text
stringlengths 2
1.04M
| meta
dict |
---|---|
namespace Pizza.RetailWeb.Models.Home
{
public class OrderStatusWidgetViewModel
{
public PizzaOrderStatus[] Orders { get; set; }
}
} | {
"content_hash": "59980141842662acce617f4d838c0c89",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 54,
"avg_line_length": 21.857142857142858,
"alnum_prop": 0.6797385620915033,
"repo_name": "NimbusAPI/Nimbus_v2",
"id": "99a4a2afc3c7ed0970360a67bd2c67cd4d01aebd",
"size": "155",
"binary": false,
"copies": "7",
"ref": "refs/heads/master",
"path": "src/Samples/PizzaSample/Pizza.RetailWeb/Models/Home/OrderStatusWidgetViewModel.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "106"
},
{
"name": "C#",
"bytes": "821881"
},
{
"name": "CSS",
"bytes": "685"
},
{
"name": "HTML",
"bytes": "5125"
},
{
"name": "JavaScript",
"bytes": "21032"
},
{
"name": "PowerShell",
"bytes": "20908"
}
],
"symlink_target": ""
} |
namespace HieraParser
{
void IterDistributedTrainer::Train(std::vector<TrainingExample> &examples, Model &model) const
{
std::vector<Model> submodels(threads);
std::vector<std::vector<TrainingExample>> shards(threads);
int exampleSize = static_cast<int>(examples.size());
ShardTrainExamples(examples, shards, std::min(threads, exampleSize));
std::vector<std::future<std::vector<int>>> results;
std::vector<int> shardSize(threads, 0);
std::vector<int> num_updates(threads, 0);
std::vector<int> total_updates(threads, 0);
for (size_t i = 0; i < threads; i++){
total_updates[i] = iterations * static_cast<int>(shards[i].size());
shardSize[i] = static_cast<int>(shards[i].size());
}
double wall0 = get_wall_time();
for (int iter = 0; iter < iterations; iter++)
{
int num_errors = 0;
int num_unreachables = 0;
std::stringstream log_string;
for (size_t i = 0; i < threads; i++)
{
results.emplace_back(
pool->enqueue(&TrainerBase::TrainOneEpoch, *this, total_updates[i],
std::ref(num_updates[i]),
std::ref(shards[i]), std::ref(submodels[i])));
}
for (auto &&result : results)
{
std::vector<int> nums = result.get();
num_errors += nums[0];
num_unreachables += nums[1];
};
double wall1 = get_wall_time();
log_string << "Iteration=" << iter << ", Errors=" << num_errors
<< ", Unreachables=" << num_unreachables
<< ", Seconds=" << wall1 - wall0 << " ";
std::cerr << log_string.str() << std::endl;
model.IterParaMix(submodels, shardSize, (float)(iterations-iter)/iterations);
if (early_stop && num_errors == 0)
break;
if (saveStep > 0 && iter % saveStep == 0){
model.WriteModel(m_path + "." + std::to_string(iter));
}
results.clear();
}
}
} // namespace HieraParser | {
"content_hash": "7de21435fac43062f9d38c0940a767e8",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 94,
"avg_line_length": 35.83050847457627,
"alnum_prop": 0.5331125827814569,
"repo_name": "wang-h/HieraParser",
"id": "0dc79a57c7e6b6226c77c2110fc204fb4377a9d4",
"size": "2266",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/trainers/IterDistributedTrainer.cc",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "309"
},
{
"name": "C++",
"bytes": "376506"
},
{
"name": "CMake",
"bytes": "1887"
},
{
"name": "Python",
"bytes": "21183"
}
],
"symlink_target": ""
} |
<html>
<head>
<meta charset="utf-8">
<title>Test page for adapter.js</title>
</head>
<body>
<h1>Test page for adapter.js</h1>
<script src="../adapter.js"></script>
The browser is: <span id="browser"></span>
<br>
The browser version is: <span id="browserversion"></span>
<script>
var browser_display = document.getElementById('browser');
var version_display = document.getElementById('browserversion');
browser_display.innerHTML = webrtcDetectedBrowser;
version_display.innerHTML = webrtcDetectedVersion;
</script>
</body>
</html>
| {
"content_hash": "417d671f5b8330462cf17894d5344325",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 64,
"avg_line_length": 27.894736842105264,
"alnum_prop": 0.7358490566037735,
"repo_name": "4lejandrito/adapter",
"id": "ca37ba6900740da07a091fc9d4fcbaf7dd20a2b6",
"size": "530",
"binary": false,
"copies": "7",
"ref": "refs/heads/master",
"path": "test/testpage.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "HTML",
"bytes": "530"
},
{
"name": "JavaScript",
"bytes": "43772"
},
{
"name": "Shell",
"bytes": "369"
}
],
"symlink_target": ""
} |
``keep_cross_validation_predictions``
-------------------------------------
- Available in: GBM, DRF, Deep Learning, GLM, Naïve-Bayes, K-Means, XGBoost
- Hyperparameter: no
Description
~~~~~~~~~~~
N-fold cross-validation is used to validate a model internally, i.e., to estimate the model performance without having to sacrifice a validation split. When building cross-validated models, H2O builds ``nfolds+1`` models: ``nfolds`` cross-validated models and 1 overarching model over all of the training data. For example, if you specify ``nfolds=5``, then 6 models are built. The first 5 models are the cross-validation models and are built on 80% of the training data. Each cross-validated model produces a prediction frame pertaining to its fold. You can save each of these prediction frames by enabling the ``keep_cross_validation_predictions`` option. Note that this option is disabled by default.
More information is available in the `Cross-Validation <../../cross-validation.html>`__ section.
Related Parameters
~~~~~~~~~~~~~~~~~~
- `keep_cross_validation_fold_assignment <keep_cross_validation_fold_assignment.html>`__
- `nfolds <nfolds.html>`__
Example
~~~~~~~
.. example-code::
.. code-block:: r
library(h2o)
h2o.init()
# import the cars dataset:
# this dataset is used to classify whether or not a car is economical based on
# the car's displacement, power, weight, and acceleration, and the year it was made
cars <- h2o.importFile("https://s3.amazonaws.com/h2o-public-test-data/smalldata/junit/cars_20mpg.csv")
# convert response column to a factor
cars["economy_20mpg"] <- as.factor(cars["economy_20mpg"])
# set the predictor names and the response column name
predictors <- c("displacement","power","weight","acceleration","year")
response <- "economy_20mpg"
# split into train and validation sets
cars.split <- h2o.splitFrame(data = cars,ratios = 0.8, seed = 1234)
train <- cars.split[[1]]
valid <- cars.split[[2]]
# try using the `keep_cross_validation_predictions` (boolean parameter):
# train your model, set nfolds parameter
cars_gbm <- h2o.gbm(x = predictors, y = response, training_frame = train,
nfolds = 5, keep_cross_validation_predictions= TRUE, seed = 1234)
# print the cross-validation predictions
h2o.cross_validation_predictions(cars_gbm)
.. code-block:: python
import h2o
from h2o.estimators.gbm import H2OGradientBoostingEstimator
h2o.init()
# import the cars dataset:
# this dataset is used to classify whether or not a car is economical based on
# the car's displacement, power, weight, and acceleration, and the year it was made
cars = h2o.import_file("https://s3.amazonaws.com/h2o-public-test-data/smalldata/junit/cars_20mpg.csv")
# convert response column to a factor
cars["economy_20mpg"] = cars["economy_20mpg"].asfactor()
# set the predictor names and the response column name
predictors = ["displacement","power","weight","acceleration","year"]
response = "economy_20mpg"
# split into train and validation sets
train, valid = cars.split_frame(ratios = [.8], seed = 1234)
# try using the `keep_cross_validation_predictions` (boolean parameter):
# first initialize your estimator, set nfolds parameter
cars_gbm = H2OGradientBoostingEstimator(keep_cross_validation_predictions = True, nfolds = 5, seed = 1234)
# then train your model
cars_gbm.train(x = predictors, y = response, training_frame = train)
# print the cross-validation predictions
cars_gbm.cross_validation_predictions() | {
"content_hash": "a28bc6da8f7c6ad6b9cf1d6b6934fdd4",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 703,
"avg_line_length": 41.80952380952381,
"alnum_prop": 0.7260820045558086,
"repo_name": "spennihana/h2o-3",
"id": "284acffad7a89b03f3c01d6cbf3f8900394e0c49",
"size": "3513",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "h2o-docs/src/product/data-science/algo-params/keep_cross_validation_predictions.rst",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "12629"
},
{
"name": "CSS",
"bytes": "257122"
},
{
"name": "CoffeeScript",
"bytes": "273112"
},
{
"name": "Emacs Lisp",
"bytes": "2226"
},
{
"name": "Groovy",
"bytes": "125187"
},
{
"name": "HTML",
"bytes": "2111506"
},
{
"name": "Java",
"bytes": "9481047"
},
{
"name": "JavaScript",
"bytes": "87944"
},
{
"name": "Jupyter Notebook",
"bytes": "6165027"
},
{
"name": "Makefile",
"bytes": "42233"
},
{
"name": "Python",
"bytes": "4982123"
},
{
"name": "R",
"bytes": "2699289"
},
{
"name": "Ruby",
"bytes": "3506"
},
{
"name": "Scala",
"bytes": "32768"
},
{
"name": "Shell",
"bytes": "179758"
},
{
"name": "TeX",
"bytes": "657375"
}
],
"symlink_target": ""
} |
<?php
namespace Microsoft\Dynamics\Model;
use SaintSystems\OData\Entity;
/**
* Subject class
*
* Subject entity
*
* @category Model
* @package Microsoft.Dynamics
* @license https://opensource.org/licenses/MIT MIT License
* @link https://www.microsoft.com/en-us/dynamics365/
*/
class Subject extends Entity
{
/**
* The entity set name associated with the entity.
* This is needed for API calls since this is the API endpoint for this Entity
*
* @var string
*/
static $entity = 'subjects';
/**
* The name of the attribute that is the primary id for the entity.
* PrimaryIdAttribute from https://msdn.microsoft.com/en-us/library/mt607760.aspx
*
* @var string
*/
static $primaryKey = 'subjectid';
}
| {
"content_hash": "6fd0da6215ffdf2b6f954d1e6606b046",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 85,
"avg_line_length": 22.823529411764707,
"alnum_prop": 0.6597938144329897,
"repo_name": "saintsystems/dynamics-sdk-php",
"id": "ebcec926c3f9c9b126d159a1d1240dd914150e64",
"size": "1200",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Dynamics/Model/Subject.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "624"
},
{
"name": "PHP",
"bytes": "532648"
},
{
"name": "Shell",
"bytes": "434"
}
],
"symlink_target": ""
} |
@echo off
REM This batch file compiles the demo program with the gnu gcc compiler under DOS/Windows
REM There are two ways to do that: use the lpsolve code directly or use that static library.
set c=gcc
REM determine platform (win32/win64)
echo main(){printf("SET PLATFORM=win%%d\n", (int) (sizeof(void *)*8));}>platform.c
%c% platform.c -o platform.exe
del platform.c
platform.exe >platform.bat
del platform.exe
call platform.bat
del platform.bat
if not exist bin\%PLATFORM%\*.* md bin\%PLATFORM%
rem link lpsolve code with application
set src=../lp_MDO.c ../shared/commonlib.c ../colamd/colamd.c ../shared/mmio.c ../shared/myblas.c ../ini.c ../lp_rlp.c ../lp_crash.c ../bfp/bfp_LUSOL/lp_LUSOL.c ../bfp/bfp_LUSOL/LUSOL/lusol.c ../lp_Hash.c ../lp_lib.c ../lp_wlp.c ../lp_matrix.c ../lp_mipbb.c ../lp_MPS.c ../lp_params.c ../lp_presolve.c ../lp_price.c ../lp_pricePSE.c ../lp_report.c ../lp_scale.c ../lp_simplex.c ../lp_SOS.c ../lp_utils.c ../yacc_read.c
rem statically link lpsolve library
rem set src=../lpsolve55/bin/%PLATFORM%/liblpsolve55.a
%c% -DINLINE=static -I.. -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL -I../colamd -I../shared -O3 -DBFP_CALLMODEL=__stdcall -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine demo.c %src% -o bin\%PLATFORM%\demo.exe
if exist *.o del *.o
set PLATFORM=
| {
"content_hash": "ba7fce2f28a8a2a23515a29c72c0fc2a",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 417,
"avg_line_length": 45.166666666666664,
"alnum_prop": 0.7011070110701108,
"repo_name": "smremde/node-lp_solve",
"id": "2374850de835eb48dbec159b745b31bf6a787f22",
"size": "1355",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "deps/lp_solve/lp_solve_5.5/demo/cgcc.bat",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "170868"
},
{
"name": "JavaScript",
"bytes": "36478"
},
{
"name": "Python",
"bytes": "616"
}
],
"symlink_target": ""
} |
<#
/********************************************************
* *
* © Microsoft. All rights reserved. *
* *
*********************************************************/
.SYNOPSIS
This script creates performance counter catagory and adds
specified user to 'Performance Monitor Users' local group.
.NOTES
Author: Microsoft SQL Elastic Scale team
Last Updated: 5/6/2016
.EXAMPLES
.\CreatePerformanceCounterCategory.ps1 `
-UserName 'domain\username'
#>
param(
[Parameter(Mandatory = $true)]
[string]
$UserName=""
)
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
# Import modules
$ScriptDir = Split-Path -parent $MyInvocation.MyCommand.Path
Import-Module $ScriptDir\ShardManagement -Force
if (([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
Write-Host "Creating performance counter category 'Elastic Database: Shard Management' ..."
[Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement.ShardMapManagerFactory]::CreatePerformanceCategoryAndCounters()
Write-Host "Performance counter category 'Elastic Database: Shard Management' created successfully."
Write-Host "Adding specified user to 'Performance Monitor Users' group ..."
net localgroup "Performance Monitor Users" $UserName /ADD
if($?) {
Write-Host "User $UserName is now part of 'Performance Monitor Users' group. 'Performance Monitor Users' group membership is required for accessing performance counters."
} else {
Write-Host "Failed to add User $UserName to 'Performance Monitor Users' group, please add $UserName to this group to enable performance counters access."
}
} else {
Write-Host "Performance counter category creation needs Administrator privileges, please rerun script as Administrator."
}
| {
"content_hash": "0982ac3b81829c8e94cdc02fa3c9b923",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 178,
"avg_line_length": 43.65217391304348,
"alnum_prop": 0.6613545816733067,
"repo_name": "jaredmoo/elastic-db-tools",
"id": "7cf7e8211fe24b815d51340346a557b53056454a",
"size": "2011",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Samples/PowerShell/ShardManagement/CreatePerformanceCounterCategory.ps1",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "3172361"
},
{
"name": "Smalltalk",
"bytes": "3106"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<title>Warp Protocol Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Protocol/Warp" class="dashAnchor"></a>
<a title="Warp Protocol Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html">Weavy Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html">Weavy Reference</a>
<img id="carat" src="../img/carat.png" />
Warp Protocol Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/Loom.html">Loom</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SingleWeftable.html">SingleWeftable</a>
</li>
<li class="nav-group-task">
<a href="../Classes/Warps.html">Warps</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/ObservableType.html">ObservableType</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Reactive.html">Reactive</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UIViewController.html">UIViewController</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UIWindow.html">UIWindow</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/HasDisposeBag.html">HasDisposeBag</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/Presentable.html">Presentable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols.html#/s:5Weavy14SynchronizableP">Synchronizable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/Warp.html">Warp</a>
</li>
<li class="nav-group-task">
<a href="../Protocols.html#/s:5Weavy4WeftP">Weft</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/Weftable.html">Weftable</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/Stitch.html">Stitch</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>Warp</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">Warp</span><span class="p">:</span> <span class="kt"><a href="../Protocols/Presentable.html">Presentable</a></span></code></pre>
</div>
</div>
<p>A Warp defines a clear navigation area. Combined to a Weft it leads to a navigation action</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:5Weavy4WarpP4knitSayAA6StitchVGAA4Weft_p04withE0_tF"></a>
<a name="//apple_ref/swift/Method/knit(withWeft:)" class="dashAnchor"></a>
<a class="token" href="#/s:5Weavy4WarpP4knitSayAA6StitchVGAA4Weft_p04withE0_tF">knit(withWeft:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Resolves Stitches according to the Weft, in the context of this very Warp</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">func</span> <span class="nf">knit</span> <span class="p">(</span><span class="n">withWeft</span> <span class="nv">weft</span><span class="p">:</span> <span class="kt"><a href="../Protocols.html#/s:5Weavy4WeftP">Weft</a></span><span class="p">)</span> <span class="o">-></span> <span class="p">[</span><span class="kt"><a href="../Structs/Stitch.html">Stitch</a></span><span class="p">]</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>weft</em>
</code>
</td>
<td>
<div>
<p>the weft emitted by one of the weftables declared in the Warp</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<h4>Return Value</h4>
<p>the stitches matching the weft. This stitches determines the next navigation steps (Presentables to display / Weftables to listen)</p>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:5Weavy4WarpP4headSo16UIViewControllerCv"></a>
<a name="//apple_ref/swift/Property/head" class="dashAnchor"></a>
<a class="token" href="#/s:5Weavy4WarpP4headSo16UIViewControllerCv">head</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>the UIViewController on which rely the navigation inside this Warp. This method must always give the same instance</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">var</span> <span class="nv">head</span><span class="p">:</span> <span class="kt">UIViewController</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:5Weavy4WarpPAAE9rxVisible7RxSwift10ObservableCySbGv"></a>
<a name="//apple_ref/swift/Property/rxVisible" class="dashAnchor"></a>
<a class="token" href="#/s:5Weavy4WarpPAAE9rxVisible7RxSwift10ObservableCySbGv">rxVisible</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Rx Observable that triggers a bool indicating if the current Warp is being displayed</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">rxVisible</span><span class="p">:</span> <span class="kt">Observable</span><span class="o"><</span><span class="kt">Bool</span><span class="o">></span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:5Weavy4WarpPAAE18rxFirstTimeVisible7RxSwift17PrimitiveSequenceVyAE11SingleTraitOytGv"></a>
<a name="//apple_ref/swift/Property/rxFirstTimeVisible" class="dashAnchor"></a>
<a class="token" href="#/s:5Weavy4WarpPAAE18rxFirstTimeVisible7RxSwift17PrimitiveSequenceVyAE11SingleTraitOytGv">rxFirstTimeVisible</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Rx Observable (Single trait) triggered when this Warp is displayed for the first time</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">rxFirstTimeVisible</span><span class="p">:</span> <span class="kt">Single</span><span class="o"><</span><span class="kt">Void</span><span class="o">></span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:5Weavy4WarpPAAE11rxDismissed7RxSwift17PrimitiveSequenceVyAE11SingleTraitOytGv"></a>
<a name="//apple_ref/swift/Property/rxDismissed" class="dashAnchor"></a>
<a class="token" href="#/s:5Weavy4WarpPAAE11rxDismissed7RxSwift17PrimitiveSequenceVyAE11SingleTraitOytGv">rxDismissed</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Rx Observable (Single trait) triggered when this Warp is dismissed</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">rxDismissed</span><span class="p">:</span> <span class="kt">Single</span><span class="o"><</span><span class="kt">Void</span><span class="o">></span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>© 2017 <a class="link" href="https://github.com/twittemb/Weavy" target="_blank" rel="external">Thibault Wittemberg</a>. All rights reserved. (Last updated: 2017-12-02)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>
| {
"content_hash": "59dbaba42f55152af170e5e104f8eb1e",
"timestamp": "",
"source": "github",
"line_count": 293,
"max_line_length": 480,
"avg_line_length": 47.27303754266212,
"alnum_prop": 0.4520251245397444,
"repo_name": "twittemb/Weavy",
"id": "6b642c701fe33f431ee7cc965b5ca151051eb918",
"size": "13855",
"binary": false,
"copies": "2",
"ref": "refs/heads/develop",
"path": "docs/docsets/Weavy.docset/Contents/Resources/Documents/Protocols/Warp.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "477"
},
{
"name": "Ruby",
"bytes": "1461"
},
{
"name": "Swift",
"bytes": "69044"
}
],
"symlink_target": ""
} |
/** @namespace fx.effects */
ECMAScript.Extend('fx.effects', function (ecma) {
var CEffect = ecma.fx.Effect;
var proto = ecma.lang.createPrototype(CEffect);
/**
* @class Style
*/
this.Style = function (elem, attr, p1, p2, units, duration) {
this.elem = ecma.dom.getElement(elem);
this.attr = attr;
this.units = units || '';
this.end = p2;
this.begin = p1;
this.dir = this.begin > this.end ? -1 : 1;
var delta = Math.abs(this.dir > 0 ? this.end - this.begin : this.end - this.begin);
CEffect.apply(this, [delta, duration]);
};
this.Style.prototype = proto;
proto.draw = function (action, progress) {
var d = this.getDelta() * progress.getProportion();
var value = (d * this.dir) + this.begin;
ecma.dom.setStyle(this.elem, this.attr, value + this.units);
//ecma.console.log(this.attr, value + this.units);
};
});
| {
"content_hash": "5431c57844b99e5d2cb662de1000c88e",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 87,
"avg_line_length": 27.75,
"alnum_prop": 0.6171171171171171,
"repo_name": "ryangies/lsn-javascript",
"id": "5e13f35d3bab5f14e2993186ef53ab4a846703fb",
"size": "888",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/lib/ecma/lsn/fx/effects/Style.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "8256"
},
{
"name": "JavaScript",
"bytes": "702597"
},
{
"name": "Perl",
"bytes": "48616"
},
{
"name": "Shell",
"bytes": "1470"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html>
<head>
<title>Postmodern Pachyderm</title>
<link rel="stylesheet", type="text/css", href="stylesheets/blog_template.css" >
</head>
<body>
<div id= "header">
<a href="http://adowns01.github.io/"><h1 id= "title">Postmodern Pachyderm</h1></a>
</div>
<div id= "content_container">
</div>
</body>
</html>
| {
"content_hash": "7b54d2b031856a2a917d82483c3714ce",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 84,
"avg_line_length": 16.095238095238095,
"alnum_prop": 0.6390532544378699,
"repo_name": "adowns01/adowns01.github.io",
"id": "b3e88a1c11ff22512403ba79614e800c547501d8",
"size": "338",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "unit1-projects/blog_template.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "20815"
},
{
"name": "JavaScript",
"bytes": "1144"
},
{
"name": "Ruby",
"bytes": "7636"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
Index Fungorum
#### Published in
Krypt. -Fl. Brandenburg (Leipzig) 7(3): 440 (1938)
#### Original name
Pleosphaerulina salicis Kirschst.
### Remarks
null | {
"content_hash": "6b2906d6e14b6ae37f548a3eaf6525bd",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 50,
"avg_line_length": 14.153846153846153,
"alnum_prop": 0.7065217391304348,
"repo_name": "mdoering/backbone",
"id": "cfc4403e33a16e370dce5a2013ae092d44359f70",
"size": "241",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Fungi/Ascomycota/Dothideomycetes/Dothideales/Dothioraceae/Pleosphaerulina/Pleosphaerulina salicis/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Window.cs" company="bbv Software Services AG">
// Copyright (c) 2014 - 2020
//
// 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.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace CleanCode.Testing.Sample.SameImplementation
{
using System.Drawing;
public class Window
{
public Color BorderColor { get; set; }
public SizeF Dimension { get; set; }
}
} | {
"content_hash": "7832ead4fea012fd4b772381d1acb394",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 120,
"avg_line_length": 39.6551724137931,
"alnum_prop": 0.5478260869565217,
"repo_name": "mmarkovic/CleanCode.Academy",
"id": "dadc1be68580746390294294f2f68a8448bb78e2",
"size": "1152",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "source/Testing.Sample/5 Builder with Syntax Sample/SameImplementation/Window.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "291912"
},
{
"name": "CSS",
"bytes": "2386"
},
{
"name": "JavaScript",
"bytes": "12505"
},
{
"name": "PowerShell",
"bytes": "2374"
},
{
"name": "Shell",
"bytes": "774"
}
],
"symlink_target": ""
} |
package net.glowstone.block.block2.details;
import net.glowstone.block.block2.IdResolver;
import net.glowstone.block.block2.sponge.BlockState;
import org.bukkit.TreeSpecies;
public class SaplingIdResolver implements IdResolver {
@Override
public int getId(BlockState state, int suggested) {
if (suggested >= TreeSpecies.values().length) {
suggested += 8 - TreeSpecies.values().length;
}
return suggested;
}
}
| {
"content_hash": "e0362256b8876935a609c9a75e30fe42",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 57,
"avg_line_length": 30.6,
"alnum_prop": 0.710239651416122,
"repo_name": "Tonodus/WaterGleam",
"id": "40af9480c33653e69614f5252026550777c460c1",
"size": "459",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/net/glowstone/block/block2/details/SaplingIdResolver.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "1469619"
},
{
"name": "Python",
"bytes": "1031"
},
{
"name": "Ruby",
"bytes": "335"
},
{
"name": "Shell",
"bytes": "2105"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>constructors: 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.15.0 / constructors - 1.0.0</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
constructors
<small>
1.0.0
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-04-08 22:17:07 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-04-08 22:17:07 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.15.0 Formal proof management system
dune 3.0.3 Fast, portable, and opinionated build system
ocaml 4.10.2 The OCaml compiler (virtual package)
ocaml-base-compiler 4.10.2 Official release 4.10.2
ocaml-config 1 OCaml Switch Configuration
ocamlfind 1.9.3 A library manager for OCaml
zarith 1.12 Implements arithmetic and logical operations over arbitrary-precision integers
# opam file:
opam-version: "2.0"
maintainer: "[email protected]"
homepage: "https://github.com/mattam82/Constructors"
bug-reports: "https://github.com/mattam82/Constructors/issues"
license: "MIT"
dev-repo: "git+https://github.com/mattam82/Constructors.git#v8.4"
build: [
["coq_makefile" "-f" "Make" "-o" "Makefile"]
[make "-j%{jobs}%"]
]
install: [
[make "install"]
]
remove: ["rm" "-R" "%{lib}%/coq/user-contrib/Constructors"]
depends: [
"ocaml"
"coq" {>= "8.4.5" & < "8.5~"}
]
synopsis: "An example Coq plugin, defining a tactic to get the constructors of an inductive type in a list"
authors: "Matthieu Sozeau <[email protected]>"
flags: light-uninstall
url {
src: "https://github.com/mattam82/Constructors/archive/1.0.0.tar.gz"
checksum: "md5=6a2b355fa0b43233f281c3ef9ba1499d"
}
</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-constructors.1.0.0 coq.8.15.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.15.0).
The following dependencies couldn't be met:
- coq-constructors -> coq < 8.5~ -> ocaml < 4.03.0
base of this switch (use `--unlock-base' to force)
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-constructors.1.0.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": "bfea936d3254d71a66ff8f08083a806b",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 159,
"avg_line_length": 40.96969696969697,
"alnum_prop": 0.5356508875739645,
"repo_name": "coq-bench/coq-bench.github.io",
"id": "4d0859e143634576dd56b645dbfdbfaff8a2445a",
"size": "6785",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clean/Linux-x86_64-4.10.2-2.0.6/released/8.15.0/constructors/1.0.0.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
/**
* Gulp tasks for docker platform.
*/
import * as del from "del";
import * as fs from "fs";
import * as gulp from "gulp";
import * as minimist from "minimist";
import * as path from "path";
import * as runSequence from "run-sequence";
import * as util from "util";
import { IUniteConfiguration } from "../../types/IUniteConfiguration";
import * as asyncUtil from "../util/async-util";
import * as display from "../util/display";
import * as exec from "../util/exec";
import * as packageConfig from "../util/package-config";
import * as platformUtils from "../util/platform-utils";
import * as uc from "../util/unite-config";
function loadOptions(uniteConfig: IUniteConfiguration): { image: string; www: string; save: boolean } {
const platformSettings = platformUtils.getConfig(uniteConfig, "Docker");
const knownOptions = {
default: {
image: platformSettings.image || "nginx",
www: platformSettings.www || "/usr/share/nginx/html",
save: false
},
string: [
"image",
"www"
],
boolean: [
"save"
]
};
return minimist<{ image: string; www: string; save: boolean }>(process.argv.slice(2), knownOptions);
}
gulp.task("platform-docker-package", async () => {
try {
await util.promisify(runSequence)(
"platform-docker-clean",
"platform-docker-gather",
"platform-docker-build-image",
"platform-docker-save"
);
} catch (err) {
display.error("Unhandled error during task", err);
process.exit(1);
}
});
gulp.task("platform-docker-clean", async () => {
const uniteConfig = await uc.getUniteConfig();
const packageJson = await packageConfig.getPackageJson();
const options = loadOptions(uniteConfig);
const toClean = [
path.join("../", uniteConfig.dirs.packagedRoot, `/${packageJson.version}/docker_${options.image}/**/*`),
path.join("../", uniteConfig.dirs.packagedRoot, `/${packageJson.version}_docker_${options.image}.tar`)
];
display.info("Cleaning", toClean);
return del(toClean, { force: true });
});
gulp.task("platform-docker-gather", async () => {
const uniteConfig = await uc.getUniteConfig();
const buildConfiguration = uc.getBuildConfiguration(uniteConfig, false);
const packageJson = await packageConfig.getPackageJson();
const options = loadOptions(uniteConfig);
const platformName = `docker_${options.image}`;
const gatherRoot = path.join(
"../",
uniteConfig.dirs.packagedRoot,
`/${packageJson.version}/${platformName.toLowerCase()}/`,
options.www
);
await platformUtils.gatherFiles(
uniteConfig,
buildConfiguration,
packageJson,
platformName,
gatherRoot
);
display.info("Copying Image Additions");
return asyncUtil.stream(gulp.src(path.join(
uniteConfig.dirs.www.assetsSrc,
`docker/${options.image}/**/*`
),
{ dot: true })
.pipe(gulp.dest(gatherRoot)));
});
gulp.task("platform-docker-build-image", async () => {
const uniteConfig = await uc.getUniteConfig();
const packageJson = await packageConfig.getPackageJson();
const options = loadOptions(uniteConfig);
display.info("Writing Dockerfile");
const platformRoot = path.resolve(path.join(
"../",
uniteConfig.dirs.packagedRoot,
`/${packageJson.version}/`
));
const dockerFilename = path.join(platformRoot, "dockerfile");
try {
const dockerFile = `FROM ${options.image}\nCOPY docker_${options.image} /`;
await util.promisify(fs.writeFile)(dockerFilename, dockerFile);
} catch (err) {
display.error("Creating dockerfile failed", err);
process.exit(1);
}
display.info("Building Image", "Docker");
const tagName = `${packageJson.name}:v${packageJson.version}`;
try {
await exec.launch("docker", [
"build",
".",
"--file=dockerfile",
"--pull",
`--tag=${tagName}`
], platformRoot);
} catch (err) {
display.error("Building docker image failed", err);
process.exit(1);
}
try {
const dockerArchive = path.resolve(path.join(
"../",
uniteConfig.dirs.packagedRoot
));
await exec.launch("docker", [
"save",
`--output=${packageJson.version}_docker_${options.image}.tar`,
tagName
], dockerArchive);
} catch (err) {
display.error("Saving docker image failed", err);
process.exit(1);
}
return del([dockerFilename], { force: true });
});
gulp.task("platform-docker-save", async () => {
const uniteConfig = await uc.getUniteConfig();
const knownOptions: { default: { [id: string]: any}; string: string[]; boolean: string[] } = {
default: {
image: undefined,
www: undefined,
save: false
},
string: [
"image",
"www"
],
boolean: [
"save"
]
};
const options = minimist(process.argv.slice(2), knownOptions);
try {
if (options.save) {
display.info("Saving Options");
uniteConfig.platforms.Docker = uniteConfig.platforms.Docker || {};
if (options.image !== undefined) {
if (options.image === "") {
delete uniteConfig.platforms.Docker.image;
} else {
uniteConfig.platforms.Docker.image = options.image;
}
}
if (options.www !== undefined) {
if (options.www === "") {
delete uniteConfig.platforms.Docker.www;
} else {
uniteConfig.platforms.Docker.www = options.www;
}
}
await uc.setUniteConfig(uniteConfig);
}
} catch (err) {
display.error("Saving options failed", err);
process.exit(1);
}
});
// Generated by UniteJS
| {
"content_hash": "58579217a131f45a7292aef4e7a3a49b",
"timestamp": "",
"source": "github",
"line_count": 210,
"max_line_length": 112,
"avg_line_length": 30.142857142857142,
"alnum_prop": 0.5581358609794629,
"repo_name": "unitejs/engine",
"id": "47d7daf39374406834b858ac3b32ba829849d4db",
"size": "6330",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "assets/gulp/src/tasks/platform/platform-docker.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "9458"
},
{
"name": "HTML",
"bytes": "1359"
},
{
"name": "JavaScript",
"bytes": "58087"
},
{
"name": "TypeScript",
"bytes": "1692524"
},
{
"name": "Vue",
"bytes": "409"
}
],
"symlink_target": ""
} |
module BitAttrs
class ActiveRecordBinding
def self.should_be_created?(klass)
return false unless defined?(ActiveRecord)
return false unless klass.ancestors.include?(ActiveRecord::Base)
true
end
def self.with(klass, attr_name, bitset)
klass.where("#{attr_name}_mask & ? = ?", bitset.to_i, bitset.to_i)
end
def self.without(klass, attr_name, bitset)
klass.where("#{attr_name}_mask IS NULL OR #{attr_name}_mask & ? = ?", bitset.to_i, 0)
end
end
end
| {
"content_hash": "f1ad442e51e313ace4be932d9f785ee9",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 91,
"avg_line_length": 25.45,
"alnum_prop": 0.6463654223968566,
"repo_name": "rsamoilov/bit_attrs",
"id": "10ca3301107d8ce4b7a0ba3bea9e1e81d5121563",
"size": "509",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/bit_attrs/bindings/active_record_binding.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "13303"
},
{
"name": "Shell",
"bytes": "131"
}
],
"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("ModernWPF.PCL.Web")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ModernWPF.PCL.Web")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[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("4f2248ae-adde-471d-91af-e1b2f125e490")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| {
"content_hash": "7b38e5d56c87b753a18141e37dcbbd81",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 84,
"avg_line_length": 40.05714285714286,
"alnum_prop": 0.7289586305278174,
"repo_name": "dschenkelman/modern-wpf",
"id": "a2a7a06d551463c170ce3cec30ca61ca0d3a3980",
"size": "1405",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/ModernWPF.PCL/ModernWPF.PCL.Web/Properties/AssemblyInfo.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "340"
},
{
"name": "C#",
"bytes": "93814"
},
{
"name": "CSS",
"bytes": "13944"
},
{
"name": "JavaScript",
"bytes": "245662"
}
],
"symlink_target": ""
} |
$BUTTON_A = 0;
$BUTTON_B = 1;
$BUTTON_X = 2;
$BUTTON_Y = 3;
//------------------------------------------------------------------------------
// GamepadButtonsGui methods
//------------------------------------------------------------------------------
/// Callback when this control wakes up. All buttons are set to invisible and
/// disabled.
function GamepadButtonsGui::onWake(%this)
{
%this.setButton($BUTTON_A);
%this.setButton($BUTTON_B);
%this.setButton($BUTTON_X);
%this.setButton($BUTTON_Y);
}
/// Sets the command and text for the specified button. If %text and %command
/// are left empty, the button will be disabled and hidden.
/// Note: This command is not executed when the A button is pressed. That
/// command is executed directly from the GuiGameList___Ctrl. This command is
/// for the graphical hint and to allow a mouse equivalent.
///
/// \param %button (constant) The button to set. See: $BUTTON_A, _B, _X, _Y
/// \param %text (string) The text to display next to the A button graphic.
/// \param %command (string) The command executed when the A button is pressed.
function GamepadButtonsGui::setButton(%this, %button, %text, %command)
{
switch (%button)
{
case $BUTTON_A :
%labelCtrl = ButtonALabel;
%buttonCtrl = ButtonAButton;
%imgCtrl = ButtonAImg;
case $BUTTON_B :
%labelCtrl = ButtonBLabel;
%buttonCtrl = ButtonBButton;
%imgCtrl = ButtonBImg;
case $BUTTON_X :
%labelCtrl = ButtonXLabel;
%buttonCtrl = ButtonXButton;
%imgCtrl = ButtonXImg;
case $BUTTON_Y :
%labelCtrl = ButtonYLabel;
%buttonCtrl = ButtonYButton;
%imgCtrl = ButtonYImg;
default:
error("GamepadButtonsGui::setButton(" @ %button @ ", " @ %text @ ", " @ %command @ "). No valid button was specified. Please pass one of the $BUTTON_ globals for this parameter.");
return "";
}
%set = (! ((%text $= "") && (%command $= "")));
%labelCtrl.setText(%text);
%labelCtrl.setActive(%set);
%labelCtrl.setVisible(%set);
%buttonCtrl.Command = %command;
%buttonCtrl.setActive(%set);
%buttonCtrl.setVisible(%set);
%imgCtrl.setActive(%set);
%imgCtrl.setVisible(%set);
}
| {
"content_hash": "0a139683ea25cab67c401cfc0560a548",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 189,
"avg_line_length": 32.89855072463768,
"alnum_prop": 0.5872246696035243,
"repo_name": "AnteSim/Verve",
"id": "de958df23c4e6fff66681ea47e52e5775fc3eb96",
"size": "2654",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Templates/Verve/game/core/unifiedShell/GamepadButtonsGui.cs",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
package com.tencent.connect.auth;
public class AuthConstants
{
public static final String CANCEL_URI = "auth://cancel";
public static final String CLOSE_URI = "auth://close";
public static final String DOWNLOAD_URI = "download://";
public static final String REDIRECT_BROWSER_URI = "auth://browser";
public AuthConstants()
{
}
}
| {
"content_hash": "e448a8a64b07e100b65edb6b4c31b18b",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 71,
"avg_line_length": 24.066666666666666,
"alnum_prop": 0.6842105263157895,
"repo_name": "machinahub/MiBandDecompiled",
"id": "58c1c8e072f59a22b1428caf7168ebb020e5f926",
"size": "536",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Original Files/source/src/com/tencent/connect/auth/AuthConstants.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "109824"
},
{
"name": "Java",
"bytes": "8906016"
},
{
"name": "Lua",
"bytes": "134432"
},
{
"name": "Smali",
"bytes": "48075881"
}
],
"symlink_target": ""
} |
#ifdef KROLL_COVERAGE
#import "TiBase.h"
#import "KrollObject.h"
#import "KrollMethod.h"
#define COMPONENT_TYPE_PROXIES @"proxies"
#define COMPONENT_TYPE_MODULES @"modules"
#define COMPONENT_TYPE_OTHER @"other"
#define API_TYPE_FUNCTION @"function"
#define API_TYPE_PROPERTY @"property"
#define COVERAGE_TYPE_GET @"propertyGet"
#define COVERAGE_TYPE_SET @"propertySet"
#define COVERAGE_TYPE_CALL @"functionCall"
#define TOP_LEVEL @"TOP_LEVEL"
@protocol KrollCoverage <NSObject>
-(void)increment:(NSString*)apiName coverageType:(NSString*)coverageType apiType:(NSString*)apiType;
-(NSString*)coverageName;
-(NSString*)coverageType;
@end
@interface KrollCoverageObject : KrollObject <KrollCoverage> {
@private
NSString *componentName, *componentType;
}
@property(nonatomic,copy) NSString *componentName;
@property(nonatomic,copy) NSString *componentType;
+(void)incrementCoverage:(NSString*)componentType_ componentName:(NSString*)componentName_ apiName:(NSString*)apiName_ coverageType:(NSString*)coverageType_ apiType:(NSString*)apiType_;
+(void)incrementTopLevelFunctionCall:(NSString*)componentName name:(NSString*)apiName;
+(NSDictionary*)dumpCoverage;
+(void)releaseCoverage;
-(id)initWithTarget:(id)target_ context:(KrollContext*)context_;
-(id)initWithTarget:(id)target_ context:(KrollContext*)context_ componentName:(NSString*)componentName_;
@end
@interface KrollCoverageMethod : KrollMethod <KrollCoverage> {
@private
NSString *parentName, *parentType;
id<KrollCoverage> parent;
}
@property(nonatomic,copy) NSString *parentName;
@property(nonatomic,copy) NSString *parentType;
-(id)initWithTarget:(id)target_ context:(KrollContext *)context_ parent:(id<KrollCoverage>)parent_;
-(id)initWithTarget:(id)target_ selector:(SEL)selector_ argcount:(int)argcount_ type:(KrollMethodType)type_ name:(id)name_ context:(KrollContext*)context_ parent:(id)parent_;
-(id)call:(NSArray*)args;
@end
#endif | {
"content_hash": "f2310e70fae0ce73e05c1bacdd8f3974",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 185,
"avg_line_length": 31.016129032258064,
"alnum_prop": 0.7795111804472179,
"repo_name": "alanleard/AvrilFoundation",
"id": "bf0fcd1db863e3cdce1efd68d4c897d74951d328",
"size": "2225",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "build/iphone/Classes/KrollCoverage.h",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/devtools/artifactregistry/v1beta2/tag.proto
package com.google.devtools.artifactregistry.v1beta2;
/**
*
*
* <pre>
* Tags point to a version and represent an alternative name that can be used
* to access the version.
* </pre>
*
* Protobuf type {@code google.devtools.artifactregistry.v1beta2.Tag}
*/
public final class Tag extends com.google.protobuf.GeneratedMessageV3
implements
// @@protoc_insertion_point(message_implements:google.devtools.artifactregistry.v1beta2.Tag)
TagOrBuilder {
private static final long serialVersionUID = 0L;
// Use Tag.newBuilder() to construct.
private Tag(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private Tag() {
name_ = "";
version_ = "";
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
return new Tag();
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
return this.unknownFields;
}
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
return com.google.devtools.artifactregistry.v1beta2.TagProto
.internal_static_google_devtools_artifactregistry_v1beta2_Tag_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.google.devtools.artifactregistry.v1beta2.TagProto
.internal_static_google_devtools_artifactregistry_v1beta2_Tag_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.google.devtools.artifactregistry.v1beta2.Tag.class,
com.google.devtools.artifactregistry.v1beta2.Tag.Builder.class);
}
public static final int NAME_FIELD_NUMBER = 1;
private volatile java.lang.Object name_;
/**
*
*
* <pre>
* The name of the tag, for example:
* "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/tags/tag1".
* If the package part contains slashes, the slashes are escaped.
* The tag part can only have characters in [a-zA-Z0-9\-._~:@], anything else
* must be URL encoded.
* </pre>
*
* <code>string name = 1;</code>
*
* @return The name.
*/
@java.lang.Override
public java.lang.String getName() {
java.lang.Object ref = name_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
name_ = s;
return s;
}
}
/**
*
*
* <pre>
* The name of the tag, for example:
* "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/tags/tag1".
* If the package part contains slashes, the slashes are escaped.
* The tag part can only have characters in [a-zA-Z0-9\-._~:@], anything else
* must be URL encoded.
* </pre>
*
* <code>string name = 1;</code>
*
* @return The bytes for name.
*/
@java.lang.Override
public com.google.protobuf.ByteString getNameBytes() {
java.lang.Object ref = name_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
name_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int VERSION_FIELD_NUMBER = 2;
private volatile java.lang.Object version_;
/**
*
*
* <pre>
* The name of the version the tag refers to, for example:
* "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/sha256:5243811"
* If the package or version ID parts contain slashes, the slashes are
* escaped.
* </pre>
*
* <code>string version = 2;</code>
*
* @return The version.
*/
@java.lang.Override
public java.lang.String getVersion() {
java.lang.Object ref = version_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
version_ = s;
return s;
}
}
/**
*
*
* <pre>
* The name of the version the tag refers to, for example:
* "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/sha256:5243811"
* If the package or version ID parts contain slashes, the slashes are
* escaped.
* </pre>
*
* <code>string version = 2;</code>
*
* @return The bytes for version.
*/
@java.lang.Override
public com.google.protobuf.ByteString getVersionBytes() {
java.lang.Object ref = version_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
version_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_);
}
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(version_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 2, version_);
}
getUnknownFields().writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_);
}
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(version_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, version_);
}
size += getUnknownFields().getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof com.google.devtools.artifactregistry.v1beta2.Tag)) {
return super.equals(obj);
}
com.google.devtools.artifactregistry.v1beta2.Tag other =
(com.google.devtools.artifactregistry.v1beta2.Tag) obj;
if (!getName().equals(other.getName())) return false;
if (!getVersion().equals(other.getVersion())) return false;
if (!getUnknownFields().equals(other.getUnknownFields())) return false;
return true;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + NAME_FIELD_NUMBER;
hash = (53 * hash) + getName().hashCode();
hash = (37 * hash) + VERSION_FIELD_NUMBER;
hash = (53 * hash) + getVersion().hashCode();
hash = (29 * hash) + getUnknownFields().hashCode();
memoizedHashCode = hash;
return hash;
}
public static com.google.devtools.artifactregistry.v1beta2.Tag parseFrom(java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.devtools.artifactregistry.v1beta2.Tag parseFrom(
java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.devtools.artifactregistry.v1beta2.Tag parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.devtools.artifactregistry.v1beta2.Tag parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.devtools.artifactregistry.v1beta2.Tag parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.devtools.artifactregistry.v1beta2.Tag parseFrom(
byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.devtools.artifactregistry.v1beta2.Tag parseFrom(
java.io.InputStream input) throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
}
public static com.google.devtools.artifactregistry.v1beta2.Tag parseFrom(
java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
PARSER, input, extensionRegistry);
}
public static com.google.devtools.artifactregistry.v1beta2.Tag parseDelimitedFrom(
java.io.InputStream input) throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
}
public static com.google.devtools.artifactregistry.v1beta2.Tag parseDelimitedFrom(
java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
PARSER, input, extensionRegistry);
}
public static com.google.devtools.artifactregistry.v1beta2.Tag parseFrom(
com.google.protobuf.CodedInputStream input) throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
}
public static com.google.devtools.artifactregistry.v1beta2.Tag parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
PARSER, input, extensionRegistry);
}
@java.lang.Override
public Builder newBuilderForType() {
return newBuilder();
}
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(com.google.devtools.artifactregistry.v1beta2.Tag prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@java.lang.Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
*
*
* <pre>
* Tags point to a version and represent an alternative name that can be used
* to access the version.
* </pre>
*
* Protobuf type {@code google.devtools.artifactregistry.v1beta2.Tag}
*/
public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
implements
// @@protoc_insertion_point(builder_implements:google.devtools.artifactregistry.v1beta2.Tag)
com.google.devtools.artifactregistry.v1beta2.TagOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
return com.google.devtools.artifactregistry.v1beta2.TagProto
.internal_static_google_devtools_artifactregistry_v1beta2_Tag_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.google.devtools.artifactregistry.v1beta2.TagProto
.internal_static_google_devtools_artifactregistry_v1beta2_Tag_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.google.devtools.artifactregistry.v1beta2.Tag.class,
com.google.devtools.artifactregistry.v1beta2.Tag.Builder.class);
}
// Construct using com.google.devtools.artifactregistry.v1beta2.Tag.newBuilder()
private Builder() {}
private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
}
@java.lang.Override
public Builder clear() {
super.clear();
name_ = "";
version_ = "";
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
return com.google.devtools.artifactregistry.v1beta2.TagProto
.internal_static_google_devtools_artifactregistry_v1beta2_Tag_descriptor;
}
@java.lang.Override
public com.google.devtools.artifactregistry.v1beta2.Tag getDefaultInstanceForType() {
return com.google.devtools.artifactregistry.v1beta2.Tag.getDefaultInstance();
}
@java.lang.Override
public com.google.devtools.artifactregistry.v1beta2.Tag build() {
com.google.devtools.artifactregistry.v1beta2.Tag result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public com.google.devtools.artifactregistry.v1beta2.Tag buildPartial() {
com.google.devtools.artifactregistry.v1beta2.Tag result =
new com.google.devtools.artifactregistry.v1beta2.Tag(this);
result.name_ = name_;
result.version_ = version_;
onBuilt();
return result;
}
@java.lang.Override
public Builder clone() {
return super.clone();
}
@java.lang.Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
return super.setField(field, value);
}
@java.lang.Override
public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@java.lang.Override
public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@java.lang.Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) {
return super.setRepeatedField(field, index, value);
}
@java.lang.Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
return super.addRepeatedField(field, value);
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.google.devtools.artifactregistry.v1beta2.Tag) {
return mergeFrom((com.google.devtools.artifactregistry.v1beta2.Tag) other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.google.devtools.artifactregistry.v1beta2.Tag other) {
if (other == com.google.devtools.artifactregistry.v1beta2.Tag.getDefaultInstance())
return this;
if (!other.getName().isEmpty()) {
name_ = other.name_;
onChanged();
}
if (!other.getVersion().isEmpty()) {
version_ = other.version_;
onChanged();
}
this.mergeUnknownFields(other.getUnknownFields());
onChanged();
return this;
}
@java.lang.Override
public final boolean isInitialized() {
return true;
}
@java.lang.Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 10:
{
name_ = input.readStringRequireUtf8();
break;
} // case 10
case 18:
{
version_ = input.readStringRequireUtf8();
break;
} // case 18
default:
{
if (!super.parseUnknownField(input, extensionRegistry, tag)) {
done = true; // was an endgroup tag
}
break;
} // default:
} // switch (tag)
} // while (!done)
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.unwrapIOException();
} finally {
onChanged();
} // finally
return this;
}
private java.lang.Object name_ = "";
/**
*
*
* <pre>
* The name of the tag, for example:
* "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/tags/tag1".
* If the package part contains slashes, the slashes are escaped.
* The tag part can only have characters in [a-zA-Z0-9\-._~:@], anything else
* must be URL encoded.
* </pre>
*
* <code>string name = 1;</code>
*
* @return The name.
*/
public java.lang.String getName() {
java.lang.Object ref = name_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
name_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
*
*
* <pre>
* The name of the tag, for example:
* "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/tags/tag1".
* If the package part contains slashes, the slashes are escaped.
* The tag part can only have characters in [a-zA-Z0-9\-._~:@], anything else
* must be URL encoded.
* </pre>
*
* <code>string name = 1;</code>
*
* @return The bytes for name.
*/
public com.google.protobuf.ByteString getNameBytes() {
java.lang.Object ref = name_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
name_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
*
*
* <pre>
* The name of the tag, for example:
* "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/tags/tag1".
* If the package part contains slashes, the slashes are escaped.
* The tag part can only have characters in [a-zA-Z0-9\-._~:@], anything else
* must be URL encoded.
* </pre>
*
* <code>string name = 1;</code>
*
* @param value The name to set.
* @return This builder for chaining.
*/
public Builder setName(java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
name_ = value;
onChanged();
return this;
}
/**
*
*
* <pre>
* The name of the tag, for example:
* "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/tags/tag1".
* If the package part contains slashes, the slashes are escaped.
* The tag part can only have characters in [a-zA-Z0-9\-._~:@], anything else
* must be URL encoded.
* </pre>
*
* <code>string name = 1;</code>
*
* @return This builder for chaining.
*/
public Builder clearName() {
name_ = getDefaultInstance().getName();
onChanged();
return this;
}
/**
*
*
* <pre>
* The name of the tag, for example:
* "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/tags/tag1".
* If the package part contains slashes, the slashes are escaped.
* The tag part can only have characters in [a-zA-Z0-9\-._~:@], anything else
* must be URL encoded.
* </pre>
*
* <code>string name = 1;</code>
*
* @param value The bytes for name to set.
* @return This builder for chaining.
*/
public Builder setNameBytes(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
name_ = value;
onChanged();
return this;
}
private java.lang.Object version_ = "";
/**
*
*
* <pre>
* The name of the version the tag refers to, for example:
* "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/sha256:5243811"
* If the package or version ID parts contain slashes, the slashes are
* escaped.
* </pre>
*
* <code>string version = 2;</code>
*
* @return The version.
*/
public java.lang.String getVersion() {
java.lang.Object ref = version_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
version_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
*
*
* <pre>
* The name of the version the tag refers to, for example:
* "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/sha256:5243811"
* If the package or version ID parts contain slashes, the slashes are
* escaped.
* </pre>
*
* <code>string version = 2;</code>
*
* @return The bytes for version.
*/
public com.google.protobuf.ByteString getVersionBytes() {
java.lang.Object ref = version_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
version_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
*
*
* <pre>
* The name of the version the tag refers to, for example:
* "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/sha256:5243811"
* If the package or version ID parts contain slashes, the slashes are
* escaped.
* </pre>
*
* <code>string version = 2;</code>
*
* @param value The version to set.
* @return This builder for chaining.
*/
public Builder setVersion(java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
version_ = value;
onChanged();
return this;
}
/**
*
*
* <pre>
* The name of the version the tag refers to, for example:
* "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/sha256:5243811"
* If the package or version ID parts contain slashes, the slashes are
* escaped.
* </pre>
*
* <code>string version = 2;</code>
*
* @return This builder for chaining.
*/
public Builder clearVersion() {
version_ = getDefaultInstance().getVersion();
onChanged();
return this;
}
/**
*
*
* <pre>
* The name of the version the tag refers to, for example:
* "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/sha256:5243811"
* If the package or version ID parts contain slashes, the slashes are
* escaped.
* </pre>
*
* <code>string version = 2;</code>
*
* @param value The bytes for version to set.
* @return This builder for chaining.
*/
public Builder setVersionBytes(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
version_ = value;
onChanged();
return this;
}
@java.lang.Override
public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
}
@java.lang.Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:google.devtools.artifactregistry.v1beta2.Tag)
}
// @@protoc_insertion_point(class_scope:google.devtools.artifactregistry.v1beta2.Tag)
private static final com.google.devtools.artifactregistry.v1beta2.Tag DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new com.google.devtools.artifactregistry.v1beta2.Tag();
}
public static com.google.devtools.artifactregistry.v1beta2.Tag getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<Tag> PARSER =
new com.google.protobuf.AbstractParser<Tag>() {
@java.lang.Override
public Tag parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
Builder builder = newBuilder();
try {
builder.mergeFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(builder.buildPartial());
} catch (com.google.protobuf.UninitializedMessageException e) {
throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(e)
.setUnfinishedMessage(builder.buildPartial());
}
return builder.buildPartial();
}
};
public static com.google.protobuf.Parser<Tag> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<Tag> getParserForType() {
return PARSER;
}
@java.lang.Override
public com.google.devtools.artifactregistry.v1beta2.Tag getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
| {
"content_hash": "096e03f65d790562a942e997e96e22a6",
"timestamp": "",
"source": "github",
"line_count": 830,
"max_line_length": 100,
"avg_line_length": 32.4289156626506,
"alnum_prop": 0.6598305840392331,
"repo_name": "googleapis/java-artifact-registry",
"id": "3a16da0b9354a36cc02c1c662c96cdf2eead38dc",
"size": "27510",
"binary": false,
"copies": "2",
"ref": "refs/heads/main",
"path": "proto-google-cloud-artifact-registry-v1beta2/src/main/java/com/google/devtools/artifactregistry/v1beta2/Tag.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "801"
},
{
"name": "Java",
"bytes": "5058549"
},
{
"name": "Python",
"bytes": "788"
},
{
"name": "Shell",
"bytes": "20474"
}
],
"symlink_target": ""
} |
<?php
/**
* Step 2 : check system configuration (permissions on folders, PHP version, etc.)
*/
class InstallControllerHttpSystem extends InstallControllerHttp
{
public $tests = array();
/**
* @var InstallModelSystem
*/
public $model_system;
/**
* @see InstallAbstractModel::init()
*/
public function init()
{
require_once _PS_INSTALL_MODELS_PATH_.'system.php';
$this->model_system = new InstallModelSystem();
}
/**
* @see InstallAbstractModel::processNextStep()
*/
public function processNextStep()
{
}
/**
* Required tests must be passed to validate this step
*
* @see InstallAbstractModel::validate()
*/
public function validate()
{
$this->tests['required'] = $this->model_system->checkRequiredTests();
return $this->tests['required']['success'];
}
/**
* Display system step
*/
public function display()
{
if (!isset($this->tests['required']))
$this->tests['required'] = $this->model_system->checkRequiredTests();
if (!isset($this->tests['optional']))
$this->tests['optional'] = $this->model_system->checkOptionalTests();
// Generate display array
$this->tests_render = array(
'required' => array(
array(
'title' => $this->l('PHP parameters:'),
'success' => 1,
'checks' => array(
'phpversion' => $this->l('PHP 5.1.2 or later is not enabled'),
'upload' => $this->l('Cannot upload files'),
'system' => $this->l('Cannot create new files and folders'),
'gd' => $this->l('GD Library is not installed'),
'mysql_support' => $this->l('MySQL support is not activated'),
)
),
array(
'title' => $this->l('Recursive write permissions on files and folders:'),
'success' => 1,
'checks' => array(
'config_dir' => '~/config/',
'cache_dir' => '~/cache/',
'log_dir' => '~/log/',
'img_dir' => '~/img/',
'mails_dir' => '~/mails/',
'module_dir' => '~/modules/',
'theme_lang_dir' => '~/themes/default/lang/',
'theme_pdf_lang_dir' => '~/themes/default/pdf/lang/',
'theme_cache_dir' => '~/themes/default/cache/',
'translations_dir' => '~/translations/',
'customizable_products_dir' => '~/upload/',
'virtual_products_dir' => '~/download/',
'sitemap' => '~/sitemap.xml',
)
),
),
'optional' => array(
array(
'title' => $this->l('PHP parameters:'),
'success' => $this->tests['optional']['success'],
'checks' => array(
'fopen' => $this->l('Cannot open external URLs'),
'register_globals' => $this->l('PHP register global option is on'),
'gz' => $this->l('GZIP compression is not activated'),
'mcrypt' => $this->l('Mcrypt extension is not enabled'),
'mbstring' => $this->l('Mbstring extension is not enabled'),
'magicquotes' => $this->l('PHP magic quotes option is enabled'),
'dom' => $this->l('Dom extension is not loaded'),
'pdo_mysql' => $this->l('PDO MySQL extension is not loaded'),
)
),
),
);
foreach ($this->tests_render['required'] as &$category)
foreach ($category['checks'] as $id => $check)
if ($this->tests['required']['checks'][$id] != 'ok')
$category['success'] = 0;
// If required tests failed, disable next button
if (!$this->tests['required']['success'])
$this->next_button = false;
$this->displayTemplate('system');
}
} | {
"content_hash": "9a607534143fbd9bf3a125021da77da2",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 82,
"avg_line_length": 29.76923076923077,
"alnum_prop": 0.5664656904966983,
"repo_name": "rafaeljuzo/makeuptown",
"id": "e0c79958002080719b5eaeae47dcf18f068e0784",
"size": "4474",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "site/install/controllers/http/system.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "1284076"
},
{
"name": "PHP",
"bytes": "14546161"
}
],
"symlink_target": ""
} |
import sys
import matplotlib
from matplotlib import style
import cloudside
matplotlib.use("agg")
style.use("classic")
if "--strict" in sys.argv:
sys.argv.remove("--strict")
status = cloudside.teststrict(*sys.argv[1:])
else:
status = cloudside.test(*sys.argv[1:])
sys.exit(status)
| {
"content_hash": "22e4b5616f23eb8cb591f832d5787136",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 48,
"avg_line_length": 18.5,
"alnum_prop": 0.706081081081081,
"repo_name": "phobson/cloudside",
"id": "e0232b22e356c82bd6b1e186277f01690dc7c00c",
"size": "296",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "check_cloudside.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Python",
"bytes": "94088"
}
],
"symlink_target": ""
} |
package components;
/*
* TableRenderDemo.java requires no other files.
*/
import javax.swing.DefaultCellEditor;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.GridLayout;
/**
* TableRenderDemo is just like TableDemo, except that it explicitly initializes
* column sizes and it uses a combo box as an editor for the Sport column.
*/
public class TableRenderDemo extends JPanel {
private boolean DEBUG = false;
public TableRenderDemo() {
super(new GridLayout(1, 0));
JTable table = new JTable(new MyTableModel());
table.setPreferredScrollableViewportSize(new Dimension(500, 70));
table.setFillsViewportHeight(true);
// Create the scroll pane and add the table to it.
JScrollPane scrollPane = new JScrollPane(table);
// Set up column sizes.
initColumnSizes(table);
// Fiddle with the Sport column's cell editors/renderers.
setUpSportColumn(table, table.getColumnModel().getColumn(2));
// Add the scroll pane to this panel.
add(scrollPane);
}
/*
* This method picks good column sizes. If all column heads are wider than
* the column's cells' contents, then you can just use
* column.sizeWidthToFit().
*/
private void initColumnSizes(JTable table) {
MyTableModel model = (MyTableModel) table.getModel();
TableColumn column = null;
Component comp = null;
int headerWidth = 0;
int cellWidth = 0;
Object[] longValues = model.longValues;
TableCellRenderer headerRenderer = table.getTableHeader().getDefaultRenderer();
for (int i = 0; i < 5; i++) {
column = table.getColumnModel().getColumn(i);
comp = headerRenderer.getTableCellRendererComponent(null, column.getHeaderValue(), false, false, 0, 0);
headerWidth = comp.getPreferredSize().width;
comp = table.getDefaultRenderer(model.getColumnClass(i)).getTableCellRendererComponent(table, longValues[i], false,
false, 0, i);
cellWidth = comp.getPreferredSize().width;
if (DEBUG) {
System.out.println(
"Initializing width of column " + i + ". " + "headerWidth = " + headerWidth + "; cellWidth = " + cellWidth);
}
column.setPreferredWidth(Math.max(headerWidth, cellWidth));
}
}
public void setUpSportColumn(JTable table, TableColumn sportColumn) {
// Set up the editor for the sport cells.
JComboBox comboBox = new JComboBox();
comboBox.addItem("Snowboarding");
comboBox.addItem("Rowing");
comboBox.addItem("Knitting");
comboBox.addItem("Speed reading");
comboBox.addItem("Pool");
comboBox.addItem("None of the above");
sportColumn.setCellEditor(new DefaultCellEditor(comboBox));
// Set up tool tips for the sport cells.
DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
renderer.setToolTipText("Click for combo box");
sportColumn.setCellRenderer(renderer);
}
class MyTableModel extends AbstractTableModel {
private String[] columnNames = { "First Name", "Last Name", "Sport", "# of Years", "Vegetarian" };
private Object[][] data = { { "Kathy", "Smith", "Snowboarding", new Integer(5), new Boolean(false) },
{ "John", "Doe", "Rowing", new Integer(3), new Boolean(true) },
{ "Sue", "Black", "Knitting", new Integer(2), new Boolean(false) },
{ "Jane", "White", "Speed reading", new Integer(20), new Boolean(true) },
{ "Joe", "Brown", "Pool", new Integer(10), new Boolean(false) } };
public final Object[] longValues = { "Jane", "Kathy", "None of the above", new Integer(20), Boolean.TRUE };
public int getColumnCount() {
return columnNames.length;
}
public int getRowCount() {
return data.length;
}
public String getColumnName(int col) {
return columnNames[col];
}
public Object getValueAt(int row, int col) {
return data[row][col];
}
/*
* JTable uses this method to determine the default renderer/ editor for
* each cell. If we didn't implement this method, then the last column
* would contain text ("true"/"false"), rather than a check box.
*/
public Class getColumnClass(int c) {
return getValueAt(0, c).getClass();
}
/*
* Don't need to implement this method unless your table's editable.
*/
public boolean isCellEditable(int row, int col) {
// Note that the data/cell address is constant,
// no matter where the cell appears onscreen.
if (col < 2) {
return false;
} else {
return true;
}
}
/*
* Don't need to implement this method unless your table's data can
* change.
*/
public void setValueAt(Object value, int row, int col) {
if (DEBUG) {
System.out.println(
"Setting value at " + row + "," + col + " to " + value + " (an instance of " + value.getClass() + ")");
}
data[row][col] = value;
fireTableCellUpdated(row, col);
if (DEBUG) {
System.out.println("New value of data:");
printDebugData();
}
}
private void printDebugData() {
int numRows = getRowCount();
int numCols = getColumnCount();
for (int i = 0; i < numRows; i++) {
System.out.print(" row " + i + ":");
for (int j = 0; j < numCols; j++) {
System.out.print(" " + data[i][j]);
}
System.out.println();
}
System.out.println("--------------------------");
}
}
/**
* Create the GUI and show it. For thread safety, this method should be
* invoked from the event-dispatching thread.
*/
private static void createAndShowGUI() {
// Create and set up the window.
JFrame frame = new JFrame("TableRenderDemo");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Create and set up the content pane.
TableRenderDemo newContentPane = new TableRenderDemo();
newContentPane.setOpaque(true); // content panes must be opaque
frame.setContentPane(newContentPane);
// Display the window.
frame.pack();
frame.setVisible(true);
}
public static void main(String[] args) {
// Schedule a job for the event-dispatching thread:
// creating and showing this application's GUI.
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
}
}
| {
"content_hash": "277786fa4a93d9f00f94cdd8f3cb000b",
"timestamp": "",
"source": "github",
"line_count": 210,
"max_line_length": 132,
"avg_line_length": 35.27619047619048,
"alnum_prop": 0.587877969762419,
"repo_name": "jalian-systems/marathonv5",
"id": "eac775c4595aa6f6fe7ecf1d1ad7203eee37cd1b",
"size": "9007",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "marathon-java/marathon-test-helpers/src/main/java/components/TableRenderDemo.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "AppleScript",
"bytes": "1764"
},
{
"name": "Batchfile",
"bytes": "6982"
},
{
"name": "CSS",
"bytes": "1787119"
},
{
"name": "HTML",
"bytes": "54026"
},
{
"name": "Java",
"bytes": "9276296"
},
{
"name": "JavaScript",
"bytes": "44347"
},
{
"name": "Ruby",
"bytes": "877513"
},
{
"name": "Shell",
"bytes": "580"
},
{
"name": "XSLT",
"bytes": "12141"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8" ?>
<Library name="sap.ui.table" xmlns="http://www.sap.com/ui5/ide/templates/xmlview">
<Template name="sap.ui.table.AnalyticalColumn" alias="AnalyticalColumn,Column">
<jsTemplate><![CDATA[new sap.ui.table.AnalyticalColumn({
id: "${id}", // sap.ui.core.ID
width: undefined, // sap.ui.core.CSSSize
flexible: true, // boolean
resizable: true, // boolean
hAlign: sap.ui.core.HorizontalAlign.Begin, // sap.ui.core.HorizontalAlign
sorted: false, // boolean
sortOrder: sap.ui.table.SortOrder.Ascending, // sap.ui.table.SortOrder
sortProperty: undefined, // string
filtered: false, // boolean
filterProperty: undefined, // string
filterValue: undefined, // string
filterOperator: undefined, // string
grouped: false, // boolean
visible: true, // boolean
filterType: undefined, // any, since 1.9.2
name: undefined, // string, since 1.11.1
showFilterMenuEntry: true, // boolean, since 1.13.0
showSortMenuEntry: true, // boolean, since 1.13.0
headerSpan: 1, // any
autoResizable: false, // boolean, since 1.21.1
defaultFilterOperator: undefined, // string
leadingProperty: undefined, // string
summed: false, // boolean
inResult: false, // boolean
showIfGrouped: false, // boolean
groupHeaderFormatter: undefined, // any
tooltip: undefined, // sap.ui.core.TooltipBase
customData: [], // sap.ui.core.CustomData
dependents: [], // sap.ui.core.Control, since 1.19
label: undefined, // sap.ui.core.Control
multiLabels: [], // sap.ui.core.Control, since 1.13.1
template: undefined, // sap.ui.core.Control
menu: undefined // sap.ui.unified.Menu
})
]]></jsTemplate>
<xmlTemplate><![CDATA[<AnalyticalColumn xmlns="sap.ui.table"
id="${id}"
width=""
flexible="true"
resizable="true"
hAlign="Begin"
sorted="false"
sortOrder="Ascending"
sortProperty=""
filtered="false"
filterProperty=""
filterValue=""
filterOperator=""
grouped="false"
visible="true"
filterType=""
name=""
showFilterMenuEntry="true"
showSortMenuEntry="true"
headerSpan="1"
autoResizable="false"
defaultFilterOperator=""
leadingProperty=""
summed="false"
inResult="false"
showIfGrouped="false"
groupHeaderFormatter="">
<tooltip></tooltip> <!-- sap.ui.core.TooltipBase -->
<dependents></dependents> <!-- sap.ui.core.Control, since 1.19 -->
<label></label> <!-- sap.ui.core.Control -->
<multiLabels></multiLabels> <!-- sap.ui.core.Control, since 1.13.1 -->
<template></template> <!-- sap.ui.core.Control -->
<menu></menu> <!-- sap.ui.unified.Menu -->
</AnalyticalColumn>
]]></xmlTemplate>
</Template>
<Template name="sap.ui.table.AnalyticalColumnMenu" alias="AnalyticalColumnMenu,Menu">
<jsTemplate><![CDATA[new sap.ui.table.AnalyticalColumnMenu({
id: "${id}", // sap.ui.core.ID
busy: false, // boolean
busyIndicatorDelay: 1000, // int
visible: true, // boolean
fieldGroupIds: [], // string[], since 1.31
enabled: true, // boolean
ariaDescription: undefined, // string
maxVisibleItems: 0, // int
pageSize: 5, // int, since 1.25.0
tooltip: undefined, // sap.ui.core.TooltipBase
customData: [], // sap.ui.core.CustomData
dependents: [], // sap.ui.core.Control, since 1.19
items: [], // sap.ui.unified.MenuItemBase
ariaLabelledBy: [], // sap.ui.core.Control, since 1.26.3
validateFieldGroup: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this],
itemSelect: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this]
})
]]></jsTemplate>
<xmlTemplate><![CDATA[<AnalyticalColumnMenu xmlns="sap.ui.table"
id="${id}"
busy="false"
busyIndicatorDelay="1000"
visible="true"
fieldGroupIds=""
enabled="true"
ariaDescription=""
maxVisibleItems="0"
pageSize="5"
ariaLabelledBy=""
validateFieldGroup=""
itemSelect="">
<tooltip></tooltip> <!-- sap.ui.core.TooltipBase -->
<dependents></dependents> <!-- sap.ui.core.Control, since 1.19 -->
<items></items> <!-- sap.ui.unified.MenuItemBase -->
</AnalyticalColumnMenu>
]]></xmlTemplate>
</Template>
<Template name="sap.ui.table.AnalyticalTable" alias="AnalyticalTable,Table">
<jsTemplate><![CDATA[new sap.ui.table.AnalyticalTable({
id: "${id}", // sap.ui.core.ID
busy: false, // boolean
busyIndicatorDelay: 1000, // int
visible: true, // boolean
fieldGroupIds: [], // string[], since 1.31
width: "auto", // sap.ui.core.CSSSize
rowHeight: undefined, // int
columnHeaderHeight: undefined, // int
columnHeaderVisible: true, // boolean
visibleRowCount: 10, // int
firstVisibleRow: 0, // int
selectionMode: sap.ui.table.SelectionMode.Multi, // sap.ui.table.SelectionMode
selectionBehavior: sap.ui.table.SelectionBehavior.RowSelector, // sap.ui.table.SelectionBehavior
selectedIndex: -1, // int
editable: true, // boolean
navigationMode: sap.ui.table.NavigationMode.Scrollbar, // sap.ui.table.NavigationMode
threshold: 100, // int
enableColumnReordering: true, // boolean
enableGrouping: false, // boolean
showColumnVisibilityMenu: false, // boolean
showNoData: true, // boolean
visibleRowCountMode: sap.ui.table.VisibleRowCountMode.Fixed, // sap.ui.table.VisibleRowCountMode, since 1.9.2
minAutoRowCount: 5, // int
fixedColumnCount: 0, // int
fixedRowCount: 0, // int
fixedBottomRowCount: 0, // int, since 1.18.7
enableColumnFreeze: false, // boolean, since 1.21.0
enableCellFilter: false, // boolean, since 1.21.0
showOverlay: false, // boolean, since 1.21.2
enableSelectAll: true, // boolean, since 1.23.0
enableCustomFilter: false, // boolean, since 1.23.0
enableBusyIndicator: false, // boolean, since 1.27.0
allowColumnReordering: true, // boolean
noDataText: undefined, // string, since 1.21.0
sumOnTop: false, // boolean
numberOfExpandedLevels: 0, // int
autoExpandMode: "Bundled", // string
columnVisibilityMenuSorter: undefined, // any
collapseRecursive: true, // boolean
dirty: undefined, // boolean
tooltip: undefined, // sap.ui.core.TooltipBase
customData: [], // sap.ui.core.CustomData
dependents: [], // sap.ui.core.Control, since 1.19
title: undefined, // sap.ui.core.Control
footer: undefined, // sap.ui.core.Control
toolbar: undefined, // sap.ui.core.Toolbar
extension: [], // sap.ui.core.Control
columns: [], // sap.ui.table.Column
rows: [], // sap.ui.table.Row
noData: undefined, // sap.ui.core.Control
groupBy: undefined, // sap.ui.table.Column
validateFieldGroup: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this],
rowSelectionChange: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this],
columnSelect: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this],
columnResize: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this],
columnMove: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this],
sort: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this],
filter: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this],
group: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this],
columnVisibility: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this],
cellClick: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this], // since 1.21.0
cellContextmenu: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this], // since 1.21.0
columnFreeze: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this], // since 1.21.0
customFilter: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this] // since 1.23.0
})
]]></jsTemplate>
<xmlTemplate><![CDATA[<AnalyticalTable xmlns="sap.ui.table"
id="${id}"
busy="false"
busyIndicatorDelay="1000"
visible="true"
fieldGroupIds=""
width="auto"
rowHeight=""
columnHeaderHeight=""
columnHeaderVisible="true"
visibleRowCount="10"
firstVisibleRow="0"
selectionMode="Multi"
selectionBehavior="RowSelector"
selectedIndex="-1"
editable="true"
navigationMode="Scrollbar"
threshold="100"
enableColumnReordering="true"
enableGrouping="false"
showColumnVisibilityMenu="false"
showNoData="true"
visibleRowCountMode="Fixed"
minAutoRowCount="5"
fixedColumnCount="0"
fixedRowCount="0"
fixedBottomRowCount="0"
enableColumnFreeze="false"
enableCellFilter="false"
showOverlay="false"
enableSelectAll="true"
enableCustomFilter="false"
enableBusyIndicator="false"
allowColumnReordering="true"
noDataText=""
sumOnTop="false"
numberOfExpandedLevels="0"
autoExpandMode="Bundled"
columnVisibilityMenuSorter=""
collapseRecursive="true"
dirty=""
groupBy=""
validateFieldGroup=""
rowSelectionChange=""
columnSelect=""
columnResize=""
columnMove=""
sort=""
filter=""
group=""
columnVisibility=""
cellClick=""
cellContextmenu=""
columnFreeze=""
customFilter="">
<tooltip></tooltip> <!-- sap.ui.core.TooltipBase -->
<dependents></dependents> <!-- sap.ui.core.Control, since 1.19 -->
<title></title> <!-- sap.ui.core.Control -->
<footer></footer> <!-- sap.ui.core.Control -->
<toolbar></toolbar> <!-- sap.ui.core.Toolbar -->
<extension></extension> <!-- sap.ui.core.Control -->
<columns></columns> <!-- sap.ui.table.Column -->
<rows></rows> <!-- sap.ui.table.Row -->
<noData></noData> <!-- sap.ui.core.Control -->
</AnalyticalTable>
]]></xmlTemplate>
</Template>
<Template name="sap.ui.table.Column" alias="Column">
<jsTemplate><![CDATA[new sap.ui.table.Column({
id: "${id}", // sap.ui.core.ID
width: undefined, // sap.ui.core.CSSSize
flexible: true, // boolean
resizable: true, // boolean
hAlign: sap.ui.core.HorizontalAlign.Begin, // sap.ui.core.HorizontalAlign
sorted: false, // boolean
sortOrder: sap.ui.table.SortOrder.Ascending, // sap.ui.table.SortOrder
sortProperty: undefined, // string
filtered: false, // boolean
filterProperty: undefined, // string
filterValue: undefined, // string
filterOperator: undefined, // string
grouped: false, // boolean
visible: true, // boolean
filterType: undefined, // any, since 1.9.2
name: undefined, // string, since 1.11.1
showFilterMenuEntry: true, // boolean, since 1.13.0
showSortMenuEntry: true, // boolean, since 1.13.0
headerSpan: 1, // any
autoResizable: false, // boolean, since 1.21.1
defaultFilterOperator: undefined, // string
tooltip: undefined, // sap.ui.core.TooltipBase
customData: [], // sap.ui.core.CustomData
dependents: [], // sap.ui.core.Control, since 1.19
label: undefined, // sap.ui.core.Control
multiLabels: [], // sap.ui.core.Control, since 1.13.1
template: undefined, // sap.ui.core.Control
menu: undefined // sap.ui.unified.Menu
})
]]></jsTemplate>
<xmlTemplate><![CDATA[<Column xmlns="sap.ui.table"
id="${id}"
width=""
flexible="true"
resizable="true"
hAlign="Begin"
sorted="false"
sortOrder="Ascending"
sortProperty=""
filtered="false"
filterProperty=""
filterValue=""
filterOperator=""
grouped="false"
visible="true"
filterType=""
name=""
showFilterMenuEntry="true"
showSortMenuEntry="true"
headerSpan="1"
autoResizable="false"
defaultFilterOperator="">
<tooltip></tooltip> <!-- sap.ui.core.TooltipBase -->
<dependents></dependents> <!-- sap.ui.core.Control, since 1.19 -->
<label></label> <!-- sap.ui.core.Control -->
<multiLabels></multiLabels> <!-- sap.ui.core.Control, since 1.13.1 -->
<template></template> <!-- sap.ui.core.Control -->
<menu></menu> <!-- sap.ui.unified.Menu -->
</Column>
]]></xmlTemplate>
</Template>
<Template name="sap.ui.table.ColumnMenu" alias="ColumnMenu,Menu">
<jsTemplate><![CDATA[new sap.ui.table.ColumnMenu({
id: "${id}", // sap.ui.core.ID
busy: false, // boolean
busyIndicatorDelay: 1000, // int
visible: true, // boolean
fieldGroupIds: [], // string[], since 1.31
enabled: true, // boolean
ariaDescription: undefined, // string
maxVisibleItems: 0, // int
pageSize: 5, // int, since 1.25.0
tooltip: undefined, // sap.ui.core.TooltipBase
customData: [], // sap.ui.core.CustomData
dependents: [], // sap.ui.core.Control, since 1.19
items: [], // sap.ui.unified.MenuItemBase
ariaLabelledBy: [], // sap.ui.core.Control, since 1.26.3
validateFieldGroup: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this],
itemSelect: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this]
})
]]></jsTemplate>
<xmlTemplate><![CDATA[<ColumnMenu xmlns="sap.ui.table"
id="${id}"
busy="false"
busyIndicatorDelay="1000"
visible="true"
fieldGroupIds=""
enabled="true"
ariaDescription=""
maxVisibleItems="0"
pageSize="5"
ariaLabelledBy=""
validateFieldGroup=""
itemSelect="">
<tooltip></tooltip> <!-- sap.ui.core.TooltipBase -->
<dependents></dependents> <!-- sap.ui.core.Control, since 1.19 -->
<items></items> <!-- sap.ui.unified.MenuItemBase -->
</ColumnMenu>
]]></xmlTemplate>
</Template>
<Template name="sap.ui.table.DataTable" alias="DataTable,Table">
<jsTemplate><![CDATA[new sap.ui.table.DataTable({
id: "${id}", // sap.ui.core.ID
busy: false, // boolean
busyIndicatorDelay: 1000, // int
visible: true, // boolean
fieldGroupIds: [], // string[], since 1.31
width: "auto", // sap.ui.core.CSSSize
rowHeight: undefined, // int
columnHeaderHeight: undefined, // int
columnHeaderVisible: true, // boolean
visibleRowCount: 10, // int
firstVisibleRow: 0, // int
selectionMode: sap.ui.table.SelectionMode.Multi, // sap.ui.table.SelectionMode
selectionBehavior: sap.ui.table.SelectionBehavior.RowSelector, // sap.ui.table.SelectionBehavior
selectedIndex: -1, // int
editable: true, // boolean
navigationMode: sap.ui.table.NavigationMode.Scrollbar, // sap.ui.table.NavigationMode
threshold: 100, // int
enableColumnReordering: true, // boolean
enableGrouping: false, // boolean
showColumnVisibilityMenu: false, // boolean
showNoData: true, // boolean
visibleRowCountMode: sap.ui.table.VisibleRowCountMode.Fixed, // sap.ui.table.VisibleRowCountMode, since 1.9.2
minAutoRowCount: 5, // int
fixedColumnCount: 0, // int
fixedRowCount: 0, // int
fixedBottomRowCount: 0, // int, since 1.18.7
enableColumnFreeze: false, // boolean, since 1.21.0
enableCellFilter: false, // boolean, since 1.21.0
showOverlay: false, // boolean, since 1.21.2
enableSelectAll: true, // boolean, since 1.23.0
enableCustomFilter: false, // boolean, since 1.23.0
enableBusyIndicator: false, // boolean, since 1.27.0
allowColumnReordering: true, // boolean
noDataText: undefined, // string, since 1.21.0
expandFirstLevel: false, // boolean
useGroupMode: false, // boolean
groupHeaderProperty: undefined, // string
collapseRecursive: true, // boolean
rootLevel: 0, // int
expandedVisibleRowCount: undefined, // int
expanded: false, // boolean
hierarchical: false, // boolean
tooltip: undefined, // sap.ui.core.TooltipBase
customData: [], // sap.ui.core.CustomData
dependents: [], // sap.ui.core.Control, since 1.19
title: undefined, // sap.ui.core.Control
footer: undefined, // sap.ui.core.Control
toolbar: undefined, // sap.ui.core.Toolbar
extension: [], // sap.ui.core.Control
columns: [], // sap.ui.table.Column
rows: [], // sap.ui.table.Row
noData: undefined, // sap.ui.core.Control
groupBy: undefined, // sap.ui.table.Column
validateFieldGroup: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this],
rowSelectionChange: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this],
columnSelect: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this],
columnResize: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this],
columnMove: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this],
sort: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this],
filter: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this],
group: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this],
columnVisibility: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this],
cellClick: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this], // since 1.21.0
cellContextmenu: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this], // since 1.21.0
columnFreeze: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this], // since 1.21.0
customFilter: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this], // since 1.23.0
toggleOpenState: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this],
rowSelect: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this]
})
]]></jsTemplate>
<xmlTemplate><![CDATA[<DataTable xmlns="sap.ui.table"
id="${id}"
busy="false"
busyIndicatorDelay="1000"
visible="true"
fieldGroupIds=""
width="auto"
rowHeight=""
columnHeaderHeight=""
columnHeaderVisible="true"
visibleRowCount="10"
firstVisibleRow="0"
selectionMode="Multi"
selectionBehavior="RowSelector"
selectedIndex="-1"
editable="true"
navigationMode="Scrollbar"
threshold="100"
enableColumnReordering="true"
enableGrouping="false"
showColumnVisibilityMenu="false"
showNoData="true"
visibleRowCountMode="Fixed"
minAutoRowCount="5"
fixedColumnCount="0"
fixedRowCount="0"
fixedBottomRowCount="0"
enableColumnFreeze="false"
enableCellFilter="false"
showOverlay="false"
enableSelectAll="true"
enableCustomFilter="false"
enableBusyIndicator="false"
allowColumnReordering="true"
noDataText=""
expandFirstLevel="false"
useGroupMode="false"
groupHeaderProperty=""
collapseRecursive="true"
rootLevel="0"
expandedVisibleRowCount=""
expanded="false"
hierarchical="false"
groupBy=""
validateFieldGroup=""
rowSelectionChange=""
columnSelect=""
columnResize=""
columnMove=""
sort=""
filter=""
group=""
columnVisibility=""
cellClick=""
cellContextmenu=""
columnFreeze=""
customFilter=""
toggleOpenState=""
rowSelect="">
<tooltip></tooltip> <!-- sap.ui.core.TooltipBase -->
<dependents></dependents> <!-- sap.ui.core.Control, since 1.19 -->
<title></title> <!-- sap.ui.core.Control -->
<footer></footer> <!-- sap.ui.core.Control -->
<toolbar></toolbar> <!-- sap.ui.core.Toolbar -->
<extension></extension> <!-- sap.ui.core.Control -->
<columns></columns> <!-- sap.ui.table.Column -->
<rows></rows> <!-- sap.ui.table.Row -->
<noData></noData> <!-- sap.ui.core.Control -->
</DataTable>
]]></xmlTemplate>
</Template>
<Template name="sap.ui.table.Row" alias="Row">
<jsTemplate><![CDATA[new sap.ui.table.Row({
id: "${id}", // sap.ui.core.ID
tooltip: undefined, // sap.ui.core.TooltipBase
customData: [], // sap.ui.core.CustomData
dependents: [], // sap.ui.core.Control, since 1.19
cells: [] // sap.ui.core.Control
})
]]></jsTemplate>
<xmlTemplate><![CDATA[<Row xmlns="sap.ui.table"
id="${id}">
<tooltip></tooltip> <!-- sap.ui.core.TooltipBase -->
<dependents></dependents> <!-- sap.ui.core.Control, since 1.19 -->
<cells></cells> <!-- sap.ui.core.Control -->
</Row>
]]></xmlTemplate>
</Template>
<Template name="sap.ui.table.Table" alias="Table">
<jsTemplate><![CDATA[new sap.ui.table.Table({
id: "${id}", // sap.ui.core.ID
busy: false, // boolean
busyIndicatorDelay: 1000, // int
visible: true, // boolean
fieldGroupIds: [], // string[], since 1.31
width: "auto", // sap.ui.core.CSSSize
rowHeight: undefined, // int
columnHeaderHeight: undefined, // int
columnHeaderVisible: true, // boolean
visibleRowCount: 10, // int
firstVisibleRow: 0, // int
selectionMode: sap.ui.table.SelectionMode.Multi, // sap.ui.table.SelectionMode
selectionBehavior: sap.ui.table.SelectionBehavior.RowSelector, // sap.ui.table.SelectionBehavior
selectedIndex: -1, // int
editable: true, // boolean
navigationMode: sap.ui.table.NavigationMode.Scrollbar, // sap.ui.table.NavigationMode
threshold: 100, // int
enableColumnReordering: true, // boolean
enableGrouping: false, // boolean
showColumnVisibilityMenu: false, // boolean
showNoData: true, // boolean
visibleRowCountMode: sap.ui.table.VisibleRowCountMode.Fixed, // sap.ui.table.VisibleRowCountMode, since 1.9.2
minAutoRowCount: 5, // int
fixedColumnCount: 0, // int
fixedRowCount: 0, // int
fixedBottomRowCount: 0, // int, since 1.18.7
enableColumnFreeze: false, // boolean, since 1.21.0
enableCellFilter: false, // boolean, since 1.21.0
showOverlay: false, // boolean, since 1.21.2
enableSelectAll: true, // boolean, since 1.23.0
enableCustomFilter: false, // boolean, since 1.23.0
enableBusyIndicator: false, // boolean, since 1.27.0
allowColumnReordering: true, // boolean
noDataText: undefined, // string, since 1.21.0
tooltip: undefined, // sap.ui.core.TooltipBase
customData: [], // sap.ui.core.CustomData
dependents: [], // sap.ui.core.Control, since 1.19
title: undefined, // sap.ui.core.Control
footer: undefined, // sap.ui.core.Control
toolbar: undefined, // sap.ui.core.Toolbar
extension: [], // sap.ui.core.Control
columns: [], // sap.ui.table.Column
rows: [], // sap.ui.table.Row
noData: undefined, // sap.ui.core.Control
groupBy: undefined, // sap.ui.table.Column
validateFieldGroup: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this],
rowSelectionChange: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this],
columnSelect: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this],
columnResize: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this],
columnMove: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this],
sort: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this],
filter: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this],
group: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this],
columnVisibility: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this],
cellClick: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this], // since 1.21.0
cellContextmenu: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this], // since 1.21.0
columnFreeze: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this], // since 1.21.0
customFilter: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this] // since 1.23.0
})
]]></jsTemplate>
<xmlTemplate><![CDATA[<Table xmlns="sap.ui.table"
id="${id}"
busy="false"
busyIndicatorDelay="1000"
visible="true"
fieldGroupIds=""
width="auto"
rowHeight=""
columnHeaderHeight=""
columnHeaderVisible="true"
visibleRowCount="10"
firstVisibleRow="0"
selectionMode="Multi"
selectionBehavior="RowSelector"
selectedIndex="-1"
editable="true"
navigationMode="Scrollbar"
threshold="100"
enableColumnReordering="true"
enableGrouping="false"
showColumnVisibilityMenu="false"
showNoData="true"
visibleRowCountMode="Fixed"
minAutoRowCount="5"
fixedColumnCount="0"
fixedRowCount="0"
fixedBottomRowCount="0"
enableColumnFreeze="false"
enableCellFilter="false"
showOverlay="false"
enableSelectAll="true"
enableCustomFilter="false"
enableBusyIndicator="false"
allowColumnReordering="true"
noDataText=""
groupBy=""
validateFieldGroup=""
rowSelectionChange=""
columnSelect=""
columnResize=""
columnMove=""
sort=""
filter=""
group=""
columnVisibility=""
cellClick=""
cellContextmenu=""
columnFreeze=""
customFilter="">
<tooltip></tooltip> <!-- sap.ui.core.TooltipBase -->
<dependents></dependents> <!-- sap.ui.core.Control, since 1.19 -->
<title></title> <!-- sap.ui.core.Control -->
<footer></footer> <!-- sap.ui.core.Control -->
<toolbar></toolbar> <!-- sap.ui.core.Toolbar -->
<extension></extension> <!-- sap.ui.core.Control -->
<columns></columns> <!-- sap.ui.table.Column -->
<rows></rows> <!-- sap.ui.table.Row -->
<noData></noData> <!-- sap.ui.core.Control -->
</Table>
]]></xmlTemplate>
</Template>
<Template name="sap.ui.table.TreeTable" alias="TreeTable,Table">
<jsTemplate><![CDATA[new sap.ui.table.TreeTable({
id: "${id}", // sap.ui.core.ID
busy: false, // boolean
busyIndicatorDelay: 1000, // int
visible: true, // boolean
fieldGroupIds: [], // string[], since 1.31
width: "auto", // sap.ui.core.CSSSize
rowHeight: undefined, // int
columnHeaderHeight: undefined, // int
columnHeaderVisible: true, // boolean
visibleRowCount: 10, // int
firstVisibleRow: 0, // int
selectionMode: sap.ui.table.SelectionMode.Multi, // sap.ui.table.SelectionMode
selectionBehavior: sap.ui.table.SelectionBehavior.RowSelector, // sap.ui.table.SelectionBehavior
selectedIndex: -1, // int
editable: true, // boolean
navigationMode: sap.ui.table.NavigationMode.Scrollbar, // sap.ui.table.NavigationMode
threshold: 100, // int
enableColumnReordering: true, // boolean
enableGrouping: false, // boolean
showColumnVisibilityMenu: false, // boolean
showNoData: true, // boolean
visibleRowCountMode: sap.ui.table.VisibleRowCountMode.Fixed, // sap.ui.table.VisibleRowCountMode, since 1.9.2
minAutoRowCount: 5, // int
fixedColumnCount: 0, // int
fixedRowCount: 0, // int
fixedBottomRowCount: 0, // int, since 1.18.7
enableColumnFreeze: false, // boolean, since 1.21.0
enableCellFilter: false, // boolean, since 1.21.0
showOverlay: false, // boolean, since 1.21.2
enableSelectAll: true, // boolean, since 1.23.0
enableCustomFilter: false, // boolean, since 1.23.0
enableBusyIndicator: false, // boolean, since 1.27.0
allowColumnReordering: true, // boolean
noDataText: undefined, // string, since 1.21.0
expandFirstLevel: false, // boolean
useGroupMode: false, // boolean
groupHeaderProperty: undefined, // string
collapseRecursive: true, // boolean
rootLevel: 0, // int
tooltip: undefined, // sap.ui.core.TooltipBase
customData: [], // sap.ui.core.CustomData
dependents: [], // sap.ui.core.Control, since 1.19
title: undefined, // sap.ui.core.Control
footer: undefined, // sap.ui.core.Control
toolbar: undefined, // sap.ui.core.Toolbar
extension: [], // sap.ui.core.Control
columns: [], // sap.ui.table.Column
rows: [], // sap.ui.table.Row
noData: undefined, // sap.ui.core.Control
groupBy: undefined, // sap.ui.table.Column
validateFieldGroup: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this],
rowSelectionChange: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this],
columnSelect: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this],
columnResize: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this],
columnMove: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this],
sort: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this],
filter: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this],
group: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this],
columnVisibility: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this],
cellClick: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this], // since 1.21.0
cellContextmenu: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this], // since 1.21.0
columnFreeze: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this], // since 1.21.0
customFilter: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this], // since 1.23.0
toggleOpenState: [function (oEvent) {
var ${control} = oEvent.getSource();
}, this]
})
]]></jsTemplate>
<xmlTemplate><![CDATA[<TreeTable xmlns="sap.ui.table"
id="${id}"
busy="false"
busyIndicatorDelay="1000"
visible="true"
fieldGroupIds=""
width="auto"
rowHeight=""
columnHeaderHeight=""
columnHeaderVisible="true"
visibleRowCount="10"
firstVisibleRow="0"
selectionMode="Multi"
selectionBehavior="RowSelector"
selectedIndex="-1"
editable="true"
navigationMode="Scrollbar"
threshold="100"
enableColumnReordering="true"
enableGrouping="false"
showColumnVisibilityMenu="false"
showNoData="true"
visibleRowCountMode="Fixed"
minAutoRowCount="5"
fixedColumnCount="0"
fixedRowCount="0"
fixedBottomRowCount="0"
enableColumnFreeze="false"
enableCellFilter="false"
showOverlay="false"
enableSelectAll="true"
enableCustomFilter="false"
enableBusyIndicator="false"
allowColumnReordering="true"
noDataText=""
expandFirstLevel="false"
useGroupMode="false"
groupHeaderProperty=""
collapseRecursive="true"
rootLevel="0"
groupBy=""
validateFieldGroup=""
rowSelectionChange=""
columnSelect=""
columnResize=""
columnMove=""
sort=""
filter=""
group=""
columnVisibility=""
cellClick=""
cellContextmenu=""
columnFreeze=""
customFilter=""
toggleOpenState="">
<tooltip></tooltip> <!-- sap.ui.core.TooltipBase -->
<dependents></dependents> <!-- sap.ui.core.Control, since 1.19 -->
<title></title> <!-- sap.ui.core.Control -->
<footer></footer> <!-- sap.ui.core.Control -->
<toolbar></toolbar> <!-- sap.ui.core.Toolbar -->
<extension></extension> <!-- sap.ui.core.Control -->
<columns></columns> <!-- sap.ui.table.Column -->
<rows></rows> <!-- sap.ui.table.Row -->
<noData></noData> <!-- sap.ui.core.Control -->
</TreeTable>
]]></xmlTemplate>
</Template>
</Library>
| {
"content_hash": "ff5dcb476621dd601ecf632fafd02460",
"timestamp": "",
"source": "github",
"line_count": 888,
"max_line_length": 110,
"avg_line_length": 32.387387387387385,
"alnum_prop": 0.6933240611961057,
"repo_name": "marinho/german-articles",
"id": "db744164742ddb74882be9f17e35e0e02995d99e",
"size": "28760",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "germanArticlesApp/www/resources/sap/ui/table/library.templates.xml",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "5594"
},
{
"name": "C",
"bytes": "1025"
},
{
"name": "C#",
"bytes": "129030"
},
{
"name": "C++",
"bytes": "2027"
},
{
"name": "CSS",
"bytes": "12151322"
},
{
"name": "HTML",
"bytes": "11450"
},
{
"name": "Java",
"bytes": "6311"
},
{
"name": "JavaScript",
"bytes": "28989082"
},
{
"name": "Makefile",
"bytes": "510"
},
{
"name": "Objective-C",
"bytes": "204837"
},
{
"name": "Python",
"bytes": "7873"
},
{
"name": "Shell",
"bytes": "1927"
}
],
"symlink_target": ""
} |
package OpenRate.db;
import OpenRate.OpenRate;
import OpenRate.exception.ExceptionHandler;
import OpenRate.exception.InitializationException;
import OpenRate.utils.PropertyUtils;
import com.jolbox.bonecp.BoneCPDataSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import javax.sql.DataSource;
public class BCPDataSource implements IDBDataSource
{
// The symbolic name is used in the management of the pipeline (control and
// thread monitoring) and logging.
private String SymbolicName = "BCPDataSource";
// reference to the exception handler
private ExceptionHandler handler;
// used to simplify logging and exception handling
public String message;
/**
* The data source is a a pooled collection of connections that can be used
* by elements of the framework.
*
* * @author ddijak
*/
// -----------------------------------------------------------------------------
// ------------------ BoneCP specific configuration options ---------------------
// -----------------------------------------------------------------------------
/**
* minimal number of connections per partition
* Sets the minimum number of connections that will be contained in every partition.
*/
public static final String MIN_CONN_KEY = "MinConnectionsPerPartiton";
public static final String DEFAULT_MIN_CONN = "5";
/**
* maximal number of connections per partition
* Sets the maximum number of connections that will be contained in every partition. Setting this to 5 with 3 partitions means you will have 15 unique connections to the database.
* Note that the connection pool will not create all these connections in one go but rather start off with minConnectionsPerPartition and gradually increase connections as required.
*/
public static final String MAX_CONN_KEY = "MaxConnectionsPerPartiton";
public static final String DEFAULT_MAX_CONN = "10";
/**
* number of partitions
* Sets number of partitions to use. In order to reduce lock contention and thus improve performance, each incoming connection request picks off a connection from a pool that has thread-affinity,
* i.e. pool[threadId % partition_count]. The higher this number, the better your performance will be for the case when you have plenty of short-lived threads. Beyond a certain threshold,
* maintenance of these pools will start to have a negative effect on performance (and only for the case when connections on a partition start running out).
* Default: 1, minimum: 1, recommended: 2-4 (but very app specific)
*/
public static final String PARTITION_KEY = "PartitionCount";
public static final String DEFAULT_PARTITON_COUNT = "1";
/**
* number of acquire increments
* Sets the acquireIncrement property. When the available connections are about to run out, BoneCP will dynamically create new ones in batches.
* This property controls how many new connections to create in one go (up to a maximum of maxConnectionsPerPartition).
* Note: This is a per partition setting.
*/
public static final String ACQUIRE_INCREMENT_KEY = "AcquireIncrement";
public static final String DEFAULT_ACQUIRE_INCREMENT_COUNT = "1";
/**
* number of cached statements
* Sets statementsCacheSize setting. The number of statements to cache.
*/
public static final String STMT_CACHE_KEY = "StatementsCacheSize";
public static final String DEFAULT_STMTS_CACHE_SIZE = DEFAULT_MAX_STMTS; // (DEFAULT_MAX_STMTS = 25)
// -----------------------------------------------------------------------------
// --------------------------- Implementation ---------------------------------
// -----------------------------------------------------------------------------
/**
* Constructor: log our version info to the audit system
*/
public BCPDataSource()
{
}
/**
* Create new data source from provided properties.
*
* @param ResourceName The name of the DataSourceFactory in the properties
* @param dataSourceName The name of the data source to create
* @return The created data source
* @throws OpenRate.exception.InitializationException
*/
@Override
public DataSource getDataSource(String ResourceName, String dataSourceName)
throws InitializationException
{
String db_url;
String driver = null;
String username;
String password;
String validationSQL;
int MaxConnPerPartition;
int MinConnPerPartition;
int AcquireIncrement;
int StatementsCacheSize;
int PartitionCount;
BoneCPDataSource dataSource = new BoneCPDataSource();
OpenRate.getOpenRateFrameworkLog().debug("Creating new DataSource <" + dataSourceName + ">");
try
{
// get the connection parameters
db_url = PropertyUtils.getPropertyUtils().getDataSourcePropertyValue(dataSourceName, DB_URL_KEY);
driver = PropertyUtils.getPropertyUtils().getDataSourcePropertyValue(dataSourceName, DRIVER_KEY);
username = PropertyUtils.getPropertyUtils().getDataSourcePropertyValue(dataSourceName, USERNAME_KEY);
password = PropertyUtils.getPropertyUtils().getDataSourcePropertyValue(dataSourceName, PASSWORD_KEY);
if (db_url == null || db_url.isEmpty())
{
message = "Error recovering data source parameter <db_url> for data source <" + dataSourceName + ">";
OpenRate.getOpenRateFrameworkLog().error(message);
throw new InitializationException(message,getSymbolicName());
}
if (driver == null || driver.isEmpty())
{
message = "Error recovering data source parameter <driver> for data source <" + dataSourceName + ">";
OpenRate.getOpenRateFrameworkLog().error(message);
throw new InitializationException(message,getSymbolicName());
}
if (username == null || username.isEmpty())
{
message = "Error recovering data source parameter <username> for data source <" + dataSourceName + ">";
OpenRate.getOpenRateFrameworkLog().error(message);
throw new InitializationException(message,getSymbolicName());
}
if (password == null)
{
message = "Error recovering data source parameter <password> for data source <" + dataSourceName + ">";
OpenRate.getOpenRateFrameworkLog().error(message);
throw new InitializationException(message,getSymbolicName());
}
OpenRate.getOpenRateFrameworkLog().info("Creating DataSource <" + dataSourceName + "> using driver <" + driver + "> from URL <" + db_url + ">");
Class<?> driverClass = Class.forName(driver);
OpenRate.getOpenRateFrameworkLog().debug("jdbc driver loaded. name = <" + driverClass.getName() + ">");
}
catch (ClassNotFoundException cnfe)
{
message = "Driver class <" + driver + "> not found for data source <" + dataSourceName + ">";
OpenRate.getOpenRateFrameworkLog().error(message);
throw new InitializationException(message,getSymbolicName());
}
// Set driver class
dataSource.setDriverClass(driver);
// set Test Query
validationSQL = PropertyUtils.getPropertyUtils().getDataSourcePropertyValue(dataSourceName, VALIDATION_QUERY_KEY);
// Options with defaults
String numberOfPartitions = PropertyUtils.getPropertyUtils().getDataSourcePropertyValueDef(dataSourceName,PARTITION_KEY, DEFAULT_PARTITON_COUNT);
PartitionCount = Integer.parseInt(numberOfPartitions);
String minConn = PropertyUtils.getPropertyUtils().getDataSourcePropertyValueDef(dataSourceName,MIN_CONN_KEY, DEFAULT_MIN_CONN);
MinConnPerPartition = Integer.parseInt(minConn);
String maxConn = PropertyUtils.getPropertyUtils().getDataSourcePropertyValueDef(dataSourceName,MAX_CONN_KEY, DEFAULT_MAX_CONN);
MaxConnPerPartition = Integer.parseInt(maxConn);
String acquireInc = PropertyUtils.getPropertyUtils().getDataSourcePropertyValueDef(dataSourceName,ACQUIRE_INCREMENT_KEY, DEFAULT_ACQUIRE_INCREMENT_COUNT);
AcquireIncrement = Integer.parseInt(acquireInc);
// Acquire Increment can't be bigger than MaxConnectionsPerPartition
// If AcquireIncrement is > MaxConnectionsPerPartition then use default value of 1
if (AcquireIncrement > MaxConnPerPartition)
{
OpenRate.getOpenRateFrameworkLog().warning("AcquireIncrement can't be bigger than MaxConnectionsPerPartition. Setting default value of: "+DEFAULT_ACQUIRE_INCREMENT_COUNT);
AcquireIncrement = Integer.parseInt(DEFAULT_ACQUIRE_INCREMENT_COUNT);
}
String stmtCacheSize = PropertyUtils.getPropertyUtils().getDataSourcePropertyValueDef(dataSourceName,STMT_CACHE_KEY, DEFAULT_STMTS_CACHE_SIZE);
StatementsCacheSize = Integer.parseInt(stmtCacheSize);
String connTimeOut = PropertyUtils.getPropertyUtils().getDataSourcePropertyValueDef(dataSourceName,CONN_TIMEOUT_KEY, DEFAULT_CONN_TIMEOUT);
int timeoutPeriod = Integer.parseInt(connTimeOut);
// Perform the initialisation
dataSource.setJdbcUrl(db_url);
dataSource.setUsername(username);
dataSource.setPassword(password);
// Pooling configuration
dataSource.setMinConnectionsPerPartition(MinConnPerPartition);
dataSource.setMaxConnectionsPerPartition(MaxConnPerPartition);
dataSource.setPartitionCount(PartitionCount);
dataSource.setAcquireIncrement(AcquireIncrement);
dataSource.setStatementsCacheSize(StatementsCacheSize);
dataSource.setMaxConnectionAgeInSeconds(timeoutPeriod);
if (validationSQL == null || validationSQL.isEmpty())
{
OpenRate.getOpenRateFrameworkLog().warning("No SQL validation statement found for Datasource <" + dataSourceName + ">");
}
else
{
dataSource.setConnectionTestStatement(validationSQL);
// Test the data source
try
{
try (Connection testConn = dataSource.getConnection(); PreparedStatement stmt = testConn.prepareStatement(validationSQL))
{
stmt.executeQuery();
}
}
catch (SQLException ex)
{
message = "Connection test failed for connection <" + dataSourceName + ">";
OpenRate.getOpenRateFrameworkLog().error(message);
throw new InitializationException(message,getSymbolicName());
}
}
return dataSource;
}
/**
* Set the exception handler for handling any exceptions.
*
* @param handler the handler to set
*/
@Override
public void setHandler(ExceptionHandler handler)
{
this.handler = handler;
}
/**
* @return the SymbolicName
*/
public String getSymbolicName() {
return SymbolicName;
}
/**
* @param SymbolicName the SymbolicName to set
*/
public void setSymbolicName(String SymbolicName) {
this.SymbolicName = SymbolicName;
}
/**
* @return the handler
*/
public ExceptionHandler getHandler() {
return handler;
}
}
| {
"content_hash": "08cc6632f36be0416e106a1fd5864c88",
"timestamp": "",
"source": "github",
"line_count": 267,
"max_line_length": 198,
"avg_line_length": 40.97378277153558,
"alnum_prop": 0.6947897623400365,
"repo_name": "isparkes/OpenRate",
"id": "d12a3072991ec68c722c72d7f494d1900b61d3d6",
"size": "10940",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/OpenRate/db/BCPDataSource.java",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "12045"
},
{
"name": "Java",
"bytes": "2270531"
}
],
"symlink_target": ""
} |
package org.quattor.pan.output;
import static org.quattor.pan.utils.MessageUtils.MSG_UNEXPECTED_EXCEPTION_WHILE_WRITING_OUTPUT;
import java.io.PrintWriter;
import java.nio.charset.Charset;
import javax.xml.XMLConstants;
import javax.xml.transform.sax.TransformerHandler;
import javax.xml.transform.stream.StreamResult;
import org.quattor.pan.dml.data.Element;
import org.quattor.pan.dml.data.HashResource;
import org.quattor.pan.dml.data.ListResource;
import org.quattor.pan.dml.data.Property;
import org.quattor.pan.dml.data.Resource;
import org.quattor.pan.dml.data.StringProperty;
import org.quattor.pan.exceptions.CompilerError;
import org.quattor.pan.tasks.FinalResult;
import org.quattor.pan.utils.Base64;
import org.quattor.pan.utils.XmlUtils;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
public class PanFormatter extends AbstractFormatter {
private static final PanFormatter instance = new PanFormatter();
private static final String PAN_NS = XMLConstants.NULL_NS_URI;
private PanFormatter() {
super("xml", "pan");
}
protected PanFormatter(String suffix, String key) {
super(suffix, key);
}
public static PanFormatter getInstance() {
return instance;
}
protected void write(FinalResult result, PrintWriter ps) throws Exception {
Element root = result.getRoot();
String rootName = "profile";
try {
TransformerHandler handler = XmlUtils.getSaxTransformerHandler();
// Ok, feed SAX events to the output stream.
handler.setResult(new StreamResult(ps));
// Create an list of attributes which can be reused on a "per-call"
// basis. This allows the class to remain a singleton.
AttributesImpl atts = new AttributesImpl();
// Begin the document and start the root element.
handler.startDocument();
// Add the attributes for the root element.
atts.addAttribute(PAN_NS, null, "format", "CDATA", "pan");
atts.addAttribute(PAN_NS, null, "name", "CDATA", rootName);
// Process children recursively.
writeChild(handler, atts, ps, root);
// Close the document. This will flush and close the underlying
// stream.
handler.endDocument();
} catch (SAXException se) {
Error error = CompilerError
.create(MSG_UNEXPECTED_EXCEPTION_WHILE_WRITING_OUTPUT);
error.initCause(se);
throw error;
}
}
private void writeChild(TransformerHandler handler, AttributesImpl atts,
PrintWriter ps, Element node) throws SAXException {
String tagName = node.getTypeAsString();
String stringContents = null;
if (node instanceof StringProperty) {
// Normally the tag name will just be the type of the element.
// However, for links we need to be careful.
if (!"string".equals(tagName)) {
atts.addAttribute(PAN_NS, null, "type", "CDATA", tagName);
tagName = "string";
}
// Check to see if the string contents need to be encoded.
String s = ((Property) node).toString();
if (XMLFormatterUtils.isValidXMLString(s)) {
stringContents = s;
} else {
stringContents = Base64.encodeBytes(s.getBytes(Charset.forName("UTF-8")));
atts.addAttribute(PAN_NS, null, "encoding", "CDATA", "base64");
}
}
// Start the element. The name attribute must be passed in by the
// parent. Any additional attributes can also be passed in.
handler.startElement(PAN_NS, null, tagName, atts);
// Clear the attribute structure for reuse.
atts.clear();
if (node instanceof HashResource) {
// Iterate over all children of the hash, setting the name attribute
// for each one.
HashResource hash = (HashResource) node;
for (Resource.Entry entry : hash) {
String name = entry.getKey().toString();
atts.addAttribute(PAN_NS, null, "name", "CDATA", name);
writeChild(handler, atts, ps, entry.getValue());
}
} else if (node instanceof ListResource) {
// Iterate over all children of the list. Children of lists are
// anonymous; do not set name attribute.
ListResource list = (ListResource) node;
for (Resource.Entry entry : list) {
writeChild(handler, atts, ps, entry.getValue());
}
} else if (node instanceof StringProperty) {
handler.characters(stringContents.toCharArray(), 0,
stringContents.length());
} else if (node instanceof Property) {
String s = ((Property) node).toString();
handler.characters(s.toCharArray(), 0, s.length());
}
// Finish the element.
handler.endElement(PAN_NS, null, tagName);
}
}
| {
"content_hash": "979954f37510db8dc8944faa58638fb1",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 95,
"avg_line_length": 30.423841059602648,
"alnum_prop": 0.694601654331737,
"repo_name": "jrha/pan",
"id": "55475b83f09401b44a40eef3c7808c9de510246d",
"size": "5428",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "panc/src/main/java/org/quattor/pan/output/PanFormatter.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Clojure",
"bytes": "27791"
},
{
"name": "HTML",
"bytes": "17882"
},
{
"name": "Java",
"bytes": "1671844"
},
{
"name": "Pan",
"bytes": "26581284"
},
{
"name": "Perl",
"bytes": "25023"
},
{
"name": "PostScript",
"bytes": "59921"
},
{
"name": "Python",
"bytes": "48260"
},
{
"name": "Shell",
"bytes": "1513"
},
{
"name": "Vim script",
"bytes": "12427"
}
],
"symlink_target": ""
} |
using System.Configuration;
namespace Motherlode.Data.NHibernate.Tests.Cfg
{
internal class Environment
{
#region Public Properties
public static string TargetDirectory
{
get
{
return ConfigurationManager.AppSettings["targetDir"];
}
}
#endregion
}
}
| {
"content_hash": "ae6ad7a32318a4545b540e070e64933f",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 69,
"avg_line_length": 18.789473684210527,
"alnum_prop": 0.5658263305322129,
"repo_name": "xSkara/Motherlode",
"id": "804722d534647f66ffb82d313379d73216c4b208",
"size": "357",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Motherlode.Data.NHibernate.Tests/Cfg/Environment.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "394984"
},
{
"name": "PowerShell",
"bytes": "39315"
},
{
"name": "Shell",
"bytes": "216"
}
],
"symlink_target": ""
} |
import {TagRepository} from '../services/tagRepository';
import {DisplayHelpers} from '../helpers/displayHelpers';
import {Views} from './common';
import {DOMHelpers} from '../helpers/domHelpers';
import {Pages} from '../pages/common';
import {PageActions} from '../pages/action';
import {Privileges} from '../services/privileges';
import {EditViews} from './edit';
import {PrivilegesView} from './privilegesView';
import {ThreadMessagesView} from './threadMessagesView';
import {ViewsExtra} from "./extra";
import {LanguageService} from "../services/languageService";
export module TagsView {
import DOMAppender = DOMHelpers.DOMAppender;
import dA = DOMHelpers.dA;
import cE = DOMHelpers.cE;
import L = LanguageService.translate;
export function createTagElement(tag: TagRepository.Tag): DOMAppender {
const container = dA('<div class="uk-display-inline-block">');
const tagElement = dA('<a class="uk-badge uk-icon" uk-icon="icon: tag" ' +
getThreadsWithTagLinkContent(tag) + '>');
container.append(tagElement);
tagElement.appendString(tag.name);
return container;
}
export function getThreadsWithTagLinkContent(tag: TagRepository.Tag): string {
return 'href="' + Pages.getThreadsWithTagUrlFull(tag) + '" ' + Views.ThreadsWithTagData + '="' +
DOMHelpers.escapeStringForAttribute(tag.name) + '"';
}
export class TagsPageContent {
sortControls: HTMLElement;
list: HTMLElement
}
export async function createTagsPageContent(tags: TagRepository.Tag[], info: Views.SortInfo,
callback: PageActions.ITagCallback): Promise<TagsPageContent> {
const result = new TagsPageContent();
const resultList = cE("div");
resultList.appendChild(result.sortControls = createTagListSortControls(info));
if (Privileges.ForumWide.canAddNewTag()) {
resultList.appendChild(createAddNewTagElement(callback));
}
const tagsList = cE('div');
resultList.appendChild(tagsList);
DOMHelpers.addClasses(tagsList, 'tags-list');
tagsList.appendChild(await this.createTagsTable(tags));
if (Privileges.ForumWide.canAddNewTag()) {
resultList.appendChild(createAddNewTagElement(callback));
}
result.list = resultList;
return result;
}
export async function createTagsTable(tags: TagRepository.Tag[]): Promise<HTMLElement> {
const allMessages = tags
.filter(t => t && t.latestMessage)
.map(t => t.latestMessage.content);
await ViewsExtra.searchUsersById(allMessages);
const tableContainer = dA('<div class="tags-table">');
const table = dA('<table class="uk-table uk-table-divider uk-table-middle">');
tableContainer.append(table);
if (tags.length < 1) {
table.appendRaw(`<span class="uk-text-warning">${L('No tags found')}</span>`);
return tableContainer.toElement();
}
const tableHeader = '<thead>\n' +
' <tr>\n' +
` <th class="uk-table-expand">${L('Tag')}</th>\n` +
` <th class="uk-text-center uk-table-shrink hide-compact">${L('Statistics')}</th>\n` +
` <th class="uk-text-right latest-message-header">${L('Latest Message')}</th>\n` +
' </tr>\n' +
'</thead>';
table.appendRaw(tableHeader);
const tbody = dA('<tbody>');
table.append(tbody);
for (let tag of tags) {
if (null == tag) continue;
const row = dA('<tr>');
tbody.append(row);
{
const nameColumn = dA('<td class="uk-table-expand">');
row.append(nameColumn);
nameColumn.append(dA('<span class="uk-icon" uk-icon="icon: tag">'));
const nameLink = dA('<a class="uk-button uk-button-text" ' + getThreadsWithTagLinkContent(tag) + '>');
nameColumn.append(nameLink);
nameLink.appendString(' ' + tag.name);
nameColumn.appendRaw('<br/>');
if (tag.categories && tag.categories.length) {
const categoryElement = dA('<span class="category-children uk-text-small">');
nameColumn.appendRaw(`<span class="uk-text-meta">${L('Referenced by:')}</span> `);
nameColumn.append(categoryElement);
for (let i = 0; i < tag.categories.length; ++i) {
const category = tag.categories[i];
const element = dA('<a href="' +
Pages.getCategoryFullUrl(category) +
'" data-categoryid="' + DOMHelpers.escapeStringForAttribute(category.id) + '" data-categoryname="' +
DOMHelpers.escapeStringForAttribute(category.name) + '">');
categoryElement.append(element);
element.appendString(category.name);
if (i < (tag.categories.length - 1)) {
categoryElement.appendRaw(' · ');
}
}
}
nameColumn.appendRaw(('<div class="uk-text-meta show-compact">' +
`{nrOfThreads} ${L('threads')} · ` +
`{nrOfMessages} ${L('messages')}` +
'</div>')
.replace('{nrOfThreads}', DisplayHelpers.intToString(tag.threadCount))
.replace('{nrOfMessages}', DisplayHelpers.intToString(tag.messageCount)));
}
{
const statisticsColumn = ('<td class="tag-statistics uk-table-shrink hide-compact">\n' +
' <table>\n' +
' <tr>\n' +
' <td class="spaced-number uk-text-right">{nrOfThreads}</td>\n' +
` <td class="spaced-number uk-text-left uk-text-meta">${L('threads')}</td>\n` +
' </tr>\n' +
' <tr>\n' +
' <td class="spaced-number uk-text-right">{nrOfMessages}</td>\n' +
` <td class="spaced-number uk-text-left uk-text-meta">${L('messages')}</td>\n` +
' </tr>\n' +
' </table>\n' +
'</td>')
.replace('{nrOfThreads}', DisplayHelpers.intToString(tag.threadCount))
.replace('{nrOfMessages}', DisplayHelpers.intToString(tag.messageCount));
row.appendRaw(statisticsColumn);
}
{
row.append(ThreadMessagesView.createLatestMessageColumnView(tag.latestMessage));
}
}
const result = tableContainer.toElement();
Views.setupCategoryLinks(result);
Views.setupThreadsWithTagsLinks(result);
Views.setupThreadMessagesOfThreadsLinks(result);
Views.setupThreadMessagesOfMessageParentThreadLinks(result);
return result;
}
function createTagListSortControls(info: Views.SortInfo): HTMLElement {
return DOMHelpers.parseHTML('<div class="tags-list-header">\n' +
' <form>\n' +
' <div class="uk-grid-small uk-child-width-auto uk-grid">\n' +
' <div class="order-by">\n' +
` ${L('Sort by:')}\n` +
Views.createOrderByLabel('name', L('Name'), info) +
Views.createOrderByLabel('threadcount', L('Thread Count'), info) +
Views.createOrderByLabel('messagecount', L('Message Count'), info) +
' </div>\n' +
' <div class="uk-float-right">\n' +
' <select class="uk-select" name="sortOrder">\n' +
Views.createSortOrderOption('ascending', L('Ascending'), info) +
Views.createSortOrderOption('descending', L('Descending'), info) +
' </select>\n' +
' </div>\n' +
' </div>\n' +
' </form>\n' +
'</div>');
}
export function createTagPageHeader(tag: TagRepository.Tag,
callback: PageActions.ITagCallback,
privilegesCallback: PageActions.IPrivilegesCallback): HTMLElement {
const container = cE('div');
DOMHelpers.addClasses(container, 'uk-grid-small', 'tag-page-header');
const badge = cE('span');
if (Privileges.Tag.canEditTagName(tag)) {
const link = EditViews.createEditLink(L('Edit tag name'));
container.appendChild(link);
Views.onClick(link, () => {
const name = EditViews.getInput(L('Edit tag name'), tag.name);
if (name && name.length && (name != tag.name)) {
EditViews.doIfOk(callback.editTagName(tag.id, name), () => {
badge.innerText = tag.name = name;
});
}
});
}
const badgeContainer = cE('div');
container.appendChild(badgeContainer);
DOMHelpers.addClasses(badgeContainer, 'uk-display-inline-block');
badgeContainer.appendChild(badge);
DOMHelpers.addClasses(badge, 'uk-badge', 'uk-icon');
badge.setAttribute('uk-icon', 'icon: tag');
badge.innerText = tag.name;
if (Privileges.Tag.canMergeTags(tag)) {
const link = EditViews.createEditLink(L('Merge tags'), 'git-fork');
container.appendChild(link);
Views.onClick(link, async () => {
const allTags = await callback.getAllTags();
TagsView.showSelectSingleTagDialog(allTags, (selected: string) => {
EditViews.goToTagsPageIfOk(callback.mergeTags(tag.id, selected));
});
});
}
if (Privileges.Tag.canViewTagRequiredPrivileges(tag)
|| Privileges.Tag.canViewTagAssignedPrivileges(tag)) {
const link = EditViews.createEditLink(L('Privileges'), 'settings');
container.appendChild(link);
Views.onClick(link, async () => {
PrivilegesView.showTagPrivileges(tag, privilegesCallback);
});
}
const threadCount = cE('span');
container.appendChild(threadCount);
threadCount.innerText = L('THREADS_COUNT', DisplayHelpers.intToString(tag.threadCount));
const messageCount = cE('span');
container.appendChild(messageCount);
messageCount.innerText = L('MESSAGE_COUNT', DisplayHelpers.intToString(tag.messageCount));
container.appendChild(DOMHelpers.parseHTML(`<span class="uk-text-meta">${L('Referenced by:')} </span>`));
if (tag.categories && tag.categories.length) {
for (let i = 0; i < tag.categories.length; ++i) {
const category = tag.categories[i];
const element = cE('a');
container.appendChild(element);
element.setAttribute('href', Pages.getCategoryFullUrl(category));
element.setAttribute('data-categoryid', category.id);
element.setAttribute('data-categoryname', category.name);
element.innerText = category.name;
if (i < (tag.categories.length - 1)) {
container.appendChild(document.createTextNode(', '));
}
}
}
if (Privileges.Tag.canDeleteTag(tag)) {
const deleteLink = EditViews.createDeleteLink(L('Delete tag'));
container.appendChild(deleteLink);
Views.onClick(deleteLink, () => {
if (EditViews.confirm(L('CONFIRM_DELETE_TAG', tag.name))) {
EditViews.goToTagsPageIfOk(callback.deleteTag(tag.id));
}
});
}
Views.setupCategoryLinks(container);
return container;
}
export function populateTagsInSelect(selectElement: HTMLSelectElement, tags: TagRepository.Tag[],
selectedTags?: TagRepository.Tag[]) {
selectElement.innerHTML = '';
selectedTags = selectedTags || [];
for (let tag of tags) {
const option = cE('option');
option.setAttribute('value', tag.id);
option.innerText = tag.name;
if (selectedTags.find((value) => {
return value.id == tag.id;
})) {
option.setAttribute('selected', '');
}
selectElement.appendChild(option);
}
}
export function createTagSelectionView(tagCallback: PageActions.ITagCallback, tags: TagRepository.Tag[],
selectedTags?: TagRepository.Tag[]): HTMLDivElement {
selectedTags = selectedTags || [];
const result = cE('div') as HTMLDivElement;
DOMHelpers.addClasses(result, 'tag-selection-container');
const searchForm = cE('form');
result.appendChild(searchForm);
DOMHelpers.addClasses(searchForm, 'uk-search', 'uk-search-default');
searchForm.appendChild(DOMHelpers.parseHTML('<span class="uk-search-icon-flip" uk-search-icon></span>'));
const searchInput =
DOMHelpers.parseHTML(`<input class="uk-search-input" type="search" placeholder="${L('Filter...')}" />`) as HTMLInputElement;
searchForm.appendChild(searchInput);
function createEntry(tagId: string, tagName: string): HTMLLabelElement {
const checkBox = cE('input') as HTMLInputElement;
checkBox.type = 'checkbox';
checkBox.setAttribute('value', tagId);
const label = cE('label') as HTMLLabelElement;
label.appendChild(checkBox);
label.appendChild(document.createTextNode(tagName));
label.setAttribute('data-value', tagName.toLowerCase());
checkBox.checked = !! selectedTags.find((value) => {
return value.id == tagId;
});
return label;
}
for (let tag of tags) {
result.appendChild(createEntry(tag.id, tag.name));
}
if (Privileges.ForumWide.canAddNewTag()) {
const tagNameInput =
DOMHelpers.parseHTML(`<input class="uk-input" type="input" placeholder="${L('Add new tag...')}" />`) as HTMLInputElement;
result.appendChild(tagNameInput);
tagNameInput.onkeypress = async ev => {
if ('Enter' === ev.key) {
ev.preventDefault();
const tagName = tagNameInput.value.trim();
if (tagName.length < 1) return;
const tagId = await tagCallback.createTagAndGetId(tagName);
if (tagId && tagId.length) {
const entry = createEntry(tagId, tagName);
(entry.getElementsByTagName('input')[0] as HTMLInputElement).checked = true;
const searchBy = tagName.toLowerCase();
let nextEntry: HTMLElement = null;
DOMHelpers.forEach(result.getElementsByTagName('label'), label => {
if ((null === nextEntry) && label.getAttribute('data-value') > searchBy) {
nextEntry = label as HTMLLabelElement;
}
});
if (null === nextEntry) {
nextEntry = tagNameInput;
}
nextEntry.parentElement.insertBefore(entry, nextEntry);
tagNameInput.value = '';
}
}
}
}
searchInput.onclick = ev => ev.preventDefault();
searchInput.onkeypress = ev => {
if ('Enter' === ev.key) ev.preventDefault();
};
searchInput.oninput = () => {
const toSearch = searchInput.value;
const searchFor = toSearch.toLocaleLowerCase().trim();
DOMHelpers.forEach(result.getElementsByTagName('label'), label => {
DOMHelpers.unHide(label);
if (searchFor.length) {
if (label.getAttribute('data-value').indexOf(searchFor) < 0) {
DOMHelpers.hide(label);
}
}
});
};
return result;
}
export function getSelectedTagIds(container: HTMLElement): string[] {
const result: string[] = [];
DOMHelpers.forEach(container.getElementsByTagName('input'), element => {
const checkbox = element as HTMLInputElement;
if (checkbox.checked) {
result.push(checkbox.value);
}
});
return result;
}
export function showSelectTagsDialog(tagCallback: PageActions.ITagCallback,
currentTags: TagRepository.Tag[], allTags: TagRepository.Tag[],
onSave: (added: string[], removed: string[]) => void): void {
TagRepository.sortByName(allTags);
const modal = document.getElementById('select-tags-modal');
Views.showModal(modal);
const saveButton = DOMHelpers.removeEventListeners(
modal.getElementsByClassName('uk-button-primary')[0] as HTMLElement);
const selectFormElement = modal.getElementsByTagName('form')[0] as HTMLFormElement;
const previousTagIds = new Set();
for (let tag of currentTags) {
previousTagIds.add(tag.id);
}
Views.onClick(saveButton, () => {
const added = [], removed = [];
for (const id of getSelectedTagIds(selectFormElement)) {
if (previousTagIds.has(id)) {
previousTagIds.delete(id);
}
else {
added.push(id);
}
}
previousTagIds.forEach((value) => {
removed.push(value);
});
onSave(added, removed);
});
selectFormElement.innerHTML = '';
selectFormElement.appendChild(createTagSelectionView(tagCallback, allTags, currentTags));
}
export function showSelectSingleTagDialog(allTags: TagRepository.Tag[], onSave: (selected: string) => void): void {
TagRepository.sortByName(allTags);
const modal = document.getElementById('select-single-tag-modal');
Views.showModal(modal);
const saveButton = DOMHelpers.removeEventListeners(
modal.getElementsByClassName('uk-button-primary')[0] as HTMLElement);
const selectElement = modal.getElementsByTagName('select')[0] as HTMLSelectElement;
Views.onClick(saveButton, () => {
const selected = selectElement.selectedOptions;
if (selected.length) {
const id = selected[0].getAttribute('value');
onSave(id);
}
});
populateTagsInSelect(selectElement, allTags);
}
function createAddNewTagElement(callback: PageActions.ITagCallback): HTMLElement {
const button = EditViews.createAddNewButton(L('Add Tag'));
Views.onClick(button, () => {
const name = EditViews.getInput(L('Enter the new tag name'));
if ((null === name) || (name.length < 1)) return;
EditViews.reloadPageIfOk(callback.createTag(name));
});
return EditViews.wrapAddElements(button);
}
}
| {
"content_hash": "02cf0f644ae766a7e650d7592bcd1dc2",
"timestamp": "",
"source": "github",
"line_count": 544,
"max_line_length": 137,
"avg_line_length": 36.64154411764706,
"alnum_prop": 0.5452265088044951,
"repo_name": "danij/Forum.WebClient",
"id": "8c1291b7622a6219208b72cbc481d44844f2c3e9",
"size": "19936",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/views/tagsView.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "34248"
},
{
"name": "HTML",
"bytes": "30692"
},
{
"name": "JavaScript",
"bytes": "5769"
},
{
"name": "Shell",
"bytes": "679"
},
{
"name": "TypeScript",
"bytes": "601375"
}
],
"symlink_target": ""
} |
package org.vaadin.spring.navigator.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import org.vaadin.spring.annotation.VaadinComponent;
import org.vaadin.spring.annotation.VaadinUIScope;
import org.vaadin.spring.navigator.SpringViewProvider;
/**
* Annotation to be placed on {@link org.vaadin.spring.navigator.Presenter}-classes that employ a
* {@link SpringViewProvider} and an {@link org.vaadin.spring.events.EventBus}.
* <p>
* This annotation is also a stereotype annotation, so Spring will automatically detect the annotated classes.
* <p>
* This is an example of a presenter that is mapped to a view name:
* <pre>
* <code>
* @VaadinPresenter(viewName = "myView")
* public class MyPresenter extends Presenter {
* // ...
* }
* </code>
* </pre>
*
* The <code>viewName</code> must match the <code>name</code> attribute of a {@link org.vaadin.spring.navigator.annotation.VaadinView} annotated {@link com.vaadin.navigator.View}.
*
* @author Chris Phillipson ([email protected])
*/
@Target({java.lang.annotation.ElementType.TYPE})
@Retention(java.lang.annotation.RetentionPolicy.RUNTIME)
@Documented
@VaadinUIScope
@VaadinComponent
public @interface VaadinPresenter {
/**
* A presenter will always be matched with a view in an application.
*/
String viewName();
}
| {
"content_hash": "5a17e56aac6662cc83d911407aff4c8e",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 179,
"avg_line_length": 32.83720930232558,
"alnum_prop": 0.7365439093484419,
"repo_name": "fastnsilver/vaadin4spring",
"id": "61606a5ffdd4e55eecb38091020352793755aeee",
"size": "2013",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spring-vaadin-mvp/src/main/java/org/vaadin/spring/navigator/annotation/VaadinPresenter.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "665"
},
{
"name": "Java",
"bytes": "383776"
}
],
"symlink_target": ""
} |
package kieker.monitoring.core.registry;
import java.security.SecureRandom;
import java.util.Stack;
import java.util.WeakHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import kieker.common.logging.Log;
import kieker.common.logging.LogFactory;
import kieker.common.record.flow.trace.TraceMetadata;
import kieker.monitoring.core.controller.MonitoringController;
/**
* @author Jan Waller
*
* @since 1.5
*/
public enum TraceRegistry { // Singleton (Effective Java #3)
/** The singleton instance. */
INSTANCE;
private static final Log LOG = LogFactory.getLog(TraceRegistry.class); // NOPMD (enum logger)
private final AtomicInteger nextTraceId = new AtomicInteger(0);
private final long unique = MonitoringController.getInstance().isDebug() ? 0 : ((long) new SecureRandom().nextInt()) << 32; // NOCS
/** the hostname is final after the instantiation of the monitoring controller. */
private final String hostname = MonitoringController.getInstance().getHostname();
/** the current trace; null if new trace. */
private final ThreadLocal<TraceMetadata> traceStorage = new ThreadLocal<TraceMetadata>();
/** used to store the stack of enclosing traces; null if no sub trace created yet. */
private final ThreadLocal<Stack<TraceMetadata>> enclosingTraceStack = new ThreadLocal<Stack<TraceMetadata>>();
/** store the parent Trace. */
private final WeakHashMap<Thread, TracePoint> parentTrace = new WeakHashMap<Thread, TracePoint>();
private final long getNewId() {
return this.unique | this.nextTraceId.getAndIncrement();
}
/**
* Gets a Trace for the current thread. If no trace is active, null is returned.
*
* @return
* Trace object or null
*/
public final TraceMetadata getTrace() {
return this.traceStorage.get();
}
/**
* This creates a new unique Trace object and registers it.
*
* @return
* Trace object
*/
public final TraceMetadata registerTrace() {
final TraceMetadata enclosingTrace = this.getTrace();
if (enclosingTrace != null) { // we create a subtrace
Stack<TraceMetadata> localTraceStack = this.enclosingTraceStack.get();
if (localTraceStack == null) {
localTraceStack = new Stack<TraceMetadata>();
this.enclosingTraceStack.set(localTraceStack);
}
localTraceStack.push(enclosingTrace);
}
final Thread thread = Thread.currentThread();
final TracePoint tp = this.getAndRemoveParentTraceId(thread);
final long traceId = this.getNewId();
final long parentTraceId;
final int parentOrderId;
if (tp != null) { // we have a known split point
if ((enclosingTrace != null) && (enclosingTrace.getTraceId() != tp.traceId)) {
LOG.error("Enclosing trace does not match split point. Found: " + enclosingTrace.getTraceId() + " expected: " + tp.traceId);
}
parentTraceId = tp.traceId;
parentOrderId = tp.orderId;
} else if (enclosingTrace != null) { // we create a sub trace without a known split point
parentTraceId = enclosingTrace.getTraceId();
parentOrderId = -1; // we could instead get the last orderId ... But this would make it harder to distinguish from known split points
} else { // we create a new trace without a parent
parentTraceId = traceId;
parentOrderId = -1;
}
final String sessionId = SessionRegistry.INSTANCE.recallThreadLocalSessionId();
final TraceMetadata trace = new TraceMetadata(traceId, thread.getId(), sessionId, this.hostname, parentTraceId, parentOrderId);
this.traceStorage.set(trace);
return trace;
}
/**
* Unregisters the current Trace object.
*
* Future calls of getTrace() will either return null or the enclosing trace object.
*/
public final void unregisterTrace() {
final Stack<TraceMetadata> localTraceStack = this.enclosingTraceStack.get();
if (localTraceStack != null) { // we might have an enclosing trace and and are able to restore it
if (!localTraceStack.isEmpty()) { // we actually found something
this.traceStorage.set(localTraceStack.pop());
} else {
this.enclosingTraceStack.remove();
this.traceStorage.remove();
}
} else {
this.traceStorage.remove();
}
}
private final TracePoint getAndRemoveParentTraceId(final Thread t) {
synchronized (this) {
return this.parentTrace.remove(t);
}
}
/**
* Sets the parent for the next created trace inside this thread.
* This method should be used by probes in connection with SpliEvents.
*
* @param t
* the thread the new trace belongs to
* @param traceId
* the parent trace id
* @param orderId
* the parent order id
*/
public final void setParentTraceId(final Thread t, final long traceId, final int orderId) {
synchronized (this) {
this.parentTrace.put(t, new TracePoint(traceId, orderId));
}
}
/**
* @author Jan Waller
*/
private static final class TracePoint {
public final long traceId; // NOCS (public no setters or getters)
public final int orderId; // NOCS (public no setters or getters)
public TracePoint(final long traceId, final int orderId) {
this.traceId = traceId;
this.orderId = orderId;
}
}
}
| {
"content_hash": "88c01dd42ef8e3f8f859ba3375fa20cd",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 136,
"avg_line_length": 34.37162162162162,
"alnum_prop": 0.718498132494594,
"repo_name": "leadwire-apm/leadwire-javaagent",
"id": "e3a2c7fbe0ad6cd7ee2d79f96762624ff1807578",
"size": "5863",
"binary": false,
"copies": "1",
"ref": "refs/heads/stable",
"path": "leadwire-monitoring/src/kieker/monitoring/core/registry/TraceRegistry.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "11219"
},
{
"name": "Java",
"bytes": "2473607"
},
{
"name": "Python",
"bytes": "14400"
}
],
"symlink_target": ""
} |
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "ae57127157e27b66c4f6ac53e9859aeb",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.23076923076923,
"alnum_prop": 0.6917293233082706,
"repo_name": "mdoering/backbone",
"id": "115614791c79c31f34f3097134c2be4f4bba65d6",
"size": "202",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Brassicales/Brassicaceae/Eudema/Eudema hauthalii/ Syn. Brayopsis hauthalii/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
package pl.touk.nussknacker.engine.flink.util.transformer
import com.typesafe.config.Config
import pl.touk.nussknacker.engine.api.component.{ComponentDefinition, ComponentProvider, NussknackerVersion}
import pl.touk.nussknacker.engine.api.process.{ProcessObjectDependencies, SinkFactory}
import pl.touk.nussknacker.engine.flink.util.sink.EmptySink
import pl.touk.nussknacker.engine.flink.util.transformer.aggregate.sampleTransformers.{SessionWindowAggregateTransformer, SlidingAggregateTransformerV2, TumblingAggregateTransformer}
import pl.touk.nussknacker.engine.flink.util.transformer.join.{FullOuterJoinTransformer, SingleSideJoinTransformer}
import pl.touk.nussknacker.engine.util.config.DocsConfig
class FlinkBaseComponentProvider extends ComponentProvider {
override def providerName: String = "base"
override def resolveConfigForExecution(config: Config): Config = config
override def create(config: Config, dependencies: ProcessObjectDependencies): List[ComponentDefinition] = {
val docsConfig: DocsConfig = new DocsConfig(config)
import docsConfig._
//When adding/changing stateful components, corresponding changes should be done in LiteBaseComponentProvider!
val statelessComponents = List(
ComponentDefinition("for-each", ForEachTransformer).withRelativeDocs("BasicNodes#foreach"),
ComponentDefinition("union", UnionTransformer).withRelativeDocs("BasicNodes#union"),
ComponentDefinition("dead-end", SinkFactory.noParam(EmptySink)).withRelativeDocs("BasicNodes#deadend"),
ComponentDefinition("periodic", PeriodicSourceFactory).withRelativeDocs("BasicNodes#periodic")
)
val statefulComponents = List(
ComponentDefinition("union-memo", UnionWithMemoTransformer).withRelativeDocs("BasicNodes#unionmemo"),
ComponentDefinition("previousValue", PreviousValueTransformer).withRelativeDocs("BasicNodes#previousvalue"),
ComponentDefinition("aggregate-sliding", SlidingAggregateTransformerV2).withRelativeDocs("AggregatesInTimeWindows#sliding-window"),
ComponentDefinition("aggregate-tumbling", TumblingAggregateTransformer).withRelativeDocs("AggregatesInTimeWindows#tumbling-window"),
ComponentDefinition("aggregate-session", SessionWindowAggregateTransformer).withRelativeDocs("AggregatesInTimeWindows#session-window"),
ComponentDefinition("single-side-join", SingleSideJoinTransformer).withRelativeDocs("AggregatesInTimeWindows#single-side-join"),
ComponentDefinition("full-outer-join", FullOuterJoinTransformer).withRelativeDocs("AggregatesInTimeWindows#single-side-join"),
ComponentDefinition("delay", DelayTransformer).withRelativeDocs("BasicNodes#delay"),
)
statefulComponents ++ statelessComponents
}
override def isCompatible(version: NussknackerVersion): Boolean = true
override def isAutoLoaded: Boolean = true
}
| {
"content_hash": "4d39e7519dee43cc71f18ce0679013ea",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 182,
"avg_line_length": 63.355555555555554,
"alnum_prop": 0.8172571027709575,
"repo_name": "TouK/nussknacker",
"id": "5e3670b20da0dd851765ad4413a55dccebe81994",
"size": "2851",
"binary": false,
"copies": "1",
"ref": "refs/heads/staging",
"path": "engine/flink/components/base/src/main/scala/pl/touk/nussknacker/engine/flink/util/transformer/FlinkBaseComponentProvider.scala",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "3757"
},
{
"name": "Dockerfile",
"bytes": "597"
},
{
"name": "HTML",
"bytes": "3573"
},
{
"name": "Java",
"bytes": "240995"
},
{
"name": "JavaScript",
"bytes": "189903"
},
{
"name": "PLSQL",
"bytes": "269"
},
{
"name": "Scala",
"bytes": "5323010"
},
{
"name": "Shell",
"bytes": "42521"
},
{
"name": "Stylus",
"bytes": "60452"
},
{
"name": "TypeScript",
"bytes": "991644"
}
],
"symlink_target": ""
} |
.btn-file {
position: relative;
overflow: hidden;
text-align: center;
border-radius: 0;
}
.btn-file input[type=file] {
position: absolute;
top: 0;
right: 0;
min-width: 100%;
min-height: 100%;
font-size: 100px;
text-align: right;
filter: alpha(opacity=0);
opacity: 0;
outline: none;
background: white;
cursor: inherit;
display: block;
}
.match-making{
margin-top: 70px;
}
.fa-heart-o,.fa-heart, .textLove {
color: #d9534f !important;
}
.btnMakingMatch {
text-decoration: none;
}
a.btnMakingMatch:hover{
border-bottom: none;
text-decoration: none;
}
| {
"content_hash": "8ffaa7108b5c33ed46b9b4ac646ce5a5",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 34,
"avg_line_length": 18.2,
"alnum_prop": 0.6153846153846154,
"repo_name": "sakukode/lovesmatch",
"id": "977b1fa9ff933b2c041cc073d2d118e8aa419022",
"size": "637",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "client/views/frontend/index.css",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "7819"
},
{
"name": "HTML",
"bytes": "109349"
},
{
"name": "JavaScript",
"bytes": "197271"
},
{
"name": "Perl",
"bytes": "23"
},
{
"name": "Shell",
"bytes": "16"
},
{
"name": "XML",
"bytes": "328"
}
],
"symlink_target": ""
} |
package org.apache.drill.exec.store.parquet;
import io.netty.buffer.DrillBuf;
import java.io.IOException;
import java.io.OutputStream;
import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.parquet.bytes.BytesInput;
import org.apache.parquet.format.PageHeader;
import org.apache.parquet.format.Util;
import org.apache.parquet.hadoop.util.HadoopStreams;
/**
* @deprecated it is never used. So can be removed in Drill 1.21.0
*/
public class ColumnDataReader {
static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ColumnDataReader.class);
private final long endPosition;
public final FSDataInputStream input;
public ColumnDataReader(FSDataInputStream input, long start, long length) throws IOException{
this.input = input;
this.input.seek(start);
this.endPosition = start + length;
}
public PageHeader readPageHeader() throws IOException{
return Util.readPageHeader(input);
}
public FSDataInputStream getInputStream() {
return input;
}
public BytesInput getPageAsBytesInput(int pageLength) throws IOException{
byte[] b = new byte[pageLength];
input.read(b);
return new HadoopBytesInput(b);
}
public void loadPage(DrillBuf target, int pageLength) throws IOException {
target.clear();
HadoopStreams.wrap(input).read(target.nioBuffer(0, pageLength));
target.writerIndex(pageLength);
}
public void clear(){
try{
input.close();
}catch(IOException ex){
logger.warn("Error while closing input stream.", ex);
}
}
public boolean hasRemainder() throws IOException{
return input.getPos() < endPosition;
}
public class HadoopBytesInput extends BytesInput{
private final byte[] pageBytes;
public HadoopBytesInput(byte[] pageBytes) {
super();
this.pageBytes = pageBytes;
}
@Override
public byte[] toByteArray() throws IOException {
return pageBytes;
}
@Override
public long size() {
return pageBytes.length;
}
@Override
public void writeAllTo(OutputStream out) throws IOException {
out.write(pageBytes);
}
}
}
| {
"content_hash": "869a01e14e09579e66c7351379a4710f",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 99,
"avg_line_length": 24.517241379310345,
"alnum_prop": 0.7149554617909049,
"repo_name": "vvysotskyi/drill",
"id": "1d9ccdad5095696e0364a02ff568c072c4f92521",
"size": "2934",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ColumnDataReader.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "22729"
},
{
"name": "Batchfile",
"bytes": "7541"
},
{
"name": "C",
"bytes": "31425"
},
{
"name": "C++",
"bytes": "595697"
},
{
"name": "CMake",
"bytes": "25162"
},
{
"name": "CSS",
"bytes": "15681"
},
{
"name": "Dockerfile",
"bytes": "8534"
},
{
"name": "FreeMarker",
"bytes": "208130"
},
{
"name": "HTML",
"bytes": "1398"
},
{
"name": "Java",
"bytes": "34179251"
},
{
"name": "JavaScript",
"bytes": "83256"
},
{
"name": "Shell",
"bytes": "122305"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "4fb5c0664d818080ef97361f4201f60a",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.307692307692308,
"alnum_prop": 0.6940298507462687,
"repo_name": "mdoering/backbone",
"id": "072638bcfbbeec444967809b070a04196920b90c",
"size": "184",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Chlorophyta/Chlorophyceae/Volvocales/Phacotaceae/Pteromonas/Pteromonas spinosa/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.pfe.services;
import com.pfe.exceptions.*;
import java.util.*;
import org.springframework.stereotype.*;
import org.springframework.validation.*;
/**
*
* @author Karim
*/
@Service
public class ValidatorService {
public Object validate(BindingResult binding,List<String> fields) throws OperationNotCompletException{
if(binding == null || !binding.hasFieldErrors())
return null;
if(fields == null || fields.isEmpty())
throw new OperationNotCompletException(binding.getFieldError().getDefaultMessage());
for(String field : fields){
if(binding.hasFieldErrors(field)){
throw new OperationNotCompletException(binding.getFieldError(field).getDefaultMessage());
}
}
return null;
}
}
| {
"content_hash": "6b21b88c1c04d310a27ccdc667cfd78f",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 106,
"avg_line_length": 33.096774193548384,
"alnum_prop": 0.6578947368421053,
"repo_name": "elrhourha/pfe",
"id": "fc0ae55df84f0e563e0affd92997b7feb7368357",
"size": "1026",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/com/pfe/services/ValidatorService.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "453"
},
{
"name": "Java",
"bytes": "258794"
}
],
"symlink_target": ""
} |
{% load i18n wagtailadmin_tags %}
{% if tasks %}
{% if search_form.is_searching %}
<h2 role="alert">
{% blocktrans trimmed count counter=tasks.paginator.count %}
There is {{ counter }} match
{% plural %}
There are {{ counter }} matches
{% endblocktrans %}
</h2>
{% else %}
<h2>{% trans "Tasks" %}</h2>
{% endif %}
<table class="listing">
<thead>
<tr class="table-headers">
<th>
{% trans "Name" %}
</th>
{% if search_form.specific_task_model_selected %}
{# TODO #}
{% else %}
<th>
{% trans "Task type" %}
</th>
{% endif %}
<th>
{% trans "Used on" %}
</th>
</tr>
</thead>
<tbody>
{% for task in tasks %}
<tr>
<td class="title">
<div class="title-wrapper"><a href="{% url 'wagtailadmin_workflows:task_chosen' task.id %}" class="task-choice">{{ task.name }}</a></div>
</td>
{% if search_form.specific_task_model_selected %}
{# TODO #}
{% else %}
<td>
{{ task.content_type.name }}
</td>
{% endif %}
<td>
{% for workflow in task.active_workflows|slice:":5" %}
{{ workflow.name }}{% if not forloop.last %}, {% endif %}
{% empty %}
{% trans "Not used" %}
{% endfor %}
{% if task.active_workflows.count > 5 %}
{% blocktrans trimmed count counter=task.active_workflows.count|add:-5 %}+{{ counter }} more{% plural %}+{{ counter }} more{% endblocktrans %}
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% include "wagtailadmin/shared/pagination_nav.html" with items=tasks linkurl='wagtailadmin_workflows:task_chooser_results' %}
{% else %}
{% if all_tasks.exists %}
<p role="alert">{% blocktrans trimmed %}Sorry, no tasks match "<em>{{ query_string }}</em>"{% endblocktrans %}</p>
{% else %}
<p>
{% trans "You haven't created any tasks." %}
{% if can_create %}
{% blocktrans trimmed %}
Why not <a class="create-one-now" href="#tab-new" data-tab-trigger>create one now</a>?
{% endblocktrans %}
{% endif %}
</p>
{% endif %}
{% endif %}
| {
"content_hash": "2b23dfdeb4750e41131b611ec9ac43e4",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 170,
"avg_line_length": 38.52,
"alnum_prop": 0.3925233644859813,
"repo_name": "zerolab/wagtail",
"id": "441412d461a6f831e4293278cb46dada2d042864",
"size": "2889",
"binary": false,
"copies": "4",
"ref": "refs/heads/main",
"path": "wagtail/admin/templates/wagtailadmin/workflows/task_chooser/includes/results.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "2522"
},
{
"name": "Dockerfile",
"bytes": "2041"
},
{
"name": "HTML",
"bytes": "593037"
},
{
"name": "JavaScript",
"bytes": "615631"
},
{
"name": "Makefile",
"bytes": "1413"
},
{
"name": "Python",
"bytes": "6560334"
},
{
"name": "SCSS",
"bytes": "219204"
},
{
"name": "Shell",
"bytes": "6845"
},
{
"name": "TypeScript",
"bytes": "288102"
}
],
"symlink_target": ""
} |
// Originally from UpdatedComponentTests/StandardTesting/REST/Rest_Get_SimpleOperation_DelegateResponse.xls;
package com.betfair.cougar.tests.updatedcomponenttests.standardtesting.rest;
import com.betfair.testing.utils.cougar.misc.XMLHelpers;
import com.betfair.testing.utils.cougar.assertions.AssertionUtils;
import com.betfair.testing.utils.cougar.beans.HttpCallBean;
import com.betfair.testing.utils.cougar.beans.HttpResponseBean;
import com.betfair.testing.utils.cougar.enums.CougarMessageProtocolRequestTypeEnum;
import com.betfair.testing.utils.cougar.manager.CougarManager;
import com.betfair.testing.utils.cougar.manager.RequestLogRequirement;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import java.sql.Timestamp;
import java.util.HashMap;
import java.util.Map;
/**
* Ensure that when a simple Rest XML/JSON Get is performed against Cougar, the repsonse can be populate using a delegate.
*/
public class RestGetSimpleOperationDelegateResponseTest {
@Test
public void doTest() throws Exception {
// Set up the Http Call Bean to make the request
CougarManager cougarManager1 = CougarManager.getInstance();
HttpCallBean getNewHttpCallBean1 = cougarManager1.getNewHttpCallBean("87.248.113.14");
cougarManager1 = cougarManager1;
getNewHttpCallBean1.setOperationName("testSimpleGetQA");
getNewHttpCallBean1.setServiceName("baseline", "cougarBaseline");
getNewHttpCallBean1.setVersion("v2");
// Instruct Cougar to populate the response using a delegate
Map map2 = new HashMap();
map2.put("message","DELEGATE");
getNewHttpCallBean1.setQueryParams(map2);
// Get current time for getting log entries later
Timestamp getTimeAsTimeStamp7 = new Timestamp(System.currentTimeMillis());
// Make the 4 REST calls to the operation
cougarManager1.makeRestCougarHTTPCalls(getNewHttpCallBean1);
// Create the expected response as an XML document
XMLHelpers xMLHelpers4 = new XMLHelpers();
Document createAsDocument9 = xMLHelpers4.getXMLObjectFromString("<SimpleResponse><message>Hardcoded delegate response</message></SimpleResponse>");
// Convert the expected response to REST types for comparison with actual responses
Map<CougarMessageProtocolRequestTypeEnum, Object> convertResponseToRestTypes10 = cougarManager1.convertResponseToRestTypes(createAsDocument9, getNewHttpCallBean1);
// Check the 4 responses are as expected
HttpResponseBean response5 = getNewHttpCallBean1.getResponseObjectsByEnum(com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum.RESTXMLXML);
AssertionUtils.multiAssertEquals(convertResponseToRestTypes10.get(CougarMessageProtocolRequestTypeEnum.RESTXML), response5.getResponseObject());
AssertionUtils.multiAssertEquals((int) 200, response5.getHttpStatusCode());
AssertionUtils.multiAssertEquals("OK", response5.getHttpStatusText());
HttpResponseBean response6 = getNewHttpCallBean1.getResponseObjectsByEnum(com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum.RESTJSONJSON);
AssertionUtils.multiAssertEquals(convertResponseToRestTypes10.get(CougarMessageProtocolRequestTypeEnum.RESTJSON), response6.getResponseObject());
AssertionUtils.multiAssertEquals((int) 200, response6.getHttpStatusCode());
AssertionUtils.multiAssertEquals("OK", response6.getHttpStatusText());
HttpResponseBean response7 = getNewHttpCallBean1.getResponseObjectsByEnum(com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum.RESTXMLJSON);
AssertionUtils.multiAssertEquals(convertResponseToRestTypes10.get(CougarMessageProtocolRequestTypeEnum.RESTJSON), response7.getResponseObject());
AssertionUtils.multiAssertEquals((int) 200, response7.getHttpStatusCode());
AssertionUtils.multiAssertEquals("OK", response7.getHttpStatusText());
HttpResponseBean response8 = getNewHttpCallBean1.getResponseObjectsByEnum(com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum.RESTJSONXML);
AssertionUtils.multiAssertEquals(convertResponseToRestTypes10.get(CougarMessageProtocolRequestTypeEnum.RESTXML), response8.getResponseObject());
AssertionUtils.multiAssertEquals((int) 200, response8.getHttpStatusCode());
AssertionUtils.multiAssertEquals("OK", response8.getHttpStatusText());
// Check the log entries are as expected
cougarManager1.verifyRequestLogEntriesAfterDate(getTimeAsTimeStamp7, new RequestLogRequirement("2.8", "testSimpleGetQA"),new RequestLogRequirement("2.8", "testSimpleGetQA"),new RequestLogRequirement("2.8", "testSimpleGetQA"),new RequestLogRequirement("2.8", "testSimpleGetQA") );
}
}
| {
"content_hash": "fb07af105c4b109fe24ba94bf83e2e6c",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 287,
"avg_line_length": 64.30263157894737,
"alnum_prop": 0.7816656435440966,
"repo_name": "olupas/cougar",
"id": "2863d560db78edde68c8ea4dc1ea031cd2f93a29",
"size": "5500",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "cougar-test/cougar-normal-code-tests/src/test/java/com/betfair/cougar/tests/updatedcomponenttests/standardtesting/rest/RestGetSimpleOperationDelegateResponseTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C++",
"bytes": "83394"
},
{
"name": "HTML",
"bytes": "23595"
},
{
"name": "Java",
"bytes": "9535986"
},
{
"name": "Shell",
"bytes": "19139"
},
{
"name": "XSLT",
"bytes": "57361"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using KeyPay.DomainModels.V2.PayRun;
using KeyPay.DomainModels.V2.Report;
using KeyPay.Enums;
using Newtonsoft.Json;
namespace KeyPay.ApiFunctions.V2
{
public class ReportFunction : BaseFunction
{
public ReportFunction(ApiRequestExecutor api) : base(api)
{
}
public List<ActivityReportExportModel> PayRunActivity(int businessId, DateTime fromDate, DateTime toDate, int payScheduleId = 0, int locationId = 0)
{
return ApiRequest<List<ActivityReportExportModel>>(string.Format("/business/{0}/report/payrunactivity?fromDate={1:yyyy-MM-dd}&toDate={2:yyyy-MM-dd}&payScheduleId={3}&locationId={4}", businessId, fromDate, toDate, payScheduleId, locationId));
}
public List<DetailedActivityReportExportModel> DetailedActivity(int businessId, DateTime fromDate, DateTime toDate, int payScheduleId = 0, int locationId = 0, int? employingEntityId = 0)
{
return ApiRequest<List<DetailedActivityReportExportModel>>(string.Format("/business/{0}/report/detailedactivity?fromDate={1:yyyy-MM-dd}&toDate={2:yyyy-MM-dd}&payScheduleId={3}&locationId={4}&employingEntityId={5}", businessId, fromDate, toDate, payScheduleId, locationId, employingEntityId));
}
public List<SuperAccrualExportModel> SuperContributionsByEmployee(int businessId, DateTime fromDate, DateTime toDate, int payScheduleId = 0, int locationId = 0, int? employingEntityId = 0)
{
return ApiRequest<List<SuperAccrualExportModel>>(string.Format("/business/{0}/report/supercontributions/byemployee?fromDate={1:yyyy-MM-dd}&toDate={2:yyyy-MM-dd}&payScheduleId={3}&locationId={4}&employingEntityId={5}", businessId, fromDate, toDate, payScheduleId, locationId, employingEntityId));
}
public List<SuperContributionsReportExportModel> SuperContributionsBySuperFund(int businessId, DateTime fromDate, DateTime toDate, int payScheduleId = 0, int locationId = 0, int? employingEntityId = 0)
{
return ApiRequest<List<SuperContributionsReportExportModel>>(string.Format("/business/{0}/report/supercontributions/bysuperfund?fromDate={1:yyyy-MM-dd}&toDate={2:yyyy-MM-dd}&payScheduleId={3}&locationId={4}&employingEntityId={5}", businessId, fromDate, toDate, payScheduleId, locationId, employingEntityId));
}
public List<DeductionsReportExportModel> Deductions(int businessId, DateTime fromDate, DateTime toDate, int payScheduleId = 0, int locationId = 0, int employeeId = 0, int deductionCategoryId = 0, int? employingEntityId = 0)
{
return ApiRequest<List<DeductionsReportExportModel>>(string.Format("/business/{0}/report/deductions?fromDate={1:yyyy-MM-dd}&toDate={2:yyyy-MM-dd}&locationId={3}&employeeId={4}&deductionCategoryId={5}&payScheduleId={6}&employingEntityId={7}", businessId, fromDate, toDate, locationId, employeeId, deductionCategoryId, payScheduleId, employingEntityId));
}
public List<PayCategoriesReportExportModel> PayCategories(int businessId, DateTime fromDate, DateTime toDate, int payScheduleId = 0, int locationId = 0, int employeeId = 0, int? employingEntityId = 0, bool groupByEarningsLocation = false)
{
return ApiRequest<List<PayCategoriesReportExportModel>>(string.Format("/business/{0}/report/paycategories?fromDate={1:yyyy-MM-dd}&toDate={2:yyyy-MM-dd}&locationId={3}&employeeId={4}&payScheduleId={5}&employingEntityId={6}&groupByEarningsLocation={7}", businessId, fromDate, toDate, locationId, employeeId, payScheduleId, employingEntityId, groupByEarningsLocation));
}
public List<PaymentHistoryReportExportModel> PaymentHistory(int businessId, DateTime fromDate, DateTime toDate, int locationId = 0, int employeeId = 0, int? employingEntityId = 0)
{
return ApiRequest<List<PaymentHistoryReportExportModel>>(string.Format("/business/{0}/report/paymenthistory?fromDate={1:yyyy-MM-dd}&toDate={2:yyyy-MM-dd}&locationId={3}&employeeId={4}&employingEntityId={5}", businessId, fromDate, toDate, locationId, employeeId, employingEntityId));
}
public List<LeaveBalancesReportExportModel> LeaveBalances(int businessId, int locationId = 0, int leaveTypeId = 0, bool useDefaultLocation = false, int? employingEntityId = 0)
{
var groupBy = useDefaultLocation ? LeaveReportDisplay.DefaultLocation : LeaveReportDisplay.AccrualLocation;
return ApiRequest<List<LeaveBalancesReportExportModel>>(string.Format("/business/{0}/report/leavebalances?locationId={1}&leaveTypeId={2}&groupBy={3}&employingEntityId={4}", businessId, locationId, leaveTypeId, groupBy, employingEntityId));
}
public List<BirthdayReportExportModel> Birthday(int businessId, DateTime fromDate, DateTime toDate, int locationId = 0)
{
return ApiRequest<List<BirthdayReportExportModel>>(string.Format("/business/{0}/report/birthday?fromDate={1:yyyy-MM-dd}&toDate={2:yyyy-MM-dd}&locationId={3}", businessId, fromDate, toDate, locationId));
}
public List<RosterLiveLeaveAccruals> LeaveBalancesExport(int businessId, int[] payScheduleIds)
{
var payScheduleFilter = new StringBuilder();
if (payScheduleIds != null && payScheduleIds.Any())
{
payScheduleFilter.Append("?");
foreach (var payScheduleId in payScheduleIds)
{
payScheduleFilter.AppendFormat("payScheduleIds={0}&", payScheduleId);
}
}
var result = ApiJsonRequest(string.Format("/business/{0}/report/leavebalancesexport{1}", businessId, payScheduleFilter));
return JsonConvert.DeserializeObject<List<RosterLiveLeaveAccruals>>(result);
}
public List<PayrollExemptReportExportModel> PayrollExempt(int businessId, DateTime fromDate, DateTime toDate, int payScheduleId = 0, int locationId = 0, int? employingEntityId = 0, string state = null)
{
return ApiRequest<List<PayrollExemptReportExportModel>>(string.Format("/business/{0}/report/payrollexempt?fromDate={1:yyyy-MM-dd}&toDate={2:yyyy-MM-dd}&locationId={3}&payscheduleid={4}&employingEntityId={5}&state={6}", businessId, fromDate, toDate, locationId, payScheduleId, employingEntityId, state));
}
public List<MLCSuperReportExportModel> MLCSuperExport(int businessId, int[] payScheduleIds)
{
var payScheduleFilter = new StringBuilder();
if (payScheduleIds != null && payScheduleIds.Any())
{
payScheduleFilter.Append("?");
foreach (var payScheduleId in payScheduleIds)
{
payScheduleFilter.AppendFormat("payScheduleIds={0}&", payScheduleId);
}
}
return ApiRequest<List<MLCSuperReportExportModel>>(string.Format("/business/{0}/report/mlcsuper{1}", businessId, payScheduleFilter));
}
public List<WorkersCompReportGridModel> WorkersComp(int businessId, DateTime fromDate, DateTime toDate, int locationId = 0)
{
var url = string.Format("/business/{0}/report/workerscomp?fromDate={1:yyyy-MM-dd}&toDate={2:yyyy-MM-dd}&locationId={3}", businessId, fromDate, toDate, locationId);
return ApiRequest<List<WorkersCompReportGridModel>>(url);
}
public List<LeaveHistoryReportGroupModel> LeaveHistory(int businessId, DateTime fromDate, DateTime toDate, int payScheduleId = 0, int locationId = 0)
{
var url = string.Format("/business/{0}/report/leavehistory?fromDate={1:yyyy-MM-dd}&toDate={2:yyyy-MM-dd}&payScheduleId={3}&locationId={4}", businessId, fromDate, toDate, payScheduleId, locationId);
return ApiRequest<List<LeaveHistoryReportGroupModel>>(url);
}
public List<EmployeeDetailsReportField> EmployeeDetailsFields(int businessId)
{
var url = string.Format("/business/{0}/report/employeedetails/fields", businessId);
return ApiRequest<List<EmployeeDetailsReportField>>(url);
}
public List<dynamic> EmployeeDetails(int businessId, List<string> selectedFields, int locationId = 0, int? employingEntityId = null, bool includeActive = true, bool includeInactive = true)
{
var combinedSelectedFields = "";
if (selectedFields != null && selectedFields.Any())
{
var builder = new StringBuilder();
foreach (var selectedField in selectedFields)
{
builder.AppendFormat("selectedColumns={0}&", selectedField);
}
combinedSelectedFields = builder.ToString();
}
var url = string.Format("/business/{0}/report/employeedetails?{1}locationId={2}&includeActive={3}&includeInactive={4}", businessId, combinedSelectedFields, locationId, includeActive, includeInactive);
if (employingEntityId != null)
{
url = string.Format("{0}&employingEntityId={1}", url, employingEntityId);
}
var data = ApiJsonRequest<List<dynamic>>(url);
return data;
}
public List<PayrollTaxReportExportModel> PayrollTax(int businessId, DateTime fromDate, DateTime toDate, int locationId = 0, int? employingEntityId = null)
{
var url = string.Format("/business/{0}/report/payrolltax?fromDate={1:yyyy-MM-dd}&toDate={2:yyyy-MM-dd}&locationId={3}{4}", businessId, fromDate, toDate, locationId, employingEntityId.HasValue ? "&employingEntityId=" + employingEntityId.Value : "");
return ApiJsonRequest<List<PayrollTaxReportExportModel>>(url);
}
public List<PaygReportExportModel> PaygWithholding(int businessId, DateTime fromDate, DateTime toDate, int locationId = 0, int? employingEntityId = null, string state = null)
{
var url = string.Format("/business/{0}/report/payg?fromDate={1:yyyy-MM-dd}&toDate={2:yyyy-MM-dd}&locationId={3}&state={4}{5}", businessId, fromDate, toDate, locationId, state, employingEntityId.HasValue ? "&employingEntityId=" + employingEntityId.Value : "");
return ApiJsonRequest<List<PaygReportExportModel>>(url);
}
public List<LeaveLiabilityReportExportModel> LeaveLiability(int businessId, DateTime? asAtDate = null, int locationId = 0, int leaveTypeId = 0, bool includeApprovedLeave = true)
{
var url = string.Format("/business/{0}/report/leaveliability?locationId={1}&asAtDate={2:yyyy-MM-dd}&leaveTypeId={3}&includeApprovedLeave={4}", businessId, locationId, asAtDate, leaveTypeId, includeApprovedLeave);
return ApiRequest<List<LeaveLiabilityReportExportModel>>(url);
}
public List<GrossToNetReportExportModel> GrossToNet(int businessId, DateTime fromDate, DateTime toDate, int payScheduleId = 0, int locationId = 0, int[] payCategoryIds = null, int employeeId = 0, int? employingEntityId = null)
{
var employingEntityFilter = employingEntityId.HasValue ? "&employingEntityId=" + employingEntityId.Value : "";
var payCategoryFilter = new StringBuilder();
if (payCategoryIds != null)
{
foreach (var payCategoryId in payCategoryIds)
{
payCategoryFilter.Append($"&payCategoryIds={payCategoryId}");
}
}
var url = string.Format("/business/{0}/report/grosstonet?fromDate={1:yyyy-MM-dd}&toDate={2:yyyy-MM-dd}&payScheduleId={3}&locationId={4}&employeeId={5}{6}{7}", businessId, fromDate, toDate, payScheduleId, locationId, employeeId, employingEntityFilter, payCategoryFilter);
return ApiJsonRequest<List<GrossToNetReportExportModel>>(url);
}
}
} | {
"content_hash": "778effe610a235ccbb08f1f31c2117bf",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 378,
"avg_line_length": 70.03529411764706,
"alnum_prop": 0.692256005375441,
"repo_name": "KeyPay/keypay-dotnet",
"id": "570d6182998add3ebcc48cfdca95c1a710cf421f",
"size": "11906",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/keypay-dotnet/ApiFunctions/V2/ReportFunction.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "249864"
},
{
"name": "CSS",
"bytes": "718"
},
{
"name": "HTML",
"bytes": "11872"
},
{
"name": "JavaScript",
"bytes": "392714"
},
{
"name": "Less",
"bytes": "203040"
},
{
"name": "PowerShell",
"bytes": "471"
},
{
"name": "Ruby",
"bytes": "127"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="scaffolded-by" content="https://github.com/google/stagehand">
<title>base64decode</title>
<link rel="stylesheet" href="styles.css">
<script async src="main.dart" type="application/dart"></script>
<script async src="packages/browser/dart.js"></script>
</head>
<body>
<input id="input" type="text"></input>
<button>decode base64 string</button>
<div id="output"></div>
</body>
</html>
| {
"content_hash": "5c249d88c2b6ab740f687620ce04e7f0",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 77,
"avg_line_length": 29.238095238095237,
"alnum_prop": 0.6628664495114006,
"repo_name": "moocodenet/base64decode",
"id": "28c6acdd39a959120cd59e6ff147cf8b6ffb719b",
"size": "614",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "web/index.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "182"
},
{
"name": "Dart",
"bytes": "505"
},
{
"name": "HTML",
"bytes": "614"
}
],
"symlink_target": ""
} |
package com.hubbardgary.londontrails.proxy.interfaces;
public interface IAndroidFrameworkProxy {
CharSequence fromHtml(String text);
}
| {
"content_hash": "c80f30b4d9d7bf8f82ffe55f1bb4eed9",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 54,
"avg_line_length": 28,
"alnum_prop": 0.8214285714285714,
"repo_name": "hubbardgary/LondonTrails",
"id": "02a31827102d19f3dd52d7280f00592ae3ab465a",
"size": "140",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/java/com/hubbardgary/londontrails/proxy/interfaces/IAndroidFrameworkProxy.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "286596"
}
],
"symlink_target": ""
} |
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2014.08.31 at 10:36:23 AM KST
//
package org.oliot.model.epcis;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.datatype.XMLGregorianCalendar;
import org.w3c.dom.Element;
/**
* <p>
* Java class for SubscriptionControls complex type.
*
* <p>
* The following schema fragment specifies the expected content contained within
* this class.
*
* <pre>
* <complexType name="SubscriptionControls">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="schedule" type="{query.epcis.oliot.org}QuerySchedule" minOccurs="0"/>
* <element name="trigger" type="{http://www.w3.org/2001/XMLSchema}anyURI" minOccurs="0"/>
* <element name="initialRecordTime" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/>
* <element name="reportIfEmpty" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
* <element name="extension" type="{query.epcis.oliot.org}SubscriptionControlsExtensionType" minOccurs="0"/>
* <any processContents='lax' namespace='##other' maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SubscriptionControls", namespace = "query.epcis.oliot.org", propOrder = {
"schedule", "trigger", "initialRecordTime", "reportIfEmpty",
"extension", "any" })
public class SubscriptionControls {
protected QuerySchedule schedule;
@XmlSchemaType(name = "anyURI")
protected String trigger;
@XmlSchemaType(name = "dateTime")
protected XMLGregorianCalendar initialRecordTime;
protected boolean reportIfEmpty;
protected SubscriptionControlsExtensionType extension;
@XmlAnyElement(lax = true)
protected List<Object> any;
/**
* Gets the value of the schedule property.
*
* @return possible object is {@link QuerySchedule }
*
*/
public QuerySchedule getSchedule() {
return schedule;
}
/**
* Sets the value of the schedule property.
*
* @param value
* allowed object is {@link QuerySchedule }
*
*/
public void setSchedule(QuerySchedule value) {
this.schedule = value;
}
/**
* Gets the value of the trigger property.
*
* @return possible object is {@link String }
*
*/
public String getTrigger() {
return trigger;
}
/**
* Sets the value of the trigger property.
*
* @param value
* allowed object is {@link String }
*
*/
public void setTrigger(String value) {
this.trigger = value;
}
/**
* Gets the value of the initialRecordTime property.
*
* @return possible object is {@link XMLGregorianCalendar }
*
*/
public XMLGregorianCalendar getInitialRecordTime() {
return initialRecordTime;
}
/**
* Sets the value of the initialRecordTime property.
*
* @param value
* allowed object is {@link XMLGregorianCalendar }
*
*/
public void setInitialRecordTime(XMLGregorianCalendar value) {
this.initialRecordTime = value;
}
/**
* Gets the value of the reportIfEmpty property.
*
*/
public boolean isReportIfEmpty() {
return reportIfEmpty;
}
/**
* Sets the value of the reportIfEmpty property.
*
*/
public void setReportIfEmpty(boolean value) {
this.reportIfEmpty = value;
}
/**
* Gets the value of the extension property.
*
* @return possible object is {@link SubscriptionControlsExtensionType }
*
*/
public SubscriptionControlsExtensionType getExtension() {
return extension;
}
/**
* Sets the value of the extension property.
*
* @param value
* allowed object is {@link SubscriptionControlsExtensionType }
*
*/
public void setExtension(SubscriptionControlsExtensionType value) {
this.extension = value;
}
/**
* Gets the value of the any property.
*
* <p>
* This accessor method returns a reference to the live list, not a
* snapshot. Therefore any modification you make to the returned list will
* be present inside the JAXB object. This is why there is not a
* <CODE>set</CODE> method for the any property.
*
* <p>
* For example, to add a new item, do as follows:
*
* <pre>
* getAny().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list {@link Object }
* {@link Element }
*
*
*/
public List<Object> getAny() {
if (any == null) {
any = new ArrayList<Object>();
}
return this.any;
}
}
| {
"content_hash": "8726892d5f514958cb6b74b9911cc41c",
"timestamp": "",
"source": "github",
"line_count": 193,
"max_line_length": 119,
"avg_line_length": 26.352331606217618,
"alnum_prop": 0.6801022414471097,
"repo_name": "kyle0311/oliot-epcis-1.1",
"id": "0c0a580db9a2d69f60a314e7bb97f01719ce5642",
"size": "5086",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "epcis/src/main/java/org/oliot/model/epcis/SubscriptionControls.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "2661"
},
{
"name": "HTML",
"bytes": "20266"
},
{
"name": "Java",
"bytes": "1026931"
}
],
"symlink_target": ""
} |
<?php
/**
* Your Inspiration Themes
*
* @package WordPress
* @subpackage Your Inspiration Themes
* @author Your Inspiration Themes Team <[email protected]>
*
* This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://www.gnu.org/licenses/gpl-3.0.txt
*/
class YIT_Products extends WP_Widget {
/**
* constructor
*
* @access public
* @return void
*/
function YIT_Products() {
/* Widget variable settings. */
$this->woo_widget_idbase = 'yit_products';
/* Widget settings. */
$widget_ops = array( 'classname' => 'yit_products', 'description' => __( 'Display a list of random products on your site.', 'yit' ) );
/* Create the widget. */
$this->WP_Widget('yit-products', 'YIT Woocommerce Random Products', $widget_ops);
}
/**
* widget function.
*
* @see WP_Widget
* @access public
* @param array $args
* @param array $instance
* @return void
*/
function widget($args, $instance) {
global $woocommerce;
ob_start();
extract( $args );
$title = apply_filters( 'widget_title', $instance['title'] );
if ( !$number = (int) $instance['number'] ) {
$number = 6;
}
else {
if ( $number < 1 ) {
$number = 3;
}
else {
if ( $number > 15 ) {
$number = 15;
}
}
}
$query_args = array( 'posts_per_page' => $number, 'orderby' => 'rand', 'no_found_rows' => 1, 'post_status' => 'publish', 'post_type' => 'product' );
if ( !empty ( $instance['category'] ) && $instance['category'][0] != '' ) {
$query_args ['tax_query'] = implode( ',', $instance['category'] );
}
$r = new WP_Query($query_args);
if ($r->have_posts()) : ?>
<?php echo $before_widget; ?>
<div class="clearfix widget random-products">
<?php if ( $title ) echo '<h3>' . $title . '</h3>'; ?>
<ul class="clearfix products-thumbnails">
<?php while ($r->have_posts()) : $r->the_post(); global $product; ?>
<li>
<?php if( has_post_thumbnail() ) : ?>
<a href="<?php echo esc_url( get_permalink( $r->post->ID ) ); ?>" class="with-tooltip product_img" title="<?php echo esc_attr($r->post->post_title ? $r->post->post_title : $r->post->ID); ?>">
<?php the_post_thumbnail( 'shop_thumbnail' ) ?>
</a>
<?php endif ?>
</li>
<?php endwhile; ?>
</ul>
</div>
<?php echo $after_widget; ?>
<?php endif;
$content = ob_get_clean();
if ( isset( $args['widget_id'] ) ) $cache[$args['widget_id']] = $content;
echo $content;
wp_reset_postdata();
}
/**
* update function.
*
* @see WP_Widget->update
* @access public
* @param array $new_instance
* @param array $old_instance
* @return array
*/
function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['number'] = (int) $new_instance['number'];
$instance['category'] = $new_instance['category'];
return $instance;
}
/**
* form function.
*
* @see WP_Widget->form
* @access public
* @param array $instance
* @return void
*/
function form( $instance ) {
$defaults = array(
'title' => '',
'number' => 6,
'category' => array('')
);
$cats = yit_woocommerce_get_shop_categories(false);
$instance = wp_parse_args( $instance, $defaults );
?>
<p><label for="<?php echo esc_attr( $this->get_field_id('title') ); ?>"><?php _e('Title', 'yit'); ?>:</label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id('title') ); ?>" name="<?php echo esc_attr( $this->get_field_name('title') ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" /></p>
<p><label for="<?php echo esc_attr( $this->get_field_id('number') ); ?>"><?php _e('Number of products to show', 'yit'); ?>:</label>
<input id="<?php echo esc_attr( $this->get_field_id('number') ); ?>" name="<?php echo esc_attr( $this->get_field_name('number') ); ?>" type="text" value="<?php echo esc_attr( $instance['number'] ); ?>" size="3" /></p>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'category' ) ); ?>"><?php _e( 'Product Category', 'yit' ) ?>:
<select id="<?php echo esc_attr( $this->get_field_id( 'category' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'category' ) ); ?>[]" multiple="multiple">
<option value="" <?php echo ( in_array( '' , $instance['category'] ) ? 'selected' : '' ) ?>><?php echo __('All Categories', 'yit') ?></option>
<?php foreach( $cats as $k => $cat ): ?>
<option value="<?php echo esc_attr( $k ) ?>" <?php echo ( in_array( $k , $instance['category'] ) ? 'selected' : '' ) ?>><?php echo $cat ?></option>
<?php endforeach ?>
</select>
</label>
</p>
<?php
}
} | {
"content_hash": "43faf23e05f6f64a03702816e9fb0e27",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 233,
"avg_line_length": 35.453416149068325,
"alnum_prop": 0.48458304134548,
"repo_name": "garungabc/Wordpress_useful",
"id": "b6823fc078299ab6e7d931c90e87615020439a9f",
"size": "5708",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "widget/yit_widget/YIT_Products.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "18720"
},
{
"name": "PHP",
"bytes": "272207"
}
],
"symlink_target": ""
} |
Installing Neurotune
========================
.. code-block:: bash
python setup.py --install
Dependencies
------------
Neurotune has the following hard dependencies:
* Inspyred
* Numpy
And the following soft dependencies:
* Scipy
* neuronpy
* NEURON
Requirements
---------------------
Neurotune has so far been tested on Ubuntu 12.04.
It should however also work on OSX and Windows.
| {
"content_hash": "96b95da0a5a775f22cc0739e7c80d55f",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 50,
"avg_line_length": 16.583333333333332,
"alnum_prop": 0.6432160804020101,
"repo_name": "pgleeson/neurotune",
"id": "bc8ca955b578ba7ff6ff0a57f9b6089b20749b02",
"size": "398",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "doc/installation.rst",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Python",
"bytes": "57649"
}
],
"symlink_target": ""
} |
package com.hacktahon.speakers.tests;
import static org.junit.Assert.fail;
import org.junit.Test;
import com.hackathon.speakers.util.SpeakUtil;
public class SpeakTest {
@Test
public void testSimpleSpeak() {
try {
SpeakUtil.speak("Testing speaking capabilities", "Test");
} catch (Exception e) {
e.printStackTrace();
fail();
}
}
}
| {
"content_hash": "7fc5ecfe0421c5358035a59b46afc27e",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 69,
"avg_line_length": 20.55,
"alnum_prop": 0.610705596107056,
"repo_name": "dor-levi/hackathon-speakers",
"id": "cae249e6447164e2f569687369a9f033668b9d82",
"size": "411",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "src/test/java/com/hacktahon/speakers/tests/SpeakTest.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "20262"
},
{
"name": "Shell",
"bytes": "3942"
}
],
"symlink_target": ""
} |
package org.apache.sshd.server.session;
import java.io.IOException;
import org.apache.sshd.common.Service;
import org.apache.sshd.common.ServiceFactory;
import org.apache.sshd.common.session.Session;
/**
* @author <a href="mailto:[email protected]">Apache MINA SSHD Project</a>
*/
public class ServerUserAuthServiceFactory implements ServiceFactory {
public static final ServerUserAuthServiceFactory INSTANCE = new ServerUserAuthServiceFactory();
public ServerUserAuthServiceFactory() {
super();
}
@Override
public String getName() {
return "ssh-userauth";
}
@Override
public Service create(Session session) throws IOException {
return new ServerUserAuthService(session);
}
} | {
"content_hash": "4129c1ff81daafd2cbc7b094519497a7",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 99,
"avg_line_length": 25.724137931034484,
"alnum_prop": 0.7319034852546917,
"repo_name": "ieure/mina-sshd",
"id": "d012f83548823e585345e38206625d573be36fba",
"size": "1547",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "sshd-core/src/main/java/org/apache/sshd/server/session/ServerUserAuthServiceFactory.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "6194"
},
{
"name": "HTML",
"bytes": "5769"
},
{
"name": "Java",
"bytes": "3181948"
},
{
"name": "Shell",
"bytes": "13910"
}
],
"symlink_target": ""
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>Able Polecat: Todo List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">Able Polecat
 <span id="projectnumber">0.7.0</span>
</div>
<div id="projectbrief">Able Polecat Core Class Library</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.9.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li class="current"><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('todo.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">Todo List </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><dl class="reflist">
<dt><a class="anchor" id="_todo000002"></a>Global <a class="el" href="class_able_polecat___data___primitive___scalar___integer.html#ab0ca104ebb3288467244dbfaeaa474ed">AblePolecat_Data_Primitive_Scalar_Integer::max</a> ($numbers)</dt>
<dd>: based on <a href="http://php.net/manual/en/array.sorting.php">http://php.net/manual/en/array.sorting.php</a> there is some disagreement as to which native PHP sorting algorithm is fastest, most efficient etc. We are sticking with a home-grown algorithm so as to use typeCast for excluding not-scalar values. </dd>
<dt><a class="anchor" id="_todo000004"></a>Global <a class="el" href="class_able_polecat___dom.html#af8f857ffafb0c1e59d752b7b430a95a0">AblePolecat_Dom::loadTemplateFragment</a> (DOMDocument $Document, $templateSearchPaths, $domDirectives=NULL)</dt>
<dd>: probably pass class registration as parameter so we know what to update with file modified time </dd>
<dt><a class="anchor" id="_todo000003"></a>Global <a class="el" href="class_able_polecat___dom.html#a9687e5f2a0ad8e40fbf6de213dc8e077">AblePolecat_Dom::XHTML_1_1_QUALIFIED_NAME</a> </dt>
<dd>: XHTML 1.1 hard-coded here; should extend to allow for other doc types. </dd>
<dt><a class="anchor" id="_todo000006"></a>Global <a class="el" href="class_able_polecat___message___response_abstract.html#a1211a3dcd44d6bfe7f0205151465a677">AblePolecat_Message_ResponseAbstract::validateHeaderField</a> ($field)</dt>
<dd>: smirk </dd>
<dt><a class="anchor" id="_todo000007"></a>Global <a class="el" href="class_able_polecat___mode___server.html#a7e7be427ff1899a7386be4019db2d59d">AblePolecat_Mode_Server::handleException</a> (Exception $Exception)</dt>
<dd>: hand control back to the server or otherwise fail gracefully. no WSOD </dd>
<dt><a class="anchor" id="_todo000009"></a>Global <a class="el" href="class_able_polecat___query_language___statement_abstract.html#a7e8b7ade103075378490c24d61b098bd">AblePolecat_QueryLanguage_StatementAbstract::getLiteralExpression</a> ($literal, $type=NULL)</dt>
<dd><p class="startdd">: lots on this one, more of a placeholder for now. </p>
<p class="enddd">: something like $Database->quote($this->rvalue()) Used to express literal values in DML (for example quotes around strings etc). </p>
</dd>
<dt><a class="anchor" id="_todo000008"></a>Global <a class="el" href="interface_able_polecat___query_language___statement_interface.html#a7e8b7ade103075378490c24d61b098bd">AblePolecat_QueryLanguage_StatementInterface::getLiteralExpression</a> ($literal, $type=NULL)</dt>
<dd><p class="startdd">: lots on this one, more of a placeholder for now. </p>
<p class="enddd">: something like $Database->quote($this->rvalue()) Used to express literal values in DML (for example quotes around strings etc). </p>
</dd>
<dt><a class="anchor" id="_todo000012"></a>Global <a class="el" href="class_able_polecat___service___bus.html#aae046bbb8c846e4d0a266db8991fa7a7">AblePolecat_Service_Bus::$Messages</a> </dt>
<dd>: message queue </dd>
<dt><a class="anchor" id="_todo000013"></a>Global <a class="el" href="class_able_polecat___service___bus.html#a01219e75781fce23cab2d8ff3ad781be">AblePolecat_Service_Bus::getResponse</a> (<a class="el" href="interface_able_polecat___resource_interface.html">AblePolecat_ResourceInterface</a> $Resource, $statusCode)</dt>
<dd>: auto update modified times in resource/response registration records if:<ul>
<li>PHP class file modified time is newer than registry entry modified time</li>
<li>.tpl file modified time is newer than registry entry modified time </li>
</ul>
</dd>
<dt><a class="anchor" id="_todo000017"></a>Global <a class="el" href="class_able_polecat___service___dtx_abstract.html#a4ecaa0a2c1ecb9a47f85b357d65a8dd4">AblePolecat_Service_DtxAbstract::setGroupByExpression</a> ($group_by_expression)</dt>
<dd>: check proper syntax of GROUP BY expression </dd>
<dt><a class="anchor" id="_todo000018"></a>Global <a class="el" href="class_able_polecat___service___dtx_abstract.html#a861af4015034dbff8963261a7d22237d">AblePolecat_Service_DtxAbstract::setOrderByExpression</a> ($order_by_expression)</dt>
<dd>: check proper syntax of ORDER BY expression </dd>
<dt><a class="anchor" id="_todo000015"></a>Global <a class="el" href="class_able_polecat___service___dtx_abstract.html#aaf145251ff829dc64ee23ba36eba9a94">AblePolecat_Service_DtxAbstract::setSelectColumns</a> ($select_columns)</dt>
<dd><p class="startdd">: check proper formating/escaping of column name(s) </p>
<p class="enddd">: check syntax of sub queries </p>
</dd>
<dt><a class="anchor" id="_todo000014"></a>Global <a class="el" href="class_able_polecat___service___dtx_abstract.html#aca5a5c1f3b4b4d4b90d46796d98510db">AblePolecat_Service_DtxAbstract::setTableName</a> ($table_name)</dt>
<dd>: check proper formatting/escaping of table name </dd>
<dt><a class="anchor" id="_todo000016"></a>Global <a class="el" href="class_able_polecat___service___dtx_abstract.html#ab41e2a612cda6276d37ad1afd264e3df">AblePolecat_Service_DtxAbstract::setWhereCondition</a> ($where_condition)</dt>
<dd>: check proper syntax of WHERE condition </dd>
</dl>
</div></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">Generated on Fri Apr 10 2015 11:24:44 for Able Polecat by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.9.1 </li>
</ul>
</div>
</body>
</html>
| {
"content_hash": "1a715619f14c0d27856a70632a19229a",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 320,
"avg_line_length": 61.28662420382165,
"alnum_prop": 0.6994387861151528,
"repo_name": "kkuhrman/AblePolecat",
"id": "d68baa145ad26c15bdc4f714e0400b144583b67d",
"size": "9622",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "usr/share/documentation/html/todo.html",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "PHP",
"bytes": "1010057"
}
],
"symlink_target": ""
} |
require 'rails_helper'
require 'message_queue_consumer'
describe MessageQueueConsumer::HeartbeatMiddlewareProcessor do
let(:heartbeat_headers) { instance_double("Bunny::MessageProperties", :content_type => "application/x-heartbeat") }
let(:heartbeat_message) { instance_double("RabbitmqConsumer::Message", :headers => heartbeat_headers, :ack => nil) }
let(:standard_headers) { instance_double("Bunny::MessageProperties", :content_type => nil) }
let(:standard_message) { instance_double("RabbitmqConsumer::Message", :headers => standard_headers, :ack => nil) }
let(:processor) { instance_double("MessageQueueConsumer::Processor") }
subject {
MessageQueueConsumer::HeartbeatMiddlewareProcessor.new(processor)
}
context "for a heartbeat message" do
it "doesn't call the next processor" do
expect(processor).not_to receive(:call)
subject.call(heartbeat_message)
end
it "acks the message" do
expect(heartbeat_message).to receive(:ack)
subject.call(heartbeat_message)
end
end
context "for a content message" do
it "calls the next processor" do
expect(processor).to receive(:call).with(standard_message)
subject.call(standard_message)
end
it "doesn't ack the message" do
expect(standard_message).not_to receive(:ack)
expect(processor).to receive(:call)
subject.call(standard_message)
end
end
end
| {
"content_hash": "b668fb4af51de7dd03d4477eca8aa3f5",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 118,
"avg_line_length": 31.4,
"alnum_prop": 0.7098372257607927,
"repo_name": "alphagov/content-register",
"id": "970055ae8501c88c4017af9ade4e0af2361781ba",
"size": "1413",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spec/lib/message_queue_consumer_heartbeat_processor_spec.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "4588"
},
{
"name": "Ruby",
"bytes": "57852"
},
{
"name": "Shell",
"bytes": "882"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.umeng.update">
</manifest>
| {
"content_hash": "47cb4d9193295ec81ac9bc05ccf7321d",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 68,
"avg_line_length": 30.6,
"alnum_prop": 0.6993464052287581,
"repo_name": "liqk2014/CNode-Material-Design",
"id": "a37b14ae910df0d3f96c1a1a5535c6f32fda8324",
"size": "153",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "umeng-update-sdk/src/main/AndroidManifest.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "3697"
},
{
"name": "Java",
"bytes": "153951"
}
],
"symlink_target": ""
} |
package org.codehaus.groovy.jsr223;
import groovy.lang.GroovyClassLoader;
import org.codehaus.groovy.ast.ClassNode;
import org.codehaus.groovy.ast.CodeVisitorSupport;
import org.codehaus.groovy.ast.expr.MethodCallExpression;
import org.codehaus.groovy.ast.stmt.ExpressionStatement;
import org.codehaus.groovy.classgen.GeneratorContext;
import org.codehaus.groovy.control.CompilationUnit;
import org.codehaus.groovy.control.CompilerConfiguration;
import org.codehaus.groovy.control.Phases;
import org.codehaus.groovy.control.SourceUnit;
import org.junit.Before;
import org.junit.Test;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import java.lang.reflect.Field;
import java.security.CodeSource;
import java.util.HashSet;
import java.util.Set;
/**
* Test for GROOVY-3946 and GROOVY-5255.
*/
public class JSR223SecurityTest {
class TestFixture {
String script = "System.exit 2";
String forbiddenInstruction = "java.lang.System";
}
TestFixture testFixture;
@Before
public void resetTestFixture() {
testFixture = new TestFixture();
}
@Test(expected = ScriptException.class)
public void should_forbid_an_instruction_when_overriding_GroovyClassLoader_using_reflection() throws Exception {
secureEval(ClassLoaderDefinitionType.REFLECTION);
}
@Test(expected = ScriptException.class)
public void should_forbid_an_instruction_when_overriding_GroovyClassLoader_using_injection() throws Exception {
secureEval(ClassLoaderDefinitionType.INJECTION);
}
@Test(expected = ScriptException.class)
public void should_forbid_an_instruction_when_overriding_GroovyClassLoader_using_constructor() throws Exception {
secureEval(ClassLoaderDefinitionType.CONSTRUCTOR);
}
private void secureEval(ClassLoaderDefinitionType classLoaderDefType) throws Exception {
ScriptEngine engine = createScriptEngine(classLoaderDefType);
GroovySecurityManager securityMgr = GroovySecurityManager.instance();
securityMgr.overrideGroovyClassLoader(engine, classLoaderDefType);
securityMgr.forbid(testFixture.forbiddenInstruction);
engine.eval(testFixture.script);
}
private ScriptEngine createScriptEngine(ClassLoaderDefinitionType classLoaderDefType) {
return (classLoaderDefType == ClassLoaderDefinitionType.CONSTRUCTOR)
? new GroovyScriptEngineImpl(new CustomGroovyClassLoader())
: new ScriptEngineManager().getEngineByName("groovy");
}
}
enum ClassLoaderDefinitionType {
CONSTRUCTOR,
INJECTION,
REFLECTION
}
class GroovySecurityManager {
private static GroovySecurityManager instance = new GroovySecurityManager();
private Set<String> forbiddenList = new HashSet<String>();
private GroovySecurityManager() { }
public synchronized static GroovySecurityManager instance() {
return instance;
}
public void overrideGroovyClassLoader(ScriptEngine engine, ClassLoaderDefinitionType classLoaderDefType) {
try {
if (classLoaderDefType == ClassLoaderDefinitionType.REFLECTION) {
overrideDefaultGroovyClassLoaderUsingReflection(engine);
}
else if (classLoaderDefType == ClassLoaderDefinitionType.INJECTION) {
overrideDefaultGroovyClassLoaderUsingInjection(engine);
}
}
catch (Throwable ex) {
throw new RuntimeException("Could not initialize the security manager", ex);
}
}
public void forbid(String instruction) {
forbiddenList.add(instruction);
}
public boolean isForbidden(String instruction) {
for (String forbidden : forbiddenList)
if (instruction.startsWith(forbidden))
return true;
return false;
}
private void overrideDefaultGroovyClassLoaderUsingReflection(ScriptEngine engine) throws Exception {
Field classLoader = engine.getClass().getDeclaredField("loader");
classLoader.setAccessible(true);
classLoader.set(engine, new CustomGroovyClassLoader());
}
private void overrideDefaultGroovyClassLoaderUsingInjection(ScriptEngine engine) throws Exception {
GroovyScriptEngineImpl concreteEngine = (GroovyScriptEngineImpl) engine;
concreteEngine.setClassLoader(new CustomGroovyClassLoader());
}
}
class GroovySecurityException extends RuntimeException {
public GroovySecurityException(String message) {
super(message);
}
}
class CustomGroovyClassLoader extends GroovyClassLoader {
protected CompilationUnit createCompilationUnit(CompilerConfiguration config, CodeSource source) {
CompilationUnit unit = super.createCompilationUnit(config, source);
unit.addPhaseOperation(new CustomPrimaryClassNodeOperation(), Phases.SEMANTIC_ANALYSIS);
return unit;
}
}
class CustomPrimaryClassNodeOperation implements CompilationUnit.IPrimaryClassNodeOperation {
@Override
public void call(SourceUnit source, GeneratorContext context, ClassNode classNode) {
for (Object statement : source.getAST().getStatementBlock().getStatements()) {
((ExpressionStatement) statement).visit(new CustomCodeVisitorSupport());
}
}
}
class CustomCodeVisitorSupport extends CodeVisitorSupport {
private GroovySecurityManager groovySecurityManager = GroovySecurityManager.instance();
public void visitMethodCallExpression(MethodCallExpression call) {
if (groovySecurityManager.isForbidden(call.getText()))
throw new GroovySecurityException("The following code is forbidden in the script: " + call.getText());
}
}
| {
"content_hash": "fd7a265d9ec86d9b6d3e8c9a6f85826c",
"timestamp": "",
"source": "github",
"line_count": 164,
"max_line_length": 117,
"avg_line_length": 35.09146341463415,
"alnum_prop": 0.7424847958297133,
"repo_name": "paulk-asert/groovy",
"id": "9c8d751ca5739165978de46fb1dc10c8acd629d2",
"size": "6576",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "subprojects/groovy-jsr223/src/test/java/org/codehaus/groovy/jsr223/JSR223SecurityTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "59900"
},
{
"name": "Batchfile",
"bytes": "23519"
},
{
"name": "CSS",
"bytes": "79976"
},
{
"name": "Groovy",
"bytes": "10604511"
},
{
"name": "HTML",
"bytes": "81795"
},
{
"name": "Java",
"bytes": "13355644"
},
{
"name": "JavaScript",
"bytes": "1191"
},
{
"name": "Shell",
"bytes": "58187"
},
{
"name": "Smarty",
"bytes": "7825"
}
],
"symlink_target": ""
} |
(function (global, factory) {
if (typeof module === "object" && typeof module.exports === "object") {
// For CommonJS and CommonJS-like environments where a proper window is present,
// execute the factory and get jQuery
// For environments that do not inherently posses a window with a document
// (such as Node.js), expose a jQuery-making factory as module.exports
// This accentuates the need for the creation of a real window
// e.g. var jQuery = require("jquery")(window);
// See ticket #14549 for more info
module.exports = global.document ?
factory(global, true) :
function (w) {
if (!w.document) {
throw new Error("jQuery requires a window with a document");
}
return factory(w);
};
} else {
factory(global);
}
// Pass this if window is not defined yet
}(typeof window !== "undefined" ? window : this, function (window, noGlobal) {
// Can't do this because several apps including ASP.NET trace
// the stack via arguments.caller.callee and Firefox dies if
// you try to trace through "use strict" call chains. (#13335)
// Support: Firefox 18+
//
var arr = [];
var slice = arr.slice;
var concat = arr.concat;
var push = arr.push;
var indexOf = arr.indexOf;
var class2type = {};
var toString = class2type.toString;
var hasOwn = class2type.hasOwnProperty;
var support = {};
var
// Use the correct document accordingly with window argument (sandbox)
document = window.document,
version = "2.1.1",
// Define a local copy of jQuery
jQuery = function (selector, context) {
// The jQuery object is actually just the init constructor 'enhanced'
// Need init if jQuery is called (just allow error to be thrown if not included)
return new jQuery.fn.init(selector, context);
},
// Support: Android<4.1
// Make sure we trim BOM and NBSP
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
// Matches dashed string for camelizing
rmsPrefix = /^-ms-/,
rdashAlpha = /-([\da-z])/gi,
// Used by jQuery.camelCase as callback to replace()
fcamelCase = function (all, letter) {
return letter.toUpperCase();
};
jQuery.fn = jQuery.prototype = {
// The current version of jQuery being used
jquery: version,
constructor: jQuery,
// Start with an empty selector
selector: "",
// The default length of a jQuery object is 0
length: 0,
toArray: function () {
return slice.call(this);
},
// Get the Nth element in the matched element set OR
// Get the whole matched element set as a clean array
get: function (num) {
return num != null ?
// Return just the one element from the set
( num < 0 ? this[num + this.length] : this[num] ) :
// Return all the elements in a clean array
slice.call(this);
},
// Take an array of elements and push it onto the stack
// (returning the new matched element set)
pushStack: function (elems) {
// Build a new jQuery matched element set
var ret = jQuery.merge(this.constructor(), elems);
// Add the old object onto the stack (as a reference)
ret.prevObject = this;
ret.context = this.context;
// Return the newly-formed element set
return ret;
},
// Execute a callback for every element in the matched set.
// (You can seed the arguments with an array of args, but this is
// only used internally.)
each: function (callback, args) {
return jQuery.each(this, callback, args);
},
map: function (callback) {
return this.pushStack(jQuery.map(this, function (elem, i) {
return callback.call(elem, i, elem);
}));
},
slice: function () {
return this.pushStack(slice.apply(this, arguments));
},
first: function () {
return this.eq(0);
},
last: function () {
return this.eq(-1);
},
eq: function (i) {
var len = this.length,
j = +i + ( i < 0 ? len : 0 );
return this.pushStack(j >= 0 && j < len ? [this[j]] : []);
},
end: function () {
return this.prevObject || this.constructor(null);
},
// For internal use only.
// Behaves like an Array's method, not like a jQuery method.
push: push,
sort: arr.sort,
splice: arr.splice
};
jQuery.extend = jQuery.fn.extend = function () {
var options, name, src, copy, copyIsArray, clone,
target = arguments[0] || {},
i = 1,
length = arguments.length,
deep = false;
// Handle a deep copy situation
if (typeof target === "boolean") {
deep = target;
// skip the boolean and the target
target = arguments[i] || {};
i++;
}
// Handle case when target is a string or something (possible in deep copy)
if (typeof target !== "object" && !jQuery.isFunction(target)) {
target = {};
}
// extend jQuery itself if only one argument is passed
if (i === length) {
target = this;
i--;
}
for (; i < length; i++) {
// Only deal with non-null/undefined values
if ((options = arguments[i]) != null) {
// Extend the base object
for (name in options) {
src = target[name];
copy = options[name];
// Prevent never-ending loop
if (target === copy) {
continue;
}
// Recurse if we're merging plain objects or arrays
if (deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) )) {
if (copyIsArray) {
copyIsArray = false;
clone = src && jQuery.isArray(src) ? src : [];
} else {
clone = src && jQuery.isPlainObject(src) ? src : {};
}
// Never move original objects, clone them
target[name] = jQuery.extend(deep, clone, copy);
// Don't bring in undefined values
} else if (copy !== undefined) {
target[name] = copy;
}
}
}
}
// Return the modified object
return target;
};
jQuery.extend({
// Unique for each copy of jQuery on the page
expando: "jQuery" + ( version + Math.random() ).replace(/\D/g, ""),
// Assume jQuery is ready without the ready module
isReady: true,
error: function (msg) {
throw new Error(msg);
},
noop: function () {
},
// See test/unit/core.js for details concerning isFunction.
// Since version 1.3, DOM methods and functions like alert
// aren't supported. They return false on IE (#2968).
isFunction: function (obj) {
return jQuery.type(obj) === "function";
},
isArray: Array.isArray,
isWindow: function (obj) {
return obj != null && obj === obj.window;
},
isNumeric: function (obj) {
// parseFloat NaNs numeric-cast false positives (null|true|false|"")
// ...but misinterprets leading-number strings, particularly hex literals ("0x...")
// subtraction forces infinities to NaN
return !jQuery.isArray(obj) && obj - parseFloat(obj) >= 0;
},
isPlainObject: function (obj) {
// Not plain objects:
// - Any object or value whose internal [[Class]] property is not "[object Object]"
// - DOM nodes
// - window
if (jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow(obj)) {
return false;
}
if (obj.constructor && !hasOwn.call(obj.constructor.prototype, "isPrototypeOf")) {
return false;
}
// If the function hasn't returned already, we're confident that
// |obj| is a plain object, created by {} or constructed with new Object
return true;
},
isEmptyObject: function (obj) {
var name;
for (name in obj) {
return false;
}
return true;
},
type: function (obj) {
if (obj == null) {
return obj + "";
}
// Support: Android < 4.0, iOS < 6 (functionish RegExp)
return typeof obj === "object" || typeof obj === "function" ?
class2type[toString.call(obj)] || "object" :
typeof obj;
},
// Evaluates a script in a global context
globalEval: function (code) {
var script,
indirect = eval;
code = jQuery.trim(code);
if (code) {
// If the code includes a valid, prologue position
// strict mode pragma, execute code by injecting a
// script tag into the document.
if (code.indexOf("use strict") === 1) {
script = document.createElement("script");
script.text = code;
document.head.appendChild(script).parentNode.removeChild(script);
} else {
// Otherwise, avoid the DOM node creation, insertion
// and removal by using an indirect global eval
indirect(code);
}
}
},
// Convert dashed to camelCase; used by the css and data modules
// Microsoft forgot to hump their vendor prefix (#9572)
camelCase: function (string) {
return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase);
},
nodeName: function (elem, name) {
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
},
// args is for internal usage only
each: function (obj, callback, args) {
var value,
i = 0,
length = obj.length,
isArray = isArraylike(obj);
if (args) {
if (isArray) {
for (; i < length; i++) {
value = callback.apply(obj[i], args);
if (value === false) {
break;
}
}
} else {
for (i in obj) {
value = callback.apply(obj[i], args);
if (value === false) {
break;
}
}
}
// A special, fast, case for the most common use of each
} else {
if (isArray) {
for (; i < length; i++) {
value = callback.call(obj[i], i, obj[i]);
if (value === false) {
break;
}
}
} else {
for (i in obj) {
value = callback.call(obj[i], i, obj[i]);
if (value === false) {
break;
}
}
}
}
return obj;
},
// Support: Android<4.1
trim: function (text) {
return text == null ?
"" :
( text + "" ).replace(rtrim, "");
},
// results is for internal usage only
makeArray: function (arr, results) {
var ret = results || [];
if (arr != null) {
if (isArraylike(Object(arr))) {
jQuery.merge(ret,
typeof arr === "string" ?
[arr] : arr
);
} else {
push.call(ret, arr);
}
}
return ret;
},
inArray: function (elem, arr, i) {
return arr == null ? -1 : indexOf.call(arr, elem, i);
},
merge: function (first, second) {
var len = +second.length,
j = 0,
i = first.length;
for (; j < len; j++) {
first[i++] = second[j];
}
first.length = i;
return first;
},
grep: function (elems, callback, invert) {
var callbackInverse,
matches = [],
i = 0,
length = elems.length,
callbackExpect = !invert;
// Go through the array, only saving the items
// that pass the validator function
for (; i < length; i++) {
callbackInverse = !callback(elems[i], i);
if (callbackInverse !== callbackExpect) {
matches.push(elems[i]);
}
}
return matches;
},
// arg is for internal usage only
map: function (elems, callback, arg) {
var value,
i = 0,
length = elems.length,
isArray = isArraylike(elems),
ret = [];
// Go through the array, translating each of the items to their new values
if (isArray) {
for (; i < length; i++) {
value = callback(elems[i], i, arg);
if (value != null) {
ret.push(value);
}
}
// Go through every key on the object,
} else {
for (i in elems) {
value = callback(elems[i], i, arg);
if (value != null) {
ret.push(value);
}
}
}
// Flatten any nested arrays
return concat.apply([], ret);
},
// A global GUID counter for objects
guid: 1,
// Bind a function to a context, optionally partially applying any
// arguments.
proxy: function (fn, context) {
var tmp, args, proxy;
if (typeof context === "string") {
tmp = fn[context];
context = fn;
fn = tmp;
}
// Quick check to determine if target is callable, in the spec
// this throws a TypeError, but we will just return undefined.
if (!jQuery.isFunction(fn)) {
return undefined;
}
// Simulated bind
args = slice.call(arguments, 2);
proxy = function () {
return fn.apply(context || this, args.concat(slice.call(arguments)));
};
// Set the guid of unique handler to the same of original handler, so it can be removed
proxy.guid = fn.guid = fn.guid || jQuery.guid++;
return proxy;
},
now: Date.now,
// jQuery.support is not used in Core but other projects attach their
// properties to it so it needs to exist.
support: support
});
// Populate the class2type map
jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function (i, name) {
class2type["[object " + name + "]"] = name.toLowerCase();
});
function isArraylike(obj) {
var length = obj.length,
type = jQuery.type(obj);
if (type === "function" || jQuery.isWindow(obj)) {
return false;
}
if (obj.nodeType === 1 && length) {
return true;
}
return type === "array" || length === 0 ||
typeof length === "number" && length > 0 && ( length - 1 ) in obj;
}
var Sizzle =
/*!
* Sizzle CSS Selector Engine v1.10.19
* http://sizzlejs.com/
*
* Copyright 2013 jQuery Foundation, Inc. and other contributors
* Released under the MIT license
* http://jquery.org/license
*
* Date: 2014-04-18
*/
(function (window) {
var i,
support,
Expr,
getText,
isXML,
tokenize,
compile,
select,
outermostContext,
sortInput,
hasDuplicate,
// Local document vars
setDocument,
document,
docElem,
documentIsHTML,
rbuggyQSA,
rbuggyMatches,
matches,
contains,
// Instance-specific data
expando = "sizzle" + -(new Date()),
preferredDoc = window.document,
dirruns = 0,
done = 0,
classCache = createCache(),
tokenCache = createCache(),
compilerCache = createCache(),
sortOrder = function (a, b) {
if (a === b) {
hasDuplicate = true;
}
return 0;
},
// General-purpose constants
strundefined = typeof undefined,
MAX_NEGATIVE = 1 << 31,
// Instance methods
hasOwn = ({}).hasOwnProperty,
arr = [],
pop = arr.pop,
push_native = arr.push,
push = arr.push,
slice = arr.slice,
// Use a stripped-down indexOf if we can't use a native one
indexOf = arr.indexOf || function (elem) {
var i = 0,
len = this.length;
for (; i < len; i++) {
if (this[i] === elem) {
return i;
}
}
return -1;
},
booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
// Regular expressions
// Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
whitespace = "[\\x20\\t\\r\\n\\f]",
// http://www.w3.org/TR/css3-syntax/#characters
characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
// Loosely modeled on CSS identifier characters
// An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
// Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
identifier = characterEncoding.replace("w", "w#"),
// Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace +
// Operator (capture 2)
"*([*^$|!~]?=)" + whitespace +
// "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
"*\\]",
pseudos = ":(" + characterEncoding + ")(?:\\((" +
// To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
// 1. quoted (capture 3; capture 4 or capture 5)
"('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
// 2. simple (capture 6)
"((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
// 3. anything else (capture 2)
".*" +
")\\)|)",
// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
rtrim = new RegExp("^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g"),
rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"),
rcombinators = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*"),
rattributeQuotes = new RegExp("=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g"),
rpseudo = new RegExp(pseudos),
ridentifier = new RegExp("^" + identifier + "$"),
matchExpr = {
"ID": new RegExp("^#(" + characterEncoding + ")"),
"CLASS": new RegExp("^\\.(" + characterEncoding + ")"),
"TAG": new RegExp("^(" + characterEncoding.replace("w", "w*") + ")"),
"ATTR": new RegExp("^" + attributes),
"PSEUDO": new RegExp("^" + pseudos),
"CHILD": new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
"*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
"*(\\d+)|))" + whitespace + "*\\)|)", "i"),
"bool": new RegExp("^(?:" + booleans + ")$", "i"),
// For use in libraries implementing .is()
// We use this for POS matching in `select`
"needsContext": new RegExp("^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i")
},
rinputs = /^(?:input|select|textarea|button)$/i,
rheader = /^h\d$/i,
rnative = /^[^{]+\{\s*\[native \w/,
// Easily-parseable/retrievable ID or TAG or CLASS selectors
rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
rsibling = /[+~]/,
rescape = /'|\\/g,
// CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
runescape = new RegExp("\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig"),
funescape = function (_, escaped, escapedWhitespace) {
var high = "0x" + escaped - 0x10000;
// NaN means non-codepoint
// Support: Firefox<24
// Workaround erroneous numeric interpretation of +"0x"
return high !== high || escapedWhitespace ?
escaped :
high < 0 ?
// BMP codepoint
String.fromCharCode(high + 0x10000) :
// Supplemental Plane codepoint (surrogate pair)
String.fromCharCode(high >> 10 | 0xD800, high & 0x3FF | 0xDC00);
};
// Optimize for push.apply( _, NodeList )
try {
push.apply(
(arr = slice.call(preferredDoc.childNodes)),
preferredDoc.childNodes
);
// Support: Android<4.0
// Detect silently failing push.apply
arr[preferredDoc.childNodes.length].nodeType;
} catch (e) {
push = {
apply: arr.length ?
// Leverage slice if possible
function (target, els) {
push_native.apply(target, slice.call(els));
} :
// Support: IE<9
// Otherwise append directly
function (target, els) {
var j = target.length,
i = 0;
// Can't trust NodeList.length
while ((target[j++] = els[i++])) {
}
target.length = j - 1;
}
};
}
function Sizzle(selector, context, results, seed) {
var match, elem, m, nodeType,
// QSA vars
i, groups, old, nid, newContext, newSelector;
if (( context ? context.ownerDocument || context : preferredDoc ) !== document) {
setDocument(context);
}
context = context || document;
results = results || [];
if (!selector || typeof selector !== "string") {
return results;
}
if ((nodeType = context.nodeType) !== 1 && nodeType !== 9) {
return [];
}
if (documentIsHTML && !seed) {
// Shortcuts
if ((match = rquickExpr.exec(selector))) {
// Speed-up: Sizzle("#ID")
if ((m = match[1])) {
if (nodeType === 9) {
elem = context.getElementById(m);
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document (jQuery #6963)
if (elem && elem.parentNode) {
// Handle the case where IE, Opera, and Webkit return items
// by name instead of ID
if (elem.id === m) {
results.push(elem);
return results;
}
} else {
return results;
}
} else {
// Context is not a document
if (context.ownerDocument && (elem = context.ownerDocument.getElementById(m)) &&
contains(context, elem) && elem.id === m) {
results.push(elem);
return results;
}
}
// Speed-up: Sizzle("TAG")
} else if (match[2]) {
push.apply(results, context.getElementsByTagName(selector));
return results;
// Speed-up: Sizzle(".CLASS")
} else if ((m = match[3]) && support.getElementsByClassName && context.getElementsByClassName) {
push.apply(results, context.getElementsByClassName(m));
return results;
}
}
// QSA path
if (support.qsa && (!rbuggyQSA || !rbuggyQSA.test(selector))) {
nid = old = expando;
newContext = context;
newSelector = nodeType === 9 && selector;
// qSA works strangely on Element-rooted queries
// We can work around this by specifying an extra ID on the root
// and working up from there (Thanks to Andrew Dupont for the technique)
// IE 8 doesn't work on object elements
if (nodeType === 1 && context.nodeName.toLowerCase() !== "object") {
groups = tokenize(selector);
if ((old = context.getAttribute("id"))) {
nid = old.replace(rescape, "\\$&");
} else {
context.setAttribute("id", nid);
}
nid = "[id='" + nid + "'] ";
i = groups.length;
while (i--) {
groups[i] = nid + toSelector(groups[i]);
}
newContext = rsibling.test(selector) && testContext(context.parentNode) || context;
newSelector = groups.join(",");
}
if (newSelector) {
try {
push.apply(results,
newContext.querySelectorAll(newSelector)
);
return results;
} catch (qsaError) {
} finally {
if (!old) {
context.removeAttribute("id");
}
}
}
}
}
// All others
return select(selector.replace(rtrim, "$1"), context, results, seed);
}
/**
* Create key-value caches of limited size
* @returns {Function(string, Object)} Returns the Object data after storing it on itself with
* property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
* deleting the oldest entry
*/
function createCache() {
var keys = [];
function cache(key, value) {
// Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
if (keys.push(key + " ") > Expr.cacheLength) {
// Only keep the most recent entries
delete cache[keys.shift()];
}
return (cache[key + " "] = value);
}
return cache;
}
/**
* Mark a function for special use by Sizzle
* @param {Function} fn The function to mark
*/
function markFunction(fn) {
fn[expando] = true;
return fn;
}
/**
* Support testing using an element
* @param {Function} fn Passed the created div and expects a boolean result
*/
function assert(fn) {
var div = document.createElement("div");
try {
return !!fn(div);
} catch (e) {
return false;
} finally {
// Remove from its parent by default
if (div.parentNode) {
div.parentNode.removeChild(div);
}
// release memory in IE
div = null;
}
}
/**
* Adds the same handler for all of the specified attrs
* @param {String} attrs Pipe-separated list of attributes
* @param {Function} handler The method that will be applied
*/
function addHandle(attrs, handler) {
var arr = attrs.split("|"),
i = attrs.length;
while (i--) {
Expr.attrHandle[arr[i]] = handler;
}
}
/**
* Checks document order of two siblings
* @param {Element} a
* @param {Element} b
* @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
*/
function siblingCheck(a, b) {
var cur = b && a,
diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
( ~b.sourceIndex || MAX_NEGATIVE ) -
( ~a.sourceIndex || MAX_NEGATIVE );
// Use IE sourceIndex if available on both nodes
if (diff) {
return diff;
}
// Check if b follows a
if (cur) {
while ((cur = cur.nextSibling)) {
if (cur === b) {
return -1;
}
}
}
return a ? 1 : -1;
}
/**
* Returns a function to use in pseudos for input types
* @param {String} type
*/
function createInputPseudo(type) {
return function (elem) {
var name = elem.nodeName.toLowerCase();
return name === "input" && elem.type === type;
};
}
/**
* Returns a function to use in pseudos for buttons
* @param {String} type
*/
function createButtonPseudo(type) {
return function (elem) {
var name = elem.nodeName.toLowerCase();
return (name === "input" || name === "button") && elem.type === type;
};
}
/**
* Returns a function to use in pseudos for positionals
* @param {Function} fn
*/
function createPositionalPseudo(fn) {
return markFunction(function (argument) {
argument = +argument;
return markFunction(function (seed, matches) {
var j,
matchIndexes = fn([], seed.length, argument),
i = matchIndexes.length;
// Match elements found at the specified indexes
while (i--) {
if (seed[(j = matchIndexes[i])]) {
seed[j] = !(matches[j] = seed[j]);
}
}
});
});
}
/**
* Checks a node for validity as a Sizzle context
* @param {Element|Object=} context
* @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
*/
function testContext(context) {
return context && typeof context.getElementsByTagName !== strundefined && context;
}
// Expose support vars for convenience
support = Sizzle.support = {};
/**
* Detects XML nodes
* @param {Element|Object} elem An element or a document
* @returns {Boolean} True iff elem is a non-HTML XML node
*/
isXML = Sizzle.isXML = function (elem) {
// documentElement is verified for cases where it doesn't yet exist
// (such as loading iframes in IE - #4833)
var documentElement = elem && (elem.ownerDocument || elem).documentElement;
return documentElement ? documentElement.nodeName !== "HTML" : false;
};
/**
* Sets document-related variables once based on the current document
* @param {Element|Object} [doc] An element or document object to use to set the document
* @returns {Object} Returns the current document
*/
setDocument = Sizzle.setDocument = function (node) {
var hasCompare,
doc = node ? node.ownerDocument || node : preferredDoc,
parent = doc.defaultView;
// If no document and documentElement is available, return
if (doc === document || doc.nodeType !== 9 || !doc.documentElement) {
return document;
}
// Set our document
document = doc;
docElem = doc.documentElement;
// Support tests
documentIsHTML = !isXML(doc);
// Support: IE>8
// If iframe document is assigned to "document" variable and if iframe has been reloaded,
// IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936
// IE6-8 do not support the defaultView property so parent will be undefined
if (parent && parent !== parent.top) {
// IE11 does not have attachEvent, so all must suffer
if (parent.addEventListener) {
parent.addEventListener("unload", function () {
setDocument();
}, false);
} else if (parent.attachEvent) {
parent.attachEvent("onunload", function () {
setDocument();
});
}
}
/* Attributes
---------------------------------------------------------------------- */
// Support: IE<8
// Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans)
support.attributes = assert(function (div) {
div.className = "i";
return !div.getAttribute("className");
});
/* getElement(s)By*
---------------------------------------------------------------------- */
// Check if getElementsByTagName("*") returns only elements
support.getElementsByTagName = assert(function (div) {
div.appendChild(doc.createComment(""));
return !div.getElementsByTagName("*").length;
});
// Check if getElementsByClassName can be trusted
support.getElementsByClassName = rnative.test(doc.getElementsByClassName) && assert(function (div) {
div.innerHTML = "<div class='a'></div><div class='a i'></div>";
// Support: Safari<4
// Catch class over-caching
div.firstChild.className = "i";
// Support: Opera<10
// Catch gEBCN failure to find non-leading classes
return div.getElementsByClassName("i").length === 2;
});
// Support: IE<10
// Check if getElementById returns elements by name
// The broken getElementById methods don't pick up programatically-set names,
// so use a roundabout getElementsByName test
support.getById = assert(function (div) {
docElem.appendChild(div).id = expando;
return !doc.getElementsByName || !doc.getElementsByName(expando).length;
});
// ID find and filter
if (support.getById) {
Expr.find["ID"] = function (id, context) {
if (typeof context.getElementById !== strundefined && documentIsHTML) {
var m = context.getElementById(id);
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
return m && m.parentNode ? [m] : [];
}
};
Expr.filter["ID"] = function (id) {
var attrId = id.replace(runescape, funescape);
return function (elem) {
return elem.getAttribute("id") === attrId;
};
};
} else {
// Support: IE6/7
// getElementById is not reliable as a find shortcut
delete Expr.find["ID"];
Expr.filter["ID"] = function (id) {
var attrId = id.replace(runescape, funescape);
return function (elem) {
var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
return node && node.value === attrId;
};
};
}
// Tag
Expr.find["TAG"] = support.getElementsByTagName ?
function (tag, context) {
if (typeof context.getElementsByTagName !== strundefined) {
return context.getElementsByTagName(tag);
}
} :
function (tag, context) {
var elem,
tmp = [],
i = 0,
results = context.getElementsByTagName(tag);
// Filter out possible comments
if (tag === "*") {
while ((elem = results[i++])) {
if (elem.nodeType === 1) {
tmp.push(elem);
}
}
return tmp;
}
return results;
};
// Class
Expr.find["CLASS"] = support.getElementsByClassName && function (className, context) {
if (typeof context.getElementsByClassName !== strundefined && documentIsHTML) {
return context.getElementsByClassName(className);
}
};
/* QSA/matchesSelector
---------------------------------------------------------------------- */
// QSA and matchesSelector support
// matchesSelector(:active) reports false when true (IE9/Opera 11.5)
rbuggyMatches = [];
// qSa(:focus) reports false when true (Chrome 21)
// We allow this because of a bug in IE8/9 that throws an error
// whenever `document.activeElement` is accessed on an iframe
// So, we allow :focus to pass through QSA all the time to avoid the IE error
// See http://bugs.jquery.com/ticket/13378
rbuggyQSA = [];
if ((support.qsa = rnative.test(doc.querySelectorAll))) {
// Build QSA regex
// Regex strategy adopted from Diego Perini
assert(function (div) {
// Select is set to empty string on purpose
// This is to test IE's treatment of not explicitly
// setting a boolean content attribute,
// since its presence should be enough
// http://bugs.jquery.com/ticket/12359
div.innerHTML = "<select msallowclip=''><option selected=''></option></select>";
// Support: IE8, Opera 11-12.16
// Nothing should be selected when empty strings follow ^= or $= or *=
// The test attribute must be unknown in Opera but "safe" for WinRT
// http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
if (div.querySelectorAll("[msallowclip^='']").length) {
rbuggyQSA.push("[*^$]=" + whitespace + "*(?:''|\"\")");
}
// Support: IE8
// Boolean attributes and "value" are not treated correctly
if (!div.querySelectorAll("[selected]").length) {
rbuggyQSA.push("\\[" + whitespace + "*(?:value|" + booleans + ")");
}
// Webkit/Opera - :checked should return selected option elements
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
// IE8 throws error here and will not see later tests
if (!div.querySelectorAll(":checked").length) {
rbuggyQSA.push(":checked");
}
});
assert(function (div) {
// Support: Windows 8 Native Apps
// The type and name attributes are restricted during .innerHTML assignment
var input = doc.createElement("input");
input.setAttribute("type", "hidden");
div.appendChild(input).setAttribute("name", "D");
// Support: IE8
// Enforce case-sensitivity of name attribute
if (div.querySelectorAll("[name=d]").length) {
rbuggyQSA.push("name" + whitespace + "*[*^$|!~]?=");
}
// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
// IE8 throws error here and will not see later tests
if (!div.querySelectorAll(":enabled").length) {
rbuggyQSA.push(":enabled", ":disabled");
}
// Opera 10-11 does not throw on post-comma invalid pseudos
div.querySelectorAll("*,:x");
rbuggyQSA.push(",.*:");
});
}
if ((support.matchesSelector = rnative.test((matches = docElem.matches ||
docElem.webkitMatchesSelector ||
docElem.mozMatchesSelector ||
docElem.oMatchesSelector ||
docElem.msMatchesSelector)))) {
assert(function (div) {
// Check to see if it's possible to do matchesSelector
// on a disconnected node (IE 9)
support.disconnectedMatch = matches.call(div, "div");
// This should fail with an exception
// Gecko does not error, returns false instead
matches.call(div, "[s!='']:x");
rbuggyMatches.push("!=", pseudos);
});
}
rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|"));
rbuggyMatches = rbuggyMatches.length && new RegExp(rbuggyMatches.join("|"));
/* Contains
---------------------------------------------------------------------- */
hasCompare = rnative.test(docElem.compareDocumentPosition);
// Element contains another
// Purposefully does not implement inclusive descendent
// As in, an element does not contain itself
contains = hasCompare || rnative.test(docElem.contains) ?
function (a, b) {
var adown = a.nodeType === 9 ? a.documentElement : a,
bup = b && b.parentNode;
return a === bup || !!( bup && bup.nodeType === 1 && (
adown.contains ?
adown.contains(bup) :
a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16
));
} :
function (a, b) {
if (b) {
while ((b = b.parentNode)) {
if (b === a) {
return true;
}
}
}
return false;
};
/* Sorting
---------------------------------------------------------------------- */
// Document order sorting
sortOrder = hasCompare ?
function (a, b) {
// Flag for duplicate removal
if (a === b) {
hasDuplicate = true;
return 0;
}
// Sort on method existence if only one input has compareDocumentPosition
var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
if (compare) {
return compare;
}
// Calculate position if both inputs belong to the same document
compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
a.compareDocumentPosition(b) :
// Otherwise we know they are disconnected
1;
// Disconnected nodes
if (compare & 1 ||
(!support.sortDetached && b.compareDocumentPosition(a) === compare)) {
// Choose the first element that is related to our preferred document
if (a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a)) {
return -1;
}
if (b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b)) {
return 1;
}
// Maintain original order
return sortInput ?
( indexOf.call(sortInput, a) - indexOf.call(sortInput, b) ) :
0;
}
return compare & 4 ? -1 : 1;
} :
function (a, b) {
// Exit early if the nodes are identical
if (a === b) {
hasDuplicate = true;
return 0;
}
var cur,
i = 0,
aup = a.parentNode,
bup = b.parentNode,
ap = [a],
bp = [b];
// Parentless nodes are either documents or disconnected
if (!aup || !bup) {
return a === doc ? -1 :
b === doc ? 1 :
aup ? -1 :
bup ? 1 :
sortInput ?
( indexOf.call(sortInput, a) - indexOf.call(sortInput, b) ) :
0;
// If the nodes are siblings, we can do a quick check
} else if (aup === bup) {
return siblingCheck(a, b);
}
// Otherwise we need full lists of their ancestors for comparison
cur = a;
while ((cur = cur.parentNode)) {
ap.unshift(cur);
}
cur = b;
while ((cur = cur.parentNode)) {
bp.unshift(cur);
}
// Walk down the tree looking for a discrepancy
while (ap[i] === bp[i]) {
i++;
}
return i ?
// Do a sibling check if the nodes have a common ancestor
siblingCheck(ap[i], bp[i]) :
// Otherwise nodes in our document sort first
ap[i] === preferredDoc ? -1 :
bp[i] === preferredDoc ? 1 :
0;
};
return doc;
};
Sizzle.matches = function (expr, elements) {
return Sizzle(expr, null, null, elements);
};
Sizzle.matchesSelector = function (elem, expr) {
// Set document vars if needed
if (( elem.ownerDocument || elem ) !== document) {
setDocument(elem);
}
// Make sure that attribute selectors are quoted
expr = expr.replace(rattributeQuotes, "='$1']");
if (support.matchesSelector && documentIsHTML &&
( !rbuggyMatches || !rbuggyMatches.test(expr) ) &&
( !rbuggyQSA || !rbuggyQSA.test(expr) )) {
try {
var ret = matches.call(elem, expr);
// IE 9's matchesSelector returns false on disconnected nodes
if (ret || support.disconnectedMatch ||
// As well, disconnected nodes are said to be in a document
// fragment in IE 9
elem.document && elem.document.nodeType !== 11) {
return ret;
}
} catch (e) {
}
}
return Sizzle(expr, document, null, [elem]).length > 0;
};
Sizzle.contains = function (context, elem) {
// Set document vars if needed
if (( context.ownerDocument || context ) !== document) {
setDocument(context);
}
return contains(context, elem);
};
Sizzle.attr = function (elem, name) {
// Set document vars if needed
if (( elem.ownerDocument || elem ) !== document) {
setDocument(elem);
}
var fn = Expr.attrHandle[name.toLowerCase()],
// Don't get fooled by Object.prototype properties (jQuery #13807)
val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ?
fn(elem, name, !documentIsHTML) :
undefined;
return val !== undefined ?
val :
support.attributes || !documentIsHTML ?
elem.getAttribute(name) :
(val = elem.getAttributeNode(name)) && val.specified ?
val.value :
null;
};
Sizzle.error = function (msg) {
throw new Error("Syntax error, unrecognized expression: " + msg);
};
/**
* Document sorting and removing duplicates
* @param {ArrayLike} results
*/
Sizzle.uniqueSort = function (results) {
var elem,
duplicates = [],
j = 0,
i = 0;
// Unless we *know* we can detect duplicates, assume their presence
hasDuplicate = !support.detectDuplicates;
sortInput = !support.sortStable && results.slice(0);
results.sort(sortOrder);
if (hasDuplicate) {
while ((elem = results[i++])) {
if (elem === results[i]) {
j = duplicates.push(i);
}
}
while (j--) {
results.splice(duplicates[j], 1);
}
}
// Clear input after sorting to release objects
// See https://github.com/jquery/sizzle/pull/225
sortInput = null;
return results;
};
/**
* Utility function for retrieving the text value of an array of DOM nodes
* @param {Array|Element} elem
*/
getText = Sizzle.getText = function (elem) {
var node,
ret = "",
i = 0,
nodeType = elem.nodeType;
if (!nodeType) {
// If no nodeType, this is expected to be an array
while ((node = elem[i++])) {
// Do not traverse comment nodes
ret += getText(node);
}
} else if (nodeType === 1 || nodeType === 9 || nodeType === 11) {
// Use textContent for elements
// innerText usage removed for consistency of new lines (jQuery #11153)
if (typeof elem.textContent === "string") {
return elem.textContent;
} else {
// Traverse its children
for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
ret += getText(elem);
}
}
} else if (nodeType === 3 || nodeType === 4) {
return elem.nodeValue;
}
// Do not include comment or processing instruction nodes
return ret;
};
Expr = Sizzle.selectors = {
// Can be adjusted by the user
cacheLength: 50,
createPseudo: markFunction,
match: matchExpr,
attrHandle: {},
find: {},
relative: {
">": {dir: "parentNode", first: true},
" ": {dir: "parentNode"},
"+": {dir: "previousSibling", first: true},
"~": {dir: "previousSibling"}
},
preFilter: {
"ATTR": function (match) {
match[1] = match[1].replace(runescape, funescape);
// Move the given value to match[3] whether quoted or unquoted
match[3] = ( match[3] || match[4] || match[5] || "" ).replace(runescape, funescape);
if (match[2] === "~=") {
match[3] = " " + match[3] + " ";
}
return match.slice(0, 4);
},
"CHILD": function (match) {
/* matches from matchExpr["CHILD"]
1 type (only|nth|...)
2 what (child|of-type)
3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
4 xn-component of xn+y argument ([+-]?\d*n|)
5 sign of xn-component
6 x of xn-component
7 sign of y-component
8 y of y-component
*/
match[1] = match[1].toLowerCase();
if (match[1].slice(0, 3) === "nth") {
// nth-* requires argument
if (!match[3]) {
Sizzle.error(match[0]);
}
// numeric x and y parameters for Expr.filter.CHILD
// remember that false/true cast respectively to 0/1
match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
// other types prohibit arguments
} else if (match[3]) {
Sizzle.error(match[0]);
}
return match;
},
"PSEUDO": function (match) {
var excess,
unquoted = !match[6] && match[2];
if (matchExpr["CHILD"].test(match[0])) {
return null;
}
// Accept quoted arguments as-is
if (match[3]) {
match[2] = match[4] || match[5] || "";
// Strip excess characters from unquoted arguments
} else if (unquoted && rpseudo.test(unquoted) &&
// Get excess from tokenize (recursively)
(excess = tokenize(unquoted, true)) &&
// advance to the next closing parenthesis
(excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) {
// excess is a negative index
match[0] = match[0].slice(0, excess);
match[2] = unquoted.slice(0, excess);
}
// Return only captures needed by the pseudo filter method (type and argument)
return match.slice(0, 3);
}
},
filter: {
"TAG": function (nodeNameSelector) {
var nodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase();
return nodeNameSelector === "*" ?
function () {
return true;
} :
function (elem) {
return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
};
},
"CLASS": function (className) {
var pattern = classCache[className + " "];
return pattern ||
(pattern = new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)")) &&
classCache(className, function (elem) {
return pattern.test(typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "");
});
},
"ATTR": function (name, operator, check) {
return function (elem) {
var result = Sizzle.attr(elem, name);
if (result == null) {
return operator === "!=";
}
if (!operator) {
return true;
}
result += "";
return operator === "=" ? result === check :
operator === "!=" ? result !== check :
operator === "^=" ? check && result.indexOf(check) === 0 :
operator === "*=" ? check && result.indexOf(check) > -1 :
operator === "$=" ? check && result.slice(-check.length) === check :
operator === "~=" ? ( " " + result + " " ).indexOf(check) > -1 :
operator === "|=" ? result === check || result.slice(0, check.length + 1) === check + "-" :
false;
};
},
"CHILD": function (type, what, argument, first, last) {
var simple = type.slice(0, 3) !== "nth",
forward = type.slice(-4) !== "last",
ofType = what === "of-type";
return first === 1 && last === 0 ?
// Shortcut for :nth-*(n)
function (elem) {
return !!elem.parentNode;
} :
function (elem, context, xml) {
var cache, outerCache, node, diff, nodeIndex, start,
dir = simple !== forward ? "nextSibling" : "previousSibling",
parent = elem.parentNode,
name = ofType && elem.nodeName.toLowerCase(),
useCache = !xml && !ofType;
if (parent) {
// :(first|last|only)-(child|of-type)
if (simple) {
while (dir) {
node = elem;
while ((node = node[dir])) {
if (ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) {
return false;
}
}
// Reverse direction for :only-* (if we haven't yet done so)
start = dir = type === "only" && !start && "nextSibling";
}
return true;
}
start = [forward ? parent.firstChild : parent.lastChild];
// non-xml :nth-child(...) stores cache data on `parent`
if (forward && useCache) {
// Seek `elem` from a previously-cached index
outerCache = parent[expando] || (parent[expando] = {});
cache = outerCache[type] || [];
nodeIndex = cache[0] === dirruns && cache[1];
diff = cache[0] === dirruns && cache[2];
node = nodeIndex && parent.childNodes[nodeIndex];
while ((node = ++nodeIndex && node && node[dir] ||
// Fallback to seeking `elem` from the start
(diff = nodeIndex = 0) || start.pop())) {
// When found, cache indexes on `parent` and break
if (node.nodeType === 1 && ++diff && node === elem) {
outerCache[type] = [dirruns, nodeIndex, diff];
break;
}
}
// Use previously-cached element index if available
} else if (useCache && (cache = (elem[expando] || (elem[expando] = {}))[type]) && cache[0] === dirruns) {
diff = cache[1];
// xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
} else {
// Use the same loop as above to seek `elem` from the start
while ((node = ++nodeIndex && node && node[dir] ||
(diff = nodeIndex = 0) || start.pop())) {
if (( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff) {
// Cache the index of each encountered element
if (useCache) {
(node[expando] || (node[expando] = {}))[type] = [dirruns, diff];
}
if (node === elem) {
break;
}
}
}
}
// Incorporate the offset, then check against cycle size
diff -= last;
return diff === first || ( diff % first === 0 && diff / first >= 0 );
}
};
},
"PSEUDO": function (pseudo, argument) {
// pseudo-class names are case-insensitive
// http://www.w3.org/TR/selectors/#pseudo-classes
// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
// Remember that setFilters inherits from pseudos
var args,
fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] ||
Sizzle.error("unsupported pseudo: " + pseudo);
// The user may use createPseudo to indicate that
// arguments are needed to create the filter function
// just as Sizzle does
if (fn[expando]) {
return fn(argument);
}
// But maintain support for old signatures
if (fn.length > 1) {
args = [pseudo, pseudo, "", argument];
return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ?
markFunction(function (seed, matches) {
var idx,
matched = fn(seed, argument),
i = matched.length;
while (i--) {
idx = indexOf.call(seed, matched[i]);
seed[idx] = !( matches[idx] = matched[i] );
}
}) :
function (elem) {
return fn(elem, 0, args);
};
}
return fn;
}
},
pseudos: {
// Potentially complex pseudos
"not": markFunction(function (selector) {
// Trim the selector passed to compile
// to avoid treating leading and trailing
// spaces as combinators
var input = [],
results = [],
matcher = compile(selector.replace(rtrim, "$1"));
return matcher[expando] ?
markFunction(function (seed, matches, context, xml) {
var elem,
unmatched = matcher(seed, null, xml, []),
i = seed.length;
// Match elements unmatched by `matcher`
while (i--) {
if ((elem = unmatched[i])) {
seed[i] = !(matches[i] = elem);
}
}
}) :
function (elem, context, xml) {
input[0] = elem;
matcher(input, null, xml, results);
return !results.pop();
};
}),
"has": markFunction(function (selector) {
return function (elem) {
return Sizzle(selector, elem).length > 0;
};
}),
"contains": markFunction(function (text) {
return function (elem) {
return ( elem.textContent || elem.innerText || getText(elem) ).indexOf(text) > -1;
};
}),
// "Whether an element is represented by a :lang() selector
// is based solely on the element's language value
// being equal to the identifier C,
// or beginning with the identifier C immediately followed by "-".
// The matching of C against the element's language value is performed case-insensitively.
// The identifier C does not have to be a valid language name."
// http://www.w3.org/TR/selectors/#lang-pseudo
"lang": markFunction(function (lang) {
// lang value must be a valid identifier
if (!ridentifier.test(lang || "")) {
Sizzle.error("unsupported lang: " + lang);
}
lang = lang.replace(runescape, funescape).toLowerCase();
return function (elem) {
var elemLang;
do {
if ((elemLang = documentIsHTML ?
elem.lang :
elem.getAttribute("xml:lang") || elem.getAttribute("lang"))) {
elemLang = elemLang.toLowerCase();
return elemLang === lang || elemLang.indexOf(lang + "-") === 0;
}
} while ((elem = elem.parentNode) && elem.nodeType === 1);
return false;
};
}),
// Miscellaneous
"target": function (elem) {
var hash = window.location && window.location.hash;
return hash && hash.slice(1) === elem.id;
},
"root": function (elem) {
return elem === docElem;
},
"focus": function (elem) {
return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
},
// Boolean properties
"enabled": function (elem) {
return elem.disabled === false;
},
"disabled": function (elem) {
return elem.disabled === true;
},
"checked": function (elem) {
// In CSS3, :checked should return both checked and selected elements
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
var nodeName = elem.nodeName.toLowerCase();
return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
},
"selected": function (elem) {
// Accessing this property makes selected-by-default
// options in Safari work properly
if (elem.parentNode) {
elem.parentNode.selectedIndex;
}
return elem.selected === true;
},
// Contents
"empty": function (elem) {
// http://www.w3.org/TR/selectors/#empty-pseudo
// :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
// but not by others (comment: 8; processing instruction: 7; etc.)
// nodeType < 6 works because attributes (2) do not appear as children
for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
if (elem.nodeType < 6) {
return false;
}
}
return true;
},
"parent": function (elem) {
return !Expr.pseudos["empty"](elem);
},
// Element/input types
"header": function (elem) {
return rheader.test(elem.nodeName);
},
"input": function (elem) {
return rinputs.test(elem.nodeName);
},
"button": function (elem) {
var name = elem.nodeName.toLowerCase();
return name === "input" && elem.type === "button" || name === "button";
},
"text": function (elem) {
var attr;
return elem.nodeName.toLowerCase() === "input" &&
elem.type === "text" &&
// Support: IE<8
// New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
},
// Position-in-collection
"first": createPositionalPseudo(function () {
return [0];
}),
"last": createPositionalPseudo(function (matchIndexes, length) {
return [length - 1];
}),
"eq": createPositionalPseudo(function (matchIndexes, length, argument) {
return [argument < 0 ? argument + length : argument];
}),
"even": createPositionalPseudo(function (matchIndexes, length) {
var i = 0;
for (; i < length; i += 2) {
matchIndexes.push(i);
}
return matchIndexes;
}),
"odd": createPositionalPseudo(function (matchIndexes, length) {
var i = 1;
for (; i < length; i += 2) {
matchIndexes.push(i);
}
return matchIndexes;
}),
"lt": createPositionalPseudo(function (matchIndexes, length, argument) {
var i = argument < 0 ? argument + length : argument;
for (; --i >= 0;) {
matchIndexes.push(i);
}
return matchIndexes;
}),
"gt": createPositionalPseudo(function (matchIndexes, length, argument) {
var i = argument < 0 ? argument + length : argument;
for (; ++i < length;) {
matchIndexes.push(i);
}
return matchIndexes;
})
}
};
Expr.pseudos["nth"] = Expr.pseudos["eq"];
// Add button/input type pseudos
for (i in {radio: true, checkbox: true, file: true, password: true, image: true}) {
Expr.pseudos[i] = createInputPseudo(i);
}
for (i in {submit: true, reset: true}) {
Expr.pseudos[i] = createButtonPseudo(i);
}
// Easy API for creating new setFilters
function setFilters() {
}
setFilters.prototype = Expr.filters = Expr.pseudos;
Expr.setFilters = new setFilters();
tokenize = Sizzle.tokenize = function (selector, parseOnly) {
var matched, match, tokens, type,
soFar, groups, preFilters,
cached = tokenCache[selector + " "];
if (cached) {
return parseOnly ? 0 : cached.slice(0);
}
soFar = selector;
groups = [];
preFilters = Expr.preFilter;
while (soFar) {
// Comma and first run
if (!matched || (match = rcomma.exec(soFar))) {
if (match) {
// Don't consume trailing commas as valid
soFar = soFar.slice(match[0].length) || soFar;
}
groups.push((tokens = []));
}
matched = false;
// Combinators
if ((match = rcombinators.exec(soFar))) {
matched = match.shift();
tokens.push({
value: matched,
// Cast descendant combinators to space
type: match[0].replace(rtrim, " ")
});
soFar = soFar.slice(matched.length);
}
// Filters
for (type in Expr.filter) {
if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] ||
(match = preFilters[type](match)))) {
matched = match.shift();
tokens.push({
value: matched,
type: type,
matches: match
});
soFar = soFar.slice(matched.length);
}
}
if (!matched) {
break;
}
}
// Return the length of the invalid excess
// if we're just parsing
// Otherwise, throw an error or return tokens
return parseOnly ?
soFar.length :
soFar ?
Sizzle.error(selector) :
// Cache the tokens
tokenCache(selector, groups).slice(0);
};
function toSelector(tokens) {
var i = 0,
len = tokens.length,
selector = "";
for (; i < len; i++) {
selector += tokens[i].value;
}
return selector;
}
function addCombinator(matcher, combinator, base) {
var dir = combinator.dir,
checkNonElements = base && dir === "parentNode",
doneName = done++;
return combinator.first ?
// Check against closest ancestor/preceding element
function (elem, context, xml) {
while ((elem = elem[dir])) {
if (elem.nodeType === 1 || checkNonElements) {
return matcher(elem, context, xml);
}
}
} :
// Check against all ancestor/preceding elements
function (elem, context, xml) {
var oldCache, outerCache,
newCache = [dirruns, doneName];
// We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
if (xml) {
while ((elem = elem[dir])) {
if (elem.nodeType === 1 || checkNonElements) {
if (matcher(elem, context, xml)) {
return true;
}
}
}
} else {
while ((elem = elem[dir])) {
if (elem.nodeType === 1 || checkNonElements) {
outerCache = elem[expando] || (elem[expando] = {});
if ((oldCache = outerCache[dir]) &&
oldCache[0] === dirruns && oldCache[1] === doneName) {
// Assign to newCache so results back-propagate to previous elements
return (newCache[2] = oldCache[2]);
} else {
// Reuse newcache so results back-propagate to previous elements
outerCache[dir] = newCache;
// A match means we're done; a fail means we have to keep checking
if ((newCache[2] = matcher(elem, context, xml))) {
return true;
}
}
}
}
}
};
}
function elementMatcher(matchers) {
return matchers.length > 1 ?
function (elem, context, xml) {
var i = matchers.length;
while (i--) {
if (!matchers[i](elem, context, xml)) {
return false;
}
}
return true;
} :
matchers[0];
}
function multipleContexts(selector, contexts, results) {
var i = 0,
len = contexts.length;
for (; i < len; i++) {
Sizzle(selector, contexts[i], results);
}
return results;
}
function condense(unmatched, map, filter, context, xml) {
var elem,
newUnmatched = [],
i = 0,
len = unmatched.length,
mapped = map != null;
for (; i < len; i++) {
if ((elem = unmatched[i])) {
if (!filter || filter(elem, context, xml)) {
newUnmatched.push(elem);
if (mapped) {
map.push(i);
}
}
}
}
return newUnmatched;
}
function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) {
if (postFilter && !postFilter[expando]) {
postFilter = setMatcher(postFilter);
}
if (postFinder && !postFinder[expando]) {
postFinder = setMatcher(postFinder, postSelector);
}
return markFunction(function (seed, results, context, xml) {
var temp, i, elem,
preMap = [],
postMap = [],
preexisting = results.length,
// Get initial elements from seed or context
elems = seed || multipleContexts(selector || "*", context.nodeType ? [context] : context, []),
// Prefilter to get matcher input, preserving a map for seed-results synchronization
matcherIn = preFilter && ( seed || !selector ) ?
condense(elems, preMap, preFilter, context, xml) :
elems,
matcherOut = matcher ?
// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
// ...intermediate processing is necessary
[] :
// ...otherwise use results directly
results :
matcherIn;
// Find primary matches
if (matcher) {
matcher(matcherIn, matcherOut, context, xml);
}
// Apply postFilter
if (postFilter) {
temp = condense(matcherOut, postMap);
postFilter(temp, [], context, xml);
// Un-match failing elements by moving them back to matcherIn
i = temp.length;
while (i--) {
if ((elem = temp[i])) {
matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem);
}
}
}
if (seed) {
if (postFinder || preFilter) {
if (postFinder) {
// Get the final matcherOut by condensing this intermediate into postFinder contexts
temp = [];
i = matcherOut.length;
while (i--) {
if ((elem = matcherOut[i])) {
// Restore matcherIn since elem is not yet a final match
temp.push((matcherIn[i] = elem));
}
}
postFinder(null, (matcherOut = []), temp, xml);
}
// Move matched elements from seed to results to keep them synchronized
i = matcherOut.length;
while (i--) {
if ((elem = matcherOut[i]) &&
(temp = postFinder ? indexOf.call(seed, elem) : preMap[i]) > -1) {
seed[temp] = !(results[temp] = elem);
}
}
}
// Add elements to results, through postFinder if defined
} else {
matcherOut = condense(
matcherOut === results ?
matcherOut.splice(preexisting, matcherOut.length) :
matcherOut
);
if (postFinder) {
postFinder(null, results, matcherOut, xml);
} else {
push.apply(results, matcherOut);
}
}
});
}
function matcherFromTokens(tokens) {
var checkContext, matcher, j,
len = tokens.length,
leadingRelative = Expr.relative[tokens[0].type],
implicitRelative = leadingRelative || Expr.relative[" "],
i = leadingRelative ? 1 : 0,
// The foundational matcher ensures that elements are reachable from top-level context(s)
matchContext = addCombinator(function (elem) {
return elem === checkContext;
}, implicitRelative, true),
matchAnyContext = addCombinator(function (elem) {
return indexOf.call(checkContext, elem) > -1;
}, implicitRelative, true),
matchers = [function (elem, context, xml) {
return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
(checkContext = context).nodeType ?
matchContext(elem, context, xml) :
matchAnyContext(elem, context, xml) );
}];
for (; i < len; i++) {
if ((matcher = Expr.relative[tokens[i].type])) {
matchers = [addCombinator(elementMatcher(matchers), matcher)];
} else {
matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches);
// Return special upon seeing a positional matcher
if (matcher[expando]) {
// Find the next relative operator (if any) for proper handling
j = ++i;
for (; j < len; j++) {
if (Expr.relative[tokens[j].type]) {
break;
}
}
return setMatcher(
i > 1 && elementMatcher(matchers),
i > 1 && toSelector(
// If the preceding token was a descendant combinator, insert an implicit any-element `*`
tokens.slice(0, i - 1).concat({value: tokens[i - 2].type === " " ? "*" : ""})
).replace(rtrim, "$1"),
matcher,
i < j && matcherFromTokens(tokens.slice(i, j)),
j < len && matcherFromTokens((tokens = tokens.slice(j))),
j < len && toSelector(tokens)
);
}
matchers.push(matcher);
}
}
return elementMatcher(matchers);
}
function matcherFromGroupMatchers(elementMatchers, setMatchers) {
var bySet = setMatchers.length > 0,
byElement = elementMatchers.length > 0,
superMatcher = function (seed, context, xml, results, outermost) {
var elem, j, matcher,
matchedCount = 0,
i = "0",
unmatched = seed && [],
setMatched = [],
contextBackup = outermostContext,
// We must always have either seed elements or outermost context
elems = seed || byElement && Expr.find["TAG"]("*", outermost),
// Use integer dirruns iff this is the outermost matcher
dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
len = elems.length;
if (outermost) {
outermostContext = context !== document && context;
}
// Add elements passing elementMatchers directly to results
// Keep `i` a string if there are no elements so `matchedCount` will be "00" below
// Support: IE<9, Safari
// Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
for (; i !== len && (elem = elems[i]) != null; i++) {
if (byElement && elem) {
j = 0;
while ((matcher = elementMatchers[j++])) {
if (matcher(elem, context, xml)) {
results.push(elem);
break;
}
}
if (outermost) {
dirruns = dirrunsUnique;
}
}
// Track unmatched elements for set filters
if (bySet) {
// They will have gone through all possible matchers
if ((elem = !matcher && elem)) {
matchedCount--;
}
// Lengthen the array for every element, matched or not
if (seed) {
unmatched.push(elem);
}
}
}
// Apply set filters to unmatched elements
matchedCount += i;
if (bySet && i !== matchedCount) {
j = 0;
while ((matcher = setMatchers[j++])) {
matcher(unmatched, setMatched, context, xml);
}
if (seed) {
// Reintegrate element matches to eliminate the need for sorting
if (matchedCount > 0) {
while (i--) {
if (!(unmatched[i] || setMatched[i])) {
setMatched[i] = pop.call(results);
}
}
}
// Discard index placeholder values to get only actual matches
setMatched = condense(setMatched);
}
// Add matches to results
push.apply(results, setMatched);
// Seedless set matches succeeding multiple successful matchers stipulate sorting
if (outermost && !seed && setMatched.length > 0 &&
( matchedCount + setMatchers.length ) > 1) {
Sizzle.uniqueSort(results);
}
}
// Override manipulation of globals by nested matchers
if (outermost) {
dirruns = dirrunsUnique;
outermostContext = contextBackup;
}
return unmatched;
};
return bySet ?
markFunction(superMatcher) :
superMatcher;
}
compile = Sizzle.compile = function (selector, match /* Internal Use Only */) {
var i,
setMatchers = [],
elementMatchers = [],
cached = compilerCache[selector + " "];
if (!cached) {
// Generate a function of recursive functions that can be used to check each element
if (!match) {
match = tokenize(selector);
}
i = match.length;
while (i--) {
cached = matcherFromTokens(match[i]);
if (cached[expando]) {
setMatchers.push(cached);
} else {
elementMatchers.push(cached);
}
}
// Cache the compiled function
cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers));
// Save selector and tokenization
cached.selector = selector;
}
return cached;
};
/**
* A low-level selection function that works with Sizzle's compiled
* selector functions
* @param {String|Function} selector A selector or a pre-compiled
* selector function built with Sizzle.compile
* @param {Element} context
* @param {Array} [results]
* @param {Array} [seed] A set of elements to match against
*/
select = Sizzle.select = function (selector, context, results, seed) {
var i, tokens, token, type, find,
compiled = typeof selector === "function" && selector,
match = !seed && tokenize((selector = compiled.selector || selector));
results = results || [];
// Try to minimize operations if there is no seed and only one group
if (match.length === 1) {
// Take a shortcut and set the context if the root selector is an ID
tokens = match[0] = match[0].slice(0);
if (tokens.length > 2 && (token = tokens[0]).type === "ID" &&
support.getById && context.nodeType === 9 && documentIsHTML &&
Expr.relative[tokens[1].type]) {
context = ( Expr.find["ID"](token.matches[0].replace(runescape, funescape), context) || [] )[0];
if (!context) {
return results;
// Precompiled matchers will still verify ancestry, so step up a level
} else if (compiled) {
context = context.parentNode;
}
selector = selector.slice(tokens.shift().value.length);
}
// Fetch a seed set for right-to-left matching
i = matchExpr["needsContext"].test(selector) ? 0 : tokens.length;
while (i--) {
token = tokens[i];
// Abort if we hit a combinator
if (Expr.relative[(type = token.type)]) {
break;
}
if ((find = Expr.find[type])) {
// Search, expanding context for leading sibling combinators
if ((seed = find(
token.matches[0].replace(runescape, funescape),
rsibling.test(tokens[0].type) && testContext(context.parentNode) || context
))) {
// If seed is empty or no tokens remain, we can return early
tokens.splice(i, 1);
selector = seed.length && toSelector(tokens);
if (!selector) {
push.apply(results, seed);
return results;
}
break;
}
}
}
}
// Compile and execute a filtering function if one is not provided
// Provide `match` to avoid retokenization if we modified the selector above
( compiled || compile(selector, match) )(
seed,
context,
!documentIsHTML,
results,
rsibling.test(selector) && testContext(context.parentNode) || context
);
return results;
};
// One-time assignments
// Sort stability
support.sortStable = expando.split("").sort(sortOrder).join("") === expando;
// Support: Chrome<14
// Always assume duplicates if they aren't passed to the comparison function
support.detectDuplicates = !!hasDuplicate;
// Initialize against the default document
setDocument();
// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
// Detached nodes confoundingly follow *each other*
support.sortDetached = assert(function (div1) {
// Should return 1, but returns 4 (following)
return div1.compareDocumentPosition(document.createElement("div")) & 1;
});
// Support: IE<8
// Prevent attribute/property "interpolation"
// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
if (!assert(function (div) {
div.innerHTML = "<a href='#'></a>";
return div.firstChild.getAttribute("href") === "#";
})) {
addHandle("type|href|height|width", function (elem, name, isXML) {
if (!isXML) {
return elem.getAttribute(name, name.toLowerCase() === "type" ? 1 : 2);
}
});
}
// Support: IE<9
// Use defaultValue in place of getAttribute("value")
if (!support.attributes || !assert(function (div) {
div.innerHTML = "<input/>";
div.firstChild.setAttribute("value", "");
return div.firstChild.getAttribute("value") === "";
})) {
addHandle("value", function (elem, name, isXML) {
if (!isXML && elem.nodeName.toLowerCase() === "input") {
return elem.defaultValue;
}
});
}
// Support: IE<9
// Use getAttributeNode to fetch booleans when getAttribute lies
if (!assert(function (div) {
return div.getAttribute("disabled") == null;
})) {
addHandle(booleans, function (elem, name, isXML) {
var val;
if (!isXML) {
return elem[name] === true ? name.toLowerCase() :
(val = elem.getAttributeNode(name)) && val.specified ?
val.value :
null;
}
});
}
return Sizzle;
})(window);
jQuery.find = Sizzle;
jQuery.expr = Sizzle.selectors;
jQuery.expr[":"] = jQuery.expr.pseudos;
jQuery.unique = Sizzle.uniqueSort;
jQuery.text = Sizzle.getText;
jQuery.isXMLDoc = Sizzle.isXML;
jQuery.contains = Sizzle.contains;
var rneedsContext = jQuery.expr.match.needsContext;
var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/);
var risSimple = /^.[^:#\[\.,]*$/;
// Implement the identical functionality for filter and not
function winnow(elements, qualifier, not) {
if (jQuery.isFunction(qualifier)) {
return jQuery.grep(elements, function (elem, i) {
/* jshint -W018 */
return !!qualifier.call(elem, i, elem) !== not;
});
}
if (qualifier.nodeType) {
return jQuery.grep(elements, function (elem) {
return ( elem === qualifier ) !== not;
});
}
if (typeof qualifier === "string") {
if (risSimple.test(qualifier)) {
return jQuery.filter(qualifier, elements, not);
}
qualifier = jQuery.filter(qualifier, elements);
}
return jQuery.grep(elements, function (elem) {
return ( indexOf.call(qualifier, elem) >= 0 ) !== not;
});
}
jQuery.filter = function (expr, elems, not) {
var elem = elems[0];
if (not) {
expr = ":not(" + expr + ")";
}
return elems.length === 1 && elem.nodeType === 1 ?
jQuery.find.matchesSelector(elem, expr) ? [elem] : [] :
jQuery.find.matches(expr, jQuery.grep(elems, function (elem) {
return elem.nodeType === 1;
}));
};
jQuery.fn.extend({
find: function (selector) {
var i,
len = this.length,
ret = [],
self = this;
if (typeof selector !== "string") {
return this.pushStack(jQuery(selector).filter(function () {
for (i = 0; i < len; i++) {
if (jQuery.contains(self[i], this)) {
return true;
}
}
}));
}
for (i = 0; i < len; i++) {
jQuery.find(selector, self[i], ret);
}
// Needed because $( selector, context ) becomes $( context ).find( selector )
ret = this.pushStack(len > 1 ? jQuery.unique(ret) : ret);
ret.selector = this.selector ? this.selector + " " + selector : selector;
return ret;
},
filter: function (selector) {
return this.pushStack(winnow(this, selector || [], false));
},
not: function (selector) {
return this.pushStack(winnow(this, selector || [], true));
},
is: function (selector) {
return !!winnow(
this,
// If this is a positional/relative selector, check membership in the returned set
// so $("p:first").is("p:last") won't return true for a doc with two "p".
typeof selector === "string" && rneedsContext.test(selector) ?
jQuery(selector) :
selector || [],
false
).length;
}
});
// Initialize a jQuery object
// A central reference to the root jQuery(document)
var rootjQuery,
// A simple way to check for HTML strings
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
// Strict HTML recognition (#11290: must start with <)
rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
init = jQuery.fn.init = function (selector, context) {
var match, elem;
// HANDLE: $(""), $(null), $(undefined), $(false)
if (!selector) {
return this;
}
// Handle HTML strings
if (typeof selector === "string") {
if (selector[0] === "<" && selector[selector.length - 1] === ">" && selector.length >= 3) {
// Assume that strings that start and end with <> are HTML and skip the regex check
match = [null, selector, null];
} else {
match = rquickExpr.exec(selector);
}
// Match html or make sure no context is specified for #id
if (match && (match[1] || !context)) {
// HANDLE: $(html) -> $(array)
if (match[1]) {
context = context instanceof jQuery ? context[0] : context;
// scripts is true for back-compat
// Intentionally let the error be thrown if parseHTML is not present
jQuery.merge(this, jQuery.parseHTML(
match[1],
context && context.nodeType ? context.ownerDocument || context : document,
true
));
// HANDLE: $(html, props)
if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) {
for (match in context) {
// Properties of context are called as methods if possible
if (jQuery.isFunction(this[match])) {
this[match](context[match]);
// ...and otherwise set as attributes
} else {
this.attr(match, context[match]);
}
}
}
return this;
// HANDLE: $(#id)
} else {
elem = document.getElementById(match[2]);
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
if (elem && elem.parentNode) {
// Inject the element directly into the jQuery object
this.length = 1;
this[0] = elem;
}
this.context = document;
this.selector = selector;
return this;
}
// HANDLE: $(expr, $(...))
} else if (!context || context.jquery) {
return ( context || rootjQuery ).find(selector);
// HANDLE: $(expr, context)
// (which is just equivalent to: $(context).find(expr)
} else {
return this.constructor(context).find(selector);
}
// HANDLE: $(DOMElement)
} else if (selector.nodeType) {
this.context = this[0] = selector;
this.length = 1;
return this;
// HANDLE: $(function)
// Shortcut for document ready
} else if (jQuery.isFunction(selector)) {
return typeof rootjQuery.ready !== "undefined" ?
rootjQuery.ready(selector) :
// Execute immediately if ready is not present
selector(jQuery);
}
if (selector.selector !== undefined) {
this.selector = selector.selector;
this.context = selector.context;
}
return jQuery.makeArray(selector, this);
};
// Give the init function the jQuery prototype for later instantiation
init.prototype = jQuery.fn;
// Initialize central reference
rootjQuery = jQuery(document);
var rparentsprev = /^(?:parents|prev(?:Until|All))/,
// methods guaranteed to produce a unique set when starting from a unique set
guaranteedUnique = {
children: true,
contents: true,
next: true,
prev: true
};
jQuery.extend({
dir: function (elem, dir, until) {
var matched = [],
truncate = until !== undefined;
while ((elem = elem[dir]) && elem.nodeType !== 9) {
if (elem.nodeType === 1) {
if (truncate && jQuery(elem).is(until)) {
break;
}
matched.push(elem);
}
}
return matched;
},
sibling: function (n, elem) {
var matched = [];
for (; n; n = n.nextSibling) {
if (n.nodeType === 1 && n !== elem) {
matched.push(n);
}
}
return matched;
}
});
jQuery.fn.extend({
has: function (target) {
var targets = jQuery(target, this),
l = targets.length;
return this.filter(function () {
var i = 0;
for (; i < l; i++) {
if (jQuery.contains(this, targets[i])) {
return true;
}
}
});
},
closest: function (selectors, context) {
var cur,
i = 0,
l = this.length,
matched = [],
pos = rneedsContext.test(selectors) || typeof selectors !== "string" ?
jQuery(selectors, context || this.context) :
0;
for (; i < l; i++) {
for (cur = this[i]; cur && cur !== context; cur = cur.parentNode) {
// Always skip document fragments
if (cur.nodeType < 11 && (pos ?
pos.index(cur) > -1 :
// Don't pass non-elements to Sizzle
cur.nodeType === 1 &&
jQuery.find.matchesSelector(cur, selectors))) {
matched.push(cur);
break;
}
}
}
return this.pushStack(matched.length > 1 ? jQuery.unique(matched) : matched);
},
// Determine the position of an element within
// the matched set of elements
index: function (elem) {
// No argument, return index in parent
if (!elem) {
return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1;
}
// index in selector
if (typeof elem === "string") {
return indexOf.call(jQuery(elem), this[0]);
}
// Locate the position of the desired element
return indexOf.call(this,
// If it receives a jQuery object, the first element is used
elem.jquery ? elem[0] : elem
);
},
add: function (selector, context) {
return this.pushStack(
jQuery.unique(
jQuery.merge(this.get(), jQuery(selector, context))
)
);
},
addBack: function (selector) {
return this.add(selector == null ?
this.prevObject : this.prevObject.filter(selector)
);
}
});
function sibling(cur, dir) {
while ((cur = cur[dir]) && cur.nodeType !== 1) {
}
return cur;
}
jQuery.each({
parent: function (elem) {
var parent = elem.parentNode;
return parent && parent.nodeType !== 11 ? parent : null;
},
parents: function (elem) {
return jQuery.dir(elem, "parentNode");
},
parentsUntil: function (elem, i, until) {
return jQuery.dir(elem, "parentNode", until);
},
next: function (elem) {
return sibling(elem, "nextSibling");
},
prev: function (elem) {
return sibling(elem, "previousSibling");
},
nextAll: function (elem) {
return jQuery.dir(elem, "nextSibling");
},
prevAll: function (elem) {
return jQuery.dir(elem, "previousSibling");
},
nextUntil: function (elem, i, until) {
return jQuery.dir(elem, "nextSibling", until);
},
prevUntil: function (elem, i, until) {
return jQuery.dir(elem, "previousSibling", until);
},
siblings: function (elem) {
return jQuery.sibling(( elem.parentNode || {} ).firstChild, elem);
},
children: function (elem) {
return jQuery.sibling(elem.firstChild);
},
contents: function (elem) {
return elem.contentDocument || jQuery.merge([], elem.childNodes);
}
}, function (name, fn) {
jQuery.fn[name] = function (until, selector) {
var matched = jQuery.map(this, fn, until);
if (name.slice(-5) !== "Until") {
selector = until;
}
if (selector && typeof selector === "string") {
matched = jQuery.filter(selector, matched);
}
if (this.length > 1) {
// Remove duplicates
if (!guaranteedUnique[name]) {
jQuery.unique(matched);
}
// Reverse order for parents* and prev-derivatives
if (rparentsprev.test(name)) {
matched.reverse();
}
}
return this.pushStack(matched);
};
});
var rnotwhite = (/\S+/g);
// String to Object options format cache
var optionsCache = {};
// Convert String-formatted options into Object-formatted ones and store in cache
function createOptions(options) {
var object = optionsCache[options] = {};
jQuery.each(options.match(rnotwhite) || [], function (_, flag) {
object[flag] = true;
});
return object;
}
/*
* Create a callback list using the following parameters:
*
* options: an optional list of space-separated options that will change how
* the callback list behaves or a more traditional option object
*
* By default a callback list will act like an event callback list and can be
* "fired" multiple times.
*
* Possible options:
*
* once: will ensure the callback list can only be fired once (like a Deferred)
*
* memory: will keep track of previous values and will call any callback added
* after the list has been fired right away with the latest "memorized"
* values (like a Deferred)
*
* unique: will ensure a callback can only be added once (no duplicate in the list)
*
* stopOnFalse: interrupt callings when a callback returns false
*
*/
jQuery.Callbacks = function (options) {
// Convert options from String-formatted to Object-formatted if needed
// (we check in cache first)
options = typeof options === "string" ?
( optionsCache[options] || createOptions(options) ) :
jQuery.extend({}, options);
var // Last fire value (for non-forgettable lists)
memory,
// Flag to know if list was already fired
fired,
// Flag to know if list is currently firing
firing,
// First callback to fire (used internally by add and fireWith)
firingStart,
// End of the loop when firing
firingLength,
// Index of currently firing callback (modified by remove if needed)
firingIndex,
// Actual callback list
list = [],
// Stack of fire calls for repeatable lists
stack = !options.once && [],
// Fire callbacks
fire = function (data) {
memory = options.memory && data;
fired = true;
firingIndex = firingStart || 0;
firingStart = 0;
firingLength = list.length;
firing = true;
for (; list && firingIndex < firingLength; firingIndex++) {
if (list[firingIndex].apply(data[0], data[1]) === false && options.stopOnFalse) {
memory = false; // To prevent further calls using add
break;
}
}
firing = false;
if (list) {
if (stack) {
if (stack.length) {
fire(stack.shift());
}
} else if (memory) {
list = [];
} else {
self.disable();
}
}
},
// Actual Callbacks object
self = {
// Add a callback or a collection of callbacks to the list
add: function () {
if (list) {
// First, we save the current length
var start = list.length;
(function add(args) {
jQuery.each(args, function (_, arg) {
var type = jQuery.type(arg);
if (type === "function") {
if (!options.unique || !self.has(arg)) {
list.push(arg);
}
} else if (arg && arg.length && type !== "string") {
// Inspect recursively
add(arg);
}
});
})(arguments);
// Do we need to add the callbacks to the
// current firing batch?
if (firing) {
firingLength = list.length;
// With memory, if we're not firing then
// we should call right away
} else if (memory) {
firingStart = start;
fire(memory);
}
}
return this;
},
// Remove a callback from the list
remove: function () {
if (list) {
jQuery.each(arguments, function (_, arg) {
var index;
while (( index = jQuery.inArray(arg, list, index) ) > -1) {
list.splice(index, 1);
// Handle firing indexes
if (firing) {
if (index <= firingLength) {
firingLength--;
}
if (index <= firingIndex) {
firingIndex--;
}
}
}
});
}
return this;
},
// Check if a given callback is in the list.
// If no argument is given, return whether or not list has callbacks attached.
has: function (fn) {
return fn ? jQuery.inArray(fn, list) > -1 : !!( list && list.length );
},
// Remove all callbacks from the list
empty: function () {
list = [];
firingLength = 0;
return this;
},
// Have the list do nothing anymore
disable: function () {
list = stack = memory = undefined;
return this;
},
// Is it disabled?
disabled: function () {
return !list;
},
// Lock the list in its current state
lock: function () {
stack = undefined;
if (!memory) {
self.disable();
}
return this;
},
// Is it locked?
locked: function () {
return !stack;
},
// Call all callbacks with the given context and arguments
fireWith: function (context, args) {
if (list && ( !fired || stack )) {
args = args || [];
args = [context, args.slice ? args.slice() : args];
if (firing) {
stack.push(args);
} else {
fire(args);
}
}
return this;
},
// Call all the callbacks with the given arguments
fire: function () {
self.fireWith(this, arguments);
return this;
},
// To know if the callbacks have already been called at least once
fired: function () {
return !!fired;
}
};
return self;
};
jQuery.extend({
Deferred: function (func) {
var tuples = [
// action, add listener, listener list, final state
["resolve", "done", jQuery.Callbacks("once memory"), "resolved"],
["reject", "fail", jQuery.Callbacks("once memory"), "rejected"],
["notify", "progress", jQuery.Callbacks("memory")]
],
state = "pending",
promise = {
state: function () {
return state;
},
always: function () {
deferred.done(arguments).fail(arguments);
return this;
},
then: function (/* fnDone, fnFail, fnProgress */) {
var fns = arguments;
return jQuery.Deferred(function (newDefer) {
jQuery.each(tuples, function (i, tuple) {
var fn = jQuery.isFunction(fns[i]) && fns[i];
// deferred[ done | fail | progress ] for forwarding actions to newDefer
deferred[tuple[1]](function () {
var returned = fn && fn.apply(this, arguments);
if (returned && jQuery.isFunction(returned.promise)) {
returned.promise()
.done(newDefer.resolve)
.fail(newDefer.reject)
.progress(newDefer.notify);
} else {
newDefer[tuple[0] + "With"](this === promise ? newDefer.promise() : this, fn ? [returned] : arguments);
}
});
});
fns = null;
}).promise();
},
// Get a promise for this deferred
// If obj is provided, the promise aspect is added to the object
promise: function (obj) {
return obj != null ? jQuery.extend(obj, promise) : promise;
}
},
deferred = {};
// Keep pipe for back-compat
promise.pipe = promise.then;
// Add list-specific methods
jQuery.each(tuples, function (i, tuple) {
var list = tuple[2],
stateString = tuple[3];
// promise[ done | fail | progress ] = list.add
promise[tuple[1]] = list.add;
// Handle state
if (stateString) {
list.add(function () {
// state = [ resolved | rejected ]
state = stateString;
// [ reject_list | resolve_list ].disable; progress_list.lock
}, tuples[i ^ 1][2].disable, tuples[2][2].lock);
}
// deferred[ resolve | reject | notify ]
deferred[tuple[0]] = function () {
deferred[tuple[0] + "With"](this === deferred ? promise : this, arguments);
return this;
};
deferred[tuple[0] + "With"] = list.fireWith;
});
// Make the deferred a promise
promise.promise(deferred);
// Call given func if any
if (func) {
func.call(deferred, deferred);
}
// All done!
return deferred;
},
// Deferred helper
when: function (subordinate /* , ..., subordinateN */) {
var i = 0,
resolveValues = slice.call(arguments),
length = resolveValues.length,
// the count of uncompleted subordinates
remaining = length !== 1 || ( subordinate && jQuery.isFunction(subordinate.promise) ) ? length : 0,
// the master Deferred. If resolveValues consist of only a single Deferred, just use that.
deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
// Update function for both resolve and progress values
updateFunc = function (i, contexts, values) {
return function (value) {
contexts[i] = this;
values[i] = arguments.length > 1 ? slice.call(arguments) : value;
if (values === progressValues) {
deferred.notifyWith(contexts, values);
} else if (!( --remaining )) {
deferred.resolveWith(contexts, values);
}
};
},
progressValues, progressContexts, resolveContexts;
// add listeners to Deferred subordinates; treat others as resolved
if (length > 1) {
progressValues = new Array(length);
progressContexts = new Array(length);
resolveContexts = new Array(length);
for (; i < length; i++) {
if (resolveValues[i] && jQuery.isFunction(resolveValues[i].promise)) {
resolveValues[i].promise()
.done(updateFunc(i, resolveContexts, resolveValues))
.fail(deferred.reject)
.progress(updateFunc(i, progressContexts, progressValues));
} else {
--remaining;
}
}
}
// if we're not waiting on anything, resolve the master
if (!remaining) {
deferred.resolveWith(resolveContexts, resolveValues);
}
return deferred.promise();
}
});
// The deferred used on DOM ready
var readyList;
jQuery.fn.ready = function (fn) {
// Add the callback
jQuery.ready.promise().done(fn);
return this;
};
jQuery.extend({
// Is the DOM ready to be used? Set to true once it occurs.
isReady: false,
// A counter to track how many items to wait for before
// the ready event fires. See #6781
readyWait: 1,
// Hold (or release) the ready event
holdReady: function (hold) {
if (hold) {
jQuery.readyWait++;
} else {
jQuery.ready(true);
}
},
// Handle when the DOM is ready
ready: function (wait) {
// Abort if there are pending holds or we're already ready
if (wait === true ? --jQuery.readyWait : jQuery.isReady) {
return;
}
// Remember that the DOM is ready
jQuery.isReady = true;
// If a normal DOM Ready event fired, decrement, and wait if need be
if (wait !== true && --jQuery.readyWait > 0) {
return;
}
// If there are functions bound, to execute
readyList.resolveWith(document, [jQuery]);
// Trigger any bound ready events
if (jQuery.fn.triggerHandler) {
jQuery(document).triggerHandler("ready");
jQuery(document).off("ready");
}
}
});
/**
* The ready event handler and self cleanup method
*/
function completed() {
document.removeEventListener("DOMContentLoaded", completed, false);
window.removeEventListener("load", completed, false);
jQuery.ready();
}
jQuery.ready.promise = function (obj) {
if (!readyList) {
readyList = jQuery.Deferred();
// Catch cases where $(document).ready() is called after the browser event has already occurred.
// we once tried to use readyState "interactive" here, but it caused issues like the one
// discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
if (document.readyState === "complete") {
// Handle it asynchronously to allow scripts the opportunity to delay ready
setTimeout(jQuery.ready);
} else {
// Use the handy event callback
document.addEventListener("DOMContentLoaded", completed, false);
// A fallback to window.onload, that will always work
window.addEventListener("load", completed, false);
}
}
return readyList.promise(obj);
};
// Kick off the DOM ready check even if the user does not
jQuery.ready.promise();
// Multifunctional method to get and set values of a collection
// The value/s can optionally be executed if it's a function
var access = jQuery.access = function (elems, fn, key, value, chainable, emptyGet, raw) {
var i = 0,
len = elems.length,
bulk = key == null;
// Sets many values
if (jQuery.type(key) === "object") {
chainable = true;
for (i in key) {
jQuery.access(elems, fn, i, key[i], true, emptyGet, raw);
}
// Sets one value
} else if (value !== undefined) {
chainable = true;
if (!jQuery.isFunction(value)) {
raw = true;
}
if (bulk) {
// Bulk operations run against the entire set
if (raw) {
fn.call(elems, value);
fn = null;
// ...except when executing function values
} else {
bulk = fn;
fn = function (elem, key, value) {
return bulk.call(jQuery(elem), value);
};
}
}
if (fn) {
for (; i < len; i++) {
fn(elems[i], key, raw ? value : value.call(elems[i], i, fn(elems[i], key)));
}
}
}
return chainable ?
elems :
// Gets
bulk ?
fn.call(elems) :
len ? fn(elems[0], key) : emptyGet;
};
/**
* Determines whether an object can have data
*/
jQuery.acceptData = function (owner) {
// Accepts only:
// - Node
// - Node.ELEMENT_NODE
// - Node.DOCUMENT_NODE
// - Object
// - Any
/* jshint -W018 */
return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
};
function Data() {
// Support: Android < 4,
// Old WebKit does not have Object.preventExtensions/freeze method,
// return new empty object instead with no [[set]] accessor
Object.defineProperty(this.cache = {}, 0, {
get: function () {
return {};
}
});
this.expando = jQuery.expando + Math.random();
}
Data.uid = 1;
Data.accepts = jQuery.acceptData;
Data.prototype = {
key: function (owner) {
// We can accept data for non-element nodes in modern browsers,
// but we should not, see #8335.
// Always return the key for a frozen object.
if (!Data.accepts(owner)) {
return 0;
}
var descriptor = {},
// Check if the owner object already has a cache key
unlock = owner[this.expando];
// If not, create one
if (!unlock) {
unlock = Data.uid++;
// Secure it in a non-enumerable, non-writable property
try {
descriptor[this.expando] = {value: unlock};
Object.defineProperties(owner, descriptor);
// Support: Android < 4
// Fallback to a less secure definition
} catch (e) {
descriptor[this.expando] = unlock;
jQuery.extend(owner, descriptor);
}
}
// Ensure the cache object
if (!this.cache[unlock]) {
this.cache[unlock] = {};
}
return unlock;
},
set: function (owner, data, value) {
var prop,
// There may be an unlock assigned to this node,
// if there is no entry for this "owner", create one inline
// and set the unlock as though an owner entry had always existed
unlock = this.key(owner),
cache = this.cache[unlock];
// Handle: [ owner, key, value ] args
if (typeof data === "string") {
cache[data] = value;
// Handle: [ owner, { properties } ] args
} else {
// Fresh assignments by object are shallow copied
if (jQuery.isEmptyObject(cache)) {
jQuery.extend(this.cache[unlock], data);
// Otherwise, copy the properties one-by-one to the cache object
} else {
for (prop in data) {
cache[prop] = data[prop];
}
}
}
return cache;
},
get: function (owner, key) {
// Either a valid cache is found, or will be created.
// New caches will be created and the unlock returned,
// allowing direct access to the newly created
// empty data object. A valid owner object must be provided.
var cache = this.cache[this.key(owner)];
return key === undefined ?
cache : cache[key];
},
access: function (owner, key, value) {
var stored;
// In cases where either:
//
// 1. No key was specified
// 2. A string key was specified, but no value provided
//
// Take the "read" path and allow the get method to determine
// which value to return, respectively either:
//
// 1. The entire cache object
// 2. The data stored at the key
//
if (key === undefined ||
((key && typeof key === "string") && value === undefined)) {
stored = this.get(owner, key);
return stored !== undefined ?
stored : this.get(owner, jQuery.camelCase(key));
}
// [*]When the key is not a string, or both a key and value
// are specified, set or extend (existing objects) with either:
//
// 1. An object of properties
// 2. A key and value
//
this.set(owner, key, value);
// Since the "set" path can have two possible entry points
// return the expected data based on which path was taken[*]
return value !== undefined ? value : key;
},
remove: function (owner, key) {
var i, name, camel,
unlock = this.key(owner),
cache = this.cache[unlock];
if (key === undefined) {
this.cache[unlock] = {};
} else {
// Support array or space separated string of keys
if (jQuery.isArray(key)) {
// If "name" is an array of keys...
// When data is initially created, via ("key", "val") signature,
// keys will be converted to camelCase.
// Since there is no way to tell _how_ a key was added, remove
// both plain key and camelCase key. #12786
// This will only penalize the array argument path.
name = key.concat(key.map(jQuery.camelCase));
} else {
camel = jQuery.camelCase(key);
// Try the string as a key before any manipulation
if (key in cache) {
name = [key, camel];
} else {
// If a key with the spaces exists, use it.
// Otherwise, create an array by matching non-whitespace
name = camel;
name = name in cache ?
[name] : ( name.match(rnotwhite) || [] );
}
}
i = name.length;
while (i--) {
delete cache[name[i]];
}
}
},
hasData: function (owner) {
return !jQuery.isEmptyObject(
this.cache[owner[this.expando]] || {}
);
},
discard: function (owner) {
if (owner[this.expando]) {
delete this.cache[owner[this.expando]];
}
}
};
var data_priv = new Data();
var data_user = new Data();
/*
Implementation Summary
1. Enforce API surface and semantic compatibility with 1.9.x branch
2. Improve the module's maintainability by reducing the storage
paths to a single mechanism.
3. Use the same single mechanism to support "private" and "user" data.
4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
5. Avoid exposing implementation details on user objects (eg. expando properties)
6. Provide a clear path for implementation upgrade to WeakMap in 2014
*/
var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
rmultiDash = /([A-Z])/g;
function dataAttr(elem, key, data) {
var name;
// If nothing was found internally, try to fetch any
// data from the HTML5 data-* attribute
if (data === undefined && elem.nodeType === 1) {
name = "data-" + key.replace(rmultiDash, "-$1").toLowerCase();
data = elem.getAttribute(name);
if (typeof data === "string") {
try {
data = data === "true" ? true :
data === "false" ? false :
data === "null" ? null :
// Only convert to a number if it doesn't change the string
+data + "" === data ? +data :
rbrace.test(data) ? jQuery.parseJSON(data) :
data;
} catch (e) {
}
// Make sure we set the data so it isn't changed later
data_user.set(elem, key, data);
} else {
data = undefined;
}
}
return data;
}
jQuery.extend({
hasData: function (elem) {
return data_user.hasData(elem) || data_priv.hasData(elem);
},
data: function (elem, name, data) {
return data_user.access(elem, name, data);
},
removeData: function (elem, name) {
data_user.remove(elem, name);
},
// TODO: Now that all calls to _data and _removeData have been replaced
// with direct calls to data_priv methods, these can be deprecated.
_data: function (elem, name, data) {
return data_priv.access(elem, name, data);
},
_removeData: function (elem, name) {
data_priv.remove(elem, name);
}
});
jQuery.fn.extend({
data: function (key, value) {
var i, name, data,
elem = this[0],
attrs = elem && elem.attributes;
// Gets all values
if (key === undefined) {
if (this.length) {
data = data_user.get(elem);
if (elem.nodeType === 1 && !data_priv.get(elem, "hasDataAttrs")) {
i = attrs.length;
while (i--) {
// Support: IE11+
// The attrs elements can be null (#14894)
if (attrs[i]) {
name = attrs[i].name;
if (name.indexOf("data-") === 0) {
name = jQuery.camelCase(name.slice(5));
dataAttr(elem, name, data[name]);
}
}
}
data_priv.set(elem, "hasDataAttrs", true);
}
}
return data;
}
// Sets multiple values
if (typeof key === "object") {
return this.each(function () {
data_user.set(this, key);
});
}
return access(this, function (value) {
var data,
camelKey = jQuery.camelCase(key);
// The calling jQuery object (element matches) is not empty
// (and therefore has an element appears at this[ 0 ]) and the
// `value` parameter was not undefined. An empty jQuery object
// will result in `undefined` for elem = this[ 0 ] which will
// throw an exception if an attempt to read a data cache is made.
if (elem && value === undefined) {
// Attempt to get data from the cache
// with the key as-is
data = data_user.get(elem, key);
if (data !== undefined) {
return data;
}
// Attempt to get data from the cache
// with the key camelized
data = data_user.get(elem, camelKey);
if (data !== undefined) {
return data;
}
// Attempt to "discover" the data in
// HTML5 custom data-* attrs
data = dataAttr(elem, camelKey, undefined);
if (data !== undefined) {
return data;
}
// We tried really hard, but the data doesn't exist.
return;
}
// Set the data...
this.each(function () {
// First, attempt to store a copy or reference of any
// data that might've been store with a camelCased key.
var data = data_user.get(this, camelKey);
// For HTML5 data-* attribute interop, we have to
// store property names with dashes in a camelCase form.
// This might not apply to all properties...*
data_user.set(this, camelKey, value);
// *... In the case of properties that might _actually_
// have dashes, we need to also store a copy of that
// unchanged property.
if (key.indexOf("-") !== -1 && data !== undefined) {
data_user.set(this, key, value);
}
});
}, null, value, arguments.length > 1, null, true);
},
removeData: function (key) {
return this.each(function () {
data_user.remove(this, key);
});
}
});
jQuery.extend({
queue: function (elem, type, data) {
var queue;
if (elem) {
type = ( type || "fx" ) + "queue";
queue = data_priv.get(elem, type);
// Speed up dequeue by getting out quickly if this is just a lookup
if (data) {
if (!queue || jQuery.isArray(data)) {
queue = data_priv.access(elem, type, jQuery.makeArray(data));
} else {
queue.push(data);
}
}
return queue || [];
}
},
dequeue: function (elem, type) {
type = type || "fx";
var queue = jQuery.queue(elem, type),
startLength = queue.length,
fn = queue.shift(),
hooks = jQuery._queueHooks(elem, type),
next = function () {
jQuery.dequeue(elem, type);
};
// If the fx queue is dequeued, always remove the progress sentinel
if (fn === "inprogress") {
fn = queue.shift();
startLength--;
}
if (fn) {
// Add a progress sentinel to prevent the fx queue from being
// automatically dequeued
if (type === "fx") {
queue.unshift("inprogress");
}
// clear up the last queue stop function
delete hooks.stop;
fn.call(elem, next, hooks);
}
if (!startLength && hooks) {
hooks.empty.fire();
}
},
// not intended for public consumption - generates a queueHooks object, or returns the current one
_queueHooks: function (elem, type) {
var key = type + "queueHooks";
return data_priv.get(elem, key) || data_priv.access(elem, key, {
empty: jQuery.Callbacks("once memory").add(function () {
data_priv.remove(elem, [type + "queue", key]);
})
});
}
});
jQuery.fn.extend({
queue: function (type, data) {
var setter = 2;
if (typeof type !== "string") {
data = type;
type = "fx";
setter--;
}
if (arguments.length < setter) {
return jQuery.queue(this[0], type);
}
return data === undefined ?
this :
this.each(function () {
var queue = jQuery.queue(this, type, data);
// ensure a hooks for this queue
jQuery._queueHooks(this, type);
if (type === "fx" && queue[0] !== "inprogress") {
jQuery.dequeue(this, type);
}
});
},
dequeue: function (type) {
return this.each(function () {
jQuery.dequeue(this, type);
});
},
clearQueue: function (type) {
return this.queue(type || "fx", []);
},
// Get a promise resolved when queues of a certain type
// are emptied (fx is the type by default)
promise: function (type, obj) {
var tmp,
count = 1,
defer = jQuery.Deferred(),
elements = this,
i = this.length,
resolve = function () {
if (!( --count )) {
defer.resolveWith(elements, [elements]);
}
};
if (typeof type !== "string") {
obj = type;
type = undefined;
}
type = type || "fx";
while (i--) {
tmp = data_priv.get(elements[i], type + "queueHooks");
if (tmp && tmp.empty) {
count++;
tmp.empty.add(resolve);
}
}
resolve();
return defer.promise(obj);
}
});
var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source;
var cssExpand = ["Top", "Right", "Bottom", "Left"];
var isHidden = function (elem, el) {
// isHidden might be called from jQuery#filter function;
// in that case, element will be second argument
elem = el || elem;
return jQuery.css(elem, "display") === "none" || !jQuery.contains(elem.ownerDocument, elem);
};
var rcheckableType = (/^(?:checkbox|radio)$/i);
(function () {
var fragment = document.createDocumentFragment(),
div = fragment.appendChild(document.createElement("div")),
input = document.createElement("input");
// #11217 - WebKit loses check when the name is after the checked attribute
// Support: Windows Web Apps (WWA)
// `name` and `type` need .setAttribute for WWA
input.setAttribute("type", "radio");
input.setAttribute("checked", "checked");
input.setAttribute("name", "t");
div.appendChild(input);
// Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3
// old WebKit doesn't clone checked state correctly in fragments
support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked;
// Make sure textarea (and checkbox) defaultValue is properly cloned
// Support: IE9-IE11+
div.innerHTML = "<textarea>x</textarea>";
support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue;
})();
var strundefined = typeof undefined;
support.focusinBubbles = "onfocusin" in window;
var
rkeyEvent = /^key/,
rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/,
rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
function returnTrue() {
return true;
}
function returnFalse() {
return false;
}
function safeActiveElement() {
try {
return document.activeElement;
} catch (err) {
}
}
/*
* Helper functions for managing events -- not part of the public interface.
* Props to Dean Edwards' addEvent library for many of the ideas.
*/
jQuery.event = {
global: {},
add: function (elem, types, handler, data, selector) {
var handleObjIn, eventHandle, tmp,
events, t, handleObj,
special, handlers, type, namespaces, origType,
elemData = data_priv.get(elem);
// Don't attach events to noData or text/comment nodes (but allow plain objects)
if (!elemData) {
return;
}
// Caller can pass in an object of custom data in lieu of the handler
if (handler.handler) {
handleObjIn = handler;
handler = handleObjIn.handler;
selector = handleObjIn.selector;
}
// Make sure that the handler has a unique ID, used to find/remove it later
if (!handler.guid) {
handler.guid = jQuery.guid++;
}
// Init the element's event structure and main handler, if this is the first
if (!(events = elemData.events)) {
events = elemData.events = {};
}
if (!(eventHandle = elemData.handle)) {
eventHandle = elemData.handle = function (e) {
// Discard the second event of a jQuery.event.trigger() and
// when an event is called after a page has unloaded
return typeof jQuery !== strundefined && jQuery.event.triggered !== e.type ?
jQuery.event.dispatch.apply(elem, arguments) : undefined;
};
}
// Handle multiple events separated by a space
types = ( types || "" ).match(rnotwhite) || [""];
t = types.length;
while (t--) {
tmp = rtypenamespace.exec(types[t]) || [];
type = origType = tmp[1];
namespaces = ( tmp[2] || "" ).split(".").sort();
// There *must* be a type, no attaching namespace-only handlers
if (!type) {
continue;
}
// If event changes its type, use the special event handlers for the changed type
special = jQuery.event.special[type] || {};
// If selector defined, determine special event api type, otherwise given type
type = ( selector ? special.delegateType : special.bindType ) || type;
// Update special based on newly reset type
special = jQuery.event.special[type] || {};
// handleObj is passed to all event handlers
handleObj = jQuery.extend({
type: type,
origType: origType,
data: data,
handler: handler,
guid: handler.guid,
selector: selector,
needsContext: selector && jQuery.expr.match.needsContext.test(selector),
namespace: namespaces.join(".")
}, handleObjIn);
// Init the event handler queue if we're the first
if (!(handlers = events[type])) {
handlers = events[type] = [];
handlers.delegateCount = 0;
// Only use addEventListener if the special events handler returns false
if (!special.setup || special.setup.call(elem, data, namespaces, eventHandle) === false) {
if (elem.addEventListener) {
elem.addEventListener(type, eventHandle, false);
}
}
}
if (special.add) {
special.add.call(elem, handleObj);
if (!handleObj.handler.guid) {
handleObj.handler.guid = handler.guid;
}
}
// Add to the element's handler list, delegates in front
if (selector) {
handlers.splice(handlers.delegateCount++, 0, handleObj);
} else {
handlers.push(handleObj);
}
// Keep track of which events have ever been used, for event optimization
jQuery.event.global[type] = true;
}
},
// Detach an event or set of events from an element
remove: function (elem, types, handler, selector, mappedTypes) {
var j, origCount, tmp,
events, t, handleObj,
special, handlers, type, namespaces, origType,
elemData = data_priv.hasData(elem) && data_priv.get(elem);
if (!elemData || !(events = elemData.events)) {
return;
}
// Once for each type.namespace in types; type may be omitted
types = ( types || "" ).match(rnotwhite) || [""];
t = types.length;
while (t--) {
tmp = rtypenamespace.exec(types[t]) || [];
type = origType = tmp[1];
namespaces = ( tmp[2] || "" ).split(".").sort();
// Unbind all events (on this namespace, if provided) for the element
if (!type) {
for (type in events) {
jQuery.event.remove(elem, type + types[t], handler, selector, true);
}
continue;
}
special = jQuery.event.special[type] || {};
type = ( selector ? special.delegateType : special.bindType ) || type;
handlers = events[type] || [];
tmp = tmp[2] && new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)");
// Remove matching events
origCount = j = handlers.length;
while (j--) {
handleObj = handlers[j];
if (( mappedTypes || origType === handleObj.origType ) &&
( !handler || handler.guid === handleObj.guid ) &&
( !tmp || tmp.test(handleObj.namespace) ) &&
( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector )) {
handlers.splice(j, 1);
if (handleObj.selector) {
handlers.delegateCount--;
}
if (special.remove) {
special.remove.call(elem, handleObj);
}
}
}
// Remove generic event handler if we removed something and no more handlers exist
// (avoids potential for endless recursion during removal of special event handlers)
if (origCount && !handlers.length) {
if (!special.teardown || special.teardown.call(elem, namespaces, elemData.handle) === false) {
jQuery.removeEvent(elem, type, elemData.handle);
}
delete events[type];
}
}
// Remove the expando if it's no longer used
if (jQuery.isEmptyObject(events)) {
delete elemData.handle;
data_priv.remove(elem, "events");
}
},
trigger: function (event, data, elem, onlyHandlers) {
var i, cur, tmp, bubbleType, ontype, handle, special,
eventPath = [elem || document],
type = hasOwn.call(event, "type") ? event.type : event,
namespaces = hasOwn.call(event, "namespace") ? event.namespace.split(".") : [];
cur = tmp = elem = elem || document;
// Don't do events on text and comment nodes
if (elem.nodeType === 3 || elem.nodeType === 8) {
return;
}
// focus/blur morphs to focusin/out; ensure we're not firing them right now
if (rfocusMorph.test(type + jQuery.event.triggered)) {
return;
}
if (type.indexOf(".") >= 0) {
// Namespaced trigger; create a regexp to match event type in handle()
namespaces = type.split(".");
type = namespaces.shift();
namespaces.sort();
}
ontype = type.indexOf(":") < 0 && "on" + type;
// Caller can pass in a jQuery.Event object, Object, or just an event type string
event = event[jQuery.expando] ?
event :
new jQuery.Event(type, typeof event === "object" && event);
// Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
event.isTrigger = onlyHandlers ? 2 : 3;
event.namespace = namespaces.join(".");
event.namespace_re = event.namespace ?
new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") :
null;
// Clean up the event in case it is being reused
event.result = undefined;
if (!event.target) {
event.target = elem;
}
// Clone any incoming data and prepend the event, creating the handler arg list
data = data == null ?
[event] :
jQuery.makeArray(data, [event]);
// Allow special events to draw outside the lines
special = jQuery.event.special[type] || {};
if (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) {
return;
}
// Determine event propagation path in advance, per W3C events spec (#9951)
// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
if (!onlyHandlers && !special.noBubble && !jQuery.isWindow(elem)) {
bubbleType = special.delegateType || type;
if (!rfocusMorph.test(bubbleType + type)) {
cur = cur.parentNode;
}
for (; cur; cur = cur.parentNode) {
eventPath.push(cur);
tmp = cur;
}
// Only add window if we got to document (e.g., not plain obj or detached DOM)
if (tmp === (elem.ownerDocument || document)) {
eventPath.push(tmp.defaultView || tmp.parentWindow || window);
}
}
// Fire handlers on the event path
i = 0;
while ((cur = eventPath[i++]) && !event.isPropagationStopped()) {
event.type = i > 1 ?
bubbleType :
special.bindType || type;
// jQuery handler
handle = ( data_priv.get(cur, "events") || {} )[event.type] && data_priv.get(cur, "handle");
if (handle) {
handle.apply(cur, data);
}
// Native handler
handle = ontype && cur[ontype];
if (handle && handle.apply && jQuery.acceptData(cur)) {
event.result = handle.apply(cur, data);
if (event.result === false) {
event.preventDefault();
}
}
}
event.type = type;
// If nobody prevented the default action, do it now
if (!onlyHandlers && !event.isDefaultPrevented()) {
if ((!special._default || special._default.apply(eventPath.pop(), data) === false) &&
jQuery.acceptData(elem)) {
// Call a native DOM method on the target with the same name name as the event.
// Don't do default actions on window, that's where global variables be (#6170)
if (ontype && jQuery.isFunction(elem[type]) && !jQuery.isWindow(elem)) {
// Don't re-trigger an onFOO event when we call its FOO() method
tmp = elem[ontype];
if (tmp) {
elem[ontype] = null;
}
// Prevent re-triggering of the same event, since we already bubbled it above
jQuery.event.triggered = type;
elem[type]();
jQuery.event.triggered = undefined;
if (tmp) {
elem[ontype] = tmp;
}
}
}
}
return event.result;
},
dispatch: function (event) {
// Make a writable jQuery.Event from the native event object
event = jQuery.event.fix(event);
var i, j, ret, matched, handleObj,
handlerQueue = [],
args = slice.call(arguments),
handlers = ( data_priv.get(this, "events") || {} )[event.type] || [],
special = jQuery.event.special[event.type] || {};
// Use the fix-ed jQuery.Event rather than the (read-only) native event
args[0] = event;
event.delegateTarget = this;
// Call the preDispatch hook for the mapped type, and let it bail if desired
if (special.preDispatch && special.preDispatch.call(this, event) === false) {
return;
}
// Determine handlers
handlerQueue = jQuery.event.handlers.call(this, event, handlers);
// Run delegates first; they may want to stop propagation beneath us
i = 0;
while ((matched = handlerQueue[i++]) && !event.isPropagationStopped()) {
event.currentTarget = matched.elem;
j = 0;
while ((handleObj = matched.handlers[j++]) && !event.isImmediatePropagationStopped()) {
// Triggered event must either 1) have no namespace, or
// 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
if (!event.namespace_re || event.namespace_re.test(handleObj.namespace)) {
event.handleObj = handleObj;
event.data = handleObj.data;
ret = ( (jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler )
.apply(matched.elem, args);
if (ret !== undefined) {
if ((event.result = ret) === false) {
event.preventDefault();
event.stopPropagation();
}
}
}
}
}
// Call the postDispatch hook for the mapped type
if (special.postDispatch) {
special.postDispatch.call(this, event);
}
return event.result;
},
handlers: function (event, handlers) {
var i, matches, sel, handleObj,
handlerQueue = [],
delegateCount = handlers.delegateCount,
cur = event.target;
// Find delegate handlers
// Black-hole SVG <use> instance trees (#13180)
// Avoid non-left-click bubbling in Firefox (#3861)
if (delegateCount && cur.nodeType && (!event.button || event.type !== "click")) {
for (; cur !== this; cur = cur.parentNode || this) {
// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
if (cur.disabled !== true || event.type !== "click") {
matches = [];
for (i = 0; i < delegateCount; i++) {
handleObj = handlers[i];
// Don't conflict with Object.prototype properties (#13203)
sel = handleObj.selector + " ";
if (matches[sel] === undefined) {
matches[sel] = handleObj.needsContext ?
jQuery(sel, this).index(cur) >= 0 :
jQuery.find(sel, this, null, [cur]).length;
}
if (matches[sel]) {
matches.push(handleObj);
}
}
if (matches.length) {
handlerQueue.push({elem: cur, handlers: matches});
}
}
}
}
// Add the remaining (directly-bound) handlers
if (delegateCount < handlers.length) {
handlerQueue.push({elem: this, handlers: handlers.slice(delegateCount)});
}
return handlerQueue;
},
// Includes some event props shared by KeyEvent and MouseEvent
props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
fixHooks: {},
keyHooks: {
props: "char charCode key keyCode".split(" "),
filter: function (event, original) {
// Add which for key events
if (event.which == null) {
event.which = original.charCode != null ? original.charCode : original.keyCode;
}
return event;
}
},
mouseHooks: {
props: "button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
filter: function (event, original) {
var eventDoc, doc, body,
button = original.button;
// Calculate pageX/Y if missing and clientX/Y available
if (event.pageX == null && original.clientX != null) {
eventDoc = event.target.ownerDocument || document;
doc = eventDoc.documentElement;
body = eventDoc.body;
event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
}
// Add which for click: 1 === left; 2 === middle; 3 === right
// Note: button is not normalized, so don't use it
if (!event.which && button !== undefined) {
event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
}
return event;
}
},
fix: function (event) {
if (event[jQuery.expando]) {
return event;
}
// Create a writable copy of the event object and normalize some properties
var i, prop, copy,
type = event.type,
originalEvent = event,
fixHook = this.fixHooks[type];
if (!fixHook) {
this.fixHooks[type] = fixHook =
rmouseEvent.test(type) ? this.mouseHooks :
rkeyEvent.test(type) ? this.keyHooks :
{};
}
copy = fixHook.props ? this.props.concat(fixHook.props) : this.props;
event = new jQuery.Event(originalEvent);
i = copy.length;
while (i--) {
prop = copy[i];
event[prop] = originalEvent[prop];
}
// Support: Cordova 2.5 (WebKit) (#13255)
// All events should have a target; Cordova deviceready doesn't
if (!event.target) {
event.target = document;
}
// Support: Safari 6.0+, Chrome < 28
// Target should not be a text node (#504, #13143)
if (event.target.nodeType === 3) {
event.target = event.target.parentNode;
}
return fixHook.filter ? fixHook.filter(event, originalEvent) : event;
},
special: {
load: {
// Prevent triggered image.load events from bubbling to window.load
noBubble: true
},
focus: {
// Fire native event if possible so blur/focus sequence is correct
trigger: function () {
if (this !== safeActiveElement() && this.focus) {
this.focus();
return false;
}
},
delegateType: "focusin"
},
blur: {
trigger: function () {
if (this === safeActiveElement() && this.blur) {
this.blur();
return false;
}
},
delegateType: "focusout"
},
click: {
// For checkbox, fire native event so checked state will be right
trigger: function () {
if (this.type === "checkbox" && this.click && jQuery.nodeName(this, "input")) {
this.click();
return false;
}
},
// For cross-browser consistency, don't fire native .click() on links
_default: function (event) {
return jQuery.nodeName(event.target, "a");
}
},
beforeunload: {
postDispatch: function (event) {
// Support: Firefox 20+
// Firefox doesn't alert if the returnValue field is not set.
if (event.result !== undefined && event.originalEvent) {
event.originalEvent.returnValue = event.result;
}
}
}
},
simulate: function (type, elem, event, bubble) {
// Piggyback on a donor event to simulate a different one.
// Fake originalEvent to avoid donor's stopPropagation, but if the
// simulated event prevents default then we do the same on the donor.
var e = jQuery.extend(
new jQuery.Event(),
event,
{
type: type,
isSimulated: true,
originalEvent: {}
}
);
if (bubble) {
jQuery.event.trigger(e, null, elem);
} else {
jQuery.event.dispatch.call(elem, e);
}
if (e.isDefaultPrevented()) {
event.preventDefault();
}
}
};
jQuery.removeEvent = function (elem, type, handle) {
if (elem.removeEventListener) {
elem.removeEventListener(type, handle, false);
}
};
jQuery.Event = function (src, props) {
// Allow instantiation without the 'new' keyword
if (!(this instanceof jQuery.Event)) {
return new jQuery.Event(src, props);
}
// Event object
if (src && src.type) {
this.originalEvent = src;
this.type = src.type;
// Events bubbling up the document may have been marked as prevented
// by a handler lower down the tree; reflect the correct value.
this.isDefaultPrevented = src.defaultPrevented ||
src.defaultPrevented === undefined &&
// Support: Android < 4.0
src.returnValue === false ?
returnTrue :
returnFalse;
// Event type
} else {
this.type = src;
}
// Put explicitly provided properties onto the event object
if (props) {
jQuery.extend(this, props);
}
// Create a timestamp if incoming event doesn't have one
this.timeStamp = src && src.timeStamp || jQuery.now();
// Mark it as fixed
this[jQuery.expando] = true;
};
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
jQuery.Event.prototype = {
isDefaultPrevented: returnFalse,
isPropagationStopped: returnFalse,
isImmediatePropagationStopped: returnFalse,
preventDefault: function () {
var e = this.originalEvent;
this.isDefaultPrevented = returnTrue;
if (e && e.preventDefault) {
e.preventDefault();
}
},
stopPropagation: function () {
var e = this.originalEvent;
this.isPropagationStopped = returnTrue;
if (e && e.stopPropagation) {
e.stopPropagation();
}
},
stopImmediatePropagation: function () {
var e = this.originalEvent;
this.isImmediatePropagationStopped = returnTrue;
if (e && e.stopImmediatePropagation) {
e.stopImmediatePropagation();
}
this.stopPropagation();
}
};
// Create mouseenter/leave events using mouseover/out and event-time checks
// Support: Chrome 15+
jQuery.each({
mouseenter: "mouseover",
mouseleave: "mouseout",
pointerenter: "pointerover",
pointerleave: "pointerout"
}, function (orig, fix) {
jQuery.event.special[orig] = {
delegateType: fix,
bindType: fix,
handle: function (event) {
var ret,
target = this,
related = event.relatedTarget,
handleObj = event.handleObj;
// For mousenter/leave call the handler if related is outside the target.
// NB: No relatedTarget if the mouse left/entered the browser window
if (!related || (related !== target && !jQuery.contains(target, related))) {
event.type = handleObj.origType;
ret = handleObj.handler.apply(this, arguments);
event.type = fix;
}
return ret;
}
};
});
// Create "bubbling" focus and blur events
// Support: Firefox, Chrome, Safari
if (!support.focusinBubbles) {
jQuery.each({focus: "focusin", blur: "focusout"}, function (orig, fix) {
// Attach a single capturing handler on the document while someone wants focusin/focusout
var handler = function (event) {
jQuery.event.simulate(fix, event.target, jQuery.event.fix(event), true);
};
jQuery.event.special[fix] = {
setup: function () {
var doc = this.ownerDocument || this,
attaches = data_priv.access(doc, fix);
if (!attaches) {
doc.addEventListener(orig, handler, true);
}
data_priv.access(doc, fix, ( attaches || 0 ) + 1);
},
teardown: function () {
var doc = this.ownerDocument || this,
attaches = data_priv.access(doc, fix) - 1;
if (!attaches) {
doc.removeEventListener(orig, handler, true);
data_priv.remove(doc, fix);
} else {
data_priv.access(doc, fix, attaches);
}
}
};
});
}
jQuery.fn.extend({
on: function (types, selector, data, fn, /*INTERNAL*/ one) {
var origFn, type;
// Types can be a map of types/handlers
if (typeof types === "object") {
// ( types-Object, selector, data )
if (typeof selector !== "string") {
// ( types-Object, data )
data = data || selector;
selector = undefined;
}
for (type in types) {
this.on(type, selector, data, types[type], one);
}
return this;
}
if (data == null && fn == null) {
// ( types, fn )
fn = selector;
data = selector = undefined;
} else if (fn == null) {
if (typeof selector === "string") {
// ( types, selector, fn )
fn = data;
data = undefined;
} else {
// ( types, data, fn )
fn = data;
data = selector;
selector = undefined;
}
}
if (fn === false) {
fn = returnFalse;
} else if (!fn) {
return this;
}
if (one === 1) {
origFn = fn;
fn = function (event) {
// Can use an empty set, since event contains the info
jQuery().off(event);
return origFn.apply(this, arguments);
};
// Use same guid so caller can remove using origFn
fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
}
return this.each(function () {
jQuery.event.add(this, types, fn, data, selector);
});
},
one: function (types, selector, data, fn) {
return this.on(types, selector, data, fn, 1);
},
off: function (types, selector, fn) {
var handleObj, type;
if (types && types.preventDefault && types.handleObj) {
// ( event ) dispatched jQuery.Event
handleObj = types.handleObj;
jQuery(types.delegateTarget).off(
handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
handleObj.selector,
handleObj.handler
);
return this;
}
if (typeof types === "object") {
// ( types-object [, selector] )
for (type in types) {
this.off(type, selector, types[type]);
}
return this;
}
if (selector === false || typeof selector === "function") {
// ( types [, fn] )
fn = selector;
selector = undefined;
}
if (fn === false) {
fn = returnFalse;
}
return this.each(function () {
jQuery.event.remove(this, types, fn, selector);
});
},
trigger: function (type, data) {
return this.each(function () {
jQuery.event.trigger(type, data, this);
});
},
triggerHandler: function (type, data) {
var elem = this[0];
if (elem) {
return jQuery.event.trigger(type, data, elem, true);
}
}
});
var
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
rtagName = /<([\w:]+)/,
rhtml = /<|&#?\w+;/,
rnoInnerhtml = /<(?:script|style|link)/i,
// checked="checked" or checked
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
rscriptType = /^$|\/(?:java|ecma)script/i,
rscriptTypeMasked = /^true\/(.*)/,
rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
// We have to close these tags to support XHTML (#13200)
wrapMap = {
// Support: IE 9
option: [1, "<select multiple='multiple'>", "</select>"],
thead: [1, "<table>", "</table>"],
col: [2, "<table><colgroup>", "</colgroup></table>"],
tr: [2, "<table><tbody>", "</tbody></table>"],
td: [3, "<table><tbody><tr>", "</tr></tbody></table>"],
_default: [0, "", ""]
};
// Support: IE 9
wrapMap.optgroup = wrapMap.option;
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
wrapMap.th = wrapMap.td;
// Support: 1.x compatibility
// Manipulating tables requires a tbody
function manipulationTarget(elem, content) {
return jQuery.nodeName(elem, "table") &&
jQuery.nodeName(content.nodeType !== 11 ? content : content.firstChild, "tr") ?
elem.getElementsByTagName("tbody")[0] ||
elem.appendChild(elem.ownerDocument.createElement("tbody")) :
elem;
}
// Replace/restore the type attribute of script elements for safe DOM manipulation
function disableScript(elem) {
elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type;
return elem;
}
function restoreScript(elem) {
var match = rscriptTypeMasked.exec(elem.type);
if (match) {
elem.type = match[1];
} else {
elem.removeAttribute("type");
}
return elem;
}
// Mark scripts as having already been evaluated
function setGlobalEval(elems, refElements) {
var i = 0,
l = elems.length;
for (; i < l; i++) {
data_priv.set(
elems[i], "globalEval", !refElements || data_priv.get(refElements[i], "globalEval")
);
}
}
function cloneCopyEvent(src, dest) {
var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
if (dest.nodeType !== 1) {
return;
}
// 1. Copy private data: events, handlers, etc.
if (data_priv.hasData(src)) {
pdataOld = data_priv.access(src);
pdataCur = data_priv.set(dest, pdataOld);
events = pdataOld.events;
if (events) {
delete pdataCur.handle;
pdataCur.events = {};
for (type in events) {
for (i = 0, l = events[type].length; i < l; i++) {
jQuery.event.add(dest, type, events[type][i]);
}
}
}
}
// 2. Copy user data
if (data_user.hasData(src)) {
udataOld = data_user.access(src);
udataCur = jQuery.extend({}, udataOld);
data_user.set(dest, udataCur);
}
}
function getAll(context, tag) {
var ret = context.getElementsByTagName ? context.getElementsByTagName(tag || "*") :
context.querySelectorAll ? context.querySelectorAll(tag || "*") :
[];
return tag === undefined || tag && jQuery.nodeName(context, tag) ?
jQuery.merge([context], ret) :
ret;
}
// Support: IE >= 9
function fixInput(src, dest) {
var nodeName = dest.nodeName.toLowerCase();
// Fails to persist the checked state of a cloned checkbox or radio button.
if (nodeName === "input" && rcheckableType.test(src.type)) {
dest.checked = src.checked;
// Fails to return the selected option to the default selected state when cloning options
} else if (nodeName === "input" || nodeName === "textarea") {
dest.defaultValue = src.defaultValue;
}
}
jQuery.extend({
clone: function (elem, dataAndEvents, deepDataAndEvents) {
var i, l, srcElements, destElements,
clone = elem.cloneNode(true),
inPage = jQuery.contains(elem.ownerDocument, elem);
// Support: IE >= 9
// Fix Cloning issues
if (!support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && !jQuery.isXMLDoc(elem)) {
// We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
destElements = getAll(clone);
srcElements = getAll(elem);
for (i = 0, l = srcElements.length; i < l; i++) {
fixInput(srcElements[i], destElements[i]);
}
}
// Copy the events from the original to the clone
if (dataAndEvents) {
if (deepDataAndEvents) {
srcElements = srcElements || getAll(elem);
destElements = destElements || getAll(clone);
for (i = 0, l = srcElements.length; i < l; i++) {
cloneCopyEvent(srcElements[i], destElements[i]);
}
} else {
cloneCopyEvent(elem, clone);
}
}
// Preserve script evaluation history
destElements = getAll(clone, "script");
if (destElements.length > 0) {
setGlobalEval(destElements, !inPage && getAll(elem, "script"));
}
// Return the cloned set
return clone;
},
buildFragment: function (elems, context, scripts, selection) {
var elem, tmp, tag, wrap, contains, j,
fragment = context.createDocumentFragment(),
nodes = [],
i = 0,
l = elems.length;
for (; i < l; i++) {
elem = elems[i];
if (elem || elem === 0) {
// Add nodes directly
if (jQuery.type(elem) === "object") {
// Support: QtWebKit
// jQuery.merge because push.apply(_, arraylike) throws
jQuery.merge(nodes, elem.nodeType ? [elem] : elem);
// Convert non-html into a text node
} else if (!rhtml.test(elem)) {
nodes.push(context.createTextNode(elem));
// Convert html into DOM nodes
} else {
tmp = tmp || fragment.appendChild(context.createElement("div"));
// Deserialize a standard representation
tag = ( rtagName.exec(elem) || ["", ""] )[1].toLowerCase();
wrap = wrapMap[tag] || wrapMap._default;
tmp.innerHTML = wrap[1] + elem.replace(rxhtmlTag, "<$1></$2>") + wrap[2];
// Descend through wrappers to the right content
j = wrap[0];
while (j--) {
tmp = tmp.lastChild;
}
// Support: QtWebKit
// jQuery.merge because push.apply(_, arraylike) throws
jQuery.merge(nodes, tmp.childNodes);
// Remember the top-level container
tmp = fragment.firstChild;
// Fixes #12346
// Support: Webkit, IE
tmp.textContent = "";
}
}
}
// Remove wrapper from fragment
fragment.textContent = "";
i = 0;
while ((elem = nodes[i++])) {
// #4087 - If origin and destination elements are the same, and this is
// that element, do not do anything
if (selection && jQuery.inArray(elem, selection) !== -1) {
continue;
}
contains = jQuery.contains(elem.ownerDocument, elem);
// Append to fragment
tmp = getAll(fragment.appendChild(elem), "script");
// Preserve script evaluation history
if (contains) {
setGlobalEval(tmp);
}
// Capture executables
if (scripts) {
j = 0;
while ((elem = tmp[j++])) {
if (rscriptType.test(elem.type || "")) {
scripts.push(elem);
}
}
}
}
return fragment;
},
cleanData: function (elems) {
var data, elem, type, key,
special = jQuery.event.special,
i = 0;
for (; (elem = elems[i]) !== undefined; i++) {
if (jQuery.acceptData(elem)) {
key = elem[data_priv.expando];
if (key && (data = data_priv.cache[key])) {
if (data.events) {
for (type in data.events) {
if (special[type]) {
jQuery.event.remove(elem, type);
// This is a shortcut to avoid jQuery.event.remove's overhead
} else {
jQuery.removeEvent(elem, type, data.handle);
}
}
}
if (data_priv.cache[key]) {
// Discard any remaining `private` data
delete data_priv.cache[key];
}
}
}
// Discard any remaining `user` data
delete data_user.cache[elem[data_user.expando]];
}
}
});
jQuery.fn.extend({
text: function (value) {
return access(this, function (value) {
return value === undefined ?
jQuery.text(this) :
this.empty().each(function () {
if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
this.textContent = value;
}
});
}, null, value, arguments.length);
},
append: function () {
return this.domManip(arguments, function (elem) {
if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
var target = manipulationTarget(this, elem);
target.appendChild(elem);
}
});
},
prepend: function () {
return this.domManip(arguments, function (elem) {
if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
var target = manipulationTarget(this, elem);
target.insertBefore(elem, target.firstChild);
}
});
},
before: function () {
return this.domManip(arguments, function (elem) {
if (this.parentNode) {
this.parentNode.insertBefore(elem, this);
}
});
},
after: function () {
return this.domManip(arguments, function (elem) {
if (this.parentNode) {
this.parentNode.insertBefore(elem, this.nextSibling);
}
});
},
remove: function (selector, keepData /* Internal Use Only */) {
var elem,
elems = selector ? jQuery.filter(selector, this) : this,
i = 0;
for (; (elem = elems[i]) != null; i++) {
if (!keepData && elem.nodeType === 1) {
jQuery.cleanData(getAll(elem));
}
if (elem.parentNode) {
if (keepData && jQuery.contains(elem.ownerDocument, elem)) {
setGlobalEval(getAll(elem, "script"));
}
elem.parentNode.removeChild(elem);
}
}
return this;
},
empty: function () {
var elem,
i = 0;
for (; (elem = this[i]) != null; i++) {
if (elem.nodeType === 1) {
// Prevent memory leaks
jQuery.cleanData(getAll(elem, false));
// Remove any remaining nodes
elem.textContent = "";
}
}
return this;
},
clone: function (dataAndEvents, deepDataAndEvents) {
dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
return this.map(function () {
return jQuery.clone(this, dataAndEvents, deepDataAndEvents);
});
},
html: function (value) {
return access(this, function (value) {
var elem = this[0] || {},
i = 0,
l = this.length;
if (value === undefined && elem.nodeType === 1) {
return elem.innerHTML;
}
// See if we can take a shortcut and just use innerHTML
if (typeof value === "string" && !rnoInnerhtml.test(value) && !wrapMap[( rtagName.exec(value) || ["", ""] )[1].toLowerCase()]) {
value = value.replace(rxhtmlTag, "<$1></$2>");
try {
for (; i < l; i++) {
elem = this[i] || {};
// Remove element nodes and prevent memory leaks
if (elem.nodeType === 1) {
jQuery.cleanData(getAll(elem, false));
elem.innerHTML = value;
}
}
elem = 0;
// If using innerHTML throws an exception, use the fallback method
} catch (e) {
}
}
if (elem) {
this.empty().append(value);
}
}, null, value, arguments.length);
},
replaceWith: function () {
var arg = arguments[0];
// Make the changes, replacing each context element with the new content
this.domManip(arguments, function (elem) {
arg = this.parentNode;
jQuery.cleanData(getAll(this));
if (arg) {
arg.replaceChild(elem, this);
}
});
// Force removal if there was no new content (e.g., from empty arguments)
return arg && (arg.length || arg.nodeType) ? this : this.remove();
},
detach: function (selector) {
return this.remove(selector, true);
},
domManip: function (args, callback) {
// Flatten any nested arrays
args = concat.apply([], args);
var fragment, first, scripts, hasScripts, node, doc,
i = 0,
l = this.length,
set = this,
iNoClone = l - 1,
value = args[0],
isFunction = jQuery.isFunction(value);
// We can't cloneNode fragments that contain checked, in WebKit
if (isFunction ||
( l > 1 && typeof value === "string" && !support.checkClone && rchecked.test(value) )) {
return this.each(function (index) {
var self = set.eq(index);
if (isFunction) {
args[0] = value.call(this, index, self.html());
}
self.domManip(args, callback);
});
}
if (l) {
fragment = jQuery.buildFragment(args, this[0].ownerDocument, false, this);
first = fragment.firstChild;
if (fragment.childNodes.length === 1) {
fragment = first;
}
if (first) {
scripts = jQuery.map(getAll(fragment, "script"), disableScript);
hasScripts = scripts.length;
// Use the original fragment for the last item instead of the first because it can end up
// being emptied incorrectly in certain situations (#8070).
for (; i < l; i++) {
node = fragment;
if (i !== iNoClone) {
node = jQuery.clone(node, true, true);
// Keep references to cloned scripts for later restoration
if (hasScripts) {
// Support: QtWebKit
// jQuery.merge because push.apply(_, arraylike) throws
jQuery.merge(scripts, getAll(node, "script"));
}
}
callback.call(this[i], node, i);
}
if (hasScripts) {
doc = scripts[scripts.length - 1].ownerDocument;
// Reenable scripts
jQuery.map(scripts, restoreScript);
// Evaluate executable scripts on first document insertion
for (i = 0; i < hasScripts; i++) {
node = scripts[i];
if (rscriptType.test(node.type || "") && !data_priv.access(node, "globalEval") && jQuery.contains(doc, node)) {
if (node.src) {
// Optional AJAX dependency, but won't run scripts if not present
if (jQuery._evalUrl) {
jQuery._evalUrl(node.src);
}
} else {
jQuery.globalEval(node.textContent.replace(rcleanScript, ""));
}
}
}
}
}
}
return this;
}
});
jQuery.each({
appendTo: "append",
prependTo: "prepend",
insertBefore: "before",
insertAfter: "after",
replaceAll: "replaceWith"
}, function (name, original) {
jQuery.fn[name] = function (selector) {
var elems,
ret = [],
insert = jQuery(selector),
last = insert.length - 1,
i = 0;
for (; i <= last; i++) {
elems = i === last ? this : this.clone(true);
jQuery(insert[i])[original](elems);
// Support: QtWebKit
// .get() because push.apply(_, arraylike) throws
push.apply(ret, elems.get());
}
return this.pushStack(ret);
};
});
var iframe,
elemdisplay = {};
/**
* Retrieve the actual display of a element
* @param {String} name nodeName of the element
* @param {Object} doc Document object
*/
// Called only from within defaultDisplay
function actualDisplay(name, doc) {
var style,
elem = jQuery(doc.createElement(name)).appendTo(doc.body),
// getDefaultComputedStyle might be reliably used only on attached element
display = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle(elem[0]) ) ?
// Use of this method is a temporary fix (more like optmization) until something better comes along,
// since it was removed from specification and supported only in FF
style.display : jQuery.css(elem[0], "display");
// We don't have any data stored on the element,
// so use "detach" method as fast way to get rid of the element
elem.detach();
return display;
}
/**
* Try to determine the default display value of an element
* @param {String} nodeName
*/
function defaultDisplay(nodeName) {
var doc = document,
display = elemdisplay[nodeName];
if (!display) {
display = actualDisplay(nodeName, doc);
// If the simple way fails, read from inside an iframe
if (display === "none" || !display) {
// Use the already-created iframe if possible
iframe = (iframe || jQuery("<iframe frameborder='0' width='0' height='0'/>")).appendTo(doc.documentElement);
// Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
doc = iframe[0].contentDocument;
// Support: IE
doc.write();
doc.close();
display = actualDisplay(nodeName, doc);
iframe.detach();
}
// Store the correct default display
elemdisplay[nodeName] = display;
}
return display;
}
var rmargin = (/^margin/);
var rnumnonpx = new RegExp("^(" + pnum + ")(?!px)[a-z%]+$", "i");
var getStyles = function (elem) {
return elem.ownerDocument.defaultView.getComputedStyle(elem, null);
};
function curCSS(elem, name, computed) {
var width, minWidth, maxWidth, ret,
style = elem.style;
computed = computed || getStyles(elem);
// Support: IE9
// getPropertyValue is only needed for .css('filter') in IE9, see #12537
if (computed) {
ret = computed.getPropertyValue(name) || computed[name];
}
if (computed) {
if (ret === "" && !jQuery.contains(elem.ownerDocument, elem)) {
ret = jQuery.style(elem, name);
}
// Support: iOS < 6
// A tribute to the "awesome hack by Dean Edwards"
// iOS < 6 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
// this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
if (rnumnonpx.test(ret) && rmargin.test(name)) {
// Remember the original values
width = style.width;
minWidth = style.minWidth;
maxWidth = style.maxWidth;
// Put in the new values to get a computed value out
style.minWidth = style.maxWidth = style.width = ret;
ret = computed.width;
// Revert the changed values
style.width = width;
style.minWidth = minWidth;
style.maxWidth = maxWidth;
}
}
return ret !== undefined ?
// Support: IE
// IE returns zIndex value as an integer.
ret + "" :
ret;
}
function addGetHookIf(conditionFn, hookFn) {
// Define the hook, we'll check on the first run if it's really needed.
return {
get: function () {
if (conditionFn()) {
// Hook not needed (or it's not possible to use it due to missing dependency),
// remove it.
// Since there are no other hooks for marginRight, remove the whole object.
delete this.get;
return;
}
// Hook needed; redefine it so that the support test is not executed again.
return (this.get = hookFn).apply(this, arguments);
}
};
}
(function () {
var pixelPositionVal, boxSizingReliableVal,
docElem = document.documentElement,
container = document.createElement("div"),
div = document.createElement("div");
if (!div.style) {
return;
}
div.style.backgroundClip = "content-box";
div.cloneNode(true).style.backgroundClip = "";
support.clearCloneStyle = div.style.backgroundClip === "content-box";
container.style.cssText = "border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;" +
"position:absolute";
container.appendChild(div);
// Executing both pixelPosition & boxSizingReliable tests require only one layout
// so they're executed at the same time to save the second computation.
function computePixelPositionAndBoxSizingReliable() {
div.style.cssText =
// Support: Firefox<29, Android 2.3
// Vendor-prefix box-sizing
"-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" +
"box-sizing:border-box;display:block;margin-top:1%;top:1%;" +
"border:1px;padding:1px;width:4px;position:absolute";
div.innerHTML = "";
docElem.appendChild(container);
var divStyle = window.getComputedStyle(div, null);
pixelPositionVal = divStyle.top !== "1%";
boxSizingReliableVal = divStyle.width === "4px";
docElem.removeChild(container);
}
// Support: node.js jsdom
// Don't assume that getComputedStyle is a property of the global object
if (window.getComputedStyle) {
jQuery.extend(support, {
pixelPosition: function () {
// This test is executed only once but we still do memoizing
// since we can use the boxSizingReliable pre-computing.
// No need to check if the test was already performed, though.
computePixelPositionAndBoxSizingReliable();
return pixelPositionVal;
},
boxSizingReliable: function () {
if (boxSizingReliableVal == null) {
computePixelPositionAndBoxSizingReliable();
}
return boxSizingReliableVal;
},
reliableMarginRight: function () {
// Support: Android 2.3
// Check if div with explicit width and no margin-right incorrectly
// gets computed margin-right based on width of container. (#3333)
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
// This support function is only executed once so no memoizing is needed.
var ret,
marginDiv = div.appendChild(document.createElement("div"));
// Reset CSS: box-sizing; display; margin; border; padding
marginDiv.style.cssText = div.style.cssText =
// Support: Firefox<29, Android 2.3
// Vendor-prefix box-sizing
"-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" +
"box-sizing:content-box;display:block;margin:0;border:0;padding:0";
marginDiv.style.marginRight = marginDiv.style.width = "0";
div.style.width = "1px";
docElem.appendChild(container);
ret = !parseFloat(window.getComputedStyle(marginDiv, null).marginRight);
docElem.removeChild(container);
return ret;
}
});
}
})();
// A method for quickly swapping in/out CSS properties to get correct calculations.
jQuery.swap = function (elem, options, callback, args) {
var ret, name,
old = {};
// Remember the old values, and insert the new ones
for (name in options) {
old[name] = elem.style[name];
elem.style[name] = options[name];
}
ret = callback.apply(elem, args || []);
// Revert the old values
for (name in options) {
elem.style[name] = old[name];
}
return ret;
};
var
// swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
// see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
rdisplayswap = /^(none|table(?!-c[ea]).+)/,
rnumsplit = new RegExp("^(" + pnum + ")(.*)$", "i"),
rrelNum = new RegExp("^([+-])=(" + pnum + ")", "i"),
cssShow = {position: "absolute", visibility: "hidden", display: "block"},
cssNormalTransform = {
letterSpacing: "0",
fontWeight: "400"
},
cssPrefixes = ["Webkit", "O", "Moz", "ms"];
// return a css property mapped to a potentially vendor prefixed property
function vendorPropName(style, name) {
// shortcut for names that are not vendor prefixed
if (name in style) {
return name;
}
// check for vendor prefixed names
var capName = name[0].toUpperCase() + name.slice(1),
origName = name,
i = cssPrefixes.length;
while (i--) {
name = cssPrefixes[i] + capName;
if (name in style) {
return name;
}
}
return origName;
}
function setPositiveNumber(elem, value, subtract) {
var matches = rnumsplit.exec(value);
return matches ?
// Guard against undefined "subtract", e.g., when used as in cssHooks
Math.max(0, matches[1] - ( subtract || 0 )) + ( matches[2] || "px" ) :
value;
}
function augmentWidthOrHeight(elem, name, extra, isBorderBox, styles) {
var i = extra === ( isBorderBox ? "border" : "content" ) ?
// If we already have the right measurement, avoid augmentation
4 :
// Otherwise initialize for horizontal or vertical properties
name === "width" ? 1 : 0,
val = 0;
for (; i < 4; i += 2) {
// both box models exclude margin, so add it if we want it
if (extra === "margin") {
val += jQuery.css(elem, extra + cssExpand[i], true, styles);
}
if (isBorderBox) {
// border-box includes padding, so remove it if we want content
if (extra === "content") {
val -= jQuery.css(elem, "padding" + cssExpand[i], true, styles);
}
// at this point, extra isn't border nor margin, so remove border
if (extra !== "margin") {
val -= jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
}
} else {
// at this point, extra isn't content, so add padding
val += jQuery.css(elem, "padding" + cssExpand[i], true, styles);
// at this point, extra isn't content nor padding, so add border
if (extra !== "padding") {
val += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
}
}
}
return val;
}
function getWidthOrHeight(elem, name, extra) {
// Start with offset property, which is equivalent to the border-box value
var valueIsBorderBox = true,
val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
styles = getStyles(elem),
isBorderBox = jQuery.css(elem, "boxSizing", false, styles) === "border-box";
// some non-html elements return undefined for offsetWidth, so check for null/undefined
// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
// MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
if (val <= 0 || val == null) {
// Fall back to computed then uncomputed css if necessary
val = curCSS(elem, name, styles);
if (val < 0 || val == null) {
val = elem.style[name];
}
// Computed unit is not pixels. Stop here and return.
if (rnumnonpx.test(val)) {
return val;
}
// we need the check for style in case a browser which returns unreliable values
// for getComputedStyle silently falls back to the reliable elem.style
valueIsBorderBox = isBorderBox &&
( support.boxSizingReliable() || val === elem.style[name] );
// Normalize "", auto, and prepare for extra
val = parseFloat(val) || 0;
}
// use the active box-sizing model to add/subtract irrelevant styles
return ( val +
augmentWidthOrHeight(
elem,
name,
extra || ( isBorderBox ? "border" : "content" ),
valueIsBorderBox,
styles
)
) + "px";
}
function showHide(elements, show) {
var display, elem, hidden,
values = [],
index = 0,
length = elements.length;
for (; index < length; index++) {
elem = elements[index];
if (!elem.style) {
continue;
}
values[index] = data_priv.get(elem, "olddisplay");
display = elem.style.display;
if (show) {
// Reset the inline display of this element to learn if it is
// being hidden by cascaded rules or not
if (!values[index] && display === "none") {
elem.style.display = "";
}
// Set elements which have been overridden with display: none
// in a stylesheet to whatever the default browser style is
// for such an element
if (elem.style.display === "" && isHidden(elem)) {
values[index] = data_priv.access(elem, "olddisplay", defaultDisplay(elem.nodeName));
}
} else {
hidden = isHidden(elem);
if (display !== "none" || !hidden) {
data_priv.set(elem, "olddisplay", hidden ? display : jQuery.css(elem, "display"));
}
}
}
// Set the display of most of the elements in a second loop
// to avoid the constant reflow
for (index = 0; index < length; index++) {
elem = elements[index];
if (!elem.style) {
continue;
}
if (!show || elem.style.display === "none" || elem.style.display === "") {
elem.style.display = show ? values[index] || "" : "none";
}
}
return elements;
}
jQuery.extend({
// Add in style property hooks for overriding the default
// behavior of getting and setting a style property
cssHooks: {
opacity: {
get: function (elem, computed) {
if (computed) {
// We should always get a number back from opacity
var ret = curCSS(elem, "opacity");
return ret === "" ? "1" : ret;
}
}
}
},
// Don't automatically add "px" to these possibly-unitless properties
cssNumber: {
"columnCount": true,
"fillOpacity": true,
"flexGrow": true,
"flexShrink": true,
"fontWeight": true,
"lineHeight": true,
"opacity": true,
"order": true,
"orphans": true,
"widows": true,
"zIndex": true,
"zoom": true
},
// Add in properties whose names you wish to fix before
// setting or getting the value
cssProps: {
// normalize float css property
"float": "cssFloat"
},
// Get and set the style property on a DOM Node
style: function (elem, name, value, extra) {
// Don't set styles on text and comment nodes
if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) {
return;
}
// Make sure that we're working with the right name
var ret, type, hooks,
origName = jQuery.camelCase(name),
style = elem.style;
name = jQuery.cssProps[origName] || ( jQuery.cssProps[origName] = vendorPropName(style, origName) );
// gets hook for the prefixed version
// followed by the unprefixed version
hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
// Check if we're setting a value
if (value !== undefined) {
type = typeof value;
// convert relative number strings (+= or -=) to relative numbers. #7345
if (type === "string" && (ret = rrelNum.exec(value))) {
value = ( ret[1] + 1 ) * ret[2] + parseFloat(jQuery.css(elem, name));
// Fixes bug #9237
type = "number";
}
// Make sure that null and NaN values aren't set. See: #7116
if (value == null || value !== value) {
return;
}
// If a number was passed in, add 'px' to the (except for certain CSS properties)
if (type === "number" && !jQuery.cssNumber[origName]) {
value += "px";
}
// Fixes #8908, it can be done more correctly by specifying setters in cssHooks,
// but it would mean to define eight (for every problematic property) identical functions
if (!support.clearCloneStyle && value === "" && name.indexOf("background") === 0) {
style[name] = "inherit";
}
// If a hook was provided, use that value, otherwise just set the specified value
if (!hooks || !("set" in hooks) || (value = hooks.set(elem, value, extra)) !== undefined) {
style[name] = value;
}
} else {
// If a hook was provided get the non-computed value from there
if (hooks && "get" in hooks && (ret = hooks.get(elem, false, extra)) !== undefined) {
return ret;
}
// Otherwise just get the value from the style object
return style[name];
}
},
css: function (elem, name, extra, styles) {
var val, num, hooks,
origName = jQuery.camelCase(name);
// Make sure that we're working with the right name
name = jQuery.cssProps[origName] || ( jQuery.cssProps[origName] = vendorPropName(elem.style, origName) );
// gets hook for the prefixed version
// followed by the unprefixed version
hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
// If a hook was provided get the computed value from there
if (hooks && "get" in hooks) {
val = hooks.get(elem, true, extra);
}
// Otherwise, if a way to get the computed value exists, use that
if (val === undefined) {
val = curCSS(elem, name, styles);
}
//convert "normal" to computed value
if (val === "normal" && name in cssNormalTransform) {
val = cssNormalTransform[name];
}
// Return, converting to number if forced or a qualifier was provided and val looks numeric
if (extra === "" || extra) {
num = parseFloat(val);
return extra === true || jQuery.isNumeric(num) ? num || 0 : val;
}
return val;
}
});
jQuery.each(["height", "width"], function (i, name) {
jQuery.cssHooks[name] = {
get: function (elem, computed, extra) {
if (computed) {
// certain elements can have dimension info if we invisibly show them
// however, it must have a current display style that would benefit from this
return rdisplayswap.test(jQuery.css(elem, "display")) && elem.offsetWidth === 0 ?
jQuery.swap(elem, cssShow, function () {
return getWidthOrHeight(elem, name, extra);
}) :
getWidthOrHeight(elem, name, extra);
}
},
set: function (elem, value, extra) {
var styles = extra && getStyles(elem);
return setPositiveNumber(elem, value, extra ?
augmentWidthOrHeight(
elem,
name,
extra,
jQuery.css(elem, "boxSizing", false, styles) === "border-box",
styles
) : 0
);
}
};
});
// Support: Android 2.3
jQuery.cssHooks.marginRight = addGetHookIf(support.reliableMarginRight,
function (elem, computed) {
if (computed) {
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
// Work around by temporarily setting element display to inline-block
return jQuery.swap(elem, {"display": "inline-block"},
curCSS, [elem, "marginRight"]);
}
}
);
// These hooks are used by animate to expand properties
jQuery.each({
margin: "",
padding: "",
border: "Width"
}, function (prefix, suffix) {
jQuery.cssHooks[prefix + suffix] = {
expand: function (value) {
var i = 0,
expanded = {},
// assumes a single number if not a string
parts = typeof value === "string" ? value.split(" ") : [value];
for (; i < 4; i++) {
expanded[prefix + cssExpand[i] + suffix] =
parts[i] || parts[i - 2] || parts[0];
}
return expanded;
}
};
if (!rmargin.test(prefix)) {
jQuery.cssHooks[prefix + suffix].set = setPositiveNumber;
}
});
jQuery.fn.extend({
css: function (name, value) {
return access(this, function (elem, name, value) {
var styles, len,
map = {},
i = 0;
if (jQuery.isArray(name)) {
styles = getStyles(elem);
len = name.length;
for (; i < len; i++) {
map[name[i]] = jQuery.css(elem, name[i], false, styles);
}
return map;
}
return value !== undefined ?
jQuery.style(elem, name, value) :
jQuery.css(elem, name);
}, name, value, arguments.length > 1);
},
show: function () {
return showHide(this, true);
},
hide: function () {
return showHide(this);
},
toggle: function (state) {
if (typeof state === "boolean") {
return state ? this.show() : this.hide();
}
return this.each(function () {
if (isHidden(this)) {
jQuery(this).show();
} else {
jQuery(this).hide();
}
});
}
});
function Tween(elem, options, prop, end, easing) {
return new Tween.prototype.init(elem, options, prop, end, easing);
}
jQuery.Tween = Tween;
Tween.prototype = {
constructor: Tween,
init: function (elem, options, prop, end, easing, unit) {
this.elem = elem;
this.prop = prop;
this.easing = easing || "swing";
this.options = options;
this.start = this.now = this.cur();
this.end = end;
this.unit = unit || ( jQuery.cssNumber[prop] ? "" : "px" );
},
cur: function () {
var hooks = Tween.propHooks[this.prop];
return hooks && hooks.get ?
hooks.get(this) :
Tween.propHooks._default.get(this);
},
run: function (percent) {
var eased,
hooks = Tween.propHooks[this.prop];
if (this.options.duration) {
this.pos = eased = jQuery.easing[this.easing](
percent, this.options.duration * percent, 0, 1, this.options.duration
);
} else {
this.pos = eased = percent;
}
this.now = ( this.end - this.start ) * eased + this.start;
if (this.options.step) {
this.options.step.call(this.elem, this.now, this);
}
if (hooks && hooks.set) {
hooks.set(this);
} else {
Tween.propHooks._default.set(this);
}
return this;
}
};
Tween.prototype.init.prototype = Tween.prototype;
Tween.propHooks = {
_default: {
get: function (tween) {
var result;
if (tween.elem[tween.prop] != null &&
(!tween.elem.style || tween.elem.style[tween.prop] == null)) {
return tween.elem[tween.prop];
}
// passing an empty string as a 3rd parameter to .css will automatically
// attempt a parseFloat and fallback to a string if the parse fails
// so, simple values such as "10px" are parsed to Float.
// complex values such as "rotate(1rad)" are returned as is.
result = jQuery.css(tween.elem, tween.prop, "");
// Empty strings, null, undefined and "auto" are converted to 0.
return !result || result === "auto" ? 0 : result;
},
set: function (tween) {
// use step hook for back compat - use cssHook if its there - use .style if its
// available and use plain properties where available
if (jQuery.fx.step[tween.prop]) {
jQuery.fx.step[tween.prop](tween);
} else if (tween.elem.style && ( tween.elem.style[jQuery.cssProps[tween.prop]] != null || jQuery.cssHooks[tween.prop] )) {
jQuery.style(tween.elem, tween.prop, tween.now + tween.unit);
} else {
tween.elem[tween.prop] = tween.now;
}
}
}
};
// Support: IE9
// Panic based approach to setting things on disconnected nodes
Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
set: function (tween) {
if (tween.elem.nodeType && tween.elem.parentNode) {
tween.elem[tween.prop] = tween.now;
}
}
};
jQuery.easing = {
linear: function (p) {
return p;
},
swing: function (p) {
return 0.5 - Math.cos(p * Math.PI) / 2;
}
};
jQuery.fx = Tween.prototype.init;
// Back Compat <1.8 extension point
jQuery.fx.step = {};
var
fxNow, timerId,
rfxtypes = /^(?:toggle|show|hide)$/,
rfxnum = new RegExp("^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i"),
rrun = /queueHooks$/,
animationPrefilters = [defaultPrefilter],
tweeners = {
"*": [function (prop, value) {
var tween = this.createTween(prop, value),
target = tween.cur(),
parts = rfxnum.exec(value),
unit = parts && parts[3] || ( jQuery.cssNumber[prop] ? "" : "px" ),
// Starting value computation is required for potential unit mismatches
start = ( jQuery.cssNumber[prop] || unit !== "px" && +target ) &&
rfxnum.exec(jQuery.css(tween.elem, prop)),
scale = 1,
maxIterations = 20;
if (start && start[3] !== unit) {
// Trust units reported by jQuery.css
unit = unit || start[3];
// Make sure we update the tween properties later on
parts = parts || [];
// Iteratively approximate from a nonzero starting point
start = +target || 1;
do {
// If previous iteration zeroed out, double until we get *something*
// Use a string for doubling factor so we don't accidentally see scale as unchanged below
scale = scale || ".5";
// Adjust and apply
start = start / scale;
jQuery.style(tween.elem, prop, start + unit);
// Update scale, tolerating zero or NaN from tween.cur()
// And breaking the loop if scale is unchanged or perfect, or if we've just had enough
} while (scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations);
}
// Update tween properties
if (parts) {
start = tween.start = +start || +target || 0;
tween.unit = unit;
// If a +=/-= token was provided, we're doing a relative animation
tween.end = parts[1] ?
start + ( parts[1] + 1 ) * parts[2] :
+parts[2];
}
return tween;
}]
};
// Animations created synchronously will run synchronously
function createFxNow() {
setTimeout(function () {
fxNow = undefined;
});
return ( fxNow = jQuery.now() );
}
// Generate parameters to create a standard animation
function genFx(type, includeWidth) {
var which,
i = 0,
attrs = {height: type};
// if we include width, step value is 1 to do all cssExpand values,
// if we don't include width, step value is 2 to skip over Left and Right
includeWidth = includeWidth ? 1 : 0;
for (; i < 4; i += 2 - includeWidth) {
which = cssExpand[i];
attrs["margin" + which] = attrs["padding" + which] = type;
}
if (includeWidth) {
attrs.opacity = attrs.width = type;
}
return attrs;
}
function createTween(value, prop, animation) {
var tween,
collection = ( tweeners[prop] || [] ).concat(tweeners["*"]),
index = 0,
length = collection.length;
for (; index < length; index++) {
if ((tween = collection[index].call(animation, prop, value))) {
// we're done with this property
return tween;
}
}
}
function defaultPrefilter(elem, props, opts) {
/* jshint validthis: true */
var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay,
anim = this,
orig = {},
style = elem.style,
hidden = elem.nodeType && isHidden(elem),
dataShow = data_priv.get(elem, "fxshow");
// handle queue: false promises
if (!opts.queue) {
hooks = jQuery._queueHooks(elem, "fx");
if (hooks.unqueued == null) {
hooks.unqueued = 0;
oldfire = hooks.empty.fire;
hooks.empty.fire = function () {
if (!hooks.unqueued) {
oldfire();
}
};
}
hooks.unqueued++;
anim.always(function () {
// doing this makes sure that the complete handler will be called
// before this completes
anim.always(function () {
hooks.unqueued--;
if (!jQuery.queue(elem, "fx").length) {
hooks.empty.fire();
}
});
});
}
// height/width overflow pass
if (elem.nodeType === 1 && ( "height" in props || "width" in props )) {
// Make sure that nothing sneaks out
// Record all 3 overflow attributes because IE9-10 do not
// change the overflow attribute when overflowX and
// overflowY are set to the same value
opts.overflow = [style.overflow, style.overflowX, style.overflowY];
// Set display property to inline-block for height/width
// animations on inline elements that are having width/height animated
display = jQuery.css(elem, "display");
// Test default display if display is currently "none"
checkDisplay = display === "none" ?
data_priv.get(elem, "olddisplay") || defaultDisplay(elem.nodeName) : display;
if (checkDisplay === "inline" && jQuery.css(elem, "float") === "none") {
style.display = "inline-block";
}
}
if (opts.overflow) {
style.overflow = "hidden";
anim.always(function () {
style.overflow = opts.overflow[0];
style.overflowX = opts.overflow[1];
style.overflowY = opts.overflow[2];
});
}
// show/hide pass
for (prop in props) {
value = props[prop];
if (rfxtypes.exec(value)) {
delete props[prop];
toggle = toggle || value === "toggle";
if (value === ( hidden ? "hide" : "show" )) {
// If there is dataShow left over from a stopped hide or show and we are going to proceed with show, we should pretend to be hidden
if (value === "show" && dataShow && dataShow[prop] !== undefined) {
hidden = true;
} else {
continue;
}
}
orig[prop] = dataShow && dataShow[prop] || jQuery.style(elem, prop);
// Any non-fx value stops us from restoring the original display value
} else {
display = undefined;
}
}
if (!jQuery.isEmptyObject(orig)) {
if (dataShow) {
if ("hidden" in dataShow) {
hidden = dataShow.hidden;
}
} else {
dataShow = data_priv.access(elem, "fxshow", {});
}
// store state if its toggle - enables .stop().toggle() to "reverse"
if (toggle) {
dataShow.hidden = !hidden;
}
if (hidden) {
jQuery(elem).show();
} else {
anim.done(function () {
jQuery(elem).hide();
});
}
anim.done(function () {
var prop;
data_priv.remove(elem, "fxshow");
for (prop in orig) {
jQuery.style(elem, prop, orig[prop]);
}
});
for (prop in orig) {
tween = createTween(hidden ? dataShow[prop] : 0, prop, anim);
if (!( prop in dataShow )) {
dataShow[prop] = tween.start;
if (hidden) {
tween.end = tween.start;
tween.start = prop === "width" || prop === "height" ? 1 : 0;
}
}
}
// If this is a noop like .hide().hide(), restore an overwritten display value
} else if ((display === "none" ? defaultDisplay(elem.nodeName) : display) === "inline") {
style.display = display;
}
}
function propFilter(props, specialEasing) {
var index, name, easing, value, hooks;
// camelCase, specialEasing and expand cssHook pass
for (index in props) {
name = jQuery.camelCase(index);
easing = specialEasing[name];
value = props[index];
if (jQuery.isArray(value)) {
easing = value[1];
value = props[index] = value[0];
}
if (index !== name) {
props[name] = value;
delete props[index];
}
hooks = jQuery.cssHooks[name];
if (hooks && "expand" in hooks) {
value = hooks.expand(value);
delete props[name];
// not quite $.extend, this wont overwrite keys already present.
// also - reusing 'index' from above because we have the correct "name"
for (index in value) {
if (!( index in props )) {
props[index] = value[index];
specialEasing[index] = easing;
}
}
} else {
specialEasing[name] = easing;
}
}
}
function Animation(elem, properties, options) {
var result,
stopped,
index = 0,
length = animationPrefilters.length,
deferred = jQuery.Deferred().always(function () {
// don't match elem in the :animated selector
delete tick.elem;
}),
tick = function () {
if (stopped) {
return false;
}
var currentTime = fxNow || createFxNow(),
remaining = Math.max(0, animation.startTime + animation.duration - currentTime),
// archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
temp = remaining / animation.duration || 0,
percent = 1 - temp,
index = 0,
length = animation.tweens.length;
for (; index < length; index++) {
animation.tweens[index].run(percent);
}
deferred.notifyWith(elem, [animation, percent, remaining]);
if (percent < 1 && length) {
return remaining;
} else {
deferred.resolveWith(elem, [animation]);
return false;
}
},
animation = deferred.promise({
elem: elem,
props: jQuery.extend({}, properties),
opts: jQuery.extend(true, {specialEasing: {}}, options),
originalProperties: properties,
originalOptions: options,
startTime: fxNow || createFxNow(),
duration: options.duration,
tweens: [],
createTween: function (prop, end) {
var tween = jQuery.Tween(elem, animation.opts, prop, end,
animation.opts.specialEasing[prop] || animation.opts.easing);
animation.tweens.push(tween);
return tween;
},
stop: function (gotoEnd) {
var index = 0,
// if we are going to the end, we want to run all the tweens
// otherwise we skip this part
length = gotoEnd ? animation.tweens.length : 0;
if (stopped) {
return this;
}
stopped = true;
for (; index < length; index++) {
animation.tweens[index].run(1);
}
// resolve when we played the last frame
// otherwise, reject
if (gotoEnd) {
deferred.resolveWith(elem, [animation, gotoEnd]);
} else {
deferred.rejectWith(elem, [animation, gotoEnd]);
}
return this;
}
}),
props = animation.props;
propFilter(props, animation.opts.specialEasing);
for (; index < length; index++) {
result = animationPrefilters[index].call(animation, elem, props, animation.opts);
if (result) {
return result;
}
}
jQuery.map(props, createTween, animation);
if (jQuery.isFunction(animation.opts.start)) {
animation.opts.start.call(elem, animation);
}
jQuery.fx.timer(
jQuery.extend(tick, {
elem: elem,
anim: animation,
queue: animation.opts.queue
})
);
// attach callbacks from options
return animation.progress(animation.opts.progress)
.done(animation.opts.done, animation.opts.complete)
.fail(animation.opts.fail)
.always(animation.opts.always);
}
jQuery.Animation = jQuery.extend(Animation, {
tweener: function (props, callback) {
if (jQuery.isFunction(props)) {
callback = props;
props = ["*"];
} else {
props = props.split(" ");
}
var prop,
index = 0,
length = props.length;
for (; index < length; index++) {
prop = props[index];
tweeners[prop] = tweeners[prop] || [];
tweeners[prop].unshift(callback);
}
},
prefilter: function (callback, prepend) {
if (prepend) {
animationPrefilters.unshift(callback);
} else {
animationPrefilters.push(callback);
}
}
});
jQuery.speed = function (speed, easing, fn) {
var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : {
complete: fn || !fn && easing ||
jQuery.isFunction(speed) && speed,
duration: speed,
easing: fn && easing || easing && !jQuery.isFunction(easing) && easing
};
opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[opt.duration] : jQuery.fx.speeds._default;
// normalize opt.queue - true/undefined/null -> "fx"
if (opt.queue == null || opt.queue === true) {
opt.queue = "fx";
}
// Queueing
opt.old = opt.complete;
opt.complete = function () {
if (jQuery.isFunction(opt.old)) {
opt.old.call(this);
}
if (opt.queue) {
jQuery.dequeue(this, opt.queue);
}
};
return opt;
};
jQuery.fn.extend({
fadeTo: function (speed, to, easing, callback) {
// show any hidden elements after setting opacity to 0
return this.filter(isHidden).css("opacity", 0).show()
// animate to the value specified
.end().animate({opacity: to}, speed, easing, callback);
},
animate: function (prop, speed, easing, callback) {
var empty = jQuery.isEmptyObject(prop),
optall = jQuery.speed(speed, easing, callback),
doAnimation = function () {
// Operate on a copy of prop so per-property easing won't be lost
var anim = Animation(this, jQuery.extend({}, prop), optall);
// Empty animations, or finishing resolves immediately
if (empty || data_priv.get(this, "finish")) {
anim.stop(true);
}
};
doAnimation.finish = doAnimation;
return empty || optall.queue === false ?
this.each(doAnimation) :
this.queue(optall.queue, doAnimation);
},
stop: function (type, clearQueue, gotoEnd) {
var stopQueue = function (hooks) {
var stop = hooks.stop;
delete hooks.stop;
stop(gotoEnd);
};
if (typeof type !== "string") {
gotoEnd = clearQueue;
clearQueue = type;
type = undefined;
}
if (clearQueue && type !== false) {
this.queue(type || "fx", []);
}
return this.each(function () {
var dequeue = true,
index = type != null && type + "queueHooks",
timers = jQuery.timers,
data = data_priv.get(this);
if (index) {
if (data[index] && data[index].stop) {
stopQueue(data[index]);
}
} else {
for (index in data) {
if (data[index] && data[index].stop && rrun.test(index)) {
stopQueue(data[index]);
}
}
}
for (index = timers.length; index--;) {
if (timers[index].elem === this && (type == null || timers[index].queue === type)) {
timers[index].anim.stop(gotoEnd);
dequeue = false;
timers.splice(index, 1);
}
}
// start the next in the queue if the last step wasn't forced
// timers currently will call their complete callbacks, which will dequeue
// but only if they were gotoEnd
if (dequeue || !gotoEnd) {
jQuery.dequeue(this, type);
}
});
},
finish: function (type) {
if (type !== false) {
type = type || "fx";
}
return this.each(function () {
var index,
data = data_priv.get(this),
queue = data[type + "queue"],
hooks = data[type + "queueHooks"],
timers = jQuery.timers,
length = queue ? queue.length : 0;
// enable finishing flag on private data
data.finish = true;
// empty the queue first
jQuery.queue(this, type, []);
if (hooks && hooks.stop) {
hooks.stop.call(this, true);
}
// look for any active animations, and finish them
for (index = timers.length; index--;) {
if (timers[index].elem === this && timers[index].queue === type) {
timers[index].anim.stop(true);
timers.splice(index, 1);
}
}
// look for any animations in the old queue and finish them
for (index = 0; index < length; index++) {
if (queue[index] && queue[index].finish) {
queue[index].finish.call(this);
}
}
// turn off finishing flag
delete data.finish;
});
}
});
jQuery.each(["toggle", "show", "hide"], function (i, name) {
var cssFn = jQuery.fn[name];
jQuery.fn[name] = function (speed, easing, callback) {
return speed == null || typeof speed === "boolean" ?
cssFn.apply(this, arguments) :
this.animate(genFx(name, true), speed, easing, callback);
};
});
// Generate shortcuts for custom animations
jQuery.each({
slideDown: genFx("show"),
slideUp: genFx("hide"),
slideToggle: genFx("toggle"),
fadeIn: {opacity: "show"},
fadeOut: {opacity: "hide"},
fadeToggle: {opacity: "toggle"}
}, function (name, props) {
jQuery.fn[name] = function (speed, easing, callback) {
return this.animate(props, speed, easing, callback);
};
});
jQuery.timers = [];
jQuery.fx.tick = function () {
var timer,
i = 0,
timers = jQuery.timers;
fxNow = jQuery.now();
for (; i < timers.length; i++) {
timer = timers[i];
// Checks the timer has not already been removed
if (!timer() && timers[i] === timer) {
timers.splice(i--, 1);
}
}
if (!timers.length) {
jQuery.fx.stop();
}
fxNow = undefined;
};
jQuery.fx.timer = function (timer) {
jQuery.timers.push(timer);
if (timer()) {
jQuery.fx.start();
} else {
jQuery.timers.pop();
}
};
jQuery.fx.interval = 13;
jQuery.fx.start = function () {
if (!timerId) {
timerId = setInterval(jQuery.fx.tick, jQuery.fx.interval);
}
};
jQuery.fx.stop = function () {
clearInterval(timerId);
timerId = null;
};
jQuery.fx.speeds = {
slow: 600,
fast: 200,
// Default speed
_default: 400
};
// Based off of the plugin by Clint Helfers, with permission.
// http://blindsignals.com/index.php/2009/07/jquery-delay/
jQuery.fn.delay = function (time, type) {
time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
type = type || "fx";
return this.queue(type, function (next, hooks) {
var timeout = setTimeout(next, time);
hooks.stop = function () {
clearTimeout(timeout);
};
});
};
(function () {
var input = document.createElement("input"),
select = document.createElement("select"),
opt = select.appendChild(document.createElement("option"));
input.type = "checkbox";
// Support: iOS 5.1, Android 4.x, Android 2.3
// Check the default checkbox/radio value ("" on old WebKit; "on" elsewhere)
support.checkOn = input.value !== "";
// Must access the parent to make an option select properly
// Support: IE9, IE10
support.optSelected = opt.selected;
// Make sure that the options inside disabled selects aren't marked as disabled
// (WebKit marks them as disabled)
select.disabled = true;
support.optDisabled = !opt.disabled;
// Check if an input maintains its value after becoming a radio
// Support: IE9, IE10
input = document.createElement("input");
input.value = "t";
input.type = "radio";
support.radioValue = input.value === "t";
})();
var nodeHook, boolHook,
attrHandle = jQuery.expr.attrHandle;
jQuery.fn.extend({
attr: function (name, value) {
return access(this, jQuery.attr, name, value, arguments.length > 1);
},
removeAttr: function (name) {
return this.each(function () {
jQuery.removeAttr(this, name);
});
}
});
jQuery.extend({
attr: function (elem, name, value) {
var hooks, ret,
nType = elem.nodeType;
// don't get/set attributes on text, comment and attribute nodes
if (!elem || nType === 3 || nType === 8 || nType === 2) {
return;
}
// Fallback to prop when attributes are not supported
if (typeof elem.getAttribute === strundefined) {
return jQuery.prop(elem, name, value);
}
// All attributes are lowercase
// Grab necessary hook if one is defined
if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
name = name.toLowerCase();
hooks = jQuery.attrHooks[name] ||
( jQuery.expr.match.bool.test(name) ? boolHook : nodeHook );
}
if (value !== undefined) {
if (value === null) {
jQuery.removeAttr(elem, name);
} else if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {
return ret;
} else {
elem.setAttribute(name, value + "");
return value;
}
} else if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
return ret;
} else {
ret = jQuery.find.attr(elem, name);
// Non-existent attributes return null, we normalize to undefined
return ret == null ?
undefined :
ret;
}
},
removeAttr: function (elem, value) {
var name, propName,
i = 0,
attrNames = value && value.match(rnotwhite);
if (attrNames && elem.nodeType === 1) {
while ((name = attrNames[i++])) {
propName = jQuery.propFix[name] || name;
// Boolean attributes get special treatment (#10870)
if (jQuery.expr.match.bool.test(name)) {
// Set corresponding property to false
elem[propName] = false;
}
elem.removeAttribute(name);
}
}
},
attrHooks: {
type: {
set: function (elem, value) {
if (!support.radioValue && value === "radio" &&
jQuery.nodeName(elem, "input")) {
// Setting the type on a radio button after the value resets the value in IE6-9
// Reset value to default in case type is set after value during creation
var val = elem.value;
elem.setAttribute("type", value);
if (val) {
elem.value = val;
}
return value;
}
}
}
}
});
// Hooks for boolean attributes
boolHook = {
set: function (elem, value, name) {
if (value === false) {
// Remove boolean attributes when set to false
jQuery.removeAttr(elem, name);
} else {
elem.setAttribute(name, name);
}
return name;
}
};
jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g), function (i, name) {
var getter = attrHandle[name] || jQuery.find.attr;
attrHandle[name] = function (elem, name, isXML) {
var ret, handle;
if (!isXML) {
// Avoid an infinite loop by temporarily removing this function from the getter
handle = attrHandle[name];
attrHandle[name] = ret;
ret = getter(elem, name, isXML) != null ?
name.toLowerCase() :
null;
attrHandle[name] = handle;
}
return ret;
};
});
var rfocusable = /^(?:input|select|textarea|button)$/i;
jQuery.fn.extend({
prop: function (name, value) {
return access(this, jQuery.prop, name, value, arguments.length > 1);
},
removeProp: function (name) {
return this.each(function () {
delete this[jQuery.propFix[name] || name];
});
}
});
jQuery.extend({
propFix: {
"for": "htmlFor",
"class": "className"
},
prop: function (elem, name, value) {
var ret, hooks, notxml,
nType = elem.nodeType;
// don't get/set properties on text, comment and attribute nodes
if (!elem || nType === 3 || nType === 8 || nType === 2) {
return;
}
notxml = nType !== 1 || !jQuery.isXMLDoc(elem);
if (notxml) {
// Fix name and attach hooks
name = jQuery.propFix[name] || name;
hooks = jQuery.propHooks[name];
}
if (value !== undefined) {
return hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined ?
ret :
( elem[name] = value );
} else {
return hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null ?
ret :
elem[name];
}
},
propHooks: {
tabIndex: {
get: function (elem) {
return elem.hasAttribute("tabindex") || rfocusable.test(elem.nodeName) || elem.href ?
elem.tabIndex :
-1;
}
}
}
});
// Support: IE9+
// Selectedness for an option in an optgroup can be inaccurate
if (!support.optSelected) {
jQuery.propHooks.selected = {
get: function (elem) {
var parent = elem.parentNode;
if (parent && parent.parentNode) {
parent.parentNode.selectedIndex;
}
return null;
}
};
}
jQuery.each([
"tabIndex",
"readOnly",
"maxLength",
"cellSpacing",
"cellPadding",
"rowSpan",
"colSpan",
"useMap",
"frameBorder",
"contentEditable"
], function () {
jQuery.propFix[this.toLowerCase()] = this;
});
var rclass = /[\t\r\n\f]/g;
jQuery.fn.extend({
addClass: function (value) {
var classes, elem, cur, clazz, j, finalValue,
proceed = typeof value === "string" && value,
i = 0,
len = this.length;
if (jQuery.isFunction(value)) {
return this.each(function (j) {
jQuery(this).addClass(value.call(this, j, this.className));
});
}
if (proceed) {
// The disjunction here is for better compressibility (see removeClass)
classes = ( value || "" ).match(rnotwhite) || [];
for (; i < len; i++) {
elem = this[i];
cur = elem.nodeType === 1 && ( elem.className ?
( " " + elem.className + " " ).replace(rclass, " ") :
" "
);
if (cur) {
j = 0;
while ((clazz = classes[j++])) {
if (cur.indexOf(" " + clazz + " ") < 0) {
cur += clazz + " ";
}
}
// only assign if different to avoid unneeded rendering.
finalValue = jQuery.trim(cur);
if (elem.className !== finalValue) {
elem.className = finalValue;
}
}
}
}
return this;
},
removeClass: function (value) {
var classes, elem, cur, clazz, j, finalValue,
proceed = arguments.length === 0 || typeof value === "string" && value,
i = 0,
len = this.length;
if (jQuery.isFunction(value)) {
return this.each(function (j) {
jQuery(this).removeClass(value.call(this, j, this.className));
});
}
if (proceed) {
classes = ( value || "" ).match(rnotwhite) || [];
for (; i < len; i++) {
elem = this[i];
// This expression is here for better compressibility (see addClass)
cur = elem.nodeType === 1 && ( elem.className ?
( " " + elem.className + " " ).replace(rclass, " ") :
""
);
if (cur) {
j = 0;
while ((clazz = classes[j++])) {
// Remove *all* instances
while (cur.indexOf(" " + clazz + " ") >= 0) {
cur = cur.replace(" " + clazz + " ", " ");
}
}
// only assign if different to avoid unneeded rendering.
finalValue = value ? jQuery.trim(cur) : "";
if (elem.className !== finalValue) {
elem.className = finalValue;
}
}
}
}
return this;
},
toggleClass: function (value, stateVal) {
var type = typeof value;
if (typeof stateVal === "boolean" && type === "string") {
return stateVal ? this.addClass(value) : this.removeClass(value);
}
if (jQuery.isFunction(value)) {
return this.each(function (i) {
jQuery(this).toggleClass(value.call(this, i, this.className, stateVal), stateVal);
});
}
return this.each(function () {
if (type === "string") {
// toggle individual class names
var className,
i = 0,
self = jQuery(this),
classNames = value.match(rnotwhite) || [];
while ((className = classNames[i++])) {
// check each className given, space separated list
if (self.hasClass(className)) {
self.removeClass(className);
} else {
self.addClass(className);
}
}
// Toggle whole class name
} else if (type === strundefined || type === "boolean") {
if (this.className) {
// store className if set
data_priv.set(this, "__className__", this.className);
}
// If the element has a class name or if we're passed "false",
// then remove the whole classname (if there was one, the above saved it).
// Otherwise bring back whatever was previously saved (if anything),
// falling back to the empty string if nothing was stored.
this.className = this.className || value === false ? "" : data_priv.get(this, "__className__") || "";
}
});
},
hasClass: function (selector) {
var className = " " + selector + " ",
i = 0,
l = this.length;
for (; i < l; i++) {
if (this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf(className) >= 0) {
return true;
}
}
return false;
}
});
var rreturn = /\r/g;
jQuery.fn.extend({
val: function (value) {
var hooks, ret, isFunction,
elem = this[0];
if (!arguments.length) {
if (elem) {
hooks = jQuery.valHooks[elem.type] || jQuery.valHooks[elem.nodeName.toLowerCase()];
if (hooks && "get" in hooks && (ret = hooks.get(elem, "value")) !== undefined) {
return ret;
}
ret = elem.value;
return typeof ret === "string" ?
// handle most common string cases
ret.replace(rreturn, "") :
// handle cases where value is null/undef or number
ret == null ? "" : ret;
}
return;
}
isFunction = jQuery.isFunction(value);
return this.each(function (i) {
var val;
if (this.nodeType !== 1) {
return;
}
if (isFunction) {
val = value.call(this, i, jQuery(this).val());
} else {
val = value;
}
// Treat null/undefined as ""; convert numbers to string
if (val == null) {
val = "";
} else if (typeof val === "number") {
val += "";
} else if (jQuery.isArray(val)) {
val = jQuery.map(val, function (value) {
return value == null ? "" : value + "";
});
}
hooks = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()];
// If set returns undefined, fall back to normal setting
if (!hooks || !("set" in hooks) || hooks.set(this, val, "value") === undefined) {
this.value = val;
}
});
}
});
jQuery.extend({
valHooks: {
option: {
get: function (elem) {
var val = jQuery.find.attr(elem, "value");
return val != null ?
val :
// Support: IE10-11+
// option.text throws exceptions (#14686, #14858)
jQuery.trim(jQuery.text(elem));
}
},
select: {
get: function (elem) {
var value, option,
options = elem.options,
index = elem.selectedIndex,
one = elem.type === "select-one" || index < 0,
values = one ? null : [],
max = one ? index + 1 : options.length,
i = index < 0 ?
max :
one ? index : 0;
// Loop through all the selected options
for (; i < max; i++) {
option = options[i];
// IE6-9 doesn't update selected after form reset (#2551)
if (( option.selected || i === index ) &&
// Don't return options that are disabled or in a disabled optgroup
( support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) &&
( !option.parentNode.disabled || !jQuery.nodeName(option.parentNode, "optgroup") )) {
// Get the specific value for the option
value = jQuery(option).val();
// We don't need an array for one selects
if (one) {
return value;
}
// Multi-Selects return an array
values.push(value);
}
}
return values;
},
set: function (elem, value) {
var optionSet, option,
options = elem.options,
values = jQuery.makeArray(value),
i = options.length;
while (i--) {
option = options[i];
if ((option.selected = jQuery.inArray(option.value, values) >= 0)) {
optionSet = true;
}
}
// force browsers to behave consistently when non-matching value is set
if (!optionSet) {
elem.selectedIndex = -1;
}
return values;
}
}
}
});
// Radios and checkboxes getter/setter
jQuery.each(["radio", "checkbox"], function () {
jQuery.valHooks[this] = {
set: function (elem, value) {
if (jQuery.isArray(value)) {
return ( elem.checked = jQuery.inArray(jQuery(elem).val(), value) >= 0 );
}
}
};
if (!support.checkOn) {
jQuery.valHooks[this].get = function (elem) {
// Support: Webkit
// "" is returned instead of "on" if a value isn't specified
return elem.getAttribute("value") === null ? "on" : elem.value;
};
}
});
// Return jQuery for attributes-only inclusion
jQuery.each(("blur focus focusin focusout load resize scroll unload click dblclick " +
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
"change select submit keydown keypress keyup error contextmenu").split(" "), function (i, name) {
// Handle event binding
jQuery.fn[name] = function (data, fn) {
return arguments.length > 0 ?
this.on(name, null, data, fn) :
this.trigger(name);
};
});
jQuery.fn.extend({
hover: function (fnOver, fnOut) {
return this.mouseenter(fnOver).mouseleave(fnOut || fnOver);
},
bind: function (types, data, fn) {
return this.on(types, null, data, fn);
},
unbind: function (types, fn) {
return this.off(types, null, fn);
},
delegate: function (selector, types, data, fn) {
return this.on(types, selector, data, fn);
},
undelegate: function (selector, types, fn) {
// ( namespace ) or ( selector, types [, fn] )
return arguments.length === 1 ? this.off(selector, "**") : this.off(types, selector || "**", fn);
}
});
var nonce = jQuery.now();
var rquery = (/\?/);
// Support: Android 2.3
// Workaround failure to string-cast null input
jQuery.parseJSON = function (data) {
return JSON.parse(data + "");
};
// Cross-browser xml parsing
jQuery.parseXML = function (data) {
var xml, tmp;
if (!data || typeof data !== "string") {
return null;
}
// Support: IE9
try {
tmp = new DOMParser();
xml = tmp.parseFromString(data, "text/xml");
} catch (e) {
xml = undefined;
}
if (!xml || xml.getElementsByTagName("parsererror").length) {
jQuery.error("Invalid XML: " + data);
}
return xml;
};
var
// Document location
ajaxLocParts,
ajaxLocation,
rhash = /#.*$/,
rts = /([?&])_=[^&]*/,
rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
// #7653, #8125, #8152: local protocol detection
rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
rnoContent = /^(?:GET|HEAD)$/,
rprotocol = /^\/\//,
rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,
/* Prefilters
* 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
* 2) These are called:
* - BEFORE asking for a transport
* - AFTER param serialization (s.data is a string if s.processData is true)
* 3) key is the dataType
* 4) the catchall symbol "*" can be used
* 5) execution will start with transport dataType and THEN continue down to "*" if needed
*/
prefilters = {},
/* Transports bindings
* 1) key is the dataType
* 2) the catchall symbol "*" can be used
* 3) selection will start with transport dataType and THEN go to "*" if needed
*/
transports = {},
// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
allTypes = "*/".concat("*");
// #8138, IE may throw an exception when accessing
// a field from window.location if document.domain has been set
try {
ajaxLocation = location.href;
} catch (e) {
// Use the href attribute of an A element
// since IE will modify it given document.location
ajaxLocation = document.createElement("a");
ajaxLocation.href = "";
ajaxLocation = ajaxLocation.href;
}
// Segment location into parts
ajaxLocParts = rurl.exec(ajaxLocation.toLowerCase()) || [];
// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
function addToPrefiltersOrTransports(structure) {
// dataTypeExpression is optional and defaults to "*"
return function (dataTypeExpression, func) {
if (typeof dataTypeExpression !== "string") {
func = dataTypeExpression;
dataTypeExpression = "*";
}
var dataType,
i = 0,
dataTypes = dataTypeExpression.toLowerCase().match(rnotwhite) || [];
if (jQuery.isFunction(func)) {
// For each dataType in the dataTypeExpression
while ((dataType = dataTypes[i++])) {
// Prepend if requested
if (dataType[0] === "+") {
dataType = dataType.slice(1) || "*";
(structure[dataType] = structure[dataType] || []).unshift(func);
// Otherwise append
} else {
(structure[dataType] = structure[dataType] || []).push(func);
}
}
}
};
}
// Base inspection function for prefilters and transports
function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR) {
var inspected = {},
seekingTransport = ( structure === transports );
function inspect(dataType) {
var selected;
inspected[dataType] = true;
jQuery.each(structure[dataType] || [], function (_, prefilterOrFactory) {
var dataTypeOrTransport = prefilterOrFactory(options, originalOptions, jqXHR);
if (typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[dataTypeOrTransport]) {
options.dataTypes.unshift(dataTypeOrTransport);
inspect(dataTypeOrTransport);
return false;
} else if (seekingTransport) {
return !( selected = dataTypeOrTransport );
}
});
return selected;
}
return inspect(options.dataTypes[0]) || !inspected["*"] && inspect("*");
}
// A special extend for ajax options
// that takes "flat" options (not to be deep extended)
// Fixes #9887
function ajaxExtend(target, src) {
var key, deep,
flatOptions = jQuery.ajaxSettings.flatOptions || {};
for (key in src) {
if (src[key] !== undefined) {
( flatOptions[key] ? target : ( deep || (deep = {}) ) )[key] = src[key];
}
}
if (deep) {
jQuery.extend(true, target, deep);
}
return target;
}
/* Handles responses to an ajax request:
* - finds the right dataType (mediates between content-type and expected dataType)
* - returns the corresponding response
*/
function ajaxHandleResponses(s, jqXHR, responses) {
var ct, type, finalDataType, firstDataType,
contents = s.contents,
dataTypes = s.dataTypes;
// Remove auto dataType and get content-type in the process
while (dataTypes[0] === "*") {
dataTypes.shift();
if (ct === undefined) {
ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
}
}
// Check if we're dealing with a known content-type
if (ct) {
for (type in contents) {
if (contents[type] && contents[type].test(ct)) {
dataTypes.unshift(type);
break;
}
}
}
// Check to see if we have a response for the expected dataType
if (dataTypes[0] in responses) {
finalDataType = dataTypes[0];
} else {
// Try convertible dataTypes
for (type in responses) {
if (!dataTypes[0] || s.converters[type + " " + dataTypes[0]]) {
finalDataType = type;
break;
}
if (!firstDataType) {
firstDataType = type;
}
}
// Or just use first one
finalDataType = finalDataType || firstDataType;
}
// If we found a dataType
// We add the dataType to the list if needed
// and return the corresponding response
if (finalDataType) {
if (finalDataType !== dataTypes[0]) {
dataTypes.unshift(finalDataType);
}
return responses[finalDataType];
}
}
/* Chain conversions given the request and the original response
* Also sets the responseXXX fields on the jqXHR instance
*/
function ajaxConvert(s, response, jqXHR, isSuccess) {
var conv2, current, conv, tmp, prev,
converters = {},
// Work with a copy of dataTypes in case we need to modify it for conversion
dataTypes = s.dataTypes.slice();
// Create converters map with lowercased keys
if (dataTypes[1]) {
for (conv in s.converters) {
converters[conv.toLowerCase()] = s.converters[conv];
}
}
current = dataTypes.shift();
// Convert to each sequential dataType
while (current) {
if (s.responseFields[current]) {
jqXHR[s.responseFields[current]] = response;
}
// Apply the dataFilter if provided
if (!prev && isSuccess && s.dataFilter) {
response = s.dataFilter(response, s.dataType);
}
prev = current;
current = dataTypes.shift();
if (current) {
// There's only work to do if current dataType is non-auto
if (current === "*") {
current = prev;
// Convert response if prev dataType is non-auto and differs from current
} else if (prev !== "*" && prev !== current) {
// Seek a direct converter
conv = converters[prev + " " + current] || converters["* " + current];
// If none found, seek a pair
if (!conv) {
for (conv2 in converters) {
// If conv2 outputs current
tmp = conv2.split(" ");
if (tmp[1] === current) {
// If prev can be converted to accepted input
conv = converters[prev + " " + tmp[0]] ||
converters["* " + tmp[0]];
if (conv) {
// Condense equivalence converters
if (conv === true) {
conv = converters[conv2];
// Otherwise, insert the intermediate dataType
} else if (converters[conv2] !== true) {
current = tmp[0];
dataTypes.unshift(tmp[1]);
}
break;
}
}
}
}
// Apply converter (if not an equivalence)
if (conv !== true) {
// Unless errors are allowed to bubble, catch and return them
if (conv && s["throws"]) {
response = conv(response);
} else {
try {
response = conv(response);
} catch (e) {
return {
state: "parsererror",
error: conv ? e : "No conversion from " + prev + " to " + current
};
}
}
}
}
}
}
return {state: "success", data: response};
}
jQuery.extend({
// Counter for holding the number of active queries
active: 0,
// Last-Modified header cache for next request
lastModified: {},
etag: {},
ajaxSettings: {
url: ajaxLocation,
type: "GET",
isLocal: rlocalProtocol.test(ajaxLocParts[1]),
global: true,
processData: true,
async: true,
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
/*
timeout: 0,
data: null,
dataType: null,
username: null,
password: null,
cache: null,
throws: false,
traditional: false,
headers: {},
*/
accepts: {
"*": allTypes,
text: "text/plain",
html: "text/html",
xml: "application/xml, text/xml",
json: "application/json, text/javascript"
},
contents: {
xml: /xml/,
html: /html/,
json: /json/
},
responseFields: {
xml: "responseXML",
text: "responseText",
json: "responseJSON"
},
// Data converters
// Keys separate source (or catchall "*") and destination types with a single space
converters: {
// Convert anything to text
"* text": String,
// Text to html (true = no transformation)
"text html": true,
// Evaluate text as a json expression
"text json": jQuery.parseJSON,
// Parse text as xml
"text xml": jQuery.parseXML
},
// For options that shouldn't be deep extended:
// you can add your own custom options here if
// and when you create one that shouldn't be
// deep extended (see ajaxExtend)
flatOptions: {
url: true,
context: true
}
},
// Creates a full fledged settings object into target
// with both ajaxSettings and settings fields.
// If target is omitted, writes into ajaxSettings.
ajaxSetup: function (target, settings) {
return settings ?
// Building a settings object
ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings) :
// Extending ajaxSettings
ajaxExtend(jQuery.ajaxSettings, target);
},
ajaxPrefilter: addToPrefiltersOrTransports(prefilters),
ajaxTransport: addToPrefiltersOrTransports(transports),
// Main method
ajax: function (url, options) {
// If url is an object, simulate pre-1.5 signature
if (typeof url === "object") {
options = url;
url = undefined;
}
// Force options to be an object
options = options || {};
var transport,
// URL without anti-cache param
cacheURL,
// Response headers
responseHeadersString,
responseHeaders,
// timeout handle
timeoutTimer,
// Cross-domain detection vars
parts,
// To know if global events are to be dispatched
fireGlobals,
// Loop variable
i,
// Create the final options object
s = jQuery.ajaxSetup({}, options),
// Callbacks context
callbackContext = s.context || s,
// Context for global events is callbackContext if it is a DOM node or jQuery collection
globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
jQuery(callbackContext) :
jQuery.event,
// Deferreds
deferred = jQuery.Deferred(),
completeDeferred = jQuery.Callbacks("once memory"),
// Status-dependent callbacks
statusCode = s.statusCode || {},
// Headers (they are sent all at once)
requestHeaders = {},
requestHeadersNames = {},
// The jqXHR state
state = 0,
// Default abort message
strAbort = "canceled",
// Fake xhr
jqXHR = {
readyState: 0,
// Builds headers hashtable if needed
getResponseHeader: function (key) {
var match;
if (state === 2) {
if (!responseHeaders) {
responseHeaders = {};
while ((match = rheaders.exec(responseHeadersString))) {
responseHeaders[match[1].toLowerCase()] = match[2];
}
}
match = responseHeaders[key.toLowerCase()];
}
return match == null ? null : match;
},
// Raw string
getAllResponseHeaders: function () {
return state === 2 ? responseHeadersString : null;
},
// Caches the header
setRequestHeader: function (name, value) {
var lname = name.toLowerCase();
if (!state) {
name = requestHeadersNames[lname] = requestHeadersNames[lname] || name;
requestHeaders[name] = value;
}
return this;
},
// Overrides response content-type header
overrideMimeType: function (type) {
if (!state) {
s.mimeType = type;
}
return this;
},
// Status-dependent callbacks
statusCode: function (map) {
var code;
if (map) {
if (state < 2) {
for (code in map) {
// Lazy-add the new callback in a way that preserves old ones
statusCode[code] = [statusCode[code], map[code]];
}
} else {
// Execute the appropriate callbacks
jqXHR.always(map[jqXHR.status]);
}
}
return this;
},
// Cancel the request
abort: function (statusText) {
var finalText = statusText || strAbort;
if (transport) {
transport.abort(finalText);
}
done(0, finalText);
return this;
}
};
// Attach deferreds
deferred.promise(jqXHR).complete = completeDeferred.add;
jqXHR.success = jqXHR.done;
jqXHR.error = jqXHR.fail;
// Remove hash character (#7531: and string promotion)
// Add protocol if not provided (prefilters might expect it)
// Handle falsy url in the settings object (#10093: consistency with old signature)
// We also use the url parameter if available
s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace(rhash, "")
.replace(rprotocol, ajaxLocParts[1] + "//");
// Alias method option to type as per ticket #12004
s.type = options.method || options.type || s.method || s.type;
// Extract dataTypes list
s.dataTypes = jQuery.trim(s.dataType || "*").toLowerCase().match(rnotwhite) || [""];
// A cross-domain request is in order when we have a protocol:host:port mismatch
if (s.crossDomain == null) {
parts = rurl.exec(s.url.toLowerCase());
s.crossDomain = !!( parts &&
( parts[1] !== ajaxLocParts[1] || parts[2] !== ajaxLocParts[2] ||
( parts[3] || ( parts[1] === "http:" ? "80" : "443" ) ) !==
( ajaxLocParts[3] || ( ajaxLocParts[1] === "http:" ? "80" : "443" ) ) )
);
}
// Convert data if not already a string
if (s.data && s.processData && typeof s.data !== "string") {
s.data = jQuery.param(s.data, s.traditional);
}
// Apply prefilters
inspectPrefiltersOrTransports(prefilters, s, options, jqXHR);
// If request was aborted inside a prefilter, stop there
if (state === 2) {
return jqXHR;
}
// We can fire global events as of now if asked to
fireGlobals = s.global;
// Watch for a new set of requests
if (fireGlobals && jQuery.active++ === 0) {
jQuery.event.trigger("ajaxStart");
}
// Uppercase the type
s.type = s.type.toUpperCase();
// Determine if request has content
s.hasContent = !rnoContent.test(s.type);
// Save the URL in case we're toying with the If-Modified-Since
// and/or If-None-Match header later on
cacheURL = s.url;
// More options handling for requests with no content
if (!s.hasContent) {
// If data is available, append data to url
if (s.data) {
cacheURL = ( s.url += ( rquery.test(cacheURL) ? "&" : "?" ) + s.data );
// #9682: remove data so that it's not used in an eventual retry
delete s.data;
}
// Add anti-cache in url if needed
if (s.cache === false) {
s.url = rts.test(cacheURL) ?
// If there is already a '_' parameter, set its value
cacheURL.replace(rts, "$1_=" + nonce++) :
// Otherwise add one to the end
cacheURL + ( rquery.test(cacheURL) ? "&" : "?" ) + "_=" + nonce++;
}
}
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if (s.ifModified) {
if (jQuery.lastModified[cacheURL]) {
jqXHR.setRequestHeader("If-Modified-Since", jQuery.lastModified[cacheURL]);
}
if (jQuery.etag[cacheURL]) {
jqXHR.setRequestHeader("If-None-Match", jQuery.etag[cacheURL]);
}
}
// Set the correct header, if data is being sent
if (s.data && s.hasContent && s.contentType !== false || options.contentType) {
jqXHR.setRequestHeader("Content-Type", s.contentType);
}
// Set the Accepts header for the server, depending on the dataType
jqXHR.setRequestHeader(
"Accept",
s.dataTypes[0] && s.accepts[s.dataTypes[0]] ?
s.accepts[s.dataTypes[0]] + ( s.dataTypes[0] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
s.accepts["*"]
);
// Check for headers option
for (i in s.headers) {
jqXHR.setRequestHeader(i, s.headers[i]);
}
// Allow custom headers/mimetypes and early abort
if (s.beforeSend && ( s.beforeSend.call(callbackContext, jqXHR, s) === false || state === 2 )) {
// Abort if not done already and return
return jqXHR.abort();
}
// aborting is no longer a cancellation
strAbort = "abort";
// Install callbacks on deferreds
for (i in {success: 1, error: 1, complete: 1}) {
jqXHR[i](s[i]);
}
// Get transport
transport = inspectPrefiltersOrTransports(transports, s, options, jqXHR);
// If no transport, we auto-abort
if (!transport) {
done(-1, "No Transport");
} else {
jqXHR.readyState = 1;
// Send global event
if (fireGlobals) {
globalEventContext.trigger("ajaxSend", [jqXHR, s]);
}
// Timeout
if (s.async && s.timeout > 0) {
timeoutTimer = setTimeout(function () {
jqXHR.abort("timeout");
}, s.timeout);
}
try {
state = 1;
transport.send(requestHeaders, done);
} catch (e) {
// Propagate exception as error if not done
if (state < 2) {
done(-1, e);
// Simply rethrow otherwise
} else {
throw e;
}
}
}
// Callback for when everything is done
function done(status, nativeStatusText, responses, headers) {
var isSuccess, success, error, response, modified,
statusText = nativeStatusText;
// Called once
if (state === 2) {
return;
}
// State is "done" now
state = 2;
// Clear timeout if it exists
if (timeoutTimer) {
clearTimeout(timeoutTimer);
}
// Dereference transport for early garbage collection
// (no matter how long the jqXHR object will be used)
transport = undefined;
// Cache response headers
responseHeadersString = headers || "";
// Set readyState
jqXHR.readyState = status > 0 ? 4 : 0;
// Determine if successful
isSuccess = status >= 200 && status < 300 || status === 304;
// Get response data
if (responses) {
response = ajaxHandleResponses(s, jqXHR, responses);
}
// Convert no matter what (that way responseXXX fields are always set)
response = ajaxConvert(s, response, jqXHR, isSuccess);
// If successful, handle type chaining
if (isSuccess) {
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if (s.ifModified) {
modified = jqXHR.getResponseHeader("Last-Modified");
if (modified) {
jQuery.lastModified[cacheURL] = modified;
}
modified = jqXHR.getResponseHeader("etag");
if (modified) {
jQuery.etag[cacheURL] = modified;
}
}
// if no content
if (status === 204 || s.type === "HEAD") {
statusText = "nocontent";
// if not modified
} else if (status === 304) {
statusText = "notmodified";
// If we have data, let's convert it
} else {
statusText = response.state;
success = response.data;
error = response.error;
isSuccess = !error;
}
} else {
// We extract error from statusText
// then normalize statusText and status for non-aborts
error = statusText;
if (status || !statusText) {
statusText = "error";
if (status < 0) {
status = 0;
}
}
}
// Set data for the fake xhr object
jqXHR.status = status;
jqXHR.statusText = ( nativeStatusText || statusText ) + "";
// Success/Error
if (isSuccess) {
deferred.resolveWith(callbackContext, [success, statusText, jqXHR]);
} else {
deferred.rejectWith(callbackContext, [jqXHR, statusText, error]);
}
// Status-dependent callbacks
jqXHR.statusCode(statusCode);
statusCode = undefined;
if (fireGlobals) {
globalEventContext.trigger(isSuccess ? "ajaxSuccess" : "ajaxError",
[jqXHR, s, isSuccess ? success : error]);
}
// Complete
completeDeferred.fireWith(callbackContext, [jqXHR, statusText]);
if (fireGlobals) {
globalEventContext.trigger("ajaxComplete", [jqXHR, s]);
// Handle the global AJAX counter
if (!( --jQuery.active )) {
jQuery.event.trigger("ajaxStop");
}
}
}
return jqXHR;
},
getJSON: function (url, data, callback) {
return jQuery.get(url, data, callback, "json");
},
getScript: function (url, callback) {
return jQuery.get(url, undefined, callback, "script");
}
});
jQuery.each(["get", "post"], function (i, method) {
jQuery[method] = function (url, data, callback, type) {
// shift arguments if data argument was omitted
if (jQuery.isFunction(data)) {
type = type || callback;
callback = data;
data = undefined;
}
return jQuery.ajax({
url: url,
type: method,
dataType: type,
data: data,
success: callback
});
};
});
// Attach a bunch of functions for handling common AJAX events
jQuery.each(["ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend"], function (i, type) {
jQuery.fn[type] = function (fn) {
return this.on(type, fn);
};
});
jQuery._evalUrl = function (url) {
return jQuery.ajax({
url: url,
type: "GET",
dataType: "script",
async: false,
global: false,
"throws": true
});
};
jQuery.fn.extend({
wrapAll: function (html) {
var wrap;
if (jQuery.isFunction(html)) {
return this.each(function (i) {
jQuery(this).wrapAll(html.call(this, i));
});
}
if (this[0]) {
// The elements to wrap the target around
wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true);
if (this[0].parentNode) {
wrap.insertBefore(this[0]);
}
wrap.map(function () {
var elem = this;
while (elem.firstElementChild) {
elem = elem.firstElementChild;
}
return elem;
}).append(this);
}
return this;
},
wrapInner: function (html) {
if (jQuery.isFunction(html)) {
return this.each(function (i) {
jQuery(this).wrapInner(html.call(this, i));
});
}
return this.each(function () {
var self = jQuery(this),
contents = self.contents();
if (contents.length) {
contents.wrapAll(html);
} else {
self.append(html);
}
});
},
wrap: function (html) {
var isFunction = jQuery.isFunction(html);
return this.each(function (i) {
jQuery(this).wrapAll(isFunction ? html.call(this, i) : html);
});
},
unwrap: function () {
return this.parent().each(function () {
if (!jQuery.nodeName(this, "body")) {
jQuery(this).replaceWith(this.childNodes);
}
}).end();
}
});
jQuery.expr.filters.hidden = function (elem) {
// Support: Opera <= 12.12
// Opera reports offsetWidths and offsetHeights less than zero on some elements
return elem.offsetWidth <= 0 && elem.offsetHeight <= 0;
};
jQuery.expr.filters.visible = function (elem) {
return !jQuery.expr.filters.hidden(elem);
};
var r20 = /%20/g,
rbracket = /\[\]$/,
rCRLF = /\r?\n/g,
rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
rsubmittable = /^(?:input|select|textarea|keygen)/i;
function buildParams(prefix, obj, traditional, add) {
var name;
if (jQuery.isArray(obj)) {
// Serialize array item.
jQuery.each(obj, function (i, v) {
if (traditional || rbracket.test(prefix)) {
// Treat each array item as a scalar.
add(prefix, v);
} else {
// Item is non-scalar (array or object), encode its numeric index.
buildParams(prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add);
}
});
} else if (!traditional && jQuery.type(obj) === "object") {
// Serialize object item.
for (name in obj) {
buildParams(prefix + "[" + name + "]", obj[name], traditional, add);
}
} else {
// Serialize scalar item.
add(prefix, obj);
}
}
// Serialize an array of form elements or a set of
// key/values into a query string
jQuery.param = function (a, traditional) {
var prefix,
s = [],
add = function (key, value) {
// If value is a function, invoke it and return its value
value = jQuery.isFunction(value) ? value() : ( value == null ? "" : value );
s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
};
// Set traditional to true for jQuery <= 1.3.2 behavior.
if (traditional === undefined) {
traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
}
// If an array was passed in, assume that it is an array of form elements.
if (jQuery.isArray(a) || ( a.jquery && !jQuery.isPlainObject(a) )) {
// Serialize the form elements
jQuery.each(a, function () {
add(this.name, this.value);
});
} else {
// If traditional, encode the "old" way (the way 1.3.2 or older
// did it), otherwise encode params recursively.
for (prefix in a) {
buildParams(prefix, a[prefix], traditional, add);
}
}
// Return the resulting serialization
return s.join("&").replace(r20, "+");
};
jQuery.fn.extend({
serialize: function () {
return jQuery.param(this.serializeArray());
},
serializeArray: function () {
return this.map(function () {
// Can add propHook for "elements" to filter or add form elements
var elements = jQuery.prop(this, "elements");
return elements ? jQuery.makeArray(elements) : this;
})
.filter(function () {
var type = this.type;
// Use .is( ":disabled" ) so that fieldset[disabled] works
return this.name && !jQuery(this).is(":disabled") &&
rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type) &&
( this.checked || !rcheckableType.test(type) );
})
.map(function (i, elem) {
var val = jQuery(this).val();
return val == null ?
null :
jQuery.isArray(val) ?
jQuery.map(val, function (val) {
return {name: elem.name, value: val.replace(rCRLF, "\r\n")};
}) :
{name: elem.name, value: val.replace(rCRLF, "\r\n")};
}).get();
}
});
jQuery.ajaxSettings.xhr = function () {
try {
return new XMLHttpRequest();
} catch (e) {
}
};
var xhrId = 0,
xhrCallbacks = {},
xhrSuccessStatus = {
// file protocol always yields status code 0, assume 200
0: 200,
// Support: IE9
// #1450: sometimes IE returns 1223 when it should be 204
1223: 204
},
xhrSupported = jQuery.ajaxSettings.xhr();
// Support: IE9
// Open requests must be manually aborted on unload (#5280)
if (window.ActiveXObject) {
jQuery(window).on("unload", function () {
for (var key in xhrCallbacks) {
xhrCallbacks[key]();
}
});
}
support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
support.ajax = xhrSupported = !!xhrSupported;
jQuery.ajaxTransport(function (options) {
var callback;
// Cross domain only allowed if supported through XMLHttpRequest
if (support.cors || xhrSupported && !options.crossDomain) {
return {
send: function (headers, complete) {
var i,
xhr = options.xhr(),
id = ++xhrId;
xhr.open(options.type, options.url, options.async, options.username, options.password);
// Apply custom fields if provided
if (options.xhrFields) {
for (i in options.xhrFields) {
xhr[i] = options.xhrFields[i];
}
}
// Override mime type if needed
if (options.mimeType && xhr.overrideMimeType) {
xhr.overrideMimeType(options.mimeType);
}
// X-Requested-With header
// For cross-domain requests, seeing as conditions for a preflight are
// akin to a jigsaw puzzle, we simply never set it to be sure.
// (it can always be set on a per-request basis or even using ajaxSetup)
// For same-domain requests, won't change header if already provided.
if (!options.crossDomain && !headers["X-Requested-With"]) {
headers["X-Requested-With"] = "XMLHttpRequest";
}
// Set headers
for (i in headers) {
xhr.setRequestHeader(i, headers[i]);
}
// Callback
callback = function (type) {
return function () {
if (callback) {
delete xhrCallbacks[id];
callback = xhr.onload = xhr.onerror = null;
if (type === "abort") {
xhr.abort();
} else if (type === "error") {
complete(
// file: protocol always yields status 0; see #8605, #14207
xhr.status,
xhr.statusText
);
} else {
complete(
xhrSuccessStatus[xhr.status] || xhr.status,
xhr.statusText,
// Support: IE9
// Accessing binary-data responseText throws an exception
// (#11426)
typeof xhr.responseText === "string" ? {
text: xhr.responseText
} : undefined,
xhr.getAllResponseHeaders()
);
}
}
};
};
// Listen to events
xhr.onload = callback();
xhr.onerror = callback("error");
// Create the abort callback
callback = xhrCallbacks[id] = callback("abort");
try {
// Do send the request (this may raise an exception)
xhr.send(options.hasContent && options.data || null);
} catch (e) {
// #14683: Only rethrow if this hasn't been notified as an error yet
if (callback) {
throw e;
}
}
},
abort: function () {
if (callback) {
callback();
}
}
};
}
});
// Install script dataType
jQuery.ajaxSetup({
accepts: {
script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
},
contents: {
script: /(?:java|ecma)script/
},
converters: {
"text script": function (text) {
jQuery.globalEval(text);
return text;
}
}
});
// Handle cache's special case and crossDomain
jQuery.ajaxPrefilter("script", function (s) {
if (s.cache === undefined) {
s.cache = false;
}
if (s.crossDomain) {
s.type = "GET";
}
});
// Bind script tag hack transport
jQuery.ajaxTransport("script", function (s) {
// This transport only deals with cross domain requests
if (s.crossDomain) {
var script, callback;
return {
send: function (_, complete) {
script = jQuery("<script>").prop({
async: true,
charset: s.scriptCharset,
src: s.url
}).on(
"load error",
callback = function (evt) {
script.remove();
callback = null;
if (evt) {
complete(evt.type === "error" ? 404 : 200, evt.type);
}
}
);
document.head.appendChild(script[0]);
},
abort: function () {
if (callback) {
callback();
}
}
};
}
});
var oldCallbacks = [],
rjsonp = /(=)\?(?=&|$)|\?\?/;
// Default jsonp settings
jQuery.ajaxSetup({
jsonp: "callback",
jsonpCallback: function () {
var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
this[callback] = true;
return callback;
}
});
// Detect, normalize options and install callbacks for jsonp requests
jQuery.ajaxPrefilter("json jsonp", function (s, originalSettings, jqXHR) {
var callbackName, overwritten, responseContainer,
jsonProp = s.jsonp !== false && ( rjsonp.test(s.url) ?
"url" :
typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test(s.data) && "data"
);
// Handle iff the expected data type is "jsonp" or we have a parameter to set
if (jsonProp || s.dataTypes[0] === "jsonp") {
// Get callback name, remembering preexisting value associated with it
callbackName = s.jsonpCallback = jQuery.isFunction(s.jsonpCallback) ?
s.jsonpCallback() :
s.jsonpCallback;
// Insert callback into url or form data
if (jsonProp) {
s[jsonProp] = s[jsonProp].replace(rjsonp, "$1" + callbackName);
} else if (s.jsonp !== false) {
s.url += ( rquery.test(s.url) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
}
// Use data converter to retrieve json after script execution
s.converters["script json"] = function () {
if (!responseContainer) {
jQuery.error(callbackName + " was not called");
}
return responseContainer[0];
};
// force json dataType
s.dataTypes[0] = "json";
// Install callback
overwritten = window[callbackName];
window[callbackName] = function () {
responseContainer = arguments;
};
// Clean-up function (fires after converters)
jqXHR.always(function () {
// Restore preexisting value
window[callbackName] = overwritten;
// Save back as free
if (s[callbackName]) {
// make sure that re-using the options doesn't screw things around
s.jsonpCallback = originalSettings.jsonpCallback;
// save the callback name for future use
oldCallbacks.push(callbackName);
}
// Call if it was a function and we have a response
if (responseContainer && jQuery.isFunction(overwritten)) {
overwritten(responseContainer[0]);
}
responseContainer = overwritten = undefined;
});
// Delegate to script
return "script";
}
});
// data: string of html
// context (optional): If specified, the fragment will be created in this context, defaults to document
// keepScripts (optional): If true, will include scripts passed in the html string
jQuery.parseHTML = function (data, context, keepScripts) {
if (!data || typeof data !== "string") {
return null;
}
if (typeof context === "boolean") {
keepScripts = context;
context = false;
}
context = context || document;
var parsed = rsingleTag.exec(data),
scripts = !keepScripts && [];
// Single tag
if (parsed) {
return [context.createElement(parsed[1])];
}
parsed = jQuery.buildFragment([data], context, scripts);
if (scripts && scripts.length) {
jQuery(scripts).remove();
}
return jQuery.merge([], parsed.childNodes);
};
// Keep a copy of the old load method
var _load = jQuery.fn.load;
/**
* Load a url into a page
*/
jQuery.fn.load = function (url, params, callback) {
if (typeof url !== "string" && _load) {
return _load.apply(this, arguments);
}
var selector, type, response,
self = this,
off = url.indexOf(" ");
if (off >= 0) {
selector = jQuery.trim(url.slice(off));
url = url.slice(0, off);
}
// If it's a function
if (jQuery.isFunction(params)) {
// We assume that it's the callback
callback = params;
params = undefined;
// Otherwise, build a param string
} else if (params && typeof params === "object") {
type = "POST";
}
// If we have elements to modify, make the request
if (self.length > 0) {
jQuery.ajax({
url: url,
// if "type" variable is undefined, then "GET" method will be used
type: type,
dataType: "html",
data: params
}).done(function (responseText) {
// Save response for use in complete callback
response = arguments;
self.html(selector ?
// If a selector was specified, locate the right elements in a dummy div
// Exclude scripts to avoid IE 'Permission Denied' errors
jQuery("<div>").append(jQuery.parseHTML(responseText)).find(selector) :
// Otherwise use the full result
responseText);
}).complete(callback && function (jqXHR, status) {
self.each(callback, response || [jqXHR.responseText, status, jqXHR]);
});
}
return this;
};
jQuery.expr.filters.animated = function (elem) {
return jQuery.grep(jQuery.timers, function (fn) {
return elem === fn.elem;
}).length;
};
var docElem = window.document.documentElement;
/**
* Gets a window from an element
*/
function getWindow(elem) {
return jQuery.isWindow(elem) ? elem : elem.nodeType === 9 && elem.defaultView;
}
jQuery.offset = {
setOffset: function (elem, options, i) {
var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
position = jQuery.css(elem, "position"),
curElem = jQuery(elem),
props = {};
// Set position first, in-case top/left are set even on static elem
if (position === "static") {
elem.style.position = "relative";
}
curOffset = curElem.offset();
curCSSTop = jQuery.css(elem, "top");
curCSSLeft = jQuery.css(elem, "left");
calculatePosition = ( position === "absolute" || position === "fixed" ) &&
( curCSSTop + curCSSLeft ).indexOf("auto") > -1;
// Need to be able to calculate position if either top or left is auto and position is either absolute or fixed
if (calculatePosition) {
curPosition = curElem.position();
curTop = curPosition.top;
curLeft = curPosition.left;
} else {
curTop = parseFloat(curCSSTop) || 0;
curLeft = parseFloat(curCSSLeft) || 0;
}
if (jQuery.isFunction(options)) {
options = options.call(elem, i, curOffset);
}
if (options.top != null) {
props.top = ( options.top - curOffset.top ) + curTop;
}
if (options.left != null) {
props.left = ( options.left - curOffset.left ) + curLeft;
}
if ("using" in options) {
options.using.call(elem, props);
} else {
curElem.css(props);
}
}
};
jQuery.fn.extend({
offset: function (options) {
if (arguments.length) {
return options === undefined ?
this :
this.each(function (i) {
jQuery.offset.setOffset(this, options, i);
});
}
var docElem, win,
elem = this[0],
box = {top: 0, left: 0},
doc = elem && elem.ownerDocument;
if (!doc) {
return;
}
docElem = doc.documentElement;
// Make sure it's not a disconnected DOM node
if (!jQuery.contains(docElem, elem)) {
return box;
}
// If we don't have gBCR, just use 0,0 rather than error
// BlackBerry 5, iOS 3 (original iPhone)
if (typeof elem.getBoundingClientRect !== strundefined) {
box = elem.getBoundingClientRect();
}
win = getWindow(doc);
return {
top: box.top + win.pageYOffset - docElem.clientTop,
left: box.left + win.pageXOffset - docElem.clientLeft
};
},
position: function () {
if (!this[0]) {
return;
}
var offsetParent, offset,
elem = this[0],
parentOffset = {top: 0, left: 0};
// Fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is its only offset parent
if (jQuery.css(elem, "position") === "fixed") {
// We assume that getBoundingClientRect is available when computed position is fixed
offset = elem.getBoundingClientRect();
} else {
// Get *real* offsetParent
offsetParent = this.offsetParent();
// Get correct offsets
offset = this.offset();
if (!jQuery.nodeName(offsetParent[0], "html")) {
parentOffset = offsetParent.offset();
}
// Add offsetParent borders
parentOffset.top += jQuery.css(offsetParent[0], "borderTopWidth", true);
parentOffset.left += jQuery.css(offsetParent[0], "borderLeftWidth", true);
}
// Subtract parent offsets and element margins
return {
top: offset.top - parentOffset.top - jQuery.css(elem, "marginTop", true),
left: offset.left - parentOffset.left - jQuery.css(elem, "marginLeft", true)
};
},
offsetParent: function () {
return this.map(function () {
var offsetParent = this.offsetParent || docElem;
while (offsetParent && ( !jQuery.nodeName(offsetParent, "html") && jQuery.css(offsetParent, "position") === "static" )) {
offsetParent = offsetParent.offsetParent;
}
return offsetParent || docElem;
});
}
});
// Create scrollLeft and scrollTop methods
jQuery.each({scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function (method, prop) {
var top = "pageYOffset" === prop;
jQuery.fn[method] = function (val) {
return access(this, function (elem, method, val) {
var win = getWindow(elem);
if (val === undefined) {
return win ? win[prop] : elem[method];
}
if (win) {
win.scrollTo(
!top ? val : window.pageXOffset,
top ? val : window.pageYOffset
);
} else {
elem[method] = val;
}
}, method, val, arguments.length, null);
};
});
// Add the top/left cssHooks using jQuery.fn.position
// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
// getComputedStyle returns percent when specified for top/left/bottom/right
// rather than make the css module depend on the offset module, we just check for it here
jQuery.each(["top", "left"], function (i, prop) {
jQuery.cssHooks[prop] = addGetHookIf(support.pixelPosition,
function (elem, computed) {
if (computed) {
computed = curCSS(elem, prop);
// if curCSS returns percentage, fallback to offset
return rnumnonpx.test(computed) ?
jQuery(elem).position()[prop] + "px" :
computed;
}
}
);
});
// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
jQuery.each({Height: "height", Width: "width"}, function (name, type) {
jQuery.each({padding: "inner" + name, content: type, "": "outer" + name}, function (defaultExtra, funcName) {
// margin is only for outerHeight, outerWidth
jQuery.fn[funcName] = function (margin, value) {
var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
return access(this, function (elem, type, value) {
var doc;
if (jQuery.isWindow(elem)) {
// As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
// isn't a whole lot we can do. See pull request at this URL for discussion:
// https://github.com/jquery/jquery/pull/764
return elem.document.documentElement["client" + name];
}
// Get document width or height
if (elem.nodeType === 9) {
doc = elem.documentElement;
// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
// whichever is greatest
return Math.max(
elem.body["scroll" + name], doc["scroll" + name],
elem.body["offset" + name], doc["offset" + name],
doc["client" + name]
);
}
return value === undefined ?
// Get width or height on the element, requesting but not forcing parseFloat
jQuery.css(elem, type, extra) :
// Set width or height on the element
jQuery.style(elem, type, value, extra);
}, type, chainable ? margin : undefined, chainable, null);
};
});
});
// The number of elements contained in the matched element set
jQuery.fn.size = function () {
return this.length;
};
jQuery.fn.andSelf = jQuery.fn.addBack;
// Register as a named AMD module, since jQuery can be concatenated with other
// files that may use define, but not via a proper concatenation script that
// understands anonymous AMD modules. A named AMD is safest and most robust
// way to register. Lowercase jquery is used because AMD module names are
// derived from file names, and jQuery is normally delivered in a lowercase
// file name. Do this after creating the global so that if an AMD module wants
// to call noConflict to hide this version of jQuery, it will work.
// Note that for maximum portability, libraries that are not jQuery should
// declare themselves as anonymous modules, and avoid setting a global if an
// AMD loader is present. jQuery is a special case. For more information, see
// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
if (typeof define === "function" && define.amd) {
define("jquery", [], function () {
return jQuery;
});
}
var
// Map over jQuery in case of overwrite
_jQuery = window.jQuery,
// Map over the $ in case of overwrite
_$ = window.$;
jQuery.noConflict = function (deep) {
if (window.$ === jQuery) {
window.$ = _$;
}
if (deep && window.jQuery === jQuery) {
window.jQuery = _jQuery;
}
return jQuery;
};
// Expose jQuery and $ identifiers, even in
// AMD (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
// and CommonJS for browser emulators (#13566)
if (typeof noGlobal === strundefined) {
window.jQuery = window.$ = jQuery;
}
return jQuery;
}));
| {
"content_hash": "5ae2d718cbea1623c830bfd11cc719ac",
"timestamp": "",
"source": "github",
"line_count": 9154,
"max_line_length": 187,
"avg_line_length": 37.67828271793751,
"alnum_prop": 0.43805431609100426,
"repo_name": "a7000q/tagera.ru",
"id": "02a8bc6cfcf201bbf7a7142f2c5df0157bae8b2b",
"size": "345188",
"binary": false,
"copies": "7",
"ref": "refs/heads/master",
"path": "frontend/web/theme/assets/plugins/autocomplete/jquery-2.1.1.js",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Batchfile",
"bytes": "1541"
},
{
"name": "CSS",
"bytes": "723863"
},
{
"name": "HTML",
"bytes": "1899273"
},
{
"name": "JavaScript",
"bytes": "2790230"
},
{
"name": "PHP",
"bytes": "310412"
},
{
"name": "Shell",
"bytes": "3257"
}
],
"symlink_target": ""
} |
NAME=server
# the location of the vcproj that builds the mod
MOD_PROJ="../game/server/server_scratch-2005.vcxproj"
# the name of the mod configuration (typically <proj name>_<build type><build target>)
MOD_CONFIG="ServerSDK_DebugWin32"
# the directory the base binaries (tier0_i486.so, etc) are located
# this should point to your orange box subfolder of where you have srcds installed.
GAME_DIR="/home/roman/hlserver/files/orangebox"
# the path to your mods directory
# set this so that 'make install' or 'make installrelease' will copy your binary over automatically.
MOD_DIR=$(GAME_DIR)/ios_dev
# compiler options (gcc 3.4.1 will work - 4.2.2 recommended)
CC="gcc"
CPLUS="g++"
CLINK="gcc"
CPP_LIB="/usr/lib/gcc/i486-linux-gnu/4.2.4/libstdc++.a /usr/lib/gcc/i486-linux-gnu/4.2.4/libgcc_eh.a"
# GCC 4.2.2 optimization flags, if you're using anything below, don't use these!
OPTFLAGS=-O1 -fomit-frame-pointer -ffast-math -fforce-addr -funroll-loops -fthread-jumps -fcrossjumping -foptimize-sibling-calls -fcse-follow-jumps -fcse-skip-blocks -fgcse -fgcse-lm -fexpensive-optimizations -frerun-cse-after-loop -fcaller-saves -fpeephole2 -fschedule-insns2 -fsched-interblock -fsched-spec -fregmove -fstrict-overflow -fdelete-null-pointer-checks -freorder-blocks -freorder-functions -falign-functions -falign-jumps -falign-loops -falign-labels -ftree-vrp -ftree-pre -finline-functions -funswitch-loops -fgcse-after-reload
#OPTFLAGS=
# put any compiler flags you want passed here
USER_CFLAGS=
# Link Libraries
LIBFILES= \
$(SOURCE_DIR)/lib/linux/tier1_486.a \
$(SOURCE_DIR)/lib/linux/choreoobjects_486.a \
$(SOURCE_DIR)/lib/linux/particles_486.a \
$(SOURCE_DIR)/lib/linux/dmxloader_486.a \
tier0_i486.so \
vstdlib_i486.so \
steam_api_i486.so \
$(SOURCE_DIR)/lib/linux/tier3_486.a \
$(SOURCE_DIR)/lib/linux/tier2_486.a \
$(SOURCE_DIR)/lib/linux/tier1_486.a \
$(SOURCE_DIR)/lib/linux/mathlib_486.a \
# link flags for your mod, make sure to include any special libraries here
#NOTE: YES we want to include the lib files 2 times. We've run into problems with the 1-pass linker not bringing in symbols it should.
LDFLAGS="-lm -ldl $(LIBFILES) $(LIBFILES)"
# XERCES 2.6.0 or above ( http://xml.apache.org/xerces-c/ ) is used by the vcproj to makefile converter
# it must be installed before being able to run this makefile
# if you have xerces installed already you should be able to use the two lines below
XERCES_INC_DIR=/usr/include
XERCES_LIB_DIR=/usr/lib
#############################################################################
# Things below here shouldn't need to be altered
#############################################################################
MAKE=make
# the dir we want to put binaries we build into
BUILD_DIR=.
# the place to put object files
BUILD_OBJ_DIR=$(BUILD_DIR)/obj
# the location of the source code
SOURCE_DIR=..
# the CPU target for the build, must be i486 for now
ARCH=i486
ARCH_CFLAGS=-mtune=i686 -march=pentium -mmmx -msse -pipe
# -fpermissive is so gcc 3.4.x doesn't complain about some template stuff
BASE_CFLAGS=-DVPROF_LEVEL=1 -DSWDS -D_LINUX -DLINUX -DNDEBUG -fpermissive -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp
SHLIBEXT=so
SHLIBCFLAGS=-fPIC
SHLIBLDFLAGS=-shared -Wl,-Map,$@_map.txt -Wl
#flags passed to the compiler
CFLAGS="$(USER_CFLAGS) $(DEFINES) $(ARCH_CFLAGS) $(OPTFLAGS) $(BASE_CFLAGS) -Usprintf=use_Q_snprintf_instead_of_sprintf -Ustrncpy=use_Q_strncpy_instead -Ufopen=dont_use_fopen -UPROTECTED_THINGS_ENABLE"
# define list passed to make for the sub makefile
BASE_DEFINES=CC=$(CC) CPLUS=$(CPLUS) CPP_LIB=$(CPP_LIB) \
BUILD_DIR=$(BUILD_DIR) BUILD_OBJ_DIR=$(BUILD_OBJ_DIR) \
SOURCE_DIR=$(SOURCE_DIR) SHLIBLDFLAGS=$(SHLIBLDFLAGS) SHLIBEXT=$(SHLIBEXT) \
CLINK=$(CLINK) CFLAGS=$(CFLAGS) LDFLAGS=$(LDFLAGS) \
ARCH=$(ARCH) GAME_DIR=$(GAME_DIR) MOD_CONFIG=$(MOD_CONFIG) NAME=$(NAME) \
XERCES_INC_DIR=$(XERCES_INC_DIR) XERCES_LIB_DIR=$(XERCES_LIB_DIR)
# Project Makefile
MAKE_MOD=Makefile.server
MAKE_VCPM=Makefile.vcpm
MAKE_PLUGIN=Makefile.plugin
ll: check vcpm server
check:
if [ -z "$(CC)" ]; then echo "Compiler not defined."; exit; fi
if [ ! -d $(BUILD_DIR) ];then mkdir $(BUILD_DIR);fi
cd $(BUILD_DIR)
vcpm:
$(MAKE) -f $(MAKE_VCPM) $(BASE_DEFINES)
server: vcpm
if [ ! -f "tier0_i486.so" ]; then ln -s $(GAME_DIR)/bin/tier0_i486.so .; fi
if [ ! -f "vstdlib_i486.so" ]; then ln -s $(GAME_DIR)/bin/vstdlib_i486.so .; fi
if [ ! -f "steam_api_i486.so" ]; then ln -s $(GAME_DIR)/bin/steam_api_i486.so .; fi
# When running over samba we need to copy the files because symlinking isn't possible.
# cp -f $(GAME_DIR)/bin/tier0_i486.so .
# cp -f $(GAME_DIR)/bin/vstdlib_i486.so .
# cp -f $(GAME_DIR)/bin/steam_api_i486.so .
./vcpm $(MOD_PROJ)
$(MAKE) -f $(MAKE_MOD) $(BASE_DEFINES)
plugin:
$(MAKE) -f $(MAKE_PLUGIN) $(BASE_DEFINES)
clean:
$(MAKE) -f $(MAKE_VCPM) $(BASE_DEFINES) clean
$(MAKE) -f $(MAKE_PLUGIN) $(BASE_DEFINES) clean
$(MAKE) -f $(MAKE_MOD) $(BASE_DEFINES) clean
install:
cp -f $(NAME)_$(ARCH).so $(MOD_DIR)/bin/$(NAME)_$(ARCH).so
installrelease:
cp -f $(NAME)_$(ARCH).so $(MOD_DIR)/bin/$(NAME)_$(ARCH).so
strip $(MOD_DIR)/bin/$(NAME)_$(ARCH).so
| {
"content_hash": "3dedc86d8e5c5f7c99318f175fb56265",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 541,
"avg_line_length": 40.42748091603053,
"alnum_prop": 0.6952416918429003,
"repo_name": "iosoccer/iosoccer-game",
"id": "48f457f04cb49a47c83c41f7fa76193b75b36f37",
"size": "5583",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "linux_sdk/Makefile",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "8889"
},
{
"name": "C",
"bytes": "690977"
},
{
"name": "C++",
"bytes": "35120239"
},
{
"name": "GLSL",
"bytes": "90651"
},
{
"name": "Makefile",
"bytes": "15124"
},
{
"name": "Objective-C",
"bytes": "147413"
},
{
"name": "Perl",
"bytes": "93735"
},
{
"name": "Perl6",
"bytes": "221"
}
],
"symlink_target": ""
} |
"""
Check for unique lists within an array
"""
def unique_list(array, elements_to_check=0):
"""
:param array: Array of lists to be checked
:param elements_to_check: range of numbers corresponding to indices of list
:return: new unique array
"""
n_rows = len(array)
unique_array = []
if elements_to_check == 0:
elements = range(len(array[0]))
else:
elements = elements_to_check
# for each row
for i in range(n_rows):
row_a = array[i]
equal_row = False
# for all subsequent rows
for j in range(i + 1, n_rows):
row_b = array[j]
# check if each element in rows are equal, breaking after finding even one unequal element
for k in elements:
equal_element = True
if row_a[k] != row_b[k]:
equal_element = False
break
if equal_element == True:
equal_row = True
break
if equal_row == True:
pass
# append all unique rows to new array
else:
unique_array.append(row_a)
return unique_array
| {
"content_hash": "1062bbba3de15aa9c737e84d5ba6f0cf",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 102,
"avg_line_length": 18.46153846153846,
"alnum_prop": 0.525,
"repo_name": "nitikayad96/chandra_suli",
"id": "b1eea5882475eb66db26bc598f49ab9ae42adc75",
"size": "1200",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "chandra_suli/unique_list.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Python",
"bytes": "139543"
}
],
"symlink_target": ""
} |
package com.squareup.wire.schema;
import com.squareup.wire.schema.internal.Util;
import com.squareup.wire.schema.internal.parser.ExtensionsElement;
final class Extensions {
private final ExtensionsElement element;
Extensions(ExtensionsElement element) {
this.element = element;
}
public Location location() {
return element.location();
}
public String documentation() {
return element.documentation();
}
public int start() {
return element.start();
}
public int end() {
return element.end();
}
void validate(Linker linker) {
if (!Util.isValidTag(start()) || !Util.isValidTag(end())) {
linker.withContext(this).addError("tags are out of range: %s to %s", start(), end());
}
}
}
| {
"content_hash": "91d3433d6c0e2106a408ed7dd3cabe02",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 91,
"avg_line_length": 21.314285714285713,
"alnum_prop": 0.6796246648793566,
"repo_name": "pforhan/wire",
"id": "80ca94642956e928fa0639ba51f9e25ca38c65c7",
"size": "1341",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "wire-schema/src/main/java/com/squareup/wire/schema/Extensions.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "1506604"
},
{
"name": "Protocol Buffer",
"bytes": "64617"
},
{
"name": "Shell",
"bytes": "3737"
}
],
"symlink_target": ""
} |
.class Lcom/sec/android/app/camera/Camera$33;
.super Ljava/lang/Object;
.source "Camera.java"
# interfaces
.implements Landroid/widget/CompoundButton$OnCheckedChangeListener;
# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
value = Lcom/sec/android/app/camera/Camera;->showFaceZoomGuideDialog()V
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x0
name = null
.end annotation
# instance fields
.field final synthetic this$0:Lcom/sec/android/app/camera/Camera;
# direct methods
.method constructor <init>(Lcom/sec/android/app/camera/Camera;)V
.locals 0
.parameter
.prologue
.line 6910
iput-object p1, p0, Lcom/sec/android/app/camera/Camera$33;->this$0:Lcom/sec/android/app/camera/Camera;
invoke-direct/range {p0 .. p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
# virtual methods
.method public onCheckedChanged(Landroid/widget/CompoundButton;Z)V
.locals 4
.parameter "arg0"
.parameter "arg1"
.prologue
const/4 v1, 0x0
.line 6912
iget-object v2, p0, Lcom/sec/android/app/camera/Camera$33;->this$0:Lcom/sec/android/app/camera/Camera;
iget-object v0, p0, Lcom/sec/android/app/camera/Camera$33;->this$0:Lcom/sec/android/app/camera/Camera;
const-string v3, "audio"
invoke-virtual {v0, v3}, Lcom/sec/android/app/camera/Camera;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Landroid/media/AudioManager;
#setter for: Lcom/sec/android/app/camera/Camera;->mAudioManager:Landroid/media/AudioManager;
invoke-static {v2, v0}, Lcom/sec/android/app/camera/Camera;->access$1702(Lcom/sec/android/app/camera/Camera;Landroid/media/AudioManager;)Landroid/media/AudioManager;
.line 6913
iget-object v0, p0, Lcom/sec/android/app/camera/Camera$33;->this$0:Lcom/sec/android/app/camera/Camera;
#getter for: Lcom/sec/android/app/camera/Camera;->mAudioManager:Landroid/media/AudioManager;
invoke-static {v0}, Lcom/sec/android/app/camera/Camera;->access$1700(Lcom/sec/android/app/camera/Camera;)Landroid/media/AudioManager;
move-result-object v0
invoke-virtual {v0, v1}, Landroid/media/AudioManager;->playSoundEffect(I)V
.line 6914
iget-object v0, p0, Lcom/sec/android/app/camera/Camera$33;->this$0:Lcom/sec/android/app/camera/Camera;
invoke-virtual {v0}, Lcom/sec/android/app/camera/Camera;->getCameraSettings()Lcom/sec/android/app/camera/CameraSettings;
move-result-object v2
if-eqz p2, :cond_0
const/4 v0, 0x1
:goto_0
invoke-virtual {v2, v0}, Lcom/sec/android/app/camera/CameraSettings;->setFaceZoomHelpTextDialog(I)V
.line 6915
return-void
:cond_0
move v0, v1
.line 6914
goto :goto_0
.end method
| {
"content_hash": "5b5fbc6e3d4c406122b6e0cd8c6e0ae6",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 169,
"avg_line_length": 29.09375,
"alnum_prop": 0.7278911564625851,
"repo_name": "baidurom/devices-n7108",
"id": "7e1aa8d038745a9c89aa4905880652abd24b4fe3",
"size": "2793",
"binary": false,
"copies": "1",
"ref": "refs/heads/coron-4.1",
"path": "SamsungCamera/smali/com/sec/android/app/camera/Camera$33.smali",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Makefile",
"bytes": "12697"
},
{
"name": "Shell",
"bytes": "1974"
}
],
"symlink_target": ""
} |
gRPC Hello World Tutorial (Android Java)
========================
BACKGROUND
-------------
For this sample, we've already generated the server and client stubs from [helloworld.proto](https://github.com/grpc/grpc-common/blob/master/protos/helloworld.proto).
PREREQUISITES
-------------
- [Java gRPC](https://github.com/grpc/grpc-java)
- [Android Tutorial](https://developer.android.com/training/basics/firstapp/index.html) if you're new to Android development
- We only have Android gRPC client in this example. Please follow examples in other languages to build and run a gRPC server.
INSTALL
-------
**1 Clone the gRPC Java git repo**
```sh
$ git clone https://github.com/grpc/grpc-java
```
**2 Install gRPC Java, as described in [How to Build](https://github.com/grpc/grpc-java#how-to-build)**
```sh
$ # from this dir
$ cd grpc-java
$ # follow the instructions in 'How to Build'
```
**3 [Create an Android project](https://developer.android.com/training/basics/firstapp/creating-project.html) under your working directory.**
- Set Application name to "Helloworld Example" and set Company Domain to "grpc.io". Make sure your package name is "io.grpc.helloworldexample"
- Choose appropriate minimum SDK
- Use Blank Activity
- Set Activity Name to HelloworldActivity
- Set Layout Name to activity_helloworld
**4 Prepare the app**
- Clone this git repo
```sh
$ git clone https://github.com/grpc/grpc-common
```
- Replace the generated HelloworldActivity.java and activity_helloworld.xml with the two files in this repo
- Copy GreeterGrpc.java and Helloworld.java under your_app_dir/app/src/main/java/io/grpc/examples/
- In your AndroidManifest.xml, make sure you have
```sh
<uses-permission android:name="android.permission.INTERNET" />
```
added outside your appplication tag
**5 Add dependencies. gRPC Java on Android depends on grpc-java, protobuf nano, okhttp**
- Copy grpc-java .jar files to your_app_dir/app/libs
```sh
$ cp grpc-java/core/build/libs/*.jar your_app_dir/app/libs/
$ cp grpc-java/stub/build/libs/*.jar your_app_dir/app/libs/
$ cp grpc-java/nano/build/libs/*.jar your_app_dir/app/libs/
$ cp grpc-java/okhttp/build/libs/*.jar your_app_dir/app/libs/
```
- Copy or download other dependencies to your_app_dir/app/libs/
- [Guava 18](http://search.maven.org/remotecontent?filepath=com/google/guava/guava/18.0/guava-18.0.jar)
- [okhttp 2.2.0](http://repo1.maven.org/maven2/com/squareup/okhttp/okhttp/2.2.0/okhttp-2.2.0.jar)
- [okio](http://search.maven.org/remotecontent?filepath=com/squareup/okio/okio/1.2.0/okio-1.2.0.jar)
- [jsr305](http://search.maven.org/remotecontent?filepath=com/google/code/findbugs/jsr305/3.0.0/jsr305-3.0.0.jar)
- protobuf nano:
```sh
$ cp ~/.m2/repository/com/google/protobuf/nano/protobuf-javanano/3.0.0-alpha-2/protobuf-javanano-3.0.0-alpha-2.jar your_app_dir/app/libs/
```
- Make sure your_app_dir/app/build.gradle contains:
```sh
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
```
**6 [Run your Helloworld Example app](https://developer.android.com/training/basics/firstapp/running-app.html)**
| {
"content_hash": "7e1517be13918c80bdf5800332dd025e",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 167,
"avg_line_length": 41.12,
"alnum_prop": 0.7308690012970168,
"repo_name": "mbrukman/grpc-common",
"id": "1b6b8193466d8903afb0c4262bed6f1bfd2e7567",
"size": "3084",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "java/android/README.md",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C++",
"bytes": "28446"
},
{
"name": "Go",
"bytes": "7236"
},
{
"name": "Java",
"bytes": "10533"
},
{
"name": "JavaScript",
"bytes": "19533"
},
{
"name": "Makefile",
"bytes": "7598"
},
{
"name": "Protocol Buffer",
"bytes": "20960"
},
{
"name": "Python",
"bytes": "15775"
},
{
"name": "Ruby",
"bytes": "20780"
},
{
"name": "Shell",
"bytes": "1482"
}
],
"symlink_target": ""
} |
using System;
using System.Runtime.InteropServices;
using System.Text;
#if !SILVERLIGHT
using System.Drawing.Imaging;
using System.Drawing;
#endif
namespace ZXing.Common
{
/// <summary> A class which wraps a 2D array of bytes. The default usage is signed. If you want to use it as a
/// unsigned container, it's up to you to do byteValue & 0xff at each location.
///
/// JAVAPORT: The original code was a 2D array of ints, but since it only ever gets assigned
/// -1, 0, and 1, I'm going to use less memory and go with bytes.
///
/// </summary>
/// <author> [email protected] (Daniel Switkin)
/// </author>
/// <author>www.Redivivus.in ([email protected]) - Ported from ZXING Java Source
/// </author>
public sealed class ByteMatrix
{
public int Height { get; private set; }
public int Width { get; private set; }
public sbyte[][] Array { get; private set; }
public ByteMatrix(int width, int height)
{
Array = new sbyte[height][];
for (int i = 0; i < height; i++)
{
Array[i] = new sbyte[width];
}
Width = width;
Height = height;
}
public void set_Renamed(int x, int y, sbyte value)
{
Array[y][x] = value;
}
public int this[int x, int y]
{
get
{
return Array[y][x];
}
set
{
Array[y][x] = (sbyte)value;
}
}
public void clear(sbyte value)
{
for (int y = 0; y < Height; ++y)
{
for (int x = 0; x < Width; ++x)
{
Array[y][x] = value;
}
}
}
public override String ToString()
{
var result = new StringBuilder(2 * Width * Height + 2);
for (int y = 0; y < Height; ++y)
{
for (int x = 0; x < Width; ++x)
{
switch (Array[y][x])
{
case 0:
result.Append(" 0");
break;
case 1:
result.Append(" 1");
break;
default:
result.Append(" ");
break;
}
}
result.Append('\n');
}
return result.ToString();
}
#if !SILVERLIGHT
/// <summary>
/// Converts this ByteMatrix to a black and white bitmap.
/// </summary>
/// <returns>A black and white bitmap converted from this ByteMatrix.</returns>
public Bitmap ToBitmap()
{
const byte BLACK = 0;
const byte WHITE = 255;
sbyte[][] array = this.Array;
int width = this.Width;
int height = this.Height;
byte[] pixels = new byte[width * height];
for (int y = 0; y < height; y++)
{
int offset = y * width;
for (int x = 0; x < width; x++)
{
pixels[offset + x] = array[y][x] == 0 ? BLACK : WHITE;
}
}
//Here create the Bitmap to the known height, width and format
Bitmap bmp = new Bitmap(width, height, PixelFormat.Format8bppIndexed);
//Create a BitmapData and Lock all pixels to be written
BitmapData bmpData =
bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height),
ImageLockMode.WriteOnly, bmp.PixelFormat);
//Copy the data from the byte array into BitmapData.Scan0
Marshal.Copy(pixels, 0, bmpData.Scan0, pixels.Length);
//Unlock the pixels
bmp.UnlockBits(bmpData);
//Return the bitmap
return bmp;
}
#endif
}
}
| {
"content_hash": "8693fb5ce694b0d220945c0db85bf897",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 113,
"avg_line_length": 26.41958041958042,
"alnum_prop": 0.49364743250397036,
"repo_name": "DigitalPlatform/dp2",
"id": "e20157725d2057dd5054821069fda36c6881f38b",
"size": "4361",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "zxing_lib/common/ByteMatrix.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ASP.NET",
"bytes": "80547"
},
{
"name": "Batchfile",
"bytes": "7192"
},
{
"name": "C#",
"bytes": "56347865"
},
{
"name": "CSS",
"bytes": "818819"
},
{
"name": "HTML",
"bytes": "1914736"
},
{
"name": "JavaScript",
"bytes": "152102"
},
{
"name": "PHP",
"bytes": "30185"
},
{
"name": "Roff",
"bytes": "1879"
},
{
"name": "Smalltalk",
"bytes": "48625"
},
{
"name": "XSLT",
"bytes": "64230"
}
],
"symlink_target": ""
} |
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/cloud/vision/v1p1beta1/image_annotator.proto
package com.google.cloud.vision.v1p1beta1;
/**
* <pre>
* Single crop hint that is used to generate a new crop when serving an image.
* </pre>
*
* Protobuf type {@code google.cloud.vision.v1p1beta1.CropHint}
*/
public final class CropHint extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:google.cloud.vision.v1p1beta1.CropHint)
CropHintOrBuilder {
private static final long serialVersionUID = 0L;
// Use CropHint.newBuilder() to construct.
private CropHint(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private CropHint() {
confidence_ = 0F;
importanceFraction_ = 0F;
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private CropHint(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownFieldProto3(
input, unknownFields, extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
com.google.cloud.vision.v1p1beta1.BoundingPoly.Builder subBuilder = null;
if (boundingPoly_ != null) {
subBuilder = boundingPoly_.toBuilder();
}
boundingPoly_ = input.readMessage(com.google.cloud.vision.v1p1beta1.BoundingPoly.parser(), extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(boundingPoly_);
boundingPoly_ = subBuilder.buildPartial();
}
break;
}
case 21: {
confidence_ = input.readFloat();
break;
}
case 29: {
importanceFraction_ = input.readFloat();
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.google.cloud.vision.v1p1beta1.ImageAnnotatorProto.internal_static_google_cloud_vision_v1p1beta1_CropHint_descriptor;
}
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.google.cloud.vision.v1p1beta1.ImageAnnotatorProto.internal_static_google_cloud_vision_v1p1beta1_CropHint_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.google.cloud.vision.v1p1beta1.CropHint.class, com.google.cloud.vision.v1p1beta1.CropHint.Builder.class);
}
public static final int BOUNDING_POLY_FIELD_NUMBER = 1;
private com.google.cloud.vision.v1p1beta1.BoundingPoly boundingPoly_;
/**
* <pre>
* The bounding polygon for the crop region. The coordinates of the bounding
* box are in the original image's scale, as returned in `ImageParams`.
* </pre>
*
* <code>.google.cloud.vision.v1p1beta1.BoundingPoly bounding_poly = 1;</code>
*/
public boolean hasBoundingPoly() {
return boundingPoly_ != null;
}
/**
* <pre>
* The bounding polygon for the crop region. The coordinates of the bounding
* box are in the original image's scale, as returned in `ImageParams`.
* </pre>
*
* <code>.google.cloud.vision.v1p1beta1.BoundingPoly bounding_poly = 1;</code>
*/
public com.google.cloud.vision.v1p1beta1.BoundingPoly getBoundingPoly() {
return boundingPoly_ == null ? com.google.cloud.vision.v1p1beta1.BoundingPoly.getDefaultInstance() : boundingPoly_;
}
/**
* <pre>
* The bounding polygon for the crop region. The coordinates of the bounding
* box are in the original image's scale, as returned in `ImageParams`.
* </pre>
*
* <code>.google.cloud.vision.v1p1beta1.BoundingPoly bounding_poly = 1;</code>
*/
public com.google.cloud.vision.v1p1beta1.BoundingPolyOrBuilder getBoundingPolyOrBuilder() {
return getBoundingPoly();
}
public static final int CONFIDENCE_FIELD_NUMBER = 2;
private float confidence_;
/**
* <pre>
* Confidence of this being a salient region. Range [0, 1].
* </pre>
*
* <code>float confidence = 2;</code>
*/
public float getConfidence() {
return confidence_;
}
public static final int IMPORTANCE_FRACTION_FIELD_NUMBER = 3;
private float importanceFraction_;
/**
* <pre>
* Fraction of importance of this salient region with respect to the original
* image.
* </pre>
*
* <code>float importance_fraction = 3;</code>
*/
public float getImportanceFraction() {
return importanceFraction_;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (boundingPoly_ != null) {
output.writeMessage(1, getBoundingPoly());
}
if (confidence_ != 0F) {
output.writeFloat(2, confidence_);
}
if (importanceFraction_ != 0F) {
output.writeFloat(3, importanceFraction_);
}
unknownFields.writeTo(output);
}
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (boundingPoly_ != null) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(1, getBoundingPoly());
}
if (confidence_ != 0F) {
size += com.google.protobuf.CodedOutputStream
.computeFloatSize(2, confidence_);
}
if (importanceFraction_ != 0F) {
size += com.google.protobuf.CodedOutputStream
.computeFloatSize(3, importanceFraction_);
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof com.google.cloud.vision.v1p1beta1.CropHint)) {
return super.equals(obj);
}
com.google.cloud.vision.v1p1beta1.CropHint other = (com.google.cloud.vision.v1p1beta1.CropHint) obj;
boolean result = true;
result = result && (hasBoundingPoly() == other.hasBoundingPoly());
if (hasBoundingPoly()) {
result = result && getBoundingPoly()
.equals(other.getBoundingPoly());
}
result = result && (
java.lang.Float.floatToIntBits(getConfidence())
== java.lang.Float.floatToIntBits(
other.getConfidence()));
result = result && (
java.lang.Float.floatToIntBits(getImportanceFraction())
== java.lang.Float.floatToIntBits(
other.getImportanceFraction()));
result = result && unknownFields.equals(other.unknownFields);
return result;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
if (hasBoundingPoly()) {
hash = (37 * hash) + BOUNDING_POLY_FIELD_NUMBER;
hash = (53 * hash) + getBoundingPoly().hashCode();
}
hash = (37 * hash) + CONFIDENCE_FIELD_NUMBER;
hash = (53 * hash) + java.lang.Float.floatToIntBits(
getConfidence());
hash = (37 * hash) + IMPORTANCE_FRACTION_FIELD_NUMBER;
hash = (53 * hash) + java.lang.Float.floatToIntBits(
getImportanceFraction());
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static com.google.cloud.vision.v1p1beta1.CropHint parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.cloud.vision.v1p1beta1.CropHint parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.cloud.vision.v1p1beta1.CropHint parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.cloud.vision.v1p1beta1.CropHint parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.cloud.vision.v1p1beta1.CropHint parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.cloud.vision.v1p1beta1.CropHint parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.cloud.vision.v1p1beta1.CropHint parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static com.google.cloud.vision.v1p1beta1.CropHint parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static com.google.cloud.vision.v1p1beta1.CropHint parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static com.google.cloud.vision.v1p1beta1.CropHint parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static com.google.cloud.vision.v1p1beta1.CropHint parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static com.google.cloud.vision.v1p1beta1.CropHint parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(com.google.cloud.vision.v1p1beta1.CropHint prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* <pre>
* Single crop hint that is used to generate a new crop when serving an image.
* </pre>
*
* Protobuf type {@code google.cloud.vision.v1p1beta1.CropHint}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:google.cloud.vision.v1p1beta1.CropHint)
com.google.cloud.vision.v1p1beta1.CropHintOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.google.cloud.vision.v1p1beta1.ImageAnnotatorProto.internal_static_google_cloud_vision_v1p1beta1_CropHint_descriptor;
}
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.google.cloud.vision.v1p1beta1.ImageAnnotatorProto.internal_static_google_cloud_vision_v1p1beta1_CropHint_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.google.cloud.vision.v1p1beta1.CropHint.class, com.google.cloud.vision.v1p1beta1.CropHint.Builder.class);
}
// Construct using com.google.cloud.vision.v1p1beta1.CropHint.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}
}
public Builder clear() {
super.clear();
if (boundingPolyBuilder_ == null) {
boundingPoly_ = null;
} else {
boundingPoly_ = null;
boundingPolyBuilder_ = null;
}
confidence_ = 0F;
importanceFraction_ = 0F;
return this;
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.google.cloud.vision.v1p1beta1.ImageAnnotatorProto.internal_static_google_cloud_vision_v1p1beta1_CropHint_descriptor;
}
public com.google.cloud.vision.v1p1beta1.CropHint getDefaultInstanceForType() {
return com.google.cloud.vision.v1p1beta1.CropHint.getDefaultInstance();
}
public com.google.cloud.vision.v1p1beta1.CropHint build() {
com.google.cloud.vision.v1p1beta1.CropHint result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public com.google.cloud.vision.v1p1beta1.CropHint buildPartial() {
com.google.cloud.vision.v1p1beta1.CropHint result = new com.google.cloud.vision.v1p1beta1.CropHint(this);
if (boundingPolyBuilder_ == null) {
result.boundingPoly_ = boundingPoly_;
} else {
result.boundingPoly_ = boundingPolyBuilder_.build();
}
result.confidence_ = confidence_;
result.importanceFraction_ = importanceFraction_;
onBuilt();
return result;
}
public Builder clone() {
return (Builder) super.clone();
}
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return (Builder) super.setField(field, value);
}
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return (Builder) super.clearField(field);
}
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return (Builder) super.clearOneof(oneof);
}
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, java.lang.Object value) {
return (Builder) super.setRepeatedField(field, index, value);
}
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return (Builder) super.addRepeatedField(field, value);
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.google.cloud.vision.v1p1beta1.CropHint) {
return mergeFrom((com.google.cloud.vision.v1p1beta1.CropHint)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.google.cloud.vision.v1p1beta1.CropHint other) {
if (other == com.google.cloud.vision.v1p1beta1.CropHint.getDefaultInstance()) return this;
if (other.hasBoundingPoly()) {
mergeBoundingPoly(other.getBoundingPoly());
}
if (other.getConfidence() != 0F) {
setConfidence(other.getConfidence());
}
if (other.getImportanceFraction() != 0F) {
setImportanceFraction(other.getImportanceFraction());
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
public final boolean isInitialized() {
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.google.cloud.vision.v1p1beta1.CropHint parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.google.cloud.vision.v1p1beta1.CropHint) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private com.google.cloud.vision.v1p1beta1.BoundingPoly boundingPoly_ = null;
private com.google.protobuf.SingleFieldBuilderV3<
com.google.cloud.vision.v1p1beta1.BoundingPoly, com.google.cloud.vision.v1p1beta1.BoundingPoly.Builder, com.google.cloud.vision.v1p1beta1.BoundingPolyOrBuilder> boundingPolyBuilder_;
/**
* <pre>
* The bounding polygon for the crop region. The coordinates of the bounding
* box are in the original image's scale, as returned in `ImageParams`.
* </pre>
*
* <code>.google.cloud.vision.v1p1beta1.BoundingPoly bounding_poly = 1;</code>
*/
public boolean hasBoundingPoly() {
return boundingPolyBuilder_ != null || boundingPoly_ != null;
}
/**
* <pre>
* The bounding polygon for the crop region. The coordinates of the bounding
* box are in the original image's scale, as returned in `ImageParams`.
* </pre>
*
* <code>.google.cloud.vision.v1p1beta1.BoundingPoly bounding_poly = 1;</code>
*/
public com.google.cloud.vision.v1p1beta1.BoundingPoly getBoundingPoly() {
if (boundingPolyBuilder_ == null) {
return boundingPoly_ == null ? com.google.cloud.vision.v1p1beta1.BoundingPoly.getDefaultInstance() : boundingPoly_;
} else {
return boundingPolyBuilder_.getMessage();
}
}
/**
* <pre>
* The bounding polygon for the crop region. The coordinates of the bounding
* box are in the original image's scale, as returned in `ImageParams`.
* </pre>
*
* <code>.google.cloud.vision.v1p1beta1.BoundingPoly bounding_poly = 1;</code>
*/
public Builder setBoundingPoly(com.google.cloud.vision.v1p1beta1.BoundingPoly value) {
if (boundingPolyBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
boundingPoly_ = value;
onChanged();
} else {
boundingPolyBuilder_.setMessage(value);
}
return this;
}
/**
* <pre>
* The bounding polygon for the crop region. The coordinates of the bounding
* box are in the original image's scale, as returned in `ImageParams`.
* </pre>
*
* <code>.google.cloud.vision.v1p1beta1.BoundingPoly bounding_poly = 1;</code>
*/
public Builder setBoundingPoly(
com.google.cloud.vision.v1p1beta1.BoundingPoly.Builder builderForValue) {
if (boundingPolyBuilder_ == null) {
boundingPoly_ = builderForValue.build();
onChanged();
} else {
boundingPolyBuilder_.setMessage(builderForValue.build());
}
return this;
}
/**
* <pre>
* The bounding polygon for the crop region. The coordinates of the bounding
* box are in the original image's scale, as returned in `ImageParams`.
* </pre>
*
* <code>.google.cloud.vision.v1p1beta1.BoundingPoly bounding_poly = 1;</code>
*/
public Builder mergeBoundingPoly(com.google.cloud.vision.v1p1beta1.BoundingPoly value) {
if (boundingPolyBuilder_ == null) {
if (boundingPoly_ != null) {
boundingPoly_ =
com.google.cloud.vision.v1p1beta1.BoundingPoly.newBuilder(boundingPoly_).mergeFrom(value).buildPartial();
} else {
boundingPoly_ = value;
}
onChanged();
} else {
boundingPolyBuilder_.mergeFrom(value);
}
return this;
}
/**
* <pre>
* The bounding polygon for the crop region. The coordinates of the bounding
* box are in the original image's scale, as returned in `ImageParams`.
* </pre>
*
* <code>.google.cloud.vision.v1p1beta1.BoundingPoly bounding_poly = 1;</code>
*/
public Builder clearBoundingPoly() {
if (boundingPolyBuilder_ == null) {
boundingPoly_ = null;
onChanged();
} else {
boundingPoly_ = null;
boundingPolyBuilder_ = null;
}
return this;
}
/**
* <pre>
* The bounding polygon for the crop region. The coordinates of the bounding
* box are in the original image's scale, as returned in `ImageParams`.
* </pre>
*
* <code>.google.cloud.vision.v1p1beta1.BoundingPoly bounding_poly = 1;</code>
*/
public com.google.cloud.vision.v1p1beta1.BoundingPoly.Builder getBoundingPolyBuilder() {
onChanged();
return getBoundingPolyFieldBuilder().getBuilder();
}
/**
* <pre>
* The bounding polygon for the crop region. The coordinates of the bounding
* box are in the original image's scale, as returned in `ImageParams`.
* </pre>
*
* <code>.google.cloud.vision.v1p1beta1.BoundingPoly bounding_poly = 1;</code>
*/
public com.google.cloud.vision.v1p1beta1.BoundingPolyOrBuilder getBoundingPolyOrBuilder() {
if (boundingPolyBuilder_ != null) {
return boundingPolyBuilder_.getMessageOrBuilder();
} else {
return boundingPoly_ == null ?
com.google.cloud.vision.v1p1beta1.BoundingPoly.getDefaultInstance() : boundingPoly_;
}
}
/**
* <pre>
* The bounding polygon for the crop region. The coordinates of the bounding
* box are in the original image's scale, as returned in `ImageParams`.
* </pre>
*
* <code>.google.cloud.vision.v1p1beta1.BoundingPoly bounding_poly = 1;</code>
*/
private com.google.protobuf.SingleFieldBuilderV3<
com.google.cloud.vision.v1p1beta1.BoundingPoly, com.google.cloud.vision.v1p1beta1.BoundingPoly.Builder, com.google.cloud.vision.v1p1beta1.BoundingPolyOrBuilder>
getBoundingPolyFieldBuilder() {
if (boundingPolyBuilder_ == null) {
boundingPolyBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
com.google.cloud.vision.v1p1beta1.BoundingPoly, com.google.cloud.vision.v1p1beta1.BoundingPoly.Builder, com.google.cloud.vision.v1p1beta1.BoundingPolyOrBuilder>(
getBoundingPoly(),
getParentForChildren(),
isClean());
boundingPoly_ = null;
}
return boundingPolyBuilder_;
}
private float confidence_ ;
/**
* <pre>
* Confidence of this being a salient region. Range [0, 1].
* </pre>
*
* <code>float confidence = 2;</code>
*/
public float getConfidence() {
return confidence_;
}
/**
* <pre>
* Confidence of this being a salient region. Range [0, 1].
* </pre>
*
* <code>float confidence = 2;</code>
*/
public Builder setConfidence(float value) {
confidence_ = value;
onChanged();
return this;
}
/**
* <pre>
* Confidence of this being a salient region. Range [0, 1].
* </pre>
*
* <code>float confidence = 2;</code>
*/
public Builder clearConfidence() {
confidence_ = 0F;
onChanged();
return this;
}
private float importanceFraction_ ;
/**
* <pre>
* Fraction of importance of this salient region with respect to the original
* image.
* </pre>
*
* <code>float importance_fraction = 3;</code>
*/
public float getImportanceFraction() {
return importanceFraction_;
}
/**
* <pre>
* Fraction of importance of this salient region with respect to the original
* image.
* </pre>
*
* <code>float importance_fraction = 3;</code>
*/
public Builder setImportanceFraction(float value) {
importanceFraction_ = value;
onChanged();
return this;
}
/**
* <pre>
* Fraction of importance of this salient region with respect to the original
* image.
* </pre>
*
* <code>float importance_fraction = 3;</code>
*/
public Builder clearImportanceFraction() {
importanceFraction_ = 0F;
onChanged();
return this;
}
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFieldsProto3(unknownFields);
}
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:google.cloud.vision.v1p1beta1.CropHint)
}
// @@protoc_insertion_point(class_scope:google.cloud.vision.v1p1beta1.CropHint)
private static final com.google.cloud.vision.v1p1beta1.CropHint DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new com.google.cloud.vision.v1p1beta1.CropHint();
}
public static com.google.cloud.vision.v1p1beta1.CropHint getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<CropHint>
PARSER = new com.google.protobuf.AbstractParser<CropHint>() {
public CropHint parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new CropHint(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser<CropHint> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<CropHint> getParserForType() {
return PARSER;
}
public com.google.cloud.vision.v1p1beta1.CropHint getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
| {
"content_hash": "62db9ad0a28726d892b2f3147af658c6",
"timestamp": "",
"source": "github",
"line_count": 796,
"max_line_length": 190,
"avg_line_length": 34.62437185929648,
"alnum_prop": 0.6697144515801313,
"repo_name": "pongad/api-client-staging",
"id": "e07d7a843b2e16d5f42bf19890c4bfd777f816c3",
"size": "27561",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "generated/java/proto-google-cloud-vision-v1p1beta1/src/main/java/com/google/cloud/vision/v1p1beta1/CropHint.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Java",
"bytes": "10561078"
},
{
"name": "JavaScript",
"bytes": "890945"
},
{
"name": "PHP",
"bytes": "9761909"
},
{
"name": "Python",
"bytes": "1395608"
},
{
"name": "Shell",
"bytes": "592"
}
],
"symlink_target": ""
} |
function [fmri, vol, vol_size] = CBIG_MSHBM_read_fmri(fmri_name)
% [fmri, vol, vol_size] = CBIG_MSHBM_read_fmri(fmri_name)
% Given the name of functional MRI file (fmri_name), this function read in
% the fmri structure and the content of signals (vol) or functional
% connectivity matrix.
%
% Input:
% - fmri_name:
% The full path of input file name.
%
% Output:
% - fmri:
% The structure read in by MRIread() or ft_read_cifti(), or a simple
% .mat file contain the functional connectivity profile matrix
% profile_mat. To save the memory, fmri.vol (for NIFTI) or
% fmri.dtseries (for CIFTI) is set to be empty after it is transfered
% to "vol".
%
% - vol:
% A num_voxels x num_timepoints matrix which is the content of
% fmri.vol (for NIFTI) or fmri.dtseries (for CIFTI) after reshape or
% A num_voxels x num_ROIs matrix which is the functional
% connectivity.
%
% - vol_size:
% The size of fmri.vol (NIFTI) or fmri.dtseries (CIFTI) or FC.
%
% Example:
% [~, vol, ~] = CBIG_MSHBM_read_fmri('lh.subj01.fsaverage5_roifsaverage3_BI.surf2surf_profile_cen.nii.gz');
%
% Written by Ru(by) Kong and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md
if (~isempty(strfind(fmri_name, '.mat')))
load(fmri_name);
vol = single(profile_mat);
vol_size = size(vol);
profile_mat = [];
fmri = [];
elseif (isempty(strfind(fmri_name, '.dtseries.nii')))
% if input file is NIFTI file
fmri = MRIread(fmri_name);
vol = single(fmri.vol);
vol_size = size(vol);
vol = reshape(vol, prod(vol_size(1:3)), prod(vol_size)/prod(vol_size(1:3)));
fmri.vol = [];
else
% if input file is CIFTI file
fmri = ft_read_cifti(fmri_name);
vol = single(fmri.dtseries);
vol_size = size(vol);
fmri.dtseries = [];
end
end | {
"content_hash": "627d237fc61566a138d70e440f14a34b",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 112,
"avg_line_length": 33.267857142857146,
"alnum_prop": 0.6446591519055287,
"repo_name": "ThomasYeoLab/CBIG",
"id": "607cee9b34022e5ed34803740f202cddc5bb0fc5",
"size": "1863",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "stable_projects/brain_parcellation/Kong2019_MSHBM/lib/CBIG_MSHBM_read_fmri.m",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "35378"
},
{
"name": "C",
"bytes": "2076236"
},
{
"name": "C++",
"bytes": "1461097"
},
{
"name": "CSS",
"bytes": "6852"
},
{
"name": "Fortran",
"bytes": "598090"
},
{
"name": "HTML",
"bytes": "287918"
},
{
"name": "Jupyter Notebook",
"bytes": "569200"
},
{
"name": "MATLAB",
"bytes": "10013692"
},
{
"name": "Makefile",
"bytes": "7902"
},
{
"name": "Objective-C",
"bytes": "77"
},
{
"name": "PostScript",
"bytes": "8416"
},
{
"name": "Python",
"bytes": "2499129"
},
{
"name": "R",
"bytes": "33929"
},
{
"name": "Shell",
"bytes": "1923688"
},
{
"name": "TeX",
"bytes": "8993"
},
{
"name": "Vim Script",
"bytes": "2859"
},
{
"name": "XSLT",
"bytes": "19506"
}
],
"symlink_target": ""
} |
module MailManager
class Contact < ActiveRecord::Base
self.table_name = "#{MailManager.table_prefix}contacts"
has_many :messages, :class_name => 'MailManager::Message'
belongs_to :contactable, :polymorphic => true
#not working for some reasom
#accepts_nested_attributes_for :subscriptions
validates_presence_of :email_address
#validates_format_of :email_address, :with => Authentication.email_regex,
# :message => Authentication.bad_email_message, :allow_nil => true
validates_format_of :email_address, :with => /\A([\w+\-].?)+@[a-z\d\-]+(\.[a-z]+)*\.[a-z]+\z/i, :allow_nil => true
before_validation :trim_fields
include MailManager::ContactableRegistry::Contactable
include Deleteable
attr_protected :id
def contact
self
end
def trim_fields
[:first_name, :last_name, :email_address].each do |field|
self[field].gsub!(/\A\s*|\s*\Z/,'') if self[field].present?
end
end
scope :search, lambda{|params|
conditions = ["deleted_at IS NULL"]
joins = {}
unless params[:term].blank?
conditions[0] += " AND (#{params[:term].split(/\s+/).collect{ |term|
term = "%#{term}%";
3.times{conditions << term}
"(first_name like ? OR last_name like ? OR email_address like ?)"
}.join(' OR ')})"
end
if params[:mailing_list_id].present?
joins = {joins: "INNER JOIN #{MailManager.table_prefix}subscriptions s ON
s.contact_id=#{MailManager.table_prefix}contacts.id AND s.mailing_list_id=#{params[:mailing_list_id].to_i}"}
end
unless params[:status].blank? || params[:mailing_list_id].blank?
conditions[0] += " AND status=?"
conditions << params[:status]
end
conditions = {
:conditions => conditions,
:order => 'last_name, first_name, email_address'
}
conditions.merge!(joins) if params[:mailing_list_id].present?
conditions
}
scope :active, lambda {{:conditions => "#{table_name}.deleted_at IS NULL"}}
default_scope :order => 'last_name, first_name, email_address'
def email_address_with_name
return %Q|"#{full_name}" <#{email_address}>|.gsub(/\s+/,' ') unless full_name.eql?('')
email_address
end
def full_name
"#{first_name} #{last_name}".strip
end
def deleted?
!deleted_at.nil?
end
def self.signup(params)
contact = Contact.active.find_by_email_address(params['email_address'])
contact ||= Contact.new
Rails.logger.debug "Updating contact(#{contact.new_record? ? "New" : contact.id}) params: #{params.inspect}"
contact.update_attributes(params)
contact
end
def double_opt_in(mailing_list_ids)
previously_active_subscriptions = subscriptions.select(&:"active?")
new_subscriptions = subscriptions.select do |s|
mailing_list_ids.include?(s.mailing_list_id.to_s)
end
if new_subscriptions.present?
new_subscriptions.each{|subscription| subscription.change_status(:pending)}
self.delay.deliver_double_opt_in
end
nil
end
def deliver_double_opt_in
Mailer.double_opt_in(self).deliver
end
def double_opt_in_url
"#{MailManager.site_url}#{MailManager.double_opt_in_path}/#{login_token}"
end
def self.inject_contact_id(token,id)
token = token.split('')
id_string = id.to_s.split('')
new_token = ""
0.upto(39) do |index|
new_token << token.pop
new_token << id_string.shift unless id_string.blank?
end
new_token
end
def self.extract_contact_id(token)
token = token.split('')
id_string = ""
0.upto(token.length - 41) do |index|
token.shift
id_string << token.shift
end
id_string.to_i
end
def self.find_by_token(token)
Contact.find_by_id(Contact::extract_contact_id(token))
end
def login_token
self[:login_token] ||= generate_login_token
end
def authorized?(token)
login_token.eql?(token) and login_token_created_at > 2.days.ago
end
def initialize_subscriptions
@subscriptions = new_record? ? [] : Subscription.find_all_by_contact_id(self.id)
MailingList.active.each do |list|
next if @subscriptions.detect{|subscription| subscription.mailing_list_id.eql?(list.id) }
Rails.logger.warn "Building Subscription for Mailing List #{list.name}"
subscription = Subscription.new(:contact => self)
subscription.mailing_list_id = list.id
subscription.change_status((self.new_record? and list.defaults_to_active?) ? :active : :pending,false)
@subscriptions << subscription
end
@subscriptions = subscriptions.reject{|subscription| subscription.mailing_list.try(:inactive?) or
subscription.mailing_list.nil?}.sort_by{|subscription|
subscription.mailing_list.name.downcase}
end
# generated the token for which an opt-in is emailed
def generate_login_token
time = Time.now
token = Contact::inject_contact_id("#{Digest::SHA1.hexdigest(
"#{self.id}#{::MailManager.secret}#{time}")}", self.id)
self.update_attribute(:login_token, token)
self.update_attribute(:login_token_created_at, time)
token
end
end
end
| {
"content_hash": "7633989a28302abdf76a09c074b7466f",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 118,
"avg_line_length": 33.25308641975309,
"alnum_prop": 0.6237237794690923,
"repo_name": "LoneStarInternet/mail_manager",
"id": "5c765d34a3913fc02943d5291eaae2e37c9791e1",
"size": "5387",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/models/mail_manager/contact.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "11047"
},
{
"name": "Gherkin",
"bytes": "13659"
},
{
"name": "HTML",
"bytes": "33659"
},
{
"name": "JavaScript",
"bytes": "1909"
},
{
"name": "Ruby",
"bytes": "296621"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>spgl.gsounds.Sound</title>
<link rel="stylesheet" href="epydoc.css" type="text/css" />
<script type="text/javascript" src="epydoc.js"></script>
</head>
<body bgcolor="white" text="black" link="blue" vlink="#204080"
alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
bgcolor="#a0c0ff" cellspacing="0">
<tr valign="middle">
<!-- Home link -->
<th> <a
href="spgl-module.html">Home</a> </th>
<!-- Tree link -->
<th> <a
href="module-tree.html">Trees</a> </th>
<!-- Index link -->
<th> <a
href="identifier-index.html">Indices</a> </th>
<!-- Help link -->
<th> <a
href="help.html">Help</a> </th>
<th class="navbar" width="100%"></th>
</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
<tr valign="top">
<td width="100%">
<span class="breadcrumbs">
<a href="spgl-module.html">Package spgl</a> ::
<a href="spgl.gsounds-module.html">Module gsounds</a> ::
Class Sound
</span>
</td>
<td>
<table cellpadding="0" cellspacing="0">
<!-- hide/show private -->
<tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
onclick="toggle_private();">hide private</a>]</span></td></tr>
<tr><td align="right"><span class="options"
>[<a href="frames.html" target="_top">frames</a
>] | <a href="spgl.gsounds.Sound-class.html"
target="_top">no frames</a>]</span></td></tr>
</table>
</td>
</tr>
</table>
<!-- ==================== CLASS DESCRIPTION ==================== -->
<h1 class="epydoc">Class Sound</h1><p class="nomargin-top"><span class="codelink"><a href="spgl.gsounds-pysrc.html#Sound">source code</a></span></p>
<p>This class encapsulates a sound file. The sound file is specified in
the constructor and must be a file in either the current directory or a
subdirectory named sounds.</p>
<p>The following code, for example, plays the sound file
ringtone.wav:</p>
<pre class="literalblock">
Sound ringtone("ringtone.wav");
ringtone.play();
</pre>
<!-- ==================== INSTANCE METHODS ==================== -->
<a name="section-InstanceMethods"></a>
<table class="summary" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
<td colspan="2" class="table-header">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr valign="top">
<td align="left"><span class="table-header">Instance Methods</span></td>
<td align="right" valign="top"
><span class="options">[<a href="#section-InstanceMethods"
class="privatelink" onclick="toggle_private();"
>hide private</a>]</span></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">void</span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="spgl.gsounds.Sound-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary-sig-arg">self</span>,
<span class="summary-sig-arg">filename</span>)</span><br />
Creates a Sound object.</td>
<td align="right" valign="top">
<span class="codelink"><a href="spgl.gsounds-pysrc.html#Sound.__init__">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">void</span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="__del__"></a><span class="summary-sig-name">__del__</span>(<span class="summary-sig-arg">self</span>)</span><br />
Informs the Java backend that the sound should be deleted</td>
<td align="right" valign="top">
<span class="codelink"><a href="spgl.gsounds-pysrc.html#Sound.__del__">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">void</span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="spgl.gsounds.Sound-class.html#play" class="summary-sig-name">play</a>(<span class="summary-sig-arg">self</span>)</span><br />
Starts playing the sound.</td>
<td align="right" valign="top">
<span class="codelink"><a href="spgl.gsounds-pysrc.html#Sound.play">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- ==================== METHOD DETAILS ==================== -->
<a name="section-MethodDetails"></a>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
<td colspan="2" class="table-header">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr valign="top">
<td align="left"><span class="table-header">Method Details</span></td>
<td align="right" valign="top"
><span class="options">[<a href="#section-MethodDetails"
class="privatelink" onclick="toggle_private();"
>hide private</a>]</span></td>
</tr>
</table>
</td>
</tr>
</table>
<a name="__init__"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">__init__</span>(<span class="sig-arg">self</span>,
<span class="sig-arg">filename</span>)</span>
<br /><em class="fname">(Constructor)</em>
</h3>
</td><td align="right" valign="top"
><span class="codelink"><a href="spgl.gsounds-pysrc.html#Sound.__init__">source code</a></span>
</td>
</tr></table>
<p>Creates a Sound object. The default constructor creates an empty
sound that cannot be played. The second form initializes the sound by
reading in the contents of the specified file.</p>
<dl class="fields">
<dt>Parameters:</dt>
<dd><ul class="nomargin-top">
<li><strong class="pname"><code>filename</code></strong> (string) - sound file</li>
</ul></dd>
<dt>Returns: void</dt>
</dl>
</td></tr></table>
</div>
<a name="play"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">play</span>(<span class="sig-arg">self</span>)</span>
</h3>
</td><td align="right" valign="top"
><span class="codelink"><a href="spgl.gsounds-pysrc.html#Sound.play">source code</a></span>
</td>
</tr></table>
<p>Starts playing the sound. This call returns immediately without
waiting for the sound to finish.</p>
<dl class="fields">
<dt>Returns: void</dt>
</dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
bgcolor="#a0c0ff" cellspacing="0">
<tr valign="middle">
<!-- Home link -->
<th> <a
href="spgl-module.html">Home</a> </th>
<!-- Tree link -->
<th> <a
href="module-tree.html">Trees</a> </th>
<!-- Index link -->
<th> <a
href="identifier-index.html">Indices</a> </th>
<!-- Help link -->
<th> <a
href="help.html">Help</a> </th>
<th class="navbar" width="100%"></th>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
<tr>
<td align="left" class="footer">
Generated by Epydoc 3.0.1 on Fri May 10 02:58:16 2013
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
>http://epydoc.sourceforge.net</a>
</td>
</tr>
</table>
<script type="text/javascript">
<!--
// Private objects are initially displayed (because if
// javascript is turned off then we want them to be
// visible); but by default, we want to hide them. So hide
// them unless we have a cookie that says to show them.
checkCookie();
// -->
</script>
</body>
</html>
| {
"content_hash": "5c94ded93a81a1d944b5b75b6cec2634",
"timestamp": "",
"source": "github",
"line_count": 253,
"max_line_length": 174,
"avg_line_length": 37.08695652173913,
"alnum_prop": 0.5782798678461046,
"repo_name": "SarahPythonista/acmpy",
"id": "ec5570699efe715a876a71d80202461fe3f39604",
"size": "9383",
"binary": false,
"copies": "1",
"ref": "refs/heads/stylistic",
"path": "docs/spgl.gsounds.Sound-class.html",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "7737"
},
{
"name": "Python",
"bytes": "404025"
}
],
"symlink_target": ""
} |
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// http://code.google.com/p/protobuf/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Author: [email protected] (Kenton Varda)
// Based on original Protocol Buffers design by
// Sanjay Ghemawat, Jeff Dean, and others.
#include <map>
#include <string>
#include <google/protobuf/compiler/javanano/javanano_enum_field.h>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/compiler/javanano/javanano_helpers.h>
#include <google/protobuf/io/printer.h>
#include <google/protobuf/wire_format.h>
#include <google/protobuf/stubs/strutil.h>
namespace google {
namespace protobuf {
namespace compiler {
namespace javanano {
namespace {
// TODO(kenton): Factor out a "SetCommonFieldVariables()" to get rid of
// repeat code between this and the other field types.
void SetEnumVariables(const Params& params,
const FieldDescriptor* descriptor, map<string, string>* variables) {
(*variables)["name"] =
RenameJavaKeywords(UnderscoresToCamelCase(descriptor));
(*variables)["capitalized_name"] =
RenameJavaKeywords(UnderscoresToCapitalizedCamelCase(descriptor));
(*variables)["number"] = SimpleItoa(descriptor->number());
if (params.use_reference_types_for_primitives()
&& !params.reftypes_primitive_enums()
&& !descriptor->is_repeated()) {
(*variables)["type"] = "java.lang.Integer";
(*variables)["default"] = "null";
} else {
(*variables)["type"] = "int";
(*variables)["default"] = DefaultValue(params, descriptor);
}
(*variables)["repeated_default"] =
"com.google.protobuf.nano.WireFormatNano.EMPTY_INT_ARRAY";
(*variables)["tag"] = SimpleItoa(internal::WireFormat::MakeTag(descriptor));
(*variables)["tag_size"] = SimpleItoa(
internal::WireFormat::TagSize(descriptor->number(), descriptor->type()));
(*variables)["non_packed_tag"] = SimpleItoa(
internal::WireFormatLite::MakeTag(descriptor->number(),
internal::WireFormat::WireTypeForFieldType(descriptor->type())));
(*variables)["message_name"] = descriptor->containing_type()->name();
}
void LoadEnumValues(const Params& params,
const EnumDescriptor* enum_descriptor, vector<string>* canonical_values) {
string enum_class_name = ClassName(params, enum_descriptor);
for (int i = 0; i < enum_descriptor->value_count(); i++) {
const EnumValueDescriptor* value = enum_descriptor->value(i);
const EnumValueDescriptor* canonical_value =
enum_descriptor->FindValueByNumber(value->number());
if (value == canonical_value) {
canonical_values->push_back(
enum_class_name + "." + RenameJavaKeywords(value->name()));
}
}
}
void PrintCaseLabels(
io::Printer* printer, const vector<string>& canonical_values) {
for (int i = 0; i < canonical_values.size(); i++) {
printer->Print(
" case $value$:\n",
"value", canonical_values[i]);
}
}
} // namespace
// ===================================================================
EnumFieldGenerator::
EnumFieldGenerator(const FieldDescriptor* descriptor, const Params& params)
: FieldGenerator(params), descriptor_(descriptor) {
SetEnumVariables(params, descriptor, &variables_);
LoadEnumValues(params, descriptor->enum_type(), &canonical_values_);
}
EnumFieldGenerator::~EnumFieldGenerator() {}
void EnumFieldGenerator::
GenerateMembers(io::Printer* printer, bool /* unused lazy_init */) const {
printer->Print(variables_,
"public $type$ $name$;\n");
if (params_.generate_has()) {
printer->Print(variables_,
"public boolean has$capitalized_name$;\n");
}
}
void EnumFieldGenerator::
GenerateClearCode(io::Printer* printer) const {
printer->Print(variables_,
"$name$ = $default$;\n");
if (params_.generate_has()) {
printer->Print(variables_,
"has$capitalized_name$ = false;\n");
}
}
void EnumFieldGenerator::
GenerateMergingCode(io::Printer* printer) const {
printer->Print(variables_,
"int value = input.readInt32();\n"
"switch (value) {\n");
PrintCaseLabels(printer, canonical_values_);
printer->Print(variables_,
" this.$name$ = value;\n");
if (params_.generate_has()) {
printer->Print(variables_,
" has$capitalized_name$ = true;\n");
}
printer->Print(
" break;\n"
"}\n");
// No default case: in case of invalid value from the wire, preserve old
// field value. Also we are not storing the invalid value into the unknown
// fields, because there is no way to get the value out.
}
void EnumFieldGenerator::
GenerateSerializationCode(io::Printer* printer) const {
if (descriptor_->is_required() && !params_.generate_has()) {
// Always serialize a required field if we don't have the 'has' signal.
printer->Print(variables_,
"output.writeInt32($number$, this.$name$);\n");
} else {
if (params_.generate_has()) {
printer->Print(variables_,
"if (this.$name$ != $default$ || has$capitalized_name$) {\n");
} else {
printer->Print(variables_,
"if (this.$name$ != $default$) {\n");
}
printer->Print(variables_,
" output.writeInt32($number$, this.$name$);\n"
"}\n");
}
}
void EnumFieldGenerator::
GenerateSerializedSizeCode(io::Printer* printer) const {
if (descriptor_->is_required() && !params_.generate_has()) {
printer->Print(variables_,
"size += com.google.protobuf.nano.CodedOutputByteBufferNano\n"
" .computeInt32Size($number$, this.$name$);\n");
} else {
if (params_.generate_has()) {
printer->Print(variables_,
"if (this.$name$ != $default$ || has$capitalized_name$) {\n");
} else {
printer->Print(variables_,
"if (this.$name$ != $default$) {\n");
}
printer->Print(variables_,
" size += com.google.protobuf.nano.CodedOutputByteBufferNano\n"
" .computeInt32Size($number$, this.$name$);\n"
"}\n");
}
}
void EnumFieldGenerator::GenerateEqualsCode(io::Printer* printer) const {
if (params_.use_reference_types_for_primitives()
&& !params_.reftypes_primitive_enums()) {
printer->Print(variables_,
"if (this.$name$ == null) {\n"
" if (other.$name$ != null) {\n"
" return false;\n"
" }\n"
"} else if (!this.$name$.equals(other.$name$)) {\n"
" return false;"
"}\n");
} else {
// We define equality as serialized form equality. If generate_has(),
// then if the field value equals the default value in both messages,
// but one's 'has' field is set and the other's is not, the serialized
// forms are different and we should return false.
printer->Print(variables_,
"if (this.$name$ != other.$name$");
if (params_.generate_has()) {
printer->Print(variables_,
"\n"
" || (this.$name$ == $default$\n"
" && this.has$capitalized_name$ != other.has$capitalized_name$)");
}
printer->Print(") {\n"
" return false;\n"
"}\n");
}
}
void EnumFieldGenerator::GenerateHashCodeCode(io::Printer* printer) const {
printer->Print(
"result = 31 * result + ");
if (params_.use_reference_types_for_primitives()
&& !params_.reftypes_primitive_enums()) {
printer->Print(variables_,
"(this.$name$ == null ? 0 : this.$name$)");
} else {
printer->Print(variables_,
"this.$name$");
}
printer->Print(";\n");
}
// ===================================================================
AccessorEnumFieldGenerator::
AccessorEnumFieldGenerator(const FieldDescriptor* descriptor,
const Params& params, int has_bit_index)
: FieldGenerator(params), descriptor_(descriptor) {
SetEnumVariables(params, descriptor, &variables_);
LoadEnumValues(params, descriptor->enum_type(), &canonical_values_);
SetBitOperationVariables("has", has_bit_index, &variables_);
}
AccessorEnumFieldGenerator::~AccessorEnumFieldGenerator() {}
void AccessorEnumFieldGenerator::
GenerateMembers(io::Printer* printer, bool /* unused lazy_init */) const {
printer->Print(variables_,
"private int $name$_;\n"
"public int get$capitalized_name$() {\n"
" return $name$_;\n"
"}\n"
"public $message_name$ set$capitalized_name$(int value) {\n"
" $name$_ = value;\n"
" $set_has$;\n"
" return this;\n"
"}\n"
"public boolean has$capitalized_name$() {\n"
" return $get_has$;\n"
"}\n"
"public $message_name$ clear$capitalized_name$() {\n"
" $name$_ = $default$;\n"
" $clear_has$;\n"
" return this;\n"
"}\n");
}
void AccessorEnumFieldGenerator::
GenerateClearCode(io::Printer* printer) const {
printer->Print(variables_,
"$name$_ = $default$;\n");
}
void AccessorEnumFieldGenerator::
GenerateMergingCode(io::Printer* printer) const {
printer->Print(variables_,
"int value = input.readInt32();\n"
"switch (value) {\n");
PrintCaseLabels(printer, canonical_values_);
printer->Print(variables_,
" $name$_ = value;\n"
" $set_has$;\n"
" break;\n"
"}\n");
// No default case: in case of invalid value from the wire, preserve old
// field value. Also we are not storing the invalid value into the unknown
// fields, because there is no way to get the value out.
}
void AccessorEnumFieldGenerator::
GenerateSerializationCode(io::Printer* printer) const {
printer->Print(variables_,
"if ($get_has$) {\n"
" output.writeInt32($number$, $name$_);\n"
"}\n");
}
void AccessorEnumFieldGenerator::
GenerateSerializedSizeCode(io::Printer* printer) const {
printer->Print(variables_,
"if ($get_has$) {\n"
" size += com.google.protobuf.nano.CodedOutputByteBufferNano\n"
" .computeInt32Size($number$, $name$_);\n"
"}\n");
}
void AccessorEnumFieldGenerator::
GenerateEqualsCode(io::Printer* printer) const {
printer->Print(variables_,
"if ($different_has$\n"
" || $name$_ != other.$name$_) {\n"
" return false;\n"
"}\n");
}
void AccessorEnumFieldGenerator::
GenerateHashCodeCode(io::Printer* printer) const {
printer->Print(variables_,
"result = 31 * result + $name$_;\n");
}
// ===================================================================
RepeatedEnumFieldGenerator::
RepeatedEnumFieldGenerator(const FieldDescriptor* descriptor, const Params& params)
: FieldGenerator(params), descriptor_(descriptor) {
SetEnumVariables(params, descriptor, &variables_);
LoadEnumValues(params, descriptor->enum_type(), &canonical_values_);
}
RepeatedEnumFieldGenerator::~RepeatedEnumFieldGenerator() {}
void RepeatedEnumFieldGenerator::
GenerateMembers(io::Printer* printer, bool /* unused lazy_init */) const {
printer->Print(variables_,
"public $type$[] $name$;\n");
}
void RepeatedEnumFieldGenerator::
GenerateClearCode(io::Printer* printer) const {
printer->Print(variables_,
"$name$ = $repeated_default$;\n");
}
void RepeatedEnumFieldGenerator::
GenerateMergingCode(io::Printer* printer) const {
// First, figure out the maximum length of the array, then parse,
// and finally copy the valid values to the field.
printer->Print(variables_,
"int length = com.google.protobuf.nano.WireFormatNano\n"
" .getRepeatedFieldArrayLength(input, $non_packed_tag$);\n"
"int[] validValues = new int[length];\n"
"int validCount = 0;\n"
"for (int i = 0; i < length; i++) {\n"
" if (i != 0) { // tag for first value already consumed.\n"
" input.readTag();\n"
" }\n"
" int value = input.readInt32();\n"
" switch (value) {\n");
printer->Indent();
PrintCaseLabels(printer, canonical_values_);
printer->Outdent();
printer->Print(variables_,
" validValues[validCount++] = value;\n"
" break;\n"
" }\n"
"}\n"
"if (validCount != 0) {\n"
" int i = this.$name$ == null ? 0 : this.$name$.length;\n"
" if (i == 0 && validCount == validValues.length) {\n"
" this.$name$ = validValues;\n"
" } else {\n"
" int[] newArray = new int[i + validCount];\n"
" if (i != 0) {\n"
" java.lang.System.arraycopy(this.$name$, 0, newArray, 0, i);\n"
" }\n"
" java.lang.System.arraycopy(validValues, 0, newArray, i, validCount);\n"
" this.$name$ = newArray;\n"
" }\n"
"}\n");
}
void RepeatedEnumFieldGenerator::
GenerateMergingCodeFromPacked(io::Printer* printer) const {
printer->Print(variables_,
"int bytes = input.readRawVarint32();\n"
"int limit = input.pushLimit(bytes);\n"
"// First pass to compute array length.\n"
"int arrayLength = 0;\n"
"int startPos = input.getPosition();\n"
"while (input.getBytesUntilLimit() > 0) {\n"
" switch (input.readInt32()) {\n");
printer->Indent();
PrintCaseLabels(printer, canonical_values_);
printer->Outdent();
printer->Print(variables_,
" arrayLength++;\n"
" break;\n"
" }\n"
"}\n"
"if (arrayLength != 0) {\n"
" input.rewindToPosition(startPos);\n"
" int i = this.$name$ == null ? 0 : this.$name$.length;\n"
" int[] newArray = new int[i + arrayLength];\n"
" if (i != 0) {\n"
" java.lang.System.arraycopy(this.$name$, 0, newArray, 0, i);\n"
" }\n"
" while (input.getBytesUntilLimit() > 0) {\n"
" int value = input.readInt32();\n"
" switch (value) {\n");
printer->Indent();
printer->Indent();
PrintCaseLabels(printer, canonical_values_);
printer->Outdent();
printer->Outdent();
printer->Print(variables_,
" newArray[i++] = value;\n"
" break;\n"
" }\n"
" }\n"
" this.$name$ = newArray;\n"
"}\n"
"input.popLimit(limit);\n");
}
void RepeatedEnumFieldGenerator::
GenerateRepeatedDataSizeCode(io::Printer* printer) const {
// Creates a variable dataSize and puts the serialized size in there.
printer->Print(variables_,
"int dataSize = 0;\n"
"for (int i = 0; i < this.$name$.length; i++) {\n"
" int element = this.$name$[i];\n"
" dataSize += com.google.protobuf.nano.CodedOutputByteBufferNano\n"
" .computeInt32SizeNoTag(element);\n"
"}\n");
}
void RepeatedEnumFieldGenerator::
GenerateSerializationCode(io::Printer* printer) const {
printer->Print(variables_,
"if (this.$name$ != null && this.$name$.length > 0) {\n");
printer->Indent();
if (descriptor_->options().packed()) {
GenerateRepeatedDataSizeCode(printer);
printer->Print(variables_,
"output.writeRawVarint32($tag$);\n"
"output.writeRawVarint32(dataSize);\n"
"for (int i = 0; i < this.$name$.length; i++) {\n"
" output.writeRawVarint32(this.$name$[i]);\n"
"}\n");
} else {
printer->Print(variables_,
"for (int i = 0; i < this.$name$.length; i++) {\n"
" output.writeInt32($number$, this.$name$[i]);\n"
"}\n");
}
printer->Outdent();
printer->Print(variables_,
"}\n");
}
void RepeatedEnumFieldGenerator::
GenerateSerializedSizeCode(io::Printer* printer) const {
printer->Print(variables_,
"if (this.$name$ != null && this.$name$.length > 0) {\n");
printer->Indent();
GenerateRepeatedDataSizeCode(printer);
printer->Print(
"size += dataSize;\n");
if (descriptor_->options().packed()) {
printer->Print(variables_,
"size += $tag_size$;\n"
"size += com.google.protobuf.nano.CodedOutputByteBufferNano\n"
" .computeRawVarint32Size(dataSize);\n");
} else {
printer->Print(variables_,
"size += $tag_size$ * this.$name$.length;\n");
}
printer->Outdent();
printer->Print(
"}\n");
}
void RepeatedEnumFieldGenerator::
GenerateEqualsCode(io::Printer* printer) const {
printer->Print(variables_,
"if (!com.google.protobuf.nano.InternalNano.equals(\n"
" this.$name$, other.$name$)) {\n"
" return false;\n"
"}\n");
}
void RepeatedEnumFieldGenerator::
GenerateHashCodeCode(io::Printer* printer) const {
printer->Print(variables_,
"result = 31 * result\n"
" + com.google.protobuf.nano.InternalNano.hashCode(this.$name$);\n");
}
} // namespace javanano
} // namespace compiler
} // namespace protobuf
} // namespace google
| {
"content_hash": "84d5a8c50851915c772641030cf62c9c",
"timestamp": "",
"source": "github",
"line_count": 520,
"max_line_length": 83,
"avg_line_length": 33.78653846153846,
"alnum_prop": 0.64044624053731,
"repo_name": "meghana0507/grpc-java-poll",
"id": "8a59d3233cc16f211b0bed46f7f097c3ada94ee3",
"size": "17569",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "lib/netty/protobuf/protobuf-3.0.0-alpha-2/src/google/protobuf/compiler/javanano/javanano_enum_field.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "675278"
},
{
"name": "C++",
"bytes": "13760110"
},
{
"name": "CMake",
"bytes": "18668"
},
{
"name": "CSS",
"bytes": "3570"
},
{
"name": "Emacs Lisp",
"bytes": "15596"
},
{
"name": "HTML",
"bytes": "7473"
},
{
"name": "Java",
"bytes": "15326237"
},
{
"name": "JavaScript",
"bytes": "2933"
},
{
"name": "Makefile",
"bytes": "590545"
},
{
"name": "Protocol Buffer",
"bytes": "1065012"
},
{
"name": "Python",
"bytes": "967273"
},
{
"name": "Ruby",
"bytes": "38278"
},
{
"name": "Shell",
"bytes": "1540526"
},
{
"name": "VimL",
"bytes": "7500"
}
],
"symlink_target": ""
} |
'use strict'
// Characters.
var NULL = '\0'
var AMP = '&'
var SP = ' '
var TB = '\t'
var GR = '`'
var DQ = '"'
var SQ = "'"
var EQ = '='
var LT = '<'
var GT = '>'
var SO = '/'
var LF = '\n'
var CR = '\r'
var FF = '\f'
var whitespace = [SP, TB, LF, CR, FF]
// https://html.spec.whatwg.org/#attribute-name-state
var name = whitespace.concat(AMP, SO, GT, EQ)
// https://html.spec.whatwg.org/#attribute-value-(unquoted)-state
var unquoted = whitespace.concat(AMP, GT)
var unquotedSafe = unquoted.concat(NULL, DQ, SQ, LT, EQ, GR)
// https://html.spec.whatwg.org/#attribute-value-(single-quoted)-state
var singleQuoted = [AMP, SQ]
// https://html.spec.whatwg.org/#attribute-value-(double-quoted)-state
var doubleQuoted = [AMP, DQ]
// Maps of subsets. Each value is a matrix of tuples.
// The first value causes parse errors, the second is valid.
// Of both values, the first value is unsafe, and the second is safe.
module.exports = {
name: [
[name, name.concat(DQ, SQ, GR)],
[name.concat(NULL, DQ, SQ, LT), name.concat(NULL, DQ, SQ, LT, GR)]
],
unquoted: [[unquoted, unquotedSafe], [unquotedSafe, unquotedSafe]],
single: [
[singleQuoted, singleQuoted.concat(DQ, GR)],
[singleQuoted.concat(NULL), singleQuoted.concat(NULL, DQ, GR)]
],
double: [
[doubleQuoted, doubleQuoted.concat(SQ, GR)],
[doubleQuoted.concat(NULL), doubleQuoted.concat(NULL, SQ, GR)]
]
}
| {
"content_hash": "a04e6791b0badfdc8f5123637b835a7d",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 70,
"avg_line_length": 29.617021276595743,
"alnum_prop": 0.6501436781609196,
"repo_name": "jpoeng/jpoeng.github.io",
"id": "41212763d359f7fba41d8d2f093429869f2458c7",
"size": "1392",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "node_modules/hast-util-to-html/lib/constants.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "5765"
},
{
"name": "HTML",
"bytes": "53947"
},
{
"name": "JavaScript",
"bytes": "1885"
},
{
"name": "PHP",
"bytes": "9773"
}
],
"symlink_target": ""
} |
--TEST--
Test xml_set_start_namespace_decl_handler() function : error conditions
--SKIPIF--
<?php
if (!extension_loaded("xml")) {
print "skip - XML extension not loaded";
}
?>
--FILE--
<?php
/* Prototype : proto int xml_set_start_namespace_decl_handler(resource parser, string hdl)
* Description: Set up character data handler
* Source code: ext/xml/xml.c
* Alias to functions:
*/
echo "*** Testing xml_set_start_namespace_decl_handler() : error conditions ***\n";
//Test xml_set_start_namespace_decl_handler with one more than the expected number of arguments
echo "\n-- Testing xml_set_start_namespace_decl_handler() function with more than expected no. of arguments --\n";
$hdl = 'string_val';
$extra_arg = 10;
var_dump( xml_set_start_namespace_decl_handler(null, $hdl, $extra_arg) );
// Testing xml_set_start_namespace_decl_handler with one less than the expected number of arguments
echo "\n-- Testing xml_set_start_namespace_decl_handler() function with less than expected no. of arguments --\n";
var_dump( xml_set_start_namespace_decl_handler(null) );
echo "Done";
?>
--EXPECTF--
*** Testing xml_set_start_namespace_decl_handler() : error conditions ***
-- Testing xml_set_start_namespace_decl_handler() function with more than expected no. of arguments --
Warning: xml_set_start_namespace_decl_handler() expects exactly 2 parameters, 3 given in %s on line %d
NULL
-- Testing xml_set_start_namespace_decl_handler() function with less than expected no. of arguments --
Warning: xml_set_start_namespace_decl_handler() expects exactly 2 parameters, 1 given in %s on line %d
NULL
Done
| {
"content_hash": "8f925772bcd517536c0ff9ef69ab8512",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 114,
"avg_line_length": 34.319148936170215,
"alnum_prop": 0.7259764414135151,
"repo_name": "lunaczp/learning",
"id": "221b005dfd403e2d2f3b1bf61b422c639ebb0e9a",
"size": "1613",
"binary": false,
"copies": "7",
"ref": "refs/heads/master",
"path": "language/c/testPhpSrc/php-5.6.17/ext/xml/tests/xml_set_start_namespace_decl_handler_error.phpt",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "4526"
},
{
"name": "Assembly",
"bytes": "14500403"
},
{
"name": "Awk",
"bytes": "21252"
},
{
"name": "Batchfile",
"bytes": "2526"
},
{
"name": "C",
"bytes": "381839655"
},
{
"name": "C++",
"bytes": "10162228"
},
{
"name": "CMake",
"bytes": "68196"
},
{
"name": "CSS",
"bytes": "3943"
},
{
"name": "D",
"bytes": "1022"
},
{
"name": "DTrace",
"bytes": "4528"
},
{
"name": "Fortran",
"bytes": "1834"
},
{
"name": "GAP",
"bytes": "4344"
},
{
"name": "GDB",
"bytes": "31864"
},
{
"name": "Gnuplot",
"bytes": "148"
},
{
"name": "Go",
"bytes": "732"
},
{
"name": "HTML",
"bytes": "86756"
},
{
"name": "Java",
"bytes": "8286"
},
{
"name": "JavaScript",
"bytes": "238365"
},
{
"name": "Lex",
"bytes": "121233"
},
{
"name": "Limbo",
"bytes": "1609"
},
{
"name": "Lua",
"bytes": "96"
},
{
"name": "M4",
"bytes": "483288"
},
{
"name": "Makefile",
"bytes": "1915601"
},
{
"name": "Nix",
"bytes": "180099"
},
{
"name": "Objective-C",
"bytes": "1742504"
},
{
"name": "OpenEdge ABL",
"bytes": "4238"
},
{
"name": "PHP",
"bytes": "27984629"
},
{
"name": "Pascal",
"bytes": "74868"
},
{
"name": "Perl",
"bytes": "317465"
},
{
"name": "Perl 6",
"bytes": "6916"
},
{
"name": "Python",
"bytes": "21547"
},
{
"name": "R",
"bytes": "1112"
},
{
"name": "Roff",
"bytes": "435717"
},
{
"name": "Scilab",
"bytes": "22980"
},
{
"name": "Shell",
"bytes": "468206"
},
{
"name": "UnrealScript",
"bytes": "20840"
},
{
"name": "Vue",
"bytes": "563"
},
{
"name": "XSLT",
"bytes": "7946"
},
{
"name": "Yacc",
"bytes": "172805"
},
{
"name": "sed",
"bytes": "2073"
}
],
"symlink_target": ""
} |
import RPi.GPIO as GPIO
import time
import queue as Queue # https://pymotw.com/2/Queue/
from functools import partial
from threading import Thread
#------------------------------------------------------------------------
# use the raspi board pin number
#GPIO.setmode(GPIO.BOARD)
# use the gpio number
GPIO.setmode(GPIO.BCM)
Taster = 25
#------------------------------------------------------------------------
def interrupt_event(qF, qR, pin):
if GPIO.input(pin) == GPIO.HIGH:
qR.put(pin)
else:
qF.put(pin)
def rising_edge(queue):
while running:
if not queue.empty():
pin = queue.get()
zeit = time.strftime("%d.%m.%Y %H:%M:%S")
print("{} Rising edge detected on {}".format(zeit, pin))
time.sleep(0.5)
def falling_edge(queue):
while running:
if not queue.empty():
pin = queue.get()
zeit = time.strftime("%d.%m.%Y %H:%M:%S")
print("{} Falling edge detected on {}".format(zeit, pin))
time.sleep(0.5)
def main():
queueFalling = Queue.Queue()
queueRising = Queue.Queue()
rising_thread = Thread(target=rising_edge, args=(queueRising,))
falling_thread = Thread(target=falling_edge, args=(queueFalling,))
rising_thread.start()
falling_thread.start()
GPIO.setup(Taster, GPIO.IN)
GPIO.add_event_detect(Taster, GPIO.BOTH, callback=partial(interrupt_event, queueFalling, queueRising), bouncetime=200)
#keep script running
while True:
time.sleep(5)
if __name__ == '__main__':
try:
running = True
main()
except (KeyboardInterrupt, SystemExit):
running = False
print("\nQuit\n")
GPIO.cleanup() | {
"content_hash": "eb600f472f4e36f816e16e426c7e91e9",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 122,
"avg_line_length": 28.666666666666668,
"alnum_prop": 0.5593023255813954,
"repo_name": "meigrafd/Sample-Code",
"id": "513a0cf19adf5e14363fca60a8e4431a2574583d",
"size": "1739",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "interrupt_rising.falling_queue.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "496"
},
{
"name": "CSS",
"bytes": "638"
},
{
"name": "HTML",
"bytes": "1141"
},
{
"name": "JavaScript",
"bytes": "1624"
},
{
"name": "PHP",
"bytes": "77857"
},
{
"name": "Perl",
"bytes": "478"
},
{
"name": "Python",
"bytes": "382809"
},
{
"name": "Shell",
"bytes": "56023"
}
],
"symlink_target": ""
} |
const baseSteps = require(__srcdir + '/steps/baseSteps.js');
const membersTab = require(__srcdir + '/pages/settings/membersTab.js');
class membersSteps extends baseSteps{
constructor(driver){
super(driver);
this.memTab = new membersTab(driver);
}
async isLoaded(){
await this.memTab.isTabLoaded();
}
}
module.exports = membersSteps;
| {
"content_hash": "622471e3dfe410f7d7c0ecfae4bd3721",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 71,
"avg_line_length": 22.294117647058822,
"alnum_prop": 0.6596306068601583,
"repo_name": "nooproblem/influxdb",
"id": "4c913e53864dc1678f73b937855edf767bff3744",
"size": "379",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "e2e/src/steps/settings/membersSteps.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "9692"
},
{
"name": "Go",
"bytes": "2692594"
},
{
"name": "HTML",
"bytes": "9436"
},
{
"name": "JavaScript",
"bytes": "13653"
},
{
"name": "Protocol Buffer",
"bytes": "8668"
},
{
"name": "Ruby",
"bytes": "4064"
},
{
"name": "Shell",
"bytes": "46962"
}
],
"symlink_target": ""
} |
package com.xeiam.xchange.bleutrade.service.polling;
import java.io.IOException;
import java.util.List;
import com.xeiam.xchange.Exchange;
import com.xeiam.xchange.bleutrade.BleutradeAdapters;
import com.xeiam.xchange.bleutrade.dto.marketdata.BleutradeOrderBook;
import com.xeiam.xchange.bleutrade.dto.marketdata.BleutradeTicker;
import com.xeiam.xchange.bleutrade.dto.marketdata.BleutradeTrade;
import com.xeiam.xchange.currency.CurrencyPair;
import com.xeiam.xchange.dto.marketdata.OrderBook;
import com.xeiam.xchange.dto.marketdata.Ticker;
import com.xeiam.xchange.dto.marketdata.Trades;
import com.xeiam.xchange.service.polling.marketdata.PollingMarketDataService;
public class BleutradeMarketDataService extends BleutradeMarketDataServiceRaw implements PollingMarketDataService {
/**
* Constructor
*
* @param exchange
*/
public BleutradeMarketDataService(Exchange exchange) {
super(exchange);
}
@Override
public Ticker getTicker(CurrencyPair currencyPair, Object... args) throws IOException {
BleutradeTicker bleutradeTicker = getBleutradeTicker(currencyPair);
return BleutradeAdapters.adaptBleutradeTicker(bleutradeTicker);
}
@Override
public OrderBook getOrderBook(CurrencyPair currencyPair, Object... args) throws IOException {
int depth = 50;
if (args.length > 0) {
if (args[0] instanceof Integer) {
depth = (Integer) args[0];
}
}
BleutradeOrderBook bleutradeOrderBook = getBleutradeOrderBook(currencyPair, depth);
return BleutradeAdapters.adaptBleutradeOrderBook(bleutradeOrderBook, currencyPair);
}
@Override
public Trades getTrades(CurrencyPair currencyPair, Object... args) throws IOException {
int count = 50;
if (args.length > 0) {
if (args[0] instanceof Integer) {
count = (Integer) args[0];
}
}
if (count < 1) {
count = 1;
} else if (count > 200) {
count = 200;
}
List<BleutradeTrade> bleutradeTrades = getBleutradeMarketHistory(currencyPair, count);
return BleutradeAdapters.adaptBleutradeMarketHistory(bleutradeTrades, currencyPair);
}
}
| {
"content_hash": "3d30f9b0f305305d787b2a48b2e9dae4",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 115,
"avg_line_length": 29.52777777777778,
"alnum_prop": 0.7492944496707432,
"repo_name": "okazia/XChange",
"id": "7d18195771c3b2a5f8970abac6a90489be0bce09",
"size": "2126",
"binary": false,
"copies": "11",
"ref": "refs/heads/develop",
"path": "xchange-bleutrade/src/main/java/com/xeiam/xchange/bleutrade/service/polling/BleutradeMarketDataService.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "3498319"
}
],
"symlink_target": ""
} |
/* jshint unused:false */
'use strict';
var should = require('should');
var app = require('../../app');
var request = require('supertest');
var <%= name %>Model = require('./<%= name %>.model');
// Clear all <%= name %>s
function cleanup(done) {
<%= name %>Model.model.remove().exec().then(function () { done(); });
}
describe('<%= route %>', function () {
var <%= name %>;
// reset <%= name %> before each test
beforeEach(function () {
<%= name %> = {
name: 'Dog',
info: 'Hello, this is dog.',
active: true
};
});
// Clear <%= name %>s before each test
beforeEach(cleanup);
// Clear <%= name %>s after each test
afterEach(cleanup);
describe('GET', function () {
it('should respond with JSON array', function (done) {
request(app)
.get('<%= route %>')
.set('Accept', 'application/json')
.expect(200)
.expect('Content-Type', /json/)
.end(function (err, res) {
if (err) {
return done(err);
}
res.body.should.be.instanceof(Array);
done();
});
});
it('should respond with an error for a malformed <%= name %> id parameter', function (done) {
request(app)
.get('<%= route %>/malformedid')
.set('Accept', 'application/json')
.expect(400)
.expect('Content-Type', /json/)
.end(done);
});
it('should respond with an not found error for a not existing <%= name %> id', function (done) {
request(app)
.get('<%= route %>/cccccccccccccccccccccccc')
.set('Accept', 'application/json')
.expect(404)
.expect('Content-Type', /json/)
.end(done);
});
it('should return a <%= name %> for its id', function (done) {
<%= name %>Model.model(<%= name %>).save(function (err, doc) {
request(app)
.get('<%= route %>/' + doc._id)
.set('Accept', 'application/json')
.expect(200)
.expect('Content-Type', /json/)
.end(function (err, res) {
if (err) {
return done(err);
}
res.body.should.be.an.Object.and.have.properties(<%= name %>);
res.body._id.should.exist;
done();
});
});
});
});
describe('POST', function () {
it('should create a new <%= name %> and respond with 201 and the created <%= name %>', function (done) {
request(app)
.post('<%= route %>')
.set('Accept', 'application/json')
.send(<%= name %>)
.expect(201)
.expect('Content-Type', /json/)
.end(function (err, res) {
if (err) {
return done(err);
}
res.body.should.be.an.Object.and.have.properties(<%= name %>);
res.body._id.should.exist;
done();
});
});
});
describe('PUT', function () {
it('should return an error if attempting a put without an id', function (done) {
request(app)
.put('<%= route %>')
.set('Accept', 'application/json')
.send(<%= name %>)
.expect(404)
.end(done);
});
it('should respond with an not found error for a not existing <%= name %> id', function (done) {
request(app)
.put('<%= route %>/cccccccccccccccccccccccc')
.set('Accept', 'application/json')
.expect(404)
.expect('Content-Type', /json/)
.end(done);
});
it('should update a <%= name %> and respond with the updated <%= name %>', function (done) {
request(app)
.post('<%= route %>')
.set('Accept', 'application/json')
.send(<%= name %>)
.end(function (err, res) {
if (err) {
return done(err);
}
<%= name %>.name = 'Cat';
// check if id is stripped on update
<%= name %>._id = 'malformed id string';
request(app)
.put('<%= route %>/' + res.body._id)
.set('Accept', 'application/json')
.send(<%= name %>)
.expect(200)
.expect('Content-Type', /json/)
.end(function (err, res) {
if (err) {
return done(err);
}
res.body.should.be.an.Object.and.have.property('name', <%= name %>.name);
done();
});
});
});
});
describe('DELETE', function () {
it('should return an error if attempting a delete without an id', function (done) {
request(app)
.delete('<%= route %>')
.set('Accept', 'application/json')
.expect(404)
.end(done);
});
it('should respond with an not found error for a not existing <%= name %> id', function (done) {
request(app)
.delete('<%= route %>/cccccccccccccccccccccccc')
.set('Accept', 'application/json')
.expect(404)
.expect('Content-Type', /json/)
.end(done);
});
it('should delete a <%= name %> and respond with 204', function (done) {
request(app)
.post('<%= route %>')
.set('Accept', 'application/json')
.send(<%= name %>)
.end(function (err, res) {
if (err) {
return done(err);
}
request(app)
.delete('<%= route %>/' + res.body._id)
.set('Accept', 'application/json')
.expect(204)
.end(done);
});
});
});
});
| {
"content_hash": "bc3d841e782b15c40d856d69285a3641",
"timestamp": "",
"source": "github",
"line_count": 195,
"max_line_length": 106,
"avg_line_length": 24.994871794871795,
"alnum_prop": 0.5443167829298318,
"repo_name": "baba2157/generator-material-app",
"id": "b9fb2d4306cff437989383eb593d723af96713f3",
"size": "4874",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "generators/api/templates/name.controller.spec.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "5106"
},
{
"name": "HTML",
"bytes": "33496"
},
{
"name": "JavaScript",
"bytes": "296309"
}
],
"symlink_target": ""
} |
package authorizationapi
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// 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.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
import (
"context"
"github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2018-07-01-preview/authorization"
"github.com/Azure/go-autorest/autorest"
)
// ClassicAdministratorsClientAPI contains the set of methods on the ClassicAdministratorsClient type.
type ClassicAdministratorsClientAPI interface {
List(ctx context.Context) (result authorization.ClassicAdministratorListResultPage, err error)
}
var _ ClassicAdministratorsClientAPI = (*authorization.ClassicAdministratorsClient)(nil)
// GlobalAdministratorClientAPI contains the set of methods on the GlobalAdministratorClient type.
type GlobalAdministratorClientAPI interface {
ElevateAccess(ctx context.Context) (result autorest.Response, err error)
}
var _ GlobalAdministratorClientAPI = (*authorization.GlobalAdministratorClient)(nil)
// ProviderOperationsMetadataClientAPI contains the set of methods on the ProviderOperationsMetadataClient type.
type ProviderOperationsMetadataClientAPI interface {
Get(ctx context.Context, resourceProviderNamespace string, expand string) (result authorization.ProviderOperationsMetadata, err error)
List(ctx context.Context, expand string) (result authorization.ProviderOperationsMetadataListResultPage, err error)
}
var _ ProviderOperationsMetadataClientAPI = (*authorization.ProviderOperationsMetadataClient)(nil)
// RoleAssignmentsClientAPI contains the set of methods on the RoleAssignmentsClient type.
type RoleAssignmentsClientAPI interface {
Create(ctx context.Context, scope string, roleAssignmentName string, parameters authorization.RoleAssignmentCreateParameters) (result authorization.RoleAssignment, err error)
CreateByID(ctx context.Context, roleID string, parameters authorization.RoleAssignmentCreateParameters) (result authorization.RoleAssignment, err error)
Delete(ctx context.Context, scope string, roleAssignmentName string) (result authorization.RoleAssignment, err error)
DeleteByID(ctx context.Context, roleID string) (result authorization.RoleAssignment, err error)
Get(ctx context.Context, scope string, roleAssignmentName string) (result authorization.RoleAssignment, err error)
GetByID(ctx context.Context, roleID string) (result authorization.RoleAssignment, err error)
List(ctx context.Context, filter string) (result authorization.RoleAssignmentListResultPage, err error)
ListForResource(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (result authorization.RoleAssignmentListResultPage, err error)
ListForResourceGroup(ctx context.Context, resourceGroupName string, filter string) (result authorization.RoleAssignmentListResultPage, err error)
ListForScope(ctx context.Context, scope string, filter string) (result authorization.RoleAssignmentListResultPage, err error)
}
var _ RoleAssignmentsClientAPI = (*authorization.RoleAssignmentsClient)(nil)
// PermissionsClientAPI contains the set of methods on the PermissionsClient type.
type PermissionsClientAPI interface {
ListForResource(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string) (result authorization.PermissionGetResultPage, err error)
ListForResourceGroup(ctx context.Context, resourceGroupName string) (result authorization.PermissionGetResultPage, err error)
}
var _ PermissionsClientAPI = (*authorization.PermissionsClient)(nil)
// RoleDefinitionsClientAPI contains the set of methods on the RoleDefinitionsClient type.
type RoleDefinitionsClientAPI interface {
CreateOrUpdate(ctx context.Context, scope string, roleDefinitionID string, roleDefinition authorization.RoleDefinition) (result authorization.RoleDefinition, err error)
Delete(ctx context.Context, scope string, roleDefinitionID string) (result authorization.RoleDefinition, err error)
Get(ctx context.Context, scope string, roleDefinitionID string) (result authorization.RoleDefinition, err error)
GetByID(ctx context.Context, roleID string) (result authorization.RoleDefinition, err error)
List(ctx context.Context, scope string, filter string) (result authorization.RoleDefinitionListResultPage, err error)
}
var _ RoleDefinitionsClientAPI = (*authorization.RoleDefinitionsClient)(nil)
// DenyAssignmentsClientAPI contains the set of methods on the DenyAssignmentsClient type.
type DenyAssignmentsClientAPI interface {
Get(ctx context.Context, scope string, denyAssignmentID string) (result authorization.DenyAssignment, err error)
GetByID(ctx context.Context, denyAssignmentID string) (result authorization.DenyAssignment, err error)
List(ctx context.Context, filter string) (result authorization.DenyAssignmentListResultPage, err error)
ListForResource(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (result authorization.DenyAssignmentListResultPage, err error)
ListForResourceGroup(ctx context.Context, resourceGroupName string, filter string) (result authorization.DenyAssignmentListResultPage, err error)
ListForScope(ctx context.Context, scope string, filter string) (result authorization.DenyAssignmentListResultPage, err error)
}
var _ DenyAssignmentsClientAPI = (*authorization.DenyAssignmentsClient)(nil)
| {
"content_hash": "e4a3d6e0195f16b477876034e2afaa41",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 244,
"avg_line_length": 66.2258064516129,
"alnum_prop": 0.8330897873031337,
"repo_name": "sdminonne/origin",
"id": "70b5d055bab4aa6ccf6c0bdbc6ec871ae9204dd0",
"size": "6159",
"binary": false,
"copies": "9",
"ref": "refs/heads/master",
"path": "vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2018-07-01-preview/authorization/authorizationapi/interfaces.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Awk",
"bytes": "921"
},
{
"name": "Dockerfile",
"bytes": "1668"
},
{
"name": "Go",
"bytes": "2136606"
},
{
"name": "Makefile",
"bytes": "6549"
},
{
"name": "Python",
"bytes": "14374"
},
{
"name": "Shell",
"bytes": "315233"
}
],
"symlink_target": ""
} |
require 'cocoa/bindings/NSImageRep'
module Cocoa
class NSCIImageRep < Cocoa::NSImageRep
attach_method :CIImage, :args=>0, :names=>[], :types=>[], :retval=>"@"
attach_singular_method :imageRepWithCIImage, :args=>1, :names=>[], :types=>["@"], :retval=>"@"
attach_method :initWithCIImage, :args=>1, :names=>[], :types=>["@"], :retval=>"@"
end
end
| {
"content_hash": "ab4fb5133e2000548ba7855d480fbaa9",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 98,
"avg_line_length": 45,
"alnum_prop": 0.6305555555555555,
"repo_name": "patrickhno/cocoa",
"id": "ae44767084f3e4d3951abd9d02ae62bbe89ff58b",
"size": "391",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/cocoa/bindings/NSCIImageRep.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "1613989"
}
],
"symlink_target": ""
} |
<?php
namespace PhpMigration\Changes\v5dot6;
use PhpMigration\Changes\AbstractChange;
use PhpMigration\Changes\RemoveTableItemTrait;
use PhpMigration\SymbolTable;
use PhpMigration\Utils\ParserHelper;
use PhpParser\Node\Expr;
class IncompMisc extends AbstractChange
{
use RemoveTableItemTrait;
protected static $version = '5.6.0';
protected $gmpTable = [
'gmp_abs', 'gmp_add', 'gmp_and', 'gmp_clrbit', 'gmp_cmp', 'gmp_com',
'gmp_div_q', 'gmp_div_qr', 'gmp_div_r', 'gmp_div', 'gmp_divexact',
'gmp_export', 'gmp_fact', 'gmp_gcd', 'gmp_gcdext', 'gmp_hamdist',
'gmp_import', 'gmp_init', 'gmp_intval', 'gmp_invert', 'gmp_jacobi',
'gmp_legendre', 'gmp_mod', 'gmp_mul', 'gmp_neg', 'gmp_nextprime',
'gmp_or', 'gmp_perfect_square', 'gmp_popcount', 'gmp_pow', 'gmp_powm',
'gmp_prob_prime', 'gmp_random_bits', 'gmp_random_range', 'gmp_random',
'gmp_root', 'gmp_rootrem', 'gmp_scan0', 'gmp_scan1', 'gmp_setbit',
'gmp_sign', 'gmp_sqrt', 'gmp_sqrtrem', 'gmp_strval', 'gmp_sub',
'gmp_testbit', 'gmp_xor',
];
protected $mcryptTable = [
'mcrypt_encrypt', 'mcrypt_decrypt', 'mcrypt_cbc', 'mcrypt_cfb',
'mcrypt_ecb', 'mcrypt_generic', 'mcrypt_ofb',
];
public function __construct()
{
$this->gmpTable = new SymbolTable($this->gmpTable, SymbolTable::IC);
$this->mcryptTable = new SymbolTable($this->mcryptTable, SymbolTable::IC);
}
public function leaveNode($node)
{
// json_decode()
if ($node instanceof Expr\FuncCall && ParserHelper::isSameFunc($node->name, 'json_decode')) {
/*
* {Description}
* json_decode() now rejects non-lowercase variants of the JSON
* literals true, false and null at all times, as per the JSON
* specification, and sets json_last_error() accordingly.
* Previously, inputs to json_decode() that consisted solely of one
* of these values in upper or mixed case were accepted.
*
* This change will only affect cases where invalid JSON was being
* passed to json_decode(): valid JSON input is unaffected and will
* continue to be parsed normally.
*
* {Reference}
* http://php.net/manual/en/migration56.incompatible.php#migration56.incompatible.json-decode
*/
$this->addSpot('NOTICE', false, 'json_decode() rejects non-lowercase variants of true, false, null');
// GMP
} elseif ($node instanceof Expr\FuncCall && $this->gmpTable->has($node->name)) {
/*
* {Description}
* GMP resources are now objects. The functional API implemented in
* the GMP extension has not changed, and code should run
* unmodified unless it checks explicitly for a resource using
* is_resource() or similar.
*
* {Reference}
* http://php.net/manual/en/migration56.incompatible.php#migration56.incompatible.gmp
*/
$this->addSpot('NOTICE', false, 'GMP resource is now object, do not use is_resource() to test');
// Mcrypt
} elseif ($node instanceof Expr\FuncCall && $this->mcryptTable->has($node->name)) {
/*
* {Description}
* mcrypt_encrypt(), mcrypt_decrypt(), mcrypt_cbc(), mcrypt_cfb(),
* mcrypt_ecb(), mcrypt_generic() and mcrypt_ofb() will no longer
* accept keys or IVs with incorrect sizes, and block cipher modes
* that require IVs will now fail if an IV isn't provided.
*
* {Reference}
* http://php.net/manual/en/migration56.incompatible.php#migration56.incompatible.mcrypt
*/
$this->addSpot('NOTICE', false, $node->name.'() no longer accept keys or IVs with incorrect size');
}
}
}
| {
"content_hash": "80b65e937186b10bd53d9d4d86409f08",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 113,
"avg_line_length": 43.73626373626374,
"alnum_prop": 0.5902010050251256,
"repo_name": "monque/PHP-Migration",
"id": "8f9c0897d8aa31c51daff15a82fdbc751fab55ba",
"size": "3980",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Changes/v5dot6/IncompMisc.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "195345"
}
],
"symlink_target": ""
} |
package com.swfarm.biz.ebay.dao;
import com.swfarm.biz.ebay.bo.RelistEbayItemsConfig;
import com.swfarm.pub.framework.dao.GenericDao;
public interface RelistEbayItemsConfigDao extends
GenericDao<RelistEbayItemsConfig, Long> {
}
| {
"content_hash": "a3636e34053147d07eb3b065d4fb6180",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 52,
"avg_line_length": 30,
"alnum_prop": 0.8,
"repo_name": "zhangqiang110/my4j",
"id": "9f05a218c50399e66084c4751510caf5eee266cd",
"size": "240",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "pms/src/main/java/com/swfarm/biz/ebay/dao/RelistEbayItemsConfigDao.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "41428"
}
],
"symlink_target": ""
} |
'use strict';
// I was getting errors when spawning too many instances at once
// throat is going to limit to the number of cpu's
const cpuCount = require('os').cpus().length;
const throat = require('throat')(cpuCount);
const execa = require('execa');
module.exports = function () {
const args = arguments;
return throat(() => {
return execa.apply(null, args);
});
};
| {
"content_hash": "e001208d7d41f9891e2be24f6c7fd33c",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 64,
"avg_line_length": 27.857142857142858,
"alnum_prop": 0.6615384615384615,
"repo_name": "dylang/space-hogs",
"id": "b7ed3c63de660e05f7f255282fd081377d573374",
"size": "390",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "util/spawn.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "10155"
}
],
"symlink_target": ""
} |
from google.cloud import monitoring_v3
def sample_get_alert_policy():
# Create a client
client = monitoring_v3.AlertPolicyServiceClient()
# Initialize request argument(s)
request = monitoring_v3.GetAlertPolicyRequest(
name="name_value",
)
# Make the request
response = client.get_alert_policy(request=request)
# Handle the response
print(response)
# [END monitoring_v3_generated_AlertPolicyService_GetAlertPolicy_sync]
| {
"content_hash": "2c53e5779f55dcc0ff580b64527c7b64",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 70,
"avg_line_length": 24.68421052631579,
"alnum_prop": 0.7164179104477612,
"repo_name": "googleapis/python-monitoring",
"id": "a9ee89a26f46f36e41f47f8f7400b36a20cbef79",
"size": "1867",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "samples/generated_samples/monitoring_v3_generated_alert_policy_service_get_alert_policy_sync.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "2050"
},
{
"name": "Python",
"bytes": "2375818"
},
{
"name": "Shell",
"bytes": "30672"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_05) on Tue Feb 02 23:09:48 CET 2016 -->
<title>Uses of Class com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup (libgdx API)</title>
<meta name="date" content="2016-02-02">
<link rel="stylesheet" type="text/css" href="../../../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup (libgdx API)";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../../com/badlogic/gdx/scenes/scene2d/ui/HorizontalGroup.html" title="class in com.badlogic.gdx.scenes.scene2d.ui">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../../../../../../../overview-tree.html">Tree</a></li>
<li><a href="../../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage">
libgdx API
<style>
body, td, th { font-family:Helvetica, Tahoma, Arial, sans-serif; font-size:10pt }
pre, code, tt { font-size:9pt; font-family:Lucida Console, Courier New, sans-serif }
h1, h2, h3, .FrameTitleFont, .FrameHeadingFont, .TableHeadingColor font { font-size:105%; font-weight:bold }
.TableHeadingColor { background:#EEEEFF; }
a { text-decoration:none }
a:hover { text-decoration:underline }
a:link, a:visited { color:blue }
table { border:0px }
.TableRowColor td:first-child { border-left:1px solid black }
.TableRowColor td { border:0px; border-bottom:1px solid black; border-right:1px solid black }
hr { border:0px; border-bottom:1px solid #333366; }
</style>
</div>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../../index.html?com/badlogic/gdx/scenes/scene2d/ui/class-use/HorizontalGroup.html" target="_top">Frames</a></li>
<li><a href="HorizontalGroup.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup" class="title">Uses of Class<br>com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup</h2>
</div>
<div class="classUseContainer">
<ul class="blockList">
<li class="blockList">
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation">
<caption><span>Packages that use <a href="../../../../../../../com/badlogic/gdx/scenes/scene2d/ui/HorizontalGroup.html" title="class in com.badlogic.gdx.scenes.scene2d.ui">HorizontalGroup</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Package</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="#com.badlogic.gdx.scenes.scene2d.ui">com.badlogic.gdx.scenes.scene2d.ui</a></td>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="com.badlogic.gdx.scenes.scene2d.ui">
<!-- -->
</a>
<h3>Uses of <a href="../../../../../../../com/badlogic/gdx/scenes/scene2d/ui/HorizontalGroup.html" title="class in com.badlogic.gdx.scenes.scene2d.ui">HorizontalGroup</a> in <a href="../../../../../../../com/badlogic/gdx/scenes/scene2d/ui/package-summary.html">com.badlogic.gdx.scenes.scene2d.ui</a></h3>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../../../../../com/badlogic/gdx/scenes/scene2d/ui/package-summary.html">com.badlogic.gdx.scenes.scene2d.ui</a> that return <a href="../../../../../../../com/badlogic/gdx/scenes/scene2d/ui/HorizontalGroup.html" title="class in com.badlogic.gdx.scenes.scene2d.ui">HorizontalGroup</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../../../com/badlogic/gdx/scenes/scene2d/ui/HorizontalGroup.html" title="class in com.badlogic.gdx.scenes.scene2d.ui">HorizontalGroup</a></code></td>
<td class="colLast"><span class="typeNameLabel">HorizontalGroup.</span><code><span class="memberNameLink"><a href="../../../../../../../com/badlogic/gdx/scenes/scene2d/ui/HorizontalGroup.html#align-int-">align</a></span>(int align)</code>
<div class="block">Sets the alignment of widgets within the horizontal group.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../../../../com/badlogic/gdx/scenes/scene2d/ui/HorizontalGroup.html" title="class in com.badlogic.gdx.scenes.scene2d.ui">HorizontalGroup</a></code></td>
<td class="colLast"><span class="typeNameLabel">HorizontalGroup.</span><code><span class="memberNameLink"><a href="../../../../../../../com/badlogic/gdx/scenes/scene2d/ui/HorizontalGroup.html#bottom--">bottom</a></span>()</code>
<div class="block">Sets <a href="../../../../../../../com/badlogic/gdx/utils/Align.html#bottom"><code>Align.bottom</code></a> and clears <a href="../../../../../../../com/badlogic/gdx/utils/Align.html#top"><code>Align.top</code></a> for the alignment of widgets within the horizontal group.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../../../com/badlogic/gdx/scenes/scene2d/ui/HorizontalGroup.html" title="class in com.badlogic.gdx.scenes.scene2d.ui">HorizontalGroup</a></code></td>
<td class="colLast"><span class="typeNameLabel">HorizontalGroup.</span><code><span class="memberNameLink"><a href="../../../../../../../com/badlogic/gdx/scenes/scene2d/ui/HorizontalGroup.html#center--">center</a></span>()</code>
<div class="block">Sets the alignment of widgets within the horizontal group to <a href="../../../../../../../com/badlogic/gdx/utils/Align.html#center"><code>Align.center</code></a>.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../../../../com/badlogic/gdx/scenes/scene2d/ui/HorizontalGroup.html" title="class in com.badlogic.gdx.scenes.scene2d.ui">HorizontalGroup</a></code></td>
<td class="colLast"><span class="typeNameLabel">HorizontalGroup.</span><code><span class="memberNameLink"><a href="../../../../../../../com/badlogic/gdx/scenes/scene2d/ui/HorizontalGroup.html#fill--">fill</a></span>()</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../../../com/badlogic/gdx/scenes/scene2d/ui/HorizontalGroup.html" title="class in com.badlogic.gdx.scenes.scene2d.ui">HorizontalGroup</a></code></td>
<td class="colLast"><span class="typeNameLabel">HorizontalGroup.</span><code><span class="memberNameLink"><a href="../../../../../../../com/badlogic/gdx/scenes/scene2d/ui/HorizontalGroup.html#fill-float-">fill</a></span>(float fill)</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../../../../com/badlogic/gdx/scenes/scene2d/ui/HorizontalGroup.html" title="class in com.badlogic.gdx.scenes.scene2d.ui">HorizontalGroup</a></code></td>
<td class="colLast"><span class="typeNameLabel">HorizontalGroup.</span><code><span class="memberNameLink"><a href="../../../../../../../com/badlogic/gdx/scenes/scene2d/ui/HorizontalGroup.html#pad-float-">pad</a></span>(float pad)</code>
<div class="block">Sets the padTop, padLeft, padBottom, and padRight to the specified value.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../../../com/badlogic/gdx/scenes/scene2d/ui/HorizontalGroup.html" title="class in com.badlogic.gdx.scenes.scene2d.ui">HorizontalGroup</a></code></td>
<td class="colLast"><span class="typeNameLabel">HorizontalGroup.</span><code><span class="memberNameLink"><a href="../../../../../../../com/badlogic/gdx/scenes/scene2d/ui/HorizontalGroup.html#pad-float-float-float-float-">pad</a></span>(float top,
float left,
float bottom,
float right)</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../../../../com/badlogic/gdx/scenes/scene2d/ui/HorizontalGroup.html" title="class in com.badlogic.gdx.scenes.scene2d.ui">HorizontalGroup</a></code></td>
<td class="colLast"><span class="typeNameLabel">HorizontalGroup.</span><code><span class="memberNameLink"><a href="../../../../../../../com/badlogic/gdx/scenes/scene2d/ui/HorizontalGroup.html#padBottom-float-">padBottom</a></span>(float padBottom)</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../../../com/badlogic/gdx/scenes/scene2d/ui/HorizontalGroup.html" title="class in com.badlogic.gdx.scenes.scene2d.ui">HorizontalGroup</a></code></td>
<td class="colLast"><span class="typeNameLabel">HorizontalGroup.</span><code><span class="memberNameLink"><a href="../../../../../../../com/badlogic/gdx/scenes/scene2d/ui/HorizontalGroup.html#padLeft-float-">padLeft</a></span>(float padLeft)</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../../../../com/badlogic/gdx/scenes/scene2d/ui/HorizontalGroup.html" title="class in com.badlogic.gdx.scenes.scene2d.ui">HorizontalGroup</a></code></td>
<td class="colLast"><span class="typeNameLabel">HorizontalGroup.</span><code><span class="memberNameLink"><a href="../../../../../../../com/badlogic/gdx/scenes/scene2d/ui/HorizontalGroup.html#padRight-float-">padRight</a></span>(float padRight)</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../../../com/badlogic/gdx/scenes/scene2d/ui/HorizontalGroup.html" title="class in com.badlogic.gdx.scenes.scene2d.ui">HorizontalGroup</a></code></td>
<td class="colLast"><span class="typeNameLabel">HorizontalGroup.</span><code><span class="memberNameLink"><a href="../../../../../../../com/badlogic/gdx/scenes/scene2d/ui/HorizontalGroup.html#padTop-float-">padTop</a></span>(float padTop)</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../../../../com/badlogic/gdx/scenes/scene2d/ui/HorizontalGroup.html" title="class in com.badlogic.gdx.scenes.scene2d.ui">HorizontalGroup</a></code></td>
<td class="colLast"><span class="typeNameLabel">HorizontalGroup.</span><code><span class="memberNameLink"><a href="../../../../../../../com/badlogic/gdx/scenes/scene2d/ui/HorizontalGroup.html#reverse--">reverse</a></span>()</code>
<div class="block">The children will be ordered from right to left rather than the default left to right.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../../../com/badlogic/gdx/scenes/scene2d/ui/HorizontalGroup.html" title="class in com.badlogic.gdx.scenes.scene2d.ui">HorizontalGroup</a></code></td>
<td class="colLast"><span class="typeNameLabel">HorizontalGroup.</span><code><span class="memberNameLink"><a href="../../../../../../../com/badlogic/gdx/scenes/scene2d/ui/HorizontalGroup.html#reverse-boolean-">reverse</a></span>(boolean reverse)</code>
<div class="block">If true, the children will be ordered from right to left rather than the default left to right.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../../../../com/badlogic/gdx/scenes/scene2d/ui/HorizontalGroup.html" title="class in com.badlogic.gdx.scenes.scene2d.ui">HorizontalGroup</a></code></td>
<td class="colLast"><span class="typeNameLabel">HorizontalGroup.</span><code><span class="memberNameLink"><a href="../../../../../../../com/badlogic/gdx/scenes/scene2d/ui/HorizontalGroup.html#space-float-">space</a></span>(float spacing)</code>
<div class="block">Sets the space between children.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../../../com/badlogic/gdx/scenes/scene2d/ui/HorizontalGroup.html" title="class in com.badlogic.gdx.scenes.scene2d.ui">HorizontalGroup</a></code></td>
<td class="colLast"><span class="typeNameLabel">HorizontalGroup.</span><code><span class="memberNameLink"><a href="../../../../../../../com/badlogic/gdx/scenes/scene2d/ui/HorizontalGroup.html#top--">top</a></span>()</code>
<div class="block">Sets <a href="../../../../../../../com/badlogic/gdx/utils/Align.html#top"><code>Align.top</code></a> and clears <a href="../../../../../../../com/badlogic/gdx/utils/Align.html#bottom"><code>Align.bottom</code></a> for the alignment of widgets within the horizontal group.</div>
</td>
</tr>
</tbody>
</table>
</li>
</ul>
</li>
</ul>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../../com/badlogic/gdx/scenes/scene2d/ui/HorizontalGroup.html" title="class in com.badlogic.gdx.scenes.scene2d.ui">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../../../../../../../overview-tree.html">Tree</a></li>
<li><a href="../../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage">libgdx API</div>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../../index.html?com/badlogic/gdx/scenes/scene2d/ui/class-use/HorizontalGroup.html" target="_top">Frames</a></li>
<li><a href="HorizontalGroup.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>
<div style="font-size:9pt"><i>
Copyright © 2010-2013 Mario Zechner ([email protected]), Nathan Sweet ([email protected])
</i></div>
</small></p>
</body>
</html>
| {
"content_hash": "f9c93b8bf92ecd651e19768d03922a72",
"timestamp": "",
"source": "github",
"line_count": 261,
"max_line_length": 373,
"avg_line_length": 61.16858237547893,
"alnum_prop": 0.6568117757594738,
"repo_name": "JFixby/libgdx-nightly",
"id": "284a83e039966d69f233c966906c8cf5a241eef9",
"size": "15965",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "gdx-nightly/docs/api/com/badlogic/gdx/scenes/scene2d/ui/class-use/HorizontalGroup.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "12808"
},
{
"name": "HTML",
"bytes": "44095638"
},
{
"name": "JavaScript",
"bytes": "827"
}
],
"symlink_target": ""
} |
first_name = "Chris"
last_name = "Miklius"
age = 22
# RSpec Tests. They are included in this file because the local variables you are creating are not accessible across files. If we try to run these files as a separate file per normal operation, the local variable checks will return nil.
describe 'first_name' do
it "is defined as a local variable" do
expect(defined?(first_name)).to eq 'local-variable'
end
it "is a String" do
expect(first_name).to be_a String
end
end
describe 'last_name' do
it "is defined as a local variable" do
expect(defined?(last_name)).to eq 'local-variable'
end
it "be a String" do
expect(last_name).to be_a String
end
end
describe 'age' do
it "is defined as a local variable" do
expect(defined?(age)).to eq 'local-variable'
end
it "is an integer" do
expect(age).to be_a Fixnum
end
end | {
"content_hash": "fcd6a06d892a8b1aabd1d2bf70b75bfd",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 236,
"avg_line_length": 23.486486486486488,
"alnum_prop": 0.7019562715765247,
"repo_name": "ChrisMIX/phase-0",
"id": "1c36bffaeb19276b0b9a966e6894881141dfa0b5",
"size": "886",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "week-4/defining-variables.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2946"
},
{
"name": "HTML",
"bytes": "26832"
},
{
"name": "JavaScript",
"bytes": "35640"
},
{
"name": "Ruby",
"bytes": "114765"
}
],
"symlink_target": ""
} |
using content::PluginService;
using webkit::WebPluginInfo;
PluginInfoMessageFilter::Context::Context(int render_process_id,
Profile* profile)
: render_process_id_(render_process_id),
resource_context_(profile->GetResourceContext()),
host_content_settings_map_(profile->GetHostContentSettingsMap()) {
allow_outdated_plugins_.Init(prefs::kPluginsAllowOutdated,
profile->GetPrefs(), NULL);
allow_outdated_plugins_.MoveToThread(content::BrowserThread::IO);
always_authorize_plugins_.Init(prefs::kPluginsAlwaysAuthorize,
profile->GetPrefs(), NULL);
always_authorize_plugins_.MoveToThread(content::BrowserThread::IO);
}
PluginInfoMessageFilter::Context::Context()
: render_process_id_(0),
resource_context_(NULL),
host_content_settings_map_(NULL) {
}
PluginInfoMessageFilter::Context::~Context() {
}
PluginInfoMessageFilter::PluginInfoMessageFilter(
int render_process_id,
Profile* profile)
: context_(render_process_id, profile),
weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
}
bool PluginInfoMessageFilter::OnMessageReceived(const IPC::Message& message,
bool* message_was_ok) {
IPC_BEGIN_MESSAGE_MAP_EX(PluginInfoMessageFilter, message, *message_was_ok)
IPC_MESSAGE_HANDLER_DELAY_REPLY(ChromeViewHostMsg_GetPluginInfo,
OnGetPluginInfo)
IPC_MESSAGE_UNHANDLED(return false)
IPC_END_MESSAGE_MAP()
return true;
}
void PluginInfoMessageFilter::OnDestruct() const {
const_cast<PluginInfoMessageFilter*>(this)->
weak_ptr_factory_.DetachFromThread();
const_cast<PluginInfoMessageFilter*>(this)->
weak_ptr_factory_.InvalidateWeakPtrs();
// Destroy on the UI thread because we contain a |PrefMember|.
content::BrowserThread::DeleteOnUIThread::Destruct(this);
}
PluginInfoMessageFilter::~PluginInfoMessageFilter() {}
struct PluginInfoMessageFilter::GetPluginInfo_Params {
int render_view_id;
GURL url;
GURL top_origin_url;
std::string mime_type;
};
void PluginInfoMessageFilter::OnGetPluginInfo(
int render_view_id,
const GURL& url,
const GURL& top_origin_url,
const std::string& mime_type,
IPC::Message* reply_msg) {
GetPluginInfo_Params params = {
render_view_id,
url,
top_origin_url,
mime_type
};
PluginService::GetInstance()->GetPlugins(
base::Bind(&PluginInfoMessageFilter::PluginsLoaded,
weak_ptr_factory_.GetWeakPtr(),
params, reply_msg));
}
void PluginInfoMessageFilter::PluginsLoaded(
const GetPluginInfo_Params& params,
IPC::Message* reply_msg,
const std::vector<WebPluginInfo>& plugins) {
ChromeViewHostMsg_GetPluginInfo_Status status;
WebPluginInfo plugin;
std::string actual_mime_type;
// This also fills in |actual_mime_type|.
if (!context_.FindEnabledPlugin(params.render_view_id, params.url,
params.top_origin_url, params.mime_type,
&status, &plugin, &actual_mime_type)) {
ChromeViewHostMsg_GetPluginInfo::WriteReplyParams(
reply_msg, status, plugin, actual_mime_type);
Send(reply_msg);
return;
}
#if defined(ENABLE_PLUGIN_INSTALLATION)
PluginFinder::Get(base::Bind(&PluginInfoMessageFilter::GotPluginFinder, this,
params, reply_msg, plugin, actual_mime_type));
#else
GotPluginFinder(params, reply_msg, plugin, actual_mime_type, NULL);
#endif
}
void PluginInfoMessageFilter::GotPluginFinder(
const GetPluginInfo_Params& params,
IPC::Message* reply_msg,
const WebPluginInfo& plugin,
const std::string& actual_mime_type,
PluginFinder* plugin_finder) {
ChromeViewHostMsg_GetPluginInfo_Status status;
context_.DecidePluginStatus(params, plugin, plugin_finder, &status);
ChromeViewHostMsg_GetPluginInfo::WriteReplyParams(
reply_msg, status, plugin, actual_mime_type);
Send(reply_msg);
}
void PluginInfoMessageFilter::Context::DecidePluginStatus(
const GetPluginInfo_Params& params,
const WebPluginInfo& plugin,
PluginFinder* plugin_finder,
ChromeViewHostMsg_GetPluginInfo_Status* status) const {
scoped_ptr<webkit::npapi::PluginGroup> group(
webkit::npapi::PluginList::Singleton()->GetPluginGroup(plugin));
ContentSetting plugin_setting = CONTENT_SETTING_DEFAULT;
bool uses_default_content_setting = true;
// Check plug-in content settings. The primary URL is the top origin URL and
// the secondary URL is the plug-in URL.
GetPluginContentSetting(plugin, params.top_origin_url, params.url,
group->identifier(), &plugin_setting,
&uses_default_content_setting);
DCHECK(plugin_setting != CONTENT_SETTING_DEFAULT);
#if defined(ENABLE_PLUGIN_INSTALLATION)
PluginInstaller::SecurityStatus plugin_status =
PluginInstaller::SECURITY_STATUS_UP_TO_DATE;
PluginInstaller* installer =
plugin_finder->FindPluginWithIdentifier(group->identifier());
if (installer)
plugin_status = installer->GetSecurityStatus(plugin);
// Check if the plug-in is outdated.
if (plugin_status == PluginInstaller::SECURITY_STATUS_OUT_OF_DATE &&
!allow_outdated_plugins_.GetValue()) {
if (allow_outdated_plugins_.IsManaged()) {
status->value =
ChromeViewHostMsg_GetPluginInfo_Status::kOutdatedDisallowed;
} else {
status->value = ChromeViewHostMsg_GetPluginInfo_Status::kOutdatedBlocked;
}
return;
}
// Check if the plug-in requires authorization.
if ((plugin_status ==
PluginInstaller::SECURITY_STATUS_REQUIRES_AUTHORIZATION ||
PluginService::GetInstance()->IsPluginUnstable(plugin.path)) &&
plugin.type != WebPluginInfo::PLUGIN_TYPE_PEPPER_IN_PROCESS &&
plugin.type != WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS &&
!always_authorize_plugins_.GetValue() &&
plugin_setting != CONTENT_SETTING_BLOCK &&
uses_default_content_setting) {
status->value = ChromeViewHostMsg_GetPluginInfo_Status::kUnauthorized;
return;
}
#endif
if (plugin_setting == CONTENT_SETTING_ASK)
status->value = ChromeViewHostMsg_GetPluginInfo_Status::kClickToPlay;
else if (plugin_setting == CONTENT_SETTING_BLOCK)
status->value = ChromeViewHostMsg_GetPluginInfo_Status::kBlocked;
}
bool PluginInfoMessageFilter::Context::FindEnabledPlugin(
int render_view_id,
const GURL& url,
const GURL& top_origin_url,
const std::string& mime_type,
ChromeViewHostMsg_GetPluginInfo_Status* status,
WebPluginInfo* plugin,
std::string* actual_mime_type) const {
bool allow_wildcard = true;
std::vector<WebPluginInfo> matching_plugins;
std::vector<std::string> mime_types;
PluginService::GetInstance()->GetPluginInfoArray(
url, mime_type, allow_wildcard, &matching_plugins, &mime_types);
content::PluginServiceFilter* filter =
PluginService::GetInstance()->GetFilter();
bool found = false;
for (size_t i = 0; i < matching_plugins.size(); ++i) {
bool enabled = !filter || filter->ShouldUsePlugin(render_process_id_,
render_view_id,
resource_context_,
url,
top_origin_url,
&matching_plugins[i]);
if (!found || enabled) {
*plugin = matching_plugins[i];
*actual_mime_type = mime_types[i];
if (enabled) {
// We have found an enabled plug-in. Return immediately.
return true;
}
// We have found a plug-in, but it's disabled. Keep looking for an
// enabled one.
found = true;
}
}
// If we're here and have previously found a plug-in, it must have been
// disabled.
if (found)
status->value = ChromeViewHostMsg_GetPluginInfo_Status::kDisabled;
else
status->value = ChromeViewHostMsg_GetPluginInfo_Status::kNotFound;
return false;
}
void PluginInfoMessageFilter::Context::GetPluginContentSetting(
const WebPluginInfo& plugin,
const GURL& policy_url,
const GURL& plugin_url,
const std::string& resource,
ContentSetting* setting,
bool* uses_default_content_setting) const {
// Treat Native Client invocations like Javascript.
bool is_nacl_plugin = (plugin.name == ASCIIToUTF16(
chrome::ChromeContentClient::kNaClPluginName));
scoped_ptr<base::Value> value;
content_settings::SettingInfo info;
bool uses_plugin_specific_setting = false;
if (is_nacl_plugin) {
value.reset(
host_content_settings_map_->GetWebsiteSetting(
policy_url, policy_url, CONTENT_SETTINGS_TYPE_JAVASCRIPT,
std::string(), &info));
} else {
value.reset(
host_content_settings_map_->GetWebsiteSetting(
policy_url, plugin_url, CONTENT_SETTINGS_TYPE_PLUGINS, resource,
&info));
if (value.get()) {
uses_plugin_specific_setting = true;
} else {
value.reset(host_content_settings_map_->GetWebsiteSetting(
policy_url, plugin_url, CONTENT_SETTINGS_TYPE_PLUGINS, std::string(),
&info));
}
}
*setting = content_settings::ValueToContentSetting(value.get());
*uses_default_content_setting =
!uses_plugin_specific_setting &&
info.primary_pattern == ContentSettingsPattern::Wildcard() &&
info.secondary_pattern == ContentSettingsPattern::Wildcard();
}
| {
"content_hash": "309e5f492470979096733d300a7b2090",
"timestamp": "",
"source": "github",
"line_count": 255,
"max_line_length": 79,
"avg_line_length": 37.772549019607844,
"alnum_prop": 0.6677740863787376,
"repo_name": "keishi/chromium",
"id": "d980ada6b7b79f8e76cf8d261e45c110a1104792",
"size": "10751",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "chrome/browser/renderer_host/plugin_info_message_filter.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ASP",
"bytes": "853"
},
{
"name": "Arduino",
"bytes": "464"
},
{
"name": "Assembly",
"bytes": "1172794"
},
{
"name": "C",
"bytes": "67452317"
},
{
"name": "C#",
"bytes": "1132"
},
{
"name": "C++",
"bytes": "132681259"
},
{
"name": "F#",
"bytes": "381"
},
{
"name": "Go",
"bytes": "19048"
},
{
"name": "Java",
"bytes": "361412"
},
{
"name": "JavaScript",
"bytes": "16603687"
},
{
"name": "Objective-C",
"bytes": "9609581"
},
{
"name": "PHP",
"bytes": "97796"
},
{
"name": "Perl",
"bytes": "918683"
},
{
"name": "Python",
"bytes": "6407891"
},
{
"name": "R",
"bytes": "524"
},
{
"name": "Shell",
"bytes": "4192593"
},
{
"name": "Tcl",
"bytes": "277077"
}
],
"symlink_target": ""
} |
// Based upon the excellent jsx-transpiler by Ingvar Stepanyan (RReverser)
// https://github.com/RReverser/jsx-transpiler
// jsx
import isString from "lodash/lang/isString";
import * as messages from "../../messages";
import esutils from "esutils";
import * as react from "./react";
import * as t from "../../types";
export default function (exports, opts) {
exports.check = function (node) {
if (t.isJSX(node)) return true;
if (react.isCreateClass(node)) return true;
return false;
};
exports.JSXIdentifier = function (node, parent) {
if (node.name === "this" && t.isReferenced(node, parent)) {
return t.thisExpression();
} else if (esutils.keyword.isIdentifierName(node.name)) {
node.type = "Identifier";
} else {
return t.literal(node.name);
}
};
exports.JSXNamespacedName = function (node, parent, scope, file) {
throw file.errorWithNode(node, messages.get("JSXNamespacedTags"));
};
exports.JSXMemberExpression = {
exit(node) {
node.computed = t.isLiteral(node.property);
node.type = "MemberExpression";
}
};
exports.JSXExpressionContainer = function (node) {
return node.expression;
};
exports.JSXAttribute = {
enter(node) {
var value = node.value;
if (t.isLiteral(value) && isString(value.value)) {
value.value = value.value.replace(/\n\s+/g, " ");
}
},
exit(node) {
var value = node.value || t.literal(true);
return t.inherits(t.property("init", node.name, value), node);
}
};
exports.JSXOpeningElement = {
exit(node, parent, scope, file) {
var tagExpr = node.name;
var args = [];
var tagName;
if (t.isIdentifier(tagExpr)) {
tagName = tagExpr.name;
} else if (t.isLiteral(tagExpr)) {
tagName = tagExpr.value;
}
var state = {
tagExpr: tagExpr,
tagName: tagName,
args: args
};
if (opts.pre) {
opts.pre(state, file);
}
var attribs = node.attributes;
if (attribs.length) {
attribs = buildJSXOpeningElementAttributes(attribs, file);
} else {
attribs = t.literal(null);
}
args.push(attribs);
if (opts.post) {
opts.post(state, file);
}
return state.call || t.callExpression(state.callee, args);
}
};
/**
* The logic for this is quite terse. It's because we need to
* support spread elements. We loop over all attributes,
* breaking on spreads, we then push a new object containg
* all prior attributes to an array for later processing.
*/
var buildJSXOpeningElementAttributes = function (attribs, file) {
var _props = [];
var objs = [];
var pushProps = function () {
if (!_props.length) return;
objs.push(t.objectExpression(_props));
_props = [];
};
while (attribs.length) {
var prop = attribs.shift();
if (t.isJSXSpreadAttribute(prop)) {
pushProps();
objs.push(prop.argument);
} else {
_props.push(prop);
}
}
pushProps();
if (objs.length === 1) {
// only one object
attribs = objs[0];
} else {
// looks like we have multiple objects
if (!t.isObjectExpression(objs[0])) {
objs.unshift(t.objectExpression([]));
}
// spread it
attribs = t.callExpression(
file.addHelper("extends"),
objs
);
}
return attribs;
};
exports.JSXElement = {
exit(node) {
var callExpr = node.openingElement;
for (var i = 0; i < node.children.length; i++) {
var child = node.children[i];
if (t.isLiteral(child) && typeof child.value === "string") {
cleanJSXElementLiteralChild(child, callExpr.arguments);
continue;
} else if (t.isJSXEmptyExpression(child)) {
continue;
}
callExpr.arguments.push(child);
}
callExpr.arguments = flatten(callExpr.arguments);
if (callExpr.arguments.length >= 3) {
callExpr._prettyCall = true;
}
return t.inherits(callExpr, node);
}
};
var isStringLiteral = function (node) {
return t.isLiteral(node) && isString(node.value);
};
var flatten = function (args) {
var flattened = [];
var last;
for (var i = 0; i < args.length; i++) {
var arg = args[i];
if (isStringLiteral(arg) && isStringLiteral(last)) {
last.value += arg.value;
} else {
last = arg;
flattened.push(arg);
}
}
return flattened;
};
var cleanJSXElementLiteralChild = function (child, args) {
var lines = child.value.split(/\r\n|\n|\r/);
var lastNonEmptyLine = 0;
var i;
for (i = 0; i < lines.length; i++) {
if (lines[i].match(/[^ \t]/)) {
lastNonEmptyLine = i;
}
}
for (i = 0; i < lines.length; i++) {
var line = lines[i];
var isFirstLine = i === 0;
var isLastLine = i === lines.length - 1;
var isLastNonEmptyLine = i === lastNonEmptyLine;
// replace rendered whitespace tabs with spaces
var trimmedLine = line.replace(/\t/g, " ");
// trim whitespace touching a newline
if (!isFirstLine) {
trimmedLine = trimmedLine.replace(/^[ ]+/, "");
}
// trim whitespace touching an endline
if (!isLastLine) {
trimmedLine = trimmedLine.replace(/[ ]+$/, "");
}
if (trimmedLine) {
if (!isLastNonEmptyLine) {
trimmedLine += " ";
}
args.push(t.literal(trimmedLine));
}
}
};
// display names
var addDisplayName = function (id, call) {
var props = call.arguments[0].properties;
var safe = true;
for (var i = 0; i < props.length; i++) {
var prop = props[i];
if (t.isIdentifier(prop.key, { name: "displayName" })) {
safe = false;
break;
}
}
if (safe) {
props.unshift(t.property("init", t.identifier("displayName"), t.literal(id)));
}
};
exports.ExportDeclaration = function (node, parent, scope, file) {
if (node.default && react.isCreateClass(node.declaration)) {
addDisplayName(file.opts.basename, node.declaration);
}
};
exports.AssignmentExpression =
exports.Property =
exports.VariableDeclarator = function (node) {
var left, right;
if (t.isAssignmentExpression(node)) {
left = node.left;
right = node.right;
} else if (t.isProperty(node)) {
left = node.key;
right = node.value;
} else if (t.isVariableDeclarator(node)) {
left = node.id;
right = node.init;
}
if (t.isMemberExpression(left)) {
left = left.property;
}
if (t.isIdentifier(left) && react.isCreateClass(right)) {
addDisplayName(left.name, right);
}
};
};
| {
"content_hash": "4b51d6f4ea64aeb9f576758646bc9b99",
"timestamp": "",
"source": "github",
"line_count": 285,
"max_line_length": 84,
"avg_line_length": 24.028070175438597,
"alnum_prop": 0.5752044392523364,
"repo_name": "jaredly/babel",
"id": "02b9ba1ffe464487661eccfbcd1ba154bdf7973a",
"size": "6848",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/babel/transformation/helpers/build-react-transformer.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "529"
},
{
"name": "JavaScript",
"bytes": "363306"
},
{
"name": "Makefile",
"bytes": "2705"
}
],
"symlink_target": ""
} |
class AddNwordToEntries < ActiveRecord::Migration
def change
add_column :entries, :nword, :string
end
end
| {
"content_hash": "015291ebdf4a843461d2a5076b2fefc4",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 49,
"avg_line_length": 22.8,
"alnum_prop": 0.7456140350877193,
"repo_name": "ARMmaster17/JeffBot",
"id": "e4544dae3d445def81d8e4f4b623fb872f504ded",
"size": "114",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "db/migrate/20160427050108_add_nword_to_entries.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "9033"
},
{
"name": "Shell",
"bytes": "127"
}
],
"symlink_target": ""
} |
import {MdGridTile} from './grid-tile';
import {TileCoordinator} from './tile-coordinator';
/*
* Sets the style properties for an individual tile, given the position calculated by the
* Tile Coordinator.
* @docs-private
*/
export abstract class TileStyler {
_gutterSize: string;
_rows: number = 0;
_rowspan: number = 0;
_cols: number;
_direction: string;
/*
* Adds grid-list layout info once it is available. Cannot be processed in the constructor
* because these properties haven't been calculated by that point.
*
* @param gutterSize Size of the grid's gutter.
* @param tracker Instance of the TileCoordinator.
* @param cols Amount of columns in the grid.
* @param direction Layout direction of the grid.
*/
init(gutterSize: string, tracker: TileCoordinator, cols: number, direction: string): void {
this._gutterSize = normalizeUnits(gutterSize);
this._rows = tracker.rowCount;
this._rowspan = tracker.rowspan;
this._cols = cols;
this._direction = direction;
}
/*
* Computes the amount of space a single 1x1 tile would take up (width or height).
* Used as a basis for other calculations.
* @param sizePercent Percent of the total grid-list space that one 1x1 tile would take up.
* @param gutterFraction Fraction of the gutter size taken up by one 1x1 tile.
* @return The size of a 1x1 tile as an expression that can be evaluated via CSS calc().
*/
getBaseTileSize(sizePercent: number, gutterFraction: number): string {
// Take the base size percent (as would be if evenly dividing the size between cells),
// and then subtracting the size of one gutter. However, since there are no gutters on the
// edges, each tile only uses a fraction (gutterShare = numGutters / numCells) of the gutter
// size. (Imagine having one gutter per tile, and then breaking up the extra gutter on the
// edge evenly among the cells).
return `(${sizePercent}% - ( ${this._gutterSize} * ${gutterFraction} ))`;
}
/*
* Gets The horizontal or vertical position of a tile, e.g., the 'top' or 'left' property value.
* @param offset Number of tiles that have already been rendered in the row/column.
* @param baseSize Base size of a 1x1 tile (as computed in getBaseTileSize).
* @return Position of the tile as a CSS calc() expression.
*/
getTilePosition(baseSize: string, offset: number): string {
// The position comes the size of a 1x1 tile plus gutter for each previous tile in the
// row/column (offset).
return calc(`(${baseSize} + ${this._gutterSize}) * ${offset}`);
}
/*
* Gets the actual size of a tile, e.g., width or height, taking rowspan or colspan into account.
* @param baseSize Base size of a 1x1 tile (as computed in getBaseTileSize).
* @param span The tile's rowspan or colspan.
* @return Size of the tile as a CSS calc() expression.
*/
getTileSize(baseSize: string, span: number): string {
return `(${baseSize} * ${span}) + (${span - 1} * ${this._gutterSize})`;
}
/*
* Sets the style properties to be applied to a tile for the given row and column index.
* @param tile Tile to which to apply the styling.
* @param rowIndex Index of the tile's row.
* @param colIndex Index of the tile's column.
*/
setStyle(tile: MdGridTile, rowIndex: number, colIndex: number): void {
// Percent of the available horizontal space that one column takes up.
let percentWidthPerTile = 100 / this._cols;
// Fraction of the vertical gutter size that each column takes up.
// For example, if there are 5 columns, each column uses 4/5 = 0.8 times the gutter width.
let gutterWidthFractionPerTile = (this._cols - 1) / this._cols;
this.setColStyles(tile, colIndex, percentWidthPerTile, gutterWidthFractionPerTile);
this.setRowStyles(tile, rowIndex, percentWidthPerTile, gutterWidthFractionPerTile);
}
/* Sets the horizontal placement of the tile in the list. */
setColStyles(tile: MdGridTile, colIndex: number, percentWidth: number,
gutterWidth: number) {
// Base horizontal size of a column.
let baseTileWidth = this.getBaseTileSize(percentWidth, gutterWidth);
// The width and horizontal position of each tile is always calculated the same way, but the
// height and vertical position depends on the rowMode.
let side = this._direction === 'ltr' ? 'left' : 'right';
tile._setStyle(side, this.getTilePosition(baseTileWidth, colIndex));
tile._setStyle('width', calc(this.getTileSize(baseTileWidth, tile.colspan)));
}
/*
* Calculates the total size taken up by gutters across one axis of a list.
*/
getGutterSpan(): string {
return `${this._gutterSize} * (${this._rowspan} - 1)`;
}
/*
* Calculates the total size taken up by tiles across one axis of a list.
* @param tileHeight Height of the tile.
*/
getTileSpan(tileHeight: string): string {
return `${this._rowspan} * ${this.getTileSize(tileHeight, 1)}`;
}
/*
* Sets the vertical placement of the tile in the list.
* This method will be implemented by each type of TileStyler.
* @docs-private
*/
abstract setRowStyles(tile: MdGridTile, rowIndex: number, percentWidth: number,
gutterWidth: number);
/*
* Calculates the computed height and returns the correct style property to set.
* This method can be implemented by each type of TileStyler.
* @docs-private
*/
getComputedHeight(): [string, string] | null { return null; }
}
/*
* This type of styler is instantiated when the user passes in a fixed row height.
* Example <md-grid-list cols="3" rowHeight="100px">
* @docs-private
*/
export class FixedTileStyler extends TileStyler {
constructor(public fixedRowHeight: string) { super(); }
init(gutterSize: string, tracker: TileCoordinator, cols: number, direction: string) {
super.init(gutterSize, tracker, cols, direction);
this.fixedRowHeight = normalizeUnits(this.fixedRowHeight);
}
setRowStyles(tile: MdGridTile, rowIndex: number): void {
tile._setStyle('top', this.getTilePosition(this.fixedRowHeight, rowIndex));
tile._setStyle('height', calc(this.getTileSize(this.fixedRowHeight, tile.rowspan)));
}
getComputedHeight(): [string, string] {
return [
'height', calc(`${this.getTileSpan(this.fixedRowHeight)} + ${this.getGutterSpan()}`)
];
}
}
/*
* This type of styler is instantiated when the user passes in a width:height ratio
* for the row height. Example <md-grid-list cols="3" rowHeight="3:1">
* @docs-private
*/
export class RatioTileStyler extends TileStyler {
/* Ratio width:height given by user to determine row height.*/
rowHeightRatio: number;
baseTileHeight: string;
constructor(value: string) {
super();
this._parseRatio(value);
}
setRowStyles(tile: MdGridTile, rowIndex: number, percentWidth: number,
gutterWidth: number): void {
let percentHeightPerTile = percentWidth / this.rowHeightRatio;
this.baseTileHeight = this.getBaseTileSize(percentHeightPerTile, gutterWidth);
// Use paddingTop and marginTop to maintain the given aspect ratio, as
// a percentage-based value for these properties is applied versus the *width* of the
// containing block. See http://www.w3.org/TR/CSS2/box.html#margin-properties
tile._setStyle('marginTop', this.getTilePosition(this.baseTileHeight, rowIndex));
tile._setStyle('paddingTop', calc(this.getTileSize(this.baseTileHeight, tile.rowspan)));
}
getComputedHeight(): [string, string] {
return [
'paddingBottom', calc(`${this.getTileSpan(this.baseTileHeight)} + ${this.getGutterSpan()}`)
];
}
private _parseRatio(value: string): void {
let ratioParts = value.split(':');
if (ratioParts.length !== 2) {
throw Error(`md-grid-list: invalid ratio given for row-height: "${value}"`);
}
this.rowHeightRatio = parseFloat(ratioParts[0]) / parseFloat(ratioParts[1]);
}
}
/*
* This type of styler is instantiated when the user selects a "fit" row height mode.
* In other words, the row height will reflect the total height of the container divided
* by the number of rows. Example <md-grid-list cols="3" rowHeight="fit">
*
* @docs-private
*/
export class FitTileStyler extends TileStyler {
setRowStyles(tile: MdGridTile, rowIndex: number): void {
// Percent of the available vertical space that one row takes up.
let percentHeightPerTile = 100 / this._rowspan;
// Fraction of the horizontal gutter size that each column takes up.
let gutterHeightPerTile = (this._rows - 1) / this._rows;
// Base vertical size of a column.
let baseTileHeight = this.getBaseTileSize(percentHeightPerTile, gutterHeightPerTile);
tile._setStyle('top', this.getTilePosition(baseTileHeight, rowIndex));
tile._setStyle('height', calc(this.getTileSize(baseTileHeight, tile.rowspan)));
}
}
/* Wraps a CSS string in a calc function */
function calc(exp: string): string { return `calc(${exp})`; }
/* Appends pixels to a CSS string if no units are given. */
function normalizeUnits(value: string): string {
return (value.match(/px|em|rem/)) ? value : value + 'px';
}
| {
"content_hash": "6bd278916b0e99d0ea17c850a1418284",
"timestamp": "",
"source": "github",
"line_count": 245,
"max_line_length": 99,
"avg_line_length": 37.57551020408163,
"alnum_prop": 0.6956332826417554,
"repo_name": "tomlandau/material2-new",
"id": "73df4eb16273fb7e7fb72b785e739c005b25376c",
"size": "9407",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/lib/grid-list/tile-styler.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "224478"
},
{
"name": "HTML",
"bytes": "185219"
},
{
"name": "JavaScript",
"bytes": "20204"
},
{
"name": "Shell",
"bytes": "22710"
},
{
"name": "TypeScript",
"bytes": "2167997"
}
],
"symlink_target": ""
} |
<?php
/*
Safe sample
input : Get a serialize string in POST and unserialize it
sanitize : use of ternary condition
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.*/
$string = $_POST['UserData'] ;
$tainted = unserialize($string);
$tainted = $tainted == 'safe1' ? 'safe1' : 'safe2';
$var = header(sprintf("Location: pages/'%d'.php", $tainted));
?> | {
"content_hash": "4073e232865aaeacd451665a5b3c5716",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 75,
"avg_line_length": 22.839285714285715,
"alnum_prop": 0.7584050039093041,
"repo_name": "stivalet/PHP-Vulnerability-test-suite",
"id": "3949b9cdad721db9b9956b8ce7dc3b6fbb2b6639",
"size": "1279",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "URF/CWE_601/safe/CWE_601__unserialize__ternary_white_list__header_file_id-sprintf_%d_simple_quote.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "64184004"
}
],
"symlink_target": ""
} |
require_relative 'message_filter'
require 'rspec/its'
require 'rspec/collection_matchers'
describe MessageFilter do
shared_examples 'MessageFilter with argument "foo"' do
it { is_expected.to be_detect('hello from foo') }
it { is_expected.not_to be_detect('hello, world!') }
its(:ng_words) { is_expected.not_to be_empty }
end
context 'with argument "foo"' do
subject { MessageFilter.new('foo') }
it_behaves_like 'MessageFilter with argument "foo"'
it { is_expected.to have(1).ng_words }
end
context 'with argument "foo"' do
subject { MessageFilter.new('foo', 'bar') }
it { is_expected.to be_detect('hello from bar') }
it_behaves_like 'MessageFilter with argument "foo"'
it { is_expected.to have(2).ng_words }
end
end
| {
"content_hash": "d7b7531760db2d8e12b6e6a84494b7e2",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 56,
"avg_line_length": 29.73076923076923,
"alnum_prop": 0.6778783958602846,
"repo_name": "pixta-yuki-ito/rspec",
"id": "00b974f3b161f6de7037cab9ccade1cc1d6fabdc",
"size": "773",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "message_filter_spec.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "1812"
}
],
"symlink_target": ""
} |
<?php
// Call Zend_Form_Element_TextareaTest::main() if this source file is executed directly.
if (!defined("PHPUnit_MAIN_METHOD")) {
define("PHPUnit_MAIN_METHOD", "Zend_Form_Element_TextareaTest::main");
}
require_once 'Zend/Form/Element/Textarea.php';
/**
* Test class for Zend_Form_Element_Textarea
*
* @category Zend
* @package Zend_Form
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @group Zend_Form
*/
class Zend_Form_Element_TextareaTest extends PHPUnit_Framework_TestCase
{
/**
* Runs the test methods of this class.
*
* @return void
*/
public static function main()
{
$suite = new PHPUnit_Framework_TestSuite("Zend_Form_Element_TextareaTest");
$result = PHPUnit_TextUI_TestRunner::run($suite);
}
/**
* Sets up the fixture, for example, open a network connection.
* This method is called before a test is executed.
*
* @return void
*/
public function setUp()
{
$this->element = new Zend_Form_Element_Textarea('foo');
}
/**
* Tears down the fixture, for example, close a network connection.
* This method is called after a test is executed.
*
* @return void
*/
public function tearDown()
{
}
public function testTextareaElementSubclassesXhtmlElement()
{
$this->assertTrue($this->element instanceof Zend_Form_Element_Xhtml);
}
public function testTextareaElementInstanceOfBaseElement()
{
$this->assertTrue($this->element instanceof Zend_Form_Element);
}
public function testTextareaElementUsesTextareaHelperInViewHelperDecoratorByDefault()
{
$this->_checkZf2794();
$decorator = $this->element->getDecorator('viewHelper');
$this->assertTrue($decorator instanceof Zend_Form_Decorator_ViewHelper);
$decorator->setElement($this->element);
$helper = $decorator->getHelper();
$this->assertEquals('formTextarea', $helper);
}
/**
* Used by test methods susceptible to ZF-2794, marks a test as incomplete
*
* @link http://framework.zend.com/issues/browse/ZF-2794
* @return void
*/
protected function _checkZf2794()
{
if (strtolower(substr(PHP_OS, 0, 3)) == 'win' && version_compare(PHP_VERSION, '5.1.4', '=')) {
$this->markTestIncomplete('Error occurs for PHP 5.1.4 on Windows');
}
}
}
// Call Zend_Form_Element_TextareaTest::main() if this source file is executed directly.
if (PHPUnit_MAIN_METHOD == "Zend_Form_Element_TextareaTest::main") {
Zend_Form_Element_TextareaTest::main();
}
| {
"content_hash": "4163b3ff4fa9b4f341211c6ad72be425",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 102,
"avg_line_length": 29.574468085106382,
"alnum_prop": 0.6453237410071943,
"repo_name": "grzana12/ZendFramework",
"id": "d3a3c506e06775f6abbca1790906fc29f8316f58",
"size": "3495",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "tests/Zend/Form/Element/TextareaTest.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "JavaScript",
"bytes": "30081"
},
{
"name": "PHP",
"bytes": "30424694"
},
{
"name": "Ruby",
"bytes": "10"
},
{
"name": "Shell",
"bytes": "5476"
}
],
"symlink_target": ""
} |
'use strict';
require('app-templates');
var App = function($urlRouterProvider) {
$urlRouterProvider.otherwise('/');
};
App.$inject = ['$urlRouterProvider'];
var trafficPortal = angular.module('trafficPortal', [
'config',
'ngAnimate',
'ngResource',
'ngSanitize',
'ngRoute',
'ui.router',
'ui.bootstrap',
'restangular',
'app.templates',
'angular-jwt',
'angular-loading-bar',
// public modules
require('./modules/public').name,
require('./modules/public/login').name,
// private modules
require('./modules/private').name,
require('./modules/private/asns').name,
require('./modules/private/asns/edit').name,
require('./modules/private/asns/list').name,
require('./modules/private/asns/new').name,
require('./modules/private/cacheGroups').name,
require('./modules/private/cacheGroups/edit').name,
require('./modules/private/cacheGroups/list').name,
require('./modules/private/cacheGroups/new').name,
require('./modules/private/cacheGroups/asns').name,
require('./modules/private/cacheGroups/parameters').name,
require('./modules/private/cacheGroups/servers').name,
require('./modules/private/cacheGroups/staticDnsEntries').name,
require('./modules/private/cacheChecks').name,
require('./modules/private/cacheStats').name,
require('./modules/private/cdns').name,
require('./modules/private/cdns/config').name,
require('./modules/private/cdns/deliveryServices').name,
require('./modules/private/cdns/dnssecKeys').name,
require('./modules/private/cdns/dnssecKeys/generate').name,
require('./modules/private/cdns/dnssecKeys/view').name,
require('./modules/private/cdns/edit').name,
require('./modules/private/cdns/federations').name,
require('./modules/private/cdns/federations/deliveryServices').name,
require('./modules/private/cdns/federations/edit').name,
require('./modules/private/cdns/federations/list').name,
require('./modules/private/cdns/federations/new').name,
require('./modules/private/cdns/federations/users').name,
require('./modules/private/cdns/list').name,
require('./modules/private/cdns/new').name,
require('./modules/private/cdns/profiles').name,
require('./modules/private/cdns/servers').name,
require('./modules/private/changeLogs').name,
require('./modules/private/changeLogs/list').name,
require('./modules/private/dashboard').name,
require('./modules/private/dashboard/view').name,
require('./modules/private/deliveryServices').name,
require('./modules/private/deliveryServices/compare').name,
require('./modules/private/deliveryServices/edit').name,
require('./modules/private/deliveryServices/list').name,
require('./modules/private/deliveryServices/new').name,
require('./modules/private/deliveryServices/jobs').name,
require('./modules/private/deliveryServices/jobs/list').name,
require('./modules/private/deliveryServices/jobs/new').name,
require('./modules/private/deliveryServices/regexes').name,
require('./modules/private/deliveryServices/regexes/edit').name,
require('./modules/private/deliveryServices/regexes/list').name,
require('./modules/private/deliveryServices/regexes/new').name,
require('./modules/private/deliveryServices/servers').name,
require('./modules/private/deliveryServices/staticDnsEntries').name,
require('./modules/private/deliveryServices/targets').name,
require('./modules/private/deliveryServices/targets/edit').name,
require('./modules/private/deliveryServices/targets/list').name,
require('./modules/private/deliveryServices/targets/new').name,
require('./modules/private/deliveryServices/users').name,
require('./modules/private/deliveryServices/urlSigKeys').name,
require('./modules/private/deliveryServices/uriSigningKeys').name,
require('./modules/private/deliveryServices/sslKeys').name,
require('./modules/private/deliveryServices/sslKeys/view').name,
require('./modules/private/deliveryServices/sslKeys/generate').name,
require('./modules/private/divisions').name,
require('./modules/private/divisions/edit').name,
require('./modules/private/divisions/list').name,
require('./modules/private/divisions/new').name,
require('./modules/private/divisions/regions').name,
require('./modules/private/iso').name,
require('./modules/private/jobs').name,
require('./modules/private/jobs/list').name,
require('./modules/private/jobs/new').name,
require('./modules/private/physLocations').name,
require('./modules/private/physLocations/edit').name,
require('./modules/private/physLocations/list').name,
require('./modules/private/physLocations/new').name,
require('./modules/private/physLocations/servers').name,
require('./modules/private/parameters').name,
require('./modules/private/parameters/cacheGroups').name,
require('./modules/private/parameters/edit').name,
require('./modules/private/parameters/list').name,
require('./modules/private/parameters/new').name,
require('./modules/private/parameters/profiles').name,
require('./modules/private/profiles').name,
require('./modules/private/profiles/compare').name,
require('./modules/private/profiles/deliveryServices').name,
require('./modules/private/profiles/edit').name,
require('./modules/private/profiles/list').name,
require('./modules/private/profiles/new').name,
require('./modules/private/profiles/parameters').name,
require('./modules/private/profiles/servers').name,
require('./modules/private/regions').name,
require('./modules/private/regions/edit').name,
require('./modules/private/regions/list').name,
require('./modules/private/regions/physLocations').name,
require('./modules/private/regions/new').name,
require('./modules/private/servers').name,
require('./modules/private/servers/configFiles').name,
require('./modules/private/servers/deliveryServices').name,
require('./modules/private/servers/edit').name,
require('./modules/private/servers/new').name,
require('./modules/private/servers/list').name,
require('./modules/private/statuses').name,
require('./modules/private/statuses/edit').name,
require('./modules/private/statuses/list').name,
require('./modules/private/statuses/new').name,
require('./modules/private/statuses/servers').name,
require('./modules/private/tenants').name,
require('./modules/private/tenants/deliveryServices').name,
require('./modules/private/tenants/edit').name,
require('./modules/private/tenants/list').name,
require('./modules/private/tenants/new').name,
require('./modules/private/tenants/users').name,
require('./modules/private/types').name,
require('./modules/private/types/edit').name,
require('./modules/private/types/list').name,
require('./modules/private/types/new').name,
require('./modules/private/types/servers').name,
require('./modules/private/types/cacheGroups').name,
require('./modules/private/types/deliveryServices').name,
require('./modules/private/types/staticDnsEntries').name,
require('./modules/private/users').name,
require('./modules/private/users/deliveryServices').name,
require('./modules/private/users/edit').name,
require('./modules/private/users/list').name,
require('./modules/private/users/new').name,
require('./modules/private/users/register').name,
// current user
require('./modules/private/user').name,
require('./modules/private/user/edit').name,
// custom
require('./modules/private/custom').name,
// common modules
require('./common/modules/compare').name,
require('./common/modules/dialog/compare').name,
require('./common/modules/dialog/confirm').name,
require('./common/modules/dialog/confirm/enter').name,
require('./common/modules/dialog/delete').name,
require('./common/modules/dialog/federationResolver').name,
require('./common/modules/dialog/import').name,
require('./common/modules/dialog/input').name,
require('./common/modules/dialog/reset').name,
require('./common/modules/dialog/select').name,
require('./common/modules/dialog/select/status').name,
require('./common/modules/dialog/text').name,
require('./common/modules/header').name,
require('./common/modules/message').name,
require('./common/modules/navigation').name,
require('./common/modules/release').name,
// forms
require('./common/modules/form/cacheGroup').name,
require('./common/modules/form/cacheGroup/edit').name,
require('./common/modules/form/cacheGroup/new').name,
require('./common/modules/form/asn').name,
require('./common/modules/form/asn/edit').name,
require('./common/modules/form/asn/new').name,
require('./common/modules/form/cdn').name,
require('./common/modules/form/cdn/edit').name,
require('./common/modules/form/cdn/new').name,
require('./common/modules/form/cdnDnssecKeys').name,
require('./common/modules/form/cdnDnssecKeys/generate').name,
require('./common/modules/form/deliveryService').name,
require('./common/modules/form/deliveryService/edit').name,
require('./common/modules/form/deliveryService/new').name,
require('./common/modules/form/deliveryServiceRegex').name,
require('./common/modules/form/deliveryServiceRegex/edit').name,
require('./common/modules/form/deliveryServiceRegex/new').name,
require('./common/modules/form/deliveryServiceSslKeys').name,
require('./common/modules/form/deliveryServiceSslKeys/generate').name,
require('./common/modules/form/deliveryServiceTarget').name,
require('./common/modules/form/deliveryServiceTarget/edit').name,
require('./common/modules/form/deliveryServiceTarget/new').name,
require('./common/modules/form/deliveryServiceJob').name,
require('./common/modules/form/deliveryServiceJob/new').name,
require('./common/modules/form/division').name,
require('./common/modules/form/division/edit').name,
require('./common/modules/form/division/new').name,
require('./common/modules/form/federation').name,
require('./common/modules/form/federation/edit').name,
require('./common/modules/form/federation/new').name,
require('./common/modules/form/iso').name,
require('./common/modules/form/job').name,
require('./common/modules/form/job/new').name,
require('./common/modules/form/physLocation').name,
require('./common/modules/form/physLocation/edit').name,
require('./common/modules/form/physLocation/new').name,
require('./common/modules/form/parameter').name,
require('./common/modules/form/parameter/edit').name,
require('./common/modules/form/parameter/new').name,
require('./common/modules/form/profile').name,
require('./common/modules/form/profile/edit').name,
require('./common/modules/form/profile/new').name,
require('./common/modules/form/region').name,
require('./common/modules/form/region/edit').name,
require('./common/modules/form/region/new').name,
require('./common/modules/form/server').name,
require('./common/modules/form/server/edit').name,
require('./common/modules/form/server/new').name,
require('./common/modules/form/status').name,
require('./common/modules/form/status/edit').name,
require('./common/modules/form/status/new').name,
require('./common/modules/form/tenant').name,
require('./common/modules/form/tenant/edit').name,
require('./common/modules/form/tenant/new').name,
require('./common/modules/form/type').name,
require('./common/modules/form/type/edit').name,
require('./common/modules/form/type/new').name,
require('./common/modules/form/user').name,
require('./common/modules/form/user/edit').name,
require('./common/modules/form/user/new').name,
require('./common/modules/form/user/register').name,
// tables
require('./common/modules/table/cacheGroups').name,
require('./common/modules/table/cacheGroupAsns').name,
require('./common/modules/table/cacheGroupParameters').name,
require('./common/modules/table/cacheGroupServers').name,
require('./common/modules/table/cacheGroupStaticDnsEntries').name,
require('./common/modules/table/changeLogs').name,
require('./common/modules/table/asns').name,
require('./common/modules/table/cdns').name,
require('./common/modules/table/cdnDeliveryServices').name,
require('./common/modules/table/cdnFederations').name,
require('./common/modules/table/cdnFederationDeliveryServices').name,
require('./common/modules/table/cdnFederationUsers').name,
require('./common/modules/table/cdnProfiles').name,
require('./common/modules/table/cdnServers').name,
require('./common/modules/table/deliveryServices').name,
require('./common/modules/table/deliveryServiceJobs').name,
require('./common/modules/table/deliveryServiceRegexes').name,
require('./common/modules/table/deliveryServiceServers').name,
require('./common/modules/table/deliveryServiceStaticDnsEntries').name,
require('./common/modules/table/deliveryServiceTargets').name,
require('./common/modules/table/deliveryServiceUsers').name,
require('./common/modules/table/divisions').name,
require('./common/modules/table/divisionRegions').name,
require('./common/modules/table/jobs').name,
require('./common/modules/table/physLocations').name,
require('./common/modules/table/physLocationServers').name,
require('./common/modules/table/parameters').name,
require('./common/modules/table/parameterCacheGroups').name,
require('./common/modules/table/parameterProfiles').name,
require('./common/modules/table/profileDeliveryServices').name,
require('./common/modules/table/profileParameters').name,
require('./common/modules/table/profileServers').name,
require('./common/modules/table/profiles').name,
require('./common/modules/table/regions').name,
require('./common/modules/table/regionPhysLocations').name,
require('./common/modules/table/servers').name,
require('./common/modules/table/serverConfigFiles').name,
require('./common/modules/table/serverDeliveryServices').name,
require('./common/modules/table/statuses').name,
require('./common/modules/table/statusServers').name,
require('./common/modules/table/tenants').name,
require('./common/modules/table/tenantDeliveryServices').name,
require('./common/modules/table/tenantUsers').name,
require('./common/modules/table/types').name,
require('./common/modules/table/typeCacheGroups').name,
require('./common/modules/table/typeDeliveryServices').name,
require('./common/modules/table/typeServers').name,
require('./common/modules/table/typeStaticDnsEntries').name,
require('./common/modules/table/users').name,
require('./common/modules/table/userDeliveryServices').name,
// widgets
require('./common/modules/widget/cacheGroups').name,
require('./common/modules/widget/capacity').name,
require('./common/modules/widget/cdnChart').name,
require('./common/modules/widget/changeLogs').name,
require('./common/modules/widget/routing').name,
// models
require('./common/models').name,
require('./common/api').name,
// directives
require('./common/directives/match').name,
// services
require('./common/service/application').name,
require('./common/service/utils').name,
// filters
require('./common/filters').name
], App)
.config(function($stateProvider, $logProvider, $controllerProvider, RestangularProvider, ENV) {
RestangularProvider.setBaseUrl(ENV.api['root']);
RestangularProvider.setResponseInterceptor(function(data, operation, what) {
if (angular.isDefined(data.response)) { // todo: this should not be needed. need better solution.
if (operation == 'getList') {
return data.response;
}
return data.response[0];
} else {
return data;
}
});
$controllerProvider.allowGlobals();
$logProvider.debugEnabled(true);
$stateProvider
.state('trafficPortal', {
url: '/',
abstract: true,
templateUrl: 'common/templates/master.tpl.html',
resolve: {
properties: function(trafficPortalService, propertiesModel) {
return trafficPortalService.getProperties()
.then(function(result) {
propertiesModel.setProperties(result);
});
}
}
});
})
.run(function($log, applicationService) {
$log.debug("Application run...");
applicationService.startup();
})
;
trafficPortal.factory('authInterceptor', function ($rootScope, $q, $window, $location, $timeout, messageModel, userModel) {
return {
responseError: function (rejection) {
var url = $location.url(),
alerts = [];
try { alerts = rejection.data.alerts; }
catch(e) {}
// 401, 403, 404 and 5xx errors handled globally; all others handled in fault handler
if (rejection.status === 401) {
$rootScope.$broadcast('trafficPortal::exit');
userModel.resetUser();
if (url == '/' || $location.search().redirect) {
messageModel.setMessages(alerts, false);
} else {
$timeout(function () {
messageModel.setMessages(alerts, true);
// forward the to the login page with ?redirect=page/they/were/trying/to/reach
$location.url('/').search({ redirect: encodeURIComponent(url) });
}, 200);
}
} else if (rejection.status === 403 || rejection.status === 404) {
$timeout(function () {
messageModel.setMessages(alerts, false);
}, 200);
} else if (rejection.status.toString().match(/^5\d[01356789]$/)) {
// matches 5xx EXCEPT for 502's and 504's which indicate a timeout and will be handled by each service call accordingly
$timeout(function () {
messageModel.setMessages([ { level: 'error', text: rejection.status.toString() + ': ' + rejection.statusText } ], false);
}, 200);
}
return $q.reject(rejection);
}
};
});
trafficPortal.config(function ($httpProvider) {
$httpProvider.interceptors.push('authInterceptor');
});
| {
"content_hash": "68e58463498a86419676f3558d7d686a",
"timestamp": "",
"source": "github",
"line_count": 401,
"max_line_length": 141,
"avg_line_length": 50.556109725685786,
"alnum_prop": 0.6289153060721157,
"repo_name": "alficles/incubator-trafficcontrol",
"id": "90399bb3335b19fa4fecbe71c27d614d83dd3740",
"size": "21082",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "traffic_portal/app/src/app.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "21929"
},
{
"name": "CSS",
"bytes": "188991"
},
{
"name": "Go",
"bytes": "1451886"
},
{
"name": "HTML",
"bytes": "731049"
},
{
"name": "Java",
"bytes": "1233059"
},
{
"name": "JavaScript",
"bytes": "1612580"
},
{
"name": "Makefile",
"bytes": "1047"
},
{
"name": "PLSQL",
"bytes": "4308"
},
{
"name": "PLpgSQL",
"bytes": "70798"
},
{
"name": "Perl",
"bytes": "3491771"
},
{
"name": "Perl 6",
"bytes": "25530"
},
{
"name": "Python",
"bytes": "93425"
},
{
"name": "Roff",
"bytes": "4011"
},
{
"name": "Ruby",
"bytes": "4090"
},
{
"name": "SQLPL",
"bytes": "66645"
},
{
"name": "Shell",
"bytes": "166287"
}
],
"symlink_target": ""
} |
'use strict';
promise_test(async testCase => {
const file = await storageFoundation.open('test_file');
await file.close();
const fileNamesBeforeRename = await storageFoundation.getAll();
assert_in_array('test_file', fileNamesBeforeRename);
await storageFoundation.rename('test_file', 'renamed_test_file');
testCase.add_cleanup(async () => {
await storageFoundation.delete('test_file');
await storageFoundation.delete('renamed_test_file');
});
const fileNamesAfterRename = await storageFoundation.getAll();
assert_false(fileNamesAfterRename.includes('test_file'));
assert_in_array('renamed_test_file', fileNamesAfterRename);
}, 'storageFoundation.getAll returns a file renamed by' +
' storageFoundation.rename with its new name.');
| {
"content_hash": "d35f0f28ff552e09a15540d535ee5ebc",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 67,
"avg_line_length": 38.4,
"alnum_prop": 0.7395833333333334,
"repo_name": "nwjs/chromium.src",
"id": "47c9ffc6b919417dfbc47499b8029d13788cd8bf",
"size": "867",
"binary": false,
"copies": "20",
"ref": "refs/heads/nw70",
"path": "third_party/blink/web_tests/external/wpt/native-io/rename_async_basic.tentative.https.any.js",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
<?php
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
$page=$_GET["p"];
switch ($page)
{
case ("directions");
$title="Directions";
$h1=$title;
$righttext=
"<p>Please enter your address and click the \"Get Directions\" button.</p>
<form action=\"https://www.mapquest.com/directions/main.adp\" method=\"get\">
<fieldset>
<legend>From:</legend>
<label class=\"addlabel\">Address:</label> <input class=\"textarea\" type=\"text\" name=\"1a\" value=\"\" size=\"20\" maxlength=\"50\">
<br><br>
<label class=\"addlabel\">City:</label> <input class=\"textarea\" type=\"text\" name=\"1c\" size=\"20\" value=\"\" maxlength=\"50\">
<br><br>
<label class=\"addlabel\">State/Province:</label> <input class=\"textarea\" type=\"text\" name=\"1s\" size=\"20\" value=\"\" maxlength=\"50\">
<br><br>
<label class=\"addlabel\">Postal Code:</label> <input class=\"textarea\" type=\"text\" name=\"1z\" size=\"20\" value=\"\" maxlength=\"50\">
<br>
<input type=\"hidden\" name=\"go\" value=\"1\">
<input type=\"hidden\" name=\"2a\" value=\"317 Dolphin Street\">
<input type=\"hidden\" name=\"2c\" value=\"Baltimore\">
<input type=\"hidden\" name=\"2s\" value=\"MD\">
<input type=\"hidden\" name=\"2z\" value=\"21217\">
<input type=\"hidden\" name=\"2y\" value=\"US\">
<input type=\"hidden\" name=\"CID\" value=\"lfddwid\">
<br>
<br>
To:
<p>
City Temple Baltimore (Baptist) Church<br>
317 Dolphin Street<br>
Baltimore, MD 21217</p>
<input class=\"dirbutton\" type=\"submit\" value=\"Get Directions\">
</fieldset>
</form>";
break;
default; // and "beliefs"
$title="Our Beliefs";
$h1=$title;
$righttext="<img style=\"float:right; padding:1em; width:30%;\" src=\"images\beliefs.jpg\"><p>We are a fellowship of the Christian faith and, as such, we acknowledge Christ Jesus to be our Savior, Lord and Head, the Holy Spirit to be our Director and Guide, and the Holy Bible as having set forth the final standards by which we are governed.</p>
<p>The purpose of this church is to witness and participate in the continuing redemptive activity of God through Jesus Christ, in the world. This is done through public worship of God, teaching of the Faith, service to humanity, evangelism, missionary activity, at home and abroad; and by striving to live Christ-like in our daily lives.</p>
<p>We are governed by the Holy Spirit, as the Spirit is vested in this body of believers, who strive to adhere to the Spirit's direction.</p>";
break;
case ("history");
$title="Our History";
$h1=$title;
$righttext=" <div id=\"historytext\">
<h3>Before the Dream</h3>
<p>The City Temple of Baltimore (Baptist) is a historic landmark and should be preserved. The church was built in 1868 - 1871 and is the only structure in Baltimore designed by Thomas U. Walter, architect of the Dome and the House and Senate wings of the United States Capitol, and a founder of the American Institute of Architects.</p>
<p>Declared one of the 13 landmark buildings in Baltimore City, the Temple's majestic Gothic structure and its spire does much to add attractiveness and historic value to the neighborhood. As an integral part of the Baltimore City community, the Temple has provided an array of services through its Inner City Ministry program. The doors of the Temple were opened to the sorrowful; thousands of meals have been served to the hungry, clothing has been given to the needy, the homeless have been assisted in finding shelter, visitations have been made to hospitals and jails.</p>
<h3>The Impossible Dream (1970-1981)</h3>
<div class=\"histpictcapt\">
<img class=\"payneimage\" src=\"images/revpayne1995.jpg\" alt=\"Late Reverend Payne\">
<p>\"Our hearts are aglow with joy, gratitude, humility and expectancy. Like Abraham, we went out, not knowing where we were going. We continue to face the challenges and difficulties of the future with the assurance that God is our help in ages past and our hope for years to come. May God ever use us every one as instruments of His peace.\"</p>
</div>
<p>Reverend William W. Payne, led by the Holy Spirit on June 20, 1970, announced his intent to resign from a congregation of twenty-three years to inaugurate a ministry to show spiritual and social concern for the rejected and neglected of the Inner City. In this \"Impossible Dream\" Pastor Payne envisioned a ministry in which the hungry would be fed, the naked would be clothed, the homeless would be sheltered, and the alcoholics and the drug addicts would be served and loved.</p>
<p>Several members of the former congregation expressed their desire to share this ministry of love and concern, and met with the pastor to pledge their support in the pursuit of this \"Impossible Dream\" in a meeting in the home of Pastor William Payne.</p>
<p>A temporary place of worship was secured by Mrs. Elizabeth Logan, which became known as the Upper Room, at 745 W. Baltimore Street. At a meeting held on September 29, 1970, Pastor Payne suggested, and it was agreed, that the name of the congregation would be The City Temple of Baltimore (Baptist). The congregation suggested that the pastor would be the Reverend William W. Payne. It was also stated at this meeting that strong emphasis would be placed on Worship, Study, Soul Winning, Tithing and Giving Service to Those In Need. All members in this ministry were urged to enroll in Sunday School.</p>
<p>Reverend Payne stated that part of this dream was a settlement house. The settlement house would be called \"A House of Hope\" where all people could come. The House would be a separate entity from the church. Mrs. Zadie Simon proceeded to look for a place to begin the clothing distribution. She was instrumental in securing the vacant Summers Norwood Florist Shop, where Mr. Carl Norwood, a Deacon at Faith Baptist Church, donated the florist shop for the clothing ministry free of charge.</p>
<p>In the meantime worship services were held at the Old University Hall. The first officers were: (Deacons) Mr. William Boyd, Mr. Clifton White, Mr. David Rather, Mr. Royster Gant, Mr. William Taylor, Mr. Reginald Trusty and Mr. William Coleman; (Trustees) Mr. George D. Brown, Mr. Felix Hughey, Mr. Elmore Bowler, Mr. Samuel Washington, Mr. Walter McCants, Mr. Viller Brown, Mr. Herman C. Johnson and Mr. Jim Ivey.</p>
<p>After much time, energy and prayer, the impossible became possible. The Lord touched not only the hearts of this small fellowship, but people from all walks of life who literally poured money into this new venture and within ninety days more than $30,000 was raised.</p>
<p>The pulpit furniture was completely decayed; Mr. William Johnson, assisted by his son, Mr. Herman Johnson, restored and upholstered each chair with hobnails and trimmings. Mrs. Marjorie Roberson made all of the cushions for the pews. Shortly thereafter, \"The City Temple of Baltimore (Baptist) was incorporated. The corporation included: Rev. William W. Payne, President; William H. Boyd, Secretary; Walter B. McCants, Treasurer; David Rather, Director; Royster Gant, Director. The newly formed congregation was duly chartered and incorporated as a body corporate under the laws of the State of Maryland.</p>
<p>On Thanksgiving Day, November 26, 1970, the congregation of The City Temple of Baltimore (Baptist) made its triumphant entry into the current house of worship at Eutaw Place and Dolphin Street. Upon the invitation to Christian discipleship, more than 50 persons came forth. Within a few months, the Sunday School had an enrollment of 350 and the Sunday worship service averaged 700. The House of Hope at 1900 Eutaw Place was purchased from the Mitchell Funeral Home. The House of Hope relocated at 20th and Wolfe Streets on July 11, 1983.</p>
<p>By 1981, 1,638+ souls had been added to our numbers and 750 candidates had been baptized. The doors of the Temple had been opened to the sorrowful to be given the comfort of the gospel without regard to race or creed. Thousands of meals had been given to the hungry by Mrs. Phyllis Womack, Mrs. Florine Trusty, Mr. John Segal, Mrs. Shirley Rice and Mr. William Boyd. Clothing had been given to the needy, initiated by Mrs. Zadie Simon and continued by Mrs. Mary Rich. The homeless were assisted in finding shelter; visitations were made to hospitals and jails; the addicts, the alcoholics and the emotionally disturbed were embraced in our Christian fellowship. The Eutaw Place Day Nursery was set up by Mrs. Elizabeth D. Logan and large numbers of children were enrolled as a courtesy to working mothers employed by the State and other agencies. Mrs. Logan also used her expertise in getting much of the legal litigation of the corporation done free of charge.</p>
<p>Mid-week, mid-city, mid-day worship services were held at the City Temple of Baltimore (Baptist) each Wednesday at 12:05 PM for all people who desired to unite with God and enjoy the fellowship of others who found these services uplifting, both spiritually and emotionally. The Lord blessed the Temple materially, also. The lot next door to the building was purchased from the City at a cost of $2,100. Necessary repairs were made to the roof and the ladies restroom was renovated. The funds were raised by Just We Few, with Mrs. Dora Hardee as Group Leader. Our mortgage was completely liquidated on December 14, 1981.</p>
<h3>The Dream Continues (1982-1984)</h3>
<p>A Restoration and Planning Corporation was formed in 1983 to meet the requirements of the State. The City Temple of Baltimore (Baptist) is a historical landmark and the church was blessed materially with a matching fund grant from the State of Maryland of $100,000 for the restoration of the exterior of the building. Because the Constitution states that churches cannot use State money for religious purposes, Pastor Payne appointed the following persons to work with the Corporation: Mr. William Harrington, Mrs. Lorena Branch, Mrs. Christine Moore, Mr. Viller Brown, Mr. Edward Holden, Mr. Charles Davenport, Mr. Herman C. Johnson and Mr. Francis White (President).</p>
<p>On March 15, 1983, due to failing health, our Pastor and Founder of the \"Impossible Dream\" rendered his resignation as Pastor of the City Temple of Baltimore (Baptist). In this meeting, requested by Reverend William W. Payne, he became Pastor Emeritus; and, on June 26, 1983, a tribute was given in his honor.</p>
<p>Following the retirement of Pastor William W. Payne, the \"Impossible Dream\" seemed a bit shattered due to decline in membership, spiritual nourishment and financial contributions. But, \"God was not through with the Temple yet.\" Reverend Cecil McClary accepted the challenge and was chosen Pastor of City Temple. He resigned after serving one year.</p>
<p>On November 24, 1984 a Pulpit Committee was selected to seek out a suitable pastor to be presented to the City Temple congregation. Because of Deacon William Boyd's experience, as chairman of the Official Board (although he had retired as Board Chairman), he was asked to serve as interim Chairman of the Board, and Reverend William W. Payne was asked to serve as interim Pastor during the period of the pulpit vacancy. Deacon Boyd and Reverend Payne accepted the appointments as Interim Chairman of the Board and Interim Pastor, respectively. But, due to the illness of Reverend W. W. Payne, Reverend Randolph Taylor, an associate minister of City Temple, actually served during the vacancy of the pulpit, with assistance from the Evangelists of City Temple and visiting ministers. On July 9, 1985, in a duly called Church wide Meeting of the congregation, Mr. Lewis Carr was elected Chairman of the Official Board and Mr. Charles Davenport was elected as the Vice Chairman.</p>
<h3>Thy Will be Done (1985-1990)</h3>
<img class=\"yearginpreach\" src=\"images/yearginpreach.jpg\" alt=\"Reverend Yeargin Preaching\">
<p>In a duly called Church wide Meeting, September 10, 1985, Reverend Grady A. Yeargin, Jr. was unanimously elected as Pastor of The City Temple of Baltimore (Baptist). He was officially installed on January 20, 1986 at 5:00 PM. Reverend Grady A. Yeargin, Jr. came to City Temple with the anointing of the Holy Spirit and experience of nine years in the Ministry. His sensitive spirit and servant heart has brought us a new dimension of spiritual nourishment and growth through worship, study and action.</p>
<p>The state of the economy imposed greater demands on the Outreach Ministry sponsored by City Temple for assistance to the needy under the direction of Deacon Lewis Carr. By the grace of God and with the volunteers of Mrs. Pearl Giles and Mr. James McCoy in the Temple Soup Kitchen at 317 Dolphin Street, and Mrs. Shirley Rice, in the House of Hope Soup Kitchen at 906 Wolfe Street, 200 persons or more were fed daily. Mrs. Pearl Cartwright, a volunteer in the clothing program, distributed 100 articles of clothing weekly free of charge. Mrs. Zadie Simon and Mrs. Betty Johnson volunteered in the social service area of the ministry. Many other parishioners and friends volunteered with the Outreach Program which, since the sale of the House of Hope, has moved in its entirety to City Temple.</p>
<p>The Restoration and Planning Committee completed the restoration of the exterior of City Temple in November, 1987 under the leadership of Pastor Grady A. Yeargin. Mrs. Lorena Branch and Mr. Edward B. Holden chaired the committee. The completion and restoration project of the Temple Organ was celebrated November 15, 1987 with a Dedicatorial Recital presented by Kenneth M. Dean, Jr., Minister of Music at that time.</p>
<p>The Building Committee, the B.U.I.L.D. Action Team and the Cultural and Fine Arts Committee are part of the continuing dream. In addition, the Board of Christian Education and Scholarship Committees were developed by Pastor Grady A. Yeargin, Jr., in January 1988.</p>
<p>Realizing that there is a need to meet the increasing needs of our church and the greater Baltimore community, we felt that there was a new and greater challenge before us. It was with this need in mind that the church voted to become involved in a Capital Stewardship Improvement Program for a three year commitment by members of the congregation.</p>
<p>We move on in Faith as We Continue to do His Will!</p>
<h3>We Continue (1991-1995)</h3>
<p>On May 21, 1995 a street sign honoring Rev. William W. Payne was unveiled at the corner of Dolphin and Eutaw following a brief ceremony in the church sanctuary. The sign reads \"Rev. William W. Payne Way\" and was unveiled at 10:51 AM by Bro. Herman Johnson</p>
<p>This project was sponsored by the Young At Heart Seniors Ministry. Representatives from the Mayor's Office, City Council and State Government were in attendance (Mary Pat Clarke, Julian Lapides, Carl Stokes, etc.) A resolution from the City Council was read by Mary Pat Clarke.</p>
<p>During the same event, Sis. Delores Royster made a presentation to Dea. Mattie Gladney and Bro. Herman Johnson for dedicated service.</p>
<p>A special committee of church members was formed to raise money for the restoration of the church's pipe organ. This committee sold fish and chicken dinners for several weeks during the months of January through May, 1995 and on May 21, 1995 a financial report was presented to the congregation by Gladys Smith: $8,107.93 was collected ($ 1916.95 was used to install a new fryer; $618.00 was donated to the Concert Choir and $5573.48 was used for the organ).</p>
<p>On June 11, 1995 the church celebrated Pastor's Appreciation Day and Rev. Grady A. Yeargin, Jr. was honored for 25 years in the ministry. One worship service was held at 10:00AM and was sponsored by The Pastor's Aid. The guest speaker was Rev. Dr. Fred L. Steen of Oberlin, Ohio (City Temple took 5 busloads to visit Rev. Steen's congregation in 1992). Rev. W.W. Payne was in attendance. \"A 25-Year Journey\" of Rev. Yeargin was presented by Mrs. Betty Johnson. Two presentations were made: Dea. Mattie Gladney made a presentation to the elevator and Rev. Yeargin and Gladys Smith (Trustees) presented $500 to the Organ Fund.</p>
<p>On November 5, 1995, being led by the Holy Spirit, Rev. Grady A. Yeargin, Jr., Pastor, Rev. W. W. Payne, Pastor Emeritus, founders, sons/daughters, officers and members (100+) met on the Governor's Club parking lot to re-enact the march into City Temple as it took place 25 years ago.</p>
<p>Leading us in song of praises were Rev. Yeargin and Bro. Frank White; then the march began up Eutaw Place with Rev. Yeargin, Rev. W.W. Payne, sons/daughters of founders who have passed on, officers. Following from that point came the members of the congregation singing \"Marching to Zion\" on this glorious crisp, sun shining fall morning. The history was given by Norman Johnson and Barreda Howell paid tribute and recognized the founders of City Temple. The congregation was then introduced to the 25th Anniversary Committee.</p>
<h3>A Community of Spiritual Maturity (1996 - 2000)</h3>
<img class=\"choirimage\" src=\"images/concert-choir-1998.jpg\" alt=\"Concert Choir Picture\">
<p>Due to the efforts of The Perpetual Organ Fund of The City Temple of Baltimore (Baptist) the restoration and upgrade of the church's pipe organ was completed. At the culmination of the organ upgrade, a Recital, featuring Ms. Diane Bish, was coordinated by Lois E. Smith, Minister of Music. This great instrument, with many voices and many builders across many years, has joined our hearts, hands and voices to also include a strong and comprehensive music ministry. We resoundingly accepted a new mission at the Temple - We will become a spiritually mature Christian fellowship, in order to provide an effective witness for Christ in this world.
Glorious Everlasting (2006 - Present)</p>
<p>The City Temple Development Corporation (CTDC) was formed to develop and implement educational, community programs, services and economic development projects for persons who require such support and services; encouraging independent living and improving quality of life to the extent of each person's capability. The first task of the Corporation was to construct the W. W. Payne Educational and Community Center. A multi-purpose building located on the parking lot adjacent to The Temple, the space is to be used to continue and expand existing services and develop new programs and services for the community.</p>
<p>As we move ever-forward in our quest to fulfill the Vision, we continue our Inner City Ministry program (feed the hungry, clothe the naked). We have expanded this outreach to teach the unlearned. Preaching, music, bible study, Sunday school, Christian education, visitations and making a joyful noise unto the Lord brings us ever closer to becoming spiritually mature Christians and effective witnesses for Christ in this world.</p>
<img class=\"congregation\" src=\"images/congregation.jpg\" alt=\"Congregation Picture\">
</div>
<div id=\"original\">
<h3>The Original 27</h3>
<p>Rev. William Washington Payne, Jr.</p>
<p>Walter Allen</p>
<p>Marjorie P. Austin</p>
<p>William Boyd</p>
<p>Royster Gant</p>
<p>Gladys Higginbotham</p>
<p>Glover Holman</p>
<p>Lillian Hughey</p>
<p>Felix Hughey</p>
<p>Leon Jackson</p>
<p>William Laney</p>
<p>Colleaner Lyons</p>
<p>Harold Mattison</p>
<p>Susie Mattison</p>
<p>Pearl McCants</p>
<p>Walter McCants</p>
<p>Clyde Milner</p>
<p>Josephine Morton</p>
<p>Ozea Morton</p>
<p>Gladys Palmer</p>
<p>Bettye L. Preston</p>
<p>David Rather</p>
<p>Ollie Rather</p>
<p>Pearl Watts</p>
<p>Clifton White</p>
<p>Louise White</p>
<p>Gertrude Withers</p>
</div> ";
break;
case ("membership");
$title="Membership";
$h1=$title;
$righttext="<img style=\"float:right; padding:1em; width:30%;\" src=\"images\membershipsubsub.jpg\"><p>City Temple membership consists of baptized believers who have professed faith in Christ and a willingness to be directed by the Holy Spirit. Any person who wishes, regardless of his race, gender, sexual preference, or religion, will be welcomed into church membership upon profession of faith in Christ.</p>
<p>To make the transition to joining our church fluid and comfortable, we offer a New Membership Training Class. The training includes assigning a prayer partner to each new member, receiving detailed information regarding the many ministries, fellowship groups, and partnerships at the church, and accepting the Right Hand of Fellowship during the worship service. </p>
<p>To receive more information, please contact the Rev. Dr. Grady A. Yeargin, Jr., Pastor. Thank you for your interest in becoming a member of this body of Christ and we hope to see you during service!</p>
<h3 class=\"topsectitle\">New Members' Training</h3>
<p>One of the entities of The Christian Education Ministry is the New Members' class. All persons
joining City Temple of Baltimore Baptist Church are invited to participate in this program. This
six-week course, which meets each Sunday following worship service, is designed to provide an
orientation for all who are new to the Baptist faith, in addition to being new to City Temple.</p>
This spiritually based course will cover subjects including:
<ol>
<li>The Meaning of Church Membership</li>
<li>The Nature and Mission of the Church</li>
<li>Baptist Beliefs and Practices</li>
<li>The Organization of The Baptist Church</li>
<li>The Life of City Temple.</li>
<li>Spiritual Gifts and Talents</li>
</ol>
The following City Temple parishioners serve as instructors for this program:
<ol>
<li>Sis. Deborah Bates</li>
<li>Dea. Doris Hunter</li>
<li>Min. Marshell Jenkins</li>
<li>Dea. Vonda Reed</li>
<li>Dea. Patricia Ward</li>
<li>Min. Michelle Hamiel</li>
</ol>
Please direct all questions, comments and/or suggestions to <a href=\"mailto:[email protected]?Subject=New Nember Training\">Min. Patricia A. Yeargin></a></p>";
break;
case ("organ");
$title="History of Our Organ";
$h1=$title;
$righttext="<div id=\"historytext\">
<p class=\"scripture\">\"Praise Him with stringed instruments and organs.\" Psalms 150:4</p>
<p>The City Temple of Baltimore (Baptist) was built in 1870 as The Eutaw Place Baptist Church. It was designed by world famous architect Samuel U. Walter.</p>
<p>The first organ in the church was installed in the rear balcony. Parts of the mechanism of the old water motor are still attached to the wall.</p>
<!--need last picture<img class=\"organpic\" src=\"images/couple.jpg\" alt=\"\">-->
<p>The casework and much of the pipe work was installed in the early 1890s and remain today in its original position. This is the work of Adam Stein of Baltimore, who was employed in the Baltimore branch of the Roosevelt Organ Co. Upon the death of Mr. Roosevelt and the closing of the factor, Mr. Stein continued to build in the Roosevelt tradition. This is the secret of the tonal breadth and dignity of our \"Miracle Organ.\"</p>
<p>In 1947, the Wicks Organ Co. of Highland, Illinois rebuilt the organ, electrified the chest with direct electric action, installed a new three manual console, unified the dulciana on the choir, added a concert flute, clarinet and extended the great gemshorn.</p>
<img class=\"organpic\" src=\"images/closeorgan.jpg\" alt=\"Closeup picture of Organ\">
<p>When City Temple purchased the building in 1970, the organ was almost unusable. We were fortunate in securing the services of the late Mr. Ernest Hornig and Mr. Ronald Unger of the Shantz Organ Co. to restore and maintain the instrument.</p>
<p>The late Rev. William W. Payne (organizer of City Temple) and organist Kenneth M. Dean indulged in bold dreams and grand illusions about the organ. The Pastor learned that the organ of James Chapel of Union Theological Seminary in New York City was being replaced. Generous members of the congregation donated ranks of pipes of the New York organ as memorials to their departed loved ones. Their names are inscribed on a plaque in the foyer of the church. For their vision and devotion, we are eternally grateful.</p>
<p>The old Seminary organ contained much beautiful (almost priceless) pipe work—having been built by the Austin Organ Co. in 1912 and later enlarged by M.P. Moller in 1940, and again in 1960. We called it the \"Miracle Organ\" and some even called it \"Payne's Folly\"; but, the \"Dream Organ\" became a glorious reality.</p>
<p>Upon learning of the closing of Old St. Gregory's Catholic Church, we opted for and secured the \"Double Moller Artist.\" For the additional stops, a larger console was essential. After being told by the M.P. Moller Co. that a suitable console would cost more than $15,000.00 and that it would require more than a year to build, God provided another \"miracle.\" The Old St. Paul Church had recently bought a new console. We secured their old E.M. Skinner four manual console for $200.00. Truly this was still another \"miracle.\"</p>
<p>The organ has been enlarged by the following additional pipe work; a four rank mixture, which is exposed on the outside of the case, was added to the great. It adds a bright tap to the entire organ. Twelve new trumpet pipes were installed to provide a double reed to the pedal.</p>
<img class=\"organpic\" src=\"images/wallpipe.jpg\" alt=\"Organ Pipes on Wall\">
<p>The Moller Artiste from St. Gregory's has a pair of strings and French trompette in one chamber and a baroque flute, a Nazard and principal in the other. This creates an excellent antiphonal section and is also playable from its own two manual console in the gallery.</p>
<p>The excellent strings from the old 1912 Austin are big, warm and rich. The sixteen foot Violene speaks from the gallery placed around the rose window. It is a soft but \"telling-voice\" in the pedal. The Gamba Celeste four foot flute, Moller Octave, and three-rank Plein-Jeu (which adds fire and brilliance) are in the swell.</p>
<p>From the old organ in the Faith Baptist Church we retrieved the soft, lovely Vox Humana, which imitates the human voice, along with the xylophone. Through the efforts of Lois E. Smith, organist, these were obtained in 1982, through the benevolence of the Elizabeth L. Phillips Funeral Home, P.A.</p>
<p>The pipe work of the Positiv division which is enclosed over the baptistery was given by Pastor Payne in memory of his parents. It is by Moller and comprised of the following voices: Gedeckt-8', Nachthorn 4', Principal 2', Quint 1 1/3', Sifflote-1' and a small 4' baroque reed. Much of the pipe work is written in the German and French language, indicating their origins.</p>
<p>We are indebted to the late William Coleman and other volunteers, including Kenneth Dean, Minister of Music, who made the trips to New York to deliver our precious cargo from New York to Baltimore. Orchids to Mr. Ronald Unger who installed the additional pipe work and who has maintained the organ through the years.</p>
<p>The lovely music of our \"Miracle Organ\" sings and soars from every corner of the church—leading us in praising our God from whom all blessings flow.</p>
<p>The Rogers Organ Company of Portland Oregon was contracted to build a new four manual, state-of-the-art console, and with Midi capability, eliminate all unification and add additional voices, bringing the size of the organ to 244 ranks. In 1995, Ms. Diane Bish was recitalist for the rededication of the Temple Organ.</p>
<p>As the organ has evolved as a great instrumentalist with many voices, built by many builders, across many years, may its music challenge us to join our hearts, hands, and voices to make glorious and harmonious under the master-touch of Jesus Christ our Lord.</p>
<p class=\"scripture\">\"Let everything that hath breath, praise the Lord.\"</p>
<img class=\"organpic\" src=\"images/organ.jpg\" alt=\"Organ Picture\">
</div>";
break;
case ("ged");
$title="GED Program";
$h1=$title;
$righttext="
<p>The W.W. Payne Education and Community Center was built to support Rev. Dr. Grady
A. Yeargin, Jr.’s vision to provide outreach services to the community. In July 2005,
in a meeting with Rev. Dr. Yeargin, Gary Hamiel, Marlene Jones and Patricia Payne,
staff from the Baltimore City Community College presented a proposal to initiate a free,
daytime GED class for members and community of the City Temple of Baltimore Baptist
Church.</p>
<p>The first pre-GED class was introduced in January 2006.</p>
<p>The class was held in the Payne Center on Mondays and Wednesdays from 9:00 a.m.
to 12:00 noon. BCCC provided the teacher and all instructional materials and supplies,
while City Temple agreed to provide a classroom with a blackboard. In addition, City
Temple also agreed to:</p>
<ul>
<li>Offer lunch to the students enrolled in the program.</li>
<li>Provide duplicating privileges for the instructor’s use.</li>
<li>Purchase a file cabinet for the instructor’s use.</li>
</ul>
<p>The largest commitment made by City Temple was the responsibility to recruit and retain
15-20 students for the class. Patricia A. Payne was asked to lead this charge.</p>
<p>The City Temple family has willingly and lovingly adopted this project. They actively
participate in the recruitment process. They provide duplicating paper/services, markers,
erasers, money, and instructional materials for the program. Members have offered job
opportunities, and pertinent information about preparing for the GED examination. When
students are ready to take the actual GED examination, the Outreach Ministry has offered
to defray the cost for those unable to afford it.</p>
<p>With the support of the City Temple family and other external resources, included but not
limited to the Department of Social Services, Social Security, Union Baptist Head Start,
Dru-Mondawmin, and the University of Maryland, each semester we have had student
participation ranging from 15 to 50 students. There have been several teachers assigned
to the program; however, beginning in 2009 when the same instructor was permanently
assigned, student retention stabilized significantly. In addition, an average of 20% of the
students is promoted to the advanced GED classes, and 100% of those students go on to
receive their GED certification.</p>
<p>The success of the day program motivated the administrators at BCCC to invite City
Temple to initiate an evening program. Beginning in the fall 2010, City Temple
introduced an evening class held on Mondays and Wednesdays from 5:30 – 8:30 p.m.
The population for this class satisfied the need to serve those who work during the
daytime hours.</p>
<p>Both classes maintain an average attendance rate of 20-30 students per class, with an
increase of 10-15% of its students promoting to advanced GED classes each semester.
This program has attracted students from Baltimore City, Baltimore County, Harford
County and Anne Arundel County.</p>
<p>Recognizing the success of this program, in 2011, BCCC expanded the pre-GED classes
to three days a week, and introduced a year-round program so that classes would continue
during the summer.</p>
Pre- and post-testing revealed the need for literacy classes. Many of those interested in
obtaining their GED technically did not qualify for the pre-GED class. Therefore, in
January 2012, BCCC introduced two BRIDGE classes: one for the morning session and
the other for the evening. The BRIDGE classes are currently two days a week. The class
size for the BRIDGE class is generally 10-15 students.</p>
<p>With this expansion, coupled with the love and support provided by the City Temple
family, the program has the potential to reach even greater heights.</p>
<p>For more information, please contact <a href=\"mailto:[email protected]?Subject=GED Program\">Pat Payne</a>.</p>";
break;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"https://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="default.css">
<meta name="keywords" content="baltimore, baptist, city, temple, christian, church, grady, yeargin" >
<meta name="description" content="City Temple Baptist Church Webpage" >
<meta name="revised" content="Earl Jones, <?php echo date ("F d Y H:i:s.", filemtime(__FILE__))?>" >
<meta http-equiv="content-type" content="text/html; charset=UTF-8" >
<meta name="generator" content="Notepad++" >
<title>City Temple of Baltimore - <? echo $title ?></title>
</head>
<body>
<?php include "bannerandmenu.php"?>
<div id="container">
<div class="bothsides">
<div class="leftside">
<?
if ($page != "ged")
{
include "servicetimesleft.php";
}
else
{
include "gedlinksleft.php";
}
?>
</div>
<div class="rightside">
<div class="navchain"><a class="titlelink" href="index.php">Home</a> >> <a class="titlelink" href="submenu.php?p=about">About Us</a> >> <?php echo $h1 ?></div>
<h1><?php echo $h1 ?></h1>
<hr>
<?php echo $righttext ?>
</div>
</div>
</div>
<?php include "footer.php"?>
</body>
</html>
| {
"content_hash": "6002be558071ac5be3f4b00bed534afd",
"timestamp": "",
"source": "github",
"line_count": 336,
"max_line_length": 987,
"avg_line_length": 98.66964285714286,
"alnum_prop": 0.7602630229541821,
"repo_name": "EJLearner/church-site",
"id": "5078c34e667f3efe570445d26bbe97063812ded9",
"size": "33166",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "public_html/aboutpage.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "48149"
},
{
"name": "HTML",
"bytes": "519"
},
{
"name": "Hack",
"bytes": "12841"
},
{
"name": "JavaScript",
"bytes": "162165"
},
{
"name": "Less",
"bytes": "8837"
},
{
"name": "PHP",
"bytes": "286321"
},
{
"name": "SCSS",
"bytes": "8055"
}
],
"symlink_target": ""
} |
namespace url {
const char kAboutBlankURL[] = "about:blank";
const char kAboutBlankPath[] = "blank";
const char kAboutBlankWithHashPath[] = "blank/";
const char kAboutScheme[] = "about";
const char kBlobScheme[] = "blob";
const char kContentScheme[] = "content";
const char kContentIDScheme[] = "cid";
const char kDataScheme[] = "data";
const char kFileScheme[] = "file";
const char kFileSystemScheme[] = "filesystem";
const char kFtpScheme[] = "ftp";
const char kGopherScheme[] = "gopher";
const char kHttpScheme[] = "http";
const char kHttpsScheme[] = "https";
const char kJavaScriptScheme[] = "javascript";
const char kMailToScheme[] = "mailto";
const char kWsScheme[] = "ws";
const char kWssScheme[] = "wss";
const char kStandardSchemeSeparator[] = "://";
const size_t kMaxURLChars = 2 * 1024 * 1024;
} // namespace url
| {
"content_hash": "7609959978093b7bb0b896eed0307cc0",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 48,
"avg_line_length": 29.678571428571427,
"alnum_prop": 0.703971119133574,
"repo_name": "youtube/cobalt",
"id": "110c6a7b22d0e244b4cfd77bdb8d537ee7d21c9b",
"size": "1029",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "url/url_constants.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
<html>
<h1>Title: Rock-Paper-Scissors Arcade</h1>
<h2>Author: Jae-Hwan (Jeff) Jung</h2>
<p>University of British Columbia<br>
Computer Engineering - Software Option, 4th Year</h3>
<h2>Description</h2>
<p>A simple rock paper scissors game for <b>Android</b>. Rock, paper, scissors will keep falling down from the top of the screen. When they reach the collision bar at the bottom of the screen, the user has to hit the correct counter hand at the right timing.</p>
<p>The difficulty of the game increases as time elapses.</p>
<p>Created for fun to play with various tools so that I can properly build my first game that I intend to spend some time on.</p>
<h2>Q & A</h2>
<p>Q: How long did it take?<br>
A: During the week of my spring break. So less than a week for a few hours a day.</p>
<p>Q: Why is there no logging?<br>
A: This was just for fun and was simple enough that logging was simply unnecessary. Also, I am not planning to do any additional work on this game in future.</p>
<p>Q: Why is there no testing?<br>
A: Same reason as above.</p>
<h2>Warning</h2>
<ul>
<li>Only tested on Android emulators. Not tested on real device because I don't have one.</li>
<li>I haven't refactored any of the code properly because this game was developed as a practice.</li>
<li>I will probably never improve this code/game.</li>
<li>I am aware of the quality of my code ... No proper architecture, not enough abstraction, not enough loose coupling, not enough high cohesion, you name it...this code is messy<br>
It was my intention to spend the reasonable small amount of time on this project.</li>
<li>Feel free to use my code but I assume no responsibility for errors, omissions, damages, etc.</li>
</ul>
<h2>Tools</h2>
The tools I played with while developing this game are:
<ul>
<li>C#</li>
<li>Xamarin Android
<ul>
<li>Cross-Platform Mobile Dev Tool</li>
<li>$99/year Subscription for Students</li>
<li>Subscription covered by school thanks to a school project</li>
</ul>
</li>
<li>MonoGame
<ul>
<li>Cross-Platform Game Dev Framework</li>
<li>Open Source Implementation of Microsoft XNA</li>
<li>Free</li>
</ul>
</li>
<li>Windows Azure
<ul>
<li>Microsoft Cloud Platform</li>
<li>Free Trial</li>
</ul>
</li>
<li>AdMob
<ul>
<li>Mobile Monetization Network</li>
</ul>
</li>
<li>GIMP
<ul>
<li>Image Manipulation Program</li>
</ul>
</li>
<li>GenyMotion
<ul>
<li>3rd Party Android Emulator</li>
<li>Super Fast. 100% Recommended.</li>
</ul>
</li>
</ul>
<h2>Resources</h2>
<p>All drawings are manually done by me.</p>
<p>All sound FX files are freeware, taken from <a href="http://www.flashkit.com/">FlashKit</a></p>
<p>All background music files are under Creative Commons License, taken from <a href="http://incompetech.com/music/royalty-free/index.html?genre=Electronica&page=1">Incompetech</a></p>
<p>"Aurea Carmina" Kevin MacLeod (incompetech.com)<br>
Licensed under Creative Commons: By Attribution 3.0<br>
http://creativecommons.org/licenses/by/3.0/</p>
<p>"Electrodoodle" Kevin MacLeod (incompetech.com)<br>
Licensed under Creative Commons: By Attribution 3.0<br>
http://creativecommons.org/licenses/by/3.0/</p>
<p>"Killing Time" Kevin MacLeod (incompetech.com) <br>
Licensed under Creative Commons: By Attribution 3.0<br>
http://creativecommons.org/licenses/by/3.0/</p>
<p>"MTA" Kevin MacLeod (incompetech.com)<br>
Licensed under Creative Commons: By Attribution 3.0<br>
http://creativecommons.org/licenses/by/3.0/</p>
<p>Marimba Ringtone Remix<br>
Free, taken from <a href="http://www.zedge.net/dmca/">Zedge</a></p>
</html> | {
"content_hash": "2aaf48975e831ef2469797ae2066d4fd",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 262,
"avg_line_length": 42.305882352941175,
"alnum_prop": 0.7174638487208009,
"repo_name": "jaehwan-jung/RPS-Arcade",
"id": "0df0663f716d41833badd2b3bd23f3258295dd3c",
"size": "3596",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "153788"
}
],
"symlink_target": ""
} |
// Accord Statistics Library
// The Accord.NET Framework
// http://accord-framework.net
//
// Copyright © César Souza, 2009-2014
// cesarsouza at gmail.com
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
namespace Accord.Statistics.Distributions.Univariate
{
using System;
using Accord.Math;
using Accord.Statistics.Distributions.Fitting;
using AForge;
/// <summary>
/// Estimators for Hazard distribution functions.
/// </summary>
///
public enum HazardEstimator
{
/// <summary>
/// Breslow-Nelson-Aalen estimator.
/// </summary>
///
BreslowNelsonAalen,
/// <summary>
/// Kalbfleisch & Prentice estimator.
/// </summary>
///
KalbfleischPrentice
}
/// <summary>
/// Empirical Hazard Distribution.
/// </summary>
///
/// <remarks>
/// <para>
/// The Empirical Hazard (or Survival) Distribution can be used as an
/// estimative of the true Survival function for a dataset which does
/// not relies on distribution or model assumptions about the data.</para>
/// <para>
/// This class can be instantiated using either hazards values through
/// its <see cref="EmpiricalHazardDistribution">constructor</see> and
/// <see cref="FromHazardValues"/>; or using survival values using
/// <see cref="FromSurvivalValues"/>.</para>
///
/// <para>
/// The most direct use for this class is in Survival Analysis, such as when
/// using or creating <see cref=" Accord.Statistics.Models.Regression.ProportionalHazards">
/// Cox's Proportional Hazards models</see>.</para>
/// </remarks>
///
/// <example>
/// <para>
/// The following example shows how to construct an empirical hazards
/// function from a set of hazard values at the given time instants.</para>
/// <code>
///
/// // Consider the following observations, occurring at the given time steps
/// double[] times = { 11, 10, 9, 8, 6, 5, 4, 2 };
/// double[] values = { 0.22, 0.67, 1.00, 0.18, 1.00, 1.00, 1.00, 0.55 };
///
/// // Create a new empirical distribution function given the observations and event times
/// EmpiricalHazardDistribution distribution = new EmpiricalHazardDistribution(times, values);
///
/// // Common measures
/// double mean = distribution.Mean; // 0.93696461879063664
/// double median = distribution.Median; // 3.9999999151458066
/// double var = distribution.Variance; // 2.0441627748096289
///
/// // Cumulative distribution functions
/// double cdf = distribution.DistributionFunction(x: 4.2); // 0.7877520261732569
/// double ccdf = distribution.ComplementaryDistributionFunction(x: 4.2); // 0.21224797382674304
/// double icdf = distribution.InverseDistributionFunction(p: cdf); // 4.3304819115496436
///
/// // Probability density functions
/// double pdf = distribution.ProbabilityDensityFunction(x: 4.2); // 0.046694554241883471
/// double lpdf = distribution.LogProbabilityDensityFunction(x: 4.2); // -3.0641277326297756
///
/// // Hazard (failure rate) functions
/// double hf = distribution.HazardFunction(x: 4.2); // 0.22
/// double chf = distribution.CumulativeHazardFunction(x: 4.2); // 1.55
///
/// // String representation
/// string str = distribution.ToString(); // H(x; v, t)
/// </code>
/// </example>
///
/// <seealso cref="Accord.Statistics.Models.Regression.ProportionalHazards"/>
///
[Serializable]
public class EmpiricalHazardDistribution : UnivariateContinuousDistribution,
IFittableDistribution<double, EmpiricalHazardOptions>
{
private double? mean;
private double? variance;
private double? maxTimes;
/// <summary>
/// Gets the time steps of the hazard density values.
/// </summary>
///
public double[] Times { get; private set; }
/// <summary>
/// Gets the hazard values at each time step.
/// </summary>
///
public double[] Hazards { get; private set; }
/// <summary>
/// Initializes a new instance of the <see cref="EmpiricalHazardDistribution"/> class.
/// </summary>
///
public EmpiricalHazardDistribution()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="EmpiricalHazardDistribution"/> class.
/// </summary>
///
/// <param name="time">The time steps.</param>
/// <param name="values">The hazard values at the time steps.</param>
///
public EmpiricalHazardDistribution(double[] time, double[] values)
{
this.Times = time;
this.Hazards = values;
}
/// <summary>
/// Gets the mean for this distribution.
/// </summary>
///
/// <value>
/// The distribution's mean value.
/// </value>
///
public override double Mean
{
get
{
if (!mean.HasValue)
{
// http://www.stat.nuk.edu.tw/wongkf_html/survival02.pdf
double m = 0;
for (int i = 0; i < Times.Length; i++)
m += ComplementaryDistributionFunction(Times[i]);
mean = m;
}
return mean.Value;
}
}
/// <summary>
/// Gets the variance for this distribution.
/// </summary>
///
/// <value>
/// The distribution's variance.
/// </value>
///
public override double Variance
{
get
{
if (!variance.HasValue)
{
// http://www.stat.nuk.edu.tw/wongkf_html/survival02.pdf
double v = 0;
double m = Mean;
for (int i = 0; i < Times.Length; i++)
v += Times[i] * ComplementaryDistributionFunction(Times[i]);
this.variance = v - m * m;
}
return variance.Value;
}
}
/// <summary>
/// Gets the entropy for this distribution.
/// </summary>
///
/// <value>
/// The distribution's entropy.
/// </value>
///
public override double Entropy
{
get { throw new NotSupportedException(); }
}
/// <summary>
/// Gets the support interval for this distribution.
/// </summary>
///
/// <value>
/// A <see cref="AForge.DoubleRange" /> containing
/// the support interval for this distribution.
/// </value>
///
public override DoubleRange Support
{
get
{
if (!maxTimes.HasValue)
maxTimes = Matrix.Max(Times);
return new DoubleRange(0, maxTimes.Value);
}
}
/// <summary>
/// Gets the cumulative hazard function for this
/// distribution evaluated at point <c>x</c>.
/// </summary>
///
/// <param name="x">A single point in the distribution range.</param>
///
/// <returns>
/// The cumulative hazard function <c>H(x)</c>
/// evaluated at <c>x</c> in the current distribution.
/// </returns>
///
public override double CumulativeHazardFunction(double x)
{
double sum = 0;
for (int i = 0; i < Times.Length; i++)
{
if (Times[i] <= x)
sum += Hazards[i];
}
return sum;
}
/// <summary>
/// Gets the cumulative distribution function (cdf) for
/// this distribution evaluated at point <c>x</c>.
/// </summary>
///
/// <param name="x">A single point in the distribution range.</param>
///
/// <remarks>
/// The Cumulative Distribution Function (CDF) describes the cumulative
/// probability that a given value or any value smaller than it will occur.
/// </remarks>
///
public override double DistributionFunction(double x)
{
if (!maxTimes.HasValue)
maxTimes = Matrix.Max(Times);
if (x > maxTimes)
return 1.0;
// H(x) = -ln(1-F(x))
// F(x) = 1 - exp(-H(x))
double chf = CumulativeHazardFunction(x);
double exp = Math.Exp(-chf);
return 1.0 - exp;
}
/// <summary>
/// Gets the complementary cumulative distribution function
/// (ccdf) for this distribution evaluated at point <c>x</c>.
/// This function is also known as the Survival function.
/// </summary>
///
/// <param name="x">
/// A single point in the distribution range.</param>
///
/// <remarks>
/// The Complementary Cumulative Distribution Function (CCDF) is
/// the complement of the Cumulative Distribution Function, or 1
/// minus the CDF.
/// </remarks>
///
public override double ComplementaryDistributionFunction(double x)
{
// H(x) = -ln(1-F(x))
// 1-F(x) = exp(-H(x))
return Math.Exp(-CumulativeHazardFunction(x));
}
/// <summary>
/// Gets the probability density function (pdf) for
/// this distribution evaluated at point <c>x</c>.
/// </summary>
///
/// <param name="x">A single point in the distribution range.</param>
///
/// <returns>
/// The probability of <c>x</c> occurring
/// in the current distribution.
/// </returns>
///
/// <remarks>
/// In the Empirical Hazard Distribution, the PDF is defined
/// as the product of the hazard function h(x) and survival
/// function CDF(x), as PDF(x) = h(x) * CDF(x).
/// </remarks>
///
public override double ProbabilityDensityFunction(double x)
{
// f(x) = h(x)exp(-H(x))
// Density function is the product of the hazard and survival functions
return HazardFunction(x) * ComplementaryDistributionFunction(x);
}
/// <summary>
/// Gets the log-probability density function (pdf) for
/// this distribution evaluated at point <c>x</c>.
/// </summary>
///
/// <param name="x">A single point in the distribution range.</param>
///
/// <returns>
/// The logarithm of the probability of <c>x</c>
/// occurring in the current distribution.
/// </returns>
///
public override double LogProbabilityDensityFunction(double x)
{
// f(x) = h(x)exp(-H(x))
// Density function is the product of the hazard and survival functions
return Math.Log(HazardFunction(x) * ComplementaryDistributionFunction(x));
}
/// <summary>
/// Gets the hazard function, also known as the failure rate or
/// the conditional failure density function for this distribution
/// evaluated at point <c>x</c>.
/// </summary>
///
/// <param name="x">A single point in the distribution range.</param>
///
/// <returns>
/// The conditional failure density function <c>h(x)</c>
/// evaluated at <c>x</c> in the current distribution.
/// </returns>
///
public override double HazardFunction(double x)
{
for (int i = 0; i < Times.Length; i++)
if (Times[i] >= x) return Hazards[i];
return 0;
}
/// <summary>
/// Creates a new object that is a copy of the current instance.
/// </summary>
///
/// <returns>
/// A new object that is a copy of this instance.
/// </returns>
///
public override object Clone()
{
return new EmpiricalHazardDistribution(
(double[])Times.Clone(),
(double[])Hazards.Clone());
}
/// <summary>
/// Creates a new Empirical Hazard Distribution from the hazard values.
/// </summary>
///
/// <param name="time">The time steps.</param>
/// <param name="hazard">The hazard values at the time steps.</param>
///
/// <returns>A new <see cref="EmpiricalHazardDistribution"/> using the given hazard values.</returns>
///
public static EmpiricalHazardDistribution FromHazardValues(double[] time, double[] hazard)
{
return new EmpiricalHazardDistribution(time, hazard);
}
/// <summary>
/// Creates a new Empirical Hazard Distribution from the survival values.
/// </summary>
///
/// <param name="time">The time steps.</param>
/// <param name="survival">The survival values at the time steps.</param>
///
/// <returns>A new <see cref="EmpiricalHazardDistribution"/> using the given survival values.</returns>
///
public static EmpiricalHazardDistribution FromSurvivalValues(double[] time, double[] survival)
{
double[] hazard = new double[survival.Length];
for (int i = 0; i < hazard.Length; i++)
hazard[i] = 1.0 - survival[i];
return new EmpiricalHazardDistribution(time, hazard);
}
/// <summary>
/// Fits the underlying distribution to a given set of observations.
/// </summary>
///
/// <param name="observations">The array of observations to fit the model against. The array
/// elements can be either of type double (for univariate data) or
/// type double[] (for multivariate data).</param>
/// <param name="weights">The weight vector containing the weight for each of the samples.</param>
/// <param name="options">Optional arguments which may be used during fitting, such
/// as regularization constants and additional parameters.</param>
///
public override void Fit(double[] observations, double[] weights, IFittingOptions options)
{
Fit(observations, weights, options as EmpiricalHazardOptions);
}
/// <summary>
/// Fits the underlying distribution to a given set of observations.
/// </summary>
///
/// <param name="observations">The array of observations to fit the model against. The array
/// elements can be either of type double (for univariate data) or
/// type double[] (for multivariate data).</param>
/// <param name="weights">The weight vector containing the weight for each of the samples.</param>
/// <param name="options">Optional arguments which may be used during fitting, such
/// as regularization constants and additional parameters.</param>
///
public void Fit(double[] observations, double[] weights, EmpiricalHazardOptions options)
{
if (options == null) throw new ArgumentNullException("options", "Options can't be null");
if (weights != null) throw new ArgumentException("Weights are not supported.", "weights");
double[] output = options.Output;
int[] censor = options.Censor;
double[] time = observations;
double[] values = new double[time.Length];
if (options.Estimator == HazardEstimator.BreslowNelsonAalen)
{
// Compute an estimate of the cumulative Hazard
// function using the Nelson-Aalen estimator
for (int i = 0; i < values.Length; i++)
{
// Check if we should censor
if (censor[i] == 0) continue;
double t = time[i];
int numberOfTies = 0;
// Count the number of ties at t = time[i]
for (int j = 0; j < time.Length; j++)
if (time[j] == t) numberOfTies++;
double sum = 0;
for (int j = 0; j < output.Length && time[j] >= time[i]; j++)
sum += output[j];
values[i] = numberOfTies / sum;
}
}
else if (options.Estimator == HazardEstimator.KalbfleischPrentice)
{
// Compute an estimate of the cumulative Survival
// function using Kalbfleisch & Prentice's estimator
// assuming there are no ties in event times
for (int i = 0; i < values.Length; i++)
{
values[i] = 1;
// Check if we should censor
if (censor[i] == 0) continue;
double num = output[i];
double den = 0;
for (int j = 0; j < output.Length && time[j] >= time[i]; j++)
den += output[j];
values[i] = 1.0 - Math.Pow(1.0 - num / den, 1.0 / num);
}
}
this.Times = (double[])time.Clone();
this.Hazards = values;
this.mean = null;
this.variance = null;
}
/// <summary>
/// Returns a <see cref="System.String"/> that represents this instance.
/// </summary>
///
/// <returns>
/// A <see cref="System.String"/> that represents this instance.
/// </returns>
///
public override string ToString()
{
return "H(x; v, t)";
}
}
}
| {
"content_hash": "4951e29e52aeed694a03a4f04072e563",
"timestamp": "",
"source": "github",
"line_count": 539,
"max_line_length": 111,
"avg_line_length": 35.465677179962896,
"alnum_prop": 0.5287717095626701,
"repo_name": "Libaier/HMMBasedGestureRecognition",
"id": "4debabcd103cd62a5ce9691fd77bd469e34873c8",
"size": "19120",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "HMMBasedGestureRecognition/Externals/Accord.NET/Accord.Statistics/Distributions/Univariate/Continuous/EmpiricalHazardDistribution.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "5078595"
}
],
"symlink_target": ""
} |
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">
</RelativeLayout>
| {
"content_hash": "64dea3ee9cc1079a237b07f8d2f6ab32",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 96,
"avg_line_length": 54.22222222222222,
"alnum_prop": 0.7766393442622951,
"repo_name": "MRixen/rbc_Diagnose",
"id": "b9b38b1a599ab6f489fe9d9e25358772e902e0d2",
"size": "488",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "app/src/main/res/layout/activity_barcodereading.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "701"
},
{
"name": "Java",
"bytes": "4971902"
},
{
"name": "Shell",
"bytes": "270"
}
],
"symlink_target": ""
} |
@extends('layouts.app')
@section('content')
<div class="row">
<div class="col-lg-12">
<section class="panel">
<header class="panel-heading">
States
</header>
<div class="panel-body">
<div class="row">
{!! Form::model($states, ['route' => ['states.update', $states->id], 'method' => 'patch']) !!}
@include('states.fields')
{!! Form::close() !!}
</div>
</div>
</section>
</div>
</div>
@endsection | {
"content_hash": "22d7958a185ef3c9afe936fd59ef23ca",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 117,
"avg_line_length": 28.863636363636363,
"alnum_prop": 0.3858267716535433,
"repo_name": "Ashrafdev/laravel-5-thestore",
"id": "fa29a179cec18dd0936b21704ec9a4b8f0d0559a",
"size": "635",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "resources/views/states/edit.blade.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ActionScript",
"bytes": "15982"
},
{
"name": "ApacheConf",
"bytes": "1011"
},
{
"name": "CSS",
"bytes": "62081"
},
{
"name": "CoffeeScript",
"bytes": "80553"
},
{
"name": "Go",
"bytes": "6713"
},
{
"name": "HTML",
"bytes": "4005418"
},
{
"name": "JavaScript",
"bytes": "4650088"
},
{
"name": "Makefile",
"bytes": "397"
},
{
"name": "PHP",
"bytes": "364172"
},
{
"name": "Python",
"bytes": "5173"
},
{
"name": "Shell",
"bytes": "7411"
}
],
"symlink_target": ""
} |
package org.apache.geode.management.internal.cli.functions;
import java.util.ArrayList;
import java.util.List;
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.execute.FunctionContext;
import org.apache.geode.cache.query.internal.cq.CqService;
import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.internal.cache.execute.InternalFunction;
import org.apache.geode.internal.cache.tier.sockets.CacheClientNotifier;
import org.apache.geode.internal.cache.tier.sockets.CacheClientProxy;
import org.apache.geode.management.internal.cli.CliUtil;
import org.apache.geode.management.internal.functions.CliFunctionResult;
import org.apache.geode.management.internal.i18n.CliStrings;
/**
* The ListDurableCqs class is a GemFire function used to collect all the durable client names on
* the server
* </p>
*
* @see org.apache.geode.cache.Cache
* @see org.apache.geode.cache.execute.Function
* @see org.apache.geode.cache.execute.FunctionContext
* @see org.apache.geode.internal.InternalEntity
* @see org.apache.geode.management.internal.cli.domain.IndexDetails
* @since GemFire 7.0.1
*/
@SuppressWarnings("unused")
public class ListDurableCqNamesFunction implements InternalFunction<String> {
private static final long serialVersionUID = 1L;
@Override
public String getId() {
return ListDurableCqNamesFunction.class.getName();
}
@Override
public void execute(final FunctionContext<String> context) {
final Cache cache = context.getCache();
final DistributedMember member = cache.getDistributedSystem().getDistributedMember();
String memberNameOrId = CliUtil.getMemberNameOrId(member);
String durableClientId = context.getArguments();
context.getResultSender().lastResult(createFunctionResult(memberNameOrId, durableClientId));
}
private List<CliFunctionResult> createFunctionResult(String memberNameOrId,
String durableClientId) {
List<CliFunctionResult> results = new ArrayList<>();
try {
CacheClientNotifier ccn = CacheClientNotifier.getInstance();
if (ccn == null) {
results.add(new CliFunctionResult(memberNameOrId, CliFunctionResult.StatusState.IGNORABLE,
CliStrings.NO_CLIENT_FOUND));
return results;
}
CacheClientProxy ccp = ccn.getClientProxy(durableClientId);
if (ccp == null) {
results.add(new CliFunctionResult(memberNameOrId, CliFunctionResult.StatusState.IGNORABLE,
CliStrings.format(CliStrings.NO_CLIENT_FOUND_WITH_CLIENT_ID, durableClientId)));
return results;
}
CqService cqService = ccp.getCache().getCqService();
if (cqService == null || !cqService.isRunning()) {
results.add(new CliFunctionResult(memberNameOrId, CliFunctionResult.StatusState.IGNORABLE,
CliStrings.LIST_DURABLE_CQS__NO__CQS__REGISTERED));
return results;
}
List<String> durableCqNames = cqService.getAllDurableClientCqs(ccp.getProxyID());
if (durableCqNames == null || durableCqNames.isEmpty()) {
results.add(new CliFunctionResult(memberNameOrId, CliFunctionResult.StatusState.IGNORABLE,
CliStrings
.format(CliStrings.LIST_DURABLE_CQS__NO__CQS__FOR__CLIENT, durableClientId)));
return results;
}
for (String cqName : durableCqNames) {
results.add(new CliFunctionResult(memberNameOrId, CliFunctionResult.StatusState.OK,
cqName));
}
return results;
} catch (Exception e) {
results.add(new CliFunctionResult(memberNameOrId, CliFunctionResult.StatusState.ERROR,
e.getMessage()));
return results;
}
}
}
| {
"content_hash": "70799fb1663e5eab82e989025195000f",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 98,
"avg_line_length": 38.177083333333336,
"alnum_prop": 0.7353342428376535,
"repo_name": "davinash/geode",
"id": "51b4067134259e0631a01e74412cb9450e910560",
"size": "4454",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "geode-gfsh/src/main/java/org/apache/geode/management/internal/cli/functions/ListDurableCqNamesFunction.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "106707"
},
{
"name": "Go",
"bytes": "1205"
},
{
"name": "Groovy",
"bytes": "2783"
},
{
"name": "HTML",
"bytes": "3917327"
},
{
"name": "Java",
"bytes": "28126965"
},
{
"name": "JavaScript",
"bytes": "1781013"
},
{
"name": "Python",
"bytes": "5014"
},
{
"name": "Ruby",
"bytes": "6686"
},
{
"name": "Shell",
"bytes": "46841"
}
],
"symlink_target": ""
} |
/*
* 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.
*/
package com.facebook.presto.operator;
import com.facebook.presto.metadata.MetadataManager;
import com.facebook.presto.metadata.Signature;
import com.facebook.presto.operator.project.PageProcessor;
import com.facebook.presto.spi.Page;
import com.facebook.presto.sql.gen.ExpressionCompiler;
import com.facebook.presto.sql.gen.PageFunctionCompiler;
import com.facebook.presto.sql.planner.plan.PlanNodeId;
import com.facebook.presto.sql.relational.RowExpression;
import com.facebook.presto.testing.MaterializedResult;
import com.google.common.collect.ImmutableList;
import io.airlift.units.DataSize;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ScheduledExecutorService;
import java.util.function.Supplier;
import static com.facebook.presto.RowPagesBuilder.rowPagesBuilder;
import static com.facebook.presto.SessionTestUtils.TEST_SESSION;
import static com.facebook.presto.metadata.MetadataManager.createTestMetadataManager;
import static com.facebook.presto.operator.OperatorAssertion.assertOperatorEquals;
import static com.facebook.presto.spi.function.OperatorType.ADD;
import static com.facebook.presto.spi.function.OperatorType.BETWEEN;
import static com.facebook.presto.spi.function.OperatorType.EQUAL;
import static com.facebook.presto.spi.type.BigintType.BIGINT;
import static com.facebook.presto.spi.type.BooleanType.BOOLEAN;
import static com.facebook.presto.spi.type.VarcharType.VARCHAR;
import static com.facebook.presto.sql.relational.Expressions.call;
import static com.facebook.presto.sql.relational.Expressions.constant;
import static com.facebook.presto.sql.relational.Expressions.field;
import static com.facebook.presto.testing.TestingTaskContext.createTaskContext;
import static io.airlift.concurrent.Threads.daemonThreadsNamed;
import static io.airlift.units.DataSize.Unit.BYTE;
import static io.airlift.units.DataSize.Unit.KILOBYTE;
import static java.util.concurrent.Executors.newCachedThreadPool;
import static java.util.concurrent.Executors.newScheduledThreadPool;
@Test(singleThreaded = true)
public class TestFilterAndProjectOperator
{
private ExecutorService executor;
private ScheduledExecutorService scheduledExecutor;
private DriverContext driverContext;
@BeforeMethod
public void setUp()
{
executor = newCachedThreadPool(daemonThreadsNamed("test-executor-%s"));
scheduledExecutor = newScheduledThreadPool(2, daemonThreadsNamed("test-scheduledExecutor-%s"));
driverContext = createTaskContext(executor, scheduledExecutor, TEST_SESSION)
.addPipelineContext(0, true, true, false)
.addDriverContext();
}
@AfterMethod
public void tearDown()
{
executor.shutdownNow();
scheduledExecutor.shutdownNow();
}
@Test
public void test()
{
List<Page> input = rowPagesBuilder(VARCHAR, BIGINT)
.addSequencePage(100, 0, 0)
.build();
RowExpression filter = call(
Signature.internalOperator(BETWEEN, BOOLEAN.getTypeSignature(), ImmutableList.of(BIGINT.getTypeSignature(), BIGINT.getTypeSignature(), BIGINT.getTypeSignature())),
BOOLEAN,
field(1, BIGINT),
constant(10L, BIGINT),
constant(19L, BIGINT));
RowExpression field0 = field(0, VARCHAR);
RowExpression add5 = call(
Signature.internalOperator(ADD, BIGINT.getTypeSignature(), ImmutableList.of(BIGINT.getTypeSignature(), BIGINT.getTypeSignature())),
BIGINT,
field(1, BIGINT),
constant(5L, BIGINT));
MetadataManager metadata = createTestMetadataManager();
ExpressionCompiler compiler = new ExpressionCompiler(metadata, new PageFunctionCompiler(metadata, 0));
Supplier<PageProcessor> processor = compiler.compilePageProcessor(Optional.of(filter), ImmutableList.of(field0, add5));
OperatorFactory operatorFactory = new FilterAndProjectOperator.FilterAndProjectOperatorFactory(
0,
new PlanNodeId("test"),
processor,
ImmutableList.of(VARCHAR, BIGINT),
new DataSize(0, BYTE),
0);
MaterializedResult expected = MaterializedResult.resultBuilder(driverContext.getSession(), VARCHAR, BIGINT)
.row("10", 15L)
.row("11", 16L)
.row("12", 17L)
.row("13", 18L)
.row("14", 19L)
.row("15", 20L)
.row("16", 21L)
.row("17", 22L)
.row("18", 23L)
.row("19", 24L)
.build();
assertOperatorEquals(operatorFactory, driverContext, input, expected);
}
@Test
public void testMergeOutput()
{
List<Page> input = rowPagesBuilder(VARCHAR, BIGINT)
.addSequencePage(100, 0, 0)
.addSequencePage(100, 0, 0)
.addSequencePage(100, 0, 0)
.addSequencePage(100, 0, 0)
.build();
RowExpression filter = call(
Signature.internalOperator(EQUAL, BOOLEAN.getTypeSignature(), ImmutableList.of(BIGINT.getTypeSignature(), BIGINT.getTypeSignature())),
BOOLEAN,
field(1, BIGINT),
constant(10L, BIGINT));
MetadataManager metadata = createTestMetadataManager();
ExpressionCompiler compiler = new ExpressionCompiler(metadata, new PageFunctionCompiler(metadata, 0));
Supplier<PageProcessor> processor = compiler.compilePageProcessor(Optional.of(filter), ImmutableList.of(field(1, BIGINT)));
OperatorFactory operatorFactory = new FilterAndProjectOperator.FilterAndProjectOperatorFactory(
0,
new PlanNodeId("test"),
processor,
ImmutableList.of(BIGINT),
new DataSize(64, KILOBYTE),
2);
List<Page> expected = rowPagesBuilder(BIGINT)
.row(10L)
.row(10L)
.row(10L)
.row(10L)
.build();
assertOperatorEquals(operatorFactory, ImmutableList.of(BIGINT), driverContext, input, expected);
}
}
| {
"content_hash": "10d740fcb2548dcd0d3e1b2b46a6c169",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 179,
"avg_line_length": 41.82738095238095,
"alnum_prop": 0.6849295574213747,
"repo_name": "raghavsethi/presto",
"id": "49b8107f437eb05231fcd7af856f246580a0e962",
"size": "7027",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "presto-main/src/test/java/com/facebook/presto/operator/TestFilterAndProjectOperator.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "26997"
},
{
"name": "CSS",
"bytes": "13018"
},
{
"name": "HTML",
"bytes": "28633"
},
{
"name": "Java",
"bytes": "31909074"
},
{
"name": "JavaScript",
"bytes": "214692"
},
{
"name": "Makefile",
"bytes": "6830"
},
{
"name": "PLSQL",
"bytes": "2797"
},
{
"name": "PLpgSQL",
"bytes": "11504"
},
{
"name": "Python",
"bytes": "7664"
},
{
"name": "SQLPL",
"bytes": "926"
},
{
"name": "Shell",
"bytes": "29871"
},
{
"name": "Thrift",
"bytes": "12631"
}
],
"symlink_target": ""
} |
package com.olacabs.fabric.compute.pipeline;
import com.olacabs.fabric.model.event.EventSet;
import lombok.Builder;
import lombok.Getter;
/**
* TODO javadoc.
*/
public class PipelineMessage {
@Getter
private final Type messageType;
@Getter
private final EventSet messages;
@Getter
private final PipelineMessage parent;
PipelineMessage(Type messageType) {
this.messageType = messageType;
messages = null;
parent = null;
}
@Builder(builderMethodName = "userspaceMessageBuilder")
public PipelineMessage(EventSet messages, PipelineMessage parent) {
this.messageType = Type.USERSPACE;
this.messages = messages;
this.parent = parent;
}
public static PipelineMessage timerMessageBuilder() {
return new PipelineMessage(Type.TIMER);
}
/**
* TODO doc.
*/
public enum Type {
TIMER,
USERSPACE
}
}
| {
"content_hash": "cb1e7fa5a215f8adf4641a1b5dea923f",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 71,
"avg_line_length": 20.933333333333334,
"alnum_prop": 0.6571125265392781,
"repo_name": "olacabs/fabric",
"id": "d74c697d4c8ddbf3825f99b0e375f7716f724639",
"size": "1551",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "fabric-compute-framework/src/main/java/com/olacabs/fabric/compute/pipeline/PipelineMessage.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "1798"
},
{
"name": "Java",
"bytes": "587200"
}
],
"symlink_target": ""
} |
use test_float_parse::validate;
fn main() {
// Skip e = 0 because small-u32 already does those.
for e in 1..301 {
for i in 0..10000 {
// If it ends in zeros, the parser will strip those (and adjust the exponent),
// which almost always (except for exponents near +/- 300) result in an input
// equivalent to something we already generate in a different way.
if i % 10 == 0 {
continue;
}
validate(&format!("{}e{}", i, e));
validate(&format!("{}e-{}", i, e));
}
}
}
| {
"content_hash": "945e6d55a8e9dd455e62fdd7494eb6d0",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 90,
"avg_line_length": 34.88235294117647,
"alnum_prop": 0.5160202360876898,
"repo_name": "graydon/rust",
"id": "49084eb35e8346d0cac600e0fae2e6c3bb4bc6e5",
"size": "593",
"binary": false,
"copies": "14",
"ref": "refs/heads/master",
"path": "src/etc/test-float-parse/src/bin/short-decimals.rs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "4990"
},
{
"name": "Assembly",
"bytes": "20064"
},
{
"name": "Awk",
"bytes": "159"
},
{
"name": "Bison",
"bytes": "78848"
},
{
"name": "C",
"bytes": "725899"
},
{
"name": "C++",
"bytes": "55803"
},
{
"name": "CSS",
"bytes": "22181"
},
{
"name": "JavaScript",
"bytes": "36295"
},
{
"name": "LLVM",
"bytes": "1587"
},
{
"name": "Makefile",
"bytes": "227056"
},
{
"name": "Puppet",
"bytes": "16300"
},
{
"name": "Python",
"bytes": "142548"
},
{
"name": "RenderScript",
"bytes": "99815"
},
{
"name": "Rust",
"bytes": "18342682"
},
{
"name": "Shell",
"bytes": "269546"
},
{
"name": "TeX",
"bytes": "57"
}
],
"symlink_target": ""
} |
/**
* Created by imodules on 5/13/15.
*/
'use strict';
describe('server.updateBuildDisplay', function () {
var serverId,
buildId;
beforeAll(function () {
spyOn(Meteor, 'user').and.callFake(function () {
return { isAdmin: true };
});
spyOn(Meteor, 'userId').and.callFake(function () { return 'userId123'; });
serverId = Controllers.Servers.onSaveServer(null, 'buildDsiplayServer', 'http://del.example.com', 'nodel', 'yesdel');
var project = new Models.Project({serverId: serverId, serviceProjectId: 'BDServerProject'}),
builds = [
new Models.Build({serverId: serverId, serviceBuildId: 'BDServerProjectDB1', name: 'BDServerProject Build 1'}),
new Models.Build({serverId: serverId, serviceBuildId: 'BDServerProjectDB2', name: 'BDServerProject Build 2'})
];
Controllers.Projects.onAddProject(project, builds);
var build = Collections.Builds.findOne({serverId: serverId});
buildId = build._id;
});
it('should increment the display count of the build', function () {
var build = Controllers.Builds.getBuild(buildId);
expect(build.watchers.length).toBe(0);
expect(build.isDisplayed).toBeFalsy();
var server = Controllers.Servers.getServer(serverId);
server.toggleBuildDisplay(buildId, 'TheSweet1', true);
build = Controllers.Builds.getBuild(buildId);
expect(build.watchers.length).toBe(1);
expect(build.isDisplayed).toBe(true);
server.toggleBuildDisplay(buildId, 'TheSweet2', true);
build = Controllers.Builds.getBuild(buildId);
expect(build.watchers.length).toBe(2);
expect(build.isDisplayed).toBe(true);
});
it('should decrement the display count of the build', function () {
var build = Controllers.Builds.getBuild(buildId);
expect(build.watchers.length).toBe(2);
expect(build.isDisplayed).toBe(true);
var server = Controllers.Servers.getServer(serverId);
server.toggleBuildDisplay(buildId, 'TheSweet1', false);
build = Controllers.Builds.getBuild(buildId);
expect(build.watchers.length).toBe(1);
expect(build.isDisplayed).toBe(true);
server.toggleBuildDisplay(buildId, 'TheSweet2', false);
build = Controllers.Builds.getBuild(buildId);
expect(build.watchers.length).toBe(0);
expect(build.isDisplayed).toBeFalsy();
});
});
| {
"content_hash": "4d0873d482d15ba022ffdabcd194cfac",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 119,
"avg_line_length": 35.91935483870968,
"alnum_prop": 0.7242927705433319,
"repo_name": "pstuart2/build-monitor",
"id": "758e2d055cd0004e6b78bfc75cedf260e8a62da1",
"size": "2227",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "tests/jasmine/server/integration/server/updateBuildDisplayTests.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "3671"
},
{
"name": "HTML",
"bytes": "8764"
},
{
"name": "JavaScript",
"bytes": "161382"
},
{
"name": "Shell",
"bytes": "333"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
Integrated Taxonomic Information System
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "08f4dc51609d3d1676d3771ef892f920",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.307692307692308,
"alnum_prop": 0.7238805970149254,
"repo_name": "mdoering/backbone",
"id": "8aa5f3c5740a17e207ddf8ab935fa251f43d0feb",
"size": "180",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Bacteria/Actinobacteria/Actinobacteria/Actinomycetales/Corynebacteriaceae/Corynebacterium/Corynebacterium xerose/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
package fmt_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestTime(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "UI Format Suite")
}
| {
"content_hash": "6e22b7ef80127f0156e8b05a9735caf3",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 31,
"avg_line_length": 15.666666666666666,
"alnum_prop": 0.6968085106382979,
"repo_name": "cloudfoundry/bosh-init",
"id": "1dbd5a0ef32750b9de8a9fb016aa2175433c27c9",
"size": "188",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "ui/fmt/fmt_suite_test.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Go",
"bytes": "1173133"
},
{
"name": "Ruby",
"bytes": "974"
},
{
"name": "Shell",
"bytes": "17365"
}
],
"symlink_target": ""
} |
package io.katharsis.jpa.internal.query.backend.querydsl;
import java.util.Arrays;
import java.util.List;
import javax.persistence.TupleElement;
import com.querydsl.core.types.Expression;
import io.katharsis.jpa.query.criteria.JpaCriteriaTuple;
import io.katharsis.jpa.query.querydsl.QuerydslTuple;
public class ObjectArrayTupleImpl implements QuerydslTuple, JpaCriteriaTuple {
private Object[] data;
private int numEntriesToIgnore;
public ObjectArrayTupleImpl(Object entity) {
if (entity instanceof Object[]) {
data = (Object[]) entity;
}
else {
data = new Object[] { entity };
}
}
@SuppressWarnings("unchecked")
@Override
public <T> T get(int index, Class<T> type) {
return (T) data[index + numEntriesToIgnore];
}
@Override
public <T> T get(Expression<T> expr) {
throw new UnsupportedOperationException();
}
@Override
public int size() {
return data.length - numEntriesToIgnore;
}
@Override
public Object[] toArray() {
if (numEntriesToIgnore > 0) {
return Arrays.copyOfRange(data, numEntriesToIgnore, data.length);
}
else {
return data;
}
}
@Override
public <T> T get(String name, Class<T> clazz) {
throw new UnsupportedOperationException();
}
@Override
public <X> X get(TupleElement<X> element) {
throw new UnsupportedOperationException();
}
@Override
public Object get(String name) {
throw new UnsupportedOperationException();
}
@Override
public Object get(int index) {
return get(index, Object.class);
}
@Override
public List<TupleElement<?>> getElements() {
throw new UnsupportedOperationException();
}
@Override
public void reduce(int numEntriesToIgnore) {
this.numEntriesToIgnore = numEntriesToIgnore;
}
}
| {
"content_hash": "b279de76580c5b231f6ea22b786b2504",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 78,
"avg_line_length": 20.404761904761905,
"alnum_prop": 0.7287047841306884,
"repo_name": "apetrucci/katharsis-framework",
"id": "1c64919c95f593e28330c785d095c73945660d06",
"size": "1714",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "katharsis-jpa/src/main/java/io/katharsis/jpa/internal/query/backend/querydsl/ObjectArrayTupleImpl.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "191265"
},
{
"name": "HTML",
"bytes": "8048"
},
{
"name": "Java",
"bytes": "2446402"
},
{
"name": "JavaScript",
"bytes": "2121"
},
{
"name": "Shell",
"bytes": "614"
},
{
"name": "TypeScript",
"bytes": "32723"
}
],
"symlink_target": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.