Dataset Preview
Duplicate
The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
The dataset generation failed
Error code:   DatasetGenerationError
Exception:    ArrowInvalid
Message:      JSON parse error: Missing a closing quotation mark in string. in row 823
Traceback:    Traceback (most recent call last):
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 145, in _generate_tables
                  dataset = json.load(f)
                File "/usr/local/lib/python3.9/json/__init__.py", line 293, in load
                  return loads(fp.read(),
                File "/usr/local/lib/python3.9/json/__init__.py", line 346, in loads
                  return _default_decoder.decode(s)
                File "/usr/local/lib/python3.9/json/decoder.py", line 340, in decode
                  raise JSONDecodeError("Extra data", s, end)
              json.decoder.JSONDecodeError: Extra data: line 2 column 1 (char 2987)
              
              During handling of the above exception, another exception occurred:
              
              Traceback (most recent call last):
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1995, in _prepare_split_single
                  for _, table in generator:
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 148, in _generate_tables
                  raise e
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 122, in _generate_tables
                  pa_table = paj.read_json(
                File "pyarrow/_json.pyx", line 308, in pyarrow._json.read_json
                File "pyarrow/error.pxi", line 154, in pyarrow.lib.pyarrow_internal_check_status
                File "pyarrow/error.pxi", line 91, in pyarrow.lib.check_status
              pyarrow.lib.ArrowInvalid: JSON parse error: Missing a closing quotation mark in string. in row 823
              
              The above exception was the direct cause of the following exception:
              
              Traceback (most recent call last):
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1529, in compute_config_parquet_and_info_response
                  parquet_operations = convert_to_parquet(builder)
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1154, in convert_to_parquet
                  builder.download_and_prepare(
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1027, in download_and_prepare
                  self._download_and_prepare(
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1122, in _download_and_prepare
                  self._prepare_split(split_generator, **prepare_split_kwargs)
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1882, in _prepare_split
                  for job_id, done, content in self._prepare_split_single(
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 2038, in _prepare_split_single
                  raise DatasetGenerationError("An error occurred while generating the dataset") from e
              datasets.exceptions.DatasetGenerationError: An error occurred while generating the dataset

Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.

text
string
meta
dict
import qualified Bench.Binary as Binary import qualified Bench.Cereal as Cereal import Bench.Data (genBenchData) import qualified Bench.FastPack as FastPack import qualified Bench.Packer as Packer import Bench.Types import Data.ByteString (ByteString) import qualified Data.ByteString.Char8 as BS import qualified Data.List as DL import qualified Criterion.Main as C main :: IO () main = do sanityCheck putStrLn "\nPassed sanity test.\n" C.defaultMain benchmarks -------------------------------------------------------------------------------- -- The benchmarks. benchmarks :: [C.Benchmark] benchmarks = let (bws, bss) = genBenchData 500000 in [ C.bgroup "Write to ByteString" [ C.bench "Binary" $ C.whnf (putBenchTest Binary.putBenchWord) bws , C.bench "Cereal" $ C.whnf (putBenchTest Cereal.putBenchWord) bws , C.bench "Packer" $ C.whnf (putBenchTest Packer.putBenchWord) bws , C.bench "FastPack" $ C.whnf (putBenchTest FastPack.putBenchWord) bws ] , C.bgroup "Read from ByteString" [ C.bench "Binary" $ C.whnf (getBenchTest Binary.getBenchWord) bss , C.bench "Cereal" $ C.whnf (getBenchTest Cereal.getBenchWord) bss , C.bench "Packer" $ C.whnf (getBenchTest Packer.getBenchWord) bss , C.bench "FastPack" $ C.whnf (getBenchTest FastPack.getBenchWord) bss ] ] putBenchTest :: (BenchWord -> ByteString) -> [BenchWord] -> Int putBenchTest put = DL.foldl' (\ acc bw -> acc + BS.length (put bw)) 0 getBenchTest :: (ByteString -> BenchWord) -> [ByteString] -> Int getBenchTest get = DL.foldl' (\ acc bs -> acc + fromIntegral (getThird $ get bs)) 0 sanityCheck :: IO () sanityCheck = do assert "Binary" $ Binary.sanityBenchWord bw == bw assert "Cereal" $ Cereal.sanityBenchWord bw == bw assert "Packer" $ Packer.sanityBenchWord bw == bw assert "FastPack" $ FastPack.sanityBenchWord bw == bw where bw = BenchWord 0x123456789abcdef 0xabcdef123456789 0x87654321 0x76543210 0x1234 0x2345 0x55 0xaa assert name prop = if prop then pure () else error $ name ++ " failed assertion!"
{ "content_hash": "5a4e4ec7561177db0f58a6bff226a250", "timestamp": "", "source": "github", "line_count": 64, "max_line_length": 83, "avg_line_length": 34.984375, "alnum_prop": 0.6342117016525235, "repo_name": "erikd/fastpack", "id": "8970f8f68332e0358949adede92469c929cd08cd", "size": "2240", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "bench/bench.hs", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "CSS", "bytes": "1287" }, { "name": "Haskell", "bytes": "24563" }, { "name": "JavaScript", "bytes": "2527" }, { "name": "Makefile", "bytes": "156" }, { "name": "Smarty", "bytes": "13836" } ] }
import React from 'react'; import {BaseMixin, ElementaryMixin, ContentMixin, ColorSchemaMixin} from './../common/common.js'; import './well.less'; export const Well = React.createClass({ //@@viewOn:mixins mixins: [ BaseMixin, ElementaryMixin, ContentMixin, ColorSchemaMixin ], //@@viewOff:mixins //@@viewOn:statics statics: { tagName: 'UU5.Bricks.Well', classNames: { main: 'uu5-bricks-well well' } }, //@@viewOff:statics //@@viewOn:propTypes propTypes: { size: React.PropTypes.oneOf(['sm', 'lg']) }, //@@viewOff:propTypes //@@viewOn:getDefaultProps getDefaultProps: function () { return { size: null }; }, //@@viewOff:getDefaultProps //@@viewOn:standardComponentLifeCycle //@@viewOff:standardComponentLifeCycle //@@viewOn:interface //@@viewOff:interface //@@viewOn:overridingMethods //@@viewOff:overridingMethods //@@viewOn:componentSpecificHelpers //@@viewOff:componentSpecificHelpers //@@viewOn:render render: function () { var mainAttrs = this.buildMainAttrs(); this.props.size && (mainAttrs.className += ' well-' + this.props.size); return ( <div {...mainAttrs}> {this.getChildren()} {this.getDisabledCover()} </div> ); } //@@viewOff:render }); export default Well;
{ "content_hash": "11f033820422e98b4fa1c6c9a73d73b6", "timestamp": "", "source": "github", "line_count": 67, "max_line_length": 97, "avg_line_length": 19.925373134328357, "alnum_prop": 0.6367041198501873, "repo_name": "UnicornCollege/ucl.itkpd.configurator", "id": "b76423bd5b84ae2e22f82a002baff9654f8ae310", "size": "1335", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "client/node_modules/uu5g03/doc/main/server/public/data/source/uu5-bricks-well.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "59239" }, { "name": "HTML", "bytes": "1425565" }, { "name": "JavaScript", "bytes": "4296563" }, { "name": "Ruby", "bytes": "74737" } ] }
package com.intellij.util; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class ReflectionUtilRt { @NotNull public static List<Field> collectFields(@NotNull Class<?> clazz) { List<Field> result = new ArrayList<Field>(); collectFields(clazz, result); return result; } private static void collectFields(Class<?> clazz, List<? super Field> result) { result.addAll(Arrays.asList(clazz.getDeclaredFields())); Class<?> superClass = clazz.getSuperclass(); if (superClass != null) { collectFields(superClass, result); } for (Class<?> each : clazz.getInterfaces()) { collectFields(each, result); } } public static <T> T getField(@NotNull Class<?> objectClass, @Nullable Object object, @Nullable("null means any type") Class<T> fieldType, @NotNull String fieldName) { Field field = findField(objectClass, fieldName, fieldType); if (field != null) { try { @SuppressWarnings("unchecked") T t = (T)field.get(object); return t; } catch (IllegalAccessException ignored) { } } return null; } @Nullable private static Field findField(Class<?> clazz, String fieldName, @Nullable Class<?> fieldType) { for (Field field : clazz.getDeclaredFields()) { if (fieldName.equals(field.getName()) && (fieldType == null || fieldType.isAssignableFrom(field.getType()))) { field.setAccessible(true); return field; } } Class<?> superClass = clazz.getSuperclass(); if (superClass != null) { Field result = findField(superClass, fieldName, fieldType); if (result != null) return result; } for (Class<?> each : clazz.getInterfaces()) { Field result = findField(each, fieldName, fieldType); if (result != null) return result; } return null; } }
{ "content_hash": "bcd2a0cefe72aa27daceaebc66d616ac", "timestamp": "", "source": "github", "line_count": 70, "max_line_length": 116, "avg_line_length": 29.542857142857144, "alnum_prop": 0.6329787234042553, "repo_name": "leafclick/intellij-community", "id": "8c3d8024b64e865d4fc40c385d86c2feb88a66c3", "size": "2209", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "platform/util-rt/src/com/intellij/util/ReflectionUtilRt.java", "mode": "33188", "license": "apache-2.0", "language": [] }
namespace System.ServiceModel { public sealed partial class MessageSecurityOverTcp { public MessageSecurityOverTcp() { } [System.ComponentModel.DefaultValueAttribute((System.ServiceModel.MessageCredentialType)(1))] public System.ServiceModel.MessageCredentialType ClientCredentialType { get { return default(System.ServiceModel.MessageCredentialType); } set { } } } public partial class NetTcpBinding : System.ServiceModel.Channels.Binding { public NetTcpBinding() { } public NetTcpBinding(System.ServiceModel.SecurityMode securityMode) { } public NetTcpBinding(string configurationName) { } public System.ServiceModel.EnvelopeVersion EnvelopeVersion { get { return default(System.ServiceModel.EnvelopeVersion); } } [System.ComponentModel.DefaultValueAttribute((long)524288)] public long MaxBufferPoolSize { get { return default(long); } set { } } [System.ComponentModel.DefaultValueAttribute(65536)] public int MaxBufferSize { get { return default(int); } set { } } [System.ComponentModel.DefaultValueAttribute((long)65536)] public long MaxReceivedMessageSize { get { return default(long); } set { } } public System.Xml.XmlDictionaryReaderQuotas ReaderQuotas { get { return default(System.Xml.XmlDictionaryReaderQuotas); } set { } } public override string Scheme { get { return default(string); } } public System.ServiceModel.NetTcpSecurity Security { get { return default(System.ServiceModel.NetTcpSecurity); } set { } } [System.ComponentModel.DefaultValueAttribute((System.ServiceModel.TransferMode)(0))] public System.ServiceModel.TransferMode TransferMode { get { return default(System.ServiceModel.TransferMode); } set { } } public override System.ServiceModel.Channels.BindingElementCollection CreateBindingElements() { return default(System.ServiceModel.Channels.BindingElementCollection); } } public sealed partial class NetTcpSecurity { public NetTcpSecurity() { } public System.ServiceModel.MessageSecurityOverTcp Message { get { return default(System.ServiceModel.MessageSecurityOverTcp); } set { } } [System.ComponentModel.DefaultValueAttribute((System.ServiceModel.SecurityMode)(1))] public System.ServiceModel.SecurityMode Mode { get { return default(System.ServiceModel.SecurityMode); } set { } } public System.ServiceModel.TcpTransportSecurity Transport { get { return default(System.ServiceModel.TcpTransportSecurity); } set { } } } public enum TcpClientCredentialType { Certificate = 2, None = 0, Windows = 1, } public sealed partial class TcpTransportSecurity { public TcpTransportSecurity() { } [System.ComponentModel.DefaultValueAttribute((System.ServiceModel.TcpClientCredentialType)(1))] public System.ServiceModel.TcpClientCredentialType ClientCredentialType { get { return default(System.ServiceModel.TcpClientCredentialType); } set { } } } } namespace System.ServiceModel.Channels { public abstract partial class ConnectionOrientedTransportBindingElement : System.ServiceModel.Channels.TransportBindingElement { internal ConnectionOrientedTransportBindingElement() { } [System.ComponentModel.DefaultValueAttribute(8192)] public int ConnectionBufferSize { get { return default(int); } set { } } [System.ComponentModel.DefaultValueAttribute(65536)] public int MaxBufferSize { get { return default(int); } set { } } [System.ComponentModel.DefaultValueAttribute((System.ServiceModel.TransferMode)(0))] public System.ServiceModel.TransferMode TransferMode { get { return default(System.ServiceModel.TransferMode); } set { } } public override bool CanBuildChannelFactory<TChannel>(System.ServiceModel.Channels.BindingContext context) { return default(bool); } public override T GetProperty<T>(System.ServiceModel.Channels.BindingContext context) { return default(T); } } public partial class SslStreamSecurityBindingElement : System.ServiceModel.Channels.BindingElement { public SslStreamSecurityBindingElement() { } public override System.ServiceModel.Channels.IChannelFactory<TChannel> BuildChannelFactory<TChannel>(System.ServiceModel.Channels.BindingContext context) { return default(System.ServiceModel.Channels.IChannelFactory<TChannel>); } public override bool CanBuildChannelFactory<TChannel>(System.ServiceModel.Channels.BindingContext context) { return default(bool); } public override System.ServiceModel.Channels.BindingElement Clone() { return default(System.ServiceModel.Channels.BindingElement); } public override T GetProperty<T>(System.ServiceModel.Channels.BindingContext context) { return default(T); } } public sealed partial class TcpConnectionPoolSettings { internal TcpConnectionPoolSettings() { } public string GroupName { get { return default(string); } set { } } public System.TimeSpan IdleTimeout { get { return default(System.TimeSpan); } set { } } public System.TimeSpan LeaseTimeout { get { return default(System.TimeSpan); } set { } } public int MaxOutboundConnectionsPerEndpoint { get { return default(int); } set { } } } public partial class TcpTransportBindingElement : System.ServiceModel.Channels.ConnectionOrientedTransportBindingElement { public TcpTransportBindingElement() { } protected TcpTransportBindingElement(System.ServiceModel.Channels.TcpTransportBindingElement elementToBeCloned) { } public System.ServiceModel.Channels.TcpConnectionPoolSettings ConnectionPoolSettings { get { return default(System.ServiceModel.Channels.TcpConnectionPoolSettings); } } public override string Scheme { get { return default(string); } } public override System.ServiceModel.Channels.IChannelFactory<TChannel> BuildChannelFactory<TChannel>(System.ServiceModel.Channels.BindingContext context) { return default(System.ServiceModel.Channels.IChannelFactory<TChannel>); } public override System.ServiceModel.Channels.BindingElement Clone() { return default(System.ServiceModel.Channels.BindingElement); } public override T GetProperty<T>(System.ServiceModel.Channels.BindingContext context) { return default(T); } } public partial class WindowsStreamSecurityBindingElement : System.ServiceModel.Channels.BindingElement { public WindowsStreamSecurityBindingElement() { } public override System.ServiceModel.Channels.IChannelFactory<TChannel> BuildChannelFactory<TChannel>(System.ServiceModel.Channels.BindingContext context) { return default(System.ServiceModel.Channels.IChannelFactory<TChannel>); } public override bool CanBuildChannelFactory<TChannel>(System.ServiceModel.Channels.BindingContext context) { return default(bool); } public override System.ServiceModel.Channels.BindingElement Clone() { return default(System.ServiceModel.Channels.BindingElement); } public override T GetProperty<T>(System.ServiceModel.Channels.BindingContext context) { return default(T); } } }
{ "content_hash": "0e94f4031cb6cc14d7854acfa2a99793", "timestamp": "", "source": "github", "line_count": 97, "max_line_length": 237, "avg_line_length": 74.57731958762886, "alnum_prop": 0.7511750069118054, "repo_name": "MarcosRamiro/wcf", "id": "b2187646f6d1e2a40ab31d939db509a3db3ec6fc", "size": "7625", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "src/System.ServiceModel.NetTcp/ref/System.ServiceModel.NetTcp.cs", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "4939" }, { "name": "C#", "bytes": "5189537" }, { "name": "PowerShell", "bytes": "1672" }, { "name": "Shell", "bytes": "9898" } ] }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>paramcoq: 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.12.0 / paramcoq - 1.1.2+coq8.7</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> paramcoq <small> 1.1.2+coq8.7 <span class="label label-info">Not compatible 👼</span> </small> </h1> <p>📅 <em><script>document.write(moment("2022-06-18 18:41:23 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-06-18 18:41:23 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-threads base base-unix base conf-findutils 1 Virtual package relying on findutils coq 8.12.0 Formal proof management system num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic ocaml 4.08.1 The OCaml compiler (virtual package) ocaml-base-compiler 4.08.1 Official release 4.08.1 ocaml-config 1 OCaml Switch Configuration ocamlfind 1.9.3 A library manager for OCaml # opam file: opam-version: &quot;2.0&quot; maintainer: &quot;Pierre Roux &lt;pierre.roux@onera.fr&gt;&quot; homepage: &quot;https://github.com/coq-community/paramcoq&quot; dev-repo: &quot;git+https://github.com/coq-community/paramcoq.git&quot; bug-reports: &quot;https://github.com/coq-community/paramcoq/issues&quot; license: &quot;MIT&quot; build: [make &quot;-j%{jobs}%&quot;] install: [make &quot;install&quot;] depends: [ &quot;coq&quot; {&gt;= &quot;8.7.2&quot; &amp; &lt; &quot;8.8~&quot;} ] tags: [ &quot;keyword:paramcoq&quot; &quot;keyword:parametricity&quot; &quot;keyword:OCaml modules&quot; &quot;category:Miscellaneous/Coq Extensions&quot; &quot;logpath:Param&quot; ] authors: [ &quot;Chantal Keller (Inria, École polytechnique)&quot; &quot;Marc Lasson (ÉNS de Lyon)&quot; &quot;Abhishek Anand&quot; &quot;Pierre Roux&quot; &quot;Emilio Jesús Gallego Arias&quot; &quot;Cyril Cohen&quot; &quot;Matthieu Sozeau&quot; ] synopsis: &quot;Plugin for generating parametricity statements to perform refinement proofs&quot; description: &quot;&quot;&quot; The plugin is still in an experimental state. It is not very user friendly (lack of good error messages) and still contains bugs. But is useable enough to &quot;translate&quot; a large chunk of standard library.&quot;&quot;&quot; url { src: &quot;https://github.com/coq-community/paramcoq/archive/v1.1.2+coq8.7.tar.gz&quot; checksum: &quot;sha256=48fcb716c00d52802a9596ee396eab9af7f368da6afebdbb9cf67738ae133b97&quot; } </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-paramcoq.1.1.2+coq8.7 coq.8.12.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.12.0). The following dependencies couldn&#39;t be met: - coq-paramcoq -&gt; coq &lt; 8.8~ -&gt; ocaml &lt; 4.06.0 base of this switch (use `--unlock-base&#39; to force) Your request can&#39;t be satisfied: - No available version of coq satisfies the constraints No solution found, exiting </pre></dd> </dl> <p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-paramcoq.1.1.2+coq8.7</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": "50cce4c6d3e91b2d4fefb40dee1bbc43", "timestamp": "", "source": "github", "line_count": 176, "max_line_length": 159, "avg_line_length": 40.63068181818182, "alnum_prop": 0.5533491819325969, "repo_name": "coq-bench/coq-bench.github.io", "id": "d7aaaf6455ae63baa5c7b44ac2f5e24ff6145ee6", "size": "7179", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "clean/Linux-x86_64-4.08.1-2.0.5/released/8.12.0/paramcoq/1.1.2+coq8.7.html", "mode": "33188", "license": "mit", "language": [] }
<!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"/> <title>Boost.Geometry.Index: boost::geometry::index::quadratic&lt; MaxElements, MinElements &gt; Struct Template Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css" /> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="search/search.js"></script> <script type="text/javascript"> $(document).ready(function() { searchBox.OnSelectItem(0); }); </script> </head> <body> <div id="top"><!-- do not remove this div! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">Boost.Geometry.Index </div> </td> </tr> </tbody> </table> </div> <!-- Generated by Doxygen 1.7.6.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&#160;Page</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li class="current"><a href="annotated.html"><span>Classes</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 id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="annotated.html"><span>Class&#160;List</span></a></li> <li><a href="classes.html"><span>Class&#160;Index</span></a></li> <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li> <li><a href="functions.html"><span>Class&#160;Members</span></a></li> </ul> </div> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> <a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Typedefs</a></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 id="nav-path" class="navpath"> <ul> <li class="navelem"><b>boost</b> </li> <li class="navelem"><b>geometry</b> </li> <li class="navelem"><b>index</b> </li> <li class="navelem"><a class="el" href="structboost_1_1geometry_1_1index_1_1quadratic.html">quadratic</a> </li> </ul> </div> </div> <div class="header"> <div class="headertitle"> <div class="title">boost::geometry::index::quadratic&lt; MaxElements, MinElements &gt; Struct Template Reference</div> </div> </div><!--header--> <div class="contents"> <!-- doxytag: class="boost::geometry::index::quadratic" --> <p>Quadratic r-tree creation algorithm parameters. <a href="structboost_1_1geometry_1_1index_1_1quadratic.html#details">More...</a></p> <p><code>#include &lt;<a class="el" href="parameters_8hpp_source.html">parameters.hpp</a>&gt;</code></p> <p><a href="structboost_1_1geometry_1_1index_1_1quadratic-members.html">List of all members.</a></p> <hr/><a name="details" id="details"></a><h2>Detailed Description</h2> <div class="textblock"><h3>template&lt;size_t MaxElements, size_t MinElements = detail::default_min_elements_s&lt;MaxElements&gt;::value&gt;<br/> struct boost::geometry::index::quadratic&lt; MaxElements, MinElements &gt;</h3> <p>Quadratic r-tree creation algorithm parameters. </p> <dl class=""><dt><b>Template Parameters:</b></dt><dd> <table class=""> <tr><td class="paramname">MaxElements</td><td>Maximum number of elements in nodes. </td></tr> <tr><td class="paramname">MinElements</td><td>Minimum number of elements in nodes. Default: 0.3*Max. </td></tr> </table> </dd> </dl> </div><hr/>The documentation for this struct was generated from the following file:<ul> <li>/home/travis/build/boostorg/boost/boost/geometry/index/<a class="el" href="parameters_8hpp_source.html">parameters.hpp</a></li> </ul> </div><!-- contents --> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> <a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Typedefs</a></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> <hr class="footer"/><address class="footer"><small> Generated on Thu May 5 2016 21:18:04 for Boost.Geometry.Index by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.7.6.1 </small></address> </body> </html>
{ "content_hash": "3c57a50cfe487f09743252e4939a3147", "timestamp": "", "source": "github", "line_count": 153, "max_line_length": 549, "avg_line_length": 45.95424836601307, "alnum_prop": 0.6683259849239084, "repo_name": "calvinfarias/IC2015-2", "id": "162832010bfff6c9e8242d1a3bd48592f7dcba43", "size": "7031", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "BOOST/boost_1_61_0/libs/geometry/doc/index/html_by_doxygen/structboost_1_1geometry_1_1index_1_1quadratic.html", "mode": "33188", "license": "mit", "language": [ { "name": "Assembly", "bytes": "223360" }, { "name": "Batchfile", "bytes": "32233" }, { "name": "C", "bytes": "2977162" }, { "name": "C#", "bytes": "40804" }, { "name": "C++", "bytes": "184445796" }, { "name": "CMake", "bytes": "119765" }, { "name": "CSS", "bytes": "427923" }, { "name": "Cuda", "bytes": "111870" }, { "name": "DIGITAL Command Language", "bytes": "6246" }, { "name": "FORTRAN", "bytes": "5291" }, { "name": "Groff", "bytes": "5189" }, { "name": "HTML", "bytes": "234946752" }, { "name": "IDL", "bytes": "14" }, { "name": "JavaScript", "bytes": "682223" }, { "name": "Lex", "bytes": "1231" }, { "name": "M4", "bytes": "29689" }, { "name": "Makefile", "bytes": "1083443" }, { "name": "Max", "bytes": "36857" }, { "name": "Objective-C", "bytes": "11406" }, { "name": "Objective-C++", "bytes": "630" }, { "name": "PHP", "bytes": "59030" }, { "name": "Perl", "bytes": "39008" }, { "name": "Perl6", "bytes": "2053" }, { "name": "Python", "bytes": "1759984" }, { "name": "QML", "bytes": "593" }, { "name": "QMake", "bytes": "16692" }, { "name": "Rebol", "bytes": "354" }, { "name": "Ruby", "bytes": "5532" }, { "name": "Shell", "bytes": "355247" }, { "name": "Tcl", "bytes": "1172" }, { "name": "TeX", "bytes": "126042" }, { "name": "XSLT", "bytes": "552736" }, { "name": "Yacc", "bytes": "19623" } ] }
import os.path import re import sys from pycodestyle import Checker, BaseReport, StandardReport, readlines SELFTEST_REGEX = re.compile(r'\b(Okay|[EW]\d{3}):\s(.*)') ROOT_DIR = os.path.dirname(os.path.dirname(__file__)) class PseudoFile(list): """Simplified file interface.""" write = list.append def getvalue(self): return ''.join(self) def flush(self): pass class TestReport(StandardReport): """Collect the results for the tests.""" def __init__(self, options): options.benchmark_keys += ['test cases', 'failed tests'] super(TestReport, self).__init__(options) self._verbose = options.verbose def error(self, line_number, offset, text, check): """Report an error, according to options.""" code = text[:4] if code in self.counters: self.counters[code] += 1 else: self.counters[code] = 1 detailed_code = '%s:%s:%s' % (code, line_number, offset + 1) # Don't care about expected errors or warnings if code in self.expected or detailed_code in self.expected: return self._deferred_print.append( (line_number, offset, detailed_code, text[5:], check.__doc__)) self.file_errors += 1 self.total_errors += 1 return code def get_file_results(self): # Check if the expected errors were found label = '%s:%s:1' % (self.filename, self.line_offset) for extended_code in self.expected: code = extended_code.split(':')[0] if not self.counters.get(code): self.file_errors += 1 self.total_errors += 1 print('%s: error %s not found' % (label, extended_code)) else: self.counters[code] -= 1 for code, extra in sorted(self.counters.items()): if code not in self._benchmark_keys: if extra and code in self.expected: self.file_errors += 1 self.total_errors += 1 print('%s: error %s found too many times (+%d)' % (label, code, extra)) # Reset counters del self.counters[code] if self._verbose and not self.file_errors: print('%s: passed (%s)' % (label, ' '.join(self.expected) or 'Okay')) self.counters['test cases'] += 1 if self.file_errors: self.counters['failed tests'] += 1 return super(TestReport, self).get_file_results() def print_results(self): results = ("%(physical lines)d lines tested: %(files)d files, " "%(test cases)d test cases%%s." % self.counters) if self.total_errors: print(results % ", %s failures" % self.total_errors) else: print(results % "") print("Test failed." if self.total_errors else "Test passed.") class InMemoryReport(BaseReport): """ Collect the results in memory, without printing anything. """ def __init__(self, options): super(InMemoryReport, self).__init__(options) self.in_memory_errors = [] def error(self, line_number, offset, text, check): """ Report an error, according to options. """ code = text[:4] self.in_memory_errors.append('%s:%s:%s' % ( code, line_number, offset + 1)) return super(InMemoryReport, self).error( line_number, offset, text, check) def selftest(options): """ Test all check functions with test cases in docstrings. """ count_failed = count_all = 0 report = BaseReport(options) counters = report.counters checks = options.physical_checks + options.logical_checks for name, check, argument_names in checks: for line in check.__doc__.splitlines(): line = line.lstrip() match = SELFTEST_REGEX.match(line) if match is None: continue code, source = match.groups() lines = [part.replace(r'\t', '\t') + '\n' for part in source.split(r'\n')] checker = Checker(lines=lines, options=options, report=report) checker.check_all() error = None if code == 'Okay': if len(counters) > len(options.benchmark_keys): codes = [key for key in counters if key not in options.benchmark_keys] error = "incorrectly found %s" % ', '.join(codes) elif not counters.get(code): error = "failed to find %s" % code # Keep showing errors for multiple tests for key in set(counters) - set(options.benchmark_keys): del counters[key] count_all += 1 if not error: if options.verbose: print("%s: %s" % (code, source)) else: count_failed += 1 print("pycodestyle.py: %s:" % error) for line in checker.lines: print(line.rstrip()) return count_failed, count_all def init_tests(pep8style): """ Initialize testing framework. A test file can provide many tests. Each test starts with a declaration. This declaration is a single line starting with '#:'. It declares codes of expected failures, separated by spaces or 'Okay' if no failure is expected. If the file does not contain such declaration, it should pass all tests. If the declaration is empty, following lines are not checked, until next declaration. Examples: * Only E224 and W701 are expected: #: E224 W701 * Following example is conform: #: Okay * Don't check these lines: #: """ report = pep8style.init_report(TestReport) runner = pep8style.input_file def run_tests(filename): """Run all the tests from a file.""" # Skip tests meant for higher versions of python ver_match = re.search(r'python(\d)(\d+)?\.py$', filename) if ver_match: test_against_version = tuple(int(val or 0) for val in ver_match.groups()) if sys.version_info < test_against_version: return lines = readlines(filename) + ['#:\n'] line_offset = 0 codes = ['Okay'] testcase = [] count_files = report.counters['files'] for index, line in enumerate(lines): if not line.startswith('#:'): if codes: # Collect the lines of the test case testcase.append(line) continue if codes and index: if 'noeol' in codes: testcase[-1] = testcase[-1].rstrip('\n') codes = [c for c in codes if c not in ('Okay', 'noeol')] # Run the checker runner(filename, testcase, expected=codes, line_offset=line_offset) # output the real line numbers line_offset = index + 1 # configure the expected errors codes = line.split()[1:] # empty the test case buffer del testcase[:] report.counters['files'] = count_files + 1 return report.counters['failed tests'] pep8style.runner = run_tests def run_tests(style): options = style.options if options.doctest: import doctest fail_d, done_d = doctest.testmod(report=False, verbose=options.verbose) fail_s, done_s = selftest(options) count_failed = fail_s + fail_d if not options.quiet: count_passed = done_d + done_s - count_failed print("%d passed and %d failed." % (count_passed, count_failed)) print("Test failed." if count_failed else "Test passed.") if count_failed: sys.exit(1) if options.testsuite: init_tests(style) return style.check_files()
{ "content_hash": "05ea3974c39e899bf3d844272354bf0d", "timestamp": "", "source": "github", "line_count": 223, "max_line_length": 79, "avg_line_length": 36.55605381165919, "alnum_prop": 0.5462463199214916, "repo_name": "PyCQA/pep8", "id": "eb8b4436f9078d7d59b418e0e09f68a1c77e3124", "size": "8176", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "testsuite/support.py", "mode": "33188", "license": "mit", "language": [ { "name": "Makefile", "bytes": "215" }, { "name": "Python", "bytes": "160589" } ] }
> Decorators make it possible to annotate and modify classes and properties at design time. ## When To Use You **may** use decorator with some reservation. > Why? The decorator proposal has been in stage 2 for many years. While it is actively used as TypeScript and Babel supports it, it may change in the future. ## Hoisting When using decorator, you **must** beware of `hoisting`. ```ts import { autoinject } from 'aurelia-dependency-injection' @autoinject() class Depender { constructor(private dep: Dependent) { } } class Dependent { } ``` > Why? Decorator executes at load time, at the point of declaration. This means all references it uses must be defined prior to the call. The following code doesn't work: `dep` parameter will receive `undefined` because the variable of class `Dependent` is hoisted but not the initialization. Therefore, when the `@autoinject()` is called on the class `Depender`, the `Dependent` variable is still undefined. ## References - <https://github.com/wycats/javascript-decorators> - <https://github.com/tc39/proposal-decorators> - <http://javascript.info/tutorial/decorators> - <https://medium.com/google-developers/exploring-es7-decorators-76ecb65fb841#.bziwbnnow>
{ "content_hash": "5ec038096b3eef3dd1721dc5b162ea1a", "timestamp": "", "source": "github", "line_count": 45, "max_line_length": 121, "avg_line_length": 27.155555555555555, "alnum_prop": 0.7553191489361702, "repo_name": "unional/TypeScript", "id": "c6d564e9c0ae28ca7e2d8d7c823b4124132ea4cb", "size": "1235", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "pages/02-javascript-syntax/decorator.md", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "JavaScript", "bytes": "2404" }, { "name": "TypeScript", "bytes": "1938" } ] }
/** * @file * A Backbone View that provides a dynamic contextual link. */ (function ($, Backbone, Drupal) { "use strict"; Drupal.quickedit.ContextualLinkView = Backbone.View.extend(/** @lends Drupal.quickedit.ContextualLinkView# */{ /** * Define all events to listen to. * * @return {object} * A map of events. */ events: function () { // Prevents delay and simulated mouse events. function touchEndToClick(event) { event.preventDefault(); event.target.click(); } return { 'click a': function (event) { event.preventDefault(); this.model.set('state', 'launching'); }, 'touchEnd a': touchEndToClick }; }, /** * Create a new contextual link view. * * @constructs * * @augments Backbone.View * * @param {object} options * An object with the following keys: * @param {Drupal.quickedit.EntityModel} options.model * The associated entity's model. * @param {Drupal.quickedit.AppModel} options.appModel * The application state model. * @param {object} options.strings * The strings for the "Quick edit" link. */ initialize: function (options) { // Insert the text of the quick edit toggle. this.$el.find('a').text(options.strings.quickEdit); // Initial render. this.render(); // Re-render whenever this entity's isActive attribute changes. this.listenTo(this.model, 'change:isActive', this.render); }, /** * Render function for the contextual link view. * * @param {Drupal.quickedit.EntityModel} entityModel * The associated `EntityModel`. * @param {bool} isActive * Whether the in-place editor is active or not. * * @return {Drupal.quickedit.ContextualLinkView} * The `ContextualLinkView` in question. */ render: function (entityModel, isActive) { this.$el.find('a').attr('aria-pressed', isActive); // Hides the contextual links if an in-place editor is active. this.$el.closest('.contextual').toggle(!isActive); return this; } }); })(jQuery, Backbone, Drupal);
{ "content_hash": "b51a43225ce332865728da636d020c87", "timestamp": "", "source": "github", "line_count": 81, "max_line_length": 112, "avg_line_length": 27.493827160493826, "alnum_prop": 0.6035024696901662, "repo_name": "komejo/d8demo-dev", "id": "288101a31265caf50b7bc877b43f054bfd4f691c", "size": "2227", "binary": false, "copies": "26", "ref": "refs/heads/master", "path": "web/core/modules/quickedit/js/views/ContextualLinkView.js", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "9118" }, { "name": "C++", "bytes": "13044" }, { "name": "CSS", "bytes": "291673" }, { "name": "HTML", "bytes": "322832" }, { "name": "JavaScript", "bytes": "838628" }, { "name": "PHP", "bytes": "27260329" }, { "name": "Shell", "bytes": "45206" } ] }
package com.google.common.collect.testing; import com.google.common.collect.testing.features.CollectionFeature; import com.google.common.collect.testing.features.Feature; import com.google.common.collect.testing.testers.CollectionSerializationEqualTester; import com.google.common.collect.testing.testers.ListAddAllAtIndexTester; import com.google.common.collect.testing.testers.ListAddAllTester; import com.google.common.collect.testing.testers.ListAddAtIndexTester; import com.google.common.collect.testing.testers.ListAddTester; import com.google.common.collect.testing.testers.ListCreationTester; import com.google.common.collect.testing.testers.ListEqualsTester; import com.google.common.collect.testing.testers.ListGetTester; import com.google.common.collect.testing.testers.ListHashCodeTester; import com.google.common.collect.testing.testers.ListIndexOfTester; import com.google.common.collect.testing.testers.ListLastIndexOfTester; import com.google.common.collect.testing.testers.ListListIteratorTester; import com.google.common.collect.testing.testers.ListRemoveAllTester; import com.google.common.collect.testing.testers.ListRemoveAtIndexTester; import com.google.common.collect.testing.testers.ListRemoveTester; import com.google.common.collect.testing.testers.ListRetainAllTester; import com.google.common.collect.testing.testers.ListSetTester; import com.google.common.collect.testing.testers.ListSubListTester; import com.google.common.collect.testing.testers.ListToArrayTester; import com.google.common.testing.SerializableTester; import junit.framework.TestSuite; import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.List; import java.util.Set; /** * Creates, based on your criteria, a JUnit test suite that exhaustively tests * a List implementation. * * @author George van den Driessche */ public final class ListTestSuiteBuilder<E> extends AbstractCollectionTestSuiteBuilder<ListTestSuiteBuilder<E>, E> { public static <E> ListTestSuiteBuilder<E> using( TestListGenerator<E> generator) { return new ListTestSuiteBuilder<E>().usingGenerator(generator); } @Override protected List<Class<? extends AbstractTester>> getTesters() { List<Class<? extends AbstractTester>> testers = Helpers.copyToList(super.getTesters()); testers.add(CollectionSerializationEqualTester.class); testers.add(ListAddAllAtIndexTester.class); testers.add(ListAddAllTester.class); testers.add(ListAddAtIndexTester.class); testers.add(ListAddTester.class); testers.add(ListCreationTester.class); testers.add(ListEqualsTester.class); testers.add(ListGetTester.class); testers.add(ListHashCodeTester.class); testers.add(ListIndexOfTester.class); testers.add(ListLastIndexOfTester.class); testers.add(ListListIteratorTester.class); testers.add(ListRemoveAllTester.class); testers.add(ListRemoveAtIndexTester.class); testers.add(ListRemoveTester.class); testers.add(ListRetainAllTester.class); testers.add(ListSetTester.class); testers.add(ListSubListTester.class); testers.add(ListToArrayTester.class); return testers; } /** * Specifies {@link CollectionFeature#KNOWN_ORDER} for all list tests, since * lists have an iteration ordering corresponding to the insertion order. */ @Override public TestSuite createTestSuite() { if (!getFeatures().contains(CollectionFeature.KNOWN_ORDER)) { List<Feature<?>> features = Helpers.copyToList(getFeatures()); features.add(CollectionFeature.KNOWN_ORDER); withFeatures(features); } return super.createTestSuite(); } @Override protected List<TestSuite> createDerivedSuites( FeatureSpecificTestSuiteBuilder< ?, ? extends OneSizeTestContainerGenerator<Collection<E>, E>> parentBuilder) { List<TestSuite> derivedSuites = new ArrayList<TestSuite>( super.createDerivedSuites(parentBuilder)); if (parentBuilder.getFeatures().contains(CollectionFeature.SERIALIZABLE)) { derivedSuites.add(ListTestSuiteBuilder .using(new ReserializedListGenerator<E>(parentBuilder.getSubjectGenerator())) .named(getName() + " reserialized") .withFeatures(computeReserializedCollectionFeatures(parentBuilder.getFeatures())) .suppressing(parentBuilder.getSuppressedTests()) .createTestSuite()); } return derivedSuites; } static class ReserializedListGenerator<E> implements TestListGenerator<E>{ final OneSizeTestContainerGenerator<Collection<E>, E> gen; private ReserializedListGenerator(OneSizeTestContainerGenerator<Collection<E>, E> gen) { this.gen = gen; } @Override public SampleElements<E> samples() { return gen.samples(); } @Override public List<E> create(Object... elements) { return (List<E>) SerializableTester.reserialize(gen.create(elements)); } @Override public E[] createArray(int length) { return gen.createArray(length); } @Override public Iterable<E> order(List<E> insertionOrder) { return gen.order(insertionOrder); } } private static Set<Feature<?>> computeReserializedCollectionFeatures( Set<Feature<?>> features) { Set<Feature<?>> derivedFeatures = new HashSet<Feature<?>>(); derivedFeatures.addAll(features); derivedFeatures.remove(CollectionFeature.SERIALIZABLE); derivedFeatures.remove(CollectionFeature.SERIALIZABLE_INCLUDING_VIEWS); return derivedFeatures; } }
{ "content_hash": "7f4041b86d603aee4295523daf9a4264", "timestamp": "", "source": "github", "line_count": 144, "max_line_length": 92, "avg_line_length": 38.645833333333336, "alnum_prop": 0.7638814016172507, "repo_name": "lowasser/guava-experimental", "id": "71a9216292ad261c6bb544e7f22fe7e67298de20", "size": "6165", "binary": false, "copies": "6", "ref": "refs/heads/master", "path": "guava-testlib/src/com/google/common/collect/testing/ListTestSuiteBuilder.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "8854301" }, { "name": "Shell", "bytes": "1443" } ] }
package org.jgroups.protocols.jzookeeper; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import java.util.Timer; import java.util.TimerTask; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; import org.jgroups.Address; import org.jgroups.Event; import org.jgroups.Message; import org.jgroups.View; import org.jgroups.annotations.ManagedAttribute; import org.jgroups.annotations.ManagedOperation; import org.jgroups.protocols.jzookeeper.Zab2Phases.FollowerMessageHandler; import org.jgroups.protocols.jzookeeper.Zab2Phases.MessageHandler; import org.jgroups.stack.Protocol; import org.jgroups.util.MessageBatch; /* * It is orignal protocol of Apache Zookeeper. Also it has features of testing throuhput, latency (in Nano), ant etc. * When using testing, it provides warm up test before starting real test. * @author Ibrahim EL-Sanosi */ public class Zab extends Protocol { private final static String ProtocolName = "Zab"; private final static int numberOfSenderInEachClient = 20; private final AtomicLong zxid = new AtomicLong(0); private ExecutorService executor1; private ExecutorService executor2; private Address local_addr; private volatile Address leader; private volatile View view; private volatile boolean is_leader = false; private List<Address> zabMembers = Collections .synchronizedList(new ArrayList<Address>()); private long lastZxidProposed = 0, lastZxidCommitted = 0; private final Set<MessageId> requestQueue = Collections .synchronizedSet(new HashSet<MessageId>()); private Map<Long, ZabHeader> queuedCommitMessage = new HashMap<Long, ZabHeader>(); private final Map<Long, ZabHeader> queuedProposalMessage = Collections .synchronizedMap(new HashMap<Long, ZabHeader>()); private final LinkedBlockingQueue<ZabHeader> queuedMessages = new LinkedBlockingQueue<ZabHeader>(); private final LinkedBlockingQueue<ZabHeader> delivery = new LinkedBlockingQueue<ZabHeader>(); private ConcurrentMap<Long, Proposal> outstandingProposals = new ConcurrentHashMap<Long, Proposal>(); private final Map<MessageId, Message> messageStore = Collections .synchronizedMap(new HashMap<MessageId, Message>()); private Calendar cal = Calendar.getInstance(); private int index = -1; private int clientFinished = 0; private int numABRecieved = 0; private volatile boolean running = true; private volatile boolean startThroughput = false; private final static String outDir = "/work/Zab/"; private final static String outDirWork = "/work/Zab/"; private AtomicLong countMessageLeader = new AtomicLong(0); private long countMessageFollower = 0; private List<Address> clients = Collections .synchronizedList(new ArrayList<Address>()); private ProtocolStats stats = new ProtocolStats(); private Timer timer = new Timer(); /* * Empty constructor */ public Zab() { } @ManagedAttribute public boolean isleaderinator() { return is_leader; } public Address getleaderinator() { return leader; } public Address getLocalAddress() { return local_addr; } @ManagedOperation public String printStats() { return dumpStats().toString(); } @Override public void start() throws Exception { super.start(); running = true; executor1 = Executors.newSingleThreadExecutor(); executor1.execute(new FollowerMessageHandler(this.id)); log.setLevel("trace"); } /* * reset all protocol fields, reset invokes after warm up has finished, then * callback the clients to start main test */ public void reset(Address client) { zxid.set(0); lastZxidProposed = 0; lastZxidCommitted = 0; requestQueue.clear(); queuedCommitMessage.clear(); queuedProposalMessage.clear(); queuedMessages.clear(); outstandingProposals.clear(); messageStore.clear(); startThroughput = false; countMessageLeader = new AtomicLong(0);// timer.cancel(); countMessageFollower = 0; timer.schedule(new Throughput(), 1000, 1000); this.stats = new ProtocolStats(ProtocolName, clients.size(), numberOfSenderInEachClient, outDir, false); log.info("Reset done"); MessageId messageId = new MessageId(local_addr, -10, System.currentTimeMillis()); if (is_leader) { for (Address c : clients) { ZabHeader startTest = new ZabHeader(ZabHeader.STARTREALTEST, messageId); Message confirmClient = new Message(c).putHeader(this.id, startTest); down_prot.down(new Event(Event.MSG, confirmClient)); } } } @Override public void stop() { running = false; executor1.shutdown(); executor2.shutdown(); super.stop(); } public Object down(Event evt) { switch (evt.getType()) { case Event.MSG: Message m = (Message) evt.getArg(); handleClientRequest(m); return null; // don't pass down case Event.SET_LOCAL_ADDRESS: local_addr = (Address) evt.getArg(); break; } return down_prot.down(evt); } public Object up(Event evt) { Message msg = null; ZabHeader hdr; switch (evt.getType()) { case Event.MSG: msg = (Message) evt.getArg(); hdr = (ZabHeader) msg.getHeader(this.id); if (hdr == null) { break; // pass up } switch (hdr.getType()) { case ZabHeader.START_SENDING: if (!zabMembers.contains(local_addr)) return up_prot.up(new Event(Event.MSG, msg)); break; case ZabHeader.REQUEST: forwardToLeader(msg); break; case ZabHeader.RESET: reset(msg.getSrc()); break; case ZabHeader.FORWARD: // if (!stats.isWarmup()) { // stats.addLatencyProposalST(hdr.getMessageId(), // System.nanoTime()); // } queuedMessages.add(hdr); break; case ZabHeader.PROPOSAL: if (!is_leader) { if (!stats.isWarmup() && !startThroughput) { startThroughput = true; stats.setStartThroughputTime(System.currentTimeMillis()); stats.setLastNumReqDeliveredBefore(0); stats.setLastThroughputTime(System.currentTimeMillis()); } sendACK(msg, hdr); } break; case ZabHeader.ACK: if (is_leader) { processACK(msg, msg.getSrc()); } break; case ZabHeader.COMMIT: delivery.add(hdr); //deliver(hdr.getZxid()); break; case ZabHeader.CLIENTFINISHED: clientFinished++; if(clientFinished==clients.size() && !is_leader){ running = false; timer.cancel(); sendMyTotalBroadcast(); } break; case ZabHeader.STATS: stats.printProtocolStats(is_leader); break; case ZabHeader.COUNTMESSAGE: addTotalABMssages(hdr); log.info("Yes, I recieved count request"); break; case ZabHeader.SENDMYADDRESS: if (!zabMembers.contains(msg.getSrc())) { clients.add(msg.getSrc()); System.out.println("Rceived clients address " + msg.getSrc()); } break; case ZabHeader.STARTREALTEST: if (!zabMembers.contains(local_addr)) return up_prot.up(new Event(Event.MSG, msg)); break; case ZabHeader.RESPONSE: handleOrderingResponse(hdr); } return null; case Event.VIEW_CHANGE: handleViewChange((View) evt.getArg()); break; } return up_prot.up(evt); } public void up(MessageBatch batch) { for (Message msg : batch) { if (msg.isFlagSet(Message.Flag.NO_TOTAL_ORDER) || msg.isFlagSet(Message.Flag.OOB) || msg.getHeader(id) == null) continue; batch.remove(msg); try { up(new Event(Event.MSG, msg)); } catch (Throwable t) { log.error("failed passing up message", t); } } if (!batch.isEmpty()) up_prot.up(batch); } /* * --------------------------------- Private Methods * -------------------------------- */ /* * Handling all client requests, processing them according to request type */ private synchronized void handleClientRequest(Message message) { ZabHeader clientHeader = ((ZabHeader) message.getHeader(this.id)); if (clientHeader != null && clientHeader.getType() == ZabHeader.START_SENDING) { for (Address client : view.getMembers()) { if (log.isDebugEnabled()) if (!zabMembers.contains(client)) { if (log.isDebugEnabled()) log.info("Address to check is not zab Members, will send start request to" + client + " " + getCurrentTimeStamp()); message.setDest(client); down_prot.down(new Event(Event.MSG, message)); } } } else if (clientHeader != null && clientHeader.getType() == ZabHeader.RESET) { for (Address server : zabMembers) { // message.setDest(server); Message resetMessage = new Message(server).putHeader(this.id, clientHeader); resetMessage.setSrc(local_addr); down_prot.down(new Event(Event.MSG, resetMessage)); } } else if (clientHeader != null && clientHeader.getType() == ZabHeader.STATS) { for (Address server : zabMembers) { Message statsMessage = new Message(server).putHeader(this.id, clientHeader); down_prot.down(new Event(Event.MSG, statsMessage)); } } else if (clientHeader != null && clientHeader.getType() == ZabHeader.CLIENTFINISHED) { for (Address server : zabMembers) { Message countMessages = new Message(server).putHeader( this.id, clientHeader); down_prot.down(new Event(Event.MSG, countMessages)); } } else if (!clientHeader.getMessageId().equals(null) && clientHeader.getType() == ZabHeader.REQUEST) { Address destination = null; messageStore.put(clientHeader.getMessageId(), message); ZabHeader hdrReq = new ZabHeader(ZabHeader.REQUEST, clientHeader.getMessageId()); ++index; if (index > 2) index = 0; destination = zabMembers.get(index); Message requestMessage = new Message(destination).putHeader( this.id, hdrReq); // int diff = 1000 - hdrReq.size(); // if (diff > 0) // requestMessage.setBuffer(new byte[diff]); down_prot.down(new Event(Event.MSG, requestMessage)); } else if (!clientHeader.getMessageId().equals(null) && clientHeader.getType() == ZabHeader.SENDMYADDRESS) { Address destination = null; destination = zabMembers.get(0); // destination = zabMembers.get(0); log.info("ZabMemberSize = " + zabMembers.size()); for (Address server : zabMembers) { log.info("server address = " + server); message.dest(server); message.src(message.getSrc()); down_prot.down(new Event(Event.MSG, message)); } } } private void handleViewChange(View v) { List<Address> mbrs = v.getMembers(); leader = mbrs.get(0); if (leader.equals(local_addr)) { is_leader = true; } // make the first three joined server as ZK servers if (mbrs.size() == 3) { zabMembers.addAll(v.getMembers()); if (zabMembers.contains(local_addr)) { log.info("(going to executor2, handleViewChange "); executor2 = Executors.newSingleThreadExecutor(); executor2.execute(new MessageHandler()); } } if (mbrs.size() > 3 && zabMembers.isEmpty()) { for (int i = 0; i < 3; i++) { zabMembers.add(mbrs.get(i)); } } if (mbrs.isEmpty()) return; if (view == null || view.compareTo(v) < 0) view = v; else return; } private long getNewZxid() { return zxid.incrementAndGet(); } /* * If this server is a leader put the request in queue for processing it. * otherwise forwards request to the leader */ private synchronized void forwardToLeader(Message msg) { ZabHeader hdrReq = (ZabHeader) msg.getHeader(this.id); requestQueue.add(hdrReq.getMessageId()); if (!stats.isWarmup() && is_leader && !startThroughput) { startThroughput = true; stats.setStartThroughputTime(System.currentTimeMillis()); //log.info("requestQueue size ="+requestQueue.size()); } if (is_leader) { if (!stats.isWarmup()) { long stp = System.nanoTime(); //log.info("stl="+stp+" For req id="+hdrReq.getMessageId()); //log.info("requestQueue size ="+requestQueue.size()); //hdrReq.getMessageId().setStartLToFP(stp); hdrReq.getMessageId().setStartTime(stp); //stats.addLatencyProposalForwardST(hdrReq.getMessageId(), //System.nanoTime()); } queuedMessages.add(hdrReq); } else { if (!stats.isWarmup()) { long stf = System.nanoTime(); //log.info("stl="+stf+" For req id="+hdrReq.getMessageId()); // hdrReq.getMessageId().setStartFToLFOneWay(stf); hdrReq.getMessageId().setStartTime(stf); } forward(msg); } } /* * Forward request to the leader */ private void forward(Message msg) { Address target = leader; if (target == null) return; ZabHeader hdrReq = (ZabHeader) msg.getHeader(this.id); try { ZabHeader hdr = new ZabHeader(ZabHeader.FORWARD, hdrReq.getMessageId()); Message forward_msg = new Message(target).putHeader(this.id, hdr); down_prot.down(new Event(Event.MSG, forward_msg)); } catch (Exception ex) { log.error("failed forwarding message to " + msg, ex); } } /* * This method is invoked by follower. Follower receives a proposal. This * method generates ACK message and send it to the leader. */ private void sendACK(Message msg, ZabHeader hdrAck) { if (!stats.isWarmup()) { stats.incNumRequest(); } if (msg == null) return; if (hdrAck == null) return; lastZxidProposed = hdrAck.getZxid(); queuedProposalMessage.put(hdrAck.getZxid(), hdrAck); ZabHeader hdrACK = new ZabHeader(ZabHeader.ACK, hdrAck.getZxid(), hdrAck.getMessageId()); Message ACKMessage = new Message(leader).putHeader(this.id, hdrACK); if (!stats.isWarmup()) { countMessageFollower++; stats.incCountMessageFollower(); // if (requestQueue.contains(hdrAck.getMessageId())) { // long stf = hdrAck.getMessageId().getStartFToLFOneWay(); // stats.addLatencyFToLF((int) (System.nanoTime() - stf)); // log.info("Latency for forward fro zxid=" + dZxid + // " start time=" + stf + " End Time=" + etf + // " latency = "+((etf - stf)/1000000)); //} } try { down_prot.down(new Event(Event.MSG, ACKMessage)); } catch (Exception ex) { log.error("failed sending ACK message to Leader"); } } /* * This method is invoked by leader. It receives ACK message from a follower * and check if a majority is reached for particular proposal. */ private synchronized void processACK(Message msgACK, Address sender) { ZabHeader hdr = (ZabHeader) msgACK.getHeader(this.id); long ackZxid = hdr.getZxid(); if (lastZxidCommitted >= ackZxid) { return; } Proposal p = outstandingProposals.get(ackZxid); if (p == null) { return; } p.AckCount++; if (isQuorum(p.getAckCount())) { //if (ackZxid == lastZxidCommitted + 1) { outstandingProposals.remove(ackZxid); //if (!stats.isWarmup() && requestQueue.contains(hdr.getMessageId())) { //long stf = hdr.getMessageId().getStartLToFP(); // log.info("Latency for Prposal for zxid=" + ackZxid + // " start time=" + stf + " End Time=" + etf + // " latency = "+((etf - stf)/1000000)); //stats.addLatencyLToFP((int) (System.nanoTime() - stf)); //} commit(ackZxid); // } else // System.out.println(">>> Can't commit >>>>>>>>>"); } } /* * This method is invoked by leader. It sends COMMIT message to all follower * and itself. */ private void commit(long zxidd) { // ZABHeader hdrOrg = queuedProposalMessage.get(zxidd); if (zxidd != lastZxidCommitted + 1) { if (log.isDebugEnabled()){ log.debug("delivering Zxid out of order "+zxidd + " should be " + lastZxidCommitted + 1); } } synchronized (this) { lastZxidCommitted = zxidd; } ZabHeader hdrCommit = new ZabHeader(ZabHeader.COMMIT, zxidd); Message commitMessage = new Message().putHeader(this.id, hdrCommit); for (Address address : zabMembers) { if (!address.equals(leader) && !stats.isWarmup()) { countMessageLeader.incrementAndGet(); stats.incCountMessageLeader(); } Message cpy = commitMessage.copy(); cpy.setDest(address); down_prot.down(new Event(Event.MSG, cpy)); } // if (hdrOrg == null) { // log.info("??????????????????????????? Header is null (commit)" // + hdrOrg + " for zxid " + zxidd); // return; // } } /* * Deliver the proposal locally and if the current server is the receiver of * the request, replay to the client. */ private void deliver(long dZxid) { ZabHeader hdrOrginal = queuedProposalMessage.remove(dZxid); // if (hdrOrginal == null) { // if (log.isInfoEnabled()) // log.info("$$$$$$$$$$$$$$$$$$$$$ Header is null (deliver)" // + hdrOrginal + " for zxid " + dZxid); // return; // } queuedCommitMessage.put(dZxid, hdrOrginal); if (!stats.isWarmup()) { stats.incnumReqDelivered(); stats.setEndThroughputTime(System.currentTimeMillis()); } //if (log.isInfoEnabled()) //log.info("queuedCommitMessage size = " + queuedCommitMessage.size() // + " zxid " + dZxid); if(hdrOrginal==null) log.info("****hdrOrginal is null ****"); if (requestQueue.contains(hdrOrginal.getMessageId())) { if (!stats.isWarmup()) { long startTime = hdrOrginal.getMessageId().getStartTime(); long endTime = System.nanoTime(); // log.info("deliver st="+startTime+" For req id="+hdrOrginal.getMessageId()); // log.info("deliver et="+endTime+" For req id="+hdrOrginal.getMessageId()); // log.info("deliver latency="+( (endTime-startTime))+" For req id="+hdrOrginal.getMessageId()); // log.info("deliver latency="+( (int) (endTime-startTime))+" For req id="+hdrOrginal.getMessageId()); // latency= endTime - startTime; // if(latency<0){ // log.info("deliver st="+startTime+" For req id="+hdrOrginal.getMessageId()); // log.info("deliver et="+endTime+" For req id="+hdrOrginal.getMessageId()); // } stats.addLatency((endTime - startTime)); //stats.addKVLatencies(((System.currentTimeMillis()-stats.getStartThroughputTime())), (endTime - startTime)); } ZabHeader hdrResponse = new ZabHeader(ZabHeader.RESPONSE, dZxid, hdrOrginal.getMessageId()); Message msgResponse = new Message(hdrOrginal.getMessageId() .getOriginator()).putHeader(this.id, hdrResponse); down_prot.down(new Event(Event.MSG, msgResponse)); requestQueue.remove(hdrOrginal.getMessageId()); } } /* * Send replay to client */ private void handleOrderingResponse(ZabHeader hdrResponse) { Message message = messageStore.get(hdrResponse.getMessageId()); message.putHeader(this.id, hdrResponse); up_prot.up(new Event(Event.MSG, message)); messageStore.remove(hdrResponse.getMessageId()); } /* * Check a majority */ private boolean isQuorum(int majority) { return majority >= ((zabMembers.size() / 2) + 1) ? true : false; } private String getCurrentTimeStamp() { long timestamp = new Date().getTime(); cal.setTimeInMillis(timestamp); String timeString = new SimpleDateFormat("HH:mm:ss:SSS").format(cal .getTime()); return timeString; } private synchronized void addTotalABMssages(ZabHeader carryCountMessageLeader) { long followerMsg = carryCountMessageLeader.getZxid(); stats.addCountTotalMessagesFollowers((int) followerMsg); numABRecieved++; if(numABRecieved==zabMembers.size()-1){ ZabHeader headertStats = new ZabHeader(ZabHeader.STATS); for (Address zabServer:zabMembers){ Message messageStats = new Message(zabServer).putHeader(this.id, headertStats); down_prot.down(new Event(Event.MSG, messageStats)); } } } private void sendMyTotalBroadcast(){ ZabHeader followerMsgCount = new ZabHeader( ZabHeader.COUNTMESSAGE, countMessageFollower); Message requestMessage = new Message(leader).putHeader(this.id, followerMsgCount); down_prot.down(new Event(Event.MSG, requestMessage)); } /* * ----------------------------- End of Private Methods * -------------------------------- */ final class FollowerMessageHandler implements Runnable { private short id; public FollowerMessageHandler(short id) { this.id = id; } /** * create a proposal and send it out to all the members * * @param message */ @Override public void run() { handleRequests(); } public void handleRequests() { ZabHeader hdrReq = null; while (running) { try { hdrReq = queuedMessages.take(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } long new_zxid = getNewZxid(); if (!stats.isWarmup()) { stats.incNumRequest(); } ZabHeader hdrProposal = new ZabHeader(ZabHeader.PROPOSAL, new_zxid, hdrReq.getMessageId()); Message ProposalMessage = new Message().putHeader(this.id, hdrProposal); ProposalMessage.setSrc(local_addr); Proposal p = new Proposal(); p.setMessageId(hdrReq.getMessageId()); p.AckCount++; outstandingProposals.put(new_zxid, p); queuedProposalMessage.put(new_zxid, hdrProposal); // if (!stats.isWarmup()) { // Long st = stats.getLatencyProposalST(hdrReq.getMessageId()); // if (st != null) { // stats.removeLatencyProposalST(hdrReq.getMessageId()); // stats.addLatencyProp((int) (System.nanoTime() - st)); // } else { // Long stL = stats.getLatencyProposalForwardST(hdrReq // .getMessageId()); // if (stL != null) { // stats.removeLatencyProposalForwardST(hdrReq // .getMessageId()); // stats.addLatencyPropForward((int) (System // .nanoTime() - stL)); // } // } // } try { for (Address address : zabMembers) { if (address.equals(leader)) continue; if (!stats.isWarmup()) { countMessageLeader.incrementAndGet(); stats.incCountMessageLeader(); } Message cpy = ProposalMessage.copy(); cpy.setDest(address); down_prot.down(new Event(Event.MSG, cpy)); } } catch (Exception ex) { log.error("failed proposing message to members"); } } } } final class MessageHandler implements Runnable { @Override public void run() { //if(is_leader) log.info("call deliverMessages()"); deliverMessages(); } private void deliverMessages() { ZabHeader hdrDelivery= null; while (true) { try { hdrDelivery = delivery.take(); //log.info("(deliverMessages) deliver zxid = "+ hdrDelivery.getZxid()); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } //log.info("(going to call deliver zxid = "+ hdrDelivery.getZxid()); deliver(hdrDelivery.getZxid()); } } } class Throughput extends TimerTask { public Throughput() { } private long startTime = 0; private long currentTime = 0; private double currentThroughput = 0; private int finishedThroughput = 0; @Override public void run() { //if (running){ startTime = stats.getLastThroughputTime(); currentTime = System.currentTimeMillis(); finishedThroughput=stats.getnumReqDelivered(); //log.info("Start Time="+startTime); //log.info("currentTime Time="+currentTime); //elpasedThroughputTimeInSecond = (int) (TimeUnit.MILLISECONDS //.toSeconds(currentThroughput - startTime)); //log.info("elpasedThroughputTimeInSecond Time="+elpasedThroughputTimeInSecond); //log.info("finishedThroughput="+finishedThroughput); //log.info("stats.getLastNumReqDeliveredBefore()="+stats //.getLastNumReqDeliveredBefore()); currentThroughput = (((double)finishedThroughput - stats .getLastNumReqDeliveredBefore()) / ((double)(currentTime - startTime)/1000.0)); stats.setLastNumReqDeliveredBefore(finishedThroughput); stats.setLastThroughputTime(currentTime); stats.addThroughput(convertLongToTimeFormat(currentTime), currentThroughput); //} } public String convertLongToTimeFormat(long time) { Date date = new Date(time); SimpleDateFormat longToTime = new SimpleDateFormat("HH:mm:ss.SSSZ"); return longToTime.format(date); } } }
{ "content_hash": "4c3d390539569b9022b335524c8f5a3e", "timestamp": "", "source": "github", "line_count": 828, "max_line_length": 118, "avg_line_length": 30.404589371980677, "alnum_prop": 0.6490963257199602, "repo_name": "ibrahimshbat/JGroups", "id": "a71e7769c7d0d2d21dba52f0989068e16f58d232", "size": "25175", "binary": false, "copies": "1", "ref": "refs/heads/Zab_4", "path": "src/org/jgroups/protocols/jzookeeper/Zab.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "3465" }, { "name": "Java", "bytes": "12917680" }, { "name": "Python", "bytes": "2267" }, { "name": "Shell", "bytes": "91017" } ] }
<?php /** * @see Zend_Paginator */ require_once 'Zend/Paginator.php'; /** * @see Zend_Paginator_ScrollingStyle_All */ require_once 'Zend/Paginator/ScrollingStyle/All.php'; /** * @see PHPUnit_Framework_TestCase */ /** * @category Zend * @package Zend_Paginator * @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_Paginator */ class Zend_Paginator_ScrollingStyle_AllTest extends PHPUnit_Framework_TestCase { /** * @var Zend_Paginator_ScrollingStyle_All */ private $_scrollingStyle = null; private $_paginator = null; /** * Prepares the environment before running a test. */ protected function setUp() { parent::setUp(); $this->_scrollingStyle = new Zend_Paginator_ScrollingStyle_All(); $this->_paginator = Zend_Paginator::factory(range(1, 101)); $this->_paginator->setItemCountPerPage(10); } /** * Cleans up the environment after running a test. */ protected function tearDown () { $this->_scrollingStyle = null; $this->_paginator = null; parent::tearDown(); } /** * Tests Zend_Paginator_ScrollingStyle_All->getPages() */ public function testGetsPages() { $expected = array_combine(range(1, 11), range(1, 11)); $pages = $this->_scrollingStyle->getPages($this->_paginator); $this->assertEquals($expected, $pages); } public function testGetsNextAndPreviousPageForFirstPage() { $this->_paginator->setCurrentPageNumber(1); $pages = $this->_paginator->getPages('All'); $this->assertEquals(2, $pages->next); } public function testGetsNextAndPreviousPageForSecondPage() { $this->_paginator->setCurrentPageNumber(2); $pages = $this->_paginator->getPages('All'); $this->assertEquals(1, $pages->previous); $this->assertEquals(3, $pages->next); } public function testGetsNextAndPreviousPageForMiddlePage() { $this->_paginator->setCurrentPageNumber(6); $pages = $this->_paginator->getPages('All'); $this->assertEquals(5, $pages->previous); $this->assertEquals(7, $pages->next); } public function testGetsNextAndPreviousPageForSecondLastPage() { $this->_paginator->setCurrentPageNumber(10); $pages = $this->_paginator->getPages('All'); $this->assertEquals(9, $pages->previous); $this->assertEquals(11, $pages->next); } public function testGetsNextAndPreviousPageForLastPage() { $this->_paginator->setCurrentPageNumber(11); $pages = $this->_paginator->getPages('All'); $this->assertEquals(10, $pages->previous); } }
{ "content_hash": "041a51dd724cc0766814a21d2cd42786", "timestamp": "", "source": "github", "line_count": 102, "max_line_length": 87, "avg_line_length": 28.127450980392158, "alnum_prop": 0.6249564308121297, "repo_name": "sandsmedia/zf", "id": "c35018380576d125c325b20533bfe493037977b2", "size": "3589", "binary": false, "copies": "6", "ref": "refs/heads/trunk", "path": "tests/Zend/Paginator/ScrollingStyle/AllTest.php", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "JavaScript", "bytes": "30072" }, { "name": "PHP", "bytes": "30457193" }, { "name": "Shell", "bytes": "6541" } ] }
interface JQuery { dynatree(options?: DynatreeOptions): DynaTree; dynatree(option?: string, ...rest: any[]): any; } interface JQueryStatic { ui: { dynatree: DynatreeNamespace; }; } interface DynaTree { activateKey(key: string): DynaTreeNode; count(): number; enable(): void; disable(): void; enableUpdate(enable: boolean): void; getActiveNode(): DynaTreeNode; getNodeByKey(key: string): DynaTreeNode; getPersistData(): any; getRoot(): DynaTreeNode; getSelectedNodes(stopOnParents: boolean): DynaTreeNode[]; initialize(): void; isInitializing(): boolean; isReloading(): boolean; isUserEvent(): boolean; loadKeyPath(keyPath: string, callback: (node: DynaTreeNode, status: string) =>void ): void; reactivate(setFocus: boolean): void; redraw(): void; reload(): void; renderInvisibleNodes(): void; selectKey(key: string, flag: string): DynaTreeNode; serializeArray(stopOnParents: boolean): any[]; toDict(): any; visit(fn: (node: DynaTreeNode) =>boolean, includeRoot: boolean): void; } interface DynaTreeNode { data: DynaTreeDataModel; activate(): void; activateSilently(): void; addChild(nodeData: DynaTreeDataModel, beforeNode?: DynaTreeNode): void; addChild(nodeData: DynaTreeDataModel[], beforeNode?: DynaTreeNode): void; appendAjax(ajaxOptions: JQueryAjaxSettings): void; countChildren(): number; deactivate(): void; expand(flag: string): void; focus(): void; getChildren(): DynaTreeNode[]; getEventTargetType(event: Event): string; getLevel(): number; getNextSibling(): DynaTreeNode; getParent(): DynaTreeNode; getPrevSibling(): DynaTreeNode; hasChildren(): boolean; isActive(): boolean; isChildOf(otherNode: DynaTreeNode): boolean; isDescendantOf(otherNode: DynaTreeNode): boolean; isExpanded(): boolean; isFirstSibling(): boolean; isFocused(): boolean; isLastSibling(): boolean; isLazy(): boolean; isLoading(): boolean; isSelected(): boolean; isStatusNode(): boolean; isVisible(): boolean; makeVisible(): boolean; move(targetNode: DynaTreeNode, mode: string): boolean; reload(force: boolean): void; remove(): void; removeChildren(): void; render(useEffects: boolean, includeInvisible: boolean): void; resetLazy(): void; scheduleAction(mode: string, ms: number); select(flag: string): void; setLazyNodeStatus(status: number): void; setTitle(title: string): void; sortChildren(cmp?: (a: DynaTreeNode, b: DynaTreeNode) =>number, deep?: boolean); toDict(recursive: boolean, callback?: (node: any) =>any): any; toggleExpand(): void; toggleSelect(): void; visit(fn: (node: DynaTreeNode) =>boolean, includeSelf: boolean): void; visitParents(fn: (node: DynaTreeNode) =>boolean, includeSelf: boolean): void; } interface DynatreeOptions { title?: string; // Tree's name (only used for debug outpu) minExpandLevel?: number; // 1: root node is not collapsible imagePath?: string; // Path to a folder containing icons. Defaults to 'skin/' subdirectory. children?: DynaTreeDataModel[]; // Init tree structure from this object array. initId?: string; // Init tree structure from a <ul> element with this ID. initAjax?: JQueryAjaxSettings; // Ajax options used to initialize the tree strucuture. autoFocus?: boolean; // Set focus to first child, when expanding or lazy-loading. keyboard?: boolean; // Support keyboard navigation. persist?: boolean; // Persist expand-status to a cookie autoCollapse?: boolean; // Automatically collapse all siblings, when a node is expanded. clickFolderMode?: number; // 1:activate, 2:expand, 3:activate and expand activeVisible?: boolean; // Make sure, active nodes are visible (expanded). checkbox?: boolean; // Show checkboxes. selectMode?: number; // 1:single, 2:multi, 3:multi-hier fx?: any; // Animations, e.g. null or { height: "toggle", duration: 200 } noLink?: boolean; // Use <span> instead of <a> tags for all nodes debugLevel?: number; // 0:quiet, 1:normal, 2:debug generateIds?: boolean; // Generate id attributes like <span id='dynatree-id-KEY'> idPrefix?: string; // Used to generate node id's like <span id="dynatree-id-<key>">. keyPathSeparator?: string; // Used by node.getKeyPath() and tree.loadKeyPath(). cookieId?: string; // Choose a more unique name, to allow multiple trees. dnd?: DynaTreeDNDOptions; // Drag'n'drop support ajaxDefaults?: DynaTreeAjaxOptions;// Used by initAjax option strings?: DynaTreeStringsOptions; cookie?: DynaTreeCookieOptions; // Class names used, when rendering the HTML markup. // Note: if only single entries are passed for options.classNames, all other // values are still set to default. classNames?: DynatreeClassNamesOptions; // Low level event handlers: onEvent(dtnode, event): return false, to stop default processing onClick?: (dtnode: DynaTreeNode, event: Event) =>boolean; // null: generate focus, expand, activate, select events. onDblClick?: (dtnode: DynaTreeNode, event: Event) =>boolean; // (No default actions.) onKeydown?: (dtnode: DynaTreeNode, event: Event) =>boolean; // null: generate keyboard navigation (focus, expand, activate). onKeypress?: (dtnode: DynaTreeNode, event: Event) =>boolean; // (No default actions.) onFocus?: (dtnode: DynaTreeNode, event: Event) =>boolean; // null: set focus to node. onBlur?: (dtnode: DynaTreeNode, event: Event) =>boolean; // null: remove focus from node. // Pre-event handlers onQueryEvent(flag, dtnode): return false, to stop processing onQueryActivate?: (flag: string, dtnode: DynaTreeNode) =>void; // Callback(flag, dtnode) before a node is (de)activated. onQuerySelect?: (flag: string, dtnode: DynaTreeNode) =>void;// Callback(flag, dtnode) before a node is (de)selected. onQueryExpand?: (flag: string, dtnode: DynaTreeNode) =>void;// Callback(flag, dtnode) before a node is expanded/collpsed. // High level event handlers onPostInit?: (isReloading: boolean, isError: boolean) =>void;// Callback(isReloading, isError) when tree was (re)loaded. onActivate?: (dtnode: DynaTreeNode) =>void; // Callback(dtnode) when a node is activated. onDeactivate?: (dtnode: DynaTreeNode) =>void; // Callback(dtnode) when a node is deactivated. onSelect?: (flag: string, dtnode: DynaTreeNode) =>void; // Callback(flag, dtnode) when a node is (de)selected. onExpand?: (flag: string, dtnode: DynaTreeNode) =>void; // Callback(flag, dtnode) when a node is expanded/collapsed. onLazyRead?: (dtnode: DynaTreeNode) =>void; // Callback(dtnode) when a lazy node is expanded for the first time. onCustomRender?: (dtnode: DynaTreeNode) =>void; // Callback(dtnode) before a node is rendered. Return a HTML string to override. onCreate?: (dtnode: DynaTreeNode, nodeSpan: any) =>void; // Callback(dtnode, nodeSpan) after a node was rendered for the first time. onRender?: (dtnode: DynaTreeNode, nodeSpan: any) =>void; // Callback(dtnode, nodeSpan) after a node was rendered. postProcess?: (data: any, dataType: any) =>void; // Callback(data, dataType) before an Ajax result is passed to dynatree. } interface DynaTreeDataModel { title: string; // (required) Displayed name of the node (html is allowed here) key?: string; // May be used with activate(), select(), find(), ... isFolder?: boolean; // Use a folder icon. Also the node is expandable but not selectable. isLazy?: boolean; // Call onLazyRead(), when the node is expanded for the first time to allow for delayed creation of children. tooltip?: string; // Show this popup text. href?: string; // Added to the generated <a> tag. icon?: string; // Use a custom image (filename relative to tree.options.imagePath). 'null' for default icon, 'false' for no icon. addClass?: string; // Class name added to the node's span tag. noLink?: boolean; // Use <span> instead of <a> tag for this node activate?: boolean; // Initial active status. focus?: boolean; // Initial focused status. expand?: boolean; // Initial expanded status. select?: boolean; // Initial selected status. hideCheckbox?: boolean; // Suppress checkbox display for this node. unselectable?: boolean; // Prevent selection. // The following attributes are only valid if passed to some functions: children?: DynaTreeDataModel[]; // Array of child nodes. // NOTE: we can also add custom attributes here. // This may then also be used in the onActivate(), onSelect() or onLazyTree() callbacks. } interface DynaTreeDNDOptions { autoExpandMS?: number; // Expand nodes after n milliseconds of hovering. preventVoidMoves?: boolean; // Prevent dropping nodes 'before self', etc. // Make tree nodes draggable: onDragStart?: (sourceNode: any) =>void; // Callback(sourceNode), return true, to enable dnd onDragStop?: (sourceNode: any) =>void; // Callback(sourceNode) // Make tree nodes accept draggables onDragEnter?: (targetNode: any, sourceNode: any) =>void; // Callback(targetNode, sourceNode) onDragOver?: (targetNode: any, sourceNode: any, hitMode: string) =>void; // Callback(targetNode, sourceNode, hitMode) onDrop?: (targetNode: any, sourceNode: any, hitMode: string) =>void; // Callback(targetNode, sourceNode, hitMode) onDragLeave?: (targetNode: any, sourceNode: any) =>void; // Callback(targetNode, sourceNode) } interface DynaTreeCookieOptions { expires: any; } interface DynaTreeStringsOptions { loading?: string; loadError?: string; } interface DynaTreeAjaxOptions { cache?: boolean; // false: Append random '_' argument to the request url to prevent caching. timeout?: number; // >0: Make sure we get an ajax error for invalid URLs dataType?: string; // Expect json format and pass json object to callbacks. } interface DynatreeClassNamesOptions { container?: string; node?: string; folder?: string; empty?: string; vline?: string; expander?: string; connector?: string; checkbox?: string; nodeIcon?: string; title?: string; noConnector?: string; nodeError?: string; nodeWait?: string; hidden?: string; combinedExpanderPrefix?: string; combinedIconPrefix?: string; hasChildren?: string; active?: string; selected?: string; expanded?: string; lazy?: string; focused?: string; partsel?: string; lastsib?: string; } interface DynatreeNamespace { getNode(element: HTMLElement): DynaTreeNode; getPersistData(cookieId: string, cookieOpts: DynaTreeCookieOptions): any; version: number; }
{ "content_hash": "b98467e8f55ce583f1aee8fc3c1a026d", "timestamp": "", "source": "github", "line_count": 234, "max_line_length": 136, "avg_line_length": 46.08119658119658, "alnum_prop": 0.6934990262450152, "repo_name": "uguy/hawtio", "id": "ec65723c783419f1b0e17313e9b0eeaed3cf9b02", "size": "10990", "binary": false, "copies": "15", "ref": "refs/heads/master", "path": "hawtio-web/src/main/d.ts/jquery.dynatree-1.2.d.ts", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ApacheConf", "bytes": "26" }, { "name": "CSS", "bytes": "659103" }, { "name": "HTML", "bytes": "664431" }, { "name": "Java", "bytes": "931943" }, { "name": "JavaScript", "bytes": "3828234" }, { "name": "Scala", "bytes": "5228" }, { "name": "Shell", "bytes": "1997" }, { "name": "TypeScript", "bytes": "2082240" } ] }
"""This file contains tests for drawing helpers""" import sys import unittest if sys.version_info[0] >= 3: import unittest.mock as mock from unittest.mock import PropertyMock, patch else: import mock from mock import PropertyMock, patch if "core" not in sys.path[0]: sys.path.insert(0, 'core') from simulation import Intersection, IntersectionProperties, RoadSizeVector from drawing.drawing_helpers import draw_car_by_value, draw_car from drawing.maps import create_map_painter def get_intersection_with_road(): road = [RoadSizeVector(10, 5, 5), RoadSizeVector(10, 5, 5), RoadSizeVector(10, 5, 5), RoadSizeVector(10, 5, 5)] properties = IntersectionProperties(road) return Intersection(properties), road class MockingTestTestCase(unittest.TestCase): @patch('drawing.drawing_helpers.draw_car') def test_mock_stubs(self, draw_car): draw_car_by_value(None, 1, -1) draw_car_by_value(None, 2, 0) draw_car_by_value(None, 3, 1) draw_car_by_value(None, 4, 2) draw_car_by_value(None, 5, 3) draw_car_by_value(None, 6, 4) calls = draw_car.mock_calls assert len(calls) == 6 draw_car.assert_any_call(None, 1, (255, 255, 255)) draw_car.assert_any_call(None, 2, (200, 0, 0)) draw_car.assert_any_call(None, 3, (0, 200, 0)) draw_car.assert_any_call(None, 4, (0, 0, 200)) draw_car.assert_any_call(None, 5, (255, 0, 114)) draw_car.assert_any_call(None, 6, (0, 0, 0)) def test_create_map_painter(): intersection, road = get_intersection_with_road() #create_map_painter(intersection, road)
{ "content_hash": "305712afe271c5f3be7537842ee3a844", "timestamp": "", "source": "github", "line_count": 46, "max_line_length": 115, "avg_line_length": 35.58695652173913, "alnum_prop": 0.662797800855223, "repo_name": "DrimTim32/py_proj_lights", "id": "3ea2ed77c05f3efed63f45ab988c30ca86165aa2", "size": "1637", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "tests/test_drawing.py", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "1143" }, { "name": "PowerShell", "bytes": "3085" }, { "name": "Python", "bytes": "126124" } ] }
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE23_Relative_Path_Traversal__wchar_t_environment_ifstream_73b.cpp Label Definition File: CWE23_Relative_Path_Traversal.label.xml Template File: sources-sink-73b.tmpl.cpp */ /* * @description * CWE: 23 Relative Path Traversal * BadSource: environment Read input from an environment variable * GoodSource: Use a fixed file name * Sinks: ifstream * BadSink : Open the file named in data using ifstream::open() * Flow Variant: 73 Data flow: data passed in a list from one function to another in different source files * * */ #include "std_testcase.h" #include <list> #ifdef _WIN32 #define BASEPATH L"c:\\temp\\" #else #include <wchar.h> #define BASEPATH L"/tmp/" #endif #include <fstream> using namespace std; using namespace std; namespace CWE23_Relative_Path_Traversal__wchar_t_environment_ifstream_73 { #ifndef OMITBAD void badSink(list<wchar_t *> dataList) { /* copy data out of dataList */ wchar_t * data = dataList.back(); { ifstream inputFile; /* POTENTIAL FLAW: Possibly opening a file without validating the file name or path */ inputFile.open((char *)data); inputFile.close(); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ void goodG2BSink(list<wchar_t *> dataList) { wchar_t * data = dataList.back(); { ifstream inputFile; /* POTENTIAL FLAW: Possibly opening a file without validating the file name or path */ inputFile.open((char *)data); inputFile.close(); } } #endif /* OMITGOOD */ } /* close namespace */
{ "content_hash": "b10eca66a738fbdf0884cff67bbe1ec3", "timestamp": "", "source": "github", "line_count": 67, "max_line_length": 107, "avg_line_length": 25.28358208955224, "alnum_prop": 0.6611570247933884, "repo_name": "JianpingZeng/xcc", "id": "126bbf7cf0496bbb11eaf938aa9786a33e06105d", "size": "1694", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "xcc/test/juliet/testcases/CWE23_Relative_Path_Traversal/s04/CWE23_Relative_Path_Traversal__wchar_t_environment_ifstream_73b.cpp", "mode": "33188", "license": "bsd-3-clause", "language": [] }
require('./angular'); module.exports = angular; function onDeviceReady(){ var map = new GoogleMap(); map.initialize(); }
{ "content_hash": "89723048d46bc1ccd443b63c65341c1f", "timestamp": "", "source": "github", "line_count": 7, "max_line_length": 30, "avg_line_length": 18.571428571428573, "alnum_prop": 0.6615384615384615, "repo_name": "pablolmnora/helpthecity", "id": "c86c1364a6d876bb089b28d19fa1523218f05f9d", "size": "130", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "mobile/www/lib/angular/index.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ApacheConf", "bytes": "24139" }, { "name": "CSS", "bytes": "707462" }, { "name": "CoffeeScript", "bytes": "31516" }, { "name": "HTML", "bytes": "34529" }, { "name": "JavaScript", "bytes": "3734057" }, { "name": "Shell", "bytes": "329" } ] }
<?php // These constants may be changed without breaking existing hashes. define("PBKDF2_HASH_ALGORITHM", "sha256"); define("PBKDF2_ITERATIONS", 1000); define("PBKDF2_SALT_BYTE_SIZE", 24); define("PBKDF2_HASH_BYTE_SIZE", 24); define("HASH_SECTIONS", 4); define("HASH_ALGORITHM_INDEX", 0); define("HASH_ITERATION_INDEX", 1); define("HASH_SALT_INDEX", 2); define("HASH_PBKDF2_INDEX", 3); function create_hash($password) { // format: algorithm:iterations:salt:hash $salt = base64_encode(mcrypt_create_iv(PBKDF2_SALT_BYTE_SIZE, MCRYPT_DEV_URANDOM)); return PBKDF2_HASH_ALGORITHM . ":" . PBKDF2_ITERATIONS . ":" . $salt . ":" . base64_encode(pbkdf2( PBKDF2_HASH_ALGORITHM, $password, $salt, PBKDF2_ITERATIONS, PBKDF2_HASH_BYTE_SIZE, true )); } function validate_password($password, $correct_hash) { $params = explode(":", $correct_hash); if(count($params) < HASH_SECTIONS) return false; $pbkdf2 = base64_decode($params[HASH_PBKDF2_INDEX]); return slow_equals( $pbkdf2, pbkdf2( $params[HASH_ALGORITHM_INDEX], $password, $params[HASH_SALT_INDEX], (int)$params[HASH_ITERATION_INDEX], strlen($pbkdf2), true ) ); } // Compares two strings $a and $b in length-constant time. function slow_equals($a, $b) { $diff = strlen($a) ^ strlen($b); for($i = 0; $i < strlen($a) && $i < strlen($b); $i++) { $diff |= ord($a[$i]) ^ ord($b[$i]); } return $diff === 0; } /* * PBKDF2 key derivation function as defined by RSA's PKCS #5: https://www.ietf.org/rfc/rfc2898.txt * $algorithm - The hash algorithm to use. Recommended: SHA256 * $password - The password. * $salt - A salt that is unique to the password. * $count - Iteration count. Higher is better, but slower. Recommended: At least 1000. * $key_length - The length of the derived key in bytes. * $raw_output - If true, the key is returned in raw binary format. Hex encoded otherwise. * Returns: A $key_length-byte key derived from the password and salt. * * Test vectors can be found here: https://www.ietf.org/rfc/rfc6070.txt * * This implementation of PBKDF2 was originally created by https://defuse.ca * With improvements by http://www.variations-of-shadow.com */ function pbkdf2($algorithm, $password, $salt, $count, $key_length, $raw_output = false) { $algorithm = strtolower($algorithm); if(!in_array($algorithm, hash_algos(), true)) trigger_error('PBKDF2 ERROR: Invalid hash algorithm.', E_USER_ERROR); if($count <= 0 || $key_length <= 0) trigger_error('PBKDF2 ERROR: Invalid parameters.', E_USER_ERROR); if (function_exists("hash_pbkdf2")) { // The output length is in NIBBLES (4-bits) if $raw_output is false! if (!$raw_output) { $key_length = $key_length * 2; } return hash_pbkdf2($algorithm, $password, $salt, $count, $key_length, $raw_output); } $hash_length = strlen(hash($algorithm, "", true)); $block_count = ceil($key_length / $hash_length); $output = ""; for($i = 1; $i <= $block_count; $i++) { // $i encoded as 4 bytes, big endian. $last = $salt . pack("N", $i); // first iteration $last = $xorsum = hash_hmac($algorithm, $last, $password, true); // perform the other $count - 1 iterations for ($j = 1; $j < $count; $j++) { $xorsum ^= ($last = hash_hmac($algorithm, $last, $password, true)); } $output .= $xorsum; } if($raw_output) return substr($output, 0, $key_length); else return bin2hex(substr($output, 0, $key_length)); }
{ "content_hash": "c39b9c5901f1491d34ec50865f629f76", "timestamp": "", "source": "github", "line_count": 112, "max_line_length": 99, "avg_line_length": 33.526785714285715, "alnum_prop": 0.6, "repo_name": "bign8/member-social-app", "id": "6c2a6b020989733aa4d7b7d49676780b2e4781c6", "size": "5214", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "php/secure_pass.php", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "3708" }, { "name": "JavaScript", "bytes": "10800" }, { "name": "PHP", "bytes": "73528" } ] }
dojo.provide("plugins.apps.AppRow"); dojo.declare( "plugins.apps.AppRow", [ dijit._Widget, dijit._Templated ], { //Path to the template of this widget. templatePath: dojo.moduleUrl("plugins", "apps/templates/approw.html"), // Calls dijit._Templated.widgetsInTemplate widgetsInTemplate : true, // PARENT plugins.apps.Apps WIDGET parentWidget : null, /////}}} constructor : function(args) { ////console.log("AppRow.constructor plugins.workflow.AppRow.constructor()"); ////console.log("AppRow.constructor args.submit: " + args.submit); this.checkboxOn = args.submit; this.parentWidget = args.parentWidget; this.formInputs = this.parentWidget.formInputs; }, postCreate : function() { ////////console.log("AppRow.postCreate plugins.workflow.AppRow.postCreate()"); this.startup(); }, startup : function () { //////console.log("AppRow.startup plugins.workflow.AppRow.startup()"); //////console.log("AppRow.startup this.parentWidget: " + this.parentWidget); this.inherited(arguments); // CONNECT TOGGLE EVENT var thisObject = this; dojo.connect( this.name, "onclick", function(event) { thisObject.toggle(); }); // ADD 'EDIT' ONCLICKS var thisObject = this; var array = [ "executor", "location", "description", "notes", "url" ]; for ( var i in array ) { dojo.connect(this[array[i]], "onclick", function(event) { //////console.log("AppRow.startup " + array[i] + " clicked"); thisObject.parentWidget.editRow(thisObject, event.target); event.stopPropagation(); //Stop Event Bubbling } ); } // USE this.checkboxOn TO DECIDE IF CHECKBOX IS SELECTED ////console.log("AppRow.startup this.checkboxOn: " + this.checkboxOn); if ( this.checkboxOn != null && this.checkboxOn == 1 ) { ////console.log("AppRow.startup this.checkboxOn = " + this.checkboxOn + ". Setting this.submit to On"); this.localonly.setValue("on"); } }, submitChange : function (event) { // REGISTER CHECKBOX CHANGE //console.log("AppRow.submitChange plugins.apps.AppRow.submitChange(event)"); //console.log("AppRow.submitChange event: " + event); event.stopPropagation(); //Stop Event Bubbling //console.log("AppRow.submitChange Doing inputs = this.parentWidget.getFormInputs(this)"); // GET INPUTS var inputs = this.parentWidget.getFormInputs(this); if ( inputs == null ) return; this.parentWidget.saveInputs(inputs, {reload: false}); }, // TOGGLE HIDDEN DETAILS toggle : function () { ////console.log("AppRow.toggle plugins.workflow.AppRow.toggle()"); //////console.log("AppRow.toggle this.description: " + this.description); var array = [ "executor", "packageCombo", "location", "localonlyContainer", "description", "notes", "url" ]; for ( var i in array ) { console.log("AppRow.toggle this[" + array[i] + "]: " + this[array[i]]); if ( this[array[i]].style.display == 'inline-block' ) this[array[i]].style.display='none'; else this[array[i]].style.display = 'inline-block'; } } });
{ "content_hash": "cacb471589f9aef138078cacd631a681", "timestamp": "", "source": "github", "line_count": 98, "max_line_length": 109, "avg_line_length": 31.510204081632654, "alnum_prop": 0.6531735751295337, "repo_name": "agua/agua", "id": "5fdb8e5d724369e47b4c951ec0b84ef078248c5d", "size": "3088", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "html/plugins/apps/AppRow.js", "mode": "33188", "license": "mit", "language": [ { "name": "ActionScript", "bytes": "21071" }, { "name": "C", "bytes": "929361" }, { "name": "C++", "bytes": "47947" }, { "name": "CSS", "bytes": "3453393" }, { "name": "Java", "bytes": "137781" }, { "name": "JavaScript", "bytes": "32393155" }, { "name": "Lua", "bytes": "23713" }, { "name": "PHP", "bytes": "616960" }, { "name": "Perl", "bytes": "3453598" }, { "name": "Puppet", "bytes": "4423" }, { "name": "Python", "bytes": "60419" }, { "name": "Ruby", "bytes": "1521" }, { "name": "Shell", "bytes": "44467" }, { "name": "TeX", "bytes": "4217" }, { "name": "XQuery", "bytes": "799" }, { "name": "XSLT", "bytes": "104131" } ] }
/** * Utilify functions for logging */ cordova.define("salesforce/util/logger", function(require, exports, module) { var appStartTime = (new Date()).getTime(); // Used for debug timing measurements. /** * Logs text to a given section of the page. * section - id of HTML section to log to. * txt - The text (html) to log. */ var log = function(section, txt) { console.log("jslog: " + txt); if ((typeof debugMode !== "undefined") && (debugMode === true)) { var now = new Date(); var fullTxt = "<p><i><b>* At " + (now.getTime() - appStartTime) + "ms:</b></i> " + txt + "</p>"; var sectionElt = document.getElementById(section); if (sectionElt) { sectionElt.style.display = "block"; document.getElementById(section).innerHTML += fullTxt; } } }; /** * Logs debug messages to a "debug console" section of the page. Only * shows when debugMode (above) is set to true. * txt - The text (html) to log to the console. */ var logToConsole = function(txt) { log("console", txt); }; /** * Use to log error messages to an "error console" section of the page. * txt - The text (html) to log to the console. */ var logError = function(txt) { log("errors", txt); }; /** * Sanitizes a URL for logging, based on an array of querystring parameters whose * values should be sanitized. The value of each querystring parameter, if found * in the URL, will be changed to '[redacted]'. Useful for getting rid of secure * data on the querystring, so it doesn't get persisted in an app log for instance. * * origUrl - Required - The URL to sanitize. * sanitizeParamArray - Required - An array of querystring parameters whose values * should be sanitized. * Returns: The sanitzed URL. */ var sanitizeUrlParamsForLogging = function(origUrl, sanitizeParamArray) { var trimmedOrigUrl = origUrl.trim(); if (trimmedOrigUrl === '') return trimmedOrigUrl; if ((typeof sanitizeParamArray !== "object") || (sanitizeParamArray.length === 0)) return trimmedOrigUrl; var redactedUrl = trimmedOrigUrl; for (var i = 0; i < sanitizeParamArray.length; i++) { var paramRedactRegexString = "^(.*[\\?&]" + sanitizeParamArray[i] + "=)([^&]+)(.*)$"; var paramRedactRegex = new RegExp(paramRedactRegexString, "i"); if (paramRedactRegex.test(redactedUrl)) redactedUrl = redactedUrl.replace(paramRedactRegex, "$1[redacted]$3"); } return redactedUrl; }; /** * Part of the module that is public */ module.exports = { logToConsole: logToConsole, logError: logError, sanitizeUrlParamsForLogging: sanitizeUrlParamsForLogging }; }); cordova.define("salesforce/util/event", function(require, exports, module) { var logger = require("salesforce/util/logger"); /** * Enumeration of event types. */ var EventType = { AUTHENTICATING: {code: 0, description: "Authenticating...", isError: false}, STARTING: {code: 1, description: "Loading application", isError: false}, OFFLINE: {code: 2, description: "Your device is offline. Can't continue.", isError: true} }; /** * Dispatches event with current status text and success indicator. */ var sendStatusEvent = function(statusEvent) { if (statusEvent.isError) { logger.logError(statusEvent.description); } else { logger.logToConsole(statusEvent.description); } cordova.fireDocumentEvent('bootstrapStatusEvent', statusEvent); }; /** * Part of the module that is public */ module.exports = { EventType: EventType, sendStatusEvent: sendStatusEvent }; }); /** * Utility functions used at startup */ cordova.define("salesforce/util/bootstrap", function(require, exports, module) { var logger = require("salesforce/util/logger"); /** * Determine whether the device is online. */ var deviceIsOnline = function() { var connType; if (navigator && navigator.connection) { connType = navigator.connection.type; logger.logToConsole("deviceIsOnline connType: " + connType); } else { logger.logToConsole("deviceIsOnline connType is undefined."); } if (typeof connType !== 'undefined') { // Cordova's connection object. May be more accurate? return (connType != null && connType != Connection.NONE && connType != Connection.UNKNOWN); } else { // Default to browser facility. return navigator.onLine; } }; /** * Part of the module that is public */ module.exports = { deviceIsOnline: deviceIsOnline }; }); /** * Helper function used to call the native side */ cordova.define("salesforce/util/exec", function(require, exports, module) { var exec = function(pluginVersion, successCB, errorCB, service, action, args) { var defaultSuccessCB = function() { console.log(service + ":" + action + " succeeded"); }; var defaultErrorCB = function() { console.error(service + ":" + action + " failed"); }; successCB = typeof successCB !== "function" ? defaultSuccessCB : successCB; error = typeof errorCB !== "function" ? defaultErrorCB : errorCB; args.unshift("pluginSDKVersion:" + pluginVersion); var cordovaExec = require('cordova/exec'); return cordovaExec(successCB, errorCB, service, action, args); }; /** * Part of the module that is public */ module.exports = { exec: exec }; }); cordova.define("salesforce/plugin/sdkinfo", function(require, exports, module) { // Version this js was shipped with var SDK_VERSION = "2.0.0unstable"; var SERVICE = "com.salesforce.sdkinfo"; var exec = require("salesforce/util/exec").exec; /** * SDKInfo data structure */ var SDKInfo = function(sdkVersion, forcePluginsAvailable, appName, appVersion) { this.sdkVersion = sdkVersion; this.forcePluginsAvailable = forcePluginsAvailable; this.appName = appName; this.appVersion = appVersion; }; /** * Returns a populated SDKInfo object (via a callback) */ var getInfo = function(successCB, errorCB) { exec(SDK_VERSION, successCB, errorCB, SERVICE, "getInfo", []); }; /** * Part of the module that is public */ module.exports = { getInfo: getInfo, // Constructor SDKInfo: SDKInfo }; }); // For backward compatibility var SFHybridApp = { logToConsole: cordova.require("salesforce/util/logger").logToConsole, logError: cordova.require("salesforce/util/logger").logError }; cordova.define("salesforce/plugin/oauth", function (require, exports, module) { // Version this js was shipped with var SDK_VERSION = "2.0.0unstable"; var SERVICE = "com.salesforce.oauth"; var exec = require("salesforce/util/exec").exec; /** * Whether or not logout has already been initiated. Can only be initiated once * per page load. */ var logoutInitiated = false; /** * Obtain authentication credentials, calling 'authenticate' only if necessary. * Most index.html authors can simply use this method to obtain auth credentials * after onDeviceReady. * success - The success callback function to use. * fail - The failure/error callback function to use. * cordova returns a dictionary with: * accessToken * refreshToken * clientId * userId * orgId * loginUrl * instanceUrl * userAgent */ var getAuthCredentials = function (success, fail) { exec(SDK_VERSION, success, fail, SERVICE, "getAuthCredentials", []); }; /** * Initiates the authentication process, with the given app configuration. * success - The success callback function to use. * fail - The failure/error callback function to use. * cordova returns a dictionary with: * accessToken * refreshToken * clientId * userId * orgId * loginUrl * instanceUrl * userAgent */ var authenticate = function (success, fail) { exec(SDK_VERSION, success, fail, SERVICE, "authenticate", []); }; /** * Logout the current authenticated user. This removes any current valid session token * as well as any OAuth refresh token. The user is forced to login again. * This method does not call back with a success or failure callback, as * (1) this method must not fail and (2) in the success case, the current user * will be logged out and asked to re-authenticate. Note also that this method can only * be called once per page load. Initiating logout will ultimately redirect away from * the given page (effectively resetting the logout flag), and calling this method again * while it's currently processing will result in app state issues. */ var logout = function () { if (!logoutInitiated) { logoutInitiated = true; exec(SDK_VERSION, null, null, SERVICE, "logoutCurrentUser", []); } }; /** * Gets the app's homepage as an absolute URL. Used for attempting to load any cached * content that the developer may have built into the app (via HTML5 caching). * * This method will either return the URL as a string, or an empty string if the URL has not been * initialized. */ var getAppHomeUrl = function (success) { exec(SDK_VERSION, success, null, SERVICE, "getAppHomeUrl", []); }; /** * Goes through the refresh flow, and sets the new session token in the supplied forcetkClient. */ var forcetkRefresh = function (forcetkClient, success, fail) { authenticate(function(oauthResponse) { var oauthResponseData = oauthResponse; if (oauthResponse.data) { oauthResponseData = oauthResponse.data; } forcetkClient.setSessionToken(oauthResponseData.accessToken, null, oauthResponseData.instanceUrl); success(); }, error); }; /** * Part of the module that is public */ module.exports = { getAuthCredentials: getAuthCredentials, authenticate: authenticate, logout: logout, getAppHomeUrl: getAppHomeUrl, forcetkRefresh: forcetkRefresh }; }); // For backward compatibility var SalesforceOAuthPlugin = cordova.require("salesforce/plugin/oauth"); cordova.define("salesforce/plugin/smartstore", function (require, exports, module) { // Version this js was shipped with var SDK_VERSION = "2.0.0unstable"; var SERVICE = "com.salesforce.smartstore"; var exec = require("salesforce/util/exec").exec; /** * SoupIndexSpec consturctor */ var SoupIndexSpec = function (path, type) { this.path = path; this.type = type; }; /** * QuerySpec constructor */ var QuerySpec = function (path) { // the kind of query, one of: "exact","range", "like" or "smart": // "exact" uses matchKey, "range" uses beginKey and endKey, "like" uses likeKey, "smart" uses smartSql this.queryType = "exact"; //path for the original IndexSpec you wish to use for search: may be a compound path eg Account.Owner.Name this.indexPath = path; //for queryType "exact" this.matchKey = null; //for queryType "like" this.likeKey = null; //for queryType "range" //the value at which query results may begin this.beginKey = null; //the value at which query results may end this.endKey = null; // for queryType "smart" this.smartSql = null; //"ascending" or "descending" : optional this.order = "ascending"; //the number of entries to copy from native to javascript per each cursor page this.pageSize = 10; }; /** * StoreCursor constructor */ var StoreCursor = function () { //a unique identifier for this cursor, used by plugin this.cursorId = null; //the maximum number of entries returned per page this.pageSize = 0; //the total number of pages of results available this.totalPages = 0; //the current page index among all the pages available this.currentPageIndex = 0; //the list of current page entries, ordered as requested in the querySpec this.currentPageOrderedEntries = null; }; // ====== Logging support ====== var logLevel = 0; var setLogLevel = function (l) { logLevel = l; }; var getLogLevel = function () { return logLevel; }; // ====== querySpec factory methods // Returns a query spec that will page through all soup entries in order by the given path value // Internally it simply does a range query with null begin and end keys var buildAllQuerySpec = function (path, order, pageSize) { var inst = new QuerySpec(path); inst.queryType = "range"; if (order) { inst.order = order; } // override default only if a value was specified if (pageSize) { inst.pageSize = pageSize; } // override default only if a value was specified return inst; }; // Returns a query spec that will page all entries exactly matching the matchKey value for path var buildExactQuerySpec = function (path, matchKey, pageSize) { var inst = new QuerySpec(path); inst.matchKey = matchKey; if (pageSize) { inst.pageSize = pageSize; } // override default only if a value was specified return inst; }; // Returns a query spec that will page all entries in the range beginKey ...endKey for path var buildRangeQuerySpec = function (path, beginKey, endKey, order, pageSize) { var inst = new QuerySpec(path); inst.queryType = "range"; inst.beginKey = beginKey; inst.endKey = endKey; if (order) { inst.order = order; } // override default only if a value was specified if (pageSize) { inst.pageSize = pageSize; } // override default only if a value was specified return inst; }; // Returns a query spec that will page all entries matching the given likeKey value for path var buildLikeQuerySpec = function (path, likeKey, order, pageSize) { var inst = new QuerySpec(path); inst.queryType = "like"; inst.likeKey = likeKey; if (order) { inst.order = order; } // override default only if a value was specified if (pageSize) { inst.pageSize = pageSize; } // override default only if a value was specified return inst; }; // Returns a query spec that will page all results returned by smartSql var buildSmartQuerySpec = function (smartSql, pageSize) { var inst = new QuerySpec(); inst.queryType = "smart"; inst.smartSql = smartSql; if (pageSize) { inst.pageSize = pageSize; } // override default only if a value was specified return inst; }; // ====== Soup manipulation ====== var registerSoup = function (soupName, indexSpecs, successCB, errorCB) { console.log("SmartStore.registerSoup: '" + soupName + "' indexSpecs: " + JSON.stringify(indexSpecs)); exec(SDK_VERSION, successCB, errorCB, SERVICE, "pgRegisterSoup", [{"soupName": soupName, "indexes": indexSpecs}] ); }; var removeSoup = function (soupName, successCB, errorCB) { console.log("SmartStore.removeSoup: " + soupName); exec(SDK_VERSION, successCB, errorCB, SERVICE, "pgRemoveSoup", [{"soupName": soupName}] ); }; var soupExists = function (soupName, successCB, errorCB) { console.log("SmartStore.soupExists: " + soupName); exec(SDK_VERSION, successCB, errorCB, SERVICE, "pgSoupExists", [{"soupName": soupName}] ); }; var querySoup = function (soupName, querySpec, successCB, errorCB) { if (querySpec.queryType == "smart") throw new Error("Smart queries can only be run using runSmartQuery"); console.log("SmartStore.querySoup: '" + soupName + "' indexPath: " + querySpec.indexPath); exec(SDK_VERSION, successCB, errorCB, SERVICE, "pgQuerySoup", [{"soupName": soupName, "querySpec": querySpec}] ); }; var runSmartQuery = function (querySpec, successCB, errorCB) { if (querySpec.queryType != "smart") throw new Error("runSmartQuery can only run smart queries"); console.log("SmartStore.runSmartQuery: smartSql: " + querySpec.smartSql); exec(SDK_VERSION, successCB, errorCB, SERVICE, "pgRunSmartQuery", [{"querySpec": querySpec}] ); }; var retrieveSoupEntries = function (soupName, entryIds, successCB, errorCB) { if (logLevel > 0) { console.log("SmartStore.retrieveSoupEntry: '" + soupName + "' entryIds: " + entryIds); } exec(SDK_VERSION, successCB, errorCB, SERVICE, "pgRetrieveSoupEntries", [{"soupName": soupName, "entryIds": entryIds}] ); }; var upsertSoupEntries = function (soupName, entries, successCB, errorCB) { upsertSoupEntriesWithExternalId(soupName, entries, "_soupEntryId", successCB, errorCB); }; var upsertSoupEntriesWithExternalId = function (soupName, entries, externalIdPath, successCB, errorCB) { if (logLevel > 0) { console.log("SmartStore.upsertSoupEntries: '" + soupName + "' entries.length: " + entries.length); } exec(SDK_VERSION, successCB, errorCB, SERVICE, "pgUpsertSoupEntries", [{"soupName": soupName, "entries": entries, "externalIdPath": externalIdPath}] ); }; var removeFromSoup = function (soupName, entryIds, successCB, errorCB) { console.log("SmartStore.removeFromSoup: '" + soupName + "' entryIds: " + entryIds); exec(SDK_VERSION, successCB, errorCB, SERVICE, "pgRemoveFromSoup", [{"soupName": soupName, "entryIds": entryIds}] ); }; //====== Cursor manipulation ====== var moveCursorToPageIndex = function (cursor, newPageIndex, successCB, errorCB) { console.log("moveCursorToPageIndex: " + cursor.cursorId + " newPageIndex: " + newPageIndex); exec(SDK_VERSION, successCB, errorCB, SERVICE, "pgMoveCursorToPageIndex", [{"cursorId": cursor.cursorId, "index": newPageIndex}] ); }; var moveCursorToNextPage = function (cursor, successCB, errorCB) { var newPageIndex = cursor.currentPageIndex + 1; if (newPageIndex >= cursor.totalPages) { errorCB(cursor, new Error("moveCursorToNextPage called while on last page")); } else { moveCursorToPageIndex(cursor, newPageIndex, successCB, errorCB); } }; var moveCursorToPreviousPage = function (cursor, successCB, errorCB) { var newPageIndex = cursor.currentPageIndex - 1; if (newPageIndex < 0) { errorCB(cursor, new Error("moveCursorToPreviousPage called while on first page")); } else { moveCursorToPageIndex(cursor, newPageIndex, successCB, errorCB); } }; var closeCursor = function (cursor, successCB, errorCB) { console.log("closeCursor: " + cursor.cursorId); exec(SDK_VERSION, successCB, errorCB, SERVICE, "pgCloseCursor", [{"cursorId": cursor.cursorId}] ); }; /** * Part of the module that is public */ module.exports = { getLogLevel: getLogLevel, setLogLevel: setLogLevel, buildAllQuerySpec: buildAllQuerySpec, buildExactQuerySpec: buildExactQuerySpec, buildRangeQuerySpec: buildRangeQuerySpec, buildLikeQuerySpec: buildLikeQuerySpec, buildSmartQuerySpec: buildSmartQuerySpec, registerSoup: registerSoup, removeSoup: removeSoup, soupExists: soupExists, querySoup: querySoup, runSmartQuery: runSmartQuery, retrieveSoupEntries: retrieveSoupEntries, upsertSoupEntries: upsertSoupEntries, upsertSoupEntriesWithExternalId: upsertSoupEntriesWithExternalId, removeFromSoup: removeFromSoup, moveCursorToPageIndex: moveCursorToPageIndex, moveCursorToNextPage: moveCursorToNextPage, moveCursorToPreviousPage: moveCursorToPreviousPage, closeCursor: closeCursor, // Constructors QuerySpec: QuerySpec, SoupIndexSpec: SoupIndexSpec, StoreCursor: StoreCursor }; }); // For backward compatibility navigator.smartstore = cordova.require("salesforce/plugin/smartstore"); var SoupIndexSpec = navigator.smartstore.SoupIndexSpec; var QuerySpec = navigator.smartstore.QuerySpec; var StoreCursor = navigator.smartstore.StoreCursor;
{ "content_hash": "0301cfdc5a680b63e3049271274dc500", "timestamp": "", "source": "github", "line_count": 608, "max_line_length": 114, "avg_line_length": 35.64802631578947, "alnum_prop": 0.6178831780012919, "repo_name": "developerforce/MobilePack-jQueryMobile", "id": "69735bb384d4707315ea1535ff6aef80c36363e8", "size": "23228", "binary": false, "copies": "6", "ref": "refs/heads/master", "path": "Samples/jQueryMobileHerokuNode/public/cordova.force.js", "mode": "33188", "license": "apache-2.0", "language": [] }
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <link rel="SHORTCUT ICON" href="../../../../../img/clover.ico" /> <link rel="stylesheet" href="../../../../../aui/css/aui.min.css" media="all"/> <link rel="stylesheet" href="../../../../../aui/css/aui-experimental.min.css" media="all"/> <!--[if IE 9]><link rel="stylesheet" href="../../../../../aui/css/aui-ie9.min.css" media="all"/><![endif]--> <style type="text/css" media="all"> @import url('../../../../../style.css'); @import url('../../../../../tree.css'); </style> <script src="../../../../../jquery-1.8.3.min.js" type="text/javascript"></script> <script src="../../../../../aui/js/aui.min.js" type="text/javascript"></script> <script src="../../../../../aui/js/aui-experimental.min.js" type="text/javascript"></script> <script src="../../../../../aui/js/aui-soy.min.js" type="text/javascript"></script> <script src="../../../../../package-nodes-tree.js" type="text/javascript"></script> <script src="../../../../../clover-tree.js" type="text/javascript"></script> <script src="../../../../../clover.js" type="text/javascript"></script> <script src="../../../../../clover-descriptions.js" type="text/javascript"></script> <script src="../../../../../cloud.js" type="text/javascript"></script> <title>ABA Route Transit Number Validator 1.0.1-SNAPSHOT</title> </head> <body> <div id="page"> <header id="header" role="banner"> <nav class="aui-header aui-dropdown2-trigger-group" role="navigation"> <div class="aui-header-inner"> <div class="aui-header-primary"> <h1 id="logo" class="aui-header-logo aui-header-logo-clover"> <a href="http://openclover.org" title="Visit OpenClover home page"><span class="aui-header-logo-device">OpenClover</span></a> </h1> </div> <div class="aui-header-secondary"> <ul class="aui-nav"> <li id="system-help-menu"> <a class="aui-nav-link" title="Open online documentation" target="_blank" href="http://openclover.org/documentation"> <span class="aui-icon aui-icon-small aui-iconfont-help">&#160;Help</span> </a> </li> </ul> </div> </div> </nav> </header> <div class="aui-page-panel"> <div class="aui-page-panel-inner"> <div class="aui-page-panel-nav aui-page-panel-nav-clover"> <div class="aui-page-header-inner" style="margin-bottom: 20px;"> <div class="aui-page-header-image"> <a href="http://cardatechnologies.com" target="_top"> <div class="aui-avatar aui-avatar-large aui-avatar-project"> <div class="aui-avatar-inner"> <img src="../../../../../img/clover_logo_large.png" alt="Clover icon"/> </div> </div> </a> </div> <div class="aui-page-header-main" > <h1> <a href="http://cardatechnologies.com" target="_top"> ABA Route Transit Number Validator 1.0.1-SNAPSHOT </a> </h1> </div> </div> <nav class="aui-navgroup aui-navgroup-vertical"> <div class="aui-navgroup-inner"> <ul class="aui-nav"> <li class=""> <a href="../../../../../dashboard.html">Project overview</a> </li> </ul> <div class="aui-nav-heading packages-nav-heading"> <strong>Packages</strong> </div> <div class="aui-nav project-packages"> <form method="get" action="#" class="aui package-filter-container"> <input type="text" autocomplete="off" class="package-filter text" placeholder="Type to filter packages..." name="package-filter" id="package-filter" title="Start typing package name (or part of the name) to search through the tree. Use arrow keys and the Enter key to navigate."/> </form> <p class="package-filter-no-results-message hidden"> <small>No results found.</small> </p> <div class="packages-tree-wrapper" data-root-relative="../../../../../" data-package-name="com.cardatechnologies.utils.validators.abaroutevalidator"> <div class="packages-tree-container"></div> <div class="clover-packages-lozenges"></div> </div> </div> </div> </nav> </div> <section class="aui-page-panel-content"> <div class="aui-page-panel-content-clover"> <div class="aui-page-header-main"><ol class="aui-nav aui-nav-breadcrumbs"> <li><a href="../../../../../dashboard.html"> Project Clover database Sat Aug 7 2021 12:29:33 MDT</a></li> <li><a href="test-pkg-summary.html">Package com.cardatechnologies.utils.validators.abaroutevalidator</a></li> <li><a href="test-Test_AbaRouteValidator_15.html">Class Test_AbaRouteValidator_15</a></li> </ol></div> <h1 class="aui-h2-clover"> Test testAbaNumberCheck_33653_good </h1> <table class="aui"> <thead> <tr> <th>Test</th> <th><label title="The test result. Either a Pass, Fail or Error.">Status</label></th> <th><label title="When the test execution was started">Start time</label></th> <th><label title="The total time in seconds taken to run this test.">Time (seconds)</label></th> <th><label title="A failure or error message if the test is not successful.">Message</label></th> </tr> </thead> <tbody> <tr> <td> <a href="../../../../../com/cardatechnologies/utils/validators/abaroutevalidator/Test_AbaRouteValidator_15.html?line=27162#src-27162" >testAbaNumberCheck_33653_good</a> </td> <td> <span class="sortValue">1</span><span class="aui-lozenge aui-lozenge-success">PASS</span> </td> <td> 7 Aug 12:44:29 </td> <td> 0.0 </td> <td> <div></div> <div class="errorMessage"></div> </td> </tr> </tbody> </table> <div>&#160;</div> <table class="aui aui-table-sortable"> <thead> <tr> <th style="white-space:nowrap;"><label title="A class that was directly hit by this test.">Target Class</label></th> <th colspan="4"><label title="The percentage of coverage contributed by each single test.">Coverage contributed by</label> testAbaNumberCheck_33653_good</th> </tr> </thead> <tbody> <tr> <td> <span class="sortValue">com.cardatechnologies.utils.validators.abaroutevalidator.AbaRouteValidator</span> &#160;&#160;<a href="../../../../../com/cardatechnologies/utils/validators/abaroutevalidator/AbaRouteValidator.html?id=9432#AbaRouteValidator" title="AbaRouteValidator" name="sl-47">com.cardatechnologies.utils.validators.abaroutevalidator.AbaRouteValidator</a> </td> <td> <span class="sortValue">0.7352941</span>73.5% </td> <td class="align-middle" style="width: 100%" colspan="3"> <div> <div title="73.5% Covered" style="min-width:40px;" class="barNegative contribBarNegative contribBarNegative"><div class="barPositive contribBarPositive contribBarPositive" style="width:73.5%"></div></div></div> </td> </tr> </tbody> </table> </div> <!-- class="aui-page-panel-content-clover" --> <footer id="footer" role="contentinfo"> <section class="footer-body"> <ul> <li> Report generated by <a target="_new" href="http://openclover.org">OpenClover</a> v 4.4.1 on Sat Aug 7 2021 12:49:26 MDT using coverage data from Sat Aug 7 2021 12:47:23 MDT. </li> </ul> <ul> <li>OpenClover is free and open-source software. </li> </ul> </section> </footer> </section> <!-- class="aui-page-panel-content" --> </div> <!-- class="aui-page-panel-inner" --> </div> <!-- class="aui-page-panel" --> </div> <!-- id="page" --> </body> </html>
{ "content_hash": "e15192cb4b279e3f45582b9621fa0f56", "timestamp": "", "source": "github", "line_count": 209, "max_line_length": 296, "avg_line_length": 43.92344497607655, "alnum_prop": 0.5096949891067538, "repo_name": "dcarda/aba.route.validator", "id": "51c183077d9b903992d7048318a0ec8609a66ecf", "size": "9180", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "target13/site/clover/com/cardatechnologies/utils/validators/abaroutevalidator/Test_AbaRouteValidator_15_testAbaNumberCheck_33653_good_7a0.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "18715254" } ] }
<?php use yii\helpers\Html; use yii\widgets\ActiveForm; /* @var $this yii\web\View */ /* @var $model common\models\CollegeSearch */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="college-search"> <?php $form = ActiveForm::begin([ 'action' => ['index'], 'method' => 'get', ]); ?> <?= $form->field($model, 'id') ?> <?= $form->field($model, 'university_id') ?> <?= $form->field($model, 'name') ?> <?= $form->field($model, 'description') ?> <?= $form->field($model, 'website') ?> <?php // echo $form->field($model, 'logo') ?> <?php // echo $form->field($model, 'banner') ?> <?php // echo $form->field($model, 'establish') ?> <?php // echo $form->field($model, 'statutory_body_id') ?> <?php // echo $form->field($model, 'important_links_id') ?> <?php // echo $form->field($model, 'download_links_id') ?> <?php // echo $form->field($model, 'is_featured') ?> <?php // echo $form->field($model, 'created') ?> <?php // echo $form->field($model, 'modified') ?> <?php // echo $form->field($model, 'status') ?> <?php // echo $form->field($model, 'college_image_id') ?> <div class="form-group"> <?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?> <?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?> </div> <?php ActiveForm::end(); ?> </div>
{ "content_hash": "be16d2baa4213e82a2866d5bcaceb096", "timestamp": "", "source": "github", "line_count": 57, "max_line_length": 75, "avg_line_length": 24.649122807017545, "alnum_prop": 0.5316725978647687, "repo_name": "khurshedt9l/collegey", "id": "f4d2bff5e1641c78ce930f4d7646169375272a09", "size": "1405", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "backend/views/college/_search.php", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Batchfile", "bytes": "2681" }, { "name": "CSS", "bytes": "904188" }, { "name": "Groff", "bytes": "11383" }, { "name": "HTML", "bytes": "3204459" }, { "name": "JavaScript", "bytes": "3538849" }, { "name": "PHP", "bytes": "526868" }, { "name": "Shell", "bytes": "619" } ] }
<!-- Test Description: This testcase isn't run verbatim. The template string below is replaced by the test harnesses with various lengths of inline JavaScript. We use this test to verify the max_byte_length rules for inline scripts. --> <!doctype html> <html ⚡> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,minimum-scale=1"> <script async src="https://cdn.ampproject.org/v0.js"></script> <script async custom-element="amp-script" src="https://cdn.ampproject.org/v0/amp-script-0.1.js"></script> <link rel="canonical" href="./regular-html-version.html"> <style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript> </head> <body> Hello, world. <amp-script script=a layout=container></amp-script> <script type=text/plain target=amp-script id=a>replace_inline_script</script> </body> </html>
{ "content_hash": "5d924755a3a2bdb1f7da2a11f75477a6", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 765, "avg_line_length": 70.54545454545455, "alnum_prop": 0.7519329896907216, "repo_name": "Gregable/amphtml", "id": "a316d3104613485c06b601cf0e36bf9a80cabd01", "size": "1554", "binary": false, "copies": "11", "ref": "refs/heads/main", "path": "validator/testdata/feature_tests/inline_script_length.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "256" }, { "name": "C++", "bytes": "1600760" }, { "name": "CSS", "bytes": "478532" }, { "name": "Go", "bytes": "6528" }, { "name": "HTML", "bytes": "2075758" }, { "name": "JavaScript", "bytes": "18892784" }, { "name": "Python", "bytes": "64486" }, { "name": "Shell", "bytes": "20757" }, { "name": "Starlark", "bytes": "33812" }, { "name": "TypeScript", "bytes": "23157" }, { "name": "Yacc", "bytes": "28669" } ] }
<section class="app-headline"> <div class="row"> <div class="column small-12"> <div class="app-breadcrumbs"> <a routerLink="/">Pagrindinis puslapis</a> <a (click)="backToList()">Kategorijos</a> <a class="current">Maisto produktų pakuotės</a> </div><!-- .breadcrumbs --> </div><!-- .column small-12 --> </div><!-- .row --> </section><!-- .app-headline --> <section class="app-main"> <div class="row"> <div class="columns small-12"> <div class="page-headline"> <h2 class="title">Užpildykite formą žemiau</h2><!-- .headline --> <!--<span class="subtitle">Page <strong>1</strong> of 3</span>--> <!-- This one is aligned to the right. --> <a (click)="backToList()" class="see-faq">Atgal į sąrašą</a> </div><!-- .page-headline --> </div><!-- .columns small-12 --> </div><!-- .row --> <form #f="ngForm" (ngSubmit)="addContest(f.value)"> <div *ngIf="!isClient()" class="input-forms"> <div class="input-row"> <h4><span class="span-bold">Paskelbti konkursą gali tik užsakovai.</span> <span class="normal-text">Prašome <span class="italic">prisijungti</span> ar <span class="italic">užsiregistruoti</span></span>.</h4> </div> </div> <div *ngIf="isClient() && !isEmailConfirmed()" class="input-forms"> <div class="input-row"> <h4><span class="span-bold">Kad galėtumėte paskelbti konkursą, prašome patvirtinti savo el. pašto paskyrą</span> <a class="span-link" routerLink="/profilis">profilyje</a></h4> </div> </div> <div *ngIf="isClient() && isEmailConfirmed()" class="input-forms"> <div class="input-row"> <div class="input-label"> <span>Konkurso kategorija</span> </div><!-- .input-label --> <div class="input-field"> <input class="readonly" type="text" readonly name="category" [(ngModel)]="contest.category" #category="ngModel" /> </div><!-- .input-field --> <span (click)="backToList()" class="btn-back">Pakeisti</span> </div><!-- .input-row --> <hr class="sep" /> <div class="input-row"> <div class="input-label"> <span>Konkurso pavadinimas</span> </div><!-- .input-label --> <div class="input-field"> <input type="text" placeholder="Pvz. įmonės pavadinimas" [ngClass]="{'input-area-error': name.errors && (name.dirty || name.touched)}" name="name" [(ngModel)]="contest.name" required #name="ngModel" /> </div><!-- .input-field --> <span *ngIf="name.pristine" class="asterisk">*</span> </div><!-- .input-row --> <div *ngIf="name.errors && (name.dirty || name.touched)" class="input-error-below"> <div [hidden]="!name.errors.required"> Įveskite konkurso pavadinimą </div> </div> <div class="input-row"> <div class="input-label"> <span>Pakuotės aprašymas</span> </div><!-- .input-label --> <div class="input-field"> <textarea type="text" placeholder="Konkurso aprašymas" [ngClass]="{'input-area-error': description.errors && (description.dirty || description.touched)}" name="description" [(ngModel)]="contest.description" required #description="ngModel"></textarea> </div><!-- .input-field --> <span *ngIf="description.pristine" class="asterisk">*</span> </div><!-- .input-row --> <div *ngIf="description.errors && (description.dirty || description.touched)" class="input-error-below"> <div [hidden]="!description.errors.required"> Įveskite norimo dizaino aprašymą </div> </div> <hr class="sep" /> <div class="input-row"> <div class="input-label"> <span>Informacija apie organizaciją</span> </div><!-- .input-label --> <div class="input-field"> <textarea type="text" placeholder="Organizacijos pavadinimas, veikla" name="organization" [(ngModel)]="contest.organization" #organization="ngModel"></textarea> </div><!-- .input-field --> </div><!-- .input-row --> <div class="textarea-row"> <div class="input-label textarea-label"> <span>Papildoma informacija</span> </div><!-- .input-label --> <div class="input-field"> <textarea type="text" placeholder="Papildoma informacija" name="extraInfo" [(ngModel)]="contest.extraInfo" #extraInfo="ngModel"></textarea> </div><!-- .input-field --> </div><!-- .input-row --> <div class="input-row"> <div class="input-label textarea-label"> <span>Konkurso trukmė (dienomis)</span> <small>Mažiausiai 7 dienos</small> </div><!-- .input-label --> <div class="input-field input-small"> <input class="input-center" type="number" [ngClass]="{'input-area-error': contestLength.errors && (contestLength.dirty || contestLength.touched)}" placeholder="Pvz. 14" name="contestLength" min="7" max="30" [(ngModel)]="contest.contestLength" required #contestLength="ngModel" /> </div><!-- .input-field --> <span *ngIf="contestLength.pristine" class="asterisk">*</span> <div *ngIf="contestLength.errors && (contestLength.dirty || contestLength.touched)" class="input-error"> <div [hidden]="!contestLength.errors.required"> Įveskite konkurso trukmę </div> </div> </div><!-- .input-row --> <div class="textarea-row"> <div class="input-label textarea-label"> <span>Konkurso kaina (&euro;)</span> <small>Mažiausiai 50 &euro;</small> </div><!-- .input-label --> <div class="input-field input-small"> <input class="input-center" type="number" [ngClass]="{'input-area-error': award.errors && (award.dirty || award.touched)}" name="award" [(ngModel)]="contest.award" required min="50" max="1000" #award="ngModel" /> </div><!-- .input-field --> <span *ngIf="award.pristine" class="asterisk">*</span> <div *ngIf="award.errors && (award.dirty || award.touched)" class="input-error"> <div [hidden]="!award.errors.required"> Įveskite kainą </div> </div> </div><!-- .input-row --> <div class="input-row"> <div class="input-label textarea-label"> <span>Privatus konkursas?</span> <small>Konkursas nematomas viešai</small> </div><!-- .input-label --> <div class="input-field input-small checkbox-input"> <input type="checkbox" name="isPrivate" [(ngModel)]="contest.isPrivate"> </div><!-- .input-field --> </div><!-- .input-row --> <hr class="sep" /> <div class="extra-info">Pagalbinius failus (logotipą, iliustracijas, brėžinius) galėsite įkelti paskelbus konkursą, konkurso puslapyje</div> <hr class="sep" /> <div *ngIf="isClient() && isEmailConfirmed()" class="publish-contest-button"> <button type="submit" class="submit" [disabled]="!f.valid" value="Paskelbti konkursą">Paskelbti konkursą</button> </div> <div *ngIf="isClient() && !isEmailConfirmed()"> <h4>Kad galėtumėt paskelbti konkursą, patvirtinkite savo el. pašto paskyrą profilio nustatymuose</h4> </div> <div *ngIf="isDesigner()"> <div class="info-disabled-button"> <h4>Skelbti konkursą gali tik užsakovai</h4> </div> </div> <div *ngIf="!isDesigner() && !isClient()"> <div class="info-disabled-button"> <h4><span class="span-bold">Skelbti konkursą gali tik registruoti užsakovai.</span> <span class="normal-text">Prašome <span class="italic">prisijungti</span> ar <span class="italic">užsiregistruoti</span></span>.</h4> </div> </div> </div><!-- .input-forms --> </form> <simple-notifications [options]="options"></simple-notifications> <test-loader *ngIf="isLoading"></test-loader>
{ "content_hash": "ef7abe77fd0bcb9ca025501fa2e91046", "timestamp": "", "source": "github", "line_count": 178, "max_line_length": 284, "avg_line_length": 41.842696629213485, "alnum_prop": 0.6291621911922664, "repo_name": "IrmantasLiepis/logo-design", "id": "2a2d0ac97da9d4700c942b498449af825c6bb2c2", "size": "7505", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "assets/app/components/publish-contest/packaging-and-label/food-products-label-or-packaging-design/food-products-label-or-packaging-design.component.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "631630" }, { "name": "HTML", "bytes": "1301729" }, { "name": "JavaScript", "bytes": "83986" }, { "name": "TypeScript", "bytes": "316006" } ] }
<!DOCTYPE html> <html lang="en-us"> <head> <meta charset="UTF-8"> <title>{{ page.title | default: site.title }}</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="theme-color" content="#157878"> <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css'> <link rel="stylesheet" href="{{ '/assets/css/style.css?v=' | append: site.github.build_revision | relative_url }}"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-fork-ribbon-css/0.2.0/gh-fork-ribbon.min.css" /> <!--[if lt IE 9]> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-fork-ribbon-css/0.2.0/gh-fork-ribbon.ie.min.css" /> <![endif]--> </head> <body> <a class="github-fork-ribbon" href="https://github.com/openluopworld" title="Fork me on GitHub">Fork me on GitHub</a> <section class="page-header"> <h1 class="project-name">{{ site.title | default: site.github.repository_name }}</h1> <h2 class="project-tagline">{{ site.description | default: site.github.project_tagline }}</h2> <a href="./../" class="btn">Home</a> <a href="./../read/read.html" class="btn">Read</a> </section> <section class="main-content"> {{ content }} </section> {% if site.google_analytics %} <script type="text/javascript"> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', '{{ site.google_analytics }}', 'auto'); ga('send', 'pageview'); </script> {% endif %} </body> </html>
{ "content_hash": "01f8a6586722039804e0dd3236be2228", "timestamp": "", "source": "github", "line_count": 42, "max_line_length": 130, "avg_line_length": 45.30952380952381, "alnum_prop": 0.6163951655281135, "repo_name": "openluopworld/openluopworld.github.io", "id": "2d35a7656faf26cc8255dc6c69a9c8b3363f620f", "size": "1903", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "_layouts/default.html", "mode": "33261", "license": "mit", "language": [ { "name": "CSS", "bytes": "37" }, { "name": "HTML", "bytes": "16059" }, { "name": "TeX", "bytes": "5690" } ] }
package org.topbraid.shacl.validation.java; import java.util.HashMap; import java.util.Map; import java.util.function.Function; import org.apache.jena.rdf.model.Resource; import org.topbraid.shacl.engine.Constraint; import org.topbraid.shacl.validation.ConstraintExecutor; import org.topbraid.shacl.validation.ConstraintExecutors; import org.topbraid.shacl.vocabulary.DASH; import org.topbraid.shacl.vocabulary.SH; public class JavaConstraintExecutors { private static Map<Resource,Function<Constraint,ConstraintExecutor>> map = new HashMap<>(); static { map.put(SH.AndConstraintComponent, constraint -> new AndConstraintExecutor(constraint)); map.put(SH.ClassConstraintComponent, constraint -> new ClassConstraintExecutor()); map.put(SH.ClosedConstraintComponent, constraint -> new ClosedConstraintExecutor(constraint)); map.put(SH.DatatypeConstraintComponent, constraint -> new DatatypeConstraintExecutor()); map.put(SH.DisjointConstraintComponent, constraint -> new DisjointConstraintExecutor()); map.put(SH.EqualsConstraintComponent, constraint -> new EqualsConstraintExecutor()); map.put(SH.HasValueConstraintComponent, constraint -> new HasValueConstraintExecutor()); map.put(SH.InConstraintComponent, constraint -> new InConstraintExecutor(constraint)); map.put(SH.LanguageInConstraintComponent, constraint -> new LanguageInConstraintExecutor(constraint)); map.put(SH.LessThanConstraintComponent, constraint -> new LessThanConstraintExecutor()); map.put(SH.LessThanOrEqualsConstraintComponent, constraint -> new LessThanOrEqualsConstraintExecutor()); map.put(SH.MaxCountConstraintComponent, constraint -> new MaxCountConstraintExecutor(constraint)); map.put(SH.MaxExclusiveConstraintComponent, constraint -> new MaxExclusiveConstraintExecutor()); map.put(SH.MaxInclusiveConstraintComponent, constraint -> new MaxInclusiveConstraintExecutor()); map.put(SH.MaxLengthConstraintComponent, constraint -> new MaxLengthConstraintExecutor(constraint)); map.put(SH.MinCountConstraintComponent, constraint -> new MinCountConstraintExecutor(constraint)); map.put(SH.MinExclusiveConstraintComponent, constraint -> new MinExclusiveConstraintExecutor()); map.put(SH.MinInclusiveConstraintComponent, constraint -> new MinInclusiveConstraintExecutor()); map.put(SH.MinLengthConstraintComponent, constraint -> new MinLengthConstraintExecutor(constraint)); map.put(SH.NodeConstraintComponent, constraint -> new NodeConstraintExecutor()); map.put(SH.NodeKindConstraintComponent, constraint -> new NodeKindConstraintExecutor()); map.put(SH.NotConstraintComponent, constraint -> new NotConstraintExecutor()); map.put(SH.OrConstraintComponent, constraint -> new OrConstraintExecutor(constraint)); map.put(SH.PatternConstraintComponent, constraint -> new PatternConstraintExecutor(constraint)); map.put(SH.QualifiedMaxCountConstraintComponent, constraint -> new QualifiedValueShapeConstraintExecutor(constraint)); map.put(SH.QualifiedMinCountConstraintComponent, constraint -> new QualifiedValueShapeConstraintExecutor(constraint)); map.put(SH.UniqueLangConstraintComponent, constraint -> new UniqueLangConstraintExecutor()); map.put(SH.XoneConstraintComponent, constraint -> new XoneConstraintExecutor(constraint)); map.put(DASH.SingleLineConstraintComponent, constraint -> new SingleLineConstraintExecutor()); } public static void install(ConstraintExecutors constraintExecutors) { for(Resource cc : map.keySet()) { constraintExecutors.addSpecialExecutor(cc, map.get(cc)); } } }
{ "content_hash": "895ae0ac3ba61c4057afd8fc73acbe20", "timestamp": "", "source": "github", "line_count": 56, "max_line_length": 120, "avg_line_length": 63.32142857142857, "alnum_prop": 0.817258883248731, "repo_name": "TopQuadrant/shacl", "id": "b9a31fd140f968615918534b1d557adbb0015b6f", "size": "3546", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/org/topbraid/shacl/validation/java/JavaConstraintExecutors.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "975" }, { "name": "Java", "bytes": "828701" }, { "name": "Shell", "bytes": "4201" } ] }
google-site-verification: google00b2ff83e5d189a3.html
{ "content_hash": "c10bf22dae934c5c213715bd3b8379f4", "timestamp": "", "source": "github", "line_count": 1, "max_line_length": 53, "avg_line_length": 53, "alnum_prop": 0.9056603773584906, "repo_name": "enigmabeautysalon/enigmabeautysalon.github.io", "id": "50b70a53f8e026bd1458d60b81a0238539480fcd", "size": "53", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "google00b2ff83e5d189a3.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "69994" }, { "name": "HTML", "bytes": "108633" }, { "name": "JavaScript", "bytes": "4116" }, { "name": "Ruby", "bytes": "48" }, { "name": "SCSS", "bytes": "45598" } ] }
<div class="pie-chart" ng-class="{ 'danger': chartData.overMax }"> <chart-tooltip tooltip-data="model.tooltipData"></chart-tooltip> <div ng-if="::model.settings.showTitle && chartData.title" class="pie-chart-title {$ ::model.settings.titleClass $}"> {$ ::chartData.title $} ({$ model.total ? model.total + ' ' : '' $}{$ model.totalLabel $}) </div> <svg class="svg-pie-chart" ng-if="chartData.showChart" ng-attr-height="{$ ::model.settings.diameter $}" ng-attr-width="{$ ::model.settings.diameter $}"> <g class="chart" ng-attr-transform="translate({$ ::model.settings.outerRadius $},{$ ::model.settings.outerRadius $})"> <g class="slices"></g> <g ng-if="::model.settings.showLabel && chartData.label" class="pie-chart-label"> <text dy="0.35em" ng-style="model.settings.label" ng-class="{ 'danger': chartData.overMax }">{$ chartData.label $}</text> </g> </g> </svg> <div ng-if="::model.settings.showLegend" class="pie-chart-legend"> <div ng-repeat="slice in chartData.data | showKeyFilter" class="slice-legend"> <div ng-if="chartData.showChart" class="slice-key" ng-class="slice.colorClass"></div> <div ng-class="[slice.colorClass, chartData.chartless]">{$ slice.value $}</div> <div>{$ slice.label $}</div> </div> </div> </div>
{ "content_hash": "99246ca715ca524643225f85a761536a", "timestamp": "", "source": "github", "line_count": 31, "max_line_length": 107, "avg_line_length": 43.58064516129032, "alnum_prop": 0.6173205033308661, "repo_name": "Tesora-Release/tesora-horizon", "id": "1a120b99b29ea9f3adb9cfaa9ed5b3a01d0e0748", "size": "1351", "binary": false, "copies": "7", "ref": "refs/heads/master", "path": "horizon/static/framework/widgets/charts/pie-chart.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "109391" }, { "name": "HTML", "bytes": "538713" }, { "name": "JavaScript", "bytes": "973924" }, { "name": "Makefile", "bytes": "588" }, { "name": "Python", "bytes": "5145012" }, { "name": "Shell", "bytes": "18658" } ] }
package org.opensingular.lib.commons.context; import org.opensingular.lib.commons.base.SingularException; public class SingularSingletonNotFoundException extends SingularException { public SingularSingletonNotFoundException(String key) { super(String.format("We could not find the singleton you asked for (key: %s), sorry. Check if the singleton is registered.", key)); } }
{ "content_hash": "9b51ecd462676bcc640ce3e210fe1940", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 139, "avg_line_length": 32.916666666666664, "alnum_prop": 0.7746835443037975, "repo_name": "opensingular/singular-core", "id": "6237e6732a47eed5d47c8a925945ad746136213c", "size": "1041", "binary": false, "copies": "1", "ref": "refs/heads/feature_1.9.x", "path": "lib/commons/src/main/java/org/opensingular/lib/commons/context/SingularSingletonNotFoundException.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "3919351" }, { "name": "CoffeeScript", "bytes": "83631" }, { "name": "HTML", "bytes": "1038610" }, { "name": "Java", "bytes": "6990606" }, { "name": "JavaScript", "bytes": "15861962" }, { "name": "Shell", "bytes": "444" } ] }
<Type Name="CTFontFeatureVerticalSubstitutionConnection" FullName="MonoMac.CoreText.CTFontFeatureVerticalSubstitutionConnection"> <TypeSignature Language="C#" Value="public class CTFontFeatureVerticalSubstitutionConnection : MonoMac.CoreText.CTFontFeatureSelectors" /> <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit CTFontFeatureVerticalSubstitutionConnection extends MonoMac.CoreText.CTFontFeatureSelectors" /> <AssemblyInfo> <AssemblyName>MonoMac</AssemblyName> <AssemblyVersion>0.0.0.0</AssemblyVersion> </AssemblyInfo> <Base> <BaseTypeName>MonoMac.CoreText.CTFontFeatureSelectors</BaseTypeName> </Base> <Interfaces /> <Docs> <summary>To be added.</summary> <remarks>To be added.</remarks> </Docs> <Members> <Member MemberName=".ctor"> <MemberSignature Language="C#" Value="public CTFontFeatureVerticalSubstitutionConnection (MonoMac.Foundation.NSDictionary dictionary);" /> <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class MonoMac.Foundation.NSDictionary dictionary) cil managed" /> <MemberType>Constructor</MemberType> <AssemblyInfo> <AssemblyVersion>0.0.0.0</AssemblyVersion> </AssemblyInfo> <Parameters> <Parameter Name="dictionary" Type="MonoMac.Foundation.NSDictionary" /> </Parameters> <Docs> <param name="dictionary">To be added.</param> <summary>To be added.</summary> <remarks>To be added.</remarks> </Docs> </Member> <Member MemberName="Feature"> <MemberSignature Language="C#" Value="public MonoMac.CoreText.CTFontFeatureVerticalSubstitutionConnection.Selector Feature { get; }" /> <MemberSignature Language="ILAsm" Value=".property instance valuetype MonoMac.CoreText.CTFontFeatureVerticalSubstitutionConnection/Selector Feature" /> <MemberType>Property</MemberType> <AssemblyInfo> <AssemblyVersion>0.0.0.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>MonoMac.CoreText.CTFontFeatureVerticalSubstitutionConnection+Selector</ReturnType> </ReturnValue> <Docs> <summary>To be added.</summary> <value>To be added.</value> <remarks>To be added.</remarks> </Docs> </Member> </Members> </Type>
{ "content_hash": "a109a183e2b3d063ad87150c73907244", "timestamp": "", "source": "github", "line_count": 50, "max_line_length": 183, "avg_line_length": 47.28, "alnum_prop": 0.7225042301184433, "repo_name": "PlayScriptRedux/monomac", "id": "c65246f27a666336c1663dd48e92d2956efe97da", "size": "2364", "binary": false, "copies": "4", "ref": "refs/heads/playscript", "path": "docs/en/MonoMac.CoreText/CTFontFeatureVerticalSubstitutionConnection.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C#", "bytes": "8631093" }, { "name": "Makefile", "bytes": "8784" } ] }
__version__ = '1.3.0' from SimpleCV.base import * from SimpleCV.Camera import * from SimpleCV.Color import * from SimpleCV.Display import * from SimpleCV.Features import * from SimpleCV.ImageClass import * from SimpleCV.Stream import * from SimpleCV.Font import * from SimpleCV.ColorModel import * from SimpleCV.DrawingLayer import * from SimpleCV.Segmentation import * from SimpleCV.MachineLearning import * from SimpleCV.LineScan import * from SimpleCV.DFT import DFT if (__name__ == '__main__'): from SimpleCV.Shell import * main(sys.argv)
{ "content_hash": "f4e9616a2f1ed66979aae5b74acd0628", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 38, "avg_line_length": 27.65, "alnum_prop": 0.7576853526220615, "repo_name": "sightmachine/SimpleCV", "id": "4f8a5b77812eda3dff3d8aacbe43a64a1b4838d2", "size": "553", "binary": false, "copies": "12", "ref": "refs/heads/master", "path": "SimpleCV/__init__.py", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "CSS", "bytes": "1187" }, { "name": "HTML", "bytes": "17691" }, { "name": "JavaScript", "bytes": "13899" }, { "name": "NSIS", "bytes": "10632" }, { "name": "Perl", "bytes": "5044" }, { "name": "Python", "bytes": "1699737" }, { "name": "Shell", "bytes": "12345" } ] }
{// 引入标签库 } <tagLib name="html" /> <include file="Public:header" /> <PHP> function get_handle($id) { $order_info = M("DealOrder")->getById($id); if($order_info['order_status']==0) { $str = l("DEAL_ORDER_HANDLE"); } else { $str = l("DEAL_ORDER_VIEW"); } $str = "<a href='".u("DealOrder/view_order",array("id"=>$id))."'>".$str."</a>"; if($order_info['order_status']==1) { $str.="&nbsp;&nbsp;<a href='javascript:del(".$id.");'>".l("DEL")."</a>"; } return $str; } function get_extra_status($status) { return l("EXTRA_STATUS_".$status); } function get_after_sale($status,$order_status) { if($order_status==0) return l("NO_OVER_ORDER"); else return l("AFTER_SALE_".$status); } function get_order_item($order_sn,$order_id) { $deal_order_item = M("DealOrderItem")->where("order_id = ".$order_id)->findAll(); $str = "<span style='font-size:14px; font-family:verdana; font-weight:bold;'>".$order_sn."</span>"; foreach($deal_order_item as $v) { $str.="<br />&nbsp;".l('DEAL_ID').":".$v['deal_id']."&nbsp;<span title='".$v['name']."'"; if(intval($_REQUEST['deal_id'])==$v['deal_id']) { $str.=" style='color:red;' "; } $str.=">".msubstr($v['name'],0,5)."</span>&nbsp;".l("NUMBER")." [".$v['number']."]"; } return $str; } function get_refund_status($s) { if($s==0) return "无"; if($s==1) return "<span style='color:#f30;'>要求退款</span>"; if($s==2) return "已处理"; } function get_retake_status($s) { if($s==0) return "无"; if($s==1) return "<span style='color:#f30;'>要求退货</span>"; if($s==2) return "已处理"; } </php> <load href='__TMPL__Common/js/jquery.bgiframe.js' /> <load href='__TMPL__Common/js/jquery.weebox.js' /> <load href='__TMPL__Common/style/weebox.css' /> <script type="text/javascript"> function batch_delivery() { express_id = $("select[name='express_id']").val(); if(express_id==0) { alert(LANG['SELECT_EXPRESS_WARNING']); return; } idBox = $(".key:checked"); if(idBox.length == 0) { alert(LANG['SELECT_EMPTY_WARNING']); return; } idArray = new Array(); $.each( idBox, function(i, n){ idArray.push($(n).val()); }); ids = idArray.join(","); $.weeboxs.open(ROOT+'?m=DealOrder&a=load_batch_delivery&ids='+ids+"&express_id="+express_id, {contentType:'ajax',showButton:false,title:LANG['BATCH_DELIVERY'],width:600,height:120}); } function batch_print() { express_id = $("select[name='express_id']").val(); if(express_id==0) { alert(LANG['SELECT_EXPRESS_WARNING']); return; } idBox = $(".key:checked"); if(idBox.length == 0) { alert(LANG['SELECT_EMPTY_WARNING']); return; } idArray = new Array(); $.each( idBox, function(i, n){ idArray.push($(n).val()); }); ids = idArray.join(","); window.open(ROOT+'?m=Express&a=eprint&order_id='+ids+"&express_id="+express_id); } </script> <div class="main"> <div class="main_title">{%DEAL_ORDER}</div> <div class="blank5"></div> <form name="search" action="__APP__" method="get"> <div class="button_row"> <input type="button" class="button" value="{%DEL}" onclick="del();" /> <input type="submit" class="button" value="{%SEARCH}" /> <if condition="!$_REQUEST['referer']"> <input type="button" class="button" value="{%EXPORT}" onclick="export_csv();" /> </if> <input type="button" class="button" value="{%BATCH_DELIVERY}" onclick="batch_delivery();" /> <input type="button" class="button" value="{%BATCH_PRINT}" onclick="batch_print();" /> <lable>{%SELECT_EXPRESS} <select name="express_id"> <option value="0">{%OTHER_EXPRESS}</option> <foreach name="express_list" item="express"> <option value="{$express.id}">{$express.name}</option> </foreach> </select> </lable> </div> <div class="blank5"></div> <div class="search_row"> {%ORDER_SN}:<input type="text" class="textbox" name="order_sn" value="{:trim($_REQUEST['order_sn'])}" style="width:100px;" /> {%DEAL_ID}:<input type="text" class="textbox" name="deal_id" value="{:trim($_REQUEST['deal_id'])}" style="width:30px;" /> {%USER_NAME_S}:<input type="text" class="textbox" name="user_name" value="{:trim($_REQUEST['user_name'])}" style="width:100px;" /> {%PAYMENT_STATUS_S}: <select name="pay_status"> <option value="-1" <if condition="intval($_REQUEST['pay_status']) eq -1">selected="selected"</if>>{%ALL}</option> <option value="0" <if condition="intval($_REQUEST['pay_status']) eq 0">selected="selected"</if>>{%PAY_STATUS_0}</option> <option value="1" <if condition="intval($_REQUEST['pay_status']) eq 1">selected="selected"</if>>{%PAY_STATUS_1}</option> <option value="2" <if condition="intval($_REQUEST['pay_status']) eq 2">selected="selected"</if>>{%PAY_STATUS_2}</option> </select> {%DELIVERY_STATUS_S}: <select name="delivery_status"> <option value="-1" <if condition="intval($_REQUEST['delivery_status']) eq -1">selected="selected"</if>>{%ALL}</option> <option value="0" <if condition="intval($_REQUEST['delivery_status']) eq 0">selected="selected"</if>>{%ORDER_DELIVERY_STATUS_0}</option> <option value="1" <if condition="intval($_REQUEST['delivery_status']) eq 1">selected="selected"</if>>{%ORDER_DELIVERY_STATUS_1}</option> <option value="2" <if condition="intval($_REQUEST['delivery_status']) eq 2">selected="selected"</if>>{%ORDER_DELIVERY_STATUS_2}</option> <option value="5" <if condition="intval($_REQUEST['delivery_status']) eq 5">selected="selected"</if>>{%ORDER_DELIVERY_STATUS_5}</option> </select> {%EXTRA_STATUS_S}: <select name="extra_status"> <option value="-1" <if condition="intval($_REQUEST['extra_status']) eq -1">selected="selected"</if>>{%ALL}</option> <option value="0" <if condition="intval($_REQUEST['extra_status']) eq 0">selected="selected"</if>>{%EXTRA_STATUS_0}</option> <option value="1" <if condition="intval($_REQUEST['extra_status']) eq 1">selected="selected"</if>>{%EXTRA_STATUS_1}</option> <option value="2" <if condition="intval($_REQUEST['extra_status']) eq 2">selected="selected"</if>>{%EXTRA_STATUS_2}</option> </select> {%AFTER_SALE_S}: <select name="after_sale"> <option value="-1" <if condition="intval($_REQUEST['after_sale']) eq -1">selected="selected"</if>>{%ALL}</option> <option value="0" <if condition="intval($_REQUEST['after_sale']) eq 0">selected="selected"</if>>{%AFTER_SALE_0}</option> <option value="1" <if condition="intval($_REQUEST['after_sale']) eq 1">selected="selected"</if>>{%AFTER_SALE_1}</option> </select> <input type="hidden" value="DealOrder" name="m" /> <input type="hidden" value="deal_index" name="a" /> </div> </form> <div class="blank5"></div> <html:list id="dataTable" style="dataTable" name="deal_order" checkbox="true" action="true" datasource="list" show="id:{%ID}|50px,order_sn|get_order_item=$deal_order['id']:{%ORDER_SN},user_id|get_user_name:{%USER_NAME},total_price|format_price:{%PAY_AMOUNT},pay_amount|format_price:{%PAID_AMOUNT} ,refund_status|get_refund_status:退款申请 ,create_time|to_date:{%ORDER_CREATE_TIME},pay_status|get_pay_status:{%PAYMENT_STATUS},delivery_status|get_delivery_status=$deal_order['id']:{%DELIVERY_STATUS} ,extra_status|get_extra_status:{%EXTRA_STATUS} ,after_sale|get_after_sale=$deal_order['order_status']:{%AFTER_SALE}" actionlist="id|get_handle" /> <div class="blank5"></div> <div class="page">{$page}</div> </div> <include file="Public:footer" />
{ "content_hash": "588334da3e6075776edf6a6f05e1da6d", "timestamp": "", "source": "github", "line_count": 202, "max_line_length": 187, "avg_line_length": 37.757425742574256, "alnum_prop": 0.6074472269568638, "repo_name": "hushulin/zsh_admin", "id": "74c100d8a23b07bbba874ea9c77d7ccd05ceef1b", "size": "7683", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "admin/Tpl/default/DealOrder/deal_index.html", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "232389" }, { "name": "Java", "bytes": "81125" }, { "name": "JavaScript", "bytes": "1903729" }, { "name": "PHP", "bytes": "3340014" }, { "name": "Perl", "bytes": "3676" }, { "name": "Shell", "bytes": "1278" } ] }
Types for Google Cloud Documentai v1beta3 API ============================================= .. automodule:: google.cloud.documentai_v1beta3.types :members: :show-inheritance:
{ "content_hash": "95f405f1c7467dad6b5b821c38ee7a25", "timestamp": "", "source": "github", "line_count": 6, "max_line_length": 53, "avg_line_length": 30.666666666666668, "alnum_prop": 0.5652173913043478, "repo_name": "googleapis/python-documentai", "id": "31b489da1ca70e4fa7001a2a9cf8e7ccf972cbaf", "size": "184", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "docs/documentai_v1beta3/types.rst", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Dockerfile", "bytes": "2050" }, { "name": "Python", "bytes": "1819136" }, { "name": "Shell", "bytes": "30672" } ] }
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <base data-ice="baseUrl"> <title data-ice="title">API Document</title> <link type="text/css" rel="stylesheet" href="css/style.css"> <link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css"> <script src="script/prettify/prettify.js"></script> <script src="script/manual.js"></script> </head> <body class="layout-container" data-ice="rootContainer"> <header> <a href="./">Home</a> <a href="identifiers.html">Reference</a> <a href="source.html">Source</a> <a data-ice="repoURL" href="https://github.com/killercrush/music-tempo" class="repo-url-github">Repository</a> <div class="search-box"> <span> <img src="./image/search.png"> <span class="search-input-edge"></span><input class="search-input"><span class="search-input-edge"></span> </span> <ul class="search-result"></ul> </div> </header> <nav class="navigation" data-ice="nav"><div> <ul> <li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/Agent.js~Agent.html">Agent</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/BeatTracking.js~BeatTracking.html">BeatTracking</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/FFT.js~FFT.html">FFT</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/MusicTempo.js~MusicTempo.html">MusicTempo</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/OnsetDetection.js~OnsetDetection.html">OnsetDetection</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/TempoInduction.js~TempoInduction.html">TempoInduction</a></span></span></li> </ul> </div> </nav> <div class="content" data-ice="content"><div data-ice="index" class="github-markdown"><h2 id="description">Description</h2> <p>Javascript-library for finding out tempo (BPM) of a song and beat tracking. It uses an algorithm <a href="http://www.eecs.qmul.ac.uk/~simond/pub/2001/jnmr.pdf">&quot;Beatroot&quot;</a> authored by <a href="http://www.eecs.qmul.ac.uk/~simond/">Simon Dixon</a></p> <p><strong><a href="https://killercrush.github.io/music-tempo/example/example-advanced.html">Example App</a></strong></p> <p><strong><a href="https://killercrush.github.io/music-tempo/docs/index.html">Docs</a></strong></p> <h2 id="instalation">Instalation</h2> <p>In a browser</p> <pre><code class="lang-html"><code class="source-code prettyprint">&lt;script src=&quot;music-tempo.min.js&quot;&gt;&lt;/script&gt;</code> </code></pre> <p>Using npm:</p> <pre><code class="lang-shell"><code class="source-code prettyprint">$ npm i --save music-tempo</code> </code></pre> <h2 id="usage">Usage</h2> <p>Pass to the constructor MusicTempo the buffer that contains data in the following format: non-interleaved IEEE754 32-bit linear PCM with a nominal range between -1 and +1, that is, 32bits floating point buffer, with each samples between -1.0 and 1.0. This format is used in the <a href="https://developer.mozilla.org/en/docs/Web/API/AudioBuffer">AudioBuffer</a> interface of <a href="https://developer.mozilla.org/en/docs/Web/API/Web_Audio_API">Web Audio API</a>. The object returned by the constructor contain properties <code>tempo</code> - tempo value in beats per minute and <code>beats</code> - array with beat times in seconds.</p> <h3 id="browser">Browser</h3> <pre><code class="lang-javascript"><code class="source-code prettyprint">var context = new AudioContext(); var fileInput = document.getElementById(&quot;fileInput&quot;); fileInput.onchange = function () { var files = fileInput.files; if (files.length == 0) return; var reader = new FileReader(); reader.onload = function(fileEvent) { context.decodeAudioData(fileEvent.target.result, calcTempo); } reader.readAsArrayBuffer(files[0]); } var calcTempo = function (buffer) { var audioData = []; // Take the average of the two channels if (buffer.numberOfChannels == 2) { var channel1Data = buffer.getChannelData(0); var channel2Data = buffer.getChannelData(1); var length = channel1Data.length; for (var i = 0; i &lt; length; i++) { audioData[i] = (channel1Data[i] + channel2Data[i]) / 2; } } else { audioData = buffer.getChannelData(0); } var mt = new MusicTempo(audioData); console.log(mt.tempo); console.log(mt.beats); }</code> </code></pre> <h3 id="node-js">Node.js</h3> <p>In Node.js environment can be used <a href="https://github.com/sebpiq/node-web-audio-api">node-web-audio-api library</a></p> <pre><code class="lang-javascript"><code class="source-code prettyprint">var AudioContext = require(&quot;web-audio-api&quot;).AudioContext; var MusicTempo = require(&quot;music-tempo&quot;); var fs = require(&quot;fs&quot;); var calcTempo = function (buffer) { var audioData = []; // Take the average of the two channels if (buffer.numberOfChannels == 2) { var channel1Data = buffer.getChannelData(0); var channel2Data = buffer.getChannelData(1); var length = channel1Data.length; for (var i = 0; i &lt; length; i++) { audioData[i] = (channel1Data[i] + channel2Data[i]) / 2; } } else { audioData = buffer.getChannelData(0); } var mt = new MusicTempo(audioData); console.log(mt.tempo); console.log(mt.beats); } var data = fs.readFileSync(&quot;songname.mp3&quot;); var context = new AudioContext(); context.decodeAudioData(data, calcTempo);</code> </code></pre> <h2 id="other">Other</h2> <h3 id="tests">Tests</h3> <p>Requires <a href="https://www.npmjs.com/package/mocha">mocha</a> and <a href="https://www.npmjs.com/package/chai">chai</a></p> <pre><code class="lang-shell"><code class="source-code prettyprint">$ npm test</code> </code></pre> <h3 id="documentation">Documentation</h3> <p>Requires <a href="https://www.npmjs.com/package/esdoc">esdoc</a></p> <pre><code class="lang-shell"><code class="source-code prettyprint">$ esdoc</code> </code></pre> <h3 id="build">Build</h3> <p>Requires <a href="https://www.npmjs.com/package/gulp">gulp</a> and <a href="https://www.npmjs.com/package/gulp-babel">babel</a>. Other dependencies can be found in <code>package.json</code></p> <pre><code class="lang-shell"><code class="source-code prettyprint">$ gulp build</code> </code></pre> <h2 id="license">License</h2> <p><a href="LICENSE">MIT License</a></p> </div> </div> <footer class="footer"> Generated by <a href="https://esdoc.org">ESDoc<span data-ice="esdocVersion">(0.5.2)</span><img src="./image/esdoc-logo-mini-black.png"></a> </footer> <script src="script/search_index.js"></script> <script src="script/search.js"></script> <script src="script/pretty-print.js"></script> <script src="script/inherited-summary.js"></script> <script src="script/test-summary.js"></script> <script src="script/inner-link.js"></script> <script src="script/patch-for-local.js"></script> </body> </html>
{ "content_hash": "80760b15132fdb522b45cc25f5ce4d16", "timestamp": "", "source": "github", "line_count": 153, "max_line_length": 640, "avg_line_length": 47.248366013071895, "alnum_prop": 0.6909669387190482, "repo_name": "killercrush/music-tempo", "id": "a888cc23d62e89545ff341bfa153eae6009effd7", "size": "7229", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "docs/index.html", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "31699" }, { "name": "JavaScript", "bytes": "386755" } ] }
<?php use app\models\general\GeneralLabel; use yii\helpers\Html; /* @var $this yii\web\View */ /* @var $model app\models\RefKumpulan */ $this->title = GeneralLabel::createTitle.' '.GeneralLabel::kumpulan; $this->params['breadcrumbs'][] = ['label' => GeneralLabel::kumpulan, 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="ref-kumpulan-create"> <h1><?= Html::encode($this->title) ?></h1> <?= $this->render('_form', [ 'model' => $model, ]) ?> </div>
{ "content_hash": "86776af9e8daf5817598ff245cede19d", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 89, "avg_line_length": 21.333333333333332, "alnum_prop": 0.599609375, "repo_name": "hung101/kbs", "id": "dae424ea006f00ae9a13374305fb5433975bba5b", "size": "512", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "frontend/views/ref-kumpulan/create.php", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "ApacheConf", "bytes": "113" }, { "name": "Batchfile", "bytes": "1541" }, { "name": "CSS", "bytes": "4999813" }, { "name": "HTML", "bytes": "32884422" }, { "name": "JavaScript", "bytes": "38543640" }, { "name": "PHP", "bytes": "30558998" }, { "name": "PowerShell", "bytes": "936" }, { "name": "Shell", "bytes": "5561" } ] }
End of preview.

No dataset card yet

Downloads last month
3