text
stringlengths
2
1.04M
meta
dict
<?php /* * This file is part of the Paginate package * * (c) Christian Hoegl <chrigu@sirprize.me> */ namespace Sirprize\Paginate\Range; /** * RangeInterface. * * @author Christian Hoegl <chrigu@sirprize.me> */ interface RangeInterface { public function setTotalItems($totalItems); public function getTotalItems(); public function getOffset(); public function getLast(); public function getNumItems(); }
{ "content_hash": "89b8c23f72944f3456641018c14edae6", "timestamp": "", "source": "github", "line_count": 23, "max_line_length": 47, "avg_line_length": 18.82608695652174, "alnum_prop": 0.7020785219399538, "repo_name": "sirprize/paginate", "id": "57e1d2bfaff71ef195b96c46e317a42e34a73ac8", "size": "433", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/Sirprize/Paginate/Range/RangeInterface.php", "mode": "33188", "license": "mit", "language": [ { "name": "PHP", "bytes": "36483" } ], "symlink_target": "" }
<?php namespace ElkArte\sources\subs\ScheduledTask; if (!defined('ELK')) die('No access...'); /** * Perform the standard checks on expiring/near expiring subscriptions: * * - remove expired subscriptions * - notify of subscriptions about to expire * * @package ScheduledTasks */ class Paid_Subscriptions implements Scheduled_Task_Interface { public function run() { global $scripturl, $modSettings, $language; $db = database(); // Start off by checking for removed subscriptions. $request = $db->query('', ' SELECT id_subscribe, id_member FROM {db_prefix}log_subscribed WHERE status = {int:is_active} AND end_time < {int:time_now}', array( 'is_active' => 1, 'time_now' => time(), ) ); require_once(SUBSDIR . '/PaidSubscriptions.subs.php'); while ($row = $db->fetch_assoc($request)) { removeSubscription($row['id_subscribe'], $row['id_member']); } $db->free_result($request); // Get all those about to expire that have not had a reminder sent. $request = $db->query('', ' SELECT ls.id_sublog, m.id_member, m.member_name, m.email_address, m.lngfile, s.name, ls.end_time FROM {db_prefix}log_subscribed AS ls INNER JOIN {db_prefix}subscriptions AS s ON (s.id_subscribe = ls.id_subscribe) INNER JOIN {db_prefix}members AS m ON (m.id_member = ls.id_member) WHERE ls.status = {int:is_active} AND ls.reminder_sent = {int:reminder_sent} AND s.reminder > {int:reminder_wanted} AND ls.end_time < ({int:time_now} + s.reminder * 86400)', array( 'is_active' => 1, 'reminder_sent' => 0, 'reminder_wanted' => 0, 'time_now' => time(), ) ); $subs_reminded = array(); while ($row = $db->fetch_assoc($request)) { // If this is the first one load the important bits. if (empty($subs_reminded)) { require_once(SUBSDIR . '/Mail.subs.php'); // Need the below for loadLanguage to work! loadEssentialThemeData(); } $subs_reminded[] = $row['id_sublog']; $replacements = array( 'PROFILE_LINK' => $scripturl . '?action=profile;area=subscriptions;u=' . $row['id_member'], 'REALNAME' => $row['member_name'], 'SUBSCRIPTION' => $row['name'], 'END_DATE' => strip_tags(standardTime($row['end_time'])), ); $emaildata = loadEmailTemplate('paid_subscription_reminder', $replacements, empty($row['lngfile']) || empty($modSettings['userLanguage']) ? $language : $row['lngfile']); // Send the actual email. sendmail($row['email_address'], $emaildata['subject'], $emaildata['body'], null, null, false, 2); } $db->free_result($request); // Mark the reminder as sent. if (!empty($subs_reminded)) $db->query('', ' UPDATE {db_prefix}log_subscribed SET reminder_sent = {int:reminder_sent} WHERE id_sublog IN ({array_int:subscription_list})', array( 'subscription_list' => $subs_reminded, 'reminder_sent' => 1, ) ); return true; } }
{ "content_hash": "54b451a3d27898c4bc4cfa0f519707e5", "timestamp": "", "source": "github", "line_count": 102, "max_line_length": 172, "avg_line_length": 28.686274509803923, "alnum_prop": 0.6363636363636364, "repo_name": "wizardaf/Elkarte", "id": "61ea6651596a925e25cfb89d2495297013d00bf4", "size": "3387", "binary": false, "copies": "1", "ref": "refs/heads/development", "path": "sources/subs/ScheduledTask/PaidSubscriptions.php", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "ApacheConf", "bytes": "279" }, { "name": "CSS", "bytes": "330227" }, { "name": "HTML", "bytes": "45" }, { "name": "JavaScript", "bytes": "588241" }, { "name": "PHP", "bytes": "8097003" }, { "name": "Shell", "bytes": "6608" } ], "symlink_target": "" }
.. _stateful-behaviour: ****************** Stateful Behaviour ****************** .. rubric:: Most web services tend to have some state, which changes as you and others interact with it. So it's pretty useful to be able to simulate this when you've swapped a real service for a test double. .. _stateful-behaviour-scenarios: Scenarios ========= WireMock supports state via the notion of scenarios. A scenario is essentially a state machine whose states can be arbitrarily assigned. It starting state is always ``Scenario.STARTED``. Stub mappings can be configured to match on scenario state, such that stub A can be returned initially, then stub B once the next scenario state has been triggered. For example, suppose we're writing a to-do list application consisting of a rich client of some kind talking to a REST service. We want to test that our UI can read the to-do list, add an item and refresh itself, showing the updated list. In Java this could be set up like this: .. code-block:: java @Test public void toDoListScenario() { stubFor(get(urlEqualTo("/todo/items")).inScenario("To do list") .whenScenarioStateIs(STARTED) .willReturn(aResponse() .withBody("<items>" + " <item>Buy milk</item>" + "</items>"))); stubFor(post(urlEqualTo("/todo/items")).inScenario("To do list") .whenScenarioStateIs(STARTED) .withRequestBody(containing("Cancel newspaper subscription")) .willReturn(aResponse().withStatus(201)) .willSetStateTo("Cancel newspaper item added")); stubFor(get(urlEqualTo("/todo/items")).inScenario("To do list") .whenScenarioStateIs("Cancel newspaper item added") .willReturn(aResponse() .withBody("<items>" + " <item>Buy milk</item>" + " <item>Cancel newspaper subscription</item>" + "</items>"))); WireMockResponse response = testClient.get("/todo/items"); assertThat(response.content(), containsString("Buy milk")); assertThat(response.content(), not(containsString("Cancel newspaper subscription"))); response = testClient.postWithBody("/todo/items", "Cancel newspaper subscription", "text/plain", "UTF-8"); assertThat(response.statusCode(), is(201)); response = testClient.get("/todo/items"); assertThat(response.content(), containsString("Buy milk")); assertThat(response.content(), containsString("Cancel newspaper subscription")); } The JSON equivalent for the above three stubs is: .. code-block:: javascript { "scenarioName": "To do list", "requiredScenarioState": "Started", "request": { "method": "GET", "url": "/todo/items" }, "response": { "status": 200, "body" : "<items><item>Buy milk</item></items>" } } { "scenarioName": "To do list", "requiredScenarioState": "Started", "newScenarioState": "Cancel newspaper item added", "request": { "method": "POST", "url": "/todo/items", "bodyPatterns": [ { "contains": "Cancel newspaper subscription" } ] }, "response": { "status": 201 } } { "scenarioName": "To do list", "requiredScenarioState": "Cancel newspaper item added", "request": { "method": "GET", "url": "/todo/items" }, "response": { "status": 200, "body" : "<items><item>Buy milk</item><item>Cancel newspaper subscription</item></items>" } } .. _stateful-behaviour-scenarios-reset: Scenarios reset =============== The state of all configured scenarios can be reset back to ``Scenario.START`` either by calling ``WireMock.resetAllScenarios()`` in Java, or posting an empty request to ``http://<host>:<port>/__admin/scenarios/reset``.
{ "content_hash": "a33d8402b16415ee4e0ebbcc57068c57", "timestamp": "", "source": "github", "line_count": 119, "max_line_length": 120, "avg_line_length": 35.21848739495798, "alnum_prop": 0.5802910999761394, "repo_name": "edgarvonk/wiremock", "id": "485ad3e9cacef3adbe30c97ba549545485a2e5ec", "size": "4191", "binary": false, "copies": "8", "ref": "refs/heads/master", "path": "docs/source/stateful-behaviour.rst", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "533" }, { "name": "HTML", "bytes": "34982" }, { "name": "Java", "bytes": "690977" }, { "name": "JavaScript", "bytes": "3841" }, { "name": "Shell", "bytes": "185" }, { "name": "XSLT", "bytes": "14502" } ], "symlink_target": "" }
import os import config import web import app.controllers urls = ( # front page '/', 'app.controllers.home.index', '/hello/', 'app.controllers.hello.index', ) app = web.application(urls, globals()) def notfound(): render = web.template.render(config.global_template_path, base='layout', cache=config.get_cache_config(), globals=globals()) return web.notfound(render.notfound()) def internalerror(): render = web.template.render(config.global_template_path, base='layout', cache=config.get_cache_config(), globals=globals()) return web.notfound(render.internalerror()) # You can change this to run only under the else condition (above app.wsgifunc()) to show as it's in prod. app.notfound = notfound app.internalerror = internalerror if __name__ == "__main__": app.run() else: # move app.notfound and app.internalerror here if you want to show them only in production envs current_dir = os.path.dirname(__file__) session = web.session.Session(app, web.session.DiskStore(os.path.join(current_dir, 'sessions')), ) application = app.wsgifunc()
{ "content_hash": "850bfabbb516908a8b7268e1a1332321", "timestamp": "", "source": "github", "line_count": 35, "max_line_length": 128, "avg_line_length": 31.314285714285713, "alnum_prop": 0.7071167883211679, "repo_name": "neuweb/mvc-webpy", "id": "a97b2131ffa4e62d492f6f5c46cd8414d6b6c8e1", "size": "1145", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "application.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Python", "bytes": "3998" } ], "symlink_target": "" }
import time from openerp.osv import fields, osv from openerp.osv.orm import browse_record, browse_null from openerp.tools.translate import _ class purchase_requisition_partner(osv.osv_memory): _name = "purchase.requisition.partner" _description = "Purchase Requisition Partner" _columns = { 'partner_id': fields.many2one('res.partner', 'Supplier', required=True,domain=[('supplier', '=', True)]), } def view_init(self, cr, uid, fields_list, context=None): if context is None: context = {} res = super(purchase_requisition_partner, self).view_init(cr, uid, fields_list, context=context) record_id = context and context.get('active_id', False) or False tender = self.pool.get('purchase.requisition').browse(cr, uid, record_id, context=context) if not tender.line_ids: raise osv.except_osv(_('Error!'), _('No Product in Tender.')) return res def create_order(self, cr, uid, ids, context=None): active_ids = context and context.get('active_ids', []) data = self.browse(cr, uid, ids, context=context)[0] self.pool.get('purchase.requisition').make_purchase_order(cr, uid, active_ids, data.partner_id.id, context=context) return {'type': 'ir.actions.act_window_close'} purchase_requisition_partner() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
{ "content_hash": "c0592eb2b30afdc67f388e560f8d21b8", "timestamp": "", "source": "github", "line_count": 32, "max_line_length": 123, "avg_line_length": 43.8125, "alnum_prop": 0.6697574893009985, "repo_name": "chjw8016/GreenOdoo7-haibao", "id": "58a72556b221925ed3dfa87cb79a89e316b347ee", "size": "2381", "binary": false, "copies": "49", "ref": "refs/heads/master", "path": "openerp/addons/purchase_requisition/wizard/purchase_requisition_partner.py", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "90846" }, { "name": "CSS", "bytes": "384369" }, { "name": "JavaScript", "bytes": "1730589" }, { "name": "PHP", "bytes": "14033" }, { "name": "Python", "bytes": "9394626" }, { "name": "Shell", "bytes": "5172" }, { "name": "XSLT", "bytes": "156761" } ], "symlink_target": "" }
package fi.nls.oskari.annotation; import fi.nls.oskari.service.OskariComponent; import javax.annotation.processing.RoundEnvironment; import javax.annotation.processing.SupportedAnnotationTypes; import javax.annotation.processing.SupportedSourceVersion; import javax.lang.model.SourceVersion; import javax.lang.model.element.Element; import javax.lang.model.element.Modifier; import javax.lang.model.element.TypeElement; import javax.tools.Diagnostic; import java.io.IOException; import java.util.HashSet; import java.util.Set; @SupportedSourceVersion(SourceVersion.RELEASE_5) @SupportedAnnotationTypes(OskariComponentAnnotationProcessor.ANNOTATION_TYPE) public class OskariComponentAnnotationProcessor extends OskariBaseAnnotationProcessor { /** * This is the annotation we are going to process */ public static final String ANNOTATION_TYPE = "fi.nls.oskari.annotation.Oskari"; public static final String SERVICE_NAME = "fi.nls.oskari.service.OskariComponent"; @Override public boolean process( final Set<? extends TypeElement> annotations, final RoundEnvironment roundEnv) { if (annotations == null || annotations.isEmpty()) { return false; } // we need the actual TypeElement of the annotation, not just it's name final TypeElement annotation = typeElement(ANNOTATION_TYPE); // make sure we have the annotation type if (annotation == null) { // no go for processing return false; } // get all classes that have the annotation final Set<? extends Element> annotatedElements = roundEnv.getElementsAnnotatedWith(annotation); try { // we will need to gather the annotated classes that we are // going to write to the services registration file final Set<String> results = new HashSet<String>(annotatedElements.size()); for (final Element m : annotatedElements) { // we know @OskariActionRoute is a type annotation so casting to TypeElement final TypeElement el = (TypeElement) m; // check that the class is not abstract since we cant instantiate it if it is // and that its of the correct type for our fi.nls.oskari.control.ActionControl if (el.getModifiers().contains(Modifier.ABSTRACT) || !isAssignable(m.asType(), OskariComponent.class)) { // wasn't proper annotation -> go for compilation failure processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, "@Oskari annotated classes must be non-abstract and of type " + OskariComponent.class, m); } else { // we are good to go, gather it up in the results Oskari route = el.getAnnotation(Oskari.class); String comment = processingEnv.getElementUtils().getDocComment(el); if (comment != null) { writeDoc(route.value(), comment); } else { processingEnv.getMessager().printMessage(Diagnostic.Kind.MANDATORY_WARNING, "Documentation missing for component " + route.value() + " (" + el.getQualifiedName().toString() + ")"); } results.add(el.getQualifiedName().toString()); } } // write the services to file registerControls(results, SERVICE_NAME); } catch (final IOException ioe) { System.out.println("ERROR " + ioe.getMessage()); processingEnv.getMessager().printMessage( Diagnostic.Kind.ERROR, "I/O Error during processing."); ioe.printStackTrace(); } return true; } }
{ "content_hash": "b6101dd4d8dcceaeb876481e1a55ea78", "timestamp": "", "source": "github", "line_count": 93, "max_line_length": 136, "avg_line_length": 42.11827956989247, "alnum_prop": 0.6272657646157774, "repo_name": "uhef/Oskari-Routing", "id": "c437d17376d734448d4dbeaad055d0bfc8f6617c", "size": "3917", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "service-base/src/main/java/fi/nls/oskari/annotation/OskariComponentAnnotationProcessor.java", "mode": "33261", "license": "mit", "language": [ { "name": "CSS", "bytes": "5868" }, { "name": "Groovy", "bytes": "93510" }, { "name": "HTML", "bytes": "9833" }, { "name": "Java", "bytes": "3893602" }, { "name": "JavaScript", "bytes": "46736" }, { "name": "PLpgSQL", "bytes": "11077" }, { "name": "SQLPL", "bytes": "2569" }, { "name": "Scheme", "bytes": "629755" }, { "name": "Shell", "bytes": "416" }, { "name": "XSLT", "bytes": "3890" } ], "symlink_target": "" }
package org.wso2.siddhi.core.table; import org.wso2.siddhi.core.config.ExecutionPlanContext; import org.wso2.siddhi.core.event.ComplexEvent; import org.wso2.siddhi.core.event.ComplexEventChunk; import org.wso2.siddhi.core.event.MetaComplexEvent; import org.wso2.siddhi.core.executor.VariableExpressionExecutor; import org.wso2.siddhi.core.query.processor.stream.window.FindableProcessor; import org.wso2.siddhi.core.util.collection.operator.Finder; import org.wso2.siddhi.core.util.collection.operator.Operator; import org.wso2.siddhi.query.api.definition.TableDefinition; import org.wso2.siddhi.query.api.expression.Expression; import java.util.List; import java.util.Map; public interface EventTable extends FindableProcessor { void init(TableDefinition tableDefinition, ExecutionPlanContext executionPlanContext); TableDefinition getTableDefinition(); void add(ComplexEventChunk addingEventChunk); void delete(ComplexEventChunk deletingEventChunk, Operator operator); void update(ComplexEventChunk updatingEventChunk, Operator operator, int[] mappingPosition); boolean contains(ComplexEvent matchingEvent, Finder finder); public Operator constructOperator(Expression expression, MetaComplexEvent metaComplexEvent, ExecutionPlanContext executionPlanContext, List<VariableExpressionExecutor> variableExpressionExecutors, Map<String, EventTable> eventTableMap, int matchingStreamIndex, long withinTime); }
{ "content_hash": "1c025f6eeb07290a22a5a836aa9c36cd", "timestamp": "", "source": "github", "line_count": 36, "max_line_length": 282, "avg_line_length": 40.22222222222222, "alnum_prop": 0.8342541436464088, "repo_name": "mt0803/siddhi", "id": "3212dae52fbabb22829c3ec4394edcb6ac7b1a0a", "size": "2088", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "modules/siddhi-core/src/main/java/org/wso2/siddhi/core/table/EventTable.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ANTLR", "bytes": "15263" }, { "name": "Java", "bytes": "3491579" }, { "name": "Scala", "bytes": "923" } ], "symlink_target": "" }
// Copyright 2015 Google Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. /** * @fileoverview Gulp tasks for compiling backend application. */ import del from 'del'; import fs from 'fs'; import gulp from 'gulp'; import lodash from 'lodash'; import path from 'path'; import conf from './conf'; import goCommand from './gocommand'; /** * Compiles backend application in development mode and places the binary in the serve * directory. */ gulp.task('backend', ['package-backend'], function(doneFn) { goCommand( [ 'build', // Install dependencies to speed up subsequent compilations. '-i', '-o', path.join(conf.paths.serve, conf.backend.binaryName), conf.backend.mainPackageName, ], doneFn); }); /** * Compiles backend application in production mode for the current architecture and places the * binary in the dist directory. * * The production binary difference from development binary is only that it contains all * dependencies inside it and is targeted for a specific architecture. */ gulp.task('backend:prod', ['package-backend', 'clean-dist'], function() { let outputBinaryPath = path.join(conf.paths.dist, conf.backend.binaryName); return backendProd([[outputBinaryPath, conf.arch.default]]); }); /** * Compiles backend application in production mode for all architectures and places the * binary in the dist directory. * * The production binary difference from development binary is only that it contains all * dependencies inside it and is targeted specific architecture. */ gulp.task('backend:prod:cross', ['package-backend', 'clean-dist'], function() { let outputBinaryPaths = conf.paths.distCross.map((dir) => path.join(dir, conf.backend.binaryName)); return backendProd(lodash.zip(outputBinaryPaths, conf.arch.list)); }); /** * Packages backend code to be ready for tests and compilation. */ gulp.task('package-backend', ['package-backend-source', 'link-vendor']); /** * Moves all backend source files (app and tests) to a temporary package directory where it can be * applied go commands. */ gulp.task('package-backend-source', ['clean-packaged-backend-source'], function() { return gulp.src([path.join(conf.paths.backendSrc, '**/*')]) .pipe(gulp.dest(conf.paths.backendTmpSrc)); }); /** * Cleans packaged backend source to remove any leftovers from there. */ gulp.task('clean-packaged-backend-source', function() { return del([conf.paths.backendTmpSrc]); }); /** * Links vendor folder to the packaged backend source. */ gulp.task('link-vendor', ['package-backend-source'], function(doneFn) { fs.symlink(conf.paths.backendVendor, conf.paths.backendTmpSrcVendor, 'dir', (err) => { if (err && err.code === 'EEXIST') { // Skip errors if the link already exists. doneFn(); } else { doneFn(err); } }); }); /** * @param {!Array<!Array<string>>} outputBinaryPathsAndArchs array of * (output binary path, architecture) pairs * @return {!Promise} */ function backendProd(outputBinaryPathsAndArchs) { let promiseFn = (path, arch) => { return (resolve, reject) => { goCommand( [ 'build', '-a', '-installsuffix', 'cgo', '-o', path, conf.backend.mainPackageName, ], (err) => { if (err) { reject(err); } else { resolve(); } }, { // Disable cgo package. Required to run on scratch docker image. CGO_ENABLED: '0', GOARCH: arch, }); }; }; let goCommandPromises = outputBinaryPathsAndArchs.map( (pathAndArch) => new Promise(promiseFn(pathAndArch[0], pathAndArch[1]))); return Promise.all(goCommandPromises); }
{ "content_hash": "8784579d4e8c33a122ca0d55ee5f46c6", "timestamp": "", "source": "github", "line_count": 142, "max_line_length": 98, "avg_line_length": 30.85211267605634, "alnum_prop": 0.655786350148368, "repo_name": "IanLewis/dashboard", "id": "638e8b4dbd467f36f1facaf8c7c3813201f47323", "size": "4381", "binary": false, "copies": "6", "ref": "refs/heads/master", "path": "build/backend.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "50528" }, { "name": "Go", "bytes": "739398" }, { "name": "HTML", "bytes": "372621" }, { "name": "JavaScript", "bytes": "1312039" }, { "name": "Shell", "bytes": "5736" }, { "name": "XSLT", "bytes": "1119" } ], "symlink_target": "" }
using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using System.Security.Claims; namespace QuoteMyGoods.Models { public class QMGUser:IdentityUser { //public string JoinTheDotsKey { get; set; } } public static class PrincipleExtensions { public static string GetJoinTheDots(this ClaimsPrincipal principal) { //return principal.FindFirstValue("JoinTheDots"); return "hahgaghsdgarc2isshit"; } } }
{ "content_hash": "2a220f5f28a07c4adab0e589d8996c6d", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 75, "avg_line_length": 24.25, "alnum_prop": 0.6742268041237114, "repo_name": "PSCAlex/QuoteMyGoods", "id": "5b173f7c26fc6bd5e496c1c11faaffb5190c722e", "size": "487", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/QuoteMyGoods/Models/QMGUser.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "185661" }, { "name": "CSS", "bytes": "757" }, { "name": "HTML", "bytes": "13636" }, { "name": "JavaScript", "bytes": "15818" }, { "name": "TypeScript", "bytes": "14288" } ], "symlink_target": "" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="de"> <head> <!-- Generated by javadoc (version 1.7.0_51) on Thu Feb 27 00:03:31 CET 2014 --> <title>Uses of Class com.jgoodies.looks.windows.WindowsTabbedPaneUI (JGoodies Looks 2.6 API)</title> <meta name="date" content="2014-02-27"> <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> </head> <body> <script type="text/javascript"><!-- if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class com.jgoodies.looks.windows.WindowsTabbedPaneUI (JGoodies Looks 2.6 API)"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar_top"> <!-- --> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../com/jgoodies/looks/windows/WindowsTabbedPaneUI.html" title="class in com.jgoodies.looks.windows">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-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> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?com/jgoodies/looks/windows/class-use/WindowsTabbedPaneUI.html" target="_top">Frames</a></li> <li><a href="WindowsTabbedPaneUI.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h2 title="Uses of Class com.jgoodies.looks.windows.WindowsTabbedPaneUI" class="title">Uses of Class<br>com.jgoodies.looks.windows.WindowsTabbedPaneUI</h2> </div> <div class="classUseContainer">No usage of com.jgoodies.looks.windows.WindowsTabbedPaneUI</div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar_bottom"> <!-- --> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../com/jgoodies/looks/windows/WindowsTabbedPaneUI.html" title="class in com.jgoodies.looks.windows">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-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> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?com/jgoodies/looks/windows/class-use/WindowsTabbedPaneUI.html" target="_top">Frames</a></li> <li><a href="WindowsTabbedPaneUI.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small>Copyright &#169; 2001-2014 JGoodies Software GmbH. All Rights Reserved. </small></p> </body> </html>
{ "content_hash": "547eead4ad30b4dbbc7576d7e6cd4aea", "timestamp": "", "source": "github", "line_count": 116, "max_line_length": 155, "avg_line_length": 37.87931034482759, "alnum_prop": 0.6249431042330451, "repo_name": "pohh-mell/BeerHousePOS", "id": "7a50d0aee237b18e557c6d121d68a6f4e0abe696", "size": "4394", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "docs/api/com/jgoodies/looks/windows/class-use/WindowsTabbedPaneUI.html", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "C++", "bytes": "10287" }, { "name": "CSS", "bytes": "50874" }, { "name": "Java", "bytes": "2266231" }, { "name": "Perl", "bytes": "4298" }, { "name": "Shell", "bytes": "7154" } ], "symlink_target": "" }
package high.mackenzie.autumn.lang.compiler.utils; import autumn.lang.DefinedFunctor; import com.google.common.base.Preconditions; import high.mackenzie.autumn.lang.compiler.typesystem.design.IMethod; import high.mackenzie.autumn.lang.compiler.typesystem.design.IVariableType; /** * An instance of this class is used to indicate why one functor-type cannot subtype another. * * @author Mackenzie High */ public final class FunctorSubtypingViolation { public final IMethod lower; public final IMethod upper; /** * Sole Constructor. * * @param lower is the type of the invoke(*) method in the subclass. * @param upper is the type of the invoke(*) method in the superclass. */ FunctorSubtypingViolation(final IMethod lower, final IMethod upper) { Preconditions.checkNotNull(lower); Preconditions.checkNotNull(upper); assert lower.getOwner().isSubtypeOf(upper.getOwner()); assert lower.getName().equals("invoke"); assert upper.getName().equals("invoke"); assert lower.getOwner().isSubtypeOf(lower.getOwner().getTypeFactory().fromClass(DefinedFunctor.class)); assert upper.getOwner().isSubtypeOf(upper.getOwner().getTypeFactory().fromClass(DefinedFunctor.class)); this.lower = lower; this.upper = upper; } /** * The lengths of the methods parameter-lists must be the same. * * @return true, if this violation was caused by differing numbers of parameters. */ public boolean isParameterLengthViolation() { return lower.getParameters().size() != upper.getParameters().size(); } /** * Each parameter in the lower method must be a subtype of the equivalent parameter * in the upper method. * * @return true, if this violation was caused by mismatched parameters. */ public boolean isParameterTypeViolation() { for (int i = 0; i < lower.getParameters().size() && i < upper.getParameters().size(); i++) { final IVariableType param1 = lower.getParameters().get(i).getType(); final IVariableType param2 = upper.getParameters().get(i).getType(); if (param1.isSubtypeOf(param2) == false) { return true; // Violation Detected } } return false; // No Violation Detected } /** * The return-type of the lower method must be subtype of the upper method's return-type. * * @return true, if this violation is a result of a covariance violation. */ public boolean isReturnTypeViolation() { return !lower.getReturnType().isSubtypeOf(upper.getReturnType()); } }
{ "content_hash": "80d931cff40fa34cf822b52553a732e5", "timestamp": "", "source": "github", "line_count": 82, "max_line_length": 111, "avg_line_length": 33.41463414634146, "alnum_prop": 0.6532846715328468, "repo_name": "Mackenzie-High/autumn", "id": "ef5c2e6ae3cb46d0eeeee7c7f2364dd2cafaaf70", "size": "2740", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/high/mackenzie/autumn/lang/compiler/utils/FunctorSubtypingViolation.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "2604069" }, { "name": "Shell", "bytes": "1208" } ], "symlink_target": "" }
Given(/^I use (?:a|the) fixture(?: named)? "([^"]*)"$/) do |name| copy File.join(aruba.config.fixtures_path_prefix, name), name cd name end Given(/^I copy (?:a|the) (file|directory)(?: (?:named|from))? "([^"]*)" to "([^"]*)"$/) do |file_or_directory, source, destination| copy source, destination end Given(/^I move (?:a|the) (file|directory)(?: (?:named|from))? "([^"]*)" to "([^"]*)"$/) do |file_or_directory, source, destination| move source, destination end Given(/^(?:a|the|(?:an empty)) directory(?: named)? "([^"]*)"$/) do |dir_name| create_directory(dir_name) end Given(/^(?:a|the) directory(?: named)? "([^"]*)" with mode "([^"]*)"$/) do |dir_name, dir_mode| create_directory(dir_name) chmod(dir_mode, dir_name) end Given(/^(?:a|the) file(?: named)? "([^"]*)" with:$/) do |file_name, file_content| write_file(file_name, file_content) end Given(/^(?:an|the) executable(?: named)? "([^"]*)" with:$/) do |file_name, file_content| step %(a file named "#{file_name}" with mode "0755" and with:), file_content end Given(/^(?:a|the) file(?: named)? "([^"]*)" with "([^"]*)"$/) do |file_name, file_content| write_file(file_name, unescape_text(file_content)) end Given(/^(?:a|the) file(?: named)? "([^"]*)" with mode "([^"]*)" and with:$/) do |file_name, file_mode, file_content| write_file(file_name, unescape_text(file_content)) chmod(file_mode, file_name) end Given(/^(?:a|the) (\d+) byte file(?: named)? "([^"]*)"$/) do |file_size, file_name| write_fixed_size_file(file_name, file_size.to_i) end Given(/^(?:an|the) empty file(?: named)? "([^"]*)"$/) do |file_name| write_file(file_name, "") end Given(/^(?:an|the) empty file(?: named)? "([^"]*)" with mode "([^"]*)"$/) do |file_name, file_mode| write_file(file_name, "") chmod(file_mode, file_name) end When(/^I write to "([^"]*)" with:$/) do |file_name, file_content| write_file(file_name, file_content) end When(/^I overwrite(?: (?:a|the) file(?: named)?)? "([^"]*)" with:$/) do |file_name, file_content| overwrite_file(file_name, file_content) end When(/^I append to "([^"]*)" with:$/) do |file_name, file_content| append_to_file(file_name, file_content) end When(/^I append to "([^"]*)" with "([^"]*)"$/) do |file_name, file_content| append_to_file(file_name, file_content) end When(/^I remove (?:a|the) (?:file|directory)(?: named)? "([^"]*)"( with full force)?$/) do |name, force_remove| remove(name, :force => force_remove.nil? ? false : true) end Given(/^(?:a|the) (?:file|directory)(?: named)? "([^"]*)" does not exist$/) do |name| remove(name, :force => true) end When(/^I cd to "([^"]*)"$/) do |dir| cd(dir) end Then(/^the following files should (not )?exist:$/) do |negated, files| files = files.rows.flatten if negated expect(files).not_to include an_existing_file else expect(files).to Aruba::Matchers.all be_an_existing_file end end Then(/^(?:a|the) (file|directory)(?: named)? "([^"]*)" should (not )?exist(?: anymore)?$/) do |directory_or_file, path, expect_match| if directory_or_file == 'file' if expect_match expect(path).not_to be_an_existing_file else expect(path).to be_an_existing_file end elsif directory_or_file == 'directory' if expect_match expect(path).not_to be_an_existing_directory else expect(path).to be_an_existing_directory end else fail ArgumentError, %("#{directory_or_file}" can only be "directory" or "file".) end end Then(/^(?:a|the) file matching %r<(.*?)> should (not )?exist$/) do |pattern, expect_match| if expect_match expect(all_paths).not_to include a_file_name_matching(pattern) else expect(all_paths).to include match a_file_name_matching(pattern) end end Then(/^(?:a|the) (\d+) byte file(?: named)? "([^"]*)" should (not )?exist$/) do |size, file, negated| if negated expect(file).not_to have_file_size(size) else expect(file).to have_file_size(size) end end Then(/^the following directories should (not )?exist:$/) do |negated, directories| directories = directories.rows.flatten if negated expect(directories).not_to include an_existing_directory else expect(directories).to Aruba::Matchers.all be_an_existing_directory end end Then(/^(?:a|the) file(?: named)? "([^"]*)" should (not )?contain "([^"]*)"$/) do |file, negated, content| if negated expect(file).not_to have_file_content file_content_including(content.chomp) else expect(file).to have_file_content file_content_including(content.chomp) end end Then(/^(?:a|the) file(?: named)? "([^"]*)" should (not )?contain:$/) do |file, negated, content| if negated expect(file).not_to have_file_content file_content_including(content.chomp) else expect(file).to have_file_content file_content_including(content.chomp) end end Then(/^(?:a|the) file(?: named)? "([^"]*)" should (not )?contain exactly:$/) do |file, negated, content| if negated expect(file).not_to have_file_content content else expect(file).to have_file_content content end end Then(/^(?:a|the) file(?: named)? "([^"]*)" should (not )?match %r<([^\/]*)>$/) do |file, negated, content| if negated expect(file).not_to have_file_content file_content_matching(content) else expect(file).to have_file_content file_content_matching(content) end end Then(/^(?:a|the) file(?: named)? "([^"]*)" should (not )?match \/([^\/]*)\/$/) do |file, negated, content| if negated expect(file).not_to have_file_content file_content_matching(content) else expect(file).to have_file_content file_content_matching(content) end end Then(/^(?:a|the) file(?: named)? "([^"]*)" should (not )?be equal to file "([^"]*)"/) do |file, negated, reference_file| if negated expect(file).not_to have_same_file_content_like(reference_file) else expect(file).to have_same_file_content_like(reference_file) end end Then(/^the mode of filesystem object "([^"]*)" should (not )?match "([^"]*)"$/) do |file, negated, permissions| # rubocop:disable Metrics/LineLength Aruba.platform.deprecated('The use of step "the mode of filesystem object "([^"]*)" should (not )?match "([^"]*)" is deprecated. Use "^the (?:file|directory)(?: named)? "([^"]*)" should have permissions "([^"]*)"$" instead') # rubocop:enable Metrics/LineLength if negated expect(file).not_to have_permissions(permissions) else expect(file).to have_permissions(permissions) end end Then(/^the (?:file|directory)(?: named)? "([^"]*)" should( not)? have permissions "([^"]*)"$/) do |path, negated, permissions| if negated expect(path).not_to have_permissions(permissions) else expect(path).to have_permissions(permissions) end end
{ "content_hash": "092871e67096e9aa24565cd1690d1c6a", "timestamp": "", "source": "github", "line_count": 201, "max_line_length": 226, "avg_line_length": 33.298507462686565, "alnum_prop": 0.630509487524279, "repo_name": "jasnow/aruba", "id": "7fa9f4f85d952d3b79fe4b21d483b8d16b7f2a9d", "size": "6693", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "lib/aruba/cucumber/file.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "4666" }, { "name": "Cucumber", "bytes": "274414" }, { "name": "HTML", "bytes": "1928" }, { "name": "JavaScript", "bytes": "128" }, { "name": "Ruby", "bytes": "353308" }, { "name": "Shell", "bytes": "1011" } ], "symlink_target": "" }
/* * � 2001-2009, Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. Sample Application Writing a Basic JMS Application with Point-to-Point Queues, using: - Send and Receive - Transacted Sessions - Multiple Sessions This sample starts up with a username, and the queues you are sending on, and receiving on. Continue writing lines and pressing enter to buffer messages until a specific key word is used to confirm the messages or to completely forget them. Messages are buffered and sent when a specific string is seen ("COMMIT"). Messages buffered can be discarded by entering a specified string ("CANCEL"). Usage: java TransactedTalk -b <broker:port> -u <username> -p <password> -qs <queue> -qr <queue> -b broker:port points to your message broker Default: tcp://localhost:61616 -u username must be unique (but is not checked) -p password password for user (not checked) -qr queue name of queue to receive -qs queue name of queue to send You must specify either a queue for sending or receiving (or both). Suggested demonstration: - In separate console windows with the environment set, start instances of the application under unique user names. For example: java TransactedTalk -u OPERATIONS -qr Q1 -qs Q2 java TransactedTalk -u FACILITIES -qr Q2 -qs Q1 - Type some text and then press Enter. - Repeat to create a batch of messages. - Send the batched messages by entering the text "COMMIT" - Discard the batched messages by entering the text "CANCEL" - Stop a session by pressing CTRL+C in its console window. */ import org.apache.activemq.*; public class TransactedTalk implements javax.jms.MessageListener { private static final String DEFAULT_BROKER_NAME = "tcp://localhost:61616"; private static final String DEFAULT_PASSWORD = "password"; private static final int MESSAGE_LIFESPAN = 1800000; // milliseconds (30 minutes) private javax.jms.Connection connect = null; private javax.jms.Session sendSession = null; private javax.jms.Session receiveSession = null; private javax.jms.MessageProducer sender = null; /** Create JMS client for sending and receiving messages. */ private void talker( String broker, String username, String password, String rQueue, String sQueue) { // Create a connection. try { javax.jms.ConnectionFactory factory; factory = new ActiveMQConnectionFactory(username, password, broker); connect = factory.createConnection (username, password); // We want to be able up commit/rollback messages sent, // but not affect messages received. Therefore, we need two sessions. sendSession = connect.createSession(true,javax.jms.Session.AUTO_ACKNOWLEDGE); receiveSession = connect.createSession(false,javax.jms.Session.AUTO_ACKNOWLEDGE); } catch (javax.jms.JMSException jmse) { System.err.println("error: Cannot connect to Broker - " + broker); jmse.printStackTrace(); System.exit(1); } // Create Sender and Receiver 'Talk' queues try { if (sQueue != null) { javax.jms.Queue sendQueue = sendSession.createQueue (sQueue); sender = sendSession.createProducer(sendQueue); } if (rQueue != null) { javax.jms.Queue receiveQueue = receiveSession.createQueue (rQueue); javax.jms.MessageConsumer qReceiver = receiveSession.createConsumer(receiveQueue); qReceiver.setMessageListener(this); // Now that 'receive' setup is complete, start the Connection connect.start(); } } catch (javax.jms.JMSException jmse) { jmse.printStackTrace(); exit(); } try { if (rQueue != null) System.out.println (""); else System.out.println ("\nNo receiving queue specified.\n"); // Read all standard input and send it as a message. java.io.BufferedReader stdin = new java.io.BufferedReader( new java.io.InputStreamReader( System.in ) ); if (sQueue != null){ System.out.println ("TransactedTalk application:"); System.out.println ("===========================" ); System.out.println ("The application user " + username + " connects to the broker at " + DEFAULT_BROKER_NAME + "."); System.out.println ("The application will stage messages to " + sQueue + " until you either commit them or roll them back."); System.out.println ("The application receives messages on " + rQueue + " to consume any committed messages sent there.\n"); System.out.println ("1. Enter text to send and then press Enter to stage the message."); System.out.println ("2. Add a few messages to the transaction batch."); System.out.println ("3. Then, either:"); System.out.println (" o Enter the text 'COMMIT', and press Enter to send all the staged messages."); System.out.println (" o Enter the text 'CANCEL', and press Enter to drop the staged messages waiting to be sent."); } else System.out.println ("\nPress CTRL-C to exit.\n"); while ( true ) { String s = stdin.readLine(); if ( s == null ) exit(); else if (s.trim().equals("CANCEL")) { // Rollback the messages. A new transaction is implicitly // started for following messages. System.out.print ("Cancelling messages..."); sendSession.rollback(); System.out.println ("Staged messages have been cleared."); } else if ( s.length() > 0 && sQueue != null) { javax.jms.TextMessage msg = sendSession.createTextMessage(); msg.setText( username + ": " + s ); // Queues usually are used for PERSISTENT messages. // Hold messages for 30 minutes (1,800,000 millisecs). sender.send( msg, javax.jms.DeliveryMode.PERSISTENT, javax.jms.Message.DEFAULT_PRIORITY, MESSAGE_LIFESPAN); // See if we should send the messages if (s.trim().equals("COMMIT")) { // Commit (send) the messages. A new transaction is // implicitly started for following messages. System.out.print ("Committing messages..."); sendSession.commit(); System.out.println ("Staged messages have all been sent."); } } } } catch ( java.io.IOException ioe ) { ioe.printStackTrace(); } catch ( javax.jms.JMSException jmse ) { jmse.printStackTrace(); } // Close the connection. exit(); } /** * Handle the message * (as specified in the javax.jms.MessageListener interface). */ public void onMessage( javax.jms.Message aMessage) { try { // Cast the message as a text message. javax.jms.TextMessage textMessage = (javax.jms.TextMessage) aMessage; // This handler reads a single String from the // message and prints it to the standard output. try { String string = textMessage.getText(); System.out.println( string ); } catch (javax.jms.JMSException jmse) { jmse.printStackTrace(); } } catch (java.lang.RuntimeException rte) { rte.printStackTrace(); } } /** Cleanup resources and then exit. */ private void exit() { try { sendSession.rollback(); // Rollback any uncommitted messages. connect.close(); } catch (javax.jms.JMSException jmse) { jmse.printStackTrace(); } System.exit(0); } // // NOTE: the remainder of this sample deals with reading arguments // and does not utilize any JMS classes or code. // /** Main program entry point. */ public static void main(String argv[]) { // Is there anything to do? if (argv.length == 0) { printUsage(); System.exit(1); } // Values to be read from parameters String broker = DEFAULT_BROKER_NAME; String username = null; String password = DEFAULT_PASSWORD; String qSender = null; String qReceiver = null; // Check parameters for (int i = 0; i < argv.length; i++) { String arg = argv[i]; // Options if (!arg.startsWith("-")) { System.err.println ("error: unexpected argument - "+arg); printUsage(); System.exit(1); } else { if (arg.equals("-b")) { if (i == argv.length - 1 || argv[i+1].startsWith("-")) { System.err.println("error: missing broker name:port"); System.exit(1); } broker = argv[++i]; continue; } if (arg.equals("-u")) { if (i == argv.length - 1 || argv[i+1].startsWith("-")) { System.err.println("error: missing user name"); System.exit(1); } username = argv[++i]; continue; } if (arg.equals("-p")) { if (i == argv.length - 1 || argv[i+1].startsWith("-")) { System.err.println("error: missing password"); System.exit(1); } password = argv[++i]; continue; } if (arg.equals("-qr")) { if (i == argv.length - 1 || argv[i+1].startsWith("-")) { System.err.println("error: missing receive queue parameter"); System.exit(1); } qReceiver = argv[++i]; continue; } if (arg.equals("-qs")) { if (i == argv.length - 1 || argv[i+1].startsWith("-")) { System.err.println("error: missing send queue parameter"); System.exit(1); } qSender = argv[++i]; continue; } if (arg.equals("-h")) { printUsage(); System.exit(1); } } } // Check values read in. if (username == null) { System.err.println ("error: user name must be supplied"); printUsage(); System.exit(1); } if (qReceiver == null && qSender == null) { System.err.println ("error: receive queue, or send queue, must be supplied"); printUsage(); System.exit(1); } // Start the JMS client for the "Talk". TransactedTalk tranTalk = new TransactedTalk(); tranTalk.talker (broker, username, password, qReceiver, qSender); } /** Prints the usage. */ private static void printUsage() { StringBuffer use = new StringBuffer(); use.append("usage: java TransactedTalk (options) ...\n\n"); use.append("options:\n"); use.append(" -b name:port Specify name:port of broker.\n"); use.append(" Default broker: "+DEFAULT_BROKER_NAME+"\n"); use.append(" -u name Specify unique user name. (Required)\n"); use.append(" -p password Specify password for user.\n"); use.append(" Default password: "+DEFAULT_PASSWORD+"\n"); use.append(" -qr queue Specify queue for receiving messages.\n"); use.append(" -qs queue Specify queue for sending messages.\n"); use.append(" -h This help screen.\n"); System.err.println (use); } }
{ "content_hash": "f46bcb5657513439c085c7ef63525882", "timestamp": "", "source": "github", "line_count": 360, "max_line_length": 139, "avg_line_length": 37.61944444444445, "alnum_prop": 0.5342243225282434, "repo_name": "JunSoftware109/Java_Exercises", "id": "7b3db0ea2d7e5aef9e77dd33ee5f90efddee5dba", "size": "13545", "binary": false, "copies": "8", "ref": "refs/heads/master", "path": "Lab 4 MOM/exploring-jms/QueuePTPSamples/TransactedTalk/TransactedTalk.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "4371" }, { "name": "HTML", "bytes": "217460" }, { "name": "Java", "bytes": "383310" }, { "name": "JavaScript", "bytes": "63078" } ], "symlink_target": "" }
SYNONYM #### According to Integrated Taxonomic Information System #### Published in Scripta Hierosolymitana 12:90. 1963 #### Original name null ### Remarks null
{ "content_hash": "ba65387ba0971726341e2fcd7fcc79a9", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 39, "avg_line_length": 12.615384615384615, "alnum_prop": 0.7439024390243902, "repo_name": "mdoering/backbone", "id": "3cd24caca5bf7c020c52ea2ef1d8e7fd0492cb61", "size": "241", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Fabales/Fabaceae/Medicago/Medicago shepardii/ Syn. Medicago tornata shepardii/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.5"/> <title>CCTLib: HandleGeneralRegisters&lt; T &gt; Struct Template Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="navtree.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="resize.js"></script> <script type="text/javascript" src="navtree.js"></script> <script type="text/javascript"> $(document).ready(initResizable); $(window).load(resizeHeight); </script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/search.js"></script> <script type="text/javascript"> $(document).ready(function() { searchBox.OnSelectItem(0); }); </script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">CCTLib </div> <div id="projectbrief">Call path collection for Pin Tools and tools for detecting software inefficiencies.</div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.5 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li class="current"><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li> <div id="MSearchBox" class="MSearchBoxInactive"> <span class="left"> <img id="MSearchSelect" src="search/mag_sel.png" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/> <input type="text" id="MSearchField" value="Search" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> </span><span class="right"> <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> </span> </div> </li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="annotated.html"><span>Class&#160;List</span></a></li> <li><a href="classes.html"><span>Class&#160;Index</span></a></li> <li><a href="functions.html"><span>Class&#160;Members</span></a></li> </ul> </div> </div><!-- top --> <div id="side-nav" class="ui-resizable side-nav-resizable"> <div id="nav-tree"> <div id="nav-tree-contents"> <div id="nav-sync" class="sync"></div> </div> </div> <div id="splitbar" style="-moz-user-select:none;" class="ui-resizable-handle"> </div> </div> <script type="text/javascript"> $(document).ready(function(){initNavTree('structHandleGeneralRegisters.html','');}); </script> <div id="doc-content"> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> <a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Variables</a></div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <div class="header"> <div class="summary"> <a href="#pub-static-methods">Static Public Member Functions</a> &#124; <a href="#pub-attribs">Public Attributes</a> &#124; <a href="structHandleGeneralRegisters-members.html">List of all members</a> </div> <div class="headertitle"> <div class="title">HandleGeneralRegisters&lt; T &gt; Struct Template Reference</div> </div> </div><!--header--> <div class="contents"> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a> Static Public Member Functions</h2></td></tr> <tr class="memitem:a7c8491409c3a41d3ba9321ec80f5bad7"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a7c8491409c3a41d3ba9321ec80f5bad7"></a> static&#160;</td><td class="memItemRight" valign="bottom"><b>__attribute__</b> ((always_inline)) void CheckValues(T value</td></tr> <tr class="separator:a7c8491409c3a41d3ba9321ec80f5bad7"><td class="memSeparator" colspan="2">&#160;</td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a> Public Attributes</h2></td></tr> <tr class="memitem:a41c949d0a193af77658671c066c6855d"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a41c949d0a193af77658671c066c6855d"></a> static REG&#160;</td><td class="memItemRight" valign="bottom"><b>reg</b></td></tr> <tr class="separator:a41c949d0a193af77658671c066c6855d"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a209211dc1f8f3965c160da822599231f"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a209211dc1f8f3965c160da822599231f"></a> static REG uint32_t&#160;</td><td class="memItemRight" valign="bottom"><b>opaqueHandle</b></td></tr> <tr class="separator:a209211dc1f8f3965c160da822599231f"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a1c358ea1f32751b2b7d8aaef2bd24f3b"><td class="memItemLeft" align="right" valign="top">static REG uint32_t THREADID&#160;</td><td class="memItemRight" valign="bottom"><b>threadId</b></td></tr> <tr class="separator:a1c358ea1f32751b2b7d8aaef2bd24f3b"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a1c79da2d213ae8dd21079581d7ee69bf"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a1c79da2d213ae8dd21079581d7ee69bf"></a> ContextHandle_t&#160;</td><td class="memItemRight" valign="bottom"><b>curCtxtHandle</b> = GetContextHandle(threadId, opaqueHandle)</td></tr> <tr class="separator:a1c79da2d213ae8dd21079581d7ee69bf"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ae78d9091d4eb5eb5dc72a0c21c8aa87b"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae78d9091d4eb5eb5dc72a0c21c8aa87b"></a> T *&#160;</td><td class="memItemRight" valign="bottom"><b>regBefore</b> = (T *)(&amp;tData-&gt;regValue[reg][0])</td></tr> <tr class="separator:ae78d9091d4eb5eb5dc72a0c21c8aa87b"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ae44164656bd477ab58ac4a5c4b79f5ee"><td class="memItemLeft" align="right" valign="top">if&#160;</td><td class="memItemRight" valign="bottom"><b>regBefore</b></td></tr> <tr class="separator:ae44164656bd477ab58ac4a5c4b79f5ee"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:afce9ed50cad57b6e4118a0ab4b1edbef"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="afce9ed50cad57b6e4118a0ab4b1edbef"></a> else *&#160;</td><td class="memItemRight" valign="bottom"><b>regBefore</b> = value</td></tr> <tr class="separator:afce9ed50cad57b6e4118a0ab4b1edbef"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a8178a7e792bad65cc8709ce40a03b128"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a8178a7e792bad65cc8709ce40a03b128"></a> tData&#160;</td><td class="memItemRight" valign="bottom"><b>regCtxt</b> [reg] = curCtxtHandle</td></tr> <tr class="separator:a8178a7e792bad65cc8709ce40a03b128"><td class="memSeparator" colspan="2">&#160;</td></tr> </table> <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> <div class="textblock"><h3>template&lt;class T&gt;<br/> struct HandleGeneralRegisters&lt; T &gt;</h3> <p>Definition at line <a class="el" href="redspy__temporal__client_8cpp_source.html#l00345">345</a> of file <a class="el" href="redspy__temporal__client_8cpp_source.html">redspy_temporal_client.cpp</a>.</p> </div><h2 class="groupheader">Member Data Documentation</h2> <a class="anchor" id="ae44164656bd477ab58ac4a5c4b79f5ee"></a> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template&lt;class T &gt; </div> <table class="memname"> <tr> <td class="memname">if <a class="el" href="structHandleGeneralRegisters.html">HandleGeneralRegisters</a>&lt; T &gt;::regBefore</td> </tr> </table> </div><div class="memdoc"> <b>Initial value:</b><div class="fragment"><div class="line">{</div> <div class="line"> AddToRedTable(MAKE_CONTEXT_PAIR(tData-&gt;regCtxt[reg],curCtxtHandle),<span class="keyword">sizeof</span>(T),threadId)</div> </div><!-- fragment --> <p>Definition at line <a class="el" href="redspy__temporal__client_8cpp_source.html#l00354">354</a> of file <a class="el" href="redspy__temporal__client_8cpp_source.html">redspy_temporal_client.cpp</a>.</p> </div> </div> <a class="anchor" id="a1c358ea1f32751b2b7d8aaef2bd24f3b"></a> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template&lt;class T &gt; </div> <table class="memname"> <tr> <td class="memname">REG uint32_t THREADID <a class="el" href="structHandleGeneralRegisters.html">HandleGeneralRegisters</a>&lt; T &gt;::threadId</td> </tr> </table> </div><div class="memdoc"> <b>Initial value:</b><div class="fragment"><div class="line">{</div> <div class="line"> </div> <div class="line"> <a class="code" href="structRedSpyThreadData.html">RedSpyThreadData</a>* <span class="keyword">const</span> tData = ClientGetTLS(threadId)</div> </div><!-- fragment --> <p>Definition at line <a class="el" href="redspy__temporal__client_8cpp_source.html#l00347">347</a> of file <a class="el" href="redspy__temporal__client_8cpp_source.html">redspy_temporal_client.cpp</a>.</p> </div> </div> <hr/>The documentation for this struct was generated from the following file:<ul> <li>tests/<a class="el" href="redspy__temporal__client_8cpp_source.html">redspy_temporal_client.cpp</a></li> </ul> </div><!-- contents --> </div><!-- doc-content --> <!-- start footer part --> <div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> <ul> <li class="navelem"><a class="el" href="structHandleGeneralRegisters.html">HandleGeneralRegisters</a></li> <li class="footer">Generated by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.5 </li> </ul> </div> </body> </html>
{ "content_hash": "900895be94799f713cac809810a81370", "timestamp": "", "source": "github", "line_count": 204, "max_line_length": 412, "avg_line_length": 56.490196078431374, "alnum_prop": 0.6894307532106907, "repo_name": "CCTLib/cctlib", "id": "57ca4ff5188c865e15c85f9a568894284e895f0a", "size": "11524", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "docs/html/structHandleGeneralRegisters.html", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "12900" }, { "name": "C++", "bytes": "855002" }, { "name": "M4", "bytes": "5373" }, { "name": "Makefile", "bytes": "111628" }, { "name": "Shell", "bytes": "59977" } ], "symlink_target": "" }
MESSAGE(STATUS "Looking for libmill...") find_path(LIBMILL_ROOT_DIR NAMES include/libmill.h ) find_path(LIBMILL_INCLUDE_DIR NAMES libmill.h HINTS ${LIBMILL_ROOT_DIR}/include ) find_library(LIBMILL_LIBRARY_SHARED NAMES libmill.dylib HINTS ${LIBMILL_ROOT_DIR}/lib ) find_library(LIBMILL_LIBRARY_STATIC NAMES libmill.a HINTS ${LIBMILL_ROOT_DIR}/lib ) add_definitions(-DLIBMILL) set(LIBMILL_LIBRARIES "${LIBMILL_LIBRARY_STATIC};${LIBMILL_LIBRARY_SHARED}") include(FindPackageHandleStandardArgs) find_package_handle_standard_args(libmill DEFAULT_MSG LIBMILL_INCLUDE_DIR LIBMILL_LIBRARIES ) MESSAGE(STATUS " LIBMILL_ROOT_DIR = ${LIBMILL_ROOT_DIR}") MESSAGE(STATUS " LIBMILL_INCLUDE_DIR = ${LIBMILL_INCLUDE_DIR}") MESSAGE(STATUS " LIBMILL_LIBRARY_STATIC = ${LIBMILL_LIBRARY_STATIC}") MESSAGE(STATUS " LIBMILL_LIBRARY_SHARED = ${LIBMILL_LIBRARY_SHARED}") mark_as_advanced( LIBMILL_ROOT_DIR LIBMILL_INCLUDE_DIR LIBMILL_LIBRARIES ) mark_as_advanced(LIBMILL_INCLUDE_DIR LIBMILL_LIBRARIES LIBMILL_LIBRARY_SHARED LIBMILL_LIBRARY_STATIC)
{ "content_hash": "c1ba04b49958a8bf9457da0eecc88bc7", "timestamp": "", "source": "github", "line_count": 44, "max_line_length": 101, "avg_line_length": 24.545454545454547, "alnum_prop": 0.75, "repo_name": "lucmichalski/hunter", "id": "3bf287ced32d9e1dcbc04e6989476f2a810724b0", "size": "1464", "binary": false, "copies": "1", "ref": "refs/heads/hunter2", "path": "cmake/find/FindLibMill.cmake", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "Batchfile", "bytes": "1193" }, { "name": "C++", "bytes": "55684" }, { "name": "CMake", "bytes": "1519759" }, { "name": "Python", "bytes": "67178" }, { "name": "Shell", "bytes": "20036" } ], "symlink_target": "" }
package org.codehaus.groovy.grails.commons; import grails.util.Environment; import java.io.IOException; import org.codehaus.groovy.grails.commons.spring.GrailsResourceHolder; import org.codehaus.groovy.grails.compiler.support.GrailsResourceLoader; import org.codehaus.groovy.grails.compiler.support.GrailsResourceLoaderHolder; import org.springframework.beans.factory.FactoryBean; import org.springframework.beans.factory.InitializingBean; import org.springframework.core.io.Resource; import org.springframework.core.io.support.PathMatchingResourcePatternResolver; import org.springframework.core.io.support.ResourcePatternResolver; /** * A factory bean that constructs the Grails ResourceLoader used to load Grails classes. * * @author Graeme Rocher * @since 0.4 */ public class GrailsResourceLoaderFactoryBean implements FactoryBean<GrailsResourceLoader>, InitializingBean { private GrailsResourceHolder grailsResourceHolder; private GrailsResourceLoader resourceLoader; @Deprecated public void setGrailsResourceHolder(GrailsResourceHolder grailsResourceHolder) { this.grailsResourceHolder = grailsResourceHolder; } public GrailsResourceLoader getObject() { return resourceLoader; } public Class<GrailsResourceLoader> getObjectType() { return GrailsResourceLoader.class; } public boolean isSingleton() { return true; } public void afterPropertiesSet() throws Exception { resourceLoader = GrailsResourceLoaderHolder.getResourceLoader(); if (resourceLoader != null) { return; } if (Environment.getCurrent().isReloadEnabled()) { ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); try { Resource[] resources = resolver.getResources("file:" + Environment.getCurrent().getReloadLocation() + "/grails-app/**/*.groovy"); resourceLoader = new GrailsResourceLoader(resources); } catch (IOException e) { createDefaultInternal(); } } else { createDefaultInternal(); } GrailsResourceLoaderHolder.setResourceLoader(resourceLoader); } private void createDefaultInternal() { if (grailsResourceHolder == null) grailsResourceHolder = new GrailsResourceHolder(); resourceLoader = new GrailsResourceLoader(grailsResourceHolder.getResources()); } }
{ "content_hash": "6f09730974aa184a115a020dde07c4f9", "timestamp": "", "source": "github", "line_count": 72, "max_line_length": 109, "avg_line_length": 34.77777777777778, "alnum_prop": 0.7160543130990416, "repo_name": "erdi/grails-core", "id": "8353e08d05b049b90126b6fdf8270e05cc419543", "size": "3103", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "grails-core/src/main/groovy/org/codehaus/groovy/grails/commons/GrailsResourceLoaderFactoryBean.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Gosu", "bytes": "94" }, { "name": "Groovy", "bytes": "3976293" }, { "name": "Java", "bytes": "4672452" }, { "name": "JavaScript", "bytes": "1919" }, { "name": "Shell", "bytes": "5485" } ], "symlink_target": "" }
<?xml version="1.0" encoding="utf-8"?> <PRONOM-Report xmlns="http://pronom.nationalarchives.gov.uk"> <report_format_detail> <FileFormat> <FormatID>350</FormatID> <FormatName>Microsoft Access Database</FormatName> <FormatVersion>95</FormatVersion> <FormatAliases> </FormatAliases> <FormatFamilies> </FormatFamilies> <FormatTypes> </FormatTypes> <FormatDisclosure> </FormatDisclosure> <FormatDescription>This is an outline record only, and requires further details, research or authentication to provide information that will enable users to further understand the format and to assess digital preservation risks associated with it if appropriate. If you are able to help by supplying any additional information concerning this entry, please return to the main PRONOM page and select ‘Add an Entry’.</FormatDescription> <BinaryFileFormat>Text</BinaryFileFormat> <ByteOrders> </ByteOrders> <ReleaseDate> </ReleaseDate> <WithdrawnDate> </WithdrawnDate> <ProvenanceSourceID>1</ProvenanceSourceID> <ProvenanceName>Digital Preservation Department / The National Archives</ProvenanceName> <ProvenanceSourceDate>02 Aug 2005</ProvenanceSourceDate> <ProvenanceDescription> </ProvenanceDescription> <LastUpdatedDate>02 Aug 2005</LastUpdatedDate> <FormatNote> </FormatNote> <FormatRisk> </FormatRisk> <TechnicalEnvironment> </TechnicalEnvironment> <FileFormatIdentifier> <Identifier>x-fmt/238</Identifier> <IdentifierType>PUID</IdentifierType> </FileFormatIdentifier> <ExternalSignature> <ExternalSignatureID>337</ExternalSignatureID> <Signature>mdb</Signature> <SignatureType>File extension</SignatureType> </ExternalSignature> <InternalSignature> <SignatureID>271</SignatureID> <SignatureName>MS Access 95</SignatureName> <SignatureNote>Jet 3 DB header plus variably-positioned AccessVersion 06. Two byte sequences. Sequence one character sequence, Standard Jet DB. Sequence two character sequence AccessVersion{0-1024}06.[0:9][0:9]</SignatureNote> <ByteSequence> <ByteSequenceID>346</ByteSequenceID> <PositionType>Absolute from BOF</PositionType> <Offset>0</Offset> <MaxOffset> </MaxOffset> <IndirectOffsetLocation> </IndirectOffsetLocation> <IndirectOffsetLength> </IndirectOffsetLength> <Endianness>Little-endian</Endianness> <ByteSequenceValue>000100005374616E64617264204A65742044420000000000</ByteSequenceValue> </ByteSequence> <ByteSequence> <ByteSequenceID>347</ByteSequenceID> <PositionType>Variable</PositionType> <Offset> </Offset> <MaxOffset> </MaxOffset> <IndirectOffsetLocation> </IndirectOffsetLocation> <IndirectOffsetLength> </IndirectOffsetLength> <Endianness>Little-endian</Endianness> <ByteSequenceValue>41636365737356657273696F6E{0-1024}30362E[30:39][30:39]</ByteSequenceValue> </ByteSequence> </InternalSignature> </FileFormat> <SearchCriteria>Criteria</SearchCriteria> </report_format_detail> </PRONOM-Report>
{ "content_hash": "337213f2c5f39bee5044c41e84e250af", "timestamp": "", "source": "github", "line_count": 80, "max_line_length": 440, "avg_line_length": 42.3125, "alnum_prop": 0.6824224519940916, "repo_name": "opf-attic/ref", "id": "00d3064d56a3098ad86a7890dcaf6299dc108304", "size": "3389", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "tools/fido/0.9.6-1/oldstuff/data/pronom/source/xml/puid.x-fmt.238.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "PHP", "bytes": "137454" }, { "name": "Shell", "bytes": "13228" } ], "symlink_target": "" }
package dk.siman.jive.ui; import android.app.Activity; import android.app.ActivityOptions; import android.app.FragmentManager; import android.content.Context; import android.content.Intent; import android.content.res.Configuration; import android.graphics.Color; import android.os.Bundle; import android.os.Handler; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.AppCompatActivity; import android.support.v7.app.MediaRouteButton; import android.support.v7.media.MediaRouter; import android.support.v7.widget.Toolbar; import android.view.KeyEvent; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ListView; import android.widget.SimpleAdapter; import android.widget.Toast; import com.github.amlcurran.showcaseview.ShowcaseView; import com.github.amlcurran.showcaseview.targets.ViewTarget; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.GooglePlayServicesUtil; import com.google.android.libraries.cast.companionlibrary.cast.VideoCastManager; import com.google.android.libraries.cast.companionlibrary.cast.callbacks.VideoCastConsumerImpl; import dk.siman.jive.R; import dk.siman.jive.utils.CastHelper; import dk.siman.jive.utils.LogHelper; import dk.siman.jive.utils.PrefUtils; import dk.siman.jive.utils.ResourceHelper; /** * Abstract activity with toolbar, navigation drawer and cast support. Needs to be extended by * any activity that wants to be shown as a top level activity. * * The requirements for a subclass is to call {@link #initializeToolbar()} on onCreate, after * setContentView() is called and have three mandatory layout elements: * a {@link android.support.v7.widget.Toolbar} with id 'toolbar', * a {@link android.support.v4.widget.DrawerLayout} with id 'drawerLayout' and * a {@link android.widget.ListView} with id 'drawerList'. */ public abstract class ActionBarCastActivity extends AppCompatActivity { private static final String TAG = LogHelper.makeLogTag(ActionBarCastActivity.class); private static final int DELAY_MILLIS = 1000; private VideoCastManager mCastManager; private MenuItem mMediaRouteMenuItem; private Toolbar mToolbar; private ActionBarDrawerToggle mDrawerToggle; private DrawerLayout mDrawerLayout; private ListView mDrawerList; private DrawerMenuContents mDrawerMenuContents; private boolean mToolbarInitialized; private boolean doubleBackToExitPressedOnce = false; private boolean playService; private int mItemToOpenWhenDrawerCloses = -1; public interface Defs { int EFFECTS_PANEL = 1; } private final VideoCastConsumerImpl mCastConsumer = new VideoCastConsumerImpl() { @Override public void onFailed(int resourceId, int statusCode) { String reason = "Not Available"; if (resourceId > 0) { reason = getString(resourceId); } LogHelper.e(TAG, "onFailed, reason: " + reason + ", status code: " + statusCode); } @Override public void onConnectionSuspended(int cause) { LogHelper.d(TAG, "onConnectionSuspended() was called with cause: ", cause); Toast.makeText(getApplicationContext(), getString(R.string.connection_temp_lost), Toast.LENGTH_LONG).show(); } @Override public void onConnectivityRecovered() { Toast.makeText(getApplicationContext(), getString(R.string.connection_recovered), Toast.LENGTH_LONG).show(); } @Override public void onCastDeviceDetected(final MediaRouter.RouteInfo info) { CastHelper.checkCastDevice(info); // FTU stands for First Time Use: if (!PrefUtils.isFtuShown(ActionBarCastActivity.this)) { // If user is seeing the cast button for the first time, we will // show an overlay that explains what that button means. PrefUtils.setFtuShown(ActionBarCastActivity.this, true); LogHelper.d(TAG, "Route is visible: ", info); new Handler().postDelayed(new Runnable() { @Override public void run() { if (mMediaRouteMenuItem.isVisible()) { LogHelper.d(TAG, "Cast Icon is visible: ", info.getName()); showFtu(); } } }, DELAY_MILLIS); } } }; private final DrawerLayout.DrawerListener mDrawerListener = new DrawerLayout.DrawerListener() { @Override public void onDrawerClosed(View drawerView) { if (mDrawerToggle != null) mDrawerToggle.onDrawerClosed(drawerView); int position = mItemToOpenWhenDrawerCloses; if (position >= 0) { Bundle extras = ActivityOptions.makeCustomAnimation( ActionBarCastActivity.this, R.anim.fade_in, R.anim.fade_out).toBundle(); Class activityClass = mDrawerMenuContents.getActivity(position); startActivity(new Intent(ActionBarCastActivity.this, activityClass), extras); finish(); } } @Override public void onDrawerStateChanged(int newState) { if (mDrawerToggle != null) mDrawerToggle.onDrawerStateChanged(newState); } @Override public void onDrawerSlide(View drawerView, float slideOffset) { if (mDrawerToggle != null) mDrawerToggle.onDrawerSlide(drawerView, slideOffset); } @Override public void onDrawerOpened(View drawerView) { if (mDrawerToggle != null) mDrawerToggle.onDrawerOpened(drawerView); if (getSupportActionBar() != null) getSupportActionBar() .setTitle(R.string.app_name); } }; private final FragmentManager.OnBackStackChangedListener mBackStackChangedListener = new FragmentManager.OnBackStackChangedListener() { @Override public void onBackStackChanged() { updateDrawerToggle(); } }; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); updateLoggingStatus(getApplicationContext()); LogHelper.d(TAG, "Activity onCreate"); // Check if Google Play Service is available. playService = checkGooglePlayServices(this); if (playService) { LogHelper.d(TAG, "PlayService found"); mCastManager = VideoCastManager.getInstance(); mCastManager.reconnectSessionIfPossible(); } else { LogHelper.d(TAG, "PlayService not found"); } } public static boolean checkGooglePlayServices(final Activity activity) { final int googlePlayServicesCheck = GooglePlayServicesUtil.isGooglePlayServicesAvailable( activity); switch (googlePlayServicesCheck) { case ConnectionResult.SUCCESS: return true; case ConnectionResult.SERVICE_DISABLED: LogHelper.d(TAG, "checkGooglePlayServices SERVICE_DISABLED"); return false; case ConnectionResult.SERVICE_INVALID: LogHelper.d(TAG, "checkGooglePlayServices SERVICE_INVALID"); return false; case ConnectionResult.SERVICE_MISSING: LogHelper.d(TAG, "checkGooglePlayServices SERVICE_MISSING"); return false; case ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED: LogHelper.d(TAG, "checkGooglePlayServices SERVICE_VERSION_UPDATE_REQUIRED"); return false; default: LogHelper.d(TAG, "checkGooglePlayServices failed"); } return false; } private void updateLoggingStatus(Context context) { if (PrefUtils.isVerboseLogging(context)) { LogHelper.setVerboseLogging(true); } else { LogHelper.setVerboseLogging(false); } } @Override protected void onStart() { super.onStart(); if (!mToolbarInitialized) { throw new IllegalStateException("You must run super.initializeToolbar at " + "the end of your onCreate method"); } } @Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); if (mDrawerToggle != null) { mDrawerToggle.syncState(); } } @Override public void onResume() { super.onResume(); LogHelper.d(TAG, "Activity onResume"); if (playService) { mCastManager.addVideoCastConsumer(mCastConsumer); mCastManager.incrementUiCounter(); } // Whenever the fragment back stack changes, we may need to update the // action bar toggle: only top level screens show the hamburger-like icon, inner // screens - either Activities or fragments - show the "Up" icon instead. getFragmentManager().addOnBackStackChangedListener(mBackStackChangedListener); this.doubleBackToExitPressedOnce = false; } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); if (mDrawerToggle != null) { mDrawerToggle.onConfigurationChanged(newConfig); } } @Override public void onPause() { super.onPause(); LogHelper.d(TAG, "Activity onPause"); if (playService) { mCastManager.removeVideoCastConsumer(mCastConsumer); mCastManager.decrementUiCounter(); } getFragmentManager().removeOnBackStackChangedListener(mBackStackChangedListener); } @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); getMenuInflater().inflate(R.menu.main, menu); if (playService) { mMediaRouteMenuItem = mCastManager.addMediaRouterButton(menu, R.id.media_route_menu_item); } return true; } public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_MENU) { if (mDrawerLayout != null) if (mDrawerLayout.isDrawerOpen(GravityCompat.START)) { mDrawerLayout.closeDrawers(); return true; } else { mDrawerLayout.openDrawer(GravityCompat.START); return true; } } return super.onKeyDown(keyCode, event); } @Override public boolean onOptionsItemSelected(MenuItem item) { LogHelper.d(TAG, "onOptionsItemSelected"); if (mDrawerToggle != null && mDrawerToggle.onOptionsItemSelected(item)) { return true; } // If not handled by drawerToggle, home needs to be handled by returning to previous if (item != null && item.getItemId() == android.R.id.home) { onBackPressed(); return true; } return super.onOptionsItemSelected(item); } @Override public void onBackPressed() { LogHelper.d(TAG, "onBackPressed"); // If the drawer is open, back will close it if (mDrawerLayout != null && mDrawerLayout.isDrawerOpen(GravityCompat.START)) { mDrawerLayout.closeDrawers(); return; } // Otherwise, it may return to the previous fragment stack FragmentManager fragmentManager = getFragmentManager(); if (fragmentManager.getBackStackEntryCount() > 0) { fragmentManager.popBackStack(); } else if (mDrawerLayout != null) { // If current view ain't album view, return to album view int position = mDrawerMenuContents.getPosition(this.getClass()); if (position > 0) { Class activityClass = mDrawerMenuContents.getActivity(0); startActivity(new Intent(ActionBarCastActivity.this, activityClass), null); finish(); } else { // When back pressed once, and view is album view, show Toast msg and exit app on 2nd back press if (doubleBackToExitPressedOnce) { super.onBackPressed(); return; } this.doubleBackToExitPressedOnce = true; Toast.makeText(this, R.string.double_tab_exit_text, Toast.LENGTH_SHORT).show(); new Handler().postDelayed(new Runnable() { @Override public void run() { doubleBackToExitPressedOnce=false; } }, 2000); } } else { super.onBackPressed(); } } @Override public void setTitle(CharSequence title) { super.setTitle(title); mToolbar.setTitle(title); } @Override public void setTitle(int titleId) { super.setTitle(titleId); mToolbar.setTitle(titleId); } protected void initializeToolbar() { mToolbar = (Toolbar) findViewById(R.id.toolbar); if (mToolbar == null) { throw new IllegalStateException("Layout is required to include a Toolbar with id " + "'toolbar'"); } mToolbar.inflateMenu(R.menu.main); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawerLayout); if (mDrawerLayout != null) { mDrawerList = (ListView) findViewById(R.id.drawer_list); if (mDrawerList == null) { throw new IllegalStateException("A layout with a drawerLayout is required to" + "include a ListView with id 'drawerList'"); } // Create an ActionBarDrawerToggle that will handle opening/closing of the drawer: mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, mToolbar, R.string.open_content_drawer, R.string.close_content_drawer); mDrawerLayout.setDrawerListener(mDrawerListener); mDrawerLayout.setStatusBarBackgroundColor( ResourceHelper.getThemeColor(this, R.attr.colorPrimary, android.R.color.black)); populateDrawerItems(); setSupportActionBar(mToolbar); updateDrawerToggle(); } else { setSupportActionBar(mToolbar); } mToolbarInitialized = true; } private void populateDrawerItems() { mDrawerMenuContents = new DrawerMenuContents(this); final int selectedPosition = mDrawerMenuContents.getPosition(this.getClass()); final int unselectedColor = Color.WHITE; final int selectedColor = getResources().getColor(R.color.drawer_item_selected_background); SimpleAdapter adapter = new SimpleAdapter(this, mDrawerMenuContents.getItems(), R.layout.drawer_list_item, new String[]{DrawerMenuContents.FIELD_TITLE, DrawerMenuContents.FIELD_ICON}, new int[]{R.id.drawer_item_title, R.id.drawer_item_icon}) { @Override public View getView(int position, View convertView, ViewGroup parent) { View view = super.getView(position, convertView, parent); int color = unselectedColor; if (position == selectedPosition) { color = selectedColor; } view.setBackgroundColor(color); return view; } }; mDrawerList.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if (position != selectedPosition) { view.setBackgroundColor(getResources().getColor( R.color.drawer_item_selected_background)); mItemToOpenWhenDrawerCloses = position; } mDrawerLayout.closeDrawers(); } }); mDrawerList.setAdapter(adapter); } private void updateDrawerToggle() { if (mDrawerToggle == null) { return; } boolean isRoot = getFragmentManager().getBackStackEntryCount() == 0; mDrawerToggle.setDrawerIndicatorEnabled(isRoot); if (getSupportActionBar() != null) { getSupportActionBar().setDisplayShowHomeEnabled(!isRoot); getSupportActionBar().setDisplayHomeAsUpEnabled(!isRoot); getSupportActionBar().setHomeButtonEnabled(!isRoot); } if (isRoot) { mDrawerToggle.syncState(); } } /** * Shows the Cast First Time User experience to the user (an overlay that explains what is * the Cast icon) */ private void showFtu() { Menu menu = mToolbar.getMenu(); View view = menu.findItem(R.id.media_route_menu_item).getActionView(); if (view != null && view instanceof MediaRouteButton) { new ShowcaseView.Builder(this) .setTarget(new ViewTarget(view)) .setContentTitle(R.string.touch_to_cast) .hideOnTouchOutside() .build(); } } }
{ "content_hash": "4b8c91d3d080a2dc6168ddb3fac0dda4", "timestamp": "", "source": "github", "line_count": 457, "max_line_length": 120, "avg_line_length": 38.59518599562363, "alnum_prop": 0.6272820047624447, "repo_name": "TeamEOS/gradle_Jive", "id": "27431f41aa07046bc1956b4f6d3795d0012fbfae", "size": "18257", "binary": false, "copies": "1", "ref": "refs/heads/mm6.0", "path": "app/src/main/java/dk/siman/jive/ui/ActionBarCastActivity.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "3977" }, { "name": "Java", "bytes": "1002257" } ], "symlink_target": "" }
--- license: > Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --- # iOS WebViews Начиная с Cordova 1.4, можно использовать Cordova как компонент в iOS приложений. Этот компонент является кодовым названием «Колун». Новые Cordova-приложения, созданные с помощью Xcode шаблона, доступного в Cordova 1.4 или более широкому использованию Кливер. (Шаблон — Кливер в эталонной реализации). Колун осуществления подпроектов на основе поддерживают только Cordova 2.0.0 и последующих версиях. ## Необходимые условия * Кордова 2.3.0 или больше * Xcode 4.5 или больше * `config.xml`файл (из вновь созданного iOS проекта) ## Добавление Кливер в Xcode проект (подпроект CordovaLib) 1. Скачайте и распакуйте Cordova источник постоянного каталог на жестком диске, например`~/Documents/Cordova`. 2. Закройте Xcode, если она запущена. 3. С помощью Terminal.app, перейдите в каталог, где вы положили загруженных исходных выше. 4. Копия `config.xml` файл в каталог проекта на диске (см выше). 5. Перетащите и падение `config.xml` файлов в навигатор проекта Xcode. 6. Выберите переключатель **создать группы для любой дополнительной папки** и нажмите кнопку **Готово**. 7. Перетащите и падение `CordovaLib.xcodeproj` файлов в навигатор проекта Xcode (от постоянного каталога расположение выше и она должна быть в `CordovaLib` подкаталог). 8. Select `CordovaLib.xcodeproj` in the Project Navigator. 9. Введите сочетание клавиш **Option-Command-1** , чтобы показать **Инспектора файлов**. 10. Выберите **относительный группу** в **Инспектора файлов** для раскрывающегося меню для **местоположения**. 11. Выберите **значок проекта** в диспетчере структуры проекта, выберите ваши **цели**, а затем выберите вкладку **Параметры построения** . 12. Добавить `-all_load` и `-Obj-C` для **Других компоновщика Flags** значения. 13. Нажмите на **значок проекта** в диспетчере структуры проекта, выберите **целевой**, а затем выберите вкладку **Build фаз** . 14. Разверните **двоичных файлов связь с библиотеками**. 15. Выберите **+** кнопку и добавьте следующие **рамки**. При необходимости в диспетчере структуры проекта, переместите их под **рамки** группы): AddressBook.framework AddressBookUI.framework AudioToolbox.framework AVFoundation.framework CoreLocation.framework MediaPlayer.framework QuartzCore.framework SystemConfiguration.framework MobileCoreServices.framework CoreMedia.framework 16. Разверните узел **Целевого объекта зависимостей**, приставки, помечены как это, если у вас есть несколько коробки! 17. Выберите **+** кнопку и добавьте `CordovaLib` создания продукта. 18. Разверните **Двоичных файлов связь с библиотеками**, приставки, помечены как это, если у вас есть несколько коробки! 19. Выберите **+** кнопку и добавить`libCordova.a`. 20. Присвоить **уникальный** Xcode предпочтения **предпочтения Xcode → места → полученных данных → передовые...**. 21. Выберите **значок проекта** в диспетчере структуры проекта, выберите ваши **цели**, а затем выберите вкладку **Параметры построения** . 22. Поиск **путей поиска заголовка**. Для этого параметра, добавьте эти три значения ниже (в кавычках): "$(TARGET_BUILD_DIR)/usr/local/lib/include" "$(OBJROOT)/UninstalledProducts/include" "$(BUILT_PRODUCTS_DIR)" С Cordova 2.1.0 `CordovaLib` был обновлен для использования **Автоматического подсчета ссылок (ARC)**. Вам не нужно для обновления до **дуги** для использования CordovaLib, но если вы хотите обновить проект для использования **дуги**, пожалуйста, используйте мастер миграции Xcode из меню: **Правка → рефакторинг → преобразовать в Objective-C ARC...**, **снимите флажок libCordova.a**, затем запустите мастер до завершения. ## Использование CDVViewController в коде 1. Добавьте этот заголовок: #import <Cordova/CDVViewController.h> 2. Создайте экземпляр нового `CDVViewController` и сохранить его где-нибудь (например, к свойству в классе): CDVViewController* viewController = [CDVViewController new]; 3. (*ФАКУЛЬТАТИВНЫЙ*) Установите `wwwFolderName` Свойства (по умолчанию `www` ): viewController.wwwFolderName = @"myfolder"; 4. (*ФАКУЛЬТАТИВНЫЙ*) Задайте начальную страницу в config.xml, `<content>` тег. <content src="index.html" /> ИЛИ <content src="http://apache.org" /> 5. (*ФАКУЛЬТАТИВНЫЙ*) Установите `useSplashScreen` Свойства (по умолчанию `NO` ): viewController.useSplashScreen = YES; 6. Задать **кадр представления** (всегда установить это как последнего свойства): viewController.view.frame = CGRectMake(0, 0, 320, 480); 7. Добавьте Кливер в представление: [myView addSubview:viewController.view]; ## Добавление HTML, CSS и JavaScript активов 1. Создайте новый каталог проекта на диске, `www` например. 2. Положите ваши активы HTML, CSS и JavaScript в этот каталог. 3. Перетащите и поместите каталог в навигатор проекта Xcode. 4. Выберите переключатель **создать папку ссылок для любых папок, добавил** . 5. Установите соответствующий `wwwFolderName` и `startPage` свойства для папки, вы первоначально создали, или использовать значения по умолчанию (см. предыдущий раздел) при создании экземпляра`CDVViewController`. /* if you created a folder called 'myfolder' and you want the file 'mypage.html' in it to be the startPage */ viewController.wwwFolderName = @"myfolder"; viewController.startPage = @"mypage.html"
{ "content_hash": "1c776f7be14d1998221f678f89241886", "timestamp": "", "source": "github", "line_count": 162, "max_line_length": 427, "avg_line_length": 39.851851851851855, "alnum_prop": 0.7193308550185874, "repo_name": "drbeermann/cordova-docs", "id": "d145c3cb77eb20fb54ce34125f7a4946f236a95e", "size": "9209", "binary": false, "copies": "5", "ref": "refs/heads/master", "path": "docs/ru/3.1.0/guide/platforms/ios/webview.md", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "5116" }, { "name": "CSS", "bytes": "11129" }, { "name": "HTML", "bytes": "113105" }, { "name": "JavaScript", "bytes": "69082" } ], "symlink_target": "" }
<?php /** * @file * Contains \Drupal\Core\Cache\CacheCollector. */ namespace Drupal\Core\Cache; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\DestructableInterface; use Drupal\Core\Lock\LockBackendInterface; /** * Default implementation for CacheCollectorInterface. * * By default, the class accounts for caches where calling functions might * request keys that won't exist even after a cache rebuild. This prevents * situations where a cache rebuild would be triggered over and over due to a * 'missing' item. These cases are stored internally as a value of NULL. This * means that the CacheCollector::get() method must be overridden if caching * data where the values can legitimately be NULL, and where * CacheCollector->has() needs to correctly return (equivalent to * array_key_exists() vs. isset()). This should not be necessary in the majority * of cases. */ abstract class CacheCollector implements CacheCollectorInterface, DestructableInterface { /** * The cache id that is used for the cache entry. * * @var string */ protected $cid; /** * A list of tags that are used for the cache entry. * * @var array */ protected $tags; /** * The cache backend that should be used. * * @var \Drupal\Core\Cache\CacheBackendInterface */ protected $cache; /** * The lock backend that should be used. * * @var \Drupal\Core\Lock\LockBackendInterface */ protected $lock; /** * An array of keys to add to the cache on service termination. * * @var array */ protected $keysToPersist = array(); /** * An array of keys to remove from the cache on service termination. * * @var array */ protected $keysToRemove = array(); /** * Storage for the data itself. * * @var array */ protected $storage = array(); /** * Stores the cache creation time. * * This is used to check if an invalidated cache item has been overwritten in * the meantime. * * @var int */ protected $cacheCreated; /** * Flag that indicates of the cache has been invalidated. * * @var bool */ protected $cacheInvalidated = FALSE; /** * Indicates if the collected cache was already loaded. * * The collected cache is lazy loaded when an entry is set, get or deleted. * * @var bool */ protected $cacheLoaded = FALSE; /** * Constructs a CacheCollector object. * * @param string $cid * The cid for the array being cached. * @param \Drupal\Core\Cache\CacheBackendInterface $cache * The cache backend. * @param \Drupal\Core\Lock\LockBackendInterface $lock * The lock backend. * @param array $tags * (optional) The tags to specify for the cache item. */ public function __construct($cid, CacheBackendInterface $cache, LockBackendInterface $lock, $tags = array()) { $this->cid = $cid; $this->cache = $cache; $this->tags = $tags; $this->lock = $lock; } /** * {@inheritdoc} */ public function has($key) { // Make sure the value is loaded. $this->get($key); return isset($this->storage[$key]) || array_key_exists($key, $this->storage); } /** * {@inheritdoc} */ public function get($key) { $this->lazyLoadCache(); if (isset($this->storage[$key]) || array_key_exists($key, $this->storage)) { return $this->storage[$key]; } else { return $this->resolveCacheMiss($key); } } /** * Implements \Drupal\Core\Cache\CacheCollectorInterface::set(). * * This is not persisted by default. In practice this means that setting a * value will only apply while the object is in scope and will not be written * back to the persistent cache. This follows a similar pattern to static vs. * persistent caching in procedural code. Extending classes may wish to alter * this behavior, for example by adding a call to persist(). */ public function set($key, $value) { $this->lazyLoadCache(); $this->storage[$key] = $value; // The key might have been marked for deletion. unset($this->keysToRemove[$key]); $this->invalidateCache(); } /** * {@inheritdoc} */ public function delete($key) { $this->lazyLoadCache(); unset($this->storage[$key]); $this->keysToRemove[$key] = $key; // The key might have been marked for persisting. unset($this->keysToPersist[$key]); $this->invalidateCache(); } /** * Flags an offset value to be written to the persistent cache. * * @param string $key * The key that was requested. * @param bool $persist * (optional) Whether the offset should be persisted or not, defaults to * TRUE. When called with $persist = FALSE the offset will be unflagged so * that it will not be written at the end of the request. */ protected function persist($key, $persist = TRUE) { $this->keysToPersist[$key] = $persist; } /** * Resolves a cache miss. * * When an offset is not found in the object, this is treated as a cache * miss. This method allows classes using this implementatio to look up the * actual value and allow it to be cached. * * @param sring $key * The offset that was requested. * * @return mixed * The value of the offset, or NULL if no value was found. */ abstract protected function resolveCacheMiss($key); /** * Writes a value to the persistent cache immediately. * * @param bool $lock * (optional) Whether to acquire a lock before writing to cache. Defaults to * TRUE. */ protected function updateCache($lock = TRUE) { $data = array(); foreach ($this->keysToPersist as $offset => $persist) { if ($persist) { $data[$offset] = $this->storage[$offset]; } } if (empty($data) && empty($this->keysToRemove)) { return; } // Lock cache writes to help avoid stampedes. $lock_name = $this->cid . ':' . __CLASS__; if (!$lock || $this->lock->acquire($lock_name)) { // Set and delete operations invalidate the cache item. Try to also load // an eventually invalidated cache entry, only update an invalidated cache // entry if the creation date did not change as this could result in an // inconsistent cache. if ($cache = $this->cache->get($this->cid, $this->cacheInvalidated)) { if ($this->cacheInvalidated && $cache->created != $this->cacheCreated) { // We have invalidated the cache in this request and got a different // cache entry. Do not attempt to overwrite data that might have been // changed in a different request. We'll let the cache rebuild in // later requests. $this->cache->delete($this->cid); $this->lock->release($lock_name); return; } $data = array_merge($cache->data, $data); } // Remove keys marked for deletion. foreach ($this->keysToRemove as $delete_key) { unset($data[$delete_key]); } $this->cache->set($this->cid, $data, CacheBackendInterface::CACHE_PERMANENT, $this->tags); if ($lock) { $this->lock->release($lock_name); } } $this->keysToPersist = array(); $this->keysToRemove = array(); } /** * {@inheritdoc} */ public function reset() { $this->storage = array(); $this->keysToPersist = array(); $this->keysToRemove = array(); $this->cacheLoaded = FALSE; } /** * {@inheritdoc} */ public function clear() { $this->reset(); if ($this->tags) { $this->cache->deleteTags($this->tags); } else { $this->cache->delete($this->cid); } } /** * {@inheritdoc} */ public function destruct() { $this->updateCache(); } /** * Loads the cache if not already done. */ protected function lazyLoadCache() { if ($this->cacheLoaded) { return; } // The cache was not yet loaded, set flag to TRUE. $this->cacheLoaded = TRUE; if ($cache = $this->cache->get($this->cid)) { $this->cacheCreated = $cache->created; $this->storage = $cache->data; } } /** * Invalidate the cache. */ protected function invalidateCache() { // Invalidate the cache to make sure that other requests immediately see the // deletion before this request is terminated. $this->cache->invalidate($this->cid); $this->cacheInvalidated = TRUE; } }
{ "content_hash": "b746c44de14e9ab122cc4ae3da77435b", "timestamp": "", "source": "github", "line_count": 311, "max_line_length": 112, "avg_line_length": 27.14790996784566, "alnum_prop": 0.627383631410636, "repo_name": "nickopris/musicapp", "id": "21d54878ff334edd78a1852955d30d3c8c1c361f", "size": "8443", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "www/core/lib/Drupal/Core/Cache/CacheCollector.php", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "263467" }, { "name": "JavaScript", "bytes": "665433" }, { "name": "PHP", "bytes": "14580545" }, { "name": "Shell", "bytes": "61500" } ], "symlink_target": "" }
import { ModuleWithProviders } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import { AppComponent } from './app.component'; // Pages import { LandingComponent } from './pages/landing/landing.component'; import { PortfolioComponent } from './pages/portfolio/portfolio.component'; import { PortfolioDetailComponent } from './pages/portfolio-detail/portfolio-detail.component'; // Components import { HomeComponent } from './components/home/home.component'; import { ItemComponent } from './components/item/item.component'; import { PageNotFoundComponent } from './pages/page-not-found/page-not-found.component'; export const routes: Routes = [ { path: '', component: LandingComponent, }, { path: 'portfolio', component: PortfolioComponent }, { path: 'portfolio/:name', component: PortfolioDetailComponent }, { path: '**', component: PageNotFoundComponent } ]; export const routing: ModuleWithProviders = RouterModule.forRoot(routes);
{ "content_hash": "051035d2abeb9b99b9e7f33b7f4a284c", "timestamp": "", "source": "github", "line_count": 34, "max_line_length": 95, "avg_line_length": 29.91176470588235, "alnum_prop": 0.7168141592920354, "repo_name": "AlvSovereign/NG2-AlvSovPortfolio", "id": "5122278edd7ebb7906ae7677140f54e8cee8593c", "size": "1017", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/app/app.routes.ts", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "13976" }, { "name": "HTML", "bytes": "13985" }, { "name": "JavaScript", "bytes": "2732" }, { "name": "TypeScript", "bytes": "27864" } ], "symlink_target": "" }
This folder contains manifests for installing `notebook-controller`. The structure is the following: ``` . ├── crd ├── default ├── manager ├── rbac ├── samples ├── base ├── overlays │ ├── kubeflow │ └── standalone ``` The breakdown is the following: - `crd`, `default`, `manager`, `rbac`, `samples`: Kubebuilder-generated structure. We keep this in order to be compatible with kubebuilder workflows. This is not meant for the consumer of the manifests. - `base`, `overlays`: Kustomizations meant for consumption by the user: - `overlays/kubeflow`: Installs `notebook-controller` as part of Kubeflow. The resulting manifests should be the same as the result of the [deprecated `base_v3` from kubeflow/manifests](https://github.com/kubeflow/manifests/tree/306d02979124bc29e48152272ddd60a59be9306c/profiles/base_v3). At a glance, it makes the following changes: - Use namespace `kubeflow`. - Remove namespace resource. - Add KFAM container. - Add KFAM Service and VirtualService. - `overlays/standalone`: Install `notebook-controller` in its own namespace. Useful for testing or for users that prefer to install just the controller. ### CRD Issue We patch the kubebuilder-generated CRD with an older version. That's because the validation was more relaxed in a previous version and now we ended up with some clients and resources in a state that fails more detailed validation, but works correctly. For more information, see: https://github.com/kubeflow/kubeflow/issues/5722
{ "content_hash": "741619e453342519b413326cefeb9165", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 337, "avg_line_length": 54.25, "alnum_prop": 0.7465437788018433, "repo_name": "kubeflow/manifests", "id": "8a3af908b22c9ecaa574c74a937ddaf986691a4d", "size": "1592", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "apps/jupyter/notebook-controller/upstream/README.md", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Makefile", "bytes": "3223" }, { "name": "OpenAPI Specification v2", "bytes": "1069" }, { "name": "Python", "bytes": "77112" }, { "name": "Shell", "bytes": "67051" }, { "name": "Smarty", "bytes": "1079" }, { "name": "YAML", "bytes": "7654384" } ], "symlink_target": "" }
<?php /** * Subclass for representing a row from the 'gg_purchase_calc' table. * * * * @package lib.model */ class GgPurchaseCalc extends BaseGgPurchaseCalc { }
{ "content_hash": "388bb071a511993100eeada8c6abd38b", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 69, "avg_line_length": 15.083333333333334, "alnum_prop": 0.6353591160220995, "repo_name": "vincent03460/fxcmiscc-partner", "id": "887a7ab19534ac5038e0a1a66d4dc3db1964d2c2", "size": "181", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/model/GgPurchaseCalc.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "1626" }, { "name": "CSS", "bytes": "439697" }, { "name": "HTML", "bytes": "87" }, { "name": "JavaScript", "bytes": "765670" }, { "name": "PHP", "bytes": "12209219" }, { "name": "Shell", "bytes": "4594" } ], "symlink_target": "" }
package sistema_de_diagnostico; import com.nilo.plaf.nimrod.NimRODLookAndFeel; import com.nilo.plaf.nimrod.NimRODProgressBarUI; import com.nilo.plaf.nimrod.NimRODTheme; import java.awt.Color; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.ImageIcon; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.plaf.ProgressBarUI; public class Entradita extends javax.swing.JFrame implements Runnable { public void run() { try { initComponents(); setIconImage(new ImageIcon(getClass().getResource("/imagenes/linux.png")).getImage()); setVisible(true); for (int i = 0; i <= 100; i += 5) { if (i == 5) { lblTextito.setText("Cargando Modulos..."); } else if (i == 50) { lblTextito.setText("Cargando Librerias..."); } else if (i == 90) { lblTextito.setText("Iniciando el programa..."); } jpbEntrada.setBackground(Color.BLACK); jpbEntrada.setForeground(jpbEntrada.getForeground()); jpbEntrada.setUI((ProgressBarUI) NimRODProgressBarUI.createUI(null)); jpbEntrada.setValue(i); Thread.sleep(100); } } catch (InterruptedException ex) { Logger.getLogger(Entradita.class.getName()).log(Level.SEVERE, null, ex); } catch (Exception e) { } new Pantalla_Principal().setVisible(true); this.setVisible(false); } @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel1 = new javax.swing.JPanel(); jpbEntrada = new javax.swing.JProgressBar(); lblTextito = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("MICCASIB 1.0"); setUndecorated(true); jPanel1.setName("jPanel1"); // NOI18N jPanel1 = new Panelcito("Azulll.jpg"); jPanel1.setLayout(null); jpbEntrada.setName("jpbEntrada"); // NOI18N jPanel1.add(jpbEntrada); jpbEntrada.setBounds(60, 150, 305, 10); lblTextito.setForeground(new java.awt.Color(0, 51, 51)); lblTextito.setName("lblTextito"); // NOI18N jPanel1.add(lblTextito); lblTextito.setBounds(60, 160, 179, 14); jLabel3.setForeground(new java.awt.Color(0, 51, 51)); jLabel3.setText("® Copyright (C) 2010-2011"); jLabel3.setName("jLabel3"); // NOI18N jPanel1.add(jLabel3); jLabel3.setBounds(112, 267, 305, 14); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 417, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 302, Short.MAX_VALUE) ); java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); setBounds((screenSize.width-417)/2, (screenSize.height-302)/2, 417, 302); }// </editor-fold>//GEN-END:initComponents public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { Entradita e = new Entradita(); Thread t = new Thread(e); t.setDaemon(true); t.start(); NimRODTheme nt = new NimRODTheme(); //Pone en rojo los colores // nt.setPrimary1(new Color(184, 00, 00)); // nt.setPrimary2(new Color(194, 00, 00)); // nt.setPrimary3(new Color(204, 00, 00)); // nt.setSecondary1(new Color(220, 220, 220)); // nt.setSecondary2(new Color(230, 230, 230)); // nt.setSecondary3(new Color(240, 240, 240)); //Pone en azul los colores nt.setPrimary1(new Color(00, 133, 235)); nt.setPrimary2(new Color(00, 143, 245)); nt.setPrimary3(new Color(00, 153, 255)); nt.setSecondary1(new Color(220, 220, 220)); nt.setSecondary2(new Color(230, 230, 230)); nt.setSecondary3(new Color(240, 240, 240)); nt.setWhite(new Color(250, 250, 250)); nt.setBlack(new Color(0, 0, 0)); nt.setOpacity(0); nt.setMenuOpacity(0); nt.setFrameOpacity(0); NimRODLookAndFeel nlf = new NimRODLookAndFeel(); nlf.setCurrentTheme(nt); try { UIManager.setLookAndFeel(nlf); } catch (UnsupportedLookAndFeelException ex) { Logger.getLogger(Entradita.class.getName()).log(Level.SEVERE, null, ex); } } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel jLabel3; private javax.swing.JPanel jPanel1; private javax.swing.JProgressBar jpbEntrada; private javax.swing.JLabel lblTextito; // End of variables declaration//GEN-END:variables }
{ "content_hash": "d0121a4d18fde06d276f94402e548871", "timestamp": "", "source": "github", "line_count": 138, "max_line_length": 98, "avg_line_length": 40.971014492753625, "alnum_prop": 0.5933852140077821, "repo_name": "HConsu/sepsm", "id": "4943f1addf996e29d5fff363771dd673bd0438a1", "size": "5655", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "test/svn/src/sistema_de_diagnostico/Entradita.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "224838" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <recipeml version="0.5"> <recipe> <head> <title>"Drunken" Pork Chops</title> <categories> <cat>Pork</cat> <cat>Main dish</cat></categories> <yield>4</yield></head> <ingredients> <ing> <amt> <qty>4</qty> <unit/></amt> <item>Pork Center Loin Chops; 1- Inch Thick</item></ing> <ing> <amt> <qty>1</qty> <unit>tablespoon</unit></amt> <item>Olive oil</item></ing> <ing> <amt> <qty>1</qty> <unit/></amt> <item>Onion; chopped</item></ing> <ing> <amt> <qty>1 1/2</qty> <unit>teaspoons</unit></amt> <item>Fennel seeds</item></ing> <ing> <amt> <qty>2</qty> <unit>teaspoons</unit></amt> <item>Paprika</item></ing> <ing> <amt> <qty>1/2</qty> <unit>cups</unit></amt> <item>Dry white wine</item></ing> <ing> <amt> <qty>1/2</qty> <unit>cups</unit></amt> <item>Low-Salt Chicken Broth; Canned</item></ing> <ing> <amt> <qty>1</qty> <unit>teaspoon</unit></amt> <item>Fresh lemon juice</item></ing></ingredients> <directions> <step> Season pork with salt and pepper. Heat oil in heavy, large skillet over medium-high heat. Add pork; saute until brown and just cooked through, about 5 minutes per side. Transfer pork to plate; tent with foil to keep warm. Add onion and fennel seeds to same skillet and saute until onion is tender, about 5 minutes. Mix in paprika; stir 15 seconds. Add wine, broth and lemon juice and boil until sauce thickens slightly, scraping up browned bits, about 5 minutes. Season sauce to taste with salt and pepper. Spoon sauce over pork chops and serve. Recipe by: Bon Appetite Posted to MC-Recipe Digest V1 #975 by "Bob &amp; Carole Walberg" &lt;walbergr@mb.sympatico.ca&gt; on Dec 30, 1997 </step></directions></recipe></recipeml>
{ "content_hash": "8c364e396abf23a9d3ccca0edb6c079c", "timestamp": "", "source": "github", "line_count": 67, "max_line_length": 85, "avg_line_length": 32.07462686567164, "alnum_prop": 0.545835272219637, "repo_name": "coogle/coogle-recipes", "id": "5bf39f0dc6966d7a972e81490cb8456e6f113ea9", "size": "2149", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "extras/recipes/_Drunken__Pork_Chops.xml", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "Blade", "bytes": "70365" }, { "name": "CSS", "bytes": "2508" }, { "name": "HTML", "bytes": "1294" }, { "name": "JavaScript", "bytes": "1133" }, { "name": "PHP", "bytes": "130922" }, { "name": "Puppet", "bytes": "23814" }, { "name": "SCSS", "bytes": "1015" }, { "name": "Shell", "bytes": "3538" }, { "name": "Vue", "bytes": "559" } ], "symlink_target": "" }
using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms; namespace ReniUI { public interface IApplication { void Register(Form frame); } }
{ "content_hash": "9e842456de3a103e9b358aba83529653", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 34, "avg_line_length": 16.416666666666668, "alnum_prop": 0.7157360406091371, "repo_name": "hahoyer/reni.cs", "id": "4ee4b53f20bdaeb19e32ec63b214df2473a4dac4", "size": "197", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/ReniUIWithForms/IApplication.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "1785399" }, { "name": "HTML", "bytes": "11724" }, { "name": "JavaScript", "bytes": "202" } ], "symlink_target": "" }
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>AdminLTE 2 | Invoice</title> <!-- Tell the browser to be responsive to screen width --> <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"> <!-- Bootstrap 3.3.6 --> <link rel="stylesheet" href="../../bootstrap/css/bootstrap.min.css"> <!-- Font Awesome --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css"> <!-- Ionicons --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css"> <!-- Theme style --> <link rel="stylesheet" href="../../dist/css/AdminLTE.min.css"> <!-- AdminLTE Skins. Choose a skin from the css/skins folder instead of downloading all of them to reduce the load. --> <link rel="stylesheet" href="../../dist/css/skins/_all-skins.min.css"> <!-- 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.3/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body class="hold-transition skin-blue sidebar-mini"> <div class="wrapper"> <header class="main-header"> <!-- Logo --> <a href="../../index2.html" class="logo"> <!-- mini logo for sidebar mini 50x50 pixels --> <span class="logo-mini"><b>A</b>LT</span> <!-- logo for regular state and mobile devices --> <span class="logo-lg"><b>Admin</b>LTE</span> </a> <!-- Header Navbar: style can be found in header.less --> <nav class="navbar navbar-static-top"> <!-- Sidebar toggle button--> <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </a> <div class="navbar-custom-menu"> <ul class="nav navbar-nav"> <!-- Messages: style can be found in dropdown.less--> <li class="dropdown messages-menu"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"> <i class="fa fa-envelope-o"></i> <span class="label label-success">4</span> </a> <ul class="dropdown-menu"> <li class="header">You have 4 messages</li> <li> <!-- inner menu: contains the actual data --> <ul class="menu"> <li><!-- start message --> <a href="#"> <div class="pull-left"> <img src="../../dist/img/user2-160x160.jpg" class="img-circle" alt="User Image"> </div> <h4> Support Team <small><i class="fa fa-clock-o"></i> 5 mins</small> </h4> <p>Why not buy a new awesome theme?</p> </a> </li> <!-- end message --> <li> <a href="#"> <div class="pull-left"> <img src="../../dist/img/user3-128x128.jpg" class="img-circle" alt="User Image"> </div> <h4> AdminLTE Design Team <small><i class="fa fa-clock-o"></i> 2 hours</small> </h4> <p>Why not buy a new awesome theme?</p> </a> </li> <li> <a href="#"> <div class="pull-left"> <img src="../../dist/img/user4-128x128.jpg" class="img-circle" alt="User Image"> </div> <h4> Developers <small><i class="fa fa-clock-o"></i> Today</small> </h4> <p>Why not buy a new awesome theme?</p> </a> </li> <li> <a href="#"> <div class="pull-left"> <img src="../../dist/img/user3-128x128.jpg" class="img-circle" alt="User Image"> </div> <h4> Sales Department <small><i class="fa fa-clock-o"></i> Yesterday</small> </h4> <p>Why not buy a new awesome theme?</p> </a> </li> <li> <a href="#"> <div class="pull-left"> <img src="../../dist/img/user4-128x128.jpg" class="img-circle" alt="User Image"> </div> <h4> Reviewers <small><i class="fa fa-clock-o"></i> 2 days</small> </h4> <p>Why not buy a new awesome theme?</p> </a> </li> </ul> </li> <li class="footer"><a href="#">See All Messages</a></li> </ul> </li> <!-- Notifications: style can be found in dropdown.less --> <li class="dropdown notifications-menu"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"> <i class="fa fa-bell-o"></i> <span class="label label-warning">10</span> </a> <ul class="dropdown-menu"> <li class="header">You have 10 notifications</li> <li> <!-- inner menu: contains the actual data --> <ul class="menu"> <li> <a href="#"> <i class="fa fa-users text-aqua"></i> 5 new members joined today </a> </li> <li> <a href="#"> <i class="fa fa-warning text-yellow"></i> Very long description here that may not fit into the page and may cause design problems </a> </li> <li> <a href="#"> <i class="fa fa-users text-red"></i> 5 new members joined </a> </li> <li> <a href="#"> <i class="fa fa-shopping-cart text-green"></i> 25 sales made </a> </li> <li> <a href="#"> <i class="fa fa-user text-red"></i> You changed your username </a> </li> </ul> </li> <li class="footer"><a href="#">View all</a></li> </ul> </li> <!-- Tasks: style can be found in dropdown.less --> <li class="dropdown tasks-menu"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"> <i class="fa fa-flag-o"></i> <span class="label label-danger">9</span> </a> <ul class="dropdown-menu"> <li class="header">You have 9 tasks</li> <li> <!-- inner menu: contains the actual data --> <ul class="menu"> <li><!-- Task item --> <a href="#"> <h3> Design some buttons <small class="pull-right">20%</small> </h3> <div class="progress xs"> <div class="progress-bar progress-bar-aqua" style="width: 20%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100"> <span class="sr-only">20% Complete</span> </div> </div> </a> </li> <!-- end task item --> <li><!-- Task item --> <a href="#"> <h3> Create a nice theme <small class="pull-right">40%</small> </h3> <div class="progress xs"> <div class="progress-bar progress-bar-green" style="width: 40%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100"> <span class="sr-only">40% Complete</span> </div> </div> </a> </li> <!-- end task item --> <li><!-- Task item --> <a href="#"> <h3> Some task I need to do <small class="pull-right">60%</small> </h3> <div class="progress xs"> <div class="progress-bar progress-bar-red" style="width: 60%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100"> <span class="sr-only">60% Complete</span> </div> </div> </a> </li> <!-- end task item --> <li><!-- Task item --> <a href="#"> <h3> Make beautiful transitions <small class="pull-right">80%</small> </h3> <div class="progress xs"> <div class="progress-bar progress-bar-yellow" style="width: 80%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100"> <span class="sr-only">80% Complete</span> </div> </div> </a> </li> <!-- end task item --> </ul> </li> <li class="footer"> <a href="#">View all tasks</a> </li> </ul> </li> <!-- User Account: style can be found in dropdown.less --> <li class="dropdown user user-menu"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"> <img src="../../dist/img/user2-160x160.jpg" class="user-image" alt="User Image"> <span class="hidden-xs">Alexander Pierce</span> </a> <ul class="dropdown-menu"> <!-- User image --> <li class="user-header"> <img src="../../dist/img/user2-160x160.jpg" class="img-circle" alt="User Image"> <p> Alexander Pierce - Web Developer <small>Member since Nov. 2012</small> </p> </li> <!-- Menu Body --> <li class="user-body"> <div class="row"> <div class="col-xs-4 text-center"> <a href="#">Followers</a> </div> <div class="col-xs-4 text-center"> <a href="#">Sales</a> </div> <div class="col-xs-4 text-center"> <a href="#">Friends</a> </div> </div> <!-- /.row --> </li> <!-- Menu Footer--> <li class="user-footer"> <div class="pull-left"> <a href="#" class="btn btn-default btn-flat">Profile</a> </div> <div class="pull-right"> <a href="#" class="btn btn-default btn-flat">Sign out</a> </div> </li> </ul> </li> <!-- Control Sidebar Toggle Button --> <li> <a href="#" data-toggle="control-sidebar"><i class="fa fa-gears"></i></a> </li> </ul> </div> </nav> </header> <!-- Left side column. contains the logo and sidebar --> <aside class="main-sidebar"> <!-- sidebar: style can be found in sidebar.less --> <section class="sidebar"> <!-- Sidebar user panel --> <div class="user-panel"> <div class="pull-left image"> <img src="../../dist/img/user2-160x160.jpg" class="img-circle" alt="User Image"> </div> <div class="pull-left info"> <p>Alexander Pierce</p> <a href="#"><i class="fa fa-circle text-success"></i> Online</a> </div> </div> <!-- search form --> <form action="#" method="get" class="sidebar-form"> <div class="input-group"> <input type="text" name="q" class="form-control" placeholder="Search..."> <span class="input-group-btn"> <button type="submit" name="search" id="search-btn" class="btn btn-flat"><i class="fa fa-search"></i> </button> </span> </div> </form> <!-- /.search form --> <!-- sidebar menu: : style can be found in sidebar.less --> <ul class="sidebar-menu"> <li class="header">MAIN NAVIGATION</li> <li class="treeview"> <a href="#"> <i class="fa fa-dashboard"></i> <span>Dashboard</span> <span class="pull-right-container"> <i class="fa fa-angle-left pull-right"></i> </span> </a> <ul class="treeview-menu"> <li><a href="../../index.html"><i class="fa fa-circle-o"></i> Dashboard v1</a></li> <li><a href="../../index2.html"><i class="fa fa-circle-o"></i> Dashboard v2</a></li> </ul> </li> <li class="treeview"> <a href="#"> <i class="fa fa-files-o"></i> <span>Layout Options</span> <span class="pull-right-container"> <span class="label label-primary pull-right">4</span> </span> </a> <ul class="treeview-menu"> <li><a href="../layout/top-nav.html"><i class="fa fa-circle-o"></i> Top Navigation</a></li> <li><a href="../layout/boxed.html"><i class="fa fa-circle-o"></i> Boxed</a></li> <li><a href="../layout/fixed.html"><i class="fa fa-circle-o"></i> Fixed</a></li> <li><a href="../layout/collapsed-sidebar.html"><i class="fa fa-circle-o"></i> Collapsed Sidebar</a></li> </ul> </li> <li> <a href="../widgets.html"> <i class="fa fa-th"></i> <span>Widgets</span> <span class="pull-right-container"> <small class="label pull-right bg-green">new</small> </span> </a> </li> <li class="treeview"> <a href="#"> <i class="fa fa-pie-chart"></i> <span>Charts</span> <span class="pull-right-container"> <i class="fa fa-angle-left pull-right"></i> </span> </a> <ul class="treeview-menu"> <li><a href="../charts/chartjs.html"><i class="fa fa-circle-o"></i> ChartJS</a></li> <li><a href="../charts/morris.html"><i class="fa fa-circle-o"></i> Morris</a></li> <li><a href="../charts/flot.html"><i class="fa fa-circle-o"></i> Flot</a></li> <li><a href="../charts/inline.html"><i class="fa fa-circle-o"></i> Inline charts</a></li> </ul> </li> <li class="treeview"> <a href="#"> <i class="fa fa-laptop"></i> <span>UI Elements</span> <span class="pull-right-container"> <i class="fa fa-angle-left pull-right"></i> </span> </a> <ul class="treeview-menu"> <li><a href="../UI/general.html"><i class="fa fa-circle-o"></i> General</a></li> <li><a href="../UI/icons.html"><i class="fa fa-circle-o"></i> Icons</a></li> <li><a href="../UI/buttons.html"><i class="fa fa-circle-o"></i> Buttons</a></li> <li><a href="../UI/sliders.html"><i class="fa fa-circle-o"></i> Sliders</a></li> <li><a href="../UI/modals.html"><i class="fa fa-circle-o"></i> Modals</a></li> </ul> </li> <li class="treeview"> <a href="#"> <i class="fa fa-edit"></i> <span>Forms</span> <span class="pull-right-container"> <i class="fa fa-angle-left pull-right"></i> </span> </a> <ul class="treeview-menu"> <li><a href="../forms/general.html"><i class="fa fa-circle-o"></i> General Elements</a></li> <li><a href="../forms/advanced.html"><i class="fa fa-circle-o"></i> Advanced Elements</a></li> <li><a href="../forms/editors.html"><i class="fa fa-circle-o"></i> Editors</a></li> </ul> </li> <li class="treeview"> <a href="#"> <i class="fa fa-table"></i> <span>Tables</span> <span class="pull-right-container"> <i class="fa fa-angle-left pull-right"></i> </span> </a> <ul class="treeview-menu"> <li><a href="../tables/simple.html"><i class="fa fa-circle-o"></i> Simple tables</a></li> <li><a href="../tables/data.html"><i class="fa fa-circle-o"></i> Data tables</a></li> </ul> </li> <li> <a href="../calendar.html"> <i class="fa fa-calendar"></i> <span>Calendar</span> <span class="pull-right-container"> <small class="label pull-right bg-red">3</small> <small class="label pull-right bg-blue">17</small> </span> </a> </li> <li> <a href="../mailbox/mailbox.html"> <i class="fa fa-envelope"></i> <span>Mailbox</span> <span class="pull-right-container"> <small class="label pull-right bg-yellow">12</small> <small class="label pull-right bg-green">16</small> <small class="label pull-right bg-red">5</small> </span> </a> </li> <li class="treeview active"> <a href="#"> <i class="fa fa-folder"></i> <span>Examples</span> <span class="pull-right-container"> <i class="fa fa-angle-left pull-right"></i> </span> </a> <ul class="treeview-menu"> <li class="active"><a href="invoice.html"><i class="fa fa-circle-o"></i> Invoice</a></li> <li><a href="profile.html"><i class="fa fa-circle-o"></i> Profile</a></li> <li><a href="login.html"><i class="fa fa-circle-o"></i> Login</a></li> <li><a href="register.html"><i class="fa fa-circle-o"></i> Register</a></li> <li><a href="lockscreen.html"><i class="fa fa-circle-o"></i> Lockscreen</a></li> <li><a href="404.html"><i class="fa fa-circle-o"></i> 404 Error</a></li> <li><a href="500.html"><i class="fa fa-circle-o"></i> 500 Error</a></li> <li><a href="blank.html"><i class="fa fa-circle-o"></i> Blank Page</a></li> <li><a href="pace.html"><i class="fa fa-circle-o"></i> Pace Page</a></li> </ul> </li> <li class="treeview"> <a href="#"> <i class="fa fa-share"></i> <span>Multilevel</span> <span class="pull-right-container"> <i class="fa fa-angle-left pull-right"></i> </span> </a> <ul class="treeview-menu"> <li><a href="#"><i class="fa fa-circle-o"></i> Level One</a></li> <li> <a href="#"><i class="fa fa-circle-o"></i> Level One <span class="pull-right-container"> <i class="fa fa-angle-left pull-right"></i> </span> </a> <ul class="treeview-menu"> <li><a href="#"><i class="fa fa-circle-o"></i> Level Two</a></li> <li> <a href="#"><i class="fa fa-circle-o"></i> Level Two <span class="pull-right-container"> <i class="fa fa-angle-left pull-right"></i> </span> </a> <ul class="treeview-menu"> <li><a href="#"><i class="fa fa-circle-o"></i> Level Three</a></li> <li><a href="#"><i class="fa fa-circle-o"></i> Level Three</a></li> </ul> </li> </ul> </li> <li><a href="#"><i class="fa fa-circle-o"></i> Level One</a></li> </ul> </li> <li><a href="../../documentation/index.html"><i class="fa fa-book"></i> <span>Documentation</span></a></li> <li class="header">LABELS</li> <li><a href="#"><i class="fa fa-circle-o text-red"></i> <span>Important</span></a></li> <li><a href="#"><i class="fa fa-circle-o text-yellow"></i> <span>Warning</span></a></li> <li><a href="#"><i class="fa fa-circle-o text-aqua"></i> <span>Information</span></a></li> </ul> </section> <!-- /.sidebar --> </aside> <!-- Content Wrapper. Contains page content --> <div class="content-wrapper"> <!-- Content Header (Page header) --> <section class="content-header"> <h1> Invoice <small>#007612</small> </h1> <ol class="breadcrumb"> <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li> <li><a href="#">Examples</a></li> <li class="active">Invoice</li> </ol> </section> <div class="pad margin no-print"> <div class="callout callout-info" style="margin-bottom: 0!important;"> <h4><i class="fa fa-info"></i> Note:</h4> This page has been enhanced for printing. Click the print button at the bottom of the invoice to test. </div> </div> <!-- Main content --> <section class="invoice"> <!-- title row --> <div class="row"> <div class="col-xs-12"> <h2 class="page-header"> <i class="fa fa-globe"></i> AdminLTE, Inc. <small class="pull-right">Date: 2/10/2014</small> </h2> </div> <!-- /.col --> </div> <!-- info row --> <div class="row invoice-info"> <div class="col-sm-4 invoice-col"> From <address> <strong>Admin, Inc.</strong><br> 795 Folsom Ave, Suite 600<br> San Francisco, CA 94107<br> Phone: (804) 123-5432<br> Email: info@almasaeedstudio.com </address> </div> <!-- /.col --> <div class="col-sm-4 invoice-col"> To <address> <strong>John Doe</strong><br> 795 Folsom Ave, Suite 600<br> San Francisco, CA 94107<br> Phone: (555) 539-1037<br> Email: john.doe@example.com </address> </div> <!-- /.col --> <div class="col-sm-4 invoice-col"> <b>Invoice #007612</b><br> <br> <b>Order ID:</b> 4F3S8J<br> <b>Payment Due:</b> 2/22/2014<br> <b>Account:</b> 968-34567 </div> <!-- /.col --> </div> <!-- /.row --> <!-- Table row --> <div class="row"> <div class="col-xs-12 table-responsive"> <table class="table table-striped"> <thead> <tr> <th>Qty</th> <th>Product</th> <th>Serial #</th> <th>Description</th> <th>Subtotal</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>Call of Duty</td> <td>455-981-221</td> <td>El snort testosterone trophy driving gloves handsome</td> <td>$64.50</td> </tr> <tr> <td>1</td> <td>Need for Speed IV</td> <td>247-925-726</td> <td>Wes Anderson umami biodiesel</td> <td>$50.00</td> </tr> <tr> <td>1</td> <td>Monsters DVD</td> <td>735-845-642</td> <td>Terry Richardson helvetica tousled street art master</td> <td>$10.70</td> </tr> <tr> <td>1</td> <td>Grown Ups Blue Ray</td> <td>422-568-642</td> <td>Tousled lomo letterpress</td> <td>$25.99</td> </tr> </tbody> </table> </div> <!-- /.col --> </div> <!-- /.row --> <div class="row"> <!-- accepted payments column --> <div class="col-xs-6"> <p class="lead">Payment Methods:</p> <img src="../../dist/img/credit/visa.png" alt="Visa"> <img src="../../dist/img/credit/mastercard.png" alt="Mastercard"> <img src="../../dist/img/credit/american-express.png" alt="American Express"> <img src="../../dist/img/credit/paypal2.png" alt="Paypal"> <p class="text-muted well well-sm no-shadow" style="margin-top: 10px;"> Etsy doostang zoodles disqus groupon greplin oooj voxy zoodles, weebly ning heekya handango imeem plugg dopplr jibjab, movity jajah plickers sifteo edmodo ifttt zimbra. </p> </div> <!-- /.col --> <div class="col-xs-6"> <p class="lead">Amount Due 2/22/2014</p> <div class="table-responsive"> <table class="table"> <tr> <th style="width:50%">Subtotal:</th> <td>$250.30</td> </tr> <tr> <th>Tax (9.3%)</th> <td>$10.34</td> </tr> <tr> <th>Shipping:</th> <td>$5.80</td> </tr> <tr> <th>Total:</th> <td>$265.24</td> </tr> </table> </div> </div> <!-- /.col --> </div> <!-- /.row --> <!-- this row will not appear when printing --> <div class="row no-print"> <div class="col-xs-12"> <a href="invoice-print.html" target="_blank" class="btn btn-default"><i class="fa fa-print"></i> Print</a> <button type="button" class="btn btn-success pull-right"><i class="fa fa-credit-card"></i> Submit Payment </button> <button type="button" class="btn btn-primary pull-right" style="margin-right: 5px;"> <i class="fa fa-download"></i> Generate PDF </button> </div> </div> </section> <!-- /.content --> <div class="clearfix"></div> </div> <!-- /.content-wrapper --> <footer class="main-footer no-print"> <div class="pull-right hidden-xs"> <b>Version</b> 2.3.11 </div> <strong>Copyright &copy; 2014-2016 <a href="http://almsaeedstudio.com">Almsaeed Studio</a>.</strong> All rights reserved. </footer> <!-- Control Sidebar --> <aside class="control-sidebar control-sidebar-dark"> <!-- Create the tabs --> <ul class="nav nav-tabs nav-justified control-sidebar-tabs"> <li><a href="#control-sidebar-home-tab" data-toggle="tab"><i class="fa fa-home"></i></a></li> <li><a href="#control-sidebar-settings-tab" data-toggle="tab"><i class="fa fa-gears"></i></a></li> </ul> <!-- Tab panes --> <div class="tab-content"> <!-- Home tab content --> <div class="tab-pane" id="control-sidebar-home-tab"> <h3 class="control-sidebar-heading">Recent Activity</h3> <ul class="control-sidebar-menu"> <li> <a href="javascript:void(0)"> <i class="menu-icon fa fa-birthday-cake bg-red"></i> <div class="menu-info"> <h4 class="control-sidebar-subheading">Langdon's Birthday</h4> <p>Will be 23 on April 24th</p> </div> </a> </li> <li> <a href="javascript:void(0)"> <i class="menu-icon fa fa-user bg-yellow"></i> <div class="menu-info"> <h4 class="control-sidebar-subheading">Frodo Updated His Profile</h4> <p>New phone +1(800)555-1234</p> </div> </a> </li> <li> <a href="javascript:void(0)"> <i class="menu-icon fa fa-envelope-o bg-light-blue"></i> <div class="menu-info"> <h4 class="control-sidebar-subheading">Nora Joined Mailing List</h4> <p>nora@example.com</p> </div> </a> </li> <li> <a href="javascript:void(0)"> <i class="menu-icon fa fa-file-code-o bg-green"></i> <div class="menu-info"> <h4 class="control-sidebar-subheading">Cron Job 254 Executed</h4> <p>Execution time 5 seconds</p> </div> </a> </li> </ul> <!-- /.control-sidebar-menu --> <h3 class="control-sidebar-heading">Tasks Progress</h3> <ul class="control-sidebar-menu"> <li> <a href="javascript:void(0)"> <h4 class="control-sidebar-subheading"> Custom Template Design <span class="label label-danger pull-right">70%</span> </h4> <div class="progress progress-xxs"> <div class="progress-bar progress-bar-danger" style="width: 70%"></div> </div> </a> </li> <li> <a href="javascript:void(0)"> <h4 class="control-sidebar-subheading"> Update Resume <span class="label label-success pull-right">95%</span> </h4> <div class="progress progress-xxs"> <div class="progress-bar progress-bar-success" style="width: 95%"></div> </div> </a> </li> <li> <a href="javascript:void(0)"> <h4 class="control-sidebar-subheading"> Laravel Integration <span class="label label-warning pull-right">50%</span> </h4> <div class="progress progress-xxs"> <div class="progress-bar progress-bar-warning" style="width: 50%"></div> </div> </a> </li> <li> <a href="javascript:void(0)"> <h4 class="control-sidebar-subheading"> Back End Framework <span class="label label-primary pull-right">68%</span> </h4> <div class="progress progress-xxs"> <div class="progress-bar progress-bar-primary" style="width: 68%"></div> </div> </a> </li> </ul> <!-- /.control-sidebar-menu --> </div> <!-- /.tab-pane --> <!-- Stats tab content --> <div class="tab-pane" id="control-sidebar-stats-tab">Stats Tab Content</div> <!-- /.tab-pane --> <!-- Settings tab content --> <div class="tab-pane" id="control-sidebar-settings-tab"> <form method="post"> <h3 class="control-sidebar-heading">General Settings</h3> <div class="form-group"> <label class="control-sidebar-subheading"> Report panel usage <input type="checkbox" class="pull-right" checked> </label> <p> Some information about this general settings option </p> </div> <!-- /.form-group --> <div class="form-group"> <label class="control-sidebar-subheading"> Allow mail redirect <input type="checkbox" class="pull-right" checked> </label> <p> Other sets of options are available </p> </div> <!-- /.form-group --> <div class="form-group"> <label class="control-sidebar-subheading"> Expose author name in posts <input type="checkbox" class="pull-right" checked> </label> <p> Allow the user to show his name in blog posts </p> </div> <!-- /.form-group --> <h3 class="control-sidebar-heading">Chat Settings</h3> <div class="form-group"> <label class="control-sidebar-subheading"> Show me as online <input type="checkbox" class="pull-right" checked> </label> </div> <!-- /.form-group --> <div class="form-group"> <label class="control-sidebar-subheading"> Turn off notifications <input type="checkbox" class="pull-right"> </label> </div> <!-- /.form-group --> <div class="form-group"> <label class="control-sidebar-subheading"> Delete chat history <a href="javascript:void(0)" class="text-red pull-right"><i class="fa fa-trash-o"></i></a> </label> </div> <!-- /.form-group --> </form> </div> <!-- /.tab-pane --> </div> </aside> <!-- /.control-sidebar --> <!-- Add the sidebar's background. This div must be placed immediately after the control sidebar --> <div class="control-sidebar-bg"></div> </div> <!-- ./wrapper --> <!-- jQuery 2.2.3 --> <script src="../../plugins/jQuery/jquery-2.2.3.min.js"></script> <!-- Bootstrap 3.3.6 --> <script src="../../bootstrap/js/bootstrap.min.js"></script> <!-- FastClick --> <script src="../../plugins/fastclick/fastclick.js"></script> <!-- AdminLTE App --> <script src="../../dist/js/app.min.js"></script> <!-- AdminLTE for demo purposes --> <script src="../../dist/js/demo.js"></script> </body> </html>
{ "content_hash": "d0e57afcc1d134eb3087cf1e2c1907ba", "timestamp": "", "source": "github", "line_count": 886, "max_line_length": 165, "avg_line_length": 39.103837471783294, "alnum_prop": 0.4505859262252497, "repo_name": "danemmanuel/freenew", "id": "5f22fc908d34e50d0719c3eeb5699558d7a5bbf4", "size": "34646", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "conta/c/pages/examples/invoice.html", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "166" }, { "name": "CSS", "bytes": "1848605" }, { "name": "HTML", "bytes": "6950486" }, { "name": "JavaScript", "bytes": "6050373" }, { "name": "PHP", "bytes": "720185" } ], "symlink_target": "" }
namespace ROOT_PROJECT_NAMESPACE.Areas.HelpPage.ModelDescriptions { public class DictionaryModelDescription : KeyValuePairModelDescription { } }
{ "content_hash": "3ea40ab0e696daf26e0c54863999a40b", "timestamp": "", "source": "github", "line_count": 6, "max_line_length": 74, "avg_line_length": 26.166666666666668, "alnum_prop": 0.7898089171974523, "repo_name": "Terminator-Aaron/Katana", "id": "591cc41f1417bca14ba9395a9b13e2c7900311c8", "size": "159", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "aspnetwebsrc/WebApiHelpPage/Areas/HelpPage/ModelDescriptions/DictionaryModelDescription.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ASP", "bytes": "10480" }, { "name": "C#", "bytes": "17928568" }, { "name": "CSS", "bytes": "19810" }, { "name": "HTML", "bytes": "2554" }, { "name": "JavaScript", "bytes": "11545" }, { "name": "PowerShell", "bytes": "20946" }, { "name": "Shell", "bytes": "12306" }, { "name": "Smalltalk", "bytes": "50876" }, { "name": "Visual Basic", "bytes": "157681" } ], "symlink_target": "" }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using NUnit.Framework; using RxAs.Rx4.ProofTests.Mock; using System.Concurrency; namespace RxAs.Rx4.ProofTests.Operators { [TestFixture] public class WndowWithTimeFixture { private StatsObserver<IObservable<int>> stats = new StatsObserver<IObservable<int>>(); private Subject<int> subject = new Subject<int>(); private TimeSpan timeSpan = TimeSpan.FromMilliseconds(50); private TimeSpan timeShift = TimeSpan.FromMilliseconds(10); private TestScheduler scheduler = new TestScheduler(); [SetUp] public void SetUp() { stats = new StatsObserver<IObservable<int>>(); subject = new Subject<int>(); timeSpan = TimeSpan.FromMilliseconds(50); timeShift = TimeSpan.FromMilliseconds(10); scheduler = new TestScheduler(); } [Test] public void genenrates_window_on_subscription_using_scheduler() { subject.WindowWithTime(timeSpan, timeShift, scheduler) .Subscribe(stats); Assert.AreEqual(0, stats.NextCount); scheduler.RunTo(1); Assert.AreEqual(1, stats.NextCount); } [Test] public void genenrates_new_window_after_timeshift() { subject.WindowWithTime(timeSpan, timeShift, scheduler) .Subscribe(stats); scheduler.RunTo(timeShift.Ticks + 1); Assert.AreEqual(2, stats.NextCount); } } }
{ "content_hash": "d532072bc032a4606071503ff5e7e93c", "timestamp": "", "source": "github", "line_count": 59, "max_line_length": 94, "avg_line_length": 27.11864406779661, "alnum_prop": 0.619375, "repo_name": "richardszalay/raix", "id": "86479a4e4d102dd8f5b0268851cb5fa655dc62e2", "size": "1602", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "prooftests/source/RxAs.Rx4.ProofTests/Operators/WndowWithTimeFixture.cs", "mode": "33188", "license": "mit", "language": [ { "name": "ActionScript", "bytes": "738723" }, { "name": "C#", "bytes": "299053" }, { "name": "JavaScript", "bytes": "45931" } ], "symlink_target": "" }
<!DOCTYPE html> <html> <head> <meta name='viewport' content:'width=device-width, initial-scale=1.0'> <meta charset='utf-8'> <title>Bulgakov Layout</title> <link rel='stylesheet' href='../src/bulgakov.css'> <link rel='stylesheet' href='example.css'> </head> <body> <div class='bkv_container'> <nav class='bkv_menu'> <div class='bkv_persistent'> <a class='bkv_menu_trigger'></a> </div> <div class='bkv_collapsible'> </div> </nav> <div class='bkv_main'></div> </div> <script src='../src/bulgakov.js'></script> </body> </html>
{ "content_hash": "09fdef44da8dcc0d806847a0b5ef9872", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 72, "avg_line_length": 22.5, "alnum_prop": 0.5982905982905983, "repo_name": "sethbonnie/Bulgakov", "id": "05c5c48e36ead95988fdb4f2c31abd2c2d7d2bad", "size": "585", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "example/example.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "4270" }, { "name": "JavaScript", "bytes": "845" } ], "symlink_target": "" }
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <title>Incomplete Beta Functions</title> <link rel="stylesheet" href="../../../../../../../../doc/src/boostbook.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.77.1"> <link rel="home" href="../../../index.html" title="Math Toolkit"> <link rel="up" href="../sf_beta.html" title="Beta Functions"> <link rel="prev" href="beta_function.html" title="Beta"> <link rel="next" href="ibeta_inv_function.html" title="The Incomplete Beta Function Inverses"> </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="beta_function.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../sf_beta.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="ibeta_inv_function.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a> </div> <div class="section"> <div class="titlepage"><div><div><h4 class="title"> <a name="math_toolkit.special.sf_beta.ibeta_function"></a><a class="link" href="ibeta_function.html" title="Incomplete Beta Functions">Incomplete Beta Functions</a> </h4></div></div></div> <h5> <a name="math_toolkit.special.sf_beta.ibeta_function.h0"></a> <span class="phrase"><a name="math_toolkit.special.sf_beta.ibeta_function.synopsis"></a></span><a class="link" href="ibeta_function.html#math_toolkit.special.sf_beta.ibeta_function.synopsis">Synopsis</a> </h5> <p> </p> <pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">special_functions</span><span class="special">/</span><span class="identifier">beta</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span> </pre> <p> </p> <pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">math</span><span class="special">{</span> <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">&gt;</span> <a class="link" href="../../main_overview/result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">ibeta</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">T3</span> <span class="identifier">x</span><span class="special">);</span> <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../policy.html" title="Policies">Policy</a><span class="special">&gt;</span> <a class="link" href="../../main_overview/result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">ibeta</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">T3</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Policies">Policy</a><span class="special">&amp;);</span> <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">&gt;</span> <a class="link" href="../../main_overview/result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">ibetac</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">T3</span> <span class="identifier">x</span><span class="special">);</span> <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../policy.html" title="Policies">Policy</a><span class="special">&gt;</span> <a class="link" href="../../main_overview/result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">ibetac</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">T3</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Policies">Policy</a><span class="special">&amp;);</span> <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">&gt;</span> <a class="link" href="../../main_overview/result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">beta</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">T3</span> <span class="identifier">x</span><span class="special">);</span> <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../policy.html" title="Policies">Policy</a><span class="special">&gt;</span> <a class="link" href="../../main_overview/result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">beta</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">T3</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Policies">Policy</a><span class="special">&amp;);</span> <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">&gt;</span> <a class="link" href="../../main_overview/result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">betac</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">T3</span> <span class="identifier">x</span><span class="special">);</span> <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../policy.html" title="Policies">Policy</a><span class="special">&gt;</span> <a class="link" href="../../main_overview/result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">betac</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">T3</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Policies">Policy</a><span class="special">&amp;);</span> <span class="special">}}</span> <span class="comment">// namespaces</span> </pre> <h5> <a name="math_toolkit.special.sf_beta.ibeta_function.h1"></a> <span class="phrase"><a name="math_toolkit.special.sf_beta.ibeta_function.description"></a></span><a class="link" href="ibeta_function.html#math_toolkit.special.sf_beta.ibeta_function.description">Description</a> </h5> <p> There are four <a href="http://en.wikipedia.org/wiki/Incomplete_beta_function" target="_top">incomplete beta functions</a> : two are normalised versions (also known as <span class="emphasis"><em>regularized</em></span> beta functions) that return values in the range [0, 1], and two are non-normalised and return values in the range [0, <a class="link" href="beta_function.html" title="Beta">beta</a>(a, b)]. Users interested in statistical applications should use the normalised (or <a href="http://mathworld.wolfram.com/RegularizedBetaFunction.html" target="_top">regularized</a> ) versions (ibeta and ibetac). </p> <p> All of these functions require <span class="emphasis"><em>0 &lt;= x &lt;= 1</em></span>. </p> <p> The normalized functions <a class="link" href="ibeta_function.html" title="Incomplete Beta Functions">ibeta</a> and <a class="link" href="ibeta_function.html" title="Incomplete Beta Functions">ibetac</a> require <span class="emphasis"><em>a,b &gt;= 0</em></span>, and in addition that not both <span class="emphasis"><em>a</em></span> and <span class="emphasis"><em>b</em></span> are zero. </p> <p> The functions <a class="link" href="beta_function.html" title="Beta">beta</a> and <a class="link" href="ibeta_function.html" title="Incomplete Beta Functions">betac</a> require <span class="emphasis"><em>a,b &gt; 0</em></span>. </p> <p> The return type of these functions is computed using the <a class="link" href="../../main_overview/result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>result type calculation rules</em></span></a> when T1, T2 and T3 are different types. </p> <p> The final <a class="link" href="../../policy.html" title="Policies">Policy</a> argument is optional and can be used to control the behaviour of the function: how it handles errors, what level of precision to use etc. Refer to the <a class="link" href="../../policy.html" title="Policies">policy documentation for more details</a>. </p> <pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">&gt;</span> <a class="link" href="../../main_overview/result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">ibeta</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">T3</span> <span class="identifier">x</span><span class="special">);</span> <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../policy.html" title="Policies">Policy</a><span class="special">&gt;</span> <a class="link" href="../../main_overview/result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">ibeta</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">T3</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Policies">Policy</a><span class="special">&amp;);</span> </pre> <p> Returns the normalised incomplete beta function of a, b and x: </p> <p> <span class="inlinemediaobject"><img src="../../../../equations/ibeta3.png"></span> </p> <p> <span class="inlinemediaobject"><img src="../../../../graphs/ibeta.png" align="middle"></span> </p> <pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">&gt;</span> <a class="link" href="../../main_overview/result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">ibetac</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">T3</span> <span class="identifier">x</span><span class="special">);</span> <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../policy.html" title="Policies">Policy</a><span class="special">&gt;</span> <a class="link" href="../../main_overview/result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">ibetac</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">T3</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Policies">Policy</a><span class="special">&amp;);</span> </pre> <p> Returns the normalised complement of the incomplete beta function of a, b and x: </p> <p> <span class="inlinemediaobject"><img src="../../../../equations/ibeta4.png"></span> </p> <pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">&gt;</span> <a class="link" href="../../main_overview/result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">beta</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">T3</span> <span class="identifier">x</span><span class="special">);</span> <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../policy.html" title="Policies">Policy</a><span class="special">&gt;</span> <a class="link" href="../../main_overview/result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">beta</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">T3</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Policies">Policy</a><span class="special">&amp;);</span> </pre> <p> Returns the full (non-normalised) incomplete beta function of a, b and x: </p> <p> <span class="inlinemediaobject"><img src="../../../../equations/ibeta1.png"></span> </p> <pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">&gt;</span> <a class="link" href="../../main_overview/result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">betac</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">T3</span> <span class="identifier">x</span><span class="special">);</span> <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../policy.html" title="Policies">Policy</a><span class="special">&gt;</span> <a class="link" href="../../main_overview/result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">betac</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">T3</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Policies">Policy</a><span class="special">&amp;);</span> </pre> <p> Returns the full (non-normalised) complement of the incomplete beta function of a, b and x: </p> <p> <span class="inlinemediaobject"><img src="../../../../equations/ibeta2.png"></span> </p> <h5> <a name="math_toolkit.special.sf_beta.ibeta_function.h2"></a> <span class="phrase"><a name="math_toolkit.special.sf_beta.ibeta_function.accuracy"></a></span><a class="link" href="ibeta_function.html#math_toolkit.special.sf_beta.ibeta_function.accuracy">Accuracy</a> </h5> <p> The following tables give peak and mean relative errors in over various domains of a, b and x, along with comparisons to the <a href="http://www.gnu.org/software/gsl/" target="_top">GSL-1.9</a> and <a href="http://www.netlib.org/cephes/" target="_top">Cephes</a> libraries. Note that only results for the widest floating-point type on the system are given as narrower types have <a class="link" href="../../backgrounders/relative_error.html#zero_error">effectively zero error</a>. </p> <p> Note that the results for 80 and 128-bit long doubles are noticeably higher than for doubles: this is because the wider exponent range of these types allow more extreme test cases to be tested. For example expected results that are zero at double precision, may be finite but exceptionally small with the wider exponent range of the long double types. </p> <div class="table"> <a name="math_toolkit.special.sf_beta.ibeta_function.errors_in_the_function_ibeta_a_b_x_"></a><p class="title"><b>Table&#160;26.&#160;Errors In the Function ibeta(a,b,x)</b></p> <div class="table-contents"><table class="table" summary="Errors In the Function ibeta(a,b,x)"> <colgroup> <col> <col> <col> <col> <col> </colgroup> <thead><tr> <th> <p> Significand Size </p> </th> <th> <p> Platform and Compiler </p> </th> <th> <p> 0 &lt; a,b &lt; 10 </p> <p> and </p> <p> 0 &lt; x &lt; 1 </p> </th> <th> <p> 0 &lt; a,b &lt; 100 </p> <p> and </p> <p> 0 &lt; x &lt; 1 </p> </th> <th> <p> 1x10<sup>-5</sup> &lt; a,b &lt; 1x10<sup>5</sup> </p> <p> and </p> <p> 0 &lt; x &lt; 1 </p> </th> </tr></thead> <tbody> <tr> <td> <p> 53 </p> </td> <td> <p> Win32, Visual C++ 8 </p> </td> <td> <p> Peak=42.3 Mean=2.9 </p> <p> (GSL Peak=682 Mean=32.5) </p> <p> (<a href="http://www.netlib.org/cephes/" target="_top">Cephes</a> Peak=42.7 Mean=7.0) </p> </td> <td> <p> Peak=108 Mean=16.6 </p> <p> (GSL Peak=690 Mean=151) </p> <p> (<a href="http://www.netlib.org/cephes/" target="_top">Cephes</a> Peak=1545 Mean=218) </p> </td> <td> <p> Peak=4x10<sup>3</sup> &#160; Mean=203 </p> <p> (GSL Peak~3x10<sup>5</sup> &#160; Mean~2x10<sup>4</sup> &#160;) </p> <p> (<a href="http://www.netlib.org/cephes/" target="_top">Cephes</a> Peak~5x10<sup>5</sup> &#160; Mean~2x10<sup>4</sup> &#160;) </p> </td> </tr> <tr> <td> <p> 64 </p> </td> <td> <p> Redhat Linux IA32, gcc-3.4.4 </p> </td> <td> <p> Peak=21.9 Mean=3.1 </p> </td> <td> <p> Peak=270.7 Mean=26.8 </p> </td> <td> <p> Peak~5x10<sup>4</sup> &#160; Mean=3x10<sup>3</sup> &#160; </p> </td> </tr> <tr> <td> <p> 64 </p> </td> <td> <p> Redhat Linux IA64, gcc-3.4.4 </p> </td> <td> <p> Peak=15.4 Mean=3.0 </p> </td> <td> <p> Peak=112.9 Mean=14.3 </p> </td> <td> <p> Peak~5x10<sup>4</sup> &#160; Mean=3x10<sup>3</sup> &#160; </p> </td> </tr> <tr> <td> <p> 113 </p> </td> <td> <p> HPUX IA64, aCC A.06.06 </p> </td> <td> <p> Peak=20.9 Mean=2.6 </p> </td> <td> <p> Peak=88.1 Mean=14.3 </p> </td> <td> <p> Peak~2x10<sup>4</sup> &#160; Mean=1x10<sup>3</sup> &#160; </p> </td> </tr> </tbody> </table></div> </div> <br class="table-break"><div class="table"> <a name="math_toolkit.special.sf_beta.ibeta_function.errors_in_the_function_ibetac_a_b_x_"></a><p class="title"><b>Table&#160;27.&#160;Errors In the Function ibetac(a,b,x)</b></p> <div class="table-contents"><table class="table" summary="Errors In the Function ibetac(a,b,x)"> <colgroup> <col> <col> <col> <col> <col> </colgroup> <thead><tr> <th> <p> Significand Size </p> </th> <th> <p> Platform and Compiler </p> </th> <th> <p> 0 &lt; a,b &lt; 10 </p> <p> and </p> <p> 0 &lt; x &lt; 1 </p> </th> <th> <p> 0 &lt; a,b &lt; 100 </p> <p> and </p> <p> 0 &lt; x &lt; 1 </p> </th> <th> <p> 1x10<sup>-5</sup> &lt; a,b &lt; 1x10<sup>5</sup> </p> <p> and </p> <p> 0 &lt; x &lt; 1 </p> </th> </tr></thead> <tbody> <tr> <td> <p> 53 </p> </td> <td> <p> Win32, Visual C++ 8 </p> </td> <td> <p> Peak=13.9 Mean=2.0 </p> </td> <td> <p> Peak=56.2 Mean=14 </p> </td> <td> <p> Peak=3x10<sup>3</sup> &#160; Mean=159 </p> </td> </tr> <tr> <td> <p> 64 </p> </td> <td> <p> Redhat Linux IA32, gcc-3.4.4 </p> </td> <td> <p> Peak=21.1 Mean=3.6 </p> </td> <td> <p> Peak=221.7 Mean=25.8 </p> </td> <td> <p> Peak~9x10<sup>4</sup> &#160; Mean=3x10<sup>3</sup> &#160; </p> </td> </tr> <tr> <td> <p> 64 </p> </td> <td> <p> Redhat Linux IA64, gcc-3.4.4 </p> </td> <td> <p> Peak=10.6 Mean=2.2 </p> </td> <td> <p> Peak=73.9 Mean=11.9 </p> </td> <td> <p> Peak~9x10<sup>4</sup> &#160; Mean=3x10<sup>3</sup> &#160; </p> </td> </tr> <tr> <td> <p> 113 </p> </td> <td> <p> HPUX IA64, aCC A.06.06 </p> </td> <td> <p> Peak=9.9 Mean=2.6 </p> </td> <td> <p> Peak=117.7 Mean=15.1 </p> </td> <td> <p> Peak~3x10<sup>4</sup> &#160; Mean=1x10<sup>3</sup> &#160; </p> </td> </tr> </tbody> </table></div> </div> <br class="table-break"><div class="table"> <a name="math_toolkit.special.sf_beta.ibeta_function.errors_in_the_function_beta_a__b__x_"></a><p class="title"><b>Table&#160;28.&#160;Errors In the Function beta(a, b, x)</b></p> <div class="table-contents"><table class="table" summary="Errors In the Function beta(a, b, x)"> <colgroup> <col> <col> <col> <col> <col> </colgroup> <thead><tr> <th> <p> Significand Size </p> </th> <th> <p> Platform and Compiler </p> </th> <th> <p> 0 &lt; a,b &lt; 10 </p> <p> and </p> <p> 0 &lt; x &lt; 1 </p> </th> <th> <p> 0 &lt; a,b &lt; 100 </p> <p> and </p> <p> 0 &lt; x &lt; 1 </p> </th> <th> <p> 1x10<sup>-5</sup> &lt; a,b &lt; 1x10<sup>5</sup> </p> <p> and </p> <p> 0 &lt; x &lt; 1 </p> </th> </tr></thead> <tbody> <tr> <td> <p> 53 </p> </td> <td> <p> Win32, Visual C++ 8 </p> </td> <td> <p> Peak=39 Mean=2.9 </p> </td> <td> <p> Peak=91 Mean=12.7 </p> </td> <td> <p> Peak=635 Mean=25 </p> </td> </tr> <tr> <td> <p> 64 </p> </td> <td> <p> Redhat Linux IA32, gcc-3.4.4 </p> </td> <td> <p> Peak=26 Mean=3.6 </p> </td> <td> <p> Peak=180.7 Mean=30.1 </p> </td> <td> <p> Peak~7x10<sup>4</sup> &#160; Mean=3x10<sup>3</sup> &#160; </p> </td> </tr> <tr> <td> <p> 64 </p> </td> <td> <p> Redhat Linux IA64, gcc-3.4.4 </p> </td> <td> <p> Peak=13 Mean=2.4 </p> </td> <td> <p> Peak=67.1 Mean=13.4 </p> </td> <td> <p> Peak~7x10<sup>4</sup> &#160; Mean=3x10<sup>3</sup> &#160; </p> </td> </tr> <tr> <td> <p> 113 </p> </td> <td> <p> HPUX IA64, aCC A.06.06 </p> </td> <td> <p> Peak=27.3 Mean=3.6 </p> </td> <td> <p> Peak=49.8 Mean=9.1 </p> </td> <td> <p> Peak~6x10<sup>4</sup> &#160; Mean=3x10<sup>3</sup> &#160; </p> </td> </tr> </tbody> </table></div> </div> <br class="table-break"><div class="table"> <a name="math_toolkit.special.sf_beta.ibeta_function.errors_in_the_function_betac_a_b_x_"></a><p class="title"><b>Table&#160;29.&#160;Errors In the Function betac(a,b,x)</b></p> <div class="table-contents"><table class="table" summary="Errors In the Function betac(a,b,x)"> <colgroup> <col> <col> <col> <col> <col> </colgroup> <thead><tr> <th> <p> Significand Size </p> </th> <th> <p> Platform and Compiler </p> </th> <th> <p> 0 &lt; a,b &lt; 10 </p> <p> and </p> <p> 0 &lt; x &lt; 1 </p> </th> <th> <p> 0 &lt; a,b &lt; 100 </p> <p> and </p> <p> 0 &lt; x &lt; 1 </p> </th> <th> <p> 1x10<sup>-5</sup> &lt; a,b &lt; 1x10<sup>5</sup> </p> <p> and </p> <p> 0 &lt; x &lt; 1 </p> </th> </tr></thead> <tbody> <tr> <td> <p> 53 </p> </td> <td> <p> Win32, Visual C++ 8 </p> </td> <td> <p> Peak=12.0 Mean=2.4 </p> </td> <td> <p> Peak=91 Mean=15 </p> </td> <td> <p> Peak=4x10<sup>3</sup> &#160; Mean=113 </p> </td> </tr> <tr> <td> <p> 64 </p> </td> <td> <p> Redhat Linux IA32, gcc-3.4.4 </p> </td> <td> <p> Peak=19.8 Mean=3.8 </p> </td> <td> <p> Peak=295.1 Mean=33.9 </p> </td> <td> <p> Peak~1x10<sup>5</sup> &#160; Mean=5x10<sup>3</sup> &#160; </p> </td> </tr> <tr> <td> <p> 64 </p> </td> <td> <p> Redhat Linux IA64, gcc-3.4.4 </p> </td> <td> <p> Peak=11.2 Mean=2.4 </p> </td> <td> <p> Peak=63.5 Mean=13.6 </p> </td> <td> <p> Peak~1x10<sup>5</sup> &#160; Mean=5x10<sup>3</sup> &#160; </p> </td> </tr> <tr> <td> <p> 113 </p> </td> <td> <p> HPUX IA64, aCC A.06.06 </p> </td> <td> <p> Peak=15.6 Mean=3.5 </p> </td> <td> <p> Peak=39.8 Mean=8.9 </p> </td> <td> <p> Peak~9x10<sup>4</sup> &#160; Mean=5x10<sup>3</sup> &#160; </p> </td> </tr> </tbody> </table></div> </div> <br class="table-break"><h5> <a name="math_toolkit.special.sf_beta.ibeta_function.h3"></a> <span class="phrase"><a name="math_toolkit.special.sf_beta.ibeta_function.testing"></a></span><a class="link" href="ibeta_function.html#math_toolkit.special.sf_beta.ibeta_function.testing">Testing</a> </h5> <p> There are two sets of tests: spot tests compare values taken from <a href="http://functions.wolfram.com/webMathematica/FunctionEvaluation.jsp?name=BetaRegularized" target="_top">Mathworld's online function evaluator</a> with this implementation: they provide a basic "sanity check" for the implementation, with one spot-test in each implementation-domain (see implementation notes below). </p> <p> Accuracy tests use data generated at very high precision (with <a href="http://shoup.net/ntl/doc/RR.txt" target="_top">NTL RR class</a> set at 1000-bit precision), using the "textbook" continued fraction representation (refer to the first continued fraction in the implementation discussion below). Note that this continued fraction is <span class="emphasis"><em>not</em></span> used in the implementation, and therefore we have test data that is fully independent of the code. </p> <h5> <a name="math_toolkit.special.sf_beta.ibeta_function.h4"></a> <span class="phrase"><a name="math_toolkit.special.sf_beta.ibeta_function.implementation"></a></span><a class="link" href="ibeta_function.html#math_toolkit.special.sf_beta.ibeta_function.implementation">Implementation</a> </h5> <p> This implementation is closely based upon <a href="http://portal.acm.org/citation.cfm?doid=131766.131776" target="_top">"Algorithm 708; Significant digit computation of the incomplete beta function ratios", DiDonato and Morris, ACM, 1992.</a> </p> <p> All four of these functions share a common implementation: this is passed both x and y, and can return either p or q where these are related by: </p> <p> <span class="inlinemediaobject"><img src="../../../../equations/ibeta_inv5.png"></span> </p> <p> so at any point we can swap a for b, x for y and p for q if this results in a more favourable position. Generally such swaps are performed so that we always compute a value less than 0.9: when required this can then be subtracted from 1 without undue cancellation error. </p> <p> The following continued fraction representation is found in many textbooks but is not used in this implementation - it's both slower and less accurate than the alternatives - however it is used to generate test data: </p> <p> <span class="inlinemediaobject"><img src="../../../../equations/ibeta5.png"></span> </p> <p> The following continued fraction is due to <a href="http://portal.acm.org/citation.cfm?doid=131766.131776" target="_top">Didonato and Morris</a>, and is used in this implementation when a and b are both greater than 1: </p> <p> <span class="inlinemediaobject"><img src="../../../../equations/ibeta6.png"></span> </p> <p> For smallish b and x then a series representation can be used: </p> <p> <span class="inlinemediaobject"><img src="../../../../equations/ibeta7.png"></span> </p> <p> When b &lt;&lt; a then the transition from 0 to 1 occurs very close to x = 1 and some care has to be taken over the method of computation, in that case the following series representation is used: </p> <p> <span class="inlinemediaobject"><img src="../../../../equations/ibeta8.png"></span> </p> <p> Where Q(a,x) is an <a href="http://functions.wolfram.com/GammaBetaErf/Gamma2/" target="_top">incomplete gamma function</a>. Note that this method relies on keeping a table of all the p<sub>n </sub> previously computed, which does limit the precision of the method, depending upon the size of the table used. </p> <p> When <span class="emphasis"><em>a</em></span> and <span class="emphasis"><em>b</em></span> are both small integers, then we can relate the incomplete beta to the binomial distribution and use the following finite sum: </p> <p> <span class="inlinemediaobject"><img src="../../../../equations/ibeta12.png"></span> </p> <p> Finally we can sidestep difficult areas, or move to an area with a more efficient means of computation, by using the duplication formulae: </p> <p> <span class="inlinemediaobject"><img src="../../../../equations/ibeta10.png"></span> </p> <p> <span class="inlinemediaobject"><img src="../../../../equations/ibeta11.png"></span> </p> <p> The domains of a, b and x for which the various methods are used are identical to those described in the <a href="http://portal.acm.org/citation.cfm?doid=131766.131776" target="_top">Didonato and Morris TOMS 708 paper</a>. </p> </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> <td align="left"></td> <td align="right"><div class="copyright-footer">Copyright &#169; 2006-2010, 2012 John Maddock, Paul A. Bristow, Hubert Holin, Xiaogang Zhang, Bruno Lalande, Johan R&#229;de, Gautam Sewani, Thijs van den Berg and Benjamin Sobotta<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="beta_function.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../sf_beta.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="ibeta_inv_function.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a> </div> </body> </html>
{ "content_hash": "1e74dba6969139f476f0ee643a1191b2", "timestamp": "", "source": "github", "line_count": 982, "max_line_length": 676, "avg_line_length": 49.294297352342156, "alnum_prop": 0.5098229594893301, "repo_name": "cpascal/af-cpp", "id": "a2c6a0d4c4b6a19d02bc59c31812cbf95f14f448", "size": "48407", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "apdos/exts/boost_1_53_0/libs/math/doc/sf_and_dist/html/math_toolkit/special/sf_beta/ibeta_function.html", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "Assembly", "bytes": "142321" }, { "name": "Batchfile", "bytes": "45292" }, { "name": "C", "bytes": "2380742" }, { "name": "C#", "bytes": "41850" }, { "name": "C++", "bytes": "141733840" }, { "name": "CMake", "bytes": "1784" }, { "name": "CSS", "bytes": "303526" }, { "name": "Cuda", "bytes": "27558" }, { "name": "FORTRAN", "bytes": "1440" }, { "name": "Groff", "bytes": "8174" }, { "name": "HTML", "bytes": "80494592" }, { "name": "IDL", "bytes": "15" }, { "name": "JavaScript", "bytes": "134468" }, { "name": "Lex", "bytes": "1318" }, { "name": "Makefile", "bytes": "1028949" }, { "name": "Max", "bytes": "36857" }, { "name": "Objective-C", "bytes": "4297" }, { "name": "PHP", "bytes": "60249" }, { "name": "Perl", "bytes": "30505" }, { "name": "Perl6", "bytes": "2130" }, { "name": "Python", "bytes": "1751993" }, { "name": "QML", "bytes": "613" }, { "name": "Rebol", "bytes": "372" }, { "name": "Shell", "bytes": "374946" }, { "name": "Tcl", "bytes": "1205" }, { "name": "TeX", "bytes": "13819" }, { "name": "XSLT", "bytes": "780775" }, { "name": "Yacc", "bytes": "19612" } ], "symlink_target": "" }
# Tightly ## What is this? This is a tool for populating [sightly](http://blogs.adobe.com/experiencedelivers/experience-management/sightly-intro-part-1/) templates with dummy data via JavaScript. It's rather simple, in that it simply looks for a sightly-templated string as directed and replaces it with a string containing the values that sightly could have populated. Given a properly populated data object (more detail below), `tightly` can be called as follows: var data = { '<p data-sly-text="${msg}">TEXT TO BE REPLACED</p>' : '<p data-sly-text="cool">cool</p>' } var template = '<div><p data-sly-text="${msg}">TEXT TO BE REPLACED</p></div>'; var find = '<p data-sly-text="${msg}">TEXT TO BE REPLACED</p>'; var target = '<div><p data-sly-text="cool">cool</p></div>'; target === tightly(template, find, data) // i.e. the tightly call will return the following: // <div><p data-sly-text="cool">cool</p></div> ## Why is this needed? We need a mechanism to load sightly templates with data when they are not served in a CQ environment. This allows us to demonstrate the template, filled with example data, in non-CQ contexts such as the pattern library. ## Usage Create a data object, with keys representing the data we want to replace, and the values containing the data we want to inject into the template. Note that a key is either: * the literal string that will be replaced (in the case of single-line replacements) * or the base64 representation of the literal string that will be replaced (in the case of multi-line replacements) var data = { 'data-sly-text="${msg}"': (function() {/* data-sly-text="cool" */}).toString().match(/[^]*\/\*([^]*)\*\/\}$/)[1], /* <ul data-sly-list.child='${currentPage.listChildren}'> <li>${child.title}</li> </ul> */ 'CiAgICAgICAgICAgICAgICA8dWwgZGF0YS1zbHktbGlzdC5jaGlsZD0nJHtjdXJyZW50UGFnZS5saXN0Q2hpbGRyZW59Jz4KICAgICAgICAgICAgICAgICAgPGxpPiR7Y2hpbGQudGl0bGV9PC9saT4KICAgICAgICAgICAgICAgIDwvdWw+CiAgICAgICAg': (function() {/* <ul data-sly-list.child='[{"title":"Title 1"},{"title":"Title 2"},{"title":"Title 3"}]'> <li>Title 1</li> <li>Title 2</li> <li>Title 3</li> </ul> */}).toString().match(/[^]*\/\*([^]*)\*\/\}$/)[1] }; As the tests show, the first item in the data array above can be used as such: it ("should allow replacement of a string within a single-line template, where the string is not the entire template", function() { var template = (function() {/* <p data-sly-text="${msg}">MY NEW TEXT</p> */}).toString().match(/[^]*\/\*([^]*)\*\/\}$/)[1]; var find = (function() {/* data-sly-text="${msg}" */}).toString().match(/[^]*\/\*([^]*)\*\/\}$/)[1]; var target = (function() {/* <p data-sly-text="cool">MY NEW TEXT</p> */}).toString().match(/[^]*\/\*([^]*)\*\/\}$/)[1]; expect(tightly(template, find, data)).toBe(target); }); Whereas the second item in the data array above can be used as such: it ("should allow replacement of a string within a multi-line template, where the string is not the entire template", function() { var template = (function() {/* <div> <ul data-sly-list.child='${currentPage.listChildren}'> <li>${child.title}</li> </ul> </div> */}).toString().match(/[^]*\/\*([^]*)\*\/\}$/)[1]; var find = (function() {/* <ul data-sly-list.child='${currentPage.listChildren}'> <li>${child.title}</li> </ul> */}).toString().match(/[^]*\/\*([^]*)\*\/\}$/)[1]; // To generate the base64 string, simply do: // console.log(window.btoa(find)); var target = (function() {/* <div> <ul data-sly-list.child='[{"title":"Title 1"},{"title":"Title 2"},{"title":"Title 3"}]'> <li>Title 1</li> <li>Title 2</li> <li>Title 3</li> </ul> </div> */}).toString().match(/[^]*\/\*([^]*)\*\/\}$/)[1]; expect(tightly(template, find, data)).toBe(target); }); ## Tests To see the tests in action: * install dependencies bower install * open the `SpecRunner.html` in a browser
{ "content_hash": "8538476ccb8d9e83c1b201c5174bf7c6", "timestamp": "", "source": "github", "line_count": 128, "max_line_length": 207, "avg_line_length": 36, "alnum_prop": 0.5544704861111112, "repo_name": "fairfaxmedia/tightly", "id": "2c90c2ec8f135636e659757f4903047fb00e64a9", "size": "4608", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "757" }, { "name": "JavaScript", "bytes": "5707" } ], "symlink_target": "" }
FROM balenalib/hummingboard2-debian:jessie-build # A few reasons for installing distribution-provided OpenJDK: # # 1. Oracle. Licensing prevents us from redistributing the official JDK. # # 2. Compiling OpenJDK also requires the JDK to be installed, and it gets # really hairy. # # For some sample build times, see Debian's buildd logs: # https://buildd.debian.org/status/logs.php?pkg=openjdk-7 RUN apt-get update && apt-get install -y --no-install-recommends \ bzip2 \ unzip \ xz-utils \ && rm -rf /var/lib/apt/lists/* # Default to UTF-8 file.encoding ENV LANG C.UTF-8 # add a simple script that can auto-detect the appropriate JAVA_HOME value # based on whether the JDK or only the JRE is installed RUN { \ echo '#!/bin/sh'; \ echo 'set -e'; \ echo; \ echo 'dirname "$(dirname "$(readlink -f "$(which javac || which java)")")"'; \ } > /usr/local/bin/docker-java-home \ && chmod +x /usr/local/bin/docker-java-home # do some fancy footwork to create a JAVA_HOME that's cross-architecture-safe RUN ln -svT "/usr/lib/jvm/java-7-openjdk-$(dpkg --print-architecture)" /docker-java-home ENV JAVA_HOME /docker-java-home RUN set -ex; \ \ # deal with slim variants not having man page directories (which causes "update-alternatives" to fail) if [ ! -d /usr/share/man/man1 ]; then \ mkdir -p /usr/share/man/man1; \ fi; \ \ apt-get update; \ apt-get install -y --no-install-recommends \ openjdk-7-jre \ ; \ rm -rf /var/lib/apt/lists/*; \ \ # verify that "docker-java-home" returns what we expect [ "$(readlink -f "$JAVA_HOME")" = "$(docker-java-home)" ]; \ \ # update-alternatives so that future installs of other OpenJDK versions don't change /usr/bin/java update-alternatives --get-selections | awk -v home="$(readlink -f "$JAVA_HOME")" 'index($3, home) == 1 { $2 = "manual"; print | "update-alternatives --set-selections" }'; \ # ... and verify that it actually worked for one of the alternatives we care about update-alternatives --query java | grep -q 'Status: manual' CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"] RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo 'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: ARM v7 \nOS: Debian Jessie \nVariant: build variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \nOpenJDK v7-jre \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info RUN echo '#!/bin/sh.real\nbalena-info\nrm -f /bin/sh\ncp /bin/sh.real /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \ && chmod +x /bin/sh-shim \ && cp /bin/sh /bin/sh.real \ && mv /bin/sh-shim /bin/sh
{ "content_hash": "3f8331d5c233a6f4ca423530fe6b2cd6", "timestamp": "", "source": "github", "line_count": 64, "max_line_length": 678, "avg_line_length": 48.03125, "alnum_prop": 0.6997397527651269, "repo_name": "nghiant2710/base-images", "id": "65e4bb16d446ff6f9218ceaf7672e3b5ab4cdebc", "size": "3095", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "balena-base-images/openjdk/hummingboard2/debian/jessie/7-jre/build/Dockerfile", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Dockerfile", "bytes": "144558581" }, { "name": "JavaScript", "bytes": "16316" }, { "name": "Shell", "bytes": "368690" } ], "symlink_target": "" }
<?php declare(strict_types=1); namespace Sylius\Bundle\ResourceBundle\Controller; use Doctrine\Common\Persistence\ObjectManager; use FOS\RestBundle\View\View; use Sylius\Bundle\ResourceBundle\Event\ResourceControllerEvent; use Sylius\Component\Resource\Exception\UpdateHandlingException; use Sylius\Component\Resource\Factory\FactoryInterface; use Sylius\Component\Resource\Metadata\MetadataInterface; use Sylius\Component\Resource\Repository\RepositoryInterface; use Sylius\Component\Resource\ResourceActions; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\Security\Core\Exception\AccessDeniedException; /** * @author Paweł Jędrzejewski <pawel@sylius.org> * @author Saša Stamenković <umpirsky@gmail.com> */ class ResourceController extends Controller { /** * @var MetadataInterface */ protected $metadata; /** * @var RequestConfigurationFactoryInterface */ protected $requestConfigurationFactory; /** * @var ViewHandlerInterface */ protected $viewHandler; /** * @var RepositoryInterface */ protected $repository; /** * @var FactoryInterface */ protected $factory; /** * @var NewResourceFactoryInterface */ protected $newResourceFactory; /** * @var ObjectManager */ protected $manager; /** * @var SingleResourceProviderInterface */ protected $singleResourceProvider; /** * @var ResourcesCollectionProviderInterface */ protected $resourcesCollectionProvider; /** * @var ResourceFormFactoryInterface */ protected $resourceFormFactory; /** * @var RedirectHandlerInterface */ protected $redirectHandler; /** * @var FlashHelperInterface */ protected $flashHelper; /** * @var AuthorizationCheckerInterface */ protected $authorizationChecker; /** * @var EventDispatcherInterface */ protected $eventDispatcher; /** * @var StateMachineInterface */ protected $stateMachine; /** * @var ResourceUpdateHandlerInterface */ protected $resourceUpdateHandler; /** * @param MetadataInterface $metadata * @param RequestConfigurationFactoryInterface $requestConfigurationFactory * @param ViewHandlerInterface $viewHandler * @param RepositoryInterface $repository * @param FactoryInterface $factory * @param NewResourceFactoryInterface $newResourceFactory * @param ObjectManager $manager * @param SingleResourceProviderInterface $singleResourceProvider * @param ResourcesCollectionProviderInterface $resourcesFinder * @param ResourceFormFactoryInterface $resourceFormFactory * @param RedirectHandlerInterface $redirectHandler * @param FlashHelperInterface $flashHelper * @param AuthorizationCheckerInterface $authorizationChecker * @param EventDispatcherInterface $eventDispatcher * @param StateMachineInterface $stateMachine * @param ResourceUpdateHandlerInterface $resourceUpdateHandler */ public function __construct( MetadataInterface $metadata, RequestConfigurationFactoryInterface $requestConfigurationFactory, ViewHandlerInterface $viewHandler, RepositoryInterface $repository, FactoryInterface $factory, NewResourceFactoryInterface $newResourceFactory, ObjectManager $manager, SingleResourceProviderInterface $singleResourceProvider, ResourcesCollectionProviderInterface $resourcesFinder, ResourceFormFactoryInterface $resourceFormFactory, RedirectHandlerInterface $redirectHandler, FlashHelperInterface $flashHelper, AuthorizationCheckerInterface $authorizationChecker, EventDispatcherInterface $eventDispatcher, StateMachineInterface $stateMachine, ResourceUpdateHandlerInterface $resourceUpdateHandler ) { $this->metadata = $metadata; $this->requestConfigurationFactory = $requestConfigurationFactory; $this->viewHandler = $viewHandler; $this->repository = $repository; $this->factory = $factory; $this->newResourceFactory = $newResourceFactory; $this->manager = $manager; $this->singleResourceProvider = $singleResourceProvider; $this->resourcesCollectionProvider = $resourcesFinder; $this->resourceFormFactory = $resourceFormFactory; $this->redirectHandler = $redirectHandler; $this->flashHelper = $flashHelper; $this->authorizationChecker = $authorizationChecker; $this->eventDispatcher = $eventDispatcher; $this->stateMachine = $stateMachine; $this->resourceUpdateHandler = $resourceUpdateHandler; } /** * @param Request $request * * @return Response */ public function showAction(Request $request) { $configuration = $this->requestConfigurationFactory->create($this->metadata, $request); $this->isGrantedOr403($configuration, ResourceActions::SHOW); $resource = $this->findOr404($configuration); $this->eventDispatcher->dispatch(ResourceActions::SHOW, $configuration, $resource); $view = View::create($resource); if ($configuration->isHtmlRequest()) { $view ->setTemplate($configuration->getTemplate(ResourceActions::SHOW . '.html')) ->setTemplateVar($this->metadata->getName()) ->setData([ 'configuration' => $configuration, 'metadata' => $this->metadata, 'resource' => $resource, $this->metadata->getName() => $resource, ]) ; } return $this->viewHandler->handle($configuration, $view); } /** * @param Request $request * * @return Response */ public function indexAction(Request $request) { $configuration = $this->requestConfigurationFactory->create($this->metadata, $request); $this->isGrantedOr403($configuration, ResourceActions::INDEX); $resources = $this->resourcesCollectionProvider->get($configuration, $this->repository); $view = View::create($resources); if ($configuration->isHtmlRequest()) { $view ->setTemplate($configuration->getTemplate(ResourceActions::INDEX . '.html')) ->setTemplateVar($this->metadata->getPluralName()) ->setData([ 'configuration' => $configuration, 'metadata' => $this->metadata, 'resources' => $resources, $this->metadata->getPluralName() => $resources, ]) ; } return $this->viewHandler->handle($configuration, $view); } /** * @param Request $request * * @return Response */ public function createAction(Request $request) { $configuration = $this->requestConfigurationFactory->create($this->metadata, $request); $this->isGrantedOr403($configuration, ResourceActions::CREATE); $newResource = $this->newResourceFactory->create($configuration, $this->factory); $form = $this->resourceFormFactory->create($configuration, $newResource); if ($request->isMethod('POST') && $form->handleRequest($request)->isValid()) { $newResource = $form->getData(); $event = $this->eventDispatcher->dispatchPreEvent(ResourceActions::CREATE, $configuration, $newResource); if ($event->isStopped() && !$configuration->isHtmlRequest()) { throw new HttpException($event->getErrorCode(), $event->getMessage()); } if ($event->isStopped()) { $this->flashHelper->addFlashFromEvent($configuration, $event); return $this->redirectHandler->redirectToIndex($configuration, $newResource); } if ($configuration->hasStateMachine()) { $this->stateMachine->apply($configuration, $newResource); } $this->repository->add($newResource); $this->eventDispatcher->dispatchPostEvent(ResourceActions::CREATE, $configuration, $newResource); if (!$configuration->isHtmlRequest()) { return $this->viewHandler->handle($configuration, View::create($newResource, Response::HTTP_CREATED)); } $this->flashHelper->addSuccessFlash($configuration, ResourceActions::CREATE, $newResource); return $this->redirectHandler->redirectToResource($configuration, $newResource); } if (!$configuration->isHtmlRequest()) { return $this->viewHandler->handle($configuration, View::create($form, Response::HTTP_BAD_REQUEST)); } $this->eventDispatcher->dispatchInitializeEvent(ResourceActions::CREATE, $configuration, $newResource); $view = View::create() ->setData([ 'configuration' => $configuration, 'metadata' => $this->metadata, 'resource' => $newResource, $this->metadata->getName() => $newResource, 'form' => $form->createView(), ]) ->setTemplate($configuration->getTemplate(ResourceActions::CREATE . '.html')) ; return $this->viewHandler->handle($configuration, $view); } /** * @param Request $request * * @return Response */ public function updateAction(Request $request) { $configuration = $this->requestConfigurationFactory->create($this->metadata, $request); $this->isGrantedOr403($configuration, ResourceActions::UPDATE); $resource = $this->findOr404($configuration); $form = $this->resourceFormFactory->create($configuration, $resource); if (in_array($request->getMethod(), ['POST', 'PUT', 'PATCH'], true) && $form->handleRequest($request)->isValid()) { $resource = $form->getData(); /** @var ResourceControllerEvent $event */ $event = $this->eventDispatcher->dispatchPreEvent(ResourceActions::UPDATE, $configuration, $resource); if ($event->isStopped() && !$configuration->isHtmlRequest()) { throw new HttpException($event->getErrorCode(), $event->getMessage()); } if ($event->isStopped()) { $this->flashHelper->addFlashFromEvent($configuration, $event); if ($event->hasResponse()) { return $event->getResponse(); } return $this->redirectHandler->redirectToResource($configuration, $resource); } try { $this->resourceUpdateHandler->handle($resource, $configuration, $this->manager); } catch (UpdateHandlingException $exception) { if (!$configuration->isHtmlRequest()) { return $this->viewHandler->handle( $configuration, View::create($form, $exception->getApiResponseCode()) ); } $this->flashHelper->addErrorFlash($configuration, $exception->getFlash()); return $this->redirectHandler->redirectToReferer($configuration); } $postEvent = $this->eventDispatcher->dispatchPostEvent(ResourceActions::UPDATE, $configuration, $resource); if (!$configuration->isHtmlRequest()) { $view = $configuration->getParameters()->get('return_content', false) ? View::create($resource, Response::HTTP_OK) : View::create(null, Response::HTTP_NO_CONTENT); return $this->viewHandler->handle($configuration, $view); } $this->flashHelper->addSuccessFlash($configuration, ResourceActions::UPDATE, $resource); if ($postEvent->hasResponse()) { return $postEvent->getResponse(); } return $this->redirectHandler->redirectToResource($configuration, $resource); } if (!$configuration->isHtmlRequest()) { return $this->viewHandler->handle($configuration, View::create($form, Response::HTTP_BAD_REQUEST)); } $this->eventDispatcher->dispatchInitializeEvent(ResourceActions::UPDATE, $configuration, $resource); $view = View::create() ->setData([ 'configuration' => $configuration, 'metadata' => $this->metadata, 'resource' => $resource, $this->metadata->getName() => $resource, 'form' => $form->createView(), ]) ->setTemplate($configuration->getTemplate(ResourceActions::UPDATE . '.html')) ; return $this->viewHandler->handle($configuration, $view); } /** * @param Request $request * * @return Response */ public function deleteAction(Request $request) { $configuration = $this->requestConfigurationFactory->create($this->metadata, $request); $this->isGrantedOr403($configuration, ResourceActions::DELETE); $resource = $this->findOr404($configuration); if ($configuration->isCsrfProtectionEnabled() && !$this->isCsrfTokenValid($resource->getId(), $request->request->get('_csrf_token'))) { throw new HttpException(Response::HTTP_FORBIDDEN, 'Invalid csrf token.'); } $event = $this->eventDispatcher->dispatchPreEvent(ResourceActions::DELETE, $configuration, $resource); if ($event->isStopped() && !$configuration->isHtmlRequest()) { throw new HttpException($event->getErrorCode(), $event->getMessage()); } if ($event->isStopped()) { $this->flashHelper->addFlashFromEvent($configuration, $event); if ($event->hasResponse()) { return $event->getResponse(); } return $this->redirectHandler->redirectToIndex($configuration, $resource); } $this->repository->remove($resource); $this->eventDispatcher->dispatchPostEvent(ResourceActions::DELETE, $configuration, $resource); if (!$configuration->isHtmlRequest()) { return $this->viewHandler->handle($configuration, View::create(null, Response::HTTP_NO_CONTENT)); } $this->flashHelper->addSuccessFlash($configuration, ResourceActions::DELETE, $resource); return $this->redirectHandler->redirectToIndex($configuration, $resource); } /** * @param Request $request * * @return RedirectResponse */ public function applyStateMachineTransitionAction(Request $request) { $configuration = $this->requestConfigurationFactory->create($this->metadata, $request); $this->isGrantedOr403($configuration, ResourceActions::UPDATE); $resource = $this->findOr404($configuration); $event = $this->eventDispatcher->dispatchPreEvent(ResourceActions::UPDATE, $configuration, $resource); if ($event->isStopped() && !$configuration->isHtmlRequest()) { throw new HttpException($event->getErrorCode(), $event->getMessage()); } if ($event->isStopped()) { $this->flashHelper->addFlashFromEvent($configuration, $event); return $this->redirectHandler->redirectToResource($configuration, $resource); } if (!$this->stateMachine->can($configuration, $resource)) { throw new BadRequestHttpException(); } try { $this->resourceUpdateHandler->handle($resource, $configuration, $this->manager); } catch (UpdateHandlingException $exception) { if (!$configuration->isHtmlRequest()) { return $this->viewHandler->handle( $configuration, View::create($resource, $exception->getApiResponseCode()) ); } $this->flashHelper->addErrorFlash($configuration, $exception->getFlash()); return $this->redirectHandler->redirectToReferer($configuration); } $this->eventDispatcher->dispatchPostEvent(ResourceActions::UPDATE, $configuration, $resource); if (!$configuration->isHtmlRequest()) { $view = $configuration->getParameters()->get('return_content', true) ? View::create($resource, Response::HTTP_OK) : View::create(null, Response::HTTP_NO_CONTENT); return $this->viewHandler->handle($configuration, $view); } $this->flashHelper->addSuccessFlash($configuration, ResourceActions::UPDATE, $resource); return $this->redirectHandler->redirectToResource($configuration, $resource); } /** * @param RequestConfiguration $configuration * @param string $permission * * @throws AccessDeniedException */ protected function isGrantedOr403(RequestConfiguration $configuration, $permission) { if (!$configuration->hasPermission()) { return; } $permission = $configuration->getPermission($permission); if (!$this->authorizationChecker->isGranted($configuration, $permission)) { throw new AccessDeniedException(); } } /** * @param RequestConfiguration $configuration * * @return \Sylius\Component\Resource\Model\ResourceInterface * * @throws NotFoundHttpException */ protected function findOr404(RequestConfiguration $configuration) { if (null === $resource = $this->singleResourceProvider->get($configuration, $this->repository)) { throw new NotFoundHttpException(sprintf('The "%s" has not been found', $this->metadata->getHumanizedName())); } return $resource; } }
{ "content_hash": "954108242791229fd813ec462c97bb3f", "timestamp": "", "source": "github", "line_count": 509, "max_line_length": 179, "avg_line_length": 35.854616895874265, "alnum_prop": 0.6290958904109589, "repo_name": "regnisolbap/Sylius", "id": "7536c174e869a3096241d0afd70e6981ec4e011e", "size": "18465", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/Sylius/Bundle/ResourceBundle/Controller/ResourceController.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "601" }, { "name": "CSS", "bytes": "2150" }, { "name": "Gherkin", "bytes": "789647" }, { "name": "HTML", "bytes": "303018" }, { "name": "JavaScript", "bytes": "71083" }, { "name": "PHP", "bytes": "6689113" }, { "name": "Shell", "bytes": "28860" } ], "symlink_target": "" }
// ---------------------------------------------------------------------------------- // <copyright file="IndexAccessRewriter.cs" company="NMemory Team"> // Copyright (C) 2012-2014 NMemory Team // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // </copyright> // ---------------------------------------------------------------------------------- #pragma warning disable 1591 namespace NMemory.Execution.Optimization.Rewriters { using System; using System.Linq; using System.Linq.Expressions; using NMemory.Common; using NMemory.Indexes; /// <summary> /// Rewrites constant->member index access expression to constant expression. /// </summary> public class IndexAccessRewriter : ExpressionRewriterBase { protected override Expression VisitMember(MemberExpression node) { // ---------------------------------------------------- // original: // const.index // ---------------------------------------------------- // transformed: // indexConstant // ---------------------------------------------------- Type indexInterface = null; if (node.Type.IsInterface && node.Type.GetGenericTypeDefinition() == typeof(IIndex<>)) { indexInterface = node.Type; } else { indexInterface = node.Type .GetInterfaces() .FirstOrDefault(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IIndex<>)); } if (indexInterface == null) { return base.VisitMember(node); } if (!(node.Expression is ConstantExpression source)) { return base.VisitMember(node); } return Expression.Constant( ReflectionHelper.GetMemberValue(node.Member, source.Value)); } } }
{ "content_hash": "4a70436d97530012579ccc8be46295a3", "timestamp": "", "source": "github", "line_count": 79, "max_line_length": 86, "avg_line_length": 39.75949367088607, "alnum_prop": 0.5428207577204712, "repo_name": "daryllabar/XrmUnitTest", "id": "a4922fd5bfda92255f8a459d98f43c56f610e0d1", "size": "3143", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "NMemory.Base/Execution/Optimization/Rewriters/IndexAccessRewriter.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "65030148" }, { "name": "Vim Snippet", "bytes": "5709" } ], "symlink_target": "" }
\hypertarget{_u_i_picker_action_sheet_8h}{\section{/\-Users/\-Kalai/\-Desktop/classes/\-U\-I\-Picker\-Action\-Sheet.h File Reference} \label{_u_i_picker_action_sheet_8h}\index{/\-Users/\-Kalai/\-Desktop/classes/\-U\-I\-Picker\-Action\-Sheet.\-h@{/\-Users/\-Kalai/\-Desktop/classes/\-U\-I\-Picker\-Action\-Sheet.\-h}} } {\ttfamily \#import $<$Foundation/\-Foundation.\-h$>$}\\* \subsection*{Classes} \begin{DoxyCompactItemize} \item class \hyperlink{interface_u_i_picker_action_sheet}{U\-I\-Picker\-Action\-Sheet} \item protocol \hyperlink{protocol_u_i_picker_action_sheet_delegate-p}{$<$\-U\-I\-Picker\-Action\-Sheet\-Delegate$>$} \end{DoxyCompactItemize}
{ "content_hash": "2d775ec59da3137de3765c7486e62fa4", "timestamp": "", "source": "github", "line_count": 11, "max_line_length": 182, "avg_line_length": 59.81818181818182, "alnum_prop": 0.6990881458966566, "repo_name": "nurimelia/PSM", "id": "6106388348d14a17f4ca226332471f1428a621b9", "size": "658", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "Documentation/latex/_u_i_picker_action_sheet_8h.tex", "mode": "33261", "license": "mit", "language": [ { "name": "C++", "bytes": "3694" }, { "name": "Objective-C", "bytes": "343724" } ], "symlink_target": "" }
local ClearCache = require "elasticsearch.endpoints.Indices.ClearCache" local MockTransport = require "lib.MockTransport" local getmetatable = getmetatable -- Setting up environment local _ENV = lunit.TEST_CASE "tests.endpoints.IndicesTest.ClearCacheTest" -- Declaring local variables local endpoint local mockTransport = MockTransport:new() -- Testing the constructor function constructorTest() assert_function(ClearCache.new) local o = ClearCache:new() assert_not_nil(o) local mt = getmetatable(o) assert_table(mt) assert_equal(mt, mt.__index) end -- The setup function function setup() endpoint = ClearCache:new{ transport = mockTransport } end -- Testing request function requestTest() mockTransport.method = "POST" mockTransport.uri = "/_cache/clear" mockTransport.params = {} mockTransport.body = nil local _, err = endpoint:request() assert_nil(err) end -- Testing index request function requestIndexTest() mockTransport.method = "POST" mockTransport.uri = "/twitter/_cache/clear" mockTransport.params = {} mockTransport.body = nil endpoint:setParams{ index = "twitter" } local _, err = endpoint:request() assert_nil(err) end
{ "content_hash": "4d2a94df889b1fabb7a96d026d454555", "timestamp": "", "source": "github", "line_count": 53, "max_line_length": 73, "avg_line_length": 22.528301886792452, "alnum_prop": 0.7361809045226131, "repo_name": "DhavalKapil/elasticsearch-lua", "id": "f53af3d6d2eec19631b6404a9386d62630131732", "size": "1215", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "tests/endpoints/IndicesTest/ClearCacheTest.lua", "mode": "33188", "license": "mit", "language": [ { "name": "Lua", "bytes": "628365" }, { "name": "Shell", "bytes": "5442" } ], "symlink_target": "" }
<?php use SharePoint\PHP\Client\AuthenticationContext; use SharePoint\PHP\Client\ClientContext; require_once(__DIR__ . '/../src/ClientContext.php'); require_once(__DIR__.'/../src/auth/AuthenticationContext.php'); require_once 'Settings.php'; try { $authCtx = new AuthenticationContext($Settings['Url']); $authCtx->acquireTokenForUser($Settings['UserName'],$Settings['Password']); $ctx = new SharePoint\PHP\Client\ClientContext($Settings['Url'],$authCtx); getSiteUsers($ctx); getUser($ctx); updateUser($ctx); } catch (Exception $e) { echo 'Error: ', $e->getMessage(), "\n"; } function getSiteUsers(ClientContext $ctx){ $web = $ctx->getWeb(); $users = $web->getSiteUsers(); $ctx->load($users); $ctx->executeQuery(); foreach( $users->getData() as $user ) { print "User title: '{$user->Title}'\r\n"; } } function getUser(ClientContext $ctx){ $web = $ctx->getWeb(); $user = $web->getSiteUsers()->getById(3); $ctx->load($user); $ctx->executeQuery(); print "User title: '{$user->Title}'\r\n"; } function updateUser(ClientContext $ctx){ $web = $ctx->getWeb(); $user = $web->getSiteUsers()->getById(3); $info = array( 'Title' => 'John Doe'); $user->update($info); $ctx->executeQuery(); print "User has been updated'\r\n"; }
{ "content_hash": "fe0bf2cec0044349f34f983e79c25dfc", "timestamp": "", "source": "github", "line_count": 58, "max_line_length": 79, "avg_line_length": 23.051724137931036, "alnum_prop": 0.6192969334330591, "repo_name": "ctcudd/phpSPO", "id": "85b24519f8854b0f751ad39477e751eafdd8e581", "size": "1337", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "examples/user_examples.php", "mode": "33188", "license": "mit", "language": [ { "name": "PHP", "bytes": "101270" } ], "symlink_target": "" }
<?php defined('BASEPATH') OR exit('No direct script access allowed'); class MY_Exceptions extends CI_Exceptions { protected $ci = null; /** * Initialize execption class * * @return void */ public function __construct() { parent::__construct(); if (function_exists('get_instance') && class_exists('CI_Controller', false)) { $this->ci = get_instance(); } } // -------------------------------------------------------------------- /** * 404 Page Not Found Handler * * @param string the page * @param bool log error yes/no * @return string */ public function show_404($page = '', $log_error = TRUE) { $heading = '404 Page Not Found'; $message = 'The page you requested was not found.'; // By default we log this, but allow a dev to skip it if ($log_error) { // Removed by Ivan Tcholakov, 12-OCT-2013. //log_message('error', '404 Page Not Found --> '.$_SERVER['REQUEST_URI']); // } require APPPATH . 'config/routes.php'; if ($route['404_override'] != '' && is_object($this->ci)) { $this->ci->load->set_module('error_404'); Modules::run($route['404_override'].'/index'); set_status_header(404); echo $this->ci->output->get_output(); exit(4); // EXIT_UNKNOWN_FILE } set_status_header(404); echo $this->show_error($heading, $message, 'error_404', 404); exit(4); // EXIT_UNKNOWN_FILE } }
{ "content_hash": "5280b4dd1dc36652a1e307ff0033e06e", "timestamp": "", "source": "github", "line_count": 58, "max_line_length": 86, "avg_line_length": 27.689655172413794, "alnum_prop": 0.5, "repo_name": "ericariyanto/starter-public-edition-3", "id": "1b0b0b01eaa2a84a6fd0dcf89b03f36f427f4c85", "size": "1606", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "platform/application/core/MY_Exceptions.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "29251" }, { "name": "CSS", "bytes": "297158" }, { "name": "HTML", "bytes": "46361" }, { "name": "JavaScript", "bytes": "1119930" }, { "name": "PHP", "bytes": "4458029" } ], "symlink_target": "" }
using System; using System.Linq.Expressions; using Zarf.Extensions; using Zarf.Generators; using Zarf.Generators.Functions.Handlers.Dates; namespace Zarf.SqlServer.Generators.Functions.Handlers { public class SqlServerDateTimeFunctionHandler : DateTimeFunctionHandler { public override bool HandleFunction(ISQLGenerator generator, MethodCallExpression methodCall) { if (methodCall.Method.DeclaringType != SoupportedType) { return false; } switch (methodCall.Method.Name) { case "Add": HandleAdd(generator, methodCall); return true; case "AddTicks": HandleAddTicks(generator, methodCall); return true; case "AddDays": HandleAddDays(generator, methodCall); return true; case "AddHours": HandleAddHours(generator, methodCall); return true; case "AddMilliseconds": HandleAddMilliseconds(generator, methodCall); return true; case "AddMinutes": HandleAddMinutes(generator, methodCall); return true; case "AddMonths": HandleAddMonths(generator, methodCall); return true; case "AddSeconds": HandleAddSeconds(generator, methodCall); return true; case "AddYears": HandleAddYears(generator, methodCall); return true; } return base.HandleFunction(generator, methodCall); } protected virtual void HandleAdd(ISQLGenerator generator, MethodCallExpression methodCall) { var timeSpan = methodCall.Arguments[0].Cast<ConstantExpression>().GetValue<TimeSpan>(); AddModifier( generator, methodCall.Object, Expression.Constant(timeSpan.TotalMilliseconds), "MS"); } protected virtual void HandleAddTicks(ISQLGenerator generator, MethodCallExpression methodCall) { AddModifier( generator, methodCall.Object, methodCall.Arguments[0], "NS"); } protected virtual void HandleAddDays(ISQLGenerator generator, MethodCallExpression methodCall) { AddModifier( generator, methodCall.Object, methodCall.Arguments[0], "DD"); } protected virtual void HandleAddHours(ISQLGenerator generator, MethodCallExpression methodCall) { AddModifier( generator, methodCall.Object, methodCall.Arguments[0], "HH"); } protected virtual void HandleAddMilliseconds(ISQLGenerator generator, MethodCallExpression methodCall) { AddModifier( generator, methodCall.Object, methodCall.Arguments[0], "MS"); } protected virtual void HandleAddMinutes(ISQLGenerator generator, MethodCallExpression methodCall) { AddModifier( generator, methodCall.Object, methodCall.Arguments[0], "MI"); } protected virtual void HandleAddMonths(ISQLGenerator generator, MethodCallExpression methodCall) { AddModifier( generator, methodCall.Object, methodCall.Arguments[0], "MM"); } protected virtual void HandleAddSeconds(ISQLGenerator generator, MethodCallExpression methodCall) { AddModifier( generator, methodCall.Object, methodCall.Arguments[0], "SS"); } protected virtual void HandleAddYears(ISQLGenerator generator, MethodCallExpression methodCall) { AddModifier( generator, methodCall.Object, methodCall.Arguments[0], "YY"); } protected void AddModifier(ISQLGenerator generator, Expression dateTime, Expression timeSpan, string modifier) { generator.Attach(" DATEADD("); generator.Attach(Expression.Constant(modifier)); generator.Attach(","); generator.Attach(timeSpan); generator.Attach(","); generator.Attach(dateTime); generator.Attach(")"); } } }
{ "content_hash": "ed8139c862371bfe7bd4992dea5787a4", "timestamp": "", "source": "github", "line_count": 146, "max_line_length": 118, "avg_line_length": 33.23972602739726, "alnum_prop": 0.53389655882959, "repo_name": "HastenS/zarf", "id": "2767f299064dba3f192f562568f829756a6ec120", "size": "4855", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/Zarf.SqlServer/Generators/Functions/Handlers/SqlServerDateTimeFunctionHandler.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "420119" } ], "symlink_target": "" }
namespace asio { namespace detail { class std_event : private noncopyable { public: // Constructor. std_event() : signalled_(false) { } // Destructor. ~std_event() { } // Signal the event. template <typename Lock> void signal(Lock& lock) { ASIO_ASSERT(lock.locked()); (void)lock; signalled_ = true; cond_.notify_one(); } // Signal the event and unlock the mutex. template <typename Lock> void signal_and_unlock(Lock& lock) { ASIO_ASSERT(lock.locked()); signalled_ = true; lock.unlock(); cond_.notify_one(); } // Reset the event. template <typename Lock> void clear(Lock& lock) { ASIO_ASSERT(lock.locked()); (void)lock; signalled_ = false; } // Wait for the event to become signalled. template <typename Lock> void wait(Lock& lock) { ASIO_ASSERT(lock.locked()); unique_lock_adapter u_lock(lock); while (!signalled_) cond_.wait(u_lock.unique_lock_); } // Timed wait for the event to become signalled. template <typename Lock> bool wait_for_usec(Lock& lock, long usec) { ASIO_ASSERT(lock.locked()); unique_lock_adapter u_lock(lock); if (!signalled_) cond_.wait_for(u_lock.unique_lock_, std::chrono::microseconds(usec)); return signalled_; } private: // Helper class to temporarily adapt a scoped_lock into a unique_lock so that // it can be passed to std::condition_variable::wait(). struct unique_lock_adapter { template <typename Lock> explicit unique_lock_adapter(Lock& lock) : unique_lock_(lock.mutex().mutex_, std::adopt_lock) { } ~unique_lock_adapter() { unique_lock_.release(); } std::unique_lock<std::mutex> unique_lock_; }; std::condition_variable cond_; bool signalled_; }; } // namespace detail } // namespace asio #include "asio/detail/pop_options.hpp" #endif // defined(ASIO_HAS_STD_MUTEX_AND_CONDVAR) #endif // ASIO_DETAIL_STD_EVENT_HPP
{ "content_hash": "d917f2ca3241a60947313719ef8e5168", "timestamp": "", "source": "github", "line_count": 99, "max_line_length": 79, "avg_line_length": 19.96969696969697, "alnum_prop": 0.6332827516439049, "repo_name": "laeotropic/HTTP-Proxy", "id": "a66a3272511e4f86a4e0cd79dc264ccf573a1daf", "size": "2691", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "deps/asio-1.10.1/include/asio/detail/std_event.hpp", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "C++", "bytes": "25868" } ], "symlink_target": "" }
ACCEPTED #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
{ "content_hash": "5511ad1464145fda6288dd31a59c9ce6", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 39, "avg_line_length": 10.307692307692308, "alnum_prop": 0.6940298507462687, "repo_name": "mdoering/backbone", "id": "505410779c894826f7c2c156650c973ccafba5a2", "size": "182", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Liliopsida/Asparagales/Orchidaceae/Lepanthes/Lepanthes rhynchion/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
package com.streamsets.pipeline.lib.io; import com.streamsets.pipeline.api.impl.Utils; import com.streamsets.pipeline.config.FileRollMode; import com.streamsets.pipeline.config.PostProcessingOptions; import com.streamsets.pipeline.lib.executor.SafeScheduledExecutorService; import com.streamsets.pipeline.lib.util.GlobFilePathUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.Closeable; import java.io.File; import java.io.IOException; import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.ScheduledExecutorService; public class GlobFileContextProvider extends BaseFileContextProvider { private static final Logger LOG = LoggerFactory.getLogger(GlobFileContextProvider.class); private static class GlobFileInfo implements Closeable { private final MultiFileInfo globFileInfo; private final FileFinder fileFinder; private final Path finderPath; // if scan interval is zero the GlobFileInfo will work synchronously and it won't require an executor public GlobFileInfo(MultiFileInfo globFileInfo, ScheduledExecutorService executor, int scanIntervalSecs) { this.globFileInfo = globFileInfo; //For Periodic Pattern Roll mode, we will just use the parent path of //the file for globbing and we will filter just the directories. this.finderPath = (globFileInfo.getFileRollMode() == FileRollMode.PATTERN)? Paths.get(globFileInfo.getFileFullPath()).getParent() : Paths.get(globFileInfo.getFileFullPath()); FileFilterOption filterOption = (globFileInfo.getFileRollMode() == FileRollMode.PATTERN) ? FileFilterOption.FILTER_DIRECTORIES_ONLY : FileFilterOption.FILTER_REGULAR_FILES_ONLY; this.fileFinder = (scanIntervalSecs == 0) ? new SynchronousFileFinder(finderPath, filterOption) : new AsynchronousFileFinder(finderPath, scanIntervalSecs, executor, filterOption); } public MultiFileInfo getFileInfo(Path path) { //For Periodic Pattern Roll Mode we will only watch for path of the parent //Once we resolve the filepath for parent //we will attach the final file name to the path to do the periodic pattern match. if (globFileInfo.getFileRollMode() == FileRollMode.PATTERN) { return new MultiFileInfo( globFileInfo, path.toString() + File.separatorChar + Paths.get(globFileInfo.getFileFullPath()).getFileName() ); } else { return new MultiFileInfo( globFileInfo, path.toString() ); } } public Set<Path> find() throws IOException { return fileFinder.find(); } public boolean forget(MultiFileInfo multiFileInfo) { return (multiFileInfo.getFileRollMode() == FileRollMode.PATTERN) ? fileFinder.forget(Paths.get(multiFileInfo.getFileFullPath()).getParent()) : fileFinder.forget(Paths.get(multiFileInfo.getFileFullPath())); } @Override public void close() throws IOException { fileFinder.close(); } @Override public String toString() { return Utils.format("GlobFileInfo [finderPath='{}']", finderPath); } } private final List<GlobFileInfo> globFileInfos; private final Charset charset; private final int maxLineLength; private final PostProcessingOptions postProcessing; private final String archiveDir; private final FileEventPublisher eventPublisher; private int scanIntervalSecs; private boolean inPreviewMode; private boolean allowForLateDirectoryCreation; private Map<Path, MultiFileInfo> nonExistingPaths = new HashMap<Path, MultiFileInfo>(); private ScheduledExecutorService executor; private DirectoryPathCreationWatcher directoryWatcher = null; public GlobFileContextProvider( boolean allowForLateDirectoryCreation, List<MultiFileInfo> fileInfos, int scanIntervalSecs, Charset charset, int maxLineLength, PostProcessingOptions postProcessing, String archiveDir, FileEventPublisher eventPublisher, boolean inPreviewMode) throws IOException { super(); // if scan interval is zero the GlobFileInfo will work synchronously and it won't require an executor globFileInfos = new CopyOnWriteArrayList<GlobFileInfo>(); fileContexts = new ArrayList<>(); this.allowForLateDirectoryCreation = allowForLateDirectoryCreation; this.scanIntervalSecs = scanIntervalSecs; this.charset = charset; this.maxLineLength = maxLineLength; this.postProcessing = postProcessing; this.archiveDir = archiveDir; this.eventPublisher = eventPublisher; this.inPreviewMode = inPreviewMode; executor = (scanIntervalSecs == 0) ? null : new SafeScheduledExecutorService(fileInfos.size() / 3 + 1, "File Finder"); for (MultiFileInfo fileInfo : fileInfos) { if (!checkForNonExistingPath(fileInfo)) { addToContextOrGlobFileInfo(fileInfo); } } if (allowForLateDirectoryCreation && !nonExistingPaths.isEmpty()) { directoryWatcher = new DirectoryPathCreationWatcher(nonExistingPaths.keySet(), this.scanIntervalSecs); } LOG.debug("Created"); } private void addToContextOrGlobFileInfo(MultiFileInfo fileInfo) throws IOException { //Make sure if it is a periodic pattern roll mode and there is no globbing in the parent path //if so add it to globFileInfo if (fileInfo.getFileRollMode() == FileRollMode.PATTERN && !GlobFilePathUtil.hasGlobWildcard(fileInfo.getFileFullPath().replaceAll("\\$\\{"+"PATTERN"+"\\}", ""))) { fileContexts.add( new FileContext( fileInfo, charset, maxLineLength, postProcessing, archiveDir, eventPublisher, inPreviewMode ) ); } else { //If scanIntervalSecs == 0, the GlobFile Info doc says it is synchronous it does not need a executor. globFileInfos.add(new GlobFileInfo(fileInfo, (scanIntervalSecs == 0)? null : executor, scanIntervalSecs)); } } private boolean checkForNonExistingPath(MultiFileInfo multiFileInfo) throws IOException { Path pathToSearchFor = GlobFilePathUtil.getPivotPath(Paths.get(multiFileInfo.getFileFullPath()).getParent()); boolean exists = Files.exists(pathToSearchFor); if (!exists) { if (!allowForLateDirectoryCreation) { throw new IOException(Utils.format("Path does not exist:{}", pathToSearchFor)); } else { nonExistingPaths.put(pathToSearchFor, multiFileInfo); return true; } } return false; } private void findCreatedDirectories() throws IOException{ if (allowForLateDirectoryCreation && !nonExistingPaths.isEmpty()) { for (Path foundPath : directoryWatcher.find()) { MultiFileInfo fileInfo = nonExistingPaths.get(foundPath); addToContextOrGlobFileInfo(fileInfo); nonExistingPaths.remove(foundPath); LOG.debug("Found Path '{}'", foundPath); } } } private Map<FileContext, GlobFileInfo> fileToGlobFile = new HashMap<>(); private void findNewFileContexts() throws IOException { //Thread fail safe Iterator<GlobFileInfo> iterator = globFileInfos.iterator(); while (iterator.hasNext()) { GlobFileInfo globfileInfo = iterator.next(); Set<Path> found = globfileInfo.find(); for (Path path : found) { FileContext fileContext = new FileContext( globfileInfo.getFileInfo(path), charset, maxLineLength, postProcessing, archiveDir, eventPublisher, inPreviewMode ); fileContexts.add(fileContext); fileToGlobFile.put(fileContext, globfileInfo); LOG.debug("Found '{}'", fileContext); } } } @Override public void purge() { Iterator<FileContext> iterator = fileContexts.iterator(); boolean purgedAtLeastOne = false; while (iterator.hasNext()) { FileContext fileContext = iterator.next(); if (!fileContext.isActive()) { fileContext.close(); iterator.remove(); if (fileToGlobFile.containsKey(fileContext)) { fileToGlobFile.get(fileContext).forget(fileContext.getMultiFileInfo()); } LOG.debug("Removed '{}'", fileContext); purgedAtLeastOne = true; } } if (purgedAtLeastOne) { //reset loop counter to be within boundaries. resetCurrentAndStartingIdx(); startNewLoop(); } } /** * Sets the file offsets to use for the next read. To work correctly, the last return offsets should be used or * an empty <code>Map</code> if there is none. * <p/> * If a reader is already live, the corresponding set offset is ignored as we cache all the contextual information * of live readers. * * @param offsets directory offsets. * @throws java.io.IOException thrown if there was an IO error while preparing file offsets. */ @Override public void setOffsets(Map<String, String> offsets) throws IOException { Utils.checkNotNull(offsets, "offsets"); LOG.trace("setOffsets()"); // We look for created directory paths here findCreatedDirectories(); // we look for new files only here findNewFileContexts(); // we purge file only here purge(); super.setOffsets(offsets); startNewLoop(); } @Override public void close() { LOG.debug("Closed"); if (executor != null) { executor.shutdownNow(); } if (directoryWatcher != null) { directoryWatcher.close(); } for (GlobFileInfo globFileInfo : globFileInfos) { try { globFileInfo.close(); } catch (IOException ex) { LOG.warn("Could not close '{}': {}", globFileInfo, ex.toString(), ex); } } //Close File Contexts super.close(); } }
{ "content_hash": "6f3b4c654c699b63076a8c913ba4382a", "timestamp": "", "source": "github", "line_count": 294, "max_line_length": 116, "avg_line_length": 34.554421768707485, "alnum_prop": 0.6927847229057978, "repo_name": "rockmkd/datacollector", "id": "3b711ed506ddc2bee93f685040c7e3dd71a88f2f", "size": "10757", "binary": false, "copies": "5", "ref": "refs/heads/master", "path": "commonlib/src/main/java/com/streamsets/pipeline/lib/io/GlobFileContextProvider.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ANTLR", "bytes": "101291" }, { "name": "CSS", "bytes": "120603" }, { "name": "Groovy", "bytes": "11876" }, { "name": "HTML", "bytes": "528951" }, { "name": "Java", "bytes": "20152513" }, { "name": "JavaScript", "bytes": "1070702" }, { "name": "Python", "bytes": "7413" }, { "name": "Scala", "bytes": "6347" }, { "name": "Shell", "bytes": "30088" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <mbeans-descriptors> <mbean name="Mapper" description="Maps requests received by the associated connector to Hosts, Contexts and Wrappers" domain="Catalina" group="Mapper" type="org.apache.catalina.mapper.MapperListener"> <attribute name="stateName" description="The name of the LifecycleState that this component is currently in" type="java.lang.String" writeable="false"/> <operation name="start" description="Start" impact="ACTION" returnType="void" /> <operation name="stop" description="Stop" impact="ACTION" returnType="void" /> <operation name="init" description="Init" impact="ACTION" returnType="void" /> <operation name="destroy" description="Destroy" impact="ACTION" returnType="void" /> </mbean> </mbeans-descriptors>
{ "content_hash": "eb530fafcd1774629b87c5138ec2b0e5", "timestamp": "", "source": "github", "line_count": 37, "max_line_length": 100, "avg_line_length": 46.054054054054056, "alnum_prop": 0.7001173708920188, "repo_name": "IAMTJW/Tomcat-8.5.20", "id": "e500d9c0eb9b34220986cab8f72f1562f1680006", "size": "1704", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "tomcat-8.5.20/java/org/apache/catalina/mapper/mbeans-descriptors.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "38058" }, { "name": "CSS", "bytes": "14009" }, { "name": "HTML", "bytes": "333233" }, { "name": "Java", "bytes": "19675734" }, { "name": "NSIS", "bytes": "44042" }, { "name": "Perl", "bytes": "14275" }, { "name": "Shell", "bytes": "48396" }, { "name": "XSLT", "bytes": "32480" } ], "symlink_target": "" }
(function( $ ){ /* * Handle input. Call public functions and initializers */ $.fn.tablerodecontrol = function(data){ var _this = $(this); var plugin = _this.data('tablerodecontrol'); /*Inicializado ?*/ if (!plugin) { plugin = new $.tablerodecontrol(this, data); _this.data('tablerodecontrol', plugin); return plugin; /*Si ya fue inizializado regresamos el plugin*/ }else{ return plugin; } }; /* * Plugin Constructor */ $.tablerodecontrol = function(container, options){ var plugin = this; /* * Default Values */ var defaults = { }; /* * Important Components */ var $container = $(container); var settings; var $table1; var $table2; /* * Private methods */ var filter = function(from,to){ var empleados_select = $container.find("select[name=idempleado]").multipleSelect('getSelects'); if(typeof from == 'undefined' && typeof to == 'undefined'){ //El origen de los tiempo from = moment('19-08-1990','DD-MM-YYYY'); to = moment(); } if(typeof $table1 != 'undefined' && typeof $table2 != 'undefined'){ $table1.clear(); $table1.destroy(); $table2.clear(); $table2.destroy(); } $.ajax({ method:'POST', dataType:'json', url:'/reportes/filterempleado', async:false, data:{empleados:empleados_select,from:from.format('YYYY-MM-DD'),to:to.format('YYYY-MM-DD')}, success:function(data){ //Las cabeceras de nuestras tablas var thead_servicios = $('<tr>'); thead_servicios.append('<th>Servicios</th>'); var thead_productos = $('<tr>'); thead_productos.append('<th>Productos</th>'); $.each(data.empleados,function(){ var td = $('<th>'+this.empleado_nombre+'</th>').attr('idempleado',this.idempleado); thead_servicios.append(td); var td = $('<th>'+this.empleado_nombre+'</th>').attr('idempleado',this.idempleado); thead_productos.append(td); }); $tableServicios.find('thead').append(thead_servicios); $tableProductos.find('thead').append(thead_productos); /* * SERVICIOS */ if(data.vendidos.length > 0){ //Creamos el esqueleto $.each(data.vendidos[0].servicios,function(idservicio){ var tr = $('<tr>').attr('idservicio', idservicio); tr.append('<td>'+this.servicio_nombre+'</td>'); for(var i=0;i<data.empleados.length;i++){ tr.append('<td></td>'); } $tableServicios.find('tbody').append(tr); }); //Insertamos los servicios $.each(data.vendidos,function(){ var index = $tableServicios.find('thead tr th[idempleado='+this.idempleado+']').index(); $.each(this.servicios,function(idservicio){ var td = $tableServicios.find('tr[idservicio='+idservicio+']').find('td').eq(index); td.text(this.vendidos); }); }); } /* * MEMBRESIA */ if(data.vendidos.length > 0){ //Creamos el esqueleto $.each(data.vendidos[0].membresias,function(idmembresia){ var tr = $('<tr>').attr('idmembresia', idmembresia); tr.append('<td>'+this.membresia_nombre+'</td>'); for(var i=0;i<data.empleados.length;i++){ tr.append('<td></td>'); } $tableServicios.find('tbody').append(tr); }); //Insertamos los servicios $.each(data.vendidos,function(idempleado){ var index = $tableServicios.find('thead tr th[idempleado='+this.idempleado+']').index(); $.each(this.membresias,function(idmembresia){ var td = $tableServicios.find('tr[idmembresia='+idmembresia +']').find('td').eq(index); td.text(this.vendidos); }); }); } /* * PRODUCTOS */ if(data.vendidos.length > 0){ //Creamos el esqueleto $.each(data.vendidos[0].productos,function(idproducto){ var tr = $('<tr>').attr('idproducto', idproducto); tr.append('<td>'+this.producto_nombre+'</td>'); for(var i=0;i<data.empleados.length;i++){ tr.append('<td></td>'); } $tableProductos.find('tbody').append(tr); }); //Insertamos los servicios $.each(data.vendidos,function(idempleado){ var index = $tableProductos.find('thead tr th[idempleado='+this.idempleado+']').index(); $.each(this.productos,function(idproducto){ var td = $tableProductos.find('tr[idproducto='+idproducto+']').find('td').eq(index); td.text(this.vendidos); }); }); } /* * DATATABLE */ $.ajax({ url: '/json/lang_es_datatable.json', dataType: 'json', async:false, success: function(data){ $table1 = $tableServicios.DataTable({ language:data, }); $table2 = $tableProductos.DataTable({ language:data, }); } }); } }) } /* * Public methods */ plugin.init = function(){ settings = plugin.settings = $.extend({}, defaults, options); //Inicializamos nuestro multiple select $container.find("select[name=idclinica]").multipleSelect({ single: true }); /* * El evento filter */ var pickdateFrom = $container.find('input[name=filter_indicadores_from]').pickadate({ monthsFull: [ 'enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre' ], monthsShort: [ 'ene', 'feb', 'mar', 'abr', 'may', 'jun', 'jul', 'ago', 'sep', 'oct', 'nov', 'dic' ], weekdaysFull: [ 'domingo', 'lunes', 'martes', 'miércoles', 'jueves', 'viernes', 'sábado' ], weekdaysShort: [ 'dom', 'lun', 'mar', 'mié', 'jue', 'vie', 'sáb' ], today: 'hoy', clear: 'borrar', close: 'cerrar', firstDay: 1, format: 'd !de mmmm !de yyyy', formatSubmit: 'yyyy/mm/dd', selectMonths: true, selectYears: 25, max: new Date(), }); var pickdateTo = $container.find('input[name=filter_to_indicadores]').pickadate({ monthsFull: [ 'enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre' ], monthsShort: [ 'ene', 'feb', 'mar', 'abr', 'may', 'jun', 'jul', 'ago', 'sep', 'oct', 'nov', 'dic' ], weekdaysFull: [ 'domingo', 'lunes', 'martes', 'miércoles', 'jueves', 'viernes', 'sábado' ], weekdaysShort: [ 'dom', 'lun', 'mar', 'mié', 'jue', 'vie', 'sáb' ], today: 'hoy', clear: 'borrar', close: 'cerrar', firstDay: 1, format: 'd !de mmmm !de yyyy', formatSubmit: 'yyyy/mm/dd', selectMonths: true, selectYears: 25, max: new Date(), }); //Inicializamos nuestros calendarios del filtro de fechas $container.find('input[name=filter_from]').datepicker({ changeMonth: true, changeYear: true, showButtonPanel: true, dateFormat: 'MM yy', altFormat: "yy-mm-dd", }); $container.find('input[name=filter_from]').datepicker('option','onClose',function(textDate,inst){ var date = new Date(inst.selectedYear, inst.selectedMonth, 1); var from_month = date.getMonth() +1 ; var from_year = date.getFullYear(); var from_full = from_year+"-"+from_month+"-1"; $container.find('input[name=filter_from_hidden]').val(from_full); $container.find('input[name=filter_from]').datepicker('setDate',date); }); $container.find('input[name=filter_to]').datepicker({ changeMonth: true, changeYear: true, showButtonPanel: true, dateFormat: 'MM yy', altFormat: "yy-mm-dd", }); $container.find('input[name=filter_to]').datepicker('option','onClose',function(textDate,inst){ var date = new Date(inst.selectedYear, inst.selectedMonth, 1); var to_month = date.getMonth() +1 ; var to_year = date.getFullYear(); var to_day = new Date(to_year, to_month , 0).getDate(); var to_full = to_year+"-"+to_month+"-"+to_day; $container.find('input[name=filter_to_hidden]').val(to_full); $container.find('input[name=filter_to]').datepicker('setDate',date); }); $container.find('button#filterbydate').on('click',function(){ $('body').addClass('loading'); var from = $container.find('input[name=filter_from_hidden]').val(); var to = $container.find('input[name=filter_to_hidden]').val(); var idclinica = $container.find("select[name=idclinica]").multipleSelect("getSelects")[0]; $.ajax({ url: "/reportes/tablerodecontrol", type: 'POST', dataType: 'JSON', data:{from:from,to:to,idclinica:idclinica}, success: function (data, textStatus, jqXHR) { //$container.find('input[name=filter_indicadores_from]').pickadate('picker').set('select', new Date(data.from)); //$container.find('input[name=filter_to_indicadores]').pickadate('picker').set('select', new Date(data.to)); //CLINICA $container.find('#table_clinica tbody tr').remove(); var clinica = data.data.clinica; var empleados = data.data.empleados; var $tr = $('<tr>'); $tr.append('<td>'+clinica.clinica_nombre+'</td>'); $tr.append('<td>'+accounting.formatMoney(clinica.clinica_meta)+'</td>'); $tr.append('<td>'+accounting.formatMoney(clinica.clinica_acumulado)+'</td>'); $tr.append('<td>'+accounting.formatMoney(clinica.clinica_hoy)+'</td>'); $tr.append('<td>'+clinica.clinica_diasrestantes+'</td>'); $container.find('#table_clinica tbody').append($tr); //EMPLEADOS $container.find('#table_empleado tbody tr').remove(); $container.find('#table_indicadores tbody tr').remove(); $container.find('#table_indicadores thead th').remove(); $container.find('#table_indicadores thead').append('<th>Indicadores</th>'); //INDICADORES ESTRUCTURA var $tr = $('<tr>'); $tr.append('<td><b>Clientes atendidos por día</b></td>'); for(var i=0; i<empleados.length;i++){ $tr.append('<td></td>'); } $container.find('#table_indicadores tbody').append($tr); var $tr = $('<tr>'); $tr.append('<td><b>Servicios Com. por día</b></td>'); for(var i=0; i<empleados.length;i++){ $tr.append('<td></td>'); } $container.find('#table_indicadores tbody').append($tr); var $tr = $('<tr>'); $tr.append('<td><b>Venta promedio por cliente</b></td>'); for(var i=0; i<empleados.length;i++){ $tr.append('<td></td>'); } $container.find('#table_indicadores tbody').append($tr); var $tr = $('<tr>'); $tr.append('<td><b>Productos por cliente</b></td>'); for(var i=0; i<empleados.length;i++){ $tr.append('<td></td>'); } $container.find('#table_indicadores tbody').append($tr); var $tr = $('<tr>'); $tr.append('<td><b>Tiempo promedio de servicio</td>'); for(var i=0; i<empleados.length;i++){ $tr.append('<td></td>'); } $container.find('#table_indicadores tbody').append($tr); var $tr = $('<tr>'); $tr.append('<td><b>Clientes nuevos</b></td>'); for(var i=0; i<empleados.length;i++){ $tr.append('<td></td>'); } $container.find('#table_indicadores tbody').append($tr); var $tr = $('<tr>'); $tr.append('<td><b>Membresias</b></td>'); for(var i=0; i<empleados.length;i++){ $tr.append('<td></td>'); } $container.find('#table_indicadores tbody').append($tr); var $tr = $('<tr>'); $tr.append('<td><b>Pagos anticipados</b></td>'); for(var i=0; i<empleados.length;i++){ $tr.append('<td></td>'); } $container.find('#table_indicadores tbody').append($tr); var $tr = $('<tr>'); $tr.append('<td colspan="'+(empleados.length + 1)+'"><b>Tasa de retorno</b></td>'); $container.find('#table_indicadores tbody').append($tr); var $tr = $('<tr>'); $tr.append('<td><b>30 Días</b></td>'); for(var i=0; i<empleados.length;i++){ $tr.append('<td></td>'); } $container.find('#table_indicadores tbody').append($tr); var $tr = $('<tr>'); $tr.append('<td><b>45 Días</b></td>'); for(var i=0; i<empleados.length;i++){ $tr.append('<td></td>'); } $container.find('#table_indicadores tbody').append($tr); var $tr = $('<tr>'); $tr.append('<td><b>60 Días</b></td>'); for(var i=0; i<empleados.length;i++){ $tr.append('<td></td>'); } $container.find('#table_indicadores tbody').append($tr); empleados.forEach(function(value,index){ var $tr = $('<tr>'); $tr.append('<td>'+value.empleado_nombre+'</td>'); $tr.append('<td>'+accounting.formatMoney(value.empleado_meta)+'</td>'); $tr.append('<td>'+accounting.formatMoney(value.empleado_acumulado)+'</td>'); $tr.append('<td>'+accounting.formatMoney(value.empleado_hoy)+'</td>'); $tr.append('<td>'+value.empleado_diasrestantes+'</td>'); $container.find('#table_empleado tbody').append($tr); //INDICADORES $container.find('#table_indicadores thead').append('<th>'+value.empleado_nombre+'</th>'); $container.find('#table_indicadores tbody tr').eq(0).find('td').eq(index+1).text(value.servicios_por_dia); $container.find('#table_indicadores tbody tr').eq(1).find('td').eq(index+1).text(value.servicioscomision_por_dia); $container.find('#table_indicadores tbody tr').eq(2).find('td').eq(index+1).text(accounting.formatMoney(value.venta_promedio_por_cliente)); $container.find('#table_indicadores tbody tr').eq(3).find('td').eq(index+1).text(value.productos_por_cliente); $container.find('#table_indicadores tbody tr').eq(4).find('td').eq(index+1).text(value.tiempo_promedio_servicio); $container.find('#table_indicadores tbody tr').eq(5).find('td').eq(index+1).text(value.clientes_nuevos); $container.find('#table_indicadores tbody tr').eq(6).find('td').eq(index+1).text(value.membresias); $container.find('#table_indicadores tbody tr').eq(7).find('td').eq(index+1).text(value.serviciomembresias); $container.find('#table_indicadores tbody tr').eq(8).find('td').eq(index+1).text(value.pagos_anticipados); $container.find('#table_indicadores tbody tr').eq(9).find('td').eq(index+1).text(value.tasa_retorno['30dias']); $container.find('#table_indicadores tbody tr').eq(10).find('td').eq(index+1).text(value.tasa_retorno['45dias']); $container.find('#table_indicadores tbody tr').eq(11).find('td').eq(index+1).text(value.tasa_retorno['60dias']); }); $('body').removeClass('loading'); } }); $container.find('#indicadores').show(); }); $container.find('button#filterbydate2').on('click',function(){ $('body').addClass('loading'); var from = moment($container.find('input[name=filter_indicadores_from_submit]').val(),'YYYY-MM-DD'); var to = moment($container.find('input[name=filter_to_indicadores_submit]').val(),'YYYY-MM-DD'); var idclinica = $container.find("select[name=idclinica]").multipleSelect("getSelects")[0]; $.ajax({ url: "/reportes/tablerodecontrol", type: 'POST', dataType: 'JSON', data:{from:from.format('YYYY-MM-DD'),to:to.format('YYYY-MM-DD'),idclinica:idclinica}, success: function (data, textStatus, jqXHR) { //CLINICA var clinica = data.data.clinica; var empleados = data.data.empleados; //EMPLEADOS $container.find('#table_indicadores tbody tr').remove(); $container.find('#table_indicadores thead th').remove(); $container.find('#table_indicadores thead').append('<th>Indicadores</th>'); //INDICADORES ESTRUCTURA var $tr = $('<tr>'); $tr.append('<td><b>Clientes atendidos por día</b></td>'); for(var i=0; i<empleados.length;i++){ $tr.append('<td></td>'); } $container.find('#table_indicadores tbody').append($tr); var $tr = $('<tr>'); $tr.append('<td><b>Servicios Com. por día</b></td>'); for(var i=0; i<empleados.length;i++){ $tr.append('<td></td>'); } $container.find('#table_indicadores tbody').append($tr); var $tr = $('<tr>'); $tr.append('<td><b>Venta promedio por cliente</b></td>'); for(var i=0; i<empleados.length;i++){ $tr.append('<td></td>'); } $container.find('#table_indicadores tbody').append($tr); var $tr = $('<tr>'); $tr.append('<td><b>Productos por cliente</b></td>'); for(var i=0; i<empleados.length;i++){ $tr.append('<td></td>'); } $container.find('#table_indicadores tbody').append($tr); var $tr = $('<tr>'); $tr.append('<td><b>Tiempo promedio de servicio</td>'); for(var i=0; i<empleados.length;i++){ $tr.append('<td></td>'); } $container.find('#table_indicadores tbody').append($tr); var $tr = $('<tr>'); $tr.append('<td><b>Clientes nuevos</b></td>'); for(var i=0; i<empleados.length;i++){ $tr.append('<td></td>'); } $container.find('#table_indicadores tbody').append($tr); var $tr = $('<tr>'); $tr.append('<td><b>Membresias</b></td>'); for(var i=0; i<empleados.length;i++){ $tr.append('<td></td>'); } $container.find('#table_indicadores tbody').append($tr); var $tr = $('<tr>'); $tr.append('<td><b>Servicio de membresias</b></td>'); for(var i=0; i<empleados.length;i++){ $tr.append('<td></td>'); } $container.find('#table_indicadores tbody').append($tr); var $tr = $('<tr>'); $tr.append('<td><b>Pagos anticipados</b></td>'); for(var i=0; i<empleados.length;i++){ $tr.append('<td></td>'); } $container.find('#table_indicadores tbody').append($tr); var $tr = $('<tr>'); $tr.append('<td colspan="'+(empleados.length + 1)+'"><b>Tasa de retorno</b></td>'); $container.find('#table_indicadores tbody').append($tr); var $tr = $('<tr>'); $tr.append('<td><b>30 Días</b></td>'); for(var i=0; i<empleados.length;i++){ $tr.append('<td></td>'); } $container.find('#table_indicadores tbody').append($tr); var $tr = $('<tr>'); $tr.append('<td><b>45 Días</b></td>'); for(var i=0; i<empleados.length;i++){ $tr.append('<td></td>'); } $container.find('#table_indicadores tbody').append($tr); var $tr = $('<tr>'); $tr.append('<td><b>60 Días</b></td>'); for(var i=0; i<empleados.length;i++){ $tr.append('<td></td>'); } $container.find('#table_indicadores tbody').append($tr); empleados.forEach(function(value,index){ //INDICADORES $container.find('#table_indicadores thead').append('<th>'+value.empleado_nombre+'</th>'); $container.find('#table_indicadores tbody tr').eq(0).find('td').eq(index+1).text(value.servicios_por_dia); $container.find('#table_indicadores tbody tr').eq(1).find('td').eq(index+1).text(value.servicioscomision_por_dia); $container.find('#table_indicadores tbody tr').eq(2).find('td').eq(index+1).text(accounting.formatMoney(value.venta_promedio_por_cliente)); $container.find('#table_indicadores tbody tr').eq(3).find('td').eq(index+1).text(value.productos_por_cliente); $container.find('#table_indicadores tbody tr').eq(4).find('td').eq(index+1).text(value.tiempo_promedio_servicio); $container.find('#table_indicadores tbody tr').eq(5).find('td').eq(index+1).text(value.clientes_nuevos); $container.find('#table_indicadores tbody tr').eq(6).find('td').eq(index+1).text(value.membresias); $container.find('#table_indicadores tbody tr').eq(7).find('td').eq(index+1).text(value.serviciomembresias); $container.find('#table_indicadores tbody tr').eq(8).find('td').eq(index+1).text(value.pagos_anticipados); $container.find('#table_indicadores tbody tr').eq(10).find('td').eq(index+1).text(value.tasa_retorno['30dias']); $container.find('#table_indicadores tbody tr').eq(11).find('td').eq(index+1).text(value.tasa_retorno['45dias']); $container.find('#table_indicadores tbody tr').eq(12).find('td').eq(index+1).text(value.tasa_retorno['60dias']); }); $('body').removeClass('loading'); } }); $container.find('#indicadores').show(); }); } /* * Plugin initializing */ plugin.init(); } })( jQuery );
{ "content_hash": "34cef179869cba7b19ddf531b646c80f", "timestamp": "", "source": "github", "line_count": 613, "max_line_length": 168, "avg_line_length": 48.783034257748774, "alnum_prop": 0.3972378277153558, "repo_name": "dcastanedob/feetcenter", "id": "40f395b49c4b5f470bb0e7c9c513d6e6062d599f", "size": "29922", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "public/js/reportes/tablerodecontrol.js", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "ApacheConf", "bytes": "711" }, { "name": "CSS", "bytes": "372682" }, { "name": "HTML", "bytes": "649253" }, { "name": "JavaScript", "bytes": "2538978" }, { "name": "PHP", "bytes": "14297161" } ], "symlink_target": "" }
package org.elasticsearch.search.aggregations.metrics; import org.elasticsearch.common.io.stream.Writeable.Reader; import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.aggregations.ParsedAggregation; import org.elasticsearch.test.InternalAggregationTestCase; import java.util.HashMap; import java.util.List; import java.util.Map; public class InternalWeightedAvgTests extends InternalAggregationTestCase<InternalWeightedAvg> { @Override protected InternalWeightedAvg createTestInstance(String name, Map<String, Object> metadata) { DocValueFormat formatter = randomNumericDocValueFormat(); return new InternalWeightedAvg( name, randomDoubleBetween(0, 100000, true), randomDoubleBetween(0, 100000, true), formatter, metadata); } @Override protected Reader<InternalWeightedAvg> instanceReader() { return InternalWeightedAvg::new; } @Override protected void assertReduced(InternalWeightedAvg reduced, List<InternalWeightedAvg> inputs) { double sum = 0; double weight = 0; for (InternalWeightedAvg in : inputs) { sum += in.getSum(); weight += in.getWeight(); } assertEquals(sum, reduced.getSum(), 0.0000001); assertEquals(weight, reduced.getWeight(), 0.0000001); assertEquals(sum / weight, reduced.getValue(), 0.0000001); } @Override protected void assertFromXContent(InternalWeightedAvg avg, ParsedAggregation parsedAggregation) { ParsedWeightedAvg parsed = ((ParsedWeightedAvg) parsedAggregation); assertEquals(avg.getValue(), parsed.getValue(), Double.MIN_VALUE); // we don't print out VALUE_AS_STRING for avg.getCount() == 0, so we cannot get the exact same value back if (avg.getWeight() != 0) { assertEquals(avg.getValueAsString(), parsed.getValueAsString()); } } @Override protected InternalWeightedAvg mutateInstance(InternalWeightedAvg instance) { String name = instance.getName(); double sum = instance.getSum(); double weight = instance.getWeight(); DocValueFormat formatter = instance.getFormatter(); Map<String, Object> metadata = instance.getMetadata(); switch (between(0, 2)) { case 0: name += randomAlphaOfLength(5); break; case 1: if (Double.isFinite(sum)) { sum += between(1, 100); } else { sum = between(1, 100); } break; case 2: if (Double.isFinite(weight)) { weight += between(1, 100); } else { weight = between(1, 100); } break; case 3: if (metadata == null) { metadata = new HashMap<>(1); } else { metadata = new HashMap<>(instance.getMetadata()); } metadata.put(randomAlphaOfLength(15), randomInt()); break; default: throw new AssertionError("Illegal randomisation branch"); } return new InternalWeightedAvg(name, sum, weight, formatter, metadata); } }
{ "content_hash": "81e2ff73b7b9184bd83ffde540c81e29", "timestamp": "", "source": "github", "line_count": 92, "max_line_length": 113, "avg_line_length": 35.48913043478261, "alnum_prop": 0.618989280245023, "repo_name": "HonzaKral/elasticsearch", "id": "3a3def49f3c616bd3056dd64546f84a4b94fe0cc", "size": "4053", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalWeightedAvgTests.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "21661311" }, { "name": "Python", "bytes": "23898" }, { "name": "Ruby", "bytes": "17975" }, { "name": "Shell", "bytes": "27701" } ], "symlink_target": "" }
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~ Copyright © 2013-2015 The Nxt Core Developers. ~ ~ ~ ~ See the AUTHORS.txt, DEVELOPER-AGREEMENT.txt and LICENSE.txt files at ~ ~ the top-level directory of this distribution for the individual copyright ~ ~ holder information and the developer policies on copyright and licensing. ~ ~ ~ ~ Unless otherwise agreed in a custom licensing agreement, no part of the ~ ~ Nxt software, including this file, may be copied, modified, propagated, ~ ~ or distributed except according to the terms contained in the LICENSE.txt ~ ~ file. ~ ~ ~ ~ Removal or modification of this copyright notice is prohibited. ~ ~ ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> <div class="modal fade" id="transfer_currency_modal" data-transaction-type="5" data-transaction-subtype="3" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <h4 class="modal-title" data-i18n="transfer_currency">Transfer Currency</h4> </div> <div class="modal-body"> <form role="form" autocomplete="off"> <div class="callout callout-danger error_message" style="display:none"></div> <div data-replace-with-modal-template="recipient_modal_template"></div> <div class="form-group"> <div class="form-group"> <label for="transfer_currency_code" data-i18n="currency">CURRENCY</label> <input type="text" maxlength="5" class="form-control" name="code" id="transfer_currency_code" placeholder="Currency Code" data-i18n="[placeholder]currency_code" tabindex="2" /> </div> <p><span id="transfer_currency_available" style="font-style:italic"></span></p> <input type="hidden" name="currency" id="transfer_currency_currency" value="" /> <input type="hidden" name="decimals" id="transfer_currency_decimals" value="" /> </div> <div class="form-group"> <label for="transfer_currency_units" data-i18n="units">UNITS</label> <div class="input-group"> <input type="number" name="units" id="transfer_currency_units" class="form-control" step="any" min="0" placeholder="Units" data-i18n="[placeholder]units" tabindex="3"> <span class="input-group-addon" id="transfer_currency_units_code"></span> </div> </div> <div data-replace-with-modal-template="add_message_modal_template"></div> <div data-replace-with-modal-template="secret_phrase_modal_template"></div> <div data-replace-with-modal-template="advanced_fee_deadline_template"></div> <div data-replace-with-modal-template="advanced_approve_template"></div> <div data-replace-with-modal-template="advanced_rt_hash_template"></div> <div data-replace-with-modal-template="advanced_broadcast_template"></div> <div data-replace-with-modal-template="advanced_note_to_self_template"></div> <div class="callout account_info" style="display:none;margin-bottom: 0;"></div> <input type="hidden" name="request_type" value="transferCurrency" /> <input type="hidden" name="converted_account_id" value="" /> <input type="hidden" name="merchant_info" value="" data-default="" /> </form> </div> <div class="modal-footer" style="margin-top:0;"> <div class="advanced_info"><strong data-i18n="fee">Fee:</strong> <span class="advanced_fee">1 HZ</span> - <a href="#" data-i18n="advanced">advanced</a></div> <button type="button" class="btn btn-default" data-dismiss="modal" data-i18n="cancel">Cancel</button> <button type="button" class="btn btn-primary" data-loading-text="Submitting..." data-i18n="transfer_currency;[placeholder]submitting">Transfer Currency</button> </div> </div> </div> </div> <div class="modal fade" id="currency_order_modal" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <!-- todo --> <h4 class="modal-title"><span data-i18n="confirm_exchange">Confirm Exchange</span> <span class="currency_order_modal_type"></span></h4> </div> <div class="modal-body"> <form role="form" autocomplete="off"> <div class="callout callout-danger error_message" style="display:none"></div> <div class="form-group"> <label data-i18n="exchange_description">EXCHANGE DESCRIPTION</label> <p id="currency_order_description"></p> <input type="hidden" name="currency" id="currency_order_currency" value="" /> <input type="hidden" name="units" id="currency_order_units" value="" /> <input type="hidden" name="rateNQT" id="currency_order_rate" value="" /> <input type="hidden" name="feeNQT" id="currency_order_fee" value="" /> <input type="hidden" name="deadline" id="currency_order_deadline" data-default="24" value="24" /> </div> <div class="form-group"> <label><span data-i18n="total">TOTAL</span> <i id="currency_order_total_tooltip" class="fa fa-question-circle" style="color:#4CAA6E" data-toggle="popover" data-placement="right" data-content=""></i></label> <p id="currency_order_total"></p> </div> <div class="form-group"> <label data-i18n="fee">FEE</label> <p id="currency_order_fee_paid"></p> </div> <div data-replace-with-modal-template="secret_phrase_modal_template"></div> <div data-replace-with-modal-template="advanced_fee_deadline_template"></div> <div data-replace-with-modal-template="advanced_approve_template"></div> <div data-replace-with-modal-template="advanced_rt_hash_template"></div> <div data-replace-with-modal-template="advanced_broadcast_template"></div> <div data-replace-with-modal-template="advanced_note_to_self_template"></div> <input type="hidden" name="currency_order_type" id="currency_order_type" /> <input type="hidden" name="request_type" value="orderCurrency" /> </form> </div> <div class="modal-footer" style="margin-top:0;"> <div class="advanced_info"><strong data-i18n="fee">Fee:</strong> <span class="advanced_fee">1 HZ</span> - <a href="#" data-i18n="advanced">advanced</a></div> <button type="button" class="btn btn-default" data-dismiss="modal" data-i18n="cancel">Cancel</button> <button type="button" class="btn btn-primary" data-loading-text="Submitting..." id="currency_order_modal_button" data-i18n="[data-loading-text]submitting"></button> </div> </div> </div> </div> <div class="modal fade" id="issue_currency_modal" data-transaction-type="5" data-transaction-subtype="0" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <h4 class="modal-title" data-i18n="issue_currency">Issue Currency</h4> </div> <div class="modal-body"> <form role="form" autocomplete="off"> <div class="callout callout-danger error_message" style="display:none"></div> <div class="form-group"> <label for="issue_currency_name"><span data-i18n="currency_name">CURRENCY NAME</span> <i class="fa fa-question-circle show_popover" data-content="The currency name is unique. Should be between 3-10 characters and longer than the currency code." data-i18n="[data-content]currency_name_help" data-container="body" style="color:#4CAA6E" ></i></label> <input type="text" maxlength="10" class="form-control" name="name" id="issue_currency_name" placeholder="Currency Name" data-i18n="[placeholder]currency_name" autofocus tabindex="1" /> </div> <div class="form-group"> <label for="issue_currency_code"><span data-i18n="currency_code">CURRENCY CODE</span> <i class="fa fa-question-circle show_popover" data-content="The currency code is unique. Its composed of 3-5 upper case letters." data-i18n="[data-content]currency_code_help" data-container="body" style="color:#4CAA6E" ></i></label> <input type="text" maxlength="5" class="form-control" name="code" id="issue_currency_code" placeholder="Currency Code" data-i18n="[placeholder]currency_code" autofocus tabindex="2" /> </div> <div class="form-group"> <label for="issue_currency_description" data-i18n="description">DESCRIPTION</label> <textarea class="form-control" maxlength="1000" id="issue_currency_description" name="description" rows="3" tabindex="3"></textarea> </div> <div class="form-group"> <label data-i18n="type">TYPE</label> <div class="input-group"> <input type="checkbox" name="type" id="issue_currency_exchangeable" value="1" /> <label for="issue_currency_exchangeable" style="font-weight:normal;" tabindex="4" data-i18n="exchangeable">Exchangeable</label> </div> <div class="input-group"> <input type="checkbox" name="type" id="issue_currency_controllable" value="2" /> <label for="issue_currency_controllable" style="font-weight:normal;" tabindex="5" data-i18n="controllable">Controllable</label> </div> <div class="input-group"> <input type="checkbox" name="type" id="issue_currency_reservable" class="issue_currency_reservable" value="4" /> <label for="issue_currency_reservable" style="font-weight:normal;" tabindex="6" data-i18n="reservable">Reservable</label> </div> <div class="form-group advanced optional_reserve"> <label for="issue_currency_min_reserve" data-i18n="min_reserve">MINIMUM AMOUNT OF HZ PER WHOLE UNIT NEEDED TO ACTIVATE CURRENCY</label> <input name="minReservePerUnitNQT" id="issue_currency_min_reserve" class="form-control" placeholder="Minimum Amount Per Unit" data-i18n="minimum_reserve" tabindex="7" disabled> </div> <div class="form-group advanced optional_reserve"> <label for="issue_currency_min_reserve" data-i18n="reserve_supply">UNITS TO RESERVE</label> <input type="number" name="reserveSupply" id="issue_currency_min_reserve_supply" class="form-control" min="1" placeholder="Number of Units" data-i18n="reserve_supply" tabindex="8" disabled> </div> <div class="input-group"> <input type="checkbox" name="type" id="issue_currency_claimable" value="8" /> <label for="issue_currency_claimable" style="font-weight:normal;" tabindex="9" data-i18n="claimable">Claimable</label> </div> <div class="input-group"> <input type="checkbox" name="type" id="issue_currency_mintable" class="issue_currency_mintable" value="16" /> <label for="issue_currency_mintable" style="font-weight:normal;" tabindex="10" data-i18n="mintable">Mintable</label> </div> <div class="form-group advanced optional_mint"> <label for="issue_currency_min_difficulty"><span data-i18n="min_difficulty">MINIMUM DIFFICULTY</span> <i class="fa fa-question-circle show_popover" data-content="The exponent of the initial difficulty." data-i18n="[data-content]currency_decimals_help" data-container="body" style="color:#4CAA6E" ></i></label> <input type="number" name="minDifficulty" id="issue_currency_min_difficulty" class="form-control" min="1" max="255" placeholder="Minimum Difficulty" data-i18n="minimum_difficulty" tabindex="11"> </div> <div class="form-group advanced optional_mint"> <label for="issue_currency_max_difficulty"><span data-i18n="max_difficulty">MAXIMUM DIFFICULTY</span> <i class="fa fa-question-circle show_popover" data-content="The exponent of the final difficulty." data-i18n="[data-content]currency_decimals_help" data-container="body" style="color:#4CAA6E" ></i></label> <input type="number" name="maxDifficulty" id="issue_currency_max_difficulty" class="form-control" min="1" max="255" placeholder="Maximum Difficulty" data-i18n="maximum_difficulty" tabindex="12"> </div> <div class="form-group advanced optional_mint"> <label for="issue_currency_algorithm" data-i18n="algorithm">ALGORITHM</label> <select name="algorithm" id="issue_currency_algorithm" class="form-control" tabindex="13"> <option value="">Pick an algorithm</option> <option value="2">SHA256</option> <option value="3">SHA3</option> <option value="5">Scrypt</option> <option value="25">Keccak25</option> </select> </div> <div class="input-group"> <input type="checkbox" name="type" id="issue_currency_shuffleable" value="32" /> <label for="issue_currency_shuffleable" style="font-weight:normal;" tabindex="14" data-i18n="nonshuffleable"> Non-Shuffleable</label> </div> </div> <div class="row"> <div class="col-xs-4 col-sm-4 col-md-4"> <label for="issue_currency_initial_supply" data-i18n="initial_supply">INITIAL SUPPLY</label> <input type="number" name="initialSupply" id="issue_currency_initial_supply" class="form-control" min="0" placeholder="Initial Supply" data-i18n="Initial_supply" tabindex="15"> </div> <div class="col-xs-4 col-sm-4 col-md-4"> <div class="form-group"> <label for="issue_currency_max_supply" data-i18n="total_supply">TOTAL SUPPLY</label> <input type="number" name="maxSupply" id="issue_currency_max_supply" class="form-control" min="1" placeholder="Total Supply" data-i18n="total_supply" tabindex="16"> </div> </div> <div class="col-xs-4 col-sm-4 col-md-4"> <div class="form-group"> <label for="issue_currency_decimals"><span data-i18n="decimals">DECIMALS</span> <i class="fa fa-question-circle show_popover" data-content="The maximum allowed number of digits after the currency quantity decimal point." data-i18n="[data-content]currency_decimals_help" data-container="body" style="color:#4CAA6E" ></i></label> <input type="number" name="decimals" id="issue_currency_decimals" class="form-control" min="0" max="8" placeholder="Decimals" data-i18n="decimals" data-default="0" value="0" tabindex="17"> </div> </div> </div> <div class="form-group"> <label for="issue_currency_issuance_height" data-i18n="issuance_height">ISSUANCE HEIGHT</label> <i>Current Height: <span class="nrs_current_block"></span></i> <input type="number" name="issuanceHeight" id="issue_currency_issuance_height" class="form-control" min="0" placeholder="Issuance Height" data-i18n="issuance_height" tabindex="18" value="0" disabled> </div> <div data-replace-with-modal-template="secret_phrase_modal_template"></div> <div class="row"> <div class="col-xs-6 col-sm-6 col-md-6 advanced" data-advanced="6"> <div class="form-group"> <label for="issue_currency_fee"><span data-i18n="fee">FEE</span> <i class="fa fa-exclamation-circle show_popover" data-content="The fees are the following: 3 Letters - 25000 HZ, 4 Letters - 1000 HZ, 5 Letters - 40 HZ" data-i18n="[data-content]currency_minimum_fee_help" data-container="body" style="color:red"></i></label> <div class="input-group"> <input type="text" name="feeNXT" id="issue_currency_fee" class="form-control" placeholder="Fee" min="40" data-default="25000" value="25000" tabindex="19"> <span class="input-group-addon" style="min-width:50px;"><i class="fa fa-gavel"></i> <span id="{{name}}_feeNXT_addition_info" class="feeNXT_approval_addition_info">+0</span> </span> <input type="hidden" id="{{name}}_feeNXT_approval_addition" name="feeNXT_approval_addition" value="0" /> <span class="input-group-addon">HZ</span> </div> </div> </div> <div class="col-xs-6 col-sm-6 col-md-6 advanced"> <div class="form-group"> <label for="issue_currency_deadline" data-i18n="deadline_hours">DEADLINE (HOURS)</label> <input type="number" name="deadline" id="issue_currency_deadline" class="form-control" placeholder="Deadline" data-i18n="deadline" min="1" data-default="24" value="24" tabindex="20"> </div> </div> </div> <div data-replace-with-modal-template="advanced_approve_template"></div> <div data-replace-with-modal-template="advanced_rt_hash_template"></div> <div data-replace-with-modal-template="advanced_broadcast_template"></div> <div data-replace-with-modal-template="advanced_note_to_self_template"></div> <input type="hidden" name="request_type" value="issueCurrency" /> </form> </div> <div class="modal-footer" style="margin-top:0;"> <div class="advanced_info"><strong data-i18n="fee">Fee</strong>: <span class="advanced_fee">25'000 HZ</span> - <a href="#" data-i18n="advanced">advanced</a></div> <button type="button" class="btn btn-default" data-dismiss="modal" data-i18n="cancel">Cancel</button> <button type="button" class="btn btn-primary" data-loading-text="Submitting..." data-i18n="issue_currency;[data-loading-text]submitting">Issue Currency</button> </div> </div> </div> </div> <div class="modal fade" id="currency_distribution_modal" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog modal-dialog-wider"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <h4 class="modal-title" data-i18n="Currency Distribution">Currency Distribution</h4> </div> <div class="modal-body"> <div class="data-container data-loading table-responsive" style="max-height:350px;overflow:auto"> <table class="table table-striped" id="currency_distribution_table"> <thead> <tr> <th data-i18n="account">Account</th> <th data-i18n="units">Units</th> <th data-i18n="percentage">Percentage</th> </tr> </thead> <tbody> </tbody> </table> <div class="data-loading-container"><img src="img/loading_indicator.gif" alt="Loading..." width="32" height="32" /></div> <div class="data-empty-container"><p data-i18n="currency_not_distributed">Currency Not Distributed</p></div> </div> </div> <div class="modal-footer" style="margin-top:0;"> <button type="button" class="btn btn-primary" data-dismiss="modal" data-i18n="close">Close</button> </div> </div> </div> </div> <div class="modal fade" id="publish_exchange_offer_modal" data-transaction-type="5" data-transaction-subtype="4" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <h4 class="modal-title" data-i18n="publish_exchange_offer">Publish Exchange Offer</h4> </div> <div class="modal-body"> <form role="form" class="form-horizontal" style="padding: 10px;max-width:520px;margin-left:auto;margin-right:auto;" autocomplete="off"> <div class="callout callout-danger error_message" style="display:none"></div> <div style="margin-left:-20px"> <div class="form-group"> <label data-i18n="currency">CURRENCY</label> <p><span class="currency_code"></span><span id="publish_exchange_available" style="font-style:italic"></span></p> <input type="hidden" name="currency" id="publish_exchange_offer_currency" value="" /> <input type="hidden" name="decimals" id="publish_exchange_offer_decimals" value="" /> </div> <div class="form-group"> <label for="buy_currency_units_initial" class="col-sm-3 control-label" data-i18n="buy_units_initial">Buy units (Initial)</label> <div class="col-sm-9"> <div class="input-group"> <input id="buy_currency_units_initial" type="text" name="initialBuySupply" value="0" class="form-control" data-type="buy" tabindex="2" /> <span class="input-group-addon"><span class="currency_code"></span></span> </div> </div> </div> <div class="form-group"> <label for="buy_currency_units_total" class="col-sm-3 control-label" data-i18n="buy_units_limit">Buy units (Limit)</label> <div class="col-sm-9"> <div class="input-group"> <input id="buy_currency_units_total" type="text" name="totalBuyLimit" value="0" class="form-control" data-type="buy" tabindex="3" /> <span class="input-group-addon"><span class="currency_code"></span></span> </div> </div> </div> <div class="form-group"> <label for="buy_currency_rate" class="col-sm-3 control-label" data-i18n="buy_rate_per_unit">Buy Rate per unit</label> <div class="col-sm-9"> <div class="input-group"> <input id="buy_currency_rate" type="text" value="0" name="buyRateNQT" class="form-control" data-type="buy" tabindex="4" /> <span class="input-group-addon"><span class="currency_code"></span> / HZ</span> </div> </div> </div> <div class="form-group"> <label for="sell_currency_units_initial" class="col-sm-3 control-label" data-i18n="sell_units_initial">Sell units (Initial)</label> <div class="col-sm-9"> <div class="input-group"> <input id="sell_currency_units_initial" type="text" name="initialSellSupply" value="0" class="form-control" data-type="sell" tabindex="5" /> <span class="input-group-addon"><span class="currency_code"></span></span> </div> </div> </div> <div class="form-group"> <label for="sell_currency_units_total" class="col-sm-3 control-label" data-i18n="sell_units_limit">Sell units (Limit)</label> <div class="col-sm-9"> <div class="input-group"> <input id="sell_currency_units_total" type="text" name="totalSellLimit" value="0" class="form-control" data-type="sell" tabindex="6" /> <span class="input-group-addon"><span class="currency_code"></span></span> </div> </div> </div> <div class="form-group"> <label for="sell_currency_rate" class="col-sm-3 control-label" data-i18n="sell_rate_per_unit">Sell Rate per unit</label> <div class="col-sm-9"> <div class="input-group"> <input id="sell_currency_rate" type="text" value="0" name="sellRateNQT" class="form-control" data-type="sell" tabindex="7" /> <span class="input-group-addon"><span class="currency_code"></span> / HZ</span> </div> </div> </div> <div class="form-group"> <label for="expiration_height" class="col-sm-3 control-label" data-i18n="expiration_height">Expiration Height</label><i><span data-i18n="current_height">Current Height</span>: <span class="nrs_current_block"></span></i> <div class="col-sm-9"> <div class="input-group"> <input id="expiration_height" type="number" name="expirationHeight" class="form-control" tabindex="8" /> </div> </div> </div> </div> <div data-replace-with-modal-template="secret_phrase_modal_template"></div> <div data-replace-with-modal-template="advanced_fee_deadline_template"></div> <div data-replace-with-modal-template="advanced_approve_template"></div> <div data-replace-with-modal-template="advanced_rt_hash_template"></div> <div data-replace-with-modal-template="advanced_broadcast_template"></div> <div data-replace-with-modal-template="advanced_note_to_self_template"></div> <input type="hidden" name="request_type" value="publishExchangeOffer" /> </form> </div> <div class="modal-footer" style="margin-top:0;"> <div class="advanced_info"><strong data-i18n="fee">Fee</strong>: <span class="advanced_fee">1 HZ</span> - <a href="#" data-i18n="advanced">advanced</a></div> <button type="button" class="btn btn-default" data-dismiss="modal" data-i18n="cancel">Cancel</button> <button type="button" class="btn btn-primary" data-loading-text="Submitting..." data-i18n="publish_exchange_offer;[data-loading-text]submitting">Publish Exchange Offer</button> </div> </div> </div> </div> <div class="modal fade" id="claim_currency_modal" data-transaction-type="5" data-transaction-subtype="2" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <h4 class="modal-title"><span data-i18n="claim_currency">Claim currency</span> - <span id="claim_currency_code"></span></h4> </div> <div class="modal-body"> <form role="form" autocomplete="off"> <div class="callout callout-danger error_message" style="display:none"></div> <div class="form-group"> <input type="hidden" name="currency" id="claim_currency_currency" /> <input type="hidden" name="decimals" id="claim_currency_decimals" value="" /> </div> <div class="form-group"> <label for="claim_currency_amount" data-i18n="currency_units_to_claim">Number of units to claim</label> <i><span id="claimAvailable"></span></i> <label for="claim_currency_amount" data-i18n="currency_claim_rate">Claim rate</label> <i><span id="claimRate"></span></i> <input type="text" class="form-control" name="units" id="claim_currency_amount" placeholder="Number of units" data-i18n="units" tabindex="1" /> </div> <div data-replace-with-modal-template="secret_phrase_modal_template"></div> <div data-replace-with-modal-template="advanced_fee_deadline_template"></div> <div data-replace-with-modal-template="advanced_approve_template"></div> <div data-replace-with-modal-template="advanced_rt_hash_template"></div> <div data-replace-with-modal-template="advanced_broadcast_template"></div> <div data-replace-with-modal-template="advanced_note_to_self_template"></div> <input type="hidden" name="request_type" value="currencyReserveClaim" /> </form> </div> <div class="modal-footer" style="margin-top:0;"> <div class="advanced_info"><strong data-i18n="fee">Fee</strong>: <span class="advanced_fee">1 HZ</span> - <a href="#" data-i18n="advanced">advanced</a></div> <button type="button" class="btn btn-default" data-dismiss="modal" data-i18n="cancel">Cancel</button> <button type="button" class="btn btn-primary" id="claim_currency_button" data-loading-text="Submitting..." data-i18n="claim;[data-loading-text]submitting">Claim currency</button> </div> </div> </div> </div> <div class="modal fade" id="mine_currency_modal" data-transaction-type="5" data-transaction-subtype="7" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <h4 class="modal-title"><span data-i18n="mint_currency">Mint Currency</span> - <span id="mine_currency_code"></span></h4> </div> <div class="modal-body"> <form role="form" autocomplete="off"> <div class="callout callout-danger error_message" style="display:none"></div> <div class="form-group"> <input type="hidden" name="currency" id="mine_currency_currency" /> <input type="hidden" name="decimals" id="mine_currency_decimals" /> </div> <div class="form-group"> <label for="mine_currency_units" data-i18n="units">Units</label> <input type="text" class="form-control" name="units" id="mine_currency_units" data-i18n="units" tabindex="1" /> </div> <div class="form-group"> <label for="mine_currency_counter" data-i18n="counter">Counter</label> <input type="text" class="form-control" name="counter" id="mine_currency_counter" data-i18n="counter" tabindex="1" /> </div> <div class="form-group"> <label for="mine_currency_difficulty" data-i18n="difficulty">Difficulty</label> <input type="text" class="form-control" name="difficulty" id="mine_currency_difficulty" data-i18n="difficulty" disabled tabindex="1" /> </div> <div class="form-group"> <label for="mine_currency_nonce" data-i18n="nonce">Nonce</label> <input type="text" class="form-control" name="nonce" id="mine_currency_nonce" data-i18n="nonce" tabindex="1" /> </div> <div data-replace-with-modal-template="secret_phrase_modal_template"></div> <div data-replace-with-modal-template="advanced_fee_deadline_template"></div> <div data-replace-with-modal-template="advanced_approve_template"></div> <div data-replace-with-modal-template="advanced_rt_hash_template"></div> <div data-replace-with-modal-template="advanced_broadcast_template"></div> <div data-replace-with-modal-template="advanced_note_to_self_template"></div> <input type="hidden" name="request_type" value="currencyMint" /> </form> </div> <div class="modal-footer" style="margin-top:0;"> <div class="advanced_info"><strong data-i18n="fee">Fee</strong>: <span class="advanced_fee">1 HZ</span> - <a href="#" data-i18n="advanced">advanced</a></div> <button type="button" class="btn btn-default" data-dismiss="modal" data-i18n="cancel">Cancel</button> <button type="button" class="btn btn-primary" id="mine_currency_button" data-loading-text="Submitting..." data-i18n="mint;[data-loading-text]submitting">Mint currency</button> </div> </div> </div> </div> <div class="modal fade" id="reserve_currency_modal" data-transaction-type="5" data-transaction-subtype="1" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <h4 class="modal-title"><span data-i18n="reserve_currency">Reserve currency</span> - <span id="reserve_currency_code"></span></h4> </div> <div class="modal-body"> <form role="form" autocomplete="off"> <div class="callout callout-danger error_message" style="display:none"></div> <div class="form-group"> <input type="hidden" class="form-control" name="currency" id="reserve_currency_currency" placeholder="Currency" data-i18n="[placeholder]currency" tabindex="1" /> <input type="hidden" name="decimals" id="reserve_currency_decimals" value="" /> <input type="hidden" name="minReserve" id="reserve_currency_minReserve" value="" /> <input type="hidden" name="currentReserve" id="reserve_currency_currentReserve" value="" /> <input type="hidden" name="resSupply" id="reserve_currency_resSupply" value="" /> <p> <label for="reserve_currency_resSupply_text" data-i18n="reserve_supply">Reserve Supply</label> <i><span id="reserve_currency_resSupply_text"></span></i> <label for="reserve_currency_initialSupply_text" data-i18n="initial_supply_included">Initial Supply Included</label> <i><span id="reserve_currency_initialSupply_text"></span></i> </p> <p> <label for="reserve_currency_minReserve_text" data-i18n="target_reserve">Target Amount [HZ]</label> <i><span id="reserve_currency_minReserve_text"></span></i> <label for="reserve_currency_currentReserve_text" data-i18n="current_reserve">Reserved Amount [HZ]</label> <i><span id="reserve_currency_currentReserve_text"></span></i> </p> </div> <div class="form-group"> <label for="reserve_currency_amount" data-i18n="amount_per_currency_unit">Amount of HZ to reserve</label> <input type="text" class="form-control" id="reserve_currency_amount" placeholder="HZ amount" data-i18n="amount" tabindex="1" /> </div> <div class="form-group"> <label for="reserve_currency_total" data-i18n="amount_nxt_reserved">Reserve per Unit</label> <input id="reserve_currency_total" name="amountPerUnitNQT" readonly style="border: none"/> </div> <div data-replace-with-modal-template="secret_phrase_modal_template"></div> <div data-replace-with-modal-template="advanced_fee_deadline_template"></div> <div data-replace-with-modal-template="advanced_approve_template"></div> <div data-replace-with-modal-template="advanced_rt_hash_template"></div> <div data-replace-with-modal-template="advanced_broadcast_template"></div> <div data-replace-with-modal-template="advanced_note_to_self_template"></div> <input type="hidden" name="request_type" value="currencyReserveIncrease" /> </form> </div> <div class="modal-footer" style="margin-top:0;"> <div class="advanced_info"><strong data-i18n="fee">Fee</strong>: <span class="advanced_fee">1 HZ</span> - <a href="#" data-i18n="advanced">advanced</a></div> <button type="button" class="btn btn-default" data-dismiss="modal" data-i18n="cancel">Cancel</button> <button type="button" class="btn btn-primary" id="reserve_currency_button" data-loading-text="Submitting..." data-i18n="reserve;[data-loading-text]submitting">Reserve currency</button> </div> </div> </div> </div> <div class="modal fade" id="delete_currency_modal" data-transaction-type="5" data-transaction-subtype="8" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <h4 class="modal-title"><span data-i18n="delete_currency">Delete currency</span> - <span id="delete_currency_code"></span></h4> </div> <div class="modal-body"> <form role="form" autocomplete="off"> <div class="callout callout-danger error_message" style="display:none"></div> <div class="form-group"> <input type="hidden" class="form-control" name="currency" id="delete_currency_currency" /> </div> <div data-replace-with-modal-template="secret_phrase_modal_template"></div> <div data-replace-with-modal-template="advanced_fee_deadline_template"></div> <div data-replace-with-modal-template="advanced_approve_template"></div> <div data-replace-with-modal-template="advanced_rt_hash_template"></div> <div data-replace-with-modal-template="advanced_broadcast_template"></div> <div data-replace-with-modal-template="advanced_note_to_self_template"></div> <input type="hidden" name="request_type" value="deleteCurrency" /> </form> </div> <div class="modal-footer" style="margin-top:0;"> <div class="advanced_info"><strong data-i18n="fee">Fee</strong>: <span class="advanced_fee">1 HZ</span> - <a href="#" data-i18n="advanced">advanced</a></div> <button type="button" class="btn btn-default" data-dismiss="modal" data-i18n="cancel">Cancel</button> <button type="button" class="btn btn-primary" id="delete_currency_button" data-loading-text="Submitting..." data-i18n="delete;[data-loading-text]submitting">Delete currency</button> </div> </div> </div> </div> <div class="modal fade" id="currency_founders_modal" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog modal-dialog-wider"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <h4 class="modal-title"><span data-i18n="currency_founders">Currency Founders</span> - <span id="founders_currency_code"></span></h4> </div> <div class="modal-body"> <div class="form-group"> <p> <label for="founders_reserve_units" data-i18n="reserve_units">Reserve Units</label>: <i><span id="founders_reserve_units"></span></i> | <label for="founders_issuer_units" data-i18n="issuer_units">Issuer Units</label>: <i><span id="founders_issuer_units"></span></i> | <label for="founders_blocks_active" data-i18n="blocks_until_active">Blocks until active</label>: <i><span id="founders_blocks_active"></span></i> </p> </div> <div class="data-container data-loading table-responsive" style="max-height:350px;overflow:auto"> <table class="table table-striped" id="currency_founders_table"> <thead> <tr> <th data-i18n="account">Account</th> <th data-i18n="amount_per_unit">Amount Per Unit</th> <th data-i18n="amount_reserved">Amount Reserved</th> <th data-i18n="founders_units">Founders Units</th> <th data-i18n="percent_of_min">Percent of Minimum</th> </tr> </thead> <tbody> </tbody> </table> <div class="data-loading-container"><img src="img/loading_indicator.gif" alt="Loading..." width="32" height="32" /></div> <div class="data-empty-container"><p data-i18n="error">Error</p></div> </div> </div> <div class="modal-footer" style="margin-top:0;"> <button type="button" class="btn btn-primary" data-dismiss="modal" data-i18n="close">Close</button> </div> </div> </div> </div>
{ "content_hash": "a2fb85965c8bcdbefa654f50890561a8", "timestamp": "", "source": "github", "line_count": 597, "max_line_length": 371, "avg_line_length": 76.73031825795645, "alnum_prop": 0.5383120852252882, "repo_name": "OKtoshi/ROKOS", "id": "9169f97500ee7378010670cf9a47970b7e8d0ff2", "size": "45809", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "clients-nodes/flavors/rokos-flavors-Pi2-Pi3/horizon/html/ui/html/modals/monetary_system.html", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
package git4idea.branch; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.util.Condition; import com.intellij.openapi.util.Couple; import com.intellij.openapi.vcs.VcsException; import com.intellij.openapi.vcs.changes.Change; import com.intellij.util.containers.ContainerUtil; import git4idea.GitCommit; import git4idea.GitExecutionException; import git4idea.GitLocalBranch; import git4idea.changes.GitChangeUtils; import git4idea.commands.Git; import git4idea.history.GitHistoryUtils; import git4idea.rebase.GitRebaseUtils; import git4idea.repo.GitRepository; import git4idea.ui.branch.GitCompareBranchesDialog; import git4idea.util.GitCommitCompareInfo; import org.jetbrains.annotations.NotNull; import java.util.Collection; import java.util.List; /** * Executes the logic of git branch operations. * All operations are run in the current thread. * All UI interaction is done via the {@link GitBranchUiHandler} passed to the constructor. */ public final class GitBranchWorker { private static final Logger LOG = Logger.getInstance(GitBranchWorker.class); @NotNull private final Project myProject; @NotNull private final Git myGit; @NotNull private final GitBranchUiHandler myUiHandler; public GitBranchWorker(@NotNull Project project, @NotNull Git git, @NotNull GitBranchUiHandler uiHandler) { myProject = project; myGit = git; myUiHandler = uiHandler; } public void checkoutNewBranch(@NotNull final String name, @NotNull List<GitRepository> repositories) { updateInfo(repositories); repositories = ContainerUtil.filter(repositories, new Condition<GitRepository>() { @Override public boolean value(GitRepository repository) { GitLocalBranch currentBranch = repository.getCurrentBranch(); return currentBranch == null || !currentBranch.getName().equals(name); } }); if (!repositories.isEmpty()) { new GitCheckoutNewBranchOperation(myProject, myGit, myUiHandler, repositories, name).execute(); } else { LOG.error("Creating new branch the same as current in all repositories: " + name); } } public void createNewTag(@NotNull final String name, @NotNull final String reference, @NotNull final List<GitRepository> repositories) { for (GitRepository repository : repositories) { myGit.createNewTag(repository, name, null, reference); repository.getRepositoryFiles().refresh(false); } } public void checkoutNewBranchStartingFrom(@NotNull String newBranchName, @NotNull String startPoint, @NotNull List<GitRepository> repositories) { updateInfo(repositories); new GitCheckoutOperation(myProject, myGit, myUiHandler, repositories, startPoint, false, true, newBranchName).execute(); } public void checkout(@NotNull final String reference, boolean detach, @NotNull List<GitRepository> repositories) { updateInfo(repositories); new GitCheckoutOperation(myProject, myGit, myUiHandler, repositories, reference, detach, false, null).execute(); } public void deleteBranch(@NotNull final String branchName, @NotNull final List<GitRepository> repositories) { updateInfo(repositories); new GitDeleteBranchOperation(myProject, myGit, myUiHandler, repositories, branchName).execute(); } public void deleteRemoteBranch(@NotNull final String branchName, @NotNull final List<GitRepository> repositories) { updateInfo(repositories); new GitDeleteRemoteBranchOperation(myProject, myGit, myUiHandler, repositories, branchName).execute(); } public void merge(@NotNull final String branchName, @NotNull final GitBrancher.DeleteOnMergeOption deleteOnMerge, @NotNull final List<GitRepository> repositories) { updateInfo(repositories); new GitMergeOperation(myProject, myGit, myUiHandler, repositories, branchName, deleteOnMerge).execute(); } public void rebase(@NotNull List<GitRepository> repositories, @NotNull String branchName) { updateInfo(repositories); GitRebaseUtils.rebase(myProject, repositories, new GitRebaseParams(branchName), myUiHandler.getProgressIndicator()); } public void rebaseOnCurrent(@NotNull List<GitRepository> repositories, @NotNull String branchName) { updateInfo(repositories); GitRebaseUtils.rebase(myProject, repositories, new GitRebaseParams(branchName, null, "HEAD", false, false), myUiHandler.getProgressIndicator()); } public void renameBranch(@NotNull String currentName, @NotNull String newName, @NotNull List<GitRepository> repositories) { updateInfo(repositories); new GitRenameBranchOperation(myProject, myGit, myUiHandler, currentName, newName, repositories).execute(); } public void compare(@NotNull final String branchName, @NotNull final List<GitRepository> repositories, @NotNull final GitRepository selectedRepository) { final GitCommitCompareInfo myCompareInfo = loadCommitsToCompare(repositories, branchName); if (myCompareInfo == null) { LOG.error("The task to get compare info didn't finish. Repositories: \n" + repositories + "\nbranch name: " + branchName); return; } ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { displayCompareDialog(branchName, GitBranchUtil.getCurrentBranchOrRev(repositories), myCompareInfo, selectedRepository); } }); } private GitCommitCompareInfo loadCommitsToCompare(List<GitRepository> repositories, String branchName) { GitCommitCompareInfo compareInfo = new GitCommitCompareInfo(); for (GitRepository repository : repositories) { compareInfo.put(repository, loadCommitsToCompare(repository, branchName)); compareInfo.put(repository, loadTotalDiff(repository, branchName)); } return compareInfo; } @NotNull private static Collection<Change> loadTotalDiff(@NotNull GitRepository repository, @NotNull String branchName) { try { // return git diff between current working directory and branchName: working dir should be displayed as a 'left' one (base) return GitChangeUtils.getDiffWithWorkingDir(repository.getProject(), repository.getRoot(), branchName, null, true); } catch (VcsException e) { // we treat it as critical and report an error throw new GitExecutionException("Couldn't get [git diff " + branchName + "] on repository [" + repository.getRoot() + "]", e); } } @NotNull private Couple<List<GitCommit>> loadCommitsToCompare(@NotNull GitRepository repository, @NotNull final String branchName) { final List<GitCommit> headToBranch; final List<GitCommit> branchToHead; try { headToBranch = GitHistoryUtils.history(myProject, repository.getRoot(), ".." + branchName); branchToHead = GitHistoryUtils.history(myProject, repository.getRoot(), branchName + ".."); } catch (VcsException e) { // we treat it as critical and report an error throw new GitExecutionException("Couldn't get [git log .." + branchName + "] on repository [" + repository.getRoot() + "]", e); } return Couple.of(headToBranch, branchToHead); } private void displayCompareDialog(@NotNull String branchName, @NotNull String currentBranch, @NotNull GitCommitCompareInfo compareInfo, @NotNull GitRepository selectedRepository) { if (compareInfo.isEmpty()) { Messages.showInfoMessage(myProject, String.format("<html>There are no changes between <code>%s</code> and <code>%s</code></html>", currentBranch, branchName), "No Changes Detected"); } else { new GitCompareBranchesDialog(myProject, branchName, currentBranch, compareInfo, selectedRepository).show(); } } private static void updateInfo(@NotNull Collection<GitRepository> repositories) { for (GitRepository repository : repositories) { repository.update(); } } }
{ "content_hash": "92802b0610cd9cc1e8e53e1fcf7c0181", "timestamp": "", "source": "github", "line_count": 183, "max_line_length": 138, "avg_line_length": 44.61748633879781, "alnum_prop": 0.7376607470912431, "repo_name": "hurricup/intellij-community", "id": "b7d14ea9f283dcc7829906264467e37bda085eea", "size": "8765", "binary": false, "copies": "5", "ref": "refs/heads/master", "path": "plugins/git4idea/src/git4idea/branch/GitBranchWorker.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "AMPL", "bytes": "20665" }, { "name": "AspectJ", "bytes": "182" }, { "name": "Batchfile", "bytes": "59458" }, { "name": "C", "bytes": "215610" }, { "name": "C#", "bytes": "1538" }, { "name": "C++", "bytes": "196925" }, { "name": "CSS", "bytes": "197224" }, { "name": "CoffeeScript", "bytes": "1759" }, { "name": "Cucumber", "bytes": "14382" }, { "name": "Erlang", "bytes": "10" }, { "name": "Groff", "bytes": "35232" }, { "name": "Groovy", "bytes": "2831828" }, { "name": "HLSL", "bytes": "57" }, { "name": "HTML", "bytes": "1809290" }, { "name": "J", "bytes": "5050" }, { "name": "Java", "bytes": "156277117" }, { "name": "JavaScript", "bytes": "563135" }, { "name": "Jupyter Notebook", "bytes": "92629" }, { "name": "Kotlin", "bytes": "1888388" }, { "name": "Lex", "bytes": "179397" }, { "name": "Makefile", "bytes": "2352" }, { "name": "NSIS", "bytes": "52097" }, { "name": "Objective-C", "bytes": "28750" }, { "name": "Perl", "bytes": "903" }, { "name": "Perl6", "bytes": "26" }, { "name": "Protocol Buffer", "bytes": "6607" }, { "name": "Python", "bytes": "23832829" }, { "name": "Ruby", "bytes": "1217" }, { "name": "Scala", "bytes": "11698" }, { "name": "Shell", "bytes": "61583" }, { "name": "Smalltalk", "bytes": "64" }, { "name": "TeX", "bytes": "25473" }, { "name": "Thrift", "bytes": "1846" }, { "name": "TypeScript", "bytes": "9469" }, { "name": "XSLT", "bytes": "113040" } ], "symlink_target": "" }
package org.wso2.developerstudio.eclipse.gmf.esb.provider; import java.util.Collection; import java.util.List; import org.eclipse.emf.common.notify.AdapterFactory; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; import org.eclipse.emf.edit.provider.IItemLabelProvider; import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; import org.eclipse.emf.edit.provider.IItemPropertySource; import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; import org.eclipse.emf.edit.provider.ITreeItemContentProvider; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; import org.eclipse.emf.edit.provider.ViewerNotification; import org.wso2.developerstudio.eclipse.gmf.esb.APIHandler; import org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage; /** * This is the item provider adapter for a {@link org.wso2.developerstudio.eclipse.gmf.esb.APIHandler} object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public class APIHandlerItemProvider extends EsbNodeItemProvider { /** * This constructs an instance from a factory and a notifier. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public APIHandlerItemProvider(AdapterFactory adapterFactory) { super(adapterFactory); } /** * This returns the property descriptors for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { if (itemPropertyDescriptors == null) { super.getPropertyDescriptors(object); addClassNamePropertyDescriptor(object); addPropertiesPropertyDescriptor(object); } return itemPropertyDescriptors; } /** * This adds a property descriptor for the Class Name feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addClassNamePropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_APIHandler_className_feature"), getString("_UI_PropertyDescriptor_description", "_UI_APIHandler_className_feature", "_UI_APIHandler_type"), EsbPackage.Literals.API_HANDLER__CLASS_NAME, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the Properties feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addPropertiesPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_APIHandler_properties_feature"), getString("_UI_PropertyDescriptor_description", "_UI_APIHandler_properties_feature", "_UI_APIHandler_type"), EsbPackage.Literals.API_HANDLER__PROPERTIES, true, false, true, null, null, null)); } /** * This returns APIHandler.gif. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object getImage(Object object) { return overlayImage(object, getResourceLocator().getImage("full/obj16/APIHandler")); } /** * This returns the label text for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String getText(Object object) { String label = ((APIHandler)object).getClassName(); return label == null || label.length() == 0 ? getString("_UI_APIHandler_type") : getString("_UI_APIHandler_type") + " " + label; } /** * This handles model notifications by calling {@link #updateChildren} to update any cached * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void notifyChanged(Notification notification) { updateChildren(notification); switch (notification.getFeatureID(APIHandler.class)) { case EsbPackage.API_HANDLER__CLASS_NAME: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); return; } super.notifyChanged(notification); } /** * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children * that can be created under this object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); } }
{ "content_hash": "20afaa78cc29a70f2e2ca244ebd36d1d", "timestamp": "", "source": "github", "line_count": 157, "max_line_length": 125, "avg_line_length": 35.0828025477707, "alnum_prop": 0.6350762527233116, "repo_name": "prabushi/devstudio-tooling-esb", "id": "569d0f4660d2fe950d5237aee1f207ddecf82b05", "size": "6124", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "plugins/org.wso2.developerstudio.eclipse.gmf.esb.edit/src/org/wso2/developerstudio/eclipse/gmf/esb/provider/APIHandlerItemProvider.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "41098" }, { "name": "HTML", "bytes": "731356" }, { "name": "Java", "bytes": "77332976" }, { "name": "JavaScript", "bytes": "475592" }, { "name": "Shell", "bytes": "7727" } ], "symlink_target": "" }
<?php namespace Scalr\Service\Aws\Ec2\DataType; use Scalr\Service\Aws\Ec2\Ec2ListDataType; /** * InternetGatewayList * * @author Vitaliy Demidov <vitaliy@scalr.com> * @since 03.04.2012 */ class InternetGatewayList extends Ec2ListDataType { /** * List of the public properties * which is managed by magic getter and setters internally. * * @var array */ protected $_properties = array('requestId'); /** * Constructor * * @param array|InternetGatewayData $aListData List of InternetGatewayData objects */ public function __construct($aListData = null) { parent::__construct($aListData, 'internetGatewayId', __NAMESPACE__ . '\\InternetGatewayData'); } /** * {@inheritdoc} * @see Scalr\Service\Aws\DataType.ListDataType::getQueryArray() */ public function getQueryArray($uriParameterName = 'InternetGatewayId', $member = true) { return array_filter(parent::getQueryArray($uriParameterName, $member), function ($val) { return $val !== null; }); } }
{ "content_hash": "c14adbf2b4a4b6148fd96ad6b721b62c", "timestamp": "", "source": "github", "line_count": 43, "max_line_length": 102, "avg_line_length": 25.53488372093023, "alnum_prop": 0.6366120218579235, "repo_name": "AlphaStaxLLC/scalr", "id": "bb95db3dcb46e87b6d281132affd5f32bbf39eab", "size": "1098", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "app/src/Scalr/Service/Aws/Ec2/DataType/InternetGatewayList.php", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ApacheConf", "bytes": "4249" }, { "name": "CSS", "bytes": "86731" }, { "name": "Gherkin", "bytes": "72478" }, { "name": "HTML", "bytes": "2474225" }, { "name": "JavaScript", "bytes": "16934089" }, { "name": "PHP", "bytes": "20637716" }, { "name": "Python", "bytes": "350030" }, { "name": "Ruby", "bytes": "9397" }, { "name": "Shell", "bytes": "17207" }, { "name": "Smarty", "bytes": "2245" }, { "name": "XSLT", "bytes": "29678" } ], "symlink_target": "" }
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>basic_datagram_socket::close (2 of 2 overloads)</title> <link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> <link rel="home" href="../../../../boost_asio.html" title="Boost.Asio"> <link rel="up" href="../close.html" title="basic_datagram_socket::close"> <link rel="prev" href="overload1.html" title="basic_datagram_socket::close (1 of 2 overloads)"> <link rel="next" href="../connect.html" title="basic_datagram_socket::connect"> </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="overload1.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../close.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../boost_asio.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../connect.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> </div> <div class="section"> <div class="titlepage"><div><div><h5 class="title"> <a name="boost_asio.reference.basic_datagram_socket.close.overload2"></a><a class="link" href="overload2.html" title="basic_datagram_socket::close (2 of 2 overloads)">basic_datagram_socket::close (2 of 2 overloads)</a> </h5></div></div></div> <p> <span class="emphasis"><em>Inherited from basic_socket.</em></span> </p> <p> Close the socket. </p> <pre class="programlisting">void close( boost::system::error_code &amp; ec); </pre> <p> This function is used to close the socket. Any asynchronous send, receive or connect operations will be cancelled immediately, and will complete with the <code class="computeroutput">boost::asio::error::operation_aborted</code> error. </p> <h6> <a name="boost_asio.reference.basic_datagram_socket.close.overload2.h0"></a> <span class="phrase"><a name="boost_asio.reference.basic_datagram_socket.close.overload2.parameters"></a></span><a class="link" href="overload2.html#boost_asio.reference.basic_datagram_socket.close.overload2.parameters">Parameters</a> </h6> <div class="variablelist"> <p class="title"><b></b></p> <dl class="variablelist"> <dt><span class="term">ec</span></dt> <dd><p> Set to indicate what error occurred, if any. Note that, even if the function indicates an error, the underlying descriptor is closed. </p></dd> </dl> </div> <h6> <a name="boost_asio.reference.basic_datagram_socket.close.overload2.h1"></a> <span class="phrase"><a name="boost_asio.reference.basic_datagram_socket.close.overload2.example"></a></span><a class="link" href="overload2.html#boost_asio.reference.basic_datagram_socket.close.overload2.example">Example</a> </h6> <pre class="programlisting">boost::asio::ip::tcp::socket socket(my_context); ... boost::system::error_code ec; socket.close(ec); if (ec) { // An error occurred. } </pre> <h6> <a name="boost_asio.reference.basic_datagram_socket.close.overload2.h2"></a> <span class="phrase"><a name="boost_asio.reference.basic_datagram_socket.close.overload2.remarks"></a></span><a class="link" href="overload2.html#boost_asio.reference.basic_datagram_socket.close.overload2.remarks">Remarks</a> </h6> <p> For portable behaviour with respect to graceful closure of a connected socket, call <code class="computeroutput">shutdown()</code> before closing the socket. </p> </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> <td align="left"></td> <td align="right"><div class="copyright-footer">Copyright © 2003-2021 Christopher M. Kohlhoff<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="overload1.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../close.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../boost_asio.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../connect.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> </div> </body> </html>
{ "content_hash": "4ce68c83141800b44a4ff5a8f33a24c1", "timestamp": "", "source": "github", "line_count": 94, "max_line_length": 437, "avg_line_length": 56.47872340425532, "alnum_prop": 0.6317573931060463, "repo_name": "davehorton/drachtio-server", "id": "e4dcea4b46e566b42fc2dff12303aea710e5a2f7", "size": "5310", "binary": false, "copies": "2", "ref": "refs/heads/main", "path": "deps/boost_1_77_0/doc/html/boost_asio/reference/basic_datagram_socket/close/overload2.html", "mode": "33188", "license": "mit", "language": [ { "name": "C++", "bytes": "662596" }, { "name": "Dockerfile", "bytes": "1330" }, { "name": "JavaScript", "bytes": "60639" }, { "name": "M4", "bytes": "35273" }, { "name": "Makefile", "bytes": "5960" }, { "name": "Shell", "bytes": "47298" } ], "symlink_target": "" }
package org.dita.dost.module.reader; import org.dita.dost.exception.DITAOTException; import org.dita.dost.exception.DITAOTXMLErrorHandler; import org.dita.dost.log.MessageUtils; import org.dita.dost.pipeline.AbstractPipelineInput; import org.dita.dost.pipeline.AbstractPipelineOutput; import org.dita.dost.reader.GenListModuleReader.Reference; import org.dita.dost.writer.DebugFilter; import org.dita.dost.writer.NormalizeFilter; import org.dita.dost.writer.ProfilingFilter; import org.dita.dost.writer.ValidationFilter; import org.xml.sax.XMLFilter; import java.net.URI; import java.util.ArrayList; import java.util.List; import java.util.Objects; import static org.dita.dost.util.Constants.*; import static org.dita.dost.util.URLUtils.exists; /** * ModuleElem for reading and serializing topics into temporary directory. * * @since 2.5 */ public final class MapReaderModule extends AbstractReaderModule { public MapReaderModule() { super(); formatFilter = v -> Objects.equals(v, ATTR_FORMAT_VALUE_DITAMAP) || Objects.equals(v, ATTR_FORMAT_VALUE_DITAVAL); } @Override public AbstractPipelineOutput execute(final AbstractPipelineInput input) throws DITAOTException { try { parseInputParameters(input); init(); readResourceFiles(); readStartFile(); processWaitList(); handleConref(); outputResult(); job.write(); } catch (final RuntimeException | DITAOTException e) { throw e; } catch (final Exception e) { throw new DITAOTException(e.getMessage(), e); } return null; } @Override public void readStartFile() throws DITAOTException { addToWaitList(new Reference(rootFile)); } @Override List<XMLFilter> getProcessingPipe(final URI fileToParse) { assert fileToParse.isAbsolute(); final List<XMLFilter> pipe = new ArrayList<>(); if (genDebugInfo) { final DebugFilter debugFilter = new DebugFilter(); debugFilter.setLogger(logger); debugFilter.setCurrentFile(currentFile); pipe.add(debugFilter); } if (filterUtils != null) { final ProfilingFilter profilingFilter = new ProfilingFilter(); profilingFilter.setLogger(logger); profilingFilter.setJob(job); profilingFilter.setFilterUtils(filterUtils); profilingFilter.setCurrentFile(fileToParse); pipe.add(profilingFilter); } final ValidationFilter validationFilter = new ValidationFilter(); validationFilter.setLogger(logger); validationFilter.setValidateMap(validateMap); validationFilter.setCurrentFile(fileToParse); validationFilter.setJob(job); validationFilter.setProcessingMode(processingMode); pipe.add(validationFilter); final NormalizeFilter normalizeFilter = new NormalizeFilter(); normalizeFilter.setLogger(logger); pipe.add(normalizeFilter); if (INDEX_TYPE_ECLIPSEHELP.equals(transtype)) { exportAnchorsFilter.setCurrentFile(fileToParse); exportAnchorsFilter.setErrorHandler(new DITAOTXMLErrorHandler(fileToParse.toString(), logger)); pipe.add(exportAnchorsFilter); } keydefFilter.setCurrentDir(fileToParse.resolve(".")); keydefFilter.setErrorHandler(new DITAOTXMLErrorHandler(fileToParse.toString(), logger)); pipe.add(keydefFilter); listFilter.setCurrentFile(fileToParse); listFilter.setErrorHandler(new DITAOTXMLErrorHandler(fileToParse.toString(), logger)); pipe.add(listFilter); ditaWriterFilter.setDefaultValueMap(defaultValueMap); ditaWriterFilter.setCurrentFile(currentFile); ditaWriterFilter.setOutputFile(outputFile); pipe.add(ditaWriterFilter); return pipe; } @Override void categorizeReferenceFile(final Reference file) { if (file.format == null || ATTR_FORMAT_VALUE_DITA.equals(file.format)) { return; } // Ignore topics // if (formatFilter.test(file.format)) { switch (file.format) { case ATTR_FORMAT_VALUE_DITAMAP: addToWaitList(file); break; case ATTR_FORMAT_VALUE_IMAGE: formatSet.add(file); if (!exists(file.filename)) { logger.warn(MessageUtils.getMessage("DOTX008E", file.filename.toString()).toString()); } break; case ATTR_FORMAT_VALUE_DITAVAL: formatSet.add(file); break; default: htmlSet.put(file.format, file.filename); break; } // } } }
{ "content_hash": "5f2c7462afd953e4448cd7e858f468c0", "timestamp": "", "source": "github", "line_count": 147, "max_line_length": 121, "avg_line_length": 33.095238095238095, "alnum_prop": 0.6503597122302158, "repo_name": "shaneataylor/dita-ot", "id": "fdce493d1d573149a80a209f278dcab7287ad02f", "size": "5027", "binary": false, "copies": "2", "ref": "refs/heads/develop", "path": "src/main/java/org/dita/dost/module/reader/MapReaderModule.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "10738" }, { "name": "C", "bytes": "4336" }, { "name": "CSS", "bytes": "60188" }, { "name": "HTML", "bytes": "795861" }, { "name": "Java", "bytes": "2404278" }, { "name": "JavaScript", "bytes": "2246" }, { "name": "Shell", "bytes": "16323" }, { "name": "XSLT", "bytes": "2106965" } ], "symlink_target": "" }
package com.gersion.superlock.lockadapter; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ObjectAnimator; import android.content.Context; import android.os.Handler; import android.view.LayoutInflater; import android.view.View; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; import com.gersion.superlock.R; import com.gersion.superlock.app.SuperLockApplication; import com.gersion.superlock.utils.AnimatorUtils; import com.gersion.superlock.utils.ConfigManager; import com.orhanobut.logger.Logger; import com.wei.android.lib.fingerprintidentify.FingerprintIdentify; import com.wei.android.lib.fingerprintidentify.base.BaseFingerprint; /** * Created by aa326 on 2018/1/9. */ public class FingerPrintAdapter implements LockAdapter { private LockCallback mLockCallback; private ConfigManager mInstance; private RelativeLayout mRlFingerContainer; private ImageView mIvFinger; private TextView mTvNotice; private TextView mBtnCancel; private TextView mBtnOtherType; private Context mContext; private FingerprintIdentify mFingerprintIdentify; @Override public View init(Context context) { mContext = context; View view = LayoutInflater.from(context).inflate(R.layout.view_finger_print, null); mRlFingerContainer = (RelativeLayout) view.findViewById(R.id.rl_finger_container); mTvNotice = (TextView) view.findViewById(R.id.tv_notice); mIvFinger = (ImageView) view.findViewById(R.id.iv_finger); mBtnCancel = (TextView) view.findViewById(R.id.btn_cancel); mBtnOtherType = (TextView) view.findViewById(R.id.btn_other_type); mFingerprintIdentify = new FingerprintIdentify(SuperLockApplication.getContext(), new BaseFingerprint.FingerprintIdentifyExceptionListener() { @Override public void onCatchException(Throwable exception) { Logger.e("\nException:" + exception.getLocalizedMessage()); } }); start(); initListener(); return view; } private void initListener() { mBtnCancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { } }); mBtnOtherType.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { switch2OtherType(false); } }); } @Override public void onStart() { // initFingerPrint(); } private void start() { mInstance = ConfigManager.getInstance(); mFingerprintIdentify.startIdentify(5, new BaseFingerprint.FingerprintIdentifyListener() { @Override public void onSucceed() { mIvFinger.setImageResource(R.mipmap.success); new Handler().postDelayed(new Runnable() { @Override public void run() { mLockCallback.onSuccess(); } }, 300); } @Override public void onNotMatch(int availableTimes) { mTvNotice.setText("指纹不匹配,还可以尝试 " + availableTimes + " 次"); shake(); } @Override public void onStartFailedByDeviceLocked() { switch2OtherType(true); } @Override public void onFailed(boolean isDeviceLocked) { // mTvNotice.setText("指纹解锁已禁用,请 " + 15 + " 秒后重试"); // SPManager.setLockedTime(SystemClock.currentThreadTimeMillis()); // mIvFinger.setImageResource(R.mipmap.alert); // new Handler().postDelayed(new Runnable() { // @Override // public void run() { // mIvFinger.setImageResource(R.mipmap.finger); // mTvNotice.setText("请轻触指纹感应器验证指纹"); // SuperLockApplication.mFingerprintIdentify.startIdentify(5, mFingerprintIdentifyListener); // } // }, 15000); // if (isDeviceLocked) { // switch2OtherType(true); // }else { // start(); // } if (!isDeviceLocked){ mTvNotice.postDelayed(new Runnable() { @Override public void run() { start(); } },1000); }else { switch2OtherType(true); } } }); } private void switch2OtherType(final boolean isFingerLock) { mRlFingerContainer.animate() .alpha(0) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mLockCallback.onChangLockType(isFingerLock); } }).setDuration(500).start(); } private void shake() { ObjectAnimator animator = AnimatorUtils.tada(mIvFinger, 5); animator.setRepeatCount(0); animator.start(); } @Override public void setLockCallback(LockCallback lockCallback) { mLockCallback = lockCallback; } public void onDestroy() { mFingerprintIdentify.cancelIdentify(); } }
{ "content_hash": "27836c6783d08d0238fd6ce9a28d78a8", "timestamp": "", "source": "github", "line_count": 161, "max_line_length": 150, "avg_line_length": 34.298136645962735, "alnum_prop": 0.5923578413618255, "repo_name": "GaoGersy/PasswordManager", "id": "00515d42bb09c05465fe50cb79f5d1c2bb8a74f1", "size": "5598", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/src/main/java/com/gersion/superlock/lockadapter/FingerPrintAdapter.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "917400" } ], "symlink_target": "" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_60-ea) on Thu Dec 15 09:48:36 EST 2016 --> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Uses of Interface org.wildfly.swarm.config.logging.LoggingProfileConsumer (Public javadocs 2016.12.1 API)</title> <meta name="date" content="2016-12-15"> <link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Interface org.wildfly.swarm.config.logging.LoggingProfileConsumer (Public javadocs 2016.12.1 API)"; } } catch(err) { } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../../org/wildfly/swarm/config/logging/LoggingProfileConsumer.html" title="interface in org.wildfly.swarm.config.logging">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">WildFly Swarm API, 2016.12.1</div> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../../index.html?org/wildfly/swarm/config/logging/class-use/LoggingProfileConsumer.html" target="_top">Frames</a></li> <li><a href="LoggingProfileConsumer.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h2 title="Uses of Interface org.wildfly.swarm.config.logging.LoggingProfileConsumer" class="title">Uses of Interface<br>org.wildfly.swarm.config.logging.LoggingProfileConsumer</h2> </div> <div class="classUseContainer"> <ul class="blockList"> <li class="blockList"> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation"> <caption><span>Packages that use <a href="../../../../../../org/wildfly/swarm/config/logging/LoggingProfileConsumer.html" title="interface in org.wildfly.swarm.config.logging">LoggingProfileConsumer</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Package</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><a href="#org.wildfly.swarm.config">org.wildfly.swarm.config</a></td> <td class="colLast">&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="#org.wildfly.swarm.config.logging">org.wildfly.swarm.config.logging</a></td> <td class="colLast">&nbsp;</td> </tr> </tbody> </table> </li> <li class="blockList"> <ul class="blockList"> <li class="blockList"><a name="org.wildfly.swarm.config"> <!-- --> </a> <h3>Uses of <a href="../../../../../../org/wildfly/swarm/config/logging/LoggingProfileConsumer.html" title="interface in org.wildfly.swarm.config.logging">LoggingProfileConsumer</a> in <a href="../../../../../../org/wildfly/swarm/config/package-summary.html">org.wildfly.swarm.config</a></h3> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../../../org/wildfly/swarm/config/package-summary.html">org.wildfly.swarm.config</a> with parameters of type <a href="../../../../../../org/wildfly/swarm/config/logging/LoggingProfileConsumer.html" title="interface in org.wildfly.swarm.config.logging">LoggingProfileConsumer</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../../../org/wildfly/swarm/config/Logging.html" title="type parameter in Logging">T</a></code></td> <td class="colLast"><span class="typeNameLabel">Logging.</span><code><span class="memberNameLink"><a href="../../../../../../org/wildfly/swarm/config/Logging.html#loggingProfile-java.lang.String-org.wildfly.swarm.config.logging.LoggingProfileConsumer-">loggingProfile</a></span>(<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;childKey, <a href="../../../../../../org/wildfly/swarm/config/logging/LoggingProfileConsumer.html" title="interface in org.wildfly.swarm.config.logging">LoggingProfileConsumer</a>&nbsp;consumer)</code> <div class="block">Create and configure a LoggingProfile object to the list of subresources</div> </td> </tr> </tbody> </table> </li> <li class="blockList"><a name="org.wildfly.swarm.config.logging"> <!-- --> </a> <h3>Uses of <a href="../../../../../../org/wildfly/swarm/config/logging/LoggingProfileConsumer.html" title="interface in org.wildfly.swarm.config.logging">LoggingProfileConsumer</a> in <a href="../../../../../../org/wildfly/swarm/config/logging/package-summary.html">org.wildfly.swarm.config.logging</a></h3> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../../../org/wildfly/swarm/config/logging/package-summary.html">org.wildfly.swarm.config.logging</a> that return <a href="../../../../../../org/wildfly/swarm/config/logging/LoggingProfileConsumer.html" title="interface in org.wildfly.swarm.config.logging">LoggingProfileConsumer</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>default <a href="../../../../../../org/wildfly/swarm/config/logging/LoggingProfileConsumer.html" title="interface in org.wildfly.swarm.config.logging">LoggingProfileConsumer</a>&lt;<a href="../../../../../../org/wildfly/swarm/config/logging/LoggingProfileConsumer.html" title="type parameter in LoggingProfileConsumer">T</a>&gt;</code></td> <td class="colLast"><span class="typeNameLabel">LoggingProfileConsumer.</span><code><span class="memberNameLink"><a href="../../../../../../org/wildfly/swarm/config/logging/LoggingProfileConsumer.html#andThen-org.wildfly.swarm.config.logging.LoggingProfileConsumer-">andThen</a></span>(<a href="../../../../../../org/wildfly/swarm/config/logging/LoggingProfileConsumer.html" title="interface in org.wildfly.swarm.config.logging">LoggingProfileConsumer</a>&lt;<a href="../../../../../../org/wildfly/swarm/config/logging/LoggingProfileConsumer.html" title="type parameter in LoggingProfileConsumer">T</a>&gt;&nbsp;after)</code>&nbsp;</td> </tr> </tbody> </table> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../../../org/wildfly/swarm/config/logging/package-summary.html">org.wildfly.swarm.config.logging</a> with parameters of type <a href="../../../../../../org/wildfly/swarm/config/logging/LoggingProfileConsumer.html" title="interface in org.wildfly.swarm.config.logging">LoggingProfileConsumer</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>default <a href="../../../../../../org/wildfly/swarm/config/logging/LoggingProfileConsumer.html" title="interface in org.wildfly.swarm.config.logging">LoggingProfileConsumer</a>&lt;<a href="../../../../../../org/wildfly/swarm/config/logging/LoggingProfileConsumer.html" title="type parameter in LoggingProfileConsumer">T</a>&gt;</code></td> <td class="colLast"><span class="typeNameLabel">LoggingProfileConsumer.</span><code><span class="memberNameLink"><a href="../../../../../../org/wildfly/swarm/config/logging/LoggingProfileConsumer.html#andThen-org.wildfly.swarm.config.logging.LoggingProfileConsumer-">andThen</a></span>(<a href="../../../../../../org/wildfly/swarm/config/logging/LoggingProfileConsumer.html" title="interface in org.wildfly.swarm.config.logging">LoggingProfileConsumer</a>&lt;<a href="../../../../../../org/wildfly/swarm/config/logging/LoggingProfileConsumer.html" title="type parameter in LoggingProfileConsumer">T</a>&gt;&nbsp;after)</code>&nbsp;</td> </tr> </tbody> </table> </li> </ul> </li> </ul> </div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../../org/wildfly/swarm/config/logging/LoggingProfileConsumer.html" title="interface in org.wildfly.swarm.config.logging">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">WildFly Swarm API, 2016.12.1</div> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../../index.html?org/wildfly/swarm/config/logging/class-use/LoggingProfileConsumer.html" target="_top">Frames</a></li> <li><a href="LoggingProfileConsumer.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; 2016 <a href="http://www.jboss.org">JBoss by Red Hat</a>. All rights reserved.</small></p> </body> </html>
{ "content_hash": "d36b65b14461f9fa9e31e9ae0ba848d4", "timestamp": "", "source": "github", "line_count": 206, "max_line_length": 636, "avg_line_length": 56.70873786407767, "alnum_prop": 0.6720595788392398, "repo_name": "wildfly-swarm/wildfly-swarm-javadocs", "id": "3ed710b44861dfc2dd109193f61128667e7ac9cb", "size": "11682", "binary": false, "copies": "1", "ref": "refs/heads/gh-pages", "path": "2016.12.1/apidocs/org/wildfly/swarm/config/logging/class-use/LoggingProfileConsumer.html", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
package com.zc.express; import android.app.Application; import android.app.Notification; import com.tencent.bugly.crashreport.CrashReport; import com.zc.express.api.ExpressApiProvider; import com.zc.express.data.network.OkHttp; import com.zc.express.utils.ToastUtils; import cn.jpush.android.api.BasicPushNotificationBuilder; import cn.jpush.android.api.JPushInterface; /** * Created by ZC on 2017/6/23. */ public class ExpressAplication extends Application { @Override public void onCreate() { super.onCreate(); CrashReport.initCrashReport(getApplicationContext(),"92b933de11", false); ExpressModule.init(this); OkHttp.createCache(getCacheDir()); ExpressApiProvider.init(OkHttp.client(this)); ToastUtils.init(this); JPushInterface.setDebugMode(true); // 设置开启日志,发布时请关闭日志 JPushInterface.init(this); // 初始化 JPush setStyleBasic(); } private void setStyleBasic() { BasicPushNotificationBuilder builder = new BasicPushNotificationBuilder(getApplicationContext()); builder.statusBarDrawable = R.mipmap.app_logo; builder.notificationFlags = Notification.FLAG_AUTO_CANCEL; //设置为点击后自动消失 builder.notificationDefaults = Notification.DEFAULT_SOUND; //设置为铃声( Notification.DEFAULT_SOUND)或者震动( Notification.DEFAULT_VIBRATE) JPushInterface.setPushNotificationBuilder(1, builder); } }
{ "content_hash": "6a11024c00ed819fc2f40cd22bc195f2", "timestamp": "", "source": "github", "line_count": 44, "max_line_length": 139, "avg_line_length": 32.31818181818182, "alnum_prop": 0.729957805907173, "repo_name": "JK2DOG/OneOrderExpress", "id": "c7b1c225e17424ec5f0592dbf1b89d98cba1204b", "size": "1502", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "OneExpress/app/src/main/java/com/zc/express/ExpressAplication.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "6079" }, { "name": "Java", "bytes": "307464" } ], "symlink_target": "" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (version 1.7.0_65) on Wed Dec 03 20:05:06 CET 2014 --> <meta http-equiv="Content-Type" content="text/html" charset="UTF-8"> <title>net.sourceforge.pmd.lang.java.rule.migrating (PMD Java 5.2.2 API)</title> <meta name="date" content="2014-12-03"> <link rel="stylesheet" type="text/css" href="../../../../../../../stylesheet.css" title="Style"> </head> <body> <h1 class="bar"><a href="../../../../../../../net/sourceforge/pmd/lang/java/rule/migrating/package-summary.html" target="classFrame">net.sourceforge.pmd.lang.java.rule.migrating</a></h1> <div class="indexContainer"> <h2 title="Classes">Classes</h2> <ul title="Classes"> <li><a href="JUnitUseExpectedRule.html" title="class in net.sourceforge.pmd.lang.java.rule.migrating" target="classFrame">JUnitUseExpectedRule</a></li> <li><a href="UnnecessaryCastRule.html" title="class in net.sourceforge.pmd.lang.java.rule.migrating" target="classFrame">UnnecessaryCastRule</a></li> </ul> </div> </body> </html>
{ "content_hash": "98097225c885bf6be0bfe7bcdc009004", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 186, "avg_line_length": 53.714285714285715, "alnum_prop": 0.6950354609929078, "repo_name": "byronka/xenos", "id": "c43399eb7c4b79ea26e4eed69a15b13069c238b9", "size": "1128", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "utils/pmd-bin-5.2.2/docs/pmd-java/apidocs/net/sourceforge/pmd/lang/java/rule/migrating/package-frame.html", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "102953" }, { "name": "C++", "bytes": "436" }, { "name": "CSS", "bytes": "482910" }, { "name": "HTML", "bytes": "220459885" }, { "name": "Java", "bytes": "31611126" }, { "name": "JavaScript", "bytes": "19708" }, { "name": "NSIS", "bytes": "38770" }, { "name": "PLSQL", "bytes": "19219" }, { "name": "Perl", "bytes": "23704" }, { "name": "Python", "bytes": "3299" }, { "name": "SQLPL", "bytes": "54633" }, { "name": "Shell", "bytes": "192465" }, { "name": "XSLT", "bytes": "499720" } ], "symlink_target": "" }
'use strict'; var utils = require('./utils'); var isDeleted = require('./deps/docs/isDeleted'); var merge = require('./merge'); var errors = require('./deps/errors'); var EE = require('events').EventEmitter; var evalFilter = require('./evalFilter'); var evalView = require('./evalView'); module.exports = Changes; utils.inherits(Changes, EE); function Changes(db, opts, callback) { EE.call(this); var self = this; this.db = db; opts = opts ? utils.clone(opts) : {}; var oldComplete = callback || opts.complete || function () {}; var complete = opts.complete = utils.once(function (err, resp) { if (err) { self.emit('error', err); } else { self.emit('complete', resp); } self.removeAllListeners(); db.removeListener('destroyed', onDestroy); }); if (oldComplete) { self.on('complete', function (resp) { oldComplete(null, resp); }); self.on('error', function (err) { oldComplete(err); }); } var oldOnChange = opts.onChange; if (oldOnChange) { self.on('change', oldOnChange); } function onDestroy() { self.cancel(); } db.once('destroyed', onDestroy); opts.onChange = function (change) { if (opts.isCancelled) { return; } self.emit('change', change); if (self.startSeq && self.startSeq <= change.seq) { self.emit('uptodate'); self.startSeq = false; } if (change.deleted) { self.emit('delete', change); } else if (change.changes.length === 1 && change.changes[0].rev.slice(0, 2) === '1-') { self.emit('create', change); } else { self.emit('update', change); } }; var promise = new utils.Promise(function (fulfill, reject) { opts.complete = function (err, res) { if (err) { reject(err); } else { fulfill(res); } }; }); self.once('cancel', function () { if (oldOnChange) { self.removeListener('change', oldOnChange); } db.removeListener('destroyed', onDestroy); opts.complete(null, {status: 'cancelled'}); }); this.then = promise.then.bind(promise); this['catch'] = promise['catch'].bind(promise); this.then(function (result) { complete(null, result); }, complete); if (!db.taskqueue.isReady) { db.taskqueue.addTask(function () { if (self.isCancelled) { self.emit('cancel'); } else { self.doChanges(opts); } }); } else { self.doChanges(opts); } } Changes.prototype.cancel = function () { this.isCancelled = true; if (this.db.taskqueue.isReady) { this.emit('cancel'); } }; function processChange(doc, metadata, opts) { var changeList = [{rev: doc._rev}]; if (opts.style === 'all_docs') { changeList = merge.collectLeaves(metadata.rev_tree) .map(function (x) { return {rev: x.rev}; }); } var change = { id: metadata.id, changes: changeList, doc: doc }; if (isDeleted(metadata, doc._rev)) { change.deleted = true; } if (opts.conflicts) { change.doc._conflicts = merge.collectConflicts(metadata); if (!change.doc._conflicts.length) { delete change.doc._conflicts; } } return change; } Changes.prototype.doChanges = function (opts) { var self = this; var callback = opts.complete; opts = utils.clone(opts); if ('live' in opts && !('continuous' in opts)) { opts.continuous = opts.live; } opts.processChange = processChange; if (opts.since === 'latest') { opts.since = 'now'; } if (!opts.since) { opts.since = 0; } if (opts.since === 'now') { this.db.info().then(function (info) { if (self.isCancelled) { callback(null, {status: 'cancelled'}); return; } opts.since = info.update_seq; self.doChanges(opts); }, callback); return; } if (opts.continuous && opts.since !== 'now') { this.db.info().then(function (info) { self.startSeq = info.update_seq; }, function (err) { if (err.id === 'idbNull') { //db closed before this returned //thats ok return; } throw err; }); } if (opts.filter && typeof opts.filter === 'string') { if (opts.filter === '_view') { opts.view = utils.normalizeDesignDocFunctionName(opts.view); } else { opts.filter = utils.normalizeDesignDocFunctionName(opts.filter); } if (this.db.type() !== 'http' && !opts.doc_ids) { return this.filterChanges(opts); } } if (!('descending' in opts)) { opts.descending = false; } // 0 and 1 should return 1 document opts.limit = opts.limit === 0 ? 1 : opts.limit; opts.complete = callback; var newPromise = this.db._changes(opts); if (newPromise && typeof newPromise.cancel === 'function') { var cancel = self.cancel; self.cancel = utils.getArguments(function (args) { newPromise.cancel(); cancel.apply(this, args); }); } }; Changes.prototype.filterChanges = function (opts) { var self = this; var callback = opts.complete; if (opts.filter === '_view') { if (!opts.view || typeof opts.view !== 'string') { var err = errors.error(errors.BAD_REQUEST, '`view` filter parameter is not provided.'); callback(err); return; } // fetch a view from a design doc, make it behave like a filter var viewName = utils.parseDesignDocFunctionName(opts.view); if (!viewName) { callback(errors.error(errors.BAD_REQUEST, '`view` filter parameter invalid.')); return; } this.db.get('_design/' + viewName[0], function (err, ddoc) { if (self.isCancelled) { callback(null, {status: 'cancelled'}); return; } if (err) { callback(errors.generateErrorFromResponse(err)); return; } if (ddoc && ddoc.views && ddoc.views[viewName[1]]) { var filter = evalView(ddoc.views[viewName[1]].map); opts.filter = filter; self.doChanges(opts); return; } var msg = ddoc.views ? 'missing json key: ' + viewName[1] : 'missing json key: views'; if (!err) { err = errors.error(errors.MISSING_DOC, msg); } callback(err); return; }); } else { // fetch a filter from a design doc var filterName = utils.parseDesignDocFunctionName(opts.filter); if (!filterName) { callback(errors.error(errors.BAD_REQUEST, '`filter` filter parameter invalid.')); return; } this.db.get('_design/' + filterName[0], function (err, ddoc) { if (self.isCancelled) { callback(null, {status: 'cancelled'}); return; } if (err) { callback(errors.generateErrorFromResponse(err)); return; } if (ddoc && ddoc.filters && ddoc.filters[filterName[1]]) { var filter = evalFilter(ddoc.filters[filterName[1]]); opts.filter = filter; self.doChanges(opts); return; } else { var msg = (ddoc && ddoc.filters) ? 'missing json key: ' + filterName[1] : 'missing json key: filters'; if (!err) { err = errors.error(errors.MISSING_DOC, msg); } callback(err); return; } }); } };
{ "content_hash": "b60c784376c456f80870d1e04ee87f26", "timestamp": "", "source": "github", "line_count": 272, "max_line_length": 79, "avg_line_length": 26.573529411764707, "alnum_prop": 0.579136690647482, "repo_name": "mattbailey/pouchdb", "id": "8aa9c08d2e476b71a6b84aa905fcf3504f4f7593", "size": "7228", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "lib/changes.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "7172" }, { "name": "JavaScript", "bytes": "2208974" }, { "name": "Shell", "bytes": "10371" } ], "symlink_target": "" }
using System.Web; using System.Web.Optimization; namespace Nimbow.Samples.AspNetMvcMfa { public class BundleConfig { // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862 public static void RegisterBundles(BundleCollection bundles) { bundles.Add(new ScriptBundle("~/bundles/jquery").Include( "~/Scripts/jquery-{version}.js")); bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include( "~/Scripts/jquery.validate*")); // Use the development version of Modernizr to develop with and learn from. Then, when you're // ready for production, use the build tool at http://modernizr.com to pick only the tests you need. bundles.Add(new ScriptBundle("~/bundles/modernizr").Include( "~/Scripts/modernizr-*")); bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include( "~/Scripts/bootstrap.js", "~/Scripts/respond.js")); bundles.Add(new StyleBundle("~/Content/css").Include( "~/Content/bootstrap.css", "~/Content/site.css")); } } }
{ "content_hash": "1b12d1e806792adcab85c1b89fdffbc4", "timestamp": "", "source": "github", "line_count": 31, "max_line_length": 112, "avg_line_length": 41.516129032258064, "alnum_prop": 0.5633255633255633, "repo_name": "Nimbow/Client-DotNet", "id": "154545c1b5a62070388edec63cb34f42e123f19b", "size": "1289", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Samples/Nimbow.Samples.AspNetMvcMfa/App_Start/BundleConfig.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "23444" } ], "symlink_target": "" }
<?php /** * Squiz_Sniffs_CSS_ColourDefinitionSniff. * * Ensure colours are defined in upper-case and use shortcuts where possible. * * @category PHP * @package PHP_CodeSniffer * @author Greg Sherwood <gsherwood@squiz.net> * @copyright 2006-2012 Squiz Pty Ltd (ABN 77 084 670 600) * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence * @version Release: 1.5.2 * @link http://pear.php.net/package/PHP_CodeSniffer */ class Squiz_Sniffs_CSS_ColourDefinitionSniff implements PHP_CodeSniffer_Sniff { /** * A list of tokenizers this sniff supports. * * @var array */ public $supportedTokenizers = array('CSS'); /** * Returns the token types that this sniff is interested in. * * @return array(int) */ public function register() { return array(T_COLOUR); }//end register() /** * Processes the tokens that this sniff is interested in. * * @param PHP_CodeSniffer_File $phpcsFile The file where the token was found. * @param int $stackPtr The position in the stack where * the token was found. * * @return void */ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); $colour = $tokens[$stackPtr]['content']; $expected = strtoupper($colour); if ($colour !== $expected) { $error = 'CSS colours must be defined in uppercase; expected %s but found %s'; $data = array( $expected, $colour, ); $phpcsFile->addError($error, $stackPtr, 'NotUpper', $data); } // Now check if shorthand can be used. if (strlen($colour) !== 7) { return; } if ($colour{1} === $colour{2} && $colour{3} === $colour{4} && $colour{5} === $colour{6}) { $expected = '#'.$colour{1}.$colour{3}.$colour{5}; $error = 'CSS colours must use shorthand if available; expected %s but found %s'; $data = array( $expected, $colour, ); $phpcsFile->addError($error, $stackPtr, 'Shorthand', $data); } }//end process() }//end class ?>
{ "content_hash": "f3990a5a76e0a35b5afb70f921edea8a", "timestamp": "", "source": "github", "line_count": 82, "max_line_length": 98, "avg_line_length": 29.414634146341463, "alnum_prop": 0.5402155887230514, "repo_name": "boratek/simple-site-inzf2", "id": "a6aa7e8ca74cee1607fa32bbab869f313ccd4143", "size": "2795", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "php/PHP/CodeSniffer/Standards/Squiz/Sniffs/CSS/ColourDefinitionSniff.php", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence https://raw.github.com/impetus-opensource/Kundera/Kundera-2.0.4/kundera-core/src/test/resources/META-INF/persistence_2_0.xsd" version="2.0"> <!-- Persistence Units for ES application --> <persistence-unit name="es-pu"> <provider>com.impetus.kundera.KunderaPersistence</provider> <properties> <property name="kundera.nodes" value="localhost" /> <property name="kundera.port" value="9300" /> <property name="kundera.keyspace" value="esSchema" /> <property name="kundera.dialect" value="es" /> <property name="kundera.client.lookup.class" value="com.impetus.client.es.ESClientFactory" /> </properties> </persistence-unit> <persistence-unit name="esAggregationPU"> <provider>com.impetus.kundera.KunderaPersistence</provider> <class>com.impetus.kundera.query.Person</class> <exclude-unlisted-classes>true</exclude-unlisted-classes> <properties> <property name="kundera.nodes" value="localhost" /> <property name="kundera.port" value="9300" /> <property name="kundera.keyspace" value="esSchema" /> <property name="kundera.dialect" value="es" /> <property name="kundera.client.lookup.class" value="com.impetus.client.es.ESClientFactory" /> </properties> </persistence-unit> <persistence-unit name="es-external-config"> <provider>com.impetus.kundera.KunderaPersistence</provider> <properties> <property name="kundera.nodes" value="localhost" /> <property name="kundera.port" value="9300" /> <property name="kundera.keyspace" value="esSchema" /> <property name="kundera.dialect" value="es" /> <property name="kundera.client.lookup.class" value="com.impetus.client.es.ESClientFactory" /> <property name="kundera.client.property" value="kunderaes.xml" /> </properties> </persistence-unit> <persistence-unit name="esMappedSuperClass-pu"> <provider>com.impetus.kundera.KunderaPersistence</provider> <class>com.impetus.kundera.metadata.mappedsuperclass.Person</class> <class>com.impetus.kundera.metadata.mappedsuperclass.PersonChild</class> <exclude-unlisted-classes>true</exclude-unlisted-classes> <properties> <property name="kundera.nodes" value="localhost" /> <property name="kundera.port" value="9300" /> <property name="kundera.keyspace" value="esSchema" /> <property name="kundera.dialect" value="es" /> <property name="kundera.client.lookup.class" value="com.impetus.client.es.ESClientFactory" /> </properties> </persistence-unit> </persistence>
{ "content_hash": "fa48061cd0c8c80f5c441fc395794793", "timestamp": "", "source": "github", "line_count": 62, "max_line_length": 126, "avg_line_length": 42.45161290322581, "alnum_prop": 0.7344224924012158, "repo_name": "lgscofield/Kundera", "id": "daf682ac9142d686cce11d08c50d099fdc04f800", "size": "2632", "binary": false, "copies": "3", "ref": "refs/heads/trunk", "path": "src/kundera-elastic-search/src/test/resources/META-INF/persistence.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "14122679" }, { "name": "Shell", "bytes": "113" } ], "symlink_target": "" }
<template name="_tabsHeader"> {{> ionHeaderBar class="bar-assertive"}} {{#contentFor "headerButtonLeft"}} {{>ionNavBackButton path="index"}} {{/contentFor}} {{#contentFor "headerTitle"}} Tabs {{/contentFor}} </template>
{ "content_hash": "148033b1d32525d6e0d9c52d069e9f6d", "timestamp": "", "source": "github", "line_count": 9, "max_line_length": 44, "avg_line_length": 28.444444444444443, "alnum_prop": 0.60546875, "repo_name": "cyclops24/ionic-demo", "id": "86f17529b2d481fd8a0bad648685321d6f191761", "size": "256", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "client/templates/tabs/_tabsHeader.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "659" }, { "name": "Cucumber", "bytes": "10237" }, { "name": "HTML", "bytes": "53374" }, { "name": "JavaScript", "bytes": "14665" } ], "symlink_target": "" }
<?php # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/ads/googleads/v11/enums/product_channel.proto namespace Google\Ads\GoogleAds\V11\Enums\ProductChannelEnum; use UnexpectedValueException; /** * Enum describing the locality of a product offer. * * Protobuf type <code>google.ads.googleads.v11.enums.ProductChannelEnum.ProductChannel</code> */ class ProductChannel { /** * Not specified. * * Generated from protobuf enum <code>UNSPECIFIED = 0;</code> */ const UNSPECIFIED = 0; /** * Used for return value only. Represents value unknown in this version. * * Generated from protobuf enum <code>UNKNOWN = 1;</code> */ const UNKNOWN = 1; /** * The item is sold online. * * Generated from protobuf enum <code>ONLINE = 2;</code> */ const ONLINE = 2; /** * The item is sold in local stores. * * Generated from protobuf enum <code>LOCAL = 3;</code> */ const LOCAL = 3; private static $valueToName = [ self::UNSPECIFIED => 'UNSPECIFIED', self::UNKNOWN => 'UNKNOWN', self::ONLINE => 'ONLINE', self::LOCAL => 'LOCAL', ]; public static function name($value) { if (!isset(self::$valueToName[$value])) { throw new UnexpectedValueException(sprintf( 'Enum %s has no name defined for value %s', __CLASS__, $value)); } return self::$valueToName[$value]; } public static function value($name) { $const = __CLASS__ . '::' . strtoupper($name); if (!defined($const)) { throw new UnexpectedValueException(sprintf( 'Enum %s has no value defined for name %s', __CLASS__, $name)); } return constant($const); } } // Adding a class alias for backwards compatibility with the previous class name. class_alias(ProductChannel::class, \Google\Ads\GoogleAds\V11\Enums\ProductChannelEnum_ProductChannel::class);
{ "content_hash": "441dc85146cf3da2ab23ca2659c58141", "timestamp": "", "source": "github", "line_count": 71, "max_line_length": 109, "avg_line_length": 28.3943661971831, "alnum_prop": 0.6096230158730159, "repo_name": "googleads/google-ads-php", "id": "20b42b029f48c55020b972d7e17b1c674d30236b", "size": "2016", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "src/Google/Ads/GoogleAds/V11/Enums/ProductChannelEnum/ProductChannel.php", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Dockerfile", "bytes": "899" }, { "name": "PHP", "bytes": "9952711" }, { "name": "Shell", "bytes": "338" } ], "symlink_target": "" }
% Filename: validateAssemblyAnalysis.m % Author: Samuel Acuña % Date: 02 Dec 2016 % % About: % Driver file for the simEngine3D framework. Defines the system, the % bodies in the system, and the constraints in the system. % Uses the double pendulum to test assembly analysis clear; clc; close all % access directory with simEngine in it. currentpath = cd('..'); cd('..'); addpath(pwd); % add grandparent folder to path cd(currentpath); % return to initial folder %% DEFINE SYSTEM %% sys = system3D(); %initialize system %% DEFINE BODIES IN THE SYSTEM %% % body 1, ground sys.addBody('ground') % body 1, ground % body 2, in initial configuration. All units in SI L2 = 2; theta = pi/2; %initial rotation,radians R = utility.R2(pi/2)*utility.R3(theta); % initial pendulum rotation p = utility.A2p(R); % euler parameter for pendulum LRF rotation sys.addBody('free',[0;L2*sin(theta);-L2*cos(theta)],p); % add body 2 sys.body{2}.color = [0.4141, 0.3516, 0.8008]; %slateblue % set body 2 mass rho = 7800; Length = 4; width = 0.05; volume = Length*width*width; mass = rho*volume; sys.body{2}.setMass(mass); % set body 2 inertia J = zeros(3); J(1,1) = mass/12*(width^2+width^2); J(2,2) = mass/12*(Length^2+width^2); J(3,3) = mass/12*(Length^2+width^2); sys.body{2}.setInertia(J); % body 3, in initial configuration. All units in SI L3 = L2/2; theta = 0; %initial rotation,radians R = utility.R2(pi/2)*utility.R3(theta); % initial pendulum rotation p = utility.A2p(R); % euler parameter for pendulum LRF rotation sys.addBody('free',[0;2*L2+L3*sin(theta);-L3*cos(theta)],p); % add body 3 sys.body{3}.color = [0.6953, 0.1328, 0.1328]; %Firebrick red % set body 3 mass rho = 7800; Length = 2; width = 0.05; volume = Length*width*width; mass = rho*volume; sys.body{3}.setMass(mass); % set body 3 inertia J = zeros(3); J(1,1) = mass/12*(width^2+width^2); J(2,2) = mass/12*(Length^2+width^2); J(3,3) = mass/12*(Length^2+width^2); sys.body{3}.setInertia(J); %% DEFINE POINTS ON THE BODIES %% % these are used to specify heads and tails of vectors sys.body{1}.addPoint([0;0;0]); % body 1, point 1 sys.body{1}.addPoint([0;1;0]); % body 1, point 2 sys.body{1}.addPoint([0;0;-1]); % body 1, point 3 sys.body{2}.addPoint([0;0;0]); % body 2, point 1 sys.body{2}.addPoint([0;0;1]); % body 2, point 2 sys.body{2}.addPoint([-2;0;0]); % body 2, point 3 sys.body{2}.addPoint([2;0;0]); % body 2, point 4 sys.body{2}.addPoint([0;-1;0]); % body 2, point 5 sys.body{3}.addPoint([-1;0;0]); % body 3, point 1 sys.body{3}.addPoint([0;0;0]); % body 3, point 2 sys.body{3}.addPoint([0;0;1]); % body 3, point 3 sys.body{3}.addPoint([1;0;0]); % body 3, point 4, just for looks %% PLOT THE SYSTEM in 3D %% sys.plot(1) % plot with reference frames view(98,12); axis equal %% PERTURB ASSEMBLY FROM CONSISTENT CONFIGURATION % at this point, the pendulum should have a consistent configuration perturbSize = 0.001; sys.constructQ(); q_original = sys.q; q_perturbed = sys.q + perturbSize*rand(size(sys.q)); % slightly adjust q vector (positions and orientations) sys.updateSystem(q_perturbed,[],[]) %% DEFINE CONSTRAINTS AMONG THE BODIES %% % KINEMATIC CONSTRAINTS % revolute joint with ground body sys.addConstraint('rj',sys.body{1},1,1,2,1,3,sys.body{2},3,1,2) % revolute joint body 3 to body 2 sys.addConstraint('rj',sys.body{2},4,1,4,1,5,sys.body{3},1,2,3) % EULER PARAMETER NORMALIZATION CONSTRAINTS sys.addEulerParamConstraints(); %% ASSEMBLE CONSTRAINT MATRIX q_assembled = sys.assemblyAnalysis(); sys.assembleConstraints(q_assembled) %% Validate THE SOLUTION sys.checkInitialConditions(1e-5) q_difference = q_original-q_assembled
{ "content_hash": "9efae2afb0101e5e4021451bf6411f35", "timestamp": "", "source": "github", "line_count": 121, "max_line_length": 108, "avg_line_length": 30.05785123966942, "alnum_prop": 0.6882045642012647, "repo_name": "saacuna/simEngine3D", "id": "5fb914f5506c2354c03cf7d2978cf9ea9dec109f", "size": "3637", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "final_project/validateAssemblyAnalysis/simEngine3D_validateAssemblyAnalysis.m", "mode": "33188", "license": "mit", "language": [ { "name": "Matlab", "bytes": "291996" } ], "symlink_target": "" }
#import "NSObject.h" #import "NSCopying-Protocol.h" #import "NSMutableCopying-Protocol.h" @class NSManagedObjectID; // Not exported @interface _CDSnapshot : NSObject <NSCopying, NSMutableCopying> { int _cd_rc; int _cd_version; NSManagedObjectID *_cd_objectID; struct _snapshotFlags_st { unsigned int _readOnly:1; unsigned int _reservedFlags:31; } _cd_flags; unsigned int _cd_nullFlags_; } + (unsigned int)newBatchAllocation:(id *)arg1 count:(unsigned int)arg2 withOwnedObjectIDs:(id *)arg3; + (void)_entityDeallocated; + (id)allocWithZone:(struct _NSZone *)arg1; + (id)alloc; + (Class)classForEntity:(id)arg1; + (void)initialize; - (id)_snapshot_; - (id)objectID; - (id)entity; - (void)setValue:(id)arg1 forKey:(id)arg2; - (id)valueForKey:(id)arg1; - (id)description; - (id)_descriptionValues; - (void)dealloc; - (void)finalize; - (_Bool)_isDeallocating; - (_Bool)_tryRetain; - (unsigned long long)retainCount; - (oneway void)release; - (id)retain; - (_Bool)isEqual:(id)arg1; - (unsigned long long)hash; - (id)mutableCopy; - (id)mutableCopyWithZone:(struct _NSZone *)arg1; - (id)copy; - (id)copyWithZone:(struct _NSZone *)arg1; - (id)initWithObjectID:(id)arg1; @end
{ "content_hash": "ed4f2cf7611336c9219b9625a15e0181", "timestamp": "", "source": "github", "line_count": 52, "max_line_length": 101, "avg_line_length": 23.346153846153847, "alnum_prop": 0.6911037891268533, "repo_name": "matthewsot/CocoaSharp", "id": "cffbb9fc223f2c9eab148b39e9810516f80615d6", "size": "1354", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Headers/Frameworks/CoreData/_CDSnapshot.h", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "259784" }, { "name": "C#", "bytes": "2789005" }, { "name": "C++", "bytes": "252504" }, { "name": "Objective-C", "bytes": "24301417" }, { "name": "Smalltalk", "bytes": "167909" } ], "symlink_target": "" }
#include "tensorflow/core/profiler/rpc/client/capture_profile.h" #include <cstdio> #include <ctime> #include <vector> #include "grpcpp/grpcpp.h" #include "absl/strings/escaping.h" #include "absl/strings/match.h" #include "tensorflow/core/distributed_runtime/rpc/grpc_util.h" #include "tensorflow/core/lib/core/errors.h" #include "tensorflow/core/lib/core/status.h" #include "tensorflow/core/lib/io/path.h" #include "tensorflow/core/lib/strings/numbers.h" #include "tensorflow/core/lib/strings/str_util.h" #include "tensorflow/core/platform/grpc_services.h" #include "tensorflow/core/profiler/rpc/client/dump_tpu_profile.h" #include "tensorflow/core/util/events_writer.h" namespace tensorflow { namespace profiler { namespace client { constexpr uint64 kMaxEvents = 1000000; string GetCurrentTimeStampAsString() { char s[128]; std::time_t t = std::time(nullptr); auto result = std::strftime(s, sizeof(s), "%F_%T", std::localtime(&t)); DCHECK_NE(result, 0); return s; } Status ValidateHostPortPair(const string& host_port) { uint32 port; std::vector<string> parts = str_util::Split(host_port, ':'); // Must be host:port, port must be a number, host must not contain a '/', // host also must not be empty. if (parts.size() != 2 || !strings::safe_strtou32(parts[1], &port) || parts[0].find("/") != string::npos || parts[0].empty()) { return errors::InvalidArgument("Could not interpret \"", host_port, "\" as a host-port pair."); } return Status::OK(); } ProfileRequest PopulateProfileRequest(int duration_ms, const string& repository_root, const string& session_id, const ProfileOptions& opts) { ProfileRequest request; request.set_duration_ms(duration_ms); request.set_max_events(kMaxEvents); if (absl::StartsWith(repository_root, "gs://")) { // For backward compatibilities, only generate tracetable etc when the // user provide a GCS path for model directory. request.set_repository_root(repository_root); request.set_session_id(session_id); } request.add_tools("op_profile"); request.add_tools("input_pipeline"); request.add_tools("memory_viewer"); request.add_tools("overview_page"); request.add_tools("pod_viewer"); *request.mutable_opts() = opts; return request; } // Returns whether the returned trace is empty. // Failure are handled by CHECK, i.e. abort() Status Profile(const string& service_addr, const string& logdir, int duration_ms, const string& repository_root, const string& session_id, const ProfileOptions& opts) { ProfileRequest request = PopulateProfileRequest(duration_ms, repository_root, session_id, opts); ::grpc::ClientContext context; ::grpc::ChannelArguments channel_args; // TODO(qiuminxu): use `NewHostPortGrpcChannel` instead once their // `ValidateHostPortPair` checks for empty host string case. channel_args.SetInt(GRPC_ARG_MAX_MESSAGE_LENGTH, std::numeric_limits<int32>::max()); std::unique_ptr<grpc::ProfilerService::Stub> stub = grpc::ProfilerService::NewStub(::grpc::CreateCustomChannel( "dns:///" + service_addr, ::grpc::InsecureChannelCredentials(), channel_args)); ProfileResponse response; TF_RETURN_IF_ERROR( FromGrpcStatus(stub->Profile(&context, request, &response))); if (!response.encoded_trace().empty()) { TF_CHECK_OK(WriteTensorboardTPUProfile(logdir, session_id, "", response, &std::cout)); // Print this at the end so that it's not buried in irrelevant LOG messages. std::cout << "NOTE: using the trace duration " << duration_ms << "ms." << std::endl << "Set an appropriate duration (with --duration_ms) if you " "don't see a full step in your trace or the captured trace is too " "large." << std::endl; } if (response.encoded_trace().empty()) { return Status(tensorflow::error::Code::UNAVAILABLE, "No trace event is collected"); } return Status::OK(); } // Start a new profiling session that include all the hosts included in // hostnames, for the time interval of duration_ms. Possibly save the profiling // result in the directory specified by repository_root and session_id. Status NewSession(const string& service_addr, const std::vector<tensorflow::string>& hostnames, int duration_ms, const string& repository_root, const string& session_id, const ProfileOptions& opts) { NewProfileSessionRequest new_session_request; *new_session_request.mutable_request() = PopulateProfileRequest(duration_ms, repository_root, session_id, opts); new_session_request.set_repository_root(repository_root); new_session_request.set_session_id(session_id); for (const auto& hostname : hostnames) { new_session_request.add_hosts(hostname); } ::grpc::ClientContext context; ::grpc::ChannelArguments channel_args; // TODO(qiuminxu): use `NewHostPortGrpcChannel` instead once their // `ValidateHostPortPair` checks for empty host string case. channel_args.SetMaxReceiveMessageSize(std::numeric_limits<int32>::max()); // TODO(jiesun): GRPC support following relevant naming scheme: // 1. dns:///host:port // 2. ipv4:host:port or ipv6:[host]:port // We might need to change the prefix which depends on what TPU name resolver // will give us. std::unique_ptr<grpc::ProfileAnalysis::Stub> stub = grpc::ProfileAnalysis::NewStub(::grpc::CreateCustomChannel( "dns:///" + service_addr, ::grpc::InsecureChannelCredentials(), channel_args)); NewProfileSessionResponse new_session_response; TF_RETURN_IF_ERROR(FromGrpcStatus( stub->NewSession(&context, new_session_request, &new_session_response))); std::cout << "Profile session succeed for host(s):" << absl::StrJoin(hostnames, ",") << std::endl; if (new_session_response.empty_trace()) { return Status(tensorflow::error::Code::UNAVAILABLE, "No trace event is collected"); } return Status::OK(); } // Creates an empty event file if not already exists, which indicates that we // have a plugins/profile/ directory in the current logdir. Status MaybeCreateEmptyEventFile(const tensorflow::string& logdir) { // Suffix for an empty event file. it should be kept in sync with // _EVENT_FILE_SUFFIX in tensorflow/python/eager/profiler.py. constexpr char kProfileEmptySuffix[] = ".profile-empty"; std::vector<string> children; TF_RETURN_IF_ERROR(Env::Default()->GetChildren(logdir, &children)); for (const string& child : children) { if (str_util::EndsWith(child, kProfileEmptySuffix)) { return Status::OK(); } } EventsWriter event_writer(io::JoinPath(logdir, "events")); return event_writer.InitWithSuffix(kProfileEmptySuffix); } // Starts tracing on a single or multiple TPU hosts and saves the result in the // given logdir. If no trace was collected, retries tracing for // num_tracing_attempts. Status StartTracing(const tensorflow::string& service_addr, const tensorflow::string& logdir, const tensorflow::string& workers_list, bool include_dataset_ops, int duration_ms, int num_tracing_attempts) { // Use the current timestamp as the run name. tensorflow::string session_id = GetCurrentTimeStampAsString(); constexpr char kProfilePluginDirectory[] = "plugins/profile/"; tensorflow::string repository_root = io::JoinPath(logdir, kProfilePluginDirectory); std::vector<tensorflow::string> hostnames = tensorflow::str_util::Split(workers_list, ","); TF_RETURN_IF_ERROR(MaybeCreateEmptyEventFile(logdir)); Status status = Status::OK(); int remaining_attempts = num_tracing_attempts; tensorflow::ProfileOptions opts; opts.set_include_dataset_ops(include_dataset_ops); while (true) { std::cout << "Starting to profile TPU traces for " << duration_ms << " ms. " << "Remaining attempt(s): " << --remaining_attempts << std::endl; if (hostnames.empty()) { status = Profile(service_addr, logdir, duration_ms, repository_root, session_id, opts); } else { tensorflow::string tpu_master = service_addr; status = NewSession(tpu_master, hostnames, duration_ms, repository_root, session_id, opts); } if (remaining_attempts <= 0 || status.ok() || status.code() != tensorflow::error::Code::UNAVAILABLE || status.code() != tensorflow::error::Code::ALREADY_EXISTS) break; std::cout << "No trace event is collected. Automatically retrying." << std::endl << std::endl; } if (status.code() == tensorflow::error::Code::UNAVAILABLE) { std::cout << "No trace event is collected after " << num_tracing_attempts << " attempt(s). " << "Perhaps, you want to try again (with more attempts?)." << std::endl << "Tip: increase number of attempts with --num_tracing_attempts." << std::endl; } return status; } MonitorRequest PopulateMonitorRequest(int duration_ms, int monitoring_level, bool timestamp) { MonitorRequest request; request.set_duration_ms(duration_ms); request.set_monitoring_level(monitoring_level); request.set_timestamp(timestamp); return request; } Status StartMonitoring(const tensorflow::string& service_addr, int duration_ms, int monitoring_level, bool timestamp, int num_queries) { for (int query = 0; query < num_queries; ++query) { MonitorRequest request = PopulateMonitorRequest(duration_ms, monitoring_level, timestamp); ::grpc::ClientContext context; ::grpc::ChannelArguments channel_args; channel_args.SetInt(GRPC_ARG_MAX_MESSAGE_LENGTH, std::numeric_limits<int32>::max()); std::unique_ptr<grpc::ProfilerService::Stub> stub = grpc::ProfilerService::NewStub(::grpc::CreateCustomChannel( "dns:///" + service_addr, ::grpc::InsecureChannelCredentials(), channel_args)); MonitorResponse response; TF_RETURN_IF_ERROR( FromGrpcStatus(stub->Monitor(&context, request, &response))); std::cout << "Cloud TPU Monitoring Results (Sample " << query + 1 << "):\n\n" << response.data() << std::flush; } return Status::OK(); } } // namespace client } // namespace profiler } // namespace tensorflow
{ "content_hash": "c27901cd6211390e60fbb45598b6736d", "timestamp": "", "source": "github", "line_count": 261, "max_line_length": 80, "avg_line_length": 41.05747126436781, "alnum_prop": 0.6605076521089959, "repo_name": "ghchinoy/tensorflow", "id": "06a97b4874ef247ee6f766de0e5589b593463795", "size": "11383", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "tensorflow/core/profiler/rpc/client/capture_profile.cc", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Assembly", "bytes": "3568" }, { "name": "Batchfile", "bytes": "15317" }, { "name": "C", "bytes": "699905" }, { "name": "C#", "bytes": "8446" }, { "name": "C++", "bytes": "67022491" }, { "name": "CMake", "bytes": "206499" }, { "name": "Dockerfile", "bytes": "73602" }, { "name": "Go", "bytes": "1585039" }, { "name": "HTML", "bytes": "4680118" }, { "name": "Java", "bytes": "836400" }, { "name": "Jupyter Notebook", "bytes": "1665583" }, { "name": "LLVM", "bytes": "6536" }, { "name": "Makefile", "bytes": "98194" }, { "name": "Objective-C", "bytes": "94022" }, { "name": "Objective-C++", "bytes": "175222" }, { "name": "PHP", "bytes": "17600" }, { "name": "Pascal", "bytes": "3239" }, { "name": "Perl", "bytes": "7536" }, { "name": "Python", "bytes": "48407007" }, { "name": "RobotFramework", "bytes": "891" }, { "name": "Ruby", "bytes": "4733" }, { "name": "Shell", "bytes": "476920" }, { "name": "Smarty", "bytes": "27495" }, { "name": "Swift", "bytes": "56155" } ], "symlink_target": "" }
%% Machine Learning Online Class % Exercise 8 | Anomaly Detection and Collaborative Filtering % % Instructions % ------------ % % This file contains code that helps you get started on the % exercise. You will need to complete the following functions: % % estimateGaussian.m % selectThreshold.m % cofiCostFunc.m % % For this exercise, you will not need to change any code in this file, % or any other files other than those mentioned above. % %% Initialization clear ; close all; clc %% ================== Part 1: Load Example Dataset =================== % We start this exercise by using a small dataset that is easy to % visualize. % % Our example case consists of 2 network server statistics across % several machines: the latency and throughput of each machine. % This exercise will help us find possibly faulty (or very fast) machines. % fprintf('Visualizing example dataset for outlier detection.\n\n'); % The following command loads the dataset. You should now have the % variables X, Xval, yval in your environment load('ex8data1.mat'); % Visualize the example dataset plot(X(:, 1), X(:, 2), 'bx'); axis([0 30 0 30]); xlabel('Latency (ms)'); ylabel('Throughput (mb/s)'); fprintf('Program paused. Press enter to continue.\n'); %pause %% ================== Part 2: Estimate the dataset statistics =================== % For this exercise, we assume a Gaussian distribution for the dataset. % % We first estimate the parameters of our assumed Gaussian distribution, % then compute the probabilities for each of the points and then visualize % both the overall distribution and where each of the points falls in % terms of that distribution. % fprintf('Visualizing Gaussian fit.\n\n'); % Estimate my and sigma2 [mu sigma2] = estimateGaussian(X); % Returns the density of the multivariate normal at each data point (row) % of X p = multivariateGaussian(X, mu, sigma2); % Visualize the fit visualizeFit(X, mu, sigma2); xlabel('Latency (ms)'); ylabel('Throughput (mb/s)'); fprintf('Program paused. Press enter to continue.\n'); %pause; %% ================== Part 3: Find Outliers =================== % Now you will find a good epsilon threshold using a cross-validation set % probabilities given the estimated Gaussian distribution % pval = multivariateGaussian(Xval, mu, sigma2); [epsilon F1] = selectThreshold(yval, pval); fprintf('Best epsilon found using cross-validation: %e\n', epsilon); fprintf('Best F1 on Cross Validation Set: %f\n', F1); fprintf(' (you should see a value epsilon of about 8.99e-05)\n\n'); % Find the outliers in the training set and plot the outliers = find(p < epsilon); % Draw a red circle around those outliers hold on plot(X(outliers, 1), X(outliers, 2), 'ro', 'LineWidth', 2, 'MarkerSize', 10); hold off fprintf('Program paused. Press enter to continue.\n'); pause; %% ================== Part 4: Multidimensional Outliers =================== % We will now use the code from the previous part and apply it to a % harder problem in which more features describe each datapoint and only % some features indicate whether a point is an outlier. % % Loads the second dataset. You should now have the % variables X, Xval, yval in your environment load('ex8data2.mat'); % Apply the same steps to the larger dataset [mu sigma2] = estimateGaussian(X); % Training set p = multivariateGaussian(X, mu, sigma2); % Cross-validation set pval = multivariateGaussian(Xval, mu, sigma2); % Find the best threshold [epsilon F1] = selectThreshold(yval, pval); fprintf('Best epsilon found using cross-validation: %e\n', epsilon); fprintf('Best F1 on Cross Validation Set: %f\n', F1); fprintf('# Outliers found: %d\n', sum(p < epsilon)); fprintf(' (you should see a value epsilon of about 1.38e-18)\n\n'); pause
{ "content_hash": "1ca7c148e862b4afc54c01754dc1a970", "timestamp": "", "source": "github", "line_count": 123, "max_line_length": 81, "avg_line_length": 30.983739837398375, "alnum_prop": 0.6937811598005773, "repo_name": "mungobungo/ml_2016", "id": "a636ff6bd86c10e505228af608e093d6560baae1", "size": "3811", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "machine-learning-ex8/ex8/ex8.m", "mode": "33188", "license": "mit", "language": [ { "name": "Matlab", "bytes": "819833" } ], "symlink_target": "" }
import re import json import dateutil import logging import urllib3 import collections from bson import ObjectId from urllib.parse import urlparse, parse_qs, parse_qsl from datetime import date, datetime import requests from functools import partial from time import time, sleep from slovar.strings import split_strip, str2dt, str2rdt from slovar.utils import maybe_dotted from slovar import slovar from prf.utils.errors import DValueError, DKeyError log = logging.getLogger(__name__) OPERATORS = ['ne', 'lt', 'lte', 'gt', 'gte', 'in', 'all', 'startswith', 'exists', 'range', 'geobb', 'size'] class Params(slovar): 'Subclass of slovar that will raise D* exceptions' def __init__(self, *arg, **kw): super().__init__(*arg, **kw) def bad_value_error_klass(self, e): return DValueError(e) def missing_key_error_klass(self, e): return DKeyError(e) class JSONEncoder(json.JSONEncoder): def default(self, obj): if isinstance(obj, (datetime, date)): return obj.isoformat().split(".")[0] try: return super(JSONEncoder, self).default(obj) except TypeError: return str(obj) # fallback to unicode def json_dumps(body): return json.dumps(body, cls=JSONEncoder) def process_limit(start, page, limit): try: limit = int(limit) if start is not None and page is not None: raise DValueError('Can not specify _start and _page at the same time') if start is not None: start = int(start) elif page is not None and limit > 0: start = int(page) * limit else: start = 0 if limit < -1 or start < 0: raise DValueError('_limit/_page or _limit/_start can not be < 0') except (ValueError, TypeError) as e: raise DValueError(e) except Exception as e: #pragma nocover raise DValueError('Bad _limit param: %s ' % e) return start, limit def snake2camel(text): '''turn the snake case to camel case: snake_camel -> SnakeCamel''' return ''.join([a.title() for a in text.split('_')]) def camel2snake(name): s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name) return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower() def urlify(s): s = re.sub(r"[^\w\s]", '', s) s = re.sub(r"\s+", '_', s) return s def process_key(key, suffix=''): _key, div, op = key.rpartition('__') if div and op in OPERATORS: key = _key key = key.replace('__', '.') return ('%s.%s' % (key, suffix) if suffix else key), (op if op in OPERATORS else '') def parse_specials(orig_params): specials = Params( _sort=None, _fields=None, _count=None, _start=None, _limit=None, _page=None, _end=None, _frequencies=None, _group=None, _distinct=None, _scalar=None, _flat=None, _flat_sep=None, _flat_keep_lists=None, _join=None, _unwind=None, _meta=None, _tr=None ) def short(name): _n = name[:2] if _n in params: return _n else: return name params = orig_params.copy() specials._sort = params.aslist(short('_sort'), default=[], pop=True) specials._fields = params.aslist(short('_fields'), default=[], pop=True) specials._flat = params.aslist(short('_flat'), default=[], pop=True) specials._group = params.aslist(short('_group'), default=[], pop=True) specials._count = short('_count') in params; params.pop(short('_count'), False) params.asint('_start', allow_missing=True) params.asint('_page', allow_missing=True) params.asint('_limit', allow_missing=True) if not specials._count and params.get('_limit'): specials._start, specials._limit = process_limit( params.pop('_start', None), params.pop('_page', None), params.asint(short('_limit'), pop=True)) specials._end = specials._start+specials._limit\ if specials._limit > -1 else None specials._flat_keep_lists = params.asbool('_flat_keep_lists', default=False) specials._flat_sep = params.asstr('_flat_sep', default='.') specials._asdict = params.pop('_asdict', False) specials._pop_empty = params.pop('_pop_empty', False) for each in list(params.keys()): if each.startswith('_'): specials[each] = params.pop(each) if '.' in each and each in params: params[each.replace('.', '__')] = params.pop(each) params = typecast(params) #deduce fields from the query if 'AUTO' in specials._fields: for kk in params: fld, _ = process_key(kk) specials._fields.append(fld) specials._meta = specials.get('_meta') or slovar() specials._tr = specials.aslist('_tr', default=[]) return params, specials def typecast(params): params = Params(params) list_ops = ('in', 'nin', 'all') int_ops = ('exists', 'size', 'max_distance', 'min_distance', 'empty') geo_ops = ('near',) types = ('asbool', 'asint', 'asfloat', 'asstr', 'aslist', 'asset', 'asdt', 'asobj', 'asdtob') for key in list(params.keys()): if params[key] == 'null': params[key] = None continue parts = key.split('__') if len(parts) <= 1: continue suf = [] op = '' for ix in range(len(parts)-1, -1, -1): part = parts[ix] if part in list_ops+int_ops+geo_ops+types: op = part break if not op: continue new_key = '__'.join([e for e in parts if e != op]) if op in geo_ops: coords = params.aslist(key) try: coords = [float(e) for e in coords] if len(coords) != 2: raise ValueError except ValueError: raise DValueError('`near` operator takes pair of' ' numeric elements. Got `%s` instead' % coords) params[key] = coords continue if op in list_ops: new_key = key op = 'aslist' if op in int_ops: new_key = key op = 'asint' if not op.startswith('as') and not op in types: continue if op == 'asobj': params[new_key]=ObjectId(params.pop(key)) continue try: method = getattr(params, op) if isinstance(method, collections.Callable): params[new_key] = method(key, pop=True) except (KeyError, AttributeError) as e: raise DValueError('Unknown typecast operator `%s`' % op) return params def with_metaclass(meta, *bases): """Defines a metaclass. Creates a dummy class with a dummy metaclass. When subclassed, the dummy metaclass is used, which has a constructor that instantiates a new class from the original parent. This ensures that the dummy class and dummy metaclass are not in the inheritance tree. Credit to Armin Ronacher. """ class metaclass(meta): __call__ = type.__call__ __init__ = type.__init__ def __new__(cls, name, this_bases, d): if this_bases is None: return type.__new__(cls, name, (), d) return meta(name, bases, d) return metaclass('temporary_class', None, {}) def resolve_host_to(url, newhost): ''' substitute the host in `url` with `newhost` if newhost ends with `:` the original port will be preserved. ''' elements = urlparse(url) _, _, port = elements.netloc.partition(':') newhost,newcol,newport=newhost.partition(':') if newcol: if not newport: newport = port else: newport = '' if newport: newhost = '%s:%s' % (newhost, newport) return elements._replace(netloc=newhost).geturl() def sanitize_url(url, to_remove=None): if not to_remove: return urlparse(url)._replace(query='').geturl() if isinstance(to_remove, str): to_remove = [to_remove] elements = urlparse(url) qs_dict = parse_qs(elements.query) for rm in to_remove: qs_dict.pop(rm, None) return elements._replace( query=urlencode(qs_dict, True)).geturl() def to_dunders(d, only=None): new_d = slovar() for key in d: if only and key not in only: continue if '__' not in key: new_d['set__%s'%key.replace('.', '__')] = d[key] else: new_d[key] = d[key] return new_d def validate_url(url, method='GET'): from requests import Session, Request try: return Session().send(Request(method, url).prepare()).status_code except Exception: raise DValueError('URL not reachable `%s`' % url) def is_url(text, validate=False): if text.startswith('http'): if validate: return validate_url(text) else: return True return False def chunks(_list, chunk_size): for ix in range(0, len(_list), chunk_size): yield _list[ix:ix+chunk_size] def encoded_dict(in_dict): out_dict = {} for k, v in list(in_dict.items()): if isinstance(v, dict): out_dict[k] = encoded_dict(v) elif isinstance(v, list): for ix in range(len(v)): v[ix] = str(v[ix]).encode('utf-8') out_dict[k] = v else: out_dict[k] = str(v).encode('utf-8') return out_dict def urlencode(query, doseq=False): import urllib.request, urllib.parse, urllib.error try: return urllib.parse.urlencode(encoded_dict(query), doseq) except UnicodeEncodeError as e: log.error(e) def pager(start, page, total): def _pager(start,page,total): if total != -1: for each in chunks(list(range(0, total)), page): _page = len(each) yield (start, _page) start += _page else: while 1: yield (start, page) start += page return partial(_pager, start, page, total) def cleanup_url(url, _raise=True): if not url: if _raise: raise DValueError('bad url `%s`' % url) return '' try: parsed = urllib3.util.parse_url(url) except Exception as e: if _raise: raise e return '' host = parsed.host if not host: if _raise: raise DValueError('missing host in %s' % url) else: return '' if host.startswith('www.'): host = host[4:] path = (parsed.path or '').strip('/') return ('%s/%s' % (host, path)).strip('/') def ld2dl(ld): dl = {} for _d in ld: for kk,vv in _d.items(): if kk in dl: dl[kk].append(vv) else: dl[kk] = [vv] return dl def dl2ld(dl): "dict of lists to list of dicts" return [{key:value[index] for key, value in list(dl.items())} for index in range(len(list(dl.values())[0]))] def ld2dd(ld, key): 'list of dicts to dict of dicts' return {each[key]:each for each in ld} def d2inv(d, value_as_list=True): inv_dict = {} for kk,vv in d.items(): if value_as_list: inv_dict[vv] = inv_dict.get(vv, []) inv_dict[vv].append(kk) elif vv not in inv_dict: inv_dict[vv] = kk return inv_dict def qs2dict(qs): from urllib.parse import parse_qsl return slovar(parse_qsl(qs,keep_blank_values=True)) def TODAY(sep='_'): return datetime.utcnow().strftime(sep.join(['%Y', '%m', '%d'])) def NOW(sep=None): dnow = datetime.utcnow() if sep: return dnow.strftime(sep.join(['%Y', '%m', '%dT%H', '%M', '%S'])) return dnow.strftime('%Y-%m-%dT%H:%M:%S') def raise_or_log(_raise=False): if _raise: import sys _type, value, _ = sys.exc_info() raise _type(value) else: import traceback traceback.print_exc() def join(objects, joinee_itor, join_on, require_match=True, join_ns=None, join_unwind=True, join_params=None): ''' require_match = False is equivalent to SQL left join require_match = True is equivalent to SQL left inner join ''' join_params = slovar(join_params or {}).flat() for each in objects: _d1 = each.to_dict() join_params.update(_d1.extract(join_on).flat()) if not join_params: if require_match: log.warning('empty query for cls2') continue else: yield _d1 continue join_params.setdefault('_limit', 1) matched = joinee_itor(**join_params) if not matched: if require_match: continue elif not join_ns: yield _d1 continue else: matched = [slovar()] #attach empty slovar to results as join_ns if not join_unwind: joinee_list = [it.to_dict(join_params.get('_fields', [])) for it in matched] _d1[join_ns or 'joinee'] = joinee_list yield _d1 else: for it in matched: _d2 = it.to_dict(join_params.get('_fields', [])) if join_ns: _d2 = slovar({join_ns:_d2}) yield _d1.update_with(_d2) def rextract(expr, data, delim, _raise=True): for fld in expr.split(delim)[1::2]: _d = data.extract(fld) if _d: val = typecast(_d.flat())[fld] if val: expr = expr.replace('#%s#'%fld, val) else: msg = 'missing fields or value None in data.\nfields: %s\ndata keys: %s' % (fld, data.keys()) if _raise: raise ValueError(msg) else: log.warning(msg) return expr def get_dt_unique_name(name='', add_seconds=True, only_seconds=False): now = datetime.utcnow() seconds_since_midnight = int((now - now.replace(hour=0, minute=0, second=0, microsecond=0))\ .total_seconds()) if only_seconds: return '%s_%s' % (name, seconds_since_midnight) if name: uname = '%s_%s' % (TODAY(), name) else: uname = TODAY() if add_seconds: uname += '_%s' % seconds_since_midnight return uname class Throttler: def __init__(self, max_counter, period): self.max_counter = max_counter self.period = period self.reset() def reset(self): self.stime = time() self.counter = 0 def pause(self): time_past = time() - self.stime sleep_for = self.period-time_past log.debug('THROTTLE: sleep for %s, with %s' % (sleep_for, self.__dict__)) sleep(sleep_for) self.reset() def __call__(self): self.counter += 1 if time() - self.stime <= self.period and self.counter >= self.max_counter: self.pause() def dict2tab(data, fields=None, format_='csv', skip_headers=False): import tablib def render(each, key): val = each.get(key) if isinstance(val, (datetime, date)): val = val.strftime('%Y-%m-%dT%H:%M:%SZ') # iso elif isinstance(val, (list, tuple)): val = json.dumps(val) if val is None: val = '' return val data = data or [] if not data: return None headers = [] if fields: for each in split_strip(fields): aa, _, bb = each.partition('__as__') name = (bb or aa).split(':')[0] headers.append(name) else: #get the headers from the first item in the data. #Note, data IS schemaless, so other items could have different fields. headers = sorted(list(data[0].flat(keep_lists=1).keys())) log.warn('Default headers take from the first item: %s', headers) tabdata = tablib.Dataset(headers=None if skip_headers else headers) try: for each in data: each = each.extract(headers).flat(keep_lists=1) row = [] for col in headers: row.append(render(each, col)) tabdata.append(row) return getattr(tabdata, format_) except Exception as e: log.error('Headers:%s, Format:%s\nData:%s', tabdata.headers, format_, each) raise prf_exc.HTTPBadRequest('dict2tab error: %r' % e) class TabRenderer(object): def __init__(self, info): pass def __call__(self, value, system): request = system.get('request') response = request.response _, specials = system['view'](None, request).process_params(request) if 'text/csv' in request.accept: response.content_type = 'text/csv' _format = 'csv' elif 'text/xls' in request.accept: _format = 'xls' else: raise prf_exc.HTTPBadRequest( 'Unsupported Accept Header `%s`' % request.accept) return dict2tab(value.get('data', []), fields=specials.aslist('_csv_fields', default=[]), format_=_format)
{ "content_hash": "baa38fa6c51658a13a1a912b149b2413", "timestamp": "", "source": "github", "line_count": 651, "max_line_length": 105, "avg_line_length": 27.043010752688172, "alnum_prop": 0.5413234876455553, "repo_name": "vahana/prf", "id": "6282ea7fbb0af6689b777f13dbe251b583b64d46", "size": "17605", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "prf/utils/utils.py", "mode": "33188", "license": "mit", "language": [ { "name": "Python", "bytes": "167421" } ], "symlink_target": "" }
package org.apache.giraph.utils; import com.google.common.collect.UnmodifiableIterator; import org.apache.hadoop.io.IntWritable; /** * {@link UnmodifiableIterator} over a primitive int array */ public class UnmodifiableIntArrayIterator extends UnmodifiableIterator<IntWritable> { private final int[] arr; private int offset; public UnmodifiableIntArrayIterator(int[] arr) { this.arr = arr; offset = 0; } @Override public boolean hasNext() { return offset < arr.length; } @Override public IntWritable next() { return new IntWritable(arr[offset++]); } }
{ "content_hash": "f7078f8c1d24f7cf5c42b8287ee15091", "timestamp": "", "source": "github", "line_count": 31, "max_line_length": 58, "avg_line_length": 20.677419354838708, "alnum_prop": 0.6708268330733229, "repo_name": "serafett/giraphx", "id": "e01d242f929e9e6cbe19264e5be947846f89a051", "size": "1446", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "src/main/java/org/apache/giraph/utils/UnmodifiableIntArrayIterator.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "866149" } ], "symlink_target": "" }
package com.facebook.buck.features.d; import com.facebook.buck.core.model.BuildTarget; import com.facebook.buck.core.model.FlavorDomain; import com.facebook.buck.core.model.targetgraph.AbstractNodeBuilder; import com.facebook.buck.core.toolchain.ToolchainProvider; import com.facebook.buck.core.toolchain.impl.ToolchainProviderBuilder; import com.facebook.buck.cxx.toolchain.CxxPlatform; import com.facebook.buck.cxx.toolchain.CxxPlatformUtils; import com.facebook.buck.cxx.toolchain.CxxPlatformsProvider; import com.facebook.buck.rules.coercer.SourceSortedSet; import com.google.common.collect.ImmutableMap; public class DTestBuilder extends AbstractNodeBuilder< DTestDescriptionArg.Builder, DTestDescriptionArg, DTestDescription, DTest> { public DTestBuilder(BuildTarget target, DBuckConfig dBuckConfig, CxxPlatform defaultCxxPlatform) { super( new DTestDescription( createToolchain(defaultCxxPlatform), dBuckConfig, CxxPlatformUtils.DEFAULT_CONFIG), target); getArgForPopulating().setSrcs(SourceSortedSet.EMPTY); } private static ToolchainProvider createToolchain(CxxPlatform cxxPlatform) { return new ToolchainProviderBuilder() .withToolchain( CxxPlatformsProvider.DEFAULT_NAME, CxxPlatformsProvider.of( cxxPlatform, new FlavorDomain<>( "C/C++ platform", ImmutableMap.of(cxxPlatform.getFlavor(), cxxPlatform)))) .build(); } }
{ "content_hash": "4e82e707e1cfc9f10512a768fbb839a5", "timestamp": "", "source": "github", "line_count": 38, "max_line_length": 100, "avg_line_length": 39.1578947368421, "alnum_prop": 0.7547043010752689, "repo_name": "brettwooldridge/buck", "id": "f6e32745e2504462a54db8cd78994ba1087f4b2a", "size": "2093", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "test/com/facebook/buck/features/d/DTestBuilder.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Assembly", "bytes": "1585" }, { "name": "Batchfile", "bytes": "3875" }, { "name": "C", "bytes": "280326" }, { "name": "C#", "bytes": "237" }, { "name": "C++", "bytes": "18771" }, { "name": "CSS", "bytes": "56106" }, { "name": "D", "bytes": "1017" }, { "name": "Dockerfile", "bytes": "2081" }, { "name": "Go", "bytes": "9822" }, { "name": "Groovy", "bytes": "3362" }, { "name": "HTML", "bytes": "10916" }, { "name": "Haskell", "bytes": "1008" }, { "name": "IDL", "bytes": "480" }, { "name": "Java", "bytes": "28622919" }, { "name": "JavaScript", "bytes": "938678" }, { "name": "Kotlin", "bytes": "23444" }, { "name": "Lex", "bytes": "7502" }, { "name": "MATLAB", "bytes": "47" }, { "name": "Makefile", "bytes": "1916" }, { "name": "OCaml", "bytes": "4935" }, { "name": "Objective-C", "bytes": "176943" }, { "name": "Objective-C++", "bytes": "34" }, { "name": "PowerShell", "bytes": "2244" }, { "name": "Python", "bytes": "2069290" }, { "name": "Roff", "bytes": "1207" }, { "name": "Rust", "bytes": "5214" }, { "name": "Scala", "bytes": "5082" }, { "name": "Shell", "bytes": "76854" }, { "name": "Smalltalk", "bytes": "194" }, { "name": "Swift", "bytes": "11393" }, { "name": "Thrift", "bytes": "47828" }, { "name": "Yacc", "bytes": "323" } ], "symlink_target": "" }
@interface DetailViewController () @end @implementation DetailViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end
{ "content_hash": "0ff04207dd868f08e7f838f69a9cedcd", "timestamp": "", "source": "github", "line_count": 17, "max_line_length": 54, "avg_line_length": 18.764705882352942, "alnum_prop": 0.7304075235109718, "repo_name": "ArslanBilal/Instagram-Client", "id": "bceb81cfef67c60bd7b86743c06907efa6c9bc04", "size": "523", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "DemoApp/DemoApp/DetailViewController.m", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "9186" }, { "name": "Objective-C", "bytes": "946015" }, { "name": "Ruby", "bytes": "265" }, { "name": "Shell", "bytes": "4655" } ], "symlink_target": "" }
@interface ALRKeyboardViewController : UIViewController @end
{ "content_hash": "1c6e18be44fe738993035fff685225d3", "timestamp": "", "source": "github", "line_count": 3, "max_line_length": 55, "avg_line_length": 20.666666666666668, "alnum_prop": 0.8548387096774194, "repo_name": "cheungacc/AutoLayoutRecipes", "id": "283bb1c058b190d2ea8f4a45e85ad1fb288921ef", "size": "248", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "AutoLayoutRecipes/AutoLayoutRecipes/ALRKeyboardViewController.h", "mode": "33188", "license": "mit", "language": [ { "name": "Objective-C", "bytes": "11138" } ], "symlink_target": "" }
class UserPreview < ActionMailer::Preview end
{ "content_hash": "7288f3258af654cd49300b438f6b9b7d", "timestamp": "", "source": "github", "line_count": 2, "max_line_length": 41, "avg_line_length": 23, "alnum_prop": 0.8260869565217391, "repo_name": "5xRuby/daikichi", "id": "820d915264cfa47d6bcbfa70958f5d3648e2cd71", "size": "142", "binary": false, "copies": "1", "ref": "refs/heads/development", "path": "spec/mailers/previews/user_preview.rb", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Dockerfile", "bytes": "800" }, { "name": "HTML", "bytes": "11121" }, { "name": "Haml", "bytes": "56747" }, { "name": "JavaScript", "bytes": "5778" }, { "name": "Ruby", "bytes": "277786" }, { "name": "SCSS", "bytes": "2398" }, { "name": "Shell", "bytes": "5653" } ], "symlink_target": "" }
class BookmarkMenuController; class Browser; class BrowserWindowGtk; class GtkThemeService; class MenuGtk; class TabstripOriginProvider; namespace content { class PageNavigator; } class BookmarkBarGtk : public ui::AnimationDelegate, public BookmarkModelObserver, public MenuBarHelper::Delegate, public content::NotificationObserver, public BookmarkBarInstructionsGtk::Delegate, public BookmarkContextMenuControllerDelegate { public: // The NTP needs to have access to this. static const int kBookmarkBarNTPHeight; BookmarkBarGtk(BrowserWindowGtk* window, Browser* browser, TabstripOriginProvider* tabstrip_origin_provider); virtual ~BookmarkBarGtk(); // Returns the current browser. Browser* browser() const { return browser_; } // Returns the top level widget. GtkWidget* widget() const { return event_box_.get(); } // Sets the PageNavigator that is used when the user selects an entry on // the bookmark bar. void SetPageNavigator(content::PageNavigator* navigator); // Create the contents of the bookmark bar. void Init(); // Changes the state of the bookmark bar. void SetBookmarkBarState(BookmarkBar::State state, BookmarkBar::AnimateChangeType animate_type); // Get the current height of the bookmark bar. int GetHeight(); // Returns true if the bookmark bar is showing an animation. bool IsAnimating(); // ui::AnimationDelegate implementation -------------------------------------- virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; // MenuBarHelper::Delegate implementation ------------------------------------ virtual void PopupForButton(GtkWidget* button) OVERRIDE; virtual void PopupForButtonNextTo(GtkWidget* button, GtkMenuDirectionType dir) OVERRIDE; // BookmarkContextMenuController::Delegate implementation -------------------- virtual void CloseMenu() OVERRIDE; const ui::Animation* animation() { return &slide_animation_; } private: FRIEND_TEST_ALL_PREFIXES(BookmarkBarGtkUnittest, DisplaysHelpMessageOnEmpty); FRIEND_TEST_ALL_PREFIXES(BookmarkBarGtkUnittest, HidesHelpMessageWithBookmark); FRIEND_TEST_ALL_PREFIXES(BookmarkBarGtkUnittest, BuildsButtons); // Change the visibility of the bookmarks bar. (Starts out hidden, per GTK's // default behaviour). There are three visiblity states: // // Showing - bookmark bar is fully visible. // Hidden - bookmark bar is hidden except for a few pixels that give // extra padding to the bottom of the toolbar. Buttons are not // clickable. // Fullscreen - bookmark bar is fully hidden. void Show(BookmarkBar::State old_state, BookmarkBar::AnimateChangeType animate_type); void Hide(BookmarkBar::State old_state, BookmarkBar::AnimateChangeType animate_type); // Calculate maximum height of bookmark bar. void CalculateMaxHeight(); // Helper function which generates GtkToolItems for |bookmark_toolbar_|. void CreateAllBookmarkButtons(); // Sets the visibility of the instructional text based on whether there are // any bookmarks in the bookmark bar node. void SetInstructionState(); // Sets the visibility of the overflow chevron. void SetChevronState(); // Shows or hides the other bookmarks button depending on whether there are // bookmarks in it. void UpdateOtherBookmarksVisibility(); // Destroys all the bookmark buttons in the GtkToolbar. void RemoveAllButtons(); // Adds the "other bookmarks" and overflow buttons. void AddCoreButtons(); // Removes and recreates all buttons in the bar. void ResetButtons(); // Returns the number of buttons corresponding to starred urls/folders. This // is equivalent to the number of children the bookmark bar node from the // bookmark bar model has. int GetBookmarkButtonCount(); // Set the appearance of the overflow button appropriately (either chromium // style or GTK style). void SetOverflowButtonAppearance(); // Returns the index of the first bookmark that is not visible on the bar. // Returns -1 if they are all visible. // |extra_space| is how much extra space to give the toolbar during the // calculation (for the purposes of determining if ditching the chevron // would be a good idea). // If non-NULL, |showing_folders| will be packed with all the folders that are // showing on the bar. int GetFirstHiddenBookmark(int extra_space, std::vector<GtkWidget*>* showing_folders); // Update the detached state (either enable or disable it, or do nothing). void UpdateDetachedState(BookmarkBar::State old_state); // Turns on or off the app_paintable flag on |event_box_|, depending on our // state. void UpdateEventBoxPaintability(); // Queue a paint on the event box. void PaintEventBox(); // Finds the size of the current tab contents, if it exists and sets |size| // to the correct value. Returns false if there isn't a WebContents, a // condition that can happen during testing. bool GetTabContentsSize(gfx::Size* size); // Connects to the "size-allocate" signal on the given widget, and causes it // to throb after allocation. This is called when a new item is added to the // bar. We can't call StartThrobbing directly because we don't know if it's // visible or not until after the widget is allocated. void StartThrobbingAfterAllocation(GtkWidget* item); // Used by StartThrobbingAfterAllocation. CHROMEGTK_CALLBACK_1(BookmarkBarGtk, void, OnItemAllocate, GtkAllocation*); // Makes the appropriate widget on the bookmark bar stop throbbing // (a folder, the overflow chevron, or nothing). void StartThrobbing(const BookmarkNode* node); // Set |throbbing_widget_| to |widget|. Also makes sure that // |throbbing_widget_| doesn't become stale. void SetThrobbingWidget(GtkWidget* widget); // An item has been dragged over the toolbar, update the drag context // and toolbar UI appropriately. gboolean ItemDraggedOverToolbar( GdkDragContext* context, int index, guint time); // When dragging in the middle of a folder, assume the user wants to drop // on the folder. Towards the edges, assume the user wants to drop on the // toolbar. This makes it possible to drop between two folders. This function // returns the index on the toolbar the drag should target, or -1 if the // drag should hit the folder. int GetToolbarIndexForDragOverFolder(GtkWidget* button, gint x); void ClearToolbarDropHighlighting(); // Overridden from BookmarkModelObserver: // Invoked when the bookmark model has finished loading. Creates a button // for each of the children of the root node from the model. virtual void Loaded(BookmarkModel* model, bool ids_reassigned) OVERRIDE; // Invoked when the model is being deleted. virtual void BookmarkModelBeingDeleted(BookmarkModel* model) OVERRIDE; // Invoked when a node has moved. virtual void BookmarkNodeMoved(BookmarkModel* model, const BookmarkNode* old_parent, int old_index, const BookmarkNode* new_parent, int new_index) OVERRIDE; virtual void BookmarkNodeAdded(BookmarkModel* model, const BookmarkNode* parent, int index) OVERRIDE; virtual void BookmarkNodeRemoved(BookmarkModel* model, const BookmarkNode* parent, int old_index, const BookmarkNode* node) OVERRIDE; virtual void BookmarkNodeChanged(BookmarkModel* model, const BookmarkNode* node) OVERRIDE; // Invoked when a favicon has finished loading. virtual void BookmarkNodeFaviconChanged(BookmarkModel* model, const BookmarkNode* node) OVERRIDE; virtual void BookmarkNodeChildrenReordered(BookmarkModel* model, const BookmarkNode* node) OVERRIDE; // Overridden from content::NotificationObserver: virtual void Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) OVERRIDE; GtkWidget* CreateBookmarkButton(const BookmarkNode* node); GtkToolItem* CreateBookmarkToolItem(const BookmarkNode* node); void ConnectFolderButtonEvents(GtkWidget* widget, bool is_tool_item); // Finds the BookmarkNode from the model associated with |button|. const BookmarkNode* GetNodeForToolButton(GtkWidget* button); // Creates and displays a popup menu for BookmarkNode |node|. void PopupMenuForNode(GtkWidget* sender, const BookmarkNode* node, GdkEventButton* event); // GtkButton callbacks. CHROMEGTK_CALLBACK_1(BookmarkBarGtk, gboolean, OnButtonPressed, GdkEventButton*); CHROMEGTK_CALLBACK_0(BookmarkBarGtk, void, OnClicked); CHROMEGTK_CALLBACK_1(BookmarkBarGtk, void, OnButtonDragBegin, GdkDragContext*); CHROMEGTK_CALLBACK_1(BookmarkBarGtk, void, OnButtonDragEnd, GdkDragContext*); CHROMEGTK_CALLBACK_4(BookmarkBarGtk, void, OnButtonDragGet, GdkDragContext*, GtkSelectionData*, guint, guint); // GtkButton callbacks for folder buttons. CHROMEGTK_CALLBACK_0(BookmarkBarGtk, void, OnFolderClicked); // GtkToolbar callbacks. CHROMEGTK_CALLBACK_4(BookmarkBarGtk, gboolean, OnToolbarDragMotion, GdkDragContext*, gint, gint, guint); CHROMEGTK_CALLBACK_1(BookmarkBarGtk, void, OnToolbarSizeAllocate, GtkAllocation*); // Used for both folder buttons and the toolbar. CHROMEGTK_CALLBACK_6(BookmarkBarGtk, void, OnDragReceived, GdkDragContext*, gint, gint, GtkSelectionData*, guint, guint); CHROMEGTK_CALLBACK_2(BookmarkBarGtk, void, OnDragLeave, GdkDragContext*, guint); // Used for folder buttons. CHROMEGTK_CALLBACK_4(BookmarkBarGtk, gboolean, OnFolderDragMotion, GdkDragContext*, gint, gint, guint); // GtkEventBox callbacks. CHROMEGTK_CALLBACK_1(BookmarkBarGtk, gboolean, OnEventBoxExpose, GdkEventExpose*); CHROMEGTK_CALLBACK_0(BookmarkBarGtk, void, OnEventBoxDestroy); // Callbacks on our parent widget. CHROMEGTK_CALLBACK_1(BookmarkBarGtk, void, OnParentSizeAllocate, GtkAllocation*); // |throbbing_widget_| callback. CHROMEGTK_CALLBACK_0(BookmarkBarGtk, void, OnThrobbingWidgetDestroy); // Overriden from BookmarkBarInstructionsGtk::Delegate. virtual void ShowImportDialog() OVERRIDE; // Updates the drag&drop state when |edit_bookmarks_enabled_| changes. void OnEditBookmarksEnabledChanged(); // Used for opening urls. content::PageNavigator* page_navigator_; Browser* browser_; BrowserWindowGtk* window_; // Provides us with the offset into the background theme image. TabstripOriginProvider* tabstrip_origin_provider_; // Model providing details as to the starred entries/folders that should be // shown. This is owned by the Profile. BookmarkModel* model_; // Contains |bookmark_hbox_|. Event box exists to prevent leakage of // background color from the toplevel application window's GDK window. ui::OwnedWidgetGtk event_box_; // Used to detached the bookmark bar when on the NTP. GtkWidget* ntp_padding_box_; // Used to paint the background of the bookmark bar when in detached mode. GtkWidget* paint_box_; // Used to position all children. GtkWidget* bookmark_hbox_; // Alignment widget that is visible if there are no bookmarks on // the bookmar bar. GtkWidget* instructions_; // BookmarkBarInstructionsGtk that holds the label and the link for importing // bookmarks when there are no bookmarks on the bookmark bar. scoped_ptr<BookmarkBarInstructionsGtk> instructions_gtk_; // GtkToolbar which contains all the bookmark buttons. ui::OwnedWidgetGtk bookmark_toolbar_; // The button that shows extra bookmarks that don't fit on the bookmark // bar. GtkWidget* overflow_button_; // A separator between the main bookmark bar area and // |other_bookmarks_button_|. GtkWidget* other_bookmarks_separator_; // The other bookmarks button. GtkWidget* other_bookmarks_button_; // Padding for the other bookmarks button. GtkWidget* other_padding_; // The BookmarkNode from the model being dragged. NULL when we aren't // dragging. const BookmarkNode* dragged_node_; // The visual representation that follows the cursor during drags. GtkWidget* drag_icon_; // We create a GtkToolbarItem from |dragged_node_| ;or display. GtkToolItem* toolbar_drop_item_; // Theme provider for building buttons. GtkThemeService* theme_service_; // Whether we should show the instructional text in the bookmark bar. bool show_instructions_; MenuBarHelper menu_bar_helper_; // The last displayed right click menu, or NULL if no menus have been // displayed yet. // The controller. scoped_ptr<BookmarkContextMenuController> current_context_menu_controller_; // The view. scoped_ptr<MenuGtk> current_context_menu_; // The last displayed left click menu, or NULL if no menus have been // displayed yet. scoped_ptr<BookmarkMenuController> current_menu_; ui::SlideAnimation slide_animation_; // Used to optimize out |bookmark_toolbar_| size-allocate events we don't // need to respond to. int last_allocation_width_; content::NotificationRegistrar registrar_; // The size of the tab contents last time we forced a paint. We keep track // of this so we don't force too many paints. gfx::Size last_tab_contents_size_; // The last coordinates recorded by OnButtonPress; used to line up the // drag icon during bookmark drags. gfx::Point last_pressed_coordinates_; // The currently throbbing widget. This is NULL if no widget is throbbing. // We track it because we only want to allow one widget to throb at a time. GtkWidget* throbbing_widget_; // Tracks whether bookmarks can be modified. BooleanPrefMember edit_bookmarks_enabled_; base::WeakPtrFactory<BookmarkBarGtk> weak_factory_; BookmarkBar::State bookmark_bar_state_; // Maximum height of the bookmark bar. int max_height_; DISALLOW_COPY_AND_ASSIGN(BookmarkBarGtk); }; #endif // CHROME_BROWSER_UI_GTK_BOOKMARKS_BOOKMARK_BAR_GTK_H_
{ "content_hash": "f13da9c9ab4ee635ee813b843fb88d0d", "timestamp": "", "source": "github", "line_count": 382, "max_line_length": 80, "avg_line_length": 38.86649214659686, "alnum_prop": 0.6998720280191284, "repo_name": "keishi/chromium", "id": "5fb88cfe46a169e9b612fc7fa0f760d96654ed21", "size": "16111", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.h", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "ASP", "bytes": "853" }, { "name": "Arduino", "bytes": "464" }, { "name": "Assembly", "bytes": "1172794" }, { "name": "C", "bytes": "67452317" }, { "name": "C#", "bytes": "1132" }, { "name": "C++", "bytes": "132681259" }, { "name": "F#", "bytes": "381" }, { "name": "Go", "bytes": "19048" }, { "name": "Java", "bytes": "361412" }, { "name": "JavaScript", "bytes": "16603687" }, { "name": "Objective-C", "bytes": "9609581" }, { "name": "PHP", "bytes": "97796" }, { "name": "Perl", "bytes": "918683" }, { "name": "Python", "bytes": "6407891" }, { "name": "R", "bytes": "524" }, { "name": "Shell", "bytes": "4192593" }, { "name": "Tcl", "bytes": "277077" } ], "symlink_target": "" }
<?php if (!class_exists('Aws\Sqs\SqsClient')) { //include the AWS auto-loader, because the weird namespacing doesn't play nice //with Magentos auto-loader. require 'AWSSDKforPHP/aws.phar'; } //use the namespaces we need use Aws\Sqs\SqsClient; /** * The Amazon SQS queue adaptor * * @category Lilmuckers * @package Lilmuckers_Queue * @author Patrick McKinley <contact@patrick-mckinley.com> * @license MIT http://choosealicense.com/licenses/mit/ * @link https://github.com/lilmuckers/magento-lilmuckers_queue */ class Lilmuckers_Queue_Model_Adapter_Amazon extends Lilmuckers_Queue_Model_Adapter_Abstract { /** * Constant for the path to the amazon sqs config */ const AMAZONSQS_CONFIG = 'global/queue/amazonsqs/connection'; /** * The SQS Client object * * @var Aws\Sqs\SqsClient */ protected $_sqsClient; /** * A cache of queue URLs * * @var array */ protected $_queueUrls = array(); /** * A map for our variables to the queue attributes * * @var array */ protected $_queueAttrMap = array( 'ttr' => 'VisibilityTimeout', 'delay' => 'DelaySeconds', 'max_size' => 'MaximumMessageSize', 'wait' => 'ReceiveMessageWaitTimeSeconds' ); /** * The default attributes to start queues with * * @var array */ protected $_queueDefaultAttr; /** * Get the Aws Client instance * * @return Aws\Sqs\SqsClient */ public function getConnection() { //we have a stored connection if (!$this->_sqsClient) { $_config = $this->_getConfiguration(); $this->_sqsClient = new SqsClient( array( 'credentials' => [ 'key' => $_config['key'], 'secret' => $_config['secret'], ], 'region' => $_config['region'], 'version' => $_config['version'] ?? 'latest' ) ); } return $this->_sqsClient; } /** * Instantiate the connection * * @return Lilmuckers_Queue_Model_Adapter_Abstract */ protected function _loadConnection() { $this->getConnection(); return $this; } /** * Get the amazonsqs connection configuration * * @param string $value Value to retrieve from config * * @return array */ protected function _getConfiguration($value = null) { //load the config from the local.xml and array it $_config = Mage::getConfig()->getNode(self::AMAZONSQS_CONFIG); $_config = $_config->asArray(); //return the requested value if isset if (!is_null($value) && array_key_exists($value, $_config)) { return $_config[$value]; } return $_config; } /** * Add the task to the queue * * @param string $queue The queue to use * @param Lilmuckers_Queue_Model_Queue_Task $task The task to assign * * @return Lilmuckers_Queue_Model_Adapter_Amazon */ protected function _addToQueue($queue, Lilmuckers_Queue_Model_Queue_Task $task) { //load the default prioriy, delay and ttr data $_delay = is_null($task->getDelay()) ? null : $task->getDelay(); //load the json string for the task $_data = $task->exportData(); //get the queue url for this task $_queueUrl = $this->_getQueueUrl($queue); //start building the task parameters $_params = array( 'QueueUrl' => $_queueUrl, 'MessageBody' => $_data, ); //if delay was specified: if ($_delay) { $_params['DelaySeconds'] = $_delay; } //send this data to the amazon sqs server $this->getConnection() ->sendMessage($_params); return $this; } /** * Get the Amazon SQS Queue URL for an identifier * * @param string $queue The identifier for the queue * * @return string */ protected function _getQueueUrl($queue) { //check if we know this data... if (!array_key_exists($queue, $this->_queueUrls)) { //build queue parameters $_queueParams = array( 'QueueName' => $queue, ); //Append the additional queue parameters if applicable if ($_queueAttr = $this->_getDefaultQueueAttr()) { $_queueParams['Attributes'] = $_queueAttr; } //create the queue $_result = $this->getConnection()->createQueue($_queueParams); //get the queue url $this->_queueUrls[$queue] = $_result->get('QueueUrl'); } return $this->_queueUrls[$queue]; } /** * Build an array of additional data * * @return array|bool */ protected function _getDefaultQueueAttr() { if (!$this->_queueDefaultAttr) { $_config = $this->_getConfiguration(); //instantiate the array first of all $this->_queueDefaultAttr = array(); //iterate through the config, and map applicable values foreach ($_config as $_key => $_value) { if (array_key_exists($_key, $this->_queueAttrMap)) { $this->_queueDefaultAttr[$this->_queueAttrMap[$_key]] = $_value; } } } //if there's nothing, return a false if (empty($this->_queueDefaultAttr)) { return false; } //otherwise return the data return $this->_queueDefaultAttr; } /** * Get the next task from the queue in question * * @param string $queue The queue to reserve from * * @return Lilmuckers_Queue_Model_Queue_Task */ protected function _reserveFromQueue($queue) { //get the queue url we're interested in $_queueUrl = $this->_getQueueUrl($queue); //get the amazonsqs job $_job = $this->getConnection() ->receiveMessage( array( 'QueueUrl' => $_queueUrl, 'AttributeNames' => array( 'All' ) ) ); return $this->_prepareJob($_job, $queue); } /** * Get the next task from the queues in question * * @param array $queues The queues to reserve from * * @return Lilmuckers_Queue_Model_Queue_Task * * @throws Lilmuckers_Queue_Model_Adapter_Timeout_Exception When the connection times out */ protected function _reserveFromQueues($queues) { //iterate through all the queues in turn foreach ($queues as $_queue) { try { $_task = $this->_reserveFromQueue($_queue); } catch (Lilmuckers_Queue_Model_Adapter_Timeout_Exception $e) { //ignore this exception and skip to the next queue continue; } return $_task; } //throw a timeout exception throw new Lilmuckers_Queue_Model_Adapter_Timeout_Exception( 'Timeout watching queue, no job delivered in time limit' ); } /** * Prepare the amazonsqs job for the module as a task * * @param Aws\Result $job The AmazonSQS job * @param string $queue The queue identifier * * @return Lilmuckers_Queue_Model_Queue_Task * * @throws Lilmuckers_Queue_Model_Adapter_Timeout_Exception When the connection times out */ protected function _prepareJob(Aws\Result $job, $queue) { //if there's a timeout instead of a job then throw the timeout exception if (!$job->get('Messages')) { throw new Lilmuckers_Queue_Model_Adapter_Timeout_Exception( 'Timeout watching queue, no job delivered in time limit' ); } //pull off the only thing we're interested in - the first message $_messages = array_values($job->get('Messages')); //PHP 7 fix $_job = array_shift($_messages); //set the queue $_job['Queue'] = $queue; //instantiate the task $_task = Mage::getModel(Lilmuckers_Queue_Helper_Data::TASK_HANDLER); $_task->setJob($_job); //ensure the json data is set to the job $_task->importData($_job['Body']); //get the json data from the job return $_task; } /** * Touch the task to keep it reserved * * @param Lilmuckers_Queue_Model_Queue_Task $task The task to renew * * @return Lilmuckers_Queue_Model_Adapter_Amazon */ protected function _touch(Lilmuckers_Queue_Model_Queue_Task $task) { //get the pheanstalk job $_job = $task->getJob(); //keep the job reserved $this->getConnection() ->changeMessageVisibility( array( 'QueueUrl' => $this->_getQueueUrl($_job['Queue']), 'ReceiptHandle' => $_job['ReceiptHandle'], 'VisibilityTimeout' => $this->_getConfiguration('ttr') ) ); return $this; } /** * Remove a task from the queue * * @param Lilmuckers_Queue_Model_Queue_Abstract $queue The queue handler to use * @param Lilmuckers_Queue_Model_Queue_Task $task The task to remove * * @return Lilmuckers_Queue_Model_Adapter_Amazon */ protected function _remove( Lilmuckers_Queue_Model_Queue_Abstract $queue, Lilmuckers_Queue_Model_Queue_Task $task ) { //get the pheanstalk job $_job = $task->getJob(); //keep the job reserved $this->getConnection() ->deleteMessage( array( 'QueueUrl' => $this->_getQueueUrl($_job['Queue']), 'ReceiptHandle' => $_job['ReceiptHandle'] ) ); return $this; } /** * AmazonSQS can't hold messages * * @param Lilmuckers_Queue_Model_Queue_Abstract $queue The queue handler to use * @param Lilmuckers_Queue_Model_Queue_Task $task The task to hold * * @TODO Enable some form of message holding * * @return Lilmuckers_Queue_Model_Adapter_Amazon */ protected function _hold( Lilmuckers_Queue_Model_Queue_Abstract $queue, Lilmuckers_Queue_Model_Queue_Task $task ) { return $this; } /** * AmazonSQS can't hold messages * * @param Lilmuckers_Queue_Model_Queue_Abstract $queue The queue handler to use * @param Lilmuckers_Queue_Model_Queue_Task $task The task to unhold * * @TODO Enable some form of message unholding * * @return Lilmuckers_Queue_Model_Adapter_Amazon */ protected function _unhold( Lilmuckers_Queue_Model_Queue_Abstract $queue, Lilmuckers_Queue_Model_Queue_Task $task ) { return $this; } /** * AmazonSQS can't hold messages * * @param int $number The number of held tasks to kick * @param Lilmuckers_Queue_Model_Queue_Abstract $queue The queue to kick from * * @TODO Enable some form of multiple message unholding * * @return Lilmuckers_Queue_Model_Adapter_Abstract */ public function _unholdMultiple( $number, Lilmuckers_Queue_Model_Queue_Abstract $queue = null ) { return $this; } /** * Requeue a task - not explicitly supported so just let the ttr lapse * * @param Lilmuckers_Queue_Model_Queue_Abstract $queue The queue handler to use * @param Lilmuckers_Queue_Model_Queue_Task $task The task to retry * * @return Lilmuckers_Queue_Model_Adapter_Amazon */ protected function _retry( Lilmuckers_Queue_Model_Queue_Abstract $queue, Lilmuckers_Queue_Model_Queue_Task $task ) { //instead of explicitly setting an item to retry - let it timeout return $this; } /** * Get the job status for a given job * * @param Lilmuckers_Queue_Model_Queue_Task $task The task to map data for * * @return array */ protected function _getMappedTaskData(Lilmuckers_Queue_Model_Queue_Task $task) { //get the pheanstalk job $_job = $task->getJob(); return $this->_mapJobStatToTaskInfo($_job); } /** * Map the AmazonSQS data response to the task info for * the Lilmuckers_Queue module * * @param array $stats The stats response to map * * @return array */ protected function _mapJobStatToTaskInfo(array $stats) { $_data = array( 'queue' => $stats['Queue'], 'age' => time() - $stats['Attributes']['SentTimestamp'], 'ttr' => $this->_getConfiguration('ttr'), 'reserves' => $stats['Attributes']['ApproximateReceiveCount'], ); return $_data; } /** * AmazonSQS doesn't support this * * @param Lilmuckers_Queue_Model_Queue_Abstract $queue Queue to peek at * * @return Lilmuckers_Queue_Model_Queue_Task */ protected function _getUnreservedTask(Lilmuckers_Queue_Model_Queue_Abstract $queue) { //turn it into a task return $this->_dummyTask(); } /** * Amazon SQS doesn't support this * * @param Lilmuckers_Queue_Model_Queue_Abstract $queue Queue to peek at * * @return Lilmuckers_Queue_Model_Queue_Task */ protected function _getUnreservedDelayedTask( Lilmuckers_Queue_Model_Queue_Abstract $queue ) { //turn it into a task return $this->_dummyTask(); } /** * AmazonSQS doesn't support this * * @param Lilmuckers_Queue_Model_Queue_Abstract $queue Queue to peek at * * @return Lilmuckers_Queue_Model_Queue_Task */ protected function _getUnreservedHeldTask( Lilmuckers_Queue_Model_Queue_Abstract $queue ) { //turn it into a task return $this->_dummyTask(); } /** * Return a dummy task * * @return Lilmuckers_Queue_Model_Queue_Task */ protected function _dummyTask() { return Mage::getModel(Lilmuckers_Queue_Helper_Data::TASK_HANDLER); } }
{ "content_hash": "b67e7172212bc3f930ae38e8560aa942", "timestamp": "", "source": "github", "line_count": 522, "max_line_length": 93, "avg_line_length": 27.988505747126435, "alnum_prop": 0.5566735112936345, "repo_name": "lilmuckers/magento-lilmuckers_queue", "id": "ae1affc54f7d331db834d80b8be7a89598421edc", "size": "14867", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/code/community/Lilmuckers/Queue/Model/Adapter/Amazon.php", "mode": "33188", "license": "mit", "language": [ { "name": "PHP", "bytes": "206505" } ], "symlink_target": "" }
declare namespace mockjs { type N = number; type S = string; type B = boolean; // Interface for global namespace 'Mockjs' interface Mockjs { mock: MockjsMock; setup: MockjsSetup; Random: MockjsRandom; valid: MockjsValid; toJSONSchema: MockjsToJSONSchema; version: number; } // Mockjs.mock() // see https://github.com/nuysoft/Mock/wiki/Mock.mock() interface MockjsMock { (rurl: S | RegExp, rtype: S, template: any): Mockjs; (rurl: S | RegExp, template: any): Mockjs; (template: any): any; } interface MockjsSetupSettings { timeout?: number | S; } // Mockjs.setup() // see https://github.com/nuysoft/Mock/wiki/Mock.setup() type MockjsSetup = (settings: MockjsSetupSettings) => void; // Mockjs.Random - Basic // see https://github.com/nuysoft/Mock/wiki/Basic interface MockjsRandomBasic { // Random.boolean boolean(min: N, max: N, current: B): B; boolean(): B; // Random.natural natural(min?: N, max?: N): N; // Random.integer integer(min?: N, max?: N): N; // Random.float float(min?: N, max?: N, dmin?: N, dmax?: N): N; // Random.character character(pool: 'lower' | 'upper' | 'number' | 'symbol'): S; character(pool?: S): S; // Random.string string(pool?: S | N, min?: N, max?: N): S; // Random.range range(start?: N, stop?: N, step?: N): N; } // Mockjs.Random - Date // see https://github.com/nuysoft/Mock/wiki/Date type RandomDateUtilString = 'year' | 'month' | 'week' | 'day' | 'hour' | 'minute' | 'second' | 'week'; interface MockjsRandomDate { // Random.date date(format?: S): S; // Random.time time(format?: S): S; // Random.datetime datetime(format?: S): S; // Random.now now(util: RandomDateUtilString, format?: S): S; mow(format?: S): S; } // Mockjs.Random - Image // see https://github.com/nuysoft/Mock/wiki/Image type RandomImageFormatString = 'png' | 'gif' | 'jpg'; interface MockjsRandomImage { // Random.image image(size?: S, background?: S, foreground?: S, format?: RandomImageFormatString | S, text?: S): S; // Random.dataImage dataImage(size?: S, text?: S): S; } // Mockjs.Random - Color // see https://github.com/nuysoft/Mock/wiki/Color interface MockjsRandomColor { // Random.color color(): S; // Random.hex hex(): S; // Random.rgb rgb(): S; // Random.rgba rgba(): S; // Random.hsl hsl(): S; } // Mockjs.Random - Text // see https://github.com/nuysoft/Mock/wiki/Text interface MockjsRandomText { // Random.paragraph paragraph(min?: N, max?: N): S; // Random.cparagraph cparagraph(min?: N, max?: N): S; // Random.sentence sentence(min?: N, max?: N): S; // Random.csentence csentence(min?: N, max?: N): S; // Random.word word(min?: N, max?: N): S; // Random.cword cword(pool?: S | N, min?: N, max?: N): S; // Random.title title(min?: N, max?: N): S; // Random.ctitle ctitle(min?: N, max?: N): S; } // Mockjs.Random - Name // see https://github.com/nuysoft/Mock/wiki/Name interface MockjsRandomName { // Random.first first(): S; // Random.last last(): S; // Random.name name(middle?: B): S; // Random.cfirst cfirst(): S; // Random.clast clast(): S; // Random.cname cname(): S; } // Mockjs.Random - Web // see https://github.com/nuysoft/Mock/wiki/Web type RandomWebProtocal = 'http' | 'ftp' | 'gopher' | 'mailto' | 'mid' | 'cid' | 'news' | 'nntp' | 'prospero' | 'telnet' | 'rlogin' | 'tn3270' | 'wais'; interface MockjsRandomWeb { // Random.url url(protocol?: S, host?: S): S; // Random.protocol protocal(): RandomWebProtocal; // Random.domain domain(): S; // Random.tld dtl(): S; // Random.email email(domain?: S): S; // Random.ip ip(): S; } // Mockjs.Random - Address // see https://github.com/nuysoft/Mock/wiki/Address interface MockjsRandomAddress { // Random.region region(): S; // Random.province province(): S; // Random.city city(prefix?: B): S; // Random.county country(prefix?: B): S; // Random.zip zip(prefix?: B): S; } // Mockjs.Random - Helper // see https://github.com/nuysoft/Mock/wiki/Helper interface MockjsRandomHelper { // Random.capitalize capitalize(word: S): S; // Random.upper upper(str: S): S; // Random.lower lower(str: S): S; // Random.pick pick(arr: any[]): any; // Random.shuffle shuffle(arr: any[]): any[]; } // Mockjs.Random - Miscellaneous // see https://github.com/nuysoft/Mock/wiki/Miscellaneous interface MockjsRandomMiscellaneous { // Random.guid guid(): S; // Random.id id(): S; // Random.increment increment(step?: N): N; } // Mockjs.Random // see https://github.com/nuysoft/Mock/wiki/Mock.Random interface MockjsRandom extends MockjsRandomBasic, MockjsRandomDate, MockjsRandomImage, MockjsRandomColor, MockjsRandomAddress, MockjsRandomHelper, MockjsRandomMiscellaneous, MockjsRandomName, MockjsRandomText, MockjsRandomWeb { } interface MockjsValidRsItem { action: S; actual: S; expected: S; message: S; path: S[]; type: S; } // Mockjs.valid() // see https://github.com/nuysoft/Mock/wiki/Mock.valid() type MockjsValid = (template: any, data: any) => MockjsValidRsItem[]; interface MockjsToJSONSchemaRs { name: S | undefined; template: any; type: S; rule: object; path: S[]; properties?: MockjsToJSONSchemaRs[]; items?: MockjsToJSONSchemaRs[]; } // Mockjs.toJSONSchema() // see https://github.com/nuysoft/Mock/wiki/Mock.toJSONSchema() type MockjsToJSONSchema = (template: any) => MockjsToJSONSchemaRs; let mock: MockjsMock; let setup: MockjsSetup; let Random: MockjsRandom; let valid: MockjsValid; let toJSONSchema: MockjsToJSONSchema; let version: number; } export = mockjs;
{ "content_hash": "27fbb7c8c49e36f6b4878f8aa97bb1a9", "timestamp": "", "source": "github", "line_count": 275, "max_line_length": 153, "avg_line_length": 22.061818181818182, "alnum_prop": 0.6034283830558761, "repo_name": "aaronryden/DefinitelyTyped", "id": "9be645b791288dbe8e210dfa7921b31db2c12608", "size": "6282", "binary": false, "copies": "11", "ref": "refs/heads/master", "path": "types/mockjs/index.d.ts", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
 FCKConfig.CustomConfigurationsPath = '' ; FCKConfig.EditorAreaCSS = FCKConfig.BasePath + 'css/fck_editorarea.css' ; FCKConfig.EditorAreaStyles = '' ; FCKConfig.ToolbarComboPreviewCSS = '' ; FCKConfig.DocType = '' ; FCKConfig.BaseHref = '' ; FCKConfig.FullPage = false ; // The following option determines whether the "Show Blocks" feature is enabled or not at startup. FCKConfig.StartupShowBlocks = false ; FCKConfig.Debug = false ; FCKConfig.AllowQueryStringDebug = true ; FCKConfig.SkinPath = FCKConfig.BasePath + 'skins/default/' ; FCKConfig.SkinEditorCSS = '' ; // FCKConfig.SkinPath + "|<minified css>" ; FCKConfig.SkinDialogCSS = '' ; // FCKConfig.SkinPath + "|<minified css>" ; FCKConfig.PreloadImages = [ FCKConfig.SkinPath + 'images/toolbar.start.gif', FCKConfig.SkinPath + 'images/toolbar.buttonarrow.gif' ] ; FCKConfig.PluginsPath = FCKConfig.BasePath + 'plugins/' ; // FCKConfig.Plugins.Add( 'autogrow' ) ; // FCKConfig.Plugins.Add( 'dragresizetable' ); FCKConfig.AutoGrowMax = 400 ; // FCKConfig.ProtectedSource.Add( /<%[\s\S]*?%>/g ) ; // ASP style server side code <%...%> // FCKConfig.ProtectedSource.Add( /<\?[\s\S]*?\?>/g ) ; // PHP style server side code // FCKConfig.ProtectedSource.Add( /(<asp:[^\>]+>[\s|\S]*?<\/asp:[^\>]+>)|(<asp:[^\>]+\/>)/gi ) ; // ASP.Net style tags <asp:control> FCKConfig.AutoDetectLanguage = true ; FCKConfig.DefaultLanguage = 'en' ; FCKConfig.ContentLangDirection = 'ltr' ; FCKConfig.ProcessHTMLEntities = true ; FCKConfig.IncludeLatinEntities = true ; FCKConfig.IncludeGreekEntities = true ; FCKConfig.ProcessNumericEntities = false ; FCKConfig.AdditionalNumericEntities = '' ; // Single Quote: "'" FCKConfig.FillEmptyBlocks = true ; FCKConfig.FormatSource = true ; FCKConfig.FormatOutput = true ; FCKConfig.FormatIndentator = ' ' ; FCKConfig.EMailProtection = 'encode' ; // none | encode | function FCKConfig.EMailProtectionFunction = 'mt(NAME,DOMAIN,SUBJECT,BODY)' ; FCKConfig.StartupFocus = false ; FCKConfig.ForcePasteAsPlainText = false ; FCKConfig.AutoDetectPasteFromWord = true ; // IE only. FCKConfig.ShowDropDialog = true ; FCKConfig.ForceSimpleAmpersand = false ; FCKConfig.TabSpaces = 0 ; FCKConfig.ShowBorders = true ; FCKConfig.SourcePopup = false ; FCKConfig.ToolbarStartExpanded = true ; FCKConfig.ToolbarCanCollapse = true ; FCKConfig.IgnoreEmptyParagraphValue = true ; FCKConfig.FloatingPanelsZIndex = 10000 ; FCKConfig.HtmlEncodeOutput = false ; FCKConfig.TemplateReplaceAll = true ; FCKConfig.TemplateReplaceCheckbox = true ; FCKConfig.ToolbarLocation = 'In' ; FCKConfig.ToolbarSets["Default"] = [ ['Source','DocProps','-','Save','NewPage','Preview','-','Templates'], ['Cut','Copy','Paste','PasteText','PasteWord','-','Print','SpellCheck'], ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'], '/', ['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'], ['OrderedList','UnorderedList','-','Outdent','Indent','Blockquote','CreateDiv'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'], ['Link','Unlink','Anchor'], ['Image','Flash','Table','Rule','Smiley','SpecialChar','PageBreak'], '/', ['Style','FontFormat','FontName','FontSize'], ['TextColor','BGColor'], ['FitWindow','ShowBlocks','-','About'] // No comma for the last row. ] ; FCKConfig.ToolbarSets["Basic"] = [ ['Bold','Italic','-','OrderedList','UnorderedList','-','Link','Unlink','-','About'] ] ; FCKConfig.EnterMode = 'p' ; // p | div | br FCKConfig.ShiftEnterMode = 'br' ; // p | div | br FCKConfig.Keystrokes = [ [ CTRL + 65 /*A*/, true ], [ CTRL + 67 /*C*/, true ], [ CTRL + 70 /*F*/, true ], [ CTRL + 83 /*S*/, true ], [ CTRL + 84 /*T*/, true ], [ CTRL + 88 /*X*/, true ], [ CTRL + 86 /*V*/, 'Paste' ], [ CTRL + 45 /*INS*/, true ], [ SHIFT + 45 /*INS*/, 'Paste' ], [ CTRL + 88 /*X*/, 'Cut' ], [ SHIFT + 46 /*DEL*/, 'Cut' ], [ CTRL + 90 /*Z*/, 'Undo' ], [ CTRL + 89 /*Y*/, 'Redo' ], [ CTRL + SHIFT + 90 /*Z*/, 'Redo' ], [ CTRL + 76 /*L*/, 'Link' ], [ CTRL + 66 /*B*/, 'Bold' ], [ CTRL + 73 /*I*/, 'Italic' ], [ CTRL + 85 /*U*/, 'Underline' ], [ CTRL + SHIFT + 83 /*S*/, 'Save' ], [ CTRL + ALT + 13 /*ENTER*/, 'FitWindow' ], [ SHIFT + 32 /*SPACE*/, 'Nbsp' ] ] ; FCKConfig.ContextMenu = ['Generic','Link','Anchor','Image','Flash','Select','Textarea','Checkbox','Radio','TextField','HiddenField','ImageButton','Button','BulletedList','NumberedList','Table','Form','DivContainer'] ; FCKConfig.BrowserContextMenuOnCtrl = false ; FCKConfig.BrowserContextMenu = false ; FCKConfig.EnableMoreFontColors = true ; FCKConfig.FontColors = '000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,808080,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF' ; FCKConfig.FontFormats = 'p;h1;h2;h3;h4;h5;h6;pre;address;div' ; FCKConfig.FontNames = 'Arial;Comic Sans MS;Courier New;Tahoma;Times New Roman;Verdana' ; FCKConfig.FontSizes = 'smaller;larger;xx-small;x-small;small;medium;large;x-large;xx-large' ; FCKConfig.StylesXmlPath = FCKConfig.EditorPath + 'fckstyles.xml' ; FCKConfig.TemplatesXmlPath = FCKConfig.EditorPath + 'fcktemplates.xml' ; FCKConfig.SpellChecker = 'ieSpell' ; // 'ieSpell' | 'SpellerPages' FCKConfig.IeSpellDownloadUrl = 'http://www.iespell.com/download.php' ; FCKConfig.SpellerPagesServerScript = 'server-scripts/spellchecker.php' ; // Available extension: .php .cfm .pl FCKConfig.FirefoxSpellChecker = false ; FCKConfig.MaxUndoLevels = 15 ; FCKConfig.DisableObjectResizing = false ; FCKConfig.DisableFFTableHandles = true ; FCKConfig.LinkDlgHideTarget = false ; FCKConfig.LinkDlgHideAdvanced = false ; FCKConfig.ImageDlgHideLink = false ; FCKConfig.ImageDlgHideAdvanced = false ; FCKConfig.FlashDlgHideAdvanced = false ; FCKConfig.ProtectedTags = '' ; // This will be applied to the body element of the editor FCKConfig.BodyId = '' ; FCKConfig.BodyClass = '' ; FCKConfig.DefaultStyleLabel = '' ; FCKConfig.DefaultFontFormatLabel = '' ; FCKConfig.DefaultFontLabel = '' ; FCKConfig.DefaultFontSizeLabel = '' ; FCKConfig.DefaultLinkTarget = '' ; // The option switches between trying to keep the html structure or do the changes so the content looks like it was in Word FCKConfig.CleanWordKeepsStructure = false ; // Only inline elements are valid. FCKConfig.RemoveFormatTags = 'b,big,code,del,dfn,em,font,i,ins,kbd,q,samp,small,span,strike,strong,sub,sup,tt,u,var' ; // Attributes that will be removed FCKConfig.RemoveAttributes = 'class,style,lang,width,height,align,hspace,valign' ; FCKConfig.CustomStyles = { 'Red Title' : { Element : 'h3', Styles : { 'color' : 'Red' } } }; // Do not add, rename or remove styles here. Only apply definition changes. FCKConfig.CoreStyles = { // Basic Inline Styles. 'Bold' : { Element : 'strong', Overrides : 'b' }, 'Italic' : { Element : 'em', Overrides : 'i' }, 'Underline' : { Element : 'u' }, 'StrikeThrough' : { Element : 'strike' }, 'Subscript' : { Element : 'sub' }, 'Superscript' : { Element : 'sup' }, // Basic Block Styles (Font Format Combo). 'p' : { Element : 'p' }, 'div' : { Element : 'div' }, 'pre' : { Element : 'pre' }, 'address' : { Element : 'address' }, 'h1' : { Element : 'h1' }, 'h2' : { Element : 'h2' }, 'h3' : { Element : 'h3' }, 'h4' : { Element : 'h4' }, 'h5' : { Element : 'h5' }, 'h6' : { Element : 'h6' }, // Other formatting features. 'FontFace' : { Element : 'span', Styles : { 'font-family' : '#("Font")' }, Overrides : [ { Element : 'font', Attributes : { 'face' : null } } ] }, 'Size' : { Element : 'span', Styles : { 'font-size' : '#("Size","fontSize")' }, Overrides : [ { Element : 'font', Attributes : { 'size' : null } } ] }, 'Color' : { Element : 'span', Styles : { 'color' : '#("Color","color")' }, Overrides : [ { Element : 'font', Attributes : { 'color' : null } } ] }, 'BackColor' : { Element : 'span', Styles : { 'background-color' : '#("Color","color")' } }, 'SelectionHighlight' : { Element : 'span', Styles : { 'background-color' : 'navy', 'color' : 'white' } } }; // The distance of an indentation step. FCKConfig.IndentLength = 40 ; FCKConfig.IndentUnit = 'px' ; // Alternatively, FCKeditor allows the use of CSS classes for block indentation. // This overrides the IndentLength/IndentUnit settings. FCKConfig.IndentClasses = [] ; // [ Left, Center, Right, Justified ] FCKConfig.JustifyClasses = [] ; // The following value defines which File Browser connector and Quick Upload // "uploader" to use. It is valid for the default implementaion and it is here // just to make this configuration file cleaner. // It is not possible to change this value using an external file or even // inline when creating the editor instance. In that cases you must set the // values of LinkBrowserURL, ImageBrowserURL and so on. // Custom implementations should just ignore it. var _FileBrowserLanguage = 'aspx' ; // asp | aspx | cfm | lasso | perl | php | py var _QuickUploadLanguage = 'aspx' ; // asp | aspx | cfm | lasso | perl | php | py // Don't care about the following two lines. It just calculates the correct connector // extension to use for the default File Browser (Perl uses "cgi"). var _FileBrowserExtension = _FileBrowserLanguage == 'perl' ? 'cgi' : _FileBrowserLanguage ; var _QuickUploadExtension = _QuickUploadLanguage == 'perl' ? 'cgi' : _QuickUploadLanguage ; FCKConfig.LinkBrowser = true ; FCKConfig.LinkBrowserURL = FCKConfig.BasePath + 'filemanager/browser/default/browser.html?Connector=' + encodeURIComponent( FCKConfig.BasePath + 'filemanager/connectors/' + _FileBrowserLanguage + '/connector.' + _FileBrowserExtension ) ; FCKConfig.LinkBrowserWindowWidth = FCKConfig.ScreenWidth * 0.7 ; // 70% FCKConfig.LinkBrowserWindowHeight = FCKConfig.ScreenHeight * 0.7 ; // 70% FCKConfig.ImageBrowser = true ; FCKConfig.ImageBrowserURL = FCKConfig.BasePath + 'filemanager/browser/default/browser.html?Type=Image&Connector=' + encodeURIComponent( FCKConfig.BasePath + 'filemanager/connectors/' + _FileBrowserLanguage + '/connector.' + _FileBrowserExtension ) ; FCKConfig.ImageBrowserWindowWidth = FCKConfig.ScreenWidth * 0.7 ; // 70% ; FCKConfig.ImageBrowserWindowHeight = FCKConfig.ScreenHeight * 0.7 ; // 70% ; FCKConfig.FlashBrowser = true ; FCKConfig.FlashBrowserURL = FCKConfig.BasePath + 'filemanager/browser/default/browser.html?Type=Flash&Connector=' + encodeURIComponent( FCKConfig.BasePath + 'filemanager/connectors/' + _FileBrowserLanguage + '/connector.' + _FileBrowserExtension ) ; FCKConfig.FlashBrowserWindowWidth = FCKConfig.ScreenWidth * 0.7 ; //70% ; FCKConfig.FlashBrowserWindowHeight = FCKConfig.ScreenHeight * 0.7 ; //70% ; FCKConfig.LinkUpload = true ; FCKConfig.LinkUploadURL = FCKConfig.BasePath + 'filemanager/connectors/' + _QuickUploadLanguage + '/upload.' + _QuickUploadExtension ; FCKConfig.LinkUploadAllowedExtensions = ".(7z|aiff|asf|avi|bmp|csv|doc|fla|flv|gif|gz|gzip|jpeg|jpg|mid|mov|mp3|mp4|mpc|mpeg|mpg|ods|odt|pdf|png|ppt|pxd|qt|ram|rar|rm|rmi|rmvb|rtf|sdc|sitd|swf|sxc|sxw|tar|tgz|tif|tiff|txt|vsd|wav|wma|wmv|xls|xml|zip)$" ; // empty for all FCKConfig.LinkUploadDeniedExtensions = "" ; // empty for no one FCKConfig.ImageUpload = true ; FCKConfig.ImageUploadURL = FCKConfig.BasePath + 'filemanager/connectors/' + _QuickUploadLanguage + '/upload.' + _QuickUploadExtension + '?Type=Image' ; FCKConfig.ImageUploadAllowedExtensions = ".(jpg|gif|jpeg|png|bmp)$" ; // empty for all FCKConfig.ImageUploadDeniedExtensions = "" ; // empty for no one FCKConfig.FlashUpload = true ; FCKConfig.FlashUploadURL = FCKConfig.BasePath + 'filemanager/connectors/' + _QuickUploadLanguage + '/upload.' + _QuickUploadExtension + '?Type=Flash' ; FCKConfig.FlashUploadAllowedExtensions = ".(swf|flv)$" ; // empty for all FCKConfig.FlashUploadDeniedExtensions = "" ; // empty for no one FCKConfig.SmileyPath = FCKConfig.BasePath + 'images/smiley/msn/' ; FCKConfig.SmileyImages = ['regular_smile.gif','sad_smile.gif','wink_smile.gif','teeth_smile.gif','confused_smile.gif','tounge_smile.gif','embaressed_smile.gif','omg_smile.gif','whatchutalkingabout_smile.gif','angry_smile.gif','angel_smile.gif','shades_smile.gif','devil_smile.gif','cry_smile.gif','lightbulb.gif','thumbs_down.gif','thumbs_up.gif','heart.gif','broken_heart.gif','kiss.gif','envelope.gif'] ; FCKConfig.SmileyColumns = 8 ; FCKConfig.SmileyWindowWidth = 320 ; FCKConfig.SmileyWindowHeight = 210 ; FCKConfig.BackgroundBlockerColor = '#ffffff' ; FCKConfig.BackgroundBlockerOpacity = 0.50 ; FCKConfig.MsWebBrowserControlCompat = false ; FCKConfig.PreventSubmitHandler = false ;
{ "content_hash": "17fd98b4643217100bb2bbc9573fe8e6", "timestamp": "", "source": "github", "line_count": 300, "max_line_length": 406, "avg_line_length": 42.39, "alnum_prop": 0.6963906581740976, "repo_name": "fwdfn/Test", "id": "3c3b7d1a2bb87b4d3c95e932cb3a2fd716d0da0b", "size": "13503", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "awst/艾维斯特/fckeditor/fckconfig.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ASP", "bytes": "156385" }, { "name": "C#", "bytes": "186832" }, { "name": "CSS", "bytes": "78657" }, { "name": "ColdFusion", "bytes": "5390" }, { "name": "HTML", "bytes": "307570" }, { "name": "JavaScript", "bytes": "610685" }, { "name": "PHP", "bytes": "5655" }, { "name": "Pascal", "bytes": "5735" }, { "name": "Perl", "bytes": "4746" }, { "name": "PowerShell", "bytes": "136433" } ], "symlink_target": "" }
alias echo='echo foo' BUFFER='echo bar' expected_region_highlight=( '1 4 alias' # echo '1 4 builtin' # echo '6 8 default' # bar )
{ "content_hash": "12b2998ac2fca977b8fd116ef0d94d08", "timestamp": "", "source": "github", "line_count": 9, "max_line_length": 27, "avg_line_length": 15.333333333333334, "alnum_prop": 0.6376811594202898, "repo_name": "codeprimate/arid", "id": "88ed3c8be89127448d5a059e2701976fd215b175", "size": "2150", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "zsh/zsh-syntax-highlighting/highlighters/main/test-data/alias-self.zsh", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "C", "bytes": "10691" }, { "name": "C++", "bytes": "1006" }, { "name": "CSS", "bytes": "4962" }, { "name": "CoffeeScript", "bytes": "1402" }, { "name": "Dockerfile", "bytes": "1126" }, { "name": "Erlang", "bytes": "10460" }, { "name": "HTML", "bytes": "6705" }, { "name": "JavaScript", "bytes": "9357" }, { "name": "Lua", "bytes": "436" }, { "name": "Makefile", "bytes": "31299" }, { "name": "Perl", "bytes": "51050" }, { "name": "Python", "bytes": "872670" }, { "name": "Roff", "bytes": "5000" }, { "name": "Ruby", "bytes": "129834" }, { "name": "Shell", "bytes": "1798938" }, { "name": "Smarty", "bytes": "318" }, { "name": "TeX", "bytes": "25888" }, { "name": "Vim Script", "bytes": "8338240" }, { "name": "Vim Snippet", "bytes": "597916" } ], "symlink_target": "" }
using System; using System.Collections; using System.Collections.Generic; using UnityEngine; namespace HoloLensModule.Input { // オブジェクトのサイズ public class ObjectScaleControl : MonoBehaviour { [Range(0.1f, 10.0f)] public float SizeScale = 1.0f; public float MinSize = 0.001f; private float deltadistace; private DragGestureEvent dragevent; void Start() { dragevent = gameObject.AddComponent<DragGestureEvent>(); dragevent.ActionState = HandsGestureManager.HandGestureState.MultiDrag; dragevent.DragStartActionEvent.AddListener(GestureStart); dragevent.DragUpdateActionEvent.AddListener(GestureUpdate); } void OnDestroy() { dragevent.DragStartActionEvent.RemoveListener(GestureStart); dragevent.DragUpdateActionEvent.RemoveListener(GestureUpdate); } public void GestureStart(Vector3 pos1, Vector3? pos2) { deltadistace = Vector3.Distance(pos1, pos2.Value); } public void GestureUpdate(Vector3 pos1, Vector3? pos2) { float deltamove = SizeScale * (Vector3.Distance(pos1, pos2.Value) - deltadistace); if (deltamove > 0) deltamove = 1.0f + deltamove; else deltamove = 1.0f / (1.0f - deltamove); float min = transform.localScale.x * deltamove; if (transform.localScale.y * deltamove < min) min = transform.localScale.y * deltamove; if (transform.localScale.z * deltamove < min) min = transform.localScale.z * deltamove; if (min > MinSize) transform.localScale *= deltamove; deltadistace = Vector3.Distance(pos1, pos2.Value); } } }
{ "content_hash": "494c3507f6ecef822e23caeeb5ea995e", "timestamp": "", "source": "github", "line_count": 45, "max_line_length": 116, "avg_line_length": 38.51111111111111, "alnum_prop": 0.6491633006347375, "repo_name": "akihiro0105/MixedPresentation", "id": "2114b6728aa71314dad401655889cf926e293658", "size": "1755", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Assets/HoloLensModule/Input/Scripts/ObjectScaleControl.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "118628" } ], "symlink_target": "" }
package csci599; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import java.io.*; import java.util.*; public class JSONGenerator { static ObjectMapper mapper = new ObjectMapper(); // This assumes that fingerprint and correlationStrengths have the same keys. public static void generateJSON(String filePath,HashMap<String,ArrayList<Double>> fingerprint,HashMap<String,ArrayList<Double>> correlationStrengths) { Map<String, BFAFingerprint> json = new HashMap<>(); for (String mime : fingerprint.keySet()) { BFAFingerprint jsonFingerprint= new BFAFingerprint(); jsonFingerprint.BFD = fingerprint.get(mime); jsonFingerprint.CS = correlationStrengths.get(mime); json.put(mime, jsonFingerprint); } try { mapper.writeValue(new File(filePath), json); } catch (IOException ex) { System.out.println("Error writing BFA JSON file."); } } public static HashMap<String, BFAFingerprint> readJSON(String filePath) throws IOException { return mapper.readValue(new File(filePath), new TypeReference<Map<String, BFAFingerprint>>() { } ); } }
{ "content_hash": "71517f5766f3fb3f940f11443e13c427", "timestamp": "", "source": "github", "line_count": 31, "max_line_length": 155, "avg_line_length": 40.935483870967744, "alnum_prop": 0.6729708431836091, "repo_name": "usc-cs599-group5/mime-diversity", "id": "2c5fb56e3bf2935cda37fc322cbbc1ef58fa8b02", "size": "1269", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/main/java/csci599/JSONGenerator.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "67415685" }, { "name": "Java", "bytes": "49122" }, { "name": "TeX", "bytes": "225276" } ], "symlink_target": "" }
import zlib import cPickle import sqlite3 try: from cyordereddict import OrderedDict except: from collections import OrderedDict def pack_blob(obj): return sqlite3.Binary(zdumps(obj)) def unpack_genotype_blob(blob): return cPickle.loads(zlib.decompress(blob)) def unpack_ordereddict_blob(blob): blob_val = cPickle.loads(zlib.decompress(blob)) if blob_val is not None: return OrderedDict(blob_val) return None def zdumps(obj): return zlib.compress(cPickle.dumps(obj, cPickle.HIGHEST_PROTOCOL), 9) def zloads(obj): return cPickle.loads(zlib.decompress(obj))
{ "content_hash": "ad930efcd0071e2e3d9e277df6fc2bcd", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 73, "avg_line_length": 22.48148148148148, "alnum_prop": 0.7347611202635914, "repo_name": "bpow/gemini", "id": "63dbf34f94b2f5a84e8f9ce89d0ea1760c2f1c74", "size": "607", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "gemini/compression.py", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "130" }, { "name": "HTML", "bytes": "54411" }, { "name": "Perl", "bytes": "5684" }, { "name": "Python", "bytes": "575290" }, { "name": "Shell", "bytes": "286535" } ], "symlink_target": "" }
namespace faint{ MAKE_FAINT_COMMAND_EVENT(PICKED_HUE_SAT); class LightnessBackground : public SliderBackground{ public: explicit LightnessBackground(const HS& hueSat) : m_hueSat(hueSat) {} void Draw(Bitmap& bmp, const IntSize& size, SliderDir) override{ if (!bitmap_ok(m_bitmap) || m_bitmap.GetSize() != size){ InitializeBitmap(size); } blit(at_top_left(m_bitmap), onto(bmp)); } SliderBackground* Clone() const override{ return new LightnessBackground(*this); } private: void InitializeBitmap(const IntSize& size){ m_bitmap = lightness_gradient_bitmap(m_hueSat, size); } Bitmap m_bitmap; HS m_hueSat; }; class HueSatPicker : public wxPanel { public: HueSatPicker(wxWindow* parent) : wxPanel(parent, wxID_ANY), m_hslSize(241,241), m_hueSat(0.0,0.0), m_mouse(this) { SetBackgroundStyle(wxBG_STYLE_PAINT); // Prevent flicker on full refresh SetInitialSize(m_hslSize); InitializeBitmap(); events::on_paint(this, [this](){ wxPaintDC dc(this); dc.DrawBitmap(m_bmp, 0, 0); // Draw the marker dc.SetPen(wxPen(wxColour(0,0,0), 1, wxPENSTYLE_SOLID)); int x = floored((m_hueSat.h / 360.0) * 240.0); int y = floored(240 - m_hueSat.s * 240); dc.DrawLine(x, y - 10, x, y + 10); dc.DrawLine(x - 10, y, x + 10, y); }); events::on_mouse_left_down(this, [this](const IntPoint& pos){ SetFromPos(pos); m_mouse.Capture(); }); events::on_mouse_left_up(this, releaser(m_mouse)); events::on_mouse_motion(this, [this](const IntPoint& pos){ if (m_mouse.HasCapture()){ SetFromPos(pos); } }); } bool AcceptsFocus() const override{ return false; } bool AcceptsFocusFromKeyboard() const override{ return false; } HS GetValue() const{ return m_hueSat; } void Set(const HS& hueSat){ m_hueSat = hueSat; Refresh(); } private: void InitializeBitmap(){ m_bmp = to_wx_bmp(hue_saturation_color_map(to_faint(m_hslSize))); } void SetFromPos(const IntPoint& pos){ int viewHue = std::max(0, std::min(pos.x, 240)); m_hueSat.h = std::min((viewHue / 240.0) * 360.0, 359.0); // Fixme m_hueSat.s = 1.0 - std::max(0, std::min(pos.y, 240)) / 240.0; Refresh(); wxCommandEvent newEvent(EVT_PICKED_HUE_SAT); newEvent.SetEventObject(this); ProcessEvent(newEvent); } wxBitmap m_bmp; wxSize m_hslSize; HS m_hueSat; MouseCapture m_mouse; }; class PaintPanel_HSL::PaintPanel_HSL_Impl : public wxPanel{ public: PaintPanel_HSL_Impl(wxWindow* parent) : wxPanel(parent, wxID_ANY) { m_hueSatPicker = new HueSatPicker(this); set_pos(m_hueSatPicker, IntPoint::Both(panel_padding)); auto lblHue = create_label(this, "&Hue"); m_hueTxt = BindKillFocus(CreateTextControl({min_t(0),max_t(240)}, below(m_hueSatPicker))); PlaceLabel(lblHue, m_hueTxt, true); auto lblSat = create_label(this, "&Sat"); m_saturationTxt = BindKillFocus(CreateTextControl({min_t(0),max_t(240)}, below(m_hueTxt))); PlaceLabel(lblSat, m_saturationTxt, false); m_lightnessSlider = create_slider(this, BoundedInt::Mid(min_t(0), max_t(240)), SliderDir::VERTICAL, BorderedSliderMarker(), LightnessBackground(m_hueSatPicker->GetValue()), IntSize(20, 240)); set_pos(m_lightnessSlider, to_the_right_of(m_hueSatPicker)); m_alphaSlider = create_slider(this, BoundedInt::Mid(min_t(0), max_t(255)), SliderDir::VERTICAL, BorderedSliderMarker(), AlphaBackground(ColRGB(128,128,128)), IntSize(20,255)); set_pos(m_alphaSlider, to_the_right_of(m_lightnessSlider)); auto lblLightness = create_label(this, "&Lightness"); m_lightnessTxt = BindKillFocus(CreateTextControl({min_t(0),max_t(240)})); auto lightnessTxtPos = get_pos(m_lightnessSlider); lightnessTxtPos.x += get_width(m_lightnessSlider) - get_width(m_lightnessTxt); lightnessTxtPos.y = get_pos(m_hueTxt).y; set_pos(m_lightnessTxt, lightnessTxtPos); PlaceLabel(lblLightness, m_lightnessTxt); m_colorBitmap = new StaticBitmap(this, Bitmap({120,120}, color_black)); set_pos(m_colorBitmap, to_the_right_of(m_alphaSlider)); // RGBA text-boxes auto lblRed = create_label(this, "&R"); m_redTxt = BindKillFocus(CreateTextControl({min_t(0), max_t(255)})); auto redPos = get_pos(m_colorBitmap); redPos.x = redPos.x + get_width(m_colorBitmap) - get_width(m_redTxt); redPos.y += get_height(m_colorBitmap) + 5; set_pos(m_redTxt, redPos); PlaceLabel(lblRed, m_redTxt); auto lblGreen = create_label(this, "&G"); IntPoint greenPos(redPos.x, redPos.y + get_height(m_redTxt) + 5); m_greenTxt = BindKillFocus(CreateTextControl({min_t(0), max_t(255)}, greenPos)); PlaceLabel(lblGreen, m_greenTxt); auto lblBlue = create_label(this, "&B"); IntPoint bluePos(greenPos.x, greenPos.y + get_height(m_greenTxt) + 5); m_blueTxt = BindKillFocus(CreateTextControl({min_t(0), max_t(255)}, bluePos)); PlaceLabel(lblBlue, m_blueTxt); auto lblAlpha = create_label(this, "&A"); IntPoint alphaPos(bluePos.x, bluePos.y + get_height(m_blueTxt) + 5); m_alphaTxt = BindKillFocus(CreateTextControl({min_t(0), max_t(255)}, alphaPos)); PlaceLabel(lblAlpha, m_alphaTxt); SetInitialSize(wxSize(right_side(m_colorBitmap) + panel_padding, bottom(m_saturationTxt) + panel_padding)); SetColor(Color(0,0,128,255)); UpdateRGBA(); UpdateHSL(); UpdateColorBitmap(); events::on_slider_change(m_lightnessSlider, [this](int lightness){ HSL hsl(m_hueSatPicker->GetValue(), lightness / 240.0); m_alphaSlider->SetBackground(AlphaBackground(to_rgb(hsl))); UpdateColorBitmap(); set_number_text(m_lightnessTxt, lightness, Signal::NO); UpdateRGBA(); }); events::on_slider_change(m_alphaSlider, [this](int alpha){ UpdateColorBitmap(); set_number_text(m_alphaTxt, alpha, Signal::NO); }); bind(this, EVT_PICKED_HUE_SAT, [this](){ HS hueSat(m_hueSatPicker->GetValue()); m_lightnessSlider->SetBackground(LightnessBackground(hueSat)); ColRGB rgb(to_rgb(HSL(hueSat, m_lightnessSlider->GetValue() / 240.0))); // Fixme: Nasty conversion m_alphaSlider->SetBackground(AlphaBackground(rgb)); UpdateColorBitmap(); int hue = static_cast<int>((hueSat.h / 360) * 240); // Fixme set_number_text(m_hueTxt, hue, Signal::NO); int saturation = static_cast<int>(hueSat.s * 40); set_number_text(m_saturationTxt, saturation, Signal::NO); UpdateRGBA(); }); // Fixme: Bind each text-control separately instead bind_fwd(this, wxEVT_COMMAND_TEXT_UPDATED, [this](wxCommandEvent& evt){ auto* ctrl = dynamic_cast<wxTextCtrl*>(evt.GetEventObject()); IntRange range(m_ranges[ctrl]); int value = range.Constrain(parse_int_value(ctrl,0)); if (ctrl == m_hueTxt){ HS hs = m_hueSatPicker->GetValue(); hs.h = std::min((value / 240.0) * 360.0, 359.0); // Fixme m_hueSatPicker->Set(hs); m_lightnessSlider->SetBackground(LightnessBackground(hs)); UpdateColorBitmap(); } else if (ctrl == m_saturationTxt){ HS hs = m_hueSatPicker->GetValue(); hs.s = value / 240.0; m_hueSatPicker->Set(hs); m_lightnessSlider->SetBackground(LightnessBackground(hs)); UpdateColorBitmap(); } else if (ctrl == m_lightnessTxt){ m_lightnessSlider->SetValue(value); m_alphaSlider->SetBackground(AlphaBackground(strip_alpha(GetColor()))); UpdateColorBitmap(); } else if (ctrl == m_alphaTxt){ m_alphaSlider->SetValue(value); UpdateColorBitmap(); } else if (ctrl == m_redTxt || ctrl == m_greenTxt || ctrl == m_blueTxt){ ColRGB rgb(rgb_from_ints(parse_int_value(m_redTxt, 0), parse_int_value(m_greenTxt, 0), parse_int_value(m_blueTxt, 0))); HSL hsl(to_hsl(rgb)); m_hueSatPicker->Set(hsl.GetHS()); m_lightnessSlider->SetBackground(LightnessBackground(hsl.GetHS())); m_lightnessSlider->SetValue(floored(hsl.l * 240.0)); // Fixme: Conversion m_alphaSlider->SetBackground(AlphaBackground(rgb)); UpdateColorBitmap(); UpdateHSL(); } }); } Color GetColor() const{ Color c(to_rgba(HSL(m_hueSatPicker->GetValue(), m_lightnessSlider->GetValue() / 240.0), m_alphaSlider->GetValue())); return c; } void SetColor(const Color& color){ HSL hsl(to_hsl(strip_alpha(color))); m_hueSatPicker->Set(hsl.GetHS()); m_lightnessSlider->SetBackground(LightnessBackground(hsl.GetHS())); m_lightnessSlider->SetValue(floored(hsl.l * 240.0)); // Fixme: Nasty conversion m_alphaSlider->SetBackground(AlphaBackground(strip_alpha(color))); m_alphaSlider->SetValue(color.a); UpdateColorBitmap(); UpdateRGBA(); UpdateHSL(); } private: wxTextCtrl* BindKillFocus(wxTextCtrl* textCtrl){ events::on_kill_focus(textCtrl, [this, textCtrl](){ // Set the value to 0 if invalid wxString text = textCtrl->GetValue(); if (text.empty() || !text.IsNumber() || text.Contains("-")){ set_number_text(textCtrl, 0, Signal::YES); return; } int value = parse_int_value(textCtrl, 0); IntRange& range(m_ranges[textCtrl]); if (!range.Has(value)){ set_number_text(textCtrl, range.Constrain(value), Signal::YES); } }); return textCtrl; } wxTextCtrl* CreateTextControl(const IntRange& range, const IntPoint& pos){ wxTextCtrl* t = create_text_control(this, pos, Width(50)); t->SetMaxLength(3); m_ranges[t] = range; return t; } wxTextCtrl* CreateTextControl(const IntRange& range){ return CreateTextControl(range, to_faint(wxDefaultPosition)); } void UpdateRGBA(){ Color c(GetColor()); m_redTxt->ChangeValue(to_wx(str_int(c.r))); m_greenTxt->ChangeValue(to_wx(str_int(c.g))); m_blueTxt->ChangeValue(to_wx(str_int(c.b))); m_alphaTxt->ChangeValue(to_wx(str_int(c.a))); } void UpdateHSL(){ Color c(GetColor()); HSL hsl(to_hsl(strip_alpha(c))); m_hueTxt->ChangeValue(to_wx(str_int(truncated((hsl.h / 360.0) * 240.0)))); // Fixme m_saturationTxt->ChangeValue(to_wx(str_int(truncated(hsl.s * 240.0)))); // Fixme m_lightnessTxt->ChangeValue(to_wx(str_int(truncated(hsl.l * 240.0)))); // Fixme } void UpdateColorBitmap(){ Bitmap bmp(color_bitmap(GetColor(), to_faint(m_colorBitmap->GetSize()))); m_colorBitmap->SetBitmap(bmp); } void PlaceLabel(wxStaticText* label, wxTextCtrl* control, bool shift=false){ // Place the label to the left of the control. // Note: I previously just had an AddLabel-function, but the label // would then end up after the (already-created) control in the // tab order. Hence, the label must be created before the // control. I tried wxWindows::MoveBeforeInTabOrder, but this did // not affect traversal with mnemonics, so e.g. Alt+H for the hue // label ("&Hue") would select the saturation text field. auto ctrlPos(get_pos(control)); auto ctrlSize(get_size(control)); auto lblSize(get_size(label)); if (shift){ set_pos(control, IntPoint(ctrlPos.x + lblSize.w + 5, ctrlPos.y)); set_pos(label, IntPoint(ctrlPos.x, ctrlPos.y + ctrlSize.h / 2 - lblSize.h / 2)); } else { set_pos(label, {ctrlPos.x - lblSize.w - 5, ctrlPos.y + ctrlSize.h / 2 - lblSize.h / 2}); } } Slider* m_alphaSlider; wxTextCtrl* m_alphaTxt; wxTextCtrl* m_blueTxt; StaticBitmap* m_colorBitmap; wxTextCtrl* m_greenTxt; HueSatPicker* m_hueSatPicker; wxTextCtrl* m_hueTxt; Slider* m_lightnessSlider; wxTextCtrl* m_lightnessTxt; std::map<wxTextCtrl*, IntRange> m_ranges; wxTextCtrl* m_redTxt; wxTextCtrl* m_saturationTxt; }; PaintPanel_HSL::PaintPanel_HSL(wxWindow* parent){ m_impl = new PaintPanel_HSL_Impl(parent); } PaintPanel_HSL::~PaintPanel_HSL(){ m_impl = nullptr; // Deletion handled by wxWidgets } Color PaintPanel_HSL::GetColor() const{ return m_impl->GetColor(); } void PaintPanel_HSL::SetColor(const Color& color){ m_impl->SetColor(color); } wxWindow* PaintPanel_HSL::AsWindow(){ return m_impl; } } // namespace
{ "content_hash": "b59317de9f3404537bf74c4f25395143", "timestamp": "", "source": "github", "line_count": 388, "max_line_length": 106, "avg_line_length": 32.396907216494846, "alnum_prop": 0.6356404136833731, "repo_name": "tectronics/faint-graphics-editor", "id": "3fa3ee4e2e71c89c24b22990e99adfca05c6b24c", "size": "13925", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "gui/paint-dialog/hsl-panel.cpp", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "32346" }, { "name": "C++", "bytes": "2585909" }, { "name": "Emacs Lisp", "bytes": "8164" }, { "name": "HTML", "bytes": "26096" }, { "name": "NSIS", "bytes": "2088" }, { "name": "Python", "bytes": "454374" } ], "symlink_target": "" }
ACCEPTED #### According to Index Fungorum #### Published in null #### Original name Diplodina moelleriana N.F. Buchw. ### Remarks null
{ "content_hash": "2205e3b61328d60ee37ec842f01bc6ae", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 33, "avg_line_length": 10.615384615384615, "alnum_prop": 0.7028985507246377, "repo_name": "mdoering/backbone", "id": "e25bfc63765ed364db188568967a3f8fee261684", "size": "195", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Fungi/Ascomycota/Sordariomycetes/Diaporthales/Gnomoniaceae/Diplodina/Diplodina moelleriana/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
import collections import six import unittest2 as unittest from fabricio import docker, utils class OptionsTestCase(unittest.TestCase): def test_str_version(self): cases = dict( empty_options_list=dict( options=collections.OrderedDict(), expected_str_version='', ), with_underscore=dict( options=collections.OrderedDict(foo_baz='bar'), expected_str_version='--foo_baz=bar', ), multiword=dict( options=collections.OrderedDict(foo='bar baz'), expected_str_version="--foo='bar baz'", ), empty=dict( options=collections.OrderedDict(foo=''), expected_str_version="--foo=''", ), str=dict( options=collections.OrderedDict(foo='bar'), expected_str_version='--foo=bar', ), unicode=dict( options=collections.OrderedDict(foo=u'привет'), expected_str_version=u"--foo='привет'", ), integer=dict( options=collections.OrderedDict(foo=42), expected_str_version='--foo=42', ), integer_zero=dict( options=collections.OrderedDict(foo=0), expected_str_version='--foo=0', ), integer_one=dict( options=collections.OrderedDict(foo=1), expected_str_version='--foo=1', ), integer_minus_one=dict( options=collections.OrderedDict(foo=-1), expected_str_version='--foo=-1', ), image=dict( options=collections.OrderedDict(image=docker.Image('image:tag')), expected_str_version='--image=image:tag', ), triple_length=dict( options=collections.OrderedDict([ ('foo', 'foo'), ('bar', 'bar'), ('baz', 'baz'), ]), expected_str_version='--foo=foo --bar=bar --baz=baz', ), multi_value_empty=dict( options=collections.OrderedDict(foo=[]), expected_str_version='', ), multi_value=dict( options=collections.OrderedDict(foo=['bar', 'baz']), expected_str_version='--foo=bar --foo=baz', ), multi_value_integer=dict( options=collections.OrderedDict(foo=[42, 43]), expected_str_version='--foo=42 --foo=43', ), boolean_values=dict( options=collections.OrderedDict(foo=True, bar=False), expected_str_version='--foo', ), mix=dict( options=collections.OrderedDict([ ('foo', 'foo'), ('bar', True), ('baz', ['1', 'a']), ]), expected_str_version='--foo=foo --bar --baz=1 --baz=a', ), ) for case, params in cases.items(): with self.subTest(case=case): options = utils.Options(params['options']) expected_str_version = params['expected_str_version'] self.assertEqual(expected_str_version, six.text_type(options))
{ "content_hash": "6558588923e1464d5f2163812333df28", "timestamp": "", "source": "github", "line_count": 94, "max_line_length": 81, "avg_line_length": 36.744680851063826, "alnum_prop": 0.47278517660683267, "repo_name": "renskiy/fabricio", "id": "b5ebdd3797ed9725c9b55e053c59bab3a63d7f15", "size": "3482", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "tests/test_utils.py", "mode": "33188", "license": "mit", "language": [ { "name": "Python", "bytes": "582330" } ], "symlink_target": "" }
package models; import java.util.List; public class ExhibitionHallsDto { public List<ExhibitionHall> exhibitionHalls; }
{ "content_hash": "474909e96d3fd52caa24dc2b7984f673", "timestamp": "", "source": "github", "line_count": 7, "max_line_length": 45, "avg_line_length": 17.571428571428573, "alnum_prop": 0.8048780487804879, "repo_name": "tom1120/ninja", "id": "2c2c60fc132fe59034bb8ffbae135b4778b59e10", "size": "123", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "zhaoyi/src/main/java/models/ExhibitionHallsDto.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "1769079" }, { "name": "FreeMarker", "bytes": "193300" }, { "name": "HTML", "bytes": "640943" }, { "name": "Java", "bytes": "3137200" }, { "name": "JavaScript", "bytes": "3201287" }, { "name": "Roff", "bytes": "17565" } ], "symlink_target": "" }
#import <OBAKit/OBAMapDataLoader.h> #import <OBAKit/OBAKit-Swift.h> @interface OBAMapDataLoader () @property (nonatomic, strong, readwrite) OBASearchResult *result; @property (nonatomic, strong) OBANavigationTarget *target; @property (nonatomic, strong) CLLocation *lastCurrentLocationSearch; @property (nonatomic, strong) NSHashTable *delegates; @end @implementation OBAMapDataLoader - (instancetype)init { if (self = [super init]) { _searchType = OBASearchTypeNone; _delegates = [NSHashTable weakObjectsHashTable]; } return self; } - (void)dealloc { [self cancelOpenConnections]; } #pragma mark - Delegates - (void)addDelegate:(id<OBAMapDataLoaderDelegate>)delegate { [self.delegates addObject:delegate]; } - (void)removeDelegate:(id<OBAMapDataLoaderDelegate>)delegate { [self.delegates removeObject:delegate]; } - (void)callDelegatesDidUpdateResult:(OBASearchResult*)searchResult { for (id<OBAMapDataLoaderDelegate> delegate in self.delegates) { if ([delegate respondsToSelector:@selector(mapDataLoader:didUpdateResult:)]) { [delegate mapDataLoader:self didUpdateResult:searchResult]; } } } - (void)callDelegatesStartedUpdatingWithNavigationTarget:(OBANavigationTarget*)target { for (id<OBAMapDataLoaderDelegate> delegate in self.delegates) { if ([delegate respondsToSelector:@selector(mapDataLoader:startedUpdatingWithNavigationTarget:)]) { [delegate mapDataLoader:self startedUpdatingWithNavigationTarget:target]; } } } - (void)callDelegatesFinishedUpdating { for (id<OBAMapDataLoaderDelegate> delegate in self.delegates) { if ([delegate respondsToSelector:@selector(mapDataLoaderFinishedUpdating:)]) { [delegate mapDataLoaderFinishedUpdating:self]; } } } - (void)callDelegatesDidReceiveError:(NSError*)error { for (id<OBAMapDataLoaderDelegate> delegate in self.delegates) { if ([delegate respondsToSelector:@selector(mapDataLoader:didReceiveError:)]) { [delegate mapDataLoader:self didReceiveError:error]; } } } #pragma mark - Public Methods - (void)searchWithTarget:(OBANavigationTarget *)target { [self cancelOpenConnections]; _target = target; _searchType = target.searchType; // Short circuit if the request is NONE if (_searchType == OBASearchTypeNone) { OBASearchResult *result = [OBASearchResult result]; result.searchType = OBASearchTypeNone; [self fireUpdate:result]; [self callDelegatesFinishedUpdating]; return; } [self requestTarget:target]; [self callDelegatesStartedUpdatingWithNavigationTarget:target]; } - (void)searchPending { [self cancelOpenConnections]; _target = nil; _searchType = OBASearchTypePending; } - (OBANavigationTarget*)searchTarget { return _target; } - (id)searchParameter { return _target.searchArgument; } - (CLLocation *)searchLocation { return _target.parameters[kOBASearchControllerSearchLocationParameter]; } - (void)setSearchLocation:(CLLocation *)location { if (!location) { return; } [_target setObject:location forParameter:kOBASearchControllerSearchLocationParameter]; } - (void)cancelOpenConnections { _searchType = OBASearchTypeNone; self.result = nil; } #pragma mark - Public Methods - (BOOL)unfilteredSearch { return ( self.searchType == OBASearchTypeNone || self.searchType == OBASearchTypePending || self.searchType == OBASearchTypeRegion || self.searchType == OBASearchTypePlacemark); } #pragma mark - Data Requests - (AnyPromise*)requestRegion:(MKCoordinateRegion)region { return [self.modelService requestStopsForRegion:region].then(^(OBASearchResult *result) { [self fireUpdate:result]; }); } - (AnyPromise*)requestRouteWithQuery:(NSString*)routeQuery { OBAGuardClass(routeQuery, NSString) else { return nil; } return [self.modelService requestRoutesForQuery:routeQuery region:self.searchRegion].then(^(OBASearchResult *result) { [self fireUpdate:result]; }); } - (AnyPromise*)requestStopsForRouteID:(NSString*)routeID { return [self.modelService requestStopsForRoute:routeID].then(^(OBAStopsForRouteV2* stopsForRoute) { OBASearchResult *result = [OBASearchResult result]; result.values = [stopsForRoute stops]; result.additionalValues = stopsForRoute.polylines; [self fireUpdate:result]; }); } - (AnyPromise*)requestAddressWithQuery:(NSString*)addressQuery { return [self.modelService placemarksForAddress:addressQuery].then(^(NSArray<OBAPlacemark*>* placemarks) { if (placemarks.count == 1) { OBAPlacemark *placemark = placemarks[0]; OBANavigationTarget *navTarget = [OBANavigationTarget navigationTargetForSearchPlacemark:placemark]; [self searchWithTarget:navTarget]; } else { OBASearchResult *result = [OBASearchResult result]; result.values = placemarks; [self fireUpdate:result]; } }); } - (AnyPromise*)requestPlacemark:(OBAPlacemark*)placemark { return [self.modelService requestStopsForPlacemark:placemark].then(^(OBASearchResult* result) { OBAPlacemark *newMark = self.target.parameters[OBANavigationTargetSearchKey]; result.additionalValues = @[newMark]; [self fireUpdate:result]; }); } - (AnyPromise*)requestStopIDWithStopCode:(NSString*)stopCode { return [self.modelService requestStopsForQuery:stopCode region:self.searchRegion].then(^(OBASearchResult* result) { [self fireUpdate:result]; }); } - (AnyPromise*)requestTarget:(OBANavigationTarget *)target { id searchTypeParameter = target.searchArgument; AnyPromise *promise = nil; OBASearchType searchType = target.searchType; switch (searchType) { case OBASearchTypeRegion: { MKCoordinateRegion region; [searchTypeParameter getBytes:&region length:sizeof(MKCoordinateRegion)]; promise = [self requestRegion:region]; break; } case OBASearchTypeRoute: { promise = [self requestRouteWithQuery:searchTypeParameter]; break; } case OBASearchTypeStops: { promise = [self requestStopsForRouteID:searchTypeParameter]; break; } case OBASearchTypeAddress: { promise = [self requestAddressWithQuery:searchTypeParameter]; break; } case OBASearchTypePlacemark: { promise = [self requestPlacemark:searchTypeParameter]; break; } case OBASearchTypeStopIdSearch: { promise = [self requestStopIDWithStopCode:searchTypeParameter]; break; } default: break; } promise.catch(^(NSError *error) { [self processError:error responseCode:error.code]; }).always(^{ [self callDelegatesFinishedUpdating]; }); return promise; } #pragma mark - Update Data - (void)fireUpdate:(OBASearchResult *)result { result.searchType = self.searchType; self.result = result; [self callDelegatesDidUpdateResult:self.result]; } - (void)processError:(NSError *)error responseCode:(NSUInteger)responseCode { if (responseCode == 0 && error.code == NSURLErrorCancelled) { // This shouldn't be happening, and frankly I'm not entirely sure why it's happening. // But, I do know that it doesn't have any appreciable user impact outside of this // error alert being really annoying. So we'll just log it and eat it. DDLogError(@"Errored out at launch: %@", error); } else if (error) { [self callDelegatesFinishedUpdating]; self.error = error; [self callDelegatesDidReceiveError:error]; } else { [self callDelegatesFinishedUpdating]; } } @end
{ "content_hash": "171d3da921e98931030a4e7d0e3010da", "timestamp": "", "source": "github", "line_count": 264, "max_line_length": 122, "avg_line_length": 30.272727272727273, "alnum_prop": 0.68506006006006, "repo_name": "themonki/onebusaway-iphone", "id": "d42a8682b4a7dfa4863c2f1d89a78318544678d0", "size": "8618", "binary": false, "copies": "3", "ref": "refs/heads/develop", "path": "OBAKit/Services/OBAMapDataLoader.m", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "67761" }, { "name": "HTML", "bytes": "1709" }, { "name": "Objective-C", "bytes": "1499798" }, { "name": "Ruby", "bytes": "10497" }, { "name": "Shell", "bytes": "306" }, { "name": "Swift", "bytes": "542901" } ], "symlink_target": "" }
/** * Autogenerated by Thrift Compiler (0.9.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ package org.apache.hadoop.hive.metastore.api; import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.thrift.scheme.IScheme; import org.apache.thrift.scheme.SchemeFactory; import org.apache.thrift.scheme.StandardScheme; import org.apache.thrift.scheme.TupleScheme; import org.apache.thrift.protocol.TTupleProtocol; import org.apache.thrift.protocol.TProtocolException; import org.apache.thrift.EncodingUtils; import org.apache.thrift.TException; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.util.HashMap; import java.util.EnumMap; import java.util.Set; import java.util.HashSet; import java.util.EnumSet; import java.util.Collections; import java.util.BitSet; import java.nio.ByteBuffer; import java.util.Arrays; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class Index implements org.apache.thrift.TBase<Index, Index._Fields>, java.io.Serializable, Cloneable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Index"); private static final org.apache.thrift.protocol.TField INDEX_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("indexName", org.apache.thrift.protocol.TType.STRING, (short)1); private static final org.apache.thrift.protocol.TField INDEX_HANDLER_CLASS_FIELD_DESC = new org.apache.thrift.protocol.TField("indexHandlerClass", org.apache.thrift.protocol.TType.STRING, (short)2); private static final org.apache.thrift.protocol.TField DB_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("dbName", org.apache.thrift.protocol.TType.STRING, (short)3); private static final org.apache.thrift.protocol.TField ORIG_TABLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("origTableName", org.apache.thrift.protocol.TType.STRING, (short)4); private static final org.apache.thrift.protocol.TField CREATE_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("createTime", org.apache.thrift.protocol.TType.I32, (short)5); private static final org.apache.thrift.protocol.TField LAST_ACCESS_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("lastAccessTime", org.apache.thrift.protocol.TType.I32, (short)6); private static final org.apache.thrift.protocol.TField INDEX_TABLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("indexTableName", org.apache.thrift.protocol.TType.STRING, (short)7); private static final org.apache.thrift.protocol.TField SD_FIELD_DESC = new org.apache.thrift.protocol.TField("sd", org.apache.thrift.protocol.TType.STRUCT, (short)8); private static final org.apache.thrift.protocol.TField PARAMETERS_FIELD_DESC = new org.apache.thrift.protocol.TField("parameters", org.apache.thrift.protocol.TType.MAP, (short)9); private static final org.apache.thrift.protocol.TField DEFERRED_REBUILD_FIELD_DESC = new org.apache.thrift.protocol.TField("deferredRebuild", org.apache.thrift.protocol.TType.BOOL, (short)10); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { schemes.put(StandardScheme.class, new IndexStandardSchemeFactory()); schemes.put(TupleScheme.class, new IndexTupleSchemeFactory()); } private String indexName; // required private String indexHandlerClass; // required private String dbName; // required private String origTableName; // required private int createTime; // required private int lastAccessTime; // required private String indexTableName; // required private StorageDescriptor sd; // required private Map<String,String> parameters; // required private boolean deferredRebuild; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { INDEX_NAME((short)1, "indexName"), INDEX_HANDLER_CLASS((short)2, "indexHandlerClass"), DB_NAME((short)3, "dbName"), ORIG_TABLE_NAME((short)4, "origTableName"), CREATE_TIME((short)5, "createTime"), LAST_ACCESS_TIME((short)6, "lastAccessTime"), INDEX_TABLE_NAME((short)7, "indexTableName"), SD((short)8, "sd"), PARAMETERS((short)9, "parameters"), DEFERRED_REBUILD((short)10, "deferredRebuild"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); static { for (_Fields field : EnumSet.allOf(_Fields.class)) { byName.put(field.getFieldName(), field); } } /** * Find the _Fields constant that matches fieldId, or null if its not found. */ public static _Fields findByThriftId(int fieldId) { switch(fieldId) { case 1: // INDEX_NAME return INDEX_NAME; case 2: // INDEX_HANDLER_CLASS return INDEX_HANDLER_CLASS; case 3: // DB_NAME return DB_NAME; case 4: // ORIG_TABLE_NAME return ORIG_TABLE_NAME; case 5: // CREATE_TIME return CREATE_TIME; case 6: // LAST_ACCESS_TIME return LAST_ACCESS_TIME; case 7: // INDEX_TABLE_NAME return INDEX_TABLE_NAME; case 8: // SD return SD; case 9: // PARAMETERS return PARAMETERS; case 10: // DEFERRED_REBUILD return DEFERRED_REBUILD; default: return null; } } /** * Find the _Fields constant that matches fieldId, throwing an exception * if it is not found. */ public static _Fields findByThriftIdOrThrow(int fieldId) { _Fields fields = findByThriftId(fieldId); if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); return fields; } /** * Find the _Fields constant that matches name, or null if its not found. */ public static _Fields findByName(String name) { return byName.get(name); } private final short _thriftId; private final String _fieldName; _Fields(short thriftId, String fieldName) { _thriftId = thriftId; _fieldName = fieldName; } public short getThriftFieldId() { return _thriftId; } public String getFieldName() { return _fieldName; } } // isset id assignments private static final int __CREATETIME_ISSET_ID = 0; private static final int __LASTACCESSTIME_ISSET_ID = 1; private static final int __DEFERREDREBUILD_ISSET_ID = 2; private byte __isset_bitfield = 0; public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; static { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); tmpMap.put(_Fields.INDEX_NAME, new org.apache.thrift.meta_data.FieldMetaData("indexName", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.INDEX_HANDLER_CLASS, new org.apache.thrift.meta_data.FieldMetaData("indexHandlerClass", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.DB_NAME, new org.apache.thrift.meta_data.FieldMetaData("dbName", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.ORIG_TABLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("origTableName", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.CREATE_TIME, new org.apache.thrift.meta_data.FieldMetaData("createTime", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); tmpMap.put(_Fields.LAST_ACCESS_TIME, new org.apache.thrift.meta_data.FieldMetaData("lastAccessTime", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); tmpMap.put(_Fields.INDEX_TABLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("indexTableName", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.SD, new org.apache.thrift.meta_data.FieldMetaData("sd", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, StorageDescriptor.class))); tmpMap.put(_Fields.PARAMETERS, new org.apache.thrift.meta_data.FieldMetaData("parameters", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING), new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)))); tmpMap.put(_Fields.DEFERRED_REBUILD, new org.apache.thrift.meta_data.FieldMetaData("deferredRebuild", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Index.class, metaDataMap); } public Index() { } public Index( String indexName, String indexHandlerClass, String dbName, String origTableName, int createTime, int lastAccessTime, String indexTableName, StorageDescriptor sd, Map<String,String> parameters, boolean deferredRebuild) { this(); this.indexName = indexName; this.indexHandlerClass = indexHandlerClass; this.dbName = dbName; this.origTableName = origTableName; this.createTime = createTime; setCreateTimeIsSet(true); this.lastAccessTime = lastAccessTime; setLastAccessTimeIsSet(true); this.indexTableName = indexTableName; this.sd = sd; this.parameters = parameters; this.deferredRebuild = deferredRebuild; setDeferredRebuildIsSet(true); } /** * Performs a deep copy on <i>other</i>. */ public Index(Index other) { __isset_bitfield = other.__isset_bitfield; if (other.isSetIndexName()) { this.indexName = other.indexName; } if (other.isSetIndexHandlerClass()) { this.indexHandlerClass = other.indexHandlerClass; } if (other.isSetDbName()) { this.dbName = other.dbName; } if (other.isSetOrigTableName()) { this.origTableName = other.origTableName; } this.createTime = other.createTime; this.lastAccessTime = other.lastAccessTime; if (other.isSetIndexTableName()) { this.indexTableName = other.indexTableName; } if (other.isSetSd()) { this.sd = new StorageDescriptor(other.sd); } if (other.isSetParameters()) { Map<String,String> __this__parameters = new HashMap<String,String>(); for (Map.Entry<String, String> other_element : other.parameters.entrySet()) { String other_element_key = other_element.getKey(); String other_element_value = other_element.getValue(); String __this__parameters_copy_key = other_element_key; String __this__parameters_copy_value = other_element_value; __this__parameters.put(__this__parameters_copy_key, __this__parameters_copy_value); } this.parameters = __this__parameters; } this.deferredRebuild = other.deferredRebuild; } public Index deepCopy() { return new Index(this); } @Override public void clear() { this.indexName = null; this.indexHandlerClass = null; this.dbName = null; this.origTableName = null; setCreateTimeIsSet(false); this.createTime = 0; setLastAccessTimeIsSet(false); this.lastAccessTime = 0; this.indexTableName = null; this.sd = null; this.parameters = null; setDeferredRebuildIsSet(false); this.deferredRebuild = false; } public String getIndexName() { return this.indexName; } public void setIndexName(String indexName) { this.indexName = indexName; } public void unsetIndexName() { this.indexName = null; } /** Returns true if field indexName is set (has been assigned a value) and false otherwise */ public boolean isSetIndexName() { return this.indexName != null; } public void setIndexNameIsSet(boolean value) { if (!value) { this.indexName = null; } } public String getIndexHandlerClass() { return this.indexHandlerClass; } public void setIndexHandlerClass(String indexHandlerClass) { this.indexHandlerClass = indexHandlerClass; } public void unsetIndexHandlerClass() { this.indexHandlerClass = null; } /** Returns true if field indexHandlerClass is set (has been assigned a value) and false otherwise */ public boolean isSetIndexHandlerClass() { return this.indexHandlerClass != null; } public void setIndexHandlerClassIsSet(boolean value) { if (!value) { this.indexHandlerClass = null; } } public String getDbName() { return this.dbName; } public void setDbName(String dbName) { this.dbName = dbName; } public void unsetDbName() { this.dbName = null; } /** Returns true if field dbName is set (has been assigned a value) and false otherwise */ public boolean isSetDbName() { return this.dbName != null; } public void setDbNameIsSet(boolean value) { if (!value) { this.dbName = null; } } public String getOrigTableName() { return this.origTableName; } public void setOrigTableName(String origTableName) { this.origTableName = origTableName; } public void unsetOrigTableName() { this.origTableName = null; } /** Returns true if field origTableName is set (has been assigned a value) and false otherwise */ public boolean isSetOrigTableName() { return this.origTableName != null; } public void setOrigTableNameIsSet(boolean value) { if (!value) { this.origTableName = null; } } public int getCreateTime() { return this.createTime; } public void setCreateTime(int createTime) { this.createTime = createTime; setCreateTimeIsSet(true); } public void unsetCreateTime() { __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __CREATETIME_ISSET_ID); } /** Returns true if field createTime is set (has been assigned a value) and false otherwise */ public boolean isSetCreateTime() { return EncodingUtils.testBit(__isset_bitfield, __CREATETIME_ISSET_ID); } public void setCreateTimeIsSet(boolean value) { __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __CREATETIME_ISSET_ID, value); } public int getLastAccessTime() { return this.lastAccessTime; } public void setLastAccessTime(int lastAccessTime) { this.lastAccessTime = lastAccessTime; setLastAccessTimeIsSet(true); } public void unsetLastAccessTime() { __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __LASTACCESSTIME_ISSET_ID); } /** Returns true if field lastAccessTime is set (has been assigned a value) and false otherwise */ public boolean isSetLastAccessTime() { return EncodingUtils.testBit(__isset_bitfield, __LASTACCESSTIME_ISSET_ID); } public void setLastAccessTimeIsSet(boolean value) { __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __LASTACCESSTIME_ISSET_ID, value); } public String getIndexTableName() { return this.indexTableName; } public void setIndexTableName(String indexTableName) { this.indexTableName = indexTableName; } public void unsetIndexTableName() { this.indexTableName = null; } /** Returns true if field indexTableName is set (has been assigned a value) and false otherwise */ public boolean isSetIndexTableName() { return this.indexTableName != null; } public void setIndexTableNameIsSet(boolean value) { if (!value) { this.indexTableName = null; } } public StorageDescriptor getSd() { return this.sd; } public void setSd(StorageDescriptor sd) { this.sd = sd; } public void unsetSd() { this.sd = null; } /** Returns true if field sd is set (has been assigned a value) and false otherwise */ public boolean isSetSd() { return this.sd != null; } public void setSdIsSet(boolean value) { if (!value) { this.sd = null; } } public int getParametersSize() { return (this.parameters == null) ? 0 : this.parameters.size(); } public void putToParameters(String key, String val) { if (this.parameters == null) { this.parameters = new HashMap<String,String>(); } this.parameters.put(key, val); } public Map<String,String> getParameters() { return this.parameters; } public void setParameters(Map<String,String> parameters) { this.parameters = parameters; } public void unsetParameters() { this.parameters = null; } /** Returns true if field parameters is set (has been assigned a value) and false otherwise */ public boolean isSetParameters() { return this.parameters != null; } public void setParametersIsSet(boolean value) { if (!value) { this.parameters = null; } } public boolean isDeferredRebuild() { return this.deferredRebuild; } public void setDeferredRebuild(boolean deferredRebuild) { this.deferredRebuild = deferredRebuild; setDeferredRebuildIsSet(true); } public void unsetDeferredRebuild() { __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __DEFERREDREBUILD_ISSET_ID); } /** Returns true if field deferredRebuild is set (has been assigned a value) and false otherwise */ public boolean isSetDeferredRebuild() { return EncodingUtils.testBit(__isset_bitfield, __DEFERREDREBUILD_ISSET_ID); } public void setDeferredRebuildIsSet(boolean value) { __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __DEFERREDREBUILD_ISSET_ID, value); } public void setFieldValue(_Fields field, Object value) { switch (field) { case INDEX_NAME: if (value == null) { unsetIndexName(); } else { setIndexName((String)value); } break; case INDEX_HANDLER_CLASS: if (value == null) { unsetIndexHandlerClass(); } else { setIndexHandlerClass((String)value); } break; case DB_NAME: if (value == null) { unsetDbName(); } else { setDbName((String)value); } break; case ORIG_TABLE_NAME: if (value == null) { unsetOrigTableName(); } else { setOrigTableName((String)value); } break; case CREATE_TIME: if (value == null) { unsetCreateTime(); } else { setCreateTime((Integer)value); } break; case LAST_ACCESS_TIME: if (value == null) { unsetLastAccessTime(); } else { setLastAccessTime((Integer)value); } break; case INDEX_TABLE_NAME: if (value == null) { unsetIndexTableName(); } else { setIndexTableName((String)value); } break; case SD: if (value == null) { unsetSd(); } else { setSd((StorageDescriptor)value); } break; case PARAMETERS: if (value == null) { unsetParameters(); } else { setParameters((Map<String,String>)value); } break; case DEFERRED_REBUILD: if (value == null) { unsetDeferredRebuild(); } else { setDeferredRebuild((Boolean)value); } break; } } public Object getFieldValue(_Fields field) { switch (field) { case INDEX_NAME: return getIndexName(); case INDEX_HANDLER_CLASS: return getIndexHandlerClass(); case DB_NAME: return getDbName(); case ORIG_TABLE_NAME: return getOrigTableName(); case CREATE_TIME: return Integer.valueOf(getCreateTime()); case LAST_ACCESS_TIME: return Integer.valueOf(getLastAccessTime()); case INDEX_TABLE_NAME: return getIndexTableName(); case SD: return getSd(); case PARAMETERS: return getParameters(); case DEFERRED_REBUILD: return Boolean.valueOf(isDeferredRebuild()); } throw new IllegalStateException(); } /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case INDEX_NAME: return isSetIndexName(); case INDEX_HANDLER_CLASS: return isSetIndexHandlerClass(); case DB_NAME: return isSetDbName(); case ORIG_TABLE_NAME: return isSetOrigTableName(); case CREATE_TIME: return isSetCreateTime(); case LAST_ACCESS_TIME: return isSetLastAccessTime(); case INDEX_TABLE_NAME: return isSetIndexTableName(); case SD: return isSetSd(); case PARAMETERS: return isSetParameters(); case DEFERRED_REBUILD: return isSetDeferredRebuild(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof Index) return this.equals((Index)that); return false; } public boolean equals(Index that) { if (that == null) return false; boolean this_present_indexName = true && this.isSetIndexName(); boolean that_present_indexName = true && that.isSetIndexName(); if (this_present_indexName || that_present_indexName) { if (!(this_present_indexName && that_present_indexName)) return false; if (!this.indexName.equals(that.indexName)) return false; } boolean this_present_indexHandlerClass = true && this.isSetIndexHandlerClass(); boolean that_present_indexHandlerClass = true && that.isSetIndexHandlerClass(); if (this_present_indexHandlerClass || that_present_indexHandlerClass) { if (!(this_present_indexHandlerClass && that_present_indexHandlerClass)) return false; if (!this.indexHandlerClass.equals(that.indexHandlerClass)) return false; } boolean this_present_dbName = true && this.isSetDbName(); boolean that_present_dbName = true && that.isSetDbName(); if (this_present_dbName || that_present_dbName) { if (!(this_present_dbName && that_present_dbName)) return false; if (!this.dbName.equals(that.dbName)) return false; } boolean this_present_origTableName = true && this.isSetOrigTableName(); boolean that_present_origTableName = true && that.isSetOrigTableName(); if (this_present_origTableName || that_present_origTableName) { if (!(this_present_origTableName && that_present_origTableName)) return false; if (!this.origTableName.equals(that.origTableName)) return false; } boolean this_present_createTime = true; boolean that_present_createTime = true; if (this_present_createTime || that_present_createTime) { if (!(this_present_createTime && that_present_createTime)) return false; if (this.createTime != that.createTime) return false; } boolean this_present_lastAccessTime = true; boolean that_present_lastAccessTime = true; if (this_present_lastAccessTime || that_present_lastAccessTime) { if (!(this_present_lastAccessTime && that_present_lastAccessTime)) return false; if (this.lastAccessTime != that.lastAccessTime) return false; } boolean this_present_indexTableName = true && this.isSetIndexTableName(); boolean that_present_indexTableName = true && that.isSetIndexTableName(); if (this_present_indexTableName || that_present_indexTableName) { if (!(this_present_indexTableName && that_present_indexTableName)) return false; if (!this.indexTableName.equals(that.indexTableName)) return false; } boolean this_present_sd = true && this.isSetSd(); boolean that_present_sd = true && that.isSetSd(); if (this_present_sd || that_present_sd) { if (!(this_present_sd && that_present_sd)) return false; if (!this.sd.equals(that.sd)) return false; } boolean this_present_parameters = true && this.isSetParameters(); boolean that_present_parameters = true && that.isSetParameters(); if (this_present_parameters || that_present_parameters) { if (!(this_present_parameters && that_present_parameters)) return false; if (!this.parameters.equals(that.parameters)) return false; } boolean this_present_deferredRebuild = true; boolean that_present_deferredRebuild = true; if (this_present_deferredRebuild || that_present_deferredRebuild) { if (!(this_present_deferredRebuild && that_present_deferredRebuild)) return false; if (this.deferredRebuild != that.deferredRebuild) return false; } return true; } @Override public int hashCode() { HashCodeBuilder builder = new HashCodeBuilder(); boolean present_indexName = true && (isSetIndexName()); builder.append(present_indexName); if (present_indexName) builder.append(indexName); boolean present_indexHandlerClass = true && (isSetIndexHandlerClass()); builder.append(present_indexHandlerClass); if (present_indexHandlerClass) builder.append(indexHandlerClass); boolean present_dbName = true && (isSetDbName()); builder.append(present_dbName); if (present_dbName) builder.append(dbName); boolean present_origTableName = true && (isSetOrigTableName()); builder.append(present_origTableName); if (present_origTableName) builder.append(origTableName); boolean present_createTime = true; builder.append(present_createTime); if (present_createTime) builder.append(createTime); boolean present_lastAccessTime = true; builder.append(present_lastAccessTime); if (present_lastAccessTime) builder.append(lastAccessTime); boolean present_indexTableName = true && (isSetIndexTableName()); builder.append(present_indexTableName); if (present_indexTableName) builder.append(indexTableName); boolean present_sd = true && (isSetSd()); builder.append(present_sd); if (present_sd) builder.append(sd); boolean present_parameters = true && (isSetParameters()); builder.append(present_parameters); if (present_parameters) builder.append(parameters); boolean present_deferredRebuild = true; builder.append(present_deferredRebuild); if (present_deferredRebuild) builder.append(deferredRebuild); return builder.toHashCode(); } public int compareTo(Index other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; Index typedOther = (Index)other; lastComparison = Boolean.valueOf(isSetIndexName()).compareTo(typedOther.isSetIndexName()); if (lastComparison != 0) { return lastComparison; } if (isSetIndexName()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.indexName, typedOther.indexName); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetIndexHandlerClass()).compareTo(typedOther.isSetIndexHandlerClass()); if (lastComparison != 0) { return lastComparison; } if (isSetIndexHandlerClass()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.indexHandlerClass, typedOther.indexHandlerClass); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetDbName()).compareTo(typedOther.isSetDbName()); if (lastComparison != 0) { return lastComparison; } if (isSetDbName()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dbName, typedOther.dbName); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetOrigTableName()).compareTo(typedOther.isSetOrigTableName()); if (lastComparison != 0) { return lastComparison; } if (isSetOrigTableName()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.origTableName, typedOther.origTableName); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetCreateTime()).compareTo(typedOther.isSetCreateTime()); if (lastComparison != 0) { return lastComparison; } if (isSetCreateTime()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.createTime, typedOther.createTime); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetLastAccessTime()).compareTo(typedOther.isSetLastAccessTime()); if (lastComparison != 0) { return lastComparison; } if (isSetLastAccessTime()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.lastAccessTime, typedOther.lastAccessTime); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetIndexTableName()).compareTo(typedOther.isSetIndexTableName()); if (lastComparison != 0) { return lastComparison; } if (isSetIndexTableName()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.indexTableName, typedOther.indexTableName); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetSd()).compareTo(typedOther.isSetSd()); if (lastComparison != 0) { return lastComparison; } if (isSetSd()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sd, typedOther.sd); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetParameters()).compareTo(typedOther.isSetParameters()); if (lastComparison != 0) { return lastComparison; } if (isSetParameters()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.parameters, typedOther.parameters); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetDeferredRebuild()).compareTo(typedOther.isSetDeferredRebuild()); if (lastComparison != 0) { return lastComparison; } if (isSetDeferredRebuild()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.deferredRebuild, typedOther.deferredRebuild); if (lastComparison != 0) { return lastComparison; } } return 0; } public _Fields fieldForId(int fieldId) { return _Fields.findByThriftId(fieldId); } public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { schemes.get(iprot.getScheme()).getScheme().read(iprot, this); } public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { schemes.get(oprot.getScheme()).getScheme().write(oprot, this); } @Override public String toString() { StringBuilder sb = new StringBuilder("Index("); boolean first = true; sb.append("indexName:"); if (this.indexName == null) { sb.append("null"); } else { sb.append(this.indexName); } first = false; if (!first) sb.append(", "); sb.append("indexHandlerClass:"); if (this.indexHandlerClass == null) { sb.append("null"); } else { sb.append(this.indexHandlerClass); } first = false; if (!first) sb.append(", "); sb.append("dbName:"); if (this.dbName == null) { sb.append("null"); } else { sb.append(this.dbName); } first = false; if (!first) sb.append(", "); sb.append("origTableName:"); if (this.origTableName == null) { sb.append("null"); } else { sb.append(this.origTableName); } first = false; if (!first) sb.append(", "); sb.append("createTime:"); sb.append(this.createTime); first = false; if (!first) sb.append(", "); sb.append("lastAccessTime:"); sb.append(this.lastAccessTime); first = false; if (!first) sb.append(", "); sb.append("indexTableName:"); if (this.indexTableName == null) { sb.append("null"); } else { sb.append(this.indexTableName); } first = false; if (!first) sb.append(", "); sb.append("sd:"); if (this.sd == null) { sb.append("null"); } else { sb.append(this.sd); } first = false; if (!first) sb.append(", "); sb.append("parameters:"); if (this.parameters == null) { sb.append("null"); } else { sb.append(this.parameters); } first = false; if (!first) sb.append(", "); sb.append("deferredRebuild:"); sb.append(this.deferredRebuild); first = false; sb.append(")"); return sb.toString(); } public void validate() throws org.apache.thrift.TException { // check for required fields // check for sub-struct validity if (sd != null) { sd.validate(); } } private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { try { write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } } private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { try { // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. __isset_bitfield = 0; read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } } private static class IndexStandardSchemeFactory implements SchemeFactory { public IndexStandardScheme getScheme() { return new IndexStandardScheme(); } } private static class IndexStandardScheme extends StandardScheme<Index> { public void read(org.apache.thrift.protocol.TProtocol iprot, Index struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; iprot.readStructBegin(); while (true) { schemeField = iprot.readFieldBegin(); if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { break; } switch (schemeField.id) { case 1: // INDEX_NAME if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.indexName = iprot.readString(); struct.setIndexNameIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 2: // INDEX_HANDLER_CLASS if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.indexHandlerClass = iprot.readString(); struct.setIndexHandlerClassIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 3: // DB_NAME if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.dbName = iprot.readString(); struct.setDbNameIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 4: // ORIG_TABLE_NAME if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.origTableName = iprot.readString(); struct.setOrigTableNameIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 5: // CREATE_TIME if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.createTime = iprot.readI32(); struct.setCreateTimeIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 6: // LAST_ACCESS_TIME if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.lastAccessTime = iprot.readI32(); struct.setLastAccessTimeIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 7: // INDEX_TABLE_NAME if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.indexTableName = iprot.readString(); struct.setIndexTableNameIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 8: // SD if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.sd = new StorageDescriptor(); struct.sd.read(iprot); struct.setSdIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 9: // PARAMETERS if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { { org.apache.thrift.protocol.TMap _map226 = iprot.readMapBegin(); struct.parameters = new HashMap<String,String>(2*_map226.size); for (int _i227 = 0; _i227 < _map226.size; ++_i227) { String _key228; // required String _val229; // required _key228 = iprot.readString(); _val229 = iprot.readString(); struct.parameters.put(_key228, _val229); } iprot.readMapEnd(); } struct.setParametersIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 10: // DEFERRED_REBUILD if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { struct.deferredRebuild = iprot.readBool(); struct.setDeferredRebuildIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } iprot.readFieldEnd(); } iprot.readStructEnd(); struct.validate(); } public void write(org.apache.thrift.protocol.TProtocol oprot, Index struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.indexName != null) { oprot.writeFieldBegin(INDEX_NAME_FIELD_DESC); oprot.writeString(struct.indexName); oprot.writeFieldEnd(); } if (struct.indexHandlerClass != null) { oprot.writeFieldBegin(INDEX_HANDLER_CLASS_FIELD_DESC); oprot.writeString(struct.indexHandlerClass); oprot.writeFieldEnd(); } if (struct.dbName != null) { oprot.writeFieldBegin(DB_NAME_FIELD_DESC); oprot.writeString(struct.dbName); oprot.writeFieldEnd(); } if (struct.origTableName != null) { oprot.writeFieldBegin(ORIG_TABLE_NAME_FIELD_DESC); oprot.writeString(struct.origTableName); oprot.writeFieldEnd(); } oprot.writeFieldBegin(CREATE_TIME_FIELD_DESC); oprot.writeI32(struct.createTime); oprot.writeFieldEnd(); oprot.writeFieldBegin(LAST_ACCESS_TIME_FIELD_DESC); oprot.writeI32(struct.lastAccessTime); oprot.writeFieldEnd(); if (struct.indexTableName != null) { oprot.writeFieldBegin(INDEX_TABLE_NAME_FIELD_DESC); oprot.writeString(struct.indexTableName); oprot.writeFieldEnd(); } if (struct.sd != null) { oprot.writeFieldBegin(SD_FIELD_DESC); struct.sd.write(oprot); oprot.writeFieldEnd(); } if (struct.parameters != null) { oprot.writeFieldBegin(PARAMETERS_FIELD_DESC); { oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.parameters.size())); for (Map.Entry<String, String> _iter230 : struct.parameters.entrySet()) { oprot.writeString(_iter230.getKey()); oprot.writeString(_iter230.getValue()); } oprot.writeMapEnd(); } oprot.writeFieldEnd(); } oprot.writeFieldBegin(DEFERRED_REBUILD_FIELD_DESC); oprot.writeBool(struct.deferredRebuild); oprot.writeFieldEnd(); oprot.writeFieldStop(); oprot.writeStructEnd(); } } private static class IndexTupleSchemeFactory implements SchemeFactory { public IndexTupleScheme getScheme() { return new IndexTupleScheme(); } } private static class IndexTupleScheme extends TupleScheme<Index> { @Override public void write(org.apache.thrift.protocol.TProtocol prot, Index struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); if (struct.isSetIndexName()) { optionals.set(0); } if (struct.isSetIndexHandlerClass()) { optionals.set(1); } if (struct.isSetDbName()) { optionals.set(2); } if (struct.isSetOrigTableName()) { optionals.set(3); } if (struct.isSetCreateTime()) { optionals.set(4); } if (struct.isSetLastAccessTime()) { optionals.set(5); } if (struct.isSetIndexTableName()) { optionals.set(6); } if (struct.isSetSd()) { optionals.set(7); } if (struct.isSetParameters()) { optionals.set(8); } if (struct.isSetDeferredRebuild()) { optionals.set(9); } oprot.writeBitSet(optionals, 10); if (struct.isSetIndexName()) { oprot.writeString(struct.indexName); } if (struct.isSetIndexHandlerClass()) { oprot.writeString(struct.indexHandlerClass); } if (struct.isSetDbName()) { oprot.writeString(struct.dbName); } if (struct.isSetOrigTableName()) { oprot.writeString(struct.origTableName); } if (struct.isSetCreateTime()) { oprot.writeI32(struct.createTime); } if (struct.isSetLastAccessTime()) { oprot.writeI32(struct.lastAccessTime); } if (struct.isSetIndexTableName()) { oprot.writeString(struct.indexTableName); } if (struct.isSetSd()) { struct.sd.write(oprot); } if (struct.isSetParameters()) { { oprot.writeI32(struct.parameters.size()); for (Map.Entry<String, String> _iter231 : struct.parameters.entrySet()) { oprot.writeString(_iter231.getKey()); oprot.writeString(_iter231.getValue()); } } } if (struct.isSetDeferredRebuild()) { oprot.writeBool(struct.deferredRebuild); } } @Override public void read(org.apache.thrift.protocol.TProtocol prot, Index struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(10); if (incoming.get(0)) { struct.indexName = iprot.readString(); struct.setIndexNameIsSet(true); } if (incoming.get(1)) { struct.indexHandlerClass = iprot.readString(); struct.setIndexHandlerClassIsSet(true); } if (incoming.get(2)) { struct.dbName = iprot.readString(); struct.setDbNameIsSet(true); } if (incoming.get(3)) { struct.origTableName = iprot.readString(); struct.setOrigTableNameIsSet(true); } if (incoming.get(4)) { struct.createTime = iprot.readI32(); struct.setCreateTimeIsSet(true); } if (incoming.get(5)) { struct.lastAccessTime = iprot.readI32(); struct.setLastAccessTimeIsSet(true); } if (incoming.get(6)) { struct.indexTableName = iprot.readString(); struct.setIndexTableNameIsSet(true); } if (incoming.get(7)) { struct.sd = new StorageDescriptor(); struct.sd.read(iprot); struct.setSdIsSet(true); } if (incoming.get(8)) { { org.apache.thrift.protocol.TMap _map232 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); struct.parameters = new HashMap<String,String>(2*_map232.size); for (int _i233 = 0; _i233 < _map232.size; ++_i233) { String _key234; // required String _val235; // required _key234 = iprot.readString(); _val235 = iprot.readString(); struct.parameters.put(_key234, _val235); } } struct.setParametersIsSet(true); } if (incoming.get(9)) { struct.deferredRebuild = iprot.readBool(); struct.setDeferredRebuildIsSet(true); } } } }
{ "content_hash": "961ffaf670a0901235faf9f98d2ffff6", "timestamp": "", "source": "github", "line_count": 1381, "max_line_length": 200, "avg_line_length": 33.629978276611155, "alnum_prop": 0.6559223133733825, "repo_name": "dayutianfei/impala-Q", "id": "19ff4f2b8ab20f963e1c961b7b4a9492247c5904", "size": "46443", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "thirdparty/hive-0.13.1-cdh5.3.2/src/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/Index.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "15836" }, { "name": "C++", "bytes": "5750170" }, { "name": "CMake", "bytes": "90614" }, { "name": "CSS", "bytes": "86925" }, { "name": "HTML", "bytes": "56" }, { "name": "Java", "bytes": "3897527" }, { "name": "Lex", "bytes": "21323" }, { "name": "Python", "bytes": "1228318" }, { "name": "Shell", "bytes": "131062" }, { "name": "Thrift", "bytes": "241288" }, { "name": "Yacc", "bytes": "80074" } ], "symlink_target": "" }
<?php namespace estvoyage\risingsun\comparison\unary; class blank extends equal { function __construct() { parent::__construct(''); } }
{ "content_hash": "01543dbd8944019ef33c64cf147741ad", "timestamp": "", "source": "github", "line_count": 9, "max_line_length": 53, "avg_line_length": 15.777777777777779, "alnum_prop": 0.6971830985915493, "repo_name": "estvoyage/risingsun", "id": "adca1fc3fa17de8f842db524748cfbe2ed85bcff", "size": "142", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/comparison/unary/blank.php", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "PHP", "bytes": "381281" } ], "symlink_target": "" }
<?php namespace backend\controllers; use Yii; use common\models\Slider; use common\models\SliderSearch; use backend\components\Controller; use yii\web\NotFoundHttpException; use yii\filters\VerbFilter; use yii\filters\AccessControl; use yii\web\UploadedFile; /** * SliderController implements the CRUD actions for Slider model. */ class SliderController extends Controller { public function behaviors() { return [ 'verbs' => [ 'class' => VerbFilter::className(), 'actions' => [ 'delete' => ['post'], ], ], 'access' => [ 'class' => AccessControl::className(), 'rules' => [ [ 'allow' => true, 'roles' => ['@'], ], ], ], ]; } /** * Lists all Slider models. * @return mixed */ public function actionIndex() { $searchModel = new SliderSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); $model = new Slider(); return $this->render('index', [ 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'model' => $model, ]); } /** * Displays a single Slider model. * @param string $id * @return mixed */ public function actionView($id) { return $this->render('view', [ 'model' => $this->findModel($id), ]); } /** * Creates a new Slider model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Slider(); if ($model->load(Yii::$app->request->post())) { if (isset($_FILES) && $_FILES) { $model->imageFile = UploadedFile::getInstance($model, 'imageFile'); if($model->imageFile){ $model->upload(); } } if($model->ord == ""){ $model->ord = 0; } if($model->save()){ return $this->redirect(['view', 'id' => $model->id]); } } else { return $this->render('create', [ 'model' => $model, ]); } } /** * Updates an existing Slider model. * If update is successful, the browser will be redirected to the 'view' page. * @param string $id * @return mixed */ public function actionUpdate($id) { $model = $this->findModel($id); if ($model->load(Yii::$app->request->post())) { if (isset($_FILES) && $_FILES) { $model->imageFile = UploadedFile::getInstance($model, 'imageFile'); if($model->imageFile){ $model->upload(); } } if($model->save()){ return $this->redirect(['view', 'id' => $model->id]); } } else { return $this->render('update', [ 'model' => $model, ]); } } /** * Deletes an existing Slider model. * If deletion is successful, the browser will be redirected to the 'index' page. * @param string $id * @return mixed */ public function actionDelete($id) { $this->findModel($id)->delete(); return $this->redirect(['index']); } /** * Finds the Slider model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return Slider the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Slider::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } } }
{ "content_hash": "573080a4f82f49010889fef40dfd77b5", "timestamp": "", "source": "github", "line_count": 154, "max_line_length": 85, "avg_line_length": 26.818181818181817, "alnum_prop": 0.4801452784503632, "repo_name": "James88/www.yii2.com", "id": "37241ef713dee5597be9fa3dddef3075412c5266", "size": "4130", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "backend/controllers/SliderController.php", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "ApacheConf", "bytes": "228" }, { "name": "Batchfile", "bytes": "1541" }, { "name": "CSS", "bytes": "71810" }, { "name": "HTML", "bytes": "7917" }, { "name": "JavaScript", "bytes": "241140" }, { "name": "PHP", "bytes": "829626" } ], "symlink_target": "" }
module LookML module Test class YAMLTest attr_reader :group attr_reader :title def initialize(hash, group: nil) @group = group @title = hash["test"] @query = hash["query"] @assertions = [hash["assert"]].flatten.map do |definition| if definition == "success" Assertion.new else raise "Unknown assertion #{definition}" end end if @assertions.length == 0 raise "'assert' not defined for #{@title}" end end def run!(runner) begin result = runner.sdk.run_inline_query("json_detail", @query) rescue LookerSDK::NotFound return [false, "Looker returned a 404 error for this query. Are the model and explore name correct?"] end @assertions.each do |assertion| (success, msg) = assertion.assert(result) return [success, msg] unless success end return [true, nil] end end end end
{ "content_hash": "a545cb7f209d4c27c192e2499c1bbfd3", "timestamp": "", "source": "github", "line_count": 40, "max_line_length": 111, "avg_line_length": 25.75, "alnum_prop": 0.5563106796116505, "repo_name": "looker/lookml-test-runner", "id": "e15de584b1be686bdd670b3a748f254fd1b4e9a2", "size": "1030", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/lookml/test/yaml_test.rb", "mode": "33188", "license": "mit", "language": [ { "name": "Ruby", "bytes": "8186" }, { "name": "Shell", "bytes": "131" } ], "symlink_target": "" }
package models; import javax.persistence.*; import play.db.ebean.*; import java.util.Date; @Entity @Table(schema = "salesforce", name = "session__c") public class Session extends Model { @Id public String Id; public String Name; public static Finder<Long, Session> find = new Finder<Long, Session>(Long.class, Session.class); }
{ "content_hash": "243b59521c546f62d814e698c5715e93", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 100, "avg_line_length": 17.55, "alnum_prop": 0.698005698005698, "repo_name": "developerforce/salesforce-developer-workshop-java", "id": "dc66b4a727f570e998f40e5c82348343173bd509", "size": "351", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "app/models/Session.java", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
'use strict'; /*global setTimeout, exports, require*/ var File = java.io.File; /************************************************************************ ## The watcher Module This module exposes functions for watching for changes to files or directories. ### watcher.watchFile() function Watches for changes to the given file or directory and calls the function provided when the file changes. #### Parameters * File - the file to watch (can be a file or directory) * Callback - The callback to invoke when the file has changed. The callback takes the changed file as a parameter. #### Example ```javascript var watcher = require('watcher'); watcher.watchFile( 'test.txt', function( file ) { console.log( file + ' has changed'); }); ``` ***/ var filesWatched = {}; var dirsWatched = {}; exports.watchFile = function( file, callback ) { if ( typeof file == 'string' ) { file = new File(file); } filesWatched[file.canonicalPath] = { callback: callback, lastModified: file.lastModified() }; }; /************************************************************************ ### watcher.watchDir() function Watches for changes to the given directory and calls the function provided when the directory changes. It works by calling watchFile/watchDir for each file/subdirectory. #### Parameters * Dir - the file to watch (can be a file or directory) * Callback - The callback to invoke when the directory has changed. The callback takes the changed file as a parameter. For each change inside the directory the callback will also be called. #### Example ```javascript var watcher = require('watcher'); watcher.watchDir( 'players/_ial', function( dir ) { console.log( dir + ' has changed'); }); ``` ***/ exports.watchDir = function( dir, callback ) { if ( typeof dir == 'string' ) { dir = new File(dir); } dirsWatched[dir.canonicalPath] = { callback: callback, lastModified: dir.lastModified() }; var files = dir.listFiles(),file; if ( !files ) { return; } for ( var i = 0; i < files.length; i++ ) { file = files[i]; if (file.isDirectory( )) { exports.watchDir(file,callback); }else{ exports.watchFile(file,callback); } } }; /************************************************************************ ### watcher.unwatchFile() function Removes a file from the watch list. #### Example ```javascript var watcher = require('watcher'); watcher.unwatchFile('test.txt'); ``` ***/ exports.unwatchFile = function( file, callback ) { if ( typeof file == 'string' ) { file = new File(file); } delete filesWatched[file.canonicalPath]; }; /************************************************************************ ### watcher.unwatchDir() function Removes a directory from the watch list and all files inside the directory are also "unwatched" #### Example ```javascript var watcher = require('watcher'); watcher.unwatchDir ('players/_ial'); ``` Would cause also ```javascript watcher.unwatchFile (file); ``` for each file inside directory (and unwatchDir for each directory inside it) ***/ exports.unwatchDir = function( dir, callback ) { if ( typeof dir == 'string' ) { dir = new File(dir); } delete dirsWatched[dir.canonicalPath]; var files = dir.listFiles(),file; if ( !files ) { return; } for ( var i = 0; i < files.length; i++ ) { file = files[i]; if (file.isDirectory( )) { exports.unwatchDir(file,callback); }else{ exports.unwatchFile(file,callback); } } }; function fileWatcher(calledCallbacks) { for (var file in filesWatched) { var fileObject = new File(file); var lm = fileObject.lastModified(); if ( lm != filesWatched[file].lastModified ) { filesWatched[file].lastModified = lm; filesWatched[file].callback(fileObject); if (!fileObject.exists()) { exports.unwatchFile(file,filesWatched[file].callback); } } } }; //monitors directories for time change //when a change is detected watchFiles are invoked for each of the files in directory //and callback is called function dirWatcher(calledCallbacks) { for (var dir in dirsWatched) { var dirObject = new File(dir); var lm = dirObject.lastModified(); var dw = dirsWatched[dir]; if ( lm != dirsWatched[dir].lastModified ) { dirsWatched[dir].lastModified = lm; dirsWatched[dir].callback(dirObject); exports.unwatchDir(dir, dw.callback); //causes all files to be rewatched if (dirObject.exists()) { exports.watchDir(dir, dw.callback); } } } }; //guarantees that a callback is only called once for each change function monitorDirAndFiles() { fileWatcher (); dirWatcher (); setTimeout( monitorDirAndFiles, 3000 ); }; setTimeout( monitorDirAndFiles, 3000 );
{ "content_hash": "8ca95e582741b7d2aad3e0f7ed759f97", "timestamp": "", "source": "github", "line_count": 189, "max_line_length": 87, "avg_line_length": 25.756613756613756, "alnum_prop": 0.6207888249794576, "repo_name": "itrion/ScriptCraft", "id": "7970d6c8332cda12a34775eaf9fd8a5ba7b25e0d", "size": "4868", "binary": false, "copies": "8", "ref": "refs/heads/master", "path": "src/main/js/modules/watcher.js", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "9253" }, { "name": "JavaScript", "bytes": "363831" } ], "symlink_target": "" }
/** * 前一个练习不是很面向对象。提供一个通用的超类 UnitConversion * 并定义扩展该超类的 InchesToCentimeters,GallonsToLiters 和 MilesToKilometers 对象 */ abstract class UnitConversion(val factor:Double){ def convert(value: Double): Double = factor * value } object InchesToSantimeters extends UnitConversion(2.54) object GallonsToLiters extends UnitConversion(3.78541178) object MilesToKilometers extends UnitConversion(1.609344)
{ "content_hash": "11185d12e5ea43d7d54f3faafc989940", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 71, "avg_line_length": 39.8, "alnum_prop": 0.8266331658291457, "repo_name": "vernonzheng/scala-for-the-Impatient", "id": "1a1857c70d2cfcdc68bf7021a26208affce7bac1", "size": "466", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/Chapter06/exercise02.scala", "mode": "33188", "license": "mit", "language": [ { "name": "Scala", "bytes": "72681" } ], "symlink_target": "" }
--- id: 5a24c314108439a4d4036183 title: Use Advanced JavaScript in React Render Method challengeType: 6 forumTopicId: 301415 dashedName: use-advanced-javascript-in-react-render-method --- # --description-- In previous challenges, you learned how to inject JavaScript code into JSX code using curly braces, `{ }`, for tasks like accessing props, passing props, accessing state, inserting comments into your code, and most recently, styling your components. These are all common use cases to put JavaScript in JSX, but they aren't the only way that you can utilize JavaScript code in your React components. You can also write JavaScript directly in your `render` methods, before the `return` statement, ***without*** inserting it inside of curly braces. This is because it is not yet within the JSX code. When you want to use a variable later in the JSX code *inside* the `return` statement, you place the variable name inside curly braces. # --instructions-- In the code provided, the `render` method has an array that contains 20 phrases to represent the answers found in the classic 1980's Magic Eight Ball toy. The button click event is bound to the `ask` method, so each time the button is clicked a random number will be generated and stored as the `randomIndex` in state. On line 52, delete the string `change me!` and reassign the `answer` const so your code randomly accesses a different index of the `possibleAnswers` array each time the component updates. Finally, insert the `answer` const inside the `p` tags. # --hints-- The `MagicEightBall` component should exist and should render to the page. ```js assert.strictEqual( Enzyme.mount(React.createElement(MagicEightBall)).find('MagicEightBall') .length, 1 ); ``` `MagicEightBall`'s first child should be an `input` element. ```js assert.strictEqual( Enzyme.mount(React.createElement(MagicEightBall)) .children() .childAt(0) .name(), 'input' ); ``` `MagicEightBall`'s third child should be a `button` element. ```js assert.strictEqual( Enzyme.mount(React.createElement(MagicEightBall)) .children() .childAt(2) .name(), 'button' ); ``` `MagicEightBall`'s state should be initialized with a property of `userInput` and a property of `randomIndex` both set to a value of an empty string. ```js assert( Enzyme.mount(React.createElement(MagicEightBall)).state('randomIndex') === '' && Enzyme.mount(React.createElement(MagicEightBall)).state('userInput') === '' ); ``` When `MagicEightBall` is first mounted to the DOM, it should return an empty `p` element. ```js assert( Enzyme.mount(React.createElement(MagicEightBall)).find('p').length === 1 && Enzyme.mount(React.createElement(MagicEightBall)).find('p').text() === '' ); ``` When text is entered into the `input` element and the button is clicked, the `MagicEightBall` component should return a `p` element that contains a random element from the `possibleAnswers` array. ```js (() => { const comp = Enzyme.mount(React.createElement(MagicEightBall)); const simulate = () => { comp.find('input').simulate('change', { target: { value: 'test?' } }); comp.find('button').simulate('click'); }; const result = () => comp.find('p').text(); const _1 = () => { simulate(); return result(); }; const _2 = () => { simulate(); return result(); }; const _3 = () => { simulate(); return result(); }; const _4 = () => { simulate(); return result(); }; const _5 = () => { simulate(); return result(); }; const _6 = () => { simulate(); return result(); }; const _7 = () => { simulate(); return result(); }; const _8 = () => { simulate(); return result(); }; const _9 = () => { simulate(); return result(); }; const _10 = () => { simulate(); return result(); }; const _1_val = _1(); const _2_val = _2(); const _3_val = _3(); const _4_val = _4(); const _5_val = _5(); const _6_val = _6(); const _7_val = _7(); const _8_val = _8(); const _9_val = _9(); const _10_val = _10(); const actualAnswers = [ _1_val, _2_val, _3_val, _4_val, _5_val, _6_val, _7_val, _8_val, _9_val, _10_val ]; const hasIndex = actualAnswers.filter( (answer, i) => possibleAnswers.indexOf(answer) !== -1 ); const notAllEqual = new Set(actualAnswers); assert(notAllEqual.size > 1 && hasIndex.length === 10); })(); ``` # --seed-- ## --after-user-code-- ```jsx var possibleAnswers = [ 'It is certain', 'It is decidedly so', 'Without a doubt', 'Yes, definitely', 'You may rely on it', 'As I see it, yes', 'Outlook good', 'Yes', 'Signs point to yes', 'Reply hazy try again', 'Ask again later', 'Better not tell you now', 'Cannot predict now', 'Concentrate and ask again', "Don't count on it", 'My reply is no', 'My sources say no', 'Outlook not so good', 'Very doubtful', 'Most likely' ]; ReactDOM.render(<MagicEightBall />, document.getElementById('root')); ``` ## --seed-contents-- ```jsx const inputStyle = { width: 235, margin: 5 }; class MagicEightBall extends React.Component { constructor(props) { super(props); this.state = { userInput: '', randomIndex: '' }; this.ask = this.ask.bind(this); this.handleChange = this.handleChange.bind(this); } ask() { if (this.state.userInput) { this.setState({ randomIndex: Math.floor(Math.random() * 20), userInput: '' }); } } handleChange(event) { this.setState({ userInput: event.target.value }); } render() { const possibleAnswers = [ 'It is certain', 'It is decidedly so', 'Without a doubt', 'Yes, definitely', 'You may rely on it', 'As I see it, yes', 'Outlook good', 'Yes', 'Signs point to yes', 'Reply hazy try again', 'Ask again later', 'Better not tell you now', 'Cannot predict now', 'Concentrate and ask again', "Don't count on it", 'My reply is no', 'My sources say no', 'Most likely', 'Outlook not so good', 'Very doubtful' ]; const answer = 'change me!'; // Change this line return ( <div> <input type='text' value={this.state.userInput} onChange={this.handleChange} style={inputStyle} /> <br /> <button onClick={this.ask}>Ask the Magic Eight Ball!</button> <br /> <h3>Answer:</h3> <p> {/* Change code below this line */} {/* Change code above this line */} </p> </div> ); } } ``` # --solutions-- ```jsx const inputStyle = { width: 235, margin: 5 }; class MagicEightBall extends React.Component { constructor(props) { super(props); this.state = { userInput: '', randomIndex: '' }; this.ask = this.ask.bind(this); this.handleChange = this.handleChange.bind(this); } ask() { if (this.state.userInput) { this.setState({ randomIndex: Math.floor(Math.random() * 20), userInput: '' }); } } handleChange(event) { this.setState({ userInput: event.target.value }); } render() { const possibleAnswers = [ 'It is certain', 'It is decidedly so', 'Without a doubt', 'Yes, definitely', 'You may rely on it', 'As I see it, yes', 'Outlook good', 'Yes', 'Signs point to yes', 'Reply hazy try again', 'Ask again later', 'Better not tell you now', 'Cannot predict now', 'Concentrate and ask again', "Don't count on it", 'My reply is no', 'My sources say no', 'Outlook not so good', 'Very doubtful', 'Most likely' ]; const answer = possibleAnswers[this.state.randomIndex]; return ( <div> <input type='text' value={this.state.userInput} onChange={this.handleChange} style={inputStyle} /> <br /> <button onClick={this.ask}>Ask the Magic Eight Ball!</button> <br /> <h3>Answer:</h3> <p>{answer}</p> </div> ); } } ```
{ "content_hash": "1c7100d50c8b1877942f7621341e1c41", "timestamp": "", "source": "github", "line_count": 334, "max_line_length": 562, "avg_line_length": 24.769461077844312, "alnum_prop": 0.5997824247552278, "repo_name": "FreeCodeCamp/FreeCodeCamp", "id": "d9bccebbf2f75477f8bec37cd422ad85a4a3ab60", "size": "8273", "binary": false, "copies": "2", "ref": "refs/heads/i18n-sync-client", "path": "curriculum/challenges/english/03-front-end-development-libraries/react/use-advanced-javascript-in-react-render-method.md", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "CSS", "bytes": "190263" }, { "name": "HTML", "bytes": "160430" }, { "name": "JavaScript", "bytes": "546299" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>{% if page.title %}{{ page.title }}{% else %}{{ site.name }}{% endif %}</title> <link rel="stylesheet" href="//fonts.googleapis.com/css?family=Source+Sans+Pro:300,300i,600"> <link rel="stylesheet" href="{{ site.baseurl }}/style.css"> <link rel="alternate" type="application/rss+xml" title="RSS Feed for {{ site.name }}" href="{{ site.baseurl }}/feed.xml" /> <!--Google Analytics--> {% if site.google_analytics %} <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', '{{ site.google_analytics }}', 'auto'); ga('send', 'pageview'); $("script[type='math/tex']").replaceWith( function(){ var tex = $(this).text(); return "<span class=\"inline-equation\">" + katex.renderToString(tex) + "</span>"; }); $("script[type='math/tex; mode=display']").replaceWith( function(){ var tex = $(this).text(); return "<div class=\"equation\">" + katex.renderToString("\\displaystyle "+tex) + "</div>"; }); </script> <!-- Load jQuery --> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!-- Load KaTeX --> <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.1.1/katex.min.css"> <script src="//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.1.1/katex.min.js"></script> <script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script> {% endif %} </head> <body> <div class="container"> {{ content }} </div> </body> </html>
{ "content_hash": "79f276482b7689d5d6930c1a5cf584ed", "timestamp": "", "source": "github", "line_count": 51, "max_line_length": 125, "avg_line_length": 38.94117647058823, "alnum_prop": 0.6007049345417925, "repo_name": "CISprague/Astro.IQ", "id": "11515e04437f02fac15720ba2f22d57c37a33014", "size": "1986", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "docs/_layouts/default.html", "mode": "33188", "license": "mit", "language": [ { "name": "Jupyter Notebook", "bytes": "2691465" }, { "name": "Python", "bytes": "46522" } ], "symlink_target": "" }
description: This template allows you to create an HDInsight cluster running Linux. This template also creates an Azure Storage account. The SSH authentication method for the cluster is username / public key. page_type: sample products: - azure - azure-resource-manager urlFragment: hdinsight-linux-ssh-publickey languages: - json --- # Deploy HDInsight on Linux (w/ Azure Storage, SSH key) ![Azure Public Test Date](https://azurequickstartsservice.blob.core.windows.net/badges/quickstarts/microsoft.hdinsight/hdinsight-linux-ssh-publickey/PublicLastTestDate.svg) ![Azure Public Test Result](https://azurequickstartsservice.blob.core.windows.net/badges/quickstarts/microsoft.hdinsight/hdinsight-linux-ssh-publickey/PublicDeployment.svg) ![Azure US Gov Last Test Date](https://azurequickstartsservice.blob.core.windows.net/badges/quickstarts/microsoft.hdinsight/hdinsight-linux-ssh-publickey/FairfaxLastTestDate.svg) ![Azure US Gov Last Test Result](https://azurequickstartsservice.blob.core.windows.net/badges/quickstarts/microsoft.hdinsight/hdinsight-linux-ssh-publickey/FairfaxDeployment.svg) ![Best Practice Check](https://azurequickstartsservice.blob.core.windows.net/badges/quickstarts/microsoft.hdinsight/hdinsight-linux-ssh-publickey/BestPracticeResult.svg) ![Cred Scan Check](https://azurequickstartsservice.blob.core.windows.net/badges/quickstarts/microsoft.hdinsight/hdinsight-linux-ssh-publickey/CredScanResult.svg) [![Deploy To Azure](https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/1-CONTRIBUTION-GUIDE/images/deploytoazure.svg?sanitize=true)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2Fquickstarts%2Fmicrosoft.hdinsight%2Fhdinsight-linux-ssh-publickey%2Fazuredeploy.json) [![Deploy To Azure US Gov](https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/1-CONTRIBUTION-GUIDE/images/deploytoazuregov.svg?sanitize=true)](https://portal.azure.us/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2Fquickstarts%2Fmicrosoft.hdinsight%2Fhdinsight-linux-ssh-publickey%2Fazuredeploy.json) [![Visualize](https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/1-CONTRIBUTION-GUIDE/images/visualizebutton.svg?sanitize=true)](http://armviz.io/#/?load=https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2Fquickstarts%2Fmicrosoft.hdinsight%2Fhdinsight-linux-ssh-publickey%2Fazuredeploy.json) This template allows you to create an HDInsight cluster running Linux (with Azure Storage) with an SSH public key. If you are new to template deployment, see: [Azure Resource Manager documentation](https://docs.microsoft.com/azure/azure-resource-manager/) `Tags: Microsoft.Storage/storageAccounts, Microsoft.HDInsight/clusters`
{ "content_hash": "8266f2f9fd0fc25c8fdfe872bb9a4d21", "timestamp": "", "source": "github", "line_count": 29, "max_line_length": 394, "avg_line_length": 99.79310344827586, "alnum_prop": 0.8324118866620595, "repo_name": "Azure/azure-quickstart-templates", "id": "85816ecfae4abaa5971000fe684e9f1f5ba38563", "size": "2898", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "quickstarts/microsoft.hdinsight/hdinsight-linux-ssh-publickey/README.md", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "852" }, { "name": "Bicep", "bytes": "1307140" }, { "name": "C#", "bytes": "13071" }, { "name": "CSS", "bytes": "8505" }, { "name": "Dockerfile", "bytes": "186" }, { "name": "Groovy", "bytes": "1715" }, { "name": "HCL", "bytes": "7632" }, { "name": "HTML", "bytes": "5143" }, { "name": "HiveQL", "bytes": "613" }, { "name": "Java", "bytes": "6880" }, { "name": "JavaScript", "bytes": "1067401" }, { "name": "PowerShell", "bytes": "1205333" }, { "name": "Python", "bytes": "27862" }, { "name": "Shell", "bytes": "1232774" }, { "name": "Solidity", "bytes": "247" }, { "name": "TSQL", "bytes": "66" }, { "name": "XSLT", "bytes": "4429" } ], "symlink_target": "" }
<!-- new GDS navigation pattern --> <div class="content-width big-space"> <nav id="nav" class="menu"> <div class="navbar"> <ul class="navbar__list-items menu-left"> <li class="navlink active"> <a href="/v24/wirs/licences">View licences</a> </li> <li class="navlink"> <a href="/v24/wirs/returns/find-return">Manage returns</a> </li> </ul> </div> </nav> </div>
{ "content_hash": "3e07128428894282781c5d120b293312", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 68, "avg_line_length": 24.333333333333332, "alnum_prop": 0.541095890410959, "repo_name": "christinagyles-ea/water", "id": "ea3716c84de7f9e82668fc3953011511b7264557", "size": "438", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/v6/views/v24/partials/nav-wirs-view.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "7565" }, { "name": "HTML", "bytes": "291991" }, { "name": "JavaScript", "bytes": "39109" }, { "name": "Shell", "bytes": "1495" } ], "symlink_target": "" }
package org.apache.activemq.artemis.tests.integration.openwire.amq; import java.util.Arrays; import java.util.Collection; import javax.jms.DeliveryMode; import javax.jms.Message; import javax.jms.MessageConsumer; import javax.jms.Session; import org.apache.activemq.ActiveMQConnection; import org.apache.activemq.command.ActiveMQDestination; import org.apache.activemq.artemis.tests.integration.openwire.BasicOpenWireTest; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; /** * adapted from: org.apache.activemq.JMSConsumerTest */ @RunWith(Parameterized.class) public class JMSConsumer11Test extends BasicOpenWireTest { @Parameterized.Parameters(name = "deliveryMode={0}") public static Collection<Object[]> getParams() { return Arrays.asList(new Object[][]{{DeliveryMode.NON_PERSISTENT}, {DeliveryMode.PERSISTENT}}); } public int deliveryMode; public JMSConsumer11Test(int deliveryMode) { this.deliveryMode = deliveryMode; } @Test public void testPrefetch1MessageNotDispatched() throws Exception { // Set prefetch to 1 connection.getPrefetchPolicy().setAll(1); connection.start(); Session session = connection.createSession(true, 0); ActiveMQDestination destination = createDestination(session, ActiveMQDestination.QUEUE_TYPE); MessageConsumer consumer = session.createConsumer(destination); // Send 2 messages to the destination. sendMessages(session, destination, 2); session.commit(); // The prefetch should fill up with 1 message. // Since prefetch is still full, the 2nd message should get dispatched // to another consumer.. lets create the 2nd consumer test that it does // make sure it does. ActiveMQConnection connection2 = (ActiveMQConnection) factory.createConnection(); connection2.start(); Session session2 = connection2.createSession(true, 0); MessageConsumer consumer2 = session2.createConsumer(destination); System.out.println("consumer receiving ..."); // Pick up the first message. Message message1 = consumer.receive(1000); System.out.println("received1: " + message1); assertNotNull(message1); System.out.println("consumer 2 receiving..."); // Pick up the 2nd messages. Message message2 = consumer2.receive(5000); System.out.println("received2: " + message2); assertNotNull(message2); System.out.println("committing sessions !! " + session.getClass().getName()); session.commit(); System.out.println("committed session, now 2"); session2.commit(); System.out.println("all committed"); Message m = consumer.receiveNoWait(); System.out.println("received 3: " + m); assertNull(m); try { connection2.close(); } catch (Throwable e) { System.err.println("exception e: " + e); e.printStackTrace(); } System.out.println("Test finished!!"); } }
{ "content_hash": "b2da337c6eb046b141f17cf39268c52c", "timestamp": "", "source": "github", "line_count": 92, "max_line_length": 101, "avg_line_length": 32.94565217391305, "alnum_prop": 0.7007588254701419, "repo_name": "glaucio-melo-movile/activemq-artemis", "id": "c4be09317da70412635a3c13e26183f182b1e12d", "size": "3830", "binary": false, "copies": "6", "ref": "refs/heads/master", "path": "tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JMSConsumer11Test.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "5879" }, { "name": "C", "bytes": "23262" }, { "name": "C++", "bytes": "1032" }, { "name": "CMake", "bytes": "4260" }, { "name": "CSS", "bytes": "11732" }, { "name": "HTML", "bytes": "19113" }, { "name": "Java", "bytes": "22822527" }, { "name": "Shell", "bytes": "11911" } ], "symlink_target": "" }
pub struct GraphemeBytesIter<'a> { source: &'a str, offset: usize, grapheme_count: usize, } impl<'a> GraphemeBytesIter<'a> { /// Creates a new grapheme iterator from a string source. pub fn new(source: &'a str) -> GraphemeBytesIter<'a> { GraphemeBytesIter { source, offset: 0, grapheme_count: 0, } } } impl<'a> Iterator for GraphemeBytesIter<'a> { type Item = &'a [u8]; fn next(&mut self) -> Option<&'a [u8]> { let mut result: Option<&[u8]> = None; let mut idx = self.offset; for _ in self.offset..self.source.len() { idx += 1; if self.offset < self.source.len() { if self.source.is_char_boundary(idx) { let slice: &[u8] = self.source[self.offset..idx].as_bytes(); self.grapheme_count += 1; self.offset = idx; result = Some(slice); break; } } } result } } impl<'a> ExactSizeIterator for GraphemeBytesIter<'a> { fn len(&self) -> usize { self.source.chars().count() } } /// ToGraphemeBytesIter - create an iterator to return bytes for each grapheme in a string. pub trait ToGraphemeBytesIter<'a> { /// Returns a GraphemeBytesIter which you may iterate over. /// /// # Example /// ``` /// use array_tool::string::ToGraphemeBytesIter; /// /// let string = "a s—d féZ"; /// let mut graphemes = string.grapheme_bytes_iter(); /// graphemes.skip(3).next(); /// ``` /// /// # Output /// ```text /// [226, 128, 148] /// ``` fn grapheme_bytes_iter(&'a self) -> GraphemeBytesIter<'a>; } impl<'a> ToGraphemeBytesIter<'a> for str { fn grapheme_bytes_iter(&'a self) -> GraphemeBytesIter<'a> { GraphemeBytesIter::new(&self) } } /// Squeeze - squeezes duplicate characters down to one each pub trait Squeeze { /// # Example /// ``` /// use array_tool::string::Squeeze; /// /// "yellow moon".squeeze(""); /// ``` /// /// # Output /// ```text /// "yelow mon" /// ``` fn squeeze(&self, targets: &'static str) -> String; } impl Squeeze for str { fn squeeze(&self, targets: &'static str) -> String { let mut output = Vec::<u8>::with_capacity(self.len()); let everything: bool = targets.is_empty(); let chars = targets.grapheme_bytes_iter().collect::<Vec<&[u8]>>(); let mut last: &[u8] = &[0]; for character in self.grapheme_bytes_iter() { if last != character { output.extend_from_slice(character); } else if !(everything || chars.contains(&character)) { output.extend_from_slice(character); } last = character; } String::from_utf8(output).expect("squeeze failed to render String!") } } /// Justify - expand line to given width. pub trait Justify { /// # Example /// ``` /// use array_tool::string::Justify; /// /// "asd asdf asd".justify_line(14); /// ``` /// /// # Output /// ```text /// "asd asdf asd" /// ``` fn justify_line(&self, width: usize) -> String; } impl Justify for str { fn justify_line(&self, width: usize) -> String { if self.is_empty() { return format!("{}", self); }; let trimmed = self.trim(); let len = trimmed.chars().count(); if len >= width { return self.to_string(); }; let difference = width - len; let iter = trimmed.split_whitespace(); let spaces = iter.count() - 1; let mut iter = trimmed.split_whitespace().peekable(); if spaces == 0 { return self.to_string(); } let mut obj = String::with_capacity(trimmed.len() + spaces); let div = difference / spaces; let mut remainder = difference % spaces; while let Some(x) = iter.next() { obj.push_str(x); let val = if remainder > 0 { remainder = remainder - 1; div + 1 } else { div }; for _ in 0..val + 1 { if let Some(_) = iter.peek() { // Don't add spaces if last word obj.push_str(" "); } } } obj } } /// Substitute string character for each index given. pub trait SubstMarks { /// # Example /// ``` /// use array_tool::string::SubstMarks; /// /// "asdf asdf asdf".subst_marks(vec![0,5,8], "Z"); /// ``` /// /// # Output /// ```text /// "Zsdf ZsdZ asdf" /// ``` fn subst_marks(&self, marks: Vec<usize>, chr: &'static str) -> String; } impl SubstMarks for str { fn subst_marks(&self, marks: Vec<usize>, chr: &'static str) -> String { let mut output = Vec::<u8>::with_capacity(self.len()); let mut count = 0; let mut last = 0; for i in 0..self.len() { let idx = i + 1; if self.is_char_boundary(idx) { if marks.contains(&count) { count += 1; last = idx; output.extend_from_slice(chr.as_bytes()); continue; } let slice: &[u8] = self[last..idx].as_bytes(); output.extend_from_slice(slice); count += 1; last = idx } } String::from_utf8(output).expect("subst_marks failed to render String!") } } /// After whitespace pub trait AfterWhitespace { /// Given offset method will seek from there to end of string to find the first /// non white space. Resulting value is counted from offset. /// /// # Example /// ``` /// use array_tool::string::AfterWhitespace; /// /// assert_eq!( /// "asdf asdf asdf".seek_end_of_whitespace(6), /// Some(9) /// ); /// ``` fn seek_end_of_whitespace(&self, offset: usize) -> Option<usize>; } impl AfterWhitespace for str { fn seek_end_of_whitespace(&self, offset: usize) -> Option<usize> { if self.len() < offset { return None; }; let mut seeker = self[offset..self.len()].chars(); let mut val = None; let mut indx = 0; while let Some(x) = seeker.next() { if x.ne(&" ".chars().next().unwrap()) { val = Some(indx); break; } indx += 1; } val } } /// Word wrapping pub trait WordWrap { /// White space is treated as valid content and new lines will only be swapped in for /// the last white space character at the end of the given width. White space may reach beyond /// the width you've provided. You will need to trim end of lines in your own output (e.g. /// splitting string at each new line and printing the line with trim_right). Or just trust /// that lines that are beyond the width are just white space and only print the width - /// ignoring tailing white space. /// /// # Example /// ``` /// use array_tool::string::WordWrap; /// /// "asd asdf asd".word_wrap(8); /// ``` /// /// # Output /// ```text /// "asd asdf\nasd" /// ``` fn word_wrap(&self, width: usize) -> String; } // No need to worry about character encoding since we're only checking for the // space and new line characters. impl WordWrap for &'static str { fn word_wrap(&self, width: usize) -> String { let mut markers = vec![]; fn wordwrap( t: &'static str, chunk: usize, offset: usize, mrkrs: &mut Vec<usize>, ) -> String { match t[offset..*vec![offset + chunk, t.len()].iter().min().unwrap()].rfind("\n") { None => { match t[offset..*vec![offset + chunk, t.len()].iter().min().unwrap()].rfind(" ") { Some(x) => { let mut eows = x; // end of white space if offset + chunk < t.len() { // check if white space continues match t.seek_end_of_whitespace(offset + x) { Some(a) => { if a.ne(&0) { eows = x + a - 1; } } None => {} } } if offset + chunk < t.len() { // safe to seek ahead by 1 or not end of string if !["\n".chars().next().unwrap(), " ".chars().next().unwrap()] .contains( &t[offset + eows + 1..offset + eows + 2] .chars() .next() .unwrap(), ) { mrkrs.push(offset + eows) } }; wordwrap(t, chunk, offset + eows + 1, mrkrs) } None => { if offset + chunk < t.len() { // String may continue wordwrap(t, chunk, offset + 1, mrkrs) // Recurse + 1 until next space } else { return t.subst_marks(mrkrs.to_vec(), "\n"); } } } } Some(x) => wordwrap(t, chunk, offset + x + 1, mrkrs), } } wordwrap(self, width + 1, 0, &mut markers) } }
{ "content_hash": "0b6658bb5f5004fb06a91b652fb1203b", "timestamp": "", "source": "github", "line_count": 315, "max_line_length": 101, "avg_line_length": 32.48571428571429, "alnum_prop": 0.44893970487638035, "repo_name": "danielpclark/array_tool", "id": "a1e0afa9ae43dee195669f2f553b5831efab5255", "size": "10681", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/string.rs", "mode": "33188", "license": "mit", "language": [ { "name": "Rust", "bytes": "50613" } ], "symlink_target": "" }
'use strict'; var pluginPath = '../index'; var axeCore = require(pluginPath); var gulp = require('gulp'); var path = require('path'); var fs = require('fs-extra'); var assert = require('assert'); var sassert = require('stream-assert'); require('mocha'); var fixtures = function(glob) { return path.join(__dirname, './fixtures', glob); } function fileExists(filePath) { try { return fs.statSync(filePath).isFile(); } catch (err) { return false; } } describe('gulp-axe-core', function() { var output; var write = process.stdout.write; this.timeout(30000); beforeEach(function(done) { var folder = path.join(__dirname, 'temp'); output = ''; process.stdout.write = function(str) { output += str; }; fs.remove(folder, done); }); afterEach(function() { process.stdout.write = write; }); describe('using Chrome', function() { it('should pass the a11y validation', function (done) { gulp.src(fixtures('working.html')) .pipe(axeCore()) .pipe(sassert.end(function() { assert.notEqual(output.match(/Found no accessibility violations./gi), null); assert.notEqual(output.match(/(File to test|test\/fixtures\/working.html)/gi), null); done(); })); }); it('should not pass the a11y validation', function (done) { gulp.src(fixtures('broken.html')) .pipe(axeCore()) .pipe(sassert.end(function() { assert.notEqual(output.match(/Found 3 accessibility violations/gi), null); assert.notEqual(output.match(/(File to test|test\/fixtures\/broken.html)/gi), null); done(); })); }); it('should create JSON file with the results', function (done) { var options = { saveOutputIn: 'allHtml.json', folderOutputReport: path.join(__dirname, 'temp') }; var expected = path.join(__dirname, 'temp', 'allHtml.json'); gulp.src(fixtures('broken.html')) .pipe(axeCore(options)) .pipe(sassert.end(function() { assert(fileExists(expected), true); done(); })); }); }) describe('using PhantomJS', function() { it('should pass the a11y validation', function (done) { var options = { browser: 'phantomjs' }; gulp.src(fixtures('working.html')) .pipe(axeCore(options)) .pipe(sassert.end(function() { assert.notEqual(output.match(/Found no accessibility violations./gi), null); assert.notEqual(output.match(/(File to test|test\/fixtures\/working.html)/gi), null); done(); })); }); it('should not pass the a11y validation', function (done) { var options = { browser: 'phantomjs' }; gulp.src(fixtures('broken.html')) .pipe(axeCore(options)) .pipe(sassert.end(function() { assert.notEqual(output.match(/Found 3 accessibility violations/gi), null); assert.notEqual(output.match(/(File to test|test\/fixtures\/broken.html)/gi), null); done(); })); }); it('should create JSON file with the results', function (done) { var options = { saveOutputIn: 'allHtml.json', folderOutputReport: path.join(__dirname, 'temp'), browser: 'phantomjs' }; var expected = path.join(__dirname, 'temp', 'allHtml.json'); gulp.src(fixtures('broken.html')) .pipe(axeCore(options)) .pipe(sassert.end(function() { assert(fileExists(expected), true); done(); })); }); }); it('should emit error on streamed file', function (done) { gulp.src(fixtures('working.html'), { buffer: false }) .pipe(axeCore()) .on('error', function (err) { assert.equal(err.message, 'Streaming not supported'); done(); }); }); });
{ "content_hash": "5143ece11fff03b7774bb28b5a1d3722", "timestamp": "", "source": "github", "line_count": 132, "max_line_length": 91, "avg_line_length": 27.568181818181817, "alnum_prop": 0.6205001374003847, "repo_name": "felixzapata/gulp-axe-core", "id": "fbf8823aeaf1995d82b9d36d2c43eb0b09e703fe", "size": "3639", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "test/test.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "11704" } ], "symlink_target": "" }