text stringlengths 2 1.04M | meta dict |
|---|---|
namespace Checkpoints
{
typedef std::map<int, uint256> MapCheckpoints;
// How many times we expect transactions after the last checkpoint to
// be slower. This number is a compromise, as it can't be accurate for
// every system. When reindexing from a fast disk with a slow CPU, it
// can be up to 20, while when downloading from a slow network with a
// fast multicore CPU, it won't be much higher than 1.
static const double fSigcheckVerificationFactor = 5.0;
struct CCheckpointData {
const MapCheckpoints *mapCheckpoints;
int64 nTimeLastCheckpoint;
int64 nTransactionsLastCheckpoint;
double fTransactionsPerDay;
};
// What makes a good checkpoint block?
// + Is surrounded by blocks with reasonable timestamps
// (no blocks before with a timestamp after, none after with
// timestamp before)
// + Contains no strange transactions
static MapCheckpoints mapCheckpoints =
boost::assign::map_list_of
( 0, uint256("0x000005b25af09f023520e4e5904248a5efe8d471d7a2788b5c484bf0bab0d33f"))
( 400, uint256("0x000000032d1cce0500f309141d7a6541e92ec1c8ee58ea0ce0fb74f421306c8d"))
;
static const CCheckpointData data = {
&mapCheckpoints,
1405018733, // * UNIX timestamp of last checkpoint block
401, // * total number of transactions between genesis and last checkpoint
// (the tx=... number in the SetBestChain debug.log lines)
800.0 // * estimated number of transactions per day after checkpoint
};
static MapCheckpoints mapCheckpointsTestnet =
boost::assign::map_list_of
( 0, uint256("0000059ff4ae4152dabf0c9f3554cc179e90d97dcfa003d60cdbba3c1919b03c"))
;
static const CCheckpointData dataTestnet = {
&mapCheckpointsTestnet,
1404989919,
1,
30
};
const CCheckpointData &Checkpoints() {
if (fTestNet)
return dataTestnet;
else
return data;
}
bool CheckBlock(int nHeight, const uint256& hash)
{
if (fTestNet) return true; // Testnet has no checkpoints
if (!GetBoolArg("-checkpoints", true))
return true;
const MapCheckpoints& checkpoints = *Checkpoints().mapCheckpoints;
MapCheckpoints::const_iterator i = checkpoints.find(nHeight);
if (i == checkpoints.end()) return true;
return hash == i->second;
}
// Guess how far we are in the verification process at the given block index
double GuessVerificationProgress(CBlockIndex *pindex) {
if (pindex==NULL)
return 0.0;
int64 nNow = time(NULL);
double fWorkBefore = 0.0; // Amount of work done before pindex
double fWorkAfter = 0.0; // Amount of work left after pindex (estimated)
// Work is defined as: 1.0 per transaction before the last checkoint, and
// fSigcheckVerificationFactor per transaction after.
const CCheckpointData &data = Checkpoints();
if (pindex->nChainTx <= data.nTransactionsLastCheckpoint) {
double nCheapBefore = pindex->nChainTx;
double nCheapAfter = data.nTransactionsLastCheckpoint - pindex->nChainTx;
double nExpensiveAfter = (nNow - data.nTimeLastCheckpoint)/86400.0*data.fTransactionsPerDay;
fWorkBefore = nCheapBefore;
fWorkAfter = nCheapAfter + nExpensiveAfter*fSigcheckVerificationFactor;
} else {
double nCheapBefore = data.nTransactionsLastCheckpoint;
double nExpensiveBefore = pindex->nChainTx - data.nTransactionsLastCheckpoint;
double nExpensiveAfter = (nNow - pindex->nTime)/86400.0*data.fTransactionsPerDay;
fWorkBefore = nCheapBefore + nExpensiveBefore*fSigcheckVerificationFactor;
fWorkAfter = nExpensiveAfter*fSigcheckVerificationFactor;
}
return fWorkBefore / (fWorkBefore + fWorkAfter);
}
int GetTotalBlocksEstimate()
{
if (fTestNet) return 0; // Testnet has no checkpoints
if (!GetBoolArg("-checkpoints", true))
return 0;
const MapCheckpoints& checkpoints = *Checkpoints().mapCheckpoints;
return checkpoints.rbegin()->first;
}
CBlockIndex* GetLastCheckpoint(const std::map<uint256, CBlockIndex*>& mapBlockIndex)
{
if (fTestNet) return NULL; // Testnet has no checkpoints
if (!GetBoolArg("-checkpoints", true))
return NULL;
const MapCheckpoints& checkpoints = *Checkpoints().mapCheckpoints;
BOOST_REVERSE_FOREACH(const MapCheckpoints::value_type& i, checkpoints)
{
const uint256& hash = i.second;
std::map<uint256, CBlockIndex*>::const_iterator t = mapBlockIndex.find(hash);
if (t != mapBlockIndex.end())
return t->second;
}
return NULL;
}
uint256 GetLastAvailableCheckpoint() {
const MapCheckpoints& checkpoints = (fTestNet ? mapCheckpointsTestnet : mapCheckpoints);
BOOST_REVERSE_FOREACH(const MapCheckpoints::value_type& i, checkpoints) {
const uint256& hash = i.second;
if(mapBlockIndex.count(hash) && mapBlockIndex[hash]->IsInMainChain())
return(hash);
}
return(hashGenesisBlock);
}
uint256 GetLatestHardenedCheckpoint()
{
const MapCheckpoints& checkpoints = *Checkpoints().mapCheckpoints;
return (checkpoints.rbegin()->second);
}
} | {
"content_hash": "eb521d71c4c8433c6dda3ac943d888d4",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 104,
"avg_line_length": 38.30344827586207,
"alnum_prop": 0.6541231544832553,
"repo_name": "fvzcoin/fvzcoin",
"id": "d996db12827d6a21852ff99ad6d68a66d499910c",
"size": "5903",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/checkpoints.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "701315"
},
{
"name": "C++",
"bytes": "2678637"
},
{
"name": "CSS",
"bytes": "1127"
},
{
"name": "HTML",
"bytes": "50615"
},
{
"name": "Makefile",
"bytes": "12621"
},
{
"name": "NSIS",
"bytes": "5911"
},
{
"name": "Objective-C",
"bytes": "858"
},
{
"name": "Objective-C++",
"bytes": "5864"
},
{
"name": "Python",
"bytes": "3774"
},
{
"name": "QMake",
"bytes": "15377"
},
{
"name": "Shell",
"bytes": "8318"
}
],
"symlink_target": ""
} |
@interface ______UITests : XCTestCase
@end
@implementation ______UITests
- (void)setUp {
[super setUp];
// Put setup code here. This method is called before the invocation of each test method in the class.
// In UI tests it is usually best to stop immediately when a failure occurs.
self.continueAfterFailure = NO;
// UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
[[[XCUIApplication alloc] init] launch];
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}
- (void)tearDown {
// Put teardown code here. This method is called after the invocation of each test method in the class.
[super tearDown];
}
- (void)testExample {
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
@end
| {
"content_hash": "4a03031d55d6c63ace4137822c93ecd4",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 178,
"avg_line_length": 34.43333333333333,
"alnum_prop": 0.7047434656340755,
"repo_name": "anchoriteFili/CustomPhoto",
"id": "f27241107edcd580d90121a2c194cf497c97a887",
"size": "1217",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "定制相册部分/定制相册部分UITests/______UITests.m",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "855886"
}
],
"symlink_target": ""
} |
ActiveRecord::Schema.define(version: 20160501020445) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
create_table "dependencies", force: :cascade do |t|
t.string "name"
t.text "description"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "input_type"
end
create_table "document_dependencies", force: :cascade do |t|
t.integer "document_id"
t.integer "dependency_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "document_step_requirements", force: :cascade do |t|
t.integer "document_step_id"
t.integer "dependency_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "document_steps", force: :cascade do |t|
t.integer "document_id"
t.integer "order"
t.text "video"
t.text "description"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "documents", force: :cascade do |t|
t.string "name"
t.text "description"
t.string "type"
t.integer "genre_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "genres", force: :cascade do |t|
t.string "name"
t.text "description"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "users", force: :cascade do |t|
t.string "provider", default: "email", null: false
t.string "uid", default: "", null: false
t.string "encrypted_password", default: "", null: false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.string "confirmation_token"
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
t.string "unconfirmed_email"
t.string "name"
t.string "nickname"
t.string "image"
t.string "email"
t.json "tokens"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "users", ["email"], name: "index_users_on_email", using: :btree
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
add_index "users", ["uid", "provider"], name: "index_users_on_uid_and_provider", unique: true, using: :btree
end
| {
"content_hash": "90c9b68220668412efc7ab89dd2e9838",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 119,
"avg_line_length": 33.426829268292686,
"alnum_prop": 0.6249543962057643,
"repo_name": "amoody2108/TechForJustice",
"id": "5a54d4198fbea56897a085851eccedfe20ec14e1",
"size": "3482",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "techForJustice/db/schema.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2265"
},
{
"name": "CoffeeScript",
"bytes": "633"
},
{
"name": "HTML",
"bytes": "11265"
},
{
"name": "JavaScript",
"bytes": "642"
},
{
"name": "Ruby",
"bytes": "57483"
}
],
"symlink_target": ""
} |
namespace EduHub.Data.SchemaParser.C7
{
public class C7Role : IC7Element
{
public string Name { get; set; }
public string Description { get; set; }
public override string ToString() => $"ROLE: Name={Name}; Description={Description}";
}
}
| {
"content_hash": "91acb9bc3b2aeb690c1231022a428cd6",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 93,
"avg_line_length": 27.6,
"alnum_prop": 0.6268115942028986,
"repo_name": "garysharp/EduHub.Data",
"id": "11d7792cf0c2c3c9420cd70a8f95aa6b1b86450f",
"size": "278",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/EduHub.Data.SchemaParser/C7/C7Role.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "12134532"
}
],
"symlink_target": ""
} |
"use strict";
var ReactCompositeComponent = require('ReactCompositeComponent');
var ReactDOM = require('ReactDOM');
var ReactEventEmitter = require('ReactEventEmitter');
var EventConstants = require('EventConstants');
// Store a reference to the <form> `ReactDOMComponent`.
var form = ReactDOM.form;
/**
* Since onSubmit doesn't bubble OR capture on the top level in IE8, we need
* to capture it on the <form> element itself. There are lots of hacks we could
* do to accomplish this, but the most reliable is to make <form> a
* composite component and use `componentDidMount` to attach the event handlers.
*/
var ReactDOMForm = ReactCompositeComponent.createClass({
displayName: 'ReactDOMForm',
render: function() {
// TODO: Instead of using `ReactDOM` directly, we should use JSX. However,
// `jshint` fails to parse JSX so in order for linting to work in the open
// source repo, we need to just use `ReactDOM.form`.
return this.transferPropsTo(form(null, this.props.children));
},
componentDidMount: function() {
ReactEventEmitter.trapBubbledEvent(
EventConstants.topLevelTypes.topReset,
'reset',
this.getDOMNode()
);
ReactEventEmitter.trapBubbledEvent(
EventConstants.topLevelTypes.topSubmit,
'submit',
this.getDOMNode()
);
}
});
module.exports = ReactDOMForm;
| {
"content_hash": "8e7551cce55725c34dddfeb9a0c6437e",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 80,
"avg_line_length": 31.53488372093023,
"alnum_prop": 0.717551622418879,
"repo_name": "jordwalke/VimJSXHint",
"id": "5fab7de69b0ebd97bcdedd8a3ba9fe12f2cf7634",
"size": "1990",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "ftplugin/javascript/jslint/JSXTransformer/node_modules/react-tools/src/browser/dom/components/ReactDOMForm.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "723303"
},
{
"name": "Ruby",
"bytes": "606"
},
{
"name": "Shell",
"bytes": "1300"
},
{
"name": "VimL",
"bytes": "9009"
},
{
"name": "XML",
"bytes": "859"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
Annls mycol. 16(1/2): 36 (1918)
#### Original name
Mycosticta Höhn.
### Remarks
null | {
"content_hash": "3d4f0c8a12a226e59a5b6d3be02df927",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 13.307692307692308,
"alnum_prop": 0.6878612716763006,
"repo_name": "mdoering/backbone",
"id": "a40407f919a347dc5b784446e5411c1fe0c838d9",
"size": "213",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Fungi/Ascomycota/Mycosticta/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
<?php
if (!function_exists('nz')) {
/**
* Returns the input value if set and not null otherwise return the default value.
*
* @param mixed $input
* @param mixed $default Optional return value if the $input is considdered Zero
* @param mixed $preFix Optional. Prefix text to concat before the $input
* @param mixed $surFix Optional. Surfix text to concat after the $input
* @return mixed
*/
function nz(& $input, $default = null, $preFix = null, surFix = null)
{
$result ='';
if(isset($param)) {
if(!empty($param)) {
$result = $param;
} else {
$result = $default;
}
} else {
$result = $default;
}
if(!empty($result)) {
if(!empty($prefix)) { $result = $prefix . $result; }
if(!empty($surfix)) { $result = $result . $surfix; }
}
return $result;
}
}
| {
"content_hash": "11d46233173f23ed6bbb08eabb2de5fd",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 86,
"avg_line_length": 30.29032258064516,
"alnum_prop": 0.5260915867944622,
"repo_name": "harriedeveer/nz",
"id": "dd5b6863b5b60d92f32a6bc7cedd11390897d0e1",
"size": "1248",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/nz.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "1248"
}
],
"symlink_target": ""
} |
package com.github.awvalenti.javaweb.ingressolento.repositorios;
import java.util.List;
import javax.persistence.EntityManager;
import br.com.caelum.vraptor.ioc.Component;
import com.github.awvalenti.javaweb.ingressolento.entidades.Ingresso;
@Component
public class RepositorioIngressos {
private final EntityManager em;
public RepositorioIngressos(EntityManager em) {
this.em = em;
}
public List<Ingresso> todos() {
return em.createQuery("FROM " + Ingresso.class.getSimpleName(), Ingresso.class)
.getResultList();
}
public Ingresso comId(long id) {
return em.find(Ingresso.class, id);
}
public void incluir(Ingresso e) {
em.persist(e);
}
public Long quantidadeCompradaPor(Long usuarioId) {
return em.createQuery(""
+ "SELECT COUNT(1)"
+ " FROM " + Ingresso.class.getSimpleName()
+ " WHERE comprador.id = :usuarioId"
+ "", Long.class)
.setParameter("usuarioId", usuarioId)
.getSingleResult();
}
}
| {
"content_hash": "70bd9c317baa8f6a4ac277047f3cb01d",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 81,
"avg_line_length": 22.27906976744186,
"alnum_prop": 0.7233820459290188,
"repo_name": "awvalenti/javaweb",
"id": "7885d445bf668b0a452002eff2a46c14a0a06ba4",
"size": "958",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ingressolento-vraptor/ingressolento-vraptor/src/main/java/com/github/awvalenti/javaweb/ingressolento/repositorios/RepositorioIngressos.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "779"
},
{
"name": "Java",
"bytes": "31561"
}
],
"symlink_target": ""
} |
<?php echo $content_data["content_html"]; ?> | {
"content_hash": "f30a8837460cc62aabb1a825f6f82302",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 44,
"avg_line_length": 44,
"alnum_prop": 0.6590909090909091,
"repo_name": "mtoksuy/sharetube",
"id": "e05fbe03e76416cb0a629619432d52ca11639035",
"size": "44",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "fuel/app/views/login/admin/access/access.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "713013"
},
{
"name": "HTML",
"bytes": "2524045"
},
{
"name": "JavaScript",
"bytes": "568540"
},
{
"name": "PHP",
"bytes": "4128452"
},
{
"name": "Ruby",
"bytes": "1323"
}
],
"symlink_target": ""
} |
namespace disccord
{
namespace rest
{
namespace models
{
nickname::nickname()
: nick("")
{ }
nickname::~nickname()
{ }
void nickname::decode(web::json::value json)
{
nick = json.at("nick").as_string();
}
void nickname::encode_to(
std::unordered_map<std::string, web::json::value> &info)
{
info["nick"] = web::json::value(get_nick());
}
#define define_get_method(field_name) \
decltype(nickname::field_name) nickname::get_##field_name() { \
return field_name; \
}
define_get_method(nick)
#undef define_get_method
}
}
}
| {
"content_hash": "e215f405393c9ce2aaf28d6c38f7a53b",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 79,
"avg_line_length": 23.771428571428572,
"alnum_prop": 0.42427884615384615,
"repo_name": "FiniteReality/disccord",
"id": "3b507beb5d9d48ccc10b794dd6ca0961c2f47421",
"size": "897",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/rest/models/nickname.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "743539"
},
{
"name": "CMake",
"bytes": "5738"
},
{
"name": "Shell",
"bytes": "462"
}
],
"symlink_target": ""
} |
package main
import (
"strings"
"github.com/dghubble/go-twitter/twitter"
)
func analyzeSource(tweets []twitter.Tweet) map[string]int {
var sources = make(map[string]int)
for _, v := range tweets {
source := strings.Split(strings.Split(v.Source, ">")[1], "<")[0]
if _, ok := sources[source]; ok {
sources[source] = sources[source] + 1
} else {
sources[source] = 1
}
}
return (sources)
}
| {
"content_hash": "fc00d076541c6ff75cb20ab55704a68b",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 66,
"avg_line_length": 20.45,
"alnum_prop": 0.6381418092909535,
"repo_name": "arnaucode/argos",
"id": "d65bb47e2da93e077bec44a6866376d9dc608510",
"size": "409",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "analyzeSource.go",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Go",
"bytes": "27972"
}
],
"symlink_target": ""
} |
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2022, OpenNebula Project, OpenNebula Systems */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
/* a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
/* See the License for the specific language governing permissions and */
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
define(function(require) {
/*
FUNCTION DEFINITIONS
*/
var Locale = require('utils/locale');
var Humanize = require('utils/humanize');
function _pre(info, contextTabId) {
var element = info[Object.keys(info)[0]];
$('.resource-info-header', '#' + contextTabId).text(element.NAME);
if (element.LOCK){
$('.resource-lock-header-small', '#' + contextTabId).html("<span data-tooltip aria-haspopup='true' class='has-tip' data-disable-hover='false' tabindex='1' title="+Locale.tr(Humanize.lock_to_str(element.LOCK.LOCKED))+"><i class='fas fa-lock fa-2x'/></span>");
} else {
$('.resource-lock-header-small', '#' + contextTabId).html("<i style='color: #cacedd;' class='fas fa-unlock-alt fa-2x'/>");
}
}
function _post(info, contextTabId) {
}
return {
'pre': _pre,
'post': _post
};
});
| {
"content_hash": "6cf5a042aab32153830d9f68cc398912",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 264,
"avg_line_length": 46.86363636363637,
"alnum_prop": 0.4806013579049467,
"repo_name": "OpenNebula/one",
"id": "0be277f43a34179d8f8a05b36f2899008d16d658",
"size": "2062",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/sunstone/public/app/utils/hooks/header.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Augeas",
"bytes": "5809"
},
{
"name": "C",
"bytes": "1582926"
},
{
"name": "C++",
"bytes": "4972435"
},
{
"name": "CSS",
"bytes": "77624"
},
{
"name": "Go",
"bytes": "449317"
},
{
"name": "HTML",
"bytes": "48493"
},
{
"name": "Handlebars",
"bytes": "850880"
},
{
"name": "Java",
"bytes": "517105"
},
{
"name": "JavaScript",
"bytes": "6983132"
},
{
"name": "Jinja",
"bytes": "3712"
},
{
"name": "Lex",
"bytes": "10999"
},
{
"name": "Makefile",
"bytes": "2832"
},
{
"name": "Python",
"bytes": "199809"
},
{
"name": "Roff",
"bytes": "2086"
},
{
"name": "Ruby",
"bytes": "4919604"
},
{
"name": "SCSS",
"bytes": "44872"
},
{
"name": "Shell",
"bytes": "1116349"
},
{
"name": "Yacc",
"bytes": "35951"
}
],
"symlink_target": ""
} |
package e2e
import "testing"
func TestCtlV3RoleAdd(t *testing.T) { testCtl(t, roleAddTest) }
func TestCtlV3RoleAddNoTLS(t *testing.T) { testCtl(t, roleAddTest, withCfg(configNoTLS)) }
func TestCtlV3RoleAddClientTLS(t *testing.T) { testCtl(t, roleAddTest, withCfg(configClientTLS)) }
func TestCtlV3RoleAddPeerTLS(t *testing.T) { testCtl(t, roleAddTest, withCfg(configPeerTLS)) }
func TestCtlV3RoleAddTimeout(t *testing.T) { testCtl(t, roleAddTest, withDialTimeout(0)) }
func TestCtlV3RoleGrant(t *testing.T) { testCtl(t, roleGrantTest) }
func roleAddTest(cx ctlCtx) {
cmdSet := []struct {
args []string
expectedStr string
}{
// Add a role.
{
args: []string{"add", "root"},
expectedStr: "Role root created",
},
// Try adding the same role.
{
args: []string{"add", "root"},
expectedStr: "role name already exists",
},
}
for i, cmd := range cmdSet {
if err := ctlV3Role(cx, cmd.args, cmd.expectedStr); err != nil {
if cx.dialTimeout > 0 && !isGRPCTimedout(err) {
cx.t.Fatalf("roleAddTest #%d: ctlV3Role error (%v)", i, err)
}
}
}
}
func roleGrantTest(cx ctlCtx) {
cmdSet := []struct {
args []string
expectedStr string
}{
// Add a role.
{
args: []string{"add", "root"},
expectedStr: "Role root created",
},
// Grant read permission to the role.
{
args: []string{"grant", "root", "read", "foo"},
expectedStr: "Role root updated",
},
// Grant write permission to the role.
{
args: []string{"grant", "root", "write", "foo"},
expectedStr: "Role root updated",
},
// Grant rw permission to the role.
{
args: []string{"grant", "root", "readwrite", "foo"},
expectedStr: "Role root updated",
},
// Try granting invalid permission to the role.
{
args: []string{"grant", "root", "123", "foo"},
expectedStr: "invalid permission type",
},
}
for i, cmd := range cmdSet {
if err := ctlV3Role(cx, cmd.args, cmd.expectedStr); err != nil {
cx.t.Fatalf("roleGrantTest #%d: ctlV3Role error (%v)", i, err)
}
}
}
func ctlV3Role(cx ctlCtx, args []string, expStr string) error {
cmdArgs := append(cx.PrefixArgs(), "role")
cmdArgs = append(cmdArgs, args...)
return spawnWithExpect(cmdArgs, expStr)
}
| {
"content_hash": "db06aa1d6b4e9781c47554cce47657a1",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 98,
"avg_line_length": 27.542168674698797,
"alnum_prop": 0.6242344706911636,
"repo_name": "achanda/etcd",
"id": "7716374f2506eeeb4aa1bc9d481b7f7480a5a678",
"size": "2876",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "e2e/ctl_v3_role_test.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "941"
},
{
"name": "Go",
"bytes": "1715383"
},
{
"name": "Makefile",
"bytes": "1019"
},
{
"name": "Protocol Buffer",
"bytes": "14524"
},
{
"name": "Scheme",
"bytes": "9281"
},
{
"name": "Shell",
"bytes": "16147"
}
],
"symlink_target": ""
} |
name 'haproxy-ng'
maintainer 'Nathan Williams'
maintainer_email 'nath.e.will@gmail.com'
license 'apache2'
description 'modern, resource-driven cookbook for managing haproxy'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
source_url 'https://github.com/nathwill/chef-haproxy-ng'
issues_url 'https://github.com/nathwill/chef-haproxy-ng/issues'
version '1.2.1'
%w( fedora redhat centos scientific ubuntu ).each do |platform|
supports platform
end
depends 'apt'
depends 'ark'
depends 'systemd'
| {
"content_hash": "125a7d09dbb48e589c8ced38acf24f55",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 72,
"avg_line_length": 33.705882352941174,
"alnum_prop": 0.6945898778359512,
"repo_name": "nathwill/chef-haproxy-ng",
"id": "5d880aef674ac7c8c6558b4f4f21bee38b8bb8f1",
"size": "573",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "metadata.rb",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "257"
},
{
"name": "Ruby",
"bytes": "86770"
}
],
"symlink_target": ""
} |
'use strict';
var path = require('path');
var gutil = require('gulp-util');
var through = require('through2');
var clonedeep = require('lodash.clonedeep');
const PLUGIN_NAME = 'gulp-shopify-sass';
/*
* Most of the code in index.js are copied from gulp-sass
*/
//////////////////////////////
// Main Gulp Shopify Sass function
//////////////////////////////
var gulpShopifySass = function gulpShopifySass (options, sync) {
return through.obj(function (file, enc, cb) {
var opts, contents;
if (file.isNull()) {
return cb(null, file);
}
// do not support stream
if(file.isStream()) {
return cb(new gutil.PluginError(PLUGIN_NAME, 'Streaming not supported!'));
}
//////////////////////////////
// Handles returning the file to the stream
//////////////////////////////
var filePush = function filePush(contents) {
// console.log(file);
// console.log(file.contents);
// console.log(contents);
// file = new gutil.File({
// 'cwd': __dirname,
// 'base': file.base,
// 'path': gutil.replaceExtension(file.path, '.cat.scss.liquid'),
// 'contents': contents
// });
file.contents = new Buffer(contents);
file.path = gutil.replaceExtension(file.path, '.cat.scss.liquid');
cb(null, file);
};
//////////////////////////////
// Handles error message
//////////////////////////////
var errorM = function errorM(error) {
var relativePath = '',
filePath = error.file === 'stdin' ? file.path : error.file,
message = '';
filePath = filePath ? filePath : file.path;
relativePath = path.relative(process.cwd(), filePath);
message += gutil.colors.underline(relativePath) + '\n';
message += error.formatted;
error.messageFormatted = message;
error.messageOriginal = error.message;
// error.message = gutil.colors.stripColor(message);
error.relativePath = relativePath;
return cb(new gutil.PluginError(
PLUGIN_NAME, error
));
};
// processing buffer
if(file.isBuffer()) {
//////////////////////////////
// gulpShopifySass main process BEGIN
//////////////////////////////
opts = clonedeep(options || {});
opts.data = file.contents.toString();
// we set the file path here so that libsass can correctly resolve import paths
opts.file = file.path;
// TODO: add relavent processer
// Ensure file's parent directory in the include path
if (opts.includePaths) {
if (typeof opts.includePaths === 'string') {
opts.includePaths = [opts.includePaths];
}
} else {
opts.includePaths = [];
}
// opts.includePaths.unshift(path.dirname(file.path));
if (sync === true) {
//////////////////////////////
// Sync Sass render
//////////////////////////////
try {
contents = gulpShopifySass.compiler.renderSync(opts);
filePush(contents);
} catch (error) {
return errorM(error);
}
} else {
//////////////////////////////
// Async Sass render
//////////////////////////////
var callback = function(catFile) {
filePush(catFile);
};
gulpShopifySass.compiler.render(opts, callback, errorM);
}
//////////////////////////////
// gulpShopifySass main process END
//////////////////////////////
}
});
}
//////////////////////////////
// Sync Shopify Sass render
//////////////////////////////
gulpShopifySass.sync = function sync(options) {
return gulpShopifySass(options, true);
};
//////////////////////////////
// Log errors nicely
//////////////////////////////
gulpShopifySass.logError = function logError(error) {
var message = new gutil.PluginError('sass', error.messageFormatted).toString();
process.stderr.write(message + '\n');
this.emit('end');
};
//////////////////////////////
// Store compiler in a prop
//////////////////////////////
gulpShopifySass.compiler = require('./lib/compiler');
module.exports = gulpShopifySass;
| {
"content_hash": "56c49edd3214eab10f39bd71112ada07",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 85,
"avg_line_length": 27.30718954248366,
"alnum_prop": 0.5117280995691719,
"repo_name": "theJian/gulp-shopify-sass",
"id": "e80648cd1ddbcdff571ae4ad96f0f3500b603933",
"size": "4178",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "index.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "20415"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>infotheo: Not compatible 👼</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.14.0 / infotheo - 0.3.2</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
infotheo
<small>
0.3.2
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-07-22 03:33:14 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-07-22 03:33:14 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-threads base
base-unix base
conf-findutils 1 Virtual package relying on findutils
conf-gmp 4 Virtual package relying on a GMP lib system installation
coq 8.14.0 Formal proof management system
dune 3.3.1 Fast, portable, and opinionated build system
ocaml 4.07.1 The OCaml compiler (virtual package)
ocaml-base-compiler 4.07.1 Official release 4.07.1
ocaml-config 1 OCaml Switch Configuration
ocaml-secondary-compiler 4.08.1-1 OCaml 4.08.1 Secondary Switch Compiler
ocamlfind 1.9.1 A library manager for OCaml
ocamlfind-secondary 1.9.1 Adds support for ocaml-secondary-compiler to ocamlfind
zarith 1.12 Implements arithmetic and logical operations over arbitrary-precision integers
# opam file:
opam-version: "2.0"
maintainer: "Reynald Affeldt <reynald.affeldt@aist.go.jp>"
homepage: "https://github.com/affeldt-aist/infotheo"
dev-repo: "git+https://github.com/affeldt-aist/infotheo.git"
bug-reports: "https://github.com/affeldt-aist/infotheo/issues"
license: "LGPL-2.1-or-later"
synopsis: "Discrete probabilities and information theory for Coq"
description: """
Infotheo is a Coq library for reasoning about discrete probabilities,
information theory, and linear error-correcting codes."""
build: [
[make "-j%{jobs}%" ]
[make "-C" "extraction" "tests"] {with-test}
]
install: [make "install"]
depends: [
"coq" { (>= "8.13" & < "8.14~") | (= "dev") }
"coq-mathcomp-ssreflect" { (>= "1.12.0" & < "1.13~") }
"coq-mathcomp-fingroup" { (>= "1.12.0" & < "1.13~") }
"coq-mathcomp-algebra" { (>= "1.12.0" & < "1.13~") }
"coq-mathcomp-solvable" { (>= "1.12.0" & < "1.13~") }
"coq-mathcomp-field" { (>= "1.12.0" & < "1.13~") }
"coq-mathcomp-analysis" { (>= "0.3.6" & < "0.3.8") }
]
tags: [
"keyword:information theory"
"keyword:probability"
"keyword:error-correcting codes"
"keyword:convexity"
"logpath:infotheo"
"date:2021-03-23"
]
authors: [
"Reynald Affeldt, AIST"
"Manabu Hagiwara, Chiba U. (previously AIST)"
"Jonas Senizergues, ENS Cachan (internship at AIST)"
"Jacques Garrigue, Nagoya U."
"Kazuhiko Sakaguchi, Tsukuba U."
"Taku Asai, Nagoya U. (M2)"
"Takafumi Saikawa, Nagoya U."
"Naruomi Obata, Titech (M2)"
]
url {
http: "https://github.com/affeldt-aist/infotheo/archive/0.3.2.tar.gz"
checksum: "sha512=ab3a82c343eb3b1fc164e95cc963612310f06a400e3fb9781c28b4afb37356a57a99d236cd788d925ae5f2c8ce8f96850ad40d5a79306daca69db652c268d5f8"
}
</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-infotheo.0.3.2 coq.8.14.0</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.14.0).
The following dependencies couldn't be met:
- coq-infotheo -> coq (< 8.14~ & = dev) -> ocaml < 4.06.0
base of this switch (use `--unlock-base' to force)
Your request can't be satisfied:
- No available version of coq satisfies the constraints
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-infotheo.0.3.2</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://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>
| {
"content_hash": "5917f9dde187d33e7a4618a6e13ef03c",
"timestamp": "",
"source": "github",
"line_count": 190,
"max_line_length": 159,
"avg_line_length": 43.873684210526314,
"alnum_prop": 0.5604606525911708,
"repo_name": "coq-bench/coq-bench.github.io",
"id": "dfd11ce2f63da5e113ce4cbf97f9cae696840942",
"size": "8361",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clean/Linux-x86_64-4.07.1-2.0.6/released/8.14.0/infotheo/0.3.2.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
import * as Babel from "@babel/core";
// import metadataPlugin from "./metadataPlugin";
// take from @babel/standalone
import {
presets as availablePresets,
plugins as availablePlugins,
} from "./plugins-list";
export function transpilePlugin(pluginString) {
return Babel.transform(pluginString, {
babelrc: false,
configFile: false,
ast: false,
highlightCode: false,
presets: [
[
availablePresets["@babel/preset-env"],
{ loose: true, shippedProposals: true },
],
[
availablePresets["@babel/preset-typescript"],
{
isTSX: true,
allExtensions: true,
allowDeclareFields: true,
allowNamespaces: true,
onlyRemoveTypeImports: true,
},
],
],
// TODO: figure out file url issue
// plugins: [metadataPlugin],
}).code;
}
// astexplorer
export default function compileModule(code, globals = {}) {
const exports = {};
const module = { exports };
const globalNames = Object.keys(globals);
const keys = ["module", "exports", ...globalNames];
const values = [module, exports, ...globalNames.map(key => globals[key])];
// eslint-disable-next-line no-new-func
new Function(keys.join(), code).apply(exports, values);
return module.exports;
}
export function loadBuiltin(builtinTable, name) {
if (Array.isArray(name) && typeof name[0] === "string") {
if (Object.prototype.hasOwnProperty.call(builtinTable, name[0])) {
return [builtinTable[name[0]]].concat(name.slice(1));
}
return;
} else if (typeof name === "string") {
return builtinTable[name];
}
// Could be an actual preset/plugin module
return name;
}
export function processOptions(options, customPlugin) {
if (typeof options === "string") options = JSON.parse(options);
// Parse preset names
const presets = (options.presets || []).map(presetName => {
const preset = loadBuiltin(availablePresets, presetName);
if (preset) {
// workaround for babel issue
// at some point, babel copies the preset, losing the non-enumerable
// buildPreset key; convert it into an enumerable key.
if (
Array.isArray(preset) &&
typeof preset[0] === "object" &&
Object.prototype.hasOwnProperty.call(preset[0], "buildPreset")
) {
preset[0] = { ...preset[0], buildPreset: preset[0].buildPreset };
}
} else {
throw new Error(
`Invalid preset specified in Babel options: "${presetName}"`
);
}
return preset;
});
// Parse plugin names
const plugins = (options.plugins || []).map(pluginName => {
const plugin = loadBuiltin(availablePlugins, pluginName);
if (!plugin) {
throw new Error(
`Invalid plugin specified in Babel options: "${pluginName}"`
);
}
return plugin;
});
if (customPlugin) {
customPlugin = transpilePlugin(customPlugin);
plugins.unshift(compileModule(customPlugin));
}
const handledVisitors = [
"ArrayExpression",
"ArrayPattern",
"ArrowFunctionExpression",
"AssignmentExpression",
"AssignmentPattern",
"BinaryExpression",
"BlockStatement",
"BreakStatement",
"CallExpression",
"CatchClause",
"ConditionalExpression",
"ContinueStatement",
"DebuggerStatement",
"Directive",
"EmptyStatement",
"ExpressionStatement",
"ForInStatement",
"ForOfStatement",
"ForStatement",
"FunctionExpression",
"FunctionDeclaration",
"Identifier",
"IfStatement",
"Import",
"JSXAttribute",
"LabeledStatement",
"Literal",
"LogicalExpression",
"MemberExpression",
"MetaProperty",
"NewExpression",
"ObjectExpression",
"ObjectPattern",
"ObjectProperty",
"RestElement",
"SequenceExpression",
"SpreadElement",
"Super",
"SwitchCase",
"SwitchStatement",
"TemplateElement",
"ThisExpression",
"ThrowStatement",
"TryStatement",
"ReturnStatement",
"UnaryExpression",
"UpdateExpression",
"VariableDeclaration",
].join("|");
// TODO: test
plugins.unshift(function customPlugin2({ types: t }) {
return {
name: "mark-original-loc",
pre(file) {
// file.opts.generatorOpts.compact = true;
if (options.sourceMaps) {
file.opts.generatorOpts.sourceFileName = "input.js";
file.opts.sourceMaps = "inline";
}
},
visitor: {
[handledVisitors](path) {
if (!path.node._sourceNode) {
path.node._sourceNode = path.node._sourceNodes?.[0] || {
...t.cloneNode(path.node, true),
_newNode: true,
};
}
},
},
};
});
return {
ast: true,
sourceMaps: options.sourceMaps,
filename: "input.js",
parserOpts: {
tokens: true,
plugins: [
"typescript",
"jsx",
"classProperties",
"classPrivateProperties",
"classPrivateMethods",
"decimal",
],
},
babelrc: false,
configFile: false,
...options,
presets,
plugins,
// for each visitor
// wrapPluginVisitorMethod(pluginAlias, visitorType, callback) {
// return function (...args) {
// let node = args[0].node;
// callback.call(this, ...args);
// };
// },
};
}
| {
"content_hash": "47150db9fcb51c5b3316a3414fd90765",
"timestamp": "",
"source": "github",
"line_count": 208,
"max_line_length": 76,
"avg_line_length": 25.79326923076923,
"alnum_prop": 0.6029822926374651,
"repo_name": "hzoo/babel",
"id": "7b1fe0cf91fa82a4f96d3d791da9ad57c19c0b1c",
"size": "5412",
"binary": false,
"copies": "1",
"ref": "refs/heads/mapping",
"path": "sandbox/src/standalone.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "4028"
},
{
"name": "JavaScript",
"bytes": "1800462"
},
{
"name": "Makefile",
"bytes": "7540"
},
{
"name": "Prolog",
"bytes": "4720"
},
{
"name": "Shell",
"bytes": "18622"
},
{
"name": "TypeScript",
"bytes": "2144706"
}
],
"symlink_target": ""
} |
<nav class="navBar navBar--sub navBar--account">
<ul class="navBar-section">
{{#if account_page '===' 'orders'}}
{{#if page_type '===' 'account_order'}}
<li class="navBar-item is-active">
<a class="navBar-action" href="{{urls.account.orders.all}}">{{lang 'account.nav.orders'}}</a>
</li>
{{else}}
<li class="navBar-item is-active">{{lang 'account.nav.orders'}}</li>
{{/if}}
{{else}}
<li class="navBar-item">
<a class="navBar-action" href="{{urls.account.orders.all}}">{{lang 'account.nav.orders'}}</a>
</li>
{{/if}}
{{#if settings.returns_enabled}}
{{#if account_page '===' 'returns'}}
<li class="navBar-item is-active">{{lang 'account.nav.returns'}}</li>
{{else}}
<li class="navBar-item">
<a class="navBar-action" href="{{urls.account.returns}}">{{lang 'account.nav.returns'}}</a>
</li>
{{/if}}
{{/if}}
{{#if account_page '===' 'messages'}}
<li class="navBar-item is-active">{{lang 'account.nav.messages' num_new_messages=customer.num_new_messages}}</li>
{{else}}
<li class="navBar-item">
<a class="navBar-action" href="{{urls.account.inbox}}">{{lang 'account.nav.messages' num_new_messages=customer.num_new_messages}}</a>
</li>
{{/if}}
{{#if account_page '===' 'addresses'}}
<li class="navBar-item is-active">{{lang 'account.nav.addresses'}}</li>
{{else}}
<li class="navBar-item">
<a class="navBar-action" href="{{urls.account.addresses}}">{{lang 'account.nav.addresses'}}</a>
</li>
{{/if}}
{{#if settings.show_payment_methods}}
{{#if account_page '===' 'payment_methods'}}
<li class="navBar-item is-active">{{lang 'account.nav.payment_methods'}}</li>
{{else}}
<li class="navBar-item">
<a class="navBar-action" href="{{urls.account.payment_methods.all}}">{{lang 'account.nav.payment_methods'}}</a>
</li>
{{/if}}
{{/if}}
{{#if settings.show_wishlist}}
{{#if account_page '===' 'wishlists'}}
<li class="navBar-item is-active">{{lang 'account.nav.wishlists' num_wishlists=customer.num_wishlists}}</li>
{{else}}
<li class="navBar-item">
<a class="navBar-action" href="{{urls.account.wishlists.all}}">{{lang 'account.nav.wishlists' num_wishlists=customer.num_wishlists}}</a>
</li>
{{/if}}
{{/if}}
{{#if account_page '===' 'recent_items'}}
<li class="navBar-item is-active">{{lang 'account.nav.recently_viewed'}}</li>
{{else}}
<li class="navBar-item">
<a class="navBar-action" href="{{urls.account.recent_items}}">{{lang 'account.nav.recently_viewed'}}</a>
</li>
{{/if}}
{{#if account_page '===' 'settings'}}
<li class="navBar-item is-active">{{lang 'account.nav.settings'}}</li>
{{else}}
<li class="navBar-item">
<a class="navBar-action" href="{{urls.account.details}}">{{lang 'account.nav.settings'}}</a>
</li>
{{/if}}
</ul>
</nav>
| {
"content_hash": "57a0fece09afc910c1792bf9e2e55ada",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 156,
"avg_line_length": 48.19444444444444,
"alnum_prop": 0.49279538904899134,
"repo_name": "bigcommerce/stencil",
"id": "b31dbb576088b4a0ab994ee7a54b0dfb43eba4c9",
"size": "3470",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "templates/components/account/navigation.html",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "289819"
},
{
"name": "HTML",
"bytes": "301440"
},
{
"name": "JavaScript",
"bytes": "201200"
},
{
"name": "Ruby",
"bytes": "291"
}
],
"symlink_target": ""
} |
<?php
/*
Safe sample
input : Uses popen to read the file /tmp/tainted.txt using cat command
SANITIZE : use of mysql_real_escape string
construction : use of sprintf via a %d with simple quote
*/
/*Copyright 2015 Bertrand STIVALET
Permission is hereby granted, without written agreement or royalty fee, to
use, copy, modify, and distribute this software and its documentation for
any purpose, provided that the above copyright notice and the following
three paragraphs appear in all copies of this software.
IN NO EVENT SHALL AUTHORS BE LIABLE TO ANY PARTY FOR DIRECT,
INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF AUTHORS HAVE
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
AUTHORS SPECIFICALLY DISCLAIM ANY WARRANTIES INCLUDING, BUT NOT
LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
THE SOFTWARE IS PROVIDED ON AN "AS-IS" BASIS AND AUTHORS HAVE NO
OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
MODIFICATIONS.*/
$handle = popen('/bin/cat /tmp/tainted.txt', 'r');
$tainted = fread($handle, 4096);
pclose($handle);
$tainted = mysql_real_escape_string($tainted);
$var = require(sprintf("pages/'%d'.php", $tainted));
?> | {
"content_hash": "768ad05a44ed8e2cd1f6a581c4a57b3c",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 75,
"avg_line_length": 23.5,
"alnum_prop": 0.7644376899696048,
"repo_name": "stivalet/PHP-Vulnerability-test-suite",
"id": "8a274b7bbbcec8713622073b7a0efaf353c498c5",
"size": "1316",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Injection/CWE_98/safe/CWE_98__popen__func_mysql_real_escape_string__require_file_id-sprintf_%d_simple_quote.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "64184004"
}
],
"symlink_target": ""
} |
package natlab.backends.Fortran.codegen_simplified.astCaseHandler;
import java.util.ArrayList;
import java.util.List;
import natlab.backends.Fortran.codegen_simplified.FortranAST_simplified.RigorousIndexingTransformation;
import natlab.tame.valueanalysis.components.shape.DimValue;
public class ArraySetIndexingTransformation {
public static RigorousIndexingTransformation getTransformedIndex(
String lhsArrayName,
String valueName,
List<DimValue> lhsArrayDimension,
ArrayList<String> lhsIndex) {
RigorousIndexingTransformation transformedArraySet = new RigorousIndexingTransformation();
StringBuffer sb = new StringBuffer();
sb.append("CALL ARRAY_SET");
sb.append(lhsArrayDimension.size());
for (int i=0; i<lhsIndex.size(); i++) {
String[] vectorIndex = lhsIndex.get(i).split(":");
if (lhsIndex.get(i).equals(":")) {
sb.append("C");
}
else if (vectorIndex.length==2) {
sb.append("V");
}
else {
sb.append("S");
}
}
sb.append("(");
sb.append(lhsArrayName+", ");
for (int i=0; i<lhsArrayDimension.size(); i++) {
sb.append(lhsArrayDimension.get(i)+", ");
}
for (int i=0; i<lhsIndex.size(); i++) {
String[] vectorIndex = lhsIndex.get(i).split(":");
if (lhsIndex.get(i).equals(":")) {
// do nothing.
}
else if (vectorIndex.length==2) {
sb.append(vectorIndex[0]+", "+vectorIndex[1]+", ");
}
else {
sb.append(lhsIndex.get(i)+", ");
}
}
sb.append(valueName+");");
transformedArraySet.setFunctionCall(sb.toString());
return transformedArraySet;
}
}
| {
"content_hash": "59a13e8f4bdc7f49c14cf52ed15fcefe",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 103,
"avg_line_length": 29.433962264150942,
"alnum_prop": 0.6814102564102564,
"repo_name": "Sable/Mc2For",
"id": "732d18c3b517616b2f7e5442e006db3f3bf34b4b",
"size": "1560",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "languages/Natlab/src/natlab/backends/Fortran/codegen_simplified/astCaseHandler/ArraySetIndexingTransformation.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "66122"
},
{
"name": "Java",
"bytes": "297885"
}
],
"symlink_target": ""
} |
`user_management.models.mixins.AvatarMixin` adds an avatar field. The
serializers for this field require `django-imagekit` to be installed.
## Installation
To install `django-user-management` with avatar functionality:
pip install django-user-management[avatar]
Add the urls to your `ROOT_URLCONF`:
urlpatterns = [
...
url(r'', include('user_management.api.avatar.urls.avatar')),
...
]
## View
`user_management.api.avatar.views.ProfileAvatar` provides an endpoint to retrieve
and update the logged-in user's avatar.
`user_management.api.avatar.views.UserAvatar` provides an endpoint to retrieve
and update another user's avatar. Only an admin user can update other users' data.
Both avatar views provides an endpoint to retrieve a thumbnail of the
authenticated user's avatar.
Thumbnail options can be specified as GET arguments. Options are:
width: Specify the width (in pixels) to resize/crop to.
height: Specify the height (in pixels) to resize/crop to.
crop: Whether to crop or not (allowed values: 0 or 1)
anchor: Where to anchor the crop, top/bottom/left/right (allowed values: t, b, l, r)
upscale: Whether to upscale or not (allowed values: 0 or 1)
If no options are specified, the user's avatar is returned.
For example, to return an avatar cropped to 100x100 anchored to the top right:
avatar?width=100&height=100&crop=1&anchor=tr
| {
"content_hash": "955fa1ef66cb0f3e62064e9c40dda4dd",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 88,
"avg_line_length": 36.205128205128204,
"alnum_prop": 0.7393767705382436,
"repo_name": "incuna/django-user-management",
"id": "23436cc61a7e21511cb0961d0950eb4aa4da3934",
"size": "1432",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/avatar.md",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "HTML",
"bytes": "1163"
},
{
"name": "Makefile",
"bytes": "443"
},
{
"name": "Python",
"bytes": "179550"
}
],
"symlink_target": ""
} |
//
// PulseQueuedTape.hpp
// Clock Signal
//
// Created by Thomas Harte on 16/07/2017.
// Copyright 2017 Thomas Harte. All rights reserved.
//
#ifndef PulseQueuedTape_hpp
#define PulseQueuedTape_hpp
#include "Tape.hpp"
#include <vector>
namespace Storage {
namespace Tape {
/*!
Provides a @c Tape with a queue of upcoming pulses and an is-at-end flag.
If is-at-end is set then get_next_pulse() returns a second of silence and
is_at_end() returns true.
Otherwise get_next_pulse() returns something from the pulse queue if there is
anything there, and otherwise calls get_next_pulses(). get_next_pulses() is
virtual, giving subclasses a chance to provide the next batch of pulses.
*/
class PulseQueuedTape: public Tape {
public:
PulseQueuedTape();
bool is_at_end();
protected:
void emplace_back(Tape::Pulse::Type type, Time length);
void emplace_back(const Tape::Pulse &&pulse);
void clear();
bool empty();
void set_is_at_end(bool);
virtual void get_next_pulses() = 0;
private:
Pulse virtual_get_next_pulse();
Pulse silence();
std::vector<Pulse> queued_pulses_;
std::size_t pulse_pointer_;
bool is_at_end_;
};
}
}
#endif /* PulseQueuedTape_hpp */
| {
"content_hash": "8d92bed8aabbe31ece59bafb0cc48e2d",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 78,
"avg_line_length": 22.14814814814815,
"alnum_prop": 0.7065217391304348,
"repo_name": "TomHarte/CLK",
"id": "a55e717be3a01ec35c5db1cfae2ad368d91eb26e",
"size": "1196",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Storage/Tape/PulseQueuedTape.hpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "162880"
},
{
"name": "BASIC",
"bytes": "59"
},
{
"name": "C",
"bytes": "6346"
},
{
"name": "C++",
"bytes": "3969642"
},
{
"name": "Jinja",
"bytes": "6456"
},
{
"name": "Makefile",
"bytes": "861"
},
{
"name": "Metal",
"bytes": "24558"
},
{
"name": "Objective-C",
"bytes": "74491"
},
{
"name": "Objective-C++",
"bytes": "664345"
},
{
"name": "Python",
"bytes": "6775"
},
{
"name": "QMake",
"bytes": "9532"
},
{
"name": "R",
"bytes": "11537"
},
{
"name": "Swift",
"bytes": "214587"
}
],
"symlink_target": ""
} |
import {
TestComponentBuilder,
describe,
expect,
injectAsync,
it,
} from 'angular2/testing_internal';
import {Component, View} from 'angular2/core';
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
import {HomeCmp} from './home';
export function main() {
describe('Home component', () => {
it('should work',
injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
return tcb.overrideTemplate(TestComponent, '<div><home></home></div>')
.createAsync(TestComponent)
.then((rootTC) => {
let homeDOMEl = rootTC.debugElement.componentViewChildren[0].nativeElement;
expect(DOM.querySelectorAll(homeDOMEl, 'h1')[0].textContent).toEqual('Home');
});
}));
});
}
@Component({selector: 'test-cmp'})
@View({directives: [HomeCmp]})
class TestComponent {}
| {
"content_hash": "4af9816d807b3f64f9c63ce63c3c45c4",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 89,
"avg_line_length": 29.620689655172413,
"alnum_prop": 0.6507566938300349,
"repo_name": "kiwikern/expra",
"id": "da898bb6179f08430577f12e207ef3e457c187b4",
"size": "859",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/components/home/home_spec.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "817"
},
{
"name": "HTML",
"bytes": "7255"
},
{
"name": "JavaScript",
"bytes": "29943"
},
{
"name": "TypeScript",
"bytes": "14494"
}
],
"symlink_target": ""
} |
from decimal import *
import getpass
import math
import os
import os.path
import platform
import sys
import time
from jsonrpc import ServiceProxy, json
BASE_FEE=Decimal("0.001")
def check_json_precision():
"""Make sure json library being used does not lose precision converting CARBON values"""
n = Decimal("20000000.00000003")
satoshis = int(json.loads(json.dumps(float(n)))*1.0e8)
if satoshis != 2000000000000003:
raise RuntimeError("JSON encode/decode loses precision")
def determine_db_dir():
"""Return the default location of the carboncoin data directory"""
if platform.system() == "Darwin":
return os.path.expanduser("~/Library/Application Support/Carboncoin/")
elif platform.system() == "Windows":
return os.path.join(os.environ['APPDATA'], "Carboncoin")
return os.path.expanduser("~/.carboncoin")
def read_carboncoin_config(dbdir):
"""Read the carboncoin.conf file from dbdir, returns dictionary of settings"""
from ConfigParser import SafeConfigParser
class FakeSecHead(object):
def __init__(self, fp):
self.fp = fp
self.sechead = '[all]\n'
def readline(self):
if self.sechead:
try: return self.sechead
finally: self.sechead = None
else:
s = self.fp.readline()
if s.find('#') != -1:
s = s[0:s.find('#')].strip() +"\n"
return s
config_parser = SafeConfigParser()
config_parser.readfp(FakeSecHead(open(os.path.join(dbdir, "carboncoin.conf"))))
return dict(config_parser.items("all"))
def connect_JSON(config):
"""Connect to a carboncoin JSON-RPC server"""
testnet = config.get('testnet', '0')
testnet = (int(testnet) > 0) # 0/1 in config file, convert to True/False
if not 'rpcport' in config:
config['rpcport'] = 18332 if testnet else 8332
connect = "http://%s:%s@127.0.0.1:%s"%(config['rpcuser'], config['rpcpassword'], config['rpcport'])
try:
result = ServiceProxy(connect)
# ServiceProxy is lazy-connect, so send an RPC command mostly to catch connection errors,
# but also make sure the carboncoind we're talking to is/isn't testnet:
if result.getmininginfo()['testnet'] != testnet:
sys.stderr.write("RPC server at "+connect+" testnet setting mismatch\n")
sys.exit(1)
return result
except:
sys.stderr.write("Error connecting to RPC server at "+connect+"\n")
sys.exit(1)
def unlock_wallet(carboncoind):
info = carboncoind.getinfo()
if 'unlocked_until' not in info:
return True # wallet is not encrypted
t = int(info['unlocked_until'])
if t <= time.time():
try:
passphrase = getpass.getpass("Wallet is locked; enter passphrase: ")
carboncoind.walletpassphrase(passphrase, 5)
except:
sys.stderr.write("Wrong passphrase\n")
info = carboncoind.getinfo()
return int(info['unlocked_until']) > time.time()
def list_available(carboncoind):
address_summary = dict()
address_to_account = dict()
for info in carboncoind.listreceivedbyaddress(0):
address_to_account[info["address"]] = info["account"]
unspent = carboncoind.listunspent(0)
for output in unspent:
# listunspent doesn't give addresses, so:
rawtx = carboncoind.getrawtransaction(output['txid'], 1)
vout = rawtx["vout"][output['vout']]
pk = vout["scriptPubKey"]
# This code only deals with ordinary pay-to-carboncoin-address
# or pay-to-script-hash outputs right now; anything exotic is ignored.
if pk["type"] != "pubkeyhash" and pk["type"] != "scripthash":
continue
address = pk["addresses"][0]
if address in address_summary:
address_summary[address]["total"] += vout["value"]
address_summary[address]["outputs"].append(output)
else:
address_summary[address] = {
"total" : vout["value"],
"outputs" : [output],
"account" : address_to_account.get(address, "")
}
return address_summary
def select_coins(needed, inputs):
# Feel free to improve this, this is good enough for my simple needs:
outputs = []
have = Decimal("0.0")
n = 0
while have < needed and n < len(inputs):
outputs.append({ "txid":inputs[n]["txid"], "vout":inputs[n]["vout"]})
have += inputs[n]["amount"]
n += 1
return (outputs, have-needed)
def create_tx(carboncoind, fromaddresses, toaddress, amount, fee):
all_coins = list_available(carboncoind)
total_available = Decimal("0.0")
needed = amount+fee
potential_inputs = []
for addr in fromaddresses:
if addr not in all_coins:
continue
potential_inputs.extend(all_coins[addr]["outputs"])
total_available += all_coins[addr]["total"]
if total_available < needed:
sys.stderr.write("Error, only %f CARBON available, need %f\n"%(total_available, needed));
sys.exit(1)
#
# Note:
# Python's json/jsonrpc modules have inconsistent support for Decimal numbers.
# Instead of wrestling with getting json.dumps() (used by jsonrpc) to encode
# Decimals, I'm casting amounts to float before sending them to carboncoind.
#
outputs = { toaddress : float(amount) }
(inputs, change_amount) = select_coins(needed, potential_inputs)
if change_amount > BASE_FEE: # don't bother with zero or tiny change
change_address = fromaddresses[-1]
if change_address in outputs:
outputs[change_address] += float(change_amount)
else:
outputs[change_address] = float(change_amount)
rawtx = carboncoind.createrawtransaction(inputs, outputs)
signed_rawtx = carboncoind.signrawtransaction(rawtx)
if not signed_rawtx["complete"]:
sys.stderr.write("signrawtransaction failed\n")
sys.exit(1)
txdata = signed_rawtx["hex"]
return txdata
def compute_amount_in(carboncoind, txinfo):
result = Decimal("0.0")
for vin in txinfo['vin']:
in_info = carboncoind.getrawtransaction(vin['txid'], 1)
vout = in_info['vout'][vin['vout']]
result = result + vout['value']
return result
def compute_amount_out(txinfo):
result = Decimal("0.0")
for vout in txinfo['vout']:
result = result + vout['value']
return result
def sanity_test_fee(carboncoind, txdata_hex, max_fee):
class FeeError(RuntimeError):
pass
try:
txinfo = carboncoind.decoderawtransaction(txdata_hex)
total_in = compute_amount_in(carboncoind, txinfo)
total_out = compute_amount_out(txinfo)
if total_in-total_out > max_fee:
raise FeeError("Rejecting transaction, unreasonable fee of "+str(total_in-total_out))
tx_size = len(txdata_hex)/2
kb = tx_size/1000 # integer division rounds down
if kb > 1 and fee < BASE_FEE:
raise FeeError("Rejecting no-fee transaction, larger than 1000 bytes")
if total_in < 0.01 and fee < BASE_FEE:
raise FeeError("Rejecting no-fee, tiny-amount transaction")
# Exercise for the reader: compute transaction priority, and
# warn if this is a very-low-priority transaction
except FeeError as err:
sys.stderr.write((str(err)+"\n"))
sys.exit(1)
def main():
import optparse
parser = optparse.OptionParser(usage="%prog [options]")
parser.add_option("--from", dest="fromaddresses", default=None,
help="addresses to get carboncoins from")
parser.add_option("--to", dest="to", default=None,
help="address to get send carboncoins to")
parser.add_option("--amount", dest="amount", default=None,
help="amount to send")
parser.add_option("--fee", dest="fee", default="0.0",
help="fee to include")
parser.add_option("--datadir", dest="datadir", default=determine_db_dir(),
help="location of carboncoin.conf file with RPC username/password (default: %default)")
parser.add_option("--testnet", dest="testnet", default=False, action="store_true",
help="Use the test network")
parser.add_option("--dry_run", dest="dry_run", default=False, action="store_true",
help="Don't broadcast the transaction, just create and print the transaction data")
(options, args) = parser.parse_args()
check_json_precision()
config = read_carboncoin_config(options.datadir)
if options.testnet: config['testnet'] = True
carboncoind = connect_JSON(config)
if options.amount is None:
address_summary = list_available(carboncoind)
for address,info in address_summary.iteritems():
n_transactions = len(info['outputs'])
if n_transactions > 1:
print("%s %.8f %s (%d transactions)"%(address, info['total'], info['account'], n_transactions))
else:
print("%s %.8f %s"%(address, info['total'], info['account']))
else:
fee = Decimal(options.fee)
amount = Decimal(options.amount)
while unlock_wallet(carboncoind) == False:
pass # Keep asking for passphrase until they get it right
txdata = create_tx(carboncoind, options.fromaddresses.split(","), options.to, amount, fee)
sanity_test_fee(carboncoind, txdata, amount*Decimal("0.01"))
if options.dry_run:
print(txdata)
else:
txid = carboncoind.sendrawtransaction(txdata)
print(txid)
if __name__ == '__main__':
main()
| {
"content_hash": "eb6908a87b581c1b2d9127b863bc5af6",
"timestamp": "",
"source": "github",
"line_count": 252,
"max_line_length": 111,
"avg_line_length": 38.86904761904762,
"alnum_prop": 0.6202143950995406,
"repo_name": "carboncointrust/CarboncoinCore",
"id": "7faa033e2ac16059a82f2a47d83f23331f59c89e",
"size": "10182",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "contrib/spendfrom/spendfrom.py",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "49954"
},
{
"name": "C++",
"bytes": "3092916"
},
{
"name": "CSS",
"bytes": "1127"
},
{
"name": "HTML",
"bytes": "50620"
},
{
"name": "M4",
"bytes": "114315"
},
{
"name": "Makefile",
"bytes": "33017"
},
{
"name": "Objective-C",
"bytes": "1055"
},
{
"name": "Objective-C++",
"bytes": "6336"
},
{
"name": "Python",
"bytes": "118531"
},
{
"name": "QMake",
"bytes": "2022"
},
{
"name": "Roff",
"bytes": "18320"
},
{
"name": "Shell",
"bytes": "51272"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<!--
* Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
* source code is governed by a BSD-style license that can be found in the
* LICENSE file.
-->
<html>
<head>
<title>OAuth Redirect Page</title>
<style type="text/css">
body {
font: 16px Arial;
color: #333;
}
</style>
<script type="text/javascript" src="js/lib/chrome_ex_oauthsimple.js"></script>
<script type="text/javascript" src="js/lib/chrome_ex_oauth.js"></script>
<script type="text/javascript" src="js/lib/chrome_ex_onload.js"></script>
</head>
<body>
Redirecting...
</body>
</html>
| {
"content_hash": "a02019430832de6e789226ce51f00298",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 82,
"avg_line_length": 28.391304347826086,
"alnum_prop": 0.6294027565084227,
"repo_name": "yonchu/vimmers-follow-status",
"id": "f1fcc4d5affa56f17cb31282759b299db58d8666",
"size": "653",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "contents/chrome_ex_oauth.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1018"
},
{
"name": "CoffeeScript",
"bytes": "6453"
},
{
"name": "JavaScript",
"bytes": "43353"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html>
<head>
<title>OriDomi</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<link rel="stylesheet" media="all" href="docco.css" />
</head>
<body>
<div id="container">
<div id="background"></div>
<ul class="sections">
<li id="section-1">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-1">¶</a>
</div>
<h1 id="oridomi">OriDomi</h1>
<h3 id="fold-up-the-dom-like-paper-">Fold up the DOM like paper.</h3>
<p>1.1.5</p>
</div>
</li>
<li id="section-2">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-2">¶</a>
</div>
<p><a href="http://oridomi.com">oridomi.com</a></p>
<h4 id="by-dan-motzenbecker-http-oxism-com-">by <a href="http://oxism.com">Dan Motzenbecker</a></h4>
</div>
</li>
<li id="section-3">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-3">¶</a>
</div>
<p>Copyright 2014, MIT License</p>
</div>
<div class="content"><div class='highlight'><pre>
libName = <span class="hljs-string">'OriDomi'</span></pre></div></div>
</li>
<li id="section-4">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-4">¶</a>
</div>
<p>This variable is set to true and negated later if the browser does
not support OriDomi.</p>
</div>
<div class="content"><div class='highlight'><pre>isSupported = <span class="hljs-literal">true</span></pre></div></div>
</li>
<li id="section-5">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-5">¶</a>
</div>
<h1 id="utility-functions">Utility Functions</h1>
</div>
</li>
<li id="section-6">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-6">¶</a>
</div>
</div>
</li>
<li id="section-7">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-7">¶</a>
</div>
<p>Used for informing the developer which required feature the browser lacks.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">supportWarning</span> = <span class="hljs-params">(prop)</span> -></span>
<span class="hljs-built_in">console</span>?.warn <span class="hljs-string">"<span class="hljs-subst">#{ libName }</span>: Missing support for `<span class="hljs-subst">#{ prop }</span>`."</span>
isSupported = <span class="hljs-literal">false</span></pre></div></div>
</li>
<li id="section-8">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-8">¶</a>
</div>
<p>Checks for the presence of CSS properties on a test element.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">testProp</span> = <span class="hljs-params">(prop)</span> -></span></pre></div></div>
</li>
<li id="section-9">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-9">¶</a>
</div>
<p>Loop through the vendor prefix list and return a match is found.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">for</span> prefix <span class="hljs-keyword">in</span> prefixList
<span class="hljs-keyword">return</span> full <span class="hljs-keyword">if</span> (full = prefix + capitalize prop) <span class="hljs-keyword">of</span> testEl.style</pre></div></div>
</li>
<li id="section-10">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-10">¶</a>
</div>
<p>If the unprefixed property is present, return it.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">return</span> prop <span class="hljs-keyword">if</span> prop <span class="hljs-keyword">of</span> testEl.style</pre></div></div>
</li>
<li id="section-11">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-11">¶</a>
</div>
<p>If no matches are found, return false to denote that the browser is
missing this property.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-literal">false</span></pre></div></div>
</li>
<li id="section-12">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-12">¶</a>
</div>
<p>Generates CSS text based on a selector string and a map of styling rules.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">addStyle</span> = <span class="hljs-params">(selector, rules)</span> -></span>
style = <span class="hljs-string">".<span class="hljs-subst">#{ selector }</span>{"</span>
<span class="hljs-keyword">for</span> prop, val <span class="hljs-keyword">of</span> rules</pre></div></div>
</li>
<li id="section-13">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-13">¶</a>
</div>
<p>If the CSS property is among special properties defined later, prefix it.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> prop <span class="hljs-keyword">of</span> css
prop = css[prop]
prop = <span class="hljs-string">'-'</span> + prop <span class="hljs-keyword">if</span> prop.match <span class="hljs-regexp">/^(webkit|moz|ms)/i</span></pre></div></div>
</li>
<li id="section-14">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-14">¶</a>
</div>
<p>Convert camel case to hyphenated.</p>
</div>
<div class="content"><div class='highlight'><pre> style += <span class="hljs-string">"<span class="hljs-subst">#{ prop.replace(<span class="hljs-regexp">/([a-z])([A-Z])/g</span>, <span class="hljs-string">'$1-$2'</span>).toLowerCase() }</span>:<span class="hljs-subst">#{ val }</span>;"</span>
styleBuffer += style + <span class="hljs-string">'}'</span></pre></div></div>
</li>
<li id="section-15">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-15">¶</a>
</div>
<p>Defines gradient directions based on a given anchor.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">getGradient</span> = <span class="hljs-params">(anchor)</span> -></span>
<span class="hljs-string">"<span class="hljs-subst">#{ css.gradientProp }</span>(<span class="hljs-subst">#{ anchor }</span>, rgba(0, 0, 0, .5) 0%, rgba(255, 255, 255, .35) 100%)"</span></pre></div></div>
</li>
<li id="section-16">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-16">¶</a>
</div>
<p>Used mainly when creating camel cased strings.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">capitalize</span> = <span class="hljs-params">(s)</span> -></span>
s[<span class="hljs-number">0</span>].toUpperCase() + s[<span class="hljs-number">1.</span>..]</pre></div></div>
</li>
<li id="section-17">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-17">¶</a>
</div>
<p>Create an element and look up the canonical class name.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">createEl</span> = <span class="hljs-params">(className)</span> -></span>
el = <span class="hljs-built_in">document</span>.createElement <span class="hljs-string">'div'</span>
el.className = elClasses[className]
el</pre></div></div>
</li>
<li id="section-18">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-18">¶</a>
</div>
<p>Clone an element, add an additional class, and return it.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">cloneEl</span> = <span class="hljs-params">(parent, deep, className)</span> -></span>
el = parent.cloneNode deep
el.classList.add elClasses[className]
el</pre></div></div>
</li>
<li id="section-19">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-19">¶</a>
</div>
<p>GPU efficient ways of hiding and showing elements:</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">hideEl</span> = <span class="hljs-params">(el)</span> -></span>
el.style[css.transform] = <span class="hljs-string">'translate3d(-99999px, 0, 0)'</span>
<span class="hljs-function">
<span class="hljs-title">showEl</span> = <span class="hljs-params">(el)</span> -></span>
el.style[css.transform] = <span class="hljs-string">'translate3d(0, 0, 0)'</span></pre></div></div>
</li>
<li id="section-20">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-20">¶</a>
</div>
<p>This decorator is used on public effect methods to invoke preliminary tasks
before the effect is applied.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">prep</span> = <span class="hljs-params">(fn)</span> -></span><span class="hljs-function">
-></span></pre></div></div>
</li>
<li id="section-21">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-21">¶</a>
</div>
<p>If the method has been initiated by a touch handler, skip this process.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> <span class="hljs-property">@_touchStarted</span>
fn.apply @, arguments
<span class="hljs-keyword">else</span>
[a0, a1, a2] = arguments
opt = {}
angle = anchor = <span class="hljs-literal">null</span></pre></div></div>
</li>
<li id="section-22">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-22">¶</a>
</div>
<p>This switch is used to derive the intended order of arguments.
This keeps argument requirements flexible, allowing most to be left out.
By putting this logic in a decorator, it doesn’t have to exist in any
of the individual methods.</p>
</div>
</li>
<li id="section-23">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-23">¶</a>
</div>
<p>Methods are inferred by their arity.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">switch</span> fn.length
<span class="hljs-keyword">when</span> <span class="hljs-number">1</span>
opt.callback = a0
<span class="hljs-keyword">when</span> <span class="hljs-number">2</span>
<span class="hljs-keyword">if</span> <span class="hljs-keyword">typeof</span> a0 <span class="hljs-keyword">is</span> <span class="hljs-string">'function'</span>
opt.callback = a0
<span class="hljs-keyword">else</span>
anchor = a0
opt.callback = a1
<span class="hljs-keyword">when</span> <span class="hljs-number">3</span>
angle = a0
<span class="hljs-keyword">if</span> arguments.length <span class="hljs-keyword">is</span> <span class="hljs-number">2</span>
<span class="hljs-keyword">if</span> <span class="hljs-keyword">typeof</span> a1 <span class="hljs-keyword">is</span> <span class="hljs-string">'object'</span>
opt = a1
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> <span class="hljs-keyword">typeof</span> a1 <span class="hljs-keyword">is</span> <span class="hljs-string">'function'</span>
opt.callback = a1
<span class="hljs-keyword">else</span>
anchor = a1
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> arguments.length <span class="hljs-keyword">is</span> <span class="hljs-number">3</span>
anchor = a1
<span class="hljs-keyword">if</span> <span class="hljs-keyword">typeof</span> a2 <span class="hljs-keyword">is</span> <span class="hljs-string">'object'</span>
opt = a2
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> <span class="hljs-keyword">typeof</span> a2 <span class="hljs-keyword">is</span> <span class="hljs-string">'function'</span>
opt.callback = a2
angle ?= <span class="hljs-property">@_lastOp</span>.angle <span class="hljs-keyword">or</span> <span class="hljs-number">0</span>
anchor <span class="hljs-keyword">or</span>= <span class="hljs-property">@_lastOp</span>.anchor</pre></div></div>
</li>
<li id="section-24">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-24">¶</a>
</div>
<p>Here we add the called function and its normalized arguments to the
instance’s queue.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-property">@_queue</span>.push [fn, <span class="hljs-property">@_normalizeAngle</span>(angle), <span class="hljs-property">@_getLonghandAnchor</span>(anchor), opt]</pre></div></div>
</li>
<li id="section-25">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-25">¶</a>
</div>
<p><code>_step()</code> manages the queue and decides whether the action will occur now
or be deferred.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-property">@_step</span>()</pre></div></div>
</li>
<li id="section-26">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-26">¶</a>
</div>
<p>This decorator also returns the instance so effect methods are chainable.</p>
</div>
<div class="content"><div class='highlight'><pre> @</pre></div></div>
</li>
<li id="section-27">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-27">¶</a>
</div>
<p>It’s necessary to defer many DOM manipulations to a subsequent event loop tick.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">defer</span> = <span class="hljs-params">(fn)</span> -></span>
setTimeout fn, <span class="hljs-number">0</span></pre></div></div>
</li>
<li id="section-28">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-28">¶</a>
</div>
<p>Empty function to be used as placeholder for callback defaults
(instead of creating separate empty functions).</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">noOp</span> = -></span></pre></div></div>
</li>
<li id="section-29">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-29">¶</a>
</div>
<h1 id="setup">Setup</h1>
</div>
</li>
<li id="section-30">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-30">¶</a>
</div>
</div>
</li>
<li id="section-31">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-31">¶</a>
</div>
<p>Set a reference to jQuery (or another <code>$</code>-aliased DOM library).
If it doesn’t exist, set to null so OriDomi knows we are working without jQuery.
OriDomi doesn’t require it to work, but offers a useful plugin bridge if present.</p>
</div>
<div class="content"><div class='highlight'><pre>$ = <span class="hljs-keyword">if</span> <span class="hljs-built_in">window</span>?.$?.data <span class="hljs-keyword">then</span> <span class="hljs-built_in">window</span>.$ <span class="hljs-keyword">else</span> <span class="hljs-literal">null</span></pre></div></div>
</li>
<li id="section-32">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-32">¶</a>
</div>
<p>List of anchors and their corresponding axis pairs.</p>
</div>
<div class="content"><div class='highlight'><pre>anchorList = [<span class="hljs-string">'left'</span>, <span class="hljs-string">'right'</span>, <span class="hljs-string">'top'</span>, <span class="hljs-string">'bottom'</span>]
anchorListV = anchorList[.<span class="hljs-number">.1</span>]
anchorListH = anchorList[<span class="hljs-number">2.</span>.]</pre></div></div>
</li>
<li id="section-33">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-33">¶</a>
</div>
<p>Create a div for testing CSS3 properties.</p>
</div>
<div class="content"><div class='highlight'><pre>testEl = <span class="hljs-built_in">document</span>.createElement <span class="hljs-string">'div'</span></pre></div></div>
</li>
<li id="section-34">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-34">¶</a>
</div>
<p>The style buffer is later populated with CSS rules and appended to the document.</p>
</div>
<div class="content"><div class='highlight'><pre>styleBuffer = <span class="hljs-string">''</span></pre></div></div>
</li>
<li id="section-35">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-35">¶</a>
</div>
<p>List of browser prefixes for testing CSS3 properties.</p>
</div>
<div class="content"><div class='highlight'><pre>prefixList = [<span class="hljs-string">'Webkit'</span>, <span class="hljs-string">'Moz'</span>, <span class="hljs-string">'ms'</span>]
baseName = libName.toLowerCase()</pre></div></div>
</li>
<li id="section-36">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-36">¶</a>
</div>
<p>CSS classes used by style rules.</p>
</div>
<div class="content"><div class='highlight'><pre>elClasses =
<span class="hljs-attribute">active</span>: <span class="hljs-string">'active'</span>
<span class="hljs-attribute">clone</span>: <span class="hljs-string">'clone'</span>
<span class="hljs-attribute">holder</span>: <span class="hljs-string">'holder'</span>
<span class="hljs-attribute">stage</span>: <span class="hljs-string">'stage'</span>
<span class="hljs-attribute">stageLeft</span>: <span class="hljs-string">'stage-left'</span>
<span class="hljs-attribute">stageRight</span>: <span class="hljs-string">'stage-right'</span>
<span class="hljs-attribute">stageTop</span>: <span class="hljs-string">'stage-top'</span>
<span class="hljs-attribute">stageBottom</span>: <span class="hljs-string">'stage-bottom'</span>
<span class="hljs-attribute">content</span>: <span class="hljs-string">'content'</span>
<span class="hljs-attribute">mask</span>: <span class="hljs-string">'mask'</span>
<span class="hljs-attribute">maskH</span>: <span class="hljs-string">'mask-h'</span>
<span class="hljs-attribute">maskV</span>: <span class="hljs-string">'mask-v'</span>
<span class="hljs-attribute">panel</span>: <span class="hljs-string">'panel'</span>
<span class="hljs-attribute">panelH</span>: <span class="hljs-string">'panel-h'</span>
<span class="hljs-attribute">panelV</span>: <span class="hljs-string">'panel-v'</span>
<span class="hljs-attribute">shader</span>: <span class="hljs-string">'shader'</span>
<span class="hljs-attribute">shaderLeft</span>: <span class="hljs-string">'shader-left'</span>
<span class="hljs-attribute">shaderRight</span>: <span class="hljs-string">'shader-right'</span>
<span class="hljs-attribute">shaderTop</span>: <span class="hljs-string">'shader-top'</span>
<span class="hljs-attribute">shaderBottom</span>: <span class="hljs-string">'shader-bottom'</span></pre></div></div>
</li>
<li id="section-37">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-37">¶</a>
</div>
<p>Each class is namespaced to prevent styling collisions.</p>
</div>
<div class="content"><div class='highlight'><pre>elClasses[k] = <span class="hljs-string">"<span class="hljs-subst">#{ baseName }</span>-<span class="hljs-subst">#{ v }</span>"</span> <span class="hljs-keyword">for</span> k, v <span class="hljs-keyword">of</span> elClasses</pre></div></div>
</li>
<li id="section-38">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-38">¶</a>
</div>
<p>Map of the CSS3 properties needed to support OriDomi, with shorthand names as keys.
The keys and values are initialized as identical pairs to start with and prefixed
subsequently when necessary.</p>
</div>
<div class="content"><div class='highlight'><pre>css = <span class="hljs-keyword">new</span> <span class="hljs-function">-></span>
@[key] = key <span class="hljs-keyword">for</span> key <span class="hljs-keyword">in</span> [
<span class="hljs-string">'transform'</span>
<span class="hljs-string">'transformOrigin'</span>
<span class="hljs-string">'transformStyle'</span>
<span class="hljs-string">'transitionProperty'</span>
<span class="hljs-string">'transitionDuration'</span>
<span class="hljs-string">'transitionDelay'</span>
<span class="hljs-string">'transitionTimingFunction'</span>
<span class="hljs-string">'perspective'</span>
<span class="hljs-string">'perspectiveOrigin'</span>
<span class="hljs-string">'backfaceVisibility'</span>
<span class="hljs-string">'boxSizing'</span>
<span class="hljs-string">'mask'</span>
]
@</pre></div></div>
</li>
<li id="section-39">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-39">¶</a>
</div>
<p>This section is wrapped in a function call so that it can exit
early when discovering a lack of browser support to prevent unnecessary work.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-keyword">do</span> <span class="hljs-function">-></span></pre></div></div>
</li>
<li id="section-40">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-40">¶</a>
</div>
<p>Loop through the CSS map and replace each value with the result of <code>testProp()</code>.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">for</span> key, value <span class="hljs-keyword">of</span> css
css[key] = testProp value</pre></div></div>
</li>
<li id="section-41">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-41">¶</a>
</div>
<p>If the returned value is false, warn the user that the browser doesn’t support
OriDomi, set <code>isSupported</code> to false, and break out of the loop.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">return</span> supportWarning value <span class="hljs-keyword">unless</span> css[key]</pre></div></div>
</li>
<li id="section-42">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-42">¶</a>
</div>
<p>Test for <code>preserve-3d</code> as a transform style. This is particularly important
since it’s necessary for nested 3D transforms and recent versions of IE that
support 3D transforms lack it.</p>
</div>
<div class="content"><div class='highlight'><pre> p3d = <span class="hljs-string">'preserve-3d'</span>
testEl.style[css.transformStyle] = p3d</pre></div></div>
</li>
<li id="section-43">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-43">¶</a>
</div>
<p>Failure is indicated when querying the style lacks the correct string.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">unless</span> testEl.style[css.transformStyle] <span class="hljs-keyword">is</span> p3d
<span class="hljs-keyword">return</span> supportWarning p3d</pre></div></div>
</li>
<li id="section-44">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-44">¶</a>
</div>
<p>CSS3 linear gradients are used for shading.
Testing for them is different because they are prefixed values, not properties.
This invokes an anonymous function to loop through vendor-prefixed linear gradients.</p>
</div>
<div class="content"><div class='highlight'><pre> css.gradientProp = <span class="hljs-keyword">do</span> <span class="hljs-function">-></span>
<span class="hljs-keyword">for</span> prefix <span class="hljs-keyword">in</span> prefixList
hyphenated = <span class="hljs-string">"-<span class="hljs-subst">#{ prefix.toLowerCase() }</span>-linear-gradient"</span>
testEl.style.backgroundImage = <span class="hljs-string">"<span class="hljs-subst">#{ hyphenated }</span>(left, #000, #fff)"</span></pre></div></div>
</li>
<li id="section-45">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-45">¶</a>
</div>
<p>After setting a gradient background on the test div, attempt to retrieve it.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">return</span> hyphenated <span class="hljs-keyword">unless</span> testEl.style.backgroundImage.indexOf(<span class="hljs-string">'gradient'</span>) <span class="hljs-keyword">is</span> -<span class="hljs-number">1</span></pre></div></div>
</li>
<li id="section-46">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-46">¶</a>
</div>
<p>If none of the hyphenated values worked, return the unprefixed version.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-string">'linear-gradient'</span></pre></div></div>
</li>
<li id="section-47">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-47">¶</a>
</div>
<p>The default cursor style is set to <code>grab</code> to prompt the user to interact with the element.
<code>grab</code> as a value isn’t supported in all browsers so it has to be detected.</p>
</div>
<div class="content"><div class='highlight'><pre> [css.grab, css.grabbing] = <span class="hljs-keyword">do</span> <span class="hljs-function">-></span>
<span class="hljs-keyword">for</span> prefix <span class="hljs-keyword">in</span> prefixList
plainGrab = <span class="hljs-string">'grab'</span>
testEl.style.cursor = (grabValue = <span class="hljs-string">"-<span class="hljs-subst">#{ prefix.toLowerCase() }</span>-<span class="hljs-subst">#{ plainGrab }</span>"</span>)</pre></div></div>
</li>
<li id="section-48">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-48">¶</a>
</div>
<p>If the cursor was set correctly, return the prefixed pair.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">return</span> [grabValue, <span class="hljs-string">"-<span class="hljs-subst">#{ prefix.toLowerCase() }</span>-grabbing"</span>] <span class="hljs-keyword">if</span> testEl.style.cursor <span class="hljs-keyword">is</span> grabValue</pre></div></div>
</li>
<li id="section-49">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-49">¶</a>
</div>
<p>Otherwise try the unprefixed version.</p>
</div>
<div class="content"><div class='highlight'><pre> testEl.style.cursor = plainGrab
<span class="hljs-keyword">if</span> testEl.style.cursor <span class="hljs-keyword">is</span> plainGrab
[plainGrab, <span class="hljs-string">'grabbing'</span>]
<span class="hljs-keyword">else</span></pre></div></div>
</li>
<li id="section-50">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-50">¶</a>
</div>
<p>Fallback to <code>move</code>.</p>
</div>
<div class="content"><div class='highlight'><pre> [<span class="hljs-string">'move'</span>, <span class="hljs-string">'move'</span>]</pre></div></div>
</li>
<li id="section-51">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-51">¶</a>
</div>
<p>Like gradients, transform (as a transition value) needs to be detected and prefixed.</p>
</div>
<div class="content"><div class='highlight'><pre> css.transformProp =</pre></div></div>
</li>
<li id="section-52">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-52">¶</a>
</div>
<p>Use a regular expression to pluck the prefix <code>testProp</code> found.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> prefix = css.transform.match <span class="hljs-regexp">/(\w+)Transform/i</span>
<span class="hljs-string">"-<span class="hljs-subst">#{ prefix[<span class="hljs-number">1</span>].toLowerCase() }</span>-transform"</span>
<span class="hljs-keyword">else</span>
<span class="hljs-string">'transform'</span></pre></div></div>
</li>
<li id="section-53">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-53">¶</a>
</div>
<p>Set a <code>transitionEnd</code> property based on the browser’s prefix for <code>transitionProperty</code>.</p>
</div>
<div class="content"><div class='highlight'><pre> css.transitionEnd =
<span class="hljs-keyword">switch</span> css.transitionProperty.toLowerCase()
<span class="hljs-keyword">when</span> <span class="hljs-string">'transitionproperty'</span> <span class="hljs-keyword">then</span> <span class="hljs-string">'transitionEnd'</span>
<span class="hljs-keyword">when</span> <span class="hljs-string">'webkittransitionproperty'</span> <span class="hljs-keyword">then</span> <span class="hljs-string">'webkitTransitionEnd'</span>
<span class="hljs-keyword">when</span> <span class="hljs-string">'moztransitionproperty'</span> <span class="hljs-keyword">then</span> <span class="hljs-string">'transitionend'</span>
<span class="hljs-keyword">when</span> <span class="hljs-string">'mstransitionproperty'</span> <span class="hljs-keyword">then</span> <span class="hljs-string">'msTransitionEnd'</span></pre></div></div>
</li>
<li id="section-54">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-54">¶</a>
</div>
<p>These calls generate OriDomi’s stylesheet.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">do</span> <span class="hljs-function"><span class="hljs-params">(i = (s) -> s + <span class="hljs-string">' !important'</span>)</span> -></span>
addStyle elClasses.active,
<span class="hljs-attribute">backgroundColor</span>: i <span class="hljs-string">'transparent'</span>
<span class="hljs-attribute">backgroundImage</span>: i <span class="hljs-string">'none'</span>
<span class="hljs-attribute">boxSizing</span>: i <span class="hljs-string">'border-box'</span>
<span class="hljs-attribute">border</span>: i <span class="hljs-string">'none'</span>
<span class="hljs-attribute">outline</span>: i <span class="hljs-string">'none'</span>
<span class="hljs-attribute">padding</span>: i <span class="hljs-string">'0'</span>
<span class="hljs-attribute">transformStyle</span>: i p3d
<span class="hljs-attribute">mask</span>: i <span class="hljs-string">'none'</span>
<span class="hljs-attribute">position</span>: <span class="hljs-string">'relative'</span>
addStyle elClasses.clone,
<span class="hljs-attribute">margin</span>: i <span class="hljs-string">'0'</span>
<span class="hljs-attribute">boxSizing</span>: i <span class="hljs-string">'border-box'</span>
<span class="hljs-attribute">overflow</span>: i <span class="hljs-string">'hidden'</span>
<span class="hljs-attribute">display</span>: i <span class="hljs-string">'block'</span>
addStyle elClasses.holder,
<span class="hljs-attribute">width</span>: <span class="hljs-string">'100%'</span>
<span class="hljs-attribute">position</span>: <span class="hljs-string">'absolute'</span>
<span class="hljs-attribute">top</span>: <span class="hljs-string">'0'</span>
<span class="hljs-attribute">bottom</span>: <span class="hljs-string">'0'</span>
<span class="hljs-attribute">transformStyle</span>: p3d
addStyle elClasses.stage,
<span class="hljs-attribute">width</span>: <span class="hljs-string">'100%'</span>
<span class="hljs-attribute">height</span>: <span class="hljs-string">'100%'</span>
<span class="hljs-attribute">position</span>: <span class="hljs-string">'absolute'</span>
<span class="hljs-attribute">transform</span>: <span class="hljs-string">'translate3d(-9999px, 0, 0)'</span>
<span class="hljs-attribute">margin</span>: <span class="hljs-string">'0'</span>
<span class="hljs-attribute">padding</span>: <span class="hljs-string">'0'</span>
<span class="hljs-attribute">transformStyle</span>: p3d</pre></div></div>
</li>
<li id="section-55">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-55">¶</a>
</div>
<p>Each anchor needs a particular perspective origin.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">for</span> k, v <span class="hljs-keyword">of</span> {<span class="hljs-attribute">Left</span>: <span class="hljs-string">'0% 50%'</span>, <span class="hljs-attribute">Right</span>: <span class="hljs-string">'100% 50%'</span>, <span class="hljs-attribute">Top</span>: <span class="hljs-string">'50% 0%'</span>, <span class="hljs-attribute">Bottom</span>: <span class="hljs-string">'50% 100%'</span>}
addStyle elClasses[<span class="hljs-string">'stage'</span> + k], <span class="hljs-attribute">perspectiveOrigin</span>: v
addStyle elClasses.shader,
<span class="hljs-attribute">width</span>: <span class="hljs-string">'100%'</span>
<span class="hljs-attribute">height</span>: <span class="hljs-string">'100%'</span>
<span class="hljs-attribute">position</span>: <span class="hljs-string">'absolute'</span>
<span class="hljs-attribute">opacity</span>: <span class="hljs-string">'0'</span>
<span class="hljs-attribute">top</span>: <span class="hljs-string">'0'</span>
<span class="hljs-attribute">left</span>: <span class="hljs-string">'0'</span>
<span class="hljs-attribute">pointerEvents</span>: <span class="hljs-string">'none'</span>
<span class="hljs-attribute">transitionProperty</span>: <span class="hljs-string">'opacity'</span></pre></div></div>
</li>
<li id="section-56">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-56">¶</a>
</div>
<p>Linear gradient directions depend on their anchor.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">for</span> anchor <span class="hljs-keyword">in</span> anchorList
addStyle elClasses[<span class="hljs-string">'shader'</span> + capitalize anchor], <span class="hljs-attribute">background</span>: getGradient anchor
addStyle elClasses.content,
<span class="hljs-attribute">margin</span>: i <span class="hljs-string">'0'</span>
<span class="hljs-attribute">position</span>: i <span class="hljs-string">'relative'</span>
<span class="hljs-attribute">float</span>: i <span class="hljs-string">'none'</span>
<span class="hljs-attribute">boxSizing</span>: i <span class="hljs-string">'border-box'</span>
<span class="hljs-attribute">overflow</span>: i <span class="hljs-string">'hidden'</span>
addStyle elClasses.mask,
<span class="hljs-attribute">width</span>: <span class="hljs-string">'100%'</span>
<span class="hljs-attribute">height</span>: <span class="hljs-string">'100%'</span>
<span class="hljs-attribute">position</span>: <span class="hljs-string">'absolute'</span>
<span class="hljs-attribute">overflow</span>: <span class="hljs-string">'hidden'</span>
<span class="hljs-attribute">transform</span>: <span class="hljs-string">'translate3d(0, 0, 0)'</span>
<span class="hljs-attribute">outline</span>: <span class="hljs-string">'1px solid transparent'</span>
addStyle elClasses.panel,
<span class="hljs-attribute">width</span>: <span class="hljs-string">'100%'</span>
<span class="hljs-attribute">height</span>: <span class="hljs-string">'100%'</span>
<span class="hljs-attribute">padding</span>: <span class="hljs-string">'0'</span>
<span class="hljs-attribute">position</span>: <span class="hljs-string">'absolute'</span>
<span class="hljs-attribute">transitionProperty</span>: css.transformProp
<span class="hljs-attribute">transformOrigin</span>: <span class="hljs-string">'left'</span>
<span class="hljs-attribute">transformStyle</span>: p3d
addStyle elClasses.panelH, <span class="hljs-attribute">transformOrigin</span>: <span class="hljs-string">'top'</span>
addStyle <span class="hljs-string">"<span class="hljs-subst">#{ elClasses.stageRight }</span> .<span class="hljs-subst">#{ elClasses.panel }</span>"</span>, <span class="hljs-attribute">transformOrigin</span>: <span class="hljs-string">'right'</span>
addStyle <span class="hljs-string">"<span class="hljs-subst">#{ elClasses.stageBottom }</span> .<span class="hljs-subst">#{ elClasses.panel }</span>"</span>, <span class="hljs-attribute">transformOrigin</span>: <span class="hljs-string">'bottom'</span>
styleEl = <span class="hljs-built_in">document</span>.createElement <span class="hljs-string">'style'</span>
styleEl.type = <span class="hljs-string">'text/css'</span></pre></div></div>
</li>
<li id="section-57">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-57">¶</a>
</div>
<p>Once the style buffer is ready, it’s appended to the document as a stylesheet.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> styleEl.styleSheet
styleEl.styleSheet.cssText = styleBuffer
<span class="hljs-keyword">else</span>
styleEl.appendChild <span class="hljs-built_in">document</span>.createTextNode styleBuffer
<span class="hljs-built_in">document</span>.head.appendChild styleEl</pre></div></div>
</li>
<li id="section-58">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-58">¶</a>
</div>
<h1 id="defaults">Defaults</h1>
</div>
</li>
<li id="section-59">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-59">¶</a>
</div>
</div>
</li>
<li id="section-60">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-60">¶</a>
</div>
<p>These defaults are used by all OriDomi instances unless overridden.</p>
</div>
<div class="content"><div class='highlight'><pre>defaults =</pre></div></div>
</li>
<li id="section-61">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-61">¶</a>
</div>
<p>The number of vertical panels (for folding left or right).
You can use either an integer, or an array of percentages if you want custom
panel widths, e.g. <code>[20, 10, 10, 20, 10, 20, 10]</code>.
The numbers must add up to 100 (or near it, so you can use values like
<code>[33, 33, 33]</code>).</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">vPanels</span>: <span class="hljs-number">3</span></pre></div></div>
</li>
<li id="section-62">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-62">¶</a>
</div>
<p>The number of horizontal panels (for folding top or bottom) or an array of percentages.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">hPanels</span>: <span class="hljs-number">3</span></pre></div></div>
</li>
<li id="section-63">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-63">¶</a>
</div>
<p>The determines the distance in pixels (z axis) of the camera/viewer to the paper.
The smaller the value, the more distorted and exaggerated the effects will appear.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">perspective</span>: <span class="hljs-number">1000</span></pre></div></div>
</li>
<li id="section-64">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-64">¶</a>
</div>
<p>The default shading style is hard, which shows distinct creases in the paper.
Other options include <code>'soft'</code> — for a smoother, more rounded look — or <code>false</code>
to disable shading altogether for a flat look.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">shading</span>: <span class="hljs-string">'hard'</span></pre></div></div>
</li>
<li id="section-65">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-65">¶</a>
</div>
<p>Determines the duration of all animations in milliseconds.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">speed</span>: <span class="hljs-number">700</span></pre></div></div>
</li>
<li id="section-66">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-66">¶</a>
</div>
<p>Configurable maximum angle for effects. With most effects, exceeding 90/-90 usually
makes the element wrap around and pass through itself leading to some glitchy visuals.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">maxAngle</span>: <span class="hljs-number">90</span></pre></div></div>
</li>
<li id="section-67">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-67">¶</a>
</div>
<p>Ripple mode causes effects to fold in a staggered, cascading manner.
<code>1</code> indicates a forward cascade, <code>2</code> is backwards. It is disabled by default.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">ripple</span>: <span class="hljs-number">0</span></pre></div></div>
</li>
<li id="section-68">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-68">¶</a>
</div>
<p>This CSS class is applied to OriDomi elements so they can be easily targeted later.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">oriDomiClass</span>: libName.toLowerCase()</pre></div></div>
</li>
<li id="section-69">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-69">¶</a>
</div>
<p>This is a multiplier that determines the darkness of shading.
If you need subtler shading, set this to a value below 1.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">shadingIntensity</span>: <span class="hljs-number">1</span></pre></div></div>
</li>
<li id="section-70">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-70">¶</a>
</div>
<p>This option allows you to supply the name of a CSS easing method or a
cubic bezier formula for customized animation easing.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">easingMethod</span>: <span class="hljs-string">''</span></pre></div></div>
</li>
<li id="section-71">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-71">¶</a>
</div>
<p>Number of pixels to offset each panel to prevent small gaps from appearing
between them. This is configurable if you have a need for precision.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">gapNudge</span>: <span class="hljs-number">1.5</span></pre></div></div>
</li>
<li id="section-72">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-72">¶</a>
</div>
<p>Allows the user to fold the element via touch or mouse.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">touchEnabled</span>: <span class="hljs-literal">true</span></pre></div></div>
</li>
<li id="section-73">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-73">¶</a>
</div>
<p>Coefficient of touch/drag action’s distance delta. Higher numbers cause more movement.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">touchSensitivity</span>: <span class="hljs-number">.25</span></pre></div></div>
</li>
<li id="section-74">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-74">¶</a>
</div>
<p>Custom callbacks for touch/drag events. Each one is invoked with a relevant
value so they can be used to manipulate objects outside of the OriDomi
instance (e.g. sliding panels). x values are returned when folding left and
right, y values for top and bottom. The second argument passed is the original
touch or mouse event. These are empty functions by default. Invoked with
starting coordinate as first argument.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">touchStartCallback</span>: noOp</pre></div></div>
</li>
<li id="section-75">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-75">¶</a>
</div>
<p>Invoked with the folded angle.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">touchMoveCallback</span>: noOp</pre></div></div>
</li>
<li id="section-76">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-76">¶</a>
</div>
<p>Invoked with ending point.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">touchEndCallback</span>: noOp</pre></div></div>
</li>
<li id="section-77">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-77">¶</a>
</div>
<h1 id="constructor">Constructor</h1>
</div>
</li>
<li id="section-78">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-78">¶</a>
</div>
</div>
<div class="content"><div class='highlight'><pre>
<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">OriDomi</span></span>
<span class="hljs-attribute">constructor</span>: <span class="hljs-function"><span class="hljs-params">(<span class="hljs-property">@el</span>, options = {})</span> -></span>
<span class="hljs-keyword">return</span> <span class="hljs-keyword">unless</span> isSupported</pre></div></div>
</li>
<li id="section-79">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-79">¶</a>
</div>
<p>Fix constructor calls made without <code>new</code>.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">return</span> <span class="hljs-keyword">new</span> OriDomi <span class="hljs-property">@el</span>, options <span class="hljs-keyword">unless</span> @ <span class="hljs-keyword">instanceof</span> OriDomi</pre></div></div>
</li>
<li id="section-80">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-80">¶</a>
</div>
<p>Support selector strings as well as elements.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-property">@el</span> = <span class="hljs-built_in">document</span>.querySelector <span class="hljs-property">@el</span> <span class="hljs-keyword">if</span> <span class="hljs-keyword">typeof</span> <span class="hljs-property">@el</span> <span class="hljs-keyword">is</span> <span class="hljs-string">'string'</span></pre></div></div>
</li>
<li id="section-81">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-81">¶</a>
</div>
<p>Make sure element is valid.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">unless</span> <span class="hljs-property">@el</span> <span class="hljs-keyword">and</span> <span class="hljs-property">@el</span>.nodeType <span class="hljs-keyword">is</span> <span class="hljs-number">1</span>
<span class="hljs-built_in">console</span>?.warn <span class="hljs-string">"<span class="hljs-subst">#{ libName }</span>: First argument must be a DOM element"</span>
<span class="hljs-keyword">return</span></pre></div></div>
</li>
<li id="section-82">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-82">¶</a>
</div>
<p>Fill in passed options with defaults.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-property">@_config</span> = <span class="hljs-keyword">new</span> <span class="hljs-function">-></span>
<span class="hljs-keyword">for</span> k, v <span class="hljs-keyword">of</span> defaults
<span class="hljs-keyword">if</span> k <span class="hljs-keyword">of</span> options
@[k] = options[k]
<span class="hljs-keyword">else</span>
@[k] = v
@</pre></div></div>
</li>
<li id="section-83">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-83">¶</a>
</div>
<p>The ripple setting is converted to a number to allow boolean settings.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-property">@_config</span>.ripple = Number <span class="hljs-property">@_config</span>.ripple</pre></div></div>
</li>
<li id="section-84">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-84">¶</a>
</div>
<p>The queue holds animation sequences.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-property">@_queue</span> = []
<span class="hljs-property">@_panels</span> = {}
<span class="hljs-property">@_stages</span> = {}</pre></div></div>
</li>
<li id="section-85">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-85">¶</a>
</div>
<p>Set the starting anchor to left.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-property">@_lastOp</span> = <span class="hljs-attribute">anchor</span>: anchorList[<span class="hljs-number">0</span>]
<span class="hljs-property">@_shading</span> = <span class="hljs-property">@_config</span>.shading</pre></div></div>
</li>
<li id="section-86">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-86">¶</a>
</div>
<p>Alias <code>shading: true</code> as hard shading.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-property">@_shading</span> = <span class="hljs-string">'hard'</span> <span class="hljs-keyword">if</span> <span class="hljs-property">@_shading</span> <span class="hljs-keyword">is</span> <span class="hljs-literal">true</span></pre></div></div>
</li>
<li id="section-87">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-87">¶</a>
</div>
<p>The shader elements are constructed in a conditional so the process can be
skipped if shading is disabled.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> <span class="hljs-property">@_shading</span>
<span class="hljs-property">@_shaders</span> = {}
shaderProtos = {}
shaderProto = createEl <span class="hljs-string">'shader'</span>
shaderProto.style[css.transitionDuration] = <span class="hljs-property">@_config</span>.speed + <span class="hljs-string">'ms'</span>
shaderProto.style[css.transitionTimingFunction] = <span class="hljs-property">@_config</span>.easingMethod
stageProto = createEl <span class="hljs-string">'stage'</span>
stageProto.style[css.perspective] = <span class="hljs-property">@_config</span>.perspective + <span class="hljs-string">'px'</span>
<span class="hljs-keyword">for</span> anchor <span class="hljs-keyword">in</span> anchorList</pre></div></div>
</li>
<li id="section-88">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-88">¶</a>
</div>
<p>Each anchor has a unique set of panels.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-property">@_panels</span>[anchor] = []
<span class="hljs-property">@_stages</span>[anchor] = cloneEl stageProto, <span class="hljs-literal">false</span>, <span class="hljs-string">'stage'</span> + capitalize anchor
<span class="hljs-keyword">if</span> <span class="hljs-property">@_shading</span>
<span class="hljs-property">@_shaders</span>[anchor] = {}
<span class="hljs-keyword">if</span> anchor <span class="hljs-keyword">in</span> anchorListV
<span class="hljs-property">@_shaders</span>[anchor][side] = [] <span class="hljs-keyword">for</span> side <span class="hljs-keyword">in</span> anchorListV
<span class="hljs-keyword">else</span>
<span class="hljs-property">@_shaders</span>[anchor][side] = [] <span class="hljs-keyword">for</span> side <span class="hljs-keyword">in</span> anchorListH
shaderProtos[anchor] = cloneEl shaderProto, <span class="hljs-literal">false</span>, <span class="hljs-string">'shader'</span> + capitalize anchor
contentHolder = cloneEl <span class="hljs-property">@el</span>, <span class="hljs-literal">true</span>, <span class="hljs-string">'content'</span>
maskProto = createEl <span class="hljs-string">'mask'</span>
maskProto.appendChild contentHolder
panelProto = createEl <span class="hljs-string">'panel'</span>
panelProto.style[css.transitionDuration] = <span class="hljs-property">@_config</span>.speed + <span class="hljs-string">'ms'</span>
panelProto.style[css.transitionTimingFunction] = <span class="hljs-property">@_config</span>.easingMethod</pre></div></div>
</li>
<li id="section-89">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-89">¶</a>
</div>
<p>These arrays store panel offsets so they don’t have to be computed twice
for each axis.</p>
</div>
<div class="content"><div class='highlight'><pre> offsets = <span class="hljs-attribute">left</span>: [], <span class="hljs-attribute">top</span>: []</pre></div></div>
</li>
<li id="section-90">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-90">¶</a>
</div>
<p>This loop builds all of the panels.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">for</span> axis <span class="hljs-keyword">in</span> [<span class="hljs-string">'x'</span>, <span class="hljs-string">'y'</span>]
<span class="hljs-keyword">if</span> axis <span class="hljs-keyword">is</span> <span class="hljs-string">'x'</span>
anchorSet = anchorListV
metric = <span class="hljs-string">'width'</span>
classSuffix = <span class="hljs-string">'V'</span>
<span class="hljs-keyword">else</span>
anchorSet = anchorListH
metric = <span class="hljs-string">'height'</span>
classSuffix = <span class="hljs-string">'H'</span>
panelConfig = <span class="hljs-property">@_config</span>[panelKey = classSuffix.toLowerCase() + <span class="hljs-string">'Panels'</span>]</pre></div></div>
</li>
<li id="section-91">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-91">¶</a>
</div>
<p>If the panel set configuration is an integer (as it is by default),
an array is filled with equal percentages.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> <span class="hljs-keyword">typeof</span> panelConfig <span class="hljs-keyword">is</span> <span class="hljs-string">'number'</span>
count = Math.abs parseInt panelConfig, <span class="hljs-number">10</span>
percent = <span class="hljs-number">100</span> / count
panelConfig = <span class="hljs-property">@_config</span>[panelKey] = (percent <span class="hljs-keyword">for</span> [<span class="hljs-number">0.</span>..count])
<span class="hljs-keyword">else</span>
count = panelConfig.length
<span class="hljs-keyword">unless</span> <span class="hljs-number">99</span> <= panelConfig.reduce(<span class="hljs-function"><span class="hljs-params">(p, c)</span> -></span> p + c) <= <span class="hljs-number">100.1</span>
<span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> Error <span class="hljs-string">"<span class="hljs-subst">#{ libName }</span>: Panel percentages do not sum to 100"</span></pre></div></div>
</li>
<li id="section-92">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-92">¶</a>
</div>
<p>Clone a new mask element and append it to a panel element prototype.</p>
</div>
<div class="content"><div class='highlight'><pre> mask = cloneEl maskProto, <span class="hljs-literal">true</span>, <span class="hljs-string">'mask'</span> + classSuffix
<span class="hljs-keyword">if</span> <span class="hljs-property">@_shading</span>
mask.appendChild shaderProtos[anchor] <span class="hljs-keyword">for</span> anchor <span class="hljs-keyword">in</span> anchorSet
proto = cloneEl panelProto, <span class="hljs-literal">false</span>, <span class="hljs-string">'panel'</span> + classSuffix
proto.appendChild mask
<span class="hljs-keyword">for</span> anchor, rightOrBottom <span class="hljs-keyword">in</span> anchorSet
<span class="hljs-keyword">for</span> panelN <span class="hljs-keyword">in</span> [<span class="hljs-number">0.</span>..count]
panel = proto.cloneNode <span class="hljs-literal">true</span>
content = panel.children[<span class="hljs-number">0</span>].children[<span class="hljs-number">0</span>]
content.style.width = content.style.height = <span class="hljs-string">'100%'</span>
<span class="hljs-keyword">if</span> rightOrBottom
panel.style[css.origin] = anchor</pre></div></div>
</li>
<li id="section-93">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-93">¶</a>
</div>
<p>Panels on the right and bottom axes are placed backwards.</p>
</div>
<div class="content"><div class='highlight'><pre> index = panelConfig.length - panelN - <span class="hljs-number">1</span>
prev = index + <span class="hljs-number">1</span>
<span class="hljs-keyword">else</span>
index = panelN
prev = index - <span class="hljs-number">1</span></pre></div></div>
</li>
<li id="section-94">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-94">¶</a>
</div>
<p>The inner content of each panel is offset relative to the panel
index to display a contiguous composition.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> panelN <span class="hljs-keyword">is</span> <span class="hljs-number">0</span>
offsets[anchor].push <span class="hljs-number">0</span>
<span class="hljs-keyword">else</span>
offsets[anchor].push (offsets[anchor][prev] - <span class="hljs-number">100</span>) * (panelConfig[prev] / panelConfig[index])
<span class="hljs-keyword">if</span> panelN <span class="hljs-keyword">is</span> <span class="hljs-number">0</span>
panel.style[anchor] = <span class="hljs-string">'0'</span></pre></div></div>
</li>
<li id="section-95">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-95">¶</a>
</div>
<p>Only the first panel has its size set to the nominal target percentage.</p>
</div>
<div class="content"><div class='highlight'><pre> panel.style[metric] = panelConfig[index] + <span class="hljs-string">'%'</span>
<span class="hljs-keyword">else</span></pre></div></div>
</li>
<li id="section-96">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-96">¶</a>
</div>
<p>Each subsequent panel is offset by its predecessor/parent’s size.</p>
</div>
<div class="content"><div class='highlight'><pre> panel.style[anchor] = <span class="hljs-string">'100%'</span></pre></div></div>
</li>
<li id="section-97">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-97">¶</a>
</div>
<p>Subsequent panels have their percentages set relative to their
parent panel’s percentage to counteract it in an absolute sense.</p>
</div>
<div class="content"><div class='highlight'><pre> panel.style[metric] = panelConfig[index] / panelConfig[prev] * <span class="hljs-number">100</span> + <span class="hljs-string">'%'</span>
<span class="hljs-keyword">if</span> <span class="hljs-property">@_shading</span>
<span class="hljs-keyword">for</span> a, i <span class="hljs-keyword">in</span> anchorSet
<span class="hljs-property">@_shaders</span>[anchor][a][panelN] = panel.children[<span class="hljs-number">0</span>].children[i + <span class="hljs-number">1</span>]</pre></div></div>
</li>
<li id="section-98">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-98">¶</a>
</div>
<p>The inner content retains the original dimensions of the element
while being inside a small slice. By manipulating the number based
on the total number of panels and the absolute percentage, the size
reduction of the parent is undone and sizing flexibility is achieved.</p>
</div>
<div class="content"><div class='highlight'><pre> content.style[metric] =
content.style[<span class="hljs-string">'max'</span> + capitalize metric] =
(count / panelConfig[index] * <span class="hljs-number">10000</span> / count) + <span class="hljs-string">'%'</span>
content.style[anchorSet[<span class="hljs-number">0</span>]] = offsets[anchorSet[<span class="hljs-number">0</span>]][index] + <span class="hljs-string">'%'</span>
<span class="hljs-property">@_transformPanel</span> panel, <span class="hljs-number">0</span>, anchor
<span class="hljs-property">@_panels</span>[anchor][panelN] = panel</pre></div></div>
</li>
<li id="section-99">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-99">¶</a>
</div>
<p>Panels are nested inside each other.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-property">@_panels</span>[anchor][panelN - <span class="hljs-number">1</span>].appendChild panel <span class="hljs-keyword">unless</span> panelN <span class="hljs-keyword">is</span> <span class="hljs-number">0</span></pre></div></div>
</li>
<li id="section-100">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-100">¶</a>
</div>
<p>Append the first panel to each stage.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-property">@_stages</span>[anchor].appendChild <span class="hljs-property">@_panels</span>[anchor][<span class="hljs-number">0</span>]
<span class="hljs-property">@_stageHolder</span> = createEl <span class="hljs-string">'holder'</span>
<span class="hljs-property">@_stageHolder</span>.setAttribute <span class="hljs-string">'aria-hidden'</span>, <span class="hljs-string">'true'</span>
<span class="hljs-property">@_stageHolder</span>.appendChild <span class="hljs-property">@_stages</span>[anchor] <span class="hljs-keyword">for</span> anchor <span class="hljs-keyword">in</span> anchorList</pre></div></div>
</li>
<li id="section-101">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-101">¶</a>
</div>
<p>Override default styling if original positioning is absolute.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> <span class="hljs-built_in">window</span>.getComputedStyle(<span class="hljs-property">@el</span>).position <span class="hljs-keyword">is</span> <span class="hljs-string">'absolute'</span>
<span class="hljs-property">@el</span>.style.position = <span class="hljs-string">'absolute'</span>
<span class="hljs-property">@el</span>.classList.add elClasses.active
showEl <span class="hljs-property">@_stages</span>.left</pre></div></div>
</li>
<li id="section-102">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-102">¶</a>
</div>
<p>The original element is cloned and hidden via transforms so the dimensions
of the OriDomi content are maintained by it.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-property">@_cloneEl</span> = cloneEl <span class="hljs-property">@el</span>, <span class="hljs-literal">true</span>, <span class="hljs-string">'clone'</span>
<span class="hljs-property">@_cloneEl</span>.classList.remove elClasses.active
hideEl <span class="hljs-property">@_cloneEl</span></pre></div></div>
</li>
<li id="section-103">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-103">¶</a>
</div>
<p>Once the clone is stored the original element is emptied and appended with
the clone and the OriDomi content.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-property">@el</span>.innerHTML = <span class="hljs-string">''</span>
<span class="hljs-property">@el</span>.appendChild <span class="hljs-property">@_cloneEl</span>
<span class="hljs-property">@el</span>.appendChild <span class="hljs-property">@_stageHolder</span></pre></div></div>
</li>
<li id="section-104">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-104">¶</a>
</div>
<p>This ensures mouse events work correctly when panels are transformed
away from the viewer.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-property">@el</span>.parentNode.style[css.transformStyle] = <span class="hljs-string">'preserve-3d'</span></pre></div></div>
</li>
<li id="section-105">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-105">¶</a>
</div>
<p>An effect method is called since touch events rely on using the last
method called.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-property">@accordion</span> <span class="hljs-number">0</span>
<span class="hljs-property">@setRipple</span> <span class="hljs-property">@_config</span>.ripple <span class="hljs-keyword">if</span> <span class="hljs-property">@_config</span>.ripple
<span class="hljs-property">@enableTouch</span>() <span class="hljs-keyword">if</span> <span class="hljs-property">@_config</span>.touchEnabled</pre></div></div>
</li>
<li id="section-106">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-106">¶</a>
</div>
<h1 id="internal-methods">Internal Methods</h1>
</div>
</li>
<li id="section-107">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-107">¶</a>
</div>
</div>
</li>
<li id="section-108">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-108">¶</a>
</div>
<p>This method is called for the action shifted off the queue.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">_step</span>:<span class="hljs-function"> =></span></pre></div></div>
</li>
<li id="section-109">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-109">¶</a>
</div>
<p>Return if the composition is currently in transition or the queue is empty.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">return</span> <span class="hljs-keyword">if</span> <span class="hljs-property">@_inTrans</span> <span class="hljs-keyword">or</span> !<span class="hljs-property">@_queue</span>.length
<span class="hljs-property">@_inTrans</span> = <span class="hljs-literal">true</span></pre></div></div>
</li>
<li id="section-110">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-110">¶</a>
</div>
<p>Destructure action arguments from the front of the queue.</p>
</div>
<div class="content"><div class='highlight'><pre> [fn, angle, anchor, options] = <span class="hljs-property">@_queue</span>.shift()
<span class="hljs-property">@unfreeze</span>() <span class="hljs-keyword">if</span> <span class="hljs-property">@isFrozen</span></pre></div></div>
</li>
<li id="section-111">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-111">¶</a>
</div>
<p>A local function for the next action is created should the call need to be
deferred (if the stage is folded up or on the wrong anchor).</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-function"> <span class="hljs-title">next</span> = =></span>
<span class="hljs-property">@_setCallback</span> {angle, anchor, options, fn}
args = [angle, anchor, options]
args.shift() <span class="hljs-keyword">if</span> fn.length < <span class="hljs-number">3</span>
fn.apply @, args
<span class="hljs-keyword">if</span> <span class="hljs-property">@isFoldedUp</span>
<span class="hljs-keyword">if</span> fn.length <span class="hljs-keyword">is</span> <span class="hljs-number">2</span>
next()
<span class="hljs-keyword">else</span>
<span class="hljs-property">@_unfold</span> next
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> anchor <span class="hljs-keyword">isnt</span> <span class="hljs-property">@_lastOp</span>.anchor
<span class="hljs-property">@_stageReset</span> anchor, next
<span class="hljs-keyword">else</span>
next()</pre></div></div>
</li>
<li id="section-112">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-112">¶</a>
</div>
<p>This method tests if the called action is identical to the previous one.
If two identical operations were called in a row, the transition callback
wouldn’t be called due to no animation taking place. This method reasons if
movement has taken place, avoiding this pitfall of transition listeners.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">_isIdenticalOperation</span>: <span class="hljs-function"><span class="hljs-params">(op)</span> -></span>
<span class="hljs-keyword">return</span> <span class="hljs-literal">true</span> <span class="hljs-keyword">unless</span> <span class="hljs-property">@_lastOp</span>.fn
<span class="hljs-keyword">return</span> <span class="hljs-literal">false</span> <span class="hljs-keyword">if</span> <span class="hljs-property">@_lastOp</span>.reset
(<span class="hljs-keyword">return</span> <span class="hljs-literal">false</span> <span class="hljs-keyword">if</span> <span class="hljs-property">@_lastOp</span>[key] <span class="hljs-keyword">isnt</span> op[key]) <span class="hljs-keyword">for</span> key <span class="hljs-keyword">in</span> [<span class="hljs-string">'angle'</span>, <span class="hljs-string">'anchor'</span>, <span class="hljs-string">'fn'</span>]
(<span class="hljs-keyword">return</span> <span class="hljs-literal">false</span> <span class="hljs-keyword">if</span> v <span class="hljs-keyword">isnt</span> <span class="hljs-property">@_lastOp</span>.options[k] <span class="hljs-keyword">and</span> k <span class="hljs-keyword">isnt</span> <span class="hljs-string">'callback'</span>) <span class="hljs-keyword">for</span> k, v <span class="hljs-keyword">of</span> op.options
<span class="hljs-literal">true</span></pre></div></div>
</li>
<li id="section-113">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-113">¶</a>
</div>
<p>This method normalizes callback handling for all public methods.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">_setCallback</span>: <span class="hljs-function"><span class="hljs-params">(operation)</span> -></span></pre></div></div>
</li>
<li id="section-114">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-114">¶</a>
</div>
<p>If there was no transformation, invoke the callback immediately.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> !<span class="hljs-property">@_config</span>.speed <span class="hljs-keyword">or</span> <span class="hljs-property">@_isIdenticalOperation</span> operation
<span class="hljs-property">@_conclude</span> operation.options.callback</pre></div></div>
</li>
<li id="section-115">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-115">¶</a>
</div>
<p>Otherwise, attach an event listener to be called on the transition’s end.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">else</span>
<span class="hljs-property">@_panels</span>[<span class="hljs-property">@_lastOp</span>.anchor][<span class="hljs-number">0</span>].addEventListener css.transitionEnd, <span class="hljs-property">@_onTransitionEnd</span>, <span class="hljs-literal">false</span>
(<span class="hljs-property">@_lastOp</span> = operation).reset = <span class="hljs-literal">false</span></pre></div></div>
</li>
<li id="section-116">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-116">¶</a>
</div>
<p>Handler called when a CSS transition ends.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">_onTransitionEnd</span>: <span class="hljs-function"><span class="hljs-params">(e)</span> =></span></pre></div></div>
</li>
<li id="section-117">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-117">¶</a>
</div>
<p>Remove the event listener immediately to prevent bubbling.</p>
</div>
<div class="content"><div class='highlight'><pre> e.currentTarget.removeEventListener css.transitionEnd, <span class="hljs-property">@_onTransitionEnd</span>, <span class="hljs-literal">false</span></pre></div></div>
</li>
<li id="section-118">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-118">¶</a>
</div>
<p>Initialize the transition teardown process.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-property">@_conclude</span> <span class="hljs-property">@_lastOp</span>.options.callback, e</pre></div></div>
</li>
<li id="section-119">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-119">¶</a>
</div>
<p>Used to handle the end process of transitions and to initialize queued operations.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">_conclude</span>: <span class="hljs-function"><span class="hljs-params">(cb, event)</span> =></span>
defer <span class="hljs-function">=></span>
<span class="hljs-property">@_inTrans</span> = <span class="hljs-literal">false</span>
<span class="hljs-property">@_step</span>()
cb? event, @</pre></div></div>
</li>
<li id="section-120">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-120">¶</a>
</div>
<p>Transforms a given element based on angle, anchor, and fracture boolean.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">_transformPanel</span>: <span class="hljs-function"><span class="hljs-params">(el, angle, anchor, fracture)</span> -></span>
x = y = z = <span class="hljs-number">0</span>
<span class="hljs-keyword">switch</span> anchor
<span class="hljs-keyword">when</span> <span class="hljs-string">'left'</span>
y = angle
transPrefix = <span class="hljs-string">'X(-'</span>
<span class="hljs-keyword">when</span> <span class="hljs-string">'right'</span>
y = -angle
transPrefix = <span class="hljs-string">'X('</span>
<span class="hljs-keyword">when</span> <span class="hljs-string">'top'</span>
x = -angle
transPrefix = <span class="hljs-string">'Y(-'</span>
<span class="hljs-keyword">when</span> <span class="hljs-string">'bottom'</span>
x = angle
transPrefix = <span class="hljs-string">'Y('</span></pre></div></div>
</li>
<li id="section-121">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-121">¶</a>
</div>
<p>Rotate on every axis in fracture mode.</p>
</div>
<div class="content"><div class='highlight'><pre> x = y = z = angle <span class="hljs-keyword">if</span> fracture
el.style[css.transform] = <span class="hljs-string">"
rotateX(<span class="hljs-subst">#{ x }</span>deg)
rotateY(<span class="hljs-subst">#{ y }</span>deg)
rotateZ(<span class="hljs-subst">#{ z }</span>deg)
translate<span class="hljs-subst">#{ transPrefix }</span><span class="hljs-subst">#{ <span class="hljs-property">@_config</span>.gapNudge }</span>px)
"</span></pre></div></div>
</li>
<li id="section-122">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-122">¶</a>
</div>
<p>This validates a given angle by making sure it’s a float and by
keeping it within the maximum range specified in the instance settings.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">_normalizeAngle</span>: <span class="hljs-function"><span class="hljs-params">(angle)</span> -></span>
angle = parseFloat angle, <span class="hljs-number">10</span>
max = <span class="hljs-property">@_config</span>.maxAngle
<span class="hljs-keyword">if</span> isNaN angle
<span class="hljs-number">0</span>
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> angle > max
max
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> angle < -max
-max
<span class="hljs-keyword">else</span>
angle</pre></div></div>
</li>
<li id="section-123">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-123">¶</a>
</div>
<p>Allows other methods to change the transition duration/delay or disable it altogether.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">_setTrans</span>: <span class="hljs-function"><span class="hljs-params">(duration, delay, anchor = <span class="hljs-property">@_lastOp</span>.anchor)</span> -></span>
<span class="hljs-property">@_iterate</span> anchor, <span class="hljs-function"><span class="hljs-params">(panel, i, len)</span> =></span> <span class="hljs-property">@_setPanelTrans</span> anchor, arguments..., duration, delay</pre></div></div>
</li>
<li id="section-124">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-124">¶</a>
</div>
<p>This method changes the transition duration and delay of panels and shaders.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">_setPanelTrans</span>: <span class="hljs-function"><span class="hljs-params">(anchor, panel, i, len, duration, delay)</span> -></span>
delayMs =</pre></div></div>
</li>
<li id="section-125">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-125">¶</a>
</div>
<p>Delay is a <code>ripple</code> value. The milliseconds are derived based on the
speed setting and the number of panels.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">switch</span> delay
<span class="hljs-keyword">when</span> <span class="hljs-number">0</span> <span class="hljs-keyword">then</span> <span class="hljs-number">0</span>
<span class="hljs-keyword">when</span> <span class="hljs-number">1</span> <span class="hljs-keyword">then</span> <span class="hljs-property">@_config</span>.speed / len * i
<span class="hljs-keyword">when</span> <span class="hljs-number">2</span> <span class="hljs-keyword">then</span> <span class="hljs-property">@_config</span>.speed / len * (len - i - <span class="hljs-number">1</span>)
panel.style[css.transitionDuration] = duration + <span class="hljs-string">'ms'</span>
panel.style[css.transitionDelay] = delayMs + <span class="hljs-string">'ms'</span>
<span class="hljs-keyword">if</span> <span class="hljs-property">@_shading</span>
<span class="hljs-keyword">for</span> side <span class="hljs-keyword">in</span> (<span class="hljs-keyword">if</span> anchor <span class="hljs-keyword">in</span> anchorListV <span class="hljs-keyword">then</span> anchorListV <span class="hljs-keyword">else</span> anchorListH)
shader = <span class="hljs-property">@_shaders</span>[anchor][side][i]
shader.style[css.transitionDuration] = duration + <span class="hljs-string">'ms'</span>
shader.style[css.transitionDelay] = delayMs + <span class="hljs-string">'ms'</span>
delayMs</pre></div></div>
</li>
<li id="section-126">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-126">¶</a>
</div>
<p>Determines a shader’s opacity based upon panel position, anchor, and angle.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">_setShader</span>: <span class="hljs-function"><span class="hljs-params">(n, anchor, angle)</span> -></span></pre></div></div>
</li>
<li id="section-127">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-127">¶</a>
</div>
<p>Store the angle’s absolute value and generate an opacity based on <code>shadingIntensity</code>.</p>
</div>
<div class="content"><div class='highlight'><pre> abs = Math.abs angle
opacity = abs / <span class="hljs-number">90</span> * <span class="hljs-property">@_config</span>.shadingIntensity</pre></div></div>
</li>
<li id="section-128">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-128">¶</a>
</div>
<p>With hard shading, opacity is reduced and <code>angle</code> is based on the global
<code>lastAngle</code> so all panels’ shaders share the same direction. Soft shaders
have alternating directions.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> <span class="hljs-property">@_shading</span> <span class="hljs-keyword">is</span> <span class="hljs-string">'hard'</span>
opacity *= <span class="hljs-number">.15</span>
<span class="hljs-keyword">if</span> <span class="hljs-property">@_lastOp</span>.angle < <span class="hljs-number">0</span>
angle = abs
<span class="hljs-keyword">else</span>
angle = -abs
<span class="hljs-keyword">else</span>
opacity *= <span class="hljs-number">.4</span></pre></div></div>
</li>
<li id="section-129">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-129">¶</a>
</div>
<p>This block makes sure left and top shaders appear for negative angles and right
and bottom shaders appear for positive ones.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> anchor <span class="hljs-keyword">in</span> anchorListV
<span class="hljs-keyword">if</span> angle < <span class="hljs-number">0</span>
a = opacity
b = <span class="hljs-number">0</span>
<span class="hljs-keyword">else</span>
a = <span class="hljs-number">0</span>
b = opacity
<span class="hljs-property">@_shaders</span>[anchor].left[n].style.opacity = a
<span class="hljs-property">@_shaders</span>[anchor].right[n].style.opacity = b
<span class="hljs-keyword">else</span>
<span class="hljs-keyword">if</span> angle < <span class="hljs-number">0</span>
a = <span class="hljs-number">0</span>
b = opacity
<span class="hljs-keyword">else</span>
a = opacity
b = <span class="hljs-number">0</span>
<span class="hljs-property">@_shaders</span>[anchor].top[n].style.opacity = a
<span class="hljs-property">@_shaders</span>[anchor].bottom[n].style.opacity = b</pre></div></div>
</li>
<li id="section-130">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-130">¶</a>
</div>
<p>This method shows the requested stage element and sets a reference to it as
the current stage.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">_showStage</span>: <span class="hljs-function"><span class="hljs-params">(anchor)</span> -></span>
<span class="hljs-keyword">if</span> anchor <span class="hljs-keyword">isnt</span> <span class="hljs-property">@_lastOp</span>.anchor
hideEl <span class="hljs-property">@_stages</span>[<span class="hljs-property">@_lastOp</span>.anchor]
<span class="hljs-property">@_lastOp</span>.anchor = anchor
<span class="hljs-property">@_lastOp</span>.reset = <span class="hljs-literal">true</span>
<span class="hljs-property">@_stages</span>[anchor].style[css.transform] = <span class="hljs-string">'translate3d('</span> +
<span class="hljs-keyword">switch</span> anchor
<span class="hljs-keyword">when</span> <span class="hljs-string">'left'</span>
<span class="hljs-string">'0, 0, 0)'</span>
<span class="hljs-keyword">when</span> <span class="hljs-string">'right'</span>
<span class="hljs-string">"-<span class="hljs-subst">#{ <span class="hljs-property">@_config</span>.vPanels.length }</span>px, 0, 0)"</span>
<span class="hljs-keyword">when</span> <span class="hljs-string">'top'</span>
<span class="hljs-string">'0, 0, 0)'</span>
<span class="hljs-keyword">when</span> <span class="hljs-string">'bottom'</span>
<span class="hljs-string">"0, -<span class="hljs-subst">#{ <span class="hljs-property">@_config</span>.hPanels.length }</span>px, 0)"</span></pre></div></div>
</li>
<li id="section-131">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-131">¶</a>
</div>
<p>If the composition needs to switch stages or fold up, it must first unfold
all panels to 0 degrees.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">_stageReset</span>: <span class="hljs-function"><span class="hljs-params">(anchor, cb)</span> =></span>
<span class="hljs-function"> <span class="hljs-title">fn</span> = <span class="hljs-params">(e)</span> =></span>
e.currentTarget.removeEventListener css.transitionEnd, fn, <span class="hljs-literal">false</span> <span class="hljs-keyword">if</span> e
<span class="hljs-property">@_showStage</span> anchor
defer cb</pre></div></div>
</li>
<li id="section-132">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-132">¶</a>
</div>
<p>If already unfolded to 0, immediately invoke the change function.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">return</span> fn() <span class="hljs-keyword">if</span> <span class="hljs-property">@_lastOp</span>.angle <span class="hljs-keyword">is</span> <span class="hljs-number">0</span>
<span class="hljs-property">@_panels</span>[<span class="hljs-property">@_lastOp</span>.anchor][<span class="hljs-number">0</span>].addEventListener css.transitionEnd, fn, <span class="hljs-literal">false</span>
<span class="hljs-property">@_iterate</span> <span class="hljs-property">@_lastOp</span>.anchor, <span class="hljs-function"><span class="hljs-params">(panel, i)</span> =></span>
<span class="hljs-property">@_transformPanel</span> panel, <span class="hljs-number">0</span>, <span class="hljs-property">@_lastOp</span>.anchor
<span class="hljs-property">@_setShader</span> i, <span class="hljs-property">@_lastOp</span>.anchor, <span class="hljs-number">0</span> <span class="hljs-keyword">if</span> <span class="hljs-property">@_shading</span></pre></div></div>
</li>
<li id="section-133">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-133">¶</a>
</div>
<p>Converts a shorthand anchor name to a full one.
Numerical shorthands are based on CSS shorthand ordering.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">_getLonghandAnchor</span>: <span class="hljs-function"><span class="hljs-params">(shorthand)</span> -></span>
<span class="hljs-keyword">switch</span> shorthand.toString()
<span class="hljs-keyword">when</span> <span class="hljs-string">'left'</span>, <span class="hljs-string">'l'</span>, <span class="hljs-string">'4'</span>
<span class="hljs-string">'left'</span>
<span class="hljs-keyword">when</span> <span class="hljs-string">'right'</span>, <span class="hljs-string">'r'</span>, <span class="hljs-string">'2'</span>
<span class="hljs-string">'right'</span>
<span class="hljs-keyword">when</span> <span class="hljs-string">'top'</span>, <span class="hljs-string">'t'</span>, <span class="hljs-string">'1'</span>
<span class="hljs-string">'top'</span>
<span class="hljs-keyword">when</span> <span class="hljs-string">'bottom'</span>, <span class="hljs-string">'b'</span>, <span class="hljs-string">'3'</span>
<span class="hljs-string">'bottom'</span>
<span class="hljs-keyword">else</span></pre></div></div>
</li>
<li id="section-134">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-134">¶</a>
</div>
<p>Left is always default.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-string">'left'</span></pre></div></div>
</li>
<li id="section-135">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-135">¶</a>
</div>
<p>Gives the element a resize cursor to prompt the user to drag the mouse.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">_setCursor</span>: <span class="hljs-function"><span class="hljs-params">(bool = <span class="hljs-property">@_touchEnabled</span>)</span> -></span>
<span class="hljs-keyword">if</span> bool
<span class="hljs-property">@el</span>.style.cursor = css.grab
<span class="hljs-keyword">else</span>
<span class="hljs-property">@el</span>.style.cursor = <span class="hljs-string">'default'</span></pre></div></div>
</li>
<li id="section-136">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-136">¶</a>
</div>
<h1 id="touch-drag-event-handlers">Touch / Drag Event Handlers</h1>
</div>
</li>
<li id="section-137">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-137">¶</a>
</div>
</div>
</li>
<li id="section-138">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-138">¶</a>
</div>
<p>Adds or removes handlers from the element based on the boolean argument given.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">_setTouch</span>: <span class="hljs-function"><span class="hljs-params">(toggle)</span> -></span>
<span class="hljs-keyword">if</span> toggle
<span class="hljs-keyword">return</span> @ <span class="hljs-keyword">if</span> <span class="hljs-property">@_touchEnabled</span>
listenFn = <span class="hljs-string">'addEventListener'</span>
<span class="hljs-keyword">else</span>
<span class="hljs-keyword">return</span> @ <span class="hljs-keyword">unless</span> <span class="hljs-property">@_touchEnabled</span>
listenFn = <span class="hljs-string">'removeEventListener'</span>
<span class="hljs-property">@_touchEnabled</span> = toggle
<span class="hljs-property">@_setCursor</span>()</pre></div></div>
</li>
<li id="section-139">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-139">¶</a>
</div>
<p>Array of event type pairs.</p>
</div>
<div class="content"><div class='highlight'><pre> eventPairs = [[<span class="hljs-string">'TouchStart'</span>, <span class="hljs-string">'MouseDown'</span>], [<span class="hljs-string">'TouchEnd'</span>, <span class="hljs-string">'MouseUp'</span>],
[<span class="hljs-string">'TouchMove'</span>, <span class="hljs-string">'MouseMove'</span>], [<span class="hljs-string">'TouchLeave'</span>, <span class="hljs-string">'MouseLeave'</span>]]</pre></div></div>
</li>
<li id="section-140">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-140">¶</a>
</div>
<p>Detect native <code>mouseleave</code> support.</p>
</div>
<div class="content"><div class='highlight'><pre> mouseLeaveSupport = <span class="hljs-string">'onmouseleave'</span> <span class="hljs-keyword">of</span> <span class="hljs-built_in">window</span></pre></div></div>
</li>
<li id="section-141">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-141">¶</a>
</div>
<p>Attach touch/drag event listeners in related pairs.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">for</span> eventPair <span class="hljs-keyword">in</span> eventPairs
<span class="hljs-keyword">for</span> eString <span class="hljs-keyword">in</span> eventPair
<span class="hljs-keyword">unless</span> eString <span class="hljs-keyword">is</span> <span class="hljs-string">'TouchLeave'</span> <span class="hljs-keyword">and</span> !mouseLeaveSupport
<span class="hljs-property">@el</span>[listenFn] eString.toLowerCase(), @[<span class="hljs-string">'_on'</span> + eventPair[<span class="hljs-number">0</span>]], <span class="hljs-literal">false</span>
<span class="hljs-keyword">else</span>
<span class="hljs-property">@el</span>[listenFn] <span class="hljs-string">'mouseout'</span>, <span class="hljs-property">@_onMouseOut</span>, <span class="hljs-literal">false</span>
<span class="hljs-keyword">break</span>
@</pre></div></div>
</li>
<li id="section-142">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-142">¶</a>
</div>
<p>This method is called when a finger or mouse button is pressed on the element.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">_onTouchStart</span>: <span class="hljs-function"><span class="hljs-params">(e)</span> =></span>
<span class="hljs-keyword">return</span> <span class="hljs-keyword">if</span> !<span class="hljs-property">@_touchEnabled</span> <span class="hljs-keyword">or</span> <span class="hljs-property">@isFoldedUp</span>
e.preventDefault()</pre></div></div>
</li>
<li id="section-143">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-143">¶</a>
</div>
<p>Clear queued animations.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-property">@emptyQueue</span>()</pre></div></div>
</li>
<li id="section-144">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-144">¶</a>
</div>
<p>Set a property to track touch starts.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-property">@_touchStarted</span> = <span class="hljs-literal">true</span></pre></div></div>
</li>
<li id="section-145">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-145">¶</a>
</div>
<p>Change the cursor to the active <code>grabbing</code> state.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-property">@el</span>.style.cursor = css.grabbing</pre></div></div>
</li>
<li id="section-146">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-146">¶</a>
</div>
<p>Disable tweening to enable instant 1 to 1 movement.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-property">@_setTrans</span> <span class="hljs-number">0</span>, <span class="hljs-number">0</span></pre></div></div>
</li>
<li id="section-147">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-147">¶</a>
</div>
<p>Derive the axis to fold on.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-property">@_touchAxis</span> = <span class="hljs-keyword">if</span> <span class="hljs-property">@_lastOp</span>.anchor <span class="hljs-keyword">in</span> anchorListV <span class="hljs-keyword">then</span> <span class="hljs-string">'x'</span> <span class="hljs-keyword">else</span> <span class="hljs-string">'y'</span></pre></div></div>
</li>
<li id="section-148">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-148">¶</a>
</div>
<p>Set a reference to the last folded angle to accurately derive deltas.</p>
</div>
<div class="content"><div class='highlight'><pre> @[<span class="hljs-string">"_<span class="hljs-subst">#{ <span class="hljs-property">@_touchAxis</span> }</span>Last"</span>] = <span class="hljs-property">@_lastOp</span>.angle
axis1 = <span class="hljs-string">"_<span class="hljs-subst">#{ <span class="hljs-property">@_touchAxis</span> }</span>1"</span></pre></div></div>
</li>
<li id="section-149">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-149">¶</a>
</div>
<p>Determine the starting tap’s coordinate for touch and mouse events.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> e.type <span class="hljs-keyword">is</span> <span class="hljs-string">'mousedown'</span>
@[axis1] = e[<span class="hljs-string">"page<span class="hljs-subst">#{ <span class="hljs-property">@_touchAxis</span>.toUpperCase() }</span>"</span>]
<span class="hljs-keyword">else</span>
@[axis1] = e.targetTouches[<span class="hljs-number">0</span>][<span class="hljs-string">"page<span class="hljs-subst">#{ <span class="hljs-property">@_touchAxis</span>.toUpperCase() }</span>"</span>]</pre></div></div>
</li>
<li id="section-150">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-150">¶</a>
</div>
<p>Return that value to an external listener.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-property">@_config</span>.touchStartCallback @[axis1], e</pre></div></div>
</li>
<li id="section-151">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-151">¶</a>
</div>
<p>Called on touch/mouse movement.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">_onTouchMove</span>: <span class="hljs-function"><span class="hljs-params">(e)</span> =></span>
<span class="hljs-keyword">return</span> <span class="hljs-keyword">unless</span> <span class="hljs-property">@_touchEnabled</span> <span class="hljs-keyword">and</span> <span class="hljs-property">@_touchStarted</span>
e.preventDefault()</pre></div></div>
</li>
<li id="section-152">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-152">¶</a>
</div>
<p>Set a reference to the current x or y position.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> e.type <span class="hljs-keyword">is</span> <span class="hljs-string">'mousemove'</span>
current = e[<span class="hljs-string">"page<span class="hljs-subst">#{ <span class="hljs-property">@_touchAxis</span>.toUpperCase() }</span>"</span>]
<span class="hljs-keyword">else</span>
current = e.targetTouches[<span class="hljs-number">0</span>][<span class="hljs-string">"page<span class="hljs-subst">#{ <span class="hljs-property">@_touchAxis</span>.toUpperCase() }</span>"</span>]</pre></div></div>
</li>
<li id="section-153">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-153">¶</a>
</div>
<p>Calculate distance and multiply by <code>touchSensitivity</code>.</p>
</div>
<div class="content"><div class='highlight'><pre> distance = (current - @[<span class="hljs-string">"_<span class="hljs-subst">#{ <span class="hljs-property">@_touchAxis</span> }</span>1"</span>]) * <span class="hljs-property">@_config</span>.touchSensitivity</pre></div></div>
</li>
<li id="section-154">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-154">¶</a>
</div>
<p>Calculate final delta based on starting angle, anchor, and what side of zero
the last operation was on.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> <span class="hljs-property">@_lastOp</span>.angle < <span class="hljs-number">0</span>
<span class="hljs-keyword">if</span> <span class="hljs-property">@_lastOp</span>.anchor <span class="hljs-keyword">is</span> <span class="hljs-string">'right'</span> <span class="hljs-keyword">or</span> <span class="hljs-property">@_lastOp</span>.anchor <span class="hljs-keyword">is</span> <span class="hljs-string">'bottom'</span>
delta = @[<span class="hljs-string">"_<span class="hljs-subst">#{ <span class="hljs-property">@_touchAxis</span> }</span>Last"</span>] - distance
<span class="hljs-keyword">else</span>
delta = @[<span class="hljs-string">"_<span class="hljs-subst">#{ <span class="hljs-property">@_touchAxis</span> }</span>Last"</span>] + distance
delta = <span class="hljs-number">0</span> <span class="hljs-keyword">if</span> delta > <span class="hljs-number">0</span>
<span class="hljs-keyword">else</span>
<span class="hljs-keyword">if</span> <span class="hljs-property">@_lastOp</span>.anchor <span class="hljs-keyword">is</span> <span class="hljs-string">'right'</span> <span class="hljs-keyword">or</span> <span class="hljs-property">@_lastOp</span>.anchor <span class="hljs-keyword">is</span> <span class="hljs-string">'bottom'</span>
delta = @[<span class="hljs-string">"_<span class="hljs-subst">#{ <span class="hljs-property">@_touchAxis</span> }</span>Last"</span>] + distance
<span class="hljs-keyword">else</span>
delta = @[<span class="hljs-string">"_<span class="hljs-subst">#{ <span class="hljs-property">@_touchAxis</span> }</span>Last"</span>] - distance
delta = <span class="hljs-number">0</span> <span class="hljs-keyword">if</span> delta < <span class="hljs-number">0</span>
<span class="hljs-property">@_lastOp</span>.angle = delta = <span class="hljs-property">@_normalizeAngle</span> delta
<span class="hljs-property">@_lastOp</span>.fn.call @, delta, <span class="hljs-property">@_lastOp</span>.anchor, <span class="hljs-property">@_lastOp</span>.options
<span class="hljs-property">@_config</span>.touchMoveCallback delta, e</pre></div></div>
</li>
<li id="section-155">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-155">¶</a>
</div>
<p>Teardown process when touch/drag event ends.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">_onTouchEnd</span>: <span class="hljs-function"><span class="hljs-params">(e)</span> =></span>
<span class="hljs-keyword">return</span> <span class="hljs-keyword">unless</span> <span class="hljs-property">@_touchEnabled</span></pre></div></div>
</li>
<li id="section-156">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-156">¶</a>
</div>
<p>Restore the initial touch status and cursor.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-property">@_touchStarted</span> = <span class="hljs-property">@_inTrans</span> = <span class="hljs-literal">false</span>
<span class="hljs-property">@el</span>.style.cursor = css.grab</pre></div></div>
</li>
<li id="section-157">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-157">¶</a>
</div>
<p>Enable transitions again.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-property">@_setTrans</span> <span class="hljs-property">@_config</span>.speed, <span class="hljs-property">@_config</span>.ripple</pre></div></div>
</li>
<li id="section-158">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-158">¶</a>
</div>
<p>Pass callback final coordinate.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-property">@_config</span>.touchEndCallback @[<span class="hljs-string">"_<span class="hljs-subst">#{ <span class="hljs-property">@_touchAxis</span> }</span>Last"</span>], e</pre></div></div>
</li>
<li id="section-159">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-159">¶</a>
</div>
<p>End folding when the mouse or finger leaves the composition.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">_onTouchLeave</span>: <span class="hljs-function"><span class="hljs-params">(e)</span> =></span>
<span class="hljs-keyword">return</span> <span class="hljs-keyword">unless</span> <span class="hljs-property">@_touchEnabled</span> <span class="hljs-keyword">and</span> <span class="hljs-property">@_touchStarted</span>
<span class="hljs-property">@_onTouchEnd</span> e</pre></div></div>
</li>
<li id="section-160">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-160">¶</a>
</div>
<p>A fallback for browsers that don’t support <code>mouseleave</code>.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">_onMouseOut</span>: <span class="hljs-function"><span class="hljs-params">(e)</span> =></span>
<span class="hljs-keyword">return</span> <span class="hljs-keyword">unless</span> <span class="hljs-property">@_touchEnabled</span> <span class="hljs-keyword">and</span> <span class="hljs-property">@_touchStarted</span>
<span class="hljs-property">@_onTouchEnd</span> e <span class="hljs-keyword">if</span> e.toElement <span class="hljs-keyword">and</span> !<span class="hljs-property">@el</span>.contains e.toElement</pre></div></div>
</li>
<li id="section-161">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-161">¶</a>
</div>
<p>This method unfolds the composition after it’s been folded up. It’s private
and doesn’t use the decorator because it’s used internally by other methods
and skips the queue. Its public counterpart is a queued alias.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">_unfold</span>: <span class="hljs-function"><span class="hljs-params">(callback)</span> -></span>
<span class="hljs-property">@_inTrans</span> = <span class="hljs-literal">true</span>
{anchor} = <span class="hljs-property">@_lastOp</span>
<span class="hljs-property">@_iterate</span> anchor, <span class="hljs-function"><span class="hljs-params">(panel, i, len)</span> =></span>
delay = <span class="hljs-property">@_setPanelTrans</span> anchor, arguments..., <span class="hljs-property">@_config</span>.speed, <span class="hljs-number">1</span>
<span class="hljs-keyword">do</span> <span class="hljs-function"><span class="hljs-params">(panel, i, delay)</span> =></span>
defer <span class="hljs-function">=></span>
<span class="hljs-property">@_transformPanel</span> panel, <span class="hljs-number">0</span>, anchor
<span class="hljs-property">@_setShader</span> i, anchor, <span class="hljs-number">0</span> <span class="hljs-keyword">if</span> <span class="hljs-property">@_shading</span>
setTimeout <span class="hljs-function">=></span>
showEl panel.children[<span class="hljs-number">0</span>]
<span class="hljs-keyword">if</span> i <span class="hljs-keyword">is</span> len - <span class="hljs-number">1</span>
<span class="hljs-property">@_inTrans</span> = <span class="hljs-property">@isFoldedUp</span> = <span class="hljs-literal">false</span>
callback?()
<span class="hljs-property">@_lastOp</span>.fn = <span class="hljs-property">@accordion</span>
<span class="hljs-property">@_lastOp</span>.angle = <span class="hljs-number">0</span>
defer <span class="hljs-function">=></span> panel.style[css.transitionDuration] = <span class="hljs-property">@_config</span>.speed
, delay + <span class="hljs-property">@_config</span>.speed * <span class="hljs-number">.25</span></pre></div></div>
</li>
<li id="section-162">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-162">¶</a>
</div>
<p>This method is used by many others to iterate among panels within a given anchor.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">_iterate</span>: <span class="hljs-function"><span class="hljs-params">(anchor, fn)</span> -></span>
fn.call @, panel, i, panels.length <span class="hljs-keyword">for</span> panel, i <span class="hljs-keyword">in</span> panels = <span class="hljs-property">@_panels</span>[anchor]</pre></div></div>
</li>
<li id="section-163">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-163">¶</a>
</div>
<h1 id="public-methods">Public Methods</h1>
</div>
</li>
<li id="section-164">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-164">¶</a>
</div>
</div>
</li>
<li id="section-165">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-165">¶</a>
</div>
<p>Enables touch events.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">enableTouch</span>:<span class="hljs-function"> -></span>
<span class="hljs-property">@_setTouch</span> <span class="hljs-literal">true</span></pre></div></div>
</li>
<li id="section-166">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-166">¶</a>
</div>
<p>Disables touch events.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">disableTouch</span>:<span class="hljs-function"> -></span>
<span class="hljs-property">@_setTouch</span> <span class="hljs-literal">false</span></pre></div></div>
</li>
<li id="section-167">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-167">¶</a>
</div>
<p>Public setter for transition durations.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">setSpeed</span>: <span class="hljs-function"><span class="hljs-params">(speed)</span> -></span>
<span class="hljs-keyword">for</span> anchor <span class="hljs-keyword">in</span> anchorList
<span class="hljs-property">@_setTrans</span> (<span class="hljs-property">@_config</span>.speed = speed), <span class="hljs-property">@_config</span>.ripple, anchor
@</pre></div></div>
</li>
<li id="section-168">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-168">¶</a>
</div>
<p>Disables OriDomi slicing by showing the original, untouched target element.
This is useful for certain user interactions on the inner content.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">freeze</span>: <span class="hljs-function"><span class="hljs-params">(callback)</span> -></span></pre></div></div>
</li>
<li id="section-169">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-169">¶</a>
</div>
<p>Return if already frozen.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> <span class="hljs-property">@isFrozen</span>
callback?()
<span class="hljs-keyword">else</span></pre></div></div>
</li>
<li id="section-170">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-170">¶</a>
</div>
<p>Make sure to reset folding first.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-property">@_stageReset</span> <span class="hljs-property">@_lastOp</span>.anchor,<span class="hljs-function"> =></span>
<span class="hljs-property">@isFrozen</span> = <span class="hljs-literal">true</span></pre></div></div>
</li>
<li id="section-171">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-171">¶</a>
</div>
<p>Swap the visibility of the elements.</p>
</div>
<div class="content"><div class='highlight'><pre> hideEl <span class="hljs-property">@_stageHolder</span>
showEl <span class="hljs-property">@_cloneEl</span>
<span class="hljs-property">@_setCursor</span> <span class="hljs-literal">false</span>
callback?()
@</pre></div></div>
</li>
<li id="section-172">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-172">¶</a>
</div>
<p>Restores the OriDomi version of the element for folding purposes.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">unfreeze</span>:<span class="hljs-function"> -></span></pre></div></div>
</li>
<li id="section-173">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-173">¶</a>
</div>
<p>Only unfreeze if already frozen.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> <span class="hljs-property">@isFrozen</span>
<span class="hljs-property">@isFrozen</span> = <span class="hljs-literal">false</span></pre></div></div>
</li>
<li id="section-174">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-174">¶</a>
</div>
<p>Swap the visibility of the elements.</p>
</div>
<div class="content"><div class='highlight'><pre> hideEl <span class="hljs-property">@_cloneEl</span>
showEl <span class="hljs-property">@_stageHolder</span>
<span class="hljs-property">@_setCursor</span>()</pre></div></div>
</li>
<li id="section-175">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-175">¶</a>
</div>
<p>Set <code>lastAngle</code> to 0 so an immediately subsequent call to <code>freeze</code> triggers the callback.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-property">@_lastOp</span>.angle = <span class="hljs-number">0</span>
@</pre></div></div>
</li>
<li id="section-176">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-176">¶</a>
</div>
<p>Removes the OriDomi element and restores the original element.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">destroy</span>: <span class="hljs-function"><span class="hljs-params">(callback)</span> -></span></pre></div></div>
</li>
<li id="section-177">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-177">¶</a>
</div>
<p>First restore the original element.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-property">@freeze</span> <span class="hljs-function">=></span></pre></div></div>
</li>
<li id="section-178">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-178">¶</a>
</div>
<p>Remove event listeners.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-property">@_setTouch</span> <span class="hljs-literal">false</span></pre></div></div>
</li>
<li id="section-179">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-179">¶</a>
</div>
<p>Remove the data reference if using jQuery.</p>
</div>
<div class="content"><div class='highlight'><pre> $.data <span class="hljs-property">@el</span>, baseName, <span class="hljs-literal">null</span> <span class="hljs-keyword">if</span> $</pre></div></div>
</li>
<li id="section-180">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-180">¶</a>
</div>
<p>Remove the OriDomi element from the DOM.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-property">@el</span>.innerHTML = <span class="hljs-property">@_cloneEl</span>.innerHTML</pre></div></div>
</li>
<li id="section-181">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-181">¶</a>
</div>
<p>Reset original styling.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-property">@el</span>.classList.remove elClasses.active
callback?()
<span class="hljs-literal">null</span></pre></div></div>
</li>
<li id="section-182">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-182">¶</a>
</div>
<p>Empties the queue should you want to cancel scheduled animations.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">emptyQueue</span>:<span class="hljs-function"> -></span>
<span class="hljs-property">@_queue</span> = []
defer <span class="hljs-function">=></span> <span class="hljs-property">@_inTrans</span> = <span class="hljs-literal">false</span>
@</pre></div></div>
</li>
<li id="section-183">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-183">¶</a>
</div>
<p>Enable or disable ripple. 1 is forwards, 2 is backwards, 0 is disabled.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">setRipple</span>: <span class="hljs-function"><span class="hljs-params">(dir = <span class="hljs-number">1</span>)</span> -></span>
<span class="hljs-property">@_config</span>.ripple = Number dir
<span class="hljs-property">@setSpeed</span> <span class="hljs-property">@_config</span>.speed
@</pre></div></div>
</li>
<li id="section-184">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-184">¶</a>
</div>
<p>Setter method for <code>maxAngle</code>.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">constrainAngle</span>: <span class="hljs-function"><span class="hljs-params">(angle)</span> -></span>
<span class="hljs-property">@_config</span>.maxAngle = parseFloat(angle, <span class="hljs-number">10</span>) <span class="hljs-keyword">or</span> defaults.maxAngle
@</pre></div></div>
</li>
<li id="section-185">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-185">¶</a>
</div>
<p>Pause in the midst of an animation sequence, in milliseconds.
E.g.: el.reveal(20).wait(5000).accordion(-33)</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">wait</span>: <span class="hljs-function"><span class="hljs-params">(ms)</span> -></span>
<span class="hljs-function"> <span class="hljs-title">fn</span> = =></span> setTimeout <span class="hljs-property">@_conclude</span>, ms
<span class="hljs-keyword">if</span> <span class="hljs-property">@_inTrans</span>
<span class="hljs-property">@_queue</span>.push [fn, <span class="hljs-property">@_lastOp</span>.angle, <span class="hljs-property">@_lastOp</span>.anchor, <span class="hljs-property">@_lastOp</span>.options]
<span class="hljs-keyword">else</span>
fn()
@</pre></div></div>
</li>
<li id="section-186">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-186">¶</a>
</div>
<p>This method is used to externally manipulate the styling or contents of the
composition. Manipulation instructions can be supplied via a function (invoked
with each panel element), or a map of selectors with instructions.
Instruction values can be text to implicitly update <code>innerHTML</code> content or
objects with <code>style</code> and/or <code>content</code> keys. Style keys should contain object
literals with camel-cased CSS properties as keys.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">modifyContent</span>: <span class="hljs-function"><span class="hljs-params">(fn)</span> -></span>
<span class="hljs-keyword">if</span> <span class="hljs-keyword">typeof</span> fn <span class="hljs-keyword">isnt</span> <span class="hljs-string">'function'</span>
selectors = fn
<span class="hljs-function">
<span class="hljs-title">set</span> = <span class="hljs-params">(el, content, style)</span> -></span>
el.innerHTML = content <span class="hljs-keyword">if</span> content
<span class="hljs-keyword">if</span> style
el.style[key] = value <span class="hljs-keyword">for</span> key, value <span class="hljs-keyword">of</span> style
<span class="hljs-literal">null</span>
<span class="hljs-function">
<span class="hljs-title">fn</span> = <span class="hljs-params">(el)</span> -></span>
<span class="hljs-keyword">for</span> selector, value <span class="hljs-keyword">of</span> selectors
content = style = <span class="hljs-literal">null</span>
<span class="hljs-keyword">if</span> <span class="hljs-keyword">typeof</span> value <span class="hljs-keyword">is</span> <span class="hljs-string">'string'</span>
content = value
<span class="hljs-keyword">else</span>
{content, style} = value
<span class="hljs-keyword">if</span> selector <span class="hljs-keyword">is</span> <span class="hljs-string">''</span>
set el, content, style
<span class="hljs-keyword">continue</span>
set match, content, style <span class="hljs-keyword">for</span> match <span class="hljs-keyword">in</span> el.querySelectorAll selector
<span class="hljs-literal">null</span>
<span class="hljs-keyword">for</span> anchor <span class="hljs-keyword">in</span> anchorList
<span class="hljs-keyword">for</span> panel, i <span class="hljs-keyword">in</span> <span class="hljs-property">@_panels</span>[anchor]
fn panel.children[<span class="hljs-number">0</span>].children[<span class="hljs-number">0</span>], i, anchor
@</pre></div></div>
</li>
<li id="section-187">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-187">¶</a>
</div>
<h1 id="effect-methods">Effect Methods</h1>
</div>
</li>
<li id="section-188">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-188">¶</a>
</div>
</div>
</li>
<li id="section-189">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-189">¶</a>
</div>
<p>Base effect with alternating peaks and valleys.
<code>reveal</code> relies on it by calling it with <code>sticky: true</code> to keep the first
panel flat.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">accordion</span>: prep <span class="hljs-function"><span class="hljs-params">(angle, anchor, options)</span> -></span>
<span class="hljs-property">@_iterate</span> anchor, <span class="hljs-function"><span class="hljs-params">(panel, i)</span> =></span></pre></div></div>
</li>
<li id="section-190">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-190">¶</a>
</div>
<p>With an odd-numbered panel, reverse the angle.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> i % <span class="hljs-number">2</span> <span class="hljs-keyword">isnt</span> <span class="hljs-number">0</span> <span class="hljs-keyword">and</span> !options.twist
deg = -angle
<span class="hljs-keyword">else</span>
deg = angle</pre></div></div>
</li>
<li id="section-191">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-191">¶</a>
</div>
<p>If sticky, keep the first panel flat.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> options.sticky
<span class="hljs-keyword">if</span> i <span class="hljs-keyword">is</span> <span class="hljs-number">0</span>
deg = <span class="hljs-number">0</span>
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> i > <span class="hljs-number">1</span> <span class="hljs-keyword">or</span> options.stairs
deg *= <span class="hljs-number">2</span>
<span class="hljs-keyword">else</span></pre></div></div>
</li>
<li id="section-192">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-192">¶</a>
</div>
<p>Double the angle to counteract the angle of the parent panel.</p>
</div>
<div class="content"><div class='highlight'><pre> deg *= <span class="hljs-number">2</span> <span class="hljs-keyword">unless</span> i <span class="hljs-keyword">is</span> <span class="hljs-number">0</span></pre></div></div>
</li>
<li id="section-193">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-193">¶</a>
</div>
<p>In stairs mode, keep all the angles on the same side of 0.</p>
</div>
<div class="content"><div class='highlight'><pre> deg *= -<span class="hljs-number">1</span> <span class="hljs-keyword">if</span> options.stairs</pre></div></div>
</li>
<li id="section-194">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-194">¶</a>
</div>
<p>Set the CSS transformation.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-property">@_transformPanel</span> panel, deg, anchor, options.fracture
<span class="hljs-keyword">if</span> <span class="hljs-property">@_shading</span>
<span class="hljs-keyword">if</span> options.twist <span class="hljs-keyword">or</span> options.fracture <span class="hljs-keyword">or</span> (i <span class="hljs-keyword">is</span> <span class="hljs-number">0</span> <span class="hljs-keyword">and</span> options.sticky)
<span class="hljs-property">@_setShader</span> i, anchor, <span class="hljs-number">0</span>
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> Math.abs(deg) <span class="hljs-keyword">isnt</span> <span class="hljs-number">180</span>
<span class="hljs-property">@_setShader</span> i, anchor, deg</pre></div></div>
</li>
<li id="section-195">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-195">¶</a>
</div>
<p>This effect appears to bend rather than fold the paper. Its curves can
appear smoother with higher panel counts.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">curl</span>: prep <span class="hljs-function"><span class="hljs-params">(angle, anchor, options)</span> -></span></pre></div></div>
</li>
<li id="section-196">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-196">¶</a>
</div>
<p>Reduce the angle based on the number of panels in this axis.</p>
</div>
<div class="content"><div class='highlight'><pre> angle /= <span class="hljs-keyword">if</span> anchor <span class="hljs-keyword">in</span> anchorListV <span class="hljs-keyword">then</span> <span class="hljs-property">@_config</span>.vPanels.length <span class="hljs-keyword">else</span> <span class="hljs-property">@_config</span>.hPanels.length
<span class="hljs-property">@_iterate</span> anchor, <span class="hljs-function"><span class="hljs-params">(panel, i)</span> =></span>
<span class="hljs-property">@_transformPanel</span> panel, angle, anchor
<span class="hljs-property">@_setShader</span> i, anchor, <span class="hljs-number">0</span> <span class="hljs-keyword">if</span> <span class="hljs-property">@_shading</span></pre></div></div>
</li>
<li id="section-197">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-197">¶</a>
</div>
<p>Lifts up all panels after the first one.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">ramp</span>: prep <span class="hljs-function"><span class="hljs-params">(angle, anchor, options)</span> -></span></pre></div></div>
</li>
<li id="section-198">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-198">¶</a>
</div>
<p>Rotate the second panel for the lift up.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-property">@_transformPanel</span> <span class="hljs-property">@_panels</span>[anchor][<span class="hljs-number">1</span>], angle, anchor</pre></div></div>
</li>
<li id="section-199">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-199">¶</a>
</div>
<p>For all but the second panel, set the angle to 0.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-property">@_iterate</span> anchor, <span class="hljs-function"><span class="hljs-params">(panel, i)</span> =></span>
<span class="hljs-property">@_transformPanel</span> panel, <span class="hljs-number">0</span>, anchor <span class="hljs-keyword">if</span> i <span class="hljs-keyword">isnt</span> <span class="hljs-number">1</span>
<span class="hljs-property">@_setShader</span> i, anchor, <span class="hljs-number">0</span> <span class="hljs-keyword">if</span> <span class="hljs-property">@_shading</span></pre></div></div>
</li>
<li id="section-200">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-200">¶</a>
</div>
<p>Hides the element by folding each panel in a cascade of animations.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">foldUp</span>: prep <span class="hljs-function"><span class="hljs-params">(anchor, callback)</span> -></span>
<span class="hljs-keyword">return</span> callback?() <span class="hljs-keyword">if</span> <span class="hljs-property">@isFoldedUp</span>
<span class="hljs-property">@_stageReset</span> anchor,<span class="hljs-function"> =></span>
<span class="hljs-property">@_inTrans</span> = <span class="hljs-property">@isFoldedUp</span> = <span class="hljs-literal">true</span>
<span class="hljs-property">@_iterate</span> anchor, <span class="hljs-function"><span class="hljs-params">(panel, i, len)</span> =></span>
duration = <span class="hljs-property">@_config</span>.speed
duration /= <span class="hljs-number">2</span> <span class="hljs-keyword">if</span> i <span class="hljs-keyword">is</span> <span class="hljs-number">0</span>
delay = <span class="hljs-property">@_setPanelTrans</span> anchor, arguments..., duration, <span class="hljs-number">2</span>
<span class="hljs-keyword">do</span> <span class="hljs-function"><span class="hljs-params">(panel, i, delay)</span> =></span>
defer <span class="hljs-function">=></span>
<span class="hljs-property">@_transformPanel</span> panel, (<span class="hljs-keyword">if</span> i <span class="hljs-keyword">is</span> <span class="hljs-number">0</span> <span class="hljs-keyword">then</span> <span class="hljs-number">90</span> <span class="hljs-keyword">else</span> <span class="hljs-number">170</span>), anchor
setTimeout <span class="hljs-function">=></span>
<span class="hljs-keyword">if</span> i <span class="hljs-keyword">is</span> <span class="hljs-number">0</span>
<span class="hljs-property">@_inTrans</span> = <span class="hljs-literal">false</span>
callback?()
<span class="hljs-keyword">else</span>
hideEl panel.children[<span class="hljs-number">0</span>]
, delay + <span class="hljs-property">@_config</span>.speed * <span class="hljs-number">.25</span></pre></div></div>
</li>
<li id="section-201">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-201">¶</a>
</div>
<p>This is the queued version of <code>_unfold</code>.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">unfold</span>: prep @::_unfold</pre></div></div>
</li>
<li id="section-202">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-202">¶</a>
</div>
<p>For custom folding behavior, you can pass a function to <code>map()</code> that will
determine the folding angle applied to each panel. The passed function
is supplied with the input angle, the panel index, and the number of
panels in the active anchor. Calling map returns a new function bound to
the instance and the lambda, e.g. <code>oridomi.map(randomFn)(30).reveal(20)</code>.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">map</span>: <span class="hljs-function"><span class="hljs-params">(fn)</span> -></span>
prep <span class="hljs-function"><span class="hljs-params">(angle, anchor, options)</span> =></span>
<span class="hljs-property">@_iterate</span> anchor, <span class="hljs-function"><span class="hljs-params">(panel, i, len)</span> =></span>
<span class="hljs-property">@_transformPanel</span> panel, fn(angle, i, len), anchor, options.fracture
.bind @</pre></div></div>
</li>
<li id="section-203">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-203">¶</a>
</div>
<h1 id="convenience-methods">Convenience Methods</h1>
</div>
</li>
<li id="section-204">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-204">¶</a>
</div>
</div>
</li>
<li id="section-205">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-205">¶</a>
</div>
<p>Resets all panels back to zero degrees.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">reset</span>: <span class="hljs-function"><span class="hljs-params">(callback)</span> -></span>
<span class="hljs-property">@accordion</span> <span class="hljs-number">0</span>, {callback}</pre></div></div>
</li>
<li id="section-206">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-206">¶</a>
</div>
<p>Simply proxy for calling <code>accordion</code> with <code>sticky</code> enabled.
Keeps first panel flat on page.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">reveal</span>: <span class="hljs-function"><span class="hljs-params">(angle, anchor, options = {})</span> -></span>
options.sticky = <span class="hljs-literal">true</span>
<span class="hljs-property">@accordion</span> angle, anchor, options</pre></div></div>
</li>
<li id="section-207">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-207">¶</a>
</div>
<p>Proxy to enable stairs mode on <code>accordion</code>.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">stairs</span>: <span class="hljs-function"><span class="hljs-params">(angle, anchor, options = {})</span> -></span>
options.stairs = options.sticky = <span class="hljs-literal">true</span>
<span class="hljs-property">@accordion</span> angle, anchor, options</pre></div></div>
</li>
<li id="section-208">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-208">¶</a>
</div>
<p>The composition is split apart by its panels rather than folded.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">fracture</span>: <span class="hljs-function"><span class="hljs-params">(angle, anchor, options = {})</span> -></span>
options.fracture = <span class="hljs-literal">true</span>
<span class="hljs-property">@accordion</span> angle, anchor, options</pre></div></div>
</li>
<li id="section-209">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-209">¶</a>
</div>
<p>Similar to <code>fracture</code>, but the panels are twisted as well.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">twist</span>: <span class="hljs-function"><span class="hljs-params">(angle, anchor, options = {})</span> -></span>
options.fracture = options.twist = <span class="hljs-literal">true</span>
<span class="hljs-property">@accordion</span> angle / <span class="hljs-number">10</span>, anchor, options</pre></div></div>
</li>
<li id="section-210">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-210">¶</a>
</div>
<p>Convenience proxy to accordion-fold instance to maximum angle.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">collapse</span>: <span class="hljs-function"><span class="hljs-params">(anchor, options = {})</span> -></span>
options.sticky = <span class="hljs-literal">false</span>
<span class="hljs-property">@accordion</span> -<span class="hljs-property">@_config</span>.maxAngle, anchor, options</pre></div></div>
</li>
<li id="section-211">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-211">¶</a>
</div>
<p>Same as <code>collapse</code>, but uses positive angle for slightly different effect.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">collapseAlt</span>: <span class="hljs-function"><span class="hljs-params">(anchor, options = {})</span> -></span>
options.sticky = <span class="hljs-literal">false</span>
<span class="hljs-property">@accordion</span> <span class="hljs-property">@_config</span>.maxAngle, anchor, options</pre></div></div>
</li>
<li id="section-212">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-212">¶</a>
</div>
<h1 id="statics">Statics</h1>
</div>
</li>
<li id="section-213">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-213">¶</a>
</div>
</div>
</li>
<li id="section-214">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-214">¶</a>
</div>
<p>Set a version flag for easy external retrieval.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-property">@VERSION</span> = <span class="hljs-string">'1.1.5'</span></pre></div></div>
</li>
<li id="section-215">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-215">¶</a>
</div>
<p>Externally reveal if OriDomi is supported by the browser.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-property">@isSupported</span> = isSupported</pre></div></div>
</li>
<li id="section-216">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-216">¶</a>
</div>
<p>Expose the OriDomi constructor via CommonJS, AMD, or the window object.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-keyword">if</span> <span class="hljs-built_in">module</span>?.exports
<span class="hljs-built_in">module</span>.exports = OriDomi
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> define?.amd
define <span class="hljs-function">-></span> OriDomi
<span class="hljs-keyword">else</span>
<span class="hljs-built_in">window</span>.OriDomi = OriDomi</pre></div></div>
</li>
<li id="section-217">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-217">¶</a>
</div>
<h1 id="plugin-bridge">Plugin Bridge</h1>
</div>
</li>
<li id="section-218">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-218">¶</a>
</div>
</div>
</li>
<li id="section-219">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-219">¶</a>
</div>
<p>Only create bridge if jQuery (or an imitation supporting <code>data()</code>) exists.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-keyword">return</span> <span class="hljs-keyword">unless</span> $</pre></div></div>
</li>
<li id="section-220">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-220">¶</a>
</div>
<p>Attach an <code>OriDomi</code> method to <code>$</code>‘s prototype.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-attribute">$</span>::o<span class="hljs-function"><span class="hljs-title">riDomi</span> = <span class="hljs-params">(options)</span> -></span></pre></div></div>
</li>
<li id="section-221">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-221">¶</a>
</div>
<p>Return selection if OriDomi is unsupported by the browser.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">return</span> @ <span class="hljs-keyword">unless</span> isSupported
<span class="hljs-keyword">return</span> $.data @[<span class="hljs-number">0</span>], baseName <span class="hljs-keyword">if</span> options <span class="hljs-keyword">is</span> <span class="hljs-literal">true</span></pre></div></div>
</li>
<li id="section-222">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-222">¶</a>
</div>
<p>If <code>options</code> is a string, assume it’s a method call.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> <span class="hljs-keyword">typeof</span> options <span class="hljs-keyword">is</span> <span class="hljs-string">'string'</span>
methodName = options</pre></div></div>
</li>
<li id="section-223">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-223">¶</a>
</div>
<p>Check if method exists and warn if it doesn’t.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">unless</span> <span class="hljs-keyword">typeof</span> (method = <span class="hljs-attribute">OriDomi</span>::[methodName]) <span class="hljs-keyword">is</span> <span class="hljs-string">'function'</span>
<span class="hljs-built_in">console</span>?.warn <span class="hljs-string">"<span class="hljs-subst">#{ libName }</span>: No such method `<span class="hljs-subst">#{ methodName }</span>`"</span>
<span class="hljs-keyword">return</span> @
<span class="hljs-keyword">for</span> el <span class="hljs-keyword">in</span> @
<span class="hljs-keyword">unless</span> instance = $.data el, baseName
instance = $.data el, baseName, <span class="hljs-keyword">new</span> OriDomi el, options</pre></div></div>
</li>
<li id="section-224">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-224">¶</a>
</div>
<p>Call the requested method with arguments.</p>
</div>
<div class="content"><div class='highlight'><pre> method.apply instance, <span class="hljs-attribute">Array</span>::slice.call(arguments)[<span class="hljs-number">1.</span>..]</pre></div></div>
</li>
<li id="section-225">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-225">¶</a>
</div>
<p>If not calling a method, initialize OriDomi on the selection.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">else</span>
<span class="hljs-keyword">for</span> el <span class="hljs-keyword">in</span> @</pre></div></div>
</li>
<li id="section-226">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-226">¶</a>
</div>
<p>If the element in the selection already has an instance of OriDomi
attached to it, return the instance.</p>
</div>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> instance = $.data el, baseName
<span class="hljs-keyword">continue</span>
<span class="hljs-keyword">else</span></pre></div></div>
</li>
<li id="section-227">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-227">¶</a>
</div>
<p>Create an instance of OriDomi and attach it to the element.</p>
</div>
<div class="content"><div class='highlight'><pre> $.data el, baseName, <span class="hljs-keyword">new</span> OriDomi el, options</pre></div></div>
</li>
<li id="section-228">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-228">¶</a>
</div>
<p>Return the selection.</p>
</div>
<div class="content"><div class='highlight'><pre> @</pre></div></div>
</li>
</ul>
</div>
</body>
</html>
| {
"content_hash": "f339cc1e7072cb109e73a85ad57550d9",
"timestamp": "",
"source": "github",
"line_count": 4115,
"max_line_length": 491,
"avg_line_length": 44.51859052247874,
"alnum_prop": 0.5250117361922334,
"repo_name": "Simplon-Roubaix/plugin-jquery-oridomi",
"id": "cd1f10dca4fa895249b6f98daf23c30ba737280d",
"size": "183258",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "plugin-oridomi/docs/oridomi.html",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "39693"
},
{
"name": "CSS",
"bytes": "36925"
},
{
"name": "CoffeeScript",
"bytes": "49514"
},
{
"name": "HTML",
"bytes": "204519"
},
{
"name": "JavaScript",
"bytes": "42652"
}
],
"symlink_target": ""
} |
/*******************************************************************************
ADC Driver Interface Declarations for Static Single Instance Driver
Company:
Microchip Technology Inc.
File Name:
drv_adc_static.h
Summary:
ADC driver interface declarations for the static single instance driver.
Description:
The ADC device driver provides a simple interface to manage the ADC
modules on Microchip microcontrollers. This file defines the interface
Declarations for the ADC driver.
Remarks:
Static interfaces incorporate the driver instance number within the names
of the routines, eliminating the need for an object ID or object handle.
Static single-open interfaces also eliminate the need for the open handle.
*******************************************************************************/
//DOM-IGNORE-BEGIN
/*******************************************************************************
Copyright (c) 2013 released Microchip Technology Inc. All rights reserved.
Microchip licenses to you the right to use, modify, copy and distribute
Software only when embedded on a Microchip microcontroller or digital signal
controller that is integrated into your product or third party product
(pursuant to the sublicense terms in the accompanying license agreement).
You should refer to the license agreement accompanying this Software for
additional information regarding your rights and obligations.
SOFTWARE AND DOCUMENTATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER
CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR
OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR
CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF
SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
*******************************************************************************/
//DOM-IGNORE-END
#ifndef _DRV_ADC_STATIC_H
#define _DRV_ADC_STATIC_H
#include <stdbool.h>
#include "system_config.h"
#include "peripheral/adc/plib_adc.h"
#include "peripheral/int/plib_int.h"
typedef enum {
DRV_ADC_ID_1 = ADC_ID_1,
DRV_ADC_NUMBER_OF_MODULES
} DRV_ADC_MODULE_ID;
typedef enum {
DRV_ADC_MUX_A = ADC_MUX_A,
DRV_ADC_MUX_B = ADC_MUX_B
} DRV_ADC_MUX;
typedef enum {
DRV_ADC_FILLING_BUF_0TO7 = ADC_FILLING_BUF_0TO7,
DRV_ADC_FILLING_BUF_8TOF = ADC_FILLING_BUF_8TOF
} DRV_ADC_RESULT_BUF_STATUS;
typedef enum {
DRV_ADC_REFERENCE_VDD_TO_AVSS = ADC_REFERENCE_VDD_TO_AVSS,
DRV_ADC_REFERENCE_VREFPLUS_TO_AVSS = ADC_REFERENCE_VREFPLUS_TO_AVSS,
DRV_ADC_REFERENCE_AVDD_TO_VREF_NEG = ADC_REFERENCE_AVDD_TO_VREF_NEG,
DRV_ADC_REFERENCE_VREFPLUS_TO_VREFNEG = ADC_REFERENCE_VREFPLUS_TO_VREFNEG
} DRV_ADC_VOLTAGE_REFERENCE;
typedef enum {
DRV_ADC_SAMPLING_MODE_ALTERNATE_INPUT = ADC_SAMPLING_MODE_ALTERNATE_INPUT,
DRV_ADC_SAMPLING_MODE_MUXA = ADC_SAMPLING_MODE_MUXA
} DRV_ADC_SAMPLING_MODE;
typedef enum {
DRV_ADC_1SAMPLE_PER_INTERRUPT = ADC_1SAMPLE_PER_INTERRUPT,
DRV_ADC_2SAMPLES_PER_INTERRUPT = ADC_2SAMPLES_PER_INTERRUPT,
DRV_ADC_3SAMPLES_PER_INTERRUPT = ADC_3SAMPLES_PER_INTERRUPT,
DRV_ADC_4SAMPLES_PER_INTERRUPT = ADC_4SAMPLES_PER_INTERRUPT,
DRV_ADC_5SAMPLES_PER_INTERRUPT = ADC_5SAMPLES_PER_INTERRUPT,
DRV_ADC_6SAMPLES_PER_INTERRUPT = ADC_6SAMPLES_PER_INTERRUPT,
DRV_ADC_7SAMPLES_PER_INTERRUPT = ADC_7SAMPLES_PER_INTERRUPT,
DRV_ADC_8SAMPLES_PER_INTERRUPT = ADC_8SAMPLES_PER_INTERRUPT,
DRV_ADC_9SAMPLES_PER_INTERRUPT = ADC_9SAMPLES_PER_INTERRUPT,
DRV_ADC_10SAMPLES_PER_INTERRUPT = ADC_10SAMPLES_PER_INTERRUPT,
DRV_ADC_11SAMPLES_PER_INTERRUPT = ADC_11SAMPLES_PER_INTERRUPT,
DRV_ADC_12SAMPLES_PER_INTERRUPT = ADC_12SAMPLES_PER_INTERRUPT,
DRV_ADC_13SAMPLES_PER_INTERRUPT = ADC_13SAMPLES_PER_INTERRUPT,
DRV_ADC_14SAMPLES_PER_INTERRUPT = ADC_14SAMPLES_PER_INTERRUPT,
DRV_ADC_15SAMPLES_PER_INTERRUPT = ADC_15SAMPLES_PER_INTERRUPT,
DRV_ADC_16SAMPLES_PER_INTERRUPT = ADC_16SAMPLES_PER_INTERRUPT
} DRV_ADC_SAMPLES_PER_INTERRUPT;
typedef enum {
DRV_ADC_INPUT_POSITIVE_AN0 = ADC_INPUT_POSITIVE_AN0,
DRV_ADC_POSITIVE_INPUT_NUM
} DRV_ADC_INPUTS_POSITIVE;
typedef enum {
DRV_ADC_SCAN_INPUT_NUM
} DRV_ADC_INPUTS_SCAN;
typedef enum {
DRV_ADC_INPUT_NEGATIVE_VREF_MINUS = ADC_INPUT_NEGATIVE_VREF_MINUS,
DRV_ADC_INPUT_NEGATIVE_AN1 = ADC_INPUT_NEGATIVE_AN1
} DRV_ADC_INPUTS_NEGATIVE;
typedef enum {
DRV_ADC_CLOCK_SOURCE_SYSTEM_CLOCK = ADC_CLOCK_SOURCE_SYSTEM_CLOCK,
DRV_ADC_CLOCK_SOURCE_INTERNAL_RC = ADC_CLOCK_SOURCE_INTERNAL_RC
} DRV_ADC_CLOCK_SOURCE;
typedef enum {
DRV_ADC_CONVERSION_TRIGGER_SAMP_CLEAR = ADC_CONVERSION_TRIGGER_SAMP_CLEAR,
DRV_ADC_CONVERSION_TRIGGER_INT0_TRANSITION = ADC_CONVERSION_TRIGGER_INT0_TRANSITION,
DRV_ADC_CONVERSION_TRIGGER_TMR3_COMPARE_MATCH = ADC_CONVERSION_TRIGGER_TMR3_COMPARE_MATCH,
DRV_ADC_CONVERSION_TRIGGER_CTMU_EVENT = ADC_CONVERSION_TRIGGER_CTMU_EVENT,
DRV_ADC_CONVERSION_TRIGGER_INTERNAL_COUNT = ADC_CONVERSION_TRIGGER_INTERNAL_COUNT
} DRV_ADC_CONVERSION_TRIGGER_SOURCE;
typedef enum {
DRV_ADC_RESULT_FORMAT_INTEGER_16BIT = ADC_RESULT_FORMAT_INTEGER_16BIT,
DRV_ADC_RESULT_FORMAT_SIGNED_INTEGER_16BIT = ADC_RESULT_FORMAT_SIGNED_INTEGER_16BIT,
DRV_ADC_RESULT_FORMAT_FRACTIONAL_16BIT = ADC_RESULT_FORMAT_FRACTIONAL_16BIT,
DRV_ADC_RESULT_FORMAT_SIGNED_FRACTIONAL_16BIT = ADC_RESULT_FORMAT_SIGNED_FRACTIONAL_16BIT,
DRV_ADC_RESULT_FORMAT_INTEGER_32BIT = ADC_RESULT_FORMAT_INTEGER_32BIT,
DRV_ADC_RESULT_FORMAT_SIGNED_INTEGER_32BIT = ADC_RESULT_FORMAT_SIGNED_INTEGER_32BIT,
DRV_ADC_RESULT_FORMAT_FRACTIONAL_32BIT = ADC_RESULT_FORMAT_FRACTIONAL_32BIT,
DRV_ADC_RESULT_FORMAT_SIGNED_FRACTIONAL_32BIT = ADC_RESULT_FORMAT_SIGNED_FRACTIONAL_32BIT
} DRV_ADC_RESULT_FORMAT;
// *****************************************************************************
// *****************************************************************************
// Section: Interface Headers for ADC Static Driver
// *****************************************************************************
// *****************************************************************************
void DRV_ADC_Initialize(void);
inline void DRV_ADC_DeInitialize(void);
inline void DRV_ADC_Open(void);
inline void DRV_ADC_Close(void);
inline void DRV_ADC_Start(void);
inline void DRV_ADC_Stop(void);
inline void DRV_ADC_NegativeInputSelect(DRV_ADC_MUX mux, DRV_ADC_INPUTS_NEGATIVE input);
inline void DRV_ADC_PositiveInputSelect(DRV_ADC_MUX mux, DRV_ADC_INPUTS_POSITIVE input);
inline void DRV_ADC_ChannelScanInputsAdd(DRV_ADC_INPUTS_SCAN scanInput);
inline void DRV_ADC_ChannelScanInputsRemove(DRV_ADC_INPUTS_SCAN scanInput);
ADC_SAMPLE DRV_ADC_SamplesRead(uint8_t bufIndex);
bool DRV_ADC_SamplesAvailable(void);
#endif // #ifndef _DRV_ADC_STATIC_H
/*******************************************************************************
End of File
*/
| {
"content_hash": "7ed2d746c325fa839ba868b15bfd1d83",
"timestamp": "",
"source": "github",
"line_count": 198,
"max_line_length": 94,
"avg_line_length": 38.06060606060606,
"alnum_prop": 0.6693205944798302,
"repo_name": "ECE4534-Team21/gary",
"id": "bd15d89ebb3c6cce1f155bd18e2a80fa49aed5d0",
"size": "7536",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "firmware/src/system_config/default/framework/driver/adc/drv_adc_static.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "3878"
},
{
"name": "C",
"bytes": "154926"
},
{
"name": "C++",
"bytes": "7536"
},
{
"name": "Makefile",
"bytes": "459990"
},
{
"name": "Shell",
"bytes": "1351"
}
],
"symlink_target": ""
} |
<?php
use yii\db\Migration;
class m160919_203141_add_lvl_question extends Migration
{
public function up()
{
// $this->alterColumn('{{%question}}', 'id', $this->primaryKey());
$this->addColumn('{{%question}}', 'lvl', $this->integer());
$this->addColumn('{{%question}}', 'root', $this->integer());
}
public function down()
{
$this->dropColumn('{{%question}}', 'lvl');
$this->dropColumn('{{%question}}', 'root');
}
}
| {
"content_hash": "e593477b739dfec77ad78f33a5be9ad9",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 73,
"avg_line_length": 25.31578947368421,
"alnum_prop": 0.5467775467775468,
"repo_name": "dub34/doc_bot",
"id": "b754e2e381495c14ae7816b6da9d9a39a4f044b2",
"size": "481",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "migrations/m160919_203141_add_lvl_question.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ApacheConf",
"bytes": "124"
},
{
"name": "Batchfile",
"bytes": "1030"
},
{
"name": "CSS",
"bytes": "1364"
},
{
"name": "PHP",
"bytes": "87456"
}
],
"symlink_target": ""
} |
package uk.co.real_logic.agrona.concurrent;
import sun.misc.Unsafe;
import uk.co.real_logic.agrona.DirectBuffer;
import uk.co.real_logic.agrona.MutableDirectBuffer;
import uk.co.real_logic.agrona.UnsafeAccess;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.charset.StandardCharsets;
import static uk.co.real_logic.agrona.BitUtil.*;
/**
* Supports regular, byte ordered, and atomic (memory ordered) access to an underlying buffer.
* The buffer can be a byte[] or one of the various {@link ByteBuffer} implementations.
*/
public class UnsafeBuffer implements AtomicBuffer
{
/**
* Buffer alignment to ensure atomic word accesses.
*/
public static final int ALIGNMENT = SIZE_OF_LONG;
public static final String DISABLE_BOUNDS_CHECKS_PROP_NAME = "agrona.disable.bounds.checks";
public static final boolean SHOULD_BOUNDS_CHECK = !Boolean.getBoolean(DISABLE_BOUNDS_CHECKS_PROP_NAME);
private static final byte[] NULL_BYTES = "null".getBytes(StandardCharsets.UTF_8);
private static final ByteOrder NATIVE_BYTE_ORDER = ByteOrder.nativeOrder();
private static final Unsafe UNSAFE = UnsafeAccess.UNSAFE;
private static final long ARRAY_BASE_OFFSET = UNSAFE.arrayBaseOffset(byte[].class);
private byte[] byteArray;
private ByteBuffer byteBuffer;
private long addressOffset;
private int capacity;
/**
* Attach a view to a byte[] for providing direct access.
*
* @param buffer to which the view is attached.
*/
public UnsafeBuffer(final byte[] buffer)
{
wrap(buffer);
}
/**
* Attach a view to a byte[] for providing direct access.
*
* @param buffer to which the view is attached.
* @param offset within the buffer to begin.
* @param length of the buffer to be included.
*/
public UnsafeBuffer(final byte[] buffer, final int offset, final int length)
{
wrap(buffer, offset, length);
}
/**
* Attach a view to a {@link ByteBuffer} for providing direct access, the {@link ByteBuffer} can be
* heap based or direct.
*
* @param buffer to which the view is attached.
*/
public UnsafeBuffer(final ByteBuffer buffer)
{
wrap(buffer);
}
/**
* Attach a view to a {@link ByteBuffer} for providing direct access, the {@link ByteBuffer} can be
* heap based or direct.
*
* @param buffer to which the view is attached.
* @param offset within the buffer to begin.
* @param length of the buffer to be included.
*/
public UnsafeBuffer(final ByteBuffer buffer, final int offset, final int length)
{
wrap(buffer, offset, length);
}
/**
* Attach a view to an existing {@link DirectBuffer}
*
* @param buffer to which the view is attached.
*/
public UnsafeBuffer(final DirectBuffer buffer)
{
wrap(buffer);
}
/**
* Attach a view to an existing {@link DirectBuffer}
*
* @param buffer to which the view is attached.
* @param offset within the buffer to begin.
* @param length of the buffer to be included.
*/
public UnsafeBuffer(final DirectBuffer buffer, final int offset, final int length)
{
wrap(buffer, offset, length);
}
/**
* Attach a view to an off-heap memory region by address.
*
* @param address where the memory begins off-heap
* @param length of the buffer from the given address
*/
public UnsafeBuffer(final long address, final int length)
{
wrap(address, length);
}
public void wrap(final byte[] buffer)
{
addressOffset = ARRAY_BASE_OFFSET;
capacity = buffer.length;
byteArray = buffer;
byteBuffer = null;
}
public void wrap(final byte[] buffer, final int offset, final int length)
{
if (SHOULD_BOUNDS_CHECK)
{
final int bufferLength = buffer.length;
if (offset != 0 && (offset < 0 || offset > bufferLength - 1))
{
throw new IllegalArgumentException("offset=" + offset + " not valid for buffer.length=" + bufferLength);
}
if (length < 0 || length > bufferLength - offset)
{
throw new IllegalArgumentException(
"offset=" + offset + " length=" + length + " not valid for buffer.length=" + bufferLength);
}
}
addressOffset = ARRAY_BASE_OFFSET + offset;
capacity = length;
byteArray = buffer;
byteBuffer = null;
}
public void wrap(final ByteBuffer buffer)
{
byteBuffer = buffer;
if (buffer.hasArray())
{
byteArray = buffer.array();
addressOffset = ARRAY_BASE_OFFSET + buffer.arrayOffset();
}
else
{
byteArray = null;
addressOffset = ((sun.nio.ch.DirectBuffer)buffer).address();
}
capacity = buffer.capacity();
}
public void wrap(final ByteBuffer buffer, final int offset, final int length)
{
if (SHOULD_BOUNDS_CHECK)
{
final int bufferCapacity = buffer.capacity();
if (offset != 0 && (offset < 0 || offset > bufferCapacity - 1))
{
throw new IllegalArgumentException("offset=" + offset + " not valid for buffer.capacity()=" + bufferCapacity);
}
if (length < 0 || length > bufferCapacity - offset)
{
throw new IllegalArgumentException(
"offset=" + offset + " length=" + length + " not valid for buffer.capacity()=" + bufferCapacity);
}
}
byteBuffer = buffer;
if (buffer.hasArray())
{
byteArray = buffer.array();
addressOffset = ARRAY_BASE_OFFSET + buffer.arrayOffset() + offset;
}
else
{
byteArray = null;
addressOffset = ((sun.nio.ch.DirectBuffer)buffer).address() + offset;
}
capacity = length;
}
public void wrap(final DirectBuffer buffer)
{
addressOffset = buffer.addressOffset();
capacity = buffer.capacity();
byteArray = buffer.byteArray();
byteBuffer = buffer.byteBuffer();
}
public void wrap(final DirectBuffer buffer, final int offset, final int length)
{
if (SHOULD_BOUNDS_CHECK)
{
final int bufferCapacity = buffer.capacity();
if (offset != 0 && (offset < 0 || offset > bufferCapacity - 1))
{
throw new IllegalArgumentException("offset=" + offset + " not valid for buffer.capacity()=" + bufferCapacity);
}
if (length < 0 || length > bufferCapacity - offset)
{
throw new IllegalArgumentException(
"offset=" + offset + " length=" + length + " not valid for buffer.capacity()=" + bufferCapacity);
}
}
addressOffset = buffer.addressOffset() + offset;
capacity = length;
byteArray = buffer.byteArray();
byteBuffer = buffer.byteBuffer();
}
public void wrap(final long address, final int length)
{
addressOffset = address;
capacity = length;
byteArray = null;
byteBuffer = null;
}
public long addressOffset()
{
return addressOffset;
}
public byte[] byteArray()
{
return byteArray;
}
public ByteBuffer byteBuffer()
{
return byteBuffer;
}
public void setMemory(final int index, final int length, final byte value)
{
boundsCheck(index, length);
UNSAFE.setMemory(byteArray, addressOffset + index, length, value);
}
public int capacity()
{
return capacity;
}
public void checkLimit(final int limit)
{
if (limit > capacity)
{
final String msg = String.format("limit=%d is beyond capacity=%d", limit, capacity);
throw new IndexOutOfBoundsException(msg);
}
}
public void verifyAlignment()
{
if (0 != (addressOffset & (ALIGNMENT - 1)))
{
throw new IllegalStateException(String.format(
"AtomicBuffer is not correctly aligned: addressOffset=%d in not divisible by %d",
addressOffset,
ALIGNMENT));
}
}
///////////////////////////////////////////////////////////////////////////
public long getLong(final int index, final ByteOrder byteOrder)
{
boundsCheck(index, SIZE_OF_LONG);
long bits = UNSAFE.getLong(byteArray, addressOffset + index);
if (NATIVE_BYTE_ORDER != byteOrder)
{
bits = Long.reverseBytes(bits);
}
return bits;
}
public void putLong(final int index, final long value, final ByteOrder byteOrder)
{
boundsCheck(index, SIZE_OF_LONG);
long bits = value;
if (NATIVE_BYTE_ORDER != byteOrder)
{
bits = Long.reverseBytes(bits);
}
UNSAFE.putLong(byteArray, addressOffset + index, bits);
}
public long getLong(final int index)
{
boundsCheck(index, SIZE_OF_LONG);
return UNSAFE.getLong(byteArray, addressOffset + index);
}
public void putLong(final int index, final long value)
{
boundsCheck(index, SIZE_OF_LONG);
UNSAFE.putLong(byteArray, addressOffset + index, value);
}
public long getLongVolatile(final int index)
{
boundsCheck(index, SIZE_OF_LONG);
return UNSAFE.getLongVolatile(byteArray, addressOffset + index);
}
public void putLongVolatile(final int index, final long value)
{
boundsCheck(index, SIZE_OF_LONG);
UNSAFE.putLongVolatile(byteArray, addressOffset + index, value);
}
public void putLongOrdered(final int index, final long value)
{
boundsCheck(index, SIZE_OF_LONG);
UNSAFE.putOrderedLong(byteArray, addressOffset + index, value);
}
public long addLongOrdered(final int index, final long increment)
{
boundsCheck(index, SIZE_OF_LONG);
final long offset = addressOffset + index;
final byte[] byteArray = this.byteArray;
final long value = UNSAFE.getLong(byteArray, offset);
UNSAFE.putOrderedLong(byteArray, offset, value + increment);
return value;
}
public boolean compareAndSetLong(final int index, final long expectedValue, final long updateValue)
{
boundsCheck(index, SIZE_OF_LONG);
return UNSAFE.compareAndSwapLong(byteArray, addressOffset + index, expectedValue, updateValue);
}
public long getAndSetLong(final int index, final long value)
{
boundsCheck(index, SIZE_OF_LONG);
return UNSAFE.getAndSetLong(byteArray, addressOffset + index, value);
}
public long getAndAddLong(final int index, final long delta)
{
boundsCheck(index, SIZE_OF_LONG);
return UNSAFE.getAndAddLong(byteArray, addressOffset + index, delta);
}
///////////////////////////////////////////////////////////////////////////
public int getInt(final int index, final ByteOrder byteOrder)
{
boundsCheck(index, SIZE_OF_INT);
int bits = UNSAFE.getInt(byteArray, addressOffset + index);
if (NATIVE_BYTE_ORDER != byteOrder)
{
bits = Integer.reverseBytes(bits);
}
return bits;
}
public void putInt(final int index, final int value, final ByteOrder byteOrder)
{
boundsCheck(index, SIZE_OF_INT);
int bits = value;
if (NATIVE_BYTE_ORDER != byteOrder)
{
bits = Integer.reverseBytes(bits);
}
UNSAFE.putInt(byteArray, addressOffset + index, bits);
}
public int getInt(final int index)
{
boundsCheck(index, SIZE_OF_INT);
return UNSAFE.getInt(byteArray, addressOffset + index);
}
public void putInt(final int index, final int value)
{
boundsCheck(index, SIZE_OF_INT);
UNSAFE.putInt(byteArray, addressOffset + index, value);
}
public int getIntVolatile(final int index)
{
boundsCheck(index, SIZE_OF_INT);
return UNSAFE.getIntVolatile(byteArray, addressOffset + index);
}
public void putIntVolatile(final int index, final int value)
{
boundsCheck(index, SIZE_OF_INT);
UNSAFE.putIntVolatile(byteArray, addressOffset + index, value);
}
public void putIntOrdered(final int index, final int value)
{
boundsCheck(index, SIZE_OF_INT);
UNSAFE.putOrderedInt(byteArray, addressOffset + index, value);
}
public int addIntOrdered(final int index, final int increment)
{
boundsCheck(index, SIZE_OF_INT);
final long offset = addressOffset + index;
final byte[] byteArray = this.byteArray;
final int value = UNSAFE.getInt(byteArray, offset);
UNSAFE.putOrderedInt(byteArray, offset, value + increment);
return value;
}
public boolean compareAndSetInt(final int index, final int expectedValue, final int updateValue)
{
boundsCheck(index, SIZE_OF_INT);
return UNSAFE.compareAndSwapInt(byteArray, addressOffset + index, expectedValue, updateValue);
}
public int getAndSetInt(final int index, final int value)
{
boundsCheck(index, SIZE_OF_INT);
return UNSAFE.getAndSetInt(byteArray, addressOffset + index, value);
}
public int getAndAddInt(final int index, final int delta)
{
boundsCheck(index, SIZE_OF_INT);
return UNSAFE.getAndAddInt(byteArray, addressOffset + index, delta);
}
///////////////////////////////////////////////////////////////////////////
public double getDouble(final int index, final ByteOrder byteOrder)
{
boundsCheck(index, SIZE_OF_DOUBLE);
if (NATIVE_BYTE_ORDER != byteOrder)
{
final long bits = UNSAFE.getLong(byteArray, addressOffset + index);
return Double.longBitsToDouble(Long.reverseBytes(bits));
}
else
{
return UNSAFE.getDouble(byteArray, addressOffset + index);
}
}
public void putDouble(final int index, final double value, final ByteOrder byteOrder)
{
boundsCheck(index, SIZE_OF_DOUBLE);
if (NATIVE_BYTE_ORDER != byteOrder)
{
final long bits = Long.reverseBytes(Double.doubleToRawLongBits(value));
UNSAFE.putLong(byteArray, addressOffset + index, bits);
}
else
{
UNSAFE.putDouble(byteArray, addressOffset + index, value);
}
}
public double getDouble(final int index)
{
boundsCheck(index, SIZE_OF_DOUBLE);
return UNSAFE.getDouble(byteArray, addressOffset + index);
}
public void putDouble(final int index, final double value)
{
boundsCheck(index, SIZE_OF_DOUBLE);
UNSAFE.putDouble(byteArray, addressOffset + index, value);
}
///////////////////////////////////////////////////////////////////////////
public float getFloat(final int index, final ByteOrder byteOrder)
{
boundsCheck(index, SIZE_OF_FLOAT);
if (NATIVE_BYTE_ORDER != byteOrder)
{
final int bits = UNSAFE.getInt(byteArray, addressOffset + index);
return Float.intBitsToFloat(Integer.reverseBytes(bits));
}
else
{
return UNSAFE.getFloat(byteArray, addressOffset + index);
}
}
public void putFloat(final int index, final float value, final ByteOrder byteOrder)
{
boundsCheck(index, SIZE_OF_FLOAT);
if (NATIVE_BYTE_ORDER != byteOrder)
{
final int bits = Integer.reverseBytes(Float.floatToRawIntBits(value));
UNSAFE.putInt(byteArray, addressOffset + index, bits);
}
else
{
UNSAFE.putFloat(byteArray, addressOffset + index, value);
}
}
public float getFloat(final int index)
{
boundsCheck(index, SIZE_OF_FLOAT);
return UNSAFE.getFloat(byteArray, addressOffset + index);
}
public void putFloat(final int index, final float value)
{
boundsCheck(index, SIZE_OF_FLOAT);
UNSAFE.putFloat(byteArray, addressOffset + index, value);
}
///////////////////////////////////////////////////////////////////////////
public short getShort(final int index, final ByteOrder byteOrder)
{
boundsCheck(index, SIZE_OF_SHORT);
short bits = UNSAFE.getShort(byteArray, addressOffset + index);
if (NATIVE_BYTE_ORDER != byteOrder)
{
bits = Short.reverseBytes(bits);
}
return bits;
}
public void putShort(final int index, final short value, final ByteOrder byteOrder)
{
boundsCheck(index, SIZE_OF_SHORT);
short bits = value;
if (NATIVE_BYTE_ORDER != byteOrder)
{
bits = Short.reverseBytes(bits);
}
UNSAFE.putShort(byteArray, addressOffset + index, bits);
}
public short getShort(final int index)
{
boundsCheck(index, SIZE_OF_SHORT);
return UNSAFE.getShort(byteArray, addressOffset + index);
}
public void putShort(final int index, final short value)
{
boundsCheck(index, SIZE_OF_SHORT);
UNSAFE.putShort(byteArray, addressOffset + index, value);
}
public short getShortVolatile(final int index)
{
boundsCheck(index, SIZE_OF_SHORT);
return UNSAFE.getShortVolatile(byteArray, addressOffset + index);
}
public void putShortVolatile(final int index, final short value)
{
boundsCheck(index, SIZE_OF_SHORT);
UNSAFE.putShortVolatile(byteArray, addressOffset + index, value);
}
public byte getByteVolatile(final int index)
{
boundsCheck(index, SIZE_OF_BYTE);
return UNSAFE.getByteVolatile(byteArray, addressOffset + index);
}
public void putByteVolatile(final int index, final byte value)
{
boundsCheck(index, SIZE_OF_BYTE);
UNSAFE.putByteVolatile(byteArray, addressOffset + index, value);
}
///////////////////////////////////////////////////////////////////////////
public byte getByte(final int index)
{
boundsCheck(index, SIZE_OF_BYTE);
return UNSAFE.getByte(byteArray, addressOffset + index);
}
public void putByte(final int index, final byte value)
{
boundsCheck(index, SIZE_OF_BYTE);
UNSAFE.putByte(byteArray, addressOffset + index, value);
}
public void getBytes(final int index, final byte[] dst)
{
getBytes(index, dst, 0, dst.length);
}
public void getBytes(final int index, final byte[] dst, final int offset, final int length)
{
boundsCheck(index, length);
boundsCheck(dst, offset, length);
UNSAFE.copyMemory(byteArray, addressOffset + index, dst, ARRAY_BASE_OFFSET + offset, length);
}
public void getBytes(final int index, final MutableDirectBuffer dstBuffer, final int dstIndex, final int length)
{
dstBuffer.putBytes(dstIndex, this, index, length);
}
public void getBytes(final int index, final ByteBuffer dstBuffer, final int length)
{
boundsCheck(index, length);
final int dstOffset = dstBuffer.position();
boundsCheck(dstBuffer, dstOffset, length);
final byte[] dstByteArray;
final long dstBaseOffset;
if (dstBuffer.hasArray())
{
dstByteArray = dstBuffer.array();
dstBaseOffset = ARRAY_BASE_OFFSET + dstBuffer.arrayOffset();
}
else
{
dstByteArray = null;
dstBaseOffset = ((sun.nio.ch.DirectBuffer)dstBuffer).address();
}
UNSAFE.copyMemory(byteArray, addressOffset + index, dstByteArray, dstBaseOffset + dstOffset, length);
dstBuffer.position(dstBuffer.position() + length);
}
public void putBytes(final int index, final byte[] src)
{
putBytes(index, src, 0, src.length);
}
public void putBytes(final int index, final byte[] src, final int offset, final int length)
{
boundsCheck(index, length);
boundsCheck(src, offset, length);
UNSAFE.copyMemory(src, ARRAY_BASE_OFFSET + offset, byteArray, addressOffset + index, length);
}
public void putBytes(final int index, final ByteBuffer srcBuffer, final int length)
{
boundsCheck(index, length);
final int srcIndex = srcBuffer.position();
boundsCheck(srcBuffer, srcIndex, length);
putBytes(index, srcBuffer, srcIndex, length);
srcBuffer.position(srcIndex + length);
}
public void putBytes(final int index, final ByteBuffer srcBuffer, final int srcIndex, final int length)
{
boundsCheck(index, length);
boundsCheck(srcBuffer, srcIndex, length);
final byte[] srcByteArray;
final long srcBaseOffset;
if (srcBuffer.hasArray())
{
srcByteArray = srcBuffer.array();
srcBaseOffset = ARRAY_BASE_OFFSET + srcBuffer.arrayOffset();
}
else
{
srcByteArray = null;
srcBaseOffset = ((sun.nio.ch.DirectBuffer)srcBuffer).address();
}
UNSAFE.copyMemory(srcByteArray, srcBaseOffset + srcIndex, byteArray, addressOffset + index, length);
}
public void putBytes(final int index, final DirectBuffer srcBuffer, final int srcIndex, final int length)
{
boundsCheck(index, length);
srcBuffer.boundsCheck(srcIndex, length);
UNSAFE.copyMemory(
srcBuffer.byteArray(),
srcBuffer.addressOffset() + srcIndex,
byteArray,
addressOffset + index,
length);
}
///////////////////////////////////////////////////////////////////////////
public String getStringUtf8(final int offset, final ByteOrder byteOrder)
{
final int length = getInt(offset, byteOrder);
return getStringUtf8(offset, length);
}
public String getStringUtf8(final int offset, final int length)
{
final byte[] stringInBytes = new byte[length];
getBytes(offset + SIZE_OF_INT, stringInBytes);
return new String(stringInBytes, StandardCharsets.UTF_8);
}
public int putStringUtf8(final int offset, final String value, final ByteOrder byteOrder)
{
return putStringUtf8(offset, value, byteOrder, Integer.MAX_VALUE);
}
public int putStringUtf8(final int offset, final String value, final ByteOrder byteOrder, final int maxEncodedSize)
{
final byte[] bytes = value != null ? value.getBytes(StandardCharsets.UTF_8) : NULL_BYTES;
if (bytes.length > maxEncodedSize)
{
throw new IllegalArgumentException("Encoded string larger than maximum size: " + maxEncodedSize);
}
putInt(offset, bytes.length, byteOrder);
putBytes(offset + SIZE_OF_INT, bytes);
return SIZE_OF_INT + bytes.length;
}
public String getStringWithoutLengthUtf8(final int offset, final int length)
{
final byte[] stringInBytes = new byte[length];
getBytes(offset, stringInBytes);
return new String(stringInBytes, StandardCharsets.UTF_8);
}
public int putStringWithoutLengthUtf8(final int offset, final String value)
{
final byte[] bytes = value != null ? value.getBytes(StandardCharsets.UTF_8) : NULL_BYTES;
putBytes(offset, bytes);
return bytes.length;
}
///////////////////////////////////////////////////////////////////////////
public void boundsCheck(final int index, final int length)
{
if (SHOULD_BOUNDS_CHECK)
{
if (index < 0 || length < 0 || (index + length) > capacity)
{
throw new IndexOutOfBoundsException(String.format("index=%d, length=%d, capacity=%d", index, length, capacity));
}
}
}
private static void boundsCheck(final byte[] buffer, final int index, final int length)
{
if (SHOULD_BOUNDS_CHECK)
{
final int capacity = buffer.length;
if (index < 0 || length < 0 || (index + length) > capacity)
{
throw new IndexOutOfBoundsException(String.format("index=%d, length=%d, capacity=%d", index, length, capacity));
}
}
}
private static void boundsCheck(final ByteBuffer buffer, final int index, final int length)
{
if (SHOULD_BOUNDS_CHECK)
{
final int capacity = buffer.capacity();
if (index < 0 || length < 0 || (index + length) > capacity)
{
throw new IndexOutOfBoundsException(String.format("index=%d, length=%d, capacity=%d", index, length, capacity));
}
}
}
}
| {
"content_hash": "9136a3021d9f0e136ba598735856911f",
"timestamp": "",
"source": "github",
"line_count": 843,
"max_line_length": 128,
"avg_line_length": 29.785290628707,
"alnum_prop": 0.599745111314668,
"repo_name": "ligzy/Agrona",
"id": "2959b33602624b794e88372d7572cfb3a2cd8f33",
"size": "25703",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/uk/co/real_logic/agrona/concurrent/UnsafeBuffer.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "449690"
}
],
"symlink_target": ""
} |
module Oden.Type.Monomorphic where
import Oden.Identifier
import Oden.Metadata
import Oden.QualifiedName
import Oden.SourceInfo
data Type
= TTuple (Metadata SourceInfo) Type Type [Type]
| TCon (Metadata SourceInfo) QualifiedName
| TApp (Metadata SourceInfo) Type Type
| TNoArgFn (Metadata SourceInfo) Type
| TFn (Metadata SourceInfo) Type Type
| TSlice (Metadata SourceInfo) Type
| TRecord (Metadata SourceInfo) Type
| TNamed (Metadata SourceInfo) QualifiedName Type
| REmpty (Metadata SourceInfo)
| RExtension (Metadata SourceInfo) Identifier Type Type
| TForeignFn (Metadata SourceInfo) Bool [Type] [Type]
deriving (Show, Eq, Ord)
instance HasSourceInfo Type where
getSourceInfo (TTuple (Metadata si) _ _ _) = si
getSourceInfo (TFn (Metadata si) _ _) = si
getSourceInfo (TNoArgFn (Metadata si) _) = si
getSourceInfo (TCon (Metadata si) _) = si
getSourceInfo (TApp (Metadata si) _ _) = si
getSourceInfo (TForeignFn (Metadata si) _ _ _) = si
getSourceInfo (TSlice (Metadata si) _) = si
getSourceInfo (TRecord (Metadata si) _) = si
getSourceInfo (TNamed (Metadata si) _ _) = si
getSourceInfo (REmpty (Metadata si)) = si
getSourceInfo (RExtension (Metadata si) _ _ _) = si
setSourceInfo si (TTuple _ f s r) = TTuple (Metadata si) f s r
setSourceInfo si (TFn _ a r) = TFn (Metadata si) a r
setSourceInfo si (TNoArgFn _ r) = TNoArgFn (Metadata si) r
setSourceInfo si (TCon _ n) = TCon (Metadata si) n
setSourceInfo si (TApp _ cons param) = TApp (Metadata si) cons param
setSourceInfo si (TForeignFn _ v p r) = TForeignFn (Metadata si) v p r
setSourceInfo si (TSlice _ t) = TSlice (Metadata si) t
setSourceInfo si (TRecord _ fs) = TRecord (Metadata si) fs
setSourceInfo si (TNamed _ n t) = TNamed (Metadata si) n t
setSourceInfo si REmpty{} = REmpty (Metadata si)
setSourceInfo si (RExtension _ l t r) = RExtension (Metadata si) l t r
rowToList :: Type -> [(Identifier, Type)]
rowToList (RExtension _ label type' row) = (label, type') : rowToList row
rowToList _ = []
rowFromList :: [(Identifier, Type)] -> Type
rowFromList ((label, type') : fields) = RExtension (Metadata Missing) label type' (rowFromList fields)
rowFromList _ = REmpty (Metadata Missing)
getLeafRow :: Type -> Type
getLeafRow (RExtension _ _ _ row) = getLeafRow row
getLeafRow e = e
| {
"content_hash": "f4c3b16aec673237d7c0acc041716789",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 102,
"avg_line_length": 44.10526315789474,
"alnum_prop": 0.6523468575974543,
"repo_name": "oden-lang/oden",
"id": "758db697248917901387f40263ce03677661d79c",
"size": "2579",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Oden/Type/Monomorphic.hs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Go",
"bytes": "8174"
},
{
"name": "Haskell",
"bytes": "422894"
},
{
"name": "Makefile",
"bytes": "2936"
},
{
"name": "Shell",
"bytes": "3575"
}
],
"symlink_target": ""
} |
"""
Fakes For Scheduler tests.
"""
import mox
from cinder import db
from cinder.openstack.common import timeutils
from cinder.scheduler import filter_scheduler
from cinder.scheduler import host_manager
class FakeFilterScheduler(filter_scheduler.FilterScheduler):
def __init__(self, *args, **kwargs):
super(FakeFilterScheduler, self).__init__(*args, **kwargs)
self.host_manager = host_manager.HostManager()
class FakeHostManager(host_manager.HostManager):
def __init__(self):
super(FakeHostManager, self).__init__()
self.service_states = {
'host1': {'total_capacity_gb': 1024,
'free_capacity_gb': 1024,
'reserved_percentage': 10,
'timestamp': None},
'host2': {'total_capacity_gb': 2048,
'free_capacity_gb': 300,
'reserved_percentage': 10,
'timestamp': None},
'host3': {'total_capacity_gb': 512,
'free_capacity_gb': 512,
'reserved_percentage': 0,
'timestamp': None},
'host4': {'total_capacity_gb': 2048,
'free_capacity_gb': 200,
'reserved_percentage': 5,
'timestamp': None},
}
class FakeHostState(host_manager.HostState):
def __init__(self, host, attribute_dict):
super(FakeHostState, self).__init__(host)
for (key, val) in attribute_dict.iteritems():
setattr(self, key, val)
def mox_host_manager_db_calls(mock, context):
mock.StubOutWithMock(db, 'service_get_all_by_topic')
services = [
dict(id=1, host='host1', topic='volume', disabled=False,
availability_zone='zone1', updated_at=timeutils.utcnow()),
dict(id=2, host='host2', topic='volume', disabled=False,
availability_zone='zone1', updated_at=timeutils.utcnow()),
dict(id=3, host='host3', topic='volume', disabled=False,
availability_zone='zone2', updated_at=timeutils.utcnow()),
dict(id=4, host='host4', topic='volume', disabled=False,
availability_zone='zone3', updated_at=timeutils.utcnow()),
# service on host5 is disabled
dict(id=5, host='host5', topic='volume', disabled=True,
availability_zone='zone4', updated_at=timeutils.utcnow()),
]
db.service_get_all_by_topic(mox.IgnoreArg(),
mox.IgnoreArg()).AndReturn(services)
| {
"content_hash": "a6adb43786fef87684cedab9b88d8845",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 71,
"avg_line_length": 37.44117647058823,
"alnum_prop": 0.5703063629222309,
"repo_name": "cloudbau/cinder",
"id": "dd420f0c7010f248686fbe708401582432d8eee1",
"size": "3181",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "cinder/tests/scheduler/fakes.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Python",
"bytes": "5235714"
},
{
"name": "Shell",
"bytes": "8994"
}
],
"symlink_target": ""
} |
(function (root, factory) {
if (typeof define === "function" && define.amd) {
define(["d3"], factory);
} else if (typeof exports === "object") {
module.exports = factory(require("d3"));
} else {
root.RadarChart = factory(root.d3);
}
}(this, function (d3) {
var RadarChart = {
defaultConfig: {
containerClass: 'radar-chart',
w: 600,
h: 600,
factor: 0.95,
factorLegend: 1,
levels: 3,
levelTick: false,
TickLength: 10,
maxValue: 0,
minValue: 0,
radians: 2 * Math.PI,
color: d3.scale.category10(),
axisLine: true,
axisText: true,
circles: true,
radius: 5,
backgroundTooltipColor: "#555",
backgroundTooltipOpacity: "0.7",
tooltipColor: "white",
axisJoin: function(d, i) {
return d.className || i;
},
tooltipFormatValue: function(d) {
return d;
},
tooltipFormatClass: function(d) {
return d;
},
transitionDuration: 300
},
chart: function() {
// default config
var cfg = Object.create(RadarChart.defaultConfig);
function setTooltip(tooltip, msg){
if(msg == false || msg == undefined){
tooltip.classed("visible", 0);
tooltip.select("rect").classed("visible", 0);
}else{
tooltip.classed("visible", 1);
var container = tooltip.node().parentNode;
var coords = d3.mouse(container);
tooltip.select("text").classed('visible', 1).style("fill", cfg.tooltipColor);
var padding=5;
var bbox = tooltip.select("text").text(msg).node().getBBox();
tooltip.select("rect")
.classed('visible', 1).attr("x", 0)
.attr("x", bbox.x - padding)
.attr("y", bbox.y - padding)
.attr("width", bbox.width + (padding*2))
.attr("height", bbox.height + (padding*2))
.attr("rx","5").attr("ry","5")
.style("fill", cfg.backgroundTooltipColor).style("opacity", cfg.backgroundTooltipOpacity);
tooltip.attr("transform", "translate(" + (coords[0]+10) + "," + (coords[1]-10) + ")")
}
}
function radar(selection) {
selection.each(function(data) {
var container = d3.select(this);
var tooltip = container.selectAll('g.tooltip').data([data[0]]);
var tt = tooltip.enter()
.append('g')
.classed('tooltip', true)
tt.append('rect').classed("tooltip", true);
tt.append('text').classed("tooltip", true);
// allow simple notation
data = data.map(function(datum) {
if(datum instanceof Array) {
datum = {axes: datum};
}
return datum;
});
var maxValue = Math.max(cfg.maxValue, d3.max(data, function(d) {
return d3.max(d.axes, function(o){ return o.value; });
}));
maxValue -= cfg.minValue;
var allAxis = data[0].axes.map(function(i, j){ return {name: i.axis, xOffset: (i.xOffset)?i.xOffset:0, yOffset: (i.yOffset)?i.yOffset:0}; });
var total = allAxis.length;
var radius = cfg.factor * Math.min(cfg.w / 2, cfg.h / 2);
var radius2 = Math.min(cfg.w / 2, cfg.h / 2);
container.classed(cfg.containerClass, 1);
function getPosition(i, range, factor, func){
factor = typeof factor !== 'undefined' ? factor : 1;
return range * (1 - factor * func(i * cfg.radians / total));
}
function getHorizontalPosition(i, range, factor){
return getPosition(i, range, factor, Math.sin);
}
function getVerticalPosition(i, range, factor){
return getPosition(i, range, factor, Math.cos);
}
// levels && axises
var levelFactors = d3.range(0, cfg.levels).map(function(level) {
return radius * ((level + 1) / cfg.levels);
});
var levelGroups = container.selectAll('g.level-group').data(levelFactors);
levelGroups.enter().append('g');
levelGroups.exit().remove();
levelGroups.attr('class', function(d, i) {
return 'level-group level-group-' + i;
});
var levelLine = levelGroups.selectAll('.level').data(function(levelFactor) {
return d3.range(0, total).map(function() { return levelFactor; });
});
levelLine.enter().append('line');
levelLine.exit().remove();
if (cfg.levelTick){
levelLine
.attr('class', 'level')
.attr('x1', function(levelFactor, i){
if (radius == levelFactor) {
return getHorizontalPosition(i, levelFactor);
} else {
return getHorizontalPosition(i, levelFactor) + (cfg.TickLength / 2) * Math.cos(i * cfg.radians / total);
}
})
.attr('y1', function(levelFactor, i){
if (radius == levelFactor) {
return getVerticalPosition(i, levelFactor);
} else {
return getVerticalPosition(i, levelFactor) - (cfg.TickLength / 2) * Math.sin(i * cfg.radians / total);
}
})
.attr('x2', function(levelFactor, i){
if (radius == levelFactor) {
return getHorizontalPosition(i+1, levelFactor);
} else {
return getHorizontalPosition(i, levelFactor) - (cfg.TickLength / 2) * Math.cos(i * cfg.radians / total);
}
})
.attr('y2', function(levelFactor, i){
if (radius == levelFactor) {
return getVerticalPosition(i+1, levelFactor);
} else {
return getVerticalPosition(i, levelFactor) + (cfg.TickLength / 2) * Math.sin(i * cfg.radians / total);
}
})
.attr('transform', function(levelFactor) {
return 'translate(' + (cfg.w/2-levelFactor) + ', ' + (cfg.h/2-levelFactor) + ')';
});
}
else{
levelLine
.attr('class', 'level')
.attr('x1', function(levelFactor, i){ return getHorizontalPosition(i, levelFactor); })
.attr('y1', function(levelFactor, i){ return getVerticalPosition(i, levelFactor); })
.attr('x2', function(levelFactor, i){ return getHorizontalPosition(i+1, levelFactor); })
.attr('y2', function(levelFactor, i){ return getVerticalPosition(i+1, levelFactor); })
.attr('transform', function(levelFactor) {
return 'translate(' + (cfg.w/2-levelFactor) + ', ' + (cfg.h/2-levelFactor) + ')';
});
}
if(cfg.axisLine || cfg.axisText) {
var axis = container.selectAll('.axis').data(allAxis);
var newAxis = axis.enter().append('g');
if(cfg.axisLine) {
newAxis.append('line');
}
if(cfg.axisText) {
newAxis.append('text');
}
axis.exit().remove();
axis.attr('class', 'axis');
if(cfg.axisLine) {
axis.select('line')
.attr('x1', cfg.w/2)
.attr('y1', cfg.h/2)
.attr('x2', function(d, i) { return (cfg.w/2-radius2)+getHorizontalPosition(i, radius2, cfg.factor); })
.attr('y2', function(d, i) { return (cfg.h/2-radius2)+getVerticalPosition(i, radius2, cfg.factor); });
}
if(cfg.axisText) {
axis.select('text')
.attr('class', function(d, i){
var p = getHorizontalPosition(i, 0.5);
return 'legend ' +
((p < 0.4) ? 'left' : ((p > 0.6) ? 'right' : 'middle'));
})
.attr('dy', function(d, i) {
var p = getVerticalPosition(i, 0.5);
return ((p < 0.1) ? '1em' : ((p > 0.9) ? '0' : '0.5em'));
})
.text(function(d) { return d.name; })
.attr('x', function(d, i){ return d.xOffset+ (cfg.w/2-radius2)+getHorizontalPosition(i, radius2, cfg.factorLegend); })
.attr('y', function(d, i){ return d.yOffset+ (cfg.h/2-radius2)+getVerticalPosition(i, radius2, cfg.factorLegend); });
}
}
// content
data.forEach(function(d){
d.axes.forEach(function(axis, i) {
axis.x = (cfg.w/2-radius2)+getHorizontalPosition(i, radius2, (parseFloat(Math.max(axis.value - cfg.minValue, 0))/maxValue)*cfg.factor);
axis.y = (cfg.h/2-radius2)+getVerticalPosition(i, radius2, (parseFloat(Math.max(axis.value - cfg.minValue, 0))/maxValue)*cfg.factor);
});
});
var polygon = container.selectAll(".area").data(data, cfg.axisJoin);
polygon.enter().append('polygon')
.classed({area: 1, 'd3-enter': 1})
.on('mouseover', function (dd){
d3.event.stopPropagation();
container.classed('focus', 1);
d3.select(this).classed('focused', 1);
setTooltip(tooltip, cfg.tooltipFormatClass(dd.className));
})
.on('mouseout', function(){
d3.event.stopPropagation();
container.classed('focus', 0);
d3.select(this).classed('focused', 0);
setTooltip(tooltip, false);
});
polygon.exit()
.classed('d3-exit', 1) // trigger css transition
.transition().duration(cfg.transitionDuration)
.remove();
polygon
.each(function(d, i) {
var classed = {'d3-exit': 0}; // if exiting element is being reused
classed['radar-chart-serie' + i] = 1;
if(d.className) {
classed[d.className] = 1;
}
d3.select(this).classed(classed);
})
// styles should only be transitioned with css
.style('stroke', function(d, i) { return cfg.color(i); })
.style('fill', function(d, i) { return cfg.color(i); })
.transition().duration(cfg.transitionDuration)
// svg attrs with js
.attr('points',function(d) {
return d.axes.map(function(p) {
return [p.x, p.y].join(',');
}).join(' ');
})
.each('start', function() {
d3.select(this).classed('d3-enter', 0); // trigger css transition
});
if(cfg.circles && cfg.radius) {
var circleGroups = container.selectAll('g.circle-group').data(data, cfg.axisJoin);
circleGroups.enter().append('g').classed({'circle-group': 1, 'd3-enter': 1});
circleGroups.exit()
.classed('d3-exit', 1) // trigger css transition
.transition().duration(cfg.transitionDuration).remove();
circleGroups
.each(function(d) {
var classed = {'d3-exit': 0}; // if exiting element is being reused
if(d.className) {
classed[d.className] = 1;
}
d3.select(this).classed(classed);
})
.transition().duration(cfg.transitionDuration)
.each('start', function() {
d3.select(this).classed('d3-enter', 0); // trigger css transition
});
var circle = circleGroups.selectAll('.circle').data(function(datum, i) {
return datum.axes.map(function(d) { return [d, i]; });
});
circle.enter().append('circle')
.classed({circle: 1, 'd3-enter': 1})
.on('mouseover', function(dd){
d3.event.stopPropagation();
setTooltip(tooltip, cfg.tooltipFormatValue(dd[0].value));
//container.classed('focus', 1);
//container.select('.area.radar-chart-serie'+dd[1]).classed('focused', 1);
})
.on('mouseout', function(dd){
d3.event.stopPropagation();
setTooltip(tooltip, false);
container.classed('focus', 0);
//container.select('.area.radar-chart-serie'+dd[1]).classed('focused', 0);
//No idea why previous line breaks tooltip hovering area after hoverin point.
});
circle.exit()
.classed('d3-exit', 1) // trigger css transition
.transition().duration(cfg.transitionDuration).remove();
circle
.each(function(d) {
var classed = {'d3-exit': 0}; // if exit element reused
classed['radar-chart-serie'+d[1]] = 1;
d3.select(this).classed(classed);
})
// styles should only be transitioned with css
.style('fill', function(d) { return cfg.color(d[1]); })
.transition().duration(cfg.transitionDuration)
// svg attrs with js
.attr('r', cfg.radius)
.attr('cx', function(d) {
return d[0].x;
})
.attr('cy', function(d) {
return d[0].y;
})
.each('start', function() {
d3.select(this).classed('d3-enter', 0); // trigger css transition
});
//Make sure layer order is correct
var poly_node = polygon.node();
poly_node.parentNode.appendChild(poly_node);
var cg_node = circleGroups.node();
cg_node.parentNode.appendChild(cg_node);
// ensure tooltip is upmost layer
var tooltipEl = tooltip.node();
tooltipEl.parentNode.appendChild(tooltipEl);
}
});
}
radar.config = function(value) {
if(!arguments.length) {
return cfg;
}
if(arguments.length > 1) {
cfg[arguments[0]] = arguments[1];
}
else {
d3.entries(value || {}).forEach(function(option) {
cfg[option.key] = option.value;
});
}
return radar;
};
return radar;
},
draw: function(id, d, options) {
var chart = RadarChart.chart().config(options);
var cfg = chart.config();
d3.select(id).select('svg').remove();
d3.select(id)
.append("svg")
.attr("width", cfg.w)
.attr("height", cfg.h)
.datum(d)
.call(chart);
}
};
return RadarChart;
}));
| {
"content_hash": "b6d50e9003fee7fc79d120d0db3a04e7",
"timestamp": "",
"source": "github",
"line_count": 386,
"max_line_length": 151,
"avg_line_length": 38.33937823834197,
"alnum_prop": 0.502736671396716,
"repo_name": "Hacker0x01/radar-chart-d3",
"id": "f8291ee127f3548bdd91a2f6322600f60f19388a",
"size": "14799",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/radar-chart.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "1032"
},
{
"name": "HTML",
"bytes": "6163"
},
{
"name": "JavaScript",
"bytes": "14799"
}
],
"symlink_target": ""
} |
<md-card class="info-card">
<!-- <md-card-header>
<md-card-title>
</md-card-title>
</md-card-header> -->
<md-card-content>
<form [formGroup]="doForm">
<div>
<!-- <md-input-container>
<input mdInput [placeholder]="btity.titles.vehicles.vin" formControlName="vin">
</md-input-container>
<md-input-container class="m-size-input">
<input mdInput [placeholder]="btity.titles.vehicles.vehicle.vehicleType" formControlName="vehicleType">
</md-input-container> -->
<md-input-container class="l-size-input">
<input mdInput [placeholder]="btity.titles.dismantlingOrders.orderDate" disabled [value]="doForm.get('orderDate').value | date">
</md-input-container>
<ng-container *ngIf="isNew">
<ng-container *ngTemplateOutlet="planners"></ng-container>
</ng-container>
<!-- <ng-container>
<span style="width: 1em; display: inline-block"></span>
<md-checkbox color="primary" formControlName="noItemToRecycle">
{{btity.titles.dismantlingOrders.noItemToRecycle}}
</md-checkbox>
</ng-container> -->
<ng-container *ngIf="!isNew">
<md-input-container class="l-size-input">
<input mdInput disabled [placeholder]="btity.titles.dismantlingOrders.startedAt" [value]="doForm.get('startedAt').value | date">
</md-input-container>
<md-input-container class="l-size-input">
<input mdInput disabled [placeholder]="btity.titles.dismantlingOrders.completedAt" [value]="doForm.get('completedAt').value | date">
</md-input-container>
</ng-container>
</div>
<div class="select-container" *ngIf="!isNew">
<ng-container *ngTemplateOutlet="planners"></ng-container>
</div>
<div class="select-container" *ngIf="!isNew">
<md-select [multiple]="true" style="width: 30em;" class="small-select"
[placeholder]="btity.titles.dismantlingOrders.productionOperators" formControlName="productionOperators">
<md-option *ngFor="let staff of staffs" [value]="staff._id">
{{staff.displayName}}
</md-option>
</md-select>
</div>
</form>
<form [formGroup]="doForm.get('partsAndWastesPP')">
<div *ngFor="let pwPPCtrl of pwPPForm.controls; let i=index" [formGroupName]="i">
<md-input-container class="s-size-input">
<input mdInput [placeholder]="btity.titles.dismantlingOrders.id" formControlName="id">
</md-input-container>
<md-input-container class="s-size-input">
<input mdInput [placeholder]="btity.titles.dismantlingOrders.name" formControlName="name">
</md-input-container>
<md-input-container class="s-size-input">
<input mdInput type="number" [placeholder]="btity.titles.dismantlingOrders.countPlan" formControlName="countPlan">
</md-input-container>
<app-autocomplete-combo
[placeholderInput]="btity.titles.dismantlingOrders.conditionBeforeDismantling"
[formControlInput]="pwPPForm.get([i, 'conditionBeforeDismantling'])"
[objList]="btity.types.conditionBeforeDismantlingTypes"
[toSort]="false"
sizeClass='m-size-input'
>
</app-autocomplete-combo>
<md-input-container class="xl-size-input">
<input mdInput [placeholder]="btity.titles.dismantlingOrders.noteByPlanner" formControlName="noteByPlanner">
</md-input-container>
<ng-container *ngIf="!isNew && dismantlingOrder.startedAt">
<md-checkbox color="primary" formControlName="productionFinished" *ngIf="pwPPForm.get([i, 'conditionBeforeDismantling']).value.indexOf('遗失') === -1">
{{btity.titles.dismantlingOrders.productionFinished}}
</md-checkbox>
<md-checkbox color="primary" formControlName="productionIgnored" *ngIf="pwPPForm.get([i, 'conditionBeforeDismantling']).value.indexOf('遗失') > -1">
{{btity.titles.dismantlingOrders.productionIgnored}}
</md-checkbox>
<md-input-container class="m-size-input">
<input mdInput disabled [placeholder]="btity.titles.dismantlingOrders.productionDate" [value]="pwPPCtrl.get('productionDate').value | date">
</md-input-container>
<md-input-container class="s-size-input">
<input mdInput type="number" [placeholder]="btity.titles.dismantlingOrders.countProduction" formControlName="countProduction">
</md-input-container>
<md-input-container class="xl-size-input">
<input mdInput [placeholder]="btity.titles.dismantlingOrders.noteByProductionOperator" formControlName="noteByProductionOperator">
</md-input-container>
</ng-container>
<ng-container *ngIf="this.source === ddoTriggerTypes.inventoryInput">
<md-checkbox color="primary" formControlName="inventoryInputFinished" *ngIf="pwPPForm.get([i, 'conditionBeforeDismantling']).value.indexOf('遗失') === -1">
{{btity.titles.dismantlingOrders.inventoryInputFinished}}
</md-checkbox>
<md-input-container class="m-size-input">
<input mdInput disabled [placeholder]="btity.titles.dismantlingOrders.inventoryInputDate" [value]="pwPPCtrl.get('inventoryInputDate').value | date">
</md-input-container>
<button md-button color="primary" *ngIf="pwPPCtrl.get('productIds').value.length">查看入库件</button>
</ng-container>
</div>
</form>
<div *ngIf="dismantlingOrder.startedAt">
<md-input-container class="m-size-input">
<input mdInput disabled [placeholder]="btity.titles.dismantlingOrders.progressPercentage" [value]="doForm.get('progressPercentage').value | percent">
</md-input-container>
<md-checkbox color="primary"
[formControl]="doForm.get('confirmDismantlingCompleted')">
{{btity.titles.dismantlingOrders.confirmDismantlingCompleted}}
</md-checkbox>
</div>
</md-card-content>
</md-card>
<ng-template #planners>
<md-select [multiple]="true" style="width: 15em;" class="small-select"
[placeholder]="btity.titles.dismantlingOrders.planners" [formControl]="doForm.get('planners')">
<md-option *ngFor="let staff of staffs" [value]="staff._id">
{{staff.displayName}}
</md-option>
</md-select>
</ng-template>
<!-- <ng-container *ngTemplateOutlet="templateRefExp; context: contextExp"></ng-container> -->
<!--
planners: [this.isNew ? [this.auth.getUserDisplayName()] : oldDO.planners], // this is displayName now
productionOperators: [oldDO.productionOperators] // also displayName now --> | {
"content_hash": "f96ad41f33b9658222a22983244f3025",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 163,
"avg_line_length": 51.784615384615385,
"alnum_prop": 0.6512180629827689,
"repo_name": "rxjs-space/lyfront",
"id": "b76eaa07996b37c4235e7c610f7c92f43f29e312",
"size": "6754",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/app/shared/dismantling-order-details2/dismantling-order-details2.component.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "191"
},
{
"name": "CSS",
"bytes": "12195"
},
{
"name": "HTML",
"bytes": "306667"
},
{
"name": "JavaScript",
"bytes": "1996"
},
{
"name": "TypeScript",
"bytes": "549764"
}
],
"symlink_target": ""
} |
;
msos.provide("jquery.tools.equalize");
jquery.tools.equalize.version = new msos.set_version(14, 1, 10);
(function ($) {
$.fn.equalize = function (options) {
var $containers = this,
// this is the jQuery object
children = false,
reset = false,
equalize, type;
// when options are an object
if ($.isPlainObject(options)) {
equalize = options.equalize || 'height';
children = options.children || false;
reset = options.reset || false;
} else { // otherwise, a string was passed in or default to height
equalize = options || 'height';
}
if (!$.isFunction($.fn[equalize])) {
return false;
}
// determine if the height or width is being equalized
type = (equalize.indexOf('eight') > 0) ? 'height' : 'width';
return $containers.each(function () {
// when children exist, equalize the passed in child elements, otherwise equalize the children
var $children = (children) ? $(this).find(children) : $(this).children(),
max = 0; // reset for each container
$children.each(function () {
var $element = $(this),
value;
if (reset) {
$element.css(type, '');
} // remove existing height/width dimension
value = $element[equalize](); // call height(), outerHeight(), etc.
if (value > max) {
max = value;
} // update max
});
$children.css(type, max + 'px'); // add CSS to children
});
};
}(jQuery));
| {
"content_hash": "33d6d59da2aabe1983ba31d238ab1cbb",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 106,
"avg_line_length": 32.698113207547166,
"alnum_prop": 0.5031736872475476,
"repo_name": "OpenSiteMobile/mobilesiteos",
"id": "1906afc0cab1c4a0dd17d2c12e397bff708bd447",
"size": "2767",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "jquery/tools/equalize.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2308878"
},
{
"name": "HTML",
"bytes": "244053"
},
{
"name": "JavaScript",
"bytes": "14210863"
}
],
"symlink_target": ""
} |
import six
from mongoengine import ValidationError
from st2common import log as logging
from st2common.persistence.sensor import SensorType
from st2common.models.api.sensor import SensorTypeAPI
from st2common.exceptions.apivalidation import ValueValidationException
from st2common.validators.api.misc import validate_not_part_of_system_pack
from st2api.controllers import resource
from st2api.controllers.controller_transforms import transform_to_bool
from st2common.rbac.types import PermissionType
from st2common.rbac.backends import get_rbac_backend
from st2common.router import abort
http_client = six.moves.http_client
LOG = logging.getLogger(__name__)
class SensorTypeController(resource.ContentPackResourceController):
model = SensorTypeAPI
access = SensorType
supported_filters = {
"name": "name",
"pack": "pack",
"enabled": "enabled",
"trigger": "trigger_types",
}
filter_transform_functions = {"enabled": transform_to_bool}
options = {"sort": ["pack", "name"]}
def get_all(
self,
exclude_attributes=None,
include_attributes=None,
sort=None,
offset=0,
limit=None,
requester_user=None,
**raw_filters,
):
return super(SensorTypeController, self)._get_all(
exclude_fields=exclude_attributes,
include_fields=include_attributes,
sort=sort,
offset=offset,
limit=limit,
raw_filters=raw_filters,
requester_user=requester_user,
)
def get_one(self, ref_or_id, requester_user):
permission_type = PermissionType.SENSOR_VIEW
return super(SensorTypeController, self)._get_one(
ref_or_id, requester_user=requester_user, permission_type=permission_type
)
def put(self, sensor_type, ref_or_id, requester_user):
# Note: Right now this function only supports updating of "enabled"
# attribute on the SensorType model.
# The reason for that is that SensorTypeAPI.to_model right now only
# knows how to work with sensor type definitions from YAML files.
sensor_type_db = self._get_by_ref_or_id(ref_or_id=ref_or_id)
permission_type = PermissionType.SENSOR_MODIFY
rbac_utils = get_rbac_backend().get_utils_class()
rbac_utils.assert_user_has_resource_db_permission(
user_db=requester_user,
resource_db=sensor_type_db,
permission_type=permission_type,
)
sensor_type_id = sensor_type_db.id
try:
validate_not_part_of_system_pack(sensor_type_db)
except ValueValidationException as e:
abort(http_client.BAD_REQUEST, six.text_type(e))
return
if not getattr(sensor_type, "pack", None):
sensor_type.pack = sensor_type_db.pack
try:
old_sensor_type_db = sensor_type_db
sensor_type_db.id = sensor_type_id
sensor_type_db.enabled = getattr(sensor_type, "enabled", False)
sensor_type_db = SensorType.add_or_update(sensor_type_db)
except (ValidationError, ValueError) as e:
LOG.exception("Unable to update sensor_type data=%s", sensor_type)
abort(http_client.BAD_REQUEST, six.text_type(e))
return
extra = {
"old_sensor_type_db": old_sensor_type_db,
"new_sensor_type_db": sensor_type_db,
}
LOG.audit("Sensor updated. Sensor.id=%s." % (sensor_type_db.id), extra=extra)
sensor_type_api = SensorTypeAPI.from_model(sensor_type_db)
return sensor_type_api
sensor_type_controller = SensorTypeController()
| {
"content_hash": "8da3b2c783b210c7a8b275c92ce01887",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 85,
"avg_line_length": 35,
"alnum_prop": 0.6482479784366577,
"repo_name": "nzlosh/st2",
"id": "b62b56c92d9d40e51fc714c7d2127ea4036a3dc2",
"size": "4338",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "st2api/st2api/controllers/v1/sensors.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "198"
},
{
"name": "JavaScript",
"bytes": "444"
},
{
"name": "Jinja",
"bytes": "174532"
},
{
"name": "Makefile",
"bytes": "75242"
},
{
"name": "PowerShell",
"bytes": "856"
},
{
"name": "Python",
"bytes": "6453910"
},
{
"name": "Shell",
"bytes": "93607"
},
{
"name": "Starlark",
"bytes": "7236"
}
],
"symlink_target": ""
} |
using System.Text;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
using System.Diagnostics;
using System.Diagnostics.Contracts;
namespace System.IO
{
// This class implements a TextReader for reading characters to a Stream.
// This is designed for character input in a particular Encoding,
// whereas the Stream class is designed for byte input and output.
[Serializable]
public class StreamReader : TextReader
{
// StreamReader.Null is threadsafe.
public new static readonly StreamReader Null = new NullStreamReader();
// Encoding.GetPreamble() always allocates and returns a new byte[] array for
// encodings that have a preamble.
// We can avoid repeated allocations for the default and commonly used Encoding.UTF8
// encoding by using our own private cached instance of the UTF8 preamble.
// This is lazily allocated the first time it is used.
private static byte[] s_utf8Preamble;
// Using a 1K byte buffer and a 4K FileStream buffer works out pretty well
// perf-wise. On even a 40 MB text file, any perf loss by using a 4K
// buffer is negated by the win of allocating a smaller byte[], which
// saves construction time. This does break adaptive buffering,
// but this is slightly faster.
internal const int DefaultBufferSize = 1024; // Byte buffer size
internal const int DefaultFileStreamBufferSize = 4096;
private const int MinBufferSize = 128;
private Stream _stream;
private Encoding _encoding;
private Decoder _decoder;
private byte[] _byteBuffer;
private char[] _charBuffer;
private byte[] _preamble; // Encoding's preamble, which identifies this encoding.
private int _charPos;
private int _charLen;
// Record the number of valid bytes in the byteBuffer, for a few checks.
private int _byteLen;
// This is used only for preamble detection
private int _bytePos;
// This is the maximum number of chars we can get from one call to
// ReadBuffer. Used so ReadBuffer can tell when to copy data into
// a user's char[] directly, instead of our internal char[].
private int _maxCharsPerBuffer;
// We will support looking for byte order marks in the stream and trying
// to decide what the encoding might be from the byte order marks, IF they
// exist. But that's all we'll do.
private bool _detectEncoding;
// Whether we must still check for the encoding's given preamble at the
// beginning of this file.
private bool _checkPreamble;
// Whether the stream is most likely not going to give us back as much
// data as we want the next time we call it. We must do the computation
// before we do any byte order mark handling and save the result. Note
// that we need this to allow users to handle streams used for an
// interactive protocol, where they block waiting for the remote end
// to send a response, like logging in on a Unix machine.
private bool _isBlocked;
// The intent of this field is to leave open the underlying stream when
// disposing of this StreamReader. A name like _leaveOpen is better,
// but this type is serializable, and this field's name was _closable.
private bool _closable; // Whether to close the underlying stream.
// We don't guarantee thread safety on StreamReader, but we should at
// least prevent users from trying to read anything while an Async
// read from the same thread is in progress.
[NonSerialized]
private volatile Task _asyncReadTask;
private void CheckAsyncTaskInProgress()
{
// We are not locking the access to _asyncReadTask because this is not meant to guarantee thread safety.
// We are simply trying to deter calling any Read APIs while an async Read from the same thread is in progress.
Task t = _asyncReadTask;
if (t != null && !t.IsCompleted)
{
throw new InvalidOperationException(SR.InvalidOperation_AsyncIOInProgress);
}
}
// StreamReader by default will ignore illegal UTF8 characters. We don't want to
// throw here because we want to be able to read ill-formed data without choking.
// The high level goal is to be tolerant of encoding errors when we read and very strict
// when we write. Hence, default StreamWriter encoding will throw on error.
internal StreamReader()
{
}
public StreamReader(Stream stream)
: this(stream, true)
{
}
public StreamReader(Stream stream, bool detectEncodingFromByteOrderMarks)
: this(stream, Encoding.UTF8, detectEncodingFromByteOrderMarks, DefaultBufferSize, false)
{
}
public StreamReader(Stream stream, Encoding encoding)
: this(stream, encoding, true, DefaultBufferSize, false)
{
}
public StreamReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks)
: this(stream, encoding, detectEncodingFromByteOrderMarks, DefaultBufferSize, false)
{
}
// Creates a new StreamReader for the given stream. The
// character encoding is set by encoding and the buffer size,
// in number of 16-bit characters, is set by bufferSize.
//
// Note that detectEncodingFromByteOrderMarks is a very
// loose attempt at detecting the encoding by looking at the first
// 3 bytes of the stream. It will recognize UTF-8, little endian
// unicode, and big endian unicode text, but that's it. If neither
// of those three match, it will use the Encoding you provided.
//
public StreamReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize)
: this(stream, encoding, detectEncodingFromByteOrderMarks, bufferSize, false)
{
}
public StreamReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize, bool leaveOpen)
{
if (stream == null || encoding == null)
{
throw new ArgumentNullException(stream == null ? nameof(stream) : nameof(encoding));
}
if (!stream.CanRead)
{
throw new ArgumentException(SR.Argument_StreamNotReadable);
}
if (bufferSize <= 0)
{
throw new ArgumentOutOfRangeException(nameof(bufferSize), SR.ArgumentOutOfRange_NeedPosNum);
}
Init(stream, encoding, detectEncodingFromByteOrderMarks, bufferSize, leaveOpen);
}
public StreamReader(string path)
: this(path, true)
{
}
public StreamReader(string path, bool detectEncodingFromByteOrderMarks)
: this(path, Encoding.UTF8, detectEncodingFromByteOrderMarks, DefaultBufferSize)
{
}
public StreamReader(string path, Encoding encoding)
: this(path, encoding, true, DefaultBufferSize)
{
}
public StreamReader(string path, Encoding encoding, bool detectEncodingFromByteOrderMarks)
: this(path, encoding, detectEncodingFromByteOrderMarks, DefaultBufferSize)
{
}
public StreamReader(string path, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize)
{
if (path == null)
throw new ArgumentNullException(nameof(path));
if (encoding == null)
throw new ArgumentNullException(nameof(encoding));
if (path.Length == 0)
throw new ArgumentException(SR.Argument_EmptyPath);
if (bufferSize <= 0)
throw new ArgumentOutOfRangeException(nameof(bufferSize), SR.ArgumentOutOfRange_NeedPosNum);
Stream stream = FileStreamHelpers.CreateFileStream(path, write: false, append: false);
Init(stream, encoding, detectEncodingFromByteOrderMarks, bufferSize, leaveOpen: false);
}
private void Init(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize, bool leaveOpen)
{
_stream = stream;
_encoding = encoding;
_decoder = encoding.GetDecoder();
if (bufferSize < MinBufferSize)
{
bufferSize = MinBufferSize;
}
_byteBuffer = new byte[bufferSize];
_maxCharsPerBuffer = encoding.GetMaxCharCount(bufferSize);
_charBuffer = new char[_maxCharsPerBuffer];
_byteLen = 0;
_bytePos = 0;
_detectEncoding = detectEncodingFromByteOrderMarks;
// Encoding.GetPreamble() always allocates and returns a new byte[] array for
// encodings that have a preamble.
// We can avoid repeated allocations for the default and commonly used Encoding.UTF8
// encoding by using our own private cached instance of the UTF8 preamble.
// We specifically look for Encoding.UTF8 because we know it has a preamble,
// whereas other instances of UTF8Encoding may not have a preamble enabled, and
// there's no public way to tell if the preamble is enabled for an instance other
// than calling GetPreamble(), which we're trying to avoid.
// This means that other instances of UTF8Encoding are excluded from this optimization.
_preamble = object.ReferenceEquals(encoding, Encoding.UTF8) ?
(s_utf8Preamble ?? (s_utf8Preamble = encoding.GetPreamble())) :
encoding.GetPreamble();
_checkPreamble = (_preamble.Length > 0);
_isBlocked = false;
_closable = !leaveOpen;
}
// Init used by NullStreamReader, to delay load encoding
internal void Init(Stream stream)
{
_stream = stream;
_closable = true;
}
public override void Close()
{
Dispose(true);
}
protected override void Dispose(bool disposing)
{
// Dispose of our resources if this StreamReader is closable.
// Note that Console.In should be left open.
try
{
// Note that Stream.Close() can potentially throw here. So we need to
// ensure cleaning up internal resources, inside the finally block.
if (!LeaveOpen && disposing && (_stream != null))
{
_stream.Close();
}
}
finally
{
if (!LeaveOpen && (_stream != null))
{
_stream = null;
_encoding = null;
_decoder = null;
_byteBuffer = null;
_charBuffer = null;
_charPos = 0;
_charLen = 0;
base.Dispose(disposing);
}
}
}
public virtual Encoding CurrentEncoding
{
get { return _encoding; }
}
public virtual Stream BaseStream
{
get { return _stream; }
}
internal bool LeaveOpen
{
get { return !_closable; }
}
// DiscardBufferedData tells StreamReader to throw away its internal
// buffer contents. This is useful if the user needs to seek on the
// underlying stream to a known location then wants the StreamReader
// to start reading from this new point. This method should be called
// very sparingly, if ever, since it can lead to very poor performance.
// However, it may be the only way of handling some scenarios where
// users need to re-read the contents of a StreamReader a second time.
public void DiscardBufferedData()
{
CheckAsyncTaskInProgress();
_byteLen = 0;
_charLen = 0;
_charPos = 0;
// in general we'd like to have an invariant that encoding isn't null. However,
// for startup improvements for NullStreamReader, we want to delay load encoding.
if (_encoding != null)
{
_decoder = _encoding.GetDecoder();
}
_isBlocked = false;
}
public bool EndOfStream
{
get
{
if (_stream == null)
{
throw new ObjectDisposedException(null, SR.ObjectDisposed_ReaderClosed);
}
CheckAsyncTaskInProgress();
if (_charPos < _charLen)
{
return false;
}
// This may block on pipes!
int numRead = ReadBuffer();
return numRead == 0;
}
}
[Pure]
public override int Peek()
{
if (_stream == null)
{
throw new ObjectDisposedException(null, SR.ObjectDisposed_ReaderClosed);
}
CheckAsyncTaskInProgress();
if (_charPos == _charLen)
{
if (_isBlocked || ReadBuffer() == 0)
{
return -1;
}
}
return _charBuffer[_charPos];
}
public override int Read()
{
if (_stream == null)
{
throw new ObjectDisposedException(null, SR.ObjectDisposed_ReaderClosed);
}
CheckAsyncTaskInProgress();
if (_charPos == _charLen)
{
if (ReadBuffer() == 0)
{
return -1;
}
}
int result = _charBuffer[_charPos];
_charPos++;
return result;
}
public override int Read(char[] buffer, int index, int count)
{
if (buffer == null)
{
throw new ArgumentNullException(nameof(buffer), SR.ArgumentNull_Buffer);
}
if (index < 0 || count < 0)
{
throw new ArgumentOutOfRangeException(index < 0 ? nameof(index) : nameof(count), SR.ArgumentOutOfRange_NeedNonNegNum);
}
if (buffer.Length - index < count)
{
throw new ArgumentException(SR.Argument_InvalidOffLen);
}
if (_stream == null)
{
throw new ObjectDisposedException(null, SR.ObjectDisposed_ReaderClosed);
}
CheckAsyncTaskInProgress();
int charsRead = 0;
// As a perf optimization, if we had exactly one buffer's worth of
// data read in, let's try writing directly to the user's buffer.
bool readToUserBuffer = false;
while (count > 0)
{
int n = _charLen - _charPos;
if (n == 0)
{
n = ReadBuffer(buffer, index + charsRead, count, out readToUserBuffer);
}
if (n == 0)
{
break; // We're at EOF
}
if (n > count)
{
n = count;
}
if (!readToUserBuffer)
{
Buffer.BlockCopy(_charBuffer, _charPos * 2, buffer, (index + charsRead) * 2, n * 2);
_charPos += n;
}
charsRead += n;
count -= n;
// This function shouldn't block for an indefinite amount of time,
// or reading from a network stream won't work right. If we got
// fewer bytes than we requested, then we want to break right here.
if (_isBlocked)
{
break;
}
}
return charsRead;
}
public override string ReadToEnd()
{
if (_stream == null)
{
throw new ObjectDisposedException(null, SR.ObjectDisposed_ReaderClosed);
}
CheckAsyncTaskInProgress();
// Call ReadBuffer, then pull data out of charBuffer.
StringBuilder sb = new StringBuilder(_charLen - _charPos);
do
{
sb.Append(_charBuffer, _charPos, _charLen - _charPos);
_charPos = _charLen; // Note we consumed these characters
ReadBuffer();
} while (_charLen > 0);
return sb.ToString();
}
public override int ReadBlock(char[] buffer, int index, int count)
{
if (buffer == null)
{
throw new ArgumentNullException(nameof(buffer), SR.ArgumentNull_Buffer);
}
if (index < 0 || count < 0)
{
throw new ArgumentOutOfRangeException(index < 0 ? nameof(index) : nameof(count), SR.ArgumentOutOfRange_NeedNonNegNum);
}
if (buffer.Length - index < count)
{
throw new ArgumentException(SR.Argument_InvalidOffLen);
}
if (_stream == null)
{
throw new ObjectDisposedException(null, SR.ObjectDisposed_ReaderClosed);
}
CheckAsyncTaskInProgress();
return base.ReadBlock(buffer, index, count);
}
// Trims n bytes from the front of the buffer.
private void CompressBuffer(int n)
{
Debug.Assert(_byteLen >= n, "CompressBuffer was called with a number of bytes greater than the current buffer length. Are two threads using this StreamReader at the same time?");
Buffer.BlockCopy(_byteBuffer, n, _byteBuffer, 0, _byteLen - n);
_byteLen -= n;
}
private void DetectEncoding()
{
if (_byteLen < 2)
{
return;
}
_detectEncoding = false;
bool changedEncoding = false;
if (_byteBuffer[0] == 0xFE && _byteBuffer[1] == 0xFF)
{
// Big Endian Unicode
_encoding = Encoding.BigEndianUnicode;
CompressBuffer(2);
changedEncoding = true;
}
else if (_byteBuffer[0] == 0xFF && _byteBuffer[1] == 0xFE)
{
// Little Endian Unicode, or possibly little endian UTF32
if (_byteLen < 4 || _byteBuffer[2] != 0 || _byteBuffer[3] != 0)
{
_encoding = Encoding.Unicode;
CompressBuffer(2);
changedEncoding = true;
}
else
{
_encoding = Encoding.UTF32;
CompressBuffer(4);
changedEncoding = true;
}
}
else if (_byteLen >= 3 && _byteBuffer[0] == 0xEF && _byteBuffer[1] == 0xBB && _byteBuffer[2] == 0xBF)
{
// UTF-8
_encoding = Encoding.UTF8;
CompressBuffer(3);
changedEncoding = true;
}
else if (_byteLen >= 4 && _byteBuffer[0] == 0 && _byteBuffer[1] == 0 &&
_byteBuffer[2] == 0xFE && _byteBuffer[3] == 0xFF)
{
// Big Endian UTF32
_encoding = new UTF32Encoding(bigEndian: true, byteOrderMark: true);
CompressBuffer(4);
changedEncoding = true;
}
else if (_byteLen == 2)
{
_detectEncoding = true;
}
// Note: in the future, if we change this algorithm significantly,
// we can support checking for the preamble of the given encoding.
if (changedEncoding)
{
_decoder = _encoding.GetDecoder();
_maxCharsPerBuffer = _encoding.GetMaxCharCount(_byteBuffer.Length);
_charBuffer = new char[_maxCharsPerBuffer];
}
}
// Trims the preamble bytes from the byteBuffer. This routine can be called multiple times
// and we will buffer the bytes read until the preamble is matched or we determine that
// there is no match. If there is no match, every byte read previously will be available
// for further consumption. If there is a match, we will compress the buffer for the
// leading preamble bytes
private bool IsPreamble()
{
if (!_checkPreamble)
{
return _checkPreamble;
}
Debug.Assert(_bytePos <= _preamble.Length, "_compressPreamble was called with the current bytePos greater than the preamble buffer length. Are two threads using this StreamReader at the same time?");
int len = (_byteLen >= (_preamble.Length)) ? (_preamble.Length - _bytePos) : (_byteLen - _bytePos);
for (int i = 0; i < len; i++, _bytePos++)
{
if (_byteBuffer[_bytePos] != _preamble[_bytePos])
{
_bytePos = 0;
_checkPreamble = false;
break;
}
}
Debug.Assert(_bytePos <= _preamble.Length, "possible bug in _compressPreamble. Are two threads using this StreamReader at the same time?");
if (_checkPreamble)
{
if (_bytePos == _preamble.Length)
{
// We have a match
CompressBuffer(_preamble.Length);
_bytePos = 0;
_checkPreamble = false;
_detectEncoding = false;
}
}
return _checkPreamble;
}
internal virtual int ReadBuffer()
{
_charLen = 0;
_charPos = 0;
if (!_checkPreamble)
{
_byteLen = 0;
}
do
{
if (_checkPreamble)
{
Debug.Assert(_bytePos <= _preamble.Length, "possible bug in _compressPreamble. Are two threads using this StreamReader at the same time?");
int len = _stream.Read(_byteBuffer, _bytePos, _byteBuffer.Length - _bytePos);
Debug.Assert(len >= 0, "Stream.Read returned a negative number! This is a bug in your stream class.");
if (len == 0)
{
// EOF but we might have buffered bytes from previous
// attempt to detect preamble that needs to be decoded now
if (_byteLen > 0)
{
_charLen += _decoder.GetChars(_byteBuffer, 0, _byteLen, _charBuffer, _charLen);
// Need to zero out the byteLen after we consume these bytes so that we don't keep infinitely hitting this code path
_bytePos = _byteLen = 0;
}
return _charLen;
}
_byteLen += len;
}
else
{
Debug.Assert(_bytePos == 0, "bytePos can be non zero only when we are trying to _checkPreamble. Are two threads using this StreamReader at the same time?");
_byteLen = _stream.Read(_byteBuffer, 0, _byteBuffer.Length);
Debug.Assert(_byteLen >= 0, "Stream.Read returned a negative number! This is a bug in your stream class.");
if (_byteLen == 0) // We're at EOF
{
return _charLen;
}
}
// _isBlocked == whether we read fewer bytes than we asked for.
// Note we must check it here because CompressBuffer or
// DetectEncoding will change byteLen.
_isBlocked = (_byteLen < _byteBuffer.Length);
// Check for preamble before detect encoding. This is not to override the
// user supplied Encoding for the one we implicitly detect. The user could
// customize the encoding which we will loose, such as ThrowOnError on UTF8
if (IsPreamble())
{
continue;
}
// If we're supposed to detect the encoding and haven't done so yet,
// do it. Note this may need to be called more than once.
if (_detectEncoding && _byteLen >= 2)
{
DetectEncoding();
}
_charLen += _decoder.GetChars(_byteBuffer, 0, _byteLen, _charBuffer, _charLen);
} while (_charLen == 0);
//Console.WriteLine("ReadBuffer called. chars: "+charLen);
return _charLen;
}
// This version has a perf optimization to decode data DIRECTLY into the
// user's buffer, bypassing StreamReader's own buffer.
// This gives a > 20% perf improvement for our encodings across the board,
// but only when asking for at least the number of characters that one
// buffer's worth of bytes could produce.
// This optimization, if run, will break SwitchEncoding, so we must not do
// this on the first call to ReadBuffer.
private int ReadBuffer(char[] userBuffer, int userOffset, int desiredChars, out bool readToUserBuffer)
{
_charLen = 0;
_charPos = 0;
if (!_checkPreamble)
{
_byteLen = 0;
}
int charsRead = 0;
// As a perf optimization, we can decode characters DIRECTLY into a
// user's char[]. We absolutely must not write more characters
// into the user's buffer than they asked for. Calculating
// encoding.GetMaxCharCount(byteLen) each time is potentially very
// expensive - instead, cache the number of chars a full buffer's
// worth of data may produce. Yes, this makes the perf optimization
// less aggressive, in that all reads that asked for fewer than AND
// returned fewer than _maxCharsPerBuffer chars won't get the user
// buffer optimization. This affects reads where the end of the
// Stream comes in the middle somewhere, and when you ask for
// fewer chars than your buffer could produce.
readToUserBuffer = desiredChars >= _maxCharsPerBuffer;
do
{
Debug.Assert(charsRead == 0);
if (_checkPreamble)
{
Debug.Assert(_bytePos <= _preamble.Length, "possible bug in _compressPreamble. Are two threads using this StreamReader at the same time?");
int len = _stream.Read(_byteBuffer, _bytePos, _byteBuffer.Length - _bytePos);
Debug.Assert(len >= 0, "Stream.Read returned a negative number! This is a bug in your stream class.");
if (len == 0)
{
// EOF but we might have buffered bytes from previous
// attempt to detect preamble that needs to be decoded now
if (_byteLen > 0)
{
if (readToUserBuffer)
{
charsRead = _decoder.GetChars(_byteBuffer, 0, _byteLen, userBuffer, userOffset + charsRead);
_charLen = 0; // StreamReader's buffer is empty.
}
else
{
charsRead = _decoder.GetChars(_byteBuffer, 0, _byteLen, _charBuffer, charsRead);
_charLen += charsRead; // Number of chars in StreamReader's buffer.
}
}
return charsRead;
}
_byteLen += len;
}
else
{
Debug.Assert(_bytePos == 0, "bytePos can be non zero only when we are trying to _checkPreamble. Are two threads using this StreamReader at the same time?");
_byteLen = _stream.Read(_byteBuffer, 0, _byteBuffer.Length);
Debug.Assert(_byteLen >= 0, "Stream.Read returned a negative number! This is a bug in your stream class.");
if (_byteLen == 0) // EOF
{
break;
}
}
// _isBlocked == whether we read fewer bytes than we asked for.
// Note we must check it here because CompressBuffer or
// DetectEncoding will change byteLen.
_isBlocked = (_byteLen < _byteBuffer.Length);
// Check for preamble before detect encoding. This is not to override the
// user supplied Encoding for the one we implicitly detect. The user could
// customize the encoding which we will loose, such as ThrowOnError on UTF8
// Note: we don't need to recompute readToUserBuffer optimization as IsPreamble
// doesn't change the encoding or affect _maxCharsPerBuffer
if (IsPreamble())
{
continue;
}
// On the first call to ReadBuffer, if we're supposed to detect the encoding, do it.
if (_detectEncoding && _byteLen >= 2)
{
DetectEncoding();
// DetectEncoding changes some buffer state. Recompute this.
readToUserBuffer = desiredChars >= _maxCharsPerBuffer;
}
_charPos = 0;
if (readToUserBuffer)
{
charsRead += _decoder.GetChars(_byteBuffer, 0, _byteLen, userBuffer, userOffset + charsRead);
_charLen = 0; // StreamReader's buffer is empty.
}
else
{
charsRead = _decoder.GetChars(_byteBuffer, 0, _byteLen, _charBuffer, charsRead);
_charLen += charsRead; // Number of chars in StreamReader's buffer.
}
} while (charsRead == 0);
_isBlocked &= charsRead < desiredChars;
//Console.WriteLine("ReadBuffer: charsRead: "+charsRead+" readToUserBuffer: "+readToUserBuffer);
return charsRead;
}
// Reads a line. A line is defined as a sequence of characters followed by
// a carriage return ('\r'), a line feed ('\n'), or a carriage return
// immediately followed by a line feed. The resulting string does not
// contain the terminating carriage return and/or line feed. The returned
// value is null if the end of the input stream has been reached.
//
public override string ReadLine()
{
if (_stream == null)
{
throw new ObjectDisposedException(null, SR.ObjectDisposed_ReaderClosed);
}
CheckAsyncTaskInProgress();
if (_charPos == _charLen)
{
if (ReadBuffer() == 0)
{
return null;
}
}
StringBuilder sb = null;
do
{
int i = _charPos;
do
{
char ch = _charBuffer[i];
// Note the following common line feed chars:
// \n - UNIX \r\n - DOS \r - Mac
if (ch == '\r' || ch == '\n')
{
string s;
if (sb != null)
{
sb.Append(_charBuffer, _charPos, i - _charPos);
s = sb.ToString();
}
else
{
s = new string(_charBuffer, _charPos, i - _charPos);
}
_charPos = i + 1;
if (ch == '\r' && (_charPos < _charLen || ReadBuffer() > 0))
{
if (_charBuffer[_charPos] == '\n')
{
_charPos++;
}
}
return s;
}
i++;
} while (i < _charLen);
i = _charLen - _charPos;
if (sb == null)
{
sb = new StringBuilder(i + 80);
}
sb.Append(_charBuffer, _charPos, i);
} while (ReadBuffer() > 0);
return sb.ToString();
}
#region Task based Async APIs
public override Task<string> ReadLineAsync()
{
// If we have been inherited into a subclass, the following implementation could be incorrect
// since it does not call through to Read() which a subclass might have overridden.
// To be safe we will only use this implementation in cases where we know it is safe to do so,
// and delegate to our base class (which will call into Read) when we are not sure.
if (GetType() != typeof(StreamReader))
{
return base.ReadLineAsync();
}
if (_stream == null)
{
throw new ObjectDisposedException(null, SR.ObjectDisposed_ReaderClosed);
}
CheckAsyncTaskInProgress();
Task<string> task = ReadLineAsyncInternal();
_asyncReadTask = task;
return task;
}
private async Task<string> ReadLineAsyncInternal()
{
if (CharPos_Prop == CharLen_Prop && (await ReadBufferAsync().ConfigureAwait(false)) == 0)
{
return null;
}
StringBuilder sb = null;
do
{
char[] tmpCharBuffer = CharBuffer_Prop;
int tmpCharLen = CharLen_Prop;
int tmpCharPos = CharPos_Prop;
int i = tmpCharPos;
do
{
char ch = tmpCharBuffer[i];
// Note the following common line feed chars:
// \n - UNIX \r\n - DOS \r - Mac
if (ch == '\r' || ch == '\n')
{
string s;
if (sb != null)
{
sb.Append(tmpCharBuffer, tmpCharPos, i - tmpCharPos);
s = sb.ToString();
}
else
{
s = new string(tmpCharBuffer, tmpCharPos, i - tmpCharPos);
}
CharPos_Prop = tmpCharPos = i + 1;
if (ch == '\r' && (tmpCharPos < tmpCharLen || (await ReadBufferAsync().ConfigureAwait(false)) > 0))
{
tmpCharPos = CharPos_Prop;
if (CharBuffer_Prop[tmpCharPos] == '\n')
{
CharPos_Prop = ++tmpCharPos;
}
}
return s;
}
i++;
} while (i < tmpCharLen);
i = tmpCharLen - tmpCharPos;
if (sb == null)
{
sb = new StringBuilder(i + 80);
}
sb.Append(tmpCharBuffer, tmpCharPos, i);
} while (await ReadBufferAsync().ConfigureAwait(false) > 0);
return sb.ToString();
}
public override Task<string> ReadToEndAsync()
{
// If we have been inherited into a subclass, the following implementation could be incorrect
// since it does not call through to Read() which a subclass might have overridden.
// To be safe we will only use this implementation in cases where we know it is safe to do so,
// and delegate to our base class (which will call into Read) when we are not sure.
if (GetType() != typeof(StreamReader))
{
return base.ReadToEndAsync();
}
if (_stream == null)
{
throw new ObjectDisposedException(null, SR.ObjectDisposed_ReaderClosed);
}
CheckAsyncTaskInProgress();
Task<string> task = ReadToEndAsyncInternal();
_asyncReadTask = task;
return task;
}
private async Task<string> ReadToEndAsyncInternal()
{
// Call ReadBuffer, then pull data out of charBuffer.
StringBuilder sb = new StringBuilder(CharLen_Prop - CharPos_Prop);
do
{
int tmpCharPos = CharPos_Prop;
sb.Append(CharBuffer_Prop, tmpCharPos, CharLen_Prop - tmpCharPos);
CharPos_Prop = CharLen_Prop; // We consumed these characters
await ReadBufferAsync().ConfigureAwait(false);
} while (CharLen_Prop > 0);
return sb.ToString();
}
public override Task<int> ReadAsync(char[] buffer, int index, int count)
{
if (buffer == null)
{
throw new ArgumentNullException(nameof(buffer), SR.ArgumentNull_Buffer);
}
if (index < 0 || count < 0)
{
throw new ArgumentOutOfRangeException(index < 0 ? nameof(index) : nameof(count), SR.ArgumentOutOfRange_NeedNonNegNum);
}
if (buffer.Length - index < count)
{
throw new ArgumentException(SR.Argument_InvalidOffLen);
}
// If we have been inherited into a subclass, the following implementation could be incorrect
// since it does not call through to Read() which a subclass might have overridden.
// To be safe we will only use this implementation in cases where we know it is safe to do so,
// and delegate to our base class (which will call into Read) when we are not sure.
if (GetType() != typeof(StreamReader))
{
return base.ReadAsync(buffer, index, count);
}
if (_stream == null)
{
throw new ObjectDisposedException(null, SR.ObjectDisposed_ReaderClosed);
}
CheckAsyncTaskInProgress();
Task<int> task = ReadAsyncInternal(buffer, index, count);
_asyncReadTask = task;
return task;
}
internal override async Task<int> ReadAsyncInternal(char[] buffer, int index, int count)
{
if (CharPos_Prop == CharLen_Prop && (await ReadBufferAsync().ConfigureAwait(false)) == 0)
{
return 0;
}
int charsRead = 0;
// As a perf optimization, if we had exactly one buffer's worth of
// data read in, let's try writing directly to the user's buffer.
bool readToUserBuffer = false;
Byte[] tmpByteBuffer = ByteBuffer_Prop;
Stream tmpStream = Stream_Prop;
while (count > 0)
{
// n is the characters available in _charBuffer
int n = CharLen_Prop - CharPos_Prop;
// charBuffer is empty, let's read from the stream
if (n == 0)
{
CharLen_Prop = 0;
CharPos_Prop = 0;
if (!CheckPreamble_Prop)
{
ByteLen_Prop = 0;
}
readToUserBuffer = count >= MaxCharsPerBuffer_Prop;
// We loop here so that we read in enough bytes to yield at least 1 char.
// We break out of the loop if the stream is blocked (EOF is reached).
do
{
Debug.Assert(n == 0);
if (CheckPreamble_Prop)
{
Debug.Assert(BytePos_Prop <= Preamble_Prop.Length, "possible bug in _compressPreamble. Are two threads using this StreamReader at the same time?");
int tmpBytePos = BytePos_Prop;
int len = await tmpStream.ReadAsync(tmpByteBuffer, tmpBytePos, tmpByteBuffer.Length - tmpBytePos).ConfigureAwait(false);
Debug.Assert(len >= 0, "Stream.Read returned a negative number! This is a bug in your stream class.");
if (len == 0)
{
// EOF but we might have buffered bytes from previous
// attempts to detect preamble that needs to be decoded now
if (ByteLen_Prop > 0)
{
if (readToUserBuffer)
{
n = Decoder_Prop.GetChars(tmpByteBuffer, 0, ByteLen_Prop, buffer, index + charsRead);
CharLen_Prop = 0; // StreamReader's buffer is empty.
}
else
{
n = Decoder_Prop.GetChars(tmpByteBuffer, 0, ByteLen_Prop, CharBuffer_Prop, 0);
CharLen_Prop += n; // Number of chars in StreamReader's buffer.
}
}
// How can part of the preamble yield any chars?
Debug.Assert(n == 0);
IsBlocked_Prop = true;
break;
}
else
{
ByteLen_Prop += len;
}
}
else
{
Debug.Assert(BytePos_Prop == 0, "_bytePos can be non zero only when we are trying to _checkPreamble. Are two threads using this StreamReader at the same time?");
ByteLen_Prop = await tmpStream.ReadAsync(tmpByteBuffer, 0, tmpByteBuffer.Length).ConfigureAwait(false);
Debug.Assert(ByteLen_Prop >= 0, "Stream.Read returned a negative number! This is a bug in your stream class.");
if (ByteLen_Prop == 0) // EOF
{
IsBlocked_Prop = true;
break;
}
}
// _isBlocked == whether we read fewer bytes than we asked for.
// Note we must check it here because CompressBuffer or
// DetectEncoding will change _byteLen.
IsBlocked_Prop = (ByteLen_Prop < tmpByteBuffer.Length);
// Check for preamble before detect encoding. This is not to override the
// user supplied Encoding for the one we implicitly detect. The user could
// customize the encoding which we will loose, such as ThrowOnError on UTF8
// Note: we don't need to recompute readToUserBuffer optimization as IsPreamble
// doesn't change the encoding or affect _maxCharsPerBuffer
if (IsPreamble())
{
continue;
}
// On the first call to ReadBuffer, if we're supposed to detect the encoding, do it.
if (DetectEncoding_Prop && ByteLen_Prop >= 2)
{
DetectEncoding();
// DetectEncoding changes some buffer state. Recompute this.
readToUserBuffer = count >= MaxCharsPerBuffer_Prop;
}
Debug.Assert(n == 0);
CharPos_Prop = 0;
if (readToUserBuffer)
{
n += Decoder_Prop.GetChars(tmpByteBuffer, 0, ByteLen_Prop, buffer, index + charsRead);
// Why did the bytes yield no chars?
Debug.Assert(n > 0);
CharLen_Prop = 0; // StreamReader's buffer is empty.
}
else
{
n = Decoder_Prop.GetChars(tmpByteBuffer, 0, ByteLen_Prop, CharBuffer_Prop, 0);
// Why did the bytes yield no chars?
Debug.Assert(n > 0);
CharLen_Prop += n; // Number of chars in StreamReader's buffer.
}
} while (n == 0);
if (n == 0)
{
break; // We're at EOF
}
} // if (n == 0)
// Got more chars in charBuffer than the user requested
if (n > count)
{
n = count;
}
if (!readToUserBuffer)
{
Buffer.BlockCopy(CharBuffer_Prop, CharPos_Prop * 2, buffer, (index + charsRead) * 2, n * 2);
CharPos_Prop += n;
}
charsRead += n;
count -= n;
// This function shouldn't block for an indefinite amount of time,
// or reading from a network stream won't work right. If we got
// fewer bytes than we requested, then we want to break right here.
if (IsBlocked_Prop)
{
break;
}
} // while (count > 0)
return charsRead;
}
public override Task<int> ReadBlockAsync(char[] buffer, int index, int count)
{
if (buffer == null)
{
throw new ArgumentNullException(nameof(buffer), SR.ArgumentNull_Buffer);
}
if (index < 0 || count < 0)
{
throw new ArgumentOutOfRangeException(index < 0 ? nameof(index) : nameof(count), SR.ArgumentOutOfRange_NeedNonNegNum);
}
if (buffer.Length - index < count)
{
throw new ArgumentException(SR.Argument_InvalidOffLen);
}
// If we have been inherited into a subclass, the following implementation could be incorrect
// since it does not call through to Read() which a subclass might have overridden.
// To be safe we will only use this implementation in cases where we know it is safe to do so,
// and delegate to our base class (which will call into Read) when we are not sure.
if (GetType() != typeof(StreamReader))
{
return base.ReadBlockAsync(buffer, index, count);
}
if (_stream == null)
{
throw new ObjectDisposedException(null, SR.ObjectDisposed_ReaderClosed);
}
CheckAsyncTaskInProgress();
Task<int> task = base.ReadBlockAsync(buffer, index, count);
_asyncReadTask = task;
return task;
}
#region Private properties for async method performance
// Access to instance fields of MarshalByRefObject-derived types requires special JIT helpers that check
// if the instance operated on is remote. This is optimised for fields on 'this' but if a method is Async
// and is thus lifted to a state machine type, access will be slow.
// As a workaround, we either cache instance fields in locals or use properties to access such fields.
// See Dev11 bug #370300 for more info.
private int CharLen_Prop
{
get { return _charLen; }
set { _charLen = value; }
}
private int CharPos_Prop
{
get { return _charPos; }
set { _charPos = value; }
}
private int ByteLen_Prop
{
get { return _byteLen; }
set { _byteLen = value; }
}
private int BytePos_Prop
{
get { return _bytePos; }
set { _bytePos = value; }
}
private Byte[] Preamble_Prop
{
get { return _preamble; }
}
private bool CheckPreamble_Prop
{
get { return _checkPreamble; }
}
private Decoder Decoder_Prop
{
get { return _decoder; }
}
private bool DetectEncoding_Prop
{
get { return _detectEncoding; }
}
private char[] CharBuffer_Prop
{
get { return _charBuffer; }
}
private Byte[] ByteBuffer_Prop
{
get { return _byteBuffer; }
}
private bool IsBlocked_Prop
{
get { return _isBlocked; }
set { _isBlocked = value; }
}
private Stream Stream_Prop
{
get { return _stream; }
}
private int MaxCharsPerBuffer_Prop
{
get { return _maxCharsPerBuffer; }
}
#endregion Private properties for async method performance
private async Task<int> ReadBufferAsync()
{
CharLen_Prop = 0;
CharPos_Prop = 0;
Byte[] tmpByteBuffer = ByteBuffer_Prop;
Stream tmpStream = Stream_Prop;
if (!CheckPreamble_Prop)
{
ByteLen_Prop = 0;
}
do
{
if (CheckPreamble_Prop)
{
Debug.Assert(BytePos_Prop <= Preamble_Prop.Length, "possible bug in _compressPreamble. Are two threads using this StreamReader at the same time?");
int tmpBytePos = BytePos_Prop;
int len = await tmpStream.ReadAsync(tmpByteBuffer, tmpBytePos, tmpByteBuffer.Length - tmpBytePos).ConfigureAwait(false);
Debug.Assert(len >= 0, "Stream.Read returned a negative number! This is a bug in your stream class.");
if (len == 0)
{
// EOF but we might have buffered bytes from previous
// attempt to detect preamble that needs to be decoded now
if (ByteLen_Prop > 0)
{
CharLen_Prop += Decoder_Prop.GetChars(tmpByteBuffer, 0, ByteLen_Prop, CharBuffer_Prop, CharLen_Prop);
// Need to zero out the _byteLen after we consume these bytes so that we don't keep infinitely hitting this code path
BytePos_Prop = 0; ByteLen_Prop = 0;
}
return CharLen_Prop;
}
ByteLen_Prop += len;
}
else
{
Debug.Assert(BytePos_Prop == 0, "_bytePos can be non zero only when we are trying to _checkPreamble. Are two threads using this StreamReader at the same time?");
ByteLen_Prop = await tmpStream.ReadAsync(tmpByteBuffer, 0, tmpByteBuffer.Length).ConfigureAwait(false);
Debug.Assert(ByteLen_Prop >= 0, "Stream.Read returned a negative number! Bug in stream class.");
if (ByteLen_Prop == 0) // We're at EOF
{
return CharLen_Prop;
}
}
// _isBlocked == whether we read fewer bytes than we asked for.
// Note we must check it here because CompressBuffer or
// DetectEncoding will change _byteLen.
IsBlocked_Prop = (ByteLen_Prop < tmpByteBuffer.Length);
// Check for preamble before detect encoding. This is not to override the
// user supplied Encoding for the one we implicitly detect. The user could
// customize the encoding which we will loose, such as ThrowOnError on UTF8
if (IsPreamble())
{
continue;
}
// If we're supposed to detect the encoding and haven't done so yet,
// do it. Note this may need to be called more than once.
if (DetectEncoding_Prop && ByteLen_Prop >= 2)
{
DetectEncoding();
}
CharLen_Prop += Decoder_Prop.GetChars(tmpByteBuffer, 0, ByteLen_Prop, CharBuffer_Prop, CharLen_Prop);
} while (CharLen_Prop == 0);
return CharLen_Prop;
}
#endregion
// No data, class doesn't need to be serializable.
// Note this class is threadsafe.
private class NullStreamReader : StreamReader
{
// Instantiating Encoding causes unnecessary perf hit.
internal NullStreamReader()
{
Init(Stream.Null);
}
public override Stream BaseStream
{
get { return Stream.Null; }
}
public override Encoding CurrentEncoding
{
get { return Encoding.Unicode; }
}
protected override void Dispose(bool disposing)
{
// Do nothing - this is essentially unclosable.
}
public override int Peek()
{
return -1;
}
public override int Read()
{
return -1;
}
[SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override int Read(char[] buffer, int index, int count)
{
return 0;
}
public override string ReadLine()
{
return null;
}
public override string ReadToEnd()
{
return string.Empty;
}
internal override int ReadBuffer()
{
return 0;
}
}
}
}
| {
"content_hash": "4200f2c0a3b4e6a605fdd31b993e578a",
"timestamp": "",
"source": "github",
"line_count": 1430,
"max_line_length": 212,
"avg_line_length": 39.18041958041958,
"alnum_prop": 0.5009102591561362,
"repo_name": "lggomez/corefx",
"id": "322cec300751e5512b634d1f8e55747dbebada71",
"size": "56232",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "src/System.Runtime.Extensions/src/System/IO/StreamReader.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "1C Enterprise",
"bytes": "903"
},
{
"name": "ASP",
"bytes": "1687"
},
{
"name": "Batchfile",
"bytes": "20828"
},
{
"name": "C",
"bytes": "1078174"
},
{
"name": "C#",
"bytes": "121941860"
},
{
"name": "C++",
"bytes": "616580"
},
{
"name": "CMake",
"bytes": "53110"
},
{
"name": "DIGITAL Command Language",
"bytes": "26402"
},
{
"name": "Groff",
"bytes": "4236"
},
{
"name": "Groovy",
"bytes": "24259"
},
{
"name": "HTML",
"bytes": "653"
},
{
"name": "Makefile",
"bytes": "9085"
},
{
"name": "Objective-C",
"bytes": "9335"
},
{
"name": "OpenEdge ABL",
"bytes": "139178"
},
{
"name": "Perl",
"bytes": "3895"
},
{
"name": "PowerShell",
"bytes": "50639"
},
{
"name": "Python",
"bytes": "1535"
},
{
"name": "Shell",
"bytes": "55023"
},
{
"name": "Visual Basic",
"bytes": "829986"
},
{
"name": "XSLT",
"bytes": "460979"
}
],
"symlink_target": ""
} |
import os
# Function to rename multiple files
def main():
def removeYear():
for filename in os.listdir("pdf"):
print(filename[11:])
os.rename('pdf/' + filename, 'pdf/' + filename[11:])
def organizeLetters():
for filename in os.listdir("pdf"):
i=1
first = filename[0]
#Skip First letter
for letter in filename[1:]:
if letter.isupper() == False:
first += letter
i += 1
continue
elif letter.isupper() == True:
break
last = filename[i]
for letter in filename[i+1:]:
if letter != '.':
last += letter
continue
elif letter == '.':
break
os.rename('pdf/' + filename, 'pdf/' + 'Spring2012' + last + first +'.pdf')
#removeYear()
organizeLetters()
# Driver Code
if __name__ == '__main__':
# Calling main() function
main()
| {
"content_hash": "2f34a26315b74dcd2eff4b8f1f0a1a1c",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 86,
"avg_line_length": 28.512820512820515,
"alnum_prop": 0.4289568345323741,
"repo_name": "uwcartlab/uwcl.preview",
"id": "47d1b97b60abca3f467760ce01a118882fdbcd38",
"size": "1135",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "education/G370/2012SP/rename.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "4282744"
},
{
"name": "HTML",
"bytes": "2193375"
},
{
"name": "Hack",
"bytes": "946"
},
{
"name": "JavaScript",
"bytes": "13145213"
},
{
"name": "PHP",
"bytes": "19117702"
},
{
"name": "Python",
"bytes": "13695"
},
{
"name": "R",
"bytes": "2652"
},
{
"name": "Ruby",
"bytes": "821"
},
{
"name": "Shell",
"bytes": "4608"
},
{
"name": "Smarty",
"bytes": "34428"
}
],
"symlink_target": ""
} |
<?php
$config = [
'components' => [
'request' => [
// !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
'cookieValidationKey' => 'b09yQAZ7HWS-xUQX_hdGJhF8ZfQuYeGU',
],
],
];
if (!YII_ENV_TEST) {
// configuration adjustments for 'dev' environment
$config['bootstrap'][] = 'debug';
$config['modules']['debug'] = [
'class' => 'yii\debug\Module',
];
$config['bootstrap'][] = 'gii';
$config['modules']['gii'] = [
'class' => 'yii\gii\Module',
];
}
return $config;
| {
"content_hash": "75af609a6aeba1cee5690d228a88e4f3",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 112,
"avg_line_length": 25.041666666666668,
"alnum_prop": 0.5341098169717138,
"repo_name": "udamuri/app_muribudiman",
"id": "7a09c6294bfcdc2a72af276e1282118a7d01fa11",
"size": "601",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "frontend/config/main-local.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ApacheConf",
"bytes": "489"
},
{
"name": "Batchfile",
"bytes": "1541"
},
{
"name": "CSS",
"bytes": "478440"
},
{
"name": "CoffeeScript",
"bytes": "47161"
},
{
"name": "HTML",
"bytes": "6057"
},
{
"name": "JavaScript",
"bytes": "674299"
},
{
"name": "PHP",
"bytes": "233705"
},
{
"name": "Shell",
"bytes": "3257"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "130682c77e9db647cbfe73c4c3dfb3b1",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 31,
"avg_line_length": 9.692307692307692,
"alnum_prop": 0.7063492063492064,
"repo_name": "mdoering/backbone",
"id": "1ed15f968c65bc062d4e92be68930cb202cefc15",
"size": "195",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Fabales/Fabaceae/Astracantha/Astracantha delia/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace UCD.Args
{
public class FinishedArgs : EventArgs
{
public FinishedArgs() : base() { }
public FinishedArgs(int count) : base()
{
this.EntryCount = count;
}
public int EntryCount { get; set; }
}
}
| {
"content_hash": "256c4a82c8ff8329edb571295fa83104",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 47,
"avg_line_length": 19.45,
"alnum_prop": 0.6143958868894601,
"repo_name": "Amourspirit/Unicode-To-Sqlite",
"id": "147ce8300504849673957687efa64e6e33171fb5",
"size": "391",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "UCD_LIB/Args/FinishedArgs.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "182221"
},
{
"name": "Shell",
"bytes": "1005"
}
],
"symlink_target": ""
} |
package com.cinchapi.concourse;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.junit.Assert;
import org.junit.Test;
import com.cinchapi.concourse.test.ConcourseIntegrationTest;
import com.cinchapi.concourse.thrift.Operator;
import com.cinchapi.concourse.util.Strings;
import com.cinchapi.concourse.util.TestData;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import com.google.common.collect.Sets;
import com.google.gson.JsonObject;
/**
* Unit tests for the {@code insert()} API methods
*
* @author Jeff Nelson
*/
public class InsertTest extends ConcourseIntegrationTest {
@Test
public void testInsertInteger() {
JsonObject object = new JsonObject();
String key = "foo";
int value = 1;
object.addProperty(key, value);
String json = object.toString();
long record = client.insert(json).iterator().next();
Assert.assertEquals(value, client.get(key, record));
}
@Test
public void testInsertTagStripsBackticks() { // CON-157
JsonObject object = new JsonObject();
String key = "__section__";
String value = "com.cinchapi.concourse.oop.Person";
object.addProperty(key, "`" + value + "`");
String json = object.toString();
long record = client.insert(json).iterator().next();
Assert.assertEquals(value, client.get(key, record));
}
@Test
public void testInsertBoolean() {
JsonObject object = new JsonObject();
String key = "foo";
boolean value = false;
object.addProperty(key, value);
String json = object.toString();
long record = client.insert(json).iterator().next();
Assert.assertEquals(value, client.get(key, record));
}
@Test
public void testInsertBooleanAsTag() {
JsonObject object = new JsonObject();
String key = "foo";
boolean value = false;
object.addProperty(key, "`" + value + "`");
String json = object.toString();
long record = client.insert(json).iterator().next();
Assert.assertEquals(Boolean.toString(value), client.get(key, record));
}
@Test
public void testInsertLink() {
JsonObject object = new JsonObject();
object.addProperty("spouse", Link.to(1));
String json = object.toString();
client.insert(json, 2);
Assert.assertTrue(client.find("spouse", Operator.LINKS_TO, 1).contains(
2L));
}
@Test
public void testInsertResolvableLink() {
client.set("name", "Jeff", 1);
JsonObject object = new JsonObject();
object.addProperty("name", "Ashleah");
object.addProperty("spouse", Link.toWhere("name = Jeff"));
String json = object.toString();
client.insert(json, 2);
Assert.assertTrue(client.find("spouse", Operator.LINKS_TO, 1).contains(
2L));
}
@Test
public void testInsertResolvableLinkIntoNewRecord() {
client.set("name", "Jeff", 1);
JsonObject object = new JsonObject();
object.addProperty("name", "Ashleah");
object.addProperty("spouse", Link.toWhere("name = Jeff"));
String json = object.toString();
long record = client.insert(json).iterator().next();
Assert.assertTrue(client.find("spouse", Operator.LINKS_TO, 1).contains(
record));
}
@SuppressWarnings("unchecked")
@Test
public void testInsertResolvableLinkWithLocalTargets() {
Multimap<String, Object> a = HashMultimap.create();
a.put("foo", 20);
Multimap<String, Object> b = HashMultimap.create();
b.put("bar", Link.toWhere("foo < 50"));
b.put("_id", 1);
client.insert(Lists.newArrayList(a, b));
long record = Iterables.getOnlyElement(client.find("foo = 20"));
Assert.assertEquals(Sets.newHashSet(Iterables.getOnlyElement(client
.find("_id = 1"))), client.find(Strings.format("bar lnks2 {}",
record)));
}
@Test
public void testInsertMultimap() {
Multimap<String, Object> map = HashMultimap.create();
map.put("name", "Jeff Nelson");
map.put("company", "Cinchapi");
map.put("title", "CEO");
map.put("direct_reports", Link.to(1));
map.put("direct_reports", Link.to(2));
long record = client.insert(map);
Assert.assertEquals("Jeff Nelson", client.get("name", record));
Assert.assertEquals("CEO", client.get("title", record));
Assert.assertEquals("Cinchapi", client.get("company", record));
Assert.assertEquals(Sets.newLinkedHashSet(Lists.newArrayList(
Link.to(2), Link.to(1))), client.select("direct_reports",
record));
}
@Test
public void testInsertMap() {
Map<String, Object> map = Maps.newHashMap();
map.put("name", "Jeff Nelson");
map.put("company", "Cinchapi");
map.put("title", "CEO");
map.put("direct_reports", Lists.newArrayList(Link.to(1), Link.to(2)));
long record = client.insert(map);
Assert.assertEquals("Jeff Nelson", client.get("name", record));
Assert.assertEquals("CEO", client.get("title", record));
Assert.assertEquals("Cinchapi", client.get("company", record));
Assert.assertEquals(Sets.newLinkedHashSet(Lists.newArrayList(
Link.to(2), Link.to(1))), client.select("direct_reports",
record));
}
@Test
public void testInsertMultimaps() {
Multimap<String, Object> a = HashMultimap.create();
Multimap<String, Object> b = HashMultimap.create();
Multimap<String, Object> c = HashMultimap.create();
a.put("foo", "bar");
a.put("foo", "baz");
a.put("bar", 1);
a.put("baz", true);
a.put("baz", Link.to(50));
b.put("name", "Jeff Nelson");
b.put("company", "Cinchapi");
b.put("title", "CEO");
b.put("direct_reports", Link.to(2));
b.put("direct_reports", Link.to(1));
c.put("pi", 22 / 7);
List<Multimap<String, Object>> list = Lists.newArrayList();
list.add(a);
list.add(b);
list.add(c);
Set<Long> records = client.insert(list);
long record1 = Iterables.get(records, 0);
long record2 = Iterables.get(records, 1);
long record3 = Iterables.get(records, 2);
Assert.assertEquals("baz", client.get("foo", record1));
Assert.assertEquals("Cinchapi", client.get("company", record2));
Assert.assertEquals(Link.to(2), client.get("direct_reports", record2));
Assert.assertEquals(22 / 7, client.get("pi", record3));
}
@Test
public void testInsertMultimapIntoRecords() {
Multimap<String, Object> map = HashMultimap.create();
map.put("name", "Jeff Nelson");
map.put("company", "Cinchapi");
map.put("title", "CEO");
map.put("direct_reports", Link.to(1));
map.put("direct_reports", Link.to(2));
long record1 = TestData.getLong();
long record2 = TestData.getLong();
client.insert(map, Lists.newArrayList(record1, record2));
Assert.assertEquals(client.select(record1), client.select(record2));
}
@Test
public void testInsertMapIntoRecords() {
Map<String, Object> map = Maps.newHashMap();
map.put("name", "Jeff Nelson");
map.put("company", "Cinchapi");
map.put("title", "CEO");
map.put("direct_reports", Sets.newHashSet(Link.to(1), Link.to(2)));
long record1 = TestData.getLong();
long record2 = TestData.getLong();
client.insert(map, Lists.newArrayList(record1, record2));
Assert.assertEquals(client.select(record1), client.select(record2));
}
@Test
public void testInsertMultimapIntoRecord() {
Multimap<String, Object> map = HashMultimap.create();
map.put("name", "Jeff Nelson");
map.put("company", "Cinchapi");
map.put("title", "CEO");
map.put("direct_reports", Link.to(1));
map.put("direct_reports", Link.to(2));
long record = TestData.getLong();
Assert.assertTrue(client.insert(map, record));
Assert.assertEquals("Jeff Nelson", client.get("name", record));
Assert.assertEquals("CEO", client.get("title", record));
Assert.assertEquals("Cinchapi", client.get("company", record));
Assert.assertEquals(Sets.newLinkedHashSet(Lists.newArrayList(
Link.to(2), Link.to(1))), client.select("direct_reports",
record));
}
@Test
public void testInsertMapIntoRecord() {
Map<String, Object> map = Maps.newHashMap();
map.put("name", "Jeff Nelson");
map.put("company", "Cinchapi");
map.put("title", "CEO");
map.put("direct_reports", Lists.newArrayList(Link.to(1), Link.to(2)));
long record = TestData.getLong();
Assert.assertTrue(client.insert(map, record));
Assert.assertEquals("Jeff Nelson", client.get("name", record));
Assert.assertEquals("CEO", client.get("title", record));
Assert.assertEquals("Cinchapi", client.get("company", record));
Assert.assertEquals(Sets.newLinkedHashSet(Lists.newArrayList(
Link.to(2), Link.to(1))), client.select("direct_reports",
record));
}
@Test
public void testInsertFailsIfSomeDataAlreadyExists() {
Multimap<String, Object> map = HashMultimap.create();
map.put("name", "Jeff Nelson");
map.put("company", "Cinchapi");
map.put("title", "CEO");
map.put("direct_reports", Link.to(1));
map.put("direct_reports", Link.to(2));
long record = TestData.getLong();
client.add("name", "Jeff Nelson", record);
Assert.assertFalse(client.insert(map, record));
}
}
| {
"content_hash": "8ce588c6e55b238cd43ba585eb263371",
"timestamp": "",
"source": "github",
"line_count": 261,
"max_line_length": 79,
"avg_line_length": 38.616858237547895,
"alnum_prop": 0.6088897708105963,
"repo_name": "hcuffy/concourse",
"id": "da67621199035b10a26c9edd77de8bdcdd53dcc2",
"size": "10683",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "concourse-integration-tests/src/test/java/com/cinchapi/concourse/InsertTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "6985"
},
{
"name": "Groff",
"bytes": "47944"
},
{
"name": "Groovy",
"bytes": "85460"
},
{
"name": "HTML",
"bytes": "36688"
},
{
"name": "Java",
"bytes": "3733752"
},
{
"name": "Makefile",
"bytes": "123"
},
{
"name": "PHP",
"bytes": "2510821"
},
{
"name": "Python",
"bytes": "173827"
},
{
"name": "Ruby",
"bytes": "265858"
},
{
"name": "Shell",
"bytes": "116741"
},
{
"name": "Thrift",
"bytes": "125256"
}
],
"symlink_target": ""
} |
<?xml version='1.0' encoding='UTF-8'?>
<build>
<actions>
<hudson.model.CauseAction>
<causes>
<hudson.model.Cause_-UserIdCause/>
</causes>
</hudson.model.CauseAction>
<hudson.plugins.git.util.BuildData plugin="git@2.4.0">
<buildsByBranchName>
<entry>
<string>refs/remotes/origin/master</string>
<hudson.plugins.git.util.Build>
<marked plugin="git-client@1.19.0">
<sha1>e5506eaa3cab8fb6d90dda783403ef86d962e1f9</sha1>
<branches class="list">
<hudson.plugins.git.Branch>
<sha1 reference="../../../sha1"/>
<name>refs/remotes/origin/master</name>
</hudson.plugins.git.Branch>
</branches>
</marked>
<revision reference="../marked"/>
<hudsonBuildNumber>25</hudsonBuildNumber>
</hudson.plugins.git.util.Build>
</entry>
</buildsByBranchName>
<lastBuild reference="../buildsByBranchName/entry/hudson.plugins.git.util.Build"/>
<remoteUrls>
<string>https://github.com/IrishaCh/python_training/</string>
</remoteUrls>
</hudson.plugins.git.util.BuildData>
<hudson.plugins.git.GitTagAction plugin="git@2.4.0">
<tags class="hudson.util.CopyOnWriteMap$Tree">
<entry>
<string>refs/remotes/origin/master</string>
<list/>
</entry>
</tags>
<ws>C:\Users\irina.chegodaeva\.jenkins\jobs\addressbook_tests\workspace</ws>
</hudson.plugins.git.GitTagAction>
<hudson.scm.SCMRevisionState_-None/>
<hudson.tasks.junit.TestResultAction plugin="junit@1.9">
<descriptions class="concurrent-hash-map"/>
<failCount>0</failCount>
<skipCount>0</skipCount>
<totalCount>6</totalCount>
<healthScaleFactor>1.0</healthScaleFactor>
<testData/>
</hudson.tasks.junit.TestResultAction>
</actions>
<queueId>79</queueId>
<timestamp>1444379140149</timestamp>
<startTime>1444379140149</startTime>
<result>SUCCESS</result>
<duration>24918</duration>
<charset>windows-1251</charset>
<keepLog>false</keepLog>
<builtOn></builtOn>
<workspace>C:\Users\irina.chegodaeva\.jenkins\jobs\addressbook_tests\workspace</workspace>
<hudsonVersion>1.632</hudsonVersion>
<scm class="hudson.plugins.git.GitChangeLogParser" plugin="git@2.4.0">
<authorOrCommitter>false</authorOrCommitter>
</scm>
<culprits class="com.google.common.collect.RegularImmutableSortedSet">
<string>irina.chegodaeva</string>
</culprits>
</build> | {
"content_hash": "a64626f94e4f1c855c951ccb2f46ec59",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 92,
"avg_line_length": 37.94117647058823,
"alnum_prop": 0.6414728682170543,
"repo_name": "IrishaCh/python_training",
"id": "f86475d73c8af206ba13d374604f340396d0e7f0",
"size": "2580",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Tasks/Task28/build.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Cucumber",
"bytes": "546"
},
{
"name": "HTML",
"bytes": "60163"
},
{
"name": "Python",
"bytes": "78522"
}
],
"symlink_target": ""
} |
package konoha.main;
import java.io.IOException;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import jline.console.ConsoleReader;
import jline.console.completer.CandidateListCompletionHandler;
import jline.console.completer.Completer;
import konoha.message.Message;
import konoha.script.EmptyResult;
import konoha.script.ScriptContext;
import konoha.script.ScriptContextError;
import konoha.script.ScriptRuntimeException;
import nez.main.CommandContext;
import nez.util.StringUtils;
public class Main {
public final static void main(String[] args) {
try {
CommandContext c = new CommandContext();
c.parseCommandOption(args, false/* nezCommand */);
exec(c);
} catch (IOException e) {
ConsoleUtils.println(e);
System.exit(1);
}
}
public static ScriptContextError expected = ScriptContextError.NoError;
public static void exec(CommandContext config) throws IOException {
if (config.isUnspecifiedGrammarFilePath()) {
config.setGrammarFilePath("konoha.nez");
}
ScriptContext sc = new ScriptContext(config.newParser());
if (config.hasInput()) {
try {
while (config.hasInput()) {
sc.eval(config.nextInput());
}
} catch (AssertionError e) {
e.printStackTrace();
sc.found(ScriptContextError.AssertonError);
} catch (RuntimeException e) {
e.printStackTrace();
sc.found(ScriptContextError.RuntimeError);
}
if (sc.getError() != expected) {
ConsoleUtils.exit(1, "expected " + expected + " but " + sc.getError());
}
} else {
show(config);
shell(sc);
}
}
public final static String ProgName = "Konoha";
public final static String CodeName = "yokohama";
public final static int MajorVersion = 4;
public final static int MinerVersion = 0;
public final static int PatchLevel = Revision.REV;
public final static String Version = "" + MajorVersion + "." + MinerVersion + "-" + PatchLevel;
public final static String Copyright = "Copyright (c) 2008-2015, Konoha project authors";
public final static String License = "BSD-License Open Source";
private static void show(CommandContext config) {
ConsoleUtils.bold();
ConsoleUtils.println("Konoha " + Version + " U(" + config.newGrammar().getDesc() + ") on Nez " + nez.Version.Version);
ConsoleUtils.end();
ConsoleUtils.println(Copyright);
ConsoleUtils.println("Copyright (c) 2015, Kimio Kuramitsu, Yokohama National University");
ConsoleUtils.begin(37);
ConsoleUtils.println(Message.Hint);
ConsoleUtils.end();
}
public static void shell(ScriptContext sc) throws IOException {
sc.setShellMode(true);
ConsoleReader console = new ConsoleReader();
console.setHistoryEnabled(true);
console.setExpandEvents(false);
int linenum = 1;
String command = null;
while ((command = readLine(console)) != null) {
if (command.trim().equals("")) {
continue;
}
if (hasUTF8(command)) {
ConsoleUtils.begin(31);
ConsoleUtils.println("(<stdio>:" + linenum + ") " + Message.DetectedUTF8);
ConsoleUtils.end();
command = filterUTF8(command);
}
try {
ConsoleUtils.begin(32);
Object result = sc.eval("<stdio>", linenum, command);
ConsoleUtils.end();
if (!(result instanceof EmptyResult)) {
ConsoleUtils.begin(37);
ConsoleUtils.println("<<<");
ConsoleUtils.end();
ConsoleUtils.bold();
if (result instanceof String) {
result = StringUtils.quoteString('"', (String) result, '"');
}
ConsoleUtils.println(result);
ConsoleUtils.end();
}
} catch (ScriptRuntimeException e) {
ConsoleUtils.begin(31);
ConsoleUtils.println(e);
e.printStackTrace();
ConsoleUtils.end();
} catch (RuntimeException e) {
ConsoleUtils.begin(31);
ConsoleUtils.println(e);
e.printStackTrace();
ConsoleUtils.end();
}
linenum += (command.split("\n").length);
}
}
public final static String KonohaVersion = "4.0";
private static String readLine(ConsoleReader console) throws IOException {
ConsoleUtils.begin(31);
ConsoleUtils.println(">>>");
ConsoleUtils.end();
List<Completer> completors = new LinkedList<Completer>();
// completors.add(new AnsiStringsCompleter("\u001B[1mfoo\u001B[0m",
// "bar", "\u001B[32mbaz\u001B[0m"));
CandidateListCompletionHandler handler = new CandidateListCompletionHandler();
handler.setStripAnsi(true);
console.setCompletionHandler(handler);
for (Completer c : completors) {
console.addCompleter(c);
}
// History h = console.getHistory();
// ("hoge\rhoge");
StringBuilder sb = new StringBuilder();
while (true) {
String line = console.readLine();
if (line == null) {
return null;
}
if (line.equals("")) {
return sb.toString();
}
sb.append(line);
sb.append("\n");
}
// h = console.getHistory();
}
private static boolean hasUTF8(String command) {
boolean skip = false;
for (int i = 0; i < command.length(); i++) {
char c = command.charAt(i);
if (c == '"') {
skip = !skip;
continue;
}
if (c < 128 || skip) {
continue;
}
return true;
}
return false;
}
static HashMap<Character, Character> charMap = null;
static void initCharMap() {
if (charMap == null) {
charMap = new HashMap<>();
charMap.put(' ', ' ');
charMap.put('(', '(');
charMap.put(')', ')');
charMap.put('[', '[');
charMap.put(']', ']');
charMap.put('{', '{');
charMap.put('}', '}');
charMap.put('”', '"');
charMap.put('’', '\'');
charMap.put('<', '<');
charMap.put('>', '>');
charMap.put('+', '+');
charMap.put('ー', '-');
charMap.put('*', '*');
charMap.put('/', '/');
charMap.put('✕', '*');
charMap.put('÷', '/');
charMap.put('=', '=');
charMap.put('%', '%');
charMap.put('?', '?');
charMap.put(':', ':');
charMap.put('&', '&');
charMap.put('|', '|');
charMap.put('!', '!');
charMap.put('、', ',');
charMap.put(';', ';');
charMap.put('。', '.');
for (char c = 'A'; c <= 'Z'; c++) {
charMap.put((char) ('A' + (c - 'A')), c);
}
for (char c = 'a'; c <= 'z'; c++) {
charMap.put((char) ('a' + (c - 'a')), c);
}
for (char c = '0'; c <= '9'; c++) {
charMap.put((char) ('0' + (c - '0')), c);
}
for (char c = '1'; c <= '9'; c++) {
charMap.put((char) ('一' + (c - '0')), c);
}
}
}
private static String filterUTF8(String command) {
initCharMap();
StringBuilder sb = new StringBuilder(command.length());
boolean skip = false;
for (int i = 0; i < command.length(); i++) {
char c = command.charAt(i);
if (c < 128 || skip) {
if (c == '"') {
skip = !skip;
}
sb.append(c);
continue;
}
Character mapped = charMap.get(c);
if (mapped != null) {
sb.append(mapped);
} else {
sb.append(c);
}
}
return sb.toString();
}
/****
* public static void usage() { System.out.println("Usage: java " +
* Example.class.getName() +
* " [none/simple/files/dictionary [trigger mask]]");
* System.out.println(" none - no completors");
* System.out.println(" simple - a simple completor that comples " +
* "\"foo\", \"bar\", and \"baz\"");
* System.out.println(" files - a completor that comples " + "file names");
* System.out.println(" classes - a completor that comples " +
* "java class names"); System.out.println(
* " trigger - a special word which causes it to assume " +
* "the next line is a password");
* System.out.println(" mask - is the character to print in place of " +
* "the actual password character");
* System.out.println(" color - colored prompt and feedback");
* System.out.println("\n E.g - java Example simple su '*'\n" +
* "will use the simple compleator with 'su' triggering\n" +
* "the use of '*' as a password mask."); }
*
* public static void main2(String[] args) throws IOException { try {
* Character mask = null; String trigger = null; boolean color = false;
*
* ConsoleReader reader = new ConsoleReader();
*
* reader.setPrompt("prompt> ");
*
* if ((args == null) || (args.length == 0)) { usage();
*
* return; }
*
* List<Completer> completors = new LinkedList<Completer>();
*
* if (args.length > 0) { if (args[0].equals("none")) { } else if
* (args[0].equals("files")) { completors.add(new FileNameCompleter()); }
* else if (args[0].equals("simple")) { completors.add(new
* StringsCompleter("foo", "bar", "baz")); } else if
* (args[0].equals("color")) { color = true;
* reader.setPrompt("\u001B[42mfoo\u001B[0m@bar\u001B[32m@baz\u001B[0m> ");
* completors.add(new AnsiStringsCompleter("\u001B[1mfoo\u001B[0m", "bar",
* "\u001B[32mbaz\u001B[0m")); CandidateListCompletionHandler handler = new
* CandidateListCompletionHandler(); handler.setStripAnsi(true);
* reader.setCompletionHandler(handler); } else { usage();
*
* return; } }
*
* if (args.length == 3) { mask = args[2].charAt(0); trigger = args[1]; }
*
*
* String line; PrintWriter out = new PrintWriter(reader.getOutput());
*
* while ((line = reader.readLine()) != null) { if (color) {
* out.println("\u001B[33m======>\u001B[0m\"" + line + "\"");
*
* } else { out.println("======>\"" + line + "\""); } out.flush();
*
* // If we input the special word then we will mask // the next line. if
* ((trigger != null) && (line.compareTo(trigger) == 0)) { line =
* reader.readLine("password> ", mask); } if (line.equalsIgnoreCase("quit")
* || line.equalsIgnoreCase("exit")) { break; } if
* (line.equalsIgnoreCase("cls")) { reader.clearScreen(); } } } catch
* (Throwable t) { t.printStackTrace(); } }
***/
}
| {
"content_hash": "10c9287c0f8f9b75ead98d60555c623d",
"timestamp": "",
"source": "github",
"line_count": 308,
"max_line_length": 120,
"avg_line_length": 31.0974025974026,
"alnum_prop": 0.6212152850281896,
"repo_name": "nez-peg/konoha",
"id": "29858d03a352f8e854465cb4a2475cafc64920de",
"size": "9637",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/konoha/main/Main.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Java",
"bytes": "310415"
},
{
"name": "Python",
"bytes": "44"
},
{
"name": "Shell",
"bytes": "487"
}
],
"symlink_target": ""
} |
/* eslint arrow-body-style: 0 */
import gulp from 'gulp';
import _ from 'lodash';
import babel from 'gulp-babel';
import clean from 'gulp-clean';
import concat from 'gulp-concat';
import cssmin from 'gulp-cssmin';
import { createWindowsInstaller as electronInstaller } from 'electron-winstaller';
import header from 'gulp-header';
import less from 'gulp-less';
import packager from 'electron-packager';
import rebuild from './vendor/rebuild';
import replace from 'gulp-replace';
import runSequence from 'run-sequence';
import uglify from 'gulp-uglify';
import { spawn, exec } from 'child_process';
const paths = {
internalScripts: ['src/**/*.js'],
utilityScripts: ['node_modules/jquery/dist/jquery.min.js',
'node_modules/materialize-css/dist/js/materialize.min.js',
'node_modules/materialize-css/extras/noUiSlider/nouislider.min.js'],
html: 'src/public_html/**/*.html',
less: 'src/assets/less/**/*.less',
fonts: ['node_modules/materialize-css/dist/font/**/*',
'!node_modules/materialize-css/dist/font/material-design-icons/*',
'node_modules/material-design-icons-iconfont/dist/fonts/**/*'],
images: ['src/assets/icons/**/*', 'src/assets/img/**/*'],
locales: ['src/_locales/*.json'],
};
const packageJSON = require('./package.json');
let version = packageJSON.dependencies['electron-prebuilt'];
if (version.substr(0, 1) !== '0' && version.substr(0, 1) !== '1') {
version = version.substr(1);
}
const defaultPackageConf = {
'app-bundle-id': packageJSON.name,
'app-category-type': 'public.app-category.music',
'app-copyright': `Copyright © ${(new Date()).getFullYear()} ${packageJSON.author.name}, All rights reserved.`, // eslint-disable-line
'app-version': packageJSON.version,
arch: 'all',
'build-version': packageJSON.version,
dir: '.',
icon: './build/assets/img/main',
ignore: (path) => {
const tests = [
// Ignore git directory
() => /^\/\.git\/.*/g,
// Ignore electron-prebuilt
() => /^\/node_modules\/electron-prebuilt\//g,
// Ignore debug files
() => /^\/node_modules\/.*\.pdb/g,
// Ignore native module obj files
() => /^\/node_modules\/.*\.obj/g,
// Ignore symlinks in the bin directory
() => /^\/node_modules\/.bin/g,
// Ignore root dev FileDescription
() => /^\/(vendor|dist|sig|docs|src|test|.cert.pfx|.editorconfig|.eslintignore|.eslintrc|.gitignore|.travis.yml|appveyor.yml|circle.yml|CONTRIBUTING.md|Gruntfile.js|gulpfile.js|ISSUE_TEMPLATE.md|LICENSE|README.md)(\/|$)/g, // eslint-disable-line
];
for (let i = 0; i < tests.length; i++) {
if (tests[i]().test(path)) {
return true;
}
}
return false;
},
name: packageJSON.productName,
out: './dist/',
overwrite: true,
platform: 'all',
prune: true,
version,
'version-string': {
CompanyName: packageJSON.author.name,
FileDescription: packageJSON.productName,
ProductName: packageJSON.productName,
InternalName: packageJSON.productName,
},
};
const winstallerConfig = {
appDirectory: `dist/${packageJSON.productName}-win32-ia32`,
outputDirectory: 'dist/installers/win32',
authors: packageJSON.author.name,
exe: `${packageJSON.productName}.exe`,
description: packageJSON.productName,
title: packageJSON.productName,
owners: packageJSON.author.name,
name: 'GPMDP_3',
noMsi: true,
certificateFile: '.cert.pfx',
certificatePassword: process.env.SIGN_CERT_PASS,
// DEV: When in master we should change this to point to github raw url
iconUrl: 'https://www.samuelattard.com/img/gpmdp_setup.ico',
setupIcon: 'build/assets/img/main.ico',
loadingGif: 'build/assets/img/installing.gif',
remoteReleases: 'https://github.com/MarshallOfSound/Google-Play-Music-Desktop-Player-UNOFFICIAL-',
};
const cleanGlob = (glob) => {
return () => {
return gulp.src(glob, { read: false })
.pipe(clean({ force: true }));
};
};
gulp.task('clean', cleanGlob(['./build', './dist']));
gulp.task('clean-dist-win', cleanGlob(`./dist/${packageJSON.productName}-win32-ia32`));
gulp.task('clean-dist-darwin', cleanGlob(`./dist/${packageJSON.productName}-darwin-ia32`));
gulp.task('clean-dist-linux-32', cleanGlob(`./dist/${packageJSON.productName}-linux-ia32`));
gulp.task('clean-dist-linux-64', cleanGlob(`./dist/${packageJSON.productName}-linux-x64`));
gulp.task('clean-material', cleanGlob('./build/assets/material'));
gulp.task('clean-utility', cleanGlob('./build/assets/util'));
gulp.task('clean-html', cleanGlob('./build/public_html'));
gulp.task('clean-internal', cleanGlob(['./build/*.js', './build/**/*.js', '!./build/assets/**/*']));
gulp.task('clean-fonts', cleanGlob('./build/assets/fonts'));
gulp.task('clean-less', cleanGlob('./build/assets/css'));
gulp.task('clean-images', cleanGlob('./build/assets/img'));
gulp.task('clean-locales', cleanGlob('./build/_locales/*.json'));
gulp.task('materialize-js', ['clean-material'], () => {
return gulp.src('node_modules/materialize-css/dist/js/materialize.min.js')
.pipe(gulp.dest('./build/assets/material'));
});
gulp.task('utility-js', ['clean-utility'], () => {
return gulp.src(paths.utilityScripts)
.pipe(gulp.dest('./build/assets/util'));
});
gulp.task('html', ['clean-html'], () => {
return gulp.src(paths.html)
.pipe(gulp.dest('./build/public_html'));
});
gulp.task('transpile', ['clean-internal'], () => {
return gulp.src(paths.internalScripts)
.pipe(babel())
.on('error', (err) => { console.error(err); }) // eslint-disable-line
.pipe(replace(/process\.env\.(.+);/gi, (envCall, envKey) => {
return `'${process.env[envKey]}'`;
}))
.pipe(gulp.dest('./build/'));
});
gulp.task('locales', ['clean-locales'], () => {
return gulp.src(paths.locales)
.pipe(gulp.dest('./build/_locales'));
});
gulp.task('fonts', ['clean-fonts'], () => {
return gulp.src(paths.fonts)
.pipe(gulp.dest('./build/assets/fonts'));
});
gulp.task('less', ['clean-less'], () => {
return gulp.src(paths.less)
.pipe(less())
.on('error', (err) => { console.error(err); }) // eslint-disable-line
.pipe(cssmin())
.pipe(concat('core.css'))
.pipe(gulp.dest('./build/assets/css'));
});
// Copy all static images
gulp.task('images', ['clean-images'], () => {
return gulp.src(paths.images)
.pipe(gulp.dest('./build/assets/img/'));
});
gulp.task('build-release', ['build'], () => {
return gulp.src('./build/**/*.js')
.pipe(uglify())
.pipe(header(
`/*!
${packageJSON.productName}
Version: v${packageJSON.version}
API Version: v${packageJSON.apiVersion}
Compiled: ${new Date().toUTCString()}
Copyright (C) ${(new Date()).getFullYear()} ${packageJSON.author.name}
This software may be modified and distributed under the terms of the MIT license.
*/\n`
))
.pipe(gulp.dest('./build'));
});
// Rerun the task when a file changes
gulp.task('watch', ['build'], () => {
gulp.watch(paths.internalScripts, ['transpile']);
gulp.watch(paths.html, ['html']);
gulp.watch(paths.images, ['images']);
gulp.watch(paths.less, ['less']);
gulp.watch(paths.locales, ['locales']);
});
gulp.task('package:win', ['clean-dist-win', 'build-release'], (done) => {
console.log('Rebuilding ll-keyboard-hook-win'); // eslint-disable-line
rebuild('rebuild_ia32.bat')
.then(() => {
packager(_.extend({}, defaultPackageConf, { platform: 'win32', arch: 'ia32' }), () => {
setTimeout(() => {
exec(`vendor\\signtool sign /f ".cert.pfx" /p ${process.env.SIGN_CERT_PASS} /fd sha1 /tr "http://timestamp.geotrust.com/tsa" /v /as "dist/${packageJSON.productName}-win32-ia32/${packageJSON.productName}.exe"`, {}, () => {
exec(`vendor\\signtool sign /f ".cert.pfx" /p ${process.env.SIGN_CERT_PASS} /fd sha256 /tr "http://timestamp.geotrust.com/tsa" /v /as "dist/${packageJSON.productName}-win32-ia32/${packageJSON.productName}.exe"`, {}, () => {
done();
});
});
}, 1000);
});
});
});
gulp.task('make:win', ['package:win'], (done) => {
electronInstaller(winstallerConfig)
.then(() => {
exec(`vendor\\signtool sign /f ".cert.pfx" /p ${process.env.SIGN_CERT_PASS} /fd sha1 /tr "http://timestamp.geotrust.com/tsa" /v /as "dist/win32/${packageJSON.productName}Setup.exe"`, {}, () => {
exec(`vendor\\signtool sign /f ".cert.pfx" /p ${process.env.SIGN_CERT_PASS} /fd sha256 /tr "http://timestamp.geotrust.com/tsa" /v /as "dist/win32/${packageJSON.productName}Setup.exe"`, {}, () => {
done();
});
});
});
});
gulp.task('package:darwin', ['clean-dist-darwin', 'build-release'], (done) => {
rebuild('./rebuild_null.sh')
.then(() => {
packager(_.extend({}, defaultPackageConf, { platform: 'darwin', 'osx-sign': { identity: 'Developer ID Application: Samuel Attard (S7WPQ45ZU2)' } }), done); // eslint-disable-line
});
});
gulp.task('make:darwin', ['package:darwin'], (done) => {
const pathEscapedName = packageJSON.productName.replace(/ /gi, ' ');
const child = spawn('zip', ['-r', '-y', `${pathEscapedName}.zip`, `${pathEscapedName}.app`],
{
cwd: `./dist/${packageJSON.productName}-darwin-x64`,
});
console.log(`Zipping "${packageJSON.productName}.app"`); // eslint-disable-line
child.stdout.on('data', (data) => { process.stdout.write(data.toString()); });
child.stderr.on('data', (data) => {
process.stdout.write(data.toString());
});
child.on('close', (code) => {
console.log('Finished zipping with code ' + code); // eslint-disable-line
done();
});
});
gulp.task('package:linux:32', ['clean-dist-linux-32', 'build-release'], (done) => {
rebuild('./rebuild_ia32.sh')
.then(() => {
packager(_.extend({}, defaultPackageConf, { platform: 'linux', arch: 'ia32' }), done);
});
});
gulp.task('package:linux:64', ['clean-dist-linux-64', 'build-release'], (done) => {
rebuild('./rebuild.sh')
.then(() => {
packager(_.extend({}, defaultPackageConf, { platform: 'linux', arch: 'x64' }), done);
});
});
gulp.task('package:linux', (done) => {
runSequence('package:linux:32', 'package:linux:64', done);
});
const generateGulpLinuxDistroTask = (prefix, name, arch) => {
gulp.task(`${prefix}:linux:${arch}`, [`package:linux:${arch}`], (done) => {
const tool = require(`electron-installer-${name}`);
const defaults = {
bin: packageJSON.productName,
dest: `dist/installers/${name}`,
depends: ['libappindicator1'],
maintainer: `${packageJSON.author.name} <${packageJSON.author.email}>`,
homepage: packageJSON.homepage,
icon: 'build/assets/img/main.png',
categories: ['AudioVideo', 'Audio'],
};
let pkgArch = 'i386';
if (arch === '64') {
pkgArch = (prefix === 'rpm' ? 'x86_64' : 'amd64');
}
tool(_.extend({}, defaults, {
src: `dist/${packageJSON.productName}-linux-${arch === '32' ? 'ia32' : 'x64'}`,
arch: pkgArch,
}), (err) => {
console.log(`${arch}bit ${prefix} package built`); // eslint-disable-line
if (err) return done(err);
done();
});
});
};
generateGulpLinuxDistroTask('rpm', 'redhat', '32');
generateGulpLinuxDistroTask('rpm', 'redhat', '64');
generateGulpLinuxDistroTask('deb', 'debian', '32');
generateGulpLinuxDistroTask('deb', 'debian', '64');
gulp.task('rpm:linux', (done) => {
runSequence('rpm:linux:32', 'rpm:linux:64', done);
});
gulp.task('deb:linux', (done) => {
runSequence('deb:linux:32', 'deb:linux:64', done);
});
const zipTask = (makeName, deps, cwd, what) => {
gulp.task(`make:${makeName}`, deps, (done) => {
const child = spawn('zip', ['-r', '-y', 'installers.zip', '.'], { cwd });
console.log(`Zipping ${what}`); // eslint-disable-line
// spit stdout to screen
child.stdout.on('data', (data) => { process.stdout.write(data.toString()); });
// Send stderr to the main console
child.stderr.on('data', (data) => {
process.stdout.write(data.toString());
});
child.on('close', (code) => {
console.log(`Finished zipping ${what} with code: ${code}`); // eslint-disable-line
done();
});
});
};
gulp.task('make:linux', (done) => {
runSequence('deb:linux', 'rpm:linux', 'make:linux:both', done);
});
zipTask('linux:both', [], './dist/installers', 'all the Linux Installers');
zipTask('linux:deb', ['deb:linux'], './dist/installers/debian', 'the Debian Packages');
zipTask('linux:rpm', ['rpm:linux'], './dist/installers/redhat', 'the Redhat (Fedora) Packages');
// The default task (called when you run `gulp` from cli)
gulp.task('default', ['watch', 'transpile', 'images']);
gulp.task('build', ['materialize-js', 'utility-js', 'transpile', 'images', 'less',
'fonts', 'html', 'locales']);
gulp.task('package', ['package:win', 'package:darwin', 'package:linux']);
| {
"content_hash": "e8e4f5fc333f7990228a45a35cc56a6c",
"timestamp": "",
"source": "github",
"line_count": 350,
"max_line_length": 251,
"avg_line_length": 36.677142857142854,
"alnum_prop": 0.6232764664641272,
"repo_name": "MCManuelLP/Google-Play-Music-Desktop-Player-UNOFFICIAL-",
"id": "d5a9b15444357d0a4d04f422df6a6ce2893e3d73",
"size": "12838",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "gulpfile.babel.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "10665"
},
{
"name": "HTML",
"bytes": "21634"
},
{
"name": "JavaScript",
"bytes": "175116"
},
{
"name": "Shell",
"bytes": "738"
}
],
"symlink_target": ""
} |
/*
* IrNET protocol module : Synchronous PPP over an IrDA socket.
*
* Jean II - HPL `00 - <jt@hpl.hp.com>
*
* This file implement the IRDA interface of IrNET.
* Basically, we sit on top of IrTTP. We set up IrTTP, IrIAS properly,
* and exchange frames with IrTTP.
*/
#include "irnet_irda.h" /* Private header */
/************************* CONTROL CHANNEL *************************/
/*
* When ppp is not active, /dev/irnet act as a control channel.
* Writing allow to set up the IrDA destination of the IrNET channel,
* and any application may be read events happening on IrNET...
*/
/*------------------------------------------------------------------*/
/*
* Post an event to the control channel...
* Put the event in the log, and then wait all process blocked on read
* so they can read the log...
*/
static void
irnet_post_event(irnet_socket * ap,
irnet_event event,
__u32 saddr,
__u32 daddr,
char * name,
__u16 hints)
{
int index; /* In the log */
DENTER(CTRL_TRACE, "(ap=0x%p, event=%d, daddr=%08x, name=``%s'')\n",
ap, event, daddr, name);
/* Protect this section via spinlock.
* Note : as we are the only event producer, we only need to exclude
* ourself when touching the log, which is nice and easy.
*/
spin_lock_bh(&irnet_events.spinlock);
/* Copy the event in the log */
index = irnet_events.index;
irnet_events.log[index].event = event;
irnet_events.log[index].daddr = daddr;
irnet_events.log[index].saddr = saddr;
/* Try to copy IrDA nickname */
if(name)
strcpy(irnet_events.log[index].name, name);
else
irnet_events.log[index].name[0] = '\0';
/* Copy hints */
irnet_events.log[index].hints.word = hints;
/* Try to get ppp unit number */
if((ap != (irnet_socket *) NULL) && (ap->ppp_open))
irnet_events.log[index].unit = ppp_unit_number(&ap->chan);
else
irnet_events.log[index].unit = -1;
/* Increment the index
* Note that we increment the index only after the event is written,
* to make sure that the readers don't get garbage... */
irnet_events.index = (index + 1) % IRNET_MAX_EVENTS;
DEBUG(CTRL_INFO, "New event index is %d\n", irnet_events.index);
/* Spin lock end */
spin_unlock_bh(&irnet_events.spinlock);
/* Now : wake up everybody waiting for events... */
wake_up_interruptible_all(&irnet_events.rwait);
DEXIT(CTRL_TRACE, "\n");
}
/************************* IRDA SUBROUTINES *************************/
/*
* These are a bunch of subroutines called from other functions
* down there, mostly common code or to improve readability...
*
* Note : we duplicate quite heavily some routines of af_irda.c,
* because our input structure (self) is quite different
* (struct irnet instead of struct irda_sock), which make sharing
* the same code impossible (at least, without templates).
*/
/*------------------------------------------------------------------*/
/*
* Function irda_open_tsap (self)
*
* Open local Transport Service Access Point (TSAP)
*
* Create a IrTTP instance for us and set all the IrTTP callbacks.
*/
static inline int
irnet_open_tsap(irnet_socket * self)
{
notify_t notify; /* Callback structure */
DENTER(IRDA_SR_TRACE, "(self=0x%p)\n", self);
DABORT(self->tsap != NULL, -EBUSY, IRDA_SR_ERROR, "Already busy !\n");
/* Initialize IrTTP callbacks to be used by the IrDA stack */
irda_notify_init(¬ify);
notify.connect_confirm = irnet_connect_confirm;
notify.connect_indication = irnet_connect_indication;
notify.disconnect_indication = irnet_disconnect_indication;
notify.data_indication = irnet_data_indication;
/*notify.udata_indication = NULL;*/
notify.flow_indication = irnet_flow_indication;
notify.status_indication = irnet_status_indication;
notify.instance = self;
strlcpy(notify.name, IRNET_NOTIFY_NAME, sizeof(notify.name));
/* Open an IrTTP instance */
self->tsap = irttp_open_tsap(LSAP_ANY, DEFAULT_INITIAL_CREDIT,
¬ify);
DABORT(self->tsap == NULL, -ENOMEM,
IRDA_SR_ERROR, "Unable to allocate TSAP !\n");
/* Remember which TSAP selector we actually got */
self->stsap_sel = self->tsap->stsap_sel;
DEXIT(IRDA_SR_TRACE, " - tsap=0x%p, sel=0x%X\n",
self->tsap, self->stsap_sel);
return 0;
}
/*------------------------------------------------------------------*/
/*
* Function irnet_ias_to_tsap (self, result, value)
*
* Examine an IAS object and extract TSAP
*
* We do an IAP query to find the TSAP associated with the IrNET service.
* When IrIAP pass us the result of the query, this function look at
* the return values to check for failures and extract the TSAP if
* possible.
* Also deallocate value
* The failure is in self->errno
* Return TSAP or -1
*/
static inline __u8
irnet_ias_to_tsap(irnet_socket * self,
int result,
struct ias_value * value)
{
__u8 dtsap_sel = 0; /* TSAP we are looking for */
DENTER(IRDA_SR_TRACE, "(self=0x%p)\n", self);
/* By default, no error */
self->errno = 0;
/* Check if request succeeded */
switch(result)
{
/* Standard errors : service not available */
case IAS_CLASS_UNKNOWN:
case IAS_ATTRIB_UNKNOWN:
DEBUG(IRDA_SR_INFO, "IAS object doesn't exist ! (%d)\n", result);
self->errno = -EADDRNOTAVAIL;
break;
/* Other errors, most likely IrDA stack failure */
default :
DEBUG(IRDA_SR_INFO, "IAS query failed ! (%d)\n", result);
self->errno = -EHOSTUNREACH;
break;
/* Success : we got what we wanted */
case IAS_SUCCESS:
break;
}
/* Check what was returned to us */
if(value != NULL)
{
/* What type of argument have we got ? */
switch(value->type)
{
case IAS_INTEGER:
DEBUG(IRDA_SR_INFO, "result=%d\n", value->t.integer);
if(value->t.integer != -1)
/* Get the remote TSAP selector */
dtsap_sel = value->t.integer;
else
self->errno = -EADDRNOTAVAIL;
break;
default:
self->errno = -EADDRNOTAVAIL;
DERROR(IRDA_SR_ERROR, "bad type ! (0x%X)\n", value->type);
break;
}
/* Cleanup */
irias_delete_value(value);
}
else /* value == NULL */
{
/* Nothing returned to us - usually result != SUCCESS */
if(!(self->errno))
{
DERROR(IRDA_SR_ERROR,
"IrDA bug : result == SUCCESS && value == NULL\n");
self->errno = -EHOSTUNREACH;
}
}
DEXIT(IRDA_SR_TRACE, "\n");
/* Return the TSAP */
return(dtsap_sel);
}
/*------------------------------------------------------------------*/
/*
* Function irnet_find_lsap_sel (self)
*
* Try to lookup LSAP selector in remote LM-IAS
*
* Basically, we start a IAP query, and then go to sleep. When the query
* return, irnet_getvalue_confirm will wake us up, and we can examine the
* result of the query...
* Note that in some case, the query fail even before we go to sleep,
* creating some races...
*/
static inline int
irnet_find_lsap_sel(irnet_socket * self)
{
DENTER(IRDA_SR_TRACE, "(self=0x%p)\n", self);
/* This should not happen */
DABORT(self->iriap, -EBUSY, IRDA_SR_ERROR, "busy with a previous query.\n");
/* Create an IAP instance, will be closed in irnet_getvalue_confirm() */
self->iriap = iriap_open(LSAP_ANY, IAS_CLIENT, self,
irnet_getvalue_confirm);
/* Treat unexpected signals as disconnect */
self->errno = -EHOSTUNREACH;
/* Query remote LM-IAS */
iriap_getvaluebyclass_request(self->iriap, self->rsaddr, self->daddr,
IRNET_SERVICE_NAME, IRNET_IAS_VALUE);
/* The above request is non-blocking.
* After a while, IrDA will call us back in irnet_getvalue_confirm()
* We will then call irnet_ias_to_tsap() and finish the
* connection procedure */
DEXIT(IRDA_SR_TRACE, "\n");
return 0;
}
/*------------------------------------------------------------------*/
/*
* Function irnet_connect_tsap (self)
*
* Initialise the TTP socket and initiate TTP connection
*
*/
static inline int
irnet_connect_tsap(irnet_socket * self)
{
int err;
DENTER(IRDA_SR_TRACE, "(self=0x%p)\n", self);
/* Open a local TSAP (an IrTTP instance) */
err = irnet_open_tsap(self);
if(err != 0)
{
clear_bit(0, &self->ttp_connect);
DERROR(IRDA_SR_ERROR, "connect aborted!\n");
return(err);
}
/* Connect to remote device */
err = irttp_connect_request(self->tsap, self->dtsap_sel,
self->rsaddr, self->daddr, NULL,
self->max_sdu_size_rx, NULL);
if(err != 0)
{
clear_bit(0, &self->ttp_connect);
DERROR(IRDA_SR_ERROR, "connect aborted!\n");
return(err);
}
/* The above call is non-blocking.
* After a while, the IrDA stack will either call us back in
* irnet_connect_confirm() or irnet_disconnect_indication()
* See you there ;-) */
DEXIT(IRDA_SR_TRACE, "\n");
return(err);
}
/*------------------------------------------------------------------*/
/*
* Function irnet_discover_next_daddr (self)
*
* Query the IrNET TSAP of the next device in the log.
*
* Used in the TSAP discovery procedure.
*/
static inline int
irnet_discover_next_daddr(irnet_socket * self)
{
/* Close the last instance of IrIAP, and open a new one.
* We can't reuse the IrIAP instance in the IrIAP callback */
if(self->iriap)
{
iriap_close(self->iriap);
self->iriap = NULL;
}
/* Create a new IAP instance */
self->iriap = iriap_open(LSAP_ANY, IAS_CLIENT, self,
irnet_discovervalue_confirm);
if(self->iriap == NULL)
return -ENOMEM;
/* Next discovery - before the call to avoid races */
self->disco_index++;
/* Check if we have one more address to try */
if(self->disco_index < self->disco_number)
{
/* Query remote LM-IAS */
iriap_getvaluebyclass_request(self->iriap,
self->discoveries[self->disco_index].saddr,
self->discoveries[self->disco_index].daddr,
IRNET_SERVICE_NAME, IRNET_IAS_VALUE);
/* The above request is non-blocking.
* After a while, IrDA will call us back in irnet_discovervalue_confirm()
* We will then call irnet_ias_to_tsap() and come back here again... */
return(0);
}
else
return(1);
}
/*------------------------------------------------------------------*/
/*
* Function irnet_discover_daddr_and_lsap_sel (self)
*
* This try to find a device with the requested service.
*
* Initiate a TSAP discovery procedure.
* It basically look into the discovery log. For each address in the list,
* it queries the LM-IAS of the device to find if this device offer
* the requested service.
* If there is more than one node supporting the service, we complain
* to the user (it should move devices around).
* If we find one node which have the requested TSAP, we connect to it.
*
* This function just start the whole procedure. It request the discovery
* log and submit the first IAS query.
* The bulk of the job is handled in irnet_discovervalue_confirm()
*
* Note : this procedure fails if there is more than one device in range
* on the same dongle, because IrLMP doesn't disconnect the LAP when the
* last LSAP is closed. Moreover, we would need to wait the LAP
* disconnection...
*/
static inline int
irnet_discover_daddr_and_lsap_sel(irnet_socket * self)
{
int ret;
DENTER(IRDA_SR_TRACE, "(self=0x%p)\n", self);
/* Ask lmp for the current discovery log */
self->discoveries = irlmp_get_discoveries(&self->disco_number, self->mask,
DISCOVERY_DEFAULT_SLOTS);
/* Check if the we got some results */
if(self->discoveries == NULL)
{
self->disco_number = -1;
clear_bit(0, &self->ttp_connect);
DRETURN(-ENETUNREACH, IRDA_SR_INFO, "No Cachelog...\n");
}
DEBUG(IRDA_SR_INFO, "Got the log (0x%p), size is %d\n",
self->discoveries, self->disco_number);
/* Start with the first discovery */
self->disco_index = -1;
self->daddr = DEV_ADDR_ANY;
/* This will fail if the log is empty - this is non-blocking */
ret = irnet_discover_next_daddr(self);
if(ret)
{
/* Close IAP */
if(self->iriap)
iriap_close(self->iriap);
self->iriap = NULL;
/* Cleanup our copy of the discovery log */
kfree(self->discoveries);
self->discoveries = NULL;
clear_bit(0, &self->ttp_connect);
DRETURN(-ENETUNREACH, IRDA_SR_INFO, "Cachelog empty...\n");
}
/* Follow me in irnet_discovervalue_confirm() */
DEXIT(IRDA_SR_TRACE, "\n");
return(0);
}
/*------------------------------------------------------------------*/
/*
* Function irnet_dname_to_daddr (self)
*
* Convert an IrDA nickname to a valid IrDA address
*
* It basically look into the discovery log until there is a match.
*/
static inline int
irnet_dname_to_daddr(irnet_socket * self)
{
struct irda_device_info *discoveries; /* Copy of the discovery log */
int number; /* Number of nodes in the log */
int i;
DENTER(IRDA_SR_TRACE, "(self=0x%p)\n", self);
/* Ask lmp for the current discovery log */
discoveries = irlmp_get_discoveries(&number, 0xffff,
DISCOVERY_DEFAULT_SLOTS);
/* Check if the we got some results */
if(discoveries == NULL)
DRETURN(-ENETUNREACH, IRDA_SR_INFO, "Cachelog empty...\n");
/*
* Now, check all discovered devices (if any), and connect
* client only about the services that the client is
* interested in...
*/
for(i = 0; i < number; i++)
{
/* Does the name match ? */
if(!strncmp(discoveries[i].info, self->rname, NICKNAME_MAX_LEN))
{
/* Yes !!! Get it.. */
self->daddr = discoveries[i].daddr;
DEBUG(IRDA_SR_INFO, "discovered device ``%s'' at address 0x%08x.\n",
self->rname, self->daddr);
kfree(discoveries);
DEXIT(IRDA_SR_TRACE, "\n");
return 0;
}
}
/* No luck ! */
DEBUG(IRDA_SR_INFO, "cannot discover device ``%s'' !!!\n", self->rname);
kfree(discoveries);
return(-EADDRNOTAVAIL);
}
/************************* SOCKET ROUTINES *************************/
/*
* This are the main operations on IrNET sockets, basically to create
* and destroy IrNET sockets. These are called from the PPP part...
*/
/*------------------------------------------------------------------*/
/*
* Create a IrNET instance : just initialise some parameters...
*/
int
irda_irnet_create(irnet_socket * self)
{
DENTER(IRDA_SOCK_TRACE, "(self=0x%p)\n", self);
self->magic = IRNET_MAGIC; /* Paranoia */
self->ttp_open = 0; /* Prevent higher layer from accessing IrTTP */
self->ttp_connect = 0; /* Not connecting yet */
self->rname[0] = '\0'; /* May be set via control channel */
self->rdaddr = DEV_ADDR_ANY; /* May be set via control channel */
self->rsaddr = DEV_ADDR_ANY; /* May be set via control channel */
self->daddr = DEV_ADDR_ANY; /* Until we get connected */
self->saddr = DEV_ADDR_ANY; /* Until we get connected */
self->max_sdu_size_rx = TTP_SAR_UNBOUND;
/* Register as a client with IrLMP */
self->ckey = irlmp_register_client(0, NULL, NULL, NULL);
#ifdef DISCOVERY_NOMASK
self->mask = 0xffff; /* For W2k compatibility */
#else /* DISCOVERY_NOMASK */
self->mask = irlmp_service_to_hint(S_LAN);
#endif /* DISCOVERY_NOMASK */
self->tx_flow = FLOW_START; /* Flow control from IrTTP */
DEXIT(IRDA_SOCK_TRACE, "\n");
return(0);
}
/*------------------------------------------------------------------*/
/*
* Connect to the other side :
* o convert device name to an address
* o find the socket number (dlsap)
* o Establish the connection
*
* Note : We no longer mimic af_irda. The IAS query for finding the TSAP
* is done asynchronously, like the TTP connection. This allow us to
* call this function from any context (not only process).
* The downside is that following what's happening in there is tricky
* because it involve various functions all over the place...
*/
int
irda_irnet_connect(irnet_socket * self)
{
int err;
DENTER(IRDA_SOCK_TRACE, "(self=0x%p)\n", self);
/* Check if we are already trying to connect.
* Because irda_irnet_connect() can be called directly by pppd plus
* packet retries in ppp_generic and connect may take time, plus we may
* race with irnet_connect_indication(), we need to be careful there... */
if(test_and_set_bit(0, &self->ttp_connect))
DRETURN(-EBUSY, IRDA_SOCK_INFO, "Already connecting...\n");
if((self->iriap != NULL) || (self->tsap != NULL))
DERROR(IRDA_SOCK_ERROR, "Socket not cleaned up...\n");
/* Insert ourselves in the hashbin so that the IrNET server can find us.
* Notes : 4th arg is string of 32 char max and must be null terminated
* When 4th arg is used (string), 3rd arg isn't (int)
* Can't re-insert (MUST remove first) so check for that... */
if((irnet_server.running) && (self->q.q_next == NULL))
{
spin_lock_bh(&irnet_server.spinlock);
hashbin_insert(irnet_server.list, (irda_queue_t *) self, 0, self->rname);
spin_unlock_bh(&irnet_server.spinlock);
DEBUG(IRDA_SOCK_INFO, "Inserted ``%s'' in hashbin...\n", self->rname);
}
/* If we don't have anything (no address, no name) */
if((self->rdaddr == DEV_ADDR_ANY) && (self->rname[0] == '\0'))
{
/* Try to find a suitable address */
if((err = irnet_discover_daddr_and_lsap_sel(self)) != 0)
DRETURN(err, IRDA_SOCK_INFO, "auto-connect failed!\n");
/* In most cases, the call above is non-blocking */
}
else
{
/* If we have only the name (no address), try to get an address */
if(self->rdaddr == DEV_ADDR_ANY)
{
if((err = irnet_dname_to_daddr(self)) != 0)
DRETURN(err, IRDA_SOCK_INFO, "name connect failed!\n");
}
else
/* Use the requested destination address */
self->daddr = self->rdaddr;
/* Query remote LM-IAS to find LSAP selector */
irnet_find_lsap_sel(self);
/* The above call is non blocking */
}
/* At this point, we are waiting for the IrDA stack to call us back,
* or we have already failed.
* We will finish the connection procedure in irnet_connect_tsap().
*/
DEXIT(IRDA_SOCK_TRACE, "\n");
return(0);
}
/*------------------------------------------------------------------*/
/*
* Function irda_irnet_destroy(self)
*
* Destroy irnet instance
*
* Note : this need to be called from a process context.
*/
void
irda_irnet_destroy(irnet_socket * self)
{
DENTER(IRDA_SOCK_TRACE, "(self=0x%p)\n", self);
if(self == NULL)
return;
/* Remove ourselves from hashbin (if we are queued in hashbin)
* Note : `irnet_server.running' protect us from calls in hashbin_delete() */
if((irnet_server.running) && (self->q.q_next != NULL))
{
struct irnet_socket * entry;
DEBUG(IRDA_SOCK_INFO, "Removing from hash..\n");
spin_lock_bh(&irnet_server.spinlock);
entry = hashbin_remove_this(irnet_server.list, (irda_queue_t *) self);
self->q.q_next = NULL;
spin_unlock_bh(&irnet_server.spinlock);
DASSERT(entry == self, , IRDA_SOCK_ERROR, "Can't remove from hash.\n");
}
/* If we were connected, post a message */
if(test_bit(0, &self->ttp_open))
{
/* Note : as the disconnect comes from ppp_generic, the unit number
* doesn't exist anymore when we post the event, so we need to pass
* NULL as the first arg... */
irnet_post_event(NULL, IRNET_DISCONNECT_TO,
self->saddr, self->daddr, self->rname, 0);
}
/* Prevent various IrDA callbacks from messing up things
* Need to be first */
clear_bit(0, &self->ttp_connect);
/* Prevent higher layer from accessing IrTTP */
clear_bit(0, &self->ttp_open);
/* Unregister with IrLMP */
irlmp_unregister_client(self->ckey);
/* Unregister with LM-IAS */
if(self->iriap)
{
iriap_close(self->iriap);
self->iriap = NULL;
}
/* Cleanup eventual discoveries from connection attempt or control channel */
if(self->discoveries != NULL)
{
/* Cleanup our copy of the discovery log */
kfree(self->discoveries);
self->discoveries = NULL;
}
/* Close our IrTTP connection */
if(self->tsap)
{
DEBUG(IRDA_SOCK_INFO, "Closing our TTP connection.\n");
irttp_disconnect_request(self->tsap, NULL, P_NORMAL);
irttp_close_tsap(self->tsap);
self->tsap = NULL;
}
self->stsap_sel = 0;
DEXIT(IRDA_SOCK_TRACE, "\n");
return;
}
/************************** SERVER SOCKET **************************/
/*
* The IrNET service is composed of one server socket and a variable
* number of regular IrNET sockets. The server socket is supposed to
* handle incoming connections and redirect them to one IrNET sockets.
* It's a superset of the regular IrNET socket, but has a very distinct
* behaviour...
*/
/*------------------------------------------------------------------*/
/*
* Function irnet_daddr_to_dname (self)
*
* Convert an IrDA address to a IrDA nickname
*
* It basically look into the discovery log until there is a match.
*/
static inline int
irnet_daddr_to_dname(irnet_socket * self)
{
struct irda_device_info *discoveries; /* Copy of the discovery log */
int number; /* Number of nodes in the log */
int i;
DENTER(IRDA_SERV_TRACE, "(self=0x%p)\n", self);
/* Ask lmp for the current discovery log */
discoveries = irlmp_get_discoveries(&number, 0xffff,
DISCOVERY_DEFAULT_SLOTS);
/* Check if the we got some results */
if (discoveries == NULL)
DRETURN(-ENETUNREACH, IRDA_SERV_INFO, "Cachelog empty...\n");
/* Now, check all discovered devices (if any) */
for(i = 0; i < number; i++)
{
/* Does the name match ? */
if(discoveries[i].daddr == self->daddr)
{
/* Yes !!! Get it.. */
strlcpy(self->rname, discoveries[i].info, sizeof(self->rname));
self->rname[sizeof(self->rname) - 1] = '\0';
DEBUG(IRDA_SERV_INFO, "Device 0x%08x is in fact ``%s''.\n",
self->daddr, self->rname);
kfree(discoveries);
DEXIT(IRDA_SERV_TRACE, "\n");
return 0;
}
}
/* No luck ! */
DEXIT(IRDA_SERV_INFO, ": cannot discover device 0x%08x !!!\n", self->daddr);
kfree(discoveries);
return(-EADDRNOTAVAIL);
}
/*------------------------------------------------------------------*/
/*
* Function irda_find_socket (self)
*
* Find the correct IrNET socket
*
* Look into the list of IrNET sockets and finds one with the right
* properties...
*/
static inline irnet_socket *
irnet_find_socket(irnet_socket * self)
{
irnet_socket * new = (irnet_socket *) NULL;
int err;
DENTER(IRDA_SERV_TRACE, "(self=0x%p)\n", self);
/* Get the addresses of the requester */
self->daddr = irttp_get_daddr(self->tsap);
self->saddr = irttp_get_saddr(self->tsap);
/* Try to get the IrDA nickname of the requester */
err = irnet_daddr_to_dname(self);
/* Protect access to the instance list */
spin_lock_bh(&irnet_server.spinlock);
/* So now, try to get an socket having specifically
* requested that nickname */
if(err == 0)
{
new = (irnet_socket *) hashbin_find(irnet_server.list,
0, self->rname);
if(new)
DEBUG(IRDA_SERV_INFO, "Socket 0x%p matches rname ``%s''.\n",
new, new->rname);
}
/* If no name matches, try to find an socket by the destination address */
/* It can be either the requested destination address (set via the
* control channel), or the current destination address if the
* socket is in the middle of a connection request */
if(new == (irnet_socket *) NULL)
{
new = (irnet_socket *) hashbin_get_first(irnet_server.list);
while(new !=(irnet_socket *) NULL)
{
/* Does it have the same address ? */
if((new->rdaddr == self->daddr) || (new->daddr == self->daddr))
{
/* Yes !!! Get it.. */
DEBUG(IRDA_SERV_INFO, "Socket 0x%p matches daddr %#08x.\n",
new, self->daddr);
break;
}
new = (irnet_socket *) hashbin_get_next(irnet_server.list);
}
}
/* If we don't have any socket, get the first unconnected socket */
if(new == (irnet_socket *) NULL)
{
new = (irnet_socket *) hashbin_get_first(irnet_server.list);
while(new !=(irnet_socket *) NULL)
{
/* Is it available ? */
if(!(test_bit(0, &new->ttp_open)) && (new->rdaddr == DEV_ADDR_ANY) &&
(new->rname[0] == '\0') && (new->ppp_open))
{
/* Yes !!! Get it.. */
DEBUG(IRDA_SERV_INFO, "Socket 0x%p is free.\n",
new);
break;
}
new = (irnet_socket *) hashbin_get_next(irnet_server.list);
}
}
/* Spin lock end */
spin_unlock_bh(&irnet_server.spinlock);
DEXIT(IRDA_SERV_TRACE, " - new = 0x%p\n", new);
return new;
}
/*------------------------------------------------------------------*/
/*
* Function irda_connect_socket (self)
*
* Connect an incoming connection to the socket
*
*/
static inline int
irnet_connect_socket(irnet_socket * server,
irnet_socket * new,
struct qos_info * qos,
__u32 max_sdu_size,
__u8 max_header_size)
{
DENTER(IRDA_SERV_TRACE, "(server=0x%p, new=0x%p)\n",
server, new);
/* Now attach up the new socket */
new->tsap = irttp_dup(server->tsap, new);
DABORT(new->tsap == NULL, -1, IRDA_SERV_ERROR, "dup failed!\n");
/* Set up all the relevant parameters on the new socket */
new->stsap_sel = new->tsap->stsap_sel;
new->dtsap_sel = new->tsap->dtsap_sel;
new->saddr = irttp_get_saddr(new->tsap);
new->daddr = irttp_get_daddr(new->tsap);
new->max_header_size = max_header_size;
new->max_sdu_size_tx = max_sdu_size;
new->max_data_size = max_sdu_size;
#ifdef STREAM_COMPAT
/* If we want to receive "stream sockets" */
if(max_sdu_size == 0)
new->max_data_size = irttp_get_max_seg_size(new->tsap);
#endif /* STREAM_COMPAT */
/* Clean up the original one to keep it in listen state */
irttp_listen(server->tsap);
/* Send a connection response on the new socket */
irttp_connect_response(new->tsap, new->max_sdu_size_rx, NULL);
/* Allow PPP to send its junk over the new socket... */
set_bit(0, &new->ttp_open);
/* Not connecting anymore, and clean up last possible remains
* of connection attempts on the socket */
clear_bit(0, &new->ttp_connect);
if(new->iriap)
{
iriap_close(new->iriap);
new->iriap = NULL;
}
if(new->discoveries != NULL)
{
kfree(new->discoveries);
new->discoveries = NULL;
}
#ifdef CONNECT_INDIC_KICK
/* As currently we don't block packets in ppp_irnet_send() while passive,
* this is not really needed...
* Also, not doing it give IrDA a chance to finish the setup properly
* before being swamped with packets... */
ppp_output_wakeup(&new->chan);
#endif /* CONNECT_INDIC_KICK */
/* Notify the control channel */
irnet_post_event(new, IRNET_CONNECT_FROM,
new->saddr, new->daddr, server->rname, 0);
DEXIT(IRDA_SERV_TRACE, "\n");
return 0;
}
/*------------------------------------------------------------------*/
/*
* Function irda_disconnect_server (self)
*
* Cleanup the server socket when the incoming connection abort
*
*/
static inline void
irnet_disconnect_server(irnet_socket * self,
struct sk_buff *skb)
{
DENTER(IRDA_SERV_TRACE, "(self=0x%p)\n", self);
/* Put the received packet in the black hole */
kfree_skb(skb);
#ifdef FAIL_SEND_DISCONNECT
/* Tell the other party we don't want to be connected */
/* Hum... Is it the right thing to do ? And do we need to send
* a connect response before ? It looks ok without this... */
irttp_disconnect_request(self->tsap, NULL, P_NORMAL);
#endif /* FAIL_SEND_DISCONNECT */
/* Notify the control channel (see irnet_find_socket()) */
irnet_post_event(NULL, IRNET_REQUEST_FROM,
self->saddr, self->daddr, self->rname, 0);
/* Clean up the server to keep it in listen state */
irttp_listen(self->tsap);
DEXIT(IRDA_SERV_TRACE, "\n");
return;
}
/*------------------------------------------------------------------*/
/*
* Function irda_setup_server (self)
*
* Create a IrTTP server and set it up...
*
* Register the IrLAN hint bit, create a IrTTP instance for us,
* set all the IrTTP callbacks and create an IrIAS entry...
*/
static inline int
irnet_setup_server(void)
{
__u16 hints;
DENTER(IRDA_SERV_TRACE, "()\n");
/* Initialise the regular socket part of the server */
irda_irnet_create(&irnet_server.s);
/* Open a local TSAP (an IrTTP instance) for the server */
irnet_open_tsap(&irnet_server.s);
/* PPP part setup */
irnet_server.s.ppp_open = 0;
irnet_server.s.chan.private = NULL;
irnet_server.s.file = NULL;
/* Get the hint bit corresponding to IrLAN */
/* Note : we overload the IrLAN hint bit. As it is only a "hint", and as
* we provide roughly the same functionality as IrLAN, this is ok.
* In fact, the situation is similar as JetSend overloading the Obex hint
*/
hints = irlmp_service_to_hint(S_LAN);
#ifdef ADVERTISE_HINT
/* Register with IrLMP as a service (advertise our hint bit) */
irnet_server.skey = irlmp_register_service(hints);
#endif /* ADVERTISE_HINT */
/* Register with LM-IAS (so that people can connect to us) */
irnet_server.ias_obj = irias_new_object(IRNET_SERVICE_NAME, jiffies);
irias_add_integer_attrib(irnet_server.ias_obj, IRNET_IAS_VALUE,
irnet_server.s.stsap_sel, IAS_KERNEL_ATTR);
irias_insert_object(irnet_server.ias_obj);
#ifdef DISCOVERY_EVENTS
/* Tell IrLMP we want to be notified of newly discovered nodes */
irlmp_update_client(irnet_server.s.ckey, hints,
irnet_discovery_indication, irnet_expiry_indication,
(void *) &irnet_server.s);
#endif
DEXIT(IRDA_SERV_TRACE, " - self=0x%p\n", &irnet_server.s);
return 0;
}
/*------------------------------------------------------------------*/
/*
* Function irda_destroy_server (self)
*
* Destroy the IrTTP server...
*
* Reverse of the previous function...
*/
static inline void
irnet_destroy_server(void)
{
DENTER(IRDA_SERV_TRACE, "()\n");
#ifdef ADVERTISE_HINT
/* Unregister with IrLMP */
irlmp_unregister_service(irnet_server.skey);
#endif /* ADVERTISE_HINT */
/* Unregister with LM-IAS */
if(irnet_server.ias_obj)
irias_delete_object(irnet_server.ias_obj);
/* Cleanup the socket part */
irda_irnet_destroy(&irnet_server.s);
DEXIT(IRDA_SERV_TRACE, "\n");
return;
}
/************************ IRDA-TTP CALLBACKS ************************/
/*
* When we create a IrTTP instance, we pass to it a set of callbacks
* that IrTTP will call in case of various events.
* We take care of those events here.
*/
/*------------------------------------------------------------------*/
/*
* Function irnet_data_indication (instance, sap, skb)
*
* Received some data from TinyTP. Just queue it on the receive queue
*
*/
static int
irnet_data_indication(void * instance,
void * sap,
struct sk_buff *skb)
{
irnet_socket * ap = (irnet_socket *) instance;
unsigned char * p;
int code = 0;
DENTER(IRDA_TCB_TRACE, "(self/ap=0x%p, skb=0x%p)\n",
ap, skb);
DASSERT(skb != NULL, 0, IRDA_CB_ERROR, "skb is NULL !!!\n");
/* Check is ppp is ready to receive our packet */
if(!ap->ppp_open)
{
DERROR(IRDA_CB_ERROR, "PPP not ready, dropping packet...\n");
/* When we return error, TTP will need to requeue the skb and
* will stop the sender. IrTTP will stall until we send it a
* flow control request... */
return -ENOMEM;
}
/* strip address/control field if present */
p = skb->data;
if((p[0] == PPP_ALLSTATIONS) && (p[1] == PPP_UI))
{
/* chop off address/control */
if(skb->len < 3)
goto err_exit;
p = skb_pull(skb, 2);
}
/* decompress protocol field if compressed */
if(p[0] & 1)
{
/* protocol is compressed */
skb_push(skb, 1)[0] = 0;
}
else
if(skb->len < 2)
goto err_exit;
/* pass to generic ppp layer */
/* Note : how do I know if ppp can accept or not the packet ? This is
* essential if I want to manage flow control smoothly... */
ppp_input(&ap->chan, skb);
DEXIT(IRDA_TCB_TRACE, "\n");
return 0;
err_exit:
DERROR(IRDA_CB_ERROR, "Packet too small, dropping...\n");
kfree_skb(skb);
ppp_input_error(&ap->chan, code);
return 0; /* Don't return an error code, only for flow control... */
}
/*------------------------------------------------------------------*/
/*
* Function irnet_disconnect_indication (instance, sap, reason, skb)
*
* Connection has been closed. Chech reason to find out why
*
* Note : there are many cases where we come here :
* o attempted to connect, timeout
* o connected, link is broken, LAP has timeout
* o connected, other side close the link
* o connection request on the server not handled
*/
static void
irnet_disconnect_indication(void * instance,
void * sap,
LM_REASON reason,
struct sk_buff *skb)
{
irnet_socket * self = (irnet_socket *) instance;
int test_open;
int test_connect;
DENTER(IRDA_TCB_TRACE, "(self=0x%p)\n", self);
DASSERT(self != NULL, , IRDA_CB_ERROR, "Self is NULL !!!\n");
/* Don't care about it, but let's not leak it */
if(skb)
dev_kfree_skb(skb);
/* Prevent higher layer from accessing IrTTP */
test_open = test_and_clear_bit(0, &self->ttp_open);
/* Not connecting anymore...
* (note : TSAP is open, so IAP callbacks are no longer pending...) */
test_connect = test_and_clear_bit(0, &self->ttp_connect);
/* If both self->ttp_open and self->ttp_connect are NULL, it mean that we
* have a race condition with irda_irnet_destroy() or
* irnet_connect_indication(), so don't mess up tsap...
*/
if(!(test_open || test_connect))
{
DERROR(IRDA_CB_ERROR, "Race condition detected...\n");
return;
}
/* If we were active, notify the control channel */
if(test_open)
irnet_post_event(self, IRNET_DISCONNECT_FROM,
self->saddr, self->daddr, self->rname, 0);
else
/* If we were trying to connect, notify the control channel */
if((self->tsap) && (self != &irnet_server.s))
irnet_post_event(self, IRNET_NOANSWER_FROM,
self->saddr, self->daddr, self->rname, 0);
/* Close our IrTTP connection, cleanup tsap */
if((self->tsap) && (self != &irnet_server.s))
{
DEBUG(IRDA_CB_INFO, "Closing our TTP connection.\n");
irttp_close_tsap(self->tsap);
self->tsap = NULL;
}
/* Cleanup the socket in case we want to reconnect in ppp_output_wakeup() */
self->stsap_sel = 0;
self->daddr = DEV_ADDR_ANY;
self->tx_flow = FLOW_START;
/* Deal with the ppp instance if it's still alive */
if(self->ppp_open)
{
if(test_open)
{
#ifdef MISSING_PPP_API
/* ppp_unregister_channel() wants a user context, which we
* are guaranteed to NOT have here. What are we supposed
* to do here ? Jean II */
/* If we were connected, cleanup & close the PPP channel,
* which will kill pppd (hangup) and the rest */
ppp_unregister_channel(&self->chan);
self->ppp_open = 0;
#endif
}
else
{
/* If we were trying to connect, flush (drain) ppp_generic
* Tx queue (most often we have blocked it), which will
* trigger an other attempt to connect. If we are passive,
* this will empty the Tx queue after last try. */
ppp_output_wakeup(&self->chan);
}
}
DEXIT(IRDA_TCB_TRACE, "\n");
}
/*------------------------------------------------------------------*/
/*
* Function irnet_connect_confirm (instance, sap, qos, max_sdu_size, skb)
*
* Connections has been confirmed by the remote device
*
*/
static void
irnet_connect_confirm(void * instance,
void * sap,
struct qos_info *qos,
__u32 max_sdu_size,
__u8 max_header_size,
struct sk_buff *skb)
{
irnet_socket * self = (irnet_socket *) instance;
DENTER(IRDA_TCB_TRACE, "(self=0x%p)\n", self);
/* Check if socket is closing down (via irda_irnet_destroy()) */
if(! test_bit(0, &self->ttp_connect))
{
DERROR(IRDA_CB_ERROR, "Socket no longer connecting. Ouch !\n");
return;
}
/* How much header space do we need to reserve */
self->max_header_size = max_header_size;
/* IrTTP max SDU size in transmit direction */
self->max_sdu_size_tx = max_sdu_size;
self->max_data_size = max_sdu_size;
#ifdef STREAM_COMPAT
if(max_sdu_size == 0)
self->max_data_size = irttp_get_max_seg_size(self->tsap);
#endif /* STREAM_COMPAT */
/* At this point, IrLMP has assigned our source address */
self->saddr = irttp_get_saddr(self->tsap);
/* Allow higher layer to access IrTTP */
set_bit(0, &self->ttp_open);
clear_bit(0, &self->ttp_connect); /* Not racy, IrDA traffic is serial */
/* Give a kick in the ass of ppp_generic so that he sends us some data */
ppp_output_wakeup(&self->chan);
/* Check size of received packet */
if(skb->len > 0)
{
#ifdef PASS_CONNECT_PACKETS
DEBUG(IRDA_CB_INFO, "Passing connect packet to PPP.\n");
/* Try to pass it to PPP */
irnet_data_indication(instance, sap, skb);
#else /* PASS_CONNECT_PACKETS */
DERROR(IRDA_CB_ERROR, "Dropping non empty packet.\n");
kfree_skb(skb); /* Note : will be optimised with other kfree... */
#endif /* PASS_CONNECT_PACKETS */
}
else
kfree_skb(skb);
/* Notify the control channel */
irnet_post_event(self, IRNET_CONNECT_TO,
self->saddr, self->daddr, self->rname, 0);
DEXIT(IRDA_TCB_TRACE, "\n");
}
/*------------------------------------------------------------------*/
/*
* Function irnet_flow_indication (instance, sap, flow)
*
* Used by TinyTP to tell us if it can accept more data or not
*
*/
static void
irnet_flow_indication(void * instance,
void * sap,
LOCAL_FLOW flow)
{
irnet_socket * self = (irnet_socket *) instance;
LOCAL_FLOW oldflow = self->tx_flow;
DENTER(IRDA_TCB_TRACE, "(self=0x%p, flow=%d)\n", self, flow);
/* Update our state */
self->tx_flow = flow;
/* Check what IrTTP want us to do... */
switch(flow)
{
case FLOW_START:
DEBUG(IRDA_CB_INFO, "IrTTP wants us to start again\n");
/* Check if we really need to wake up PPP */
if(oldflow == FLOW_STOP)
ppp_output_wakeup(&self->chan);
else
DEBUG(IRDA_CB_INFO, "But we were already transmitting !!!\n");
break;
case FLOW_STOP:
DEBUG(IRDA_CB_INFO, "IrTTP wants us to slow down\n");
break;
default:
DEBUG(IRDA_CB_INFO, "Unknown flow command!\n");
break;
}
DEXIT(IRDA_TCB_TRACE, "\n");
}
/*------------------------------------------------------------------*/
/*
* Function irnet_status_indication (instance, sap, reason, skb)
*
* Link (IrLAP) status report.
*
*/
static void
irnet_status_indication(void * instance,
LINK_STATUS link,
LOCK_STATUS lock)
{
irnet_socket * self = (irnet_socket *) instance;
DENTER(IRDA_TCB_TRACE, "(self=0x%p)\n", self);
DASSERT(self != NULL, , IRDA_CB_ERROR, "Self is NULL !!!\n");
/* We can only get this event if we are connected */
switch(link)
{
case STATUS_NO_ACTIVITY:
irnet_post_event(self, IRNET_BLOCKED_LINK,
self->saddr, self->daddr, self->rname, 0);
break;
default:
DEBUG(IRDA_CB_INFO, "Unknown status...\n");
}
DEXIT(IRDA_TCB_TRACE, "\n");
}
/*------------------------------------------------------------------*/
/*
* Function irnet_connect_indication(instance, sap, qos, max_sdu_size, userdata)
*
* Incoming connection
*
* In theory, this function is called only on the server socket.
* Some other node is attempting to connect to the IrNET service, and has
* sent a connection request on our server socket.
* We just redirect the connection to the relevant IrNET socket.
*
* Note : we also make sure that between 2 irnet nodes, there can
* exist only one irnet connection.
*/
static void
irnet_connect_indication(void * instance,
void * sap,
struct qos_info *qos,
__u32 max_sdu_size,
__u8 max_header_size,
struct sk_buff *skb)
{
irnet_socket * server = &irnet_server.s;
irnet_socket * new = (irnet_socket *) NULL;
DENTER(IRDA_TCB_TRACE, "(server=0x%p)\n", server);
DASSERT(instance == &irnet_server, , IRDA_CB_ERROR,
"Invalid instance (0x%p) !!!\n", instance);
DASSERT(sap == irnet_server.s.tsap, , IRDA_CB_ERROR, "Invalid sap !!!\n");
/* Try to find the most appropriate IrNET socket */
new = irnet_find_socket(server);
/* After all this hard work, do we have an socket ? */
if(new == (irnet_socket *) NULL)
{
DEXIT(IRDA_CB_INFO, ": No socket waiting for this connection.\n");
irnet_disconnect_server(server, skb);
return;
}
/* Is the socket already busy ? */
if(test_bit(0, &new->ttp_open))
{
DEXIT(IRDA_CB_INFO, ": Socket already connected.\n");
irnet_disconnect_server(server, skb);
return;
}
/* The following code is a bit tricky, so need comments ;-)
*/
/* If ttp_connect is set, the socket is trying to connect to the other
* end and may have sent a IrTTP connection request and is waiting for
* a connection response (that may never come).
* Now, the pain is that the socket may have opened a tsap and is
* waiting on it, while the other end is trying to connect to it on
* another tsap.
* Because IrNET can be peer to peer, we need to workaround this.
* Furthermore, the way the irnetd script is implemented, the
* target will create a second IrNET connection back to the
* originator and expect the originator to bind this new connection
* to the original PPPD instance.
* And of course, if we don't use irnetd, we can have a race when
* both side try to connect simultaneously, which could leave both
* connections half closed (yuck).
* Conclusions :
* 1) The "originator" must accept the new connection and get rid
* of the old one so that irnetd works
* 2) One side must deny the new connection to avoid races,
* but both side must agree on which side it is...
* Most often, the originator is primary at the LAP layer.
* Jean II
*/
/* Now, let's look at the way I wrote the test...
* We need to clear up the ttp_connect flag atomically to prevent
* irnet_disconnect_indication() to mess up the tsap we are going to close.
* We want to clear the ttp_connect flag only if we close the tsap,
* otherwise we will never close it, so we need to check for primary
* *before* doing the test on the flag.
* And of course, ALLOW_SIMULT_CONNECT can disable this entirely...
* Jean II
*/
/* Socket already connecting ? On primary ? */
if(0
#ifdef ALLOW_SIMULT_CONNECT
|| ((irttp_is_primary(server->tsap) == 1) /* primary */
&& (test_and_clear_bit(0, &new->ttp_connect)))
#endif /* ALLOW_SIMULT_CONNECT */
)
{
DERROR(IRDA_CB_ERROR, "Socket already connecting, but going to reuse it !\n");
/* Cleanup the old TSAP if necessary - IrIAP will be cleaned up later */
if(new->tsap != NULL)
{
/* Close the old connection the new socket was attempting,
* so that we can hook it up to the new connection.
* It's now safe to do it... */
irttp_close_tsap(new->tsap);
new->tsap = NULL;
}
}
else
{
/* Three options :
* 1) socket was not connecting or connected : ttp_connect should be 0.
* 2) we don't want to connect the socket because we are secondary or
* ALLOW_SIMULT_CONNECT is undefined. ttp_connect should be 1.
* 3) we are half way in irnet_disconnect_indication(), and it's a
* nice race condition... Fortunately, we can detect that by checking
* if tsap is still alive. On the other hand, we can't be in
* irda_irnet_destroy() otherwise we would not have found this
* socket in the hashbin.
* Jean II */
if((test_bit(0, &new->ttp_connect)) || (new->tsap != NULL))
{
/* Don't mess this socket, somebody else in in charge... */
DERROR(IRDA_CB_ERROR, "Race condition detected, socket in use, abort connect...\n");
irnet_disconnect_server(server, skb);
return;
}
}
/* So : at this point, we have a socket, and it is idle. Good ! */
irnet_connect_socket(server, new, qos, max_sdu_size, max_header_size);
/* Check size of received packet */
if(skb->len > 0)
{
#ifdef PASS_CONNECT_PACKETS
DEBUG(IRDA_CB_INFO, "Passing connect packet to PPP.\n");
/* Try to pass it to PPP */
irnet_data_indication(new, new->tsap, skb);
#else /* PASS_CONNECT_PACKETS */
DERROR(IRDA_CB_ERROR, "Dropping non empty packet.\n");
kfree_skb(skb); /* Note : will be optimised with other kfree... */
#endif /* PASS_CONNECT_PACKETS */
}
else
kfree_skb(skb);
DEXIT(IRDA_TCB_TRACE, "\n");
}
/********************** IRDA-IAS/LMP CALLBACKS **********************/
/*
* These are the callbacks called by other layers of the IrDA stack,
* mainly LMP for discovery and IAS for name queries.
*/
/*------------------------------------------------------------------*/
/*
* Function irnet_getvalue_confirm (result, obj_id, value, priv)
*
* Got answer from remote LM-IAS, just connect
*
* This is the reply to a IAS query we were doing to find the TSAP of
* the device we want to connect to.
* If we have found a valid TSAP, just initiate the TTP connection
* on this TSAP.
*/
static void
irnet_getvalue_confirm(int result,
__u16 obj_id,
struct ias_value *value,
void * priv)
{
irnet_socket * self = (irnet_socket *) priv;
DENTER(IRDA_OCB_TRACE, "(self=0x%p)\n", self);
DASSERT(self != NULL, , IRDA_OCB_ERROR, "Self is NULL !!!\n");
/* Check if already connected (via irnet_connect_socket())
* or socket is closing down (via irda_irnet_destroy()) */
if(! test_bit(0, &self->ttp_connect))
{
DERROR(IRDA_OCB_ERROR, "Socket no longer connecting. Ouch !\n");
return;
}
/* We probably don't need to make any more queries */
iriap_close(self->iriap);
self->iriap = NULL;
/* Post process the IAS reply */
self->dtsap_sel = irnet_ias_to_tsap(self, result, value);
/* If error, just go out */
if(self->errno)
{
clear_bit(0, &self->ttp_connect);
DERROR(IRDA_OCB_ERROR, "IAS connect failed ! (0x%X)\n", self->errno);
return;
}
DEBUG(IRDA_OCB_INFO, "daddr = %08x, lsap = %d, starting IrTTP connection\n",
self->daddr, self->dtsap_sel);
/* Start up TTP - non blocking */
irnet_connect_tsap(self);
DEXIT(IRDA_OCB_TRACE, "\n");
}
/*------------------------------------------------------------------*/
/*
* Function irnet_discovervalue_confirm (result, obj_id, value, priv)
*
* Handle the TSAP discovery procedure state machine.
* Got answer from remote LM-IAS, try next device
*
* We are doing a TSAP discovery procedure, and we got an answer to
* a IAS query we were doing to find the TSAP on one of the address
* in the discovery log.
*
* If we have found a valid TSAP for the first time, save it. If it's
* not the first time we found one, complain.
*
* If we have more addresses in the log, just initiate a new query.
* Note that those query may fail (see irnet_discover_daddr_and_lsap_sel())
*
* Otherwise, wrap up the procedure (cleanup), check if we have found
* any device and connect to it.
*/
static void
irnet_discovervalue_confirm(int result,
__u16 obj_id,
struct ias_value *value,
void * priv)
{
irnet_socket * self = (irnet_socket *) priv;
__u8 dtsap_sel; /* TSAP we are looking for */
DENTER(IRDA_OCB_TRACE, "(self=0x%p)\n", self);
DASSERT(self != NULL, , IRDA_OCB_ERROR, "Self is NULL !!!\n");
/* Check if already connected (via irnet_connect_socket())
* or socket is closing down (via irda_irnet_destroy()) */
if(! test_bit(0, &self->ttp_connect))
{
DERROR(IRDA_OCB_ERROR, "Socket no longer connecting. Ouch !\n");
return;
}
/* Post process the IAS reply */
dtsap_sel = irnet_ias_to_tsap(self, result, value);
/* Have we got something ? */
if(self->errno == 0)
{
/* We found the requested service */
if(self->daddr != DEV_ADDR_ANY)
{
DERROR(IRDA_OCB_ERROR, "More than one device in range supports IrNET...\n");
}
else
{
/* First time we found that one, save it ! */
self->daddr = self->discoveries[self->disco_index].daddr;
self->dtsap_sel = dtsap_sel;
}
}
/* If no failure */
if((self->errno == -EADDRNOTAVAIL) || (self->errno == 0))
{
int ret;
/* Search the next node */
ret = irnet_discover_next_daddr(self);
if(!ret)
{
/* In this case, the above request was non-blocking.
* We will return here after a while... */
return;
}
/* In this case, we have processed the last discovery item */
}
/* No more queries to be done (failure or last one) */
/* We probably don't need to make any more queries */
iriap_close(self->iriap);
self->iriap = NULL;
/* No more items : remove the log and signal termination */
DEBUG(IRDA_OCB_INFO, "Cleaning up log (0x%p)\n",
self->discoveries);
if(self->discoveries != NULL)
{
/* Cleanup our copy of the discovery log */
kfree(self->discoveries);
self->discoveries = NULL;
}
self->disco_number = -1;
/* Check out what we found */
if(self->daddr == DEV_ADDR_ANY)
{
self->daddr = DEV_ADDR_ANY;
clear_bit(0, &self->ttp_connect);
DEXIT(IRDA_OCB_TRACE, ": cannot discover IrNET in any device !!!\n");
return;
}
/* We have a valid address - just connect */
DEBUG(IRDA_OCB_INFO, "daddr = %08x, lsap = %d, starting IrTTP connection\n",
self->daddr, self->dtsap_sel);
/* Start up TTP - non blocking */
irnet_connect_tsap(self);
DEXIT(IRDA_OCB_TRACE, "\n");
}
#ifdef DISCOVERY_EVENTS
/*------------------------------------------------------------------*/
/*
* Function irnet_discovery_indication (discovery)
*
* Got a discovery indication from IrLMP, post an event
*
* Note : IrLMP take care of matching the hint mask for us, and also
* check if it is a "new" node for us...
*
* As IrLMP filter on the IrLAN hint bit, we get both IrLAN and IrNET
* nodes, so it's only at connection time that we will know if the
* node support IrNET, IrLAN or both. The other solution is to check
* in IAS the PNP ids and service name.
* Note : even if a node support IrNET (or IrLAN), it's no guarantee
* that we will be able to connect to it, the node might already be
* busy...
*
* One last thing : in some case, this function will trigger duplicate
* discovery events. On the other hand, we should catch all
* discoveries properly (i.e. not miss one). Filtering duplicate here
* is to messy, so we leave that to user space...
*/
static void
irnet_discovery_indication(discinfo_t * discovery,
DISCOVERY_MODE mode,
void * priv)
{
irnet_socket * self = &irnet_server.s;
DENTER(IRDA_OCB_TRACE, "(self=0x%p)\n", self);
DASSERT(priv == &irnet_server, , IRDA_OCB_ERROR,
"Invalid instance (0x%p) !!!\n", priv);
DEBUG(IRDA_OCB_INFO, "Discovered new IrNET/IrLAN node %s...\n",
discovery->info);
/* Notify the control channel */
irnet_post_event(NULL, IRNET_DISCOVER,
discovery->saddr, discovery->daddr, discovery->info,
u16ho(discovery->hints));
DEXIT(IRDA_OCB_TRACE, "\n");
}
/*------------------------------------------------------------------*/
/*
* Function irnet_expiry_indication (expiry)
*
* Got a expiry indication from IrLMP, post an event
*
* Note : IrLMP take care of matching the hint mask for us, we only
* check if it is a "new" node...
*/
static void
irnet_expiry_indication(discinfo_t * expiry,
DISCOVERY_MODE mode,
void * priv)
{
irnet_socket * self = &irnet_server.s;
DENTER(IRDA_OCB_TRACE, "(self=0x%p)\n", self);
DASSERT(priv == &irnet_server, , IRDA_OCB_ERROR,
"Invalid instance (0x%p) !!!\n", priv);
DEBUG(IRDA_OCB_INFO, "IrNET/IrLAN node %s expired...\n",
expiry->info);
/* Notify the control channel */
irnet_post_event(NULL, IRNET_EXPIRE,
expiry->saddr, expiry->daddr, expiry->info,
u16ho(expiry->hints));
DEXIT(IRDA_OCB_TRACE, "\n");
}
#endif /* DISCOVERY_EVENTS */
/*********************** PROC ENTRY CALLBACKS ***********************/
/*
* We create a instance in the /proc filesystem, and here we take care
* of that...
*/
#ifdef CONFIG_PROC_FS
/*------------------------------------------------------------------*/
/*
* Function irnet_proc_read (buf, start, offset, len, unused)
*
* Give some info to the /proc file system
*/
static int
irnet_proc_read(char * buf,
char ** start,
off_t offset,
int len)
{
irnet_socket * self;
char * state;
int i = 0;
len = 0;
/* Get the IrNET server information... */
len += sprintf(buf+len, "IrNET server - ");
len += sprintf(buf+len, "IrDA state: %s, ",
(irnet_server.running ? "running" : "dead"));
len += sprintf(buf+len, "stsap_sel: %02x, ", irnet_server.s.stsap_sel);
len += sprintf(buf+len, "dtsap_sel: %02x\n", irnet_server.s.dtsap_sel);
/* Do we need to continue ? */
if(!irnet_server.running)
return len;
/* Protect access to the instance list */
spin_lock_bh(&irnet_server.spinlock);
/* Get the sockets one by one... */
self = (irnet_socket *) hashbin_get_first(irnet_server.list);
while(self != NULL)
{
/* Start printing info about the socket. */
len += sprintf(buf+len, "\nIrNET socket %d - ", i++);
/* First, get the requested configuration */
len += sprintf(buf+len, "Requested IrDA name: \"%s\", ", self->rname);
len += sprintf(buf+len, "daddr: %08x, ", self->rdaddr);
len += sprintf(buf+len, "saddr: %08x\n", self->rsaddr);
/* Second, get all the PPP info */
len += sprintf(buf+len, " PPP state: %s",
(self->ppp_open ? "registered" : "unregistered"));
if(self->ppp_open)
{
len += sprintf(buf+len, ", unit: ppp%d",
ppp_unit_number(&self->chan));
len += sprintf(buf+len, ", channel: %d",
ppp_channel_index(&self->chan));
len += sprintf(buf+len, ", mru: %d",
self->mru);
/* Maybe add self->flags ? Later... */
}
/* Then, get all the IrDA specific info... */
if(self->ttp_open)
state = "connected";
else
if(self->tsap != NULL)
state = "connecting";
else
if(self->iriap != NULL)
state = "searching";
else
if(self->ttp_connect)
state = "weird";
else
state = "idle";
len += sprintf(buf+len, "\n IrDA state: %s, ", state);
len += sprintf(buf+len, "daddr: %08x, ", self->daddr);
len += sprintf(buf+len, "stsap_sel: %02x, ", self->stsap_sel);
len += sprintf(buf+len, "dtsap_sel: %02x\n", self->dtsap_sel);
/* Next socket, please... */
self = (irnet_socket *) hashbin_get_next(irnet_server.list);
}
/* Spin lock end */
spin_unlock_bh(&irnet_server.spinlock);
return len;
}
#endif /* PROC_FS */
/********************** CONFIGURATION/CLEANUP **********************/
/*
* Initialisation and teardown of the IrDA part, called at module
* insertion and removal...
*/
/*------------------------------------------------------------------*/
/*
* Prepare the IrNET layer for operation...
*/
int __init
irda_irnet_init(void)
{
int err = 0;
DENTER(MODULE_TRACE, "()\n");
/* Pure paranoia - should be redundant */
memset(&irnet_server, 0, sizeof(struct irnet_root));
/* Setup start of irnet instance list */
irnet_server.list = hashbin_new(HB_NOLOCK);
DABORT(irnet_server.list == NULL, -ENOMEM,
MODULE_ERROR, "Can't allocate hashbin!\n");
/* Init spinlock for instance list */
spin_lock_init(&irnet_server.spinlock);
/* Initialise control channel */
init_waitqueue_head(&irnet_events.rwait);
irnet_events.index = 0;
/* Init spinlock for event logging */
spin_lock_init(&irnet_events.spinlock);
#ifdef CONFIG_PROC_FS
/* Add a /proc file for irnet infos */
create_proc_info_entry("irnet", 0, proc_irda, irnet_proc_read);
#endif /* CONFIG_PROC_FS */
/* Setup the IrNET server */
err = irnet_setup_server();
if(!err)
/* We are no longer functional... */
irnet_server.running = 1;
DEXIT(MODULE_TRACE, "\n");
return err;
}
/*------------------------------------------------------------------*/
/*
* Cleanup at exit...
*/
void __exit
irda_irnet_cleanup(void)
{
DENTER(MODULE_TRACE, "()\n");
/* We are no longer there... */
irnet_server.running = 0;
#ifdef CONFIG_PROC_FS
/* Remove our /proc file */
remove_proc_entry("irnet", proc_irda);
#endif /* CONFIG_PROC_FS */
/* Remove our IrNET server from existence */
irnet_destroy_server();
/* Remove all instances of IrNET socket still present */
hashbin_delete(irnet_server.list, (FREE_FUNC) irda_irnet_destroy);
DEXIT(MODULE_TRACE, "\n");
}
| {
"content_hash": "29fa4129e3cc1fa297fee240dfa93e72",
"timestamp": "",
"source": "github",
"line_count": 1866,
"max_line_length": 87,
"avg_line_length": 30.337620578778136,
"alnum_prop": 0.6113760819643173,
"repo_name": "ut-osa/syncchar",
"id": "f65c7a83bc5cf95d3f5884ec9391a888b59e590f",
"size": "56610",
"binary": false,
"copies": "17",
"ref": "refs/heads/master",
"path": "linux-2.6.16-unmod/net/irda/irnet/irnet_irda.c",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ASP",
"bytes": "4526"
},
{
"name": "Assembly",
"bytes": "7269561"
},
{
"name": "C",
"bytes": "191363313"
},
{
"name": "C++",
"bytes": "2703790"
},
{
"name": "Objective-C",
"bytes": "515305"
},
{
"name": "Perl",
"bytes": "118289"
},
{
"name": "Python",
"bytes": "160654"
},
{
"name": "Scala",
"bytes": "12158"
},
{
"name": "Shell",
"bytes": "48243"
},
{
"name": "TeX",
"bytes": "51367"
},
{
"name": "UnrealScript",
"bytes": "20822"
},
{
"name": "XSLT",
"bytes": "310"
}
],
"symlink_target": ""
} |
/*
*
* CperMapThread
*
*/
import { FC } from 'react'
import dynamic from 'next/dynamic'
import { useTheme } from 'styled-components'
import { buildLog } from '@/utils/logger'
import { bond } from '@/utils/mobx'
import RankingBoard from './RankingBoard'
import MapLoading from './MapLoading'
import { Wrapper } from './styles'
import type { TStore } from './store'
import { useInit } from './logic'
/* eslint-disable-next-line */
const log = buildLog('C:CperMapThread')
const GeoMap = dynamic(() => import('./GeoMap'), {
ssr: false,
})
type TProps = {
cperMapThread?: TStore
}
const CperMapThreadContainer: FC<TProps> = ({ cperMapThread: store }) => {
useInit(store)
const theme = useTheme()
const { geoInfosData, geoDataLoading, curCommunity, curTheme } = store
const ready = !geoDataLoading
const markers = geoDataLoading ? [] : geoInfosData
if (!ready) {
return <MapLoading />
}
return (
<Wrapper>
<RankingBoard total={curCommunity.subscribersCount} geoData={markers} />
{/* @ts-ignore */}
<GeoMap markers={markers} curTheme={curTheme} theme={theme} />
</Wrapper>
)
}
export default bond(CperMapThreadContainer, 'cperMapThread') as FC<TProps>
| {
"content_hash": "90dfd7e9f92496463495004acb1d3734",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 78,
"avg_line_length": 22.88679245283019,
"alnum_prop": 0.6718878812860676,
"repo_name": "mydearxym/mastani",
"id": "df8825b4578cebc08c7836d61fa4231934dff606",
"size": "1213",
"binary": false,
"copies": "1",
"ref": "refs/heads/dev",
"path": "src/containers/thread/CperMapThread/index.tsx",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "5475"
},
{
"name": "JavaScript",
"bytes": "449787"
}
],
"symlink_target": ""
} |
[?php use_stylesheets_for_form($form) ?]
[?php use_javascripts_for_form($form) ?]
<div class="headings">
<h2>Filtres</h2>
</div>
[?php if ($form->hasGlobalErrors()): ?]
[?php echo $form->renderGlobalErrors() ?]
[?php endif; ?]
<div class="contentbox">
<form action="[?php echo url_for('<?php echo $this->getUrlForAction('collection') ?>', array('action' => 'filter')) ?]" method="post">
[?php echo $form->renderHiddenFields() ?]
[?php foreach ($configuration->getFormFilterFields($form) as $name => $field): ?]
[?php if ((isset($form[$name]) && $form[$name]->isHidden()) || (!isset($form[$name]) && $field->isReal())) continue ?]
[?php include_partial('<?php echo $this->getModuleName() ?>/filters_field', array(
'name' => $name,
'attributes' => $field->getConfig('attributes', array()),
'label' => $field->getConfig('label'),
'help' => $field->getConfig('help'),
'form' => $form,
'field' => $field,
'class' => 'sf_admin_form_row sf_admin_'.strtolower($field->getType()).' sf_admin_filter_field_'.$name,
)) ?]
[?php endforeach; ?]
[?php echo link_to(__('Reset', array(), 'sf_admin'), '<?php echo $this->getUrlForAction('collection') ?>', array('action' => 'filter'), array('query_string' => '_reset', 'method' => 'post')) ?]
<input type="submit" value="[?php echo __('Filter', array(), 'sf_admin') ?]" class="btn" />
<img src="/sfAdminTemplatePlugin/images/ajax-loader.gif" alt="Chargement..." class="loading" style="display: none;" />
</form>
</div>
| {
"content_hash": "62a3b737a3707f02515be62d2ea2cd0b",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 197,
"avg_line_length": 54.793103448275865,
"alnum_prop": 0.5764631843926998,
"repo_name": "vincentchalamon/sfAdminTemplatePlugin",
"id": "224b68ee752048a69343bea6ced3a2bee6830144",
"size": "1589",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "data/generator/sfDoctrineModule/admin_template/template/templates/_filters.php",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "54344"
},
{
"name": "JavaScript",
"bytes": "67951"
},
{
"name": "PHP",
"bytes": "81393"
}
],
"symlink_target": ""
} |
import { mount } from '@cypress/vue'
import QBadge from '../QBadge.js'
const defaultOptions = {
label: 'simple badge'
}
const alignValues = [ 'top', 'middle', 'bottom' ]
function mountQBadge (options = {}) {
options.props = {
...defaultOptions,
...options.props
}
return mount(QBadge, options)
}
describe('Badge API', () => {
describe('Props', () => {
describe('Category: content', () => {
describe('(prop): floating', () => {
it('should render a floating badge', () => {
mountQBadge({
props: { floating: true }
})
cy.get('.q-badge')
.should('have.class', 'q-badge--floating')
})
})
describe('(prop): multi-line', () => {
it('should render a content with multiple lines', () => {
mountQBadge({
props: { multiLine: true }
})
cy.get('.q-badge')
.should('have.class', 'q-badge--multi-line')
})
})
describe('(prop): label', () => {
it('should render a label inside the badge', () => {
const label = 'Badge label'
mountQBadge({
props: { label }
})
cy.get('.q-badge')
.should('contain', label)
})
})
describe('(prop): align', () => {
it(`should render a badge aligned based on defined values: ${ alignValues.join(', ') }`, () => {
mountQBadge()
// loop over alignValues
for (const align of alignValues) {
cy.get('.q-badge')
.then(() => Cypress.vueWrapper.setProps({ align }))
.should('have.css', 'vertical-align', align)
}
})
})
})
describe('Category: style', () => {
describe('(prop): color', () => {
it('should change color based on Quasar Color Palette', () => {
mountQBadge({
props: { color: 'red' }
})
cy.get('.q-badge')
.should('have.class', 'bg-red')
})
})
describe('(prop): text-color', () => {
it('should change text color based on Quasar Color Palette', () => {
mountQBadge({
props: { textColor: 'red' }
})
cy.get('.q-badge')
.should('have.class', 'text-red')
})
})
describe('(prop): transparent', () => {
it('should have opacity style when "transparent" prop is true', () => {
mountQBadge({
props: { transparent: true }
})
cy.get('.q-badge')
.should('have.class', 'q-badge--transparent')
})
})
describe('(prop): outline', () => {
it('should have a outline style when "outline" prop is true', () => {
mountQBadge({
props: { outline: true }
})
cy.get('.q-badge')
.should('have.class', 'q-badge--outline')
})
})
describe('(prop): rounded', () => {
it('should have a rounded style when "rounded" prop is true', () => {
mountQBadge({
props: { rounded: true }
})
cy.get('.q-badge')
.should('have.class', 'q-badge--rounded')
})
})
})
})
describe('Slots', () => {
describe('(slot): default', () => {
it('should display the default slot content', () => {
const label = 'Badge label'
mountQBadge({
props: {
label: undefined
},
slots: {
default: label
}
})
cy.get('.q-badge')
.should('have.text', label)
})
})
})
})
| {
"content_hash": "c202ed22e76eef7f6ffceb807fcb0c9b",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 104,
"avg_line_length": 24.677852348993287,
"alnum_prop": 0.4549904813706826,
"repo_name": "quasarframework/quasar",
"id": "58b8323e03977b0aaf706f789fa7b391d8da6ee0",
"size": "3677",
"binary": false,
"copies": "1",
"ref": "refs/heads/dev",
"path": "ui/src/components/badge/__tests__/QBadge.spec.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2006590"
},
{
"name": "HTML",
"bytes": "26041"
},
{
"name": "JavaScript",
"bytes": "27008546"
},
{
"name": "SCSS",
"bytes": "4830"
},
{
"name": "Sass",
"bytes": "217157"
},
{
"name": "Shell",
"bytes": "9511"
},
{
"name": "Stylus",
"bytes": "1516"
},
{
"name": "TypeScript",
"bytes": "54448"
},
{
"name": "Vue",
"bytes": "1521880"
}
],
"symlink_target": ""
} |
static exception_mask_t FIRCLSMachExceptionMask(void);
static void* FIRCLSMachExceptionServer(void* argument);
static bool FIRCLSMachExceptionThreadStart(FIRCLSMachExceptionReadContext* context);
static bool FIRCLSMachExceptionReadMessage(FIRCLSMachExceptionReadContext* context,
MachExceptionMessage* message);
static kern_return_t FIRCLSMachExceptionDispatchMessage(FIRCLSMachExceptionReadContext* context,
MachExceptionMessage* message);
static bool FIRCLSMachExceptionReply(FIRCLSMachExceptionReadContext* context,
MachExceptionMessage* message,
kern_return_t result);
static bool FIRCLSMachExceptionRegister(FIRCLSMachExceptionReadContext* context,
exception_mask_t ignoreMask);
static bool FIRCLSMachExceptionUnregister(FIRCLSMachExceptionOriginalPorts* originalPorts,
exception_mask_t mask);
static bool FIRCLSMachExceptionRecord(FIRCLSMachExceptionReadContext* context,
MachExceptionMessage* message);
#pragma mark - Initialization
void FIRCLSMachExceptionInit(FIRCLSMachExceptionReadContext* context, exception_mask_t ignoreMask) {
if (!FIRCLSUnlinkIfExists(context->path)) {
FIRCLSSDKLog("Unable to reset the mach exception file %s\n", strerror(errno));
}
if (!FIRCLSMachExceptionRegister(context, ignoreMask)) {
FIRCLSSDKLog("Unable to register mach exception handler\n");
return;
}
if (!FIRCLSMachExceptionThreadStart(context)) {
FIRCLSSDKLog("Unable to start thread\n");
FIRCLSMachExceptionUnregister(&context->originalPorts, context->mask);
}
}
void FIRCLSMachExceptionCheckHandlers(void) {
if (_firclsContext.readonly->debuggerAttached) {
return;
}
// It isn't really critical that this be done, as its extremely uncommon to run into
// preexisting handlers.
// Can use task_get_exception_ports for this.
}
static exception_mask_t FIRCLSMachExceptionMask(void) {
exception_mask_t mask;
// EXC_BAD_ACCESS
// EXC_BAD_INSTRUCTION
// EXC_ARITHMETIC
// EXC_EMULATION - non-failure
// EXC_SOFTWARE - non-failure
// EXC_BREAKPOINT - trap instructions, from the debugger and code. Needs special treatment.
// EXC_SYSCALL - non-failure
// EXC_MACH_SYSCALL - non-failure
// EXC_RPC_ALERT - non-failure
// EXC_CRASH - see below
// EXC_RESOURCE - non-failure, happens when a process exceeds a resource limit
// EXC_GUARD - see below
//
// EXC_CRASH is a special kind of exception. It is handled by launchd, and treated special by
// the kernel. Seems that we cannot safely catch it - our handler will never be called. This
// is a confirmed kernel bug. Lacking access to EXC_CRASH means we must use signal handlers to
// cover all types of crashes.
// EXC_GUARD is relatively new, and isn't available on all OS versions. You have to be careful,
// becuase you cannot succesfully register hanlders if there are any unrecognized masks. We've
// dropped support for old OS versions that didn't have EXC_GUARD (iOS 5 and below, macOS 10.6 and
// below) so we always add it now
mask = EXC_MASK_BAD_ACCESS | EXC_MASK_BAD_INSTRUCTION | EXC_MASK_ARITHMETIC |
EXC_MASK_BREAKPOINT | EXC_MASK_GUARD;
return mask;
}
static bool FIRCLSMachExceptionThreadStart(FIRCLSMachExceptionReadContext* context) {
pthread_attr_t attr;
if (pthread_attr_init(&attr) != 0) {
FIRCLSSDKLog("pthread_attr_init %s\n", strerror(errno));
return false;
}
if (pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED) != 0) {
FIRCLSSDKLog("pthread_attr_setdetachstate %s\n", strerror(errno));
return false;
}
// Use to pre-allocate a stack for this thread
// The stack must be page-aligned
if (pthread_attr_setstack(&attr, _firclsContext.readonly->machStack,
CLS_MACH_EXCEPTION_HANDLER_STACK_SIZE) != 0) {
FIRCLSSDKLog("pthread_attr_setstack %s\n", strerror(errno));
return false;
}
if (pthread_create(&context->thread, &attr, FIRCLSMachExceptionServer, context) != 0) {
FIRCLSSDKLog("pthread_create %s\n", strerror(errno));
return false;
}
pthread_attr_destroy(&attr);
return true;
}
exception_mask_t FIRCLSMachExceptionMaskForSignal(int signal) {
switch (signal) {
case SIGTRAP:
return EXC_MASK_BREAKPOINT;
case SIGSEGV:
return EXC_MASK_BAD_ACCESS;
case SIGBUS:
return EXC_MASK_BAD_ACCESS;
case SIGILL:
return EXC_MASK_BAD_INSTRUCTION;
case SIGABRT:
return EXC_MASK_CRASH;
case SIGSYS:
return EXC_MASK_CRASH;
case SIGFPE:
return EXC_MASK_ARITHMETIC;
}
return 0;
}
#pragma mark - Message Handling
static void* FIRCLSMachExceptionServer(void* argument) {
FIRCLSMachExceptionReadContext* context = argument;
pthread_setname_np("com.google.firebase.crashlytics.MachExceptionServer");
while (1) {
MachExceptionMessage message;
// read the exception message
if (!FIRCLSMachExceptionReadMessage(context, &message)) {
break;
}
// handle it, and possibly forward
kern_return_t result = FIRCLSMachExceptionDispatchMessage(context, &message);
// and now, reply
if (!FIRCLSMachExceptionReply(context, &message, result)) {
break;
}
}
FIRCLSSDKLog("Mach exception server thread exiting\n");
return NULL;
}
static bool FIRCLSMachExceptionReadMessage(FIRCLSMachExceptionReadContext* context,
MachExceptionMessage* message) {
mach_msg_return_t r;
memset(message, 0, sizeof(MachExceptionMessage));
r = mach_msg(&message->head, MACH_RCV_MSG | MACH_RCV_LARGE, 0, sizeof(MachExceptionMessage),
context->port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
if (r != MACH_MSG_SUCCESS) {
FIRCLSSDKLog("Error receving mach_msg (%d)\n", r);
return false;
}
FIRCLSSDKLog("Accepted mach exception message\n");
return true;
}
static kern_return_t FIRCLSMachExceptionDispatchMessage(FIRCLSMachExceptionReadContext* context,
MachExceptionMessage* message) {
FIRCLSSDKLog("Mach exception: 0x%x, count: %d, code: 0x%llx 0x%llx\n", message->exception,
message->codeCnt, message->codeCnt > 0 ? message->code[0] : -1,
message->codeCnt > 1 ? message->code[1] : -1);
// This will happen if a child process raises an exception, as the exception ports are
// inherited.
if (message->task.name != mach_task_self()) {
FIRCLSSDKLog("Mach exception task mis-match, returning failure\n");
return KERN_FAILURE;
}
FIRCLSSDKLog("Unregistering handler\n");
if (!FIRCLSMachExceptionUnregister(&context->originalPorts, context->mask)) {
FIRCLSSDKLog("Failed to unregister\n");
return KERN_FAILURE;
}
FIRCLSSDKLog("Restoring original signal handlers\n");
if (!FIRCLSSignalSafeInstallPreexistingHandlers(&_firclsContext.readonly->signal)) {
FIRCLSSDKLog("Failed to restore signal handlers\n");
return KERN_FAILURE;
}
FIRCLSSDKLog("Recording mach exception\n");
if (!FIRCLSMachExceptionRecord(context, message)) {
FIRCLSSDKLog("Failed to record mach exception\n");
return KERN_FAILURE;
}
return KERN_SUCCESS;
}
static bool FIRCLSMachExceptionReply(FIRCLSMachExceptionReadContext* context,
MachExceptionMessage* message,
kern_return_t result) {
MachExceptionReply reply;
mach_msg_return_t r;
// prepare the reply
reply.head.msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REMOTE(message->head.msgh_bits), 0);
reply.head.msgh_remote_port = message->head.msgh_remote_port;
reply.head.msgh_size = (mach_msg_size_t)sizeof(MachExceptionReply);
reply.head.msgh_local_port = MACH_PORT_NULL;
reply.head.msgh_id = message->head.msgh_id + 100;
reply.NDR = NDR_record;
reply.retCode = result;
FIRCLSSDKLog("Sending exception reply\n");
// send it
r = mach_msg(&reply.head, MACH_SEND_MSG, reply.head.msgh_size, 0, MACH_PORT_NULL,
MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
if (r != MACH_MSG_SUCCESS) {
FIRCLSSDKLog("mach_msg reply failed (%d)\n", r);
return false;
}
FIRCLSSDKLog("Exception reply delivered\n");
return true;
}
#pragma mark - Registration
static bool FIRCLSMachExceptionRegister(FIRCLSMachExceptionReadContext* context,
exception_mask_t ignoreMask) {
mach_port_t task = mach_task_self();
kern_return_t kr = mach_port_allocate(task, MACH_PORT_RIGHT_RECEIVE, &context->port);
if (kr != KERN_SUCCESS) {
FIRCLSSDKLog("Error: mach_port_allocate failed %d\n", kr);
return false;
}
kr = mach_port_insert_right(task, context->port, context->port, MACH_MSG_TYPE_MAKE_SEND);
if (kr != KERN_SUCCESS) {
FIRCLSSDKLog("Error: mach_port_insert_right failed %d\n", kr);
mach_port_deallocate(task, context->port);
return false;
}
// Get the desired mask, which covers all the mach exceptions we are capable of handling,
// but clear out any that are in our ignore list. We do this by ANDing with the bitwise
// negation. Because we are only clearing bits, there's no way to set an incorrect mask
// using ignoreMask.
context->mask = FIRCLSMachExceptionMask() & ~ignoreMask;
// ORing with MACH_EXCEPTION_CODES will produce 64-bit exception data
kr = task_swap_exception_ports(task, context->mask, context->port,
EXCEPTION_DEFAULT | MACH_EXCEPTION_CODES, THREAD_STATE_NONE,
context->originalPorts.masks, &context->originalPorts.count,
context->originalPorts.ports, context->originalPorts.behaviors,
context->originalPorts.flavors);
if (kr != KERN_SUCCESS) {
FIRCLSSDKLog("Error: task_swap_exception_ports %d\n", kr);
return false;
}
for (int i = 0; i < context->originalPorts.count; ++i) {
FIRCLSSDKLog("original 0x%x 0x%x 0x%x 0x%x\n", context->originalPorts.ports[i],
context->originalPorts.masks[i], context->originalPorts.behaviors[i],
context->originalPorts.flavors[i]);
}
return true;
}
static bool FIRCLSMachExceptionUnregister(FIRCLSMachExceptionOriginalPorts* originalPorts,
exception_mask_t mask) {
kern_return_t kr;
// Re-register all the old ports.
for (mach_msg_type_number_t i = 0; i < originalPorts->count; ++i) {
// clear the bits from this original mask
mask &= ~originalPorts->masks[i];
kr =
task_set_exception_ports(mach_task_self(), originalPorts->masks[i], originalPorts->ports[i],
originalPorts->behaviors[i], originalPorts->flavors[i]);
if (kr != KERN_SUCCESS) {
FIRCLSSDKLog("unable to restore original port: %d", originalPorts->ports[i]);
}
}
// Finally, mark any masks we registered for that do not have an original port as unused.
kr = task_set_exception_ports(mach_task_self(), mask, MACH_PORT_NULL,
EXCEPTION_DEFAULT | MACH_EXCEPTION_CODES, THREAD_STATE_NONE);
if (kr != KERN_SUCCESS) {
FIRCLSSDKLog("unable to unset unregistered mask: 0x%x", mask);
return false;
}
return true;
}
#pragma mark - Recording
static void FIRCLSMachExceptionNameLookup(exception_type_t number,
mach_exception_data_type_t code,
const char** name,
const char** codeName) {
if (!name || !codeName) {
return;
}
*name = NULL;
*codeName = NULL;
switch (number) {
case EXC_BAD_ACCESS:
*name = "EXC_BAD_ACCESS";
switch (code) {
case KERN_INVALID_ADDRESS:
*codeName = "KERN_INVALID_ADDRESS";
break;
case KERN_PROTECTION_FAILURE:
*codeName = "KERN_PROTECTION_FAILURE";
break;
}
break;
case EXC_BAD_INSTRUCTION:
*name = "EXC_BAD_INSTRUCTION";
#if CLS_CPU_X86
*codeName = "EXC_I386_INVOP";
#endif
break;
case EXC_ARITHMETIC:
*name = "EXC_ARITHMETIC";
#if CLS_CPU_X86
switch (code) {
case EXC_I386_DIV:
*codeName = "EXC_I386_DIV";
break;
case EXC_I386_INTO:
*codeName = "EXC_I386_INTO";
break;
case EXC_I386_NOEXT:
*codeName = "EXC_I386_NOEXT";
break;
case EXC_I386_EXTOVR:
*codeName = "EXC_I386_EXTOVR";
break;
case EXC_I386_EXTERR:
*codeName = "EXC_I386_EXTERR";
break;
case EXC_I386_EMERR:
*codeName = "EXC_I386_EMERR";
break;
case EXC_I386_BOUND:
*codeName = "EXC_I386_BOUND";
break;
case EXC_I386_SSEEXTERR:
*codeName = "EXC_I386_SSEEXTERR";
break;
}
#endif
break;
case EXC_BREAKPOINT:
*name = "EXC_BREAKPOINT";
#if CLS_CPU_X86
switch (code) {
case EXC_I386_DIVERR:
*codeName = "EXC_I386_DIVERR";
break;
case EXC_I386_SGLSTP:
*codeName = "EXC_I386_SGLSTP";
break;
case EXC_I386_NMIFLT:
*codeName = "EXC_I386_NMIFLT";
break;
case EXC_I386_BPTFLT:
*codeName = "EXC_I386_BPTFLT";
break;
case EXC_I386_INTOFLT:
*codeName = "EXC_I386_INTOFLT";
break;
case EXC_I386_BOUNDFLT:
*codeName = "EXC_I386_BOUNDFLT";
break;
case EXC_I386_INVOPFLT:
*codeName = "EXC_I386_INVOPFLT";
break;
case EXC_I386_NOEXTFLT:
*codeName = "EXC_I386_NOEXTFLT";
break;
case EXC_I386_EXTOVRFLT:
*codeName = "EXC_I386_EXTOVRFLT";
break;
case EXC_I386_INVTSSFLT:
*codeName = "EXC_I386_INVTSSFLT";
break;
case EXC_I386_SEGNPFLT:
*codeName = "EXC_I386_SEGNPFLT";
break;
case EXC_I386_STKFLT:
*codeName = "EXC_I386_STKFLT";
break;
case EXC_I386_GPFLT:
*codeName = "EXC_I386_GPFLT";
break;
case EXC_I386_PGFLT:
*codeName = "EXC_I386_PGFLT";
break;
case EXC_I386_EXTERRFLT:
*codeName = "EXC_I386_EXTERRFLT";
break;
case EXC_I386_ALIGNFLT:
*codeName = "EXC_I386_ALIGNFLT";
break;
case EXC_I386_ENDPERR:
*codeName = "EXC_I386_ENDPERR";
break;
case EXC_I386_ENOEXTFLT:
*codeName = "EXC_I386_ENOEXTFLT";
break;
}
#endif
break;
case EXC_GUARD:
*name = "EXC_GUARD";
break;
}
}
static bool FIRCLSMachExceptionRecord(FIRCLSMachExceptionReadContext* context,
MachExceptionMessage* message) {
if (!context || !message) {
return false;
}
if (FIRCLSContextMarkAndCheckIfCrashed()) {
FIRCLSSDKLog("Error: aborting mach exception handler because crash has already occurred\n");
exit(1);
return false;
}
FIRCLSFile file;
if (!FIRCLSFileInitWithPath(&file, context->path, false)) {
FIRCLSSDKLog("Unable to open mach exception file\n");
return false;
}
FIRCLSFileWriteSectionStart(&file, "mach_exception");
FIRCLSFileWriteHashStart(&file);
FIRCLSFileWriteHashEntryUint64(&file, "exception", message->exception);
// record the codes
FIRCLSFileWriteHashKey(&file, "codes");
FIRCLSFileWriteArrayStart(&file);
for (mach_msg_type_number_t i = 0; i < message->codeCnt; ++i) {
FIRCLSFileWriteArrayEntryUint64(&file, message->code[i]);
}
FIRCLSFileWriteArrayEnd(&file);
const char* name = NULL;
const char* codeName = NULL;
FIRCLSMachExceptionNameLookup(message->exception, message->codeCnt > 0 ? message->code[0] : 0,
&name, &codeName);
FIRCLSFileWriteHashEntryString(&file, "name", name);
FIRCLSFileWriteHashEntryString(&file, "code_name", codeName);
FIRCLSFileWriteHashEntryUint64(&file, "original_ports", context->originalPorts.count);
FIRCLSFileWriteHashEntryUint64(&file, "time", time(NULL));
FIRCLSFileWriteHashEnd(&file);
FIRCLSFileWriteSectionEnd(&file);
FIRCLSHandler(&file, message->thread.name, NULL);
FIRCLSFileClose(&file);
return true;
}
#else
INJECT_STRIP_SYMBOL(cls_mach_exception)
#endif
| {
"content_hash": "1998186d5de6f9950c8a3f0c1938e326",
"timestamp": "",
"source": "github",
"line_count": 501,
"max_line_length": 100,
"avg_line_length": 33.20758483033932,
"alnum_prop": 0.6396585922942838,
"repo_name": "edx/edx-app-ios",
"id": "312724c91386e76594b0f96561679d3ebef583ad",
"size": "17853",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Pods/FirebaseCrashlytics/Crashlytics/Crashlytics/Handlers/FIRCLSMachException.c",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "13099"
},
{
"name": "CSS",
"bytes": "2524"
},
{
"name": "HTML",
"bytes": "3194251"
},
{
"name": "JavaScript",
"bytes": "1329"
},
{
"name": "Objective-C",
"bytes": "1274825"
},
{
"name": "Python",
"bytes": "8765"
},
{
"name": "Rich Text Format",
"bytes": "623"
},
{
"name": "Ruby",
"bytes": "3047"
},
{
"name": "Shell",
"bytes": "1043"
},
{
"name": "Swift",
"bytes": "2647828"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Mips.Commands;
namespace MipsTest
{
[TestClass]
public class MipsCommadMapTest
{
private readonly byte[][] map;
MipsCommandMap Default = null;
[TestMethod]
public void WriteHeaderTest()
{
}
[TestMethod]
public void CreateImplTest()
{
Dictionary<string, string> caseInsensitiveOverrides = new Dictionary<string, string>();
HashSet<MipsCommand> exclusions = new HashSet<MipsCommand>();
caseInsensitiveOverrides.Add("GERR", "GERR");
caseInsensitiveOverrides.Add("About", "About");
exclusions.Add(MipsCommand.ABOUT);
var commands = (MipsCommand[])Enum.GetValues(typeof(MipsCommand));
byte[][] map = new byte[commands.Length][];
bool haveDelta = false;
for (int i = 0; i < commands.Length; i++)
{
int idx = (int)commands[i];
string name = commands[i].ToString(), value = name;
if (exclusions != null && exclusions.Contains(commands[i]))
{
map[idx] = null;
}
else
{
if (caseInsensitiveOverrides != null)
{
string tmp;
if (caseInsensitiveOverrides.TryGetValue(name, out tmp))
{
value = tmp;
}
}
byte[] val = string.IsNullOrWhiteSpace(value) ? null : Encoding.UTF8.GetBytes(value);
map[idx] = val;
}
}
if ( Default != null)
Default = null;
var command = MipsCommand.ABOUT;
byte[] vBytes = map[(int)command];
var result = vBytes;
// return Default;
//return new CommandMap(map);
}
[TestMethod]
public void AssertAvailableTest()
{
//if (map[(int)command] == null) throw new NotImplementedException(command.ToString());
}
[TestMethod]
public void GetBytesTest()
{
var commands = (MipsCommand[])Enum.GetValues(typeof(MipsCommand));
byte[][] map = new byte[commands.Length][];
var command = MipsCommand.ABOUT;
byte[] vBytes = map[(int)command];
var result = vBytes;
}
[TestMethod]
public void IsAvailable(MipsCommand command)
{
//return map[(int)command] != null;
}
[TestMethod]
public void CommandEnumerableValueMessageTest()
{
var command = MipsCommand.SDCBALL;
IEnumerable<int> values = from value in Enumerable.Range(1, 32) select value;
byte[][] arrayvalue=new byte[values.Count()][];
int i = 0;
foreach (var value in values)
{
byte[] result=Encoding.ASCII.GetBytes(value.ToString());
arrayvalue[i] = result;
i++;
}
}
}
}
| {
"content_hash": "1cff4c9286b84aef11162c2cbdc8efbd",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 90,
"avg_line_length": 21.837606837606838,
"alnum_prop": 0.650880626223092,
"repo_name": "PNNL-Comp-Mass-Spec/AmpsSDK",
"id": "e925f9501fb2ab0d6f3b747f585408e01b6734e4",
"size": "2557",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Mips-net-tests/MipsMessageTest.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "433918"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<!-- Encoding Hint: 雀の往来 -->
<project>
<property name="jnlp.title" value="JST OverlayLayoutでCompoundButton" />
<property name="jnlp.Name" value="CompoundButton" />
<property name="jnlp.name" value="compoundbutton" />
<property name="jnlp.codebase" value="http://ateraimemo.com/swing/${jnlp.name}/" />
<property name="jnlp.homepage" value="http://ateraimemo.com/Swing/${jnlp.Name}.html" />
</project>
| {
"content_hash": "cab54d0254b2a37c66e5bef9602775ae",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 88,
"avg_line_length": 50.55555555555556,
"alnum_prop": 0.6835164835164835,
"repo_name": "mhcrnl/java-swing-tips",
"id": "4cb75d5810bd0ae48a33f2e87d1a9ddbb71bc047",
"size": "465",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "CompoundButton/config/jnlp.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "404976"
},
{
"name": "HTML",
"bytes": "213180"
},
{
"name": "Java",
"bytes": "3865671"
},
{
"name": "Shell",
"bytes": "456768"
}
],
"symlink_target": ""
} |
# direction-mixins
Direction-mixins is a collection of mixins and functions you can use to have two separate css files but only have to write (and thus maintain) one file.
Instead of using the traditional declarations you can use mixins that will transform your values based on a variable.
## Setup
### Step 1
Download them or add them to your project with npm:
```
npm install --save direction-mixins
```
#### Step 2
Create a partial which will contain all your styling and import the mixins as you were creating a stylesheet for one direction (e.g `_screen.scss`).
#### Step 3
Create two files (e.g. `screen-ltr.scss` and `screen-rtl.scss` and set the direction variable to the correct direction. Your file will look something like this:
```
$direction: rtl;
@import "screen";
```
#### Step 4
Start using mixins and functions for your declarations that depend on horizontal position (e.g. margins, paddings, left and right positions. Don't forget to add the direction variable to body.
```
body {
direction: $direction;
}
```
## Basic examples for declarations
This package contains a set of mixins that can be used for both short-hand and single-hand properties. Let's say you want to have a margin on the left of 20 pixels:
### Shorthand properties
```
@include margin(0 0 0 20px);
```
This will be transformed to:
```
margin: 0 0 0 20px; /* LTR direction */
```
And for the RTL version of your styling:
```
margin: 0 20px 0 0; /* RTL direction */
```
#### Single properties
Or you could use the margin-right mixin
```
@include margin-right(20px);
```
This will change the right margin to a left one on RTL
```
margin-right: 20px; /* LTR direction */
```
```
margin-left: 20px; /* RTL direction */
```
## Basic examples of transform values
In order to add direction-aware transform you can use functions:
```
transform: translate-xy(-50%, -50%);
```
```
transform: translate-x(-50%);
```
This will change the x-offset to a positive number for RTL
```
transform: translate(50%, -50%);
```
```
transform: translateX(50%);
```
If you need to flip an element (e.g. an icon used in breadcrumbs) you can add the flip function to the transform properties:
```
transform: flip();
```
This will use ```transform: scaleX(-1)``` in order to flip the element on the x-axis.
*Please note that this might cause conflicts when using scale within the same declaration.*
## List of Mixins and Functions
- [margin](./mixins/_mixin-margin.scss)
- [margin-left](./mixins/_mixin-margin-left.scss)
- [margin-right](./mixins/_mixin-margin-right.scss)
- [padding](./mixins/_mixin-padding.scss)
- [padding-left](./mixins/_mixin-padding-left.scss)
- [padding-right](./mixins/_mixin-padding-right.scss)
- [right](./mixins/_mixin-right.scss)
- [left](./mixins/_mixin-left.scss)
- [border-color](./mixins/_mixin-border-color.scss)
- [border-width](./mixins/_mixin-border-width.scss)
- [border-style](./mixins/_mixin-border-style.scss)
- [border-radius](./mixins/_mixin-border-radius.scss)
- [box-shadow](./mixins/_mixin-box-shadow.scss)
- [text-align](./mixins/_mixin-text-align.scss)
- [text-shadow](./mixins/_mixin-text-shadow.scss)
- [clear](./function/_mixin-clear.scss)
- [float](./function/_mixin-float.scss)
- [flip](./function/_function-flip.scss)
- [animation-direction-normal](./function/_function-animation-direction-normal.scss)
- [animation-direction-reverse](./function/_function-animation-direction-reverse.scss)
- [translate-x](./function/_function-translate-x.scss)
- [translate-xy](./function/_function-translate-xy.scss)
- [translate-3d](./function/_function-translate-3d.scss)
- [rotate-me](./function/_function-rotate-me.scss)
## To-do
- transform-origin
| {
"content_hash": "e82e75c094c0058184aff5be86bd88c4",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 192,
"avg_line_length": 26.753623188405797,
"alnum_prop": 0.7123510292524377,
"repo_name": "pigeonfresh/direction-mixins",
"id": "ce1b9cc92ba8ce6bb7da491c1a3e99624d4d1fca",
"size": "3692",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "7992"
}
],
"symlink_target": ""
} |
yii-bootstrap-fork
==================
A fork of the excellent yii-bootstrap library written by Christoffer Niska
http://www.cniska.net/yii-bootstrap/
I'll endevour to keep this fork up to date. | {
"content_hash": "a4bf6920c9dfc0dfb7a59f4b1ee83eec",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 74,
"avg_line_length": 24.5,
"alnum_prop": 0.7142857142857143,
"repo_name": "Alan01252/yii-bootstrap-fork",
"id": "6a35383cbeead1dbef9a00cfeb332985dc39d75a",
"size": "196",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
FROM microsoft/dotnet:1.1-runtime
ARG source
WORKDIR /app
COPY ${source:-obj/Docker/publish} .
ENTRYPOINT ["dotnet", "RESTGrid.MySqlEngine.Workflow.dll"]
| {
"content_hash": "5f4042779fcdfcda76be05839a6ee83d",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 58,
"avg_line_length": 30.8,
"alnum_prop": 0.7727272727272727,
"repo_name": "WorkMaze/RESTGrid",
"id": "44edc3d065a1357cb1fde978b8176685c9f7ba8e",
"size": "154",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "RESTGrid/RESTGrid.MySqlEngine.Workflow/Dockerfile",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "78761"
},
{
"name": "CSS",
"bytes": "687"
},
{
"name": "JavaScript",
"bytes": "33"
},
{
"name": "SQLPL",
"bytes": "15386"
}
],
"symlink_target": ""
} |
import { Emitter } from '../../../base/common/event.js';
import { Range } from '../../common/core/range.js';
import { findFirstInSorted } from '../../../base/common/arrays.js';
var HiddenRangeModel = /** @class */ (function () {
function HiddenRangeModel(model) {
var _this = this;
this._updateEventEmitter = new Emitter();
this._foldingModel = model;
this._foldingModelListener = model.onDidChange(function (_) { return _this.updateHiddenRanges(); });
this._hiddenRanges = [];
if (model.regions.length) {
this.updateHiddenRanges();
}
}
Object.defineProperty(HiddenRangeModel.prototype, "onDidChange", {
get: function () { return this._updateEventEmitter.event; },
enumerable: true,
configurable: true
});
Object.defineProperty(HiddenRangeModel.prototype, "hiddenRanges", {
get: function () { return this._hiddenRanges; },
enumerable: true,
configurable: true
});
HiddenRangeModel.prototype.updateHiddenRanges = function () {
var updateHiddenAreas = false;
var newHiddenAreas = [];
var i = 0; // index into hidden
var k = 0;
var lastCollapsedStart = Number.MAX_VALUE;
var lastCollapsedEnd = -1;
var ranges = this._foldingModel.regions;
for (; i < ranges.length; i++) {
if (!ranges.isCollapsed(i)) {
continue;
}
var startLineNumber = ranges.getStartLineNumber(i) + 1; // the first line is not hidden
var endLineNumber = ranges.getEndLineNumber(i);
if (lastCollapsedStart <= startLineNumber && endLineNumber <= lastCollapsedEnd) {
// ignore ranges contained in collapsed regions
continue;
}
if (!updateHiddenAreas && k < this._hiddenRanges.length && this._hiddenRanges[k].startLineNumber === startLineNumber && this._hiddenRanges[k].endLineNumber === endLineNumber) {
// reuse the old ranges
newHiddenAreas.push(this._hiddenRanges[k]);
k++;
}
else {
updateHiddenAreas = true;
newHiddenAreas.push(new Range(startLineNumber, 1, endLineNumber, 1));
}
lastCollapsedStart = startLineNumber;
lastCollapsedEnd = endLineNumber;
}
if (updateHiddenAreas || k < this._hiddenRanges.length) {
this.applyHiddenRanges(newHiddenAreas);
}
};
HiddenRangeModel.prototype.applyMemento = function (state) {
if (!Array.isArray(state) || state.length === 0) {
return false;
}
var hiddenRanges = [];
for (var _i = 0, state_1 = state; _i < state_1.length; _i++) {
var r = state_1[_i];
if (!r.startLineNumber || !r.endLineNumber) {
return false;
}
hiddenRanges.push(new Range(r.startLineNumber + 1, 1, r.endLineNumber, 1));
}
this.applyHiddenRanges(hiddenRanges);
return true;
};
/**
* Collapse state memento, for persistence only, only used if folding model is not yet initialized
*/
HiddenRangeModel.prototype.getMemento = function () {
return this._hiddenRanges.map(function (r) { return ({ startLineNumber: r.startLineNumber - 1, endLineNumber: r.endLineNumber }); });
};
HiddenRangeModel.prototype.applyHiddenRanges = function (newHiddenAreas) {
this._hiddenRanges = newHiddenAreas;
this._updateEventEmitter.fire(newHiddenAreas);
};
HiddenRangeModel.prototype.hasRanges = function () {
return this._hiddenRanges.length > 0;
};
HiddenRangeModel.prototype.isHidden = function (line) {
return findRange(this._hiddenRanges, line) !== null;
};
HiddenRangeModel.prototype.adjustSelections = function (selections) {
var _this = this;
var hasChanges = false;
var editorModel = this._foldingModel.textModel;
var lastRange = null;
var adjustLine = function (line) {
if (!lastRange || !isInside(line, lastRange)) {
lastRange = findRange(_this._hiddenRanges, line);
}
if (lastRange) {
return lastRange.startLineNumber - 1;
}
return null;
};
for (var i = 0, len = selections.length; i < len; i++) {
var selection = selections[i];
var adjustedStartLine = adjustLine(selection.startLineNumber);
if (adjustedStartLine) {
selection = selection.setStartPosition(adjustedStartLine, editorModel.getLineMaxColumn(adjustedStartLine));
hasChanges = true;
}
var adjustedEndLine = adjustLine(selection.endLineNumber);
if (adjustedEndLine) {
selection = selection.setEndPosition(adjustedEndLine, editorModel.getLineMaxColumn(adjustedEndLine));
hasChanges = true;
}
selections[i] = selection;
}
return hasChanges;
};
HiddenRangeModel.prototype.dispose = function () {
if (this.hiddenRanges.length > 0) {
this._hiddenRanges = [];
this._updateEventEmitter.fire(this._hiddenRanges);
}
if (this._foldingModelListener) {
this._foldingModelListener.dispose();
this._foldingModelListener = null;
}
};
return HiddenRangeModel;
}());
export { HiddenRangeModel };
function isInside(line, range) {
return line >= range.startLineNumber && line <= range.endLineNumber;
}
function findRange(ranges, line) {
var i = findFirstInSorted(ranges, function (r) { return line < r.startLineNumber; }) - 1;
if (i >= 0 && ranges[i].endLineNumber >= line) {
return ranges[i];
}
return null;
}
| {
"content_hash": "203f4d7dc73b7ee4d55b2889e111d25c",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 188,
"avg_line_length": 41.37062937062937,
"alnum_prop": 0.591446923597025,
"repo_name": "sandroe2000/woolaweaver",
"id": "eeefeb6cf8636057412e03622a6e5c56fb8f6be7",
"size": "6267",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "assets/monaco-editor/esm/vs/editor/contrib/folding/hiddenRangeModel.js",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "663512"
},
{
"name": "HTML",
"bytes": "79541"
},
{
"name": "JavaScript",
"bytes": "29965175"
}
],
"symlink_target": ""
} |
// Licensed under MIT No Attribution, see LICENSE file at the root.
// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet.
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using JetBrains.Annotations;
using UnitsNet.InternalHelpers;
using UnitsNet.Units;
using UnitTypeToLookup = System.Collections.Generic.Dictionary<System.Type, UnitsNet.UnitValueAbbreviationLookup>;
// ReSharper disable once CheckNamespace
namespace UnitsNet
{
public sealed partial class UnitAbbreviationsCache
{
private readonly Dictionary<IFormatProvider, UnitTypeToLookup> _lookupsForCulture;
/// <summary>
/// Fallback culture used by <see cref="GetUnitAbbreviations{TUnitType}" /> and <see cref="GetDefaultAbbreviation{TUnitType}" />
/// if no abbreviations are found with a given culture.
/// </summary>
/// <example>
/// User wants to call <see cref="UnitParser.Parse{TUnitType}" /> or <see cref="Length.ToString()" /> with Russian
/// culture, but no translation is defined, so we return the US English definition as a last resort. If it's not
/// defined there either, an exception is thrown.
/// </example>
private static readonly CultureInfo FallbackCulture = new CultureInfo("en-US");
public static UnitAbbreviationsCache Default { get; }
public UnitAbbreviationsCache()
{
_lookupsForCulture = new Dictionary<IFormatProvider, UnitTypeToLookup>();
LoadGeneratedAbbreviations();
}
static UnitAbbreviationsCache()
{
Default = new UnitAbbreviationsCache();
}
private void LoadGeneratedAbbreviations()
{
foreach(var localization in GeneratedLocalizations)
{
var culture = new CultureInfo(localization.CultureName);
MapUnitToAbbreviation(localization.UnitType, localization.UnitValue, culture, localization.UnitAbbreviations);
}
}
/// <summary>
/// Adds one or more unit abbreviation for the given unit enum value.
/// This is used to dynamically add abbreviations for existing unit enums such as <see cref="LengthUnit"/> or to extend with third-party unit enums
/// in order to <see cref="UnitParser.Parse{TUnitType}"/> or <see cref="GetDefaultAbbreviation{TUnitType}"/> on them later.
/// </summary>
/// <param name="unitType">The unit enum type.</param>
/// <param name="unitValue">The unit enum value.</param>
/// <param name="formatProvider">The format provider to use for lookup. Defaults to <see cref="GlobalConfiguration.DefaultCulture" /> if null.</param>
/// <param name="abbreviations">Unit abbreviations to add.</param>
// Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods
private void MapUnitToAbbreviation(Type unitType, int unitValue, IFormatProvider formatProvider, [NotNull] params string[] abbreviations)
{
PerformAbbreviationMapping(unitType, unitValue, formatProvider, false, abbreviations);
}
private void PerformAbbreviationMapping(Type unitType, int unitValue, IFormatProvider formatProvider, bool setAsDefault, [NotNull] params string[] abbreviations)
{
if (!unitType.Wrap().IsEnum)
throw new ArgumentException("Must be an enum type.", nameof(unitType));
if (abbreviations == null)
throw new ArgumentNullException(nameof(abbreviations));
formatProvider = formatProvider ?? GlobalConfiguration.DefaultCulture;
if (!_lookupsForCulture.TryGetValue(formatProvider, out var quantitiesForProvider))
quantitiesForProvider = _lookupsForCulture[formatProvider] = new UnitTypeToLookup();
if (!quantitiesForProvider.TryGetValue(unitType, out var unitToAbbreviations))
unitToAbbreviations = quantitiesForProvider[unitType] = new UnitValueAbbreviationLookup();
foreach (var abbr in abbreviations)
{
unitToAbbreviations.Add(unitValue, abbr, setAsDefault);
}
}
/// <summary>
/// Gets the default abbreviation for a given unit. If a unit has more than one abbreviation defined, then it returns the first one.
/// Example: GetDefaultAbbreviation<LengthUnit>(LengthUnit.Kilometer) => "km"
/// </summary>
/// <param name="unit">The unit enum value.</param>
/// <param name="formatProvider">The format provider to use for lookup. Defaults to <see cref="GlobalConfiguration.DefaultCulture" /> if null.</param>
/// <typeparam name="TUnitType">The type of unit enum.</typeparam>
/// <returns>The default unit abbreviation string.</returns>
// Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods
internal string GetDefaultAbbreviation<TUnitType>(TUnitType unit, IFormatProvider formatProvider = null) where TUnitType : Enum
{
var unitType = typeof(TUnitType);
if(!TryGetUnitValueAbbreviationLookup(unitType, formatProvider, out var lookup))
{
if(formatProvider != FallbackCulture)
return GetDefaultAbbreviation(unit, FallbackCulture);
else
throw new NotImplementedException($"No abbreviation is specified for {unitType.Name}.{unit}");
}
var abbreviations = lookup.GetAbbreviationsForUnit(unit);
if(abbreviations.Count == 0)
{
if(formatProvider != FallbackCulture)
return GetDefaultAbbreviation(unit, FallbackCulture);
else
throw new NotImplementedException($"No abbreviation is specified for {unitType.Name}.{unit}");
}
return abbreviations.First();
}
/// <summary>
/// Gets the default abbreviation for a given unit type and its numeric enum value.
/// If a unit has more than one abbreviation defined, then it returns the first one.
/// Example: GetDefaultAbbreviation<LengthUnit>(typeof(LengthUnit), 1) => "cm"
/// </summary>
/// <param name="unitType">The unit enum type.</param>
/// <param name="unitValue">The unit enum value.</param>
/// <param name="formatProvider">The format provider to use for lookup. Defaults to <see cref="GlobalConfiguration.DefaultCulture" /> if null.</param>
/// <returns>The default unit abbreviation string.</returns>
internal string GetDefaultAbbreviation(Type unitType, int unitValue, IFormatProvider formatProvider = null)
{
if(!TryGetUnitValueAbbreviationLookup(unitType, formatProvider, out var lookup))
{
if(formatProvider != FallbackCulture)
return GetDefaultAbbreviation(unitType, unitValue, FallbackCulture);
else
throw new NotImplementedException($"No abbreviation is specified for {unitType.Name} with numeric value {unitValue}.");
}
var abbreviations = lookup.GetAbbreviationsForUnit(unitValue);
if(abbreviations.Count == 0)
{
if(formatProvider != FallbackCulture)
return GetDefaultAbbreviation(unitType, unitValue, FallbackCulture);
else
throw new NotImplementedException($"No abbreviation is specified for {unitType.Name} with numeric value {unitValue}.");
}
return abbreviations.First();
}
/// <summary>
/// Get all abbreviations for unit.
/// </summary>
/// <typeparam name="TUnitType">Enum type for units.</typeparam>
/// <param name="unit">Enum value for unit.</param>
/// <param name="formatProvider">The format provider to use for lookup. Defaults to <see cref="GlobalConfiguration.DefaultCulture" /> if null.</param>
/// <returns>Unit abbreviations associated with unit.</returns>
// Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods
internal string[] GetUnitAbbreviations<TUnitType>(TUnitType unit, IFormatProvider formatProvider = null) where TUnitType : Enum
{
return GetUnitAbbreviations(typeof(TUnitType), Convert.ToInt32(unit), formatProvider);
}
/// <summary>
/// Get all abbreviations for unit.
/// </summary>
/// <param name="unitType">Enum type for unit.</param>
/// <param name="unitValue">Enum value for unit.</param>
/// <param name="formatProvider">The format provider to use for lookup. Defaults to <see cref="GlobalConfiguration.DefaultCulture" /> if null.</param>
/// <returns>Unit abbreviations associated with unit.</returns>
private string[] GetUnitAbbreviations(Type unitType, int unitValue, IFormatProvider formatProvider = null)
{
formatProvider = formatProvider ?? GlobalConfiguration.DefaultCulture;
if(!TryGetUnitValueAbbreviationLookup(unitType, formatProvider, out var lookup))
return formatProvider != FallbackCulture ? GetUnitAbbreviations(unitType, unitValue, FallbackCulture) : new string[] { };
var abbreviations = lookup.GetAbbreviationsForUnit(unitValue);
if(abbreviations.Count == 0)
return formatProvider != FallbackCulture ? GetUnitAbbreviations(unitType, unitValue, FallbackCulture) : new string[] { };
return abbreviations.ToArray();
}
/// <summary>
/// Get all abbreviations for all units of a quantity.
/// </summary>
/// <param name="unitEnumType">Enum type for unit.</param>
/// <param name="formatProvider">The format provider to use for lookup. Defaults to <see cref="GlobalConfiguration.DefaultCulture" /> if null.</param>
/// <returns>Unit abbreviations associated with unit.</returns>
internal string[] GetAllUnitAbbreviationsForQuantity(Type unitEnumType, IFormatProvider formatProvider = null)
{
formatProvider = formatProvider ?? GlobalConfiguration.DefaultCulture;
if(!TryGetUnitValueAbbreviationLookup(unitEnumType, formatProvider, out var lookup))
return formatProvider != FallbackCulture ? GetAllUnitAbbreviationsForQuantity(unitEnumType, FallbackCulture) : new string[] { };
return lookup.GetAllUnitAbbreviationsForQuantity();
}
internal bool TryGetUnitValueAbbreviationLookup(Type unitType, IFormatProvider formatProvider, out UnitValueAbbreviationLookup unitToAbbreviations)
{
unitToAbbreviations = null;
formatProvider = formatProvider ?? GlobalConfiguration.DefaultCulture;
if(!_lookupsForCulture.TryGetValue(formatProvider, out var quantitiesForProvider))
return formatProvider != FallbackCulture ? TryGetUnitValueAbbreviationLookup(unitType, FallbackCulture, out unitToAbbreviations) : false;
if(!quantitiesForProvider.TryGetValue(unitType, out unitToAbbreviations))
return formatProvider != FallbackCulture ? TryGetUnitValueAbbreviationLookup(unitType, FallbackCulture, out unitToAbbreviations) : false;
return true;
}
}
}
| {
"content_hash": "f515d7d1f09f406d1033f2efa9244b34",
"timestamp": "",
"source": "github",
"line_count": 221,
"max_line_length": 178,
"avg_line_length": 53.69683257918552,
"alnum_prop": 0.666132973792871,
"repo_name": "anjdreas/UnitsNet",
"id": "ab26d1f5e9eba86fb31a7f86525f04a06acfdcaf",
"size": "11869",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "UnitsNet.WindowsRuntimeComponent/CustomCode/UnitAbbreviationsCache.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "1734"
},
{
"name": "C#",
"bytes": "4386309"
},
{
"name": "PowerShell",
"bytes": "83051"
},
{
"name": "Shell",
"bytes": "34"
}
],
"symlink_target": ""
} |
<?php
namespace app\controllers;
use Yii;
use app\models\Topics;
use yii\data\ActiveDataProvider;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use yii\filters\AccessControl;
/**
* TopicsController implements the CRUD actions for Topics model.
*/
class TopicsController extends Controller
{
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['post'],
],
],
'access' => [
'class' => AccessControl::className(),
'only'=>['index','create','delete','update'],
'rules' => [
[
'allow' => true,
'roles' => ['@']
],
]
]
];
}
/**
* Lists all Topics models.
* @return mixed
*/
public function actionIndex()
{
$dataProvider = new ActiveDataProvider([
'query' => Topics::find(),
]);
return $this->render('index', [
'dataProvider' => $dataProvider,
]);
}
/**
* Creates a new Topics model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new Topics();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['index']);
} else {
return $this->render('create', [
'model' => $model,
]);
}
}
/**
* Updates an existing Topics model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
*/
public function actionUpdate($id)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['index']);
} else {
return $this->render('update', [
'model' => $model,
]);
}
}
/**
* Deletes an existing Topics model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
/**
* Finds the Topics model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return Topics the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = Topics::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
}
| {
"content_hash": "ee4f745e200edd72da06060bf9741cb9",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 85,
"avg_line_length": 25.991596638655462,
"alnum_prop": 0.5021015195602975,
"repo_name": "themightydeity/unadb",
"id": "27ee45368804f350e15f4f63671c837c4480ff85",
"size": "3093",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "controllers/TopicsController.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Batchfile",
"bytes": "1050"
},
{
"name": "CSS",
"bytes": "1455"
},
{
"name": "PHP",
"bytes": "77591"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="kernel.root_dir">C:\wamp\www\infographicsBundle\app</parameter>
<parameter key="kernel.environment">dev</parameter>
<parameter key="kernel.debug">true</parameter>
<parameter key="kernel.name">app</parameter>
<parameter key="kernel.cache_dir">C:\wamp\www\infographicsBundle\app\cache\dev</parameter>
<parameter key="kernel.logs_dir">C:\wamp\www\infographicsBundle\app\logs</parameter>
<parameter key="kernel.bundles" type="collection">
<parameter key="FrameworkBundle">Symfony\Bundle\FrameworkBundle\FrameworkBundle</parameter>
<parameter key="SecurityBundle">Symfony\Bundle\SecurityBundle\SecurityBundle</parameter>
<parameter key="TwigBundle">Symfony\Bundle\TwigBundle\TwigBundle</parameter>
<parameter key="MonologBundle">Symfony\Bundle\MonologBundle\MonologBundle</parameter>
<parameter key="SwiftmailerBundle">Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle</parameter>
<parameter key="AsseticBundle">Symfony\Bundle\AsseticBundle\AsseticBundle</parameter>
<parameter key="DoctrineBundle">Doctrine\Bundle\DoctrineBundle\DoctrineBundle</parameter>
<parameter key="SensioFrameworkExtraBundle">Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle</parameter>
<parameter key="DebugBundle">Symfony\Bundle\DebugBundle\DebugBundle</parameter>
<parameter key="WebProfilerBundle">Symfony\Bundle\WebProfilerBundle\WebProfilerBundle</parameter>
<parameter key="SensioDistributionBundle">Sensio\Bundle\DistributionBundle\SensioDistributionBundle</parameter>
<parameter key="SensioGeneratorBundle">Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle</parameter>
</parameter>
<parameter key="kernel.charset">UTF-8</parameter>
<parameter key="kernel.container_class">appDevDebugProjectContainer</parameter>
<parameter key="database_driver">pdo_mysql</parameter>
<parameter key="database_host">127.0.0.1</parameter>
<parameter key="database_port">null</parameter>
<parameter key="database_name">symfony</parameter>
<parameter key="database_user">root</parameter>
<parameter key="database_password">null</parameter>
<parameter key="mailer_transport">smtp</parameter>
<parameter key="mailer_host">127.0.0.1</parameter>
<parameter key="mailer_user">null</parameter>
<parameter key="mailer_password">null</parameter>
<parameter key="locale">en</parameter>
<parameter key="secret">ThisTokenIsNotSoSecretChangeIt</parameter>
<parameter key="controller_resolver.class">Symfony\Bundle\FrameworkBundle\Controller\ControllerResolver</parameter>
<parameter key="controller_name_converter.class">Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser</parameter>
<parameter key="response_listener.class">Symfony\Component\HttpKernel\EventListener\ResponseListener</parameter>
<parameter key="streamed_response_listener.class">Symfony\Component\HttpKernel\EventListener\StreamedResponseListener</parameter>
<parameter key="locale_listener.class">Symfony\Component\HttpKernel\EventListener\LocaleListener</parameter>
<parameter key="event_dispatcher.class">Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher</parameter>
<parameter key="http_kernel.class">Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel</parameter>
<parameter key="filesystem.class">Symfony\Component\Filesystem\Filesystem</parameter>
<parameter key="cache_warmer.class">Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate</parameter>
<parameter key="cache_clearer.class">Symfony\Component\HttpKernel\CacheClearer\ChainCacheClearer</parameter>
<parameter key="file_locator.class">Symfony\Component\HttpKernel\Config\FileLocator</parameter>
<parameter key="uri_signer.class">Symfony\Component\HttpKernel\UriSigner</parameter>
<parameter key="request_stack.class">Symfony\Component\HttpFoundation\RequestStack</parameter>
<parameter key="fragment.handler.class">Symfony\Component\HttpKernel\Fragment\FragmentHandler</parameter>
<parameter key="fragment.renderer.inline.class">Symfony\Component\HttpKernel\Fragment\InlineFragmentRenderer</parameter>
<parameter key="fragment.renderer.hinclude.class">Symfony\Bundle\FrameworkBundle\Fragment\ContainerAwareHIncludeFragmentRenderer</parameter>
<parameter key="fragment.renderer.hinclude.global_template">null</parameter>
<parameter key="fragment.renderer.esi.class">Symfony\Component\HttpKernel\Fragment\EsiFragmentRenderer</parameter>
<parameter key="fragment.path">/_fragment</parameter>
<parameter key="translator.class">Symfony\Bundle\FrameworkBundle\Translation\Translator</parameter>
<parameter key="translator.identity.class">Symfony\Component\Translation\IdentityTranslator</parameter>
<parameter key="translator.selector.class">Symfony\Component\Translation\MessageSelector</parameter>
<parameter key="translation.loader.php.class">Symfony\Component\Translation\Loader\PhpFileLoader</parameter>
<parameter key="translation.loader.yml.class">Symfony\Component\Translation\Loader\YamlFileLoader</parameter>
<parameter key="translation.loader.xliff.class">Symfony\Component\Translation\Loader\XliffFileLoader</parameter>
<parameter key="translation.loader.po.class">Symfony\Component\Translation\Loader\PoFileLoader</parameter>
<parameter key="translation.loader.mo.class">Symfony\Component\Translation\Loader\MoFileLoader</parameter>
<parameter key="translation.loader.qt.class">Symfony\Component\Translation\Loader\QtFileLoader</parameter>
<parameter key="translation.loader.csv.class">Symfony\Component\Translation\Loader\CsvFileLoader</parameter>
<parameter key="translation.loader.res.class">Symfony\Component\Translation\Loader\IcuResFileLoader</parameter>
<parameter key="translation.loader.dat.class">Symfony\Component\Translation\Loader\IcuDatFileLoader</parameter>
<parameter key="translation.loader.ini.class">Symfony\Component\Translation\Loader\IniFileLoader</parameter>
<parameter key="translation.loader.json.class">Symfony\Component\Translation\Loader\JsonFileLoader</parameter>
<parameter key="translation.dumper.php.class">Symfony\Component\Translation\Dumper\PhpFileDumper</parameter>
<parameter key="translation.dumper.xliff.class">Symfony\Component\Translation\Dumper\XliffFileDumper</parameter>
<parameter key="translation.dumper.po.class">Symfony\Component\Translation\Dumper\PoFileDumper</parameter>
<parameter key="translation.dumper.mo.class">Symfony\Component\Translation\Dumper\MoFileDumper</parameter>
<parameter key="translation.dumper.yml.class">Symfony\Component\Translation\Dumper\YamlFileDumper</parameter>
<parameter key="translation.dumper.qt.class">Symfony\Component\Translation\Dumper\QtFileDumper</parameter>
<parameter key="translation.dumper.csv.class">Symfony\Component\Translation\Dumper\CsvFileDumper</parameter>
<parameter key="translation.dumper.ini.class">Symfony\Component\Translation\Dumper\IniFileDumper</parameter>
<parameter key="translation.dumper.json.class">Symfony\Component\Translation\Dumper\JsonFileDumper</parameter>
<parameter key="translation.dumper.res.class">Symfony\Component\Translation\Dumper\IcuResFileDumper</parameter>
<parameter key="translation.extractor.php.class">Symfony\Bundle\FrameworkBundle\Translation\PhpExtractor</parameter>
<parameter key="translation.loader.class">Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader</parameter>
<parameter key="translation.extractor.class">Symfony\Component\Translation\Extractor\ChainExtractor</parameter>
<parameter key="translation.writer.class">Symfony\Component\Translation\Writer\TranslationWriter</parameter>
<parameter key="property_accessor.class">Symfony\Component\PropertyAccess\PropertyAccessor</parameter>
<parameter key="kernel.secret">ThisTokenIsNotSoSecretChangeIt</parameter>
<parameter key="kernel.http_method_override">true</parameter>
<parameter key="kernel.trusted_hosts" type="collection"/>
<parameter key="kernel.trusted_proxies" type="collection"/>
<parameter key="kernel.default_locale">en</parameter>
<parameter key="session.class">Symfony\Component\HttpFoundation\Session\Session</parameter>
<parameter key="session.flashbag.class">Symfony\Component\HttpFoundation\Session\Flash\FlashBag</parameter>
<parameter key="session.attribute_bag.class">Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag</parameter>
<parameter key="session.storage.metadata_bag.class">Symfony\Component\HttpFoundation\Session\Storage\MetadataBag</parameter>
<parameter key="session.metadata.storage_key">_sf2_meta</parameter>
<parameter key="session.storage.native.class">Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage</parameter>
<parameter key="session.storage.php_bridge.class">Symfony\Component\HttpFoundation\Session\Storage\PhpBridgeSessionStorage</parameter>
<parameter key="session.storage.mock_file.class">Symfony\Component\HttpFoundation\Session\Storage\MockFileSessionStorage</parameter>
<parameter key="session.handler.native_file.class">Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler</parameter>
<parameter key="session.handler.write_check.class">Symfony\Component\HttpFoundation\Session\Storage\Handler\WriteCheckSessionHandler</parameter>
<parameter key="session_listener.class">Symfony\Bundle\FrameworkBundle\EventListener\SessionListener</parameter>
<parameter key="session.storage.options" type="collection">
<parameter key="gc_probability">1</parameter>
</parameter>
<parameter key="session.save_path">C:\wamp\www\infographicsBundle\app\cache\dev/sessions</parameter>
<parameter key="session.metadata.update_threshold">0</parameter>
<parameter key="security.secure_random.class">Symfony\Component\Security\Core\Util\SecureRandom</parameter>
<parameter key="form.resolved_type_factory.class">Symfony\Component\Form\ResolvedFormTypeFactory</parameter>
<parameter key="form.registry.class">Symfony\Component\Form\FormRegistry</parameter>
<parameter key="form.factory.class">Symfony\Component\Form\FormFactory</parameter>
<parameter key="form.extension.class">Symfony\Component\Form\Extension\DependencyInjection\DependencyInjectionExtension</parameter>
<parameter key="form.type_guesser.validator.class">Symfony\Component\Form\Extension\Validator\ValidatorTypeGuesser</parameter>
<parameter key="form.type_extension.form.request_handler.class">Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationRequestHandler</parameter>
<parameter key="form.type_extension.csrf.enabled">true</parameter>
<parameter key="form.type_extension.csrf.field_name">_token</parameter>
<parameter key="security.csrf.token_generator.class">Symfony\Component\Security\Csrf\TokenGenerator\UriSafeTokenGenerator</parameter>
<parameter key="security.csrf.token_storage.class">Symfony\Component\Security\Csrf\TokenStorage\SessionTokenStorage</parameter>
<parameter key="security.csrf.token_manager.class">Symfony\Component\Security\Csrf\CsrfTokenManager</parameter>
<parameter key="templating.engine.delegating.class">Symfony\Bundle\FrameworkBundle\Templating\DelegatingEngine</parameter>
<parameter key="templating.name_parser.class">Symfony\Bundle\FrameworkBundle\Templating\TemplateNameParser</parameter>
<parameter key="templating.filename_parser.class">Symfony\Bundle\FrameworkBundle\Templating\TemplateFilenameParser</parameter>
<parameter key="templating.cache_warmer.template_paths.class">Symfony\Bundle\FrameworkBundle\CacheWarmer\TemplatePathsCacheWarmer</parameter>
<parameter key="templating.locator.class">Symfony\Bundle\FrameworkBundle\Templating\Loader\TemplateLocator</parameter>
<parameter key="templating.loader.filesystem.class">Symfony\Bundle\FrameworkBundle\Templating\Loader\FilesystemLoader</parameter>
<parameter key="templating.loader.cache.class">Symfony\Component\Templating\Loader\CacheLoader</parameter>
<parameter key="templating.loader.chain.class">Symfony\Component\Templating\Loader\ChainLoader</parameter>
<parameter key="templating.finder.class">Symfony\Bundle\FrameworkBundle\CacheWarmer\TemplateFinder</parameter>
<parameter key="templating.engine.php.class">Symfony\Bundle\FrameworkBundle\Templating\PhpEngine</parameter>
<parameter key="templating.helper.slots.class">Symfony\Component\Templating\Helper\SlotsHelper</parameter>
<parameter key="templating.helper.assets.class">Symfony\Component\Templating\Helper\CoreAssetsHelper</parameter>
<parameter key="templating.helper.actions.class">Symfony\Bundle\FrameworkBundle\Templating\Helper\ActionsHelper</parameter>
<parameter key="templating.helper.router.class">Symfony\Bundle\FrameworkBundle\Templating\Helper\RouterHelper</parameter>
<parameter key="templating.helper.request.class">Symfony\Bundle\FrameworkBundle\Templating\Helper\RequestHelper</parameter>
<parameter key="templating.helper.session.class">Symfony\Bundle\FrameworkBundle\Templating\Helper\SessionHelper</parameter>
<parameter key="templating.helper.code.class">Symfony\Bundle\FrameworkBundle\Templating\Helper\CodeHelper</parameter>
<parameter key="templating.helper.translator.class">Symfony\Bundle\FrameworkBundle\Templating\Helper\TranslatorHelper</parameter>
<parameter key="templating.helper.form.class">Symfony\Bundle\FrameworkBundle\Templating\Helper\FormHelper</parameter>
<parameter key="templating.helper.stopwatch.class">Symfony\Bundle\FrameworkBundle\Templating\Helper\StopwatchHelper</parameter>
<parameter key="templating.form.engine.class">Symfony\Component\Form\Extension\Templating\TemplatingRendererEngine</parameter>
<parameter key="templating.form.renderer.class">Symfony\Component\Form\FormRenderer</parameter>
<parameter key="templating.globals.class">Symfony\Bundle\FrameworkBundle\Templating\GlobalVariables</parameter>
<parameter key="templating.asset.path_package.class">Symfony\Bundle\FrameworkBundle\Templating\Asset\PathPackage</parameter>
<parameter key="templating.asset.url_package.class">Symfony\Component\Templating\Asset\UrlPackage</parameter>
<parameter key="templating.asset.package_factory.class">Symfony\Bundle\FrameworkBundle\Templating\Asset\PackageFactory</parameter>
<parameter key="templating.helper.code.file_link_format">null</parameter>
<parameter key="templating.helper.form.resources" type="collection">
<parameter>FrameworkBundle:Form</parameter>
</parameter>
<parameter key="debug.templating.engine.php.class">Symfony\Bundle\FrameworkBundle\Templating\TimedPhpEngine</parameter>
<parameter key="templating.loader.cache.path">null</parameter>
<parameter key="templating.engines" type="collection">
<parameter>twig</parameter>
</parameter>
<parameter key="validator.class">Symfony\Component\Validator\ValidatorInterface</parameter>
<parameter key="validator.builder.class">Symfony\Component\Validator\ValidatorBuilderInterface</parameter>
<parameter key="validator.builder.factory.class">Symfony\Component\Validator\Validation</parameter>
<parameter key="validator.mapping.cache.apc.class">Symfony\Component\Validator\Mapping\Cache\ApcCache</parameter>
<parameter key="validator.mapping.cache.prefix"></parameter>
<parameter key="validator.validator_factory.class">Symfony\Bundle\FrameworkBundle\Validator\ConstraintValidatorFactory</parameter>
<parameter key="validator.expression.class">Symfony\Component\Validator\Constraints\ExpressionValidator</parameter>
<parameter key="validator.email.class">Symfony\Component\Validator\Constraints\EmailValidator</parameter>
<parameter key="validator.translation_domain">validators</parameter>
<parameter key="validator.api">3</parameter>
<parameter key="fragment.listener.class">Symfony\Component\HttpKernel\EventListener\FragmentListener</parameter>
<parameter key="form.resolved_type_factory.data_collector_proxy.class">Symfony\Component\Form\Extension\DataCollector\Proxy\ResolvedTypeFactoryDataCollectorProxy</parameter>
<parameter key="form.type_extension.form.data_collector.class">Symfony\Component\Form\Extension\DataCollector\Type\DataCollectorTypeExtension</parameter>
<parameter key="data_collector.form.class">Symfony\Component\Form\Extension\DataCollector\FormDataCollector</parameter>
<parameter key="data_collector.form.extractor.class">Symfony\Component\Form\Extension\DataCollector\FormDataExtractor</parameter>
<parameter key="profiler.class">Symfony\Component\HttpKernel\Profiler\Profiler</parameter>
<parameter key="profiler_listener.class">Symfony\Component\HttpKernel\EventListener\ProfilerListener</parameter>
<parameter key="data_collector.config.class">Symfony\Component\HttpKernel\DataCollector\ConfigDataCollector</parameter>
<parameter key="data_collector.request.class">Symfony\Component\HttpKernel\DataCollector\RequestDataCollector</parameter>
<parameter key="data_collector.exception.class">Symfony\Component\HttpKernel\DataCollector\ExceptionDataCollector</parameter>
<parameter key="data_collector.events.class">Symfony\Component\HttpKernel\DataCollector\EventDataCollector</parameter>
<parameter key="data_collector.logger.class">Symfony\Component\HttpKernel\DataCollector\LoggerDataCollector</parameter>
<parameter key="data_collector.time.class">Symfony\Component\HttpKernel\DataCollector\TimeDataCollector</parameter>
<parameter key="data_collector.memory.class">Symfony\Component\HttpKernel\DataCollector\MemoryDataCollector</parameter>
<parameter key="data_collector.router.class">Symfony\Bundle\FrameworkBundle\DataCollector\RouterDataCollector</parameter>
<parameter key="profiler_listener.only_exceptions">false</parameter>
<parameter key="profiler_listener.only_master_requests">false</parameter>
<parameter key="profiler.storage.dsn">file:C:\wamp\www\infographicsBundle\app\cache\dev/profiler</parameter>
<parameter key="profiler.storage.username"></parameter>
<parameter key="profiler.storage.password"></parameter>
<parameter key="profiler.storage.lifetime">86400</parameter>
<parameter key="router.class">Symfony\Bundle\FrameworkBundle\Routing\Router</parameter>
<parameter key="router.request_context.class">Symfony\Component\Routing\RequestContext</parameter>
<parameter key="routing.loader.class">Symfony\Bundle\FrameworkBundle\Routing\DelegatingLoader</parameter>
<parameter key="routing.resolver.class">Symfony\Component\Config\Loader\LoaderResolver</parameter>
<parameter key="routing.loader.xml.class">Symfony\Component\Routing\Loader\XmlFileLoader</parameter>
<parameter key="routing.loader.yml.class">Symfony\Component\Routing\Loader\YamlFileLoader</parameter>
<parameter key="routing.loader.php.class">Symfony\Component\Routing\Loader\PhpFileLoader</parameter>
<parameter key="router.options.generator_class">Symfony\Component\Routing\Generator\UrlGenerator</parameter>
<parameter key="router.options.generator_base_class">Symfony\Component\Routing\Generator\UrlGenerator</parameter>
<parameter key="router.options.generator_dumper_class">Symfony\Component\Routing\Generator\Dumper\PhpGeneratorDumper</parameter>
<parameter key="router.options.matcher_class">Symfony\Bundle\FrameworkBundle\Routing\RedirectableUrlMatcher</parameter>
<parameter key="router.options.matcher_base_class">Symfony\Bundle\FrameworkBundle\Routing\RedirectableUrlMatcher</parameter>
<parameter key="router.options.matcher_dumper_class">Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper</parameter>
<parameter key="router.cache_warmer.class">Symfony\Bundle\FrameworkBundle\CacheWarmer\RouterCacheWarmer</parameter>
<parameter key="router.options.matcher.cache_class">appDevUrlMatcher</parameter>
<parameter key="router.options.generator.cache_class">appDevUrlGenerator</parameter>
<parameter key="router_listener.class">Symfony\Component\HttpKernel\EventListener\RouterListener</parameter>
<parameter key="router.request_context.host">localhost</parameter>
<parameter key="router.request_context.scheme">http</parameter>
<parameter key="router.request_context.base_url"></parameter>
<parameter key="router.resource">C:\wamp\www\infographicsBundle\app\cache\dev/assetic/routing.yml</parameter>
<parameter key="router.cache_class_prefix">appDev</parameter>
<parameter key="request_listener.http_port">80</parameter>
<parameter key="request_listener.https_port">443</parameter>
<parameter key="annotations.reader.class">Doctrine\Common\Annotations\AnnotationReader</parameter>
<parameter key="annotations.cached_reader.class">Doctrine\Common\Annotations\CachedReader</parameter>
<parameter key="annotations.file_cache_reader.class">Doctrine\Common\Annotations\FileCacheReader</parameter>
<parameter key="debug.debug_handlers_listener.class">Symfony\Component\HttpKernel\EventListener\DebugHandlersListener</parameter>
<parameter key="debug.stopwatch.class">Symfony\Component\Stopwatch\Stopwatch</parameter>
<parameter key="debug.error_handler.throw_at">-1</parameter>
<parameter key="debug.event_dispatcher.class">Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher</parameter>
<parameter key="debug.container.dump">C:\wamp\www\infographicsBundle\app\cache\dev/appDevDebugProjectContainer.xml</parameter>
<parameter key="debug.controller_resolver.class">Symfony\Component\HttpKernel\Controller\TraceableControllerResolver</parameter>
<parameter key="security.context.class">Symfony\Component\Security\Core\SecurityContext</parameter>
<parameter key="security.user_checker.class">Symfony\Component\Security\Core\User\UserChecker</parameter>
<parameter key="security.encoder_factory.generic.class">Symfony\Component\Security\Core\Encoder\EncoderFactory</parameter>
<parameter key="security.encoder.digest.class">Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder</parameter>
<parameter key="security.encoder.plain.class">Symfony\Component\Security\Core\Encoder\PlaintextPasswordEncoder</parameter>
<parameter key="security.encoder.pbkdf2.class">Symfony\Component\Security\Core\Encoder\Pbkdf2PasswordEncoder</parameter>
<parameter key="security.encoder.bcrypt.class">Symfony\Component\Security\Core\Encoder\BCryptPasswordEncoder</parameter>
<parameter key="security.user.provider.in_memory.class">Symfony\Component\Security\Core\User\InMemoryUserProvider</parameter>
<parameter key="security.user.provider.in_memory.user.class">Symfony\Component\Security\Core\User\User</parameter>
<parameter key="security.user.provider.chain.class">Symfony\Component\Security\Core\User\ChainUserProvider</parameter>
<parameter key="security.authentication.trust_resolver.class">Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolver</parameter>
<parameter key="security.authentication.trust_resolver.anonymous_class">Symfony\Component\Security\Core\Authentication\Token\AnonymousToken</parameter>
<parameter key="security.authentication.trust_resolver.rememberme_class">Symfony\Component\Security\Core\Authentication\Token\RememberMeToken</parameter>
<parameter key="security.authentication.manager.class">Symfony\Component\Security\Core\Authentication\AuthenticationProviderManager</parameter>
<parameter key="security.authentication.session_strategy.class">Symfony\Component\Security\Http\Session\SessionAuthenticationStrategy</parameter>
<parameter key="security.access.decision_manager.class">Symfony\Component\Security\Core\Authorization\AccessDecisionManager</parameter>
<parameter key="security.access.simple_role_voter.class">Symfony\Component\Security\Core\Authorization\Voter\RoleVoter</parameter>
<parameter key="security.access.authenticated_voter.class">Symfony\Component\Security\Core\Authorization\Voter\AuthenticatedVoter</parameter>
<parameter key="security.access.role_hierarchy_voter.class">Symfony\Component\Security\Core\Authorization\Voter\RoleHierarchyVoter</parameter>
<parameter key="security.access.expression_voter.class">Symfony\Component\Security\Core\Authorization\Voter\ExpressionVoter</parameter>
<parameter key="security.firewall.class">Symfony\Component\Security\Http\Firewall</parameter>
<parameter key="security.firewall.map.class">Symfony\Bundle\SecurityBundle\Security\FirewallMap</parameter>
<parameter key="security.firewall.context.class">Symfony\Bundle\SecurityBundle\Security\FirewallContext</parameter>
<parameter key="security.matcher.class">Symfony\Component\HttpFoundation\RequestMatcher</parameter>
<parameter key="security.expression_matcher.class">Symfony\Component\HttpFoundation\ExpressionRequestMatcher</parameter>
<parameter key="security.role_hierarchy.class">Symfony\Component\Security\Core\Role\RoleHierarchy</parameter>
<parameter key="security.http_utils.class">Symfony\Component\Security\Http\HttpUtils</parameter>
<parameter key="security.validator.user_password.class">Symfony\Component\Security\Core\Validator\Constraints\UserPasswordValidator</parameter>
<parameter key="security.expression_language.class">Symfony\Component\Security\Core\Authorization\ExpressionLanguage</parameter>
<parameter key="security.authentication.retry_entry_point.class">Symfony\Component\Security\Http\EntryPoint\RetryAuthenticationEntryPoint</parameter>
<parameter key="security.channel_listener.class">Symfony\Component\Security\Http\Firewall\ChannelListener</parameter>
<parameter key="security.authentication.form_entry_point.class">Symfony\Component\Security\Http\EntryPoint\FormAuthenticationEntryPoint</parameter>
<parameter key="security.authentication.listener.form.class">Symfony\Component\Security\Http\Firewall\UsernamePasswordFormAuthenticationListener</parameter>
<parameter key="security.authentication.listener.simple_form.class">Symfony\Component\Security\Http\Firewall\SimpleFormAuthenticationListener</parameter>
<parameter key="security.authentication.listener.simple_preauth.class">Symfony\Component\Security\Http\Firewall\SimplePreAuthenticationListener</parameter>
<parameter key="security.authentication.listener.basic.class">Symfony\Component\Security\Http\Firewall\BasicAuthenticationListener</parameter>
<parameter key="security.authentication.basic_entry_point.class">Symfony\Component\Security\Http\EntryPoint\BasicAuthenticationEntryPoint</parameter>
<parameter key="security.authentication.listener.digest.class">Symfony\Component\Security\Http\Firewall\DigestAuthenticationListener</parameter>
<parameter key="security.authentication.digest_entry_point.class">Symfony\Component\Security\Http\EntryPoint\DigestAuthenticationEntryPoint</parameter>
<parameter key="security.authentication.listener.x509.class">Symfony\Component\Security\Http\Firewall\X509AuthenticationListener</parameter>
<parameter key="security.authentication.listener.anonymous.class">Symfony\Component\Security\Http\Firewall\AnonymousAuthenticationListener</parameter>
<parameter key="security.authentication.switchuser_listener.class">Symfony\Component\Security\Http\Firewall\SwitchUserListener</parameter>
<parameter key="security.logout_listener.class">Symfony\Component\Security\Http\Firewall\LogoutListener</parameter>
<parameter key="security.logout.handler.session.class">Symfony\Component\Security\Http\Logout\SessionLogoutHandler</parameter>
<parameter key="security.logout.handler.cookie_clearing.class">Symfony\Component\Security\Http\Logout\CookieClearingLogoutHandler</parameter>
<parameter key="security.logout.success_handler.class">Symfony\Component\Security\Http\Logout\DefaultLogoutSuccessHandler</parameter>
<parameter key="security.access_listener.class">Symfony\Component\Security\Http\Firewall\AccessListener</parameter>
<parameter key="security.access_map.class">Symfony\Component\Security\Http\AccessMap</parameter>
<parameter key="security.exception_listener.class">Symfony\Component\Security\Http\Firewall\ExceptionListener</parameter>
<parameter key="security.context_listener.class">Symfony\Component\Security\Http\Firewall\ContextListener</parameter>
<parameter key="security.authentication.provider.dao.class">Symfony\Component\Security\Core\Authentication\Provider\DaoAuthenticationProvider</parameter>
<parameter key="security.authentication.provider.simple.class">Symfony\Component\Security\Core\Authentication\Provider\SimpleAuthenticationProvider</parameter>
<parameter key="security.authentication.provider.pre_authenticated.class">Symfony\Component\Security\Core\Authentication\Provider\PreAuthenticatedAuthenticationProvider</parameter>
<parameter key="security.authentication.provider.anonymous.class">Symfony\Component\Security\Core\Authentication\Provider\AnonymousAuthenticationProvider</parameter>
<parameter key="security.authentication.success_handler.class">Symfony\Component\Security\Http\Authentication\DefaultAuthenticationSuccessHandler</parameter>
<parameter key="security.authentication.failure_handler.class">Symfony\Component\Security\Http\Authentication\DefaultAuthenticationFailureHandler</parameter>
<parameter key="security.authentication.simple_success_failure_handler.class">Symfony\Component\Security\Http\Authentication\SimpleAuthenticationHandler</parameter>
<parameter key="security.authentication.provider.rememberme.class">Symfony\Component\Security\Core\Authentication\Provider\RememberMeAuthenticationProvider</parameter>
<parameter key="security.authentication.listener.rememberme.class">Symfony\Component\Security\Http\Firewall\RememberMeListener</parameter>
<parameter key="security.rememberme.token.provider.in_memory.class">Symfony\Component\Security\Core\Authentication\RememberMe\InMemoryTokenProvider</parameter>
<parameter key="security.authentication.rememberme.services.persistent.class">Symfony\Component\Security\Http\RememberMe\PersistentTokenBasedRememberMeServices</parameter>
<parameter key="security.authentication.rememberme.services.simplehash.class">Symfony\Component\Security\Http\RememberMe\TokenBasedRememberMeServices</parameter>
<parameter key="security.rememberme.response_listener.class">Symfony\Component\Security\Http\RememberMe\ResponseListener</parameter>
<parameter key="templating.helper.logout_url.class">Symfony\Bundle\SecurityBundle\Templating\Helper\LogoutUrlHelper</parameter>
<parameter key="templating.helper.security.class">Symfony\Bundle\SecurityBundle\Templating\Helper\SecurityHelper</parameter>
<parameter key="twig.extension.logout_url.class">Symfony\Bundle\SecurityBundle\Twig\Extension\LogoutUrlExtension</parameter>
<parameter key="twig.extension.security.class">Symfony\Bridge\Twig\Extension\SecurityExtension</parameter>
<parameter key="data_collector.security.class">Symfony\Bundle\SecurityBundle\DataCollector\SecurityDataCollector</parameter>
<parameter key="security.access.denied_url">null</parameter>
<parameter key="security.authentication.manager.erase_credentials">true</parameter>
<parameter key="security.authentication.session_strategy.strategy">migrate</parameter>
<parameter key="security.access.always_authenticate_before_granting">false</parameter>
<parameter key="security.authentication.hide_user_not_found">true</parameter>
<parameter key="security.role_hierarchy.roles" type="collection">
<parameter key="ROLE_ADMIN" type="collection">
<parameter>ROLE_USER</parameter>
</parameter>
<parameter key="ROLE_SUPER_ADMIN" type="collection">
<parameter>ROLE_USER</parameter>
<parameter>ROLE_ADMIN</parameter>
<parameter>ROLE_ALLOWED_TO_SWITCH</parameter>
</parameter>
</parameter>
<parameter key="twig.class">Twig_Environment</parameter>
<parameter key="twig.loader.filesystem.class">Symfony\Bundle\TwigBundle\Loader\FilesystemLoader</parameter>
<parameter key="twig.loader.chain.class">Twig_Loader_Chain</parameter>
<parameter key="templating.engine.twig.class">Symfony\Bundle\TwigBundle\TwigEngine</parameter>
<parameter key="twig.cache_warmer.class">Symfony\Bundle\TwigBundle\CacheWarmer\TemplateCacheCacheWarmer</parameter>
<parameter key="twig.extension.trans.class">Symfony\Bridge\Twig\Extension\TranslationExtension</parameter>
<parameter key="twig.extension.assets.class">Symfony\Bundle\TwigBundle\Extension\AssetsExtension</parameter>
<parameter key="twig.extension.actions.class">Symfony\Bundle\TwigBundle\Extension\ActionsExtension</parameter>
<parameter key="twig.extension.code.class">Symfony\Bridge\Twig\Extension\CodeExtension</parameter>
<parameter key="twig.extension.routing.class">Symfony\Bridge\Twig\Extension\RoutingExtension</parameter>
<parameter key="twig.extension.yaml.class">Symfony\Bridge\Twig\Extension\YamlExtension</parameter>
<parameter key="twig.extension.form.class">Symfony\Bridge\Twig\Extension\FormExtension</parameter>
<parameter key="twig.extension.httpkernel.class">Symfony\Bridge\Twig\Extension\HttpKernelExtension</parameter>
<parameter key="twig.extension.debug.stopwatch.class">Symfony\Bridge\Twig\Extension\StopwatchExtension</parameter>
<parameter key="twig.extension.expression.class">Symfony\Bridge\Twig\Extension\ExpressionExtension</parameter>
<parameter key="twig.form.engine.class">Symfony\Bridge\Twig\Form\TwigRendererEngine</parameter>
<parameter key="twig.form.renderer.class">Symfony\Bridge\Twig\Form\TwigRenderer</parameter>
<parameter key="twig.translation.extractor.class">Symfony\Bridge\Twig\Translation\TwigExtractor</parameter>
<parameter key="twig.exception_listener.class">Symfony\Component\HttpKernel\EventListener\ExceptionListener</parameter>
<parameter key="twig.controller.exception.class">Symfony\Bundle\TwigBundle\Controller\ExceptionController</parameter>
<parameter key="twig.controller.preview_error.class">Symfony\Bundle\TwigBundle\Controller\PreviewErrorController</parameter>
<parameter key="twig.exception_listener.controller">twig.controller.exception:showAction</parameter>
<parameter key="twig.form.resources" type="collection">
<parameter>form_div_layout.html.twig</parameter>
</parameter>
<parameter key="debug.templating.engine.twig.class">Symfony\Bundle\TwigBundle\Debug\TimedTwigEngine</parameter>
<parameter key="twig.options" type="collection">
<parameter key="debug">true</parameter>
<parameter key="strict_variables">true</parameter>
<parameter key="exception_controller">twig.controller.exception:showAction</parameter>
<parameter key="form_themes" type="collection">
<parameter>form_div_layout.html.twig</parameter>
</parameter>
<parameter key="autoescape" type="collection">
<parameter>Symfony\Bundle\TwigBundle\TwigDefaultEscapingStrategy</parameter>
<parameter>guess</parameter>
</parameter>
<parameter key="cache">C:\wamp\www\infographicsBundle\app\cache\dev/twig</parameter>
<parameter key="charset">UTF-8</parameter>
<parameter key="paths" type="collection"/>
</parameter>
<parameter key="monolog.logger.class">Symfony\Bridge\Monolog\Logger</parameter>
<parameter key="monolog.gelf.publisher.class">Gelf\MessagePublisher</parameter>
<parameter key="monolog.gelfphp.publisher.class">Gelf\Publisher</parameter>
<parameter key="monolog.handler.stream.class">Monolog\Handler\StreamHandler</parameter>
<parameter key="monolog.handler.console.class">Symfony\Bridge\Monolog\Handler\ConsoleHandler</parameter>
<parameter key="monolog.handler.group.class">Monolog\Handler\GroupHandler</parameter>
<parameter key="monolog.handler.buffer.class">Monolog\Handler\BufferHandler</parameter>
<parameter key="monolog.handler.rotating_file.class">Monolog\Handler\RotatingFileHandler</parameter>
<parameter key="monolog.handler.syslog.class">Monolog\Handler\SyslogHandler</parameter>
<parameter key="monolog.handler.syslogudp.class">Monolog\Handler\SyslogUdpHandler</parameter>
<parameter key="monolog.handler.null.class">Monolog\Handler\NullHandler</parameter>
<parameter key="monolog.handler.test.class">Monolog\Handler\TestHandler</parameter>
<parameter key="monolog.handler.gelf.class">Monolog\Handler\GelfHandler</parameter>
<parameter key="monolog.handler.rollbar.class">Monolog\Handler\RollbarHandler</parameter>
<parameter key="monolog.handler.flowdock.class">Monolog\Handler\FlowdockHandler</parameter>
<parameter key="monolog.handler.browser_console.class">Monolog\Handler\BrowserConsoleHandler</parameter>
<parameter key="monolog.handler.firephp.class">Symfony\Bridge\Monolog\Handler\FirePHPHandler</parameter>
<parameter key="monolog.handler.chromephp.class">Symfony\Bridge\Monolog\Handler\ChromePhpHandler</parameter>
<parameter key="monolog.handler.debug.class">Symfony\Bridge\Monolog\Handler\DebugHandler</parameter>
<parameter key="monolog.handler.swift_mailer.class">Symfony\Bridge\Monolog\Handler\SwiftMailerHandler</parameter>
<parameter key="monolog.handler.native_mailer.class">Monolog\Handler\NativeMailerHandler</parameter>
<parameter key="monolog.handler.socket.class">Monolog\Handler\SocketHandler</parameter>
<parameter key="monolog.handler.pushover.class">Monolog\Handler\PushoverHandler</parameter>
<parameter key="monolog.handler.raven.class">Monolog\Handler\RavenHandler</parameter>
<parameter key="monolog.handler.newrelic.class">Monolog\Handler\NewRelicHandler</parameter>
<parameter key="monolog.handler.hipchat.class">Monolog\Handler\HipChatHandler</parameter>
<parameter key="monolog.handler.slack.class">Monolog\Handler\SlackHandler</parameter>
<parameter key="monolog.handler.cube.class">Monolog\Handler\CubeHandler</parameter>
<parameter key="monolog.handler.amqp.class">Monolog\Handler\AmqpHandler</parameter>
<parameter key="monolog.handler.error_log.class">Monolog\Handler\ErrorLogHandler</parameter>
<parameter key="monolog.handler.loggly.class">Monolog\Handler\LogglyHandler</parameter>
<parameter key="monolog.handler.logentries.class">Monolog\Handler\LogEntriesHandler</parameter>
<parameter key="monolog.handler.whatfailuregroup.class">Monolog\Handler\WhatFailureGroupHandler</parameter>
<parameter key="monolog.activation_strategy.not_found.class">Symfony\Bundle\MonologBundle\NotFoundActivationStrategy</parameter>
<parameter key="monolog.handler.fingers_crossed.class">Monolog\Handler\FingersCrossedHandler</parameter>
<parameter key="monolog.handler.fingers_crossed.error_level_activation_strategy.class">Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy</parameter>
<parameter key="monolog.handler.filter.class">Monolog\Handler\FilterHandler</parameter>
<parameter key="monolog.handler.mongo.class">Monolog\Handler\MongoDBHandler</parameter>
<parameter key="monolog.mongo.client.class">MongoClient</parameter>
<parameter key="monolog.handler.elasticsearch.class">Monolog\Handler\ElasticSearchHandler</parameter>
<parameter key="monolog.elastica.client.class">Elastica\Client</parameter>
<parameter key="monolog.swift_mailer.handlers" type="collection"/>
<parameter key="monolog.handlers_to_channels" type="collection">
<parameter key="monolog.handler.console_very_verbose" type="collection">
<parameter key="type">inclusive</parameter>
<parameter key="elements" type="collection">
<parameter>doctrine</parameter>
</parameter>
</parameter>
<parameter key="monolog.handler.console" type="collection">
<parameter key="type">exclusive</parameter>
<parameter key="elements" type="collection">
<parameter>doctrine</parameter>
</parameter>
</parameter>
<parameter key="monolog.handler.main">null</parameter>
</parameter>
<parameter key="swiftmailer.class">Swift_Mailer</parameter>
<parameter key="swiftmailer.transport.sendmail.class">Swift_Transport_SendmailTransport</parameter>
<parameter key="swiftmailer.transport.mail.class">Swift_Transport_MailTransport</parameter>
<parameter key="swiftmailer.transport.failover.class">Swift_Transport_FailoverTransport</parameter>
<parameter key="swiftmailer.plugin.redirecting.class">Swift_Plugins_RedirectingPlugin</parameter>
<parameter key="swiftmailer.plugin.impersonate.class">Swift_Plugins_ImpersonatePlugin</parameter>
<parameter key="swiftmailer.plugin.messagelogger.class">Swift_Plugins_MessageLogger</parameter>
<parameter key="swiftmailer.plugin.antiflood.class">Swift_Plugins_AntiFloodPlugin</parameter>
<parameter key="swiftmailer.transport.smtp.class">Swift_Transport_EsmtpTransport</parameter>
<parameter key="swiftmailer.plugin.blackhole.class">Swift_Plugins_BlackholePlugin</parameter>
<parameter key="swiftmailer.spool.file.class">Swift_FileSpool</parameter>
<parameter key="swiftmailer.spool.memory.class">Swift_MemorySpool</parameter>
<parameter key="swiftmailer.email_sender.listener.class">Symfony\Bundle\SwiftmailerBundle\EventListener\EmailSenderListener</parameter>
<parameter key="swiftmailer.data_collector.class">Symfony\Bundle\SwiftmailerBundle\DataCollector\MessageDataCollector</parameter>
<parameter key="swiftmailer.mailer.default.transport.name">smtp</parameter>
<parameter key="swiftmailer.mailer.default.delivery.enabled">true</parameter>
<parameter key="swiftmailer.mailer.default.transport.smtp.encryption">null</parameter>
<parameter key="swiftmailer.mailer.default.transport.smtp.port">25</parameter>
<parameter key="swiftmailer.mailer.default.transport.smtp.host">127.0.0.1</parameter>
<parameter key="swiftmailer.mailer.default.transport.smtp.username">null</parameter>
<parameter key="swiftmailer.mailer.default.transport.smtp.password">null</parameter>
<parameter key="swiftmailer.mailer.default.transport.smtp.auth_mode">null</parameter>
<parameter key="swiftmailer.mailer.default.transport.smtp.timeout">30</parameter>
<parameter key="swiftmailer.mailer.default.transport.smtp.source_ip">null</parameter>
<parameter key="swiftmailer.spool.default.memory.path">C:\wamp\www\infographicsBundle\app\cache\dev/swiftmailer/spool/default</parameter>
<parameter key="swiftmailer.mailer.default.spool.enabled">true</parameter>
<parameter key="swiftmailer.mailer.default.plugin.impersonate">null</parameter>
<parameter key="swiftmailer.mailer.default.single_address">null</parameter>
<parameter key="swiftmailer.spool.enabled">true</parameter>
<parameter key="swiftmailer.delivery.enabled">true</parameter>
<parameter key="swiftmailer.single_address">null</parameter>
<parameter key="swiftmailer.mailers" type="collection">
<parameter key="default">swiftmailer.mailer.default</parameter>
</parameter>
<parameter key="swiftmailer.default_mailer">default</parameter>
<parameter key="assetic.asset_factory.class">Symfony\Bundle\AsseticBundle\Factory\AssetFactory</parameter>
<parameter key="assetic.asset_manager.class">Assetic\Factory\LazyAssetManager</parameter>
<parameter key="assetic.asset_manager_cache_warmer.class">Symfony\Bundle\AsseticBundle\CacheWarmer\AssetManagerCacheWarmer</parameter>
<parameter key="assetic.cached_formula_loader.class">Assetic\Factory\Loader\CachedFormulaLoader</parameter>
<parameter key="assetic.config_cache.class">Assetic\Cache\ConfigCache</parameter>
<parameter key="assetic.config_loader.class">Symfony\Bundle\AsseticBundle\Factory\Loader\ConfigurationLoader</parameter>
<parameter key="assetic.config_resource.class">Symfony\Bundle\AsseticBundle\Factory\Resource\ConfigurationResource</parameter>
<parameter key="assetic.coalescing_directory_resource.class">Symfony\Bundle\AsseticBundle\Factory\Resource\CoalescingDirectoryResource</parameter>
<parameter key="assetic.directory_resource.class">Symfony\Bundle\AsseticBundle\Factory\Resource\DirectoryResource</parameter>
<parameter key="assetic.filter_manager.class">Symfony\Bundle\AsseticBundle\FilterManager</parameter>
<parameter key="assetic.worker.ensure_filter.class">Assetic\Factory\Worker\EnsureFilterWorker</parameter>
<parameter key="assetic.worker.cache_busting.class">Assetic\Factory\Worker\CacheBustingWorker</parameter>
<parameter key="assetic.value_supplier.class">Symfony\Bundle\AsseticBundle\DefaultValueSupplier</parameter>
<parameter key="assetic.node.paths" type="collection"/>
<parameter key="assetic.cache_dir">C:\wamp\www\infographicsBundle\app\cache\dev/assetic</parameter>
<parameter key="assetic.bundles" type="collection"/>
<parameter key="assetic.twig_extension.class">Symfony\Bundle\AsseticBundle\Twig\AsseticExtension</parameter>
<parameter key="assetic.twig_formula_loader.class">Assetic\Extension\Twig\TwigFormulaLoader</parameter>
<parameter key="assetic.helper.dynamic.class">Symfony\Bundle\AsseticBundle\Templating\DynamicAsseticHelper</parameter>
<parameter key="assetic.helper.static.class">Symfony\Bundle\AsseticBundle\Templating\StaticAsseticHelper</parameter>
<parameter key="assetic.php_formula_loader.class">Symfony\Bundle\AsseticBundle\Factory\Loader\AsseticHelperFormulaLoader</parameter>
<parameter key="assetic.debug">true</parameter>
<parameter key="assetic.use_controller">true</parameter>
<parameter key="assetic.enable_profiler">false</parameter>
<parameter key="assetic.read_from">C:\wamp\www\infographicsBundle\app/../web</parameter>
<parameter key="assetic.write_to">C:\wamp\www\infographicsBundle\app/../web</parameter>
<parameter key="assetic.variables" type="collection"/>
<parameter key="assetic.java.bin">C:\ProgramData\Oracle\Java\javapath\java.EXE</parameter>
<parameter key="assetic.node.bin">/usr/bin/node</parameter>
<parameter key="assetic.ruby.bin">/usr/bin/ruby</parameter>
<parameter key="assetic.sass.bin">/usr/bin/sass</parameter>
<parameter key="assetic.filter.cssrewrite.class">Assetic\Filter\CssRewriteFilter</parameter>
<parameter key="assetic.twig_extension.functions" type="collection"/>
<parameter key="assetic.controller.class">Symfony\Bundle\AsseticBundle\Controller\AsseticController</parameter>
<parameter key="assetic.routing_loader.class">Symfony\Bundle\AsseticBundle\Routing\AsseticLoader</parameter>
<parameter key="assetic.cache.class">Assetic\Cache\FilesystemCache</parameter>
<parameter key="assetic.use_controller_worker.class">Symfony\Bundle\AsseticBundle\Factory\Worker\UseControllerWorker</parameter>
<parameter key="assetic.request_listener.class">Symfony\Bundle\AsseticBundle\EventListener\RequestListener</parameter>
<parameter key="doctrine_cache.apc.class">Doctrine\Common\Cache\ApcCache</parameter>
<parameter key="doctrine_cache.array.class">Doctrine\Common\Cache\ArrayCache</parameter>
<parameter key="doctrine_cache.file_system.class">Doctrine\Common\Cache\FilesystemCache</parameter>
<parameter key="doctrine_cache.php_file.class">Doctrine\Common\Cache\PhpFileCache</parameter>
<parameter key="doctrine_cache.mongodb.class">Doctrine\Common\Cache\MongoDBCache</parameter>
<parameter key="doctrine_cache.mongodb.collection.class">MongoCollection</parameter>
<parameter key="doctrine_cache.mongodb.connection.class">MongoClient</parameter>
<parameter key="doctrine_cache.mongodb.server">localhost:27017</parameter>
<parameter key="doctrine_cache.riak.class">Doctrine\Common\Cache\RiakCache</parameter>
<parameter key="doctrine_cache.riak.bucket.class">Riak\Bucket</parameter>
<parameter key="doctrine_cache.riak.connection.class">Riak\Connection</parameter>
<parameter key="doctrine_cache.riak.bucket_property_list.class">Riak\BucketPropertyList</parameter>
<parameter key="doctrine_cache.riak.host">localhost</parameter>
<parameter key="doctrine_cache.riak.port">8087</parameter>
<parameter key="doctrine_cache.memcache.class">Doctrine\Common\Cache\MemcacheCache</parameter>
<parameter key="doctrine_cache.memcache.connection.class">Memcache</parameter>
<parameter key="doctrine_cache.memcache.host">localhost</parameter>
<parameter key="doctrine_cache.memcache.port">11211</parameter>
<parameter key="doctrine_cache.memcached.class">Doctrine\Common\Cache\MemcachedCache</parameter>
<parameter key="doctrine_cache.memcached.connection.class">Memcached</parameter>
<parameter key="doctrine_cache.memcached.host">localhost</parameter>
<parameter key="doctrine_cache.memcached.port">11211</parameter>
<parameter key="doctrine_cache.redis.class">Doctrine\Common\Cache\RedisCache</parameter>
<parameter key="doctrine_cache.redis.connection.class">Redis</parameter>
<parameter key="doctrine_cache.redis.host">localhost</parameter>
<parameter key="doctrine_cache.redis.port">6379</parameter>
<parameter key="doctrine_cache.couchbase.class">Doctrine\Common\Cache\CouchbaseCache</parameter>
<parameter key="doctrine_cache.couchbase.connection.class">Couchbase</parameter>
<parameter key="doctrine_cache.couchbase.hostnames">localhost:8091</parameter>
<parameter key="doctrine_cache.wincache.class">Doctrine\Common\Cache\WinCacheCache</parameter>
<parameter key="doctrine_cache.xcache.class">Doctrine\Common\Cache\XcacheCache</parameter>
<parameter key="doctrine_cache.zenddata.class">Doctrine\Common\Cache\ZendDataCache</parameter>
<parameter key="doctrine_cache.security.acl.cache.class">Doctrine\Bundle\DoctrineCacheBundle\Acl\Model\AclCache</parameter>
<parameter key="doctrine.dbal.logger.chain.class">Doctrine\DBAL\Logging\LoggerChain</parameter>
<parameter key="doctrine.dbal.logger.profiling.class">Doctrine\DBAL\Logging\DebugStack</parameter>
<parameter key="doctrine.dbal.logger.class">Symfony\Bridge\Doctrine\Logger\DbalLogger</parameter>
<parameter key="doctrine.dbal.configuration.class">Doctrine\DBAL\Configuration</parameter>
<parameter key="doctrine.data_collector.class">Doctrine\Bundle\DoctrineBundle\DataCollector\DoctrineDataCollector</parameter>
<parameter key="doctrine.dbal.connection.event_manager.class">Symfony\Bridge\Doctrine\ContainerAwareEventManager</parameter>
<parameter key="doctrine.dbal.connection_factory.class">Doctrine\Bundle\DoctrineBundle\ConnectionFactory</parameter>
<parameter key="doctrine.dbal.events.mysql_session_init.class">Doctrine\DBAL\Event\Listeners\MysqlSessionInit</parameter>
<parameter key="doctrine.dbal.events.oracle_session_init.class">Doctrine\DBAL\Event\Listeners\OracleSessionInit</parameter>
<parameter key="doctrine.class">Doctrine\Bundle\DoctrineBundle\Registry</parameter>
<parameter key="doctrine.entity_managers" type="collection">
<parameter key="default">doctrine.orm.default_entity_manager</parameter>
</parameter>
<parameter key="doctrine.default_entity_manager">default</parameter>
<parameter key="doctrine.dbal.connection_factory.types" type="collection"/>
<parameter key="doctrine.connections" type="collection">
<parameter key="default">doctrine.dbal.default_connection</parameter>
</parameter>
<parameter key="doctrine.default_connection">default</parameter>
<parameter key="doctrine.orm.configuration.class">Doctrine\ORM\Configuration</parameter>
<parameter key="doctrine.orm.entity_manager.class">Doctrine\ORM\EntityManager</parameter>
<parameter key="doctrine.orm.manager_configurator.class">Doctrine\Bundle\DoctrineBundle\ManagerConfigurator</parameter>
<parameter key="doctrine.orm.cache.array.class">Doctrine\Common\Cache\ArrayCache</parameter>
<parameter key="doctrine.orm.cache.apc.class">Doctrine\Common\Cache\ApcCache</parameter>
<parameter key="doctrine.orm.cache.memcache.class">Doctrine\Common\Cache\MemcacheCache</parameter>
<parameter key="doctrine.orm.cache.memcache_host">localhost</parameter>
<parameter key="doctrine.orm.cache.memcache_port">11211</parameter>
<parameter key="doctrine.orm.cache.memcache_instance.class">Memcache</parameter>
<parameter key="doctrine.orm.cache.memcached.class">Doctrine\Common\Cache\MemcachedCache</parameter>
<parameter key="doctrine.orm.cache.memcached_host">localhost</parameter>
<parameter key="doctrine.orm.cache.memcached_port">11211</parameter>
<parameter key="doctrine.orm.cache.memcached_instance.class">Memcached</parameter>
<parameter key="doctrine.orm.cache.redis.class">Doctrine\Common\Cache\RedisCache</parameter>
<parameter key="doctrine.orm.cache.redis_host">localhost</parameter>
<parameter key="doctrine.orm.cache.redis_port">6379</parameter>
<parameter key="doctrine.orm.cache.redis_instance.class">Redis</parameter>
<parameter key="doctrine.orm.cache.xcache.class">Doctrine\Common\Cache\XcacheCache</parameter>
<parameter key="doctrine.orm.cache.wincache.class">Doctrine\Common\Cache\WinCacheCache</parameter>
<parameter key="doctrine.orm.cache.zenddata.class">Doctrine\Common\Cache\ZendDataCache</parameter>
<parameter key="doctrine.orm.metadata.driver_chain.class">Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain</parameter>
<parameter key="doctrine.orm.metadata.annotation.class">Doctrine\ORM\Mapping\Driver\AnnotationDriver</parameter>
<parameter key="doctrine.orm.metadata.xml.class">Doctrine\ORM\Mapping\Driver\SimplifiedXmlDriver</parameter>
<parameter key="doctrine.orm.metadata.yml.class">Doctrine\ORM\Mapping\Driver\SimplifiedYamlDriver</parameter>
<parameter key="doctrine.orm.metadata.php.class">Doctrine\ORM\Mapping\Driver\PHPDriver</parameter>
<parameter key="doctrine.orm.metadata.staticphp.class">Doctrine\ORM\Mapping\Driver\StaticPHPDriver</parameter>
<parameter key="doctrine.orm.proxy_cache_warmer.class">Symfony\Bridge\Doctrine\CacheWarmer\ProxyCacheWarmer</parameter>
<parameter key="form.type_guesser.doctrine.class">Symfony\Bridge\Doctrine\Form\DoctrineOrmTypeGuesser</parameter>
<parameter key="doctrine.orm.validator.unique.class">Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntityValidator</parameter>
<parameter key="doctrine.orm.validator_initializer.class">Symfony\Bridge\Doctrine\Validator\DoctrineInitializer</parameter>
<parameter key="doctrine.orm.security.user.provider.class">Symfony\Bridge\Doctrine\Security\User\EntityUserProvider</parameter>
<parameter key="doctrine.orm.listeners.resolve_target_entity.class">Doctrine\ORM\Tools\ResolveTargetEntityListener</parameter>
<parameter key="doctrine.orm.listeners.attach_entity_listeners.class">Doctrine\ORM\Tools\AttachEntityListenersListener</parameter>
<parameter key="doctrine.orm.naming_strategy.default.class">Doctrine\ORM\Mapping\DefaultNamingStrategy</parameter>
<parameter key="doctrine.orm.naming_strategy.underscore.class">Doctrine\ORM\Mapping\UnderscoreNamingStrategy</parameter>
<parameter key="doctrine.orm.entity_listener_resolver.class">Doctrine\ORM\Mapping\DefaultEntityListenerResolver</parameter>
<parameter key="doctrine.orm.second_level_cache.default_cache_factory.class">Doctrine\ORM\Cache\DefaultCacheFactory</parameter>
<parameter key="doctrine.orm.second_level_cache.default_region.class">Doctrine\ORM\Cache\Region\DefaultRegion</parameter>
<parameter key="doctrine.orm.second_level_cache.filelock_region.class">Doctrine\ORM\Cache\Region\FileLockRegion</parameter>
<parameter key="doctrine.orm.second_level_cache.logger_chain.class">Doctrine\ORM\Cache\Logging\CacheLoggerChain</parameter>
<parameter key="doctrine.orm.second_level_cache.logger_statistics.class">Doctrine\ORM\Cache\Logging\StatisticsCacheLogger</parameter>
<parameter key="doctrine.orm.second_level_cache.cache_configuration.class">Doctrine\ORM\Cache\CacheConfiguration</parameter>
<parameter key="doctrine.orm.second_level_cache.regions_configuration.class">Doctrine\ORM\Cache\RegionsConfiguration</parameter>
<parameter key="doctrine.orm.auto_generate_proxy_classes">true</parameter>
<parameter key="doctrine.orm.proxy_dir">C:\wamp\www\infographicsBundle\app\cache\dev/doctrine/orm/Proxies</parameter>
<parameter key="doctrine.orm.proxy_namespace">Proxies</parameter>
<parameter key="sensio_framework_extra.view.guesser.class">Sensio\Bundle\FrameworkExtraBundle\Templating\TemplateGuesser</parameter>
<parameter key="sensio_framework_extra.controller.listener.class">Sensio\Bundle\FrameworkExtraBundle\EventListener\ControllerListener</parameter>
<parameter key="sensio_framework_extra.routing.loader.annot_dir.class">Symfony\Component\Routing\Loader\AnnotationDirectoryLoader</parameter>
<parameter key="sensio_framework_extra.routing.loader.annot_file.class">Symfony\Component\Routing\Loader\AnnotationFileLoader</parameter>
<parameter key="sensio_framework_extra.routing.loader.annot_class.class">Sensio\Bundle\FrameworkExtraBundle\Routing\AnnotatedRouteControllerLoader</parameter>
<parameter key="sensio_framework_extra.converter.listener.class">Sensio\Bundle\FrameworkExtraBundle\EventListener\ParamConverterListener</parameter>
<parameter key="sensio_framework_extra.converter.manager.class">Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\ParamConverterManager</parameter>
<parameter key="sensio_framework_extra.converter.doctrine.class">Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\DoctrineParamConverter</parameter>
<parameter key="sensio_framework_extra.converter.datetime.class">Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\DateTimeParamConverter</parameter>
<parameter key="sensio_framework_extra.view.listener.class">Sensio\Bundle\FrameworkExtraBundle\EventListener\TemplateListener</parameter>
<parameter key="web_profiler.controller.profiler.class">Symfony\Bundle\WebProfilerBundle\Controller\ProfilerController</parameter>
<parameter key="web_profiler.controller.router.class">Symfony\Bundle\WebProfilerBundle\Controller\RouterController</parameter>
<parameter key="web_profiler.controller.exception.class">Symfony\Bundle\WebProfilerBundle\Controller\ExceptionController</parameter>
<parameter key="twig.extension.webprofiler.class">Symfony\Bundle\WebProfilerBundle\Twig\WebProfilerExtension</parameter>
<parameter key="web_profiler.debug_toolbar.position">bottom</parameter>
<parameter key="web_profiler.debug_toolbar.class">Symfony\Bundle\WebProfilerBundle\EventListener\WebDebugToolbarListener</parameter>
<parameter key="web_profiler.debug_toolbar.intercept_redirects">false</parameter>
<parameter key="web_profiler.debug_toolbar.mode">2</parameter>
<parameter key="sensio_distribution.webconfigurator.class">Sensio\Bundle\DistributionBundle\Configurator\Configurator</parameter>
<parameter key="sensio_distribution.webconfigurator.doctrine_step.class">Sensio\Bundle\DistributionBundle\Configurator\Step\DoctrineStep</parameter>
<parameter key="sensio_distribution.webconfigurator.secret_step.class">Sensio\Bundle\DistributionBundle\Configurator\Step\SecretStep</parameter>
<parameter key="sensio_distribution.security_checker.class">SensioLabs\Security\SecurityChecker</parameter>
<parameter key="sensio_distribution.security_checker.command.class">SensioLabs\Security\Command\SecurityCheckerCommand</parameter>
<parameter key="data_collector.templates" type="collection">
<parameter key="data_collector.form" type="collection">
<parameter>form</parameter>
<parameter>@WebProfiler/Collector/form.html.twig</parameter>
</parameter>
<parameter key="data_collector.config" type="collection">
<parameter>config</parameter>
<parameter>@WebProfiler/Collector/config.html.twig</parameter>
</parameter>
<parameter key="data_collector.request" type="collection">
<parameter>request</parameter>
<parameter>@WebProfiler/Collector/request.html.twig</parameter>
</parameter>
<parameter key="data_collector.ajax" type="collection">
<parameter>ajax</parameter>
<parameter>@WebProfiler/Collector/ajax.html.twig</parameter>
</parameter>
<parameter key="data_collector.exception" type="collection">
<parameter>exception</parameter>
<parameter>@WebProfiler/Collector/exception.html.twig</parameter>
</parameter>
<parameter key="data_collector.events" type="collection">
<parameter>events</parameter>
<parameter>@WebProfiler/Collector/events.html.twig</parameter>
</parameter>
<parameter key="data_collector.logger" type="collection">
<parameter>logger</parameter>
<parameter>@WebProfiler/Collector/logger.html.twig</parameter>
</parameter>
<parameter key="data_collector.time" type="collection">
<parameter>time</parameter>
<parameter>@WebProfiler/Collector/time.html.twig</parameter>
</parameter>
<parameter key="data_collector.memory" type="collection">
<parameter>memory</parameter>
<parameter>@WebProfiler/Collector/memory.html.twig</parameter>
</parameter>
<parameter key="data_collector.router" type="collection">
<parameter>router</parameter>
<parameter>@WebProfiler/Collector/router.html.twig</parameter>
</parameter>
<parameter key="data_collector.security" type="collection">
<parameter>security</parameter>
<parameter>@Security/Collector/security.html.twig</parameter>
</parameter>
<parameter key="swiftmailer.data_collector" type="collection">
<parameter>swiftmailer</parameter>
<parameter>@Swiftmailer/Collector/swiftmailer.html.twig</parameter>
</parameter>
<parameter key="data_collector.doctrine" type="collection">
<parameter>db</parameter>
<parameter>@Doctrine/Collector/db.html.twig</parameter>
</parameter>
<parameter key="data_collector.dump" type="collection">
<parameter>dump</parameter>
<parameter>@Debug/Profiler/dump.html.twig</parameter>
</parameter>
</parameter>
<parameter key="console.command.ids" type="collection">
<parameter>sensio_distribution.security_checker.command</parameter>
</parameter>
</parameters>
<services>
<service id="controller_name_converter" class="Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser" public="false">
<tag name="monolog.logger" channel="request"/>
<argument type="service" id="kernel"/>
</service>
<service id="response_listener" class="Symfony\Component\HttpKernel\EventListener\ResponseListener">
<tag name="kernel.event_subscriber"/>
<argument>UTF-8</argument>
</service>
<service id="streamed_response_listener" class="Symfony\Component\HttpKernel\EventListener\StreamedResponseListener">
<tag name="kernel.event_subscriber"/>
</service>
<service id="locale_listener" class="Symfony\Component\HttpKernel\EventListener\LocaleListener">
<tag name="kernel.event_subscriber"/>
<argument>en</argument>
<argument type="service" id="router" on-invalid="ignore"/>
<argument type="service" id="request_stack"/>
</service>
<service id="translator_listener" class="Symfony\Component\HttpKernel\EventListener\TranslatorListener">
<tag name="kernel.event_subscriber"/>
<argument type="service" id="translator"/>
<argument type="service" id="request_stack"/>
</service>
<service id="http_kernel" class="Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel">
<argument type="service" id="debug.event_dispatcher"/>
<argument type="service" id="service_container"/>
<argument type="service" id="debug.controller_resolver"/>
<argument type="service" id="request_stack"/>
</service>
<service id="request_stack" class="Symfony\Component\HttpFoundation\RequestStack"/>
<service id="cache_warmer" class="Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate">
<argument type="collection">
<argument type="service">
<service class="Symfony\Bundle\FrameworkBundle\CacheWarmer\TemplatePathsCacheWarmer" public="false">
<tag name="kernel.cache_warmer" priority="20"/>
<argument type="service">
<service class="Symfony\Bundle\FrameworkBundle\CacheWarmer\TemplateFinder" public="false">
<argument type="service" id="kernel"/>
<argument type="service" id="templating.filename_parser"/>
<argument>C:\wamp\www\infographicsBundle\app/Resources</argument>
</service>
</argument>
<argument type="service" id="templating.locator"/>
</service>
</argument>
<argument type="service">
<service class="Symfony\Bundle\AsseticBundle\CacheWarmer\AssetManagerCacheWarmer" public="false">
<tag name="kernel.cache_warmer" priority="10"/>
<argument type="service" id="service_container"/>
</service>
</argument>
<argument type="service">
<service class="Symfony\Bundle\FrameworkBundle\CacheWarmer\RouterCacheWarmer" public="false">
<tag name="kernel.cache_warmer"/>
<argument type="service" id="router"/>
</service>
</argument>
<argument type="service">
<service class="Symfony\Bundle\TwigBundle\CacheWarmer\TemplateCacheCacheWarmer" public="false">
<tag name="kernel.cache_warmer"/>
<argument type="service" id="service_container"/>
<argument type="service">
<service class="Symfony\Bundle\FrameworkBundle\CacheWarmer\TemplateFinder" public="false">
<argument type="service" id="kernel"/>
<argument type="service" id="templating.filename_parser"/>
<argument>C:\wamp\www\infographicsBundle\app/Resources</argument>
</service>
</argument>
</service>
</argument>
<argument type="service">
<service class="Symfony\Bridge\Doctrine\CacheWarmer\ProxyCacheWarmer" public="false">
<tag name="kernel.cache_warmer"/>
<argument type="service" id="doctrine"/>
</service>
</argument>
</argument>
</service>
<service id="cache_clearer" class="Symfony\Component\HttpKernel\CacheClearer\ChainCacheClearer">
<argument type="collection"/>
</service>
<service id="request" scope="request" synthetic="true" synchronized="true"/>
<service id="service_container" synthetic="true"/>
<service id="kernel" synthetic="true"/>
<service id="filesystem" class="Symfony\Component\Filesystem\Filesystem"/>
<service id="file_locator" class="Symfony\Component\HttpKernel\Config\FileLocator">
<argument type="service" id="kernel"/>
<argument>C:\wamp\www\infographicsBundle\app/Resources</argument>
</service>
<service id="uri_signer" class="Symfony\Component\HttpKernel\UriSigner">
<argument>ThisTokenIsNotSoSecretChangeIt</argument>
</service>
<service id="fragment.handler" class="Symfony\Component\HttpKernel\Fragment\FragmentHandler">
<argument type="collection"/>
<argument>true</argument>
<argument type="service" id="request_stack"/>
<call method="addRenderer">
<argument type="service" id="fragment.renderer.inline"/>
</call>
<call method="addRenderer">
<argument type="service" id="fragment.renderer.hinclude"/>
</call>
<call method="addRenderer">
<argument type="service" id="fragment.renderer.esi"/>
</call>
<call method="addRenderer">
<argument type="service" id="fragment.renderer.ssi"/>
</call>
</service>
<service id="fragment.renderer.inline" class="Symfony\Component\HttpKernel\Fragment\InlineFragmentRenderer">
<tag name="kernel.fragment_renderer"/>
<argument type="service" id="http_kernel"/>
<argument type="service" id="debug.event_dispatcher"/>
<call method="setFragmentPath">
<argument>/_fragment</argument>
</call>
</service>
<service id="fragment.renderer.hinclude" class="Symfony\Bundle\FrameworkBundle\Fragment\ContainerAwareHIncludeFragmentRenderer">
<tag name="kernel.fragment_renderer"/>
<argument type="service" id="service_container"/>
<argument type="service" id="uri_signer"/>
<argument>null</argument>
<call method="setFragmentPath">
<argument>/_fragment</argument>
</call>
</service>
<service id="fragment.renderer.esi" class="Symfony\Component\HttpKernel\Fragment\EsiFragmentRenderer">
<tag name="kernel.fragment_renderer"/>
<argument>null</argument>
<argument type="service" id="fragment.renderer.inline"/>
<argument type="service" id="uri_signer"/>
<call method="setFragmentPath">
<argument>/_fragment</argument>
</call>
</service>
<service id="fragment.renderer.ssi" class="Symfony\Component\HttpKernel\Fragment\SsiFragmentRenderer">
<tag name="kernel.fragment_renderer"/>
<argument>null</argument>
<argument type="service" id="fragment.renderer.inline"/>
<argument type="service" id="uri_signer"/>
<call method="setFragmentPath">
<argument>/_fragment</argument>
</call>
</service>
<service id="translator.default" class="Symfony\Bundle\FrameworkBundle\Translation\Translator">
<argument type="service" id="service_container"/>
<argument type="service" id="translator.selector"/>
<argument type="collection">
<argument key="translation.loader.php" type="collection">
<argument>php</argument>
</argument>
<argument key="translation.loader.yml" type="collection">
<argument>yml</argument>
</argument>
<argument key="translation.loader.xliff" type="collection">
<argument>xlf</argument>
<argument>xliff</argument>
</argument>
<argument key="translation.loader.po" type="collection">
<argument>po</argument>
</argument>
<argument key="translation.loader.mo" type="collection">
<argument>mo</argument>
</argument>
<argument key="translation.loader.qt" type="collection">
<argument>ts</argument>
</argument>
<argument key="translation.loader.csv" type="collection">
<argument>csv</argument>
</argument>
<argument key="translation.loader.res" type="collection">
<argument>res</argument>
</argument>
<argument key="translation.loader.dat" type="collection">
<argument>dat</argument>
</argument>
<argument key="translation.loader.ini" type="collection">
<argument>ini</argument>
</argument>
<argument key="translation.loader.json" type="collection">
<argument>json</argument>
</argument>
</argument>
<argument type="collection">
<argument key="cache_dir">C:\wamp\www\infographicsBundle\app\cache\dev/translations</argument>
<argument key="debug">true</argument>
</argument>
</service>
<service id="translator" class="Symfony\Component\Translation\IdentityTranslator">
<argument type="service" id="translator.selector"/>
</service>
<service id="translator.selector" class="Symfony\Component\Translation\MessageSelector" public="false"/>
<service id="translation.loader.php" class="Symfony\Component\Translation\Loader\PhpFileLoader">
<tag name="translation.loader" alias="php"/>
</service>
<service id="translation.loader.yml" class="Symfony\Component\Translation\Loader\YamlFileLoader">
<tag name="translation.loader" alias="yml"/>
</service>
<service id="translation.loader.xliff" class="Symfony\Component\Translation\Loader\XliffFileLoader">
<tag name="translation.loader" alias="xlf" legacy_alias="xliff" legacy-alias="xliff"/>
</service>
<service id="translation.loader.po" class="Symfony\Component\Translation\Loader\PoFileLoader">
<tag name="translation.loader" alias="po"/>
</service>
<service id="translation.loader.mo" class="Symfony\Component\Translation\Loader\MoFileLoader">
<tag name="translation.loader" alias="mo"/>
</service>
<service id="translation.loader.qt" class="Symfony\Component\Translation\Loader\QtFileLoader">
<tag name="translation.loader" alias="ts"/>
</service>
<service id="translation.loader.csv" class="Symfony\Component\Translation\Loader\CsvFileLoader">
<tag name="translation.loader" alias="csv"/>
</service>
<service id="translation.loader.res" class="Symfony\Component\Translation\Loader\IcuResFileLoader">
<tag name="translation.loader" alias="res"/>
</service>
<service id="translation.loader.dat" class="Symfony\Component\Translation\Loader\IcuDatFileLoader">
<tag name="translation.loader" alias="dat"/>
</service>
<service id="translation.loader.ini" class="Symfony\Component\Translation\Loader\IniFileLoader">
<tag name="translation.loader" alias="ini"/>
</service>
<service id="translation.loader.json" class="Symfony\Component\Translation\Loader\JsonFileLoader">
<tag name="translation.loader" alias="json"/>
</service>
<service id="translation.dumper.php" class="Symfony\Component\Translation\Dumper\PhpFileDumper">
<tag name="translation.dumper" alias="php"/>
</service>
<service id="translation.dumper.xliff" class="Symfony\Component\Translation\Dumper\XliffFileDumper">
<tag name="translation.dumper" alias="xlf"/>
</service>
<service id="translation.dumper.po" class="Symfony\Component\Translation\Dumper\PoFileDumper">
<tag name="translation.dumper" alias="po"/>
</service>
<service id="translation.dumper.mo" class="Symfony\Component\Translation\Dumper\MoFileDumper">
<tag name="translation.dumper" alias="mo"/>
</service>
<service id="translation.dumper.yml" class="Symfony\Component\Translation\Dumper\YamlFileDumper">
<tag name="translation.dumper" alias="yml"/>
</service>
<service id="translation.dumper.qt" class="Symfony\Component\Translation\Dumper\QtFileDumper">
<tag name="translation.dumper" alias="ts"/>
</service>
<service id="translation.dumper.csv" class="Symfony\Component\Translation\Dumper\CsvFileDumper">
<tag name="translation.dumper" alias="csv"/>
</service>
<service id="translation.dumper.ini" class="Symfony\Component\Translation\Dumper\IniFileDumper">
<tag name="translation.dumper" alias="ini"/>
</service>
<service id="translation.dumper.json" class="Symfony\Component\Translation\Dumper\JsonFileDumper">
<tag name="translation.dumper" alias="json"/>
</service>
<service id="translation.dumper.res" class="Symfony\Component\Translation\Dumper\IcuResFileDumper">
<tag name="translation.dumper" alias="res"/>
</service>
<service id="translation.extractor.php" class="Symfony\Bundle\FrameworkBundle\Translation\PhpExtractor">
<tag name="translation.extractor" alias="php"/>
</service>
<service id="translation.loader" class="Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader">
<call method="addLoader">
<argument>php</argument>
<argument type="service" id="translation.loader.php"/>
</call>
<call method="addLoader">
<argument>yml</argument>
<argument type="service" id="translation.loader.yml"/>
</call>
<call method="addLoader">
<argument>xlf</argument>
<argument type="service" id="translation.loader.xliff"/>
</call>
<call method="addLoader">
<argument>xliff</argument>
<argument type="service" id="translation.loader.xliff"/>
</call>
<call method="addLoader">
<argument>po</argument>
<argument type="service" id="translation.loader.po"/>
</call>
<call method="addLoader">
<argument>mo</argument>
<argument type="service" id="translation.loader.mo"/>
</call>
<call method="addLoader">
<argument>ts</argument>
<argument type="service" id="translation.loader.qt"/>
</call>
<call method="addLoader">
<argument>csv</argument>
<argument type="service" id="translation.loader.csv"/>
</call>
<call method="addLoader">
<argument>res</argument>
<argument type="service" id="translation.loader.res"/>
</call>
<call method="addLoader">
<argument>dat</argument>
<argument type="service" id="translation.loader.dat"/>
</call>
<call method="addLoader">
<argument>ini</argument>
<argument type="service" id="translation.loader.ini"/>
</call>
<call method="addLoader">
<argument>json</argument>
<argument type="service" id="translation.loader.json"/>
</call>
</service>
<service id="translation.extractor" class="Symfony\Component\Translation\Extractor\ChainExtractor">
<call method="addExtractor">
<argument>php</argument>
<argument type="service" id="translation.extractor.php"/>
</call>
<call method="addExtractor">
<argument>twig</argument>
<argument type="service" id="twig.translation.extractor"/>
</call>
</service>
<service id="translation.writer" class="Symfony\Component\Translation\Writer\TranslationWriter">
<call method="addDumper">
<argument>php</argument>
<argument type="service" id="translation.dumper.php"/>
</call>
<call method="addDumper">
<argument>xlf</argument>
<argument type="service" id="translation.dumper.xliff"/>
</call>
<call method="addDumper">
<argument>po</argument>
<argument type="service" id="translation.dumper.po"/>
</call>
<call method="addDumper">
<argument>mo</argument>
<argument type="service" id="translation.dumper.mo"/>
</call>
<call method="addDumper">
<argument>yml</argument>
<argument type="service" id="translation.dumper.yml"/>
</call>
<call method="addDumper">
<argument>ts</argument>
<argument type="service" id="translation.dumper.qt"/>
</call>
<call method="addDumper">
<argument>csv</argument>
<argument type="service" id="translation.dumper.csv"/>
</call>
<call method="addDumper">
<argument>ini</argument>
<argument type="service" id="translation.dumper.ini"/>
</call>
<call method="addDumper">
<argument>json</argument>
<argument type="service" id="translation.dumper.json"/>
</call>
<call method="addDumper">
<argument>res</argument>
<argument type="service" id="translation.dumper.res"/>
</call>
</service>
<service id="property_accessor" class="Symfony\Component\PropertyAccess\PropertyAccessor">
<argument>false</argument>
<argument>false</argument>
</service>
<service id="session" class="Symfony\Component\HttpFoundation\Session\Session">
<argument type="service" id="session.storage.native"/>
<argument type="service">
<service class="Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag" public="false"/>
</argument>
<argument type="service">
<service class="Symfony\Component\HttpFoundation\Session\Flash\FlashBag" public="false"/>
</argument>
</service>
<service id="session.storage.metadata_bag" class="Symfony\Component\HttpFoundation\Session\Storage\MetadataBag" public="false">
<argument>_sf2_meta</argument>
<argument>0</argument>
</service>
<service id="session.storage.native" class="Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage">
<argument type="collection">
<argument key="gc_probability">1</argument>
</argument>
<argument>null</argument>
<argument type="service" id="session.storage.metadata_bag"/>
</service>
<service id="session.storage.php_bridge" class="Symfony\Component\HttpFoundation\Session\Storage\PhpBridgeSessionStorage">
<argument>null</argument>
<argument type="service" id="session.storage.metadata_bag"/>
</service>
<service id="session_listener" class="Symfony\Bundle\FrameworkBundle\EventListener\SessionListener">
<tag name="kernel.event_subscriber"/>
<argument type="service" id="service_container"/>
</service>
<service id="session.save_listener" class="Symfony\Component\HttpKernel\EventListener\SaveSessionListener">
<tag name="kernel.event_subscriber"/>
</service>
<service id="security.secure_random" class="Symfony\Component\Security\Core\Util\SecureRandom">
<tag name="monolog.logger" channel="security"/>
<argument>C:\wamp\www\infographicsBundle\app\cache\dev/secure_random.seed</argument>
<argument type="service" id="monolog.logger.security" on-invalid="ignore"/>
</service>
<service id="form.resolved_type_factory" class="Symfony\Component\Form\Extension\DataCollector\Proxy\ResolvedTypeFactoryDataCollectorProxy">
<argument type="service">
<service class="Symfony\Component\Form\ResolvedFormTypeFactory" public="false"/>
</argument>
<argument type="service" id="data_collector.form"/>
</service>
<service id="form.registry" class="Symfony\Component\Form\FormRegistry">
<argument type="collection">
<argument type="service">
<service class="Symfony\Component\Form\Extension\DependencyInjection\DependencyInjectionExtension" public="false">
<argument type="service" id="service_container"/>
<argument type="collection">
<argument key="form">form.type.form</argument>
<argument key="birthday">form.type.birthday</argument>
<argument key="checkbox">form.type.checkbox</argument>
<argument key="choice">form.type.choice</argument>
<argument key="collection">form.type.collection</argument>
<argument key="country">form.type.country</argument>
<argument key="date">form.type.date</argument>
<argument key="datetime">form.type.datetime</argument>
<argument key="email">form.type.email</argument>
<argument key="file">form.type.file</argument>
<argument key="hidden">form.type.hidden</argument>
<argument key="integer">form.type.integer</argument>
<argument key="language">form.type.language</argument>
<argument key="locale">form.type.locale</argument>
<argument key="money">form.type.money</argument>
<argument key="number">form.type.number</argument>
<argument key="password">form.type.password</argument>
<argument key="percent">form.type.percent</argument>
<argument key="radio">form.type.radio</argument>
<argument key="repeated">form.type.repeated</argument>
<argument key="search">form.type.search</argument>
<argument key="textarea">form.type.textarea</argument>
<argument key="text">form.type.text</argument>
<argument key="time">form.type.time</argument>
<argument key="timezone">form.type.timezone</argument>
<argument key="url">form.type.url</argument>
<argument key="button">form.type.button</argument>
<argument key="submit">form.type.submit</argument>
<argument key="reset">form.type.reset</argument>
<argument key="currency">form.type.currency</argument>
<argument key="entity">form.type.entity</argument>
</argument>
<argument type="collection">
<argument key="form" type="collection">
<argument>form.type_extension.form.http_foundation</argument>
<argument>form.type_extension.form.validator</argument>
<argument>form.type_extension.csrf</argument>
<argument>form.type_extension.form.data_collector</argument>
</argument>
<argument key="repeated" type="collection">
<argument>form.type_extension.repeated.validator</argument>
</argument>
<argument key="submit" type="collection">
<argument>form.type_extension.submit.validator</argument>
</argument>
</argument>
<argument type="collection">
<argument>form.type_guesser.validator</argument>
<argument>form.type_guesser.doctrine</argument>
</argument>
</service>
</argument>
</argument>
<argument type="service" id="form.resolved_type_factory"/>
</service>
<service id="form.factory" class="Symfony\Component\Form\FormFactory">
<argument type="service" id="form.registry"/>
<argument type="service" id="form.resolved_type_factory"/>
</service>
<service id="form.type_guesser.validator" class="Symfony\Component\Form\Extension\Validator\ValidatorTypeGuesser">
<tag name="form.type_guesser"/>
<argument type="service" id="validator"/>
</service>
<service id="form.type.form" class="Symfony\Component\Form\Extension\Core\Type\FormType">
<tag name="form.type" alias="form"/>
<argument type="service" id="property_accessor"/>
</service>
<service id="form.type.birthday" class="Symfony\Component\Form\Extension\Core\Type\BirthdayType">
<tag name="form.type" alias="birthday"/>
</service>
<service id="form.type.checkbox" class="Symfony\Component\Form\Extension\Core\Type\CheckboxType">
<tag name="form.type" alias="checkbox"/>
</service>
<service id="form.type.choice" class="Symfony\Component\Form\Extension\Core\Type\ChoiceType">
<tag name="form.type" alias="choice"/>
</service>
<service id="form.type.collection" class="Symfony\Component\Form\Extension\Core\Type\CollectionType">
<tag name="form.type" alias="collection"/>
</service>
<service id="form.type.country" class="Symfony\Component\Form\Extension\Core\Type\CountryType">
<tag name="form.type" alias="country"/>
</service>
<service id="form.type.date" class="Symfony\Component\Form\Extension\Core\Type\DateType">
<tag name="form.type" alias="date"/>
</service>
<service id="form.type.datetime" class="Symfony\Component\Form\Extension\Core\Type\DateTimeType">
<tag name="form.type" alias="datetime"/>
</service>
<service id="form.type.email" class="Symfony\Component\Form\Extension\Core\Type\EmailType">
<tag name="form.type" alias="email"/>
</service>
<service id="form.type.file" class="Symfony\Component\Form\Extension\Core\Type\FileType">
<tag name="form.type" alias="file"/>
</service>
<service id="form.type.hidden" class="Symfony\Component\Form\Extension\Core\Type\HiddenType">
<tag name="form.type" alias="hidden"/>
</service>
<service id="form.type.integer" class="Symfony\Component\Form\Extension\Core\Type\IntegerType">
<tag name="form.type" alias="integer"/>
</service>
<service id="form.type.language" class="Symfony\Component\Form\Extension\Core\Type\LanguageType">
<tag name="form.type" alias="language"/>
</service>
<service id="form.type.locale" class="Symfony\Component\Form\Extension\Core\Type\LocaleType">
<tag name="form.type" alias="locale"/>
</service>
<service id="form.type.money" class="Symfony\Component\Form\Extension\Core\Type\MoneyType">
<tag name="form.type" alias="money"/>
</service>
<service id="form.type.number" class="Symfony\Component\Form\Extension\Core\Type\NumberType">
<tag name="form.type" alias="number"/>
</service>
<service id="form.type.password" class="Symfony\Component\Form\Extension\Core\Type\PasswordType">
<tag name="form.type" alias="password"/>
</service>
<service id="form.type.percent" class="Symfony\Component\Form\Extension\Core\Type\PercentType">
<tag name="form.type" alias="percent"/>
</service>
<service id="form.type.radio" class="Symfony\Component\Form\Extension\Core\Type\RadioType">
<tag name="form.type" alias="radio"/>
</service>
<service id="form.type.repeated" class="Symfony\Component\Form\Extension\Core\Type\RepeatedType">
<tag name="form.type" alias="repeated"/>
</service>
<service id="form.type.search" class="Symfony\Component\Form\Extension\Core\Type\SearchType">
<tag name="form.type" alias="search"/>
</service>
<service id="form.type.textarea" class="Symfony\Component\Form\Extension\Core\Type\TextareaType">
<tag name="form.type" alias="textarea"/>
</service>
<service id="form.type.text" class="Symfony\Component\Form\Extension\Core\Type\TextType">
<tag name="form.type" alias="text"/>
</service>
<service id="form.type.time" class="Symfony\Component\Form\Extension\Core\Type\TimeType">
<tag name="form.type" alias="time"/>
</service>
<service id="form.type.timezone" class="Symfony\Component\Form\Extension\Core\Type\TimezoneType">
<tag name="form.type" alias="timezone"/>
</service>
<service id="form.type.url" class="Symfony\Component\Form\Extension\Core\Type\UrlType">
<tag name="form.type" alias="url"/>
</service>
<service id="form.type.button" class="Symfony\Component\Form\Extension\Core\Type\ButtonType">
<tag name="form.type" alias="button"/>
</service>
<service id="form.type.submit" class="Symfony\Component\Form\Extension\Core\Type\SubmitType">
<tag name="form.type" alias="submit"/>
</service>
<service id="form.type.reset" class="Symfony\Component\Form\Extension\Core\Type\ResetType">
<tag name="form.type" alias="reset"/>
</service>
<service id="form.type.currency" class="Symfony\Component\Form\Extension\Core\Type\CurrencyType">
<tag name="form.type" alias="currency"/>
</service>
<service id="form.type_extension.form.http_foundation" class="Symfony\Component\Form\Extension\HttpFoundation\Type\FormTypeHttpFoundationExtension">
<tag name="form.type_extension" alias="form"/>
<argument type="service">
<service class="Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationRequestHandler" public="false"/>
</argument>
</service>
<service id="form.type_extension.form.validator" class="Symfony\Component\Form\Extension\Validator\Type\FormTypeValidatorExtension">
<tag name="form.type_extension" alias="form"/>
<argument type="service" id="validator"/>
</service>
<service id="form.type_extension.repeated.validator" class="Symfony\Component\Form\Extension\Validator\Type\RepeatedTypeValidatorExtension">
<tag name="form.type_extension" alias="repeated"/>
</service>
<service id="form.type_extension.submit.validator" class="Symfony\Component\Form\Extension\Validator\Type\SubmitTypeValidatorExtension">
<tag name="form.type_extension" alias="submit"/>
</service>
<service id="form.csrf_provider" class="Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfTokenManagerAdapter">
<argument type="service" id="security.csrf.token_manager"/>
</service>
<service id="form.type_extension.csrf" class="Symfony\Component\Form\Extension\Csrf\Type\FormTypeCsrfExtension">
<tag name="form.type_extension" alias="form"/>
<argument type="service" id="form.csrf_provider"/>
<argument>true</argument>
<argument>_token</argument>
<argument type="service" id="translator.default"/>
<argument>validators</argument>
</service>
<service id="security.csrf.token_manager" class="Symfony\Component\Security\Csrf\CsrfTokenManager">
<argument type="service">
<service class="Symfony\Component\Security\Csrf\TokenGenerator\UriSafeTokenGenerator" public="false">
<argument type="service" id="security.secure_random"/>
</service>
</argument>
<argument type="service">
<service class="Symfony\Component\Security\Csrf\TokenStorage\SessionTokenStorage" public="false">
<argument type="service" id="session"/>
</service>
</argument>
</service>
<service id="templating.name_parser" class="Symfony\Bundle\FrameworkBundle\Templating\TemplateNameParser">
<argument type="service" id="kernel"/>
</service>
<service id="templating.filename_parser" class="Symfony\Bundle\FrameworkBundle\Templating\TemplateFilenameParser"/>
<service id="templating.locator" class="Symfony\Bundle\FrameworkBundle\Templating\Loader\TemplateLocator" public="false">
<argument type="service" id="file_locator"/>
<argument>C:\wamp\www\infographicsBundle\app\cache\dev</argument>
</service>
<service id="templating.helper.slots" class="Symfony\Component\Templating\Helper\SlotsHelper">
<tag name="templating.helper" alias="slots"/>
</service>
<service id="templating.helper.assets" class="Symfony\Component\Templating\Helper\CoreAssetsHelper" scope="request">
<tag name="templating.helper" alias="assets"/>
<argument type="service">
<service class="Symfony\Bundle\FrameworkBundle\Templating\Asset\PathPackage" scope="request" public="false">
<argument type="service" id="request"/>
<argument>null</argument>
<argument>%%s?%%s</argument>
</service>
</argument>
<argument type="collection"/>
</service>
<service id="templating.asset.package_factory" class="Symfony\Bundle\FrameworkBundle\Templating\Asset\PackageFactory">
<argument type="service" id="service_container"/>
</service>
<service id="templating.helper.request" class="Symfony\Bundle\FrameworkBundle\Templating\Helper\RequestHelper">
<tag name="templating.helper" alias="request"/>
<argument type="service" id="request_stack"/>
</service>
<service id="templating.helper.session" class="Symfony\Bundle\FrameworkBundle\Templating\Helper\SessionHelper">
<tag name="templating.helper" alias="session"/>
<argument type="service" id="request_stack"/>
</service>
<service id="templating.helper.router" class="Symfony\Bundle\FrameworkBundle\Templating\Helper\RouterHelper">
<tag name="templating.helper" alias="router"/>
<argument type="service" id="router"/>
</service>
<service id="templating.helper.actions" class="Symfony\Bundle\FrameworkBundle\Templating\Helper\ActionsHelper">
<tag name="templating.helper" alias="actions"/>
<argument type="service" id="fragment.handler"/>
</service>
<service id="templating.helper.code" class="Symfony\Bundle\FrameworkBundle\Templating\Helper\CodeHelper">
<tag name="templating.helper" alias="code"/>
<argument>null</argument>
<argument>C:\wamp\www\infographicsBundle\app</argument>
<argument>UTF-8</argument>
</service>
<service id="templating.helper.translator" class="Symfony\Bundle\FrameworkBundle\Templating\Helper\TranslatorHelper">
<tag name="templating.helper" alias="translator"/>
<argument type="service" id="translator"/>
</service>
<service id="templating.helper.form" class="Symfony\Bundle\FrameworkBundle\Templating\Helper\FormHelper">
<tag name="templating.helper" alias="form"/>
<argument type="service">
<service class="Symfony\Component\Form\FormRenderer" public="false">
<argument type="service">
<service class="Symfony\Component\Form\Extension\Templating\TemplatingRendererEngine" public="false">
<argument type="service" id="debug.templating.engine.php"/>
<argument type="collection">
<argument>FrameworkBundle:Form</argument>
</argument>
</service>
</argument>
<argument type="service" id="form.csrf_provider" on-invalid="null"/>
</service>
</argument>
</service>
<service id="templating.helper.stopwatch" class="Symfony\Bundle\FrameworkBundle\Templating\Helper\StopwatchHelper">
<tag name="templating.helper" alias="stopwatch"/>
<argument type="service" id="debug.stopwatch" on-invalid="ignore"/>
</service>
<service id="templating.globals" class="Symfony\Bundle\FrameworkBundle\Templating\GlobalVariables">
<argument type="service" id="service_container"/>
</service>
<service id="validator" class="Symfony\Component\Validator\ValidatorInterface">
<factory service="validator.builder" method="getValidator"/>
</service>
<service id="validator.builder" class="Symfony\Component\Validator\ValidatorBuilderInterface">
<call method="setConstraintValidatorFactory">
<argument type="service">
<service class="Symfony\Bundle\FrameworkBundle\Validator\ConstraintValidatorFactory" public="false">
<argument type="service" id="service_container"/>
<argument type="collection">
<argument key="validator.expression">validator.expression</argument>
<argument key="Symfony\Component\Validator\Constraints\EmailValidator">validator.email</argument>
<argument key="security.validator.user_password">security.validator.user_password</argument>
<argument key="doctrine.orm.validator.unique">doctrine.orm.validator.unique</argument>
</argument>
</service>
</argument>
</call>
<call method="setTranslator">
<argument type="service" id="translator"/>
</call>
<call method="setTranslationDomain">
<argument>validators</argument>
</call>
<call method="addXmlMappings">
<argument type="collection">
<argument>C:\wamp\www\infographicsBundle\vendor\symfony\symfony\src\Symfony\Component\Form/Resources/config/validation.xml</argument>
</argument>
</call>
<call method="enableAnnotationMapping">
<argument type="service" id="annotation_reader"/>
</call>
<call method="addMethodMapping">
<argument>loadValidatorMetadata</argument>
</call>
<call method="setApiVersion">
<argument>3</argument>
</call>
<call method="addObjectInitializers">
<argument type="collection">
<argument type="service" id="doctrine.orm.validator_initializer"/>
</argument>
</call>
<factory class="%validator.builder.factory.class%" method="createValidatorBuilder"/>
</service>
<service id="validator.expression" class="Symfony\Component\Validator\Constraints\ExpressionValidator">
<tag name="validator.constraint_validator" alias="validator.expression"/>
<argument type="service" id="property_accessor"/>
</service>
<service id="validator.email" class="Symfony\Component\Validator\Constraints\EmailValidator">
<tag name="validator.constraint_validator" alias="Symfony\Component\Validator\Constraints\EmailValidator"/>
<argument>false</argument>
</service>
<service id="fragment.listener" class="Symfony\Component\HttpKernel\EventListener\FragmentListener">
<tag name="kernel.event_subscriber"/>
<argument type="service" id="uri_signer"/>
<argument>/_fragment</argument>
</service>
<service id="form.type_extension.form.data_collector" class="Symfony\Component\Form\Extension\DataCollector\Type\DataCollectorTypeExtension">
<tag name="form.type_extension" alias="form"/>
<argument type="service" id="data_collector.form"/>
</service>
<service id="data_collector.form.extractor" class="Symfony\Component\Form\Extension\DataCollector\FormDataExtractor"/>
<service id="data_collector.form" class="Symfony\Component\Form\Extension\DataCollector\FormDataCollector">
<tag name="data_collector" template="@WebProfiler/Collector/form.html.twig" id="form" priority="255"/>
<argument type="service" id="data_collector.form.extractor"/>
</service>
<service id="profiler" class="Symfony\Component\HttpKernel\Profiler\Profiler">
<tag name="monolog.logger" channel="profiler"/>
<argument type="service">
<service class="Symfony\Component\HttpKernel\Profiler\FileProfilerStorage" public="false">
<argument>file:C:\wamp\www\infographicsBundle\app\cache\dev/profiler</argument>
<argument></argument>
<argument></argument>
<argument>86400</argument>
</service>
</argument>
<argument type="service" id="monolog.logger.profiler" on-invalid="null"/>
<call method="add">
<argument type="service" id="data_collector.form"/>
</call>
<call method="add">
<argument type="service">
<service class="Symfony\Component\HttpKernel\DataCollector\ConfigDataCollector" public="false">
<tag name="data_collector" template="@WebProfiler/Collector/config.html.twig" id="config" priority="255"/>
<call method="setKernel">
<argument type="service" id="kernel" on-invalid="ignore"/>
</call>
</service>
</argument>
</call>
<call method="add">
<argument type="service" id="data_collector.request"/>
</call>
<call method="add">
<argument type="service">
<service class="Symfony\Bundle\FrameworkBundle\DataCollector\AjaxDataCollector" public="false">
<tag name="data_collector" template="@WebProfiler/Collector/ajax.html.twig" id="ajax" priority="255"/>
</service>
</argument>
</call>
<call method="add">
<argument type="service">
<service class="Symfony\Component\HttpKernel\DataCollector\ExceptionDataCollector" public="false">
<tag name="data_collector" template="@WebProfiler/Collector/exception.html.twig" id="exception" priority="255"/>
</service>
</argument>
</call>
<call method="add">
<argument type="service">
<service class="Symfony\Component\HttpKernel\DataCollector\EventDataCollector" public="false">
<tag name="data_collector" template="@WebProfiler/Collector/events.html.twig" id="events" priority="255"/>
<argument type="service" id="debug.event_dispatcher" on-invalid="ignore"/>
</service>
</argument>
</call>
<call method="add">
<argument type="service">
<service class="Symfony\Component\HttpKernel\DataCollector\LoggerDataCollector" public="false">
<tag name="data_collector" template="@WebProfiler/Collector/logger.html.twig" id="logger" priority="255"/>
<tag name="monolog.logger" channel="profiler"/>
<argument type="service" id="monolog.logger.profiler" on-invalid="ignore"/>
</service>
</argument>
</call>
<call method="add">
<argument type="service">
<service class="Symfony\Component\HttpKernel\DataCollector\TimeDataCollector" public="false">
<tag name="data_collector" template="@WebProfiler/Collector/time.html.twig" id="time" priority="255"/>
<argument type="service" id="kernel" on-invalid="ignore"/>
<argument type="service" id="debug.stopwatch" on-invalid="ignore"/>
</service>
</argument>
</call>
<call method="add">
<argument type="service">
<service class="Symfony\Component\HttpKernel\DataCollector\MemoryDataCollector" public="false">
<tag name="data_collector" template="@WebProfiler/Collector/memory.html.twig" id="memory" priority="255"/>
</service>
</argument>
</call>
<call method="add">
<argument type="service" id="data_collector.router"/>
</call>
<call method="add">
<argument type="service">
<service class="Symfony\Bundle\SecurityBundle\DataCollector\SecurityDataCollector" public="false">
<tag name="data_collector" template="@Security/Collector/security.html.twig" id="security"/>
<argument type="service" id="security.token_storage" on-invalid="ignore"/>
</service>
</argument>
</call>
<call method="add">
<argument type="service">
<service class="Symfony\Bundle\SwiftmailerBundle\DataCollector\MessageDataCollector" public="false">
<tag name="data_collector" template="@Swiftmailer/Collector/swiftmailer.html.twig" id="swiftmailer"/>
<argument type="service" id="service_container"/>
</service>
</argument>
</call>
<call method="add">
<argument type="service">
<service class="Doctrine\Bundle\DoctrineBundle\DataCollector\DoctrineDataCollector" public="false">
<tag name="data_collector" template="@Doctrine/Collector/db.html.twig" id="db"/>
<argument type="service" id="doctrine"/>
<call method="addLogger">
<argument>default</argument>
<argument type="service" id="doctrine.dbal.logger.profiling.default"/>
</call>
</service>
</argument>
</call>
<call method="add">
<argument type="service" id="data_collector.dump"/>
</call>
</service>
<service id="profiler_listener" class="Symfony\Component\HttpKernel\EventListener\ProfilerListener">
<tag name="kernel.event_subscriber"/>
<argument type="service" id="profiler"/>
<argument>null</argument>
<argument>false</argument>
<argument>false</argument>
<argument type="service" id="request_stack"/>
</service>
<service id="data_collector.request" class="Symfony\Component\HttpKernel\DataCollector\RequestDataCollector">
<tag name="kernel.event_subscriber"/>
<tag name="data_collector" template="@WebProfiler/Collector/request.html.twig" id="request" priority="255"/>
</service>
<service id="data_collector.router" class="Symfony\Bundle\FrameworkBundle\DataCollector\RouterDataCollector">
<tag name="kernel.event_listener" event="kernel.controller" method="onKernelController"/>
<tag name="data_collector" template="@WebProfiler/Collector/router.html.twig" id="router" priority="255"/>
</service>
<service id="routing.loader" class="Symfony\Bundle\FrameworkBundle\Routing\DelegatingLoader">
<tag name="monolog.logger" channel="router"/>
<argument type="service" id="controller_name_converter"/>
<argument type="service" id="monolog.logger.router" on-invalid="null"/>
<argument type="service">
<service class="Symfony\Component\Config\Loader\LoaderResolver" public="false">
<call method="addLoader">
<argument type="service">
<service class="Symfony\Component\Routing\Loader\XmlFileLoader" public="false">
<tag name="routing.loader"/>
<argument type="service" id="file_locator"/>
</service>
</argument>
</call>
<call method="addLoader">
<argument type="service">
<service class="Symfony\Component\Routing\Loader\YamlFileLoader" public="false">
<tag name="routing.loader"/>
<argument type="service" id="file_locator"/>
</service>
</argument>
</call>
<call method="addLoader">
<argument type="service">
<service class="Symfony\Component\Routing\Loader\PhpFileLoader" public="false">
<tag name="routing.loader"/>
<argument type="service" id="file_locator"/>
</service>
</argument>
</call>
<call method="addLoader">
<argument type="service">
<service class="Symfony\Bundle\AsseticBundle\Routing\AsseticLoader" public="false">
<tag name="routing.loader"/>
<argument type="service" id="assetic.asset_manager"/>
<argument type="collection"/>
</service>
</argument>
</call>
<call method="addLoader">
<argument type="service">
<service class="Symfony\Component\Routing\Loader\AnnotationDirectoryLoader" public="false">
<tag name="routing.loader"/>
<argument type="service" id="file_locator"/>
<argument type="service">
<service class="Sensio\Bundle\FrameworkExtraBundle\Routing\AnnotatedRouteControllerLoader" public="false">
<tag name="routing.loader"/>
<argument type="service" id="annotation_reader"/>
</service>
</argument>
</service>
</argument>
</call>
<call method="addLoader">
<argument type="service">
<service class="Symfony\Component\Routing\Loader\AnnotationFileLoader" public="false">
<tag name="routing.loader"/>
<argument type="service" id="file_locator"/>
<argument type="service">
<service class="Sensio\Bundle\FrameworkExtraBundle\Routing\AnnotatedRouteControllerLoader" public="false">
<tag name="routing.loader"/>
<argument type="service" id="annotation_reader"/>
</service>
</argument>
</service>
</argument>
</call>
<call method="addLoader">
<argument type="service">
<service class="Sensio\Bundle\FrameworkExtraBundle\Routing\AnnotatedRouteControllerLoader" public="false">
<tag name="routing.loader"/>
<argument type="service" id="annotation_reader"/>
</service>
</argument>
</call>
</service>
</argument>
</service>
<service id="router.request_context" class="Symfony\Component\Routing\RequestContext" public="false">
<argument></argument>
<argument>GET</argument>
<argument>localhost</argument>
<argument>http</argument>
<argument>80</argument>
<argument>443</argument>
</service>
<service id="router_listener" class="Symfony\Component\HttpKernel\EventListener\RouterListener">
<tag name="kernel.event_subscriber"/>
<tag name="monolog.logger" channel="request"/>
<argument type="service" id="router"/>
<argument type="service" id="router.request_context" on-invalid="ignore"/>
<argument type="service" id="monolog.logger.request" on-invalid="ignore"/>
<argument type="service" id="request_stack"/>
</service>
<service id="debug.debug_handlers_listener" class="Symfony\Component\HttpKernel\EventListener\DebugHandlersListener">
<tag name="kernel.event_subscriber"/>
<tag name="monolog.logger" channel="php"/>
<argument></argument>
<argument type="service" id="monolog.logger.php" on-invalid="null"/>
<argument></argument>
<argument>null</argument>
<argument>true</argument>
<argument>null</argument>
</service>
<service id="debug.stopwatch" class="Symfony\Component\Stopwatch\Stopwatch"/>
<service id="debug.event_dispatcher" class="Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher">
<tag name="monolog.logger" channel="event"/>
<argument type="service">
<service class="Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher" public="false">
<argument type="service" id="service_container"/>
</service>
</argument>
<argument type="service" id="debug.stopwatch"/>
<argument type="service" id="monolog.logger.event" on-invalid="null"/>
<call method="addListenerService">
<argument>kernel.controller</argument>
<argument type="collection">
<argument>data_collector.router</argument>
<argument>onKernelController</argument>
</argument>
<argument>0</argument>
</call>
<call method="addListenerService">
<argument>kernel.request</argument>
<argument type="collection">
<argument>assetic.request_listener</argument>
<argument>onKernelRequest</argument>
</argument>
<argument>0</argument>
</call>
<call method="addSubscriberService">
<argument>response_listener</argument>
<argument>Symfony\Component\HttpKernel\EventListener\ResponseListener</argument>
</call>
<call method="addSubscriberService">
<argument>streamed_response_listener</argument>
<argument>Symfony\Component\HttpKernel\EventListener\StreamedResponseListener</argument>
</call>
<call method="addSubscriberService">
<argument>locale_listener</argument>
<argument>Symfony\Component\HttpKernel\EventListener\LocaleListener</argument>
</call>
<call method="addSubscriberService">
<argument>translator_listener</argument>
<argument>Symfony\Component\HttpKernel\EventListener\TranslatorListener</argument>
</call>
<call method="addSubscriberService">
<argument>session_listener</argument>
<argument>Symfony\Bundle\FrameworkBundle\EventListener\SessionListener</argument>
</call>
<call method="addSubscriberService">
<argument>session.save_listener</argument>
<argument>Symfony\Component\HttpKernel\EventListener\SaveSessionListener</argument>
</call>
<call method="addSubscriberService">
<argument>fragment.listener</argument>
<argument>Symfony\Component\HttpKernel\EventListener\FragmentListener</argument>
</call>
<call method="addSubscriberService">
<argument>profiler_listener</argument>
<argument>Symfony\Component\HttpKernel\EventListener\ProfilerListener</argument>
</call>
<call method="addSubscriberService">
<argument>data_collector.request</argument>
<argument>Symfony\Component\HttpKernel\DataCollector\RequestDataCollector</argument>
</call>
<call method="addSubscriberService">
<argument>router_listener</argument>
<argument>Symfony\Component\HttpKernel\EventListener\RouterListener</argument>
</call>
<call method="addSubscriberService">
<argument>debug.debug_handlers_listener</argument>
<argument>Symfony\Component\HttpKernel\EventListener\DebugHandlersListener</argument>
</call>
<call method="addSubscriberService">
<argument>security.firewall</argument>
<argument>Symfony\Component\Security\Http\Firewall</argument>
</call>
<call method="addSubscriberService">
<argument>security.rememberme.response_listener</argument>
<argument>Symfony\Component\Security\Http\RememberMe\ResponseListener</argument>
</call>
<call method="addSubscriberService">
<argument>twig.exception_listener</argument>
<argument>Symfony\Component\HttpKernel\EventListener\ExceptionListener</argument>
</call>
<call method="addSubscriberService">
<argument>monolog.handler.console</argument>
<argument>Symfony\Bridge\Monolog\Handler\ConsoleHandler</argument>
</call>
<call method="addSubscriberService">
<argument>monolog.handler.console_very_verbose</argument>
<argument>Symfony\Bridge\Monolog\Handler\ConsoleHandler</argument>
</call>
<call method="addSubscriberService">
<argument>swiftmailer.email_sender.listener</argument>
<argument>Symfony\Bundle\SwiftmailerBundle\EventListener\EmailSenderListener</argument>
</call>
<call method="addSubscriberService">
<argument>sensio_framework_extra.controller.listener</argument>
<argument>Sensio\Bundle\FrameworkExtraBundle\EventListener\ControllerListener</argument>
</call>
<call method="addSubscriberService">
<argument>sensio_framework_extra.converter.listener</argument>
<argument>Sensio\Bundle\FrameworkExtraBundle\EventListener\ParamConverterListener</argument>
</call>
<call method="addSubscriberService">
<argument>sensio_framework_extra.view.listener</argument>
<argument>Sensio\Bundle\FrameworkExtraBundle\EventListener\TemplateListener</argument>
</call>
<call method="addSubscriberService">
<argument>sensio_framework_extra.cache.listener</argument>
<argument>Sensio\Bundle\FrameworkExtraBundle\EventListener\HttpCacheListener</argument>
</call>
<call method="addSubscriberService">
<argument>sensio_framework_extra.security.listener</argument>
<argument>Sensio\Bundle\FrameworkExtraBundle\EventListener\SecurityListener</argument>
</call>
<call method="addSubscriberService">
<argument>debug.dump_listener</argument>
<argument>Symfony\Component\HttpKernel\EventListener\DumpListener</argument>
</call>
<call method="addSubscriberService">
<argument>web_profiler.debug_toolbar</argument>
<argument>Symfony\Bundle\WebProfilerBundle\EventListener\WebDebugToolbarListener</argument>
</call>
</service>
<service id="debug.controller_resolver" class="Symfony\Component\HttpKernel\Controller\TraceableControllerResolver">
<argument type="service">
<service class="Symfony\Bundle\FrameworkBundle\Controller\ControllerResolver" public="false">
<tag name="monolog.logger" channel="request"/>
<argument type="service" id="service_container"/>
<argument type="service" id="controller_name_converter"/>
<argument type="service" id="monolog.logger.request" on-invalid="ignore"/>
</service>
</argument>
<argument type="service" id="debug.stopwatch"/>
</service>
<service id="security.context" class="Symfony\Component\Security\Core\SecurityContext">
<argument type="service" id="security.token_storage"/>
<argument type="service" id="security.authorization_checker"/>
</service>
<service id="security.authorization_checker" class="Symfony\Component\Security\Core\Authorization\AuthorizationChecker">
<argument type="service" id="security.token_storage"/>
<argument type="service" id="security.authentication.manager"/>
<argument type="service" id="security.access.decision_manager"/>
<argument>false</argument>
</service>
<service id="security.token_storage" class="Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage"/>
<service id="security.authentication.manager" class="Symfony\Component\Security\Core\Authentication\AuthenticationProviderManager" public="false">
<argument type="collection">
<argument type="service">
<service class="Symfony\Component\Security\Core\Authentication\Provider\DaoAuthenticationProvider" public="false">
<argument type="service" id="security.user.provider.concrete.in_memory"/>
<argument type="service">
<service class="Symfony\Component\Security\Core\User\UserChecker" public="false"/>
</argument>
<argument>demo_secured_area</argument>
<argument type="service" id="security.encoder_factory"/>
<argument>true</argument>
</service>
</argument>
</argument>
<argument>true</argument>
<call method="setEventDispatcher">
<argument type="service" id="debug.event_dispatcher"/>
</call>
</service>
<service id="security.authentication.trust_resolver" class="Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolver" public="false">
<argument>Symfony\Component\Security\Core\Authentication\Token\AnonymousToken</argument>
<argument>Symfony\Component\Security\Core\Authentication\Token\RememberMeToken</argument>
</service>
<service id="security.authentication_utils" class="Symfony\Component\Security\Http\Authentication\AuthenticationUtils">
<argument type="service" id="request_stack"/>
</service>
<service id="security.access.decision_manager" class="Symfony\Component\Security\Core\Authorization\AccessDecisionManager" public="false">
<argument type="collection">
<argument type="service">
<service class="Symfony\Component\Security\Core\Authorization\Voter\RoleHierarchyVoter" public="false">
<tag name="security.voter" priority="245"/>
<argument type="service" id="security.role_hierarchy"/>
</service>
</argument>
<argument type="service">
<service class="Symfony\Component\Security\Core\Authorization\Voter\ExpressionVoter" public="false">
<tag name="security.voter" priority="245"/>
<argument type="service">
<service class="Symfony\Component\Security\Core\Authorization\ExpressionLanguage" public="false"/>
</argument>
<argument type="service" id="security.authentication.trust_resolver"/>
<argument type="service" id="security.role_hierarchy" on-invalid="null"/>
</service>
</argument>
<argument type="service">
<service class="Symfony\Component\Security\Core\Authorization\Voter\AuthenticatedVoter" public="false">
<tag name="security.voter" priority="250"/>
<argument type="service" id="security.authentication.trust_resolver"/>
</service>
</argument>
</argument>
<argument>affirmative</argument>
<argument>false</argument>
<argument>true</argument>
</service>
<service id="security.role_hierarchy" class="Symfony\Component\Security\Core\Role\RoleHierarchy" public="false">
<argument type="collection">
<argument key="ROLE_ADMIN" type="collection">
<argument>ROLE_USER</argument>
</argument>
<argument key="ROLE_SUPER_ADMIN" type="collection">
<argument>ROLE_USER</argument>
<argument>ROLE_ADMIN</argument>
<argument>ROLE_ALLOWED_TO_SWITCH</argument>
</argument>
</argument>
</service>
<service id="security.firewall" class="Symfony\Component\Security\Http\Firewall">
<tag name="kernel.event_subscriber"/>
<argument type="service">
<service class="Symfony\Bundle\SecurityBundle\Security\FirewallMap" public="false">
<argument type="service" id="service_container"/>
<argument type="collection">
<argument key="security.firewall.map.context.dev" type="service">
<service class="Symfony\Component\HttpFoundation\RequestMatcher" public="false">
<argument>^/(_(profiler|wdt)|css|images|js)/</argument>
</service>
</argument>
<argument key="security.firewall.map.context.demo_login" type="service">
<service class="Symfony\Component\HttpFoundation\RequestMatcher" public="false">
<argument>^/demo/secured/login$</argument>
</service>
</argument>
<argument key="security.firewall.map.context.demo_secured_area" type="service">
<service class="Symfony\Component\HttpFoundation\RequestMatcher" public="false">
<argument>^/demo/secured/</argument>
</service>
</argument>
</argument>
</service>
</argument>
<argument type="service" id="debug.event_dispatcher"/>
</service>
<service id="security.validator.user_password" class="Symfony\Component\Security\Core\Validator\Constraints\UserPasswordValidator">
<tag name="validator.constraint_validator" alias="security.validator.user_password"/>
<argument type="service" id="security.context"/>
<argument type="service" id="security.encoder_factory"/>
</service>
<service id="security.rememberme.response_listener" class="Symfony\Component\Security\Http\RememberMe\ResponseListener">
<tag name="kernel.event_subscriber"/>
</service>
<service id="templating.helper.logout_url" class="Symfony\Bundle\SecurityBundle\Templating\Helper\LogoutUrlHelper">
<tag name="templating.helper" alias="logout_url"/>
<argument type="service" id="service_container"/>
<argument type="service" id="router"/>
<call method="registerListener">
<argument>demo_secured_area</argument>
<argument>_demo_logout</argument>
<argument>logout</argument>
<argument>_csrf_token</argument>
<argument>null</argument>
</call>
</service>
<service id="templating.helper.security" class="Symfony\Bundle\SecurityBundle\Templating\Helper\SecurityHelper">
<tag name="templating.helper" alias="security"/>
<argument type="service" id="security.context" on-invalid="ignore"/>
</service>
<service id="security.user.provider.concrete.in_memory" class="Symfony\Component\Security\Core\User\InMemoryUserProvider" public="false">
<call method="createUser">
<argument type="service">
<service class="Symfony\Component\Security\Core\User\User" public="false">
<argument>user</argument>
<argument>userpass</argument>
<argument type="collection">
<argument>ROLE_USER</argument>
</argument>
</service>
</argument>
</call>
<call method="createUser">
<argument type="service">
<service class="Symfony\Component\Security\Core\User\User" public="false">
<argument>admin</argument>
<argument>adminpass</argument>
<argument type="collection">
<argument>ROLE_ADMIN</argument>
</argument>
</service>
</argument>
</call>
</service>
<service id="security.firewall.map.context.dev" class="Symfony\Bundle\SecurityBundle\Security\FirewallContext">
<argument type="collection"/>
<argument>null</argument>
</service>
<service id="security.firewall.map.context.demo_login" class="Symfony\Bundle\SecurityBundle\Security\FirewallContext">
<argument type="collection"/>
<argument>null</argument>
</service>
<service id="security.firewall.map.context.demo_secured_area" class="Symfony\Bundle\SecurityBundle\Security\FirewallContext">
<argument type="collection">
<argument type="service">
<service class="Symfony\Component\Security\Http\Firewall\ChannelListener" public="false">
<tag name="monolog.logger" channel="security"/>
<argument type="service">
<service class="Symfony\Component\Security\Http\AccessMap" public="false"/>
</argument>
<argument type="service">
<service class="Symfony\Component\Security\Http\EntryPoint\RetryAuthenticationEntryPoint" public="false">
<argument>80</argument>
<argument>443</argument>
</service>
</argument>
<argument type="service" id="monolog.logger.security" on-invalid="null"/>
</service>
</argument>
<argument type="service">
<service class="Symfony\Component\Security\Http\Firewall\ContextListener" public="false">
<argument type="service" id="security.context"/>
<argument type="collection">
<argument type="service" id="security.user.provider.concrete.in_memory"/>
</argument>
<argument>demo_secured_area</argument>
<argument type="service" id="monolog.logger.security" on-invalid="null"/>
<argument type="service" id="debug.event_dispatcher" on-invalid="null"/>
</service>
</argument>
<argument type="service">
<service class="Symfony\Component\Security\Http\Firewall\LogoutListener" public="false">
<argument type="service" id="security.context"/>
<argument type="service">
<service class="Symfony\Component\Security\Http\HttpUtils" public="false">
<argument type="service" id="router" on-invalid="null"/>
<argument type="service" id="router" on-invalid="null"/>
</service>
</argument>
<argument type="service">
<service class="Symfony\Component\Security\Http\Logout\DefaultLogoutSuccessHandler" public="false">
<argument type="service">
<service class="Symfony\Component\Security\Http\HttpUtils" public="false">
<argument type="service" id="router" on-invalid="null"/>
<argument type="service" id="router" on-invalid="null"/>
</service>
</argument>
<argument>_demo</argument>
</service>
</argument>
<argument type="collection">
<argument key="csrf_parameter">_csrf_token</argument>
<argument key="intention">logout</argument>
<argument key="logout_path">_demo_logout</argument>
</argument>
<call method="addHandler">
<argument type="service">
<service class="Symfony\Component\Security\Http\Logout\SessionLogoutHandler" public="false"/>
</argument>
</call>
</service>
</argument>
<argument type="service">
<service class="Symfony\Component\Security\Http\Firewall\UsernamePasswordFormAuthenticationListener" public="false">
<tag name="security.remember_me_aware" id="demo_secured_area" provider="security.user.provider.concrete.in_memory"/>
<argument type="service" id="security.context"/>
<argument type="service" id="security.authentication.manager"/>
<argument type="service">
<service class="Symfony\Component\Security\Http\Session\SessionAuthenticationStrategy" public="false">
<argument>migrate</argument>
</service>
</argument>
<argument type="service">
<service class="Symfony\Component\Security\Http\HttpUtils" public="false">
<argument type="service" id="router" on-invalid="null"/>
<argument type="service" id="router" on-invalid="null"/>
</service>
</argument>
<argument>demo_secured_area</argument>
<argument type="service">
<service class="Symfony\Component\Security\Http\Authentication\DefaultAuthenticationSuccessHandler" public="false">
<argument type="service">
<service class="Symfony\Component\Security\Http\HttpUtils" public="false">
<argument type="service" id="router" on-invalid="null"/>
<argument type="service" id="router" on-invalid="null"/>
</service>
</argument>
<argument type="collection"/>
<call method="setOptions">
<argument type="collection">
<argument key="login_path">_demo_login</argument>
<argument key="always_use_default_target_path">false</argument>
<argument key="default_target_path">/</argument>
<argument key="target_path_parameter">_target_path</argument>
<argument key="use_referer">false</argument>
</argument>
</call>
<call method="setProviderKey">
<argument>demo_secured_area</argument>
</call>
</service>
</argument>
<argument type="service">
<service class="Symfony\Component\Security\Http\Authentication\DefaultAuthenticationFailureHandler" public="false">
<argument type="service" id="http_kernel"/>
<argument type="service">
<service class="Symfony\Component\Security\Http\HttpUtils" public="false">
<argument type="service" id="router" on-invalid="null"/>
<argument type="service" id="router" on-invalid="null"/>
</service>
</argument>
<argument type="collection"/>
<argument type="service" id="monolog.logger.security" on-invalid="null"/>
<call method="setOptions">
<argument type="collection">
<argument key="login_path">_demo_login</argument>
<argument key="failure_path">null</argument>
<argument key="failure_forward">false</argument>
<argument key="failure_path_parameter">_failure_path</argument>
</argument>
</call>
</service>
</argument>
<argument type="collection">
<argument key="check_path">_demo_security_check</argument>
<argument key="use_forward">false</argument>
<argument key="require_previous_session">true</argument>
<argument key="username_parameter">_username</argument>
<argument key="password_parameter">_password</argument>
<argument key="csrf_parameter">_csrf_token</argument>
<argument key="intention">authenticate</argument>
<argument key="post_only">true</argument>
</argument>
<argument type="service" id="monolog.logger.security" on-invalid="null"/>
<argument type="service" id="debug.event_dispatcher" on-invalid="null"/>
<argument>null</argument>
</service>
</argument>
<argument type="service">
<service class="Symfony\Component\Security\Http\Firewall\AccessListener" public="false">
<tag name="monolog.logger" channel="security"/>
<argument type="service" id="security.context"/>
<argument type="service" id="security.access.decision_manager"/>
<argument type="service">
<service class="Symfony\Component\Security\Http\AccessMap" public="false"/>
</argument>
<argument type="service" id="security.authentication.manager"/>
</service>
</argument>
</argument>
<argument type="service">
<service class="Symfony\Component\Security\Http\Firewall\ExceptionListener" public="false">
<argument type="service" id="security.context"/>
<argument type="service" id="security.authentication.trust_resolver"/>
<argument type="service">
<service class="Symfony\Component\Security\Http\HttpUtils" public="false">
<argument type="service" id="router" on-invalid="null"/>
<argument type="service" id="router" on-invalid="null"/>
</service>
</argument>
<argument>demo_secured_area</argument>
<argument type="service">
<service class="Symfony\Component\Security\Http\EntryPoint\FormAuthenticationEntryPoint" public="false">
<argument type="service" id="http_kernel"/>
<argument type="service">
<service class="Symfony\Component\Security\Http\HttpUtils" public="false">
<argument type="service" id="router" on-invalid="null"/>
<argument type="service" id="router" on-invalid="null"/>
</service>
</argument>
<argument>_demo_login</argument>
<argument>false</argument>
</service>
</argument>
<argument>null</argument>
<argument>null</argument>
<argument type="service" id="monolog.logger.security" on-invalid="null"/>
</service>
</argument>
</service>
<service id="twig" class="Twig_Environment">
<argument type="service" id="twig.loader"/>
<argument type="collection">
<argument key="debug">true</argument>
<argument key="strict_variables">true</argument>
<argument key="exception_controller">twig.controller.exception:showAction</argument>
<argument key="form_themes" type="collection">
<argument>form_div_layout.html.twig</argument>
</argument>
<argument key="autoescape" type="collection">
<argument>Symfony\Bundle\TwigBundle\TwigDefaultEscapingStrategy</argument>
<argument>guess</argument>
</argument>
<argument key="cache">C:\wamp\www\infographicsBundle\app\cache\dev/twig</argument>
<argument key="charset">UTF-8</argument>
<argument key="paths" type="collection"/>
</argument>
<call method="addExtension">
<argument type="service">
<service class="Symfony\Bundle\SecurityBundle\Twig\Extension\LogoutUrlExtension" public="false">
<tag name="twig.extension"/>
<argument type="service" id="templating.helper.logout_url"/>
</service>
</argument>
</call>
<call method="addExtension">
<argument type="service">
<service class="Symfony\Bridge\Twig\Extension\SecurityExtension" public="false">
<tag name="twig.extension"/>
<argument type="service" id="security.context" on-invalid="ignore"/>
</service>
</argument>
</call>
<call method="addExtension">
<argument type="service">
<service class="Symfony\Bridge\Twig\Extension\TranslationExtension" public="false">
<tag name="twig.extension"/>
<argument type="service" id="translator"/>
</service>
</argument>
</call>
<call method="addExtension">
<argument type="service">
<service class="Symfony\Bundle\TwigBundle\Extension\AssetsExtension" public="false">
<tag name="twig.extension"/>
<argument type="service" id="service_container"/>
<argument type="service" id="router.request_context" on-invalid="null"/>
</service>
</argument>
</call>
<call method="addExtension">
<argument type="service">
<service class="Symfony\Bundle\TwigBundle\Extension\ActionsExtension" public="false">
<tag name="twig.extension"/>
<argument type="service" id="service_container"/>
</service>
</argument>
</call>
<call method="addExtension">
<argument type="service">
<service class="Symfony\Bridge\Twig\Extension\CodeExtension" public="false">
<tag name="twig.extension"/>
<argument>null</argument>
<argument>C:\wamp\www\infographicsBundle\app</argument>
<argument>UTF-8</argument>
</service>
</argument>
</call>
<call method="addExtension">
<argument type="service">
<service class="Symfony\Bridge\Twig\Extension\RoutingExtension" public="false">
<tag name="twig.extension"/>
<argument type="service" id="router"/>
</service>
</argument>
</call>
<call method="addExtension">
<argument type="service">
<service class="Symfony\Bridge\Twig\Extension\YamlExtension" public="false">
<tag name="twig.extension"/>
</service>
</argument>
</call>
<call method="addExtension">
<argument type="service">
<service class="Symfony\Bridge\Twig\Extension\StopwatchExtension" public="false">
<tag name="twig.extension"/>
<argument type="service" id="debug.stopwatch" on-invalid="ignore"/>
<argument>true</argument>
</service>
</argument>
</call>
<call method="addExtension">
<argument type="service">
<service class="Symfony\Bridge\Twig\Extension\ExpressionExtension" public="false">
<tag name="twig.extension"/>
</service>
</argument>
</call>
<call method="addExtension">
<argument type="service">
<service class="Symfony\Bridge\Twig\Extension\HttpKernelExtension" public="false">
<tag name="twig.extension"/>
<argument type="service" id="fragment.handler"/>
</service>
</argument>
</call>
<call method="addExtension">
<argument type="service">
<service class="Symfony\Bridge\Twig\Extension\FormExtension" public="false">
<tag name="twig.extension"/>
<argument type="service">
<service class="Symfony\Bridge\Twig\Form\TwigRenderer" public="false">
<argument type="service">
<service class="Symfony\Bridge\Twig\Form\TwigRendererEngine" public="false">
<argument type="collection">
<argument>form_div_layout.html.twig</argument>
</argument>
</service>
</argument>
<argument type="service" id="form.csrf_provider" on-invalid="null"/>
</service>
</argument>
</service>
</argument>
</call>
<call method="addExtension">
<argument type="service">
<service class="Twig_Extension_Debug" public="false">
<tag name="twig.extension"/>
</service>
</argument>
</call>
<call method="addExtension">
<argument type="service">
<service class="Symfony\Bundle\AsseticBundle\Twig\AsseticExtension" public="false">
<tag name="twig.extension"/>
<tag name="assetic.templating.twig"/>
<argument type="service" id="assetic.asset_factory"/>
<argument type="service" id="templating.name_parser"/>
<argument>true</argument>
<argument type="collection"/>
<argument type="collection"/>
<argument type="service">
<service class="Symfony\Bundle\AsseticBundle\DefaultValueSupplier" public="false">
<argument type="service" id="service_container"/>
</service>
</argument>
</service>
</argument>
</call>
<call method="addExtension">
<argument type="service">
<service class="Doctrine\Bundle\DoctrineBundle\Twig\DoctrineExtension" public="false">
<tag name="twig.extension"/>
</service>
</argument>
</call>
<call method="addExtension">
<argument type="service">
<service class="Symfony\Bridge\Twig\Extension\DumpExtension" public="false">
<tag name="twig.extension"/>
<argument type="service" id="var_dumper.cloner"/>
</service>
</argument>
</call>
<call method="addExtension">
<argument type="service">
<service class="Symfony\Bundle\WebProfilerBundle\Twig\WebProfilerExtension" public="false">
<tag name="twig.extension"/>
</service>
</argument>
</call>
<call method="addGlobal">
<argument>app</argument>
<argument type="service" id="templating.globals"/>
</call>
</service>
<service id="twig.translation.extractor" class="Symfony\Bridge\Twig\Translation\TwigExtractor">
<tag name="translation.extractor" alias="twig"/>
<argument type="service" id="twig"/>
</service>
<service id="twig.exception_listener" class="Symfony\Component\HttpKernel\EventListener\ExceptionListener">
<tag name="kernel.event_subscriber"/>
<tag name="monolog.logger" channel="request"/>
<argument>twig.controller.exception:showAction</argument>
<argument type="service" id="monolog.logger.request" on-invalid="null"/>
</service>
<service id="twig.controller.exception" class="Symfony\Bundle\TwigBundle\Controller\ExceptionController">
<argument type="service" id="twig"/>
<argument>true</argument>
</service>
<service id="twig.controller.preview_error" class="Symfony\Bundle\TwigBundle\Controller\PreviewErrorController">
<argument type="service" id="http_kernel"/>
<argument>twig.controller.exception:showAction</argument>
</service>
<service id="monolog.handler.main" class="Monolog\Handler\StreamHandler">
<argument>C:\wamp\www\infographicsBundle\app\logs/dev.log</argument>
<argument>100</argument>
<argument>true</argument>
<argument>null</argument>
</service>
<service id="monolog.handler.console" class="Symfony\Bridge\Monolog\Handler\ConsoleHandler">
<tag name="kernel.event_subscriber"/>
<argument>null</argument>
<argument>false</argument>
<argument type="collection">
<argument key="2">200</argument>
<argument key="3">100</argument>
<argument key="1">300</argument>
<argument key="4">100</argument>
</argument>
</service>
<service id="monolog.handler.console_very_verbose" class="Symfony\Bridge\Monolog\Handler\ConsoleHandler">
<tag name="kernel.event_subscriber"/>
<argument>null</argument>
<argument>false</argument>
<argument type="collection">
<argument key="2">250</argument>
<argument key="3">250</argument>
<argument key="4">100</argument>
<argument key="1">300</argument>
</argument>
</service>
<service id="swiftmailer.email_sender.listener" class="Symfony\Bundle\SwiftmailerBundle\EventListener\EmailSenderListener">
<tag name="kernel.event_subscriber"/>
<argument type="service" id="service_container"/>
<argument type="service" id="logger" on-invalid="null"/>
</service>
<service id="swiftmailer.mailer.default.transport.eventdispatcher" class="Swift_Events_SimpleEventDispatcher" public="false"/>
<service id="swiftmailer.mailer.default" class="Swift_Mailer">
<argument type="service" id="swiftmailer.mailer.default.transport"/>
</service>
<service id="swiftmailer.mailer.default.plugin.messagelogger" class="Swift_Plugins_MessageLogger">
<tag name="swiftmailer.default.plugin"/>
</service>
<service id="assetic.filter_manager" class="Symfony\Bundle\AsseticBundle\FilterManager">
<argument type="service" id="service_container"/>
<argument type="collection">
<argument key="cssrewrite">assetic.filter.cssrewrite</argument>
</argument>
</service>
<service id="assetic.asset_manager" class="Assetic\Factory\LazyAssetManager">
<argument type="service" id="assetic.asset_factory"/>
<argument type="collection">
<argument key="twig" type="service">
<service class="Assetic\Factory\Loader\CachedFormulaLoader" public="false">
<tag name="assetic.formula_loader" alias="twig"/>
<tag name="assetic.templating.twig"/>
<argument type="service">
<service class="Assetic\Extension\Twig\TwigFormulaLoader" public="false">
<tag name="assetic.templating.twig"/>
<tag name="monolog.logger" channel="assetic"/>
<argument type="service" id="twig"/>
<argument type="service" id="monolog.logger.assetic" on-invalid="ignore"/>
</service>
</argument>
<argument type="service">
<service class="Assetic\Cache\ConfigCache" public="false">
<argument>C:\wamp\www\infographicsBundle\app\cache\dev/assetic/config</argument>
</service>
</argument>
<argument>true</argument>
</service>
</argument>
</argument>
<call method="addResource">
<argument type="service">
<service class="Symfony\Bundle\AsseticBundle\Factory\Resource\DirectoryResource" public="false">
<tag name="assetic.templating.twig"/>
<tag name="assetic.formula_resource" loader="twig"/>
<argument type="service" id="templating.loader"/>
<argument></argument>
<argument>C:\wamp\www\infographicsBundle\app/Resources/views</argument>
<argument>/\.[^.]+\.twig$/</argument>
</service>
</argument>
<argument>twig</argument>
</call>
</service>
<service id="assetic.asset_factory" class="Symfony\Bundle\AsseticBundle\Factory\AssetFactory" public="false">
<argument type="service" id="kernel"/>
<argument type="service" id="service_container"/>
<argument type="service">
<service class="Symfony\Component\DependencyInjection\ParameterBag\ParameterBag" public="false">
<factory service="service_container" method="getParameterBag"/>
</service>
</argument>
<argument>C:\wamp\www\infographicsBundle\app/../web</argument>
<argument>true</argument>
<call method="addWorker">
<argument type="service">
<service class="Symfony\Bundle\AsseticBundle\Factory\Worker\UseControllerWorker" public="false">
<tag name="assetic.factory_worker"/>
</service>
</argument>
</call>
</service>
<service id="assetic.filter.cssrewrite" class="Assetic\Filter\CssRewriteFilter">
<tag name="assetic.filter" alias="cssrewrite"/>
</service>
<service id="assetic.controller" class="Symfony\Bundle\AsseticBundle\Controller\AsseticController" scope="prototype">
<argument type="service" id="request"/>
<argument type="service" id="assetic.asset_manager"/>
<argument type="service" id="assetic.cache"/>
<argument>false</argument>
<argument type="service" id="profiler" on-invalid="null"/>
</service>
<service id="assetic.cache" class="Assetic\Cache\FilesystemCache" public="false">
<argument>C:\wamp\www\infographicsBundle\app\cache\dev/assetic/assets</argument>
</service>
<service id="assetic.request_listener" class="Symfony\Bundle\AsseticBundle\EventListener\RequestListener">
<tag name="kernel.event_listener" event="kernel.request" method="onKernelRequest"/>
</service>
<service id="doctrine.dbal.connection_factory" class="Doctrine\Bundle\DoctrineBundle\ConnectionFactory">
<argument type="collection"/>
</service>
<service id="doctrine" class="Doctrine\Bundle\DoctrineBundle\Registry">
<argument type="service" id="service_container"/>
<argument type="collection">
<argument key="default">doctrine.dbal.default_connection</argument>
</argument>
<argument type="collection">
<argument key="default">doctrine.orm.default_entity_manager</argument>
</argument>
<argument>default</argument>
<argument>default</argument>
</service>
<service id="doctrine.dbal.logger.profiling.default" class="Doctrine\DBAL\Logging\DebugStack" public="false"/>
<service id="doctrine.dbal.default_connection" class="Doctrine\DBAL\Connection" factory-method="createConnection" factory-service="doctrine.dbal.connection_factory">
<argument type="collection">
<argument key="driver">pdo_mysql</argument>
<argument key="host">127.0.0.1</argument>
<argument key="port">null</argument>
<argument key="dbname">symfony</argument>
<argument key="user">root</argument>
<argument key="password">null</argument>
<argument key="charset">UTF8</argument>
<argument key="driverOptions" type="collection"/>
</argument>
<argument type="service">
<service class="Doctrine\DBAL\Configuration" public="false">
<call method="setSQLLogger">
<argument type="service">
<service class="Doctrine\DBAL\Logging\LoggerChain" public="false">
<call method="addLogger">
<argument type="service">
<service class="Symfony\Bridge\Doctrine\Logger\DbalLogger" public="false">
<tag name="monolog.logger" channel="doctrine"/>
<argument type="service" id="monolog.logger.doctrine" on-invalid="null"/>
<argument type="service" id="debug.stopwatch" on-invalid="null"/>
</service>
</argument>
</call>
<call method="addLogger">
<argument type="service" id="doctrine.dbal.logger.profiling.default"/>
</call>
</service>
</argument>
</call>
</service>
</argument>
<argument type="service">
<service class="Symfony\Bridge\Doctrine\ContainerAwareEventManager" public="false">
<argument type="service" id="service_container"/>
</service>
</argument>
<argument type="collection"/>
</service>
<service id="form.type_guesser.doctrine" class="Symfony\Bridge\Doctrine\Form\DoctrineOrmTypeGuesser">
<tag name="form.type_guesser"/>
<argument type="service" id="doctrine"/>
</service>
<service id="form.type.entity" class="Symfony\Bridge\Doctrine\Form\Type\EntityType">
<tag name="form.type" alias="entity"/>
<argument type="service" id="doctrine"/>
</service>
<service id="doctrine.orm.validator.unique" class="Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntityValidator">
<tag name="validator.constraint_validator" alias="doctrine.orm.validator.unique"/>
<argument type="service" id="doctrine"/>
</service>
<service id="doctrine.orm.validator_initializer" class="Symfony\Bridge\Doctrine\Validator\DoctrineInitializer">
<tag name="validator.initializer"/>
<argument type="service" id="doctrine"/>
</service>
<service id="doctrine_cache.providers.doctrine.orm.default_metadata_cache" class="Doctrine\Common\Cache\ArrayCache">
<call method="setNamespace">
<argument>sf2orm_default_0387c18970ed94123b8a536d267956b2b1d2b9afec4f8519d9acde13a650cba6</argument>
</call>
</service>
<service id="doctrine_cache.providers.doctrine.orm.default_result_cache" class="Doctrine\Common\Cache\ArrayCache">
<call method="setNamespace">
<argument>sf2orm_default_0387c18970ed94123b8a536d267956b2b1d2b9afec4f8519d9acde13a650cba6</argument>
</call>
</service>
<service id="doctrine_cache.providers.doctrine.orm.default_query_cache" class="Doctrine\Common\Cache\ArrayCache">
<call method="setNamespace">
<argument>sf2orm_default_0387c18970ed94123b8a536d267956b2b1d2b9afec4f8519d9acde13a650cba6</argument>
</call>
</service>
<service id="doctrine.orm.default_entity_listener_resolver" class="Doctrine\ORM\Mapping\DefaultEntityListenerResolver"/>
<service id="doctrine.orm.default_manager_configurator" class="Doctrine\Bundle\DoctrineBundle\ManagerConfigurator">
<argument type="collection"/>
<argument type="collection"/>
</service>
<service id="doctrine.orm.default_entity_manager" class="Doctrine\ORM\EntityManager" factory-method="create" factory-class="%doctrine.orm.entity_manager.class%">
<argument type="service" id="doctrine.dbal.default_connection"/>
<argument type="service">
<service class="Doctrine\ORM\Configuration" public="false">
<call method="setEntityNamespaces">
<argument type="collection"/>
</call>
<call method="setMetadataCacheImpl">
<argument type="service" id="doctrine_cache.providers.doctrine.orm.default_metadata_cache"/>
</call>
<call method="setQueryCacheImpl">
<argument type="service" id="doctrine_cache.providers.doctrine.orm.default_query_cache"/>
</call>
<call method="setResultCacheImpl">
<argument type="service" id="doctrine_cache.providers.doctrine.orm.default_result_cache"/>
</call>
<call method="setMetadataDriverImpl">
<argument type="service">
<service class="Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain" public="false"/>
</argument>
</call>
<call method="setProxyDir">
<argument>C:\wamp\www\infographicsBundle\app\cache\dev/doctrine/orm/Proxies</argument>
</call>
<call method="setProxyNamespace">
<argument>Proxies</argument>
</call>
<call method="setAutoGenerateProxyClasses">
<argument>true</argument>
</call>
<call method="setClassMetadataFactoryName">
<argument>Doctrine\ORM\Mapping\ClassMetadataFactory</argument>
</call>
<call method="setDefaultRepositoryClassName">
<argument>Doctrine\ORM\EntityRepository</argument>
</call>
<call method="setNamingStrategy">
<argument type="service">
<service class="Doctrine\ORM\Mapping\DefaultNamingStrategy" public="false"/>
</argument>
</call>
<call method="setEntityListenerResolver">
<argument type="service" id="doctrine.orm.default_entity_listener_resolver"/>
</call>
</service>
</argument>
<configurator service="doctrine.orm.default_manager_configurator" method="configure"/>
</service>
<service id="sensio_framework_extra.view.guesser" class="Sensio\Bundle\FrameworkExtraBundle\Templating\TemplateGuesser">
<argument type="service" id="kernel"/>
</service>
<service id="sensio_framework_extra.controller.listener" class="Sensio\Bundle\FrameworkExtraBundle\EventListener\ControllerListener">
<tag name="kernel.event_subscriber"/>
<argument type="service" id="annotation_reader"/>
</service>
<service id="sensio_framework_extra.converter.listener" class="Sensio\Bundle\FrameworkExtraBundle\EventListener\ParamConverterListener">
<tag name="kernel.event_subscriber"/>
<argument type="service" id="sensio_framework_extra.converter.manager"/>
<argument>true</argument>
</service>
<service id="sensio_framework_extra.converter.manager" class="Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\ParamConverterManager">
<call method="add">
<argument type="service" id="sensio_framework_extra.converter.doctrine.orm"/>
<argument>0</argument>
<argument>doctrine.orm</argument>
</call>
<call method="add">
<argument type="service" id="sensio_framework_extra.converter.datetime"/>
<argument>0</argument>
<argument>datetime</argument>
</call>
</service>
<service id="sensio_framework_extra.converter.doctrine.orm" class="Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\DoctrineParamConverter">
<tag name="request.param_converter" converter="doctrine.orm"/>
<argument type="service" id="doctrine" on-invalid="ignore"/>
</service>
<service id="sensio_framework_extra.converter.datetime" class="Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\DateTimeParamConverter">
<tag name="request.param_converter" converter="datetime"/>
</service>
<service id="sensio_framework_extra.view.listener" class="Sensio\Bundle\FrameworkExtraBundle\EventListener\TemplateListener">
<tag name="kernel.event_subscriber"/>
<argument type="service" id="service_container"/>
</service>
<service id="sensio_framework_extra.cache.listener" class="Sensio\Bundle\FrameworkExtraBundle\EventListener\HttpCacheListener">
<tag name="kernel.event_subscriber"/>
</service>
<service id="sensio_framework_extra.security.listener" class="Sensio\Bundle\FrameworkExtraBundle\EventListener\SecurityListener">
<tag name="kernel.event_subscriber"/>
<argument type="service" id="security.context" on-invalid="null"/>
<argument type="service">
<service class="Sensio\Bundle\FrameworkExtraBundle\Security\ExpressionLanguage" public="false"/>
</argument>
<argument type="service" id="security.authentication.trust_resolver" on-invalid="null"/>
<argument type="service" id="security.role_hierarchy" on-invalid="null"/>
</service>
<service id="data_collector.dump" class="Symfony\Component\HttpKernel\DataCollector\DumpDataCollector">
<tag name="data_collector" id="dump" template="@Debug/Profiler/dump.html.twig"/>
<argument type="service" id="debug.stopwatch" on-invalid="ignore"/>
<argument>null</argument>
<argument>UTF-8</argument>
</service>
<service id="debug.dump_listener" class="Symfony\Component\HttpKernel\EventListener\DumpListener">
<tag name="kernel.event_subscriber"/>
<argument type="service" id="var_dumper.cloner"/>
<argument type="service" id="data_collector.dump"/>
</service>
<service id="var_dumper.cloner" class="Symfony\Component\VarDumper\Cloner\VarCloner">
<call method="setMaxItems">
<argument>2500</argument>
</call>
<call method="setMaxString">
<argument>-1</argument>
</call>
</service>
<service id="web_profiler.controller.profiler" class="Symfony\Bundle\WebProfilerBundle\Controller\ProfilerController">
<argument type="service" id="router" on-invalid="null"/>
<argument type="service" id="profiler" on-invalid="null"/>
<argument type="service" id="twig"/>
<argument type="collection">
<argument key="data_collector.form" type="collection">
<argument>form</argument>
<argument>@WebProfiler/Collector/form.html.twig</argument>
</argument>
<argument key="data_collector.config" type="collection">
<argument>config</argument>
<argument>@WebProfiler/Collector/config.html.twig</argument>
</argument>
<argument key="data_collector.request" type="collection">
<argument>request</argument>
<argument>@WebProfiler/Collector/request.html.twig</argument>
</argument>
<argument key="data_collector.ajax" type="collection">
<argument>ajax</argument>
<argument>@WebProfiler/Collector/ajax.html.twig</argument>
</argument>
<argument key="data_collector.exception" type="collection">
<argument>exception</argument>
<argument>@WebProfiler/Collector/exception.html.twig</argument>
</argument>
<argument key="data_collector.events" type="collection">
<argument>events</argument>
<argument>@WebProfiler/Collector/events.html.twig</argument>
</argument>
<argument key="data_collector.logger" type="collection">
<argument>logger</argument>
<argument>@WebProfiler/Collector/logger.html.twig</argument>
</argument>
<argument key="data_collector.time" type="collection">
<argument>time</argument>
<argument>@WebProfiler/Collector/time.html.twig</argument>
</argument>
<argument key="data_collector.memory" type="collection">
<argument>memory</argument>
<argument>@WebProfiler/Collector/memory.html.twig</argument>
</argument>
<argument key="data_collector.router" type="collection">
<argument>router</argument>
<argument>@WebProfiler/Collector/router.html.twig</argument>
</argument>
<argument key="data_collector.security" type="collection">
<argument>security</argument>
<argument>@Security/Collector/security.html.twig</argument>
</argument>
<argument key="swiftmailer.data_collector" type="collection">
<argument>swiftmailer</argument>
<argument>@Swiftmailer/Collector/swiftmailer.html.twig</argument>
</argument>
<argument key="data_collector.doctrine" type="collection">
<argument>db</argument>
<argument>@Doctrine/Collector/db.html.twig</argument>
</argument>
<argument key="data_collector.dump" type="collection">
<argument>dump</argument>
<argument>@Debug/Profiler/dump.html.twig</argument>
</argument>
</argument>
<argument>bottom</argument>
</service>
<service id="web_profiler.controller.router" class="Symfony\Bundle\WebProfilerBundle\Controller\RouterController">
<argument type="service" id="profiler" on-invalid="null"/>
<argument type="service" id="twig"/>
<argument type="service" id="router" on-invalid="null"/>
</service>
<service id="web_profiler.controller.exception" class="Symfony\Bundle\WebProfilerBundle\Controller\ExceptionController">
<argument type="service" id="profiler" on-invalid="null"/>
<argument type="service" id="twig"/>
<argument>true</argument>
</service>
<service id="web_profiler.debug_toolbar" class="Symfony\Bundle\WebProfilerBundle\EventListener\WebDebugToolbarListener">
<tag name="kernel.event_subscriber"/>
<argument type="service" id="twig"/>
<argument>false</argument>
<argument>2</argument>
<argument>bottom</argument>
<argument type="service" id="router" on-invalid="ignore"/>
<argument>^/bundles|^/_wdt</argument>
</service>
<service id="sensio_distribution.webconfigurator" class="Sensio\Bundle\DistributionBundle\Configurator\Configurator">
<argument>C:\wamp\www\infographicsBundle\app</argument>
<call method="addStep">
<argument type="service">
<service class="Sensio\Bundle\DistributionBundle\Configurator\Step\DoctrineStep" public="false">
<tag name="webconfigurator.step" priority="10"/>
</service>
</argument>
<argument>10</argument>
</call>
<call method="addStep">
<argument type="service">
<service class="Sensio\Bundle\DistributionBundle\Configurator\Step\SecretStep" public="false">
<tag name="webconfigurator.step"/>
</service>
</argument>
<argument>0</argument>
</call>
</service>
<service id="sensio_distribution.security_checker" class="SensioLabs\Security\SecurityChecker"/>
<service id="sensio_distribution.security_checker.command" class="SensioLabs\Security\Command\SecurityCheckerCommand">
<tag name="console.command"/>
<argument type="service" id="sensio_distribution.security_checker"/>
</service>
<service id="monolog.logger.request" class="Symfony\Bridge\Monolog\Logger">
<argument>request</argument>
<call method="pushHandler">
<argument type="service" id="monolog.handler.console"/>
</call>
<call method="pushHandler">
<argument type="service" id="monolog.handler.main"/>
</call>
<call method="pushHandler">
<argument type="service" id="monolog.handler.debug"/>
</call>
</service>
<service id="monolog.logger.translation" class="Symfony\Bridge\Monolog\Logger">
<argument>translation</argument>
<call method="pushHandler">
<argument type="service" id="monolog.handler.console"/>
</call>
<call method="pushHandler">
<argument type="service" id="monolog.handler.main"/>
</call>
<call method="pushHandler">
<argument type="service" id="monolog.handler.debug"/>
</call>
</service>
<service id="monolog.logger.security" class="Symfony\Bridge\Monolog\Logger">
<argument>security</argument>
<call method="pushHandler">
<argument type="service" id="monolog.handler.console"/>
</call>
<call method="pushHandler">
<argument type="service" id="monolog.handler.main"/>
</call>
<call method="pushHandler">
<argument type="service" id="monolog.handler.debug"/>
</call>
</service>
<service id="monolog.logger.templating" class="Symfony\Bridge\Monolog\Logger">
<argument>templating</argument>
<call method="pushHandler">
<argument type="service" id="monolog.handler.console"/>
</call>
<call method="pushHandler">
<argument type="service" id="monolog.handler.main"/>
</call>
<call method="pushHandler">
<argument type="service" id="monolog.handler.debug"/>
</call>
</service>
<service id="monolog.logger.profiler" class="Symfony\Bridge\Monolog\Logger">
<argument>profiler</argument>
<call method="pushHandler">
<argument type="service" id="monolog.handler.console"/>
</call>
<call method="pushHandler">
<argument type="service" id="monolog.handler.main"/>
</call>
<call method="pushHandler">
<argument type="service" id="monolog.handler.debug"/>
</call>
</service>
<service id="monolog.logger.router" class="Symfony\Bridge\Monolog\Logger">
<argument>router</argument>
<call method="pushHandler">
<argument type="service" id="monolog.handler.console"/>
</call>
<call method="pushHandler">
<argument type="service" id="monolog.handler.main"/>
</call>
<call method="pushHandler">
<argument type="service" id="monolog.handler.debug"/>
</call>
</service>
<service id="monolog.logger.php" class="Symfony\Bridge\Monolog\Logger">
<argument>php</argument>
<call method="pushHandler">
<argument type="service" id="monolog.handler.console"/>
</call>
<call method="pushHandler">
<argument type="service" id="monolog.handler.main"/>
</call>
<call method="pushHandler">
<argument type="service" id="monolog.handler.debug"/>
</call>
</service>
<service id="monolog.logger.event" class="Symfony\Bridge\Monolog\Logger">
<argument>event</argument>
<call method="pushHandler">
<argument type="service" id="monolog.handler.console"/>
</call>
<call method="pushHandler">
<argument type="service" id="monolog.handler.main"/>
</call>
<call method="pushHandler">
<argument type="service" id="monolog.handler.debug"/>
</call>
</service>
<service id="monolog.logger.assetic" class="Symfony\Bridge\Monolog\Logger">
<argument>assetic</argument>
<call method="pushHandler">
<argument type="service" id="monolog.handler.console"/>
</call>
<call method="pushHandler">
<argument type="service" id="monolog.handler.main"/>
</call>
<call method="pushHandler">
<argument type="service" id="monolog.handler.debug"/>
</call>
</service>
<service id="monolog.logger.doctrine" class="Symfony\Bridge\Monolog\Logger">
<argument>doctrine</argument>
<call method="pushHandler">
<argument type="service" id="monolog.handler.console_very_verbose"/>
</call>
<call method="pushHandler">
<argument type="service" id="monolog.handler.main"/>
</call>
<call method="pushHandler">
<argument type="service" id="monolog.handler.debug"/>
</call>
</service>
<service id="monolog.handler.debug" class="Symfony\Bridge\Monolog\Handler\DebugHandler">
<argument>100</argument>
<argument>true</argument>
</service>
<service id="session.storage.filesystem" class="Symfony\Component\HttpFoundation\Session\Storage\MockFileSessionStorage">
<argument>C:\wamp\www\infographicsBundle\app\cache\dev/sessions</argument>
<argument>MOCKSESSID</argument>
<argument type="service" id="session.storage.metadata_bag"/>
</service>
<service id="templating.loader" class="Symfony\Bundle\FrameworkBundle\Templating\Loader\FilesystemLoader">
<argument type="service" id="templating.locator"/>
</service>
<service id="debug.templating.engine.php" class="Symfony\Bundle\FrameworkBundle\Templating\TimedPhpEngine">
<argument type="service" id="templating.name_parser"/>
<argument type="service" id="service_container"/>
<argument type="service" id="templating.loader"/>
<argument type="service" id="debug.stopwatch"/>
<argument type="service" id="templating.globals"/>
<call method="setCharset">
<argument>UTF-8</argument>
</call>
<call method="setHelpers">
<argument type="collection">
<argument key="slots">templating.helper.slots</argument>
<argument key="assets">templating.helper.assets</argument>
<argument key="request">templating.helper.request</argument>
<argument key="session">templating.helper.session</argument>
<argument key="router">templating.helper.router</argument>
<argument key="actions">templating.helper.actions</argument>
<argument key="code">templating.helper.code</argument>
<argument key="translator">templating.helper.translator</argument>
<argument key="form">templating.helper.form</argument>
<argument key="stopwatch">templating.helper.stopwatch</argument>
<argument key="logout_url">templating.helper.logout_url</argument>
<argument key="security">templating.helper.security</argument>
<argument key="assetic">assetic.helper.dynamic</argument>
</argument>
</call>
</service>
<service id="templating" class="Symfony\Bundle\TwigBundle\Debug\TimedTwigEngine">
<argument type="service" id="twig"/>
<argument type="service" id="templating.name_parser"/>
<argument type="service" id="templating.locator"/>
<argument type="service" id="debug.stopwatch"/>
</service>
<service id="router" class="Symfony\Bundle\FrameworkBundle\Routing\Router">
<tag name="monolog.logger" channel="router"/>
<argument type="service" id="service_container"/>
<argument>C:\wamp\www\infographicsBundle\app\cache\dev/assetic/routing.yml</argument>
<argument type="collection">
<argument key="cache_dir">C:\wamp\www\infographicsBundle\app\cache\dev</argument>
<argument key="debug">true</argument>
<argument key="generator_class">Symfony\Component\Routing\Generator\UrlGenerator</argument>
<argument key="generator_base_class">Symfony\Component\Routing\Generator\UrlGenerator</argument>
<argument key="generator_dumper_class">Symfony\Component\Routing\Generator\Dumper\PhpGeneratorDumper</argument>
<argument key="generator_cache_class">appDevUrlGenerator</argument>
<argument key="matcher_class">Symfony\Bundle\FrameworkBundle\Routing\RedirectableUrlMatcher</argument>
<argument key="matcher_base_class">Symfony\Bundle\FrameworkBundle\Routing\RedirectableUrlMatcher</argument>
<argument key="matcher_dumper_class">Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper</argument>
<argument key="matcher_cache_class">appDevUrlMatcher</argument>
<argument key="strict_requirements">true</argument>
<argument key="resource_type">yaml</argument>
</argument>
<argument type="service" id="router.request_context" on-invalid="ignore"/>
<argument type="service" id="monolog.logger.router" on-invalid="ignore"/>
</service>
<service id="annotation_reader" class="Doctrine\Common\Annotations\FileCacheReader">
<argument type="service">
<service class="Doctrine\Common\Annotations\AnnotationReader" public="false"/>
</argument>
<argument>C:\wamp\www\infographicsBundle\app\cache\dev/annotations</argument>
<argument>true</argument>
</service>
<service id="security.encoder_factory" class="Symfony\Component\Security\Core\Encoder\EncoderFactory">
<argument type="collection">
<argument key="Symfony\Component\Security\Core\User\User" type="collection">
<argument key="class">%security.encoder.plain.class%</argument>
<argument key="arguments" type="collection">
<argument>false</argument>
</argument>
</argument>
</argument>
</service>
<service id="security.password_encoder" class="Symfony\Component\Security\Core\Encoder\UserPasswordEncoder">
<argument type="service" id="security.encoder_factory"/>
</service>
<service id="twig.loader" class="Symfony\Bundle\TwigBundle\Loader\FilesystemLoader">
<tag name="twig.loader"/>
<argument type="service" id="templating.locator"/>
<argument type="service" id="templating.name_parser"/>
<call method="addPath">
<argument>C:\wamp\www\infographicsBundle\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle/Resources/views</argument>
<argument>Framework</argument>
</call>
<call method="addPath">
<argument>C:\wamp\www\infographicsBundle\vendor\symfony\symfony\src\Symfony\Bundle\SecurityBundle/Resources/views</argument>
<argument>Security</argument>
</call>
<call method="addPath">
<argument>C:\wamp\www\infographicsBundle\vendor\symfony\symfony\src\Symfony\Bundle\TwigBundle/Resources/views</argument>
<argument>Twig</argument>
</call>
<call method="addPath">
<argument>C:\wamp\www\infographicsBundle\vendor\symfony\swiftmailer-bundle/Resources/views</argument>
<argument>Swiftmailer</argument>
</call>
<call method="addPath">
<argument>C:\wamp\www\infographicsBundle\vendor\doctrine\doctrine-bundle/Resources/views</argument>
<argument>Doctrine</argument>
</call>
<call method="addPath">
<argument>C:\wamp\www\infographicsBundle\vendor\symfony\symfony\src\Symfony\Bundle\DebugBundle/Resources/views</argument>
<argument>Debug</argument>
</call>
<call method="addPath">
<argument>C:\wamp\www\infographicsBundle\vendor\symfony\symfony\src\Symfony\Bundle\WebProfilerBundle/Resources/views</argument>
<argument>WebProfiler</argument>
</call>
<call method="addPath">
<argument>C:\wamp\www\infographicsBundle\vendor\sensio\distribution-bundle\Sensio\Bundle\DistributionBundle/Resources/views</argument>
<argument>SensioDistribution</argument>
</call>
<call method="addPath">
<argument>C:\wamp\www\infographicsBundle\app/Resources/views</argument>
</call>
<call method="addPath">
<argument>C:\wamp\www\infographicsBundle\vendor\symfony\symfony\src\Symfony\Bridge\Twig/Resources/views/Form</argument>
</call>
</service>
<service id="logger" class="Symfony\Bridge\Monolog\Logger">
<argument>app</argument>
<call method="pushHandler">
<argument type="service" id="monolog.handler.console"/>
</call>
<call method="pushHandler">
<argument type="service" id="monolog.handler.main"/>
</call>
<call method="pushHandler">
<argument type="service" id="monolog.handler.debug"/>
</call>
</service>
<service id="swiftmailer.mailer.default.transport" class="Swift_Transport_SpoolTransport">
<argument type="service" id="swiftmailer.mailer.default.transport.eventdispatcher"/>
<argument type="service" id="swiftmailer.mailer.default.spool"/>
<call method="registerPlugin">
<argument type="service" id="swiftmailer.mailer.default.plugin.messagelogger"/>
</call>
</service>
<service id="swiftmailer.mailer.default.spool" class="Swift_MemorySpool"/>
<service id="swiftmailer.mailer.default.transport.real" class="Swift_Transport_EsmtpTransport">
<argument type="service">
<service class="Swift_Transport_StreamBuffer" public="false">
<argument type="service">
<service class="Swift_StreamFilters_StringReplacementFilterFactory" public="false"/>
</argument>
</service>
</argument>
<argument type="collection">
<argument type="service">
<service class="Swift_Transport_Esmtp_AuthHandler" public="false">
<argument type="collection">
<argument type="service">
<service class="Swift_Transport_Esmtp_Auth_CramMd5Authenticator" public="false"/>
</argument>
<argument type="service">
<service class="Swift_Transport_Esmtp_Auth_LoginAuthenticator" public="false"/>
</argument>
<argument type="service">
<service class="Swift_Transport_Esmtp_Auth_PlainAuthenticator" public="false"/>
</argument>
</argument>
<call method="setUsername">
<argument>null</argument>
</call>
<call method="setPassword">
<argument>null</argument>
</call>
<call method="setAuthMode">
<argument>null</argument>
</call>
</service>
</argument>
</argument>
<argument type="service" id="swiftmailer.mailer.default.transport.eventdispatcher"/>
<call method="setHost">
<argument>127.0.0.1</argument>
</call>
<call method="setPort">
<argument>25</argument>
</call>
<call method="setEncryption">
<argument>null</argument>
</call>
<call method="setTimeout">
<argument>30</argument>
</call>
<call method="setSourceIp">
<argument>null</argument>
</call>
</service>
<service id="session.storage" alias="session.storage.native"/>
<service id="event_dispatcher" alias="debug.event_dispatcher"/>
<service id="debug.templating.engine.twig" alias="templating"/>
<service id="swiftmailer.spool" alias="swiftmailer.mailer.default.spool"/>
<service id="swiftmailer.transport.real" alias="swiftmailer.mailer.default.transport.real"/>
<service id="swiftmailer.plugin.messagelogger" alias="swiftmailer.mailer.default.plugin.messagelogger"/>
<service id="swiftmailer.mailer" alias="swiftmailer.mailer.default"/>
<service id="swiftmailer.transport" alias="swiftmailer.mailer.default.transport"/>
<service id="mailer" alias="swiftmailer.mailer.default"/>
<service id="database_connection" alias="doctrine.dbal.default_connection"/>
<service id="doctrine.orm.entity_manager" alias="doctrine.orm.default_entity_manager"/>
<service id="doctrine.orm.default_metadata_cache" alias="doctrine_cache.providers.doctrine.orm.default_metadata_cache"/>
<service id="doctrine.orm.default_result_cache" alias="doctrine_cache.providers.doctrine.orm.default_result_cache"/>
<service id="doctrine.orm.default_query_cache" alias="doctrine_cache.providers.doctrine.orm.default_query_cache"/>
<service id="sensio.distribution.webconfigurator" alias="sensio_distribution.webconfigurator"/>
<service id="console.command.sensiolabs_security_command_securitycheckercommand" alias="sensio_distribution.security_checker.command"/>
</services>
</container>
| {
"content_hash": "9adff49dfbf46ba3d94f25107e6e7f90",
"timestamp": "",
"source": "github",
"line_count": 3064,
"max_line_length": 228,
"avg_line_length": 59.909595300261095,
"alnum_prop": 0.7003045276008781,
"repo_name": "hichemius/Abbassi",
"id": "fa5b8b92537009a9d23458491c4a78a0981c2f9a",
"size": "183563",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "app/cache/dev/appDevDebugProjectContainer.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "3073"
},
{
"name": "CSS",
"bytes": "15716"
},
{
"name": "PHP",
"bytes": "49159"
}
],
"symlink_target": ""
} |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using System.Web;
using System.Web.Mvc;
namespace Microsoft.Azure.Blast.Web.Controllers
{
public class ConfigBasedMvcAuthorizeAttribute : AuthorizeAttribute
{
protected override bool AuthorizeCore(HttpContextBase httpContext)
{
if (ConfigBasedAuthorization.RequireAuthorization())
{
return base.AuthorizeCore(httpContext);
}
return true;
}
}
} | {
"content_hash": "d92790aab445cdc2c5f97b2e1a48181b",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 95,
"avg_line_length": 31.1,
"alnum_prop": 0.6543408360128617,
"repo_name": "djolent/WebApp",
"id": "ef205f506559329fa384afd805482129a79319db",
"size": "624",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "LifeSciences/AzureBlast/AzureBlast.Web/Controllers/ConfigBasedMvcAuthorizeAttribute.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "117"
},
{
"name": "Batchfile",
"bytes": "1111"
},
{
"name": "C#",
"bytes": "368441"
},
{
"name": "CSS",
"bytes": "21226"
},
{
"name": "JavaScript",
"bytes": "292456"
},
{
"name": "PowerShell",
"bytes": "3796"
},
{
"name": "Python",
"bytes": "14958"
},
{
"name": "Shell",
"bytes": "6364"
}
],
"symlink_target": ""
} |
<?php
/**
* Custom functions
*/
require_once locate_template('/lib/post-types.php'); // Custom Post Types
require_once locate_template('/lib/acf.php'); // Advanced Custom Fields Additions
function count_columns() {
$rows = get_field('column');
$row_count = count($rows);
echo $row_count;
} | {
"content_hash": "a16e99fc78b4c87157d2ea3485a8d5cb",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 91,
"avg_line_length": 22.142857142857142,
"alnum_prop": 0.6548387096774193,
"repo_name": "maintainweb/thelarman",
"id": "3ed545ce1177b6d392ecc0fbdd0eca4314840203",
"size": "310",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/custom.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "253030"
},
{
"name": "JavaScript",
"bytes": "6455"
},
{
"name": "PHP",
"bytes": "177472"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<alvisnlp-doc author="" beta="true" date=""
short-target="OpenNLPDocumentCategorizerTrain"
target="fr.inra.maiage.bibliome.alvisnlp.bibliomefactory.modules.opennlp.OpenNLPDocumentCategorizerTrain">
<synopsis>
<p>Train a document categorizer using the <a href="https://opennlp.apache.org/">OpenNLP</a> library.</p>
</synopsis>
<module-doc>
<description>
<p><this/> trains a document categorizer using the <a href="https://opennlp.apache.org/">OpenNLP</a> library.
The documents and their class are specified by <param>documents</param> and <param>categoryFeature</param>.
The classifier algorithm uses the document content specified by <param>tokens</param> and <param>form</param>.
</p>
<p>By default the features are BOW but can be deactivated with <param>bagOfWords</param>.
Additionally <param>nGrams</param> can be set to add n-gram features.
</p>
<p>The classifier is stored in <param>classifier</param>. This file can be used by <module>OpenNLPDocumentCategorizer</module>.
</p>
</description>
<param-doc default-value="PERCEPTRON"
mandatory="default: PERCEPTRON" name="algorithm"
short-type="OpenNLPAlgorithm"
type="fr.inra.maiage.bibliome.alvisnlp.bibliomefactory.modules.opennlp.OpenNLPAlgorithm">
<p>Categorization algorithm. Must be one of:
<ul>
<li><em>naive-bayes</em>, <em>nb</em></li>
<li><em>generalized-iterative-scaling</em>, <em>gis</em></li>
<li><em>perceptron</em></li>
<li><em>quasi-newton</em>, <em>qn</em>, <em>l-bfgs</em>, <em>lbfgs</em>, <em>bfgs</em></li>
</ul>
</p>
</param-doc>
<param-doc default-value="true" mandatory="default: true"
name="bagOfWords" short-type="Boolean" type="java.lang.Boolean">
<p>Either to generate single-word features.</p>
</param-doc>
<param-doc mandatory="required" name="categoryFeature"
name-type="feature" short-type="String" type="java.lang.String">
<p>Feature where the category is read.</p>
</param-doc>
<param-doc mandatory="optional" name="classWeights"
short-type="IntegerMapping"
type="fr.inra.maiage.bibliome.alvisnlp.core.module.types.IntegerMapping">
<p>Weight of samples of each class. This parameter is useful to compensate unbalanced training sets. The default weight is 1.</p>
</param-doc>
<param-doc default-value="100" mandatory="default: 100"
name="iterations" short-type="Integer" type="java.lang.Integer">
<p>Number of learning iterations.</p>
</param-doc>
<param-doc mandatory="required" name="language"
short-type="String" type="java.lang.String">
<p>Language of the documents (ISO 639-1 two-letter code).</p>
</param-doc>
<param-doc mandatory="required" name="model"
short-type="TargetStream"
type="fr.inra.maiage.bibliome.util.streams.TargetStream">
<p>File where to store the classifier.</p>
</param-doc>
<param-doc mandatory="optional" name="nGrams"
short-type="Integer" type="java.lang.Integer">
<p>Maximum size of n-gram features (minimum is 2). If not set, then do not use n-gram features.</p>
</param-doc>
<include-doc>fr.inra.maiage.bibliome.alvisnlp.bibliomefactory.modules.opennlp.OpenNLPDocumentCategorizerBaseDoc</include-doc>
</module-doc>
</alvisnlp-doc> | {
"content_hash": "049e2949973cf12530c0548fa83db20e",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 132,
"avg_line_length": 42.9078947368421,
"alnum_prop": 0.7114382091383011,
"repo_name": "Bibliome/alvisnlp",
"id": "ef7571cb2a2c892fba31294b8a008cc1a6bcec63",
"size": "3261",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "alvisnlp-bibliome/src/main/resources/fr/inra/maiage/bibliome/alvisnlp/bibliomefactory/modules/opennlp/OpenNLPDocumentCategorizerTrainDoc.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "1885"
},
{
"name": "CSS",
"bytes": "64310"
},
{
"name": "HTML",
"bytes": "15625"
},
{
"name": "Java",
"bytes": "2317082"
},
{
"name": "JavaScript",
"bytes": "764121"
},
{
"name": "PowerShell",
"bytes": "1881"
},
{
"name": "Python",
"bytes": "43221"
},
{
"name": "Shell",
"bytes": "18569"
},
{
"name": "XSLT",
"bytes": "73201"
}
],
"symlink_target": ""
} |
import * as React from "react";
import { mount } from "enzyme";
import { Sensors } from "../index";
import { bot } from "../../__test_support__/fake_state/bot";
import { SensorsProps } from "../interfaces";
import { fakeSensor } from "../../__test_support__/fake_state/resources";
import { clickButton } from "../../__test_support__/helpers";
import { SpecialStatus } from "farmbot";
import { error } from "../../toast/toast";
describe("<Sensors />", () => {
function fakeProps(): SensorsProps {
const fakeSensor1 = fakeSensor();
const fakeSensor2 = fakeSensor();
fakeSensor1.body.pin = 1;
fakeSensor2.body.pin = 2;
return {
bot,
sensors: [fakeSensor1, fakeSensor2],
dispatch: jest.fn(),
disabled: false,
firmwareHardware: undefined,
};
}
it("renders", () => {
const wrapper = mount(<Sensors {...fakeProps()} />);
["Sensors", "Edit", "Save", "Fake Pin", "1"].map(string =>
expect(wrapper.text()).toContain(string));
const saveButton = wrapper.find("button").at(1);
expect(saveButton.text()).toContain("Save");
expect(saveButton.props().hidden).toBeTruthy();
});
it("isEditing", () => {
const wrapper = mount<Sensors>(<Sensors {...fakeProps()} />);
expect(wrapper.instance().state.isEditing).toBeFalsy();
clickButton(wrapper, 0, "edit");
expect(wrapper.instance().state.isEditing).toBeTruthy();
});
it("save attempt: pin number too small", () => {
const p = fakeProps();
p.sensors[0].body.pin = 1;
p.sensors[1].body.pin = 1;
p.sensors[0].specialStatus = SpecialStatus.DIRTY;
const wrapper = mount(<Sensors {...p} />);
clickButton(wrapper, 1, "save", { partial_match: true });
expect(error).toHaveBeenLastCalledWith("Pin numbers must be unique.");
});
it("saves", () => {
const p = fakeProps();
p.sensors[0].body.pin = 1;
p.sensors[0].specialStatus = SpecialStatus.DIRTY;
const wrapper = mount(<Sensors {...p} />);
clickButton(wrapper, 1, "save", { partial_match: true });
expect(p.dispatch).toHaveBeenCalled();
});
it("adds empty sensor", () => {
const p = fakeProps();
const wrapper = mount(<Sensors {...p} />);
wrapper.setState({ isEditing: true });
clickButton(wrapper, 2, "");
expect(p.dispatch).toHaveBeenCalled();
});
it("adds stock sensors", () => {
const p = fakeProps();
const wrapper = mount(<Sensors {...p} />);
expect(wrapper.text().toLowerCase()).toContain("stock sensors");
wrapper.setState({ isEditing: true });
clickButton(wrapper, 3, "stock sensors");
expect(wrapper.find("button").at(3).props().hidden).toBeFalsy();
expect(p.dispatch).toHaveBeenCalledTimes(2);
});
it("doesn't display + stock button", () => {
const p = fakeProps();
p.firmwareHardware = "express_k10";
const wrapper = mount(<Sensors {...p} />);
const btn = wrapper.find("button").at(3);
expect(btn.text().toLowerCase()).toContain("stock");
expect(btn.props().hidden).toBeTruthy();
});
it("hides stock button", () => {
const p = fakeProps();
p.firmwareHardware = "none";
const wrapper = mount(<Sensors {...p} />);
wrapper.setState({ isEditing: true });
const btn = wrapper.find("button").at(3);
expect(btn.text().toLowerCase()).toContain("stock");
expect(btn.props().hidden).toBeTruthy();
});
it("renders empty state", () => {
const p = fakeProps();
p.sensors = [];
const wrapper = mount(<Sensors {...p} />);
expect(wrapper.text().toLowerCase()).toContain("no sensors yet");
});
it("doesn't render empty state", () => {
const p = fakeProps();
p.sensors = [];
const wrapper = mount(<Sensors {...p} />);
wrapper.setState({ isEditing: true });
expect(wrapper.text().toLowerCase()).not.toContain("no sensors yet");
});
});
| {
"content_hash": "0e73313289dc37fdd3fdc6aecfa552d1",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 74,
"avg_line_length": 34.294642857142854,
"alnum_prop": 0.6071335589690184,
"repo_name": "FarmBot/farmbot-web-app",
"id": "097d139164909160177679e008e0d6ad27d16ce1",
"size": "3841",
"binary": false,
"copies": "3",
"ref": "refs/heads/main",
"path": "frontend/sensors/__tests__/index_test.tsx",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2836"
},
{
"name": "HTML",
"bytes": "13533"
},
{
"name": "JavaScript",
"bytes": "280"
},
{
"name": "Ruby",
"bytes": "91842"
}
],
"symlink_target": ""
} |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.eas.client.dataflow;
import com.eas.client.metadata.Fields;
import com.eas.client.metadata.Parameter;
import com.eas.client.metadata.Parameters;
import com.eas.concurrent.CallableConsumer;
import com.eas.script.Scripts;
import com.eas.util.BinaryUtils;
import com.eas.util.RowsetJsonConstants;
import com.eas.util.StringUtils;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.*;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.TimeZone;
import java.util.concurrent.Callable;
import java.util.function.Consumer;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.sql.DataSource;
/**
* This flow dataSource intended to support the flow process from and to jdbc
* data sources.
*
* @author mg
* @param <JKT> Jdbc source key type. It may be long number or string
* identifier.
* @see FlowProvider
*/
public abstract class JdbcFlowProvider<JKT> extends DatabaseFlowProvider<JKT> {
protected static final Logger queriesLogger = Logger.getLogger(JdbcFlowProvider.class.getName());
protected DataSource dataSource;
protected Fields expectedFields;
protected Consumer<Runnable> asyncDataPuller;
protected boolean procedure;
protected ResultSet lowLevelResults;
protected Connection lowLevelConnection;
protected PreparedStatement lowLevelStatement;
/**
* A flow dataSource, intended to support jdbc data sources.
*
* @param aJdbcSourceTag Jdbc source key value. It may be long number or
* string identifier.
* @param aDataSource A DataSource instance, that would supply resources for
* use them by flow dataSource in single operations, like retriving data of
* applying data changes.
* @param aAsyncDataPuller
* @param aClause A sql clause, dataSource should use to achieve
* PreparedStatement instance to use it in the result set querying process.
* @param aExpectedFields
* @see DataSource
*/
public JdbcFlowProvider(JKT aJdbcSourceTag, DataSource aDataSource, Consumer<Runnable> aAsyncDataPuller, String aClause, Fields aExpectedFields) {
super(aJdbcSourceTag, aClause);
dataSource = aDataSource;
asyncDataPuller = aAsyncDataPuller;
expectedFields = aExpectedFields;
assert dataSource != null : "Flow provider can't exist without a data source";
assert clause != null : "Flow provider can't exist without a selecting sql clause";
}
@Override
public boolean isProcedure() {
return procedure;
}
@Override
public void setProcedure(boolean aValue) {
procedure = aValue;
}
/**
* @inheritDoc
*/
@Override
public Collection<Map<String, Object>> nextPage(Consumer<Collection<Map<String, Object>>> onSuccess, Consumer<Exception> onFailure) throws Exception {
if (!isPaged() || lowLevelResults == null) {
throw new FlowProviderNotPagedException(BAD_NEXTPAGE_REFRESH_CHAIN_MSG);
} else {
JdbcReader reader = obtainJdbcReader();
Callable<Collection<Map<String, Object>>> doWork = () -> {
try {
return reader.readRowset(lowLevelResults, pageSize);
} catch (SQLException ex) {
throw new FlowProviderFailedException(ex);
} finally {
if (lowLevelResults.isClosed() || lowLevelResults.isAfterLast()) {
endPaging();
}
}
};
if (onSuccess != null) {
asyncDataPuller.accept(() -> {
try {
Collection<Map<String, Object>> rs = doWork.call();
try {
onSuccess.accept(rs);
} catch (Exception ex) {
Logger.getLogger(JdbcFlowProvider.class.getName()).log(Level.SEVERE, null, ex);
}
} catch (Exception ex) {
if (onFailure != null) {
onFailure.accept(ex);
}
}
});
return null;
} else {
return doWork.call();
}
}
}
protected abstract JdbcReader obtainJdbcReader();
private void endPaging() throws Exception {
assert isPaged();
close();
}
@Override
public void close() throws Exception {
if (lowLevelResults != null) {
lowLevelResults.close();
// See refresh method, hacky statement closing.
if (lowLevelStatement != null) {
lowLevelStatement.close();
}
// See refresh method, hacky connection closing.
if (lowLevelConnection != null) {
lowLevelConnection.close();
}
lowLevelResults = null;
lowLevelStatement = null;
lowLevelConnection = null;
}
}
public static int assumeJdbcType(Object aValue) {
int jdbcType;
if (aValue instanceof CharSequence) {
jdbcType = Types.VARCHAR;
} else if (aValue instanceof Number) {
jdbcType = Types.DOUBLE;
} else if (aValue instanceof java.util.Date) {
jdbcType = Types.TIMESTAMP;
} else if (aValue instanceof Boolean) {
jdbcType = Types.BOOLEAN;
} else {
jdbcType = Types.VARCHAR;
}
return jdbcType;
}
// Ms sql non jdbc string types
public static final int NON_JDBC_LONG_STRING = 258;
public static final int NON_JDBC_MEDIUM_STRING = 259;
public static final int NON_JDBC_MEMO_STRING = 260;
public static final int NON_JDBC_SHORT_STRING = 261;
private static BigDecimal number2BigDecimal(Number aNumber) {
if (aNumber instanceof Float || aNumber instanceof Double) {
return new BigDecimal(aNumber.doubleValue());
} else if (aNumber instanceof BigInteger) {
return new BigDecimal((BigInteger) aNumber);
} else if (aNumber instanceof BigDecimal) {
return (BigDecimal) aNumber;
} else {
return new BigDecimal(aNumber.longValue());
}
}
public static Object get(Wrapper aRs, int aColumnIndex) throws SQLException {
try {
int sqlType = aRs instanceof ResultSet ? ((ResultSet) aRs).getMetaData().getColumnType(aColumnIndex) : ((CallableStatement) aRs).getParameterMetaData().getParameterType(aColumnIndex);
Object value = null;
switch (sqlType) {
case Types.JAVA_OBJECT:
case Types.DATALINK:
case Types.DISTINCT:
case Types.NULL:
case Types.ROWID:
case Types.REF:
case Types.SQLXML:
case Types.ARRAY:
case Types.STRUCT:
case Types.OTHER:
value = aRs instanceof ResultSet ? ((ResultSet) aRs).getString(aColumnIndex) : ((CallableStatement) aRs).getString(aColumnIndex);
break;
case Types.BINARY:
case Types.VARBINARY:
case Types.LONGVARBINARY:
value = aRs instanceof ResultSet ? ((ResultSet) aRs).getBytes(aColumnIndex) : ((CallableStatement) aRs).getBytes(aColumnIndex);
break;
case Types.BLOB:
value = aRs instanceof ResultSet ? ((ResultSet) aRs).getBlob(aColumnIndex) : ((CallableStatement) aRs).getBlob(aColumnIndex);
if (value != null) {
try (InputStream is = ((Blob) value).getBinaryStream()) {
value = BinaryUtils.readStream(is, -1);
}
}
break;
// clobs
case Types.CLOB:
value = aRs instanceof ResultSet ? ((ResultSet) aRs).getClob(aColumnIndex) : ((CallableStatement) aRs).getClob(aColumnIndex);
if (value != null) {
try (Reader reader = ((Clob) value).getCharacterStream()) {
value = StringUtils.readReader(reader, -1);
}
}
break;
case Types.NCLOB:
value = aRs instanceof ResultSet ? ((ResultSet) aRs).getNClob(aColumnIndex) : ((CallableStatement) aRs).getNClob(aColumnIndex);
if (value != null) {
try (Reader reader = ((NClob) value).getCharacterStream()) {
value = StringUtils.readReader(reader, -1);
}
}
break;
// numbers
case Types.DECIMAL:
case Types.NUMERIC:
// target type - BigDecimal
value = aRs instanceof ResultSet ? ((ResultSet) aRs).getBigDecimal(aColumnIndex) : ((CallableStatement) aRs).getBigDecimal(aColumnIndex);
break;
case Types.BIGINT:
// target type - BigInteger
value = aRs instanceof ResultSet ? ((ResultSet) aRs).getBigDecimal(aColumnIndex) : ((CallableStatement) aRs).getBigDecimal(aColumnIndex);
if (value != null) {
value = ((BigDecimal) value).toBigInteger();
}
break;
case Types.SMALLINT:
// target type - Short
value = aRs instanceof ResultSet ? ((ResultSet) aRs).getShort(aColumnIndex) : ((CallableStatement) aRs).getShort(aColumnIndex);
break;
case Types.TINYINT:
case Types.INTEGER:
// target type - Int
value = aRs instanceof ResultSet ? ((ResultSet) aRs).getInt(aColumnIndex) : ((CallableStatement) aRs).getInt(aColumnIndex);
break;
case Types.REAL:
case Types.FLOAT:
// target type - Float
value = aRs instanceof ResultSet ? ((ResultSet) aRs).getFloat(aColumnIndex) : ((CallableStatement) aRs).getFloat(aColumnIndex);
break;
case Types.DOUBLE:
// target type - Double
value = aRs instanceof ResultSet ? ((ResultSet) aRs).getDouble(aColumnIndex) : ((CallableStatement) aRs).getDouble(aColumnIndex);
break;
// strings
case Types.CHAR:
case Types.NCHAR:
case Types.VARCHAR:
case Types.NVARCHAR:
case Types.LONGVARCHAR:
case Types.LONGNVARCHAR:
case NON_JDBC_LONG_STRING:
case NON_JDBC_MEDIUM_STRING:
case NON_JDBC_MEMO_STRING:
case NON_JDBC_SHORT_STRING:
// target type - string
value = aRs instanceof ResultSet ? ((ResultSet) aRs).getString(aColumnIndex) : ((CallableStatement) aRs).getString(aColumnIndex);
break;
// booleans
case Types.BOOLEAN:
case Types.BIT:
// target type - Boolean
value = aRs instanceof ResultSet ? ((ResultSet) aRs).getBoolean(aColumnIndex) : ((CallableStatement) aRs).getBoolean(aColumnIndex);
break;
// dates, times
case Types.DATE:
value = aRs instanceof ResultSet ? ((ResultSet) aRs).getDate(aColumnIndex) : ((CallableStatement) aRs).getDate(aColumnIndex);
break;
case Types.TIMESTAMP:
value = aRs instanceof ResultSet ? ((ResultSet) aRs).getTimestamp(aColumnIndex) : ((CallableStatement) aRs).getTimestamp(aColumnIndex);
break;
case Types.TIME:
value = aRs instanceof ResultSet ? ((ResultSet) aRs).getTime(aColumnIndex) : ((CallableStatement) aRs).getTime(aColumnIndex);
break;
}
if (aRs instanceof ResultSet ? ((ResultSet) aRs).wasNull() : ((CallableStatement) aRs).wasNull()) {
value = null;
}
return value;
} catch (SQLException ex) {
throw ex;
} catch (IOException ex) {
throw new SQLException(ex);
}
}
public static int assign(Object aValue, int aParameterIndex, PreparedStatement aStmt, int aParameterJdbcType, String aParameterSqlTypeName) throws SQLException {
if (aValue != null) {
/*
if (aValue instanceof JSObject) {
aValue = aSpace.toJava(aValue);
}
*/
switch (aParameterJdbcType) {
// Some strange types. No one knows how to work with them.
case Types.JAVA_OBJECT:
case Types.DATALINK:
case Types.DISTINCT:
case Types.NULL:
case Types.ROWID:
case Types.REF:
case Types.SQLXML:
case Types.ARRAY:
case Types.OTHER:
try {
aStmt.setObject(aParameterIndex, aValue, aParameterJdbcType);
} catch (Exception ex) {
aStmt.setNull(aParameterIndex, aParameterJdbcType, aParameterSqlTypeName);
Logger.getLogger(JdbcFlowProvider.class.getName()).log(Level.WARNING, FALLED_TO_NULL_MSG, aValue.getClass().getName());
}
break;
case Types.STRUCT:
try {
aStmt.setObject(aParameterIndex, aValue, Types.STRUCT);
} catch (Exception ex) {
aStmt.setNull(aParameterIndex, aParameterJdbcType, aParameterSqlTypeName);
Logger.getLogger(JdbcFlowProvider.class.getName()).log(Level.WARNING, FALLED_TO_NULL_MSG, aValue.getClass().getName());
}
break;
case Types.BINARY:
case Types.VARBINARY:
case Types.LONGVARBINARY:
// target type - byte[]
if (aValue instanceof byte[]) {
aStmt.setBytes(aParameterIndex, (byte[]) aValue);
} else {
Logger.getLogger(JdbcFlowProvider.class.getName()).log(Level.WARNING, FALLED_TO_NULL_MSG, aValue.getClass().getName());
}
break;
case Types.BLOB:
// target type - java.sql.Blob
if (aValue instanceof Blob) {
aStmt.setBlob(aParameterIndex, (Blob) aValue);
} else {
Logger.getLogger(JdbcFlowProvider.class.getName()).log(Level.WARNING, FALLED_TO_NULL_MSG, aValue.getClass().getName());
}
break;
case Types.CLOB:
// target type - java.sql.Clob
if (aValue instanceof Clob) {
aStmt.setClob(aParameterIndex, (Clob) aValue);
} else {
Logger.getLogger(JdbcFlowProvider.class.getName()).log(Level.WARNING, FALLED_TO_NULL_MSG, aValue.getClass().getName());
}
break;
case Types.NCLOB:
// target type - java.sql.NClob
if (aValue instanceof NClob) {
aStmt.setNClob(aParameterIndex, (NClob) aValue);
} else {
Logger.getLogger(JdbcFlowProvider.class.getName()).log(Level.WARNING, FALLED_TO_NULL_MSG, aValue.getClass().getName());
}
break;
case Types.DECIMAL:
case Types.NUMERIC:
// target type - BigDecimal
// target type - BigDecimal
BigDecimal castedDecimal = null;
if (aValue instanceof Number) {
castedDecimal = number2BigDecimal((Number) aValue);
} else if (aValue instanceof String) {
castedDecimal = new BigDecimal((String) aValue);
} else if (aValue instanceof Boolean) {
castedDecimal = new BigDecimal(((Boolean) aValue) ? 1 : 0);
} else if (aValue instanceof java.util.Date) {
castedDecimal = new BigDecimal(((java.util.Date) aValue).getTime());
}
if (castedDecimal != null) {
aStmt.setBigDecimal(aParameterIndex, castedDecimal);
} else {
Logger.getLogger(JdbcFlowProvider.class.getName()).log(Level.WARNING, FALLED_TO_NULL_MSG, aValue.getClass().getName());
}
break;
case Types.BIGINT:
// target type - BigInteger
BigInteger castedInteger = null;
if (aValue instanceof Number) {
castedInteger = BigInteger.valueOf(((Number) aValue).longValue());
} else if (aValue instanceof String) {
castedInteger = new BigInteger((String) aValue);
} else if (aValue instanceof Boolean) {
castedInteger = BigInteger.valueOf(((Boolean) aValue) ? 1 : 0);
} else if (aValue instanceof java.util.Date) {
castedInteger = BigInteger.valueOf(((java.util.Date) aValue).getTime());
}
if (castedInteger != null) {
aStmt.setBigDecimal(aParameterIndex, new BigDecimal(castedInteger));
} else {
Logger.getLogger(JdbcFlowProvider.class.getName()).log(Level.WARNING, FALLED_TO_NULL_MSG, aValue.getClass().getName());
}
break;
case Types.SMALLINT:
// target type - Short
// target type - Short
Short castedShort = null;
if (aValue instanceof Number) {
castedShort = ((Number) aValue).shortValue();
} else if (aValue instanceof String) {
castedShort = Double.valueOf((String) aValue).shortValue();
} else if (aValue instanceof Boolean) {
castedShort = Integer.valueOf(((Boolean) aValue) ? 1 : 0).shortValue();
} else if (aValue instanceof java.util.Date) {
castedShort = Integer.valueOf((int) ((java.util.Date) aValue).getTime()).shortValue();
}
if (castedShort != null) {
aStmt.setShort(aParameterIndex, castedShort);
} else {
Logger.getLogger(JdbcFlowProvider.class.getName()).log(Level.WARNING, FALLED_TO_NULL_MSG, aValue.getClass().getName());
}
break;
case Types.TINYINT:
case Types.INTEGER:
// target type - Integer
Integer castedInt = null;
if (aValue instanceof Number) {
castedInt = ((Number) aValue).intValue();
} else if (aValue instanceof String) {
castedInt = Double.valueOf((String) aValue).intValue();
} else if (aValue instanceof Boolean) {
castedInt = (Boolean) aValue ? 1 : 0;
} else if (aValue instanceof java.util.Date) {
castedInt = (int) ((java.util.Date) aValue).getTime();
}
if (castedInt != null) {
aStmt.setInt(aParameterIndex, castedInt);
} else {
Logger.getLogger(JdbcFlowProvider.class.getName()).log(Level.WARNING, FALLED_TO_NULL_MSG, aValue.getClass().getName());
}
break;
case Types.REAL:
case Types.FLOAT:
// target type - Float
Float castedFloat = null;
if (aValue instanceof Number) {
castedFloat = ((Number) aValue).floatValue();
} else if (aValue instanceof String) {
castedFloat = Float.valueOf((String) aValue);
} else if (aValue instanceof Boolean) {
castedFloat = Float.valueOf(((Boolean) aValue) ? 1 : 0);
} else if (aValue instanceof java.util.Date) {
castedFloat = (float) ((java.util.Date) aValue).getTime();
}
if (castedFloat != null) {
aStmt.setFloat(aParameterIndex, castedFloat);
} else {
Logger.getLogger(JdbcFlowProvider.class.getName()).log(Level.WARNING, FALLED_TO_NULL_MSG, aValue.getClass().getName());
}
break;
case Types.DOUBLE:
// target type - Double
Double castedDouble = null;
if (aValue instanceof Number) {
castedDouble = ((Number) aValue).doubleValue();
} else if (aValue instanceof String) {
castedDouble = Double.valueOf((String) aValue);
} else if (aValue instanceof Boolean) {
castedDouble = Double.valueOf(((Boolean) aValue) ? 1 : 0);
} else if (aValue instanceof java.util.Date) {
castedDouble = (double) ((java.util.Date) aValue).getTime();
}
if (castedDouble != null) {
aStmt.setDouble(aParameterIndex, castedDouble);
} else {
Logger.getLogger(JdbcFlowProvider.class.getName()).log(Level.WARNING, FALLED_TO_NULL_MSG, aValue.getClass().getName());
}
break;
case Types.CHAR:
case Types.VARCHAR:
case Types.LONGVARCHAR:
case Types.NCHAR:
case Types.NVARCHAR:
case Types.LONGNVARCHAR:
// target type - string
// target type - string
String castedString = null;
if (aValue instanceof Number) {
castedString = ((Number) aValue).toString();
} else if (aValue instanceof String) {
castedString = (String) aValue;
} else if (aValue instanceof Boolean) {
castedString = ((Boolean) aValue) ? ((Boolean) aValue).toString() : "";
} else if (aValue instanceof java.util.Date) {
castedString = String.valueOf(((java.util.Date) aValue).getTime());
} else if (aValue instanceof Clob) {
castedString = ((Clob) aValue).getSubString(1, (int) ((Clob) aValue).length());
}
if (castedString != null) {
if (aParameterJdbcType == Types.NCHAR || aParameterJdbcType == Types.NVARCHAR || aParameterJdbcType == Types.LONGNVARCHAR) {
aStmt.setNString(aParameterIndex, castedString);
} else {
aStmt.setString(aParameterIndex, castedString);
}
} else {
Logger.getLogger(JdbcFlowProvider.class.getName()).log(Level.WARNING, FALLED_TO_NULL_MSG, aValue.getClass().getName());
}
break;
case Types.BIT:
case Types.BOOLEAN:
// target type - Boolean
Boolean castedBoolean = null;
if (aValue instanceof Number) {
castedBoolean = !(((Number) aValue).intValue() == 0);
} else if (aValue instanceof String || aValue instanceof Clob) {
String s;
if (aValue instanceof String) {
s = (String) aValue;
} else {
s = ((Clob) aValue).getSubString(1, (int) ((Clob) aValue).length());
}
castedBoolean = !s.isEmpty();
} else if (aValue instanceof Boolean) {
castedBoolean = (Boolean) aValue;
} else if (aValue instanceof java.util.Date) {
castedBoolean = !((java.util.Date) aValue).equals(new java.util.Date(0));
}
if (castedBoolean != null) {
aStmt.setBoolean(aParameterIndex, castedBoolean);
} else {
Logger.getLogger(JdbcFlowProvider.class.getName()).log(Level.WARNING, FALLED_TO_NULL_MSG, aValue.getClass().getName());
}
break;
case Types.DATE:
case Types.TIMESTAMP:
case Types.TIME:
// target type - date
java.util.Date castedDate = null;
if (aValue instanceof Number) {
castedDate = new java.util.Date(((Number) aValue).longValue());
} else if (aValue instanceof String) {
castedDate = new java.util.Date(Long.valueOf((String) aValue));
} else if (aValue instanceof Boolean) {
castedDate = new java.util.Date(((Boolean) aValue) ? 1 : 0);
} else if (aValue instanceof java.util.Date) {
castedDate = (java.util.Date) aValue;
}
if (castedDate != null) {
if (aParameterJdbcType == Types.DATE) {
aStmt.setDate(aParameterIndex, new java.sql.Date(castedDate.getTime()));//, Calendar.getInstance(TimeZone.getTimeZone("UTC")));
} else if (aParameterJdbcType == Types.TIMESTAMP) {
aStmt.setTimestamp(aParameterIndex, new java.sql.Timestamp(castedDate.getTime()));//, Calendar.getInstance(TimeZone.getTimeZone("UTC")));
} else if (aParameterJdbcType == Types.TIME) {
aStmt.setTime(aParameterIndex, new java.sql.Time(castedDate.getTime()));//, Calendar.getInstance(TimeZone.getTimeZone("UTC")));
} else {
assert false;
}
} else {
Logger.getLogger(JdbcFlowProvider.class.getName()).log(Level.WARNING, FALLED_TO_NULL_MSG, aValue.getClass().getName());
}
break;
}
} else {
try {
if (aParameterJdbcType == Types.TIME
|| aParameterJdbcType == Types.TIME_WITH_TIMEZONE
|| aParameterJdbcType == Types.TIMESTAMP
|| aParameterJdbcType == Types.TIMESTAMP_WITH_TIMEZONE) {// Crazy jdbc drivers of some databases (PostgreSQL for example) ignore such types, while setting nulls
aParameterJdbcType = Types.DATE;
aParameterSqlTypeName = null;
}
if (aParameterSqlTypeName != null && !aParameterSqlTypeName.isEmpty()) {
aStmt.setNull(aParameterIndex, aParameterJdbcType, aParameterSqlTypeName);
} else {
aStmt.setNull(aParameterIndex, aParameterJdbcType);
}
} catch (SQLException ex) {
aStmt.setNull(aParameterIndex, aParameterJdbcType, aParameterSqlTypeName);
}
}
return aParameterJdbcType;
}
protected static final String FALLED_TO_NULL_MSG = "Some value falled to null while tranferring to a database. May be it''s class is unsupported: {0}";
/**
* @inheritDoc
*/
@Override
public Collection<Map<String, Object>> refresh(Parameters aParams, Consumer<Collection<Map<String, Object>>> onSuccess, Consumer<Exception> onFailure) throws Exception {
return select(aParams, (ResultSet rs) -> {
if (rs != null) {
JdbcReader reader = obtainJdbcReader();
return reader.readRowset(rs, pageSize);
} else {
return new ArrayList<>();
}
}, onSuccess, onFailure);
}
public <T> T select(Parameters aParams, CallableConsumer<T, ResultSet> aResultSetProcessor, Consumer<T> onSuccess, Consumer<Exception> onFailure) throws Exception {
if (lowLevelResults != null) {
assert isPaged();
// Let's abort paging process
endPaging();
}
Callable<T> doWork = () -> {
String sqlClause = clause;
Connection connection = dataSource.getConnection();
if (connection != null) {
try {
PreparedStatement stmt = getFlowStatement(connection, sqlClause);
if (stmt != null) {
try {
prepareConnection(connection);
try {
Map<Integer, Integer> assignedJdbcTypes = new HashMap<>();
for (int i = 1; i <= aParams.getParametersCount(); i++) {
Parameter param = aParams.get(i);
int assignedJdbcType = assignParameter(param, stmt, i, connection);
assignedJdbcTypes.put(i, assignedJdbcType);
}
logQuery(sqlClause, aParams, assignedJdbcTypes);
ResultSet rs = null;
if (procedure) {
assert stmt instanceof CallableStatement;
CallableStatement cStmt = (CallableStatement) stmt;
cStmt.execute();
// let's return parameters
for (int i = 1; i <= aParams.getParametersCount(); i++) {
Parameter param = aParams.get(i);
acceptOutParameter(param, cStmt, i, connection);
}
// let's return a ResultSet
rs = cStmt.getResultSet();
} else {
rs = stmt.executeQuery();
}
if (rs != null) {
try {
return aResultSetProcessor.call(rs);
} finally {
if (isPaged()) {
lowLevelResults = rs;
} else {
rs.close();
}
}
} else {
return aResultSetProcessor.call(null);
}
} catch (SQLException ex) {
throw new FlowProviderFailedException(ex);
} finally {
assert dataSource != null; // since we've got a statement, dataSource must present.
unprepareConnection(connection);
}
} finally {
if (isPaged()) {
// Paged statements can't be closed, because of ResultSet existance.
lowLevelStatement = stmt;
} else {
stmt.close();
}
}
} else {
return null;
}
} finally {
if (isPaged()) {
// Paged connections can't be closed, because of ResultSet existance.
lowLevelConnection = connection;
} else {
connection.close();
}
}
} else {
return null;
}
};
if (onSuccess != null) {
asyncDataPuller.accept(() -> {
try {
T processed = doWork.call();
try {
onSuccess.accept(processed);
} catch (Exception ex) {
Logger.getLogger(JdbcFlowProvider.class.getName()).log(Level.SEVERE, null, ex);
}
} catch (Exception ex) {
if (onFailure != null) {
onFailure.accept(ex);
}
}
});
return null;
} else {
return doWork.call();
}
}
protected static void logQuery(String sqlClause, Parameters aParams, Map<Integer, Integer> aAssignedJdbcTypes) {
if (queriesLogger.isLoggable(Level.FINE)) {
boolean finerLogs = queriesLogger.isLoggable(Level.FINER);
queriesLogger.log(Level.FINE, "Executing sql:\n{0}\nwith {1} parameters{2}", new Object[]{sqlClause, aParams.getParametersCount(), finerLogs && aParams.getParametersCount() > 0 ? ":" : ""});
if (finerLogs) {
for (int i = 1; i <= aParams.getParametersCount(); i++) {
Parameter param = aParams.get(i);
Object paramValue = param.getValue();
if (paramValue != null && Scripts.DATE_TYPE_NAME.equals(param.getType())) {
java.util.Date dateValue = (java.util.Date) paramValue;
SimpleDateFormat sdf = new SimpleDateFormat(RowsetJsonConstants.DATE_FORMAT);
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
String jsonLikeText = sdf.format(dateValue);
queriesLogger.log(Level.FINER, "order: {0}; name: {1}; jdbc type: {2}; json like timestamp: {3}; raw timestamp: {4};", new Object[]{i, param.getName(), aAssignedJdbcTypes.get(i), jsonLikeText, dateValue.getTime()});
} else {// nulls, String, Number, Boolean
queriesLogger.log(Level.FINER, "order: {0}; name: {1}; jdbc type: {2}; value: {3};", new Object[]{i, param.getName(), aAssignedJdbcTypes.get(i), param.getValue()});
}
}
}
}
}
protected void acceptOutParameter(Parameter aParameter, CallableStatement aStatement, int aParameterIndex, Connection aConnection) throws SQLException {
if (aParameter.getMode() == ParameterMetaData.parameterModeOut
|| aParameter.getMode() == ParameterMetaData.parameterModeInOut) {
try {
Object outedParamValue = get(aStatement, aParameterIndex);
aParameter.setValue(outedParamValue);
} catch (SQLException ex) {
String pType = aParameter.getType();
if (pType != null) {
switch (pType) {
case Scripts.STRING_TYPE_NAME:
aParameter.setValue(aStatement.getString(aParameterIndex));
break;
case Scripts.NUMBER_TYPE_NAME:
aParameter.setValue(aStatement.getDouble(aParameterIndex));
break;
case Scripts.DATE_TYPE_NAME:
aParameter.setValue(aStatement.getDate(aParameterIndex));
break;
case Scripts.BOOLEAN_TYPE_NAME:
aParameter.setValue(aStatement.getBoolean(aParameterIndex));
break;
default:
aParameter.setValue(aStatement.getObject(aParameterIndex));
}
} else {
aParameter.setValue(aStatement.getObject(aParameterIndex));
}
}
}
}
protected int assignParameter(Parameter aParameter, PreparedStatement aStatement, int aParameterIndex, Connection aConnection) throws SQLException {
Object paramValue = aParameter.getValue();
int jdbcType;
String sqlTypeName;
/*
// Crazy DBMS-es in most cases can't answer the question about parameter's type properly!
// PostgreSQL, for example starts answer the question after some time (about 4-8 hours).
// But before it raises SQLException. And after that, starts to report TIMESTAMP parameters
// as DATE parameters.
// This leads to parameters values shifting while statement.setDate() and errorneous select results!
try {
jdbcType = aStatement.getParameterMetaData().getParameterType(aParameterIndex);
sqlTypeName = aStatement.getParameterMetaData().getParameterTypeName(aParameterIndex);
} catch (SQLException ex) {
*/
if (paramValue != null || aParameter.getType() == null) {
jdbcType = assumeJdbcType(paramValue);
//sqlTypeName = null;
} else {
//sqlTypeName = null;
jdbcType = calcJdbcType(aParameter.getType(), paramValue);
}
/*
}
*/
int assignedJdbcType = assign(paramValue, aParameterIndex, aStatement, jdbcType, null);//sqlTypeName);
checkOutParameter(aParameter, aStatement, aParameterIndex, jdbcType);
return assignedJdbcType;
}
public static int calcJdbcType(String aType, Object aParamValue) {
int jdbcType;
switch (aType) {
case Scripts.STRING_TYPE_NAME:
jdbcType = java.sql.Types.VARCHAR;
break;
case Scripts.NUMBER_TYPE_NAME:
jdbcType = java.sql.Types.DOUBLE;
break;
case Scripts.DATE_TYPE_NAME:
jdbcType = java.sql.Types.TIMESTAMP;
break;
case Scripts.BOOLEAN_TYPE_NAME:
jdbcType = java.sql.Types.BOOLEAN;
break;
default:
jdbcType = assumeJdbcType(aParamValue);
}
return jdbcType;
}
protected void checkOutParameter(Parameter param, PreparedStatement stmt, int aParameterIndex, int jdbcType) throws SQLException {
if (procedure && (param.getMode() == ParameterMetaData.parameterModeOut
|| param.getMode() == ParameterMetaData.parameterModeInOut)) {
assert stmt instanceof CallableStatement;
CallableStatement cStmt = (CallableStatement) stmt;
cStmt.registerOutParameter(aParameterIndex, jdbcType);
}
}
protected abstract void prepareConnection(Connection aConnection) throws Exception;
protected abstract void unprepareConnection(Connection aConnection) throws Exception;
/**
* Returns PreparedStatement instance. Let's consider some caching system.
* It will provide some prepared statement instance, according to passed sql
* clause.
*
* @param aConnection java.sql.Connection instance to be used.
* @param aClause Sql clause to process.
* @return StatementResourceDescriptor instance, provided according to sql
* clause.
* @throws com.eas.client.dataflow.FlowProviderFailedException
*/
protected PreparedStatement getFlowStatement(Connection aConnection, String aClause) throws FlowProviderFailedException {
try {
assert aConnection != null;
if (procedure) {
return aConnection.prepareCall(aClause);
} else {
return aConnection.prepareStatement(aClause);
}
} catch (Exception ex) {
throw new FlowProviderFailedException(ex);
}
}
}
| {
"content_hash": "0f4de289adb46d2961d72833d19cf745",
"timestamp": "",
"source": "github",
"line_count": 853,
"max_line_length": 239,
"avg_line_length": 48.76787807737397,
"alnum_prop": 0.5110699776436933,
"repo_name": "jskonst/PlatypusJS",
"id": "8bddeb05a73700bc6d6d1c5b6dae31dff5310e38",
"size": "41599",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "application/src/components/Core/src/com/eas/client/dataflow/JdbcFlowProvider.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "965"
},
{
"name": "CSS",
"bytes": "2603"
},
{
"name": "Groff",
"bytes": "5269"
},
{
"name": "HTML",
"bytes": "29686"
},
{
"name": "IDL",
"bytes": "14970"
},
{
"name": "Java",
"bytes": "9936140"
},
{
"name": "JavaScript",
"bytes": "1133220"
},
{
"name": "Pascal",
"bytes": "5888"
},
{
"name": "Pure Data",
"bytes": "125"
},
{
"name": "Shell",
"bytes": "2204"
}
],
"symlink_target": ""
} |
/**
* Example for uploading a file using the Slack Web API
*/
const { WebClient } = require('@slack/client');
const path = require('path');
const fs = require('fs');
// Get an API token by creating an app at <https://api.slack.com/apps?new_app=1>
// It's always a good idea to keep sensitive data like the token outside your source code. Prefer environment variables.
const token = process.env.SLACK_API_TOKEN || '';
if (!token) { console.log('You must specify a token to use this example'); process.exitCode = 1; return; }
// Initialize a Web API client
const web = new WebClient(token);
// Path to example file
const filePath = path.resolve('..', 'test', 'fixtures', 'train.jpg');
// Using a Stream as the source for the upload
// Your token should have `files:write:user` scope
const fileStream = fs.createReadStream(filePath);
(async () => {
try {
const response = await web.files.upload({ file: fileStream });
console.log(`File uploaded as Stream. File ID: ${response.file.id}`);
} catch (error) {
console.log('File upload as Stream error:');
console.log(error);
}
})();
// Using a Buffer as the source for the upload
// Your token should have `files:write:user` scope
const fileBuffer = fs.readFileSync(filePath);
(async () => {
try {
// When using a Buffer, its best to supply a filename, since the SDK will not know the filename on disk
const response = await web.files.upload({ file: fileBuffer, filename: 'train.jpg' });
console.log(`File uploaded as Buffer. File ID: ${response.file.id}`);
} catch (error) {
console.log('File upload as Buffer error:');
console.log(error);
}
})();
| {
"content_hash": "90c2b47bac67e85a5d1ff5e4c9c9b922",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 120,
"avg_line_length": 36.62222222222222,
"alnum_prop": 0.6820388349514563,
"repo_name": "slackhq/node-slack-sdk",
"id": "7e8863e70ab7134ecbf4ae24a72b743f830a8386",
"size": "1648",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "examples/upload-a-file.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "217263"
}
],
"symlink_target": ""
} |
class SectionsController < ApiController
skip_before_filter :verify_authenticity_token
respond_to :json
def create
section = Section.create(section_params)
respond_with(section)
rescue ActiveRecord::RecordInvalid => invalid
puts invalid.record.errors
end
def show
section = Section.find(params[:id])
respond_with(section)
rescue ActiveRecord::RecordNotFound
raise 'Section not found'
end
def leaders
section = Section.find(params[:id])
respond_with(section.leaders)
rescue ActiveRecord::RecordNotFound
raise 'Section not found'
end
def students
section = Section.find(params[:id])
respond_with(section.students)
rescue ActiveRecord::RecordNotFound
raise 'Section not found'
end
private
def section_params
params.permit(:course_id, :leader_id)
end
end
| {
"content_hash": "fcc8bf3d2f60a94355ea8142e561a6cb",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 47,
"avg_line_length": 22.18421052631579,
"alnum_prop": 0.7224199288256228,
"repo_name": "osdiab/codepuppy-web",
"id": "2d2cd75d63e429100664af5fa01d9b3dace3585a",
"size": "843",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/controllers/sections_controller.rb",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "6935"
},
{
"name": "JavaScript",
"bytes": "33183"
},
{
"name": "Python",
"bytes": "1176"
},
{
"name": "Ruby",
"bytes": "52145"
},
{
"name": "Shell",
"bytes": "8042"
}
],
"symlink_target": ""
} |
package christophedelory.playlist.m3u;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.List;
import java.util.Locale;
import org.apache.commons.logging.Log;
import christophedelory.content.type.ContentType;
import christophedelory.player.PlayerSupport;
import christophedelory.playlist.AbstractPlaylistComponent;
import christophedelory.playlist.Media;
import christophedelory.playlist.Parallel;
import christophedelory.playlist.Playlist;
import christophedelory.playlist.Sequence;
import christophedelory.playlist.SpecificPlaylist;
import christophedelory.playlist.SpecificPlaylistProvider;
/**
* A simple text-based list of the locations of the items, with each item on a new line.
* @version $Revision: 91 $
* @author Christophe Delory
*/
public class M3UProvider implements SpecificPlaylistProvider
{
/**
* A list of compatible content types.
*/
private static final ContentType[] FILETYPES =
{
new ContentType(new String[] { ".m3u" },
new String[] { "audio/x-mpegurl", "audio/mpegurl" },
new PlayerSupport[]
{
new PlayerSupport(PlayerSupport.Player.WINAMP, true, null),
new PlayerSupport(PlayerSupport.Player.VLC_MEDIA_PLAYER, true, null),
new PlayerSupport(PlayerSupport.Player.WINDOWS_MEDIA_PLAYER, true, null),
new PlayerSupport(PlayerSupport.Player.MEDIA_PLAYER_CLASSIC, true, null),
new PlayerSupport(PlayerSupport.Player.FOOBAR2000, true, null),
new PlayerSupport(PlayerSupport.Player.MPLAYER, true, null),
new PlayerSupport(PlayerSupport.Player.QUICKTIME, true, null),
new PlayerSupport(PlayerSupport.Player.ITUNES, true, null),
new PlayerSupport(PlayerSupport.Player.REALPLAYER, false, null),
},
"Winamp M3U"),
new ContentType(new String[] { ".m3u8" },
new String[] { "audio/x-mpegurl", "audio/mpegurl" },
new PlayerSupport[]
{
new PlayerSupport(PlayerSupport.Player.WINAMP, true, null),
new PlayerSupport(PlayerSupport.Player.FOOBAR2000, true, null),
},
"Winamp M3U8"),
new ContentType(new String[] { ".m4u" },
new String[] { "video/x-mpegurl" },
new PlayerSupport[]
{
},
"M4U Playlist"),
new ContentType(new String[] { ".ram" },
new String[] { "audio/vnd.rn-realaudio", "audio/x-pn-realaudio" },
new PlayerSupport[]
{
new PlayerSupport(PlayerSupport.Player.MEDIA_PLAYER_CLASSIC, false, null),
new PlayerSupport(PlayerSupport.Player.REALPLAYER, false, null),
},
"Real Audio Metadata (RAM)"),
};
@Override
public String getId()
{
return "m3u";
}
@Override
public ContentType[] getContentTypes()
{
return FILETYPES.clone();
}
@Override
public SpecificPlaylist readFrom(final InputStream in, final String encoding, final Log logger) throws Exception
{
String enc = encoding;
if (enc == null)
{
enc = "UTF-8"; // For the M3U8 case. FIXME US-ASCII?
}
final BufferedReader reader = new BufferedReader(new InputStreamReader(in, enc)); // Throws NullPointerException if in is null. May throw UnsupportedEncodingException, IOException.
final M3U ret = new M3U();
ret.setProvider(this);
String line;
String songName = null;
String songLength = null;
while ((line = reader.readLine()) != null) // May throw IOException.
{
line = line.trim();
if (line.length() > 0)
{
final char firstChar = line.charAt(0); // Shall not throw IndexOutOfBoundsException.
// Exclude what looks like an XML file, or a Windows .ini file.
// Files or URLs "usually" don't begin with such characters.
if ((firstChar == '<') || (firstChar == '['))
{
throw new IllegalArgumentException("Doesn't seem to be a M3U playlist (and related ones)");
}
else if (firstChar == '#')
{
if (line.toUpperCase(Locale.ENGLISH).startsWith("#EXTINF"))
{
final int indA = line.indexOf(',', 0);
if (indA >= 0) // NOPMD Deeply nested if then statement
{
songName = line.substring(indA + 1, line.length());
}
final int indB = line.indexOf(':', 0);
if ((indB >= 0) && (indB < indA)) // NOPMD Deeply nested if then statement
{
songLength = line.substring(indB + 1, indA).trim();
}
}
// Otherwise ignore the comment.
// In particular VLC directives "EXTVLCOPT:<param>=<value>" are ignored.
// The same applies to #EXTART for album artist and #EXTALB for album title.
}
else
{
final Resource resource = new Resource(); // NOPMD Avoid instantiating new objects inside loops
resource.setLocation(line);
resource.setName(songName); // songName may be null.
if (songLength != null)
{
resource.setLength(Long.parseLong(songLength)); // May throw NumberFormatException.
}
ret.getResources().add(resource);
songName = null;
songLength = null;
}
}
}
return ret;
}
@Override
public SpecificPlaylist toSpecificPlaylist(final Playlist playlist) throws Exception
{
final M3U ret = new M3U();
ret.setProvider(this);
addToPlaylist(ret.getResources(), playlist.getRootSequence()); // May throw Exception.
return ret;
}
/**
* Adds the resources referenced in the specified generic playlist component to the input list.
* @param resources the resulting list of resources. Shall not be <code>null</code>.
* @param component the generic playlist component to handle. Shall not be <code>null</code>.
* @throws NullPointerException if <code>resources</code> is <code>null</code>.
* @throws NullPointerException if <code>component</code> is <code>null</code>.
* @throws Exception if this service provider is unable to represent the input playlist.
*/
private void addToPlaylist(final List<Resource> resources, final AbstractPlaylistComponent component) throws Exception
{
if (component instanceof Sequence)
{
final Sequence seq = (Sequence) component;
if (seq.getRepeatCount() < 0)
{
throw new IllegalArgumentException("A M3U playlist cannot handle a sequence repeated indefinitely");
}
final AbstractPlaylistComponent[] components = seq.getComponents();
for (int iter = 0; iter < seq.getRepeatCount(); iter++)
{
for (AbstractPlaylistComponent c : components)
{
addToPlaylist(resources, c); // May throw Exception.
}
}
}
else if (component instanceof Parallel)
{
throw new IllegalArgumentException("A parallel time container is incompatible with a M3U playlist");
}
else if (component instanceof Media)
{
final Media media = (Media) component;
if (media.getDuration() != null)
{
throw new IllegalArgumentException("A M3U playlist cannot handle a timed media");
}
if (media.getRepeatCount() < 0)
{
throw new IllegalArgumentException("A M3U playlist cannot handle a media repeated indefinitely");
}
if (media.getSource() != null)
{
for (int iter = 0; iter < media.getRepeatCount(); iter++)
{
final Resource resource = new Resource(); // NOPMD Avoid instantiating new objects inside loops
resource.setLocation(media.getSource().toString());
if (media.getSource().getDuration() >= 0L)
{
resource.setLength((media.getSource().getDuration() + 999L) / 1000L);
}
resources.add(resource); // Shall not throw UnsupportedOperationException, ClassCastException, NullPointerException, IllegalArgumentException.
}
}
}
}
}
| {
"content_hash": "8fb16f20cc57d04dea5119a329ede95d",
"timestamp": "",
"source": "github",
"line_count": 237,
"max_line_length": 188,
"avg_line_length": 39.94092827004219,
"alnum_prop": 0.5438411155715192,
"repo_name": "wenerme/Lizzy",
"id": "3bf63bae95a8e75bdba3370e32c57a13be6917bf",
"size": "10806",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/java/christophedelory/playlist/m3u/M3UProvider.java",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "HTML",
"bytes": "53294"
},
{
"name": "Java",
"bytes": "1199113"
},
{
"name": "Shell",
"bytes": "1223"
}
],
"symlink_target": ""
} |
package org.apache.usergrid.query.validator;
/**
* @author Sungju Jin
*/
public class QueryRequest {
private String dbQuery;
private ApiQuery apiQuery;
public QueryRequest() {
this.apiQuery = new ApiQuery();
}
public String getDbQuery() {
return dbQuery;
}
public void setDbQuery(String dbQuery) {
this.dbQuery = dbQuery;
}
public ApiQuery getApiQuery() {
return apiQuery;
}
static public class ApiQuery {
private String query;
private int limit;
public ApiQuery() {
limit = 10;
}
public String getQuery() {
return query;
}
public void setQuery(String query) {
this.query = query;
}
public int getLimit() {
return limit;
}
public void setLimit(int limit) {
this.limit = limit;
}
}
}
| {
"content_hash": "0f471e5bd743dd36173c5590db9c8caa",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 44,
"avg_line_length": 18.313725490196077,
"alnum_prop": 0.5417558886509636,
"repo_name": "mdunker/usergrid",
"id": "e65998f741e37b56e9ea4e9e06382f814f5c5669",
"size": "1736",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "stack/query-validator/src/main/java/org/apache/usergrid/query/validator/QueryRequest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "2211"
},
{
"name": "CSS",
"bytes": "252921"
},
{
"name": "GAP",
"bytes": "7673"
},
{
"name": "Gherkin",
"bytes": "260"
},
{
"name": "Groovy",
"bytes": "38652"
},
{
"name": "HTML",
"bytes": "2949624"
},
{
"name": "Java",
"bytes": "10860414"
},
{
"name": "JavaScript",
"bytes": "581093"
},
{
"name": "Nu",
"bytes": "8658"
},
{
"name": "Objective-C",
"bytes": "396026"
},
{
"name": "PHP",
"bytes": "441368"
},
{
"name": "Perl",
"bytes": "60137"
},
{
"name": "Python",
"bytes": "398058"
},
{
"name": "Ruby",
"bytes": "200736"
},
{
"name": "Scala",
"bytes": "185325"
},
{
"name": "Shell",
"bytes": "127130"
}
],
"symlink_target": ""
} |
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class FS_AffiliateTerms extends FS_Scope_Entity {
#region Properties
/**
* @var bool
*/
public $is_active;
/**
* @var string Enum: `affiliation` or `rewards`. Defaults to `affiliation`.
*/
public $type;
/**
* @var string Enum: `payout` or `credit`. Defaults to `payout`.
*/
public $reward_type;
/**
* If `first`, the referral will be attributed to the first visited source containing the affiliation link that
* was clicked.
*
* @var string Enum: `first` or `last`. Defaults to `first`.
*/
public $referral_attribution;
/**
* @var int Defaults to `30`, `0` for session cookie, and `null` for endless cookie (until cookies are cleaned).
*/
public $cookie_days;
/**
* @var int
*/
public $commission;
/**
* @var string Enum: `percentage` or `dollar`. Defaults to `percentage`.
*/
public $commission_type;
/**
* @var null|int Defaults to `0` (affiliate only on first payment). `null` for commission for all renewals. If
* greater than `0`, affiliate will get paid for all renewals for `commission_renewals_days` days after
* the initial upgrade/purchase.
*/
public $commission_renewals_days;
/**
* @var int Only cents and no percentage. In US cents, e.g.: 100 = $1.00. Defaults to `null`.
*/
public $install_commission;
/**
* @var string Required default target link, e.g.: pricing page.
*/
public $default_url;
/**
* @var string One of the following: 'all', 'new_customer', 'new_user'.
* If 'all' - reward for any user type.
* If 'new_customer' - reward only for new customers.
* If 'new_user' - reward only for new users.
*/
public $reward_customer_type;
/**
* @var int Defaults to `0` (affiliate only on directly affiliated links). `null` if an affiliate will get
* paid for all customers' lifetime payments. If greater than `0`, an affiliate will get paid for all
* customer payments for `future_payments_days` days after the initial payment.
*/
public $future_payments_days;
/**
* @var bool If `true`, allow referrals from social sites.
*/
public $is_social_allowed;
/**
* @var bool If `true`, allow conversions without HTTP referrer header at all.
*/
public $is_app_allowed;
/**
* @var bool If `true`, allow referrals from any site.
*/
public $is_any_site_allowed;
#endregion Properties
/**
* @author Leo Fajardo (@leorw)
*
* @return string
*/
function get_formatted_commission()
{
return ( 'dollar' === $this->commission_type ) ?
( '$' . $this->commission ) :
( $this->commission . '%' );
}
/**
* @author Leo Fajardo (@leorw)
*
* @return bool
*/
function has_lifetime_commission() {
return ( 0 !== $this->future_payments_days );
}
/**
* @author Leo Fajardo (@leorw)
*
* @return bool
*/
function is_session_cookie() {
return ( 0 == $this->cookie_days );
}
/**
* @author Leo Fajardo (@leorw)
*
* @return bool
*/
function has_renewals_commission() {
return ( is_null( $this->commission_renewals_days ) || $this->commission_renewals_days > 0 );
}
} | {
"content_hash": "35016787d29f2095d8d4139255ef6d2d",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 120,
"avg_line_length": 31.650406504065042,
"alnum_prop": 0.5068070896480863,
"repo_name": "afragen/github-updater-additions",
"id": "6dab87f41f94ca096faed1d19a8474a934ac4c90",
"size": "4098",
"binary": false,
"copies": "40",
"ref": "refs/heads/develop",
"path": "vendor/freemius/wordpress-sdk/includes/entities/class-fs-affiliate-terms.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "30638"
}
],
"symlink_target": ""
} |
name: Bug report
about: Create a report to help us improve
---
<!--⚠️⚠️⚠️ **Issue with no filled out template will be closed** ⚠️⚠️⚠️-->
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Version [e.g. 0.6.0]
**FlagPhoneNumber (please complete the following information):**
- Version [e.g. 0.6.0]
**Additional context**
Add any other context about the problem here.
| {
"content_hash": "26ce50219516ff8ec5579ac6c091badc",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 73,
"avg_line_length": 24.09090909090909,
"alnum_prop": 0.6842767295597484,
"repo_name": "chronotruck/CTKFlagPhoneNumber",
"id": "4f29b885eb20af7e18f08002aa2e2022fb411928",
"size": "823",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": ".github/ISSUE_TEMPLATE/bug_report.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Ruby",
"bytes": "2165"
},
{
"name": "Shell",
"bytes": "65"
},
{
"name": "Swift",
"bytes": "87439"
}
],
"symlink_target": ""
} |
TextEditor::Application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Do not eager load code on boot.
config.eager_load = false
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Raise an error on page load if there are pending migrations
config.active_record.migration_error = :page_load
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
end
| {
"content_hash": "0201f73947014c9b4286d4bcf5029fea",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 85,
"avg_line_length": 38.55172413793103,
"alnum_prop": 0.7602862254025045,
"repo_name": "zavodleino/prostotext",
"id": "c27bdf8dc5d763ed8beaac6ffddcf32c151379c0",
"size": "1118",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "config/environments/development.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "903"
},
{
"name": "CoffeeScript",
"bytes": "422"
},
{
"name": "HTML",
"bytes": "6221"
},
{
"name": "JavaScript",
"bytes": "664"
},
{
"name": "Ruby",
"bytes": "25644"
}
],
"symlink_target": ""
} |
function with_jquery(f) {
var script = document.createElement("script");
script.type = "text/javascript";
script.textContent = "(" + f.toString() + ")(jQuery)";
document.body.appendChild(script);
};
with_jquery(function($) {
$('document').ready(function() {
var postsToCheck = $.map($(".flagged-post-row"), function(val, i) {
return $(val).data("post-id")
}).join(";");
$.get("https://api.stackexchange.com/2.2/posts/" + postsToCheck + "/revisions", {key: "FgWOIKMLFEJQ86U3hbkgDA((", site: window.location.hostname, pagesize: 100, filter: "!*Kb37YAWvnLZdFd."}).done(function(data) {
$.each(data["items"], function(index, revision) {
$.each($("#flagged-" + revision["post_id"] + " .mod-message .relativetime"), function(index, timestamp) {
var flagDate = Date.parse($(timestamp).attr("title")) / 1000;
if (flagDate < revision["creation_date"])
{
$("#flagged-" + revision["post_id"] + " .mod-message tbody ").prepend("<tr><td class='flagcell'> </td><td><p style='color:red'><strong><a target='_blank' style='color:red' href='/posts/" + revision["post_id"] + "/revisions'>Post revised</a></strong> since first flag cast</p></td></tr>")
return false;
}
});
});
});
});
});
| {
"content_hash": "3c438d658de988976dc8c5ffbb584b67",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 304,
"avg_line_length": 46.92857142857143,
"alnum_prop": 0.58675799086758,
"repo_name": "Undo1/Undo-Userscripts",
"id": "bf5441f01601b7ab114b1ca98dc6397e0fc3743f",
"size": "1752",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "flagtimingwarning.user.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "37025"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>tortoise-hare-algorithm: Not compatible 👼</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.5.0~camlp4 / tortoise-hare-algorithm - 8.6.0</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
tortoise-hare-algorithm
<small>
8.6.0
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-11-04 11:54:16 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-11-04 11:54:16 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-num base Num library distributed with the OCaml compiler
base-threads base
base-unix base
camlp4 4.04+1 Camlp4 is a system for writing extensible parsers for programming languages
conf-findutils 1 Virtual package relying on findutils
coq 8.5.0~camlp4 Formal proof management system
num 0 The Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.04.2 The OCaml compiler (virtual package)
ocaml-base-compiler 4.04.2 Official 4.04.2 release
ocaml-config 1 OCaml Switch Configuration
ocamlbuild 0.14.2 OCamlbuild is a build system with builtin rules to easily build most OCaml projects
# opam file:
opam-version: "2.0"
maintainer: "Hugo.Herbelin@inria.fr"
homepage: "https://github.com/coq-contribs/tortoise-hare-algorithm"
license: "Unknown"
build: [make "-j%{jobs}%"]
install: [make "install"]
remove: ["rm" "-R" "%{lib}%/coq/user-contrib/TortoiseHareAlgorithm"]
depends: [
"ocaml"
"coq" {>= "8.6" & < "8.7~"}
]
tags: [
"keyword: program verification"
"keyword: paths"
"keyword: cycle detection"
"keyword: graphs"
"keyword: graph theory"
"keyword: finite sets"
"keyword: Floyd"
"category: Computer Science/Decision Procedures and Certified Algorithms/Correctness proofs of algorithms"
"date: 2007-02"
]
authors: [ "Jean-Christophe Filliâtre" ]
bug-reports: "https://github.com/coq-contribs/tortoise-hare-algorithm/issues"
dev-repo: "git+https://github.com/coq-contribs/tortoise-hare-algorithm.git"
synopsis: "Tortoise and the hare algorithm"
description: """
Correctness proof of Floyd's cycle-finding algorithm, also known as
the "tortoise and the hare"-algorithm.
See http://en.wikipedia.org/wiki/Floyd's_cycle-finding_algorithm"""
flags: light-uninstall
url {
src:
"https://github.com/coq-contribs/tortoise-hare-algorithm/archive/v8.6.0.tar.gz"
checksum: "md5=be6227480086d7ee6297ff9d817ff394"
}
</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-tortoise-hare-algorithm.8.6.0 coq.8.5.0~camlp4</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.5.0~camlp4).
The following dependencies couldn't be met:
- coq-tortoise-hare-algorithm -> coq >= 8.6 -> ocaml >= 4.05.0
base of this switch (use `--unlock-base' to force)
Your request can't be satisfied:
- No available version of coq satisfies the constraints
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-tortoise-hare-algorithm.8.6.0</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://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>
| {
"content_hash": "14596af7c9471b71e85da816490b0076",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 159,
"avg_line_length": 42.42134831460674,
"alnum_prop": 0.5629717918156536,
"repo_name": "coq-bench/coq-bench.github.io",
"id": "41b9bb1805b3c221ee20be2e323ecd4f90efcc48",
"size": "7577",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clean/Linux-x86_64-4.04.2-2.0.5/released/8.5.0~camlp4/tortoise-hare-algorithm/8.6.0.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
"""
Checkout process utilities.
"""
from __future__ import unicode_literals
from django.utils.translation import ugettext as _
from django.template.loader import get_template, TemplateDoesNotExist
from mezzanine.accounts import get_profile_for_user, ProfileNotConfigured
from mezzanine.conf import settings
from mezzanine.utils.email import send_mail_template
from cartridge.shop.models import Order
from cartridge.shop.utils import set_shipping, set_tax, sign
class CheckoutError(Exception):
"""
Should be raised in billing/shipping and payment handlers for
cases such as an invalid shipping address or an unsuccessful
payment.
"""
pass
def default_billship_handler(request, order_form):
"""
Default billing/shipping handler - called when the first step in
the checkout process with billing/shipping address fields is
submitted. Implement your own and specify the path to import it
from via the setting ``SHOP_HANDLER_BILLING_SHIPPING``.
This function will typically contain any shipping calculation
where the shipping amount can then be set using the function
``cartridge.shop.utils.set_shipping``. The Cart object is also
accessible via ``request.cart``
"""
if not request.session.get("free_shipping"):
settings.use_editable()
set_shipping(request, _("Flat rate shipping"),
settings.SHOP_DEFAULT_SHIPPING_VALUE)
def default_tax_handler(request, order_form):
"""
Default tax handler - called immediately after the handler defined
by ``SHOP_HANDLER_BILLING_SHIPPING``. Implement your own and
specify the path to import it from via the setting
``SHOP_HANDLER_TAX``. This function will typically contain any tax
calculation where the tax amount can then be set using the function
``cartridge.shop.utils.set_tax``. The Cart object is also
accessible via ``request.cart``
"""
settings.use_editable()
set_tax(request, _("Tax"), 0)
def default_payment_handler(request, order_form, order):
"""
Default payment handler - called when the final step of the
checkout process with payment information is submitted. Implement
your own and specify the path to import it from via the setting
``SHOP_HANDLER_PAYMENT``. This function will typically contain
integration with a payment gateway. Raise
cartridge.shop.checkout.CheckoutError("error message") if payment
is unsuccessful.
"""
pass
def default_order_handler(request, order_form, order):
"""
Default order handler - called when the order is complete and
contains its final data. Implement your own and specify the path
to import it from via the setting ``SHOP_HANDLER_ORDER``.
"""
pass
def initial_order_data(request, form_class=None):
"""
Return the initial data for the order form, trying the following in
order:
- request.POST which is available when moving backward through the
checkout steps
- current order details in the session which are populated via each
checkout step, to support user leaving the checkout entirely and
returning
- last order made by the user, via user ID or cookie
- matching fields on an authenticated user and profile object
"""
from cartridge.shop.forms import OrderForm
initial = {}
if request.method == "POST":
initial = dict(list(request.POST.items()))
try:
initial = form_class.preprocess(initial)
except (AttributeError, TypeError):
# form_class has no preprocess method, or isn't callable.
pass
# POST on first step won't include the "remember" checkbox if
# it isn't checked, and it'll then get an actual value of False
# when it's a hidden field - so we give it an empty value when
# it's missing from the POST data, to persist it not checked.
initial.setdefault("remember", "")
# Look for order in current session.
if not initial:
initial = request.session.get("order", {})
# Look for order in previous session.
if not initial:
lookup = {}
if request.user.is_authenticated():
lookup["user_id"] = request.user.id
remembered = request.COOKIES.get("remember", "").split(":")
if len(remembered) == 2 and remembered[0] == sign(remembered[1]):
lookup["key"] = remembered[1]
if lookup:
previous = list(Order.objects.filter(**lookup).values())[:1]
if len(previous) > 0:
initial.update(previous[0])
if not initial and request.user.is_authenticated():
# No previous order data - try and get field values from the
# logged in user. Check the profile model before the user model
# if it's configured. If the order field name uses one of the
# billing/shipping prefixes, also check for it without the
# prefix. Finally if a matching attribute is callable, call it
# for the field value, to support custom matches on the profile
# model.
user_models = [request.user]
try:
user_models.insert(0, get_profile_for_user(request.user))
except ProfileNotConfigured:
pass
for order_field in OrderForm._meta.fields:
check_fields = [order_field]
for prefix in ("billing_detail_", "shipping_detail_"):
if order_field.startswith(prefix):
check_fields.append(order_field.replace(prefix, "", 1))
for user_model in user_models:
for check_field in check_fields:
user_value = getattr(user_model, check_field, None)
if user_value:
if callable(user_value):
try:
user_value = user_value()
except TypeError:
continue
if not initial.get(order_field):
initial[order_field] = user_value
# Set initial value for "same billing/shipping" based on
# whether both sets of address fields are all equal.
shipping = lambda f: "shipping_%s" % f[len("billing_"):]
if any([f for f in OrderForm._meta.fields if f.startswith("billing_") and
shipping(f) in OrderForm._meta.fields and
initial.get(f, "") != initial.get(shipping(f), "")]):
initial["same_billing_shipping"] = False
# Never prepopulate discount code.
try:
del initial["discount_code"]
except KeyError:
pass
return initial
def send_order_email(request, order):
"""
Send order receipt email on successful order.
"""
settings.use_editable()
order_context = {"order": order, "request": request,
"order_items": order.items.all()}
if order.has_reservables:
order_context["has_reservables"] = True
else:
order_context["has_reservables"] = False
order_context["hide_shipping"] = settings.SHOP_ALWAYS_SAME_BILLING_SHIPPING
order_context.update(order.details_as_dict())
try:
get_template("shop/email/order_receipt.html")
except TemplateDoesNotExist:
receipt_template = "email/order_receipt"
else:
receipt_template = "shop/email/order_receipt"
from warnings import warn
warn("Shop email receipt templates have moved from "
"templates/shop/email/ to templates/email/")
send_mail_template(settings.SHOP_ORDER_EMAIL_SUBJECT,
receipt_template, settings.SHOP_ORDER_FROM_EMAIL,
order.billing_detail_email, context=order_context,
addr_bcc=settings.SHOP_ORDER_EMAIL_BCC or None)
# Set up some constants for identifying each checkout step.
CHECKOUT_STEPS = [{"template": "billing_shipping", "url": "details",
"title": _("Details")}]
CHECKOUT_STEP_FIRST = CHECKOUT_STEP_PAYMENT = CHECKOUT_STEP_LAST = 1
if settings.SHOP_CHECKOUT_STEPS_SPLIT:
CHECKOUT_STEPS[0].update({"url": "billing-shipping",
"title": _("Address")})
if settings.SHOP_PAYMENT_STEP_ENABLED:
CHECKOUT_STEPS.append({"template": "payment", "url": "payment",
"title": _("Payment")})
CHECKOUT_STEP_PAYMENT = CHECKOUT_STEP_LAST = 2
if settings.SHOP_CHECKOUT_STEPS_CONFIRMATION:
CHECKOUT_STEPS.append({"template": "confirmation", "url": "confirmation",
"title": _("Confirmation")})
CHECKOUT_STEP_LAST += 1
| {
"content_hash": "23cc31c836e20587e9c930c7b6ba944b",
"timestamp": "",
"source": "github",
"line_count": 207,
"max_line_length": 79,
"avg_line_length": 41.66183574879227,
"alnum_prop": 0.6419294990723562,
"repo_name": "jaywink/cartridge-reservable",
"id": "00fa603f6123a6bba4bbe486eb050815ce7bb4ce",
"size": "8624",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "cartridge/shop/checkout.py",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "CSS",
"bytes": "5886"
},
{
"name": "HTML",
"bytes": "43072"
},
{
"name": "JavaScript",
"bytes": "8904"
},
{
"name": "Python",
"bytes": "1118270"
}
],
"symlink_target": ""
} |
export function routing($stateProvider, $urlRouterProvider) {
$stateProvider
.state('login', {
url: '/login',
templateUrl: 'login/login.partial.html',
controller: 'LoginController',
controllerAs: '$ctrl'
})
.state('register', {
url: '/register',
templateUrl: 'register/register.partial.html',
controller: 'RegisterController',
controllerAs: '$ctrl'
})
.state('app', {
url: '',
templateUrl: 'app.html',
abstract: true
})
.state('app.overview', {
url: '/overview',
templateUrl: 'overview/overview.partial.html',
controller: 'OverviewController',
controllerAs: '$ctrl'
})
.state('app.outcomes', {
url: '/outcomes',
templateUrl: 'outcomes/outcomes.partial.html',
controller: 'OutcomesController',
controllerAs: '$ctrl'
})
.state('app.reflections', {
url: '/reflections',
templateUrl: 'reflections/reflections.partial.html',
controller: 'ReflectionsController',
controllerAs: '$ctrl'
})
.state('app.hot-spots', {
url: '/hot-spots',
templateUrl: 'hotSpots/hotSpots.partial.html',
controller: 'HotSpotsController',
controllerAs: '$ctrl'
})
.state('app.settings', {
url: '/settings',
templateUrl: 'settings/settings.partial.html'
});
$urlRouterProvider.otherwise(function ($injector) {
var $state = $injector.get('$state');
$state.go('app.overview');
});
} | {
"content_hash": "493153ec5ead50dbf1a93eb6d26b3ec6",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 64,
"avg_line_length": 33.075471698113205,
"alnum_prop": 0.5145464917284654,
"repo_name": "bjaanes/ExtremeResults-WebApp",
"id": "b3b5c76784d4ad7a29a9d0f60768a4b1bdfb9b7e",
"size": "1754",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/config/routing.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2475"
},
{
"name": "HTML",
"bytes": "29002"
},
{
"name": "JavaScript",
"bytes": "188707"
},
{
"name": "Shell",
"bytes": "545"
},
{
"name": "TypeScript",
"bytes": "44597"
}
],
"symlink_target": ""
} |
package org.pimslims.presentation.vector;
import java.util.Collection;
import java.util.Set;
import junit.framework.Assert;
import junit.framework.TestCase;
import org.pimslims.dao.AbstractModel;
import org.pimslims.dao.ModelImpl;
import org.pimslims.dao.WritableVersion;
import org.pimslims.exception.AccessException;
import org.pimslims.exception.ConstraintException;
import org.pimslims.model.molecule.Construct;
import org.pimslims.model.molecule.MoleculeFeature;
import org.pimslims.model.reference.SampleCategory;
import org.pimslims.model.sample.AbstractSample;
import org.pimslims.model.sample.RefSample;
import org.pimslims.model.sample.SampleComponent;
import org.pimslims.test.POJOFactory;
/**
* VectorBeanTest
*
*/
public class VectorBeanTest extends TestCase {
private static final String SEQUENCE = "CATG";
private static final String SEQUENCE2 = "ca tg";
private static final String DETAILS = "123bp";
private final AbstractModel model;
public VectorBeanTest(final String methodName) {
super(methodName);
this.model = ModelImpl.getModel();
}
public void testSimpleCreate() throws ConstraintException, AccessException {
final WritableVersion version = this.model.getTestVersion();
try {
final Construct construct = POJOFactory.createWithFullAttributes(version, Construct.class);
final VectorBean vectorBean = new VectorBean(construct);
Assert.assertNotNull(vectorBean);
} finally {
version.abort(); // not testing persistence
}
}
public void testCreateWithFeatures() throws AccessException, ConstraintException {
final WritableVersion version = this.model.getTestVersion();
try {
final Construct construct = POJOFactory.create(version, Construct.class);
final MoleculeFeature feature = POJOFactory.create(version, MoleculeFeature.class);
Assert.assertTrue(feature.get_MayDelete());
feature.setFeatureType("resistance");
construct.addMoleculeFeature(feature);
final VectorBean vectorBean = new VectorBean(construct);
Assert.assertNotNull(vectorBean);
final FeatureBean featureBean = vectorBean.getResistances().get(0);
Assert.assertEquals("resistance", featureBean.getFeatureType());
Assert.assertFalse("No sequence in bean", VectorBeanTest.SEQUENCE.equals(4));
Assert.assertTrue(featureBean.getMayDelete());
//211009 Testing length in Construct with a sequence
construct.setSequence(VectorBeanTest.SEQUENCE);
final VectorBean vectorBean2 = new VectorBean(construct);
Assert.assertSame(4, vectorBean2.getLength());
//211009 Testing length in a Construct with length in Details field
final Construct construct2 = POJOFactory.create(version, Construct.class);
construct2.setDetails(VectorBeanTest.DETAILS);
final VectorBean vectorBean3 = new VectorBean(construct2);
Assert.assertEquals(VectorBeanTest.DETAILS, vectorBean3.getDetails());
Assert.assertTrue(vectorBean3.getLength() == 123);
//211009 Finally testing when both are set
final Construct construct3 = POJOFactory.create(version, Construct.class);
construct3.setDetails(VectorBeanTest.DETAILS);
construct3.setSequence(VectorBeanTest.SEQUENCE);
final VectorBean vectorBean4 = new VectorBean(construct);
Assert.assertSame(4, vectorBean4.getLength());
Assert.assertTrue(vectorBean.getMayDelete());
} finally {
version.abort(); // not testing persistence
}
}
public void testSaveRecipe() throws AccessException, ConstraintException {
final WritableVersion version = this.model.getTestVersion();
try {
final Construct vector = POJOFactory.createWithFullAttributes(version, Construct.class);
final RefSample recipe = VectorBean.makeRecipe(vector);
Assert.assertNotNull(recipe);
Assert.assertEquals(1, recipe.getSampleCategories().size());
Assert.assertEquals("Vector", recipe.getSampleCategories().iterator().next().getName());
final VectorBean bean2 = VectorBean.getVectorBean(recipe);
Assert.assertEquals(vector.getName(), bean2.getName());
} finally {
version.abort(); // not testing persistence
}
}
public void testSimpleSave() throws AccessException, ConstraintException {
final WritableVersion version = this.model.getTestVersion();
try {
final Construct construct = POJOFactory.createWithFullAttributes(version, Construct.class);
construct.setSequence(VectorBeanTest.SEQUENCE2);
final VectorBean vectorBean = new VectorBean(construct);
Assert.assertEquals(VectorBeanTest.SEQUENCE, vectorBean.getSequence());
vectorBean.setName("TestName");
final Construct savedConstruct = VectorBean.save(version, vectorBean);
Assert.assertNotNull(savedConstruct);
Assert.assertEquals(vectorBean.getName(), savedConstruct.getName());
final Collection<SampleComponent> components =
version.findAll(SampleComponent.class, SampleComponent.PROP_REFCOMPONENT, savedConstruct);
Assert.assertEquals(1, components.size());
final AbstractSample recipe = components.iterator().next().getAbstractSample();
final Set<SampleCategory> categories = recipe.getSampleCategories();
Assert.assertEquals(1, categories.size());
Assert.assertEquals("Vector", categories.iterator().next().getName());
} finally {
version.abort(); // not testing persistence
}
}
public void testSaveWithFeatures() throws AccessException, ConstraintException {
final WritableVersion version = this.model.getTestVersion();
try {
final Construct construct = POJOFactory.create(version, Construct.class);
final MoleculeFeature feature = POJOFactory.create(version, MoleculeFeature.class);
feature.setFeatureType("resistance");
construct.addMoleculeFeature(feature);
Assert.assertEquals(1, construct.getMoleculeFeatures().size());
final VectorBean vectorBean = new VectorBean(construct);
vectorBean.setName("TestName");
final FeatureBean featureBean = vectorBean.getResistances().get(0);
featureBean.setName("FeatureName");
Assert.assertEquals(1, vectorBean.getResistances().size());
Assert.assertEquals(0, vectorBean.getMarkers().size());
Assert.assertEquals(0, vectorBean.getPromoters().size());
final Construct savedConstruct = VectorBean.save(version, vectorBean);
Assert.assertNotNull(savedConstruct);
Assert.assertEquals("TestName", savedConstruct.getName());
Assert.assertEquals(1, savedConstruct.getMoleculeFeatures().size());
final MoleculeFeature molFeature = savedConstruct.getMoleculeFeatures().iterator().next();
Assert.assertEquals("resistance", molFeature.getFeatureType());
Assert.assertEquals("FeatureName", molFeature.getName());
} finally {
version.abort(); // not testing persistence
}
}
}
| {
"content_hash": "97eafd09889c166ceb581d3488150515",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 106,
"avg_line_length": 46.104294478527606,
"alnum_prop": 0.6850299401197605,
"repo_name": "homiak/pims-lims",
"id": "f50cdb14a41137b70e00052dd0eb856ba7547f01",
"size": "7830",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "TestSource/org/pimslims/presentation/vector/VectorBeanTest.java",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "CSS",
"bytes": "64591"
},
{
"name": "HTML",
"bytes": "102786"
},
{
"name": "Java",
"bytes": "6555488"
},
{
"name": "JavaScript",
"bytes": "292181"
}
],
"symlink_target": ""
} |
package com.fit2cloud.aliyun.rds.model.response;
import com.fit2cloud.aliyun.Response;
public class CreateTempDBInstanceResponse extends Response {
private String TempDBInstanceId;
public String getTempDBInstanceId() {
return TempDBInstanceId;
}
public void setTempDBInstanceId(String tempDBInstanceId) {
TempDBInstanceId = tempDBInstanceId;
}
}
| {
"content_hash": "35611e7ce376e0539e6c03b63c786bc1",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 60,
"avg_line_length": 23.933333333333334,
"alnum_prop": 0.8133704735376045,
"repo_name": "fit2cloud/aliyun-api-java-wrapper",
"id": "7f9ecc77e25b1f1a18d3dd9af2f116c02448aafd",
"size": "359",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/com/fit2cloud/aliyun/rds/model/response/CreateTempDBInstanceResponse.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "444033"
}
],
"symlink_target": ""
} |
// @flow
import React, { Component } from 'react';
import { Text } from 'react-native-paper';
import { type Dispatch } from 'redux';
import {
createToolbarEvent,
sendAnalytics
} from '../../../analytics';
import { RAISE_HAND_ENABLED, getFeatureFlag } from '../../../base/flags';
import { translate } from '../../../base/i18n';
import {
getLocalParticipant,
hasRaisedHand,
raiseHand
} from '../../../base/participants';
import { connect } from '../../../base/redux';
import { type AbstractButtonProps } from '../../../base/toolbox/components';
import Button from '../../../base/ui/components/native/Button';
import { BUTTON_TYPES } from '../../../base/ui/constants.native';
import styles from './styles';
/**
* The type of the React {@code Component} props of {@link RaiseHandButton}.
*/
type Props = AbstractButtonProps & {
/**
* Whether this button is enabled or not.
*/
_enabled: boolean,
/**
* The local participant.
*/
_localParticipant: Object,
/**
* Whether the participant raused their hand or not.
*/
_raisedHand: boolean,
/**
* The redux {@code dispatch} function.
*/
dispatch: Dispatch<any>,
/**
* Used for translation.
*/
t: Function,
/**
* Used to close the overflow menu after raise hand is clicked.
*/
onCancel: Function
};
/**
* An implementation of a button to raise or lower hand.
*/
class RaiseHandButton extends Component<Props, *> {
accessibilityLabel = 'toolbar.accessibilityLabel.raiseHand';
label = 'toolbar.raiseYourHand';
toggledLabel = 'toolbar.lowerYourHand';
/**
* Initializes a new {@code RaiseHandButton} instance.
*
* @param {Props} props - The React {@code Component} props to initialize
* the new {@code RaiseHandButton} instance with.
*/
constructor(props: Props) {
super(props);
// Bind event handlers so they are only bound once per instance.
this._onClick = this._onClick.bind(this);
this._toggleRaisedHand = this._toggleRaisedHand.bind(this);
this._getLabel = this._getLabel.bind(this);
}
_onClick: () => void;
_toggleRaisedHand: () => void;
_getLabel: () => string;
/**
* Handles clicking / pressing the button.
*
* @returns {void}
*/
_onClick() {
this._toggleRaisedHand();
this.props.onCancel();
}
/**
* Toggles the rased hand status of the local participant.
*
* @returns {void}
*/
_toggleRaisedHand() {
const enable = !this.props._raisedHand;
sendAnalytics(createToolbarEvent('raise.hand', { enable }));
this.props.dispatch(raiseHand(enable));
}
/**
* Gets the current label, taking the toggled state into account. If no
* toggled label is provided, the regular label will also be used in the
* toggled state.
*
* @returns {string}
*/
_getLabel() {
const { _raisedHand, t } = this.props;
return t(_raisedHand ? this.toggledLabel : this.label);
}
/**
* Renders the "raise hand" emoji.
*
* @returns {ReactElement}
*/
_renderRaiseHandEmoji() {
return (
<Text>✋</Text>
);
}
/**
* Implements React's {@link Component#render()}.
*
* @inheritdoc
* @returns {ReactElement}
*/
render() {
const { _enabled } = this.props;
if (!_enabled) {
return null;
}
return (
<Button
accessibilityLabel = { this.accessibilityLabel }
icon = { this._renderRaiseHandEmoji }
labelKey = { this._getLabel() }
onClick = { this._onClick }
style = { styles.raiseHandButton }
type = { BUTTON_TYPES.SECONDARY } />
);
}
}
/**
* Maps part of the Redux state to the props of this component.
*
* @param {Object} state - The Redux state.
* @private
* @returns {Props}
*/
function _mapStateToProps(state): Object {
const _localParticipant = getLocalParticipant(state);
const enabled = getFeatureFlag(state, RAISE_HAND_ENABLED, true);
return {
_enabled: enabled,
_localParticipant,
_raisedHand: hasRaisedHand(_localParticipant)
};
}
export default translate(connect(_mapStateToProps)(RaiseHandButton));
| {
"content_hash": "27c747bcccbbde921fc25c8bd280a86d",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 77,
"avg_line_length": 24.616666666666667,
"alnum_prop": 0.5851952155269691,
"repo_name": "jitsi/jitsi-meet",
"id": "023d2edafea224d6dbe9f2b8a0ba2dee8d2142bb",
"size": "4433",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "react/features/reactions/components/native/RaiseHandButton.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "829"
},
{
"name": "HTML",
"bytes": "20408"
},
{
"name": "Java",
"bytes": "232895"
},
{
"name": "JavaScript",
"bytes": "2550511"
},
{
"name": "Lua",
"bytes": "301404"
},
{
"name": "Makefile",
"bytes": "4160"
},
{
"name": "Objective-C",
"bytes": "154389"
},
{
"name": "Ruby",
"bytes": "7816"
},
{
"name": "SCSS",
"bytes": "152946"
},
{
"name": "Shell",
"bytes": "36422"
},
{
"name": "Starlark",
"bytes": "152"
},
{
"name": "Swift",
"bytes": "50411"
},
{
"name": "TypeScript",
"bytes": "2866536"
}
],
"symlink_target": ""
} |
module RenderStatus
extend ActiveSupport::Concern
def unauthorized
status 401
end
def not_found
status 404
end
def status(status_code)
head status_code
end
end
| {
"content_hash": "1e3e363b507956ce14da12fb72481a92",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 31,
"avg_line_length": 11.875,
"alnum_prop": 0.7,
"repo_name": "MobilityLabs/pdredesign-server",
"id": "65590706acee09b51bf94d7ded3282cb2c649148",
"size": "190",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/controllers/concerns/render_status.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "63259"
},
{
"name": "Dockerfile",
"bytes": "769"
},
{
"name": "HTML",
"bytes": "311103"
},
{
"name": "JavaScript",
"bytes": "597188"
},
{
"name": "Ruby",
"bytes": "835087"
},
{
"name": "SQLPL",
"bytes": "946591"
},
{
"name": "Shell",
"bytes": "48"
}
],
"symlink_target": ""
} |
title: Chef Habitat 0.67.0 Release!
date: 2018-10-30
author: Christopher Maier
tags: release notes
category: product
classes: body-article
---
Habitat 0.67.0 Release notes
We are happy to announce the release of Chef Habitat 0.67.0. If you just want the binaries, head on over to [Install Chef Habitat](https://www.habitat.sh/docs/install-habitat/).
In this release, we have a new `hab pkg uninstall` command you'll want to check out. More will be coming for this highly-requested command in the coming weeks, but it should help you begin to take control of your `/hab/pkgs` directory.
Aside from that, we have a number of bug fixes, in particular [#5792](https://github.com/habitat-sh/habitat/pull/5792), which fixed a regression from 0.66.0 that resulted in health check information remaining behind after a service was unloaded.
Thanks again for using Chef Habitat!
#### New Features & Enhancements
- Add `hab pkg uninstall` command [#5737](https://github.com/habitat-sh/habitat/pull/5737) ([jamesc](https://github.com/jamesc))
#### Bug Fixes
- Remove health check data when a service is unloaded [#5792](https://github.com/habitat-sh/habitat/pull/5792) ([raskchanky](https://github.com/raskchanky))
- Add the possible values for --topology into the online help [#5789](https://github.com/habitat-sh/habitat/pull/5789) ([baumanj](https://github.com/baumanj))
- Ensure we have the correct ContentType on our responses [#5782](https://github.com/habitat-sh/habitat/pull/5782) ([raskchanky](https://github.com/raskchanky))
- Store port values as u16 in Member struct [#5759](https://github.com/habitat-sh/habitat/pull/5759) ([baumanj](https://github.com/baumanj))
- implement HAB_STUDIO_SECRET var passing for windows studios [#5765](https://github.com/habitat-sh/habitat/pull/5765) ([mwrock](https://github.com/mwrock))
#### Merged Pull Requests
- Prepare for 0.67.0 Release [#5795](https://github.com/habitat-sh/habitat/pull/5795) ([christophermaier](https://github.com/christophermaier))
- Shelving composites post [#5740](https://github.com/habitat-sh/habitat/pull/5740) ([mgamini](https://github.com/mgamini))
- fix asp.net tutorial based on recent changes [#5788](https://github.com/habitat-sh/habitat/pull/5788) ([mwrock](https://github.com/mwrock))
- move doc commit filtering to ci script [#5785](https://github.com/habitat-sh/habitat/pull/5785) ([mwrock](https://github.com/mwrock))
- Add macro for cli testing [#5754](https://github.com/habitat-sh/habitat/pull/5754) ([mpeck](https://github.com/mpeck))
- remove -w parameter for invoking a local studio in internal calls [#5773](https://github.com/habitat-sh/habitat/pull/5773) ([mwrock](https://github.com/mwrock))
- Remove unused function and update error message [#5764](https://github.com/habitat-sh/habitat/pull/5764) ([chefsalim](https://github.com/chefsalim))
- Add myself to MAINTAINERS.md [#5755](https://github.com/habitat-sh/habitat/pull/5755) ([jamesc](https://github.com/jamesc))
- Remove Liz from CLI related code owners [#5776](https://github.com/habitat-sh/habitat/pull/5776) ([apriofrost](https://github.com/apriofrost))
- Fix unused variable in rumor test [#5763](https://github.com/habitat-sh/habitat/pull/5763) ([jamesc](https://github.com/jamesc))
- install and upload launcher builds if not a release [#5769](https://github.com/habitat-sh/habitat/pull/5769) ([mwrock](https://github.com/mwrock))
- 0.66.0 post release [#5775](https://github.com/habitat-sh/habitat/pull/5775) ([mpeck](https://github.com/mpeck))
| {
"content_hash": "08aca88c4e45fb3df32fc1ed0c2eb661",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 245,
"avg_line_length": 85.41463414634147,
"alnum_prop": 0.7481439177612793,
"repo_name": "rsertelon/habitat",
"id": "5a4eb82889c58c5b8cd7848c8908acb4c0d39ab8",
"size": "3506",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "www/source/blog/2018-10-30-0.67.0-release.html.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "566"
},
{
"name": "C#",
"bytes": "8421"
},
{
"name": "CSS",
"bytes": "114163"
},
{
"name": "Dockerfile",
"bytes": "2648"
},
{
"name": "HTML",
"bytes": "698090"
},
{
"name": "JavaScript",
"bytes": "21970"
},
{
"name": "Makefile",
"bytes": "9091"
},
{
"name": "PowerShell",
"bytes": "180851"
},
{
"name": "Python",
"bytes": "1910"
},
{
"name": "RAML",
"bytes": "8621"
},
{
"name": "Ruby",
"bytes": "37436"
},
{
"name": "Rust",
"bytes": "2316448"
},
{
"name": "Shell",
"bytes": "438795"
}
],
"symlink_target": ""
} |
@import url(//fonts.googleapis.com/css?family=Open+Sans:400,300italic,300,400italic,600,600italic,700,700italic,800,800italic);
@import url(//fonts.googleapis.com/css?family=PT+Sans:400,700);
body,
html {
margin: 0;
padding: 0;
width: auto;
height: auto;
overflow: hidden;
}
.container {
width: 100%;
margin: 0 auto;
overflow: hidden;
}
.container .clock {
width: 100%;
margin: 0 auto;
color: #fff;
}
.container .clock #date {
position: absolute;
font-family: "PT Sans", sans-serif;
font-size: 72px;
text-align: center;
text-shadow: 0 0 5px #4c7597;
width: 100%;
height: 100%;
opacity: 0.0;
}
.container .clock ul {
width: 100%;
margin: 0 auto;
padding: 0px;
list-style: none;
text-align: center;
display: inline-block;
}
.container .clock ul li {
display: inline;
font-size: 72px;
text-align: center;
font-family: "PT Sans", sans-serif;
text-shadow: 0 0 5px #4c7597;
}
.container .clock ul li.point {
position: relative;
animation: mymove 2s ease infinite;
-webkit-animation: mymove 2s ease infinite;
padding-left: 10px;
padding-right: 10px;
text-shadow: 0 0 20px #4c7597;
}
.container.theme-green .clock {
color: #fff;
}
.container.theme-green .clock #date {
text-shadow: 0 0 5px #75974c;
}
.container.theme-green .clock ul li {
text-shadow: 0 0 5px #75974c;
}
.container.theme-green .clock ul li.point {
text-shadow: 0 0 20px #75974c;
}
.container.theme-red .clock {
color: #fff;
}
.container.theme-red .clock #date {
text-shadow: 0 0 5px #974c75;
}
.container.theme-red .clock ul li {
text-shadow: 0 0 5px #974c75;
}
.container.theme-red .clock ul li.point {
text-shadow: 0 0 20px #974c75;
}
.container.theme-variant-b .clock {
color: #5d5d5d;
}
.container.theme-variant-b .clock #date {
text-shadow: 0 0 5px transparent;
}
.container.theme-variant-b .clock ul li {
text-shadow: 0 0 5px transparent;
}
.container.theme-variant-b .clock ul li.point {
text-shadow: 0 0 20px transparent;
}
.container.theme-variant-b .clock {
margin: auto 0 !important;
}
.container.theme-variant-b .clock ul,
.container.theme-variant-b .clock #date {
text-align: left;
}
.container.theme-variant-c .clock {
color: #fffacd;
}
.container.theme-variant-c .clock #date {
text-shadow: 0 0 5px transparent;
}
.container.theme-variant-c .clock ul li {
text-shadow: 0 0 5px transparent;
}
.container.theme-variant-c .clock ul li.point {
text-shadow: 0 0 20px transparent;
}
.container.theme-variant-c .clock {
margin: auto 0 !important;
}
.container.theme-variant-c .clock ul,
.container.theme-variant-c .clock #date {
text-align: left;
}
@keyframes mymove {
0% {
opacity: 1.0;
}
50% {
opacity: 0;
text-shadow: none;
}
100% {
opacity: 1.0;
}
}
@keyframes mymove2 {
0% {
opacity: 1.0;
text-shadow: 0 0 5px #4c7597;
}
100% {
opacity: 0;
text-shadow: none;
}
}
@keyframes mymove3 {
0% {
opacity: 0;
text-shadow: none;
}
100% {
opacity: 1.0;
text-shadow: 0 0 5px #4c7597;
}
}
| {
"content_hash": "a7453f736832140e748015c46b7f1a49",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 127,
"avg_line_length": 20.65986394557823,
"alnum_prop": 0.6624958840961476,
"repo_name": "alni/digital-signage-samples",
"id": "8080e63ff846a1b3a0a1ea8103b87cfb043ce0b9",
"size": "3037",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "css3-digital-clock/styles.css",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "506024"
},
{
"name": "HTML",
"bytes": "283922"
},
{
"name": "JavaScript",
"bytes": "365761"
},
{
"name": "Lua",
"bytes": "5708"
},
{
"name": "PHP",
"bytes": "23313"
}
],
"symlink_target": ""
} |
#pragma once
#include <QtGui/QPolygonF>
#include <QtCore/qglobal.h>
namespace twoDModel {
namespace items {
/// Provides information for physics such as friction, mass, form, etc.
class SolidItem
{
public:
/// static: zero mass, zero velocity, may be manually moved
/// kinematic: zero mass, non-zero velocity set by user
/// dynamic: positive mass, non-zero velocity determined by forces
enum BodyType
{
DYNAMIC,
STATIC,
KINEMATIC
};
virtual ~SolidItem(){}
/// Returns body form as polygon.
virtual QPolygonF collidingPolygon() const = 0;
/// Returns true if body form is circle, in such case, radius is a half of collidingPolygon() bounding rect size
virtual bool isCircle() const;
/// Returns body's mass in kg.
virtual qreal mass() const = 0;
/// Returns body's friction.
virtual qreal friction() const = 0;
/// Returns body's type.
virtual BodyType bodyType() const = 0;
/// Returns body's angular damping.
virtual qreal angularDamping() const;
/// Returns body's linear damping.
virtual qreal linearDamping() const;
};
}
}
| {
"content_hash": "f28536ed84b8ebabc4f71e043fe090c8",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 113,
"avg_line_length": 21,
"alnum_prop": 0.711484593837535,
"repo_name": "qreal/qreal",
"id": "53364c97cd4448b7f204b80d060b02016fb4a1f8",
"size": "1666",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "plugins/robots/common/twoDModel/src/engine/items/solidItem.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "1181"
},
{
"name": "C",
"bytes": "24683"
},
{
"name": "C#",
"bytes": "18292"
},
{
"name": "C++",
"bytes": "7259481"
},
{
"name": "CSS",
"bytes": "13352"
},
{
"name": "Dockerfile",
"bytes": "796"
},
{
"name": "HTML",
"bytes": "322054"
},
{
"name": "IDL",
"bytes": "1050"
},
{
"name": "JavaScript",
"bytes": "11795"
},
{
"name": "Lua",
"bytes": "607"
},
{
"name": "Perl",
"bytes": "15511"
},
{
"name": "Perl 6",
"bytes": "34089"
},
{
"name": "Prolog",
"bytes": "1132"
},
{
"name": "Python",
"bytes": "25813"
},
{
"name": "QMake",
"bytes": "293818"
},
{
"name": "Shell",
"bytes": "109557"
},
{
"name": "Tcl",
"bytes": "21125"
},
{
"name": "Terra",
"bytes": "4206"
},
{
"name": "Turing",
"bytes": "28127"
}
],
"symlink_target": ""
} |
#include "ecma-alloc.h"
#include "ecma-builtins.h"
#include "ecma-conversion.h"
#include "ecma-exceptions.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
#include "ecma-objects.h"
#include "ecma-string-object.h"
#include "jrt.h"
#if ENABLED (JERRY_BUILTIN_ERRORS)
#define ECMA_BUILTINS_INTERNAL
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-evalerror-prototype.inc.h"
#define BUILTIN_UNDERSCORED_ID eval_error_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
#endif /* ENABLED (JERRY_BUILTIN_ERRORS) */
| {
"content_hash": "1aa9dea6cdea65ff14a92308e1373562",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 72,
"avg_line_length": 25.695652173913043,
"alnum_prop": 0.7563451776649747,
"repo_name": "akosthekiss/jerryscript",
"id": "3b28804869b59d35948689f2df0ad1ae8a8de6aa",
"size": "1223",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "jerry-core/ecma/builtin-objects/ecma-builtin-evalerror-prototype.c",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "3218"
},
{
"name": "Batchfile",
"bytes": "2634"
},
{
"name": "C",
"bytes": "4532832"
},
{
"name": "C++",
"bytes": "367565"
},
{
"name": "CMake",
"bytes": "58961"
},
{
"name": "JavaScript",
"bytes": "2360905"
},
{
"name": "Makefile",
"bytes": "12683"
},
{
"name": "Python",
"bytes": "215296"
},
{
"name": "Riot",
"bytes": "2201"
},
{
"name": "Shell",
"bytes": "47305"
},
{
"name": "Tcl",
"bytes": "47435"
}
],
"symlink_target": ""
} |
import copy
import json
import gpxpy.gpx
from django.conf import settings
from django.urls import reverse
from django.utils.translation import get_language, gettext_lazy as _
from drf_dynamic_fields import DynamicFieldsMixin
from mapentity.serializers import GPXSerializer
from rest_framework import serializers
from rest_framework_gis import fields as rest_gis_fields
from rest_framework_gis.serializers import GeoFeatureModelSerializer
from geotrek.altimetry.serializers import AltimetrySerializerMixin
from geotrek.authent.serializers import StructureSerializer
from geotrek.common.serializers import (
PictogramSerializerMixin, ThemeSerializer,
TranslatedModelSerializer, PicturesSerializerMixin,
PublishableSerializerMixin, RecordSourceSerializer,
TargetPortalSerializer, LabelSerializer,
)
from geotrek.trekking import models as trekking_models
from geotrek.zoning.serializers import ZoningSerializerMixin
class TrekGPXSerializer(GPXSerializer):
def end_object(self, trek):
super().end_object(trek)
for poi in trek.published_pois.all():
geom_3d = poi.geom_3d.transform(4326, clone=True) # GPX uses WGS84
wpt = gpxpy.gpx.GPXWaypoint(latitude=geom_3d.y,
longitude=geom_3d.x,
elevation=geom_3d.z)
wpt.name = "%s: %s" % (poi.type, poi.name)
wpt.description = poi.description
self.gpx.waypoints.append(wpt)
class DifficultyLevelSerializer(PictogramSerializerMixin, TranslatedModelSerializer):
label = serializers.ReadOnlyField(source='difficulty')
class Meta:
model = trekking_models.DifficultyLevel
fields = ('id', 'pictogram', 'label')
class RouteSerializer(PictogramSerializerMixin, TranslatedModelSerializer):
label = serializers.ReadOnlyField(source='route')
class Meta:
model = trekking_models.Route
fields = ('id', 'pictogram', 'label')
class NetworkSerializer(PictogramSerializerMixin, TranslatedModelSerializer):
name = serializers.ReadOnlyField(source='network')
class Meta:
model = trekking_models.Route
fields = ('id', 'pictogram', 'name')
class PracticeSerializer(PictogramSerializerMixin, TranslatedModelSerializer):
label = serializers.ReadOnlyField(source='name')
class Meta:
model = trekking_models.Practice
fields = ('id', 'pictogram', 'label')
class AccessibilitySerializer(PictogramSerializerMixin, TranslatedModelSerializer):
label = serializers.ReadOnlyField(source='name')
class Meta:
model = trekking_models.Accessibility
fields = ('id', 'pictogram', 'label')
class AccessibilityLevelSerializer(TranslatedModelSerializer):
label = serializers.ReadOnlyField(source='name')
class Meta:
model = trekking_models.AccessibilityLevel
fields = ('id', 'label')
class TypeSerializer(PictogramSerializerMixin, TranslatedModelSerializer):
class Meta:
model = trekking_models.Practice
fields = ('id', 'pictogram', 'name')
class WebLinkCategorySerializer(PictogramSerializerMixin, TranslatedModelSerializer):
class Meta:
model = trekking_models.WebLinkCategory
fields = ('id', 'pictogram', 'label')
class WebLinkSerializer(TranslatedModelSerializer):
category = WebLinkCategorySerializer()
class Meta:
model = trekking_models.WebLink
fields = ('id', 'name', 'category', 'url')
class CloseTrekSerializer(TranslatedModelSerializer):
category_id = serializers.ReadOnlyField(source='prefixed_category_id')
class Meta:
model = trekking_models.Trek
fields = ('id', 'category_id')
class RelatedTrekSerializer(TranslatedModelSerializer):
pk = serializers.ReadOnlyField(source='id')
category_slug = serializers.SerializerMethodField()
class Meta:
model = trekking_models.Trek
fields = ('id', 'pk', 'slug', 'name', 'category_slug')
def get_category_slug(self, obj):
if settings.SPLIT_TREKS_CATEGORIES_BY_ITINERANCY and obj.children.exists():
# Translators: This is a slug (without space, accent or special char)
return _('itinerancy')
if settings.SPLIT_TREKS_CATEGORIES_BY_PRACTICE and obj.practice:
return obj.practice.slug
else:
# Translators: This is a slug (without space, accent or special char)
return _('trek')
class TrekRelationshipSerializer(serializers.ModelSerializer):
published = serializers.ReadOnlyField(source='trek_b.published')
trek = RelatedTrekSerializer(source='trek_b')
class Meta:
model = trekking_models.TrekRelationship
fields = ('has_common_departure', 'has_common_edge', 'is_circuit_step',
'trek', 'published')
class TrekSerializer(DynamicFieldsMixin, serializers.ModelSerializer):
length_2d = serializers.ReadOnlyField()
name = serializers.CharField(source='name_display')
difficulty = serializers.SlugRelatedField('difficulty', read_only=True)
practice = serializers.SlugRelatedField('name', read_only=True)
themes = serializers.CharField(source='themes_display')
thumbnail = serializers.CharField(source='thumbnail_display')
structure = serializers.SlugRelatedField('name', read_only=True)
reservation_system = serializers.SlugRelatedField('name', read_only=True)
accessibilities = serializers.CharField(source='accessibilities_display')
portal = serializers.CharField(source='portal_display')
source = serializers.CharField(source='source_display')
class Meta:
model = trekking_models.Trek
fields = "__all__"
class TrekAPISerializer(PublishableSerializerMixin, PicturesSerializerMixin, AltimetrySerializerMixin,
ZoningSerializerMixin, TranslatedModelSerializer):
difficulty = DifficultyLevelSerializer()
route = RouteSerializer()
networks = NetworkSerializer(many=True)
themes = ThemeSerializer(many=True)
practice = PracticeSerializer()
usages = PracticeSerializer(many=True) # Rando v1 compat
accessibilities = AccessibilitySerializer(many=True)
accessibility_level = AccessibilityLevelSerializer()
web_links = WebLinkSerializer(many=True)
labels = LabelSerializer(many=True)
relationships = TrekRelationshipSerializer(many=True, source='published_relationships')
treks = CloseTrekSerializer(many=True, source='published_treks')
source = RecordSourceSerializer(many=True)
portal = TargetPortalSerializer(many=True)
children = serializers.ReadOnlyField(source='children_id')
parents = serializers.ReadOnlyField(source='parents_id')
previous = serializers.ReadOnlyField(source='previous_id')
next = serializers.ReadOnlyField(source='next_id')
reservation_system = serializers.ReadOnlyField(source='reservation_system.name', default="")
# Idea: use rest-framework-gis
parking_location = serializers.SerializerMethodField()
points_reference = serializers.SerializerMethodField()
gpx = serializers.SerializerMethodField('get_gpx_url')
kml = serializers.SerializerMethodField('get_kml_url')
structure = StructureSerializer()
# For consistency with touristic contents
type2 = TypeSerializer(source='accessibilities', many=True)
category = serializers.SerializerMethodField()
# Method called to retrieve relevant pictures based on settings
pictures = serializers.SerializerMethodField()
length = serializers.ReadOnlyField(source='length_2d_m')
def __init__(self, instance=None, *args, **kwargs):
# duplicate each trek for each one of its accessibilities
if instance and hasattr(instance, '__iter__') and settings.SPLIT_TREKS_CATEGORIES_BY_ACCESSIBILITY:
treks = []
for trek in instance:
treks.append(trek)
for accessibility in trek.accessibilities.all():
clone = copy.copy(trek)
clone.accessibility = accessibility
treks.append(clone)
instance = treks
super().__init__(instance, *args, **kwargs)
if settings.SPLIT_TREKS_CATEGORIES_BY_PRACTICE:
del self.fields['practice']
if settings.SPLIT_TREKS_CATEGORIES_BY_ACCESSIBILITY:
del self.fields['type2']
if 'geotrek.tourism' in settings.INSTALLED_APPS:
from geotrek.tourism import serializers as tourism_serializers
self.fields['information_desks'] = tourism_serializers.InformationDeskSerializer(many=True)
self.fields['touristic_contents'] = tourism_serializers.CloseTouristicContentSerializer(many=True, source='published_touristic_contents')
self.fields['touristic_events'] = tourism_serializers.CloseTouristicEventSerializer(many=True, source='published_touristic_events')
if 'geotrek.diving' in settings.INSTALLED_APPS:
from geotrek.diving.serializers import CloseDiveSerializer
self.fields['dives'] = CloseDiveSerializer(many=True, source='published_dives')
class Meta:
model = trekking_models.Trek
id_field = 'id' # By default on this model it's topo_object = OneToOneField(parent_link=True)
fields = (
'id', 'departure', 'arrival', 'duration', 'duration_pretty',
'description', 'description_teaser', 'networks', 'advice', 'gear',
'ambiance', 'difficulty', 'information_desks', 'themes',
'labels', 'practice', 'accessibilities', 'accessibility_level',
'accessibility_signage', 'accessibility_slope', 'accessibility_covering', 'accessibility_exposure',
'accessibility_width', 'accessibility_advice',
'usages', 'access', 'route',
'public_transport', 'advised_parking', 'web_links',
'accessibility_infrastructure', 'parking_location', 'relationships',
'points_reference', 'gpx', 'kml', 'source', 'portal',
'type2', 'category', 'structure', 'treks', 'reservation_id', 'reservation_system',
'children', 'parents', 'previous', 'next', 'ratings', 'ratings_description'
) + AltimetrySerializerMixin.Meta.fields + ZoningSerializerMixin.Meta.fields + \
PublishableSerializerMixin.Meta.fields + PicturesSerializerMixin.Meta.fields
def get_pictures(self, obj):
pictures_list = []
pictures_list.extend(obj.serializable_pictures)
if settings.TREK_WITH_POIS_PICTURES:
for poi in obj.published_pois:
pictures_list.extend(poi.serializable_pictures)
return pictures_list
def get_parking_location(self, obj):
if not obj.parking_location:
return None
point = obj.parking_location.transform(settings.API_SRID, clone=True)
return [round(point.x, 7), round(point.y, 7)]
def get_points_reference(self, obj):
if not obj.points_reference:
return None
geojson = obj.points_reference.transform(settings.API_SRID, clone=True).geojson
return json.loads(geojson)
def get_gpx_url(self, obj):
return reverse('trekking:trek_gpx_detail', kwargs={'lang': get_language(), 'pk': obj.pk, 'slug': obj.slug})
def get_kml_url(self, obj):
return reverse('trekking:trek_kml_detail', kwargs={'lang': get_language(), 'pk': obj.pk, 'slug': obj.slug})
def get_category(self, obj):
if settings.SPLIT_TREKS_CATEGORIES_BY_ITINERANCY and obj.children.exists():
data = {
'id': 'I',
'label': _("Itinerancy"),
'pictogram': '/static/trekking/itinerancy.svg',
# Translators: This is a slug (without space, accent or special char)
'slug': _('itinerancy'),
}
elif settings.SPLIT_TREKS_CATEGORIES_BY_PRACTICE and obj.practice:
data = {
'id': obj.practice.prefixed_id,
'label': obj.practice.name,
'pictogram': obj.practice.get_pictogram_url(),
'slug': obj.practice.slug,
}
else:
data = {
'id': trekking_models.Practice.id_prefix,
'label': _("Hike"),
'pictogram': '/static/trekking/trek.svg',
# Translators: This is a slug (without space, accent or special char)
'slug': _('trek'),
}
if settings.SPLIT_TREKS_CATEGORIES_BY_ITINERANCY and obj.children.exists():
data['order'] = settings.ITINERANCY_CATEGORY_ORDER
elif settings.SPLIT_TREKS_CATEGORIES_BY_PRACTICE:
data['order'] = obj.practice and obj.practice.order
else:
data['order'] = settings.TREK_CATEGORY_ORDER
if not settings.SPLIT_TREKS_CATEGORIES_BY_ACCESSIBILITY:
data['type2_label'] = obj._meta.get_field('accessibilities').verbose_name
return data
class TrekAPIGeojsonSerializer(GeoFeatureModelSerializer, TrekAPISerializer):
# Annotated geom field with API_SRID
api_geom = rest_gis_fields.GeometryField(read_only=True, precision=7)
class Meta(TrekAPISerializer.Meta):
geo_field = 'api_geom'
fields = TrekAPISerializer.Meta.fields + ('api_geom', )
class POITypeSerializer(PictogramSerializerMixin, TranslatedModelSerializer):
class Meta:
model = trekking_models.POIType
fields = ('id', 'pictogram', 'label')
class ClosePOISerializer(TranslatedModelSerializer):
type = POITypeSerializer()
class Meta:
model = trekking_models.Trek
fields = ('id', 'slug', 'name', 'type')
class POISerializer(DynamicFieldsMixin, serializers.ModelSerializer):
name = serializers.CharField(source='name_display')
type = serializers.CharField(source='type_display')
thumbnail = serializers.CharField(source='thumbnail_display')
structure = serializers.SlugRelatedField('name', read_only=True)
class Meta:
model = trekking_models.POI
fields = "__all__"
class POIAPISerializer(PublishableSerializerMixin, PicturesSerializerMixin, ZoningSerializerMixin,
TranslatedModelSerializer):
type = POITypeSerializer()
structure = StructureSerializer()
class Meta:
model = trekking_models.Trek
id_field = 'id' # By default on this model it's topo_object = OneToOneField(parent_link=True)
fields = (
'id', 'description', 'type', 'min_elevation', 'max_elevation', 'structure'
) + ZoningSerializerMixin.Meta.fields + PublishableSerializerMixin.Meta.fields + \
PicturesSerializerMixin.Meta.fields
class POIAPIGeojsonSerializer(GeoFeatureModelSerializer, POIAPISerializer):
# Annotated geom field with API_SRID
api_geom = rest_gis_fields.GeometryField(read_only=True, precision=7)
class Meta(POIAPISerializer.Meta):
geo_field = 'api_geom'
fields = POIAPISerializer.Meta.fields + ('api_geom', )
class ServiceTypeSerializer(PictogramSerializerMixin, TranslatedModelSerializer):
class Meta:
model = trekking_models.ServiceType
fields = ('id', 'pictogram', 'name')
class ServiceSerializer(DynamicFieldsMixin, serializers.ModelSerializer):
name = serializers.CharField(source='name_display')
type = serializers.CharField(source='name_display')
class Meta:
model = trekking_models.Service
fields = "__all__"
class ServiceAPISerializer(serializers.ModelSerializer):
type = ServiceTypeSerializer()
structure = StructureSerializer()
class Meta:
model = trekking_models.Service
id_field = 'id' # By default on this model it's topo_object = OneToOneField(parent_link=True)
fields = ('id', 'type', 'structure')
class ServiceAPIGeojsonSerializer(GeoFeatureModelSerializer, ServiceAPISerializer):
# Annotated geom field with API_SRID
api_geom = rest_gis_fields.GeometryField(read_only=True, precision=7)
class Meta(ServiceAPISerializer.Meta):
geo_field = 'api_geom'
fields = ServiceAPISerializer.Meta.fields + ('api_geom', )
| {
"content_hash": "99f967a18fbf185098e8872abb977ee0",
"timestamp": "",
"source": "github",
"line_count": 402,
"max_line_length": 149,
"avg_line_length": 40.353233830845774,
"alnum_prop": 0.6808654913081001,
"repo_name": "makinacorpus/Geotrek",
"id": "b93be7b4ed18648266c6ef5afc35ed9623eaafe8",
"size": "16222",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "geotrek/trekking/serializers.py",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "CSS",
"bytes": "30638"
},
{
"name": "HTML",
"bytes": "141008"
},
{
"name": "JavaScript",
"bytes": "184508"
},
{
"name": "Makefile",
"bytes": "4170"
},
{
"name": "PLpgSQL",
"bytes": "85546"
},
{
"name": "Python",
"bytes": "2768434"
},
{
"name": "Shell",
"bytes": "18090"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/action_link"
android:icon="@android:drawable/ic_menu_compass"
android:title="@string/link"/>
<item
android:id="@+id/action_new"
android:icon="@android:drawable/ic_menu_save"
android:title="@string/add_new"/>
</menu> | {
"content_hash": "7a2da75e2e05e7d0868c5363c70498f2",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 65,
"avg_line_length": 30.846153846153847,
"alnum_prop": 0.6184538653366584,
"repo_name": "kvnallsn/twinscroll",
"id": "a4e664ff708bedc8f22813f7f6af4795544d0df0",
"size": "401",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/res/menu/speed_dial.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "94328"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>vlsm: Not compatible 👼</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.10.0 / vlsm - 1.0</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
vlsm
<small>
1.0
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-06-08 03:00:16 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-06-08 03:00:16 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.10.0 Formal proof management system
num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.07.1 The OCaml compiler (virtual package)
ocaml-base-compiler 4.07.1 Official release 4.07.1
ocaml-config 1 OCaml Switch Configuration
ocamlfind 1.9.3 A library manager for OCaml
# opam file:
opam-version: "2.0"
maintainer: "palmskog@gmail.com"
homepage: "https://github.com/runtimeverification/vlsm"
dev-repo: "git+https://github.com/runtimeverification/vlsm.git"
bug-reports: "https://github.com/runtimeverification/vlsm/issues"
license: "BSD-3-Clause"
synopsis: "Coq formalization of validating labelled state transition and message production systems"
description: """
A validating labelled state transition and message production system
(VLSM) abstractly models a distributed system with faults. This project
contains a formalization of VLSMs and their theory in the Coq proof assistant."""
build: [make "-j%{jobs}%"]
install: [make "install"]
depends: [
"coq" {>= "8.13" & < "8.14~"}
"coq-stdpp" {= "1.5.0"}
]
tags: [
"category:Computer Science/Concurrent Systems and Protocols/Theory of concurrent systems"
"keyword:fault tolerance"
"keyword:distributed algorithms"
"logpath:VLSM"
"date:2021-12-23"
]
authors: [
"Mihai Calancea"
"Denisa Diaconescu"
"Wojciech Kołowski"
"Elaine Li"
"Brandon Moore"
"Karl Palmskog"
"Lucas Peña"
"Grigore Roșu"
"Traian Șerbănuță"
"Jan Tušil"
"Vlad Zamfir"
]
url {
src: "https://github.com/runtimeverification/vlsm/archive/v1.0.tar.gz"
checksum: "sha512=9bfcc12a4aeba66d23daa8783c28d575d135dbeb4956229df187a58f005594106f45920ee474fff4375a9e59fb11c9cf42958808b45ede97d80c67f0027b162b"
}
</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-vlsm.1.0 coq.8.10.0</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.10.0).
The following dependencies couldn't be met:
- coq-vlsm -> coq >= 8.13
Your request can't be satisfied:
- No available version of coq satisfies the constraints
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-vlsm.1.0</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://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>
| {
"content_hash": "220df57dcf911e15af414aef0f2603aa",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 159,
"avg_line_length": 40.21666666666667,
"alnum_prop": 0.5611272275176129,
"repo_name": "coq-bench/coq-bench.github.io",
"id": "2eb3e846327c88505d74f9404cba827b2510e285",
"size": "7272",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clean/Linux-x86_64-4.07.1-2.0.6/released/8.10.0/vlsm/1.0.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
#import <iLifeSlideshow/MPAnimationKeyframeVector.h>
@interface MPAnimationKeyframeVector (Private)
- (id)keyframe;
@end
| {
"content_hash": "09cc01bdc75f322663fb3d754d4a88aa",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 52,
"avg_line_length": 15.625,
"alnum_prop": 0.8,
"repo_name": "matthewsot/CocoaSharp",
"id": "6377d74720a9548e7d46a070c4b658fbe908cde9",
"size": "265",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Headers/PrivateFrameworks/iLifeSlideshow/MPAnimationKeyframeVector-Private.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "259784"
},
{
"name": "C#",
"bytes": "2789005"
},
{
"name": "C++",
"bytes": "252504"
},
{
"name": "Objective-C",
"bytes": "24301417"
},
{
"name": "Smalltalk",
"bytes": "167909"
}
],
"symlink_target": ""
} |
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using Newtonsoft.Json;
namespace Backlog4net
{
/// <summary>
/// Backlog change data.
/// </summary>
public interface Change
{
string Field { get; }
string NewValue { get; }
string OldValue { get; }
string Type { get; }
}
}
| {
"content_hash": "911391f02d2f11ef3686bf39dcd2558b",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 33,
"avg_line_length": 16.863636363636363,
"alnum_prop": 0.5983827493261455,
"repo_name": "ats124/backlog4net",
"id": "e5a366c0c1e64a23ff8971d3ab3156cc868cea28",
"size": "373",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Backlog4net/Change.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "556452"
},
{
"name": "PowerShell",
"bytes": "198"
}
],
"symlink_target": ""
} |
echo "Preparing system for user $USER"
echo "Run this command for all users (including root)!"
echo "Setup Byobu\n"
byobu-ctrl-a screen
echo "Install ~/.zshrc"
cp ../dotfiles/zshrc ~/.zshrc
echo "Install ~/.profile"
cp ../dotfiles/profile ~/.profile
echo "Install ~/.vimrc"
cp ../dotfiles/vimrc ~/.vimrc
echo "Install ~/.gitconfig"
cp ../dotfiles/gitconfig ~/.gitconfig
echo "Create essential directories"
mkdir -p $HOME/Documents/workspace $HOME/Documents/vault $HOME/Documents/appdata $HOME/bin $HOME/go
echo "If you want to change shell from $SHELL to zsh, run 'chsh -s /usr/bin/zsh'"
echo "Add user to various groups"
sudo gpasswd -a $USER vboxusers
sudo gpasswd -a $USER audio
sudo gpasswd -a $USER realtime
sudo gpasswd -a $USER docker
sudo gpasswd -a $USER uucp
sudo gpasswd -a $USER adbusers
sudo gpasswd -a $USER bumblebee
echo "Enable bumblebee if installed, for nvidia power management"
sudo systemctl enable bumblebee
| {
"content_hash": "94666ee33920374c92bf9ccc7894106e",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 99,
"avg_line_length": 30.193548387096776,
"alnum_prop": 0.7478632478632479,
"repo_name": "mahtuag/DistroSetup",
"id": "e330e18062b5fe27061c34a1042960cd16609b90",
"size": "947",
"binary": false,
"copies": "1",
"ref": "refs/heads/trunk",
"path": "DistroAgnostic/user-setup.sh",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "Ruby",
"bytes": "9638"
},
{
"name": "Shell",
"bytes": "25890"
},
{
"name": "Vim script",
"bytes": "2513"
}
],
"symlink_target": ""
} |
<?php
namespace PayPal;
use PayPal\AbstractResponseType;
class DoExpressCheckoutPaymentResponseType extends AbstractResponseType
{
/**
*
* @access public
* @namespace ebl
* @var DoExpressCheckoutPaymentResponseDetailsType
*/
public $DoExpressCheckoutPaymentResponseDetails;
/**
*
* @access public
* @namespace ns
* @var FMFDetailsType
*/
public $FMFDetails;
} | {
"content_hash": "0be8f24a29fee230ab0224f7a74ad346",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 74,
"avg_line_length": 13.96774193548387,
"alnum_prop": 0.6605080831408776,
"repo_name": "olegkaliuga/yii",
"id": "89911b4b961b344f4ed2f23e9e124117d44ca088",
"size": "433",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "vendor/paypal/work/merchant-sdk-php/lib/services/PayPalAPIInterfaceService/DoExpressCheckoutPaymentResponseType.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "254409"
},
{
"name": "JavaScript",
"bytes": "1565404"
},
{
"name": "PHP",
"bytes": "411626"
},
{
"name": "Shell",
"bytes": "2072"
}
],
"symlink_target": ""
} |
require "test_helper"
class UpdateVersionsFileTest < ActiveSupport::TestCase
setup do
@tmp_versions_file = Tempfile.new("tmp_versions_file")
tmp_path = @tmp_versions_file.path
Rails.application.config.rubygems.stubs(:[]).with("versions_file_location").returns(tmp_path)
Gemcutter::Application.load_tasks
end
def update_versions_file
freeze_time do
@created_at = Time.now.utc.iso8601
Rake::Task["compact_index:update_versions_file"].invoke
end
end
teardown do
Rake::Task["compact_index:update_versions_file"].reenable
@tmp_versions_file.unlink
end
context "file header" do
setup do
update_versions_file
end
should "use today's timestamp as header" do
expected_header = "created_at: #{@created_at}\n---\n"
assert_equal expected_header, @tmp_versions_file.read
end
end
context "single gem" do
setup { @rubygem = create(:rubygem, name: "rubyrubyruby") }
context "platform release" do
setup do
create(:version,
rubygem: @rubygem,
created_at: 2.minutes.ago,
number: "0.0.1",
info_checksum: "13q4e1")
create(:version,
rubygem: @rubygem,
created_at: 1.minute.ago,
number: "0.0.1",
info_checksum: "qw212r",
platform: "jruby")
update_versions_file
end
should "include platform release" do
expected_output = "rubyrubyruby 0.0.1,0.0.1-jruby qw212r\n"
assert_equal expected_output, @tmp_versions_file.readlines[2]
end
end
context "order" do
setup do
1.upto(3) do |i|
create(:version,
rubygem: @rubygem,
created_at: i.minutes.ago,
number: "0.0.#{4 - i}",
info_checksum: "13q4e#{i}")
end
update_versions_file
end
should "order by created_at and use last released version's info_checksum" do
expected_output = "rubyrubyruby 0.0.1,0.0.2,0.0.3 13q4e1\n"
assert_equal expected_output, @tmp_versions_file.readlines[2]
end
end
context "yanked version" do
setup do
create(:version,
rubygem: @rubygem,
created_at: 5.minutes.ago,
number: "0.0.1",
info_checksum: "qw212r")
create(:version,
indexed: false,
rubygem: @rubygem,
created_at: 3.minutes.ago,
yanked_at: 1.minute.ago,
number: "0.0.2",
info_checksum: "sd12q",
yanked_info_checksum: "qw212r")
Rake::Task["compact_index:update_versions_file"].invoke
end
should "not include yanked version" do
expected_output = "rubyrubyruby 0.0.1 qw212r\n"
assert_equal expected_output, @tmp_versions_file.readlines[2]
end
end
context "yanked version isn't the latest version" do
setup do
create(:version,
rubygem: @rubygem,
created_at: 5.seconds.ago,
number: "0.1.1",
info_checksum: "zqw212r")
create(:version,
indexed: false,
rubygem: @rubygem,
created_at: 4.seconds.ago,
yanked_at: 2.seconds.ago,
number: "0.1.2",
info_checksum: "zsd12q",
yanked_info_checksum: "zab45d")
create(:version,
rubygem: @rubygem,
created_at: 3.seconds.ago,
number: "0.1.3",
info_checksum: "zrt13y")
update_versions_file
end
should "not include yanked version" do
expected_output = "rubyrubyruby 0.1.1,0.1.3 zab45d\n"
assert_equal expected_output, @tmp_versions_file.readlines[2]
end
end
context "no public versions" do
setup do
create(:version,
indexed: false,
rubygem: @rubygem,
created_at: 4.seconds.ago,
yanked_at: 2.seconds.ago,
number: "0.1.2",
info_checksum: "zsd12q",
yanked_info_checksum: "zab45d")
update_versions_file
end
should "not include yanked version" do
refute_includes "rubyrubyruby", @tmp_versions_file.read
end
end
end
context "multiple gems" do
setup do
3.times do |i|
create(:rubygem, name: "rubygem#{i}").tap do |gem|
create(:version, rubygem: gem, created_at: 4.seconds.ago, number: "0.0.1", info_checksum: "13q4e#{i}")
end
end
update_versions_file
end
should "put each gem on new line" do
expected_output = <<~VERSIONS_FILE
created_at: #{@created_at}
---
rubygem0 0.0.1 13q4e0
rubygem1 0.0.1 13q4e1
rubygem2 0.0.1 13q4e2
VERSIONS_FILE
assert_equal expected_output, @tmp_versions_file.read
end
end
end
| {
"content_hash": "9d75b4f01d57b406ed5317dbf7507eae",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 112,
"avg_line_length": 28.68,
"alnum_prop": 0.5544929268778641,
"repo_name": "rubygems/rubygems.org",
"id": "0a282006a4099f21b1de9d79b8aab55f9873ebf6",
"size": "5019",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/unit/update_versions_file_test.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "69876"
},
{
"name": "Dockerfile",
"bytes": "1399"
},
{
"name": "HTML",
"bytes": "242010"
},
{
"name": "JavaScript",
"bytes": "13293"
},
{
"name": "Ruby",
"bytes": "1049068"
},
{
"name": "Shell",
"bytes": "6621"
}
],
"symlink_target": ""
} |
// flow-typed signature: 0600efdac76b8dd304304d35799abfe9
// flow-typed version: <<STUB>>/body-parser_v^1.15.2/flow_v0.33.0
/**
* This is an autogenerated libdef stub for:
*
* 'body-parser'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'body-parser' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'body-parser/lib/read' {
declare module.exports: any;
}
declare module 'body-parser/lib/types/json' {
declare module.exports: any;
}
declare module 'body-parser/lib/types/raw' {
declare module.exports: any;
}
declare module 'body-parser/lib/types/text' {
declare module.exports: any;
}
declare module 'body-parser/lib/types/urlencoded' {
declare module.exports: any;
}
// Filename aliases
declare module 'body-parser/index' {
declare module.exports: $Exports<'body-parser'>;
}
declare module 'body-parser/index.js' {
declare module.exports: $Exports<'body-parser'>;
}
declare module 'body-parser/lib/read.js' {
declare module.exports: $Exports<'body-parser/lib/read'>;
}
declare module 'body-parser/lib/types/json.js' {
declare module.exports: $Exports<'body-parser/lib/types/json'>;
}
declare module 'body-parser/lib/types/raw.js' {
declare module.exports: $Exports<'body-parser/lib/types/raw'>;
}
declare module 'body-parser/lib/types/text.js' {
declare module.exports: $Exports<'body-parser/lib/types/text'>;
}
declare module 'body-parser/lib/types/urlencoded.js' {
declare module.exports: $Exports<'body-parser/lib/types/urlencoded'>;
}
| {
"content_hash": "3c6a9baaccb17b63f944ff2678436ed4",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 77,
"avg_line_length": 27.833333333333332,
"alnum_prop": 0.7223734349482852,
"repo_name": "pekkis/react-training-broilerplate",
"id": "5b7172e7b57febee260272c27f809a9c80da4cb1",
"size": "1837",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "flow-typed/npm/body-parser_vx.x.x.js",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "HTML",
"bytes": "1016"
},
{
"name": "JavaScript",
"bytes": "458420"
}
],
"symlink_target": ""
} |
import collections
from importlib import import_module
from threading import current_thread, enumerate as threadingEnumerate, RLock
import Queue
import time
import sys
from bmconfigparser import BMConfigParser
from helper_sql import *
from singleton import Singleton
# TODO make this dynamic, and watch out for frozen, like with messagetypes
import storage.sqlite
import storage.filesystem
@Singleton
class Inventory():
def __init__(self):
#super(self.__class__, self).__init__()
self._moduleName = BMConfigParser().safeGet("inventory", "storage")
#import_module("." + self._moduleName, "storage")
#import_module("storage." + self._moduleName)
self._className = "storage." + self._moduleName + "." + self._moduleName.title() + "Inventory"
self._inventoryClass = eval(self._className)
self._realInventory = self._inventoryClass()
self.numberOfInventoryLookupsPerformed = 0
# cheap inheritance copied from asyncore
def __getattr__(self, attr):
try:
if attr == "__contains__":
self.numberOfInventoryLookupsPerformed += 1
realRet = getattr(self._realInventory, attr)
except AttributeError:
raise AttributeError("%s instance has no attribute '%s'" %(self.__class__.__name__, attr))
else:
return realRet
class PendingDownloadQueue(Queue.Queue):
# keep a track of objects that have been advertised to us but we haven't downloaded them yet
maxWait = 300
def __init__(self, maxsize=0):
Queue.Queue.__init__(self, maxsize)
self.stopped = False
self.pending = {}
self.lock = RLock()
def task_done(self, hashId):
Queue.Queue.task_done(self)
try:
with self.lock:
del self.pending[hashId]
except KeyError:
pass
def get(self, block=True, timeout=None):
retval = Queue.Queue.get(self, block, timeout)
# no exception was raised
if not self.stopped:
with self.lock:
self.pending[retval] = time.time()
return retval
def clear(self):
with self.lock:
newPending = {}
for hashId in self.pending:
if self.pending[hashId] + PendingDownloadQueue.maxWait > time.time():
newPending[hashId] = self.pending[hashId]
self.pending = newPending
@staticmethod
def totalSize():
size = 0
for thread in threadingEnumerate():
if thread.isAlive() and hasattr(thread, 'downloadQueue'):
size += thread.downloadQueue.qsize() + len(thread.downloadQueue.pending)
return size
@staticmethod
def stop():
for thread in threadingEnumerate():
if thread.isAlive() and hasattr(thread, 'downloadQueue'):
thread.downloadQueue.stopped = True
with thread.downloadQueue.lock:
thread.downloadQueue.pending = {}
class PendingUploadDeadlineException(Exception):
pass
@Singleton
class PendingUpload(object):
# keep a track of objects that we have created but haven't distributed yet
def __init__(self):
super(self.__class__, self).__init__()
self.lock = RLock()
self.hashes = {}
# end by this time in any case
self.deadline = 0
self.maxLen = 0
# during shutdown, wait up to 20 seconds to finish uploading
self.shutdownWait = 20
# forget tracking objects after 60 seconds
self.objectWait = 60
# wait 10 seconds between clears
self.clearDelay = 10
self.lastCleared = time.time()
def add(self, objectHash = None):
with self.lock:
# add a new object into existing thread lists
if objectHash:
if objectHash not in self.hashes:
self.hashes[objectHash] = {'created': time.time(), 'sendCount': 0, 'peers': []}
for thread in threadingEnumerate():
if thread.isAlive() and hasattr(thread, 'peer') and \
thread.peer not in self.hashes[objectHash]['peers']:
self.hashes[objectHash]['peers'].append(thread.peer)
# add all objects into the current thread
else:
for objectHash in self.hashes:
if current_thread().peer not in self.hashes[objectHash]['peers']:
self.hashes[objectHash]['peers'].append(current_thread().peer)
def len(self):
self.clearHashes()
with self.lock:
return sum(1
for x in self.hashes if (self.hashes[x]['created'] + self.objectWait < time.time() or
self.hashes[x]['sendCount'] == 0))
def _progress(self):
with self.lock:
return float(sum(len(self.hashes[x]['peers'])
for x in self.hashes if (self.hashes[x]['created'] + self.objectWait < time.time()) or
self.hashes[x]['sendCount'] == 0))
def progress(self, raiseDeadline=True):
if self.maxLen < self._progress():
self.maxLen = self._progress()
if self.deadline < time.time():
if self.deadline > 0 and raiseDeadline:
raise PendingUploadDeadlineException
self.deadline = time.time() + 20
try:
return 1.0 - self._progress() / self.maxLen
except ZeroDivisionError:
return 1.0
def clearHashes(self, objectHash=None):
if objectHash is None:
if self.lastCleared > time.time() - self.clearDelay:
return
objects = self.hashes.keys()
else:
objects = objectHash,
with self.lock:
for i in objects:
try:
if self.hashes[i]['sendCount'] > 0 and (
len(self.hashes[i]['peers']) == 0 or
self.hashes[i]['created'] + self.objectWait < time.time()):
del self.hashes[i]
except KeyError:
pass
self.lastCleared = time.time()
def delete(self, objectHash=None):
if not hasattr(current_thread(), 'peer'):
return
if objectHash is None:
return
with self.lock:
try:
if objectHash in self.hashes and current_thread().peer in self.hashes[objectHash]['peers']:
self.hashes[objectHash]['sendCount'] += 1
self.hashes[objectHash]['peers'].remove(current_thread().peer)
except KeyError:
pass
self.clearHashes(objectHash)
def stop(self):
with self.lock:
self.hashes = {}
def threadEnd(self):
with self.lock:
for objectHash in self.hashes:
try:
if current_thread().peer in self.hashes[objectHash]['peers']:
self.hashes[objectHash]['peers'].remove(current_thread().peer)
except KeyError:
pass
self.clearHashes()
| {
"content_hash": "56e2e4510a0a037cacf1885562716745",
"timestamp": "",
"source": "github",
"line_count": 198,
"max_line_length": 107,
"avg_line_length": 36.37373737373738,
"alnum_prop": 0.5690086087198001,
"repo_name": "hb9kns/PyBitmessage",
"id": "598021fb87dc133a13c71458ab363893013d1666",
"size": "7202",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/inventory.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "7456"
},
{
"name": "C++",
"bytes": "4482"
},
{
"name": "Makefile",
"bytes": "4328"
},
{
"name": "Python",
"bytes": "1520489"
},
{
"name": "QMake",
"bytes": "2129"
},
{
"name": "Shell",
"bytes": "14891"
}
],
"symlink_target": ""
} |
//
// (C) Copyright 1998-1999 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
//
#ifndef ARXDBG_ARXDBGAPPEDREACTOR_H
#define ARXDBG_ARXDBGAPPEDREACTOR_H
#include "ArxDbgCloneSet.h"
/****************************************************************************
**
** CLASS ArxDbgAppEditorReactor:
** needed for our app itself to track when databases are constructed,
** or destructed so we can put our db reactor on it.
**
** **jma
**
*************************************/
class ArxDbgAppEditorReactor : public AcEditorReactor {
public:
ACRX_DECLARE_MEMBERS(ArxDbgAppEditorReactor);
// messages that are sent by notification
virtual void databaseConstructed(AcDbDatabase*);
virtual void databaseToBeDestroyed(AcDbDatabase* pDwg);
virtual void endDeepClone(AcDbIdMapping& idMap);
virtual void beginDeepCloneXlation(AcDbIdMapping& pIdMap, Acad::ErrorStatus* pRetStatus);
// used by our test function to add extra objects to the cloneSet of things
// to be included in Wblock.
ArxDbgCloneSet& cloneSet() { return m_cloneSet; }
private:
// singleton class, so no one can call constructor/destructors
ArxDbgAppEditorReactor();
virtual ~ArxDbgAppEditorReactor();
// data members
ArxDbgCloneSet m_cloneSet;
AcDbObjectIdArray m_didTheseDicts;
// helper functions
void insertCloneOwnerDict(const AcDbObjectId& dictId, AcDbDatabase* destDb,
AcDbIdMapping& idMap);
void insertCloneMergeDicts(AcDbDictionary* srcDict, AcDbDictionary* destDict,
AcDbIdMapping& idMap);
void collectAllDictRecords(AcDbDatabase* db, AcDbObjectIdArray& objIds);
void searchOneDictionary(AcDbDictionary* dict, AcDbObjectIdArray& objIds);
void verifyClonedReferences(AcDbIdMapping& idMap);
// outlawed functions
ArxDbgAppEditorReactor(const& ArxDbgAppEditorReactor);
ArxDbgAppEditorReactor& operator=(const& ArxDbgAppEditorReactor);
// static functions for constructing/retrieving/destroying singleton instance
public:
static ArxDbgAppEditorReactor* getInstance();
static void destroyInstance();
private:
static ArxDbgAppEditorReactor* m_instance; // singleton instance
};
#endif // ARXDBG_ARXDBGAPPEDREACTOR_H
| {
"content_hash": "8bb41907212217d3727ee598829f5810",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 96,
"avg_line_length": 37.455555555555556,
"alnum_prop": 0.6710175022248591,
"repo_name": "kevinzhwl/ObjectARXMod",
"id": "19e37340e3fc0c2b5509b5f4e7bcc20fc0329fd9",
"size": "3371",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "2002/samples/ARXDBG/Inc/ArxDbgAppEditorReactor.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "816282"
},
{
"name": "C++",
"bytes": "6318358"
},
{
"name": "Common Lisp",
"bytes": "2377"
},
{
"name": "Objective-C",
"bytes": "72642"
},
{
"name": "Shell",
"bytes": "1719"
},
{
"name": "TeX",
"bytes": "65038"
}
],
"symlink_target": ""
} |
'use strict';
// Comercios controller
angular.module('comercios').controller('ComerciosController', ['$scope', '$stateParams', '$location', '$window', '$timeout', '$interval', '$uibModal', 'Authentication', 'Comercios', 'FileUploader', 'NgTableParams',
function ($scope, $stateParams, $location, $window, $timeout, $interval, $uibModal, Authentication, Comercios, FileUploader, NgTableParams) {
$scope.authentication = Authentication;
$scope.UrlImageComercio = '';
$scope.UrlImageLogo = '';
$scope.preview = {
UrlImageComercio: '',
UrlImageLogo: ''
};
$scope.ImagenesBanners = [];
$scope.EnvioADomicilio = false;
$scope.Tarjetas = [
{
NombreTarjeta: 'Visa',
Descripcion: 'Hasta 3 cuotas sin interés',
Acepta: false
},
{
NombreTarjeta: 'MasterCard',
Descripcion: 'Hasta 3 cuotas sin interés',
Acepta: false
},
{
NombreTarjeta: 'Naranja',
Descripcion: 'Hasta 3 cuotas sin interés',
Acepta: false
}
];
$scope.Horarios =
{
LunesViernes: {
Cortado: false,
DM: new Date(0, 0, 0, 9, 0, 0, 0),
DT: new Date(0, 0, 0, 9, 0, 0, 0),
HM: new Date(0, 0, 0, 19, 0, 0, 0),
HT: new Date(0, 0, 0, 19, 0, 0, 0)
},
Sabado: {
Cortado: false,
DM: new Date(0, 0, 0, 9, 0, 0, 0),
DT: new Date(0, 0, 0, 9, 0, 0, 0),
HM: new Date(0, 0, 0, 19, 0, 0, 0),
HT: new Date(0, 0, 0, 19, 0, 0, 0)
},
DomingoFeriado: {
Cortado: false,
DM: new Date(0, 0, 0, 9, 0, 0, 0),
DT: new Date(0, 0, 0, 9, 0, 0, 0),
HM: new Date(0, 0, 0, 19, 0, 0, 0),
HT: new Date(0, 0, 0, 19, 0, 0, 0)
}
};
$scope.isRol = function(rol) {
var roles = $scope.authentication.user.roles;
var isRol = false;
for (var i in roles) {
if (roles[i] === rol) {
isRol = true;
}
}
return isRol;
};
if($scope.isRol('dev')){
$scope.Telefono = '3513098679';
$scope.Web = 'http://52.36.173.82/';
$scope.NombreComercio = 'TEST';
$scope.Slogan = 'TEST';
$scope.Email = 'TEST@TEST';
$scope.Facebook = 'http://52.36.173.82/';
$scope.Twitter = 'http://52.36.173.82/';
$scope.Instagram = 'http://52.36.173.82/';
$scope.Direccion = 'TEST';
}
$scope.changeCheck = function(item){
if(item.Cortado){
item.DM = new Date(0, 0, 0, 9, 0, 0, 0);
item.DT = new Date(0, 0, 0, 16, 0, 0, 0);
item.HM = new Date(0, 0, 0, 13, 0, 0, 0);
item.HT = new Date(0, 0, 0, 22, 0, 0, 0);
}
else{
item.DM = new Date(0, 0, 0, 9, 0, 0, 0);
item.DT = new Date(0, 0, 0, 9, 0, 0, 0);
item.HM = new Date(0, 0, 0, 19, 0, 0, 0);
item.HT = new Date(0, 0, 0, 19, 0, 0, 0);
}
};
// Create new Comercio
$scope.create = function (isValid) {
$scope.error = null;
if (!isValid) {
$scope.$broadcast('show-errors-check-validity', 'comercioForm');
return false;
}
var Tarjetas = [];
for (var i = this.Tarjetas.length - 1; i >= 0; i--) {
if(this.Tarjetas[i].Acepta)
Tarjetas.push({
NombreTarjeta: this.Tarjetas[i].NombreTarjeta,
Descripcion: this.Tarjetas[i].Descripcion
});
}
// Create new Comercio object
var comercio = new Comercios({
// IdComercio: this.IdComercio,
NombreComercio: this.NombreComercio,
UbicacionLat: this.UbicacionLat,
UbicacionLon: this.UbicacionLon,
UrlImageComercio: this.preview.UrlImageComercio,
UrlImageLogo: this.preview.UrlImageLogo,
ImagenesBanners: this.ImagenesBanners,
Slogan: this.Slogan,
Email: this.Email,
Web: this.Web,
Facebook: this.Facebook,
Instagram: this.Instagram,
Twitter: this.Twitter,
EnvioADomicilio: this.EnvioADomicilio,
Horarios: {
LunesViernes: this.Horarios.LunesViernes,
Sabado: this.Horarios.Sabado,
DomingoFeriado: this.Horarios.DomingoFeriadoAbierto ? this.DomingoFeriado : null
},
Direccion: this.Direccion,
Telefono: this.Telefono,
Tarjetas: Tarjetas
});
// Redirect after save
comercio.$save(function (response) {
$location.path('comercios/' + response._id);
// Clear form fields
$scope.IdComercio = '';
$scope.content = '';
}, function (errorResponse) {
$scope.error = errorResponse.data.message;
});
};
// Remove existing Comercio
$scope.remove = function (comercio) {
if (comercio) {
comercio.$remove();
for (var i in $scope.comercios) {
if ($scope.comercios[i] === comercio) {
$scope.comercios.splice(i, 1);
}
}
} else {
$scope.comercio.$remove(function () {
$location.path('comercios');
});
}
};
// Update existing Comercio
$scope.update = function (isValid) {
$scope.error = null;
if (!isValid) {
$scope.$broadcast('show-errors-check-validity', 'comercioForm');
return false;
}
var comercio = new Comercios({
_id: $stateParams.IdComercio,
NombreComercio: this.comercio.NombreComercio,
UbicacionLat: this.comercio.UbicacionLat,
UbicacionLon: this.comercio.UbicacionLon,
UrlImageComercio: this.preview.UrlImageComercio,
UrlImageLogo: this.preview.UrlImageLogo,
ImagenesBanners: this.ImagenesBanners,
Slogan: this.comercio.Slogan,
Email: this.comercio.Email,
Web: this.comercio.Web,
Facebook: this.comercio.Facebook,
Instagram: this.comercio.Instagram,
Twitter: this.comercio.Twitter,
EnvioADomicilio: this.comercio.EnvioADomicilio,
Horarios: {
LunesViernes: this.comercio.Horarios.LunesViernes,
Sabado: this.comercio.Horarios.Sabado,
DomingoFeriado: this.DomingoFeriadoAbierto ? this.comercio.Horarios.DomingoFeriado : null
},
Direccion: this.comercio.Direccion,
Telefono: this.comercio.Telefono,
Tarjetas: this.comercio.Tarjeta
});
comercio.$update(function (response) {
$location.path('comercios/' + comercio._id);
}, function (errorResponse) {
$scope.error = errorResponse.data.message;
});
};
// Find a list of Comercios
$scope.find = function () {
$scope.comercios = Comercios.query();
};
// Find existing Comercio
$scope.findOne = function () {
$scope.comercio = Comercios.get({
IdComercio: $stateParams.IdComercio,
bo: true
},function(){
$scope.preview.UrlImageLogo = $scope.comercio.UrlImageLogo;
$scope.preview.UrlImageComercio = $scope.comercio.UrlImageComercio;
$scope.DomingoFeriadoAbierto = $scope.comercio.Horarios.DomingoFeriado.DM !== undefined;
$scope.tableParams = new NgTableParams({
count:10,
sorting: { NombreProducto: 'asc' }
}, { data: $scope.comercio.Productos });
});
};
var modalInstance;
$scope.modalProgress = function() {
modalInstance = $uibModal.open({
animation: true,
templateUrl: '/modules/core/client/views/templates/modal-progress.client.view.html',
controller: 'ModalProgressController',
scope: $scope
});
};
$scope.uploader = new FileUploader({
url: 'api/files/upload'
});
$scope.uploader.filters.push({
name: 'imageFilter',
fn: function (item, options) {
var type = '|' + item.type.slice(item.type.lastIndexOf('/') + 1) + '|';
return '|jpg|png|jpeg|bmp|gif|'.indexOf(type) !== -1;
}
});
$scope.uploader.onAfterAddingFile = function (fileItem) {
if ($window.FileReader) {
var fileReader = new FileReader();
fileReader.readAsDataURL(fileItem._file);
fileReader.onload = function (fileReaderEvent) {
$timeout(function () {
if($scope.comercio)
$scope.comercio.UrlImageComercio = fileReaderEvent.target.result;
else
$scope.UrlImageComercio = fileReaderEvent.target.result;
}, 0);
};
}
};
$scope.uploader.onSuccessItem = function (fileItem, response, status, headers) {
$scope.success = "La imagen del comercio se cargó correctamente";
$scope.UrlImageComercio = '';
$scope.preview.UrlImageComercio = response.url;
$scope.uploader.clearQueue();
};
$scope.uploader.onErrorItem = function (fileItem, response, status, headers) {
$scope.cancelUpload();
$scope.error = response.message;
};
$scope.uploadProfilePicture = function () {
$scope.success = $scope.error = null;
$scope.uploader.uploadAll();
};
$scope.cancelUpload = function () {
$scope.uploader.clearQueue();
};
$scope.uploaderLogo = new FileUploader({
url: 'api/files/upload'
});
$scope.uploaderLogo.filters.push({
name: 'imageFilter',
fn: function (item, options) {
var type = '|' + item.type.slice(item.type.lastIndexOf('/') + 1) + '|';
return '|jpg|png|jpeg|bmp|gif|'.indexOf(type) !== -1;
}
});
$scope.uploaderLogo.onAfterAddingFile = function (fileItem) {
if ($window.FileReader) {
var fileReader = new FileReader();
fileReader.readAsDataURL(fileItem._file);
fileReader.onload = function (fileReaderEvent) {
$timeout(function () {
if($scope.comercio)
$scope.comercio.UrlImageLogo = fileReaderEvent.target.result;
else
$scope.UrlImageLogo = fileReaderEvent.target.result;
}, 0);
};
}
};
$scope.uploaderLogo.onSuccessItem = function (fileItem, response, status, headers) {
$scope.success = "La imagen del logo se cargó correctamente";
$scope.UrlImageComercio = '';
$scope.preview.UrlImageLogo = response.url;
$scope.uploaderLogo.clearQueue();
};
$scope.uploaderLogo.onErrorItem = function (fileItem, response, status, headers) {
$scope.cancelUploadLogo();
$scope.error = response.message;
};
$scope.uploadLogo = function () {
$scope.success = $scope.error = null;
$scope.uploaderLogo.uploadAll();
};
$scope.cancelUploadLogo = function () {
$scope.uploaderLogo.clearQueue();
};
var banners = $scope.banners = new FileUploader({
url: '/api/files/upload'
});
banners.filters.push({
name: 'customFilter',
fn: function(item, options) {
return this.queue.length < 10;
}
});
banners.onWhenAddingFileFailed = function(item, filter, options) {
console.info('onWhenAddingFileFailed', item, filter, options);
};
banners.onErrorItem = function(fileItem, response, status, headers) {
console.info('onErrorItem', fileItem, response, status, headers);
};
banners.onAfterAddingAll = function(files) {
banners.uploadAll();
var stop;
if (angular.isDefined(stop)) return;
stop = $interval(function() {
if ($scope.banners.queue.length > 0) {
$interval.cancel(stop);
$scope.modalProgress();
}
}, 100);
};
banners.onCompleteAll = function() {
$scope.banners.queue.ready = true;
};
banners.onCompleteItem = function(fileItem, response, status, headers) {
if (status > 0) {
var file = fileItem._file.name.replace(/"/g, '');
console.log('asdasd');
$scope.ImagenesBanners.push({Image:response.url,Url: ''});
}
};
}
]);
| {
"content_hash": "a506ca0fd73fc70726488be9eb658e55",
"timestamp": "",
"source": "github",
"line_count": 379,
"max_line_length": 214,
"avg_line_length": 31.654353562005277,
"alnum_prop": 0.5712261398683004,
"repo_name": "matamuchastegui/WebService",
"id": "12a4a58639513cd8ca6d5c7772fb337d6c3fc284",
"size": "12002",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "modules/comercios/client/controllers/comercios.client.controller.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1472"
},
{
"name": "HTML",
"bytes": "41695"
},
{
"name": "JavaScript",
"bytes": "240473"
},
{
"name": "Shell",
"bytes": "685"
}
],
"symlink_target": ""
} |
package Parking;
/**
*Classe de test de la classe Parking
*/
public class TestParking {
public static void main(String[] args) {
//Instanciations
Voiture clio = new Voiture("Renault", "Clio", 120);
Voiture ferrari = new Voiture("Ferrari", "F1", 360);
Parking p = new Parking();
//Test de toString()
System.out.println(p.toString());
//Test de garer()
//Fonctionnement normal
try {
p.garer(clio, 0);
}
catch (ExceptionParking e) {
System.out.println(e.getMessage());
}
finally {
System.out.println(p.toString());
}
//Deuxieme voiture garee
try {
p.garer(ferrari, 1);
}
catch (ExceptionParking e) {
System.out.println(e.getMessage());
}
finally {
System.out.println(p.toString());
}
}
}
| {
"content_hash": "a39131d8eabd6e9b54b2810e52061860",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 54,
"avg_line_length": 17.41860465116279,
"alnum_prop": 0.6421895861148198,
"repo_name": "tompo-andri/IUT",
"id": "b77c8e38ecaeedf28a363c90cc07392338db0978",
"size": "749",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "First Year (2012-2013)/AP4/src/TestParking.java",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "1007195"
},
{
"name": "C++",
"bytes": "246911"
},
{
"name": "CSS",
"bytes": "2605"
},
{
"name": "HTML",
"bytes": "5411"
},
{
"name": "Java",
"bytes": "408442"
},
{
"name": "Makefile",
"bytes": "12801"
},
{
"name": "PHP",
"bytes": "70385"
},
{
"name": "Shell",
"bytes": "258"
}
],
"symlink_target": ""
} |
<component name="libraryTable">
<library name="play-services-base-9.0.2">
<CLASSES>
<root url="file://$PROJECT_DIR$/Xerung/build/intermediates/exploded-aar/com.google.android.gms/play-services-base/9.0.2/res" />
<root url="jar://$PROJECT_DIR$/Xerung/build/intermediates/exploded-aar/com.google.android.gms/play-services-base/9.0.2/jars/classes.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component> | {
"content_hash": "103ced952cefa6133a51a97ea010a978",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 147,
"avg_line_length": 44.4,
"alnum_prop": 0.6824324324324325,
"repo_name": "mityung/XERUNG",
"id": "0be1c5b1bc6bff9be91668968631465e9cb599a8",
"size": "444",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Andriod/Xerung/.idea/libraries/play_services_base_9_0_2.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "8096"
},
{
"name": "Java",
"bytes": "6716898"
},
{
"name": "Objective-C",
"bytes": "239054"
},
{
"name": "Ruby",
"bytes": "302"
},
{
"name": "Shell",
"bytes": "8796"
},
{
"name": "Swift",
"bytes": "504009"
}
],
"symlink_target": ""
} |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("File Renamer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("File Renamer")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("183b25d8-671c-4ddc-937e-b840c1efb57e")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| {
"content_hash": "f27754820ead18fd9c27442ed320d409",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 84,
"avg_line_length": 39.30555555555556,
"alnum_prop": 0.7469964664310954,
"repo_name": "Havodion/NewMeta",
"id": "fe3bbdc048492b39766783d52c5345382203745e",
"size": "1418",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "File Renamer/Properties/AssemblyInfo.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "12426"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="lang:clipboard.copy" content="Copy to clipboard">
<meta name="lang:clipboard.copied" content="Copied to clipboard">
<meta name="lang:search.language" content="en">
<meta name="lang:search.pipeline.stopwords" content="True">
<meta name="lang:search.pipeline.trimmer" content="True">
<meta name="lang:search.result.none" content="No matching documents">
<meta name="lang:search.result.one" content="1 matching document">
<meta name="lang:search.result.other" content="# matching documents">
<meta name="lang:search.tokenizer" content="[\s\-]+">
<link href="https://fonts.gstatic.com/" rel="preconnect" crossorigin>
<link href="https://fonts.googleapis.com/css?family=Roboto+Mono:400,500,700|Roboto:300,400,400i,700&display=fallback" rel="stylesheet">
<style>
body,
input {
font-family: "Roboto", "Helvetica Neue", Helvetica, Arial, sans-serif
}
code,
kbd,
pre {
font-family: "Roboto Mono", "Courier New", Courier, monospace
}
</style>
<link rel="stylesheet" href="../_static/stylesheets/application.css"/>
<link rel="stylesheet" href="../_static/stylesheets/application-palette.css"/>
<link rel="stylesheet" href="../_static/stylesheets/application-fixes.css"/>
<link rel="stylesheet" href="../_static/fonts/material-icons.css"/>
<meta name="theme-color" content="#3f51b5">
<script src="../_static/javascripts/modernizr.js"></script>
<title>statsmodels.sandbox.distributions.extras.NormExpan_gen.random_state — statsmodels</title>
<link rel="icon" type="image/png" sizes="32x32" href="../_static/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="../_static/icons/favicon-16x16.png">
<link rel="manifest" href="../_static/icons/site.webmanifest">
<link rel="mask-icon" href="../_static/icons/safari-pinned-tab.svg" color="#919191">
<meta name="msapplication-TileColor" content="#2b5797">
<meta name="msapplication-config" content="../_static/icons/browserconfig.xml">
<link rel="stylesheet" href="../_static/stylesheets/examples.css">
<link rel="stylesheet" href="../_static/material.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="../_static/graphviz.css" />
<script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
<script src="../_static/language_data.js"></script>
<script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script>
<script async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/x-mathjax-config">MathJax.Hub.Config({"tex2jax": {"inlineMath": [["$", "$"], ["\\(", "\\)"]], "processEscapes": true, "ignoreClass": "document", "processClass": "math|output_area"}})</script>
<link rel="shortcut icon" href="../_static/favicon.ico"/>
<link rel="author" title="About these documents" href="../about.html" />
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="statsmodels.sandbox.distributions.extras.mvstdnormcdf" href="statsmodels.sandbox.distributions.extras.mvstdnormcdf.html" />
<link rel="prev" title="statsmodels.sandbox.distributions.extras.NormExpan_gen.var" href="statsmodels.sandbox.distributions.extras.NormExpan_gen.var.html" />
<script src="../_static/javascripts/version_dropdown.js"></script>
<script>
var json_loc = "../_static/versions.json",
target_loc = "../../",
text = "Versions";
$( document ).ready( add_version_dropdown(json_loc, target_loc, text));
</script>
</head>
<body dir=ltr
data-md-color-primary=indigo data-md-color-accent=blue>
<svg class="md-svg">
<defs data-children-count="0">
<svg xmlns="http://www.w3.org/2000/svg" width="416" height="448" viewBox="0 0 416 448" id="__github"><path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19T128 352t-18.125-8.5-10.75-19T96 304t3.125-20.5 10.75-19T128 256t18.125 8.5 10.75 19T160 304zm160 0q0 10-3.125 20.5t-10.75 19T288 352t-18.125-8.5-10.75-19T256 304t3.125-20.5 10.75-19T288 256t18.125 8.5 10.75 19T320 304zm40 0q0-30-17.25-51T296 232q-10.25 0-48.75 5.25Q229.5 240 208 240t-39.25-2.75Q130.75 232 120 232q-29.5 0-46.75 21T56 304q0 22 8 38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0 37.25-1.75t35-7.375 30.5-15 20.25-25.75T360 304zm56-44q0 51.75-15.25 82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5T212 416q-19.5 0-35.5-.75t-36.875-3.125-38.125-7.5-34.25-12.875T37 371.5t-21.5-28.75Q0 312 0 260q0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25 30.875Q171.5 96 212 96q37 0 70 8 26.25-20.5 46.75-30.25T376 64q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34 99.5z"/></svg>
</defs>
</svg>
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search">
<label class="md-overlay" data-md-component="overlay" for="__drawer"></label>
<a href="#generated/statsmodels.sandbox.distributions.extras.NormExpan_gen.random_state" tabindex="1" class="md-skip"> Skip to content </a>
<header class="md-header" data-md-component="header">
<nav class="md-header-nav md-grid">
<div class="md-flex navheader">
<div class="md-flex__cell md-flex__cell--shrink">
<a href="../index.html" title="statsmodels"
class="md-header-nav__button md-logo">
<img src="../_static/statsmodels-logo-v2-bw.svg" height="26"
alt="statsmodels logo">
</a>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label>
</div>
<div class="md-flex__cell md-flex__cell--stretch">
<div class="md-flex__ellipsis md-header-nav__title" data-md-component="title">
<span class="md-header-nav__topic">statsmodels v0.11.1</span>
<span class="md-header-nav__topic"> statsmodels.sandbox.distributions.extras.NormExpan_gen.random_state </span>
</div>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--search md-header-nav__button" for="__search"></label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" action="../search.html" method="GET" name="search">
<input type="text" class="md-search__input" name="q" placeholder="Search"
autocapitalize="off" autocomplete="off" spellcheck="false"
data-md-component="query" data-md-state="active">
<label class="md-icon md-search__icon" for="__search"></label>
<button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">

</button>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" data-md-scrollfix>
<div class="md-search-result" data-md-component="result">
<div class="md-search-result__meta">
Type to start searching
</div>
<ol class="md-search-result__list"></ol>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<div class="md-header-nav__source">
<a href="https://github.com/statsmodels/statsmodels" title="Go to repository" class="md-source" data-md-source="github">
<div class="md-source__icon">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="28" height="28">
<use xlink:href="#__github" width="24" height="24"></use>
</svg>
</div>
<div class="md-source__repository">
statsmodels
</div>
</a>
</div>
</div>
</div>
</nav>
</header>
<div class="md-container">
<nav class="md-tabs" data-md-component="tabs">
<div class="md-tabs__inner md-grid">
<ul class="md-tabs__list">
<li class="md-tabs__item"><a href="../user-guide.html" class="md-tabs__link">User Guide</a></li>
<li class="md-tabs__item"><a href="../distributions.html" class="md-tabs__link">Distributions</a></li>
<li class="md-tabs__item"><a href="statsmodels.sandbox.distributions.extras.NormExpan_gen.html" class="md-tabs__link">statsmodels.sandbox.distributions.extras.NormExpan_gen</a></li>
</ul>
</div>
</nav>
<main class="md-main">
<div class="md-main__inner md-grid" data-md-component="container">
<div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" data-md-level="0">
<label class="md-nav__title md-nav__title--site" for="__drawer">
<a href="../index.html" title="statsmodels" class="md-nav__button md-logo">
<img src="../_static/statsmodels-logo-v2-bw.svg" alt=" logo" width="48" height="48">
</a>
<a href="../index.html"
title="statsmodels">statsmodels v0.11.1</a>
</label>
<div class="md-nav__source">
<a href="https://github.com/statsmodels/statsmodels" title="Go to repository" class="md-source" data-md-source="github">
<div class="md-source__icon">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="28" height="28">
<use xlink:href="#__github" width="24" height="24"></use>
</svg>
</div>
<div class="md-source__repository">
statsmodels
</div>
</a>
</div>
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="../install.html" class="md-nav__link">Installing statsmodels</a>
</li>
<li class="md-nav__item">
<a href="../gettingstarted.html" class="md-nav__link">Getting started</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html" class="md-nav__link">User Guide</a>
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="../user-guide.html#background" class="md-nav__link">Background</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#regression-and-linear-models" class="md-nav__link">Regression and Linear Models</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#time-series-analysis" class="md-nav__link">Time Series Analysis</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#other-models" class="md-nav__link">Other Models</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#statistics-and-tools" class="md-nav__link">Statistics and Tools</a>
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="../stats.html" class="md-nav__link">Statistics <code class="xref py py-mod docutils literal notranslate"><span class="pre">stats</span></code></a>
</li>
<li class="md-nav__item">
<a href="../contingency_tables.html" class="md-nav__link">Contingency tables</a>
</li>
<li class="md-nav__item">
<a href="../imputation.html" class="md-nav__link">Multiple Imputation with Chained Equations</a>
</li>
<li class="md-nav__item">
<a href="../emplike.html" class="md-nav__link">Empirical Likelihood <code class="xref py py-mod docutils literal notranslate"><span class="pre">emplike</span></code></a>
</li>
<li class="md-nav__item">
<a href="../distributions.html" class="md-nav__link">Distributions</a>
</li>
<li class="md-nav__item">
<a href="../graphics.html" class="md-nav__link">Graphics</a>
</li>
<li class="md-nav__item">
<a href="../iolib.html" class="md-nav__link">Input-Output <code class="xref py py-mod docutils literal notranslate"><span class="pre">iolib</span></code></a>
</li>
<li class="md-nav__item">
<a href="../tools.html" class="md-nav__link">Tools</a>
</li>
<li class="md-nav__item">
<a href="../large_data.html" class="md-nav__link">Working with Large Data Sets</a>
</li>
<li class="md-nav__item">
<a href="../optimization.html" class="md-nav__link">Optimization</a>
</li></ul>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#data-sets" class="md-nav__link">Data Sets</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#sandbox" class="md-nav__link">Sandbox</a>
</li></ul>
</li>
<li class="md-nav__item">
<a href="../examples/index.html" class="md-nav__link">Examples</a>
</li>
<li class="md-nav__item">
<a href="../api.html" class="md-nav__link">API Reference</a>
</li>
<li class="md-nav__item">
<a href="../about.html" class="md-nav__link">About statsmodels</a>
</li>
<li class="md-nav__item">
<a href="../dev/index.html" class="md-nav__link">Developer Page</a>
</li>
<li class="md-nav__item">
<a href="../release/index.html" class="md-nav__link">Release Notes</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary">
<ul class="md-nav__list" data-md-scrollfix="">
<li class="md-nav__item"><a class="md-nav__extra_link" href="../_sources/generated/statsmodels.sandbox.distributions.extras.NormExpan_gen.random_state.rst.txt">Show Source</a> </li>
<li id="searchbox" class="md-nav__item"></li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content">
<article class="md-content__inner md-typeset" role="main">
<h1 id="generated-statsmodels-sandbox-distributions-extras-normexpan-gen-random-state--page-root">statsmodels.sandbox.distributions.extras.NormExpan_gen.random_state<a class="headerlink" href="#generated-statsmodels-sandbox-distributions-extras-normexpan-gen-random-state--page-root" title="Permalink to this headline">¶</a></h1>
<dl class="method">
<dt id="statsmodels.sandbox.distributions.extras.NormExpan_gen.random_state">
<em class="property">property </em><code class="sig-prename descclassname">NormExpan_gen.</code><code class="sig-name descname">random_state</code><a class="headerlink" href="#statsmodels.sandbox.distributions.extras.NormExpan_gen.random_state" title="Permalink to this definition">¶</a></dt>
<dd><p>Get or set the RandomState object for generating random variates.</p>
<p>This can be either None or an existing RandomState object.</p>
<p>If None (or np.random), use the RandomState singleton used by np.random.
If already a RandomState instance, use it.
If an int, use a new RandomState instance seeded with seed.</p>
</dd></dl>
</article>
</div>
</div>
</main>
</div>
<footer class="md-footer">
<div class="md-footer-nav">
<nav class="md-footer-nav__inner md-grid">
<a href="statsmodels.sandbox.distributions.extras.NormExpan_gen.var.html" title="Material"
class="md-flex md-footer-nav__link md-footer-nav__link--prev"
rel="prev">
<div class="md-flex__cell md-flex__cell--shrink">
<i class="md-icon md-icon--arrow-back md-footer-nav__button"></i>
</div>
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
<span class="md-flex__ellipsis">
<span
class="md-footer-nav__direction"> Previous </span> statsmodels.sandbox.distributions.extras.NormExpan_gen.var </span>
</div>
</a>
<a href="statsmodels.sandbox.distributions.extras.mvstdnormcdf.html" title="Admonition"
class="md-flex md-footer-nav__link md-footer-nav__link--next"
rel="next">
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title"><span
class="md-flex__ellipsis"> <span
class="md-footer-nav__direction"> Next </span> statsmodels.sandbox.distributions.extras.mvstdnormcdf </span>
</div>
<div class="md-flex__cell md-flex__cell--shrink"><i
class="md-icon md-icon--arrow-forward md-footer-nav__button"></i>
</div>
</a>
</nav>
</div>
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-footer-copyright">
<div class="md-footer-copyright__highlight">
© Copyright 2009-2019, Josef Perktold, Skipper Seabold, Jonathan Taylor, statsmodels-developers.
</div>
Last updated on
Feb 21, 2020.
<br/>
Created using
<a href="http://www.sphinx-doc.org/">Sphinx</a> 2.4.2.
and
<a href="https://github.com/bashtage/sphinx-material/">Material for
Sphinx</a>
</div>
</div>
</div>
</footer>
<script src="../_static/javascripts/application.js"></script>
<script>app.initialize({version: "1.0.4", url: {base: ".."}})</script>
</body>
</html> | {
"content_hash": "1f56a93a1260e69c08b6292e066a6242",
"timestamp": "",
"source": "github",
"line_count": 449,
"max_line_length": 999,
"avg_line_length": 41.40534521158129,
"alnum_prop": 0.6062073046097574,
"repo_name": "statsmodels/statsmodels.github.io",
"id": "648a7fc9c1e4f8f68036936d83f25cebf7cf7911",
"size": "18595",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "v0.11.1/generated/statsmodels.sandbox.distributions.extras.NormExpan_gen.random_state.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
package org.elasticsearch.index.mapper;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.Version;
import org.elasticsearch.common.Explicit;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.time.DateFormatter;
import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.mapper.DynamicTemplate.XContentFieldType;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeBooleanValue;
import static org.elasticsearch.index.mapper.TypeParsers.parseDateTimeFormatter;
public class RootObjectMapper extends ObjectMapper {
private static final Logger LOGGER = LogManager.getLogger(RootObjectMapper.class);
private static final DeprecationLogger DEPRECATION_LOGGER = new DeprecationLogger(LOGGER);
public static class Defaults {
public static final DateFormatter[] DYNAMIC_DATE_TIME_FORMATTERS =
new DateFormatter[]{
DateFieldMapper.DEFAULT_DATE_TIME_FORMATTER,
DateFormatter.forPattern("yyyy/MM/dd HH:mm:ss||yyyy/MM/dd||epoch_millis")
};
public static final boolean DATE_DETECTION = true;
public static final boolean NUMERIC_DETECTION = false;
}
public static class Builder extends ObjectMapper.Builder<Builder> {
protected Explicit<DynamicTemplate[]> dynamicTemplates = new Explicit<>(new DynamicTemplate[0], false);
protected Explicit<DateFormatter[]> dynamicDateTimeFormatters = new Explicit<>(Defaults.DYNAMIC_DATE_TIME_FORMATTERS, false);
protected Explicit<Boolean> dateDetection = new Explicit<>(Defaults.DATE_DETECTION, false);
protected Explicit<Boolean> numericDetection = new Explicit<>(Defaults.NUMERIC_DETECTION, false);
public Builder(String name) {
super(name);
this.builder = this;
}
public Builder dynamicDateTimeFormatter(Collection<DateFormatter> dateTimeFormatters) {
this.dynamicDateTimeFormatters = new Explicit<>(dateTimeFormatters.toArray(new DateFormatter[0]), true);
return this;
}
public Builder dynamicTemplates(Collection<DynamicTemplate> templates) {
this.dynamicTemplates = new Explicit<>(templates.toArray(new DynamicTemplate[0]), true);
return this;
}
@Override
public RootObjectMapper build(BuilderContext context) {
fixRedundantIncludes(this, true);
return (RootObjectMapper) super.build(context);
}
/**
* Removes redundant root includes in {@link ObjectMapper.Nested} trees to avoid duplicate
* fields on the root mapper when {@code isIncludeInRoot} is {@code true} for a node that is
* itself included into a parent node, for which either {@code isIncludeInRoot} is
* {@code true} or which is transitively included in root by a chain of nodes with
* {@code isIncludeInParent} returning {@code true}.
* @param omb Builder whose children to check.
* @param parentIncluded True iff node is a child of root or a node that is included in
* root
*/
@SuppressWarnings("rawtypes")
private static void fixRedundantIncludes(ObjectMapper.Builder omb, boolean parentIncluded) {
for (Object mapper : omb.mappersBuilders) {
if (mapper instanceof ObjectMapper.Builder) {
ObjectMapper.Builder child = (ObjectMapper.Builder) mapper;
Nested nested = child.nested;
boolean isNested = nested.isNested();
boolean includeInRootViaParent = parentIncluded && isNested && nested.isIncludeInParent();
boolean includedInRoot = isNested && nested.isIncludeInRoot();
if (includeInRootViaParent && includedInRoot) {
child.nested = Nested.newNested(true, false);
}
fixRedundantIncludes(child, includeInRootViaParent || includedInRoot);
}
}
}
@Override
protected ObjectMapper createMapper(String name, String fullPath, boolean enabled, Nested nested, Dynamic dynamic,
Map<String, Mapper> mappers, @Nullable Settings settings) {
assert !nested.isNested();
return new RootObjectMapper(name, enabled, dynamic, mappers,
dynamicDateTimeFormatters,
dynamicTemplates,
dateDetection, numericDetection, settings);
}
}
public static class TypeParser extends ObjectMapper.TypeParser {
@Override
@SuppressWarnings("rawtypes")
public Mapper.Builder parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException {
RootObjectMapper.Builder builder = new Builder(name);
Iterator<Map.Entry<String, Object>> iterator = node.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<String, Object> entry = iterator.next();
String fieldName = entry.getKey();
Object fieldNode = entry.getValue();
if (parseObjectOrDocumentTypeProperties(fieldName, fieldNode, parserContext, builder)
|| processField(builder, fieldName, fieldNode, parserContext)) {
iterator.remove();
}
}
return builder;
}
@SuppressWarnings("unchecked")
protected boolean processField(RootObjectMapper.Builder builder, String fieldName, Object fieldNode,
ParserContext parserContext) {
if (fieldName.equals("date_formats") || fieldName.equals("dynamic_date_formats")) {
if (fieldNode instanceof List) {
List<DateFormatter> formatters = new ArrayList<>();
for (Object formatter : (List<?>) fieldNode) {
if (formatter.toString().startsWith("epoch_")) {
throw new MapperParsingException("Epoch ["+ formatter +"] is not supported as dynamic date format");
}
formatters.add(parseDateTimeFormatter(formatter));
}
builder.dynamicDateTimeFormatter(formatters);
} else if ("none".equals(fieldNode.toString())) {
builder.dynamicDateTimeFormatter(Collections.emptyList());
} else {
builder.dynamicDateTimeFormatter(Collections.singleton(parseDateTimeFormatter(fieldNode)));
}
return true;
} else if (fieldName.equals("dynamic_templates")) {
/*
"dynamic_templates" : [
{
"template_1" : {
"match" : "*_test",
"match_mapping_type" : "string",
"mapping" : { "type" : "keyword", "store" : "yes" }
}
}
]
*/
if ((fieldNode instanceof List) == false) {
throw new MapperParsingException("Dynamic template syntax error. An array of named objects is expected.");
}
List<?> tmplNodes = (List<?>) fieldNode;
List<DynamicTemplate> templates = new ArrayList<>();
for (Object tmplNode : tmplNodes) {
Map<String, Object> tmpl = (Map<String, Object>) tmplNode;
if (tmpl.size() != 1) {
throw new MapperParsingException("A dynamic template must be defined with a name");
}
Map.Entry<String, Object> entry = tmpl.entrySet().iterator().next();
String templateName = entry.getKey();
Map<String, Object> templateParams = (Map<String, Object>) entry.getValue();
DynamicTemplate template = DynamicTemplate.parse(templateName, templateParams);
if (template != null) {
validateDynamicTemplate(parserContext, template);
templates.add(template);
}
}
builder.dynamicTemplates(templates);
return true;
} else if (fieldName.equals("date_detection")) {
builder.dateDetection = new Explicit<>(nodeBooleanValue(fieldNode, "date_detection"), true);
return true;
} else if (fieldName.equals("numeric_detection")) {
builder.numericDetection = new Explicit<>(nodeBooleanValue(fieldNode, "numeric_detection"), true);
return true;
}
return false;
}
}
private Explicit<DateFormatter[]> dynamicDateTimeFormatters;
private Explicit<Boolean> dateDetection;
private Explicit<Boolean> numericDetection;
private Explicit<DynamicTemplate[]> dynamicTemplates;
RootObjectMapper(String name, boolean enabled, Dynamic dynamic, Map<String, Mapper> mappers,
Explicit<DateFormatter[]> dynamicDateTimeFormatters, Explicit<DynamicTemplate[]> dynamicTemplates,
Explicit<Boolean> dateDetection, Explicit<Boolean> numericDetection, Settings settings) {
super(name, name, enabled, Nested.NO, dynamic, mappers, settings);
this.dynamicTemplates = dynamicTemplates;
this.dynamicDateTimeFormatters = dynamicDateTimeFormatters;
this.dateDetection = dateDetection;
this.numericDetection = numericDetection;
}
@Override
public ObjectMapper mappingUpdate(Mapper mapper) {
RootObjectMapper update = (RootObjectMapper) super.mappingUpdate(mapper);
// for dynamic updates, no need to carry root-specific options, we just
// set everything to they implicit default value so that they are not
// applied at merge time
update.dynamicTemplates = new Explicit<>(new DynamicTemplate[0], false);
update.dynamicDateTimeFormatters = new Explicit<>(Defaults.DYNAMIC_DATE_TIME_FORMATTERS, false);
update.dateDetection = new Explicit<>(Defaults.DATE_DETECTION, false);
update.numericDetection = new Explicit<>(Defaults.NUMERIC_DETECTION, false);
return update;
}
public boolean dateDetection() {
return this.dateDetection.value();
}
public boolean numericDetection() {
return this.numericDetection.value();
}
public DateFormatter[] dynamicDateTimeFormatters() {
return dynamicDateTimeFormatters.value();
}
@SuppressWarnings("rawtypes")
public Mapper.Builder findTemplateBuilder(ParseContext context, String name, XContentFieldType matchType) {
return findTemplateBuilder(context, name, matchType.defaultMappingType(), matchType);
}
/**
* Find a template. Returns {@code null} if no template could be found.
* @param name the field name
* @param dynamicType the field type to give the field if the template does not define one
* @param matchType the type of the field in the json document or null if unknown
* @return a mapper builder, or null if there is no template for such a field
*/
@SuppressWarnings("rawtypes")
public Mapper.Builder findTemplateBuilder(ParseContext context, String name, String dynamicType, XContentFieldType matchType) {
DynamicTemplate dynamicTemplate = findTemplate(context.path(), name, matchType);
if (dynamicTemplate == null) {
return null;
}
Mapper.TypeParser.ParserContext parserContext = context.docMapperParser().parserContext();
String mappingType = dynamicTemplate.mappingType(dynamicType);
Mapper.TypeParser typeParser = parserContext.typeParser(mappingType);
if (typeParser == null) {
throw new MapperParsingException("failed to find type parsed [" + mappingType + "] for [" + name + "]");
}
return typeParser.parse(name, dynamicTemplate.mappingForName(name, dynamicType), parserContext);
}
public DynamicTemplate findTemplate(ContentPath path, String name, XContentFieldType matchType) {
final String pathAsString = path.pathAsText(name);
for (DynamicTemplate dynamicTemplate : dynamicTemplates.value()) {
if (dynamicTemplate.match(pathAsString, name, matchType)) {
return dynamicTemplate;
}
}
return null;
}
@Override
public RootObjectMapper merge(Mapper mergeWith) {
return (RootObjectMapper) super.merge(mergeWith);
}
@Override
protected void doMerge(ObjectMapper mergeWith) {
super.doMerge(mergeWith);
RootObjectMapper mergeWithObject = (RootObjectMapper) mergeWith;
if (mergeWithObject.numericDetection.explicit()) {
this.numericDetection = mergeWithObject.numericDetection;
}
if (mergeWithObject.dateDetection.explicit()) {
this.dateDetection = mergeWithObject.dateDetection;
}
if (mergeWithObject.dynamicDateTimeFormatters.explicit()) {
this.dynamicDateTimeFormatters = mergeWithObject.dynamicDateTimeFormatters;
}
if (mergeWithObject.dynamicTemplates.explicit()) {
this.dynamicTemplates = mergeWithObject.dynamicTemplates;
}
}
@Override
protected void doXContent(XContentBuilder builder, ToXContent.Params params) throws IOException {
final boolean includeDefaults = params.paramAsBoolean("include_defaults", false);
if (dynamicDateTimeFormatters.explicit() || includeDefaults) {
builder.startArray("dynamic_date_formats");
for (DateFormatter dateTimeFormatter : dynamicDateTimeFormatters.value()) {
builder.value(dateTimeFormatter.pattern());
}
builder.endArray();
}
if (dynamicTemplates.explicit() || includeDefaults) {
builder.startArray("dynamic_templates");
for (DynamicTemplate dynamicTemplate : dynamicTemplates.value()) {
builder.startObject();
builder.field(dynamicTemplate.name(), dynamicTemplate);
builder.endObject();
}
builder.endArray();
}
if (dateDetection.explicit() || includeDefaults) {
builder.field("date_detection", dateDetection.value());
}
if (numericDetection.explicit() || includeDefaults) {
builder.field("numeric_detection", numericDetection.value());
}
}
private static void validateDynamicTemplate(Mapper.TypeParser.ParserContext parserContext,
DynamicTemplate dynamicTemplate) {
if (containsSnippet(dynamicTemplate.getMapping(), "{name}")) {
// Can't validate template, because field names can't be guessed up front.
return;
}
final XContentFieldType[] types;
if (dynamicTemplate.getXContentFieldType() != null) {
types = new XContentFieldType[]{dynamicTemplate.getXContentFieldType()};
} else {
types = XContentFieldType.values();
}
Exception lastError = null;
boolean dynamicTemplateInvalid = true;
for (XContentFieldType contentFieldType : types) {
String defaultDynamicType = contentFieldType.defaultMappingType();
String mappingType = dynamicTemplate.mappingType(defaultDynamicType);
Mapper.TypeParser typeParser = parserContext.typeParser(mappingType);
if (typeParser == null) {
lastError = new IllegalArgumentException("No mapper found for type [" + mappingType + "]");
continue;
}
Map<String, Object> fieldTypeConfig = dynamicTemplate.mappingForName("__dummy__", defaultDynamicType);
fieldTypeConfig.remove("type");
try {
Mapper.Builder<?> dummyBuilder = typeParser.parse("__dummy__", fieldTypeConfig, parserContext);
if (fieldTypeConfig.isEmpty()) {
Settings indexSettings = parserContext.mapperService().getIndexSettings().getSettings();
BuilderContext builderContext = new BuilderContext(indexSettings, new ContentPath(1));
dummyBuilder.build(builderContext);
dynamicTemplateInvalid = false;
break;
} else {
lastError = new IllegalArgumentException("Unused mapping attributes [" + fieldTypeConfig + "]");
}
} catch (Exception e) {
lastError = e;
}
}
final boolean failInvalidDynamicTemplates = parserContext.indexVersionCreated().onOrAfter(Version.V_8_0_0);
if (dynamicTemplateInvalid) {
String message = String.format(Locale.ROOT, "dynamic template [%s] has invalid content [%s]",
dynamicTemplate.getName(), Strings.toString(dynamicTemplate));
if (failInvalidDynamicTemplates) {
throw new IllegalArgumentException(message, lastError);
} else {
final String deprecationMessage;
if (lastError != null) {
deprecationMessage = String.format(Locale.ROOT, "%s, caused by [%s]", message, lastError.getMessage());
} else {
deprecationMessage = message;
}
DEPRECATION_LOGGER.deprecate("invalid_dynamic_template", deprecationMessage);
}
}
}
private static boolean containsSnippet(Map<?, ?> map, String snippet) {
for (Map.Entry<?, ?> entry : map.entrySet()) {
String key = entry.getKey().toString();
if (key.contains(snippet)) {
return true;
}
Object value = entry.getValue();
if (value instanceof Map) {
if (containsSnippet((Map<?, ?>) value, snippet)) {
return true;
}
} else if (value instanceof List) {
if (containsSnippet((List<?>) value, snippet)) {
return true;
}
} else if (value instanceof String) {
String valueString = (String) value;
if (valueString.contains(snippet)) {
return true;
}
}
}
return false;
}
private static boolean containsSnippet(List<?> list, String snippet) {
for (Object value : list) {
if (value instanceof Map) {
if (containsSnippet((Map<?, ?>) value, snippet)) {
return true;
}
} else if (value instanceof List) {
if (containsSnippet((List<?>) value, snippet)) {
return true;
}
} else if (value instanceof String) {
String valueString = (String) value;
if (valueString.contains(snippet)) {
return true;
}
}
}
return false;
}
}
| {
"content_hash": "d4beb8c269e1f39b899a6a3dde369293",
"timestamp": "",
"source": "github",
"line_count": 433,
"max_line_length": 135,
"avg_line_length": 46.08775981524249,
"alnum_prop": 0.6113449589096012,
"repo_name": "uschindler/elasticsearch",
"id": "be6cb43b8a20f06d6ea61e5b7d367c04eb6f47e7",
"size": "20744",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "server/src/main/java/org/elasticsearch/index/mapper/RootObjectMapper.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "11082"
},
{
"name": "Batchfile",
"bytes": "11226"
},
{
"name": "Emacs Lisp",
"bytes": "3341"
},
{
"name": "FreeMarker",
"bytes": "45"
},
{
"name": "Groovy",
"bytes": "399054"
},
{
"name": "HTML",
"bytes": "2186"
},
{
"name": "Java",
"bytes": "46161265"
},
{
"name": "Perl",
"bytes": "12007"
},
{
"name": "Python",
"bytes": "19852"
},
{
"name": "Shell",
"bytes": "105144"
}
],
"symlink_target": ""
} |
using namespace RoutingKit;
using namespace std;
int main(int argc, char*argv[]){
try{
unsigned time_count;
unsigned random_seed;
unsigned period;
string source_time_file;
if(argc != 5){
cerr << argv[0] << " time_count random_seed period_file source_time_file" << endl;
cerr << "time_count can be a number or a uint32 vector of which the size is taken." << endl;
return 1;
}else{
try{
time_count = stoul(argv[1]);
}catch(...){
time_count = load_vector<unsigned>(argv[1]).size();
}
random_seed = stoul(argv[2]);
period = load_value<unsigned>(argv[3]);
source_time_file = argv[4];
}
cout << "Generating ... " << flush;
default_random_engine gen(random_seed);
uniform_int_distribution<int> dist(0, period-1);
vector<unsigned>source_time(time_count);
for(auto&x:source_time)
x = dist(gen);
cout << "done" << endl;
cout << "Saving test queries ... " << flush;
save_vector(source_time_file, source_time);
cout << "done" << endl;
}catch(exception&err){
cerr << "Stopped on exception : " << err.what() << endl;
}
}
| {
"content_hash": "4d62f76e0b6d594d6f2934a33c5acd34",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 95,
"avg_line_length": 23.29787234042553,
"alnum_prop": 0.6255707762557078,
"repo_name": "RoutingKit/RoutingKit",
"id": "a65e009dabdd3e038e5fe08a266ae1151db34766",
"size": "1208",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/generate_random_source_times.cpp",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "C",
"bytes": "1045"
},
{
"name": "C++",
"bytes": "644474"
},
{
"name": "Makefile",
"bytes": "48114"
},
{
"name": "Python",
"bytes": "10673"
}
],
"symlink_target": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.