code
stringlengths
5
1.01M
repo_name
stringlengths
5
84
path
stringlengths
4
311
language
stringclasses
30 values
license
stringclasses
15 values
size
int64
5
1.01M
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
/* * Copyright (c) 2012, JInterval Project. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package net.java.jinterval.ir; import com.cflex.util.lpSolve.LpConstant; import com.cflex.util.lpSolve.LpModel; import com.cflex.util.lpSolve.LpSolver; import java.util.ArrayList; //import org.apache.commons.math3.exception.MathIllegalArgumentException; //TODO: Add exceptions and throws public class IRPredictor { private double[][] X; private double[] Y; private double[] E; private boolean dataAreGiven; // Number of observations private int ObsNumber; // Number of variables private int VarNumber; // Storage for predictions private double PredictionMin; private double PredictionMax; private double[] PredictionMins; private double[] PredictionMaxs; // Last error int ExitCode; public IRPredictor(){ ObsNumber = 0; VarNumber = 0; dataAreGiven = false; } public IRPredictor(double[][] X, double[] Y, double[] E){ setData(X,Y,E); } public final void setData(double[][] X, double[] Y, double[] E) // throws IllegalDimensionException { // if(X.length != Y.length || X.length != E.length) // throw IllegalDimensionException; this.X=X; this.Y=Y; this.E=E; ObsNumber = X.length; VarNumber = X[0].length; dataAreGiven = true; } public int getExitCode() { return ExitCode; } private boolean solveLpp(double[] Objective) // throws IllegalDimensionException { if (Objective.length != VarNumber){ // throw IllegalDimensionException; ExitCode = -1; return false; } try { // Init LP Solver LpModel Lpp = new LpModel(0, VarNumber); // Define LPP double[] zObjective = new double[VarNumber+1]; System.arraycopy(Objective, 0, zObjective, 1, VarNumber); Lpp.setObjFn(zObjective); double[] zX=new double[VarNumber+1]; for (int i=0; i<ObsNumber; i++) { System.arraycopy(X[i], 0, zX, 1, VarNumber); Lpp.addConstraint(zX, LpConstant.LE, Y[i]+E[i]); Lpp.addConstraint(zX, LpConstant.GE, Y[i]-E[i]); // Solver.add_constraint(Lpp, zX, constant.LE, Y[i]+E[i]); // Solver.add_constraint(Lpp, zX, constant.GE, Y[i]-E[i]); } //Solver.set_minim(Lpp); //Lpp.setMinimum(); LpSolver Solver = new LpSolver(Lpp); ExitCode = Solver.solve(); // ExitCode = Solver.solve(Lpp); switch ( ExitCode ) { case LpConstant.OPTIMAL: PredictionMin = Lpp.getBestSolution(0); break; case LpConstant.INFEASIBLE: //throw InfeasibleException case LpConstant.UNBOUNDED: //throw UnboundedException } // Solver.set_maxim(Lpp); Lpp.setMaximum(); ExitCode = Solver.solve(); switch ( ExitCode ) { case LpConstant.OPTIMAL: PredictionMax = Lpp.getBestSolution(0); break; case LpConstant.INFEASIBLE: //throw InfeasibleException case LpConstant.UNBOUNDED: //throw UnboundedException } } catch (Exception e){ //e.printStackTrace(); } return ExitCode == LpConstant.OPTIMAL; } public boolean isDataConsistent(){ return solveLpp(X[0]); } public void compressData(){ } public boolean predictAt(double[] x){ return solveLpp(x); } public boolean predictAtEveryDataPoint(){ PredictionMins = new double[ObsNumber]; PredictionMaxs = new double[ObsNumber]; boolean Solved = true; for (int i=0; i<ObsNumber; i++){ Solved = Solved && predictAt(X[i]); if(!Solved) { break; } PredictionMins[i] = getMin(); PredictionMaxs[i] = getMax(); } return Solved; } public double getMin(){ return PredictionMin; } public double getMax(){ return PredictionMax; } public double getMin(int i) { return PredictionMins[i]; } public double getMax(int i) { return PredictionMaxs[i]; } public double[] getMins() { return PredictionMins; } public double[] getMaxs() { return PredictionMaxs; } public double[] getResiduals(){ //Residuals=(y-(vmax+vmin)/2)/beta double v; double[] residuals = new double[ObsNumber]; for(int i=0; i<ObsNumber; i++) { v = (PredictionMins[i]+PredictionMaxs[i])/2; residuals[i] = (Y[i]-v)/E[i]; } return residuals; } public double[] getLeverages(){ //Leverage=((vmax-vmin)/2)/beta double v; double[] leverages = new double[ObsNumber]; for(int i=0; i<ObsNumber; i++) { v = (PredictionMaxs[i]-PredictionMins[i])/2; leverages[i] = v/E[i]; } return leverages; } public int[] getBoundary(){ final double EPSILON = 1.0e-6; ArrayList<Integer> boundary = new ArrayList<Integer>(); double yp, ym, vp, vm; for (int i=0; i<ObsNumber; i++){ yp = Y[i]+E[i]; vp = PredictionMaxs[i]; ym = Y[i]-E[i]; vm = PredictionMins[i]; if ( Math.abs(yp - vp) < EPSILON || Math.abs(ym - vm) < EPSILON ) { boundary.add(1); } else { boundary.add(0); } } int[] a_boundary = new int[boundary.size()]; for (int i=0; i<a_boundary.length; i++){ a_boundary[i] = boundary.get(i).intValue(); } return a_boundary; } public int[] getBoundaryNumbers(){ int Count = 0; int[] boundary = getBoundary(); for (int i=0; i<boundary.length; i++){ if(boundary[i] == 1) { Count++; } } int j = 0; int[] numbers = new int[Count]; for (int i=0; i<boundary.length; i++){ if(boundary[i] == 1) { numbers[j++] = i; } } return numbers; } //TODO: Implement getOutliers() // public int[] getOutliers(){ // // } //TODO: Implement getOutliersNumbers() // public int[] getOutliersNumbers(){ // // } public double[] getOutliersWeights(){ double[] outliers = new double[ObsNumber]; for(int i=0; i<ObsNumber; i++) { outliers[i]=0; } try { LpModel Lpp = new LpModel(0, ObsNumber+VarNumber); // Build and set objective of LPP double[] zObjective = new double[ObsNumber+VarNumber+1]; for(int i=1;i<=VarNumber; i++) { zObjective[i] = 0; } for(int i=1;i<=ObsNumber; i++) { zObjective[VarNumber+i] = 1; } Lpp.setObjFn(zObjective); //Solver.set_minim(Lpp); // Build and set constraints of LPP double[] Row = new double[ObsNumber+VarNumber+1]; for (int i=0; i<ObsNumber; i++) { for (int j=1; j<=VarNumber; j++) { Row[j]=X[i][j-1]; } for(int j=1; j<=ObsNumber; j++) { Row[VarNumber+j] = 0; } Row[VarNumber+i+1] = -E[i]; // Solver.add_constraint(Lpp, Row, constant.LE, Y[i]); Lpp.addConstraint(Row, LpConstant.LE, Y[i]); Row[VarNumber+i+1] = E[i]; // Solver.add_constraint(Lpp, Row, constant.GE, Y[i]); Lpp.addConstraint(Row, LpConstant.GE, Y[i]); for (int j=1; j<=ObsNumber+VarNumber; j++) { Row[j] = 0; } Row[VarNumber+i+1] = 1; // Solver.add_constraint(Lpp, Row, constant.GE, 1); Lpp.addConstraint(Row, LpConstant.GE, 1); } // Solve LPP and get outliers' weights LpSolver Solver = new LpSolver(Lpp); ExitCode = Solver.solve(); for(int i = 0; i < ObsNumber; i++) { outliers[i] = Lpp.getBestSolution(Lpp.getRows()+VarNumber+i+1); } } catch(Exception e){ //e.printStackTrace(); } return outliers; } }
jinterval/jinterval
jinterval-ir/src/main/java/net/java/jinterval/ir/IRPredictor.java
Java
bsd-2-clause
10,164
[ 30522, 1013, 1008, 1008, 9385, 1006, 1039, 1007, 2262, 1010, 9743, 3334, 10175, 2622, 1012, 1008, 2035, 2916, 30524, 1008, 25707, 2015, 1997, 3120, 3642, 2442, 9279, 1996, 2682, 9385, 5060, 1010, 1008, 2023, 2862, 1997, 3785, 1998, 1996, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * LICENCE : CloudUnit is available under the Affero Gnu Public License GPL V3 : https://www.gnu.org/licenses/agpl-3.0.html * but CloudUnit is licensed too under a standard commercial license. * Please contact our sales team if you would like to discuss the specifics of our Enterprise license. * If you are not sure whether the GPL is right for you, * you can always test our software under the GPL and inspect the source code before you contact us * about purchasing a commercial license. * * LEGAL TERMS : "CloudUnit" is a registered trademark of Treeptik and can't be used to endorse * or promote products derived from this project without prior written permission from Treeptik. * Products or services derived from this software may not be called "CloudUnit" * nor may "Treeptik" or similar confusing terms appear in their names without prior written permission. * For any questions, contact us : contact@treeptik.fr */ package fr.treeptik.cloudunit.modules.redis; import fr.treeptik.cloudunit.modules.AbstractModuleControllerTestIT; /** * Created by guillaume on 01/10/16. */ public class Wildfly8Redis32ModuleControllerTestIT extends AbstractModuleControllerTestIT { public Wildfly8Redis32ModuleControllerTestIT() { super.server = "wildfly-8"; super.module = "redis-3-2"; super.numberPort = "6379"; super.managerPrefix = ""; super.managerSuffix = ""; super.managerPageContent = ""; } @Override protected void checkConnection(String forwardedPort) { new CheckRedisConnection().invoke(forwardedPort); } }
Treeptik/cloudunit
cu-manager/src/test/java/fr/treeptik/cloudunit/modules/redis/Wildfly8Redis32ModuleControllerTestIT.java
Java
agpl-3.0
1,612
[ 30522, 1013, 1008, 1008, 11172, 1024, 6112, 19496, 2102, 2003, 2800, 2104, 1996, 21358, 7512, 2080, 27004, 2270, 6105, 14246, 2140, 1058, 2509, 1024, 16770, 1024, 1013, 1013, 7479, 1012, 27004, 1012, 8917, 1013, 15943, 1013, 12943, 24759, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
from django.contrib.contenttypes.models import ContentType import json from django.http import Http404, HttpResponse from django.contrib import messages from django.contrib.auth import get_user_model from django.contrib.auth.decorators import login_required, user_passes_test from django.core.urlresolvers import reverse from django.shortcuts import get_object_or_404, redirect, render from guardian.decorators import permission_required from guardian.shortcuts import get_objects_for_user from account.models import DepartmentGroup from backend.tasks import TestConnectionTask from event.models import NotificationPreferences from .models import Application, Department, Environment, Server, ServerRole from task.models import Execution @login_required def index(request): data = {} executions = Execution.objects.filter(task__application__department_id=request.current_department_id) if not executions.count(): return redirect(reverse('first_steps_page')) return render(request, 'page/index.html', data) @permission_required('core.view_application', (Application, 'id', 'application_id')) def application_page(request, application_id): data = {} data['application'] = get_object_or_404(Application, pk=application_id) return render(request, 'page/application.html', data) @permission_required('core.view_environment', (Environment, 'id', 'environment_id')) def environment_page(request, environment_id): data = {} data['environment'] = get_object_or_404(Environment, pk=environment_id) data['servers'] = list(Server.objects.filter(environment_id=environment_id).prefetch_related('roles')) return render(request, 'page/environment.html', data) @permission_required('core.view_environment', (Environment, 'servers__id', 'server_id')) def server_test(request, server_id): data = {} data['server'] = get_object_or_404(Server, pk=server_id) data['task_id'] = TestConnectionTask().delay(server_id).id return render(request, 'partial/server_test.html', data) @login_required def server_test_ajax(request, task_id): data = {} task = TestConnectionTask().AsyncResult(task_id) if task.status == 'SUCCESS': status, output = task.get() data['status'] = status data['output'] = output elif task.status == 'FAILED': data['status'] = False else: data['status'] = None return HttpResponse(json.dumps(data), content_type="application/json") @login_required def first_steps_page(request): data = {} return render(request, 'page/first_steps.html', data) @login_required def settings_page(request, section='user', subsection='profile'): data = {} data['section'] = section data['subsection'] = subsection data['department'] = Department(pk=request.current_department_id) data['on_settings'] = True handler = '_settings_%s_%s' % (section, subsection) if section == 'system' and request.user.is_superuser is not True: return redirect('index') if section == 'department' and not request.user.has_perm('core.change_department', obj=data['department']): return redirect('index') if handler in globals(): data = globals()[handler](request, data) else: raise Http404 return render(request, 'page/settings.html', data) def _settings_account_profile(request, data): data['subsection_template'] = 'partial/account_profile.html' from account.forms import account_create_form form = account_create_form('user_profile', request, request.user.id) form.fields['email'].widget.attrs['readonly'] = True data['form'] = form if request.method == 'POST': if form.is_valid(): form.save() data['user'] = form.instance messages.success(request, 'Saved') return data def _settings_account_password(request, data): data['subsection_template'] = 'partial/account_password.html' from account.forms import account_create_form form = account_create_form('user_password', request, request.user.id) data['form'] = form if request.method == 'POST': if form.is_valid(): user = form.save(commit=False) user.set_password(user.password) user.save() data['user'] = form.instance messages.success(request, 'Saved') return data def _settings_account_notifications(request, data): data['subsection_template'] = 'partial/account_notifications.html' data['applications'] = get_objects_for_user(request.user, 'core.view_application') content_type = ContentType.objects.get_for_model(Application) if request.method == 'POST': for application in data['applications']: key = 'notification[%s]' % application.id notification, created = NotificationPreferences.objects.get_or_create( user=request.user, event_type='ExecutionFinish', content_type=content_type, object_id=application.id) if notification.is_active != (key in request.POST): notification.is_active = key in request.POST notification.save() messages.success(request, 'Saved') data['notifications'] = NotificationPreferences.objects.filter( user=request.user, event_type='ExecutionFinish', content_type=content_type.id).values_list('object_id', 'is_active') data['notifications'] = dict(data['notifications']) return data def _settings_department_applications(request, data): data['subsection_template'] = 'partial/application_list.html' data['applications'] = Application.objects.filter(department_id=request.current_department_id) data['empty'] = not bool(data['applications'].count()) return data def _settings_department_users(request, data): data['subsection_template'] = 'partial/user_list.html' from guardian.shortcuts import get_users_with_perms department = Department.objects.get(pk=request.current_department_id) data['users'] = get_users_with_perms(department).prefetch_related('groups__departmentgroup').order_by('name') data['department_user_list'] = True data['form_name'] = 'user' return data def _settings_department_groups(request, data): data['subsection_template'] = 'partial/group_list.html' data['groups'] = DepartmentGroup.objects.filter(department_id=request.current_department_id) return data def _settings_department_serverroles(request, data): data['subsection_template'] = 'partial/serverrole_list.html' data['serverroles'] = ServerRole.objects.filter(department_id=request.current_department_id) data['empty'] = not bool(data['serverroles'].count()) return data @user_passes_test(lambda u: u.is_superuser) def _settings_system_departments(request, data): data['subsection_template'] = 'partial/department_list.html' data['departments'] = Department.objects.all() return data @user_passes_test(lambda u: u.is_superuser) def _settings_system_users(request, data): data['subsection_template'] = 'partial/user_list.html' data['users'] = get_user_model().objects.exclude(id=-1).prefetch_related('groups__departmentgroup__department').order_by('name') data['form_name'] = 'usersystem' return data def department_switch(request, id): department = get_object_or_404(Department, pk=id) if request.user.has_perm('core.view_department', department): request.session['current_department_id'] = int(id) else: messages.error(request, 'Access forbidden') return redirect('index') def handle_403(request): print 'aaaaaaaa' messages.error(request, 'Access forbidden') return redirect('index')
gunnery/gunnery
gunnery/core/views.py
Python
apache-2.0
7,964
[ 30522, 2013, 6520, 23422, 1012, 9530, 18886, 2497, 1012, 4180, 13874, 2015, 1012, 4275, 12324, 4180, 13874, 12324, 1046, 3385, 2013, 6520, 23422, 1012, 8299, 12324, 8299, 12740, 2549, 1010, 8299, 6072, 26029, 3366, 2013, 6520, 23422, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package nl.abevos.kikker.level; import nl.abevos.kikker.KikkerGame; import nl.abevos.kikker.actor.Frog; import nl.abevos.kikker.environment.Platform; import nl.abevos.kikker.environment.Wall; import nl.abevos.kikker.manager.AssetManager; import nl.abevos.kikker.manager.ContactListener; import nl.abevos.kikker.screen.GameScreen; import com.badlogic.gdx.graphics.Camera; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector3; import com.badlogic.gdx.physics.box2d.Box2DDebugRenderer; import com.badlogic.gdx.physics.box2d.World; public class Level { private static World staticWorld; private static Camera staticCamera; private static Frog staticFrog; private GameScreen screen; private World world; private Box2DDebugRenderer debugRenderer; private Frog frog; private Texture texture; private Platform floor; private Platform platform1; private Platform ceiling; private Wall leftWall; private Wall rightWall; public Level (GameScreen screen) { this.screen = screen; } public void load () { world = new World(new Vector2(0, -9.8f), true); world.setContactListener(new ContactListener()); Level.staticWorld = world; Level.staticCamera = screen.getCamera(); frog = new Frog(0, 0, world); Level.staticFrog = frog; texture = AssetManager.getTexture("food"); floor = new Platform(0, - 256); platform1 = new Platform(160, -170); ceiling = new Platform(0, 256); leftWall = new Wall(- 256, 0); rightWall = new Wall(256, 0); debugRenderer = new Box2DDebugRenderer(); } public void cameraUpdate (OrthographicCamera camera) { camera.position.lerp(new Vector3(frog.getPosition().x, frog.getPosition().y, 0), camera.position.dst(frog.getPosition().x, frog.getPosition().y, 0) / 100f); } public void update (float delta) { world.step(1f / 30, 6, 4); frog.update(delta); } public void draw () { KikkerGame.batch().draw(texture, 0, 0); floor.draw(); platform1.draw(); ceiling.draw(); leftWall.draw(); rightWall.draw(); frog.draw(); } public void postDraw () { debugRenderer.render(world, getCamera().combined); } public void dispose () { world.dispose(); } public static World getWorld () { return Level.staticWorld; } public static Camera getCamera () { return Level.staticCamera; } public static Frog getFrog () { return Level.staticFrog; } }
ManWithAJawharp/kikker
core/src/nl/abevos/kikker/level/Level.java
Java
gpl-2.0
2,508
[ 30522, 7427, 17953, 1012, 14863, 19862, 1012, 11382, 23793, 1012, 2504, 1025, 12324, 17953, 1012, 14863, 19862, 1012, 11382, 23793, 1012, 11382, 23793, 16650, 1025, 12324, 17953, 1012, 14863, 19862, 1012, 11382, 23793, 1012, 3364, 1012, 10729, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
--- jupyter: jupytext: notebook_metadata_filter: all text_representation: extension: .md format_name: markdown format_version: '1.3' jupytext_version: 1.13.4 kernelspec: display_name: Python 3 language: python name: python3 language_info: codemirror_mode: name: ipython version: 3 file_extension: .py mimetype: text/x-python name: python nbconvert_exporter: python pygments_lexer: ipython3 version: 3.8.11 plotly: description: Figure Factories are dedicated functions for creating very specific types of plots. display_as: file_settings language: python layout: base name: Figure Factories order: 33 permalink: python/figure-factories/ thumbnail: thumbnail/streamline.jpg --- #### `plotly.figure_factory` The `plotly.figure_factory` module contains dedicated functions for creating very specific types of plots that were at the time of their creation difficult to create with [graph objects](/python/graph-objects/) and prior to the existence of [Plotly Express](/python/plotly-express/). As new functionality gets added to [Plotly.js](https://plotly.com/javascript/) and to Plotly Express, certain Figure Factories become unnecessary and are therefore deprecated as "legacy", but remain in the module for backwards-compatibility reasons. The following types of plots are still difficult to create with Graph Objects or Plotly Express and therefore the corresponding Figure Factories are *not* deprecated: * [Dendrograms](/python/dendrogram/) * [Hexagonal Binning Tile Map](/python/hexbin-mapbox/) * [Quiver Plots](/python/quiver-plots/) * [Streamline Plots](/python/streamline-plots/) * [Tables](/python/figure-factory-table/) * [Ternary Contour Plots](/python/ternary-contour/) * [Triangulated Surface Plots](/python/trisurf/) Deprecated "legacy" Figure Factories include: * [Annotated Heatmaps](/python/annotated-heatmap/), deprecated by [heatmaps with `px.imshow()`](/python/heatmaps/) * [County Choropleth Maps](/python/county-choropleth/), deprecated by regular [Choropleth maps with GeoJSON input](/python/choropleth-maps/) * [Distplots](/python/distplot/), mostly deprecated by [`px.histogram`](/python/histograms/) except for KDE plots, which `px.histogram` doesn't support yet * [Gantt Charts](/python/gantt/), deprecated by [`px.timeline`](/python/gantt/) #### Reference For more information about the contents of `plotly.figure_factory`, including deprecated methods, please refer to our [API Reference documentation](https://plotly.com/python-api-reference/plotly.figure_factory.html).
plotly/plotly.py
doc/python/figure-factories.md
Markdown
mit
2,660
[ 30522, 1011, 1011, 1011, 18414, 7685, 3334, 1024, 18414, 7685, 18209, 1024, 14960, 1035, 27425, 1035, 11307, 1024, 2035, 3793, 1035, 6630, 1024, 5331, 1024, 1012, 9108, 4289, 1035, 2171, 1024, 2928, 7698, 4289, 1035, 2544, 1024, 1005, 1015,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php App::uses('AppController', 'Controller'); /** * GuestsUsers Controller * * @property GuestsUser $GuestsUser * @property PaginatorComponent $Paginator */ class GuestsUsersController extends AppController { /** * Components * * @var array */ public $components = array('Paginator'); /** * index method * * @return void */ public function index() { $this->GuestsUser->recursive = 0; $this->set('guestsUsers', $this->Paginator->paginate()); } /** * view method * * @throws NotFoundException * @param string $id * @return void */ public function view($id = null) { if (!$this->GuestsUser->exists($id)) { throw new NotFoundException(__('Invalid guests user')); } $options = array('conditions' => array('GuestsUser.' . $this->GuestsUser->primaryKey => $id)); $this->set('guestsUser', $this->GuestsUser->find('first', $options)); } /** * add method * * @return void */ public function add() { if ($this->request->is('post')) { $this->GuestsUser->create(); if ($this->GuestsUser->save($this->request->data)) { $this->Session->setFlash(__('The guests user has been saved.')); return $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash(__('The guests user could not be saved. Please, try again.')); } } } /** * edit method * * @throws NotFoundException * @param string $id * @return void */ public function edit($id = null) { if (!$this->GuestsUser->exists($id)) { throw new NotFoundException(__('Invalid guests user')); } if ($this->request->is(array('post', 'put'))) { if ($this->GuestsUser->save($this->request->data)) { $this->Session->setFlash(__('The guests user has been saved.')); return $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash(__('The guests user could not be saved. Please, try again.')); } } else { $options = array('conditions' => array('GuestsUser.' . $this->GuestsUser->primaryKey => $id)); $this->request->data = $this->GuestsUser->find('first', $options); } } /** * delete method * * @throws NotFoundException * @param string $id * @return void */ public function delete($id = null) { $this->GuestsUser->id = $id; if (!$this->GuestsUser->exists()) { throw new NotFoundException(__('Invalid guests user')); } $this->request->onlyAllow('post', 'delete'); if ($this->GuestsUser->delete()) { $this->Session->setFlash(__('The guests user has been deleted.')); } else { $this->Session->setFlash(__('The guests user could not be deleted. Please, try again.')); } return $this->redirect(array('action' => 'index')); }}
aisner33/shop
Controller/GuestsUsersController.php
PHP
gpl-3.0
2,648
[ 30522, 1026, 1029, 25718, 10439, 1024, 1024, 3594, 1006, 1005, 10439, 8663, 13181, 10820, 1005, 1010, 1005, 11486, 1005, 1007, 1025, 1013, 1008, 1008, 1008, 6368, 20330, 2015, 11486, 1008, 1008, 1030, 3200, 6368, 20330, 1002, 6368, 20330, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
using System.Threading.Tasks; using Apollo.CommandSystem; using Apollo.Data; using Apollo.Services; namespace Apollo.Commands.Log { public class GetJournalEntries : AuthenticatedCommand { private readonly IJournalDataService journalDataService; public int start { get; set; } public GetJournalEntries(IJournalDataService journalDataService, ILoginService loginService) : base(loginService) { this.journalDataService = journalDataService; } public override async Task<CommandResult> Execute() { var entries = await journalDataService.GetJournalEntries(start); var total = await journalDataService.GetCount(); return CommandResult.CreateSuccessResult(new {entries, total}); } public override Task<bool> IsValid() { return Task.FromResult(true); } } }
charlesj/Apollo
server/Apollo/Commands/Journal/GetJournalEntries.cs
C#
mit
917
[ 30522, 2478, 2291, 1012, 11689, 2075, 1012, 8518, 1025, 2478, 9348, 1012, 10954, 27268, 6633, 1025, 2478, 9348, 1012, 2951, 1025, 2478, 9348, 1012, 2578, 1025, 3415, 15327, 9348, 1012, 10954, 1012, 8833, 1063, 2270, 2465, 2131, 23099, 12789...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.jetbrains.python.inspections.quickfix; import com.intellij.codeInsight.CodeInsightUtilCore; import com.intellij.codeInsight.FileModificationService; import com.intellij.codeInsight.template.TemplateBuilder; import com.intellij.codeInsight.template.TemplateBuilderFactory; import com.intellij.codeInspection.LocalQuickFix; import com.intellij.codeInspection.ProblemDescriptor; import com.intellij.openapi.application.WriteAction; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.fileEditor.FileEditorManager; import com.intellij.openapi.fileEditor.OpenFileDescriptor; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.MessageType; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.util.Function; import com.jetbrains.python.PyBundle; import com.jetbrains.python.PyNames; import com.jetbrains.python.psi.*; import com.jetbrains.python.psi.impl.PyPsiUtils; import com.jetbrains.python.psi.types.PyClassType; import com.jetbrains.python.psi.types.PyClassTypeImpl; import com.jetbrains.python.psi.types.PyType; import com.jetbrains.python.psi.types.TypeEvalContext; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** * Available on self.my_something when my_something is unresolved. * User: dcheryasov */ public class AddFieldQuickFix implements LocalQuickFix { private final String myInitializer; private final String myClassName; private final String myIdentifier; private boolean replaceInitializer = false; public AddFieldQuickFix(@NotNull final String identifier, @NotNull final String initializer, final String className, boolean replace) { myIdentifier = identifier; myInitializer = initializer; myClassName = className; replaceInitializer = replace; } @NotNull public String getName() { return PyBundle.message("QFIX.NAME.add.field.$0.to.class.$1", myIdentifier, myClassName); } @NotNull public String getFamilyName() { return "Add field to class"; } @NotNull public static PsiElement appendToMethod(PyFunction init, Function<String, PyStatement> callback) { // add this field as the last stmt of the constructor final PyStatementList statementList = init.getStatementList(); // name of 'self' may be different for fancier styles String selfName = PyNames.CANONICAL_SELF; final PyParameter[] params = init.getParameterList().getParameters(); if (params.length > 0) { selfName = params[0].getName(); } final PyStatement newStmt = callback.fun(selfName); final PsiElement result = PyUtil.addElementToStatementList(newStmt, statementList, true); PyPsiUtils.removeRedundantPass(statementList); return result; } public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) { // expect the descriptor to point to the unresolved identifier. final PsiElement element = descriptor.getPsiElement(); final PyClassType type = getClassType(element); if (type == null) return; final PyClass cls = type.getPyClass(); if (!FileModificationService.getInstance().preparePsiElementForWrite(cls)) return; WriteAction.run(() -> { PsiElement initStatement; if (!type.isDefinition()) { initStatement = addFieldToInit(project, cls, myIdentifier, new CreateFieldCallback(project, myIdentifier, myInitializer)); } else { PyStatement field = PyElementGenerator.getInstance(project) .createFromText(LanguageLevel.getDefault(), PyStatement.class, myIdentifier + " = " + myInitializer); initStatement = PyUtil.addElementToStatementList(field, cls.getStatementList(), true); } if (initStatement != null) { showTemplateBuilder(initStatement, cls.getContainingFile()); return; } // somehow we failed. tell about this PyUtil.showBalloon(project, PyBundle.message("QFIX.failed.to.add.field"), MessageType.ERROR); }); } @Override public boolean startInWriteAction() { return false; } private static PyClassType getClassType(@NotNull final PsiElement element) { if (element instanceof PyQualifiedExpression) { final PyExpression qualifier = ((PyQualifiedExpression)element).getQualifier(); if (qualifier == null) return null; final PyType type = TypeEvalContext.userInitiated(element.getProject(), element.getContainingFile()).getType(qualifier); return type instanceof PyClassType ? (PyClassType)type : null; } final PyClass aClass = PsiTreeUtil.getParentOfType(element, PyClass.class); return aClass != null ? new PyClassTypeImpl(aClass, false) : null; } private void showTemplateBuilder(PsiElement initStatement, @NotNull final PsiFile file) { initStatement = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(initStatement); if (initStatement instanceof PyAssignmentStatement) { final TemplateBuilder builder = TemplateBuilderFactory.getInstance().createTemplateBuilder(initStatement); final PyExpression assignedValue = ((PyAssignmentStatement)initStatement).getAssignedValue(); final PyExpression leftExpression = ((PyAssignmentStatement)initStatement).getLeftHandSideExpression(); if (assignedValue != null && leftExpression != null) { if (replaceInitializer) builder.replaceElement(assignedValue, myInitializer); else builder.replaceElement(leftExpression.getLastChild(), myIdentifier); final VirtualFile virtualFile = file.getVirtualFile(); if (virtualFile == null) return; final Editor editor = FileEditorManager.getInstance(file.getProject()).openTextEditor( new OpenFileDescriptor(file.getProject(), virtualFile), true); if (editor == null) return; builder.run(editor, false); } } } @Nullable public static PsiElement addFieldToInit(Project project, PyClass cls, String itemName, Function<String, PyStatement> callback) { if (cls != null && itemName != null) { PyFunction init = cls.findMethodByName(PyNames.INIT, false, null); if (init != null) { return appendToMethod(init, callback); } else { // no init! boldly copy ancestor's. for (PyClass ancestor : cls.getAncestorClasses(null)) { init = ancestor.findMethodByName(PyNames.INIT, false, null); if (init != null) break; } PyFunction newInit = createInitMethod(project, cls, init); appendToMethod(newInit, callback); PsiElement addAnchor = null; PyFunction[] meths = cls.getMethods(); if (meths.length > 0) addAnchor = meths[0].getPrevSibling(); PyStatementList clsContent = cls.getStatementList(); newInit = (PyFunction) clsContent.addAfter(newInit, addAnchor); PyUtil.showBalloon(project, PyBundle.message("QFIX.added.constructor.$0.for.field.$1", cls.getName(), itemName), MessageType.INFO); final PyStatementList statementList = newInit.getStatementList(); final PyStatement[] statements = statementList.getStatements(); return statements.length != 0 ? statements[0] : null; } } return null; } @NotNull private static PyFunction createInitMethod(Project project, PyClass cls, @Nullable PyFunction ancestorInit) { // found it; copy its param list and make a call to it. String paramList = ancestorInit != null ? ancestorInit.getParameterList().getText() : "(self)"; String functionText = "def " + PyNames.INIT + paramList + ":\n"; if (ancestorInit == null) functionText += " pass"; else { final PyClass ancestorClass = ancestorInit.getContainingClass(); if (ancestorClass != null && !PyUtil.isObjectClass(ancestorClass)) { StringBuilder sb = new StringBuilder(); PyParameter[] params = ancestorInit.getParameterList().getParameters(); boolean seen = false; if (cls.isNewStyleClass(null)) { // form the super() call sb.append("super("); if (!LanguageLevel.forElement(cls).isPy3K()) { sb.append(cls.getName()); // NOTE: assume that we have at least the first param String self_name = params[0].getName(); sb.append(", ").append(self_name); } sb.append(").").append(PyNames.INIT).append("("); } else { sb.append(ancestorClass.getName()); sb.append(".__init__(self"); seen = true; } for (int i = 1; i < params.length; i += 1) { if (seen) sb.append(", "); else seen = true; sb.append(params[i].getText()); } sb.append(")"); functionText += " " + sb.toString(); } else { functionText += " pass"; } } return PyElementGenerator.getInstance(project).createFromText( LanguageLevel.getDefault(), PyFunction.class, functionText, new int[]{0} ); } private static class CreateFieldCallback implements Function<String, PyStatement> { private final Project myProject; private final String myItemName; private final String myInitializer; private CreateFieldCallback(Project project, String itemName, String initializer) { myProject = project; myItemName = itemName; myInitializer = initializer; } public PyStatement fun(String selfName) { return PyElementGenerator.getInstance(myProject).createFromText(LanguageLevel.getDefault(), PyStatement.class, selfName + "." + myItemName + " = " + myInitializer); } } }
jk1/intellij-community
python/src/com/jetbrains/python/inspections/quickfix/AddFieldQuickFix.java
Java
apache-2.0
10,326
[ 30522, 1013, 1008, 1008, 9385, 2456, 1011, 2297, 6892, 10024, 7076, 1055, 1012, 1054, 30524, 1025, 1008, 2017, 2089, 2025, 2224, 2023, 5371, 3272, 1999, 12646, 2007, 1996, 6105, 1012, 1008, 2017, 2089, 6855, 1037, 6100, 1997, 1996, 6105, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php /** * @package axy\fs\ifs * @author Oleg Grigoriev <go.vasac@gmail.com> */ namespace axy\fs\ifs; /** * The file stream meta data * * @SuppressWarnings(PHPMD.CamelCasePropertyName) */ class MetaData { /** * The file name * * @var string */ public $filename; /** * TRUE if the stream timed out while waiting for data on the last call * * @var bool */ public $timed_out; /** * TRUE if the stream is in blocking IO mode * * @var bool */ public $blocked; /** * TRUE if the stream has reached end-of-file * * @var bool */ public $eof; /** * The number of bytes currently contained in the PHP's own internal buffer * * @var int */ public $unread_bytes; /** * A label describing the underlying implementation of the stream * * @var string */ public $stream_type; /** * The type of access required for this file * * @var string */ public $mode; /** * Whether the current stream can be seeked * * @var bool */ public $seekable; /** * The file name * * @var string */ public $uri; /** * The constructor * * @param array $data [optional] */ public function __construct(array $data = null) { if ($data !== null) { foreach ($this as $k => &$v) { if (isset($data[$k])) { $v = $data[$k]; } } unset($v); } $this->filename = $this->uri; } }
axypro/fs-ifs
MetaData.php
PHP
mit
1,647
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 1008, 1030, 7427, 22260, 2100, 1032, 1042, 2015, 1032, 2065, 2015, 1008, 1030, 3166, 25841, 24665, 14031, 7373, 2615, 1026, 2175, 1012, 12436, 3736, 2278, 1030, 20917, 4014, 1012, 4012, 1028, 1008...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# 城市摄影系列评选:上海 上海,一个从近代开始就闪耀着奇异光彩的城市,一如既往地包容和开放。我们既可以穿过悄无声息的悠长巷道去追寻传统历史的痕迹,也可以在声名远播的外滩上将万国建筑尽收眼底。白天的上海,是匆匆的,来自五湖四海的人们都在这里为自己的理想打拼,无论四季如何交替,人来人往,川流不息;夜幕降临后的上海,漫天的霓虹淹没了白日的忙碌,夜色、歌声、倦怠、放纵交织出了一个又一个充满诱惑的夜晚。你眼中的上海是什么样子的呢?请你拿起相机,用镜头去捕捉属于你心里的上海建筑与景观的故事。 ## 目标确定 流程策划 评委招募 10-15个志愿者 ## 主题 这次拍摄的主题城市是“上海”,通过对以下一个或多个内容相关对上海的城市特色进行展示。 1、单体建筑(含建筑内部构造) 2、城市公园、广场、街道或建筑群等城市景观 ## 规格要求 对任何风格和流派都是开放的。 每一个参赛者可以上传多个作品单元,但是只能获得一个奖项(该奖项为本参赛者所有作品单元中获得的最高奖项) 每一个作品单元分为两部分: 其一为摄影作品(张数不限),其二是对该作品单元的文字描述(字数少于50)。 ## 作品上传规则 每一个作品单元上传为一篇ikuku摄影post ([详见上传指南](http://guide.ikuku.cn/ikuku-comp-photography.html)) ## 流程设计(成员名单) 评委及赞助、支持媒体的邀请 志愿者的招募 作品提交 ### 活动前期准备 志愿者的招募 ### 活动进行 摄影顾问邀请 评委的介绍 作品提交 评选进行 ### 总结成果、归档、二次分享传播 成果公布 ## 社区建设: 外联、宣传、志愿者 顾问及合作媒体协助宣传(微信、微博、朋友圈)等等 ## 志愿者招募 招募目的: 协助策划组完成以下任务 1.参与活动宣传; 2.邀请建筑摄影师参赛; 3.邀请协办媒体 招募对象: 不限专业,不限年龄,只要你爱好摄影,渴望提升自己 招募方式: ikuku网站、微博、微信宣传志愿者招募文案;上海建筑景观摄影活动文案链接志愿者招募文案宣传;在以往活动的志愿者群里宣传招募文案 招募时间: 活动开始至活动结束(一个月) 报名方式: 微博私信“ikuku志愿者竞赛策划小组” ikuku私信“志愿者竞赛策划小组” 发送邮件至:ikuku_volunteer@qq.com 主题: “ikuku志愿者报名” 内容: 姓名+专业+学校+微信号 ikuku收到私信或者邮件后,会第一时间与您微信联系。 具体目标: 10-15名志愿者 10个协办媒体 50份作品 参与福利: 表现突出者将有机会被推荐为ikuku实习生,同时在网站活动策划者名单中,将会有志愿者名字出现 ## 志愿者具体任务 1.参与活动宣传 微博、微信朋友圈、个人公众号转发此次征集活动 联系本校宣传媒体帮助推广此次活动 校内粘贴海报(张贴之前,请与学校相关部门联系,以免造成误会;张贴结束后,ikuku报销海报费用) 2.邀请建筑摄影师参赛: 可向学长学姐、老师或熟悉的符合条件的建筑摄影师发送参赛邀请函;可向ikuku提供联系方式的建筑师发送邀请函 3.寻找媒体支持: (媒体支持需要推送宣传文案和征集活动成果文案) 志愿者需要将“上海·建筑·景观”活动的文案和海报发送给支持媒体,由支持媒体在自有平台推广。 ## 志愿者任务完成标准: 每名志愿者至少联系1个协办媒体,成功邀请两名摄影师参与活动,每名摄影师上传一到两个作品。 ## 成员名单 策划:林鸿浩(主策划人)、张惠春、杨冰玉 海报设计:张惠春 志愿者招募:胡德鑫 评委、赞助媒体及支持媒体:小门 顾问:小门 指导:马海东 志愿者名单
caadxyz/guide.ikuku.cn
volunteer/volunteer-26.md
Markdown
mit
4,178
[ 30522, 1001, 1804, 100, 100, 100, 100, 100, 100, 100, 1024, 1742, 1902, 1742, 1902, 1989, 1740, 100, 100, 100, 1760, 100, 100, 100, 100, 100, 100, 100, 100, 1770, 100, 1916, 1804, 100, 1989, 1740, 100, 100, 100, 1802, 100, 100, 1796...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// -*-c++-*- #ifndef _TSYSERROR_H_ #define _TSYSERROR_H_ #include <TNamed.h> #include <Rtypes.h> class TList; class TGraphErrors; class TSysError : public TNamed { public: enum EType { kNone = 0, kMean, kMinStdDev, kRelativeErrorMCSum, kAbsoluteDevFromRef, kMaxValueFromBin, kMaxValueFromBinPercent, kStdDevValueFromBinPercent,kStdErrValueFromBinPercent, kMaxStdDevValueFromBinPercent, kNumTypes }; TSysError(); TSysError(const char *name, const char *title); ~TSysError(); void Browse(TBrowser *b); Bool_t IsFolder() const { return kTRUE; } void SetGraph(TGraphErrors *gr, Bool_t doClone = kFALSE); void SetHistogram(TH1D *h); void SetType(TSysError::EType type) { fType = type; } void SetTypeToList(TSysError::EType type); void SetPrintInfo(Bool_t printInfo) { fPrintInfo = printInfo; } TList *GetList() const { return fList; } TList *GetInputList() const { return fInputList; } TList *GetOutputList() const { return fOutputList; } TGraphErrors *GetGraph() const { return fGraph; } TH1D *GetHistogram() const { return fHist; } EType GetType() const { return fType; } void PrintHistogramInfo(TSysError *se, TH1D *h = 0); void Add(TSysError *sysError); Bool_t AddGraph(const char *filename, const char *tmpl = "%lg %lg %lg"); Bool_t AddGraphDirectory(const char *dirname, const char *filter = "*.txt", const char *tmpl = "%lg %lg %lg", Int_t maxFiles=kMaxInt); void AddInput(TObject *o); void AddOutput(TObject *o); Bool_t Calculate(); Bool_t CalculateMean(); Bool_t CalculateMinStdDev(); Bool_t CalculateAbsoluteDevFromRef(); Bool_t CalculateRelaticeErrorMCSum(); Bool_t CalculateMaxValueFromBin(); Bool_t CalculateMaxStdDevValueFromBinPercent(); Bool_t CalculateMaxValueFromBinPercent(); Bool_t CalculateStdDevValueFromBinPercent(Bool_t useStdErr=kFALSE); private: TList *fList; // list of TSysError TGraphErrors *fGraph; // current graph TH1D *fHist; // current histogram (representation of fGraph) TList *fInputList; // list of TSysError TList *fOutputList; // list of TSysError EType fType; // type of calculation Bool_t fPrintInfo; // flag if info should be printed (default is kFALSE) ClassDef(TSysError, 1) }; #endif /* _TSYSERROR_H_ */
mvala/syserr
TSysError.h
C
gpl-3.0
2,799
[ 30522, 1013, 1013, 1011, 1008, 1011, 1039, 1009, 1009, 1011, 1008, 1011, 1001, 2065, 13629, 2546, 1035, 24529, 23274, 18933, 2099, 1035, 1044, 1035, 1001, 9375, 1035, 24529, 23274, 18933, 2099, 1035, 1044, 1035, 1001, 2421, 1026, 20108, 758...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#undef _LARGEFILE_SOURCE #undef _FILE_OFFSET_BITS #define _LARGEFILE_SOURCE #define _FILE_OFFSET_BITS 64 #if defined(__PPC__) && !defined(__powerpc__) #define __powerpc__ 1 #endif #if defined (GRUB_UTIL) || !defined (GRUB_MACHINE) #include <config-util.h> #define NESTED_FUNC_ATTR #else /* Define if C symbols get an underscore after compilation. */ #define HAVE_ASM_USCORE 0 /* Define it to \"addr32\" or \"addr32;\" to make GAS happy. */ #define ADDR32 addr32 /* Define it to \"data32\" or \"data32;\" to make GAS happy. */ #define DATA32 data32 /* Define it to one of __bss_start, edata and _edata. */ #define BSS_START_SYMBOL __bss_start /* Define it to either end or _end. */ #define END_SYMBOL end /* Name of package. */ #define PACKAGE "grub" /* Version number of package. */ #define VERSION "2.00" /* Define to the full name and version of this package. */ #define PACKAGE_STRING "GRUB 2.00" /* Define to the version of this package. */ #define PACKAGE_VERSION "2.00" /* Define to the full name of this package. */ #define PACKAGE_NAME "GRUB" /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "bug-grub@gnu.org" /* Default boot directory name" */ #define GRUB_BOOT_DIR_NAME "boot" /* Default grub directory name */ #define GRUB_DIR_NAME "grub" /* Define to 1 if GCC generates calls to __enable_execute_stack(). */ #define NEED_ENABLE_EXECUTE_STACK 0 /* Define to 1 if GCC generates calls to __register_frame_info(). */ #define NEED_REGISTER_FRAME_INFO 0 /* Define to 1 to enable disk cache statistics. */ #define DISK_CACHE_STATS 0 #define GRUB_TARGET_CPU "i386" #define GRUB_PLATFORM "pc" #define RE_ENABLE_I18N 1 #if defined(__i386__) #define NESTED_FUNC_ATTR __attribute__ ((__regparm__ (1))) #else #define NESTED_FUNC_ATTR #endif #endif
craigschenk/grub2
config.h
C
gpl-3.0
1,816
[ 30522, 1001, 6151, 12879, 1035, 2312, 8873, 2571, 1035, 3120, 1001, 6151, 12879, 1035, 5371, 1035, 16396, 1035, 9017, 1001, 9375, 1035, 2312, 8873, 2571, 1035, 3120, 1001, 9375, 1035, 5371, 1035, 16396, 1035, 9017, 4185, 1001, 2065, 4225, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#!/usr/bin/env ruby $:.unshift File.expand_path('../../../lib', __FILE__) $stdout.sync = true require 'philotic' require 'awesome_print' class NamedQueueConsumer < Philotic::Consumer # subscribe to an existing named queue subscribe_to :test_queue # use acknowledgements auto_acknowledge # REQUEUE the message with RabbitMQ if consume throws these errors. I.e., something went wrong with the consumer # Only valid with ack_messages # requeueable_errors PossiblyTransientErrorOne, PossiblyTransientErrorTwo # REJECT the message with RabbitMQ if consume throws these errors. I.e., The message is malformed/invalid # Only valid with ack_messages # rejectable_errors BadMessageError def consume(message) ap named: message.attributes end end class AnonymousQueueConsumer < Philotic::Consumer # subscribe anonymously to a set of headers: # subscribe_to header_1: 'value_1', # header_2: 'value_2', # header_3: 'value_3' subscribe_to philotic_firehose: true def consume(message) ap anon: message.attributes end end #run the consumers AnonymousQueueConsumer.subscribe NamedQueueConsumer.subscribe # keep the parent thread alive Philotic.endure
nkeyes/philotic
examples/subscribing/consumer.rb
Ruby
mit
1,218
[ 30522, 1001, 999, 1013, 2149, 2099, 1013, 8026, 1013, 4372, 2615, 10090, 1002, 1024, 1012, 4895, 6182, 6199, 5371, 1012, 7818, 1035, 4130, 1006, 1005, 1012, 1012, 1013, 1012, 1012, 1013, 1012, 1012, 1013, 5622, 2497, 1005, 1010, 1035, 103...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package edu.stanford.nlp.util.logging; import edu.stanford.nlp.util.logging.Redwood.Record; import java.util.Collections; import java.util.HashSet; import java.util.Set; import java.util.List; /** * A filter for selecting which channels are visible. This class * behaves as an "or" filter; that is, if any of the filters are considered * valid, it allows the Record to proceed to the next handler. * * @author Gabor Angeli (angeli at cs.stanford) */ public class VisibilityHandler extends LogRecordHandler { private enum State { SHOW_ALL, HIDE_ALL } private VisibilityHandler.State defaultState = State.SHOW_ALL; private final Set<Object> deltaPool = new HashSet<>(); // replacing with Generics.newHashSet() makes classloader go haywire? public VisibilityHandler() { } // default is SHOW_ALL public VisibilityHandler(Object[] channels) { if (channels.length > 0) { defaultState = State.HIDE_ALL; Collections.addAll(deltaPool, channels); } } /** * Show all of the channels. */ public void showAll() { this.defaultState = State.SHOW_ALL; this.deltaPool.clear(); } /** * Show none of the channels */ public void hideAll() { this.defaultState = State.HIDE_ALL; this.deltaPool.clear(); } /** * Show all the channels currently being printed, in addition * to a new one * @param filter The channel to also show * @return true if this channel was already being shown. */ public boolean alsoShow(Object filter) { switch(this.defaultState){ case HIDE_ALL: return this.deltaPool.add(filter); case SHOW_ALL: return this.deltaPool.remove(filter); default: throw new IllegalStateException("Unknown default state setting: " + this.defaultState); } } /** * Show all the channels currently being printed, with the exception * of this new one * @param filter The channel to also hide * @return true if this channel was already being hidden. */ public boolean alsoHide(Object filter) { switch(this.defaultState){ case HIDE_ALL: return this.deltaPool.remove(filter); case SHOW_ALL: return this.deltaPool.add(filter); default: throw new IllegalStateException("Unknown default state setting: " + this.defaultState); } } /** {@inheritDoc} */ @Override public List<Record> handle(Record record) { boolean isPrinting = false; if(record.force()){ //--Case: Force Printing isPrinting = true; } else { //--Case: Filter switch (this.defaultState){ case HIDE_ALL: //--Default False for(Object tag : record.channels()){ if(this.deltaPool.contains(tag)){ isPrinting = true; break; } } break; case SHOW_ALL: //--Default True if (!this.deltaPool.isEmpty()) { // Short-circuit for efficiency boolean somethingSeen = false; for (Object tag : record.channels()) { if (this.deltaPool.contains(tag)) { somethingSeen = true; break; } } isPrinting = !somethingSeen; } else { isPrinting = true; } break; default: throw new IllegalStateException("Unknown default state setting: " + this.defaultState); } } //--Return if(isPrinting){ return Collections.singletonList(record); } else { return EMPTY; } } /** {@inheritDoc} */ @Override public List<Record> signalStartTrack(Record signal) { return EMPTY; } /** {@inheritDoc} */ @Override public List<Record> signalEndTrack(int newDepth, long timeOfEnd) { return EMPTY; } }
rupenp/CoreNLP
src/edu/stanford/nlp/util/logging/VisibilityHandler.java
Java
gpl-2.0
3,793
[ 30522, 7427, 3968, 2226, 1012, 8422, 1012, 17953, 2361, 1012, 21183, 4014, 1012, 15899, 1025, 12324, 3968, 2226, 1012, 8422, 1012, 17953, 2361, 1012, 21183, 4014, 1012, 15899, 1012, 27552, 1012, 2501, 1025, 12324, 9262, 1012, 21183, 4014, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// 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. package org.apache.kudu.client; import static org.apache.kudu.test.ClientTestUtil.getSchemaWithAllTypes; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import java.math.BigDecimal; import java.nio.ByteBuffer; import java.sql.Timestamp; import org.junit.Rule; import org.junit.Test; import org.apache.kudu.ColumnSchema; import org.apache.kudu.Schema; import org.apache.kudu.Type; import org.apache.kudu.test.junit.RetryRule; public class TestPartialRow { @Rule public RetryRule retryRule = new RetryRule(); @Test public void testGetters() { PartialRow partialRow = getPartialRowWithAllTypes(); assertEquals(true, partialRow.getBoolean("bool")); assertEquals(42, partialRow.getByte("int8")); assertEquals(43, partialRow.getShort("int16")); assertEquals(44, partialRow.getInt("int32")); assertEquals(45, partialRow.getLong("int64")); assertEquals(new Timestamp(1234567890), partialRow.getTimestamp("timestamp")); assertEquals(52.35F, partialRow.getFloat("float"), 0.0f); assertEquals(53.35, partialRow.getDouble("double"), 0.0); assertEquals("fun with ütf\0", partialRow.getString("string")); assertArrayEquals(new byte[] { 0, 1, 2, 3, 4 }, partialRow.getBinaryCopy("binary-array")); assertArrayEquals(new byte[] { 5, 6, 7, 8, 9 }, partialRow.getBinaryCopy("binary-bytebuffer")); assertEquals(ByteBuffer.wrap(new byte[] { 0, 1, 2, 3, 4 }), partialRow.getBinary("binary-array")); assertEquals(ByteBuffer.wrap(new byte[] { 5, 6, 7, 8, 9 }), partialRow.getBinary("binary-bytebuffer")); assertTrue(partialRow.isSet("null")); assertTrue(partialRow.isNull("null")); assertEquals(BigDecimal.valueOf(12345, 3), partialRow.getDecimal("decimal")); } @Test public void testGetObject() { PartialRow partialRow = getPartialRowWithAllTypes(); assertTrue(partialRow.getObject("bool") instanceof Boolean); assertEquals(true, partialRow.getObject("bool")); assertTrue(partialRow.getObject("int8") instanceof Byte); assertEquals((byte) 42, partialRow.getObject("int8")); assertTrue(partialRow.getObject("int16") instanceof Short); assertEquals((short)43, partialRow.getObject("int16")); assertTrue(partialRow.getObject("int32") instanceof Integer); assertEquals(44, partialRow.getObject("int32")); assertTrue(partialRow.getObject("int64") instanceof Long); assertEquals((long) 45, partialRow.getObject("int64")); assertTrue(partialRow.getObject("timestamp") instanceof Timestamp); assertEquals(new Timestamp(1234567890), partialRow.getObject("timestamp")); assertTrue(partialRow.getObject("float") instanceof Float); assertEquals(52.35F, (float) partialRow.getObject("float"), 0.0f); assertTrue(partialRow.getObject("double") instanceof Double); assertEquals(53.35, (double) partialRow.getObject("double"), 0.0); assertTrue(partialRow.getObject("string") instanceof String); assertEquals("fun with ütf\0", partialRow.getObject("string")); assertTrue(partialRow.getObject("binary-array") instanceof byte[]); assertArrayEquals(new byte[] { 0, 1, 2, 3, 4 }, partialRow.getBinaryCopy("binary-array")); assertTrue(partialRow.getObject("binary-bytebuffer") instanceof byte[]); assertEquals(ByteBuffer.wrap(new byte[] { 5, 6, 7, 8, 9 }), partialRow.getBinary("binary-bytebuffer")); assertNull(partialRow.getObject("null")); assertTrue(partialRow.getObject("decimal") instanceof BigDecimal); assertEquals(BigDecimal.valueOf(12345, 3), partialRow.getObject("decimal")); } @Test(expected = IllegalArgumentException.class) public void testGetNullColumn() { PartialRow partialRow = getPartialRowWithAllTypes(); assertTrue(partialRow.isSet("null")); assertTrue(partialRow.isNull("null")); partialRow.getString("null"); } @Test(expected = IllegalArgumentException.class) public void testSetNonNullableColumn() { PartialRow partialRow = getPartialRowWithAllTypes(); partialRow.setNull("int32"); } @Test public void testGetUnsetColumn() { Schema schema = getSchemaWithAllTypes(); PartialRow partialRow = schema.newPartialRow(); for (ColumnSchema columnSchema : schema.getColumns()) { assertFalse(partialRow.isSet("null")); assertFalse(partialRow.isNull("null")); try { callGetByName(partialRow, columnSchema.getName(), columnSchema.getType()); fail("Expected IllegalArgumentException for type: " + columnSchema.getType()); } catch (IllegalArgumentException ex) { // This is the expected exception. } } } @Test public void testGetMissingColumnName() { PartialRow partialRow = getPartialRowWithAllTypes(); for (ColumnSchema columnSchema : partialRow.getSchema().getColumns()) { try { callGetByName(partialRow, "not-a-column", columnSchema.getType()); fail("Expected IllegalArgumentException for type: " + columnSchema.getType()); } catch (IllegalArgumentException ex) { // This is the expected exception. } } } @Test public void testGetMissingColumnIndex() { PartialRow partialRow = getPartialRowWithAllTypes(); for (ColumnSchema columnSchema : partialRow.getSchema().getColumns()) { try { callGetByIndex(partialRow, 999, columnSchema.getType()); fail("Expected IndexOutOfBoundsException for type: " + columnSchema.getType()); } catch (IndexOutOfBoundsException ex) { // This is the expected exception. } } } @Test public void testGetWrongTypeColumn() { PartialRow partialRow = getPartialRowWithAllTypes(); for (ColumnSchema columnSchema : partialRow.getSchema().getColumns()) { try { callGetByName(partialRow, columnSchema.getName(), getShiftedType(columnSchema.getType())); fail("Expected IllegalArgumentException for type: " + columnSchema.getType()); } catch (IllegalArgumentException ex) { // This is the expected exception. } } } @Test public void testAddMissingColumnName() { PartialRow partialRow = getPartialRowWithAllTypes(); for (ColumnSchema columnSchema : partialRow.getSchema().getColumns()) { try { callAddByName(partialRow, "not-a-column", columnSchema.getType()); fail("Expected IllegalArgumentException for type: " + columnSchema.getType()); } catch (IllegalArgumentException ex) { // This is the expected exception. } } } @Test public void testAddMissingColumnIndex() { PartialRow partialRow = getPartialRowWithAllTypes(); for (ColumnSchema columnSchema : partialRow.getSchema().getColumns()) { try { callAddByIndex(partialRow, 999, columnSchema.getType()); fail("Expected IndexOutOfBoundsException for type: " + columnSchema.getType()); } catch (IndexOutOfBoundsException ex) { // This is the expected exception. } } } @Test public void testAddWrongTypeColumn() { PartialRow partialRow = getPartialRowWithAllTypes(); for (ColumnSchema columnSchema : partialRow.getSchema().getColumns()) { try { callAddByName(partialRow, columnSchema.getName(), getShiftedType(columnSchema.getType())); fail("Expected IllegalArgumentException for type: " + columnSchema.getType()); } catch (IllegalArgumentException ex) { // This is the expected exception. } } } @Test public void testAddToFrozenRow() { PartialRow partialRow = getPartialRowWithAllTypes(); partialRow.freeze(); for (ColumnSchema columnSchema : partialRow.getSchema().getColumns()) { try { callAddByName(partialRow, columnSchema.getName(), columnSchema.getType()); fail("Expected IllegalStateException for type: " + columnSchema.getType()); } catch (IllegalStateException ex) { // This is the expected exception. } } } @Test(expected = IllegalArgumentException.class) public void testIsNullMissingColumnName() { PartialRow partialRow = getPartialRowWithAllTypes(); partialRow.isNull("not-a-column"); } @Test(expected = IndexOutOfBoundsException.class) public void testIsNullMissingColumnIndex() { PartialRow partialRow = getPartialRowWithAllTypes(); partialRow.isNull(999); } @Test(expected = IllegalArgumentException.class) public void testIsSetMissingColumnName() { PartialRow partialRow = getPartialRowWithAllTypes(); partialRow.isSet("not-a-column"); } @Test(expected = IndexOutOfBoundsException.class) public void testIsSetMissingColumnIndex() { PartialRow partialRow = getPartialRowWithAllTypes(); partialRow.isSet(999); } @Test(expected = IllegalArgumentException.class) public void testAddInvalidPrecisionDecimal() { PartialRow partialRow = getPartialRowWithAllTypes(); partialRow.addDecimal("decimal", BigDecimal.valueOf(123456, 3)); } @Test(expected = IllegalArgumentException.class) public void testAddInvalidScaleDecimal() { PartialRow partialRow = getPartialRowWithAllTypes(); partialRow.addDecimal("decimal", BigDecimal.valueOf(12345, 4)); } @Test(expected = IllegalArgumentException.class) public void testAddInvalidCoercedScaleDecimal() { PartialRow partialRow = getPartialRowWithAllTypes(); partialRow.addDecimal("decimal", BigDecimal.valueOf(12345, 2)); } @Test public void testAddCoercedScaleAndPrecisionDecimal() { PartialRow partialRow = getPartialRowWithAllTypes(); partialRow.addDecimal("decimal", BigDecimal.valueOf(222, 1)); BigDecimal decimal = partialRow.getDecimal("decimal"); assertEquals("22.200", decimal.toString()); } @Test public void testToString() { Schema schema = getSchemaWithAllTypes(); PartialRow row = schema.newPartialRow(); assertEquals("()", row.toString()); row.addInt("int32", 42); row.addByte("int8", (byte) 42); assertEquals("(int8 int8=42, int32 int32=42)", row.toString()); row.addString("string", "fun with ütf\0"); assertEquals("(int8 int8=42, int32 int32=42, string string=\"fun with ütf\\0\")", row.toString()); ByteBuffer binary = ByteBuffer.wrap(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }); binary.position(2); binary.limit(5); row.addBinary("binary-bytebuffer", binary); assertEquals("(int8 int8=42, int32 int32=42, string string=\"fun with ütf\\0\", " + "binary binary-bytebuffer=[2, 3, 4])", row.toString()); row.addDouble("double", 52.35); assertEquals("(int8 int8=42, int32 int32=42, double double=52.35, " + "string string=\"fun with ütf\\0\", binary binary-bytebuffer=[2, 3, 4])", row.toString()); row.addDecimal("decimal", BigDecimal.valueOf(12345, 3)); assertEquals("(int8 int8=42, int32 int32=42, double double=52.35, " + "string string=\"fun with ütf\\0\", binary binary-bytebuffer=[2, 3, 4], " + "decimal(5, 3) decimal=12.345)", row.toString()); } @Test public void testIncrementColumn() { PartialRow partialRow = getPartialRowWithAllTypes(); // Boolean int boolIndex = getColumnIndex(partialRow, "bool"); partialRow.addBoolean(boolIndex, false); assertTrue(partialRow.incrementColumn(boolIndex)); assertEquals(true, partialRow.getBoolean(boolIndex)); assertFalse(partialRow.incrementColumn(boolIndex)); // Int8 int int8Index = getColumnIndex(partialRow, "int8"); partialRow.addByte(int8Index, (byte)(Byte.MAX_VALUE - 1)); assertTrue(partialRow.incrementColumn(int8Index)); assertEquals(Byte.MAX_VALUE, partialRow.getByte(int8Index)); assertFalse(partialRow.incrementColumn(int8Index)); // Int16 int int16Index = getColumnIndex(partialRow, "int16"); partialRow.addShort(int16Index, (short)(Short.MAX_VALUE - 1)); assertTrue(partialRow.incrementColumn(int16Index)); assertEquals(Short.MAX_VALUE, partialRow.getShort(int16Index)); assertFalse(partialRow.incrementColumn(int16Index)); // Int32 int int32Index = getColumnIndex(partialRow, "int32"); partialRow.addInt(int32Index, Integer.MAX_VALUE - 1); assertTrue(partialRow.incrementColumn(int32Index)); assertEquals(Integer.MAX_VALUE, partialRow.getInt(int32Index)); assertFalse(partialRow.incrementColumn(int32Index)); // Int64 int int64Index = getColumnIndex(partialRow, "int64"); partialRow.addLong(int64Index, Long.MAX_VALUE - 1); assertTrue(partialRow.incrementColumn(int64Index)); assertEquals(Long.MAX_VALUE, partialRow.getLong(int64Index)); assertFalse(partialRow.incrementColumn(int64Index)); // Float int floatIndex = getColumnIndex(partialRow, "float"); partialRow.addFloat(floatIndex, Float.MAX_VALUE); assertTrue(partialRow.incrementColumn(floatIndex)); assertEquals(Float.POSITIVE_INFINITY, partialRow.getFloat(floatIndex), 0.0f); assertFalse(partialRow.incrementColumn(floatIndex)); // Float int doubleIndex = getColumnIndex(partialRow, "double"); partialRow.addDouble(doubleIndex, Double.MAX_VALUE); assertTrue(partialRow.incrementColumn(doubleIndex)); assertEquals(Double.POSITIVE_INFINITY, partialRow.getDouble(doubleIndex), 0.0); assertFalse(partialRow.incrementColumn(doubleIndex)); // Decimal int decimalIndex = getColumnIndex(partialRow, "decimal"); // Decimal with precision 5, scale 3 has a max of 99.999 partialRow.addDecimal(decimalIndex, new BigDecimal("99.998")); assertTrue(partialRow.incrementColumn(decimalIndex)); assertEquals(new BigDecimal("99.999"), partialRow.getDecimal(decimalIndex)); assertFalse(partialRow.incrementColumn(decimalIndex)); // String int stringIndex = getColumnIndex(partialRow, "string"); partialRow.addString(stringIndex, "hello"); assertTrue(partialRow.incrementColumn(stringIndex)); assertEquals("hello\0", partialRow.getString(stringIndex)); // Binary int binaryIndex = getColumnIndex(partialRow, "binary-array"); partialRow.addBinary(binaryIndex, new byte[] { 0, 1, 2, 3, 4 }); assertTrue(partialRow.incrementColumn(binaryIndex)); assertArrayEquals(new byte[] { 0, 1, 2, 3, 4, 0 }, partialRow.getBinaryCopy(binaryIndex)); } @Test public void testSetMin() { PartialRow partialRow = getPartialRowWithAllTypes(); for (int i = 0; i < partialRow.getSchema().getColumnCount(); i++) { partialRow.setMin(i); } assertEquals(false, partialRow.getBoolean("bool")); assertEquals(Byte.MIN_VALUE, partialRow.getByte("int8")); assertEquals(Short.MIN_VALUE, partialRow.getShort("int16")); assertEquals(Integer.MIN_VALUE, partialRow.getInt("int32")); assertEquals(Long.MIN_VALUE, partialRow.getLong("int64")); assertEquals(Long.MIN_VALUE, partialRow.getLong("timestamp")); assertEquals(-Float.MAX_VALUE, partialRow.getFloat("float"), 0.0f); assertEquals(-Double.MAX_VALUE, partialRow.getDouble("double"), 0.0); assertEquals("", partialRow.getString("string")); assertArrayEquals(new byte[0], partialRow.getBinaryCopy("binary-array")); assertArrayEquals(new byte[0], partialRow.getBinaryCopy("binary-bytebuffer")); assertEquals(BigDecimal.valueOf(-99999, 3), partialRow.getDecimal("decimal")); } private int getColumnIndex(PartialRow partialRow, String columnName) { return partialRow.getSchema().getColumnIndex(columnName); } private PartialRow getPartialRowWithAllTypes() { Schema schema = getSchemaWithAllTypes(); // Ensure we aren't missing any types assertEquals(13, schema.getColumnCount()); PartialRow row = schema.newPartialRow(); row.addByte("int8", (byte) 42); row.addShort("int16", (short) 43); row.addInt("int32", 44); row.addLong("int64", 45); row.addTimestamp("timestamp", new Timestamp(1234567890)); row.addBoolean("bool", true); row.addFloat("float", 52.35F); row.addDouble("double", 53.35); row.addString("string", "fun with ütf\0"); row.addBinary("binary-array", new byte[] { 0, 1, 2, 3, 4 }); ByteBuffer binaryBuffer = ByteBuffer.wrap(new byte[] { 5, 6, 7, 8, 9 }); row.addBinary("binary-bytebuffer", binaryBuffer); row.setNull("null"); row.addDecimal("decimal", BigDecimal.valueOf(12345, 3)); return row; } // Shift the type one position to force the wrong type for all types. private Type getShiftedType(Type type) { int shiftedPosition = (type.ordinal() + 1) % Type.values().length; return Type.values()[shiftedPosition]; } private Object callGetByName(PartialRow partialRow, String columnName, Type type) { switch (type) { case INT8: return partialRow.getByte(columnName); case INT16: return partialRow.getShort(columnName); case INT32: return partialRow.getInt(columnName); case INT64: return partialRow.getLong(columnName); case UNIXTIME_MICROS: return partialRow.getTimestamp(columnName); case STRING: return partialRow.getString(columnName); case BINARY: return partialRow.getBinary(columnName); case FLOAT: return partialRow.getFloat(columnName); case DOUBLE: return partialRow.getDouble(columnName); case BOOL: return partialRow.getBoolean(columnName); case DECIMAL: return partialRow.getDecimal(columnName); default: throw new UnsupportedOperationException(); } } private Object callGetByIndex(PartialRow partialRow, int columnIndex, Type type) { switch (type) { case INT8: return partialRow.getByte(columnIndex); case INT16: return partialRow.getShort(columnIndex); case INT32: return partialRow.getInt(columnIndex); case INT64: return partialRow.getLong(columnIndex); case UNIXTIME_MICROS: return partialRow.getTimestamp(columnIndex); case STRING: return partialRow.getString(columnIndex); case BINARY: return partialRow.getBinary(columnIndex); case FLOAT: return partialRow.getFloat(columnIndex); case DOUBLE: return partialRow.getDouble(columnIndex); case BOOL: return partialRow.getBoolean(columnIndex); case DECIMAL: return partialRow.getDecimal(columnIndex); default: throw new UnsupportedOperationException(); } } private void callAddByName(PartialRow partialRow, String columnName, Type type) { switch (type) { case INT8: partialRow.addByte(columnName, (byte) 42); break; case INT16: partialRow.addShort(columnName, (short) 43); break; case INT32: partialRow.addInt(columnName, 44); break; case INT64: partialRow.addLong(columnName, 45); break; case UNIXTIME_MICROS: partialRow.addTimestamp(columnName, new Timestamp(1234567890)); break; case STRING: partialRow.addString(columnName, "fun with ütf\0"); break; case BINARY: partialRow.addBinary(columnName, new byte[] { 0, 1, 2, 3, 4 }); break; case FLOAT: partialRow.addFloat(columnName, 52.35F); break; case DOUBLE: partialRow.addDouble(columnName, 53.35); break; case BOOL: partialRow.addBoolean(columnName, true); break; case DECIMAL: partialRow.addDecimal(columnName, BigDecimal.valueOf(12345, 3)); break; default: throw new UnsupportedOperationException(); } } private void callAddByIndex(PartialRow partialRow, int columnIndex, Type type) { switch (type) { case INT8: partialRow.addByte(columnIndex, (byte) 42); break; case INT16: partialRow.addShort(columnIndex, (short) 43); break; case INT32: partialRow.addInt(columnIndex, 44); break; case INT64: partialRow.addLong(columnIndex, 45); break; case UNIXTIME_MICROS: partialRow.addTimestamp(columnIndex, new Timestamp(1234567890)); break; case STRING: partialRow.addString(columnIndex, "fun with ütf\0"); break; case BINARY: partialRow.addBinary(columnIndex, new byte[] { 0, 1, 2, 3, 4 }); break; case FLOAT: partialRow.addFloat(columnIndex, 52.35F); break; case DOUBLE: partialRow.addDouble(columnIndex, 53.35); break; case BOOL: partialRow.addBoolean(columnIndex, true); break; case DECIMAL: partialRow.addDecimal(columnIndex, BigDecimal.valueOf(12345, 3)); break; default: throw new UnsupportedOperationException(); } } }
InspurUSA/kudu
java/kudu-client/src/test/java/org/apache/kudu/client/TestPartialRow.java
Java
apache-2.0
21,274
[ 30522, 1013, 1013, 7000, 2000, 1996, 15895, 4007, 3192, 1006, 2004, 2546, 1007, 2104, 2028, 1013, 1013, 2030, 2062, 12130, 6105, 10540, 1012, 30524, 1025, 2017, 2089, 2025, 2224, 2023, 5371, 3272, 1999, 12646, 1013, 1013, 2007, 1996, 6105, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="generator" content="rustdoc"> <meta name="description" content="API documentation for the Rust `get_precision` fn in crate `script`."> <meta name="keywords" content="rust, rustlang, rust-lang, get_precision"> <title>script::dom::bindings::codegen::Bindings::WebGLShaderPrecisionFormatBinding::get_precision - Rust</title> <link rel="stylesheet" type="text/css" href="../../../../../../main.css"> </head> <body class="rustdoc"> <!--[if lte IE 8]> <div class="warning"> This old browser is unsupported and will most likely display funky things. </div> <![endif]--> <section class="sidebar"> <p class='location'><a href='../../../../../index.html'>script</a>::<wbr><a href='../../../../index.html'>dom</a>::<wbr><a href='../../../index.html'>bindings</a>::<wbr><a href='../../index.html'>codegen</a>::<wbr><a href='../index.html'>Bindings</a>::<wbr><a href='index.html'>WebGLShaderPrecisionFormatBinding</a></p><script>window.sidebarCurrent = {name: 'get_precision', ty: 'fn', relpath: ''};</script><script defer src="sidebar-items.js"></script> </section> <nav class="sub"> <form class="search-form js-only"> <div class="search-container"> <input class="search-input" name="search" autocomplete="off" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"> </div> </form> </nav> <section id='main' class="content fn"> <h1 class='fqn'><span class='in-band'>Function <a href='../../../../../index.html'>script</a>::<wbr><a href='../../../../index.html'>dom</a>::<wbr><a href='../../../index.html'>bindings</a>::<wbr><a href='../../index.html'>codegen</a>::<wbr><a href='../index.html'>Bindings</a>::<wbr><a href='index.html'>WebGLShaderPrecisionFormatBinding</a>::<wbr><a class='fn' href=''>get_precision</a></span><span class='out-of-band'><span id='render-detail'> <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs"> [<span class='inner'>&#x2212;</span>] </a> </span><a id='src-511714' class='srclink' href='../../../../../../src/script///home/servo/buildbot/slave/doc/build/target/debug/build/script-49135cd7c70c0a0f/out/Bindings/WebGLShaderPrecisionFormatBinding.rs.html#176-182' title='goto source code'>[src]</a></span></h1> <pre class='rust fn'>unsafe extern fn get_precision(cx: <a href='../../../../../../std/primitive.pointer.html'>*mut <a class='enum' href='../../../../../../js/jsapi/enum.JSContext.html' title='js::jsapi::JSContext'>JSContext</a></a>, _obj: <a class='type' href='../../../../../../js/jsapi/type.HandleObject.html' title='js::jsapi::HandleObject'>HandleObject</a>, this: <a href='../../../../../../std/primitive.pointer.html'>*const <a class='struct' href='../../../../../../script/dom/webglshaderprecisionformat/struct.WebGLShaderPrecisionFormat.html' title='script::dom::webglshaderprecisionformat::WebGLShaderPrecisionFormat'>WebGLShaderPrecisionFormat</a></a>, args: <a class='struct' href='../../../../../../js/jsapi/struct.JSJitGetterCallArgs.html' title='js::jsapi::JSJitGetterCallArgs'>JSJitGetterCallArgs</a>) -&gt; <a href='../../../../../../std/primitive.u8.html'>u8</a></pre></section> <section id='search' class="content hidden"></section> <section class="footer"></section> <div id="help" class="hidden"> <div> <div class="shortcuts"> <h1>Keyboard Shortcuts</h1> <dl> <dt>?</dt> <dd>Show this help dialog</dd> <dt>S</dt> <dd>Focus the search field</dd> <dt>&larrb;</dt> <dd>Move up in search results</dd> <dt>&rarrb;</dt> <dd>Move down in search results</dd> <dt>&#9166;</dt> <dd>Go to active search result</dd> </dl> </div> <div class="infos"> <h1>Search Tricks</h1> <p> Prefix searches with a type followed by a colon (e.g. <code>fn:</code>) to restrict the search to a given type. </p> <p> Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>. </p> <p> Search functions by type signature (e.g. <code>vec -> usize</code>) </p> </div> </div> </div> <script> window.rootPath = "../../../../../../"; window.currentCrate = "script"; window.playgroundUrl = ""; </script> <script src="../../../../../../jquery.js"></script> <script src="../../../../../../main.js"></script> <script async src="../../../../../../search-index.js"></script> </body> </html>
susaing/doc.servo.org
script/dom/bindings/codegen/Bindings/WebGLShaderPrecisionFormatBinding/fn.get_precision.html
HTML
mpl-2.0
5,373
[ 30522, 1026, 999, 9986, 13874, 16129, 1028, 1026, 16129, 11374, 1027, 1000, 4372, 1000, 1028, 1026, 2132, 1028, 1026, 18804, 25869, 13462, 1027, 1000, 21183, 2546, 1011, 1022, 1000, 1028, 1026, 18804, 2171, 1027, 1000, 3193, 6442, 1000, 418...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// -*- Mode: Go; indent-tabs-mode: t -*- /* * Copyright (C) 2014-2015 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ package snapstate import ( "fmt" "github.com/snapcore/snapd/boot" "github.com/snapcore/snapd/logger" "github.com/snapcore/snapd/overlord/state" "github.com/snapcore/snapd/release" "github.com/snapcore/snapd/snap" ) // UpdateBootRevisions synchronizes the active kernel and OS snap versions // with the versions that actually booted. This is needed because a // system may install "os=v2" but that fails to boot. The bootloader // fallback logic will revert to "os=v1" but on the filesystem snappy // still has the "active" version set to "v2" which is // misleading. This code will check what kernel/os booted and set // those versions active.To do this it creates a Change and kicks // start it directly. func UpdateBootRevisions(st *state.State) error { const errorPrefix = "cannot update revisions after boot changes: " if release.OnClassic { return nil } // nothing to check if there's no kernel ok, err := HasSnapOfType(st, snap.TypeKernel) if err != nil { return fmt.Errorf(errorPrefix+"%s", err) } if !ok { return nil } kernel, err := boot.GetCurrentBoot(snap.TypeKernel) if err != nil { return fmt.Errorf(errorPrefix+"%s", err) } base, err := boot.GetCurrentBoot(snap.TypeBase) if err != nil { return fmt.Errorf(errorPrefix+"%s", err) } var tsAll []*state.TaskSet for _, actual := range []*boot.NameAndRevision{kernel, base} { info, err := CurrentInfo(st, actual.Name) if err != nil { logger.Noticef("cannot get info for %q: %s", actual.Name, err) continue } if actual.Revision != info.SideInfo.Revision { // FIXME: check that there is no task // for this already in progress ts, err := RevertToRevision(st, actual.Name, actual.Revision, Flags{}) if err != nil { return err } tsAll = append(tsAll, ts) } } if len(tsAll) == 0 { return nil } msg := fmt.Sprintf("Update kernel and core snap revisions") chg := st.NewChange("update-revisions", msg) for _, ts := range tsAll { chg.AddAll(ts) } st.EnsureBefore(0) return nil }
ubuntu-core/snappy
overlord/snapstate/booted.go
GO
gpl-3.0
2,708
[ 30522, 1013, 1013, 1011, 1008, 1011, 5549, 1024, 2175, 1025, 27427, 4765, 1011, 21628, 2015, 1011, 5549, 1024, 1056, 1011, 1008, 1011, 1013, 1008, 1008, 9385, 1006, 1039, 1007, 2297, 1011, 2325, 18562, 5183, 1008, 1008, 2023, 2565, 2003, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package org.knowm.xchange.atlasats; import si.mazi.rescu.serialization.jackson.JacksonConfigureListener; import com.fasterxml.jackson.core.JsonParser.Feature; import com.fasterxml.jackson.databind.ObjectMapper; public class AtlasJacksonConfigureListener implements JacksonConfigureListener { @Override public void configureObjectMapper(ObjectMapper arg0) { arg0.configure(Feature.ALLOW_COMMENTS, true); } }
mmithril/XChange
xchange-atlasats/src/test/java/org/knowm/xchange/atlasats/AtlasJacksonConfigureListener.java
Java
mit
423
[ 30522, 7427, 8917, 1012, 2113, 2213, 1012, 1060, 22305, 2063, 1012, 11568, 11149, 1025, 12324, 9033, 1012, 5003, 5831, 1012, 24501, 10841, 1012, 7642, 3989, 1012, 4027, 1012, 4027, 8663, 8873, 27390, 29282, 6528, 2121, 1025, 12324, 4012, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// Regular expression that matches all symbols in the Linear B Syllabary block as per Unicode v5.1.0: /\uD800[\uDC00-\uDC7F]/;
mathiasbynens/unicode-data
5.1.0/blocks/Linear-B-Syllabary-regex.js
JavaScript
mit
126
[ 30522, 1013, 1013, 3180, 3670, 2008, 3503, 2035, 9255, 1999, 1996, 7399, 1038, 25353, 4571, 8237, 2100, 3796, 2004, 2566, 27260, 1058, 2629, 1012, 1015, 1012, 1014, 1024, 1013, 1032, 20904, 17914, 2692, 1031, 1032, 20904, 2278, 8889, 1011, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
using System; using Neutronium.Core; namespace Neutronium.WPF { /// <summary> /// IWPFWebWindow factory: abstraction of a WPF implementation of an HTML Browser /// </summary> public interface IWPFWebWindowFactory : IDisposable { /// <summary> /// Get the name of underlying javascript engine /// </summary> string EngineName { get; } /// <summary> /// Get the version of underlying javascript engine /// </summary> string EngineVersion { get; } /// <summary> /// Get the javascript engine environment information /// including Platform build if nay /// </summary> string Environment { get; } /// <summary> /// value of the .Net glue framework to javascript engine /// </summary> string Name { get; } /// <summary> /// Create a new IWPFWebWindow /// </summary> ///<param name="useNeutroniumSettings"> /// indicates if browser should use dedicated neutronium settings /// </param> /// <returns> /// a new IWPFWebWindow <see cref="IWPFWebWindow"/> ///</returns> IWPFWebWindow Create(bool useNeutroniumSettings); /// <summary> /// get IsModern value /// </summary> /// <returns> /// true if engine create a IWPFWebWindow which HTMLWindow /// is a IModernWebBrowserWindow ///</returns> bool IsModern { get; } /// <summary> /// get or set WebSessionLogger /// </summary> IWebSessionLogger WebSessionLogger { get; set; } } }
David-Desmaisons/MVVM.CEF.Glue
Neutronium.WPF/IWPFWebWindowFactory.cs
C#
lgpl-3.0
1,665
[ 30522, 2478, 2291, 1025, 2478, 20393, 5007, 1012, 30524, 1037, 1059, 14376, 7375, 1997, 2019, 16129, 16602, 1013, 1013, 1013, 1026, 1013, 12654, 1028, 2270, 8278, 1045, 2860, 14376, 8545, 2497, 11101, 5004, 21450, 1024, 8909, 2483, 6873, 19...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
import os import os.path import sys import pygame from buffalo import utils from buffalo.scene import Scene from buffalo.label import Label from buffalo.button import Button from buffalo.input import Input from buffalo.tray import Tray from camera import Camera from mapManager import MapManager from pluginManager import PluginManager from toolManager import ToolManager class CameraController: def __init__(self): self.fPos = (0.0, 0.0) self.pos = (int(self.fPos[0]), int(self.fPos[1])) self.xv, self.yv = 0.0, 0.0 self.speed = 1.2 self.shift_speed = self.speed * 5.0 def update(self, keys): w, a, s, d, shift = ( keys[pygame.K_w], keys[pygame.K_a], keys[pygame.K_s], keys[pygame.K_d], keys[pygame.K_LSHIFT], ) if shift: speed = self.shift_speed else: speed = self.speed speed *= utils.delta / 16.0 self.xv = 0.0 self.yv = 0.0 if w: self.yv -= speed if a: self.xv -= speed if s: self.yv += speed if d: self.xv += speed x, y = self.fPos x += self.xv y += self.yv self.fPos = x, y self.pos = (int(self.fPos[0]), int(self.fPos[1])) class EditMapTestScene(Scene): def on_escape(self): sys.exit() def blit(self): Camera.blitView() def update(self): super(EditMapTestScene, self).update() keys = pygame.key.get_pressed() self.camera_controller.update(keys) Camera.update() MapManager.soft_load_writer() def __init__(self): Scene.__init__(self) self.BACKGROUND_COLOR = (0, 0, 0, 255) PluginManager.loadPlugins() self.camera_controller = CameraController() Camera.lock(self.camera_controller, initial_update=True) Button.DEFAULT_SEL_COLOR = (50, 50, 100, 255) self.tool_tray = Tray( (utils.SCREEN_W - 270, 20), (250, 800), min_width=250, max_width=250, min_height=250, max_height=800, color=(100, 50, 50, 100), ) self.tool_tray.labels.add( Label( (int(self.tool_tray.width / 2), 10), "Tool Tray", color=(255,255,255,255), x_centered=True, font="default24", ) ) self.tool_tray.labels.add( Label( (int(self.tool_tray.width / 2), 25), "________________", color=(255,255,255,255), x_centered=True, font="default18", ) ) self.tool_tray.labels.add( Label( (int(self.tool_tray.width / 2), 50), "Function", color=(255,255,255,255), x_centered=True, font="default18", ) ) def set_func_state_to_select(): ToolManager.set_func_state(ToolManager.FUNC_SELECT) self.tool_tray.render() self.button_select_mode = Button( (15, 80), " Select Mode ", color=(255,255,255,255), bg_color=(100,100,200,255), font="default12", func=set_func_state_to_select, ) self.tool_tray.buttons.add(self.button_select_mode) def set_func_state_to_fill(): ToolManager.set_func_state(ToolManager.FUNC_FILL) self.tool_tray.render() self.button_fill_mode = Button( (self.tool_tray.width - 15, 80), " Fill Mode ", color=(255,255,255,255), bg_color=(100,100,200,255), invert_x_pos=True, font="default12", func=set_func_state_to_fill, ) self.tool_tray.buttons.add(self.button_fill_mode) self.tool_tray.labels.add( Label( (int(self.tool_tray.width / 2), 120), "________________", color=(255,255,255,255), x_centered=True, font="default18", ) ) self.tool_tray.labels.add( Label( (int(self.tool_tray.width / 2), 150), "Area of Effect", color=(255,255,255,255), x_centered=True, font="default18", ) ) def set_effect_state_to_draw(): ToolManager.set_effect_state(ToolManager.EFFECT_DRAW) self.tool_tray.render() self.button_draw_mode = Button( (15, 180), " Draw Mode ", color=(255,255,255,255), bg_color=(100,100,200,255), font="default12", func=set_effect_state_to_draw, ) self.tool_tray.buttons.add(self.button_draw_mode) def set_effect_state_to_area(): ToolManager.set_effect_state(ToolManager.EFFECT_AREA) self.tool_tray.render() self.button_area_mode = Button( (self.tool_tray.width - 15, 180), " Area Mode ", color=(255,255,255,255), bg_color=(100,100,200,255), invert_x_pos=True, font="default12", func=set_effect_state_to_area, ) self.tool_tray.buttons.add(self.button_area_mode) ToolManager.initialize_states( ToolManager.FUNC_SELECT, ToolManager.EFFECT_DRAW, ( self.button_fill_mode, self.button_select_mode, self.button_draw_mode, self.button_area_mode, ), ) self.tool_tray.render() self.trays.add(self.tool_tray)
benjamincongdon/adept
editMapTestScene.py
Python
mit
5,875
[ 30522, 12324, 9808, 12324, 9808, 1012, 4130, 12324, 25353, 2015, 12324, 1052, 2100, 16650, 2013, 6901, 12324, 21183, 12146, 2013, 6901, 1012, 3496, 12324, 3496, 2013, 6901, 1012, 3830, 12324, 3830, 2013, 6901, 1012, 6462, 12324, 6462, 2013, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package com.ftfl.ftflnavigationdrawer; import android.app.Fragment; import android.app.FragmentManager; import android.content.res.Configuration; import android.os.Bundle; import android.support.v4.app.ActionBarDrawerToggle; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarActivity; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; import com.ftfl.ftflnavigationdrawer.fragment.GeneralFragment; import com.ftfl.ftflnavigationdrawer.fragment.GrowthFragment; import com.ftfl.ftflnavigationdrawer.fragment.VaccinationFragment; public class MainActivity extends ActionBarActivity { private DrawerLayout mDrawerLayout; private ListView mDrawerList; private ActionBarDrawerToggle mDrawerToggle; private CharSequence mDrawerTitle; private CharSequence mTitle; private String[] mDrawarMenus; Fragment fragment; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mTitle = mDrawerTitle = getTitle(); mDrawarMenus =getResources().getStringArray(R.array.drawer_menu_array); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerList = (ListView) findViewById(R.id.left_drawer); // set a custom shadow that overlays the main content when the drawer opens mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); // set up the drawer's list view with items and click listener mDrawerList.setAdapter(new ArrayAdapter<String>(this, R.layout.item_drawer_list, mDrawarMenus)); mDrawerList.setOnItemClickListener(new DrawerItemClickListener()); // enable ActionBar app icon to behave as action to toggle nav drawer // ActionBarDrawerToggle ties together the the proper interactions // between the sliding drawer and the action bar app icon mDrawerToggle = new ActionBarDrawerToggle( this, /* host Activity */ mDrawerLayout, /* DrawerLayout object */ R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */ R.string.navigation_drawer_open, /* "open drawer" description for accessibility */ R.string.navigation_drawer_close /* "close drawer" description for accessibility */ ) { public void onDrawerClosed(View view) { getActionBar().setTitle(mTitle); invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() } public void onDrawerOpened(View drawerView) { getActionBar().setTitle(mDrawerTitle); invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() } }; mDrawerLayout.setDrawerListener(mDrawerToggle); getActionBar().setDisplayHomeAsUpEnabled(true); getActionBar().setHomeButtonEnabled(true); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main, menu); return true; } /* Called whenever we call invalidateOptionsMenu() */ @Override public boolean onPrepareOptionsMenu(Menu menu) { // If the nav drawer is open, hide action items related to the content view boolean drawerOpen = mDrawerLayout.isDrawerOpen(mDrawerList); menu.findItem(R.id.action_settings).setVisible(!drawerOpen); return super.onPrepareOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { // The action bar home/up action should open or close the drawer. // ActionBarDrawerToggle will take care of this. if (mDrawerToggle.onOptionsItemSelected(item)) { return true; } // Handle action buttons switch(item.getItemId()) { case R.id.action_settings: return true; default: return super.onOptionsItemSelected(item); } } /* The click listner for ListView in the navigation drawer */ private class DrawerItemClickListener implements ListView.OnItemClickListener { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { selectItem(position); } } private void selectItem(int position) { // update the main content by replacing fragments FragmentManager fragmentManager = getFragmentManager(); switch (position) { case 0: fragment = new GeneralFragment(); break; case 1: fragment = new VaccinationFragment(); break; case 2: fragment = new GrowthFragment(); break; default: break; } fragmentManager.beginTransaction().replace(R.id.container, fragment).commit(); // update selected item and title, then close the drawer mDrawerList.setItemChecked(position, true); setTitle(mDrawarMenus[position]); mDrawerLayout.closeDrawer(mDrawerList); } @Override public void setTitle(CharSequence title) { mTitle = title; getActionBar().setTitle(mTitle); } /** * When using the ActionBarDrawerToggle, you must call it during * onPostCreate() and onConfigurationChanged()... */ @Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); // Sync the toggle state after onRestoreInstanceState has occurred. mDrawerToggle.syncState(); } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); // Pass any configuration change to the drawer toggls mDrawerToggle.onConfigurationChanged(newConfig); } }
nasser-munshi/Android
FTFLNavigationDrawer/src/com/ftfl/ftflnavigationdrawer/MainActivity.java
Java
apache-2.0
6,040
[ 30522, 7427, 4012, 1012, 3027, 10258, 1012, 3027, 10258, 2532, 5737, 12540, 7265, 13777, 1025, 12324, 11924, 1012, 10439, 1012, 15778, 1025, 12324, 11924, 1012, 10439, 1012, 15778, 24805, 4590, 1025, 12324, 11924, 1012, 4180, 1012, 24501, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#ifndef __CODEC_COM_ETSI_OP_H__ #define __CODEC_COM_ETSI_OP_H__ /***************************************************************************** 1 ÆäËûÍ·Îļþ°üº¬ *****************************************************************************/ #ifndef _MED_C89_ #include "codec_op_etsi_hifi.h" #endif #ifdef __cplusplus #if __cplusplus extern "C" { #endif #endif /***************************************************************************** 2 Êý¾ÝÀàÐͶ¨Òå *****************************************************************************/ /* ±ê×¼Cƽ̨¶¨Òå */ #ifdef _MED_C89_ /* »ù±¾Êý¾ÝÀàÐͶ¨Òå */ typedef char Char; typedef signed char Word8; typedef unsigned char UWord8; typedef short Word16; typedef unsigned short UWord16; typedef long Word32; typedef unsigned long UWord32; typedef int Flag; #endif /***************************************************************************** 3 ºê¶¨Òå *****************************************************************************/ #define MAX_32 ((Word32)0x7fffffffL) /*×î´óµÄ32λÊý*/ #define MIN_32 ((Word32)0x80000000L) /*×îСµÄ32λÊý*/ #define MAX_16 ((Word16)0x7fff) /*×î´óµÄ16λÊý*/ #define MIN_16 ((Word16)0x8000) /*×îСµÄ16λÊý*/ /* ±ê×¼Cƽ̨¶¨Òå */ #ifdef _MED_C89_ #define CODEC_OpSetOverflow(swFlag) (Overflow = swFlag) #define CODEC_OpGetOverflow() (Overflow) #define CODEC_OpSetCarry(swFlag) (Carry = swFlag) #define CODEC_OpGetCarry() (Carry) #define XT_INLINE static #endif /***************************************************************************** 4 ö¾Ù¶¨Òå *****************************************************************************/ /***************************************************************************** 5 ÏûϢͷ¶¨Òå *****************************************************************************/ /***************************************************************************** 6 ÏûÏ¢¶¨Òå *****************************************************************************/ /***************************************************************************** 7 STRUCT¶¨Òå *****************************************************************************/ /***************************************************************************** 8 UNION¶¨Òå *****************************************************************************/ /***************************************************************************** 9 OTHERS¶¨Òå *****************************************************************************/ #define round(L_var1) round_etsi(L_var1) /***************************************************************************** 10 È«¾Ö±äÁ¿ÉùÃ÷ *****************************************************************************/ /* ±ê×¼Cƽ̨¶¨Òå */ #ifdef _MED_C89_ extern Flag Overflow; extern Flag Carry; #endif /***************************************************************************** 11 º¯ÊýÉùÃ÷ *****************************************************************************/ #ifdef _MED_C89_ /* ETSI : basic_op.h */ extern Word16 saturate (Word32 swVar); /* 32bit->16bit */ extern Word16 add(Word16 shwVar1, Word16 shwVar2); /* Short add */ extern Word16 sub(Word16 shwVar1, Word16 shwVar2); /* Short sub */ extern Word16 abs_s(Word16 shwVar1); /* Short abs */ extern Word16 shl(Word16 shwVar1, Word16 shwVar2); /* Short shift left */ extern Word16 shr(Word16 shwVar1, Word16 shwVar2); /* Short shift right*/ extern Word16 mult(Word16 shwVar1, Word16 shwVar2); /* Short mult */ extern Word32 L_mult(Word16 shwVar1, Word16 shwVar2); /* Long mult */ extern Word16 negate(Word16 shwVar1); /* Short negate */ extern Word16 extract_h(Word32 swVar1); /* Extract high */ extern Word16 extract_l(Word32 swVar1); /* Extract low */ extern Word16 round_etsi(Word32 swVar1); /* Round */ extern Word32 L_mac(Word32 swVar3, Word16 shwVar1, Word16 shwVar2); /* Mac */ extern Word32 L_msu(Word32 swVar3, Word16 shwVar1, Word16 shwVar2); /* Msu */ extern Word32 L_macNs(Word32 swVar3, Word16 shwVar1, Word16 shwVar2); /* Mac without sat */ extern Word32 L_msuNs(Word32 swVar3, Word16 shwVar1, Word16 shwVar2); /* Msu without sat */ extern Word32 L_add(Word32 swVar1, Word32 swVar2); /* Long add */ extern Word32 L_sub(Word32 swVar1, Word32 swVar2); /* Long sub */ extern Word32 L_add_c(Word32 swVar1, Word32 swVar2); /* Long add with c */ extern Word32 L_sub_c(Word32 swVar1, Word32 swVar2); /* Long sub with c */ extern Word32 L_negate(Word32 swVar1); /* Long negate */ extern Word16 mult_r(Word16 shwVar1, Word16 shwVar2); /* Mult with round */ extern Word32 L_shl(Word32 swVar1, Word16 shwVar2); /* Long shift left */ extern Word32 L_shr(Word32 swVar1, Word16 shwVar2); /* Long shift right */ extern Word16 shr_r(Word16 shwVar1, Word16 shwVar2); /* Shift right with round */ extern Word16 mac_r(Word32 swVar3, Word16 shwVar1, Word16 shwVar2); /* Mac with rounding */ extern Word16 msu_r(Word32 swVar3, Word16 shwVar1, Word16 shwVar2); /* Msu with rounding */ extern Word32 L_deposit_h(Word16 shwVar1); /* 16 bit shwVar1 -> MSB */ extern Word32 L_deposit_l(Word16 shwVar1); /* 16 bit shwVar1 -> LSB */ extern Word32 L_shr_r(Word32 swVar1, Word16 shwVar2); /* Long shift right with round */ extern Word32 L_abs(Word32 swVar1); /* Long abs */ extern Word32 L_sat(Word32 swVar1); /* Long saturation */ extern Word16 norm_s(Word16 shwVar1); /* Short norm */ extern Word16 div_s(Word16 shwVar1, Word16 shwVar2); /* Short division */ extern Word16 norm_l(Word32 swVar1); /* Long norm */ /* ETSI : oper_32b.h */ /* Extract from a 32 bit integer two 16 bit DPF */ extern void L_Extract(Word32 swVar32, Word16 *pshwHi, Word16 *pshwLo); /* Compose from two 16 bit DPF a 32 bit integer */ extern Word32 L_Comp(Word16 shwHi, Word16 shwLo); /* Multiply two 32 bit integers (DPF). The result is divided by 2**31 */ extern Word32 Mpy_32(Word16 shwHi1, Word16 shwLo1, Word16 shwHi2, Word16 shwLo2); /* Multiply a 16 bit integer by a 32 bit (DPF). The result is divided by 2**15 */ extern Word32 Mpy_32_16(Word16 shwHi, Word16 shwLo, Word16 shwN); /* Fractional integer division of two 32 bit numbers */ extern Word32 Div_32(Word32 swNum, Word16 denom_hi, Word16 denom_lo); /* ETSI : mac_32.h */ /* Multiply two 32 bit integers (DPF) and accumulate with (normal) 32 bit integer. The multiplication result is divided by 2**31 */ extern Word32 Mac_32(Word32 swVar32, Word16 shwHi1, Word16 shwLo1, Word16 shwHi2, Word16 shwLo2); /* Multiply a 16 bit integer by a 32 bit (DPF) and accumulate with (normal)32 bit integer. The multiplication result is divided by 2**15 */ extern Word32 Mac_32_16(Word32 swVar32, Word16 shwHi, Word16 shwLo, Word16 shwN); #endif /* ifdef _MED_C89_ */ #ifdef __cplusplus #if __cplusplus } #endif #endif #endif /* end of med_com_etsi_op.h */
gabry3795/android_kernel_huawei_mt7_l09
drivers/vendor/hisi/modem/med/common/inc/codec/codec_op_etsi.h
C
gpl-2.0
8,235
[ 30522, 1001, 2065, 13629, 2546, 1035, 1035, 3642, 2278, 1035, 4012, 1035, 3802, 5332, 1035, 6728, 1035, 1044, 1035, 1035, 1001, 9375, 1035, 1035, 3642, 2278, 1035, 4012, 1035, 3802, 5332, 1035, 6728, 30524, 1008, 1008, 1008, 1008, 1008, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
The PDF includes all problems from the 2012 SoCal Regional ICPC. We're only doing problem six this week! That's the one entitled "The Perks of Planning Ahead." <a href="http://socalcontest.org/current/index.shtml" target="_blank">SoCal ICPC official website</a>
acm-csuf/icpc
2012-12-6-The_Perks_of_Planning_Ahead/notes.md
Markdown
mit
263
[ 30522, 1996, 11135, 2950, 2035, 3471, 2013, 1996, 2262, 27084, 2389, 3164, 24582, 15042, 1012, 2057, 1005, 2128, 2069, 2725, 3291, 2416, 2023, 2733, 999, 2008, 1005, 1055, 1996, 2028, 4709, 1000, 1996, 2566, 5705, 1997, 4041, 3805, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php /** * The template for displaying Archive pages. * * Used to display archive-type pages if nothing more specific matches a query. * For example, puts together date-based pages if no date.php file exists. * * If you'd like to further customize these archive views, you may create a * new template file for each specific one. For example, Quasar Theme * already has tag.php for Tag archives, category.php for Category archives, * and author.php for Author archives. * * Learn more: http://codex.wordpress.org/Template_Hierarchy * * @package WordPress * @subpackage Quasar Theme * @since Quasar Theme 1.0 */ get_header(); ?> <div id="primary" class="content-area"> <div id="content" class="site-content" role="main"> <?php if ( have_posts() ) : ?> <header class="archive-header"> <h1 class="archive-title"><?php if ( is_day() ) : printf( __( 'Daily Archives: %s', 'quasartheme' ), get_the_date() ); elseif ( is_month() ) : printf( __( 'Monthly Archives: %s', 'quasartheme' ), get_the_date( _x( 'F Y', 'monthly archives date format', 'quasartheme' ) ) ); elseif ( is_year() ) : printf( __( 'Yearly Archives: %s', 'quasartheme' ), get_the_date( _x( 'Y', 'yearly archives date format', 'quasartheme' ) ) ); else : _e( 'Archives', 'quasartheme' ); endif; ?></h1> </header><!-- .archive-header --> <?php /* The loop */ ?> <?php while ( have_posts() ) : the_post(); ?> <?php get_template_part( 'content', get_post_format() ); ?> <?php endwhile; ?> <?php quasartheme_paging_nav(); ?> <?php else : ?> <?php get_template_part( 'content', 'none' ); ?> <?php endif; ?> </div><!-- #content --> </div><!-- #primary --> <?php get_sidebar(); ?> <?php get_footer(); ?>
peeyarmenon/quasar-theme-framework
archive.php
PHP
gpl-3.0
1,773
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 1008, 1996, 23561, 2005, 14962, 8756, 5530, 1012, 1008, 1008, 2109, 2000, 4653, 8756, 1011, 2828, 5530, 2065, 2498, 2062, 3563, 3503, 1037, 23032, 1012, 1008, 2005, 2742, 1010, 8509, 2362, 3058, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright 2015, The Querydsl Team (http://www.querydsl.com/team) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.querydsl.sql; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import org.junit.Test; public class MultikeyTest { Multikey multiKey1 = new Multikey(); Multikey multiKey2 = new Multikey(); @Test public void hashCode_() { int hashCode = multiKey1.hashCode(); multiKey1.setId(1); assertEquals(hashCode, multiKey1.hashCode()); multiKey1.setId2("2"); multiKey1.setId3(3); multiKey2.setId(1); multiKey2.setId2("2"); multiKey2.setId3(3); assertEquals(multiKey1.hashCode(), multiKey2.hashCode()); } @Test public void equals() { multiKey1.setId(1); multiKey1.setId2("2"); multiKey1.setId3(3); assertFalse(multiKey1.equals(multiKey2)); multiKey2.setId(1); assertFalse(multiKey1.equals(multiKey2)); multiKey2.setId2("2"); multiKey2.setId3(3); assertEquals(multiKey1, multiKey2); } @Test public void toString_() { assertEquals("Multikey#null;null;null", multiKey1.toString()); multiKey1.setId(1); multiKey1.setId2("2"); multiKey1.setId3(3); assertEquals("Multikey#1;2;3", multiKey1.toString()); } }
balazs-zsoldos/querydsl
querydsl-sql/src/test/java/com/querydsl/sql/MultikeyTest.java
Java
apache-2.0
1,905
[ 30522, 1013, 1008, 1008, 9385, 2325, 1010, 1996, 23032, 5104, 2140, 2136, 1006, 8299, 1024, 1013, 1013, 7479, 1012, 23032, 5104, 2140, 1012, 4012, 1013, 2136, 1007, 1008, 1008, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#pragma once #include "CScanner.h" #include "CToken.h" class CLexer { public: CLexer(); ~CLexer(); void SetCharacters(CCharacter* pCharacter, int nCharacters); CToken* GetTokens(); int GetTokenCount(); unsigned int ProcessCharacters(); private: unsigned int ConstructToken(int& index); char* GetTokenType(char* tokenString); CCharacter* m_pCharacter; CToken* m_pToken; int m_nTokens; int m_nCharacters; };
patrickmortensen/Elektro
Source To Merge/Interpreter/CLexer.h
C
lgpl-3.0
461
[ 30522, 1001, 10975, 8490, 2863, 2320, 1001, 2421, 1000, 20116, 9336, 3678, 1012, 1044, 1000, 1001, 2421, 1000, 14931, 11045, 2078, 1012, 1044, 1000, 2465, 18856, 10288, 2121, 1063, 2270, 1024, 18856, 10288, 2121, 1006, 1007, 1025, 1066, 188...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (factory((global.Inferno = global.Inferno || {}))); }(this, (function (exports) { 'use strict'; var NO_OP = '$NO_OP'; var ERROR_MSG = 'a runtime error occured! Use Inferno in development environment to find the error.'; // This should be boolean and not reference to window.document var isBrowser = !!(typeof window !== 'undefined' && window.document); // this is MUCH faster than .constructor === Array and instanceof Array // in Node 7 and the later versions of V8, slower in older versions though var isArray = Array.isArray; function isStringOrNumber(o) { var type = typeof o; return type === 'string' || type === 'number'; } function isNullOrUndef(o) { return isUndefined(o) || isNull(o); } function isInvalid(o) { return isNull(o) || o === false || isTrue(o) || isUndefined(o); } function isFunction(o) { return typeof o === 'function'; } function isString(o) { return typeof o === 'string'; } function isNumber(o) { return typeof o === 'number'; } function isNull(o) { return o === null; } function isTrue(o) { return o === true; } function isUndefined(o) { return o === void 0; } function isDefined(o) { return o !== void 0; } function isObject(o) { return typeof o === 'object'; } function throwError(message) { if (!message) { message = ERROR_MSG; } throw new Error(("Inferno Error: " + message)); } function warning(message) { // tslint:disable-next-line:no-console console.error(message); } function combineFrom(first, second) { var out = {}; if (first) { for (var key in first) { out[key] = first[key]; } } if (second) { for (var key$1 in second) { out[key$1] = second[key$1]; } } return out; } function getTagName(input) { var tagName; if (isArray(input)) { var arrayText = input.length > 3 ? input.slice(0, 3).toString() + ',...' : input.toString(); tagName = 'Array(' + arrayText + ')'; } else if (isStringOrNumber(input)) { tagName = 'Text(' + input + ')'; } else if (isInvalid(input)) { tagName = 'InvalidVNode(' + input + ')'; } else { var flags = input.flags; if (flags & 481 /* Element */) { tagName = "<" + (input.type) + (input.className ? ' class="' + input.className + '"' : '') + ">"; } else if (flags & 16 /* Text */) { tagName = "Text(" + (input.children) + ")"; } else if (flags & 1024 /* Portal */) { tagName = "Portal*"; } else { var type = input.type; // Fallback for IE var componentName = type.name || type.displayName || type.constructor.name || (type.toString().match(/^function\s*([^\s(]+)/) || [])[1]; tagName = "<" + componentName + " />"; } } return '>> ' + tagName + '\n'; } function DEV_ValidateKeys(vNodeTree, vNode, forceKeyed) { var foundKeys = []; for (var i = 0, len = vNodeTree.length; i < len; i++) { var childNode = vNodeTree[i]; if (isArray(childNode)) { return 'Encountered ARRAY in mount, array must be flattened, or normalize used. Location: \n' + getTagName(childNode); } if (isInvalid(childNode)) { if (forceKeyed) { return 'Encountered invalid node when preparing to keyed algorithm. Location: \n' + getTagName(childNode); } else if (foundKeys.length !== 0) { return 'Encountered invalid node with mixed keys. Location: \n' + getTagName(childNode); } continue; } if (typeof childNode === 'object') { childNode.isValidated = true; } var key = childNode.key; if (!isNullOrUndef(key) && !isStringOrNumber(key)) { return 'Encountered child vNode where key property is not string or number. Location: \n' + getTagName(childNode); } var children = childNode.children; var childFlags = childNode.childFlags; if (!isInvalid(children)) { var val = (void 0); if (childFlags & 12 /* MultipleChildren */) { val = DEV_ValidateKeys(children, childNode, childNode.childFlags & 8 /* HasKeyedChildren */); } else if (childFlags === 2 /* HasVNodeChildren */) { val = DEV_ValidateKeys([children], childNode, childNode.childFlags & 8 /* HasKeyedChildren */); } if (val) { val += getTagName(childNode); return val; } } if (forceKeyed && isNullOrUndef(key)) { return ('Encountered child without key during keyed algorithm. If this error points to Array make sure children is flat list. Location: \n' + getTagName(childNode)); } else if (!forceKeyed && isNullOrUndef(key)) { if (foundKeys.length !== 0) { return 'Encountered children with key missing. Location: \n' + getTagName(childNode); } continue; } if (foundKeys.indexOf(key) > -1) { return 'Encountered two children with same key: {' + key + '}. Location: \n' + getTagName(childNode); } foundKeys.push(key); } } function validateVNodeElementChildren(vNode) { { if (vNode.childFlags & 1 /* HasInvalidChildren */) { return; } if (vNode.flags & 64 /* InputElement */) { throwError("input elements can't have children."); } if (vNode.flags & 128 /* TextareaElement */) { throwError("textarea elements can't have children."); } if (vNode.flags & 481 /* Element */) { var voidTypes = ['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr']; var tag = vNode.type.toLowerCase(); if (tag === 'media') { throwError("media elements can't have children."); } var idx = voidTypes.indexOf(tag); if (idx !== -1) { throwError(((voidTypes[idx]) + " elements can't have children.")); } } } } function validateKeys(vNode) { { // Checks if there is any key missing or duplicate keys if (vNode.isValidated === false && vNode.children && vNode.flags & 481 /* Element */) { var error = DEV_ValidateKeys(Array.isArray(vNode.children) ? vNode.children : [vNode.children], vNode, (vNode.childFlags & 8 /* HasKeyedChildren */) > 0); if (error) { throwError(error + getTagName(vNode)); } } vNode.isValidated = true; } } var keyPrefix = '$'; function getVNode(childFlags, children, className, flags, key, props, ref, type) { { return { childFlags: childFlags, children: children, className: className, dom: null, flags: flags, isValidated: false, key: key === void 0 ? null : key, parentVNode: null, props: props === void 0 ? null : props, ref: ref === void 0 ? null : ref, type: type }; } return { childFlags: childFlags, children: children, className: className, dom: null, flags: flags, key: key === void 0 ? null : key, parentVNode: null, props: props === void 0 ? null : props, ref: ref === void 0 ? null : ref, type: type }; } function createVNode(flags, type, className, children, childFlags, props, key, ref) { { if (flags & 14 /* Component */) { throwError('Creating Component vNodes using createVNode is not allowed. Use Inferno.createComponentVNode method.'); } } var childFlag = childFlags === void 0 ? 1 /* HasInvalidChildren */ : childFlags; var vNode = getVNode(childFlag, children, className, flags, key, props, ref, type); var optsVNode = options.createVNode; if (typeof optsVNode === 'function') { optsVNode(vNode); } if (childFlag === 0 /* UnknownChildren */) { normalizeChildren(vNode, vNode.children); } { validateVNodeElementChildren(vNode); } return vNode; } function createComponentVNode(flags, type, props, key, ref) { { if (flags & 1 /* HtmlElement */) { throwError('Creating element vNodes using createComponentVNode is not allowed. Use Inferno.createVNode method.'); } } if ((flags & 2 /* ComponentUnknown */) > 0) { flags = isDefined(type.prototype) && isFunction(type.prototype.render) ? 4 /* ComponentClass */ : 8 /* ComponentFunction */; } // set default props var defaultProps = type.defaultProps; if (!isNullOrUndef(defaultProps)) { if (!props) { props = {}; // Props can be referenced and modified at application level so always create new object } for (var prop in defaultProps) { if (isUndefined(props[prop])) { props[prop] = defaultProps[prop]; } } } if ((flags & 8 /* ComponentFunction */) > 0) { var defaultHooks = type.defaultHooks; if (!isNullOrUndef(defaultHooks)) { if (!ref) { // As ref cannot be referenced from application level, we can use the same refs object ref = defaultHooks; } else { for (var prop$1 in defaultHooks) { if (isUndefined(ref[prop$1])) { ref[prop$1] = defaultHooks[prop$1]; } } } } } var vNode = getVNode(1 /* HasInvalidChildren */, null, null, flags, key, props, ref, type); var optsVNode = options.createVNode; if (isFunction(optsVNode)) { optsVNode(vNode); } return vNode; } function createTextVNode(text, key) { return getVNode(1 /* HasInvalidChildren */, isNullOrUndef(text) ? '' : text, null, 16 /* Text */, key, null, null, null); } function normalizeProps(vNode) { var props = vNode.props; if (props) { var flags = vNode.flags; if (flags & 481 /* Element */) { if (isDefined(props.children) && isNullOrUndef(vNode.children)) { normalizeChildren(vNode, props.children); } if (isDefined(props.className)) { vNode.className = props.className || null; props.className = undefined; } } if (isDefined(props.key)) { vNode.key = props.key; props.key = undefined; } if (isDefined(props.ref)) { if (flags & 8 /* ComponentFunction */) { vNode.ref = combineFrom(vNode.ref, props.ref); } else { vNode.ref = props.ref; } props.ref = undefined; } } return vNode; } function directClone(vNodeToClone) { var newVNode; var flags = vNodeToClone.flags; if (flags & 14 /* Component */) { var props; var propsToClone = vNodeToClone.props; if (!isNull(propsToClone)) { props = {}; for (var key in propsToClone) { props[key] = propsToClone[key]; } } newVNode = createComponentVNode(flags, vNodeToClone.type, props, vNodeToClone.key, vNodeToClone.ref); } else if (flags & 481 /* Element */) { var children = vNodeToClone.children; newVNode = createVNode(flags, vNodeToClone.type, vNodeToClone.className, children, 0 /* UnknownChildren */, vNodeToClone.props, vNodeToClone.key, vNodeToClone.ref); } else if (flags & 16 /* Text */) { newVNode = createTextVNode(vNodeToClone.children, vNodeToClone.key); } else if (flags & 1024 /* Portal */) { newVNode = vNodeToClone; } return newVNode; } function createVoidVNode() { return createTextVNode('', null); } function _normalizeVNodes(nodes, result, index, currentKey) { for (var len = nodes.length; index < len; index++) { var n = nodes[index]; if (!isInvalid(n)) { var newKey = currentKey + keyPrefix + index; if (isArray(n)) { _normalizeVNodes(n, result, 0, newKey); } else { if (isStringOrNumber(n)) { n = createTextVNode(n, newKey); } else { var oldKey = n.key; var isPrefixedKey = isString(oldKey) && oldKey[0] === keyPrefix; if (!isNull(n.dom) || isPrefixedKey) { n = directClone(n); } if (isNull(oldKey) || isPrefixedKey) { n.key = newKey; } else { n.key = currentKey + oldKey; } } result.push(n); } } } } function getFlagsForElementVnode(type) { if (type === 'svg') { return 32 /* SvgElement */; } if (type === 'input') { return 64 /* InputElement */; } if (type === 'select') { return 256 /* SelectElement */; } if (type === 'textarea') { return 128 /* TextareaElement */; } return 1 /* HtmlElement */; } function normalizeChildren(vNode, children) { var newChildren; var newChildFlags = 1 /* HasInvalidChildren */; // Don't change children to match strict equal (===) true in patching if (isInvalid(children)) { newChildren = children; } else if (isString(children)) { newChildFlags = 2 /* HasVNodeChildren */; newChildren = createTextVNode(children); } else if (isNumber(children)) { newChildFlags = 2 /* HasVNodeChildren */; newChildren = createTextVNode(children + ''); } else if (isArray(children)) { var len = children.length; if (len === 0) { newChildren = null; newChildFlags = 1 /* HasInvalidChildren */; } else { // we assign $ which basically means we've flagged this array for future note // if it comes back again, we need to clone it, as people are using it // in an immutable way // tslint:disable-next-line if (Object.isFrozen(children) || children['$'] === true) { children = children.slice(); } newChildFlags = 8 /* HasKeyedChildren */; for (var i = 0; i < len; i++) { var n = children[i]; if (isInvalid(n) || isArray(n)) { newChildren = newChildren || children.slice(0, i); _normalizeVNodes(children, newChildren, i, ''); break; } else if (isStringOrNumber(n)) { newChildren = newChildren || children.slice(0, i); newChildren.push(createTextVNode(n, keyPrefix + i)); } else { var key = n.key; var isNullDom = isNull(n.dom); var isNullKey = isNull(key); var isPrefixed = !isNullKey && key[0] === keyPrefix; if (!isNullDom || isNullKey || isPrefixed) { newChildren = newChildren || children.slice(0, i); if (!isNullDom || isPrefixed) { n = directClone(n); } if (isNullKey || isPrefixed) { n.key = keyPrefix + i; } newChildren.push(n); } else if (newChildren) { newChildren.push(n); } } } newChildren = newChildren || children; newChildren.$ = true; } } else { newChildren = children; if (!isNull(children.dom)) { newChildren = directClone(children); } newChildFlags = 2 /* HasVNodeChildren */; } vNode.children = newChildren; vNode.childFlags = newChildFlags; { validateVNodeElementChildren(vNode); } return vNode; } var options = { afterMount: null, afterRender: null, afterUpdate: null, beforeRender: null, beforeUnmount: null, createVNode: null, roots: [] }; /** * Links given data to event as first parameter * @param {*} data data to be linked, it will be available in function as first parameter * @param {Function} event Function to be called when event occurs * @returns {{data: *, event: Function}} */ function linkEvent(data, event) { if (isFunction(event)) { return { data: data, event: event }; } return null; // Return null when event is invalid, to avoid creating unnecessary event handlers } var xlinkNS = 'http://www.w3.org/1999/xlink'; var xmlNS = 'http://www.w3.org/XML/1998/namespace'; var svgNS = 'http://www.w3.org/2000/svg'; var namespaces = { 'xlink:actuate': xlinkNS, 'xlink:arcrole': xlinkNS, 'xlink:href': xlinkNS, 'xlink:role': xlinkNS, 'xlink:show': xlinkNS, 'xlink:title': xlinkNS, 'xlink:type': xlinkNS, 'xml:base': xmlNS, 'xml:lang': xmlNS, 'xml:space': xmlNS }; // We need EMPTY_OBJ defined in one place. // Its used for comparison so we cant inline it into shared var EMPTY_OBJ = {}; var LIFECYCLE = []; { Object.freeze(EMPTY_OBJ); } function appendChild(parentDom, dom) { parentDom.appendChild(dom); } function insertOrAppend(parentDom, newNode, nextNode) { if (isNullOrUndef(nextNode)) { appendChild(parentDom, newNode); } else { parentDom.insertBefore(newNode, nextNode); } } function documentCreateElement(tag, isSVG) { if (isSVG === true) { return document.createElementNS(svgNS, tag); } return document.createElement(tag); } function replaceChild(parentDom, newDom, lastDom) { parentDom.replaceChild(newDom, lastDom); } function removeChild(parentDom, dom) { parentDom.removeChild(dom); } function callAll(arrayFn) { var listener; while ((listener = arrayFn.shift()) !== undefined) { listener(); } } var attachedEventCounts = {}; var attachedEvents = {}; function handleEvent(name, nextEvent, dom) { var eventsLeft = attachedEventCounts[name]; var eventsObject = dom.$EV; if (nextEvent) { if (!eventsLeft) { attachedEvents[name] = attachEventToDocument(name); attachedEventCounts[name] = 0; } if (!eventsObject) { eventsObject = dom.$EV = {}; } if (!eventsObject[name]) { attachedEventCounts[name]++; } eventsObject[name] = nextEvent; } else if (eventsObject && eventsObject[name]) { attachedEventCounts[name]--; if (eventsLeft === 1) { document.removeEventListener(normalizeEventName(name), attachedEvents[name]); attachedEvents[name] = null; } eventsObject[name] = nextEvent; } } function dispatchEvents(event, target, isClick, name, eventData) { var dom = target; while (!isNull(dom)) { // Html Nodes can be nested fe: span inside button in that scenario browser does not handle disabled attribute on parent, // because the event listener is on document.body // Don't process clicks on disabled elements if (isClick && dom.disabled) { return; } var eventsObject = dom.$EV; if (eventsObject) { var currentEvent = eventsObject[name]; if (currentEvent) { // linkEvent object eventData.dom = dom; if (currentEvent.event) { currentEvent.event(currentEvent.data, event); } else { currentEvent(event); } if (event.cancelBubble) { return; } } } dom = dom.parentNode; } } function normalizeEventName(name) { return name.substr(2).toLowerCase(); } function stopPropagation() { this.cancelBubble = true; this.stopImmediatePropagation(); } function attachEventToDocument(name) { var docEvent = function (event) { var type = event.type; var isClick = type === 'click' || type === 'dblclick'; if (isClick && event.button !== 0) { // Firefox incorrectly triggers click event for mid/right mouse buttons. // This bug has been active for 12 years. // https://bugzilla.mozilla.org/show_bug.cgi?id=184051 event.preventDefault(); event.stopPropagation(); return false; } event.stopPropagation = stopPropagation; // Event data needs to be object to save reference to currentTarget getter var eventData = { dom: document }; try { Object.defineProperty(event, 'currentTarget', { configurable: true, get: function get() { return eventData.dom; } }); } catch (e) { /* safari7 and phantomJS will crash */ } dispatchEvents(event, event.target, isClick, name, eventData); }; document.addEventListener(normalizeEventName(name), docEvent); return docEvent; } function isSameInnerHTML(dom, innerHTML) { var tempdom = document.createElement('i'); tempdom.innerHTML = innerHTML; return tempdom.innerHTML === dom.innerHTML; } function isSamePropsInnerHTML(dom, props) { return Boolean(props && props.dangerouslySetInnerHTML && props.dangerouslySetInnerHTML.__html && isSameInnerHTML(dom, props.dangerouslySetInnerHTML.__html)); } function triggerEventListener(props, methodName, e) { if (props[methodName]) { var listener = props[methodName]; if (listener.event) { listener.event(listener.data, e); } else { listener(e); } } else { var nativeListenerName = methodName.toLowerCase(); if (props[nativeListenerName]) { props[nativeListenerName](e); } } } function createWrappedFunction(methodName, applyValue) { var fnMethod = function (e) { e.stopPropagation(); var vNode = this.$V; // If vNode is gone by the time event fires, no-op if (!vNode) { return; } var props = vNode.props || EMPTY_OBJ; var dom = vNode.dom; if (isString(methodName)) { triggerEventListener(props, methodName, e); } else { for (var i = 0; i < methodName.length; i++) { triggerEventListener(props, methodName[i], e); } } if (isFunction(applyValue)) { var newVNode = this.$V; var newProps = newVNode.props || EMPTY_OBJ; applyValue(newProps, dom, false, newVNode); } }; Object.defineProperty(fnMethod, 'wrapped', { configurable: false, enumerable: false, value: true, writable: false }); return fnMethod; } function isCheckedType(type) { return type === 'checkbox' || type === 'radio'; } var onTextInputChange = createWrappedFunction('onInput', applyValueInput); var wrappedOnChange = createWrappedFunction(['onClick', 'onChange'], applyValueInput); /* tslint:disable-next-line:no-empty */ function emptywrapper(event) { event.stopPropagation(); } emptywrapper.wrapped = true; function inputEvents(dom, nextPropsOrEmpty) { if (isCheckedType(nextPropsOrEmpty.type)) { dom.onchange = wrappedOnChange; dom.onclick = emptywrapper; } else { dom.oninput = onTextInputChange; } } function applyValueInput(nextPropsOrEmpty, dom) { var type = nextPropsOrEmpty.type; var value = nextPropsOrEmpty.value; var checked = nextPropsOrEmpty.checked; var multiple = nextPropsOrEmpty.multiple; var defaultValue = nextPropsOrEmpty.defaultValue; var hasValue = !isNullOrUndef(value); if (type && type !== dom.type) { dom.setAttribute('type', type); } if (!isNullOrUndef(multiple) && multiple !== dom.multiple) { dom.multiple = multiple; } if (!isNullOrUndef(defaultValue) && !hasValue) { dom.defaultValue = defaultValue + ''; } if (isCheckedType(type)) { if (hasValue) { dom.value = value; } if (!isNullOrUndef(checked)) { dom.checked = checked; } } else { if (hasValue && dom.value !== value) { dom.defaultValue = value; dom.value = value; } else if (!isNullOrUndef(checked)) { dom.checked = checked; } } } function updateChildOptionGroup(vNode, value) { var type = vNode.type; if (type === 'optgroup') { var children = vNode.children; var childFlags = vNode.childFlags; if (childFlags & 12 /* MultipleChildren */) { for (var i = 0, len = children.length; i < len; i++) { updateChildOption(children[i], value); } } else if (childFlags === 2 /* HasVNodeChildren */) { updateChildOption(children, value); } } else { updateChildOption(vNode, value); } } function updateChildOption(vNode, value) { var props = vNode.props || EMPTY_OBJ; var dom = vNode.dom; // we do this as multiple may have changed dom.value = props.value; if ((isArray(value) && value.indexOf(props.value) !== -1) || props.value === value) { dom.selected = true; } else if (!isNullOrUndef(value) || !isNullOrUndef(props.selected)) { dom.selected = props.selected || false; } } var onSelectChange = createWrappedFunction('onChange', applyValueSelect); function selectEvents(dom) { dom.onchange = onSelectChange; } function applyValueSelect(nextPropsOrEmpty, dom, mounting, vNode) { var multiplePropInBoolean = Boolean(nextPropsOrEmpty.multiple); if (!isNullOrUndef(nextPropsOrEmpty.multiple) && multiplePropInBoolean !== dom.multiple) { dom.multiple = multiplePropInBoolean; } var childFlags = vNode.childFlags; if ((childFlags & 1 /* HasInvalidChildren */) === 0) { var children = vNode.children; var value = nextPropsOrEmpty.value; if (mounting && isNullOrUndef(value)) { value = nextPropsOrEmpty.defaultValue; } if (childFlags & 12 /* MultipleChildren */) { for (var i = 0, len = children.length; i < len; i++) { updateChildOptionGroup(children[i], value); } } else if (childFlags === 2 /* HasVNodeChildren */) { updateChildOptionGroup(children, value); } } } var onTextareaInputChange = createWrappedFunction('onInput', applyValueTextArea); var wrappedOnChange$1 = createWrappedFunction('onChange'); function textAreaEvents(dom, nextPropsOrEmpty) { dom.oninput = onTextareaInputChange; if (nextPropsOrEmpty.onChange) { dom.onchange = wrappedOnChange$1; } } function applyValueTextArea(nextPropsOrEmpty, dom, mounting) { var value = nextPropsOrEmpty.value; var domValue = dom.value; if (isNullOrUndef(value)) { if (mounting) { var defaultValue = nextPropsOrEmpty.defaultValue; if (!isNullOrUndef(defaultValue) && defaultValue !== domValue) { dom.defaultValue = defaultValue; dom.value = defaultValue; } } } else if (domValue !== value) { /* There is value so keep it controlled */ dom.defaultValue = value; dom.value = value; } } /** * There is currently no support for switching same input between controlled and nonControlled * If that ever becomes a real issue, then re design controlled elements * Currently user must choose either controlled or non-controlled and stick with that */ function processElement(flags, vNode, dom, nextPropsOrEmpty, mounting, isControlled) { if (flags & 64 /* InputElement */) { applyValueInput(nextPropsOrEmpty, dom); } else if (flags & 256 /* SelectElement */) { applyValueSelect(nextPropsOrEmpty, dom, mounting, vNode); } else if (flags & 128 /* TextareaElement */) { applyValueTextArea(nextPropsOrEmpty, dom, mounting); } if (isControlled) { dom.$V = vNode; } } function addFormElementEventHandlers(flags, dom, nextPropsOrEmpty) { if (flags & 64 /* InputElement */) { inputEvents(dom, nextPropsOrEmpty); } else if (flags & 256 /* SelectElement */) { selectEvents(dom); } else if (flags & 128 /* TextareaElement */) { textAreaEvents(dom, nextPropsOrEmpty); } } function isControlledFormElement(nextPropsOrEmpty) { return nextPropsOrEmpty.type && isCheckedType(nextPropsOrEmpty.type) ? !isNullOrUndef(nextPropsOrEmpty.checked) : !isNullOrUndef(nextPropsOrEmpty.value); } function remove(vNode, parentDom) { unmount(vNode); if (!isNull(parentDom)) { removeChild(parentDom, vNode.dom); // Let carbage collector free memory vNode.dom = null; } } function unmount(vNode) { var flags = vNode.flags; if (flags & 481 /* Element */) { var ref = vNode.ref; var props = vNode.props; if (isFunction(ref)) { ref(null); } var children = vNode.children; var childFlags = vNode.childFlags; if (childFlags & 12 /* MultipleChildren */) { unmountAllChildren(children); } else if (childFlags === 2 /* HasVNodeChildren */) { unmount(children); } if (!isNull(props)) { for (var name in props) { switch (name) { case 'onClick': case 'onDblClick': case 'onFocusIn': case 'onFocusOut': case 'onKeyDown': case 'onKeyPress': case 'onKeyUp': case 'onMouseDown': case 'onMouseMove': case 'onMouseUp': case 'onSubmit': case 'onTouchEnd': case 'onTouchMove': case 'onTouchStart': handleEvent(name, null, vNode.dom); break; default: break; } } } } else if (flags & 14 /* Component */) { var instance = vNode.children; var ref$1 = vNode.ref; if (flags & 4 /* ComponentClass */) { if (isFunction(options.beforeUnmount)) { options.beforeUnmount(vNode); } if (isFunction(instance.componentWillUnmount)) { instance.componentWillUnmount(); } if (isFunction(ref$1)) { ref$1(null); } instance.$UN = true; unmount(instance.$LI); } else { if (!isNullOrUndef(ref$1) && isFunction(ref$1.onComponentWillUnmount)) { ref$1.onComponentWillUnmount(vNode.dom, vNode.props || EMPTY_OBJ); } unmount(instance); } } else if (flags & 1024 /* Portal */) { var children$1 = vNode.children; if (!isNull(children$1) && isObject(children$1)) { remove(children$1, vNode.type); } } } function unmountAllChildren(children) { for (var i = 0, len = children.length; i < len; i++) { unmount(children[i]); } } function removeAllChildren(dom, children) { unmountAllChildren(children); dom.textContent = ''; } function createLinkEvent(linkEvent, nextValue) { return function (e) { linkEvent(nextValue.data, e); }; } function patchEvent(name, lastValue, nextValue, dom) { var nameLowerCase = name.toLowerCase(); if (!isFunction(nextValue) && !isNullOrUndef(nextValue)) { var linkEvent = nextValue.event; if (linkEvent && isFunction(linkEvent)) { dom[nameLowerCase] = createLinkEvent(linkEvent, nextValue); } else { // Development warning { throwError(("an event on a VNode \"" + name + "\". was not a function or a valid linkEvent.")); } } } else { var domEvent = dom[nameLowerCase]; // if the function is wrapped, that means it's been controlled by a wrapper if (!domEvent || !domEvent.wrapped) { dom[nameLowerCase] = nextValue; } } } function getNumberStyleValue(style, value) { switch (style) { case 'animationIterationCount': case 'borderImageOutset': case 'borderImageSlice': case 'borderImageWidth': case 'boxFlex': case 'boxFlexGroup': case 'boxOrdinalGroup': case 'columnCount': case 'fillOpacity': case 'flex': case 'flexGrow': case 'flexNegative': case 'flexOrder': case 'flexPositive': case 'flexShrink': case 'floodOpacity': case 'fontWeight': case 'gridColumn': case 'gridRow': case 'lineClamp': case 'lineHeight': case 'opacity': case 'order': case 'orphans': case 'stopOpacity': case 'strokeDasharray': case 'strokeDashoffset': case 'strokeMiterlimit': case 'strokeOpacity': case 'strokeWidth': case 'tabSize': case 'widows': case 'zIndex': case 'zoom': return value; default: return value + 'px'; } } // We are assuming here that we come from patchProp routine // -nextAttrValue cannot be null or undefined function patchStyle(lastAttrValue, nextAttrValue, dom) { var domStyle = dom.style; var style; var value; if (isString(nextAttrValue)) { domStyle.cssText = nextAttrValue; return; } if (!isNullOrUndef(lastAttrValue) && !isString(lastAttrValue)) { for (style in nextAttrValue) { // do not add a hasOwnProperty check here, it affects performance value = nextAttrValue[style]; if (value !== lastAttrValue[style]) { domStyle[style] = isNumber(value) ? getNumberStyleValue(style, value) : value; } } for (style in lastAttrValue) { if (isNullOrUndef(nextAttrValue[style])) { domStyle[style] = ''; } } } else { for (style in nextAttrValue) { value = nextAttrValue[style]; domStyle[style] = isNumber(value) ? getNumberStyleValue(style, value) : value; } } } function patchProp(prop, lastValue, nextValue, dom, isSVG, hasControlledValue, lastVNode) { switch (prop) { case 'onClick': case 'onDblClick': case 'onFocusIn': case 'onFocusOut': case 'onKeyDown': case 'onKeyPress': case 'onKeyUp': case 'onMouseDown': case 'onMouseMove': case 'onMouseUp': case 'onSubmit': case 'onTouchEnd': case 'onTouchMove': case 'onTouchStart': handleEvent(prop, nextValue, dom); break; case 'children': case 'childrenType': case 'className': case 'defaultValue': case 'key': case 'multiple': case 'ref': return; case 'allowfullscreen': case 'autoFocus': case 'autoplay': case 'capture': case 'checked': case 'controls': case 'default': case 'disabled': case 'hidden': case 'indeterminate': case 'loop': case 'muted': case 'novalidate': case 'open': case 'readOnly': case 'required': case 'reversed': case 'scoped': case 'seamless': case 'selected': prop = prop === 'autoFocus' ? prop.toLowerCase() : prop; dom[prop] = !!nextValue; break; case 'defaultChecked': case 'value': case 'volume': if (hasControlledValue && prop === 'value') { return; } var value = isNullOrUndef(nextValue) ? '' : nextValue; if (dom[prop] !== value) { dom[prop] = value; } break; case 'dangerouslySetInnerHTML': var lastHtml = (lastValue && lastValue.__html) || ''; var nextHtml = (nextValue && nextValue.__html) || ''; if (lastHtml !== nextHtml) { if (!isNullOrUndef(nextHtml) && !isSameInnerHTML(dom, nextHtml)) { if (!isNull(lastVNode)) { if (lastVNode.childFlags & 12 /* MultipleChildren */) { unmountAllChildren(lastVNode.children); } else if (lastVNode.childFlags === 2 /* HasVNodeChildren */) { unmount(lastVNode.children); } lastVNode.children = null; lastVNode.childFlags = 1 /* HasInvalidChildren */; } dom.innerHTML = nextHtml; } } break; default: if (prop[0] === 'o' && prop[1] === 'n') { patchEvent(prop, lastValue, nextValue, dom); } else if (isNullOrUndef(nextValue)) { dom.removeAttribute(prop); } else if (prop === 'style') { patchStyle(lastValue, nextValue, dom); } else if (isSVG && namespaces[prop]) { // We optimize for NS being boolean. Its 99.9% time false // If we end up in this path we can read property again dom.setAttributeNS(namespaces[prop], prop, nextValue); } else { dom.setAttribute(prop, nextValue); } break; } } function mountProps(vNode, flags, props, dom, isSVG) { var hasControlledValue = false; var isFormElement = (flags & 448 /* FormElement */) > 0; if (isFormElement) { hasControlledValue = isControlledFormElement(props); if (hasControlledValue) { addFormElementEventHandlers(flags, dom, props); } } for (var prop in props) { // do not add a hasOwnProperty check here, it affects performance patchProp(prop, null, props[prop], dom, isSVG, hasControlledValue, null); } if (isFormElement) { processElement(flags, vNode, dom, props, true, hasControlledValue); } } function createClassComponentInstance(vNode, Component, props, context) { var instance = new Component(props, context); vNode.children = instance; instance.$V = vNode; instance.$BS = false; instance.context = context; if (instance.props === EMPTY_OBJ) { instance.props = props; } instance.$UN = false; if (isFunction(instance.componentWillMount)) { instance.$BR = true; instance.componentWillMount(); if (instance.$PSS) { var state = instance.state; var pending = instance.$PS; if (isNull(state)) { instance.state = pending; } else { for (var key in pending) { state[key] = pending[key]; } } instance.$PSS = false; instance.$PS = null; } instance.$BR = false; } if (isFunction(options.beforeRender)) { options.beforeRender(instance); } var input = handleComponentInput(instance.render(props, instance.state, context), vNode); var childContext; if (isFunction(instance.getChildContext)) { childContext = instance.getChildContext(); } if (isNullOrUndef(childContext)) { instance.$CX = context; } else { instance.$CX = combineFrom(context, childContext); } if (isFunction(options.afterRender)) { options.afterRender(instance); } instance.$LI = input; return instance; } function handleComponentInput(input, componentVNode) { // Development validation { if (isArray(input)) { throwError('a valid Inferno VNode (or null) must be returned from a component render. You may have returned an array or an invalid object.'); } } if (isInvalid(input)) { input = createVoidVNode(); } else if (isStringOrNumber(input)) { input = createTextVNode(input, null); } else { if (input.dom) { input = directClone(input); } if (input.flags & 14 /* Component */) { // if we have an input that is also a component, we run into a tricky situation // where the root vNode needs to always have the correct DOM entry // we can optimise this in the future, but this gets us out of a lot of issues input.parentVNode = componentVNode; } } return input; } function mount(vNode, parentDom, lifecycle, context, isSVG) { var flags = vNode.flags; if (flags & 481 /* Element */) { return mountElement(vNode, parentDom, lifecycle, context, isSVG); } if (flags & 14 /* Component */) { return mountComponent(vNode, parentDom, lifecycle, context, isSVG, (flags & 4 /* ComponentClass */) > 0); } if (flags & 512 /* Void */ || flags & 16 /* Text */) { return mountText(vNode, parentDom); } if (flags & 1024 /* Portal */) { mount(vNode.children, vNode.type, lifecycle, context, false); return (vNode.dom = mountText(createVoidVNode(), parentDom)); } // Development validation, in production we don't need to throw because it crashes anyway { if (typeof vNode === 'object') { throwError(("mount() received an object that's not a valid VNode, you should stringify it first, fix createVNode flags or call normalizeChildren. Object: \"" + (JSON.stringify(vNode)) + "\".")); } else { throwError(("mount() expects a valid VNode, instead it received an object with the type \"" + (typeof vNode) + "\".")); } } } function mountText(vNode, parentDom) { var dom = (vNode.dom = document.createTextNode(vNode.children)); if (!isNull(parentDom)) { appendChild(parentDom, dom); } return dom; } function mountElement(vNode, parentDom, lifecycle, context, isSVG) { var flags = vNode.flags; var children = vNode.children; var props = vNode.props; var className = vNode.className; var ref = vNode.ref; var childFlags = vNode.childFlags; isSVG = isSVG || (flags & 32 /* SvgElement */) > 0; var dom = documentCreateElement(vNode.type, isSVG); vNode.dom = dom; if (!isNullOrUndef(className) && className !== '') { if (isSVG) { dom.setAttribute('class', className); } else { dom.className = className; } } { validateKeys(vNode); } if (!isNull(parentDom)) { appendChild(parentDom, dom); } if ((childFlags & 1 /* HasInvalidChildren */) === 0) { var childrenIsSVG = isSVG === true && vNode.type !== 'foreignObject'; if (childFlags === 2 /* HasVNodeChildren */) { mount(children, dom, lifecycle, context, childrenIsSVG); } else if (childFlags & 12 /* MultipleChildren */) { mountArrayChildren(children, dom, lifecycle, context, childrenIsSVG); } } if (!isNull(props)) { mountProps(vNode, flags, props, dom, isSVG); } { if (isString(ref)) { throwError('string "refs" are not supported in Inferno 1.0. Use callback "refs" instead.'); } } if (isFunction(ref)) { mountRef(dom, ref, lifecycle); } return dom; } function mountArrayChildren(children, dom, lifecycle, context, isSVG) { for (var i = 0, len = children.length; i < len; i++) { var child = children[i]; if (!isNull(child.dom)) { children[i] = child = directClone(child); } mount(child, dom, lifecycle, context, isSVG); } } function mountComponent(vNode, parentDom, lifecycle, context, isSVG, isClass) { var dom; var type = vNode.type; var props = vNode.props || EMPTY_OBJ; var ref = vNode.ref; if (isClass) { var instance = createClassComponentInstance(vNode, type, props, context); vNode.dom = dom = mount(instance.$LI, null, lifecycle, instance.$CX, isSVG); mountClassComponentCallbacks(vNode, ref, instance, lifecycle); instance.$UPD = false; } else { var input = handleComponentInput(type(props, context), vNode); vNode.children = input; vNode.dom = dom = mount(input, null, lifecycle, context, isSVG); mountFunctionalComponentCallbacks(props, ref, dom, lifecycle); } if (!isNull(parentDom)) { appendChild(parentDom, dom); } return dom; } function createClassMountCallback(instance, hasAfterMount, afterMount, vNode, hasDidMount) { return function () { instance.$UPD = true; if (hasAfterMount) { afterMount(vNode); } if (hasDidMount) { instance.componentDidMount(); } instance.$UPD = false; }; } function mountClassComponentCallbacks(vNode, ref, instance, lifecycle) { if (isFunction(ref)) { ref(instance); } else { { if (isStringOrNumber(ref)) { throwError('string "refs" are not supported in Inferno 1.0. Use callback "refs" instead.'); } else if (!isNullOrUndef(ref) && isObject(ref) && vNode.flags & 4 /* ComponentClass */) { throwError('functional component lifecycle events are not supported on ES2015 class components.'); } } } var hasDidMount = isFunction(instance.componentDidMount); var afterMount = options.afterMount; var hasAfterMount = isFunction(afterMount); if (hasDidMount || hasAfterMount) { lifecycle.push(createClassMountCallback(instance, hasAfterMount, afterMount, vNode, hasDidMount)); } } // Create did mount callback lazily to avoid creating function context if not needed function createOnMountCallback(ref, dom, props) { return function () { return ref.onComponentDidMount(dom, props); }; } function mountFunctionalComponentCallbacks(props, ref, dom, lifecycle) { if (!isNullOrUndef(ref)) { if (isFunction(ref.onComponentWillMount)) { ref.onComponentWillMount(props); } if (isFunction(ref.onComponentDidMount)) { lifecycle.push(createOnMountCallback(ref, dom, props)); } } } function mountRef(dom, value, lifecycle) { lifecycle.push(function () { return value(dom); }); } function hydrateComponent(vNode, dom, lifecycle, context, isSVG, isClass) { var type = vNode.type; var ref = vNode.ref; var props = vNode.props || EMPTY_OBJ; if (isClass) { var instance = createClassComponentInstance(vNode, type, props, context); var input = instance.$LI; hydrateVNode(input, dom, lifecycle, instance.$CX, isSVG); vNode.dom = input.dom; mountClassComponentCallbacks(vNode, ref, instance, lifecycle); instance.$UPD = false; // Mount finished allow going sync } else { var input$1 = handleComponentInput(type(props, context), vNode); hydrateVNode(input$1, dom, lifecycle, context, isSVG); vNode.children = input$1; vNode.dom = input$1.dom; mountFunctionalComponentCallbacks(props, ref, dom, lifecycle); } } function hydrateElement(vNode, dom, lifecycle, context, isSVG) { var children = vNode.children; var props = vNode.props; var className = vNode.className; var flags = vNode.flags; var ref = vNode.ref; isSVG = isSVG || (flags & 32 /* SvgElement */) > 0; if (dom.nodeType !== 1 || dom.tagName.toLowerCase() !== vNode.type) { { warning("Inferno hydration: Server-side markup doesn't match client-side markup or Initial render target is not empty"); } var newDom = mountElement(vNode, null, lifecycle, context, isSVG); vNode.dom = newDom; replaceChild(dom.parentNode, newDom, dom); } else { vNode.dom = dom; var childNode = dom.firstChild; var childFlags = vNode.childFlags; if ((childFlags & 1 /* HasInvalidChildren */) === 0) { var nextSibling = null; while (childNode) { nextSibling = childNode.nextSibling; if (childNode.nodeType === 8) { if (childNode.data === '!') { dom.replaceChild(document.createTextNode(''), childNode); } else { dom.removeChild(childNode); } } childNode = nextSibling; } childNode = dom.firstChild; if (childFlags === 2 /* HasVNodeChildren */) { if (isNull(childNode)) { mount(children, dom, lifecycle, context, isSVG); } else { nextSibling = childNode.nextSibling; hydrateVNode(children, childNode, lifecycle, context, isSVG); childNode = nextSibling; } } else if (childFlags & 12 /* MultipleChildren */) { for (var i = 0, len = children.length; i < len; i++) { var child = children[i]; if (isNull(childNode)) { mount(child, dom, lifecycle, context, isSVG); } else { nextSibling = childNode.nextSibling; hydrateVNode(child, childNode, lifecycle, context, isSVG); childNode = nextSibling; } } } // clear any other DOM nodes, there should be only a single entry for the root while (childNode) { nextSibling = childNode.nextSibling; dom.removeChild(childNode); childNode = nextSibling; } } else if (!isNull(dom.firstChild) && !isSamePropsInnerHTML(dom, props)) { dom.textContent = ''; // dom has content, but VNode has no children remove everything from DOM if (flags & 448 /* FormElement */) { // If element is form element, we need to clear defaultValue also dom.defaultValue = ''; } } if (!isNull(props)) { mountProps(vNode, flags, props, dom, isSVG); } if (isNullOrUndef(className)) { if (dom.className !== '') { dom.removeAttribute('class'); } } else if (isSVG) { dom.setAttribute('class', className); } else { dom.className = className; } if (isFunction(ref)) { mountRef(dom, ref, lifecycle); } else { { if (isString(ref)) { throwError('string "refs" are not supported in Inferno 1.0. Use callback "refs" instead.'); } } } } } function hydrateText(vNode, dom) { if (dom.nodeType !== 3) { var newDom = mountText(vNode, null); vNode.dom = newDom; replaceChild(dom.parentNode, newDom, dom); } else { var text = vNode.children; if (dom.nodeValue !== text) { dom.nodeValue = text; } vNode.dom = dom; } } function hydrateVNode(vNode, dom, lifecycle, context, isSVG) { var flags = vNode.flags; if (flags & 14 /* Component */) { hydrateComponent(vNode, dom, lifecycle, context, isSVG, (flags & 4 /* ComponentClass */) > 0); } else if (flags & 481 /* Element */) { hydrateElement(vNode, dom, lifecycle, context, isSVG); } else if (flags & 16 /* Text */) { hydrateText(vNode, dom); } else if (flags & 512 /* Void */) { vNode.dom = dom; } else { { throwError(("hydrate() expects a valid VNode, instead it received an object with the type \"" + (typeof vNode) + "\".")); } throwError(); } } function hydrate(input, parentDom, callback) { var dom = parentDom.firstChild; if (!isNull(dom)) { if (!isInvalid(input)) { hydrateVNode(input, dom, LIFECYCLE, EMPTY_OBJ, false); } dom = parentDom.firstChild; // clear any other DOM nodes, there should be only a single entry for the root while ((dom = dom.nextSibling)) { parentDom.removeChild(dom); } } if (LIFECYCLE.length > 0) { callAll(LIFECYCLE); } if (!parentDom.$V) { options.roots.push(parentDom); } parentDom.$V = input; if (isFunction(callback)) { callback(); } } function replaceWithNewNode(lastNode, nextNode, parentDom, lifecycle, context, isSVG) { unmount(lastNode); replaceChild(parentDom, mount(nextNode, null, lifecycle, context, isSVG), lastNode.dom); } function patch(lastVNode, nextVNode, parentDom, lifecycle, context, isSVG) { if (lastVNode !== nextVNode) { var nextFlags = nextVNode.flags | 0; if (lastVNode.flags !== nextFlags || nextFlags & 2048 /* ReCreate */) { replaceWithNewNode(lastVNode, nextVNode, parentDom, lifecycle, context, isSVG); } else if (nextFlags & 481 /* Element */) { patchElement(lastVNode, nextVNode, parentDom, lifecycle, context, isSVG); } else if (nextFlags & 14 /* Component */) { patchComponent(lastVNode, nextVNode, parentDom, lifecycle, context, isSVG, (nextFlags & 4 /* ComponentClass */) > 0); } else if (nextFlags & 16 /* Text */) { patchText(lastVNode, nextVNode, parentDom); } else if (nextFlags & 512 /* Void */) { nextVNode.dom = lastVNode.dom; } else { // Portal patchPortal(lastVNode, nextVNode, lifecycle, context); } } } function patchPortal(lastVNode, nextVNode, lifecycle, context) { var lastContainer = lastVNode.type; var nextContainer = nextVNode.type; var nextChildren = nextVNode.children; patchChildren(lastVNode.childFlags, nextVNode.childFlags, lastVNode.children, nextChildren, lastContainer, lifecycle, context, false); nextVNode.dom = lastVNode.dom; if (lastContainer !== nextContainer && !isInvalid(nextChildren)) { var node = nextChildren.dom; lastContainer.removeChild(node); nextContainer.appendChild(node); } } function patchElement(lastVNode, nextVNode, parentDom, lifecycle, context, isSVG) { var nextTag = nextVNode.type; if (lastVNode.type !== nextTag) { replaceWithNewNode(lastVNode, nextVNode, parentDom, lifecycle, context, isSVG); } else { var dom = lastVNode.dom; var nextFlags = nextVNode.flags; var lastProps = lastVNode.props; var nextProps = nextVNode.props; var isFormElement = false; var hasControlledValue = false; var nextPropsOrEmpty; nextVNode.dom = dom; isSVG = isSVG || (nextFlags & 32 /* SvgElement */) > 0; // inlined patchProps -- starts -- if (lastProps !== nextProps) { var lastPropsOrEmpty = lastProps || EMPTY_OBJ; nextPropsOrEmpty = nextProps || EMPTY_OBJ; if (nextPropsOrEmpty !== EMPTY_OBJ) { isFormElement = (nextFlags & 448 /* FormElement */) > 0; if (isFormElement) { hasControlledValue = isControlledFormElement(nextPropsOrEmpty); } for (var prop in nextPropsOrEmpty) { var lastValue = lastPropsOrEmpty[prop]; var nextValue = nextPropsOrEmpty[prop]; if (lastValue !== nextValue) { patchProp(prop, lastValue, nextValue, dom, isSVG, hasControlledValue, lastVNode); } } } if (lastPropsOrEmpty !== EMPTY_OBJ) { for (var prop$1 in lastPropsOrEmpty) { // do not add a hasOwnProperty check here, it affects performance if (!nextPropsOrEmpty.hasOwnProperty(prop$1) && !isNullOrUndef(lastPropsOrEmpty[prop$1])) { patchProp(prop$1, lastPropsOrEmpty[prop$1], null, dom, isSVG, hasControlledValue, lastVNode); } } } } var lastChildren = lastVNode.children; var nextChildren = nextVNode.children; var nextRef = nextVNode.ref; var lastClassName = lastVNode.className; var nextClassName = nextVNode.className; if (lastChildren !== nextChildren) { { validateKeys(nextVNode); } patchChildren(lastVNode.childFlags, nextVNode.childFlags, lastChildren, nextChildren, dom, lifecycle, context, isSVG && nextTag !== 'foreignObject'); } if (isFormElement) { processElement(nextFlags, nextVNode, dom, nextPropsOrEmpty, false, hasControlledValue); } // inlined patchProps -- ends -- if (lastClassName !== nextClassName) { if (isNullOrUndef(nextClassName)) { dom.removeAttribute('class'); } else if (isSVG) { dom.setAttribute('class', nextClassName); } else { dom.className = nextClassName; } } if (isFunction(nextRef) && lastVNode.ref !== nextRef) { mountRef(dom, nextRef, lifecycle); } else { { if (isString(nextRef)) { throwError('string "refs" are not supported in Inferno 1.0. Use callback "refs" instead.'); } } } } } function patchChildren(lastChildFlags, nextChildFlags, lastChildren, nextChildren, parentDOM, lifecycle, context, isSVG) { switch (lastChildFlags) { case 2 /* HasVNodeChildren */: switch (nextChildFlags) { case 2 /* HasVNodeChildren */: patch(lastChildren, nextChildren, parentDOM, lifecycle, context, isSVG); break; case 1 /* HasInvalidChildren */: remove(lastChildren, parentDOM); break; default: remove(lastChildren, parentDOM); mountArrayChildren(nextChildren, parentDOM, lifecycle, context, isSVG); break; } break; case 1 /* HasInvalidChildren */: switch (nextChildFlags) { case 2 /* HasVNodeChildren */: mount(nextChildren, parentDOM, lifecycle, context, isSVG); break; case 1 /* HasInvalidChildren */: break; default: mountArrayChildren(nextChildren, parentDOM, lifecycle, context, isSVG); break; } break; default: if (nextChildFlags & 12 /* MultipleChildren */) { var lastLength = lastChildren.length; var nextLength = nextChildren.length; // Fast path's for both algorithms if (lastLength === 0) { if (nextLength > 0) { mountArrayChildren(nextChildren, parentDOM, lifecycle, context, isSVG); } } else if (nextLength === 0) { removeAllChildren(parentDOM, lastChildren); } else if (nextChildFlags === 8 /* HasKeyedChildren */ && lastChildFlags === 8 /* HasKeyedChildren */) { patchKeyedChildren(lastChildren, nextChildren, parentDOM, lifecycle, context, isSVG, lastLength, nextLength); } else { patchNonKeyedChildren(lastChildren, nextChildren, parentDOM, lifecycle, context, isSVG, lastLength, nextLength); } } else if (nextChildFlags === 1 /* HasInvalidChildren */) { removeAllChildren(parentDOM, lastChildren); } else { removeAllChildren(parentDOM, lastChildren); mount(nextChildren, parentDOM, lifecycle, context, isSVG); } break; } } function updateClassComponent(instance, nextState, nextVNode, nextProps, parentDom, lifecycle, context, isSVG, force, fromSetState) { var lastState = instance.state; var lastProps = instance.props; nextVNode.children = instance; var lastInput = instance.$LI; var renderOutput; if (instance.$UN) { { throwError('Inferno Error: Can only update a mounted or mounting component. This usually means you called setState() or forceUpdate() on an unmounted component. This is a no-op.'); } return; } if (lastProps !== nextProps || nextProps === EMPTY_OBJ) { if (!fromSetState && isFunction(instance.componentWillReceiveProps)) { instance.$BR = true; instance.componentWillReceiveProps(nextProps, context); // If instance component was removed during its own update do nothing... if (instance.$UN) { return; } instance.$BR = false; } if (instance.$PSS) { nextState = combineFrom(nextState, instance.$PS); instance.$PSS = false; instance.$PS = null; } } /* Update if scu is not defined, or it returns truthy value or force */ var hasSCU = isFunction(instance.shouldComponentUpdate); if (force || !hasSCU || (hasSCU && instance.shouldComponentUpdate(nextProps, nextState, context))) { if (isFunction(instance.componentWillUpdate)) { instance.$BS = true; instance.componentWillUpdate(nextProps, nextState, context); instance.$BS = false; } instance.props = nextProps; instance.state = nextState; instance.context = context; if (isFunction(options.beforeRender)) { options.beforeRender(instance); } renderOutput = instance.render(nextProps, nextState, context); if (isFunction(options.afterRender)) { options.afterRender(instance); } var didUpdate = renderOutput !== NO_OP; var childContext; if (isFunction(instance.getChildContext)) { childContext = instance.getChildContext(); } if (isNullOrUndef(childContext)) { childContext = context; } else { childContext = combineFrom(context, childContext); } instance.$CX = childContext; if (didUpdate) { var nextInput = (instance.$LI = handleComponentInput(renderOutput, nextVNode)); patch(lastInput, nextInput, parentDom, lifecycle, childContext, isSVG); if (isFunction(instance.componentDidUpdate)) { instance.componentDidUpdate(lastProps, lastState); } if (isFunction(options.afterUpdate)) { options.afterUpdate(nextVNode); } } } else { instance.props = nextProps; instance.state = nextState; instance.context = context; } nextVNode.dom = instance.$LI.dom; } function patchComponent(lastVNode, nextVNode, parentDom, lifecycle, context, isSVG, isClass) { var nextType = nextVNode.type; var lastKey = lastVNode.key; var nextKey = nextVNode.key; if (lastVNode.type !== nextType || lastKey !== nextKey) { replaceWithNewNode(lastVNode, nextVNode, parentDom, lifecycle, context, isSVG); } else { var nextProps = nextVNode.props || EMPTY_OBJ; if (isClass) { var instance = lastVNode.children; instance.$UPD = true; updateClassComponent(instance, instance.state, nextVNode, nextProps, parentDom, lifecycle, context, isSVG, false, false); instance.$V = nextVNode; instance.$UPD = false; } else { var shouldUpdate = true; var lastProps = lastVNode.props; var nextHooks = nextVNode.ref; var nextHooksDefined = !isNullOrUndef(nextHooks); var lastInput = lastVNode.children; nextVNode.dom = lastVNode.dom; nextVNode.children = lastInput; if (nextHooksDefined && isFunction(nextHooks.onComponentShouldUpdate)) { shouldUpdate = nextHooks.onComponentShouldUpdate(lastProps, nextProps); } if (shouldUpdate !== false) { if (nextHooksDefined && isFunction(nextHooks.onComponentWillUpdate)) { nextHooks.onComponentWillUpdate(lastProps, nextProps); } var nextInput = nextType(nextProps, context); if (nextInput !== NO_OP) { nextInput = handleComponentInput(nextInput, nextVNode); patch(lastInput, nextInput, parentDom, lifecycle, context, isSVG); nextVNode.children = nextInput; nextVNode.dom = nextInput.dom; if (nextHooksDefined && isFunction(nextHooks.onComponentDidUpdate)) { nextHooks.onComponentDidUpdate(lastProps, nextProps); } } } else if (lastInput.flags & 14 /* Component */) { lastInput.parentVNode = nextVNode; } } } } function patchText(lastVNode, nextVNode, parentDom) { var nextText = nextVNode.children; var textNode = parentDom.firstChild; var dom; // Guard against external change on DOM node. if (isNull(textNode)) { parentDom.textContent = nextText; dom = parentDom.firstChild; } else { dom = lastVNode.dom; if (nextText !== lastVNode.children) { dom.nodeValue = nextText; } } nextVNode.dom = dom; } function patchNonKeyedChildren(lastChildren, nextChildren, dom, lifecycle, context, isSVG, lastChildrenLength, nextChildrenLength) { var commonLength = lastChildrenLength > nextChildrenLength ? nextChildrenLength : lastChildrenLength; var i = 0; for (; i < commonLength; i++) { var nextChild = nextChildren[i]; if (nextChild.dom) { nextChild = nextChildren[i] = directClone(nextChild); } patch(lastChildren[i], nextChild, dom, lifecycle, context, isSVG); } if (lastChildrenLength < nextChildrenLength) { for (i = commonLength; i < nextChildrenLength; i++) { var nextChild$1 = nextChildren[i]; if (nextChild$1.dom) { nextChild$1 = nextChildren[i] = directClone(nextChild$1); } mount(nextChild$1, dom, lifecycle, context, isSVG); } } else if (lastChildrenLength > nextChildrenLength) { for (i = commonLength; i < lastChildrenLength; i++) { remove(lastChildren[i], dom); } } } function patchKeyedChildren(a, b, dom, lifecycle, context, isSVG, aLength, bLength) { var aEnd = aLength - 1; var bEnd = bLength - 1; var aStart = 0; var bStart = 0; var i; var j; var aNode; var bNode; var nextNode; var nextPos; var node; var aStartNode = a[aStart]; var bStartNode = b[bStart]; var aEndNode = a[aEnd]; var bEndNode = b[bEnd]; if (bStartNode.dom) { b[bStart] = bStartNode = directClone(bStartNode); } if (bEndNode.dom) { b[bEnd] = bEndNode = directClone(bEndNode); } // Step 1 // tslint:disable-next-line outer: { // Sync nodes with the same key at the beginning. while (aStartNode.key === bStartNode.key) { patch(aStartNode, bStartNode, dom, lifecycle, context, isSVG); aStart++; bStart++; if (aStart > aEnd || bStart > bEnd) { break outer; } aStartNode = a[aStart]; bStartNode = b[bStart]; if (bStartNode.dom) { b[bStart] = bStartNode = directClone(bStartNode); } } // Sync nodes with the same key at the end. while (aEndNode.key === bEndNode.key) { patch(aEndNode, bEndNode, dom, lifecycle, context, isSVG); aEnd--; bEnd--; if (aStart > aEnd || bStart > bEnd) { break outer; } aEndNode = a[aEnd]; bEndNode = b[bEnd]; if (bEndNode.dom) { b[bEnd] = bEndNode = directClone(bEndNode); } } } if (aStart > aEnd) { if (bStart <= bEnd) { nextPos = bEnd + 1; nextNode = nextPos < bLength ? b[nextPos].dom : null; while (bStart <= bEnd) { node = b[bStart]; if (node.dom) { b[bStart] = node = directClone(node); } bStart++; insertOrAppend(dom, mount(node, null, lifecycle, context, isSVG), nextNode); } } } else if (bStart > bEnd) { while (aStart <= aEnd) { remove(a[aStart++], dom); } } else { var aLeft = aEnd - aStart + 1; var bLeft = bEnd - bStart + 1; var sources = new Array(bLeft); for (i = 0; i < bLeft; i++) { sources[i] = -1; } var moved = false; var pos = 0; var patched = 0; // When sizes are small, just loop them through if (bLeft <= 4 || aLeft * bLeft <= 16) { for (i = aStart; i <= aEnd; i++) { aNode = a[i]; if (patched < bLeft) { for (j = bStart; j <= bEnd; j++) { bNode = b[j]; if (aNode.key === bNode.key) { sources[j - bStart] = i; if (pos > j) { moved = true; } else { pos = j; } if (bNode.dom) { b[j] = bNode = directClone(bNode); } patch(aNode, bNode, dom, lifecycle, context, isSVG); patched++; a[i] = null; break; } } } } } else { var keyIndex = {}; // Map keys by their index in array for (i = bStart; i <= bEnd; i++) { keyIndex[b[i].key] = i; } // Try to patch same keys for (i = aStart; i <= aEnd; i++) { aNode = a[i]; if (patched < bLeft) { j = keyIndex[aNode.key]; if (isDefined(j)) { bNode = b[j]; sources[j - bStart] = i; if (pos > j) { moved = true; } else { pos = j; } if (bNode.dom) { b[j] = bNode = directClone(bNode); } patch(aNode, bNode, dom, lifecycle, context, isSVG); patched++; a[i] = null; } } } } // fast-path: if nothing patched remove all old and add all new if (aLeft === aLength && patched === 0) { removeAllChildren(dom, a); mountArrayChildren(b, dom, lifecycle, context, isSVG); } else { i = aLeft - patched; while (i > 0) { aNode = a[aStart++]; if (!isNull(aNode)) { remove(aNode, dom); i--; } } if (moved) { var seq = lis_algorithm(sources); j = seq.length - 1; for (i = bLeft - 1; i >= 0; i--) { if (sources[i] === -1) { pos = i + bStart; node = b[pos]; if (node.dom) { b[pos] = node = directClone(node); } nextPos = pos + 1; insertOrAppend(dom, mount(node, null, lifecycle, context, isSVG), nextPos < bLength ? b[nextPos].dom : null); } else if (j < 0 || i !== seq[j]) { pos = i + bStart; node = b[pos]; nextPos = pos + 1; insertOrAppend(dom, node.dom, nextPos < bLength ? b[nextPos].dom : null); } else { j--; } } } else if (patched !== bLeft) { // when patched count doesn't match b length we need to insert those new ones // loop backwards so we can use insertBefore for (i = bLeft - 1; i >= 0; i--) { if (sources[i] === -1) { pos = i + bStart; node = b[pos]; if (node.dom) { b[pos] = node = directClone(node); } nextPos = pos + 1; insertOrAppend(dom, mount(node, null, lifecycle, context, isSVG), nextPos < bLength ? b[nextPos].dom : null); } } } } } } // // https://en.wikipedia.org/wiki/Longest_increasing_subsequence function lis_algorithm(arr) { var p = arr.slice(); var result = [0]; var i; var j; var u; var v; var c; var len = arr.length; for (i = 0; i < len; i++) { var arrI = arr[i]; if (arrI !== -1) { j = result[result.length - 1]; if (arr[j] < arrI) { p[i] = j; result.push(i); continue; } u = 0; v = result.length - 1; while (u < v) { c = ((u + v) / 2) | 0; if (arr[result[c]] < arrI) { u = c + 1; } else { v = c; } } if (arrI < arr[result[u]]) { if (u > 0) { p[i] = result[u - 1]; } result[u] = i; } } } u = result.length; v = result[u - 1]; while (u-- > 0) { result[u] = v; v = p[v]; } return result; } var roots = options.roots; { if (isBrowser && document.body === null) { warning('Inferno warning: you cannot initialize inferno without "document.body". Wait on "DOMContentLoaded" event, add script to bottom of body, or use async/defer attributes on script tag.'); } } var documentBody = isBrowser ? document.body : null; function render(input, parentDom, callback) { // Development warning { if (documentBody === parentDom) { throwError('you cannot render() to the "document.body". Use an empty element as a container instead.'); } } if (input === NO_OP) { return; } var rootLen = roots.length; var rootInput; var index; for (index = 0; index < rootLen; index++) { if (roots[index] === parentDom) { rootInput = parentDom.$V; break; } } if (isUndefined(rootInput)) { if (!isInvalid(input)) { if (input.dom) { input = directClone(input); } if (isNull(parentDom.firstChild)) { mount(input, parentDom, LIFECYCLE, EMPTY_OBJ, false); parentDom.$V = input; roots.push(parentDom); } else { hydrate(input, parentDom); } rootInput = input; } } else { if (isNullOrUndef(input)) { remove(rootInput, parentDom); roots.splice(index, 1); } else { if (input.dom) { input = directClone(input); } patch(rootInput, input, parentDom, LIFECYCLE, EMPTY_OBJ, false); rootInput = parentDom.$V = input; } } if (LIFECYCLE.length > 0) { callAll(LIFECYCLE); } if (isFunction(callback)) { callback(); } if (rootInput && rootInput.flags & 14 /* Component */) { return rootInput.children; } } function createRenderer(parentDom) { return function renderer(lastInput, nextInput) { if (!parentDom) { parentDom = lastInput; } render(nextInput, parentDom); }; } function createPortal(children, container) { return createVNode(1024 /* Portal */, container, null, children, 0 /* UnknownChildren */, null, isInvalid(children) ? null : children.key, null); } var resolvedPromise = typeof Promise === 'undefined' ? null : Promise.resolve(); var fallbackMethod = typeof requestAnimationFrame === 'undefined' ? setTimeout : requestAnimationFrame; function nextTick(fn) { if (resolvedPromise) { return resolvedPromise.then(fn); } return fallbackMethod(fn); } function queueStateChanges(component, newState, callback) { if (isFunction(newState)) { newState = newState(component.state, component.props, component.context); } var pending = component.$PS; if (isNullOrUndef(pending)) { component.$PS = newState; } else { for (var stateKey in newState) { pending[stateKey] = newState[stateKey]; } } if (!component.$PSS && !component.$BR) { if (!component.$UPD) { component.$PSS = true; component.$UPD = true; applyState(component, false, callback); component.$UPD = false; } else { // Async var queue = component.$QU; if (isNull(queue)) { queue = component.$QU = []; nextTick(promiseCallback(component, queue)); } if (isFunction(callback)) { queue.push(callback); } } } else { component.$PSS = true; if (component.$BR && isFunction(callback)) { LIFECYCLE.push(callback.bind(component)); } } } function promiseCallback(component, queue) { return function () { component.$QU = null; component.$UPD = true; applyState(component, false, function () { for (var i = 0, len = queue.length; i < len; i++) { queue[i].call(component); } }); component.$UPD = false; }; } function applyState(component, force, callback) { if (component.$UN) { return; } if (force || !component.$BR) { component.$PSS = false; var pendingState = component.$PS; var prevState = component.state; var nextState = combineFrom(prevState, pendingState); var props = component.props; var context = component.context; component.$PS = null; var vNode = component.$V; var lastInput = component.$LI; var parentDom = lastInput.dom && lastInput.dom.parentNode; updateClassComponent(component, nextState, vNode, props, parentDom, LIFECYCLE, context, (vNode.flags & 32 /* SvgElement */) > 0, force, true); if (component.$UN) { return; } if ((component.$LI.flags & 1024 /* Portal */) === 0) { var dom = component.$LI.dom; while (!isNull((vNode = vNode.parentVNode))) { if ((vNode.flags & 14 /* Component */) > 0) { vNode.dom = dom; } } } if (LIFECYCLE.length > 0) { callAll(LIFECYCLE); } } else { component.state = component.$PS; component.$PS = null; } if (isFunction(callback)) { callback.call(component); } } var Component = function Component(props, context) { this.state = null; // Internal properties this.$BR = false; // BLOCK RENDER this.$BS = true; // BLOCK STATE this.$PSS = false; // PENDING SET STATE this.$PS = null; // PENDING STATE (PARTIAL or FULL) this.$LI = null; // LAST INPUT this.$V = null; // VNODE this.$UN = false; // UNMOUNTED this.$CX = null; // CHILDCONTEXT this.$UPD = true; // UPDATING this.$QU = null; // QUEUE /** @type {object} */ this.props = props || EMPTY_OBJ; /** @type {object} */ this.context = context || EMPTY_OBJ; // context should not be mutable }; Component.prototype.forceUpdate = function forceUpdate (callback) { if (this.$UN) { return; } applyState(this, true, callback); }; Component.prototype.setState = function setState (newState, callback) { if (this.$UN) { return; } if (!this.$BS) { queueStateChanges(this, newState, callback); } else { // Development warning { throwError('cannot update state via setState() in componentWillUpdate() or constructor.'); } return; } }; // tslint:disable-next-line:no-empty Component.prototype.render = function render (nextProps, nextState, nextContext) { }; // Public Component.defaultProps = null; { /* tslint:disable-next-line:no-empty */ var testFunc = function testFn() { }; if ((testFunc.name || testFunc.toString()).indexOf('testFn') === -1) { warning("It looks like you're using a minified copy of the development build " + 'of Inferno. When deploying Inferno apps to production, make sure to use ' + 'the production build which skips development warnings and is faster. ' + 'See http://infernojs.org for more details.'); } } var version = "4.0.8"; exports.Component = Component; exports.EMPTY_OBJ = EMPTY_OBJ; exports.NO_OP = NO_OP; exports.createComponentVNode = createComponentVNode; exports.createPortal = createPortal; exports.createRenderer = createRenderer; exports.createTextVNode = createTextVNode; exports.createVNode = createVNode; exports.directClone = directClone; exports.getFlagsForElementVnode = getFlagsForElementVnode; exports.getNumberStyleValue = getNumberStyleValue; exports.hydrate = hydrate; exports.linkEvent = linkEvent; exports.normalizeProps = normalizeProps; exports.options = options; exports.render = render; exports.version = version; Object.defineProperty(exports, '__esModule', { value: true }); })));
jonobr1/cdnjs
ajax/libs/inferno/4.0.8/inferno.js
JavaScript
mit
96,955
[ 30522, 1006, 3853, 1006, 3795, 1010, 4713, 1007, 1063, 2828, 11253, 14338, 1027, 1027, 1027, 1005, 4874, 1005, 1004, 1004, 2828, 11253, 11336, 999, 1027, 1027, 1005, 6151, 28344, 1005, 1029, 4713, 1006, 14338, 1007, 1024, 2828, 11253, 9375,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// Mantid Repository : https://github.com/mantidproject/mantid // // Copyright &copy; 2010 ISIS Rutherford Appleton Laboratory UKRI, // NScD Oak Ridge National Laboratory, European Spallation Source // & Institut Laue - Langevin // SPDX - License - Identifier: GPL - 3.0 + #ifndef MANTID_MDALGORITHMS_WS_SELECTOR_H #define MANTID_MDALGORITHMS_WS_SELECTOR_H #include "MantidMDAlgorithms/ConvToMDBase.h" namespace Mantid { namespace MDAlgorithms { /** small class to select proper solver as function of the workspace kind and (possibly, in a future) other workspace parameters. * may be replaced by usual mantid factory in a future; * * * See http://www.mantidproject.org/Writing_custom_ConvertTo_MD_transformation for detailed description of this * class place in the algorithms hierarchy. * * @date 25-05-2012 */ class DLLExport ConvToMDSelector { public: enum ConverterType { DEFAULT, INDEXED }; /** * * @param tp :: type of converter (indexed or default) */ ConvToMDSelector(ConverterType tp = DEFAULT); /// function which selects the convertor depending on workspace type and /// (possibly, in a future) some workspace properties boost::shared_ptr<ConvToMDBase> convSelector(API::MatrixWorkspace_sptr inputWS, boost::shared_ptr<ConvToMDBase> &currentSolver) const; private: ConverterType converterType; }; } // namespace MDAlgorithms } // namespace Mantid #endif
mganeva/mantid
Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvToMDSelector.h
C
gpl-3.0
1,437
[ 30522, 1013, 1013, 2158, 3775, 2094, 22409, 1024, 16770, 1024, 1013, 1013, 21025, 2705, 12083, 1012, 4012, 1013, 2158, 3775, 18927, 3217, 20614, 1013, 2158, 3775, 2094, 1013, 1013, 1013, 1013, 9385, 1004, 6100, 1025, 2230, 18301, 18472, 260...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#region Copyright & License Information /* * Copyright 2007-2014 The OpenRA Developers (see AUTHORS) * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. */ #endregion using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; namespace OpenRA.FileFormats { public class XccLocalDatabase { public readonly string[] Entries; public XccLocalDatabase(Stream s) { // Skip unnecessary header data s.Seek(48, SeekOrigin.Begin); var reader = new BinaryReader(s); var count = reader.ReadInt32(); Entries = new string[count]; for (var i = 0; i < count; i++) { var chars = new List<char>(); char c; while ((c = reader.ReadChar()) != 0) chars.Add(c); Entries[i] = new string(chars.ToArray()); } } public XccLocalDatabase(IEnumerable<string> filenames) { Entries = filenames.ToArray(); } public byte[] Data() { var data = new MemoryStream(); using (var writer = new BinaryWriter(data)) { writer.Write(Encoding.ASCII.GetBytes("XCC by Olaf van der Spek")); writer.Write(new byte[] {0x1A,0x04,0x17,0x27,0x10,0x19,0x80,0x00}); writer.Write((int)(Entries.Aggregate(Entries.Length, (a,b) => a + b.Length) + 52)); // Size writer.Write((int)0); // Type writer.Write((int)0); // Version writer.Write((int)0); // Game/Format (0 == TD) writer.Write((int)Entries.Length); // Entries foreach (var e in Entries) { writer.Write(Encoding.ASCII.GetBytes(e)); writer.Write((byte)0); } } return data.ToArray(); } } }
penev92/OpenRA
OpenRA.Game/FileFormats/XccLocalDatabase.cs
C#
gpl-3.0
1,731
[ 30522, 1001, 2555, 9385, 1004, 6105, 2592, 1013, 1008, 1008, 9385, 2289, 1011, 2297, 1996, 2330, 2527, 9797, 1006, 2156, 6048, 1007, 1008, 2023, 5371, 2003, 2112, 1997, 2330, 2527, 1010, 2029, 2003, 2489, 4007, 1012, 2009, 30524, 1012, 20...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
$(document).ready(function() { $(".container").hide(); $(".container").fadeIn('5000'); $(".showcase-wrapper").hide(); $(".showcase-wrapper").fadeIn("slow"); }); /* var toggle = false; $('.nav-toggle').on('click', function () { if (toggle == false) { $('#sidebar-wrapper').stop().animate({ 'left': '4px' }); toggle = true; } else { $('#sidebar-wrapper').stop().animate({ 'left': '250px' }); toggle = false; } }); */ $(function() { $('.project-box>.row>.project-post').append('<span class="more-info">Click for more information</span>'); $('.project-box').click(function(e) { if (e.target.tagName == "A" || e.target.tagName == "IMG") { return true; } $(this).find('.more-info').toggle(); $(this).find('.post').slideToggle(); }); });
ALenfant/alenfant.github.io
js/hc.js
JavaScript
mit
885
[ 30522, 1002, 1006, 6254, 1007, 1012, 3201, 1006, 3853, 1006, 1007, 1063, 1002, 1006, 1000, 1012, 11661, 1000, 1007, 1012, 5342, 1006, 1007, 1025, 1002, 1006, 1000, 1012, 11661, 1000, 1007, 1012, 12985, 2378, 1006, 1005, 13509, 1005, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * This file contains the RTC driver table for Motorola MCF5206eLITE * ColdFire evaluation board. * * Copyright (C) 2000 OKTET Ltd., St.-Petersburg, Russia * Author: Victor V. Vengerov <vvv@oktet.ru> * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * * http://www.rtems.com/license/LICENSE. */ #include <bsp.h> #include <libchip/rtc.h> #include <ds1307.h> /* Forward function declaration */ bool mcf5206elite_ds1307_probe(int minor); extern rtc_fns ds1307_fns; /* The following table configures the RTC drivers used in this BSP */ rtc_tbl RTC_Table[] = { { "/dev/rtc", /* sDeviceName */ RTC_CUSTOM, /* deviceType */ &ds1307_fns, /* pDeviceFns */ mcf5206elite_ds1307_probe, /* deviceProbe */ NULL, /* pDeviceParams */ 0x00, /* ulCtrlPort1, for DS1307-I2C bus number */ DS1307_I2C_ADDRESS, /* ulDataPort, for DS1307-I2C device addr */ NULL, /* getRegister - not applicable to DS1307 */ NULL /* setRegister - not applicable to DS1307 */ } }; /* Some information used by the RTC driver */ #define NUM_RTCS (sizeof(RTC_Table)/sizeof(rtc_tbl)) size_t RTC_Count = NUM_RTCS; rtems_device_minor_number RTC_Minor; /* mcf5206elite_ds1307_probe -- * RTC presence probe function. Return TRUE, if device is present. * Device presence checked by probe access to RTC device over I2C bus. * * PARAMETERS: * minor - minor RTC device number * * RETURNS: * TRUE, if RTC device is present */ bool mcf5206elite_ds1307_probe(int minor) { int try = 0; i2c_message_status status; rtc_tbl *rtc; i2c_bus_number bus; i2c_address addr; if (minor >= NUM_RTCS) return false; rtc = RTC_Table + minor; bus = rtc->ulCtrlPort1; addr = rtc->ulDataPort; do { status = i2c_wrbyte(bus, addr, 0); if (status == I2C_NO_DEVICE) return false; try++; } while ((try < 15) && (status != I2C_SUCCESSFUL)); if (status == I2C_SUCCESSFUL) return true; else return false; }
yangxi/omap4m3
c/src/lib/libbsp/m68k/mcf5206elite/tod/todcfg.c
C
gpl-2.0
2,267
[ 30522, 1013, 1008, 1008, 2023, 5371, 3397, 1996, 19387, 2278, 4062, 2795, 2005, 29583, 11338, 2546, 25746, 2692, 2575, 20806, 2618, 1008, 3147, 10273, 9312, 2604, 1012, 1008, 1008, 9385, 1006, 1039, 1007, 2456, 7929, 22513, 5183, 1012, 1010...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright 2004-2006 Intel Corporation * * 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. */ #ifndef _CONTACT_MANAGER_H_ #define _CONTACT_MANAGER_H_ #include <oasys/debug/Log.h> #include <oasys/thread/SpinLock.h> #include <oasys/thread/Timer.h> #include <oasys/util/StringBuffer.h> #include <oasys/util/StringUtils.h> #include "bundling/BundleEventHandler.h" namespace dtn { class Contact; class ConvergenceLayer; class CLInfo; class Link; class LinkSet; /** * A contact manager class. Maintains topological information and * connectivity state regarding available links and contacts. */ class ContactManager : public BundleEventHandler { public: /** * Constructor / Destructor */ ContactManager(); virtual ~ContactManager(); /** * Dump a string representation of the info inside contact manager. */ void dump(oasys::StringBuffer* buf) const; /********************************************** * * Link set accessor functions * *********************************************/ /** * Add a link if the contact manager does not already have a link * by the same name. */ bool add_new_link(const LinkRef & link); /** * Record old link information read from datastore. Used to check that link names * are consistent between runs of server so that recorded forwarding logs make sense. * The 'links' in this set are not active - they are only used to check the information * held about the link with prospective new links to ensure consistency. They can * all be of the base class variety - no need to worry about using sub-classes. */ void add_previous_link(const LinkRef& link); /** * Delete a link */ void del_link(const LinkRef& link, bool wait = false, ContactEvent::reason_t reason = ContactEvent::NO_INFO); /** * Check if contact manager already has this link. */ bool has_link(const LinkRef& link); /** * * Check if contact manager already has a link by the same name. */ bool has_link(const char* name); /** * Finds link corresponding to this name */ LinkRef find_link(const char* name); /** * Finds preeviously existing link corresponding to this name */ LinkRef find_previous_link(const char* name); /** * Helper routine to find a current link based on criteria: * * @param cl The convergence layer * @param nexthop The next hop string * @param remote_eid Remote endpoint id (NULL_EID for any) * @param type Link type (LINK_INVALID for any) * @param states Bit vector of legal link states, e.g. ~(OPEN | OPENING) * * @return The link if it matches or NULL if there's no match */ LinkRef find_link_to(ConvergenceLayer* cl, const std::string& nexthop, const EndpointID& remote_eid = EndpointID::NULL_EID(), Link::link_type_t type = Link::LINK_INVALID, u_int states = 0xffffffff); /** * Helper routine to find a link that existed in a prior run based on criteria: * * @param cl The convergence layer * @param nexthop The next hop string * @param remote_eid Remote endpoint id (NULL_EID for any) * @param type Link type (LINK_INVALID for any) * @param states Bit vector of legal link states, e.g. ~(OPEN | OPENING) * * @return The link if it matches or NULL if there's no match */ LinkRef find_previous_link_to(ConvergenceLayer* cl, const std::string& nexthop, const EndpointID& remote_eid = EndpointID::NULL_EID(), Link::link_type_t type = Link::LINK_INVALID, u_int states = 0xffffffff); /** * Routine to check if usage of a newly created link name is consistent * with its previous usage so that forwarding log entries remain meaningful. */ bool consistent_with_previous_usage(const LinkRef& link, bool *reincarnation); /** * Routine to check if links created by configuration file are consistent * with previous usage so that forwarding log entries remain meaningful. * This can't be done immediately on creation because the persistent storage * hasn't been initialized. However the link creation hasn't been completed * because the event loop is not yet running. This catches any inconsistencies * once previous_links_ has been loaded during BundleDaemon::run startup. */ void config_links_consistent(void); /** * Reincarnate any non-OPPORTUNISTIC links not set up by configuration file */ void reincarnate_links(void); /** * Return the list of links. Asserts that the CM spin lock is held * by the caller. */ const LinkSet* links(); /** * Return the reloaded list of links reloaded from previous runs. * Lock is not essential here. */ const LinkSet* previous_links(); /** * Accessor for the ContactManager internal lock. */ oasys::Lock* lock() { return &lock_; } /********************************************** * * Event handler routines * *********************************************/ /** * Generic event handler. */ void handle_event(BundleEvent* event) { dispatch_event(event); } /** * Event handler when a link has been created. */ void handle_link_created(LinkCreatedEvent* event); /** * Event handler when a link becomes unavailable. */ void handle_link_available(LinkAvailableEvent* event); /** * Event handler when a link becomes unavailable. */ void handle_link_unavailable(LinkUnavailableEvent* event); /** * Event handler when a link is opened successfully */ void handle_contact_up(ContactUpEvent* event); /********************************************** * * Opportunistic contact routines * *********************************************/ /** * Notification from a convergence layer that a new opportunistic * link has come knocking. * * @return An idle link to represent the new contact */ LinkRef new_opportunistic_link(ConvergenceLayer* cl, const std::string& nexthop, const EndpointID& remote_eid, const std::string* link_name = NULL); protected: /** * Helper routine to find a link based on criteria: * * @param link_set links_ or previous_links_ * @param cl The convergence layer * @param nexthop The next hop string * @param remote_eid Remote endpoint id (NULL_EID for any) * @param type Link type (LINK_INVALID for any) * @param states Bit vector of legal link states, e.g. ~(OPEN | OPENING) * * @return The link if it matches or NULL if there's no match */ LinkRef find_any_link_to(LinkSet * link_set, ConvergenceLayer* cl, const std::string& nexthop, const EndpointID& remote_eid = EndpointID::NULL_EID(), Link::link_type_t type = Link::LINK_INVALID, u_int states = 0xffffffff); LinkSet* links_; ///< Set of all links int opportunistic_cnt_; ///< Counter for opportunistic links LinkSet* previous_links_; ///< Set of links used in prior runs of daemon /** * Reopen a broken link. */ void reopen_link(const LinkRef& link); /** * Timer class used to re-enable broken ondemand links. */ class LinkAvailabilityTimer : public oasys::Timer { public: LinkAvailabilityTimer(ContactManager* cm, const LinkRef& link) : cm_(cm), link_(link.object(), "LinkAvailabilityTimer") {} virtual void timeout(const struct timeval& now); ContactManager* cm_; ///< The contact manager object LinkRef link_; ///< The link in question }; friend class LinkAvailabilityTimer; /** * Table storing link -> availability timer class. */ typedef std::map<LinkRef, LinkAvailabilityTimer*> AvailabilityTimerMap; AvailabilityTimerMap availability_timers_; /** * Lock to protect internal data structures. */ mutable oasys::SpinLock lock_; friend class LinkCommand; }; } // namespace dtn #endif /* _CONTACT_MANAGER_H_ */
lczhang/dtn
servlib/contacts/ContactManager.h
C
apache-2.0
9,051
[ 30522, 1013, 1008, 1008, 9385, 2432, 1011, 2294, 13420, 3840, 1008, 1008, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 1000, 1007, 1025, 1008, 2017, 2089, 2025, 2224, 2023, 5371, 3272, 1999, 12646, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package co.wa2do_app.wa2do.mock; import co.wa2do_app.wa2do.InterestTypes; import co.wa2do_app.wa2do.vo.EventVo; import java.util.ArrayList; public class MockEvents { public static ArrayList<EventVo> getEvents() { ArrayList<EventVo> events = new ArrayList<EventVo>(); events.add(new EventVo(InterestTypes.SPORTS, "Racketball", "Levi Bostian", "123 ABC St", "Miami", "FL", 3, 5, 32, 5, 32)); events.add(new EventVo(InterestTypes.ARTS, "Nickelback", "Trevor Carlson", "456 D St", "Chicago", "IL", 999, 1000, 5, 12, 3)); return events; } }
levibostian/wa2do
app/src/main/java/co/wa2do_app/wa2do/mock/MockEvents.java
Java
mit
582
[ 30522, 7427, 2522, 1012, 11333, 2475, 3527, 1035, 10439, 1012, 11333, 2475, 3527, 1012, 12934, 1025, 12324, 2522, 1012, 11333, 2475, 3527, 1035, 10439, 1012, 11333, 2475, 3527, 1012, 3037, 13874, 2015, 1025, 12324, 2522, 1012, 11333, 2475, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
--- title: Using bitmaps for efficient Solidity smart contracts date: '2018-12-10' summary: '' tags: - Solidity - Ethereum - Smart Contracts - Bitmaps --- Smart contracts on Ethereum cost gas to run, and since gas is paid for in Ether, it's generally a good idea to minimize the gas cost of running one's contract. In this sense, writing a smart contract is similar to writing a complex program for a resource-constrained computer - be as efficient as possible, both in terms of memory use and and CPU cycles. One well known technique for optimizing storage and access in certain use cases is _bitmaps_. In this context _bitmap_ refers to the raw 1 and 0 bits in memory, which are then used to represent some program state. For example, let's say we have 10 people signed up to attend a class and we want to record whether each person showed up or not. If coding in [Solidity](https://solidity.readthedocs.io), we could use an array of 8-bit values to store this: ```solidity // people who showed up: 1, 3, 4, 8, 9 uint8[] memory a = new uint8[](1, 0, 1, 1, 0, 0, 0, 1, 1, 0); ``` Notice that each value takes up 8 bits of space in RAM, meaning in total we are using up at least 80 bits of memory to represent each person. In 64-bit systems (which most computers are these days) numbers are represented in multiples of 64-bits since each memory position is 64-bits. Thus 80 bits will actually require 128 bits to represent in memory. Yet we actually only need to represent two values per attendance state - 0 or 1. Thus, we could actually use a single bit to represent each value, by using a `uint16`: ```solidity // people who showed up: 1, 3, 4, 8, 9 uint16 a = 397; // equals 0110001101 in binary ``` Now everything combined take up only 16 bits of space in RAM, meaning 64 bits in raw memory. This is a much more memory efficient scheme. The only thing we need to be able to do is read individual bits within the integer. We can use _bitwise_ operators to do this. Note that bits are counted from [right to left]((https://www.techopedia.com/definition/8030/least-significant-bit-lsb)): ```solidity uint16 a = 397; // equals 0110001101 in binary // Read bits at positions 3 and 7. // Note that bits are 0-indexed, thus bit 1 is at position 0, bit 2 is at position 1, etc. uint8 bit3 = a & (1 << 2) uint8 bit7 = a & (1 << 6) ``` Setting a specific bit works similary: ```solidity uint16 a = 397; // equals 0110001101 in binary // Set bit 5 a = a | (1 << 4) ``` **Battleship** In my [Ethereum-based implementation of Battleship](https://github.com/eth-battleship/eth-battleship.github.io), I use bitmaps to both store each player's game board as well as their list of moves against their opponent's board. Using bitmaps makes checks and calculations very efficient. For instance, when a user initial signs onto a game we need to check that they've placed their ships on their board correctly. Ships may not overlap with each other and they must all be fully contained within the game board boundaries: ```solidity /** * Calculate the bitwise position of given XY coordinate. * @param boardSize_ board size * @param x_ X coordinate * @param y_ Y coordinate * @return position in integer */ function calculatePosition(uint boardSize_, uint x_, uint y_) public pure returns (uint) { return 2 ** (x_ * boardSize_ + y_); // could also write as 1 << (x_ * boardSize_ + y) } /** * Calculate board hash. * * This will check that the board is valid before calculating the hash * * @param ships_ Array representing ship sizes, each ship is a single number representing its size * @param boardSize_ Size of board's sides (board is a square) * @param board_ Array representing the board, each ship is represented as [x, y, isVertical] * @return the SHA3 hash */ function calculateBoardHash(bytes ships_, uint boardSize_, bytes board_) public pure returns (bytes32) { // used to keep track of existing ship positions uint marked = 0; // check that board setup is valid for (uint s = 0; ships_.length > s; s += 1) { // extract ship info uint index = 3 * s; uint x = uint(board_[index]); uint y = uint(board_[index + 1]); bool isVertical = (0 < uint(board_[index + 2])); uint shipSize = uint(ships_[s]); // check ship is contained within board boundaries require(0 <= x && boardSize_ > x); require(0 <= y && boardSize_ > y); require(boardSize_ >= ((isVertical ? x : y) + shipSize)); // check that ship does not overlap with other ships on the board uint endX = x + (isVertical ? shipSize : 1); uint endY = y + (isVertical ? 1 : shipSize); while (endX > x && endY > y) { uint pos = calculatePosition(boardSize_, x, y); // ensure no ship already sits on this position require((pos & marked) == 0); // update position bit marked = marked | pos; x += (isVertical ? 1 : 0); y += (isVertical ? 0 : 1); } } return keccak256(board_); } ``` When it comes to calculate the winner of a game, bitmaps are again used to check how many times a player has managed to hit their opponent's ships: ```solidity /** * Calculate no. of hits for a player. * * @param revealer_ The player whose board it is * @param mover_ The opponent player whose hits to calculate */ function calculateHits(Player storage revealer_, Player storage mover_) internal { // now let's count the hits for the mover and check board validity in one go mover_.hits = 0; for (uint ship = 0; ships.length > ship; ship += 1) { // extract ship info uint index = 3 * ship; uint x = uint(revealer_.board[index]); uint y = uint(revealer_.board[index + 1]); bool isVertical = (0 < uint(revealer_.board[index + 2])); uint shipSize = uint(ships[ship]); // now let's see if there are hits while (0 < shipSize) { // did mover_ hit this position? if (0 != (calculatePosition(boardSize, x, y) & mover_.moves)) { mover_.hits += 1; } // move to next part of ship if (isVertical) { x += 1; } else { y += 1; } // decrement counter shipSize -= 1; } } } ``` All of a player's moves (`mover_.moves` above) are stored in a single `uint256` value, for sake of efficiency. Each bit within this value signifies whether the player hit the given position or now. Since our positions are 2-dimensional (x, y) this means our maximum board size is 16, i.e. a 16x16 board. If we wished to represent larger boards then we would have to use multiple `uint256` \ values to represent each player's moves. **Kickback** Kickback is an [event attendee management platform](https://github.com/wearekickback/contracts) I'm currently working on. In Kickback we want to tell the smart contract who showed up to an event and who didn't. This is an effect a real world implementation of the example I presented earlier in this post. We use a bitmap to represent participant attendance status (0 = not attended, 1 = attended) but this time we need to use multiple bitmaps since we don't with to limit the event capacity or the number of people who can show up. Technically speaking, we use a list of `uint256` numbers to represent attendance status, where each number in the list represents the attendance status of 256 people: ```solidity /** * @dev Mark participants as attended and enable payouts. The attendance cannot be undone. * @param _maps The attendance status of participants represented by uint256 values. */ function finalize(uint256[] _maps) external onlyAdmin onlyActive { uint256 totalBits = _maps.length * 256; require(totalBits >= registered && totalBits - registered < 256, 'incorrect no. of bitmaps provided'); attendanceMaps = _maps; uint256 _totalAttended = 0; // calculate total attended for (uint256 i = 0; i < attendanceMaps.length; i++) { uint256 map = attendanceMaps[i]; // brian kerninghan bit-counting method - O(log(n)) while (map != 0) { map &= (map - 1); _totalAttended++; } } // since maps can contain more bits than there are registrants, we cap the value! totalAttended = _totalAttended < registered ? _totalAttended : registered; } ``` Note that we first check to see that the current no. of `uint256` numbers have been provided. We then save the "attendance bitmaps" for use later on, and use the [Brian Kerninghan method](https://stackoverflow.com/questions/12380478/bits-counting-algorithm-brian-kernighan-in-an-integer-time-complexity) for counting the no. of set bits. This algorithm goes through as many iterations as there are set bits, meaning that if only 2 people attended then only 2 iterations of the loop would be needed to get the final count. Finally, we add a safety check at the end to ensure that the "total attended" count doesn't exceed the total no. of people who registered to attend, though technically speaking this should never be the case if we've set the bits properly in the input attendance bitmaps.
hiddentao/hiddentao.github.io
src/pages/markdown/blog/using-bitmaps-for-efficient-solidity-smart-contracts/en.md
Markdown
mit
9,136
[ 30522, 1011, 1011, 1011, 2516, 1024, 2478, 2978, 2863, 4523, 2005, 8114, 5024, 3012, 6047, 8311, 3058, 1024, 1005, 2760, 1011, 2260, 1011, 2184, 1005, 12654, 1024, 1005, 1005, 22073, 1024, 1011, 5024, 3012, 1011, 28855, 14820, 1011, 6047, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package ca.uhn.fhir.cql.dstu3.builder; /*- * #%L * HAPI FHIR JPA Server - Clinical Quality Language * %% * Copyright (C) 2014 - 2022 Smile CDR, Inc. * %% * 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. * #L% */ import ca.uhn.fhir.cql.common.builder.BaseBuilder; import org.hl7.fhir.dstu3.model.MeasureReport; import org.hl7.fhir.dstu3.model.Period; import org.hl7.fhir.dstu3.model.Reference; import org.hl7.fhir.exceptions.FHIRException; import org.opencds.cqf.cql.engine.runtime.Interval; import java.util.Date; public class MeasureReportBuilder extends BaseBuilder<MeasureReport> { private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(MeasureReportBuilder.class); public MeasureReportBuilder() { super(new MeasureReport()); } public MeasureReportBuilder buildStatus(String status) { try { this.complexProperty.setStatus(MeasureReport.MeasureReportStatus.fromCode(status)); } catch (FHIRException e) { ourLog.warn("Exception caught while attempting to set Status to '" + status + "', assuming status COMPLETE!" + System.lineSeparator() + e.getMessage()); this.complexProperty.setStatus(MeasureReport.MeasureReportStatus.COMPLETE); } return this; } public MeasureReportBuilder buildType(MeasureReport.MeasureReportType type) { this.complexProperty.setType(type); return this; } public MeasureReportBuilder buildMeasureReference(String measureRef) { this.complexProperty.setMeasure(new Reference(measureRef)); return this; } public MeasureReportBuilder buildPatientReference(String patientRef) { this.complexProperty.setPatient(new Reference(patientRef)); return this; } public MeasureReportBuilder buildPeriod(Interval period) { this.complexProperty.setPeriod(new Period().setStart((Date) period.getStart()).setEnd((Date) period.getEnd())); return this; } }
jamesagnew/hapi-fhir
hapi-fhir-jpaserver-cql/src/main/java/ca/uhn/fhir/cql/dstu3/builder/MeasureReportBuilder.java
Java
apache-2.0
2,503
[ 30522, 7427, 6187, 1012, 7910, 2078, 1012, 1042, 11961, 1012, 1039, 4160, 2140, 1012, 16233, 8525, 2509, 1012, 12508, 1025, 1013, 1008, 1011, 1008, 1001, 1003, 1048, 1008, 5292, 8197, 1042, 11961, 30524, 4297, 1012, 1008, 1003, 1003, 1008, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script src="/js/jquery-2.2.1.min.js"></script> <script src="/js/bootstrap.min.js"></script> <script src="/js/switchery.min.js"></script> <script src="/js/bootstrap-select.min.js"></script> <script src="/js/jquery.dataTables.js"></script> <script src="/js/dataTables.bootstrap.js"></script> <script src="/js/dataTables.responsive.min.js"></script> <link href="{{URL::asset('/css/bootstrap.min.css')}}" rel="stylesheet"> <link href="{{URL::asset('/css/nifty.min.css')}}" rel="stylesheet"> <link href="{{URL::asset('/css/switchery.min.css')}}" rel="stylesheet"> <link href="{{URL::asset('/css/bootstrap-select.min.css')}}" rel="stylesheet"> <link href="{{URL::asset('/css/dataTables.bootstrap.css')}}" rel="stylesheet"> <link href="{{URL::asset('/css/dataTables.responsive.css')}}" rel="stylesheet"> <link href="{{URL::asset('docs/nifty-v2.4/demo/plugins/font-awesome/css/font-awesome.min.css')}}" rel="stylesheet"> <link href="{{URL::asset('/css/bootstrap-table.min.css')}}" rel="stylesheet"> <link href="{{URL::asset('/css/bootstrap-editable.css')}}" rel="stylesheet"> <link href="{{URL::asset('/css/bgColor.css')}}" rel="stylesheet"> <link rel="stylesheet" href="{{URL::asset('css/contactsst.css')}}"> <link rel="stylesheet" href="{{URL::asset('css/infost.css')}}"> <link rel="stylesheet" href="{{URL::asset('css/header.css')}}"> <title> Phonebook - @if(\Auth::check()) {{ Auth::user()->name }} @endif Contacts </title> <script type="text/javascript"> $(document).ready(function(){ $('#demo-dt-basic').DataTable(); }); </script> </head> <body> @include('partials.header') @if(Auth::check()) <br/><br/> @include('partials.contactsTable') @else @include('partials.info') @endif </body> </html>
gFelicio/agenda
resources/views/contacts.blade.php
PHP
mit
1,878
[ 30522, 1026, 999, 9986, 13874, 16129, 1028, 1026, 16129, 1028, 1026, 2132, 1028, 1026, 18804, 25869, 13462, 1027, 1000, 21183, 2546, 1011, 1022, 1000, 1028, 1026, 5896, 5034, 2278, 1027, 1000, 1013, 1046, 2015, 1013, 1046, 4226, 2854, 1011,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<td> {{item.name}} </td> <td> {{item.age}} </td> <td> {{item.sex}} </td>
ectechno/mulgala
PlatformProject.SPA/App/sampleService/tableComponents/tableTemplate.html
HTML
mit
91
[ 30522, 1026, 14595, 1028, 1063, 1063, 8875, 1012, 2171, 1065, 1065, 30524, 1065, 1026, 1013, 14595, 1028, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# pygopherd -- Gopher-based protocol server in Python # module: serve up gopherspace via http # $Id: http.py,v 1.21 2002/04/26 15:18:10 jgoerzen Exp $ # Copyright (C) 2002 John Goerzen # <jgoerzen@complete.org> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; version 2 of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA import SocketServer import re, binascii import os, stat, os.path, mimetypes, urllib, time from pygopherd import handlers, protocols, GopherExceptions from pygopherd.protocols.base import BaseGopherProtocol import pygopherd.version import cgi class HTTPProtocol(BaseGopherProtocol): def canhandlerequest(self): self.requestparts = map(lambda arg: arg.strip(), self.request.split(" ")) return len(self.requestparts) == 3 and \ (self.requestparts[0] == 'GET' or self.requestparts[0] == 'HEAD') and \ self.requestparts[2][0:5] == 'HTTP/' def headerslurp(self): if hasattr(self.requesthandler, 'pygopherd_http_slurped'): # Already slurped. self.httpheaders = self.requesthandler.pygopherd_http_slurped return # Slurp up remaining lines. self.httpheaders = {} while 1: line = self.rfile.readline() if not len(line): break line = line.strip() if not len(line): break splitline = line.split(':', 1) if len(splitline) == 2: self.httpheaders[splitline[0].lower()] = splitline[1] self.requesthandler.pygopherd_http_slurped = self.httpheaders def handle(self): self.canhandlerequest() # To get self.requestparts self.iconmapping = eval(self.config.get("protocols.http.HTTPProtocol", "iconmapping")) self.headerslurp() splitted = self.requestparts[1].split('?') self.selector = splitted[0] self.selector = urllib.unquote(self.selector) self.selector = self.slashnormalize(self.selector) self.formvals = {} if len(splitted) >= 2: self.formvals = cgi.parse_qs(splitted[1]) if self.formvals.has_key('searchrequest'): self.searchrequest = self.formvals['searchrequest'][0] icon = re.match('/PYGOPHERD-HTTPPROTO-ICONS/(.+)$', self.selector) if icon: iconname = icon.group(1) if icons.has_key(iconname): self.wfile.write("HTTP/1.0 200 OK\r\n") self.wfile.write("Last-Modified: Fri, 14 Dec 2001 21:19:47 GMT\r\n") self.wfile.write("Content-Type: image/gif\r\n\r\n") if self.requestparts[0] == 'HEAD': return self.wfile.write(binascii.unhexlify(icons[iconname])) return try: handler = self.gethandler() self.log(handler) self.entry = handler.getentry() handler.prepare() self.wfile.write("HTTP/1.0 200 OK\r\n") if self.entry.getmtime() != None: gmtime = time.gmtime(self.entry.getmtime()) mtime = time.strftime("%a, %d %b %Y %H:%M:%S GMT", gmtime) self.wfile.write("Last-Modified: " + mtime + "\r\n") mimetype = self.entry.getmimetype() mimetype = self.adjustmimetype(mimetype) self.wfile.write("Content-Type: " + mimetype + "\r\n\r\n") if self.requestparts[0] == 'GET': if handler.isdir(): self.writedir(self.entry, handler.getdirlist()) else: self.handlerwrite(self.wfile) except GopherExceptions.FileNotFound, e: self.filenotfound(str(e)) except IOError, e: GopherExceptions.log(e, self, None) self.filenotfound(e[1]) def handlerwrite(self, wfile): self.handler.write(wfile) def adjustmimetype(self, mimetype): if mimetype == None: return 'text/plain' if mimetype == 'application/gopher-menu': return 'text/html' return mimetype def renderobjinfo(self, entry): url = None # Decision time.... if re.match('(/|)URL:', entry.getselector()): # It's a plain URL. Make it that. url = re.match('(/|)URL:(.+)$', entry.getselector()).group(2) elif (not entry.gethost()) and (not entry.getport()): # It's a link to our own server. Make it as such. (relative) url = urllib.quote(entry.getselector()) else: # Link to a different server. Make it a gopher URL. url = entry.geturl(self.server.server_name, 70) # OK. Render. return self.getrenderstr(entry, url) def getrenderstr(self, entry, url): retstr = '<TR><TD>' retstr += self.getimgtag(entry) retstr += "</TD>\n<TD>&nbsp;" if entry.gettype() != 'i' and entry.gettype() != '7': retstr += '<A HREF="%s">' % url retstr += "<TT>" if entry.getname() != None: retstr += cgi.escape(entry.getname()).replace(" ", " &nbsp;") else: retstr += cgi.escape(entry.getselector()).replace(" ", " &nbsp;") retstr += "</TT>" if entry.gettype() != 'i' and entry.gettype() != '7': retstr += '</A>' if (entry.gettype() == '7'): retstr += '<BR><FORM METHOD="GET" ACTION="%s">' % url retstr += '<INPUT TYPE="text" NAME="searchrequest" SIZE="30">' retstr += '<INPUT TYPE="submit" NAME="Submit" VALUE="Submit">' retstr += '</FORM>' retstr += '</TD><TD><FONT SIZE="-2">' if entry.getmimetype(): subtype = re.search('/.+$', entry.getmimetype()) if subtype: retstr += cgi.escape(subtype.group()[1:]) retstr += '</FONT></TD></TR>\n' return retstr def renderdirstart(self, entry): retstr ='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">' retstr += "\n<HTML><HEAD><TITLE>Gopher" if self.entry.getname(): retstr += ": " + cgi.escape(self.entry.getname()) retstr += "</TITLE></HEAD><BODY>" if self.config.has_option("protocols.http.HTTPProtocol", "pagetopper"): retstr += re.sub('GOPHERURL', self.entry.geturl(self.server.server_name, self.server.server_port), self.config.get("protocols.http.HTTPProtocol", "pagetopper")) retstr += "<H1>Gopher" if self.entry.getname(): retstr += ": " + cgi.escape(self.entry.getname()) retstr += '</H1><TABLE WIDTH="100%" CELLSPACING="1" CELLPADDING="0">' return retstr def renderdirend(self, entry): retstr = "</TABLE><HR>\n[<A HREF=\"/\">server top</A>]" retstr += " [<A HREF=\"%s\">view with gopher</A>]" % \ entry.geturl(self.server.server_name, self.server.server_port) retstr += '<BR>Generated by <A HREF="%s">%s</A>' % ( pygopherd.version.homepage, pygopherd.version.productname) return retstr + "\n</BODY></HTML>\n" def filenotfound(self, msg): self.wfile.write("HTTP/1.0 404 Not Found\r\n") self.wfile.write("Content-Type: text/html\r\n\r\n") self.wfile.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">') self.wfile.write("""\n<HTML><HEAD><TITLE>Selector Not Found</TITLE> <H1>Selector Not Found</H1> <TT>""") self.wfile.write(cgi.escape(msg)) self.wfile.write("</TT><HR>Pygopherd</BODY></HTML>\n") def getimgtag(self, entry): name = 'generic.gif' if self.iconmapping.has_key(entry.gettype()): name = self.iconmapping[entry.gettype()] return '<IMG ALT=" * " SRC="%s" WIDTH="20" HEIGHT="22" BORDER="0">' % \ ('/PYGOPHERD-HTTPPROTO-ICONS/' + name) icons = { 'binary.gif': '47494638396114001600c20000ffffffccffffcccccc99999933333300000000000000000021fe4e546869732061727420697320696e20746865207075626c696320646f6d61696e2e204b6576696e204875676865732c206b6576696e68406569742e636f6d2c2053657074656d62657220313939350021f90401000001002c000000001400160000036948babcf1301040ab9d24be590a105d210013a9715e07a8a509a16beab5ae14df6a41e8fc76839d5168e8b3182983e4a0e0038a6e1525d396931d97be2ad482a55a55c6eec429f484a7b4e339eb215fd138ebda1b7fb3eb73983bafee8b094a8182493b114387885309003b', 'binhex.gif': '47494638396114001600c20000ffffffccffff99999966666633333300000000000000000021fe4e546869732061727420697320696e20746865207075626c696320646f6d61696e2e204b6576696e204875676865732c206b6576696e68406569742e636f6d2c2053657074656d62657220313939350021f90401000001002c000000001400160000036948babcf1301040ab9d24be59baefc0146adce78555068914985e2b609e0551df9b3c17ba995b408a602828e48a2681856894f44cc1628e07a42e9b985d14ab1b7c9440a9131c0c733b229bb5222ecdb6bfd6da3cd5d29d688a1aee2c97db044482834336113b884d09003b', 'folder.gif': '47494638396114001600c20000ffffffffcc99ccffff99663333333300000000000000000021fe4e546869732061727420697320696e20746865207075626c696320646f6d61696e2e204b6576696e204875676865732c206b6576696e68406569742e636f6d2c2053657074656d62657220313939350021f90401000002002c000000001400160000035428badcfe30ca4959b9f8ce12baef45c47d64a629c5407a6a8906432cc72b1c8ef51a13579e0f3c9c8f05ec0d4945e171673cb2824e2234da495261569856c5ddc27882d46c3c2680c3e6b47acd232c4cf08c3b01003b', 'image3.gif': '47494638396114001600e30000ffffffff3333ccffff9999996600003333330099cc00993300336600000000000000000000000000000000000000000021fe4e546869732061727420697320696e20746865207075626c696320646f6d61696e2e204b6576696e204875676865732c206b6576696e68406569742e636f6d2c2053657074656d62657220313939350021f90401000002002c0000000014001600000479b0c849a7b85814c0bbdf45766d5e49861959762a3a76442c132ae0aa44a0ef49d1ff2f4e6ea74b188f892020c70c3007d04152b3aa46a7adcaa42355160ee0f041d5a572bee23017cb1abbbf6476d52a0720ee78fc5a8930f8ff06087b66768080832a7d8a81818873744a8f8805519596503e19489b9c5311003b', 'sound1.gif': '47494638396114001600c20000ffffffff3333ccffffcccccc99999966000033333300000021fe4e546869732061727420697320696e20746865207075626c696320646f6d61696e2e204b6576696e204875676865732c206b6576696e68406569742e636f6d2c2053657074656d62657220313939350021f90401000002002c000000001400160000036b28badcfe3036c34290ea1c61558f07b171170985c0687e0d9a729e77693401dc5bd7154148fcb6db6b77e1b984c20d4fb03406913866717a842aa7d22af22acd120cdf6fd2d49cd10e034354871518de06b43a17334de42a36243e187d4a7b1a762c7b140b8418898a0b09003b', 'text.gif': '47494638396114001600c20000ffffffccffff99999933333300000000000000000000000021fe4e546869732061727420697320696e20746865207075626c696320646f6d61696e2e204b6576696e204875676865732c206b6576696e68406569742e636f6d2c2053657074656d62657220313939350021f90401000001002c000000001400160000035838babcf1300c40ab9d23be693bcf11d75522b88dd7057144eb52c410cf270abb6e8db796e00b849aadf20b4a6ebb1705281c128daca412c03c3a7b50a4f4d9bc5645dae9f78aed6e975932baebfc0e7ef0b84f1691da8d09003b', 'generic.gif': '47494638396114001600c20000ffffffccffff99999933333300000000000000000000000021fe4e546869732061727420697320696e20746865207075626c696320646f6d61696e2e204b6576696e204875676865732c206b6576696e68406569742e636f6d2c2053657074656d62657220313939350021f90401000001002c000000001400160000035038babcf1300c40ab9d23be693bcf11d75522b88dd705892831b8f08952446d13f24c09bc804b3a4befc70a027c39e391a8ac2081cd65d2f82c06ab5129b4898d76b94c2f71d02b9b79afc86dcdfe2500003b', 'blank.gif': '47494638396114001600a10000ffffffccffff00000000000021fe4e546869732061727420697320696e20746865207075626c696320646f6d61696e2e204b6576696e204875676865732c206b6576696e68406569742e636f6d2c2053657074656d62657220313939350021f90401000001002c00000000140016000002138c8fa9cbed0fa39cb4da8bb3debcfb0f864901003b'}
mas90/pygopherd
pygopherd/protocols/http.py
Python
gpl-2.0
12,731
[ 30522, 1001, 1052, 2100, 3995, 27921, 2094, 1011, 1011, 2175, 27921, 1011, 2241, 8778, 8241, 1999, 18750, 1001, 11336, 1024, 3710, 2039, 2175, 27921, 23058, 3081, 8299, 1001, 1002, 8909, 1024, 8299, 1012, 1052, 2100, 1010, 1058, 1015, 1012,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# Leptosphaeria capparicola Mundk. & S. Ahmad SPECIES #### Status ACCEPTED #### According to Index Fungorum #### Published in Mycol. Pap. 18: 4 (1946) #### Original name Leptosphaeria capparicola Mundk. & S. Ahmad ### Remarks null
mdoering/backbone
life/Fungi/Ascomycota/Dothideomycetes/Pleosporales/Leptosphaeriaceae/Leptosphaeria/Leptosphaeria capparicola/README.md
Markdown
apache-2.0
235
[ 30522, 1001, 3393, 13876, 2891, 21890, 11610, 6178, 19362, 11261, 2721, 14163, 4859, 2243, 1012, 1004, 1055, 1012, 10781, 2427, 1001, 1001, 1001, 1001, 3570, 3970, 30524, 2429, 2000, 5950, 4569, 20255, 2819, 1001, 1001, 1001, 1001, 2405, 19...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2014-2016 Alberto Gacías <alberto@migasfree.org> # Copyright (c) 2015-2016 Jose Antonio Chavarría <jachavar@gmail.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. import gettext _ = gettext.gettext from gi.repository import Gtk class Console(Gtk.Window): def __init__(self): super(Console, self).__init__() sw = Gtk.ScrolledWindow() sw.set_policy( Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC ) self.textview = Gtk.TextView() self.textbuffer = self.textview.get_buffer() self.textview.set_editable(False) self.textview.set_wrap_mode(Gtk.WrapMode.WORD) sw.add(self.textview) self.set_title(_('Migasfree Console')) self.set_icon_name('migasfree') self.resize(640, 420) self.set_decorated(True) self.set_border_width(10) self.connect('delete-event', self.on_click_hide) box = Gtk.Box(spacing=6, orientation='vertical') box.pack_start(sw, expand=True, fill=True, padding=0) self.progress = Gtk.ProgressBar() self.progress.set_pulse_step(0.02) progress_box = Gtk.Box(False, 0, orientation='vertical') progress_box.pack_start(self.progress, False, True, 0) box.pack_start(progress_box, expand=False, fill=True, padding=0) self.add(box) def on_timeout(self, user_data): self.progress.pulse() return True def on_click_hide(self, widget, data=None): self.hide() return True
migasfree/migasfree-launcher
migasfree_indicator/console.py
Python
gpl-3.0
2,190
[ 30522, 1001, 999, 1013, 2149, 2099, 1013, 8026, 1013, 4372, 2615, 18750, 1001, 1011, 1008, 1011, 16861, 1024, 21183, 2546, 1011, 1022, 1011, 1008, 1011, 1001, 9385, 1006, 1039, 1007, 2297, 1011, 2355, 12007, 11721, 7405, 2015, 1026, 12007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
namespace Maticsoft.TaoBao.Domain { using Maticsoft.TaoBao; using System; using System.Runtime.CompilerServices; using System.Xml.Serialization; [Serializable] public class ADGroupCatMatchForecast : TopObject { [XmlElement("adgroup_id")] public long AdgroupId { get; set; } [XmlElement("catmatch_id")] public long CatmatchId { get; set; } [XmlElement("nick")] public string Nick { get; set; } [XmlElement("price_click")] public string PriceClick { get; set; } [XmlElement("price_cust")] public string PriceCust { get; set; } [XmlElement("price_rank")] public string PriceRank { get; set; } } }
51zhaoshi/myyyyshop
Maticsoft.TaoBao_Source/Maticsoft.TaoBao.Domain/ADGroupCatMatchForecast.cs
C#
gpl-3.0
729
[ 30522, 3415, 15327, 13523, 6558, 15794, 1012, 20216, 3676, 2080, 1012, 5884, 1063, 2478, 13523, 6558, 15794, 1012, 20216, 3676, 2080, 1025, 2478, 2291, 1025, 2478, 2291, 1012, 2448, 7292, 1012, 21624, 8043, 7903, 2229, 1025, 2478, 2291, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
'use strict'; /** * NetSuite Records * @return {Records} */ var Records = module.exports = {}; Records.RecordRef = require('./recordRef');
CrossLead/netsuite-js
lib/netsuite/records/index.js
JavaScript
apache-2.0
144
[ 30522, 1005, 2224, 9384, 1005, 1025, 1013, 1008, 1008, 1008, 16996, 14663, 2063, 2636, 1008, 1030, 2709, 1063, 2636, 1065, 1008, 1013, 13075, 2636, 1027, 11336, 1012, 14338, 1027, 1063, 1065, 1025, 2636, 1012, 2501, 2890, 2546, 1027, 5478, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
--- title: Remove Items Using splice() localeTitle: Удаление элементов с помощью splice () --- ## Удаление элементов с помощью splice () * Функция `splice()` должна быть вызвана в массиве `arr` , чтобы удалить 1 или более элементов из центра массива. * Массив `arr` настоящее время добавляет значение 16. Просто удалите столько переменных, сколько необходимо для возврата 10. ## Решение: ```javascript function sumOfTen(arr) { // change code below this line arr.splice(1,2); // change code above this line return arr.reduce((a, b) => a + b); } // do not change code below this line console.log(sumOfTen([2, 5, 1, 5, 2, 1])); ```
otavioarc/freeCodeCamp
guide/russian/certifications/javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice/index.md
Markdown
bsd-3-clause
885
[ 30522, 1011, 1011, 1011, 2516, 1024, 6366, 5167, 2478, 11867, 13231, 1006, 1007, 2334, 20624, 9286, 1024, 1198, 29742, 10260, 29436, 15290, 18947, 10325, 15290, 1208, 29436, 15290, 29745, 15290, 18947, 22919, 19259, 1196, 1194, 14150, 29745, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package com.google.api.ads.adwords.jaxws.v201509.cm; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; /** * * Represents a ZIP archive media the content of which contains HTML5 assets. * * * <p>Java class for MediaBundle complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="MediaBundle"> * &lt;complexContent> * &lt;extension base="{https://adwords.google.com/api/adwords/cm/v201509}Media"> * &lt;sequence> * &lt;element name="data" type="{http://www.w3.org/2001/XMLSchema}base64Binary" minOccurs="0"/> * &lt;element name="mediaBundleUrl" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="entryPoint" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;/sequence> * &lt;/extension> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "MediaBundle", propOrder = { "data", "mediaBundleUrl", "entryPoint" }) public class MediaBundle extends Media { protected byte[] data; protected String mediaBundleUrl; protected String entryPoint; /** * Gets the value of the data property. * * @return * possible object is * byte[] */ public byte[] getData() { return data; } /** * Sets the value of the data property. * * @param value * allowed object is * byte[] */ public void setData(byte[] value) { this.data = value; } /** * Gets the value of the mediaBundleUrl property. * * @return * possible object is * {@link String } * */ public String getMediaBundleUrl() { return mediaBundleUrl; } /** * Sets the value of the mediaBundleUrl property. * * @param value * allowed object is * {@link String } * */ public void setMediaBundleUrl(String value) { this.mediaBundleUrl = value; } /** * Gets the value of the entryPoint property. * * @return * possible object is * {@link String } * */ public String getEntryPoint() { return entryPoint; } /** * Sets the value of the entryPoint property. * * @param value * allowed object is * {@link String } * */ public void setEntryPoint(String value) { this.entryPoint = value; } }
gawkermedia/googleads-java-lib
modules/adwords_appengine/src/main/java/com/google/api/ads/adwords/jaxws/v201509/cm/MediaBundle.java
Java
apache-2.0
2,738
[ 30522, 7427, 4012, 1012, 8224, 1012, 17928, 1012, 14997, 1012, 4748, 22104, 1012, 13118, 9333, 1012, 1058, 11387, 16068, 2692, 2683, 1012, 4642, 1025, 12324, 9262, 2595, 1012, 20950, 1012, 14187, 1012, 5754, 17287, 3508, 1012, 20950, 6305, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
name 'meteor' maintainer 'Logan Koester' maintainer_email 'logan@logankoester.com' license 'MIT' description 'Install the Meteor JavaScript App Platform' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) version '0.1.3'
logankoester/chef-meteor
metadata.rb
Ruby
mit
243
[ 30522, 2171, 1005, 23879, 1005, 5441, 2121, 1005, 6307, 12849, 20367, 1005, 5441, 2121, 1035, 10373, 1005, 6307, 1030, 6307, 3683, 20367, 1012, 4012, 1005, 6105, 1005, 10210, 1005, 6412, 1005, 16500, 1996, 23879, 9262, 22483, 10439, 4132, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# Alectoria arctica Elenkin & Savicz SPECIES #### Status ACCEPTED #### According to Index Fungorum #### Published in null #### Original name Alectoria arctica Elenkin & Savicz ### Remarks null
mdoering/backbone
life/Fungi/Ascomycota/Lecanoromycetes/Lecanorales/Parmeliaceae/Alectoria/Alectoria arctica/README.md
Markdown
apache-2.0
197
[ 30522, 1001, 9752, 29469, 2050, 10162, 2050, 3449, 2368, 4939, 1004, 7842, 7903, 2480, 2427, 1001, 1001, 1001, 1001, 3570, 3970, 1001, 1001, 1001, 1001, 2429, 2000, 5950, 4569, 20255, 2819, 1001, 30524, 2368, 4939, 1004, 7842, 7903, 2480, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>18 --> 19</title> <link href="./../../assets/style.css" rel="stylesheet"> </head> <body> <h2>You have to be fast</h2> <a href="./2b5f93a28da57c59660ea21518d5a108aa1daebc9cc8bd38ad54b26380e4ea1e.html">Teleport</a> <hr> <a href="./../../about.md">About</a> (Spoilers! ) <script src="./../../assets/md5.js"></script> <script> window.currentLevel = 7; </script> <script src="./../../assets/script.js"></script> </body> </html>
simonmysun/praxis
TAIHAO2019/pub/SmallGame/AsFastAsYouCan2/2be32cdb9b1303cdf0ce21a15a88b85cc37a1e5741db7e58e6dac8a19820b9e0.html
HTML
mit
550
[ 30522, 1026, 999, 9986, 13874, 16129, 1028, 1026, 16129, 11374, 1027, 1000, 4372, 1000, 1028, 1026, 2132, 1028, 1026, 18804, 25869, 13462, 1027, 1000, 21183, 2546, 1011, 1022, 1000, 1028, 1026, 2516, 1028, 2324, 1011, 1011, 1028, 2539, 1026...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
import CalendarDayNamesHeader from "../base/CalendarDayNamesHeader.js"; import { template } from "../base/internal.js"; import { fragmentFrom } from "../core/htmlLiterals.js"; /** * CalendarDayNamesHeader component in the Plain reference design system * * @inherits CalendarDayNamesHeader */ class PlainCalendarDayNamesHeader extends CalendarDayNamesHeader { get [template]() { const result = super[template]; result.content.append( fragmentFrom.html` <style> :host { font-size: smaller; } [part~="day-name"] { padding: 0.3em; text-align: center; white-space: nowrap; } [weekend] { color: gray; } </style> ` ); return result; } } export default PlainCalendarDayNamesHeader;
JanMiksovsky/elix
src/plain/PlainCalendarDayNamesHeader.js
JavaScript
mit
850
[ 30522, 12324, 8094, 10259, 18442, 4095, 13775, 2121, 2013, 1000, 1012, 1012, 1013, 2918, 1013, 8094, 10259, 18442, 4095, 13775, 2121, 1012, 1046, 2015, 1000, 1025, 12324, 1063, 23561, 1065, 2013, 1000, 1012, 1012, 1013, 2918, 1013, 4722, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# {{ .Spec.Name }} {{ .Spec.Description -}} {{- with .Hints }} {{ . }} {{ end }} {{- with .Spec.Credits -}} ## Source {{ . }} {{ end }} ## Submitting Incomplete Solutions It's possible to submit an incomplete solution so you can see how others have completed the exercise.
exercism/xhaxe
exercises/shared/.docs/tests.md
Markdown
mit
275
[ 30522, 1001, 1063, 1063, 1012, 28699, 1012, 2171, 1065, 1065, 1063, 1063, 1012, 28699, 1012, 6412, 1011, 1065, 1065, 1063, 1063, 1011, 2007, 1012, 20385, 1065, 1065, 1063, 1063, 1012, 1065, 1065, 1063, 1063, 2203, 1065, 1065, 1063, 1063, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
(function (global, factory) { if (typeof define === 'function' && define.amd) { define(['exports', 'module', 'skatejs'], factory); } else if (typeof exports !== 'undefined' && typeof module !== 'undefined') { factory(exports, module, require('skatejs')); } else { var mod = { exports: {} }; factory(mod.exports, mod, global.skate); global.skate = mod.exports; } })(this, function (exports, module, _skatejs) { 'use strict'; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _skate = _interopRequireDefault(_skatejs); var auiSkate = _skate['default'].noConflict(); module.exports = auiSkate; }); //# sourceMappingURL=../../../js/aui/internal/skate.js.map
parambirs/aui-demos
node_modules/@atlassian/aui/lib/js/aui/internal/skate.js
JavaScript
mit
757
[ 30522, 1006, 3853, 1006, 3795, 1010, 4713, 1007, 1063, 2065, 1006, 2828, 11253, 9375, 1027, 1027, 1027, 1005, 3853, 1005, 1004, 1004, 9375, 1012, 2572, 2094, 1007, 1063, 9375, 1006, 1031, 1005, 14338, 1005, 1010, 1005, 11336, 1005, 1010, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!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> <title>jQuery MiniUI - 专业WebUI控件库</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <meta name="keywords" content="jquery,web,grid,表格,datagrid,js,javascript,ajax,web开发,tree,table" /> <meta name="description" content="jQuery MiniUI - 专业WebUI控件库。它能缩短开发时间,减少代码量,使开发者更专注于业务和服务端,轻松实现界面开发,带来绝佳的用户体验。" /> <link href="../core.css" rel="stylesheet" type="text/css" /> <link href="common.css" rel="stylesheet" type="text/css" /> </head> <body> <div class="header"> <div class="headerInner"> <a class="logo" href="http://www.miniui.com" title="jQuery MiniUI - 专业WebUI控件库">jQuery MiniUI</a> <a id="why" href="/why">为什么选择MiniUI?</a> <ul class="topmenu"> <li><a href="/"><span>首页</span></a></li> <li onmouseover="showMenu('popup1', this)" onmouseout="hideMenu('popup1', this)"><a href="/product"><span>产品</span></a> <ul id="popup1" class="popupmenu"> <li class="product"><a href="/product">产品介绍</a></li> <li><a href="/features">功能特性</a></li> <li><a href="/screenshots">界面截图</a></li> <li><a href="/support">支持服务</a></li> <li><a href="/license">授权方式</a></li> <li class="faq"><a href="/faq">常见问题</a></li> </ul> </li> <li><a href="/demo"><span>示例</span></a></li> <li onmouseover="showMenu('popup2', this)" onmouseout="hideMenu('popup2', this)"><a href="/docs"><span>文档</span></a> <ul id="popup2" class="popupmenu"> <li id="start_link"><a href="/docs/quickstart">快速入门</a></li> <li><a href="/docs/tutorial">开发教程</a></li> <li id="kb_link"><a href="/docs/kb">精华文章</a></li> <li><a href="/docs/api">Api参考手册</a></li> </ul> </li> <li><a href="/bbs"><span>论坛</span></a></li><li><a href="/download"><span>下载</span></a></li> <li><a href="/contact"><span>联系</span></a></li> </ul> </div> </div> <div class="topnav"> <div class="topnavInner"> <a href="/">首页</a>><a href="/docs">文档中心</a>><a href="/docs/tutorial">开发教程</a>><span>表单控件</span> </div> </div> <div class="body " > <div class="bodyInner"> <div class="contentView"> <h3>TextBox:文本输入框</h3> <a title="TextBox 文本输入框" href="../../demo/textbox/textbox.html" target="_blank"><img src="../api/images/textbox.gif"/></a> <br /><br /> <p class="p_demo"><span class="note">参考示例</span>:<a href="../../demo/textbox/textbox.html" target="_blank">TextBox:文本输入框</a></p> <br /> <h4>创建代码</h4> <pre class="code"> 单行输入框:<span style="color:blue">&lt;</span><span style="color:maroon">input </span><span style="color:red">class</span><span style="color:blue">="mini-textbox" </span><span style="color:red">value</span><span style="color:blue">="0" /&gt; &lt;</span><span style="color:maroon">br </span><span style="color:blue">/&gt;&lt;</span><span style="color:maroon">br </span><span style="color:blue">/&gt; </span>密码输入框:<span style="color:blue">&lt;</span><span style="color:maroon">input </span><span style="color:red">class</span><span style="color:blue">="mini-password" </span><span style="color:red">value</span><span style="color:blue">="12345" /&gt; &lt;</span><span style="color:maroon">br </span><span style="color:blue">/&gt;&lt;</span><span style="color:maroon">br </span><span style="color:blue">/&gt; </span>多行输入框:<span style="color:blue">&lt;</span><span style="color:maroon">input </span><span style="color:red">class</span><span style="color:blue">="mini-textarea" </span><span style="color:red">value</span><span style="color:blue">="中国" /&gt; &lt;</span><span style="color:maroon">br </span><span style="color:blue">/&gt; </span></pre> </div> </div> </div> <div class="footer"> <div class="footerInner"> <div id="copyright">Copyright © 上海普加软件有限公司版权所有 </div> <div id="bottomlinks"><a href="/sitemap">网站导航</a>|<a href="/support">支持服务</a>|<a href="/license">授权方式</a>|<a href="/contact">联系我们</a></div> </div> </div> </body> </html>
hemingwang0902/jquery-miniui
src/main/webapp/docs/tutorial/textbox.html
HTML
apache-2.0
5,214
[ 30522, 1026, 999, 9986, 13874, 16129, 2270, 1000, 1011, 1013, 1013, 1059, 2509, 2278, 1013, 1013, 26718, 2094, 1060, 11039, 19968, 1015, 1012, 1014, 17459, 1013, 1013, 4372, 1000, 1000, 8299, 1024, 1013, 1013, 7479, 1012, 1059, 2509, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
using System; using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Net; using Vita.Entities; using BookStore; using BookStore.Api; using System.Threading.Tasks; using Vita.Tools.Testing; using Arrest; using Arrest.Sync; namespace Vita.Testing.WebTests { public partial class BooksApiTests { // Tests special methods in controller [TestMethod] public void TestSpecialMethods() { var client = Startup.Client; Logout(); // just in case there's still session there from other tests //Test values handling in URL var gd = new Guid("729C7EA4-F3C5-11E4-88C8-F0DEF1783701"); var foo = client.Get<string>("api/special/foo/{0}/{1}", 1, gd); //foo/(int)/(guid) Assert.AreEqual("Foo:1," + gd, foo); // 'bars' method requires login var exc = TestUtil.ExpectFailWith<RestException>(() => client.Get<string>("api/special/bars?q=Q")); Assert.AreEqual(HttpStatusCode.Unauthorized, exc.Status, "Expected Unauthorized"); LoginAs("Dora"); var bars = client.Get<string>("api/special/bars?q=Q"); Assert.AreEqual("bars:Q", bars); Logout(); // Call getBook with bad book id - will return NotFound custom code - // it is done on purpose by controller, instead of simply returning null var apiExc = TestUtil.ExpectFailWith<RestException>(() => client.Get<Book>("api/special/books/{0}", Guid.NewGuid())); Assert.AreEqual(HttpStatusCode.NotFound, apiExc.Status, "Expected NotFound status"); //Test redirect; when we create WebApiClient in SetupHelper, we set: Client.InnerHandler.AllowRedirect = false; so it will bring error on redirect apiExc = TestUtil.ExpectFailWith<RestException>(() => client.Get<HttpStatusCode>("api/special/redirect")); Assert.AreEqual(HttpStatusCode.Redirect, apiExc.Status, "Expected redirect status"); } [TestMethod] public void TestDiagnosticsController() { var client = Startup.Client; var acceptText = "application/text,text/plain"; //Heartbeat DiagnosticsController.Reset(); var serverStatus = client.GetString("api/diagnostics/heartbeat", null, acceptText); Assert.AreEqual("StatusOK", serverStatus, "Expected StatusOK in heartbeat"); // throw error DiagnosticsController.Reset(); var exc = TestUtil.ExpectFailWith<Exception>(() => client.GetString("api/diagnostics/throwerror", null, acceptText)); Assert.IsTrue(exc.Message.Contains("TestException"), "Expected TestException thrown"); //get/set time offset // current should be zero var currOffset = client.GetString("api/diagnostics/timeoffset", null, acceptText); Assert.IsTrue(currOffset.StartsWith("Current offset: 0 minutes"), "Expected no offset"); // set 60 minutes forward currOffset = client.GetString("api/diagnostics/timeoffset/60", null, acceptText); Assert.IsTrue(currOffset.StartsWith("Current offset: 60 minutes"), "Expected 60 minutes offset"); // set back to 0 currOffset = client.GetString("api/diagnostics/timeoffset/0", null, acceptText); Assert.IsTrue(currOffset.StartsWith("Current offset: 0 minutes"), "Expected no offset"); /* //test that heartbeat call is not logged in web log - controller method sets log level to None var serverSession = TestStartup.BooksApp.OpenSession(); // fix this var hbeatEntry = serverSession.EntitySet<IWebCallLog>().Where(wl => wl.Url.Contains("heartbeat")).FirstOrDefault(); Assert.IsNull(hbeatEntry, "Expected no heartbeat entry in web log."); */ } // Tests KeepOpen connection mode (default for web controllers). In this mode, the connection to database is kept alive in entity session between db calls, // to avoid extra work on acquiring connection from pool, and on making 'reset connection' roundtrip to db (done by connection pool when it gives connection from the pool) // Web call is usually very quick, so it's reasonable to hold on to open connection until the end. If the connection is not closed explicitly // by controller method, it is closed automatically by Web call handler (conn is registered in OperationContext.Disposables). // The following test verifies this behavior. We make a test call which executes a simple query to database, // then checks that connection is still alive and open (saved in session.CurrentConnection). // Then it sets up an event handler that would register the conn.Close call (conn.StateChanged event) which will happen when Web call completes; // the handler saves a 'report' in a static field in controller. // We then retrieve this report thru second call and verify that connection was in fact closed properly. [TestMethod] public void TestDbConnectionHandling() { var client = Startup.Client; var ok = client.Get<string>("api/special/connectiontest"); Assert.AreEqual("OK", ok, "Connection test did not return OK"); //get report var report = client.Get<string>("api/special/connectiontestreport"); // values: State is closed, DataConnection.Close was called, WebCallContextHandler.PostProcessResponse was called Assert.AreEqual("True,True,True", report, "Connection report does not match expected value"); } }//class }
rivantsov/vita
src/6.UnitTests/Vita.Testing.WebTests/BooksApiTests_SpecialCases.cs
C#
mit
5,352
[ 30522, 2478, 2291, 1025, 2478, 2291, 1012, 11409, 4160, 1025, 2478, 7513, 1012, 26749, 8525, 20617, 1012, 3231, 3406, 27896, 1012, 3131, 22199, 2075, 1025, 2478, 2291, 1012, 5658, 1025, 2478, 19300, 1012, 11422, 1025, 2478, 21785, 1025, 247...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
//===- WriterUtils.cpp ----------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "WriterUtils.h" #include "lld/Common/ErrorHandler.h" #include "llvm/Support/Debug.h" #include "llvm/Support/EndianStream.h" #include "llvm/Support/LEB128.h" #define DEBUG_TYPE "lld" using namespace llvm; using namespace llvm::wasm; namespace lld { std::string toString(ValType type) { switch (type) { case ValType::I32: return "i32"; case ValType::I64: return "i64"; case ValType::F32: return "f32"; case ValType::F64: return "f64"; case ValType::V128: return "v128"; case ValType::EXNREF: return "exnref"; case ValType::EXTERNREF: return "externref"; } llvm_unreachable("Invalid wasm::ValType"); } std::string toString(const WasmSignature &sig) { SmallString<128> s("("); for (ValType type : sig.Params) { if (s.size() != 1) s += ", "; s += toString(type); } s += ") -> "; if (sig.Returns.empty()) s += "void"; else s += toString(sig.Returns[0]); return std::string(s.str()); } std::string toString(const WasmGlobalType &type) { return (type.Mutable ? "var " : "const ") + toString(static_cast<ValType>(type.Type)); } std::string toString(const WasmEventType &type) { if (type.Attribute == WASM_EVENT_ATTRIBUTE_EXCEPTION) return "exception"; return "unknown"; } namespace wasm { void debugWrite(uint64_t offset, const Twine &msg) { LLVM_DEBUG(dbgs() << format(" | %08lld: ", offset) << msg << "\n"); } void writeUleb128(raw_ostream &os, uint64_t number, const Twine &msg) { debugWrite(os.tell(), msg + "[" + utohexstr(number) + "]"); encodeULEB128(number, os); } void writeSleb128(raw_ostream &os, int64_t number, const Twine &msg) { debugWrite(os.tell(), msg + "[" + utohexstr(number) + "]"); encodeSLEB128(number, os); } void writeBytes(raw_ostream &os, const char *bytes, size_t count, const Twine &msg) { debugWrite(os.tell(), msg + " [data[" + Twine(count) + "]]"); os.write(bytes, count); } void writeStr(raw_ostream &os, StringRef string, const Twine &msg) { debugWrite(os.tell(), msg + " [str[" + Twine(string.size()) + "]: " + string + "]"); encodeULEB128(string.size(), os); os.write(string.data(), string.size()); } void writeU8(raw_ostream &os, uint8_t byte, const Twine &msg) { debugWrite(os.tell(), msg + " [0x" + utohexstr(byte) + "]"); os << byte; } void writeU32(raw_ostream &os, uint32_t number, const Twine &msg) { debugWrite(os.tell(), msg + "[0x" + utohexstr(number) + "]"); support::endian::write(os, number, support::little); } void writeU64(raw_ostream &os, uint64_t number, const Twine &msg) { debugWrite(os.tell(), msg + "[0x" + utohexstr(number) + "]"); support::endian::write(os, number, support::little); } void writeValueType(raw_ostream &os, ValType type, const Twine &msg) { writeU8(os, static_cast<uint8_t>(type), msg + "[type: " + toString(type) + "]"); } void writeSig(raw_ostream &os, const WasmSignature &sig) { writeU8(os, WASM_TYPE_FUNC, "signature type"); writeUleb128(os, sig.Params.size(), "param Count"); for (ValType paramType : sig.Params) { writeValueType(os, paramType, "param type"); } writeUleb128(os, sig.Returns.size(), "result Count"); for (ValType returnType : sig.Returns) { writeValueType(os, returnType, "result type"); } } void writeI32Const(raw_ostream &os, int32_t number, const Twine &msg) { writeU8(os, WASM_OPCODE_I32_CONST, "i32.const"); writeSleb128(os, number, msg); } void writeI64Const(raw_ostream &os, int64_t number, const Twine &msg) { writeU8(os, WASM_OPCODE_I64_CONST, "i64.const"); writeSleb128(os, number, msg); } void writeMemArg(raw_ostream &os, uint32_t alignment, uint64_t offset) { writeUleb128(os, alignment, "alignment"); writeUleb128(os, offset, "offset"); } void writeInitExpr(raw_ostream &os, const WasmInitExpr &initExpr) { writeU8(os, initExpr.Opcode, "opcode"); switch (initExpr.Opcode) { case WASM_OPCODE_I32_CONST: writeSleb128(os, initExpr.Value.Int32, "literal (i32)"); break; case WASM_OPCODE_I64_CONST: writeSleb128(os, initExpr.Value.Int64, "literal (i64)"); break; case WASM_OPCODE_F32_CONST: writeU32(os, initExpr.Value.Float32, "literal (f32)"); break; case WASM_OPCODE_F64_CONST: writeU64(os, initExpr.Value.Float64, "literal (f64)"); break; case WASM_OPCODE_GLOBAL_GET: writeUleb128(os, initExpr.Value.Global, "literal (global index)"); break; case WASM_OPCODE_REF_NULL: writeValueType(os, ValType::EXTERNREF, "literal (externref type)"); break; default: fatal("unknown opcode in init expr: " + Twine(initExpr.Opcode)); } writeU8(os, WASM_OPCODE_END, "opcode:end"); } void writeLimits(raw_ostream &os, const WasmLimits &limits) { writeU8(os, limits.Flags, "limits flags"); writeUleb128(os, limits.Initial, "limits initial"); if (limits.Flags & WASM_LIMITS_FLAG_HAS_MAX) writeUleb128(os, limits.Maximum, "limits max"); } void writeGlobalType(raw_ostream &os, const WasmGlobalType &type) { // TODO: Update WasmGlobalType to use ValType and remove this cast. writeValueType(os, ValType(type.Type), "global type"); writeU8(os, type.Mutable, "global mutable"); } void writeGlobal(raw_ostream &os, const WasmGlobal &global) { writeGlobalType(os, global.Type); writeInitExpr(os, global.InitExpr); } void writeEventType(raw_ostream &os, const WasmEventType &type) { writeUleb128(os, type.Attribute, "event attribute"); writeUleb128(os, type.SigIndex, "sig index"); } void writeEvent(raw_ostream &os, const WasmEvent &event) { writeEventType(os, event.Type); } void writeTableType(raw_ostream &os, const llvm::wasm::WasmTable &type) { writeU8(os, WASM_TYPE_FUNCREF, "table type"); writeLimits(os, type.Limits); } void writeImport(raw_ostream &os, const WasmImport &import) { writeStr(os, import.Module, "import module name"); writeStr(os, import.Field, "import field name"); writeU8(os, import.Kind, "import kind"); switch (import.Kind) { case WASM_EXTERNAL_FUNCTION: writeUleb128(os, import.SigIndex, "import sig index"); break; case WASM_EXTERNAL_GLOBAL: writeGlobalType(os, import.Global); break; case WASM_EXTERNAL_EVENT: writeEventType(os, import.Event); break; case WASM_EXTERNAL_MEMORY: writeLimits(os, import.Memory); break; case WASM_EXTERNAL_TABLE: writeTableType(os, import.Table); break; default: fatal("unsupported import type: " + Twine(import.Kind)); } } void writeExport(raw_ostream &os, const WasmExport &export_) { writeStr(os, export_.Name, "export name"); writeU8(os, export_.Kind, "export kind"); switch (export_.Kind) { case WASM_EXTERNAL_FUNCTION: writeUleb128(os, export_.Index, "function index"); break; case WASM_EXTERNAL_GLOBAL: writeUleb128(os, export_.Index, "global index"); break; case WASM_EXTERNAL_EVENT: writeUleb128(os, export_.Index, "event index"); break; case WASM_EXTERNAL_MEMORY: writeUleb128(os, export_.Index, "memory index"); break; case WASM_EXTERNAL_TABLE: writeUleb128(os, export_.Index, "table index"); break; default: fatal("unsupported export type: " + Twine(export_.Kind)); } } } // namespace wasm } // namespace lld
google/llvm-propeller
lld/wasm/WriterUtils.cpp
C++
apache-2.0
7,617
[ 30522, 1013, 1013, 1027, 1027, 1027, 1011, 3213, 21823, 4877, 1012, 18133, 2361, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* ** $Id: lprefix.h,v 1.2 2014/12/29 16:54:13 roberto Exp $ ** Definitions for Lua code that must come before any other header file ** See Copyright Notice in lutf8lib.c */ #ifndef lprefix_h #define lprefix_h /* ** Allows POSIX/XSI stuff */ #if !defined(LUA_USE_C89) /* { */ #if !defined(_XOPEN_SOURCE) #define _XOPEN_SOURCE 600 #elif _XOPEN_SOURCE == 0 #undef _XOPEN_SOURCE /* use -D_XOPEN_SOURCE=0 to undefine it */ #endif /* ** Allows manipulation of large files in gcc and some other compilers */ #if !defined(LUA_32BITS) && !defined(_FILE_OFFSET_BITS) #define _LARGEFILE_SOURCE 1 #define _FILE_OFFSET_BITS 64 #endif #endif /* } */ /* ** Windows stuff */ #if defined(_WIN32) /* { */ #if !defined(_CRT_SECURE_NO_WARNINGS) #define _CRT_SECURE_NO_WARNINGS /* avoid warnings about ISO C functions */ #endif #endif /* } */ #endif
Positive07/lutf8
src/lprefix.h
C
mit
872
[ 30522, 1013, 1008, 1008, 1008, 1002, 8909, 1024, 6948, 2890, 8873, 2595, 1012, 1044, 1010, 1058, 1015, 1012, 1016, 2297, 1013, 2260, 1013, 2756, 2385, 1024, 5139, 1024, 2410, 10704, 4654, 2361, 1002, 1008, 1008, 15182, 2005, 11320, 2050, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/** * @license Copyright 2017 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. */ 'use strict'; /** * Manages drag and drop file input for the page. */ class DragAndDrop { /** * @param {function(!File)} fileHandlerCallback Invoked when the user chooses a new file. */ constructor(fileHandlerCallback) { this._dropZone = document.querySelector('.drop_zone'); this._fileHandlerCallback = fileHandlerCallback; this._dragging = false; this._addListeners(); } _addListeners() { // The mouseleave event is more reliable than dragleave when the user drops // the file outside the window. document.addEventListener('mouseleave', _ => { if (!this._dragging) { return; } this._resetDraggingUI(); }); document.addEventListener('dragover', e => { e.stopPropagation(); e.preventDefault(); e.dataTransfer.dropEffect = 'copy'; // Explicitly show as copy action. }); document.addEventListener('dragenter', _ => { this._dropZone.classList.add('dropping'); this._dragging = true; }); document.addEventListener('drop', e => { e.stopPropagation(); e.preventDefault(); this._resetDraggingUI(); // Note, this ignores multiple files in the drop, only taking the first. this._fileHandlerCallback(e.dataTransfer.files[0]); }); } _resetDraggingUI() { this._dropZone.classList.remove('dropping'); this._dragging = false; } } if (typeof module !== 'undefined' && module.exports) { module.exports = DragAndDrop; }
tkadlec/lighthouse
lighthouse-viewer/app/src/drag-and-drop.js
JavaScript
apache-2.0
2,079
[ 30522, 1013, 1008, 1008, 1008, 1030, 6105, 9385, 2418, 8224, 4297, 1012, 2035, 2916, 9235, 1012, 1008, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 1000, 1007, 1025, 2017, 2089, 2025, 2224, 2023, 53...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
--- title: GitLab is now simple to install date: February 14, 2014 --- GitLab is the most fully featured open source application to manage git repositories. However, historically it was not easy to install and update GitLab. Installing it required copy-pasting commands from a long guide. The guide [actually worked](https://twitter.com/robinvdvleuten/status/424163226532986880) but it was 10 pages long. In spite of this GitLab has become the most popular solution for on premise installations with 50,000 organizations using it. To grow even faster we needed to simplify the update and installations processes. So in GitLab 6.4 we made sure that [upgrading is now only a single command](/2013/12/21/gitlab-ce-6-dot-4-released). Today we can announce that installing GitLab is also greatly simplified. You now have three new options to install GitLab: an official GitLab Chef cookbook, GitLab Packer virtual machines and GitLab Omnibus packages. The [official GitLab Chef cookbook](https://gitlab.com/gitlab-org/cookbook-gitlab/blob/master/README.md) is the most flexible option. It supports both development and production environments and both Ubuntu and RHEL/CentOS operating systems. You can install it with Chef Solo, a Chef server or with Vagrant. It supports MySQL and PostgreSQL databases, both in the same server as external ones. The cookbook is [well tested](https://gitlab.com/gitlab-org/cookbook-gitlab/tree/master/spec) with [ChefSpec](https://github.com/sethvargo/chefspec). For cloud fans there even is [a version that runs on AWS Opsworks](https://gitlab.com/gitlab-com/cookbook-gitlab-opsworks/blob/master/README.md). If you want to quickly spin up a production GitLab server you can also use a virtual machine image with GitLab preinstalled. The [downloads page](https://www.gitlab.com/downloads/) already has an Ubuntu 12.04 image and CentOS 6.5 will come soon. These are made with [Packer](http://www.packer.io/) and [the source code to create your versions](https://gitlab.com/gitlab-org/gitlab-packer/blob/master/README.md) is available. Example configurations for Digital Ocean and AWS are included. These images are created with the official Chef cookbook mentioned earlier. Last but not least are the two GitLab Omnibus packages. A deb package for Ubuntu 12.04 LTS and a RPM package for CentOS 6 can be found on the [downloads page](https://www.gitlab.com/downloads/). These are packages of the GitLab 6.6.0.pre and should not be used on production machines. When GitLab 6.6 is stable we will update the packages and link them in the GitLab readme. Even when stable these packages currently support a reduced selection of GitLab's normal features. It is not yet possible to create/restore application backups or to use HTTPS, for instance. But it is a start and we look forward to improving them together with the rest of the GitLab community. Creating these package has been our dream for a long time. GitLab has a lot of dependencies which means that native packages would require packaging hundreds of gems. To solve this we used [omnibus-ruby](https://github.com/opscode/omnibus-ruby) that Chef Inc. uses to package Chef and Chef Server. Based on [omnibus-chef-server](https://github.com/opscode/omnibus-chef-server) we made [omnibus-gitlab](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md) that you can use to create your own package. So now you can finally install GitLab with: ``` apt-get install -y openssh-server postfix dpkg -i gitlab_6.6.0-pre1.omnibus.2-1.ubuntu.12.04_amd64.deb gitlab-ctl reconfigure ``` Like any active project there are still many way to improve the [GitLab Chef cookbook](https://gitlab.com/gitlab-org/cookbook-gitlab/issues), the [GitLab Packer virtual machines](https://gitlab.com/gitlab-org/gitlab-packer/issues) and [GitLab Omnibus packages](https://gitlab.com/gitlab-org/omnibus-gitlab/issues) so we welcome your help. We would like to thank the awesome GitLab community and the [GitLab subscribers](https://www.gitlab.com/subscription/) for their support. Of course, all previous installation options will continue to be available. Please join the celebration in the comments and let us know if you have any questions.
damianhakert/damianhakert.github.io
source/posts/2014-02-14-gitlab-is-now-simple-to-install.html.md
Markdown
mit
4,211
[ 30522, 1011, 1011, 1011, 2516, 1024, 21025, 19646, 7875, 2003, 2085, 3722, 2000, 16500, 3058, 1024, 2337, 2403, 1010, 2297, 1011, 1011, 1011, 21025, 19646, 7875, 2003, 1996, 2087, 3929, 2956, 2330, 3120, 4646, 2000, 6133, 21025, 2102, 16360...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#### NOTICE: THIS FILE IS AUTOGENERATED #### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY #### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES from swgpy.object import * def create(kernel): result = Tangible() result.template = "object/tangible/ship/crafted/weapon/shared_wpn_heavy_blaster.iff" result.attribute_template_id = 8 result.stfName("space_crafting_n","wpn_heavy_blaster") #### BEGIN MODIFICATIONS #### #### END MODIFICATIONS #### return result
obi-two/Rebelion
data/scripts/templates/object/tangible/ship/crafted/weapon/shared_wpn_heavy_blaster.py
Python
mit
474
[ 30522, 1001, 1001, 1001, 1001, 5060, 1024, 2023, 5371, 2003, 8285, 6914, 16848, 1001, 1001, 1001, 1001, 12719, 2089, 2022, 2439, 2065, 2589, 24156, 2135, 1001, 1001, 1001, 1001, 3531, 2156, 1996, 3784, 12653, 2005, 4973, 2013, 25430, 21600,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!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.6"/> <title>FTGL: FTOutlineGlyph.cpp Source File</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="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">FTGL &#160;<span id="projectnumber">2.1</span> </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.6 --> <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="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File&#160;List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="headertitle"> <div class="title">FTOutlineGlyph.cpp</div> </div> </div><!--header--> <div class="contents"> <a href="FTOutlineGlyph_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160;<span class="preprocessor">#include &quot;FTOutlineGlyph.h&quot;</span></div> <div class="line"><a name="l00002"></a><span class="lineno"> 2</span>&#160;<span class="preprocessor">#include &quot;FTVectoriser.h&quot;</span></div> <div class="line"><a name="l00003"></a><span class="lineno"> 3</span>&#160;</div> <div class="line"><a name="l00004"></a><span class="lineno"> 4</span>&#160;</div> <div class="line"><a name="l00005"></a><span class="lineno"> 5</span>&#160;FTOutlineGlyph::FTOutlineGlyph( FT_GlyphSlot glyph, <span class="keywordtype">bool</span> useDisplayList)</div> <div class="line"><a name="l00006"></a><span class="lineno"> 6</span>&#160;: FTGlyph( glyph),</div> <div class="line"><a name="l00007"></a><span class="lineno"> 7</span>&#160; glList(0)</div> <div class="line"><a name="l00008"></a><span class="lineno"> 8</span>&#160;{</div> <div class="line"><a name="l00009"></a><span class="lineno"> 9</span>&#160; <span class="keywordflow">if</span>( ft_glyph_format_outline != glyph-&gt;format)</div> <div class="line"><a name="l00010"></a><span class="lineno"> 10</span>&#160; {</div> <div class="line"><a name="l00011"></a><span class="lineno"> 11</span>&#160; err = 0x14; <span class="comment">// Invalid_Outline</span></div> <div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160; <span class="keywordflow">return</span>;</div> <div class="line"><a name="l00013"></a><span class="lineno"> 13</span>&#160; }</div> <div class="line"><a name="l00014"></a><span class="lineno"> 14</span>&#160;</div> <div class="line"><a name="l00015"></a><span class="lineno"> 15</span>&#160; FTVectoriser vectoriser( glyph);</div> <div class="line"><a name="l00016"></a><span class="lineno"> 16</span>&#160;</div> <div class="line"><a name="l00017"></a><span class="lineno"> 17</span>&#160; <span class="keywordtype">size_t</span> numContours = vectoriser.ContourCount();</div> <div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160; <span class="keywordflow">if</span> ( ( numContours &lt; 1) || ( vectoriser.PointCount() &lt; 3))</div> <div class="line"><a name="l00019"></a><span class="lineno"> 19</span>&#160; {</div> <div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160; <span class="keywordflow">return</span>;</div> <div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160; }</div> <div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160;</div> <div class="line"><a name="l00023"></a><span class="lineno"> 23</span>&#160; <span class="keywordflow">if</span>(useDisplayList)</div> <div class="line"><a name="l00024"></a><span class="lineno"> 24</span>&#160; {</div> <div class="line"><a name="l00025"></a><span class="lineno"> 25</span>&#160; glList = glGenLists(1);</div> <div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160; glNewList( glList, GL_COMPILE);</div> <div class="line"><a name="l00027"></a><span class="lineno"> 27</span>&#160; }</div> <div class="line"><a name="l00028"></a><span class="lineno"> 28</span>&#160; </div> <div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160; <span class="keywordflow">for</span>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> c = 0; c &lt; numContours; ++c)</div> <div class="line"><a name="l00030"></a><span class="lineno"> 30</span>&#160; {</div> <div class="line"><a name="l00031"></a><span class="lineno"> 31</span>&#160; <span class="keyword">const</span> FTContour* contour = vectoriser.Contour(c);</div> <div class="line"><a name="l00032"></a><span class="lineno"> 32</span>&#160; </div> <div class="line"><a name="l00033"></a><span class="lineno"> 33</span>&#160; glBegin( GL_LINE_LOOP);</div> <div class="line"><a name="l00034"></a><span class="lineno"> 34</span>&#160; <span class="keywordflow">for</span>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> pointIndex = 0; pointIndex &lt; contour-&gt;PointCount(); ++pointIndex)</div> <div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160; {</div> <div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160; FTPoint point = contour-&gt;Point(pointIndex);</div> <div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160; glVertex2f( point.X() / 64.0f, point.Y() / 64.0f);</div> <div class="line"><a name="l00038"></a><span class="lineno"> 38</span>&#160; }</div> <div class="line"><a name="l00039"></a><span class="lineno"> 39</span>&#160; glEnd();</div> <div class="line"><a name="l00040"></a><span class="lineno"> 40</span>&#160; }</div> <div class="line"><a name="l00041"></a><span class="lineno"> 41</span>&#160;</div> <div class="line"><a name="l00042"></a><span class="lineno"> 42</span>&#160; <span class="keywordflow">if</span>(useDisplayList)</div> <div class="line"><a name="l00043"></a><span class="lineno"> 43</span>&#160; {</div> <div class="line"><a name="l00044"></a><span class="lineno"> 44</span>&#160; glEndList();</div> <div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160; }</div> <div class="line"><a name="l00046"></a><span class="lineno"> 46</span>&#160;}</div> <div class="line"><a name="l00047"></a><span class="lineno"> 47</span>&#160;</div> <div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160;</div> <div class="line"><a name="l00049"></a><span class="lineno"> 49</span>&#160;FTOutlineGlyph::~FTOutlineGlyph()</div> <div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160;{</div> <div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160; glDeleteLists( glList, 1);</div> <div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160;}</div> <div class="line"><a name="l00053"></a><span class="lineno"> 53</span>&#160;</div> <div class="line"><a name="l00054"></a><span class="lineno"> 54</span>&#160;</div> <div class="line"><a name="l00055"></a><span class="lineno"> 55</span>&#160;<span class="keyword">const</span> FTPoint&amp; FTOutlineGlyph::Render( <span class="keyword">const</span> FTPoint&amp; pen)</div> <div class="line"><a name="l00056"></a><span class="lineno"> 56</span>&#160;{</div> <div class="line"><a name="l00057"></a><span class="lineno"> 57</span>&#160; glTranslatef( pen.X(), pen.Y(), 0.0f);</div> <div class="line"><a name="l00058"></a><span class="lineno"> 58</span>&#160;</div> <div class="line"><a name="l00059"></a><span class="lineno"> 59</span>&#160; <span class="keywordflow">if</span>( glList)</div> <div class="line"><a name="l00060"></a><span class="lineno"> 60</span>&#160; {</div> <div class="line"><a name="l00061"></a><span class="lineno"> 61</span>&#160; glCallList( glList);</div> <div class="line"><a name="l00062"></a><span class="lineno"> 62</span>&#160; }</div> <div class="line"><a name="l00063"></a><span class="lineno"> 63</span>&#160; </div> <div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160; <span class="keywordflow">return</span> advance;</div> <div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160;}</div> <div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160;</div> </div><!-- fragment --></div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated on Tue Sep 16 2014 09:17:19 for FTGL by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.6 </small></address> </body> </html>
TabitaPL/Pasjans
Angel-3.2/Code/Angel/Libraries/FTGL/unix/docs/html/FTOutlineGlyph_8cpp_source.html
HTML
mit
9,853
[ 30522, 1026, 999, 9986, 13874, 16129, 2270, 1000, 1011, 1013, 1013, 1059, 2509, 2278, 1013, 1013, 26718, 2094, 1060, 11039, 19968, 1015, 1012, 1014, 17459, 1013, 1013, 4372, 1000, 1000, 8299, 1024, 1013, 1013, 7479, 1012, 1059, 2509, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Generated by Apache Maven Doxia at 2014-11-14 --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Apache Hadoop 2.5.2 - </title> <style type="text/css" media="all"> @import url("../css/maven-base.css"); @import url("../css/maven-theme.css"); @import url("../css/site.css"); </style> <link rel="stylesheet" href="../css/print.css" type="text/css" media="print" /> <meta name="Date-Revision-yyyymmdd" content="20141114" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> </head> <body class="composite"> <div id="banner"> <a href="http://hadoop.apache.org/" id="bannerLeft"> <img src="http://hadoop.apache.org/images/hadoop-logo.jpg" alt="" /> </a> <a href="http://www.apache.org/" id="bannerRight"> <img src="http://www.apache.org/images/asf_logo_wide.png" alt="" /> </a> <div class="clear"> <hr/> </div> </div> <div id="breadcrumbs"> <div class="xleft"> <a href="http://www.apache.org/" class="externalLink">Apache</a> &gt; <a href="http://hadoop.apache.org/" class="externalLink">Hadoop</a> &gt; <a href="../../">Apache Hadoop Project Dist POM</a> &gt; <a href="../">Apache Hadoop 2.5.2</a> </div> <div class="xright"> <a href="http://wiki.apache.org/hadoop" class="externalLink">Wiki</a> | <a href="https://svn.apache.org/repos/asf/hadoop/" class="externalLink">SVN</a> | <a href="http://hadoop.apache.org/" class="externalLink">Apache Hadoop</a> &nbsp;| Last Published: 2014-11-14 &nbsp;| Version: 2.5.2 </div> <div class="clear"> <hr/> </div> </div> <div id="leftColumn"> <div id="navcolumn"> <h5>General</h5> <ul> <li class="none"> <a href="../../../index.html">Overview</a> </li> <li class="none"> <a href="../../../hadoop-project-dist/hadoop-common/SingleCluster.html">Single Node Setup</a> </li> <li class="none"> <a href="../../../hadoop-project-dist/hadoop-common/ClusterSetup.html">Cluster Setup</a> </li> <li class="none"> <a href="../../../hadoop-project-dist/hadoop-common/CommandsManual.html">Hadoop Commands Reference</a> </li> <li class="none"> <a href="../../../hadoop-project-dist/hadoop-common/FileSystemShell.html">FileSystem Shell</a> </li> <li class="none"> <a href="../../../hadoop-project-dist/hadoop-common/Compatibility.html">Hadoop Compatibility</a> </li> <li class="none"> <a href="../../../hadoop-project-dist/hadoop-common/filesystem/index.html">FileSystem Specification</a> </li> </ul> <h5>Common</h5> <ul> <li class="none"> <a href="../../../hadoop-project-dist/hadoop-common/CLIMiniCluster.html">CLI Mini Cluster</a> </li> <li class="none"> <a href="../../../hadoop-project-dist/hadoop-common/NativeLibraries.html">Native Libraries</a> </li> <li class="none"> <a href="../../../hadoop-project-dist/hadoop-common/Superusers.html">Superusers</a> </li> <li class="none"> <a href="../../../hadoop-project-dist/hadoop-common/SecureMode.html">Secure Mode</a> </li> <li class="none"> <a href="../../../hadoop-project-dist/hadoop-common/ServiceLevelAuth.html">Service Level Authorization</a> </li> <li class="none"> <a href="../../../hadoop-project-dist/hadoop-common/HttpAuthentication.html">HTTP Authentication</a> </li> </ul> <h5>HDFS</h5> <ul> <li class="none"> <a href="../../../hadoop-project-dist/hadoop-hdfs/HdfsUserGuide.html">HDFS User Guide</a> </li> <li class="none"> <a href="../../../hadoop-project-dist/hadoop-hdfs/HDFSHighAvailabilityWithQJM.html">High Availability With QJM</a> </li> <li class="none"> <a href="../../../hadoop-project-dist/hadoop-hdfs/HDFSHighAvailabilityWithNFS.html">High Availability With NFS</a> </li> <li class="none"> <a href="../../../hadoop-project-dist/hadoop-hdfs/Federation.html">Federation</a> </li> <li class="none"> <a href="../../../hadoop-project-dist/hadoop-hdfs/ViewFs.html">ViewFs Guide</a> </li> <li class="none"> <a href="../../../hadoop-project-dist/hadoop-hdfs/HdfsSnapshots.html">HDFS Snapshots</a> </li> <li class="none"> <a href="../../../hadoop-project-dist/hadoop-hdfs/HdfsDesign.html">HDFS Architecture</a> </li> <li class="none"> <a href="../../../hadoop-project-dist/hadoop-hdfs/HdfsEditsViewer.html">Edits Viewer</a> </li> <li class="none"> <a href="../../../hadoop-project-dist/hadoop-hdfs/HdfsImageViewer.html">Image Viewer</a> </li> <li class="none"> <a href="../../../hadoop-project-dist/hadoop-hdfs/HdfsPermissionsGuide.html">Permissions and HDFS</a> </li> <li class="none"> <a href="../../../hadoop-project-dist/hadoop-hdfs/HdfsQuotaAdminGuide.html">Quotas and HDFS</a> </li> <li class="none"> <a href="../../../hadoop-project-dist/hadoop-hdfs/Hftp.html">HFTP</a> </li> <li class="none"> <a href="../../../hadoop-project-dist/hadoop-hdfs/LibHdfs.html">C API libhdfs</a> </li> <li class="none"> <a href="../../../hadoop-project-dist/hadoop-hdfs/WebHDFS.html">WebHDFS REST API</a> </li> <li class="none"> <a href="../../../hadoop-hdfs-httpfs/index.html">HttpFS Gateway</a> </li> <li class="none"> <a href="../../../hadoop-project-dist/hadoop-hdfs/ShortCircuitLocalReads.html">Short Circuit Local Reads</a> </li> <li class="none"> <a href="../../../hadoop-project-dist/hadoop-hdfs/CentralizedCacheManagement.html">Centralized Cache Management</a> </li> <li class="none"> <a href="../../../hadoop-project-dist/hadoop-hdfs/HdfsNfsGateway.html">HDFS NFS Gateway</a> </li> <li class="none"> <a href="../../../hadoop-project-dist/hadoop-hdfs/HdfsRollingUpgrade.html">HDFS Rolling Upgrade</a> </li> <li class="none"> <a href="../../../hadoop-project-dist/hadoop-hdfs/ExtendedAttributes.html">Extended Attributes</a> </li> <li class="none"> <a href="../../../hadoop-project-dist/hadoop-hdfs/HdfsMultihoming.html">HDFS Support for Multihoming</a> </li> </ul> <h5>MapReduce</h5> <ul> <li class="none"> <a href="../../../hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapReduceTutorial.html">MapReduce Tutorial</a> </li> <li class="none"> <a href="../../../hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapReduce_Compatibility_Hadoop1_Hadoop2.html">Compatibilty between Hadoop 1.x and Hadoop 2.x</a> </li> <li class="none"> <a href="../../../hadoop-mapreduce-client/hadoop-mapreduce-client-core/EncryptedShuffle.html">Encrypted Shuffle</a> </li> <li class="none"> <a href="../../../hadoop-mapreduce-client/hadoop-mapreduce-client-core/PluggableShuffleAndPluggableSort.html">Pluggable Shuffle/Sort</a> </li> <li class="none"> <a href="../../../hadoop-mapreduce-client/hadoop-mapreduce-client-core/DistributedCacheDeploy.html">Distributed Cache Deploy</a> </li> <li class="none"> <a href="../../../hadoop-mapreduce-client/hadoop-mapreduce-client-core/HadoopStreaming.html">Hadoop Streaming</a> </li> <li class="none"> <a href="../../../hadoop-mapreduce-client/hadoop-mapreduce-client-core/HadoopArchives.html">Hadoop Archives</a> </li> <li class="none"> <a href="../../../hadoop-mapreduce-client/hadoop-mapreduce-client-core/DistCp.html">DistCp</a> </li> </ul> <h5>MapReduce REST APIs</h5> <ul> <li class="none"> <a href="../../../hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapredAppMasterRest.html">MR Application Master</a> </li> <li class="none"> <a href="../../../hadoop-mapreduce-client/hadoop-mapreduce-client-hs/HistoryServerRest.html">MR History Server</a> </li> </ul> <h5>YARN</h5> <ul> <li class="none"> <a href="../../../hadoop-yarn/hadoop-yarn-site/YARN.html">YARN Architecture</a> </li> <li class="none"> <a href="../../../hadoop-yarn/hadoop-yarn-site/CapacityScheduler.html">Capacity Scheduler</a> </li> <li class="none"> <a href="../../../hadoop-yarn/hadoop-yarn-site/FairScheduler.html">Fair Scheduler</a> </li> <li class="none"> <a href="../../../hadoop-yarn/hadoop-yarn-site/ResourceManagerRestart.html">ResourceManager Restart</a> </li> <li class="none"> <a href="../../../hadoop-yarn/hadoop-yarn-site/ResourceManagerHA.html">ResourceManager HA</a> </li> <li class="none"> <a href="../../../hadoop-yarn/hadoop-yarn-site/WebApplicationProxy.html">Web Application Proxy</a> </li> <li class="none"> <a href="../../../hadoop-yarn/hadoop-yarn-site/TimelineServer.html">YARN Timeline Server</a> </li> <li class="none"> <a href="../../../hadoop-yarn/hadoop-yarn-site/WritingYarnApplications.html">Writing YARN Applications</a> </li> <li class="none"> <a href="../../../hadoop-yarn/hadoop-yarn-site/YarnCommands.html">YARN Commands</a> </li> <li class="none"> <a href="../../../hadoop-sls/SchedulerLoadSimulator.html">Scheduler Load Simulator</a> </li> </ul> <h5>YARN REST APIs</h5> <ul> <li class="none"> <a href="../../../hadoop-yarn/hadoop-yarn-site/WebServicesIntro.html">Introduction</a> </li> <li class="none"> <a href="../../../hadoop-yarn/hadoop-yarn-site/ResourceManagerRest.html">Resource Manager</a> </li> <li class="none"> <a href="../../../hadoop-yarn/hadoop-yarn-site/NodeManagerRest.html">Node Manager</a> </li> </ul> <h5>Auth</h5> <ul> <li class="none"> <a href="../../../hadoop-auth/index.html">Overview</a> </li> <li class="none"> <a href="../../../hadoop-auth/Examples.html">Examples</a> </li> <li class="none"> <a href="../../../hadoop-auth/Configuration.html">Configuration</a> </li> <li class="none"> <a href="../../../hadoop-auth/BuildingIt.html">Building</a> </li> </ul> <h5>Reference</h5> <ul> <li class="none"> <a href="../../../hadoop-project-dist/hadoop-common/releasenotes.html">Release Notes</a> </li> <li class="none"> <a href="../../../api/index.html">API docs</a> </li> <li class="none"> <a href="../../../hadoop-project-dist/hadoop-common/CHANGES.txt">Common CHANGES.txt</a> </li> <li class="none"> <a href="../../../hadoop-project-dist/hadoop-hdfs/CHANGES.txt">HDFS CHANGES.txt</a> </li> <li class="none"> <a href="../../../hadoop-project-dist/hadoop-mapreduce/CHANGES.txt">MapReduce CHANGES.txt</a> </li> <li class="none"> <a href="../../../hadoop-project-dist/hadoop-common/Metrics.html">Metrics</a> </li> </ul> <h5>Configuration</h5> <ul> <li class="none"> <a href="../../../hadoop-project-dist/hadoop-common/core-default.xml">core-default.xml</a> </li> <li class="none"> <a href="../../../hadoop-project-dist/hadoop-hdfs/hdfs-default.xml">hdfs-default.xml</a> </li> <li class="none"> <a href="../../../hadoop-mapreduce-client/hadoop-mapreduce-client-core/mapred-default.xml">mapred-default.xml</a> </li> <li class="none"> <a href="../../../hadoop-yarn/hadoop-yarn-common/yarn-default.xml">yarn-default.xml</a> </li> <li class="none"> <a href="../../../hadoop-project-dist/hadoop-common/DeprecatedProperties.html">Deprecated Properties</a> </li> </ul> <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy"> <img alt="Built by Maven" src="../images/logos/maven-feather.png"/> </a> </div> </div> <div id="bodyColumn"> <div id="contentBox"> <!-- - 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. See accompanying LICENSE file. --><h1>The Hadoop FileSystem API Definition</h1> <p>This is a specification of the Hadoop FileSystem APIs, which models the contents of a filesystem as a set of paths that are either directories, symbolic links, or files.</p> <p>There is surprisingly little prior art in this area. There are multiple specifications of Unix filesystems as a tree of inodes, but nothing public which defines the notion of &#x201c;Unix filesystem as a conceptual model for data storage access&#x201d;.</p> <p>This specification attempts to do that; to define the Hadoop FileSystem model and APIs so that multiple filesystems can implement the APIs and present a consistent model of their data to applications. It does not attempt to formally specify any of the concurrency behaviors of the filesystems, other than to document the behaviours exhibited by HDFS as these are commonly expected by Hadoop client applications.</p> <ol style="list-style-type: decimal"> <li><a href="introduction.html">Introduction</a></li> <li><a href="notation.html">Notation</a></li> <li><a href="model.html">Model</a></li> <li><a href="filesystem.html">FileSystem class</a></li> <li><a href="fsdatainputstream.html">FSDataInputStream class</a></li> <li><a href="testing.html">Testing with the Filesystem specification</a></li> <li><a href="extending.html">Extending the specification and its tests</a></li> </ol> </div> </div> <div class="clear"> <hr/> </div> <div id="footer"> <div class="xright">&#169; 2014 Apache Software Foundation - <a href="http://maven.apache.org/privacy-policy.html">Privacy Policy</a></div> <div class="clear"> <hr/> </div> </div> </body> </html>
hsh075623201/hadoop
share/doc/hadoop/hadoop-project-dist/hadoop-common/filesystem/index.html
HTML
apache-2.0
17,796
[ 30522, 1026, 999, 9986, 13874, 16129, 2270, 1000, 1011, 1013, 1013, 1059, 2509, 2278, 1013, 1013, 26718, 2094, 1060, 11039, 19968, 1015, 1012, 1014, 17459, 1013, 1013, 4372, 1000, 1000, 8299, 1024, 1013, 1013, 7479, 1012, 1059, 2509, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!-- @license Copyright (c) 2015 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt --> <link rel="import" href="../polymer/polymer.html"> <link rel="import" href="../iron-flex-layout/iron-flex-layout.html"> <link rel="import" href="../paper-styles/default-theme.html"> <link rel="import" href="../paper-styles/typography.html"> <!-- Use `<paper-item-body>` in a `<paper-item>` or `<paper-icon-item>` to make two- or three- line items. It is a flex item that is a vertical flexbox. <paper-item> <paper-item-body two-line> <div>Show your status</div> <div secondary>Your status is visible to everyone</div> </paper-item-body> </paper-item> The child elements with the `secondary` attribute is given secondary text styling. ### Styling The following custom properties and mixins are available for styling: Custom property | Description | Default ----------------|-------------|---------- `--paper-item-body-two-line-min-height` | Minimum height of a two-line item | `72px` `--paper-item-body-three-line-min-height` | Minimum height of a three-line item | `88px` `--paper-item-body-secondary-color` | Foreground color for the `secondary` area | `--secondary-text-color` `--paper-item-body-secondary` | Mixin applied to the `secondary` area | `{}` --> <dom-module id="paper-item-body"> <template> <style> :host { overflow: hidden; /* needed for text-overflow: ellipsis to work on ff */ @apply --layout-vertical; @apply --layout-center-justified; @apply --layout-flex; } :host([two-line]) { min-height: var(--paper-item-body-two-line-min-height, 72px); } :host([three-line]) { min-height: var(--paper-item-body-three-line-min-height, 88px); } :host > ::slotted(*) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } :host > ::slotted([secondary]) { @apply --paper-font-body1; color: var(--paper-item-body-secondary-color, var(--secondary-text-color)); @apply --paper-item-body-secondary; } </style> <slot></slot> </template> <script> Polymer({ is: 'paper-item-body' }); </script> </dom-module>
catapult-project/catapult
third_party/polymer2/bower_components/paper-item/paper-item-body.html
HTML
bsd-3-clause
2,715
[ 30522, 1026, 999, 1011, 1011, 1030, 6105, 9385, 1006, 1039, 1007, 2325, 1996, 17782, 2622, 6048, 1012, 2035, 2916, 9235, 1012, 2023, 3642, 2089, 2069, 2022, 2109, 2104, 1996, 18667, 2094, 2806, 6105, 2179, 2012, 8299, 1024, 1013, 1013, 17...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * virsh-network.c: Commands to manage network * * Copyright (C) 2005, 2007-2012 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see * <http://www.gnu.org/licenses/>. * * Daniel Veillard <veillard@redhat.com> * Karel Zak <kzak@redhat.com> * Daniel P. Berrange <berrange@redhat.com> * */ #include <config.h> #include "virsh-network.h" #include <libxml/parser.h> #include <libxml/tree.h> #include <libxml/xpath.h> #include <libxml/xmlsave.h> #include "internal.h" #include "buf.h" #include "memory.h" #include "util.h" #include "xml.h" #include "conf/network_conf.h" virNetworkPtr vshCommandOptNetworkBy(vshControl *ctl, const vshCmd *cmd, const char **name, unsigned int flags) { virNetworkPtr network = NULL; const char *n = NULL; const char *optname = "network"; virCheckFlags(VSH_BYUUID | VSH_BYNAME, NULL); if (!vshCmdHasOption(ctl, cmd, optname)) return NULL; if (vshCommandOptString(cmd, optname, &n) <= 0) return NULL; vshDebug(ctl, VSH_ERR_INFO, "%s: found option <%s>: %s\n", cmd->def->name, optname, n); if (name) *name = n; /* try it by UUID */ if ((flags & VSH_BYUUID) && strlen(n) == VIR_UUID_STRING_BUFLEN-1) { vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as network UUID\n", cmd->def->name, optname); network = virNetworkLookupByUUIDString(ctl->conn, n); } /* try it by NAME */ if (!network && (flags & VSH_BYNAME)) { vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as network NAME\n", cmd->def->name, optname); network = virNetworkLookupByName(ctl->conn, n); } if (!network) vshError(ctl, _("failed to get network '%s'"), n); return network; } /* * "net-autostart" command */ static const vshCmdInfo info_network_autostart[] = { {"help", N_("autostart a network")}, {"desc", N_("Configure a network to be automatically started at boot.")}, {NULL, NULL} }; static const vshCmdOptDef opts_network_autostart[] = { {"network", VSH_OT_DATA, VSH_OFLAG_REQ, N_("network name or uuid")}, {"disable", VSH_OT_BOOL, 0, N_("disable autostarting")}, {NULL, 0, 0, NULL} }; static bool cmdNetworkAutostart(vshControl *ctl, const vshCmd *cmd) { virNetworkPtr network; const char *name; int autostart; if (!(network = vshCommandOptNetwork(ctl, cmd, &name))) return false; autostart = !vshCommandOptBool(cmd, "disable"); if (virNetworkSetAutostart(network, autostart) < 0) { if (autostart) vshError(ctl, _("failed to mark network %s as autostarted"), name); else vshError(ctl, _("failed to unmark network %s as autostarted"), name); virNetworkFree(network); return false; } if (autostart) vshPrint(ctl, _("Network %s marked as autostarted\n"), name); else vshPrint(ctl, _("Network %s unmarked as autostarted\n"), name); virNetworkFree(network); return true; } /* * "net-create" command */ static const vshCmdInfo info_network_create[] = { {"help", N_("create a network from an XML file")}, {"desc", N_("Create a network.")}, {NULL, NULL} }; static const vshCmdOptDef opts_network_create[] = { {"file", VSH_OT_DATA, VSH_OFLAG_REQ, N_("file containing an XML network description")}, {NULL, 0, 0, NULL} }; static bool cmdNetworkCreate(vshControl *ctl, const vshCmd *cmd) { virNetworkPtr network; const char *from = NULL; bool ret = true; char *buffer; if (vshCommandOptString(cmd, "file", &from) <= 0) return false; if (virFileReadAll(from, VSH_MAX_XML_FILE, &buffer) < 0) return false; network = virNetworkCreateXML(ctl->conn, buffer); VIR_FREE(buffer); if (network != NULL) { vshPrint(ctl, _("Network %s created from %s\n"), virNetworkGetName(network), from); virNetworkFree(network); } else { vshError(ctl, _("Failed to create network from %s"), from); ret = false; } return ret; } /* * "net-define" command */ static const vshCmdInfo info_network_define[] = { {"help", N_("define (but don't start) a network from an XML file")}, {"desc", N_("Define a network.")}, {NULL, NULL} }; static const vshCmdOptDef opts_network_define[] = { {"file", VSH_OT_DATA, VSH_OFLAG_REQ, N_("file containing an XML network description")}, {NULL, 0, 0, NULL} }; static bool cmdNetworkDefine(vshControl *ctl, const vshCmd *cmd) { virNetworkPtr network; const char *from = NULL; bool ret = true; char *buffer; if (vshCommandOptString(cmd, "file", &from) <= 0) return false; if (virFileReadAll(from, VSH_MAX_XML_FILE, &buffer) < 0) return false; network = virNetworkDefineXML(ctl->conn, buffer); VIR_FREE(buffer); if (network != NULL) { vshPrint(ctl, _("Network %s defined from %s\n"), virNetworkGetName(network), from); virNetworkFree(network); } else { vshError(ctl, _("Failed to define network from %s"), from); ret = false; } return ret; } /* * "net-destroy" command */ static const vshCmdInfo info_network_destroy[] = { {"help", N_("destroy (stop) a network")}, {"desc", N_("Forcefully stop a given network.")}, {NULL, NULL} }; static const vshCmdOptDef opts_network_destroy[] = { {"network", VSH_OT_DATA, VSH_OFLAG_REQ, N_("network name or uuid")}, {NULL, 0, 0, NULL} }; static bool cmdNetworkDestroy(vshControl *ctl, const vshCmd *cmd) { virNetworkPtr network; bool ret = true; const char *name; if (!(network = vshCommandOptNetwork(ctl, cmd, &name))) return false; if (virNetworkDestroy(network) == 0) { vshPrint(ctl, _("Network %s destroyed\n"), name); } else { vshError(ctl, _("Failed to destroy network %s"), name); ret = false; } virNetworkFree(network); return ret; } /* * "net-dumpxml" command */ static const vshCmdInfo info_network_dumpxml[] = { {"help", N_("network information in XML")}, {"desc", N_("Output the network information as an XML dump to stdout.")}, {NULL, NULL} }; static const vshCmdOptDef opts_network_dumpxml[] = { {"network", VSH_OT_DATA, VSH_OFLAG_REQ, N_("network name or uuid")}, {"inactive", VSH_OT_BOOL, VSH_OFLAG_NONE, N_("network information of an inactive domain")}, {NULL, 0, 0, NULL} }; static bool cmdNetworkDumpXML(vshControl *ctl, const vshCmd *cmd) { virNetworkPtr network; bool ret = true; char *dump; unsigned int flags = 0; int inactive; if (!(network = vshCommandOptNetwork(ctl, cmd, NULL))) return false; inactive = vshCommandOptBool(cmd, "inactive"); if (inactive) flags |= VIR_NETWORK_XML_INACTIVE; dump = virNetworkGetXMLDesc(network, flags); if (dump != NULL) { vshPrint(ctl, "%s", dump); VIR_FREE(dump); } else { ret = false; } virNetworkFree(network); return ret; } /* * "net-info" command */ static const vshCmdInfo info_network_info[] = { {"help", N_("network information")}, {"desc", N_("Returns basic information about the network")}, {NULL, NULL} }; static const vshCmdOptDef opts_network_info[] = { {"network", VSH_OT_DATA, VSH_OFLAG_REQ, N_("network name or uuid")}, {NULL, 0, 0, NULL} }; static bool cmdNetworkInfo(vshControl *ctl, const vshCmd *cmd) { virNetworkPtr network; char uuid[VIR_UUID_STRING_BUFLEN]; int autostart; int persistent = -1; int active = -1; char *bridge = NULL; if (!(network = vshCommandOptNetwork(ctl, cmd, NULL))) return false; vshPrint(ctl, "%-15s %s\n", _("Name"), virNetworkGetName(network)); if (virNetworkGetUUIDString(network, uuid) == 0) vshPrint(ctl, "%-15s %s\n", _("UUID"), uuid); active = virNetworkIsActive(network); if (active >= 0) vshPrint(ctl, "%-15s %s\n", _("Active:"), active? _("yes") : _("no")); persistent = virNetworkIsPersistent(network); if (persistent < 0) vshPrint(ctl, "%-15s %s\n", _("Persistent:"), _("unknown")); else vshPrint(ctl, "%-15s %s\n", _("Persistent:"), persistent ? _("yes") : _("no")); if (virNetworkGetAutostart(network, &autostart) < 0) vshPrint(ctl, "%-15s %s\n", _("Autostart:"), _("no autostart")); else vshPrint(ctl, "%-15s %s\n", _("Autostart:"), autostart ? _("yes") : _("no")); bridge = virNetworkGetBridgeName(network); if (bridge) vshPrint(ctl, "%-15s %s\n", _("Bridge:"), bridge); VIR_FREE(bridge); virNetworkFree(network); return true; } static int vshNetworkSorter(const void *a, const void *b) { virNetworkPtr *na = (virNetworkPtr *) a; virNetworkPtr *nb = (virNetworkPtr *) b; if (*na && !*nb) return -1; if (!*na) return *nb != NULL; return vshStrcasecmp(virNetworkGetName(*na), virNetworkGetName(*nb)); } struct vshNetworkList { virNetworkPtr *nets; size_t nnets; }; typedef struct vshNetworkList *vshNetworkListPtr; static void vshNetworkListFree(vshNetworkListPtr list) { int i; if (list && list->nnets) { for (i = 0; i < list->nnets; i++) { if (list->nets[i]) virNetworkFree(list->nets[i]); } VIR_FREE(list->nets); } VIR_FREE(list); } static vshNetworkListPtr vshNetworkListCollect(vshControl *ctl, unsigned int flags) { vshNetworkListPtr list = vshMalloc(ctl, sizeof(*list)); int i; int ret; char **names = NULL; virNetworkPtr net; bool success = false; size_t deleted = 0; int persistent; int autostart; int nActiveNets = 0; int nInactiveNets = 0; int nAllNets = 0; /* try the list with flags support (0.10.2 and later) */ if ((ret = virConnectListAllNetworks(ctl->conn, &list->nets, flags)) >= 0) { list->nnets = ret; goto finished; } /* check if the command is actually supported */ if (last_error && last_error->code == VIR_ERR_NO_SUPPORT) goto fallback; if (last_error && last_error->code == VIR_ERR_INVALID_ARG) { /* try the new API again but mask non-guaranteed flags */ unsigned int newflags = flags & (VIR_CONNECT_LIST_NETWORKS_ACTIVE | VIR_CONNECT_LIST_NETWORKS_INACTIVE); vshResetLibvirtError(); if ((ret = virConnectListAllNetworks(ctl->conn, &list->nets, newflags)) >= 0) { list->nnets = ret; goto filter; } } /* there was an error during the first or second call */ vshError(ctl, "%s", _("Failed to list networks")); goto cleanup; fallback: /* fall back to old method (0.10.1 and older) */ vshResetLibvirtError(); /* Get the number of active networks */ if (!VSH_MATCH(VIR_CONNECT_LIST_NETWORKS_FILTERS_ACTIVE) || VSH_MATCH(VIR_CONNECT_LIST_NETWORKS_ACTIVE)) { if ((nActiveNets = virConnectNumOfNetworks(ctl->conn)) < 0) { vshError(ctl, "%s", _("Failed to get the number of active networks")); goto cleanup; } } /* Get the number of inactive networks */ if (!VSH_MATCH(VIR_CONNECT_LIST_NETWORKS_FILTERS_ACTIVE) || VSH_MATCH(VIR_CONNECT_LIST_NETWORKS_INACTIVE)) { if ((nInactiveNets = virConnectNumOfDefinedNetworks(ctl->conn)) < 0) { vshError(ctl, "%s", _("Failed to get the number of inactive networks")); goto cleanup; } } nAllNets = nActiveNets + nInactiveNets; if (nAllNets == 0) return list; names = vshMalloc(ctl, sizeof(char *) * nAllNets); /* Retrieve a list of active network names */ if (!VSH_MATCH(VIR_CONNECT_LIST_NETWORKS_FILTERS_ACTIVE) || VSH_MATCH(VIR_CONNECT_LIST_NETWORKS_ACTIVE)) { if (virConnectListNetworks(ctl->conn, names, nActiveNets) < 0) { vshError(ctl, "%s", _("Failed to list active networks")); goto cleanup; } } /* Add the inactive networks to the end of the name list */ if (!VSH_MATCH(VIR_CONNECT_LIST_NETWORKS_FILTERS_ACTIVE) || VSH_MATCH(VIR_CONNECT_LIST_NETWORKS_ACTIVE)) { if (virConnectListDefinedNetworks(ctl->conn, &names[nActiveNets], nInactiveNets) < 0) { vshError(ctl, "%s", _("Failed to list inactive networks")); goto cleanup; } } list->nets = vshMalloc(ctl, sizeof(virNetworkPtr) * (nAllNets)); list->nnets = 0; /* get active networks */ for (i = 0; i < nActiveNets; i++) { if (!(net = virNetworkLookupByName(ctl->conn, names[i]))) continue; list->nets[list->nnets++] = net; } /* get inactive networks */ for (i = 0; i < nInactiveNets; i++) { if (!(net = virNetworkLookupByName(ctl->conn, names[i]))) continue; list->nets[list->nnets++] = net; } /* truncate networks that weren't found */ deleted = nAllNets - list->nnets; filter: /* filter list the list if the list was acquired by fallback means */ for (i = 0; i < list->nnets; i++) { net = list->nets[i]; /* persistence filter */ if (VSH_MATCH(VIR_CONNECT_LIST_NETWORKS_FILTERS_PERSISTENT)) { if ((persistent = virNetworkIsPersistent(net)) < 0) { vshError(ctl, "%s", _("Failed to get network persistence info")); goto cleanup; } if (!((VSH_MATCH(VIR_CONNECT_LIST_NETWORKS_PERSISTENT) && persistent) || (VSH_MATCH(VIR_CONNECT_LIST_NETWORKS_TRANSIENT) && !persistent))) goto remove_entry; } /* autostart filter */ if (VSH_MATCH(VIR_CONNECT_LIST_NETWORKS_FILTERS_AUTOSTART)) { if (virNetworkGetAutostart(net, &autostart) < 0) { vshError(ctl, "%s", _("Failed to get network autostart state")); goto cleanup; } if (!((VSH_MATCH(VIR_CONNECT_LIST_NETWORKS_AUTOSTART) && autostart) || (VSH_MATCH(VIR_CONNECT_LIST_NETWORKS_NO_AUTOSTART) && !autostart))) goto remove_entry; } /* the pool matched all filters, it may stay */ continue; remove_entry: /* the pool has to be removed as it failed one of the filters */ virNetworkFree(list->nets[i]); list->nets[i] = NULL; deleted++; } finished: /* sort the list */ if (list->nets && list->nnets) qsort(list->nets, list->nnets, sizeof(*list->nets), vshNetworkSorter); /* truncate the list if filter simulation deleted entries */ if (deleted) VIR_SHRINK_N(list->nets, list->nnets, deleted); success = true; cleanup: for (i = 0; i < nAllNets; i++) VIR_FREE(names[i]); VIR_FREE(names); if (!success) { vshNetworkListFree(list); list = NULL; } return list; } /* * "net-list" command */ static const vshCmdInfo info_network_list[] = { {"help", N_("list networks")}, {"desc", N_("Returns list of networks.")}, {NULL, NULL} }; static const vshCmdOptDef opts_network_list[] = { {"inactive", VSH_OT_BOOL, 0, N_("list inactive networks")}, {"all", VSH_OT_BOOL, 0, N_("list inactive & active networks")}, {"persistent", VSH_OT_BOOL, 0, N_("list persistent networks")}, {"transient", VSH_OT_BOOL, 0, N_("list transient networks")}, {"autostart", VSH_OT_BOOL, 0, N_("list networks with autostart enabled")}, {"no-autostart", VSH_OT_BOOL, 0, N_("list networks with autostart disabled")}, {NULL, 0, 0, NULL} }; static bool cmdNetworkList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED) { vshNetworkListPtr list = NULL; int i; bool inactive = vshCommandOptBool(cmd, "inactive"); bool all = vshCommandOptBool(cmd, "all"); bool persistent = vshCommandOptBool(cmd, "persistent"); bool transient = vshCommandOptBool(cmd, "transient"); bool autostart = vshCommandOptBool(cmd, "autostart"); bool no_autostart = vshCommandOptBool(cmd, "no-autostart"); unsigned int flags = VIR_CONNECT_LIST_NETWORKS_ACTIVE; if (inactive) flags = VIR_CONNECT_LIST_NETWORKS_INACTIVE; if (all) flags = VIR_CONNECT_LIST_NETWORKS_ACTIVE | VIR_CONNECT_LIST_NETWORKS_INACTIVE; if (persistent) flags |= VIR_CONNECT_LIST_NETWORKS_PERSISTENT; if (transient) flags |= VIR_CONNECT_LIST_NETWORKS_TRANSIENT; if (autostart) flags |= VIR_CONNECT_LIST_NETWORKS_AUTOSTART; if (no_autostart) flags |= VIR_CONNECT_LIST_NETWORKS_NO_AUTOSTART; if (!(list = vshNetworkListCollect(ctl, flags))) return false; vshPrintExtra(ctl, "%-20s %-10s %-13s %s\n", _("Name"), _("State"), _("Autostart"), _("Persistent")); vshPrintExtra(ctl, "--------------------------------------------------\n"); for (i = 0; i < list->nnets; i++) { virNetworkPtr network = list->nets[i]; const char *autostartStr; int is_autostart = 0; if (virNetworkGetAutostart(network, &is_autostart) < 0) autostartStr = _("no autostart"); else autostartStr = is_autostart ? _("yes") : _("no"); vshPrint(ctl, "%-20s %-10s %-13s %s\n", virNetworkGetName(network), virNetworkIsActive(network) ? _("active") : _("inactive"), autostartStr, virNetworkIsPersistent(network) ? _("yes") : _("no")); } vshNetworkListFree(list); return true; } /* * "net-name" command */ static const vshCmdInfo info_network_name[] = { {"help", N_("convert a network UUID to network name")}, {"desc", ""}, {NULL, NULL} }; static const vshCmdOptDef opts_network_name[] = { {"network", VSH_OT_DATA, VSH_OFLAG_REQ, N_("network uuid")}, {NULL, 0, 0, NULL} }; static bool cmdNetworkName(vshControl *ctl, const vshCmd *cmd) { virNetworkPtr network; if (!(network = vshCommandOptNetworkBy(ctl, cmd, NULL, VSH_BYUUID))) return false; vshPrint(ctl, "%s\n", virNetworkGetName(network)); virNetworkFree(network); return true; } /* * "net-start" command */ static const vshCmdInfo info_network_start[] = { {"help", N_("start a (previously defined) inactive network")}, {"desc", N_("Start a network.")}, {NULL, NULL} }; static const vshCmdOptDef opts_network_start[] = { {"network", VSH_OT_DATA, VSH_OFLAG_REQ, N_("network name or uuid")}, {NULL, 0, 0, NULL} }; static bool cmdNetworkStart(vshControl *ctl, const vshCmd *cmd) { virNetworkPtr network; bool ret = true; const char *name = NULL; if (!(network = vshCommandOptNetwork(ctl, cmd, &name))) return false; if (virNetworkCreate(network) == 0) { vshPrint(ctl, _("Network %s started\n"), name); } else { vshError(ctl, _("Failed to start network %s"), name); ret = false; } virNetworkFree(network); return ret; } /* * "net-undefine" command */ static const vshCmdInfo info_network_undefine[] = { {"help", N_("undefine an inactive network")}, {"desc", N_("Undefine the configuration for an inactive network.")}, {NULL, NULL} }; static const vshCmdOptDef opts_network_undefine[] = { {"network", VSH_OT_DATA, VSH_OFLAG_REQ, N_("network name or uuid")}, {NULL, 0, 0, NULL} }; static bool cmdNetworkUndefine(vshControl *ctl, const vshCmd *cmd) { virNetworkPtr network; bool ret = true; const char *name; if (!(network = vshCommandOptNetwork(ctl, cmd, &name))) return false; if (virNetworkUndefine(network) == 0) { vshPrint(ctl, _("Network %s has been undefined\n"), name); } else { vshError(ctl, _("Failed to undefine network %s"), name); ret = false; } virNetworkFree(network); return ret; } /* * "net-update" command */ static const vshCmdInfo info_network_update[] = { {"help", N_("update parts of an existing network's configuration")}, {"desc", ""}, {NULL, NULL} }; static const vshCmdOptDef opts_network_update[] = { {"network", VSH_OT_DATA, VSH_OFLAG_REQ, N_("network name or uuid")}, {"command", VSH_OT_DATA, VSH_OFLAG_REQ, N_("type of update (add-first, add-last (add), delete, or modify)")}, {"section", VSH_OT_DATA, VSH_OFLAG_REQ, N_("which section of network configuration to update")}, {"xml", VSH_OT_DATA, VSH_OFLAG_REQ, N_("name of file containing xml (or, if it starts with '<', the complete " "xml element itself) to add/modify, or to be matched for search")}, {"parent-index", VSH_OT_INT, 0, N_("which parent object to search through")}, {"config", VSH_OT_BOOL, 0, N_("affect next boot")}, {"live", VSH_OT_BOOL, 0, N_("affect running domain")}, {"current", VSH_OT_BOOL, 0, N_("affect current domain")}, {NULL, 0, 0, NULL} }; VIR_ENUM_DECL(virNetworkUpdateCommand) VIR_ENUM_IMPL(virNetworkUpdateCommand, VIR_NETWORK_UPDATE_COMMAND_LAST, "none", "modify", "delete", "add-last", "add-first"); VIR_ENUM_DECL(virNetworkSection) VIR_ENUM_IMPL(virNetworkSection, VIR_NETWORK_SECTION_LAST, "none", "bridge", "domain", "ip", "ip-dhcp-host", "ip-dhcp-range", "forward", "forward-interface", "forward-pf", "portgroup", "dns-host", "dns-txt", "dns-srv"); static bool cmdNetworkUpdate(vshControl *ctl, const vshCmd *cmd) { bool ret = false; virNetworkPtr network; const char *commandStr = NULL; const char *sectionStr = NULL; int command, section, parentIndex = -1; const char *xml = NULL; char *xmlFromFile = NULL; bool current = vshCommandOptBool(cmd, "current"); bool config = vshCommandOptBool(cmd, "config"); bool live = vshCommandOptBool(cmd, "live"); unsigned int flags = 0; const char *affected; if (!(network = vshCommandOptNetwork(ctl, cmd, NULL))) goto cleanup; if (vshCommandOptString(cmd, "command", &commandStr) < 0) { vshError(ctl, "%s", _("missing or malformed command argument")); goto cleanup; } if (STREQ(commandStr, "add")) { /* "add" is a synonym for "add-last" */ command = VIR_NETWORK_UPDATE_COMMAND_ADD_LAST; } else { command = virNetworkUpdateCommandTypeFromString(commandStr); if (command <= 0 || command >= VIR_NETWORK_UPDATE_COMMAND_LAST) { vshError(ctl, _("unrecognized command name '%s'"), commandStr); goto cleanup; } } if (vshCommandOptString(cmd, "section", &sectionStr) < 0) { vshError(ctl, "%s", _("missing or malformed section argument")); goto cleanup; } section = virNetworkSectionTypeFromString(sectionStr); if (section <= 0 || section >= VIR_NETWORK_SECTION_LAST) { vshError(ctl, _("unrecognized section name '%s'"), sectionStr); goto cleanup; } if (vshCommandOptInt(cmd, "parent-index", &parentIndex) < 0) { vshError(ctl, "%s", _("malformed parent-index argument")); goto cleanup; } /* The goal is to have a full xml element in the "xml" * string. This is provided in the --xml option, either directly * (detected by the first character being "<"), or indirectly by * supplying a filename (first character isn't "<") that contains * the desired xml. */ if (vshCommandOptString(cmd, "xml", &xml) < 0) { vshError(ctl, "%s", _("malformed or missing xml argument")); goto cleanup; } if (*xml != '<') { /* contents of xmldata is actually the name of a file that * contains the xml. */ if (virFileReadAll(xml, VSH_MAX_XML_FILE, &xmlFromFile) < 0) goto cleanup; /* NB: the original xml is just a const char * that points * to a string owned by the vshCmd object, and will be freed * by vshCommandFree, so it's safe to lose its pointer here. */ xml = xmlFromFile; } if (current) { if (live || config) { vshError(ctl, "%s", _("--current must be specified exclusively")); return false; } flags |= VIR_NETWORK_UPDATE_AFFECT_CURRENT; } else { if (config) flags |= VIR_NETWORK_UPDATE_AFFECT_CONFIG; if (live) flags |= VIR_NETWORK_UPDATE_AFFECT_LIVE; } if (virNetworkUpdate(network, command, section, parentIndex, xml, flags) < 0) { vshError(ctl, _("Failed to update network %s"), virNetworkGetName(network)); goto cleanup; } if (config) { if (live) affected = _("persistent config and live state"); else affected = _("persistent config"); } else if (live) { affected = _("live state"); } else if (virNetworkIsActive(network)) { affected = _("live state"); } else { affected = _("persistent config"); } vshPrint(ctl, _("Updated network %s %s"), virNetworkGetName(network), affected); ret = true; cleanup: vshReportError(ctl); virNetworkFree(network); VIR_FREE(xmlFromFile); return ret; } /* * "net-uuid" command */ static const vshCmdInfo info_network_uuid[] = { {"help", N_("convert a network name to network UUID")}, {"desc", ""}, {NULL, NULL} }; static const vshCmdOptDef opts_network_uuid[] = { {"network", VSH_OT_DATA, VSH_OFLAG_REQ, N_("network name")}, {NULL, 0, 0, NULL} }; static bool cmdNetworkUuid(vshControl *ctl, const vshCmd *cmd) { virNetworkPtr network; char uuid[VIR_UUID_STRING_BUFLEN]; if (!(network = vshCommandOptNetworkBy(ctl, cmd, NULL, VSH_BYNAME))) return false; if (virNetworkGetUUIDString(network, uuid) != -1) vshPrint(ctl, "%s\n", uuid); else vshError(ctl, "%s", _("failed to get network UUID")); virNetworkFree(network); return true; } /* * "net-edit" command */ static const vshCmdInfo info_network_edit[] = { {"help", N_("edit XML configuration for a network")}, {"desc", N_("Edit the XML configuration for a network.")}, {NULL, NULL} }; static const vshCmdOptDef opts_network_edit[] = { {"network", VSH_OT_DATA, VSH_OFLAG_REQ, N_("network name or uuid")}, {NULL, 0, 0, NULL} }; static char *vshNetworkGetXMLDesc(virNetworkPtr network) { unsigned int flags = VIR_NETWORK_XML_INACTIVE; char *doc = virNetworkGetXMLDesc(network, flags); if (!doc && last_error->code == VIR_ERR_INVALID_ARG) { /* The server side libvirt doesn't support * VIR_NETWORK_XML_INACTIVE, so retry without it. */ vshResetLibvirtError(); flags &= ~VIR_NETWORK_XML_INACTIVE; doc = virNetworkGetXMLDesc(network, flags); } return doc; } static bool cmdNetworkEdit(vshControl *ctl, const vshCmd *cmd) { bool ret = false; virNetworkPtr network = NULL; virNetworkPtr network_edited = NULL; network = vshCommandOptNetwork(ctl, cmd, NULL); if (network == NULL) goto cleanup; #define EDIT_GET_XML vshNetworkGetXMLDesc(network) #define EDIT_NOT_CHANGED \ vshPrint(ctl, _("Network %s XML configuration not changed.\n"), \ virNetworkGetName(network)); \ ret = true; goto edit_cleanup; #define EDIT_DEFINE \ (network_edited = virNetworkDefineXML(ctl->conn, doc_edited)) #define EDIT_FREE \ if (network_edited) \ virNetworkFree(network_edited); #include "virsh-edit.c" vshPrint(ctl, _("Network %s XML configuration edited.\n"), virNetworkGetName(network_edited)); ret = true; cleanup: if (network) virNetworkFree(network); if (network_edited) virNetworkFree(network_edited); return ret; } const vshCmdDef networkCmds[] = { {"net-autostart", cmdNetworkAutostart, opts_network_autostart, info_network_autostart, 0}, {"net-create", cmdNetworkCreate, opts_network_create, info_network_create, 0}, {"net-define", cmdNetworkDefine, opts_network_define, info_network_define, 0}, {"net-destroy", cmdNetworkDestroy, opts_network_destroy, info_network_destroy, 0}, {"net-dumpxml", cmdNetworkDumpXML, opts_network_dumpxml, info_network_dumpxml, 0}, {"net-edit", cmdNetworkEdit, opts_network_edit, info_network_edit, 0}, {"net-info", cmdNetworkInfo, opts_network_info, info_network_info, 0}, {"net-list", cmdNetworkList, opts_network_list, info_network_list, 0}, {"net-name", cmdNetworkName, opts_network_name, info_network_name, 0}, {"net-start", cmdNetworkStart, opts_network_start, info_network_start, 0}, {"net-undefine", cmdNetworkUndefine, opts_network_undefine, info_network_undefine, 0}, {"net-update", cmdNetworkUpdate, opts_network_update, info_network_update, 0}, {"net-uuid", cmdNetworkUuid, opts_network_uuid, info_network_uuid, 0}, {NULL, NULL, NULL, NULL, 0} };
warewolf/libvirt
tools/virsh-network.c
C
lgpl-2.1
30,151
[ 30522, 1013, 1008, 1008, 6819, 2869, 2232, 1011, 2897, 1012, 1039, 1024, 10954, 2000, 6133, 2897, 1008, 1008, 9385, 1006, 1039, 1007, 2384, 1010, 2289, 1011, 2262, 2417, 6045, 1010, 4297, 1012, 1008, 1008, 2023, 3075, 2003, 2489, 4007, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
using System; namespace Server.Network { public delegate void OnPacketReceive( NetState state, PacketReader pvSrc ); public delegate bool ThrottlePacketCallback( NetState state ); public class PacketHandler { public PacketHandler( int packetID, int length, bool ingame, OnPacketReceive onReceive ) { PacketID = packetID; Length = length; Ingame = ingame; OnReceive = onReceive; } public int PacketID { get; } public int Length { get; } public OnPacketReceive OnReceive { get; } public ThrottlePacketCallback ThrottleCallback { get; set; } public bool Ingame { get; } } }
xrunuo/xrunuo
Server/Network/PacketHandler.cs
C#
gpl-3.0
640
[ 30522, 2478, 2291, 1025, 3415, 15327, 8241, 1012, 2897, 1063, 2270, 11849, 11675, 2006, 23947, 3388, 2890, 3401, 3512, 1006, 16996, 12259, 2110, 1010, 14771, 16416, 4063, 26189, 21338, 2278, 1007, 1025, 2270, 11849, 22017, 2140, 24420, 23947,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/** * Copyright (C), 2012 Adaptinet.org (Todd Fearn, Anthony Graffeo) * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. * */ package org.adaptinet.mimehandlers; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.net.URLDecoder; import java.security.MessageDigest; import java.util.Enumeration; import java.util.Properties; import java.util.StringTokenizer; import java.util.Vector; import org.adaptinet.http.HTTP; import org.adaptinet.http.Request; import org.adaptinet.http.Response; import org.adaptinet.socket.PropData; import org.adaptinet.transceiver.ITransceiver; public class MimeHTML_HTTP implements MimeBase { private String url = null; private String urlBase = null; private String webBase = null; private String mimeType = null; private String pathName = null; private ITransceiver transceiver = null; private int status = 200; private boolean bAdminPort = false; static private String PLUGIN_ENTRY = "plugins/plugin?entry="; static private String PEER_ENTRY = "peers/peer?entry="; static private int PLUGIN_ENTRYLEN = 0; static private int PEER_ENTRYLEN = 0; static final String footer = "<br><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" " + "width=\"100%\" ><tr><td width=\"127\" class=\"footerorange\">" + "<IMG height=\"1\" src=\"/images/space.gif\" width=\"127\"></td><td width=\"400\" " + "class=\"footerorange\"><IMG height=\"1\" src=\"/images/space.gif\" width=\"400\"></td>" + "<td width=\"100%\" class=\"footerorange\"><IMG height=\"1\" src=\"/images/space.gif\" " + "width=\"1\"></td></tr><tr><td width=\"127\" class=\"footerorange\">" + "<IMG height=27 src=\"/images/space.gif\" width=127></td><td align=\"left\" " + "class=\"footerorange\" nowrap>25 B Vreeland Rd. Suite 103, Florham Park, NJ" + " 07932 &nbsp;&nbsp;&nbsp; 973-451-9600 &nbsp; fx 973-439-1745</td>" + "<td width=\"100%\" class=\"footerorange\"><IMG height=27 " + "src=\"/images/space.gif\" width=1></td></tr><tr><td width=\"127\">" + "<IMG height=1 src=\"/images/space.gif\" width=127></td><td align=\"left\" " + "class=\"footer\" nowrap>all materials © Adaptinet Inc. All rights reserved.</td>" + "<td align=\"right\" width=\"100%\" class=\"footer\" nowrap>" + "<A class=\"footerlink\" href=\"#\">contact Adaptinet</A> &nbsp;|&nbsp;" + " <A class=\"footerlink\" href=\"#\">support</A> &nbsp;</td></tr></table><br><br><br><br>"; static { PLUGIN_ENTRYLEN = PLUGIN_ENTRY.length(); PEER_ENTRYLEN = PEER_ENTRY.length(); } public MimeHTML_HTTP() { } public void init(String u, ITransceiver s) { transceiver = s; urlBase = s.getHTTPRoot(); webBase = s.getWebRoot(); if (urlBase == null || urlBase.equals(".")) { urlBase = System.getProperty("user.dir", ""); } if (!urlBase.endsWith(File.separator)) urlBase += File.separator; if (webBase == null || webBase.equals(".")) { webBase = System.getProperty("user.dir", ""); } if (!webBase.endsWith(File.separator)) webBase += File.separator; url = u; parseUrl(); } private void parseUrl() { try { pathName = URLDecoder.decode(url, "UTF-8"); } catch (Exception e) { pathName = url; } if (pathName.endsWith("/")) pathName += "index.html"; if (pathName.startsWith("/")) pathName = pathName.substring(1); int dot = pathName.indexOf("."); if (dot > 0) { String ext = pathName.substring(dot + 1); setMimeForExt(ext); } else mimeType = HTTP.contentTypeHTML; } public String getContentType() { return mimeType; } private void setMimeForExt(String ext) { if (ext.equalsIgnoreCase("jpg")) mimeType = HTTP.contentTypeJPEG; else if (ext.equalsIgnoreCase("htm") || ext.equalsIgnoreCase("html")) mimeType = HTTP.contentTypeHTML; else if (ext.equalsIgnoreCase("gif")) mimeType = HTTP.contentTypeGIF; else if (ext.equalsIgnoreCase("xsl")) mimeType = HTTP.contentTypeXML; else mimeType = HTTP.contentTypeHTML; } public ByteArrayOutputStream process(ITransceiver transceiver, Request request) { // note: this process has gotten pretty big, really fast // need to revisit the exception handling here, there is a better way File file = null; String monitor = null; long length = 0; try { bAdminPort = (request.getPort() == transceiver.getAdminPort()); status = isAuthorized(request.getUsername(), request.getPassword()); if (!bAdminPort) { // non-admin port are regular html requests... String base = webBase; if (bAdminPort) base = urlBase; file = new File(base + pathName); if (file.isFile() == false || !file.canRead()) throw new FileNotFoundException(); else length = file.length(); } else { if (pathName.equalsIgnoreCase("configuration.html")) { if (status == HTTP.UNAUTHORIZED || bAdminPort == false) throw new IllegalAccessException(); monitor = getConfiguration(transceiver); System.out.println(monitor); if (monitor != null) length = monitor.length(); else status = HTTP.NOT_FOUND; } else if (pathName.equalsIgnoreCase("monitor.html")) { if (status == HTTP.UNAUTHORIZED || bAdminPort == false) throw new IllegalAccessException(); try { monitor = getMonitor(); length = monitor.length(); } catch (Exception e) { monitor = e.getMessage(); status = HTTP.INTERNAL_SERVER_ERROR; } catch (Throwable t) { monitor = t.getMessage(); status = HTTP.INTERNAL_SERVER_ERROR; } } else if (pathName.equalsIgnoreCase("plugins.html")) { if (status == HTTP.UNAUTHORIZED || bAdminPort == false) throw new IllegalAccessException(); monitor = getPlugins(transceiver); if (monitor != null) length = monitor.length(); else status = HTTP.INTERNAL_SERVER_ERROR; } else if (pathName.equalsIgnoreCase("peers.html")) { if (status == HTTP.UNAUTHORIZED || bAdminPort == false) throw new IllegalAccessException(); monitor = getPeers(transceiver); if (monitor != null) length = monitor.length(); else status = HTTP.INTERNAL_SERVER_ERROR; } else if (pathName.startsWith(PLUGIN_ENTRY)) { if (status == HTTP.UNAUTHORIZED || bAdminPort == false) throw new IllegalAccessException(); if (pathName.length() > PLUGIN_ENTRYLEN) monitor = getPluginEntry(transceiver, pathName .substring(PLUGIN_ENTRYLEN)); else monitor = getPluginEntry(transceiver, ""); if (monitor != null) length = monitor.length(); else status = HTTP.NOT_FOUND; } else if (pathName.startsWith(PEER_ENTRY)) { if (status == HTTP.UNAUTHORIZED || bAdminPort == false) throw new IllegalAccessException(); if (pathName.length() > PEER_ENTRYLEN) monitor = getPeerEntry(transceiver, pathName .substring(PEER_ENTRYLEN)); else monitor = getPeerEntry(transceiver, ""); if (monitor != null) length = monitor.length(); else status = HTTP.NOT_FOUND; } else if (pathName.startsWith("setadmin?")) { if (status == HTTP.UNAUTHORIZED || bAdminPort == false) throw new IllegalAccessException(); monitor = setAdmin(pathName.substring(9), request); length = monitor.length(); } else // files { String base = webBase; if (bAdminPort) base = urlBase; file = new File(base + pathName); if (file.isFile() == false || !file.canRead()) throw new FileNotFoundException(); else length = file.length(); } } } catch (IOException e) { status = HTTP.NOT_FOUND; } catch (IllegalAccessException iae) { status = HTTP.UNAUTHORIZED; } catch (Exception e) { status = HTTP.INTERNAL_SERVER_ERROR; } try { Response resp = new Response(request.getOutStream(), transceiver .getHost(), mimeType); resp.setResponse(new ByteArrayOutputStream()); resp.setStatus(status); resp.writeHeader(length); if (status != HTTP.OK) return null; BufferedOutputStream out = new BufferedOutputStream(request .getOutStream()); if (file != null) { BufferedInputStream in = new BufferedInputStream( new FileInputStream(file)); byte[] bytes = new byte[255]; while (true) { int read = in.read(bytes); if (read < 0) break; out.write(bytes, 0, read); } in.close(); } else if (monitor != null) { out.write(monitor.getBytes()); } out.flush(); } catch (Exception e) { } return null; } public static String getPlugins(ITransceiver transceiver) { try { return PluginXML.getEntries(transceiver); } catch (Exception e) { return null; } } public static String getPeers(ITransceiver transceiver) { try { return PeerXML.getEntries(transceiver); } catch (Exception e) { return null; } } public static String getConfiguration(ITransceiver transceiver) { try { return TransceiverConfiguration.getConfiguration(transceiver); } catch (Exception e) { return null; } } public static String getPluginEntry(ITransceiver transceiver, String entry) { try { return PluginXML.getEntry(transceiver, entry); } catch (Exception e) { return null; } } public static String getPeerEntry(ITransceiver transceiver, String peer) { try { return PeerXML.getEntry(transceiver, peer); } catch (Exception e) { return null; } } public static String getLicenseKey(ITransceiver transceiver) { try { // return // simpleTransform.transform(licensingXML.getLicense(transceiver), // transceiver.getHTTPRoot() + "/licensing.xsl"); return null; } catch (Exception e) { return null; } } private String setAdmin(String params, Request request) { try { StringTokenizer tokenizer = new StringTokenizer(params, "&"); int size = tokenizer.countTokens() * 2; String token = null; Properties properties = new Properties(); for (int i = 0; i < size; i += 2) { if (tokenizer.hasMoreTokens()) { token = tokenizer.nextToken(); int loc = token.indexOf('='); properties.setProperty(token.substring(0, loc), token .substring(loc + 1, token.length())); } } String userid = properties.getProperty("userid"); String current = properties.getProperty("current"); String password = properties.getProperty("password"); String confirm = properties.getProperty("password2"); // check current password here if (isAuthorized(request.getUsername(), current) == HTTP.UNAUTHORIZED) return "<H2>The current password is incorrect for user: " + request.getUsername() + "</H2>"; if (!password.equals(confirm)) return "<H2>The password does not match the confirm password</H2>"; if (password.equals("")) return "<H2>The password cannot be empty.</H2>"; MessageDigest md = MessageDigest.getInstance("MD5"); String digest = new String(md.digest(password.getBytes())); String userpass = userid + ":" + digest; String authfile = urlBase + ".xbpasswd"; FileOutputStream fs = new FileOutputStream(authfile); fs.write(userpass.getBytes()); fs.close(); return "<H2>Change password success for " + userid + "</H2>"; } catch (Exception e) { } return "<H2>Change password failure.</H2>"; } public int getStatus() { return status; } private int isAuthorized(String username, String password) { try { if (!bAdminPort) return HTTP.OK; String authfile = urlBase + ".xbpasswd"; File file = new File(authfile); if (!file.isFile()) return HTTP.OK; BufferedReader br = new BufferedReader(new InputStreamReader( new FileInputStream(file))); String userpass = br.readLine(); br.close(); StringTokenizer st = new StringTokenizer(userpass, ":"); String user = st.hasMoreTokens() ? st.nextToken() : ""; String pass = st.hasMoreTokens() ? st.nextToken() : ""; MessageDigest md = MessageDigest.getInstance("MD5"); String digest = new String(md.digest(password != null ? password .getBytes() : "".getBytes())); if (user.equals(username) && pass.equals(digest)) return HTTP.OK; } catch (IOException ioe) { } catch (NullPointerException npe) { } catch (Exception e) { e.printStackTrace(); } return HTTP.UNAUTHORIZED; } String getMonitor() { StringBuffer buffer = new StringBuffer(); try { Vector<PropData> vec = transceiver.requestList(); buffer.append("<html><head><title>Status</title>"); buffer.append("<link rel=\"Stylesheet\" href=\"/style.css\">"); buffer.append("<script language=\"JavaScript\" src=\"/css.js\"></script></head>"); buffer.append("<body BGCOLOR=\"#FFFFFF\">"); buffer.append("<TABLE cellPadding=0 cellSpacing=0 border=0 WIDTH=\"500\"<tr><TD><IMG alt=\"\" src=\"images/empty.gif\" width=30 border=0></TD><td>"); buffer.append("<table border=\"1\" cellspacing=\"0\" cellpadding=\"4\">"); buffer.append("<tr valign=\"top\" class=\"header\">"); buffer.append("<td>Plugin Name</td>"); buffer.append("<td>System ID</td>"); buffer.append("<td>Status</td>"); buffer.append("<td>Control</td></tr>"); Enumeration<PropData> e = vec.elements(); while (e.hasMoreElements()) { PropData data = e.nextElement(); buffer.append("<tr class=\"text\">"); buffer.append("<td><strong>"); buffer.append(data.getName()); buffer.append("</strong></td>"); buffer.append("<td>"); buffer.append(data.getId()); buffer.append("</td>"); buffer.append("<td>"); buffer.append(data.getState()); buffer.append("</td>"); buffer.append("<td>"); buffer.append("<FORM Method=\"POST\" Action=\"\">"); buffer .append("<INPUT type=\"hidden\" name=\"command\" value=\"killrequest\"></INPUT>"); buffer .append("<INPUT TYPE=\"Submit\" value=\" Kill \"></INPUT>"); buffer .append("<INPUT type=\"checkbox\" name=\"Force\" value=\"true\">Force</INPUT>"); buffer.append("<INPUT type=\"hidden\" "); buffer.append("name=\"SYSTEMID\" "); buffer.append("value=\">"); buffer.append(data.getId()); buffer.append("\"></INPUT>"); buffer.append("<INPUT type=\"hidden\" "); buffer.append("name=\"Name\" "); buffer.append("value=\">"); buffer.append(data.getName()); buffer.append("\"></INPUT>"); buffer.append("</td>"); } buffer.append("</FORM>"); buffer.append("</table></td></tr></table>"); buffer.append(footer); buffer.append("</body>"); buffer.append("</html>"); } catch (Exception e) { return null; } return buffer.toString(); } }
tfearn/AdaptinetSDK
src/org/adaptinet/mimehandlers/MimeHTML_HTTP.java
Java
mpl-2.0
15,471
[ 30522, 1013, 1008, 1008, 1008, 9385, 1006, 1039, 1007, 1010, 2262, 15581, 3170, 2102, 1012, 8917, 1006, 6927, 3571, 2078, 1010, 4938, 22160, 7959, 2080, 1007, 1008, 1008, 2023, 3120, 3642, 2433, 2003, 3395, 2000, 1996, 3408, 1997, 1996, 9...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE html> <html> <head> <title>OzzA - Apresentação do Layout</title> <meta charset="utf-8" /> <meta lang="pt-BR" /> <meta name="description" content="OzzA - Apresentação do Layout" /> <meta name="keywords" content="OzzA - Apresentação do Layout" /> <meta name="author" content="Mais Interativo" /> <link rel="stylesheet" type="text/css" href="css/style.css" /> </head> <body> <div class="editarperfil-loja-dadospessoais-hover"> <div class="clearfix"></div> </div> </body> </html>
RuanBoaventura/ozza
editarperfil-loja-dadospessoais-hover.html
HTML
apache-2.0
566
[ 30522, 1026, 999, 9986, 13874, 16129, 1028, 1026, 16129, 1028, 1026, 2132, 1028, 1026, 2516, 1028, 11472, 4143, 1011, 19804, 6810, 12380, 20808, 2079, 9621, 1026, 1013, 2516, 1028, 1026, 18804, 25869, 13462, 1027, 1000, 21183, 2546, 1011, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package localsearch.domainspecific.vehiclerouting.vrp.constraints.eq; import java.util.ArrayList; import localsearch.domainspecific.vehiclerouting.vrp.IConstraintVR; import localsearch.domainspecific.vehiclerouting.vrp.IFunctionVR; import localsearch.domainspecific.vehiclerouting.vrp.VRManager; import localsearch.domainspecific.vehiclerouting.vrp.entities.Point; public class EqFunctionFunction implements IConstraintVR { private IFunctionVR f1; private IFunctionVR f2; private int violations; public EqFunctionFunction(IFunctionVR f1, IFunctionVR f2){ // f1 <= f2 this.f1 = f1; this.f2 = f2; f1.getVRManager().post(this); } public VRManager getVRManager() { // TODO Auto-generated method stub return f1.getVRManager(); } public void initPropagation() { // TODO Auto-generated method stub violations = f1.getValue() == f2.getValue() ? 0 : (int)Math.abs(f1.getValue() - f2.getValue()); } public void propagateOnePointMove(Point x, Point y) { // TODO Auto-generated method stub initPropagation(); } public void propagateTwoPointsMove(Point x, Point y) { // TODO Auto-generated method stub initPropagation(); } public void propagateTwoOptMove1(Point x, Point y) { // TODO Auto-generated method stub initPropagation(); } public void propagateTwoOptMove2(Point x, Point y) { // TODO Auto-generated method stub initPropagation(); } public void propagateTwoOptMove3(Point x, Point y) { // TODO Auto-generated method stub initPropagation(); } public void propagateTwoOptMove4(Point x, Point y) { // TODO Auto-generated method stub initPropagation(); } public void propagateTwoOptMove5(Point x, Point y) { // TODO Auto-generated method stub initPropagation(); } public void propagateTwoOptMove6(Point x, Point y) { // TODO Auto-generated method stub initPropagation(); } public void propagateTwoOptMove7(Point x, Point y) { // TODO Auto-generated method stub initPropagation(); } public void propagateTwoOptMove8(Point x, Point y) { // TODO Auto-generated method stub initPropagation(); } public void propagateOrOptMove1(Point x1, Point x2, Point y) { // TODO Auto-generated method stub initPropagation(); } public void propagateOrOptMove2(Point x1, Point x2, Point y) { // TODO Auto-generated method stub initPropagation(); } public void propagateThreeOptMove1(Point x, Point y, Point z) { // TODO Auto-generated method stub initPropagation(); } public void propagateThreeOptMove2(Point x, Point y, Point z) { // TODO Auto-generated method stub initPropagation(); } public void propagateThreeOptMove3(Point x, Point y, Point z) { // TODO Auto-generated method stub initPropagation(); } public void propagateThreeOptMove4(Point x, Point y, Point z) { // TODO Auto-generated method stub initPropagation(); } public void propagateThreeOptMove5(Point x, Point y, Point z) { // TODO Auto-generated method stub initPropagation(); } public void propagateThreeOptMove6(Point x, Point y, Point z) { // TODO Auto-generated method stub initPropagation(); } public void propagateThreeOptMove7(Point x, Point y, Point z) { // TODO Auto-generated method stub initPropagation(); } public void propagateThreeOptMove8(Point x, Point y, Point z) { // TODO Auto-generated method stub initPropagation(); } public void propagateCrossExchangeMove(Point x1, Point y1, Point x2, Point y2) { // TODO Auto-generated method stub initPropagation(); } public void propagateTwoPointsMove(Point x1, Point x2, Point y1, Point y2) { // TODO Auto-generated method stub initPropagation(); } public void propagateThreePointsMove(Point x1, Point x2, Point x3, Point y1, Point y2, Point y3) { // TODO Auto-generated method stub initPropagation(); } public void propagateFourPointsMove(Point x1, Point x2, Point x3, Point x4, Point y1, Point y2, Point y3, Point y4) { // TODO Auto-generated method stub initPropagation(); } public void propagateKPointsMove(ArrayList<Point> x, ArrayList<Point> y) { // TODO Auto-generated method stub initPropagation(); } public void propagateAddOnePoint(Point x, Point y) { // TODO Auto-generated method stub initPropagation(); } public void propagateRemoveOnePoint(Point x) { // TODO Auto-generated method stub initPropagation(); } public void propagateAddTwoPoints(Point x1, Point y1, Point x2, Point y2) { // TODO Auto-generated method stub initPropagation(); } public void propagateRemoveTwoPoints(Point x1, Point x2) { // TODO Auto-generated method stub initPropagation(); } public void propagateAddRemovePoints(Point x, Point y, Point z) { // TODO Auto-generated method stub initPropagation(); } public String name() { // TODO Auto-generated method stub return "EqFunctionFunction"; } public int violations() { // TODO Auto-generated method stub return violations; } public int evaluateOnePointMove(Point x, Point y) { // TODO Auto-generated method stub double nf1 = f1.evaluateOnePointMove(x, y) + f1.getValue(); double nf2 = f2.evaluateOnePointMove(x, y) + f2.getValue(); int nv = nf1 == nf2 ? 0 : (int)Math.abs(nf1-nf2); return nv - violations; } public int evaluateTwoPointsMove(Point x, Point y) { // TODO Auto-generated method stub double nf1 = f1.evaluateTwoPointsMove(x, y) + f1.getValue(); double nf2 = f2.evaluateTwoPointsMove(x, y) + f2.getValue(); int nv = nf1 == nf2 ? 0 : (int)Math.abs(nf1-nf2); return nv - violations; } public int evaluateTwoOptMove1(Point x, Point y) { // TODO Auto-generated method stub double nf1 = f1.evaluateTwoOptMove1(x, y) + f1.getValue(); double nf2 = f2.evaluateTwoOptMove1(x, y) + f2.getValue(); int nv = nf1 == nf2 ? 0 : (int)Math.abs(nf1-nf2); return nv - violations; } public int evaluateTwoOptMove2(Point x, Point y) { // TODO Auto-generated method stub double nf1 = f1.evaluateTwoOptMove2(x, y) + f1.getValue(); double nf2 = f2.evaluateTwoOptMove2(x, y) + f2.getValue(); int nv = nf1 == nf2 ? 0 : (int)Math.abs(nf1-nf2); return nv - violations; } public int evaluateTwoOptMove3(Point x, Point y) { // TODO Auto-generated method stub double nf1 = f1.evaluateTwoOptMove3(x, y) + f1.getValue(); double nf2 = f2.evaluateTwoOptMove3(x, y) + f2.getValue(); int nv = nf1 == nf2 ? 0 : (int)Math.abs(nf1-nf2); return nv - violations; } public int evaluateTwoOptMove4(Point x, Point y) { // TODO Auto-generated method stub double nf1 = f1.evaluateTwoOptMove4(x, y) + f1.getValue(); double nf2 = f2.evaluateTwoOptMove4(x, y) + f2.getValue(); int nv = nf1 == nf2 ? 0 : (int)Math.abs(nf1-nf2); return nv - violations; } public int evaluateTwoOptMove5(Point x, Point y) { // TODO Auto-generated method stub double nf1 = f1.evaluateTwoOptMove5(x, y) + f1.getValue(); double nf2 = f2.evaluateTwoOptMove5(x, y) + f2.getValue(); int nv = nf1 == nf2 ? 0 : (int)Math.abs(nf1-nf2); return nv - violations; } public int evaluateTwoOptMove6(Point x, Point y) { // TODO Auto-generated method stub double nf1 = f1.evaluateTwoOptMove6(x, y) + f1.getValue(); double nf2 = f2.evaluateTwoOptMove6(x, y) + f2.getValue(); int nv = nf1 == nf2 ? 0 : (int)Math.abs(nf1-nf2); return nv - violations; } public int evaluateTwoOptMove7(Point x, Point y) { // TODO Auto-generated method stub double nf1 = f1.evaluateTwoOptMove7(x, y) + f1.getValue(); double nf2 = f2.evaluateTwoOptMove7(x, y) + f2.getValue(); int nv = nf1 == nf2 ? 0 : (int)Math.abs(nf1-nf2); return nv - violations; } public int evaluateTwoOptMove8(Point x, Point y) { // TODO Auto-generated method stub double nf1 = f1.evaluateTwoOptMove8(x, y) + f1.getValue(); double nf2 = f2.evaluateTwoOptMove8(x, y) + f2.getValue(); int nv = nf1 == nf2 ? 0 : (int)Math.abs(nf1-nf2); return nv - violations; } public int evaluateOrOptMove1(Point x1, Point x2, Point y) { // TODO Auto-generated method stub double nf1 = f1.evaluateOrOptMove1(x1, x2, y) + f1.getValue(); double nf2 = f2.evaluateOrOptMove1(x1, x2, y) + f2.getValue(); int nv = nf1 == nf2 ? 0 : (int)Math.abs(nf1-nf2); return nv - violations; } public int evaluateOrOptMove2(Point x1, Point x2, Point y) { // TODO Auto-generated method stub double nf1 = f1.evaluateOrOptMove2(x1, x2, y) + f1.getValue(); double nf2 = f2.evaluateOrOptMove2(x1, x2, y) + f2.getValue(); int nv = nf1 == nf2 ? 0 : (int)Math.abs(nf1-nf2); return nv - violations; } public int evaluateThreeOptMove1(Point x, Point y, Point z) { // TODO Auto-generated method stub double nf1 = f1.evaluateThreeOptMove1(x, y, z) + f1.getValue(); double nf2 = f2.evaluateThreeOptMove1(x, y, z) + f2.getValue(); int nv = nf1 == nf2 ? 0 : (int)Math.abs(nf1-nf2); return nv - violations; } public int evaluateThreeOptMove2(Point x, Point y, Point z) { // TODO Auto-generated method stub double nf1 = f1.evaluateThreeOptMove2(x, y, z) + f1.getValue(); double nf2 = f2.evaluateThreeOptMove2(x, y, z) + f2.getValue(); int nv = nf1 == nf2 ? 0 : (int)Math.abs(nf1-nf2); return nv - violations; } public int evaluateThreeOptMove3(Point x, Point y, Point z) { // TODO Auto-generated method stub double nf1 = f1.evaluateThreeOptMove3(x, y, z) + f1.getValue(); double nf2 = f2.evaluateThreeOptMove3(x, y, z) + f2.getValue(); int nv = nf1 == nf2 ? 0 : (int)Math.abs(nf1-nf2); return nv - violations; } public int evaluateThreeOptMove4(Point x, Point y, Point z) { // TODO Auto-generated method stub double nf1 = f1.evaluateThreeOptMove4(x, y, z) + f1.getValue(); double nf2 = f2.evaluateThreeOptMove4(x, y, z) + f2.getValue(); int nv = nf1 == nf2 ? 0 : (int)Math.abs(nf1-nf2); return nv - violations; } public int evaluateThreeOptMove5(Point x, Point y, Point z) { // TODO Auto-generated method stub double nf1 = f1.evaluateThreeOptMove5(x, y, z) + f1.getValue(); double nf2 = f2.evaluateThreeOptMove5(x, y, z) + f2.getValue(); int nv = nf1 == nf2 ? 0 : (int)Math.abs(nf1-nf2); return nv - violations; } public int evaluateThreeOptMove6(Point x, Point y, Point z) { // TODO Auto-generated method stub double nf1 = f1.evaluateThreeOptMove6(x, y, z) + f1.getValue(); double nf2 = f2.evaluateThreeOptMove6(x, y, z) + f2.getValue(); int nv = nf1 == nf2 ? 0 : (int)Math.abs(nf1-nf2); return nv - violations; } public int evaluateThreeOptMove7(Point x, Point y, Point z) { // TODO Auto-generated method stub double nf1 = f1.evaluateThreeOptMove7(x, y, z) + f1.getValue(); double nf2 = f2.evaluateThreeOptMove7(x, y, z) + f2.getValue(); int nv = nf1 == nf2 ? 0 : (int)Math.abs(nf1-nf2); return nv - violations; } public int evaluateThreeOptMove8(Point x, Point y, Point z) { // TODO Auto-generated method stub double nf1 = f1.evaluateThreeOptMove8(x, y, z) + f1.getValue(); double nf2 = f2.evaluateThreeOptMove8(x, y, z) + f2.getValue(); int nv = nf1 == nf2 ? 0 : (int)Math.abs(nf1-nf2); return nv - violations; } public int evaluateCrossExchangeMove(Point x1, Point y1, Point x2, Point y2) { // TODO Auto-generated method stub double nf1 = f1.evaluateCrossExchangeMove(x1, y1, x2, y2) + f1.getValue(); double nf2 = f2.evaluateCrossExchangeMove(x1, y1, x2, y2) + f2.getValue(); int nv = nf1 == nf2 ? 0 : (int)Math.abs(nf1-nf2); return nv - violations; } public int evaluateTwoPointsMove(Point x1, Point x2, Point y1, Point y2) { // TODO Auto-generated method stub double nf1 = f1.evaluateTwoPointsMove(x1, x2, y1, y2) + f1.getValue(); double nf2 = f2.evaluateTwoPointsMove(x1, x2, y1, y2) + f2.getValue(); int nv = nf1 == nf2 ? 0 : (int)Math.abs(nf1-nf2); return nv - violations; } public int evaluateThreePointsMove(Point x1, Point x2, Point x3, Point y1, Point y2, Point y3) { // TODO Auto-generated method stub double nf1 = f1.evaluateThreePointsMove(x1, x2, x3, y1, y2, y3) + f1.getValue(); double nf2 = f2.evaluateThreePointsMove(x1, x2, x3, y1, y2, y3) + f2.getValue(); int nv = nf1 == nf2 ? 0 : (int)Math.abs(nf1-nf2); return nv - violations; } public int evaluateFourPointsMove(Point x1, Point x2, Point x3, Point x4, Point y1, Point y2, Point y3, Point y4) { // TODO Auto-generated method stub double nf1 = f1.evaluateFourPointsMove(x1, x2, x3, x4, y1, y2, y3, y4) + f1.getValue(); double nf2 = f2.evaluateFourPointsMove(x1, x2, x3, x4, y1, y2, y3, y4) + f2.getValue(); int nv = nf1 == nf2 ? 0 : (int)Math.abs(nf1-nf2); return nv - violations; } public int evaluateKPointsMove(ArrayList<Point> x, ArrayList<Point> y) { // TODO Auto-generated method stub double nf1 = f1.evaluateKPointsMove(x, y) + f1.getValue(); double nf2 = f2.evaluateKPointsMove(x, y) + f2.getValue(); int nv = nf1 == nf2 ? 0 : (int)Math.abs(nf1-nf2); return nv - violations; } public int evaluateAddOnePoint(Point x, Point y) { // TODO Auto-generated method stub double nf1 = f1.evaluateAddOnePoint(x, y) + f1.getValue(); double nf2 = f2.evaluateAddOnePoint(x, y) + f2.getValue(); int nv = nf1 == nf2 ? 0 : (int)Math.abs(nf1-nf2); return nv - violations; } public int evaluateRemoveOnePoint(Point x) { // TODO Auto-generated method stub double nf1 = f1.evaluateRemoveOnePoint(x) + f1.getValue(); double nf2 = f2.evaluateRemoveOnePoint(x) + f2.getValue(); int nv = nf1 == nf2 ? 0 : (int)Math.abs(nf1-nf2); return nv - violations; } public int evaluateAddTwoPoints(Point x1, Point y1, Point x2, Point y2) { // TODO Auto-generated method stub double nf1 = f1.evaluateAddTwoPoints(x1, y1, x2, y2) + f1.getValue(); double nf2 = f2.evaluateAddTwoPoints(x1, y1, x2, y2) + f2.getValue(); int nv = nf1 == nf2 ? 0 : (int)Math.abs(nf1-nf2); return nv - violations; } public int evaluateRemoveTwoPoints(Point x1, Point x2) { // TODO Auto-generated method stub double nf1 = f1.evaluateRemoveTwoPoints(x1, x2) + f1.getValue(); double nf2 = f2.evaluateRemoveTwoPoints(x1, x2) + f2.getValue(); int nv = nf1 == nf2 ? 0 : (int)Math.abs(nf1-nf2); return nv - violations; } public int evaluateAddRemovePoints(Point x, Point y, Point z) { // TODO Auto-generated method stub double nf1 = f1.evaluateAddRemovePoints(x, y, z) + f1.getValue(); double nf2 = f2.evaluateAddRemovePoints(x, y, z) + f2.getValue(); int nv = nf1 == nf2 ? 0 : (int)Math.abs(nf1-nf2); return nv - violations; } @Override public void propagateTwoOptMoveOneRoute(Point x, Point y) { // TODO Auto-generated method stub } }
dungkhmt/cblsvr
src/localsearch/domainspecific/vehiclerouting/vrp/constraints/eq/EqFunctionFunction.java
Java
bsd-2-clause
14,616
[ 30522, 7427, 10575, 14644, 2818, 1012, 13100, 5051, 6895, 8873, 2278, 1012, 4316, 22494, 3436, 1012, 27830, 2361, 1012, 14679, 1012, 1041, 4160, 1025, 12324, 9262, 1012, 21183, 4014, 1012, 9140, 9863, 1025, 12324, 10575, 14644, 2818, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php namespace TYPO3\CMS\Beuser\Controller; /* * This file is part of the TYPO3 CMS project. * * It is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License, either version 2 * of the License, or any later version. * * For the full copyright and license information, please read the * LICENSE.txt file that was distributed with this source code. * * The TYPO3 project - inspiring people to share! */ use TYPO3\CMS\Backend\Template\Components\ButtonBar; use TYPO3\CMS\Backend\Tree\View\PageTreeView; use TYPO3\CMS\Backend\Utility\BackendUtility; use TYPO3\CMS\Backend\View\BackendTemplateView; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Imaging\Icon; use TYPO3\CMS\Core\Messaging\FlashMessage; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; use TYPO3\CMS\Extbase\Mvc\View\ViewInterface; use TYPO3\CMS\Extbase\Utility\LocalizationUtility; /** * Backend module page permissions */ class PermissionController extends ActionController { /** * @var string prefix for session */ const SESSION_PREFIX = 'tx_Beuser_'; /** * @var int the current page id */ protected $id; /** * @var int */ protected $returnId; /** * @var int */ protected $depth; /** * @var int */ protected $lastEdited; /** * Number of levels to enable recursive settings for * * @var int */ protected $getLevels = 10; /** * @var array */ protected $pageInfo = []; /** * Backend Template Container * * @var string */ protected $defaultViewObjectName = BackendTemplateView::class; /** * BackendTemplateContainer * * @var BackendTemplateView */ protected $view; /** * Initialize action */ protected function initializeAction() { // determine id parameter $this->id = (int)GeneralUtility::_GP('id'); if ($this->request->hasArgument('id')) { $this->id = (int)$this->request->getArgument('id'); } // determine depth parameter $this->depth = ((int)GeneralUtility::_GP('depth') > 0) ? (int) GeneralUtility::_GP('depth') : $this->getBackendUser()->getSessionData(self::SESSION_PREFIX . 'depth'); if ($this->request->hasArgument('depth')) { $this->depth = (int)$this->request->getArgument('depth'); } $this->getBackendUser()->setAndSaveSessionData(self::SESSION_PREFIX . 'depth', $this->depth); $this->lastEdited = GeneralUtility::_GP('lastEdited'); $this->returnId = GeneralUtility::_GP('returnId'); $this->pageInfo = BackendUtility::readPageAccess($this->id, ' 1=1'); } /** * Initializes view * * @param ViewInterface $view The view to be initialized */ protected function initializeView(ViewInterface $view) { parent::initializeView($view); $view->assign( 'previewUrl', BackendUtility::viewOnClick( (int)$this->pageInfo['uid'], '', BackendUtility::BEgetRootLine((int)$this->pageInfo['uid']) ) ); // the view of the update action has a different view class if ($view instanceof BackendTemplateView) { $view->getModuleTemplate()->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Beuser/Permissions'); $view->getModuleTemplate()->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/Tooltip'); $view->getModuleTemplate()->addJavaScriptCode( 'jumpToUrl', ' function jumpToUrl(URL) { window.location.href = URL; return false; } ' ); $this->registerDocHeaderButtons(); $this->view->getModuleTemplate()->setFlashMessageQueue($this->controllerContext->getFlashMessageQueue()); } } /** * Registers the Icons into the docheader * * @throws \InvalidArgumentException */ protected function registerDocHeaderButtons() { /** @var ButtonBar $buttonBar */ $buttonBar = $this->view->getModuleTemplate()->getDocHeaderComponent()->getButtonBar(); $currentRequest = $this->request; $moduleName = $currentRequest->getPluginName(); $getVars = $this->request->getArguments(); $lang = $this->getLanguageService(); $extensionName = $currentRequest->getControllerExtensionName(); if (empty($getVars)) { $modulePrefix = strtolower('tx_' . $extensionName . '_' . $moduleName); $getVars = ['id', 'M', $modulePrefix]; } if ($currentRequest->getControllerActionName() === 'edit') { // CLOSE button: $closeUrl = $this->uriBuilder->reset()->setArguments([ 'action' => 'index', 'id' => $this->id ])->buildBackendUri(); $closeButton = $buttonBar->makeLinkButton() ->setHref($closeUrl) ->setTitle($lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:rm.closeDoc')) ->setIcon($this->view->getModuleTemplate()->getIconFactory()->getIcon( 'actions-close', Icon::SIZE_SMALL )); $buttonBar->addButton($closeButton); // SAVE button: $saveButton = $buttonBar->makeInputButton() ->setTitle($lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:rm.saveCloseDoc')) ->setName('tx_beuser_system_beusertxpermission[submit]') ->setValue('Save') ->setForm('PermissionControllerEdit') ->setIcon($this->view->getModuleTemplate()->getIconFactory()->getIcon( 'actions-document-save', Icon::SIZE_SMALL )) ->setShowLabelText(true); $buttonBar->addButton($saveButton); } // SHORTCUT botton: $shortcutButton = $buttonBar->makeShortcutButton() ->setModuleName($moduleName) ->setGetVariables($getVars); $buttonBar->addButton($shortcutButton); } /** * Index action */ public function indexAction() { if (!$this->id) { $this->pageInfo = ['title' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'], 'uid' => 0, 'pid' => 0]; } if ($this->getBackendUser()->workspace != 0) { // Adding section with the permission setting matrix: $this->addFlashMessage( LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:WorkspaceWarningText', 'beuser'), LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:WorkspaceWarning', 'beuser'), FlashMessage::WARNING ); } // depth options $depthOptions = []; $url = $this->uriBuilder->reset()->setArguments([ 'action' => 'index', 'depth' => '__DEPTH__', 'id' => $this->id ])->buildBackendUri(); foreach ([1, 2, 3, 4, 10] as $depthLevel) { $levelLabel = $depthLevel === 1 ? 'level' : 'levels'; $depthOptions[$depthLevel] = $depthLevel . ' ' . LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:' . $levelLabel, 'beuser'); } $this->view->assign('depthBaseUrl', $url); $this->view->assign('depth', $this->depth); $this->view->assign('depthOptions', $depthOptions); $beUserArray = BackendUtility::getUserNames(); $this->view->assign('beUsers', $beUserArray); $beGroupArray = BackendUtility::getGroupNames(); $this->view->assign('beGroups', $beGroupArray); /** @var $tree PageTreeView */ $tree = GeneralUtility::makeInstance(PageTreeView::class); $tree->init(); $tree->addField('perms_user', true); $tree->addField('perms_group', true); $tree->addField('perms_everybody', true); $tree->addField('perms_userid', true); $tree->addField('perms_groupid', true); $tree->addField('hidden'); $tree->addField('fe_group'); $tree->addField('starttime'); $tree->addField('endtime'); $tree->addField('editlock'); // Create the tree from $this->id if ($this->id) { $tree->tree[] = ['row' => $this->pageInfo, 'HTML' => $tree->getIcon($this->id)]; } else { $tree->tree[] = ['row' => $this->pageInfo, 'HTML' => $tree->getRootIcon($this->pageInfo)]; } $tree->getTree($this->id, $this->depth); $this->view->assign('viewTree', $tree->tree); // CSH for permissions setting $this->view->assign('cshItem', BackendUtility::cshItem('xMOD_csh_corebe', 'perm_module', null, '<span class="btn btn-default btn-sm">|</span>')); } /** * Edit action */ public function editAction() { $this->view->assign('id', $this->id); $this->view->assign('depth', $this->depth); if (!$this->id) { $this->pageInfo = ['title' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'], 'uid' => 0, 'pid' => 0]; } if ($this->getBackendUser()->workspace != 0) { // Adding FlashMessage with the permission setting matrix: $this->addFlashMessage( LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:WorkspaceWarningText', 'beuser'), LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:WorkspaceWarning', 'beuser'), FlashMessage::WARNING ); } // Get usernames and groupnames $beGroupArray = BackendUtility::getListGroupNames('title,uid'); $beUserArray = BackendUtility::getUserNames(); // Owner selector $beUserDataArray = [0 => LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:selectNone', 'beuser')]; foreach ($beUserArray as $uid => &$row) { $beUserDataArray[$uid] = $row['username']; } $beUserDataArray[-1] = LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:selectUnchanged', 'beuser'); $this->view->assign('currentBeUser', $this->pageInfo['perms_userid']); $this->view->assign('beUserData', $beUserDataArray); // Group selector $beGroupDataArray = [0 => LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:selectNone', 'beuser')]; foreach ($beGroupArray as $uid => $row) { $beGroupDataArray[$uid] = $row['title']; } $beGroupDataArray[-1] = LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:selectUnchanged', 'beuser'); $this->view->assign('currentBeGroup', $this->pageInfo['perms_groupid']); $this->view->assign('beGroupData', $beGroupDataArray); $this->view->assign('pageInfo', $this->pageInfo); $this->view->assign('returnId', $this->returnId); $this->view->assign('recursiveSelectOptions', $this->getRecursiveSelectOptions()); } /** * Update action * * @param array $data * @param array $mirror */ protected function updateAction(array $data, array $mirror) { if (!empty($data['pages'])) { foreach ($data['pages'] as $pageUid => $properties) { // if the owner and group field shouldn't be touched, unset the option if ((int)$properties['perms_userid'] === -1) { unset($properties['perms_userid']); } if ((int)$properties['perms_groupid'] === -1) { unset($properties['perms_groupid']); } $connection = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable('pages'); $connection->update( 'pages', $properties, ['uid' => (int)$pageUid] ); if (!empty($mirror['pages'][$pageUid])) { $mirrorPages = GeneralUtility::trimExplode(',', $mirror['pages'][$pageUid]); foreach ($mirrorPages as $mirrorPageUid) { $connection->update( 'pages', $properties, ['uid' => (int)$mirrorPageUid] ); } } } } $this->redirect('index', null, null, ['id' => $this->returnId, 'depth' => $this->depth]); } /** * @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication */ protected function getBackendUser() { return $GLOBALS['BE_USER']; } /** * Finding tree and offer setting of values recursively. * * @return array */ protected function getRecursiveSelectOptions() { // Initialize tree object: $tree = GeneralUtility::makeInstance(PageTreeView::class); $tree->init(); $tree->addField('perms_userid', true); $tree->makeHTML = 0; $tree->setRecs = 1; // Make tree: $tree->getTree($this->id, $this->getLevels, ''); $options = []; $options[''] = ''; // If there are a hierarchy of page ids, then... if ($this->getBackendUser()->user['uid'] && !empty($tree->orig_ids_hierarchy)) { // Init: $labelRecursive = LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:recursive', 'beuser'); $labelLevel = LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:level', 'beuser'); $labelLevels = LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:levels', 'beuser'); $labelPageAffected = LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:page_affected', 'beuser'); $labelPagesAffected = LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:pages_affected', 'beuser'); $theIdListArr = []; // Traverse the number of levels we want to allow recursive // setting of permissions for: for ($a = $this->getLevels; $a > 0; $a--) { if (is_array($tree->orig_ids_hierarchy[$a])) { foreach ($tree->orig_ids_hierarchy[$a] as $theId) { $theIdListArr[] = $theId; } $lKey = $this->getLevels - $a + 1; $pagesCount = count($theIdListArr); $options[implode(',', $theIdListArr)] = $labelRecursive . ' ' . $lKey . ' ' . ($lKey === 1 ? $labelLevel : $labelLevels) . ' (' . $pagesCount . ' ' . ($pagesCount === 1 ? $labelPageAffected : $labelPagesAffected) . ')'; } } } return $options; } /** * Returns LanguageService * * @return \TYPO3\CMS\Lang\LanguageService */ protected function getLanguageService() { return $GLOBALS['LANG']; } }
ksjogo/TYPO3.CMS
typo3/sysext/beuser/Classes/Controller/PermissionController.php
PHP
gpl-2.0
15,936
[ 30522, 1026, 1029, 25718, 3415, 15327, 5939, 6873, 2509, 1032, 4642, 2015, 1032, 2022, 20330, 1032, 11486, 1025, 1013, 1008, 1008, 2023, 5371, 2003, 2112, 1997, 1996, 5939, 6873, 2509, 4642, 2015, 2622, 1012, 1008, 1008, 2009, 2003, 2489, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>hammer-tactics: Not compatible 👼</title> <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" /> <link href="../../../../../bootstrap.min.css" rel="stylesheet"> <link href="../../../../../bootstrap-custom.css" rel="stylesheet"> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <script src="../../../../../moment.min.js"></script> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <div class="container"> <div class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="../..">clean / released</a></li> <li class="active"><a href="">8.13.1 / hammer-tactics - 1.3+8.12</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> hammer-tactics <small> 1.3+8.12 <span class="label label-info">Not compatible 👼</span> </small> </h1> <p>📅 <em><script>document.write(moment("2022-01-13 08:04:05 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-01-13 08:04:05 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-threads base base-unix base conf-findutils 1 Virtual package relying on findutils conf-gmp 3 Virtual package relying on a GMP lib system installation coq 8.13.1 Formal proof management system num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic ocaml 4.10.2 The OCaml compiler (virtual package) ocaml-base-compiler 4.10.2 Official release 4.10.2 ocaml-config 1 OCaml Switch Configuration ocamlfind 1.9.1 A library manager for OCaml zarith 1.12 Implements arithmetic and logical operations over arbitrary-precision integers # opam file: opam-version: &quot;2.0&quot; maintainer: &quot;palmskog@gmail.com&quot; homepage: &quot;https://github.com/lukaszcz/coqhammer&quot; dev-repo: &quot;git+https://github.com/lukaszcz/coqhammer.git&quot; bug-reports: &quot;https://github.com/lukaszcz/coqhammer/issues&quot; license: &quot;LGPL-2.1-only&quot; synopsis: &quot;Reconstruction tactics for the hammer for Coq&quot; description: &quot;&quot;&quot; Collection of tactics that are used by the hammer for Coq to reconstruct proofs found by automated theorem provers. When the hammer has been successfully applied to a project, only this package needs to be installed; the hammer plugin is not required. &quot;&quot;&quot; build: [make &quot;-j%{jobs}%&quot; {ocaml:version &gt;= &quot;4.06&quot;} &quot;tactics&quot;] install: [ [make &quot;install-tactics&quot;] [make &quot;test-tactics&quot;] {with-test} ] depends: [ &quot;ocaml&quot; &quot;coq&quot; {&gt;= &quot;8.12&quot; &amp; &lt; &quot;8.13~&quot;} ] conflicts: [ &quot;coq-hammer&quot; {!= version} ] tags: [ &quot;keyword:automation&quot; &quot;keyword:hammer&quot; &quot;keyword:tactics&quot; &quot;logpath:Hammer.Tactics&quot; &quot;date:2020-07-28&quot; ] authors: [ &quot;Lukasz Czajka &lt;lukaszcz@mimuw.edu.pl&gt;&quot; ] url { src: &quot;https://github.com/lukaszcz/coqhammer/archive/v1.3-coq8.12.tar.gz&quot; checksum: &quot;sha512=666ea825c122319e398efb7287f429ebfb5d35611b4cabe4b88732ffb5c265ef348b53d5046c958831ac0b7a759b44ce1ca04220ca68b1915accfd23435b479c&quot; } </pre> <h2>Lint</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Dry install 🏜️</h2> <p>Dry install with the current Coq version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam install -y --show-action coq-hammer-tactics.1.3+8.12 coq.8.13.1</code></dd> <dt>Return code</dt> <dd>5120</dd> <dt>Output</dt> <dd><pre>[NOTE] Package coq is already installed (current version is 8.13.1). The following dependencies couldn&#39;t be met: - coq-hammer-tactics -&gt; coq &lt; 8.13~ -&gt; ocaml &lt; 4.10 base of this switch (use `--unlock-base&#39; to force) Your request can&#39;t be satisfied: - No available version of coq satisfies the constraints No solution found, exiting </pre></dd> </dl> <p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-hammer-tactics.1.3+8.12</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Install dependencies</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Install 🚀</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Installation size</h2> <p>No files were installed.</p> <h2>Uninstall 🧹</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Missing removes</dt> <dd> none </dd> <dt>Wrong removes</dt> <dd> none </dd> </dl> </div> </div> </div> <hr/> <div class="footer"> <p class="text-center"> Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣 </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
coq-bench/coq-bench.github.io
clean/Linux-x86_64-4.10.2-2.0.6/released/8.13.1/hammer-tactics/1.3+8.12.html
HTML
mit
7,419
[ 30522, 1026, 999, 9986, 13874, 16129, 1028, 1026, 16129, 11374, 1027, 1000, 4372, 1000, 1028, 1026, 2132, 1028, 1026, 18804, 25869, 13462, 1027, 1000, 21183, 2546, 1011, 1022, 1000, 1028, 1026, 18804, 2171, 1027, 1000, 3193, 6442, 1000, 418...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package com.saq.android.data; import java.util.ArrayList; import org.w3c.dom.Element; import org.w3c.dom.NodeList; public class CategoryReference extends ReferenceWithParent { private static final String SUB_CATEGORY_TAG = "sousCategorie"; public CategoryReference(ReferenceWithParent p) { super(p); } public void inflateFromXml(Element element) throws Exception { super.inflateFromXml(element); NodeList nodes = element.getChildNodes(); for (int i = 0; i < nodes.getLength(); i++) { if (nodes.item(i).getNodeName().equals(SUB_CATEGORY_TAG)) { if (this.subReferences == null) { this.subReferences = new ArrayList(); } CategoryReference cr = new CategoryReference(this); cr.inflateFromXml((Element) nodes.item(i)); this.subReferences.add(cr); } } } }
cipicip/android
saq.forked/app/src/main/java/com/saq/android/data/CategoryReference.java
Java
apache-2.0
938
[ 30522, 7427, 4012, 1012, 7842, 4160, 1012, 11924, 1012, 2951, 1025, 12324, 9262, 1012, 21183, 4014, 1012, 9140, 9863, 1025, 12324, 8917, 1012, 1059, 2509, 2278, 1012, 14383, 1012, 5783, 1025, 12324, 8917, 1012, 1059, 2509, 2278, 1012, 14383...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// // stream_handle.cpp // ~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include "asio/windows/stream_handle.hpp" #include "asio/io_context.hpp" #include "../archetypes/async_result.hpp" #include "../unit_test.hpp" //------------------------------------------------------------------------------ // windows_stream_handle_compile test // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // The following test checks that all public member functions on the class // windows::stream_handle compile and link correctly. Runtime failures are // ignored. namespace windows_stream_handle_compile { void write_some_handler(const asio::error_code&, std::size_t) { } void read_some_handler(const asio::error_code&, std::size_t) { } void test() { #if defined(ASIO_HAS_WINDOWS_STREAM_HANDLE) using namespace asio; namespace win = asio::windows; try { io_context ioc; char mutable_char_buffer[128] = ""; const char const_char_buffer[128] = ""; archetypes::lazy_handler lazy; asio::error_code ec; // basic_stream_handle constructors. win::stream_handle handle1(ioc); HANDLE native_handle1 = INVALID_HANDLE_VALUE; win::stream_handle handle2(ioc, native_handle1); #if defined(ASIO_HAS_MOVE) win::stream_handle handle3(std::move(handle2)); #endif // defined(ASIO_HAS_MOVE) // basic_stream_handle operators. #if defined(ASIO_HAS_MOVE) handle1 = win::stream_handle(ioc); handle1 = std::move(handle2); #endif // defined(ASIO_HAS_MOVE) // basic_io_object functions. #if !defined(ASIO_NO_DEPRECATED) io_context& ioc_ref = handle1.get_io_context(); (void)ioc_ref; #endif // !defined(ASIO_NO_DEPRECATED) io_context::executor_type ex = handle1.get_executor(); (void)ex; // basic_handle functions. win::stream_handle::lowest_layer_type& lowest_layer = handle1.lowest_layer(); (void)lowest_layer; const win::stream_handle& handle4 = handle1; const win::stream_handle::lowest_layer_type& lowest_layer2 = handle4.lowest_layer(); (void)lowest_layer2; HANDLE native_handle2 = INVALID_HANDLE_VALUE; handle1.assign(native_handle2); bool is_open = handle1.is_open(); (void)is_open; handle1.close(); handle1.close(ec); win::stream_handle::native_handle_type native_handle3 = handle1.native_handle(); (void)native_handle3; handle1.cancel(); handle1.cancel(ec); // basic_stream_handle functions. handle1.write_some(buffer(mutable_char_buffer)); handle1.write_some(buffer(const_char_buffer)); handle1.write_some(buffer(mutable_char_buffer), ec); handle1.write_some(buffer(const_char_buffer), ec); handle1.async_write_some(buffer(mutable_char_buffer), &write_some_handler); handle1.async_write_some(buffer(const_char_buffer), &write_some_handler); int i1 = handle1.async_write_some(buffer(mutable_char_buffer), lazy); (void)i1; int i2 = handle1.async_write_some(buffer(const_char_buffer), lazy); (void)i2; handle1.read_some(buffer(mutable_char_buffer)); handle1.read_some(buffer(mutable_char_buffer), ec); handle1.async_read_some(buffer(mutable_char_buffer), &read_some_handler); int i3 = handle1.async_read_some(buffer(mutable_char_buffer), lazy); (void)i3; } catch (std::exception&) { } #endif // defined(ASIO_HAS_WINDOWS_STREAM_HANDLE) } } // namespace windows_stream_handle_compile //------------------------------------------------------------------------------ ASIO_TEST_SUITE ( "windows/stream_handle", ASIO_TEST_CASE(windows_stream_handle_compile::test) )
onedata/helpers
deps/asio/asio/src/tests/unit/windows/stream_handle.cpp
C++
mit
3,974
[ 30522, 1013, 1013, 1013, 1013, 5460, 1035, 5047, 1012, 18133, 2361, 1013, 1013, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1013, 1013, 1013, 1013, 9385, 1006, 1039, 1007, 2494, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php /** * @author @jenschude <jens.schulze@commercetools.de> */ namespace Commercetools\Core\Request\Types\Command; use Commercetools\Core\Model\Common\Context; use Commercetools\Core\Model\Common\EnumCollection; use Commercetools\Core\Request\AbstractAction; /** * @package Commercetools\Core\Request\Types\Command * @link https://docs.commercetools.com/http-api-projects-types.html#change-the-order-of-enumvalues * @method string getAction() * @method TypeChangeEnumValueOrderAction setAction(string $action = null) * @method string getFieldName() * @method TypeChangeEnumValueOrderAction setFieldName(string $fieldName = null) * @method array getKeys() * @method TypeChangeEnumValueOrderAction setKeys(array $keys = null) */ class TypeChangeEnumValueOrderAction extends AbstractAction { public function fieldDefinitions() { return [ 'action' => [static::TYPE => 'string'], 'fieldName' => [static::TYPE => 'string'], 'keys' => [static::TYPE => 'array'] ]; } /** * @param array $data * @param Context|callable $context */ public function __construct(array $data = [], $context = null) { parent::__construct($data, $context); $this->setAction('changeEnumValueOrder'); } /** * @param string $fieldName * @param array $keys * @param Context|callable $context * @return TypeChangeEnumValueOrderAction */ public static function ofNameAndEnums($fieldName, array $keys, $context = null) { return static::of($context)->setFieldName($fieldName)->setKeys($keys); } }
sphereio/sphere-php-sdk
src/Core/Request/Types/Command/TypeChangeEnumValueOrderAction.php
PHP
mit
1,636
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 1008, 1030, 3166, 1030, 25093, 20760, 3207, 1026, 25093, 1012, 8040, 21886, 4371, 1030, 6236, 3406, 27896, 1012, 2139, 1028, 1008, 1013, 3415, 15327, 6236, 3406, 27896, 1032, 4563, 1032, 5227, 103...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/** * 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. */ package com.alibaba.rocketmq.client.hook; import java.util.Map; import com.alibaba.rocketmq.client.impl.CommunicationMode; import com.alibaba.rocketmq.client.producer.SendResult; import com.alibaba.rocketmq.common.message.Message; import com.alibaba.rocketmq.common.message.MessageQueue; public class SendMessageContext { private String producerGroup; private Message message; private MessageQueue mq; private String brokerAddr; private String bornHost; private CommunicationMode communicationMode; private SendResult sendResult; private Exception exception; private Object mqTraceContext; private Map<String, String> props; public String getProducerGroup() { return producerGroup; } public void setProducerGroup(String producerGroup) { this.producerGroup = producerGroup; } public Message getMessage() { return message; } public void setMessage(Message message) { this.message = message; } public MessageQueue getMq() { return mq; } public void setMq(MessageQueue mq) { this.mq = mq; } public String getBrokerAddr() { return brokerAddr; } public void setBrokerAddr(String brokerAddr) { this.brokerAddr = brokerAddr; } public CommunicationMode getCommunicationMode() { return communicationMode; } public void setCommunicationMode(CommunicationMode communicationMode) { this.communicationMode = communicationMode; } public SendResult getSendResult() { return sendResult; } public void setSendResult(SendResult sendResult) { this.sendResult = sendResult; } public Exception getException() { return exception; } public void setException(Exception exception) { this.exception = exception; } public Object getMqTraceContext() { return mqTraceContext; } public void setMqTraceContext(Object mqTraceContext) { this.mqTraceContext = mqTraceContext; } public Map<String, String> getProps() { return props; } public void setProps(Map<String, String> props) { this.props = props; } public String getBornHost() { return bornHost; } public void setBornHost(String bornHost) { this.bornHost = bornHost; } }
y123456yz/reading-and-annotate-rocketmq-3.4.6
rocketmq-src/RocketMQ-3.4.6/rocketmq-client/src/main/java/com/alibaba/rocketmq/client/hook/SendMessageContext.java
Java
gpl-3.0
3,205
[ 30522, 1013, 1008, 1008, 1008, 7000, 2000, 1996, 15895, 4007, 3192, 1006, 2004, 2546, 1007, 2104, 2028, 2030, 2062, 1008, 12130, 6105, 10540, 1012, 2156, 1996, 5060, 5371, 5500, 2007, 1008, 2023, 2147, 2005, 3176, 2592, 4953, 9385, 6095, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
const multiples = '(hundred|thousand|million|billion|trillion|quadrillion|quintillion|sextillion|septillion)' const here = 'fraction-tagger' // plural-ordinals like 'hundredths' are already tagged as Fraction by compromise const tagFractions = function (doc) { // hundred doc.match(multiples).tag('#Multiple', here) // half a penny doc.match('[(half|quarter)] of? (a|an)', 0).tag('Fraction', 'millionth') // nearly half doc.match('#Adverb [half]', 0).tag('Fraction', 'nearly-half') // half the doc.match('[half] the', 0).tag('Fraction', 'half-the') // two-halves doc.match('#Value (halves|halfs|quarters)').tag('Fraction', 'two-halves') // ---ordinals as fractions--- // a fifth doc.match('a #Ordinal').tag('Fraction', 'a-quarter') // seven fifths doc.match('(#Fraction && /s$/)').lookBefore('#Cardinal+$').tag('Fraction') // one third of .. doc.match('[#Cardinal+ #Ordinal] of .', 0).tag('Fraction', 'ordinal-of') // 100th of doc.match('[(#NumericValue && #Ordinal)] of .', 0).tag('Fraction', 'num-ordinal-of') // a twenty fifth doc.match('(a|one) #Cardinal?+ #Ordinal').tag('Fraction', 'a-ordinal') // doc.match('(a|one) [#Ordinal]', 0).tag('Fraction', 'a-ordinal') // values.if('#Ordinal$').tag('Fraction', '4-fifths') // seven quarters // values.tag('Fraction', '4-quarters') // doc.match('(#Value && !#Ordinal)+ (#Ordinal|#Fraction)').tag('Fraction', '4-fifths') // 12 and seven fifths // doc.match('#Value+ and #Value+ (#Ordinal|half|quarter|#Fraction)').tag('Fraction', 'val-and-ord') // fixups // doc.match('#Cardinal+? (second|seconds)').unTag('Fraction', '3 seconds') // doc.match('#Ordinal (half|quarter)').unTag('Fraction', '2nd quarter') // doc.match('#Ordinal #Ordinal+').unTag('Fraction') // doc.match('[#Cardinal+? (second|seconds)] of (a|an)', 0).tag('Fraction', here) // doc.match(multiples).tag('#Multiple', here) // // '3 out of 5' doc.match('#Cardinal+ out? of every? #Cardinal').tag('Fraction', here) // // one and a half // doc.match('#Cardinal and a (#Fraction && #Value)').tag('Fraction', here) // fraction - 'a third of a slice' // TODO:fixme // m = doc.match(`[(#Cardinal|a) ${ordinals}] of (a|an|the)`, 0).tag('Fraction', 'ord-of') // tag 'thirds' as a ordinal // m.match('.$').tag('Ordinal', 'plural-ordinal') return doc } module.exports = tagFractions
nlp-compromise/nlp_compromise
plugins/numbers/src/tagger/fractions.js
JavaScript
mit
2,380
[ 30522, 9530, 3367, 3674, 2015, 1027, 1005, 1006, 3634, 1064, 4595, 1064, 2454, 1064, 4551, 1064, 23458, 1064, 17718, 24714, 3258, 1064, 21864, 16778, 6894, 2239, 1064, 3348, 28345, 3258, 1064, 17419, 8591, 3258, 1007, 1005, 9530, 3367, 2182...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
import React from 'react' import { Container, Group, TabBar, Icon, Badge, amStyles, } from 'amazeui-touch' import {Link} from 'react-router' class App extends React.Component{ propsType ={ children:React.PropTypes.node } render(){ let { location, params, children, ...props } = this.props; let transition = children.props.transition || 'sfr' return ( <Container direction="column"> <Container transition={transition} > {children} </Container> <TabBar > <TabBar.Item component={Link} eventKey = 'home' active = {location.pathname === '/'} icon = 'home' title = '首页' to='/' /> <TabBar.Item component={Link} active={location.pathname === '/class'} eventKey="class" icon="list" title="课程" to='/class' /> <TabBar.Item active={location.pathname === '/search'} eventKey="search" icon="search" title="发现" /> <TabBar.Item component={Link} active={location.pathname === '/me'} eventKey="person" icon="person" title="我" to='/me' /> </TabBar> </Container> ) } } export default App
yiweimatou/yiweimatou-mobile
src/components/pages/app.js
JavaScript
mit
1,961
[ 30522, 12324, 10509, 2013, 1005, 10509, 1005, 12324, 1063, 11661, 1010, 2177, 1010, 21628, 8237, 1010, 12696, 1010, 10780, 1010, 2572, 21756, 4244, 1010, 1065, 2013, 1005, 25933, 4371, 10179, 1011, 3543, 1005, 12324, 1063, 4957, 1065, 2013, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
$(function () { var colors = Highcharts.getOptions().colors, categories = ['已关闭', 'NEW', '已解决'], name = 'Browser brands', data = [{ y: 290, color: colors[0], drilldown: { name: 'close bug version', categories: ['当前版本', '历史版本'], data: [20,270], color: colors[0] } }, { y: 64, color: colors[1], drilldown: { name: 'fix bug version', categories: ['当前版本', '历史版本'], data: [8,56], color: colors[1] } }, { y: 82, color: colors[2], drilldown: { name: 'NEW bug versions', categories: ['当前版本', '历史版本'], data: [5,77], color: colors[2] } }]; // Build the data arrays var browserData = []; var versionsData = []; for (var i = 0; i < data.length; i++) { // add browser data browserData.push({ name: categories[i], y: data[i].y, color: data[i].color }); // add version data for (var j = 0; j < data[i].drilldown.data.length; j++) { var brightness = 0.2 - (j / data[i].drilldown.data.length) / 5 ; versionsData.push({ name: data[i].drilldown.categories[j], y: data[i].drilldown.data[j], color: Highcharts.Color(data[i].color).brighten(brightness).get() }); } } // Create the chart $('#container11').highcharts({ chart: { type: 'pie' }, title: { text: '当前版本在历史版本总和占比' }, yAxis: { title: { text: 'Total percent market share' } }, plotOptions: { pie: { shadow: false, center: ['50%', '50%'] } }, tooltip: { valueSuffix: '' //这里更改tooltip显示的单位 }, series: [{ name: 'Browsers', data: browserData, size: '80%', dataLabels: { formatter: function() { return this.y > 5 ? this.point.name : null; }, color: 'white', distance: -30 } }, { name: 'Versions', data: versionsData, size: '100%', innerSize: '80%', dataLabels: { formatter: function() { // display only if larger than 1 return this.y > 0 ? '<b>'+ this.point.name +':</b> '+ this.y+'个' : null; } } }] }); });
qualityTeam5/PO-demo
src/11.js
JavaScript
bsd-3-clause
3,175
[ 30522, 1002, 1006, 3853, 1006, 1007, 1063, 13075, 6087, 1027, 2152, 7507, 21217, 1012, 2131, 7361, 9285, 1006, 1007, 1012, 6087, 1010, 7236, 1027, 1031, 1005, 100, 100, 100, 1005, 1010, 1005, 2047, 1005, 1010, 1005, 100, 100, 100, 1005, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * ************************************************************************************* * Copyright (C) 2006-2015 EsperTech, Inc. All rights reserved. * * http://www.espertech.com/esper * * http://www.espertech.com * * ---------------------------------------------------------------------------------- * * The software in this package is published under the terms of the GPL license * * a copy of which has been included with this distribution in the license.txt file. * * ************************************************************************************* */ package com.espertech.esper.epl.spec; import com.espertech.esper.filter.FilterSpecCompiled; import com.espertech.esper.filter.FilterValueSetParam; import java.util.ArrayList; import java.util.List; public class ContextDetailCategory implements ContextDetail { private static final long serialVersionUID = 8141827106254268831L; private final List<ContextDetailCategoryItem> items; private final FilterSpecRaw filterSpecRaw; private transient FilterSpecCompiled filterSpecCompiled; private transient FilterValueSetParam[][] filterParamsCompiled; public ContextDetailCategory(List<ContextDetailCategoryItem> items, FilterSpecRaw filterSpecRaw) { this.items = items; this.filterSpecRaw = filterSpecRaw; } public List<FilterSpecCompiled> getFilterSpecsIfAny() { List<FilterSpecCompiled> filters = new ArrayList<FilterSpecCompiled>(1); filters.add(filterSpecCompiled); return filters; } public FilterSpecRaw getFilterSpecRaw() { return filterSpecRaw; } public List<ContextDetailCategoryItem> getItems() { return items; } public void setFilterSpecCompiled(FilterSpecCompiled filterSpec) { this.filterSpecCompiled = filterSpec; this.filterParamsCompiled = filterSpecCompiled.getValueSet(null, null, null).getParameters(); } public FilterSpecCompiled getFilterSpecCompiled() { return filterSpecCompiled; } public FilterValueSetParam[][] getFilterParamsCompiled() { return filterParamsCompiled; } }
b-cuts/esper
esper/src/main/java/com/espertech/esper/epl/spec/ContextDetailCategory.java
Java
gpl-2.0
2,285
[ 30522, 1013, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#!/bin/bash set -e if is_redhat; then source /etc/sysconfig/ceph elif is_ubuntu; then source /etc/default/ceph fi function start_osd { get_config check_config if [ "${CEPH_GET_ADMIN_KEY}" -eq 1 ]; then get_admin_key check_admin_key fi case "$OSD_TYPE" in directory) source osd_directory.sh source osd_common.sh osd_directory ;; directory_single) source osd_directory_single.sh osd_directory_single ;; disk) osd_disk ;; prepare) source osd_disk_prepare.sh osd_disk_prepare ;; activate) source osd_disk_activate.sh osd_activate ;; devices) source osd_disks.sh source osd_common.sh osd_disks ;; activate_journal) source osd_activate_journal.sh source osd_common.sh osd_activate_journal ;; *) osd_trying_to_determine_scenario ;; esac } function osd_disk { source osd_disk_prepare.sh source osd_disk_activate.sh osd_disk_prepare osd_activate }
JrCs/ceph-docker
src/daemon/start_osd.sh
Shell
apache-2.0
1,058
[ 30522, 1001, 999, 1013, 8026, 1013, 24234, 2275, 1011, 1041, 2065, 2003, 1035, 2417, 12707, 1025, 2059, 3120, 1013, 4385, 1013, 25353, 9363, 2078, 8873, 2290, 1013, 8292, 8458, 12005, 2546, 2003, 1035, 1057, 8569, 3372, 2226, 1025, 2059, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* Copyright (C) 2009-2010 Electronic Arts, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of Electronic Arts, Inc. ("EA") nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY ELECTRONIC ARTS AND ITS CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ELECTRONIC ARTS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /////////////////////////////////////////////////////////////////////////////// // FnEncode.h // // Copyright (c) 2007, Electronic Arts Inc. All rights reserved. // Created by Alex Liberman and Talin. // // Character transcoding functions for filenames /////////////////////////////////////////////////////////////////////////////// #ifndef EAIO_FNENCODE_H #define EAIO_FNENCODE_H #ifndef INCLUDED_eabase_H #include <EABase/eabase.h> #endif #include <EAIO/internal/Config.h> #ifndef EAIO_EASTREAM_H #include <EAIO/EAStream.h> // for kLengthNull #endif #ifndef EAIO_PATHSTRING_H #include <EAIO/PathString.h> // for ConvertPathUTF{8,16}ToUTF{8,16} #endif namespace EA { namespace IO { /// StrlcpyUTF16ToUTF8 /// Copies a UTF16 string to a UTF8 string, but otherwise acts similar to strlcpy except for the /// return value. /// Returns the strlen of the destination string. If destination pointer is NULL, returns the /// strlen of the would-be string. /// Specifying a source length of kLengthNull copies from the source string up to the first NULL /// character. EAIO_API size_t StrlcpyUTF16ToUTF8(char8_t* pDest, size_t nDestLength, const char16_t* pSrc, size_t nSrcLength = kLengthNull); /// StrlcpyUTF8ToUTF16 /// Copies a UTF8 string to a UTF16 string, but otherwise acts similar to strlcpy except for the /// return value. /// Returns the strlen of the destination string. If destination pointer is NULL, returns the /// strlen of the would-be string. /// Specifying a source length of kLengthNull copies from the source string up to the first NULL /// character. EAIO_API size_t StrlcpyUTF8ToUTF16(char16_t* pDest, size_t nDestLength, const char8_t* pSrc, size_t nSrcLength = kLengthNull); /////////////////////////////////////////////////////////////////////////////// /// Convenient conversion functions used by EAFileUtil and EAFileNotification /////////////////////////////////////////////////////////////////////////////// /// ConvertPathUTF8ToUTF16 /// Expands the destination to the desired size and then performs a Strlcpy /// with UTF8->UTF16 conversion. /// Returns the number of characters written. EAIO_API uint32_t ConvertPathUTF8ToUTF16(Path::PathString16& dstPath16, const char8_t* pSrcPath8); /// ConvertPathUTF16ToUTF8 /// Expands the destination to the desired size and then performs a Strlcpy with /// UTF16->UTF8 conversion. /// Returns the number of characters written. EAIO_API uint32_t ConvertPathUTF16ToUTF8(Path::PathString8& dstPath8, const char16_t* pSrcPath16); /////////////////////////////////////////////////////////////////////////////// // String comparison, strlen, and strlcpy for this module, since we don't have // access to EACRT. /////////////////////////////////////////////////////////////////////////////// EAIO_API bool StrEq16(const char16_t* str1, const char16_t* str2); EAIO_API size_t EAIOStrlen8(const char8_t* str); EAIO_API size_t EAIOStrlen16(const char16_t* str); EAIO_API size_t EAIOStrlcpy8(char8_t* pDestination, const char8_t* pSource, size_t nDestCapacity); EAIO_API size_t EAIOStrlcpy16(char16_t* pDestination, const char16_t* pSource, size_t nDestCapacity); } // namespace IO } // namespace EA #endif // EAIO_FNENCODE_H
kitsilanosoftware/EAIO
include/EAIO/FnEncode.h
C
bsd-3-clause
5,095
[ 30522, 1013, 1008, 9385, 1006, 1039, 1007, 2268, 1011, 2230, 4816, 2840, 1010, 4297, 1012, 2035, 2916, 9235, 1012, 25707, 1998, 2224, 1999, 3120, 1998, 12441, 3596, 1010, 2007, 2030, 2302, 14080, 1010, 2024, 7936, 3024, 2008, 1996, 2206, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
Miogen.require(['Component.BaseComponent', 'Component.Button'], function () { Miogen.define('Component.Toolbar', Miogen.Component.BaseComponent.extend({ construct: function (cfg) { this._super(cfg); }, build: function (cb) { var t = this; // // t.addComponent(new Miogen.Component.Button()); // t.addComponent(new Miogen.Component.Button()); // Render the base widget and newly added components this._super(function () { cb.call(this); this.el.addClass('toolbar'); }); //this.el = $('<div class="miogen-widget"><div class="pad">Collection widget</div></div>'); } })); });
medatech/MiogenPHP
lib/client/lib/miogen/js/Component/Toolbar.js
JavaScript
mit
837
[ 30522, 2771, 23924, 1012, 5478, 1006, 1031, 1005, 6922, 1012, 2918, 9006, 29513, 3372, 1005, 1010, 1005, 6922, 1012, 6462, 1005, 1033, 1010, 3853, 1006, 1007, 1063, 2771, 23924, 1012, 9375, 1006, 1005, 6922, 1012, 6994, 8237, 1005, 1010, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* -*- Mode: C++; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */ /* * generallayout.h * Copyright (C) 2015 Dejardin Gilbert <dejarding@gmail.com> * * audio is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * audio is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _GENERALLAYOUT_H_ #define _GENERALLAYOUT_H_ #include <list> #include <gtkmm/drawingarea.h> #include "generalmodule.hpp" //#include "vector2D.hpp" class GeneralLayout: public Gtk::DrawingArea { public: GeneralLayout(); virtual ~GeneralLayout(); void randomAllModulePosition(); std::list<GeneralModule*> mGMs; protected: virtual bool on_draw(const Cairo::RefPtr<Cairo::Context>& cr); bool on_timeout(); private: double mZoom; bool mautoZoom; Vector2D mPan; bool mautoPan; }; #endif // _GENERALLAYOUT_H_
Dagal/DagalTone
src/generallayout.hpp
C++
gpl-3.0
1,330
[ 30522, 1013, 1008, 1011, 1008, 1011, 5549, 1024, 1039, 1009, 1009, 1025, 27427, 4765, 1011, 21628, 2015, 1011, 5549, 1024, 1056, 1025, 1039, 1011, 3937, 1011, 16396, 1024, 1016, 1025, 21628, 1011, 9381, 1024, 1016, 1011, 1008, 1011, 1008, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php /*************************************************************************************/ /* This file is part of the RainbowPHP package. If you think this file is lost, */ /* please send it to anyone kind enough to take care of it. Thank you. */ /* */ /* email : bperche9@gmail.com */ /* web : http://www.benjaminperche.fr */ /* */ /* For the full copyright and license information, please view the LICENSE.txt */ /* file that was distributed with this source code. */ /*************************************************************************************/ namespace RainbowPHP\Generator; use RainbowPHP\DataProvider\DataProviderInterface; use RainbowPHP\File\FileHandlerInterface; use RainbowPHP\Formatter\FormatterInterface; use RainbowPHP\Formatter\LineFormatter; use RainbowPHP\Transformer\TransformerInterface; /** * Class FileGenerator * @package RainbowPHP\Generator * @author Benjamin Perche <bperche9@gmail.com> */ class FileGenerator implements FileGeneratorInterface { protected $fileHandler; protected $transformer; protected $dataProvider; protected $formatter; public function __construct( FileHandlerInterface $fileHandler, TransformerInterface $transformer, DataProviderInterface $dataProvider, FormatterInterface $formatter = null ) { $this->fileHandler = $fileHandler; $this->transformer = $transformer; $this->dataProvider = $dataProvider; $this->formatter = $formatter ?: new LineFormatter(); } public function generateFile() { foreach ($this->dataProvider->generate() as $value) { if (null !== $value) { $this->fileHandler->writeLine($this->formatter->format($value, $this->transformer->transform($value))); } } } }
lovenunu/RainbowPHP
src/RainbowPHP/Generator/FileGenerator.php
PHP
lgpl-3.0
2,135
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
var objc = require('../') objc.dlopen('/System/Library/Frameworks/AppKit.framework/AppKit'); NSApplication = objc.objc_getClass('NSApplication'); console.log(NSApplication); var sharedApplication = objc.sel_registerName('sharedApplication'); var app = objc.objc_msgSend(NSApplication, sharedApplication); console.log(app);
TooTallNate/node-objc
tests/test2.js
JavaScript
mit
326
[ 30522, 13075, 27885, 3501, 2278, 1027, 5478, 1006, 1005, 1012, 1012, 1013, 1005, 1007, 27885, 3501, 2278, 1012, 21469, 26915, 1006, 1005, 1013, 2291, 1013, 3075, 1013, 30524, 26266, 1006, 1005, 23971, 9397, 19341, 3508, 1005, 1007, 1025, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_SET_H_ #define EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_SET_H_ #include <map> #include <set> #include <string> #include <vector> #include "base/gtest_prod_util.h" #include "base/memory/ref_counted.h" #include "base/memory/singleton.h" #include "base/strings/string16.h" #include "extensions/common/manifest.h" #include "extensions/common/permissions/api_permission.h" #include "extensions/common/permissions/api_permission_set.h" #include "extensions/common/permissions/manifest_permission.h" #include "extensions/common/permissions/manifest_permission_set.h" #include "extensions/common/url_pattern_set.h" namespace extensions { class Extension; // The PermissionSet is an immutable class that encapsulates an // extension's permissions. The class exposes set operations for combining and // manipulating the permissions. class PermissionSet : public base::RefCountedThreadSafe<PermissionSet> { public: // Creates an empty permission set (e.g. default permissions). PermissionSet(); // Creates a new permission set based on the specified data: the API // permissions, manifest key permissions, host permissions, and scriptable // hosts. The effective hosts of the newly created permission set will be // inferred from the given host permissions. PermissionSet(const APIPermissionSet& apis, const ManifestPermissionSet& manifest_permissions, const URLPatternSet& explicit_hosts, const URLPatternSet& scriptable_hosts); // Creates a new permission set equal to |set1| - |set2|, passing ownership of // the new set to the caller. static PermissionSet* CreateDifference( const PermissionSet* set1, const PermissionSet* set2); // Creates a new permission set equal to the intersection of |set1| and // |set2|, passing ownership of the new set to the caller. static PermissionSet* CreateIntersection( const PermissionSet* set1, const PermissionSet* set2); // Creates a new permission set equal to the union of |set1| and |set2|. // Passes ownership of the new set to the caller. static PermissionSet* CreateUnion( const PermissionSet* set1, const PermissionSet* set2); bool operator==(const PermissionSet& rhs) const; // Returns true if every API or host permission available to |set| is also // available to this. In other words, if the API permissions of |set| are a // subset of this, and the host permissions in this encompass those in |set|. bool Contains(const PermissionSet& set) const; // Gets the API permissions in this set as a set of strings. std::set<std::string> GetAPIsAsStrings() const; // Returns true if this is an empty set (e.g., the default permission set). bool IsEmpty() const; // Returns true if the set has the specified API permission. bool HasAPIPermission(APIPermission::ID permission) const; // Returns true if the |extension| explicitly requests access to the given // |permission_name|. Note this does not include APIs without no corresponding // permission, like "runtime" or "browserAction". bool HasAPIPermission(const std::string& permission_name) const; // Returns true if the set allows the given permission with the default // permission detal. bool CheckAPIPermission(APIPermission::ID permission) const; // Returns true if the set allows the given permission and permission param. bool CheckAPIPermissionWithParam(APIPermission::ID permission, const APIPermission::CheckParam* param) const; // Returns true if this includes permission to access |origin|. bool HasExplicitAccessToOrigin(const GURL& origin) const; // Returns true if this permission set includes access to script |url|. bool HasScriptableAccessToURL(const GURL& url) const; // Returns true if this permission set includes effective access to all // origins. bool HasEffectiveAccessToAllHosts() const; // Returns true if this permission set has access to so many hosts, that we // should treat it as all hosts for warning purposes. // For example, '*://*.com/*'. bool ShouldWarnAllHosts() const; // Returns true if this permission set includes effective access to |url|. bool HasEffectiveAccessToURL(const GURL& url) const; // Returns true if this permission set effectively represents full access // (e.g. native code). bool HasEffectiveFullAccess() const; const APIPermissionSet& apis() const { return apis_; } const ManifestPermissionSet& manifest_permissions() const { return manifest_permissions_; } const URLPatternSet& effective_hosts() const { return effective_hosts_; } const URLPatternSet& explicit_hosts() const { return explicit_hosts_; } const URLPatternSet& scriptable_hosts() const { return scriptable_hosts_; } private: FRIEND_TEST_ALL_PREFIXES(PermissionsTest, GetWarningMessages_AudioVideo); friend class base::RefCountedThreadSafe<PermissionSet>; ~PermissionSet(); // Adds permissions implied independently of other context. void InitImplicitPermissions(); // Initializes the effective host permission based on the data in this set. void InitEffectiveHosts(); // Initializes |has_access_to_most_hosts_|. void InitShouldWarnAllHosts() const; // The api list is used when deciding if an extension can access certain // extension APIs and features. APIPermissionSet apis_; // The manifest key permission list is used when deciding if an extension // can access certain extension APIs and features. ManifestPermissionSet manifest_permissions_; // The list of hosts that can be accessed directly from the extension. // TODO(jstritar): Rename to "hosts_"? URLPatternSet explicit_hosts_; // The list of hosts that can be scripted by content scripts. // TODO(jstritar): Rename to "user_script_hosts_"? URLPatternSet scriptable_hosts_; // The list of hosts this effectively grants access to. URLPatternSet effective_hosts_; enum ShouldWarnAllHostsType { UNINITIALIZED = 0, WARN_ALL_HOSTS, DONT_WARN_ALL_HOSTS }; // Whether or not this permission set includes access to so many origins, we // should treat it as all_hosts for warning purposes. // Lazily initialized (and therefore mutable). mutable ShouldWarnAllHostsType should_warn_all_hosts_; }; } // namespace extensions #endif // EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_SET_H_
TeamEOS/external_chromium_org
extensions/common/permissions/permission_set.h
C
bsd-3-clause
6,568
[ 30522, 1013, 1013, 9385, 2286, 1996, 10381, 21716, 5007, 6048, 1012, 2035, 2916, 9235, 1012, 1013, 1013, 2224, 1997, 2023, 3120, 3642, 2003, 9950, 2011, 1037, 18667, 2094, 1011, 2806, 6105, 2008, 2064, 2022, 1013, 1013, 2179, 1999, 1996, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package ar.com.dcsys.model; import java.util.List; import javax.inject.Inject; import ar.com.dcsys.data.document.Document; import ar.com.dcsys.data.document.DocumentDAO; import ar.com.dcsys.exceptions.DocumentException; public class DocumentsManagerBean implements DocumentsManager { private final DocumentDAO documentDAO; @Inject public DocumentsManagerBean(DocumentDAO documentDAO) { this.documentDAO = documentDAO; } @Override public void persist(Document d) throws DocumentException { documentDAO.persist(d); } @Override public List<String> findAll() throws DocumentException { return documentDAO.findAll(); } @Override public Document findById(String id) throws DocumentException { if (id == null) { throw new DocumentException("id == null"); } return documentDAO.findById(id); } @Override public Document findByIdWithoutContent(String id) throws DocumentException { if (id == null) { throw new DocumentException("id == null"); } return documentDAO.findByIdWithoutContent(id); } }
pablodanielrey/java
document/documentModel/src/main/java/ar/com/dcsys/model/DocumentsManagerBean.java
Java
gpl-3.0
1,041
[ 30522, 7427, 12098, 1012, 4012, 1012, 5887, 6508, 2015, 1012, 2944, 1025, 12324, 9262, 1012, 21183, 4014, 1012, 2862, 1025, 12324, 9262, 2595, 1012, 1999, 20614, 1012, 1999, 20614, 1025, 12324, 12098, 1012, 4012, 1012, 5887, 6508, 2015, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
from itertools import combinations def is_good(n): return 1 + ((int(n) - 1) % 9) == 9 def generate_subsequences(n): subsequences = [] combinations_list = [] index = 4 #Generate all combinations while index > 0: combinations_list.append(list(combinations(str(n), index))) index -= 1 #Formatting combinations for index in combinations_list: for combination in index: subsequences.append(''.join(combination)) return subsequences if __name__ == '__main__': #The modulo modulo = ((10 ** 9) + 7) #Get number of cases cases = int(raw_input()) while cases > 0: value = raw_input() good_subsequences = 0 for sub in generate_subsequences(value): if is_good(sub): good_subsequences += 1 print (good_subsequences % modulo)-1 cases -= 1
Dawny33/Code
HackerEarth/BeCoder 2/nine.py
Python
gpl-3.0
882
[ 30522, 2013, 2009, 8743, 13669, 2015, 12324, 14930, 13366, 2003, 1035, 2204, 1006, 1050, 1007, 1024, 2709, 1015, 1009, 1006, 1006, 20014, 1006, 1050, 1007, 30524, 2015, 1027, 1031, 1033, 14930, 1035, 2862, 1027, 1031, 1033, 5950, 1027, 1018...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#!/usr/bin/env python # # 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. """This code example creates new proposals. To determine which proposals exist, run get_all_proposals.py. """ import uuid # Import appropriate modules from the client library. from googleads import ad_manager ADVERTISER_ID = 'INSERT_ADVERTISER_ID_HERE' PRIMARY_SALESPERSON_ID = 'INSERT_PRIMARY_SALESPERSON_ID_HERE' SECONDARY_SALESPERSON_ID = 'INSERT_SECONDARY_SALESPERSON_ID_HERE' PRIMARY_TRAFFICKER_ID = 'INSERT_PRIMARY_TRAFFICKER_ID_HERE' def main(client, advertiser_id, primary_salesperson_id, secondary_salesperson_id, primary_trafficker_id): # Initialize appropriate services. proposal_service = client.GetService('ProposalService', version='v201811') network_service = client.GetService('NetworkService', version='v201811') # Create proposal objects. proposal = { 'name': 'Proposal #%s' % uuid.uuid4(), 'advertiser': { 'companyId': advertiser_id, 'type': 'ADVERTISER' }, 'primarySalesperson': { 'userId': primary_salesperson_id, 'split': '75000' }, 'secondarySalespeople': [{ 'userId': secondary_salesperson_id, 'split': '25000' }], 'primaryTraffickerId': primary_trafficker_id, 'probabilityOfClose': '100000', 'budget': { 'microAmount': '100000000', 'currencyCode': network_service.getCurrentNetwork()['currencyCode'] }, 'billingCap': 'CAPPED_CUMULATIVE', 'billingSource': 'DFP_VOLUME' } # Add proposals. proposals = proposal_service.createProposals([proposal]) # Display results. for proposal in proposals: print ('Proposal with id "%s" and name "%s" was created.' % (proposal['id'], proposal['name'])) if __name__ == '__main__': # Initialize client object. ad_manager_client = ad_manager.AdManagerClient.LoadFromStorage() main(ad_manager_client, ADVERTISER_ID, PRIMARY_SALESPERSON_ID, SECONDARY_SALESPERSON_ID, PRIMARY_TRAFFICKER_ID)
Aloomaio/googleads-python-lib
examples/ad_manager/v201811/proposal_service/create_proposals.py
Python
apache-2.0
2,591
[ 30522, 1001, 999, 1013, 2149, 2099, 1013, 8026, 1013, 4372, 2615, 18750, 1001, 1001, 9385, 2325, 8224, 4297, 1012, 2035, 2916, 9235, 1012, 1001, 1001, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright (C) 2017 by Fonoster Inc (http://fonoster.com) * http://github.com/fonoster/astive * * This file is part of Astive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.fonoster.astive.agi.test; import junit.framework.TestCase; import com.fonoster.astive.agi.AgiException; import com.fonoster.astive.agi.CommandProcessor; import com.fonoster.astive.agi.command.DatabaseDelTree; /** * Test case for command {@link com.fonoster.astive.agi.command.DatabaseDel}. * * @since 1.0 */ public class DatabaseDelTreeTest extends TestCase { /** * Creates a new DatabaseDelTreeTest object. * * @param testName {@inheritDoc}. */ public DatabaseDelTreeTest(String testName) { super(testName); } /** * Test method. * * @throws AgiException if command is malformed. */ public void testCommand() throws AgiException { String family = "familyDb"; String keyTree = "keyTreeDb"; // Testing first constructor StringBuilder b = new StringBuilder("DATABASE DELTREE"); b.append(" "); b.append("\""); b.append(family); b.append("\""); DatabaseDelTree command = new DatabaseDelTree(family); assertEquals(b.toString(), CommandProcessor.buildCommand(command)); // Testing second constructor b.append(" "); b.append("\""); b.append(keyTree); b.append("\""); command = new DatabaseDelTree(family, keyTree); assertEquals(b.toString(), CommandProcessor.buildCommand(command)); } }
fonoster/astivetoolkit
astive-agi/src/test/java/com/fonoster/astive/agi/test/DatabaseDelTreeTest.java
Java
apache-2.0
2,016
[ 30522, 1013, 1008, 1008, 9385, 1006, 1039, 1007, 2418, 2011, 1042, 17175, 6238, 4297, 1006, 8299, 1024, 1013, 1013, 1042, 17175, 6238, 1012, 4012, 1007, 1008, 8299, 1024, 1013, 1013, 21025, 2705, 12083, 1012, 4012, 1013, 1042, 17175, 6238, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>prfx: Not compatible</title> <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" /> <link href="../../../../../bootstrap.min.css" rel="stylesheet"> <link href="../../../../../bootstrap-custom.css" rel="stylesheet"> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <script src="../../../../../moment.min.js"></script> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <div class="container"> <div class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="../..">clean / released</a></li> <li class="active"><a href="">8.11.2 / prfx - 8.10.0</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> prfx <small> 8.10.0 <span class="label label-info">Not compatible</span> </small> </h1> <p><em><script>document.write(moment("2020-08-31 05:47:56 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2020-08-31 05:47:56 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-threads base base-unix base conf-findutils 1 Virtual package relying on findutils conf-m4 1 Virtual package relying on m4 coq 8.11.2 Formal proof management system num 1.3 The legacy Num library for arbitrary-precision integer and rational arithmetic ocaml 4.11.0 The OCaml compiler (virtual package) ocaml-base-compiler 4.11.0 Official release 4.11.0 ocaml-config 1 OCaml Switch Configuration ocamlfind 1.8.1 A library manager for OCaml # opam file: opam-version: &quot;2.0&quot; maintainer: &quot;Hugo.Herbelin@inria.fr&quot; homepage: &quot;https://github.com/http://www.cs.ru.nl/~hendriks/coq/prfx/&quot; license: &quot;Unknown&quot; build: [make &quot;-j%{jobs}%&quot;] install: [make &quot;install&quot;] remove: [&quot;rm&quot; &quot;-R&quot; &quot;%{lib}%/coq/user-contrib/Prfx&quot;] depends: [ &quot;ocaml&quot; &quot;coq&quot; {&gt;= &quot;8.10&quot; &amp; &lt; &quot;8.11~&quot;} ] tags: [ &quot;keyword: first-order logic&quot; &quot;keyword: natural deduction&quot; &quot;keyword: reflection&quot; &quot;keyword: proof terms&quot; &quot;keyword: de bruijn indices&quot; &quot;keyword: permutative conversions&quot; &quot;category: Mathematics/Logic/Foundations&quot; &quot;date: 15 April 2005&quot; ] authors: [ &quot;Dimitri Hendriks &lt;hendriks@cs.ru.nl&gt; [http://www.cs.ru.nl/~hendriks/]&quot; ] bug-reports: &quot;https://github.com/coq-contribs/prfx/issues&quot; dev-repo: &quot;git+https://github.com/coq-contribs/prfx.git&quot; synopsis: &quot;Proof Reflection in Coq&quot; description: &quot;&quot;&quot; A formalisation of natural deduction for first-order logic with explicit proof terms. Read README.&quot;&quot;&quot; flags: light-uninstall url { src: &quot;https://github.com/coq-contribs/prfx/archive/v8.10.0.tar.gz&quot; checksum: &quot;md5=35eb746d14fa85582845fa8005aed9bc&quot; } </pre> <h2>Lint</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Dry install</h2> <p>Dry install with the current Coq version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam install -y --show-action coq-prfx.8.10.0 coq.8.11.2</code></dd> <dt>Return code</dt> <dd>5120</dd> <dt>Output</dt> <dd><pre>[NOTE] Package coq is already installed (current version is 8.11.2). The following dependencies couldn&#39;t be met: - coq-prfx -&gt; coq &lt; 8.11~ -&gt; ocaml &lt; 4.10 base of this switch (use `--unlock-base&#39; to force) No solution found, exiting </pre></dd> </dl> <p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-prfx.8.10.0</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Install dependencies</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Install</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Installation size</h2> <p>No files were installed.</p> <h2>Uninstall</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Missing removes</dt> <dd> none </dd> <dt>Wrong removes</dt> <dd> none </dd> </dl> </div> </div> </div> <hr/> <div class="footer"> <p class="text-center"> <small>Sources are on <a href="https://github.com/coq-bench">GitHub</a>. © Guillaume Claret.</small> </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
coq-bench/coq-bench.github.io
clean/Linux-x86_64-4.11.0-2.0.7/released/8.11.2/prfx/8.10.0.html
HTML
mit
6,964
[ 30522, 1026, 999, 9986, 13874, 16129, 1028, 1026, 16129, 11374, 1027, 1000, 4372, 1000, 1028, 1026, 2132, 1028, 1026, 18804, 25869, 13462, 1027, 1000, 21183, 2546, 1011, 1022, 1000, 1028, 1026, 18804, 2171, 1027, 1000, 3193, 6442, 1000, 418...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php /** * Checkout coupon form * * @author WooThemes * @package WooCommerce/Templates * @version 1.6.4 */ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly global $woocommerce; if ( ! WC()->cart->coupons_enabled() ) return; $info_message = apply_filters( 'woocommerce_checkout_coupon_message', __( 'Have a coupon?', 'woocommerce' ) ); $info_message .= ' <a href="#" class="showcoupon">' . __( 'Click here to enter your code', 'woocommerce' ) . '</a>'; ?> <div class="box woocommerce-box border-box"> <?php echo $info_message;?> <form class="checkout_coupon brad-woocommerce-form" method="post" style="display:none"> <p class="form-row form-row-first"> <input type="text" name="coupon_code" class="input-text" placeholder="<?php _e( 'Coupon code', 'woocommerce' ); ?>" id="coupon_code" value="" /> </p> <p class="form-row form-row-last"> <input type="submit" class="button" name="apply_coupon" value="<?php _e( 'Apply Coupon', 'woocommerce' ); ?>" /> </p> <div class="clear"></div> </form> </div>
diegoschefer/fcp-wp
wp-content/themes/Akal/woocommerce/checkout/form-coupon.php
PHP
gpl-2.0
1,068
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 1008, 4638, 5833, 8648, 2239, 2433, 1008, 1008, 1030, 3166, 15854, 10760, 7834, 1008, 1030, 7427, 15854, 9006, 5017, 3401, 1013, 23561, 2015, 1008, 1030, 2544, 1015, 1012, 1020, 1012, 1018, 1008, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<div class="modal-header dialog-header-notify ng-scope"> <button type="button" class="close" ng-click="cancel()">×</button> <h4 class="modal-title text-info ng-binding fonticon fonticon-event ng-binding"> {{item.name}}</h4> </div> <div class="modal-body text-info ng-binding ng-scope"> <div id="basic-modal-content-pc"> <tabset ng-hide="hideTabs"> <tab heading="Recommended" active="tabRecommended"> <div class="row"><br/></div> <div> <div> <label ng-show="recomendationevents.length>1" for="">{{recomendationevents.length}} events found</label> <label ng-show="recomendationevents.length==1" for="">{{recomendationevents.length}} event found</label> <label ng-show="recomendationevents.length==0" for="">No events found</label> </div> <!-- <div class="createvisualization "> <div class="filterMetricsPagination" id="filterMetricsPaginationDirective"> <div class="button-group"> <button ng-show="recomendationevents.length>1" ng-disabled="curPage == 0" class="btn" ng-click="curPage=curPage-1"> <span class="glyphicon glyphicon-chevron-left"></span> Previous </button> <button ng-show="recomendationevents.length>1" ng-disabled="curPage >= recomendationevents.length/pageSize - 1" class="btn pull-right" ng-click="curPage = curPage+1"> Next <span class="glyphicon glyphicon-chevron-right"></span> </button> </div> </div> </div> --> <div class="filterDatasetPaginationBody createvisualization "> <ul class="datasets-list metrics-list "> <li ng-class="{'metrics-list dataset-list active':idHE.indexOf(event.id) >= 0}" ng-repeat="event in recomendationevents | orderBy:'title' | pagination: (curPage-1) * pageSize | limitTo: pageSize "> <span ng-show="idsEventsToPlot[event.id]"> <a title="Unlink event {{event.title}} to the visualisation" href ng-click="deleteContainerHistoricalEvent('row_config_', idHE.indexOf(event.id) , event.title, event.id)">{{event.title}} (It's assigned)</a> </span> <span ng-hide="idsEventsToPlot[event.id]"> <a title="Link event {{event.title}} to the visualisation" href ng-click="selectHE(event,'recomendation')">{{event.title}}</a> </span> </li> </ul> </div> <div class="row"> <div style="text-align: center"> <pagination total-items="recomendationevents.length" ng-change="pageChangedHEt()" items-per-page="pageSize" ng-model="curPage" max-size="pagePagesSizeHE" class="pagination-sm" boundary-links="true" rotate="false" num-pages="numPages"></pagination> </div> </div> </div> </tab> <tab heading="Search" active="tabSearch"> <div class="row"><br/></div> <div> <div> <form action="#" name="searchEventsFormModal" role="form" novalidate> <div class="row"> <div class="col-sm-4"> <div class="form-group date-picker ng-scope"> <label for="filterEvent">Search text</label> <p class="input-group"> <input ng-keyup="$event.keyCode == 13 && findEventsByFilter('ini', filterEvent, startDateToFilter, endDateToFilter)" placeholder="--all events--" type="text" id="filterEvent" ng-model="filterEvent" name="filterEvent" class="form-control ng-isolate-scope ng-pristine ng-valid-required ng-valid"> <span class="input-group-btn"> <a type="button" class="btn btn-default" ng-click="findEventsByFilter('ini', filterEvent, startDateToFilter, endDateToFilter)"><i class="glyphicon glyphicon-search"></i></a> </span> </p> </div> </div> <div class="col-sm-4"> <div class="form-group date-picker" ng-controller="DateController"> <label for="retrievalDate">Start date</label> <p class="input-group"> <input type="text" id="startDateToFilter" name="startDateToFilter" class="form-control" datepicker-popup="" ng-model="startDateToFilter" is-open="opened" min-date-old="minDate" max-date-old="maxDate" min-date="iniStartDateToFilter" max-date="iniEndDateToFilter" datepicker-options="dateOptions" show-button-bar="false" ng-required="false" ng-disabled="true" ng-change="findEventsByFilter('ini', filterEvent, startDateToFilter, endDateToFilter)" close-text="Close"/> <span class="input-group-btn"> <a type="button" class="btn btn-default" ng-click="open($event)"><i class="glyphicon glyphicon-calendar"></i></a> </span> </p> </div> </div> <div class="col-sm-4"> <div class="form-group date-picker" ng-controller="DateController"> <label for="retrievalDate">End date</label> <p class="input-group"> <input type="text" id="endDateToFilter" name="endDateToFilter" class="form-control" datepicker-popup="" ng-model="endDateToFilter" is-open="opened" min-date-old="minDate" max-date-old="maxDate" min-date="iniStartDateToFilter" max-date="iniEndDateToFilter" datepicker-options="dateOptions" show-button-bar="false" ng-required="false" ng-disabled="true" ng-change="findEventsByFilter('ini', filterEvent, startDateToFilter, endDateToFilter)" close-text="Close"/> <span class="input-group-btn"> <a type="button" class="btn btn-default" ng-click="open($event)"><i class="glyphicon glyphicon-calendar"></i></a> </span> </p> </div> </div> </div> </form> </div> <hr> <div> <div> <label ng-show="events.hits.total>1" for="">{{events.hits.total}} events found</label> <label ng-show="events.hits.total==1" for="">{{events.hits.total}} event found</label> <label ng-show="events.hits.total==0" for="">no events found</label> </div> <!-- <div class="createvisualization "> <div class="filterMetricsPagination" id="filterMetricsPaginationDirective"> <div class="button-group"> <button ng-show="events.hits.total>1" ng-disabled="pagToSearch==1" class="btn" ng-click="findEventsByFilter('prev', filterEvent, startDateToFilter, endDateToFilter)"> <span class="glyphicon glyphicon-chevron-left"></span> Previous </button> <button ng-show="events.hits.total>1" ng-disabled="events.hits.total<=pagToSearch*itemsperpagesize" class="btn" ng-click="findEventsByFilter('next', filterEvent, startDateToFilter, endDateToFilter)"> Next <span class="glyphicon glyphicon-chevron-right"></span> </button> </div> </div> </div> --> <div class="filterDatasetPaginationBody createvisualization "> <ul class="datasets-list metrics-list "> <li ng-class="{'metrics-list dataset-list active':idHE.indexOf(event._source.id)>=0}" ng-repeat="event in events.hits.hits track by $index"> <span ng-show="idsEventsToPlot[event._id]"> <a title="Unlink event {{event._source.title}} to the visualisation" href ng-click="deleteContainerHistoricalEvent('row_config_', '-1' , event._source.title, event._id)">{{event._source.title}} (It's assigned)</a> </span> <span ng-hide="idsEventsToPlot[event._id]"> <a title="Link event {{event._source.title}} to the visualisation" href ng-click="selectHE(event,'search')">{{event._source.title}}</a> </span> </li> </ul> </div> <div class="row"> <div style="text-align: center"> <pagination total-items="events.hits.total" ng-change="pageChangedHESearch(pagToSearch, filterEvent, startDateToFilter, endDateToFilter)" items-per-page="pageSize" ng-model="pagToSearch" max-size="pagePagesSizeHE" class="pagination-sm" boundary-links="true" rotate="false" num-pages="numPages"></pagination> </div> </div> </div> </div> </tab> <tab ng-hide="eventsToPlot.length==0" heading="Configure" active="tabConfiguration"> <br/> <div ng-show="eventsToPlot.length==0">No events selected</div> <div ng-if="eventsToPlot.length > 0 " id="listHistoricalEventsToPlot"> <div class="designer-metrics ng-scope active" id="designer-metrics-he-num-{{$index+1}}" ng-repeat="event in eventsToPlot track by $index"> <h4>{{event.title}}</h4> <input type="hidden" ng-model="idHE[$index+1]" id="idHE{{$index+1}}" name="idHE[]" value="{{event.id}}"> <input type="hidden" ng-model="titleHE[$index+1]" id="titleHE{{$index+1}}" name="titleHE[]" value="{{event.title}}"> <input type="hidden" ng-model="startDateHE[$index+1]" id="startDateHE{{$index+1}}" name="startDateHE[]" value="{{event.startDate}}"> <input type="hidden" ng-model="endDateHE[$index+1]" id="endDateHE{{$index+1}}" name="endDateHE[]" value="{{event.endDate}}"> <div class="historicalevent-buttons active"> <a type="button" data-intro="Edit event main data" data-position="right" class="btn btn-primary btn-create" ng-click="vieweditHE[$index+1]=!vieweditHE[$index+1]"> <span ng-show="vieweditHE[$index+1]">Collapse</span> Configure event data</a> <button data-intro="Unlink event from the list of related events" data-position="left" type="button" class="btn btn-danger btn-clear" ng-click="deleteContainerHistoricalEvent('row_config_',$index+1, event.title, event.id)" id="delete-he-button-{{event.id}}">Unlink</button> <a type="button" data-intro="Access to the event data" data-position="right" class="btn btn-info btn-adddevent" href="#!/events/{{event.id}}" target="_blank" id="view-metric-button-{{event.id}}">Open event details</a> </div> <div ng-show="vieweditHE[$index+1]" class="contentHE"> <div><br/></div> <div ng-if="event.color"><label for="">Colour:</label> <spectrum name="colorHE[]" ng-model="colorHE[$index+1]" ng-model-onblur ng-change="updatecolorEvent($index);rePlotGraph()" options="{ showInput: true, showAlpha: false, allowEmpty: false, preferredFormat: 'hex' }"></spectrum> </div> <div ng-if="event.startDate"> <label for="">From:</label> {{event.startDate | date:'longDate'}} </div> <div ng-if="event.endDate"><label for="">To:</label> {{event.endDate | date:'longDate'}} </div> <div ng-if="event.desc"><label for="">Description (max. length 150 characters):</label> <textarea ng-change="enableRevertButton();" ng-blur="updateDescriptionEvent($index);rePlotGraph();" rows="2" cols="50" ng-model="descHE[$index+1]" ng-trim="false" maxlength="150"></textarea> <span>{{150 - descHE[$index+1].length}} left</span> </div> </div> </div> </div> </tab> </tabset> <div ng-hide="!hideTabs"> <form action="#" name="neweventForm" role="form" ng-submit="submitFormAddEvent()" novalidate> <div ng-if="historicalevent_id>0" class="events-display-fields"> <div class="form-group" ng-class="{ 'has-error' : neweventForm.title.$invalid && !neweventForm.title.$pristine }"> <label for="titleHE" class="mandatory field-label">Title:</label> <div class="field-content">{{historicalevent_title}}</div> <input type="hidden" maxlength="80" size="60" name="idHE" id="idHE" class="form-control" ng-model="historicalevent_id"> <input type="hidden" maxlength="80" size="60" name="titleHE" id="titleHE" class="form-control" ng-model="historicalevent_title"> <p ng-show="neweventForm.title.$invalid && !neweventForm.title.$pristine" class="help-block">A title is required.</p> </div> <div class="form-group" ng-controller="DateController"> <label for="startDate" class="field-label">Start date:</label> <div class="field-content">{{historicalevent_startDate | date:'longDate'}}</div> <p class="input-group"> <input type="hidden" id="startDate" name="startDate" class="form-control" datepicker-popup="{{ format }}" ng-model="historicalevent_startDate" is-open="opened" min-date="minDate" max-date="maxDate" datepicker-options="dateOptions" show-button-bar="false" ng-required="false" ng-disabled="true" close-text="Close" value="{{historicalevent_he_startdate}}"/> </p> </div> <div class="form-group" ng-controller="DateController"> <label for="endDate" class="field-label">End date:</label> <div class="field-content">{{historicalevent_endDate | date:'longDate'}}</div> <p class="input-group"> <input type="hidden" id="endDate" name="endDate" class="form-control" datepicker-popup="{{ format }}" ng-model="historicalevent_endDate" is-open="opened" min-date="minDate" max-date="maxDate" datepicker-options="dateOptions" show-button-bar="false" ng-required="false" ng-disabled="true" close-text="Close" value="{{historicalevent_he_enddate}}"/> </p> </div> <div class="form-group"> <label for="Colour" class="field-label">Colour:</label> <div class="field-content"> <spectrum ng-model="historicalevent_color_palete" options="{ showInput: true, showAlpha: false, allowEmpty: false, preferredFormat: 'hex' }"></spectrum> <input type="hidden" id="historicalevent_color" name="historicalevent_color" class="form-control" ng-required="false" value="{{historicalevent_color_palete}}"/> </div> </div> </div> <div ng-if="historicalevent_id>0" class="form-group"> <label for="Description">Description (max. length 150 characters):</label> <div> <textarea rows="2" cols="50" ng-model="historicalevent_description" ng-trim="false" maxlength="150" name="descriptionHEToAdd" id="descriptionHEToAdd"></textarea> <span>{{150 - historicalevent_description.length}} left</span> </div> </div> <a href="" ng-click="hideTabsModal()" class="btn btn-default btn-cancel"><span class="glyphicon glyphicon-chevron-left"></span> Cancel selection</a> </form> </div> </div> </div> <div class="modal-footer ng-scope"> <button ng-show="hideTabs" ng-disabled="!historicalevent_id" href="" ng-click="addAnotherHistoricalEvent('dynamicContainer'); rePlotGraph(); enableRevertButton(); ok();" class="btn btn-validate" id="addmetric">Link event</button> <button class="btn btn-primary btn-clear" ng-click="cancel()">Close</button> <!-- <a href="#!/events/create" target="_blank" class="btn btn-default btn-create" id="addmetric">Create a new event</a> --> </div>
bullz/policycompass-frontend
app/modules/visualization/partials/addEvent.html
HTML
agpl-3.0
18,084
[ 30522, 1026, 4487, 2615, 2465, 1027, 1000, 16913, 2389, 1011, 20346, 13764, 8649, 1011, 20346, 1011, 2025, 8757, 12835, 1011, 9531, 1000, 1028, 1026, 6462, 2828, 1027, 1000, 6462, 1000, 2465, 1027, 1000, 2485, 1000, 12835, 1011, 11562, 1027...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
'use strict'; /** * Module dependencies. */ var path = require('path'), mongoose = require('mongoose'), Person = mongoose.model('Person'), errorHandler = require(path.resolve('./modules/core/server/controllers/errors.server.controller')), _ = require('lodash'); /** * Create a Person */ exports.create = function(req, res) { var person = new Person(req.body); person.user = req.user; person.save(function(err) { if (err) { return res.status(400).send({ message: errorHandler.getErrorMessage(err) }); } else { res.jsonp(person); } }); }; /** * Show the current Person */ exports.read = function(req, res) { // convert mongoose document to JSON var person = req.person ? req.person.toJSON() : {}; // Add a custom field to the Article, for determining if the current User is the "owner". // NOTE: This field is NOT persisted to the database, since it doesn't exist in the Article model. // person.isCurrentUserOwner = req.user && person.user && person.user._id.toString() === req.user._id.toString(); res.jsonp(person); }; /** * Update a Person */ exports.update = function(req, res) { var person = req.person; person = _.extend(person, req.body); person.save(function(err) { if (err) { return res.status(400).send({ message: errorHandler.getErrorMessage(err) }); } else { res.jsonp(person); } }); }; /** * Delete a Person */ exports.delete = function(req, res) { var person = req.person; person.remove(function(err) { if (err) { return res.status(400).send({ message: errorHandler.getErrorMessage(err) }); } else { res.jsonp(person); } }); }; /** * List of People */ exports.list = function(req, res) { var search = {}; if (req.query.full_name) { search.full_name = new RegExp(req.query.full_name, 'i'); } if (req.query.url) { search.url = new RegExp(req.query.url, 'i'); } if (req.query.email) { search.email = new RegExp(req.query.email, 'i'); } if (req.query.job) { search.job = new RegExp(req.query.job, 'i'); } if (req.query.location_safe) { search.location_safe = new RegExp(req.query.location_safe, 'i'); } if (req.query.phone) { search.phone = new RegExp(req.query.phone, 'i'); } if (req.query.notes) { search.notes = new RegExp(req.query.notes, 'i'); } if (req.query.keywords) { search.keywords = new RegExp(req.query.keywords, 'i'); } Person.find(search).sort('-created').exec(function (err, people) { if (err) { return res.status(400).send({ message: err.message }); } else { res.json(people); } }); }; /** * List of Dupliacte People */ exports.duplicates = function (req, res) { var aggregate = [ { $group: { _id: { url: '$url' }, count: { $sum: 1 } } }, { $match: { count: { $gte: 2 } } } ]; Person.aggregate(aggregate, function (err, groups) { if (err) { return res.status(400).send({ message: err.message }); } else { var dup_urls = []; for (var i = 0; i < groups.length; i++) { var group = groups[i]; var _id = group._id; dup_urls.push(_id.url); } Person.find({ url: { $in: dup_urls } }).sort('url').exec(function (err, people) { if (err) { return res.status(400).send({ message: err.message }); } else { res.json(people); } }); } }); }; /** * Person middleware */ exports.personByID = function(req, res, next, id) { if (!mongoose.Types.ObjectId.isValid(id)) { return res.status(400).send({ message: 'Person is invalid' }); } Person.findById(id).populate('user', 'displayName').exec(function (err, person) { if (err) { return next(err); } else if (!person) { return res.status(404).send({ message: 'No Person with that identifier has been found' }); } req.person = person; next(); }); };
tmrotz/LinkedIn-People-MEAN.JS
modules/people/server/controllers/people.server.controller.js
JavaScript
mit
4,096
[ 30522, 1005, 2224, 9384, 1005, 1025, 1013, 1008, 1008, 1008, 11336, 12530, 15266, 1012, 1008, 1013, 13075, 4130, 1027, 5478, 1006, 1005, 4130, 1005, 1007, 1010, 12256, 3995, 9232, 1027, 5478, 1006, 1005, 12256, 3995, 9232, 1005, 1007, 1010,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/******************************************************************************* * Copyright (C) 2013 Andrei Olaru, Marius-Tudor Benea, Nguyen Thi Thuy Nga, Amal El Fallah Seghrouchni, Cedric Herpson. * * This file is part of tATAmI-PC. * * tATAmI-PC is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version. * * tATAmI-PC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with tATAmI-PC. If not, see <http://www.gnu.org/licenses/>. ******************************************************************************/ package tatami.pc.agent.visualization; import java.awt.GridBagConstraints; import java.awt.Panel; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; public class PCSimulationGui extends PCDefaultAgentGui { public enum SimulationComponent { CREATE, START, TIME, PAUSE, CLEAR, EXIT } public PCSimulationGui(AgentGuiConfig configuration) { super(configuration); Panel box = new Panel(); box.setLayout(new BoxLayout(box, BoxLayout.LINE_AXIS)); JButton create = new JButton("Create agents"); box.add(create); components.put(SimulationComponent.CREATE.toString(), create); JButton start = new JButton("and Start"); box.add(start); components.put(SimulationComponent.START.toString(), start); JLabel displayedTime = new JLabel(); displayedTime.setText("--:--.-"); box.add(displayedTime); components.put(SimulationComponent.TIME.toString(), displayedTime); JButton pause = new JButton("Pause"); box.add(pause); components.put(SimulationComponent.PAUSE.toString(), pause); JButton clear = new JButton("Clear agents"); box.add(clear); components.put(SimulationComponent.CLEAR.toString(), clear); JButton stop = new JButton("Exit"); box.add(stop); components.put(SimulationComponent.EXIT.toString(), stop); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = 1; c.gridwidth = 3; window.add(box, c); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.setVisible(true); } }
tATAmI-Project/tATAmI-PC
src/tatami/pc/agent/visualization/PCSimulationGui.java
Java
lgpl-3.0
2,534
[ 30522, 1013, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * gc.c - graphics context (GC) routines for Resurrection. * Copyright (C) 2003 Tuomo Venäläinen * * See the file COPYING for information about using this software. */ #include <Resurrection/Resurrection.h> #define RTERM_SCREEN_DEFAULT_FONT "fixed" #if 0 GC imageview_create_gc(Rimageview_t *imageview) { GC newgc; XGCValues gcvalues; gcvalues.foreground = BlackPixel(imageview->app->display, DefaultScreen(imageview->app->display)); if (imageview->fontinfo == NULL) { if (imageview_load_font(imageview, NULL) < 0) { return NULL; } } gcvalues.font = imageview->fontinfo->fid; gcvalues.function = GXandReverse; newgc = XCreateGC(imageview->app->display, imageview->window->win, GCForeground | GCFont | GCFunction, &gcvalues); return newgc; } GC menu_create_gc(Rwindow_t *window) { GC newgc; XGCValues gcvalues; if (window == NULL) { return NULL; } gcvalues.foreground = WhitePixel(window->app->display, DefaultScreen(window->app->display)); gcvalues.line_width = MENU_DEFAULT_LINE_WIDTH; #if !(SUPPORT_TRUETYPE_FONTS) if (window->fontinfo == NULL) { window->fontinfo = app_load_font(window->app, MENU_DEFAULT_FONT); if (window->fontinfo == NULL) { return NULL; } } gcvalues.font = window->fontinfo->fid; #endif gcvalues.graphics_exposures = False; newgc = XCreateGC(window->app->display, window->win, GCForeground | GCLineWidth #if !(SUPPORT_TRUETYPE_FONTS) | GCFont #endif | GCGraphicsExposures, &gcvalues); return newgc; } #endif int Rterm_init_selection_gc(struct R_term *term) { XGCValues gcvalues; if (term == NULL) { return -1; } gcvalues.foreground = WhitePixel(term->window->app->display, DefaultScreen(term->window->app->display)); gcvalues.function = GXandReverse; term->selectiongc = XCreateGC(term->window->app->display, term->window->id, GCForeground | GCFunction, &gcvalues); if (term->selectiongc == NULL) { return -1; } return 0; } void Rterm_set_default_foreground_color(struct R_term *term, struct R_termscreen *screen, int arg) { XGCValues gcvalues; screen->defcolors[RTERM_SCREEN_FOREGROUND_COLOR] = screen->colors[arg]; gcvalues.foreground = screen->colors[arg]; XChangeGC(screen->window->app->display, screen->defaultgc, GCForeground, &gcvalues); return; } void Rterm_set_default_background_color(struct R_term *term, struct R_termscreen *screen, int arg) { XGCValues gcvalues; screen->defcolors[RTERM_SCREEN_BACKGROUND_COLOR] = screen->colors[arg]; gcvalues.background = screen->colors[arg]; XChangeGC(screen->window->app->display, screen->defaultgc, GCBackground, &gcvalues); return; } int Rterm_init_screen_gcs(struct R_termscreen *screen) { #if (SUPPORT_RTERM_SCREEN_DOUBLE_BUFFER) struct R_term *term = R_global.app->client; #endif int screennum; XGCValues gcvalues; gcvalues.foreground = screen->defcolors[RTERM_SCREEN_FOREGROUND_COLOR]; gcvalues.background = screen->defcolors[RTERM_SCREEN_BACKGROUND_COLOR]; #if !(SUPPORT_TRUETYPE_FONTS) if (Rterm_load_screen_font(screen, RTERM_SCREEN_DEFAULT_FONT) < 0) { fprintf(stderr, "Rterm_load_screen_font failed\n"); return -1; } gcvalues.font = screen->fontinfo->fid; #endif gcvalues.graphics_exposures = False; screen->gc = XCreateGC(screen->window->app->display, screen->window->id, GCForeground | GCBackground #if !(SUPPORT_TRUETYPE_FONTS) | GCFont #endif | GCGraphicsExposures, &gcvalues); if (screen->gc == NULL) { fprintf(stderr, "screen->gc failed\n"); return -1; } screen->defaultgc = XCreateGC(screen->window->app->display, screen->window->id, GCForeground | GCBackground #if !(SUPPORT_TRUETYPE_FONTS) | GCFont #endif | GCGraphicsExposures, &gcvalues); if (screen->defaultgc == NULL) { fprintf(stderr, "screen->defaultgc failed\n"); XFreeGC(screen->window->app->display, screen->gc); return -1; } gcvalues.foreground = screen->colors[RTERM_SCREEN_CURSOR_COLOR]; // gcvalues.background = screen->colors[RTERM_SCREEN_CURSOR_COLOR]; gcvalues.function = GXxor; gcvalues.graphics_exposures = False; screen->cursorgc = XCreateGC(screen->window->app->display, screen->window->id, GCForeground | GCFunction | GCGraphicsExposures, &gcvalues); if (screen->cursorgc == NULL) { fprintf(stderr, "screen->cursorgc failed\n"); XFreeGC(screen->window->app->display, screen->gc); XFreeGC(screen->window->app->display, screen->defaultgc); return -1; } XSetForeground(screen->window->app->display, screen->cursorgc, screen->colors[RTERM_SCREEN_CURSOR_TEXT_COLOR]); XSetFunction(screen->window->app->display, screen->cursorgc, GXandReverse); memset(&gcvalues, 0, sizeof(gcvalues)); screennum = DefaultScreen(screen->window->app->display); gcvalues.foreground = WhitePixel(screen->window->app->display, screennum); gcvalues.function = GXandReverse; gcvalues.graphics_exposures = False; #if 0 screen->selectiongc = XCreateGC(screen->window->app->display, screen->window->id, GCForeground | GCFunction, &gcvalues); if (screen->selectiongc == NULL) { XFreeGC(screen->window->app->display, screen->gc); XFreeGC(screen->window->app->display, screen->defaultgc); XFreeGC(screen->window->app->display, screen->cursorgc); return -1; } #endif #if (SUPPORT_RTERM_SCREEN_DOUBLE_BUFFER) if (term->flags & RTERM_DOUBLE_BUFFER) { memset(&gcvalues, 0, sizeof(gcvalues)); gcvalues.foreground = screen->colors[RTERM_SCREEN_BACKGROUND_COLOR]; gcvalues.function = GXcopy; gcvalues.graphics_exposures = False; screen->bufgc = XCreateGC(screen->window->app->display, screen->window->id, GCForeground | GCFunction | GCGraphicsExposures, &gcvalues); if (screen->bufgc == NULL) { fprintf(stderr, "screen->bufgc failed\n"); XFreeGC(screen->window->app->display, screen->gc); XFreeGC(screen->window->app->display, screen->defaultgc); XFreeGC(screen->window->app->display, screen->cursorgc); // XFreeGC(screen->window->app->display, screen->selectiongc); return -1; } } #endif #if (SUPPORT_TRUETYPE_FONTS) memset(&gcvalues, 0, sizeof(gcvalues)); gcvalues.function = GXcopy; gcvalues.graphics_exposures = False; screen->bggc = XCreateGC(screen->window->app->display, screen->window->id, GCFunction | GCGraphicsExposures, &gcvalues); #endif return 0; } /* * NOTE: everything below really belongs into Rterm/screen.c and it should only * be called through function pointers from the screen structure... */ void Rterm_set_screen_gc(struct R_termscreen *screen, R_textflags_t textflags) { if (screen == NULL || screen->gctextflags == textflags) { return; } if (textflags & RTERM_CHAR_BOLD) { if (RTERM_CHAR_FG_COLOR(textflags) < RTERM_SCREEN_MIN_BRIGHT_COLOR) { if (RTERM_CHAR_FG_COLOR(textflags) + RTERM_SCREEN_BRIGHT_OFFSET != RTERM_CHAR_FG_COLOR(screen->gctextflags)) { Rterm_set_screen_foreground_color(screen, RTERM_CHAR_FG_COLOR(textflags) + RTERM_SCREEN_BRIGHT_OFFSET); } } else if ((textflags & RTERM_CHAR_FG_COLOR_MASK) != (screen->gctextflags & RTERM_CHAR_FG_COLOR_MASK)) { Rterm_set_screen_foreground_color(screen, RTERM_CHAR_FG_COLOR(textflags)); } } else if ((textflags & RTERM_CHAR_FG_COLOR_MASK) != (screen->gctextflags & RTERM_CHAR_FG_COLOR_MASK)) { Rterm_set_screen_foreground_color(screen, RTERM_CHAR_FG_COLOR(textflags)); } #if (SUPPORT_RTERM_BLINKING_CHARS) if ((textflags & RTERM_CHAR_BG_COLOR_MASK) != (screen->gctextflags & RTERM_CHAR_BG_COLOR_MASK)) { Rterm_set_screen_background_color(screen, RTERM_CHAR_BG_COLOR(textflags)); } #else /* !SUPPORT_RTERM_BLINKING_CHARS */ if (textflags & RTERM_CHAR_BLINKING) { if (RTERM_CHAR_BG_COLOR(textflags) < RTERM_SCREEN_MIN_BRIGHT_COLOR) { Rterm_set_screen_background_color(screen, RTERM_CHAR_BG_COLOR(textflags) + RTERM_SCREEN_BRIGHT_OFFSET); } else if ((textflags & RTERM_CHAR_BG_COLOR_MASK) != (screen->gctextflags & RTERM_CHAR_BG_COLOR_MASK)) { Rterm_set_screen_background_color(screen, RTERM_CHAR_BG_COLOR(textflags)); } } else if ((textflags & RTERM_CHAR_BG_COLOR_MASK) != (screen->gctextflags & RTERM_CHAR_BG_COLOR_MASK)) { Rterm_set_screen_background_color(screen, RTERM_CHAR_BG_COLOR(textflags)); } #endif if (textflags & RTERM_CHAR_REVERSE) { if (!(textflags & RTERM_CHAR_SELECTED)) { Rterm_set_screen_foreground_color(screen, RTERM_CHAR_BG_COLOR(textflags)); Rterm_set_screen_background_color(screen, RTERM_CHAR_FG_COLOR(textflags)); } } /* FIXME: finish this function. */ screen->gctextflags = textflags; return; }
vendu/Resurrection
lib/Rterm/gc.c
C
gpl-2.0
9,670
[ 30522, 1013, 1008, 1008, 1043, 2278, 1012, 1039, 1011, 8389, 6123, 1006, 1043, 2278, 1007, 23964, 2005, 15218, 1012, 1008, 9385, 1006, 1039, 1007, 2494, 10722, 19506, 2310, 12032, 18175, 2078, 1008, 1008, 2156, 1996, 5371, 24731, 2005, 2592...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
--- layout: post title: Redis应用场景 category: Redis tags: Redis keywords: Redis,应用场景 description: --- ## 1.取最新N个数据的操作 比如典型的取网站的最新文章,通过下面方式,我们可以将最新的500条评论的ID放在Redis的List集合中,并将超出集合部分从数据库获取。 * 使用LPUSH latest.comments<ID>命令,向list集合中插入数据 * 插入完成后再用LTRIM latest.comments 0 500命令使其永远只保存最近500个ID * 然后我们在客户端获取某一页评论时可以用下面的逻辑 伪代码 def get_latest_comments(start,num_items): id_list = redis.lrange("latest.comments",start,start+num_items-1) if ( id_list.length < num_items ) id_list = SQL_DB("SELECT ... ORDER BY time LIMIT ...") return id_list 如果你还有不同的筛选维度,比如某个分类的最新N条,那么你可以再建一个按此分类的List,只存ID的话,Redis是非常高效的。 ## 2.排行榜应用,取TOP N操作 这个需求与上面需求的不同之处在于,前面操作以时间为权重,这个是以某个条件为权重,比如按顶的次数排序,这时候可以应用sorted set,将你要排序的值设置成sorted set的score,将具体的数据设置成相应的value,每次只需要执行一条ZADD命令即可。 ## 3.需要精准设定过期时间的应用 比如你可以把上面说到的sorted set的score值设置成过期时间的时间戳,那么就可以简单地通过过期时间排序,定时清除过期数据了,不仅是清除Redis中的过期数据,你完全可以把Redis里这个过期时间当成是对数据库中数据的索引,用Redis来找出哪些数据需要过期删除,然后再精准地从数据库中删除相应的记录。 ## 4.计数器应用 Redis的命令都是原子性的,你可以轻松地利用INCR,DECR命令来构建计数器系统。 ## 5.Uniq操作,获取某段时间所有数据排重值 这个使用Redis的set数据结构最合适了,只需要不断地将数据往set中扔就行了,set意为集合,所以会自动排重。 ## 6.实时系统,反垃圾系统 通过上面说到的set功能,你可以知道一个终端用户是否进行了某个操作,可以找到其操作的集合并进行分析统计对比等。没有做不到,只有想不到。 ## 7.Pub/Sub构建实时消息系统 Redis的Pub/Sub系统可以构建实时的消息系统,比如很多用Pub/Sub构建的实时聊天系统的例子。 ## 8.构建队列系统 使用list可以构建队列系统,使用sorted set甚至可以构建有优先级的队列系统。 ## 9.缓存 这个不必说了,性能优于Memcached,数据结构更多样化。
microheart/microheart.github.io
_posts/Redis/2014-04-28-Redis_application.md
Markdown
mit
2,799
[ 30522, 1011, 1011, 1011, 9621, 1024, 2695, 2516, 1024, 2417, 2483, 100, 100, 100, 100, 4696, 1024, 2417, 2483, 22073, 1024, 2417, 2483, 3145, 22104, 1024, 2417, 2483, 1010, 100, 100, 100, 100, 6412, 1024, 1011, 1011, 1011, 1001, 1001, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>exact-real-arithmetic: Not compatible 👼</title> <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" /> <link href="../../../../../bootstrap.min.css" rel="stylesheet"> <link href="../../../../../bootstrap-custom.css" rel="stylesheet"> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <script src="../../../../../moment.min.js"></script> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <div class="container"> <div class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="../..">clean / released</a></li> <li class="active"><a href="">8.15.0 / exact-real-arithmetic - 8.6.0</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> exact-real-arithmetic <small> 8.6.0 <span class="label label-info">Not compatible 👼</span> </small> </h1> <p>📅 <em><script>document.write(moment("2022-02-01 04:13:48 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-02-01 04:13:48 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-threads base base-unix base conf-findutils 1 Virtual package relying on findutils conf-gmp 4 Virtual package relying on a GMP lib system installation coq 8.15.0 Formal proof management system dune 2.9.3 Fast, portable, and opinionated build system ocaml 4.12.1 The OCaml compiler (virtual package) ocaml-base-compiler 4.12.1 Official release 4.12.1 ocaml-config 2 OCaml Switch Configuration ocaml-options-vanilla 1 Ensure that OCaml is compiled with no special options enabled ocamlfind 1.9.3 A library manager for OCaml zarith 1.12 Implements arithmetic and logical operations over arbitrary-precision integers # opam file: opam-version: &quot;2.0&quot; maintainer: &quot;Hugo.Herbelin@inria.fr&quot; homepage: &quot;https://github.com/coq-contribs/exact-real-arithmetic&quot; license: &quot;LGPL 2.1&quot; build: [make &quot;-j%{jobs}%&quot;] install: [make &quot;install&quot;] remove: [&quot;rm&quot; &quot;-R&quot; &quot;%{lib}%/coq/user-contrib/ExactRealArithmetic&quot;] depends: [ &quot;ocaml&quot; &quot;coq&quot; {&gt;= &quot;8.6&quot; &amp; &lt; &quot;8.7~&quot;} ] tags: [ &quot;keyword: correctness&quot; &quot;keyword: real numbers&quot; &quot;keyword: arithmetic&quot; &quot;category: Mathematics/Arithmetic and Number Theory/Real numbers&quot; ] authors: [ &quot;Jérôme Creci&quot; ] bug-reports: &quot;https://github.com/coq-contribs/exact-real-arithmetic/issues&quot; dev-repo: &quot;git+https://github.com/coq-contribs/exact-real-arithmetic.git&quot; synopsis: &quot;Exact Real Arithmetic&quot; description: &quot;&quot;&quot; This contribution contains a proof of correctness of some exact real arithmetic algorithms from the PhD thesis of Valérie Ménissier-Morain&quot;&quot;&quot; flags: light-uninstall url { src: &quot;https://github.com/coq-contribs/exact-real-arithmetic/archive/v8.6.0.tar.gz&quot; checksum: &quot;md5=0286dd584cfca1f955924feae67845d8&quot; } </pre> <h2>Lint</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Dry install 🏜️</h2> <p>Dry install with the current Coq version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam install -y --show-action coq-exact-real-arithmetic.8.6.0 coq.8.15.0</code></dd> <dt>Return code</dt> <dd>5120</dd> <dt>Output</dt> <dd><pre>[NOTE] Package coq is already installed (current version is 8.15.0). The following dependencies couldn&#39;t be met: - coq-exact-real-arithmetic -&gt; coq &lt; 8.7~ -&gt; ocaml &lt; 4.06.0 base of this switch (use `--unlock-base&#39; to force) No solution found, exiting </pre></dd> </dl> <p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-exact-real-arithmetic.8.6.0</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Install dependencies</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Install 🚀</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Installation size</h2> <p>No files were installed.</p> <h2>Uninstall 🧹</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Missing removes</dt> <dd> none </dd> <dt>Wrong removes</dt> <dd> none </dd> </dl> </div> </div> </div> <hr/> <div class="footer"> <p class="text-center"> Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣 </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
coq-bench/coq-bench.github.io
clean/Linux-x86_64-4.12.1-2.0.8/released/8.15.0/exact-real-arithmetic/8.6.0.html
HTML
mit
7,198
[ 30522, 1026, 999, 9986, 13874, 16129, 1028, 1026, 16129, 11374, 1027, 1000, 4372, 30524, 6635, 1011, 2613, 1011, 20204, 1024, 2025, 11892, 100, 1026, 1013, 2516, 1028, 1026, 4957, 2128, 2140, 1027, 1000, 2460, 12690, 12696, 1000, 2828, 1027...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
import itertools, logging from gibbs.models import CommonName, Compound, Enzyme from haystack.query import SearchQuerySet class Error(Exception): pass class IllegalQueryError(Error): pass class Match(object): """An object containing a string match and it's score.""" def __init__(self, key, value, score): """Initialize a Match. Args: key: the object that matched. value: the value of the match (the object pointed to by the key). score: between 0.0 and 1.0, higher is better. """ self.key = key self.value = value self.score = score def __eq__(self, other): """Equality checking between matches, used for testing.""" return (self.key == other.key and self.value == other.value and self.score == other.score) def __str__(self): """Get as a string for debugging/printability.""" return '<matcher.Match> value=%s, score=%f' % (self.value, self.score) def TypeStr(self): if self.IsCompound(): return 'Compound' elif self.IsEnzyme(): return 'Enzyme' return '' def IsCompound(self): return isinstance(self.value, Compound) def IsEnzyme(self): return isinstance(self.value, Enzyme) def Key(self): if self.IsCompound(): return self.value.kegg_id elif self.IsEnzyme(): return self.value.ec return None class Matcher(object): """A class that matches a string against the database. The base implementation does exact matching. """ def __init__(self, max_results=10, min_score=0.0, match_enzymes=True): """Initializes the Matcher. Args: scorer: a MatchScorer object for scoring. max_results: the maximum number of matches to return. min_score: the minimum match score to return. """ self._max_results = max_results self._min_score = min_score self._match_enzymes = match_enzymes self._prefetch_objects = ['compound_set'] if self._match_enzymes: self._prefetch_objects.extend(['enzyme_set', 'enzyme_set__reactions']) def _AcceptQuery(self, query): """Accept or rejec expression = self._PrepareExpression(query) results = models.CommonName.objects.filter(name__iregex=expression)t the query. Returns: True if the query is accepted. """ if query.strip(): return True return False def _PreprocessQuery(self, query): """Perform pre-search query manipulation. Default implementation simply strips leading/trailing whitespace and makes the query lowercase. Args: query: the string query. Returns: The pre-processed query as a string. """ query = query.strip().lower() return query def _PrepocessCandidate(self, candidate): """Perform pre-match candidate manipulation. Default implementation converts to a lower-case string. Args: candidate: the candidate object (convertible to a string). Returns: The pre-processed candidate as a string. """ return str(candidate).strip().lower() def _FindNameMatches(self, query): """Find all the matches for this query. Args: query: the query to match. Returns: A list of CommonName objects matching the query. """ try: res = SearchQuerySet().filter(text__exact=query).best_match() return [res.object] except Exception as e: logging.warning('Query failed: ' + str(e)) return [] def _MakeMatchObjects(self, common_names): """Given the list of CommonNames, make the Matches. Args: common_names: a list of CommonNames. Returns: A list of Match objects. """ matches = [] for name in common_names: for compound in name.compound_set.all(): matches.append(Match(name, compound, 0.0)) if self._match_enzymes: for enzyme in name.enzyme_set.all(): matches.append(Match(name, enzyme, 0.0)) return matches def _GetScore(self, query, match): """Get the score for a query-match pair. Args: query: the query string. match: the Match object. Returns: A score between 0.0 and 1.0. """ query_len = float(len(query)) candidate_len = float(len(str(match.key))) return (query_len / candidate_len) def _ScoreMatches(self, query, matches): """Set the match scores for all matches. Args: query: the query string. matches: a list of match objects with uninitialized scores. """ for m in matches: m.score = self._GetScore(query, m) def _FilterMatches(self, matches): """Filter the match list for min score. Args: matches: an unfiltered list of match objects. """ # Filter matches without data or beneath the score limit. f = lambda match: (match.score >= self._min_score and match.value) filtered = filter(f, matches) # Take only unique matches. group_key = lambda match: match.Key() filtered_matches = [] for _, g in itertools.groupby(filtered, key=group_key): # Keep the unique match with the top score. max_match = None for match in g: if not max_match or max_match.score < match.score: max_match = match filtered_matches.append(max_match) return filtered_matches def _SortAndClip(self, matches): matches.sort(key=lambda m: m.score, reverse=True) return matches[:self._max_results] def Match(self, query): """Find matches for the query in the library. Args: query: the string query. Returns: A sorted list of Match objects or None if the query could not be parsed. """ if not self._AcceptQuery(query): raise IllegalQueryError('%s is not a valid query' % query) processed_query = self._PreprocessQuery(query) logging.debug('Query = %s' % processed_query) name_matches = self._FindNameMatches(processed_query) logging.debug('Found %d name matches' % len(name_matches)) matches = self._MakeMatchObjects(name_matches) self._ScoreMatches(processed_query, matches) matches = self._FilterMatches(matches) logging.debug('Found %d matches' % len(matches)) return self._SortAndClip(matches)
flamholz/equilibrator
matching/matcher.py
Python
mit
7,321
[ 30522, 12324, 2009, 8743, 13669, 2015, 1010, 15899, 2013, 15659, 1012, 4275, 12324, 2691, 18442, 1010, 7328, 1010, 9007, 2013, 29051, 2696, 3600, 1012, 23032, 12324, 3945, 4226, 24769, 3388, 2465, 7561, 1006, 6453, 1007, 1024, 3413, 2465, 6...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package me.rerun.akkanotes.messaging.requestresponse import akka.actor.Actor import akka.actor.ActorLogging import me.rerun.akkanotes.messaging.protocols.TeacherProtocol._ import me.rerun.akkanotes.messaging.protocols.StudentProtocol._ import akka.actor.Props import akka.actor.ActorRef /* * The Student Actor class. * */ class StudentActor (teacherActorRef:ActorRef) extends Actor with ActorLogging { def receive = { /* * This InitSignal is received from the DriverApp. * On receipt, the Student sends a message to the Teacher actor. * The teacher actor on receipt of the QuoteRequest responds with a QuoteResponse */ case InitSignal=> { teacherActorRef!QuoteRequest } /* * The Student simply logs the quote received from the TeacherActor * */ case QuoteResponse(quoteString) => { log.info ("Received QuoteResponse from Teacher") log.info(s"Printing from Student Actor $quoteString") } } }
arunma/AkkaMessagingRequestResponse
src/main/scala/me/rerun/akkanotes/messaging/requestresponse/StudentActor.scala
Scala
cc0-1.0
992
[ 30522, 7427, 2033, 1012, 2128, 15532, 1012, 17712, 9126, 12184, 2015, 1012, 24732, 1012, 5227, 6072, 26029, 3366, 12324, 17712, 2912, 1012, 3364, 1012, 3364, 12324, 17712, 2912, 1012, 3364, 1012, 3364, 21197, 4726, 12324, 2033, 1012, 2128, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
require File.dirname(__FILE__) + '/../spec_helper' describe PagesController do describe 'handling GET for a single post' do before(:each) do @page = mock_model(Page) Page.stub(:find_by_slug).and_return(@page) end def do_get get :show, :id => 'a-page' end it "should be successful" do do_get response.should be_success end it "should render show template" do do_get response.should render_template('show') end it 'should find the page requested' do Page.should_receive(:find_by_slug).with('a-page').and_return(@page) do_get end it 'should assign the page found for the view' do do_get assigns[:page].should equal(@page) end end describe 'handling GET with invalid page' do it 'raises a RecordNotFound error' do Page.stub(:find_by_slug).and_return(nil) lambda { get :show, :id => 'a-page' }.should raise_error(ActiveRecord::RecordNotFound) end end end
scottwainstock/pbm-blog
spec/controllers/pages_controller_spec.rb
Ruby
gpl-2.0
1,013
[ 30522, 5478, 5371, 1012, 16101, 18442, 1006, 1035, 1035, 5371, 1035, 1035, 1007, 1009, 1005, 1013, 1012, 1012, 1013, 28699, 1035, 2393, 2121, 1005, 6235, 5530, 8663, 13181, 10820, 2079, 6235, 1005, 8304, 2131, 2005, 1037, 2309, 2695, 1005, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* Copyright 2016 Goldman Sachs. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package com.gs.fw.common.mithra.test.tax; import com.gs.fw.finder.Operation; import java.util.*; public class FormRoleList extends FormRoleListAbstract { public FormRoleList() { super(); } public FormRoleList(int initialSize) { super(initialSize); } public FormRoleList(Collection c) { super(c); } public FormRoleList(Operation operation) { super(operation); } }
goldmansachs/reladomo
reladomo/src/test/java/com/gs/fw/common/mithra/test/tax/FormRoleList.java
Java
apache-2.0
1,001
[ 30522, 1013, 1008, 9385, 2355, 17765, 22818, 1012, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 1000, 1007, 1025, 2017, 2089, 2025, 2224, 2023, 5371, 3272, 1999, 12646, 2007, 1996, 6105, 1012, 2017, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!--[metadata]> +++ aliases = ["/engine/articles/dockerfile_best-practices/"] title = "Best practices for writing Dockerfiles" description = "Hints, tips and guidelines for writing clean, reliable Dockerfiles" keywords = ["Examples, Usage, base image, docker, documentation, dockerfile, best practices, hub, official repo"] [menu.main] parent = "engine_images" +++ <![end-metadata]--> # Best practices for writing Dockerfiles Docker can build images automatically by reading the instructions from a `Dockerfile`, a text file that contains all the commands, in order, needed to build a given image. `Dockerfile`s adhere to a specific format and use a specific set of instructions. You can learn the basics on the [Dockerfile Reference](../../reference/builder.md) page. If you’re new to writing `Dockerfile`s, you should start there. This document covers the best practices and methods recommended by Docker, Inc. and the Docker community for creating easy-to-use, effective `Dockerfile`s. We strongly suggest you follow these recommendations (in fact, if you’re creating an Official Image, you *must* adhere to these practices). You can see many of these practices and recommendations in action in the [buildpack-deps `Dockerfile`](https://github.com/docker-library/buildpack-deps/blob/master/jessie/Dockerfile). > Note: for more detailed explanations of any of the Dockerfile commands >mentioned here, visit the [Dockerfile Reference](../../reference/builder.md) page. ## General guidelines and recommendations ### Containers should be ephemeral The container produced by the image your `Dockerfile` defines should be as ephemeral as possible. By “ephemeral,” we mean that it can be stopped and destroyed and a new one built and put in place with an absolute minimum of set-up and configuration. ### Use a .dockerignore file In most cases, it's best to put each Dockerfile in an empty directory. Then, add to that directory only the files needed for building the Dockerfile. To increase the build's performance, you can exclude files and directories by adding a `.dockerignore` file to that directory as well. This file supports exclusion patterns similar to `.gitignore` files. For information on creating one, see the [.dockerignore file](../../reference/builder.md#dockerignore-file). ### Avoid installing unnecessary packages In order to reduce complexity, dependencies, file sizes, and build times, you should avoid installing extra or unnecessary packages just because they might be “nice to have.” For example, you don’t need to include a text editor in a database image. ### Run only one process per container In almost all cases, you should only run a single process in a single container. Decoupling applications into multiple containers makes it much easier to scale horizontally and reuse containers. If that service depends on another service, make use of [container linking](../../userguide/networking/default_network/dockerlinks.md). ### Minimize the number of layers You need to find the balance between readability (and thus long-term maintainability) of the `Dockerfile` and minimizing the number of layers it uses. Be strategic and cautious about the number of layers you use. ### Sort multi-line arguments Whenever possible, ease later changes by sorting multi-line arguments alphanumerically. This will help you avoid duplication of packages and make the list much easier to update. This also makes PRs a lot easier to read and review. Adding a space before a backslash (`\`) helps as well. Here’s an example from the [`buildpack-deps` image](https://github.com/docker-library/buildpack-deps): RUN apt-get update && apt-get install -y \ bzr \ cvs \ git \ mercurial \ subversion ### Build cache During the process of building an image Docker will step through the instructions in your `Dockerfile` executing each in the order specified. As each instruction is examined Docker will look for an existing image in its cache that it can reuse, rather than creating a new (duplicate) image. If you do not want to use the cache at all you can use the ` --no-cache=true` option on the `docker build` command. However, if you do let Docker use its cache then it is very important to understand when it will, and will not, find a matching image. The basic rules that Docker will follow are outlined below: * Starting with a base image that is already in the cache, the next instruction is compared against all child images derived from that base image to see if one of them was built using the exact same instruction. If not, the cache is invalidated. * In most cases simply comparing the instruction in the `Dockerfile` with one of the child images is sufficient. However, certain instructions require a little more examination and explanation. * For the `ADD` and `COPY` instructions, the contents of the file(s) in the image are examined and a checksum is calculated for each file. The last-modified and last-accessed times of the file(s) are not considered in these checksums. During the cache lookup, the checksum is compared against the checksum in the existing images. If anything has changed in the file(s), such as the contents and metadata, then the cache is invalidated. * Aside from the `ADD` and `COPY` commands, cache checking will not look at the files in the container to determine a cache match. For example, when processing a `RUN apt-get -y update` command the files updated in the container will not be examined to determine if a cache hit exists. In that case just the command string itself will be used to find a match. Once the cache is invalidated, all subsequent `Dockerfile` commands will generate new images and the cache will not be used. ## The Dockerfile instructions Below you'll find recommendations for the best way to write the various instructions available for use in a `Dockerfile`. ### FROM [Dockerfile reference for the FROM instruction](../../reference/builder.md#from) Whenever possible, use current Official Repositories as the basis for your image. We recommend the [Debian image](https://registry.hub.docker.com/_/debian/) since it’s very tightly controlled and kept extremely minimal (currently under 100 mb), while still being a full distribution. ### RUN [Dockerfile reference for the RUN instruction](../../reference/builder.md#run) As always, to make your `Dockerfile` more readable, understandable, and maintainable, split long or complex `RUN` statements on multiple lines separated with backslashes. ### apt-get Probably the most common use-case for `RUN` is an application of `apt-get`. The `RUN apt-get` command, because it installs packages, has several gotchas to look out for. You should avoid `RUN apt-get upgrade` or `dist-upgrade`, as many of the “essential” packages from the base images won't upgrade inside an unprivileged container. If a package contained in the base image is out-of-date, you should contact its maintainers. If you know there’s a particular package, `foo`, that needs to be updated, use `apt-get install -y foo` to update automatically. Always combine `RUN apt-get update` with `apt-get install` in the same `RUN` statement, for example: RUN apt-get update && apt-get install -y \ package-bar \ package-baz \ package-foo Using `apt-get update` alone in a `RUN` statement causes caching issues and subsequent `apt-get install` instructions fail. For example, say you have a Dockerfile: FROM ubuntu:14.04 RUN apt-get update RUN apt-get install -y curl After building the image, all layers are in the Docker cache. Suppose you later modify `apt-get install` by adding extra package: FROM ubuntu:14.04 RUN apt-get update RUN apt-get install -y curl nginx Docker sees the initial and modified instructions as identical and reuses the cache from previous steps. As a result the `apt-get update` is *NOT* executed because the build uses the cached version. Because the `apt-get update` is not run, your build can potentially get an outdated version of the `curl` and `nginx` packages. Using `RUN apt-get update && apt-get install -y` ensures your Dockerfile installs the latest package versions with no further coding or manual intervention. This technique is known as "cache busting". You can also achieve cache-busting by specifying a package version. This is known as version pinning, for example: RUN apt-get update && apt-get install -y \ package-bar \ package-baz \ package-foo=1.3.* Version pinning forces the build to retrieve a particular version regardless of what’s in the cache. This technique can also reduce failures due to unanticipated changes in required packages. Below is a well-formed `RUN` instruction that demonstrates all the `apt-get` recommendations. RUN apt-get update && apt-get install -y \ aufs-tools \ automake \ build-essential \ curl \ dpkg-sig \ libcap-dev \ libsqlite3-dev \ mercurial \ reprepro \ ruby1.9.1 \ ruby1.9.1-dev \ s3cmd=1.1.* \ && rm -rf /var/lib/apt/lists/* The `s3cmd` instructions specifies a version `1.1.0*`. If the image previously used an older version, specifying the new one causes a cache bust of `apt-get update` and ensure the installation of the new version. Listing packages on each line can also prevent mistakes in package duplication. In addition, cleaning up the apt cache and removing `/var/lib/apt/lists` helps keep the image size down. Since the `RUN` statement starts with `apt-get update`, the package cache will always be refreshed prior to `apt-get install`. > **Note**: The official Debian and Ubuntu images [automatically run `apt-get clean`](https://github.com/docker/docker/blob/03e2923e42446dbb830c654d0eec323a0b4ef02a/contrib/mkimage/debootstrap#L82-L105), > so explicit invocation is not required. ### CMD [Dockerfile reference for the CMD instruction](../../reference/builder.md#cmd) The `CMD` instruction should be used to run the software contained by your image, along with any arguments. `CMD` should almost always be used in the form of `CMD [“executable”, “param1”, “param2”…]`. Thus, if the image is for a service (Apache, Rails, etc.), you would run something like `CMD ["apache2","-DFOREGROUND"]`. Indeed, this form of the instruction is recommended for any service-based image. In most other cases, `CMD` should be given an interactive shell (bash, python, perl, etc), for example, `CMD ["perl", "-de0"]`, `CMD ["python"]`, or `CMD [“php”, “-a”]`. Using this form means that when you execute something like `docker run -it python`, you’ll get dropped into a usable shell, ready to go. `CMD` should rarely be used in the manner of `CMD [“param”, “param”]` in conjunction with [`ENTRYPOINT`](../../reference/builder.md#entrypoint), unless you and your expected users are already quite familiar with how `ENTRYPOINT` works. ### EXPOSE [Dockerfile reference for the EXPOSE instruction](../../reference/builder.md#expose) The `EXPOSE` instruction indicates the ports on which a container will listen for connections. Consequently, you should use the common, traditional port for your application. For example, an image containing the Apache web server would use `EXPOSE 80`, while an image containing MongoDB would use `EXPOSE 27017` and so on. For external access, your users can execute `docker run` with a flag indicating how to map the specified port to the port of their choice. For container linking, Docker provides environment variables for the path from the recipient container back to the source (ie, `MYSQL_PORT_3306_TCP`). ### ENV [Dockerfile reference for the ENV instruction](../../reference/builder.md#env) In order to make new software easier to run, you can use `ENV` to update the `PATH` environment variable for the software your container installs. For example, `ENV PATH /usr/local/nginx/bin:$PATH` will ensure that `CMD [“nginx”]` just works. The `ENV` instruction is also useful for providing required environment variables specific to services you wish to containerize, such as Postgres’s `PGDATA`. Lastly, `ENV` can also be used to set commonly used version numbers so that version bumps are easier to maintain, as seen in the following example: ENV PG_MAJOR 9.3 ENV PG_VERSION 9.3.4 RUN curl -SL http://example.com/postgres-$PG_VERSION.tar.xz | tar -xJC /usr/src/postgress && … ENV PATH /usr/local/postgres-$PG_MAJOR/bin:$PATH Similar to having constant variables in a program (as opposed to hard-coding values), this approach lets you change a single `ENV` instruction to auto-magically bump the version of the software in your container. ### ADD or COPY [Dockerfile reference for the ADD instruction](../../reference/builder.md#add)<br/> [Dockerfile reference for the COPY instruction](../../reference/builder.md#copy) Although `ADD` and `COPY` are functionally similar, generally speaking, `COPY` is preferred. That’s because it’s more transparent than `ADD`. `COPY` only supports the basic copying of local files into the container, while `ADD` has some features (like local-only tar extraction and remote URL support) that are not immediately obvious. Consequently, the best use for `ADD` is local tar file auto-extraction into the image, as in `ADD rootfs.tar.xz /`. If you have multiple `Dockerfile` steps that use different files from your context, `COPY` them individually, rather than all at once. This will ensure that each step's build cache is only invalidated (forcing the step to be re-run) if the specifically required files change. For example: COPY requirements.txt /tmp/ RUN pip install --requirement /tmp/requirements.txt COPY . /tmp/ Results in fewer cache invalidations for the `RUN` step, than if you put the `COPY . /tmp/` before it. Because image size matters, using `ADD` to fetch packages from remote URLs is strongly discouraged; you should use `curl` or `wget` instead. That way you can delete the files you no longer need after they've been extracted and you won't have to add another layer in your image. For example, you should avoid doing things like: ADD http://example.com/big.tar.xz /usr/src/things/ RUN tar -xJf /usr/src/things/big.tar.xz -C /usr/src/things RUN make -C /usr/src/things all And instead, do something like: RUN mkdir -p /usr/src/things \ && curl -SL http://example.com/big.tar.xz \ | tar -xJC /usr/src/things \ && make -C /usr/src/things all For other items (files, directories) that do not require `ADD`’s tar auto-extraction capability, you should always use `COPY`. ### ENTRYPOINT [Dockerfile reference for the ENTRYPOINT instruction](../../reference/builder.md#entrypoint) The best use for `ENTRYPOINT` is to set the image's main command, allowing that image to be run as though it was that command (and then use `CMD` as the default flags). Let's start with an example of an image for the command line tool `s3cmd`: ENTRYPOINT ["s3cmd"] CMD ["--help"] Now the image can be run like this to show the command's help: $ docker run s3cmd Or using the right parameters to execute a command: $ docker run s3cmd ls s3://mybucket This is useful because the image name can double as a reference to the binary as shown in the command above. The `ENTRYPOINT` instruction can also be used in combination with a helper script, allowing it to function in a similar way to the command above, even when starting the tool may require more than one step. For example, the [Postgres Official Image](https://registry.hub.docker.com/_/postgres/) uses the following script as its `ENTRYPOINT`: ```bash #!/bin/bash set -e if [ "$1" = 'postgres' ]; then chown -R postgres "$PGDATA" if [ -z "$(ls -A "$PGDATA")" ]; then gosu postgres initdb fi exec gosu postgres "$@" fi exec "$@" ``` > **Note**: > This script uses [the `exec` Bash command](http://wiki.bash-hackers.org/commands/builtin/exec) > so that the final running application becomes the container's PID 1. This allows > the application to receive any Unix signals sent to the container. > See the [`ENTRYPOINT`](../../reference/builder.md#entrypoint) > help for more details. The helper script is copied into the container and run via `ENTRYPOINT` on container start: COPY ./docker-entrypoint.sh / ENTRYPOINT ["/docker-entrypoint.sh"] This script allows the user to interact with Postgres in several ways. It can simply start Postgres: $ docker run postgres Or, it can be used to run Postgres and pass parameters to the server: $ docker run postgres postgres --help Lastly, it could also be used to start a totally different tool, such as Bash: $ docker run --rm -it postgres bash ### VOLUME [Dockerfile reference for the VOLUME instruction](../../reference/builder.md#volume) The `VOLUME` instruction should be used to expose any database storage area, configuration storage, or files/folders created by your docker container. You are strongly encouraged to use `VOLUME` for any mutable and/or user-serviceable parts of your image. ### USER [Dockerfile reference for the USER instruction](../../reference/builder.md#user) If a service can run without privileges, use `USER` to change to a non-root user. Start by creating the user and group in the `Dockerfile` with something like `RUN groupadd -r postgres && useradd -r -g postgres postgres`. > **Note:** Users and groups in an image get a non-deterministic > UID/GID in that the “next” UID/GID gets assigned regardless of image > rebuilds. So, if it’s critical, you should assign an explicit UID/GID. You should avoid installing or using `sudo` since it has unpredictable TTY and signal-forwarding behavior that can cause more problems than it solves. If you absolutely need functionality similar to `sudo` (e.g., initializing the daemon as root but running it as non-root), you may be able to use [“gosu”](https://github.com/tianon/gosu). Lastly, to reduce layers and complexity, avoid switching `USER` back and forth frequently. ### WORKDIR [Dockerfile reference for the WORKDIR instruction](../../reference/builder.md#workdir) For clarity and reliability, you should always use absolute paths for your `WORKDIR`. Also, you should use `WORKDIR` instead of proliferating instructions like `RUN cd … && do-something`, which are hard to read, troubleshoot, and maintain. ### ONBUILD [Dockerfile reference for the ONBUILD instruction](../../reference/builder.md#onbuild) An `ONBUILD` command executes after the current `Dockerfile` build completes. `ONBUILD` executes in any child image derived `FROM` the current image. Think of the `ONBUILD` command as an instruction the parent `Dockerfile` gives to the child `Dockerfile`. A Docker build executes `ONBUILD` commands before any command in a child `Dockerfile`. `ONBUILD` is useful for images that are going to be built `FROM` a given image. For example, you would use `ONBUILD` for a language stack image that builds arbitrary user software written in that language within the `Dockerfile`, as you can see in [Ruby’s `ONBUILD` variants](https://github.com/docker-library/ruby/blob/master/2.1/onbuild/Dockerfile). Images built from `ONBUILD` should get a separate tag, for example: `ruby:1.9-onbuild` or `ruby:2.0-onbuild`. Be careful when putting `ADD` or `COPY` in `ONBUILD`. The “onbuild” image will fail catastrophically if the new build's context is missing the resource being added. Adding a separate tag, as recommended above, will help mitigate this by allowing the `Dockerfile` author to make a choice. ## Examples for Official Repositories These Official Repositories have exemplary `Dockerfile`s: * [Go](https://registry.hub.docker.com/_/golang/) * [Perl](https://registry.hub.docker.com/_/perl/) * [Hy](https://registry.hub.docker.com/_/hylang/) * [Rails](https://registry.hub.docker.com/_/rails) ## Additional resources: * [Dockerfile Reference](../../reference/builder.md) * [More about Base Images](baseimages.md) * [More about Automated Builds](https://docs.docker.com/docker-hub/builds/) * [Guidelines for Creating Official Repositories](https://docs.docker.com/docker-hub/official_repos/)
sallyom/docker
docs/userguide/eng-image/dockerfile_best-practices.md
Markdown
apache-2.0
20,432
[ 30522, 30524, 1013, 1000, 1033, 2516, 1027, 1000, 2190, 6078, 2005, 3015, 8946, 2121, 8873, 4244, 1000, 6412, 1027, 1000, 20385, 1010, 10247, 1998, 11594, 2005, 3015, 4550, 1010, 10539, 8946, 2121, 8873, 4244, 1000, 3145, 22104, 1027, 1031,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...