text
stringlengths
2
1.04M
meta
dict
<!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 Tue Nov 05 16:02:18 MST 2019 --> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Uses of Class org.wildfly.swarm.microprofile.jwtauth.deployment.auth.cdi.ClaimProviderBeanAttributes (BOM: * : All 2.5.1.Final-SNAPSHOT API)</title> <meta name="date" content="2019-11-05"> <link rel="stylesheet" type="text/css" href="../../../../../../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../../../../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class org.wildfly.swarm.microprofile.jwtauth.deployment.auth.cdi.ClaimProviderBeanAttributes (BOM: * : All 2.5.1.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/microprofile/jwtauth/deployment/auth/cdi/ClaimProviderBeanAttributes.html" title="class in org.wildfly.swarm.microprofile.jwtauth.deployment.auth.cdi">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.5.1.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/microprofile/jwtauth/deployment/auth/cdi/class-use/ClaimProviderBeanAttributes.html" target="_top">Frames</a></li> <li><a href="ClaimProviderBeanAttributes.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 Class org.wildfly.swarm.microprofile.jwtauth.deployment.auth.cdi.ClaimProviderBeanAttributes" class="title">Uses of Class<br>org.wildfly.swarm.microprofile.jwtauth.deployment.auth.cdi.ClaimProviderBeanAttributes</h2> </div> <div class="classUseContainer">No usage of org.wildfly.swarm.microprofile.jwtauth.deployment.auth.cdi.ClaimProviderBeanAttributes</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/microprofile/jwtauth/deployment/auth/cdi/ClaimProviderBeanAttributes.html" title="class in org.wildfly.swarm.microprofile.jwtauth.deployment.auth.cdi">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.5.1.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/microprofile/jwtauth/deployment/auth/cdi/class-use/ClaimProviderBeanAttributes.html" target="_top">Frames</a></li> <li><a href="ClaimProviderBeanAttributes.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": "672e0e2af5e1735c4742344d50b412ab", "timestamp": "", "source": "github", "line_count": 128, "max_line_length": 235, "avg_line_length": 43.5390625, "alnum_prop": 0.6204916561995335, "repo_name": "wildfly-swarm/wildfly-swarm-javadocs", "id": "2805a41679250226ed8eb3628dd9ef8fa9c5af79", "size": "5573", "binary": false, "copies": "1", "ref": "refs/heads/gh-pages", "path": "2.5.1.Final-SNAPSHOT/apidocs/org/wildfly/swarm/microprofile/jwtauth/deployment/auth/cdi/class-use/ClaimProviderBeanAttributes.html", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
package handler import ( "bytes" "net/http/httptest" "testing" . "github.com/smartystreets/goconvey/convey" "github.com/skygeario/skygear-server/pkg/core/cloudstorage" . "github.com/skygeario/skygear-server/pkg/core/skytest" "github.com/skygeario/skygear-server/pkg/core/validation" ) func TestPresignUploadHandler(t *testing.T) { Convey("PresignUploadHandler", t, func() { h := &PresignUploadHandler{} validator := validation.NewValidator("http://v2.skygear.io") validator.AddSchemaFragments( PresignUploadRequestSchema, ) provider := &cloudstorage.MockProvider{} h.CloudStorageProvider = provider h.Validator = validator Convey("headers is required", func() { requestBody := []byte(`{}`) w := httptest.NewRecorder() r := httptest.NewRequest("POST", "/_asset/presign_upload", bytes.NewReader(requestBody)) r.Header.Add("content-type", "application/json") h.ServeHTTP(w, r) So(w.Code, ShouldEqual, 400) So(w.Body.Bytes(), ShouldEqualJSON, `{ "error": { "name": "Invalid", "reason": "ValidationFailed", "message": "invalid request body", "code": 400, "info": { "causes": [ { "kind": "Required", "message": "headers is required", "pointer":"/headers" } ] } } }`) }) Convey("content-length is required", func() { requestBody := []byte(`{ "headers": {} }`) w := httptest.NewRecorder() r := httptest.NewRequest("POST", "/_asset/presign_upload", bytes.NewReader(requestBody)) r.Header.Add("content-type", "application/json") h.ServeHTTP(w, r) So(w.Code, ShouldEqual, 400) So(w.Body.Bytes(), ShouldEqualJSON, `{ "error": { "name": "Invalid", "reason": "ValidationFailed", "message": "invalid request body", "code": 400, "info": { "causes": [ { "kind": "Required", "message": "content-length is required", "pointer":"/headers/content-length" } ] } } }`) }) Convey("prefix must be safe", func() { requestBody := []byte(`{ "prefix": "/", "headers": { "content-length": "123" } }`) w := httptest.NewRecorder() r := httptest.NewRequest("POST", "/_asset/presign_upload", bytes.NewReader(requestBody)) r.Header.Add("content-type", "application/json") h.ServeHTTP(w, r) So(w.Code, ShouldEqual, 400) So(w.Body.Bytes(), ShouldEqualJSON, `{ "error": { "name": "Invalid", "reason": "ValidationFailed", "message": "invalid request body", "code": 400, "info": { "causes": [ { "kind": "StringFormat", "message": "Does not match pattern '^[-_.a-zA-Z0-9]*$'", "pointer":"/prefix", "details": { "pattern": "^[-_.a-zA-Z0-9]*$" } } ] } } }`) }) Convey("success", func() { requestBody := []byte(`{ "prefix": "-_.azAZ09", "headers": { "content-length": "123" } }`) w := httptest.NewRecorder() r := httptest.NewRequest("POST", "/_asset/presign_upload", bytes.NewReader(requestBody)) r.Header.Add("content-type", "application/json") provider.PresignUploadResponse = &cloudstorage.PresignUploadResponse{ AssetName: "myimage.png", URL: "http://example.com/app/myimage.png", Method: "PUT", Headers: []cloudstorage.HeaderField{ cloudstorage.HeaderField{ Name: "Content-Length", Value: "123", }, }, } h.ServeHTTP(w, r) So(w.Code, ShouldEqual, 200) So(w.Body.Bytes(), ShouldEqualJSON, ` {"result":{"asset_name":"myimage.png","headers":[{"name":"Content-Length","value":"123"}],"method":"PUT","url":"http://example.com/app/myimage.png"}} `) }) }) }
{ "content_hash": "cbf0befb07c33b55b5d714fa8f3dbd28", "timestamp": "", "source": "github", "line_count": 131, "max_line_length": 158, "avg_line_length": 27.763358778625953, "alnum_prop": 0.6021446246906791, "repo_name": "SkygearIO/skygear-server", "id": "fe5368f1929e5bc1aeb1bfb480210d2ba32cc4c1", "size": "3637", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "pkg/asset/handler/presign_upload_test.go", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "4510" }, { "name": "Dockerfile", "bytes": "2060" }, { "name": "Go", "bytes": "1818149" }, { "name": "HTML", "bytes": "311" }, { "name": "JavaScript", "bytes": "431" }, { "name": "Makefile", "bytes": "8695" }, { "name": "Nix", "bytes": "1486" }, { "name": "PLSQL", "bytes": "351" }, { "name": "PLpgSQL", "bytes": "1058" }, { "name": "Shell", "bytes": "5366" }, { "name": "TSQL", "bytes": "30624" } ], "symlink_target": "" }
TODO: Write a gem description ## Installation Add this line to your application's Gemfile: ```ruby gem 'gatherr-omniauth' ``` And then execute: $ bundle Or install it yourself as: $ gem install gatherr-omniauth ## Usage TODO: Write usage instructions here ## Contributing 1. Fork it ( https://github.com/[my-github-username]/gatherr-omniauth/fork ) 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. Create a new Pull Request
{ "content_hash": "7807f7124f843bfa378bba8439906928", "timestamp": "", "source": "github", "line_count": 29, "max_line_length": 76, "avg_line_length": 20, "alnum_prop": 0.7189655172413794, "repo_name": "garymardell/gatherr_omniauth", "id": "49f357c3e79c5ecf83ae01a23a30a2bbe9adbd3f", "size": "601", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "mit", "language": [ { "name": "Ruby", "bytes": "1753" } ], "symlink_target": "" }
namespace LuaPlus { namespace LuaHelper { LUAPLUS_API void MergeObjects(LuaObject& mergeTo, LuaObject& mergeFrom, bool replaceDuplicates); } } #endif // LUAHELPER_H
{ "content_hash": "680d37b9e84af229669809e741919eff", "timestamp": "", "source": "github", "line_count": 8, "max_line_length": 98, "avg_line_length": 21.25, "alnum_prop": 0.7647058823529411, "repo_name": "vit3k/entity_system", "id": "5738113d24fc0cd0e382e191b10480ac759d3182", "size": "747", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "Sources/LuaPlus/LuaHelper.h", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "640719" }, { "name": "C++", "bytes": "666854" }, { "name": "GLSL", "bytes": "510" }, { "name": "Makefile", "bytes": "6088" } ], "symlink_target": "" }
import os import sys sys.path.insert(0, os.path.join('..', 'src'))
{ "content_hash": "26bf0b094e7b6a922a1ecddb06914bd4", "timestamp": "", "source": "github", "line_count": 4, "max_line_length": 45, "avg_line_length": 17, "alnum_prop": 0.6470588235294118, "repo_name": "davetcoleman/catkin_pkg", "id": "4a31225b8fbd8224d76b6950ce3b9de2f4e3d3fa", "size": "68", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "test/__init__.py", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "CMake", "bytes": "937" }, { "name": "Makefile", "bytes": "524" }, { "name": "Python", "bytes": "196083" } ], "symlink_target": "" }
<?php $mensajes = Yii::app()->user->getFlashes(); ?> <?php if ($mensajes): ?> <?php foreach ($mensajes as $idx => $mensaje): ?> <div class="alert alert-<?php echo $idx ?> alert-dismissable"> <button type="button" class="close" data-dismiss="alert">&times;</button> <?php echo $mensaje ?> </div> <?php endforeach; ?> <?php endif; ?> <div class="box-inner"> <div class="box-header well"> <div class="col-lg-1"> <h2><i class="glyphicon glyphicon-file"></i> Combos</h2> </div> </div> <div class="box-content row" id='botones-modulos'> <div class="col-md-12"> <div class="form-group"> <?php if(!$params['model']->isNewRecord):?> <div class="center"> <div class="btn-group"> <a href="<?php echo $this->createUrl('/callcenter/combo/combo', array('idCombo' => $params['model']->idCombo, 'opcion'=>'editar')) ?>" class="btn btn-primary <?php echo ($params['opcion']=="editar" ? "active" : "") ?>">Editar</a> <a href="<?php echo $this->createUrl('/callcenter/combo/combo', array('idCombo' => $params['model']->idCombo, 'opcion'=>'productos')) ?>" class="btn btn-primary <?php echo ($params['opcion']=="productos" ? "active" : "") ?>" >Productos</a> <a href="<?php echo $this->createUrl('/callcenter/combo/combo', array('idCombo' => $params['model']->idCombo, 'opcion'=>'imagen')) ?>" class="btn btn-primary <?php echo ($params['opcion']=="imagen" ? "active" : "") ?>" >Imagen</a> <a href="<?php echo $this->createUrl('/callcenter/combo/combo', array('idCombo' => $params['model']->idCombo, 'opcion'=>'sector')) ?>" class="btn btn-primary <?php echo ($params['opcion']=="sector" ? "active" : "") ?>" >Sector</a> </div> </div> <?php endif;?> <div id="div-detalle-pedido" style="padding-top: 20px"> <?php $this->renderPartial($params['vista'], $params); ?> </div> </div> </div> </div> </div>
{ "content_hash": "4daa2966b9cce19f7db5d89b42238cb4", "timestamp": "", "source": "github", "line_count": 39, "max_line_length": 267, "avg_line_length": 57.48717948717949, "alnum_prop": 0.49866190900981266, "repo_name": "msanchex/testmasm", "id": "ba7302e25326f5e3bee41cfd6b0458fc95ecff01", "size": "2242", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "protected/modules/callcenter/views/combo/editar.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "249" }, { "name": "Batchfile", "bytes": "395" }, { "name": "CSS", "bytes": "267591" }, { "name": "HTML", "bytes": "484698" }, { "name": "JavaScript", "bytes": "1502603" }, { "name": "PHP", "bytes": "2904219" } ], "symlink_target": "" }
( function() { // This function is to be called under a "walker" instance scope. function iterate( rtl, breakOnFalse ) { var range = this.range; // Return null if we have reached the end. if ( this._.end ) return null; // This is the first call. Initialize it. if ( !this._.start ) { this._.start = 1; // A collapsed range must return null at first call. if ( range.collapsed ) { this.end(); return null; } // Move outside of text node edges. range.optimize(); } var node, startCt = range.startContainer, endCt = range.endContainer, startOffset = range.startOffset, endOffset = range.endOffset, guard, userGuard = this.guard, type = this.type, getSourceNodeFn = ( rtl ? 'getPreviousSourceNode' : 'getNextSourceNode' ); // Create the LTR guard function, if necessary. if ( !rtl && !this._.guardLTR ) { // The node that stops walker from moving up. var limitLTR = endCt.type == CKEDITOR.NODE_ELEMENT ? endCt : endCt.getParent(); // The node that stops the walker from going to next. var blockerLTR = endCt.type == CKEDITOR.NODE_ELEMENT ? endCt.getChild( endOffset ) : endCt.getNext(); this._.guardLTR = function( node, movingOut ) { return ( ( !movingOut || !limitLTR.equals( node ) ) && ( !blockerLTR || !node.equals( blockerLTR ) ) && ( node.type != CKEDITOR.NODE_ELEMENT || !movingOut || !node.equals( range.root ) ) ); }; } // Create the RTL guard function, if necessary. if ( rtl && !this._.guardRTL ) { // The node that stops walker from moving up. var limitRTL = startCt.type == CKEDITOR.NODE_ELEMENT ? startCt : startCt.getParent(); // The node that stops the walker from going to next. var blockerRTL = startCt.type == CKEDITOR.NODE_ELEMENT ? startOffset ? startCt.getChild( startOffset - 1 ) : null : startCt.getPrevious(); this._.guardRTL = function( node, movingOut ) { return ( ( !movingOut || !limitRTL.equals( node ) ) && ( !blockerRTL || !node.equals( blockerRTL ) ) && ( node.type != CKEDITOR.NODE_ELEMENT || !movingOut || !node.equals( range.root ) ) ); }; } // Define which guard function to use. var stopGuard = rtl ? this._.guardRTL : this._.guardLTR; // Make the user defined guard function participate in the process, // otherwise simply use the boundary guard. if ( userGuard ) { guard = function( node, movingOut ) { if ( stopGuard( node, movingOut ) === false ) return false; return userGuard( node, movingOut ); }; } else { guard = stopGuard; } if ( this.current ) node = this.current[ getSourceNodeFn ]( false, type, guard ); else { // Get the first node to be returned. if ( rtl ) { node = endCt; if ( node.type == CKEDITOR.NODE_ELEMENT ) { if ( endOffset > 0 ) node = node.getChild( endOffset - 1 ); else node = ( guard( node, true ) === false ) ? null : node.getPreviousSourceNode( true, type, guard ); } } else { node = startCt; if ( node.type == CKEDITOR.NODE_ELEMENT ) { if ( !( node = node.getChild( startOffset ) ) ) node = ( guard( startCt, true ) === false ) ? null : startCt.getNextSourceNode( true, type, guard ); } } if ( node && guard( node ) === false ) node = null; } while ( node && !this._.end ) { this.current = node; if ( !this.evaluator || this.evaluator( node ) !== false ) { if ( !breakOnFalse ) return node; } else if ( breakOnFalse && this.evaluator ) { return false; } node = node[ getSourceNodeFn ]( false, type, guard ); } this.end(); return this.current = null; } function iterateToLast( rtl ) { var node, last = null; while ( ( node = iterate.call( this, rtl ) ) ) last = node; return last; } /** * Utility class to "walk" the DOM inside a range boundaries. If the * range starts or ends in the middle of the text node this node will * be included as a whole. Outside changes to the range may break the walker. * * The walker may return nodes that are not totaly included into the * range boundaires. Let's take the following range representation, * where the square brackets indicate the boundaries: * * [<p>Some <b>sample] text</b> * * While walking forward into the above range, the following nodes are * returned: `<p>`, `"Some "`, `<b>` and `"sample"`. Going * backwards instead we have: `"sample"` and `"Some "`. So note that the * walker always returns nodes when "entering" them, but not when * "leaving" them. The guard function is instead called both when * entering and leaving nodes. * * @class */ CKEDITOR.dom.walker = CKEDITOR.tools.createClass( { /** * Creates a walker class instance. * * @constructor * @param {CKEDITOR.dom.range} range The range within which walk. */ $: function( range ) { this.range = range; /** * A function executed for every matched node, to check whether * it's to be considered into the walk or not. If not provided, all * matched nodes are considered good. * * If the function returns `false` the node is ignored. * * @property {Function} evaluator */ // this.evaluator = null; /** * A function executed for every node the walk pass by to check * whether the walk is to be finished. It's called when both * entering and exiting nodes, as well as for the matched nodes. * * If this function returns `false`, the walking ends and no more * nodes are evaluated. * @property {Function} guard */ // this.guard = null; /** @private */ this._ = {}; }, // statics : // { // /* Creates a CKEDITOR.dom.walker instance to walk inside DOM boundaries set by nodes. // * @param {CKEDITOR.dom.node} startNode The node from wich the walk // * will start. // * @param {CKEDITOR.dom.node} [endNode] The last node to be considered // * in the walk. No more nodes are retrieved after touching or // * passing it. If not provided, the walker stops at the // * &lt;body&gt; closing boundary. // * @returns {CKEDITOR.dom.walker} A DOM walker for the nodes between the // * provided nodes. // */ // createOnNodes : function( startNode, endNode, startInclusive, endInclusive ) // { // var range = new CKEDITOR.dom.range(); // if ( startNode ) // range.setStartAt( startNode, startInclusive ? CKEDITOR.POSITION_BEFORE_START : CKEDITOR.POSITION_AFTER_END ) ; // else // range.setStartAt( startNode.getDocument().getBody(), CKEDITOR.POSITION_AFTER_START ) ; // // if ( endNode ) // range.setEndAt( endNode, endInclusive ? CKEDITOR.POSITION_AFTER_END : CKEDITOR.POSITION_BEFORE_START ) ; // else // range.setEndAt( startNode.getDocument().getBody(), CKEDITOR.POSITION_BEFORE_END ) ; // // return new CKEDITOR.dom.walker( range ); // } // }, // proto: { /** * Stops walking. No more nodes are retrieved if this function gets called. */ end: function() { this._.end = 1; }, /** * Retrieves the next node (at right). * * @returns {CKEDITOR.dom.node} The next node or null if no more * nodes are available. */ next: function() { return iterate.call( this ); }, /** * Retrieves the previous node (at left). * * @returns {CKEDITOR.dom.node} The previous node or null if no more * nodes are available. */ previous: function() { return iterate.call( this, 1 ); }, /** * Check all nodes at right, executing the evaluation function. * * @returns {Boolean} `false` if the evaluator function returned * `false` for any of the matched nodes. Otherwise `true`. */ checkForward: function() { return iterate.call( this, 0, 1 ) !== false; }, /** * Check all nodes at left, executing the evaluation function. * * @returns {Boolean} `false` if the evaluator function returned * `false` for any of the matched nodes. Otherwise `true`. */ checkBackward: function() { return iterate.call( this, 1, 1 ) !== false; }, /** * Executes a full walk forward (to the right), until no more nodes * are available, returning the last valid node. * * @returns {CKEDITOR.dom.node} The last node at the right or null * if no valid nodes are available. */ lastForward: function() { return iterateToLast.call( this ); }, /** * Executes a full walk backwards (to the left), until no more nodes * are available, returning the last valid node. * * @returns {CKEDITOR.dom.node} The last node at the left or null * if no valid nodes are available. */ lastBackward: function() { return iterateToLast.call( this, 1 ); }, /** * Resets walker. */ reset: function() { delete this.current; this._ = {}; } } } ); // Anything whose display computed style is block, list-item, table, // table-row-group, table-header-group, table-footer-group, table-row, // table-column-group, table-column, table-cell, table-caption, or whose node // name is hr, br (when enterMode is br only) is a block boundary. var blockBoundaryDisplayMatch = { block: 1, 'list-item': 1, table: 1, 'table-row-group': 1, 'table-header-group': 1, 'table-footer-group': 1, 'table-row': 1, 'table-column-group': 1, 'table-column': 1, 'table-cell': 1, 'table-caption': 1 }, outOfFlowPositions = { absolute: 1, fixed: 1 }; /** * Checks whether element is displayed as a block. * * @member CKEDITOR.dom.element * @param [customNodeNames] Custom list of nodes which will extend * default {@link CKEDITOR.dtd#$block} list. * @returns {Boolean} */ CKEDITOR.dom.element.prototype.isBlockBoundary = function( customNodeNames ) { // Whether element is in normal page flow. Floated or positioned elements are out of page flow. // Don't consider floated or positioned formatting as block boundary, fall back to dtd check in that case. (#6297) var inPageFlow = this.getComputedStyle( 'float' ) == 'none' && !( this.getComputedStyle( 'position' ) in outOfFlowPositions ); if ( inPageFlow && blockBoundaryDisplayMatch[ this.getComputedStyle( 'display' ) ] ) return true; // Either in $block or in customNodeNames if defined. return !!( this.is( CKEDITOR.dtd.$block ) || customNodeNames && this.is( customNodeNames ) ); }; /** * Returns a function which checks whether the node is a block boundary. * See {@link CKEDITOR.dom.element#isBlockBoundary}. * * @static * @param customNodeNames * @returns {Function} */ CKEDITOR.dom.walker.blockBoundary = function( customNodeNames ) { return function( node ) { return !( node.type == CKEDITOR.NODE_ELEMENT && node.isBlockBoundary( customNodeNames ) ); }; }; /** * @static * @todo */ CKEDITOR.dom.walker.listItemBoundary = function() { return this.blockBoundary( { br: 1 } ); }; /** * Returns a function which checks whether the node is a bookmark node OR bookmark node * inner contents. * * @static * @param {Boolean} [contentOnly=false] Whether only test against the text content of * bookmark node instead of the element itself (default). * @param {Boolean} [isReject=false] Whether should return `false` for the bookmark * node instead of `true` (default). * @returns {Function} */ CKEDITOR.dom.walker.bookmark = function( contentOnly, isReject ) { function isBookmarkNode( node ) { return ( node && node.getName && node.getName() == 'span' && node.data( 'cke-bookmark' ) ); } return function( node ) { var isBookmark, parent; // Is bookmark inner text node? isBookmark = ( node && node.type != CKEDITOR.NODE_ELEMENT && ( parent = node.getParent() ) && isBookmarkNode( parent ) ); // Is bookmark node? isBookmark = contentOnly ? isBookmark : isBookmark || isBookmarkNode( node ); return !!( isReject ^ isBookmark ); }; }; /** * Returns a function which checks whether the node is a text node containing only whitespaces characters. * * @static * @param {Boolean} [isReject=false] * @returns {Function} */ CKEDITOR.dom.walker.whitespaces = function( isReject ) { return function( node ) { var isWhitespace; if ( node && node.type == CKEDITOR.NODE_TEXT ) { // whitespace, as well as the text cursor filler node we used in Webkit. (#9384) isWhitespace = !CKEDITOR.tools.trim( node.getText() ) || CKEDITOR.env.webkit && node.getText() == '\u200b'; } return !!( isReject ^ isWhitespace ); }; }; /** * Returns a function which checks whether the node is invisible in the WYSIWYG mode. * * @static * @param {Boolean} [isReject=false] * @returns {Function} */ CKEDITOR.dom.walker.invisible = function( isReject ) { var whitespace = CKEDITOR.dom.walker.whitespaces(), // #12221 (Chrome) plus #11111 (Safari). offsetWidth0 = CKEDITOR.env.webkit ? 1 : 0; return function( node ) { var invisible; if ( whitespace( node ) ) invisible = 1; else { // Visibility should be checked on element. if ( node.type == CKEDITOR.NODE_TEXT ) node = node.getParent(); // Nodes that take no spaces in wysiwyg: // 1. White-spaces but not including NBSP. // 2. Empty inline elements, e.g. <b></b>. // 3. <br> elements (bogus, surrounded by text) (#12423). invisible = node.$.offsetWidth <= offsetWidth0; } return !!( isReject ^ invisible ); }; }; /** * Returns a function which checks whether node's type is equal to passed one. * * @static * @param {Number} type * @param {Boolean} [isReject=false] * @returns {Function} */ CKEDITOR.dom.walker.nodeType = function( type, isReject ) { return function( node ) { return !!( isReject ^ ( node.type == type ) ); }; }; /** * Returns a function which checks whether node is a bogus (filler) node from * contenteditable element's point of view. * * @static * @param {Boolean} [isReject=false] * @returns {Function} */ CKEDITOR.dom.walker.bogus = function( isReject ) { function nonEmpty( node ) { return !isWhitespaces( node ) && !isBookmark( node ); } return function( node ) { var isBogus = CKEDITOR.env.needsBrFiller ? node.is && node.is( 'br' ) : node.getText && tailNbspRegex.test( node.getText() ); if ( isBogus ) { var parent = node.getParent(), next = node.getNext( nonEmpty ); isBogus = parent.isBlockBoundary() && ( !next || next.type == CKEDITOR.NODE_ELEMENT && next.isBlockBoundary() ); } return !!( isReject ^ isBogus ); }; }; /** * Returns a function which checks whether node is a temporary element * (element with `data-cke-temp` attribute) or its child. * * @since 4.3 * @static * @param {Boolean} [isReject=false] Whether should return `false` for the * temporary element instead of `true` (default). * @returns {Function} */ CKEDITOR.dom.walker.temp = function( isReject ) { return function( node ) { if ( node.type != CKEDITOR.NODE_ELEMENT ) node = node.getParent(); var isTemp = node && node.hasAttribute( 'data-cke-temp' ); return !!( isReject ^ isTemp ); }; }; var tailNbspRegex = /^[\t\r\n ]*(?:&nbsp;|\xa0)$/, isWhitespaces = CKEDITOR.dom.walker.whitespaces(), isBookmark = CKEDITOR.dom.walker.bookmark(), isTemp = CKEDITOR.dom.walker.temp(), toSkip = function( node ) { return isBookmark( node ) || isWhitespaces( node ) || node.type == CKEDITOR.NODE_ELEMENT && node.is( CKEDITOR.dtd.$inline ) && !node.is( CKEDITOR.dtd.$empty ); }; /** * Returns a function which checks whether node should be ignored in terms of "editability". * * This includes: * * * whitespaces (see {@link CKEDITOR.dom.walker#whitespaces}), * * bookmarks (see {@link CKEDITOR.dom.walker#bookmark}), * * temporary elements (see {@link CKEDITOR.dom.walker#temp}). * * @since 4.3 * @static * @param {Boolean} [isReject=false] Whether should return `false` for the * ignored element instead of `true` (default). * @returns {Function} */ CKEDITOR.dom.walker.ignored = function( isReject ) { return function( node ) { var isIgnored = isWhitespaces( node ) || isBookmark( node ) || isTemp( node ); return !!( isReject ^ isIgnored ); }; }; var isIgnored = CKEDITOR.dom.walker.ignored(); function isEmpty( node ) { var i = 0, l = node.getChildCount(); for ( ; i < l; ++i ) { if ( !isIgnored( node.getChild( i ) ) ) return false; } return true; } function filterTextContainers( dtd ) { var hash = {}, name; for ( name in dtd ) { if ( CKEDITOR.dtd[ name ][ '#' ] ) hash[ name ] = 1; } return hash; } // Block elements which can contain text nodes (without ul, ol, dl, etc.). var dtdTextBlock = filterTextContainers( CKEDITOR.dtd.$block ); function isEditable( node ) { // Skip temporary elements, bookmarks and whitespaces. if ( isIgnored( node ) ) return false; if ( node.type == CKEDITOR.NODE_TEXT ) return true; if ( node.type == CKEDITOR.NODE_ELEMENT ) { // All inline and non-editable elements are valid editable places. // Note: the <hr> is currently the only element in CKEDITOR.dtd.$empty and CKEDITOR.dtd.$block, // but generally speaking we need an intersection of these two sets. // Note: non-editable block has to be treated differently (should be selected entirely). if ( node.is( CKEDITOR.dtd.$inline ) || node.is( 'hr' ) || node.getAttribute( 'contenteditable' ) == 'false' ) return true; // Empty blocks are editable on IE. if ( !CKEDITOR.env.needsBrFiller && node.is( dtdTextBlock ) && isEmpty( node ) ) return true; } // Skip all other nodes. return false; } /** * Returns a function which checks whether node can be a container or a sibling * of selection end. * * This includes: * * * text nodes (but not whitespaces), * * inline elements, * * intersection of {@link CKEDITOR.dtd#$empty} and {@link CKEDITOR.dtd#$block} (currenly * it's only `<hr>`), * * non-editable blocks (special case - such blocks cannot be containers nor * siblings, they need to be selected entirely), * * empty blocks which can contain text (IE only). * * @since 4.3 * @static * @param {Boolean} [isReject=false] Whether should return `false` for the * ignored element instead of `true` (default). * @returns {Function} */ CKEDITOR.dom.walker.editable = function( isReject ) { return function( node ) { return !!( isReject ^ isEditable( node ) ); }; }; /** * Checks if there's a filler node at the end of an element, and returns it. * * @member CKEDITOR.dom.element * @returns {CKEDITOR.dom.node/Boolean} Bogus node or `false`. */ CKEDITOR.dom.element.prototype.getBogus = function() { // Bogus are not always at the end, e.g. <p><a>text<br /></a></p> (#7070). var tail = this; do { tail = tail.getPreviousSourceNode(); } while ( toSkip( tail ) ); if ( tail && ( CKEDITOR.env.needsBrFiller ? tail.is && tail.is( 'br' ) : tail.getText && tailNbspRegex.test( tail.getText() ) ) ) return tail; return false; }; } )();
{ "content_hash": "d6fb10aadfaf0602072f1ad1aa5e7aeb", "timestamp": "", "source": "github", "line_count": 623, "max_line_length": 193, "avg_line_length": 30.75601926163724, "alnum_prop": 0.6389019362246229, "repo_name": "labidimehrez/symfony", "id": "20a7ac42ad1fbc912b091ccea2d663ce319e0d7a", "size": "19320", "binary": false, "copies": "12", "ref": "refs/heads/dev", "path": "src/MyApp/ForumBundle/Resources/public/js/ckeditor/core/dom/walker.js", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "2647" }, { "name": "CSS", "bytes": "350600" }, { "name": "HTML", "bytes": "791930" }, { "name": "JavaScript", "bytes": "4464771" }, { "name": "PHP", "bytes": "288452" } ], "symlink_target": "" }
package org.onosproject.cpman.impl; import org.junit.Before; import org.junit.Test; import org.onosproject.cpman.MetricsDatabase; import java.util.HashMap; import java.util.Map; import java.util.concurrent.TimeUnit; import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertThat; /** * Unit test for control plane metrics back-end database. */ public class MetricsDatabaseTest { private MetricsDatabase mdb; private static final String CPU_METRIC = "cpu"; private static final String CPU_LOAD = "load"; private static final String MEMORY_METRIC = "memory"; private static final String MEMORY_FREE_PERC = "freePerc"; private static final String MEMORY_USED_PERC = "usedPerc"; /** * Initializes metrics database instance. */ @Before public void setUp() { mdb = new DefaultMetricsDatabase.Builder() .withMetricName(CPU_METRIC) .addMetricType(CPU_LOAD) .build(); } /** * Tests the metric update function. */ @Test public void testMetricUpdate() { long currentTime = System.currentTimeMillis() / 1000L; mdb.updateMetric(CPU_LOAD, 30, currentTime); assertThat(30D, is(mdb.recentMetric(CPU_LOAD))); mdb.updateMetric(CPU_LOAD, 40, currentTime + 60); assertThat(40D, is(mdb.recentMetric(CPU_LOAD))); mdb.updateMetric(CPU_LOAD, 50, currentTime + 120); assertThat(50D, is(mdb.recentMetric(CPU_LOAD))); } /** * Tests the metric range fetch function. */ @Test public void testMetricRangeFetch() { // full range fetch assertThat(mdb.metrics(CPU_LOAD).length, is(60 * 24)); // query one minute time range assertThat(mdb.recentMetrics(CPU_LOAD, 1, TimeUnit.MINUTES).length, is(1)); // query one hour time range assertThat(mdb.recentMetrics(CPU_LOAD, 1, TimeUnit.HOURS).length, is(60)); // query one day time range assertThat(mdb.recentMetrics(CPU_LOAD, 1, TimeUnit.DAYS).length, is(60 * 24)); // query a specific time range long endTime = System.currentTimeMillis() / 1000L; long startTime = endTime - 60 * 5; assertThat(mdb.metrics(CPU_LOAD, startTime, endTime).length, is(5)); } /** * Test the projected time range. */ @Test(expected = IllegalArgumentException.class) public void testExceededTimeRange() { // query 25 hours time range assertThat(mdb.recentMetrics(CPU_LOAD, 25, TimeUnit.HOURS).length, is(60 * 24)); } /** * Test the projected time range. */ @Test(expected = IllegalArgumentException.class) public void testInsufficientTimeRange() { // query 50 seconds time range assertThat(mdb.recentMetrics(CPU_LOAD, 50, TimeUnit.SECONDS).length, is(1)); } /** * Test multiple metrics update and query. */ @Test public void testMultipleMetrics() { MetricsDatabase multiMdb = new DefaultMetricsDatabase.Builder() .withMetricName(MEMORY_METRIC) .addMetricType(MEMORY_FREE_PERC) .addMetricType(MEMORY_USED_PERC) .build(); Map<String, Double> metrics = new HashMap<>(); metrics.putIfAbsent(MEMORY_FREE_PERC, 30D); metrics.putIfAbsent(MEMORY_USED_PERC, 70D); multiMdb.updateMetrics(metrics); assertThat(30D, is(multiMdb.recentMetric(MEMORY_FREE_PERC))); assertThat(70D, is(multiMdb.recentMetric(MEMORY_USED_PERC))); } }
{ "content_hash": "c55dde2f8d71a34b1505f0ba1a5c63ad", "timestamp": "", "source": "github", "line_count": 115, "max_line_length": 88, "avg_line_length": 31.452173913043477, "alnum_prop": 0.6358860934476085, "repo_name": "sonu283304/onos", "id": "713c7d8e5bb1c2dbe9805d64d6aea8d2e6ce0f53", "size": "4226", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "apps/cpman/app/src/test/java/org/onosproject/cpman/impl/MetricsDatabaseTest.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ANTLR", "bytes": "69305" }, { "name": "CSS", "bytes": "174489" }, { "name": "HTML", "bytes": "499017" }, { "name": "Java", "bytes": "20230002" }, { "name": "JavaScript", "bytes": "3125902" }, { "name": "Roff", "bytes": "1090" }, { "name": "Shell", "bytes": "2625" } ], "symlink_target": "" }
<!--build:js build/SPServices.min.js --> <script src="src/utils/constants.js"></script> <script src="./core/SPServices.utils.js"></script> <script src="./core/SPServices.core.js"></script> <script src="./core/Version.js"></script> <script src="./utils/SPConvertDateToISO.js"></script> <script src="./utils/SPDebugXMLHttpResult.js"></script> <script src="./utils/SPDropdownCtl.js"></script> <script src="./utils/SPFilterNode.js"></script> <script src="./utils/SPGetCurrentSite.js"></script> <script src="./utils/SPGetCurrentUser.js"></script> <script src="./utils/SPGetDisplayFromStatic.js"></script> <script src="./utils/SPGetStaticFromDisplay.js"></script> <script src="./utils/SPListNameFromUrl.js"></script> <script src="./utils/SPXmlToJson.js"></script> <script src="./value-added/SPArrangeChoices.js"></script> <script src="./value-added/SPAutocomplete.js"></script> <script src="./value-added/SPCascadeDropdowns.js"></script> <script src="./value-added/SPComplexToSimpleDropdown.js"></script> <script src="./value-added/SPDisplayRelatedInfo.js"></script> <script src="./value-added/SPFindMMSPicker.js"></script> <script src="./value-added/SPFindPeoplePicker.js"></script> <script src="./value-added/SPLookupAddNew.js"></script> <script src="./value-added/SPRedirectWithID.js"></script> <script src="./value-added/SPScriptAudit.js"></script> <script src="./value-added/SPSetMultiSelectSizes.js"></script> <script src="./value-added/SPUpdateMultipleListItems.js"></script> <!-- endbuild -->
{ "content_hash": "98dd67edf54d154a56f070c633eab0d3", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 66, "avg_line_length": 53.357142857142854, "alnum_prop": 0.7322623828647925, "repo_name": "sympmarc/SPServices", "id": "f32a98b3332ea4fdbd0d238b25b89d1bcecfd108", "size": "1494", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/SPServices.html", "mode": "33188", "license": "mit", "language": [ { "name": "ASP", "bytes": "6270" }, { "name": "CSS", "bytes": "443" }, { "name": "HTML", "bytes": "4868" }, { "name": "JavaScript", "bytes": "271391" } ], "symlink_target": "" }
'use strict'; const assert = require('assertthat'); const getMember = require('../../lib/consul/getMember'); suite('consul.getMember', () => { test('is a function.', async () => { assert.that(getMember).is.ofType('function'); }); test('throws error if agent is not initialized', async () => { await assert .that(async () => { await getMember.call({}); }) .is.throwingAsync('Agent not initialized.'); }); test('returns an error if querying Consul failed.', async () => { const agent = { async self() { throw new Error('foo'); } }; await assert .that(async () => { await getMember.call({ agent }); }) .is.throwingAsync('foo'); }); test('returns the member info provided by Consul.', async () => { const agent = { async self() { return { Config: { Datacenter: 'dc1', Domain: 'consul.', NodeName: 'server1' }, Member: { Name: 'foobar', Addr: '10.1.10.12', Port: 8301 } }; } }; const member = await getMember.call({ agent }); assert.that(member).is.equalTo({ Name: 'foobar', Addr: '10.1.10.12', Port: 8301 }); }); });
{ "content_hash": "0b00b2f354b71838ca244d048043e8ce", "timestamp": "", "source": "github", "line_count": 60, "max_line_length": 67, "avg_line_length": 21.8, "alnum_prop": 0.4938837920489297, "repo_name": "sealsystems/seal-consul", "id": "82e95732efd84570adeec31b6f78516c6315b34d", "size": "1308", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "test/consul/getMemberTest.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "47388" } ], "symlink_target": "" }
import imageUtils from '../../utils/images'; export const SELECT_ICON = "SELECT_ICON"; export const SAVING_INFO = "SAVING_INFO"; export function selectIcon(icon) { return { type: SELECT_ICON, payload: icon != null ? icon : imageUtils.getDefault(), }; } export function savingInfo(status) { return { type: SAVING_INFO, payload: status, }; }
{ "content_hash": "41e6b4b10abc6f82adf64fae86000848", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 63, "avg_line_length": 21.666666666666668, "alnum_prop": 0.6230769230769231, "repo_name": "JoaoCnh/picto-pc", "id": "f7aef4f0baf4f8d62a568f04ddbc2973c245dfcb", "size": "399", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/actions/profile/info.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "20895" }, { "name": "HTML", "bytes": "744" }, { "name": "JavaScript", "bytes": "74832" } ], "symlink_target": "" }
namespace Ignition.Foundation.Core.Factories { public sealed class MasterDatabaseType : IDatabaseType { public string GetDatabaseName() { return "master"; } } }
{ "content_hash": "dd808c9b98e4cda60b40ec482c230644", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 55, "avg_line_length": 17.4, "alnum_prop": 0.7298850574712644, "repo_name": "sitecoreignition/Ignition.Foundation", "id": "cd84314b4c4c2726a032e7fe9edadde965d9c7e0", "size": "176", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Ignition.Foundation.Core/Factories/MasterDatabaseType.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "56232" } ], "symlink_target": "" }
var expect = require('chai').expect; var jsonData = require('./fixture/flat'); var MemFS = require('../lib/memory-fs'); var memfs = new MemFS(jsonData); describe('Memory-FS getattr tests', function() { it('should getattr of /', function( done) { memfs.getattr('/', function(err, dir) { expect(err).to.be.null; expect(dir).to.be.an('object'); expect(dir.mode).to.equal(16832); done(); }); }); it('should getattr for /amadir', function(done) { memfs.getattr('/amadir', function(err, dir) { expect(err).to.be.null; expect(dir).to.be.an('object'); expect(dir.mode).to.equal(16832); expect(dir.mtime).to.be.a('date'); expect(dir.atime).to.be.a('date'); expect(dir.ctime).to.be.a('date'); done(); }); }); it('should handle not found /notexist', function(done) { memfs.getattr('/notexists', function(err, dir) { expect(dir).to.be.an('undefined'); expect(err).to.contain('Not Found'); done(); }); }); it('should getattr for /hello.txt', function(done) { memfs.getattr('/hello.txt', function(err, dir) { expect(err).to.be.null; expect(dir).to.be.an('object'); expect(dir.mode).to.equal(33152); expect(dir.mtime).to.be.a('date'); expect(dir.atime).to.be.a('date'); expect(dir.ctime).to.be.a('date'); done(); }); }); });
{ "content_hash": "b48b21d23c3cfacf771a763c9a611b5b", "timestamp": "", "source": "github", "line_count": 52, "max_line_length": 58, "avg_line_length": 26.78846153846154, "alnum_prop": 0.5786073223259153, "repo_name": "b37t1td/virtualfs-template", "id": "f1685e918e45b8e233a1935cd278292b127d2cdf", "size": "1393", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "tests/getattr-fs.spec.js", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "JavaScript", "bytes": "25445" }, { "name": "Shell", "bytes": "2301" } ], "symlink_target": "" }
Wallfetch is a simple python script that downloads wallpapers. --- Requires python3-requests library. usage: wallfetch.py [-s] [keyword] optional arguments: -s, --sfw show only safe for work wallpapers
{ "content_hash": "7f2183d441f9ec2f0c95add8f84cc675", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 62, "avg_line_length": 21, "alnum_prop": 0.7476190476190476, "repo_name": "Stocarson/wallfetch", "id": "3948353e5c9299689cf473546932a84402e6112d", "size": "223", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "mit", "language": [ { "name": "Python", "bytes": "1636" } ], "symlink_target": "" }
<?php namespace Magento\Catalog\Test\Unit\Controller\Adminhtml\Category; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; class DeleteTest extends \PHPUnit_Framework_TestCase { /** @var \Magento\Catalog\Controller\Adminhtml\Category\Delete */ protected $unit; /** @var \Magento\Backend\Model\View\Result\Redirect|\PHPUnit_Framework_MockObject_MockObject */ protected $resultRedirect; /** @var \Magento\Framework\App\RequestInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $request; /** @var \Magento\Catalog\Api\CategoryRepositoryInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $categoryRepository; /** @var \Magento\Backend\Model\Auth\StorageInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $authStorage; protected function setUp() { $context = $this->getMock('Magento\Backend\App\Action\Context', [], [], '', false); $resultRedirectFactory = $this->getMock( 'Magento\Backend\Model\View\Result\RedirectFactory', ['create'], [], '', false ); $this->request = $this->getMockForAbstractClass( 'Magento\Framework\App\RequestInterface', [], '', false, true, true, ['getParam', 'getPost'] ); $auth = $this->getMock( 'Magento\Backend\Model\Auth', ['getAuthStorage'], [], '', false ); $this->authStorage = $this->getMock( 'Magento\Backend\Model\Auth\StorageInterface', ['processLogin', 'processLogout', 'isLoggedIn', 'prolong', 'setDeletedPath'], [], '', false ); $eventManager = $this->getMockForAbstractClass( 'Magento\Framework\Event\ManagerInterface', [], '', false, true, true, ['dispatch'] ); $response = $this->getMockForAbstractClass( 'Magento\Framework\App\ResponseInterface', [], '', false ); $messageManager = $this->getMockForAbstractClass( 'Magento\Framework\Message\ManagerInterface', [], '', false, true, true, ['addSuccess'] ); $this->categoryRepository = $this->getMock('Magento\Catalog\Api\CategoryRepositoryInterface'); $context->expects($this->any()) ->method('getRequest') ->will($this->returnValue($this->request)); $context->expects($this->any()) ->method('getResponse') ->will($this->returnValue($response)); $context->expects($this->any()) ->method('getMessageManager') ->will($this->returnValue($messageManager)); $context->expects($this->any()) ->method('getEventManager') ->will($this->returnValue($eventManager)); $context->expects($this->any()) ->method('getAuth') ->will($this->returnValue($auth)); $context->expects($this->once())->method('getResultRedirectFactory')->willReturn($resultRedirectFactory); $auth->expects($this->any()) ->method('getAuthStorage') ->will($this->returnValue($this->authStorage)); $this->resultRedirect = $this->getMock('Magento\Backend\Model\View\Result\Redirect', [], [], '', false); $resultRedirectFactory->expects($this->any())->method('create')->willReturn($this->resultRedirect); $this->unit = (new ObjectManagerHelper($this))->getObject( 'Magento\Catalog\Controller\Adminhtml\Category\Delete', [ 'context' => $context, 'categoryRepository' => $this->categoryRepository ] ); } public function testDeleteWithoutCategoryId() { $this->request->expects($this->any())->method('getParam')->with('id')->willReturn(null); $this->resultRedirect->expects($this->once())->method('setPath') ->with('catalog/*/', ['_current' => true, 'id' => null]); $this->categoryRepository->expects($this->never())->method('get'); $this->unit->execute(); } public function testDelete() { $categoryId = 5; $parentId = 7; $this->request->expects($this->any())->method('getParam')->with('id')->willReturn($categoryId); $category = $this->getMock('Magento\Catalog\Model\Category', ['getParentId', 'getPath'], [], '', false); $category->expects($this->once())->method('getParentId')->willReturn($parentId); $category->expects($this->once())->method('getPath')->willReturn('category-path'); $this->categoryRepository->expects($this->once())->method('get')->with($categoryId)->willReturn($category); $this->authStorage->expects($this->once())->method('setDeletedPath')->with('category-path'); $this->resultRedirect->expects($this->once())->method('setPath') ->with('catalog/*/', ['_current' => true, 'id' => $parentId]); $this->unit->execute(); } }
{ "content_hash": "f34b505f5d6466263199df14de5fc38c", "timestamp": "", "source": "github", "line_count": 140, "max_line_length": 115, "avg_line_length": 37.792857142857144, "alnum_prop": 0.5656775656775657, "repo_name": "enettolima/magento-training", "id": "90508bd2962db2f0c767f415db9d865971d7aba4", "size": "5389", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "magento2ce/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Category/DeleteTest.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "22648" }, { "name": "CSS", "bytes": "3382928" }, { "name": "HTML", "bytes": "8749335" }, { "name": "JavaScript", "bytes": "7355635" }, { "name": "PHP", "bytes": "58607662" }, { "name": "Perl", "bytes": "10258" }, { "name": "Shell", "bytes": "41887" }, { "name": "XSLT", "bytes": "19889" } ], "symlink_target": "" }
<Alloy> <Window id="window" class="container"> <Module id="mapview" module="ti.map" method="createView" onClick="setLocation"> <Annotation id='hq' myid='1' /> </Module> </Window> </Alloy>
{ "content_hash": "1ffa05d7cc761ee041959f284e5e908b", "timestamp": "", "source": "github", "line_count": 7, "max_line_length": 83, "avg_line_length": 29.285714285714285, "alnum_prop": 0.6292682926829268, "repo_name": "davidfischer/setLocationBug", "id": "4a59bee4506ae1f469ac3797c7c45f08f1c77952", "size": "205", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/views/index.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "1276" }, { "name": "JavaScript", "bytes": "6198" }, { "name": "Python", "bytes": "5251" } ], "symlink_target": "" }
#ifndef LUDI_GRAPHICS_DOMAIN_STAGE_NULL_H_ #define LUDI_GRAPHICS_DOMAIN_STAGE_NULL_H_ #if LUDI_GRAPHICS_PLATFORM_ID == LUDI_GRAPHICS_PLATFORM_NULL namespace ludi { namespace graphics { /*! Represents a null domain shader stage. */ template <> class DomainStage_<LUDI_GRAPHICS_PLATFORM_NULL> : public DomainStage_<> { public: /*! Constructs a domain stage. */ DomainStage_() : DomainStage_<>() { /* nothing */ } /*! Destructor. */ virtual ~DomainStage_() { /* nothing */ } }; } // graphics } // ludi #endif // LUDI_GRAPHICS_PLATFORM_ID == LUDI_GRAPHICS_PLATFORM_NULL #endif // LUDI_GRAPHICS_DOMAIN_STAGE_NULL_H_
{ "content_hash": "bd875850fff40e381757a312f214e9c9", "timestamp": "", "source": "github", "line_count": 25, "max_line_length": 77, "avg_line_length": 27.4, "alnum_prop": 0.6291970802919709, "repo_name": "davidhuynh/ludi.graphics", "id": "d2068d09a77ac9b2805f058703253d7f93455f89", "size": "1820", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Source/Null/DomainStage.Null.h", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "4361" }, { "name": "C++", "bytes": "492370" } ], "symlink_target": "" }
<?php namespace PhpHooks\Command; use PhpHooks\Abstracts\BaseCommand; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Process\ProcessBuilder; /** * Class PhpmdCommand * * @package PhpHooks\Command */ class PhpmdCommand extends BaseCommand { /** * Configures the current command. */ protected function configure() { $this ->setName('phpmd'); } /** * @param InputInterface $input * @param OutputInterface $output * * @return void */ public function run(InputInterface $input, OutputInterface $output) { /* @var $configuration \PhpHooks\Configuration */ $configuration = unserialize($input->getArgument('configuration')); $files = unserialize($input->getArgument('files')); $processBuilder = new ProcessBuilder(); $processBuilder ->setPrefix(__DIR__ . '/../../../bin/phpmd'); foreach ($files as $file) { if (substr($file, -4, 4) !== '.php') { continue; } $processBuilder ->add($file) ->add('text') ->add(preg_replace('/\s+/', null, $configuration['phpmd']['ruleset'])); $this->doExecute($processBuilder); } } }
{ "content_hash": "23c6a2d05d4e54bed64f11b96604c450", "timestamp": "", "source": "github", "line_count": 55, "max_line_length": 87, "avg_line_length": 24.87272727272727, "alnum_prop": 0.5730994152046783, "repo_name": "tommy-muehle/php-hooks", "id": "b0c6f3f070d3822faa69a9458d779a156e8c70cd", "size": "1368", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/PhpHooks/Command/PhpmdCommand.php", "mode": "33188", "license": "mit", "language": [ { "name": "PHP", "bytes": "38860" } ], "symlink_target": "" }
Date.CultureInfo = { /* Culture Name */ name: "en-PH", englishName: "English (Republic of the Philippines)", nativeName: "English (Philippines)", /* Day Name Strings */ dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], abbreviatedDayNames: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], shortestDayNames: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], firstLetterDayNames: ["S", "M", "T", "W", "T", "F", "S"], /* Month Name Strings */ monthNames: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], abbreviatedMonthNames: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], /* AM/PM Designators */ amDesignator: "AM", pmDesignator: "PM", firstDayOfWeek: 0, twoDigitYearMax: 2029, /** * The dateElementOrder is based on the order of the * format specifiers in the formatPatterns.DatePattern. * * Example: <pre> shortDatePattern dateElementOrder ------------------ ---------------- "M/d/yyyy" "mdy" "dd/MM/yyyy" "dmy" "yyyy-MM-dd" "ymd" </pre> * The correct dateElementOrder is required by the parser to * determine the expected order of the date elements in the * string being parsed. * * NOTE: It is VERY important this value be correct for each Culture. */ dateElementOrder: "mdy", /* Standard date and time format patterns */ formatPatterns: { shortDate: "M/d/yyyy", longDate: "dddd, MMMM dd, yyyy", shortTime: "h:mm tt", longTime: "h:mm:ss tt", fullDateTime: "dddd, MMMM dd, yyyy h:mm:ss tt", sortableDateTime: "yyyy-MM-ddTHH:mm:ss", universalSortableDateTime: "yyyy-MM-dd HH:mm:ssZ", rfc1123: "ddd, dd MMM yyyy HH:mm:ss GMT", monthDay: "MMMM dd", yearMonth: "MMMM, yyyy" }, /** * NOTE: If a string format is not parsing correctly, but * you would expect it parse, the problem likely lies below. * * The following regex patterns control most of the string matching * within the parser. * * The Month name and Day name patterns were automatically generated * and in general should be (mostly) correct. * * Beyond the month and day name patterns are natural language strings. * Example: "next", "today", "months" * * These natural language string may NOT be correct for this culture. * If they are not correct, please translate and edit this file * providing the correct regular expression pattern. * * If you modify this file, please post your revised CultureInfo file * to the Datejs Discussions located at * http://groups.google.com/group/date-js * * Please mark the subject with [CultureInfo]. Example: * Subject: [CultureInfo] Translated "da-DK" Danish(Denmark) * * We will add the modified patterns to the master source files. * * As well, please review the list of "Future Strings" section below. */ regexPatterns: { jan: /^jan(uary)?/i, feb: /^feb(ruary)?/i, mar: /^mar(ch)?/i, apr: /^apr(il)?/i, may: /^may/i, jun: /^jun(e)?/i, jul: /^jul(y)?/i, aug: /^aug(ust)?/i, sep: /^sep(t(ember)?)?/i, oct: /^oct(ober)?/i, nov: /^nov(ember)?/i, dec: /^dec(ember)?/i, sun: /^su(n(day)?)?/i, mon: /^mo(n(day)?)?/i, tue: /^tu(e(s(day)?)?)?/i, wed: /^we(d(nesday)?)?/i, thu: /^th(u(r(s(day)?)?)?)?/i, fri: /^fr(i(day)?)?/i, sat: /^sa(t(urday)?)?/i, future: /^next/i, past: /^last|past|prev(ious)?/i, add: /^(\+|after|from)/i, subtract: /^(\-|before|ago)/i, yesterday: /^yesterday/i, today: /^t(oday)?/i, tomorrow: /^tomorrow/i, now: /^n(ow)?/i, millisecond: /^ms|milli(second)?s?/i, second: /^sec(ond)?s?/i, minute: /^min(ute)?s?/i, hour: /^h(ou)?rs?/i, week: /^w(ee)?k/i, month: /^m(o(nth)?s?)?/i, day: /^d(ays?)?/i, year: /^y((ea)?rs?)?/i, shortMeridian: /^(a|p)/i, longMeridian: /^(a\.?m?\.?|p\.?m?\.?)/i, timezone: /^((e(s|d)t|c(s|d)t|m(s|d)t|p(s|d)t)|((gmt)?\s*(\+|\-)\s*\d\d\d\d?)|gmt)/i, ordinalSuffix: /^\s*(st|nd|rd|th)/i, timeContext: /^\s*(\:|a|p)/i }, abbreviatedTimeZoneStandard: { GMT: "-000", EST: "-0400", CST: "-0500", MST: "-0600", PST: "-0700" }, abbreviatedTimeZoneDST: { GMT: "-000", EDT: "-0500", CDT: "-0600", MDT: "-0700", PDT: "-0800" } }; /******************** ** Future Strings ** ******************** * * The following list of strings are not currently being used, but * may be incorporated later. We would appreciate any help translating * the strings below. * * If you modify this file, please post your revised CultureInfo file * to the Datejs Discussions located at * http://groups.google.com/group/date-js * * Please mark the subject with [CultureInfo]. Example: * Subject: [CultureInfo] Translated "da-DK" Danish(Denmark) * * English Name Translated * ------------------ ----------------- * date date * time time * calendar calendar * show show * hourly hourly * daily daily * weekly weekly * bi-weekly bi-weekly * monthly monthly * bi-monthly bi-monthly * quarter quarter * quarterly quarterly * yearly yearly * annual annual * annually annually * annum annum * again again * between between * after after * from now from now * repeat repeat * times times * per per */
{ "content_hash": "b63c35caa37a43b7243ee7e7b9c347c8", "timestamp": "", "source": "github", "line_count": 180, "max_line_length": 139, "avg_line_length": 34.01111111111111, "alnum_prop": 0.5240117608624633, "repo_name": "taiducnguyen/fuckinggantt", "id": "a1b94d952f786bc6dd57d2ba72770469900e0a45", "size": "6436", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/libs/jquery-grantt/Scripts/Utils/globalization/en-PH.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "485631" }, { "name": "HTML", "bytes": "5508" }, { "name": "JavaScript", "bytes": "147208" }, { "name": "TypeScript", "bytes": "46124" } ], "symlink_target": "" }
<?php namespace Fly\Database\Schema\Grammars; use Fly\Support\Fluent; use Fly\Database\Schema\Blueprint; class PostgresGrammar extends Grammar { /** * The keyword identifier wrapper format. * * @var string */ protected $wrapper = '"%s"'; /** * The possible column modifiers. * * @var array */ protected $modifiers = array('Increment', 'Nullable', 'Default'); /** * The columns available as serials. * * @var array */ protected $serials = array('bigInteger', 'integer'); /** * Compile the query to determine if a table exists. * * @return string */ public function compileTableExists() { return 'select * from information_schema.tables where table_name = ?'; } /** * Compile the query to determine the list of columns. * * @param string $table * @return string */ public function compileColumnExists($table) { return "select column_name from information_schema.columns where table_name = '$table'"; } /** * Compile a create table command. * * @param \Fly\Database\Schema\Blueprint $blueprint * @param \Fly\Support\Fluent $command * @return string */ public function compileCreate(Blueprint $blueprint, Fluent $command) { $columns = implode(', ', $this->getColumns($blueprint)); return 'create table '.$this->wrapTable($blueprint)." ($columns)"; } /** * Compile a create table command. * * @param \Fly\Database\Schema\Blueprint $blueprint * @param \Fly\Support\Fluent $command * @return string */ public function compileAdd(Blueprint $blueprint, Fluent $command) { $table = $this->wrapTable($blueprint); $columns = $this->prefixArray('add column', $this->getColumns($blueprint)); return 'alter table '.$table.' '.implode(', ', $columns); } /** * Compile a primary key command. * * @param \Fly\Database\Schema\Blueprint $blueprint * @param \Fly\Support\Fluent $command * @return string */ public function compilePrimary(Blueprint $blueprint, Fluent $command) { $columns = $this->columnize($command->columns); return 'alter table '.$this->wrapTable($blueprint)." add primary key ({$columns})"; } /** * Compile a unique key command. * * @param \Fly\Database\Schema\Blueprint $blueprint * @param \Fly\Support\Fluent $command * @return string */ public function compileUnique(Blueprint $blueprint, Fluent $command) { $table = $this->wrapTable($blueprint); $columns = $this->columnize($command->columns); return "alter table $table add constraint {$command->index} unique ($columns)"; } /** * Compile a plain index key command. * * @param \Fly\Database\Schema\Blueprint $blueprint * @param \Fly\Support\Fluent $command * @return string */ public function compileIndex(Blueprint $blueprint, Fluent $command) { $columns = $this->columnize($command->columns); return "create index {$command->index} on ".$this->wrapTable($blueprint)." ({$columns})"; } /** * Compile a drop table command. * * @param \Fly\Database\Schema\Blueprint $blueprint * @param \Fly\Support\Fluent $command * @return string */ public function compileDrop(Blueprint $blueprint, Fluent $command) { return 'drop table '.$this->wrapTable($blueprint); } /** * Compile a drop table (if exists) command. * * @param \Fly\Database\Schema\Blueprint $blueprint * @param \Fly\Support\Fluent $command * @return string */ public function compileDropIfExists(Blueprint $blueprint, Fluent $command) { return 'drop table if exists '.$this->wrapTable($blueprint); } /** * Compile a drop column command. * * @param \Fly\Database\Schema\Blueprint $blueprint * @param \Fly\Support\Fluent $command * @return string */ public function compileDropColumn(Blueprint $blueprint, Fluent $command) { $columns = $this->prefixArray('drop column', $this->wrapArray($command->columns)); $table = $this->wrapTable($blueprint); return 'alter table '.$table.' '.implode(', ', $columns); } /** * Compile a drop primary key command. * * @param \Fly\Database\Schema\Blueprint $blueprint * @param \Fly\Support\Fluent $command * @return string */ public function compileDropPrimary(Blueprint $blueprint, Fluent $command) { $table = $blueprint->getTable(); return 'alter table '.$this->wrapTable($blueprint)." drop constraint {$table}_pkey"; } /** * Compile a drop unique key command. * * @param \Fly\Database\Schema\Blueprint $blueprint * @param \Fly\Support\Fluent $command * @return string */ public function compileDropUnique(Blueprint $blueprint, Fluent $command) { $table = $this->wrapTable($blueprint); return "alter table {$table} drop constraint {$command->index}"; } /** * Compile a drop index command. * * @param \Fly\Database\Schema\Blueprint $blueprint * @param \Fly\Support\Fluent $command * @return string */ public function compileDropIndex(Blueprint $blueprint, Fluent $command) { return "drop index {$command->index}"; } /** * Compile a drop foreign key command. * * @param \Fly\Database\Schema\Blueprint $blueprint * @param \Fly\Support\Fluent $command * @return string */ public function compileDropForeign(Blueprint $blueprint, Fluent $command) { $table = $this->wrapTable($blueprint); return "alter table {$table} drop constraint {$command->index}"; } /** * Compile a rename table command. * * @param \Fly\Database\Schema\Blueprint $blueprint * @param \Fly\Support\Fluent $command * @return string */ public function compileRename(Blueprint $blueprint, Fluent $command) { $from = $this->wrapTable($blueprint); return "alter table {$from} rename to ".$this->wrapTable($command->to); } /** * Create the column definition for a string type. * * @param \Fly\Support\Fluent $column * @return string */ protected function typeString(Fluent $column) { return "varchar({$column->length})"; } /** * Create the column definition for a text type. * * @param \Fly\Support\Fluent $column * @return string */ protected function typeText(Fluent $column) { return 'text'; } /** * Create the column definition for a medium text type. * * @param \Fly\Support\Fluent $column * @return string */ protected function typeMediumText(Fluent $column) { return 'text'; } /** * Create the column definition for a long text type. * * @param \Fly\Support\Fluent $column * @return string */ protected function typeLongText(Fluent $column) { return 'text'; } /** * Create the column definition for a integer type. * * @param \Fly\Support\Fluent $column * @return string */ protected function typeInteger(Fluent $column) { return $column->autoIncrement ? 'serial' : 'integer'; } /** * Create the column definition for a big integer type. * * @param \Fly\Support\Fluent $column * @return string */ protected function typeBigInteger(Fluent $column) { return $column->autoIncrement ? 'bigserial' : 'bigint'; } /** * Create the column definition for a medium integer type. * * @param \Fly\Support\Fluent $column * @return string */ protected function typeMediumInteger(Fluent $column) { return 'integer'; } /** * Create the column definition for a tiny integer type. * * @param \Fly\Support\Fluent $column * @return string */ protected function typeTinyInteger(Fluent $column) { return 'smallint'; } /** * Create the column definition for a small integer type. * * @param \Fly\Support\Fluent $column * @return string */ protected function typeSmallInteger(Fluent $column) { return 'smallint'; } /** * Create the column definition for a float type. * * @param \Fly\Support\Fluent $column * @return string */ protected function typeFloat(Fluent $column) { return 'real'; } /** * Create the column definition for a double type. * * @param \Fly\Support\Fluent $column * @return string */ protected function typeDouble(Fluent $column) { return 'double precision'; } /** * Create the column definition for a decimal type. * * @param \Fly\Support\Fluent $column * @return string */ protected function typeDecimal(Fluent $column) { return "decimal({$column->total}, {$column->places})"; } /** * Create the column definition for a boolean type. * * @param \Fly\Support\Fluent $column * @return string */ protected function typeBoolean(Fluent $column) { return 'boolean'; } /** * Create the column definition for an enum type. * * @param \Fly\Support\Fluent $column * @return string */ protected function typeEnum(Fluent $column) { $allowed = array_map(function($a) { return "'".$a."'"; }, $column->allowed); return "varchar(255) check ({$column->name} in (".implode(', ', $allowed)."))"; } /** * Create the column definition for a date type. * * @param \Fly\Support\Fluent $column * @return string */ protected function typeDate(Fluent $column) { return 'date'; } /** * Create the column definition for a date-time type. * * @param \Fly\Support\Fluent $column * @return string */ protected function typeDateTime(Fluent $column) { return 'timestamp'; } /** * Create the column definition for a time type. * * @param \Fly\Support\Fluent $column * @return string */ protected function typeTime(Fluent $column) { return 'time'; } /** * Create the column definition for a timestamp type. * * @param \Fly\Support\Fluent $column * @return string */ protected function typeTimestamp(Fluent $column) { return 'timestamp'; } /** * Create the column definition for a binary type. * * @param \Fly\Support\Fluent $column * @return string */ protected function typeBinary(Fluent $column) { return 'bytea'; } /** * Get the SQL for a nullable column modifier. * * @param \Fly\Database\Schema\Blueprint $blueprint * @param \Fly\Support\Fluent $column * @return string|null */ protected function modifyNullable(Blueprint $blueprint, Fluent $column) { return $column->nullable ? ' null' : ' not null'; } /** * Get the SQL for a default column modifier. * * @param \Fly\Database\Schema\Blueprint $blueprint * @param \Fly\Support\Fluent $column * @return string|null */ protected function modifyDefault(Blueprint $blueprint, Fluent $column) { if ( ! is_null($column->default)) { return " default ".$this->getDefaultValue($column->default); } } /** * Get the SQL for an auto-increment column modifier. * * @param \Fly\Database\Schema\Blueprint $blueprint * @param \Fly\Support\Fluent $column * @return string|null */ protected function modifyIncrement(Blueprint $blueprint, Fluent $column) { if (in_array($column->type, $this->serials) and $column->autoIncrement) { return ' primary key'; } } }
{ "content_hash": "e0a95ca8e32dbb247aea12ff5857db18", "timestamp": "", "source": "github", "line_count": 485, "max_line_length": 91, "avg_line_length": 22.523711340206187, "alnum_prop": 0.6629439765653606, "repo_name": "flyphp/flyframework", "id": "74c6ffddd59365c1dc6c5091b77cfe9aade2173f", "size": "10924", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/Fly/Database/Schema/Grammars/PostgresGrammar.php", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "13460" }, { "name": "PHP", "bytes": "2021436" } ], "symlink_target": "" }
class DockerMachineCompletion < Formula desc "Docker-machine completion script" homepage "https://docs.docker.com/machine/completion/" url "https://github.com/docker/machine/archive/v0.16.0.tar.gz" sha256 "42342b21410cc29d71ca4d5b25e17eeaf20f21a0f3b825e702a7ddcff5adcb16" head "https://github.com/docker/machine.git" bottle :unneeded conflicts_with "docker-machine", :because => "docker-machine already includes completion scripts" def install bash_completion.install Dir["contrib/completion/bash/*.bash"] zsh_completion.install "contrib/completion/zsh/_docker-machine" end test do assert_match "-F _docker_machine", shell_output("bash -O extglob -c 'source #{bash_completion}/docker-machine.bash && complete -p docker-machine'") end end
{ "content_hash": "a51de09d5493f9236b050684b9033919", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 118, "avg_line_length": 35.72727272727273, "alnum_prop": 0.7493638676844784, "repo_name": "adamliter/homebrew-core", "id": "1f005ab8bedec234e76f8e2989a0909a70366a3a", "size": "786", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "Formula/docker-machine-completion.rb", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "Perl", "bytes": "628" }, { "name": "Ruby", "bytes": "8076358" } ], "symlink_target": "" }
function Swipe(container, options) { "use strict"; // utilities var noop = function() {}; // simple no operation function var offloadFn = function(fn) { setTimeout(fn || noop, 0) }; // offload a functions execution // check browser capabilities var browser = { addEventListener: !!window.addEventListener, touch: ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch, transitions: (function(temp) { var props = ['transitionProperty', 'WebkitTransition', 'MozTransition', 'OTransition', 'msTransition']; for ( var i in props ) if (temp.style[ props[i] ] !== undefined) return true; return false; })(document.createElement('swipe')) }; // quit if no root element if (!container) return; var element = container.children[0]; var slides, slidePos, width, length; options = options || {}; var index = parseInt(options.startSlide, 10) || 0; var speed = options.speed || 300; options.continuous = options.continuous !== undefined ? options.continuous : true; function setup() { // cache slides slides = element.children; length = slides.length; // set continuous to false if only one slide if (slides.length < 2) options.continuous = false; //special case if two slides if (browser.transitions && options.continuous && slides.length < 3) { element.appendChild(slides[0].cloneNode(true)); element.appendChild(element.children[1].cloneNode(true)); slides = element.children; } // create an array to store current positions of each slide slidePos = new Array(slides.length); // determine width of each slide width = container.getBoundingClientRect().width || container.offsetWidth; element.style.width = (slides.length * width) + 'px'; // stack elements var pos = slides.length; while(pos--) { var slide = slides[pos]; slide.style.width = width + 'px'; slide.setAttribute('data-index', pos); if (browser.transitions) { slide.style.left = (pos * -width) + 'px'; move(pos, index > pos ? -width : (index < pos ? width : 0), 0); } } // reposition elements before and after index if (options.continuous && browser.transitions) { move(circle(index-1), -width, 0); move(circle(index+1), width, 0); } if (!browser.transitions) element.style.left = (index * -width) + 'px'; container.style.visibility = 'visible'; } function prev() { if (options.continuous) slide(index-1); else if (index) slide(index-1); } function next() { if (options.continuous) slide(index+1); else if (index < slides.length - 1) slide(index+1); } function circle(index) { // a simple positive modulo using slides.length return (slides.length + (index % slides.length)) % slides.length; } function slide(to, slideSpeed) { // do nothing if already on requested slide if (index == to) return; if (browser.transitions) { var direction = Math.abs(index-to) / (index-to); // 1: backward, -1: forward // get the actual position of the slide if (options.continuous) { var natural_direction = direction; direction = -slidePos[circle(to)] / width; // if going forward but to < index, use to = slides.length + to // if going backward but to > index, use to = -slides.length + to if (direction !== natural_direction) to = -direction * slides.length + to; } var diff = Math.abs(index-to) - 1; // move all the slides between index and to in the right direction while (diff--) move( circle((to > index ? to : index) - diff - 1), width * direction, 0); to = circle(to); move(index, width * direction, slideSpeed || speed); move(to, 0, slideSpeed || speed); if (options.continuous) move(circle(to - direction), -(width * direction), 0); // we need to get the next in place } else { to = circle(to); animate(index * -width, to * -width, slideSpeed || speed); //no fallback for a circular continuous if the browser does not accept transitions } index = to; offloadFn(options.callback && options.callback(index, slides[index])); } function move(index, dist, speed) { translate(index, dist, speed); slidePos[index] = dist; } function translate(index, dist, speed) { var slide = slides[index]; var style = slide && slide.style; if (!style) return; style.webkitTransitionDuration = style.MozTransitionDuration = style.msTransitionDuration = style.OTransitionDuration = style.transitionDuration = speed + 'ms'; style.webkitTransform = 'translate(' + dist + 'px,0)' + 'translateZ(0)'; style.msTransform = style.MozTransform = style.OTransform = 'translateX(' + dist + 'px)'; } function animate(from, to, speed) { // if not an animation, just reposition if (!speed) { element.style.left = to + 'px'; return; } var start = +new Date; var timer = setInterval(function() { var timeElap = +new Date - start; if (timeElap > speed) { element.style.left = to + 'px'; if (delay) begin(); options.transitionEnd && options.transitionEnd.call(event, index, slides[index]); clearInterval(timer); return; } element.style.left = (( (to - from) * (Math.floor((timeElap / speed) * 100) / 100) ) + from) + 'px'; }, 4); } // setup auto slideshow var delay = options.auto || 0; var interval; function begin() { interval = setTimeout(next, delay); } function stop() { delay = 0; clearTimeout(interval); } // setup initial vars var start = {}; var delta = {}; var isScrolling; // setup event capturing var events = { handleEvent: function(event) { switch (event.type) { case 'touchstart': this.start(event); break; case 'touchmove': this.move(event); break; case 'touchend': offloadFn(this.end(event)); break; case 'webkitTransitionEnd': case 'msTransitionEnd': case 'oTransitionEnd': case 'otransitionend': case 'transitionend': offloadFn(this.transitionEnd(event)); break; case 'resize': offloadFn(setup); break; } if (options.stopPropagation) event.stopPropagation(); }, start: function(event) { var touches = event.touches[0]; // measure start values start = { // get initial touch coords x: touches.pageX, y: touches.pageY, // store time to determine touch duration time: +new Date }; // used for testing first move event isScrolling = undefined; // reset delta and end measurements delta = {}; // attach touchmove and touchend listeners element.addEventListener('touchmove', this, false); element.addEventListener('touchend', this, false); }, move: function(event) { // ensure swiping with one touch and not pinching if ( event.touches.length > 1 || event.scale && event.scale !== 1) return if (options.disableScroll) event.preventDefault(); var touches = event.touches[0]; // measure change in x and y delta = { x: touches.pageX - start.x, y: touches.pageY - start.y } // determine if scrolling test has run - one time test if ( typeof isScrolling == 'undefined') { isScrolling = !!( isScrolling || Math.abs(delta.x) < Math.abs(delta.y) ); } // if user is not trying to scroll vertically if (!isScrolling) { // prevent native scrolling event.preventDefault(); // stop slideshow stop(); // increase resistance if first or last slide if (options.continuous) { // we don't add resistance at the end translate(circle(index-1), delta.x + slidePos[circle(index-1)], 0); translate(index, delta.x + slidePos[index], 0); translate(circle(index+1), delta.x + slidePos[circle(index+1)], 0); } else { delta.x = delta.x / ( (!index && delta.x > 0 // if first slide and sliding left || index == slides.length - 1 // or if last slide and sliding right && delta.x < 0 // and if sliding at all ) ? ( Math.abs(delta.x) / width + 1 ) // determine resistance level : 1 ); // no resistance if false // translate 1:1 translate(index-1, delta.x + slidePos[index-1], 0); translate(index, delta.x + slidePos[index], 0); translate(index+1, delta.x + slidePos[index+1], 0); } } }, end: function(event) { // measure duration var duration = +new Date - start.time; // determine if slide attempt triggers next/prev slide var isValidSlide = Number(duration) < 250 // if slide duration is less than 250ms && Math.abs(delta.x) > 20 // and if slide amt is greater than 20px || Math.abs(delta.x) > width/2; // or if slide amt is greater than half the width // determine if slide attempt is past start and end var isPastBounds = !index && delta.x > 0 // if first slide and slide amt is greater than 0 || index == slides.length - 1 && delta.x < 0; // or if last slide and slide amt is less than 0 if (options.continuous) isPastBounds = false; // determine direction of swipe (true:right, false:left) var direction = delta.x < 0; // if not scrolling vertically if (!isScrolling) { if (isValidSlide && !isPastBounds) { if (direction) { if (options.continuous) { // we need to get the next in this direction in place move(circle(index-1), -width, 0); move(circle(index+2), width, 0); } else { move(index-1, -width, 0); } move(index, slidePos[index]-width, speed); move(circle(index+1), slidePos[circle(index+1)]-width, speed); index = circle(index+1); } else { if (options.continuous) { // we need to get the next in this direction in place move(circle(index+1), width, 0); move(circle(index-2), -width, 0); } else { move(index+1, width, 0); } move(index, slidePos[index]+width, speed); move(circle(index-1), slidePos[circle(index-1)]+width, speed); index = circle(index-1); } options.callback && options.callback(index, slides[index]); } else { if (options.continuous) { move(circle(index-1), -width, speed); move(index, 0, speed); move(circle(index+1), width, speed); } else { move(index-1, -width, speed); move(index, 0, speed); move(index+1, width, speed); } } } // kill touchmove and touchend event listeners until touchstart called again element.removeEventListener('touchmove', events, false) element.removeEventListener('touchend', events, false) }, transitionEnd: function(event) { if (parseInt(event.target.getAttribute('data-index'), 10) == index) { if (delay) begin(); options.transitionEnd && options.transitionEnd.call(event, index, slides[index]); } } } // trigger setup setup(); // start auto slideshow if applicable if (delay) begin(); // add event listeners if (browser.addEventListener) { // set touchstart event on element if (browser.touch) element.addEventListener('touchstart', events, false); if (browser.transitions) { element.addEventListener('webkitTransitionEnd', events, false); element.addEventListener('msTransitionEnd', events, false); element.addEventListener('oTransitionEnd', events, false); element.addEventListener('otransitionend', events, false); element.addEventListener('transitionend', events, false); } // set resize event on window window.addEventListener('resize', events, false); } else { window.onresize = function () { setup() }; // to play nice with old IE } // expose the Swipe API return { setup: function() { setup(); }, slide: function(to, speed) { // cancel slideshow stop(); slide(to, speed); }, prev: function() { // cancel slideshow stop(); prev(); }, next: function() { // cancel slideshow stop(); next(); }, stop: function() { // cancel slideshow stop(); }, getPos: function() { // return current index position return index; }, getNumSlides: function() { // return total number of slides return length; }, kill: function() { // cancel slideshow stop(); // reset element element.style.width = ''; element.style.left = ''; // reset slides var pos = slides.length; while(pos--) { var slide = slides[pos]; slide.style.width = ''; slide.style.left = ''; if (browser.transitions) translate(pos, 0, 0); } // removed event listeners if (browser.addEventListener) { // remove current event listeners element.removeEventListener('touchstart', events, false); element.removeEventListener('webkitTransitionEnd', events, false); element.removeEventListener('msTransitionEnd', events, false); element.removeEventListener('oTransitionEnd', events, false); element.removeEventListener('otransitionend', events, false); element.removeEventListener('transitionend', events, false); window.removeEventListener('resize', events, false); } else { window.onresize = null; } } } } module.exports = Swipe; if ( window.jQuery || window.Zepto ) { (function($) { $.fn.Swipe = function(params) { return this.each(function() { $(this).data('Swipe', new Swipe($(this)[0], params)); }); } })( window.jQuery || window.Zepto ) }
{ "content_hash": "387138c03e4877dacc67b89a869f29b6", "timestamp": "", "source": "github", "line_count": 566, "max_line_length": 120, "avg_line_length": 25.680212014134277, "alnum_prop": 0.5852081183350534, "repo_name": "janmi/website", "id": "ea3d39cedb25e4a5d526c1d2d4ace384906a67ea", "size": "14643", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "static/libs/swipe/swipe.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "45540" }, { "name": "HTML", "bytes": "1033" }, { "name": "JavaScript", "bytes": "186760" }, { "name": "Vue", "bytes": "24262" } ], "symlink_target": "" }
"""A simple example to test the a DistributionStrategy with Estimators. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow as tf from tensorflow.python.keras import metrics as metrics_module def build_model_fn_optimizer(): """Simple model_fn with optimizer.""" # TODO(anjalisridhar): Move this inside the model_fn once OptimizerV2 is # done? optimizer = tf.train.GradientDescentOptimizer(0.2) def model_fn(features, labels, mode): # pylint: disable=unused-argument """model_fn which uses a single unit Dense layer.""" # You can also use the Flatten layer if you want to test a model without any # weights. layer = tf.layers.Dense(1, use_bias=True) logits = layer(features) if mode == tf.estimator.ModeKeys.PREDICT: predictions = {"logits": logits} return tf.estimator.EstimatorSpec(mode, predictions=predictions) def loss_fn(): y = tf.reshape(logits, []) - tf.constant(1.) return y * y if mode == tf.estimator.ModeKeys.EVAL: acc_obj = metrics_module.BinaryAccuracy() acc_obj.update_state(labels, labels) return tf.estimator.EstimatorSpec( mode, loss=loss_fn(), eval_metric_ops={"Accuracy": acc_obj}) assert mode == tf.estimator.ModeKeys.TRAIN global_step = tf.train.get_global_step() train_op = optimizer.minimize(loss_fn(), global_step=global_step) return tf.estimator.EstimatorSpec(mode, loss=loss_fn(), train_op=train_op) return model_fn def main(_): distribution = tf.contrib.distribute.MirroredStrategy( ["/device:GPU:0", "/device:GPU:1"]) config = tf.estimator.RunConfig(train_distribute=distribution, eval_distribute=distribution) # Since there are 2 devices and 10 samples, we set steps=5. steps = 5 def train_input_fn(): features = tf.data.Dataset.from_tensors([[1.]]).repeat(10) labels = tf.data.Dataset.from_tensors([1.]).repeat(10) return tf.data.Dataset.zip((features, labels)) estimator = tf.estimator.Estimator( model_fn=build_model_fn_optimizer(), config=config) estimator.train(input_fn=train_input_fn, steps=steps) def eval_input_fn(): features = tf.data.Dataset.from_tensors([[1.]]).repeat(10) labels = tf.data.Dataset.from_tensors([1.]).repeat(10) return tf.data.Dataset.zip((features, labels)) eval_result = estimator.evaluate(input_fn=eval_input_fn, steps=steps) print("Eval result: {}".format(eval_result)) assert eval_result["Accuracy"] == 1.0 def predict_input_fn(): predict_features = tf.data.Dataset.from_tensors([[1.]]).repeat(10) return predict_features prediction_iterable = estimator.predict(input_fn=predict_input_fn) # Create a list containing each of the prediction dictionaries that map # the key 'logits' to an array of model outputs. predictions = [prediction_iterable.next() for _ in range(10)] print("Prediction results: {}".format(predictions)) if __name__ == "__main__": tf.app.run()
{ "content_hash": "0efe028daa178212e1059a86c0f2e6db", "timestamp": "", "source": "github", "line_count": 88, "max_line_length": 80, "avg_line_length": 34.71590909090909, "alnum_prop": 0.6880523731587561, "repo_name": "ageron/tensorflow", "id": "cfaee03a2003089366a506168be2942c279f45bf", "size": "3744", "binary": false, "copies": "7", "ref": "refs/heads/master", "path": "tensorflow/contrib/distribute/python/examples/simple_estimator_example.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Assembly", "bytes": "3560" }, { "name": "Batchfile", "bytes": "14734" }, { "name": "C", "bytes": "644380" }, { "name": "C#", "bytes": "8446" }, { "name": "C++", "bytes": "59281238" }, { "name": "CMake", "bytes": "207169" }, { "name": "Dockerfile", "bytes": "75509" }, { "name": "Go", "bytes": "1501606" }, { "name": "HTML", "bytes": "4680118" }, { "name": "Java", "bytes": "908340" }, { "name": "Jupyter Notebook", "bytes": "2510253" }, { "name": "LLVM", "bytes": "6536" }, { "name": "Makefile", "bytes": "94466" }, { "name": "Objective-C", "bytes": "60069" }, { "name": "Objective-C++", "bytes": "118322" }, { "name": "PHP", "bytes": "15024" }, { "name": "Pascal", "bytes": "617" }, { "name": "Perl", "bytes": "7536" }, { "name": "PureBasic", "bytes": "25356" }, { "name": "Python", "bytes": "46230508" }, { "name": "RobotFramework", "bytes": "891" }, { "name": "Ruby", "bytes": "838" }, { "name": "Shell", "bytes": "481859" }, { "name": "Smarty", "bytes": "27249" }, { "name": "Swift", "bytes": "53109" } ], "symlink_target": "" }
using UnityEngine; namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAudioSource { [TaskCategory("Basic/AudioSource")] [TaskDescription("Stores the max distance value of the AudioSource. Returns Success.")] public class GetMaxDistance : Action { [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] public SharedGameObject targetGameObject; [Tooltip("The max distance value of the AudioSource")] [RequiredField] public SharedFloat storeValue; private AudioSource audioSource; private GameObject prevGameObject; public override void OnStart() { var currentGameObject = GetDefaultGameObject(targetGameObject.Value); if (currentGameObject != prevGameObject) { audioSource = currentGameObject.GetComponent<AudioSource>(); prevGameObject = currentGameObject; } } public override TaskStatus OnUpdate() { if (audioSource == null) { Debug.LogWarning("AudioSource is null"); return TaskStatus.Failure; } storeValue.Value = audioSource.maxDistance; return TaskStatus.Success; } public override void OnReset() { targetGameObject = null; storeValue = 1; } } }
{ "content_hash": "ee59be70656803c1dc8433862e1b92a1", "timestamp": "", "source": "github", "line_count": 45, "max_line_length": 99, "avg_line_length": 31.444444444444443, "alnum_prop": 0.6176678445229682, "repo_name": "yantian001/3DHunter", "id": "9031b0d315cb8c49ce21738b4673c10296bd57cc", "size": "1415", "binary": false, "copies": "5", "ref": "refs/heads/master", "path": "Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetMaxDistance.cs", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "C#", "bytes": "1112193" }, { "name": "GLSL", "bytes": "3414" }, { "name": "JavaScript", "bytes": "27331" } ], "symlink_target": "" }
module DdaExpendituresHelper end
{ "content_hash": "731e7673e6913fa65720b5518b278dc5", "timestamp": "", "source": "github", "line_count": 2, "max_line_length": 28, "avg_line_length": 16.5, "alnum_prop": 0.9090909090909091, "repo_name": "uclibs/tricerashopper", "id": "16160db04bd176f6eab9a6e8186d8ee5c047356d", "size": "33", "binary": false, "copies": "2", "ref": "refs/heads/develop", "path": "app/helpers/dda_expenditures_helper.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "2749" }, { "name": "CoffeeScript", "bytes": "1159" }, { "name": "HTML", "bytes": "55362" }, { "name": "JavaScript", "bytes": "694" }, { "name": "Ruby", "bytes": "108433" } ], "symlink_target": "" }
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>Melissa McCoy</title> <link href="stylesheets/reset.css" type="text/css" rel="stylesheet"> <link href="stylesheets/blog.css" type="text/css" rel="stylesheet"> </head> <body> <div id="header"> <div class="container"> <div class="logo"> <h1>Melissa McCoy</h1> <h2>Entrepreneur | Engineer | Sweets Lover</h2> </div> <div class="nav"> <ul> <li><a href="about_me.html">About Me</a></li> <li><a href="week3_cultural_blog.html">Culture</a></li> <li><a href="week3_technical.html">Tech</a></li> <li><a href="index.html">Home</a></li> </ul> </div> </div> </div> <div id="content" style="height:1800px;"> <div class="container"> <h1>JavaScript: The Good, The Bad, and The Ugly</h1> <h2>June 1, 2014</h2> <div id="text"> <p><span class="bullet">Amazon.com</span><br />When did my love affair with Amazon begin? I believe it was freshman year of college, when I was discovering many new things, and this handsome, confident, attractively geek-ish web service bummed into my email inbox: Amazon Prime. Everything that I could ever want or need was now made available to me within 2 business days absolutely free. It had every quality I looked for in an e commerce platform and I've been faithful ever since. </p> <p>Amazon.com's homepage has a clean, friendly, personalized, organized, and inviting quality to it, which aligns with what the company's service. Taking a more critical approach, I might say the homepage is rather "busy" with many product suggestions and ads scattered about. But given most people immediately go to the search bar upon entering the site, I believe the homepage space, under the navigation header, is less about helping you navigate the website and more about catching your attention with something you'd like to buy which makes "business" understandable.</p> <p><span class="bullet">Pandora.com</span><br />While Pandora is more of a web app rather than the kind of website that the assignment questions refer to, I couldn't leave it out. Pandora first exposed me to music outside of radio and adeptly curated my interest in music. The website's layout is exception with a fixed header of control buttons (play, pause, etc) and a "quick reference" section at the bottom that describes the artist and the song. I find this bottom section extremely useful, as I don't have to take time to google the artist and ultimately get distracted, and I can view a further description without stopping the music. I would say the interface is cool, clean, informative, and easy-to-navigate. </p> <p><span class="bullet">FareCompare.com</span><br />In my past life, I booked a lot of international flights and farecompare.com as my go-to service. It excelled in including more airlines than any other travel site (eg some budget airlines are not listed on Kayak, etc) and in providing a plethora of filtering options. In terms of interface, the homepage focus it's "above the fold" space on an app-like area where you can type your desired flight details - this is perfect. In terms of feel, it has a somewhat bland complexion and I supposed I'd describe it as basic, functional, and professional.</p> </div> <div id ="sidebar"> <ul> <li><a href="week2_technical.html">Week 2 - The Display Attribute</a></li> <li><a href="week3_technical.html">Week 3 - Why Javascript?</a></li> </ul> </div> </div> </div> <div id="footer"> <div class="container"> <div class="nav"> <ul> <li><a href="index.html">Home</a></li> <li><a href="week3_technical.html">Tech</a></li> <li><a href="week3_cultural_blog.html">Culture</a></li> <li><a href="about_me.html">About Me</a></li> </ul> </div> <p>© 2014 Melissa McCoy No Rights Reserved</p> </div> </body></html> <!DOCTYPE html>
{ "content_hash": "74ac9918d68f34de3ecc7e153a3e0b84", "timestamp": "", "source": "github", "line_count": 74, "max_line_length": 735, "avg_line_length": 58.4054054054054, "alnum_prop": 0.6425266080518278, "repo_name": "melissa-mccoy/melissa-mccoy.github.io", "id": "faa22df3afb05b9d60b0e306d0e9324838b8ee82", "size": "4323", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "unit1_projects/week1_technical_blog.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "30062" } ], "symlink_target": "" }
#ifndef NETWORKINTERFACE_TESTS_H #define NETWORKINTERFACE_TESTS_H /* * Test cases */ void NETWORKINTERFACE_STATUS(); void NETWORKINTERFACE_STATUS_NONBLOCK(); void NETWORKINTERFACE_STATUS_GET(); void NETWORKINTERFACE_CONN_DISC_REPEAT(); #endif //NETWORKINTERFACE_TESTS_H
{ "content_hash": "06906b75df844c5e5ce04ee5db8fbe00", "timestamp": "", "source": "github", "line_count": 14, "max_line_length": 41, "avg_line_length": 19.714285714285715, "alnum_prop": 0.7789855072463768, "repo_name": "betzw/mbed-os", "id": "d3d0293d2e1907ec17c669f47e0179ec8d5c1913", "size": "931", "binary": false, "copies": "29", "ref": "refs/heads/master", "path": "TESTS/network/interface/networkinterface_tests.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "AMPL", "bytes": "10950" }, { "name": "Assembly", "bytes": "7623507" }, { "name": "Batchfile", "bytes": "22" }, { "name": "C", "bytes": "374441509" }, { "name": "C++", "bytes": "14180257" }, { "name": "CMake", "bytes": "22983" }, { "name": "HTML", "bytes": "1421788" }, { "name": "Makefile", "bytes": "119198" }, { "name": "Objective-C", "bytes": "74923" }, { "name": "Perl", "bytes": "2589" }, { "name": "Python", "bytes": "1347030" }, { "name": "Shell", "bytes": "88415" }, { "name": "XSLT", "bytes": "8394" } ], "symlink_target": "" }
import unittest import provider.lax_provider as lax_provider import tests.settings_mock as settings_mock import base64 import json import tests.test_data as test_data from provider.lax_provider import ErrorCallingLaxException from mock import mock, patch, MagicMock from ddt import ddt, data, unpack @ddt class TestLaxProvider(unittest.TestCase): @patch('provider.lax_provider.article_versions') def test_article_highest_version_200(self, mock_lax_provider_article_versions): mock_lax_provider_article_versions.return_value = 200, test_data.lax_article_versions_response_data version = lax_provider.article_highest_version('08411', settings_mock) self.assertEqual(3, version) @patch('provider.lax_provider.article_versions') def test_article_highest_version_no_versions(self, mock_lax_provider_article_versions): mock_lax_provider_article_versions.return_value = 200, [] version = lax_provider.article_highest_version('08411', settings_mock) self.assertEqual(0, version) @patch('provider.lax_provider.article_versions') def test_article_highest_version_404(self, mock_lax_provider_article_versions): mock_lax_provider_article_versions.return_value = 404, None version = lax_provider.article_highest_version('08411', settings_mock) self.assertEqual("1", version) @patch('provider.lax_provider.article_versions') def test_article_next_version_no_versions(self, mock_lax_provider_article_versions): mock_lax_provider_article_versions.return_value = 200, [] version = lax_provider.article_next_version('08411', settings_mock) self.assertEqual("1", version) @patch('provider.lax_provider.article_versions') def test_article_publication_date_200(self, mock_lax_provider_article_versions): mock_lax_provider_article_versions.return_value = 200, test_data.lax_article_versions_response_data date_str = lax_provider.article_publication_date('08411', settings_mock) self.assertEqual('20151126000000', date_str) @patch('provider.lax_provider.article_versions') def test_article_publication_date_200_no_versions(self, mock_lax_provider_article_versions): mock_lax_provider_article_versions.return_value = 200, [] date_str = lax_provider.article_publication_date('08411', settings_mock) self.assertEqual(None, date_str) @patch('provider.lax_provider.article_versions') def test_article_publication_date_404(self, mock_lax_provider_article_versions): mock_lax_provider_article_versions.return_value = 404, None date_str = lax_provider.article_publication_date('08411', settings_mock) self.assertEqual(None, date_str) @patch('provider.lax_provider.article_versions') def test_article_publication_date_500(self, mock_lax_provider_article_versions): mock_lax_provider_article_versions.return_value = 500, None date_str = lax_provider.article_publication_date('08411', settings_mock) self.assertEqual(None, date_str) @patch('provider.lax_provider.article_versions') def test_article_version_date_by_version(self, mock_lax_provider_article_versions): mock_lax_provider_article_versions.return_value = 200, test_data.lax_article_versions_response_data result = lax_provider.article_version_date_by_version('08411', "2", settings_mock) self.assertEqual("2015-11-30T00:00:00Z", result) @patch('requests.get') def test_article_version_200(self, mock_requests_get): response = MagicMock() response.status_code = 200 response.json.return_value = {'versions': [{'version': 1}]} mock_requests_get.return_value = response status_code, versions = lax_provider.article_versions('08411', settings_mock) self.assertEqual(status_code, 200) self.assertEqual(versions, [{'version': 1}]) @patch('requests.get') def test_article_version_404(self, mock_requests_get): response = MagicMock() response.status_code = 404 mock_requests_get.return_value = response status_code, versions = lax_provider.article_versions('08411', settings_mock) self.assertEqual(status_code, 404) self.assertIsNone(versions) @patch('requests.get') def test_article_version_500(self, mock_requests_get): response = MagicMock() response.status_code = 500 mock_requests_get.return_value = response self.assertRaises(ErrorCallingLaxException, lax_provider.article_highest_version, '08411', settings_mock) # endpoint currently not available # @patch('provider.lax_provider.article_version') # def test_article_publication_date_by_version_id_version(self, mock_lax_provider_article_version): # mock_lax_provider_article_version.return_value = 200, test_data.lax_article_by_version_response_data_incomplete # result = lax_provider.article_version_date('08411', "2", settings_mock) # self.assertEqual("2016-11-11T17:48:41Z", result) def test_poa_vor_status_both_true(self): exp_poa_status, exp_vor_status = lax_provider.poa_vor_status(test_data.lax_article_versions_response_data) self.assertEqual(True, exp_poa_status) self.assertEqual(True, exp_vor_status) def test_poa_vor_status_both_none(self): exp_poa_status, exp_vor_status = lax_provider.poa_vor_status([]) self.assertEqual(None, exp_poa_status) self.assertEqual(None, exp_vor_status) def test_poa_vor_status_not_found(self): data = None exp_poa_status, exp_vor_status = lax_provider.poa_vor_status(data) self.assertEqual(None, exp_poa_status) self.assertEqual(None, exp_vor_status) def test_poa_vor_status_blank_version(self): data = [{},{"status":"poa","version":1}] exp_poa_status, exp_vor_status = lax_provider.poa_vor_status(data) self.assertEqual(True, exp_poa_status) self.assertEqual(None, exp_vor_status) @patch('provider.lax_provider.get_xml_file_name') def test_prepare_action_message(self, fake_xml_file_name): fake_xml_file_name.return_value = "elife-00353-v1.xml" message = lax_provider.prepare_action_message(settings_mock, "00353", "bb2d37b8-e73c-43b3-a092-d555753316af", "00353.1/bb2d37b8-e73c-43b3-a092-d555753316af", "1", "vor", "", "ingest") self.assertIn('token', message) del message['token'] self.assertDictEqual(message, {'action': 'ingest', 'id': '00353', 'location': 'https://s3-external-1.amazonaws.com/origin_bucket/00353.1/bb2d37b8-e73c-43b3-a092-d555753316af/elife-00353-v1.xml', 'version': 1, 'force': False}) def test_lax_token(self): token = lax_provider.lax_token("bb2d37b8-e73c-43b3-a092-d555753316af", "1", "00353.1/bb2d37b8-e73c-43b3-a092-d555753316af", "vor", "") self.assertEqual(json.loads(base64.decodestring(token)), {"run": "bb2d37b8-e73c-43b3-a092-d555753316af", "version": "1", "expanded_folder": "00353.1/bb2d37b8-e73c-43b3-a092-d555753316af", "eif_location": "", "status": "vor", "force": False}) @patch('provider.lax_provider.article_versions') def test_was_ever_poa_was_poa(self, mock_lax_provider_article_versions): article_id = '04132' mock_lax_provider_article_versions.return_value = 200, test_data.lax_article_versions_response_data result = lax_provider.was_ever_poa(article_id, settings_mock) self.assertEqual(result, True) @patch('provider.lax_provider.article_versions') def test_was_ever_poa_was_not_poa(self, mock_lax_provider_article_versions): article_id = '04132' mock_lax_provider_article_versions.return_value = 200, [test_data.lax_article_by_version_response_data_incomplete] result = lax_provider.was_ever_poa(article_id, settings_mock) self.assertEqual(result, False) @patch('provider.lax_provider.article_versions') def test_was_ever_poa_was_not_poa_blank(self, mock_lax_provider_article_versions): article_id = '04132' mock_lax_provider_article_versions.return_value = 200, [] result = lax_provider.was_ever_poa(article_id, settings_mock) self.assertEqual(result, False) @patch('provider.lax_provider.article_versions') def test_was_ever_poa_was_not_poa_500(self, mock_lax_provider_article_versions): article_id = '04132' mock_lax_provider_article_versions.return_value = 500, [] result = lax_provider.was_ever_poa(article_id, settings_mock) self.assertEqual(result, None) @patch('provider.lax_provider.article_versions') @data( (True, True, True), (True, False, False), (True, None, False), (False, True, True), (False, False, True), (False, None, False), ) @unpack def test_published_considering_poa_status(self, is_poa, was_ever_poa, expected_return_value, mock_lax_provider_article_versions): article_id = '04132' mock_lax_provider_article_versions.return_value = 200, test_data.lax_article_versions_response_data published = lax_provider.published_considering_poa_status(article_id, settings_mock, is_poa, was_ever_poa) self.assertEqual(published, expected_return_value) @patch('provider.lax_provider.article_versions') @data( (True, True, False), (True, False, False), (True, None, False), (False, True, False), (False, False, False), (False, None, False), ) @unpack def test_published_considering_poa_status_500(self, is_poa, was_ever_poa, expected_return_value, mock_lax_provider_article_versions): article_id = '04132' mock_lax_provider_article_versions.return_value = 500, [] published = lax_provider.published_considering_poa_status(article_id, settings_mock, is_poa, was_ever_poa) self.assertEqual(published, expected_return_value) if __name__ == '__main__': unittest.main()
{ "content_hash": "f5f88bfbf238098c671bcbb718f2b18d", "timestamp": "", "source": "github", "line_count": 220, "max_line_length": 167, "avg_line_length": 50.25454545454546, "alnum_prop": 0.6260853835021708, "repo_name": "gnott/elife-bot", "id": "00d71756027ef9c46f6de3f9931508a24ca06a0a", "size": "11056", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "tests/provider/test_lax_provider.py", "mode": "33188", "license": "mit", "language": [ { "name": "Gherkin", "bytes": "53428" }, { "name": "HTML", "bytes": "3975" }, { "name": "Python", "bytes": "1295112" }, { "name": "Shell", "bytes": "2363" } ], "symlink_target": "" }
<?php namespace LoopAnime\ShowsBundle\Entity; use Doctrine\ORM\Mapping as ORM; use LoopAnime\AppBundle\Entity\BaseEntity; /** * Animes_Music * * @ORM\Table("animes_music") * @ORM\Entity(repositoryClass="LoopAnime\ShowsBundle\Entity\AnimesMusicRepository") */ class AnimesMusic extends BaseEntity { /** * @var integer * * @ORM\Column(name="id_music", type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") */ private $id; /** * @var integer * * @ORM\Column(name="id_anime", type="integer") * @ORM\ManyToOne(targetEntity="LoopAnime\ShowsBundle\Entity\Animes", cascade={"remove"}) * @ORM\JoinColumn(onDelete="CASCADE") */ private $idAnime; /** * @var string * * @ORM\Column(name="title", type="string", length=255) */ private $title; /** * Get id * * @return integer */ public function getId() { return $this->id; } /** * Set idAnime * * @param integer $idAnime * @return Animes_Music */ public function setIdAnime($idAnime) { $this->idAnime = $idAnime; return $this; } /** * Get idAnime * * @return integer */ public function getIdAnime() { return $this->idAnime; } /** * Set title * * @param string $title * @return Animes_Music */ public function setTitle($title) { $this->title = $title; return $this; } /** * Get title * * @return string */ public function getTitle() { return $this->title; } }
{ "content_hash": "16d0526b59f521d5849144c6c3adf0b6", "timestamp": "", "source": "github", "line_count": 97, "max_line_length": 93, "avg_line_length": 17.298969072164947, "alnum_prop": 0.533969010727056, "repo_name": "LoopTeam/LoopAnime-Website", "id": "3b8bf9d1b1044e709a8ec234e2ced574dc7c1539", "size": "1678", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/LoopAnime/ShowsBundle/Entity/AnimesMusic.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "1054" }, { "name": "CSS", "bytes": "20690" }, { "name": "HTML", "bytes": "176022" }, { "name": "JavaScript", "bytes": "22279" }, { "name": "PHP", "bytes": "447937" }, { "name": "Ruby", "bytes": "735" }, { "name": "Shell", "bytes": "227" } ], "symlink_target": "" }
#include "testing/testing.hpp" #include "map/feature_vec_model.hpp" #include "indexer/data_header.hpp" #include "indexer/interval_index.hpp" #include "platform/local_country_file.hpp" #include "platform/local_country_file_utils.hpp" #include "platform/platform.hpp" #include "base/logging.hpp" #include <cstdint> #include <map> #include <memory> #include <vector> using namespace std; UNIT_TEST(CheckMWM_LoadAll) { Platform & platform = GetPlatform(); vector<platform::LocalCountryFile> localFiles; platform::FindAllLocalMapsInDirectoryAndCleanup(platform.WritableDir(), 0 /* version */, -1 /* latestVersion */, localFiles); model::FeaturesFetcher m; m.InitClassificator(); for (platform::LocalCountryFile const & localFile : localFiles) { LOG(LINFO, ("Found mwm:", localFile)); try { auto p = m.RegisterMap(localFile); TEST(p.first.IsAlive(), ()); TEST_EQUAL(MwmSet::RegResult::Success, p.second, ()); } catch (RootException const & ex) { TEST(false, ("Bad mwm file:", localFile)); } } } UNIT_TEST(CheckMWM_GeomIndex) { // Open mwm file from data path. FilesContainerR cont(GetPlatform().GetReader("minsk-pass.mwm")); // Initialize index reader section inside mwm. typedef ModelReaderPtr ReaderT; ReaderT reader = cont.GetReader(INDEX_FILE_TAG); ReaderSource<ReaderT> source(reader); VarSerialVectorReader<ReaderT> treesReader(source); // Make interval index objects for each scale bucket. vector<unique_ptr<IntervalIndex<ReaderT, uint32_t>>> scale2Index; for (size_t i = 0; i < treesReader.Size(); ++i) { scale2Index.emplace_back(make_unique<IntervalIndex<ReaderT, uint32_t>>( treesReader.SubReader(static_cast<uint32_t>(i)))); } // Pass full coverage as input for test. uint64_t beg = 0; uint64_t end = static_cast<uint64_t>((1ULL << 63) - 1); // Count objects for each scale bucket. map<size_t, uint64_t> resCount; for (size_t i = 0; i < scale2Index.size(); ++i) scale2Index[i]->ForEach([i, &resCount](uint64_t, uint32_t) { ++resCount[i]; }, beg, end); // Print results. LOG(LINFO, (resCount)); }
{ "content_hash": "ca8cd14aef76ac421f86a0d2a26df299", "timestamp": "", "source": "github", "line_count": 80, "max_line_length": 90, "avg_line_length": 27.55, "alnum_prop": 0.6674228675136116, "repo_name": "VladiMihaylenko/omim", "id": "c495f62da83465e58395abebde7dc4e7e7417729", "size": "2204", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "generator/generator_tests/check_mwms.cpp", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Awk", "bytes": "3962" }, { "name": "Batchfile", "bytes": "5543" }, { "name": "C", "bytes": "13989575" }, { "name": "C++", "bytes": "146396502" }, { "name": "CMake", "bytes": "223149" }, { "name": "CSS", "bytes": "26798" }, { "name": "Common Lisp", "bytes": "17521" }, { "name": "DIGITAL Command Language", "bytes": "36710" }, { "name": "GLSL", "bytes": "50620" }, { "name": "Gherkin", "bytes": "305230" }, { "name": "Go", "bytes": "12771" }, { "name": "HTML", "bytes": "9459269" }, { "name": "Inno Setup", "bytes": "4337" }, { "name": "Java", "bytes": "1928650" }, { "name": "JavaScript", "bytes": "29076" }, { "name": "Lua", "bytes": "57672" }, { "name": "M4", "bytes": "53992" }, { "name": "Makefile", "bytes": "429637" }, { "name": "Module Management System", "bytes": "2080" }, { "name": "Objective-C", "bytes": "1990354" }, { "name": "Objective-C++", "bytes": "1177287" }, { "name": "PHP", "bytes": "2841" }, { "name": "Perl", "bytes": "57807" }, { "name": "PowerShell", "bytes": "1885" }, { "name": "Prolog", "bytes": "282" }, { "name": "Python", "bytes": "536642" }, { "name": "QMake", "bytes": "4371" }, { "name": "Roff", "bytes": "13545" }, { "name": "Ruby", "bytes": "62015" }, { "name": "Shell", "bytes": "1315138" }, { "name": "Swift", "bytes": "338051" }, { "name": "sed", "bytes": "236" } ], "symlink_target": "" }
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <title>Grammars and Nested Matches</title> <link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.76.1"> <link rel="home" href="../../index.html" title="Chapter&#160;1.&#160;Boost.Xpressive"> <link rel="up" href="../../xpressive/user_s_guide.html" title="User's Guide"> <link rel="prev" href="named_captures.html" title="Named Captures"> <link rel="next" href="semantic_actions_and_user_defined_assertions.html" title="Semantic Actions and User-Defined Assertions"> </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="named_captures.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../xpressive/user_s_guide.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="semantic_actions_and_user_defined_assertions.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> </div> <div class="section"> <div class="titlepage"><div><div><h3 class="title"> <a name="boost_xpressive.user_s_guide.grammars_and_nested_matches"></a><a class="link" href="grammars_and_nested_matches.html" title="Grammars and Nested Matches">Grammars and Nested Matches</a> </h3></div></div></div> <h3> <a name="boost_xpressive.user_s_guide.grammars_and_nested_matches.h0"></a> <span><a name="boost_xpressive.user_s_guide.grammars_and_nested_matches.overview"></a></span><a class="link" href="grammars_and_nested_matches.html#boost_xpressive.user_s_guide.grammars_and_nested_matches.overview">Overview</a> </h3> <p> One of the key benefits of representing regexes as C++ expressions is the ability to easily refer to other C++ code and data from within the regex. This enables programming idioms that are not possible with other regular expression libraries. Of particular note is the ability for one regex to refer to another regex, allowing you to build grammars out of regular expressions. This section describes how to embed one regex in another by value and by reference, how regex objects behave when they refer to other regexes, and how to access the tree of results after a successful parse. </p> <h3> <a name="boost_xpressive.user_s_guide.grammars_and_nested_matches.h1"></a> <span><a name="boost_xpressive.user_s_guide.grammars_and_nested_matches.embedding_a_regex_by_value"></a></span><a class="link" href="grammars_and_nested_matches.html#boost_xpressive.user_s_guide.grammars_and_nested_matches.embedding_a_regex_by_value">Embedding a Regex by Value</a> </h3> <p> The <code class="literal"><code class="computeroutput"><a class="link" href="../../boost/xpressive/basic_regex.html" title="Struct template basic_regex">basic_regex&lt;&gt;</a></code></code> object has value semantics. When a regex object appears on the right-hand side in the definition of another regex, it is as if the regex were embedded by value; that is, a copy of the nested regex is stored by the enclosing regex. The inner regex is invoked by the outer regex during pattern matching. The inner regex participates fully in the match, back-tracking as needed to make the match succeed. </p> <p> Consider a text editor that has a regex-find feature with a whole-word option. You can implement this with xpressive as follows: </p> <pre class="programlisting"><span class="identifier">find_dialog</span> <span class="identifier">dlg</span><span class="special">;</span> <span class="keyword">if</span><span class="special">(</span> <span class="identifier">dialog_ok</span> <span class="special">==</span> <span class="identifier">dlg</span><span class="special">.</span><span class="identifier">do_modal</span><span class="special">()</span> <span class="special">)</span> <span class="special">{</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">pattern</span> <span class="special">=</span> <span class="identifier">dlg</span><span class="special">.</span><span class="identifier">get_text</span><span class="special">();</span> <span class="comment">// the pattern the user entered</span> <span class="keyword">bool</span> <span class="identifier">whole_word</span> <span class="special">=</span> <span class="identifier">dlg</span><span class="special">.</span><span class="identifier">whole_word</span><span class="special">.</span><span class="identifier">is_checked</span><span class="special">();</span> <span class="comment">// did the user select the whole-word option?</span> <span class="identifier">sregex</span> <span class="identifier">re</span> <span class="special">=</span> <span class="identifier">sregex</span><span class="special">::</span><span class="identifier">compile</span><span class="special">(</span> <span class="identifier">pattern</span> <span class="special">);</span> <span class="comment">// try to compile the pattern</span> <span class="keyword">if</span><span class="special">(</span> <span class="identifier">whole_word</span> <span class="special">)</span> <span class="special">{</span> <span class="comment">// wrap the regex in begin-word / end-word assertions</span> <span class="identifier">re</span> <span class="special">=</span> <span class="identifier">bow</span> <span class="special">&gt;&gt;</span> <span class="identifier">re</span> <span class="special">&gt;&gt;</span> <span class="identifier">eow</span><span class="special">;</span> <span class="special">}</span> <span class="comment">// ... use re ...</span> <span class="special">}</span> </pre> <p> Look closely at this line: </p> <pre class="programlisting"><span class="comment">// wrap the regex in begin-word / end-word assertions</span> <span class="identifier">re</span> <span class="special">=</span> <span class="identifier">bow</span> <span class="special">&gt;&gt;</span> <span class="identifier">re</span> <span class="special">&gt;&gt;</span> <span class="identifier">eow</span><span class="special">;</span> </pre> <p> This line creates a new regex that embeds the old regex by value. Then, the new regex is assigned back to the original regex. Since a copy of the old regex was made on the right-hand side, this works as you might expect: the new regex has the behavior of the old regex wrapped in begin- and end-word assertions. </p> <div class="note"><table border="0" summary="Note"> <tr> <td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../doc/src/images/note.png"></td> <th align="left">Note</th> </tr> <tr><td align="left" valign="top"><p> Note that <code class="computeroutput"><span class="identifier">re</span> <span class="special">=</span> <span class="identifier">bow</span> <span class="special">&gt;&gt;</span> <span class="identifier">re</span> <span class="special">&gt;&gt;</span> <span class="identifier">eow</span></code> does <span class="emphasis"><em>not</em></span> define a recursive regular expression, since regex objects embed by value by default. The next section shows how to define a recursive regular expression by embedding a regex by reference. </p></td></tr> </table></div> <h3> <a name="boost_xpressive.user_s_guide.grammars_and_nested_matches.h2"></a> <span><a name="boost_xpressive.user_s_guide.grammars_and_nested_matches.embedding_a_regex_by_reference"></a></span><a class="link" href="grammars_and_nested_matches.html#boost_xpressive.user_s_guide.grammars_and_nested_matches.embedding_a_regex_by_reference">Embedding a Regex by Reference</a> </h3> <p> If you want to be able to build recursive regular expressions and context-free grammars, embedding a regex by value is not enough. You need to be able to make your regular expressions self-referential. Most regular expression engines don't give you that power, but xpressive does. </p> <div class="tip"><table border="0" summary="Tip"> <tr> <td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="../../../../../../doc/src/images/tip.png"></td> <th align="left">Tip</th> </tr> <tr><td align="left" valign="top"><p> The theoretical computer scientists out there will correctly point out that a self-referential regular expression is not "regular", so in the strict sense, xpressive isn't really a <span class="emphasis"><em>regular</em></span> expression engine at all. But as Larry Wall once said, "the term [regular expression] has grown with the capabilities of our pattern matching engines, so I'm not going to try to fight linguistic necessity here." </p></td></tr> </table></div> <p> Consider the following code, which uses the <code class="computeroutput"><span class="identifier">by_ref</span><span class="special">()</span></code> helper to define a recursive regular expression that matches balanced, nested parentheses: </p> <pre class="programlisting"><span class="identifier">sregex</span> <span class="identifier">parentheses</span><span class="special">;</span> <span class="identifier">parentheses</span> <span class="comment">// A balanced set of parentheses ...</span> <span class="special">=</span> <span class="char">'('</span> <span class="comment">// is an opening parenthesis ...</span> <span class="special">&gt;&gt;</span> <span class="comment">// followed by ...</span> <span class="special">*(</span> <span class="comment">// zero or more ...</span> <span class="identifier">keep</span><span class="special">(</span> <span class="special">+~(</span><span class="identifier">set</span><span class="special">=</span><span class="char">'('</span><span class="special">,</span><span class="char">')'</span><span class="special">)</span> <span class="special">)</span> <span class="comment">// of a bunch of things that are not parentheses ...</span> <span class="special">|</span> <span class="comment">// or ...</span> <span class="identifier">by_ref</span><span class="special">(</span><span class="identifier">parentheses</span><span class="special">)</span> <span class="comment">// a balanced set of parentheses</span> <span class="special">)</span> <span class="comment">// (ooh, recursion!) ...</span> <span class="special">&gt;&gt;</span> <span class="comment">// followed by ...</span> <span class="char">')'</span> <span class="comment">// a closing parenthesis</span> <span class="special">;</span> </pre> <p> Matching balanced, nested tags is an important text processing task, and it is one that "classic" regular expressions cannot do. The <code class="computeroutput"><span class="identifier">by_ref</span><span class="special">()</span></code> helper makes it possible. It allows one regex object to be embedded in another <span class="emphasis"><em>by reference</em></span>. Since the right-hand side holds <code class="computeroutput"><span class="identifier">parentheses</span></code> by reference, assigning the right-hand side back to <code class="computeroutput"><span class="identifier">parentheses</span></code> creates a cycle, which will execute recursively. </p> <h3> <a name="boost_xpressive.user_s_guide.grammars_and_nested_matches.h3"></a> <span><a name="boost_xpressive.user_s_guide.grammars_and_nested_matches.building_a_grammar"></a></span><a class="link" href="grammars_and_nested_matches.html#boost_xpressive.user_s_guide.grammars_and_nested_matches.building_a_grammar">Building a Grammar</a> </h3> <p> Once we allow self-reference in our regular expressions, the genie is out of the bottle and all manner of fun things are possible. In particular, we can now build grammars out of regular expressions. Let's have a look at the text-book grammar example: the humble calculator. </p> <pre class="programlisting"><span class="identifier">sregex</span> <span class="identifier">group</span><span class="special">,</span> <span class="identifier">factor</span><span class="special">,</span> <span class="identifier">term</span><span class="special">,</span> <span class="identifier">expression</span><span class="special">;</span> <span class="identifier">group</span> <span class="special">=</span> <span class="char">'('</span> <span class="special">&gt;&gt;</span> <span class="identifier">by_ref</span><span class="special">(</span><span class="identifier">expression</span><span class="special">)</span> <span class="special">&gt;&gt;</span> <span class="char">')'</span><span class="special">;</span> <span class="identifier">factor</span> <span class="special">=</span> <span class="special">+</span><span class="identifier">_d</span> <span class="special">|</span> <span class="identifier">group</span><span class="special">;</span> <span class="identifier">term</span> <span class="special">=</span> <span class="identifier">factor</span> <span class="special">&gt;&gt;</span> <span class="special">*((</span><span class="char">'*'</span> <span class="special">&gt;&gt;</span> <span class="identifier">factor</span><span class="special">)</span> <span class="special">|</span> <span class="special">(</span><span class="char">'/'</span> <span class="special">&gt;&gt;</span> <span class="identifier">factor</span><span class="special">));</span> <span class="identifier">expression</span> <span class="special">=</span> <span class="identifier">term</span> <span class="special">&gt;&gt;</span> <span class="special">*((</span><span class="char">'+'</span> <span class="special">&gt;&gt;</span> <span class="identifier">term</span><span class="special">)</span> <span class="special">|</span> <span class="special">(</span><span class="char">'-'</span> <span class="special">&gt;&gt;</span> <span class="identifier">term</span><span class="special">));</span> </pre> <p> The regex <code class="computeroutput"><span class="identifier">expression</span></code> defined above does something rather remarkable for a regular expression: it matches mathematical expressions. For example, if the input string were <code class="computeroutput"><span class="string">"foo 9*(10+3) bar"</span></code>, this pattern would match <code class="computeroutput"><span class="string">"9*(10+3)"</span></code>. It only matches well-formed mathematical expressions, where the parentheses are balanced and the infix operators have two arguments each. Don't try this with just any regular expression engine! </p> <p> Let's take a closer look at this regular expression grammar. Notice that it is cyclic: <code class="computeroutput"><span class="identifier">expression</span></code> is implemented in terms of <code class="computeroutput"><span class="identifier">term</span></code>, which is implemented in terms of <code class="computeroutput"><span class="identifier">factor</span></code>, which is implemented in terms of <code class="computeroutput"><span class="identifier">group</span></code>, which is implemented in terms of <code class="computeroutput"><span class="identifier">expression</span></code>, closing the loop. In general, the way to define a cyclic grammar is to forward-declare the regex objects and embed by reference those regular expressions that have not yet been initialized. In the above grammar, there is only one place where we need to reference a regex object that has not yet been initialized: the definition of <code class="computeroutput"><span class="identifier">group</span></code>. In that place, we use <code class="computeroutput"><span class="identifier">by_ref</span><span class="special">()</span></code> to embed <code class="computeroutput"><span class="identifier">expression</span></code> by reference. In all other places, it is sufficient to embed the other regex objects by value, since they have already been initialized and their values will not change. </p> <div class="tip"><table border="0" summary="Tip"> <tr> <td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="../../../../../../doc/src/images/tip.png"></td> <th align="left">Tip</th> </tr> <tr><td align="left" valign="top"><p> <span class="bold"><strong>Embed by value if possible</strong></span> <br> <br> In general, prefer embedding regular expressions by value rather than by reference. It involves one less indirection, making your patterns match a little faster. Besides, value semantics are simpler and will make your grammars easier to reason about. Don't worry about the expense of "copying" a regex. Each regex object shares its implementation with all of its copies. </p></td></tr> </table></div> <h3> <a name="boost_xpressive.user_s_guide.grammars_and_nested_matches.h4"></a> <span><a name="boost_xpressive.user_s_guide.grammars_and_nested_matches.dynamic_regex_grammars"></a></span><a class="link" href="grammars_and_nested_matches.html#boost_xpressive.user_s_guide.grammars_and_nested_matches.dynamic_regex_grammars">Dynamic Regex Grammars</a> </h3> <p> Using <code class="literal"><code class="computeroutput"><a class="link" href="../../boost/xpressive/regex_compiler.html" title="Struct template regex_compiler">regex_compiler&lt;&gt;</a></code></code>, you can also build grammars out of dynamic regular expressions. You do that by creating named regexes, and referring to other regexes by name. Each <code class="literal"><code class="computeroutput"><a class="link" href="../../boost/xpressive/regex_compiler.html" title="Struct template regex_compiler">regex_compiler&lt;&gt;</a></code></code> instance keeps a mapping from names to regexes that have been created with it. </p> <p> You can create a named dynamic regex by prefacing your regex with <code class="computeroutput"><span class="string">"(?$name=)"</span></code>, where <span class="emphasis"><em>name</em></span> is the name of the regex. You can refer to a named regex from another regex with <code class="computeroutput"><span class="string">"(?$name)"</span></code>. The named regex does not need to exist yet at the time it is referenced in another regex, but it must exist by the time you use the regex. </p> <p> Below is a code fragment that uses dynamic regex grammars to implement the calculator example from above. </p> <pre class="programlisting"><span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">xpressive</span><span class="special">;</span> <span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">regex_constants</span><span class="special">;</span> <span class="identifier">sregex</span> <span class="identifier">expr</span><span class="special">;</span> <span class="special">{</span> <span class="identifier">sregex_compiler</span> <span class="identifier">compiler</span><span class="special">;</span> <span class="identifier">syntax_option_type</span> <span class="identifier">x</span> <span class="special">=</span> <span class="identifier">ignore_white_space</span><span class="special">;</span> <span class="identifier">compiler</span><span class="special">.</span><span class="identifier">compile</span><span class="special">(</span><span class="string">"(? $group = ) \\( (? $expr ) \\) "</span><span class="special">,</span> <span class="identifier">x</span><span class="special">);</span> <span class="identifier">compiler</span><span class="special">.</span><span class="identifier">compile</span><span class="special">(</span><span class="string">"(? $factor = ) \\d+ | (? $group ) "</span><span class="special">,</span> <span class="identifier">x</span><span class="special">);</span> <span class="identifier">compiler</span><span class="special">.</span><span class="identifier">compile</span><span class="special">(</span><span class="string">"(? $term = ) (? $factor )"</span> <span class="string">" ( \\* (? $factor ) | / (? $factor ) )* "</span><span class="special">,</span> <span class="identifier">x</span><span class="special">);</span> <span class="identifier">expr</span> <span class="special">=</span> <span class="identifier">compiler</span><span class="special">.</span><span class="identifier">compile</span><span class="special">(</span><span class="string">"(? $expr = ) (? $term )"</span> <span class="string">" ( \\+ (? $term ) | - (? $term ) )* "</span><span class="special">,</span> <span class="identifier">x</span><span class="special">);</span> <span class="special">}</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">str</span><span class="special">(</span><span class="string">"foo 9*(10+3) bar"</span><span class="special">);</span> <span class="identifier">smatch</span> <span class="identifier">what</span><span class="special">;</span> <span class="keyword">if</span><span class="special">(</span><span class="identifier">regex_search</span><span class="special">(</span><span class="identifier">str</span><span class="special">,</span> <span class="identifier">what</span><span class="special">,</span> <span class="identifier">expr</span><span class="special">))</span> <span class="special">{</span> <span class="comment">// This prints "9*(10+3)":</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">what</span><span class="special">[</span><span class="number">0</span><span class="special">]</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="special">}</span> </pre> <p> As with static regex grammars, nested regex invocations create nested match results (see <span class="emphasis"><em>Nested Results</em></span> below). The result is a complete parse tree for string that matched. Unlike static regexes, dynamic regexes are always embedded by reference, not by value. </p> <h3> <a name="boost_xpressive.user_s_guide.grammars_and_nested_matches.h5"></a> <span><a name="boost_xpressive.user_s_guide.grammars_and_nested_matches.cyclic_patterns__copying_and_memory_management__oh_my_"></a></span><a class="link" href="grammars_and_nested_matches.html#boost_xpressive.user_s_guide.grammars_and_nested_matches.cyclic_patterns__copying_and_memory_management__oh_my_">Cyclic Patterns, Copying and Memory Management, Oh My!</a> </h3> <p> The calculator examples above raises a number of very complicated memory-management issues. Each of the four regex objects refer to each other, some directly and some indirectly, some by value and some by reference. What if we were to return one of them from a function and let the others go out of scope? What becomes of the references? The answer is that the regex objects are internally reference counted, such that they keep their referenced regex objects alive as long as they need them. So passing a regex object by value is never a problem, even if it refers to other regex objects that have gone out of scope. </p> <p> Those of you who have dealt with reference counting are probably familiar with its Achilles Heel: cyclic references. If regex objects are reference counted, what happens to cycles like the one created in the calculator examples? Are they leaked? The answer is no, they are not leaked. The <code class="literal"><code class="computeroutput"><a class="link" href="../../boost/xpressive/basic_regex.html" title="Struct template basic_regex">basic_regex&lt;&gt;</a></code></code> object has some tricky reference tracking code that ensures that even cyclic regex grammars are cleaned up when the last external reference goes away. So don't worry about it. Create cyclic grammars, pass your regex objects around and copy them all you want. It is fast and efficient and guaranteed not to leak or result in dangling references. </p> <h3> <a name="boost_xpressive.user_s_guide.grammars_and_nested_matches.h6"></a> <span><a name="boost_xpressive.user_s_guide.grammars_and_nested_matches.nested_regexes_and_sub_match_scoping"></a></span><a class="link" href="grammars_and_nested_matches.html#boost_xpressive.user_s_guide.grammars_and_nested_matches.nested_regexes_and_sub_match_scoping">Nested Regexes and Sub-Match Scoping</a> </h3> <p> Nested regular expressions raise the issue of sub-match scoping. If both the inner and outer regex write to and read from the same sub-match vector, chaos would ensue. The inner regex would stomp on the sub-matches written by the outer regex. For example, what does this do? </p> <pre class="programlisting"><span class="identifier">sregex</span> <span class="identifier">inner</span> <span class="special">=</span> <span class="identifier">sregex</span><span class="special">::</span><span class="identifier">compile</span><span class="special">(</span> <span class="string">"(.)\\1"</span> <span class="special">);</span> <span class="identifier">sregex</span> <span class="identifier">outer</span> <span class="special">=</span> <span class="special">(</span><span class="identifier">s1</span><span class="special">=</span> <span class="identifier">_</span><span class="special">)</span> <span class="special">&gt;&gt;</span> <span class="identifier">inner</span> <span class="special">&gt;&gt;</span> <span class="identifier">s1</span><span class="special">;</span> </pre> <p> The author probably didn't intend for the inner regex to overwrite the sub-match written by the outer regex. The problem is particularly acute when the inner regex is accepted from the user as input. The author has no way of knowing whether the inner regex will stomp the sub-match vector or not. This is clearly not acceptable. </p> <p> Instead, what actually happens is that each invocation of a nested regex gets its own scope. Sub-matches belong to that scope. That is, each nested regex invocation gets its own copy of the sub-match vector to play with, so there is no way for an inner regex to stomp on the sub-matches of an outer regex. So, for example, the regex <code class="computeroutput"><span class="identifier">outer</span></code> defined above would match <code class="computeroutput"><span class="string">"ABBA"</span></code>, as it should. </p> <h3> <a name="boost_xpressive.user_s_guide.grammars_and_nested_matches.h7"></a> <span><a name="boost_xpressive.user_s_guide.grammars_and_nested_matches.nested_results"></a></span><a class="link" href="grammars_and_nested_matches.html#boost_xpressive.user_s_guide.grammars_and_nested_matches.nested_results">Nested Results</a> </h3> <p> If nested regexes have their own sub-matches, there should be a way to access them after a successful match. In fact, there is. After a <code class="literal"><code class="computeroutput"><a class="link" href="../../boost/xpressive/regex_match.html" title="Function regex_match">regex_match()</a></code></code> or <code class="literal"><code class="computeroutput"><a class="link" href="../../boost/xpressive/regex_search.html" title="Function regex_search">regex_search()</a></code></code>, the <code class="literal"><code class="computeroutput"><a class="link" href="../../boost/xpressive/match_results.html" title="Struct template match_results">match_results&lt;&gt;</a></code></code> struct behaves like the head of a tree of nested results. The <code class="literal"><code class="computeroutput"><a class="link" href="../../boost/xpressive/match_results.html" title="Struct template match_results">match_results&lt;&gt;</a></code></code> class provides a <code class="computeroutput"><span class="identifier">nested_results</span><span class="special">()</span></code> member function that returns an ordered sequence of <code class="literal"><code class="computeroutput"><a class="link" href="../../boost/xpressive/match_results.html" title="Struct template match_results">match_results&lt;&gt;</a></code></code> structures, representing the results of the nested regexes. The order of the nested results is the same as the order in which the nested regex objects matched. </p> <p> Take as an example the regex for balanced, nested parentheses we saw earlier: </p> <pre class="programlisting"><span class="identifier">sregex</span> <span class="identifier">parentheses</span><span class="special">;</span> <span class="identifier">parentheses</span> <span class="special">=</span> <span class="char">'('</span> <span class="special">&gt;&gt;</span> <span class="special">*(</span> <span class="identifier">keep</span><span class="special">(</span> <span class="special">+~(</span><span class="identifier">set</span><span class="special">=</span><span class="char">'('</span><span class="special">,</span><span class="char">')'</span><span class="special">)</span> <span class="special">)</span> <span class="special">|</span> <span class="identifier">by_ref</span><span class="special">(</span><span class="identifier">parentheses</span><span class="special">)</span> <span class="special">)</span> <span class="special">&gt;&gt;</span> <span class="char">')'</span><span class="special">;</span> <span class="identifier">smatch</span> <span class="identifier">what</span><span class="special">;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">str</span><span class="special">(</span> <span class="string">"blah blah( a(b)c (c(e)f (g)h )i (j)6 )blah"</span> <span class="special">);</span> <span class="keyword">if</span><span class="special">(</span> <span class="identifier">regex_search</span><span class="special">(</span> <span class="identifier">str</span><span class="special">,</span> <span class="identifier">what</span><span class="special">,</span> <span class="identifier">parentheses</span> <span class="special">)</span> <span class="special">)</span> <span class="special">{</span> <span class="comment">// display the whole match</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">what</span><span class="special">[</span><span class="number">0</span><span class="special">]</span> <span class="special">&lt;&lt;</span> <span class="char">'\n'</span><span class="special">;</span> <span class="comment">// display the nested results</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">for_each</span><span class="special">(</span> <span class="identifier">what</span><span class="special">.</span><span class="identifier">nested_results</span><span class="special">().</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">what</span><span class="special">.</span><span class="identifier">nested_results</span><span class="special">().</span><span class="identifier">end</span><span class="special">(),</span> <span class="identifier">output_nested_results</span><span class="special">()</span> <span class="special">);</span> <span class="special">}</span> </pre> <p> This program displays the following: </p> <pre class="programlisting">( a(b)c (c(e)f (g)h )i (j)6 ) (b) (c(e)f (g)h ) (e) (g) (j) </pre> <p> Here you can see how the results are nested and that they are stored in the order in which they are found. </p> <div class="tip"><table border="0" summary="Tip"> <tr> <td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="../../../../../../doc/src/images/tip.png"></td> <th align="left">Tip</th> </tr> <tr><td align="left" valign="top"><p> See the definition of <a class="link" href="examples.html#boost_xpressive.user_s_guide.examples.display_a_tree_of_nested_results">output_nested_results</a> in the <a class="link" href="examples.html" title="Examples">Examples</a> section. </p></td></tr> </table></div> <h3> <a name="boost_xpressive.user_s_guide.grammars_and_nested_matches.h8"></a> <span><a name="boost_xpressive.user_s_guide.grammars_and_nested_matches.filtering_nested_results"></a></span><a class="link" href="grammars_and_nested_matches.html#boost_xpressive.user_s_guide.grammars_and_nested_matches.filtering_nested_results">Filtering Nested Results</a> </h3> <p> Sometimes a regex will have several nested regex objects, and you want to know which result corresponds to which regex object. That's where <code class="computeroutput"><span class="identifier">basic_regex</span><span class="special">&lt;&gt;::</span><span class="identifier">regex_id</span><span class="special">()</span></code> and <code class="computeroutput"><span class="identifier">match_results</span><span class="special">&lt;&gt;::</span><span class="identifier">regex_id</span><span class="special">()</span></code> come in handy. When iterating over the nested results, you can compare the regex id from the results to the id of the regex object you're interested in. </p> <p> To make this a bit easier, xpressive provides a predicate to make it simple to iterate over just the results that correspond to a certain nested regex. It is called <code class="computeroutput"><span class="identifier">regex_id_filter_predicate</span></code>, and it is intended to be used with <a href="../../../../libs/iterator/doc/index.html" target="_top">Boost.Iterator</a>. You can use it as follows: </p> <pre class="programlisting"><span class="identifier">sregex</span> <span class="identifier">name</span> <span class="special">=</span> <span class="special">+</span><span class="identifier">alpha</span><span class="special">;</span> <span class="identifier">sregex</span> <span class="identifier">integer</span> <span class="special">=</span> <span class="special">+</span><span class="identifier">_d</span><span class="special">;</span> <span class="identifier">sregex</span> <span class="identifier">re</span> <span class="special">=</span> <span class="special">*(</span> <span class="special">*</span><span class="identifier">_s</span> <span class="special">&gt;&gt;</span> <span class="special">(</span> <span class="identifier">name</span> <span class="special">|</span> <span class="identifier">integer</span> <span class="special">)</span> <span class="special">);</span> <span class="identifier">smatch</span> <span class="identifier">what</span><span class="special">;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">str</span><span class="special">(</span> <span class="string">"marsha 123 jan 456 cindy 789"</span> <span class="special">);</span> <span class="keyword">if</span><span class="special">(</span> <span class="identifier">regex_match</span><span class="special">(</span> <span class="identifier">str</span><span class="special">,</span> <span class="identifier">what</span><span class="special">,</span> <span class="identifier">re</span> <span class="special">)</span> <span class="special">)</span> <span class="special">{</span> <span class="identifier">smatch</span><span class="special">::</span><span class="identifier">nested_results_type</span><span class="special">::</span><span class="identifier">const_iterator</span> <span class="identifier">begin</span> <span class="special">=</span> <span class="identifier">what</span><span class="special">.</span><span class="identifier">nested_results</span><span class="special">().</span><span class="identifier">begin</span><span class="special">();</span> <span class="identifier">smatch</span><span class="special">::</span><span class="identifier">nested_results_type</span><span class="special">::</span><span class="identifier">const_iterator</span> <span class="identifier">end</span> <span class="special">=</span> <span class="identifier">what</span><span class="special">.</span><span class="identifier">nested_results</span><span class="special">().</span><span class="identifier">end</span><span class="special">();</span> <span class="comment">// declare filter predicates to select just the names or the integers</span> <span class="identifier">sregex_id_filter_predicate</span> <span class="identifier">name_id</span><span class="special">(</span> <span class="identifier">name</span><span class="special">.</span><span class="identifier">regex_id</span><span class="special">()</span> <span class="special">);</span> <span class="identifier">sregex_id_filter_predicate</span> <span class="identifier">integer_id</span><span class="special">(</span> <span class="identifier">integer</span><span class="special">.</span><span class="identifier">regex_id</span><span class="special">()</span> <span class="special">);</span> <span class="comment">// iterate over only the results from the name regex</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">for_each</span><span class="special">(</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_filter_iterator</span><span class="special">(</span> <span class="identifier">name_id</span><span class="special">,</span> <span class="identifier">begin</span><span class="special">,</span> <span class="identifier">end</span> <span class="special">),</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_filter_iterator</span><span class="special">(</span> <span class="identifier">name_id</span><span class="special">,</span> <span class="identifier">end</span><span class="special">,</span> <span class="identifier">end</span> <span class="special">),</span> <span class="identifier">output_result</span> <span class="special">);</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="char">'\n'</span><span class="special">;</span> <span class="comment">// iterate over only the results from the integer regex</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">for_each</span><span class="special">(</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_filter_iterator</span><span class="special">(</span> <span class="identifier">integer_id</span><span class="special">,</span> <span class="identifier">begin</span><span class="special">,</span> <span class="identifier">end</span> <span class="special">),</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_filter_iterator</span><span class="special">(</span> <span class="identifier">integer_id</span><span class="special">,</span> <span class="identifier">end</span><span class="special">,</span> <span class="identifier">end</span> <span class="special">),</span> <span class="identifier">output_result</span> <span class="special">);</span> <span class="special">}</span> </pre> <p> where <code class="computeroutput"><span class="identifier">output_results</span></code> is a simple function that takes a <code class="computeroutput"><span class="identifier">smatch</span></code> and displays the full match. Notice how we use the <code class="computeroutput"><span class="identifier">regex_id_filter_predicate</span></code> together with <code class="computeroutput"><span class="identifier">basic_regex</span><span class="special">&lt;&gt;::</span><span class="identifier">regex_id</span><span class="special">()</span></code> and <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_filter_iterator</span><span class="special">()</span></code> from the <a href="../../../../libs/iterator/doc/index.html" target="_top">Boost.Iterator</a> to select only those results corresponding to a particular nested regex. This program displays the following: </p> <pre class="programlisting">marsha jan cindy 123 456 789 </pre> </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; 2007 Eric Niebler<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="named_captures.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../xpressive/user_s_guide.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="semantic_actions_and_user_defined_assertions.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> </div> </body> </html>
{ "content_hash": "96a8f3a3f5873743f2ef8dcbe9b8c201", "timestamp": "", "source": "github", "line_count": 474, "max_line_length": 790, "avg_line_length": 92.72784810126582, "alnum_prop": 0.6728550952153437, "repo_name": "calvinfarias/IC2015-2", "id": "b5dc36d0bd50c4be6d4bbd7ce8b7fcce7321c906", "size": "43953", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "BOOST/boost_1_61_0/libs/xpressive/doc/html/boost_xpressive/user_s_guide/grammars_and_nested_matches.html", "mode": "33188", "license": "mit", "language": [ { "name": "Assembly", "bytes": "223360" }, { "name": "Batchfile", "bytes": "32233" }, { "name": "C", "bytes": "2977162" }, { "name": "C#", "bytes": "40804" }, { "name": "C++", "bytes": "184445796" }, { "name": "CMake", "bytes": "119765" }, { "name": "CSS", "bytes": "427923" }, { "name": "Cuda", "bytes": "111870" }, { "name": "DIGITAL Command Language", "bytes": "6246" }, { "name": "FORTRAN", "bytes": "5291" }, { "name": "Groff", "bytes": "5189" }, { "name": "HTML", "bytes": "234946752" }, { "name": "IDL", "bytes": "14" }, { "name": "JavaScript", "bytes": "682223" }, { "name": "Lex", "bytes": "1231" }, { "name": "M4", "bytes": "29689" }, { "name": "Makefile", "bytes": "1083443" }, { "name": "Max", "bytes": "36857" }, { "name": "Objective-C", "bytes": "11406" }, { "name": "Objective-C++", "bytes": "630" }, { "name": "PHP", "bytes": "59030" }, { "name": "Perl", "bytes": "39008" }, { "name": "Perl6", "bytes": "2053" }, { "name": "Python", "bytes": "1759984" }, { "name": "QML", "bytes": "593" }, { "name": "QMake", "bytes": "16692" }, { "name": "Rebol", "bytes": "354" }, { "name": "Ruby", "bytes": "5532" }, { "name": "Shell", "bytes": "355247" }, { "name": "Tcl", "bytes": "1172" }, { "name": "TeX", "bytes": "126042" }, { "name": "XSLT", "bytes": "552736" }, { "name": "Yacc", "bytes": "19623" } ], "symlink_target": "" }
int EstimateHilbertIterationNum(vector<Vector3D> const& cor) { return (int)ceil(log(pow((double)cor.size(), (1.0 / 3.0))) / log(2.0)); } // Adjust the vector of points so all coordinate values will be in the range [0,1] void AdjustPoints(vector<Vector3D> const & vPointsIn, vector<Vector3D> & vPointsOut) { // The output vector: vPointsOut.resize(vPointsIn.size()); // Vectors holding the X,Y,Z coordinates: vector<double> vPointsX, vPointsY, vPointsZ; Split(vPointsIn, vPointsX, vPointsY, vPointsZ); // TOOD - what if all points have the same x (or y, or z) values? double dbMinX = *min_element(vPointsX.begin(), vPointsX.end()); double dbMinY = *min_element(vPointsY.begin(), vPointsY.end()); double dbMinZ = *min_element(vPointsZ.begin(), vPointsZ.end()); double dbMaxX = *max_element(vPointsX.begin(), vPointsX.end()); double dbMaxY = *max_element(vPointsY.begin(), vPointsY.end()); double dbMaxZ = *max_element(vPointsZ.begin(), vPointsZ.end()); // The scale factor: double dbScaleX = dbMaxX - dbMinX; double dbScaleY = dbMaxY - dbMinY; double dbScaleZ = dbMaxZ - dbMinZ; // To prevent division by zero (very unlikely - double precision!) bool bFlagX = dbScaleX == 0; bool bFlagY = dbScaleY == 0; bool bFlagZ = dbScaleZ == 0; // X coordinate: if (!bFlagX) { for (std::size_t ii = 0; ii < vPointsIn.size(); ++ii) { // Scale the X coordinate: vPointsX[ii] -= dbMinX; vPointsX[ii] /= dbScaleX; } } else { fill(vPointsX.begin(), vPointsX.end(), 0); } // Y coordinate: if (!bFlagY) { for (std::size_t ii = 0; ii < vPointsIn.size(); ++ii) { // Scale the X coordinate: vPointsY[ii] -= dbMinY; vPointsY[ii] /= dbScaleY; } } else { fill(vPointsY.begin(), vPointsY.end(), 0); } // Z coordinate: if (!bFlagZ) { for (std::size_t ii = 0; ii < vPointsIn.size(); ++ii) { vPointsZ[ii] -= dbMinZ; vPointsZ[ii] /= dbScaleZ; } } else { fill(vPointsZ.begin(), vPointsZ.end(), 0); } // Store back the coordiantes in a single output vector: for (std::size_t ii = 0; ii < vPointsIn.size(); ++ii) { vPointsOut[ii].x = vPointsX[ii]; vPointsOut[ii].y = vPointsY[ii]; vPointsOut[ii].z = vPointsZ[ii]; } return; } void FindEqualIndices(vector<unsigned long long int> const & vD_sorted, vector<vector<std::size_t> > & vOut) { vector<unsigned long long int> vD_sorted_cpy = vD_sorted; vector<unsigned long long int> vD_sorted_unq = vD_sorted; //vector<unsigned long long int>::iterator it = adjacent_find(vD_sorted.begin(), vD_sorted.end()); vector<unsigned long long int>::iterator it1, itPrev, itCur; it1 = unique(vD_sorted_unq.begin(), vD_sorted_unq.end()); vD_sorted_unq.resize(distance(vD_sorted_unq.begin(), it1)); if (vD_sorted.size() == vD_sorted_unq.size()) { return; } vOut.reserve(vD_sorted.size() - vD_sorted_unq.size()); int iCurPrevDist = 0; itPrev = vD_sorted_cpy.begin(); for (it1 = vD_sorted_unq.begin()+1; it1 != vD_sorted_unq.end(); ++it1) { if (distance( it1 , vD_sorted_unq.end() ) == 0) { itCur = vD_sorted_cpy.end(); } else { itCur = find(itPrev, vD_sorted_cpy.end(), *it1); } iCurPrevDist = static_cast<int>(distance(itPrev, itCur)); if (1 < iCurPrevDist) { int iBase = static_cast<int>(distance(vD_sorted_cpy.begin(), itPrev)); vector<std::size_t> vInd( iCurPrevDist ); // C++11 // iota(vInd.begin(), vInd.end(), iBase); for (int ii = 0; ii < iCurPrevDist; ++ii) { vInd[ii] = iBase + ii; } vOut.push_back(vInd); } itPrev = itCur; } iCurPrevDist = static_cast<int>(distance(itPrev, vD_sorted_cpy.end())); if (1 < iCurPrevDist ) { int iBase = static_cast<int>(distance(vD_sorted_cpy.begin(), itPrev)); vector<std::size_t> vInd(iCurPrevDist); for (int ii = 0; ii < iCurPrevDist; ++ii) { vInd[ii] = iBase + ii; } vOut.push_back(vInd); } return; }
{ "content_hash": "7dcc7c684ce5c87e7f297a60a7443d2f", "timestamp": "", "source": "github", "line_count": 152, "max_line_length": 108, "avg_line_length": 26.388157894736842, "alnum_prop": 0.6180503615058589, "repo_name": "eladtan/Voronoi3D", "id": "05542dc8f78cb1e1665030c43255ff858fab3d94", "size": "4048", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "HilbertOrder3D_Utils.cpp", "mode": "33188", "license": "mit", "language": [ { "name": "C++", "bytes": "276481" } ], "symlink_target": "" }
package org.eleusoft.jaxs.helpers; import java.io.IOException; import java.io.Writer; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; import org.xml.sax.Locator; import org.xml.sax.SAXException; //import javax.xml.XMLConstants; /** <p>A simple serializer for XML documents.</p> * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * @author <a href="mailto:[email protected]">Jochen Wiedmann</a> */ class XMLWriter implements ContentHandler { private Writer w; private Locator l; private java.util.Map delayedPrefixes; int curIndent = 0; private static final int STATE_OUTSIDE = 0; private static final int STATE_IN_START_ELEMENT = 1; private static final int STATE_IN_ELEMENT = 2; private int state; boolean indent = true; String INDENT_SEPARATOR = "\n"; String INDENT_STRING = " "; /** Creates a new XMLWriter */ public XMLWriter() { w = null;} /** <p>Sets the XMLWriter Writer.</p> */ public void setWriter(Writer pWriter) { w = pWriter; } /** <p>Returns the XMLWriter Writer.</p> */ public Writer getWriter() { return w; } /** Sets the locator. * * @param pLocator A locator for use in case of errors * @see #getDocumentLocator */ public void setDocumentLocator(Locator pLocator) { l = pLocator; } /** Returns the locator * @return A locator previously set with setDocumentLocator or null. * @see #setDocumentLocator */ public Locator getDocumentLocator() { return l; } /** * <p>Starts use of a namespace prefix.</p> * * @param namespaceURI The namespace URI * @param prefix The prefix * @throws SAXException Not actually thrown, just for compliance to the interface specification. */ public void startPrefixMapping(String prefix, String namespaceURI) throws SAXException { if (delayedPrefixes == null) { delayedPrefixes = new java.util.HashMap(); } if ("".equals(prefix)) { if (namespaceURI.equals(prefix)) { return; } prefix = XMLConstants.XMLNS_ATTRIBUTE; } else { prefix = XMLConstants.XMLNS_ATTRIBUTE + ":" + prefix; } delayedPrefixes.put(prefix, namespaceURI); } /** <p>Terminates use of a namespace prefix.</p> * * @param prefix The prefix being abandoned. * @throws SAXException Not actually thrown, just for compliance to the interface specification. */ public void endPrefixMapping(String prefix) throws SAXException { if (delayedPrefixes != null) { if ("".equals(prefix)) { prefix = XMLConstants.XMLNS_ATTRIBUTE; } else { prefix = XMLConstants.XMLNS_ATTRIBUTE + ":" + prefix; } delayedPrefixes.remove(prefix); } } /** <p>Starts a document.</p> * @throws SAXException Not actually thrown, just for compliance to the interface specification. */ public void startDocument() throws SAXException { if (delayedPrefixes != null) { delayedPrefixes.clear(); } state = STATE_OUTSIDE; curIndent = 0; } /** <p>This method finishs the handlers action. After calling endDocument you * may start a new action by calling startDocument again.</p> * * @throws SAXException Not actually thrown, just for compliance to the * interface specification. */ public void endDocument() throws SAXException {} /** Calls the character method with the same arguments. * @param ch A string of whitespace characters being inserted into the document. * @param start The index of the first character. * @param length The number of characters. * @throws SAXException Thrown in case of an IOException. */ public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException { characters(ch, start, length); } private void stopTerminator() throws java.io.IOException { if (state == STATE_IN_START_ELEMENT) { if (w != null) { w.write('>'); } state = STATE_IN_ELEMENT; } } /** Inserts a string of characters into the document. * @param ch The characters being inserted. A substring, to be precise. * @param start Index of the first character * @param length Number of characters being inserted * @throws SAXException Thrown in case of an IOException */ public void characters(char[] ch, int start, int length) throws SAXException { try { stopTerminator(); if (w == null) return; int end = start+length; for (int i = start; i < end; i++) { char c = ch[i]; switch (c) { case '&': w.write("&amp;"); break; case '<': w.write("&lt;"); break; case '>': w.write("&gt;"); break; case '\n': case '\r': case '\t': w.write(c); break; default: if (canEncode(c)) { w.write(c); } else { w.write("&#"); w.write(Integer.toString(c)); w.write(";"); } break; } } } catch (IOException e) { throw new SAXException(e); } } public boolean canEncode(char c) { return true; //c > 31 && c < 127; } /** <p>Terminates an element.</p> * * @param namespaceURI The namespace URI, if any, or null * @param localName The local name, without prefix, or null * @param qName The qualified name, including a prefix, or null * @throws SAXException Thrown in case of an IOException. */ public void endElement(String namespaceURI, String localName, String qName) throws SAXException { if (indent) { --curIndent; } if (w != null) { try { if (state == STATE_IN_START_ELEMENT) { w.write("/>"); state = STATE_OUTSIDE; } else { if (state == STATE_OUTSIDE) { indentMe(); } w.write("</"); w.write(qName); w.write('>'); } state = STATE_OUTSIDE; } catch (java.io.IOException e) { throw new SAXException(e); } } } private void indentMe() throws java.io.IOException { if (w != null) { if (indent) { String s = INDENT_SEPARATOR; if (s != null) { w.write(s); } s = INDENT_STRING; for (int i = 0; i < curIndent; i++) { w.write(s); } } } } private void writeCData(String v) throws java.io.IOException { int len = v.length(); for (int j = 0; j < len; j++) { char c = v.charAt(j); switch (c) { case '&': w.write("&amp;"); break; case '<': w.write("&lt;"); break; case '>': w.write("&gt;"); break; case '\'': w.write("&apos;"); break; case '"': w.write("&quot;"); break; default: if (canEncode(c)) { w.write(c); } else { w.write("&#"); w.write(Integer.toString(c)); w.write(';'); } break; } } } /** Starts a new element. * * @param namespaceURI The namespace URI, if any, or null * @param localName The local name, without prefix, or null * @param qName The qualified name, including a prefix, or null * @param attr The element attributes * @throws SAXException Thrown in case of an IOException. */ public void startElement(String namespaceURI, String localName, String qName, Attributes attr) throws SAXException { try { stopTerminator(); if (indent) { if (curIndent > 0) { indentMe(); } curIndent++; } if (w != null) { w.write('<'); w.write(qName); if (attr != null) { for (int i = attr.getLength(); i > 0;) { w.write(' '); String name = attr.getQName(--i); w.write(name); if (delayedPrefixes != null) { delayedPrefixes.remove(name); } w.write("=\""); writeCData(attr.getValue(i)); w.write('"'); } } if (delayedPrefixes != null && delayedPrefixes.size() > 0) { for (java.util.Iterator iter = delayedPrefixes.entrySet().iterator(); iter.hasNext(); ) { java.util.Map.Entry entry = (java.util.Map.Entry) iter.next(); w.write(' '); w.write((String) entry.getKey()); w.write("=\""); w.write((String) entry.getValue()); w.write('"'); } delayedPrefixes.clear(); } } state = STATE_IN_START_ELEMENT; } catch (java.io.IOException e) { throw new SAXException(e); } } /** Not actually implemented, because I don't know how to skip entities. * * @param ent The entity being skipped. * @throws SAXException Not actually thrown, just for compliance to the interface specification. */ public void skippedEntity(String ent) throws SAXException { throw new SAXException("Don't know how to skip entities"); } /** Inserts a processing instruction. * * @param target The PI target * @param data The PI data * @throws SAXException Thrown in case of an IOException */ public void processingInstruction(String target, String data) throws SAXException { try { stopTerminator(); if (w != null) { w.write("<?"); w.write(target); w.write(' '); w.write(data); w.write("?>"); } } catch (java.io.IOException e) { throw new SAXException(e); } } }
{ "content_hash": "c4421800f293caf1c32cd10848a713fc", "timestamp": "", "source": "github", "line_count": 340, "max_line_length": 98, "avg_line_length": 28.45, "alnum_prop": 0.5754161066887212, "repo_name": "eleumik/eleusoft_jaxs", "id": "045510a8d758b0feb2f121ffe8d3b7b967c44f66", "size": "11929", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/org/eleusoft/jaxs/helpers/XMLWriter.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "484" }, { "name": "Java", "bytes": "103577" }, { "name": "XSLT", "bytes": "11697" } ], "symlink_target": "" }
module LoanAccessoriesHelper end
{ "content_hash": "57b51126052920e2006bb133047eec6d", "timestamp": "", "source": "github", "line_count": 2, "max_line_length": 28, "avg_line_length": 16.5, "alnum_prop": 0.9090909090909091, "repo_name": "DiegoCorrea/SoldadinhodeChumbo", "id": "a66cd01c30a414499517ad4568eb0ec52e3d0188", "size": "33", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/helpers/loan_accessories_helper.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "6165" }, { "name": "HTML", "bytes": "37061" }, { "name": "JavaScript", "bytes": "1032" }, { "name": "Ruby", "bytes": "92783" } ], "symlink_target": "" }
#######################DISA INFORMATION############################### #Group ID (Vulid): V-756 #Group Title: The UNIX host is bootable in single user mode #Rule ID: SV-27036r1_rule #Severity: CAT II #Rule Version (STIG-ID): GEN000020 #Rule Title: The system must require authentication #upon booting into single-user and maintenance modes. # #Vulnerability Discussion: If the system does not require valid root #authentication before it boots into single-user or maintenance mode, #anyone who invokes single-user or maintenance mode is granted #privileged access to all files on the system. # #Responsibility: System Administrator #IAControls: IAIA-1, IAIA-2 # #Check Content: #Check if the system requires a password for entering single-user mode. # grep ':S:' /etc/inittab #If /sbin/sulogin is not listed, this is a finding. # #Fix Text: Edit /etc/inittab and set sulogin to run in single-user mode. #Example line in /etc/inittab: #~:S:wait:/sbin/sulogin #######################DISA INFORMATION############################### #Global Variables# PDI=GEN000020 #Start-Lockdown SULOGIN=`grep -c "~:S:wait:/sbin/sulogin" /etc/inittab` #Start-Lockdown if [ $SULOGIN -eq 0 ] then echo " " >> /etc/inittab echo "#Configured to meet GEN000020" >> /etc/inittab echo "~:S:wait:/sbin/sulogin" >> /etc/inittab fi
{ "content_hash": "1cca49490b6a1dac191733bb5983360d", "timestamp": "", "source": "github", "line_count": 46, "max_line_length": 72, "avg_line_length": 29.282608695652176, "alnum_prop": 0.6711210096510765, "repo_name": "quark-pat/CLIP", "id": "76cfa3c37c2e747ad0c9a9785cb03ee906a4e461", "size": "2867", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "packages/aqueduct/aqueduct/compliance/Bash/STIG/rhel-5-beta/prod/GEN000020.sh", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "ApacheConf", "bytes": "81652" }, { "name": "Augeas", "bytes": "1413" }, { "name": "Awk", "bytes": "209" }, { "name": "C", "bytes": "13623" }, { "name": "CSS", "bytes": "11752" }, { "name": "HTML", "bytes": "445341" }, { "name": "JavaScript", "bytes": "4586" }, { "name": "Makefile", "bytes": "93916" }, { "name": "Pascal", "bytes": "65326" }, { "name": "Perl", "bytes": "7909" }, { "name": "Puppet", "bytes": "45057" }, { "name": "Python", "bytes": "327420" }, { "name": "Ruby", "bytes": "4278" }, { "name": "Shell", "bytes": "5486255" }, { "name": "XML", "bytes": "13608580" }, { "name": "XSLT", "bytes": "171062" } ], "symlink_target": "" }
import React from 'react'; import Realm from 'realm'; import {View, Text, Pressable, StyleSheet} from 'react-native'; import {shadows} from '../styles/shadows'; import colors from '../styles/colors'; import {Task} from '../models/Task'; type TaskItemProps = { task: Task & Realm.Object; onToggleStatus: () => void; onDelete: () => void; }; export const TaskItem = React.memo<TaskItemProps>( ({task, onToggleStatus, onDelete}) => { return ( <View style={styles.task}> <Pressable onPress={onToggleStatus} style={[styles.status, task.isComplete && styles.completed]}> <Text style={styles.icon}>{task.isComplete ? '✓' : '○'}</Text> </Pressable> <View style={styles.descriptionContainer}> <Text numberOfLines={1} style={styles.description}> {task.description} </Text> </View> <Pressable onPress={onDelete} style={styles.deleteButton}> <Text style={styles.deleteText}>Delete</Text> </Pressable> </View> ); }, ); const styles = StyleSheet.create({ task: { height: 50, alignSelf: 'stretch', flexDirection: 'row', marginVertical: 8, backgroundColor: colors.white, borderRadius: 5, ...shadows, }, descriptionContainer: { flex: 1, justifyContent: 'center', }, description: { paddingHorizontal: 10, color: colors.black, fontSize: 17, }, status: { width: 50, height: '100%', justifyContent: 'center', borderTopLeftRadius: 5, borderBottomLeftRadius: 5, backgroundColor: colors.gray, }, completed: { backgroundColor: colors.purple, }, deleteButton: { justifyContent: 'center', }, deleteText: { marginHorizontal: 10, color: colors.gray, fontSize: 17, }, icon: { color: colors.white, textAlign: 'center', fontSize: 17, fontWeight: 'bold', }, });
{ "content_hash": "0bf848b68dc9fd0257056a7f953a371c", "timestamp": "", "source": "github", "line_count": 81, "max_line_length": 72, "avg_line_length": 23.74074074074074, "alnum_prop": 0.6063442537701508, "repo_name": "realm/realm-js", "id": "95aae8ec1d426abff0eb716fd9845956037bfd45", "size": "1927", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "templates/react-native-template-realm-ts/template/app/components/TaskItem.tsx", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "399" }, { "name": "C", "bytes": "846" }, { "name": "C++", "bytes": "745104" }, { "name": "CMake", "bytes": "10467" }, { "name": "Dockerfile", "bytes": "3119" }, { "name": "HTML", "bytes": "31" }, { "name": "Java", "bytes": "75283" }, { "name": "JavaScript", "bytes": "693446" }, { "name": "Makefile", "bytes": "3066" }, { "name": "Objective-C", "bytes": "11784" }, { "name": "Objective-C++", "bytes": "28861" }, { "name": "PowerShell", "bytes": "1161" }, { "name": "Ruby", "bytes": "12032" }, { "name": "Shell", "bytes": "26024" }, { "name": "Starlark", "bytes": "2408" }, { "name": "Swift", "bytes": "762" }, { "name": "TypeScript", "bytes": "866205" } ], "symlink_target": "" }
package com.dewey.deweyapp.location; import android.app.Activity; import android.app.FragmentTransaction; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.EditText; import android.widget.TextView; import com.dewey.deweyapp.R; public class LocationActivity extends Activity{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_location); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_location, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } public void drawMap(View view){ System.out.println("Inside Draw Map"); FragmentTransaction trans = getFragmentManager().beginTransaction(); LocationActivityFragment fragment = new LocationActivityFragment(); trans.add(R.id.loc_fragment, fragment).commit(); } }
{ "content_hash": "ea61225833d2d6afc757607f95892713", "timestamp": "", "source": "github", "line_count": 58, "max_line_length": 80, "avg_line_length": 27.67241379310345, "alnum_prop": 0.6978193146417445, "repo_name": "brandoncox/MyApplication", "id": "9aada8d2b709af892fafa52af92e3aa562400fd3", "size": "1605", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/src/main/java/com/dewey/deweyapp/location/LocationActivity.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "6728" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>quicksort-complexity: 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.13.0 / quicksort-complexity - 8.8.0</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> quicksort-complexity <small> 8.8.0 <span class="label label-info">Not compatible</span> </small> </h1> <p><em><script>document.write(moment("2021-04-16 16:56:55 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2021-04-16 16:56:55 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 3 Virtual package relying on a GMP lib system installation coq 8.13.0 Formal proof management system num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic ocaml 4.11.1 The OCaml compiler (virtual package) ocaml-base-compiler 4.11.1 Official release 4.11.1 ocaml-config 1 OCaml Switch Configuration ocamlfind 1.9.1 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;[email protected]&quot; homepage: &quot;https://github.com/coq-contribs/quicksort-complexity&quot; license: &quot;BSD&quot; build: [make &quot;-j%{jobs}%&quot;] install: [make &quot;install&quot;] remove: [&quot;rm&quot; &quot;-R&quot; &quot;%{lib}%/coq/user-contrib/QuicksortComplexity&quot;] depends: [ &quot;ocaml&quot; &quot;coq&quot; {&gt;= &quot;8.8&quot; &amp; &lt; &quot;8.9~&quot;} ] tags: [ &quot;keyword: quicksort&quot; &quot;keyword: complexity&quot; &quot;keyword: average-case&quot; &quot;category: Computer Science/Decision Procedures and Certified Algorithms/Correctness proofs of algorithms&quot; &quot;date: 2010-06&quot; ] authors: [ &quot;Eelis&quot; ] bug-reports: &quot;https://github.com/coq-contribs/quicksort-complexity/issues&quot; dev-repo: &quot;git+https://github.com/coq-contribs/quicksort-complexity.git&quot; synopsis: &quot;Proofs of Quicksort&#39;s worst- and average-case complexity&quot; description: &quot;&quot;&quot; The development contains: - a set of monads and monad transformers for measuring a (possibly nondeterministic) algorithm&#39;s use of designated operations; - monadically expressed deterministic and nondeterministic implementations of Quicksort; - proofs of these implementations&#39; worst- and average case complexity. Most of the development is documented in the TYPES 2008 paper &quot;A Machine-Checked Proof of the Average-Case Complexity of Quicksort in Coq&quot;, available at the homepage.&quot;&quot;&quot; flags: light-uninstall url { src: &quot;https://github.com/coq-contribs/quicksort-complexity/archive/v8.8.0.tar.gz&quot; checksum: &quot;md5=86b001d6780b06f5e725cb197ea61d8e&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-quicksort-complexity.8.8.0 coq.8.13.0</code></dd> <dt>Return code</dt> <dd>5120</dd> <dt>Output</dt> <dd><pre>[NOTE] Package coq is already installed (current version is 8.13.0). The following dependencies couldn&#39;t be met: - coq-quicksort-complexity -&gt; coq &lt; 8.9~ -&gt; ocaml &lt; 4.10 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-quicksort-complexity.8.8.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"> <small>Sources are on <a href="https://github.com/coq-bench">GitHub</a>. © Guillaume Claret.</small> </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
{ "content_hash": "92951cf3cb7bbeb0efead504ae58953a", "timestamp": "", "source": "github", "line_count": 168, "max_line_length": 249, "avg_line_length": 44.773809523809526, "alnum_prop": 0.5674022866258974, "repo_name": "coq-bench/coq-bench.github.io", "id": "6e3f58d7b72f182393c557d6f4ab12c54906aa92", "size": "7524", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "clean/Linux-x86_64-4.11.1-2.0.7/released/8.13.0/quicksort-complexity/8.8.0.html", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
import random import numpy as np import sys from domain.make_env import make_env from neat_src import * class GymTask(): """Problem domain to be solved by neural network. Uses OpenAI Gym patterns. """ def __init__(self, game, paramOnly=False, nReps=1): """Initializes task environment Args: game - (string) - dict key of task to be solved (see domain/config.py) Optional: paramOnly - (bool) - only load parameters instead of launching task? nReps - (nReps) - number of trials to get average fitness """ # Network properties self.nInput = game.input_size self.nOutput = game.output_size self.actRange = game.h_act self.absWCap = game.weightCap self.layers = game.layers self.activations = np.r_[np.full(1,1),game.i_act,game.o_act] # Environment self.nReps = nReps self.maxEpisodeLength = game.max_episode_length self.actSelect = game.actionSelect if not paramOnly: self.env = make_env(game.env_name) # Special needs... self.needsClosed = (game.env_name.startswith("CartPoleSwingUp")) def getFitness(self, wVec, aVec, hyp=None, view=False, nRep=False, seed=-1): """Get fitness of a single individual. Args: wVec - (np_array) - weight matrix as a flattened vector [N**2 X 1] aVec - (np_array) - activation function of each node [N X 1] - stored as ints (see applyAct in ann.py) Optional: view - (bool) - view trial? nReps - (nReps) - number of trials to get average fitness seed - (int) - starting random seed for trials Returns: fitness - (float) - mean reward over all trials """ if nRep is False: nRep = self.nReps wVec[np.isnan(wVec)] = 0 reward = np.empty(nRep) for iRep in range(nRep): reward[iRep] = self.testInd(wVec, aVec, view=view, seed=seed+iRep) fitness = np.mean(reward) return fitness def testInd(self, wVec, aVec, view=False,seed=-1): """Evaluate individual on task Args: wVec - (np_array) - weight matrix as a flattened vector [N**2 X 1] aVec - (np_array) - activation function of each node [N X 1] - stored as ints (see applyAct in ann.py) Optional: view - (bool) - view trial? seed - (int) - starting random seed for trials Returns: fitness - (float) - reward earned in trial """ if seed >= 0: random.seed(seed) np.random.seed(seed) self.env.seed(seed) state = self.env.reset() self.env.t = 0 annOut = act(wVec, aVec, self.nInput, self.nOutput, state) action = selectAct(annOut,self.actSelect) wVec[wVec!=0] predName = str(np.mean(wVec[wVec!=0])) state, reward, done, info = self.env.step(action) if self.maxEpisodeLength == 0: if view: if self.needsClosed: self.env.render(close=done) else: self.env.render() return reward else: totalReward = reward for tStep in range(self.maxEpisodeLength): annOut = act(wVec, aVec, self.nInput, self.nOutput, state) action = selectAct(annOut,self.actSelect) state, reward, done, info = self.env.step(action) totalReward += reward if view: if self.needsClosed: self.env.render(close=done) else: self.env.render() if done: break return totalReward
{ "content_hash": "cd3719f32947c507a5ca507cbba98d11", "timestamp": "", "source": "github", "line_count": 115, "max_line_length": 78, "avg_line_length": 31, "alnum_prop": 0.5957924263674614, "repo_name": "google/brain-tokyo-workshop", "id": "3ebd386999749995c5a353a1c390f5d3c33cacee", "size": "3565", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "WANNRelease/prettyNEAT/domain/task_gym.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Dockerfile", "bytes": "671" }, { "name": "HTML", "bytes": "1031" }, { "name": "Jupyter Notebook", "bytes": "47079538" }, { "name": "Python", "bytes": "1037153" }, { "name": "Shell", "bytes": "6053" } ], "symlink_target": "" }
package fr.ocr.sql; import javax.swing.JFrame; import javax.swing.JOptionPane; public class DAOException extends Exception { /** * */ private static final long serialVersionUID = -7652868337064812965L; @SuppressWarnings("static-access") public DAOException(String mess) { super(mess); JOptionPane jop = new JOptionPane(); jop.showMessageDialog(displayDialog(), mess, "Erreur de recherche dans le DAO", JOptionPane.ERROR_MESSAGE); } /** * Boite de dialog * * @return */ private JFrame displayDialog() { JFrame jF = new JFrame(); jF.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jF.setAlwaysOnTop(true); jF.setLocation(100, 100); jF.pack(); jF.setLocationRelativeTo(null); return jF; } }
{ "content_hash": "5a84ea888fbec154dd292f6406bb2abc", "timestamp": "", "source": "github", "line_count": 35, "max_line_length": 109, "avg_line_length": 21.02857142857143, "alnum_prop": 0.7133152173913043, "repo_name": "Bernardinhouessou/Projets_Autres", "id": "6260aee13b35aafb6227aeb2d18e67798daf02ec", "size": "736", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Java EE Projects (TPs-autres)/Projets Java EE-JDBC/IHM_Garage JDBC/Vehicule-JDBC/src/fr/ocr/sql/DAOException.java", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "9812" }, { "name": "C", "bytes": "25730" }, { "name": "C#", "bytes": "1826" }, { "name": "C++", "bytes": "8278" }, { "name": "CSS", "bytes": "17218" }, { "name": "Groovy", "bytes": "20556" }, { "name": "HTML", "bytes": "17806707" }, { "name": "Hack", "bytes": "3435" }, { "name": "Java", "bytes": "21036831" }, { "name": "JavaScript", "bytes": "17665" }, { "name": "Lex", "bytes": "24122" }, { "name": "PHP", "bytes": "181894" }, { "name": "PLpgSQL", "bytes": "4202" }, { "name": "Perl", "bytes": "6946" }, { "name": "Python", "bytes": "189530" }, { "name": "Shell", "bytes": "91862" }, { "name": "TypeScript", "bytes": "1180" }, { "name": "XSLT", "bytes": "44906" } ], "symlink_target": "" }
namespace Ui{ class page_bluetooth; }; class page_bluetooth : public PageWidget{ Q_OBJECT public: page_bluetooth(QWidget *parent); ~page_bluetooth(); public slots: void SaveSettings(); void LoadSettings(int screennum); void updateIcons(); private: Ui::page_bluetooth *ui; private slots: }; #endif
{ "content_hash": "376433d95d095ea7d1582d441c16b1e5", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 41, "avg_line_length": 14.636363636363637, "alnum_prop": 0.7018633540372671, "repo_name": "Nanolx/lumina", "id": "1f140d82e365c2c82c602b67d80c65ab26b9b377", "size": "726", "binary": false, "copies": "6", "ref": "refs/heads/master", "path": "src-qt5/core-utils/lumina-config/pages/page_bluetooth_trueos.h", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "C", "bytes": "2520" }, { "name": "C++", "bytes": "2183274" }, { "name": "Makefile", "bytes": "2533" }, { "name": "QML", "bytes": "253" }, { "name": "QMake", "bytes": "79016" }, { "name": "Shell", "bytes": "5700" } ], "symlink_target": "" }
package com.acervera.osm4scala.examples.taken import com.acervera.osm4scala.BlobTupleIterator import com.acervera.osm4scala.examples.taken.ParametersConfig._ import com.acervera.osm4scala.examples.utilities.Benchmarking import com.acervera.osm4scala.utilities.Osm4ScalaUtils import java.io._ import java.nio.file.{Files, Paths} /** * Low level example about how take the N first blocks in a pbf file and write it in another. */ object TakeN extends App with Osm4ScalaUtils with Benchmarking { def fromPbf(inPbfPath: String, outPbfPath: String, blocksNumber: Int): Unit = { var pbfIS: InputStream = null var dsOS: DataOutputStream = null try { Files.createDirectories(Paths.get(outPbfPath).getParent) pbfIS = new FileInputStream(inPbfPath) dsOS = new DataOutputStream(new FileOutputStream(outPbfPath)) BlobTupleIterator .fromPbf(pbfIS) .take(blocksNumber) .foreach { case (header, blob) => dsOS.writeInt(header.serializedSize) header writeTo dsOS blob writeTo dsOS } } finally { if (pbfIS != null) pbfIS.close() if (dsOS != null) dsOS.close() } } // Logic that parse parameters. parser.parse(args, Config()) match { case Some(config) => { val (mms, _) = time { fromPbf(config.input, config.output, config.blocks) } println(f"Extracted ${config.blocks} blocks from ${config.input}%s file and stored in ${config.output} in ${mms * 1e-9}%,2.2f sec.") } case _ => } }
{ "content_hash": "44890ab5de79aec225002c3fc3f3036c", "timestamp": "", "source": "github", "line_count": 49, "max_line_length": 138, "avg_line_length": 31.489795918367346, "alnum_prop": 0.6753078418664938, "repo_name": "angelcervera/osm4scala", "id": "1cf7c523328a5531f3e760a3c11e11a7ddf1b81d", "size": "2700", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "examples/takeN/src/main/scala/com/acervera/osm4scala/examples/taken/TakeN.scala", "mode": "33188", "license": "mit", "language": [ { "name": "Scala", "bytes": "45367" } ], "symlink_target": "" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN"> <html> <head> <meta http-equiv="Content-Language" content="en-us"> <title>IupTuioClient</title> <link rel="stylesheet" type="text/css" href="../../style.css"> <style type="text/css"> .style1 { font-size: large; } </style> </head> <body> <div id="navigation"> <ul> <li><a href="#Creation">Creation</a></li> <li><a href="#Attributes">Attributes</a></li> <li><a href="#Callbacks">Callbacks</a></li> <li><a href="#Notes">Notes</a></li> <li><a href="#Examples">Examples</a></li> <li><a href="#SeeAlso">See Also</a></li> </ul> </div> <h2>IupTuioClient<span class="style1"> (since 3.3)</span></h2> <p>Implements a <a href="http://www.tuio.org">TUIO</a> protocol client that allows the use of multi-touch devices. It can use any TUIO server, but it was tested with the <a href="http://ccv.nuigroup.com/">Community Core Vision</a> (CCV) from the NUI Group. </p> <h3>Initialization and usage</h3> <p>The <b>IupTuioOpen</b> function must be called after a <b>IupOpen</b>, so that the control can be used. The iuptuio.h file must also be included in the source code. The program must be linked to the controls library (iuptuio). There is no external dependencies, the TUIO client library is already included.</p> <p>To make the control available in Lua use require&quot;iupluatuio&quot; or manually call the initialization function in C, <b>iuptuiolua_open</b>, after calling <b>iuplua_open</b>. When manually calling the function the iupluatuio.h file must also be included in the source code and the program must be linked to the respective Lua control library (iupluatuio).</p> <h3><a name="Creation">Creation</a></h3> <pre>Ihandle* IupTuioClient(int <strong>port</strong>); [in C] iup.tuioclient{<b>[port</b>: number]} -&gt; (<strong>ih</strong>: ihandle) [in Lua] tuioclient(port) [in LED] </pre> <b> <p>port</b>: the UDP port used to connect to the TUIO server. If 0 is specified then the default value of 3333 will be used (in Lua it can be simply omitted).</p> <p> <u>Returns:</u> the identifier of the created element, or NULL if an error occurs.</p> <h3><a name="Attributes">Attributes</a></h3> <p><strong>CONNECT</strong>: connects (YES) or disconnects (NO) to the TUIO server. Returns the connected state. If LOCKED is used when connected the <strong>IupSetAttribute</strong> will not return until it is disconnected (not recommended).</p> <p><strong>DEBUG</strong>: when set will enable a print a log of TUIO cursor messages on standard output.</p> <p><strong>TARGETCANVAS</strong><b>:</b> name of a handle to an <strong> IupCanvas</strong> that will be used to receive the events.</p> <h3><a name="Callbacks">Callbacks</a></h3> <p><strong>TOUCH_CB</strong>: Action generated when a touch event occurred. Multiple touch events will trigger several calls.</p> <pre>int function(Ihandle* <strong>ih</strong>, int <strong>id</strong>, int <strong>x</strong>, int <strong>y</strong>, char* <strong>state</strong>); [in C] <strong>ih</strong>:touch_cb(<strong>id</strong>, <strong>x</strong>,<strong> y</strong>: number,<strong> state</strong>: string) -&gt; (<strong>ret</strong>: number) [in Lua]</pre> <p class="info"><strong>ih</strong>: identifies the element that activated the event. If TARGETCANVAS is not defined then it is the <strong>IupTuioClient</strong> control.<br> <strong>id</strong>: identifies the touch point. <strong><br> x</strong>, <strong>y</strong>: position in pixels, relative to the top-left corner of the canvas, or the screen if TARGETCANVAS is not defined.<br> <strong>state</strong>: the touch point state. Can be: DOWN, MOVE or UP. If the point is a &quot;primary&quot; point then &quot;-PRIMARY&quot; is appended to the string.</p> <p class="info"><u>Returns</u>: IUP_CLOSE will be processed.</p> <p><strong>MULTITOUCH_CB</strong>: Action generated when multiple touch events occurred.</p> <pre>int function(Ihandle *<strong>ih</strong>, int <strong>count</strong>, int* <strong>pid</strong>, int* <strong>px</strong>, int* <strong>py</strong>, int* <strong>pstate</strong>) [in C] <strong>ih</strong>:multitouch_cb(<strong>count:</strong> number<strong>, pid, px, py, pstate: </strong>table) -&gt; (<strong>ret</strong>: number) [in Lua]</pre> <p class="info"><strong>ih</strong>: identifier of the element that activated the event. If TARGETCANVAS is not defined then it is the <strong>IupTuioClient</strong> control.<br> <strong>count</strong>: Number of touch points in the array.<br> <strong>pid</strong>: Array of touch point ids.<br> <strong>px</strong>: Array of touch point x coordinates in pixels, relative to the top-left corner of the canvas, or the screen if TARGETCANVAS is not defined.<br> <strong>py</strong>: Array of touch point y coordinates in pixels, relative to the top-left corner of the canvas, or the screen if TARGETCANVAS is not defined.<br> <strong>pstate</strong>: Array of touch point states. Can be &#39;D&#39; (DOWN), &#39;U&#39; (UP) or &#39;M&#39; (MOVE).<br> </p> <p class="info"><u>Returns</u>: IUP_CLOSE will be processed.</p> <h3><a name="Notes">Notes</a></h3> <p>The cursor ID used in the callbacks is the session ID. In TUIO when a cursor is destroyed another cursor can be created with the same ID, the difference between them is the session ID that is always incremented every time a cursor is added or removed. We consider the primary cursor the existing cursor with the smaller session ID.</p> <p>The native support for multi-touch in Windows 7 uses the same callbacks described here without the need of a <strong>IupTuioClient</strong> control. So the application will work without change. But the attribute TOUCH=YES must be set on the <strong>IupCanvas</strong>, and coordinates will be always relative to the top-left corner of the canvas.</p> <p>The <strong>IupTuioClient</strong> does not emulates a mouse for single touch events. But as you can see from the example a mouse emulator can be easily implemented.</p> <p>To learn more about TUIO:</p> <p class="info"><a target="_blank" href="http://www.microsoft.com/com">http://www.t</a><a href="http://www.tuio.org">uio.org</a></p> <h3><a name="Examples">Examples</a></h3> <p><a href="../../examples/">Browse for Example Files</a> (see <a href="../../examples/C/canvas1.c">canvas1.c</a>)</p> </body> </html> </body> </html>
{ "content_hash": "98cc4019e5d6d471583e30682da2149c", "timestamp": "", "source": "github", "line_count": 128, "max_line_length": 191, "avg_line_length": 50.109375, "alnum_prop": 0.7086061739943873, "repo_name": "ivanceras/iup-mirror", "id": "1330599df8bd71bcf1c44227d07f3d7c6200be0a", "size": "6416", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "html/en/ctrl/iuptuio.html", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "51" }, { "name": "Batchfile", "bytes": "10657" }, { "name": "C", "bytes": "10805242" }, { "name": "C++", "bytes": "7443129" }, { "name": "CSS", "bytes": "14478" }, { "name": "HTML", "bytes": "2313042" }, { "name": "Lua", "bytes": "729555" }, { "name": "Makefile", "bytes": "139501" }, { "name": "Shell", "bytes": "11775" } ], "symlink_target": "" }
// Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "components/shared_highlighting/core/common/shared_highlighting_metrics.h" #include "base/test/metrics/histogram_tester.h" #include "base/test/task_environment.h" #include "components/ukm/test_ukm_recorder.h" #include "services/metrics/public/cpp/ukm_builders.h" #include "services/metrics/public/cpp/ukm_source_id.h" #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h" namespace shared_highlighting { namespace { const char kSearchEngineUrl[] = "https://google.com"; const char kSourceUkmMetric[] = "Source"; const char kSuccessUkmMetric[] = "Success"; const char kErrorUkmMetric[] = "Error"; class SharedHighlightingMetricsTest : public testing::Test { protected: SharedHighlightingMetricsTest() = default; ~SharedHighlightingMetricsTest() override = default; void ValidateLinkOpenedUkm(const ukm::TestAutoSetUkmRecorder& recorder, ukm::SourceId source_id, bool success, TextFragmentLinkOpenSource source) { auto entries = recorder.GetEntriesByName( ukm::builders::SharedHighlights_LinkOpened::kEntryName); ASSERT_EQ(1u, entries.size()); const ukm::mojom::UkmEntry* entry = entries[0]; EXPECT_EQ(source_id, entry->source_id); recorder.ExpectEntryMetric(entry, kSuccessUkmMetric, success); recorder.ExpectEntryMetric(entry, kSourceUkmMetric, static_cast<int64_t>(source)); } base::HistogramTester histogram_tester_; private: base::test::SingleThreadTaskEnvironment task_environment_; }; TEST_F(SharedHighlightingMetricsTest, LogTextFragmentAmbiguousMatch) { LogTextFragmentAmbiguousMatch(true); histogram_tester_.ExpectBucketCount("TextFragmentAnchor.AmbiguousMatch", 1, 1); LogTextFragmentAmbiguousMatch(false); histogram_tester_.ExpectBucketCount("TextFragmentAnchor.AmbiguousMatch", 0, 1); histogram_tester_.ExpectTotalCount("TextFragmentAnchor.AmbiguousMatch", 2); } TEST_F(SharedHighlightingMetricsTest, LogTextFragmentLinkOpenSource) { GURL search_engine_url(kSearchEngineUrl); LogTextFragmentLinkOpenSource(search_engine_url); histogram_tester_.ExpectBucketCount("TextFragmentAnchor.LinkOpenSource", TextFragmentLinkOpenSource::kSearchEngine, 1); GURL non_search_engine_url("https://example.com"); LogTextFragmentLinkOpenSource(non_search_engine_url); histogram_tester_.ExpectBucketCount("TextFragmentAnchor.LinkOpenSource", TextFragmentLinkOpenSource::kUnknown, 1); histogram_tester_.ExpectTotalCount("TextFragmentAnchor.LinkOpenSource", 2); GURL empty_gurl(""); LogTextFragmentLinkOpenSource(empty_gurl); histogram_tester_.ExpectBucketCount("TextFragmentAnchor.LinkOpenSource", TextFragmentLinkOpenSource::kUnknown, 2); histogram_tester_.ExpectTotalCount("TextFragmentAnchor.LinkOpenSource", 3); GURL google_non_search_domain("https://mail.google.com"); LogTextFragmentLinkOpenSource(google_non_search_domain); histogram_tester_.ExpectBucketCount("TextFragmentAnchor.LinkOpenSource", TextFragmentLinkOpenSource::kUnknown, 3); histogram_tester_.ExpectTotalCount("TextFragmentAnchor.LinkOpenSource", 4); } TEST_F(SharedHighlightingMetricsTest, LogTextFragmentMatchRate) { LogTextFragmentMatchRate(/*matches=*/2, /*text_fragments=*/2); histogram_tester_.ExpectBucketCount("TextFragmentAnchor.MatchRate", 100, 1); LogTextFragmentMatchRate(/*matches=*/1, /*text_fragments=*/2); histogram_tester_.ExpectBucketCount("TextFragmentAnchor.MatchRate", 50, 1); histogram_tester_.ExpectTotalCount("TextFragmentAnchor.MatchRate", 2); } TEST_F(SharedHighlightingMetricsTest, LogTextFragmentSelectorCount) { LogTextFragmentSelectorCount(1); histogram_tester_.ExpectBucketCount("TextFragmentAnchor.SelectorCount", 1, 1); LogTextFragmentSelectorCount(20); histogram_tester_.ExpectBucketCount("TextFragmentAnchor.SelectorCount", 20, 1); histogram_tester_.ExpectTotalCount("TextFragmentAnchor.SelectorCount", 2); } TEST_F(SharedHighlightingMetricsTest, LogLinkGenerationStatus) { LogLinkGenerationStatus(true); histogram_tester_.ExpectUniqueSample("SharedHighlights.LinkGenerated", true, 1); LogLinkGenerationStatus(false); histogram_tester_.ExpectBucketCount("SharedHighlights.LinkGenerated", false, 1); histogram_tester_.ExpectTotalCount("SharedHighlights.LinkGenerated", 2); } TEST_F(SharedHighlightingMetricsTest, LogLinkGenerationErrorReason) { LogLinkGenerationErrorReason(LinkGenerationError::kIncorrectSelector); histogram_tester_.ExpectBucketCount("SharedHighlights.LinkGenerated.Error", LinkGenerationError::kIncorrectSelector, 1); LogLinkGenerationErrorReason(LinkGenerationError::kEmptySelection); histogram_tester_.ExpectBucketCount("SharedHighlights.LinkGenerated.Error", LinkGenerationError::kEmptySelection, 1); histogram_tester_.ExpectTotalCount("SharedHighlights.LinkGenerated.Error", 2); } TEST_F(SharedHighlightingMetricsTest, LogAndroidLinkGenerationErrorReason) { LogGenerateErrorTabHidden(); histogram_tester_.ExpectBucketCount("SharedHighlights.LinkGenerated.Error", LinkGenerationError::kTabHidden, 1); LogGenerateErrorOmniboxNavigation(); histogram_tester_.ExpectBucketCount("SharedHighlights.LinkGenerated.Error", LinkGenerationError::kOmniboxNavigation, 1); LogGenerateErrorTabCrash(); histogram_tester_.ExpectBucketCount("SharedHighlights.LinkGenerated.Error", LinkGenerationError::kTabCrash, 1); histogram_tester_.ExpectTotalCount("SharedHighlights.LinkGenerated.Error", 3); } TEST_F(SharedHighlightingMetricsTest, LinkOpenedUkmSuccessSearchEngine) { ukm::TestAutoSetUkmRecorder ukm_recorder; ukm::SourceId source_id = 1; bool success = true; LogLinkOpenedUkmEvent(source_id, GURL(kSearchEngineUrl), success); ValidateLinkOpenedUkm(ukm_recorder, source_id, success, TextFragmentLinkOpenSource::kSearchEngine); } TEST_F(SharedHighlightingMetricsTest, LinkOpenedUkmFailSearchEngine) { ukm::TestAutoSetUkmRecorder ukm_recorder; ukm::SourceId source_id = 1; bool success = false; LogLinkOpenedUkmEvent(source_id, GURL(kSearchEngineUrl), success); ValidateLinkOpenedUkm(ukm_recorder, source_id, success, TextFragmentLinkOpenSource::kSearchEngine); } TEST_F(SharedHighlightingMetricsTest, LinkOpenedUkmSuccessUnknownSource) { ukm::TestAutoSetUkmRecorder ukm_recorder; ukm::SourceId source_id = 1; bool success = true; LogLinkOpenedUkmEvent(source_id, GURL(), success); ValidateLinkOpenedUkm(ukm_recorder, source_id, success, TextFragmentLinkOpenSource::kUnknown); } TEST_F(SharedHighlightingMetricsTest, LinkOpenedUkmFailUnknownSource) { ukm::TestAutoSetUkmRecorder ukm_recorder; ukm::SourceId source_id = 1; bool success = false; LogLinkOpenedUkmEvent(source_id, GURL(), success); ValidateLinkOpenedUkm(ukm_recorder, source_id, success, TextFragmentLinkOpenSource::kUnknown); } TEST_F(SharedHighlightingMetricsTest, LinkOpenedUkmInvalidSourceId) { ukm::TestAutoSetUkmRecorder ukm_recorder; LogLinkOpenedUkmEvent(ukm::kInvalidSourceId, GURL(kSearchEngineUrl), /*success=*/true); auto entries = ukm_recorder.GetEntriesByName( ukm::builders::SharedHighlights_LinkOpened::kEntryName); EXPECT_EQ(0u, entries.size()); } // Tests that using the endpoints with a custom recorder won't use the static // UKM recorder. TEST_F(SharedHighlightingMetricsTest, LinkOpenedUkmCustomRecorder) { ukm::TestAutoSetUkmRecorder static_ukm_recorder; ukm::TestUkmRecorder custom_ukm_recorder; ukm::SourceId source_id = 1; LogLinkOpenedUkmEvent(&custom_ukm_recorder, source_id, GURL(), /*success=*/true); auto static_entries = static_ukm_recorder.GetEntriesByName( ukm::builders::SharedHighlights_LinkOpened::kEntryName); EXPECT_EQ(0U, static_entries.size()); auto custom_entries = custom_ukm_recorder.GetEntriesByName( ukm::builders::SharedHighlights_LinkOpened::kEntryName); EXPECT_EQ(1U, custom_entries.size()); } TEST_F(SharedHighlightingMetricsTest, LinkGeneratedUkmSuccess) { ukm::TestAutoSetUkmRecorder ukm_recorder; ukm::SourceId source_id = 1; LogLinkGeneratedSuccessUkmEvent(source_id); auto entries = ukm_recorder.GetEntriesByName( ukm::builders::SharedHighlights_LinkGenerated::kEntryName); ASSERT_EQ(1u, entries.size()); const ukm::mojom::UkmEntry* entry = entries[0]; EXPECT_EQ(source_id, entry->source_id); ukm_recorder.ExpectEntryMetric(entry, kSuccessUkmMetric, true); EXPECT_FALSE(ukm_recorder.GetEntryMetric(entry, kErrorUkmMetric)); } TEST_F(SharedHighlightingMetricsTest, LinkGeneratedUkmError) { ukm::TestAutoSetUkmRecorder ukm_recorder; ukm::SourceId source_id = 1; LinkGenerationError error = LinkGenerationError::kEmptySelection; LogLinkGeneratedErrorUkmEvent(source_id, error); auto entries = ukm_recorder.GetEntriesByName( ukm::builders::SharedHighlights_LinkGenerated::kEntryName); ASSERT_EQ(1u, entries.size()); const ukm::mojom::UkmEntry* entry = entries[0]; EXPECT_EQ(source_id, entry->source_id); ukm_recorder.ExpectEntryMetric(entry, kSuccessUkmMetric, false); ukm_recorder.ExpectEntryMetric(entry, kErrorUkmMetric, static_cast<int64_t>(error)); } TEST_F(SharedHighlightingMetricsTest, LinkGeneratedUkmSuccessInvalidSourceId) { ukm::TestAutoSetUkmRecorder ukm_recorder; LogLinkGeneratedSuccessUkmEvent(ukm::kInvalidSourceId); auto entries = ukm_recorder.GetEntriesByName( ukm::builders::SharedHighlights_LinkGenerated::kEntryName); EXPECT_EQ(0u, entries.size()); } // Tests that using the endpoints with a custom recorder won't use the static // UKM recorder. TEST_F(SharedHighlightingMetricsTest, LinkGeneratedUkmCustomRecorder) { ukm::TestAutoSetUkmRecorder static_ukm_recorder; ukm::TestUkmRecorder custom_ukm_recorder; ukm::SourceId source_id = 1; LogLinkGeneratedSuccessUkmEvent(&custom_ukm_recorder, source_id); LogLinkGeneratedErrorUkmEvent(&custom_ukm_recorder, source_id, LinkGenerationError::kEmptySelection); auto static_entries = static_ukm_recorder.GetEntriesByName( ukm::builders::SharedHighlights_LinkGenerated::kEntryName); EXPECT_EQ(0U, static_entries.size()); auto custom_entries = custom_ukm_recorder.GetEntriesByName( ukm::builders::SharedHighlights_LinkGenerated::kEntryName); EXPECT_EQ(2U, custom_entries.size()); } // Tests that link generation success latency logs to the right histogram. TEST_F(SharedHighlightingMetricsTest, LinkGeneratedSuccessLatency) { base::TimeDelta test_delta = base::Milliseconds(2000); LogGenerateSuccessLatency(test_delta); histogram_tester_.ExpectTimeBucketCount( "SharedHighlights.LinkGenerated.TimeToGenerate", test_delta, 1); } // Tests that link generation failure latency logs to the right histogram. TEST_F(SharedHighlightingMetricsTest, LinkGeneratedErrorLatency) { base::TimeDelta test_delta = base::Milliseconds(2000); LogGenerateErrorLatency(test_delta); histogram_tester_.ExpectTimeBucketCount( "SharedHighlights.LinkGenerated.Error.TimeToGenerate", test_delta, 1); } } // namespace } // namespace shared_highlighting
{ "content_hash": "cc573c655ee396488ca42082c1c2d604", "timestamp": "", "source": "github", "line_count": 303, "max_line_length": 83, "avg_line_length": 39.864686468646866, "alnum_prop": 0.7287027071777465, "repo_name": "ric2b/Vivaldi-browser", "id": "48d9b02a6c57a8399c98bdfa8bf07999fee8dbe0", "size": "12079", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "chromium/components/shared_highlighting/core/common/shared_highlighting_metrics_unittest.cc", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
void foo(void) { // CHECK: call void @mcount() // CHECK-PPC: call void @_mcount() }
{ "content_hash": "7e28b1151cb685a25a756d38c8a5633a", "timestamp": "", "source": "github", "line_count": 4, "max_line_length": 34, "avg_line_length": 21, "alnum_prop": 0.6190476190476191, "repo_name": "HackLinux/goblin-core", "id": "5c608bcd3657dc09b2e68682e6acc1d10977af4a", "size": "521", "binary": false, "copies": "10", "ref": "refs/heads/master", "path": "riscv/llvm/3.5/cfe-3.5.0.src/test/CodeGen/mcount.c", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "AppleScript", "bytes": "1429" }, { "name": "Assembly", "bytes": "37233636" }, { "name": "Awk", "bytes": "1296" }, { "name": "Batchfile", "bytes": "31924" }, { "name": "C", "bytes": "121284973" }, { "name": "C#", "bytes": "12418" }, { "name": "C++", "bytes": "125922408" }, { "name": "CMake", "bytes": "710908" }, { "name": "CSS", "bytes": "43924" }, { "name": "Common Lisp", "bytes": "65656" }, { "name": "Cuda", "bytes": "12393" }, { "name": "D", "bytes": "16218707" }, { "name": "DIGITAL Command Language", "bytes": "53633" }, { "name": "DTrace", "bytes": "8175207" }, { "name": "E", "bytes": "3290" }, { "name": "Eiffel", "bytes": "2314" }, { "name": "Elixir", "bytes": "314" }, { "name": "Emacs Lisp", "bytes": "41146" }, { "name": "FORTRAN", "bytes": "377751" }, { "name": "Forth", "bytes": "4188" }, { "name": "GAP", "bytes": "21991" }, { "name": "GDScript", "bytes": "54941" }, { "name": "Gnuplot", "bytes": "446" }, { "name": "Groff", "bytes": "1976484" }, { "name": "HTML", "bytes": "1119644" }, { "name": "JavaScript", "bytes": "24233" }, { "name": "LLVM", "bytes": "48362057" }, { "name": "Lex", "bytes": "596732" }, { "name": "Limbo", "bytes": "755" }, { "name": "M", "bytes": "1797" }, { "name": "Makefile", "bytes": "12715642" }, { "name": "Mathematica", "bytes": "5497" }, { "name": "Matlab", "bytes": "54444" }, { "name": "Mercury", "bytes": "1222" }, { "name": "OCaml", "bytes": "748821" }, { "name": "Objective-C", "bytes": "4995355" }, { "name": "Objective-C++", "bytes": "1419213" }, { "name": "Perl", "bytes": "880961" }, { "name": "Perl6", "bytes": "80742" }, { "name": "PicoLisp", "bytes": "31994" }, { "name": "Pure Data", "bytes": "22171" }, { "name": "Python", "bytes": "1375992" }, { "name": "R", "bytes": "627855" }, { "name": "Rebol", "bytes": "51929" }, { "name": "Scheme", "bytes": "4296232" }, { "name": "Shell", "bytes": "1994645" }, { "name": "SourcePawn", "bytes": "4564" }, { "name": "Standard ML", "bytes": "5682" }, { "name": "SuperCollider", "bytes": "734239" }, { "name": "Tcl", "bytes": "2234" }, { "name": "TeX", "bytes": "601780" }, { "name": "VimL", "bytes": "26411" }, { "name": "Yacc", "bytes": "769886" } ], "symlink_target": "" }
package org.rabix.bindings.model; import java.util.List; public interface Application { String serialize(); List<? extends ApplicationPort> getInputs(); List<? extends ApplicationPort> getOutputs(); }
{ "content_hash": "fe0ff194b7f7b13881d933ac2f50c65d", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 47, "avg_line_length": 17.833333333333332, "alnum_prop": 0.7383177570093458, "repo_name": "markosbg/markoBunny", "id": "f6fd4e3b0b4a42701075a28ec4f0bc15867748bd", "size": "214", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "rabix-bindings/src/main/java/org/rabix/bindings/model/Application.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "297" }, { "name": "HTML", "bytes": "2451" }, { "name": "Java", "bytes": "852053" }, { "name": "JavaScript", "bytes": "4011" }, { "name": "Shell", "bytes": "1829" } ], "symlink_target": "" }
package de.tum.in.www1.artemis.web.rest.dto; import com.fasterxml.jackson.annotation.JsonInclude; @JsonInclude(JsonInclude.Include.NON_EMPTY) public class FileMove { private String currentFilePath; private String newFilename; public String getCurrentFilePath() { return currentFilePath; } public void setCurrentFilePath(String currentFilename) { this.currentFilePath = currentFilename; } public String getNewFilename() { return newFilename; } public void setNewFilename(String newFilename) { this.newFilename = newFilename; } }
{ "content_hash": "e1c76690126eaba1f317a1b60537b97d", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 60, "avg_line_length": 22.51851851851852, "alnum_prop": 0.712171052631579, "repo_name": "ls1intum/ArTEMiS", "id": "0c4fdffb4594ddaf3811429e24b5ec9398277469", "size": "608", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "src/main/java/de/tum/in/www1/artemis/web/rest/dto/FileMove.java", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "77977" }, { "name": "Dockerfile", "bytes": "587" }, { "name": "HTML", "bytes": "768360" }, { "name": "Java", "bytes": "1948478" }, { "name": "JavaScript", "bytes": "24198" }, { "name": "Python", "bytes": "623" }, { "name": "Scala", "bytes": "198707" }, { "name": "Shell", "bytes": "864" }, { "name": "TypeScript", "bytes": "2685315" } ], "symlink_target": "" }
* * * titul: "Umělec: sekvence" náhled: page_curriculum téma: žádné * * * <%= partial('curriculum_header', :unittitle=>Kurz 1',: Lekce => 4,: titul => ' Umělec: sekvence',: unplugged => false,: čas => 30) %> [obsah] [dohromady] ## Lekce – přehled V této lekci se studenti převezmou řízení nad umělcem k dokončení jednoduché kresby na obrazovce. [Shrnutí] ## Přehled výuky ### **Začínáme** [Úvod](#GetStarted) ### **Aktivita: Umělec sekvence** [Umělec: sekvence](#Activity) ### **Rozšířená výuka** [Aktivity jako rozšíření](#Extended) [/ Shrnutí] ## Cíle lekce ### Studenti budou: * Vytvořit program na dokončení obrazu pomocí postupných kroků * Vyberte argument pro daný příkaz * Zvolte odpovídající bloky ke kreslení obrázků s nesouvislými řádky [/ dohromady] [dohromady] ## Začínáme ### <a name="GetStarted"></a> Úvod Prodiskutujte se studenty způsoby, jak někomu říct, jak nakreslit obrázek: * Jak byste to udělal s počítačem? * V těchto hádankách se pohybující postavy, který zanechávají čáry, všude, kam to jdou. * Budete používat základní pokyny k tomu, abyste to dělali stejně jako pták a včela. [/ dohromady] [dohromady] ## Aktivita ### <a name="Activity"></a> [Umělec: Sekvence](http://learn.code.org/s/course1/stage/8/puzzle/1) Pokud studenti bojují s použitím správného počtu bloků k nakreslení čáry, připomeňte, že každý segment čáry má bod na obou koncích. [/ dohromady] <!--(this is left in here as an example of how to include an image in Markdown) ![](binaryphoto.png) --> [dohromady] ## Rozšířená výuka <a name="Extended"></a>Používejte tyto aktivity k prohloubení učení studentů. Lze je použít jako mimoškolní aktivitu nebo jiné obohacení. ### Kopírka * Dejte studentům dva listy papíru. * Na jeden list nakreslete jednoduchý obrázek (pravé úhly a rovné čáry). * Na druhém listu nakreslete pokyny k znovuvytvoření tohoto obrazu pomocí řady šipek. * Vyměňte návody a pokuste se znovu vytvořit obrázek pomocí poskytnutých instrukcí. [/ dohromady] [standardy] ## Připojení a základní informace ### PARCC / chytřejší vyvážené zhodnocení schopností * Klepnout / poklepat * Přetažení * Vybrat objekt * Použít video přehrávač ### ISTE standardy (dříve NETS) * 1.a - uplatnit existující znalosti pro vytváření nových myšlenek, výrobků nebo procesů. * 1.c - Použití modelů a simulace ke zkoumání komplexních systémů a problémů. * 4.b - plánovat a spravovat aktivity k vývoji řešení nebo dokončení projektu. * 6.a - porozumět a používat technologické systémy. * 6.c - systémy pro odstraňování potíží a aplikace. * 6.d - převod současných znalostí k učení nových technologií. ### CSTA K-12 standardy informatiky * CT.L1:3-01. Používejte technologické prostředky (např, puzzly, programy na logické myšlení ) k řešení problémů odpovídající věku. * CL.L1:3-02. Kooperujte a spolupracujte s kolegy učiteli a dalšími používající technologie. * CPP.L1:6-05. Sestavte program jako soubor podrobných instrukcí, které musí být provedeny. * CPP.L1:6-06. Realizovat řešení problémů pomocí vizuálního programovacího jazyka blokově založeném. * CT.L2-01. Používejte základní kroky v algoritmické řešení problémů k návrhu řešení. * BTOL2-06 - popište a analyzujte posloupnost sledovaných instrukcí. * CT.L2-08. Používejte vizuální zobrazení problémových stavů, struktur a dat. * CT.L2-12. Používejte abstrakci k rozkladu problému na dílčí problémy. ### Next-Gen vědecké standardy * K-2-PS3-2. Používejte nástroje a materiály poskytnuté na návrh a vytváření zařízení, které řeší konkrétní problém nebo řeší specifický problém. ### Obecné základní matematické postupy * 1. Ujasnit problémy a vytrvat v jejich řešení. * 1. Zdůvodňovat abstraktně a kvantitativně. * 1. Modelovat s matematikou * 1. Používat strategicky vhodné nástroje. * 1. Dbát na přesnost. * 1. Vyhledávejte a využívejte struktury. * 1. Vyhledávejte a vyjádřete pravidelnost v opakujících úvahách. ### Obecné základní standardy matematiky * K.G.A.1 - popisují objekty v prostředí pomocí názvy obrazců a popisují vzájemné polohy těchto objektů pomocí termínů, jako nad, pod, vedle, před, za a vedle. * K.G.A.2 - správně název obrazce bez ohledu na jejich orientaci nebo celkovou velikost. * K.G.B.6 - tvoří jednoduché tvary k větší tvary. Například "můžete zapojit tyto dva trojúhelníky s plnou stran dotýkají aby obdélník?" * 1.G.A.1 - rozlišovat mezi vlastnostmi (např. trojúhelníky jsou uzavřené a trojstranné) proti definování vlastností (např. barvy, orientace, celkové rozměry); vytvořit a nakreslit tvary mající definované vlastnosti. * 1.G.A.2 - složit dvojrozměrné obrazce (obdélníky, čtverce, lichoběžníky, trojúhelníky, půlkruhy a čtvrtkruhy) nebo třírozměrné obrazce (krychle, hranoly, jehlany a válce). Chcete-li vytvořit složený tvar a vytvořit nové tvary ze složeného tvaru. * 2.G.A.1 - rozpoznat a nakreslit tvary s zadanými vlastnostmi, například zadaný počet úhlů nebo počet stejných stěn.1 identifikovat trojúhelníky, čtyřúhelníky, pětiúhelníky, šestiúhelníky a krychle. ### Obecné základní standardy umění jazyka * SL.K.1 - podílet se na společné rozhovory s rozmanitými partnery o tématech a texty o školce s vrstevníky a dospělými v malých a větších skupinách. * SL.K.3 - Doplnit kresby nebo jiné vizuální zobrazení požadovaných popisů pro zajištění dalších podrobností. * L.K.6 - používat slova a fráze, získané během konverzace, čtení a přečíst si je a reagovat na texty. * SL.K.1 - podílet se na společných rozhovorech s rozmanitými partnery o tématech a textech o školce s vrstevníky a dospělými, v malých a větších skupinách. * SL.1.5 - přidání kresby nebo jiné vizuální zobrazení popisu, když je vhodné vyjasnit nápady, myšlenky a pocity. * L.1.6 - používat slova a fráze, získaná prostřednictvím konverzace, čtení a přečtená, odpovídat na texty, včetně použití často se vyskytujících spojek signalizující jednoduché vztahy. * SL.K.1 - podílet se na společných rozhovorech s rozmanitými partnery o tématech a textech o školce s vrstevníky a dospělými, v malých a větších skupinách. * L.2.6 - používat slova a fráze získané prostřednictvím konverzace, čtení a přečíst si je a odpovídat na texty včetně použití k popisu přídavných jmen a příslovců. [/standardy] [/ obsah] <link rel="stylesheet" type="text/css" href="../docs/morestyle.css" />
{ "content_hash": "7ca7b9edbc76a1e7cb35c92197cd6e70", "timestamp": "", "source": "github", "line_count": 157, "max_line_length": 249, "avg_line_length": 40.80891719745223, "alnum_prop": 0.7530825659434993, "repo_name": "ty-po/code-dot-org", "id": "38cb49e980a7abbb5680ec701ca12fa95ac6a8e1", "size": "6983", "binary": false, "copies": "5", "ref": "refs/heads/staging", "path": "i18n/locales/cs-CZ/curriculum/course1/8/Teacher.md", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ApacheConf", "bytes": "93" }, { "name": "C++", "bytes": "4844" }, { "name": "CSS", "bytes": "2230244" }, { "name": "Cucumber", "bytes": "69858" }, { "name": "Emacs Lisp", "bytes": "2410" }, { "name": "HTML", "bytes": "9321123" }, { "name": "JavaScript", "bytes": "62536737" }, { "name": "PHP", "bytes": "2303483" }, { "name": "Perl", "bytes": "461" }, { "name": "Processing", "bytes": "11068" }, { "name": "Prolog", "bytes": "679" }, { "name": "Python", "bytes": "124866" }, { "name": "Racket", "bytes": "131852" }, { "name": "Ruby", "bytes": "1356290" }, { "name": "Shell", "bytes": "17795" }, { "name": "SourcePawn", "bytes": "74109" } ], "symlink_target": "" }
''' Test the upgrade master from 3.1.0.233 @author: YeTian 2018-11-25 ''' import os import tempfile import uuid import time import zstackwoodpecker.test_util as test_util import zstackwoodpecker.test_lib as test_lib import zstackwoodpecker.test_state as test_state import zstacklib.utils.ssh as ssh import zstackwoodpecker.operations.scenario_operations as scen_ops test_stub = test_lib.lib_get_test_stub() test_obj_dict = test_state.TestStateDict() tmp_file = '/tmp/%s' % uuid.uuid1().get_hex() vm_inv = None def test(): global vm_inv test_util.test_dsc('Create test vm to test zstack upgrade by -u.') image_name = os.environ.get('imageNameBase_310_mn_c74') c74_iso_path = os.environ.get('c74_iso_path') #iso_21_path = os.environ.get('iso_21_path') zstack_latest_version = os.environ.get('zstackLatestVersion') zstack_latest_path = os.environ.get('zstackLatestInstaller') vm_name = os.environ.get('vmName') + image_name upgrade_script_path = os.environ.get('upgradeScript') vm_inv = test_stub.create_vm_scenario(image_name, vm_name) vm_ip = vm_inv.vmNics[0].ip test_lib.lib_wait_target_up(vm_ip, 22) test_stub.make_ssh_no_password(vm_ip, tmp_file) test_util.test_logger('Update MN IP') test_stub.update_mn_hostname(vm_ip, tmp_file) test_stub.update_mn_ip(vm_ip, tmp_file) test_stub.stop_mn(vm_ip, tmp_file) test_stub.start_node(vm_ip, tmp_file) test_stub.start_mn(vm_ip, tmp_file) test_stub.check_installation(vm_ip, tmp_file) test_util.test_logger('Upgrade zstack to latest') test_stub.update_c74_iso(vm_ip, tmp_file, c74_iso_path, upgrade_script_path) #test_stub.updatei_21_iso(vm_ip, tmp_file, iso_21_path, upgrade_script_path) test_stub.upgrade_zstack(vm_ip, zstack_latest_path, tmp_file) test_stub.check_zstack_version(vm_ip, tmp_file, zstack_latest_version) test_stub.start_mn(vm_ip, tmp_file) test_stub.check_mn_running(vm_ip, tmp_file) test_stub.check_installation(vm_ip, tmp_file) os.system('rm -f %s' % tmp_file) test_stub.destroy_vm_scenario(vm_inv.uuid) test_util.test_pass('ZStack upgrade Test Success') #Will be called only if exception happens in test(). def error_cleanup(): global vm_inv os.system('rm -f %s' % tmp_file) if vm_inv: test_stub.destroy_vm_scenario(vm_inv.uuid) test_lib.lib_error_cleanup(test_obj_dict)
{ "content_hash": "750e074ce00408243804f33b546fdee5", "timestamp": "", "source": "github", "line_count": 67, "max_line_length": 80, "avg_line_length": 36.776119402985074, "alnum_prop": 0.6814123376623377, "repo_name": "zstackio/zstack-woodpecker", "id": "73e160f93b41142c6e49c0a71702bc88166cd438", "size": "2464", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "integrationtest/vm/installation/upgrade/test_zs_upgd_3.1.0_latest_on_cos74.py", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "Dockerfile", "bytes": "2356" }, { "name": "Go", "bytes": "49822" }, { "name": "Makefile", "bytes": "687" }, { "name": "Puppet", "bytes": "875" }, { "name": "Python", "bytes": "13070596" }, { "name": "Shell", "bytes": "177861" } ], "symlink_target": "" }
set(COMP_SRC_PROFILE "test") set(COMP_SRC_TEST_NAME "sublist") set(COMP_SRC_LIB_DEPS "binn") set(LOCAL_SRC_DIR_SUFFIX test) set(LOCAL_SRC_FILES test_sublist.c)
{ "content_hash": "4e06522085e61221c979ffe1c9d2c09a", "timestamp": "", "source": "github", "line_count": 6, "max_line_length": 35, "avg_line_length": 26.833333333333332, "alnum_prop": 0.7391304347826086, "repo_name": "debosvi/binn", "id": "e8b4e15ceed8f27bf3d065579d7bbaf0554972c8", "size": "162", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "comps/basic/targets/test_sublist.cmake", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "84329" }, { "name": "CMake", "bytes": "24539" } ], "symlink_target": "" }
package org.apache.maven.plugin.assembly.functions; import org.apache.maven.plugin.assembly.InvalidAssemblerConfigurationException; import org.apache.maven.plugin.assembly.archive.ArchiveCreationException; import org.apache.maven.plugin.assembly.artifact.DependencyResolutionException; import org.apache.maven.plugin.assembly.format.AssemblyFormattingException; import org.apache.maven.plugin.assembly.model.ModuleSet; /** * */ public interface ModuleSetConsumer { void accept( ModuleSet resolvedModule ) throws ArchiveCreationException, AssemblyFormattingException, InvalidAssemblerConfigurationException, DependencyResolutionException; }
{ "content_hash": "ac68b4fa9972f05ff1e5148bd3b6b213", "timestamp": "", "source": "github", "line_count": 19, "max_line_length": 109, "avg_line_length": 35.10526315789474, "alnum_prop": 0.8335832083958021, "repo_name": "ptahchiev/maven-plugins", "id": "f9141617d0aa9f24bb90617d9edbd0a3b60936e6", "size": "1474", "binary": false, "copies": "2", "ref": "refs/heads/trunk", "path": "maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/functions/ModuleSetConsumer.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ApacheConf", "bytes": "1043" }, { "name": "AspectJ", "bytes": "1978" }, { "name": "CSS", "bytes": "14984" }, { "name": "GAP", "bytes": "1429" }, { "name": "Groovy", "bytes": "184012" }, { "name": "HTML", "bytes": "81719" }, { "name": "Java", "bytes": "8166108" }, { "name": "JavaScript", "bytes": "1695" }, { "name": "Shell", "bytes": "49763" } ], "symlink_target": "" }
package com.google.api.services.samples.dailymotion.cmdline; import com.google.api.client.util.Key; import java.util.List; /** @author Yaniv Inbar */ public class VideoFeed { @Key public List<Video> list; @Key public int limit; @Key("has_more") public boolean hasMore; }
{ "content_hash": "772cbe2ef2b2647ea169e5cb9bc9f2b6", "timestamp": "", "source": "github", "line_count": 17, "max_line_length": 60, "avg_line_length": 16.823529411764707, "alnum_prop": 0.7202797202797203, "repo_name": "googleapis/google-oauth-java-client", "id": "91a4c606efbbb0f113217a14df606b04c1e4ae1a", "size": "874", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "samples/dailymotion-cmdline-sample/src/main/java/com/google/api/services/samples/dailymotion/cmdline/VideoFeed.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "801" }, { "name": "Java", "bytes": "444753" }, { "name": "Python", "bytes": "972" }, { "name": "Shell", "bytes": "26002" } ], "symlink_target": "" }
from PyQt5.QtWidgets import QComboBox from sdbcore.logger import Logger from sdbcore.stencildatalistener import StencilDataStencilListListener class StencilListWidget(QComboBox, StencilDataStencilListListener): def __init__(self, parent, stencil_data): super().__init__(parent) self.__stencil_data = stencil_data self.__stencil_data.register_as_stencil_list_listener(self) def remove_all_stencils(self): Logger.info( "Removing all stencils of StencilListWidget of '%s'" % self.__stencil_data.name) self.clear() def add_stencil(self, stencil): Logger.info( "Adding stencil '%s' to StencilFieldListWidget of '%s'" % ( stencil, self.__stencil_data.name)) self.addItem(stencil) def remove_stencil(self, stencil): Logger.info( "Removing stencil '%s' of StencilFieldListWidget of '%s'" % ( stencil, self.__stencil_data.name)) self.removeItem(self.findText(stencil)) @property def stencil(self): return self.itemText(self.currentIndex())
{ "content_hash": "0dd013e44482d450de33d89cd6ea26fc", "timestamp": "", "source": "github", "line_count": 32, "max_line_length": 92, "avg_line_length": 34.5625, "alnum_prop": 0.6537070524412296, "repo_name": "thfabian/serialbox2", "id": "3389c473e1e3221b2394245a54534b437dd22115", "size": "1513", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/serialbox-python/sdb/sdbgui/stencillistwidget.py", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "C++", "bytes": "935152" }, { "name": "CMake", "bytes": "100191" }, { "name": "Fortran", "bytes": "137809" }, { "name": "Python", "bytes": "389551" }, { "name": "Shell", "bytes": "5310" } ], "symlink_target": "" }
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <title>Global katals</title> <link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.76.1"> <link rel="home" href="../../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset"> <link rel="up" href="../../../boost_units/Reference.html#header.boost.units.systems.si.catalytic_activity_hpp" title="Header &lt;boost/units/systems/si/catalytic_activity.hpp&gt;"> <link rel="prev" href="katal.html" title="Global katal"> <link rel="next" href="constants/codata/BOOST_UNITS_P_idp364840640.html" title="Function BOOST_UNITS_PHYSICAL_CONSTANT"> </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="katal.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../../boost_units/Reference.html#header.boost.units.systems.si.catalytic_activity_hpp"><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="constants/codata/BOOST_UNITS_P_idp364840640.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a> </div> <div class="refentry"> <a name="boost.units.si.katals"></a><div class="titlepage"></div> <div class="refnamediv"> <h2><span class="refentrytitle">Global katals</span></h2> <p>boost::units::si::katals</p> </div> <h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2> <div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../../boost_units/Reference.html#header.boost.units.systems.si.catalytic_activity_hpp" title="Header &lt;boost/units/systems/si/catalytic_activity.hpp&gt;">boost/units/systems/si/catalytic_activity.hpp</a>&gt; </span><span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">catalytic_activity</span> katals<span class="special">;</span></pre></div> </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; 2003-2008 Matthias Christian Schabel<br>Copyright &#169; 2007-2010 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="katal.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../../boost_units/Reference.html#header.boost.units.systems.si.catalytic_activity_hpp"><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="constants/codata/BOOST_UNITS_P_idp364840640.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a> </div> </body> </html>
{ "content_hash": "e3a6071878390f3b79ef1ffc8120056b", "timestamp": "", "source": "github", "line_count": 51, "max_line_length": 521, "avg_line_length": 79.3921568627451, "alnum_prop": 0.6616448505803902, "repo_name": "yinchunlong/abelkhan-1", "id": "d19511069234658232b5438cff0c9f40bc38800b", "size": "4049", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "ext/c++/thirdpart/c++/boost/doc/html/boost/units/si/katals.html", "mode": "33188", "license": "mit", "language": [ { "name": "ASP", "bytes": "118649" }, { "name": "Assembly", "bytes": "223360" }, { "name": "Batchfile", "bytes": "32410" }, { "name": "C", "bytes": "2956993" }, { "name": "C#", "bytes": "219949" }, { "name": "C++", "bytes": "184617089" }, { "name": "CMake", "bytes": "125437" }, { "name": "CSS", "bytes": "427629" }, { "name": "Cuda", "bytes": "52444" }, { "name": "DIGITAL Command Language", "bytes": "6246" }, { "name": "FORTRAN", "bytes": "1856" }, { "name": "Groff", "bytes": "5189" }, { "name": "HTML", "bytes": "234939732" }, { "name": "IDL", "bytes": "14" }, { "name": "JavaScript", "bytes": "682223" }, { "name": "Lex", "bytes": "1231" }, { "name": "M4", "bytes": "29689" }, { "name": "Makefile", "bytes": "1083341" }, { "name": "Max", "bytes": "36857" }, { "name": "Objective-C", "bytes": "11406" }, { "name": "Objective-C++", "bytes": "630" }, { "name": "PHP", "bytes": "59030" }, { "name": "Perl", "bytes": "38649" }, { "name": "Perl6", "bytes": "2053" }, { "name": "Python", "bytes": "1780184" }, { "name": "QML", "bytes": "593" }, { "name": "QMake", "bytes": "16692" }, { "name": "Rebol", "bytes": "354" }, { "name": "Ruby", "bytes": "5532" }, { "name": "Shell", "bytes": "354720" }, { "name": "Tcl", "bytes": "1172" }, { "name": "TeX", "bytes": "32117" }, { "name": "XSLT", "bytes": "552736" }, { "name": "Yacc", "bytes": "19623" } ], "symlink_target": "" }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Decorator.Models.ManageViewModels { public class FactorViewModel { public string Purpose { get; set; } } }
{ "content_hash": "61fc096f33bbeec06fb977e0c1654a62", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 43, "avg_line_length": 20.583333333333332, "alnum_prop": 0.6923076923076923, "repo_name": "lmeijdam/asp-net-core-patterns", "id": "dbf7a3a24da2e8390438c8c6703d49e30156e51a", "size": "247", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "04_Decorator/Solution/Models/ManageViewModels/FactorViewModel.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "112077" }, { "name": "CSS", "bytes": "871" }, { "name": "JavaScript", "bytes": "210611" }, { "name": "PowerShell", "bytes": "468" } ], "symlink_target": "" }
#ifndef MICROPY_INCLUDED_LIB_TIMEUTILS_TIMEUTILS_H #define MICROPY_INCLUDED_LIB_TIMEUTILS_TIMEUTILS_H // The number of seconds between 1970/1/1 and 2000/1/1 is calculated using: // time.mktime((2000,1,1,0,0,0,0,0,0)) - time.mktime((1970,1,1,0,0,0,0,0,0)) #define TIMEUTILS_SECONDS_1970_TO_2000 (946684800ULL) typedef struct _timeutils_struct_time_t { uint16_t tm_year; // i.e. 2014 uint8_t tm_mon; // 1..12 uint8_t tm_mday; // 1..31 uint8_t tm_hour; // 0..23 uint8_t tm_min; // 0..59 uint8_t tm_sec; // 0..59 uint8_t tm_wday; // 0..6 0 = Monday uint16_t tm_yday; // 1..366 } timeutils_struct_time_t; bool timeutils_is_leap_year(mp_uint_t year); mp_uint_t timeutils_days_in_month(mp_uint_t year, mp_uint_t month); mp_uint_t timeutils_year_day(mp_uint_t year, mp_uint_t month, mp_uint_t date); void timeutils_seconds_since_2000_to_struct_time(mp_uint_t t, timeutils_struct_time_t *tm); mp_uint_t timeutils_seconds_since_2000(mp_uint_t year, mp_uint_t month, mp_uint_t date, mp_uint_t hour, mp_uint_t minute, mp_uint_t second); mp_uint_t timeutils_mktime_2000(mp_uint_t year, mp_int_t month, mp_int_t mday, mp_int_t hours, mp_int_t minutes, mp_int_t seconds); // Select the Epoch used by the port. #if MICROPY_EPOCH_IS_1970 static inline void timeutils_seconds_since_epoch_to_struct_time(uint64_t t, timeutils_struct_time_t *tm) { // TODO this will give incorrect results for dates before 2000/1/1 return timeutils_seconds_since_2000_to_struct_time(t - TIMEUTILS_SECONDS_1970_TO_2000, tm); } static inline uint64_t timeutils_mktime(mp_uint_t year, mp_int_t month, mp_int_t mday, mp_int_t hours, mp_int_t minutes, mp_int_t seconds) { return timeutils_mktime_2000(year, month, mday, hours, minutes, seconds) + TIMEUTILS_SECONDS_1970_TO_2000; } static inline uint64_t timeutils_seconds_since_epoch(mp_uint_t year, mp_uint_t month, mp_uint_t date, mp_uint_t hour, mp_uint_t minute, mp_uint_t second) { return timeutils_seconds_since_2000(year, month, date, hour, minute, second) + TIMEUTILS_SECONDS_1970_TO_2000; } static inline mp_uint_t timeutils_seconds_since_epoch_from_nanoseconds_since_1970(uint64_t ns) { return ns / 1000000000ULL; } static inline uint64_t timeutils_nanoseconds_since_epoch_to_nanoseconds_since_1970(uint64_t ns) { return ns; } #else // Epoch is 2000 #define timeutils_seconds_since_epoch_to_struct_time timeutils_seconds_since_2000_to_struct_time #define timeutils_seconds_since_epoch timeutils_seconds_since_2000 #define timeutils_mktime timeutils_mktime_2000 static inline uint64_t timeutils_seconds_since_epoch_to_nanoseconds_since_1970(mp_uint_t s) { return ((uint64_t)s + TIMEUTILS_SECONDS_1970_TO_2000) * 1000000000ULL; } static inline mp_uint_t timeutils_seconds_since_epoch_from_nanoseconds_since_1970(uint64_t ns) { return ns / 1000000000ULL - TIMEUTILS_SECONDS_1970_TO_2000; } static inline int64_t timeutils_nanoseconds_since_epoch_to_nanoseconds_since_1970(int64_t ns) { return ns + TIMEUTILS_SECONDS_1970_TO_2000 * 1000000000ULL; } #endif int timeutils_calc_weekday(int y, int m, int d); #endif // MICROPY_INCLUDED_LIB_TIMEUTILS_TIMEUTILS_H
{ "content_hash": "a98d05c926083fa17171122206b9368d", "timestamp": "", "source": "github", "line_count": 80, "max_line_length": 140, "avg_line_length": 40.4375, "alnum_prop": 0.7128284389489954, "repo_name": "bvernoux/micropython", "id": "66e2a77f139ed8cd1684f7ea41b6c8ffb7dc4733", "size": "4502", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "shared/timeutils/timeutils.h", "mode": "33188", "license": "mit", "language": [ { "name": "Assembly", "bytes": "50694" }, { "name": "C", "bytes": "19869126" }, { "name": "C++", "bytes": "2489380" }, { "name": "HTML", "bytes": "84456" }, { "name": "Makefile", "bytes": "49218" }, { "name": "Objective-C", "bytes": "8382" }, { "name": "Python", "bytes": "856777" }, { "name": "Shell", "bytes": "6229" } ], "symlink_target": "" }
namespace tera { namespace quota { struct Throttle { Throttle() : write_reqs(0), write_bytes(0), read_reqs(0), read_bytes(0), scan_reqs(0), scan_bytes(0) {} int64_t write_reqs; int64_t write_bytes; int64_t read_reqs; int64_t read_bytes; int64_t scan_reqs; int64_t scan_bytes; }; class QuotaLimiter { public: virtual void Reset(const TableQuota& table_quota) = 0; // if quota limited, return false // otherwise, consume the quota and return true virtual bool CheckAndConsume(const Throttle& throttle) = 0; }; } }
{ "content_hash": "dc89143de7023610c24f2fe2589e31c2", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 98, "avg_line_length": 22.666666666666668, "alnum_prop": 0.6838235294117647, "repo_name": "BaiduPS/tera", "id": "96dca9c589e15435ffd1cef39d63e1cf4d1a10b1", "size": "756", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/quota/limiter/quota_limiter.h", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "C", "bytes": "80545" }, { "name": "C++", "bytes": "3656768" }, { "name": "CMake", "bytes": "1005" }, { "name": "Java", "bytes": "29791" }, { "name": "Makefile", "bytes": "16373" }, { "name": "Protocol Buffer", "bytes": "28979" }, { "name": "Python", "bytes": "121068" }, { "name": "Shell", "bytes": "36158" } ], "symlink_target": "" }
ACCEPTED #### According to International Plant Names Index #### Published in null #### Original name null ### Remarks null
{ "content_hash": "2b3f98dc346c52670eb5a5a2dc2e1b93", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 31, "avg_line_length": 9.692307692307692, "alnum_prop": 0.7063492063492064, "repo_name": "mdoering/backbone", "id": "0b66a5cb3cd4e1789647c0973e226a982ba59a0c", "size": "174", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Dipsacales/Linnaeaceae/Linnaea/Linnaea albiloba/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
package org.elasticsearch.xpack.sql.jdbc; class JdbcException extends RuntimeException { JdbcException(String message) { super(message); } JdbcException(Throwable cause, String message) { super(message, cause); } }
{ "content_hash": "c8e2651d330314279e2a3ba16277fa8e", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 52, "avg_line_length": 19.615384615384617, "alnum_prop": 0.6705882352941176, "repo_name": "nknize/elasticsearch", "id": "378be3a30528bf07b67e79b59ed4079734fcbe7b", "size": "496", "binary": false, "copies": "24", "ref": "refs/heads/master", "path": "x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/JdbcException.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ANTLR", "bytes": "12298" }, { "name": "Batchfile", "bytes": "16353" }, { "name": "Emacs Lisp", "bytes": "3341" }, { "name": "FreeMarker", "bytes": "45" }, { "name": "Groovy", "bytes": "251795" }, { "name": "HTML", "bytes": "5348" }, { "name": "Java", "bytes": "36849935" }, { "name": "Perl", "bytes": "7116" }, { "name": "Python", "bytes": "76127" }, { "name": "Shell", "bytes": "102829" } ], "symlink_target": "" }
package org.apache.beam.sdk.io.aws2.dynamodb; import static org.apache.beam.sdk.io.aws2.dynamodb.DynamoDBIO.RetryConfiguration.DEFAULT_RETRY_PREDICATE; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; import java.io.Serializable; import java.util.List; import java.util.Map; import org.apache.beam.sdk.Pipeline; import org.apache.beam.sdk.testing.ExpectedLogs; import org.apache.beam.sdk.testing.PAssert; import org.apache.beam.sdk.testing.TestPipeline; import org.apache.beam.sdk.transforms.Count; import org.apache.beam.sdk.transforms.Create; import org.apache.beam.sdk.transforms.DoFn; import org.apache.beam.sdk.transforms.ParDo; import org.apache.beam.sdk.transforms.SerializableFunction; import org.apache.beam.sdk.values.KV; import org.apache.beam.sdk.values.PCollection; import org.apache.beam.sdk.values.PCollectionTuple; import org.apache.beam.sdk.values.TupleTag; import org.apache.beam.sdk.values.TupleTagList; import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.ImmutableList; import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.ImmutableMap; import org.joda.time.Duration; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.mockito.Mockito; import software.amazon.awssdk.services.dynamodb.DynamoDbClient; import software.amazon.awssdk.services.dynamodb.model.AttributeValue; import software.amazon.awssdk.services.dynamodb.model.BatchWriteItemRequest; import software.amazon.awssdk.services.dynamodb.model.DynamoDbException; import software.amazon.awssdk.services.dynamodb.model.PutRequest; import software.amazon.awssdk.services.dynamodb.model.ScanRequest; import software.amazon.awssdk.services.dynamodb.model.WriteRequest; /** Test Coverage for the IO. */ @Ignore("[BEAM-7794] DynamoDBIOTest is blocking forever") public class DynamoDBIOTest implements Serializable { @Rule public final transient TestPipeline pipeline = TestPipeline.create(); @Rule public final transient ExpectedLogs expectedLogs = ExpectedLogs.none(DynamoDBIO.class); private static final String tableName = "TaskA"; private static final int numOfItems = 10; @BeforeClass public static void setup() { DynamoDBIOTestHelper.startServerClient(); } @AfterClass public static void destroy() { DynamoDBIOTestHelper.stopServerClient(tableName); } @Before public void createTable() { DynamoDBIOTestHelper.createTestTable(tableName); } @After public void cleanTable() { DynamoDBIOTestHelper.deleteTestTable(tableName); } // Test cases for Reader. @Test public void testReaderOneSegment() { List<Map<String, AttributeValue>> expected = DynamoDBIOTestHelper.generateTestData(tableName, numOfItems); PCollection<List<Map<String, AttributeValue>>> actual = pipeline.apply( DynamoDBIO.<List<Map<String, AttributeValue>>>read() .withDynamoDbClientProvider( DynamoDbClientProviderMock.of(DynamoDBIOTestHelper.getDynamoDBClient())) .withScanRequestFn( (SerializableFunction<Void, ScanRequest>) input -> ScanRequest.builder().tableName(tableName).totalSegments(1).build()) .items()); PAssert.that(actual).containsInAnyOrder(expected); pipeline.run().waitUntilFinish(); } @Test public void testReaderThreeSegments() { TupleTag<List<Map<String, AttributeValue>>> outputTag = new TupleTag<>(); PCollectionTuple writeOutput = pipeline .apply( DynamoDBIO.<List<Map<String, AttributeValue>>>read() .withDynamoDbClientProvider( DynamoDbClientProviderMock.of(DynamoDBIOTestHelper.getDynamoDBClient())) .withScanRequestFn( (SerializableFunction<Void, ScanRequest>) input -> ScanRequest.builder().tableName(tableName).totalSegments(3).build()) .items()) .apply( ParDo.of( new DoFn< List<Map<String, AttributeValue>>, List<Map<String, AttributeValue>>>() { @ProcessElement public void processElement( @Element List<Map<String, AttributeValue>> input, OutputReceiver<List<Map<String, AttributeValue>>> out) { out.output(input); } }) .withOutputTags(outputTag, TupleTagList.empty())); final PCollection<Long> resultSetCount = writeOutput.get(outputTag).apply(Count.globally()); // Since we don't know what item will fall into what segment, so assert 3 result set returned PAssert.that(resultSetCount).containsInAnyOrder(ImmutableList.of(3L)); pipeline.run().waitUntilFinish(); } // Test cases for Reader's arguments. @Test public void testMissingScanRequestFn() { thrown.expectMessage("withScanRequestFn() is required"); pipeline.apply( DynamoDBIO.read() .withDynamoDbClientProvider( DynamoDbClientProviderMock.of(DynamoDBIOTestHelper.getDynamoDBClient()))); try { pipeline.run().waitUntilFinish(); fail("withScanRequestFn() is required"); } catch (IllegalArgumentException ex) { assertEquals("withScanRequestFn() is required", ex.getMessage()); } } @Test public void testMissingDynamoDbClientProvider() { thrown.expectMessage("withDynamoDbClientProvider() is required"); pipeline.apply( DynamoDBIO.read() .withScanRequestFn( (SerializableFunction<Void, ScanRequest>) input -> ScanRequest.builder().tableName(tableName).totalSegments(3).build())); try { pipeline.run().waitUntilFinish(); fail("withDynamoDbClientProvider() is required"); } catch (IllegalArgumentException ex) { assertEquals("withDynamoDbClientProvider() is required", ex.getMessage()); } } @Test public void testMissingTotalSegments() { thrown.expectMessage("TotalSegments is required with withScanRequestFn()"); pipeline.apply( DynamoDBIO.read() .withScanRequestFn( (SerializableFunction<Void, ScanRequest>) input -> ScanRequest.builder().tableName(tableName).build()) .withDynamoDbClientProvider( DynamoDbClientProviderMock.of(DynamoDBIOTestHelper.getDynamoDBClient()))); try { pipeline.run().waitUntilFinish(); fail("TotalSegments is required with withScanRequestFn()"); } catch (IllegalArgumentException ex) { assertEquals("TotalSegments is required with withScanRequestFn()", ex.getMessage()); } } @Test public void testNegativeTotalSegments() { thrown.expectMessage("TotalSegments is required with withScanRequestFn() and greater zero"); pipeline.apply( DynamoDBIO.read() .withScanRequestFn( (SerializableFunction<Void, ScanRequest>) input -> ScanRequest.builder().tableName(tableName).totalSegments(-1).build()) .withDynamoDbClientProvider( DynamoDbClientProviderMock.of(DynamoDBIOTestHelper.getDynamoDBClient()))); try { pipeline.run().waitUntilFinish(); fail("withTotalSegments() is expected and greater than zero"); } catch (IllegalArgumentException ex) { assertEquals( "TotalSegments is required with withScanRequestFn() and greater zero", ex.getMessage()); } } @Test public void testWriteDataToDynamo() { List<KV<String, Integer>> items = ImmutableList.of(KV.of("test1", 111), KV.of("test2", 222), KV.of("test3", 333)); final PCollection<Void> output = pipeline .apply(Create.of(items)) .apply( DynamoDBIO.<KV<String, Integer>>write() .withWriteRequestMapperFn( (SerializableFunction<KV<String, Integer>, KV<String, WriteRequest>>) entry -> { Map<String, AttributeValue> putRequest = ImmutableMap.of( "hashKey1", AttributeValue.builder().s(entry.getKey()).build(), "rangeKey2", AttributeValue.builder() .n(entry.getValue().toString()) .build()); WriteRequest writeRequest = WriteRequest.builder() .putRequest(PutRequest.builder().item(putRequest).build()) .build(); return KV.of(tableName, writeRequest); }) .withRetryConfiguration( DynamoDBIO.RetryConfiguration.builder() .setMaxAttempts(5) .setMaxDuration(Duration.standardMinutes(1)) .setRetryPredicate(DEFAULT_RETRY_PREDICATE) .build()) .withDynamoDbClientProvider( DynamoDbClientProviderMock.of(DynamoDBIOTestHelper.getDynamoDBClient()))); final PCollection<Long> publishedResultsSize = output.apply(Count.globally()); PAssert.that(publishedResultsSize).containsInAnyOrder(0L); pipeline.run().waitUntilFinish(); // Make sure data written to the table are in the table. int actualItemCount = DynamoDBIOTestHelper.readDataFromTable(tableName).size(); assertEquals(3, actualItemCount); } @Rule public transient ExpectedException thrown = ExpectedException.none(); @Test public void testRetries() throws Throwable { thrown.expectMessage("Error writing to DynamoDB"); List<KV<String, Integer>> items = ImmutableList.of(KV.of("test1", 111), KV.of("test2", 222), KV.of("test3", 333)); DynamoDbClient amazonDynamoDBMock = Mockito.mock(DynamoDbClient.class); Mockito.when(amazonDynamoDBMock.batchWriteItem(Mockito.any(BatchWriteItemRequest.class))) .thenThrow(DynamoDbException.builder().message("Service unavailable").build()); pipeline .apply(Create.of(items)) .apply( DynamoDBIO.<KV<String, Integer>>write() .withWriteRequestMapperFn( (SerializableFunction<KV<String, Integer>, KV<String, WriteRequest>>) entry -> { Map<String, AttributeValue> putRequest = ImmutableMap.of( "hashKey1", AttributeValue.builder().s(entry.getKey()).build(), "rangeKey2", AttributeValue.builder() .n(entry.getValue().toString()) .build()); WriteRequest writeRequest = WriteRequest.builder() .putRequest(PutRequest.builder().item(putRequest).build()) .build(); return KV.of(tableName, writeRequest); }) .withRetryConfiguration( DynamoDBIO.RetryConfiguration.builder() .setMaxAttempts(4) .setMaxDuration(Duration.standardSeconds(10)) .setRetryPredicate(DEFAULT_RETRY_PREDICATE) .build()) .withDynamoDbClientProvider(DynamoDbClientProviderMock.of(amazonDynamoDBMock))); try { pipeline.run().waitUntilFinish(); } catch (final Pipeline.PipelineExecutionException e) { // check 3 retries were initiated by inspecting the log before passing on the exception expectedLogs.verifyWarn(String.format(DynamoDBIO.Write.WriteFn.RETRY_ATTEMPT_LOG, 1)); expectedLogs.verifyWarn(String.format(DynamoDBIO.Write.WriteFn.RETRY_ATTEMPT_LOG, 2)); expectedLogs.verifyWarn(String.format(DynamoDBIO.Write.WriteFn.RETRY_ATTEMPT_LOG, 3)); throw e.getCause(); } fail("Pipeline is expected to fail because we were unable to write to DynamoDb."); } }
{ "content_hash": "fd5a1dd89d74088ce904f34a4066fb03", "timestamp": "", "source": "github", "line_count": 297, "max_line_length": 105, "avg_line_length": 43.23232323232323, "alnum_prop": 0.620404984423676, "repo_name": "markflyhigh/incubator-beam", "id": "a1be352f0d0afa4a13c49e84635199a2075200b0", "size": "13645", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "sdks/java/io/amazon-web-services2/src/test/java/org/apache/beam/sdk/io/aws2/dynamodb/DynamoDBIOTest.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ANTLR", "bytes": "1596" }, { "name": "CSS", "bytes": "40964" }, { "name": "Dockerfile", "bytes": "22983" }, { "name": "FreeMarker", "bytes": "7428" }, { "name": "Go", "bytes": "2508482" }, { "name": "Groovy", "bytes": "300669" }, { "name": "HTML", "bytes": "54277" }, { "name": "Java", "bytes": "24796055" }, { "name": "JavaScript", "bytes": "16472" }, { "name": "Jupyter Notebook", "bytes": "54182" }, { "name": "Python", "bytes": "4544133" }, { "name": "Ruby", "bytes": "4099" }, { "name": "Shell", "bytes": "180209" } ], "symlink_target": "" }
package com.github.robozonky.internal; import static org.assertj.core.api.SoftAssertions.assertSoftly; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.time.temporal.ChronoUnit; import java.time.temporal.TemporalAmount; import java.util.Properties; import java.util.UUID; import java.util.function.Predicate; import java.util.stream.Stream; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; class SettingsTest { @AfterEach void reinit() { Settings.INSTANCE.reinit(); System.clearProperty(Settings.FILE_LOCATION_PROPERTY); } @Test void defaultProperties() { assertSoftly(softly -> { softly.assertThat(Settings.INSTANCE.get("user.dir", "")) .isNotEqualTo(""); softly.assertThat(Settings.INSTANCE.get(UUID.randomUUID() .toString(), "")) .isEqualTo(""); softly.assertThat(Settings.INSTANCE.getRemoteResourceRefreshInterval()) .matches(new SettingsTest.TemporalPredicate(5 * 60)); softly.assertThat(Settings.INSTANCE.getDryRunBalanceMinimum()) .isEqualTo(-1); softly.assertThat(Settings.INSTANCE.getMaxItemsReadFromPrimaryMarketplace()) .isEqualTo(-1); softly.assertThat(Settings.INSTANCE.getMaxItemsReadFromSecondaryMarketplace()) .isEqualTo(500); softly.assertThat(Settings.INSTANCE.getSocketTimeout()) .matches(new SettingsTest.TemporalPredicate(10)); softly.assertThat(Settings.INSTANCE.getConnectionTimeout()) .matches(new SettingsTest.TemporalPredicate(10)); softly.assertThat(Settings.INSTANCE.getDefaultApiPageSize()) .isEqualTo(100); softly.assertThat(Settings.INSTANCE.getHttpsProxyPort()) .isEqualTo(443); softly.assertThat(Settings.INSTANCE.getHttpsProxyHostname()) .isEmpty(); softly.assertThat(Settings.INSTANCE.isDebugHttpResponseLoggingEnabled()) .isFalse(); }); } @Test void setProperties() throws IOException { final Properties p = new Properties(); Stream.of(Settings.Key.values()) .forEach(v -> p.setProperty(v.getName(), "2000")); p.setProperty(Settings.Key.DEBUG_ENABLE_HTTP_RESPONSE_LOGGING.getName(), "true"); final File f = File.createTempFile("robozonky-", ".properties"); p.store(new FileWriter(f), "Testing properties"); System.setProperty(Settings.FILE_LOCATION_PROPERTY, f.getAbsolutePath()); assertSoftly(softly -> { softly.assertThat(Settings.INSTANCE.get("user.dir", "")) .isNotEqualTo(""); softly.assertThat(Settings.INSTANCE.get(UUID.randomUUID() .toString(), "")) .isEqualTo(""); softly.assertThat(Settings.INSTANCE.isDebugHttpResponseLoggingEnabled()) .isTrue(); softly.assertThat(Settings.INSTANCE.getRemoteResourceRefreshInterval()) .matches(new SettingsTest.TemporalPredicate(2000 * 60)); softly.assertThat(Settings.INSTANCE.getDryRunBalanceMinimum()) .isEqualTo(2000); softly.assertThat(Settings.INSTANCE.getMaxItemsReadFromPrimaryMarketplace()) .isEqualTo(2000); softly.assertThat(Settings.INSTANCE.getMaxItemsReadFromSecondaryMarketplace()) .isEqualTo(2000); softly.assertThat(Settings.INSTANCE.getSocketTimeout()) .matches(new SettingsTest.TemporalPredicate(2000)); softly.assertThat(Settings.INSTANCE.getConnectionTimeout()) .matches(new SettingsTest.TemporalPredicate(2000)); softly.assertThat(Settings.INSTANCE.getDefaultApiPageSize()) .isEqualTo(2000); softly.assertThat(Settings.INSTANCE.getHttpsProxyPort()) .isEqualTo(2000); softly.assertThat(Settings.INSTANCE.getHttpsProxyHostname()) .contains("2000"); }); } private static final class TemporalPredicate implements Predicate<TemporalAmount> { private final long seconds; TemporalPredicate(final long seconds) { this.seconds = seconds; } @Override public boolean test(final TemporalAmount o) { return o.get(ChronoUnit.SECONDS) == seconds; } @Override public String toString() { return "seconds = " + seconds; } } }
{ "content_hash": "48df3ce78b2f6fe7361e93b4917ad0be", "timestamp": "", "source": "github", "line_count": 115, "max_line_length": 90, "avg_line_length": 40.469565217391306, "alnum_prop": 0.6351525569402664, "repo_name": "RoboZonky/robozonky", "id": "5780c84bc8b72c9e066e80e074c982fda5694d44", "size": "5258", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "robozonky-api/src/test/java/com/github/robozonky/internal/SettingsTest.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ANTLR", "bytes": "38464" }, { "name": "Batchfile", "bytes": "1050" }, { "name": "Dockerfile", "bytes": "4662" }, { "name": "FreeMarker", "bytes": "27977" }, { "name": "Java", "bytes": "2044064" }, { "name": "Shell", "bytes": "2423" } ], "symlink_target": "" }
<component name="libraryTable"> <library name="kotlin-test" type="repository"> <properties maven-id="org.jetbrains.kotlin:kotlin-test:1.4.32"> <exclude> <dependency maven-id="org.jetbrains.kotlin:kotlin-stdlib-common" /> <dependency maven-id="org.jetbrains.kotlin:kotlin-stdlib" /> </exclude> </properties> <CLASSES> <root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-test/1.4.32/kotlin-test-1.4.32.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-test-common/1.4.32/kotlin-test-common-1.4.32.jar!/" /> </CLASSES> <JAVADOC /> <SOURCES> <root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-test/1.4.32/kotlin-test-1.4.32-sources.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-test-common/1.4.32/kotlin-test-common-1.4.32-sources.jar!/" /> </SOURCES> </library> </component>
{ "content_hash": "930f1c2e4395e3f8de2c9649e634901d", "timestamp": "", "source": "github", "line_count": 19, "max_line_length": 132, "avg_line_length": 49.05263157894737, "alnum_prop": 0.6630901287553648, "repo_name": "zdary/intellij-community", "id": "48bd67ab9d776fb5b9a2ac9bacde4043cc7251aa", "size": "932", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": ".idea/libraries/kotlin_test.xml", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
/** * Animation Component * @author ryan.bian */ import Transition from 'react-transition-group/Transition'; import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; import classnames from 'classnames'; import styles from './Animation.css'; import MOTIONS, { TIMING_FUNCTION } from './motions'; class Animation extends PureComponent { static displayName = 'Animation' static defaultProps = { duration: 500, motion: 'fade', timingFunction: 'linear', style: undefined, in: PropTypes.bool, mountOnEnter: false, unmountOnExit: false, enter: true, exit: true, onEnter() {}, onEntering() {}, onEntered() {}, onExit() {}, onExiting() {}, onExited() {}, } // https://facebook.github.io/react/docs/typechecking-with-proptypes.html static propTypes = { duration: PropTypes.number, motion: PropTypes.oneOf(MOTIONS), timingFunction: PropTypes.oneOf(Object.keys(TIMING_FUNCTION)), style: PropTypes.object, in: PropTypes.bool, mountOnEnter: PropTypes.bool, unmountOnExit: PropTypes.bool, enter: PropTypes.bool, exit: PropTypes.bool, onEnter: PropTypes.func, onEntering: PropTypes.func, onEntered: PropTypes.func, onExit: PropTypes.func, onExiting: PropTypes.func, onExited: PropTypes.func, } render() { const { duration, motion, timingFunction, style, children, ...otherProps } = this.props; const transitionProps = { in: this.props.in, timeout: duration, ...otherProps, }; const defaultStyle = { ...style, animationDuration: `${duration}ms`, animationTimingFunction: TIMING_FUNCTION[timingFunction], }; return ( <Transition {...transitionProps}> {status => ( <div style={defaultStyle} className={classnames(styles[motion], styles[`${motion}--${status}`])} >{children}</div> )} </Transition> ); } } export default Animation;
{ "content_hash": "44d4870d003788bc703aa81728889077", "timestamp": "", "source": "github", "line_count": 79, "max_line_length": 92, "avg_line_length": 25.544303797468356, "alnum_prop": 0.6392467789890981, "repo_name": "quark-ui/quark-ui", "id": "c45d3183fa98b63af5277d296ebed5ba250a3cf8", "size": "2018", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "src/components/animation/Animation.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "3407331" }, { "name": "HTML", "bytes": "1276" }, { "name": "JavaScript", "bytes": "1403438" } ], "symlink_target": "" }
.class Lcom/android/internal/widget/ToolbarWidgetWrapper$2; .super Landroid/animation/AnimatorListenerAdapter; .source "ToolbarWidgetWrapper.java" # annotations .annotation system Ldalvik/annotation/EnclosingMethod; value = Lcom/android/internal/widget/ToolbarWidgetWrapper;->animateToVisibility(I)V .end annotation .annotation system Ldalvik/annotation/InnerClass; accessFlags = 0x0 name = null .end annotation # instance fields .field private mCanceled:Z .field final synthetic this$0:Lcom/android/internal/widget/ToolbarWidgetWrapper; # direct methods .method constructor <init>(Lcom/android/internal/widget/ToolbarWidgetWrapper;)V .locals 1 .prologue .line 578 iput-object p1, p0, Lcom/android/internal/widget/ToolbarWidgetWrapper$2;->this$0:Lcom/android/internal/widget/ToolbarWidgetWrapper; invoke-direct {p0}, Landroid/animation/AnimatorListenerAdapter;-><init>()V .line 579 const/4 v0, 0x0 iput-boolean v0, p0, Lcom/android/internal/widget/ToolbarWidgetWrapper$2;->mCanceled:Z return-void .end method # virtual methods .method public onAnimationCancel(Landroid/animation/Animator;)V .locals 1 .param p1, "animation" # Landroid/animation/Animator; .prologue .line 589 const/4 v0, 0x1 iput-boolean v0, p0, Lcom/android/internal/widget/ToolbarWidgetWrapper$2;->mCanceled:Z .line 590 return-void .end method .method public onAnimationEnd(Landroid/animation/Animator;)V .locals 2 .param p1, "animation" # Landroid/animation/Animator; .prologue .line 582 iget-boolean v0, p0, Lcom/android/internal/widget/ToolbarWidgetWrapper$2;->mCanceled:Z if-nez v0, :cond_0 .line 583 iget-object v0, p0, Lcom/android/internal/widget/ToolbarWidgetWrapper$2;->this$0:Lcom/android/internal/widget/ToolbarWidgetWrapper; # getter for: Lcom/android/internal/widget/ToolbarWidgetWrapper;->mToolbar:Landroid/widget/Toolbar; invoke-static {v0}, Lcom/android/internal/widget/ToolbarWidgetWrapper;->access$000(Lcom/android/internal/widget/ToolbarWidgetWrapper;)Landroid/widget/Toolbar; move-result-object v0 const/16 v1, 0x8 invoke-virtual {v0, v1}, Landroid/widget/Toolbar;->setVisibility(I)V .line 585 :cond_0 return-void .end method
{ "content_hash": "f3601bf9d1903508e63cbc265f5b7055", "timestamp": "", "source": "github", "line_count": 82, "max_line_length": 162, "avg_line_length": 27.9390243902439, "alnum_prop": 0.7494543867306853, "repo_name": "Liberations/Flyme5_devices_base_cm", "id": "a04b182c5e4951a79c358685038ad4d4dabbf241", "size": "2291", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "framework.jar.out/smali_classes2/com/android/internal/widget/ToolbarWidgetWrapper$2.smali", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "GLSL", "bytes": "1500" }, { "name": "HTML", "bytes": "96769" }, { "name": "Makefile", "bytes": "11209" }, { "name": "Python", "bytes": "1195" }, { "name": "Shell", "bytes": "55270" }, { "name": "Smali", "bytes": "160321888" } ], "symlink_target": "" }
<div id="drive-folder-context" ng-controller="DriveFolderContextController"> <ul> <li ng-click="open()">Open</li> <li ng-click="rename()">Rename...</li> <li ng-click="addChildFolder()">New Folder</li> <li ng-click="upload()">Upload</li> <li ng-click="download()">Download</li> <li ng-click="delete()">Delete</li> </ul> </div>
{ "content_hash": "e103b4795203247eca4c8e6cb9f4fa1b", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 76, "avg_line_length": 32, "alnum_prop": 0.5703125, "repo_name": "andrejbranch/techversed", "id": "6de5ffdd629c427031bb466cebe84bb11efd342a", "size": "384", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "web/app/partials/drive/folderContext.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "11423" }, { "name": "JavaScript", "bytes": "1081201" }, { "name": "PHP", "bytes": "56292" } ], "symlink_target": "" }
using UnityEngine; using System.Collections; using System.Collections.Generic; using Pathfinding; /** Demos different path types. * This script is an example script demoing a number of different path types included in the project. * Since only the Pro version has access to many path types, it is only included in the pro version * \astarpro * * \see Pathfinding.ABPath * \see Pathfinding.MultiTargetPath * \see Pathfinding.ConstantPath * \see Pathfinding.FleePath * \see Pathfinding.RandomPath * \see Pathfinding.FloodPath * \see Pathfinding.FloodPathTracer */ [HelpURL("http://arongranberg.com/astar/docs/class_path_types_demo.php")] public class PathTypesDemo : MonoBehaviour { public DemoMode activeDemo = DemoMode.ABPath; public enum DemoMode { ABPath, MultiTargetPath, RandomPath, FleePath, ConstantPath, FloodPath, FloodPathTracer } /** Start of paths */ public Transform start; /** Target point of paths */ public Transform end; /** Offset from the real path to where it is rendered. * Used to avoid z-fighting */ public Vector3 pathOffset; /** Material used for rendering paths */ public Material lineMat; /** Material used for rendering result of the ConstantPath */ public Material squareMat; public float lineWidth; public RichAI[] agents; public int searchLength = 1000; public int spread = 100; public float aimStrength = 0; Path lastPath = null; List<GameObject> lastRender = new List<GameObject>(); List<Vector3> multipoints = new List<Vector3>(); Vector2 mouseDragStart; float mouseDragStartTime; // Update is called once per frame void Update () { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); Vector3 zeroIntersect = ray.origin + ray.direction * (ray.origin.y / -ray.direction.y); end.position = zeroIntersect; if (Input.GetMouseButtonDown(0)) { mouseDragStart = Input.mousePosition; mouseDragStartTime = Time.realtimeSinceStartup; } if (Input.GetMouseButtonUp(0)) { Vector2 mouseDragEnd = Input.mousePosition; if ((mouseDragEnd - mouseDragStart).sqrMagnitude > 5*5 && (Time.realtimeSinceStartup - mouseDragStartTime) > 0.3f) { //Select Rect r = Rect.MinMaxRect( Mathf.Min(mouseDragStart.x, mouseDragEnd.x), Mathf.Min(mouseDragStart.y, mouseDragEnd.y), Mathf.Max(mouseDragStart.x, mouseDragEnd.x), Mathf.Max(mouseDragStart.y, mouseDragEnd.y) ); RichAI[] ais = GameObject.FindObjectsOfType(typeof(RichAI)) as RichAI[]; List<RichAI> ls = new List<RichAI>(); for (int i = 0; i < ais.Length; i++) { Vector2 p = Camera.main.WorldToScreenPoint(ais[i].transform.position); //p.y = Screen.height - p.y; if (r.Contains(p)) { ls.Add(ais[i]); } } agents = ls.ToArray(); } else { if (Input.GetKey(KeyCode.LeftShift)) { multipoints.Add(zeroIntersect); } if (Input.GetKey(KeyCode.LeftControl)) { multipoints.Clear(); } if (Input.mousePosition.x > 225) { DemoPath(); } } } if (Input.GetMouseButton(0) && Input.GetKey(KeyCode.LeftAlt) && (lastPath == null || lastPath.IsDone())) { DemoPath(); } } /** Draw some helpful gui */ public void OnGUI () { GUILayout.BeginArea(new Rect(5, 5, 220, Screen.height-10), "", "Box"); switch (activeDemo) { case DemoMode.ABPath: GUILayout.Label("Basic path. Finds a path from point A to point B."); break; case DemoMode.MultiTargetPath: GUILayout.Label("Multi Target Path. Finds a path quickly from one point to many others in a single search."); break; case DemoMode.RandomPath: GUILayout.Label("Randomized Path. Finds a path with a specified length in a random direction or biased towards some point when using a larger aim strenggth."); break; case DemoMode.FleePath: GUILayout.Label("Flee Path. Tries to flee from a specified point. Remember to set Flee Strength!"); break; case DemoMode.ConstantPath: GUILayout.Label("Finds all nodes which it costs less than some value to reach."); break; case DemoMode.FloodPath: GUILayout.Label("Searches the whole graph from a specific point. FloodPathTracer can then be used to quickly find a path to that point"); break; case DemoMode.FloodPathTracer: GUILayout.Label("Traces a path to where the FloodPath started. Compare the claculation times for this path with ABPath!\nGreat for TD games"); break; } GUILayout.Space(5); GUILayout.Label("Note that the paths are rendered without ANY post-processing applied, so they might look a bit edgy"); GUILayout.Space(5); GUILayout.Label("Click anywhere to recalculate the path. Hold Alt to continuously recalculate the path while the mouse is pressed."); if (activeDemo == DemoMode.ConstantPath || activeDemo == DemoMode.RandomPath || activeDemo == DemoMode.FleePath) { GUILayout.Label("Search Distance ("+searchLength+")"); searchLength = Mathf.RoundToInt(GUILayout.HorizontalSlider(searchLength, 0, 100000)); } if (activeDemo == DemoMode.RandomPath || activeDemo == DemoMode.FleePath) { GUILayout.Label("Spread ("+spread+")"); spread = Mathf.RoundToInt(GUILayout.HorizontalSlider(spread, 0, 40000)); GUILayout.Label((activeDemo == DemoMode.RandomPath ? "Aim strength" : "Flee strength") + " ("+aimStrength+")"); aimStrength = GUILayout.HorizontalSlider(aimStrength, 0, 1); } if (activeDemo == DemoMode.MultiTargetPath) { GUILayout.Label("Hold shift and click to add new target points. Hold ctr and click to remove all target points"); } if (GUILayout.Button("A to B path")) activeDemo = DemoMode.ABPath; if (GUILayout.Button("Multi Target Path")) activeDemo = DemoMode.MultiTargetPath; if (GUILayout.Button("Random Path")) activeDemo = DemoMode.RandomPath; if (GUILayout.Button("Flee path")) activeDemo = DemoMode.FleePath; if (GUILayout.Button("Constant Path")) activeDemo = DemoMode.ConstantPath; if (GUILayout.Button("Flood Path")) activeDemo = DemoMode.FloodPath; if (GUILayout.Button("Flood Path Tracer")) activeDemo = DemoMode.FloodPathTracer; GUILayout.EndArea(); } /** Get the path back */ public void OnPathComplete (Path p) { //To prevent it from creating new GameObjects when the application is quitting when using multithreading. if (lastRender == null) return; if (p.error) { ClearPrevious(); return; } if (p.GetType() == typeof(MultiTargetPath)) { List<GameObject> unused = new List<GameObject>(lastRender); lastRender.Clear(); MultiTargetPath mp = p as MultiTargetPath; for (int i = 0; i < mp.vectorPaths.Length; i++) { if (mp.vectorPaths[i] == null) continue; List<Vector3> vpath = mp.vectorPaths[i]; GameObject ob = null; if (unused.Count > i && unused[i].GetComponent<LineRenderer>() != null) { ob = unused[i]; unused.RemoveAt(i); } else { ob = new GameObject("LineRenderer_"+i, typeof(LineRenderer)); } LineRenderer lr = ob.GetComponent<LineRenderer>(); lr.sharedMaterial = lineMat; lr.SetWidth(lineWidth, lineWidth); lr.SetVertexCount(vpath.Count); for (int j = 0; j < vpath.Count; j++) { lr.SetPosition(j, vpath[j] + pathOffset); } lastRender.Add(ob); } for (int i = 0; i < unused.Count; i++) { Destroy(unused[i]); } } else if (p.GetType() == typeof(ConstantPath)) { ClearPrevious(); //The following code will build a mesh with a square for each node visited ConstantPath constPath = p as ConstantPath; List<GraphNode> nodes = constPath.allNodes; Mesh mesh = new Mesh(); List<Vector3> verts = new List<Vector3>(); bool drawRaysInstead = false; // Just some debugging code which selects random points on the nodes /*List<Vector3> pts = Pathfinding.PathUtilities.GetPointsOnNodes (nodes, 20, 0); * Vector3 avg = Vector3.zero; * for (int i=0;i<pts.Count;i++) { * Debug.DrawRay (pts[i], Vector3.up*5, Color.red, 3); * avg += pts[i]; * } * * if (pts.Count > 0) avg /= pts.Count; * * for (int i=0;i<pts.Count;i++) { * pts[i] -= avg; * } * * Pathfinding.PathUtilities.GetPointsAroundPoint (start.position, AstarPath.active.astarData.graphs[0] as IRaycastableGraph, pts, 0, 1); * * for (int i=0;i<pts.Count;i++) { * Debug.DrawRay (pts[i], Vector3.up*5, Color.blue, 3); * }*/ //This will loop through the nodes from furthest away to nearest, not really necessary... but why not :D //Note that the reverse does not, as common sense would suggest, loop through from the closest to the furthest away //since is might contain duplicates and only the node duplicate placed at the highest index is guarenteed to be ordered correctly. for (int i = nodes.Count-1; i >= 0; i--) { Vector3 pos = (Vector3)nodes[i].position+pathOffset; if (verts.Count == 65000 && !drawRaysInstead) { Debug.LogError("Too many nodes, rendering a mesh would throw 65K vertex error. Using Debug.DrawRay instead for the rest of the nodes"); drawRaysInstead = true; } if (drawRaysInstead) { Debug.DrawRay(pos, Vector3.up, Color.blue); continue; } //Add vertices in a square GridGraph gg = AstarData.GetGraph(nodes[i]) as GridGraph; float scale = 1F; if (gg != null) scale = gg.nodeSize; verts.Add(pos+new Vector3(-0.5F, 0, -0.5F)*scale); verts.Add(pos+new Vector3(0.5F, 0, -0.5F)*scale); verts.Add(pos+new Vector3(-0.5F, 0, 0.5F)*scale); verts.Add(pos+new Vector3(0.5F, 0, 0.5F)*scale); } //Build triangles for the squares Vector3[] vs = verts.ToArray(); int[] tris = new int[(3*vs.Length)/2]; for (int i = 0, j = 0; i < vs.Length; j += 6, i += 4) { tris[j+0] = i; tris[j+1] = i+1; tris[j+2] = i+2; tris[j+3] = i+1; tris[j+4] = i+3; tris[j+5] = i+2; } Vector2[] uv = new Vector2[vs.Length]; //Set up some basic UV for (int i = 0; i < uv.Length; i += 4) { uv[i] = new Vector2(0, 0); uv[i+1] = new Vector2(1, 0); uv[i+2] = new Vector2(0, 1); uv[i+3] = new Vector2(1, 1); } mesh.vertices = vs; mesh.triangles = tris; mesh.uv = uv; mesh.RecalculateNormals(); GameObject go = new GameObject("Mesh", typeof(MeshRenderer), typeof(MeshFilter)); MeshFilter fi = go.GetComponent<MeshFilter>(); fi.mesh = mesh; MeshRenderer re = go.GetComponent<MeshRenderer>(); re.material = squareMat; lastRender.Add(go); } else { ClearPrevious(); GameObject ob = new GameObject("LineRenderer", typeof(LineRenderer)); LineRenderer lr = ob.GetComponent<LineRenderer>(); lr.sharedMaterial = lineMat; lr.SetWidth(lineWidth, lineWidth); lr.SetVertexCount(p.vectorPath.Count); for (int i = 0; i < p.vectorPath.Count; i++) { lr.SetPosition(i, p.vectorPath[i] + pathOffset); } lastRender.Add(ob); } } /** Destroys all previous render objects */ void ClearPrevious () { for (int i = 0; i < lastRender.Count; i++) { Destroy(lastRender[i]); } lastRender.Clear(); } /** Clears renders on application quit */ void OnApplicationQuit () { ClearPrevious(); lastRender = null; } private FloodPath lastFlood = null; /** Starts a path specified by PathTypesDemo.activeDemo */ void DemoPath () { Path p = null; if (activeDemo == DemoMode.ABPath) { p = ABPath.Construct(start.position, end.position, OnPathComplete); if (agents != null && agents.Length > 0) { List<Vector3> pts = Pathfinding.Util.ListPool<Vector3>.Claim(agents.Length); Vector3 avg = Vector3.zero; for (int i = 0; i < agents.Length; i++) { pts.Add(agents[i].transform.position); avg += pts[i]; } avg /= pts.Count; for (int i = 0; i < agents.Length; i++) pts[i] -= avg; Pathfinding.PathUtilities.GetPointsAroundPoint(end.position, AstarPath.active.graphs[0] as IRaycastableGraph, pts, 0, 0.2f); for (int i = 0; i < agents.Length; i++) { if (agents[i] == null) continue; agents[i].target = pts[i]; agents[i].UpdatePath(); } } } else if (activeDemo == DemoMode.MultiTargetPath) { MultiTargetPath mp = MultiTargetPath.Construct(multipoints.ToArray(), end.position, null, OnPathComplete); p = mp; } else if (activeDemo == DemoMode.RandomPath) { RandomPath rp = RandomPath.Construct(start.position, searchLength, OnPathComplete); rp.spread = spread; rp.aimStrength = aimStrength; rp.aim = end.position; p = rp; } else if (activeDemo == DemoMode.FleePath) { FleePath fp = FleePath.Construct(start.position, end.position, searchLength, OnPathComplete); fp.aimStrength = aimStrength; fp.spread = spread; p = fp; } else if (activeDemo == DemoMode.ConstantPath) { StartCoroutine(CalculateConstantPath()); p = null; } else if (activeDemo == DemoMode.FloodPath) { FloodPath fp = FloodPath.Construct(end.position, null); lastFlood = fp; p = fp; } else if (activeDemo == DemoMode.FloodPathTracer && lastFlood != null) { FloodPathTracer fp = FloodPathTracer.Construct(end.position, lastFlood, OnPathComplete); p = fp; } if (p != null) { AstarPath.StartPath(p); lastPath = p; } } public IEnumerator CalculateConstantPath () { ConstantPath constPath = ConstantPath.Construct(end.position, searchLength, OnPathComplete); AstarPath.StartPath(constPath); lastPath = constPath; yield return constPath.WaitForPath(); } }
{ "content_hash": "c10578490e27a936ce0c8e0edba7846f", "timestamp": "", "source": "github", "line_count": 418, "max_line_length": 169, "avg_line_length": 31.949760765550238, "alnum_prop": 0.6768251591164358, "repo_name": "Polyrhythm/bud", "id": "b40b29de4aeadab4a06107f6a01fae0a4a9f8020", "size": "13355", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Assets/AstarPathfindingProject/ExampleScenes/Example8_PathTypes/PathTypesDemo.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "2767662" }, { "name": "GLSL", "bytes": "57103" } ], "symlink_target": "" }
<?php namespace Milax\Mconsole\Models; use Illuminate\Database\Eloquent\Model; class Linkable extends Model { protected $fillable = ['link_id', 'linkable_id', 'linkable_type']; /** * Relation to Link * * @return BelongsTo */ public function link() { return $this->belongsTo('Milax\Mconsole\Models\Link'); } }
{ "content_hash": "d21edae589c63fb638ea6c78fc80c272", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 70, "avg_line_length": 18.3, "alnum_prop": 0.6120218579234973, "repo_name": "misterpaladin/mconsole", "id": "55d8e5355d8d8683b2a1a105ec663d7f5cbbc93e", "size": "366", "binary": false, "copies": "1", "ref": "refs/heads/1.0", "path": "src/Milax/Mconsole/Models/Linkable.php", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "33025" }, { "name": "HTML", "bytes": "29032" }, { "name": "JavaScript", "bytes": "67023" }, { "name": "PHP", "bytes": "159485" } ], "symlink_target": "" }
/* ---------------------------------------------------------------------------- */ /* Atmel Microcontroller Software Support */ /* SAM Software Package License */ /* ---------------------------------------------------------------------------- */ /* Copyright (c) 2014, Atmel Corporation */ /* */ /* All rights reserved. */ /* */ /* Redistribution and use in source and binary forms, with or without */ /* modification, are permitted provided that the following condition is met: */ /* */ /* - Redistributions of source code must retain the above copyright notice, */ /* this list of conditions and the disclaimer below. */ /* */ /* Atmel's name may not be used to endorse or promote products derived from */ /* this software without specific prior written permission. */ /* */ /* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */ /* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */ /* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, */ /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */ /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */ /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */ /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */ /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* ---------------------------------------------------------------------------- */ #ifndef _SAM_GPBR_COMPONENT_ #define _SAM_GPBR_COMPONENT_ /* ============================================================================= */ /** SOFTWARE API DEFINITION FOR General Purpose Backup Registers */ /* ============================================================================= */ /** \addtogroup SAM_GPBR General Purpose Backup Registers */ /*@{*/ #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) /** \brief Gpbr hardware registers */ typedef struct { __IO uint32_t SYS_GPBR[8]; /**< \brief (Gpbr Offset: 0x0) General Purpose Backup Register */ } Gpbr; #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */ /* -------- SYS_GPBR[8] : (GPBR Offset: 0x0) General Purpose Backup Register -------- */ #define SYS_GPBR_GPBR_VALUE_Pos 0 #define SYS_GPBR_GPBR_VALUE_Msk (0xffffffffu << SYS_GPBR_GPBR_VALUE_Pos) /**< \brief (SYS_GPBR[8]) Value of GPBR x */ #define SYS_GPBR_GPBR_VALUE(value) ((SYS_GPBR_GPBR_VALUE_Msk & ((value) << SYS_GPBR_GPBR_VALUE_Pos))) /*@}*/ #endif /* _SAM_GPBR_COMPONENT_ */
{ "content_hash": "82a2c41f96bcc2e0fa1b2701b032e4a8", "timestamp": "", "source": "github", "line_count": 53, "max_line_length": 117, "avg_line_length": 64.50943396226415, "alnum_prop": 0.46446329336063175, "repo_name": "shengwen1997/stm32_pratice", "id": "a8052fc4996c74a2ab592304b80eb599e01a9b58", "size": "3419", "binary": false, "copies": "11", "ref": "refs/heads/master", "path": "firmware/freertos/semaphore/lib/FreeRTOSV8.2.3/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_IAR_Keil/libchip_samv7/include/samv7/component/component_gpbr.h", "mode": "33188", "license": "mit", "language": [ { "name": "Assembly", "bytes": "414380" }, { "name": "C", "bytes": "9528935" }, { "name": "C++", "bytes": "56339" }, { "name": "CSS", "bytes": "15658" }, { "name": "JavaScript", "bytes": "22190" }, { "name": "Shell", "bytes": "1138" } ], "symlink_target": "" }
module Steps::Details class RepresentativeTypeController < Steps::DetailsStepController def edit @form_object = RepresentativeTypeForm.new( tribunal_case: current_tribunal_case, representative_type: current_tribunal_case.representative_type ) end def update update_and_advance(RepresentativeTypeForm) end end end
{ "content_hash": "3f8def4e93a6848271b949f77413973d", "timestamp": "", "source": "github", "line_count": 14, "max_line_length": 70, "avg_line_length": 26.285714285714285, "alnum_prop": 0.717391304347826, "repo_name": "ministryofjustice/tax-tribunals-datacapture", "id": "16616719a0f1a7e34660eeda5ae5c5513df80aad", "size": "368", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/controllers/steps/details/representative_type_controller.rb", "mode": "33188", "license": "mit", "language": [ { "name": "Dockerfile", "bytes": "5959" }, { "name": "Gherkin", "bytes": "25767" }, { "name": "HTML", "bytes": "135700" }, { "name": "JavaScript", "bytes": "46382" }, { "name": "Makefile", "bytes": "1446" }, { "name": "Procfile", "bytes": "78" }, { "name": "Ruby", "bytes": "794660" }, { "name": "SCSS", "bytes": "23446" }, { "name": "Scala", "bytes": "8556" }, { "name": "Shell", "bytes": "5753" } ], "symlink_target": "" }
namespace content { RenderViewImplParams::RenderViewImplParams( int32 opener_id, const RendererPreferences& renderer_prefs, const WebPreferences& webkit_prefs, int32 routing_id, int32 main_frame_routing_id, int32 surface_id, int64 session_storage_namespace_id, const base::string16& frame_name, bool is_renderer_created, bool swapped_out, bool hidden, int32 next_page_id, const blink::WebScreenInfo& screen_info, unsigned int accessibility_mode) : opener_id(opener_id), renderer_prefs(renderer_prefs), webkit_prefs(webkit_prefs), routing_id(routing_id), main_frame_routing_id(main_frame_routing_id), surface_id(surface_id), session_storage_namespace_id(session_storage_namespace_id), frame_name(frame_name), is_renderer_created(is_renderer_created), swapped_out(swapped_out), hidden(hidden), next_page_id(next_page_id), screen_info(screen_info), accessibility_mode(accessibility_mode) {} RenderViewImplParams::~RenderViewImplParams() {} } // namespace content
{ "content_hash": "11b4e91074064b3913311486788522b5", "timestamp": "", "source": "github", "line_count": 35, "max_line_length": 65, "avg_line_length": 31.485714285714284, "alnum_prop": 0.6932849364791288, "repo_name": "anirudhSK/chromium", "id": "aa1325c18a0c69cbb06456b65c514d6151292b41", "size": "1327", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "content/renderer/render_view_impl_params.cc", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "ASP", "bytes": "853" }, { "name": "AppleScript", "bytes": "6973" }, { "name": "Arduino", "bytes": "464" }, { "name": "Assembly", "bytes": "52960" }, { "name": "Awk", "bytes": "8660" }, { "name": "C", "bytes": "42502191" }, { "name": "C#", "bytes": "1132" }, { "name": "C++", "bytes": "201859263" }, { "name": "CSS", "bytes": "946557" }, { "name": "DOT", "bytes": "2984" }, { "name": "Java", "bytes": "5687122" }, { "name": "JavaScript", "bytes": "22163714" }, { "name": "M", "bytes": "2190" }, { "name": "Matlab", "bytes": "2496" }, { "name": "Objective-C", "bytes": "7670589" }, { "name": "PHP", "bytes": "97817" }, { "name": "Perl", "bytes": "672770" }, { "name": "Python", "bytes": "10873885" }, { "name": "R", "bytes": "262" }, { "name": "Shell", "bytes": "1315894" }, { "name": "Tcl", "bytes": "277091" }, { "name": "TypeScript", "bytes": "1560024" }, { "name": "XSLT", "bytes": "13493" }, { "name": "nesC", "bytes": "15206" } ], "symlink_target": "" }
package hep.lcio.implementation.event; import java.util.ArrayList; import java.util.List; import hep.lcio.event.TrackerHit; /** * @author Tony Johnson * @version $Id: ITrackerHit.java,v 1.12 2010-06-02 10:59:34 engels Exp $ */ public class ITrackerHit extends ILCObject implements TrackerHit { protected int cellID0; protected int cellID1; protected double[] position = new double[3]; protected float[] covMatrix = new float[6]; //protected float dEdx; // DEPRECATED. renamed to EDep protected float EDep; protected float EDepError; protected float time; protected int type; protected int quality; protected List rawHits = new ArrayList() ; public void setCellID0(int cellID) { checkAccess(); this.cellID0 = cellID; } public int getCellID0() { return cellID0; } public void setCellID1(int cellID) { checkAccess(); this.cellID1 = cellID; } public int getCellID1() { return cellID1; } public double[] getPosition() { return position; } public void setPosition(double[] pos) { if (pos.length != 3) throw new IllegalArgumentException(); checkAccess(); this.position = pos; } public float[] getCovMatrix() { return covMatrix; } public void setCovMatrix(float[] matrix) { if (matrix.length != 6) throw new IllegalArgumentException(); checkAccess(); this.covMatrix = matrix; } // DEPRECATED. renamed to getEDep() public float getdEdx() { //return dEdx; return getEDep(); } // DEPRECATED. renamed to setEDep() public void setdEdx(float dEdx) { //checkAccess(); //this.dEdx = dEdx; setEDep( dEdx ); } public float getEDep() { return EDep; } public void setEDep(float e) { checkAccess(); this.EDep = e; } public float getEDepError() { return EDepError; } public void setEDepError(float e) { checkAccess(); this.EDepError = e; } public float getTime() { return time; } public void setTime(float time) { checkAccess(); this.time = time; } public int getQuality() { return quality; } public void setQuality(int quality) { checkAccess(); this.quality = quality; } public int getType() { return type; } public void setType(int type) { checkAccess(); this.type = type; } public List getRawHits() { return rawHits ; } public void setRawHits(List rawHits) { checkAccess(); this.rawHits = rawHits; } }
{ "content_hash": "97bbc46e8370187f4f2fd8fd5046123b", "timestamp": "", "source": "github", "line_count": 154, "max_line_length": 73, "avg_line_length": 17.5974025974026, "alnum_prop": 0.5940959409594095, "repo_name": "iLCSoft/LCIO", "id": "d92065d4d20d14f19ab6d20ce79b7524300a239a", "size": "2710", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/java/hep/lcio/implementation/event/ITrackerHit.java", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Assembly", "bytes": "974" }, { "name": "Batchfile", "bytes": "1132" }, { "name": "C", "bytes": "209552" }, { "name": "C++", "bytes": "1482964" }, { "name": "CMake", "bytes": "100875" }, { "name": "Fortran", "bytes": "63752" }, { "name": "HTML", "bytes": "556" }, { "name": "Java", "bytes": "444092" }, { "name": "Pascal", "bytes": "14435" }, { "name": "Python", "bytes": "63418" }, { "name": "Shell", "bytes": "6564" }, { "name": "TeX", "bytes": "39624" } ], "symlink_target": "" }
$j = jQuery.noConflict();
{ "content_hash": "e892cb1ad1ddd8c990608b1e3f9d9d72", "timestamp": "", "source": "github", "line_count": 1, "max_line_length": 25, "avg_line_length": 25, "alnum_prop": 0.68, "repo_name": "scottburch/sparrow", "id": "4b8a6ed9b9d53b51962c9e7db08d0d3590cab88e", "size": "25", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "env.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "27" }, { "name": "HTML", "bytes": "2124" }, { "name": "JavaScript", "bytes": "23026" } ], "symlink_target": "" }
<div class="jumbotron jumbotron-ad hidden-print"> <div class="container"> <div class="jumbotron-kickstarter"> <div class="jumbotron-text"> <h1>{{ jumbotron_h1 }}</h1> <p>{{ jumbotron_p }}</p> </div> <div class="jumbotron-ks-ad"> <div id="kickstarter-widget" class="kickstarter-widget-index"> {% include kickstarter-widget.html %} </div> </div> </div> </div> </div>
{ "content_hash": "daba24d0e3eda0523ceb61aa1489496b", "timestamp": "", "source": "github", "line_count": 17, "max_line_length": 70, "avg_line_length": 26.176470588235293, "alnum_prop": 0.5573033707865168, "repo_name": "thanhnn1106/allelua_project", "id": "33608b81b66dcc0990353abf9af41a40352f7552", "size": "445", "binary": false, "copies": "7", "ref": "refs/heads/master", "path": "public/front/js/font-awesome/4.7.0/src/_includes/jumbotron.html", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "1014" }, { "name": "CSS", "bytes": "585092" }, { "name": "CoffeeScript", "bytes": "8474" }, { "name": "HTML", "bytes": "7289219" }, { "name": "Makefile", "bytes": "2393" }, { "name": "PHP", "bytes": "895109" }, { "name": "Ruby", "bytes": "6412" }, { "name": "Vue", "bytes": "563" } ], "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("Maestrano Tests")] [assembly: AssemblyDescription(".Net API for https://maestrano.com")] [assembly: AssemblyCompany("Maestrano")] [assembly: AssemblyProduct("Maestrano")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("9d229230-735b-4aeb-9757-afd8251fc235")] // 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("0.15.3.0")] [assembly: AssemblyFileVersion("0.15.3.0")]
{ "content_hash": "6a5b239502f4d456a4e292201b965e13", "timestamp": "", "source": "github", "line_count": 34, "max_line_length": 84, "avg_line_length": 40.3235294117647, "alnum_prop": 0.7476294675419402, "repo_name": "alachaum/maestrano-dotnet", "id": "8641aa86613ca59ccdde2ca1685ac6f12b387e66", "size": "1371", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "src/Maestrano.Tests/Properties/Assembly.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "223946" }, { "name": "Shell", "bytes": "396" } ], "symlink_target": "" }
<?php /** * REST API: WP_REST_Taxonomies_Controller class * * @package WordPress * @subpackage REST_API * @since 4.7.0 */ /** * Core class used to manage taxonomies via the REST API. * * @since 4.7.0 * * @see WP_REST_Controller */ class WP_REST_Taxonomies_Controller extends WP_REST_Controller { /** * Constructor. * * @since 4.7.0 */ public function __construct() { $this->namespace = 'wp/v2'; $this->rest_base = 'taxonomies'; } /** * Registers the routes for taxonomies. * * @since 4.7.0 * * @see register_rest_route() */ public function register_routes() { register_rest_route( $this->namespace, '/' . $this->rest_base, array( array( 'methods' => WP_REST_Server::READABLE, 'callback' => array( $this, 'get_items' ), 'permission_callback' => array( $this, 'get_items_permissions_check' ), 'args' => $this->get_collection_params(), ), 'schema' => array( $this, 'get_public_item_schema' ), ) ); register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P<taxonomy>[\w-]+)', array( 'args' => array( 'taxonomy' => array( 'description' => __( 'An alphanumeric identifier for the taxonomy.' ), 'type' => 'string', ), ), array( 'methods' => WP_REST_Server::READABLE, 'callback' => array( $this, 'get_item' ), 'permission_callback' => array( $this, 'get_item_permissions_check' ), 'args' => array( 'context' => $this->get_context_param( array( 'default' => 'view' ) ), ), ), 'schema' => array( $this, 'get_public_item_schema' ), ) ); } /** * Checks whether a given request has permission to read taxonomies. * * @since 4.7.0 * * @param WP_REST_Request $request Full details about the request. * @return true|WP_Error True if the request has read access, WP_Error object otherwise. */ public function get_items_permissions_check( $request ) { if ( 'edit' === $request['context'] ) { if ( ! empty( $request['type'] ) ) { $taxonomies = get_object_taxonomies( $request['type'], 'objects' ); } else { $taxonomies = get_taxonomies( '', 'objects' ); } foreach ( $taxonomies as $taxonomy ) { if ( ! empty( $taxonomy->show_in_rest ) && current_user_can( $taxonomy->cap->assign_terms ) ) { return true; } } return new WP_Error( 'rest_cannot_view', __( 'Sorry, you are not allowed to manage terms in this taxonomy.' ), array( 'status' => rest_authorization_required_code() ) ); } return true; } /** * Retrieves all public taxonomies. * * @since 4.7.0 * * @param WP_REST_Request $request Full details about the request. * @return WP_REST_Response Response object on success, or WP_Error object on failure. */ public function get_items( $request ) { // Retrieve the list of registered collection query parameters. $registered = $this->get_collection_params(); if ( isset( $registered['type'] ) && ! empty( $request['type'] ) ) { $taxonomies = get_object_taxonomies( $request['type'], 'objects' ); } else { $taxonomies = get_taxonomies( '', 'objects' ); } $data = array(); foreach ( $taxonomies as $tax_type => $value ) { if ( empty( $value->show_in_rest ) || ( 'edit' === $request['context'] && ! current_user_can( $value->cap->assign_terms ) ) ) { continue; } $tax = $this->prepare_item_for_response( $value, $request ); $tax = $this->prepare_response_for_collection( $tax ); $data[ $tax_type ] = $tax; } if ( empty( $data ) ) { // Response should still be returned as a JSON object when it is empty. $data = (object) $data; } return rest_ensure_response( $data ); } /** * Checks if a given request has access to a taxonomy. * * @since 4.7.0 * * @param WP_REST_Request $request Full details about the request. * @return true|WP_Error True if the request has read access for the item, otherwise false or WP_Error object. */ public function get_item_permissions_check( $request ) { $tax_obj = get_taxonomy( $request['taxonomy'] ); if ( $tax_obj ) { if ( empty( $tax_obj->show_in_rest ) ) { return false; } if ( 'edit' === $request['context'] && ! current_user_can( $tax_obj->cap->assign_terms ) ) { return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to manage terms in this taxonomy.' ), array( 'status' => rest_authorization_required_code() ) ); } } return true; } /** * Retrieves a specific taxonomy. * * @since 4.7.0 * * @param WP_REST_Request $request Full details about the request. * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. */ public function get_item( $request ) { $tax_obj = get_taxonomy( $request['taxonomy'] ); if ( empty( $tax_obj ) ) { return new WP_Error( 'rest_taxonomy_invalid', __( 'Invalid taxonomy.' ), array( 'status' => 404 ) ); } $data = $this->prepare_item_for_response( $tax_obj, $request ); return rest_ensure_response( $data ); } /** * Prepares a taxonomy object for serialization. * * @since 4.7.0 * @since 5.9.0 Renamed `$taxonomy` to `$item` to match parent class for PHP 8 named parameter support. * * @param WP_Taxonomy $item Taxonomy data. * @param WP_REST_Request $request Full details about the request. * @return WP_REST_Response Response object. */ public function prepare_item_for_response( $item, $request ) { // Restores the more descriptive, specific name for use within this method. $taxonomy = $item; $base = ! empty( $taxonomy->rest_base ) ? $taxonomy->rest_base : $taxonomy->name; $fields = $this->get_fields_for_response( $request ); $data = array(); if ( in_array( 'name', $fields, true ) ) { $data['name'] = $taxonomy->label; } if ( in_array( 'slug', $fields, true ) ) { $data['slug'] = $taxonomy->name; } if ( in_array( 'capabilities', $fields, true ) ) { $data['capabilities'] = $taxonomy->cap; } if ( in_array( 'description', $fields, true ) ) { $data['description'] = $taxonomy->description; } if ( in_array( 'labels', $fields, true ) ) { $data['labels'] = $taxonomy->labels; } if ( in_array( 'types', $fields, true ) ) { $data['types'] = array_values( $taxonomy->object_type ); } if ( in_array( 'show_cloud', $fields, true ) ) { $data['show_cloud'] = $taxonomy->show_tagcloud; } if ( in_array( 'hierarchical', $fields, true ) ) { $data['hierarchical'] = $taxonomy->hierarchical; } if ( in_array( 'rest_base', $fields, true ) ) { $data['rest_base'] = $base; } if ( in_array( 'rest_namespace', $fields, true ) ) { $data['rest_namespace'] = $taxonomy->rest_namespace; } if ( in_array( 'visibility', $fields, true ) ) { $data['visibility'] = array( 'public' => (bool) $taxonomy->public, 'publicly_queryable' => (bool) $taxonomy->publicly_queryable, 'show_admin_column' => (bool) $taxonomy->show_admin_column, 'show_in_nav_menus' => (bool) $taxonomy->show_in_nav_menus, 'show_in_quick_edit' => (bool) $taxonomy->show_in_quick_edit, 'show_ui' => (bool) $taxonomy->show_ui, ); } $context = ! empty( $request['context'] ) ? $request['context'] : 'view'; $data = $this->add_additional_fields_to_object( $data, $request ); $data = $this->filter_response_by_context( $data, $context ); // Wrap the data in a response object. $response = rest_ensure_response( $data ); $response->add_links( array( 'collection' => array( 'href' => rest_url( sprintf( '%s/%s', $this->namespace, $this->rest_base ) ), ), 'https://api.w.org/items' => array( 'href' => rest_url( rest_get_route_for_taxonomy_items( $taxonomy->name ) ), ), ) ); /** * Filters a taxonomy returned from the REST API. * * Allows modification of the taxonomy data right before it is returned. * * @since 4.7.0 * * @param WP_REST_Response $response The response object. * @param WP_Taxonomy $item The original taxonomy object. * @param WP_REST_Request $request Request used to generate the response. */ return apply_filters( 'rest_prepare_taxonomy', $response, $taxonomy, $request ); } /** * Retrieves the taxonomy's schema, conforming to JSON Schema. * * @since 4.7.0 * @since 5.0.0 The `visibility` property was added. * @since 5.9.0 The `rest_namespace` property was added. * * @return array Item schema data. */ public function get_item_schema() { if ( $this->schema ) { return $this->add_additional_fields_schema( $this->schema ); } $schema = array( '$schema' => 'http://json-schema.org/draft-04/schema#', 'title' => 'taxonomy', 'type' => 'object', 'properties' => array( 'capabilities' => array( 'description' => __( 'All capabilities used by the taxonomy.' ), 'type' => 'object', 'context' => array( 'edit' ), 'readonly' => true, ), 'description' => array( 'description' => __( 'A human-readable description of the taxonomy.' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'hierarchical' => array( 'description' => __( 'Whether or not the taxonomy should have children.' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'labels' => array( 'description' => __( 'Human-readable labels for the taxonomy for various contexts.' ), 'type' => 'object', 'context' => array( 'edit' ), 'readonly' => true, ), 'name' => array( 'description' => __( 'The title for the taxonomy.' ), 'type' => 'string', 'context' => array( 'view', 'edit', 'embed' ), 'readonly' => true, ), 'slug' => array( 'description' => __( 'An alphanumeric identifier for the taxonomy.' ), 'type' => 'string', 'context' => array( 'view', 'edit', 'embed' ), 'readonly' => true, ), 'show_cloud' => array( 'description' => __( 'Whether or not the term cloud should be displayed.' ), 'type' => 'boolean', 'context' => array( 'edit' ), 'readonly' => true, ), 'types' => array( 'description' => __( 'Types associated with the taxonomy.' ), 'type' => 'array', 'items' => array( 'type' => 'string', ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'rest_base' => array( 'description' => __( 'REST base route for the taxonomy.' ), 'type' => 'string', 'context' => array( 'view', 'edit', 'embed' ), 'readonly' => true, ), 'rest_namespace' => array( 'description' => __( 'REST namespace route for the taxonomy.' ), 'type' => 'string', 'context' => array( 'view', 'edit', 'embed' ), 'readonly' => true, ), 'visibility' => array( 'description' => __( 'The visibility settings for the taxonomy.' ), 'type' => 'object', 'context' => array( 'edit' ), 'readonly' => true, 'properties' => array( 'public' => array( 'description' => __( 'Whether a taxonomy is intended for use publicly either via the admin interface or by front-end users.' ), 'type' => 'boolean', ), 'publicly_queryable' => array( 'description' => __( 'Whether the taxonomy is publicly queryable.' ), 'type' => 'boolean', ), 'show_ui' => array( 'description' => __( 'Whether to generate a default UI for managing this taxonomy.' ), 'type' => 'boolean', ), 'show_admin_column' => array( 'description' => __( 'Whether to allow automatic creation of taxonomy columns on associated post-types table.' ), 'type' => 'boolean', ), 'show_in_nav_menus' => array( 'description' => __( 'Whether to make the taxonomy available for selection in navigation menus.' ), 'type' => 'boolean', ), 'show_in_quick_edit' => array( 'description' => __( 'Whether to show the taxonomy in the quick/bulk edit panel.' ), 'type' => 'boolean', ), ), ), ), ); $this->schema = $schema; return $this->add_additional_fields_schema( $this->schema ); } /** * Retrieves the query params for collections. * * @since 4.7.0 * * @return array Collection parameters. */ public function get_collection_params() { $new_params = array(); $new_params['context'] = $this->get_context_param( array( 'default' => 'view' ) ); $new_params['type'] = array( 'description' => __( 'Limit results to taxonomies associated with a specific post type.' ), 'type' => 'string', ); return $new_params; } }
{ "content_hash": "798ef8e89868a5521fc03b23ec7af633", "timestamp": "", "source": "github", "line_count": 440, "max_line_length": 134, "avg_line_length": 29.961363636363636, "alnum_prop": 0.5623151027838883, "repo_name": "electric-eloquence/fepper-wordpress", "id": "ede47585b10ea84d83ed3180daf5e42e7b07385a", "size": "13183", "binary": false, "copies": "13", "ref": "refs/heads/dev", "path": "backend/wordpress/wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "2545314" }, { "name": "HTML", "bytes": "79" }, { "name": "JavaScript", "bytes": "5170950" }, { "name": "Mustache", "bytes": "17516" }, { "name": "PHP", "bytes": "15896768" }, { "name": "PowerShell", "bytes": "755" }, { "name": "SCSS", "bytes": "25910" }, { "name": "Shell", "bytes": "1124" }, { "name": "Stylus", "bytes": "28810" }, { "name": "VBScript", "bytes": "466" } ], "symlink_target": "" }
package net.npg.abattle.communication; import com.google.common.base.Optional; import java.util.Collection; import java.util.Map; import java.util.Set; import net.npg.abattle.client.lan.ClientGameEnvironment; import net.npg.abattle.client.lan.impl.ClientGameEnvironmentImpl; import net.npg.abattle.common.component.ComponentLookup; import net.npg.abattle.common.configuration.impl.ConfigurationComponentImpl; import net.npg.abattle.common.error.ErrorMessage; import net.npg.abattle.common.model.client.ClientGame; import net.npg.abattle.common.model.client.ClientPlayer; import net.npg.abattle.common.model.client.impl.ClientModelComponentImpl; import net.npg.abattle.common.utils.IntPoint; import net.npg.abattle.communication.command.CommandQueueServer; import net.npg.abattle.communication.command.CommandType; import net.npg.abattle.communication.command.GameCommand; import net.npg.abattle.communication.command.commands.ChangeLinkCommand; import net.npg.abattle.communication.command.impl.CommandQueueImpl; import net.npg.abattle.communication.network.NetworkClient; import net.npg.abattle.communication.network.NetworkComponent; import net.npg.abattle.communication.network.NetworkServer; import net.npg.abattle.communication.network.data.NetworkGameInfo; import net.npg.abattle.communication.network.impl.GameCommandHandler; import net.npg.abattle.communication.network.impl.LoginHandler; import net.npg.abattle.communication.network.impl.LoginResultHandler; import net.npg.abattle.communication.network.impl.NetworkComponentImpl; import net.npg.abattle.communication.network.impl.NetworkServerProcessor; import net.npg.abattle.communication.service.ServerService; import net.npg.abattle.server.command.ChangeLinkCommandProcessor; import net.npg.abattle.server.service.impl.ServerServiceImpl; import org.eclipse.xtext.xbase.lib.Exceptions; import org.junit.After; import org.junit.Assert; import org.junit.Test; @SuppressWarnings("all") public class PlayerConnectionTest { @Test public void testPlayerConnection() { try { this.baseInit(); final ClientGameEnvironmentImpl environment1 = this.doPlayer1(); final ClientGameEnvironmentImpl environment2 = this.doPlayer2(); Thread.sleep(1000); this.processCommandQueue(environment1); this.processCommandQueue(environment2); this.checkEnvironment(environment1); this.checkEnvironment(environment2); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } } private Object processCommandQueue(final ClientGameEnvironment env) { return null; } private void checkEnvironment(final ClientGameEnvironment environment) { final ClientGame game2 = environment.getGame(); Collection<ClientPlayer> _players = game2.getPlayers(); int _size = _players.size(); Assert.assertEquals(2, _size); } private void baseInit() { ComponentLookup.createInstance(); ComponentLookup _instance = ComponentLookup.getInstance(); ConfigurationComponentImpl _configurationComponentImpl = new ConfigurationComponentImpl(); _instance.<ConfigurationComponentImpl>registerComponent(_configurationComponentImpl); final CommandQueueImpl cqs = new CommandQueueImpl(CommandType.TOSERVER, null); ComponentLookup _instance_1 = ComponentLookup.getInstance(); NetworkComponentImpl _networkComponentImpl = new NetworkComponentImpl(); final NetworkComponentImpl networkComponent = _instance_1.<NetworkComponentImpl>registerComponent(_networkComponentImpl, NetworkComponent.class); final ClientModelComponentImpl clientIdRegister = new ClientModelComponentImpl(); final ServerServiceImpl serverService = new ServerServiceImpl(cqs); final NetworkServer server = networkComponent.createServer(); LoginHandler _loginHandler = new LoginHandler(serverService); server.addHandler(_loginHandler); LoginResultHandler _loginResultHandler = new LoginResultHandler(clientIdRegister); server.addHandler(_loginResultHandler); GameCommandHandler _gameCommandHandler = new GameCommandHandler(cqs); server.addHandler(_gameCommandHandler); server.registerService(serverService, ServerServiceImpl.SERVER_SERVICE_ID); this.registerServerProcessors(server, serverService, cqs); } private void registerServerProcessors(final NetworkServer server, final ServerService serverService, final CommandQueueServer serverQueue) { ChangeLinkCommandProcessor _changeLinkCommandProcessor = new ChangeLinkCommandProcessor(serverService); Optional<Class<ChangeLinkCommand>> _of = Optional.<Class<ChangeLinkCommand>>of(ChangeLinkCommand.class); serverQueue.<ChangeLinkCommand>registerCommandProcessor(_changeLinkCommandProcessor, _of, CommandType.TOSERVER); NetworkServerProcessor _networkServerProcessor = new NetworkServerProcessor(server); Optional<Class<GameCommand>> _absent = Optional.<Class<GameCommand>>absent(); serverQueue.<GameCommand>registerCommandProcessor(_networkServerProcessor, _absent, CommandType.TOCLIENT); } private ClientGameEnvironmentImpl doPlayer1() { ClientGameEnvironmentImpl _xblockexpression = null; { ComponentLookup _instance = ComponentLookup.getInstance(); NetworkComponent _component = _instance.<NetworkComponent>getComponent(NetworkComponent.class); final NetworkClient client1 = _component.createClient(); boolean _discoverHost = client1.discoverHost(); boolean _not = (!_discoverHost); if (_not) { throw new RuntimeException("cannot find local host!"); } final ClientGameEnvironmentImpl environment = new ClientGameEnvironmentImpl(client1); environment.login("Test"); IntPoint _from = IntPoint.from(10, 10); final ErrorMessage error = environment.createGame(_from, 2); boolean _isFailed = error.isFailed(); Assert.assertFalse(_isFailed); _xblockexpression = environment; } return _xblockexpression; } private ClientGameEnvironmentImpl doPlayer2() { ClientGameEnvironmentImpl _xblockexpression = null; { ComponentLookup _instance = ComponentLookup.getInstance(); NetworkComponent _component = _instance.<NetworkComponent>getComponent(NetworkComponent.class); final NetworkClient client2 = _component.createClient(); final Optional<NetworkGameInfo> networkGame = client2.discoverHostAndGame(); boolean _isPresent = networkGame.isPresent(); boolean _not = (!_isPresent); if (_not) { throw new RuntimeException("cannot find local host!"); } final ClientGameEnvironmentImpl environment = new ClientGameEnvironmentImpl(client2); Optional<NetworkGameInfo> _foundGame = client2.getFoundGame(); boolean _isPresent_1 = _foundGame.isPresent(); Assert.assertTrue(_isPresent_1); environment.login("Test2"); Optional<NetworkGameInfo> _foundGame_1 = client2.getFoundGame(); NetworkGameInfo _get = _foundGame_1.get(); int _gameId = _get.getGameId(); final ErrorMessage result = environment.joinGame(_gameId); boolean _isFailed = result.isFailed(); Assert.assertFalse(_isFailed); _xblockexpression = environment; } return _xblockexpression; } @After public void cleanUp() { this.interruptAllThreads(); } private void interruptAllThreads() { Map<Thread, StackTraceElement[]> _allStackTraces = Thread.getAllStackTraces(); Set<Thread> _keySet = _allStackTraces.keySet(); for (final Thread thread : _keySet) { boolean _and = false; String _name = thread.getName(); boolean _equals = "main".equals(_name); boolean _not = (!_equals); if (!_not) { _and = false; } else { String _name_1 = thread.getName(); boolean _equals_1 = "finalizer".equals(_name_1); boolean _not_1 = (!_equals_1); _and = _not_1; } if (_and) { thread.interrupt(); } } } }
{ "content_hash": "eb95fb6517a6fcdb8868edc1037baff4", "timestamp": "", "source": "github", "line_count": 174, "max_line_length": 149, "avg_line_length": 46.747126436781606, "alnum_prop": 0.7396115072535038, "repo_name": "CymricNPG/abattle", "id": "6783f8290782c759e528dc9aa6fc780d4e9c207d", "size": "8134", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ABattle.Test/xtend-gen/net/npg/abattle/communication/PlayerConnectionTest.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "8021" }, { "name": "Java", "bytes": "924001" }, { "name": "Xtend", "bytes": "262124" } ], "symlink_target": "" }
div.row{ width:90%; } div#example_wrapper{ width:90%; } table{ width:90% } div.dataTables_length label { font-weight: normal; text-align: left; white-space: nowrap; } div.dataTables_length select { width: 75px; display: inline-block; } div.dataTables_filter { text-align: right; } div.dataTables_filter label { font-weight: normal; white-space: nowrap; text-align: left; } div.dataTables_filter input { margin-left: 0.5em; display: inline-block; width: auto; } div.dataTables_info { padding-top: 8px; white-space: nowrap; } div.dataTables_paginate { margin: 0; white-space: nowrap; text-align: right; } div.dataTables_paginate ul.pagination { margin: 2px 0; white-space: nowrap; } @media screen and (max-width: 767px) { div.dataTables_wrapper > div.row > div, div.dataTables_length, div.dataTables_filter, div.dataTables_info, div.dataTables_paginate { text-align: center; } div.DTTT { margin-bottom: 0.5em; } } table.dataTable td, table.dataTable th { -webkit-box-sizing: content-box; -moz-box-sizing: content-box; box-sizing: content-box; } table.dataTable { clear: both; margin-top: 6px !important; margin-bottom: 6px !important; max-width: none !important; } table.dataTable thead .sorting, table.dataTable thead .sorting_asc, table.dataTable thead .sorting_desc, table.dataTable thead .sorting_asc_disabled, table.dataTable thead .sorting_desc_disabled { cursor: pointer; position: relative; } table.dataTable thead .sorting:after, table.dataTable thead .sorting_asc:after, table.dataTable thead .sorting_desc:after { position: absolute; top: 8px; right: 8px; display: block; font-family: 'Glyphicons Halflings'; opacity: 0.5; } table.dataTable thead .sorting:after { opacity: 0.2; content: "\e150"; /* sort */ } table.dataTable thead .sorting_asc:after { content: "\e155"; /* sort-by-attributes */ } table.dataTable thead .sorting_desc:after { content: "\e156"; /* sort-by-attributes-alt */ } div.dataTables_scrollBody table.dataTable thead .sorting:after, div.dataTables_scrollBody table.dataTable thead .sorting_asc:after, div.dataTables_scrollBody table.dataTable thead .sorting_desc:after { display: none; } table.dataTable thead .sorting_asc_disabled:after, table.dataTable thead .sorting_desc_disabled:after { color: #eee; } table.dataTable thead > tr > th { padding-right: 30px; } table.dataTable th:active { outline: none; } /* Condensed */ table.dataTable.table-condensed thead > tr > th { padding-right: 20px; } table.dataTable.table-condensed thead .sorting:after, table.dataTable.table-condensed thead .sorting_asc:after, table.dataTable.table-condensed thead .sorting_desc:after { top: 6px; right: 6px; } /* Scrolling */ div.dataTables_scrollHead table { margin-bottom: 0 !important; border-bottom-left-radius: 0; border-bottom-right-radius: 0; } div.dataTables_scrollHead table thead tr:last-child th:first-child, div.dataTables_scrollHead table thead tr:last-child td:first-child { border-bottom-left-radius: 0 !important; border-bottom-right-radius: 0 !important; } div.dataTables_scrollBody table { border-top: none; margin-top: 0 !important; margin-bottom: 0 !important; } div.dataTables_scrollBody tbody tr:first-child th, div.dataTables_scrollBody tbody tr:first-child td { border-top: none; } div.dataTables_scrollFoot table { margin-top: 0 !important; border-top: none; } /* Frustratingly the border-collapse:collapse used by Bootstrap makes the column width calculations when using scrolling impossible to align columns. We have to use separate */ table.table-bordered.dataTable { border-collapse: separate !important; } table.table-bordered thead th, table.table-bordered thead td { border-left-width: 0; border-top-width: 0; } table.table-bordered tbody th, table.table-bordered tbody td { border-left-width: 0; border-bottom-width: 0; } table.table-bordered tfoot th, table.table-bordered tfoot td { border-left-width: 0; border-bottom-width: 0; } table.table-bordered th:last-child, table.table-bordered td:last-child { border-right-width: 0; } div.dataTables_scrollHead table.table-bordered { border-bottom-width: 0; } /* * TableTools styles */ .table.dataTable tbody tr.active td, .table.dataTable tbody tr.active th { background-color: #08C; color: white; } .table.dataTable tbody tr.active:hover td, .table.dataTable tbody tr.active:hover th { background-color: #0075b0 !important; } .table.dataTable tbody tr.active th > a, .table.dataTable tbody tr.active td > a { color: white; } .table-striped.dataTable tbody tr.active:nth-child(odd) td, .table-striped.dataTable tbody tr.active:nth-child(odd) th { background-color: #017ebc; } table.DTTT_selectable tbody tr { cursor: pointer; } div.DTTT .btn:hover { text-decoration: none !important; } ul.DTTT_dropdown.dropdown-menu { z-index: 2003; } ul.DTTT_dropdown.dropdown-menu a { color: #333 !important; /* needed only when demo_page.css is included */ } ul.DTTT_dropdown.dropdown-menu li { position: relative; } ul.DTTT_dropdown.dropdown-menu li:hover a { background-color: #0088cc; color: white !important; } div.DTTT_collection_background { z-index: 2002; } /* TableTools information display */ div.DTTT_print_info { position: fixed; top: 50%; left: 50%; width: 400px; height: 150px; margin-left: -200px; margin-top: -75px; text-align: center; color: #333; padding: 10px 30px; opacity: 0.95; background-color: white; border: 1px solid rgba(0, 0, 0, 0.2); border-radius: 6px; -webkit-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.5); box-shadow: 0 3px 7px rgba(0, 0, 0, 0.5); } div.DTTT_print_info h6 { font-weight: normal; font-size: 28px; line-height: 28px; margin: 1em; } div.DTTT_print_info p { font-size: 14px; line-height: 20px; } div.dataTables_processing { position: absolute; top: 50%; left: 50%; width: 100%; height: 60px; margin-left: -50%; margin-top: -25px; padding-top: 20px; padding-bottom: 20px; text-align: center; font-size: 1.2em; background-color: white; background: -webkit-gradient(linear, left top, right top, color-stop(0%, rgba(255,255,255,0)), color-stop(25%, rgba(255,255,255,0.9)), color-stop(75%, rgba(255,255,255,0.9)), color-stop(100%, rgba(255,255,255,0))); background: -webkit-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%); background: -moz-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%); background: -ms-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%); background: -o-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%); background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%); } /* * FixedColumns styles */ div.DTFC_LeftHeadWrapper table, div.DTFC_LeftFootWrapper table, div.DTFC_RightHeadWrapper table, div.DTFC_RightFootWrapper table, table.DTFC_Cloned tr.even { background-color: white; margin-bottom: 0; } div.DTFC_RightHeadWrapper table , div.DTFC_LeftHeadWrapper table { border-bottom: none !important; margin-bottom: 0 !important; border-top-right-radius: 0 !important; border-bottom-left-radius: 0 !important; border-bottom-right-radius: 0 !important; } div.DTFC_RightHeadWrapper table thead tr:last-child th:first-child, div.DTFC_RightHeadWrapper table thead tr:last-child td:first-child, div.DTFC_LeftHeadWrapper table thead tr:last-child th:first-child, div.DTFC_LeftHeadWrapper table thead tr:last-child td:first-child { border-bottom-left-radius: 0 !important; border-bottom-right-radius: 0 !important; } div.DTFC_RightBodyWrapper table, div.DTFC_LeftBodyWrapper table { border-top: none; margin: 0 !important; } div.DTFC_RightBodyWrapper tbody tr:first-child th, div.DTFC_RightBodyWrapper tbody tr:first-child td, div.DTFC_LeftBodyWrapper tbody tr:first-child th, div.DTFC_LeftBodyWrapper tbody tr:first-child td { border-top: none; } div.DTFC_RightFootWrapper table, div.DTFC_LeftFootWrapper table { border-top: none; margin-top: 0 !important; } div.DTFC_LeftBodyWrapper table.dataTable thead .sorting:after, div.DTFC_LeftBodyWrapper table.dataTable thead .sorting_asc:after, div.DTFC_LeftBodyWrapper table.dataTable thead .sorting_desc:after, div.DTFC_RightBodyWrapper table.dataTable thead .sorting:after, div.DTFC_RightBodyWrapper table.dataTable thead .sorting_asc:after, div.DTFC_RightBodyWrapper table.dataTable thead .sorting_desc:after { display: none; } /* * FixedHeader styles */ div.FixedHeader_Cloned table { margin: 0 !important }
{ "content_hash": "157fca252f1a535b92e228ce8c682118", "timestamp": "", "source": "github", "line_count": 380, "max_line_length": 218, "avg_line_length": 23.41842105263158, "alnum_prop": 0.7223283515001686, "repo_name": "cortext/antonio", "id": "9424e4137f58aa7659c0a95f75795c6db00f474a", "size": "8899", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "static/css/dataTables.bootstrap.css", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "261432" }, { "name": "HTML", "bytes": "3245" }, { "name": "JavaScript", "bytes": "1203878" }, { "name": "Python", "bytes": "105675" }, { "name": "Smarty", "bytes": "256195" } ], "symlink_target": "" }
typedef void (func_type) (); struct s { func_type f:32; // { dg-error "" } bitified with function type }; int main () { return 0; }
{ "content_hash": "b2c690f79b9e0981a2f96dcdcdf7e947", "timestamp": "", "source": "github", "line_count": 7, "max_line_length": 64, "avg_line_length": 19.428571428571427, "alnum_prop": 0.6029411764705882, "repo_name": "the-linix-project/linix-kernel-source", "id": "42533861fd1ecb2747bf45eec5d33c7d51a73217", "size": "323", "binary": false, "copies": "211", "ref": "refs/heads/master", "path": "gccsrc/gcc-4.7.2/gcc/testsuite/g++.old-deja/g++.bugs/900402_01.C", "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": "" }
/* Include file missing from Interix */ #ifndef INTTYPES_H #define INTTYPES_H typedef unsigned long long uint64_t; typedef unsigned int uintptr_t; #endif
{ "content_hash": "b1ff4d8cf84f7b19930203655eeff59f", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 39, "avg_line_length": 15.8, "alnum_prop": 0.759493670886076, "repo_name": "OpenVnmrJ/OpenVnmrJ", "id": "435618c751c043047875de20e70a7a6363b436ac", "size": "400", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/nvpsg/sfuinttypes.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Assembly", "bytes": "8033" }, { "name": "Awk", "bytes": "3726" }, { "name": "Batchfile", "bytes": "993" }, { "name": "C", "bytes": "44578835" }, { "name": "C++", "bytes": "1895471" }, { "name": "CSS", "bytes": "12739" }, { "name": "Fortran", "bytes": "1661682" }, { "name": "HTML", "bytes": "68197" }, { "name": "Inno Setup", "bytes": "18741" }, { "name": "Java", "bytes": "17274464" }, { "name": "JavaScript", "bytes": "44448" }, { "name": "Lex", "bytes": "42593" }, { "name": "LiveScript", "bytes": "1071" }, { "name": "MATLAB", "bytes": "77708" }, { "name": "Makefile", "bytes": "126047" }, { "name": "OpenEdge ABL", "bytes": "6980" }, { "name": "PLpgSQL", "bytes": "1040" }, { "name": "Perl", "bytes": "10286" }, { "name": "PostScript", "bytes": "801" }, { "name": "Python", "bytes": "590263" }, { "name": "R", "bytes": "1082" }, { "name": "RPC", "bytes": "43654" }, { "name": "Roff", "bytes": "41584" }, { "name": "Shell", "bytes": "1478413" }, { "name": "Tcl", "bytes": "864859" }, { "name": "Vim Script", "bytes": "7711" }, { "name": "Yacc", "bytes": "95121" } ], "symlink_target": "" }
/** * --------------------------- Our Custom GWIN Oscilloscope --------------- * * This GWIN superset implements a simple audio oscilloscope using the GADC high speed device. */ #include "gfx.h" #include "gwinosc.h" /* Include internal GWIN routines so we can build our own superset class */ #include "src/gwin/gwin_class.h" /* How many flat-line sample before we trigger */ #define FLATLINE_SAMPLES 8 static void _destroy(GHandle gh) { gadcHighSpeedStop(); if (((GScopeObject *)gh)->lastscopetrace) { gfxFree(((GScopeObject *)gh)->lastscopetrace); ((GScopeObject *)gh)->lastscopetrace = 0; } } static const gwinVMT scopeVMT = { "Scope", // The classname sizeof(GScopeObject), // The object size _destroy, // The destroy routine 0, // The redraw routine 0, // The after-clear routine }; GHandle gwinGScopeCreate(GDisplay *g, GScopeObject *gs, GWindowInit *pInit, uint32_t physdev, uint32_t frequency) { /* Initialise the base class GWIN */ if (!(gs = (GScopeObject *)_gwindowCreate(g, &gs->g, pInit, &scopeVMT, 0))) return 0; gs->nextx = 0; if (!(gs->lastscopetrace = gfxAlloc(gs->g.width * sizeof(coord_t)))) return 0; #if TRIGGER_METHOD == TRIGGER_POSITIVERAMP gs->lasty = gs->g.height/2; #elif TRIGGER_METHOD == TRIGGER_MINVALUE gs->lasty = gs->g.height/2; gs->scopemin = 0; #endif /* Start the GADC high speed converter */ gadcHighSpeedInit(physdev, frequency); gadcHighSpeedStart(); gwinSetVisible((GHandle)gs, pInit->show); return (GHandle)gs; } void gwinScopeWaitForTrace(GHandle gh) { #define gs ((GScopeObject *)(gh)) int i; coord_t x, y; coord_t yoffset; adcsample_t *pa; coord_t *pc; GDataBuffer *pd; uint8_t shr; #if TRIGGER_METHOD == TRIGGER_POSITIVERAMP bool_t rdytrigger; int flsamples; #elif TRIGGER_METHOD == TRIGGER_MINVALUE bool_t rdytrigger; int flsamples; coord_t scopemin; #endif if (gh->vmt != &scopeVMT) return; /* Wait for a set of conversions */ pd = gadcHighSpeedGetData(TIME_INFINITE); /* Ensure we are drawing in the right area */ #if GDISP_NEED_CLIP gdispGSetClip(gh->display, gh->x, gh->y, gh->width, gh->height); #endif shr = 16 - gfxSampleFormatBits(GADC_SAMPLE_FORMAT); yoffset = gh->height/2; if (!gfxSampleFormatIsSigned(GADC_SAMPLE_FORMAT)) yoffset += (1<<SCOPE_Y_BITS)/2; x = gs->nextx; pc = gs->lastscopetrace+x; pa = (adcsample_t *)(pd+1); #if TRIGGER_METHOD == TRIGGER_POSITIVERAMP rdytrigger = FALSE; flsamples = 0; #elif TRIGGER_METHOD == TRIGGER_MINVALUE rdytrigger = FALSE; flsamples = 0; scopemin = 0; #endif for(i = pd->len/sizeof(adcsample_t); i; i--) { /* Calculate the new scope value - re-scale using simple shifts for efficiency, re-center and y-invert */ y = yoffset - (((coord_t)(*pa++) << shr) >> (16-SCOPE_Y_BITS)); #if TRIGGER_METHOD == TRIGGER_MINVALUE /* Calculate the scopemin ready for the next trace */ if (y > scopemin) scopemin = y; #endif /* Have we reached the end of a scope trace? */ if (x >= gh->width) { #if TRIGGER_METHOD == TRIGGER_POSITIVERAMP || TRIGGER_METHOD == TRIGGER_MINVALUE /* Handle triggering - we trigger on the next sample minimum (y value maximum) or a flat-line */ #if TRIGGER_METHOD == TRIGGER_MINVALUE /* Arm when we reach the sample minimum (y value maximum) of the previous trace */ if (!rdytrigger && y >= gs->scopemin) rdytrigger = TRUE; #endif if (y == gs->lasty) { /* Trigger if we get too many flat-line samples regardless of the armed state */ if (++flsamples < FLATLINE_SAMPLES) continue; flsamples = 0; } else if (y > gs->lasty) { gs->lasty = y; flsamples = 0; #if TRIGGER_METHOD == TRIGGER_POSITIVERAMP /* Arm the trigger when samples fall (y increases) ie. negative slope */ rdytrigger = TRUE; #endif continue; } else { /* If the trigger is armed, Trigger when samples increases (y decreases) ie. positive slope */ gs->lasty = y; flsamples = 0; if (!rdytrigger) continue; } /* Ready for a the next trigger cycle */ rdytrigger = FALSE; #endif /* Prepare for a scope trace */ x = 0; pc = gs->lastscopetrace; } /* Clear the old scope pixel and then draw the new scope value */ gdispGDrawPixel(gh->display, gh->x+x, gh->y+pc[0], gh->bgcolor); gdispGDrawPixel(gh->display, gh->x+x, gh->y+y, gh->color); /* Save the value */ *pc++ = y; x++; #if TRIGGER_METHOD == TRIGGER_POSITIVERAMP || TRIGGER_METHOD == TRIGGER_MINVALUE gs->lasty = y; #endif } gs->nextx = x; #if TRIGGER_METHOD == TRIGGER_MINVALUE gs->scopemin = scopemin; #endif gfxBufferRelease(pd); #undef gs }
{ "content_hash": "6a8e8c18eec49699b6ab184f8e663919", "timestamp": "", "source": "github", "line_count": 172, "max_line_length": 115, "avg_line_length": 27.11627906976744, "alnum_prop": 0.6545883361921098, "repo_name": "sonicyang/uRock", "id": "1fb802a8b3cec0dc93beacb5fc9aa272752438ac", "size": "6330", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "Middlewares/ugfx/demos/modules/gadc/gwinosc.c", "mode": "33188", "license": "mit", "language": [ { "name": "Assembly", "bytes": "1075775" }, { "name": "C", "bytes": "36715278" }, { "name": "C++", "bytes": "837608" }, { "name": "CSS", "bytes": "6741" }, { "name": "HTML", "bytes": "913610" }, { "name": "Makefile", "bytes": "88563" }, { "name": "Objective-C", "bytes": "244299" }, { "name": "Shell", "bytes": "2400" } ], "symlink_target": "" }
@interface GeometryContentCollection : ChildCollection { } @end
{ "content_hash": "cf7cce0cca5bab7823774f43fc9bf072", "timestamp": "", "source": "github", "line_count": 5, "max_line_length": 56, "avg_line_length": 13.2, "alnum_prop": 0.7878787878787878, "repo_name": "paidgeek/glomero", "id": "428a4e2211b374ab9e244e700254321b36b92c0e", "size": "270", "binary": false, "copies": "5", "ref": "refs/heads/master", "path": "XNI/include/XNI/GeometryContentCollection.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C#", "bytes": "477021" }, { "name": "Objective-C", "bytes": "279680" }, { "name": "Objective-C++", "bytes": "30395" } ], "symlink_target": "" }
@interface MSSnapHelperMethods : NSObject { } + (void)_drawBorderBarsForHeightOfRect:(struct CGRect)arg1 zoom:(double)arg2; + (void)_drawArrowsForHeightOfRect:(struct CGRect)arg1 zoom:(double)arg2; + (void)_drawLabelWithAmount:(long long)arg1 forHeightOfRect:(struct CGRect)arg2 zoom:(double)arg3; + (void)drawHeightOfRectInRect:(struct CGRect)arg1 amount:(long long)arg2 borderbars:(BOOL)arg3 zoom:(double)arg4; + (void)_drawBorderBarsForWidthOfRect:(struct CGRect)arg1 zoom:(double)arg2; + (void)_drawArrowsForWidthOfRect:(struct CGRect)arg1 zoom:(double)arg2; + (void)_drawLabelWithAmount:(long long)arg1 forWidthOfRect:(struct CGRect)arg2 zoom:(double)arg3; + (void)drawWidthOfRectInRect:(struct CGRect)arg1 amount:(long long)arg2 borderbars:(BOOL)arg3 zoom:(double)arg4; + (void)drawHeightOfFrameBesidesFrame:(struct CGRect)arg1 zoom:(double)arg2 borderBars:(BOOL)arg3; + (void)drawWidthOfFrameAboveFrame:(struct CGRect)arg1 zoom:(double)arg2 borderBars:(BOOL)arg3; + (id)snapColor; @end
{ "content_hash": "ffc6f7dfde5b7aecfedb1c29d66951b8", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 114, "avg_line_length": 66.2, "alnum_prop": 0.798590130916415, "repo_name": "dameleon/sketch-layout-generator", "id": "00c4f4e0b5aaa879b8aafec68c69a8728c7bf89e", "size": "993", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "data/sketch_classes/MSSnapHelperMethods.h", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "2384" }, { "name": "Objective-C", "bytes": "1335374" } ], "symlink_target": "" }
namespace Microsoft.Azure.Batch.Protocol.Models { using System.Linq; /// <summary> /// Additional parameters for the Certificate_Delete operation. /// </summary> public partial class CertificateDeleteOptions { /// <summary> /// Initializes a new instance of the CertificateDeleteOptions class. /// </summary> public CertificateDeleteOptions() { } /// <summary> /// Initializes a new instance of the CertificateDeleteOptions class. /// </summary> /// <param name="timeout">The maximum time that the server can spend /// processing the request, in seconds. The default is 30 /// seconds.</param> /// <param name="clientRequestId">The caller-generated request /// identity, in the form of a GUID with no decoration such as curly /// braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.</param> /// <param name="returnClientRequestId">Whether the server should /// return the client-request-id identifier in the response.</param> /// <param name="ocpDate">The time the request was issued. If not /// specified, this header will be automatically populated with the /// current system clock time.</param> public CertificateDeleteOptions(int? timeout = default(int?), string clientRequestId = default(string), bool? returnClientRequestId = default(bool?), System.DateTime? ocpDate = default(System.DateTime?)) { Timeout = timeout; ClientRequestId = clientRequestId; ReturnClientRequestId = returnClientRequestId; OcpDate = ocpDate; } /// <summary> /// Gets or sets the maximum time that the server can spend processing /// the request, in seconds. The default is 30 seconds. /// </summary> [Newtonsoft.Json.JsonProperty(PropertyName = "")] public int? Timeout { get; set; } /// <summary> /// Gets or sets the caller-generated request identity, in the form of /// a GUID with no decoration such as curly braces, e.g. /// 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. /// </summary> [Newtonsoft.Json.JsonProperty(PropertyName = "")] public string ClientRequestId { get; set; } /// <summary> /// Gets or sets whether the server should return the /// client-request-id identifier in the response. /// </summary> [Newtonsoft.Json.JsonProperty(PropertyName = "")] public bool? ReturnClientRequestId { get; set; } /// <summary> /// Gets or sets the time the request was issued. If not specified, /// this header will be automatically populated with the current /// system clock time. /// </summary> [Newtonsoft.Json.JsonConverter(typeof(Microsoft.Rest.Serialization.DateTimeRfc1123JsonConverter))] [Newtonsoft.Json.JsonProperty(PropertyName = "")] public System.DateTime? OcpDate { get; set; } } }
{ "content_hash": "d68d313f4a0116d88949bb863af15f30", "timestamp": "", "source": "github", "line_count": 69, "max_line_length": 211, "avg_line_length": 44.072463768115945, "alnum_prop": 0.6310424202564946, "repo_name": "r22016/azure-sdk-for-net", "id": "7c259b269e8b5a87602068cbba350654bbaffb42", "size": "3818", "binary": false, "copies": "7", "ref": "refs/heads/AutoRest", "path": "src/Batch/Client/Src/GeneratedProtocol/Models/CertificateDeleteOptions.cs", "mode": "33188", "license": "mit", "language": [ { "name": "ASP", "bytes": "118" }, { "name": "Batchfile", "bytes": "26719" }, { "name": "C#", "bytes": "36976394" }, { "name": "CSS", "bytes": "685" }, { "name": "JavaScript", "bytes": "7875" }, { "name": "PowerShell", "bytes": "20441" }, { "name": "Shell", "bytes": "687" }, { "name": "XSLT", "bytes": "6114" } ], "symlink_target": "" }
#ifndef CTKTESTPLUGINA2ACTIVATOR_P_H #define CTKTESTPLUGINA2ACTIVATOR_P_H #include <QScopedPointer> #include <ctkPluginActivator.h> #include "ctkTestPluginA2_p.h" class ctkTestPluginA2Activator : public QObject, public ctkPluginActivator { Q_OBJECT Q_INTERFACES(ctkPluginActivator) public: void start(ctkPluginContext* context); void stop(ctkPluginContext* context); private: QScopedPointer<ctkTestPluginA2> s; }; #endif // CTKTESTPLUGINA2ACTIVATOR_P_H
{ "content_hash": "5a92df50847f8f25cc8dc0cd811ccbb7", "timestamp": "", "source": "github", "line_count": 29, "max_line_length": 57, "avg_line_length": 17.482758620689655, "alnum_prop": 0.73767258382643, "repo_name": "chenqifeng/CTK", "id": "4209d5f65217211031fdcca40c9d314f1d674e9c", "size": "1323", "binary": false, "copies": "6", "ref": "refs/heads/master", "path": "Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginA2_test/ctkTestPluginA2Activator_p.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "186450" }, { "name": "C++", "bytes": "6531745" }, { "name": "Objective-C", "bytes": "21393" }, { "name": "Python", "bytes": "4887" } ], "symlink_target": "" }
using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Net; using System.Net.Sockets; using System.Runtime.CompilerServices; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Xml.Schema; using JetBrains.Annotations; using ph4n.Common; namespace ph4n.Net { using System; using System.ComponentModel; /// <summary> /// Provides data for the asynchronous event handlers that have one result. /// </summary> /// <typeparam name="T">The type of the result of the asynchronous operation.</typeparam> public class AsyncResultEventArgs<T> : AsyncCompletedEventArgs { /// <summary> /// The result of the asynchronous operation. /// </summary> private T result; /// <summary> /// Initializes a new instance of the <see cref="AsyncResultEventArgs{T}"/> class. /// </summary> /// <param name="result">The result of the asynchronous operation.</param> /// <param name="error">Any error that occurred. Null if no error.</param> /// <param name="cancelled">Whether the operation was cancelled.</param> /// <param name="userState">The optional user-defined state object.</param> public AsyncResultEventArgs(T result, Exception error, bool cancelled, object userState) : base(error, cancelled, userState) { this.result = result; } /// <summary> /// Initializes a new instance of the <see cref="AsyncResultEventArgs{T}"/> class indicating a successful completion. /// </summary> /// <param name="result">The result of the asynchronous operation.</param> public AsyncResultEventArgs(T result) : this(result, null, false, null) { } /// <summary> /// Initializes a new instance of the <see cref="AsyncResultEventArgs{T}"/> class indicating an unsuccessful operation. /// </summary> /// <param name="error">The error that occurred.</param> public AsyncResultEventArgs(Exception error) : this(default(T), error, false, null) { } /// <summary> /// Gets the result of the asynchronous operation. This property may only be read if <see cref="AsyncCompletedEventArgs.Error"/> is null. /// </summary> public T Result { get { RaiseExceptionIfNecessary(); return this.result; } } } public static class SaeaFactory { [NotNull] public static SocketAsyncEventArgs CreateSaea([NotNull] EventHandler<SocketAsyncEventArgs> complete) { Validate.ArgumentNotNull(complete, "complete"); var args = new SocketAsyncEventArgs(); args.Completed += complete; return args; } } public abstract class AsyncSocket { internal abstract Socket UnderlyingSocket { get; } } public static class SocketOps { public static void Bind(this AsyncSocket asynsSocket, IPEndPoint bindTo) { asynsSocket.UnderlyingSocket.Bind(bindTo); } } internal class AsyncTcpSocket35 : AsyncSocket { private Socket _socket; private SocketAsyncEventArgs _sendArgs; private SocketAsyncEventArgs _receiveArgs; private SocketAsyncEventArgs _acceptArgs; public EventHandler<AsyncResultEventArgs<byte[]>> bytesArrived; public EventHandler<AsyncResultEventArgs<byte[]>> bytesSent; public EventHandler<AsyncResultEventArgs<AsyncSocket>> connectArrived; public EventHandler<AsyncCompletedEventArgs> shutdownComplete; internal override Socket UnderlyingSocket { get { return _socket; } } private AsyncTcpSocket35(Socket socket) { _socket = socket; InitAsyncArgs(); ContinueReceiving(); } public AsyncTcpSocket35(SocketInformation socketInformation) { _socket = new Socket(socketInformation); InitAsyncArgs(); } public AsyncTcpSocket35(AddressFamily addressFamily, SocketType socketType) { _socket = new Socket(addressFamily, socketType, ProtocolType.Tcp); InitAsyncArgs(); } private void InitAsyncArgs() { _acceptArgs = SaeaFactory.CreateSaea(SocketAcceptComplete); _sendArgs = SaeaFactory.CreateSaea(SocketSendComplete); _receiveArgs = SaeaFactory.CreateSaea(SocketReceiveComplete); } public void Connect(IPAddress address, int port) { Connect(new IPEndPoint(address, port)); } public void Connect(EndPoint remoteEP) { var a = SaeaFactory.CreateSaea(SocketConnectedComplete); a.RemoteEndPoint = remoteEP; if (!_socket.ConnectAsync(a)) { SocketConnectedComplete(this, a); } } private void ContinueReceiving() { if (!_socket.ReceiveAsync(_receiveArgs)) { SocketReceiveComplete(this, _receiveArgs); } } protected void SocketConnectedComplete(object sender, SocketAsyncEventArgs e) { } protected void SocketReceiveComplete(object sender, SocketAsyncEventArgs e) { } protected void SocketSendComplete(object sender, SocketAsyncEventArgs e) { } protected void SocketAcceptComplete(object sender, SocketAsyncEventArgs e) { } public void Send(byte[] bytes) { if (!_socket.SendAsync(_sendArgs)) { SocketSendComplete(this, _sendArgs); } } } }
{ "content_hash": "027a1cc07ed3df142f719ee441ca7908", "timestamp": "", "source": "github", "line_count": 191, "max_line_length": 145, "avg_line_length": 31.06282722513089, "alnum_prop": 0.6093038934771616, "repo_name": "buchmoyerm/Lib-ph4n", "id": "c3fe3c0e3c66ff9a4023d1b95cbed3fe123cbe54", "size": "5935", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/ph4n.Net/SocketAwaitable.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "98552" } ], "symlink_target": "" }
FROM resin/rpi-raspbian:jessie MAINTAINER schafmeister <[email protected]> # Setup base system ENV DEBIAN_FRONTEND noninteractive ENV TERM xterm RUN apt-get update && apt-get upgrade # Cups and Drivers for Samsung printers RUN apt-get install -y avahi-daemon cups printer-driver-splix whois && rm -rf /var/lib/apt/lists/* RUN echo Europe/Berlin > /etc/timezone && dpkg-reconfigure tzdata # Samba ports EXPOSE 631/tcp EXPOSE 5353/udp COPY cupsd.conf /etc/cups/cupsd.conf COPY cups-files.conf /etc/cups/cups-files.conf COPY snmp.conf /etc/cups/snmp.conf # patch avahi daemon setting that prevents running the daemon in multiple containers RUN sed -i "s/rlimit-nproc=3/#rlimit-nproc=3/" /etc/avahi/avahi-daemon.conf RUN sed -i -e'/AVAHI_DAEMON_DETECT_LOCAL/s/1/0/' /etc/default/avahi-daemon # copy start script COPY run_cups.sh ./ RUN chmod +x ./run_cups.sh CMD ["/run_cups.sh"]
{ "content_hash": "02ddfc6785ca45dff7e9117ceceb4e53", "timestamp": "", "source": "github", "line_count": 31, "max_line_length": 98, "avg_line_length": 28.548387096774192, "alnum_prop": 0.7593220338983051, "repo_name": "thecael/RaspberryDocker", "id": "627a137aec5902b4e38b556210711492e8eeed5a", "size": "885", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "cups/Dockerfile", "mode": "33188", "license": "mit", "language": [ { "name": "Shell", "bytes": "1399" } ], "symlink_target": "" }
import values from "lodash-es/values"; import { connect } from "react-redux"; import * as transactionActions from "actions/transaction"; import TransactionForm from "../components/TransactionForm"; export interface StateFromProps extends TransactionFormState { accounts: Account[]; } function mapStateToProps(state) { return { ...state.transactionForm, accounts: values(state.accounts), }; } function mapDispatchToProps(dispatch) { return { streamTarget(e) { dispatch(transactionActions.streamTarget(e)); }, streamTransactionType(e) { dispatch(transactionActions.streamTransactionType(e)); }, streamAmount(e) { dispatch(transactionActions.streamAmount(e)); }, transaction(target, transactionType, amount) { dispatch(transactionActions.transaction(target, transactionType, amount)); }, }; } export default connect( mapStateToProps, mapDispatchToProps, )(TransactionForm);
{ "content_hash": "2e442f02b66d7a58a4d66a40ce263aaf", "timestamp": "", "source": "github", "line_count": 39, "max_line_length": 86, "avg_line_length": 26.487179487179485, "alnum_prop": 0.6689254598257502, "repo_name": "contrarian/redux-tsa", "id": "b06e492edd851624113d4a70fb131961788bbf55", "size": "1033", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "examples/js/src/ui/containers/TransactionFormContainer.js", "mode": "33188", "license": "mit", "language": [ { "name": "TypeScript", "bytes": "65609" } ], "symlink_target": "" }
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace gView.DataSources.EventTable.UI.Properties { using System; /// <summary> /// A strongly-typed resource class, for looking up localized strings, etc. /// </summary> // This class was auto-generated by the StronglyTypedResourceBuilder // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } /// <summary> /// Returns the cached ResourceManager instance used by this class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("gView.DataSources.EventTable.UI.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } /// <summary> /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } /// <summary> /// Looks up a localized resource of type System.Drawing.Bitmap. /// </summary> internal static System.Drawing.Bitmap cat6 { get { object obj = ResourceManager.GetObject("cat6", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// <summary> /// Looks up a localized resource of type System.Drawing.Bitmap. /// </summary> internal static System.Drawing.Bitmap gps_point { get { object obj = ResourceManager.GetObject("gps_point", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// <summary> /// Looks up a localized resource of type System.Drawing.Bitmap. /// </summary> internal static System.Drawing.Bitmap table_base { get { object obj = ResourceManager.GetObject("table_base", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } } }
{ "content_hash": "9fc42eebe3dd53886c7321479f499d48", "timestamp": "", "source": "github", "line_count": 93, "max_line_length": 197, "avg_line_length": 42.225806451612904, "alnum_prop": 0.5887445887445888, "repo_name": "jugstalt/gViewGisOS", "id": "5c7547e4b4651ca092703bf7c79bbc6e024dc35f", "size": "3929", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "gView.DataSources.EventTable.UI/Properties/Resources.Designer.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "14359299" }, { "name": "CSS", "bytes": "934" }, { "name": "HTML", "bytes": "4270" }, { "name": "NSIS", "bytes": "30399" }, { "name": "Visual Basic", "bytes": "17387" }, { "name": "XSLT", "bytes": "13865" } ], "symlink_target": "" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_45) on Thu Nov 13 21:23:01 UTC 2014 --> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <TITLE> Uses of Class org.apache.hadoop.fs.http.server.HttpFSParametersProvider.BlockSizeParam (Apache Hadoop HttpFS 2.6.0 API) </TITLE> <META NAME="date" CONTENT="2014-11-13"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class org.apache.hadoop.fs.http.server.HttpFSParametersProvider.BlockSizeParam (Apache Hadoop HttpFS 2.6.0 API)"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../org/apache/hadoop/fs/http/server/HttpFSParametersProvider.BlockSizeParam.html" title="class in org.apache.hadoop.fs.http.server"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../../../index.html?org/apache/hadoop/fs/http/server//class-useHttpFSParametersProvider.BlockSizeParam.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="HttpFSParametersProvider.BlockSizeParam.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <CENTER> <H2> <B>Uses of Class<br>org.apache.hadoop.fs.http.server.HttpFSParametersProvider.BlockSizeParam</B></H2> </CENTER> No usage of org.apache.hadoop.fs.http.server.HttpFSParametersProvider.BlockSizeParam <P> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../org/apache/hadoop/fs/http/server/HttpFSParametersProvider.BlockSizeParam.html" title="class in org.apache.hadoop.fs.http.server"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../../../index.html?org/apache/hadoop/fs/http/server//class-useHttpFSParametersProvider.BlockSizeParam.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="HttpFSParametersProvider.BlockSizeParam.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> Copyright &#169; 2014 <a href="http://www.apache.org">Apache Software Foundation</a>. All Rights Reserved. </BODY> </HTML>
{ "content_hash": "279fa95e38b8bd4e1885d21edbc391a6", "timestamp": "", "source": "github", "line_count": 145, "max_line_length": 267, "avg_line_length": 45.42068965517242, "alnum_prop": 0.6246583662313999, "repo_name": "SAT-Hadoop/hadoop-2.6.0", "id": "e85b0fc165bb769996f374d62f00ee34b8231171", "size": "6586", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "share/doc/hadoop/hadoop-hdfs-httpfs/apidocs/org/apache/hadoop/fs/http/server/class-use/HttpFSParametersProvider.BlockSizeParam.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "119024" }, { "name": "C", "bytes": "29572" }, { "name": "C++", "bytes": "16604" }, { "name": "CSS", "bytes": "452213" }, { "name": "HTML", "bytes": "72854691" }, { "name": "JavaScript", "bytes": "18210" }, { "name": "Shell", "bytes": "203634" }, { "name": "XSLT", "bytes": "20437" } ], "symlink_target": "" }
def max_profit(a) return 0 unless a.any? max_profit = 0 lowest_price = a.first a.each do |price| lowest_price = [lowest_price, price].min max_profit = [max_profit, price - lowest_price].max end max_profit end
{ "content_hash": "acd951bc1d465480083ffa5b65097845", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 55, "avg_line_length": 17.846153846153847, "alnum_prop": 0.6508620689655172, "repo_name": "UltimateCoder00/Codility-Challenges", "id": "7d5cbaf09c698a3daacf9850ce254443b0a00cb2", "size": "232", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/Lesson 9 Maximum Slice Problem/MaxProfit/max_profit.rb", "mode": "33188", "license": "mit", "language": [ { "name": "Ruby", "bytes": "248618" } ], "symlink_target": "" }
<?xml version="1.0" encoding="utf-8"?> <resources> <declare-styleable name="ElasticFrameLayout"> <attr name="dragDismissDistance" format="dimension" /> <attr name="dragDismissFraction" format="float" /> <attr name="dragDismissScale" format="float" /> <attr name="dragElasticity" format="float" /> </declare-styleable> <declare-styleable name="CircleImageView"> <attr name="borderColor" format="color"/> <attr name="borderWidth" format="dimension"/> <attr name="fillColor" format="color"/> <attr name="borderOverlay" format="boolean"/> </declare-styleable> <declare-styleable name="EmptyStateRecyclerView"> <attr name="emptyStateIcon" format="dimension"/> <attr name="emptyStateText" format="string"/> <attr name="emptyStateAuto" format="boolean"/> </declare-styleable> </resources>
{ "content_hash": "d487c71a7d1ee47e56cc683afad6f781", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 62, "avg_line_length": 40.68181818181818, "alnum_prop": 0.6536312849162011, "repo_name": "tylersuehr7/clean-architecture", "id": "0b342ad6926dbbea822a0c5cd100a4d06cfb7c7a", "size": "895", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/src/main/res/values/attrs.xml", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "94216" } ], "symlink_target": "" }
using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq.Expressions; namespace CefSharp.MinimalExample.Wpf.Mvvm { public static class PropertyChangedExtensionMethods { // Based on http://www.wpftutorial.net/INotifyPropertyChanged.html public static bool ChangeAndNotify<T>(this PropertyChangedEventHandler handler, ref T field, T value, Expression<Func<T>> memberExpression) { if (memberExpression == null) { throw new ArgumentNullException("memberExpression"); } var body = memberExpression.Body as MemberExpression; if (body == null) { throw new ArgumentException("Lambda must return a property."); } if (EqualityComparer<T>.Default.Equals(field, value)) { return false; } field = value; var vmExpression = body.Expression as ConstantExpression; if (vmExpression != null) { var lambda = Expression.Lambda(vmExpression); var vmFunc = lambda.Compile(); var sender = vmFunc.DynamicInvoke(); if (handler != null) { handler(sender, new PropertyChangedEventArgs(body.Member.Name)); } } return true; } } }
{ "content_hash": "5b93380542d5daf67962df98bbb4c504", "timestamp": "", "source": "github", "line_count": 48, "max_line_length": 87, "avg_line_length": 30.4375, "alnum_prop": 0.5564681724845996, "repo_name": "Briaker/CefSharp.MinimalExample", "id": "5a3285cc9abca4ef3c1881b73cd10d002c089979", "size": "1463", "binary": false, "copies": "7", "ref": "refs/heads/master", "path": "CefSharp.MinimalExample.Wpf/Mvvm/PropertyChangedExtensionMethods.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "17201" } ], "symlink_target": "" }
package com.netflix.spinnaker.orca.pipeline.util; import com.google.common.io.CharStreams; import com.google.common.util.concurrent.Uninterruptibles; import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; import java.util.Arrays; import java.util.List; import java.util.concurrent.TimeUnit; import org.apache.http.HttpHost; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.client.ServiceUnavailableRetryStrategy; import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.impl.client.HttpClients; import org.apache.http.protocol.HttpContext; import org.apache.http.protocol.HttpCoreContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class HttpClientUtils { private static final Logger LOGGER = LoggerFactory.getLogger(HttpClientUtils.class); private static final int MAX_RETRIES = 5; private static final int RETRY_INTERVAL = 5000; private static final int TIMEOUT_MILLIS = 30000; private static final String JVM_HTTP_PROXY_HOST = "http.proxyHost"; private static final String JVM_HTTP_PROXY_PORT = "http.proxyPort"; private static List<Integer> RETRYABLE_500_HTTP_STATUS_CODES = Arrays.asList( HttpStatus.SC_SERVICE_UNAVAILABLE, HttpStatus.SC_INTERNAL_SERVER_ERROR, HttpStatus.SC_GATEWAY_TIMEOUT); private static CloseableHttpClient httpClient = httpClientWithServiceUnavailableRetryStrategy(); private static CloseableHttpClient httpClientWithServiceUnavailableRetryStrategy() { HttpClientBuilder httpClientBuilder = HttpClients.custom() .setServiceUnavailableRetryStrategy( new ServiceUnavailableRetryStrategy() { @Override public boolean retryRequest( HttpResponse response, int executionCount, HttpContext context) { int statusCode = response.getStatusLine().getStatusCode(); HttpUriRequest currentReq = (HttpUriRequest) context.getAttribute(HttpCoreContext.HTTP_REQUEST); LOGGER.info("Response code {} for {}", statusCode, currentReq.getURI()); if (statusCode >= HttpStatus.SC_OK && statusCode <= 299) { return false; } boolean shouldRetry = (statusCode == 429 || RETRYABLE_500_HTTP_STATUS_CODES.contains(statusCode)) && executionCount <= MAX_RETRIES; if ((statusCode >= 300) && (statusCode <= 399)) { throw new RetryRequestException( String.format( "Attempted redirect from %s to %s which is not supported", currentReq.getURI(), response.getFirstHeader("LOCATION").getValue())); } if (!shouldRetry) { throw new RetryRequestException( String.format( "Not retrying %s. Count %d, Max %d", currentReq.getURI(), executionCount, MAX_RETRIES)); } LOGGER.error( "Retrying request on response status {}. Count {} Max is {}", statusCode, executionCount, MAX_RETRIES); return true; } @Override public long getRetryInterval() { return RETRY_INTERVAL; } }); httpClientBuilder.setRetryHandler( (exception, executionCount, context) -> { HttpUriRequest currentReq = (HttpUriRequest) context.getAttribute(HttpCoreContext.HTTP_REQUEST); Uninterruptibles.sleepUninterruptibly(RETRY_INTERVAL, TimeUnit.MILLISECONDS); LOGGER.info( "Encountered network error. Retrying request {}, Count {} Max is {}", currentReq.getURI(), executionCount, MAX_RETRIES); return executionCount <= MAX_RETRIES; }); String proxyHostname = System.getProperty(JVM_HTTP_PROXY_HOST); if (proxyHostname != null) { int proxyPort = System.getProperty(JVM_HTTP_PROXY_PORT) != null ? Integer.parseInt(System.getProperty(JVM_HTTP_PROXY_PORT)) : 8080; LOGGER.info( "Found system properties for proxy configuration. Setting up http client to use proxy with " + "hostname {} and port {}", proxyHostname, proxyPort); httpClientBuilder.setProxy(new HttpHost(proxyHostname, proxyPort, "http")); } httpClientBuilder.setDefaultRequestConfig( RequestConfig.custom() .setConnectionRequestTimeout(TIMEOUT_MILLIS) .setConnectTimeout(TIMEOUT_MILLIS) .setSocketTimeout(TIMEOUT_MILLIS) .build()); return httpClientBuilder.build(); } public static String httpGetAsString(String url) throws IOException { try (CloseableHttpResponse response = httpClient.execute(new HttpGet(url))) { try (final Reader reader = new InputStreamReader(response.getEntity().getContent())) { return CharStreams.toString(reader); } } } static class RetryRequestException extends RuntimeException { RetryRequestException(String cause) { super(cause); } } }
{ "content_hash": "0264bc8b2a71d8f80e3fb16c68507432", "timestamp": "", "source": "github", "line_count": 142, "max_line_length": 102, "avg_line_length": 41.140845070422536, "alnum_prop": 0.62564190345772, "repo_name": "duftler/orca", "id": "af1326c485b18071848b8f456b2b511d1508c4ea", "size": "6436", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "orca-core/src/main/java/com/netflix/spinnaker/orca/pipeline/util/HttpClientUtils.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Groovy", "bytes": "2888930" }, { "name": "HTML", "bytes": "257" }, { "name": "Java", "bytes": "1839730" }, { "name": "Kotlin", "bytes": "978079" }, { "name": "Shell", "bytes": "2672" }, { "name": "TSQL", "bytes": "388" } ], "symlink_target": "" }
return function (tableA, tableB) local minTable = {} for ind, valA in pairs(tableA) do if tableB[ind] then minTable[ind] = valA < tableB[ind] and valA or tableB[ind] else error("tables did not have matching indices") return end end return minTable end
{ "content_hash": "0fa234011d9eb5c14f9ad1c3e8778bc0", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 61, "avg_line_length": 22.5, "alnum_prop": 0.7037037037037037, "repo_name": "Roblox/Core-Scripts", "id": "19e60945aba5c0a9be3315c19f5e14b35f0f485a", "size": "270", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "CoreScriptsRoot/Modules/DevConsole/Util/minOfTable.lua", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Lua", "bytes": "3031939" } ], "symlink_target": "" }
@interface Animal : NSObject { NSString *_name; int _age; } -(void)eat; -(instancetype)initWith:(NSString *)name andAge:(int)age; @end
{ "content_hash": "cdfa170809f8c9c299f17be12798c7a2", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 57, "avg_line_length": 14.9, "alnum_prop": 0.6375838926174496, "repo_name": "MinghuiGao/C-", "id": "2e750640fbe80ed8023489e2e625a1b1410fcb9f", "size": "310", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ocday04/子类中使用super/Animal.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "244971" }, { "name": "C++", "bytes": "37334" }, { "name": "CMake", "bytes": "14537" }, { "name": "Makefile", "bytes": "35521" }, { "name": "Objective-C", "bytes": "274502" } ], "symlink_target": "" }
// -*- C++ -*- //============================================================================= /** * @file OS_NS_unistd.h * * $Id: OS_NS_unistd.h 78509 2007-05-28 19:36:42Z johnnyw $ * * @author Douglas C. Schmidt <[email protected]> * @author Jesper S. M|ller<[email protected]> * @author and a cast of thousands... * * Originally in OS.h. */ //============================================================================= #ifndef ACE_OS_NS_UNISTD_H # define ACE_OS_NS_UNISTD_H # include /**/ "ace/pre.h" # include "ace/config-all.h" # if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once # endif /* ACE_LACKS_PRAGMA_ONCE */ #include /**/ "ace/ACE_export.h" #include "ace/Time_Value.h" #include "ace/Basic_Types.h" #include "ace/os_include/os_unistd.h" #include "ace/os_include/os_stdio.h" #if defined (ACE_EXPORT_MACRO) # undef ACE_EXPORT_MACRO #endif #define ACE_EXPORT_MACRO ACE_Export // This should go in os_unistd.h, but since we don't yet implement any code // at that level, we put it here. It used to be in OS.i. #if defined (ACE_NEEDS_FTRUNCATE) extern "C" ACE_Export int ftruncate (ACE_HANDLE handle, long len); #endif /* ACE_NEEDS_FTRUNCATE */ ACE_BEGIN_VERSIONED_NAMESPACE_DECL namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION int access (const char *path, int amode); #if defined (ACE_HAS_WCHAR) ACE_NAMESPACE_INLINE_FUNCTION int access (const wchar_t *path, int amode); #endif /* ACE_HAS_WCHAR */ ACE_NAMESPACE_INLINE_FUNCTION unsigned int alarm (u_int secs); ACE_NAMESPACE_INLINE_FUNCTION long allocation_granularity (void); // used by ARGV::argv_to_string() and ACE_OS::fork_exec() extern ACE_Export int argv_to_string (ACE_TCHAR **argv, ACE_TCHAR *&buf, bool substitute_env_args = true, bool quote_args = false); #if !defined (ACE_LACKS_CHDIR) ACE_NAMESPACE_INLINE_FUNCTION int chdir (const char *path); #if defined (ACE_HAS_WCHAR) ACE_NAMESPACE_INLINE_FUNCTION int chdir (const wchar_t *path); #endif /* ACE_HAS_WCHAR */ #endif /* ACE_LACKS_CHDIR */ ACE_NAMESPACE_INLINE_FUNCTION int rmdir (const char *path); #if defined (ACE_HAS_WCHAR) ACE_NAMESPACE_INLINE_FUNCTION int rmdir (const wchar_t *path); #endif /* ACE_HAS_WCHAR */ ACE_NAMESPACE_INLINE_FUNCTION int close (ACE_HANDLE handle); ACE_NAMESPACE_INLINE_FUNCTION ACE_HANDLE dup (ACE_HANDLE handle); ACE_NAMESPACE_INLINE_FUNCTION int dup2 (ACE_HANDLE oldfd, ACE_HANDLE newfd); extern ACE_Export int execl (const char *path, const char *arg0, ...); extern ACE_Export int execle (const char *path, const char *arg0, ...); extern ACE_Export int execlp (const char *file, const char *arg0, ...); ACE_NAMESPACE_INLINE_FUNCTION int execv (const char *path, char *const argv[]); ACE_NAMESPACE_INLINE_FUNCTION int execve (const char *path, char *const argv[], char *const envp[]); ACE_NAMESPACE_INLINE_FUNCTION int execvp (const char *file, char *const argv[]); //@{ /// Forks and exec's a process in a manner that works on Solaris and /// NT. argv[0] must be the full path name to the executable. ACE_NAMESPACE_INLINE_FUNCTION pid_t fork (void); // not in susv3 extern ACE_Export pid_t fork (const ACE_TCHAR *program_name); extern ACE_Export pid_t fork_exec (ACE_TCHAR *argv[]); //@} ACE_NAMESPACE_INLINE_FUNCTION int fsync (ACE_HANDLE handle); ACE_NAMESPACE_INLINE_FUNCTION int ftruncate (ACE_HANDLE handle, ACE_OFF_T offset); ACE_NAMESPACE_INLINE_FUNCTION char *getcwd (char *, size_t); #if defined (ACE_HAS_WCHAR) ACE_NAMESPACE_INLINE_FUNCTION wchar_t *getcwd (wchar_t *, size_t); #endif /* ACE_HAS_WCHAR */ ACE_NAMESPACE_INLINE_FUNCTION gid_t getgid (void); ACE_NAMESPACE_INLINE_FUNCTION gid_t getegid (void); ACE_NAMESPACE_INLINE_FUNCTION int getopt (int argc, char *const *argv, const char *optstring); ACE_NAMESPACE_INLINE_FUNCTION long getpagesize (void); ACE_NAMESPACE_INLINE_FUNCTION pid_t getpgid (pid_t pid); ACE_NAMESPACE_INLINE_FUNCTION pid_t getpid (void); ACE_NAMESPACE_INLINE_FUNCTION pid_t getppid (void); ACE_NAMESPACE_INLINE_FUNCTION uid_t getuid (void); ACE_NAMESPACE_INLINE_FUNCTION uid_t geteuid (void); // should call gethostname() ACE_NAMESPACE_INLINE_FUNCTION int hostname (char *name, size_t maxnamelen); #if defined (ACE_HAS_WCHAR) ACE_NAMESPACE_INLINE_FUNCTION int hostname (wchar_t *name, size_t maxnamelen); #endif /* ACE_HAS_WCHAR */ ACE_NAMESPACE_INLINE_FUNCTION int isatty (int handle); #if defined (ACE_WIN32) ACE_NAMESPACE_INLINE_FUNCTION int isatty (ACE_HANDLE handle); #endif /* ACE_WIN32 */ ACE_NAMESPACE_INLINE_FUNCTION ACE_OFF_T lseek (ACE_HANDLE handle, ACE_OFF_T offset, int whence); #if defined (ACE_HAS_LLSEEK) || defined (ACE_HAS_LSEEK64) ACE_NAMESPACE_INLINE_FUNCTION ACE_LOFF_T llseek (ACE_HANDLE handle, ACE_LOFF_T offset, int whence); #endif /* ACE_HAS_LLSEEK */ /// Get the number of CPUs configured in the machine. extern ACE_Export long num_processors (void); /// Get the number of CPUs currently online. extern ACE_Export long num_processors_online (void); ACE_NAMESPACE_INLINE_FUNCTION int pipe (ACE_HANDLE handles[]); extern ACE_Export ssize_t pread (ACE_HANDLE handle, void *buf, size_t nbyte, ACE_OFF_T offset); extern ACE_Export ssize_t pwrite (ACE_HANDLE handle, const void *buf, size_t nbyte, ACE_OFF_T offset); ACE_NAMESPACE_INLINE_FUNCTION ssize_t read (ACE_HANDLE handle, void *buf, size_t len); ACE_NAMESPACE_INLINE_FUNCTION ssize_t read (ACE_HANDLE handle, void *buf, size_t len, ACE_OVERLAPPED *); /** * Receive @a len bytes into @a buf from <handle> (uses the * <ACE_OS::read> call, which uses the <read> system call on UNIX * and the <ReadFile> call on Win32). If errors occur, -1 is * returned. If EOF occurs, 0 is returned. Whatever data has been * read will be returned to the caller through<bytes_transferred>. * */ extern ACE_Export ssize_t read_n (ACE_HANDLE handle, void *buf, size_t len, size_t *bytes_transferred = 0); ACE_NAMESPACE_INLINE_FUNCTION ssize_t readlink (const char *path, char *buf, size_t bufsiz); ACE_NAMESPACE_INLINE_FUNCTION void *sbrk (intptr_t brk); ACE_NAMESPACE_INLINE_FUNCTION int setgid (gid_t); ACE_NAMESPACE_INLINE_FUNCTION int setegid (gid_t); ACE_NAMESPACE_INLINE_FUNCTION int setpgid (pid_t pid, pid_t pgid); ACE_NAMESPACE_INLINE_FUNCTION int setregid (gid_t rgid, gid_t egid); ACE_NAMESPACE_INLINE_FUNCTION int setreuid (uid_t ruid, uid_t euid); ACE_NAMESPACE_INLINE_FUNCTION pid_t setsid (void); ACE_NAMESPACE_INLINE_FUNCTION int setuid (uid_t); ACE_NAMESPACE_INLINE_FUNCTION int seteuid (uid_t); ACE_NAMESPACE_INLINE_FUNCTION int sleep (u_int seconds); ACE_NAMESPACE_INLINE_FUNCTION int sleep (const ACE_Time_Value &tv); // used by ARGV::string_to_argv extern ACE_Export int string_to_argv (ACE_TCHAR *buf, int &argc, ACE_TCHAR **&argv, bool substitute_env_args = true); ACE_NAMESPACE_INLINE_FUNCTION void swab (const void *src, void *dest, ssize_t n); ACE_NAMESPACE_INLINE_FUNCTION long sysconf (int); // not in susv3 ACE_NAMESPACE_INLINE_FUNCTION long sysinfo (int cmd, char *buf, long count); ACE_NAMESPACE_INLINE_FUNCTION int truncate (const ACE_TCHAR *filename, ACE_OFF_T length); ACE_NAMESPACE_INLINE_FUNCTION useconds_t ualarm (useconds_t usecs, useconds_t interval = 0); ACE_NAMESPACE_INLINE_FUNCTION useconds_t ualarm (const ACE_Time_Value &tv, const ACE_Time_Value &tv_interval = ACE_Time_Value::zero); ACE_NAMESPACE_INLINE_FUNCTION int unlink (const char *path); #if defined (ACE_HAS_WCHAR) ACE_NAMESPACE_INLINE_FUNCTION int unlink (const wchar_t *path); #endif /* ACE_HAS_WCHAR */ ACE_NAMESPACE_INLINE_FUNCTION ssize_t write (ACE_HANDLE handle, const void *buf, size_t nbyte); ACE_NAMESPACE_INLINE_FUNCTION ssize_t write (ACE_HANDLE handle, const void *buf, size_t nbyte, ACE_OVERLAPPED *); /** * Send @a len bytes from @a buf to <handle> (uses the <ACE_OS::write> * calls, which is uses the <write> system call on UNIX and the * <WriteFile> call on Win32). If errors occur, -1 is returned. If * EOF occurs, 0 is returned. Whatever data has been transmitted * will be returned to the caller through <bytes_transferred>. */ extern ACE_Export ssize_t write_n (ACE_HANDLE handle, const void *buf, size_t len, size_t *bytes_transferred = 0); } /* namespace ACE_OS */ ACE_END_VERSIONED_NAMESPACE_DECL # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE # endif /* ACE_INLINE */ # define ACE_INLINE inline # include "ace/OS_NS_unistd.inl" # endif /* ACE_HAS_INLINED_OSCALLS */ # include /**/ "ace/post.h" #endif /* ACE_OS_NS_UNISTD_H */
{ "content_hash": "65cd8749ecc0f216b50f89c71ec1e378", "timestamp": "", "source": "github", "line_count": 375, "max_line_length": 79, "avg_line_length": 26.88, "alnum_prop": 0.5996031746031746, "repo_name": "yuanxu/liveshow_r2", "id": "f9130cf6760bdd5e23d0fdb3d1afc76d312451e5", "size": "10080", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "P2pNet/ace/OS_NS_unistd.h", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "1037" }, { "name": "C", "bytes": "51778" }, { "name": "C#", "bytes": "166129" }, { "name": "C++", "bytes": "10074836" }, { "name": "HTML", "bytes": "20728" }, { "name": "Makefile", "bytes": "38717" }, { "name": "NSIS", "bytes": "10048" }, { "name": "Pascal", "bytes": "1921" }, { "name": "Yacc", "bytes": "10810" } ], "symlink_target": "" }
A general Computer Science blog. My fun thoughts on coding problems, ideas and projects.
{ "content_hash": "2251fedef9d11b7e60fadca1f5615a49", "timestamp": "", "source": "github", "line_count": 1, "max_line_length": 88, "avg_line_length": 89, "alnum_prop": 0.8089887640449438, "repo_name": "jootse84/jootse84.github.io", "id": "dcab40119baac898adf004cec21545400471e4f0", "size": "104", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "11152" }, { "name": "HTML", "bytes": "325911" }, { "name": "JavaScript", "bytes": "3558" }, { "name": "Ruby", "bytes": "3163" } ], "symlink_target": "" }
using System; using GopherServer.Core.Rss.Data; namespace GopherServer.Core.Rss.Syndication { public static class Syndication { public static void UpdateFeeds(Db db) { foreach (var feed in db.GetFeeds()) { try { var detail = FeedDetails.FromUrl(feed.Url); db.UpdateFeed(feed.Id, detail); } catch (Exception) { // ahh logging where are you! } } } public static void UpdateFeed(Db db, int feedId) { var feed = db.GetFeed(feedId); var detail = FeedDetails.FromUrl(feed.Url); db.UpdateFeed(feed.Id, detail); } public static bool TestValidFeed(string url) { try { var detail = FeedDetails.FromUrl(url); return true; } catch (Exception) { return false; } } } }
{ "content_hash": "e67c1adeec05fb4a91a7ce11d8827aa2", "timestamp": "", "source": "github", "line_count": 44, "max_line_length": 63, "avg_line_length": 25.045454545454547, "alnum_prop": 0.43920145190562615, "repo_name": "pgodwin/GopherServer", "id": "056e4b48e4073c055713ac8246193538da396d31", "size": "1104", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "GopherServer.Providers.Rss/Syndication/Syndication.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "97586" } ], "symlink_target": "" }
using System; using System.ComponentModel; using System.Data.Linq; using System.Data.Linq.Mapping; namespace derpirc.Data.Models { [global::System.Data.Linq.Mapping.TableAttribute()] public partial class Mention : IBaseModel, IMessage, INotifyPropertyChanging, INotifyPropertyChanged { [Column(IsVersion = true)] private Binary _Version; private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty); private int _Id; private int _NetworkId; private string _Name; private string _ChannelName; private EntitySet<MentionItem> _Messages; private EntityRef<Network> _Network; #region Extensibility Method Definitions partial void OnLoaded(); partial void OnValidate(System.Data.Linq.ChangeAction action); partial void OnCreated(); partial void OnIdChanging(int value); partial void OnIdChanged(); partial void OnNetworkIdChanging(int value); partial void OnNetworkIdChanged(); partial void OnNameChanging(string value); partial void OnNameChanged(); partial void OnChannelNameChanging(string value); partial void OnChannelNameChanged(); partial void OnIsConnectedChanging(bool value); partial void OnIsConnectedChanged(); #endregion public Mention() { this._Messages = new EntitySet<MentionItem>(new Action<MentionItem>(this.attach_MentionItems), new Action<MentionItem>(this.detach_MentionItems)); this._Network = default(EntityRef<Network>); OnCreated(); } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_Id", AutoSync = AutoSync.OnInsert, DbType = "Int NOT NULL IDENTITY", IsPrimaryKey = true, IsDbGenerated = true)] public int Id { get { return this._Id; } set { if ((this._Id != value)) { this.OnIdChanging(value); this.SendPropertyChanging(); this._Id = value; this.SendPropertyChanged("Id"); this.OnIdChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_NetworkId", DbType = "Int NOT NULL")] public int NetworkId { get { return this._NetworkId; } set { if ((this._NetworkId != value)) { if (this._Network.HasLoadedOrAssignedValue) { throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); } this.OnNetworkIdChanging(value); this.SendPropertyChanging(); this._NetworkId = value; this.SendPropertyChanged("NetworkId"); this.OnNetworkIdChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_Name", DbType = "NVarChar(64) NOT NULL", CanBeNull = false)] public string Name { get { return this._Name; } set { if ((this._Name != value.ToLower())) { this.OnNameChanging(value.ToLower()); this.SendPropertyChanging(); this._Name = value.ToLower(); this.SendPropertyChanged("Name"); this.OnNameChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_ChannelName", DbType = "NVarChar(64) NOT NULL", CanBeNull = false)] public string ChannelName { get { return this._ChannelName; } set { if ((this._ChannelName != value.ToLower())) { this.OnChannelNameChanging(value.ToLower()); this.SendPropertyChanging(); this._ChannelName = value.ToLower(); this.SendPropertyChanged("ChannelName"); this.OnChannelNameChanged(); } } } [global::System.Data.Linq.Mapping.AssociationAttribute(Name = "FK_Mention_MentionItem", Storage = "_Messages", ThisKey = "Id", OtherKey = "SummaryId", DeleteRule = "CASCADE")] public EntitySet<MentionItem> Messages { get { return this._Messages; } set { this._Messages.Assign(value); } } [global::System.Data.Linq.Mapping.AssociationAttribute(Name = "FK_Network_Mention", Storage = "_Network", ThisKey = "NetworkId", OtherKey = "Id", IsForeignKey = true)] public Network Network { get { return this._Network.Entity; } set { Network previousValue = this._Network.Entity; if (((previousValue != value) || (this._Network.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); if ((previousValue != null)) { this._Network.Entity = null; previousValue.Mentions.Remove(this); } this._Network.Entity = value; if ((value != null)) { value.Mentions.Add(this); this._NetworkId = value.Id; } else { this._NetworkId = default(int); } this.SendPropertyChanged("Network"); } } } public event PropertyChangingEventHandler PropertyChanging; public event PropertyChangedEventHandler PropertyChanged; protected virtual void SendPropertyChanging() { if ((this.PropertyChanging != null)) { this.PropertyChanging(this, emptyChangingEventArgs); } } protected virtual void SendPropertyChanged(String propertyName) { if ((this.PropertyChanged != null)) { this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } private void attach_MentionItems(MentionItem entity) { this.SendPropertyChanging(); entity.Summary = this; } private void detach_MentionItems(MentionItem entity) { this.SendPropertyChanging(); entity.Summary = null; } } }
{ "content_hash": "33f725d25bd6f380e643023f2db09213", "timestamp": "", "source": "github", "line_count": 215, "max_line_length": 183, "avg_line_length": 34.14418604651163, "alnum_prop": 0.49203105843890477, "repo_name": "w0rd-driven/derpirc", "id": "e42e6eac8d8132a7491b0eb4d67136c2c3c6ac63", "size": "7744", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "source/derpirc.WP7.Data/Models/Mention.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "509202" }, { "name": "Shell", "bytes": "95" } ], "symlink_target": "" }
#include "common.h" #if defined(MBEDTLS_SELF_TEST) && defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" #else #include <stdio.h> #define mbedtls_printf printf #endif #if defined(MBEDTLS_TIMING_C) #include "mbedtls/timing.h" #if !defined(MBEDTLS_TIMING_ALT) #if !defined(unix) && !defined(__unix__) && !defined(__unix) && \ !defined(__APPLE__) && !defined(_WIN32) && !defined(__QNXNTO__) && \ !defined(__HAIKU__) && !defined(__midipix__) #error "This module only works on Unix and Windows, see MBEDTLS_TIMING_C in config.h" #endif #ifndef asm #define asm __asm #endif #if defined(_WIN32) && !defined(EFIX64) && !defined(EFI32) #include <windows.h> #include <process.h> struct _hr_time { LARGE_INTEGER start; }; #else #include <unistd.h> #include <sys/types.h> #include <signal.h> /* time.h should be included independently of MBEDTLS_HAVE_TIME. If the * platform matches the ifdefs above, it will be used. */ #include <time.h> #include <sys/time.h> struct _hr_time { struct timeval start; }; #endif /* _WIN32 && !EFIX64 && !EFI32 */ #if !defined(HAVE_HARDCLOCK) && defined(MBEDTLS_HAVE_ASM) && \ ( defined(_MSC_VER) && defined(_M_IX86) ) || defined(__WATCOMC__) #define HAVE_HARDCLOCK unsigned long mbedtls_timing_hardclock( void ) { unsigned long tsc; __asm rdtsc __asm mov [tsc], eax return( tsc ); } #endif /* !HAVE_HARDCLOCK && MBEDTLS_HAVE_ASM && ( _MSC_VER && _M_IX86 ) || __WATCOMC__ */ /* some versions of mingw-64 have 32-bit longs even on x84_64 */ #if !defined(HAVE_HARDCLOCK) && defined(MBEDTLS_HAVE_ASM) && \ defined(__GNUC__) && ( defined(__i386__) || ( \ ( defined(__amd64__) || defined( __x86_64__) ) && __SIZEOF_LONG__ == 4 ) ) #define HAVE_HARDCLOCK unsigned long mbedtls_timing_hardclock( void ) { unsigned long lo, hi; asm volatile( "rdtsc" : "=a" (lo), "=d" (hi) ); return( lo ); } #endif /* !HAVE_HARDCLOCK && MBEDTLS_HAVE_ASM && __GNUC__ && __i386__ */ #if !defined(HAVE_HARDCLOCK) && defined(MBEDTLS_HAVE_ASM) && \ defined(__GNUC__) && ( defined(__amd64__) || defined(__x86_64__) ) #define HAVE_HARDCLOCK unsigned long mbedtls_timing_hardclock( void ) { unsigned long lo, hi; asm volatile( "rdtsc" : "=a" (lo), "=d" (hi) ); return( lo | ( hi << 32 ) ); } #endif /* !HAVE_HARDCLOCK && MBEDTLS_HAVE_ASM && __GNUC__ && ( __amd64__ || __x86_64__ ) */ #if !defined(HAVE_HARDCLOCK) && defined(MBEDTLS_HAVE_ASM) && \ defined(__GNUC__) && ( defined(__powerpc__) || defined(__ppc__) ) #define HAVE_HARDCLOCK unsigned long mbedtls_timing_hardclock( void ) { unsigned long tbl, tbu0, tbu1; do { asm volatile( "mftbu %0" : "=r" (tbu0) ); asm volatile( "mftb %0" : "=r" (tbl ) ); asm volatile( "mftbu %0" : "=r" (tbu1) ); } while( tbu0 != tbu1 ); return( tbl ); } #endif /* !HAVE_HARDCLOCK && MBEDTLS_HAVE_ASM && __GNUC__ && ( __powerpc__ || __ppc__ ) */ #if !defined(HAVE_HARDCLOCK) && defined(MBEDTLS_HAVE_ASM) && \ defined(__GNUC__) && defined(__sparc64__) #if defined(__OpenBSD__) #warning OpenBSD does not allow access to tick register using software version instead #else #define HAVE_HARDCLOCK unsigned long mbedtls_timing_hardclock( void ) { unsigned long tick; asm volatile( "rdpr %%tick, %0;" : "=&r" (tick) ); return( tick ); } #endif /* __OpenBSD__ */ #endif /* !HAVE_HARDCLOCK && MBEDTLS_HAVE_ASM && __GNUC__ && __sparc64__ */ #if !defined(HAVE_HARDCLOCK) && defined(MBEDTLS_HAVE_ASM) && \ defined(__GNUC__) && defined(__sparc__) && !defined(__sparc64__) #define HAVE_HARDCLOCK unsigned long mbedtls_timing_hardclock( void ) { unsigned long tick; asm volatile( ".byte 0x83, 0x41, 0x00, 0x00" ); asm volatile( "mov %%g1, %0" : "=r" (tick) ); return( tick ); } #endif /* !HAVE_HARDCLOCK && MBEDTLS_HAVE_ASM && __GNUC__ && __sparc__ && !__sparc64__ */ #if !defined(HAVE_HARDCLOCK) && defined(MBEDTLS_HAVE_ASM) && \ defined(__GNUC__) && defined(__alpha__) #define HAVE_HARDCLOCK unsigned long mbedtls_timing_hardclock( void ) { unsigned long cc; asm volatile( "rpcc %0" : "=r" (cc) ); return( cc & 0xFFFFFFFF ); } #endif /* !HAVE_HARDCLOCK && MBEDTLS_HAVE_ASM && __GNUC__ && __alpha__ */ #if !defined(HAVE_HARDCLOCK) && defined(MBEDTLS_HAVE_ASM) && \ defined(__GNUC__) && defined(__ia64__) #define HAVE_HARDCLOCK unsigned long mbedtls_timing_hardclock( void ) { unsigned long itc; asm volatile( "mov %0 = ar.itc" : "=r" (itc) ); return( itc ); } #endif /* !HAVE_HARDCLOCK && MBEDTLS_HAVE_ASM && __GNUC__ && __ia64__ */ #if !defined(HAVE_HARDCLOCK) && defined(_MSC_VER) && \ !defined(EFIX64) && !defined(EFI32) #define HAVE_HARDCLOCK unsigned long mbedtls_timing_hardclock( void ) { LARGE_INTEGER offset; QueryPerformanceCounter( &offset ); return( (unsigned long)( offset.QuadPart ) ); } #endif /* !HAVE_HARDCLOCK && _MSC_VER && !EFIX64 && !EFI32 */ #if !defined(HAVE_HARDCLOCK) #define HAVE_HARDCLOCK static int hardclock_init = 0; static struct timeval tv_init; unsigned long mbedtls_timing_hardclock( void ) { struct timeval tv_cur; if( hardclock_init == 0 ) { gettimeofday( &tv_init, NULL ); hardclock_init = 1; } gettimeofday( &tv_cur, NULL ); return( ( tv_cur.tv_sec - tv_init.tv_sec ) * 1000000 + ( tv_cur.tv_usec - tv_init.tv_usec ) ); } #endif /* !HAVE_HARDCLOCK */ volatile int mbedtls_timing_alarmed = 0; #if defined(_WIN32) && !defined(EFIX64) && !defined(EFI32) unsigned long mbedtls_timing_get_timer( struct mbedtls_timing_hr_time *val, int reset ) { struct _hr_time *t = (struct _hr_time *) val; if( reset ) { QueryPerformanceCounter( &t->start ); return( 0 ); } else { unsigned long delta; LARGE_INTEGER now, hfreq; QueryPerformanceCounter( &now ); QueryPerformanceFrequency( &hfreq ); delta = (unsigned long)( ( now.QuadPart - t->start.QuadPart ) * 1000ul / hfreq.QuadPart ); return( delta ); } } /* It's OK to use a global because alarm() is supposed to be global anyway */ static DWORD alarmMs; static void TimerProc( void *TimerContext ) { (void) TimerContext; Sleep( alarmMs ); mbedtls_timing_alarmed = 1; /* _endthread will be called implicitly on return * That ensures execution of thread funcition's epilogue */ } void mbedtls_set_alarm( int seconds ) { if( seconds == 0 ) { /* No need to create a thread for this simple case. * Also, this shorcut is more reliable at least on MinGW32 */ mbedtls_timing_alarmed = 1; return; } mbedtls_timing_alarmed = 0; alarmMs = seconds * 1000; (void) _beginthread( TimerProc, 0, NULL ); } #else /* _WIN32 && !EFIX64 && !EFI32 */ unsigned long mbedtls_timing_get_timer( struct mbedtls_timing_hr_time *val, int reset ) { struct _hr_time *t = (struct _hr_time *) val; if( reset ) { gettimeofday( &t->start, NULL ); return( 0 ); } else { unsigned long delta; struct timeval now; gettimeofday( &now, NULL ); delta = ( now.tv_sec - t->start.tv_sec ) * 1000ul + ( now.tv_usec - t->start.tv_usec ) / 1000; return( delta ); } } static void sighandler( int signum ) { mbedtls_timing_alarmed = 1; signal( signum, sighandler ); } void mbedtls_set_alarm( int seconds ) { mbedtls_timing_alarmed = 0; signal( SIGALRM, sighandler ); alarm( seconds ); if( seconds == 0 ) { /* alarm(0) cancelled any previous pending alarm, but the handler won't fire, so raise the flag straight away. */ mbedtls_timing_alarmed = 1; } } #endif /* _WIN32 && !EFIX64 && !EFI32 */ /* * Set delays to watch */ void mbedtls_timing_set_delay( void *data, uint32_t int_ms, uint32_t fin_ms ) { mbedtls_timing_delay_context *ctx = (mbedtls_timing_delay_context *) data; ctx->int_ms = int_ms; ctx->fin_ms = fin_ms; if( fin_ms != 0 ) (void) mbedtls_timing_get_timer( &ctx->timer, 1 ); } /* * Get number of delays expired */ int mbedtls_timing_get_delay( void *data ) { mbedtls_timing_delay_context *ctx = (mbedtls_timing_delay_context *) data; unsigned long elapsed_ms; if( ctx->fin_ms == 0 ) return( -1 ); elapsed_ms = mbedtls_timing_get_timer( &ctx->timer, 0 ); if( elapsed_ms >= ctx->fin_ms ) return( 2 ); if( elapsed_ms >= ctx->int_ms ) return( 1 ); return( 0 ); } #if defined(MBEDTLS_SELF_TEST) /* * Busy-waits for the given number of milliseconds. * Used for testing mbedtls_timing_hardclock. */ static void busy_msleep( unsigned long msec ) { struct mbedtls_timing_hr_time hires; unsigned long i = 0; /* for busy-waiting */ volatile unsigned long j; /* to prevent optimisation */ (void) mbedtls_timing_get_timer( &hires, 1 ); while( mbedtls_timing_get_timer( &hires, 0 ) < msec ) i++; j = i; (void) j; } #define FAIL do \ { \ if( verbose != 0 ) \ { \ mbedtls_printf( "failed at line %d\n", __LINE__ ); \ mbedtls_printf( " cycles=%lu ratio=%lu millisecs=%lu secs=%lu hardfail=%d a=%lu b=%lu\n", \ cycles, ratio, millisecs, secs, hardfail, \ (unsigned long) a, (unsigned long) b ); \ mbedtls_printf( " elapsed(hires)=%lu elapsed(ctx)=%lu status(ctx)=%d\n", \ mbedtls_timing_get_timer( &hires, 0 ), \ mbedtls_timing_get_timer( &ctx.timer, 0 ), \ mbedtls_timing_get_delay( &ctx ) ); \ } \ return( 1 ); \ } while( 0 ) /* * Checkup routine * * Warning: this is work in progress, some tests may not be reliable enough * yet! False positives may happen. */ int mbedtls_timing_self_test( int verbose ) { unsigned long cycles = 0, ratio = 0; unsigned long millisecs = 0, secs = 0; int hardfail = 0; struct mbedtls_timing_hr_time hires; uint32_t a = 0, b = 0; mbedtls_timing_delay_context ctx; if( verbose != 0 ) mbedtls_printf( " TIMING tests note: will take some time!\n" ); if( verbose != 0 ) mbedtls_printf( " TIMING test #1 (set_alarm / get_timer): " ); { secs = 1; (void) mbedtls_timing_get_timer( &hires, 1 ); mbedtls_set_alarm( (int) secs ); while( !mbedtls_timing_alarmed ) ; millisecs = mbedtls_timing_get_timer( &hires, 0 ); /* For some reason on Windows it looks like alarm has an extra delay * (maybe related to creating a new thread). Allow some room here. */ if( millisecs < 800 * secs || millisecs > 1200 * secs + 300 ) FAIL; } if( verbose != 0 ) mbedtls_printf( "passed\n" ); if( verbose != 0 ) mbedtls_printf( " TIMING test #2 (set/get_delay ): " ); { a = 800; b = 400; mbedtls_timing_set_delay( &ctx, a, a + b ); /* T = 0 */ busy_msleep( a - a / 4 ); /* T = a - a/4 */ if( mbedtls_timing_get_delay( &ctx ) != 0 ) FAIL; busy_msleep( a / 4 + b / 4 ); /* T = a + b/4 */ if( mbedtls_timing_get_delay( &ctx ) != 1 ) FAIL; busy_msleep( b ); /* T = a + b + b/4 */ if( mbedtls_timing_get_delay( &ctx ) != 2 ) FAIL; } mbedtls_timing_set_delay( &ctx, 0, 0 ); busy_msleep( 200 ); if( mbedtls_timing_get_delay( &ctx ) != -1 ) FAIL; if( verbose != 0 ) mbedtls_printf( "passed\n" ); if( verbose != 0 ) mbedtls_printf( " TIMING test #3 (hardclock / get_timer): " ); /* * Allow one failure for possible counter wrapping. * On a 4Ghz 32-bit machine the cycle counter wraps about once per second; * since the whole test is about 10ms, it shouldn't happen twice in a row. */ hard_test: if( hardfail > 1 ) { if( verbose != 0 ) mbedtls_printf( "failed (ignored)\n" ); goto hard_test_done; } /* Get a reference ratio cycles/ms */ millisecs = 1; cycles = mbedtls_timing_hardclock(); busy_msleep( millisecs ); cycles = mbedtls_timing_hardclock() - cycles; ratio = cycles / millisecs; /* Check that the ratio is mostly constant */ for( millisecs = 2; millisecs <= 4; millisecs++ ) { cycles = mbedtls_timing_hardclock(); busy_msleep( millisecs ); cycles = mbedtls_timing_hardclock() - cycles; /* Allow variation up to 20% */ if( cycles / millisecs < ratio - ratio / 5 || cycles / millisecs > ratio + ratio / 5 ) { hardfail++; goto hard_test; } } if( verbose != 0 ) mbedtls_printf( "passed\n" ); hard_test_done: if( verbose != 0 ) mbedtls_printf( "\n" ); return( 0 ); } #endif /* MBEDTLS_SELF_TEST */ #endif /* !MBEDTLS_TIMING_ALT */ #endif /* MBEDTLS_TIMING_C */
{ "content_hash": "337f8110af53274868ab3e0c3ee7483f", "timestamp": "", "source": "github", "line_count": 512, "max_line_length": 103, "avg_line_length": 26.76171875, "alnum_prop": 0.5514523427236899, "repo_name": "Valentactive/godot", "id": "57bc9bcc12f095d974d0c568605466a3b5217451", "size": "14402", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "thirdparty/mbedtls/library/timing.c", "mode": "33188", "license": "mit", "language": [ { "name": "AIDL", "bytes": "1633" }, { "name": "C", "bytes": "1045182" }, { "name": "C#", "bytes": "1059815" }, { "name": "C++", "bytes": "39504050" }, { "name": "CMake", "bytes": "606" }, { "name": "GAP", "bytes": "62" }, { "name": "GDScript", "bytes": "66177" }, { "name": "GLSL", "bytes": "826763" }, { "name": "Java", "bytes": "596743" }, { "name": "JavaScript", "bytes": "188671" }, { "name": "Kotlin", "bytes": "84098" }, { "name": "Makefile", "bytes": "1421" }, { "name": "Objective-C", "bytes": "20550" }, { "name": "Objective-C++", "bytes": "367914" }, { "name": "PowerShell", "bytes": "2713" }, { "name": "Python", "bytes": "477342" }, { "name": "Shell", "bytes": "30899" } ], "symlink_target": "" }