code
stringlengths
3
1.01M
repo_name
stringlengths
5
116
path
stringlengths
3
311
language
stringclasses
30 values
license
stringclasses
15 values
size
int64
3
1.01M
package acc.common.cmdline; /** * Defines a data validator. */ public interface IValidator { /** * Validates the specified value and returns an error message if the data is not valid. * If the data is valid, method should return null. * @param value Value to validate * @return Null value if data is valid, error message otherwise */ String validateValue(Object value); }
Guidewire/java-cmd-parser
src/acc/common/cmdline/IValidator.java
Java
apache-2.0
408
using System.Threading.Tasks; using JetBrains.Annotations; using Xunit; using YouTrackSharp.Management; using YouTrackSharp.Tests.Infrastructure; namespace YouTrackSharp.Tests.Integration.Management.TimeTracking { [UsedImplicitly] public partial class TimeTrackingServiceTests { public class TimeTrackingManagementServiceTests { [Fact] public async Task Valid_Connection_Updates_TimeTracking_Settings_For_Project() { // Arrange var connection = Connections.Demo1Token; var service = connection.CreateTimeTrackingManagementService(); // Act await service.UpdateTimeTrackingSettingsForProject("DP1", new TimeTrackingSettings { Enabled = true }); // Assert var result = await service.GetTimeTrackingSettingsForProject("DP1"); Assert.True(result.Enabled); } } } }
JetBrains/YouTrackSharp
tests/YouTrackSharp.Tests/Integration/Management/TimeTracking/UpdateTimeTrackingSettingsForProject.cs
C#
apache-2.0
960
/* * Copyright 2015 agwlvssainokuni * * 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 cherry.foundation.testtool.stub; 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.mockito.Mockito.mock; import java.lang.reflect.Method; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import cherry.foundation.testtool.ToolTester; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = "classpath:config/applicationContext-test.xml") public class StubTest { @Autowired private StubRepository repository; private Method method; @Before public void before() throws NoSuchMethodException { method = ToolTester.class.getDeclaredMethod("toBeStubbed", Long.class, Long.class); } @After public void after() { for (Method m : repository.getStubbedMethod()) { repository.clear(m); } } @Test public void testNext() { Stub<?> stub = repository.get(method).thenReturn(Long.valueOf(123L), Long.class.getCanonicalName()); assertTrue(stub.hasNext()); assertFalse(stub.isMock()); assertFalse(stub.isThrowable()); assertEquals(Long.class.getCanonicalName(), stub.peekType()); assertEquals(Long.valueOf(123L), stub.next()); assertFalse(stub.hasNext()); } @Test public void testNextWhenRepeatedFalse() { Stub<?> stub = repository.get(method).thenReturn(Long.valueOf(123L), Long.class.getCanonicalName()) .setRepeated(false); assertFalse(repository.get(method).isRepeated()); assertTrue(stub.hasNext()); assertFalse(stub.isMock()); assertFalse(stub.isThrowable()); assertEquals(Long.class.getCanonicalName(), stub.peekType()); assertEquals(Long.valueOf(123L), stub.next()); assertFalse(stub.hasNext()); } @Test public void testNextWhenRepeatedTrue() { Stub<?> stub = repository.get(method).thenReturn(Long.valueOf(123L), Long.class.getCanonicalName()) .setRepeated(true); assertTrue(repository.get(method).isRepeated()); assertTrue(stub.hasNext()); assertFalse(stub.isMock()); assertFalse(stub.isThrowable()); assertEquals(Long.class.getCanonicalName(), stub.peekType()); assertEquals(Long.valueOf(123L), stub.next()); assertTrue(stub.hasNext()); assertFalse(stub.isMock()); assertFalse(stub.isThrowable()); assertEquals(Long.class.getCanonicalName(), stub.peekType()); assertEquals(Long.valueOf(123L), stub.next()); } @Test public void testPeek() { Stub<?> stub = repository.get(method).thenReturn(Long.valueOf(123L), Long.class.getCanonicalName()); assertTrue(stub.hasNext()); assertFalse(stub.isMock()); assertFalse(stub.isThrowable()); assertEquals(Long.class.getCanonicalName(), stub.peekType()); assertEquals(Long.valueOf(123L), stub.peek()); assertTrue(stub.hasNext()); assertEquals(Long.valueOf(123L), stub.next()); assertFalse(stub.hasNext()); } @Test(expected = IllegalStateException.class) public void testNextWhenEmpty() { Stub<?> stub = repository.get(method); assertFalse(stub.hasNext()); stub.next(); } @Test(expected = IllegalStateException.class) public void testPeekWhenEmpty() { Stub<?> stub = repository.get(method); assertFalse(stub.hasNext()); stub.peek(); } @Test public void testNextMock() { ToolTester mock = mock(ToolTester.class); Stub<?> stub = repository.get(method).thenMock(mock); assertTrue(stub.hasNext()); assertTrue(stub.isMock()); assertFalse(stub.isThrowable()); assertEquals(mock, stub.nextMock()); assertFalse(stub.hasNext()); } @Test public void testPeekMock() { ToolTester mock = mock(ToolTester.class); Stub<?> stub = repository.get(method).thenMock(mock); assertTrue(stub.hasNext()); assertTrue(stub.isMock()); assertFalse(stub.isThrowable()); assertEquals(mock, stub.peekMock()); assertTrue(stub.hasNext()); assertEquals(mock, stub.nextMock()); assertFalse(stub.hasNext()); } @Test public void testNextThrowable() { Stub<?> stub = repository.get(method).thenThrows(IllegalArgumentException.class); assertTrue(stub.hasNext()); assertFalse(stub.isMock()); assertTrue(stub.isThrowable()); assertEquals(IllegalArgumentException.class, stub.nextThrowable()); assertFalse(stub.hasNext()); } @Test public void testPeekThrowable() { Stub<?> stub = repository.get(method).thenThrows(IllegalArgumentException.class); assertTrue(stub.hasNext()); assertFalse(stub.isMock()); assertTrue(stub.isThrowable()); assertEquals(IllegalArgumentException.class, stub.peekThrowable()); assertTrue(stub.hasNext()); assertEquals(IllegalArgumentException.class, stub.nextThrowable()); assertFalse(stub.hasNext()); } @Test public void testAlwaysReturn1() { Stub<?> stub = repository.get(method).alwaysReturn(Long.valueOf(123L)); for (int i = 0; i < 100; i++) { assertTrue(stub.hasNext()); assertFalse(stub.isMock()); assertFalse(stub.isThrowable()); assertEquals(Long.class.getCanonicalName(), stub.peekType()); assertEquals(Long.valueOf(123L), stub.peek()); assertEquals(Long.valueOf(123L), stub.next()); } stub.clear(); assertFalse(stub.hasNext()); } @Test public void testAlwaysReturn1_null() { Stub<?> stub = repository.get(method).alwaysReturn((Long) null); for (int i = 0; i < 100; i++) { assertTrue(stub.hasNext()); assertFalse(stub.isMock()); assertFalse(stub.isThrowable()); assertNull(stub.peekType()); assertNull(stub.peek()); assertNull(stub.next()); } stub.clear(); assertFalse(stub.hasNext()); } @Test public void testAlwaysReturn2() { Stub<?> stub = repository.get(method).alwaysReturn(Long.valueOf(123L), "long"); for (int i = 0; i < 100; i++) { assertTrue(stub.hasNext()); assertFalse(stub.isMock()); assertFalse(stub.isThrowable()); assertEquals("long", stub.peekType()); assertEquals(Long.valueOf(123L), stub.peek()); assertEquals(Long.valueOf(123L), stub.next()); } stub.clear(); assertFalse(stub.hasNext()); } @Test public void testThenReturn1() { Stub<?> stub = repository.get(method).thenReturn(Long.valueOf(123L)); assertTrue(stub.hasNext()); assertFalse(stub.isMock()); assertFalse(stub.isThrowable()); assertEquals(Long.class.getCanonicalName(), stub.peekType()); assertEquals(Long.valueOf(123L), stub.peek()); assertEquals(Long.valueOf(123L), stub.next()); assertFalse(stub.hasNext()); } @Test public void testThenReturn1_null() { Stub<?> stub = repository.get(method).thenReturn((Long) null); assertTrue(stub.hasNext()); assertFalse(stub.isMock()); assertFalse(stub.isThrowable()); assertNull(stub.peekType()); assertNull(stub.peek()); assertNull(stub.next()); assertFalse(stub.hasNext()); } @Test public void testThenReturn2() { Stub<?> stub = repository.get(method).thenReturn(Long.valueOf(123L), "long"); assertTrue(stub.hasNext()); assertFalse(stub.isMock()); assertFalse(stub.isThrowable()); assertEquals("long", stub.peekType()); assertEquals(Long.valueOf(123L), stub.peek()); assertEquals(Long.valueOf(123L), stub.next()); assertFalse(stub.hasNext()); } @Test public void testAlwaysMock() { ToolTester mock = mock(ToolTester.class); Stub<?> stub = repository.get(method).alwaysMock(mock); for (int i = 0; i < 100; i++) { assertTrue(stub.hasNext()); assertTrue(stub.isMock()); assertFalse(stub.isThrowable()); assertEquals(mock, stub.peekMock()); assertEquals(mock, stub.nextMock()); } stub.clear(); assertFalse(stub.hasNext()); } @Test public void testThenMock() { ToolTester mock = mock(ToolTester.class); Stub<?> stub = repository.get(method).thenMock(mock); assertTrue(stub.hasNext()); assertTrue(stub.isMock()); assertFalse(stub.isThrowable()); assertEquals(mock, stub.peekMock()); assertEquals(mock, stub.nextMock()); assertFalse(stub.hasNext()); } @Test public void testAlwaysThrows() { Stub<?> stub = repository.get(method).alwaysThrows(IllegalArgumentException.class); for (int i = 0; i < 100; i++) { assertTrue(stub.hasNext()); assertFalse(stub.isMock()); assertTrue(stub.isThrowable()); assertEquals(IllegalArgumentException.class, stub.peekThrowable()); assertEquals(IllegalArgumentException.class, stub.nextThrowable()); } stub.clear(); assertFalse(stub.hasNext()); } @Test public void testThenThrows() { Stub<?> stub = repository.get(method).thenThrows(IllegalArgumentException.class); assertTrue(stub.hasNext()); assertFalse(stub.isMock()); assertTrue(stub.isThrowable()); assertEquals(IllegalArgumentException.class, stub.peekThrowable()); assertEquals(IllegalArgumentException.class, stub.nextThrowable()); assertFalse(stub.hasNext()); } }
agwlvssainokuni/springapp
foundation/src/test/java/cherry/foundation/testtool/stub/StubTest.java
Java
apache-2.0
9,800
if ( SERVER ) then AddCSLuaFile( "shared.lua" ) end if ( CLIENT ) then SWEP.PrintName = "DC-15A TIGER" SWEP.Author = "TFA" SWEP.ViewModelFOV = 50 SWEP.Slot = 2 SWEP.SlotPos = 3 SWEP.WepSelectIcon = surface.GetTextureID("HUD/killicons/DC15A") killicon.Add( "weapon_752_dc15a", "HUD/killicons/DC15A", Color( 255, 80, 0, 255 ) ) end SWEP.HoldType = "ar2" SWEP.Base = "tfa_swsft_base_servius" SWEP.Category = "TFA Fray SWEP's" SWEP.Spawnable = true SWEP.AdminSpawnable = true SWEP.HoldType = "ar2" SWEP.ViewModelFOV = 56 SWEP.ViewModelFlip = false SWEP.ViewModel = "models/weapons/cstrike/c_snip_awp.mdl" SWEP.WorldModel = "models/weapons/w_irifle.mdl" SWEP.ShowViewModel = true SWEP.ShowWorldModel = false SWEP.UseHands = true SWEP.ViewModelBoneMods = { ["v_weapon.awm_parent"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) }, ["ValveBiped.Bip01_L_Clavicle"] = { scale = Vector(1, 1, 1), pos = Vector(0.338, 2.914, 0.18), angle = Angle(0, 0, 0) }, ["ValveBiped.Bip01_L_Finger0"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(0, 1.447, 0) } } SWEP.Primary.Sound = Sound ("weapons/dc15a/DC15A_fire.ogg"); SWEP.Primary.ReloadSound = Sound ("weapons/shared/standard_reload.ogg"); SWEP.Weight = 5 SWEP.AutoSwitchTo = false SWEP.AutoSwitchFrom = false SWEP.Primary.Recoil = 0.5 SWEP.Primary.Damage = 30 SWEP.Primary.NumShots = 1 SWEP.Primary.Spread = 0.0125 SWEP.Primary.IronAccuracy = .005 -- Ironsight accuracy, should be the same for shotguns SWEP.Primary.ClipSize = 50 SWEP.Primary.RPM = 60/0.175 SWEP.Primary.DefaultClip = 150 SWEP.Primary.Automatic = true SWEP.Primary.Ammo = "ar2" SWEP.TracerName = "effect_sw_laser_blue" SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "none" SWEP.Secondary.IronFOV = 70 SWEP.IronSightsPos = Vector(-7.401, -18.14, 2.099) SWEP.IronSightsAng = Vector(-1.89, 0.282, 0) SWEP.VElements = { ["element_name"] = { type = "Model", model = "models/weapons/w_dc15a_neue2_tiger.mdl", bone = "v_weapon.awm_parent", rel = "", pos = Vector(-0.011, -2.924, -5.414), angle = Angle(180, 0, -89.595), size = Vector(0.95, 0.95, 0.95), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } } SWEP.WElements = { ["element_name2"] = { type = "Model", model = "models/weapons/w_dc15a_neue2_tiger.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(8.279, 0.584, -4.468), angle = Angle(0, -90, 160.731), size = Vector(0.884, 0.884, 0.884), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } } SWEP.BlowbackVector = Vector(0,-3,0.025) SWEP.Blowback_Only_Iron = false SWEP.DoProceduralReload = true SWEP.ProceduralReloadTime = 2.5
Servius/tfa-sw-weapons-repository
Live Addons/servius_uploader_legacy/tfa_swrp_expanded_weapons_pack/lua/weapons/tfa_swch_dc15a_tiger_fray/shared.lua
Lua
apache-2.0
2,809
/*! * UI development toolkit for HTML5 (OpenUI5) * (c) Copyright 2009-2020 SAP SE or an SAP affiliate company. * Licensed under the Apache License, Version 2.0 - see LICENSE.txt. */ sap.ui.define(['jquery.sap.global', './ListItemBaseRenderer', 'sap/ui/core/Renderer'], function(jQuery, ListItemBaseRenderer, Renderer) { "use strict"; /** * <code>MenuListItem</code> renderer. * @namespace */ var MenuListItemRenderer = Renderer.extend(ListItemBaseRenderer); /** * Renders the HTML starting tag of the <code>MenuListItem</code>. * * @param {sap.ui.core.RenderManager} rm The RenderManager that can be used for writing to the Render-Output-Buffer * @param {sap.ui.core.Control} oLI an object representation of the control that should be rendered * @protected */ MenuListItemRenderer.openItemTag = function(rm, oLI) { if (oLI.getStartsSection()) { rm.write("<li "); rm.write("role=\"separator\" "); rm.write("class=\"sapUiMnuDiv\"><div class=\"sapUiMnuDivL\"></div><hr><div class=\"sapUiMnuDivR\"></div></li>"); } ListItemBaseRenderer.openItemTag(rm, oLI); }; /** * Renders the HTML for the given control, using the provided * {@link sap.ui.core.RenderManager}. * * @param {sap.ui.core.RenderManager} * oRenderManager the RenderManager that can be used for writing to the * Render-Output-Buffer * @param {sap.ui.core.Control} * oControl an object representation of the control that should be * rendered */ MenuListItemRenderer.renderLIAttributes = function(rm, oLI) { rm.addClass("sapMSLI"); if (oLI.getIcon()) { rm.addClass("sapMSLIIcon"); } if (oLI.getType() == sap.m.ListType.Detail || oLI.getType() == sap.m.ListType.DetailAndActive) { rm.addClass("sapMSLIDetail"); } if (oLI._hasSubItems()) { rm.addClass("sapMMenuLIHasChildren"); } }; MenuListItemRenderer.renderLIContent = function(rm, oLI) { var sTextDir = oLI.getTitleTextDirection(); // image if (oLI.getIcon()) { rm.renderControl(oLI._getImage((oLI.getId() + "-img"), "sapMMenuLIImgThumb", oLI.getIcon(), oLI.getIconDensityAware())); } rm.write("<div"); rm.addClass("sapMSLIDiv"); rm.addClass("sapMSLITitleDiv"); rm.writeClasses(); rm.write(">"); //noFlex: make an additional div for the contents table if (oLI._bNoFlex) { rm.write('<div class="sapMLIBNoFlex">'); } // List item text (also written when no title for keeping the space) rm.write("<div"); rm.addClass("sapMSLITitleOnly"); rm.writeClasses(); if (sTextDir !== sap.ui.core.TextDirection.Inherit) { rm.writeAttribute("dir", sTextDir.toLowerCase()); } rm.write(">"); rm.writeEscaped(oLI.getTitle()); rm.write("</div>"); //noFlex: make an additional div for the contents table if (oLI._bNoFlex) { rm.write('</div>'); } rm.write("</div>"); // arrow right if there is a sub-menu if (oLI._hasSubItems()) { rm.renderControl(oLI._getIconArrowRight()); } }; return MenuListItemRenderer; }, /* bExport= */ true);
openui5/packaged-sap.m
resources/sap/m/MenuListItemRenderer.js
JavaScript
apache-2.0
3,122
# Copyright 2016 Google 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. # ################################################################################ FROM gcr.io/oss-fuzz-base/base-builder MAINTAINER hhan@redhat.com RUN apt-get update && apt-get install -y libreadline-dev libselinux1-dev \ libxml2-dev make autoconf automake libtool pkg-config bison flex RUN git clone --depth 1 https://github.com/hercules-team/augeas WORKDIR augeas COPY build.sh $SRC/ COPY augeas_escape_name_fuzzer.cc $SRC/
robertswiecki/oss-fuzz
projects/augeas/Dockerfile
Dockerfile
apache-2.0
1,011
<div class='row'> <div class='col-sm-12 col-md-12 col-lg-12 center-block'> <video id="videojs-overlay-player" class="video-js vjs-default-skin" controls width="auto" height="auto"> <source src="<?= $video->src; ?>" type='<?= $video->type ?>'> </video> </div> </div> <div id='tabs'> <ul> <li><a href="#add-annotation-gui">Add Annotation</a></li> <li><a href="#delete-annotation-gui" onclick='loadAnnotations()'>Edit Annotations</a></li> </ul> <div id='add-annotation-gui' class='row'> <div class='col-sm-12 col-md-12 col-lg-12'> <h2>Annotate</h2> <div class="well"> <div class='row'> <div class='col-md-5 col-sm-5'> <h3>Annotation Text</h3> <input id="text" type="textfield"></input> </div> <div class='col-md-5 col-sm-5 pull-right'> <h3>Annotation Time</h3> Use the yellow sliders on the video to adjust when the annotation will be applied. </div> </div> <h3>Position</h3> <label>Top Left</label> <input id="position-tl" name="position" type="radio" value="top-left" checked> <label>| Top</label> <input id="position-t" name="position" type="radio" value="top"> <label>| Top Right</label> <input id="position-tr" name="position" type="radio" value="top-right"> <label>| Right</label> <input id="position-r" name="position" type="radio" value="right"> <label>| Bottom Right</label> <input id="position-br" name="position" type="radio" value="bottom-right"> <label>| Bottom</label> <input id="position-b" name="position" type="radio" value="bottom"> <label>| Bottom Left</label> <input id="position-bl" name="position" type="radio" value="bottom-left"> <label>| Left</label> <input id="position-l" name="position" type="radio" value="left"> <br> <br> <button id="save" class='btn btn-primary' onClick="annotate()">Save Annotation</button> </div> </div> </div> <div id='delete-annotation-gui' class='row'> <div id='annotation-spinner' class='col-sm-12 col-md-12 col-lg-12 text-center'> <i class='fa fa-spinner fa-spin'></i> </div> <div id='annotation-table'> <div class='row'> <div class='col-sm-1 col-md-1 col-lg-1'> <h4>Delete?</h4> </div> <div class='col-sm-1 col-md-1 col-lg-1'> <h4>Start</h4> </div> <div class='col-sm-1 col-md-1 col-lg-1'> <h4>End</h4> </div> <div class='col-sm-6 col-md-6 col-lg-6'> <h4>Text</h4> </div> <div class='col-sm-1 col-md-1 col-lg-1'> <h4>Position</h4> </div> <div class='col-sm-1 col-md-1 col-lg-1'> <h4>User</h4> </div> </div> </div> </div> </div> <br> <div class="row"> <div class='col-sm-12 col-md-12 col-lg-12'> <div class="container-fluid well well-sm"> <div class='row'> <div class='col-md-12 col-sm-12 col-lg-12'> <h3><?= $video->title ?></h3> </div> </div> <br> <div class='row'> <div class='col-md-2'> <img class='profile-pic-icon' src="<?= $user->profile_picture ?>"> </div> <div class='col-md-6'> <a href="/users/profile/<?= $user->username; ?>"><h5><?= $user->username; ?></h5></a> </div> </div> </div> </div> </div> <div class="row"> <div class='col-sm-12 col-md-12 col-lg-12'> <div class="well"> <div> </div> <div> <?= $video->description; ?> </div> </div> </div> </div> <script> $(document).ready(function(){ /* Hide the edit spinner for now */ $('#annotation-spinner').hide(); /* Instantiate the tabs for the annotation GUI */ $(function() { $( "#tabs" ).tabs(); }); }); /* Update the position variable every time a radio option changes */ var position = 'top-left'; $("input:radio[name=position]").click(function() { position = $(this).val(); }); /* Event delegation for the deletion of annotations */ $(document).on('click', '.del-annotation', function(){ var rid = $(this).data('rid'); var self = this; $.post( "/api/deleteAnnotation", { id: rid }, function() { $(self).parent().parent().remove(); alert('Your annotation has been deleted from the server, but you will need to refresh to remove it locally.'); console.log("Successfully deleted annotation."); }) .fail(function() { alert( "error" ); }); }); /* Load the overlays from the database */ var overlays = <?= $overlays ?>; /* Set up the videoJS player with the rangeslider */ (function(window, videojs) { var player = window.player = videojs('videojs-overlay-player'); player.overlay({ overlays: overlays }); options = { hidden:false, controlTime:true }; player.rangeslider(options) }(window, window.videojs)); /* Save annotations, add to list, and clear the forms when the button is clicked */ annotate = function(){ var mPlayer = videojs("videojs-overlay-player"); times = mPlayer.getValueSlider(); timeString = "[" + times.start + ', ' + times.end + ']'; annotation = $('#text').val(); overlays.push({content:annotation, start:times.start, end:times.end, align:position}); mPlayer.overlay({ overlays: overlays }); var jqxhr = $.post( "/api/annotateText", { text:annotation, start:times.start, end:times.end, video_id:"<?= $video->id ?>", user_id:"<?= $this->session->userdata('id') ?>", position:position }, function() { console.log("Successfully saved annotation."); }) .fail(function() { alert( "error" ); }); $('#text').val(''); $('#position-tl').prop('checked', true); } /* Generates an annotation element */ annotationRow = function(id, start, end, text, position, username){ var elementString = "<div class='row'>" + "<div class='col-sm-1 col-md-1 col-lg-1'>" + "<button class='btn btn-danger del-annotation' data-rid='" + id + "'>Delete</button>" + "</div>" + "<div class='col-sm-1 col-md-1 col-lg-1'>" + + start + "s" + "</div>" + "<div class='col-sm-1 col-md-1 col-lg-1'>" + end + "s" + "</div>" + "<div class='col-sm-6 col-md-6 col-lg-6'>" + text + "</div>" + "<div class='col-sm-1 col-md-1 col-lg-1'>" + position + "</div>" + "<div class='col-sm-1 col-md-1 col-lg-1'>" + username + "</div>" + "</div>"; var element = $.parseHTML( elementString ); return element; } loadAnnotations = function(){ //hide the content $('#annotation-table').hide(); //Show the spinner $('#annotation-spinner').show(); //Get the data $.post( "/api/getAnnotations", { video_id: <?= $video->id ?> }, function(data) { setTimeout(function(){ //present the data var json = JSON.parse(data); if(json.length == 0){ $('#annotation-table').html($.parseHTML("<div class='row'><div class='col-sm-12 col-md-12 col-lg-12 text-danger'>It looks like there are no annotations yet!</div></div>")); } for(var i = 0; i < json.length; i++){ var a = json[i]; $('#annotation-table').append(annotationRow(a.id, a.annotation.start_time, a.annotation.end_time, a.text, a.annotation.position, a.annotation.user.username)); } //hide the spinner $('#annotation-spinner').hide(); //show the content $('#annotation-table').show(); }, 1000); }) .fail(function() { alert( "error" ); }); } </script>
karlmoser/Video-Annotation
web/public/application/views/parts/singleVideo.php
PHP
apache-2.0
9,652
package ecs //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. // // Code generated by Alibaba Cloud SDK Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. import ( "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" ) // DescribeInvocations invokes the ecs.DescribeInvocations API synchronously func (client *Client) DescribeInvocations(request *DescribeInvocationsRequest) (response *DescribeInvocationsResponse, err error) { response = CreateDescribeInvocationsResponse() err = client.DoAction(request, response) return } // DescribeInvocationsWithChan invokes the ecs.DescribeInvocations API asynchronously func (client *Client) DescribeInvocationsWithChan(request *DescribeInvocationsRequest) (<-chan *DescribeInvocationsResponse, <-chan error) { responseChan := make(chan *DescribeInvocationsResponse, 1) errChan := make(chan error, 1) err := client.AddAsyncTask(func() { defer close(responseChan) defer close(errChan) response, err := client.DescribeInvocations(request) if err != nil { errChan <- err } else { responseChan <- response } }) if err != nil { errChan <- err close(responseChan) close(errChan) } return responseChan, errChan } // DescribeInvocationsWithCallback invokes the ecs.DescribeInvocations API asynchronously func (client *Client) DescribeInvocationsWithCallback(request *DescribeInvocationsRequest, callback func(response *DescribeInvocationsResponse, err error)) <-chan int { result := make(chan int, 1) err := client.AddAsyncTask(func() { var response *DescribeInvocationsResponse var err error defer close(result) response, err = client.DescribeInvocations(request) callback(response, err) result <- 1 }) if err != nil { defer close(result) callback(nil, err) result <- 0 } return result } // DescribeInvocationsRequest is the request struct for api DescribeInvocations type DescribeInvocationsRequest struct { *requests.RpcRequest ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` InvokeStatus string `position:"Query" name:"InvokeStatus"` IncludeOutput requests.Boolean `position:"Query" name:"IncludeOutput"` CommandId string `position:"Query" name:"CommandId"` PageNumber requests.Integer `position:"Query" name:"PageNumber"` ContentEncoding string `position:"Query" name:"ContentEncoding"` PageSize requests.Integer `position:"Query" name:"PageSize"` InvokeId string `position:"Query" name:"InvokeId"` Timed requests.Boolean `position:"Query" name:"Timed"` CommandName string `position:"Query" name:"CommandName"` ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` OwnerAccount string `position:"Query" name:"OwnerAccount"` OwnerId requests.Integer `position:"Query" name:"OwnerId"` CommandType string `position:"Query" name:"CommandType"` InstanceId string `position:"Query" name:"InstanceId"` } // DescribeInvocationsResponse is the response struct for api DescribeInvocations type DescribeInvocationsResponse struct { *responses.BaseResponse RequestId string `json:"RequestId" xml:"RequestId"` TotalCount int64 `json:"TotalCount" xml:"TotalCount"` PageNumber int64 `json:"PageNumber" xml:"PageNumber"` PageSize int64 `json:"PageSize" xml:"PageSize"` Invocations InvocationsInDescribeInvocations `json:"Invocations" xml:"Invocations"` } // CreateDescribeInvocationsRequest creates a request to invoke DescribeInvocations API func CreateDescribeInvocationsRequest() (request *DescribeInvocationsRequest) { request = &DescribeInvocationsRequest{ RpcRequest: &requests.RpcRequest{}, } request.InitWithApiInfo("Ecs", "2014-05-26", "DescribeInvocations", "ecs", "openAPI") request.Method = requests.POST return } // CreateDescribeInvocationsResponse creates a response to parse from DescribeInvocations response func CreateDescribeInvocationsResponse() (response *DescribeInvocationsResponse) { response = &DescribeInvocationsResponse{ BaseResponse: &responses.BaseResponse{}, } return }
tgraf/cilium
vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/describe_invocations.go
GO
apache-2.0
4,910
using System.Web.Mvc; namespace TestSecurity { public class FilterConfig { public static void RegisterGlobalFilters(GlobalFilterCollection filters) { filters.Add(new HandleErrorAttribute()); } } }
Searching/securityframework
TestSecurity/App_Start/FilterConfig.cs
C#
apache-2.0
249
/* * Copyright 2007 the original author or authors. * * 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 net.javacrumbs.airline.server; /** @author Arjen Poutsma */ public interface AirlineWebServiceConstants { String BOOK_FLIGHT_REQUEST = "BookFlightRequest"; String GET_FLIGHTS_REQUEST = "GetFlightsRequest"; String GET_FREQUENT_FLYER_MILEAGE_RESPONSE = "GetFrequentFlyerMileageResponse"; String MESSAGES_NAMESPACE = "http://www.springframework.org/spring-ws/samples/airline/schemas/messages"; String GET_FREQUENT_FLYER_MILEAGE_REQUEST = "GetFrequentFlyerMileageRequest"; }
lukas-krecan/smock
samples/springws-server-test/src/main/java/net/javacrumbs/airline/server/AirlineWebServiceConstants.java
Java
apache-2.0
1,122
/** * Appcelerator Titanium Mobile * Copyright (c) 2013 by Appcelerator, Inc. All Rights Reserved. * Licensed under the terms of the Apache Public License * Please see the LICENSE included with this distribution for details. */ #include "NativeGestureObject.h" #include <bb/device/DeviceInfo> #include <bb/device/DisplayInfo> #include <QDateTime> #include <QtSensors/QAccelerometer> #include <QtSensors/QAccelerometerFilter> #include <QtSensors/QAccelerometerReading> #include "EventHandler.h" #include "TiEventContainerFactory.h" #include "TiObject.h" #include "TiOrientation.h" using namespace bb::device; using namespace titanium; using namespace QtMobility; static NativeGestureObject::PropertyInfo properties[] = { { N_GESTURE_PROP_ORIENTATION, &NativeGestureObject::getOrientation, 0} }; static const int propertyCount = sizeof(properties) / sizeof(properties[0]); class GestureEventHandler : public EventHandler { Q_OBJECT public: explicit GestureEventHandler(TiEventContainer* container) : EventHandler(container) { DisplayInfo displayInfo; aspectType_ = displayInfo.aspectType(); connect(&deviceInfo_, SIGNAL(orientationChanged(bb::device::DeviceOrientation::Type)), SLOT(orientationChanged(bb::device::DeviceOrientation::Type))); } private slots: void orientationChanged(bb::device::DeviceOrientation::Type orientation) { TiEventContainer* container = getEventContainer(); container->setDataProperty("orientation", Orientation::fromDevice(orientation)); container->fireEvent(); } private: DeviceInfo deviceInfo_; DisplayAspectType::Type aspectType_; }; class ShakeEventHandler : public EventHandler, public QAccelerometerFilter { Q_OBJECT public: enum Sensitivity { Low = 20, Medium = 30, High = 40 }; // Create a shake event handler with a default // sensitivity of Medium and interval of 500 ms. explicit ShakeEventHandler(TiEventContainer* container) : EventHandler(container) , sensitivity_(Medium) , interval_(500) , lastShake_(0) { connect(&sensor_, SIGNAL(readingChanged()), SLOT(shake())); sensor_.setAccelerationMode(QAccelerometer::User); sensor_.addFilter(this); } void enable(bool on) { if (on) sensor_.start(); else sensor_.stop(); } void setSensitivity(Sensitivity sensitivity) { sensitivity_ = sensitivity; } void setInterval(qint64 interval) { interval_ = interval; } virtual bool filter(QAccelerometerReading* reading) { // Compute the time since the last shake event. qint64 now = QDateTime::currentMSecsSinceEpoch(), diff = now - lastShake_; // Compute how much force the device was shaken. // Note the force value is left squared. float x = reading->x(), y = reading->y(), z = reading->z(), force = (x * x) + (y * y) + (z * z); // If user shakes the device with enough force // and the interval of time between shake events // has been reached we will fire a shake event. if (force > (sensitivity_ * sensitivity_) && diff > interval_) { lastShake_ = now; return true; } return false; } private slots: // A shake was detected and a new sensor reading is ready. void shake() { QAccelerometerReading* reading = sensor_.reading(); TiEventContainer* container = getEventContainer(); container->setDataProperty("x", (float) reading->x()); container->setDataProperty("y", (float) reading->y()); container->setDataProperty("z", (float) reading->z()); container->fireEvent(); } private: float sensitivity_; qint64 interval_; qint64 lastShake_; QAccelerometer sensor_; }; #include "NativeGestureObject.moc" NativeGestureObject::NativeGestureObject(TiObject* obj) : NativeProxyObject(obj) , PropertyDelegateBase<NativeGestureObject>(this, properties, propertyCount) , shakeListenerCount_(0) { } NativeGestureObject* NativeGestureObject::createGesture(TiObject* obj) { return new NativeGestureObject(obj); } int NativeGestureObject::setPropertyValue(size_t propertyNumber, TiObject* obj) { return setProperty(propertyNumber, obj); } int NativeGestureObject::getPropertyValue(size_t propertyNumber, TiObject* obj) { return getProperty(propertyNumber, obj); } int NativeGestureObject::setEventHandler(const char* eventName, TiEvent* event) { NativeProxyObject::setEventHandler(eventName, event); if (strcmp("shake", eventName) == 0) { shakeListenerCount_++; if (shakeListenerCount_ == 1) { shakeHandler_->enable(true); } } } int NativeGestureObject::removeEventHandler(const char* eventName, int eventId) { NativeProxyObject::removeEventHandler(eventName, eventId); if (strcmp("shake", eventName) == 0) { shakeListenerCount_--; if (shakeListenerCount_ == 0) { shakeHandler_->enable(false); } } } int NativeGestureObject::getOrientation(TiObject* value) { DeviceInfo info; int orientation = Orientation::fromDevice(info.orientation()); value->setValue(Integer::New(orientation)); return NATIVE_ERROR_OK; } void NativeGestureObject::setupEvents(TiEventContainerFactory* containerFactory) { TiEventContainer* orientationContainer = containerFactory->createEventContainer(); orientationContainer->setDataProperty("type", "orientationchange"); GestureEventHandler* orientationHandler = new GestureEventHandler(orientationContainer); events_.insert("orientationchange", EventPairSmartPtr(orientationContainer, orientationHandler)); TiEventContainer* shakeContainer = containerFactory->createEventContainer(); shakeContainer->setDataProperty("type", "shake"); shakeHandler_ = new ShakeEventHandler(shakeContainer); events_.insert("shake", EventPairSmartPtr(shakeContainer, shakeHandler_)); }
appcelerator/titanium_mobile_blackberry
src/tibb/src/NativeGestureObject.cpp
C++
apache-2.0
6,245
package org.tlhInganHol.android.klingonttsdemo; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.View; import android.view.Menu; import android.view.MenuItem; import android.speech.tts.TextToSpeech; import java.util.Locale; public class KlingonTTSDemoActivity extends AppCompatActivity // TTS: implements TextToSpeech.OnInitListener { // TTS: private TextToSpeech mTts; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); // TTS: mTts = new TextToSpeech(this, this, "org.tlhInganHol.android.klingonttsengine"); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // TTS: Snackbar.make(view, "Heghlu'meH QaQ jajvam", Snackbar.LENGTH_LONG) .setAction("Action", null).show(); mTts.speak("Heghlu'meH QaQ jajvam", TextToSpeech.QUEUE_FLUSH, null); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } @Override protected void onDestroy() { // TTS: if (mTts != null) { mTts.stop(); mTts.shutdown(); } super.onDestroy(); } // TTS: public void onInit(int status) { if (status == TextToSpeech.SUCCESS) { mTts.setLanguage(new Locale("tlh", "", "")); } } }
dlyongemallo/KlingonTTSDemo
app/src/main/java/org/tlhInganHol/android/klingonttsdemo/KlingonTTSDemoActivity.java
Java
apache-2.0
2,538
#!/usr/bin/python # Copyright (c) 2014 SwiftStack, 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. from setuptools import setup, find_packages version = "__VERSION__" setup( name="swift_undelete", version=version, description='Undelete middleware for OpenStack Swift', license='Apache License (2.0)', author='Samuel N. Merritt', author_email='sam@swiftstack.com', url='https://github.com/swiftstack/swift_undelete', packages=find_packages(), classifiers=[ 'Development Status :: 4 - Beta', 'License :: OSI Approved :: Apache Software License', 'Operating System :: POSIX :: Linux', 'Programming Language :: Python :: 2.7', 'Environment :: No Input/Output (Daemon)'], # Ubuntu packaging incorrectly detects this as a dependency on the # "python-swift" package, which SwiftStack doesn't use. So commenting this # out so SwiftStack can still use ${python:Depends} #install_requires=["swift"], test_suite='nose.collector', tests_require=["nose"], scripts=[], entry_points={ 'paste.filter_factory': ['undelete=swift_undelete:filter_factory']})
caiobrentano/swift_undelete
setup.py
Python
apache-2.0
1,663
<?php require_once("./root_print_config.inc.php"); if (PamApplication::hasValidSession(null) && PermissionsService::isPrintAllowed(PERMISSION_SCOREBOARD)) { require_once("pdf/rpdf/sb_team.php"); } ?>
joris520/broodjesalami
pam-public/print/rpdf_sb_team.php
PHP
apache-2.0
221
package com.bjorktech.cayman.idea.architecture.o2o.meituan; /** * User: sheshan * Date: 2018/8/15 * content: */ public class LockStock { /** * update lockCount = lockCount + n where id = 100 and totalCount -lockCount >= 4,防止超卖 */ public void lockStock() { } }
wanliwang/cayman
cm-idea/src/main/java/com/bjorktech/cayman/idea/architecture/o2o/meituan/LockStock.java
Java
apache-2.0
298
/* Copyright (c) 2014, Paul L. Snyder <paul@pataprogramming.com>, * Daniel Dubois, Nicolo Calcavecchia. * * 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 2 of the License, or (at your option) * Any later version. It may also be redistributed and/or modified under the * terms of the BSD 3-Clause 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 */ package myconet; import java.util.Comparator; public class MycoNodeDegreeComparator implements Comparator<MycoNode> { public int compare(MycoNode n1, MycoNode n2) { return new Integer(n2.getHyphaLink().degree()).compareTo(n1.getHyphaLink().degree()); } }
damianarellanes/RASupport
src/myconet/MycoNodeDegreeComparator.java
Java
apache-2.0
1,182
<!DOCTYPE html> <html class="theme-next mist use-motion" lang="zh-CN"> <head> <meta charset="UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2"/> <meta name="theme-color" content="#222"> <meta http-equiv="Cache-Control" content="no-transform" /> <meta http-equiv="Cache-Control" content="no-siteapp" /> <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" /> <link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" /> <link href="/css/main.css?v=6.3.0" rel="stylesheet" type="text/css" /> <link rel="apple-touch-icon" sizes="180x180" href="http://pd1l3bbt7.bkt.clouddn.com/img/favicon.png?v=6.3.0"> <link rel="icon" type="image/png" sizes="32x32" href="http://pd1l3bbt7.bkt.clouddn.com/img/favicon.png?v=6.3.0"> <link rel="icon" type="image/png" sizes="16x16" href="http://pd1l3bbt7.bkt.clouddn.com/img/favicon.png?v=6.3.0"> <link rel="mask-icon" href="http://pd1l3bbt7.bkt.clouddn.com/img/favicon.png?v=6.3.0" color="#222"> <script type="text/javascript" id="hexo.configurations"> var NexT = window.NexT || {}; var CONFIG = { root: '/', scheme: 'Mist', version: '6.3.0', sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false}, fancybox: true, fastclick: false, lazyload: false, tabs: true, motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}, algolia: { applicationID: '', apiKey: '', indexName: '', hits: {"per_page":10}, labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"} } }; </script> <meta name="description" content="纯码迷、爱学习、爱交友、喜欢接触新鲜事物、迎接新的挑战,更爱游离于错综复杂的编码与逻辑中!"> <meta name="keywords" content="曹理鹏, iCocos, 梦工厂, iOS, IT, 技术, 程序猿, 码农"> <meta property="og:type" content="website"> <meta property="og:title" content="iCocos"> <meta property="og:url" content="https://icocos.github.io/tags/流量/index.html"> <meta property="og:site_name" content="iCocos"> <meta property="og:description" content="纯码迷、爱学习、爱交友、喜欢接触新鲜事物、迎接新的挑战,更爱游离于错综复杂的编码与逻辑中!"> <meta property="og:locale" content="zh-CN"> <meta name="twitter:card" content="summary"> <meta name="twitter:title" content="iCocos"> <meta name="twitter:description" content="纯码迷、爱学习、爱交友、喜欢接触新鲜事物、迎接新的挑战,更爱游离于错综复杂的编码与逻辑中!"> <link rel="alternate" href="/atom.xml" title="iCocos" type="application/atom+xml" /> <link rel="canonical" href="https://icocos.github.io/tags/流量/"/> <script type="text/javascript" id="page.configurations"> CONFIG.page = { sidebar: "", }; </script> <title>标签: 流量 | iCocos</title> <noscript> <style type="text/css"> .use-motion .motion-element, .use-motion .brand, .use-motion .menu-item, .sidebar-inner, .use-motion .post-block, .use-motion .pagination, .use-motion .comments, .use-motion .post-header, .use-motion .post-body, .use-motion .collection-title { opacity: initial; } .use-motion .logo, .use-motion .site-title, .use-motion .site-subtitle { opacity: initial; top: initial; } .use-motion { .logo-line-before i { left: initial; } .logo-line-after i { right: initial; } } </style> </noscript> </head> <body itemscope itemtype="http://schema.org/WebPage" lang="zh-CN"> <div class="container sidebar-position-left "> <div class="headband"></div> <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader"> <div class="header-inner"><div class="site-brand-wrapper"> <div class="site-meta "> <div class="custom-logo-site-title"> <a href="/" class="brand" rel="start"> <span class="logo-line-before"><i></i></span> <span class="site-title">iCocos</span> <span class="logo-line-after"><i></i></span> </a> </div> <p class="site-subtitle">www.icocos.cn</p> </div> <div class="site-nav-toggle"> <button aria-label="切换导航栏"> <span class="btn-bar"></span> <span class="btn-bar"></span> <span class="btn-bar"></span> </button> </div> </div> <nav class="site-nav"> <ul id="menu" class="menu"> <li class="menu-item menu-item-首页"> <a href="/" rel="section"> <i class="menu-item-icon fa fa-fw fa-home"></i> <br />首页</a> </li> <li class="menu-item menu-item-归档"> <a href="/archives/" rel="section"> <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />归档</a> </li> <li class="menu-item menu-item-关于"> <a href="/about/" rel="section"> <i class="menu-item-icon fa fa-fw fa-user"></i> <br />关于</a> </li> <li class="menu-item menu-item-作品"> <a href="/works/" rel="section"> <i class="menu-item-icon fa fa-fw fa-calendar"></i> <br />作品</a> </li> <li class="menu-item menu-item-search"> <a href="javascript:;" class="popup-trigger"> <i class="menu-item-icon fa fa-search fa-fw"></i> <br />搜索</a> </li> </ul> <div class="site-search"> <div class="popup search-popup local-search-popup"> <div class="local-search-header clearfix"> <span class="search-icon"> <i class="fa fa-search"></i> </span> <span class="popup-btn-close"> <i class="fa fa-times-circle"></i> </span> <div class="local-search-input-wrapper"> <input autocomplete="off" placeholder="搜索..." spellcheck="false" type="text" id="local-search-input"> </div> </div> <div id="local-search-result"></div> </div> </div> </nav> </div> </header> <main id="main" class="main"> <div class="main-inner"> <div class="content-wrap"> <div id="content" class="content"> <div class="post-block tag"> <div id="posts" class="posts-collapse"> <div class="collection-title"> <h1>流量<small>标签</small> </h1> </div> <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article"> <header class="post-header"> <h2 class="post-title"> <a class="post-title-link" href="/2017/08/11/关于流量优化/" itemprop="url"> <span itemprop="name">关于流量优化方案</span> </a> </h2> <div class="post-meta"> <time class="post-time" itemprop="dateCreated" datetime="2017-08-11T12:14:14+08:00" content="2017-08-11" > 08-11 </time> </div> </header> </article> </div> </div> </div> </div> <div class="sidebar-toggle"> <div class="sidebar-toggle-line-wrap"> <span class="sidebar-toggle-line sidebar-toggle-line-first"></span> <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span> <span class="sidebar-toggle-line sidebar-toggle-line-last"></span> </div> </div> <aside id="sidebar" class="sidebar"> <div class="sidebar-inner"> <section class="site-overview-wrap sidebar-panel sidebar-panel-active"> <div class="site-overview"> <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person"> <img class="site-author-image" itemprop="image" src="http://pd1l3bbt7.bkt.clouddn.com/icocos_user_icon.JPG" alt="曹理鹏@iCocos" /> <p class="site-author-name" itemprop="name">曹理鹏@iCocos</p> <p class="site-description motion-element" itemprop="description">纯码迷、爱学习、爱交友、喜欢接触新鲜事物、迎接新的挑战,更爱游离于错综复杂的编码与逻辑中!</p> </div> <nav class="site-state motion-element"> <div class="site-state-item site-state-posts"> <a href="/archives"> <span class="site-state-item-count">324</span> <span class="site-state-item-name">日志</span> </a> </div> <div class="site-state-item site-state-categories"> <span class="site-state-item-count">27</span> <span class="site-state-item-name">分类</span> </div> <div class="site-state-item site-state-tags"> <span class="site-state-item-count">268</span> <span class="site-state-item-name">标签</span> </div> </nav> <div class="feed-link motion-element"> <a href="/atom.xml" rel="alternate"> <i class="fa fa-rss"></i> RSS </a> </div> <div class="links-of-author motion-element"> <span class="links-of-author-item"> <a href="https://github.com/al1020119" target="_blank" title="GitHub"><i class="fa fa-fw fa-github"></i>GitHub</a> </span> <span class="links-of-author-item"> <a href="mailto:al1020119@163.com" target="_blank" title="E-Mail"><i class="fa fa-fw fa-envelope"></i>E-Mail</a> </span> <span class="links-of-author-item"> <a href="https://stackoverflow.com/users/10186720" target="_blank" title="StackOverflow"><i class="fa fa-fw fa-stack-overflow"></i>StackOverflow</a> </span> </div> <div class="links-of-blogroll motion-element links-of-blogroll-block"> <div class="links-of-blogroll-title"> <i class="fa fa-fw fa-link"></i> Links </div> <ul class="links-of-blogroll-list"> <li class="links-of-blogroll-item"> <a href="http://www.icocos.cn/" title="梦工厂" target="_blank">梦工厂</a> </li> <li class="links-of-blogroll-item"> <a href="http://al1020119.github.io/" title="iOS梦工厂" target="_blank">iOS梦工厂</a> </li> </ul> </div> </div> </section> </div> </aside> </div> </main> <footer id="footer" class="footer"> <div class="footer-inner"> <div class="copyright">&copy; 2017 – <span itemprop="copyrightYear">2020</span> <span class="with-love" id="animate"> <i class="fa fa-user"></i> </span> <span class="author" itemprop="copyrightHolder">曹理鹏@iCocos</span> <span class="post-meta-divider">|</span> <span class="post-meta-item-icon"> <i class="fa fa-area-chart"></i> </span> <span class="post-meta-item-text">站点总字数:</span> <span title="站点总字数">1.8m</span> <span class="post-meta-divider">|</span> <span class="post-meta-item-icon"> <i class="fa fa-coffee"></i> </span> <span class="post-meta-item-text">站点阅读时长 &asymp;</span> <span title="站点阅读时长">27:03</span> </div> <div class="busuanzi-count"> <script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script> <span class="site-uv" title="总访客量"> <i class="fa fa-user"></i> <span class="busuanzi-value" id="busuanzi_value_site_uv"></span> </span> <span class="site-pv" title="总访问量"> <i class="fa fa-eye"></i> <span class="busuanzi-value" id="busuanzi_value_site_pv"></span> </span> </div> </div> </footer> <div class="back-to-top"> <i class="fa fa-arrow-up"></i> </div> </div> <script type="text/javascript"> if (Object.prototype.toString.call(window.Promise) !== '[object Function]') { window.Promise = null; } </script> <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script> <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script> <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script> <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script> <script type="text/javascript" src="/lib/reading_progress/reading_progress.js"></script> <script type="text/javascript" src="/js/src/utils.js?v=6.3.0"></script> <script type="text/javascript" src="/js/src/motion.js?v=6.3.0"></script> <script type="text/javascript" src="/js/src/bootstrap.js?v=6.3.0"></script> <script type="text/javascript"> (function(){ var appid = 'cytKHBEtW'; var conf = '43989b8e63b25c4e9f1fde821c996a39'; var width = window.innerWidth || document.documentElement.clientWidth; if (width < 960) { window.document.write('<script id="changyan_mobile_js" charset="utf-8" type="text/javascript" src="https://changyan.sohu.com/upload/mobile/wap-js/changyan_mobile.js?client_id=' + appid + '&conf=' + conf + '"><\/script>'); } else { var loadJs=function(d,a){var c=document.getElementsByTagName("head")[0]||document.head||document.documentElement;var b=document.createElement("script");b.setAttribute("type","text/javascript");b.setAttribute("charset","UTF-8");b.setAttribute("src",d);if(typeof a==="function"){if(window.attachEvent){b.onreadystatechange=function(){var e=b.readyState;if(e==="loaded"||e==="complete"){b.onreadystatechange=null;a()}}}else{b.onload=a}}c.appendChild(b)};loadJs("https://changyan.sohu.com/upload/changyan.js",function(){ window.changyan.api.config({appid:appid,conf:conf})}); } })(); </script> <script type="text/javascript" src="https://assets.changyan.sohu.com/upload/plugins/plugins.count.js"></script> <script type="text/javascript"> // Popup Window; var isfetched = false; var isXml = true; // Search DB path; var search_path = "search.xml"; if (search_path.length === 0) { search_path = "search.xml"; } else if (/json$/i.test(search_path)) { isXml = false; } var path = "/" + search_path; // monitor main search box; var onPopupClose = function (e) { $('.popup').hide(); $('#local-search-input').val(''); $('.search-result-list').remove(); $('#no-result').remove(); $(".local-search-pop-overlay").remove(); $('body').css('overflow', ''); } function proceedsearch() { $("body") .append('<div class="search-popup-overlay local-search-pop-overlay"></div>') .css('overflow', 'hidden'); $('.search-popup-overlay').click(onPopupClose); $('.popup').toggle(); var $localSearchInput = $('#local-search-input'); $localSearchInput.attr("autocapitalize", "none"); $localSearchInput.attr("autocorrect", "off"); $localSearchInput.focus(); } // search function; var searchFunc = function(path, search_id, content_id) { 'use strict'; // start loading animation $("body") .append('<div class="search-popup-overlay local-search-pop-overlay">' + '<div id="search-loading-icon">' + '<i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>' + '</div>' + '</div>') .css('overflow', 'hidden'); $("#search-loading-icon").css('margin', '20% auto 0 auto').css('text-align', 'center'); $.ajax({ url: path, dataType: isXml ? "xml" : "json", async: true, success: function(res) { // get the contents from search data isfetched = true; $('.popup').detach().appendTo('.header-inner'); var datas = isXml ? $("entry", res).map(function() { return { title: $("title", this).text(), content: $("content",this).text(), url: $("url" , this).text() }; }).get() : res; var input = document.getElementById(search_id); var resultContent = document.getElementById(content_id); var inputEventFunction = function() { var searchText = input.value.trim().toLowerCase(); var keywords = searchText.split(/[\s\-]+/); if (keywords.length > 1) { keywords.push(searchText); } var resultItems = []; if (searchText.length > 0) { // perform local searching datas.forEach(function(data) { var isMatch = false; var hitCount = 0; var searchTextCount = 0; var title = data.title.trim(); var titleInLowerCase = title.toLowerCase(); var content = data.content.trim().replace(/<[^>]+>/g,""); var contentInLowerCase = content.toLowerCase(); var articleUrl = decodeURIComponent(data.url); var indexOfTitle = []; var indexOfContent = []; // only match articles with not empty titles if(title != '') { keywords.forEach(function(keyword) { function getIndexByWord(word, text, caseSensitive) { var wordLen = word.length; if (wordLen === 0) { return []; } var startPosition = 0, position = [], index = []; if (!caseSensitive) { text = text.toLowerCase(); word = word.toLowerCase(); } while ((position = text.indexOf(word, startPosition)) > -1) { index.push({position: position, word: word}); startPosition = position + wordLen; } return index; } indexOfTitle = indexOfTitle.concat(getIndexByWord(keyword, titleInLowerCase, false)); indexOfContent = indexOfContent.concat(getIndexByWord(keyword, contentInLowerCase, false)); }); if (indexOfTitle.length > 0 || indexOfContent.length > 0) { isMatch = true; hitCount = indexOfTitle.length + indexOfContent.length; } } // show search results if (isMatch) { // sort index by position of keyword [indexOfTitle, indexOfContent].forEach(function (index) { index.sort(function (itemLeft, itemRight) { if (itemRight.position !== itemLeft.position) { return itemRight.position - itemLeft.position; } else { return itemLeft.word.length - itemRight.word.length; } }); }); // merge hits into slices function mergeIntoSlice(text, start, end, index) { var item = index[index.length - 1]; var position = item.position; var word = item.word; var hits = []; var searchTextCountInSlice = 0; while (position + word.length <= end && index.length != 0) { if (word === searchText) { searchTextCountInSlice++; } hits.push({position: position, length: word.length}); var wordEnd = position + word.length; // move to next position of hit index.pop(); while (index.length != 0) { item = index[index.length - 1]; position = item.position; word = item.word; if (wordEnd > position) { index.pop(); } else { break; } } } searchTextCount += searchTextCountInSlice; return { hits: hits, start: start, end: end, searchTextCount: searchTextCountInSlice }; } var slicesOfTitle = []; if (indexOfTitle.length != 0) { slicesOfTitle.push(mergeIntoSlice(title, 0, title.length, indexOfTitle)); } var slicesOfContent = []; while (indexOfContent.length != 0) { var item = indexOfContent[indexOfContent.length - 1]; var position = item.position; var word = item.word; // cut out 100 characters var start = position - 20; var end = position + 80; if(start < 0){ start = 0; } if (end < position + word.length) { end = position + word.length; } if(end > content.length){ end = content.length; } slicesOfContent.push(mergeIntoSlice(content, start, end, indexOfContent)); } // sort slices in content by search text's count and hits' count slicesOfContent.sort(function (sliceLeft, sliceRight) { if (sliceLeft.searchTextCount !== sliceRight.searchTextCount) { return sliceRight.searchTextCount - sliceLeft.searchTextCount; } else if (sliceLeft.hits.length !== sliceRight.hits.length) { return sliceRight.hits.length - sliceLeft.hits.length; } else { return sliceLeft.start - sliceRight.start; } }); // select top N slices in content var upperBound = parseInt('1'); if (upperBound >= 0) { slicesOfContent = slicesOfContent.slice(0, upperBound); } // highlight title and content function highlightKeyword(text, slice) { var result = ''; var prevEnd = slice.start; slice.hits.forEach(function (hit) { result += text.substring(prevEnd, hit.position); var end = hit.position + hit.length; result += '<b class="search-keyword">' + text.substring(hit.position, end) + '</b>'; prevEnd = end; }); result += text.substring(prevEnd, slice.end); return result; } var resultItem = ''; if (slicesOfTitle.length != 0) { resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + highlightKeyword(title, slicesOfTitle[0]) + "</a>"; } else { resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + title + "</a>"; } slicesOfContent.forEach(function (slice) { resultItem += "<a href='" + articleUrl + "'>" + "<p class=\"search-result\">" + highlightKeyword(content, slice) + "...</p>" + "</a>"; }); resultItem += "</li>"; resultItems.push({ item: resultItem, searchTextCount: searchTextCount, hitCount: hitCount, id: resultItems.length }); } }) }; if (keywords.length === 1 && keywords[0] === "") { resultContent.innerHTML = '<div id="no-result"><i class="fa fa-search fa-5x" /></div>' } else if (resultItems.length === 0) { resultContent.innerHTML = '<div id="no-result"><i class="fa fa-frown-o fa-5x" /></div>' } else { resultItems.sort(function (resultLeft, resultRight) { if (resultLeft.searchTextCount !== resultRight.searchTextCount) { return resultRight.searchTextCount - resultLeft.searchTextCount; } else if (resultLeft.hitCount !== resultRight.hitCount) { return resultRight.hitCount - resultLeft.hitCount; } else { return resultRight.id - resultLeft.id; } }); var searchResultList = '<ul class=\"search-result-list\">'; resultItems.forEach(function (result) { searchResultList += result.item; }) searchResultList += "</ul>"; resultContent.innerHTML = searchResultList; } } if ('auto' === 'auto') { input.addEventListener('input', inputEventFunction); } else { $('.search-icon').click(inputEventFunction); input.addEventListener('keypress', function (event) { if (event.keyCode === 13) { inputEventFunction(); } }); } // remove loading animation $(".local-search-pop-overlay").remove(); $('body').css('overflow', ''); proceedsearch(); } }); } // handle and trigger popup window; $('.popup-trigger').click(function(e) { e.stopPropagation(); if (isfetched === false) { searchFunc(path, 'local-search-input', 'local-search-result'); } else { proceedsearch(); }; }); $('.popup-btn-close').click(onPopupClose); $('.popup').click(function(e){ e.stopPropagation(); }); $(document).on('keyup', function (event) { var shouldDismissSearchPopup = event.which === 27 && $('.search-popup').is(':visible'); if (shouldDismissSearchPopup) { onPopupClose(); } }); </script> <script src="https://cdn1.lncld.net/static/js/av-core-mini-0.6.4.js"></script> <script>AV.initialize("Tc7k1mbaieCUSgmM8LPk1IBO-gzGzoHsz", "sAb7L2vwENJTteRrvFKQacUU");</script> <script> function showTime(Counter) { var query = new AV.Query(Counter); var entries = []; var $visitors = $(".leancloud_visitors"); $visitors.each(function () { entries.push( $(this).attr("id").trim() ); }); query.containedIn('url', entries); query.find() .done(function (results) { var COUNT_CONTAINER_REF = '.leancloud-visitors-count'; if (results.length === 0) { $visitors.find(COUNT_CONTAINER_REF).text(0); return; } for (var i = 0; i < results.length; i++) { var item = results[i]; var url = item.get('url'); var time = item.get('time'); var element = document.getElementById(url); $(element).find(COUNT_CONTAINER_REF).text(time); } for(var i = 0; i < entries.length; i++) { var url = entries[i]; var element = document.getElementById(url); var countSpan = $(element).find(COUNT_CONTAINER_REF); if( countSpan.text() == '') { countSpan.text(0); } } }) .fail(function (object, error) { console.log("Error: " + error.code + " " + error.message); }); } function addCount(Counter) { var $visitors = $(".leancloud_visitors"); var url = $visitors.attr('id').trim(); var title = $visitors.attr('data-flag-title').trim(); var query = new AV.Query(Counter); query.equalTo("url", url); query.find({ success: function(results) { if (results.length > 0) { var counter = results[0]; counter.fetchWhenSave(true); counter.increment("time"); var $element = $(document.getElementById(url)); $element.find('.leancloud-visitors-count').text(counter.get('time')); counter.save(null, { success: function(counter) { }, error: function(counter, error) { console.log('Failed to save Visitor num, with error message: ' + error.message); } }); } else { var $element = $(document.getElementById(url)); $element.find('.leancloud-visitors-count').text('Counter not initialized! See more at console err msg.'); console.error('ATTENTION! LeanCloud counter has security bug, see here how to solve it: https://github.com/theme-next/hexo-leancloud-counter-security. \n But you also can use LeanCloud without security, by set \'security\' option to \'false\'.'); } }, error: function(error) { console.log('Error:' + error.code + " " + error.message); } }); } $(function() { var Counter = AV.Object.extend("Counter"); if ($('.leancloud_visitors').length == 1) { addCount(Counter); } else if ($('.post-title-link').length > 1) { showTime(Counter); } }); </script> <style> .copy-btn { display: inline-block; padding: 6px 12px; font-size: 13px; font-weight: 700; line-height: 20px; color: #333; white-space: nowrap; vertical-align: middle; cursor: pointer; background-color: #eee; background-image: linear-gradient(#fcfcfc, #eee); border: 1px solid #d5d5d5; border-radius: 3px; user-select: none; outline: 0; } .highlight-wrap .copy-btn { transition: opacity .3s ease-in-out; opacity: 0; padding: 2px 6px; position: absolute; right: 4px; top: 8px; } .highlight-wrap:hover .copy-btn, .highlight-wrap .copy-btn:focus { opacity: 1 } .highlight-wrap { position: relative; } </style> <script> $('.highlight').each(function (i, e) { var $wrap = $('<div>').addClass('highlight-wrap') $(e).after($wrap) $wrap.append($('<button>').addClass('copy-btn').append('复制').on('click', function (e) { var code = $(this).parent().find('.code').find('.line').map(function (i, e) { return $(e).text() }).toArray().join('\n') var ta = document.createElement('textarea') document.body.appendChild(ta) ta.style.position = 'absolute' ta.style.top = '0px' ta.style.left = '0px' ta.value = code ta.select() ta.focus() var result = document.execCommand('copy') document.body.removeChild(ta) if(result)$(this).text('复制成功') else $(this).text('复制失败') $(this).blur() })).on('mouseleave', function (e) { var $b = $(this).find('.copy-btn') setTimeout(function () { $b.text('复制') }, 300) }).append(e) }) </script> <script src="https://cdn1.lncld.net/static/js/av-core-mini-0.6.1.js"></script> <script>AV.initialize("Tc7k1mbaieCUSgmM8LPk1IBO-gzGzoHsz", "sAb7L2vwENJTteRrvFKQacUU");</script> <script> function showTime(Counter) { var query = new AV.Query(Counter); var entries = []; var $visitors = $(".leancloud_visitors"); $visitors.each(function () { entries.push( $(this).attr("id").trim() ); }); query.containedIn('url', entries); query.find() .done(function (results) { var COUNT_CONTAINER_REF = '.leancloud-visitors-count'; if (results.length === 0) { $visitors.find(COUNT_CONTAINER_REF).text(0); return; } for (var i = 0; i < results.length; i++) { var item = results[i]; var url = item.get('url'); var time = item.get('time'); var element = document.getElementById(url); $(element).find(COUNT_CONTAINER_REF).text(time); } }) .fail(function (object, error) { console.log("Error: " + error.code + " " + error.message); }); } function addCount(Counter) { var $visitors = $(".leancloud_visitors"); var url = $visitors.attr('id').trim(); var title = $visitors.attr('data-flag-title').trim(); var query = new AV.Query(Counter); query.equalTo("url", url); query.find({ success: function(results) { if (results.length > 0) { var counter = results[0]; counter.fetchWhenSave(true); counter.increment("time"); counter.save(null, { success: function(counter) { var $element = $(document.getElementById(url)); $element.find('.leancloud-visitors-count').text(counter.get('time')); }, error: function(counter, error) { console.log('Failed to save Visitor num, with error message: ' + error.message); } }); } else { var newcounter = new Counter(); /* Set ACL */ var acl = new AV.ACL(); acl.setPublicReadAccess(true); acl.setPublicWriteAccess(true); newcounter.setACL(acl); /* End Set ACL */ newcounter.set("title", title); newcounter.set("url", url); newcounter.set("time", 1); newcounter.save(null, { success: function(newcounter) { var $element = $(document.getElementById(url)); $element.find('.leancloud-visitors-count').text(newcounter.get('time')); }, error: function(newcounter, error) { console.log('Failed to create'); } }); } }, error: function(error) { console.log('Error:' + error.code + " " + error.message); } }); } $(function() { var Counter = AV.Object.extend("Counter"); if ($('.leancloud_visitors').length == 1) { addCount(Counter); } else if ($('.post-title-link').length > 1) { showTime(Counter); } }); </script> </body> </html>
iCocos/iCocos.github.io
tags/流量/index.html
HTML
apache-2.0
50,097
/* Copyright 2021 - 2022 R. Thomas * * 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 LIEF_PE_STRUCTURES_H_ #define LIEF_PE_STRUCTURES_H_ #include <type_traits> #include <map> #include "LIEF/types.hpp" #include "LIEF/PE/enums.hpp" namespace LIEF { //! Namespace related to the LIEF's PE module //! //! Some parts come from llvm/Support/COFF.h namespace PE { namespace details { //! Sizes in bytes of various things in the COFF format. namespace STRUCT_SIZES { enum { Header16Size = 20, Header32Size = 56, NameSize = 8, Symbol16Size = 18, Symbol32Size = 20, SectionSize = 40, RelocationSize = 10, BaseRelocationBlockSize = 8, ImportDirectoryTableEntrySize = 20, ResourceDirectoryTableSize = 16, ResourceDirectoryEntriesSize = 8, ResourceDataEntrySize = 16 }; } struct delay_imports { uint32_t attribute; uint32_t name; uint32_t handle; uint32_t iat; uint32_t name_table; uint32_t bound_iat; uint32_t unload_iat; uint32_t timestamp; }; static_assert(sizeof(delay_imports) == 32, "Wrong sizeof(delay_imports)"); #include "structures.inc" static const HEADER_CHARACTERISTICS header_characteristics_array[] = { HEADER_CHARACTERISTICS::IMAGE_FILE_INVALID, HEADER_CHARACTERISTICS::IMAGE_FILE_RELOCS_STRIPPED, HEADER_CHARACTERISTICS::IMAGE_FILE_EXECUTABLE_IMAGE, HEADER_CHARACTERISTICS::IMAGE_FILE_LINE_NUMS_STRIPPED, HEADER_CHARACTERISTICS::IMAGE_FILE_LOCAL_SYMS_STRIPPED, HEADER_CHARACTERISTICS::IMAGE_FILE_AGGRESSIVE_WS_TRIM, HEADER_CHARACTERISTICS::IMAGE_FILE_LARGE_ADDRESS_AWARE, HEADER_CHARACTERISTICS::IMAGE_FILE_BYTES_REVERSED_LO, HEADER_CHARACTERISTICS::IMAGE_FILE_32BIT_MACHINE, HEADER_CHARACTERISTICS::IMAGE_FILE_DEBUG_STRIPPED, HEADER_CHARACTERISTICS::IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP, HEADER_CHARACTERISTICS::IMAGE_FILE_NET_RUN_FROM_SWAP, HEADER_CHARACTERISTICS::IMAGE_FILE_SYSTEM, HEADER_CHARACTERISTICS::IMAGE_FILE_DLL, HEADER_CHARACTERISTICS::IMAGE_FILE_UP_SYSTEM_ONLY, HEADER_CHARACTERISTICS::IMAGE_FILE_BYTES_REVERSED_HI }; static const SECTION_CHARACTERISTICS section_characteristics_array[] = { SECTION_CHARACTERISTICS::IMAGE_SCN_TYPE_NO_PAD, SECTION_CHARACTERISTICS::IMAGE_SCN_CNT_CODE, SECTION_CHARACTERISTICS::IMAGE_SCN_CNT_INITIALIZED_DATA, SECTION_CHARACTERISTICS::IMAGE_SCN_CNT_UNINITIALIZED_DATA, SECTION_CHARACTERISTICS::IMAGE_SCN_LNK_OTHER, SECTION_CHARACTERISTICS::IMAGE_SCN_LNK_INFO, SECTION_CHARACTERISTICS::IMAGE_SCN_LNK_REMOVE, SECTION_CHARACTERISTICS::IMAGE_SCN_LNK_COMDAT, SECTION_CHARACTERISTICS::IMAGE_SCN_GPREL, SECTION_CHARACTERISTICS::IMAGE_SCN_MEM_PURGEABLE, SECTION_CHARACTERISTICS::IMAGE_SCN_MEM_16BIT, SECTION_CHARACTERISTICS::IMAGE_SCN_MEM_LOCKED, SECTION_CHARACTERISTICS::IMAGE_SCN_MEM_PRELOAD, SECTION_CHARACTERISTICS::IMAGE_SCN_ALIGN_1BYTES, SECTION_CHARACTERISTICS::IMAGE_SCN_ALIGN_2BYTES, SECTION_CHARACTERISTICS::IMAGE_SCN_ALIGN_4BYTES, SECTION_CHARACTERISTICS::IMAGE_SCN_ALIGN_8BYTES, SECTION_CHARACTERISTICS::IMAGE_SCN_ALIGN_16BYTES, SECTION_CHARACTERISTICS::IMAGE_SCN_ALIGN_32BYTES, SECTION_CHARACTERISTICS::IMAGE_SCN_ALIGN_64BYTES, SECTION_CHARACTERISTICS::IMAGE_SCN_ALIGN_128BYTES, SECTION_CHARACTERISTICS::IMAGE_SCN_ALIGN_256BYTES, SECTION_CHARACTERISTICS::IMAGE_SCN_ALIGN_512BYTES, SECTION_CHARACTERISTICS::IMAGE_SCN_ALIGN_1024BYTES, SECTION_CHARACTERISTICS::IMAGE_SCN_ALIGN_2048BYTES, SECTION_CHARACTERISTICS::IMAGE_SCN_ALIGN_4096BYTES, SECTION_CHARACTERISTICS::IMAGE_SCN_ALIGN_8192BYTES, SECTION_CHARACTERISTICS::IMAGE_SCN_LNK_NRELOC_OVFL, SECTION_CHARACTERISTICS::IMAGE_SCN_MEM_DISCARDABLE, SECTION_CHARACTERISTICS::IMAGE_SCN_MEM_NOT_CACHED, SECTION_CHARACTERISTICS::IMAGE_SCN_MEM_NOT_PAGED, SECTION_CHARACTERISTICS::IMAGE_SCN_MEM_SHARED, SECTION_CHARACTERISTICS::IMAGE_SCN_MEM_EXECUTE, SECTION_CHARACTERISTICS::IMAGE_SCN_MEM_READ, SECTION_CHARACTERISTICS::IMAGE_SCN_MEM_WRITE, }; static const DLL_CHARACTERISTICS dll_characteristics_array[] = { DLL_CHARACTERISTICS::IMAGE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA, DLL_CHARACTERISTICS::IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE, DLL_CHARACTERISTICS::IMAGE_DLL_CHARACTERISTICS_FORCE_INTEGRITY, DLL_CHARACTERISTICS::IMAGE_DLL_CHARACTERISTICS_NX_COMPAT, DLL_CHARACTERISTICS::IMAGE_DLL_CHARACTERISTICS_NO_ISOLATION, DLL_CHARACTERISTICS::IMAGE_DLL_CHARACTERISTICS_NO_SEH, DLL_CHARACTERISTICS::IMAGE_DLL_CHARACTERISTICS_NO_BIND, DLL_CHARACTERISTICS::IMAGE_DLL_CHARACTERISTICS_APPCONTAINER, DLL_CHARACTERISTICS::IMAGE_DLL_CHARACTERISTICS_WDM_DRIVER, DLL_CHARACTERISTICS::IMAGE_DLL_CHARACTERISTICS_GUARD_CF, DLL_CHARACTERISTICS::IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE, }; static const EXTENDED_WINDOW_STYLES extended_window_styles_array[] = { EXTENDED_WINDOW_STYLES::WS_EX_DLGMODALFRAME, EXTENDED_WINDOW_STYLES::WS_EX_NOPARENTNOTIFY, EXTENDED_WINDOW_STYLES::WS_EX_TOPMOST, EXTENDED_WINDOW_STYLES::WS_EX_ACCEPTFILES, EXTENDED_WINDOW_STYLES::WS_EX_TRANSPARENT, EXTENDED_WINDOW_STYLES::WS_EX_MDICHILD, EXTENDED_WINDOW_STYLES::WS_EX_TOOLWINDOW, EXTENDED_WINDOW_STYLES::WS_EX_WINDOWEDGE, EXTENDED_WINDOW_STYLES::WS_EX_CLIENTEDGE, EXTENDED_WINDOW_STYLES::WS_EX_CONTEXTHELP, EXTENDED_WINDOW_STYLES::WS_EX_RIGHT, EXTENDED_WINDOW_STYLES::WS_EX_LEFT, EXTENDED_WINDOW_STYLES::WS_EX_RTLREADING, EXTENDED_WINDOW_STYLES::WS_EX_LTRREADING, EXTENDED_WINDOW_STYLES::WS_EX_LEFTSCROLLBAR, EXTENDED_WINDOW_STYLES::WS_EX_RIGHTSCROLLBAR, EXTENDED_WINDOW_STYLES::WS_EX_CONTROLPARENT, EXTENDED_WINDOW_STYLES::WS_EX_STATICEDGE, EXTENDED_WINDOW_STYLES::WS_EX_APPWINDOW, }; static const WINDOW_STYLES window_styles_array[] = { WINDOW_STYLES::WS_OVERLAPPED, WINDOW_STYLES::WS_POPUP, WINDOW_STYLES::WS_CHILD, WINDOW_STYLES::WS_MINIMIZE, WINDOW_STYLES::WS_VISIBLE, WINDOW_STYLES::WS_DISABLED, WINDOW_STYLES::WS_CLIPSIBLINGS, WINDOW_STYLES::WS_CLIPCHILDREN, WINDOW_STYLES::WS_MAXIMIZE, WINDOW_STYLES::WS_CAPTION, WINDOW_STYLES::WS_BORDER, WINDOW_STYLES::WS_DLGFRAME, WINDOW_STYLES::WS_VSCROLL, WINDOW_STYLES::WS_HSCROLL, WINDOW_STYLES::WS_SYSMENU, WINDOW_STYLES::WS_THICKFRAME, WINDOW_STYLES::WS_GROUP, WINDOW_STYLES::WS_TABSTOP, WINDOW_STYLES::WS_MINIMIZEBOX, WINDOW_STYLES::WS_MAXIMIZEBOX, }; static const DIALOG_BOX_STYLES dialog_box_styles_array[] = { DIALOG_BOX_STYLES::DS_ABSALIGN, DIALOG_BOX_STYLES::DS_SYSMODAL, DIALOG_BOX_STYLES::DS_LOCALEDIT, DIALOG_BOX_STYLES::DS_SETFONT, DIALOG_BOX_STYLES::DS_MODALFRAME, DIALOG_BOX_STYLES::DS_NOIDLEMSG, DIALOG_BOX_STYLES::DS_SETFOREGROUND, DIALOG_BOX_STYLES::DS_3DLOOK, DIALOG_BOX_STYLES::DS_FIXEDSYS, DIALOG_BOX_STYLES::DS_NOFAILCREATE, DIALOG_BOX_STYLES::DS_CONTROL, DIALOG_BOX_STYLES::DS_CENTER, DIALOG_BOX_STYLES::DS_CENTERMOUSE, DIALOG_BOX_STYLES::DS_CONTEXTHELP, DIALOG_BOX_STYLES::DS_SHELLFONT, }; static const ACCELERATOR_FLAGS accelerator_array[] = { ACCELERATOR_FLAGS::FVIRTKEY, ACCELERATOR_FLAGS::FNOINVERT, ACCELERATOR_FLAGS::FSHIFT, ACCELERATOR_FLAGS::FCONTROL, ACCELERATOR_FLAGS::FALT, ACCELERATOR_FLAGS::END, }; // From Virtualbox - include/iprt/formats/pecoff.h template <typename T> struct load_configuration { uint32_t Characteristics; uint32_t TimeDateStamp; uint16_t MajorVersion; uint16_t MinorVersion; uint32_t GlobalFlagsClear; uint32_t GlobalFlagsSet; uint32_t CriticalSectionDefaultTimeout; T DeCommitFreeBlockThreshold; T DeCommitTotalFreeThreshold; T LockPrefixTable; T MaximumAllocationSize; T VirtualMemoryThreshold; T ProcessAffinityMask; uint32_t ProcessHeapFlags; uint16_t CSDVersion; uint16_t Reserved1; T EditList; T SecurityCookie; }; template <typename T> struct load_configuration_v0 : load_configuration<T> { T SEHandlerTable; T SEHandlerCount; }; #pragma pack(4) // Windows 10 - 9879 template <typename T> struct load_configuration_v1 : load_configuration_v0<T> { T GuardCFCheckFunctionPointer; T GuardCFDispatchFunctionPointer; T GuardCFFunctionTable; T GuardCFFunctionCount; uint32_t GuardFlags; }; #pragma pack() // Windows 10 - 9879 template <typename T> struct load_configuration_v2 : load_configuration_v1<T> { pe_code_integrity CodeIntegrity; }; template <typename T> struct load_configuration_v3 : load_configuration_v2<T> { T GuardAddressTakenIatEntryTable; T GuardAddressTakenIatEntryCount; T GuardLongJumpTargetTable; T GuardLongJumpTargetCount; }; template <typename T> struct load_configuration_v4 : load_configuration_v3<T> { T DynamicValueRelocTable; T HybridMetadataPointer; }; template <typename T> struct load_configuration_v5 : load_configuration_v4<T> { T GuardRFFailureRoutine; T GuardRFFailureRoutineFunctionPointer; uint32_t DynamicValueRelocTableOffset; uint16_t DynamicValueRelocTableSection; uint16_t Reserved2; }; #pragma pack(4) template <typename T> struct load_configuration_v6 : load_configuration_v5<T> { T GuardRFVerifyStackPointerFunctionPointer; uint32_t HotPatchTableOffset; }; #pragma pack() template <typename T> struct load_configuration_v7 : load_configuration_v6<T> { uint32_t Reserved3; T AddressOfSomeUnicodeString; }; class PE32 { public: using pe_optional_header = pe32_optional_header; using pe_tls = pe32_tls; using uint = uint32_t; using load_configuration_t = load_configuration<uint32_t>; using load_configuration_v0_t = load_configuration_v0<uint32_t>; using load_configuration_v1_t = load_configuration_v1<uint32_t>; using load_configuration_v2_t = load_configuration_v2<uint32_t>; using load_configuration_v3_t = load_configuration_v3<uint32_t>; using load_configuration_v4_t = load_configuration_v4<uint32_t>; using load_configuration_v5_t = load_configuration_v5<uint32_t>; using load_configuration_v6_t = load_configuration_v6<uint32_t>; using load_configuration_v7_t = load_configuration_v7<uint32_t>; static_assert(sizeof(load_configuration_t) == 0x40, ""); static_assert(sizeof(load_configuration_v0_t) == 0x48, ""); static_assert(sizeof(load_configuration_v1_t) == 0x5c, ""); static_assert(sizeof(load_configuration_v2_t) == 0x68, ""); static_assert(sizeof(load_configuration_v3_t) == 0x78, ""); static_assert(sizeof(load_configuration_v4_t) == 0x80, ""); static_assert(sizeof(load_configuration_v5_t) == 0x90, ""); static_assert(sizeof(load_configuration_v6_t) == 0x98, ""); //static_assert(sizeof(LoadConfiguration_V7) == 0xA0, ""); static const std::map<WIN_VERSION, size_t> load_configuration_sizes; }; class PE64 { public: using pe_optional_header = pe64_optional_header; using pe_tls = pe64_tls; using uint = uint64_t; using load_configuration_t = load_configuration<uint64_t>; using load_configuration_v0_t = load_configuration_v0<uint64_t>; using load_configuration_v1_t = load_configuration_v1<uint64_t>; using load_configuration_v2_t = load_configuration_v2<uint64_t>; using load_configuration_v3_t = load_configuration_v3<uint64_t>; using load_configuration_v4_t = load_configuration_v4<uint64_t>; using load_configuration_v5_t = load_configuration_v5<uint64_t>; using load_configuration_v6_t = load_configuration_v6<uint64_t>; using load_configuration_v7_t = load_configuration_v7<uint64_t>; static_assert(sizeof(load_configuration_t) == 0x60, ""); static_assert(sizeof(load_configuration_v0_t) == 0x70, ""); static_assert(sizeof(load_configuration_v1_t) == 0x94, ""); static_assert(sizeof(load_configuration_v2_t) == 0xA0, ""); static_assert(sizeof(load_configuration_v3_t) == 0xC0, ""); static_assert(sizeof(load_configuration_v4_t) == 0xD0, ""); static_assert(sizeof(load_configuration_v5_t) == 0xE8, ""); static_assert(sizeof(load_configuration_v6_t) == 0xF4, ""); static_assert(sizeof(load_configuration_v7_t) == 0x100, ""); static const std::map<WIN_VERSION, size_t> load_configuration_sizes; }; } } // end namesapce ELF } #endif
lief-project/LIEF
src/PE/Structures.hpp
C++
apache-2.0
12,832
/** * Copyright (C) 2015 DANS - Data Archiving and Networked Services (info@dans.knaw.nl) * * 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 nl.knaw.dans.easy.stage.command import java.io.File import java.net.URI import java.nio.file.{ Path, Paths } import java.util.regex.Pattern import org.joda.time.DateTime import org.rogach.scallop.{ ScallopConf, ScallopOption, ValueConverter, singleArgConverter } import resource._ import scala.io.Source import scala.util.Try class CommandLineOptions(args: Seq[String], configuration: Configuration) extends ScallopConf(args) { appendDefaultToDescription = true editBuilder(sc => sc.setHelpWidth(110)) printedName = "easy-stage-dataset" version(s"$printedName v${ configuration.version }") private val _________ = " " * printedName.length val description = "Stage a dataset in EASY-BagIt format for ingest into an EASY Fedora Commons 3.x Repository." val synopsis: String = s"""$printedName -t <submission-timestamp> -u <urn> [ -d <doi> ] [ -o ] [ -f <external-file-uris> ] [-a <archive>] \\ |${ _________ } <EASY-deposit> <staged-digital-object-set>""".stripMargin banner( s""" |$description | |Usage: | |$synopsis | |Options: |""".stripMargin) private implicit val dateTimeConv: ValueConverter[DateTime] = singleArgConverter[DateTime](conv = DateTime.parse) val submissionTimestamp: ScallopOption[DateTime] = opt[DateTime]( name = "submission-timestamp", short = 't', descr = "Timestamp in ISO8601 format") val urn: ScallopOption[String] = opt[String]( name = "urn", short = 'u', descr = "The URN to assign to the new dataset in EASY") val doi: ScallopOption[String] = opt[String]( name = "doi", short = 'd', descr = "The DOI to assign to the new dataset in EASY. If omitted, no files are ingested into EASY, not even place holders.") val otherAccessDOI: ScallopOption[Boolean] = opt[Boolean]( name = "doi-is-other-access-doi", short = 'o', descr = """Stage the provided DOI as an "other access DOI"""", default = Some(false)) val dsLocationMappings: ScallopOption[File] = opt[File]( name = "external-file-uris", short = 'f', descr = "File with mappings from bag local path to external file URI. Each line in this " + "file must contain a mapping. The path is separated from the URI by one ore more " + "whitespaces. If more groups of whitespaces are encountered, they are considered " + "part of the path.") val state: ScallopOption[String] = opt[String]( name = "state", descr = "The state of the dataset to be created. This must be one of DRAFT, SUBMITTED or PUBLISHED.", default = Option("DRAFT")) val archive: ScallopOption[String] = opt[String]( name = "archive", descr = "The way the dataset is archived. This must be either EASY or DATAVAULT. " + "EASY: Data and metadata are archived in EASY. " + "DATAVAULT: Data and metadata are archived in the DATAVAULT. There may be dissemination copies in EASY.", default = Option("EASY")) val includeBagMetadata: ScallopOption[Boolean] = opt[Boolean]( name = "include-bag-metadata", short = 'i', descr = "Indicates whether bag metadata (such as dataset.xml and files.xml) should be included in the resultant staged digital object.", default = Some(false), ) val deposit: ScallopOption[File] = trailArg[File]( name = "EASY-deposit", descr = "Deposit directory contains deposit.properties file and bag with extra metadata for EASY to be staged for ingest into Fedora", required = true) val sdoSet: ScallopOption[File] = trailArg[File]( name = "staged-digital-object-set", descr = "The resulting Staged Digital Object directory (will be created if it does not exist)", required = true) validateFileExists(deposit) verify() def getDsLocationMappings: Map[Path, URI] = { dsLocationMappings.map(readDsLocationMappings(_).get).getOrElse(Map.empty) } private val dsLocationsFileLinePattern = Pattern.compile("""^(.*)\s+(.*)$""") private def readDsLocationMappings(file: File): Try[Map[Path, URI]] = { managed(Source.fromFile(file, "UTF-8")) .map(_.getLines() .collect { case line if line.nonEmpty => val m = dsLocationsFileLinePattern.matcher(line) if (m.find()) (Paths.get(m.group(1).trim), new URI(m.group(2).trim)) else throw new IllegalArgumentException(s"Invalid line in input: '$line'") } .toMap) .tried } }
DANS-KNAW/easy-stage-dataset
command/src/main/scala/nl.knaw.dans.easy.stage.command/CommandLineOptions.scala
Scala
apache-2.0
5,075
/* Copyright 2016 The Kubernetes Authors. 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 dynamic provides a client interface to arbitrary Kubernetes // APIs that exposes common high level operations and exposes common // metadata. package dynamic import ( "encoding/json" "errors" "io" "net/url" "strings" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/conversion/queryparams" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/serializer" "k8s.io/apimachinery/pkg/watch" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/client/restclient" "k8s.io/kubernetes/pkg/util/flowcontrol" ) // Client is a Kubernetes client that allows you to access metadata // and manipulate metadata of a Kubernetes API group. type Client struct { cl *restclient.RESTClient parameterCodec runtime.ParameterCodec } // NewClient returns a new client based on the passed in config. The // codec is ignored, as the dynamic client uses it's own codec. func NewClient(conf *restclient.Config) (*Client, error) { // avoid changing the original config confCopy := *conf conf = &confCopy contentConfig := ContentConfig() contentConfig.GroupVersion = conf.GroupVersion if conf.NegotiatedSerializer != nil { contentConfig.NegotiatedSerializer = conf.NegotiatedSerializer } conf.ContentConfig = contentConfig if conf.APIPath == "" { conf.APIPath = "/api" } if len(conf.UserAgent) == 0 { conf.UserAgent = restclient.DefaultKubernetesUserAgent() } cl, err := restclient.RESTClientFor(conf) if err != nil { return nil, err } return &Client{cl: cl}, nil } // GetRateLimiter returns rate limier. func (c *Client) GetRateLimiter() flowcontrol.RateLimiter { return c.cl.GetRateLimiter() } // Resource returns an API interface to the specified resource for this client's // group and version. If resource is not a namespaced resource, then namespace // is ignored. The ResourceClient inherits the parameter codec of c. func (c *Client) Resource(resource *metav1.APIResource, namespace string) *ResourceClient { return &ResourceClient{ cl: c.cl, resource: resource, ns: namespace, parameterCodec: c.parameterCodec, } } // ParameterCodec returns a client with the provided parameter codec. func (c *Client) ParameterCodec(parameterCodec runtime.ParameterCodec) *Client { return &Client{ cl: c.cl, parameterCodec: parameterCodec, } } // ResourceClient is an API interface to a specific resource under a // dynamic client. type ResourceClient struct { cl *restclient.RESTClient resource *metav1.APIResource ns string parameterCodec runtime.ParameterCodec } // List returns a list of objects for this resource. func (rc *ResourceClient) List(opts runtime.Object) (runtime.Object, error) { parameterEncoder := rc.parameterCodec if parameterEncoder == nil { parameterEncoder = defaultParameterEncoder } return rc.cl.Get(). NamespaceIfScoped(rc.ns, rc.resource.Namespaced). Resource(rc.resource.Name). VersionedParams(opts, parameterEncoder). Do(). Get() } // Get gets the resource with the specified name. func (rc *ResourceClient) Get(name string) (*unstructured.Unstructured, error) { result := new(unstructured.Unstructured) err := rc.cl.Get(). NamespaceIfScoped(rc.ns, rc.resource.Namespaced). Resource(rc.resource.Name). Name(name). Do(). Into(result) return result, err } // Delete deletes the resource with the specified name. func (rc *ResourceClient) Delete(name string, opts *v1.DeleteOptions) error { return rc.cl.Delete(). NamespaceIfScoped(rc.ns, rc.resource.Namespaced). Resource(rc.resource.Name). Name(name). Body(opts). Do(). Error() } // DeleteCollection deletes a collection of objects. func (rc *ResourceClient) DeleteCollection(deleteOptions *v1.DeleteOptions, listOptions runtime.Object) error { parameterEncoder := rc.parameterCodec if parameterEncoder == nil { parameterEncoder = defaultParameterEncoder } return rc.cl.Delete(). NamespaceIfScoped(rc.ns, rc.resource.Namespaced). Resource(rc.resource.Name). VersionedParams(listOptions, parameterEncoder). Body(deleteOptions). Do(). Error() } // Create creates the provided resource. func (rc *ResourceClient) Create(obj *unstructured.Unstructured) (*unstructured.Unstructured, error) { result := new(unstructured.Unstructured) err := rc.cl.Post(). NamespaceIfScoped(rc.ns, rc.resource.Namespaced). Resource(rc.resource.Name). Body(obj). Do(). Into(result) return result, err } // Update updates the provided resource. func (rc *ResourceClient) Update(obj *unstructured.Unstructured) (*unstructured.Unstructured, error) { result := new(unstructured.Unstructured) if len(obj.GetName()) == 0 { return result, errors.New("object missing name") } err := rc.cl.Put(). NamespaceIfScoped(rc.ns, rc.resource.Namespaced). Resource(rc.resource.Name). Name(obj.GetName()). Body(obj). Do(). Into(result) return result, err } // Watch returns a watch.Interface that watches the resource. func (rc *ResourceClient) Watch(opts runtime.Object) (watch.Interface, error) { parameterEncoder := rc.parameterCodec if parameterEncoder == nil { parameterEncoder = defaultParameterEncoder } return rc.cl.Get(). Prefix("watch"). NamespaceIfScoped(rc.ns, rc.resource.Namespaced). Resource(rc.resource.Name). VersionedParams(opts, parameterEncoder). Watch() } func (rc *ResourceClient) Patch(name string, pt api.PatchType, data []byte) (*unstructured.Unstructured, error) { result := new(unstructured.Unstructured) err := rc.cl.Patch(pt). NamespaceIfScoped(rc.ns, rc.resource.Namespaced). Resource(rc.resource.Name). Name(name). Body(data). Do(). Into(result) return result, err } // dynamicCodec is a codec that wraps the standard unstructured codec // with special handling for Status objects. type dynamicCodec struct{} func (dynamicCodec) Decode(data []byte, gvk *schema.GroupVersionKind, obj runtime.Object) (runtime.Object, *schema.GroupVersionKind, error) { obj, gvk, err := unstructured.UnstructuredJSONScheme.Decode(data, gvk, obj) if err != nil { return nil, nil, err } if _, ok := obj.(*metav1.Status); !ok && strings.ToLower(gvk.Kind) == "status" { obj = &metav1.Status{} err := json.Unmarshal(data, obj) if err != nil { return nil, nil, err } } return obj, gvk, nil } func (dynamicCodec) Encode(obj runtime.Object, w io.Writer) error { return unstructured.UnstructuredJSONScheme.Encode(obj, w) } // ContentConfig returns a restclient.ContentConfig for dynamic types. func ContentConfig() restclient.ContentConfig { var jsonInfo runtime.SerializerInfo // TODO: api.Codecs here should become "pkg/apis/server/scheme" which is the minimal core you need // to talk to a kubernetes server for _, info := range api.Codecs.SupportedMediaTypes() { if info.MediaType == runtime.ContentTypeJSON { jsonInfo = info break } } jsonInfo.Serializer = dynamicCodec{} jsonInfo.PrettySerializer = nil return restclient.ContentConfig{ AcceptContentTypes: runtime.ContentTypeJSON, ContentType: runtime.ContentTypeJSON, NegotiatedSerializer: serializer.NegotiatedSerializerWrapper(jsonInfo), } } // paramaterCodec is a codec converts an API object to query // parameters without trying to convert to the target version. type parameterCodec struct{} func (parameterCodec) EncodeParameters(obj runtime.Object, to schema.GroupVersion) (url.Values, error) { return queryparams.Convert(obj) } func (parameterCodec) DecodeParameters(parameters url.Values, from schema.GroupVersion, into runtime.Object) error { return errors.New("DecodeParameters not implemented on dynamic parameterCodec") } var defaultParameterEncoder runtime.ParameterCodec = parameterCodec{} type versionedParameterEncoderWithV1Fallback struct{} func (versionedParameterEncoderWithV1Fallback) EncodeParameters(obj runtime.Object, to schema.GroupVersion) (url.Values, error) { ret, err := api.ParameterCodec.EncodeParameters(obj, to) if err != nil && runtime.IsNotRegisteredError(err) { // fallback to v1 return api.ParameterCodec.EncodeParameters(obj, v1.SchemeGroupVersion) } return ret, err } func (versionedParameterEncoderWithV1Fallback) DecodeParameters(parameters url.Values, from schema.GroupVersion, into runtime.Object) error { return errors.New("DecodeParameters not implemented on versionedParameterEncoderWithV1Fallback") } // VersionedParameterEncoderWithV1Fallback is useful for encoding query // parameters for thirdparty resources. It tries to convert object to the // specified version before converting it to query parameters, and falls back to // converting to v1 if the object is not registered in the specified version. // For the record, currently API server always treats query parameters sent to a // thirdparty resource endpoint as v1. var VersionedParameterEncoderWithV1Fallback runtime.ParameterCodec = versionedParameterEncoderWithV1Fallback{}
ibm-contribs/kubernetes
pkg/client/typed/dynamic/client.go
GO
apache-2.0
9,657
<!DOCTYPE html> <!--[if lt IE 7]> <html lang="pt-BR" ng-app="lunchTime" class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> <!--[if IE 7]> <html lang="pt-BR" ng-app="lunchTime" class="no-js lt-ie9 lt-ie8"> <![endif]--> <!--[if IE 8]> <html lang="pt-BR" ng-app="lunchTime" class="no-js lt-ie9"> <![endif]--> <!--[if gt IE 8]><!--> <html lang="pt-BR" ng-app="lunchTime" class="no-js"> <!--<![endif]--> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <link rel="shortcut icon" href="img/favicon.ico" type="image/x-icon" /> <title>LunchTime</title> <meta name="description" content=""> <meta name="viewport" content="minimal-ui; initial-scale=1.0; maximum-scale=1.0; user-scalable=no; width=440"> <!-- <meta name="viewport" content="width=device-width, initial-scale=1"> --> <link rel="stylesheet" href="css/normalize.css"> <link rel="stylesheet" href="css/lunch-time.css"> <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=true&libraries=places"></script> </head> <body ng-app="lunchTime"> <div ui-view></div> <script src="js/angular.min.js"></script> <script src="js/angular-ui-router.js"></script> <script src="js/lunchTime.js"></script> <script src="js/components/mapa/mapa.js"></script> <script src="js/components/login/login.js"></script> <script src="js/components/user/user.js"></script> <script type="text/javascript"> fixInfoWindow(); </script> </body> </html>
HoraDoAlmoco/lunch-time
LunchTime/WebContent/index.html
HTML
apache-2.0
1,541
/* * Copyright 2007 The Closure Compiler Authors. * * 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.google.javascript.jscomp; import com.google.javascript.jscomp.NodeTraversal.AbstractPostOrderCallback; import com.google.javascript.rhino.Node; /** * Traversal callback that finds method invocations of the form * * <pre> * call * getprop * ... * string * ... * </pre> * * and invokes a method defined by subclasses for processing these invocations. */ abstract class InvocationsCallback extends AbstractPostOrderCallback { @Override public void visit(NodeTraversal t, Node n, Node parent) { if (!n.isCall()) { return; } Node function = n.getFirstChild(); if (!function.isGetProp()) { return; } Node nameNode = function.getSecondChild(); // Don't care about numerical or variable indexes if (!nameNode.isString()) { return; } visit(t, n, parent, nameNode.getString()); } /** * Called for each callnode that is a method invocation. * * @param callNode node of type call * @param parent parent of callNode * @param callName name of method invoked by first child of call */ abstract void visit(NodeTraversal t, Node callNode, Node parent, String callName); }
vobruba-martin/closure-compiler
src/com/google/javascript/jscomp/InvocationsCallback.java
Java
apache-2.0
1,806
### Stopping Applications To stop an application, do these steps: * Go to the StopApp procedure. * Enter the following parameters: ![image](images/StopApp/stopApp2.png) After the job runs, you can view the results, including the following job details, which show that the application was stoped successfully: ![image](images/StopApp/stopApp3.png) In the **StopApp** step, click the Log icon to see the diagnostic information. The output is similar to the following diagnostic report. ![image](images/StopApp/stopApp4.png)
electric-cloud/EC-WebSphere
help/procedures/StopApp/postface.md
Markdown
apache-2.0
535
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (version 1.7.0_75) on Wed Jun 10 23:20:25 IST 2015 --> <meta http-equiv="Content-Type" content="text/html" charset="utf-8"> <title>Uses of Class org.apache.solr.common.cloud.Replica (Solr 5.2.1 API)</title> <meta name="date" content="2015-06-10"> <link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style"> </head> <body> <script type="text/javascript"><!-- if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class org.apache.solr.common.cloud.Replica (Solr 5.2.1 API)"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar_top"> <!-- --> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../../org/apache/solr/common/cloud/Replica.html" title="class in org.apache.solr.common.cloud">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../../index.html?org/apache/solr/common/cloud/class-use/Replica.html" target="_top">Frames</a></li> <li><a href="Replica.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h2 title="Uses of Class org.apache.solr.common.cloud.Replica" class="title">Uses of Class<br>org.apache.solr.common.cloud.Replica</h2> </div> <div class="classUseContainer"> <ul class="blockList"> <li class="blockList"> <table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation"> <caption><span>Packages that use <a href="../../../../../../org/apache/solr/common/cloud/Replica.html" title="class in org.apache.solr.common.cloud">Replica</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Package</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><a href="#org.apache.solr.common.cloud">org.apache.solr.common.cloud</a></td> <td class="colLast"> <div class="block">Common Solr Cloud and ZooKeeper related classes reused on both clients &amp; server.</div> </td> </tr> </tbody> </table> </li> <li class="blockList"> <ul class="blockList"> <li class="blockList"><a name="org.apache.solr.common.cloud"> <!-- --> </a> <h3>Uses of <a href="../../../../../../org/apache/solr/common/cloud/Replica.html" title="class in org.apache.solr.common.cloud">Replica</a> in <a href="../../../../../../org/apache/solr/common/cloud/package-summary.html">org.apache.solr.common.cloud</a></h3> <table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../../../org/apache/solr/common/cloud/package-summary.html">org.apache.solr.common.cloud</a> that return <a href="../../../../../../org/apache/solr/common/cloud/Replica.html" title="class in org.apache.solr.common.cloud">Replica</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../../../org/apache/solr/common/cloud/Replica.html" title="class in org.apache.solr.common.cloud">Replica</a></code></td> <td class="colLast"><span class="strong">Slice.</span><code><strong><a href="../../../../../../org/apache/solr/common/cloud/Slice.html#getLeader()">getLeader</a></strong>()</code>&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../../../../../../org/apache/solr/common/cloud/Replica.html" title="class in org.apache.solr.common.cloud">Replica</a></code></td> <td class="colLast"><span class="strong">ZkStateReader.</span><code><strong><a href="../../../../../../org/apache/solr/common/cloud/ZkStateReader.html#getLeader(java.lang.String,%20java.lang.String)">getLeader</a></strong>(<a href="http://download.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;collection, <a href="http://download.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;shard)</code>&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../../../org/apache/solr/common/cloud/Replica.html" title="class in org.apache.solr.common.cloud">Replica</a></code></td> <td class="colLast"><span class="strong">ClusterState.</span><code><strong><a href="../../../../../../org/apache/solr/common/cloud/ClusterState.html#getLeader(java.lang.String,%20java.lang.String)">getLeader</a></strong>(<a href="http://download.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;collection, <a href="http://download.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;sliceName)</code> <div class="block">Get the lead replica for specific collection, or null if one currently doesn't exist.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../../../../../../org/apache/solr/common/cloud/Replica.html" title="class in org.apache.solr.common.cloud">Replica</a></code></td> <td class="colLast"><span class="strong">ZkStateReader.</span><code><strong><a href="../../../../../../org/apache/solr/common/cloud/ZkStateReader.html#getLeaderRetry(java.lang.String,%20java.lang.String)">getLeaderRetry</a></strong>(<a href="http://download.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;collection, <a href="http://download.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;shard)</code> <div class="block">Get shard leader properties, with retry if none exist.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../../../org/apache/solr/common/cloud/Replica.html" title="class in org.apache.solr.common.cloud">Replica</a></code></td> <td class="colLast"><span class="strong">ZkStateReader.</span><code><strong><a href="../../../../../../org/apache/solr/common/cloud/ZkStateReader.html#getLeaderRetry(java.lang.String,%20java.lang.String,%20int)">getLeaderRetry</a></strong>(<a href="http://download.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;collection, <a href="http://download.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;shard, int&nbsp;timeout)</code> <div class="block">Get shard leader properties, with retry if none exist.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../../../../../../org/apache/solr/common/cloud/Replica.html" title="class in org.apache.solr.common.cloud">Replica</a></code></td> <td class="colLast"><span class="strong">DocCollection.</span><code><strong><a href="../../../../../../org/apache/solr/common/cloud/DocCollection.html#getReplica(java.lang.String)">getReplica</a></strong>(<a href="http://download.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;coreNodeName)</code>&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../../../org/apache/solr/common/cloud/Replica.html" title="class in org.apache.solr.common.cloud">Replica</a></code></td> <td class="colLast"><span class="strong">Slice.</span><code><strong><a href="../../../../../../org/apache/solr/common/cloud/Slice.html#getReplica(java.lang.String)">getReplica</a></strong>(<a href="http://download.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;replicaName)</code>&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../../../../../../org/apache/solr/common/cloud/Replica.html" title="class in org.apache.solr.common.cloud">Replica</a></code></td> <td class="colLast"><span class="strong">ClusterState.</span><code><strong><a href="../../../../../../org/apache/solr/common/cloud/ClusterState.html#getReplica(java.lang.String,%20java.lang.String)">getReplica</a></strong>(<a href="http://download.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;collection, <a href="http://download.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;coreNodeName)</code> <div class="block">Gets the replica by the core name (assuming the slice is unknown) or null if replica is not found.</div> </td> </tr> </tbody> </table> <table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../../../org/apache/solr/common/cloud/package-summary.html">org.apache.solr.common.cloud</a> that return types with arguments of type <a href="../../../../../../org/apache/solr/common/cloud/Replica.html" title="class in org.apache.solr.common.cloud">Replica</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="http://download.oracle.com/javase/7/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a>&lt;<a href="../../../../../../org/apache/solr/common/cloud/Replica.html" title="class in org.apache.solr.common.cloud">Replica</a>&gt;</code></td> <td class="colLast"><span class="strong">Slice.</span><code><strong><a href="../../../../../../org/apache/solr/common/cloud/Slice.html#getReplicas()">getReplicas</a></strong>()</code> <div class="block">Gets the list of replicas for this slice.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="http://download.oracle.com/javase/7/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</a>&lt;<a href="http://download.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>,<a href="../../../../../../org/apache/solr/common/cloud/Replica.html" title="class in org.apache.solr.common.cloud">Replica</a>&gt;</code></td> <td class="colLast"><span class="strong">Slice.</span><code><strong><a href="../../../../../../org/apache/solr/common/cloud/Slice.html#getReplicasCopy()">getReplicasCopy</a></strong>()</code>&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><code><a href="http://download.oracle.com/javase/7/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</a>&lt;<a href="http://download.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>,<a href="../../../../../../org/apache/solr/common/cloud/Replica.html" title="class in org.apache.solr.common.cloud">Replica</a>&gt;</code></td> <td class="colLast"><span class="strong">Slice.</span><code><strong><a href="../../../../../../org/apache/solr/common/cloud/Slice.html#getReplicasMap()">getReplicasMap</a></strong>()</code> <div class="block">Get the map of coreNodeName to replicas for this slice.</div> </td> </tr> </tbody> </table> <table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing constructors, and an explanation"> <caption><span>Constructor parameters in <a href="../../../../../../org/apache/solr/common/cloud/package-summary.html">org.apache.solr.common.cloud</a> with type arguments of type <a href="../../../../../../org/apache/solr/common/cloud/Replica.html" title="class in org.apache.solr.common.cloud">Replica</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colOne" scope="col">Constructor and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colLast"><code><strong><a href="../../../../../../org/apache/solr/common/cloud/Slice.html#Slice(java.lang.String,%20java.util.Map,%20java.util.Map)">Slice</a></strong>(<a href="http://download.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;name, <a href="http://download.oracle.com/javase/7/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</a>&lt;<a href="http://download.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>,<a href="../../../../../../org/apache/solr/common/cloud/Replica.html" title="class in org.apache.solr.common.cloud">Replica</a>&gt;&nbsp;replicas, <a href="http://download.oracle.com/javase/7/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</a>&lt;<a href="http://download.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>,<a href="http://download.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&gt;&nbsp;props)</code>&nbsp;</td> </tr> </tbody> </table> </li> </ul> </li> </ul> </div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar_bottom"> <!-- --> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../../org/apache/solr/common/cloud/Replica.html" title="class in org.apache.solr.common.cloud">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../../index.html?org/apache/solr/common/cloud/class-use/Replica.html" target="_top">Frames</a></li> <li><a href="Replica.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small> <i>Copyright &copy; 2000-2015 Apache Software Foundation. All Rights Reserved.</i> <script src='../../../../../../prettify.js' type='text/javascript'></script> <script type='text/javascript'> (function(){ var oldonload = window.onload; if (typeof oldonload != 'function') { window.onload = prettyPrint; } else { window.onload = function() { oldonload(); prettyPrint(); } } })(); </script> </small></p> </body> </html>
priyankajayaswal1/Solr-5.2-1-searching-and-indexing-
docs/solr-solrj/org/apache/solr/common/cloud/class-use/Replica.html
HTML
apache-2.0
17,095
/* * Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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.amazonaws.services.ec2.model; import java.io.Serializable; import javax.annotation.Generated; /** * <p> * PrincipalIdFormat description * </p> * * @see <a href="http://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/PrincipalIdFormat" target="_top">AWS API * Documentation</a> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class PrincipalIdFormat implements Serializable, Cloneable { /** * <p> * PrincipalIdFormatARN description * </p> */ private String arn; /** * <p> * PrincipalIdFormatStatuses description * </p> */ private com.amazonaws.internal.SdkInternalList<IdFormat> statuses; /** * <p> * PrincipalIdFormatARN description * </p> * * @param arn * PrincipalIdFormatARN description */ public void setArn(String arn) { this.arn = arn; } /** * <p> * PrincipalIdFormatARN description * </p> * * @return PrincipalIdFormatARN description */ public String getArn() { return this.arn; } /** * <p> * PrincipalIdFormatARN description * </p> * * @param arn * PrincipalIdFormatARN description * @return Returns a reference to this object so that method calls can be chained together. */ public PrincipalIdFormat withArn(String arn) { setArn(arn); return this; } /** * <p> * PrincipalIdFormatStatuses description * </p> * * @return PrincipalIdFormatStatuses description */ public java.util.List<IdFormat> getStatuses() { if (statuses == null) { statuses = new com.amazonaws.internal.SdkInternalList<IdFormat>(); } return statuses; } /** * <p> * PrincipalIdFormatStatuses description * </p> * * @param statuses * PrincipalIdFormatStatuses description */ public void setStatuses(java.util.Collection<IdFormat> statuses) { if (statuses == null) { this.statuses = null; return; } this.statuses = new com.amazonaws.internal.SdkInternalList<IdFormat>(statuses); } /** * <p> * PrincipalIdFormatStatuses description * </p> * <p> * <b>NOTE:</b> This method appends the values to the existing list (if any). Use * {@link #setStatuses(java.util.Collection)} or {@link #withStatuses(java.util.Collection)} if you want to override * the existing values. * </p> * * @param statuses * PrincipalIdFormatStatuses description * @return Returns a reference to this object so that method calls can be chained together. */ public PrincipalIdFormat withStatuses(IdFormat... statuses) { if (this.statuses == null) { setStatuses(new com.amazonaws.internal.SdkInternalList<IdFormat>(statuses.length)); } for (IdFormat ele : statuses) { this.statuses.add(ele); } return this; } /** * <p> * PrincipalIdFormatStatuses description * </p> * * @param statuses * PrincipalIdFormatStatuses description * @return Returns a reference to this object so that method calls can be chained together. */ public PrincipalIdFormat withStatuses(java.util.Collection<IdFormat> statuses) { setStatuses(statuses); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getArn() != null) sb.append("Arn: ").append(getArn()).append(","); if (getStatuses() != null) sb.append("Statuses: ").append(getStatuses()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof PrincipalIdFormat == false) return false; PrincipalIdFormat other = (PrincipalIdFormat) obj; if (other.getArn() == null ^ this.getArn() == null) return false; if (other.getArn() != null && other.getArn().equals(this.getArn()) == false) return false; if (other.getStatuses() == null ^ this.getStatuses() == null) return false; if (other.getStatuses() != null && other.getStatuses().equals(this.getStatuses()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getArn() == null) ? 0 : getArn().hashCode()); hashCode = prime * hashCode + ((getStatuses() == null) ? 0 : getStatuses().hashCode()); return hashCode; } @Override public PrincipalIdFormat clone() { try { return (PrincipalIdFormat) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } }
aws/aws-sdk-java
aws-java-sdk-ec2/src/main/java/com/amazonaws/services/ec2/model/PrincipalIdFormat.java
Java
apache-2.0
6,124
# Meliola venezuelana var. venezuelana Orejuela VARIETY #### Status ACCEPTED #### According to Index Fungorum #### Published in null #### Original name Meliola venezuelana var. venezuelana Orejuela ### Remarks null
mdoering/backbone
life/Fungi/Ascomycota/Dothideomycetes/Meliolales/Meliolaceae/Meliola/Meliola venezuelana/Meliola venezuelana venezuelana/README.md
Markdown
apache-2.0
219
<!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 `CR1` constant in crate `libc`."> <meta name="keywords" content="rust, rustlang, rust-lang, CR1"> <title>libc::CR1 - Rust</title> <link rel="stylesheet" type="text/css" href="../normalize.css"> <link rel="stylesheet" type="text/css" href="../rustdoc.css"> <link rel="stylesheet" type="text/css" href="../main.css"> <link rel="shortcut icon" href="https://doc.rust-lang.org/favicon.ico"> </head> <body class="rustdoc constant"> <!--[if lte IE 8]> <div class="warning"> This old browser is unsupported and will most likely display funky things. </div> <![endif]--> <nav class="sidebar"> <a href='../libc/index.html'><img src='https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png' alt='logo' width='100'></a> <p class='location'><a href='index.html'>libc</a></p><script>window.sidebarCurrent = {name: 'CR1', ty: 'constant', relpath: ''};</script><script defer src="sidebar-items.js"></script> </nav> <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"> <h1 class='fqn'><span class='in-band'>Constant <a href='index.html'>libc</a>::<wbr><a class="constant" href=''>CR1</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 class='srclink' href='../src/libc/unix/notbsd/linux/other/b64/x86_64.rs.html#410' title='goto source code'>[src]</a></span></h1> <pre class='rust const'>pub const CR1: <a class="type" href="../libc/type.c_int.html" title="type libc::c_int">c_int</a><code> = </code><code>512</code></pre></section> <section id='search' class="content hidden"></section> <section class="footer"></section> <aside id="help" class="hidden"> <div> <h1 class="hidden">Help</h1> <div class="shortcuts"> <h2>Keyboard Shortcuts</h2> <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> <dt>+</dt> <dd>Collapse/expand all sections</dd> </dl> </div> <div class="infos"> <h2>Search Tricks</h2> <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> or <code>* -> vec</code>) </p> </div> </div> </aside> <script> window.rootPath = "../"; window.currentCrate = "libc"; </script> <script src="../jquery.js"></script> <script src="../main.js"></script> <script defer src="../search-index.js"></script> </body> </html>
nitro-devs/nitro-game-engine
docs/libc/constant.CR1.html
HTML
apache-2.0
4,286
# AUTOGENERATED FILE FROM balenalib/iot-gate-imx8-debian:bullseye-build RUN apt-get update \ && apt-get install -y --no-install-recommends \ ca-certificates \ curl \ \ # .NET Core dependencies libc6 \ libgcc1 \ libgssapi-krb5-2 \ libicu67 \ libssl1.1 \ libstdc++6 \ zlib1g \ && rm -rf /var/lib/apt/lists/* # Configure web servers to bind to port 80 when present ENV ASPNETCORE_URLS=http://+:80 \ # Enable detection of running in a container DOTNET_RUNNING_IN_CONTAINER=true # Install .NET Core SDK ENV DOTNET_SDK_VERSION 3.1.415 RUN curl -SL --output dotnet.tar.gz "https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$DOTNET_SDK_VERSION/dotnet-sdk-$DOTNET_SDK_VERSION-linux-arm64.tar.gz" \ && dotnet_sha512='7a5b9922988bcbde63d39f97e283ca1d373d5521cca0ab8946e2f86deaef6e21f00244228a0d5d8c38c2b9634b38bc7338b61984f0e12dd8fdb8b2e6eed5dd34' \ && echo "$dotnet_sha512 dotnet.tar.gz" | sha512sum -c - \ && mkdir -p /usr/share/dotnet \ && tar -zxf dotnet.tar.gz -C /usr/share/dotnet \ && rm dotnet.tar.gz \ && ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet # Enable correct mode for dotnet watch (only mode supported in a container) ENV DOTNET_USE_POLLING_FILE_WATCHER=true \ # Skip extraction of XML docs - generally not useful within an image/container - helps performance NUGET_XMLDOC_MODE=skip \ DOTNET_NOLOGO=true # Trigger first run experience by running arbitrary cmd to populate local package cache RUN dotnet help CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"] RUN curl -SLO "https://raw.githubusercontent.com/balena-io-library/base-images/44e597e40f2010cdde15b3ba1e397aea3a5c5271/scripts/assets/tests/test-stack@dotnet.sh" \ && echo "Running test-stack@dotnet" \ && chmod +x test-stack@dotnet.sh \ && bash test-stack@dotnet.sh \ && rm -rf test-stack@dotnet.sh RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo 'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: ARM v8 \nOS: Debian Bullseye \nVariant: build variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \ndotnet 3.1-sdk \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info RUN echo '#!/bin/sh.real\nbalena-info\nrm -f /bin/sh\ncp /bin/sh.real /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \ && chmod +x /bin/sh-shim \ && cp /bin/sh /bin/sh.real \ && mv /bin/sh-shim /bin/sh
resin-io-library/base-images
balena-base-images/dotnet/iot-gate-imx8/debian/bullseye/3.1-sdk/build/Dockerfile
Dockerfile
apache-2.0
2,922
import os import time import logging import math from parsl.channels import LocalChannel from parsl.launchers import SingleNodeLauncher from parsl.providers.cluster_provider import ClusterProvider from parsl.providers.lsf.template import template_string from parsl.providers.provider_base import JobState, JobStatus from parsl.utils import RepresentationMixin, wtime_to_minutes logger = logging.getLogger(__name__) translate_table = { 'PEND': JobState.PENDING, 'RUN': JobState.RUNNING, 'DONE': JobState.COMPLETED, 'EXIT': JobState.FAILED, # (failed), 'PSUSP': JobState.CANCELLED, 'USUSP': JobState.CANCELLED, 'SSUSP': JobState.CANCELLED, } class LSFProvider(ClusterProvider, RepresentationMixin): """LSF Execution Provider This provider uses sbatch to submit, squeue for status and scancel to cancel jobs. The sbatch script to be used is created from a template file in this same module. Parameters ---------- channel : Channel Channel for accessing this provider. Possible channels include :class:`~parsl.channels.LocalChannel` (the default), :class:`~parsl.channels.SSHChannel`, or :class:`~parsl.channels.SSHInteractiveLoginChannel`. nodes_per_block : int Nodes to provision per block. When request_by_nodes is False, it is computed by cores_per_block / cores_per_node. cores_per_block : int Cores to provision per block. Enabled only when request_by_nodes is False. cores_per_node: int Cores to provision per node. Enabled only when request_by_nodes is False. init_blocks : int Number of blocks to request at the start of the run. min_blocks : int Minimum number of blocks to maintain. max_blocks : int Maximum number of blocks to maintain. parallelism : float Ratio of provisioned task slots to active tasks. A parallelism value of 1 represents aggressive scaling where as many resources as possible are used; parallelism close to 0 represents the opposite situation in which as few resources as possible (i.e., min_blocks) are used. walltime : str Walltime requested per block in HH:MM:SS. project : str Project to which the resources must be charged queue : str Queue to which to submit the job request scheduler_options : str String to prepend to the #SBATCH blocks in the submit script to the scheduler. worker_init : str Command to be run before starting a worker, such as 'module load Anaconda; source activate env'. cmd_timeout : int Seconds after which requests to the scheduler will timeout. Default: 120s launcher : Launcher Launcher for this provider. Possible launchers include :class:`~parsl.launchers.SingleNodeLauncher` (the default), :class:`~parsl.launchers.SrunLauncher`, or :class:`~parsl.launchers.AprunLauncher` move_files : Optional[Bool]: should files be moved? by default, Parsl will try to move files. bsub_redirection: Bool Should a redirection symbol "<" be included when submitting jobs, i.e., Bsub < job_script. request_by_nodes: Bool Request by nodes or request by cores per block. When this is set to false, nodes_per_block is computed by cores_per_block / cores_per_node. Default is True. """ def __init__(self, channel=LocalChannel(), nodes_per_block=1, cores_per_block=None, cores_per_node=None, init_blocks=1, min_blocks=0, max_blocks=1, parallelism=1, walltime="00:10:00", scheduler_options='', worker_init='', project=None, queue=None, cmd_timeout=120, move_files=True, bsub_redirection=False, request_by_nodes=True, launcher=SingleNodeLauncher()): label = 'LSF' super().__init__(label, channel, nodes_per_block, init_blocks, min_blocks, max_blocks, parallelism, walltime, cmd_timeout=cmd_timeout, launcher=launcher) self.project = project self.queue = queue self.cores_per_block = cores_per_block self.cores_per_node = cores_per_node self.move_files = move_files self.bsub_redirection = bsub_redirection self.request_by_nodes = request_by_nodes # Update scheduler options self.scheduler_options = scheduler_options + "\n" if project: self.scheduler_options += "#BSUB -P {}\n".format(project) if queue: self.scheduler_options += "#BSUB -q {}\n".format(queue) if request_by_nodes: self.scheduler_options += "#BSUB -nnodes {}\n".format(nodes_per_block) else: assert cores_per_block is not None and cores_per_node is not None, \ "Requesting resources by the number of cores. " \ "Need to specify cores_per_block and cores_per_node in the LSF provider." self.scheduler_options += "#BSUB -n {}\n".format(cores_per_block) self.scheduler_options += '#BSUB -R "span[ptile={}]"\n'.format(cores_per_node) # Set nodes_per_block manually for Parsl strategy assert cores_per_node != 0, "Need to specify a non-zero cores_per_node." self.nodes_per_block = int(math.ceil(cores_per_block / cores_per_node)) self.worker_init = worker_init def _status(self): ''' Internal: Do not call. Returns the status list for a list of job_ids Args: self Returns: [status...] : Status list of all jobs ''' job_id_list = ','.join(self.resources.keys()) cmd = "bjobs {0}".format(job_id_list) retcode, stdout, stderr = super().execute_wait(cmd) # Execute_wait failed. Do no update if retcode != 0: logger.debug("Updating job status from {} failed with return code {}".format(self.label, retcode)) return jobs_missing = list(self.resources.keys()) for line in stdout.split('\n'): parts = line.split() if parts and parts[0] != 'JOBID': job_id = parts[0] state = translate_table.get(parts[2], JobState.UNKNOWN) self.resources[job_id]['status'] = JobStatus(state) jobs_missing.remove(job_id) # squeue does not report on jobs that are not running. So we are filling in the # blanks for missing jobs, we might lose some information about why the jobs failed. for missing_job in jobs_missing: self.resources[missing_job]['status'] = JobStatus(JobState.COMPLETED) def submit(self, command, tasks_per_node, job_name="parsl.lsf"): """Submit the command as an LSF job. Parameters ---------- command : str Command to be made on the remote side. tasks_per_node : int Command invocations to be launched per node job_name : str Name for the job (must be unique). Returns ------- None or str If at capacity, returns None; otherwise, a string identifier for the job """ job_name = "{0}.{1}".format(job_name, time.time()) script_path = "{0}/{1}.submit".format(self.script_dir, job_name) script_path = os.path.abspath(script_path) logger.debug("Requesting one block with {} nodes".format(self.nodes_per_block)) job_config = {} job_config["submit_script_dir"] = self.channel.script_dir job_config["nodes"] = self.nodes_per_block job_config["tasks_per_node"] = tasks_per_node job_config["walltime"] = wtime_to_minutes(self.walltime) job_config["scheduler_options"] = self.scheduler_options job_config["worker_init"] = self.worker_init job_config["user_script"] = command # Wrap the command job_config["user_script"] = self.launcher(command, tasks_per_node, self.nodes_per_block) logger.debug("Writing submit script") self._write_submit_script(template_string, script_path, job_name, job_config) if self.move_files: logger.debug("moving files") channel_script_path = self.channel.push_file(script_path, self.channel.script_dir) else: logger.debug("not moving files") channel_script_path = script_path if self.bsub_redirection: cmd = "bsub < {0}".format(channel_script_path) else: cmd = "bsub {0}".format(channel_script_path) retcode, stdout, stderr = super().execute_wait(cmd) job_id = None if retcode == 0: for line in stdout.split('\n'): if line.lower().startswith("job") and "is submitted to" in line.lower(): job_id = line.split()[1].strip('<>') self.resources[job_id] = {'job_id': job_id, 'status': JobStatus(JobState.PENDING)} else: logger.warning("Submission of command to scale_out failed") logger.error("Retcode:%s STDOUT:%s STDERR:%s", retcode, stdout.strip(), stderr.strip()) return job_id def cancel(self, job_ids): ''' Cancels the jobs specified by a list of job ids Args: job_ids : [<job_id> ...] Returns : [True/False...] : If the cancel operation fails the entire list will be False. ''' job_id_list = ' '.join(job_ids) retcode, stdout, stderr = super().execute_wait("bkill {0}".format(job_id_list)) rets = None if retcode == 0: for jid in job_ids: self.resources[jid]['status'] = translate_table['USUSP'] # Job suspended by user/admin rets = [True for i in job_ids] else: rets = [False for i in job_ids] return rets @property def status_polling_interval(self): return 60
Parsl/parsl
parsl/providers/lsf/lsf.py
Python
apache-2.0
10,602
package im.getsocial.demo.fragment; import java.util.List; import java.util.Map; import javax.annotation.Nullable; public class SearchObject { public String searchTerm; @Nullable public List<String> labels; @Nullable public Map<String, String> properties; public static SearchObject empty() { SearchObject obj = new SearchObject(); obj.searchTerm = ""; return obj; } }
getsocial-im/getsocial-android-sdk
example/src/main/java/im/getsocial/demo/fragment/SearchObject.java
Java
apache-2.0
426
/* * 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.camel.impl.engine; import java.util.Map; import java.util.Optional; import org.apache.camel.CamelContext; import org.apache.camel.Endpoint; import org.apache.camel.Processor; import org.apache.camel.Route; import org.apache.camel.TypeConverter; import org.apache.camel.catalog.RuntimeCamelCatalog; import org.apache.camel.health.HealthCheckRegistry; import org.apache.camel.impl.converter.DefaultTypeConverter; import org.apache.camel.spi.AnnotationBasedProcessorFactory; import org.apache.camel.spi.AsyncProcessorAwaitManager; import org.apache.camel.spi.BeanIntrospection; import org.apache.camel.spi.BeanProcessorFactory; import org.apache.camel.spi.BeanProxyFactory; import org.apache.camel.spi.CamelBeanPostProcessor; import org.apache.camel.spi.CamelContextNameStrategy; import org.apache.camel.spi.ClassResolver; import org.apache.camel.spi.ComponentNameResolver; import org.apache.camel.spi.ComponentResolver; import org.apache.camel.spi.ConfigurerResolver; import org.apache.camel.spi.DataFormatResolver; import org.apache.camel.spi.DeferServiceFactory; import org.apache.camel.spi.EndpointRegistry; import org.apache.camel.spi.ExecutorServiceManager; import org.apache.camel.spi.FactoryFinder; import org.apache.camel.spi.FactoryFinderResolver; import org.apache.camel.spi.HeadersMapFactory; import org.apache.camel.spi.InflightRepository; import org.apache.camel.spi.Injector; import org.apache.camel.spi.InterceptEndpointFactory; import org.apache.camel.spi.InternalProcessorFactory; import org.apache.camel.spi.LanguageResolver; import org.apache.camel.spi.ManagementNameStrategy; import org.apache.camel.spi.MessageHistoryFactory; import org.apache.camel.spi.ModelJAXBContextFactory; import org.apache.camel.spi.ModelToXMLDumper; import org.apache.camel.spi.NodeIdFactory; import org.apache.camel.spi.PackageScanClassResolver; import org.apache.camel.spi.PackageScanResourceResolver; import org.apache.camel.spi.ProcessorFactory; import org.apache.camel.spi.PropertiesComponent; import org.apache.camel.spi.ReactiveExecutor; import org.apache.camel.spi.Registry; import org.apache.camel.spi.RestBindingJaxbDataFormatFactory; import org.apache.camel.spi.RestRegistryFactory; import org.apache.camel.spi.RouteController; import org.apache.camel.spi.RouteFactory; import org.apache.camel.spi.ShutdownStrategy; import org.apache.camel.spi.StreamCachingStrategy; import org.apache.camel.spi.Tracer; import org.apache.camel.spi.TransformerRegistry; import org.apache.camel.spi.TypeConverterRegistry; import org.apache.camel.spi.UnitOfWorkFactory; import org.apache.camel.spi.UriFactoryResolver; import org.apache.camel.spi.UuidGenerator; import org.apache.camel.spi.ValidatorRegistry; import org.apache.camel.spi.XMLRoutesDefinitionLoader; import org.apache.camel.support.DefaultRegistry; import org.apache.camel.support.DefaultUuidGenerator; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Represents the context used to configure routes and the policies to use. */ public class SimpleCamelContext extends AbstractCamelContext { private static final Logger LOG = LoggerFactory.getLogger(SimpleCamelContext.class); /** * Creates the {@link CamelContext} using {@link DefaultRegistry} as registry. * <p/> * Use one of the other constructors to force use an explicit registry. */ public SimpleCamelContext() { this(true); } /** * Creates the {@link CamelContext} and allows to control whether the context should automatic initialize or not. * <p/> * This is used by some Camel components such as camel-cdi and camel-blueprint, however this constructor is not * intended for regular Camel end users. * * @param init whether to automatic initialize. */ public SimpleCamelContext(boolean init) { super(init); } @Override public void disposeModel() { // noop } @Override protected HealthCheckRegistry createHealthCheckRegistry() { BaseServiceResolver<HealthCheckRegistry> resolver = new BaseServiceResolver<>( HealthCheckRegistry.FACTORY, HealthCheckRegistry.class, getBootstrapFactoryFinder()); Optional<HealthCheckRegistry> result = resolver.resolve(getCamelContextReference()); return result.orElse(null); } @Override protected TypeConverter createTypeConverter() { return new DefaultTypeConverter( getCamelContextReference(), getPackageScanClassResolver(), getInjector(), isLoadTypeConverters()); } @Override protected TypeConverterRegistry createTypeConverterRegistry() { TypeConverter typeConverter = getTypeConverter(); // type converter is also registry so create type converter if (typeConverter == null) { typeConverter = createTypeConverter(); } if (typeConverter instanceof TypeConverterRegistry) { return (TypeConverterRegistry) typeConverter; } return null; } @Override protected Injector createInjector() { FactoryFinder finder = getBootstrapFactoryFinder(); Optional<Injector> result = finder.newInstance("Injector", Injector.class); if (result.isPresent()) { return result.get(); } else { return new DefaultInjector(getCamelContextReference()); } } @Override protected PropertiesComponent createPropertiesComponent() { BaseServiceResolver<PropertiesComponent> resolver = new BaseServiceResolver<>( PropertiesComponent.FACTORY, PropertiesComponent.class, getBootstrapFactoryFinder()); Optional<PropertiesComponent> result = resolver.resolve(getCamelContextReference()); if (result.isPresent()) { return result.get(); } else { return new org.apache.camel.component.properties.PropertiesComponent(); } } @Override protected CamelBeanPostProcessor createBeanPostProcessor() { return new DefaultCamelBeanPostProcessor(getCamelContextReference()); } @Override protected ComponentResolver createComponentResolver() { return new DefaultComponentResolver(); } @Override protected ComponentNameResolver createComponentNameResolver() { return new DefaultComponentNameResolver(); } @Override protected Registry createRegistry() { return new DefaultRegistry(); } @Override protected UuidGenerator createUuidGenerator() { return new DefaultUuidGenerator(); } @Override protected ModelJAXBContextFactory createModelJAXBContextFactory() { BaseServiceResolver<ModelJAXBContextFactory> resolver = new BaseServiceResolver<>( ModelJAXBContextFactory.FACTORY, ModelJAXBContextFactory.class, getBootstrapFactoryFinder()); Optional<ModelJAXBContextFactory> result = resolver.resolve(getCamelContextReference()); if (result.isPresent()) { return result.get(); } else { throw new IllegalArgumentException( "Cannot find ModelJAXBContextFactory on classpath. Add camel-xml-jaxb to classpath."); } } @Override protected NodeIdFactory createNodeIdFactory() { return new DefaultNodeIdFactory(); } @Override protected FactoryFinderResolver createFactoryFinderResolver() { return new DefaultFactoryFinderResolver(); } @Override protected ClassResolver createClassResolver() { return new DefaultClassResolver(getCamelContextReference()); } @Override protected ProcessorFactory createProcessorFactory() { BaseServiceResolver<ProcessorFactory> resolver = new BaseServiceResolver<>(ProcessorFactory.FACTORY, ProcessorFactory.class, getBootstrapFactoryFinder()); Optional<ProcessorFactory> result = resolver.resolve(getCamelContextReference()); if (result.isPresent()) { return result.get(); } else { throw new IllegalArgumentException( "Cannot find ProcessorFactory on classpath. Add camel-core-processor to classpath."); } } @Override protected InternalProcessorFactory createInternalProcessorFactory() { BaseServiceResolver<InternalProcessorFactory> resolver = new BaseServiceResolver<>( InternalProcessorFactory.FACTORY, InternalProcessorFactory.class, getBootstrapFactoryFinder()); Optional<InternalProcessorFactory> result = resolver.resolve(getCamelContextReference()); if (result.isPresent()) { return result.get(); } else { throw new IllegalArgumentException( "Cannot find InternalProcessorFactory on classpath. Add camel-core-processor to classpath."); } } @Override protected InterceptEndpointFactory createInterceptEndpointFactory() { return new DefaultInterceptEndpointFactory(); } @Override protected RouteFactory createRouteFactory() { return new DefaultRouteFactory(); } @Override protected DataFormatResolver createDataFormatResolver() { return new DefaultDataFormatResolver(); } @Override protected MessageHistoryFactory createMessageHistoryFactory() { return new DefaultMessageHistoryFactory(); } @Override protected InflightRepository createInflightRepository() { return new DefaultInflightRepository(); } @Override protected AsyncProcessorAwaitManager createAsyncProcessorAwaitManager() { return new DefaultAsyncProcessorAwaitManager(); } @Override protected RouteController createRouteController() { return new DefaultRouteController(getCamelContextReference()); } @Override protected ShutdownStrategy createShutdownStrategy() { return new DefaultShutdownStrategy(getCamelContextReference()); } @Override protected PackageScanClassResolver createPackageScanClassResolver() { PackageScanClassResolver packageScanClassResolver; // use WebSphere specific resolver if running on WebSphere if (WebSpherePackageScanClassResolver.isWebSphereClassLoader(this.getClass().getClassLoader())) { LOG.info("Using WebSphere specific PackageScanClassResolver"); packageScanClassResolver = new WebSpherePackageScanClassResolver("META-INF/services/org/apache/camel/TypeConverter"); } else { packageScanClassResolver = new DefaultPackageScanClassResolver(); } return packageScanClassResolver; } @Override protected PackageScanResourceResolver createPackageScanResourceResolver() { return new DefaultPackageScanResourceResolver(); } @Override protected UnitOfWorkFactory createUnitOfWorkFactory() { return new DefaultUnitOfWorkFactory(); } @Override protected RuntimeCamelCatalog createRuntimeCamelCatalog() { BaseServiceResolver<RuntimeCamelCatalog> resolver = new BaseServiceResolver<>( RuntimeCamelCatalog.FACTORY, RuntimeCamelCatalog.class, getBootstrapFactoryFinder()); Optional<RuntimeCamelCatalog> result = resolver.resolve(getCamelContextReference()); if (result.isPresent()) { return result.get(); } else { throw new IllegalArgumentException( "Cannot find RuntimeCamelCatalog on classpath. Add camel-core-catalog to classpath."); } } @Override protected CamelContextNameStrategy createCamelContextNameStrategy() { return new DefaultCamelContextNameStrategy(); } @Override protected ManagementNameStrategy createManagementNameStrategy() { return new DefaultManagementNameStrategy(getCamelContextReference()); } @Override protected HeadersMapFactory createHeadersMapFactory() { BaseServiceResolver<HeadersMapFactory> resolver = new BaseServiceResolver<>(HeadersMapFactory.FACTORY, HeadersMapFactory.class, getBootstrapFactoryFinder()); Optional<HeadersMapFactory> result = resolver.resolve(getCamelContextReference()); if (result.isPresent()) { return result.get(); } else { return new DefaultHeadersMapFactory(); } } @Override protected BeanProxyFactory createBeanProxyFactory() { BaseServiceResolver<BeanProxyFactory> resolver = new BaseServiceResolver<>(BeanProxyFactory.FACTORY, BeanProxyFactory.class, getBootstrapFactoryFinder()); Optional<BeanProxyFactory> result = resolver.resolve(getCamelContextReference()); if (result.isPresent()) { return result.get(); } else { throw new IllegalArgumentException("Cannot find BeanProxyFactory on classpath. Add camel-bean to classpath."); } } @Override protected AnnotationBasedProcessorFactory createAnnotationBasedProcessorFactory() { BaseServiceResolver<AnnotationBasedProcessorFactory> resolver = new BaseServiceResolver<>( AnnotationBasedProcessorFactory.FACTORY, AnnotationBasedProcessorFactory.class, getBootstrapFactoryFinder()); Optional<AnnotationBasedProcessorFactory> result = resolver.resolve(getCamelContextReference()); if (result.isPresent()) { return result.get(); } else { throw new IllegalArgumentException( "Cannot find AnnotationBasedProcessorFactory on classpath. Add camel-core-processor to classpath."); } } @Override protected DeferServiceFactory createDeferServiceFactory() { BaseServiceResolver<DeferServiceFactory> resolver = new BaseServiceResolver<>( DeferServiceFactory.FACTORY, DeferServiceFactory.class, getBootstrapFactoryFinder()); Optional<DeferServiceFactory> result = resolver.resolve(getCamelContextReference()); if (result.isPresent()) { return result.get(); } else { throw new IllegalArgumentException( "Cannot find DeferServiceFactory on classpath. Add camel-core-processor to classpath."); } } @Override protected BeanProcessorFactory createBeanProcessorFactory() { BaseServiceResolver<BeanProcessorFactory> resolver = new BaseServiceResolver<>( BeanProcessorFactory.FACTORY, BeanProcessorFactory.class, getBootstrapFactoryFinder()); Optional<BeanProcessorFactory> result = resolver.resolve(getCamelContextReference()); if (result.isPresent()) { return result.get(); } else { throw new IllegalArgumentException("Cannot find BeanProcessorFactory on classpath. Add camel-bean to classpath."); } } @Override protected BeanIntrospection createBeanIntrospection() { return new DefaultBeanIntrospection(); } @Override protected XMLRoutesDefinitionLoader createXMLRoutesDefinitionLoader() { BaseServiceResolver<XMLRoutesDefinitionLoader> resolver = new BaseServiceResolver<>( XMLRoutesDefinitionLoader.FACTORY, XMLRoutesDefinitionLoader.class, getBootstrapFactoryFinder()); Optional<XMLRoutesDefinitionLoader> result = resolver.resolve(getCamelContextReference()); if (result.isPresent()) { return result.get(); } else { throw new IllegalArgumentException( "Cannot find ModelJAXBContextFactory on classpath. Add either camel-xml-io or camel-xml-jaxb to classpath."); } } @Override protected ModelToXMLDumper createModelToXMLDumper() { BaseServiceResolver<ModelToXMLDumper> resolver = new BaseServiceResolver<>(ModelToXMLDumper.FACTORY, ModelToXMLDumper.class, getBootstrapFactoryFinder()); Optional<ModelToXMLDumper> result = resolver.resolve(getCamelContextReference()); if (result.isPresent()) { return result.get(); } else { throw new IllegalArgumentException("Cannot find ModelToXMLDumper on classpath. Add camel-xml-jaxb to classpath."); } } @Override protected RestBindingJaxbDataFormatFactory createRestBindingJaxbDataFormatFactory() { BaseServiceResolver<RestBindingJaxbDataFormatFactory> resolver = new BaseServiceResolver<>( RestBindingJaxbDataFormatFactory.FACTORY, RestBindingJaxbDataFormatFactory.class, getBootstrapFactoryFinder()); Optional<RestBindingJaxbDataFormatFactory> result = resolver.resolve(getCamelContextReference()); if (result.isPresent()) { return result.get(); } else { throw new IllegalArgumentException( "Cannot find RestBindingJaxbDataFormatFactory on classpath. Add camel-jaxb to classpath."); } } @Override protected Tracer createTracer() { Tracer tracer = null; if (getRegistry() != null) { // lookup in registry Map<String, Tracer> map = getRegistry().findByTypeWithName(Tracer.class); if (map.size() == 1) { tracer = map.values().iterator().next(); } } if (tracer == null) { tracer = getExtension(Tracer.class); } if (tracer == null) { tracer = new DefaultTracer(); setExtension(Tracer.class, tracer); } return tracer; } @Override protected LanguageResolver createLanguageResolver() { return new DefaultLanguageResolver(); } @Override protected ConfigurerResolver createConfigurerResolver() { return new DefaultConfigurerResolver(); } @Override protected UriFactoryResolver createUriFactoryResolver() { return new DefaultUriFactoryResolver(); } @Override protected RestRegistryFactory createRestRegistryFactory() { BaseServiceResolver<RestRegistryFactory> resolver = new BaseServiceResolver<>( RestRegistryFactory.FACTORY, RestRegistryFactory.class, getBootstrapFactoryFinder()); Optional<RestRegistryFactory> result = resolver.resolve(getCamelContextReference()); if (result.isPresent()) { return result.get(); } else { throw new IllegalArgumentException("Cannot find RestRegistryFactory on classpath. Add camel-rest to classpath."); } } @Override protected EndpointRegistry<EndpointKey> createEndpointRegistry(Map<EndpointKey, Endpoint> endpoints) { return new DefaultEndpointRegistry(getCamelContextReference(), endpoints); } @Override protected StreamCachingStrategy createStreamCachingStrategy() { return new DefaultStreamCachingStrategy(); } @Override protected ReactiveExecutor createReactiveExecutor() { BaseServiceResolver<ReactiveExecutor> resolver = new BaseServiceResolver<>(ReactiveExecutor.FACTORY, ReactiveExecutor.class, getBootstrapFactoryFinder()); Optional<ReactiveExecutor> result = resolver.resolve(getCamelContextReference()); if (result.isPresent()) { return result.get(); } else { return new DefaultReactiveExecutor(); } } @Override protected ValidatorRegistry<ValidatorKey> createValidatorRegistry() { return new DefaultValidatorRegistry(getCamelContextReference()); } @Override protected TransformerRegistry<TransformerKey> createTransformerRegistry() { return new DefaultTransformerRegistry(getCamelContextReference()); } @Override protected ExecutorServiceManager createExecutorServiceManager() { return new BaseExecutorServiceManager(getCamelContextReference()); } @Override public Processor createErrorHandler(Route route, Processor processor) throws Exception { throw new UnsupportedOperationException(); } @Override public String addRouteFromTemplate(String routeId, String routeTemplateId, Map<String, Object> parameters) throws Exception { throw new UnsupportedOperationException(); } }
gnodet/camel
core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/SimpleCamelContext.java
Java
apache-2.0
21,088
package com.example.component_dependency; import arez.annotations.ArezComponent; import arez.annotations.ComponentDependency; import arez.annotations.Observable; import arez.component.DisposeNotifier; @ArezComponent abstract class ComplexDependencyModel { @ComponentDependency DisposeNotifier getValue1() { return null; } @ComponentDependency( action = ComponentDependency.Action.SET_NULL ) DisposeNotifier getValue3() { return null; } @Observable void setValue3( DisposeNotifier value ) { } }
realityforge/arez
processor/src/test/fixtures/input/com/example/component_dependency/ComplexDependencyModel.java
Java
apache-2.0
530
/* * Copyright (c) 2017 Microchip Technology Inc. and its subsidiaries (Microchip). 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. */ package com.microchip.mplab.nbide.embedded.arduino.wizard; import com.microchip.crownking.mplabinfo.DeviceSupport; import com.microchip.mplab.nbide.embedded.api.LanguageToolchain; import com.microchip.mplab.nbide.embedded.api.LanguageToolchainManager; import com.microchip.mplab.nbide.embedded.arduino.importer.ArduinoBuilderRunner; import com.microchip.mplab.nbide.embedded.arduino.importer.ArduinoConfig; import com.microchip.mplab.nbide.embedded.arduino.importer.BootloaderPathProvider; import com.microchip.mplab.nbide.embedded.arduino.importer.ProjectImporter; import com.microchip.mplab.nbide.embedded.arduino.importer.GCCToolFinder; import com.microchip.mplab.nbide.embedded.arduino.utils.DeletingFileVisitor; import static com.microchip.mplab.nbide.embedded.arduino.wizard.ImportWizardProperty.*; import static com.microchip.mplab.nbide.embedded.makeproject.api.wizards.WizardProperty.*; import com.microchip.mplab.nbide.embedded.makeproject.MakeProject; import com.microchip.mplab.nbide.embedded.makeproject.api.configurations.Folder; import com.microchip.mplab.nbide.embedded.makeproject.api.configurations.Item; import com.microchip.mplab.nbide.embedded.makeproject.api.configurations.LoadableItem; import com.microchip.mplab.nbide.embedded.makeproject.api.configurations.MakeConfiguration; import com.microchip.mplab.nbide.embedded.makeproject.api.configurations.MakeConfigurationBook; import com.microchip.mplab.nbide.embedded.makeproject.api.configurations.StringConfiguration; import com.microchip.mplab.nbide.embedded.makeproject.api.remote.FilePathAdaptor; import com.microchip.mplab.nbide.embedded.makeproject.api.support.MakeProjectGenerator; import com.microchip.mplab.nbide.embedded.makeproject.api.wizards.WizardProperty; import com.microchip.mplab.nbide.embedded.makeproject.ui.utils.PathPanel; import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.HashSet; import java.util.Properties; import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.SwingWorker; import javax.swing.Timer; import org.netbeans.api.project.ProjectManager; import org.netbeans.api.project.ui.OpenProjects; import org.netbeans.modules.cnd.utils.CndPathUtilities; import org.openide.WizardDescriptor; import org.openide.filesystems.FileObject; import org.openide.filesystems.FileUtil; import org.openide.modules.InstalledFileLocator; import org.openide.util.Exceptions; import static com.microchip.mplab.nbide.embedded.arduino.importer.ProjectImporter.IMPORTED_PROPERTIES_FILENAME; import com.microchip.mplab.nbide.embedded.arduino.importer.Board; import com.microchip.mplab.nbide.embedded.arduino.importer.BoardConfiguration; import com.microchip.mplab.nbide.embedded.arduino.wizard.avr.AVRProjectConfigurationImporter; import com.microchip.mplab.nbide.embedded.arduino.wizard.pic32.PIC32ProjectConfigurationImporter; import java.util.Arrays; import java.util.List; public class ImportWorker extends SwingWorker<Set<FileObject>, String> { private static final Logger LOGGER = Logger.getLogger(ImportWorker.class.getName()); private static final String DEFAULT_CONF_NAME = "default"; private static final String DEBUG_CONF_NAME = "debug"; private Exception exception; private final WizardDescriptor wizardDescriptor; private volatile boolean multiConfigBoard; public ImportWorker(WizardDescriptor wizardDescriptor) { this.wizardDescriptor = wizardDescriptor; } @Override public Set<FileObject> doInBackground() { try { return invokeImporterTasks(); } catch (Exception ex) { this.exception = ex; LOGGER.log( Level.SEVERE, "Failed to import project", ex ); final File projectDir = (File) wizardDescriptor.getProperty(WizardProperty.PROJECT_DIR.key()); // Delete the project directory after a short delay so that the import process releases all project files. Timer t = new Timer(2000, (a) -> { try { deleteExistingProject(projectDir); } catch (IOException ex1) { LOGGER.log( Level.SEVERE, "Failed to delete an incompletely imported project", ex1 ); } }); t.setRepeats(false); t.start(); return new HashSet<>(); } } public boolean isMultiConfigBoard() { return multiConfigBoard; } public boolean hasFailed() { return exception != null; } public Exception getException() { return exception; } //********************************************** //************** PRIVATE METHODS *************** //********************************************** private Set<FileObject> invokeImporterTasks() throws IOException { Set<FileObject> resultSet = new HashSet<>(); Boolean overwriteExistingProject = (Boolean) wizardDescriptor.getProperty(WizardProperty.OVERWRITE_EXISTING_PROJECT.key()); if (overwriteExistingProject == null) { overwriteExistingProject = false; } if (overwriteExistingProject) { File projectDir = (File) wizardDescriptor.getProperty(WizardProperty.PROJECT_DIR.key()); deleteExistingProject(projectDir); } long t0 = System.currentTimeMillis(); try { resultSet.addAll( createProject() ); } catch (InterruptedException ex) { Exceptions.printStackTrace(ex); } finally { LOGGER.log(Level.INFO, "Elapsed time of import operation: {0} ms", System.currentTimeMillis()-t0); } return resultSet; } private void deleteExistingProject(File projectDir) throws IOException { if (projectDir != null) { projectDir = FileUtil.normalizeFile(projectDir); FileObject dirFO = FileUtil.toFileObject(projectDir); MakeProject proj = null; if (dirFO != null) { proj = (MakeProject) ProjectManager.getDefault().findProject(dirFO); } if (proj != null) { if (OpenProjects.getDefault().isProjectOpen(proj)) { OpenProjects.getDefault().close(new MakeProject[]{proj}); } Files.walkFileTree(proj.getProjectDirectoryFile().toPath(), new DeletingFileVisitor()); } } } private Set<FileObject> createProject() throws IOException, InterruptedException { Set<FileObject> projectRootDirectories = new HashSet<>(1); File projectDirectory = initProjectDirectoryFromWizard(projectRootDirectories); Board board = (Board) wizardDescriptor.getProperty(BOARD.key()); MakeConfiguration[] confs; MakeConfiguration defaultConf = createDefaultMakefileConfiguration(projectDirectory); if ( ProjectImporter.CUSTOM_LD_SCRIPT_BOARD_IDS.contains(board.getBoardId()) ) { MakeConfiguration debugConf = createDebugMakefileConfiguration(projectDirectory); confs = new MakeConfiguration[]{defaultConf, debugConf}; } else { confs = new MakeConfiguration[]{defaultConf}; } String projectName = (String) wizardDescriptor.getProperty(WizardProperty.PROJECT_NAME.key()); String makefileName = (String) wizardDescriptor.getProperty(WizardProperty.MAKE_FILENAME.key()); String hostDir = projectDirectory.getAbsolutePath(); MakeProject newProject = MakeProjectGenerator.createProject(projectDirectory, hostDir, projectName, makefileName, confs, null, null, null, true, null); importArduinoProjectFiles(newProject); setupProjectEncoding(newProject); newProject.save(); return projectRootDirectories; } private File initProjectDirectoryFromWizard(Set<FileObject> projectRootDirectories) { File projectDirectory = (File) wizardDescriptor.getProperty(WizardProperty.PROJECT_DIR.key()); if (projectDirectory != null) { projectDirectory = FileUtil.normalizeFile(projectDirectory); projectDirectory.mkdirs(); FileObject dir = FileUtil.toFileObject(projectDirectory); projectRootDirectories.add(dir); } return projectDirectory; } private MakeConfiguration createDefaultMakefileConfiguration(File projectDirectory) { MakeConfiguration conf = new MakeConfiguration(projectDirectory.getPath(), DEFAULT_CONF_NAME, MakeConfiguration.TYPE_APPLICATION); setupMakefileConfiguration(conf); return conf; } private MakeConfiguration createDebugMakefileConfiguration(File projectDirectory) { MakeConfiguration conf = new MakeConfiguration(projectDirectory.getPath(), DEBUG_CONF_NAME, MakeConfiguration.TYPE_APPLICATION); setupMakefileConfiguration(conf); return conf; } private MakeConfiguration setupMakefileConfiguration(MakeConfiguration conf) { // Device and Header conf.getDevice().setValue((String) wizardDescriptor.getProperty(WizardProperty.DEVICE.key())); conf.getHeader().setValue((String) wizardDescriptor.getProperty(WizardProperty.HEADER.key())); // Platform if (wizardDescriptor.getProperty(WizardProperty.PLUGINBOARD.key()) instanceof DeviceSupport.PluginBoard) { conf.getPluginBoard().setValue(((DeviceSupport.PluginBoard) wizardDescriptor.getProperty(WizardProperty.PLUGINBOARD.key())).getName()); } else { conf.getPluginBoard().setValue((String) wizardDescriptor.getProperty(WizardProperty.PLUGINBOARD.key())); } conf.getPlatformTool().setValue((String) wizardDescriptor.getProperty(WizardProperty.PLATFORM_TOOL_META_ID.key())); conf.getPlatformToolSN().setValue((String) wizardDescriptor.getProperty(WizardProperty.PLATFORM_TOOL_SERIAL.key())); // Toolchain String languageToolchainID = (String) wizardDescriptor.getProperty( LANGUAGE_TOOL_META_ID.key() ); LanguageToolchain languageToolchain = LanguageToolchainManager.getDefault().getToolchainWithMetaID( languageToolchainID ); conf.getLanguageToolchain().setMetaID(new StringConfiguration(null, languageToolchain.getMeta().getID())); conf.getLanguageToolchain().setDir(new StringConfiguration(null, languageToolchain.getDirectory())); conf.getLanguageToolchain().setVersion(new StringConfiguration(null, languageToolchain.getVersion())); return conf; } // TODO: Refactor this method. It is too long and contains too much business logic. private void importArduinoProjectFiles(MakeProject newProject) throws IOException, InterruptedException { MakeConfigurationBook newProjectDescriptor = MakeConfigurationBook.getMakeConfigurationDescriptor(newProject); boolean copyFiles = (boolean) wizardDescriptor.getProperty(COPY_CORE_FILES.key()); File targetProjectDir = (File) wizardDescriptor.getProperty(PROJECT_DIR.key()); File sourceProjectDir = (File) wizardDescriptor.getProperty(SOURCE_PROJECT_DIR.key()); BoardConfiguration boardConfiguration = (BoardConfiguration) wizardDescriptor.getProperty(BOARD_CONFIGURATION.key()); File arduinoInstallDir = (File) wizardDescriptor.getProperty(ARDUINO_DIR.key()); GCCToolFinder toolFinder = new GCCToolFinder(newProject.getActiveConfiguration().getLanguageToolchain().findToolchain()); ArduinoConfig arduinoPathResolver = ArduinoConfig.getInstance(); ArduinoBuilderRunner arduinoBuilderRunner = new ArduinoBuilderRunner( toolFinder, arduinoPathResolver, arduinoInstallDir.toPath(), (m) -> LOGGER.info(m) ); BootloaderPathProvider bootloaderPathProvider = new BootloaderPathProvider( (filename) -> { File hexFile = InstalledFileLocator.getDefault().locate("bootloaders/" + filename, "com.microchip.mplab.nbide.embedded.arduino", false); return hexFile.toPath(); }); File customLinkerScriptsDir = InstalledFileLocator.getDefault().locate("linker_scripts", "com.microchip.mplab.nbide.embedded.arduino", false); Path customLdScriptsDirectoryPath = customLinkerScriptsDir.toPath(); ProjectImporter importer = new ProjectImporter(); importer.setCopyingFiles(copyFiles); importer.setBoardConfiguration(boardConfiguration); importer.setSourceProjectDirectoryPath(sourceProjectDir.toPath()); importer.setTargetProjectDirectoryPath(targetProjectDir.toPath()); importer.setArduinoBuilderRunner(arduinoBuilderRunner); importer.setBootloaderPathProvider(bootloaderPathProvider); importer.setCustomLdScriptsPath(customLdScriptsDirectoryPath); importer.execute(); // This will be used to display either the short "how-to" guide or the longer one: multiConfigBoard = importer.isCustomLdScriptBoard(); // Create Imported Core Logical Folder Folder importedCoreFolder = newProjectDescriptor.getLogicalFolders().addNewFolder(ProjectImporter.CORE_DIRECTORY_NAME, "Imported Core", false, Folder.Kind.SOURCE_LOGICAL_FOLDER ); importer.getCoreFilePaths().forEach( p -> { if (copyFiles) { addFileToFolder(importedCoreFolder, p, importer.getTargetCoreDirectoryPath()); } else { addFileToFolder(importedCoreFolder, p, boardConfiguration.getCoreDirectoryPath(), boardConfiguration.getVariantPath()); } } ); // Create Imported Libraries Logical Folder Folder importedLibrariesFolder = newProjectDescriptor.getLogicalFolders().addNewFolder(ProjectImporter.LIBRARIES_DIRECTORY_NAME, "Imported Libraries", true, Folder.Kind.SOURCE_LOGICAL_FOLDER ); if (copyFiles) { importer.getMainLibraryFilePaths().forEach(p -> addFileToFolder(importedLibrariesFolder, p, importer.getTargetLibraryDirectoryPath())); } else { Set<Path> libraryRootPaths = new HashSet<>(); importer.getMainLibraryDirPaths().forEach(p -> libraryRootPaths.add(p.getParent())); importer.getMainLibraryFilePaths().forEach(p -> addFileToFolder(importedLibrariesFolder, p, libraryRootPaths.toArray(new Path[libraryRootPaths.size()]))); } // Add source files Folder sourceFolder = newProjectDescriptor.getLogicalFolders().addNewFolder(ProjectImporter.SOURCE_FILES_DIRECTORY_NAME, "Source", true, Folder.Kind.SOURCE_LOGICAL_FOLDER ); if (copyFiles) { importer.getSourceFilePaths().forEach((p) -> { addFileToFolder(sourceFolder, p, importer.getTargetSourceFilesDirectoryPath()); }); } newProjectDescriptor.addSourceRoot(copyFiles ? ProjectImporter.SOURCE_FILES_DIRECTORY_NAME : importer.getSourceProjectDirectoryPath().toString()); if (!copyFiles) { Folder sketchSourceFolder = newProjectDescriptor.getLogicalFolders().addNewFolder( "sketchSource", "Sketch Source", false, Folder.Kind.IMPORTANT_FILES_FOLDER ); importer.getSourceFilePaths().forEach((p) -> { if (p.toString().endsWith(".ino")) { addFileToFolder(sketchSourceFolder, p); } }); Folder generatedFolder = sourceFolder.addNewFolder( "generated", "generated", true, Folder.Kind.SOURCE_LOGICAL_FOLDER ); importer.getPreprocessedSourceFilePaths().forEach((p) -> { addFileToFolder(generatedFolder, p, importer.getPreprocessedSketchDirectoryPath()); }); final String arduinoBuilderCommand = importer.getPreprocessingCommand() + " > preprocess.log"; // Redirecting Arduino Builder output to a log file newProjectDescriptor.getConfs().getConfigurtions().forEach( c -> { MakeConfiguration mc = (MakeConfiguration) c; mc.getMakeCustomizationConfiguration().setPreBuildStep( arduinoBuilderCommand ); mc.getMakeCustomizationConfiguration().setApplyPreBuildStep(true); }); } // Add bootloader .hex file: if ( importer.hasBootloaderPath() ) { String loadableItemPath = importer.getProductionBootloaderPath().toString(); if (PathPanel.getMode() == PathPanel.REL_OR_ABS) { loadableItemPath = CndPathUtilities.toAbsoluteOrRelativePath( newProjectDescriptor.getBaseDirFileObject(), loadableItemPath ); } else if (PathPanel.getMode() == PathPanel.REL) { loadableItemPath = CndPathUtilities.toRelativePath( newProjectDescriptor.getBaseDirFileObject(), loadableItemPath ); } loadableItemPath = FilePathAdaptor.normalize(loadableItemPath); LoadableItem newLoadableItem = new LoadableItem.FileItem( loadableItemPath ); newProjectDescriptor.addLoadableItem(newLoadableItem); } else if ( !importer.isCustomLdScriptBoard() ) { // If the board uses a custom .ld script, it is supposed not to use a bootloader LOGGER.log(Level.WARNING, "Could not find a bootloader file for device {0}", boardConfiguration.getBoardId()); } // Set auxiliary configuration options if ( boardConfiguration.getBoard().isAVR() ) { new AVRProjectConfigurationImporter(importer, copyFiles, newProjectDescriptor, targetProjectDir).run(); } else if ( boardConfiguration.getBoard().isPIC32() ) { new PIC32ProjectConfigurationImporter(importer, copyFiles, newProjectDescriptor, targetProjectDir).run(); } else { throw new IllegalStateException("There's no support for " + boardConfiguration.getBoard().getArchitecture() + " devices!"); } // Create imported project properties file: Properties importedProjectProperties = new Properties(); // importedProjectProperties.setProperty("platform-path", importer.getBoardConfigNavigator().getPlatformRootPath().toString()); //importedProjectProperties.setProperty("programmer-path", importer.getBoardConfigNavigator().getProgrammerPath().toString()); Path propsFilePath = Paths.get(newProjectDescriptor.getProjectDir(), "nbproject", IMPORTED_PROPERTIES_FILENAME ); Files.createFile( propsFilePath ); PrintWriter printWriter = new PrintWriter( propsFilePath.toFile() ); importedProjectProperties.store( printWriter, null ); } private void addFileToFolder(Folder folder, Path filePath, Path... rootPaths) { addFileToFolder( folder, filePath, Arrays.asList(rootPaths) ); } private void addFileToFolder(Folder folder, Path filePath, List<Path> rootPaths) { if ( filePath == null ) return; FileObject fileObject = FileUtil.toFileObject(filePath.toFile()); Path projectRootPath = Paths.get( folder.getConfigurationDescriptor().getBaseDir() ); if (rootPaths != null && rootPaths.size() > 0) { for (Path rootPath : rootPaths) { if (!filePath.startsWith(rootPath)) { continue; } // Create subdirectories if necessary: Path relativePath = rootPath.relativize(filePath); if (relativePath.getNameCount() > 1) { for (int i = 0; i < relativePath.getNameCount() - 1; i++) { String subfolderName = relativePath.getName(i).toString(); boolean subfolderAlreadyExists = false; for (Folder f : folder.getFoldersAsArray()) { if (f.getDisplayName().equals(subfolderName)) { folder = f; subfolderAlreadyExists = true; break; } } if (!subfolderAlreadyExists) { folder = folder.addNewFolder(subfolderName, subfolderName, true, Folder.Kind.SOURCE_LOGICAL_FOLDER); } } break; } } if ( filePath.startsWith(projectRootPath) ) { String relativePath = FileUtil.getRelativePath( FileUtil.toFileObject(projectRootPath.toFile()), fileObject ); folder.addItem( new Item(fileObject, relativePath) ); } else { folder.addItem( new Item(fileObject, filePath.toString()) ); } } else { folder.addItem( new Item(fileObject, filePath.toString()) ); } } private void setupProjectEncoding(MakeProject newProject) { Object encoding = wizardDescriptor.getProperty(WizardProperty.PROJECT_ENCODING.key()); if (encoding != null && encoding instanceof Charset) { newProject.setSourceEncoding(((Charset) encoding).name()); } } }
chipKIT32/chipKIT-importer-2.0
src/com/microchip/mplab/nbide/embedded/arduino/wizard/ImportWorker.java
Java
apache-2.0
22,331
--- layout: base title: 'Statistics of Person[psor] in UD_Turkish' udver: '2' --- ## Treebank Statistics: UD_Turkish: Features: `Person[psor]` This feature is language-specific. It occurs with 3 different values: `1`, `2`, `3`. This is a <a href="../../u/overview/feat-layers.html">layered feature</a> with the following layers: <tt><a href="tr-feat-Person.html">Person</a></tt>, <tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt>. 8083 tokens (14%) have a non-empty value of `Person[psor]`. 4944 types (29%) occur at least once with a non-empty value of `Person[psor]`. 1932 lemmas (33%) occur at least once with a non-empty value of `Person[psor]`. The feature is used with 7 part-of-speech tags: <tt><a href="tr-pos-NOUN.html">NOUN</a></tt> (4997; 9% instances), <tt><a href="tr-pos-VERB.html">VERB</a></tt> (1703; 3% instances), <tt><a href="tr-pos-ADJ.html">ADJ</a></tt> (930; 2% instances), <tt><a href="tr-pos-PRON.html">PRON</a></tt> (346; 1% instances), <tt><a href="tr-pos-NUM.html">NUM</a></tt> (70; 0% instances), <tt><a href="tr-pos-ADP.html">ADP</a></tt> (22; 0% instances), <tt><a href="tr-pos-PROPN.html">PROPN</a></tt> (15; 0% instances). ### `NOUN` 4997 <tt><a href="tr-pos-NOUN.html">NOUN</a></tt> tokens (32% of all `NOUN` tokens) have a non-empty value of `Person[psor]`. The most frequent other feature values with which `NOUN` and `Person[psor]` co-occurred: <tt><a href="tr-feat-Person.html">Person</a></tt><tt>=3</tt> (4996; 100%), <tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt> (4469; 89%), <tt><a href="tr-feat-Number.html">Number</a></tt><tt>=Sing</tt> (4072; 81%). `NOUN` tokens may have the following values of `Person[psor]`: <table> <tr><th>Paradigm <i>yer</i></th><th><tt>1</tt></th><th><tt>2</tt></th><th><tt>3</tt></th></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Abl</tt>|<tt><a href="tr-feat-Number.html">Number</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=1</tt></tt></td><td><em>yerimden</em></td><td></td><td></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Abl</tt>|<tt><a href="tr-feat-Number.html">Number</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt></tt></td><td></td><td></td><td><em>yerinden</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Abl</tt>|<tt><a href="tr-feat-Number.html">Number</a></tt><tt>=Plur</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt></tt></td><td></td><td></td><td><em>yerlerinden</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Abl</tt>|<tt><a href="tr-feat-Number.html">Number</a></tt><tt>=Plur</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Plur</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=1</tt></tt></td><td><em>yerlerimizden</em></td><td></td><td></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Abl</tt>|<tt><a href="tr-feat-Number.html">Number</a></tt><tt>=Plur</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Plur</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt></tt></td><td></td><td></td><td><em>yerlerinden</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Acc</tt>|<tt><a href="tr-feat-Number.html">Number</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt></tt></td><td></td><td></td><td><em>yerini</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Acc</tt>|<tt><a href="tr-feat-Number.html">Number</a></tt><tt>=Plur</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Plur</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt></tt></td><td></td><td></td><td><em>yerlerini</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Dat</tt>|<tt><a href="tr-feat-Number.html">Number</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=1</tt></tt></td><td><em>Yerime</em></td><td></td><td></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Dat</tt>|<tt><a href="tr-feat-Number.html">Number</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=2</tt></tt></td><td></td><td><em>yerine</em></td><td></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Dat</tt>|<tt><a href="tr-feat-Number.html">Number</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt></tt></td><td></td><td></td><td><em>yerine</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Dat</tt>|<tt><a href="tr-feat-Number.html">Number</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Plur</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=1</tt></tt></td><td><em>yerimize</em></td><td></td><td></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Dat</tt>|<tt><a href="tr-feat-Number.html">Number</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Plur</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=2</tt></tt></td><td></td><td><em>yerinize</em></td><td></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Dat</tt>|<tt><a href="tr-feat-Number.html">Number</a></tt><tt>=Plur</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Plur</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt></tt></td><td></td><td></td><td><em>yerlerine</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Gen</tt>|<tt><a href="tr-feat-Number.html">Number</a></tt><tt>=Plur</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Plur</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt></tt></td><td></td><td></td><td><em>yerlerinin</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Loc</tt>|<tt><a href="tr-feat-Number.html">Number</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=1</tt></tt></td><td><em>yerimde</em></td><td></td><td></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Loc</tt>|<tt><a href="tr-feat-Number.html">Number</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt></tt></td><td></td><td></td><td><em>yerinde</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Loc</tt>|<tt><a href="tr-feat-Number.html">Number</a></tt><tt>=Plur</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Plur</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt></tt></td><td></td><td></td><td><em>yerlerinde</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Nom</tt>|<tt><a href="tr-feat-Number.html">Number</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=2</tt></tt></td><td></td><td><em>yerin</em></td><td></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Nom</tt>|<tt><a href="tr-feat-Number.html">Number</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt></tt></td><td></td><td></td><td><em>yeri</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Nom</tt>|<tt><a href="tr-feat-Number.html">Number</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Plur</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=1</tt></tt></td><td><em>yerimiz</em></td><td></td><td></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Nom</tt>|<tt><a href="tr-feat-Number.html">Number</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Plur</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt></tt></td><td></td><td></td><td><em>yerleri</em></td></tr> </table> ### `VERB` 1703 <tt><a href="tr-pos-VERB.html">VERB</a></tt> tokens (15% of all `VERB` tokens) have a non-empty value of `Person[psor]`. The most frequent other feature values with which `VERB` and `Person[psor]` co-occurred: <tt><a href="tr-feat-Number.html">Number</a></tt><tt>=EMPTY</tt> (1703; 100%), <tt><a href="tr-feat-Person.html">Person</a></tt><tt>=EMPTY</tt> (1703; 100%), <tt><a href="tr-feat-Polite.html">Polite</a></tt><tt>=EMPTY</tt> (1703; 100%), <tt><a href="tr-feat-Aspect.html">Aspect</a></tt><tt>=Perf</tt> (1701; 100%), <tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Ind</tt> (1620; 95%), <tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Pos</tt> (1538; 90%), <tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt> (1443; 85%), <tt><a href="tr-feat-Voice.html">Voice</a></tt><tt>=EMPTY</tt> (1393; 82%), <tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Part</tt> (1236; 73%), <tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Past</tt> (1043; 61%). `VERB` tokens may have the following values of `Person[psor]`: <table> <tr><th>Paradigm <i>ol</i></th><th><tt>1</tt></th><th><tt>2</tt></th><th><tt>3</tt></th></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Abl</tt>|<tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Ind</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=1</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Pos</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Pres</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Vnoun</tt></tt></td><td><em>olmamdan</em></td><td></td><td></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Abl</tt>|<tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Ind</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=2</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Pos</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Past</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Part</tt></tt></td><td></td><td><em>olduğundan</em></td><td></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Abl</tt>|<tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Ind</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Neg</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Fut</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Part</tt></tt></td><td></td><td></td><td><em>olmayacağından</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Abl</tt>|<tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Ind</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Neg</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Past</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Part</tt></tt></td><td></td><td></td><td><em>olmadığından</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Abl</tt>|<tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Ind</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Pos</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Past</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Part</tt></tt></td><td></td><td></td><td><em>olduğundan</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Acc</tt>|<tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Ind</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=1</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Pos</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Past</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Part</tt></tt></td><td><em>olduğumu</em></td><td></td><td></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Acc</tt>|<tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Ind</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Neg</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Fut</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Part</tt></tt></td><td></td><td></td><td><em>olmayacağını</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Acc</tt>|<tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Ind</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Neg</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Past</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Part</tt></tt></td><td></td><td></td><td><em>olmadığını</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Acc</tt>|<tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Ind</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Pos</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Past</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Part</tt></tt></td><td></td><td></td><td><em>olduğunu</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Acc</tt>|<tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Ind</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Pos</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Past</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Part</tt>|<tt><a href="tr-feat-Voice.html">Voice</a></tt><tt>=Pass</tt></tt></td><td></td><td></td><td><em>olunduğunu</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Acc</tt>|<tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Ind</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Pos</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Pres</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Vnoun</tt></tt></td><td></td><td></td><td><em>olmasını</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Acc</tt>|<tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Ind</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Plur</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=1</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Neg</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Past</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Part</tt></tt></td><td><em>olmadığımızı</em></td><td></td><td></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Acc</tt>|<tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Ind</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Plur</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=1</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Pos</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Past</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Part</tt></tt></td><td><em>olduğumuzu</em></td><td></td><td></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Acc</tt>|<tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Ind</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Plur</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Neg</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Past</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Part</tt></tt></td><td></td><td></td><td><em>olmadıklarını</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Acc</tt>|<tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Ind</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Plur</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Pos</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Past</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Part</tt></tt></td><td></td><td></td><td><em>olduklarını</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Acc</tt>|<tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Pot</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Pos</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Fut</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Part</tt></tt></td><td></td><td></td><td><em>olabileceğini</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Dat</tt>|<tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Ind</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Pos</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Past</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Part</tt></tt></td><td></td><td></td><td><em>olduğuna</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Dat</tt>|<tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Ind</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Pos</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Pres</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Vnoun</tt></tt></td><td></td><td></td><td><em>olmasına</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Dat</tt>|<tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Pot</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Pos</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Fut</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Part</tt></tt></td><td></td><td></td><td><em>olabileceğine</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Gen</tt>|<tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Ind</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Neg</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Past</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Part</tt></tt></td><td></td><td></td><td><em>olmadığının</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Gen</tt>|<tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Ind</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Pos</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Past</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Part</tt></tt></td><td></td><td></td><td><em>olduğunun</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Gen</tt>|<tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Ind</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Pos</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Pres</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Vnoun</tt></tt></td><td></td><td></td><td><em>olmasının</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Loc</tt>|<tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Ind</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Pos</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Past</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Part</tt></tt></td><td></td><td></td><td><em>olduğunda</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Loc</tt>|<tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Ind</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Pos</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Pres</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Vnoun</tt></tt></td><td></td><td></td><td><em>olmasında</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Nom</tt>|<tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Ind</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=1</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Pos</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Past</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Part</tt></tt></td><td><em>olduğum</em></td><td></td><td></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Nom</tt>|<tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Ind</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=1</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Pos</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Pres</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Vnoun</tt></tt></td><td><em>olmam</em></td><td></td><td></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Nom</tt>|<tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Ind</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Neg</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Past</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Part</tt></tt></td><td></td><td></td><td><em>olmadığı</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Nom</tt>|<tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Ind</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Neg</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Pres</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Vnoun</tt></tt></td><td></td><td></td><td><em>olmaması, olmayışı</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Nom</tt>|<tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Ind</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Pos</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Past</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Part</tt></tt></td><td></td><td></td><td><em>olduğu, oldukları</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Nom</tt>|<tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Ind</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Pos</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Pres</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Vnoun</tt></tt></td><td></td><td></td><td><em>olması</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Nom</tt>|<tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Ind</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Pos</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Pres</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Vnoun</tt>|<tt><a href="tr-feat-Voice.html">Voice</a></tt><tt>=Pass</tt></tt></td><td></td><td></td><td><em>olunması</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Nom</tt>|<tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Ind</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Plur</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Pos</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Past</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Part</tt></tt></td><td></td><td></td><td><em>oldukları</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Nom</tt>|<tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Ind</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Plur</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Pos</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Pres</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Vnoun</tt></tt></td><td></td><td></td><td><em>olmaları</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Nom</tt>|<tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Pot</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Pos</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Fut</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Part</tt></tt></td><td></td><td></td><td><em>olabileceği</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Nom</tt>|<tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Pot</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Pos</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Pres</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Vnoun</tt></tt></td><td></td><td></td><td><em>olabilmesi</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Ind</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=1</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Pos</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Past</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Part</tt></tt></td><td><em>olduğum</em></td><td></td><td></td></tr> <tr><td><tt><tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Ind</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Neg</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Fut</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Part</tt></tt></td><td></td><td></td><td><em>olmayacağı</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Ind</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Neg</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Past</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Part</tt></tt></td><td></td><td></td><td><em>olmadığı</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Ind</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Pos</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Fut</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Part</tt></tt></td><td></td><td></td><td><em>olacağı</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Ind</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Pos</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Past</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Part</tt></tt></td><td></td><td></td><td><em>olduğu</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Ind</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Plur</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=1</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Neg</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Past</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Part</tt></tt></td><td><em>olmadığımız</em></td><td></td><td></td></tr> <tr><td><tt><tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Ind</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Plur</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=1</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Pos</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Past</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Part</tt></tt></td><td><em>olduğumuz</em></td><td></td><td></td></tr> <tr><td><tt><tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Ind</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Plur</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Neg</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Past</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Part</tt></tt></td><td></td><td></td><td><em>olmadıkları</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Mood.html">Mood</a></tt><tt>=Ind</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Plur</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt>|<tt><a href="tr-feat-Polarity.html">Polarity</a></tt><tt>=Pos</tt>|<tt><a href="tr-feat-Tense.html">Tense</a></tt><tt>=Past</tt>|<tt><a href="tr-feat-VerbForm.html">VerbForm</a></tt><tt>=Part</tt></tt></td><td></td><td></td><td><em>oldukları</em></td></tr> </table> ### `ADJ` 930 <tt><a href="tr-pos-ADJ.html">ADJ</a></tt> tokens (16% of all `ADJ` tokens) have a non-empty value of `Person[psor]`. The most frequent other feature values with which `ADJ` and `Person[psor]` co-occurred: <tt><a href="tr-feat-Person.html">Person</a></tt><tt>=3</tt> (930; 100%), <tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt> (862; 93%), <tt><a href="tr-feat-Number.html">Number</a></tt><tt>=Sing</tt> (840; 90%). `ADJ` tokens may have the following values of `Person[psor]`: <table> <tr><th>Paradigm <i>iç</i></th><th><tt>1</tt></th><th><tt>2</tt></th><th><tt>3</tt></th></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Abl</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=1</tt></tt></td><td><em>içimden</em></td><td></td><td></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Abl</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt></tt></td><td></td><td></td><td><em>içinden</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Acc</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=1</tt></tt></td><td><em>İçimi, içimi</em></td><td></td><td></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Acc</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=2</tt></tt></td><td></td><td><em>içini</em></td><td></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Acc</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Plur</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=1</tt></tt></td><td><em>içimizi</em></td><td></td><td></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Dat</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt></tt></td><td></td><td></td><td><em>içine, İçine</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Loc</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=1</tt></tt></td><td><em>içimde</em></td><td></td><td></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Loc</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt></tt></td><td></td><td></td><td><em>içinde, İçinde</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Nom</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=1</tt></tt></td><td><em>İçim, içim</em></td><td></td><td></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Nom</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt></tt></td><td></td><td></td><td><em>içi</em></td></tr> </table> ### `PRON` 346 <tt><a href="tr-pos-PRON.html">PRON</a></tt> tokens (16% of all `PRON` tokens) have a non-empty value of `Person[psor]`. The most frequent other feature values with which `PRON` and `Person[psor]` co-occurred: <tt><a href="tr-feat-Person.html">Person</a></tt><tt>=3</tt> (281; 81%), <tt><a href="tr-feat-Number.html">Number</a></tt><tt>=Sing</tt> (232; 67%), <tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt> (232; 67%), <tt><a href="tr-feat-PronType.html">PronType</a></tt><tt>=EMPTY</tt> (188; 54%). `PRON` tokens may have the following values of `Person[psor]`: <table> <tr><th>Paradigm <i>ne</i></th><th><tt>1</tt></th><th><tt>2</tt></th><th><tt>3</tt></th></tr> <tr><td><tt><tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=1</tt></tt></td><td><em>neyim</em></td><td></td><td></td></tr> <tr><td><tt><tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=2</tt></tt></td><td></td><td><em>Neyin</em></td><td></td></tr> <tr><td><tt><tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt></tt></td><td></td><td></td><td><em>Nesi</em></td></tr> </table> ### `NUM` 70 <tt><a href="tr-pos-NUM.html">NUM</a></tt> tokens (3% of all `NUM` tokens) have a non-empty value of `Person[psor]`. The most frequent other feature values with which `NUM` and `Person[psor]` co-occurred: <tt><a href="tr-feat-Person.html">Person</a></tt><tt>=3</tt> (70; 100%), <tt><a href="tr-feat-Number.html">Number</a></tt><tt>=Sing</tt> (67; 96%), <tt><a href="tr-feat-NumType.html">NumType</a></tt><tt>=Card</tt> (56; 80%), <tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Nom</tt> (38; 54%). `NUM` tokens may have the following values of `Person[psor]`: <table> <tr><th>Paradigm <i>bir</i></th><th><tt>2</tt></th><th><tt>3</tt></th></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Acc</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt></tt></td><td></td><td><em>birini</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Dat</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=2</tt></tt></td><td><em>birine</em></td><td></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Dat</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt></tt></td><td></td><td><em>birine</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Loc</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt></tt></td><td></td><td><em>birinde</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Nom</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt></tt></td><td></td><td><em>biri</em></td></tr> </table> ### `ADP` 22 <tt><a href="tr-pos-ADP.html">ADP</a></tt> tokens (1% of all `ADP` tokens) have a non-empty value of `Person[psor]`. `ADP` tokens may have the following values of `Person[psor]`: <table> <tr><th>Paradigm <i>lik</i></th><th><tt>1</tt></th><th><tt>2</tt></th><th><tt>3</tt></th></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Abl</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt></tt></td><td></td><td></td><td><em>liğinden</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Dat</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=1</tt></tt></td><td><em>lığıma</em></td><td></td><td></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Dat</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt></tt></td><td></td><td></td><td><em>lığına</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Gen</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt></tt></td><td></td><td></td><td><em>lüğünün, lığının</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Nom</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Sing</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=3</tt></tt></td><td></td><td></td><td><em>anlışlanabilirliği, lığı</em></td></tr> <tr><td><tt><tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Nom</tt>|<tt><a href="tr-feat-Number-psor.html">Number[psor]</a></tt><tt>=Plur</tt>|<tt><a href="tr-feat-Person-psor.html">Person[psor]</a></tt><tt>=2</tt></tt></td><td></td><td><em>lığınız</em></td><td></td></tr> </table> ### `PROPN` 15 <tt><a href="tr-pos-PROPN.html">PROPN</a></tt> tokens (1% of all `PROPN` tokens) have a non-empty value of `Person[psor]`. The most frequent other feature values with which `PROPN` and `Person[psor]` co-occurred: <tt><a href="tr-feat-Number.html">Number</a></tt><tt>=Sing</tt> (15; 100%), <tt><a href="tr-feat-Person.html">Person</a></tt><tt>=3</tt> (15; 100%), <tt><a href="tr-feat-Case.html">Case</a></tt><tt>=Nom</tt> (10; 67%). `PROPN` tokens may have the following values of `Person[psor]`: ## Relations with Agreement in `Person[psor]` The 10 most frequent relations where parent and child node agree in `Person[psor]`: <tt>VERB --[<tt><a href="tr-dep-conj.html">conj</a></tt>]--> VERB</tt> (80; 82%), <tt>ADJ --[<tt><a href="tr-dep-conj.html">conj</a></tt>]--> ADJ</tt> (8; 62%), <tt>NOUN --[<tt><a href="tr-dep-compound-redup.html">compound:redup</a></tt>]--> NOUN</tt> (6; 60%), <tt>ADP --[<tt><a href="tr-dep-nmod-poss.html">nmod:poss</a></tt>]--> ADJ</tt> (2; 100%), <tt>NOUN --[<tt><a href="tr-dep-advmod-emph.html">advmod:emph</a></tt>]--> VERB</tt> (1; 100%), <tt>NUM --[<tt><a href="tr-dep-conj.html">conj</a></tt>]--> NUM</tt> (1; 100%), <tt>VERB --[<tt><a href="tr-dep-cc.html">cc</a></tt>]--> PRON</tt> (1; 100%).
UniversalDependencies/docs
treebanks/tr_imst/tr-feat-Person-psor.md
Markdown
apache-2.0
43,029
// This is all mercilessly copied from LoadBalancersTag.tsx. This should be clenaed up at some point // Probably when we convert clusters view to React. import * as React from 'react'; import * as ReactGA from 'react-ga'; import autoBindMethods from 'class-autobind-decorator'; import { sortBy } from 'lodash'; import { HealthCounts, ILoadBalancer, ILoadBalancersTagProps, LoadBalancerDataUtils, ReactInjector, Tooltip, HoverablePopover } from '@spinnaker/core'; import { AmazonLoadBalancerDataUtils } from 'amazon/loadBalancer/amazonLoadBalancerDataUtils'; import { IAmazonServerGroup, ITargetGroup } from 'amazon/domain'; interface ILoadBalancerListItemProps { loadBalancer: ILoadBalancer | ITargetGroup; onItemClick: (loadBalancer: ILoadBalancer | ITargetGroup) => void; } interface ILoadBalancerSingleItemProps extends ILoadBalancerListItemProps { label: string; } @autoBindMethods class LoadBalancerListItem extends React.Component<ILoadBalancerListItemProps> { private onClick(e: React.MouseEvent<HTMLElement>): void { this.props.onItemClick(this.props.loadBalancer); e.nativeEvent.preventDefault(); // yay angular JQueryEvent still listening to the click event... } public render(): React.ReactElement<LoadBalancerListItem> { return ( <a onClick={this.onClick}> <span className="name">{this.props.loadBalancer.name}</span> <HealthCounts container={this.props.loadBalancer.instanceCounts}/> </a> ) } } @autoBindMethods class LoadBalancerButton extends React.Component<ILoadBalancerSingleItemProps> { private onClick(e: React.MouseEvent<HTMLElement>): void { this.props.onItemClick(this.props.loadBalancer); e.nativeEvent.preventDefault(); // yay angular JQueryEvent still listening to the click event... } public render(): React.ReactElement<LoadBalancerButton> { return ( <Tooltip value={`${this.props.label || 'Load Balancer'}: ${this.props.loadBalancer.name}`}> <button className="btn btn-link no-padding" onClick={this.onClick}> <span className="badge badge-counter"> <span className="icon"> <span className="icon-elb"/> </span> </span> </button> </Tooltip> ) } } export interface IAmazonLoadBalancersTagState { loadBalancers: ILoadBalancer[]; targetGroups: ITargetGroup[]; } @autoBindMethods export class AmazonLoadBalancersTag extends React.Component<ILoadBalancersTagProps, IAmazonLoadBalancersTagState> { private loadBalancersRefreshUnsubscribe: () => void; constructor(props: ILoadBalancersTagProps) { super(props); this.state = { loadBalancers: [], targetGroups: [], }; LoadBalancerDataUtils.populateLoadBalancers(props.application, props.serverGroup).then((loadBalancers) => this.setState({loadBalancers})) AmazonLoadBalancerDataUtils.populateTargetGroups(props.application, props.serverGroup as IAmazonServerGroup).then((targetGroups: ITargetGroup[]) => this.setState({targetGroups})) this.loadBalancersRefreshUnsubscribe = props.application.getDataSource('loadBalancers').onRefresh(null, () => { this.forceUpdate(); }); } private showLoadBalancerDetails(loadBalancer: ILoadBalancer): void { const { $state } = ReactInjector; const serverGroup = this.props.serverGroup; ReactGA.event({category: 'Cluster Pod', action: `Load Load Balancer Details (multiple menu)`}); const nextState = $state.current.name.endsWith('.clusters') ? '.loadBalancerDetails' : '^.loadBalancerDetails'; $state.go(nextState, {region: serverGroup.region, accountId: serverGroup.account, name: loadBalancer.name, provider: serverGroup.type}); } private showTargetGroupDetails(targetGroup: ITargetGroup): void { const { $state } = ReactInjector; const serverGroup = this.props.serverGroup; ReactGA.event({category: 'Cluster Pod', action: `Load Target Group Details (multiple menu)`}); const nextState = $state.current.name.endsWith('.clusters') ? '.targetGroupDetails' : '^.targetGroupDetails'; $state.go(nextState, {region: serverGroup.region, accountId: serverGroup.account, name: targetGroup.name, provider: serverGroup.type, loadBalancerName: targetGroup.loadBalancerNames[0]}); } private handleShowPopover() { ReactGA.event({category: 'Cluster Pod', action: `Show Load Balancers Menu`}); } private handleClick(e: React.MouseEvent<HTMLElement>): void { e.preventDefault(); e.stopPropagation(); } public componentWillUnmount(): void { this.loadBalancersRefreshUnsubscribe(); } public render(): React.ReactElement<AmazonLoadBalancersTag> { const { loadBalancers, targetGroups } = this.state; const targetGroupCount = targetGroups && targetGroups.length || 0, loadBalancerCount = loadBalancers && loadBalancers.length || 0, totalCount = targetGroupCount + loadBalancerCount; if (!totalCount) { return null; } const className = `load-balancers-tag ${totalCount > 1 ? 'overflowing' : ''}`; const popover = ( <div className="menu-load-balancers"> {loadBalancerCount > 0 && <div className="menu-load-balancers-header">Load Balancers</div>} {sortBy(loadBalancers, 'name').map((loadBalancer) => ( <LoadBalancerListItem key={loadBalancer.name} loadBalancer={loadBalancer} onItemClick={this.showLoadBalancerDetails}/> ))} {targetGroupCount > 0 && <div className="menu-load-balancers-header">Target Groups</div>} {sortBy(targetGroups, 'name').map((targetGroup) => ( <LoadBalancerListItem key={targetGroup.name} loadBalancer={targetGroup} onItemClick={this.showTargetGroupDetails}/> ))} </div> ); return ( <span className={className}> { totalCount > 1 && ( <HoverablePopover delayShow={100} delayHide={150} onShow={this.handleShowPopover} placement="bottom" template={popover} hOffsetPercent="80%" container={this.props.container} className="no-padding menu-load-balancers" > <button onClick={this.handleClick} className="btn btn-link btn-multiple-load-balancers clearfix no-padding" > <span className="badge badge-counter"> <span className="icon"><span className="icon-elb"/></span> {totalCount} </span> </button> </HoverablePopover> )} { (loadBalancers.length === 1 && targetGroups.length === 0) && ( <span className="btn-load-balancer"> <LoadBalancerButton key={loadBalancers[0].name} label="Load Balancer" loadBalancer={loadBalancers[0]} onItemClick={this.showLoadBalancerDetails}/> </span> )} { (targetGroups.length === 1 && loadBalancers.length === 0) && ( <span className="btn-load-balancer"> <LoadBalancerButton key={targetGroups[0].name} label="Target Group" loadBalancer={targetGroups[0]} onItemClick={this.showTargetGroupDetails}/> </span> )} </span> ) } }
kenzanlabs/deck
app/scripts/modules/amazon/src/loadBalancer/AmazonLoadBalancersTag.tsx
TypeScript
apache-2.0
7,131
Given(/^I am on the sign in page$/) do @current_page = page(SignInPage) raise "Expected to be on the 'sign in page'" unless @current_page.current_page? end Given(/^I enter a valid username$/) do @current_page.enter_username($valid_username) end Given(/^I enter a valid password$/) do @current_page.enter_password($valid_password) end When(/^I press the sign in button$/) do @current_page.touch_login_button end Then(/^I should see the main page$/) do @current_page = page(MainPage).await(timeout: 5) end Given(/^I have successfully signed in$/) do step %|I am on the sign in page| step %|I enter a valid username| step %|I enter a valid password| step %|I press the sign in button| step %|I should see the main page| end
we7/calabash-trainer
app/features/step_definitions/login_steps.rb
Ruby
apache-2.0
752
<?php /** * AvailabilityFollowUpTimeSlotModel * * PHP version 5 * * @category Class * @package BumbalClient * @author Swaagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ /** * Bumbal Client Api * * Bumbal API documentation * * OpenAPI spec version: 2.0 * Contact: gerb@bumbal.eu * Generated by: https://github.com/swagger-api/swagger-codegen.git * */ /** * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen * Do not edit the class manually. */ namespace BumbalClient\Model; use \ArrayAccess; /** * AvailabilityFollowUpTimeSlotModel Class Doc Comment * * @category Class * @package BumbalClient * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ class AvailabilityFollowUpTimeSlotModel implements ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. * @var string */ protected static $swaggerModelName = 'AvailabilityFollowUpTimeSlotModel'; /** * Array of property to type mappings. Used for (de)serialization * @var string[] */ protected static $swaggerTypes = [ 'date_time_from' => '\DateTime', 'date_time_to' => '\DateTime', 'proposed_plan_date_time_from' => '\DateTime', 'proposed_plan_date_time_to' => '\DateTime', 'proposed_driver' => '\BumbalClient\Model\DriverModel' ]; /** * Array of property to format mappings. Used for (de)serialization * @var string[] */ protected static $swaggerFormats = [ 'date_time_from' => 'date-time', 'date_time_to' => 'date-time', 'proposed_plan_date_time_from' => 'date-time', 'proposed_plan_date_time_to' => 'date-time', 'proposed_driver' => null ]; public static function swaggerTypes() { return self::$swaggerTypes; } public static function swaggerFormats() { return self::$swaggerFormats; } /** * Array of attributes where the key is the local name, and the value is the original name * @var string[] */ protected static $attributeMap = [ 'date_time_from' => 'date_time_from', 'date_time_to' => 'date_time_to', 'proposed_plan_date_time_from' => 'proposed_plan_date_time_from', 'proposed_plan_date_time_to' => 'proposed_plan_date_time_to', 'proposed_driver' => 'proposed_driver' ]; /** * Array of attributes to setter functions (for deserialization of responses) * @var string[] */ protected static $setters = [ 'date_time_from' => 'setDateTimeFrom', 'date_time_to' => 'setDateTimeTo', 'proposed_plan_date_time_from' => 'setProposedPlanDateTimeFrom', 'proposed_plan_date_time_to' => 'setProposedPlanDateTimeTo', 'proposed_driver' => 'setProposedDriver' ]; /** * Array of attributes to getter functions (for serialization of requests) * @var string[] */ protected static $getters = [ 'date_time_from' => 'getDateTimeFrom', 'date_time_to' => 'getDateTimeTo', 'proposed_plan_date_time_from' => 'getProposedPlanDateTimeFrom', 'proposed_plan_date_time_to' => 'getProposedPlanDateTimeTo', 'proposed_driver' => 'getProposedDriver' ]; public static function attributeMap() { return self::$attributeMap; } public static function setters() { return self::$setters; } public static function getters() { return self::$getters; } /** * Associative array for storing property values * @var mixed[] */ protected $container = []; /** * Constructor * @param mixed[] $data Associated array of property values initializing the model */ public function __construct(array $data = null) { $this->container['date_time_from'] = isset($data['date_time_from']) ? $data['date_time_from'] : null; $this->container['date_time_to'] = isset($data['date_time_to']) ? $data['date_time_to'] : null; $this->container['proposed_plan_date_time_from'] = isset($data['proposed_plan_date_time_from']) ? $data['proposed_plan_date_time_from'] : null; $this->container['proposed_plan_date_time_to'] = isset($data['proposed_plan_date_time_to']) ? $data['proposed_plan_date_time_to'] : null; $this->container['proposed_driver'] = isset($data['proposed_driver']) ? $data['proposed_driver'] : null; } /** * show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { $invalid_properties = []; return $invalid_properties; } /** * validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid */ public function valid() { return true; } /** * Gets date_time_from * @return \DateTime */ public function getDateTimeFrom() { return $this->container['date_time_from']; } /** * Sets date_time_from * @param \DateTime $date_time_from * @return $this */ public function setDateTimeFrom($date_time_from) { $this->container['date_time_from'] = $date_time_from; return $this; } /** * Gets date_time_to * @return \DateTime */ public function getDateTimeTo() { return $this->container['date_time_to']; } /** * Sets date_time_to * @param \DateTime $date_time_to * @return $this */ public function setDateTimeTo($date_time_to) { $this->container['date_time_to'] = $date_time_to; return $this; } /** * Gets proposed_plan_date_time_from * @return \DateTime */ public function getProposedPlanDateTimeFrom() { return $this->container['proposed_plan_date_time_from']; } /** * Sets proposed_plan_date_time_from * @param \DateTime $proposed_plan_date_time_from * @return $this */ public function setProposedPlanDateTimeFrom($proposed_plan_date_time_from) { $this->container['proposed_plan_date_time_from'] = $proposed_plan_date_time_from; return $this; } /** * Gets proposed_plan_date_time_to * @return \DateTime */ public function getProposedPlanDateTimeTo() { return $this->container['proposed_plan_date_time_to']; } /** * Sets proposed_plan_date_time_to * @param \DateTime $proposed_plan_date_time_to * @return $this */ public function setProposedPlanDateTimeTo($proposed_plan_date_time_to) { $this->container['proposed_plan_date_time_to'] = $proposed_plan_date_time_to; return $this; } /** * Gets proposed_driver * @return \BumbalClient\Model\DriverModel */ public function getProposedDriver() { return $this->container['proposed_driver']; } /** * Sets proposed_driver * @param \BumbalClient\Model\DriverModel $proposed_driver * @return $this */ public function setProposedDriver($proposed_driver) { $this->container['proposed_driver'] = $proposed_driver; return $this; } /** * Returns true if offset exists. False otherwise. * @param integer $offset Offset * @return boolean */ public function offsetExists($offset) { return isset($this->container[$offset]); } /** * Gets offset. * @param integer $offset Offset * @return mixed */ public function offsetGet($offset) { return isset($this->container[$offset]) ? $this->container[$offset] : null; } /** * Sets value based on offset. * @param integer $offset Offset * @param mixed $value Value to be set * @return void */ public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; } else { $this->container[$offset] = $value; } } /** * Unsets offset. * @param integer $offset Offset * @return void */ public function offsetUnset($offset) { unset($this->container[$offset]); } /** * Gets the string presentation of the object * @return string */ public function __toString() { if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print return json_encode(\BumbalClient\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); } return json_encode(\BumbalClient\ObjectSerializer::sanitizeForSerialization($this)); } }
freightlive/bumbal-client-api-php
src/Model/AvailabilityFollowUpTimeSlotModel.php
PHP
apache-2.0
8,933
import java.util.Hashtable; import java.util.Map; /** * La classe {@link Arguments} permet de traiter les arguments lisibles * passés en paramètres du lancement du programme */ public class Arguments { static public String graph = ""; static public long limit = -1; static public int method = 0; static public String show = ""; static public boolean help = false; public Arguments(String[] args) throws ArgumentException { Map<String, Object> arguments = new Hashtable<>(); for(String s : args) { if(s.startsWith("-")) { String arg; arg = s.substring(1); if(arg.equals("help")) { help = true; return; } else { int pos = arg.indexOf('='); if(pos == -1) throw new ArgumentException(s); String argument = arg.substring(0, pos); String value = arg.substring(pos+1); switch(argument) { case "graph" : arguments.put(argument, value); break; case "limit" : arguments.put(argument, Long.valueOf(value)); break; case "method" : arguments.put(argument, Integer.valueOf(value)); break; case "show" : arguments.put(argument, value); break; default: throw new ArgumentException(argument); } } } else throw new ArgumentException(s); } computeMap(arguments); } private void computeMap(Map<String, Object> M) { if(M.get("graph") != null) graph = (String) M.get("graph"); if(M.get("limit") != null) limit = (Long) M.get("limit"); if(M.get("method") != null) method = (Integer) M.get("method"); if(M.get("show") != null) show = (String) M.get("show"); } public static void showValidArguments() { System.out.println("Usage : clique_issue -graph=<file to graph> -method=<method 0, 1, 2, 3> -limit=<limit time ms> -show=<all, stats, graph> "); } public static void showHelp() { System.out.println("-graph=<file to graph> : the file who contains the description of the graphe"); System.out.println("-method=<method 0, 1, 2, 3> : method to use"); System.out.println("\t\t\t 0\t:\tClassic"); System.out.println("\t\t\t 1\t:\tB-K"); System.out.println("\t\t\t 2\t:\tTomita"); System.out.println("\t\t\t 3\t:\tClassic n°2"); System.out.println("-limit=<time limit ms> : the time limit of execution (ms)"); System.out.println("show=<all, stats, graph>\t:\twhat to show"); System.out.println("\t\t\t all\t:\tshow the stats of the graph and the graph (matrix)"); System.out.println("\t\t\t graph\t:\tshow only the graph (matrix)"); System.out.println("\t\t\t stats\t:\tshow only the stats"); } }
jfourmond/CliqueIssue
CliqueIssue/src/Arguments.java
Java
apache-2.0
2,616
package com.asadmshah.drawnearby.network; import com.asadmshah.drawnearby.models.DrawEvent; public interface NearbyDrawerRoom { void connect(); void disconnect(); void setListener(NearbyDrawerRoomListener listener); void sendDrawEvent(DrawEvent event); }
asadmshah/drawnearby
app/src/main/java/com/asadmshah/drawnearby/network/NearbyDrawerRoom.java
Java
apache-2.0
273
package com.sean.bigdata.action; import com.sean.bigdata.bean.ReportBean; import com.sean.bigdata.constant.A; import com.sean.bigdata.constant.M; import com.sean.bigdata.constant.P; import com.sean.bigdata.constant.R; import com.sean.common.ioc.ResourceConfig; import com.sean.service.annotation.ActionConfig; import com.sean.service.annotation.DescriptConfig; import com.sean.service.annotation.MustParamsConfig; import com.sean.service.annotation.ReturnParamsConfig; import com.sean.service.core.Action; import com.sean.service.core.Session; @ActionConfig(module = M.class, permission = A.Admin | A.ReportACL) @MustParamsConfig({ P.reportId }) @ReturnParamsConfig({ R.reportDetail }) @DescriptConfig("查询报表") public class InquireReportAction extends Action { @ResourceConfig private ReportBean reportBean; @Override public void execute(Session session) throws Exception { long reportId = session.getLongParameter(P.reportId); session.setReturnAttribute(R.reportDetail, reportBean.getReportById(reportId)); session.success(); } }
seanzwx/workspace
bigdata/bigdata-core/src/main/java/com/sean/bigdata/action/InquireReportAction.java
Java
apache-2.0
1,054
/* * Copyright 2011-2014 Eric F. Savage, code@efsavage.com * * 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.ajah.user.login; import com.ajah.util.IdentifiableEnum; /** * Valid sources of LogIn entities. * * @author Eric F. Savage <code@efsavage.com> * */ public enum LogInSource implements IdentifiableEnum<String> { /** * Unknown/Other. */ UNKNOWN("0", "unk", "Unknown/Other", "Unknown/Other"), /** * Website. */ WEB("1", "web", "Website", "Website"), /** * Mobile app. */ MOBILE_APP("2", "mobile", "Mobile", "Mobile App"); /** * Finds a LogInType that matches the id on id, name, or name(). * * @param string * Value to match against id, name, or name() * @return Matching LogInType, or null. */ public static LogInSource get(final String string) { for (final LogInSource type : values()) { if (type.getId().equals(string) || type.getCode().equals(string) || type.name().equals(string) || type.getName().equals(string)) { return type; } } return null; } private final String id; private final String code; private final String name; private final String description; LogInSource(final String id, final String code, final String name, final String description) { this.id = id; this.code = code; this.name = name; this.description = description; } /** * The short, display-friendly code of the type. If no code is applicable, * it should be an alias for the ID. * * @return The short, display-friendly code of the type. Cannot be null. */ @Override public String getCode() { return this.code; } /** * The display-friendly description of the type. * * @return The display-friendly description of the type. May be null. */ public String getDescription() { return this.description; } /** * The internal ID of the type. * * @return The internal ID of the type. Cannot be null. */ @Override public String getId() { return this.id; } /** * The display-friendly name of the type. If no name is applicable, it * should be an alias for the ID or code. * * @return The display-friendly name of the type. Cannot be null. */ @Override public String getName() { return this.name; } @Override public void setId(final String id) { throw new UnsupportedOperationException(); } }
efsavage/ajah
ajah-user/src/main/java/com/ajah/user/login/LogInSource.java
Java
apache-2.0
2,870
package nam.model.query; import java.io.Serializable; import javax.enterprise.context.SessionScoped; import javax.inject.Named; import org.aries.ui.AbstractWizardPage; import nam.model.Query; import nam.model.util.QueryUtil; @SessionScoped @Named("queryDocumentationSection") public class QueryRecord_DocumentationSection extends AbstractWizardPage<Query> implements Serializable { private Query query; public QueryRecord_DocumentationSection() { setName("Documentation"); setUrl("documentation"); } public Query getQuery() { return query; } public void setQuery(Query query) { this.query = query; } @Override public void initialize(Query query) { setEnabled(true); setBackEnabled(true); setNextEnabled(true); setFinishEnabled(false); setQuery(query); } @Override public void validate() { if (query == null) { validator.missing("Query"); } else { } } }
tfisher1226/ARIES
nam/nam-view/src/main/java/nam/model/query/QueryRecord_DocumentationSection.java
Java
apache-2.0
917
/* * Copyright 2013 Gunnar Kappei. * * 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 net.opengis.gml.impl; /** * A document containing one decimalMinutes(@http://www.opengis.net/gml) element. * * This is a complex type. */ public class DecimalMinutesDocumentImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements net.opengis.gml.DecimalMinutesDocument { private static final long serialVersionUID = 1L; public DecimalMinutesDocumentImpl(org.apache.xmlbeans.SchemaType sType) { super(sType); } private static final javax.xml.namespace.QName DECIMALMINUTES$0 = new javax.xml.namespace.QName("http://www.opengis.net/gml", "decimalMinutes"); /** * Gets the "decimalMinutes" element */ public java.math.BigDecimal getDecimalMinutes() { synchronized (monitor()) { check_orphaned(); org.apache.xmlbeans.SimpleValue target = null; target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(DECIMALMINUTES$0, 0); if (target == null) { return null; } return target.getBigDecimalValue(); } } /** * Gets (as xml) the "decimalMinutes" element */ public net.opengis.gml.DecimalMinutesType xgetDecimalMinutes() { synchronized (monitor()) { check_orphaned(); net.opengis.gml.DecimalMinutesType target = null; target = (net.opengis.gml.DecimalMinutesType)get_store().find_element_user(DECIMALMINUTES$0, 0); return target; } } /** * Sets the "decimalMinutes" element */ public void setDecimalMinutes(java.math.BigDecimal decimalMinutes) { synchronized (monitor()) { check_orphaned(); org.apache.xmlbeans.SimpleValue target = null; target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(DECIMALMINUTES$0, 0); if (target == null) { target = (org.apache.xmlbeans.SimpleValue)get_store().add_element_user(DECIMALMINUTES$0); } target.setBigDecimalValue(decimalMinutes); } } /** * Sets (as xml) the "decimalMinutes" element */ public void xsetDecimalMinutes(net.opengis.gml.DecimalMinutesType decimalMinutes) { synchronized (monitor()) { check_orphaned(); net.opengis.gml.DecimalMinutesType target = null; target = (net.opengis.gml.DecimalMinutesType)get_store().find_element_user(DECIMALMINUTES$0, 0); if (target == null) { target = (net.opengis.gml.DecimalMinutesType)get_store().add_element_user(DECIMALMINUTES$0); } target.set(decimalMinutes); } } }
moosbusch/xbLIDO
src/net/opengis/gml/impl/DecimalMinutesDocumentImpl.java
Java
apache-2.0
3,447
/** * @license * Copyright 2020 Google LLC. 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. * ============================================================================= */ import {ENGINE} from '../engine'; import {RealDiv, RealDivInputs} from '../kernel_names'; import {Tensor} from '../tensor'; import {NamedTensorMap} from '../tensor_types'; import {makeTypesMatch} from '../tensor_util'; import {convertToTensor} from '../tensor_util_env'; import {TensorLike} from '../types'; import {floorDiv} from './floorDiv'; import {op} from './operation'; /** * Divides two `tf.Tensor`s element-wise, A / B. Supports broadcasting. * * ```js * const a = tf.tensor1d([1, 4, 9, 16]); * const b = tf.tensor1d([1, 2, 3, 4]); * * a.div(b).print(); // or tf.div(a, b) * ``` * * ```js * // Broadcast div a with b. * const a = tf.tensor1d([2, 4, 6, 8]); * const b = tf.scalar(2); * * a.div(b).print(); // or tf.div(a, b) * ``` * * @param a The first tensor as the numerator. * @param b The second tensor as the denominator. Must have the same dtype as * `a`. * * @doc {heading: 'Operations', subheading: 'Arithmetic'} */ function div_<T extends Tensor>(a: Tensor|TensorLike, b: Tensor|TensorLike): T { let $a = convertToTensor(a, 'a', 'div'); let $b = convertToTensor(b, 'b', 'div'); [$a, $b] = makeTypesMatch($a, $b); if ($a.dtype === 'int32' && $b.dtype === 'int32') { return floorDiv($a, $b); } const inputs: RealDivInputs = {a: $a, b: $b}; const attrs = {}; // tslint:disable-next-line: no-unnecessary-type-assertion return ENGINE.runKernel(RealDiv, inputs as {} as NamedTensorMap, attrs) as T; } export const div = op({div_});
tensorflow/tfjs
tfjs-core/src/ops/div.ts
TypeScript
apache-2.0
2,201
package org.cloudbus.mcweb.rules.relations; /** * Represents an algebraic relation with a left hand side (lhs) and * a rigth hand side (rhs); * * @author nikolay.grozev * * @param <T> - the compile time type of the arguements. */ public interface IRelation<T> { /** * Returns the left hand side (lhs) of the relation. * @return the left hand side (lhs) of the relation. */ public T getLhs(); /** * Sets the left hand side (lhs) of the relation. * @param lhs - the left hand side (lhs) of the relation. Must not be null. Must of the type specified by {@link IRelation.getElementType}. */ public void setLhs(T lhs); /** * Returns the right hand side (lhs) of the relation. * @return the right hand side (lhs) of the relation. */ public T getRhs(); /** * Sets the right hand side (rhs) of the relation. * @param rhs - the right hand side (rhs) of the relation. Must not be null. Must of the type specified by {@link IRelation.getElementType}. */ public void setRhs(T rhs); /** * Returns the expected type of the elements of this relation. Used for validation, because of type erasure in Java. * @return the expected type of the elements of this relation. */ public Class<? extends T> getElementType(); /** * Sets the expected type of the elements of this relation. Used for validation, because of type erasure in Java. * @param elementType - the expected type of the elements of this relation. Used for validation. Must not be null. * Must match or be a supertype of the types of lhs and rhs. */ public void setElementType(Class<? extends T> elementType); /** * Returns if this relation is applicable to the specified object. * @param o - the object to check for. * @return if this relation is applicable to the specified object. */ public default boolean isApplicableTo(Object o){ return o != null && getElementType().isInstance(o); } }
nikolayg/MCWeb
acrules/src/main/java/org/cloudbus/mcweb/rules/relations/IRelation.java
Java
apache-2.0
2,055
'use strict'; module.exports = { db: "mongodb://localhost/openqna-test", port: 3001, facebook: { clientID: "APP_ID", clientSecret: "APP_SECRET", callbackURL: "http://localhost:3000/auth/facebook/callback" }, twitter: { clientID: "CONSUMER_KEY", clientSecret: "CONSUMER_SECRET", callbackURL: "http://localhost:3000/auth/twitter/callback" }, github: { clientID: "APP_ID", clientSecret: "APP_SECRET", callbackURL: "http://localhost:3000/auth/github/callback" }, google: { clientID: "APP_ID", clientSecret: "APP_SECRET", callbackURL: "http://localhost:3000/auth/google/callback" } }
noamshemesh/openqna
config/env/test.js
JavaScript
apache-2.0
715
/* * Copyright 2017 Red Hat, Inc. and/or its affiliates. * * 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 org.jbpm.casemgmt.impl.wih; import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.Map; import org.drools.core.ClassObjectFilter; import org.jbpm.casemgmt.api.event.CaseCancelEvent; import org.jbpm.casemgmt.api.event.CaseCloseEvent; import org.jbpm.casemgmt.api.event.CaseDestroyEvent; import org.jbpm.casemgmt.api.event.CaseEvent; import org.jbpm.casemgmt.api.event.CaseEventListener; import org.jbpm.casemgmt.api.model.instance.CaseFileInstance; import org.jbpm.casemgmt.impl.model.instance.CaseFileInstanceImpl; import org.jbpm.process.instance.ProcessInstance; import org.jbpm.services.api.ProcessService; import org.jbpm.services.api.service.ServiceRegistry; import org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl; import org.kie.api.event.process.DefaultProcessEventListener; import org.kie.api.event.process.ProcessCompletedEvent; import org.kie.api.runtime.KieSession; import org.kie.internal.identity.IdentityProvider; import org.kie.internal.runtime.Cacheable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class NotifyParentCaseEventListener extends DefaultProcessEventListener implements CaseEventListener, Cacheable { private static final Logger logger = LoggerFactory.getLogger(NotifyParentCaseEventListener.class); private IdentityProvider identityProvider; public NotifyParentCaseEventListener(IdentityProvider identityProvider) { this.identityProvider = identityProvider; } @Override public void afterCaseClosed(CaseCloseEvent event) { notifyParentOnCompletion(event); } @Override public void afterCaseCancelled(CaseCancelEvent event) { notifyParentOnCompletion(event); } @Override public void afterCaseDestroyed(CaseDestroyEvent event) { notifyParentOnCompletion(event); } @Override public void afterProcessCompleted(ProcessCompletedEvent event) { CaseFileInstance caseFile = getCaseFile((KieSession) event.getKieRuntime()); if (caseFile != null) { String caseId = ((WorkflowProcessInstanceImpl) event.getProcessInstance()).getCorrelationKey(); if (caseFile.getCaseId().equals(caseId)) { logger.debug("Process instance {} that represents main case instance {} has completed/was aborted, notify parent if exists", event.getProcessInstance().getId(), caseId); CaseEvent caseEvent = null; if (event.getProcessInstance().getState() == ProcessInstance.STATE_COMPLETED) { caseEvent = new CaseCloseEvent(identityProvider.getName(), caseId, caseFile, ""); } else { caseEvent = new CaseCancelEvent(identityProvider.getName(), caseId, caseFile, Arrays.asList(event.getProcessInstance().getId())); } notifyParentOnCompletion(caseEvent); } } } protected void notifyParentOnCompletion(CaseEvent event) { CaseFileInstanceImpl caseFileInstance = (CaseFileInstanceImpl) event.getCaseFile(); if (caseFileInstance == null) { return; } if (caseFileInstance.getParentInstanceId() != null && caseFileInstance.getParentWorkItemId() != null) { logger.debug("Case {} has defined parent information instance {}, work item {}, going to notify it", event.getCaseId(), caseFileInstance.getParentInstanceId(), caseFileInstance.getParentWorkItemId()); ProcessService processService = (ProcessService) ServiceRegistry.get().service(ServiceRegistry.PROCESS_SERVICE); Map<String, Object> results = new HashMap<>(caseFileInstance.getData()); results.put("CaseId", event.getCaseId()); processService.completeWorkItem(caseFileInstance.getParentWorkItemId(), results); logger.debug("Parent instance id {}, work item id {}, has been successfully notified about case {} completion", caseFileInstance.getParentInstanceId(), caseFileInstance.getParentWorkItemId(), event.getCaseId()); caseFileInstance.setParentInstanceId(null); caseFileInstance.setParentWorkItemId(null); } } protected CaseFileInstance getCaseFile(KieSession ksession) { Collection<? extends Object> caseFiles = ksession.getObjects(new ClassObjectFilter(CaseFileInstance.class)); if (caseFiles.size() == 0) { return null; } CaseFileInstance caseFile = (CaseFileInstance) caseFiles.iterator().next(); return caseFile; } @Override public void close() { // no-op } }
etirelli/jbpm
jbpm-case-mgmt/jbpm-case-mgmt-impl/src/main/java/org/jbpm/casemgmt/impl/wih/NotifyParentCaseEventListener.java
Java
apache-2.0
5,369
# Situm demo This is a simple app to test situm sdk. <img src="./art/screenshot1.png" width="30%"/> <img src="./art/screenshot2.png" width="30%" style="float: right;"/> <img src="./art/screenshot3.png" width="30%"/> ## Usage 1. **Config your api key and your user in keys.properties file** 2. **Set your building id in MapsActivity.kt.** ## Situm doc * [situm.es/developers](https://situm.es/en/developers) * [Javadoc](http://developers.situm.es/sdk_documentation/android/javadoc/2.5.0/)
mrebollob/situm-demo
README.md
Markdown
apache-2.0
490
/* * Copyright 2015 Adaptris Ltd. * * 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.adaptris.util.stream; import java.io.IOException; import java.io.OutputStream; /** * An OutputStream that flushes out to a logger. * <p> * Note that no data is written out to the Category until the stream is flushed or closed. * </p> * <br/> * Example: * * <pre> * {@code * // make sure everything sent to System.err is logged * System.setErr(new PrintStream(new LoggingOutputStream(LogHandler.WARN)); * // make sure everything sent to System.out is also logged * System.setOut(new PrintStream(new LoggingOutputStream(LogHandler.INFO)); * } * </pre> * */ abstract class LoggingOutputStreamImpl extends OutputStream { private boolean hasBeenClosed = false; private byte[] buf; public enum LogLevel { FATAL, ERROR, WARN, INFO, DEBUG, TRACE; }; /** * The number of valid bytes in the buffer. This value is always in the range * <tt>0</tt> through <tt>buf.length</tt>; elements <tt>buf[0]</tt> * through <tt>buf[count-1]</tt> contain valid byte data. */ private int count; private int bufLength; /** * The default number of bytes in the buffer. =2048 */ public static final int DEFAULT_BUFFER_LENGTH = 2048; protected transient LogLevel logLevel; protected LoggingOutputStreamImpl(LogLevel level) throws IllegalArgumentException { if (level == null) { throw new IllegalArgumentException("LogLevel == null"); } logLevel = level; } protected abstract void log(LogLevel level, String s); /** * Closes this output stream and releases any system resources associated with * this stream. The general contract of <code>close</code> is that it closes * the output stream. A closed stream cannot perform output operations and * cannot be reopened. */ @Override public void close() { flush(); hasBeenClosed = true; } /** * Writes the specified byte to this output stream. The general contract for * <code>write</code> is that one byte is written to the output stream. The * byte to be written is the eight low-order bits of the argument * <code>b</code>. The 24 high-order bits of <code>b</code> are ignored. * * @param b the <code>byte</code> to write * @throws IOException if an I/O error occurs. In particular, an * <code>IOException</code> may be thrown if the output stream has * been closed. */ @Override public void write(final int b) throws IOException { if (hasBeenClosed) { throw new IOException("The stream has been closed."); } if (count == bufLength) { final int newBufLength = bufLength + DEFAULT_BUFFER_LENGTH; final byte[] newBuf = new byte[newBufLength]; System.arraycopy(buf, 0, newBuf, 0, bufLength); buf = newBuf; bufLength = newBufLength; } buf[count] = (byte) b; count++; } /** * Flushes this output stream and forces any buffered output bytes to be * written out. The general contract of <code>flush</code> is that calling * it is an indication that, if any bytes previously written have been * buffered by the implementation of the output stream, such bytes should * immediately be written to their intended destination. */ @Override public void flush() { if (count == 0) { return; } // don't print out blank lines; flushing from PrintStream puts // out these // For linux system if (count == 1 && (char) buf[0] == '\n') { reset(); return; } // For mac system if (count == 1 && (char) buf[0] == '\r') { reset(); return; } // On windows system if (count == 2 && (char) buf[0] == '\r' && (char) buf[1] == '\n') { reset(); return; } final byte[] theBytes = new byte[count]; System.arraycopy(buf, 0, theBytes, 0, count); log(logLevel, new String(theBytes)); reset(); } protected void reset() { bufLength = DEFAULT_BUFFER_LENGTH; buf = new byte[DEFAULT_BUFFER_LENGTH]; count = 0; } }
mcwarman/interlok
adapter/src/main/java/com/adaptris/util/stream/LoggingOutputStreamImpl.java
Java
apache-2.0
4,605
/* Copyright 2020 The Knative Authors. 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 v1alpha1 import ( "context" ) func (s *PrometheusSource) SetDefaults(ctx context.Context) { s.Spec.SetDefaults(ctx) } func (s *PrometheusSourceSpec) SetDefaults(ctx context.Context) { // Nothing yet. }
knative-sandbox/eventing-prometheus
pkg/apis/sources/v1alpha1/prometheus_defaults.go
GO
apache-2.0
784
#pragma once #include <memory> #include "extensions/filters/http/jwt_authn/authenticator.h" #include "extensions/filters/http/jwt_authn/verifier.h" #include "test/mocks/upstream/mocks.h" #include "gmock/gmock.h" using ::google::jwt_verify::Status; namespace Envoy { namespace Extensions { namespace HttpFilters { namespace JwtAuthn { class MockAuthFactory : public AuthFactory { public: MOCK_METHOD(AuthenticatorPtr, create, (const ::google::jwt_verify::CheckAudience*, const absl::optional<std::string>&, bool, bool), (const)); }; class MockAuthenticator : public Authenticator { public: MOCK_METHOD(void, doVerify, (Http::HeaderMap & headers, Tracing::Span& parent_span, std::vector<JwtLocationConstPtr>* tokens, SetPayloadCallback set_payload_cb, AuthenticatorCallback callback)); void verify(Http::HeaderMap& headers, Tracing::Span& parent_span, std::vector<JwtLocationConstPtr>&& tokens, SetPayloadCallback set_payload_cb, AuthenticatorCallback callback) override { doVerify(headers, parent_span, &tokens, std::move(set_payload_cb), std::move(callback)); } MOCK_METHOD(void, onDestroy, ()); }; class MockVerifierCallbacks : public Verifier::Callbacks { public: MOCK_METHOD(void, setPayload, (const ProtobufWkt::Struct& payload)); MOCK_METHOD(void, onComplete, (const Status& status)); }; class MockVerifier : public Verifier { public: MOCK_METHOD(void, verify, (ContextSharedPtr context), (const)); }; class MockExtractor : public Extractor { public: MOCK_METHOD(std::vector<JwtLocationConstPtr>, extract, (const Http::HeaderMap& headers), (const)); MOCK_METHOD(void, sanitizePayloadHeaders, (Http::HeaderMap & headers), (const)); }; // A mock HTTP upstream with response body. class MockUpstream { public: MockUpstream(Upstream::MockClusterManager& mock_cm, const std::string& response_body) : request_(&mock_cm.async_client_), response_body_(response_body) { ON_CALL(mock_cm.async_client_, send_(_, _, _)) .WillByDefault( Invoke([this](Http::RequestMessagePtr&, Http::AsyncClient::Callbacks& cb, const Http::AsyncClient::RequestOptions&) -> Http::AsyncClient::Request* { Http::ResponseMessagePtr response_message( new Http::ResponseMessageImpl(Http::ResponseHeaderMapPtr{ new Http::TestResponseHeaderMapImpl{{":status", "200"}}})); response_message->body() = std::make_unique<Buffer::OwnedImpl>(response_body_); cb.onSuccess(std::move(response_message)); called_count_++; return &request_; })); } int called_count() const { return called_count_; } private: Http::MockAsyncClientRequest request_; std::string response_body_; int called_count_{}; }; } // namespace JwtAuthn } // namespace HttpFilters } // namespace Extensions } // namespace Envoy
eklitzke/envoy
test/extensions/filters/http/jwt_authn/mock.h
C
apache-2.0
2,999
<!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>OpenNI 1.5.8: Member List</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 id="projectlogo"><img alt="Logo" src="OpenNILogo.bmp"/></td> <td style="padding-left: 0.5em;"> <div id="projectname">OpenNI 1.5.8 </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><a href="pages.html"><span>Related&#160;Pages</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li class="current"><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="annotated.html"><span>Class&#160;List</span></a></li> <li><a href="classes.html"><span>Class&#160;Index</span></a></li> <li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li> <li><a href="functions.html"><span>Class&#160;Members</span></a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="headertitle"> <div class="title">XnModuleSceneAnalyzerInterface Member List</div> </div> </div><!--header--> <div class="contents"> <p>This is the complete list of members for <a class="el" href="struct_xn_module_scene_analyzer_interface.html">XnModuleSceneAnalyzerInterface</a>, including all inherited members.</p> <table class="directory"> <tr class="even"><td class="entry"><a class="el" href="struct_xn_module_scene_analyzer_interface.html#ab98e179f147abca2d4f61e1aed7e1e06">GetFloor</a></td><td class="entry"><a class="el" href="struct_xn_module_scene_analyzer_interface.html">XnModuleSceneAnalyzerInterface</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="struct_xn_module_scene_analyzer_interface.html#a0de34bd317aa01c3c2d7c954aaf61619">GetLabelMap</a></td><td class="entry"><a class="el" href="struct_xn_module_scene_analyzer_interface.html">XnModuleSceneAnalyzerInterface</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="struct_xn_module_scene_analyzer_interface.html#a548f9604f601a932a16a7563280edcae">pMapInterface</a></td><td class="entry"><a class="el" href="struct_xn_module_scene_analyzer_interface.html">XnModuleSceneAnalyzerInterface</a></td><td class="entry"></td></tr> </table></div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated on Thu Jun 11 2015 12:31:40 for OpenNI 1.5.8 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>
Wessi/OpenNI
Source/DoxyGen/html/struct_xn_module_scene_analyzer_interface-members.html
HTML
apache-2.0
3,570
--- title: Getting Started page_title: Getting Started - WinForms ScrollBar Control description: Learn how using Telerik scrollbars is a bit more intricate compared to using the standard scroll bars because you have to handle scroll event manually. slug: winforms/track-and-status-controls/scrollbar/getting-started tags: getting,started published: True position: 2 previous_url: track-and-status-controls-scrollbar-getting-started --- # Getting Started Using Telerik scroll bars is a bit more intricate compared to using the standard scroll bars because you have to handle scroll event manually. The rest of this article demonstrates how you can use two panels to implement scrolling for the content of the second panel. 1\. Add a **RadPanel** to your form (*TelerikMetro* theme was used for both panels. This theme is contained in the Miscellaneous theme component): ![track-and-status-controls-scroll-bar-getting-started 001](images/track-and-status-controls-scroll-bar-getting-started001.png) 2\. Add a **RadVScrollbar** in the panel and dock it to the *Right*: ![track-and-status-controls-scroll-bar-getting-started 002](images/track-and-status-controls-scroll-bar-getting-started002.png) 3\. Add another **RadPanel** in the already added one and set its height to the *total* height you want to be available upon scrolling. This value can be statics e.g. *1000* pixels or dynamic determined by the scrollable content. For the purpose, of this example it is set to *1000* pixels.  ![track-and-status-controls-scroll-bar-getting-started 003](images/track-and-status-controls-scroll-bar-getting-started003.png) 4\. The next step is to add controls to the second **RadPanel** (the controls which are to be scrolled): #### Adding controls to the panel {{source=..\SamplesCS\TrackAndStatus\ScrollBar\ScrollGettingStarted.cs region=buttons}} {{source=..\SamplesVB\TrackAndStatus\ScrollBar\ScrollGettingStarted.vb region=buttons}} ````C# for (int i = 1; i < 15; i++) { RadButton button = new RadButton(); button.Location = new Point(30, i * 30 + 5 * i); button.Size = new Size(70, 30); button.Text = "RadButton" + i.ToString(); this.radPanel2.Controls.Add(button); } ```` ````VB.NET For i As Integer = 1 To 14 Dim button As New RadButton() button.Location = New Point(30, i * 30 + 5 * i) button.Size = New Size(70, 30) button.Text = "RadButton" & i.ToString() Me.RadPanel2.Controls.Add(button) Next i ```` {{endregion}} >note You can add controls by drag and drop at design time as well. > ![track-and-status-controls-scroll-bar-getting-started 004](images/track-and-status-controls-scroll-bar-getting-started004.png) 5\. Then, subscribe to the **Scroll** event of the vertical scroll bar and assign its negated value to the **Top** property of the second **RadPanel**: #### Handling the Scroll event {{source=..\SamplesCS\TrackAndStatus\ScrollBar\ScrollGettingStarted.cs region=scroll}} {{source=..\SamplesVB\TrackAndStatus\ScrollBar\ScrollGettingStarted.vb region=scroll}} ````C# void radVScrollBar1_Scroll(object sender, ScrollEventArgs e) { this.radPanel2.Top = -this.radVScrollBar1.Value; } ```` ````VB.NET Private Sub radVScrollBar1_Scroll(ByVal sender As Object, ByVal e As ScrollEventArgs) Me.RadPanel2.Top = -Me.RadVScrollBar1.Value End Sub ```` {{endregion}} 6\. The last required step is to set the __Maximum__ property of the scroll bar to reflect the size of the __scrollable height__ which is the __total height__ of the scrollable content minus the __visible height__. For the example of this section in particular, that is the height of the second panel minus the height of the first panel. #### Specify RadVScrollBar's maximum {{source=..\SamplesCS\TrackAndStatus\ScrollBar\ScrollGettingStarted.cs region=maximum}} {{source=..\SamplesVB\TrackAndStatus\ScrollBar\ScrollGettingStarted.vb region=maximum}} ````C# this.radVScrollBar1.Maximum = this.radPanel2.Size.Height - this.radPanel1.Size.Height; ```` ````VB.NET Me.RadVScrollBar1.Maximum = Me.RadPanel2.Size.Height - Me.RadPanel1.Size.Height ```` {{endregion}} ![track-and-status-controls-scroll-bar-getting-started 005](images/track-and-status-controls-scroll-bar-getting-started005.png) # See Also * [Properties, Methods and Events]({%slug winforms/track-and-status-controls/scrollbar/programming-radscrollbars%})
telerik/winforms-docs
controls/track-and-status-controls/scrollbar/getting-started.md
Markdown
apache-2.0
4,412
/* * Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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.amazonaws.services.securityhub.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.AmazonWebServiceRequest; /** * * @see <a href="http://docs.aws.amazon.com/goto/WebAPI/securityhub-2018-10-26/DisableImportFindingsForProduct" * target="_top">AWS API Documentation</a> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class DisableImportFindingsForProductRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable { /** * <p> * The ARN of the integrated product to disable the integration for. * </p> */ private String productSubscriptionArn; /** * <p> * The ARN of the integrated product to disable the integration for. * </p> * * @param productSubscriptionArn * The ARN of the integrated product to disable the integration for. */ public void setProductSubscriptionArn(String productSubscriptionArn) { this.productSubscriptionArn = productSubscriptionArn; } /** * <p> * The ARN of the integrated product to disable the integration for. * </p> * * @return The ARN of the integrated product to disable the integration for. */ public String getProductSubscriptionArn() { return this.productSubscriptionArn; } /** * <p> * The ARN of the integrated product to disable the integration for. * </p> * * @param productSubscriptionArn * The ARN of the integrated product to disable the integration for. * @return Returns a reference to this object so that method calls can be chained together. */ public DisableImportFindingsForProductRequest withProductSubscriptionArn(String productSubscriptionArn) { setProductSubscriptionArn(productSubscriptionArn); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getProductSubscriptionArn() != null) sb.append("ProductSubscriptionArn: ").append(getProductSubscriptionArn()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof DisableImportFindingsForProductRequest == false) return false; DisableImportFindingsForProductRequest other = (DisableImportFindingsForProductRequest) obj; if (other.getProductSubscriptionArn() == null ^ this.getProductSubscriptionArn() == null) return false; if (other.getProductSubscriptionArn() != null && other.getProductSubscriptionArn().equals(this.getProductSubscriptionArn()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getProductSubscriptionArn() == null) ? 0 : getProductSubscriptionArn().hashCode()); return hashCode; } @Override public DisableImportFindingsForProductRequest clone() { return (DisableImportFindingsForProductRequest) super.clone(); } }
aws/aws-sdk-java
aws-java-sdk-securityhub/src/main/java/com/amazonaws/services/securityhub/model/DisableImportFindingsForProductRequest.java
Java
apache-2.0
4,185
/* * Copyright © EMC Corporation. All rights reserved. */ package radl.eclipse.builder; import java.util.Map; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResourceDelta; import org.eclipse.core.resources.IncrementalProjectBuilder; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import radl.core.validation.CompositeValidator; import radl.core.validation.LintValidator; import radl.core.validation.RelaxNgValidator; import radl.core.validation.Validator; /** * Project builder that validates RADL documents. */ public class RadlBuilder extends IncrementalProjectBuilder { public static final String BUILDER_ID = "radl.eclipse.radlBuilder"; private final RadlValidatingVisitor radlValidatingVisitor; public RadlBuilder() { this(new CompositeValidator(new RelaxNgValidator(), new LintValidator())); } RadlBuilder(Validator validator) { radlValidatingVisitor = new RadlValidatingVisitor(validator); } @Override protected IProject[] build(int kind, @SuppressWarnings("rawtypes") Map args, IProgressMonitor monitor) throws CoreException { if (kind == FULL_BUILD) { fullBuild(); } else { IResourceDelta delta = getDelta(getProject()); if (delta == null) { fullBuild(); } else { incrementalBuild(delta); } } return new IProject[0]; } @Override protected void clean(IProgressMonitor monitor) throws CoreException { getProject().deleteMarkers(RadlValidatingVisitor.MARKER_TYPE, true, IResource.DEPTH_INFINITE); } private void fullBuild() throws CoreException { getProject().accept(radlValidatingVisitor); } private void incrementalBuild(IResourceDelta delta) throws CoreException { delta.accept(radlValidatingVisitor); } }
restful-api-description-language/RADL
java/eclipse/src/main/java/radl/eclipse/builder/RadlBuilder.java
Java
apache-2.0
1,881
# -*- coding: utf-8 -*- ''' fantastic Add-on 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 urllib, urlparse, re from resources.lib.modules import cleantitle from resources.lib.modules import client from resources.lib.modules import source_utils from resources.lib.modules import dom_parser from resources.lib.modules import directstream from resources.lib.modules import debrid class source: def __init__(self): self.priority = 1 self.language = ['en'] self.domains = ['movie4k.is'] self.base_link = 'http://movie4k.is' self.search_link = '/search/%s/feed/rss2/' def movie(self, imdb, title, localtitle, aliases, year): try: url = {'imdb': imdb, 'title': title, 'year': year} url = urllib.urlencode(url) return url except: return def sources(self, url, hostDict, hostprDict): try: sources = [] if url == None: return sources data = urlparse.parse_qs(url) data = dict([(i, data[i][0]) if data[i] else (i, '') for i in data]) title = data['tvshowtitle'] if 'tvshowtitle' in data else data['title'] hdlr = 'S%02dE%02d' % (int(data['season']), int(data['episode'])) if 'tvshowtitle' in data else data['year'] query = '%s S%02dE%02d' % (data['tvshowtitle'], int(data['season']), int(data['episode'])) if 'tvshowtitle' in data else '%s' % (data['title']) query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', ' ', query) url = self.search_link % urllib.quote_plus(query) url = urlparse.urljoin(self.base_link, url) r = client.request(url) posts = client.parseDOM(r, 'item') items = [] for post in posts: try: t = client.parseDOM(post, 'title')[0] t2 = re.sub('(\.|\(|\[|\s)(\d{4}|S\d*E\d*|S\d*|3D)(\.|\)|\]|\s|)(.+|)', '', t) if not cleantitle.get_simple(t2.replace('Watch Online','')) == cleantitle.get(title): raise Exception() l = client.parseDOM(post, 'link')[0] p = client.parseDOM(post, 'pubDate')[0] if data['year'] in p: items += [(t, l)] except: pass print items for item in items: try: name = item[0] name = client.replaceHTMLCodes(name) u = client.request(item[1]) if 'http://www.imdb.com/title/%s/' % data['imdb'] in u: l = client.parseDOM(u, 'div', {'class': 'movieplay'})[0] l = client.parseDOM(u, 'iframe', ret='data-lazy-src')[0] quality, info = source_utils.get_release_quality(name, l) info = ' | '.join(info) url = l url = client.replaceHTMLCodes(url) url = url.encode('utf-8') valid, host = source_utils.is_host_valid(url,hostDict) sources.append({'source': host, 'quality': quality, 'language': 'en', 'url': url, 'info': info, 'direct': False, 'debridonly': False}) except: pass return sources except: return sources def resolve(self, url): return url
TheWardoctor/Wardoctors-repo
script.module.fantastic/lib/resources/lib/sources/en/movie4kis.py
Python
apache-2.0
4,184
# All-Terrain-Life-Vest All Terrain Life Vest- IEA Raspverry Pi Competition Entry # Description import RPi.GPIO as GPIO import time import os GPIO.setmode (GPIO.BCM) GPIO.cleanup() GPIO.setwarnings(False) GPIO.setup(17,GPIO.OUT) GPIO.setup(04,GPIO.OUT) GPIO.setup(22, GPIO.IN) print("---------------") print("Button+GPIO") print("---------------") print GPIO.input(22) while True: if(GPIO.input(22)==False): GPIO.output(17,GPIO.HIGH) GPIO.output(04,GPIO.HIGH) print("air bag activated") os.system('date') print GPIO.input(22) time.sleep(1) GPIO.output(17,GPIO.LOW) GPIO.output(04,GPIO.LOW) else: os.system('clear') print("air bag NOT activated") time.sleep(1)
8acs2016/All-Terrain-Life-Vest
code.py
Python
apache-2.0
762
/* * Name: $RCSfile: BaseRelativeLayout.java,v $ * Version: $Revision: 1.1 $ * Date: $Date: Nov 14, 2011 5:36:00 PM $ * * Copyright (C) 2011 COMPANY_NAME, Inc. All rights reserved. */ package mdn.vtvsport.common; import android.app.Activity; import android.content.Context; import android.util.AttributeSet; import android.view.LayoutInflater; import android.widget.RelativeLayout; /** * BaseRelativeLayout * * @author Quan */ public class BaseRelativeLayout extends RelativeLayout { /** * Constructor * * @param context */ public BaseRelativeLayout(Context context) { super(context); } /** * Constructor * * @param context * @param attrs */ public BaseRelativeLayout(Context context, AttributeSet attrs) { super(context, attrs); } /** * Initial inflater layout * * @param reID * @param context */ protected void initLayout(Context context, int reID) { LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); layoutInflater.inflate(reID, this, true); } /** * Get parent activity * * @return */ public Activity getActivity() { return (Activity) this.getContext(); } }
ribbon-xx/VTVPro-Plus
VtvPro/src/mdn/vtvsport/common/BaseRelativeLayout.java
Java
apache-2.0
1,325
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.5.0_22) on Wed May 30 16:47:58 EEST 2012 --> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <TITLE> ComponentResolvers.ResolverFilter (Wicket Parent 1.5.7 API) </TITLE> <META NAME="keywords" CONTENT="org.apache.wicket.markup.resolver.ComponentResolvers.ResolverFilter interface"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { parent.document.title="ComponentResolvers.ResolverFilter (Wicket Parent 1.5.7 API)"; } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/ComponentResolvers.ResolverFilter.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;<A HREF="../../../../../org/apache/wicket/markup/resolver/ComponentResolvers.html" title="class in org.apache.wicket.markup.resolver"><B>PREV CLASS</B></A>&nbsp; &nbsp;<A HREF="../../../../../org/apache/wicket/markup/resolver/FragmentResolver.html" title="class in org.apache.wicket.markup.resolver"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../index.html?org/apache/wicket/markup/resolver/ComponentResolvers.ResolverFilter.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="ComponentResolvers.ResolverFilter.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <!-- ======== START OF CLASS DATA ======== --> <H2> <FONT SIZE="-1"> org.apache.wicket.markup.resolver</FONT> <BR> Interface ComponentResolvers.ResolverFilter</H2> <DL> <DT><B>Enclosing class:</B><DD><A HREF="../../../../../org/apache/wicket/markup/resolver/ComponentResolvers.html" title="class in org.apache.wicket.markup.resolver">ComponentResolvers</A></DD> </DL> <HR> <DL> <DT><PRE>public static interface <B>ComponentResolvers.ResolverFilter</B></DL> </PRE> <P> <HR> <P> <!-- ========== METHOD SUMMARY =========== --> <A NAME="method_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Method Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;boolean</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/apache/wicket/markup/resolver/ComponentResolvers.ResolverFilter.html#ignoreResolver(org.apache.wicket.markup.resolver.IComponentResolver)">ignoreResolver</A></B>(<A HREF="../../../../../org/apache/wicket/markup/resolver/IComponentResolver.html" title="interface in org.apache.wicket.markup.resolver">IComponentResolver</A>&nbsp;resolver)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp; <P> <!-- ============ METHOD DETAIL ========== --> <A NAME="method_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Method Detail</B></FONT></TH> </TR> </TABLE> <A NAME="ignoreResolver(org.apache.wicket.markup.resolver.IComponentResolver)"><!-- --></A><H3> ignoreResolver</H3> <PRE> boolean <B>ignoreResolver</B>(<A HREF="../../../../../org/apache/wicket/markup/resolver/IComponentResolver.html" title="interface in org.apache.wicket.markup.resolver">IComponentResolver</A>&nbsp;resolver)</PRE> <DL> <DD><DL> <DT><B>Parameters:</B><DD><CODE>resolver</CODE> - <DT><B>Returns:</B><DD>true, if resolvers should be skipped</DL> </DD> </DL> <!-- ========= END OF CLASS DATA ========= --> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/ComponentResolvers.ResolverFilter.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;<A HREF="../../../../../org/apache/wicket/markup/resolver/ComponentResolvers.html" title="class in org.apache.wicket.markup.resolver"><B>PREV CLASS</B></A>&nbsp; &nbsp;<A HREF="../../../../../org/apache/wicket/markup/resolver/FragmentResolver.html" title="class in org.apache.wicket.markup.resolver"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../index.html?org/apache/wicket/markup/resolver/ComponentResolvers.ResolverFilter.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="ComponentResolvers.ResolverFilter.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> Copyright &#169; 2006-2012 <a href="http://apache.org">Apache Software Foundation</a>. All Rights Reserved. </BODY> </HTML>
afiantara/apache-wicket-1.5.7
apidocs/org/apache/wicket/markup/resolver/ComponentResolvers.ResolverFilter.html
HTML
apache-2.0
9,417
/* * 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.ignite.internal.processors.query.h2.sys.view; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.UUID; import org.apache.ignite.cluster.ClusterNode; import org.apache.ignite.internal.GridKernalContext; import org.apache.ignite.internal.util.typedef.F; import org.h2.engine.Session; import org.h2.result.Row; import org.h2.result.SearchRow; import org.h2.value.Value; /** * System view: nodes. */ public class SqlSystemViewNodes extends SqlAbstractLocalSystemView { /** * @param ctx Grid context. */ public SqlSystemViewNodes(GridKernalContext ctx) { super("NODES", "Topology nodes", ctx, new String[] {"ID", "IS_LOCAL"}, newColumn("ID", Value.UUID), newColumn("CONSISTENT_ID"), newColumn("VERSION"), newColumn("IS_LOCAL", Value.BOOLEAN), newColumn("IS_CLIENT", Value.BOOLEAN), newColumn("IS_DAEMON", Value.BOOLEAN), newColumn("NODE_ORDER", Value.INT), newColumn("ADDRESSES"), newColumn("HOSTNAMES") ); } /** {@inheritDoc} */ @Override public Iterator<Row> getRows(Session ses, SearchRow first, SearchRow last) { List<Row> rows = new ArrayList<>(); Collection<ClusterNode> nodes; SqlSystemViewColumnCondition locCond = conditionForColumn("IS_LOCAL", first, last); SqlSystemViewColumnCondition idCond = conditionForColumn("ID", first, last); if (locCond.isEquality() && locCond.valueForEquality().getBoolean()) nodes = Collections.singleton(ctx.discovery().localNode()); else if (idCond.isEquality()) { UUID nodeId = uuidFromValue(idCond.valueForEquality()); nodes = nodeId == null ? Collections.emptySet() : Collections.singleton(ctx.discovery().node(nodeId)); } else nodes = F.concat(false, ctx.discovery().allNodes(), ctx.discovery().daemonNodes()); for (ClusterNode node : nodes) { if (node != null) rows.add( createRow(ses, rows.size(), node.id(), node.consistentId(), node.version(), node.isLocal(), node.isClient(), node.isDaemon(), node.order(), node.addresses(), node.hostNames() ) ); } return rows.iterator(); } /** {@inheritDoc} */ @Override public boolean canGetRowCount() { return true; } /** {@inheritDoc} */ @Override public long getRowCount() { return ctx.discovery().allNodes().size() + ctx.discovery().daemonNodes().size(); } }
sk0x50/ignite
modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sys/view/SqlSystemViewNodes.java
Java
apache-2.0
3,717
import urllib from flask import Flask, Response, abort, request, send_file from flask_restful import Resource, Api from flask_cors import CORS, cross_origin import datetime import json import vacker.file_factory app = Flask(__name__) api = Api(app) file_factory = vacker.file_factory.FileFactory() CORS(app, resources={"*": {"origins": "*"}}) class Stats(Resource): def get(self, query_string): pass class Search(Resource): def get(self): res = file_factory.query_files( query_string=request.args.get('q', ''), start=request.args.get('start', 0), limit=request.args.get('limit', 10), sort=request.args.get('sort_field', None), sort_dir=('asc' if request.args.get('sort_order', '1') == '1' else 'desc')) for file_ in res['files']: file_['blob_url'] = '/blob/' + urllib.parse.quote(file_['id']) return { 'data': [file_ for file_ in res['files']], 'recordsTotal': res['total_results'], 'recordsFiltered': res['total_results'] } class Blob(Resource): def get(self, file_id): file_ = file_factory.get_file_by_id(file_id) parent = file_.get('a_parent_archive') if parent: return send_file(parent) return send_file(file_.get_path()) # Year API api.add_resource(Stats, '/stats/<string:query_string>') api.add_resource(Search, '/search') #api.add_resource(Blob, '/blob/<string:file_id>')
MatthewJohn/vacker
vacker/server.py
Python
apache-2.0
1,498
<!DOCTYPE HTML> <!-- Eventually by HTML5 UP html5up.net | @ajlkn Free for personal and commercial use under the CCA 3.0 license (html5up.net/license) --> <html> <head> <title>Login</title> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" /> <!--[if lte IE 8]><script src="assets/js/ie/html5shiv.js"></script><![endif]--> <!-- <link rel="stylesheet" href="assets/css/main.css" /> --> <link rel="stylesheet" type="text/css" href="<?php echo base_url() ?>assets/login/css/main.css" /> <link rel="stylesheet" type="text/css" href="<?php echo base_url() ?>assets/main/css/bootstrap.css" /> <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Roboto:400,100,300,500"> <link rel="stylesheet" href="<?php echo base_url() ?>assets/login/temp/font-awesome/css/font-awesome.min.css"> <link rel="stylesheet" href="<?php echo base_url() ?>assets/login/temp/css/form-elements.css"> <link rel="stylesheet" href="<?php echo base_url() ?>assets/login/temp/css/style.css"> <script src="<?php echo base_url() ?>assets\main\js\jquery-1.9.0.min.js"></script> <script src="<?php echo base_url() ?>assets\main\js\bootstrap.js"></script> <!--[if lte IE 8]><link rel="stylesheet" href="assets/css/ie8.css" /><![endif]--> <!--[if lte IE 9]><link rel="stylesheet" href="assets/css/ie9.css" /><![endif]--> <!-- pavithra's code --> <link rel="stylesheet" type="text/css" href="<?php echo base_url() ?>assets\pavithra\pavithrastyle.css" /> <style> ::-webkit-input-placeholder { /* WebKit, Blink, Edge */ color: black!important; } :-moz-placeholder { /* Mozilla Firefox 4 to 18 */ color: black!important; opacity: 1; } ::-moz-placeholder { /* Mozilla Firefox 19+ */ color: black!important; opacity: 1; } :-ms-input-placeholder { /* Internet Explorer 10-11 */ color: black!important; } .social-login-buttons a:hover{ color: white !important; } </style> </head> <body class="P_body" style="overflow-y: hidden;"> <!-- Top content --> <div class="top-content"> <div class="inner-bg"> <div class="container"> <div class="row"> <div class="col-sm-8 col-sm-offset-2 text"> <h1><strong>BEAUTIFUL SRI LANKA</strong> </h1> <div class="description"> <p> Our pick of where to go in Sri lanaka in the next 12 month </p> </div> </div> </div> <div class="row"> <div class="col-sm-6 col-sm-offset-3 form-box"> <div class="form-top"> <div class="form-top-left"> <h3>Login to our site</h3> <p>Enter your email and password to log on:</p> </div> <div class="form-top-right"> <i class="fa fa-lock"></i> </div> </div> <div class="form-bottom"> <form role="form" action="#" method="post" class="login-form"> <div class="form-group"> <label class="sr-only" for="form-username">Username</label> <input type="text" name="form-username" placeholder="Email..." class="form-username form-control" id="form-username"> </div> <div class="form-group"> <label class="sr-only" for="form-password">Password</label> <input type="password" name="form-password" placeholder="Password..." class="form-password form-control" id="form-password"> </div> <button type="submit" class="btn">Sign in!</button> <div class="text-center"> <br> Forgot your password? &nbsp; <a href="#" > Click here to reset it. </a> <br> Don't you have an account? &nbsp; <a href="<?php echo base_url(); ?>index.php/register" > Sign up <a/> <br> <div style="color:red;"> <b></b> <?php echo $error; ?></b> </div> </div> </form> </div> </div> </div> <div class="row"> <div class="col-sm-6 col-sm-offset-3 social-login"> <h3>...or login with:</h3> <div class="social-login-buttons"> <a class="btn btn-link-1 btn-link-1-facebook" href="#"> <i class="fa fa-facebook"></i> Facebook </a> <a class="btn btn-link-1 btn-link-1-twitter" href="#"> <i class="fa fa-twitter"></i> Twitter </a> <a class="btn btn-link-1 btn-link-1-google-plus" href="#"> <i class="fa fa-google-plus"></i> Google Plus </a> </div> </div> </div> </div> </div> </div> <!-- Scripts --> <!--[if lte IE 8]><script src="assets/js/ie/respond.min.js"></script><![endif]--> <script src="<?php echo base_url() ?>assets\login\js\main.js"></script> </body> </html>
sepProjectTeam/TourismApplication
sep_ii_pro/application/views/login/login.php
PHP
apache-2.0
5,910
# Copyright 2019 The TensorFlow Authors. 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. # ============================================================================== """Model defination for the RetinaNet Model.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import collections import numpy as np from absl import logging import tensorflow.compat.v2 as tf from tensorflow.python.keras import backend from official.vision.detection.dataloader import mode_keys from official.vision.detection.evaluation import factory as eval_factory from official.vision.detection.modeling import base_model from official.vision.detection.modeling import losses from official.vision.detection.modeling.architecture import factory from official.vision.detection.ops import postprocess_ops class RetinanetModel(base_model.Model): """RetinaNet model function.""" def __init__(self, params): super(RetinanetModel, self).__init__(params) # For eval metrics. self._params = params # Architecture generators. self._backbone_fn = factory.backbone_generator(params) self._fpn_fn = factory.multilevel_features_generator(params) self._head_fn = factory.retinanet_head_generator(params.retinanet_head) # Loss function. self._cls_loss_fn = losses.RetinanetClassLoss(params.retinanet_loss) self._box_loss_fn = losses.RetinanetBoxLoss(params.retinanet_loss) self._box_loss_weight = params.retinanet_loss.box_loss_weight self._keras_model = None # Predict function. self._generate_detections_fn = postprocess_ops.MultilevelDetectionGenerator( params.postprocess) self._transpose_input = params.train.transpose_input assert not self._transpose_input, 'Transpose input is not supportted.' # Input layer. input_shape = ( params.retinanet_parser.output_size + [params.retinanet_parser.num_channels]) self._input_layer = tf.keras.layers.Input( shape=input_shape, name='', dtype=tf.bfloat16 if self._use_bfloat16 else tf.float32) def build_outputs(self, inputs, mode): # If the input image is transposed (from NHWC to HWCN), we need to revert it # back to the original shape before it's used in the computation. if self._transpose_input: inputs = tf.transpose(inputs, [3, 0, 1, 2]) backbone_features = self._backbone_fn( inputs, is_training=(mode == mode_keys.TRAIN)) fpn_features = self._fpn_fn( backbone_features, is_training=(mode == mode_keys.TRAIN)) cls_outputs, box_outputs = self._head_fn( fpn_features, is_training=(mode == mode_keys.TRAIN)) if self._use_bfloat16: levels = cls_outputs.keys() for level in levels: cls_outputs[level] = tf.cast(cls_outputs[level], tf.float32) box_outputs[level] = tf.cast(box_outputs[level], tf.float32) model_outputs = { 'cls_outputs': cls_outputs, 'box_outputs': box_outputs, } return model_outputs def build_loss_fn(self): if self._keras_model is None: raise ValueError('build_loss_fn() must be called after build_model().') filter_fn = self.make_filter_trainable_variables_fn() trainable_variables = filter_fn(self._keras_model.trainable_variables) def _total_loss_fn(labels, outputs): cls_loss = self._cls_loss_fn(outputs['cls_outputs'], labels['cls_targets'], labels['num_positives']) box_loss = self._box_loss_fn(outputs['box_outputs'], labels['box_targets'], labels['num_positives']) model_loss = cls_loss + self._box_loss_weight * box_loss l2_regularization_loss = self.weight_decay_loss(self._l2_weight_decay, trainable_variables) total_loss = model_loss + l2_regularization_loss return { 'total_loss': total_loss, 'cls_loss': cls_loss, 'box_loss': box_loss, 'model_loss': model_loss, 'l2_regularization_loss': l2_regularization_loss, } return _total_loss_fn def build_model(self, params, mode=None): if self._keras_model is None: with backend.get_graph().as_default(): outputs = self.model_outputs(self._input_layer, mode) model = tf.keras.models.Model( inputs=self._input_layer, outputs=outputs, name='retinanet') assert model is not None, 'Fail to build tf.keras.Model.' model.optimizer = self.build_optimizer() self._keras_model = model return self._keras_model def post_processing(self, labels, outputs): # TODO(yeqing): Moves the output related part into build_outputs. required_output_fields = ['cls_outputs', 'box_outputs'] for field in required_output_fields: if field not in outputs: raise ValueError('"%s" is missing in outputs, requried %s found %s', field, required_output_fields, outputs.keys()) required_label_fields = ['image_info', 'groundtruths'] for field in required_label_fields: if field not in labels: raise ValueError('"%s" is missing in outputs, requried %s found %s', field, required_label_fields, labels.keys()) boxes, scores, classes, valid_detections = self._generate_detections_fn( outputs['box_outputs'], outputs['cls_outputs'], labels['anchor_boxes'], labels['image_info'][:, 1:2, :]) # Discards the old output tensors to save memory. The `cls_outputs` and # `box_outputs` are pretty big and could potentiall lead to memory issue. outputs = { 'source_id': labels['groundtruths']['source_id'], 'image_info': labels['image_info'], 'num_detections': valid_detections, 'detection_boxes': boxes, 'detection_classes': classes, 'detection_scores': scores, } if 'groundtruths' in labels: labels['source_id'] = labels['groundtruths']['source_id'] labels['boxes'] = labels['groundtruths']['boxes'] labels['classes'] = labels['groundtruths']['classes'] labels['areas'] = labels['groundtruths']['areas'] labels['is_crowds'] = labels['groundtruths']['is_crowds'] return labels, outputs def eval_metrics(self): return eval_factory.evaluator_generator(self._params.eval)
alexgorban/models
official/vision/detection/modeling/retinanet_model.py
Python
apache-2.0
6,957
import logging from boto3.resources.factory import ResourceFactory from boto3.resources.model import ResourceModel from boto3.resources.base import ResourceMeta from boto3.docs import docstring from boto3.exceptions import ResourceLoadException from boto3.resources.factory import build_identifiers from functools import partial from aioboto3.resources.collection import AIOCollectionFactory from aioboto3.resources.action import AIOServiceAction, AIOWaiterAction from aioboto3.resources.base import AIOBoto3ServiceResource logger = logging.getLogger(__name__) class AIOBoto3ResourceFactory(ResourceFactory): # noinspection PyMissingConstructor def __init__(self, emitter): self._collection_factory = AIOCollectionFactory() self._emitter = emitter async def load_from_definition(self, resource_name, single_resource_json_definition, service_context): logger.debug('Loading %s:%s', service_context.service_name, resource_name) # Using the loaded JSON create a ResourceModel object. resource_model = ResourceModel( resource_name, single_resource_json_definition, service_context.resource_json_definitions ) # Do some renaming of the shape if there was a naming collision # that needed to be accounted for. shape = None if resource_model.shape: shape = service_context.service_model.shape_for( resource_model.shape) resource_model.load_rename_map(shape) # Set some basic info meta = ResourceMeta( service_context.service_name, resource_model=resource_model) attrs = { 'meta': meta, } # Create and load all of attributes of the resource class based # on the models. # Identifiers self._load_identifiers( attrs=attrs, meta=meta, resource_name=resource_name, resource_model=resource_model ) # Load/Reload actions self._load_actions( attrs=attrs, resource_name=resource_name, resource_model=resource_model, service_context=service_context ) # Attributes that get auto-loaded self._load_attributes( attrs=attrs, meta=meta, resource_name=resource_name, resource_model=resource_model, service_context=service_context) # Collections and their corresponding methods self._load_collections( attrs=attrs, resource_model=resource_model, service_context=service_context) # References and Subresources self._load_has_relations( attrs=attrs, resource_name=resource_name, resource_model=resource_model, service_context=service_context ) # Waiter resource actions self._load_waiters( attrs=attrs, resource_name=resource_name, resource_model=resource_model, service_context=service_context ) # Create the name based on the requested service and resource cls_name = resource_name if service_context.service_name == resource_name: cls_name = 'ServiceResource' cls_name = service_context.service_name + '.' + cls_name base_classes = [AIOBoto3ServiceResource] if self._emitter is not None: await self._emitter.emit( 'creating-resource-class.%s' % cls_name, class_attributes=attrs, base_classes=base_classes, service_context=service_context) return type(str(cls_name), tuple(base_classes), attrs) def _create_autoload_property(factory_self, resource_name, name, snake_cased, member_model, service_context): """ Creates a new property on the resource to lazy-load its value via the resource's ``load`` method (if it exists). """ # The property loader will check to see if this resource has already # been loaded and return the cached value if possible. If not, then # it first checks to see if it CAN be loaded (raise if not), then # calls the load before returning the value. async def property_loader(self): if self.meta.data is None: if hasattr(self, 'load'): await self.load() else: raise ResourceLoadException( '{0} has no load method'.format( self.__class__.__name__)) return self.meta.data.get(name) property_loader.__name__ = str(snake_cased) property_loader.__doc__ = docstring.AttributeDocstring( service_name=service_context.service_name, resource_name=resource_name, attr_name=snake_cased, event_emitter=factory_self._emitter, attr_model=member_model, include_signature=False ) return property(property_loader) def _create_waiter(factory_self, resource_waiter_model, resource_name, service_context): """ Creates a new wait method for each resource where both a waiter and resource model is defined. """ waiter = AIOWaiterAction(resource_waiter_model, waiter_resource_name=resource_waiter_model.name) async def do_waiter(self, *args, **kwargs): await waiter(self, *args, **kwargs) do_waiter.__name__ = str(resource_waiter_model.name) do_waiter.__doc__ = docstring.ResourceWaiterDocstring( resource_name=resource_name, event_emitter=factory_self._emitter, service_model=service_context.service_model, resource_waiter_model=resource_waiter_model, service_waiter_model=service_context.service_waiter_model, include_signature=False ) return do_waiter def _create_class_partial(factory_self, subresource_model, resource_name, service_context): """ Creates a new method which acts as a functools.partial, passing along the instance's low-level `client` to the new resource class' constructor. """ name = subresource_model.resource.type async def create_resource(self, *args, **kwargs): # We need a new method here because we want access to the # instance's client. positional_args = [] # We lazy-load the class to handle circular references. json_def = service_context.resource_json_definitions.get(name, {}) resource_cls = await factory_self.load_from_definition( resource_name=name, single_resource_json_definition=json_def, service_context=service_context ) # Assumes that identifiers are in order, which lets you do # e.g. ``sqs.Queue('foo').Message('bar')`` to create a new message # linked with the ``foo`` queue and which has a ``bar`` receipt # handle. If we did kwargs here then future positional arguments # would lead to failure. identifiers = subresource_model.resource.identifiers if identifiers is not None: for identifier, value in build_identifiers(identifiers, self): positional_args.append(value) return partial(resource_cls, *positional_args, client=self.meta.client)(*args, **kwargs) create_resource.__name__ = str(name) create_resource.__doc__ = docstring.SubResourceDocstring( resource_name=resource_name, sub_resource_model=subresource_model, service_model=service_context.service_model, include_signature=False ) return create_resource def _create_action(factory_self, action_model, resource_name, service_context, is_load=False): """ Creates a new method which makes a request to the underlying AWS service. """ # Create the action in in this closure but before the ``do_action`` # method below is invoked, which allows instances of the resource # to share the ServiceAction instance. action = AIOServiceAction( action_model, factory=factory_self, service_context=service_context ) # A resource's ``load`` method is special because it sets # values on the resource instead of returning the response. if is_load: # We need a new method here because we want access to the # instance via ``self``. async def do_action(self, *args, **kwargs): response = await action(self, *args, **kwargs) self.meta.data = response # Create the docstring for the load/reload mehtods. lazy_docstring = docstring.LoadReloadDocstring( action_name=action_model.name, resource_name=resource_name, event_emitter=factory_self._emitter, load_model=action_model, service_model=service_context.service_model, include_signature=False ) else: # We need a new method here because we want access to the # instance via ``self``. async def do_action(self, *args, **kwargs): response = await action(self, *args, **kwargs) if hasattr(self, 'load'): # Clear cached data. It will be reloaded the next # time that an attribute is accessed. # TODO: Make this configurable in the future? self.meta.data = None return response lazy_docstring = docstring.ActionDocstring( resource_name=resource_name, event_emitter=factory_self._emitter, action_model=action_model, service_model=service_context.service_model, include_signature=False ) do_action.__name__ = str(action_model.name) do_action.__doc__ = lazy_docstring return do_action
terrycain/aioboto3
aioboto3/resources/factory.py
Python
apache-2.0
10,415
# Thelypteris fadenii Fosb. & Sachet SPECIES #### Status ACCEPTED #### According to International Plant Names Index #### Published in null #### Original name null ### Remarks null
mdoering/backbone
life/Plantae/Pteridophyta/Polypodiopsida/Polypodiales/Thelypteridaceae/Thelypteris/Thelypteris fadenii/README.md
Markdown
apache-2.0
184
# Caraipa richardiana var. typica Wawra VARIETY #### Status ACCEPTED #### According to International Plant Names Index #### Published in null #### Original name null ### Remarks null
mdoering/backbone
life/Plantae/Magnoliophyta/Magnoliopsida/Malpighiales/Clusiaceae/Caraipa/Caraipa richardiana/Caraipa richardiana typica/README.md
Markdown
apache-2.0
187
# Crotalaria homblei De Wild. SPECIES #### Status ACCEPTED #### According to International Plant Names Index #### Published in null #### Original name null ### Remarks null
mdoering/backbone
life/Plantae/Magnoliophyta/Magnoliopsida/Fabales/Fabaceae/Crotalaria/Crotalaria homblei/README.md
Markdown
apache-2.0
177
# Masakia yoshinagae (Makino) Nakai SPECIES #### Status ACCEPTED #### According to International Plant Names Index #### Published in null #### Original name null ### Remarks null
mdoering/backbone
life/Plantae/Rhodophyta/Florideophyceae/Corallinales/Corallinaceae/Masakiella/Masakia yoshinagae/README.md
Markdown
apache-2.0
183
# Pandanus cochleatus H.St.John SPECIES #### Status ACCEPTED #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
mdoering/backbone
life/Plantae/Magnoliophyta/Liliopsida/Pandanales/Pandanaceae/Pandanus/Pandanus cochleatus/README.md
Markdown
apache-2.0
187
# Aphanocapsa biformis A. Braun SPECIES #### Status ACCEPTED #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
mdoering/backbone
life/Bacteria/Cyanobacteria/Chroococcales/Merismopediaceae/Aphanocapsa/Aphanocapsa biformis/README.md
Markdown
apache-2.0
187
import deepFreeze from 'deep-freeze'; import { getUnreadByStream, getUnreadStreamTotal, getUnreadByPms, getUnreadPmsTotal, getUnreadByHuddles, getUnreadHuddlesTotal, getUnreadMentionsTotal, getUnreadTotal, getUnreadStreamsAndTopics, getUnreadStreamsAndTopicsSansMuted, } from '../unreadSelectors'; const unreadStreamData = [ { stream_id: 0, topic: 'a topic', unread_message_ids: [1, 2, 3], }, { stream_id: 0, topic: 'another topic', unread_message_ids: [4, 5], }, { stream_id: 2, topic: 'some other topic', unread_message_ids: [6, 7], }, ]; const unreadPmsData = [ { sender_id: 0, unread_message_ids: [1, 2], }, { sender_id: 2, unread_message_ids: [3, 4, 5], }, ]; const unreadHuddlesData = [ { user_ids_string: '1,2,3', unread_message_ids: [1, 2], }, { user_ids_string: '4,5', unread_message_ids: [3, 4, 5], }, ]; const unreadMentionsData = [1, 2, 3]; describe('getUnreadByStream', () => { test('when no items in streams key, the result is an empty object', () => { const state = deepFreeze({ subscriptions: [], unread: { streams: [], }, }); const unreadByStream = getUnreadByStream(state); expect(unreadByStream).toEqual({}); }); test('when there are unread stream messages, returns a list with counts per stream_id ', () => { const state = deepFreeze({ subscriptions: [ { stream_id: 0, name: 'stream 0', in_home_view: true, }, { stream_id: 2, name: 'stream 2', in_home_view: true, }, ], unread: { streams: unreadStreamData, }, mute: [['stream 0', 'a topic']], }); const unreadByStream = getUnreadByStream(state); expect(unreadByStream).toEqual({ '0': 2, '2': 2 }); }); }); describe('getUnreadStreamTotal', () => { test('when no items in "streams" key, there are unread message', () => { const state = deepFreeze({ unread: { streams: [], }, subscriptions: [], mute: [], }); const unreadCount = getUnreadStreamTotal(state); expect(unreadCount).toEqual(0); }); test('count all the unread messages listed in "streams" key', () => { const state = deepFreeze({ unread: { streams: unreadStreamData, }, subscriptions: [ { stream_id: 0, in_home_view: true, }, { stream_id: 0, in_home_view: true, }, { stream_id: 2, in_home_view: true, }, ], mute: [], }); const unreadCount = getUnreadStreamTotal(state); expect(unreadCount).toEqual(7); }); }); describe('getUnreadByPms', () => { test('when no items in streams key, the result is an empty array', () => { const state = deepFreeze({ unread: { pms: [], }, }); const unreadByStream = getUnreadByPms(state); expect(unreadByStream).toEqual({}); }); test('when there are unread private messages, returns counts by sender_id', () => { const state = deepFreeze({ unread: { pms: unreadPmsData, }, }); const unreadByStream = getUnreadByPms(state); expect(unreadByStream).toEqual({ '0': 2, '2': 3 }); }); }); describe('getUnreadPmsTotal', () => { test('when no items in "pms" key, there are unread private messages', () => { const state = deepFreeze({ unread: { pms: [], }, }); const unreadCount = getUnreadPmsTotal(state); expect(unreadCount).toEqual(0); }); test('when there are keys in "pms", sum up all unread private message counts', () => { const state = deepFreeze({ unread: { pms: unreadPmsData, }, }); const unreadCount = getUnreadPmsTotal(state); expect(unreadCount).toEqual(5); }); }); describe('getUnreadByHuddles', () => { test('when no items in streams key, the result is an empty array', () => { const state = deepFreeze({ unread: { huddles: [], }, }); const unreadByStream = getUnreadByHuddles(state); expect(unreadByStream).toEqual({}); }); test('when there are unread stream messages, returns a ', () => { const state = deepFreeze({ unread: { huddles: unreadHuddlesData, }, }); const unreadByStream = getUnreadByHuddles(state); expect(unreadByStream).toEqual({ '1,2,3': 2, '4,5': 3 }); }); }); describe('getUnreadHuddlesTotal', () => { test('when no items in "huddles" key, there are unread group messages', () => { const state = deepFreeze({ unread: { huddles: [], }, }); const unreadCount = getUnreadHuddlesTotal(state); expect(unreadCount).toEqual(0); }); test('when there are keys in "huddles", sum up all unread group message counts', () => { const state = deepFreeze({ unread: { huddles: unreadHuddlesData, }, }); const unreadCount = getUnreadHuddlesTotal(state); expect(unreadCount).toEqual(5); }); }); describe('getUnreadMentionsTotal', () => { test('unread mentions count is equal to the unread array length', () => { const state = deepFreeze({ unread: { mentions: [1, 2, 3], }, }); const unreadCount = getUnreadMentionsTotal(state); expect(unreadCount).toEqual(3); }); }); describe('getUnreadTotal', () => { test('if no key has any items then no unread messages', () => { const state = deepFreeze({ unread: { streams: [], pms: [], huddles: [], mentions: [], }, subscriptions: [], mute: [], }); const unreadCount = getUnreadTotal(state); expect(unreadCount).toEqual(0); }); test('calculates total unread of streams + pms + huddles', () => { const state = deepFreeze({ unread: { streams: unreadStreamData, pms: unreadPmsData, huddles: unreadHuddlesData, mentions: unreadMentionsData, }, subscriptions: [ { stream_id: 0, in_home_view: true, }, { stream_id: 0, in_home_view: true, }, { stream_id: 2, in_home_view: true, }, ], mute: [], }); const unreadCount = getUnreadTotal(state); expect(unreadCount).toEqual(20); }); }); describe('getUnreadStreamsAndTopics', () => { test('if no key has any items then no unread messages', () => { const state = deepFreeze({ subscriptions: [], unread: { streams: [], }, }); const unreadCount = getUnreadStreamsAndTopics(state); expect(unreadCount).toEqual([]); }); test('muted streams are included', () => { const state = deepFreeze({ subscriptions: [ { stream_id: 0, name: 'stream 0', color: 'red', in_home_view: false, }, { stream_id: 2, name: 'stream 2', color: 'blue', in_home_view: false, }, ], unread: { streams: unreadStreamData, }, mute: [], }); const unreadCount = getUnreadStreamsAndTopics(state); expect(unreadCount).toEqual([ { color: 'red', data: [ { isMuted: false, key: 'another topic', lastUnreadMsgId: 5, topic: 'another topic', unread: 2, }, { isMuted: false, key: 'a topic', lastUnreadMsgId: 3, topic: 'a topic', unread: 3, }, ], isMuted: true, key: 'stream:stream 0', streamName: 'stream 0', unread: 5, }, { color: 'blue', data: [ { isMuted: false, key: 'some other topic', lastUnreadMsgId: 7, topic: 'some other topic', unread: 2, }, ], isMuted: true, key: 'stream:stream 2', streamName: 'stream 2', unread: 2, }, ]); }); test('muted topics inside non muted streams are included', () => { const state = deepFreeze({ subscriptions: [ { stream_id: 0, name: 'stream 0', color: 'red', in_home_view: true, }, { stream_id: 2, name: 'stream 2', color: 'blue', in_home_view: true, }, ], unread: { streams: unreadStreamData, }, mute: [['stream 0', 'a topic']], }); const unreadCount = getUnreadStreamsAndTopics(state); expect(unreadCount).toEqual([ { color: 'red', data: [ { isMuted: false, key: 'another topic', topic: 'another topic', unread: 2, lastUnreadMsgId: 5, }, { isMuted: true, key: 'a topic', topic: 'a topic', unread: 3, lastUnreadMsgId: 3, }, ], isMuted: false, isPrivate: undefined, key: 'stream:stream 0', streamName: 'stream 0', unread: 2, }, { color: 'blue', data: [ { isMuted: false, key: 'some other topic', lastUnreadMsgId: 7, topic: 'some other topic', unread: 2, }, ], isMuted: false, key: 'stream:stream 2', streamName: 'stream 2', unread: 2, }, ]); }); test('group data by stream and topics inside, count unread', () => { const state = deepFreeze({ subscriptions: [ { stream_id: 0, name: 'stream 0', color: 'red', in_home_view: true, }, { stream_id: 2, name: 'stream 2', color: 'blue', in_home_view: true, }, ], unread: { streams: unreadStreamData, }, mute: [], }); const unreadCount = getUnreadStreamsAndTopics(state); expect(unreadCount).toEqual([ { key: 'stream:stream 0', streamName: 'stream 0', color: 'red', unread: 5, isMuted: false, data: [ { key: 'another topic', topic: 'another topic', unread: 2, isMuted: false, lastUnreadMsgId: 5, }, { key: 'a topic', topic: 'a topic', unread: 3, isMuted: false, lastUnreadMsgId: 3 }, ], }, { key: 'stream:stream 2', streamName: 'stream 2', color: 'blue', unread: 2, isMuted: false, data: [ { key: 'some other topic', topic: 'some other topic', unread: 2, isMuted: false, lastUnreadMsgId: 7, }, ], }, ]); }); test('streams are sorted alphabetically, case-insensitive, topics by last activity, pinned stream on top', () => { const state = deepFreeze({ subscriptions: [ { stream_id: 2, color: 'green', name: 'def stream', in_home_view: true, invite_only: false, pin_to_top: false, }, { stream_id: 1, color: 'blue', name: 'xyz stream', in_home_view: true, invite_only: false, pin_to_top: true, }, { stream_id: 0, color: 'red', name: 'abc stream', in_home_view: true, invite_only: false, pin_to_top: false, }, ], unread: { streams: [ { stream_id: 0, topic: 'z topic', unread_message_ids: [1, 2, 3], }, { stream_id: 0, topic: 'a topic', unread_message_ids: [4, 5], }, { stream_id: 2, topic: 'b topic', unread_message_ids: [6, 7], }, { stream_id: 2, topic: 'c topic', unread_message_ids: [7, 8], }, { stream_id: 1, topic: 'e topic', unread_message_ids: [10], }, { stream_id: 1, topic: 'd topic', unread_message_ids: [9], }, ], }, mute: [['def stream', 'c topic']], }); const unreadCount = getUnreadStreamsAndTopics(state); expect(unreadCount).toEqual([ { key: 'stream:xyz stream', streamName: 'xyz stream', color: 'blue', isMuted: false, isPrivate: false, isPinned: true, unread: 2, data: [ { key: 'e topic', topic: 'e topic', unread: 1, isMuted: false, lastUnreadMsgId: 10 }, { key: 'd topic', topic: 'd topic', unread: 1, isMuted: false, lastUnreadMsgId: 9 }, ], }, { key: 'stream:abc stream', streamName: 'abc stream', color: 'red', isMuted: false, isPrivate: false, isPinned: false, unread: 5, data: [ { key: 'a topic', topic: 'a topic', unread: 2, isMuted: false, lastUnreadMsgId: 5 }, { key: 'z topic', topic: 'z topic', unread: 3, isMuted: false, lastUnreadMsgId: 3 }, ], }, { key: 'stream:def stream', streamName: 'def stream', color: 'green', isMuted: false, isPrivate: false, isPinned: false, unread: 2, data: [ { key: 'c topic', topic: 'c topic', unread: 2, isMuted: true, lastUnreadMsgId: 8 }, { key: 'b topic', topic: 'b topic', unread: 2, isMuted: false, lastUnreadMsgId: 7 }, ], }, ]); }); }); describe('getUnreadStreamsAndTopicsSansMuted', () => { test('muted streams are not included', () => { const state = deepFreeze({ subscriptions: [ { stream_id: 0, name: 'stream 0', color: 'red', in_home_view: false, }, { stream_id: 2, name: 'stream 2', color: 'blue', in_home_view: false, }, ], unread: { streams: unreadStreamData, }, mute: [], }); const unreadCount = getUnreadStreamsAndTopicsSansMuted(state); expect(unreadCount).toEqual([]); }); test('muted topics inside non muted streams are not included', () => { const state = deepFreeze({ subscriptions: [ { stream_id: 0, name: 'stream 0', color: 'red', in_home_view: true, }, ], unread: { streams: unreadStreamData, }, mute: [['stream 0', 'a topic']], }); const unreadCount = getUnreadStreamsAndTopicsSansMuted(state); expect(unreadCount).toEqual([ { color: 'red', data: [ { isMuted: false, key: 'another topic', topic: 'another topic', unread: 2, lastUnreadMsgId: 5, }, ], isMuted: false, isPrivate: undefined, key: 'stream:stream 0', streamName: 'stream 0', unread: 2, }, ]); }); });
vishwesh3/zulip-mobile
src/unread/__tests__/unreadSelectors-test.js
JavaScript
apache-2.0
15,573
package com.raxdenstudios.mvp.sample.login.presenter; import android.content.Context; import android.os.Bundle; import android.os.Handler; import com.raxdenstudios.mvp.sample.login.UserModel; import com.raxdenstudios.mvp.presenter.Presenter; import com.raxdenstudios.mvp.sample.login.view.ILoginFragmentView; public class LoginFragmentPresenter extends Presenter<ILoginFragmentView> implements ILoginFragmentPresenter { private UserModel mUserModel; public LoginFragmentPresenter(Context context) { super(context); } @Override public void onSave(Bundle outState) { super.onSave(outState); if (outState != null) { outState.putParcelable(UserModel.class.getSimpleName(), mUserModel); } } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (savedInstanceState != null && savedInstanceState .containsKey(UserModel.class.getSimpleName())) { mUserModel = savedInstanceState.getParcelable(UserModel.class.getSimpleName()); } } @Override public void login(String email, String password) { if (validateCredentials(email, password)) { retrieveUserData(email, password); } } private void retrieveUserData(final String email, final String password) { mView.showLoading("loading..."); { // this code simulate asynctask usecase... Handler handler = new Handler(); handler.postDelayed(new Runnable() { public void run() { mUserModel = new UserModel(); mUserModel.setEmail(email); mUserModel.setPassword(password); if (mView != null) { mView.userLogged(); mView.hideLoading(); } } }, 2000); } } private boolean validateCredentials(String email, String password) { if (email == null || email.length() == 0) { mView.showError("error", "email empty"); return false; } if (password == null || password.length() == 0) { mView.showError("error", "password empty"); return false; } return true; } }
raxden/AndroidMVP
sample/src/main/java/com/raxdenstudios/mvp/sample/login/presenter/LoginFragmentPresenter.java
Java
apache-2.0
2,353
/* * 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.commons.vfs2.provider.tar; import java.io.File; import java.io.IOException; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemManager; import org.apache.commons.vfs2.VFS; import org.junit.Assert; import org.junit.jupiter.api.Test; /** * test use DefaultFileSystemManager.createFileSystem method to create tar,tgz,tbz2 file system * * @since 2.7.0 **/ public class CreateFileSystemTest { private FileObject createFileSystem(final String testFilePath) throws IOException { final File testFile = new File(testFilePath); final FileSystemManager manager = VFS.getManager(); // create fileSystem and return fileObject try (FileObject localFileObject = manager.resolveFile(testFile.getAbsolutePath())) { return manager.createFileSystem(localFileObject); } } @Test public void testTarFile() throws IOException { final String testFilePath = "src/test/resources/test-data/test.tar"; try (FileObject fileObject = createFileSystem(testFilePath)) { Assert.assertTrue(fileObject instanceof TarFileObject); } } @Test public void testTbz2File() throws IOException { final String testFilePath = "src/test/resources/test-data/test.tbz2"; try (FileObject fileObject = createFileSystem(testFilePath)) { Assert.assertTrue(fileObject instanceof TarFileObject); } } @Test public void testTgzFile() throws IOException { final String testFilePath = "src/test/resources/test-data/test.tgz"; try (FileObject fileObject = createFileSystem(testFilePath)) { Assert.assertTrue(fileObject instanceof TarFileObject); } } }
apache/commons-vfs
commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/tar/CreateFileSystemTest.java
Java
apache-2.0
2,566
// Copyright 2021 Google LLC // // 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.google.api.ads.admanager.jaxws.v202105; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for FrequencyCapBehavior. * * <p>The following schema fragment specifies the expected content contained within this class. * <p> * <pre> * &lt;simpleType name="FrequencyCapBehavior"> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"> * &lt;enumeration value="TURN_ON"/> * &lt;enumeration value="TURN_OFF"/> * &lt;enumeration value="DEFER"/> * &lt;enumeration value="UNKNOWN"/> * &lt;/restriction> * &lt;/simpleType> * </pre> * */ @XmlType(name = "FrequencyCapBehavior") @XmlEnum public enum FrequencyCapBehavior { /** * * Turn on at least one of the frequency caps. * * */ TURN_ON, /** * * Turn off all frequency caps. * * */ TURN_OFF, /** * * Defer frequency cap decisions to the next ad rule in priority order. * * */ DEFER, /** * * The value returned if the actual value is not exposed by the requested API version. * * */ UNKNOWN; public String value() { return name(); } public static FrequencyCapBehavior fromValue(String v) { return valueOf(v); } }
googleads/googleads-java-lib
modules/dfp_appengine/src/main/java/com/google/api/ads/admanager/jaxws/v202105/FrequencyCapBehavior.java
Java
apache-2.0
2,058
# AUTOGENERATED FILE FROM balenalib/raspberrypi4-64-debian:buster-run ENV GO_VERSION 1.15.7 # gcc for cgo RUN apt-get update && apt-get install -y --no-install-recommends \ g++ \ gcc \ libc6-dev \ make \ pkg-config \ git \ && rm -rf /var/lib/apt/lists/* RUN set -x \ && fetchDeps=' \ curl \ ' \ && apt-get update && apt-get install -y $fetchDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ && mkdir -p /usr/local/go \ && curl -SLO "https://storage.googleapis.com/golang/go$GO_VERSION.linux-arm64.tar.gz" \ && echo "bca4af0c20f86521dfabf3b39fa2f1ceeeb11cebf7e90bdf1de2618c40628539 go$GO_VERSION.linux-arm64.tar.gz" | sha256sum -c - \ && tar -xzf "go$GO_VERSION.linux-arm64.tar.gz" -C /usr/local/go --strip-components=1 \ && rm -f go$GO_VERSION.linux-arm64.tar.gz ENV GOROOT /usr/local/go ENV GOPATH /go ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH" WORKDIR $GOPATH CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"] RUN curl -SLO "https://raw.githubusercontent.com/balena-io-library/base-images/8accad6af708fca7271c5c65f18a86782e19f877/scripts/assets/tests/test-stack@golang.sh" \ && echo "Running test-stack@golang" \ && chmod +x test-stack@golang.sh \ && bash test-stack@golang.sh \ && rm -rf test-stack@golang.sh RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo 'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: ARM v8 \nOS: Debian Buster \nVariant: run variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \nGo v1.15.7 \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info RUN echo '#!/bin/sh.real\nbalena-info\nrm -f /bin/sh\ncp /bin/sh.real /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \ && chmod +x /bin/sh-shim \ && cp /bin/sh /bin/sh.real \ && mv /bin/sh-shim /bin/sh
nghiant2710/base-images
balena-base-images/golang/raspberrypi4-64/debian/buster/1.15.7/run/Dockerfile
Dockerfile
apache-2.0
2,330
<?php /** * Functions related to the OpenID Consumer. */ // hooks for getting user data add_filter( 'openid_auth_request_extensions', 'openid_add_sreg_extension', 10, 2 ); add_filter( 'openid_auth_request_extensions', 'openid_add_ax_extension', 10, 2 ); add_filter( 'xrds_simple', 'openid_consumer_xrds_simple' ); /** * Get the internal OpenID Consumer object. If it is not already initialized, do so. * * @return Auth_OpenID_Consumer OpenID consumer object */ function openid_getConsumer() { // phpcs:ignore static $consumer; if ( ! $consumer ) { require_once 'Auth/OpenID/Consumer.php'; $store = openid_getStore(); $consumer = new Auth_OpenID_Consumer( $store ); if ( null === $consumer ) { openid_error( 'OpenID consumer could not be created properly.' ); openid_enabled( false ); } } return $consumer; } /** * Send the user to their OpenID provider to authenticate. * * @param Auth_OpenID_AuthRequest $auth_request OpenID authentication request object * @param string $trust_root OpenID trust root * @param string $return_to URL where the OpenID provider should return the user */ function openid_redirect( $auth_request, $trust_root, $return_to ) { do_action( 'openid_redirect', $auth_request, $trust_root, $return_to ); $message = $auth_request->getMessage( $trust_root, $return_to, false ); if ( Auth_OpenID::isFailure( $message ) ) { return openid_error( 'Could not redirect to server: ' . $message->message ); } $_SESSION['openid_return_to'] = $message->getArg( Auth_OpenID_OPENID_NS, 'return_to' ); // send 302 redirect or POST if ( $auth_request->shouldSendRedirect() ) { $redirect_url = $auth_request->redirectURL( $trust_root, $return_to ); wp_redirect( $redirect_url ); } else { openid_repost( $auth_request->endpoint->server_url, $message->toPostArgs() ); } } /** * Finish OpenID Authentication. * * @return String authenticated identity URL, or null if authentication failed. */ function finish_openid_auth() { @session_start(); $consumer = openid_getConsumer(); if ( array_key_exists( 'openid_return_to', $_SESSION ) ) { $openid_return_to = $_SESSION['openid_return_to']; } if ( empty( $openid_return_to ) ) { $openid_return_to = openid_service_url( 'consumer' ); } $response = $consumer->complete( $openid_return_to ); unset( $_SESSION['openid_return_to'] ); openid_response( $response ); switch ( $response->status ) { case Auth_OpenID_CANCEL: openid_message( __( 'OpenID login was cancelled.', 'openid' ) ); openid_status( 'error' ); break; case Auth_OpenID_FAILURE: openid_message( sprintf( __( 'OpenID login failed: %s', 'openid' ), $response->message ) ); openid_status( 'error' ); break; case Auth_OpenID_SUCCESS: openid_message( __( 'OpenID login successful', 'openid' ) ); openid_status( 'success' ); $identity_url = $response->identity_url; $escaped_url = htmlspecialchars( $identity_url, ENT_QUOTES ); return $escaped_url; default: openid_message( __( 'Unknown Status. Bind not successful. This is probably a bug.', 'openid' ) ); openid_status( 'error' ); } return null; } /** * Begin login by activating the OpenID consumer. * * @param string $url claimed ID * @return Auth_OpenID_Request OpenID Request */ function openid_begin_consumer( $url ) { static $request; @session_start(); if ( null == $request ) { set_error_handler( 'openid_customer_error_handler' ); $consumer = openid_getConsumer(); $request = $consumer->begin( $url ); restore_error_handler(); } return $request; } /** * Start the OpenID authentication process. * * @param string $claimed_url claimed OpenID URL * @param string $action OpenID action being performed * @param string $finish_url stored in user session for later redirect * @uses apply_filters() Calls 'openid_auth_request_extensions' to gather extensions to be attached to auth request */ function openid_start_login( $claimed_url, $action, $finish_url = null ) { if ( empty( $claimed_url ) ) { return; // do nothing. } $auth_request = openid_begin_consumer( $claimed_url ); if ( null === $auth_request ) { openid_status( 'error' ); openid_message(sprintf( __( 'Could not discover an OpenID identity server endpoint at the url: %s', 'openid' ), htmlentities( $claimed_url ) )); return; } @session_start(); $_SESSION['openid_action'] = $action; $_SESSION['openid_finish_url'] = $finish_url; $extensions = apply_filters( 'openid_auth_request_extensions', array(), $auth_request ); foreach ( $extensions as $e ) { if ( is_a( $e, 'Auth_OpenID_Extension' ) ) { $auth_request->addExtension( $e ); } } $return_to = openid_service_url( 'consumer', 'login_post' ); $return_to = apply_filters( 'openid_return_to', $return_to ); $trust_root = openid_trust_root( $return_to ); openid_redirect( $auth_request, $trust_root, $return_to ); exit( 0 ); } /** * Build an Attribute Exchange attribute query extension if we've never seen this OpenID before. */ function openid_add_ax_extension( $extensions, $auth_request ) { if ( ! get_user_by_openid( $auth_request->endpoint->claimed_id ) ) { require_once( 'Auth/OpenID/AX.php' ); if ( $auth_request->endpoint->usesExtension( Auth_OpenID_AX_NS_URI ) ) { $default_fields = array( Auth_OpenID_AX_AttrInfo::make( 'http://axschema.org/namePerson/friendly', 1, true ), Auth_OpenID_AX_AttrInfo::make( 'http://axschema.org/contact/email', 1, true ), Auth_OpenID_AX_AttrInfo::make( 'http://axschema.org/namePerson', 1, true ), ); $fields = apply_filters( 'openid_consumer_ax_fields', $default_fields ); $ax_request = new Auth_OpenID_AX_FetchRequest(); foreach ( $fields as $field ) { $ax_request->add( $field ); } $extensions[] = $ax_request; } } return $extensions; } /** * Build an SReg attribute query extension if we've never seen this OpenID before. * * @uses apply_filters() Calls 'openid_consumer_sreg_required_fields' and * 'openid_consumer_sreg_required_fields' to collect sreg fields. */ function openid_add_sreg_extension( $extensions, $auth_request ) { if ( ! get_user_by_openid( $auth_request->endpoint->claimed_id ) ) { require_once( 'Auth/OpenID/SReg.php' ); if ( $auth_request->endpoint->usesExtension( Auth_OpenID_SREG_NS_URI_1_0 ) || $auth_request->endpoint->usesExtension( Auth_OpenID_SREG_NS_URI_1_1 ) ) { $required = apply_filters( 'openid_consumer_sreg_required_fields', array() ); $optional = apply_filters( 'openid_consumer_sreg_optional_fields', array( 'nickname', 'email', 'fullname' ) ); $extensions[] = Auth_OpenID_SRegRequest::build( $required, $optional ); } } return $extensions; } /** * Finish OpenID authentication. * * @param string $action login action that is being performed * @uses do_action() Calls 'openid_finish_auth' hook action after processing the authentication response. */ function finish_openid( $action ) { $identity_url = finish_openid_auth(); do_action( 'openid_finish_auth', $identity_url, $action ); } /** * * @uses apply_filters() Calls 'openid_consumer_return_urls' to collect return_to URLs to be included in XRDS document. */ function openid_consumer_xrds_simple( $xrds ) { if ( get_option( 'openid_xrds_returnto' ) ) { // OpenID Consumer Service $return_urls = array_unique( apply_filters( 'openid_consumer_return_urls', array( openid_service_url( 'consumer', 'login_post' ) ) ) ); if ( ! empty( $return_urls ) ) { // fixes https://github.com/diso/wordpress-xrds-simple/issues/4 unset( $xrds['main']['type'] ); $xrds = xrds_add_simple_service( $xrds, 'OpenID Consumer Service', 'http://specs.openid.net/auth/2.0/return_to', $return_urls ); } } return $xrds; }
diso/wordpress-openid
consumer.php
PHP
apache-2.0
7,742
from PyCA.Core import * import PyCA.Common as common import numpy as np import matplotlib.pyplot as plt def SplatSafe(outMass, g, mass): mType = mass.memType() if mType == MEM_DEVICE: minmaxl = MinMax(mass) maxval = max([abs(x) for x in minmaxl]) if maxval > 2000.00: # print 'Warning, range too big for splatting. Range: ',minmaxl # print 'Temporary downscaling values for splatting. Will scale it back after splatting.' scalefactor = float(100.00)/maxval MulC_I(mass, scalefactor) Splat(outMass, g, mass, False) MulC_I(mass, 1.0/scalefactor) MulC_I(outMass, 1.0/scalefactor) else: Splat(outMass, g, mass, False) else: Splat(outMass,g, mass, False) # end SplatSafe def ComputeVhat(out_v, scratchV, I, Ihat, m, mhat, diffOp): ''' ''' Gradient(out_v, I) MulMulC_I(out_v, Ihat, 1.0) CoAdInf(scratchV, mhat ,m) Sub_I(out_v, scratchV) diffOp.applyInverseOperator(out_v) return out_v # end ComputeVhat def EvaluateRHSFwd(out_v, v, phi): ''' Evaluate RHS for forward integration of \frac{d\phi}{dt}=v\circ\phi ''' ApplyH(out_v, v, phi, BACKGROUND_STRATEGY_PARTIAL_ZERO) return out_v #end EvaluateRHSFwd def EvaluateRHSBwd(out_v, scratchV, v, I, m, mhat, Ihat, g, diffOp): ''' ''' #first compute vhat_t ComputeVhat(out_v, scratchV, I, Ihat, m, mhat, diffOp) #compute Dvmhat JacobianXY(scratchV, v, mhat) #Add both Add_I(scratchV, out_v) #deform ApplyH(out_v, scratchV, g, BACKGROUND_STRATEGY_PARTIAL_ZERO); return out_v #end EvaluateRHSBwd def IntegrateGeodesic(m0,t,diffOp,\ m,g,ginv,\ scratchV1,scratchV2,scratchV3,\ keepstates=None,keepinds=None,\ Ninv=5,integMethod='EULER', startIndex=0, endIndex=0, initializePhi=True,\ RK4=None, scratchG=None): ''' Resulted g and ginv are diffeomorphism and its inverse at end point of shooting. and keepstates is populated with g and ginv at requested timepoints mentioned in keepinds. m is NOT the momentum at the end point. Must call CoAd(m,ginv,m0) after the call to get it. If startTime is anything other than 0, it assumes g and ginv are appropriately initialized. ''' # initial conditions if endIndex == 0: endIndex=len(t)-1 if startIndex == 0: if initializePhi==True: # if t=0 is not the identity diffeomorphisms SetToIdentity(g) SetToIdentity(ginv) Copy(m,m0) else: CoAd(m,ginv,m0) else: CoAd(m,ginv,m0) # assumes ginv is initialized when the function was called # end if # Smooth to get velocity at time t diffOp.applyInverseOperator(m) if (keepinds!=None) & (keepstates!=None): if (0 in keepinds) & (startIndex == 0): # remember to copy everything indx_of_cur_tp = keepinds.index(0) Copy(keepstates[indx_of_cur_tp][0],g) Copy(keepstates[indx_of_cur_tp][1],ginv) # end if # end if # do integration for i in range(startIndex+1,endIndex+1,1): #sys.stdout.write(',') dt = t[i]-t[i-1] # time step if integMethod == "EULER": # print 'Running Euler integration for shooting' # Compute forward step, w for g EvaluateRHSFwd(scratchV1, m, g) MulC_I(scratchV1, dt) # Take the fwd step Add_I(g,scratchV1) # Update ginv corresponding to this fwd step UpdateInverse(scratchV3, scratchV2, ginv, scratchV1, Ninv) Copy(ginv,scratchV3) elif integMethod == "RK4": # RK4 integration two extra fields if scratchG is None: print 'scratchG variable is initialized in geodesic shooting' scratchG = Field3D(m0.grid(),m0.memType()) if RK4 is None: print 'RK4 variable is initialized in geodesic shooting' RK4 = Field3D(m0.grid(),m0.memType()) EvaluateRHSFwd(scratchV1, m, g); MulC_I(scratchV1, dt) # k1 computed Copy(RK4,scratchV1) # for k2 Copy(scratchG, g); MulC_I(scratchV1,0.5); Add_I(scratchG,scratchV1); UpdateInverse(scratchV3, scratchV2, ginv, scratchV1, Ninv); CoAd(m,scratchV3,m0); diffOp.applyInverseOperator(m); EvaluateRHSFwd(scratchV1, m, scratchG); MulC_I(scratchV1, dt) # k2 computed Add_MulC_I(RK4,scratchV1,2.0) # for k3 Copy(scratchG, g); MulC_I(scratchV1,0.5); Add_I(scratchG,scratchV1); UpdateInverse(scratchV3, scratchV2, ginv, scratchV1, Ninv); CoAd(m,scratchV3,m0); diffOp.applyInverseOperator(m); EvaluateRHSFwd(scratchV1, m, scratchG); MulC_I(scratchV1, dt) # k3 computed Add_MulC_I(RK4,scratchV1,2.0) # for k4 Copy(scratchG, g); Add_I(scratchG,scratchV1); UpdateInverse(scratchV3, scratchV2, ginv, scratchV1, Ninv); CoAd(m,scratchV3,m0); diffOp.applyInverseOperator(m); EvaluateRHSFwd(scratchV1, m, scratchG); MulC_I(scratchV1, dt) # k4 computed Add_I(RK4,scratchV1) # final update MulC_I(RK4,1.0/float(6.0)) Add_I(g,RK4) UpdateInverse(scratchV3, scratchV2, ginv, RK4, Ninv) Copy(ginv,scratchV3) else: raise Exception('Unknown integration method: '+integMethod) # end if # common lines of code executed regardless of the integration scheme # check whether we should store this state if (keepinds!=None) & (keepstates!=None): if i in keepinds: # remember to copy everything indx_of_cur_tp = keepinds.index(i) Copy(keepstates[indx_of_cur_tp][0],g) Copy(keepstates[indx_of_cur_tp][1],ginv) # end if # end if # skip if it is the last iteration. if i<endIndex: # Coadjoint action gives us momentum at time t CoAd(m,ginv,m0) # Smooth to get velocity at time t diffOp.applyInverseOperator(m) # end if # end for # end IntegrateGeodesic def IntegrateGeodesicBwdIteration(t,i,m0,g1,ginv1,m1,bwdG,bwdGinv, gprev,ginvprev, m1initialized,prev_was_checkpoint, diffOp, m, scratchV1, scratchV2,scratchV3, Ninv=5,integMethod='EULER', RK4=None, scratchG=None): if m1 is None: print 'm1 variable is initialized in IntegrateGeodesicBwdIteration' m1 = Field3D(m0.grid(),m0.memType()) if bwdG is None: print 'bwdG variable is initialized in IntegrateGeodesicBwdIteration' bwdG = Field3D(m0.grid(),m0.memType()) if bwdGinv is None: print 'bwdGinv variable is initialized in IntegrateGeodesicBwdIteration' bwdGinv = Field3D(m0.grid(),m0.memType()) if ( m1initialized == False ): SetToIdentity(bwdG) SetToIdentity(bwdGinv) CoAd(m1,ginv1,m0) m1initialized = True # end if # If previous iteration had a checkpoint bwdG, bwdGinv would have been updated. If not need an updated ones if (prev_was_checkpoint == True) & (i != (len(t)-2)): ComposeHH(bwdG,gprev,ginv1) ComposeHH(bwdGinv,g1,ginvprev) # end if IntegrateGeodesic(m1,[0,t[i]-t[i+1]],diffOp,\ m,bwdG,bwdGinv,\ scratchV1,scratchV2,scratchV3,\ keepstates=None,keepinds=None,\ Ninv=Ninv,integMethod=integMethod,initializePhi=False,RK4=RK4,scratchG=scratchG) ComposeHH(gprev,bwdG,g1) ComposeHH(ginvprev, ginv1,bwdGinv) prev_was_checkpoint = False # end IntegrateGeodesicBwd def IntegrateAdjoints(Iadj,madj, I,m,Iadjtmp, madjtmp,v, scratchV1,scratchV2, I0,m0, t, checkpointstates, checkpointinds, IGradAtMsmts, msmtInds, diffOp, integMethod='EULER',Ninv=5, scratchV3=None, scratchV4=None,scratchV5=None,scratchV6=None, scratchV7=None, # used when all timepoints are not checkpointed or with RK4 scratchV8=None, scratchV9=None, # used with RK4 only when all are not checkpointed RK4 = None, scratchG = None,scratchGinv = None, # used only with RK4 scratchI = None ): ''' ''' if len(t)-1 not in checkpointinds: raise Exception('Endpoint must be one of the checkpoints passed to IntegrateAdjoints') else: indx_of_last_tp = checkpointinds.index(len(t)-1) # extra reference names used m1 = None bwdG = None bwdGinv = None SetMem(madj,0.0) SetMem(Iadj,0.0) (g, ginv) = checkpointstates[indx_of_last_tp] #I(t) and m(t) at end point CoAd(m,ginv,m0) ApplyH(I,I0,ginv) Copy(v,m) diffOp.applyInverseOperator(v) # has v(t) SetMem(madjtmp,0.0) # will be used for hat version of madj SetMem(Iadjtmp,0.0) # will be used for hat version of Iadj # initial conditions for k in range(len(msmtInds)): if checkpointinds[msmtInds[k]] == (len(t)-1): # there is a measurement at the last time point which will always be the case for matching but not necessarily regression MulC(Iadjtmp,IGradAtMsmts[k],-1) #Splat(Iadj,ginv, Iadjtmp,False) #Also, ginv = checkpointstates[msmtInds[k]][1] SplatSafe(Iadj, ginv, Iadjtmp) # end if # end for prev_was_checkpoint = True m1initialized = False for i in range(len(t)-2,-1,-1): dt = t[i] - t[i+1] if integMethod == "EULER": # print 'Running Euler integration for adjoint integration' EvaluateRHSBwd(scratchV1, scratchV2, v, I, m, madjtmp, Iadjtmp, g, diffOp) # Euler step for madj Add_MulC_I(madj, scratchV1, dt) if i in checkpointinds: indx_of_cur_tp = checkpointinds.index(i) (g, ginv) = checkpointstates[indx_of_cur_tp] prev_was_checkpoint = True elif i > 0: # i=0 need not be calculated # compute g and ginv by backward integrating geodesic # oops we are going to need a lot of scratch variables if scratchV6 is None: print 'scratchV6 variable is initialized in IntegrateAdjoints' scratchV6 = Field3D(I0.grid(),I0.memType()) if scratchV7 is None: print 'scratchV7 variable is initialized in IntegrateAdjoints' scratchV7 = Field3D(I0.grid(),I0.memType()) if (prev_was_checkpoint == True): # so that we do not update checkpointed states Copy(scratchV6,g) Copy(scratchV7,ginv) # update reference g=scratchV6 ginv=scratchV7 # madjtmp and v are used as scratch variables in below call m1 = scratchV3; bwdG = scratchV4; bwdGinv = scratchV5; # update references for ease of reading IntegrateGeodesicBwdIteration(t,i,m0, checkpointstates[indx_of_last_tp][0], checkpointstates[indx_of_last_tp][1],m1, bwdG, bwdGinv, g,ginv, m1initialized,prev_was_checkpoint, diffOp, madjtmp, scratchV1,scratchV2,v, Ninv=Ninv,integMethod=integMethod) # end if # if there is a measurement at this time point (for regression) for k in range(len(msmtInds)): if i>0: if checkpointinds[msmtInds[k]] == i: # I is used as scratch variable #Splat(I, ginv, IGradAtMsmts[k],False) SplatSafe(I, ginv, IGradAtMsmts[k]) Sub_I(Iadj,I) # end if elif msmtInds[k]==-1:# if there is a measurement at time t=0 it won't be checkpointed but HARDCODED to have msmstInds == -1. Note this will be checked only for t==0 Sub_I(Iadj, IGradAtMsmts[k]) # end if # end for # update variables for next iteration if i > 0: # last iteration skipped CoAd(m,ginv,m0) ApplyH(I,I0,ginv) Copy(v,m) diffOp.applyInverseOperator(v) # has v(t) ApplyH(madjtmp,madj,ginv,BACKGROUND_STRATEGY_PARTIAL_ZERO) # hat version of madj #Splat(Iadjtmp, g, Iadj,False) # hat version of Iadj SplatSafe(Iadjtmp, g, Iadj) # hat version of Iadj # end if elif integMethod == "RK4": if RK4 is None: print 'RK4 variable is initialized' RK4 = Field3D(I0.grid(),I0.memType()) if scratchG is None: print 'scratchG variable is initialized' scratchG = Field3D(I0.grid(),I0.memType()) if scratchGinv is None: print 'scratchGinv variable is initialized' scratchGinv = Field3D(I0.grid(),I0.memType()) if scratchI is None: print 'scratchI variable is initialized' scratchI = Image3D(I0.grid(),I0.memType()) # first get g and ginv for current timepoint if (i in checkpointinds) or (i==0): # assuming g and g inv points to prev # just assign the references if i>0: indx_of_cur_tp = checkpointinds.index(i) (gcur, ginvcur) = checkpointstates[indx_of_cur_tp] # end if note if i==0, gcur and ginvcur are treated as identity prev_was_checkpoint = True # begin rk4 integration for adjoint EvaluateRHSBwd(scratchV1, scratchV2, v, I, m, madjtmp, Iadjtmp, g, diffOp); MulC_I(scratchV1, dt) # k1 computed Copy(RK4,scratchV1) # compute and store phi0t, phit0, v_t, i_t, m_t and i_hat at t+1/2 for computing k2 and k3 if i>0: SubMulC(scratchG,g,gcur,0.5); #scratchG has w UpdateInverse(scratchGinv, scratchV2, ginvcur, scratchG, Ninv) Add_I(scratchG,gcur) else:# add 0.5 times identity HtoV(scratchG,g);MulC_I(scratchG,0.5) #scratchG has w # iteratively update inverse as, g_{1,0} = Id - w\circ g_{1,0} SetToIdentity(scratchGinv) for k in range(Ninv): ApplyH(scratchV2, scratchG, scratchGinv, BACKGROUND_STRATEGY_PARTIAL_ZERO) HtoV(scratchGinv,scratchV2); MulC_I(scratchGinv,-1.0) VtoH_I(scratchG) # end if CoAd(m,scratchGinv,m0); Copy(v,m); diffOp.applyInverseOperator(v); ApplyH(I,I0,scratchGinv) #Splat(Iadjtmp, scratchG, Iadj,False) SplatSafe(Iadjtmp, scratchG, Iadj) # for k2 # mhat_t at t+1/2 for k2 Add_MulC(scratchV2,madj,scratchV1,0.5) # mtilde at t+1/2 ApplyH(madjtmp,scratchV2,scratchGinv, BACKGROUND_STRATEGY_PARTIAL_ZERO); #mhat at t+1/2 EvaluateRHSBwd(scratchV1, scratchV2, v, I, m, madjtmp, Iadjtmp, scratchG, diffOp); MulC_I(scratchV1, dt) # k2 computed Add_MulC_I(RK4, scratchV1, 2.0) # for k3 # mhat_t at t+1/2 for k3 Add_MulC(scratchV2,madj,scratchV1,0.5) # mtilde at t+1/2 ApplyH(madjtmp,scratchV2,scratchGinv, BACKGROUND_STRATEGY_PARTIAL_ZERO); #mhat at t+1/2 EvaluateRHSBwd(scratchV1, scratchV2, v, I, m, madjtmp, Iadjtmp, scratchG, diffOp); MulC_I(scratchV1, dt) # k3 computed Add_MulC_I(RK4, scratchV1, 2.0) # compute v_t, i_t, m_t, i_hat at t for computing k4 if i>0: CoAd(m,ginvcur,m0) #Splat(Iadjtmp, gcur, Iadj,False) SplatSafe(Iadjtmp, gcur, Iadj) ApplyH(I,I0,ginvcur) else: Copy(m,m0) Copy(Iadjtmp,Iadj) Copy(I,I0) Copy(v,m); diffOp.applyInverseOperator(v); # for k4 # mhat_t at t for k4 Add(scratchV2,madj,scratchV1) # mtilde at t if i>0: ApplyH(madjtmp,scratchV2,ginvcur, BACKGROUND_STRATEGY_PARTIAL_ZERO); else: Copy(madjtmp,scratchV2) # end if #mhat at t if i>0: EvaluateRHSBwd(scratchV1, scratchV2, v, I, m, madjtmp, Iadjtmp, gcur, diffOp); MulC_I(scratchV1, dt) # k4 computed else: SetToIdentity(scratchG) EvaluateRHSBwd(scratchV1, scratchV2, v, I, m, madjtmp, Iadjtmp, scratchG, diffOp); MulC_I(scratchV1, dt) # k4 computed Add_I(RK4, scratchV1) # final update MulC_I(RK4,1.0/float(6.0)) Add_I(madj,RK4) #FOR NEXT ITERATION: # compute mhat_t, ihat_t at t to use in k1 computation. Note v_t, i_t and m_t are still stored from this iteration. # if there is a measurement at this time point (for regression) for k in range(len(msmtInds)): if i>0: if checkpointinds[msmtInds[k]] == i: #Splat(scratchV1, ginvcur, IGradAtMsmts[k],False) SplatSafe(scratchI, ginvcur, IGradAtMsmts[k]) Sub_I(Iadj,scratchI) #Splat(Iadjtmp, gcur, Iadj,False) # hat version of Iadj SplatSafe(Iadjtmp, gcur, Iadj) # hat version of Iadj # end if elif msmtInds[k]==-1: # if there is a measurement at time t=0 it won't be checkpointed but HARDCODED to have msmstInds == -1. Note this will be checked only for t==0 Sub_I(Iadj, IGradAtMsmts[k]) # end if # end for if i > 0: # last iteration skipped ApplyH(madjtmp,madj,ginvcur, BACKGROUND_STRATEGY_PARTIAL_ZERO) # hat version of madj # assign g, ginv appropriately for next iteration g = gcur ginv = ginvcur # end if else: # raise Exception('RK4 integration without all checkpoints not yet implemented') # compute gcur and ginvcur by backward integrating geodesic if scratchV6 is None: print 'scratchV6 variable is initialized in IntegrateAdjoints' scratchV6 = Field3D(I0.grid(),I0.memType()) if scratchV7 is None: print 'scratchV7 variable is initialized in IntegrateAdjoints' scratchV7 = Field3D(I0.grid(),I0.memType()) if scratchV8 is None: print 'scratchV8 variable is initialized in IntegrateAdjoints' scratchV8 = Field3D(I0.grid(),I0.memType()) if scratchV9 is None: print 'scratchV9 variable is initialized in IntegrateAdjoints' scratchV9 = Field3D(I0.grid(),I0.memType()) # initialize with previous if prev_was_checkpoint == True: gcur=scratchV8 ginvcur=scratchV9 Copy(gcur,g) Copy(ginvcur,ginv) # endif --previous was not checkpoint scratchV6 and scratch V8 should both have g and scratchV7 and scratch V9 should both have ginv. so no need to copy # scratchG, scratchGinv and v are used as scratch variables in below call m1 = scratchV3; bwdG = scratchV4; bwdGinv = scratchV5; # update references for ease of reading IntegrateGeodesicBwdIteration(t,i,m0, checkpointstates[indx_of_last_tp][0], checkpointstates[indx_of_last_tp][1],m1, bwdG, bwdGinv, gcur,ginvcur, m1initialized,prev_was_checkpoint, diffOp, scratchGinv, scratchV1,scratchV2,v, Ninv=Ninv,integMethod=integMethod, RK4=RK4,scratchG=scratchG) # begin rk4 integration for adjoint Copy(v,m); diffOp.applyInverseOperator(v); EvaluateRHSBwd(scratchV1, scratchV2, v, I, m, madjtmp, Iadjtmp, g, diffOp); MulC_I(scratchV1, dt) # k1 computed Copy(RK4,scratchV1) # compute and store phi0t, phit0, v_t, i_t, m_t and i_hat at t+1/2 for computing k2 and k3 SubMulC(scratchG,g,gcur,0.5); #scratchG has w UpdateInverse(scratchGinv, scratchV2, ginvcur, scratchG, Ninv) Add_I(scratchG,gcur) CoAd(m,scratchGinv,m0); Copy(v,m); diffOp.applyInverseOperator(v); ApplyH(I,I0,scratchGinv) #Splat(Iadjtmp, scratchG, Iadj,False) SplatSafe(Iadjtmp, scratchG, Iadj) # for k2 # mhat_t at t+1/2 for k2 Add_MulC(scratchV2,madj,scratchV1,0.5) # mtilde at t+1/2 ApplyH(madjtmp,scratchV2,scratchGinv, BACKGROUND_STRATEGY_PARTIAL_ZERO); #mhat at t+1/2 EvaluateRHSBwd(scratchV1, scratchV2, v, I, m, madjtmp, Iadjtmp, scratchG, diffOp); MulC_I(scratchV1, dt) # k2 computed Add_MulC_I(RK4, scratchV1, 2.0) # for k3 # mhat_t at t+1/2 for k3 Add_MulC(scratchV2,madj,scratchV1,0.5) # mtilde at t+1/2 ApplyH(madjtmp,scratchV2,scratchGinv, BACKGROUND_STRATEGY_PARTIAL_ZERO); #mhat at t+1/2 EvaluateRHSBwd(scratchV1, scratchV2, v, I, m, madjtmp, Iadjtmp, scratchG, diffOp); MulC_I(scratchV1, dt) # k3 computed Add_MulC_I(RK4, scratchV1, 2.0) # compute v_t, i_t, m_t, i_hat at t for computing k4 CoAd(m,ginvcur,m0) #Splat(Iadjtmp, gcur, Iadj,False) SplatSafe(Iadjtmp, gcur, Iadj) ApplyH(I,I0,ginvcur) Copy(v,m); diffOp.applyInverseOperator(v); # for k4 # mhat_t at t for k4 Add(scratchV2,madj,scratchV1) # mtilde at t ApplyH(madjtmp,scratchV2,ginvcur, BACKGROUND_STRATEGY_PARTIAL_ZERO); EvaluateRHSBwd(scratchV1, scratchV2, v, I, m, madjtmp, Iadjtmp, gcur, diffOp); MulC_I(scratchV1, dt) # k4 computed Add_I(RK4, scratchV1) # final update MulC_I(RK4,1.0/float(6.0)) Add_I(madj,RK4) #FOR NEXT ITERATION: # compute mhat_t, ihat_t at t to use in k1 computation. Note v_t, i_t and m_t are still stored from this iteration. # if there is a measurement at this time point (for regression) for k in range(len(msmtInds)): if i>0: if checkpointinds[msmtInds[k]] == i: #Splat(scratchV1, ginvcur, IGradAtMsmts[k],False) SplatSafe(scratchI, ginvcur, IGradAtMsmts[k]) Sub_I(Iadj,scratchI) #Splat(Iadjtmp, gcur, Iadj,False) # hat version of Iadj SplatSafe(Iadjtmp, gcur, Iadj) # hat version of Iadj # end if elif msmtInds[k]==-1: # if there is a measurement at time t=0 it won't be checkpointed but HARDCODED to have msmstInds == -1. Note this will be checked only for t==0 Sub_I(Iadj,IGradAtMsmts[k]) # end if # end for ApplyH(madjtmp,madj,ginvcur, BACKGROUND_STRATEGY_PARTIAL_ZERO) # hat version of madj # assign g, ginv appropriately for next iteration # first assign references g = scratchV6 ginv = scratchV7 # then copy memory Copy(g,gcur) Copy(ginv,ginvcur) # end if else: raise Exception('Unknown integration method: '+integMethod) #end if # common lines of code executed regardless of the integration scheme # end for return m #end IntegrateAdjoints def ParallelTransport(m1, n0, m0, nTimeSteps, diffOp, Ninv=10, integMethod='RK4',saveOutput=False, mtArray=None, ginvArray=None): ''' Parallel translation of vector momentum, m0 along the geodesic denoted by initial condition, n0 from t=0 to t=1 using given time descritization, nTimeSteps. Returns the parallely tranlated momentum in argument variable m1 at the end point of geodesic at t=1. Also, returns list of norm of m(t), norm(n) and inner product between m and n at all timepoints along the geodesic. ''' t = [x*1./nTimeSteps for x in range(nTimeSteps+1)] mGrid = n0.grid() mType = n0.memType() v = Field3D(mGrid, mType) #m = m1 m = Field3D(mGrid, mType) w = Field3D(mGrid, mType) n = Field3D(mGrid, mType) g = Field3D(mGrid, mType) ginv = Field3D(mGrid, mType) k_n = Field3D(mGrid, mType) k_m = Field3D(mGrid, mType) scratchV1 = Field3D(mGrid, mType) scratchV2 = Field3D(mGrid, mType) scratchG = Field3D(mGrid, mType) scratchM = Field3D(mGrid, mType) RK4_m = Field3D(mGrid, mType) RK4_n = Field3D(mGrid, mType) SetToIdentity(g) SetToIdentity(ginv) Copy(n, n0) Copy(w,n) diffOp.applyInverseOperator(w) Copy(m, m0) Copy(v,m) diffOp.applyInverseOperator(v) #common.DebugHere() mtArray=[] ginvArray=[] if saveOutput: #common.DebugHere() mtArray.append(m.copy()) ginvArray.append(ginv.copy()) norm2_m=[Dot(m,v)] norm2_n=[Dot(n,w)] inner_m_n=[Dot(m,w)] for i in range(1,len(t),1): dt = t[i] - t[i-1] if integMethod == "EULER": raise Exception('Euler integration for parallel transport not implemented: '+integMethod) elif integMethod == "RK4": EvaluateRHSFwd(k_n, w, g); MulC_I(k_n, dt) # k1_n computed Copy(RK4_n,k_n) EvaluateRHSParallelTransport(k_m, scratchV1, n, w, m, v, diffOp); MulC_I(k_m, dt) # k1_m computed Copy(RK4_m,k_m) # for k2_n Copy(scratchG, g); MulC_I(k_n,0.5); Add_I(scratchG,k_n); UpdateInverse(scratchV2, scratchV1, ginv, k_n, Ninv); CoAd(n,scratchV2, n0); Copy(w,n); diffOp.applyInverseOperator(w); EvaluateRHSFwd(k_n, w, scratchG); MulC_I(k_n, dt) # k2 computed Add_MulC_I(RK4_n, k_n, 2.0) # for k2_m Copy(scratchM, m); MulC_I(k_m,0.5); Add_I(scratchM,k_m); Copy(v,scratchM); diffOp.applyInverseOperator(v); EvaluateRHSParallelTransport(k_m, scratchV1, n, w, scratchM, v, diffOp); MulC_I(k_m, dt) # k2_m computed Add_MulC_I(RK4_m, k_m, 2.0) # for k3_n Copy(scratchG, g); MulC_I(k_n,0.5); Add_I(scratchG,k_n); UpdateInverse(scratchV2, scratchV1, ginv, k_n, Ninv); CoAd(n,scratchV2, n0);Copy(w,n); diffOp.applyInverseOperator(w); EvaluateRHSFwd(k_n, w, scratchG); MulC_I(k_n, dt) # k3_n computed Add_MulC_I(RK4_n, k_n, 2.0) # for k3_m Copy(scratchM, m); MulC_I(k_m,0.5); Add_I(scratchM,k_m); Copy(v,scratchM); diffOp.applyInverseOperator(v); EvaluateRHSParallelTransport(k_m, scratchV1, n, w, scratchM, v, diffOp); MulC_I(k_m, dt) # k3_m computed Add_MulC_I(RK4_m, k_m, 2.0) # for k4_n Copy(scratchG, g); Add_I(scratchG,k_n); UpdateInverse(scratchV2, scratchV1, ginv, k_n, Ninv); CoAd(n,scratchV2, n0);Copy(w,n); diffOp.applyInverseOperator(w); EvaluateRHSFwd(k_n, w, scratchG); MulC_I(k_n, dt) # k4_n computed Add_I(RK4_n, k_n) # for k4_m Copy(scratchM, m); Add_I(scratchM,k_m); Copy(v,scratchM); diffOp.applyInverseOperator(v); EvaluateRHSParallelTransport(k_m, scratchV1, n, w, scratchM, v, diffOp); MulC_I(k_m, dt) # k4_m computed Add_I(RK4_m, k_m) # final update MulC_I(RK4_n,1.0/float(6.0)) Add_I(g,RK4_n) UpdateInverse(scratchV2, scratchV1, ginv, RK4_n, Ninv) Copy(ginv,scratchV2) Add_MulC_I(m, RK4_m, 1.0/float(6.0)) else: raise Exception('Unknown integration method: '+integMethod) # end if # Coadjoint action gives us momentum at time t CoAd(n, ginv, n0) Copy(w,n) # Smooth to get velocity at time t diffOp.applyInverseOperator(w) Copy(v,m) diffOp.applyInverseOperator(v) if saveOutput: mtArray.append(m.copy()) ginvArray.append(ginv.copy()) # save norms and inner product norm2_m.append(Dot(m,v)) norm2_n.append(Dot(n,w)) inner_m_n.append(Dot(m,w)) # end for Copy(m1,m) return norm2_m, norm2_n, inner_m_n, mtArray, ginvArray def EvaluateRHSParallelTransport(out_m, scratchV, n, w, m, v, diffOp): ''' Evaluate RHS for parallel transport ''' AdInf(out_m, w, v) diffOp.applyOperator(out_m) CoAdInf(scratchV, w, m) Sub_I(out_m, scratchV) CoAdInf(scratchV, v, n) Sub_I(out_m, scratchV) MulC_I(out_m, 0.5) return out_m #end EvaluateRHSFwd def MyGridPlot(vf, sliceIdx=None, dim='z', every=1, isVF=True, color='g', plotBase=True, colorbase='#A0A0FF'): sliceArr = common.ExtractSliceArrVF(vf, sliceIdx, dim) sz = sliceArr.shape hID = np.mgrid[0:sz[0], 0:sz[1]] d1 = np.squeeze(hID[1, ::every, ::every]) d2 = np.squeeze(hID[0, ::every, ::every]) sliceArr = sliceArr[::every, ::every, :] if plotBase: plt.plot(d1, d2, colorbase) plt.hold(True) plt.plot(d1.T, d2.T, colorbase) if not isVF: d1 = np.zeros(d1.shape) d2 = np.zeros(d2.shape) if dim=='z': plt.plot(d1+np.squeeze(sliceArr[:,:,1]), d2+np.squeeze(sliceArr[:,:,0]), color) plt.hold(True) plt.plot((d1+np.squeeze(sliceArr[:,:,1])).T, (d2+np.squeeze(sliceArr[:,:,0])).T, color) plt.hold(False) elif dim=='x': plt.plot(d1+np.squeeze(sliceArr[:,:,2]), d2+np.squeeze(sliceArr[:,:,1]), color) plt.hold(True) plt.plot((d1+np.squeeze(sliceArr[:,:,2])).T, (d2+np.squeeze(sliceArr[:,:,1])).T, color) plt.hold(False) elif dim=='y': plt.plot(d1+np.squeeze(sliceArr[:,:,2]), d2+np.squeeze(sliceArr[:,:,0]), color) plt.hold(True) plt.plot((d1+np.squeeze(sliceArr[:,:,2])).T, (d2+np.squeeze(sliceArr[:,:,0])).T, color) plt.hold(False) # change axes to match image axes if not plt.gca().yaxis_inverted(): plt.gca().invert_yaxis() # force redraw plt.draw() def MyQuiver(vf, sliceIdx=None, dim='z',every=1,thresh=None,scaleArrows=None,arrowCol='r',lineWidth=None, width=None): sliceArr = common.ExtractSliceArrVF(vf, sliceIdx, dim) if dim=='z': vy = np.squeeze(sliceArr[:,:,0]) vx = np.squeeze(sliceArr[:,:,1]) elif dim=='x': vy = np.squeeze(sliceArr[:,:,1]) vx = np.squeeze(sliceArr[:,:,2]) elif dim=='y': vy = np.squeeze(sliceArr[:,:,0]) vx = np.squeeze(sliceArr[:,:,2]) vxshow = np.zeros(np.shape(vx)) vyshow = np.zeros(np.shape(vy)) vxshow[::every,::every] = vx[::every,::every] vyshow[::every,::every] = vy[::every,::every] valindex = np.zeros(np.shape(vx),dtype=bool) valindex[::every,::every] = True if thresh is not None: valindex[(vx**2+vy**2)<thresh] = False #gridX, gridY = np.meshgrid(range(np.shape(vx)[0]),range(np.shape(vx)[1]-1,-1,-1)) gridX, gridY = np.meshgrid(range(np.shape(vx)[0]),range(np.shape(vx)[1])) quiverhandle = plt.quiver(gridX[valindex],gridY[valindex],vx[valindex],vy[valindex],scale=scaleArrows,color=arrowCol,linewidth=lineWidth,width=width,zorder=4) # change axes to match image axes plt.gca().invert_yaxis() # force redraw plt.draw()
rkwitt/quicksilver
code/vectormomentum/Code/Python/Libraries/CAvmCommon.py
Python
apache-2.0
34,587
<!DOCTYPE html> <html class="light page-tags前端"> <head> <meta charset="utf-8"> <title>Tag: 前端 | 笑不忘书</title> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <meta name="keywords" content="前端,设计,Hexo主题,前端开发,用户体验,设计,frontend,design,Python,PHP" /> <meta property="og:type" content="website"> <meta property="og:title" content="笑不忘书"> <meta property="og:url" content="http://www.mybjut.cn/tags/前端/index.html"> <meta property="og:site_name" content="笑不忘书"> <meta name="twitter:card" content="summary"> <meta name="twitter:title" content="笑不忘书"> <link rel="icon" href="images/favicon.ico"> <link href="/css/styles.css?v=028c63b1" rel="stylesheet"> <link rel="stylesheet" href="/css/personal-style.css"> </head> <body> <span id="toolbox-mobile" class="toolbox-mobile">潘多拉</span> <div class="content content-tag"> <div class="page-header"> <div class="breadcrumb"> <div class="location">标签</div> <i class="icon-location"></i> </div> <div class="toolbox"> <a class="toolbox-entry" href="/"> <span class="toolbox-entry-text">潘多拉</span> <i class="icon-angle-down"></i> <i class="icon-home"></i> </a> <ul class="list-toolbox"> <li class="item-toolbox"> <a class="CIRCLE" href="/archives/" rel="noopener noreferrer" target="_self" > 博客 </a> </li> <li class="item-toolbox"> <a class="CIRCLE" href="/category/" rel="noopener noreferrer" target="_self" > 分类 </a> </li> <li class="item-toolbox"> <a class="CIRCLE" href="/tag/" rel="noopener noreferrer" target="_self" > 标签 </a> </li> <li class="item-toolbox"> <a class="CIRCLE" href="/link/" rel="noopener noreferrer" target="_self" > 友链 </a> </li> <li class="item-toolbox"> <a class="CIRCLE" href="/about/" rel="noopener noreferrer" target="_self" > 关于 </a> </li> <li class="item-toolbox"> <a class="CIRCLE" href="/search/" rel="noopener noreferrer" target="_self" > 搜索 </a> </li> </ul> </div> <div class="box-blog-info"> <a class="avatar" href="/"> <img src="/images/avatar.jpg" alt="" /> </a> <div class="info"> <h3 class="name" style="font-family: calligraffittiregular"> tfhnia </h3> <div class="slogan"> 永言配命 </div> </div> </div> </div> <section class="tag-box"> <div class="tag-title">标签</div> <div class="tag-list"> <a class="tag-item" href="#CSS"> <span class="tag-name">CSS</span> <span class="tag-size">( 1 )</span> </a> <a class="tag-item" href="#JavaScript"> <span class="tag-name">JavaScript</span> <span class="tag-size">( 1 )</span> </a> <a class="tag-item" href="#公开课"> <span class="tag-name">公开课</span> <span class="tag-size">( 1 )</span> </a> <a class="tag-item" href="#写作"> <span class="tag-name">写作</span> <span class="tag-size">( 1 )</span> </a> <a class="tag-item" href="#前端"> <span class="tag-name">前端</span> <span class="tag-size">( 1 )</span> </a> <a class="tag-item" href="#技术"> <span class="tag-name">技术</span> <span class="tag-size">( 1 )</span> </a> <a class="tag-item" href="#教程"> <span class="tag-name">教程</span> <span class="tag-size">( 1 )</span> </a> <a class="tag-item" href="#沟通"> <span class="tag-name">沟通</span> <span class="tag-size">( 1 )</span> </a> <a class="tag-item" href="#测试"> <span class="tag-name">测试</span> <span class="tag-size">( 3 )</span> </a> <a class="tag-item" href="#爱情"> <span class="tag-name">爱情</span> <span class="tag-size">( 1 )</span> </a> <a class="tag-item" href="#自省"> <span class="tag-name">自省</span> <span class="tag-size">( 1 )</span> </a> <a class="tag-item" href="#计划"> <span class="tag-name">计划</span> <span class="tag-size">( 1 )</span> </a> <a class="tag-item" href="#话剧"> <span class="tag-name">话剧</span> <span class="tag-size">( 1 )</span> </a> <a class="tag-item" href="#阅读"> <span class="tag-name">阅读</span> <span class="tag-size">( 1 )</span> </a> </div> </section> <ul class="list-post"><li id="CSS" class="item-category-name item-title item-title-0"> <!-- <a href="" class="text-year"> --> CSS <span class="category-count">( 1 )</span> <!-- </a> --> </li> <li class="item-post item"> <span class="post-date">10-31</span> <a class="post-title" href="/2016/10/31/CSS定位体系/">CSS定位体系</a> </li> <li id="JavaScript" class="item-category-name item-title item-title-1"> <!-- <a href="" class="text-year"> --> JavaScript <span class="category-count">( 1 )</span> <!-- </a> --> </li> <li class="item-post item"> <span class="post-date">10-29</span> <a class="post-title" href="/2016/10/29/JS入门/">JS入门</a> </li> <li id="公开课" class="item-category-name item-title item-title-2"> <!-- <a href="" class="text-year"> --> 公开课 <span class="category-count">( 1 )</span> <!-- </a> --> </li> <li class="item-post item"> <span class="post-date">10-28</span> <a class="post-title" href="/2016/10/28/公开课整理/">公开课整理</a> </li> <li id="写作" class="item-category-name item-title item-title-3"> <!-- <a href="" class="text-year"> --> 写作 <span class="category-count">( 1 )</span> <!-- </a> --> </li> <li class="item-post item"> <span class="post-date">11-02</span> <a class="post-title" href="/2016/11/02/如何进行博文写作/">如何进行博文写作</a> </li> <li id="前端" class="item-category-name item-title item-title-4"> <!-- <a href="" class="text-year"> --> 前端 <span class="category-count">( 1 )</span> <!-- </a> --> </li> <li class="item-post item"> <span class="post-date">10-31</span> <a class="post-title" href="/2016/10/31/CSS定位体系/">CSS定位体系</a> </li> <li id="技术" class="item-category-name item-title item-title-0"> <!-- <a href="" class="text-year"> --> 技术 <span class="category-count">( 1 )</span> <!-- </a> --> </li> <li class="item-post item"> <span class="post-date">10-29</span> <a class="post-title" href="/2016/10/29/JS入门/">JS入门</a> </li> <li id="教程" class="item-category-name item-title item-title-1"> <!-- <a href="" class="text-year"> --> 教程 <span class="category-count">( 1 )</span> <!-- </a> --> </li> <li class="item-post item"> <span class="post-date">11-02</span> <a class="post-title" href="/2016/11/02/如何进行博文写作/">如何进行博文写作</a> </li> <li id="沟通" class="item-category-name item-title item-title-2"> <!-- <a href="" class="text-year"> --> 沟通 <span class="category-count">( 1 )</span> <!-- </a> --> </li> <li class="item-post item"> <span class="post-date">12-01</span> <a class="post-title" href="/2016/12/01/高难度对话/">高难度对话</a> </li> <li id="测试" class="item-category-name item-title item-title-3"> <!-- <a href="" class="text-year"> --> 测试 <span class="category-count">( 3 )</span> <!-- </a> --> </li> <li class="item-post item"> <span class="post-date">10-22</span> <a class="post-title" href="/2016/10/22/article/">自动部署脚本测试</a> </li> <li class="item-post item"> <span class="post-date">10-22</span> <a class="post-title" href="/2016/10/22/new-article/">我的第一篇文章</a> </li> <li class="item-post item"> <span class="post-date">10-28</span> <a class="post-title" href="/2016/10/28/测试图片插入/">测试图片插入</a> </li> <li id="爱情" class="item-category-name item-title item-title-4"> <!-- <a href="" class="text-year"> --> 爱情 <span class="category-count">( 1 )</span> <!-- </a> --> </li> <li class="item-post item"> <span class="post-date">10-28</span> <a class="post-title" href="/2016/10/28/恋爱的犀牛/">恋爱的犀牛</a> </li> <li id="自省" class="item-category-name item-title item-title-0"> <!-- <a href="" class="text-year"> --> 自省 <span class="category-count">( 1 )</span> <!-- </a> --> </li> <li class="item-post item"> <span class="post-date">12-01</span> <a class="post-title" href="/2016/12/01/踏实/">踏实</a> </li> <li id="计划" class="item-category-name item-title item-title-1"> <!-- <a href="" class="text-year"> --> 计划 <span class="category-count">( 1 )</span> <!-- </a> --> </li> <li class="item-post item"> <span class="post-date">10-28</span> <a class="post-title" href="/2016/10/28/阅读计划/">阅读计划</a> </li> <li id="话剧" class="item-category-name item-title item-title-2"> <!-- <a href="" class="text-year"> --> 话剧 <span class="category-count">( 1 )</span> <!-- </a> --> </li> <li class="item-post item"> <span class="post-date">10-28</span> <a class="post-title" href="/2016/10/28/恋爱的犀牛/">恋爱的犀牛</a> </li> <li id="阅读" class="item-category-name item-title item-title-3"> <!-- <a href="" class="text-year"> --> 阅读 <span class="category-count">( 1 )</span> <!-- </a> --> </li> <li class="item-post item"> <span class="post-date">10-28</span> <a class="post-title" href="/2016/10/28/阅读计划/">阅读计划</a> </li> </ul> </div> <a id="backTop" class="back-top"> <i class="icon-angle-up"></i> </a> <div class="modal" id="modal"> <span id="cover" class="cover hide"></span> <div id="modal-dialog" class="modal-dialog hide-dialog"> <div class="modal-header"> <span id="close" class="btn-close">关闭</span> </div> <hr> <div class="modal-body"> <ul class="list-toolbox"> <li class="item-toolbox"> <a class="CIRCLE" href="/archives/" rel="noopener noreferrer" target="_self" > 博客 </a> </li> <li class="item-toolbox"> <a class="CIRCLE" href="/category/" rel="noopener noreferrer" target="_self" > 分类 </a> </li> <li class="item-toolbox"> <a class="CIRCLE" href="/tag/" rel="noopener noreferrer" target="_self" > 标签 </a> </li> <li class="item-toolbox"> <a class="CIRCLE" href="/link/" rel="noopener noreferrer" target="_self" > 友链 </a> </li> <li class="item-toolbox"> <a class="CIRCLE" href="/about/" rel="noopener noreferrer" target="_self" > 关于 </a> </li> <li class="item-toolbox"> <a class="CIRCLE" href="/search/" rel="noopener noreferrer" target="_self" > 搜索 </a> </li> </ul> </div> </div> </div> <script type="text/javascript"> function loadScript(url, callback) { var script = document.createElement('script') script.type = 'text/javascript'; if (script.readyState) { //IE script.onreadystatechange = function() { if (script.readyState == 'loaded' || script.readyState == 'complete') { script.onreadystatechange = null; callback(); } }; } else { //Others script.onload = function() { callback(); }; } script.src = url; document.getElementsByTagName('head')[0].appendChild(script); } window.onload = function() { loadScript('/js/bundle.js?235683', function() { // load success }); } </script> </body> </html>
tfhnia/tfhnia.github.io
tags/前端/index.html
HTML
apache-2.0
13,460
/* * Copyright 2019 Red Hat, 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. */ package org.jboss.migration.eap6.to.eap7.tasks; import org.jboss.migration.core.jboss.JBossSubsystemNames; import org.jboss.migration.wfly10.config.task.management.subsystem.UpdateSubsystemResources; import org.jboss.migration.wfly10.config.task.subsystem.messagingactivemq.AddHttpAcceptorsAndConnectors; /** * @author emmartins */ public class EAP6_4ToEAP7_3UpdateMessagingActiveMQSubsystem<S> extends UpdateSubsystemResources<S> { public EAP6_4ToEAP7_3UpdateMessagingActiveMQSubsystem() { super(JBossSubsystemNames.MESSAGING_ACTIVEMQ, new AddHttpAcceptorsAndConnectors<>()); } }
emmartins/wildfly-server-migration
migrations/eap7.3/eap6.4/src/main/java/org/jboss/migration/eap6/to/eap7/tasks/EAP6_4ToEAP7_3UpdateMessagingActiveMQSubsystem.java
Java
apache-2.0
1,210
--- type: post101 title: Flash drive IMDG Storage categories: XAP101TUT parent: none weight: 1600 --- XAP 10 introduces a new storage model called BlobStore Storage Model, which allows an external storage medium (one that does not reside on the JVM heap) to store the IMDG data. This guide describes the general architecture and functionality of this storage model that is leveraging both on-heap, off-heap and SSD implementation, called `MemoryXtend`. <br> {{%section%}} {{%column width="30%" %}} {{%youtube "kAe-ZxFnIYc" "XAP MemoryXtend"%}} {{%/column%}} {{%column width="30%" %}} {{%pdf "/download_files/White-Paper-ssd-V2.pdf"%}} This MemoryXtend white paper provides a high level overview of the technology and motivation behind MemoryXtend. {{%/column%}} {{%column width="30%" %}} {{%pdf "/download_files/xap10–memoryXtend-tutorial.pdf"%}} The MemoryXtend Tutorial describes how to experiment with MemoryXtend and comparing RAM based Data Grid with SSD based Data Grid. {{%/column%}} {{%/section%}} <br> {{%learn "/xap101adm/memoryxtend.html"%}}
croffler/documentation
sites/xap-docs/content/xap101tut/blobstore.markdown
Markdown
apache-2.0
1,068
# The Operator Splitting QP Solver [![CI](https://github.com/osqp/osqp/actions/workflows/main.yml/badge.svg)](https://github.com/osqp/osqp/actions/workflows/main.yml) [![Code coverage](https://coveralls.io/repos/github/oxfordcontrol/osqp/badge.svg?branch=master)](https://coveralls.io/github/oxfordcontrol/osqp?branch=master) ![License](https://img.shields.io/badge/License-Apache%202.0-brightgreen.svg) ![PyPI - downloads](https://img.shields.io/pypi/dm/osqp.svg?label=Pypi%20downloads) ![Conda - downloads](https://img.shields.io/conda/dn/conda-forge/osqp.svg?label=Conda%20downloads) [**Join our forum on Discourse**](https://osqp.discourse.group) for any questions related to the solver! **The documentation** is available at [**osqp.org**](https://osqp.org/) The OSQP (Operator Splitting Quadratic Program) solver is a numerical optimization package for solving problems in the form ``` minimize 0.5 x' P x + q' x subject to l <= A x <= u ``` where `x in R^n` is the optimization variable. The objective function is defined by a positive semidefinite matrix `P in S^n_+` and vector `q in R^n`. The linear constraints are defined by matrix `A in R^{m x n}` and vectors `l` and `u` so that `l_i in R U {-inf}` and `u_i in R U {+inf}` for all `i in 1,...,m`. The latest version is `0.6.2`. ## Citing OSQP If you are using OSQP for your work, we encourage you to * [Cite the related papers](https://osqp.org/citing/), * Put a star on this repository. **We are looking forward to hearing your success stories with OSQP!** Please [share them with us](mailto:bartolomeo.stellato@gmail.com). ## Bug reports and support Please report any issues via the [Github issue tracker](https://github.com/oxfordcontrol/osqp/issues). All types of issues are welcome including bug reports, documentation typos, feature requests and so on. ## Numerical benchmarks Numerical benchmarks against other solvers are available [here](https://github.com/oxfordcontrol/osqp_benchmarks).
oxfordcontrol/osqp
README.md
Markdown
apache-2.0
1,994
package com.socrata.soql.types.obfuscation import org.scalatest.FunSuite import org.scalatest.MustMatchers import org.scalatestplus.scalacheck.ScalaCheckPropertyChecks class LongFormatterTest extends FunSuite with MustMatchers with ScalaCheckPropertyChecks { test("Format always produces exactly 14 characters") { forAll { x: Long => LongFormatter.format(x).length must be (14) } } test("Deformat-format is the identity") { forAll { (x: Long) => LongFormatter.deformatEx(LongFormatter.format(x)) must equal (x) } } test("Deformat ignores declared prefixes") { forAll { (x: Long, prefix: String) => LongFormatter.deformatEx(prefix + LongFormatter.format(x), prefix.length) must equal (x) } } test("Deformat rejects suffixes") { forAll { (x: Long, suffix: String) => whenever(suffix != "") { an [IllegalArgumentException] must be thrownBy { LongFormatter.deformatEx(LongFormatter.format(x) + suffix) must equal (x) } } } } test("Format always produces a formatted value") { forAll { (x: Long) => LongFormatter.isFormattedValue(LongFormatter.format(x)) must be (true) } } test("isFormattedValue ignores declared prefixes") { forAll { (x: Long, prefix: String) => LongFormatter.isFormattedValue(prefix + LongFormatter.format(x), prefix.length) must be (true) } } test("isFormattedValue rejects suffixes") { forAll { (x: Long, suffix: String) => whenever(suffix != "") { LongFormatter.isFormattedValue(LongFormatter.format(x) + suffix) must be (false) } } } }
socrata-platform/soql-reference
soql-types/src/test/scala/com/socrata/soql/types/obfuscation/LongFormatterTest.scala
Scala
apache-2.0
1,635
// Copyright 2014-2015, Bryan Stockus // 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. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Sting.Host { public interface IControllableHost { void Pause(); void UnPause(); } }
bstockus/sting
Sting/Host/IControllableHost.cs
C#
apache-2.0
834
/* * Copyright 2012-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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.amazonaws.services.codepipeline.model.transform; import java.math.*; import javax.annotation.Generated; import com.amazonaws.services.codepipeline.model.*; import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*; import com.amazonaws.transform.*; import com.fasterxml.jackson.core.JsonToken; import static com.fasterxml.jackson.core.JsonToken.*; /** * GetJobDetailsResult JSON Unmarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class GetJobDetailsResultJsonUnmarshaller implements Unmarshaller<GetJobDetailsResult, JsonUnmarshallerContext> { public GetJobDetailsResult unmarshall(JsonUnmarshallerContext context) throws Exception { GetJobDetailsResult getJobDetailsResult = new GetJobDetailsResult(); int originalDepth = context.getCurrentDepth(); String currentParentElement = context.getCurrentParentElement(); int targetDepth = originalDepth + 1; JsonToken token = context.getCurrentToken(); if (token == null) token = context.nextToken(); if (token == VALUE_NULL) { return getJobDetailsResult; } while (true) { if (token == null) break; if (token == FIELD_NAME || token == START_OBJECT) { if (context.testExpression("jobDetails", targetDepth)) { context.nextToken(); getJobDetailsResult.setJobDetails(JobDetailsJsonUnmarshaller.getInstance().unmarshall(context)); } } else if (token == END_ARRAY || token == END_OBJECT) { if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) { if (context.getCurrentDepth() <= originalDepth) break; } } token = context.nextToken(); } return getJobDetailsResult; } private static GetJobDetailsResultJsonUnmarshaller instance; public static GetJobDetailsResultJsonUnmarshaller getInstance() { if (instance == null) instance = new GetJobDetailsResultJsonUnmarshaller(); return instance; } }
dagnir/aws-sdk-java
aws-java-sdk-codepipeline/src/main/java/com/amazonaws/services/codepipeline/model/transform/GetJobDetailsResultJsonUnmarshaller.java
Java
apache-2.0
2,816
/** * Copyright 2016 BitTorrent 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. */ #pragma once #include <scraps/config.h> #include <scraps/net/Address.h> #include <scraps/net/UDPReceiver.h> #include <scraps/net/UDPSender.h> #include <array> #include <mutex> #include <thread> #include <atomic> namespace scraps::net { /** * Thread-safe. */ class UDPSocket : public UDPSender { public: using Protocol = Address::Protocol; static constexpr size_t kEthernetMTU = 1500; static constexpr size_t kIPv4HeaderSize = 20; static constexpr size_t kIPv6HeaderSize = 40; static constexpr size_t kUDPHeaderSize = 8; static constexpr size_t kMaxIPv4UDPPayloadSize = kEthernetMTU - kIPv4HeaderSize - kUDPHeaderSize; static constexpr size_t kMaxIPv6UDPPayloadSize = kEthernetMTU - kIPv6HeaderSize - kUDPHeaderSize; /** * Creates a new UDP socket. * * @param receiver must outlive the socket. if null, should be given via setReceiver */ UDPSocket(Protocol protocol, std::weak_ptr<UDPReceiver> receiver = std::weak_ptr<UDPReceiver>()); ~UDPSocket() { close(); } /** * Returns the native socket. */ int native() const { return _socket; } /** * Sets the receiver for the socket. The receiver should outlive the socket and * should not be changed once set. */ void setReceiver(std::weak_ptr<UDPReceiver> receiver); /** * Binds the socket to any interface on the given port. */ bool bind(uint16_t port); /** * Binds the socket to the given interface and port. */ bool bind(const char* interface, uint16_t port); /** * Binds the socket, joining the given multicast group address. */ bool bindMulticast(const char* groupAddress, uint16_t port); /** * Sends data on the socket. */ virtual bool send(const Endpoint& destination, const void* data, size_t length) override; /** * Attempts to receive data on the socket and dispatch it to its receiver. */ void receive(); /** * Explicitly closes the socket. */ void close(); /** * Get total number of bytes sent and received. */ uint64_t totalSentBytes() { return _totalSentBytes; } uint64_t totalReceivedBytes() { return _totalReceivedBytes; } private: std::mutex _mutex; int _socket = -1; Protocol _protocol; std::weak_ptr<UDPReceiver> _receiver; std::array<unsigned char, 4096> _buffer; std::atomic_uint_fast64_t _totalSentBytes{0}; std::atomic_uint_fast64_t _totalReceivedBytes{0}; bool _bind(const char* interface, uint16_t port); }; } // namespace scraps::net
bittorrent/scraps
include/scraps/net/UDPSocket.h
C
apache-2.0
3,152
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <link rel="SHORTCUT ICON" href="../../../../../img/clover.ico" /> <link rel="stylesheet" href="../../../../../aui/css/aui.min.css" media="all"/> <link rel="stylesheet" href="../../../../../aui/css/aui-experimental.min.css" media="all"/> <!--[if IE 9]><link rel="stylesheet" href="../../../../../aui/css/aui-ie9.min.css" media="all"/><![endif]--> <style type="text/css" media="all"> @import url('../../../../../style.css'); @import url('../../../../../tree.css'); </style> <script src="../../../../../jquery-1.8.3.min.js" type="text/javascript"></script> <script src="../../../../../aui/js/aui.min.js" type="text/javascript"></script> <script src="../../../../../aui/js/aui-experimental.min.js" type="text/javascript"></script> <script src="../../../../../aui/js/aui-soy.min.js" type="text/javascript"></script> <script src="../../../../../package-nodes-tree.js" type="text/javascript"></script> <script src="../../../../../clover-tree.js" type="text/javascript"></script> <script src="../../../../../clover.js" type="text/javascript"></script> <script src="../../../../../clover-descriptions.js" type="text/javascript"></script> <script src="../../../../../cloud.js" type="text/javascript"></script> <title>ABA Route Transit Number Validator 1.0.1-SNAPSHOT</title> </head> <body> <div id="page"> <header id="header" role="banner"> <nav class="aui-header aui-dropdown2-trigger-group" role="navigation"> <div class="aui-header-inner"> <div class="aui-header-primary"> <h1 id="logo" class="aui-header-logo aui-header-logo-clover"> <a href="http://openclover.org" title="Visit OpenClover home page"><span class="aui-header-logo-device">OpenClover</span></a> </h1> </div> <div class="aui-header-secondary"> <ul class="aui-nav"> <li id="system-help-menu"> <a class="aui-nav-link" title="Open online documentation" target="_blank" href="http://openclover.org/documentation"> <span class="aui-icon aui-icon-small aui-iconfont-help">&#160;Help</span> </a> </li> </ul> </div> </div> </nav> </header> <div class="aui-page-panel"> <div class="aui-page-panel-inner"> <div class="aui-page-panel-nav aui-page-panel-nav-clover"> <div class="aui-page-header-inner" style="margin-bottom: 20px;"> <div class="aui-page-header-image"> <a href="http://cardatechnologies.com" target="_top"> <div class="aui-avatar aui-avatar-large aui-avatar-project"> <div class="aui-avatar-inner"> <img src="../../../../../img/clover_logo_large.png" alt="Clover icon"/> </div> </div> </a> </div> <div class="aui-page-header-main" > <h1> <a href="http://cardatechnologies.com" target="_top"> ABA Route Transit Number Validator 1.0.1-SNAPSHOT </a> </h1> </div> </div> <nav class="aui-navgroup aui-navgroup-vertical"> <div class="aui-navgroup-inner"> <ul class="aui-nav"> <li class=""> <a href="../../../../../dashboard.html">Project overview</a> </li> </ul> <div class="aui-nav-heading packages-nav-heading"> <strong>Packages</strong> </div> <div class="aui-nav project-packages"> <form method="get" action="#" class="aui package-filter-container"> <input type="text" autocomplete="off" class="package-filter text" placeholder="Type to filter packages..." name="package-filter" id="package-filter" title="Start typing package name (or part of the name) to search through the tree. Use arrow keys and the Enter key to navigate."/> </form> <p class="package-filter-no-results-message hidden"> <small>No results found.</small> </p> <div class="packages-tree-wrapper" data-root-relative="../../../../../" data-package-name="com.cardatechnologies.utils.validators.abaroutevalidator"> <div class="packages-tree-container"></div> <div class="clover-packages-lozenges"></div> </div> </div> </div> </nav> </div> <section class="aui-page-panel-content"> <div class="aui-page-panel-content-clover"> <div class="aui-page-header-main"><ol class="aui-nav aui-nav-breadcrumbs"> <li><a href="../../../../../dashboard.html"> Project Clover database Sat Aug 7 2021 12:29:33 MDT</a></li> <li><a href="test-pkg-summary.html">Package com.cardatechnologies.utils.validators.abaroutevalidator</a></li> <li><a href="test-Test_AbaRouteValidator_17b.html">Class Test_AbaRouteValidator_17b</a></li> </ol></div> <h1 class="aui-h2-clover"> Test testAbaNumberCheck_35713_good </h1> <table class="aui"> <thead> <tr> <th>Test</th> <th><label title="The test result. Either a Pass, Fail or Error.">Status</label></th> <th><label title="When the test execution was started">Start time</label></th> <th><label title="The total time in seconds taken to run this test.">Time (seconds)</label></th> <th><label title="A failure or error message if the test is not successful.">Message</label></th> </tr> </thead> <tbody> <tr> <td> <a href="../../../../../com/cardatechnologies/utils/validators/abaroutevalidator/Test_AbaRouteValidator_17b.html?line=15113#src-15113" >testAbaNumberCheck_35713_good</a> </td> <td> <span class="sortValue">1</span><span class="aui-lozenge aui-lozenge-success">PASS</span> </td> <td> 7 Aug 12:46:38 </td> <td> 0.0 </td> <td> <div></div> <div class="errorMessage"></div> </td> </tr> </tbody> </table> <div>&#160;</div> <table class="aui aui-table-sortable"> <thead> <tr> <th style="white-space:nowrap;"><label title="A class that was directly hit by this test.">Target Class</label></th> <th colspan="4"><label title="The percentage of coverage contributed by each single test.">Coverage contributed by</label> testAbaNumberCheck_35713_good</th> </tr> </thead> <tbody> <tr> <td> <span class="sortValue">com.cardatechnologies.utils.validators.abaroutevalidator.AbaRouteValidator</span> &#160;&#160;<a href="../../../../../com/cardatechnologies/utils/validators/abaroutevalidator/AbaRouteValidator.html?id=26293#AbaRouteValidator" title="AbaRouteValidator" name="sl-47">com.cardatechnologies.utils.validators.abaroutevalidator.AbaRouteValidator</a> </td> <td> <span class="sortValue">0.7352941</span>73.5% </td> <td class="align-middle" style="width: 100%" colspan="3"> <div> <div title="73.5% Covered" style="min-width:40px;" class="barNegative contribBarNegative contribBarNegative"><div class="barPositive contribBarPositive contribBarPositive" style="width:73.5%"></div></div></div> </td> </tr> </tbody> </table> </div> <!-- class="aui-page-panel-content-clover" --> <footer id="footer" role="contentinfo"> <section class="footer-body"> <ul> <li> Report generated by <a target="_new" href="http://openclover.org">OpenClover</a> v 4.4.1 on Sat Aug 7 2021 12:49:26 MDT using coverage data from Sat Aug 7 2021 12:47:23 MDT. </li> </ul> <ul> <li>OpenClover is free and open-source software. </li> </ul> </section> </footer> </section> <!-- class="aui-page-panel-content" --> </div> <!-- class="aui-page-panel-inner" --> </div> <!-- class="aui-page-panel" --> </div> <!-- id="page" --> </body> </html>
dcarda/aba.route.validator
target13/site/clover/com/cardatechnologies/utils/validators/abaroutevalidator/Test_AbaRouteValidator_17b_testAbaNumberCheck_35713_good_kad.html
HTML
apache-2.0
9,184
package com.iisigroup.web; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; @Controller public class HelloWorldController { @RequestMapping("helloWorld") public String helloWorld(Model model) { model.addAttribute("message", "Hello World!"); return "helloWorld"; } }
lf23617358/training-sample
springmvc/spring-mvc-first/spring-mvc-java/src/main/java/com/iisigroup/web/HelloWorldController.java
Java
apache-2.0
378
package zielu.junit5.intellij.extension.resources; import java.nio.file.Path; import org.junit.jupiter.api.extension.BeforeAllCallback; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.ParameterContext; import org.junit.jupiter.api.extension.ParameterResolutionException; import org.junit.jupiter.api.extension.ParameterResolver; import zielu.junit5.intellij.parameters.ExtensionContextParamResolver; import zielu.junit5.intellij.parameters.ParameterHolder; import zielu.junit5.intellij.util.TestUtil; public class ResourcesExtension implements ParameterResolver, BeforeAllCallback { private static final ExtensionContext.Namespace NS = ExtensionContext.Namespace.create(ResourcesExtension.class); private static final ParameterResolver RESOLVER = new ExtensionContextParamResolver(NS); @Override public void beforeAll(ExtensionContext context) { ParameterHolder holder = ParameterHolder.getHolder(context.getStore(NS)); holder.register(Path.class, ExternalPath.class, externalPath -> TestUtil.resolvePathFromParts(externalPath.value())); holder.register(TextResource.class, ResourcePath.class, TextResourceImpl::new); } @Override public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException { return RESOLVER.supportsParameter(parameterContext, extensionContext); } @Override public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException { return RESOLVER.resolveParameter(parameterContext, extensionContext); } }
zielu/GitToolBox
src/test/java/zielu/junit5/intellij/extension/resources/ResourcesExtension.java
Java
apache-2.0
1,730
import { MessageHandler } from "../src"; import { MessageMock } from "./__mocks__/message-mock"; describe("MessageHandler.whenMessageEndsWith test", () => { test("whenMessageEndsWith should fire", () => { // Given const handler = new MessageHandler(); const callback = jest.fn() handler.whenMessageEndsWith("foo").do(callback) // When const message = new MessageMock("lorem ipsum foo"); handler.handleMessage(message); // Then expect(callback).toHaveBeenCalled(); }); test("whenMessageEndsWith should not fire", () => { // Given const handler = new MessageHandler(); const callback = jest.fn() handler.whenMessageEndsWith("foo").do(callback) // When const message = new MessageMock("lorem foo ipsum"); handler.handleMessage(message); // Then expect(callback).toBeCalledTimes(0); }); });
lmmfranco/discord-message-handler
tests/whenMessageEndsWith.test.ts
TypeScript
apache-2.0
951
/*! \brief Header for SPI.c. * \details Header for SPI communication library. * \author Raphael Lauber, NTB * \date 01.12.2015 */ #ifndef SPI_H_ #define SPI_H_ #include <avr/io.h> /* Prototypes */ void SPI_Write(uint8_t*, uint8_t); void SPI_Read(uint8_t*, uint8_t); void SPI_WriteRead(uint8_t*, uint8_t, uint8_t*, uint8_t); #endif /* SPI_H_ */
bitlischieber/flinklight
Flink/SPI.h
C
apache-2.0
355
{% extends 'layout.html' %} {% load project_tags %} {% block content %} <div class="container subproject-details"> <div class="row current-version"> <div class="row"> <h1> {{ subproject.parent.name }} - {{ subproject.name }} <br> {% if current_version %} <small> آخرین ورژن :‌ {{ current_version.version }} </small> {% endif %} </h1> </div> <div class="row"> {% if current_version %} <div class="col-xs-16"> <p class="current-version-change-log"> {{ current_version.change_log|linebreaksbr }} </p> </div> {% else %} <div class="col-xs-16"> <h2 style="text-align: center;"> این پروژه هنوز ورژنی ارائه نکرده است </h2> </div> {% endif %} </div> </div> {% if all_versions %} <div class="row all-versions"> <h2> تاریخچه ورژن ها </h2> <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true"> {% for version in all_versions %} {% if version.version == current_version.version %} <div class="panel panel-success"> {% else %} <div class="panel panel-default"> {% endif %} <div class="panel-heading" role="tab" id="v{{ version.id }}"> <h4 class="panel-title"> <a role="button" data-toggle="collapse" data-parent="#accordion" href="#V{{ version.id }}" aria-expanded="false" aria-controls="V{{ version.id }}"> <span> {% if version.version == current_version.version %} نسخه فعلی : {% endif %} {{ version.version }} </span> <span style="float:left;direction: ltr"> {{ version.version_date }} </span> </a> </h4> </div> <div id="V{{ version.id }}" {% if version.version == current_version.version %} class="panel-collapse collapse in" {% else %} class="panel-collapse collapse" {% endif %} role="tabpanel" aria-labelledby="headingOne"> <div class="panel-body"> <p> {{ version.change_log|linebreaksbr }} </p> </div> </div> </div> {% endfor %} </div> </div> </div> {% endif %} {% endblock %}
MahdiZareie/VersionMonitoring
templates/subproject.html
HTML
apache-2.0
3,653
package com.canmeizhexue.test.image; import android.content.Context; import android.util.AttributeSet; import android.util.Log; import android.view.MotionEvent; import android.widget.TextView; /** * Created by silence on 2016/4/3. */ public class MyTextView extends TextView { public MyTextView(Context context) { super(context); } public MyTextView(Context context, AttributeSet attrs) { super(context, attrs); } @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { Log.d("silence", "---onLayout-------" + left+" = "+top+" = "+right+" = "+bottom); super.onLayout(changed, left, top, right, bottom); } @Override public boolean dispatchTouchEvent(MotionEvent ev) { int action=ev.getAction() & MotionEvent.ACTION_MASK; String actionString=""; switch (action){ case MotionEvent.ACTION_DOWN: actionString="ACTION_DOWN"; break; case MotionEvent.ACTION_MOVE: actionString="ACTION_MOVE"; break; case MotionEvent.ACTION_UP: actionString="ACTION_UP"; break; case MotionEvent.ACTION_CANCEL: actionString="ACTION_CANCEL"; break; } Log.d("silence", "---MyTextView----dispatchTouchEvent---" + actionString); return super.dispatchTouchEvent(ev); } @Override public boolean onTouchEvent(MotionEvent event) { final float xf = event.getX(); final float yf = event.getY(); Log.d("silence", "---MyTextView----onTouchEvent---" + xf+",,,,,,===="+yf); int action=event.getAction() & MotionEvent.ACTION_MASK; String actionString=""; switch (action){ case MotionEvent.ACTION_DOWN: actionString="ACTION_DOWN"; // return true; break; case MotionEvent.ACTION_MOVE: actionString="ACTION_MOVE"; break; case MotionEvent.ACTION_UP: actionString="ACTION_UP"; break; case MotionEvent.ACTION_CANCEL: actionString="ACTION_CANCEL"; break; } Log.d("silence", "---MyTextView----onTouchEvent---" + actionString); return super.onTouchEvent(event); } }
canmeizhexue/Test
app/src/main/java/com/canmeizhexue/test/image/MyTextView.java
Java
apache-2.0
2,432
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_151) on Wed Jul 17 13:50:42 MST 2019 --> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>VaultExpressionConstraintSupplier (BOM: * : All 2.5.0.Final API)</title> <meta name="date" content="2019-07-17"> <link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="VaultExpressionConstraintSupplier (BOM: * : All 2.5.0.Final API)"; } } catch(err) { } //--> var methods = {"i0":6}; var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"]}; var altColor = "altColor"; var rowColor = "rowColor"; var tableTab = "tableTab"; var activeTableTab = "activeTableTab"; </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="class-use/VaultExpressionConstraintSupplier.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../../index-all.html">Index</a></li> <li><a href="../../../../../../help-doc.html">Help</a></li> </ul> <div class="aboutLanguage">Thorntail API, 2.5.0.Final</div> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../../../org/wildfly/swarm/config/management/access/VaultExpressionConstraintConsumer.html" title="interface in org.wildfly.swarm.config.management.access"><span class="typeNameLink">Prev&nbsp;Class</span></a></li> <li>Next&nbsp;Class</li> </ul> <ul class="navList"> <li><a href="../../../../../../index.html?org/wildfly/swarm/config/management/access/VaultExpressionConstraintSupplier.html" target="_top">Frames</a></li> <li><a href="VaultExpressionConstraintSupplier.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li>Constr&nbsp;|&nbsp;</li> <li><a href="#method.summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li>Constr&nbsp;|&nbsp;</li> <li><a href="#method.detail">Method</a></li> </ul> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <!-- ======== START OF CLASS DATA ======== --> <div class="header"> <div class="subTitle">org.wildfly.swarm.config.management.access</div> <h2 title="Interface VaultExpressionConstraintSupplier" class="title">Interface VaultExpressionConstraintSupplier&lt;T extends <a href="../../../../../../org/wildfly/swarm/config/management/access/VaultExpressionConstraint.html" title="class in org.wildfly.swarm.config.management.access">VaultExpressionConstraint</a>&gt;</h2> </div> <div class="contentContainer"> <div class="description"> <ul class="blockList"> <li class="blockList"> <dl> <dt>Functional Interface:</dt> <dd>This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.</dd> </dl> <hr> <br> <pre><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/FunctionalInterface.html?is-external=true" title="class or interface in java.lang">@FunctionalInterface</a> public interface <span class="typeNameLabel">VaultExpressionConstraintSupplier&lt;T extends <a href="../../../../../../org/wildfly/swarm/config/management/access/VaultExpressionConstraint.html" title="class in org.wildfly.swarm.config.management.access">VaultExpressionConstraint</a>&gt;</span></pre> </li> </ul> </div> <div class="summary"> <ul class="blockList"> <li class="blockList"> <!-- ========== METHOD SUMMARY =========== --> <ul class="blockList"> <li class="blockList"><a name="method.summary"> <!-- --> </a> <h3>Method Summary</h3> <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tr id="i0" class="altColor"> <td class="colFirst"><code><a href="../../../../../../org/wildfly/swarm/config/management/access/VaultExpressionConstraint.html" title="class in org.wildfly.swarm.config.management.access">VaultExpressionConstraint</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/wildfly/swarm/config/management/access/VaultExpressionConstraintSupplier.html#get--">get</a></span>()</code> <div class="block">Constructed instance of VaultExpressionConstraint resource</div> </td> </tr> </table> </li> </ul> </li> </ul> </div> <div class="details"> <ul class="blockList"> <li class="blockList"> <!-- ============ METHOD DETAIL ========== --> <ul class="blockList"> <li class="blockList"><a name="method.detail"> <!-- --> </a> <h3>Method Detail</h3> <a name="get--"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>get</h4> <pre><a href="../../../../../../org/wildfly/swarm/config/management/access/VaultExpressionConstraint.html" title="class in org.wildfly.swarm.config.management.access">VaultExpressionConstraint</a>&nbsp;get()</pre> <div class="block">Constructed instance of VaultExpressionConstraint resource</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>The instance</dd> </dl> </li> </ul> </li> </ul> </li> </ul> </div> </div> <!-- ========= END OF CLASS DATA ========= --> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="class-use/VaultExpressionConstraintSupplier.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../../index-all.html">Index</a></li> <li><a href="../../../../../../help-doc.html">Help</a></li> </ul> <div class="aboutLanguage">Thorntail API, 2.5.0.Final</div> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../../../org/wildfly/swarm/config/management/access/VaultExpressionConstraintConsumer.html" title="interface in org.wildfly.swarm.config.management.access"><span class="typeNameLink">Prev&nbsp;Class</span></a></li> <li>Next&nbsp;Class</li> </ul> <ul class="navList"> <li><a href="../../../../../../index.html?org/wildfly/swarm/config/management/access/VaultExpressionConstraintSupplier.html" target="_top">Frames</a></li> <li><a href="VaultExpressionConstraintSupplier.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li>Constr&nbsp;|&nbsp;</li> <li><a href="#method.summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li>Constr&nbsp;|&nbsp;</li> <li><a href="#method.detail">Method</a></li> </ul> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small>Copyright &#169; 2019 <a href="http://www.jboss.org">JBoss by Red Hat</a>. All rights reserved.</small></p> </body> </html>
wildfly-swarm/wildfly-swarm-javadocs
2.5.0.Final/apidocs/org/wildfly/swarm/config/management/access/VaultExpressionConstraintSupplier.html
HTML
apache-2.0
9,448
module ActiveSupport module VERSION #:nodoc: MAJOR = 3 MINOR = 2 TINY = 0 PRE = nil STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.') end end
masukomi/mobtvse
vendor/bundle/gems/activesupport-3.2.0/lib/active_support/version.rb
Ruby
apache-2.0
173
// Copyright (c) 2016 ~ 2018, Alex Stocks. // // 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 server /* // consumer: rpc client -> rpc stream -> rpc codec -> transport + codec // provider: rpc server -> rpc stream -> rpc codec -> transport + codec func (s *server) handlePkg(servo interface{}, sock transport.Socket) { sock.Recv(&pkg) // pkg = transport.Package // func (r *rpcStream) Recv(pkg interface{}) error { // r.codec.ReadRequestHeader(&req, false) // // func (c *rpcCodec) ReadRequestHeader(r *request, first bool) error // // c.socket.Recv(&tm) // tm(transport.Package) // // // func (h *httpTransportSocket) Recv(m *Message) error { // 读取全部reqeust,并赋值给m(transport.Package) // // // http.ReadRequest(h.buff) // // // ioutil.ReadAll(r.Body) // // // m.Target = m.Header["Path"] // // // } // // // // err := c.codec.ReadHeader(&m, codec.Request) // // // func (j *jsonCodec) ReadHeader(m *codec.Message, mt codec.MessageType) // // // case codec.Request: // // // return j.s.ReadHeader(m) // // // // func (c *serverCodec) ReadHeader(m *codec.Message) error { // serverCodec, github.com/AlexStocks/dubbogo/codec // // // // c.dec.Decode(&raw) // // // // json.Unmarshal(raw, &c.req) // 注意此处,c.req存储了请求的body // // // // m.Id = c.seq // // // // m.Method = c.req.Method // // // // m.Target = m.Header["Path"] // // // // } // // // } // // r.Service = m.Target // // r.Method = m.Method // // r.Seq = m.Id // // return err // // } // (c *rpcCodec) ReadRequestHeader // r.codec.ReadRequestBody(pkg) // } codecFunc, err = s.newCodec(contentType) // dubbogo.codec codec = newRPCCodec(&pkg, sock, codecFunc) rpc.serveRequest(ctx, codec, contentType) // func (server *server) serveRequest(ctx context.Context, codec serverCodec, ct string) error { // server.readRequest(codec) // // func (server *server) readRequest(codec serverCodec) { // // server.readRequestHeader(codec) // // // func (server *server) readRequestHeader(codec serverCodec) // // // err = codec.ReadRequestHeader(req, true) // 注意此时first为false,避免进行网络收发,只读取相关分析结果 // // // // func (c *rpcCodec) ReadRequestHeader(r *request, first bool) error { // // // // m := codec.Message{Header: c.req.Header} // // // // err := c.codec.ReadHeader(&m, codec.Request) // // // // r.Service = m.Target // // // // r.Method = m.Method // // // // r.Seq = m.Id // // // // return err // // // // } // // // service = server.serviceMap[req.Service] // 根据Service // // // mtype = service.method[req.Method] // 获取method, 供下面的call调用 // // // } // // codec.ReadRequestBody(argv.Interface()) // rpcCodec.ReadRequestBody // // // func (c *rpcCodec) ReadRequestBody(b interface{}) error { // // // return c.codec.ReadBody(b) // // // // func (c *serverCodec) ReadBody(x interface{}) error { // // // // json.Unmarshal(*c.req.Params, x) // decode request body, c.req value line 19 // // // // } // // // } // // } // service.call() // } } */
AlexStocks/dubbogo
server/doc.go
GO
apache-2.0
3,853
#Solution# * 第一种方法里面,使用了从begin到end的路径,通过BFS来求解问题。但是会TLE,所以需要two-end的方法来解决问题。 * 第二种方法,就是使用了two-end的方法。 * 从两头开始寻找,直到找到middle,发现相遇之后,得到求解。
MyYaYa/leetcode
src/problem127/README.md
Markdown
apache-2.0
300
/* * 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. */ #include "route_control.h" #include <inttypes.h> #include <stdio.h> #include <qpid/dispatch/iterator.h> ALLOC_DEFINE(qdr_link_route_t); ALLOC_DEFINE(qdr_auto_link_t); ALLOC_DEFINE(qdr_conn_identifier_t); const char CONTAINER_PREFIX = 'C'; const char CONNECTION_PREFIX = 'L'; static qdr_conn_identifier_t *qdr_route_declare_id_CT(qdr_core_t *core, qd_iterator_t *container, qd_iterator_t *connection) { qdr_conn_identifier_t *cid = 0; if (container && connection) { qd_iterator_reset_view(container, ITER_VIEW_ADDRESS_HASH); qd_iterator_annotate_prefix(container, CONTAINER_PREFIX); qd_hash_retrieve(core->conn_id_hash, container, (void**) &cid); if (!cid) { qd_iterator_reset_view(connection, ITER_VIEW_ADDRESS_HASH); qd_iterator_annotate_prefix(connection, CONNECTION_PREFIX); qd_hash_retrieve(core->conn_id_hash, connection, (void**) &cid); } if (!cid) { cid = new_qdr_conn_identifier_t(); ZERO(cid); // // The container and the connection will represent the same connection. // qd_hash_insert(core->conn_id_hash, container, cid, &cid->container_hash_handle); qd_hash_insert(core->conn_id_hash, connection, cid, &cid->connection_hash_handle); } } else if (container) { qd_iterator_reset_view(container, ITER_VIEW_ADDRESS_HASH); qd_iterator_annotate_prefix(container, CONTAINER_PREFIX); qd_hash_retrieve(core->conn_id_hash, container, (void**) &cid); if (!cid) { cid = new_qdr_conn_identifier_t(); ZERO(cid); qd_hash_insert(core->conn_id_hash, container, cid, &cid->container_hash_handle); } } else if (connection) { qd_iterator_reset_view(connection, ITER_VIEW_ADDRESS_HASH); qd_iterator_annotate_prefix(connection, CONNECTION_PREFIX); qd_hash_retrieve(core->conn_id_hash, connection, (void**) &cid); if (!cid) { cid = new_qdr_conn_identifier_t(); ZERO(cid); qd_hash_insert(core->conn_id_hash, connection, cid, &cid->connection_hash_handle); } } return cid; } static void qdr_route_check_id_for_deletion_CT(qdr_core_t *core, qdr_conn_identifier_t *cid) { // // If this connection identifier has no open connection and no referencing routes, // it can safely be deleted and removed from the hash index. // if (DEQ_IS_EMPTY(cid->connection_refs) && DEQ_IS_EMPTY(cid->link_route_refs) && DEQ_IS_EMPTY(cid->auto_link_refs)) { qd_hash_remove_by_handle(core->conn_id_hash, cid->connection_hash_handle); qd_hash_remove_by_handle(core->conn_id_hash, cid->container_hash_handle); free_qdr_conn_identifier_t(cid); } } static void qdr_route_log_CT(qdr_core_t *core, const char *text, const char *name, uint64_t id, qdr_connection_t *conn) { const char *key = (const char*) qd_hash_key_by_handle(conn->conn_id->connection_hash_handle); if (!key) key = (const char*) qd_hash_key_by_handle(conn->conn_id->container_hash_handle); char id_string[64]; const char *log_name = name ? name : id_string; if (!name) snprintf(id_string, 64, "%"PRId64, id); qd_log(core->log, QD_LOG_INFO, "%s '%s' on %s %s", text, log_name, key[0] == 'L' ? "connection" : "container", &key[1]); } static void qdr_link_route_activate_CT(qdr_core_t *core, qdr_link_route_t *lr, qdr_connection_t *conn) { const char *key; qdr_route_log_CT(core, "Link Route Activated", lr->name, lr->identity, conn); // // Activate the address for link-routed destinations. If this is the first // activation for this address, notify the router module of the added address. // if (lr->addr) { qdr_add_connection_ref(&lr->addr->conns, conn); if (DEQ_SIZE(lr->addr->conns) == 1) { key = (const char*) qd_hash_key_by_handle(lr->addr->hash_handle); if (key) qdr_post_mobile_added_CT(core, key); } } lr->active = true; } static void qdr_link_route_deactivate_CT(qdr_core_t *core, qdr_link_route_t *lr, qdr_connection_t *conn) { const char *key; qdr_route_log_CT(core, "Link Route Deactivated", lr->name, lr->identity, conn); // // Deactivate the address(es) for link-routed destinations. // if (lr->addr) { qdr_del_connection_ref(&lr->addr->conns, conn); if (DEQ_IS_EMPTY(lr->addr->conns)) { key = (const char*) qd_hash_key_by_handle(lr->addr->hash_handle); if (key) qdr_post_mobile_removed_CT(core, key); } } lr->active = false; } static void qdr_auto_link_activate_CT(qdr_core_t *core, qdr_auto_link_t *al, qdr_connection_t *conn) { const char *key; qdr_route_log_CT(core, "Auto Link Activated", al->name, al->identity, conn); if (al->addr) { qdr_terminus_t *source = 0; qdr_terminus_t *target = 0; qdr_terminus_t *term = qdr_terminus(0); if (al->dir == QD_INCOMING) source = term; else target = term; key = (const char*) qd_hash_key_by_handle(al->addr->hash_handle); if (key || al->external_addr) { if (al->external_addr) qdr_terminus_set_address(term, al->external_addr); else qdr_terminus_set_address(term, &key[2]); // truncate the "Mp" annotation (where p = phase) al->link = qdr_create_link_CT(core, conn, QD_LINK_ENDPOINT, al->dir, source, target); al->link->auto_link = al; al->state = QDR_AUTO_LINK_STATE_ATTACHING; } } } static void qdr_auto_link_deactivate_CT(qdr_core_t *core, qdr_auto_link_t *al, qdr_connection_t *conn) { qdr_route_log_CT(core, "Auto Link Deactivated", al->name, al->identity, conn); if (al->link) { qdr_link_outbound_detach_CT(core, al->link, 0, QDR_CONDITION_ROUTED_LINK_LOST, true); al->link->auto_link = 0; al->link = 0; } al->state = QDR_AUTO_LINK_STATE_INACTIVE; } qdr_link_route_t *qdr_route_add_link_route_CT(qdr_core_t *core, qd_iterator_t *name, qd_parsed_field_t *prefix_field, qd_parsed_field_t *container_field, qd_parsed_field_t *connection_field, qd_address_treatment_t treatment, qd_direction_t dir) { qdr_link_route_t *lr = new_qdr_link_route_t(); // // Set up the link_route structure // ZERO(lr); lr->identity = qdr_identifier(core); lr->name = name ? (char*) qd_iterator_copy(name) : 0; lr->dir = dir; lr->treatment = treatment; // // Find or create an address for link-attach routing // qd_iterator_t *iter = qd_parse_raw(prefix_field); qd_iterator_reset_view(iter, ITER_VIEW_ADDRESS_HASH); qd_iterator_annotate_prefix(iter, dir == QD_INCOMING ? 'C' : 'D'); qd_hash_retrieve(core->addr_hash, iter, (void*) &lr->addr); if (!lr->addr) { lr->addr = qdr_address_CT(core, treatment); DEQ_INSERT_TAIL(core->addrs, lr->addr); qd_hash_insert(core->addr_hash, iter, lr->addr, &lr->addr->hash_handle); } lr->addr->ref_count++; // // Find or create a connection identifier structure for this link route // if (container_field || connection_field) { lr->conn_id = qdr_route_declare_id_CT(core, qd_parse_raw(container_field), qd_parse_raw(connection_field)); DEQ_INSERT_TAIL_N(REF, lr->conn_id->link_route_refs, lr); qdr_connection_ref_t * cref = DEQ_HEAD(lr->conn_id->connection_refs); while (cref) { qdr_link_route_activate_CT(core, lr, cref->conn); cref = DEQ_NEXT(cref); } } // // Add the link route to the core list // DEQ_INSERT_TAIL(core->link_routes, lr); return lr; } void qdr_route_del_link_route_CT(qdr_core_t *core, qdr_link_route_t *lr) { // // Disassociate from the connection identifier. Check to see if the identifier // should be removed. // qdr_conn_identifier_t *cid = lr->conn_id; if (cid) { qdr_connection_ref_t * cref = DEQ_HEAD(cid->connection_refs); while (cref) { qdr_link_route_deactivate_CT(core, lr, cref->conn); cref = DEQ_NEXT(cref); } DEQ_REMOVE_N(REF, cid->link_route_refs, lr); qdr_route_check_id_for_deletion_CT(core, cid); } // // Disassociate the link route from its address. Check to see if the address // should be removed. // qdr_address_t *addr = lr->addr; if (addr && --addr->ref_count == 0) qdr_check_addr_CT(core, addr, false); // // Remove the link route from the core list. // DEQ_REMOVE(core->link_routes, lr); free(lr->name); free_qdr_link_route_t(lr); } qdr_auto_link_t *qdr_route_add_auto_link_CT(qdr_core_t *core, qd_iterator_t *name, qd_parsed_field_t *addr_field, qd_direction_t dir, int phase, qd_parsed_field_t *container_field, qd_parsed_field_t *connection_field, qd_parsed_field_t *external_addr) { qdr_auto_link_t *al = new_qdr_auto_link_t(); // // Set up the auto_link structure // ZERO(al); al->identity = qdr_identifier(core); al->name = name ? (char*) qd_iterator_copy(name) : 0; al->dir = dir; al->phase = phase; al->state = QDR_AUTO_LINK_STATE_INACTIVE; al->external_addr = external_addr ? (char*) qd_iterator_copy(qd_parse_raw(external_addr)) : 0; // // Find or create an address for the auto_link destination // qd_iterator_t *iter = qd_parse_raw(addr_field); qd_iterator_reset_view(iter, ITER_VIEW_ADDRESS_HASH); qd_iterator_annotate_phase(iter, (char) phase + '0'); qd_hash_retrieve(core->addr_hash, iter, (void*) &al->addr); if (!al->addr) { al->addr = qdr_address_CT(core, qdr_treatment_for_address_CT(core, 0, iter, 0, 0)); DEQ_INSERT_TAIL(core->addrs, al->addr); qd_hash_insert(core->addr_hash, iter, al->addr, &al->addr->hash_handle); } al->addr->ref_count++; // // Find or create a connection identifier structure for this auto_link // if (container_field || connection_field) { al->conn_id = qdr_route_declare_id_CT(core, qd_parse_raw(container_field), qd_parse_raw(connection_field)); DEQ_INSERT_TAIL_N(REF, al->conn_id->auto_link_refs, al); qdr_connection_ref_t * cref = DEQ_HEAD(al->conn_id->connection_refs); while (cref) { qdr_auto_link_activate_CT(core, al, cref->conn); cref = DEQ_NEXT(cref); } } // // Add the auto_link to the core list // DEQ_INSERT_TAIL(core->auto_links, al); return al; } void qdr_route_del_auto_link_CT(qdr_core_t *core, qdr_auto_link_t *al) { // // Disassociate from the connection identifier. Check to see if the identifier // should be removed. // qdr_conn_identifier_t *cid = al->conn_id; if (cid) { qdr_connection_ref_t * cref = DEQ_HEAD(cid->connection_refs); while (cref) { qdr_auto_link_deactivate_CT(core, al, cref->conn); cref = DEQ_NEXT(cref); } DEQ_REMOVE_N(REF, cid->auto_link_refs, al); qdr_route_check_id_for_deletion_CT(core, cid); } // // Disassociate the auto link from its address. Check to see if the address // should be removed. // qdr_address_t *addr = al->addr; if (addr && --addr->ref_count == 0) qdr_check_addr_CT(core, addr, false); // // Remove the auto link from the core list. // DEQ_REMOVE(core->auto_links, al); free(al->name); free(al->external_addr); free_qdr_auto_link_t(al); } void qdr_route_connection_opened_CT(qdr_core_t *core, qdr_connection_t *conn, qdr_field_t *container_field, qdr_field_t *connection_field) { if (conn->role != QDR_ROLE_ROUTE_CONTAINER) return; qdr_conn_identifier_t *cid = qdr_route_declare_id_CT(core, container_field?container_field->iterator:0, connection_field?connection_field->iterator:0); qdr_add_connection_ref(&cid->connection_refs, conn); conn->conn_id = cid; // // Activate all link-routes associated with this remote container. // qdr_link_route_t *lr = DEQ_HEAD(cid->link_route_refs); while (lr) { qdr_link_route_activate_CT(core, lr, conn); lr = DEQ_NEXT_N(REF, lr); } // // Activate all auto-links associated with this remote container. // qdr_auto_link_t *al = DEQ_HEAD(cid->auto_link_refs); while (al) { qdr_auto_link_activate_CT(core, al, conn); al = DEQ_NEXT_N(REF, al); } } void qdr_route_connection_closed_CT(qdr_core_t *core, qdr_connection_t *conn) { if (conn->role != QDR_ROLE_ROUTE_CONTAINER) return; qdr_conn_identifier_t *cid = conn->conn_id; if (cid) { // // Deactivate all link-routes associated with this remote container. // qdr_link_route_t *lr = DEQ_HEAD(cid->link_route_refs); while (lr) { qdr_link_route_deactivate_CT(core, lr, conn); lr = DEQ_NEXT_N(REF, lr); } // // Deactivate all auto-links associated with this remote container. // qdr_auto_link_t *al = DEQ_HEAD(cid->auto_link_refs); while (al) { qdr_auto_link_deactivate_CT(core, al, conn); al = DEQ_NEXT_N(REF, al); } // // Remove our own entry in the connection list // qdr_del_connection_ref(&cid->connection_refs, conn); conn->conn_id = 0; qdr_route_check_id_for_deletion_CT(core, cid); } }
alanconway/dispatch
src/router_core/route_control.c
C
apache-2.0
15,554
import shutil import tempfile import numpy as np import os from os.path import getsize import pytest import yaml from util import PATH_TO_TESTS, seed, dummy_predict_with_threshold PATH_TO_ASSETS = os.path.join(PATH_TO_TESTS, 'assets') PATH_TO_RETINA_DIR = os.path.join(PATH_TO_ASSETS, 'recordings', 'retina') PATH_TO_RETINA_CONFIG_DIR = os.path.join(PATH_TO_RETINA_DIR, 'config') @pytest.fixture(autouse=True) def setup(): seed(0) @pytest.fixture def patch_triage_network(monkeypatch): to_patch = 'yass.neuralnetwork.model.KerasModel.predict_with_threshold' monkeypatch.setattr(to_patch, dummy_predict_with_threshold) yield def _path_to_config(): return os.path.join(PATH_TO_RETINA_CONFIG_DIR, 'config.yaml') def _data_info(): with open(_path_to_config()) as f: d = yaml.load(f) return d @pytest.fixture() def data_info(): return _data_info() @pytest.fixture() def data(): info = _data_info()['recordings'] path = os.path.join(PATH_TO_RETINA_DIR, 'data.bin') d = np.fromfile(path, dtype=info['dtype']) n_observations = int(getsize(path) / info['n_channels'] / np.dtype(info['dtype']).itemsize) d = d.reshape(n_observations, info['n_channels']) return d @pytest.fixture() def path_to_tests(): return PATH_TO_TESTS @pytest.fixture() def path_to_performance(): return os.path.join(PATH_TO_TESTS, 'performance/') @pytest.fixture def make_tmp_folder(): temp = tempfile.mkdtemp() yield temp shutil.rmtree(temp) @pytest.fixture() def path_to_data(): return os.path.join(PATH_TO_RETINA_DIR, 'data.bin') @pytest.fixture() def path_to_geometry(): return os.path.join(PATH_TO_RETINA_DIR, 'geometry.npy') @pytest.fixture() def path_to_sample_pipeline_folder(): return os.path.join(PATH_TO_RETINA_DIR, 'sample_pipeline_output') @pytest.fixture() def path_to_standardized_data(): return os.path.join(PATH_TO_RETINA_DIR, 'sample_pipeline_output', 'preprocess', 'standardized.bin') @pytest.fixture() def path_to_output_reference(): return os.path.join(PATH_TO_ASSETS, 'output_reference') @pytest.fixture def path_to_config(): return _path_to_config() @pytest.fixture def path_to_config_threshold(): return os.path.join(PATH_TO_RETINA_CONFIG_DIR, 'config_threshold.yaml') @pytest.fixture def path_to_config_with_wrong_channels(): return os.path.join(PATH_TO_RETINA_CONFIG_DIR, 'wrong_channels.yaml') @pytest.fixture def path_to_txt_geometry(): return os.path.join(PATH_TO_ASSETS, 'test_files', 'geometry.txt') @pytest.fixture def path_to_npy_geometry(): return os.path.join(PATH_TO_ASSETS, 'test_files', 'geometry.npy')
paninski-lab/yass
tests/conftest.py
Python
apache-2.0
2,794
package com.palmelf.eoffice.dao.admin.impl; import com.palmelf.core.dao.impl.BaseDaoImpl; import com.palmelf.eoffice.dao.admin.GoodsApplyDao; import com.palmelf.eoffice.model.admin.GoodsApply; public class GoodsApplyDaoImpl extends BaseDaoImpl<GoodsApply> implements GoodsApplyDao { public GoodsApplyDaoImpl() { super(GoodsApply.class); } }
jacarrichan/eoffice
src/main/java/com/palmelf/eoffice/dao/admin/impl/GoodsApplyDaoImpl.java
Java
apache-2.0
349
/* Yet Another Forum.NET * Copyright (C) 2003-2005 Bjørnar Henden * Copyright (C) 2006-2013 Jaben Cargman * Copyright (C) 2014-2022 Ingo Herbote * https://www.yetanotherforum.net/ * * 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 * https://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. */ namespace YAF.Web.Extensions { using System.Linq; using System.Text; using YAF.Core.BasePages; using YAF.Core.Context; using YAF.Core.Helpers; using YAF.Types.Constants; using YAF.Types.Extensions; using YAF.Types.Interfaces; using YAF.Web.Controls; public static class ForumPageExtensions { public static string GeneratePageTitle(this ForumPage page) { var title = new StringBuilder(); var pageString = string.Empty; if (BoardContext.Current.CurrentForumPage.PageType is ForumPages.Posts or ForumPages.Topics) { // get current page... var currentPager = page.FindControlAs<Pager>("Pager"); if (currentPager != null && currentPager.CurrentPageIndex != 0) { pageString = BoardContext.Current.BoardSettings.PagingTitleTemplate.Replace( "{paging}", $"{BoardContext.Current.Get<ILocalization>().GetText("COMMON", "PAGE")} {currentPager.CurrentPageIndex + 1}"); } } if (!BoardContext.Current.CurrentForumPage.IsAdminPage) { switch (BoardContext.Current.CurrentForumPage.PageType) { case ForumPages.Posts: if (BoardContext.Current.PageTopicID != 0) { // Tack on the topic we're viewing title.Append( BoardContext.Current.Get<IBadWordReplace>() .Replace(BoardContext.Current.PageTopic.TopicName.Truncate(80))); } // Append Current Page title.Append(pageString); break; case ForumPages.Topics: if (BoardContext.Current.PageForum != null && BoardContext.Current.PageForum.Name.IsSet()) { // Tack on the forum we're viewing title.Append(page.HtmlEncode(BoardContext.Current.PageForum.Name.Truncate(80))); } // Append Current Page title.Append(pageString); break; case ForumPages.Board: if (BoardContext.Current.PageCategory != null && BoardContext.Current.PageCategory.Name.IsSet()) { // Tack on the forum we're viewing title.Append(page.HtmlEncode(BoardContext.Current.PageCategory.Name.Truncate(80))); } break; default: var pageLinks = page.FindControlAs<PageLinks>("PageLinks"); var activePageLink = pageLinks?.PageLinkList?.FirstOrDefault(link => link.URL.IsNotSet()); if (activePageLink != null) { // Tack on the forum we're viewing title.Append(page.HtmlEncode(activePageLink.Title.Truncate(80))); } break; } } else { var pageLinks = page.FindControlAs<PageLinks>("PageLinks"); var activePageLink = pageLinks?.PageLinkList?.FirstOrDefault(link => link.URL.IsNotSet()); if (activePageLink != null) { // Tack on the forum we're viewing title.Append(page.HtmlEncode(activePageLink.Title)); } } var boardName = page.HtmlEncode(BoardContext.Current.BoardSettings.Name); return title.Length > 0 ? BoardContext.Current.BoardSettings.TitleTemplate.Replace("{title}", title.ToString()) .Replace("{boardName}", boardName) : boardName; } } }
YAFNET/YAFNET
yafsrc/YAF.Web/Extensions/ForumPageExtension.cs
C#
apache-2.0
5,144