text
stringlengths
2
1.04M
meta
dict
<p align="center"> <img width="250" src="./docs/markvis-logo.png" alt="logo" /> </p> # Markvis > Make visualization in markdown. [![NPM version](https://img.shields.io/npm/v/markvis.svg?style=flat-square)](https://npmjs.com/package/markvis) [![NPM downloads](https://img.shields.io/npm/dm/markvis.svg?style=flat-square)](https://npmjs.com/package/markvis) [![Build](https://travis-ci.org/geekplux/markvis.svg?style=flat-square)](https://travis-ci.org/geekplux/markvis) [![Coverage](https://coveralls.io/repos/github/geekplux/markvis/badge.svg?style=flat-square)](https://coveralls.io/github/geekplux/markvis) [![donate](https://img.shields.io/badge/$-donate-ff69b4.svg?maxAge=2592000&style=flat-square)](https://geekplux.github.io/donate) [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fgeekplux%2Fmarkvis.svg?type=shield)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fgeekplux%2Fmarkvis?ref=badge_shield) - [Documentation](https://markvis.js.org) - [Online Editor](https://markvis-editor.js.org) ## Preview ![](./docs/preview.png) # Quick Start ## Install ```bash yarn add markvis --save npm install markvis --save ``` ## Usage ```js const md = require('markdown-it')() const vis = require('markvis') const d3 = require('d3') // in browser environment const d3node = require('d3-node') // in node environment md.use(vis).render(` your markdown content `, { d3, // in browser environment d3node // in node environment }) ``` there are [Examples](https://github.com/geekplux/markvis/tree/master/examples) which in node environment. # Motivation We often publish articles enriched with data, since data make them more convincing and easy to interpret. Hence, techniques that enable the embedding of visualization into texts are of great importance. However, the most frequently used method now is to export charts as images, upload them into cloud, and then paste them into the editor. It is a tedious process from the perspective of a writer. Besides, image loading costs much more time than that of DOM elements, which leads to poor experience from the perspective of a reader. # API There are many options you can config and below is some in common. But you'd better to config the options which related to chart style in chart options, such as [markvis-bar](https://github.com/geekplux/markvis-bar), [markvis-line](https://github.com/geekplux/markvis-line), [markvis-pie](https://github.com/geekplux/markvis-pie). ## options ##### data - Type: `Array` Data from file or web processed by d3 library. ##### d3 - Type: `Object` [d3](https://github.com/d3/d3) library which used in **browser** environment. ##### d3node - Type: `Function` [d3-node](https://github.com/d3-node/d3-node) constructor which used in **node** environment. ##### layout - Type: `String` Name of chart layout. You can customize any chart layout you want. ##### render - Type: `Function` Customized renderer to render a new layout you want. ##### container - Type: `String` - Default: `<div id="container"><h2>Bar Chart</h2><div id="chart"></div></div>` DOM contained the visualization result. ##### selector - Type: `String` - Default: `'#chart'` DOM selector in container. ##### style - Type: `String`<br> - Default: `''` Chart style. ##### width - Type: `Number`<br> - Default: `960` SVG width for chart. ##### height - Type: `Number`<br> - Default: `500` SVG height for chart. ##### margin - Type: `Object`<br> - Default: `{ top: 20, right: 20, bottom: 20, left: 20 }` Margin of the first <g> wrapper in SVG, usually used to add axis. # Contributing 1. Fork it! 2. Create your feature branch: `git checkout -b my-new-feature` 3. Commit your changes: `git commit -am 'Add some feature'` 4. Push to the branch: `git push origin my-new-feature` 5. Submit a pull request :D # LICENSE **markvis** © [geekplux](https://github.com/geekplux), Released under the [MIT](./LICENSE) License.<br> Authored and maintained by geekplux with help from contributors ([list](https://github.com/geekplux/markvis/contributors)). > [geekplux.com](http://geekplux.com) · GitHub [@geekplux](https://github.com/geekplux) · Twitter [@geekplux](https://twitter.com/geekplux) [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fgeekplux%2Fmarkvis.svg?type=large)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fgeekplux%2Fmarkvis?ref=badge_large)
{ "content_hash": "67412c052e22965dbef8ff5ef846a765", "timestamp": "", "source": "github", "line_count": 150, "max_line_length": 609, "avg_line_length": 29.82, "alnum_prop": 0.7165213503241672, "repo_name": "geekplux/markvis", "id": "02fab435c16a1644215d39fd3b759ae3265b4be5", "size": "4476", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "1182" } ], "symlink_target": "" }
_<sup><sup>[www.codever.land/bookmarks/t/cluster-management](https://www.codever.land/bookmarks/t/cluster-management)</sup></sup>_ --- #### [PM2 - Node.js clustering made easy with PM2](https://pm2.io/blog/2018/04/20/Node-js-clustering-made-easy-with-PM2) _<sup>https://pm2.io/blog/2018/04/20/Node-js-clustering-made-easy-with-PM2</sup>_ How to start NodeJS in Cluster mode with PM2: * **tags**: [node.js](../tagged/node.js.md), [pm2](../tagged/pm2.md), [cluster-computing](../tagged/cluster-computing.md), [cluster-management](../tagged/cluster-management.md), [scalability](../tagged/scalability.md) --- #### [Apache Aurora](https://aurora.apache.org) _<sup>https://aurora.apache.org</sup>_ Mesos framework for long-running services and cron jobs. * **tags**: [java](../tagged/java.md), [cluster-management](../tagged/cluster-management.md) --- #### [Apache Mesos](https://mesos.apache.org) _<sup>https://mesos.apache.org</sup>_ Abstracts CPU, memory, storage, and other compute resources away from machines. * **tags**: [java](../tagged/java.md), [cluster-management](../tagged/cluster-management.md) --- #### [Singularity](http://getsingularity.com) _<sup>http://getsingularity.com</sup>_ Mesos framework that makes deployment and operations easy. It supports web services, background workers, scheduled jobs, and one-off tasks. * **tags**: [java](../tagged/java.md), [cluster-management](../tagged/cluster-management.md) ---
{ "content_hash": "b9b963b5964bc0dc993a968171611e51", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 217, "avg_line_length": 51.285714285714285, "alnum_prop": 0.7075208913649025, "repo_name": "Codingpedia/bookmarks", "id": "e17a1b5d797069812684b5ceb4489bce19b72347", "size": "1536", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "tagged/cluster-management.md", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
The structure ```Rhoban::IKWalkParameters``` has following parameters: * ```distHipToKnee```: Leg model distance between hip and knee rotation axes (in meters). * ```distKneeToAnkle```: Leg model distance between knee and ankle rotation axes (in meters). * ```distAnkleToGround```: Leg model distance between ankle rotation axis and the foot center (in meters). * ```distFeetLateral```: Leg model lateral distance between the two feet center (in meters). * ```enabledGain```: Allows for smoothing the walk stopping and starting. =0 stops the walk. =1 starts the walk. * ```stepGain```: Footstep forward (X) length (in meters). <0 goes backward. Note that you may have to find the actual value offset for the robot neutral. * ```lateralGain```: Footstep lateral (Y) length (in meters). =0 goes straight. >0 makes lateral steps on the left. <0 makes lateral steps on the right. * ```turnGain```: Footstep rotation angle (in radians). =0 goes straight. >0 turns on the left. <0 turns steps on the right. * ```freq```: Complete walk cycle (two steps) frequency (in Hertz). * ```supportPhaseRatio```: The length of the double support phase in walk cycle. =0 is full single support, no double support phase. =1 is full double support phase. * ```footYOffset```: Lateral distance offset between the two foot (in meters). * ```riseGain```: Foot height (Z) during flying backward to forward (in meters). * ```swingGain```: Amplitude of lateral oscillation of the trunk with respect to the feet (in meters). * ```swingPhase```: Phase shift used to desynchronize the lateral trunk oscillation and footsteps movement. * ```trunkXOffset```: Trunk forward (X) translation with respect to the feet (in meters). >0 goes forward. <0 goes backward. * ```trunkYOffset```: Trunk lateral (Y) translation with respect to the feet (in meters). >0 goes on the left. <0 goes on the right. * ```trunkZOffset```: Trunk height from the ground. =0 is maximum height (in meters). >0 is lower to the ground. * ```trunkPitch```: Trunk pitch (Y) orientation. >0 bends forward (in radians). <0 bends backward. * ```trunkRoll```: Trunk roll (X) orientation. >0 bends on the left (in radians). <0 bends on the right. * ```swingPause```: * ```swingVel```: * ```stepUpVel```: * ```stepDownVel```: * ```riseUpVel```: * ```riseDownVel```: Additional offset on left and right foot target position (in meters). They must be set to zero if not used. * ```extraLeftX``` * ```extraLeftY``` * ```extraLeftZ``` * ```extraRightX``` * ```extraRightY``` * ```extraRightZ``` Additional offset on left and right foot target orientation (in radians). They must be set to zero if not used. * ```extraLeftYaw``` * ```extraLeftPitch``` * ```extraLeftRoll``` * ```extraRightYaw``` * ```extraRightPitch``` * ```extraRightRoll``` The ```extra``` offsets can for example be used to implement a dynamic kick on top of the walk engine.
{ "content_hash": "b5045c0a862686f291aed3e8f2d4a2d6", "timestamp": "", "source": "github", "line_count": 50, "max_line_length": 165, "avg_line_length": 57.88, "alnum_prop": 0.7004146510020732, "repo_name": "Rhoban/IKWalk", "id": "5ae9f26fb76130059593e26030d60b656b469697", "size": "2920", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Docs/parameters.md", "mode": "33188", "license": "mit", "language": [ { "name": "C++", "bytes": "56196" }, { "name": "CMake", "bytes": "703" } ], "symlink_target": "" }
layout: page title: "Sam Gill" comments: true description: "blanks" keywords: "Sam Gill,CU,Boulder" --- <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script src="https://dl.dropboxusercontent.com/s/pc42nxpaw1ea4o9/highcharts.js?dl=0"></script> <!-- <script src="../assets/js/highcharts.js"></script> --> <style type="text/css">@font-face { font-family: "Bebas Neue"; src: url(https://www.filehosting.org/file/details/544349/BebasNeue Regular.otf) format("opentype"); } h1.Bebas { font-family: "Bebas Neue", Verdana, Tahoma; } </style> </head> #### TEACHING INFORMATION **College**: College of Arts and Sciences **Classes taught**: RLST 1620, RLST 3010, RLST 3020, RLST 3820, RLST 3838, RLST 4820 #### RLST 1620: Religious Dimension in Human Experience **Terms taught**: Fall 2006, Spring 2007, Fall 2015 **Instructor rating**: 4.8 **Standard deviation in instructor rating**: 0.21 **Average grade** (4.0 scale): 2.96 **Standard deviation in grades** (4.0 scale): 0.05 **Average workload** (raw): 1.98 **Standard deviation in workload** (raw): 0.25 #### RLST 3010: Religion and the Senses **Terms taught**: Spring 2013, Fall 2013, Fall 2014, Spring 2015, Fall 2016 **Instructor rating**: 4.81 **Standard deviation in instructor rating**: 0.45 **Average grade** (4.0 scale): 3.15 **Standard deviation in grades** (4.0 scale): 0.2 **Average workload** (raw): 2.2 **Standard deviation in workload** (raw): 0.15 #### RLST 3020: Advanced Writing in Religious Studies **Terms taught**: Fall 2006, Fall 2008, Fall 2009, Fall 2010, Fall 2011, Fall 2012 **Instructor rating**: 5.06 **Standard deviation in instructor rating**: 0.5 **Average grade** (4.0 scale): 3.04 **Standard deviation in grades** (4.0 scale): 0.25 **Average workload** (raw): 3.12 **Standard deviation in workload** (raw): 0.55 #### RLST 3820: Topics in Religious Studies **Terms taught**: Spring 2007, Spring 2008, Spring 2010, Spring 2011, Spring 2012 **Instructor rating**: 5.34 **Standard deviation in instructor rating**: 0.37 **Average grade** (4.0 scale): 3.18 **Standard deviation in grades** (4.0 scale): 0.22 **Average workload** (raw): 2.42 **Standard deviation in workload** (raw): 0.14 #### RLST 3838: Dancing, Religion, and Culture **Terms taught**: Fall 2008, Spring 2009, Fall 2009, Fall 2010, Fall 2011, Spring 2012, Fall 2012, Spring 2013, Fall 2014 **Instructor rating**: 4.89 **Standard deviation in instructor rating**: 0.51 **Average grade** (4.0 scale): 3.13 **Standard deviation in grades** (4.0 scale): 0.21 **Average workload** (raw): 2.06 **Standard deviation in workload** (raw): 0.16 #### RLST 4820: SEM-JONTHN SMTH&STDY REL **Terms taught**: Spring 2008, Spring 2009, Spring 2010 **Instructor rating**: 5.59 **Standard deviation in instructor rating**: 0.28 **Average grade** (4.0 scale): 3.39 **Standard deviation in grades** (4.0 scale): 0.11 **Average workload** (raw): 3.05 **Standard deviation in workload** (raw): 0.16
{ "content_hash": "1057baa63e941f2184b422798c0781f0", "timestamp": "", "source": "github", "line_count": 122, "max_line_length": 121, "avg_line_length": 24.84426229508197, "alnum_prop": 0.6875618607720224, "repo_name": "nikhilrajaram/nikhilrajaram.github.io", "id": "3658a9b0d14014f5d4cd843cc2fdf2fa544e35c5", "size": "3035", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "instructors/Sam_Gill.md", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "15727" }, { "name": "HTML", "bytes": "48339721" }, { "name": "Python", "bytes": "9692" }, { "name": "Ruby", "bytes": "5940" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>elpi: Not compatible 👼</title> <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" /> <link href="../../../../../bootstrap.min.css" rel="stylesheet"> <link href="../../../../../bootstrap-custom.css" rel="stylesheet"> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <script src="../../../../../moment.min.js"></script> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <div class="container"> <div class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="../..">clean / released</a></li> <li class="active"><a href="">8.5.0~camlp4 / elpi - 1.2.0</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> elpi <small> 1.2.0 <span class="label label-info">Not compatible 👼</span> </small> </h1> <p>📅 <em><script>document.write(moment("2022-06-22 03:35:28 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-06-22 03:35:28 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-num base Num library distributed with the OCaml compiler base-threads base base-unix base camlp4 4.05+1 Camlp4 is a system for writing extensible parsers for programming languages conf-findutils 1 Virtual package relying on findutils coq 8.5.0~camlp4 Formal proof management system num 0 The Num library for arbitrary-precision integer and rational arithmetic ocaml 4.05.0 The OCaml compiler (virtual package) ocaml-base-compiler 4.05.0 Official 4.05.0 release ocaml-config 1 OCaml Switch Configuration ocamlbuild 0.14.1 OCamlbuild is a build system with builtin rules to easily build most OCaml projects # opam file: opam-version: &quot;2.0&quot; name: &quot;coq-elpi&quot; maintainer: &quot;Enrico Tassi &lt;[email protected]&gt;&quot; authors: [ &quot;Enrico Tassi&quot; ] license: &quot;LGPL 2.1&quot; homepage: &quot;https://github.com/LPCIC/coq-elpi&quot; bug-reports: &quot;https://github.com/LPCIC/coq-elpi/issues&quot; dev-repo: &quot;git+https://github.com/LPCIC/coq-elpi&quot; build: [ make &quot;COQBIN=%{bin}%/&quot; &quot;ELPIDIR=%{prefix}%/lib/elpi&quot; ] install: [ make &quot;install&quot; &quot;COQBIN=%{bin}%/&quot; &quot;ELPIDIR=%{prefix}%/lib/elpi&quot; ] depends: [ &quot;elpi&quot; {&gt;= &quot;1.8.0&quot; &amp; &lt; &quot;1.9.0~&quot;} &quot;coq&quot; { (&gt;= &quot;8.10.0&quot; &amp; &lt; &quot;8.11~&quot;) | (= &quot;8.10.dev&quot;) } ] synopsis: &quot;Elpi extension language for Coq&quot; description: &quot;&quot;&quot; Coq-elpi provides a Coq plugin that embeds ELPI. It also provides a way to embed Coq&#39;s terms into λProlog using the Higher-Order Abstract Syntax approach and a way to read terms back. In addition to that it exports to ELPI a set of Coq&#39;s primitives, e.g. printing a message, accessing the environment of theorems and data types, defining a new constant and so on. For convenience it also provides a quotation and anti-quotation for Coq&#39;s syntax in λProlog. E.g. `{{nat}}` is expanded to the type name of natural numbers, or `{{A -&gt; B}}` to the representation of a product by unfolding the `-&gt;` notation. Finally it provides a way to define new vernacular commands and new tactics.&quot;&quot;&quot; url { src: &quot;https://github.com/LPCIC/coq-elpi/archive/v1.2.0.tar.gz&quot; checksum: &quot;sha256=58aef9596e6ad74d9f230abc34171dafaa39da93a4f1bf6f07f69904360c2c9c&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-elpi.1.2.0 coq.8.5.0~camlp4</code></dd> <dt>Return code</dt> <dd>5120</dd> <dt>Output</dt> <dd><pre>[NOTE] Package coq is already installed (current version is 8.5.0~camlp4). The following dependencies couldn&#39;t be met: - coq-elpi -&gt; coq = 8.10.dev no matching version 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-elpi.1.2.0</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Install dependencies</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Install 🚀</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Installation size</h2> <p>No files were installed.</p> <h2>Uninstall 🧹</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Missing removes</dt> <dd> none </dd> <dt>Wrong removes</dt> <dd> none </dd> </dl> </div> </div> </div> <hr/> <div class="footer"> <p class="text-center"> Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣 </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
{ "content_hash": "ca559bbfc650cce66295ed2eab1cc267", "timestamp": "", "source": "github", "line_count": 173, "max_line_length": 159, "avg_line_length": 43.630057803468205, "alnum_prop": 0.5577636459989401, "repo_name": "coq-bench/coq-bench.github.io", "id": "55f777c2aaa205a580994da8fb1fa6ece443377c", "size": "7575", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "clean/Linux-x86_64-4.05.0-2.0.1/released/8.5.0~camlp4/elpi/1.2.0.html", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
Comments = new Meteor.Collection('comments'); Meteor.methods({ comment: function(commentAttributes) { var user = Meteor.user(); var post = Posts.findOne(commentAttributes.postId); // ensure the user is logged in if (!user) throw new Meteor.Error(401, "You need to login to make comments"); if (!commentAttributes.body) throw new Meteor.Error(422, 'Please write some content'); if (!post) throw new Meteor.Error(422, 'You must comment on a post'); comment = _.extend(_.pick(commentAttributes, 'postId', 'body'), { userId: user._id, author: user.username, submitted: new Date().getTime() }); // update the post with the number of comments Posts.update(comment.postId, {$inc: {commentsCount: 1}}); // create the comment, save the id comment._id = Comments.insert(comment); // now create a notification, informing the user that there's been a comment createCommentNotification(comment); return comment._id; } });
{ "content_hash": "a084be3f2954cf9d1c94dd9d1194bd3f", "timestamp": "", "source": "github", "line_count": 34, "max_line_length": 80, "avg_line_length": 30.823529411764707, "alnum_prop": 0.6393129770992366, "repo_name": "shantha-kumara/group-radio", "id": "8558ac1ddd5cf6ba4f831eb80003504a8c10f80c", "size": "1048", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "collections/comments.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "6488" }, { "name": "JavaScript", "bytes": "19241" } ], "symlink_target": "" }
package org.fiteagle.core.aaa.authentication; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.StringWriter; import java.security.Key; import java.security.KeyStore; import java.security.KeyStore.Entry; import java.security.KeyStore.PasswordProtection; import java.security.KeyStore.PrivateKeyEntry; import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException; import java.security.PrivateKey; import java.security.UnrecoverableEntryException; import java.security.cert.Certificate; import java.security.cert.CertificateEncodingException; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; import java.util.ArrayList; import java.util.Enumeration; import java.util.LinkedList; import java.util.List; import org.bouncycastle.asn1.x500.RDN; import org.bouncycastle.asn1.x500.X500Name; import org.bouncycastle.asn1.x500.style.BCStrictStyle; import org.bouncycastle.asn1.x500.style.IETFUtils; import org.bouncycastle.cert.jcajce.JcaX509CertificateHolder; import org.bouncycastle.openssl.PEMWriter; import org.fiteagle.core.aaa.authentication.x509.X509Util; import org.fiteagle.core.config.preferences.FiteaglePreferences; import org.fiteagle.core.config.preferences.FiteaglePreferencesXML; public class KeyStoreManagement { private FiteaglePreferences preferences; private final String DEFAULT_KEYSTORE_LOCATION=System.getProperty("jboss.server.config.dir")+System.getProperty("file.separator")+"jetty-ssl.keystore"; private final String DEFAULT_KEYSTORE_PASSWORD = "jetty6"; private final String DEFAULT_CA_ALIAS ="root"; private final String DEFAULT_CA_PRK_PASS = "jetty6"; private final String DEFAULT_PRK_PASS= "jetty6"; private final String DEFAULT_TRUSTSTORE_LOCATION=System.getProperty("jboss.server.config.dir")+System.getProperty("file.separator")+"jetty-ssl.truststore"; private final String DEFAULT_TRUSTSTORE_PASSWORD = DEFAULT_KEYSTORE_PASSWORD; private final String DEFAULT_SERVER_ALIAS ="root"; private final String DEFAULT_SA_ALIAS="fiteagleSA"; private final String DEFAULT_SA_PASS="changeit"; private final String DEFAULT_RESOURCE_STORE_LOCATION = System.getProperty("jboss.server.config.dir")+System.getProperty("file.separator")+"resourceCertificateStore"; private final String DEFAULT_RESOURCE_STORE_PASS = "changeit"; private static KeyStoreManagement keyStoreManagement; private enum StoreType{ KEYSTORE,TRUSTSTORE,RESOURCESTORE; } public static KeyStoreManagement getInstance(){ if(keyStoreManagement == null) keyStoreManagement = new KeyStoreManagement(); return keyStoreManagement; } private KeyStoreManagement(){ this.preferences = new FiteaglePreferencesXML(this.getClass()); if(preferences.get("CAAlias") == null){ preferences.put("CAAlias", DEFAULT_CA_ALIAS); } if(preferences.get("keystore_pass") == null){ preferences.put("keystore_pass", DEFAULT_KEYSTORE_PASSWORD); } if(preferences.get("keystore") == null){ preferences.put("keystore", DEFAULT_KEYSTORE_LOCATION); } if(preferences.get("prk_pass") == null){ preferences.put("prk_pass", DEFAULT_PRK_PASS); } if(preferences.get("truststore") == null){ preferences.put("truststore", DEFAULT_TRUSTSTORE_LOCATION); } if(preferences.get("truststore_pass") == null){ preferences.put("truststore_pass", DEFAULT_TRUSTSTORE_PASSWORD); } if(preferences.get("server_alias")== null){ preferences.put("server_alias", DEFAULT_SERVER_ALIAS); } if(preferences.get("ca_prkey_pass")==null){ preferences.put("ca_prkey_pass", DEFAULT_CA_PRK_PASS); } if(preferences.get("SAAlias")==null) preferences.put("SAAlias", DEFAULT_SA_ALIAS); if(preferences.get("sa_prkey_pass")==null) preferences.put("sa_prkey_pass", DEFAULT_SA_PASS); if(preferences.get("resourceStore")==null) preferences.put("resourceStore", DEFAULT_RESOURCE_STORE_LOCATION); if(preferences.get("resourceStore_pass")==null) preferences.put("resourceStore_pass", DEFAULT_RESOURCE_STORE_PASS); } protected KeyStore loadKeyStore(StoreType type) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException{ KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); FileInputStream fis = new FileInputStream(getStorePath(type)); char[] pass = getStorePass(type); ks.load(fis, pass); return ks; } private char[] getStorePass(StoreType type) { switch(type) { case KEYSTORE: return getKeyStorePassword(); case TRUSTSTORE: return getTrustStorePassword(); case RESOURCESTORE: return getResourceStorePass(); default: return getTrustStorePassword(); } } private String getStorePath(StoreType type) { switch(type) { case KEYSTORE: return getKeyStorePath(); case TRUSTSTORE: return getTrustStorePath(); case RESOURCESTORE: return getResourceStorePath(); default: return getTrustStorePath(); } } private char[] getTrustStorePassword() { return preferences.get("truststore_pass").toCharArray(); } private String getTrustStorePath() { return preferences.get("truststore"); } protected void storeCertificate(String alias, X509Certificate cert, StoreType type) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException { KeyStore ks = loadKeyStore(type); ks.setCertificateEntry(alias, cert); FileOutputStream fos = new FileOutputStream(getStorePath(type)); char[] pass = getStorePass(type); ks.store(fos, pass); } private String getCAAlias() { String alias = preferences.get("CAAlias"); return alias; } private String getKeyStorePath() { return preferences.get("keystore"); } public char[] getPrivateKeyPassword(){ return preferences.get("prk_pass").toCharArray(); } private char[] getKeyStorePassword() { return preferences.get("keystore_pass").toCharArray(); } public PrivateKey getCAPrivateKey() throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException, UnrecoverableEntryException { PrivateKey privateKey = null; KeyStore ks = loadKeyStore(StoreType.TRUSTSTORE); PasswordProtection protection = new PasswordProtection(getCAPrivateKeyPassword()); Entry keyStoreEntry = ks.getEntry(getCAAlias(), protection); if(keyStoreEntry instanceof PrivateKeyEntry){ PrivateKeyEntry privateKeyEntry = (PrivateKeyEntry)keyStoreEntry; privateKey = privateKeyEntry.getPrivateKey(); }else { throw new PrivateKeyException(); } return privateKey; } private char[] getCAPrivateKeyPassword() { return preferences.get("ca_prkey_pass").toCharArray(); } protected X509Certificate getCACert() throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException { KeyStore ks = loadKeyStore(StoreType.TRUSTSTORE); X509Certificate caCert = (X509Certificate) ks.getCertificate(getCAAlias()); return caCert; } protected List<X509Certificate> getTrustedCerts() throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException { KeyStore ks = loadKeyStore(StoreType.TRUSTSTORE); List<X509Certificate> certificateList = new LinkedList<>(); for(Enumeration<String> aliases= ks.aliases(); aliases.hasMoreElements();){ certificateList.add((X509Certificate)(ks.getCertificate(aliases.nextElement()))); } return certificateList; } public List<String> getTrustedCertsCommonNames() throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException{ List<X509Certificate> certs; certs = getTrustedCerts(); List<String> certsAsStrings = new ArrayList<String>(); for(X509Certificate cert : certs){ certsAsStrings.add(getCertificateCommonName(cert)); } return certsAsStrings; } private String getCertificateCommonName(X509Certificate cert) throws CertificateEncodingException{ X500Name x500name = new JcaX509CertificateHolder(cert).getSubject(); RDN commonName = x500name.getRDNs(BCStrictStyle.CN)[0]; return IETFUtils.valueToString(commonName.getFirst().getValue()); } public String getTrustedCertificate(String commonName) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException{ for(X509Certificate cert : getTrustedCerts()){ if(getCertificateCommonName(cert).equals(commonName)){ return convertToPem(cert); } } return null; } public String getAllTrustedCertificates() throws IOException, KeyStoreException, NoSuchAlgorithmException, CertificateException { String all = ""; for(X509Certificate cert : getTrustedCerts()){ all+=convertToPem(cert); } return all; } private String convertToPem(X509Certificate cert) throws CertificateEncodingException, IOException{ StringWriter sw = new StringWriter(); PEMWriter pemwriter = new PEMWriter(sw); pemwriter.writeObject(cert); pemwriter.close(); return sw.toString(); } public X509Certificate[] getStoredCertificate(String alias) { try { KeyStore ks = loadKeyStore(StoreType.KEYSTORE); Certificate[] certChain = ks.getCertificateChain(alias); X509Certificate[] returnChain = new X509Certificate[certChain.length]; for(int i = 0; i<certChain.length; i++){ returnChain[i] = (X509Certificate) certChain[i]; } return returnChain; } catch (KeyStoreException | NoSuchAlgorithmException | CertificateException | IOException e) { throw new CertificateNotFoundException(); } } public PrivateKey getServerPrivateKey() throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException, UnrecoverableEntryException { PrivateKey privateKey = null; KeyStore ks = loadKeyStore(StoreType.KEYSTORE); PasswordProtection protection = new PasswordProtection(getPrivateKeyPassword()); Entry keyStoreEntry = ks.getEntry(getServerAlias(), protection); if(keyStoreEntry instanceof PrivateKeyEntry){ PrivateKeyEntry privateKeyEntry = (PrivateKeyEntry)keyStoreEntry; privateKey = privateKeyEntry.getPrivateKey(); }else { throw new PrivateKeyException(); } return privateKey; } private String getServerAlias() { return preferences.get("server_alias"); } public X509Certificate getSliceAuthorityCert() throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException { String sa_alias = preferences.get("SAAlias"); X509Certificate cert = (X509Certificate) loadKeyStore(StoreType.TRUSTSTORE).getCertificate(sa_alias); return cert; } public Key getSAPrivateKey() throws NoSuchAlgorithmException, CertificateException, KeyStoreException, IOException, UnrecoverableEntryException { PrivateKey privateKey = null; KeyStore ks = loadKeyStore(StoreType.TRUSTSTORE); PasswordProtection protection = new PasswordProtection(getSA_PrivateKeyPassword()); Entry keyStoreEntry = ks.getEntry(getSAAlias(), protection); if(keyStoreEntry instanceof PrivateKeyEntry){ PrivateKeyEntry privateKeyEntry = (PrivateKeyEntry)keyStoreEntry; privateKey = privateKeyEntry.getPrivateKey(); }else { throw new PrivateKeyException(); } return privateKey; } private String getSAAlias() { return preferences.get("SAAlias"); } private char[] getSA_PrivateKeyPassword() { return preferences.get("sa_prkey_pass").toCharArray(); } public X509Certificate getResourceCertificate(String alias) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException { KeyStore userCertStore = loadKeyStore(StoreType.RESOURCESTORE); if(userCertStore.containsAlias(alias)){ return (X509Certificate) userCertStore.getCertificate(alias); } throw new CertificateNotFoundException(); } private char[] getResourceStorePass() { return preferences.get("resourceStore_pass").toCharArray(); } private String getResourceStorePath() { return preferences.get("resourceStore"); } public void storeResourceCertificate(X509Certificate cert) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException { String alias = X509Util.getURN(cert).getSubjectAtDomain(); storeCertificate(alias, cert, StoreType.RESOURCESTORE); } public class PrivateKeyException extends RuntimeException { private static final long serialVersionUID = 2842186524464171483L; } public class CertificateNotFoundException extends RuntimeException { private static final long serialVersionUID = -3514307715237455008L; } public List<X509Certificate> getResourceCertificates(List<String> urns) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException { KeyStore ks = loadKeyStore(StoreType.RESOURCESTORE); List<X509Certificate> certificates = new LinkedList<>(); for(String urn: urns){ if(ks.containsAlias(urn)) certificates.add((X509Certificate) ks.getCertificate(urn)); } return certificates; } }
{ "content_hash": "27e544d5e38ec71da75af52554a03dc8", "timestamp": "", "source": "github", "line_count": 344, "max_line_length": 173, "avg_line_length": 38.57848837209303, "alnum_prop": 0.7499811619320322, "repo_name": "FITeagle/core", "id": "5695d17ce04af2a5bced6f93cef63419acf4a8c4", "size": "13271", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "aaa/src/main/java/org/fiteagle/core/aaa/authentication/KeyStoreManagement.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "277843" } ], "symlink_target": "" }
A new experimental UI platform [![Build status](https://ci.appveyor.com/api/projects/status/ajmcj49jiddxg3jn/branch/master?svg=true)](https://ci.appveyor.com/project/tevert/media-electron/branch/master) ## Building a Release Instructions 1. Update the version number in \<projectdir\>/app/package.json 2. Execute `npm run-script release` in \<projectdir\> 3. Upload the output files (should be 5) from \<projectdir\>/release to mediacomplete.github.io/download 4. Every user should automatically receive the update on their next run.
{ "content_hash": "fa7db429b7c9431c2e173ec9f33d11cb", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 171, "avg_line_length": 53.7, "alnum_prop": 0.7821229050279329, "repo_name": "MediaComplete/Media-Electron", "id": "812053e3c87a722a9ae2ad873c16a5f7b2884cc6", "size": "554", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "539" }, { "name": "HTML", "bytes": "1535" }, { "name": "JavaScript", "bytes": "25854" }, { "name": "NSIS", "bytes": "3767" } ], "symlink_target": "" }
@protocol EventName <NSObject> \ - (void)handle ## EventName ## _ ## Params; \ @end \ #define HUDeclareEventRegistration(EventName, Params) \ @property (nonatomic) NSMutableArray* listenerArrayFor ## EventName; \ - (void)register ## EventName ## _observer:(id < EventName > )object; \ - (void)handle ## EventName ## _ ## Params; \ #define HUImplementEvent(EventName, Params) \ - (NSMutableArray*)listenerArrayFor ## EventName { \ if (!_listenerArrayFor ## EventName) { \ _listenerArrayFor ## EventName = [NSMutableArray new]; \ } \ return _listenerArrayFor ## EventName; \ } \ - (void)register ## EventName ## _observer:(id)object { \ if (![object conformsToProtocol:@protocol(EventName)]) { return; } \ HUTypedEventListener* listener = [HUTypedEventListener new]; \ listener.object = object; \ [self.listenerArrayFor ## EventName addObject:listener]; \ } \ - (void)enumerateObjectsFor ## EventName ## WithBlock:(void(^)(id object))block { \ NSMutableArray* array = _listenerArrayFor ## EventName ; \ for (int i = (int)array.count - 1; i >= 0; i --) { \ HUTypedEventListener* listener = [array objectAtIndex:i]; \ if (listener.object && [listener.object conformsToProtocol:@protocol(EventName)]) { \ block(listener.object); \ } \ else { \ [array removeObjectAtIndex:i];\ } \ } \ } \ - (void)handle ## EventName ## _ ## Params { \ [self enumerateObjectsFor ## EventName ## WithBlock:^(id object) { \ [object handle ## EventName ## _ ## Params]; \ }]; \ } \ #define HUDeclareSingleton(classname)\ + (classname *)instance; #define HUImplementSingleton(classname) \ + (classname *)instance { \ static dispatch_once_t pred; \ __strong static classname * sharedObject = nil; \ dispatch_once( &pred, ^{ \ sharedObject = [[self alloc] init]; }); \ return sharedObject; \ } \ #endif @interface HUTypedEventListener : NSObject @property (nonatomic, weak) id object; @end
{ "content_hash": "13f7a7cfb5c77fabdb843796268c309c", "timestamp": "", "source": "github", "line_count": 65, "max_line_length": 93, "avg_line_length": 31.184615384615384, "alnum_prop": 0.6349284657128762, "repo_name": "hulu/HUTypedEvents", "id": "a39b27edb3f9f44f34028e12108cc912de65c34e", "size": "2215", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/HUTypedEvents.h", "mode": "33188", "license": "mit", "language": [ { "name": "Objective-C", "bytes": "14200" }, { "name": "Ruby", "bytes": "259" } ], "symlink_target": "" }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>statsmodels.discrete.discrete_model.MultinomialResults.t_test &mdash; statsmodels 0.6.1 documentation</title> <link rel="stylesheet" href="../_static/nature.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../', VERSION: '0.6.1', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="../_static/jquery.js"></script> <script type="text/javascript" src="../_static/underscore.js"></script> <script type="text/javascript" src="../_static/doctools.js"></script> <link rel="shortcut icon" href="../_static/statsmodels_hybi_favico.ico"/> <link rel="author" title="About these documents" href="../about.html" /> <link rel="top" title="statsmodels 0.6.1 documentation" href="../index.html" /> <link rel="stylesheet" href="../../_static/facebox.css" type="text/css" /> <link rel="stylesheet" href="../_static/examples.css" type="text/css" /> <script type="text/javascript" src="../_static/scripts.js"> </script> <script type="text/javascript" src="../_static/facebox.js"> </script> </head> <body role="document"> <div class="headerwrap"> <div class = "header"> <a href = "../index.html"> <img src="../_static/statsmodels_hybi_banner.png" alt="Logo" style="padding-left: 15px"/></a> </div> </div> <div class="related" role="navigation" aria-label="related navigation"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../genindex.html" title="General Index" accesskey="I">index</a></li> <li><a href ="../install.html">Install</a></li> &nbsp;|&nbsp; <li><a href="https://groups.google.com/group/pystatsmodels?hl=en">Support</a></li> &nbsp;|&nbsp; <li><a href="https://github.com/statsmodels/statsmodels/issues">Bugs</a></li> &nbsp;|&nbsp; <li><a href="../dev/index.html">Develop</a></li> &nbsp;|&nbsp; <li><a href="../examples/index.html">Examples</a></li> &nbsp;|&nbsp; <li><a href="../faq.html">FAQ</a></li> &nbsp;|&nbsp; </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body" role="main"> <div class="section" id="statsmodels-discrete-discrete-model-multinomialresults-t-test"> <h1>statsmodels.discrete.discrete_model.MultinomialResults.t_test<a class="headerlink" href="#statsmodels-discrete-discrete-model-multinomialresults-t-test" title="Permalink to this headline">¶</a></h1> <dl class="method"> <dt id="statsmodels.discrete.discrete_model.MultinomialResults.t_test"> <code class="descclassname">MultinomialResults.</code><code class="descname">t_test</code><span class="sig-paren">(</span><em>r_matrix</em>, <em>cov_p=None</em>, <em>scale=None</em>, <em>use_t=None</em><span class="sig-paren">)</span><a class="headerlink" href="#statsmodels.discrete.discrete_model.MultinomialResults.t_test" title="Permalink to this definition">¶</a></dt> <dd><p>Compute a t-test for a each linear hypothesis of the form Rb = q</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>r_matrix</strong> : array-like, str, tuple</p> <blockquote> <div><ul class="simple"> <li>array : If an array is given, a p x k 2d array or length k 1d array specifying the linear restrictions. It is assumed that the linear combination is equal to zero.</li> <li>str : The full hypotheses to test can be given as a string. See the examples.</li> <li>tuple : A tuple of arrays in the form (R, q). If q is given, can be either a scalar or a length p row vector.</li> </ul> </div></blockquote> <p><strong>cov_p</strong> : array-like, optional</p> <blockquote> <div><p>An alternative estimate for the parameter covariance matrix. If None is given, self.normalized_cov_params is used.</p> </div></blockquote> <p><strong>scale</strong> : float, optional</p> <blockquote> <div><p>An optional <cite>scale</cite> to use. Default is the scale specified by the model fit.</p> </div></blockquote> <p><strong>use_t</strong> : bool, optional</p> <blockquote> <div><p>If use_t is None, then the default of the model is used. If use_t is True, then the p-values are based on the t distribution. If use_t is False, then the p-values are based on the normal distribution.</p> </div></blockquote> </td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>res</strong> : ContrastResults instance</p> <blockquote class="last"> <div><p>The results for the test are attributes of this results instance. The available results have the same elements as the parameter table in <cite>summary()</cite>.</p> </div></blockquote> </td> </tr> </tbody> </table> <div class="admonition seealso"> <p class="first admonition-title">See also</p> <dl class="docutils"> <dt><a class="reference internal" href="statsmodels.discrete.discrete_model.MultinomialResults.tvalues.html#statsmodels.discrete.discrete_model.MultinomialResults.tvalues" title="statsmodels.discrete.discrete_model.MultinomialResults.tvalues"><code class="xref py py-obj docutils literal"><span class="pre">tvalues</span></code></a></dt> <dd>individual t statistics</dd> <dt><a class="reference internal" href="statsmodels.discrete.discrete_model.MultinomialResults.f_test.html#statsmodels.discrete.discrete_model.MultinomialResults.f_test" title="statsmodels.discrete.discrete_model.MultinomialResults.f_test"><code class="xref py py-obj docutils literal"><span class="pre">f_test</span></code></a></dt> <dd>for F tests</dd> </dl> <p class="last"><a class="reference external" href="http://patsy.readthedocs.org/en/latest/API-reference.html#patsy.DesignInfo.linear_constraint" title="(in patsy v0.3.0-dev)"><code class="xref py py-obj docutils literal"><span class="pre">patsy.DesignInfo.linear_constraint</span></code></a></p> </div> <p class="rubric">Examples</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">numpy</span> <span class="kn">as</span> <span class="nn">np</span> <span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">statsmodels.api</span> <span class="kn">as</span> <span class="nn">sm</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">data</span> <span class="o">=</span> <span class="n">sm</span><span class="o">.</span><span class="n">datasets</span><span class="o">.</span><span class="n">longley</span><span class="o">.</span><span class="n">load</span><span class="p">()</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">data</span><span class="o">.</span><span class="n">exog</span> <span class="o">=</span> <span class="n">sm</span><span class="o">.</span><span class="n">add_constant</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">exog</span><span class="p">)</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">results</span> <span class="o">=</span> <span class="n">sm</span><span class="o">.</span><span class="n">OLS</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">endog</span><span class="p">,</span> <span class="n">data</span><span class="o">.</span><span class="n">exog</span><span class="p">)</span><span class="o">.</span><span class="n">fit</span><span class="p">()</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">r</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">zeros_like</span><span class="p">(</span><span class="n">results</span><span class="o">.</span><span class="n">params</span><span class="p">)</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">r</span><span class="p">[</span><span class="mi">5</span><span class="p">:]</span> <span class="o">=</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="gp">&gt;&gt;&gt; </span><span class="k">print</span><span class="p">(</span><span class="n">r</span><span class="p">)</span> <span class="go">[ 0. 0. 0. 0. 0. 1. -1.]</span> </pre></div> </div> <p>r tests that the coefficients on the 5th and 6th independent variable are the same.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">T_test</span> <span class="o">=</span> <span class="n">results</span><span class="o">.</span><span class="n">t_test</span><span class="p">(</span><span class="n">r</span><span class="p">)</span> <span class="gp">&gt;&gt;&gt; </span><span class="k">print</span><span class="p">(</span><span class="n">T_test</span><span class="p">)</span> <span class="go">&lt;T contrast: effect=-1829.2025687192481, sd=455.39079425193762,</span> <span class="go">t=-4.0167754636411717, p=0.0015163772380899498, df_denom=9&gt;</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">T_test</span><span class="o">.</span><span class="n">effect</span> <span class="go">-1829.2025687192481</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">T_test</span><span class="o">.</span><span class="n">sd</span> <span class="go">455.39079425193762</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">T_test</span><span class="o">.</span><span class="n">tvalue</span> <span class="go">-4.0167754636411717</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">T_test</span><span class="o">.</span><span class="n">pvalue</span> <span class="go">0.0015163772380899498</span> </pre></div> </div> <p>Alternatively, you can specify the hypothesis tests using a string</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">statsmodels.formula.api</span> <span class="kn">import</span> <span class="n">ols</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">dta</span> <span class="o">=</span> <span class="n">sm</span><span class="o">.</span><span class="n">datasets</span><span class="o">.</span><span class="n">longley</span><span class="o">.</span><span class="n">load_pandas</span><span class="p">()</span><span class="o">.</span><span class="n">data</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">formula</span> <span class="o">=</span> <span class="s">&#39;TOTEMP ~ GNPDEFL + GNP + UNEMP + ARMED + POP + YEAR&#39;</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">results</span> <span class="o">=</span> <span class="n">ols</span><span class="p">(</span><span class="n">formula</span><span class="p">,</span> <span class="n">dta</span><span class="p">)</span><span class="o">.</span><span class="n">fit</span><span class="p">()</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">hypotheses</span> <span class="o">=</span> <span class="s">&#39;GNPDEFL = GNP, UNEMP = 2, YEAR/1829 = 1&#39;</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">t_test</span> <span class="o">=</span> <span class="n">results</span><span class="o">.</span><span class="n">t_test</span><span class="p">(</span><span class="n">hypotheses</span><span class="p">)</span> <span class="gp">&gt;&gt;&gt; </span><span class="k">print</span><span class="p">(</span><span class="n">t_test</span><span class="p">)</span> </pre></div> </div> </dd></dl> </div> </div> </div> </div> <div class="sphinxsidebar" role="navigation" aria-label="main navigation"> <div class="sphinxsidebarwrapper"> <div role="note" aria-label="source link"> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../_sources/generated/statsmodels.discrete.discrete_model.MultinomialResults.t_test.txt" rel="nofollow">Show Source</a></li> </ul> </div> <div id="searchbox" style="display: none" role="search"> <h3>Quick search</h3> <form class="search" action="../search.html" method="get"> <input type="text" name="q" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> <p class="searchtip" style="font-size: 90%"> Enter search terms or a module, class or function name. </p> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="footer" role="contentinfo"> &copy; Copyright 2009-2013, Josef Perktold, Skipper Seabold, Jonathan Taylor, statsmodels-developers. Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.1. </div> </body> </html>
{ "content_hash": "3cbe01430c4754f9b410324fcab08319", "timestamp": "", "source": "github", "line_count": 215, "max_line_length": 473, "avg_line_length": 62.013953488372096, "alnum_prop": 0.6528163204080102, "repo_name": "statsmodels/statsmodels.github.io", "id": "b973856b916274b46e9d4519bb16ac3fb2e6fdef", "size": "13336", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "0.6.1/generated/statsmodels.discrete.discrete_model.MultinomialResults.t_test.html", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
import argparse import os import libcst as cst import pathlib import sys from typing import (Any, Callable, Dict, List, Sequence, Tuple) def partition( predicate: Callable[[Any], bool], iterator: Sequence[Any] ) -> Tuple[List[Any], List[Any]]: """A stable, out-of-place partition.""" results = ([], []) for i in iterator: results[int(predicate(i))].append(i) # Returns trueList, falseList return results[1], results[0] class memcacheCallTransformer(cst.CSTTransformer): CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata') METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { 'apply_parameters': ('name', 'node_ids', 'apply_all', ), 'apply_software_update': ('instance', 'node_ids', 'apply_all', ), 'create_instance': ('parent', 'instance_id', 'resource', ), 'delete_instance': ('name', ), 'get_instance': ('name', ), 'list_instances': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), 'update_instance': ('update_mask', 'resource', ), 'update_parameters': ('name', 'update_mask', 'parameters', ), } def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: try: key = original.func.attr.value kword_params = self.METHOD_TO_PARAMS[key] except (AttributeError, KeyError): # Either not a method from the API or too convoluted to be sure. return updated # If the existing code is valid, keyword args come after positional args. # Therefore, all positional args must map to the first parameters. args, kwargs = partition(lambda a: not bool(a.keyword), updated.args) if any(k.keyword.value == "request" for k in kwargs): # We've already fixed this file, don't fix it again. return updated kwargs, ctrl_kwargs = partition( lambda a: a.keyword.value not in self.CTRL_PARAMS, kwargs ) args, ctrl_args = args[:len(kword_params)], args[len(kword_params):] ctrl_kwargs.extend(cst.Arg(value=a.value, keyword=cst.Name(value=ctrl)) for a, ctrl in zip(ctrl_args, self.CTRL_PARAMS)) request_arg = cst.Arg( value=cst.Dict([ cst.DictElement( cst.SimpleString("'{}'".format(name)), cst.Element(value=arg.value) ) # Note: the args + kwargs looks silly, but keep in mind that # the control parameters had to be stripped out, and that # those could have been passed positionally or by keyword. for name, arg in zip(kword_params, args + kwargs)]), keyword=cst.Name("request") ) return updated.with_changes( args=[request_arg] + ctrl_kwargs ) def fix_files( in_dir: pathlib.Path, out_dir: pathlib.Path, *, transformer=memcacheCallTransformer(), ): """Duplicate the input dir to the output dir, fixing file method calls. Preconditions: * in_dir is a real directory * out_dir is a real, empty directory """ pyfile_gen = ( pathlib.Path(os.path.join(root, f)) for root, _, files in os.walk(in_dir) for f in files if os.path.splitext(f)[1] == ".py" ) for fpath in pyfile_gen: with open(fpath, 'r') as f: src = f.read() # Parse the code and insert method call fixes. tree = cst.parse_module(src) updated = tree.visit(transformer) # Create the path and directory structure for the new file. updated_path = out_dir.joinpath(fpath.relative_to(in_dir)) updated_path.parent.mkdir(parents=True, exist_ok=True) # Generate the updated source file at the corresponding path. with open(updated_path, 'w') as f: f.write(updated.code) if __name__ == '__main__': parser = argparse.ArgumentParser( description="""Fix up source that uses the memcache client library. The existing sources are NOT overwritten but are copied to output_dir with changes made. Note: This tool operates at a best-effort level at converting positional parameters in client method calls to keyword based parameters. Cases where it WILL FAIL include A) * or ** expansion in a method call. B) Calls via function or method alias (includes free function calls) C) Indirect or dispatched calls (e.g. the method is looked up dynamically) These all constitute false negatives. The tool will also detect false positives when an API method shares a name with another method. """) parser.add_argument( '-d', '--input-directory', required=True, dest='input_dir', help='the input directory to walk for python files to fix up', ) parser.add_argument( '-o', '--output-directory', required=True, dest='output_dir', help='the directory to output files fixed via un-flattening', ) args = parser.parse_args() input_dir = pathlib.Path(args.input_dir) output_dir = pathlib.Path(args.output_dir) if not input_dir.is_dir(): print( f"input directory '{input_dir}' does not exist or is not a directory", file=sys.stderr, ) sys.exit(-1) if not output_dir.is_dir(): print( f"output directory '{output_dir}' does not exist or is not a directory", file=sys.stderr, ) sys.exit(-1) if os.listdir(output_dir): print( f"output directory '{output_dir}' is not empty", file=sys.stderr, ) sys.exit(-1) fix_files(input_dir, output_dir)
{ "content_hash": "db74a64b8b1b16ca209a5e88fcb38231", "timestamp": "", "source": "github", "line_count": 167, "max_line_length": 88, "avg_line_length": 34.604790419161674, "alnum_prop": 0.599584703235854, "repo_name": "googleapis/python-memcache", "id": "4b5aa32190ca7ced27f1e5de8ac70515c4c31ad6", "size": "6403", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "scripts/fixup_memcache_v1beta2_keywords.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Dockerfile", "bytes": "2050" }, { "name": "Python", "bytes": "680016" }, { "name": "Shell", "bytes": "30666" } ], "symlink_target": "" }
use ruma_macros::EventContent; use serde::{Deserialize, Serialize}; use crate::{events::EmptyStateKey, serde::StringEnum, PrivOwnedStr}; /// The content of an `m.room.guest_access` event. /// /// Controls whether guest users are allowed to join rooms. /// /// This event controls whether guest users are allowed to join rooms. If this event is absent, /// servers should act as if it is present and has the value `GuestAccess::Forbidden`. #[derive(Clone, Debug, Deserialize, Serialize, EventContent)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[ruma_event(type = "m.room.guest_access", kind = State, state_key_type = EmptyStateKey)] pub struct RoomGuestAccessEventContent { /// A policy for guest user access to a room. pub guest_access: GuestAccess, } impl RoomGuestAccessEventContent { /// Creates a new `RoomGuestAccessEventContent` with the given policy. pub fn new(guest_access: GuestAccess) -> Self { Self { guest_access } } } impl RoomGuestAccessEvent { /// Obtain the guest access policy, regardless of whether this event is redacted. pub fn guest_access(&self) -> &GuestAccess { match self { Self::Original(ev) => &ev.content.guest_access, Self::Redacted(_) => &GuestAccess::Forbidden, } } } impl SyncRoomGuestAccessEvent { /// Obtain the guest access policy, regardless of whether this event is redacted. pub fn guest_access(&self) -> &GuestAccess { match self { Self::Original(ev) => &ev.content.guest_access, Self::Redacted(_) => &GuestAccess::Forbidden, } } } /// A policy for guest user access to a room. #[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/string_enum.md"))] #[derive(Clone, Debug, PartialEq, Eq, StringEnum)] #[ruma_enum(rename_all = "snake_case")] #[non_exhaustive] pub enum GuestAccess { /// Guests are allowed to join the room. CanJoin, /// Guests are not allowed to join the room. Forbidden, #[doc(hidden)] _Custom(PrivOwnedStr), }
{ "content_hash": "46e6b78685659876c0c268c883996c18", "timestamp": "", "source": "github", "line_count": 61, "max_line_length": 95, "avg_line_length": 34.049180327868854, "alnum_prop": 0.6730861819932595, "repo_name": "ruma/ruma", "id": "82c5ddb3a5845f2bf835e28ad314d9aa8173ac67", "size": "2226", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "crates/ruma-common/src/events/room/guest_access.rs", "mode": "33188", "license": "mit", "language": [ { "name": "Rust", "bytes": "2765243" } ], "symlink_target": "" }
package exec import ( "fmt" "os" "testing" "github.com/go-acme/lego/v3/log" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" ) func TestDNSProvider_Present(t *testing.T) { backupLogger := log.Logger defer func() { log.Logger = backupLogger }() logRecorder := &LogRecorder{} log.Logger = logRecorder type expected struct { args string error bool } testCases := []struct { desc string config *Config expected expected }{ { desc: "Standard mode", config: &Config{ Program: "echo", Mode: "", }, expected: expected{ args: "present _acme-challenge.domain. pW9ZKG0xz_PCriK-nCMOjADy9eJcgGWIzkkj2fN4uZM\n", }, }, { desc: "program error", config: &Config{ Program: "ogellego", Mode: "", }, expected: expected{error: true}, }, { desc: "Raw mode", config: &Config{ Program: "echo", Mode: "RAW", }, expected: expected{ args: "present -- domain token keyAuth\n", }, }, } var message string logRecorder.On("Println", mock.Anything).Run(func(args mock.Arguments) { message = args.String(0) fmt.Fprintln(os.Stdout, "XXX", message) }) for _, test := range testCases { t.Run(test.desc, func(t *testing.T) { message = "" provider, err := NewDNSProviderConfig(test.config) require.NoError(t, err) err = provider.Present("domain", "token", "keyAuth") if test.expected.error { require.Error(t, err) } else { require.NoError(t, err) assert.Equal(t, test.expected.args, message) } }) } } func TestDNSProvider_CleanUp(t *testing.T) { backupLogger := log.Logger defer func() { log.Logger = backupLogger }() logRecorder := &LogRecorder{} log.Logger = logRecorder type expected struct { args string error bool } testCases := []struct { desc string config *Config expected expected }{ { desc: "Standard mode", config: &Config{ Program: "echo", Mode: "", }, expected: expected{ args: "cleanup _acme-challenge.domain. pW9ZKG0xz_PCriK-nCMOjADy9eJcgGWIzkkj2fN4uZM\n", }, }, { desc: "program error", config: &Config{ Program: "ogellego", Mode: "", }, expected: expected{error: true}, }, { desc: "Raw mode", config: &Config{ Program: "echo", Mode: "RAW", }, expected: expected{ args: "cleanup -- domain token keyAuth\n", }, }, } var message string logRecorder.On("Println", mock.Anything).Run(func(args mock.Arguments) { message = args.String(0) fmt.Fprintln(os.Stdout, "XXX", message) }) for _, test := range testCases { t.Run(test.desc, func(t *testing.T) { message = "" provider, err := NewDNSProviderConfig(test.config) require.NoError(t, err) err = provider.CleanUp("domain", "token", "keyAuth") if test.expected.error { require.Error(t, err) } else { require.NoError(t, err) assert.Equal(t, test.expected.args, message) } }) } }
{ "content_hash": "f66955c1ffc7f3d4e7cb6d1be1c118c2", "timestamp": "", "source": "github", "line_count": 158, "max_line_length": 90, "avg_line_length": 19.145569620253166, "alnum_prop": 0.6201652892561983, "repo_name": "xenolf/lego", "id": "d79e4a888b7ee865a496f9ee7a7bc5b2ae54dacc", "size": "3025", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "providers/dns/exec/exec_test.go", "mode": "33188", "license": "mit", "language": [ { "name": "Dockerfile", "bytes": "385" }, { "name": "Go", "bytes": "1021264" }, { "name": "Makefile", "bytes": "1324" }, { "name": "Roff", "bytes": "131" }, { "name": "Shell", "bytes": "541" } ], "symlink_target": "" }
import { GraphQLScalarType } from 'graphql'; import jwt from 'jsonwebtoken'; import Program from './models/Program'; import Admin from './models/Admin'; export default { Query: { test: () => 'Success', programs: async (_, { input, first, skip }) => { const searchText = input.searchText ? { $text: { $search: input.searchText } } : {}; const filters = input.filters || {}; const find = { ...filters, ...searchText }; return await Program.find(find) .skip(skip) .limit(first) .exec(); }, program: async (_, { id }) => { return await Program.findById(id).exec(); }, _programsMeta: async (_, { input }) => { const searchText = input.searchText ? { $text: { $search: input.searchText } } : {}; const filters = input.filters || {}; const find = { ...filters, ...searchText }; const totalCount = await Program.count(find).exec(); return { totalCount }; } }, Mutation: { createProgram: async (_, { input }, { token }) => { let admin; try { const payload = jwt.verify(token, 'tokenSig'); admin = payload.admin; } catch (e) { throw e; } let adminIsAuthorized; try { const { _id: id } = admin; adminIsAuthorized = await Admin.findById(id).exec(); } catch (e) { adminIsAuthorized = null; } if (adminIsAuthorized) { try { const program = await Program.create(input); return program; } catch (e) { throw new Error('There was a problem creating Program'); } } else { throw new Error('Unauthorized action.'); } }, updateProgram: async (_, { input }, { token }) => { let admin; try { const payload = jwt.verify(token, 'tokenSig'); admin = payload.admin; } catch (e) { throw e; } let adminIsAuthorized; try { const { _id: id } = admin; adminIsAuthorized = await Admin.findById(id).exec(); } catch (e) { adminIsAuthorized = null; } if (adminIsAuthorized) { const { id, ...rest } = input; try { const program = await Program.findByIdAndUpdate(id, rest, { new: true }).exec(); return program; } catch (e) { throw new Error('There was a problem updating Program'); } } else { throw new Error('Unauthorized action.'); } }, deleteProgram: async (_, { id }, { token }) => { let admin; try { const payload = jwt.verify(token, 'tokenSig'); admin = payload.admin; } catch (e) { throw e; } let adminIsAuthorized; try { const { _id: id } = admin; adminIsAuthorized = await Admin.findById(id).exec(); } catch (e) { adminIsAuthorized = null; } if (adminIsAuthorized) { const { id, ...rest } = input; try { const program = await Program.findByIdAndRemove(id).exec(); return program; } catch (e) { throw new Error('There was a problem deleting Program'); } } else { throw new Error('Unauthorized action.'); } }, signInAdmin: async (_, { username, password }) => { const admin = await Admin.findOne({ username }).exec(); if (!admin) { return new Error('Admin not found'); } if (admin.password === password) { const token = jwt.sign({ admin }, 'tokenSig', { expiresIn: 86400 }); return { token, isAuthenticated: true }; } else { return new Error('Admin not found'); } } }, // Custom Scaler types Datetime: new GraphQLScalarType({ name: 'Datetime', description: 'Datetime custom scalar type', parseValue(value) { return new Date(value); }, serialize(value) { return value; }, parseLiteral(ast) { return ast.value; } }) };
{ "content_hash": "c9fe29546823bae8f9e779c3811ab6b8", "timestamp": "", "source": "github", "line_count": 151, "max_line_length": 69, "avg_line_length": 27.05298013245033, "alnum_prop": 0.5197062423500612, "repo_name": "nnnoel/graphql-apollo-resource-manager", "id": "e2112a7e2f94cba632f2587946973dcf5ae9458d", "size": "4085", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "server/src/data/resolvers.js", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "1590" }, { "name": "JavaScript", "bytes": "112742" } ], "symlink_target": "" }
package java.security.cert; /** * The {@link CertPathBuilder} <i>Service Provider Interface</i> * (<b>SPI</b>). * * @see CertPathBuilder */ public abstract class CertPathBuilderSpi { // Constructors. // ------------------------------------------------------------------------ /** * Creates a new CertPathBuilderSpi. */ public CertPathBuilderSpi() { super(); } // Abstract methods. // ------------------------------------------------------------------------ /** * Creates a certificate path from the specified parameters. * * @param params The parameters to use. * @return The certificate path result. * @throws CertPathBuilderException If the certificate path cannot be * built. * @throws java.security.InvalidAlgorithmParameterException If the * implementation rejects the specified parameters. */ public abstract CertPathBuilderResult engineBuild(CertPathParameters params) throws CertPathBuilderException, java.security.InvalidAlgorithmParameterException; }
{ "content_hash": "201612f11652f144666a27e2d345da3f", "timestamp": "", "source": "github", "line_count": 39, "max_line_length": 78, "avg_line_length": 26.743589743589745, "alnum_prop": 0.6069031639501438, "repo_name": "the-linix-project/linix-kernel-source", "id": "afc7fc07366bbb39ea348c662cc406b5df7e6f71", "size": "2820", "binary": false, "copies": "182", "ref": "refs/heads/master", "path": "gccsrc/gcc-4.7.2/libjava/classpath/java/security/cert/CertPathBuilderSpi.java", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "Ada", "bytes": "38139979" }, { "name": "Assembly", "bytes": "3723477" }, { "name": "Awk", "bytes": "83739" }, { "name": "C", "bytes": "103607293" }, { "name": "C#", "bytes": "55726" }, { "name": "C++", "bytes": "38577421" }, { "name": "CLIPS", "bytes": "6933" }, { "name": "CSS", "bytes": "32588" }, { "name": "Emacs Lisp", "bytes": "13451" }, { "name": "FORTRAN", "bytes": "4294984" }, { "name": "GAP", "bytes": "13089" }, { "name": "Go", "bytes": "11277335" }, { "name": "Haskell", "bytes": "2415" }, { "name": "Java", "bytes": "45298678" }, { "name": "JavaScript", "bytes": "6265" }, { "name": "Matlab", "bytes": "56" }, { "name": "OCaml", "bytes": "148372" }, { "name": "Objective-C", "bytes": "995127" }, { "name": "Objective-C++", "bytes": "436045" }, { "name": "PHP", "bytes": "12361" }, { "name": "Pascal", "bytes": "40318" }, { "name": "Perl", "bytes": "358808" }, { "name": "Python", "bytes": "60178" }, { "name": "SAS", "bytes": "1711" }, { "name": "Scilab", "bytes": "258457" }, { "name": "Shell", "bytes": "2610907" }, { "name": "Tcl", "bytes": "17983" }, { "name": "TeX", "bytes": "1455571" }, { "name": "XSLT", "bytes": "156419" } ], "symlink_target": "" }
"""Node manager engine to collect power and temperature of compute node. Intel Node Manager Technology enables the datacenter IT to monitor and control actual server power, thermal and compute utlization behavior through industry defined standard IPMI. This file provides Node Manager engine to get simple system power and temperature data based on ipmitool. """ import binascii import collections import tempfile import time from oslo.config import cfg from ceilometer.ipmi.platform import exception as nmexcept from ceilometer.ipmi.platform import ipmitool from ceilometer.openstack.common.gettextutils import _ OPTS = [ cfg.IntOpt('node_manager_init_retry', default=3, help='Number of retries upon Intel Node ' 'Manager initialization failure') ] CONF = cfg.CONF CONF.register_opts(OPTS, group='ipmi') IPMICMD = {"sdr_dump": "sdr dump", "sdr_info": "sdr info", "sensor_dump": "sdr -v"} IPMIRAWCMD = {"get_device_id": "raw 0x06 0x01", "init_sensor_agent": "raw 0x0a 0x2c 0x01", "init_complete": "raw 0x0a 0x2c 0x00", "init_sensor_agent_status": "raw 0x0a 0x2c 0x00", "read_power_all": "raw 0x2e 0xc8 0x57 0x01 0x00 0x01 0x00 0x00", "read_temperature_all": "raw 0x2e 0xc8 0x57 0x01 0x00 0x02 0x00 0x00"} MANUFACTURER_ID_INTEL = ['57', '01', '00'] INTEL_PREFIX = '5701000d01' # The template dict are made according to the spec. It contains the expected # length of each item. And it can be used to parse the output of IPMI command. ONE_RETURN_TEMPLATE = {"ret": 1} BMC_INFO_TEMPLATE = collections.OrderedDict() BMC_INFO_TEMPLATE['Device_ID'] = 1 BMC_INFO_TEMPLATE['Device_Revision'] = 1 BMC_INFO_TEMPLATE['Firmware_Revision_1'] = 1 BMC_INFO_TEMPLATE['Firmware_Revision_2'] = 1 BMC_INFO_TEMPLATE['IPMI_Version'] = 1 BMC_INFO_TEMPLATE['Additional_Device_support'] = 1 BMC_INFO_TEMPLATE['Manufacturer_ID'] = 3 BMC_INFO_TEMPLATE['Product_ID'] = 2 BMC_INFO_TEMPLATE['Auxiliary_Firmware_Revision'] = 4 NM_STATISTICS_TEMPLATE = collections.OrderedDict() NM_STATISTICS_TEMPLATE['Manufacturer_ID'] = 3 NM_STATISTICS_TEMPLATE['Current_value'] = 2 NM_STATISTICS_TEMPLATE['Minimum_value'] = 2 NM_STATISTICS_TEMPLATE['Maximum_value'] = 2 NM_STATISTICS_TEMPLATE['Average_value'] = 2 NM_STATISTICS_TEMPLATE['Time_stamp'] = 4 NM_STATISTICS_TEMPLATE['Report_period'] = 4 NM_STATISTICS_TEMPLATE["DomainID_PolicyState"] = 1 NM_GET_DEVICE_ID_TEMPLATE = collections.OrderedDict() NM_GET_DEVICE_ID_TEMPLATE['Device_ID'] = 1 NM_GET_DEVICE_ID_TEMPLATE['Device_revision'] = 1 NM_GET_DEVICE_ID_TEMPLATE['Firmware_revision_1'] = 1 NM_GET_DEVICE_ID_TEMPLATE['Firmware_Revision_2'] = 1 NM_GET_DEVICE_ID_TEMPLATE['IPMI_Version'] = 1 NM_GET_DEVICE_ID_TEMPLATE['Additinal_Device_support'] = 1 NM_GET_DEVICE_ID_TEMPLATE['Manufacturer_ID'] = 3 NM_GET_DEVICE_ID_TEMPLATE['Product_ID_min_version'] = 1 NM_GET_DEVICE_ID_TEMPLATE['Product_ID_major_version'] = 1 NM_GET_DEVICE_ID_TEMPLATE['Implemented_firmware'] = 1 NM_GET_DEVICE_ID_TEMPLATE['Firmware_build_number'] = 1 NM_GET_DEVICE_ID_TEMPLATE['Last_digit_firmware_build_number'] = 1 NM_GET_DEVICE_ID_TEMPLATE['Image_flags'] = 1 def _hex(list=None): """Format the return value in list into hex.""" list = list or [] if list: list.reverse() return int(''.join(list), 16) return 0 class NodeManager(object): """The python implementation of Intel Node Manager engine using ipmitool The class implements the engine to read power and temperature of compute node. It uses ipmitool to execute the IPMI command and parse the output into dict. """ _inited = False _instance = None def __new__(cls, *args, **kwargs): """Singleton to avoid duplicated initialization.""" if not cls._instance: cls._instance = super(NodeManager, cls).__new__(cls, *args, **kwargs) return cls._instance def __init__(self): if not (self._instance and self._inited): self.nm_support = False self.channel_slave = '' self._inited = True self.nm_support = self.check_node_manager() @staticmethod def _parse_slave_and_channel(file_path): """Parse the dumped file to get slave address and channel number. :param file_path: file path of dumped SDR file. :return: slave address and channel number of target device. """ ret = None prefix = INTEL_PREFIX # According to Intel Node Manager spec, section 4.5, for Intel NM # discovery OEM SDR records are type C0h. It contains manufacture ID # and OEM data in the record body. # 0-2 bytes are OEM ID, byte 3 is 0Dh and byte 4 is 01h. Byte 5, 6 # is Intel NM device slave address and channel number/sensor owner LUN. with open(file_path, 'rb') as bin_fp: for line in bin_fp.readlines(): if line: data_str = binascii.hexlify(line) if prefix in data_str: oem_id_index = data_str.index(prefix) ret = data_str[oem_id_index + len(prefix): oem_id_index + len(prefix) + 4] # Byte 5 is slave address. [7:4] from byte 6 is channel # number, so just pick ret[2] here. ret = (ret[0:2], ret[2]) break return ret @ipmitool.execute_ipmi_cmd(BMC_INFO_TEMPLATE) def get_device_id(self): """IPMI command GET_DEVICE_ID.""" return IPMIRAWCMD["get_device_id"] @ipmitool.execute_ipmi_cmd(ONE_RETURN_TEMPLATE) def _init_sensor_agent(self): """Run initialization agent.""" return IPMIRAWCMD["init_sensor_agent"] @ipmitool.execute_ipmi_cmd(ONE_RETURN_TEMPLATE) def _init_sensor_agent_process(self): """Check the status of initialization agent.""" return IPMIRAWCMD["init_sensor_agent_status"] @ipmitool.execute_ipmi_cmd() def _dump_sdr_file(self, data_file=""): """Dump SDR into a file.""" return IPMICMD["sdr_dump"] + " " + data_file @ipmitool.execute_ipmi_cmd(NM_GET_DEVICE_ID_TEMPLATE) def _node_manager_get_device_id(self): """GET_DEVICE_ID command in Intel Node Manager Different from IPMI command GET_DEVICE_ID, it contains more information of Intel Node Manager. """ return self.channel_slave + ' ' + IPMIRAWCMD["get_device_id"] @ipmitool.execute_ipmi_cmd(NM_STATISTICS_TEMPLATE) def _read_power_all(self): """Get the power consumption of the whole platform.""" return self.channel_slave + ' ' + IPMIRAWCMD['read_power_all'] @ipmitool.execute_ipmi_cmd(NM_STATISTICS_TEMPLATE) def _read_temperature_all(self): """Get the temperature info of the whole platform.""" return self.channel_slave + ' ' + IPMIRAWCMD['read_temperature_all'] def read_power_all(self): if self.nm_support: return self._read_power_all() return {} def read_temperature_all(self): if self.nm_support: return self._read_temperature_all() return {} def init_node_manager(self): if self._init_sensor_agent_process()['ret'] == ['01']: return # Run sensor initialization agent for i in range(CONF.ipmi.node_manager_init_retry): self._init_sensor_agent() time.sleep(1) if self._init_sensor_agent_process()['ret'] == ['01']: return raise nmexcept.NodeManagerException(_('Node Manager init failed')) def discover_slave_channel(self): """Discover target slave address and channel number.""" file_path = tempfile.mkstemp()[1] self._dump_sdr_file(data_file=file_path) ret = self._parse_slave_and_channel(file_path) slave_address = ''.join(['0x', ret[0]]) channel = ''.join(['0x', ret[1]]) # String of channel and slave_address self.channel_slave = '-b ' + channel + ' -t ' + slave_address def node_manager_support(self): """Intel Node Manager capability checking This function is used to detect if compute node support Intel Node Manager or not and parse out the slave address and channel number of node manager. """ self.manufacturer_id = self.get_device_id()['Manufacturer_ID'] if MANUFACTURER_ID_INTEL != self.manufacturer_id: # If the manufacturer is not Intel, just set False and return. return False self.discover_slave_channel() support = self._node_manager_get_device_id()['Implemented_firmware'] # According to Intel Node Manager spec, return value of GET_DEVICE_ID, # bits 3 to 0 shows if Intel NM implemented or not. if int(support[0], 16) & 0xf != 0: return True else: return False def check_node_manager(self): """Intel Node Manager init and check This function is used to initialize Intel Node Manager and check the capability without throwing exception. It's safe to call it on non-NodeManager platform. """ try: self.init_node_manager() has_nm = self.node_manager_support() except (nmexcept.NodeManagerException, nmexcept.IPMIException): return False return has_nm
{ "content_hash": "4073506c6ac7058ce86f057ba2ef614c", "timestamp": "", "source": "github", "line_count": 258, "max_line_length": 79, "avg_line_length": 37.26744186046512, "alnum_prop": 0.6303692147685908, "repo_name": "m1093782566/openstack_org_ceilometer", "id": "6743ccf9f3e5541a57fee1114e6f969517b4d327", "size": "10343", "binary": false, "copies": "1", "ref": "refs/heads/dev", "path": "ceilometer/ipmi/platform/intel_node_manager.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Python", "bytes": "2657375" }, { "name": "Shell", "bytes": "3204" } ], "symlink_target": "" }
 CKEDITOR.plugins.setLang( 'div', 'hu', { IdInputLabel: 'Azonosító', advisoryTitleInputLabel: 'Tipp szöveg', cssClassInputLabel: 'Stíluslap osztály', edit: 'DIV szerkesztése', inlineStyleInputLabel: 'Inline stílus', langDirLTRLabel: 'Balról jobbra (LTR)', langDirLabel: 'Nyelvi irány', langDirRTLLabel: 'Jobbról balra (RTL)', languageCodeInputLabel: ' Nyelv kódja', remove: 'DIV eltávolítása', styleSelectLabel: 'Stílus', title: 'DIV tároló létrehozása', toolbar: 'DIV tároló létrehozása' } );
{ "content_hash": "3673823814a043720a482ef5055fff54", "timestamp": "", "source": "github", "line_count": 16, "max_line_length": 41, "avg_line_length": 32.75, "alnum_prop": 0.7194656488549618, "repo_name": "Kunstmaan/BootstrapCK4-Skin", "id": "a8c0e6234b20ff8b4142822c42058259eccd5855", "size": "694", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "plugins/div/lang/hu.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "245479" }, { "name": "JavaScript", "bytes": "4813019" } ], "symlink_target": "" }
/* * File: gtextarea.h * ----------------- * This file exports the GTextArea class, which represents a multi-line * area that displays plain text. * * @author Jeff Lutgen * @version 2017/03/16 * - improved comments and changed them from doxygen style to StanfordCPPLib style * @version 2016/10/12 * - taken from https://github.com/jlutgen/stanford-whittier-cpplib/ * - Thanks, Jeff! */ /*************************************************************************/ /* Stanford Portable Library */ /* */ /* This program is free software: you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ /* the Free Software Foundation, either version 3 of the License, or */ /* (at your option) any later version. */ /* */ /* This program is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ /* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ /* along with this program. If not, see <http://www.gnu.org/licenses/>. */ /*************************************************************************/ #ifndef _gtextarea_h #define _gtextarea_h #include "ginteractors.h" #include "gobjects.h" #include "gtypes.h" /* Class: GTextArea * ---------------- * This interactor subclass represents a multi-line * area that displays plain text. * * Scrollbars are added to the text area automatically if the * text is too large to fit in the displayed region of the * text area. */ class GTextArea : public GInteractor { public: GTextArea(double width, double height); /* * Constructor: GTextArea * Usage: GTextArea textArea; * GTextArea textArea(width, height); * GTextArea textArea(x, y, width, height); * ----------------------------------------------- * Constructs an text area with the specified width, height, * and initial location. If no location is passed, the default * of (0, 0) is used. * * The text area is editable by default. */ GTextArea(double x, double y, double width, double height); /* Prototypes for the virtual methods */ virtual GRectangle getBounds() const; virtual std::string getType() const; virtual std::string toString() const; /* unique GTextArea behavior */ /* * Method: GTextArea * Usage: textarea.setFont("Monospaced-9"); * ---------------------------------------- * Sets the font used by this text area. */ void setFont(std::string font); /* * Method: getText * Usage: string text = textarea.getText(); * ---------------------------------------- * Returns the text currently displayed by this text area. */ std::string getText() const; /* * Method: setText * Usage: textarea.setText(text); * ------------------------------ * Sets the text displayed by this text area. */ void setText(std::string text); /* * Method: setEditable * Usage: textarea.setEditable(isEditable); * ---------------------------------------- * Sets whether this text area is editable. */ void setEditable(bool isEditable); private: double width; double height; }; #endif
{ "content_hash": "a2367555fd82cc89777ef9eae35d898a", "timestamp": "", "source": "github", "line_count": 109, "max_line_length": 82, "avg_line_length": 34.321100917431195, "alnum_prop": 0.5311414060411654, "repo_name": "shawlu95/SuperWordLadder", "id": "c299b3d87208a59f6e133750d4bfcf020e29bdf3", "size": "3741", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/StanfordCPPLib/graphics/gtextarea.h", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "4828" }, { "name": "C++", "bytes": "1310534" }, { "name": "Objective-C", "bytes": "645" }, { "name": "QMake", "bytes": "23175" } ], "symlink_target": "" }
import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-comp-1926', templateUrl: './comp-1926.component.html', styleUrls: ['./comp-1926.component.css'] }) export class Comp1926Component implements OnInit { constructor() { } ngOnInit() { } }
{ "content_hash": "5bdec1c112f7ef26b96104c86c14476e", "timestamp": "", "source": "github", "line_count": 17, "max_line_length": 50, "avg_line_length": 16.58823529411765, "alnum_prop": 0.6666666666666666, "repo_name": "angular/angular-cli-stress-test", "id": "36b8dd55fb288980ad7afa0a79fadd1d9ffdfb85", "size": "484", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/app/components/comp-1926/comp-1926.component.ts", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "1040888" }, { "name": "HTML", "bytes": "300322" }, { "name": "JavaScript", "bytes": "2404" }, { "name": "TypeScript", "bytes": "8535506" } ], "symlink_target": "" }
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb') describe Sproutvideo::LiveStream do before(:each) do @api_key = 'abc123' Sproutvideo.api_key = @api_key Sproutvideo.base_url = 'https://api.sproutvideo.com/v1' @msg = mock(:to_s => "{}", :code => 200) end describe "#create" do it "should POST the correct url and return a response" do data = { title: 'newww live stream'} RestClient.should_receive(:post).with( "#{Sproutvideo.base_url}/live_streams", MultiJson.encode(data), {'SproutVideo-Api-Key' => @api_key}).and_return(@msg) Sproutvideo::LiveStream.create(data).class.should == Sproutvideo::Response end it "should POST the correct url with file and return a response" do File.open("upload_test", "w+") do |f| f.syswrite("upload!") end file = File.open('upload_test') File.stub!(:open).with('upload_test').and_yield(file) RestClient.should_receive(:post).with( "#{Sproutvideo.base_url}/live_streams", {:custom_poster_frame => file, :title => 'test title'}, {'SproutVideo-Api-Key' => @api_key, :timeout => 18000}).and_return(@msg) Sproutvideo::LiveStream.create({:title => 'test title', :custom_poster_frame => 'upload_test' }).class.should == Sproutvideo::Response FileUtils.rm('upload_test') end end describe "#list" do before(:each) do @url = "#{Sproutvideo.base_url}/live_streams" end it "should GET the correct url and return a response" do RestClient.should_receive(:get).with( @url, {'SproutVideo-Api-Key' => @api_key, :params => {:page => 1, :per_page => 25}}).and_return(@msg) Sproutvideo::LiveStream.list.class.should == Sproutvideo::Response end it "should merge params" do RestClient.should_receive(:get).with( @url, {'SproutVideo-Api-Key' => @api_key, :params => {:page => 1, :per_page => 25, :foo => 'bar'}}).and_return(@msg) Sproutvideo::LiveStream.list(:foo => 'bar') end it "should use pagination params" do RestClient.should_receive(:get).with( @url, {'SproutVideo-Api-Key' => @api_key, :params => {:page => 2, :per_page => 5}}).and_return(@msg) Sproutvideo::LiveStream.list(:page => 2, :per_page => 5) end it "should request live_streams for a tag if tag_id is passed in" do RestClient.should_receive(:get).with( @url, {'SproutVideo-Api-Key' => @api_key, :params => {:page => 1, :per_page => 25, :tag_id => 'asdf'}}).and_return(@msg) Sproutvideo::LiveStream.list(:tag_id => 'asdf') end end describe "#details" do before(:each) do @live_stream_id = 1 @url = "#{Sproutvideo.base_url}/live_streams/#{@live_stream_id}" end it "should get the correct url and return a response" do RestClient.should_receive(:get).with( @url, {'SproutVideo-Api-Key' => @api_key, :params => {}}).and_return(@msg) Sproutvideo::LiveStream.details(@live_stream_id).class.should == Sproutvideo::Response end end describe "#update" do before(:each) do @live_stream_id = 1 @url = "#{Sproutvideo.base_url}/live_streams/#{@live_stream_id}" end it "should PUT the correct url and return a response" do data = {:title => 'new title'} RestClient.should_receive(:put).with( @url, MultiJson.encode(data), {'SproutVideo-Api-Key' => @api_key}).and_return(@msg) Sproutvideo::LiveStream.update(@live_stream_id, data).class.should == Sproutvideo::Response end it "should PUT the correct url and return a response" do File.open("upload_test2", "w+") do |f| f.syswrite("upload!") end file = File.open('upload_test2') File.stub!(:open).with('upload_test2').and_yield(file) RestClient.should_receive(:put).with( "#{Sproutvideo.base_url}/live_streams/#{@live_stream_id}", {:custom_poster_frame => file, :title => 'test title'}, {'SproutVideo-Api-Key' => @api_key, :timeout => 18000}).and_return(@msg) Sproutvideo::LiveStream.update(@live_stream_id, {:title => 'test title', :custom_poster_frame => 'upload_test2' }).class.should == Sproutvideo::Response FileUtils.rm('upload_test2') end end describe "#delete" do before(:each) do @live_stream_id = 1 @url = "#{Sproutvideo.base_url}/live_streams/#{@live_stream_id}" end it "should DELETE the correct url and return a response" do RestClient.should_receive(:delete).with( @url, {'SproutVideo-Api-Key' => @api_key, :params => {}}).and_return(@msg) Sproutvideo::LiveStream.destroy(@live_stream_id).class.should == Sproutvideo::Response end end describe "#end_stream" do before(:each) do @live_stream_id = 1 @url = "#{Sproutvideo.base_url}/live_streams/#{@live_stream_id}/end_stream" end it "should PUT the correct url and return a response" do RestClient.should_receive(:put).with( @url, "{}", {'SproutVideo-Api-Key' => @api_key}).and_return(@msg) Sproutvideo::LiveStream.end_stream(@live_stream_id).class.should == Sproutvideo::Response end end end
{ "content_hash": "d4c8dc076b633736ee50989c4100d975", "timestamp": "", "source": "github", "line_count": 152, "max_line_length": 158, "avg_line_length": 34.76315789473684, "alnum_prop": 0.6116578349735049, "repo_name": "SproutVideo/sproutvideo-rb", "id": "2e3d75a04d074994d2dd689432d23b055f029145", "size": "5284", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "spec/sproutvideo/live_stream_spec.rb", "mode": "33188", "license": "mit", "language": [ { "name": "Ruby", "bytes": "74077" } ], "symlink_target": "" }
.ui-spinner { position: relative; display: inline-block; overflow: hidden; padding: 0; vertical-align: middle; } .ui-spinner-input { border: none; background: none; color: inherit; padding: 0; margin: .2em 0; vertical-align: middle; margin-left: .4em; margin-right: 22px; } .ui-spinner-button { width: 16px; height: 50%; font-size: .5em; padding: 0; margin: 0; text-align: center; position: absolute; cursor: default; display: block; overflow: hidden; right: 0; } /* more specificity required here to overide default borders */ .ui-spinner a.ui-spinner-button { border-top: none; border-bottom: none; border-right: none; } /* vertical centre icon */ .ui-spinner .ui-icon { position: absolute; margin-top: -8px; top: 50%; left: 0; } .ui-spinner-up { top: 0; } .ui-spinner-down { bottom: 0; } /* TR overrides */ .ui-spinner .ui-icon-triangle-1-s { /* need to fix icons sprite */ background-position: -65px -16px; }
{ "content_hash": "f377375843a7d5ba524466daedabfd03", "timestamp": "", "source": "github", "line_count": 56, "max_line_length": 63, "avg_line_length": 17.964285714285715, "alnum_prop": 0.6361829025844931, "repo_name": "Mozu/Mozu.Integrations.Quickbooks", "id": "5c4941a7dddf1e8f66d26b4e24873292d4b9512f", "size": "1247", "binary": false, "copies": "25", "ref": "refs/heads/master", "path": "src/main/webapp/resources/css/themes/base/jquery.ui.spinner.css", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "103" }, { "name": "CSS", "bytes": "41639" }, { "name": "HTML", "bytes": "38859" }, { "name": "Java", "bytes": "9578806" }, { "name": "JavaScript", "bytes": "558615" } ], "symlink_target": "" }
import { IdleValue } from 'vs/base/common/async'; import { illegalState } from 'vs/base/common/errors'; import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'; import { Graph } from 'vs/platform/instantiation/common/graph'; import { IInstantiationService, ServiceIdentifier, ServicesAccessor, _util } from 'vs/platform/instantiation/common/instantiation'; import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; // TRACING const _enableTracing = false; class CyclicDependencyError extends Error { constructor(graph: Graph<any>) { super('cyclic dependency between services'); this.message = graph.findCycleSlow() ?? `UNABLE to detect cycle, dumping graph: \n${graph.toString()}`; } } export class InstantiationService implements IInstantiationService { declare readonly _serviceBrand: undefined; private readonly _services: ServiceCollection; private readonly _strict: boolean; private readonly _parent?: InstantiationService; constructor(services: ServiceCollection = new ServiceCollection(), strict: boolean = false, parent?: InstantiationService) { this._services = services; this._strict = strict; this._parent = parent; this._services.set(IInstantiationService, this); } createChild(services: ServiceCollection): IInstantiationService { return new InstantiationService(services, this._strict, this); } invokeFunction<R, TS extends any[] = []>(fn: (accessor: ServicesAccessor, ...args: TS) => R, ...args: TS): R { const _trace = Trace.traceInvocation(fn); let _done = false; try { const accessor: ServicesAccessor = { get: <T>(id: ServiceIdentifier<T>) => { if (_done) { throw illegalState('service accessor is only valid during the invocation of its target method'); } const result = this._getOrCreateServiceInstance(id, _trace); if (!result) { throw new Error(`[invokeFunction] unknown service '${id}'`); } return result; } }; return fn(accessor, ...args); } finally { _done = true; _trace.stop(); } } createInstance(ctorOrDescriptor: any | SyncDescriptor<any>, ...rest: any[]): any { let _trace: Trace; let result: any; if (ctorOrDescriptor instanceof SyncDescriptor) { _trace = Trace.traceCreation(ctorOrDescriptor.ctor); result = this._createInstance(ctorOrDescriptor.ctor, ctorOrDescriptor.staticArguments.concat(rest), _trace); } else { _trace = Trace.traceCreation(ctorOrDescriptor); result = this._createInstance(ctorOrDescriptor, rest, _trace); } _trace.stop(); return result; } private _createInstance<T>(ctor: any, args: any[] = [], _trace: Trace): T { // arguments defined by service decorators const serviceDependencies = _util.getServiceDependencies(ctor).sort((a, b) => a.index - b.index); const serviceArgs: any[] = []; for (const dependency of serviceDependencies) { const service = this._getOrCreateServiceInstance(dependency.id, _trace); if (!service) { this._throwIfStrict(`[createInstance] ${ctor.name} depends on UNKNOWN service ${dependency.id}.`, false); } serviceArgs.push(service); } const firstServiceArgPos = serviceDependencies.length > 0 ? serviceDependencies[0].index : args.length; // check for argument mismatches, adjust static args if needed if (args.length !== firstServiceArgPos) { console.trace(`[createInstance] First service dependency of ${ctor.name} at position ${firstServiceArgPos + 1} conflicts with ${args.length} static arguments`); const delta = firstServiceArgPos - args.length; if (delta > 0) { args = args.concat(new Array(delta)); } else { args = args.slice(0, firstServiceArgPos); } } // now create the instance return <T>new ctor(...[...args, ...serviceArgs]); } private _setServiceInstance<T>(id: ServiceIdentifier<T>, instance: T): void { if (this._services.get(id) instanceof SyncDescriptor) { this._services.set(id, instance); } else if (this._parent) { this._parent._setServiceInstance(id, instance); } else { throw new Error('illegalState - setting UNKNOWN service instance'); } } private _getServiceInstanceOrDescriptor<T>(id: ServiceIdentifier<T>): T | SyncDescriptor<T> { const instanceOrDesc = this._services.get(id); if (!instanceOrDesc && this._parent) { return this._parent._getServiceInstanceOrDescriptor(id); } else { return instanceOrDesc; } } protected _getOrCreateServiceInstance<T>(id: ServiceIdentifier<T>, _trace: Trace): T { const thing = this._getServiceInstanceOrDescriptor(id); if (thing instanceof SyncDescriptor) { return this._safeCreateAndCacheServiceInstance(id, thing, _trace.branch(id, true)); } else { _trace.branch(id, false); return thing; } } private readonly _activeInstantiations = new Set<ServiceIdentifier<any>>(); private _safeCreateAndCacheServiceInstance<T>(id: ServiceIdentifier<T>, desc: SyncDescriptor<T>, _trace: Trace): T { if (this._activeInstantiations.has(id)) { throw new Error(`illegal state - RECURSIVELY instantiating service '${id}'`); } this._activeInstantiations.add(id); try { return this._createAndCacheServiceInstance(id, desc, _trace); } finally { this._activeInstantiations.delete(id); } } private _createAndCacheServiceInstance<T>(id: ServiceIdentifier<T>, desc: SyncDescriptor<T>, _trace: Trace): T { type Triple = { id: ServiceIdentifier<any>; desc: SyncDescriptor<any>; _trace: Trace }; const graph = new Graph<Triple>(data => data.id.toString()); let cycleCount = 0; const stack = [{ id, desc, _trace }]; while (stack.length) { const item = stack.pop()!; graph.lookupOrInsertNode(item); // a weak but working heuristic for cycle checks if (cycleCount++ > 1000) { throw new CyclicDependencyError(graph); } // check all dependencies for existence and if they need to be created first for (const dependency of _util.getServiceDependencies(item.desc.ctor)) { const instanceOrDesc = this._getServiceInstanceOrDescriptor(dependency.id); if (!instanceOrDesc) { this._throwIfStrict(`[createInstance] ${id} depends on ${dependency.id} which is NOT registered.`, true); } if (instanceOrDesc instanceof SyncDescriptor) { const d = { id: dependency.id, desc: instanceOrDesc, _trace: item._trace.branch(dependency.id, true) }; graph.insertEdge(item, d); stack.push(d); } } } while (true) { const roots = graph.roots(); // if there is no more roots but still // nodes in the graph we have a cycle if (roots.length === 0) { if (!graph.isEmpty()) { throw new CyclicDependencyError(graph); } break; } for (const { data } of roots) { // Repeat the check for this still being a service sync descriptor. That's because // instantiating a dependency might have side-effect and recursively trigger instantiation // so that some dependencies are now fullfilled already. const instanceOrDesc = this._getServiceInstanceOrDescriptor(data.id); if (instanceOrDesc instanceof SyncDescriptor) { // create instance and overwrite the service collections const instance = this._createServiceInstanceWithOwner(data.id, data.desc.ctor, data.desc.staticArguments, data.desc.supportsDelayedInstantiation, data._trace); this._setServiceInstance(data.id, instance); } graph.removeNode(data); } } return <T>this._getServiceInstanceOrDescriptor(id); } private _createServiceInstanceWithOwner<T>(id: ServiceIdentifier<T>, ctor: any, args: any[] = [], supportsDelayedInstantiation: boolean, _trace: Trace): T { if (this._services.get(id) instanceof SyncDescriptor) { return this._createServiceInstance(ctor, args, supportsDelayedInstantiation, _trace); } else if (this._parent) { return this._parent._createServiceInstanceWithOwner(id, ctor, args, supportsDelayedInstantiation, _trace); } else { throw new Error(`illegalState - creating UNKNOWN service instance ${ctor.name}`); } } private _createServiceInstance<T>(ctor: any, args: any[] = [], _supportsDelayedInstantiation: boolean, _trace: Trace): T { if (!_supportsDelayedInstantiation) { // eager instantiation return this._createInstance(ctor, args, _trace); } else { // Return a proxy object that's backed by an idle value. That // strategy is to instantiate services in our idle time or when actually // needed but not when injected into a consumer const idle = new IdleValue<any>(() => this._createInstance<T>(ctor, args, _trace)); return <T>new Proxy(Object.create(null), { get(target: any, key: PropertyKey): any { if (key in target) { return target[key]; } const obj = idle.value; let prop = obj[key]; if (typeof prop !== 'function') { return prop; } prop = prop.bind(obj); target[key] = prop; return prop; }, set(_target: T, p: PropertyKey, value: any): boolean { idle.value[p] = value; return true; } }); } } private _throwIfStrict(msg: string, printWarning: boolean): void { if (printWarning) { console.warn(msg); } if (this._strict) { throw new Error(msg); } } } //#region -- tracing --- const enum TraceType { Creation, Invocation, Branch } export class Trace { private static readonly _None = new class extends Trace { constructor() { super(-1, null); } override stop() { } override branch() { return this; } }; static traceInvocation(ctor: any): Trace { return !_enableTracing ? Trace._None : new Trace(TraceType.Invocation, ctor.name || (ctor.toString() as string).substring(0, 42).replace(/\n/g, '')); } static traceCreation(ctor: any): Trace { return !_enableTracing ? Trace._None : new Trace(TraceType.Creation, ctor.name); } private static _totals: number = 0; private readonly _start: number = Date.now(); private readonly _dep: [ServiceIdentifier<any>, boolean, Trace?][] = []; private constructor( readonly type: TraceType, readonly name: string | null ) { } branch(id: ServiceIdentifier<any>, first: boolean): Trace { const child = new Trace(TraceType.Branch, id.toString()); this._dep.push([id, first, child]); return child; } stop() { const dur = Date.now() - this._start; Trace._totals += dur; let causedCreation = false; function printChild(n: number, trace: Trace) { const res: string[] = []; const prefix = new Array(n + 1).join('\t'); for (const [id, first, child] of trace._dep) { if (first && child) { causedCreation = true; res.push(`${prefix}CREATES -> ${id}`); const nested = printChild(n + 1, child); if (nested) { res.push(nested); } } else { res.push(`${prefix}uses -> ${id}`); } } return res.join('\n'); } const lines = [ `${this.type === TraceType.Creation ? 'CREATE' : 'CALL'} ${this.name}`, `${printChild(1, this)}`, `DONE, took ${dur.toFixed(2)}ms (grand total ${Trace._totals.toFixed(2)}ms)` ]; if (dur > 2 || causedCreation) { console.log(lines.join('\n')); } } } //#endregion
{ "content_hash": "22ffb67b83ae377e5776cc9197e2abe0", "timestamp": "", "source": "github", "line_count": 339, "max_line_length": 164, "avg_line_length": 32.70796460176991, "alnum_prop": 0.683531746031746, "repo_name": "eamodio/vscode", "id": "1f6bba77e24cef6b48b22968b1eca14d7ace473b", "size": "11439", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "src/vs/platform/instantiation/common/instantiationService.ts", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "19196" }, { "name": "C", "bytes": "818" }, { "name": "C#", "bytes": "709" }, { "name": "C++", "bytes": "2745" }, { "name": "CSS", "bytes": "620323" }, { "name": "Clojure", "bytes": "1206" }, { "name": "CoffeeScript", "bytes": "590" }, { "name": "Cuda", "bytes": "3634" }, { "name": "Dart", "bytes": "324" }, { "name": "Dockerfile", "bytes": "475" }, { "name": "F#", "bytes": "634" }, { "name": "Go", "bytes": "652" }, { "name": "Groovy", "bytes": "3928" }, { "name": "HLSL", "bytes": "184" }, { "name": "HTML", "bytes": "380999" }, { "name": "Hack", "bytes": "16" }, { "name": "Handlebars", "bytes": "1064" }, { "name": "Inno Setup", "bytes": "304239" }, { "name": "Java", "bytes": "599" }, { "name": "JavaScript", "bytes": "1413253" }, { "name": "Julia", "bytes": "940" }, { "name": "Jupyter Notebook", "bytes": "929" }, { "name": "Less", "bytes": "1029" }, { "name": "Lua", "bytes": "252" }, { "name": "Makefile", "bytes": "2252" }, { "name": "Objective-C", "bytes": "1387" }, { "name": "Objective-C++", "bytes": "1387" }, { "name": "PHP", "bytes": "998" }, { "name": "Perl", "bytes": "1922" }, { "name": "PowerShell", "bytes": "12409" }, { "name": "Pug", "bytes": "654" }, { "name": "Python", "bytes": "2405" }, { "name": "R", "bytes": "362" }, { "name": "Roff", "bytes": "351" }, { "name": "Ruby", "bytes": "1703" }, { "name": "Rust", "bytes": "532" }, { "name": "SCSS", "bytes": "6732" }, { "name": "ShaderLab", "bytes": "330" }, { "name": "Shell", "bytes": "57256" }, { "name": "Swift", "bytes": "284" }, { "name": "TeX", "bytes": "1602" }, { "name": "TypeScript", "bytes": "41954506" }, { "name": "Visual Basic .NET", "bytes": "893" } ], "symlink_target": "" }
#ifndef PICTUREPREVIEWWIDGET_H #define PICTUREPREVIEWWIDGET_H #include <QWidget> #include <QPixmap> #include <QPaintEvent> class PicturePreviewWidget : public QWidget { Q_OBJECT public: explicit PicturePreviewWidget(QWidget *parent = 0); void LoadImage(QPixmap * pPixmap); void UnloadImage(); void paintEvent(QPaintEvent * e); private: QPixmap * pPixmap; signals: public slots: }; #endif // PICTUREPREVIEWWIDGET_H
{ "content_hash": "b82b6362accf1d7c76ac1bf21924dea0", "timestamp": "", "source": "github", "line_count": 30, "max_line_length": 58, "avg_line_length": 15.833333333333334, "alnum_prop": 0.6863157894736842, "repo_name": "dbautsch/QScreenshot", "id": "a0fa235be058ba2be1c14f74d3f32f1bd9bdbba2", "size": "1017", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "QScreenshot/PicturePreviewWidget.h", "mode": "33261", "license": "mit", "language": [ { "name": "C++", "bytes": "96049" }, { "name": "QMake", "bytes": "1575" } ], "symlink_target": "" }
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width" /> <title></title> <script src="http://code.jquery.com/jquery-1.12.0.min.js"></script> <link data-require="[email protected]" data-semver="1.0.0-beta.1" rel="stylesheet" href="http://code.ionicframework.com/1.0.0-beta.1/css/ionic.css" /> <link href="../node_modules/mocha/mocha.css" rel="stylesheet" /> <link href="../bower_components/bootstrap/dist/css/bootstrap.css" rel="stylesheet" /> <link href="../bower_components/bootstrap/dist/css/bootstrap-theme.css" rel="stylesheet" /> <link rel="stylesheet" href="style.css" /> <script data-require="[email protected]" data-semver="1.0.0-beta.1" src="http://code.ionicframework.com/1.0.0-beta.1/js/ionic.bundle.js"></script> <!-- cordova script (this will be a 404 during development) --> <script src="cordova.js"></script> <script src="js/app.js"></script> <script src="js/controllers.js"></script> <script src="js/mqttws31.js" type="text/javascript"></script> <script src="../bower_components/jquery/dist/jquery.min.js"></script> <script src="../bower_components/bootstrap/dist/js/bootstrap.min.js"></script> <script src="../node_modules/mocha/mocha.js"></script> <script src="../node_modules/chai/chai.js"></script> <script>mocha.setup('bdd')</script> <script src="../build/bootstrap-waitingfor.js"></script> <script src="waitingfor.test.js"></script> <link rel="stylesheet" href="css/styles.css"/> </head> <body ng-app="starter" onload="clearmsg();"> <ion-nav-view ></ion-nav-view> </body> </html>
{ "content_hash": "9bc09a5fdcbc33057dcedba65fcf0dbe", "timestamp": "", "source": "github", "line_count": 43, "max_line_length": 155, "avg_line_length": 40.093023255813954, "alnum_prop": 0.6554524361948956, "repo_name": "jchilela/Adjust_comfort_information", "id": "c87a0347c6c48a993fd1fb32e769a95b8260fe13", "size": "1724", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "www/index.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "3033" }, { "name": "CSS", "bytes": "20366" }, { "name": "HTML", "bytes": "45092" }, { "name": "Java", "bytes": "6311" }, { "name": "JavaScript", "bytes": "207690" }, { "name": "PHP", "bytes": "1005" } ], "symlink_target": "" }
#region License #endregion using System.IO; using System.Threading; using System.Threading.Tasks; namespace Gremlin.Net.Structure.IO.GraphBinary.Types { /// <summary> /// A <see cref="Property"/> serializer. /// </summary> public class PropertySerializer : SimpleTypeSerializer<Property> { /// <summary> /// Initializes a new instance of the <see cref="PropertySerializer" /> class. /// </summary> public PropertySerializer() : base(DataType.Property) { } /// <inheritdoc /> protected override async Task WriteValueAsync(Property value, Stream stream, GraphBinaryWriter writer, CancellationToken cancellationToken = default) { await writer.WriteNonNullableValueAsync(value.Key, stream, cancellationToken).ConfigureAwait(false); await writer.WriteAsync(value.Value, stream, cancellationToken).ConfigureAwait(false); // placeholder for the parent element await writer.WriteAsync(null, stream, cancellationToken).ConfigureAwait(false); } /// <inheritdoc /> protected override async Task<Property> ReadValueAsync(Stream stream, GraphBinaryReader reader, CancellationToken cancellationToken = default) { var p = new Property( (string)await reader.ReadNonNullableValueAsync<string>(stream, cancellationToken).ConfigureAwait(false), await reader.ReadAsync(stream, cancellationToken).ConfigureAwait(false)); // discard parent element await reader.ReadAsync(stream, cancellationToken).ConfigureAwait(false); return p; } } }
{ "content_hash": "9f8a636835c9425627f4600033c79647", "timestamp": "", "source": "github", "line_count": 51, "max_line_length": 120, "avg_line_length": 34.31372549019608, "alnum_prop": 0.6434285714285715, "repo_name": "apache/tinkerpop", "id": "556cd9169798083e98e926be87f4bbf1d75c5260", "size": "2561", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphBinary/Types/PropertySerializer.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ANTLR", "bytes": "59230" }, { "name": "Awk", "bytes": "2335" }, { "name": "Batchfile", "bytes": "3976" }, { "name": "C#", "bytes": "1745461" }, { "name": "Dockerfile", "bytes": "8353" }, { "name": "Gherkin", "bytes": "606034" }, { "name": "Go", "bytes": "776105" }, { "name": "Groovy", "bytes": "337658" }, { "name": "Java", "bytes": "11495240" }, { "name": "JavaScript", "bytes": "596328" }, { "name": "Python", "bytes": "685711" }, { "name": "Shell", "bytes": "71980" }, { "name": "TypeScript", "bytes": "154521" }, { "name": "XSLT", "bytes": "2205" } ], "symlink_target": "" }
<?php /** * Collection of utilities for various Zend_Service_Technorati classes. * * @category Zend * @package Zend_Service * @subpackage Technorati * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Service_Technorati_Utils { /** * Parses, validates and returns a valid Zend_Uri object * from given $input. * * @param string|Zend_Uri_Http $input * @return null|Zend_Uri_Http * @throws Zend_Service_Technorati_Exception * @static */ public static function normalizeUriHttp($input) { // allow null as value if ($input === null) { return null; } /** * @see Zend_Uri */ // require_once 'Zend/Uri.php'; if ($input instanceof Zend_Uri_Http) { $uri = $input; } else { try { $uri = Zend_Uri::factory((string) $input); } // wrap exception under Zend_Service_Technorati_Exception object catch (Exception $e) { /** * @see Zend_Service_Technorati_Exception */ // require_once 'Zend/Service/Technorati/Exception.php'; throw new Zend_Service_Technorati_Exception($e->getMessage(), 0, $e); } } // allow inly Zend_Uri_Http objects or child classes if (!($uri instanceof Zend_Uri_Http)) { /** * @see Zend_Service_Technorati_Exception */ // require_once 'Zend/Service/Technorati/Exception.php'; throw new Zend_Service_Technorati_Exception( "Invalid URL $uri, only HTTP(S) protocols can be used"); } return $uri; } /** * Parses, validates and returns a valid Zend_Date object * from given $input. * * $input can be either a string, an integer or a Zend_Date object. * If $input is string or int, it will be provided to Zend_Date as it is. * If $input is a Zend_Date object, the object instance will be returned. * * @param mixed|Zend_Date $input * @return null|Zend_Date * @throws Zend_Service_Technorati_Exception * @static */ public static function normalizeDate($input) { /** * @see Zend_Date */ // require_once 'Zend/Date.php'; /** * @see Zend_Locale */ // require_once 'Zend/Locale.php'; // allow null as value and return valid Zend_Date objects if (($input === null) || ($input instanceof Zend_Date)) { return $input; } // due to a BC break as of ZF 1.5 it's not safe to use Zend_Date::isDate() here // see ZF-2524, ZF-2334 if (@strtotime($input) !== FALSE) { return new Zend_Date($input); } else { /** * @see Zend_Service_Technorati_Exception */ // require_once 'Zend/Service/Technorati/Exception.php'; throw new Zend_Service_Technorati_Exception("'$input' is not a valid Date/Time"); } } /** * @todo public static function xpathQueryAndSet() {} */ /** * @todo public static function xpathQueryAndSetIf() {} */ /** * @todo public static function xpathQueryAndSetUnless() {} */ }
{ "content_hash": "1952c02b104438e6b98dfb1c4976c023", "timestamp": "", "source": "github", "line_count": 117, "max_line_length": 93, "avg_line_length": 29.846153846153847, "alnum_prop": 0.5423825887743413, "repo_name": "PatidarWeb/pimcore", "id": "0c5959f407c929bf36428ce41177e07857bf75d8", "size": "4258", "binary": false, "copies": "12", "ref": "refs/heads/master", "path": "pimcore/lib/Zend/Service/Technorati/Utils.php", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
using System.Web; using System.Web.Mvc; using Microsoft.Owin.Security; namespace PopForums.ExternalLogin { public class ChallengeResult : HttpUnauthorizedResult { public ChallengeResult(string provider, string redirectUri) { LoginProvider = provider; RedirectUri = redirectUri; } public string LoginProvider { get; set; } public string RedirectUri { get; set; } public override void ExecuteResult(ControllerContext context) { context.RequestContext.HttpContext.Response.SuppressFormsAuthenticationRedirect = true; context.HttpContext.GetOwinContext().Authentication.Challenge(new AuthenticationProperties{ RedirectUri = RedirectUri }, LoginProvider); } } }
{ "content_hash": "bd5ce618ca330692a2ec457e102c1dc9", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 139, "avg_line_length": 28.833333333333332, "alnum_prop": 0.7832369942196532, "repo_name": "COTB/Hackathon2014", "id": "e72bf2f00bd07fcad12dcc3e5b5008f68e1b8e77", "size": "694", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "POPForums/PopForums/ExternalLogin/ChallengeResult.cs", "mode": "33188", "license": "mit", "language": [ { "name": "ASP", "bytes": "216" }, { "name": "C#", "bytes": "1267868" }, { "name": "CSS", "bytes": "16701" }, { "name": "JavaScript", "bytes": "155314" } ], "symlink_target": "" }
using Plugin.ShareFile.Abstractions; using System; namespace Plugin.ShareFile { /// <summary> /// Implementation for ShareFile /// </summary> public class ShareFileImplementation : IShareFile { public void ShareLocalFile(string localFilePath, string title = "", object view = null) { throw new NotImplementedException(); } public System.Threading.Tasks.Task ShareRemoteFile(string fileUri, string fileName, string title = "", object view = null) { throw new NotImplementedException(); } } }
{ "content_hash": "ef53376da271b8c2e224bc06c1e9f9c0", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 130, "avg_line_length": 25.59090909090909, "alnum_prop": 0.6714031971580817, "repo_name": "nielscup/ShareFile", "id": "f45e1465f8dd66b804ef7eb493630cc72b7b000a", "size": "563", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ShareFile/Plugin.ShareFile.WindowsPhone81/ShareFileImplementation.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "47799" } ], "symlink_target": "" }
var browserSync = require('browser-sync'); var config = require('../config/html'); var gulp = require('gulp'); var handleErrors = require('../lib/handleErrors'); gulp.task('html', function() { return gulp.src(config.src) .on('error', handleErrors) .pipe(gulp.dest(config.dest)) .pipe(browserSync.reload({stream:true})); });
{ "content_hash": "8f2240d8e0c150f643490e38693c1f2c", "timestamp": "", "source": "github", "line_count": 11, "max_line_length": 50, "avg_line_length": 32.18181818181818, "alnum_prop": 0.6412429378531074, "repo_name": "ebessa/app-starter", "id": "c108a5dc7671980a71d6cc52cf32f0054a220b25", "size": "354", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "gulpfile.js/tasks/html.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "2180" }, { "name": "HTML", "bytes": "542" }, { "name": "JavaScript", "bytes": "11352" } ], "symlink_target": "" }
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.jdisc.service; import com.yahoo.jdisc.Request; import com.yahoo.jdisc.handler.ContentChannel; import com.yahoo.jdisc.handler.ResponseHandler; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertTrue; /** * @author Simon Thoresen Hult */ public class AbstractClientProviderTestCase { @Test void requireThatAbstractClassIsAClientProvider() { assertTrue(ClientProvider.class.isInstance(new MyClientProvider())); } @Test void requireThatStartDoesNotThrowAnException() { new MyClientProvider().start(); } private static class MyClientProvider extends AbstractClientProvider { @Override public ContentChannel handleRequest(Request request, ResponseHandler handler) { return null; } } }
{ "content_hash": "a8cf797e36713270676b2eb997dc9ae7", "timestamp": "", "source": "github", "line_count": 34, "max_line_length": 104, "avg_line_length": 27.441176470588236, "alnum_prop": 0.7341907824222936, "repo_name": "vespa-engine/vespa", "id": "9fe0b91cb39e465d84ec4a2ea1c88ca891dae584", "size": "933", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "jdisc_core/src/test/java/com/yahoo/jdisc/service/AbstractClientProviderTestCase.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ANTLR", "bytes": "8130" }, { "name": "C", "bytes": "60315" }, { "name": "C++", "bytes": "29580035" }, { "name": "CMake", "bytes": "593981" }, { "name": "Emacs Lisp", "bytes": "91" }, { "name": "GAP", "bytes": "3312" }, { "name": "Go", "bytes": "560664" }, { "name": "HTML", "bytes": "54520" }, { "name": "Java", "bytes": "40814190" }, { "name": "JavaScript", "bytes": "73436" }, { "name": "LLVM", "bytes": "6152" }, { "name": "Lex", "bytes": "11499" }, { "name": "Makefile", "bytes": "5553" }, { "name": "Objective-C", "bytes": "12369" }, { "name": "Perl", "bytes": "23134" }, { "name": "Python", "bytes": "52392" }, { "name": "Roff", "bytes": "17506" }, { "name": "Ruby", "bytes": "10690" }, { "name": "Shell", "bytes": "268737" }, { "name": "Yacc", "bytes": "14735" } ], "symlink_target": "" }
package mcjty.immcraft.books.elements; import mcjty.immcraft.books.renderers.RenderElement; import mcjty.immcraft.books.renderers.RenderElementIndent; import mcjty.immcraft.setup.ClientProxy; public class BookElementIndent implements BookElement { public static final String INDENTSTRING = " " + '\u2022'; @Override public int getWidth(int curw) { return (int) ClientProxy.font.getWidth(INDENTSTRING); } @Override public int getHeight() { return (int) ClientProxy.font.getHeight(); } @Override public RenderElement createRenderElement(int x, int y, int w, int h) { return new RenderElementIndent(x, y); } }
{ "content_hash": "c2da29450eb30dda15ab8e90c0adcf62", "timestamp": "", "source": "github", "line_count": 25, "max_line_length": 74, "avg_line_length": 27.24, "alnum_prop": 0.7077826725403817, "repo_name": "McJty/ImmersiveCraft", "id": "9d151b1c78733f9ed26af66d529f29879fbed3b5", "size": "681", "binary": false, "copies": "1", "ref": "refs/heads/1.12", "path": "src/main/java/mcjty/immcraft/books/elements/BookElementIndent.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "444794" } ], "symlink_target": "" }
<p>This is the partial for view 1.</p> <div class="panel panel-default"> <div class="panel-heading"> <h3>Products</h3> <div class="panel-body"> <button class="btn btn-primary" ng-click="incrementPrices()"> Change prices </button> </div> <div class="panel-body"> <div unordered-list="products" list-property="price | currency"></div> </div> <h3>Products - directive 2</h3> <div class="panel-body"> <div unordered-list2="products" list-property="price | currency"></div> </div> </div> </div>
{ "content_hash": "7a56ef2b66b46ed38c1fe01450a589ad", "timestamp": "", "source": "github", "line_count": 32, "max_line_length": 74, "avg_line_length": 16.8125, "alnum_prop": 0.6319702602230484, "repo_name": "davidbarrows/dBWeb3", "id": "8fed6d8a8267a6032568f9b7caa061e5fc696766", "size": "538", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/view1/view1.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "366" }, { "name": "HTML", "bytes": "7003" }, { "name": "JavaScript", "bytes": "8318" } ], "symlink_target": "" }
"""Setup and activate a python virtual environment through setup.""" __author__ = ('Lance Finn Helsten',) __version__ = '0.7.4' __copyright__ = """Copyright (C) 2014 Lance Helsten""" __docformat__ = "reStructuredText en" __license__ = """ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ from .venv import *
{ "content_hash": "215f794fd4b601995ed7bd19e0b6ecdc", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 76, "avg_line_length": 39.285714285714285, "alnum_prop": 0.7078787878787879, "repo_name": "lanhel/ftpysetup", "id": "2f988e162e76baa8a3583ab528360eb5f4b1ca5d", "size": "953", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ftpysetup/venv/__init__.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "27162" }, { "name": "Python", "bytes": "81977" } ], "symlink_target": "" }
<!doctype html PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html> <head> <link rel="stylesheet" type="text/css" href="style.css" /> <link rel="shortcut icon" href="images/logoicon.gif" type="image/gif" /> <title>The Dependency Finder Developer Guide</title> </head> <body> <h1>The Dependency Finder Developer Guide</h1> <p> For Dependency Finder version 1.2.1-beta1. </p> <p> by Jean Tessier </p> <hr /> <h2>Table of Contents</h2> <ul> <li><a href="#Introduction">Introduction</a></li> <li><a href="#Installation">Installation</a></li> <ul> <li><a href="#Third-PartyPackages">Third-Party Packages</a></li> <li><a href="#JavaApplication">Java Application</a></li> <ul> <li><a href="#JAVA_HOME"><code>JAVA_HOME</code></a></li> <li><a href="#DEPENDENCYFINDER_HOME"><code>DEPENDENCYFINDER_HOME</code></a></li> <li><a href="#DEPENDENCYFINDER_OPTS"><code>DEPENDENCYFINDER_OPTS</code></a></li> <li><a href="#DEPENDENCYFINDER_CONSOLE"><code>DEPENDENCYFINDER_CONSOLE</code></a></li> </ul> <li><a href="#WebApplication">Web Application</a></li> <ul> <li><a href="#web.xml"><code>web.xml</code></a></li> </ul> </ul> <li><a href="#HistoryBehindDependencyFinder">History Behind Dependency Finder</a></li> <ul> <li><a href="#ClassFiles">Class Files</a></li> <li><a href="#Dependencies">Dependencies</a></li> <li><a href="#Metrics">Metrics</a></li> <li><a href="#APIDifferences">API Differences</a></li> </ul> <li><a href="#ContributingtoDependencyFinder">Contributing to Dependency Finder</a></li> <ul> <li><a href="#SeparateProject">Separate Project</a></li> <li><a href="#Assimilation">Assimilation</a></li> <li><a href="#Money">Money</a></li> </ul> <li><a href="#ClassFilesX">Class Files</a></li> <ul> <li><a href="#ClassfileLoader"><code>ClassfileLoader</code></a></li> <li><a href="#Visitor"><code>Visitor</code></a></li> </ul> <li><a href="#DependenciesX">Dependencies</a></li> <ul> <li><a href="#DependencyExtractor"><code>DependencyExtractor</code></a></li> <li><a href="#UpdatingtheGraphforChangedFiles">Updating the Graph for Changed Files</a></li> <li><a href="#extract.jsp"><code>extract.jsp</code></a></li> <li><a href="#SampleStandaloneApplicationwithRefresh">Sample Standalone Application with Refresh</a></li> <li><a href="#VisitorX"><code>Visitor</code></a></li> <ul> <li><a href="#VisitorandTraversalStrategy"><code>Visitor</code> and <code>TraversalStrategy</code></a></li> </ul> </ul> <li><a href="#OOMetrics">OO Metrics</a></li> <ul> <li><a href="#DataStructure">Data Structure</a></li> </ul> <li><a href="#APIDifferencesX">API Differences</a></li> <li><a href="#Command-LineParsing">Command-Line Parsing</a></li> <li><a href="#BuildingDependencyFinder">Building Dependency Finder</a></li> <ul> <li><a href="#BuildinganExecutable">Building an Executable</a></li> <li><a href="#BuildingtheDocumentation">Building the Documentation</a></li> <li><a href="#CompilingaBuild">Compiling a Build</a></li> <li><a href="#TestingtheBuild">Testing the Build</a></li> <li><a href="#MakingaRelease">Making a Release</a></li> <li><a href="#ComputingCodeCoverage">Computing Code Coverage</a></li> <ul> <li><a href="#Emma">Emma</a></li> <li><a href="#Clover">Clover</a></li> </ul> </ul> </ul> <hr /> <a name="Introduction"></a> <h2>Introduction</h2> <hr /> <a name="Installation"></a> <h2>Installation</h2> <a name="Third-PartyPackages"></a> <h3>Third-Party Packages</h3> <p> Dependency Finder uses a number of third-party packages, especially for testing. Everything you need to run Dependency Finder is in the distribution files, but you will need additional software if you want to compile your own custom version and/or run the test suite. The tables below list those third-party packages, where you can find them, and which version we have tried Dependency Finder with. Older or newer version have a good change of working too, but these are tried and true. </p> <p> For simple compilation: </p> <table> <tr><th>Name</th><th>Location</th><th>Tested Version</th></tr> <tr><td>Tomcat</td><td><a href="http://tomcat.apache.org/">tomcat.apache.org</a></td><td align="center">5.5.17</td></tr> <tr><td>WebWork</td><td><a href="http://www.opensymphony.org/webwork/">www.opensymphony.org/webwork</a></td><td align="center">2.2.4</td><td style="font-size: small">You may need to change the JAR's name in <code>[text]junit[.bat]</code>.</td></tr> </table> <p> For testing: </p> <table> <tr><th>Name</th><th>Location</th><th>Tested Version</th></tr> <tr><td>JUnit</td><td><a href="http://junit.org/">junit.org</a></td><td align="center">3.8.2</td></tr> <tr><td>jMock</td><td><a href="http://jmock.org/">jmock.org</a></td><td align="center">2.4.0</td></tr> <tr><td>FitLibrary</td><td><a href="http://fitlibrary.sourceforge.net/">fitlibrary.sourceforge.net</a></td><td align="center">2006-01-16</td></tr> <tr><td>HttpUnit</td><td><a href="http://httpunit.sourceforge.net/">httpunit.sourceforge.net</a></td><td align="center">1.6.2</td></tr> <tr><td>Emma</td><td><a href="http://emma.sourceforge.net/">emma.sourceforge.net</a></td><td align="center">2.0.5312</td></tr> <tr><td>Clover</td><td><a href="http://www.cenqua.com/clover/">cenqua.com/clover</a></td><td align="center">1.3.13</td><td style="font-size: small">You will need the <code>clover-ant</code> distribution.</td></tr> </table> <a name="JavaApplication"></a> <h3>Java Application</h3> <a name="JAVA_HOME"></a> <h4><code>JAVA_HOME</code></h4> <a name="DEPENDENCYFINDER_HOME"></a> <h4><code>DEPENDENCYFINDER_HOME</code></h4> <a name="DEPENDENCYFINDER_OPTS"></a> <h4><code>DEPENDENCYFINDER_OPTS</code></h4> <a name="DEPENDENCYFINDER_CONSOLE"></a> <h4><code>DEPENDENCYFINDER_CONSOLE</code></h4> <a name="WebApplication"></a> <h3>Web Application</h3> <a name="web.xml"></a> <h4><code>web.xml</code></h4> <hr /> <a name="HistoryBehindDependencyFinder"></a> <h2>History Behind Dependency Finder</h2> <a name="ClassFiles"></a> <h3>Class Files</h3> <a name="Dependencies"></a> <h3>Dependencies</h3> <a name="Metrics"></a> <h3>Metrics</h3> <a name="APIDifferences"></a> <h3>API Differences</h3> <hr /> <a name="ContributingtoDependencyFinder"></a> <h2>Contributing to Dependency Finder</h2> <p> I spend a lot of my personal time on Dependency Finder and I have grown very attached to it. I work very hard to keep the code quality as high as I can, and in order to do that, I must retain strict control over what goes into Dependency Finder. I take great pride in the work I do on Dependency Finder and that is part of why all the package names start with "<code>com.jeantessier</code>". </p> <p> If you have built some great addition or enhancement to Dependency Finder, there are two ways you can share it with the world and help Dependency Finder (and yourself too). </p> <a name="SeparateProject"></a> <h3>Separate Project</h3> <p> The best way to share your addition/enhancement with the world is for you to create your own open source project. <a href="http://sourceforge.net/">SourceForge</a> can help you with this and there are other alternatives. With your own project, you can take all the credit for your work and manage it the way <b>you</b> want to. You are free to redistribute Dependency Finder with your code. You don't have to make your project open source if you don't want to, you can charge for it or release it to the public domain. The Dependency Finder license is very lax, you can do pretty much what you want with it as long as my name remains on the Dependency Finder code. </p> <p> By pointing to the Dependency Finder project from your project, you help it show up on web search engines like <a href="http://www.yahoo.com/">Yahoo!</a> and <a href="http://www.google.com/">Google</a>. This raises awareness of Dependency Finder and helps it gain popularity. I will, of course, return the favor and mention you project on the Dependency Finder website. This way, we both help each other. </p> <a name="Assimilation"></a> <h3>Assimilation</h3> <p> Another, less desireable, option is for you to surrender your code to me for inclusion in Dependency Finder. I will review your code thoroughly and I may modify it extensively to make it meets <b>my</b> standards of quality (I'm not necessarily claiming that my standards are better, but they are <b>mine</b>) and that it fits well with the rest of Dependency Finder. In the end, your code will end up in a <code>com.jeantessier</code> package and will bear the standard license header. Your name and the nature of your contribution will be listed on the Dependency Finder website and in some of the documentation, but most likely nowhere in the code itself. </p> <a name="Money"></a> <h3>Money</h3> <p> At this time, I do not accept any monetary contributions or any other form of compensation. The only thing I get out of Dependency Finder is the joy to know people are using my stuff and actually finding it useful. I don't even accept donations as some people might construe it entitles them to <i>something</i>. If you want to help the project, simply tell a friend, or two, or three ... </p> <hr /> <a name="ClassFilesX"></a> <h2>Class Files</h2> <p> You use the <code>com.jeantessier.classreader</code> package to parse compiled Java code. You feed <code>.class</code> files to a <code>ClassfileLoader</code> and you get instances of <code>Classfile</code> back. </p> <a name="ClassfileLoader"></a> <h3><code>ClassfileLoader</code></h3> <div align="center"> <img src="images/ClassfileLoaders.gif" /><br /> <b><code>CLassfileLoader</code> Hierarchy</b> </div> <p> Here is the basic interface for <code>ClassfileLoader</code>: </p> <div class="highlight"> <pre> public class ClassfileLoader { public void <b>load</b>(Collection filenames) { public Collection <b>getAllClassfiles</b>(); } </pre> </div> <p> At the most simple, you can just call <code>load(filenames)</code> and then iterate over the <code>Classfile</code>s from <code>getAllClassfiles()</code>. </p> <div class="lowlight"> <pre> Collection sources = /* Get filenames to read ... */ ClassfileLoader loader = new AggregatingClassfileLoader(); loader.load(sources); </pre> <pre> for(Classfile classfile: loader.getAllClassfiles()) { /* Do something with classfile ... */ } </pre> </div> <p> This approach has a few drawbacks. First, it requires you to read all the <code>.class</code> files into memory before you can start processing them. Often, processing one class does not require any of the others, so this is potentially using up a lot of memory needlessly. Second, there is no way for you to monitor classes as they are being loaded. This comes in handy for showing progress indicators. </p> <p> For those reasons, you should use an event-driven approach instead. You can implement the <code>LoadListener</code> interface and register with the <code>ClassfileLoader</code> by calling <code>addLoadListener(listener)</code> (not shown above). Your implementation will receive various callbacks as the <code>.class</code> files are read in to let it know how things are progressing. </p> <div class="lowlight"> <pre> class MyLoadListener implements LoadListener { public void endClassfile(LoadEvent event) { Classfile classfile = event.getClassfile(); /* Do something with classfile ... */ } /* ... */ } </pre> <pre> Collection sources = /* Get filenames to read ... */ LoadListener listener = MyLoadListener(); ClassfileLoader loader = new TransientClassfileLoader(); loader.addLoadListener(listener); loader.load(sources); </pre> </div> <p> The <code>ClassfileLoader</code> classes you will use the most often derive from <code>ClassfileLoaderEventSource</code>. These loaders are the ones who actually create instances of <code>Classfile</code>. They also keep track of <code>LoadListener</code> objects and drive the event model associated with parsing class files. </p> <p> There are two concrete subclasses of <code>ClassfileLoaderEventSource</code>: </p> <ul> <li>AggregatingClassfileLoader</li> <li>TransientClassfileLoader</li> </ul> <p> <code>AggregatingClassfileLoader</code> keeps a reference to every <code>Classfile</code> it loads. You can access them through <code>getAllClassfiles()</code>. <code>TransientClassfileLoader</code>, on the other hand, does not hold on to any of them. It simply drives the event loop. It's implementation of <code>getAllClassfiles()</code> returns an empty collection. </p> <p> <code>ClassfileLoader</code> has only one public method for loading classes that takes a collection of names. This defines a session. The listeners will receive a <code>beginSession</code> event at the beginning of the method and an <code>endSession</code> event just before the method returns. Each name in the collection defines a group. This can be a JAR file, a Zip file, a directory hierarchy containing <code>.class</code> files, or even a single <code>.class</code> file. The processing of each group starts with a <code>beginGroup</code> event and ends with an <code>endGroup</code> event. The loader treats a group as a collection of files. Each file is processed in turn, begining with a <code>beginFile</code> event and ending with an <code>endFile</code> event. The loader uses a <code>ClassfileLoaderDispatcher</code> instance to determine how to process a file. If the file is a <code>.class</code> file (as per the dispatcher), the loader finally starts processing it, surrounded by a <code>beginClassfile</code> event and an <code>endClassfile</code> event. The <code>EndClassfile</code> event will have a reference to the newly loaded <code>Classfile</code> instance. </p> <p> Node that the various <code>begin???</code> events are not guaranteed to be matched by corresponding <code>end???</code> events. Various errors can lead to the loss of events. </p> <p> In summary, you can get instances of <code>Classfile</code> either from <code>endClassfile</code> events or by querying the loader. Once you have them, you can traverse them with objects that implement <code>com.jeantessier.classreader.Visitor</code>. They have callback methods that get called by the various parts of <code>Classfile</code> objects. </p> <p> <code>EventSourceClassfileLoader</code> uses other <code>ClassfileLoader</code> implementation to process the various kinds of files it encounters. Depending on the nature of a file, as determined by its dispatcher, the loader uses one of three <i>decorator</i> loaders to actually open input streams to individual class files. These decorators are subclasses of <code>ClassfileLoaderDecorator</code>. They are: </p> <ul> <li>DirectoryClassfileLoader</li> <li>ZipClassfileLoader</li> <li>JarClassfileLoader</li> </ul> <p> A decorator opens input streams from the data sources and passes them to an underlying <code>ClassfileLoader</code>. The reason for the distinction is to separate concerns of how long the <code>Classfile</code> instances remain in memory from concerns about how to open various input file types. </p> <a name="Visitor"></a> <h3><code>Visitor</code></h3> <p> We use <code>Classfile</code> instances to represent the data in <code>.class</code> files. We just saw how to get <code>Classfile</code> instances using a <code>ClassfileLoader</code> and the event-driven mechanism. Now, <code>Classfile</code> is actually the root of a large set of objects that represent all the details of a compiled Java class. Traversing this complex object graph can be non-trivial and is very repetitive. This is why Dependency Finder uses the Visitor pattern as a means of traversing <code>Classfile</code> data. </p> <p> You can implement the <code>com.jeantessier.classreader.Visitor</code> interface to traverse <code>Classfile</code> structures. It has callback methods that get called on various parts of the structure. </p> <p> One easy solution is to have a class that implements both <code>LoadListener</code> and <code>Visitor</code> with the following <code>endClassfile()</code> method: </p> <div class="lowlight"> <pre> class MyListenerAndVisitor implements LoadListener, Visitor { public void endClassfile(LoadEvent event) { event.getClassfile().accept(this); } /* ... */ } </pre> </div> <p> You might end up having quite a few visitors, all duplicating this piece of code. So we already provide it as part of the Dependency Finder library. The class <code>LoadListenerVisitorAdapter</code> takes a <code>Visitor</code> and hands it over to <code>Classfile</code> instances are they are made available by the <code>ClassfileLoader</code>. With it, your class only needs to implement the <code>Visitor</code> interface and can focus on the processing at hand, instead needing a series of empty methods to satisfy the <code>LoadListener</code> contract. </p> <div class="lowlight"> <pre> class MyVisitor implements Visitor { /* ... */ } </pre> <pre> Collection sources = /* Get filenames to read ... */ MyVisitor visitor = MyVisitor(); ClassfileLoader loader = new TransientClassfileLoader(); loader.addLoadListener(new LoadListenerVisitorAdapter(visitor)); loader.load(sources); </pre> </div> <div align="center"> <img src="images/LoadListenerVisitorAdapter.gif" /><br /> <b><code>LoadListener</code> to <code>Visitor</code> Adapter</b> </div> <p> Look at the code of <code>ClassMetrics</code> for an example of using the Visitor pattern to traverse <code>Classfile</code> instances. </p> <hr /> <a name="DependenciesX"></a> <h2>Dependencies</h2> <p> You create a dependency graph with a <code>NodeFactory</code>. The factory keeps track of the package nodes at the top of the graph and all their surbordinate nodes. Individual nodes keep track of their outbound and inbound dependencies. </p> <p> You extract dependencies from <code>Classfile</code> instances with a <code>CodeDependencyCollector</code>. You can either give it your own <code>NodeFactory</code> or you can let it create an empty one for you. <code>CodeDependencyCollector</code> is a <code>Visitor</code>, so you can register it with a <code>ClassfileLoader</code> using a <code>LoadListenerVisitorAdapter</code> so it will visit each <code>Classfile</code> as it is loaded. </p> <div class="lowlight"> <pre> Collection sources = /* Get filenames to read ... */ NodeFactory factory = new NodeFactory(); Visitor visitor = CodeDependencyCollector(factory); ClassfileLoader loader = new TransientClassfileLoader(); loader.addLoadListener(new LoadListenerVisitorAdapter(visitor)); loader.load(sources); </pre> <pre> /* Further processing using factory ... */ </pre> </div> <div align="center"> <img src="images/CodeDependencyCollectorEventChain.gif" /><br /> <b>Processing files with <code>CodeDependencyCollector</code></b> </div> <p> <code>CodeDependencyCollector</code> fires its own set of events during processing. If you are interested in those events, simply implement <code>DependencyListener</code> and register yourself with the collector through its <code>addDependencyListener()</code> method. Processing a <code>Classfile</code> begins with a <code>beginClass</code> event and ends with an <code>endClass</code> event. As the processing unfolds, it will fire a <code>dependency</code> event for each dependency in encounters. Please note that while the dependency graph shows only a single dependency for <code>A&nbsp;--&gt;&nbsp;B</code>, the collector can potentially fire multiple <code>dependency</code> events for it if it occurs more than once in the code. It is also impossible to determine the order of calls from the dependency graph, but the events arrive in the order the dependencies are discovered. </p> <p> For example, if you take the following method: </p> <div class="highlight"> <pre> public void f() throws Exception { try { out.write("abcd"); } catch (java.io.IOException ex) { out.close() } } </pre> </div> <p> Processing it will fire the following events in this order: </p> <ol> <li><code>f() --&gt; out</code></li> <li><code>f() --&gt; java.io.Writer</code></li> <li><code>f() --&gt; java.io.Writer.write(java.lang.String)</code></li> <li><code>f() --&gt; java.lang.String</code></li> <li><code>f() --&gt; out</code></li> <li><code>f() --&gt; java.io.Writer</code></li> <li><code>f() --&gt; java.io.Writer.close()</code></li> <li><code>f() --&gt; java.io.IOException</code></li> <li><code>f() --&gt; java.lang.Exception</code></li> </ol> <p> No. 4 comes from analyzing the signature of <code>write()</code>, <b>not</b> from the constant <code>"abcd"</code>. No. 8 comes from looking at exception handlers. </p> <p> Because <code>Node</code> uses <code>Set</code> to store dependencies on other <code>Node</code>s, duplicate dependencies are removed. No. 1 and No. 5 above are duplicates. No. 2 and No. 6 are duplicates too. In the end, the graph would look as follow: </p> <div class="lowlight"> <pre> f() --&gt; java.io.IOException --&gt; java.io.Writer --&gt; java.io.Writer.close() --&gt; java.io.Writer.write(java.lang.String) --&gt; java.lang.Exception --&gt; java.lang.String --&gt; out </pre> </div> <a name="DependencyExtractor"></a> <h3><code>DependencyExtractor</code></h3> <p> Let's take a look at <code>DependencyExtractor</code> and see how it uses what we've seen so far to generate a dependency graph. Here is the core part of the <code>main()</code> method from <code>com.jeantessier.dependencyfinder.cli.DependencyExtractor</code>. The Ant equivalent is very similar. </p> <div class="highlight"> <pre> 01: List <b>parameters</b> = commandLine.getParameters(); 02: if (parameters.size() <code></code> 0) { 03: parameters.add("."); 04: } 05: 06: VerboseListener <b>verboseListener</b> = new VerboseListener(); 07: 08: NodeFactory <b>factory</b> = new NodeFactory(); 09: CodeDependencyCollector <b>collector</b> = new CodeDependencyCollector(factory); 10: 11: ClassfileLoader <b>loader</b> = new TransientClassfileLoader(); 12: loader.addLoadListener(new LoadListenerVisitorAdapter(collector)); 13: loader.addLoadListener(verboseListener); 14: loader.load(parameters); </pre> </div> <p> On lines 1 through 4, we set <i>parameters</i> to a list of file and directory names, similar to what you would expect on <code>CLASSPATH</code>. The <code>ClassfileLoader</code> will explore each one in turn, looking for <code>.class</code> files. Typically, I give it a single directory where my compiled classes are, such as <code>classes/</code>, or a single JAR file, such as <code>myapp.jar</code>. For large projects, I have sometimes give it multiple JARs, though now <code>ClassfileLoader</code> is smart enough to search for them automatically if I put all the JARs in one directory, such as <code>lib/</code>. </p> <p> Line 6 sets <i>verboseListener</i>. It is only there to provide a progress indicator for the user. It counts how many files are slated to be processed and listens to "beginFile" events to tell the user how many percent-complete. It also displays the name of files are they are being processed. There is a <code>VerboseListenerBase</code> in the <code>com.jeantessier.dependencyfinder</code> package with common functionality. Each subpackage (<code>cli</code>, <code>ant</code>, <code>gui</code>, the webapp) extends it to create its own <code>VerboseListener</code> that is specific to that package's user interface. </p> <p> Lines 8 and 9 set up the <i>collector</i> that will build the graph and store it in <i>factory</i>. After all this, <i>factory</i> will contain the resulting graph. </p> <p> Line 11 creates the <i>loader</i> and lines 12 and 13 attach our two listeners to it so they will receive <code>LoadEvent</code>s. Notice how we use a <code>LoadListenerVisitorAdapter</code> to tie the <i>collector</i>. Again, <i>verboseListener</i> on line 13 is only there to help keep the user appraised of what is going on. </p> <p> With the entire event pipeline in place, we finally put it all in motion on line 14 by passing it the <i>parameters</i>. After control returns from <code>load()</code>, the dependency graph is in <i>factory</i>. </p> <p> What I typically do is pass <code>factory.getPackages().values()</code> to some visitor. All visitors have a <code>traverseNodes()</code> method that takes a collection of <code>Nodes</code>. So it usually looks like: </p> <pre> visitor.traverseNodes (factory.getPackages().values()); </pre> <p> You might also want to look at <code>GraphCopier</code> and <code>GraphSummarizer</code> as example visitors. They use two factories and a <code>TraversalStrategy</code> to make a partial copy of a graph. You can take a look at <code>query.jsp</code> for an example of how this is done. It uses the graph in the <i>factory</i>, select specific nodes and dependencies from it according to the <code>TraversalStragey</code>, and copy them to their own internal <code>NodeFactory</code> instances. Then, the JSP runs a <code>Printer</code> on the scope <code>NodeFactory</code> from the copier, not the original <i>factory</i>. </p> <a name="UpdatingtheGraphforChangedFiles"></a> <h3>Updating the Graph for Changed Files</h3> <p> So far, we have looked at extracting a brand new graph. For a large codebase, this can take a while. It would be nice if, after making a simple change, we could refresh the graph quickly by having it re-extract only those files that have changed and adjust the graph accordingly. </p> <div align="center"> <img src="images/ExtractingWithMonitor_class.gif" /><br /> <b>Updating a Graph using <code>Monitor</code></b> </div> <div align="center"> <img src="images/ExtractingWithMonitor_sequence.gif" /><br /> <b>Updating a Graph using <code>Monitor</code></b> </div> <a name="extract.jsp"></a> <h3><code>extract.jsp</code></h3> <p> Let's take a look at <code>extract.jsp</code> and see how it generates a dependency graph and how it differs from what we saw for <code>DependencyExtractor</code>. Here is the core part of the JSP. The GUI equivalent is very similar, if spread across multiple classes in the <code>com.jeantessier.dependencyfinder.gui</code> package. </p> <div class="highlight"> <pre> 01: Perl5Util perl = new Perl5Util(); 02: Collection <b>sources</b> = new LinkedList(); 03: perl.split(sources, "/,\\s*/", application.getInitParameter("source")); 04: 05: VerboseListener <b>verboseListener</b> = new VerboseListener(out); 06: 07: ClassfileLoaderDispatcher <b>dispatcher</b> = (ClassfileLoaderDispatcher) application.getAttribute("dispatcher"); 08: if (dispatcher <code></code> null || request.getParameter("update") <code></code> null) { 09: dispatcher = new ModifiedOnlyDispatcher(ClassfileLoaderEventSource.DEFAULT_DISPATCHER); 10: } 11: 12: NodeFactory factory = (NodeFactory) application.getAttribute("factory"); 13: if (factory <code></code> null || request.getParameter("update") <code></code> null) { 14: factory = new NodeFactory(); 15: } 16: 17: Monitor <b>monitor</b> = (Monitor) application.getAttribute("monitor"); 18: if (monitor <code></code> null || request.getParameter("update") <code></code> null) { 19: CodeDependencyCollector <b>collector</b> = new CodeDependencyCollector(factory); 20: DeletingVisitor <b>deletingVisitor</b> = new DeletingVisitor(factory); 21: 22: monitor = new Monitor(collector, deletingVisitor); 23: } 24: 25: ClassfileLoader <b>loader</b> = new TransientClassfileLoader(dispatcher); 26: loader.addLoadListener(verboseListener); 27: loader.addLoadListener(monitor); 28: loader.load(sources); </pre> </div> <p> Lines 1 through 3 set up <i>sources</i>, the equivalent of <i>parameters</i> from <code>DependencyExtractor</code>. We have already covered the purpose of <i>verboseListener</i>, <i>factory</i>, and <i>collector</i>. </p> <p> Lines 7 through 9 set up a special <i>dispatcher</i> for the <i>loader</i>. It has to do with the webapp being a long-running process and <code>extract.jsp</code> being able to only reload the classes that have changed since "the last time." Here, the code uses a <code>ModifiedOnlyDispatcher</code> to remember what was done "the last time." This dispatcher is stored in the session and passed to the <code>ClassfileLoader</code>. That is, unless the user chooses to discard the current graph and start all over, in which case the JSP creates a brand new <i>dispatcher</i>. </p> <p> The JSP also saves <i>factory</i> in the session to make it available to the other JSPs that make up the web application. Lines 12 through 15 deal with retrieving back from the session or creating a new one, as appropriate. </p> <p> Lines 17 through 23 create the <i>monitor</i> that will apply changes to the graph. This is the second part of figuring out what "the last time" was. It, too, keeps track of files as they are flying by on the event pipeline. When the <i>loader</i> reloads a <code>.class</code> file, the <i>monitor</i> will first call <code>removeClass()</code> on <i>deletingVisitor</i> to remove the previous dependencies regarding that class from the graph. It then passes the event along to the <i>collector</i> to add the new dependency information. Just like the <i>dispatcher</i> earlier, the <i>monitor</i> is saved in the session and reused between invocations, unless the user decides to start over, at which point the JSP simply create a brand new one instead of reusing the one in the session. </p> <p> Lines 25 through 28 serve the same purpose as before in <code>DependencyExtractor</code>. Notice that <code>Monitor</code> extends <code>LoadListenerVisitorAdapter</code> and does not need any special treatment before we register it with the <i>loader</i>. </p> <a name="SampleStandaloneApplicationwithRefresh"></a> <h3>Sample Standalone Application with Refresh</h3> <p> If you are writing your own long-lived application that needs to pick up changes to the <code>.class</code> files, you would setup the <code>ClassfileLoader</code> and dispatcher and visitors once at initialization and hold on to the resulting loader. </p> <div class="highlight"> <pre> 01: NodeFactory factory = new NodeFactory(); 02: CodeDependencyCollector collector = new CodeDependencyCollector(factory); 03: DeletingVisitor deletingVisitor = new DeletingVisitor(factory); 04: 05: ClassfileLoaderDispatcher <b>dispatcher</b> = new ModifiedOnlyDispatcher(ClassfileLoaderEventSource.DEFAULT_DISPATCHER); 06: Monitor <b>monitor</b> = new Monitor(collector, deletingVisitor); 07: monitor.setClosedSession(true); 08: 09: <b>loader</b> = new TransientClassfileLoader(<b>dispatcher</b>); 10: loader.addLoadListener(<b>monitor</b>); </pre> </div> <p> Lines 1 through 6 set up the machinery for the <i>loader</i>. We have already covered the purpose of <i>dispatcher</i>, and <i>monitor</i>. </p> <p> Line 7 instructs the <i>monitor</i> to use a <i>closed session</i>. This means that when the <i>loader</i> sends a <code>endSession</code> event, the monitor will remove from the graph any classes that were not looked at during the session that just ended. By default, the <i>monitor</i> uses open sessions and does not remove any classes (except as part of revising a modified class). </p> <p> Lines 9 and 10 setup the <i>loader</i> instance for use by the application. </p> <p> When you want to pickup changes in the classes, all you need to do is call <code>load()</code> on the loader with the location of the <code>.class</code> files. </p> <div class="highlight"> <pre> 01: <b>loader</b>.load(sources); </pre> </div> <p> Here, <i>sources</i> would point to the code that you want to analyze. The application would have to execure this line everytime it wants to refresh the graph, either because it detected a change in the <code>.class</code> files or in response to a user action. </p> <a name="VisitorX"></a> <h3><code>Visitor</code></h3> <p> You can implement the <code>com.jeantessier.dependency.Visitor</code> interface to traverse a dependency graph. It has callback methods that get called by the various instances of <code>Node</code> as the traversal progresses. </p> <p> Look at the code for <code>DependencyReporter</code> and <code>DependencyMetrics</code> for examples of using the Visitor pattern to traverse <code>Node</code> instances. </p> <p> If you traverse a standard dependency graph, such as the ones produced by <code>CodeDependencyCollector</code>, you will visit <b>each</b> dependency twice. If we take the dependency <code>A&nbsp;--&gt;&nbsp;B</code> as an example, a visitor will see it once as an outbound node <code>B</code> while visiting node <code>A</code>, as shown in this call stack: </p> <pre> A.Accept(visitor) visitor.Visit[Package|Class|Feature](A) visitor.VisitOutbound(A.Outbound()) B.AcceptOutbound(visitor) visitorVisitOutbound[Package|Class|Feature]Node(B) </pre> <p> and a second time as an inbound node <code>A</code> while visiting node <code>B</code>, as shown in this call stack: </p> <pre> B.Accept(visitor) visitor.Visit[Package|Class|Feature](B) visitor.VisitInbound(B.Inbound()) A.AcceptInbound(visitor) visitor.VisitInbound[Package|Class|Feature]Node(A) </pre> <p> If you are only interested in outbound dependencies, you only have to implement <code>VisitOutbound[Package|Class|Feature]Node()</code> and leave their inbound equivalents empty. If you are only interested in inbound dependencies, you only have to implement <code>VisitInbound[Package|Class|Feature]Node()</code> and leave their outbound equivalents empty. </p> <p> There is a <code>VisitorBase</code> class that embodies the Template pattern. It implements all the methods from the <code>Visitor</code> interface, provides default traversal of the dependency graph, and offers numerous extension points where specific visitors can insert their own custom behavior. The following class diagram shows all the methods that make up the extension points. </p> <div align="center"> <img src="images/DependencyVisitorBaseTemplatePatterns.gif" /><br /> <b>Template Patterns in <code>VisitorBase</code></b> </div> <p> Let's look into more details at <code>visitPackageNode()</code> to get a better understanding of how the various templates operate. </p> <div class="highlight"> <pre> 01: public void visitPackageNode(PackageNode node) { 02: boolean inScope = <b>isInScope</b>(node); 03: 04: if (inScope) { 05: <b>preprocessPackageNode</b>(node); 06: 07: if (getStrategy().doPreOutboundTraversal()) { 08: traverseOutbound(node.getOutboundDependencies()); 09: } 10: 11: if (getStrategy().doPreInboundTraversal()) { 12: traverseInbound(node.getInboundDependencies()); 13: } 14: 15: <b>preprocessAfterDependenciesPackageNode</b>(node); 16: } 17: 18: traverseNodes(node.getClasses()); 19: 20: if (inScope) { 21: <b>postprocessBeforeDependenciesPackageNode</b>(node); 22: 23: if (getStrategy().doPostOutboundTraversal()) { 24: traverseOutbound(node.getOutboundDependencies()); 25: } 26: 27: if (getStrategy().doPostInboundTraversal()) { 28: traverseInbound(node.getInboundDependencies()); 29: } 30: 31: <b>postprocessPackageNode</b>(node); 32: } 33: } </pre> </div> <p> Line 2 determines if we should bother visiting this package <i>node</i> at all. But before that comes into play, notice that on line 18, we traverse the classes in the package unconditionally. <i>inScope</i> will only affect whether or not we look at the node itself and its dependencies; it has no bearings on classe in the package or their features. The <code>isInScope()</code> method is an extension point for this template method. </p> <p> A subclass can do some processing before going down to visit classes. This is shown in lines 4 through 16. <code>preprocessPackageNode()</code> on line 5, is called before any dependencies or classes have been visited. <code>preprocessAfterDependenciesPackageNode()</code>, on line 15, is called after the dependencies but before the classes. They represent two more extension points for this template method. </p> <p> Similarily, a subclass can do some processing after going down to visit the classes. This is shown in lines 20 through 32. <code>postprocessBeforeDependenciesPackageNode()</code> on line 21, is called before any dependencies but after the classes have been visited. <code>postprocessPackageNode()</code>, on line 31, is called after the dependencies and the classes. They represent two more extension points for this template method. </p> <p> The <code>TraversalStrategy</code> instance decides if inbound or outbound dependencies get visited. The methods <code>traverseNodes()</code>, <code>traverseOutbound()</code>, and <code>traverseInbound()</code> provide the traversal of the graph. They are the common behavior of the template method. </p> <p> The template methods <code>visitClassNode()</code> and <code>visitFeatureNode()</code> work very much the same way, except that <code>FeatureNode</code>s have no descendants. </p> <p> When overriding any of the extension methods, such as <code>preprocessPackageNode()</code> and <code>postprocessPackageNode()</code>, it is very important to call their <code>super</code> definitions. </p> <div class="lowlight"> <pre> protected void preprocessPackageNode(PackageNode node) { super.preprocessPackageNode(node); /* Custom processing ... */ } </pre> <pre> /* ... */ </pre> <pre> protected void postprocessPackageNode(PackageNode node) { /* Custom processing ... */ super.postprocessPackageNode(node); } </pre> </div> <p> This lets <code>VisitorBase</code> maintain a stack of <code>Nodes</code> that represents the current path through the graph. All subclasses can call <code>getCurrentNode()</code> to get at the current node in the traversal. This is particuliarily handy in the methods that process inbound and outbound nodes to let them know which perspective to use when looking at a dependency. For a dependency <code>A&nbsp;--&gt;&nbsp;B</code>, are we visiting <code>A</code> and looking at an outbound dependency to <code>B</code>? Or are we visiting <code>B</code> and looking at an inbound dependency from <code>A</code>? Some visitors care about this distinction, like <code>TextPrinter</code> for example. </p> <a name="VisitorandTraversalStrategy"></a> <h4><code>Visitor</code> and <code>TraversalStrategy</code></h4> <p> Here is an example showing the sequence of calls betweeen a visitor implementation based on <code>VisitorBase</code>, its <code>TraversalStrategy</code>, and a sample dependency graph. You can find the graph in <a href="SampleGraph.xml">SampleGraph.xml</a>. </p> <p> Here is the sample graph, magnified so you can see what is going on. The focus will be placed on package <code>P1</code>, class <code>C1</code>, and feature <code>f1</code>. Even-numbered elements have dependencies on them and they have dependencies on odd-numbered elements. This example illustrates the traversal order and processing that occurs on child nodes, outbound dependencies, and inbound dependencies. </p> <div align="center"> <img src="images/DependencyVisitorLegend.gif" /><br /> <b>Sample Dependency Graph</b> </div> <p> For the sake of this example, we use a plain <code>SelectiveTraversalStrategy</code>. It will dictate the traversal of a node's outbound and inbound dependencies before the traversal moves on to the subnodes. We will decorate it with a <code>SortedTraversalStrategy</code> that will sort groups of nodes in alphabetical order. </p> <pre> visitor = new SomeVisitor(new SortedTraversalStrategy(new SelectiveTraversalStrategy())) visitor.TraverseNodes({P2, P1, P3}) strategy.Order({P2, P1, P3}) ==> {P1, P2, P3} </pre> <div align="center"> <img src="images/DependencyVisitorI.gif" /><br /> </div> <pre> P1.Accept(visitor) visitor.VisitPackageNode(P1) strategy.InScope(P1) visitor.PreprocessPackageNode(P1) strategy.PreOutboundTraversal() ==> true visitor.TraverseOutbound(P1.Outbound()) // empty strategy.PreInboundTraversal() ==> true visitor.TraverseInbound(P1.Inbound()) // empty visitor.PreprocessAfterDependenciesPackageNode(P1) </pre> <div align="center"> <img src="images/DependencyVisitorII.gif" /><br /> </div> <pre> visitor.TraverseNodes(P1.Classes()) strategy.Order({C2, C1, C3}) ==> {C1, C2, C3} </pre> <div align="center"> <img src="images/DependencyVisitorIII.gif" /><br /> </div> <pre> C1.Accept(visitor) visitor.VisitClassNode(C1) strategy.InScope(C1) visitor.PreprocessClassNode(C1) </pre> <div align="center"> <img src="images/DependencyVisitorIV.gif" /><br /> </div> <pre> strategy.PreOutboundTraversal() ==> true visitor.TraverseOutbound(C1.Outbound()) strategy.Order({C3, C5}) ==> {C3, C5} C3.AcceptOutbound(visitor) visitor.VisitOutboundClassNode(C3) C5.AcceptOutbound(visitor) visitor.VisitOutboundClassNode(C5) </pre> <div align="center"> <img src="images/DependencyVisitorV.gif" /><br /> </div> <pre> strategy.PreInboundTraversal() ==> true visitor.TraverseInbound(C1.Inbound()) strategy.Order({C4, C2, f6, f4}) ==> {C2, C4, f4, f6} C2.AcceptInbound(visitor) visitor.VisitInboundClassNode(C2) C4.AcceptInbound(visitor) visitor.VisitInboundClassNode(C4) f4.AcceptInbound(visitor) visitor.VisitInboundFeatureNode(f4) f6.AcceptInbound(visitor) visitor.VisitInboundFeatureNode(f6) </pre> <div align="center"> <img src="images/DependencyVisitorVI.gif" /><br /> </div> <pre> visitor.PreprocessAfterDependenciesClassNode(C1) visitor.TraverseNodes(C1.Features()) strategy.Order({f2, f1, f3}) ==> {f1, f2, f3} </pre> <div align="center"> <img src="images/DependencyVisitorVII.gif" /><br /> </div> <pre> f1.Accept(visitor) visitor.VisitFeatureNode(f1) strategy.InScope(f1) visitor.PreprocessFeatureNode(f1) </pre> <div align="center"> <img src="images/DependencyVisitorVIII.gif" /><br /> </div> <pre> strategy.PreOutboundTraversal() ==> true visitor.TraverseOutbound(f1.Outbound()) strategy.Order({C3, C5, f3, f5, f7}) ==> {C3, C5, f3, f5, f7} C3.AcceptOutbound(visitor) visitor.VisitOutboundClassNode(C3) C5.AcceptOutbound(visitor) visitor.VisitOutboundClassNode(C5) f3.AcceptOutbound(visitor) visitor.VisitOutboundFeatureNode(f3) f5.AcceptOutbound(visitor) visitor.VisitOutboundFeatureNode(f5) f7.AcceptOutbound(visitor) visitor.VisitOutboundFeatureNode(f7) </pre> <div align="center"> <img src="images/DependencyVisitorIX.gif" /><br /> </div> <pre> strategy.PreInboundTraversal() ==> true visitor.TraverseInbound(f1.Inbound()) strategy.Order({f6, f4, f2}) ==> {f2, f4, f6} f2.AcceptInbound(visitor) visitor.VisitInboundFeatureNode(f2) f4.AcceptInbound(visitor) visitor.VisitInboundFeatureNode(f4) f6.AcceptInbound(visitor) visitor.VisitInboundFeatureNode(f6) </pre> <div align="center"> <img src="images/DependencyVisitorX.gif" /><br /> </div> <pre> strategy.PostOutboundTraversal() ==> false strategy.PostInboundTraversal() ==> false visitor.PostProcessFeatureNode(f1) </pre> <div align="center"> <img src="images/DependencyVisitorVIII.gif" /><br /> </div> <pre> f2.Accept(visitor) ... f3.Accept(visitor) ... visitor.PostProcessBeforeDependenciesClassNode(C1) strategy.PostOutboundTraversal() ==> false strategy.PostInboundTraversal() ==> false visitor.PostProcessClassNode(C1) </pre> <div align="center"> <img src="images/DependencyVisitorIV.gif" /><br /> </div> <pre> C2.Accept(visitor) ... C3.Accept(visitor) ... visitor.PostProcessBeforeDependenciesPackageNode(P1) strategy.PostOutboundTraversal() ==> false strategy.PostInboundTraversal() ==> false visitor.PostProcessPackageNode(P1) </pre> <div align="center"> <img src="images/DependencyVisitorII.gif" /><br /> </div> <pre> P2.Accept(visitor) ... P3.Accept(visitor) ... </pre> <hr /> <a name="OOMetrics"></a> <h2>OO Metrics</h2> <p> You use <code>com.jeantessier.metrics.MetricsGatherer</code> instance to read class files and compute the metrics. It is a <code>com.jeantessier.classreader.Visitor</code> and will traverse the complete structure rooted at the <code>Classfile</code> instance and compute various metrics. </p> <p> The <code>MetricsGatherer</code> uses a <code>MetricsFactory</code> to create the various <code>Metrics</code> instances. The factory uses a <code>MetricsConfiguration</code> instance to decide what measurements make up a given set of metrics. The configuration is loaded at runtime from an XML file. </p> <p> By default, the value of each measurement is computed only the first time it is requested and then cached for further request. You can refresh the caches through the API and you can turn off caching of individual measurements through their descriptor and in the configuration file. </p> <a name="DataStructure"></a> <h3>Data Structure</h3> <div align="center"> <img src="images/MetricsLegend.gif" /><br /> <img src="images/MetricsStructure.gif" /><br /> </div> <hr /> <a name="APIDifferencesX"></a> <h2>API Differences</h2> <p> You can use <code>com.jeantessier.classreader.ClassfileLoader</code> classes to examine the baseline of your codebase; be they in JAR files, loose class files, or a combination of both. You can apply the same treatment to your latest codebase. You now have two sets <code>Classfile</code> instances. </p> <p> You can use <code>com.jeantessier.dependency.NodeFactory</code> to create a tree of packages, classes, and features from each codebase. You can then start to compare them to each other. If a package is in the old codebase but not in the new one, you can mark it as having been removed. If it is not in the old codebase but it is in new one, then you can mark it as having been recently added. For packages that are present in both codebase, you can repeat this analysis at the class level, and then at the feature level. </p> <hr /> <a name="Command-LineParsing"></a> <h2>Command-Line Parsing</h2> <p> The <code>com.jeantessier.commandline</code> package gives you the tools you need to parse the command-line to your program, validate switches and parameters, and even print a summary usage statement when your program is not called properly. <i>Switches</i> start with a dash ("<code>-</code>") and usually have specific semantics attached to them. <i>Parameters</i> are just strung out on the command-line and usually don't have individual specific semantics, besides those they share as a group. </p> <p> You create a <code>CommandLine</code> instance to parse your command-line. At creation time, you can supply a specifc <code>ParameterStrategy</code>. Here are a the ones that ship with Dependency Finder. </p> <blockquote> <dl> <dt><code>AnyParameterStrategy</code></dt> <dd>No restrictions, the command-line can include any number of parameters, including none at all. This is the default strategy if you do not specify one.</dd> <dt><code>AtLeastParameterStrategy</code></dt> <dd>The command-line must include at least a certain number of parameters or the framework will find the command-line invalid.</dd> <dt><code>AtMostParameterStrategy</code></dt> <dd>The command-line can include at most a certain number of parameters or the framework will find the command-line invalid.</dd> <dt><code>ExactlyParameterStrategy</code></dt> <dd>The command-line must include an exact number of parameters or the framework will find the command-line invalid.</dd> <dt><code>NullParameterStrategy</code></dt> <dd>The command-line cannot include any parameters or the framework will find the command-line invalid.</dd> </dl> </blockquote> <p> Once you have a parser, you can add switch definitions to it. There are five types of switches described below. </p> <blockquote> <dl> <dt><code>ToggleSwitch</code></dt> <dd>The switch be followed by a value. It acts as a boolean, <code>false</code> if absent or <code>true</code> if present on the command-line.</dd> <dt><code>SingleValueSwitch</code></dt> <dd>The switch must be followed by a value. It can only appear once on the command-line.</dd> <dt><code>OptionalValueSwitch</code></dt> <dd>The switch can appear by itself or followed by a value. It can only appear once on the command-line.</dd> <dt><code>MultipleValuesSwitch</code></dt> <dd>The switch must be followed by a value, but it can occur multiple times on the command-line. The values are accumulated in the same order as on the command-line and you retrieve them as a single <code>List</code>.</dd> <dt><code>AliasSwitch</code></dt> <dd>An alias swich passes its values to the switches it is an alias for. You can use an alias switch to group many switches together so you can set them all at once with just one name.</dd> </dl> </blockquote> <p> You add switches with the matching <code>addSwitch()</code> methods on <code>CommandLine</code>. You can supply switches with default values and specify if they are mandatory (must appear on the command-line) or not. </p> <p> When you create the parser, you can also specify if the parser will be <i>strict</i> or not. Strict parsers will only accept switches that are explicitly specified. Non-strict parsers treat an unknown switch as an <code>OptionalValueSwitch</code>. </p> <p> Along with your <code>CommandLine</code> parser, you can create a <code>CommandLineUsage</code> that will create a summary description of your command-line specification. You can use this summary in error messages for invalid command-lines to help users figure out what they did wrong. </p> <p> To actually parse your command-line, just call <code>CommandLine</code>'s <code>parse()</code> method and pass it the string array that is <code>main()</code>'s sole parameter. The parser will throw an exception if anything went wrong. After parsing, you can check for the presence of specific switches with the <code>IsPresent()</code> method and get the value(s) of specific switches with one of the <code>Switch()</code> methods. You can retrieve parameters, if any, with the <code>Parameters()</code> method. </p> <hr /> <a name="BuildingDependencyFinder"></a> <h2>Building Dependency Finder</h2> <p> Before you can compile Dependency Finder, you need to set the following environment variables: </p> <ul> <li><code>CATALINA_HOME</code> to your <a href="http://tomcat.apache.org/">Tomcat</a> installation</li> <li><code>WEBWORK_HOME</code> to your <a href="http://www.opensymphony.com/webwork/">WebWork</a> installation</li> </ul> <a name="BuildinganExecutable"></a> <h3>Building an Executable</h3> <pre> <code>ant exec</code> </pre> <p> This target will create everything you need to run Dependency Finder in-place. If you make a change and you simply want to refresh the executable, simply run: </p> <pre> <code>and jar</code> </pre> <a name="BuildingtheDocumentation"></a> <h3>Building the Documentation</h3> <pre> <code>ant docs</code> </pre> <p> This target will create both Javadocs and the various manuals. </p> <a name="CompilingaBuild"></a> <h3>Compiling a Build</h3> <pre> <code>ant</code> </pre> <p> This target will create a set of distribution files from a clean build. </p> <a name="TestingtheBuild"></a> <h3>Testing the Build</h3> <p> Before you can compile and run the tests, you need to set the following environment variables in addition to those for compiling Dependency Finder: </p> <ul> <li><code>JUNIT_HOME</code> to your <a href="http://junit.org/">JUnit</a> installation</li> <li><code>JMOCK_HOME</code> to your <a href="http://jmock.org/">jMock</a> installation</li> <li><code>FITLIBRARY_HOME</code> to your <a href="http://fitlibrary.sourceforge.net/">FitLibrary</a> installation</li> <li><code>HTTPUNIT_HOME</code> to your <a href="http://httpunit.sourceforge.net/">HttpUnit</a> installation</li> </ul> <p> You will also need to put <code>junit.jar</code> on Ant's <code>CLASSPATH</code>. For this, you can either set the <code>CLASSPATH</code> environment variable, or with Ant 1.6 and above, you can copy <code>junit.jar</code> to <code>${user.home}/.ant/lib</code>, where <code>${user.home}</code> is the home directory for the current user. This depends on your operating system. On Unix, it is <code>$HOME</code> and is typically <code>/home/<i>username</i></code>. On Windows, it is typically <code>C:\Documents&nbsp;and&nbsp;Settings\<i>username</i></code>. </p> <p> I recommend you use JUnit 4.4 or later, where the JAR file is named <code>junit-X.Y.jar</code>, but everything should work as is with any version of JUnit 3.8 and above (where the JAR file was named <code>junit.jar</code>), and even some older ones. </p> <p> To run all tests and generate test reports in the <code>reports</code> directory: </p> <ol> <li><code>set CLASSPATH=%JUNIT_HOME%\junit-4.4.jar</code></li> <li><code>ant -f build.test.xml</code></li> </ol> <p> or, to run tests manually: </p> <ol> <li><code>set CLASSPATH=%JUNIT_HOME%\junit-4.4.jar</code></li> <li><code>ant -f build.test.xml compile</code></li> <li><code>textjunit TestAll</code></li> <li><code>textjunit com.jeantessier.fitlibrary.TestAll</code></li> </ol> <a name="MakingaRelease"></a> <h3>Making a Release</h3> <p> <i>These instructions need to be updated to account for Subversion instead of CVS.</i> </p> <ol> <li><code>svn mkdir https://depfind.svn.sourceforge.net/svnroot/depfind/tags/release-1.2.1 -m "Tagging the 1.2.1 release of Dependency Finder"</code></li> <li><code>svn copy https://depfind.svn.sourceforge.net/svnroot/depfind/trunk/DependencyFinder https://depfind.svn.sourceforge.net/svnroot/depfind/tags/release-121/DependencyFinder -m "Tagging the 1.2.1 release of Dependency Finder"</code></li> <li><code>ant realclean dist</code></li> <li><code>ant ftp</code></li> <li><code>cvs log -rrelease-1.1.1:release-1.2.0</code></li> <li>Create new release on SourceForge.net</li> <li>Notify monitoring people</li> <li>Close bugs</li> <li>Close feature requests</li> <li>New news item</li> <li>Post to depfind-announce</li> <li>Post to news groups (<code>comp.lang.java.announce</code>, <code>comp.lang.java.softwaretools</code>, <code>comp.software.measurement</code>, <code>comp.software-eng</code>)</li> <li>Generate sample files</li> </ol> <a name="ComputingCodeCoverage"></a> <h3>Computing Code Coverage</h3> <a name="Emma"></a> <h4>Emma</h4> <p> You can use <a href="http://emma.sourceforge.net/">Emma</a> and the build file in <code>build.emma.xml</code>. </p> <p> Before you can run Emma, you need to set the following environment variable in addition to those for testing and compiling Dependency Finder: </p> <ul> <li><code>EMMA_HOME</code> to your <a href="http://emma.sourceforge.net/">Emma</a> installation</li> </ul> <p> To run the tests and generate code coverage reports: </p> <pre> <code>ant -f build.emma.xml</code> </pre> <p> To publish the results: </p> <ol> <li><code>ssh depfind.sourceforge.net rm -fR /home/groups/d/de/depfind/htdocs/emma</code></li> <li><code>scp reports/emma depfind.sourceforge.net:/home/groups/d/de/depfind/htdocs</code></li> </ol> <p> Or use an archive: </p> <ol> <li>Archive the <code>reports/emma</code> directory</li> <li>Use <code>scp</code> to transfer the archive to SourceForge</li> <li>Use <code>ssh</code> to login to SourceForge</li> <li>Extract the archive in the root of the website</li> </ol> <a name="Clover"></a> <h4>Clover</h4> <p> You can use <a href="http://www.cenqua.com/clover/">Clover</a> and the build file in <code>build.clover.xml</code>. </p> <p> Before you can run Emma, you need to set the following environment variable in addition to those for testing and compiling Dependency Finder: </p> <ul> <li><code>CLOVER_HOME</code> to your <a href="http://www.cenqua.com/clover/">Clover</a> installation</li> </ul> <p> You will also need to put <code>clover.jar</code> and <code>clover.license</code> on Ant's <code>CLASSPATH</code>. For this, you can either set the <code>CLASSPATH</code> environment variable, or with Ant 1.6 and above, you can copy <code>clover.jar</code> and <code>clover.license</code> to <code>${user.home}/.ant/lib</code> (see above). </p> <p> To run the tests and generate code coverage reports: </p> <pre> <code>ant -f build.clover.xml</code> </pre> <p> To publish the results: </p> <ol> <li><code>ssh depfind.sourceforge.net rm -fR /home/groups/d/de/depfind/htdocs/clover</code></li> <li><code>scp reports/clover/html depfind.sourceforge.net:/home/groups/d/de/depfind/htdocs/clover</code></li> </ol> <p> Or use an archive: </p> <ol> <li>Archive the <code>reports/clover/html</code> directory</li> <li>Use <code>scp</code> to transfer the archive to SourceForge</li> <li>Use <code>ssh</code> to login to SourceForge</li> <li>Extract the archive in the root of the website</li> </ol> <hr /> <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> </script> <script type="text/javascript"> _uacct = "UA-2083086-2"; urchinTracker(); </script> </body> </html>
{ "content_hash": "2a8fea047a7c9c517e1b0b3d064840da", "timestamp": "", "source": "github", "line_count": 1649, "max_line_length": 252, "avg_line_length": 35.6931473620376, "alnum_prop": 0.7080430867511638, "repo_name": "windup/JBossMAT", "id": "8736b21db61c1cc427baf48386cbac97ed9432bc", "size": "58858", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "tools/depfinder/docs/Developer.html", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "777" }, { "name": "Groovy", "bytes": "71973" }, { "name": "Java", "bytes": "53651" }, { "name": "JavaScript", "bytes": "828" }, { "name": "Python", "bytes": "852" }, { "name": "Shell", "bytes": "3446" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <algorithms version="100401"> <algorithm name="ParsHed" version="100401"> <variant no="0" confidence="0.845606"> <title confidence="0.993933">Lexical Heads, Phrase Structure and the Induction of Grammar</title> <author confidence="0.994982">Carl de_Marcken</author> <affiliation confidence="0.999948">MIT Artificial Intelligence Laboratory</affiliation> <address confidence="0.982963">NE43-804 545 Technology Square Cambridge, MA, 02139, USA</address> <email confidence="0.997916">cgdemarcaai.mit.edu</email> <abstract confidence="0.984180428571429">Summary Acquiring linguistically plausible phrase-structure grammars from ordinary text has proven difficult for standard induction techniques, and researchers have turned to supervised training from bracketed corpora. We examine why previous approaches have failed to acquire desired grammars, concentrating our analysis on the inside-outside algorithm (Baker, 1979), and propose that with a representation of phrase structure centered on head relations such supervision may not be necessary</abstract> </variant> </algorithm> <algorithm name="ParsCit" version="100401"> <citationList> <citation valid="true"> <authors> <author>James K Baker</author> </authors> <title>Trainable grammars for speech recognition</title> <date>1979</date> <booktitle>In Proceedings of the 97th Meeting of the Acoustical Society of America</booktitle> <pages>547--550</pages> <contexts> <context position="561" citStr="Baker, 1979">hers have turned to supervised training from bracketed corpora. We examine why previous approaches have failed to acquire desired grammars, concentrating our analysis on the inside-outside algorithm (Baker, 1979), and propose that with a representation of phrase structure centered on head relations such supervision may not be necessary. 1. INTRODUCTION Researchers investigating the acquisition of phrase-struc</context> </contexts> <marker>Baker, 1979</marker> <rawString>James K. Baker. 1979. Trainable grammars for speech recognition. In Proceedings of the 97th Meeting of the Acoustical Society of America, pages 547-550.</rawString> </citation> <citation valid="true"> <authors> <author>Michael Brent</author> </authors> <title>Minimal generative explanations: A middle ground between neurons and triggers</title> <date>1993</date> <booktitle>In Proc. of the 15th Annual Meeting of the Cognitive Science Society</booktitle> <pages>28--36</pages> <contexts> <context position="8875" citStr="Brent, 1993">on the acquisition of syntax, similar or identical statistical models to those discussed here have been used to acquiring words and morphemes from sequences of characters (Olivier, 1968; Wolff, 1982; Brent, 1993; Cartwright and Brent, 1994) and syllables from phonemes (Ellison, 1992), among other language applications. 16 explore ways of fixing them. Let us look again at (A), reproduced below, and center dis</context> </contexts> <marker>Brent, 1993</marker> <rawString>Michael Brent. 1993. Minimal generative explanations: A middle ground between neurons and triggers. In Proc. of the 15th Annual Meeting of the Cognitive Science Society, pages 28-36.</rawString> </citation> <citation valid="true"> <authors> <author>Eric Brill</author> </authors> <title>Automatic grammar induction and parsing free text: A transformation based approach</title> <date>1993</date> <booktitle>In Proceedings of the DARPA Speech and Natural Language Workshop</booktitle> <contexts> <context position="1379" citStr="Brill, 1993"> Treebank (Marcus, 1991) to train the learner: (Pereira and Schabes, 1992) demonstrate that the inside-outside algorithm can learn grammars effectively given such constraint; from a bracketed corpus (Brill, 1993) successfully learns rules that iteratively transform a default phrase-structure into a better one for a particular sentence. The necessity of bracketed corpora for training is grating to our sensibil</context> </contexts> <marker>Brill, 1993</marker> <rawString>Eric Brill. 1993. Automatic grammar induction and parsing free text: A transformation based approach. In Proceedings of the DARPA Speech and Natural Language Workshop.</rawString> </citation> <citation valid="true"> <authors> <author>Ted Briscoe</author> <author>Nick Waegner</author> </authors> <title>Robust stochastic parsing using the inside-outside algorithm</title> <date>1992</date> <booktitle>In Proc. of the AAAI Workshop on Probabilistic-Based Natural Language Processing Techniques</booktitle> <pages>39--52</pages> <contexts> <context position="13790" citStr="Briscoe and Waegner, 1992">exhaustive set of stochastic context-free rules of a certain form, and estimate probabilities for these rules from a test corpus. This is the same general procedure as used by (Lan i and Young, 1990; Briscoe and Waegner, 1992; Pereira and Schabes, 1992) and others. For parts-of-speech Y and Z, the rules we include in our base grammar are S ZP ZP ZP YP ZP YP ZP ZP Z YP ZP YP Z ZP Z where S is the root nonterminal. As is us</context> </contexts> <marker>Briscoe, Waegner, 1992</marker> <rawString>Ted Briscoe and Nick Waegner. 1992. Robust stochastic parsing using the inside-outside algorithm. In Proc. of the AAAI Workshop on Probabilistic-Based Natural Language Processing Techniques, pages 39-52.</rawString> </citation> <citation valid="true"> <authors> <author>Timothy Andrew Cartwright</author> <author>Michael R Brent</author> </authors> <title>Segmenting speech without a lexicon: Evidence for a bootstrapping model of lexical acquisition</title> <date>1994</date> <booktitle>In Proc. of the 16th Annual Meeting of the Cognitive Science Society</booktitle> <location>Hillsdale, New Jersey</location> <contexts> <context position="8904" citStr="Cartwright and Brent, 1994">ition of syntax, similar or identical statistical models to those discussed here have been used to acquiring words and morphemes from sequences of characters (Olivier, 1968; Wolff, 1982; Brent, 1993; Cartwright and Brent, 1994) and syllables from phonemes (Ellison, 1992), among other language applications. 16 explore ways of fixing them. Let us look again at (A), reproduced below, and center discussion on an extended stocha</context> </contexts> <marker>Cartwright, Brent, 1994</marker> <rawString>Timothy Andrew Cartwright and Michael R. Brent. 1994. Segmenting speech without a lexicon: Evidence for a bootstrapping model of lexical acquisition. In Proc. of the 16th Annual Meeting of the Cognitive Science Society, Hillsdale, New Jersey.</rawString> </citation> <citation valid="true"> <authors> <author>Carl de Marcken</author> </authors> <title>Parsing with stochastic, feature-based RTNs</title> <date>1995</date> <journal>Memo A.I. Memo, MIT Artificial Intelligence Lab</journal> <location>Cambridge, Massachusetts</location> <marker>de Marcken, 1995</marker> <rawString>Carl de Marcken. 1995. Parsing with stochastic, feature-based RTNs. Memo A.I. Memo, MIT Artificial Intelligence Lab., Cambridge, Massachusetts.</rawString> </citation> <citation valid="true"> <authors> <author>S Della-Pietra</author> <author>V Della-Pietra</author> <author>J Gillett</author> <author>J Lafferty</author> <author>H Printz</author> <author>L Ureg</author> </authors> <title>Inference and estimation of a long-range trigram model</title> <date>1994</date> <booktitle>In International Colloquium on Grammatical Inference</booktitle> <pages>78--92</pages> <location>Alicante, Spain</location> <marker>Della-Pietra, Della-Pietra, Gillett, Lafferty, Printz, Ureg, 1994</marker> <rawString>S. Della-Pietra, V. Della-Pietra, J. Gillett, J. Lafferty, H. Printz, and L. Ureg. 1994. Inference and estimation of a long-range trigram model. In International Colloquium on Grammatical Inference, pages 78-92, Alicante, Spain.</rawString> </citation> <citation valid="true"> <authors> <author>T Mark Ellison</author> </authors> <title>The Machine Learning of Phonological Structure</title> <date>1992</date> <tech>Ph.D. thesis</tech> <institution>University of Western Australia</institution> <contexts> <context position="8948" citStr="Ellison, 1992">to those discussed here have been used to acquiring words and morphemes from sequences of characters (Olivier, 1968; Wolff, 1982; Brent, 1993; Cartwright and Brent, 1994) and syllables from phonemes (Ellison, 1992), among other language applications. 16 explore ways of fixing them. Let us look again at (A), reproduced below, and center discussion on an extended stochastic context-free grammar model in which a b</context> </contexts> <marker>Ellison, 1992</marker> <rawString>T. Mark Ellison. 1992. The Machine Learning of Phonological Structure. Ph.D. thesis, University of Western Australia.</rawString> </citation> <citation valid="true"> <authors> <author>John Lafferty</author> <author>Daniel Sleator</author> <author>Davy Temperley</author> </authors> <title>Grammatical trigrams: A probabalistic model of link grammar</title> <date>1992</date> <tech>Technical Report CMU-CS-92-181</tech> <institution>Carnegie Mellon University</institution> <location>Pittsburgh, Pennsylvania</location> <contexts> <context position="30196" citStr="Lafferty et al., 1992"> We have implemented a statistical parser and training mechanism based on the above notions, but results are too preliminary to include here. Stochastic link-grammar based models have been discussed (Lafferty et al., 1992) but the only test results we have seen (Della-Pietra et al., 1994) assume a very restricted subset of the model and do not explore the &amp;quot;phrase structures&amp;quot; that result from training on English text. R</context> </contexts> <marker>Lafferty, Sleator, Temperley, 1992</marker> <rawString>John Lafferty, Daniel Sleator, and Davy Temperley. 1992. Grammatical trigrams: A probabalistic model of link grammar. Technical Report CMU-CS-92-181, Carnegie Mellon University, Pittsburgh, Pennsylvania.</rawString> </citation> <citation valid="true"> <authors> <author>K Lan i</author> <author>S J Young</author> </authors> <title>The estimation of stochastic context-free grammars using the inside-outside algorithm. Computer Speech and Language</title> <date>1990</date> <pages>4--35</pages> <contexts> <context position="13763" citStr="i and Young, 1990">y starting with an exhaustive set of stochastic context-free rules of a certain form, and estimate probabilities for these rules from a test corpus. This is the same general procedure as used by (Lan i and Young, 1990; Briscoe and Waegner, 1992; Pereira and Schabes, 1992) and others. For parts-of-speech Y and Z, the rules we include in our base grammar are S ZP ZP ZP YP ZP YP ZP ZP Z YP ZP YP Z ZP Z where S is the</context> </contexts> <marker>i, Young, 1990</marker> <rawString>K. Lan i and S. J. Young. 1990. The estimation of stochastic context-free grammars using the inside-outside algorithm. Computer Speech and Language, 4:35-56.</rawString> </citation> <citation valid="true"> <authors> <author>David M Magerman</author> <author>Mitchell P Marcus</author> </authors> <title>Parsing a natural language using mutual information statistics</title> <date>1990</date> <booktitle>In Proc. of the American Association for Artificial Intelligence</booktitle> <pages>984--989</pages> <contexts> <context position="5555" citStr="Magerman and Marcus, 1990">s has been generated from a phrase-structure grammar, it suggests that we can recover internal structure by grouping subsequences of words with high mutual information. This is the approach taken by (Magerman and Marcus, 1990) for parsing sentences, who use mutual information rather than a grammar to reconstruct phrase-structure. The hope is that by searching for a phrase-structure or phrase-structure grammar that maximize</context> <context position="6395" citStr="Magerman and Marcus, 1990">ic context free grammar trained on part-of-speech sequences from English text can have an entropy as low or lower than another but bracket the text much more poorly (tested on hand-annotations). And (Magerman and Marcus, 1990) provide evidence that grouping sub-sequences of events with high mutual information is not always a good heuristic; they must include in their parsing algorithm a list of event sequences (such as nou</context> <context position="7758" citStr="Magerman and Marcus, 1990">occur together not because they are part of a common word, but because English syntax and semantics places these two morphemes sideby-side. At a syntactic level, this is exactly why the algorithm of (Magerman and Marcus, 1990) has problems: English places prepositions after nouns not because they are in the same phrase, but because prepositional phrases often adjoin to noun phrases. Any greedy algorithm (such as (Magerman </context> </contexts> <marker>Magerman, Marcus, 1990</marker> <rawString>David M. Magerman and Mitchell P. Marcus. 1990. Parsing a natural language using mutual information statistics. In Proc. of the American Association for Artificial Intelligence, pages 984-989.</rawString> </citation> <citation valid="true"> <authors> <author>Mitchell Marcus</author> </authors> <title>Very large annotated databse of American English</title> <date>1991</date> <booktitle>In Proceedings of the DARPA Speech and Natural Language Workshop</booktitle> <contexts> <context position="1191" citStr="Marcus, 1991">mmars (SCFGs), tend to produce grammars that structure text in ways contrary to our linguistic intuitions. One effective way around this problem is to use hand-structured text like the Penn Treebank (Marcus, 1991) to train the learner: (Pereira and Schabes, 1992) demonstrate that the inside-outside algorithm can learn grammars effectively given such constraint; from a bracketed corpus (Brill, 1993) successfull</context> </contexts> <marker>Marcus, 1991</marker> <rawString>Mitchell Marcus. 1991. Very large annotated databse of American English. In Proceedings of the DARPA Speech and Natural Language Workshop.</rawString> </citation> <citation valid="true"> <authors> <author>I A MelCuk</author> </authors> <title>Dependency Syntax: Theory and Practice</title> <date>1988</date> <publisher>State University of New York Press</publisher> <marker>MelCuk, 1988</marker> <rawString>I. A. MelCuk. 1988. Dependency Syntax: Theory and Practice. State University of New York Press.</rawString> </citation> <citation valid="true"> <authors> <author>Donald Cort Olivier</author> </authors> <title>Stochastic Grammars and Language Acquisition Mechanisms</title> <date>1968</date> <tech>Ph.D. thesis</tech> <institution>Harvard University</institution> <location>Cambridge, Massachusetts</location> <contexts> <context position="6814" citStr="Olivier, 1968">position) that should not be grouped together in a single phrase, in order to prevent their method from mis-bracketing. To understand why, we can look at an example from a slightly different domain. (Olivier, 1968) seeks to acquire a lexicon from unsegmented (spaceless) character sequences by treating each word as a stochastic context free rule mapping a common nonterminal (call it W) to a sequence of letters; </context> <context position="8849" citStr="Olivier, 1968">ile this paper concentrates on the acquisition of syntax, similar or identical statistical models to those discussed here have been used to acquiring words and morphemes from sequences of characters (Olivier, 1968; Wolff, 1982; Brent, 1993; Cartwright and Brent, 1994) and syllables from phonemes (Ellison, 1992), among other language applications. 16 explore ways of fixing them. Let us look again at (A), reprod</context> </contexts> <marker>Olivier, 1968</marker> <rawString>Donald Cort Olivier. 1968. Stochastic Grammars and Language Acquisition Mechanisms. Ph.D. thesis, Harvard University, Cambridge, Massachusetts.</rawString> </citation> <citation valid="true"> <authors> <author>Fernando Pereira</author> <author>Yves Schabes</author> </authors> <title>Inside-outside reestimation from partially bracketed corpora</title> <date>1992</date> <booktitle>In Proc. 29th Annual Meeting of the Association for Computational Linguistics</booktitle> <pages>128--135</pages> <location>Berkeley, California</location> <contexts> <context position="1241" citStr="Pereira and Schabes, 1992">rs that structure text in ways contrary to our linguistic intuitions. One effective way around this problem is to use hand-structured text like the Penn Treebank (Marcus, 1991) to train the learner: (Pereira and Schabes, 1992) demonstrate that the inside-outside algorithm can learn grammars effectively given such constraint; from a bracketed corpus (Brill, 1993) successfully learns rules that iteratively transform a defaul</context> <context position="6119" citStr="Pereira and Schabes, 1992">uantitative evidence that simple techniques for estimating phrase-structure grammars by minimizing entropy do not lead to the desired grammars (grammars that agree with structure (A), for instance). (Pereira and Schabes, 1992) explore this topic, demonstrating that a stochastic context free grammar trained on part-of-speech sequences from English text can have an entropy as low or lower than another but bracket the text mu</context> <context position="13818" citStr="Pereira and Schabes, 1992">c context-free rules of a certain form, and estimate probabilities for these rules from a test corpus. This is the same general procedure as used by (Lan i and Young, 1990; Briscoe and Waegner, 1992; Pereira and Schabes, 1992) and others. For parts-of-speech Y and Z, the rules we include in our base grammar are S ZP ZP ZP YP ZP YP ZP ZP Z YP ZP YP Z ZP Z where S is the root nonterminal. As is ususal with stochastic context</context> <context position="23730" citStr="Pereira and Schabes, 1992"> feature out. 4.3. Testing on the Penn Treebank To test whether head-driven language models do indeed converge to linguistically-motivated grammars better than SCFGs, we replicated the experiment of (Pereira and Schabes, 1992) on the ATIS section of the Penn Treebank. The 48 parts-of-speech in the Treebank were collapsed to 25, resulting in 2550 grammar rules. Word head features were created by assigning numbers a common f</context> <context position="24723" citStr="Pereira and Schabes, 1992">ere skipped. We ran four experiments, training a grammar with and without bracketing and with and without use of features. Without features, we are essentially replicating the two experiments run by (Pereira and Schabes, 1992), except that they use a different set of initial rules (all 4095 CNF grammar rules over 15 nonterminals and the 48 Treebank terminal categories). Every tenth sentence of the 1129 sentences in the ATI</context> </contexts> <marker>Pereira, Schabes, 1992</marker> <rawString>Fernando Pereira and Yves Schabes. 1992. Inside-outside reestimation from partially bracketed corpora. In Proc. 29th Annual Meeting of the Association for Computational Linguistics,. pages 128-135, Berkeley, California.</rawString> </citation> <citation valid="true"> <authors> <author>Daniel D K Sleator</author> <author>Davy Temperley</author> </authors> <title>Parsing english with a link grammar</title> <date>1991</date> <tech>Technical Report CMU-CS-91-196</tech> <institution>Carnegie Mellon University</institution> <location>Pittsburgh, Pennsylvania</location> <contexts> <context position="28170" citStr="Sleator and Temperley, 1991"> is essentially incapable of finding an optimal grammar without bracketing help. We now suggest that a representation that explicitly represents relations between phrase heads, such as link grammars (Sleator and Temperley, 1991), is far more amenable to language acquisition problems. Let us look one final time at the sequence V P N. There are only three words here, and therefore three heads. Assuming a head-driven bigram mod</context> </contexts> <marker>Sleator, Temperley, 1991</marker> <rawString>Daniel D. K. Sleator and Davy Temperley. 1991. Parsing english with a link grammar. Technical Report CMU-CS-91-196, Carnegie Mellon University, Pittsburgh, Pennsylvania.</rawString> </citation> <citation valid="true"> <authors> <author>Andreas Stolcke</author> </authors> <title>Bayesian Learning of Probabalistic Language Models</title> <date>1994</date> <tech>Ph.D. thesis</tech> <institution>University of California at Berkeley</institution> <location>Berkeley, CA</location> <contexts> <context position="8040" citStr="Stolcke, 1994">hey are in the same phrase, but because prepositional phrases often adjoin to noun phrases. Any greedy algorithm (such as (Magerman and Marcus, 1990) and the context-free grammar induction method of (Stolcke, 1994)) that builds phrases by grouping events with high mutual information will consequently fail to derive linguistically-plausible phrase structure in many situations. 3. INCORPORATING HEADEDNESS INTO LA</context> </contexts> <marker>Stolcke, 1994</marker> <rawString>Andreas Stolcke. 1994. Bayesian Learning of Probabalistic Language Models. Ph.D. thesis, University of California at Berkeley, Berkeley, CA.</rawString> </citation> <citation valid="true"> <authors> <author>J Gerald Wolff</author> </authors> <title>Language acquisition, data compression and generalization</title> <date>1982</date> <journal>Language and Communication</journal> <pages>2--1</pages> <contexts> <context position="8862" citStr="Wolff, 1982">concentrates on the acquisition of syntax, similar or identical statistical models to those discussed here have been used to acquiring words and morphemes from sequences of characters (Olivier, 1968; Wolff, 1982; Brent, 1993; Cartwright and Brent, 1994) and syllables from phonemes (Ellison, 1992), among other language applications. 16 explore ways of fixing them. Let us look again at (A), reproduced below, a</context> </contexts> <marker>Wolff, 1982</marker> <rawString>J. Gerald Wolff. 1982. Language acquisition, data compression and generalization. Language and Communication, 2(1):57-89.</rawString> </citation> </citationList> </algorithm> </algorithms>
{ "content_hash": "6cf3fc1f46fb5bd862f48b1432097e09", "timestamp": "", "source": "github", "line_count": 282, "max_line_length": 544, "avg_line_length": 78.12765957446808, "alnum_prop": 0.7888071895424836, "repo_name": "sfontanarrosa/metadata-extraction", "id": "65857e6cb9e883e5b64763e3f752c9419e57e284", "size": "22032", "binary": false, "copies": "10", "ref": "refs/heads/master", "path": "ParsCit/test/v090625b-output/W95-0102_meta.xml", "mode": "33261", "license": "mit", "language": [ { "name": "C", "bytes": "47344" }, { "name": "C++", "bytes": "498183" }, { "name": "CSS", "bytes": "6248" }, { "name": "Java", "bytes": "12973" }, { "name": "Perl", "bytes": "82191" }, { "name": "Python", "bytes": "62281" }, { "name": "Ruby", "bytes": "4613" }, { "name": "Scala", "bytes": "534" }, { "name": "Shell", "bytes": "442673" }, { "name": "TeX", "bytes": "117394" }, { "name": "XSLT", "bytes": "3829" } ], "symlink_target": "" }
package MonsterQuest.game.items; /** This defines the behavour for the items. Extend this class for creating the * weapon and inventory classes * * @author Zyun */ public interface Item { /** * Get the name of the item object * @return the name of the item */ public String getName(); /** * The description of the item. * @return the description of the item */ public String getDescription (); /** * Get the type of the weapon * @return the type of the weapon */ public ItemType getType (); }
{ "content_hash": "c273c61ccb1cf955aa272d7d764703d5", "timestamp": "", "source": "github", "line_count": 29, "max_line_length": 79, "avg_line_length": 20.862068965517242, "alnum_prop": 0.5851239669421487, "repo_name": "EhWhoAmI/Monster-Quest", "id": "fbc84e69826a13820073fa8cb1ce91df1ec441a9", "size": "1754", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/MonsterQuest/game/items/Item.java", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "158" }, { "name": "HTML", "bytes": "5551" }, { "name": "Java", "bytes": "144720" } ], "symlink_target": "" }
/* jslint node: true */ 'use strict'; const View = require('./view.js').View; const strUtil = require('./string_util.js'); const ansi = require('./ansi_term.js'); const wordWrapText = require('./word_wrap.js').wordWrapText; const ansiPrep = require('./ansi_prep.js'); const assert = require('assert'); const _ = require('lodash'); // :TODO: Determine CTRL-* keys for various things // See http://www.bbsdocumentary.com/library/PROGRAMS/GRAPHICS/ANSI/bansi.txt // http://wiki.synchro.net/howto:editor:slyedit#edit_mode // http://sublime-text-unofficial-documentation.readthedocs.org/en/latest/reference/keyboard_shortcuts_win.html /* Mystic [^B] Reformat Paragraph [^O] Show this help file [^I] Insert tab space [^Q] Enter quote mode [^K] Cut current line of text [^V] Toggle insert/overwrite [^U] Paste previously cut text [^Y] Delete current line BASIC MOVEMENT COMMANDS UP/^E LEFT/^S PGUP/^R HOME/^F DOWN/^X RIGHT/^D PGDN/^C END/^G */ // // Some other interesting implementations, resources, etc. // // Editors - BBS // * https://github.com/M-griffin/Enthral/blob/master/src/msg_fse.cpp // // // Editors - Other // * http://joe-editor.sourceforge.net/ // * http://www.jbox.dk/downloads/edit.c // * https://github.com/dominictarr/hipster // // Implementations - Word Wrap // * https://github.com/protomouse/synchronet/blob/93b01c55b3102ebc3c4f4793c3a45b8c13d0dc2a/src/sbbs3/wordwrap.c // // Misc notes // * https://github.com/dominictarr/hipster/issues/15 (Deleting lines/etc.) // // Blessed // insertLine: CSR(top, bottom) + CUP(y, 0) + IL(1) + CSR(0, height) // deleteLine: CSR(top, bottom) + CUP(y, 0) + DL(1) + CSR(0, height) // Quick Ansi -- update only what was changed: // https://github.com/dominictarr/quickansi // // To-Do // // * Index pos % for emit scroll events // * Some of this should be async'd where there is lots of processing (e.g. word wrap) // * Fix backspace when col=0 (e.g. bs to prev line) // * Add word delete (CTRL+????) // * const SPECIAL_KEY_MAP_DEFAULT = { 'line feed': ['return'], exit: ['esc'], backspace: ['backspace', 'ctrl + d'], // https://www.tecmint.com/linux-command-line-bash-shortcut-keys/ delete: ['delete'], tab: ['tab'], up: ['up arrow'], down: ['down arrow'], end: ['end'], home: ['home'], left: ['left arrow'], right: ['right arrow'], 'delete line': ['ctrl + y', 'ctrl + u'], // https://en.wikipedia.org/wiki/Backspace 'page up': ['page up'], 'page down': ['page down'], insert: ['insert', 'ctrl + v'], }; exports.MultiLineEditTextView = MultiLineEditTextView; function MultiLineEditTextView(options) { if (!_.isBoolean(options.acceptsFocus)) { options.acceptsFocus = true; } if (!_.isBoolean(this.acceptsInput)) { options.acceptsInput = true; } if (!_.isObject(options.specialKeyMap)) { options.specialKeyMap = SPECIAL_KEY_MAP_DEFAULT; } View.call(this, options); this.initDefaultWidth(); var self = this; // // ANSI seems to want tabs to default to 8 characters. See the following: // * http://www.ansi-bbs.org/ansi-bbs2/control_chars/ // * http://www.bbsdocumentary.com/library/PROGRAMS/GRAPHICS/ANSI/bansi.txt // // This seems overkill though, so let's default to 4 :) // :TODO: what shoudl this really be? Maybe 8 is OK // this.tabWidth = _.isNumber(options.tabWidth) ? options.tabWidth : 4; this.textLines = []; this.topVisibleIndex = 0; this.mode = options.mode || 'edit'; // edit | preview | read-only if ('preview' === this.mode) { this.autoScroll = options.autoScroll || true; this.tabSwitchesView = true; } else { this.autoScroll = options.autoScroll || false; this.tabSwitchesView = options.tabSwitchesView || false; } // // cursorPos represents zero-based row, col positions // within the editor itself // this.cursorPos = { col: 0, row: 0 }; this.getSGRFor = function (sgrFor) { return ( { text: self.getSGR(), }[sgrFor] || self.getSGR() ); }; this.isEditMode = function () { return 'edit' === self.mode; }; this.isPreviewMode = function () { return 'preview' === self.mode; }; // :TODO: Most of the calls to this could be avoided via incrementRow(), decrementRow() that keeps track or such this.getTextLinesIndex = function (row) { if (!_.isNumber(row)) { row = self.cursorPos.row; } var index = self.topVisibleIndex + row; return index; }; this.getRemainingLinesBelowRow = function (row) { if (!_.isNumber(row)) { row = self.cursorPos.row; } return self.textLines.length - (self.topVisibleIndex + row) - 1; }; this.getNextEndOfLineIndex = function (startIndex) { for (var i = startIndex; i < self.textLines.length; i++) { if (self.textLines[i].eol) { return i; } } return self.textLines.length; }; this.toggleTextCursor = function (action) { self.client.term.rawWrite( `${self.getSGRFor('text')}${ 'hide' === action ? ansi.hideCursor() : ansi.showCursor() }` ); }; this.redrawRows = function (startRow, endRow) { self.toggleTextCursor('hide'); const startIndex = self.getTextLinesIndex(startRow); const endIndex = Math.min(self.getTextLinesIndex(endRow), self.textLines.length); const absPos = self.getAbsolutePosition(startRow, 0); for (let i = startIndex; i < endIndex; ++i) { //${self.getSGRFor('text')} self.client.term.write( `${ansi.goto(absPos.row++, absPos.col)}${self.getRenderText(i)}`, false // convertLineFeeds ); } self.toggleTextCursor('show'); return absPos.row - self.position.row; // row we ended on }; this.eraseRows = function (startRow, endRow) { self.toggleTextCursor('hide'); const absPos = self.getAbsolutePosition(startRow, 0); const absPosEnd = self.getAbsolutePosition(endRow, 0); const eraseFiller = ' '.repeat(self.dimens.width); //new Array(self.dimens.width).join(' '); while (absPos.row < absPosEnd.row) { self.client.term.write( `${ansi.goto(absPos.row++, absPos.col)}${eraseFiller}`, false // convertLineFeeds ); } self.toggleTextCursor('show'); }; this.redrawVisibleArea = function () { assert(self.topVisibleIndex <= self.textLines.length); const lastRow = self.redrawRows(0, self.dimens.height); self.eraseRows(lastRow, self.dimens.height); /* // :TOOD: create eraseRows(startRow, endRow) if(lastRow < self.dimens.height) { var absPos = self.getAbsolutePosition(lastRow, 0); var empty = new Array(self.dimens.width).join(' '); while(lastRow++ < self.dimens.height) { self.client.term.write(ansi.goto(absPos.row++, absPos.col)); self.client.term.write(empty); } } */ }; this.getVisibleText = function (index) { if (!_.isNumber(index)) { index = self.getTextLinesIndex(); } return self.textLines[index].text.replace(/\t/g, ' '); }; this.getText = function (index) { if (!_.isNumber(index)) { index = self.getTextLinesIndex(); } return self.textLines.length > index ? self.textLines[index].text : ''; }; this.getTextLength = function (index) { if (!_.isNumber(index)) { index = self.getTextLinesIndex(); } return self.textLines.length > index ? self.textLines[index].text.length : 0; }; this.getCharacter = function (index, col) { if (!_.isNumber(col)) { col = self.cursorPos.col; } return self.getText(index).charAt(col); }; this.isTab = function (index, col) { return '\t' === self.getCharacter(index, col); }; this.getTextEndOfLineColumn = function (index) { return Math.max(0, self.getTextLength(index)); }; this.getRenderText = function (index) { let text = self.getVisibleText(index); const remain = self.dimens.width - strUtil.renderStringLength(text); if (remain > 0) { text += ' '.repeat(remain); // + 1); } return text; }; this.getTextLines = function (startIndex, endIndex) { var lines; if (startIndex === endIndex) { lines = [self.textLines[startIndex]]; } else { lines = self.textLines.slice(startIndex, endIndex + 1); // "slice extracts up to but not including end." } return lines; }; this.getOutputText = function (startIndex, endIndex, eolMarker, options) { const lines = self.getTextLines(startIndex, endIndex); let text = ''; const re = new RegExp('\\t{1,' + self.tabWidth + '}', 'g'); lines.forEach(line => { text += line.text.replace(re, '\t'); if (options.forceLineTerms || (eolMarker && line.eol)) { text += eolMarker; } }); return text; }; this.getContiguousText = function (startIndex, endIndex, includeEol) { var lines = self.getTextLines(startIndex, endIndex); var text = ''; for (var i = 0; i < lines.length; ++i) { text += lines[i].text; if (includeEol && lines[i].eol) { text += '\n'; } } return text; }; this.replaceCharacterInText = function (c, index, col) { self.textLines[index].text = strUtil.replaceAt( self.textLines[index].text, col, c ); }; /* this.editTextAtPosition = function(editAction, text, index, col) { switch(editAction) { case 'insert' : self.insertCharactersInText(text, index, col); break; case 'deleteForward' : break; case 'deleteBack' : break; case 'replace' : break; } }; */ this.updateTextWordWrap = function (index) { const nextEolIndex = self.getNextEndOfLineIndex(index); const wrapped = self.wordWrapSingleLine( self.getContiguousText(index, nextEolIndex), 'tabsIntact' ); const newLines = wrapped.wrapped.map(l => { return { text: l }; }); newLines[newLines.length - 1].eol = true; Array.prototype.splice.apply( self.textLines, [index, nextEolIndex - index + 1].concat(newLines) ); return wrapped.firstWrapRange; }; this.removeCharactersFromText = function (index, col, operation, count) { if ('delete' === operation) { self.textLines[index].text = self.textLines[index].text.slice(0, col) + self.textLines[index].text.slice(col + count); self.updateTextWordWrap(index); self.redrawRows(self.cursorPos.row, self.dimens.height); self.moveClientCursorToCursorPos(); } else if ('backspace' === operation) { // :TODO: method for splicing text self.textLines[index].text = self.textLines[index].text.slice(0, col - (count - 1)) + self.textLines[index].text.slice(col + 1); self.cursorPos.col -= count - 1; self.updateTextWordWrap(index); self.redrawRows(self.cursorPos.row, self.dimens.height); self.moveClientCursorToCursorPos(); } else if ('delete line' === operation) { // // Delete a visible line. Note that this is *not* the "physical" line, or // 1:n entries up to eol! This is to keep consistency with home/end, and // some other text editors such as nano. Sublime for example want to // treat all of these things using the physical approach, but this seems // a bit odd in this context. // var isLastLine = index === self.textLines.length - 1; var hadEol = self.textLines[index].eol; self.textLines.splice(index, 1); if (hadEol && self.textLines.length > index && !self.textLines[index].eol) { self.textLines[index].eol = true; } // // Create a empty edit buffer if necessary // :TODO: Make this a method if (self.textLines.length < 1) { self.textLines = [{ text: '', eol: true }]; isLastLine = false; // resetting } self.cursorPos.col = 0; var lastRow = self.redrawRows(self.cursorPos.row, self.dimens.height); self.eraseRows(lastRow, self.dimens.height); // // If we just deleted the last line in the buffer, move up // if (isLastLine) { self.cursorEndOfPreviousLine(); } else { self.moveClientCursorToCursorPos(); } } }; this.insertCharactersInText = function (c, index, col) { const prevTextLength = self.getTextLength(index); let editingEol = self.cursorPos.col === prevTextLength; self.textLines[index].text = [ self.textLines[index].text.slice(0, col), c, self.textLines[index].text.slice(col), ].join(''); self.cursorPos.col += c.length; if (self.getTextLength(index) > self.dimens.width) { // // Update word wrapping and |cursorOffset| if the cursor // was within the bounds of the wrapped text // let cursorOffset; const lastCol = self.cursorPos.col - c.length; const firstWrapRange = self.updateTextWordWrap(index); if (lastCol >= firstWrapRange.start && lastCol <= firstWrapRange.end) { cursorOffset = self.cursorPos.col - firstWrapRange.start; editingEol = true; //override } else { cursorOffset = firstWrapRange.end; } // redraw from current row to end of visible area self.redrawRows(self.cursorPos.row, self.dimens.height); // If we're editing mid, we're done here. Else, we need to // move the cursor to the new editing position after a wrap if (editingEol) { self.cursorBeginOfNextLine(); self.cursorPos.col += cursorOffset; self.client.term.rawWrite(ansi.right(cursorOffset)); } else { // adjust cursor after drawing new rows const absPos = self.getAbsolutePosition( self.cursorPos.row, self.cursorPos.col ); self.client.term.rawWrite(ansi.goto(absPos.row, absPos.col)); } } else { // // We must only redraw from col -> end of current visible line // const absPos = self.getAbsolutePosition( self.cursorPos.row, self.cursorPos.col ); const renderText = self .getRenderText(index) .slice(self.cursorPos.col - c.length); self.client.term.write( `${ansi.hideCursor()}${self.getSGRFor('text')}${renderText}${ansi.goto( absPos.row, absPos.col )}${ansi.showCursor()}`, false // convertLineFeeds ); } }; this.getRemainingTabWidth = function (col) { if (!_.isNumber(col)) { col = self.cursorPos.col; } return self.tabWidth - (col % self.tabWidth); }; this.calculateTabStops = function () { self.tabStops = [0]; var col = 0; while (col < self.dimens.width) { col += self.getRemainingTabWidth(col); self.tabStops.push(col); } }; this.getNextTabStop = function (col) { var i = self.tabStops.length; while (self.tabStops[--i] > col); return self.tabStops[++i]; }; this.getPrevTabStop = function (col) { var i = self.tabStops.length; while (self.tabStops[--i] >= col); return self.tabStops[i]; }; this.expandTab = function (col, expandChar) { expandChar = expandChar || ' '; return new Array(self.getRemainingTabWidth(col)).join(expandChar); }; this.wordWrapSingleLine = function (line, tabHandling = 'expand') { return wordWrapText(line, { width: self.dimens.width, tabHandling: tabHandling, tabWidth: self.tabWidth, tabChar: '\t', }); }; this.setTextLines = function (lines, index, termWithEol) { if ( 0 === index && (0 === self.textLines.length || (self.textLines.length === 1 && '' === self.textLines[0].text)) ) { // quick path: just set the things self.textLines = lines .slice(0, -1) .map(l => { return { text: l }; }) .concat({ text: lines[lines.length - 1], eol: termWithEol }); } else { // insert somewhere in textLines... if (index > self.textLines.length) { // fill with empty self.textLines.splice( self.textLines.length, 0, ...Array.from({ length: index - self.textLines.length }).map(() => { return { text: '' }; }) ); } const newLines = lines .slice(0, -1) .map(l => { return { text: l }; }) .concat({ text: lines[lines.length - 1], eol: termWithEol }); self.textLines.splice(index, 0, ...newLines); } }; this.setAnsiWithOptions = function (ansi, options, cb) { function setLines(text) { text = strUtil.splitTextAtTerms(text); let index = 0; text.forEach(line => { self.setTextLines([line], index, true); // true=termWithEol index += 1; }); self.cursorStartOfDocument(); if (cb) { return cb(null); } } if (options.prepped) { return setLines(ansi); } ansiPrep( ansi, { termWidth: options.termWidth || this.client.term.termWidth, termHeight: options.termHeight || this.client.term.termHeight, cols: this.dimens.width, rows: 'auto', startCol: this.position.col, forceLineTerm: options.forceLineTerm, }, (err, preppedAnsi) => { return setLines(err ? ansi : preppedAnsi); } ); }; this.insertRawText = function (text, index, col) { // // Perform the following on |text|: // * Normalize various line feed formats -> \n // * Remove some control characters (e.g. \b) // * Word wrap lines such that they fit in the visible workspace. // Each actual line will then take 1:n elements in textLines[]. // * Each tab will be appropriately expanded and take 1:n \t // characters. This allows us to know when we're in tab space // when doing cursor movement/etc. // // // Try to handle any possible newline that can be fed to us. // See http://stackoverflow.com/questions/5034781/js-regex-to-split-by-line // // :TODO: support index/col insertion point if (_.isNumber(index)) { if (_.isNumber(col)) { // // Modify text to have information from index // before and and after column // // :TODO: Need to clean this string (e.g. collapse tabs) text = self.textLines; // :TODO: Remove original line @ index } } else { index = self.textLines.length; } text = strUtil.splitTextAtTerms(text); let wrapped; text.forEach(line => { wrapped = self.wordWrapSingleLine(line, 'expand').wrapped; self.setTextLines(wrapped, index, true); // true=termWithEol index += wrapped.length; }); }; this.getAbsolutePosition = function (row, col) { return { row: self.position.row + row, col: self.position.col + col, }; }; this.moveClientCursorToCursorPos = function () { var absPos = self.getAbsolutePosition(self.cursorPos.row, self.cursorPos.col); self.client.term.rawWrite(ansi.goto(absPos.row, absPos.col)); }; this.keyPressCharacter = function (c) { var index = self.getTextLinesIndex(); // // :TODO: stuff that needs to happen // * Break up into smaller methods // * Even in overtype mode, word wrapping must apply if past bounds // * A lot of this can be used for backspacing also // * See how Sublime treats tabs in *non* overtype mode... just overwrite them? // // if (self.overtypeMode) { // :TODO: special handing for insert over eol mark? self.replaceCharacterInText(c, index, self.cursorPos.col); self.cursorPos.col++; self.client.term.write(c); } else { self.insertCharactersInText(c, index, self.cursorPos.col); } self.emitEditPosition(); }; this.keyPressUp = function () { if (self.cursorPos.row > 0) { self.cursorPos.row--; self.client.term.rawWrite(ansi.up()); if (!self.adjustCursorToNextTab('up')) { self.adjustCursorIfPastEndOfLine(false); } } else { self.scrollDocumentDown(); self.adjustCursorIfPastEndOfLine(true); } self.emitEditPosition(); }; this.keyPressDown = function () { var lastVisibleRow = Math.min(self.dimens.height, self.textLines.length - self.topVisibleIndex) - 1; if (self.cursorPos.row < lastVisibleRow) { self.cursorPos.row++; self.client.term.rawWrite(ansi.down()); if (!self.adjustCursorToNextTab('down')) { self.adjustCursorIfPastEndOfLine(false); } } else { self.scrollDocumentUp(); self.adjustCursorIfPastEndOfLine(true); } self.emitEditPosition(); }; this.keyPressLeft = function () { if (self.cursorPos.col > 0) { var prevCharIsTab = self.isTab(); self.cursorPos.col--; self.client.term.rawWrite(ansi.left()); if (prevCharIsTab) { self.adjustCursorToNextTab('left'); } } else { self.cursorEndOfPreviousLine(); } self.emitEditPosition(); }; this.keyPressRight = function () { var eolColumn = self.getTextEndOfLineColumn(); if (self.cursorPos.col < eolColumn) { var prevCharIsTab = self.isTab(); self.cursorPos.col++; self.client.term.rawWrite(ansi.right()); if (prevCharIsTab) { self.adjustCursorToNextTab('right'); } } else { self.cursorBeginOfNextLine(); } self.emitEditPosition(); }; this.keyPressHome = function () { var firstNonWhitespace = self.getVisibleText().search(/\S/); if (-1 !== firstNonWhitespace) { self.cursorPos.col = firstNonWhitespace; } else { self.cursorPos.col = 0; } self.moveClientCursorToCursorPos(); self.emitEditPosition(); }; this.keyPressEnd = function () { self.cursorPos.col = self.getTextEndOfLineColumn(); self.moveClientCursorToCursorPos(); self.emitEditPosition(); }; this.keyPressPageUp = function () { if (self.topVisibleIndex > 0) { self.topVisibleIndex = Math.max(0, self.topVisibleIndex - self.dimens.height); self.redraw(); self.adjustCursorIfPastEndOfLine(true); } else { self.cursorPos.row = 0; self.moveClientCursorToCursorPos(); // :TODO: ajust if eol, etc. } self.emitEditPosition(); }; this.keyPressPageDown = function () { var linesBelow = self.getRemainingLinesBelowRow(); if (linesBelow > 0) { self.topVisibleIndex += Math.min(linesBelow, self.dimens.height); self.redraw(); self.adjustCursorIfPastEndOfLine(true); } self.emitEditPosition(); }; this.keyPressLineFeed = function () { // // Break up text from cursor position, redraw, and update cursor // position to start of next line // var index = self.getTextLinesIndex(); var nextEolIndex = self.getNextEndOfLineIndex(index); var text = self.getContiguousText(index, nextEolIndex); const newLines = self.wordWrapSingleLine( text.slice(self.cursorPos.col), 'tabsIntact' ).wrapped; newLines.unshift({ text: text.slice(0, self.cursorPos.col), eol: true }); for (var i = 1; i < newLines.length; ++i) { newLines[i] = { text: newLines[i] }; } newLines[newLines.length - 1].eol = true; Array.prototype.splice.apply( self.textLines, [index, nextEolIndex - index + 1].concat(newLines) ); // redraw from current row to end of visible area self.redrawRows(self.cursorPos.row, self.dimens.height); self.cursorBeginOfNextLine(); self.emitEditPosition(); }; this.keyPressInsert = function () { self.toggleTextEditMode(); }; this.keyPressTab = function () { var index = self.getTextLinesIndex(); self.insertCharactersInText( self.expandTab(self.cursorPos.col, '\t') + '\t', index, self.cursorPos.col ); self.emitEditPosition(); }; this.keyPressBackspace = function () { if (self.cursorPos.col >= 1) { // // Don't want to delete character at cursor, but rather the character // to the left of the cursor! // self.cursorPos.col -= 1; var index = self.getTextLinesIndex(); var count; if (self.isTab()) { var col = self.cursorPos.col; var prevTabStop = self.getPrevTabStop(self.cursorPos.col); while (col >= prevTabStop) { if (!self.isTab(index, col)) { break; } --col; } count = self.cursorPos.col - col; } else { count = 1; } self.removeCharactersFromText(index, self.cursorPos.col, 'backspace', count); } else { // // Delete character at end of line previous. // * This may be a eol marker // * Word wrapping will need re-applied // // :TODO: apply word wrapping such that text can be re-adjusted if it can now fit on prev self.keyPressLeft(); // same as hitting left - jump to previous line //self.keyPressBackspace(); } self.emitEditPosition(); }; this.keyPressDelete = function () { const lineIndex = self.getTextLinesIndex(); if ( 0 === self.cursorPos.col && 0 === self.textLines[lineIndex].text.length && self.textLines.length > 0 ) { // // Start of line and nothing left. Just delete the line // self.removeCharactersFromText(lineIndex, 0, 'delete line'); } else { self.removeCharactersFromText(lineIndex, self.cursorPos.col, 'delete', 1); } self.emitEditPosition(); }; this.keyPressDeleteLine = function () { if (self.textLines.length > 0) { self.removeCharactersFromText(self.getTextLinesIndex(), 0, 'delete line'); } self.emitEditPosition(); }; this.adjustCursorIfPastEndOfLine = function (forceUpdate) { var eolColumn = self.getTextEndOfLineColumn(); if (self.cursorPos.col > eolColumn) { self.cursorPos.col = eolColumn; forceUpdate = true; } if (forceUpdate) { self.moveClientCursorToCursorPos(); } }; this.adjustCursorToNextTab = function (direction) { if (self.isTab()) { var move; switch (direction) { // // Next tabstop to the right // case 'right': move = self.getNextTabStop(self.cursorPos.col) - self.cursorPos.col; self.cursorPos.col += move; self.client.term.rawWrite(ansi.right(move)); break; // // Next tabstop to the left // case 'left': move = self.cursorPos.col - self.getPrevTabStop(self.cursorPos.col); self.cursorPos.col -= move; self.client.term.rawWrite(ansi.left(move)); break; case 'up': case 'down': // // Jump to the tabstop nearest the cursor // var newCol = self.tabStops.reduce(function r(prev, curr) { return Math.abs(curr - self.cursorPos.col) < Math.abs(prev - self.cursorPos.col) ? curr : prev; }); if (newCol > self.cursorPos.col) { move = newCol - self.cursorPos.col; self.cursorPos.col += move; self.client.term.rawWrite(ansi.right(move)); } else if (newCol < self.cursorPos.col) { move = self.cursorPos.col - newCol; self.cursorPos.col -= move; self.client.term.rawWrite(ansi.left(move)); } break; } return true; } return false; // did not fall on a tab }; this.cursorStartOfDocument = function () { self.topVisibleIndex = 0; self.cursorPos = { row: 0, col: 0 }; self.redraw(); self.moveClientCursorToCursorPos(); }; this.cursorEndOfDocument = function () { self.topVisibleIndex = Math.max(self.textLines.length - self.dimens.height, 0); self.cursorPos.row = self.textLines.length - self.topVisibleIndex - 1; self.cursorPos.col = self.getTextEndOfLineColumn(); self.redraw(); self.moveClientCursorToCursorPos(); }; this.cursorBeginOfNextLine = function () { // e.g. when scrolling right past eol var linesBelow = self.getRemainingLinesBelowRow(); if (linesBelow > 0) { var lastVisibleRow = Math.min(self.dimens.height, self.textLines.length) - 1; if (self.cursorPos.row < lastVisibleRow) { self.cursorPos.row++; } else { self.scrollDocumentUp(); } self.keyPressHome(); // same as pressing 'home' } }; this.cursorEndOfPreviousLine = function () { // e.g. when scrolling left past start of line var moveToEnd; if (self.cursorPos.row > 0) { self.cursorPos.row--; moveToEnd = true; } else if (self.topVisibleIndex > 0) { self.scrollDocumentDown(); moveToEnd = true; } if (moveToEnd) { self.keyPressEnd(); // same as pressing 'end' } }; /* this.cusorEndOfNextLine = function() { var linesBelow = self.getRemainingLinesBelowRow(); if(linesBelow > 0) { var lastVisibleRow = Math.min(self.dimens.height, self.textLines.length) - 1; if(self.cursorPos.row < lastVisibleRow) { self.cursorPos.row++; } else { self.scrollDocumentUp(); } self.keyPressEnd(); // same as pressing 'end' } }; */ this.scrollDocumentUp = function () { // // Note: We scroll *up* when the cursor goes *down* beyond // the visible area! // var linesBelow = self.getRemainingLinesBelowRow(); if (linesBelow > 0) { self.topVisibleIndex++; self.redraw(); } }; this.scrollDocumentDown = function () { // // Note: We scroll *down* when the cursor goes *up* beyond // the visible area! // if (self.topVisibleIndex > 0) { self.topVisibleIndex--; self.redraw(); } }; this.emitEditPosition = function () { self.emit('edit position', self.getEditPosition()); }; this.toggleTextEditMode = function () { self.overtypeMode = !self.overtypeMode; self.emit('text edit mode', self.getTextEditMode()); }; this.insertRawText(''); // init to blank/empty } require('util').inherits(MultiLineEditTextView, View); MultiLineEditTextView.prototype.setWidth = function (width) { MultiLineEditTextView.super_.prototype.setWidth.call(this, width); this.calculateTabStops(); }; MultiLineEditTextView.prototype.redraw = function () { MultiLineEditTextView.super_.prototype.redraw.call(this); this.redrawVisibleArea(); }; MultiLineEditTextView.prototype.setFocus = function (focused) { this.client.term.rawWrite(this.getSGRFor('text')); this.moveClientCursorToCursorPos(); MultiLineEditTextView.super_.prototype.setFocus.call(this, focused); }; MultiLineEditTextView.prototype.setText = function ( text, options = { scrollMode: 'default' } ) { this.textLines = []; this.addText(text, options); /*this.insertRawText(text); if(this.isEditMode()) { this.cursorEndOfDocument(); } else if(this.isPreviewMode()) { this.cursorStartOfDocument(); }*/ }; MultiLineEditTextView.prototype.setAnsi = function ( ansi, options = { prepped: false }, cb ) { this.textLines = []; return this.setAnsiWithOptions(ansi, options, cb); }; MultiLineEditTextView.prototype.addText = function ( text, options = { scrollMode: 'default' } ) { this.insertRawText(text); switch (options.scrollMode) { case 'default': if (this.isEditMode() || this.autoScroll) { this.cursorEndOfDocument(); } else { this.cursorStartOfDocument(); } break; case 'top': case 'start': this.cursorStartOfDocument(); break; case 'end': case 'bottom': this.cursorEndOfDocument(); break; } }; MultiLineEditTextView.prototype.getData = function (options = { forceLineTerms: false }) { return this.getOutputText(0, this.textLines.length, '\r\n', options); }; MultiLineEditTextView.prototype.setPropertyValue = function (propName, value) { switch (propName) { case 'mode': this.mode = value; if ('preview' === value && !this.specialKeyMap.next) { this.specialKeyMap.next = ['tab']; } break; case 'autoScroll': this.autoScroll = value; break; case 'tabSwitchesView': this.tabSwitchesView = value; this.specialKeyMap.next = this.specialKeyMap.next || []; this.specialKeyMap.next.push('tab'); break; } MultiLineEditTextView.super_.prototype.setPropertyValue.call(this, propName, value); }; const HANDLED_SPECIAL_KEYS = [ 'up', 'down', 'left', 'right', 'home', 'end', 'page up', 'page down', 'line feed', 'insert', 'tab', 'backspace', 'delete', 'delete line', ]; const PREVIEW_MODE_KEYS = ['up', 'down', 'page up', 'page down']; MultiLineEditTextView.prototype.onKeyPress = function (ch, key) { const self = this; let handled; if (key) { HANDLED_SPECIAL_KEYS.forEach(function aKey(specialKey) { if (self.isKeyMapped(specialKey, key.name)) { if ( self.isPreviewMode() && -1 === PREVIEW_MODE_KEYS.indexOf(specialKey) ) { return; } if ('tab' !== key.name || !self.tabSwitchesView) { self[_.camelCase('keyPress ' + specialKey)](); handled = true; } } }); } if (self.isEditMode() && ch && strUtil.isPrintable(ch)) { this.keyPressCharacter(ch); } if (!handled) { MultiLineEditTextView.super_.prototype.onKeyPress.call(this, ch, key); } }; MultiLineEditTextView.prototype.scrollUp = function () { this.scrollDocumentUp(); }; MultiLineEditTextView.prototype.scrollDown = function () { this.scrollDocumentDown(); }; MultiLineEditTextView.prototype.deleteLine = function (line) { this.textLines.splice(line, 1); }; MultiLineEditTextView.prototype.getLineCount = function () { return this.textLines.length; }; MultiLineEditTextView.prototype.getTextEditMode = function () { return this.overtypeMode ? 'overtype' : 'insert'; }; MultiLineEditTextView.prototype.getEditPosition = function () { var currentIndex = this.getTextLinesIndex() + 1; return { row: this.getTextLinesIndex(this.cursorPos.row), col: this.cursorPos.col, percent: Math.floor((currentIndex / this.textLines.length) * 100), below: this.getRemainingLinesBelowRow(), }; };
{ "content_hash": "4d3a2ebdcd9e958ce03ef1893ff2d346", "timestamp": "", "source": "github", "line_count": 1257, "max_line_length": 117, "avg_line_length": 31.330151153540175, "alnum_prop": 0.5397897516631964, "repo_name": "NuSkooler/enigma-bbs", "id": "025f14d476d669af253e12324bf15448ca81ded8", "size": "39382", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "core/multi_line_edit_text_view.js", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "AGS Script", "bytes": "146" }, { "name": "Dockerfile", "bytes": "1472" }, { "name": "HTML", "bytes": "3767" }, { "name": "JavaScript", "bytes": "1948938" }, { "name": "PEG.js", "bytes": "7843" }, { "name": "PLpgSQL", "bytes": "1284" }, { "name": "Shell", "bytes": "7541" } ], "symlink_target": "" }
using System; using System.Collections.Generic; using System.Runtime.Serialization; namespace MsgPack.Serialization.CollectionSerializers { /// <summary> /// Provides common features for generic dictionary serializers. /// </summary> /// <typeparam name="TDictionary">The type of the dictionary.</typeparam> /// <typeparam name="TKey">The type of the key of dictionary.</typeparam> /// <typeparam name="TValue">The type of the value of dictionary.</typeparam> /// <remarks> /// This class provides framework to implement variable collection serializer, and this type seals some virtual members to maximize future backward compatibility. /// If you cannot use this class, you can implement your own serializer which inherits <see cref="MessagePackSerializer{T}"/> and implements <see cref="ICollectionInstanceFactory"/>. /// </remarks> [System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes", Justification = "By design" )] public abstract class DictionaryMessagePackSerializerBase<TDictionary, TKey, TValue> : MessagePackSerializer<TDictionary>, ICollectionInstanceFactory where TDictionary : IEnumerable<KeyValuePair<TKey, TValue>> { private readonly MessagePackSerializer<TKey> _keySerializer; private readonly MessagePackSerializer<TValue> _valueSerializer; /// <summary> /// Initializes a new instance of the <see cref="DictionaryMessagePackSerializerBase{TDictionary, TKey, TValue}"/> class. /// </summary> /// <param name="ownerContext">A <see cref="SerializationContext"/> which owns this serializer.</param> /// <param name="schema"> /// The schema for collection itself or its items for the member this instance will be used to. /// <c>null</c> will be considered as <see cref="PolymorphismSchema.Default"/>. /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="ownerContext"/> is <c>null</c>. /// </exception> [System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Design", "CA1062:ValidateArgumentsOfPublicMethods", MessageId = "0", Justification = "Validated by base .ctor" )] protected DictionaryMessagePackSerializerBase( SerializationContext ownerContext, PolymorphismSchema schema ) : base( ownerContext ) { var safeSchema = schema ?? PolymorphismSchema.Default; this._keySerializer = ownerContext.GetSerializer<TKey>( safeSchema.KeySchema ); this._valueSerializer = ownerContext.GetSerializer<TValue>( safeSchema.ItemSchema ); } /// <summary> /// Serializes specified object with specified <see cref="Packer"/>. /// </summary> /// <param name="packer"><see cref="Packer"/> which packs values in <paramref name="objectTree"/>. This value will not be <c>null</c>.</param> /// <param name="objectTree">Object to be serialized.</param> /// <exception cref="SerializationException"> /// <typeparamref name="TDictionary"/> is not serializable etc. /// </exception> [System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Design", "CA1062:ValidateArgumentsOfPublicMethods", MessageId = "0", Justification = "Validated by caller in base class" )] [System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Design", "CA1062:ValidateArgumentsOfPublicMethods", MessageId = "1", Justification = "Validated by caller in base class" )] protected internal sealed override void PackToCore( Packer packer, TDictionary objectTree ) { #if ( !UNITY && !XAMIOS ) || AOT_CHECK packer.PackMapHeader( this.GetCount( objectTree ) ); foreach ( var item in objectTree ) { this._keySerializer.PackTo( packer, item.Key ); this._valueSerializer.PackTo( packer, item.Value ); } #else // .constraind call for TDictionary.get_Count/TDictionary.GetEnumerator() causes AOT error. // So use cast and invoke as normal call (it might cause boxing, but most collection should be reference type). packer.PackMapHeader( this.GetCount( objectTree ) ); foreach ( var item in objectTree as IEnumerable<KeyValuePair<TKey,TValue>> ) { this._keySerializer.PackTo( packer, item.Key ); this._valueSerializer.PackTo( packer, item.Value ); } #endif // ( !UNITY && !XAMIOS ) || AOT_CHECK } /// <summary> /// When overridden in derived class, returns count of the dictionary. /// </summary> /// <param name="dictionary">A collection. This value will not be <c>null</c>.</param> /// <returns>The count of the <paramref name="dictionary"/>.</returns> protected abstract int GetCount( TDictionary dictionary ); /// <summary> /// Deserializes object with specified <see cref="Unpacker"/>. /// </summary> /// <param name="unpacker"><see cref="Unpacker"/> which unpacks values of resulting object tree. This value will not be <c>null</c>.</param> /// <returns>Deserialized object.</returns> /// <exception cref="SerializationException"> /// Failed to deserialize object due to invalid unpacker state, stream content, or so. /// </exception> /// <exception cref="MessageTypeException"> /// Failed to deserialize object due to invalid unpacker state, stream content, or so. /// </exception> /// <exception cref="InvalidMessagePackStreamException"> /// Failed to deserialize object due to invalid unpacker state, stream content, or so. /// </exception> /// <exception cref="NotSupportedException"> /// <typeparamref name="TDictionary"/> is abstract type. /// </exception> /// <remarks> /// This method invokes <see cref="CreateInstance(int)"/>, and then fill deserialized items to resultong collection. /// </remarks> [System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Design", "CA1062:ValidateArgumentsOfPublicMethods", MessageId = "0", Justification = "Validated by caller in base class" )] protected internal sealed override TDictionary UnpackFromCore( Unpacker unpacker ) { if ( !unpacker.IsMapHeader ) { throw SerializationExceptions.NewIsNotArrayHeader(); } return this.InternalUnpackFromCore( unpacker ); } internal virtual TDictionary InternalUnpackFromCore( Unpacker unpacker ) { var itemsCount = UnpackHelpers.GetItemsCount( unpacker ); var collection = this.CreateInstance( itemsCount ); this.UnpackToCore( unpacker, collection, itemsCount ); return collection; } /// <summary> /// Creates a new collection instance with specified initial capacity. /// </summary> /// <param name="initialCapacity"> /// The initial capacy of creating collection. /// Note that this parameter may <c>0</c> for non-empty collection. /// </param> /// <returns> /// New collection instance. This value will not be <c>null</c>. /// </returns> /// <remarks> /// An author of <see cref="Unpacker" /> could implement unpacker for non-MessagePack format, /// so implementer of this interface should not rely on that <paramref name="initialCapacity" /> reflects actual items count. /// For example, JSON unpacker cannot supply collection items count efficiently. /// </remarks> /// <seealso cref="ICollectionInstanceFactory.CreateInstance"/> protected abstract TDictionary CreateInstance( int initialCapacity ); object ICollectionInstanceFactory.CreateInstance( int initialCapacity ) { return this.CreateInstance( initialCapacity ); } /// <summary> /// Deserializes collection items with specified <see cref="Unpacker"/> and stores them to <paramref name="collection"/>. /// </summary> /// <param name="unpacker"><see cref="Unpacker"/> which unpacks values of resulting object tree. This value will not be <c>null</c>.</param> /// <param name="collection">Collection that the items to be stored. This value will not be <c>null</c>.</param> /// <exception cref="SerializationException"> /// Failed to deserialize object due to invalid unpacker state, stream content, or so. /// </exception> /// <exception cref="NotSupportedException"> /// <typeparamref name="TDictionary"/> is not collection. /// </exception> [System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Design", "CA1062:ValidateArgumentsOfPublicMethods", MessageId = "0", Justification = "Validated by caller in base class" )] [System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Design", "CA1062:ValidateArgumentsOfPublicMethods", MessageId = "1", Justification = "Validated by caller in base class" )] protected internal sealed override void UnpackToCore( Unpacker unpacker, TDictionary collection ) { if ( !unpacker.IsMapHeader ) { throw SerializationExceptions.NewIsNotArrayHeader(); } this.UnpackToCore( unpacker, collection, UnpackHelpers.GetItemsCount( unpacker ) ); } private void UnpackToCore( Unpacker unpacker, TDictionary collection, int itemsCount ) { for ( int i = 0; i < itemsCount; i++ ) { if ( !unpacker.Read() ) { throw SerializationExceptions.NewMissingItem( i ); } TKey key; if ( !unpacker.IsArrayHeader && !unpacker.IsMapHeader ) { key = this._keySerializer.UnpackFrom( unpacker ); } else { using ( var subtreeUnpacker = unpacker.ReadSubtree() ) { key = this._keySerializer.UnpackFrom( subtreeUnpacker ); } } if ( !unpacker.Read() ) { throw SerializationExceptions.NewMissingItem( i ); } TValue value; if ( !unpacker.IsArrayHeader && !unpacker.IsMapHeader ) { value = this._valueSerializer.UnpackFrom( unpacker ); } else { using ( var subtreeUnpacker = unpacker.ReadSubtree() ) { value = this._valueSerializer.UnpackFrom( subtreeUnpacker ); } } this.AddItem( collection, key, value ); } } /// <summary> /// When implemented by derive class, /// adds the deserialized item to the collection on <typeparamref name="TDictionary"/> specific manner /// to implement <see cref="UnpackToCore(Unpacker,TDictionary)"/>. /// </summary> /// <param name="dictionary">The dictionary to be added.</param> /// <param name="key">The key to be added.</param> /// <param name="value">The value to be added.</param> /// <exception cref="NotSupportedException"> /// This implementation always throws it. /// </exception> protected virtual void AddItem( TDictionary dictionary, TKey key, TValue value ) { throw SerializationExceptions.NewUnpackToIsNotSupported( typeof( TDictionary ), null ); } } }
{ "content_hash": "931a18c09e8c9d57efa7704a375077b9", "timestamp": "", "source": "github", "line_count": 228, "max_line_length": 186, "avg_line_length": 45.53947368421053, "alnum_prop": 0.7130887026870847, "repo_name": "luyikk/ZYSOCKET", "id": "6f083468c33079c27262e6d0ef4a56d43f5a79d7", "size": "11304", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "msgpack-cli-master/src/MsgPack/Serialization/CollectionSerializers/DictionaryMessagePackSerializerBase`3.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "348" }, { "name": "C", "bytes": "451" }, { "name": "C#", "bytes": "32978903" }, { "name": "C++", "bytes": "86396" }, { "name": "HTML", "bytes": "38474" }, { "name": "Java", "bytes": "1864" }, { "name": "PowerShell", "bytes": "4676" }, { "name": "Protocol Buffer", "bytes": "192" }, { "name": "Python", "bytes": "5096" }, { "name": "Shell", "bytes": "206" } ], "symlink_target": "" }
<?php class Impressora implements AcoesAoGerarNota { public function executa(NotaFiscal $nf) { echo "<br />Eu mandei para a impressora<br />"; } } ?>
{ "content_hash": "2ffb3292d0a1f733387348f5cb4052b2", "timestamp": "", "source": "github", "line_count": 7, "max_line_length": 53, "avg_line_length": 24, "alnum_prop": 0.6428571428571429, "repo_name": "fabriciofmsilva/labs", "id": "f7050b454a253623ba26b446ffb180ab3ae2a78a", "size": "168", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "alura/php-design-patterns/Impressora.php", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "16438" }, { "name": "C#", "bytes": "89745" }, { "name": "C++", "bytes": "228" }, { "name": "CSS", "bytes": "294644" }, { "name": "Clojure", "bytes": "1759" }, { "name": "CoffeeScript", "bytes": "25" }, { "name": "Common Lisp", "bytes": "971" }, { "name": "HTML", "bytes": "224192" }, { "name": "Java", "bytes": "279422" }, { "name": "JavaScript", "bytes": "735744" }, { "name": "NewLisp", "bytes": "10960" }, { "name": "Objective-C", "bytes": "18791" }, { "name": "PHP", "bytes": "263653" }, { "name": "PLSQL", "bytes": "11021" }, { "name": "Perl", "bytes": "1127" }, { "name": "Python", "bytes": "850" }, { "name": "Ruby", "bytes": "1630" }, { "name": "Shell", "bytes": "227" }, { "name": "Swift", "bytes": "2631" }, { "name": "TypeScript", "bytes": "13708" }, { "name": "Visual Basic", "bytes": "783" } ], "symlink_target": "" }
package zipkin2.reporter.beans; import java.util.Arrays; import org.junit.After; import org.junit.Test; import zipkin2.codec.Encoding; import zipkin2.reporter.kafka.KafkaSender; import static org.assertj.core.api.Assertions.assertThat; public class KafkaSenderFactoryBeanTest { XmlBeans context; @After public void close() { if (context != null) context.close(); } @Test public void bootstrapServers() { context = new XmlBeans("" + "<bean id=\"sender\" class=\"zipkin2.reporter.beans.KafkaSenderFactoryBean\">\n" + " <property name=\"bootstrapServers\" value=\"localhost:9092\"/>\n" + "</bean>" ); assertThat(context.getBean("sender", KafkaSender.class)) .usingRecursiveComparison() .isEqualTo(KafkaSender.newBuilder() .bootstrapServers("localhost:9092") .build()); } @Test public void topic() { context = new XmlBeans("" + "<bean id=\"sender\" class=\"zipkin2.reporter.beans.KafkaSenderFactoryBean\">\n" + " <property name=\"bootstrapServers\" value=\"localhost:9092\"/>\n" + " <property name=\"topic\" value=\"zipkin2\"/>\n" + "</bean>" ); assertThat(context.getBean("sender", KafkaSender.class)) .usingRecursiveComparison() .isEqualTo(KafkaSender.newBuilder() .bootstrapServers("localhost:9092") .topic("zipkin2").build()); } @Test public void messageMaxBytes() { context = new XmlBeans("" + "<bean id=\"sender\" class=\"zipkin2.reporter.beans.KafkaSenderFactoryBean\">\n" + " <property name=\"bootstrapServers\" value=\"localhost:9092\"/>\n" + " <property name=\"messageMaxBytes\" value=\"1024\"/>\n" + "</bean>" ); assertThat(context.getBean("sender", KafkaSender.class)) .extracting("messageMaxBytes") .isEqualTo(1024); } @Test public void encoding() { context = new XmlBeans("" + "<bean id=\"sender\" class=\"zipkin2.reporter.beans.KafkaSenderFactoryBean\">\n" + " <property name=\"bootstrapServers\" value=\"localhost:9092\"/>\n" + " <property name=\"encoding\" value=\"PROTO3\"/>\n" + "</bean>" ); assertThat(context.getBean("sender", KafkaSender.class)) .extracting("encoding") .isEqualTo(Encoding.PROTO3); } @Test(expected = IllegalStateException.class) public void close_closesSender() { context = new XmlBeans("" + "<bean id=\"sender\" class=\"zipkin2.reporter.beans.KafkaSenderFactoryBean\">\n" + " <property name=\"bootstrapServers\" value=\"localhost:9092\"/>\n" + "</bean>" ); KafkaSender sender = context.getBean("sender", KafkaSender.class); context.close(); sender.sendSpans(Arrays.asList(new byte[] {'{', '}'})); } }
{ "content_hash": "63979d68c9e4fb36acc842eb38ae6b16", "timestamp": "", "source": "github", "line_count": 86, "max_line_length": 90, "avg_line_length": 32.74418604651163, "alnum_prop": 0.6221590909090909, "repo_name": "openzipkin/zipkin-reporter-java", "id": "d28a8549bbdf7e261a588fbaa8b9a103355a8f41", "size": "3416", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "spring-beans/src/test/java/zipkin2/reporter/beans/KafkaSenderFactoryBeanTest.java", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "305036" }, { "name": "Shell", "bytes": "5102" } ], "symlink_target": "" }
'Copyright © exc-jdbi 2016 '© mnPassing 2016 'mnPassing - www.github.com/exc-jdbi/passing 'mnPassing is Free and Opensource Software Option Strict On Option Explicit On Imports System Imports System.Reflection Imports System.Runtime.InteropServices ' Allgemeine Informationen über eine Assembly werden über die folgenden ' Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, ' die mit einer Assembly verknüpft sind. ' Die Werte der Assemblyattribute überprüfen <Assembly: AssemblyTitle("© mnPassing 2016")> <Assembly: AssemblyDescription("Passing Array")> <Assembly: AssemblyCompany("© exc-jdbi")> <Assembly: AssemblyProduct("© mnPassing 2016")> <Assembly: AssemblyCopyright("Copyright © exc-jdbi 2016")> <Assembly: AssemblyTrademark("")> <Assembly: ComVisible(False)> 'Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird <Assembly: Guid("ec5e2ed0-8a2b-475e-8578-3200ce61928e")> ' Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: ' ' Hauptversion ' Nebenversion ' Buildnummer ' Revision ' ' Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern ' übernehmen, indem Sie "*" eingeben: ' <Assembly: AssemblyVersion("1.0.*")> <Assembly: AssemblyVersion("1.0.0.0")> <Assembly: AssemblyFileVersion("1.0.0.0")>
{ "content_hash": "89172e459bd579c9b83c050054e919ee", "timestamp": "", "source": "github", "line_count": 44, "max_line_length": 104, "avg_line_length": 31.65909090909091, "alnum_prop": 0.7623833452979182, "repo_name": "exc-jdbi/passing", "id": "171dd91a2e8302d25b418b2ab1ac7aec318efaca", "size": "1415", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "mnPassingVb/mnPassingVbTest/My Project/AssemblyInfo.vb", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "1862" }, { "name": "C#", "bytes": "7749" }, { "name": "C++", "bytes": "15022" }, { "name": "Visual Basic", "bytes": "20044" } ], "symlink_target": "" }
.iconList { align-items: flex-start; display: flex; flex-flow: column nowrap; justify-content: space-between; } .characteristics { align-items: center; display: flex; justify-content: flex-start; margin: 1rem 0; } .iconContainer { padding: 0 25px 0 0; width: 75px; }
{ "content_hash": "eb47c6d85f7901811204f42cb47321de", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 33, "avg_line_length": 16.055555555555557, "alnum_prop": 0.6782006920415224, "repo_name": "tal87/operationcode_frontend", "id": "cb447ba0cc26769bbdf10638b276e33c829c7384", "size": "289", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/scenes/home/ourPrograms/mentorVolunteers/mentorVolunteers.css", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "68449" }, { "name": "HTML", "bytes": "4841" }, { "name": "JavaScript", "bytes": "333006" }, { "name": "Makefile", "bytes": "361" }, { "name": "Shell", "bytes": "2436" } ], "symlink_target": "" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_151) on Wed Jan 16 10:54:25 MST 2019 --> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Uses of Interface org.wildfly.swarm.config.messaging.activemq.server.ReplicationMasterHAPolicySupplier (BOM: * : All 2.3.0.Final-SNAPSHOT API)</title> <meta name="date" content="2019-01-16"> <link rel="stylesheet" type="text/css" href="../../../../../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../../../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Interface org.wildfly.swarm.config.messaging.activemq.server.ReplicationMasterHAPolicySupplier (BOM: * : All 2.3.0.Final-SNAPSHOT API)"; } } catch(err) { } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../../../../org/wildfly/swarm/config/messaging/activemq/server/ReplicationMasterHAPolicySupplier.html" title="interface in org.wildfly.swarm.config.messaging.activemq.server">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../../../../../../../../overview-tree.html">Tree</a></li> <li><a href="../../../../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../../../../index-all.html">Index</a></li> <li><a href="../../../../../../../../help-doc.html">Help</a></li> </ul> <div class="aboutLanguage">Thorntail API, 2.3.0.Final-SNAPSHOT</div> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../../../../index.html?org/wildfly/swarm/config/messaging/activemq/server/class-use/ReplicationMasterHAPolicySupplier.html" target="_top">Frames</a></li> <li><a href="ReplicationMasterHAPolicySupplier.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h2 title="Uses of Interface org.wildfly.swarm.config.messaging.activemq.server.ReplicationMasterHAPolicySupplier" class="title">Uses of Interface<br>org.wildfly.swarm.config.messaging.activemq.server.ReplicationMasterHAPolicySupplier</h2> </div> <div class="classUseContainer"> <ul class="blockList"> <li class="blockList"> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation"> <caption><span>Packages that use <a href="../../../../../../../../org/wildfly/swarm/config/messaging/activemq/server/ReplicationMasterHAPolicySupplier.html" title="interface in org.wildfly.swarm.config.messaging.activemq.server">ReplicationMasterHAPolicySupplier</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Package</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><a href="#org.wildfly.swarm.config.messaging.activemq">org.wildfly.swarm.config.messaging.activemq</a></td> <td class="colLast">&nbsp;</td> </tr> </tbody> </table> </li> <li class="blockList"> <ul class="blockList"> <li class="blockList"><a name="org.wildfly.swarm.config.messaging.activemq"> <!-- --> </a> <h3>Uses of <a href="../../../../../../../../org/wildfly/swarm/config/messaging/activemq/server/ReplicationMasterHAPolicySupplier.html" title="interface in org.wildfly.swarm.config.messaging.activemq.server">ReplicationMasterHAPolicySupplier</a> in <a href="../../../../../../../../org/wildfly/swarm/config/messaging/activemq/package-summary.html">org.wildfly.swarm.config.messaging.activemq</a></h3> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../../../../../org/wildfly/swarm/config/messaging/activemq/package-summary.html">org.wildfly.swarm.config.messaging.activemq</a> with parameters of type <a href="../../../../../../../../org/wildfly/swarm/config/messaging/activemq/server/ReplicationMasterHAPolicySupplier.html" title="interface in org.wildfly.swarm.config.messaging.activemq.server">ReplicationMasterHAPolicySupplier</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../../../../../org/wildfly/swarm/config/messaging/activemq/Server.html" title="type parameter in Server">T</a></code></td> <td class="colLast"><span class="typeNameLabel">Server.</span><code><span class="memberNameLink"><a href="../../../../../../../../org/wildfly/swarm/config/messaging/activemq/Server.html#replicationMasterHaPolicy-org.wildfly.swarm.config.messaging.activemq.server.ReplicationMasterHAPolicySupplier-">replicationMasterHaPolicy</a></span>(<a href="../../../../../../../../org/wildfly/swarm/config/messaging/activemq/server/ReplicationMasterHAPolicySupplier.html" title="interface in org.wildfly.swarm.config.messaging.activemq.server">ReplicationMasterHAPolicySupplier</a>&nbsp;supplier)</code> <div class="block">A messaging resource that allows you to configure High Availability for the ActiveMQ server (the value of ha-policy can be live-only, replication-master, replication-slave, or replication-colocated).</div> </td> </tr> </tbody> </table> </li> </ul> </li> </ul> </div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../../../../org/wildfly/swarm/config/messaging/activemq/server/ReplicationMasterHAPolicySupplier.html" title="interface in org.wildfly.swarm.config.messaging.activemq.server">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../../../../../../../../overview-tree.html">Tree</a></li> <li><a href="../../../../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../../../../index-all.html">Index</a></li> <li><a href="../../../../../../../../help-doc.html">Help</a></li> </ul> <div class="aboutLanguage">Thorntail API, 2.3.0.Final-SNAPSHOT</div> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../../../../index.html?org/wildfly/swarm/config/messaging/activemq/server/class-use/ReplicationMasterHAPolicySupplier.html" target="_top">Frames</a></li> <li><a href="ReplicationMasterHAPolicySupplier.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small>Copyright &#169; 2019 <a href="http://www.jboss.org">JBoss by Red Hat</a>. All rights reserved.</small></p> </body> </html>
{ "content_hash": "cd415643a18afa64d30c35c82b4f098a", "timestamp": "", "source": "github", "line_count": 172, "max_line_length": 591, "avg_line_length": 49.95348837209303, "alnum_prop": 0.6613128491620112, "repo_name": "wildfly-swarm/wildfly-swarm-javadocs", "id": "d554456083c9c649a3a377f83388511dad4e5363", "size": "8592", "binary": false, "copies": "1", "ref": "refs/heads/gh-pages", "path": "2.3.0.Final-SNAPSHOT/apidocs/org/wildfly/swarm/config/messaging/activemq/server/class-use/ReplicationMasterHAPolicySupplier.html", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
package com.resttest.framework.json.model; import java.util.ArrayList; import java.util.HashSet; import java.util.LinkedHashSet; import java.util.Set; public class TestSuite { private ArrayList<TestCase> testSuite = new ArrayList<TestCase>(); public void addTestSuite(String filename,ArrayList<TestCase> newTestSuite){ for (TestCase tc : newTestSuite){ tc.addFileName(filename); } testSuite.addAll(newTestSuite); } public void addTestCase(TestCase testCase) { testSuite.add(testCase); } public ArrayList<TestCase> getTestCases() { return testSuite; } /* @Override public String toString() { StringBuilder formattedString = new StringBuilder(); for (TestCase tc : getTestCases()) { formattedString.append(" ").append(tc).append("\n"); } return formattedString.toString(); }*/ }
{ "content_hash": "b179bb1f49826aa303c67fc246b2f58b", "timestamp": "", "source": "github", "line_count": 42, "max_line_length": 76, "avg_line_length": 21.142857142857142, "alnum_prop": 0.6801801801801802, "repo_name": "academyandbeyond/rest-test", "id": "34dd94ff6fd67b7d44a439bdf404293e93ef1175", "size": "888", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/com/resttest/framework/json/model/TestSuite.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "1601" }, { "name": "HTML", "bytes": "209484" }, { "name": "Java", "bytes": "106397" }, { "name": "JavaScript", "bytes": "1366469" } ], "symlink_target": "" }
A simple game that is belongs to my newbie period. When I see my code , I laugh too loud. It is very hard-code. ##License It dosen't need a license, but [MIT License](http://choosealicense.com/licenses/mit/)
{ "content_hash": "1dbb8d71d9d4be371079cd7d0d0f339b", "timestamp": "", "source": "github", "line_count": 3, "max_line_length": 112, "avg_line_length": 69.33333333333333, "alnum_prop": 0.7451923076923077, "repo_name": "amovah/TicTacToeOffline", "id": "a57c823bbd0206b0ae119e60ef817d319978077f", "size": "219", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "2894" }, { "name": "HTML", "bytes": "551" }, { "name": "JavaScript", "bytes": "8910" } ], "symlink_target": "" }
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("HexadecimalVar")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("HexadecimalVar")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("811e7597-42f0-4481-88f4-c5eb40b8c054")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
{ "content_hash": "02d8312cc7ae21270f686272bf962a07", "timestamp": "", "source": "github", "line_count": 36, "max_line_length": 84, "avg_line_length": 39.916666666666664, "alnum_prop": 0.7272094641614475, "repo_name": "SevdalinZhelyazkov/TelerikAcademy", "id": "dbc56a0e240f750e8db36e307f8f2b01bb7a809e", "size": "1440", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "CSharp-Part-1/DataTypesAndVariables/HexadecimalVar/Properties/AssemblyInfo.cs", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "32824" }, { "name": "HTML", "bytes": "93794" }, { "name": "JavaScript", "bytes": "38671" } ], "symlink_target": "" }
package org.apache.orc.impl.writer; import org.apache.hadoop.hive.ql.exec.vector.BytesColumnVector; import org.apache.hadoop.hive.ql.exec.vector.ColumnVector; import org.apache.orc.TypeDescription; import org.apache.orc.impl.Utf8Utils; import java.io.IOException; import java.nio.charset.StandardCharsets; /** * Under the covers, varchar is written to ORC the same way as string. */ public class VarcharTreeWriter extends StringBaseTreeWriter { private final int maxLength; VarcharTreeWriter(TypeDescription schema, WriterEncryptionVariant encryption, WriterContext context) throws IOException { super(schema, encryption, context); maxLength = schema.getMaxLength(); } @Override public void writeBatch(ColumnVector vector, int offset, int length) throws IOException { super.writeBatch(vector, offset, length); BytesColumnVector vec = (BytesColumnVector) vector; if (vector.isRepeating) { if (vector.noNulls || !vector.isNull[0]) { // 0, length times writeTruncated(vec, 0, length); } } else { for(int i=0; i < length; ++i) { if (vec.noNulls || !vec.isNull[i + offset]) { // offset + i, once per loop writeTruncated(vec, i + offset, 1); } } } } private void writeTruncated(BytesColumnVector vec, int row, int repeats) throws IOException { int itemLength = Utf8Utils.truncateBytesTo(maxLength, vec.vector[row], vec.start[row], vec.length[row]); if (useDictionaryEncoding) { int id = dictionary.add(vec.vector[row], vec.start[row], itemLength); for (int i = 0; i < repeats; ++i) { rows.add(id); } } else { for (int i = 0; i < repeats; ++i) { directStreamOutput.write(vec.vector[row], vec.start[row], itemLength); lengthOutput.write(itemLength); } } indexStatistics.updateString(vec.vector[row], vec.start[row], itemLength, repeats); if (createBloomFilter) { if (bloomFilter != null) { // translate from UTF-8 to the default charset bloomFilter.addString(new String(vec.vector[row], vec.start[row], itemLength, StandardCharsets.UTF_8)); } bloomFilterUtf8.addBytes(vec.vector[row], vec.start[row], itemLength); } } }
{ "content_hash": "11a1718550a316bfe3ce2c5c0f2252e5", "timestamp": "", "source": "github", "line_count": 71, "max_line_length": 95, "avg_line_length": 33.08450704225352, "alnum_prop": 0.6475095785440613, "repo_name": "apache/orc", "id": "506b55f3aee8bb5a847610e9d2536004f41377e3", "size": "3154", "binary": false, "copies": "2", "ref": "refs/heads/main", "path": "java/core/src/java/org/apache/orc/impl/writer/VarcharTreeWriter.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "5758" }, { "name": "C++", "bytes": "2224089" }, { "name": "CMake", "bytes": "62280" }, { "name": "CSS", "bytes": "77052" }, { "name": "Dockerfile", "bytes": "15416" }, { "name": "HTML", "bytes": "19890468" }, { "name": "Java", "bytes": "3479604" }, { "name": "JavaScript", "bytes": "4962" }, { "name": "Python", "bytes": "19748" }, { "name": "Ruby", "bytes": "67" }, { "name": "SCSS", "bytes": "36593" }, { "name": "Shell", "bytes": "6638" } ], "symlink_target": "" }
package main import ( "fmt" ) const ( TAGS_URI = "/repos/%s/%s/tags" ) type Tag struct { Name string `json:"name"` Commit Commit `json:"commit"` ZipBallUrl string `json:"zipball_url"` TarBallUrl string `json:"tarball_url"` } func (t *Tag) String() string { return t.Name + " (commit: " + t.Commit.Url + ")" } /* get the tags associated with a repo */ func Tags(user, repo string) ([]Tag, error) { var tags []Tag err := GithubGet(fmt.Sprintf(TAGS_URI, user, repo), &tags) if err != nil { return nil, err } return tags, nil }
{ "content_hash": "8ea36c0acfc1708d8cca8bceafa29ab1", "timestamp": "", "source": "github", "line_count": 31, "max_line_length": 59, "avg_line_length": 17.870967741935484, "alnum_prop": 0.6245487364620939, "repo_name": "jwilder/github-release", "id": "edab7af58d2cbd7b390ff0d472ccfbf3c7f7fb3a", "size": "554", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "tags.go", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
import index from '../../../src/components/HomePage/index' // eslint-disable-line describe('components/HomePage/index', () => { it('should work') })
{ "content_hash": "506ff5d0dab80a13e38bc6b28ab74079", "timestamp": "", "source": "github", "line_count": 5, "max_line_length": 81, "avg_line_length": 30.4, "alnum_prop": 0.6644736842105263, "repo_name": "vslinko-archive/esex", "id": "fe2a2c4a7a03fc1f0a79d0595194b1ffb22e9c8a", "size": "152", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "test/components/HomePage/indexTest.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "88910" }, { "name": "Shell", "bytes": "2258" } ], "symlink_target": "" }
<?php /* Section: email-change-password Language: Portuguese (Brazilian) */ $translations = array( 'email' => 'Recebemos sua solicitação de mudança de senha. Seguem seus novos dados abaixo: Usuário: {$user} Senha: {$newData} Por favor, confirme as alterações clicando no link a seguir: {$mailLink} Se não foi você que solicitou a mudança da senha do seu banco de dados no db4free.net, ignore esse email! Esperamos que aproveite o seu banco de dados! Equipe db4free.net http://www.db4free.net', ); ?>
{ "content_hash": "d7673416ee1f3adc641755449e56765a", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 105, "avg_line_length": 19.653846153846153, "alnum_prop": 0.735812133072407, "repo_name": "dcdgupta/sqldatabase", "id": "4b98e1d8b304b9eb4a2689ce9ac6d26edb278592", "size": "520", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "pt/email-change-password.php", "mode": "33188", "license": "mit", "language": [ { "name": "PHP", "bytes": "309546" } ], "symlink_target": "" }
<?xml version="1.0" ?> <dataset id="participants-challenge"> <question id="1" answertype="resource" aggregation="false" onlydbo="false"> <string><![CDATA[ Give me all people that wrote lyrics for bands from Seattle. ]]></string> <query><![CDATA[ PREFIX dbo: <http://dbpedia.org/ontology/> PREFIX res: <http://dbpedia.org/resource/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX mo: <http://purl.org/ontology/mo/> SELECT DISTINCT ?uri WHERE { ?dbp_band owl:sameAs ?band . ?dbp_band dbo:hometown res:Seattle. ?album foaf:maker ?band . ?album mo:lyricist ?uri . } ]]></query> </question> <question id="2" answertype="number" aggregation="true" onlydbo="false"> <string><![CDATA[ How many singles were produced by bands under contract with Roadrunner Records? ]]></string> <query> <![CDATA[ PREFIX dbo: <http://dbpedia.org/ontology/> PREFIX res: <http://dbpedia.org/resource/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX mo: <http://purl.org/ontology/mo/> PREFIX dc: <http://purl.org/dc/elements/1.1/> SELECT COUNT(DISTINCT ?uri) WHERE { ?dbp_band rdf:type dbo:Band . ?dbp_band dbo:recordLabel res:Roadrunner_Records . ?dbp_band owl:sameAs ?mb_band . ?uri rdf:type mo:Record . ?uri mo:release_type mo:single . ?uri foaf:maker ?mb_band . } ]]></query> </question> <question id="3" answertype="resource" aggregation="true" onlydbo="false"> <string><![CDATA[ Give me all records that were released during the lifetime of John F. Kennedy. ]]></string> <query><![CDATA[ PREFIX dbo: <http://dbpedia.org/ontology/> PREFIX res: <http://dbpedia.org/resource/> PREFIX mo: <http://purl.org/ontology/mo/> SELECT DISTINCT ?uri WHERE { ?uri rdf:type mo:Record . ?album owl:sameAs ?uri . ?album dbo:releaseDate ?date . res:John_F._Kennedy dbo:birthDate ?start . res:John_F._Kennedy dbo:deathDate ?end . FILTER (?date >= ?start && ?date <= ?end) } ]]></query> </question> <question id="4" answertype="resource" aggregation="true" onlydbo="false"> <string><![CDATA[ Give me all anarcho punk bands that were formed in the 80s. ]]></string> <query><![CDATA[ PREFIX yago: <http://dbpedia.org/class/yago/> PREFIX bio: <http://purl.org/vocab/bio/0.1/> SELECT DISTINCT ?uri ?string WHERE { ?uri rdf:type yago:Anarcho-punkGroups . ?uri owl:sameAs ?mb_band . ?mb_band bio:event ?event . ?event rdf:type bio:Birth . ?event bio:date ?date . { ?event bio:date ?date . FILTER (?date <= '1989-12-31'^^xsd:date || ?date >= '1980-01-01'^^xsd:date ) } UNION { ?event bio:date ?date . FILTER regex(?date,'^198') } OPTIONAL { ?uri rdfs:label ?string . FILTER (lang(?string) = 'en') } } ]]></query> </question> <question id="5" answertype="resource" aggregation="false" onlydbo="false"> <string><![CDATA[ Give me all singles released by daughter labels of Sony Music. ]]></string> <query><![CDATA[ PREFIX dbo: <http://dbpedia.org/ontology/> PREFIX dbp: <http://dbpedia.org/property/> PREFIX res: <http://dbpedia.org/resource/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX mo: <http://purl.org/ontology/mo/> SELECT DISTINCT ?uri ?string WHERE { ?label dbp:parent res:Sony_Music_Entertainment . ?dbp_band dbo:recordLabel ?label . ?dbp_band owl:sameAs ?mb_band . ?uri rdf:type mo:Record . ?uri mo:release_type mo:single . ?uri foaf:maker ?mb_band . ?uri dc:title ?string . } ]]></query> </question> <question id="6" answertype="boolean" aggregation="true" onlydbo="false"> <string><![CDATA[ Was the Cracow Klezmer Band founded before DJ Tomekk was born? ]]></string> <query><![CDATA[ PREFIX dbo: <http://dbpedia.org/ontology/> PREFIX res: <http://dbpedia.org/resource/> PREFIX bio: <http://purl.org/vocab/bio/0.1/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX mo: <http://purl.org/ontology/mo/> ASK WHERE { ?mb_band foaf:name 'The Cracow Klezmer Band' . ?mb_band bio:event ?event . ?event rdf:type bio:Birth . ?event bio:date ?birthdate1 . res:DJ_Tomekk dbo:birthDate ?birthdate2 . FILTER (?birthdate1 <= ?birthdate2) } ]]></query> </question> <question id="7" answertype="resource" aggregation="false" onlydbo="false"> <string><![CDATA[ In which country was the singer of the Drunken Lullabies by Flogging Molly born? ]]></string> <query><![CDATA[ PREFIX dbo: <http://dbpedia.org/ontology/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX dc: <http://purl.org/dc/elements/1.1/> PREFIX mo: <http://purl.org/ontology/mo/> SELECT DISTINCT ?uri WHERE { ?album rdf:type mo:Record . ?album dc:title 'Drunken Lullabies' . ?album mo:singer ?mb_singer . ?album foaf:maker ?mb_band . ?mb_band foaf:name 'Flogging Molly' . ?dbp_singer owl:sameAs ?mb_singer . ?dbp_singer dbo:birthPlace ?uri . ?uri rdf:type dbo:Country . } ]]> </query> </question> </dataset>
{ "content_hash": "1854485e1cbf1f0fb96ceba09dc4cd94", "timestamp": "", "source": "github", "line_count": 160, "max_line_length": 82, "avg_line_length": 29.65625, "alnum_prop": 0.6815595363540569, "repo_name": "ag-sc/QALD", "id": "82bd0cfbdaf38e91bebb3980b6e412a8c8732a43", "size": "4745", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "3/data/participants-challenge.xml", "mode": "33261", "license": "mit", "language": [ { "name": "CSS", "bytes": "2877" }, { "name": "Dockerfile", "bytes": "54" }, { "name": "HTML", "bytes": "80816" }, { "name": "Mustache", "bytes": "4259" }, { "name": "PHP", "bytes": "30605" }, { "name": "Python", "bytes": "253237" }, { "name": "Ruby", "bytes": "20744" }, { "name": "TeX", "bytes": "111498" } ], "symlink_target": "" }
// ----------------------------------------------------------------------- // <copyright file="GetEntryList.cs" company="SugarCrm + PocoGen + REST"> // Copyright (c) SugarCrm + PocoGen + REST. All rights reserved. // </copyright> // ----------------------------------------------------------------------- namespace SugarRestSharp.MethodCalls { using System; using System.Collections.Generic; using System.Net; using Helpers; using Newtonsoft.Json; using Responses; using RestSharp; /// <summary> /// Represents the GetEntryList class /// </summary> internal static class GetEntryList { /// <summary> /// Gets entries [SugarCrm REST method - get_entry_list] /// </summary> /// <param name="sessionId">Session identifier</param> /// <param name="url">REST API Url</param> /// <param name="moduleName">SugarCrm module name</param> /// <param name="selectFields">Selected field list</param> /// <param name="queryString">Formatted query string.</param> /// <param name="maxCountResult">Maximum number of entries to return</param> /// <returns>ReadEntryListResponse object</returns> public static ReadEntryListResponse Run(string sessionId, string url, string moduleName, List<string> selectFields, string queryString, int maxCountResult) { var readEntryListResponse = new ReadEntryListResponse(); var content = string.Empty; try { dynamic data = new { session = sessionId, module_name = moduleName, query = queryString, order_by = string.Empty, offset = 0, select_fields = selectFields, link_name_to_fields_array = string.Empty, max_results = maxCountResult, deleted = 0, favorites = false }; var client = new RestClient(url); var request = new RestRequest(string.Empty, Method.POST); string jsonData = JsonConvert.SerializeObject(data); request.AddParameter("method", "get_entry_list"); request.AddParameter("input_type", "json"); request.AddParameter("response_type", "json"); request.AddParameter("rest_data", jsonData); var sugarApiRestResponse = client.ExecuteEx(request); var response = sugarApiRestResponse.RestResponse; if (response.StatusCode == HttpStatusCode.OK) { content = response.Content; readEntryListResponse = JsonConverterHelper.Deserialize<ReadEntryListResponse>(content); readEntryListResponse.StatusCode = response.StatusCode; } else { readEntryListResponse.StatusCode = response.StatusCode; readEntryListResponse.Error = ErrorResponse.Format(response); } readEntryListResponse.JsonRawRequest = sugarApiRestResponse.JsonRawRequest; readEntryListResponse.JsonRawResponse = sugarApiRestResponse.JsonRawResponse; } catch (Exception exception) { readEntryListResponse.StatusCode = HttpStatusCode.InternalServerError; readEntryListResponse.Error = ErrorResponse.Format(exception, content); } return readEntryListResponse; } } }
{ "content_hash": "f23be7f63eda14368f912ac72b83b2b6", "timestamp": "", "source": "github", "line_count": 90, "max_line_length": 163, "avg_line_length": 40.766666666666666, "alnum_prop": 0.5521940583265195, "repo_name": "mattkol/SugarRestSharp", "id": "c290bd58283def0e3b8bbf8b0384fec9f854202f", "size": "3671", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "SugarRestSharpSolution/SugarRestSharp/RestApiCalls/MethodCalls/GetEntryList.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "513863" } ], "symlink_target": "" }
START_ATF_NAMESPACE namespace Detail { Info::_item_fanfare_zoclInit2_ptr _item_fanfare_zoclInit2_next(nullptr); Info::_item_fanfare_zoclInit2_clbk _item_fanfare_zoclInit2_user(nullptr); Info::_item_fanfare_zoclctor__item_fanfare_zocl4_ptr _item_fanfare_zoclctor__item_fanfare_zocl4_next(nullptr); Info::_item_fanfare_zoclctor__item_fanfare_zocl4_clbk _item_fanfare_zoclctor__item_fanfare_zocl4_user(nullptr); void _item_fanfare_zoclInit2_wrapper(struct _item_fanfare_zocl* _this) { _item_fanfare_zoclInit2_user(_this, _item_fanfare_zoclInit2_next); }; void _item_fanfare_zoclctor__item_fanfare_zocl4_wrapper(struct _item_fanfare_zocl* _this) { _item_fanfare_zoclctor__item_fanfare_zocl4_user(_this, _item_fanfare_zoclctor__item_fanfare_zocl4_next); }; ::std::array<hook_record, 2> _item_fanfare_zocl_functions = { _hook_record { (LPVOID)0x1400f0560L, (LPVOID *)&_item_fanfare_zoclInit2_user, (LPVOID *)&_item_fanfare_zoclInit2_next, (LPVOID)cast_pointer_function(_item_fanfare_zoclInit2_wrapper), (LPVOID)cast_pointer_function((void(_item_fanfare_zocl::*)())&_item_fanfare_zocl::Init) }, _hook_record { (LPVOID)0x1400f0510L, (LPVOID *)&_item_fanfare_zoclctor__item_fanfare_zocl4_user, (LPVOID *)&_item_fanfare_zoclctor__item_fanfare_zocl4_next, (LPVOID)cast_pointer_function(_item_fanfare_zoclctor__item_fanfare_zocl4_wrapper), (LPVOID)cast_pointer_function((void(_item_fanfare_zocl::*)())&_item_fanfare_zocl::ctor__item_fanfare_zocl) }, }; }; // end namespace Detail END_ATF_NAMESPACE
{ "content_hash": "7cf4e16b47ce0ae9f1be736a12834e14", "timestamp": "", "source": "github", "line_count": 39, "max_line_length": 122, "avg_line_length": 48.15384615384615, "alnum_prop": 0.601171458998935, "repo_name": "goodwinxp/Yorozuya", "id": "4a0eef59cef185ff6d047446c462e5420f999660", "size": "1950", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "YorozuyaGSLib/source/_item_fanfare_zoclDetail.cpp", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "207291" }, { "name": "C++", "bytes": "21670817" } ], "symlink_target": "" }
define([ 'underscore', 'backbone', 'marionette' ], function (_, Backbone, Marionette) { 'use strict'; return Backbone.Marionette.LayoutView.extend({ template: '#home-skeleton', className: 'home-container', regions: { top: '#home-top-container', bottom: '#home-bottom-container' }, initialize: function (options) {} }); });
{ "content_hash": "201656007979991556bbf80c1fff6685", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 48, "avg_line_length": 15.583333333333334, "alnum_prop": 0.606951871657754, "repo_name": "enzotoshio/marionettejs-maryo-exemple", "id": "1be46c38d247a4e92dfc2d57e5b788da5343b6f4", "size": "374", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/scripts/layouts/home.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "11360" }, { "name": "HTML", "bytes": "3711" }, { "name": "JavaScript", "bytes": "29234" } ], "symlink_target": "" }
namespace Packets { class GCGuildError: public Packet { public: GCGuildError(){} virtual ~GCGuildError(){} //公用接口 virtual BOOL Read( SocketInputStream& iStream ); virtual BOOL Write( SocketOutputStream& oStream ) const; virtual UINT Execute( Player* pPlayer ); virtual PacketID_t GetPacketID() const { return PACKET_GC_GUILDERROR; } virtual UINT GetPacketSize() const { return sizeof(m_Error); } public : VOID SetErrorCode( CHAR Error ){ m_Error = Error; } CHAR GetErrorCode( ){ return m_Error; } private : CHAR m_Error; }; class GCGuildErrorFactory: public PacketFactory { public: Packet* CreatePacket() { return new GCGuildError(); } PacketID_t GetPacketID() const { return PACKET_GC_GUILDERROR; } UINT GetPacketMaxSize() const { return sizeof(CHAR); } }; class GCGuildErrorHandler { public: static UINT Execute(GCGuildError* pPacket, Player* pPlayer); }; } using namespace Packets; #endif // __GC_GUILDERROR_H__
{ "content_hash": "6320bc8c3ea4e0abb7b295e049058d95", "timestamp": "", "source": "github", "line_count": 44, "max_line_length": 86, "avg_line_length": 29.772727272727273, "alnum_prop": 0.5251908396946565, "repo_name": "viticm/web-pap", "id": "3a18eefdc0e4376746eeb510d19053ec678eb222", "size": "1441", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "server/Common/Packets/GCGuildError.h", "mode": "33261", "license": "bsd-3-clause", "language": [ { "name": "C", "bytes": "2382465" }, { "name": "C++", "bytes": "6819417" }, { "name": "CSS", "bytes": "1042" }, { "name": "JavaScript", "bytes": "8703" }, { "name": "Lua", "bytes": "12590" }, { "name": "Objective-C", "bytes": "143909" }, { "name": "PHP", "bytes": "14327" }, { "name": "Perl", "bytes": "892" }, { "name": "Shell", "bytes": "16405" } ], "symlink_target": "" }
package playn.ios; import java.util.HashMap; import java.util.Map; import cli.MonoTouch.CoreText.CTFont; import playn.core.AbstractFont; class IOSFont extends AbstractFont { /** * Registers a font for use when a bold, italic or bold italic variant is requested. iOS does not * programmatically generate bold, italic and bold italic variants of fonts. Instead it uses the * actual bold, italic or bold italic variant of the font provided by the original designer. * * <p> The built-in iOS fonts (Helvetica, Courier) have already had their variants mapped, but if * you add custom fonts to your game, you will need to register variants for the bold, italic or * bold italic versions if you intend to make use of them. </p> * * <p> Alternatively, you can simply request a font variant by name (e.g. {@code * graphics().createFont("Arial Bold Italic", Font.Style.PLAIN, 16)}) to use a specific font * variant directly. This variant mapping process exists only to simplify cross-platform * development. </p> */ public static final void registerVariant(String name, Style style, String variantName) { Map<String,String> styleVariants = _variants.get(style); if (styleVariants == null) { _variants.put(style, styleVariants = new HashMap<String,String>()); } styleVariants.put(name, variantName); } final CTFont ctFont; IOSFont(String name, Style style, float size) { super(name, style, size); ctFont = new CTFont(getVariant(name, style), size); } private static String getVariant(String name, Style style) { Map<String,String> styleVariants = _variants.get(style); String variant = (styleVariants == null) ? null : styleVariants.get(name); if (variant != null) return variant; else if (style == Style.BOLD_ITALIC) // fall back to bold if we have no bold+italic variant return getVariant(name, Style.BOLD); else return name; } private static Map<Style,Map<String,String>> _variants = new HashMap<Style,Map<String,String>>(); static { // this is a selection of moderately well-known fonts that are available on iOS; // see http://www.bluecrowbar.com/blog/2010/12/ios-fonts.html for a complete list registerVariant("American Typewriter", Style.BOLD, "American Typewriter Bold"); registerVariant("Arial", Style.ITALIC, "Arial Italic"); registerVariant("Arial", Style.BOLD, "Arial Bold"); registerVariant("Arial", Style.BOLD_ITALIC, "Arial Bold Italic"); registerVariant("Arial Hebrew", Style.BOLD, "Arial Hebrew Bold"); registerVariant("Baskerville", Style.BOLD, "Baskerville Bold"); registerVariant("Baskerville", Style.ITALIC, "Baskerville Italic"); registerVariant("Baskerville", Style.BOLD_ITALIC, "Baskerville Bold Italic"); registerVariant("Chalkboard SE", Style.PLAIN, "Chalkboard SE Regular"); registerVariant("Chalkboard SE", Style.BOLD, "Chalkboard SE Bold"); registerVariant("Chalkboard SE Regular", Style.BOLD_ITALIC, "Chalkboard SE Bold"); registerVariant("Cochin", Style.BOLD, "Cochin Bold"); registerVariant("Cochin", Style.ITALIC, "Cochin Italic"); registerVariant("Cochin", Style.BOLD_ITALIC, "Cochin Bold Italic"); registerVariant("Courier", Style.BOLD, "Courier Bold"); registerVariant("Courier", Style.ITALIC, "Courier Oblique"); registerVariant("Courier", Style.BOLD_ITALIC, "Courier Bold Oblique"); registerVariant("Courier New", Style.BOLD, "Courier New Bold"); registerVariant("Courier New", Style.ITALIC, "Courier New Italic"); registerVariant("Courier New", Style.BOLD_ITALIC, "Courier New Bold Italic"); registerVariant("Georgia", Style.ITALIC, "Georgia Italic"); registerVariant("Georgia", Style.BOLD, "Georgia Bold"); registerVariant("Georgia", Style.BOLD_ITALIC, "Georgia Bold Italic"); registerVariant("Georgia", Style.ITALIC, "Georgia Italic"); registerVariant("Georgia", Style.BOLD, "Georgia Bold"); registerVariant("Georgia", Style.BOLD_ITALIC, "Georgia Bold Italic"); registerVariant("Helvetica", Style.BOLD, "Helvetica Bold"); registerVariant("Helvetica", Style.ITALIC, "Helvetica Oblique"); registerVariant("Helvetica", Style.BOLD_ITALIC, "Helvetica Bold Oblique"); registerVariant("Helvetica Neue", Style.BOLD, "Helvetica Neue Bold"); registerVariant("Helvetica Neue", Style.ITALIC, "Helvetica Neue Italic"); registerVariant("Helvetica Neue", Style.BOLD_ITALIC, "Helvetica Neue Bold Italic"); registerVariant("Palatino", Style.ITALIC, "Palatino Italic"); registerVariant("Palatino", Style.BOLD, "Palatino Bold"); registerVariant("Palatino", Style.BOLD_ITALIC, "Palatino Bold Italic"); registerVariant("Times New Roman", Style.ITALIC, "Times New Roman Italic"); registerVariant("Times New Roman", Style.BOLD, "Times New Roman Bold"); registerVariant("Times New Roman", Style.BOLD_ITALIC, "Times New Roman Bold Italic"); registerVariant("Trebuchet MS", Style.ITALIC, "Trebuchet MS Italic"); registerVariant("Trebuchet MS", Style.BOLD, "Trebuchet MS Bold"); registerVariant("Trebuchet MS", Style.BOLD_ITALIC, "Trebuchet MS Bold Italic"); registerVariant("Verdana", Style.ITALIC, "Verdana Italic"); registerVariant("Verdana", Style.BOLD, "Verdana Bold"); registerVariant("Verdana", Style.BOLD_ITALIC, "Verdana Bold Italic"); // map 'Times New Roman' as 'Times' for compatibility as well registerVariant("Times", Style.PLAIN, "Times New Roman"); registerVariant("Times", Style.ITALIC, "Times New Roman Italic"); registerVariant("Times", Style.BOLD, "Times New Roman Bold"); registerVariant("Times", Style.BOLD_ITALIC, "Times New Roman Bold Italic"); } }
{ "content_hash": "8db438db874f241c90f63f656cd6501f", "timestamp": "", "source": "github", "line_count": 107, "max_line_length": 99, "avg_line_length": 53.4392523364486, "alnum_prop": 0.7173837005946135, "repo_name": "Just-/playn", "id": "4537ea9ee58e0a2a255490c9bc31b45e0dbf1ee8", "size": "6315", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ios/src/playn/ios/IOSFont.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ActionScript", "bytes": "129219" }, { "name": "C", "bytes": "787" }, { "name": "C#", "bytes": "549" }, { "name": "C++", "bytes": "611" }, { "name": "Emacs Lisp", "bytes": "105" }, { "name": "Java", "bytes": "2021719" }, { "name": "Scala", "bytes": "2824" }, { "name": "Shell", "bytes": "869" } ], "symlink_target": "" }
/* * DbgTracePort.cpp * * Created on: 16.03.2015 * Author: niklausd */ #include <DbgTraceContext.h> #include <DbgTraceOut.h> #include <DbgTracePort.h> #include <DbgCliCommand.h> #ifdef ARDUINO #include <Arduino.h> #else #include <time.h> #endif #include <stdio.h> #include <string.h> #include <stdarg.h> //----------------------------------------------------------------------------- // concrete command class DbgCli_Command_ChangeOut //----------------------------------------------------------------------------- /** * @brief Concrete cli command implementation to access the output of a trace port. */ class DbgCli_Command_ChangeOut : public DbgCli_Command { private: DbgTrace_Port* m_tracePort; public: DbgCli_Command_ChangeOut(DbgTrace_Port* port, DbgCli_Node* parentNode, const char* nodeName, const char* helpText) : DbgCli_Command(parentNode, nodeName, helpText) , m_tracePort(port) { } void execute(unsigned int argc, const char** args, unsigned int idxToFirstArgToHandle) { if (argc > idxToFirstArgToHandle) { const char* cmd = args[idxToFirstArgToHandle]; DbgTrace_Context* context = DbgTrace_Context::getContext(); if(0 == strncmp(cmd, "get", 4)) { if((0 != m_tracePort) && (0 != m_tracePort->getOut())) { char buf[20 + DbgTrace_Out::s_cMaxOutNameLength]; snprintf(buf, sizeof(buf), "Out: \"%s\"" , m_tracePort->getOut()->getName()); #ifdef ARDUINO Serial.println(buf); #else printf("%s\n", buf); #endif } } else if(0 == strncmp(cmd, "set", 4)) { if((0 != m_tracePort) && (0 != m_tracePort->getOut()) && (0 != context)) { if (argc <= idxToFirstArgToHandle+1) { #ifdef ARDUINO #ifndef __ets__ Serial.println(F("Output Name missing")); #else Serial.println("Output Name missing"); #endif Serial.println(this->getHelpText()); #else printf("Output Name missing\n"); printf("%s\n", this->getHelpText()); #endif } else { DbgTrace_Out* newOut = context->getTraceOut(args[idxToFirstArgToHandle+1]); char buf[20 + DbgTrace_Out::s_cMaxOutNameLength]; if(0 != newOut) { m_tracePort->setOut(newOut); snprintf(buf, sizeof(buf), "OK! Out: \"%s\"" , m_tracePort->getOut()->getName()); } else { snprintf(buf, sizeof(buf), "Fail! Out: \"%s\"" , m_tracePort->getOut()->getName()); } #ifdef ARDUINO Serial.println(buf); #else printf("%s\n", buf); #endif } } } else if((0 == strncmp(cmd, "list", 5)) && (0 != context)) { DbgTrace_Out* tmpOut = context->getFirstTraceOut(); if((0 != m_tracePort) && (0 != m_tracePort->getOut())) { char buf[20 + DbgTrace_Out::s_cMaxOutNameLength]; while(0 != tmpOut) { if((0 != m_tracePort->getOut()) && (0 == strncmp(tmpOut->getName(), m_tracePort->getOut()->getName(), DbgTrace_Out::s_cMaxOutNameLength))) { // mark currently used output snprintf(buf, sizeof(buf),">%s" , tmpOut->getName()); } else { snprintf(buf, sizeof(buf), " %s" , tmpOut->getName()); } #ifdef ARDUINO Serial.println(buf); #else printf("%s\n", buf); #endif tmpOut = tmpOut->getNextOut(); } } } else { #ifdef ARDUINO #ifndef __ets__ Serial.print(F("Unknown command: ")); #else Serial.print("Unknown command: "); #endif Serial.println(cmd); Serial.println(this->getHelpText()); #else printf("Unknown command: %s\n", cmd); printf("%s\n", this->getHelpText()); #endif } } else { #ifdef ARDUINO #ifndef __ets__ Serial.println(F("Cmd missing")); #else Serial.println("Cmd missing"); #endif Serial.println(this->getHelpText()); #else printf("Cmd missing\n"); printf("%s\n", this->getHelpText()); #endif } } private: DbgCli_Command_ChangeOut(); }; //----------------------------------------------------------------------------- // concrete command class DbgCli_Command_ChangeLevel //----------------------------------------------------------------------------- /** * @brief Concrete cli command implementation to access the level of a trace port. */ class DbgCli_Command_ChangeLevel : public DbgCli_Command { private: DbgTrace_Port* m_tracePort; public: DbgCli_Command_ChangeLevel(DbgTrace_Port* port, DbgCli_Node* parentNode, const char* nodeName, const char* helpText) : DbgCli_Command(parentNode, nodeName, helpText) , m_tracePort(port) { } void execute(unsigned int argc, const char** args, unsigned int idxToFirstArgToHandle) { if (argc > idxToFirstArgToHandle) { const char* cmd = args[idxToFirstArgToHandle]; if (0 == strncmp(cmd, "get", 4)) { if (0 != m_tracePort) { char buf[20 + DbgTrace_Level::s_cMaxLevelLength]; snprintf(buf, sizeof(buf), "Level: \"%s\"" , DbgTrace_Level::levelToString(m_tracePort->getLevel())); // Print current level #ifdef ARDUINO Serial.println(buf); #else printf("%s\n", buf); #endif } } else if (0 == strncmp(cmd, "set", 4)) { if (0 != m_tracePort) { if (argc <= idxToFirstArgToHandle+1) { #ifdef ARDUINO #ifndef __ets__ Serial.println(F("Level missing")); #else Serial.println("Level missing"); #endif Serial.println(this->getHelpText()); #else printf("Level missing\n"); printf("%s\n", this->getHelpText()); #endif } else { char buf[20 + DbgTrace_Level::s_cMaxLevelLength]; // Get new level, as additional parameter DbgTrace_Level::Level newLevel = DbgTrace_Level::stringToLevel(args[idxToFirstArgToHandle+1]); if (DbgTrace_Level::none != newLevel) { m_tracePort->setLevel(newLevel); snprintf(buf, sizeof(buf), "OK! Level: \"%s\"" , DbgTrace_Level::levelToString(m_tracePort->getLevel())); } else { snprintf(buf, sizeof(buf), "Fail! Level: \"%s\"" , DbgTrace_Level::levelToString(m_tracePort->getLevel())); } // Print new level #ifdef ARDUINO Serial.println(buf); #else printf("%s\n", buf); #endif } } } else if (0 == strncmp(cmd, "list", 5)) { if (0 != m_tracePort) { int level = 0; char buf[4 + DbgTrace_Level::s_cMaxLevelLength]; while (DbgTrace_Level::LEVEL_ENUM_LIMIT != level) { // List all valid levels, line by line. if (level == m_tracePort->getLevel()) { // mark currently used level snprintf(buf, sizeof(buf),">%s" , DbgTrace_Level::levelToString(static_cast<DbgTrace_Level::Level>(level))); } else { snprintf(buf, sizeof(buf)," %s" , DbgTrace_Level::levelToString(static_cast<DbgTrace_Level::Level>(level))); } #ifdef ARDUINO Serial.println(buf); #else printf("%s\n", buf); #endif level++; } } } else { #ifdef ARDUINO #ifndef __ets__ Serial.print(F("Unknown command: ")); #else Serial.print("Unknown command: "); #endif Serial.println(cmd); Serial.println(this->getHelpText()); #else printf("Unknown command: %s\n", cmd); printf("%s\n", this->getHelpText()); #endif } } else { #ifdef ARDUINO #ifndef __ets__ Serial.println(F("Cmd missing")); #else Serial.println("Cmd missing"); #endif Serial.println(this->getHelpText()); #else printf("Cmd missing\n"); printf("%s\n", this->getHelpText()); #endif } } private: DbgCli_Command_ChangeLevel(); }; //----------------------------------------------------------------------------- // Class DbgTrace_Port //----------------------------------------------------------------------------- DbgTrace_Port::DbgTrace_Port(const char* tag, DbgTrace_Level::Level level, const char* outName) : m_out(DbgTrace_Context::getContext()->getTraceOut(outName)) , m_level(level) , m_nextPort(0) , m_tag(reinterpret_cast<const char*>(tag)) { DbgTrace_Context* context = DbgTrace_Context::getContext(); if(0 != context) { context->addTracePort(this); } } DbgTrace_Port::DbgTrace_Port(const char* tag, DbgTrace_Level::Level level) : m_out(DbgTrace_Context::getContext()->getTraceOut(reinterpret_cast<const char*>("trConOut"))) , m_level(level) , m_nextPort(0) , m_tag(reinterpret_cast<const char*>(tag)) { DbgTrace_Context* context = DbgTrace_Context::getContext(); if(0 != context) { context->addTracePort(this); } } #ifdef ARDUINO #ifndef __ets__ DbgTrace_Port::DbgTrace_Port(const __FlashStringHelper* tag, DbgTrace_Level::Level level, const __FlashStringHelper* outName) : m_out(DbgTrace_Context::getContext()->getTraceOut(reinterpret_cast<const char*>(outName))) , m_level(level) , m_nextPort(0) , m_tag(reinterpret_cast<const char*>(tag)) { DbgTrace_Context* context = DbgTrace_Context::getContext(); if(0 != context) { context->addTracePort(this); } } DbgTrace_Port::DbgTrace_Port(const __FlashStringHelper* tag, DbgTrace_Level::Level level) : m_out(DbgTrace_Context::getContext()->getTraceOut(reinterpret_cast<const char*>(F("trConOut")))) , m_level(level) , m_nextPort(0) , m_tag(reinterpret_cast<const char*>(tag)) { DbgTrace_Context* context = DbgTrace_Context::getContext(); if(0 != context) { context->addTracePort(this); } } #endif #endif DbgTrace_Port::~DbgTrace_Port() { //Delete tracePort in single linked list DbgTrace_Context* context = DbgTrace_Context::getContext(); if(0 != context) { context->deleteTracePort(m_tag); } } void DbgTrace_Port::printStrFormat(const char* format, ...) { char stream[s_cTraceBufSize]; va_list args; va_start(args, format); vsnprintf(stream, s_cTraceBufSize, format, args); va_end(args); printStr(stream); } void DbgTrace_Port::printStr(const char* str) { if(0 != m_out) { #ifdef ARDUINO char timeStr[s_cArduinoTimeStamp]; #else char timeStr[s_cTestTimeStamp]; #endif char stream[s_cTraceBufSize]; getTime(timeStr); snprintf(stream, sizeof(stream), "%s - %s: %s", timeStr, getTag(), str); m_out->print(stream); } } void DbgTrace_Port::printLong(long num) { if(0 != m_out) { #ifdef ARDUINO char timeStr[s_cArduinoTimeStamp]; #else char timeStr[s_cTestTimeStamp]; #endif char stream[s_cTraceBufSize]; getTime(timeStr); snprintf(stream, sizeof(stream), "%s - %s: %ld", timeStr, getTag(), num); m_out->print(stream); } } void DbgTrace_Port::printDbl(double val) { if(0 != m_out) { #ifdef ARDUINO char timeStr[s_cArduinoTimeStamp]; #else char timeStr[s_cTestTimeStamp]; #endif getTime(timeStr); char stream[s_cTraceBufSize]; #ifdef AVR snprintf(stream, sizeof(stream), "%s - %s: ", timeStr, getTag()); dtostrf(val, 6, 3, &stream[12]); #else snprintf(stream, sizeof(stream), "%s - %s: %f", timeStr, getTag(), val); #endif m_out->print(stream); } } void DbgTrace_Port::getTime(char* timeStr) { #ifdef ARDUINO sprintf(timeStr,"%ld", millis()); #else _strtime(timeStr); #endif } void DbgTrace_Port::createCliNodes(DbgCli_Topic* contextTopic) { DbgCli_Topic* portTopic = new DbgCli_Topic(contextTopic, m_tag, "Offers get/set access to output and level"); if(0 != m_out) { // Create DbgCli commands for out and level of this port new DbgCli_Command_ChangeOut(this, portTopic, "out", "Cmds: get, set <outName>, list"); new DbgCli_Command_ChangeLevel(this, portTopic, "lvl", "Cmds: get, set <levelName>, list"); } }
{ "content_hash": "eb7d45cb7943fe3c5c92a1f71cc70e1f", "timestamp": "", "source": "github", "line_count": 461, "max_line_length": 125, "avg_line_length": 26.537960954446856, "alnum_prop": 0.5653097923818865, "repo_name": "ERNICommunity/dbg-trace", "id": "de5a19f3a57e74ab0bae5363f4b80c73696bf118", "size": "12234", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "DbgTracePort.cpp", "mode": "33188", "license": "mit", "language": [ { "name": "C++", "bytes": "39517" } ], "symlink_target": "" }
package org.lwjgl.opengl; import java.nio.*; import static org.lwjgl.system.Checks.*; import static org.lwjgl.system.JNI.*; import static org.lwjgl.system.MemoryUtil.*; /** * Native bindings to the <a href="http://www.opengl.org/registry/specs/ARB/draw_indirect.txt">ARB_draw_indirect</a> extension. * * <p>This extension provides a mechanism for supplying the arguments to a * DrawArraysInstanced or DrawElementsInstancedBaseVertex from buffer object * memory. This is not particularly useful for applications where the CPU * knows the values of the arguments beforehand, but is helpful when the * values will be generated on the GPU through any mechanism that can write * to a buffer object including image stores, atomic counters, or compute * interop. This allows the GPU to consume these arguments without a round- * trip to the CPU or the expensive synchronization that would involve. This * is similar to the DrawTransformFeedbackEXT command from * EXT_transform_feedback2, but offers much more flexibility in both * generating the arguments and in the type of Draws that can be accomplished.</p> * * <p>Requires {@link GL31 OpenGL 3.1}. Promoted to core in {@link GL40 OpenGL 4.0}.</p> */ public class ARBDrawIndirect { /** * Accepted by the {@code target} parameters of BindBuffer, BufferData, BufferSubData, MapBuffer, UnmapBuffer, GetBufferSubData, GetBufferPointerv, * MapBufferRange, FlushMappedBufferRange, GetBufferParameteriv, and CopyBufferSubData. */ public static final int GL_DRAW_INDIRECT_BUFFER = 0x8F3F; /** Accepted by the {@code value} parameter of GetIntegerv, GetBooleanv, GetFloatv, and GetDoublev. */ public static final int GL_DRAW_INDIRECT_BUFFER_BINDING = 0x8F43; protected ARBDrawIndirect() { throw new UnsupportedOperationException(); } static boolean isAvailable(GLCapabilities caps) { return checkFunctions( caps.glDrawArraysIndirect, caps.glDrawElementsIndirect ); } // --- [ glDrawArraysIndirect ] --- /** Unsafe version of: {@link #glDrawArraysIndirect DrawArraysIndirect} */ public static void nglDrawArraysIndirect(int mode, long indirect) { long __functionAddress = GL.getCapabilities().glDrawArraysIndirect; if ( CHECKS ) checkFunctionAddress(__functionAddress); callPV(__functionAddress, mode, indirect); } /** * Renders primitives from array data, taking parameters from memory. * * <p>{@code glDrawArraysIndirect} behaves similarly to {@link GL42#glDrawArraysInstancedBaseInstance DrawArraysInstancedBaseInstance}, except that the parameters to * glDrawArraysInstancedBaseInstance are stored in memory at the address given by {@code indirect}.</p> * * <p>The parameters addressed by {@code indirect} are packed into a structure that takes the form (in C):</p> * * <pre><code>typedef struct { uint count; uint primCount; uint first; uint baseInstance; // must be 0 unless OpenGL 4.2 is supported } DrawArraysIndirectCommand; const DrawArraysIndirectCommand *cmd = (const DrawArraysIndirectCommand *)indirect; glDrawArraysInstancedBaseInstance(mode, cmd->first, cmd->count, cmd->primCount, cmd->baseInstance);</code></pre> * * @param mode what kind of primitives to render. One of:<br><table><tr><td>{@link GL11#GL_POINTS POINTS}</td><td>{@link GL11#GL_LINE_STRIP LINE_STRIP}</td><td>{@link GL11#GL_LINE_LOOP LINE_LOOP}</td><td>{@link GL11#GL_LINES LINES}</td><td>{@link GL11#GL_POLYGON POLYGON}</td><td>{@link GL11#GL_TRIANGLE_STRIP TRIANGLE_STRIP}</td><td>{@link GL11#GL_TRIANGLE_FAN TRIANGLE_FAN}</td></tr><tr><td>{@link GL11#GL_TRIANGLES TRIANGLES}</td><td>{@link GL11#GL_QUAD_STRIP QUAD_STRIP}</td><td>{@link GL11#GL_QUADS QUADS}</td><td>{@link GL32#GL_LINES_ADJACENCY LINES_ADJACENCY}</td><td>{@link GL32#GL_LINE_STRIP_ADJACENCY LINE_STRIP_ADJACENCY}</td><td>{@link GL32#GL_TRIANGLES_ADJACENCY TRIANGLES_ADJACENCY}</td><td>{@link GL32#GL_TRIANGLE_STRIP_ADJACENCY TRIANGLE_STRIP_ADJACENCY}</td></tr><tr><td>{@link GL40#GL_PATCHES PATCHES}</td></tr></table> * @param indirect a structure containing the draw parameters */ public static void glDrawArraysIndirect(int mode, ByteBuffer indirect) { if ( CHECKS ) checkBuffer(indirect, 4 * 4); nglDrawArraysIndirect(mode, memAddress(indirect)); } /** * Renders primitives from array data, taking parameters from memory. * * <p>{@code glDrawArraysIndirect} behaves similarly to {@link GL42#glDrawArraysInstancedBaseInstance DrawArraysInstancedBaseInstance}, except that the parameters to * glDrawArraysInstancedBaseInstance are stored in memory at the address given by {@code indirect}.</p> * * <p>The parameters addressed by {@code indirect} are packed into a structure that takes the form (in C):</p> * * <pre><code>typedef struct { uint count; uint primCount; uint first; uint baseInstance; // must be 0 unless OpenGL 4.2 is supported } DrawArraysIndirectCommand; const DrawArraysIndirectCommand *cmd = (const DrawArraysIndirectCommand *)indirect; glDrawArraysInstancedBaseInstance(mode, cmd->first, cmd->count, cmd->primCount, cmd->baseInstance);</code></pre> * * @param mode what kind of primitives to render. One of:<br><table><tr><td>{@link GL11#GL_POINTS POINTS}</td><td>{@link GL11#GL_LINE_STRIP LINE_STRIP}</td><td>{@link GL11#GL_LINE_LOOP LINE_LOOP}</td><td>{@link GL11#GL_LINES LINES}</td><td>{@link GL11#GL_POLYGON POLYGON}</td><td>{@link GL11#GL_TRIANGLE_STRIP TRIANGLE_STRIP}</td><td>{@link GL11#GL_TRIANGLE_FAN TRIANGLE_FAN}</td></tr><tr><td>{@link GL11#GL_TRIANGLES TRIANGLES}</td><td>{@link GL11#GL_QUAD_STRIP QUAD_STRIP}</td><td>{@link GL11#GL_QUADS QUADS}</td><td>{@link GL32#GL_LINES_ADJACENCY LINES_ADJACENCY}</td><td>{@link GL32#GL_LINE_STRIP_ADJACENCY LINE_STRIP_ADJACENCY}</td><td>{@link GL32#GL_TRIANGLES_ADJACENCY TRIANGLES_ADJACENCY}</td><td>{@link GL32#GL_TRIANGLE_STRIP_ADJACENCY TRIANGLE_STRIP_ADJACENCY}</td></tr><tr><td>{@link GL40#GL_PATCHES PATCHES}</td></tr></table> * @param indirect a structure containing the draw parameters */ public static void glDrawArraysIndirect(int mode, long indirect) { nglDrawArraysIndirect(mode, indirect); } /** * Renders primitives from array data, taking parameters from memory. * * <p>{@code glDrawArraysIndirect} behaves similarly to {@link GL42#glDrawArraysInstancedBaseInstance DrawArraysInstancedBaseInstance}, except that the parameters to * glDrawArraysInstancedBaseInstance are stored in memory at the address given by {@code indirect}.</p> * * <p>The parameters addressed by {@code indirect} are packed into a structure that takes the form (in C):</p> * * <pre><code>typedef struct { uint count; uint primCount; uint first; uint baseInstance; // must be 0 unless OpenGL 4.2 is supported } DrawArraysIndirectCommand; const DrawArraysIndirectCommand *cmd = (const DrawArraysIndirectCommand *)indirect; glDrawArraysInstancedBaseInstance(mode, cmd->first, cmd->count, cmd->primCount, cmd->baseInstance);</code></pre> * * @param mode what kind of primitives to render. One of:<br><table><tr><td>{@link GL11#GL_POINTS POINTS}</td><td>{@link GL11#GL_LINE_STRIP LINE_STRIP}</td><td>{@link GL11#GL_LINE_LOOP LINE_LOOP}</td><td>{@link GL11#GL_LINES LINES}</td><td>{@link GL11#GL_POLYGON POLYGON}</td><td>{@link GL11#GL_TRIANGLE_STRIP TRIANGLE_STRIP}</td><td>{@link GL11#GL_TRIANGLE_FAN TRIANGLE_FAN}</td></tr><tr><td>{@link GL11#GL_TRIANGLES TRIANGLES}</td><td>{@link GL11#GL_QUAD_STRIP QUAD_STRIP}</td><td>{@link GL11#GL_QUADS QUADS}</td><td>{@link GL32#GL_LINES_ADJACENCY LINES_ADJACENCY}</td><td>{@link GL32#GL_LINE_STRIP_ADJACENCY LINE_STRIP_ADJACENCY}</td><td>{@link GL32#GL_TRIANGLES_ADJACENCY TRIANGLES_ADJACENCY}</td><td>{@link GL32#GL_TRIANGLE_STRIP_ADJACENCY TRIANGLE_STRIP_ADJACENCY}</td></tr><tr><td>{@link GL40#GL_PATCHES PATCHES}</td></tr></table> * @param indirect a structure containing the draw parameters */ public static void glDrawArraysIndirect(int mode, IntBuffer indirect) { if ( CHECKS ) checkBuffer(indirect, (4 * 4) >> 2); nglDrawArraysIndirect(mode, memAddress(indirect)); } // --- [ glDrawElementsIndirect ] --- /** Unsafe version of: {@link #glDrawElementsIndirect DrawElementsIndirect} */ public static void nglDrawElementsIndirect(int mode, int type, long indirect) { long __functionAddress = GL.getCapabilities().glDrawElementsIndirect; if ( CHECKS ) checkFunctionAddress(__functionAddress); callPV(__functionAddress, mode, type, indirect); } /** * Renders indexed primitives from array data, taking parameters from memory. * * <p>{@code glDrawElementsIndirect} behaves similarly to {@link GL42#glDrawElementsInstancedBaseVertexBaseInstance DrawElementsInstancedBaseVertexBaseInstance}, execpt that the parameters to * glDrawElementsInstancedBaseVertexBaseInstance are stored in memory at the address given by {@code indirect}.</p> * * <p>The parameters addressed by {@code indirect} are packed into a structure that takes the form (in C):</p> * * <pre><code>typedef struct { uint count; uint primCount; uint firstIndex; uint baseVertex; uint baseInstance; } DrawElementsIndirectCommand;</code></pre> * * <p>{@code glDrawElementsIndirect} is equivalent to:</p> * * <pre><code>void glDrawElementsIndirect(GLenum mode, GLenum type, const void *indirect) { const DrawElementsIndirectCommand *cmd = (const DrawElementsIndirectCommand *)indirect; glDrawElementsInstancedBaseVertexBaseInstance( mode, cmd->count, type, cmd->firstIndex + size-of-type, cmd->primCount, cmd->baseVertex, cmd->baseInstance ); }</code></pre> * * @param mode what kind of primitives to render. One of:<br><table><tr><td>{@link GL11#GL_POINTS POINTS}</td><td>{@link GL11#GL_LINE_STRIP LINE_STRIP}</td><td>{@link GL11#GL_LINE_LOOP LINE_LOOP}</td><td>{@link GL11#GL_LINES LINES}</td><td>{@link GL11#GL_POLYGON POLYGON}</td><td>{@link GL11#GL_TRIANGLE_STRIP TRIANGLE_STRIP}</td><td>{@link GL11#GL_TRIANGLE_FAN TRIANGLE_FAN}</td></tr><tr><td>{@link GL11#GL_TRIANGLES TRIANGLES}</td><td>{@link GL11#GL_QUAD_STRIP QUAD_STRIP}</td><td>{@link GL11#GL_QUADS QUADS}</td><td>{@link GL32#GL_LINES_ADJACENCY LINES_ADJACENCY}</td><td>{@link GL32#GL_LINE_STRIP_ADJACENCY LINE_STRIP_ADJACENCY}</td><td>{@link GL32#GL_TRIANGLES_ADJACENCY TRIANGLES_ADJACENCY}</td><td>{@link GL32#GL_TRIANGLE_STRIP_ADJACENCY TRIANGLE_STRIP_ADJACENCY}</td></tr><tr><td>{@link GL40#GL_PATCHES PATCHES}</td></tr></table> * @param type the type of data in the buffer bound to the {@link GL15#GL_ELEMENT_ARRAY_BUFFER ELEMENT_ARRAY_BUFFER} binding. One of:<br><table><tr><td>{@link GL11#GL_UNSIGNED_BYTE UNSIGNED_BYTE}</td><td>{@link GL11#GL_UNSIGNED_SHORT UNSIGNED_SHORT}</td><td>{@link GL11#GL_UNSIGNED_INT UNSIGNED_INT}</td></tr></table> * @param indirect the address of a structure containing the draw parameters */ public static void glDrawElementsIndirect(int mode, int type, ByteBuffer indirect) { if ( CHECKS ) checkBuffer(indirect, 5 * 4); nglDrawElementsIndirect(mode, type, memAddress(indirect)); } /** * Renders indexed primitives from array data, taking parameters from memory. * * <p>{@code glDrawElementsIndirect} behaves similarly to {@link GL42#glDrawElementsInstancedBaseVertexBaseInstance DrawElementsInstancedBaseVertexBaseInstance}, execpt that the parameters to * glDrawElementsInstancedBaseVertexBaseInstance are stored in memory at the address given by {@code indirect}.</p> * * <p>The parameters addressed by {@code indirect} are packed into a structure that takes the form (in C):</p> * * <pre><code>typedef struct { uint count; uint primCount; uint firstIndex; uint baseVertex; uint baseInstance; } DrawElementsIndirectCommand;</code></pre> * * <p>{@code glDrawElementsIndirect} is equivalent to:</p> * * <pre><code>void glDrawElementsIndirect(GLenum mode, GLenum type, const void *indirect) { const DrawElementsIndirectCommand *cmd = (const DrawElementsIndirectCommand *)indirect; glDrawElementsInstancedBaseVertexBaseInstance( mode, cmd->count, type, cmd->firstIndex + size-of-type, cmd->primCount, cmd->baseVertex, cmd->baseInstance ); }</code></pre> * * @param mode what kind of primitives to render. One of:<br><table><tr><td>{@link GL11#GL_POINTS POINTS}</td><td>{@link GL11#GL_LINE_STRIP LINE_STRIP}</td><td>{@link GL11#GL_LINE_LOOP LINE_LOOP}</td><td>{@link GL11#GL_LINES LINES}</td><td>{@link GL11#GL_POLYGON POLYGON}</td><td>{@link GL11#GL_TRIANGLE_STRIP TRIANGLE_STRIP}</td><td>{@link GL11#GL_TRIANGLE_FAN TRIANGLE_FAN}</td></tr><tr><td>{@link GL11#GL_TRIANGLES TRIANGLES}</td><td>{@link GL11#GL_QUAD_STRIP QUAD_STRIP}</td><td>{@link GL11#GL_QUADS QUADS}</td><td>{@link GL32#GL_LINES_ADJACENCY LINES_ADJACENCY}</td><td>{@link GL32#GL_LINE_STRIP_ADJACENCY LINE_STRIP_ADJACENCY}</td><td>{@link GL32#GL_TRIANGLES_ADJACENCY TRIANGLES_ADJACENCY}</td><td>{@link GL32#GL_TRIANGLE_STRIP_ADJACENCY TRIANGLE_STRIP_ADJACENCY}</td></tr><tr><td>{@link GL40#GL_PATCHES PATCHES}</td></tr></table> * @param type the type of data in the buffer bound to the {@link GL15#GL_ELEMENT_ARRAY_BUFFER ELEMENT_ARRAY_BUFFER} binding. One of:<br><table><tr><td>{@link GL11#GL_UNSIGNED_BYTE UNSIGNED_BYTE}</td><td>{@link GL11#GL_UNSIGNED_SHORT UNSIGNED_SHORT}</td><td>{@link GL11#GL_UNSIGNED_INT UNSIGNED_INT}</td></tr></table> * @param indirect the address of a structure containing the draw parameters */ public static void glDrawElementsIndirect(int mode, int type, long indirect) { nglDrawElementsIndirect(mode, type, indirect); } /** * Renders indexed primitives from array data, taking parameters from memory. * * <p>{@code glDrawElementsIndirect} behaves similarly to {@link GL42#glDrawElementsInstancedBaseVertexBaseInstance DrawElementsInstancedBaseVertexBaseInstance}, execpt that the parameters to * glDrawElementsInstancedBaseVertexBaseInstance are stored in memory at the address given by {@code indirect}.</p> * * <p>The parameters addressed by {@code indirect} are packed into a structure that takes the form (in C):</p> * * <pre><code>typedef struct { uint count; uint primCount; uint firstIndex; uint baseVertex; uint baseInstance; } DrawElementsIndirectCommand;</code></pre> * * <p>{@code glDrawElementsIndirect} is equivalent to:</p> * * <pre><code>void glDrawElementsIndirect(GLenum mode, GLenum type, const void *indirect) { const DrawElementsIndirectCommand *cmd = (const DrawElementsIndirectCommand *)indirect; glDrawElementsInstancedBaseVertexBaseInstance( mode, cmd->count, type, cmd->firstIndex + size-of-type, cmd->primCount, cmd->baseVertex, cmd->baseInstance ); }</code></pre> * * @param mode what kind of primitives to render. One of:<br><table><tr><td>{@link GL11#GL_POINTS POINTS}</td><td>{@link GL11#GL_LINE_STRIP LINE_STRIP}</td><td>{@link GL11#GL_LINE_LOOP LINE_LOOP}</td><td>{@link GL11#GL_LINES LINES}</td><td>{@link GL11#GL_POLYGON POLYGON}</td><td>{@link GL11#GL_TRIANGLE_STRIP TRIANGLE_STRIP}</td><td>{@link GL11#GL_TRIANGLE_FAN TRIANGLE_FAN}</td></tr><tr><td>{@link GL11#GL_TRIANGLES TRIANGLES}</td><td>{@link GL11#GL_QUAD_STRIP QUAD_STRIP}</td><td>{@link GL11#GL_QUADS QUADS}</td><td>{@link GL32#GL_LINES_ADJACENCY LINES_ADJACENCY}</td><td>{@link GL32#GL_LINE_STRIP_ADJACENCY LINE_STRIP_ADJACENCY}</td><td>{@link GL32#GL_TRIANGLES_ADJACENCY TRIANGLES_ADJACENCY}</td><td>{@link GL32#GL_TRIANGLE_STRIP_ADJACENCY TRIANGLE_STRIP_ADJACENCY}</td></tr><tr><td>{@link GL40#GL_PATCHES PATCHES}</td></tr></table> * @param type the type of data in the buffer bound to the {@link GL15#GL_ELEMENT_ARRAY_BUFFER ELEMENT_ARRAY_BUFFER} binding. One of:<br><table><tr><td>{@link GL11#GL_UNSIGNED_BYTE UNSIGNED_BYTE}</td><td>{@link GL11#GL_UNSIGNED_SHORT UNSIGNED_SHORT}</td><td>{@link GL11#GL_UNSIGNED_INT UNSIGNED_INT}</td></tr></table> * @param indirect the address of a structure containing the draw parameters */ public static void glDrawElementsIndirect(int mode, int type, IntBuffer indirect) { if ( CHECKS ) checkBuffer(indirect, (5 * 4) >> 2); nglDrawElementsIndirect(mode, type, memAddress(indirect)); } /** Array version of: {@link #glDrawArraysIndirect DrawArraysIndirect} */ public static void glDrawArraysIndirect(int mode, int[] indirect) { long __functionAddress = GL.getCapabilities().glDrawArraysIndirect; if ( CHECKS ) { checkFunctionAddress(__functionAddress); checkBuffer(indirect, (4 * 4) >> 2); } callPV(__functionAddress, mode, indirect); } /** Array version of: {@link #glDrawElementsIndirect DrawElementsIndirect} */ public static void glDrawElementsIndirect(int mode, int type, int[] indirect) { long __functionAddress = GL.getCapabilities().glDrawElementsIndirect; if ( CHECKS ) { checkFunctionAddress(__functionAddress); checkBuffer(indirect, (5 * 4) >> 2); } callPV(__functionAddress, mode, type, indirect); } }
{ "content_hash": "f4419ee4fff7da98dd8cf01133863987", "timestamp": "", "source": "github", "line_count": 288, "max_line_length": 842, "avg_line_length": 59.4375, "alnum_prop": 0.7253183783152237, "repo_name": "VirtualGamer/SnowEngine", "id": "3eafc7657e0549b5747415fdbd2266e3574075e7", "size": "17252", "binary": false, "copies": "1", "ref": "refs/heads/Development", "path": "Dependencies/opengl/src/org/lwjgl/opengl/ARBDrawIndirect.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "GLSL", "bytes": "3506" }, { "name": "Java", "bytes": "229846" } ], "symlink_target": "" }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Univer.WorkflowLight.Execution; namespace Univer.WorkflowLight.UnitTest.Restart { public class SimpleWorkingState : WorkflowState { } }
{ "content_hash": "cb6936dcfaf60b87e2ad4090ea5625ad", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 51, "avg_line_length": 20.166666666666668, "alnum_prop": 0.7768595041322314, "repo_name": "shigengyu/UniverCore", "id": "f0410c169dcce75d8b69ef9cf47d67f1c9c5cd8e", "size": "244", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/Univer.WorkflowLight.UnitTest/Restart/SimpleWorkingState.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "372992" } ], "symlink_target": "" }
#include "Assembler.hpp" #include "BitManip.hpp" #include "Core.hpp" #include "CPU.hpp" #include "Decoder.hpp" #include "Exceptions.hpp" #include "InstructionDataBank.hpp" #include "Encoder.hpp" #include "MemoryMap.hpp" #include "Parser.hpp" #include "VirtualMemory.hpp" #include <bitset> #include <cassert> #include <iomanip> #include <iostream> #include <fstream> #include <time.h> #include <unordered_map> using namespace std; int main(int argc, char** args){ // _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); _CrtSetBreakAlloc(NUM);{ //allocation number ex {123} etc shown in objdump as NUM assert(sizeof(float) == 4); assert(sizeof(int) == 4); assert(sizeof(unsigned int) == 4); assert(sizeof(uint32_t) == 4); assert(sizeof(int32_t) == 4); assert(sizeof(uint64_t) == 8); assert(sizeof(int64_t) == 8); srand((unsigned int)time(NULL)); if(!argc == 2){ cout << "Error: invalid number of arguments. Only one can be used, *.MIPSEMobj file to run"; return 0; } string fileName(args[1]); if(Parser::isNestedByQuotes(fileName)){ fileName = Parser::removeNestedQuotes(fileName); } if(Parser::filePathToParentDirectory(fileName).empty()){ //add later } ifstream file(fileName.c_str()); if(!file.good()){ cout << "Unable to open object file \"" << fileName << "\"."; getchar(); return 0; } Core core; core.MEM.deserialize(fileName); core.run(); // } _CrtDumpMemoryLeaks(); return 0; }
{ "content_hash": "f3ea5bc1da96e77c74432297610fe3b8", "timestamp": "", "source": "github", "line_count": 69, "max_line_length": 148, "avg_line_length": 22.057971014492754, "alnum_prop": 0.6484888304862023, "repo_name": "ptjohns2/MIPSEM", "id": "6e57c12ec4ba5d8ce8b72f5010d32d58aab7de6f", "size": "1590", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/MIPSEM_CORE/MIPSEM_CORE/main.cpp", "mode": "33188", "license": "mit", "language": [ { "name": "C++", "bytes": "398551" } ], "symlink_target": "" }
// // WebViewController.m // XHLaunchAdExample // // Created by zhuxiaohui on 16/9/8. // Copyright © 2016年 it7090.com. All rights reserved. // 代码地址:https://github.com/CoderZhuXH/XHLaunchAd // 广告详情页 #import "WebViewController.h" #import <WebKit/WebKit.h> #import "XHLaunchAd.h" @interface WebViewController () @property(nonatomic,strong)WKWebView *webView; @property (nonatomic, strong) UIProgressView *progressView; @end @implementation WebViewController -(void)dealloc { /** 如果你设置了APP从后台恢复时也显示广告, 当用户停留在广告详情页时,APP从后台恢复时,你不想再次显示启动广告, 请在广告详情控制器销毁时,发下面通知,告诉XHLaunchAd,广告详情页面已显示完 */ [[NSNotificationCenter defaultCenter] postNotificationName:XHLaunchAdDetailPageShowFinishNotification object:nil]; [self.webView removeObserver:self forKeyPath:@"estimatedProgress"]; } -(void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; /** 如果你设置了APP从后台恢复时也显示广告, 当用户停留在广告详情页时,APP从后台恢复时,你不想再次显示启动广告, 请在广告详情控制器将要显示时,发下面通知,告诉XHLaunchAd,广告详情页面将要显示 */ [[NSNotificationCenter defaultCenter] postNotificationName:XHLaunchAdDetailPageWillShowNotification object:nil]; } - (void)viewDidLoad { [super viewDidLoad]; self.navigationItem.title = @"详情"; self.navigationController.navigationBar.translucent = YES; self.automaticallyAdjustsScrollViewInsets = NO; self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"←" style:UIBarButtonItemStylePlain target:self action:@selector(back)]; CGFloat navbarHeight = [UIApplication sharedApplication].statusBarFrame.size.height + 44; self.webView = [[WKWebView alloc] initWithFrame:CGRectMake(0, navbarHeight, self.view.bounds.size.width, self.view.bounds.size.height-navbarHeight)]; self.webView.scrollView.backgroundColor = [UIColor groupTableViewBackgroundColor]; [self.view addSubview:self.webView]; [self.webView addObserver:self forKeyPath:@"estimatedProgress" options:NSKeyValueObservingOptionNew context:nil]; if(!self.URLString) return; NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:(self.URLString)]]; [self.webView loadRequest:request]; self.progressView = [[UIProgressView alloc] initWithFrame:CGRectMake(0, navbarHeight-2, self.view.bounds.size.width, 2)]; self.progressView.progressViewStyle = UIProgressViewStyleBar; self.progressView.progressTintColor = [UIColor blackColor]; [self.navigationController.view addSubview:self.progressView]; } -(void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; [self.progressView removeFromSuperview]; } -(void)back{ if([_webView canGoBack]) { [_webView goBack]; } else { [self.navigationController popViewControllerAnimated:YES]; } } - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSString *,id> *)change context:(void *)context{ if ([keyPath isEqualToString:@"estimatedProgress"]) { CGFloat progress = [change[NSKeyValueChangeNewKey] floatValue]; [self.progressView setProgress:progress animated:YES]; if(progress == 1.0) { dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [self.progressView setProgress:0.0 animated:NO]; }); } }else{ [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; } } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } /* #pragma mark - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // Get the new view controller using [segue destinationViewController]. // Pass the selected object to the new view controller. } */ @end
{ "content_hash": "698543c802b6bcfea2465cc908d82451", "timestamp": "", "source": "github", "line_count": 115, "max_line_length": 156, "avg_line_length": 35.06086956521739, "alnum_prop": 0.7242063492063492, "repo_name": "CoderZhuXH/XHLaunchAd", "id": "30833655b2e748daf8bdfcea31c3f7b89a35c6b1", "size": "4363", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "XHLaunchAdExample/Class/WebViewController.m", "mode": "33188", "license": "mit", "language": [ { "name": "Objective-C", "bytes": "206955" }, { "name": "Ruby", "bytes": "704" } ], "symlink_target": "" }
namespace moducom { namespace coap { // context mode is intermediate, so once native streambuf mode is fully online, zap EXPCONTEXT code //#define FEATURE_MCCOAP_EXPCONTEXT template <class TStreambuf> class StreambufDecoder : public Decoder { TStreambuf streambuf; #ifdef FEATURE_MCCOAP_EXPCONTEXT // a bit like the netbuf-ish DecoderWithContext, but without the netbuf mk1 semantics // might be able to bypass context or minimize it to more stack-y behavior internal::DecoderContext context; #endif public: typedef typename estd::remove_reference<TStreambuf>::type streambuf_type; typedef estd::internal::basic_istream<streambuf_type&> istream_type; typedef typename streambuf_type::int_type int_type; typedef typename streambuf_type::size_type size_type; typedef typename streambuf_type::traits_type traits_type; // DEBT: Must assert that char_type is an 8-bit type typedef typename traits_type::char_type char_type; typedef typename estd::span<const char_type> span_type; private: #ifdef FEATURE_MCCOAP_EXPCONTEXT // Represents total size remaining of incoming stream/packet data to be decoded // NOTE: Temporary helper as we transition to truly stream-based decoding. CoAP // relies heavily on the transport knowing total_size or at least a hard EOF for // a particular packet. That's a little murky still with streambufs, so manually // specify total_size, which for every CoAP use case I can think of, is readily // available on a decode. Sloppy, but not "wrong". Eventually we want to lean more // on in_avail(), underflow() and friends directly in the decoder size_type total_size_remaining; #endif public: // Copy/adapted from decoder.h context flavor span_type option(bool* completed = NULLPTR); // FIX: temporary name until we decouple from legacy context/chunk style decoding. Once we finish that, // _streambuf suffix is dropped // NOTE: We may find existing Decoder::process_iterate is fully sufficient in its current form, so this // function is considered experimental // NOTE: This has a diverging behavior in that it's .hpp not .cpp, so we may be facing code bloat this way // Without analysis, unknown if this is a real, imagined, good or bad thing // NOTE: pos' days are numbered, only using this for compatibility with non streambuf decoder // TODO: Consider passing in streambuf also and moving this into Decoder base class bool process_iterate_streambuf(size_t& pos); bool process_iterate_streambuf() { #ifdef FEATURE_MCCOAP_EXPCONTEXT size_t& pos = context.pos; #else size_t pos = 0; // dummy value, phase out this call after EXPCONTEXT is gone #endif return process_iterate_streambuf(pos); } #ifdef FEATURE_CPP_VARIADIC template <class ...TArgs> StreambufDecoder( #ifdef FEATURE_MCCOAP_EXPCONTEXT size_type total_size, #endif TArgs&&... args) : streambuf(std::forward<TArgs>(args)...) #ifdef FEATURE_MCCOAP_EXPCONTEXT // FIX: in_avail() can come back with a '0' or '-1' , still need to address that // FIX: Need better assessment of 'last_chunk' ,context(estd::const_buffer( (const uint8_t*)streambuf.gptr(), streambuf.in_avail()), total_size <= streambuf.in_avail()), total_size_remaining(total_size) #endif {} #else template <class T1> StreambufDecoder(T1& arg1) : streambuf(arg1) { } #endif #ifdef FEATURE_CPP_MOVESEMANTIC StreambufDecoder(streambuf_type&& streambuf) : streambuf(std::move(streambuf)) {} #endif // istream-style streambuf_type* rdbuf() { return &streambuf; } // NOTE: might prefer instead to present entire encoder as a minimal // (non flaggable) basic_istream. Brings along some useful functionality // without adding any overhead istream_type istream() { return istream_type(streambuf); } #ifdef FEATURE_MCCOAP_EXPCONTEXT // evaluates incoming chunk up until the next state change OR end // of presented chunk, then stops // returns true when context.chunk is fully processed, even if it is not // the last_chunk. State may or may not change in this circumstance bool process_iterate() { bool end_reached = Decoder::process_iterate(context); if(end_reached) { // NOTE: expected pos is, at the end of a particular context, the same value // as egptr() - eback() // NOTE: We have to do these buffer gymnastics because streambufs don't deal in the // notion of absolute data input size, but the current decoder does, specifically // in the way it deals with 'last_chunk' (see comment on 'total_size_remaining') size_type chunk_size = context.pos; //size_type streambuf_chunk_size = streambuf.egptr() - streambuf.eback(); // do whatever trickery needed to push streambuf forward. If that is unsuccessful, // then we really do reach the end. Still need to decide if that's *really* the end // or if it's a non-blocking-maybe-more-data-is-coming scenario int_type ch = streambuf.underflow(); if(ch != traits_type::eof()) { total_size_remaining -= chunk_size; size_type in_avail = streambuf.in_avail(); // NOTE: A bit rule bending here to force a re-construction of context. Violates // the spirit of the const_buffer // FIX: Need better assessment of 'last_chunk' new (&context) internal::DecoderContext( estd::const_buffer( (const uint8_t*)streambuf.gptr(), in_avail), total_size_remaining <= in_avail); } } return false; } #endif }; }}
{ "content_hash": "72cc63d999b22d7526a3e2e398f05c9e", "timestamp": "", "source": "github", "line_count": 148, "max_line_length": 110, "avg_line_length": 40.763513513513516, "alnum_prop": 0.6535720205536217, "repo_name": "moducom/mc-coap", "id": "3732668c6258056c5713fbe65b5ec457ecd26d12", "size": "6153", "binary": false, "copies": "1", "ref": "refs/heads/dependabot/nuget/test/Tester.net/PeterO.Cbor-4.5.1", "path": "src/coap/decoder/streambuf.h", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "33905" }, { "name": "C#", "bytes": "14487" }, { "name": "C++", "bytes": "585798" }, { "name": "CMake", "bytes": "10057" }, { "name": "Makefile", "bytes": "1621" }, { "name": "Python", "bytes": "529" }, { "name": "Shell", "bytes": "690" } ], "symlink_target": "" }
Check your data against regual expressions. ## Usage Using the module is three step process: Install, Require, Use. 1) Install npm install isjs 2) Require var is = require('isjs'); 3) Use // Clever use : returns boolean value is('000-0000', 'phone:is') // Not as clever use : also returns boolean value is('000-0000', /\d{3}-\d{4}/) ## Get in touch Follow me on twitter [@rthor](http://twitter.com/rthor) or send me a line in an [email](mailto:[email protected]).
{ "content_hash": "71cf333ff91e4622bf783e05f8ea8592", "timestamp": "", "source": "github", "line_count": 25, "max_line_length": 112, "avg_line_length": 19.12, "alnum_prop": 0.6841004184100419, "repo_name": "rthor/isjs", "id": "520521976d55bbe13df3cdcbf63745d02a05b92b", "size": "487", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "nodejs/README.md", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "28097" } ], "symlink_target": "" }
declare module Kubernetes { }
{ "content_hash": "b32ea15596cfb68d66258ba07b92c3bf", "timestamp": "", "source": "github", "line_count": 2, "max_line_length": 27, "avg_line_length": 15, "alnum_prop": 0.7666666666666667, "repo_name": "NewlandNJRD/nl-hawtio-k8s", "id": "98805f9943e1c70072dcdd4566f89d1e6291a5cf", "size": "114", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "d.ts/kubernetes/ts/kubernetesSchema.d.ts", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "953516" }, { "name": "HTML", "bytes": "1050552" }, { "name": "JavaScript", "bytes": "8169713" }, { "name": "Makefile", "bytes": "208" }, { "name": "PowerShell", "bytes": "633" }, { "name": "Roff", "bytes": "2072" }, { "name": "Ruby", "bytes": "2785" }, { "name": "Shell", "bytes": "1021" }, { "name": "TypeScript", "bytes": "766713" } ], "symlink_target": "" }
/** * This code was auto-generated by a Codezu. * * Changes to this file may cause incorrect behavior and will be lost if * the code is regenerated. */ package com.mozu.api.resources.content.documentlists; import com.mozu.api.ApiContext; import java.util.List; import java.util.ArrayList; import com.mozu.api.MozuClient; import com.mozu.api.MozuClientFactory; import com.mozu.api.MozuUrl; import com.mozu.api.Headers; import com.mozu.api.AsyncCallback; import com.mozu.api.security.AuthTicket; import org.apache.commons.lang.StringUtils; import java.util.concurrent.CountDownLatch; /** <summary> * Use the facets subresource to allow a merchant to add information for product indexing and searching. * </summary> */ public class FacetResource { /// /// <see cref="Mozu.Api.ApiContext"/> /// private ApiContext _apiContext; public FacetResource(ApiContext apiContext) { _apiContext = apiContext; } /** * Retrieves the properties of facets that aid in indexing and searching. * <p><pre><code> * Facet facet = new Facet(); * Facet facet = facet.getFacets( documentListName, propertyName); * </code></pre></p> * @param documentListName Name of content documentListName to delete * @param propertyName The property name associated with the facets to retrieve. * @return List<com.mozu.api.contracts.content.Facet> * @see com.mozu.api.contracts.content.Facet */ public List<com.mozu.api.contracts.content.Facet> getFacets(String documentListName, String propertyName) throws Exception { MozuClient<List<com.mozu.api.contracts.content.Facet>> client = com.mozu.api.clients.content.documentlists.FacetClient.getFacetsClient( documentListName, propertyName); client.setContext(_apiContext); client.executeRequest(); return client.getResult(); } /** * Retrieves the properties of facets that aid in indexing and searching. * <p><pre><code> * Facet facet = new Facet(); * CountDownLatch latch = facet.getFacets( documentListName, propertyName, callback ); * latch.await() * </code></pre></p> * @param documentListName Name of content documentListName to delete * @param propertyName The property name associated with the facets to retrieve. * @param callback callback handler for asynchronous operations * @return List<com.mozu.api.contracts.content.Facet> * @see com.mozu.api.contracts.content.Facet */ public CountDownLatch getFacetsAsync(String documentListName, String propertyName, AsyncCallback<List<com.mozu.api.contracts.content.Facet>> callback) throws Exception { MozuClient<List<com.mozu.api.contracts.content.Facet>> client = com.mozu.api.clients.content.documentlists.FacetClient.getFacetsClient( documentListName, propertyName); client.setContext(_apiContext); return client.executeRequest(callback); } }
{ "content_hash": "a70a2595756f04b64d5d3e6120a35e72", "timestamp": "", "source": "github", "line_count": 81, "max_line_length": 171, "avg_line_length": 35.888888888888886, "alnum_prop": 0.7313381492948057, "repo_name": "johngatti/mozu-java", "id": "16297353ae0333b99051ef38f5c897a1b762dae9", "size": "2907", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "mozu-javaasync-core/src/main/java/com/mozu/api/resources/content/documentlists/FacetResource.java", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "102" }, { "name": "Java", "bytes": "10444263" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.apache.isis.example.application</groupId> <artifactId>simpleapp</artifactId> <version>1.9.0-SNAPSHOT</version> <name>Simple App</name> <packaging>pom</packaging> <prerequisites> <maven>3.0.4</maven> </prerequisites> <properties> <isis.version>1.9.0-SNAPSHOT</isis.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <assertj-core.version>2.0.0</assertj-core.version> </properties> <repositories> <repository> <id>apache.snapshots</id> <name>Apache Snapshots</name> <url>https://repository.apache.org/content/repositories/snapshots/</url> <releases> <enabled>false</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository> <repository> <id>Cloudbees snapshots</id> <url>http://repository-estatio.forge.cloudbees.com/snapshot/</url> <snapshots> <enabled>true</enabled> </snapshots> <releases> <enabled>false</enabled> </releases> </repository> </repositories> <build> <pluginManagement> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-enforcer-plugin</artifactId> <version>1.3.1</version> <configuration> <rules> <requireMavenVersion> <version>[3.2.1,)</version> </requireMavenVersion> <requireJavaVersion> <version>[1.8.0,)</version> </requireJavaVersion> <requirePluginVersions> <message>All plugin versions must be defined!</message> <banLatest>true</banLatest> <banRelease>true</banRelease> </requirePluginVersions> <DependencyConvergence /> </rules> </configuration> <executions> <execution> <id>validate-enforce</id> <phase>validate</phase> <goals> <goal>enforce</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration> <source>1.8</source> <target>1.8</target> <compilerArgument>-parameters</compilerArgument> </configuration> <executions> <execution> <id>source</id> <phase>compile</phase> </execution> <execution> <id>test</id> <phase>test-compile</phase> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.16</version> <configuration> <includes> <include>**/*Test.java</include> <include>**/*Test$*.java</include> <include>**/*Test_*.java</include> <include>**/*Spec*.java</include> </includes> <excludes> <exclude>**/Test*.java</exclude> <exclude>**/*ForTesting.java</exclude> <exclude>**/*Abstract*.java</exclude> </excludes> <useFile>true</useFile> <printSummary>true</printSummary> <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-report-plugin</artifactId> <version>2.16</version> <configuration> <showSuccess>false</showSuccess> </configuration> <executions> <execution> <phase>test</phase> </execution> </executions> </plugin> <plugin> <artifactId>maven-clean-plugin</artifactId> <version>2.5</version> </plugin> <plugin> <artifactId>maven-resources-plugin</artifactId> <version>2.6</version> </plugin> <plugin> <artifactId>maven-jar-plugin</artifactId> <version>2.4</version> </plugin> <plugin> <artifactId>maven-install-plugin</artifactId> <version>2.5.1</version> </plugin> <plugin> <artifactId>maven-deploy-plugin</artifactId> <version>2.8.1</version> </plugin> <plugin> <artifactId>maven-site-plugin</artifactId> <version>3.3</version> </plugin> <plugin> <artifactId>maven-war-plugin</artifactId> <version>2.4</version> </plugin> <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>maven-jetty-plugin</artifactId> <version>6.1.26</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>2.2</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> <version>1.7</version> <executions> <execution> <goals> <goal>run</goal> </goals> </execution> </executions> </plugin> <!-- http://simplericity.com/2009/11/10/1257880778509.html --> <plugin> <groupId>org.simplericity.jettyconsole</groupId> <artifactId>jetty-console-maven-plugin</artifactId> <version>1.56</version> </plugin> <!-- Apache Release Audit Tool --> <plugin> <groupId>org.apache.rat</groupId> <artifactId>apache-rat-plugin</artifactId> <version>0.10</version> <configuration> <addDefaultLicenseMatchers>true</addDefaultLicenseMatchers> <excludeSubProjects>true</excludeSubProjects> <excludes> <exclude>**/target/**</exclude> <exclude>**/target-ide/**</exclude> <exclude>**/*.project</exclude> <exclude>**/.classpath</exclude> <exclude>**/.settings/**</exclude> <exclude>**/*.launch</exclude> <exclude>**/ide/eclipse/launch/**</exclude> <exclude>**/ide/intellij/launch/**</exclude> <exclude>src/site/resources/ide/eclipse/**</exclude> <exclude>**/rebel.xml</exclude> <exclude>**/*.gitignore</exclude> <exclude>**/*.log</exclude> <exclude>**/*.pdn</exclude> <exclude>**/*.svg</exclude> <exclude>**/*.json</exclude> <exclude>**/*.min.js</exclude> <exclude>**/*.js</exclude> <exclude>**/translations.pot</exclude> <exclude>**/translations*.po</exclude> </excludes> <licenses> <license implementation="org.apache.rat.analysis.license.SimplePatternBasedLicense"> <licenseFamilyCategory>AL2</licenseFamilyCategory> <licenseFamilyName>Apache License 2.0</licenseFamilyName> <notes/> <patterns> <pattern>Licensed to the Apache Software Foundation (ASF) under one</pattern> </patterns> </license> <license implementation="org.apache.rat.analysis.license.SimplePatternBasedLicense"> <licenseFamilyCategory>JQRY</licenseFamilyCategory> <licenseFamilyName>MIT</licenseFamilyName> <notes/> <patterns> <pattern>Dual licensed under the MIT or GPL Version 2 licenses.</pattern> </patterns> </license> <license implementation="org.apache.rat.analysis.license.SimplePatternBasedLicense"> <licenseFamilyCategory>JMOCK</licenseFamilyCategory> <licenseFamilyName>JMock</licenseFamilyName> <notes/> <patterns> <pattern>Copyright (c) 2000-2007, jMock.org</pattern> </patterns> </license> <license implementation="org.apache.rat.analysis.license.SimplePatternBasedLicense"> <licenseFamilyCategory>DOCBK</licenseFamilyCategory> <licenseFamilyName>DocBook 4.5</licenseFamilyName> <notes/> <patterns> <pattern>Permission to copy in any form is granted for use</pattern> <pattern>Permission to use, copy, modify and distribute the DocBook DTD</pattern> <pattern>is hereby granted in perpetuity, provided that the above copyright </pattern> <pattern>This is the catalog data file for DocBook XML V4.5. It is provided as </pattern> <pattern>XML Catalog data for DocBook XML V4.5</pattern> <pattern>DocBook additional general entities V4.5</pattern> <pattern>XML EXCHANGE TABLE MODEL DECLARATION MODULE</pattern> </patterns> </license> <license implementation="org.apache.rat.analysis.license.SimplePatternBasedLicense"> <licenseFamilyCategory>W3C</licenseFamilyCategory> <licenseFamilyName>XHTML</licenseFamilyName> <notes/> <patterns> <pattern>Copyright (c) 1998-2002 W3C (MIT, INRIA, Keio),</pattern> </patterns> </license> </licenses> <licenseFamilies> <licenseFamily implementation="org.apache.rat.license.SimpleLicenseFamily"> <familyName>Apache License 2.0</familyName> </licenseFamily> <licenseFamily implementation="org.apache.rat.license.SimpleLicenseFamily"> <familyName>MIT</familyName> </licenseFamily> <licenseFamily implementation="org.apache.rat.license.SimpleLicenseFamily"> <familyName>JMock</familyName> </licenseFamily> <licenseFamily implementation="org.apache.rat.license.SimpleLicenseFamily"> <familyName>DocBook 4.5</familyName> </licenseFamily> <licenseFamily implementation="org.apache.rat.license.SimpleLicenseFamily"> <familyName>XHTML</familyName> </licenseFamily> </licenseFamilies> </configuration> </plugin> </plugins> </pluginManagement> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-report-plugin</artifactId> </plugin> </plugins> </build> <modules> <module>dom</module> <module>fixture</module> <module>integtests</module> <module>webapp</module> </modules> <dependencyManagement> <dependencies> <dependency> <groupId>org.apache.isis.core</groupId> <artifactId>isis</artifactId> <version>${isis.version}</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> <groupId>org.apache.isis.viewer</groupId> <artifactId>isis-viewer-wicket</artifactId> <version>${isis.version}</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> <groupId>org.assertj</groupId> <artifactId>assertj-core</artifactId> <version>${assertj-core.version}</version> </dependency> <!-- this project's own modules --> <dependency> <groupId>${project.groupId}</groupId> <artifactId>simpleapp-dom</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>${project.groupId}</groupId> <artifactId>simpleapp-fixture</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>${project.groupId}</groupId> <artifactId>simpleapp-webapp</artifactId> <version>${project.version}</version> </dependency> </dependencies> </dependencyManagement> <profiles> <profile> <id>m2e</id> <activation> <property> <name>m2e.version</name> </property> </activation> <build> <directory>target-ide</directory> </build> </profile> </profiles> </project>
{ "content_hash": "45d5e1b9919bad58f9d50e39a001c2cd", "timestamp": "", "source": "github", "line_count": 402, "max_line_length": 117, "avg_line_length": 44.330845771144276, "alnum_prop": 0.45283654115930644, "repo_name": "peridotperiod/isis", "id": "9c2442ddd052aa0df70667f89dde57c813dc58c3", "size": "17821", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "example/application/simpleapp/pom.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "169398" }, { "name": "Cucumber", "bytes": "8162" }, { "name": "Groovy", "bytes": "28126" }, { "name": "HTML", "bytes": "601123" }, { "name": "Java", "bytes": "18098201" }, { "name": "JavaScript", "bytes": "118425" }, { "name": "Shell", "bytes": "12793" }, { "name": "XSLT", "bytes": "72290" } ], "symlink_target": "" }
ACCEPTED #### According to International Plant Names Index #### Published in null #### Original name null ### Remarks null
{ "content_hash": "9ce266a5a33cca96895cde13db5aa605", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 31, "avg_line_length": 9.692307692307692, "alnum_prop": 0.7063492063492064, "repo_name": "mdoering/backbone", "id": "a45fdb03bc092ce4489923ce0d09797b5334851c", "size": "178", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Liliopsida/Alismatales/Potamogetonaceae/Potamogeton/Potamogeton preussii/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
import cross3d from cross3d.studiomax.studiomaxscenelayer import StudiomaxSceneLayer class StudiomaxGroup(StudiomaxSceneLayer): ''' Since Max does not have a native group object that fit our need, we are exposing layers instead. For your information, native groups in Max are a way to contain a bunch of object under a single transform. ''' pass # register the symbol cross3d.registerSymbol('Group', StudiomaxGroup)
{ "content_hash": "8c75070e7b243bb67758b5d7726b2320", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 109, "avg_line_length": 29.533333333333335, "alnum_prop": 0.7652370203160271, "repo_name": "blurstudio/cross3d", "id": "9efb28a00a5bd29d21bb63f2dec3f85c3cdbc56a", "size": "624", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "cross3d/studiomax/studiomaxgroup.py", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "46" }, { "name": "MAXScript", "bytes": "17640" }, { "name": "Python", "bytes": "1023336" } ], "symlink_target": "" }
package net.sparkeek.farmdroptest.tests.mock; import net.sparkeek.farmdroptest.ApplicationAndroidStarter; import net.sparkeek.farmdroptest.di.modules.ModuleContext; import net.sparkeek.farmdroptest.DaggerApplicationAndroidStarterComponent; import net.sparkeek.farmdroptest.di.modules.ModuleAsync; import net.sparkeek.farmdroptest.di.modules.ModuleBus; import net.sparkeek.farmdroptest.di.modules.ModuleEnvironment; public class MockApplication extends ApplicationAndroidStarter { //region Fields private ModuleBus mModuleBus; private MockModuleRest mModuleRest; private ModuleEnvironment mModuleEnvironment; //endregion //region Singleton protected static MockApplication sSharedMockApplication; public static MockApplication sharedMockApplication() { return sSharedMockApplication; } //endregion //region Lifecycle @Override public void onCreate() { super.onCreate(); sSharedMockApplication = this; } //endregion //region Overridden method @Override protected void buildComponent() { mModuleBus = new ModuleBus(); mModuleRest = new MockModuleRest(); mModuleEnvironment = new MockModuleEnvironment(); mComponentApplication = DaggerApplicationAndroidStarterComponent.builder() .moduleAsync(new ModuleAsync()) .moduleBus(mModuleBus) .moduleContext(new ModuleContext(getApplicationContext())) .moduleDatabase(new MockModuleDatabase()) .moduleEnvironment(mModuleEnvironment) .moduleRest(mModuleRest) .build(); } //endregion //region Getters public MockModuleRest getModuleRest() { return mModuleRest; } public ModuleBus getModuleBus() { return mModuleBus; } public ModuleEnvironment getModuleEnvironment() { return mModuleEnvironment; } //endregion }
{ "content_hash": "5d6791c6cd7fbab99e064eb714f71d5b", "timestamp": "", "source": "github", "line_count": 66, "max_line_length": 82, "avg_line_length": 29.742424242424242, "alnum_prop": 0.7040244523688233, "repo_name": "adrienrx/fd-test-mvp", "id": "8ee77a932b90f323f267db55435d18668482e438", "size": "1963", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/src/androidTest/java/net/sparkeek/farmdroptest/tests/mock/MockApplication.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "100715" }, { "name": "Shell", "bytes": "1074" } ], "symlink_target": "" }
rmas_pm_adapter Package ======================= :mod:`pm_api` Module -------------------- .. automodule:: rmas_pm_adapter.pm_api :members: :undoc-members: :show-inheritance: :mod:`runner` Module -------------------- .. automodule:: rmas_pm_adapter.runner :members: :undoc-members: :show-inheritance: :mod:`settings` Module ---------------------- .. automodule:: rmas_pm_adapter.settings :members: :undoc-members: :show-inheritance: Subpackages ----------- .. toctree:: rmas_pm_adapter.dev rmas_pm_adapter.handlers
{ "content_hash": "09e2a31855aec9b09acf75a81e2a952e", "timestamp": "", "source": "github", "line_count": 35, "max_line_length": 40, "avg_line_length": 16.228571428571428, "alnum_prop": 0.5475352112676056, "repo_name": "UoK-Psychology/rmas_pm_adapter", "id": "ce937e61ea829f74b6922502ad7b11ae89edfb50", "size": "568", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "docs/api/rmas_pm_adapter.rst", "mode": "33188", "license": "mit", "language": [ { "name": "Python", "bytes": "14154" } ], "symlink_target": "" }
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <title>MPL Interoperability</title> <link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.77.1"> <link rel="home" href="../index.html" title="Chapter&#160;1.&#160;Boost.TypeTraits"> <link rel="up" href="../index.html" title="Chapter&#160;1.&#160;Boost.TypeTraits"> <link rel="prev" href="intrinsics.html" title="Support for Compiler Intrinsics"> <link rel="next" href="examples.html" title="Examples"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table cellpadding="2" width="100%"><tr> <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td> <td align="center"><a href="../../../../../index.html">Home</a></td> <td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td> <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> <td align="center"><a href="../../../../../more/index.htm">More</a></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="intrinsics.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="examples.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a> </div> <div class="section boost_typetraits_mpl"> <div class="titlepage"><div><div><h2 class="title" style="clear: both"> <a name="boost_typetraits.mpl"></a><a class="link" href="mpl.html" title="MPL Interoperability">MPL Interoperability</a> </h2></div></div></div> <p> All the value based traits in this library conform to MPL's requirements for an <a href="../../../../../libs/mpl/doc/refmanual/integral-constant.html" target="_top">Integral Constant type</a>: that includes a number of rather intrusive workarounds for broken compilers. </p> <p> Purely as an implementation detail, this means that <code class="computeroutput"><a class="link" href="reference/integral_constant.html" title="integral_constant">true_type</a></code> inherits from <a href="../../../../../libs/mpl/doc/refmanual/bool.html" target="_top"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">true_</span></code></a>, <code class="computeroutput"><a class="link" href="reference/integral_constant.html" title="integral_constant">false_type</a></code> inherits from <a href="../../../../../libs/mpl/doc/refmanual/bool.html" target="_top"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">false_</span></code></a>, and <code class="computeroutput"><a class="link" href="reference/integral_constant.html" title="integral_constant">integral_constant</a><span class="special">&lt;</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">v</span><span class="special">&gt;</span></code> inherits from <a href="../../../../../libs/mpl/doc/refmanual/integral-c.html" target="_top"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">integral_c</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">,</span><span class="identifier">v</span><span class="special">&gt;</span></code></a> (provided <code class="computeroutput"><span class="identifier">T</span></code> is not <code class="computeroutput"><span class="keyword">bool</span></code>) </p> </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> <td align="left"></td> <td align="right"><div class="copyright-footer">Copyright &#169; 2000, 2011 Adobe Systems Inc, David Abrahams, Frederic Bron, Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones, Mat Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen, Roman Perepelitsa, Robert Ramey, Jeremy Siek, Robert Stewart and Steven Watanabe<p> Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) </p> </div></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="intrinsics.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="examples.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a> </div> </body> </html>
{ "content_hash": "8166148e8478340dc5353bc60426b896", "timestamp": "", "source": "github", "line_count": 63, "max_line_length": 476, "avg_line_length": 85.38095238095238, "alnum_prop": 0.6573712585982525, "repo_name": "Krugercoin/krugercoins", "id": "d171e28e93c54379370912454f44e0a8dda512be", "size": "5379", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "BuildDeps/deps/boost/libs/type_traits/doc/html/boost_typetraits/mpl.html", "mode": "33188", "license": "mit", "language": [ { "name": "ASP", "bytes": "21289" }, { "name": "Assembly", "bytes": "956955" }, { "name": "Awk", "bytes": "89654" }, { "name": "C", "bytes": "23442146" }, { "name": "C#", "bytes": "1801043" }, { "name": "C++", "bytes": "127633009" }, { "name": "CSS", "bytes": "391998" }, { "name": "DOT", "bytes": "27186" }, { "name": "Emacs Lisp", "bytes": "1639" }, { "name": "FORTRAN", "bytes": "1387" }, { "name": "IDL", "bytes": "14533" }, { "name": "Java", "bytes": "4131730" }, { "name": "JavaScript", "bytes": "209934" }, { "name": "Max", "bytes": "36857" }, { "name": "Objective-C", "bytes": "27715" }, { "name": "PHP", "bytes": "60328" }, { "name": "Perl", "bytes": "4110742" }, { "name": "Python", "bytes": "651396" }, { "name": "R", "bytes": "4363" }, { "name": "Scheme", "bytes": "4249" }, { "name": "Shell", "bytes": "461438" }, { "name": "Tcl", "bytes": "2574990" }, { "name": "TeX", "bytes": "13404" }, { "name": "TypeScript", "bytes": "3810608" }, { "name": "XSLT", "bytes": "760331" }, { "name": "eC", "bytes": "5079" } ], "symlink_target": "" }
from weaver.lib.engine import *
{ "content_hash": "8901f7c58ff5a017da71b69ee392672f", "timestamp": "", "source": "github", "line_count": 1, "max_line_length": 31, "avg_line_length": 31, "alnum_prop": 0.8064516129032258, "repo_name": "ethanwhite/weaver", "id": "63b7ce565b73f7e632ed4a21eca949d06d1b69c3", "size": "31", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "lib/models.py", "mode": "33188", "license": "mit", "language": [ { "name": "Python", "bytes": "58341" } ], "symlink_target": "" }
/**************************************************************************** ** ** GENERATED BY SOHAG DEVELOPER FOR POSTGRESQL ** Visit Us: http://sohag-developer.com/ ** ****************************************************************************/ #include "employees.h" #include "ui_employees.h" #include <QSqlQuery> #include <QSqlError> Employees::Employees(QWidget *parent) : QWidget(parent), ui(new Ui::Employees) { ui->setupUi(this); } Employees::~Employees() { delete ui; } void Employees::clear() { ui->employee_id->clear(); ui->employee_name->clear(); ui->gender->clear(); ui->birth_date->clear(); } QVariant Employees::toVarinat(QString string) { if (string.isEmpty()){ return QVariant(); } return QVariant(string); } QString Employees::toString(QVariant value) { int valueType=value.type(); if(value.isNull()){ return QString(); }else if(valueType==QMetaType::Int){ return QString::number(value.toInt()); }else if(valueType==QMetaType::UInt){ return QString::number(value.toUInt()); }else if(valueType==QMetaType::Double){ return QString::number(value.toDouble()); }else if(valueType==QMetaType::Long){ return QString::number(value.toLongLong()); }else if(valueType==QMetaType::LongLong){ return QString::number(value.toLongLong()); }else if(valueType==QMetaType::Short){ return QString::number(value.toInt()); }else if(valueType==QMetaType::ULong){ return QString::number(value.toULongLong()); }else if(valueType==QMetaType::ULongLong){ return QString::number(value.toULongLong()); }else if(valueType==QMetaType::UShort){ return QString::number(value.toUInt()); }else if(valueType==QMetaType::Float){ return QString::number(value.toFloat()); } return value.toString(); } bool Employees::insert() { QSqlQuery query; query.prepare("insert into public.employees(employee_id,employee_name,gender,birth_date) values (?,?,?,?)"); query.addBindValue(toVarinat(ui->employee_id->text())); query.addBindValue(toVarinat(ui->employee_name->text())); query.addBindValue(toVarinat(ui->gender->text())); query.addBindValue(toVarinat(ui->birth_date->text())); query.exec(); if(query.lastError().isValid()){ return false; } return true; } bool Employees::update() { QSqlQuery query; query.prepare("UPDATE public.employees SET employee_id=?,employee_name=?,gender=?,birth_date=? WHERE employee_id=?"); query.addBindValue(toVarinat(ui->employee_id->text())); query.addBindValue(toVarinat(ui->employee_name->text())); query.addBindValue(toVarinat(ui->gender->text())); query.addBindValue(toVarinat(ui->birth_date->text())); query.addBindValue(ui->employee_id->text()); query.exec(); if(query.lastError().isValid()){ return false; } return true; } bool Employees::remove() { QSqlQuery query; query.prepare("delete from public.employees WHERE employee_id=?"); query.addBindValue(ui->employee_id->text()); query.exec(); if(query.lastError().isValid()){ return false; } return true; } bool Employees::query() { QSqlQuery query; query.prepare("select employee_id,employee_name,gender,birth_date from public.employees WHERE employee_id=?"); query.addBindValue(ui->employee_id->text()); query.exec(); if(query.lastError().isValid()){ return false; } query.first(); ui->employee_id->setText(toString(query.value(0))); ui->employee_name->setText(toString(query.value(1))); ui->gender->setText(toString(query.value(2))); ui->birth_date->setText(toString(query.value(3))); return true; }
{ "content_hash": "fe3072b35790ca117119640553a6f8b7", "timestamp": "", "source": "github", "line_count": 151, "max_line_length": 121, "avg_line_length": 24.71523178807947, "alnum_prop": 0.632636655948553, "repo_name": "amr2027/Qt-PostgreSQL-Database-Example-Sohag-Developer-", "id": "46fb4bd75eda75f94cde759d05a67de6feed3a64", "size": "3732", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "basic-template/employees.cpp", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "C++", "bytes": "4882" }, { "name": "QMake", "bytes": "712" } ], "symlink_target": "" }
layout: post title: That which is to be, already has been date: '2008-10-07T10:05:00.004-05:00' author: Jabell tags: - Will of God - Calvinism - Sovereignty modified_time: '2008-10-07T10:12:27.550-05:00' blogger_id: tag:blogger.com,1999:blog-19739956.post-1394021628445367185 blogger_orig_url: http://theabellsix.blogspot.com/2008/10/that-which-is-to-be-already-has-been.html --- I realize that there is a lot more going on in Ecclesiastes than meets the eye. Is there one writer or two? Is it Solomon or not?<br /><br />Yet, there are nuggets of truth in Ecclesiastes that are beyond profound and require serious thought. So many of the arguments of our day wrestle around the doctrine of God's sovereignty. I have believed in God's absolute sovereignty for years now, and while I still wrestle with the ramifications of that belief, I find it very comforting.<br /><br />Here is a nugget from Ecclesiastes that is worth our time pondering:<br /><br />Ecclesiastes 3:14-15: I perceived that whatever God does endures forever; nothing can be added to it, nor anything taken from it. God has done it, so that people fear before him. 15 That which is, already has been; that which is to be, already has been; and God seeks what has been driven away.
{ "content_hash": "b6b3aaa56ef603514acfda5f8ccc1cf4", "timestamp": "", "source": "github", "line_count": 14, "max_line_length": 872, "avg_line_length": 89.5, "alnum_prop": 0.7669592976855547, "repo_name": "jasabell/jasabell.github.io", "id": "3e35691959e076283ab134a725e74d714cfc5b0a", "size": "1257", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "_posts/2008-10-07-that-which-is-to-be-already-has-been.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "82293" }, { "name": "HTML", "bytes": "811001" }, { "name": "Ruby", "bytes": "23296" }, { "name": "Shell", "bytes": "317" } ], "symlink_target": "" }
module Code import Creature import Creature.f16 import Config import Config.@if_test import Config.@if_not_test import Helper include("CodeMacros.jl") include("CodeOrganism.jl") include("CodeMath.jl") export CodePart export CODE_PARTS # # Command functions. Amount of these functions will be increased # as many Julia language parts i'm going to support... # export var export fn export fnCall export condition export loop # # Public functions # export onRemoveLine export getRandPos # # Describes one code block like "if", "for", "function" and so on. # Is used for mutations of organism's AST. Contains function and # block flag. Function is used for obtaining new block expression # (Expr type). isBlock flag is used for changing and removing AST. # type CodePart fn::Function isBlock::Bool end # # @cmd # @line # Returns AST expression for assigning Float16 constant to variable. Format: # var_xx::Float16 = value # @param cfg Global configuration type # @param org Organism we have to mutate # @param pos Position for current mutation # @return {Expr|Expr(:nothing)} # function var(cfg::Config.ConfigData, org::Creature.Organism, pos::Helper.CodePos) :($(@randVar())=$(Helper.fRand())) end # # @cmd # @block # Creates custom function with unique name, random arguments with # default values. By default it returns first argument as local # variable. Format: function func_xx(var_xx::Float16,...) return var_xx end # @param cfg Global configuration type # @param org Organism we are working with # @param pos Code position # @return {Expr} # function fn(cfg::Config.ConfigData, org::Creature.Organism, pos::Helper.CodePos) local typ::DataType local i::Int local j::Int local exp::Expr @if_test local paramLen::Int = Helper.fastRand(1) @if_not_test local paramLen::Int = Helper.fastRand(cfg.codeFuncParamAmount) local block::Creature.Block = Creature.Block(Helper.getTypesMap(), Expr(:nothing), Creature.VAR_AMOUNT - paramLen) local blocks::Array{Creature.Block, 1} = [block] # # New function parameters in format: [name::Type=val,...]. # At least one parameter should exist. We use codeFuncParamAmount # config for amount of parameters. Here a small hack. :(=) symbol # switched by :kw. I don't know why, but it doesn't work # without this... # local params::Array{Expr, 1} = [ (exp = :($(@var(i))::$(f16)=$(Helper.fRand()));exp.head=:kw;exp) for i=1:paramLen ] # # New function in format: function func_x(var_x::Type=val,...) return var_x end # All parameters will be added as local variables. # local fnEx::Expr = :(function $(Symbol(@newFunc(org)))($(params...)) end) # # This property means that we haven't add mutations # before this line number, because we produce undefined # variable/function error. # org.funcs[pos.fnIdx].blocks[pos.blockIdx].defIndex += 1 block.expr = fnEx.args[2] # # This line fixes Julia small issue with additional comment line, # which is added during new function creation. We have to remove # this comment line (head === :line) to prevent incorrect org.codeSize # calculation. # _removeCommentLine(block.expr.args) _addDefaultVars(block, paramLen + 1) push!(block.expr.args, :(return $(@randVar()))) push!(org.funcs, Creature.Func(fnEx, blocks)) fnEx end # # @cmd # @line # Calls custom function or do nothing if no available functions. # It choose custom function from org.funcs array, fills parameters # and call it. It also creates new variable with appropriate type. # Example: var_xx = func_xx(var_xx::Float16,...) # @param cfg Global configuration type # @param org Organism we are working with # @param pos Code position # @return {Expr|Expr(:nothing)} # function fnCall(cfg::Config.ConfigData, org::Creature.Organism, pos::Helper.CodePos) local nothingEx::Expr = Expr(:nothing) local funcsLen::Int = length(org.funcs) if funcsLen < 2 return nothingEx end local fnEx::Expr = org.funcs[Helper.fastRand(funcsLen-1)+1].code # only custom function may be called local var::Symbol = @randVar() # var = <fn-name>(...) if var === :nothing return nothingEx end local args::Array{Any, 1} = fnEx.args[1].args # shortcut to func args local types::Array{DataType, 1} = Array{DataType, 1}() # func types only local argsLen::Int = length(args) local badParams::Bool = false if argsLen > 1 # # We start from 2, because first argument is a function symbol # for i = 2:(Helper.fastRand(argsLen-1)+1) push!(types, args[i].args[1].args[2]) end end fnEx = :($var=$(fnEx.args[1].args[1])($([(ex = @randVar(); if ex === :nothing badParams = true end;ex) for i in types]...))) if badParams return nothingEx end # # Pushing of new variable should be after function call to prevent # error of calling function with argument of just created variable # push!(@getVars(org, pos)[f16], var) fnEx end # # @cmd # @block # if operator implementation. It contains block inside, so it can't be inside # other block. For example, it can't be inside body of "for" operator. Format: # if var_xx compare_op var_xx end # @param cfg Global configuration type # @param org Organism we are working with # @param pos Code position # @return {Expr|Expr(:nothing)} # function condition(cfg::Config.ConfigData, org::Creature.Organism, pos::Helper.CodePos) local v1::Symbol = @randVar() if v1 === :nothing return Expr(:nothing) end local v2::Symbol = @randVar() local op::Symbol = _COMPARE_OPERATORS[Helper.fastRand(length(_COMPARE_OPERATORS))] local ifEx = :(if $(op)($(v1),$(v2)) end) # if v1 comparison v2 end # # This line fixes Julia small issue with additional comment line, # which is added during new condition creation. We have to remove # this comment line (head === :line) to prevent incorrect org.codeSize # calculation. # _removeCommentLine(ifEx.args[2].args) # # According to julia specification variable inside if block # can't be local and should be used from outside block. In our # case it's a block of parent function. # push!(@getBlocks(org, pos), Creature.Block(org.funcs[pos.fnIdx].blocks[1].vars, ifEx.args[2])) ifEx end # # @cmd # @block # Creates a for loop. We have to create small loops, because they # affect entire speed. See Config.codeLoopAmount for details # @param cfg Global configuration type. Format: for i::Int = 1:8 end # @param org Organism we are working with # @param pos Position in a code # @return {Expr} # function loop(cfg::Config.ConfigData, org::Creature.Organism, pos::Helper.CodePos) local loopEx = :(for i::Int = 1:$(cfg.codeLoopAmount) end) local block::Creature.Block # # This line fixes Julia small issue with additional comment line, # which is added during new loop creation. We have to remove # this comment line (head === :line) to prevent incorrect org.codeSize # calculation. # _removeCommentLine(loopEx.args[2].args) block = Creature.Block(org.funcs[pos.fnIdx].blocks[1].vars, loopEx.args[2]) push!(@getBlocks(org, pos), block) loopEx end # # This method is called before one code line is removed or changed. # It checks if removed/changed line is a local variable declaration # or function declaration. In this case it clears all related # structures like org.vars and org.funcs... # @param org Organism we are working with # @param pos Remove/Change position # function onRemoveLine(org::Creature.Organism, pos::Helper.CodePos) local blocks::Array{Creature.Block, 1} = org.funcs[pos.fnIdx].blocks local exp::Expr = blocks[pos.blockIdx].expr.args[pos.lineIdx] local lines::Array{Any, 1} local idx::Int local i::Int local bLen::Int # # This is function element. We have to sum amount of code # lines inside function + amount of code lines inside all # function blocks. This is how we calc codeSize of this. # function. # if exp.head === :function idx = findfirst((f::Creature.Func) -> f.code === exp, org.funcs) blocks = org.funcs[idx].blocks for i = 1:length(blocks) org.codeSize -= (length(blocks[i].expr.args) - Creature.VAR_AMOUNT) end org.codeSize += 1 # skip "return" org.funcs[1].blocks[1].defIndex -= 1 deleteat!(org.funcs, idx) # # This is block element, but not a function # elseif haskey(_CODE_PARTS_MAP, exp.head) lines = Helper.getLines(exp, _CODE_PARTS_MAP[exp.head]) idx = findfirst((b::Creature.Block) -> b.expr.args === lines, blocks) org.codeSize -= (length(lines) - (exp.head === :if ? 0 : Creature.VAR_AMOUNT)) deleteat!(blocks, idx) end end # # Returns random position in a code (including all custom # functions), where we have to insert/change/delete code # line. Position is chose randomly. It takes main function # and all custom functions together, choose one function # randomly and choose random block and position inside this # block. Every function contains return operator at the end. # So we have to skip it. # @param org Organism we are working with # @return {CodePos} Position in a code # function getRandPos(org::Creature.Organism, cfg::Config.ConfigData) local fnIdx ::Int = Helper.fastRand(length(org.funcs)) local blockIdx::Int = Helper.fastRand(length(org.funcs[fnIdx].blocks)) local block ::Creature.Block = org.funcs[fnIdx].blocks[blockIdx] local isFunc ::Bool = blockIdx === 1 local isMainFn::Bool = fnIdx === 1 local args ::Int = cfg.codeFuncParamAmount # # In this line we skip "return" operator and lines with variables # and functions declaration. # local lines ::Int = length(block.expr.args) - (isFunc ? (isMainFn ? Creature.VAR_AMOUNT : Creature.VAR_AMOUNT - args) + 1 : 0) Helper.CodePos( fnIdx, blockIdx, Helper.fastRand(lines) + (isFunc ? (isMainFn ? Creature.VAR_AMOUNT : Creature.VAR_AMOUNT - args) : 0) ) end # # Fills default variables meta data. Adds embedded vars at the # beginning of new function # @param block Block, where we have to insert default variables # function _addDefaultVars(block::Creature.Block, startIndex = 1) for j::Int in 1:(Creature.VAR_AMOUNT - startIndex + 1) push!(block.vars[f16], Symbol("var_", startIndex)) push!(block.expr.args, :(local $(Symbol("var_", startIndex))::f16=$(Helper.fRand()))) startIndex += 1 end end # # Removes comment line from code expression. Comment line is created # every time if block (quote...end) is created. We have to remove it, # because if affects aon amount of code lines, but does nothing. # @param args Code lines array # function _removeCommentLine(args::Array{Any, 1}) if length(args) > 0 && args[1].head === :line deleteat!(args, 1) end end # # This map contains only block symbols like: for, if, function,... # This map and _CODE_PARTS should be synchronized. # const _CODE_PARTS_MAP = Dict{Symbol, Array{Int, 1}}( :function => [2], :if => [2], :for => [2] ) # # Array of available functions. Each function should return Expr type. # They are used for generating (add,change) code of organisms. This # array can't be empty. # const CODE_PARTS = [ # # Code # CodePart(var, false), CodePart(fn, true ), CodePart(fnCall, false), CodePart(condition, true ), CodePart(loop, true ), # # CodeMath # CodePart(plus, false), CodePart(minus, false), CodePart(multiply, false), CodePart(divide, false), CodePart(reminder, false), CodePart(and, false), CodePart(or, false), CodePart(xor, false), CodePart(rshift, false), CodePart(lshift, false), CodePart(sqrt, false), CodePart(log, false), CodePart(sin, false), CodePart(cos, false), CodePart(tan, false), CodePart(cot, false), CodePart(sec, false), CodePart(csc, false), CodePart(not, false), CodePart(pi, false), # # CodeOrganism # CodePart(lookAt, false), CodePart(eatLeft, false), CodePart(eatRight, false), CodePart(eatUp, false), CodePart(eatDown, false), CodePart(stepLeft, false), CodePart(stepRight, false), CodePart(stepUp, false), CodePart(stepDown, false), CodePart(toMem, false), CodePart(fromMem, false), CodePart(myColor, false), # CodePart(idLeft, false), CodePart(idRight, false), # CodePart(idUp, false), CodePart(idDown, false), CodePart(myX, false), CodePart(myY, false), CodePart(energyLeft, false), CodePart(energyRight, false), CodePart(energyUp, false), CodePart(energyDown, false) # CodePart(codeSizeLeft, false), CodePart(codeSizeRight, false), # CodePart(codeSizeUp, false), CodePart(codeSizeDown, false), # CodePart(cloneEnergyPercentLeft, false), CodePart(cloneEnergyPercentRight, false), # CodePart(cloneEnergyPercentUp, false), CodePart(cloneEnergyPercentDown, false) ] # # Available comparison operators. May be used with "if" operator # const _COMPARE_OPERATORS = [:<, :>, :<=, :>=, :(==), :!=, :!==, :(===)] end
{ "content_hash": "6307a2efc231bc831745fcd98af53347", "timestamp": "", "source": "github", "line_count": 350, "max_line_length": 132, "avg_line_length": 41.39714285714286, "alnum_prop": 0.6200565946580164, "repo_name": "tmptrash/jevo", "id": "c959d243fbf22ca2faa8493df2d2d783375821b9", "size": "15219", "binary": false, "copies": "1", "ref": "refs/heads/Float64-optimization", "path": "src/organism/Code.jl", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "989" }, { "name": "Julia", "bytes": "7030918" }, { "name": "Shell", "bytes": "626" } ], "symlink_target": "" }
import { NgModule } from '@angular/core'; import { RouterModule } from '@angular/router'; import { SharedModule } from 'app/shared'; import { NoticeModule } from 'app/core/components/notice'; import { ConfigurationIconModule } from 'app/core/components/configuration-icon'; import { TransactionDetailContentsModule } from 'app/core/components/transaction-detail-contents'; import { TransactionDetailPageComponent } from './transaction-detail-page.component'; import { routing } from './transaction-detail-page.routing'; import { ServerErrorPopupModule } from 'app/core/components/server-error-popup'; import { SideNavigationBarModule } from 'app/core/components/side-navigation-bar'; @NgModule({ declarations: [ TransactionDetailPageComponent ], imports: [ SharedModule, NoticeModule, ConfigurationIconModule, TransactionDetailContentsModule, ServerErrorPopupModule, SideNavigationBarModule, RouterModule.forChild(routing) ], exports: [], providers: [] }) export class TransactionDetailPageModule {}
{ "content_hash": "66dcab7332ebd6cc6513f0a9e8f8fad2", "timestamp": "", "source": "github", "line_count": 29, "max_line_length": 98, "avg_line_length": 37.58620689655172, "alnum_prop": 0.7321100917431193, "repo_name": "koo-taejin/pinpoint", "id": "da0841323446b3af30f8a261a0c3f83bd3ebc72f", "size": "1090", "binary": false, "copies": "5", "ref": "refs/heads/master", "path": "web/src/main/angular/src/app/routes/transaction-detail-page/index.ts", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "200" }, { "name": "CSS", "bytes": "204717" }, { "name": "Groovy", "bytes": "1423" }, { "name": "HTML", "bytes": "194029" }, { "name": "Java", "bytes": "19043787" }, { "name": "JavaScript", "bytes": "5724" }, { "name": "Kotlin", "bytes": "1327" }, { "name": "Shell", "bytes": "6420" }, { "name": "TSQL", "bytes": "978" }, { "name": "Thrift", "bytes": "15920" }, { "name": "TypeScript", "bytes": "1622425" } ], "symlink_target": "" }
/* * Creado por SharpDevelop. * Usuario: valle * Fecha: 24/08/2009 * Hora: 23:47 * * Para cambiar esta plantilla use Herramientas | Opciones | Codificación | Editar Encabezados Estándar */ using System; using System.IO; using System.Runtime.Serialization.Formatters.Binary; using Valle.SqlGestion; using Valle.SqlUtilidades; namespace Valle.ToolsTpv { /// <summary> /// Description of CrearBaseDatos. /// </summary> public class CrearBaseDatos { //toda las tablas de al base de datos ordenadas segun claves externas para la correcta inportacion y exportacion public String[] listaTodasLasTablas = new string[]{"Familias","Colores","Controles","Favoritos", "Secciones","Articulos", "Teclas","VentaPorKilos","ArticuloNoVenta", "DesgloseArt","TPVs","Camareros", "InstComision", "Configuracion","Rutas", "Zonas","Mesas", "ZonasTpv","FavoritosTpv","TeclasFav","SeccionesTpv","Ticket", "CierreDeCaja", "ResComision", "LineasTicket", "Usuarios","Privilegios","SuperUsuario", "Almacen", "Inventarios", "GestionMesas","Rondas", "LineasNulas", "LineasRonda","Sincronizados"}; string nomBaseDatos = ""; public CrearBaseDatos(IGesSql gestorSql, string nomBase, string dirSquemas) { if(gestorSql is GesMySQL){ nomBaseDatos = nomBase; GesMySQL gesL = (GesMySQL)gestorSql; gesL.CrearBaseDatos(nomBaseDatos); Console.WriteLine(dirSquemas); FileStream f = new FileStream(dirSquemas,FileMode.Open,FileAccess.Read); Console.WriteLine(dirSquemas); BinaryFormatter biForm = new BinaryFormatter(); InfEsquemas infEsq = (InfEsquemas)biForm.Deserialize(f); f.Close(); foreach(string tabla in listaTodasLasTablas){ CrearTabla(tabla,infEsq.ExtraerExquema(tabla),gesL); } } } void CrearTabla(string tabla, Esquema esq, GesMySQL gesLocal){ foreach (ClaveExt cl in esq.clavesExt){ cl.BaseDatos = nomBaseDatos; } string strCrearTabla = esq.StrCrearTabla().Replace("money","decimal"); strCrearTabla = strCrearTabla.Replace("bit","TINYINT(1)"); strCrearTabla = strCrearTabla.Replace(",,",","); strCrearTabla = strCrearTabla + " TYPE = InnoDB"; Console.WriteLine(strCrearTabla); gesLocal.EjConsultaNoSelect(tabla,strCrearTabla,nomBaseDatos); } } }
{ "content_hash": "52a95886c3420b06cc5df91b7d7ac104", "timestamp": "", "source": "github", "line_count": 67, "max_line_length": 135, "avg_line_length": 39.76119402985075, "alnum_prop": 0.6122372372372372, "repo_name": "vallemrv/valletpv", "id": "44552a89310e82f3506fd4085f7c0bc96c161706", "size": "2666", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Valle.Tpv0.2/Valle.ToolsTpv/CrearBaseDatos.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C#", "bytes": "2658843" }, { "name": "Makefile", "bytes": "72170" }, { "name": "Shell", "bytes": "69" } ], "symlink_target": "" }
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace BizHawk.Client.EmuHawk { public partial class MobileDetailView : Form { public MobileDetailView() { InitializeComponent(); } public BmpView BmpView { get { return bmpView1; } } [Browsable(false)] public bool ShouldDraw { get { return this.Visible; } } public override string ToString() { return Text; } public void SetDetails(IList<Tuple<string, string>> details) { listView1.Items.Clear(); foreach (var t in details) { listView1.Items.Add(new ListViewItem(new string[] { t.Item1, t.Item2 })); } } private void MobileDetailView_SizeChanged(object sender, EventArgs e) { // bmp view is always square tableLayoutPanel1.RowStyles[0].Height = ClientSize.Width; } private void listView1_SizeChanged(object sender, EventArgs e) { listView1.Columns[0].Width = listView1.Width / 2; listView1.Columns[1].Width = listView1.Width / 2; } } }
{ "content_hash": "cccfc2f7fc5a8236f650320518730fb7", "timestamp": "", "source": "github", "line_count": 50, "max_line_length": 77, "avg_line_length": 22.1, "alnum_prop": 0.7104072398190046, "repo_name": "ircluzar/RTC3", "id": "818a36b706c6654f3c14b8c73edee63596f17d13", "size": "1107", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "Real-Time Corruptor/BizHawk_RTC/BizHawk.Client.EmuHawk/tools/GBA/MobileDetailView.cs", "mode": "33188", "license": "mit", "language": [ { "name": "Assembly", "bytes": "77250" }, { "name": "Batchfile", "bytes": "11077" }, { "name": "C", "bytes": "10464062" }, { "name": "C#", "bytes": "14062504" }, { "name": "C++", "bytes": "15252473" }, { "name": "CSS", "bytes": "74" }, { "name": "GLSL", "bytes": "6610" }, { "name": "HTML", "bytes": "426873" }, { "name": "Limbo", "bytes": "15313" }, { "name": "Lua", "bytes": "312676" }, { "name": "Makefile", "bytes": "127427" }, { "name": "Objective-C", "bytes": "40789" }, { "name": "PHP", "bytes": "863004" }, { "name": "POV-Ray SDL", "bytes": "206" }, { "name": "Python", "bytes": "27842" }, { "name": "Shell", "bytes": "19693" }, { "name": "Smalltalk", "bytes": "1719" } ], "symlink_target": "" }
<?php namespace RIPS\Test\Requests\System; use RIPS\Connector\Requests\Quota\AclRequests; use RIPS\Connector\Requests\System\LdapRequests; use RIPS\Test\TestCase; use GuzzleHttp\Handler\MockHandler; use GuzzleHttp\Psr7\Response; use GuzzleHttp\Middleware; class LdapRequestsTest extends TestCase { /** @var LdapRequests */ protected $ldapRequests; protected function setUp() { parent::setUp(); $history = Middleware::history($this->container); $this->stack->push($history); $this->stack->setHandler(new MockHandler([ new Response(200, ['x-header' => 'header-content'], '{"key": "value"}'), ])); $this->ldapRequests = new LdapRequests($this->client); } /** * @test */ public function get() { $response = $this->ldapRequests->get(); /** @var \GuzzleHttp\Psr7\Request $request */ $request = $this->container[0]['request']; $this->assertEquals('GET', $request->getMethod()); $this->assertEquals('/systems/ldap', $request->getUri()->getPath()); $this->assertEquals('value', $response->getDecodedData()->key); } /** * @test */ public function update() { $response = $this->ldapRequests->update(['test' => 'input']); /** @var \GuzzleHttp\Psr7\Request $request */ $request = $this->container[0]['request']; $body = urldecode($request->getBody()->getContents()); $this->assertEquals('PUT', $request->getMethod()); $this->assertEquals('/systems/ldap', $request->getUri()->getPath()); $this->assertEquals('{"ldap":{"test":"input"}}', $body); $this->assertEquals('value', $response->getDecodedData()->key); } /** * @test */ public function sync() { $this->ldapRequests->sync(); /** @var \GuzzleHttp\Psr7\Request $request */ $request = $this->container[0]['request']; $this->assertEquals('POST', $request->getMethod()); $this->assertEquals('/systems/ldap/sync', $request->getUri()->getPath()); } }
{ "content_hash": "b303701c8855f1a4c203f331b55d32d1", "timestamp": "", "source": "github", "line_count": 72, "max_line_length": 84, "avg_line_length": 29.26388888888889, "alnum_prop": 0.5866160417655434, "repo_name": "rips/php-connector", "id": "60b45fd71544f0df17d6ec280c467d6a07ba39da", "size": "2107", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "test/Requests/System/LdapRequestsTest.php", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "PHP", "bytes": "396304" } ], "symlink_target": "" }
layout: page title: About --- Hi, I'm Simon. Find me on [Instagram](https://www.instagram.com/shellmayr) and [Facebook](https://www.facebook.com/s.hellmayr).
{ "content_hash": "14a9746f84416bfa6f2008230efa26f9", "timestamp": "", "source": "github", "line_count": 6, "max_line_length": 113, "avg_line_length": 26.833333333333332, "alnum_prop": 0.7080745341614907, "repo_name": "shellmayr/shellmayr.github.io", "id": "d3ca77a3748a144ae3539009aea00d7aa7ae7711", "size": "165", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "about.md", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "11558" }, { "name": "HTML", "bytes": "3602" } ], "symlink_target": "" }
package net.npe.webaudio; public enum ChannelCountMode { /** max */ MAX("max"), /** clamped-max */ CLAMPED_MAX("clamped-max"), /** explicit */ EXPLICIT("explicit"); public String toString() { return name; } private ChannelCountMode(String name) { this.name = name; } private String name; }
{ "content_hash": "77055f1e282661e8a46713b56e69b380", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 40, "avg_line_length": 13.25, "alnum_prop": 0.6352201257861635, "repo_name": "npedotnet/GwtAudio", "id": "d21679c3ca6a82d1406af58111199159030d326d", "size": "645", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/net/npe/webaudio/ChannelCountMode.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "50242" } ], "symlink_target": "" }
package jp.hazuki.yuzubrowser.legacy.utils; import android.content.Context; import android.util.TypedValue; import androidx.annotation.AttrRes; import androidx.annotation.ColorInt; import androidx.core.content.res.ResourcesCompat; public final class ThemeUtils { public static int getIdFromThemeRes(Context context, @AttrRes int id) { TypedValue outValue = new TypedValue(); context.getTheme().resolveAttribute(id, outValue, true); return outValue.resourceId; } @ColorInt public static int getColorFromThemeRes(Context context, @AttrRes int id) { return ResourcesCompat.getColor(context.getResources(), getIdFromThemeRes(context, id), context.getTheme()); } }
{ "content_hash": "8188c5a8d59f1d614e4d8f26a086d759", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 116, "avg_line_length": 29.958333333333332, "alnum_prop": 0.7496522948539638, "repo_name": "hazuki0x0/YuzuBrowser", "id": "f4ce61de103b2b570efb88224dd016947ead53bb", "size": "1312", "binary": false, "copies": "1", "ref": "refs/heads/dev", "path": "legacy/src/main/java/jp/hazuki/yuzubrowser/legacy/utils/ThemeUtils.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "4743" }, { "name": "HTML", "bytes": "45256" }, { "name": "Java", "bytes": "699958" }, { "name": "JavaScript", "bytes": "2994" }, { "name": "Kotlin", "bytes": "2164362" } ], "symlink_target": "" }
multiplication ============== Multiplication training script for elementary school (grades 3-4). Well, every parent probably knows that elementary schools want their students to learn the multiplication table. In 3rd grade, students are required to solve 100 mutiplication problems in 5 minutes. In 4th grade, the time constraint goes down to 3 minutes, which is not really possible without daily training. I was lookuing for some kind of an application that is capable of doing the time trial, but to no avail. Also, almost all training software is missing vitally important statistics - how many problems were answered, how many of them incorrectly, which problems took the longest to solve. As a result, I wrote this simple python script that does exacttly this, end even sends the statistics to me over the email (so I always know about my daughter's progress). Right now, the scrip supports mutiplication and division, and has 4 modes of operation: - Simple training (time and errors are counted, but time limits are not enforced, and student can make multiple errors) - Precision training (the trial stops after first mistake) - Time trial (time limit is enforced) - SPARTA mode (time trial + precision) The script relies on several python modules: - smtplib and MIMEText, for sending the statistics over the email; - enum (or enum34, for python 2.x) - sorry, I cannot use a language without enums. Sending stats over email is disabled by defult, go ahead and correct enable it by editing multiplication.config file (I moved it to a separate file to simplify the updates). Enjoy, and good luck. --Anatoly.
{ "content_hash": "fc27b6e3572b2d3f502fec12dc6fac3e", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 181, "avg_line_length": 57.92857142857143, "alnum_prop": 0.782983970406905, "repo_name": "iAnatoly/multiplication", "id": "957d5dc675e5b4377727ee5bff34bfe6a4a1e72a", "size": "1622", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Python", "bytes": "19578" } ], "symlink_target": "" }
"""Export methods that will soon move into this module.""" # pylint: disable=g-multiple-import # pylint: disable=unused-import from seqio.dataset_providers import ( get_mixture_or_task, get_subtasks, get_dataset, )
{ "content_hash": "794bf444f24399568c9398adf624997c", "timestamp": "", "source": "github", "line_count": 8, "max_line_length": 58, "avg_line_length": 28.375, "alnum_prop": 0.7224669603524229, "repo_name": "google/seqio", "id": "f6514b3792cfe5d0c7c73238de20e84aa6214796", "size": "810", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "seqio/dataset_providers_helpers.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Jupyter Notebook", "bytes": "41898" }, { "name": "Python", "bytes": "679734" } ], "symlink_target": "" }
Copyright 2015 SoftwareBrothers Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
{ "content_hash": "66682bb4742e7371b6b90a7ff54d646b", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 70, "avg_line_length": 52.8, "alnum_prop": 0.8096590909090909, "repo_name": "rstgroup/rails_admin_rst_theme", "id": "85bc0bdfe56f6835fd8e80af42e383be389eda76", "size": "1056", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "LICENSE.md", "mode": "33188", "license": "mit", "language": [ { "name": "Ruby", "bytes": "1893" } ], "symlink_target": "" }
package leap.lang.collection; import java.util.List; /** * A {@link List} wraps the immutable view of itself. */ public interface ImvList<E> extends List<E> { /** * Returns the immutable view of itself. */ List<E> getImmutableView(); }
{ "content_hash": "b04874267c535e2613677a417b8d9cf5", "timestamp": "", "source": "github", "line_count": 16, "max_line_length": 53, "avg_line_length": 16.25, "alnum_prop": 0.6461538461538462, "repo_name": "leapframework/framework", "id": "e22111efe46ea1fa9208410efad65061374106fd", "size": "875", "binary": false, "copies": "1", "ref": "refs/heads/dev", "path": "base/lang/src/main/java/leap/lang/collection/ImvList.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "355" }, { "name": "HTML", "bytes": "645766" }, { "name": "Java", "bytes": "13020209" }, { "name": "JavaScript", "bytes": "167" }, { "name": "PLSQL", "bytes": "30834" }, { "name": "Shell", "bytes": "66" } ], "symlink_target": "" }
using System; using Entitas; using UnityEditor; namespace Entitas.Unity.VisualDebugging { public class IntTypeDrawer : ITypeDrawer { public bool HandlesType(Type type) { return type == typeof(int); } public object DrawAndGetNewValue(Type memberType, string memberName, object value, Entity entity, int index, IComponent component) { return EditorGUILayout.IntField(memberName, (int)value); } } }
{ "content_hash": "7b15f7047523f41badb1ff425f99affb", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 140, "avg_line_length": 30.8, "alnum_prop": 0.6818181818181818, "repo_name": "Saytiras/Game-Prototypes", "id": "ceb1ed04ebf935a9b5582d3902cf7f88dfef5c79", "size": "462", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "Eiskrieg/Assets/Libraries/Entitas/Unity/VisualDebugging/Entity/Editor/TypeDrawer/IntTypeDrawer.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "210" } ], "symlink_target": "" }
int main(int argc, char * argv[]) { @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); } }
{ "content_hash": "32017c48693e76d1c364dd446b276d1f", "timestamp": "", "source": "github", "line_count": 5, "max_line_length": 90, "avg_line_length": 31.6, "alnum_prop": 0.6582278481012658, "repo_name": "Sergey-Lomov/WCCircularSlider", "id": "047c04e6e31fd6e32a1eb424cb705dc1ff78280e", "size": "355", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "Example/main.m", "mode": "33188", "license": "mit", "language": [ { "name": "Objective-C", "bytes": "9293" }, { "name": "Ruby", "bytes": "5997" } ], "symlink_target": "" }
/* * This file contains the parser for the configuration routines. It's used * both in the kernel and in the user interface program, thus the separate file. */ /* * Go through a text and split up into text tokens. These are either non-blank * sequences, or any sequence (except \0) enclosed in ' or ". Embedded ' or * " characters may be escaped by \, which otherwise has no special meaning. * * Delimit by following with a \0, and return pointers to the starts at token []. * Return the number of tokens found as the return value. * * This method has the restriction that a closing " or ' must be followed by * grey space. * * Error conditions are end of line before end of quote, or no space after * a closing quote. In this case, tokenize() returns -1. */ #include <sys/param.h> #include <dev/vinum/vinumkw.h> #ifdef _KERNEL #include <sys/systm.h> #include <sys/conf.h> #include <machine/setjmp.h> /* All this mess for a single struct definition */ #include <sys/uio.h> #include <sys/namei.h> #include <sys/mount.h> #include <dev/vinum/vinumvar.h> #include <dev/vinum/vinumio.h> #include <dev/vinum/vinumext.h> #define iswhite(c) ((c == ' ') || (c == '\t')) /* check for white space */ #else /* userland */ #include <ctype.h> #include <errno.h> #include <fcntl.h> #define iswhite isspace /* use the ctype macro */ #endif /* enum keyword is defined in vinumvar.h */ #define keypair(x) { #x, kw_##x } /* create pair "foo", kw_foo */ #define flagkeypair(x) { "-"#x, kw_##x } /* create pair "-foo", kw_foo */ #define KEYWORDSET(x) {sizeof (x) / sizeof (struct _keywords), x} /* Normal keywords. These are all the words that vinum knows. */ struct _keywords keywords[] = {keypair(drive), keypair(partition), keypair(sd), keypair(subdisk), keypair(plex), keypair(volume), keypair(vol), keypair(setupstate), keypair(readpol), keypair(org), keypair(name), keypair(writethrough), keypair(writeback), keypair(raw), keypair(device), keypair(concat), keypair(raid4), keypair(raid5), keypair(striped), keypair(plexoffset), keypair(driveoffset), keypair(length), keypair(len), keypair(size), keypair(state), keypair(round), keypair(prefer), keypair(rename), keypair(detached), #ifndef _KERNEL /* for vinum(8) only */ #ifdef VINUMDEBUG keypair(debug), #endif keypair(stripe), keypair(mirror), #endif keypair(attach), keypair(detach), keypair(printconfig), keypair(saveconfig), keypair(replace), keypair(create), keypair(read), keypair(modify), keypair(list), keypair(l), keypair(ld), keypair(ls), keypair(lp), keypair(lv), keypair(info), keypair(set), keypair(rm), keypair(mv), keypair(move), keypair(init), keypair(label), keypair(resetconfig), keypair(start), keypair(stop), keypair(makedev), keypair(help), keypair(quit), keypair(setdaemon), keypair(getdaemon), keypair(max), keypair(replace), keypair(readpol), keypair(resetstats), keypair(setstate), keypair(checkparity), keypair(rebuildparity), keypair(dumpconfig), keypair(retryerrors) }; struct keywordset keyword_set = KEYWORDSET(keywords); #ifndef _KERNEL struct _keywords flag_keywords[] = {flagkeypair(f), flagkeypair(d), flagkeypair(v), flagkeypair(s), flagkeypair(r), flagkeypair(w) }; struct keywordset flag_set = KEYWORDSET(flag_keywords); #endif /* * Take a blank separated list of tokens and turn it into a list of * individual nul-delimited strings. Build a list of pointers at * token, which must have enough space for the tokens. Return the * number of tokens, or -1 on error (typically a missing string * delimiter). */ int tokenize(char *cptr, char *token[], int maxtoken) { char delim; /* delimiter for searching for the partner */ int tokennr; /* index of this token */ for (tokennr = 0; tokennr < maxtoken;) { while (iswhite(*cptr)) cptr++; /* skip initial white space */ if ((*cptr == '\0') || (*cptr == '\n') || (*cptr == '#')) /* end of line */ return tokennr; /* return number of tokens found */ delim = *cptr; token[tokennr] = cptr; /* point to it */ tokennr++; /* one more */ if (tokennr == maxtoken) /* run off the end? */ return tokennr; if ((delim == '\'') || (delim == '"')) { /* delimitered */ for (;;) { cptr++; if ((*cptr == delim) && (cptr[-1] != '\\')) { /* found the partner */ cptr++; /* move on past */ if (!iswhite(*cptr)) /* error, no space after closing quote */ return -1; *cptr++ = '\0'; /* delimit */ } else if ((*cptr == '\0') || (*cptr == '\n')) /* end of line */ return -1; } } else { /* not quoted */ while ((*cptr != '\0') && (!iswhite(*cptr)) && (*cptr != '\n')) cptr++; if (*cptr != '\0') /* not end of the line, */ *cptr++ = '\0'; /* delimit and move to the next */ } } return maxtoken; /* can't get here */ } /* Find a keyword and return an index */ enum keyword get_keyword(char *name, struct keywordset *keywordset) { int i; struct _keywords *keywords = keywordset->k; /* point to the keywords */ if (name != NULL) { /* parameter exists */ for (i = 0; i < keywordset->size; i++) if (!strcmp(name, keywords[i].name)) return (enum keyword) keywords[i].keyword; } return kw_invalid_keyword; }
{ "content_hash": "57d27715698f79ace5dd7c6a0e3ace55", "timestamp": "", "source": "github", "line_count": 199, "max_line_length": 81, "avg_line_length": 28.175879396984925, "alnum_prop": 0.6078116639914393, "repo_name": "MarginC/kame", "id": "837aa86d56b4e9c3178f9f5f59f978c956e77046", "size": "7606", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "freebsd5/sys/dev/vinum/vinumparser.c", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Arc", "bytes": "7491" }, { "name": "Assembly", "bytes": "14375563" }, { "name": "Awk", "bytes": "313712" }, { "name": "Batchfile", "bytes": "6819" }, { "name": "C", "bytes": "356715789" }, { "name": "C++", "bytes": "4231647" }, { "name": "DIGITAL Command Language", "bytes": "11155" }, { "name": "Emacs Lisp", "bytes": "790" }, { "name": "Forth", "bytes": "253695" }, { "name": "GAP", "bytes": "9964" }, { "name": "Groff", "bytes": "2220485" }, { "name": "Lex", "bytes": "168376" }, { "name": "Logos", "bytes": "570213" }, { "name": "Makefile", "bytes": "1778847" }, { "name": "Mathematica", "bytes": "16549" }, { "name": "Objective-C", "bytes": "529629" }, { "name": "PHP", "bytes": "11283" }, { "name": "Perl", "bytes": "151251" }, { "name": "Perl6", "bytes": "2572" }, { "name": "Ruby", "bytes": "7283" }, { "name": "Scheme", "bytes": "76872" }, { "name": "Shell", "bytes": "583253" }, { "name": "Stata", "bytes": "408" }, { "name": "Yacc", "bytes": "606054" } ], "symlink_target": "" }
@interface UIImage (Statistic) @end
{ "content_hash": "c262244aad635d0d8561c5d0a05dfd0e", "timestamp": "", "source": "github", "line_count": 3, "max_line_length": 30, "avg_line_length": 12.333333333333334, "alnum_prop": 0.7567567567567568, "repo_name": "DuRofei/SDK-RFStatistics", "id": "9e81239389713a2bbc823076ff249796c1e4c09f", "size": "214", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "RFStatistics/RFStatistics/Statistics/RFStatistics/Categorys/UIImage+Statistic.h", "mode": "33188", "license": "mit", "language": [ { "name": "Objective-C", "bytes": "296046" }, { "name": "Ruby", "bytes": "6179" } ], "symlink_target": "" }
package co.edu.udea.cmovil.gr5.twiiteryamba_compmov_lab01; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
{ "content_hash": "21cca37765df0c1288d394c534e6fa76", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 93, "avg_line_length": 29.23076923076923, "alnum_prop": 0.7552631578947369, "repo_name": "Sergir10/Computacion_Movil", "id": "1aa860f927c3c3db4d96a94a2d6b239a64415fd9", "size": "380", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/src/androidTest/java/co/edu/udea/cmovil/gr5/twiiteryamba_compmov_lab01/ApplicationTest.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "3926" } ], "symlink_target": "" }
#import <Foundation/Foundation.h> #import "sqlite3.h" @interface UASQLite : NSObject { sqlite3 *_db; } @property (assign) NSInteger busyRetryTimeout; @property (copy) NSString *dbPath; - (id)initWithDBPath:(NSString *)aDBPath; - (BOOL)open:(NSString *)aDBPath; - (void)close; /*error info*/ - (NSString*)lastErrorMessage; - (NSInteger)lastErrorCode; /*query, select data*/ - (NSArray *)executeQuery:(NSString *)sql, ...; - (NSArray *)executeQuery:(NSString *)sql arguments:(NSArray *)args; /*update methods, update/insert/delete data*/ - (BOOL)executeUpdate:(NSString *)sql, ...; - (BOOL)executeUpdate:(NSString *)sql arguments:(NSArray *)args; /*transaction*/ - (BOOL)commit; - (BOOL)rollback; - (BOOL)beginTransaction; - (BOOL)beginDeferredTransaction; /*helper methods*/ - (BOOL)tableExists:(NSString*)tableName; - (BOOL)indexExists:(NSString*)indexName; @end
{ "content_hash": "68971684571e8dab16f3dcafeb5aa9d9", "timestamp": "", "source": "github", "line_count": 41, "max_line_length": 68, "avg_line_length": 21.463414634146343, "alnum_prop": 0.7102272727272727, "repo_name": "seth-hayward/authie", "id": "ee87763a4ae6f47d21c16d74ab631444ad424d33", "size": "2180", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "authie/authie/Airship/Common/UASQLite.h", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "55563" }, { "name": "C++", "bytes": "2869" }, { "name": "Objective-C", "bytes": "1035236" }, { "name": "Ruby", "bytes": "606" } ], "symlink_target": "" }
<?php /* This file will run all the database functions. It will not see you. */ // This gets the siteload.php from the includes directory. $_site = require_once(getenv("SITELOADNAME")); $S = new $_site->className($_site); // The $h object has information that is passed to the getPageTopBottom() function. $h->title = "Example4"; // The <title> $h->banner = "<h1>Example4</h1>"; // This is the banner. // Lets do some database stuff /* Here is the tarcker table's schema CREATE TABLE `tracker` ( `id` int NOT NULL AUTO_INCREMENT, `botAs` varchar(30) DEFAULT NULL, `site` varchar(25) DEFAULT NULL, `page` varchar(255) NOT NULL DEFAULT '', `finger` varchar(50) DEFAULT NULL, `nogeo` tinyint(1) DEFAULT NULL, `ip` varchar(40) DEFAULT NULL, `agent` text, `referer` varchar(255) DEFAULT '', `starttime` datetime DEFAULT NULL, `endtime` datetime DEFAULT NULL, `difftime` varchar(20) DEFAULT NULL, `isJavaScript` int DEFAULT '0', `lasttime` datetime DEFAULT NULL, PRIMARY KEY (`id`), KEY `site` (`site`), KEY `ip` (`ip`), KEY `lasttime` (`lasttime`), KEY `starttime` (`starttime`) ) ENGINE=MyISAM AUTO_INCREMENT=6315673 DEFAULT CHARSET=utf8mb3; */ // There is more information about the mysql functions at https://bartonlp.github.io/site-class/ or // in the docs directory. $sql = "select id, site, page, ip, lasttime from $S->masterdb.tracker where lasttime>=now() - interval 5 minute and site='Examples' order by lasttime"; $S->query($sql); while($row = $S->fetchrow('num')) { $rows .= "<tr>"; foreach($row as $v) { $rows .= "<td>$v</td>"; } $rows .= "</tr>"; } // Now here is an easier way using dbTables. // For more information on dbTables you can look at the source or the documentation in the docs // directory on on line at https://bartonlp.github.io/site-class/ $T = new dbTables($S); $tbl = $T->maketable($sql, ['attr'=>['id'=>'table1', 'border'=>'1']])[0]; [$top, $footer] = $S->getPageTopBottom($h, $b); echo <<<EOF $top <p>Here are some entries from the 'tracker' table for the last 5 minutes for the 'Examples' site.</p> <table border='1'> <thead> <tr><th>id</th><th>site</th><th>page</th><th>ip</th><th>lasttime</th></tr> </thead> <tbody> $rows </tbody> </table> <p>Same table but with dbTables</p> $tbl <hr> <a href="example1.php">Example1</a><br> <a href="example2.php">Example2</a><br> <a href="example3.php">Example3</a><br> <a href="example4.php">Example4</a><br> <a href="hi.php">Hi</a><br> <a href="phpinfo.php">PHPINFO</a> $footer EOF;
{ "content_hash": "b998e76f0d7eba9b3e1b786d4fd09c35", "timestamp": "", "source": "github", "line_count": 83, "max_line_length": 151, "avg_line_length": 30.313253012048193, "alnum_prop": 0.6629570747217806, "repo_name": "bartonlp/site-class", "id": "b3e0f37b771c66ce5586a4b3c64c466209abf74f", "size": "2516", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "examples/example4.php", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "2276" }, { "name": "HTML", "bytes": "569" }, { "name": "JavaScript", "bytes": "7602" }, { "name": "PHP", "bytes": "124614" }, { "name": "Shell", "bytes": "394" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>mathcomp-fingroup: Not compatible 👼</title> <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" /> <link href="../../../../../bootstrap.min.css" rel="stylesheet"> <link href="../../../../../bootstrap-custom.css" rel="stylesheet"> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <script src="../../../../../moment.min.js"></script> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <div class="container"> <div class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="../..">clean / released</a></li> <li class="active"><a href="">8.15.1 / mathcomp-fingroup - 1.11.0</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> mathcomp-fingroup <small> 1.11.0 <span class="label label-info">Not compatible 👼</span> </small> </h1> <p>📅 <em><script>document.write(moment("2022-05-30 04:18:43 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-05-30 04:18:43 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-threads base base-unix base conf-findutils 1 Virtual package relying on findutils conf-gmp 4 Virtual package relying on a GMP lib system installation coq 8.15.1 Formal proof management system dune 3.2.0 Fast, portable, and opinionated build system ocaml 4.14.0 The OCaml compiler (virtual package) ocaml-base-compiler 4.14.0 Official release 4.14.0 ocaml-config 2 OCaml Switch Configuration ocaml-options-vanilla 1 Ensure that OCaml is compiled with no special options enabled ocamlfind 1.9.3 A library manager for OCaml zarith 1.12 Implements arithmetic and logical operations over arbitrary-precision integers # opam file: opam-version: &quot;2.0&quot; maintainer: &quot;Mathematical Components &lt;[email protected]&gt;&quot; homepage: &quot;https://math-comp.github.io/&quot; bug-reports: &quot;https://github.com/math-comp/math-comp/issues&quot; dev-repo: &quot;git+https://github.com/math-comp/math-comp.git&quot; license: &quot;CECILL-B&quot; build: [ make &quot;-C&quot; &quot;mathcomp/fingroup&quot; &quot;-j&quot; &quot;%{jobs}%&quot; ] install: [ make &quot;-C&quot; &quot;mathcomp/fingroup&quot; &quot;install&quot; ] depends: [ &quot;coq-mathcomp-ssreflect&quot; { = version } ] tags: [ &quot;keyword:finite groups&quot; &quot;keyword:small scale reflection&quot; &quot;keyword:mathematical components&quot; &quot;keyword:odd order theorem&quot; &quot;logpath:mathcomp.fingroup&quot; ] authors: [ &quot;Jeremy Avigad &lt;&gt;&quot; &quot;Andrea Asperti &lt;&gt;&quot; &quot;Stephane Le Roux &lt;&gt;&quot; &quot;Yves Bertot &lt;&gt;&quot; &quot;Laurence Rideau &lt;&gt;&quot; &quot;Enrico Tassi &lt;&gt;&quot; &quot;Ioana Pasca &lt;&gt;&quot; &quot;Georges Gonthier &lt;&gt;&quot; &quot;Sidi Ould Biha &lt;&gt;&quot; &quot;Cyril Cohen &lt;&gt;&quot; &quot;Francois Garillot &lt;&gt;&quot; &quot;Alexey Solovyev &lt;&gt;&quot; &quot;Russell O&#39;Connor &lt;&gt;&quot; &quot;Laurent Théry &lt;&gt;&quot; &quot;Assia Mahboubi &lt;&gt;&quot; ] synopsis: &quot;Mathematical Components Library on finite groups&quot; description: &quot;&quot;&quot; This library contains definitions and theorems about finite groups, group quotients, group morphisms, group presentation, group action... &quot;&quot;&quot; url { src: &quot;https://github.com/math-comp/math-comp/archive/mathcomp-1.11.0.tar.gz&quot; checksum: &quot;sha256=b16108320f77d15dd19ecc5aad90775b576edfa50c971682a1a439f6d364fef6&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-mathcomp-fingroup.1.11.0 coq.8.15.1</code></dd> <dt>Return code</dt> <dd>5120</dd> <dt>Output</dt> <dd><pre>[NOTE] Package coq is already installed (current version is 8.15.1). The following dependencies couldn&#39;t be met: - coq-mathcomp-fingroup -&gt; coq-mathcomp-ssreflect = 1.11.0 -&gt; coq &lt; 8.13~ -&gt; ocaml &lt; 4.12 base of this switch (use `--unlock-base&#39; to force) No solution found, exiting </pre></dd> </dl> <p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-mathcomp-fingroup.1.11.0</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Install dependencies</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Install 🚀</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Installation size</h2> <p>No files were installed.</p> <h2>Uninstall 🧹</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Missing removes</dt> <dd> none </dd> <dt>Wrong removes</dt> <dd> none </dd> </dl> </div> </div> </div> <hr/> <div class="footer"> <p class="text-center"> Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣 </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
{ "content_hash": "c0537fcf082e2d68a0aa02a56a678efc", "timestamp": "", "source": "github", "line_count": 161, "max_line_length": 554, "avg_line_length": 47.83229813664596, "alnum_prop": 0.5612258148292429, "repo_name": "coq-bench/coq-bench.github.io", "id": "d4f975254393a52e92cc0c475fda5faf3017c84e", "size": "7727", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "clean/Linux-x86_64-4.14.0-2.0.10/released/8.15.1/mathcomp-fingroup/1.11.0.html", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
// ========================================================================== // DG.PlotView // // Author: William Finzer // // Copyright (c) 2014 by The Concord Consortium, Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ========================================================================== sc_require('components/graph_map_common/plot_layer'); /** @class DG.PlotView - The base class for a plot layer that appears in a graph. @extends DG.PlotLayer */ DG.PlotView = DG.PlotLayer.extend( /** @scope DG.PlotView.prototype */ { autoDestroyProperties: ['plottedCountAdorn', 'plottedValueAdorn'], /** * These two properties are used to determine point color when there are multiple plots in a graph */ plotIndex: 0, numPlots: 1, plotIndexDidChange: function () { // Keep my plotLayerNumber in synch this.set('plotLayerNumber', this.get('plotIndex')); }.observes('plotIndex'), /** @property { DG.AxisView} */ xAxisView: null, /** @property { DG.AxisView } */ yAxisView: null, /** * We can check the orientation of the yAxis. */ isUsingY2: function () { return this.getPath('yAxisView.orientation') === DG.GraphTypes.EOrientation.kVertical2; }.property(), isUsingY2DidChange: function () { this.notifyPropertyChange('isUsingY2'); }.observes('*yAxisView.orientation'), /** * Expected type of plotted elements */ plottedElementType: 'circle', /** Used to store point coordinates at the beginning of a configuration change. @property { Array of {cx:{Number}, cy:{Number}} } */ cachedPointCoordinates: null, /** * These are point coordinates that were gathered up from the plot before a configuration change @property { Array of {cx:{Number}, cy:{Number}} } */ transferredElementCoordinates: null, /** * Set to false if you have your own way of animating to a new state @property {Boolean} */ allowTransferAnimation: true, _areAdornmentsInitialized: false, /** @property {DG.FormulaTextEditView} */ plottedValueEditView: null, /** @property {DG.PlottedCountAdornment} */ plottedCountAdorn: null, /** * Used by both dot plot and scatter plot * @property {DG.PlottedValueAdornment} */ plottedValueAdorn: null, /** Prepare dependencies. */ init: function () { sc_super(); }, destroy: function () { this.removePlottedValueEditView(); sc_super(); }, removePlottedValueEditView: function () { if (this.plottedValueEditView) { this.plottedValueEditView.removeFromParent(); this.plottedValueEditView.destroy(); this.plottedValueEditView = null; } }, /** * Subclasses may override to set certain axis view properties for their purpose. */ setupAxes: function () { }, /** * Gives plot a chance to return descriptions of axis views * @return {[{}]} */ getAxisViewDescriptions: function () { return []; }, /** Observer function called when the axis bounds change. */ axisBoundsDidChange: function () { this._isRenderingValid = false; this.displayDidChange(); }.observes('xAxisView.model.lowerBound', 'xAxisView.model.upperBound', 'yAxisView.model.lowerBound', 'yAxisView.model.upperBound', '.model.axisBounds'), /** Invalidate and update adornments shared by all plot types */ updateAdornments: function () { var tCountAdornModel = this.plottedCountAdorn && this.plottedCountAdorn.get('model'); if (tCountAdornModel) { // update counts if present this.plottedCountAdorn.get('model').setComputingNeeded(); this.plottedCountAdorn.updateToModel(); } var tPlottedValueAdorn = this.get('plottedValueAdorn'); if (tPlottedValueAdorn) { tPlottedValueAdorn.updateToModel(); } }, rescaleOnParentCaseCompletion: function (iCases) { var caseCount = iCases && iCases.length, lastCase = caseCount && iCases[caseCount - 1], lastCaseID = lastCase && lastCase.get('id'), openParentCaseID = this.getPath('model.openParentCaseID'); if (!SC.none(lastCaseID) && (lastCaseID === openParentCaseID)) { var plot = this.get('model'); if (plot && plot.rescaleAxesFromData) { plot.rescaleAxesFromData(false /* don't allow scale shrinkage */, false /* don't animate points */); } this.setPath('model.openParentCaseID', null); } }, /** Initialize the adornments from the set of adornment models. */ initializeAdornments: function () { /* TODO: for historical reasons, the implementation of the plotted count * adornment is different from other adornments. it's state is managed * separately. Should be unified. */ this.plottedCountChanged(); var model = this.get('model'), adornmentModels = model && model._adornmentModels; DG.ObjectMap.forEach(adornmentModels, function (iAdornmentKey, iAdornmentModel) { model.notifyPropertyChange(iAdornmentKey); }); this._areAdornmentsInitialized = true; }, /** * * @param iIndex Index of this plot view in array of plotviews owned by graph * @param iNumPlots Number of plotviews owned by graph */ doDraw: function doDraw(iIndex, iNumPlots) { if (!SC.none(iIndex)) { this.set('plotIndex', iIndex); this.set('numPlots', iNumPlots); } if (!this._areAdornmentsInitialized) { this.initializeAdornments(); } else { this.updateAdornments(); } // The following seemed necessary at one point, but has since caused problems. // We leave it commented in because we may discover situations in which it _is_ necessary. // if( this.getPath('model.isAnimating')) { // In some situations we get both animation and transferred points coordinates. The first is sufficient // this.set('transferredElementCoordinates', null); // } }, /** For use in transferring current element positions of this plot to a new plot about to take its place. @return {[{cx:{Number}, cy:{Number}, r: {Number}, fill: {String} ]} */ getElementPositionsInParentFrame: function () { var tFrame = this.get('frame'), tPlottedElements = this.get('plottedElements'); DG.assert(tPlottedElements.length === 0 || tPlottedElements[0][0].constructor !== SVGRectElement, 'Expecting circle, not rect'); return tPlottedElements.map(function (iElement) { var tRadius = (iElement.isHidden() ? 0 : iElement.attr('r')); // use r:0 as proxy for hidden plot element return { cx: iElement.attr('cx') + tFrame.x, cy: iElement.attr('cy') + tFrame.y, r: tRadius, fill: iElement.attr('fill'), type: 'circle' }; }); }, /** * Returns 'transferredElementCoordinates' converted to view coordinates. */ getTransferredElementsViewCoords: function () { var coords = this.get('transferredElementCoordinates'), frame = this.get('frame'); if (coords && frame) { coords.forEach(function (iPoint, iIndex) { // adjust old coordinates from parent frame to this view // assign x/y and cx/cy to support animating to rects or circles if (iPoint.cx != null) iPoint.cx -= frame.x; if (iPoint.cy != null) iPoint.cy -= frame.y; if (iPoint.x != null) iPoint.x -= frame.x; if (iPoint.y != null) iPoint.y -= frame.y; }); } return coords; }, /** * Called from animateFromTransferredElements to create animatable elements. * @param {DG.Case} iCase * @param {number} iIndex * @param {Object} iOldEltAttrs */ createAnimatingElement: function (iCase, iIndex, iOldEltAttrs) { var tElement = this.callCreateElement(iCase, iIndex, false); iOldEltAttrs && tElement.attr(iOldEltAttrs); return tElement; }, /** Called when this view is taking over from another one in order to animate points from their previous position to their new position. Handles 3 types of animations: (a) one-to-many animation for moving from parent to corresponding child case(s) (b) many-to-one animation for moving from child case(s) to corresponding parent case (c) one-to-one animation for moving within a collection (this is default). */ animateFromTransferredElements: function () { var tCases = this.getPath('model.cases'), tRC = this.createRenderContext(), tOldPointAttrs = this.getTransferredElementsViewCoords(), tOldElementType = tOldPointAttrs.length > 0 && tOldPointAttrs[0].type, tNewPointAttrs = [], // used if many-to-one animation tNewToOldCaseMap = [], tOldToNewCaseMap = []; // During undo/redo we can get here without cases. Bail! if (!tCases || !tRC) return; function caseLocationSimple(iIndex) { // assume a 1 to 1 correspondence of the current case indices to the new cases return tOldPointAttrs[iIndex]; } function caseLocationViaMap(iIndex) { // use our case index map to go from current case index to previous case index return tOldPointAttrs[tNewToOldCaseMap[iIndex]]; } this._getTransferredElementsToCasesMap(tNewToOldCaseMap, tOldToNewCaseMap); this.set('transferredElementCoordinates', null); var hasElementMap = tNewToOldCaseMap.length > 0, hasVanishingElements = tOldToNewCaseMap.length > 0, getCaseCurrentLocation = (hasElementMap ? caseLocationViaMap : caseLocationSimple), tHaveInstalledCallback = false; this._elementOrderIsValid = false; DG.sounds.playMixup(); this.prepareToResetCoordinates(); if (tOldElementType !== this.get('plottedElementType')) { this.removePlottedElements(true); // one would think that removePlottedElements() would obviate the need for this, but no this.get('plottedElements').forEach(function (iElement) { iElement.remove(); }); this.get('plottedElements').length = 0; } var eachCaseFunc = function (iCase, iIndex, iIsLast) { // Because this function is called during an invokeLater, it can happen that // since the time the loop was initiated, the plotview has been destroyed! if (this.isDestroyed) return; // create new circles, animating from old coordinates where possible var tPt = getCaseCurrentLocation(iIndex), tAnimate = false, tCallBack; this.createAnimatingElement(iCase, iIndex, tPt); if (!SC.none(tPt)) { tAnimate = true; if (iIsLast) { tCallBack = function () { this.setPath('model.isAnimating', false); // Allow standard draw // Draw once more because it can happen that a graph layout has happened since we computed // point coordinates this.drawData(); }.bind(this); } } // setCircleCoordinate returns null if coordinates are not valid tPt = this.setCircleCoordinate(tRC, iCase, iIndex, tAnimate, tCallBack); if (tPt && tCallBack) { tHaveInstalledCallback = true; } if (hasVanishingElements) { tNewPointAttrs.push(tPt); } return this.getPath('model.isAnimating'); }.bind(this), finallyFunc = function () { if (!tHaveInstalledCallback) this.setPath('model.isAnimating', false); if (hasVanishingElements) { // create a vanishing element for each old point that needs one (used if many-to-one animation) tOldPointAttrs.forEach(function (iOldAttrs, iIndex) { var tNewIndex = tOldToNewCaseMap[iIndex], tNewAttrs = tNewPointAttrs[tNewIndex]; if (SC.none(tNewIndex) || SC.none(tNewAttrs) || (iOldAttrs.r === 0)) return; // no vanishing element, if (1) element persists or (2) new circle hidden or (3) old circle hidden this.vanishPlottedElement(iOldAttrs, tNewAttrs); }); } this.notifyPropertyChange('plotDisplayDidChange'); }.bind(this); this.setPath('model.isAnimating', true); // So plot's standard draw won't wipe out animation tCases.forEachWithInvokeLater(eachCaseFunc, finallyFunc); }, /** * Get a map from the current (new) case index to the index of the transferred point coordinates (old case), * and vise versa, if and only if we are animating from many cases to fewer cases, or vise versa. * Used to handle special case animations, when switching from parent to child collection or back, * where cases appear to get split or joined. If neither array is populated, the caller can assume * a 1 to 1 case index mapping. * @param iNewToOldCaseMap {[]} empty Array, or array of index values, one for each (new) case. * @param iOldToNewCaseMap {[]} empty Array, or array of index values, one for each (old) transferred point coordinate. */ _getTransferredElementsToCasesMap: function (iNewToOldCaseMap, iOldToNewCaseMap) { var tTransferredPoints = this.get('transferredElementCoordinates'), tCases = this.getPath('model.cases'), tCollectionClient = this.getPath('model.collectionClient'), tChildCollectionClient = this.getPath('model.dataContext.childCollection'), tParentCollectionClient = this.getPath('model.dataContext.parentCollection'), tParentNumCases = tParentCollectionClient ? tParentCollectionClient.getCaseCount() : 0, tChildNumCases = tChildCollectionClient ? tChildCollectionClient.getCaseCount() : 0, tNewNumCases = tCases ? tCases.get('length') : 0, tOldNumCases = tTransferredPoints.length; function isParentToChildTransformation() { // TODO this function needs improvement. Returns true even if not changing collections, if number of cases happens to match parent-to-child transform. return (tParentCollectionClient && (tParentNumCases === tOldNumCases) && // TODO: fix this bad assumption, better to check collection id saved with old cases instead (tCollectionClient && tCollectionClient.isDescendantOf(tParentCollectionClient))); } function isChildToParentTransformation() { // TODO this function needs improvement. Returns true even if not changing collections, if number of cases happens to match child-to-parent transform. return (tChildCollectionClient && (tChildNumCases === tOldNumCases) && // TODO: fix this bad assumption, better to check collection id saved with old cases instead (tCollectionClient && tCollectionClient.isAncestorOf(tChildCollectionClient))); } function getParentCaseNumChildren(iCaseIndex) { // return the number of children of the given case in the parent collection var tParentCase = tParentCollectionClient.getCaseAt(iCaseIndex), tParentCaseChildren = tParentCase && tParentCase.get('children'); if (tParentCaseChildren) { tParentCaseChildren = tParentCaseChildren.filter(function (iCase) { return tCases.indexOf(iCase) >= 0; }); return tParentCaseChildren.get('length'); } else return 0; } function getParentToChildTransformation(iNewToOld, iOldToNew) { // fill iNewToOld[] with child case index to parent case index mapping // because typically many child cases will want location of the same shared parent case for animation var tOldIndex, tNewIndex, tNumChildren; for (tOldIndex = 0; tOldIndex < tOldNumCases; ++tOldIndex) { tNumChildren = getParentCaseNumChildren(tOldIndex); for (tNewIndex = 0; tNewIndex < tNumChildren; ++tNewIndex) { iNewToOld.push(tOldIndex); } } if (!DG.assert(iNewToOld.length === tNewNumCases, "Parent/Child case mismatch")) { iNewToOld.length = 0; // don't use this map if length error } DG.assert(iOldToNew.length === 0, "another parent/child case mismatch"); } function getChildToParentTransformation(iNewToOld, iOldToNew) { // fill iNewToOld[] with parent case index to child case index mapping, using 'undefined' if no child case index // fill iOldToNew[] with child case index to parent case index mapping, for extra old cases that are vanishing // because typically each newly created parent case will start at location of 0th child case, // and typically all but 0th child case must animate to position of newly created parent case. var tOldIndex, tNewIndex, tNumChildren, tChild, tChildCaseIndex; tOldIndex = 0; for (tNewIndex = 0; tNewIndex < tNewNumCases; ++tNewIndex) { tNumChildren = getParentCaseNumChildren(tNewIndex); iNewToOld.push((tNumChildren > 0) ? tOldIndex : undefined); // map each parent case to 1st child case if any, otherwise undefined for (tChild = 0; tChild < tNumChildren; ++tChild) { // ignore the 0th child case (undefined mapping), give index of 1st+ child case which is to be vanished tChildCaseIndex = ((tChild === 0) ? undefined : iNewToOld.length - 1); iOldToNew.push(tChildCaseIndex); ++tOldIndex; } } } if (isParentToChildTransformation()) { getParentToChildTransformation(iNewToOldCaseMap, iOldToNewCaseMap); } else if (isChildToParentTransformation()) { getChildToParentTransformation(iNewToOldCaseMap, iOldToNewCaseMap); } //DG.log("DG.PlotView._getTransferredElementsToCasesMap() collection id=%@, NewToOldCaseMap %@", tCollectionClient.get('id'), iNewToOldCaseMap.toString()); //DG.log("DG.PlotView._getTransferredElementsToCasesMap() collection id=%@, OldToNewCaseMap %@", tCollectionClient.get('id'), iOldToNewCaseMap.toString()); }, /** * Our model is signalling that it is about to change (DG.GraphModel.aboutToChangeConfiguration.set(true)) * We use this opportunity to prepare for an animation. * See also handleConfigurationChange. */ prepareForConfigurationChange: function () { this.set('cachedPointCoordinates', this.getElementPositionsInParentFrame()); }, /** * Our model is signalling that it has changed (DG.GraphModel.aboutToChangeConfiguration.set(false)) * We use this opportunity to update views. * See also prepareForConfigurationChange. */ handleConfigurationChange: function () { // In certain circumstances we have already moved point coordinates to transferredElementCoordinates. // Protect against wiping these out. if (this.get('allowTransferAnimation') && !this.get('transferredElementCoordinates')) { // the configuration has changed this.set('transferredElementCoordinates', this.get('cachedPointCoordinates')); } }, /** Subclasses may override. Note that deselection happens in startMarquee. @param iEvent {SC.Event} */ handleBackgroundClick: function (iEvent) { }, /** Subclasses will override if they have a double-click behavior @param iEvent {SC.Event} */ handleBackgroundDblClick: function (iEvent) { }, /** * This value depends only on plotIndex and numPlots */ getAttributeColor: function () { var tPlotIndex = this.get('plotIndex'), tNumPlots = this.get('numPlots'); return SC.none(tPlotIndex) || (tPlotIndex === 0) ? null : DG.ColorUtilities.calcAttributeColorFromIndex(tPlotIndex, tNumPlots); }, getPointColor: function () { var tModel = this.get('model'); return tModel.getPointColor ? tModel.getPointColor() : DG.PlotUtilities.kDefaultPointColor; }, /** * Construct and return a new render context * used for setCircleCoordinate() * @return {*} */ createRenderContext: function () { var tModel = this.get('model'), tConfig = tModel.get('dataConfiguration'), tLegendDesc = tConfig.get('legendAttributeDescription'), tYVarIDKey = tModel.getPath('verticalAxisIsY2') ? 'y2VarID' : 'yVarID', tStrokeParams = this.getStrokeParams(), tIsNumeric = tLegendDesc && tLegendDesc.get('isNumeric'), tQuantileValues = (tIsNumeric) ? DG.MathUtilities.nQuantileValues( tConfig.numericValuesForPlace(DG.GraphTypes.EPlace.eLegend), 5) : []; this._pointRadius = this.calcPointRadius(); // make sure created circles are of right size return { // render needs (set all to true for now, maybe later we can optimize by not doing all of them?) casesAdded: true, casesRemoved: true, updatedColors: true, updatedPositions: true, // cached render parameters common to all cases xAxisView: this.get('xAxisView'), yAxisView: this.get('yAxisView'), xVarID: tModel.get('xVarID'), yVarID: tModel.get(tYVarIDKey), legendDesc: tLegendDesc, legendVarID: tLegendDesc && tLegendDesc.get('attributeID'), pointColor: this.getPointColor(), transparency: tModel.getTransparency ? tModel.getTransparency() : DG.PlotUtilities.kDefaultPointOpacity, strokeTransparency: tStrokeParams.strokeTransparency, attrColor: this.getAttributeColor(), /** * Calculate the case color string * @param iCase {DG.Case} * @return {String} */ calcCaseColorString: function (iCase) { DG.assert(iCase); var tColorValue = tIsNumeric ? iCase.getForcedNumericValue(this.legendVarID) : iCase.getValue(this.legendVarID), tCaseColor = DG.ColorUtilities.calcCaseColor(tColorValue, this.legendDesc, this.attrColor || this.pointColor, tQuantileValues); return tCaseColor.colorString || tCaseColor; }, calcStrokeColorString: function (iCase) { if (tStrokeParams.strokeSameAsFill) return this.calcCaseColorString(iCase); else return tStrokeParams.strokeColor; } }; }, /** Create or destroy the matching adornment when our model creates/destroys the DG.PlottedCountModel. */ plottedCountChanged: function () { var tCountModel = this.getPath('model.plottedCount'); // This adornment may have been passed from a previous plot. Make sure knows it needs to recompute if (tCountModel.get('isVisible')) tCountModel.setComputingNeeded(); // Rather than attempt to reconnect an existing adornment, we throw out the old and rebuild. if (this.plottedCountAdorn) { this.plottedCountAdorn.destroy(); this.plottedCountAdorn = null; } if (tCountModel && this.get('paper')) { this.plottedCountAdorn = DG.PlottedCountAdornment.create({ parentView: this, valueAxisView: this.get('primaryAxisView'), model: tCountModel, paperSource: this.get('paperSource'), layerName: DG.LayerNames.kAdornments }); this.plottedCountAdorn.updateToModel(); } }.observes('*model.plottedCount'), /** The visibility of the model's plotted function has changed. We respond accordingly. */ plottedValueChanged: function () { var plotModel = this.get('model'), tPlottedValue = plotModel && plotModel.getAdornmentModel('plottedValue'), tPlottedValueAdorn = this.get('plottedValueAdorn'), tFormulaEditContextExists = DG.PlottedFormulaEditContext.hasFormulaEditContextFor(tPlottedValue), tPlottedValueEditView = this.get('plottedValueEditView'), tPlottedValueIsVisible = tPlottedValue && tPlottedValue.get('isVisible'); if (tPlottedValueEditView && !tPlottedValueIsVisible) { // If it's not visible, we can avoid much of the work tPlottedValueEditView.set('isVisible', false); } if (!tFormulaEditContextExists && tPlottedValueEditView) { this.removePlottedValueEditView(); tPlottedValueEditView = null; } if (tPlottedValue) { if (tPlottedValue && !tPlottedValueEditView) { tPlottedValueEditView = DG.PlottedValueAdornment.createFormulaEditView(tPlottedValue); this.set('plottedValueEditView', tPlottedValueEditView); this.setPath('parentView.plottedValueEditorView', tPlottedValueEditView); } // noinspection JSObjectNullOrUndefined tPlottedValueEditView.set('isVisible', tPlottedValue.get('isVisible')); if (tPlottedValueAdorn) { tPlottedValueAdorn.set('parentView', this); tPlottedValueAdorn.set('model', tPlottedValue); tPlottedValueAdorn.set('paperSource', this.get('paperSource')); } else { tPlottedValueAdorn = DG.PlottedValueAdornment.create({ parentView: this, model: tPlottedValue, paperSource: this.get('paperSource'), layerName: DG.LayerNames.kAdornments }); this.set('plottedValueAdorn', tPlottedValueAdorn); } } else if (tPlottedValueAdorn) { tPlottedValueAdorn.destroy(); this.set('plottedValueAdorn', null); } }.observes('*model.plottedValue'), /** Called when the order of the categories on an axis changes (e.g. cells are dragged) */ categoriesDidChange: function (iObject, iProperty) { }, /** * Here we do the initialization that relies on there being a paper to draw on. */ didCreateLayer: function () { this.plottedCountChanged(); // create count adornment to match model, now that we have paper } });
{ "content_hash": "09a63e4fcf6e183c40cb65d810e1fdd8", "timestamp": "", "source": "github", "line_count": 652, "max_line_length": 163, "avg_line_length": 43.236196319018404, "alnum_prop": 0.6174529975168499, "repo_name": "concord-consortium/codap", "id": "9e84def9ac4e404b368af10963e74920ab008282", "size": "28190", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "apps/dg/components/graph/plots/plot_view.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "107422" }, { "name": "HTML", "bytes": "13765" }, { "name": "JavaScript", "bytes": "5366188" }, { "name": "Makefile", "bytes": "5391" }, { "name": "PEG.js", "bytes": "13143" }, { "name": "Ruby", "bytes": "1984" }, { "name": "SCSS", "bytes": "13133" }, { "name": "Shell", "bytes": "41455" }, { "name": "TypeScript", "bytes": "477743" } ], "symlink_target": "" }
ACCEPTED #### According to International Plant Names Index #### Published in null #### Original name null ### Remarks null
{ "content_hash": "0f3255729db70eee9a7ff9304d70db9d", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 31, "avg_line_length": 9.692307692307692, "alnum_prop": 0.7063492063492064, "repo_name": "mdoering/backbone", "id": "3d68c3ba963bdb486092002dfe469d79902410e7", "size": "174", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Malpighiales/Clusiaceae/Cambogia/Cambogia venulosa/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
import random import time list_a = random.sample(range(1000), k=random.randint(1, 1000)) list_b = random.sample(range(1000), k=random.randint(1, 1000)) start = time.time() print(set(list_a) & set(list_b)) end = time.time() print(end - start)
{ "content_hash": "e95f40434d8720e5582f72a82df1aa26", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 62, "avg_line_length": 19, "alnum_prop": 0.6882591093117408, "repo_name": "shaggy245/practicepython", "id": "1ecba8ab538ec969bb8c85b25eba64fa2122b3cf", "size": "247", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ex10/ex10-2.py", "mode": "33188", "license": "mit", "language": [ { "name": "Python", "bytes": "2088146" } ], "symlink_target": "" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (version 1.6.0_18) on Thu Dec 18 17:18:27 PST 2014 --> <title>javax.swing.plaf.multi (Java Platform SE 7 )</title> <meta name="date" content="2014-12-18"> <meta name="keywords" content="javax.swing.plaf.multi package"> <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"> </head> <body> <h1 class="bar"><a href="../../../../javax/swing/plaf/multi/package-summary.html" target="classFrame">javax.swing.plaf.multi</a></h1> <div class="indexContainer"> <h2 title="Classes">Classes</h2> <ul title="Classes"> <li><a href="MultiButtonUI.html" title="class in javax.swing.plaf.multi" target="classFrame">MultiButtonUI</a></li> <li><a href="MultiColorChooserUI.html" title="class in javax.swing.plaf.multi" target="classFrame">MultiColorChooserUI</a></li> <li><a href="MultiComboBoxUI.html" title="class in javax.swing.plaf.multi" target="classFrame">MultiComboBoxUI</a></li> <li><a href="MultiDesktopIconUI.html" title="class in javax.swing.plaf.multi" target="classFrame">MultiDesktopIconUI</a></li> <li><a href="MultiDesktopPaneUI.html" title="class in javax.swing.plaf.multi" target="classFrame">MultiDesktopPaneUI</a></li> <li><a href="MultiFileChooserUI.html" title="class in javax.swing.plaf.multi" target="classFrame">MultiFileChooserUI</a></li> <li><a href="MultiInternalFrameUI.html" title="class in javax.swing.plaf.multi" target="classFrame">MultiInternalFrameUI</a></li> <li><a href="MultiLabelUI.html" title="class in javax.swing.plaf.multi" target="classFrame">MultiLabelUI</a></li> <li><a href="MultiListUI.html" title="class in javax.swing.plaf.multi" target="classFrame">MultiListUI</a></li> <li><a href="MultiLookAndFeel.html" title="class in javax.swing.plaf.multi" target="classFrame">MultiLookAndFeel</a></li> <li><a href="MultiMenuBarUI.html" title="class in javax.swing.plaf.multi" target="classFrame">MultiMenuBarUI</a></li> <li><a href="MultiMenuItemUI.html" title="class in javax.swing.plaf.multi" target="classFrame">MultiMenuItemUI</a></li> <li><a href="MultiOptionPaneUI.html" title="class in javax.swing.plaf.multi" target="classFrame">MultiOptionPaneUI</a></li> <li><a href="MultiPanelUI.html" title="class in javax.swing.plaf.multi" target="classFrame">MultiPanelUI</a></li> <li><a href="MultiPopupMenuUI.html" title="class in javax.swing.plaf.multi" target="classFrame">MultiPopupMenuUI</a></li> <li><a href="MultiProgressBarUI.html" title="class in javax.swing.plaf.multi" target="classFrame">MultiProgressBarUI</a></li> <li><a href="MultiRootPaneUI.html" title="class in javax.swing.plaf.multi" target="classFrame">MultiRootPaneUI</a></li> <li><a href="MultiScrollBarUI.html" title="class in javax.swing.plaf.multi" target="classFrame">MultiScrollBarUI</a></li> <li><a href="MultiScrollPaneUI.html" title="class in javax.swing.plaf.multi" target="classFrame">MultiScrollPaneUI</a></li> <li><a href="MultiSeparatorUI.html" title="class in javax.swing.plaf.multi" target="classFrame">MultiSeparatorUI</a></li> <li><a href="MultiSliderUI.html" title="class in javax.swing.plaf.multi" target="classFrame">MultiSliderUI</a></li> <li><a href="MultiSpinnerUI.html" title="class in javax.swing.plaf.multi" target="classFrame">MultiSpinnerUI</a></li> <li><a href="MultiSplitPaneUI.html" title="class in javax.swing.plaf.multi" target="classFrame">MultiSplitPaneUI</a></li> <li><a href="MultiTabbedPaneUI.html" title="class in javax.swing.plaf.multi" target="classFrame">MultiTabbedPaneUI</a></li> <li><a href="MultiTableHeaderUI.html" title="class in javax.swing.plaf.multi" target="classFrame">MultiTableHeaderUI</a></li> <li><a href="MultiTableUI.html" title="class in javax.swing.plaf.multi" target="classFrame">MultiTableUI</a></li> <li><a href="MultiTextUI.html" title="class in javax.swing.plaf.multi" target="classFrame">MultiTextUI</a></li> <li><a href="MultiToolBarUI.html" title="class in javax.swing.plaf.multi" target="classFrame">MultiToolBarUI</a></li> <li><a href="MultiToolTipUI.html" title="class in javax.swing.plaf.multi" target="classFrame">MultiToolTipUI</a></li> <li><a href="MultiTreeUI.html" title="class in javax.swing.plaf.multi" target="classFrame">MultiTreeUI</a></li> <li><a href="MultiViewportUI.html" title="class in javax.swing.plaf.multi" target="classFrame">MultiViewportUI</a></li> </ul> </div> </body> </html>
{ "content_hash": "6b7d2fb3339efe37aea8f58054b96798", "timestamp": "", "source": "github", "line_count": 50, "max_line_length": 133, "avg_line_length": 89.4, "alnum_prop": 0.743400447427293, "repo_name": "fbiville/annotation-processing-ftw", "id": "c21a5f8d646615461c84946e1f28ebd9b6367ffe", "size": "4470", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "doc/java/jdk7/javax/swing/plaf/multi/package-frame.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "191178" }, { "name": "HTML", "bytes": "63904" }, { "name": "Java", "bytes": "107042" }, { "name": "JavaScript", "bytes": "246677" } ], "symlink_target": "" }
<menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" tools:context=".MatrixActivity"> <item android:id="@+id/action_settings" android:title="@string/action_settings" android:orderInCategory="100" app:showAsAction="never" /> </menu>
{ "content_hash": "618dad2490a641ce6be81ca6ba1e6efd", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 64, "avg_line_length": 39.1, "alnum_prop": 0.6675191815856778, "repo_name": "bizoru/android-learning", "id": "cceda572696bde8cc15d0e8a9babb73e17f7e8e1", "size": "391", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/src/main/res/menu/menu_matrix.xml", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "4073" } ], "symlink_target": "" }
<resources> <string name="lib_name">Sample</string> </resources>
{ "content_hash": "568823eeb29981fc56ddcfe8a1dbd2ea", "timestamp": "", "source": "github", "line_count": 3, "max_line_length": 43, "avg_line_length": 23, "alnum_prop": 0.6811594202898551, "repo_name": "davide-maestroni/robo-fashion", "id": "6a7f197fe356bd98505b85eaa5557bd0b3e7f91b", "size": "69", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "sample/src/main/res/values/strings.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "3850" }, { "name": "Java", "bytes": "1051656" } ], "symlink_target": "" }