text
stringlengths
27
775k
let arr = ['w','teacher','manager']; let obj = {"success":true,"message":"","code":200,"result":true} let obj_err = {"success":false,"message":"用户账号已存在","code":200,"result":true} let url = 'get|/tice/sys/user/checkOnlyUser'; import {getQueryString} from '@/utils/util' export default { 'get|/tice/sys/user/checkOnlyUser': option => { let username = getQueryString(option.url, "username"); if(arr.indexOf(username)<0) { console.log('请求url:'+url+",结果:"+JSON.stringify(obj)); return obj }else { console.log('请求url:'+url+",结果:"+JSON.stringify(obj_err)); return obj_err } } }
############################## # Test prandtl_meyer functions ############################## import gas_dynamics as gd from gas_dynamics.fluids import air, methane import random class Test_prandtl_meyer_angle_from_mach: def test_one(self): a = random.uniform(1.01,10) assert float(gd.prandtl_meyer_angle_from_mach(a)) def test_two(self): a = random.uniform(1.01,10) assert float(gd.prandtl_meyer_angle_from_mach(a, methane)) def test_three(self): assert gd.prandtl_meyer_angle_from_mach(1) == 0.0 def test_four(self): assert gd.prandtl_meyer_angle_from_mach(1, methane) == 0.0 def test_five(self): zero = gd.prandtl_meyer_angle_from_mach(2) - 26.37976 assert abs(zero) < 1e-4 class Test_prandtl_meyer_mach_from_angle: def test_one(self): a = random.uniform(0,130) assert float(gd.prandtl_meyer_mach_from_angle(a)) def test_two(self): a = random.uniform(0,130) assert float(gd.prandtl_meyer_mach_from_angle(a, methane)) def test_three(self): zero = gd.prandtl_meyer_mach_from_angle(0) - 1.0 assert abs(zero) < 1e-5 def test_four(self): zero = gd.prandtl_meyer_mach_from_angle(0, methane) - 1.0 assert abs(zero) < 1e-5 def test_five(self): zero = gd.prandtl_meyer_mach_from_angle(45) - 2.764452 assert abs(zero) < 1e-5 class Test_mach_wave_angle: def test_one(self): a = random.uniform(1,10) assert float(gd.mach_wave_angle(a)) def test_two(self): zero = gd.mach_wave_angle(2.0) - 30 assert abs(zero) < 1e-5
#include<iostream> #include<unistd.h> #include<sys/wait.h> int main() { std::cout << "Fork test\n"; pid_t rt_value = 0; rt_value = fork(); if(rt_value == 0) { std::cout << "In Child..\n"; for(unsigned int i = 0; i < 100; ++i) { std::cout << "In Child process. \n"; } std::cout << "Child process done.\n"; _exit(EXIT_SUCCESS); } else { std::cout << "In Parent..\n"; for(unsigned int i = 0; i < 100; ++i) { std::cout << "In Parent process. \n"; } std::cout << "Parent process done..\n"; } int status = 0; waitpid(rt_value, &status, 0); std::cout << "Suceess!\n"; return 0; }
// Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. // SPDX-License-Identifier: Apache-2.0 package com.daml.platform.sandbox.stores.ledger.sql import java.time.{Duration => JDuration} import akka.stream.scaladsl.Sink import com.daml.ledger.api.domain import com.daml.ledger.api.testing.utils.{SuiteResourceManagementAroundAll, MockMessages => M} import com.daml.ledger.api.v1.admin.party_management_service.PartyManagementServiceGrpc import com.daml.ledger.api.v1.command_completion_service.CommandCompletionServiceGrpc import com.daml.ledger.api.v1.command_submission_service.{ CommandSubmissionServiceGrpc, SubmitRequest, } import com.daml.ledger.api.v1.commands.{Command, CreateCommand} import com.daml.ledger.api.v1.ledger_offset.LedgerOffset import com.daml.ledger.api.v1.transaction_service.TransactionServiceGrpc import com.daml.ledger.api.v1.value.{Record, RecordField, Value} import com.daml.ledger.client.configuration.CommandClientConfiguration import com.daml.ledger.client.services.admin.PartyManagementClient import com.daml.ledger.client.services.commands.CommandClient import com.daml.ledger.client.services.transactions.TransactionClient import com.daml.platform.sandbox.config.SandboxConfig import com.daml.platform.sandbox.services.{SandboxFixture, TestCommands} import com.daml.platform.services.time.TimeProviderType import org.scalatest.concurrent.ScalaFutures import org.scalatest.time.{Millis, Span} import org.scalatest.matchers.should.Matchers import org.scalatest.wordspec.AsyncWordSpec import scalaz.syntax.tag._ class TransactionStreamTerminationIT extends AsyncWordSpec with Matchers with ScalaFutures with TestCommands with SandboxFixture with SuiteResourceManagementAroundAll { override implicit def patienceConfig: PatienceConfig = PatienceConfig(scaled(Span(15000, Millis)), scaled(Span(150, Millis))) override protected def config: SandboxConfig = super.config.copy( // TODO: this class does not use SandboxBackend.H2Database, the jdbc url provided here will have no effect jdbcUrl = Some("jdbc:h2:mem:static_time;db_close_delay=-1"), timeProviderType = Some(TimeProviderType.Static), ) def commandClientConfig = CommandClientConfiguration( maxCommandsInFlight = config.commandConfig.maxCommandsInFlight, maxParallelSubmissions = config.commandConfig.maxParallelSubmissions, defaultDeduplicationTime = JDuration.ofSeconds(30), ) private val applicationId = "transaction-stream-termination-test" private def newTransactionClient(ledgerId: domain.LedgerId) = new TransactionClient(ledgerId, TransactionServiceGrpc.stub(channel)) private def newPartyManagement() = new PartyManagementClient(PartyManagementServiceGrpc.stub(channel)) private def newCommandSubmissionClient(ledgerId: domain.LedgerId) = new CommandClient( CommandSubmissionServiceGrpc.stub(channel), CommandCompletionServiceGrpc.stub(channel), ledgerId, applicationId, commandClientConfig, ) "TransactionService" when { "streaming transactions until ledger end with no corresponding ledger entries" should { "terminate properly" in { val actualLedgerId = ledgerId() val begin = LedgerOffset(LedgerOffset.Value.Boundary(LedgerOffset.LedgerBoundary.LEDGER_BEGIN)) val end = LedgerOffset(LedgerOffset.Value.Boundary(LedgerOffset.LedgerBoundary.LEDGER_END)) val submitRequest: SubmitRequest = M.submitRequest.update( _.commands.ledgerId := actualLedgerId.unwrap, _.commands.applicationId := applicationId, _.commands.commands := List( Command( Command.Command.Create( CreateCommand( Some(templateIds.dummy), Some( Record( Some(templateIds.dummy), Seq( RecordField( "operator", Option( Value(Value.Sum.Party(M.submitAndWaitRequest.commands.get.party)) ), ) ), ) ), ) ) ) ), ) val commandClient = newCommandSubmissionClient(actualLedgerId) val txClient = newTransactionClient(actualLedgerId) val partyManagementClient = newPartyManagement() def getLedgerEnd = txClient.getLedgerEnd().map(_.getOffset.value.absolute.get.toLong) for { endAtStartOfTest <- getLedgerEnd // first we create a transaction _ <- commandClient.trackSingleCommand(submitRequest) endAfterSubmission <- getLedgerEnd // next we allocate a party. this causes the ledger end to move without a corresponding ledger entry _ <- partyManagementClient.allocateParty(None, None) endAfterParty <- getLedgerEnd // without the fix, this call will cause the test to run into a timeout transactions <- txClient .getTransactions(begin, Some(end), M.transactionFilter) .runWith(Sink.seq) } yield { endAtStartOfTest should be < endAfterSubmission endAfterSubmission should be < endAfterParty transactions should have size 1 } } } } }
// Copyright (c) Jeremy Tuloup. // Distributed under the terms of the Modified BSD License. export const EXTENSION_SPEC_VERSION = '1.0.0';
#! /usr/bin/env perl # # Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved. # # Licensed under the Apache License 2.0 (the "License"). You may not use # this file except in compliance with the License. You can obtain a copy # in the file LICENSE in the source distribution or at # https://www.openssl.org/source/license.html use strict; use warnings; use OpenSSL::Test::Simple; use OpenSSL::Test qw(:DEFAULT openssl_versions); use OpenSSL::Test::Utils qw(alldisabled available_protocols); setup("test_cipherlist"); my ($build_version, $library_version) = openssl_versions(); plan skip_all => "This test recipe isn't supported when doing regression testing" if $build_version ne $library_version; my $no_anytls = alldisabled(available_protocols("tls")); # If we have no protocols, then we also have no supported ciphers. plan skip_all => "No SSL/TLS protocol is supported by this OpenSSL build." if $no_anytls; simple_test("test_cipherlist", "cipherlist_test", "cipherlist");
--- title: Understand Format of GovCloud Linkage Payload description: Learn how to format the relationship that establishes a GovCloud linkage. position: 17 content_markdown: |- Familiarize yourself with the format of the payload that you can post to define the linkage between a GovCloud Commercial Account and a GovCloud Asset Account. **GovCloud Commercial Account:** The proxy account that contains the costs for the account in the Detailed Billing Record. **GovCloud Asset Account:** The account that owns the AWS assets. Express a linkage between two of these accounts in the following format: ``` { "govcloud_acct_id": 1, "commercial_acct_id": 2 } ``` In order to get the values of `govcloud_acct_id` and `commercial_acct_id` use these steps: 1. Make a GET request as shown in [AWS Accounts in CloudHealth](#account_aws-accounts-in-cloudhealth). 2. From the response, which contains all AWS accounts associated with the customer, isolate the GovCloud Commercial Account and the GovCloud Asset Account. 3. Copy the value of the `id` field for both accounts. 4. Use the `id` of the GovCloud Commercial Account as the value of `govcloud_acct_id` and the `id` of the GovCloud Asset Account as the value of `commercial_acct_id`. ---
module Hydra::Controller module IpBasedAbility # Overriding the default method provided by cancan # This passes the remote_ip to the Ability instance def current_ability @current_ability ||= ::Ability.new(current_user, remote_ip: request.remote_ip) end end end
//! //! The statement tests. //! #![cfg(test)] use num_bigint::BigInt; use crate::error::Error; use crate::lexical::token::location::Location; use crate::semantic::element::constant::boolean::Boolean as BooleanConstant; use crate::semantic::element::constant::integer::Integer as IntegerConstant; use crate::semantic::element::constant::Constant; use crate::semantic::element::error::Error as ElementError; use crate::semantic::element::r#type::error::Error as TypeError; use crate::semantic::element::r#type::structure::error::Error as StructureTypeError; use crate::semantic::element::r#type::Type; use crate::semantic::error::Error as SemanticError; #[test] fn error_for_bounds_expected_constant_range_expression() { let input = r#" fn main() { let mut sum = 0; for i in true { sum = sum + i; } } "#; let expected = Err(Error::Semantic( SemanticError::LoopBoundsExpectedConstantRangeExpression { location: Location::new(4, 14), found: Constant::Boolean(BooleanConstant::new(true)).to_string(), }, )); let result = crate::semantic::tests::compile_entry(input); assert_eq!(result, expected); } #[test] fn error_for_while_expected_boolean_condition() { let input = r#" fn main() { let mut sum = 0; for i in 0..10 while 42 { sum = sum + i; } } "#; let expected = Err(Error::Semantic( SemanticError::LoopWhileExpectedBooleanCondition { location: Location::new(4, 26), found: Type::integer_unsigned(crate::BITLENGTH_BYTE).to_string(), }, )); let result = crate::semantic::tests::compile_entry(input); assert_eq!(result, expected); } #[test] fn error_structure_duplicate_field() { let input = r#" struct Data { a: u8, b: u8, b: field, } fn main() -> u8 { 42 } "#; let expected = Err(Error::Semantic(SemanticError::Element( Location::new(5, 5), ElementError::Type(TypeError::Structure(StructureTypeError::DuplicateField { type_identifier: "Data".to_owned(), field_name: "b".to_owned(), })), ))); let result = crate::semantic::tests::compile_entry(input); assert_eq!(result, expected); } #[test] fn error_impl_expected_structure_or_enumeration() { let input = r#" type X = field; impl X { fn impossible() {} } fn main() {} "#; let expected = Err(Error::Semantic( SemanticError::ImplStatementExpectedStructureOrEnumeration { location: Location::new(4, 6), found: Type::field().to_string(), }, )); let result = crate::semantic::tests::compile_entry(input); assert_eq!(result, expected); } #[test] fn error_module_not_found() { let input = r#" mod unknown; fn main() {} "#; let expected = Err(Error::Semantic(SemanticError::ModuleNotFound { location: Location::new(2, 5), name: "unknown".to_owned(), })); let result = crate::semantic::tests::compile_entry(input); assert_eq!(result, expected); } #[test] fn error_use_expected_path() { let input = r#" use 5; fn main() {} "#; let expected = Err(Error::Semantic(SemanticError::UseExpectedPath { location: Location::new(2, 5), found: IntegerConstant::new(BigInt::from(5), false, crate::BITLENGTH_BYTE).to_string(), })); let result = crate::semantic::tests::compile_entry(input); assert_eq!(result, expected); }
package model import ( "errors" "fmt" "github.com/lakesite/ls-governor" ) // Migrate takes a governor API and app name and migrates models, returns error func Migrate(gapi *governor.API, app string) error { if gapi == nil { return errors.New("Migrate: Governor API is not initialized.") } if app == "" { return errors.New("Migrate: App name cannot be empty.") } dbc := gapi.ManagerService.DBConfig[app] if dbc == nil { return fmt.Errorf("Migrate: Database configuration for '%s' does not exist.", app) } if dbc.Connection == nil { return fmt.Errorf("Migrate: Database connection for '%s' does not exist.", app) } dbc.Connection.AutoMigrate(&Contact{}) return nil }
package com.dev.simplemvvm.ui import androidx.annotation.ColorRes import androidx.annotation.DrawableRes import com.dev.simplemvvm.R enum class HouseType(@DrawableRes val logo:Int,@ColorRes val color:Int){ Gryffindor(R.drawable.logo_gryffindor,android.R.color.holo_red_dark), Slytherin(R.drawable.logo_slytherin, android.R.color.holo_green_dark), Ravenclaw(R.drawable.logo_ravenclaw, android.R.color.holo_blue_bright), Hufflepuff(R.drawable.logo_hufflepuff, R.color.yellow) }
import 'dart:ui' show Color; import '../models/typedef_aliases/int_rgb_color.dart'; extension IntColorExtensions on IntRGBColor { Color toColor() => (length == 3) ? Color.fromRGBO(this[_red], this[_green], this[_blue], _opacity) : const Color.fromRGBO( 128, 128, 128, _opacity, ); } const int _red = 0; const int _green = 1; const int _blue = 2; const double _opacity = 1;
# Applying a Brand to a template # Check that we're in a bash shell if [[ $SHELL != *"bash"* ]]; then echo "PROBLEM: Run these scripts from within the bash shell." fi # Check for a valid cc email and prompt the user if #CC_EMAIL and CC_NAME haven't been set in the config file. source ./examples/eSignature/lib/utils.sh CheckForValidCCEmail # Check that we have a template id if [ ! -f config/TEMPLATE_ID ]; then echo "" echo "PROBLEM: Template Id needed. To fix: execute script eg008CreateTemplate.sh" echo "" exit 0 fi template_id=`cat config/TEMPLATE_ID` # Check that we have a brand id if [ ! -f config/BRAND_ID ]; then echo "" echo "PROBLEM: Brand Id is needed. To fix: execute script eg028CreateingABrand.sh" echo "" exit 0 fi brand_id=`cat config/BRAND_ID` # Step 1: Obtain your OAuth token # Note: Substitute these values with your own # Set up variables for full code example ACCESS_TOKEN=$(cat config/ds_access_token.txt) account_id=$(cat config/API_ACCOUNT_ID) brand_id=$brand_id template_id=$template_id base_path="https://demo.docusign.net/restapi" #Step 2: Construct your API headers declare -a Headers=('--header' "Authorization: Bearer $ACCESS_TOKEN" \ '--header' "Accept: application/json" \ '--header' "Content-Type: application/json") # Step 3: Construct the request body # Create a temporary file to store the request body request_data=$(mktemp /tmp/request-brand-001.XXXXXX) printf \ '{ "templateId": "'$template_id'", "brandId": "'$brand_id'", "templateRoles": [ { "email": "'"${SIGNER_EMAIL}"'", "name": "'"${SIGNER_NAME}"'", "roleName": "signer" }, { "email": "'"${CC_EMAIL}"'", "name": "'"${CC_NAME}"'", "roleName": "cc" } ], "status": "sent" }' >> $request_data # Step 4: a) Call the eSignature API # b) Display the JSON response # Create a temporary file to store the response response=$(mktemp /tmp/response-brand.XXXXXX) Status=$(curl -w '%{http_code}' -i --request POST ${base_path}/v2.1/accounts/${account_id}/envelopes \ "${Headers[@]}" \ --data-binary @${request_data} \ --output ${response}) # If the Status code returned is greater than 399, display an error message along with the API response if [[ "$Status" -gt "399" ]] ; then echo "" echo "Creating a new envelope has failed." echo "" cat $response exit 0 fi echo "" echo "Response:" cat $response echo "" # Remove the temporary files rm "$request_data" rm "$response" echo "" echo "" echo "Done." echo ""
(in-package :maze-gen) (defparameter *version* 0.4) ;; shortcut/convenience macro (defmacro with-pane-process ((self) &body body) `(capi:apply-in-pane-process ,self (lambda () ,@body))) (define-interface maze-trenchbroom-window () ((grid :initarg :grid)) (:panes (tb-preview output-pane :min-width 600 :min-height 600 :draw-with-buffer t :resize-callback (lambda (pane x y width height) (on-redisplay-tb-preview pane x y width height)) :display-callback 'on-redisplay-tb-preview) (export-button push-button :text "Export to TrenchBroom..." :data grid :callback-type :data :callback 'on-export-tb-button)) (:layouts (main-layout column-layout '(tb-preview export-button) :gap 10 ;; distance between elements :internal-border 20 ;; distance to border of the frame :adjust :center)) (:default-initargs :title (format nil "Trenchbroom export preview") :layout 'main-layout)) (define-interface maze-gen-ui () (grid) (:menus (application-menu "File" ((:component (("About" :callback (lambda () (display-message-on-screen (convert-to-screen nil) "Procedural Maze Generator ~a~%Copyright (c) Alexey Veretennikov(fourier) 2019" *version*)) :callback-type :none) ("Export..." :callback #'preview-trechbroom :callback-type :interface) ("Save as image..." :callback #'save-image :callback-type :interface)))))) (:panes (draw-board output-pane :min-width 500 :min-height 500 :draw-with-buffer t :resize-callback 'on-resize-draw-board :display-callback 'on-redisplay-draw-board) (algorithm-panel radio-button-panel :visible-max-width nil :visible-max-height nil :items `((binary-tree . "Binary tree") (sidewinder . "Sidewinder") (aldous-broder . "Aldous-Broder") (wilson . "Wilson's") (hunt-and-kill . "Hunt-and-Kill") (recursive-backtracker . "Recursive Backtracker")) :layout-class 'column-layout :layout-args '(:adjust :right ;;:internal-border 20 :uniform-size-p t) :print-function #'cdr) (draw-options-panel check-button-panel :visible-max-width nil :visible-max-height nil :items '((:draw-start-end . "Start/End cells") (:distance-intensity . "Distance intensity") (:shortest-path . "Shortest path")) :print-function #'cdr :layout-class 'column-layout :layout-args '(:adjust :right ;;:internal-border 20 :uniform-size-p t) :selection-callback 'on-draw-options-checkbox-selected :retract-callback 'on-draw-options-checkbox-retracted) (size-slider slider :start 10 :end 100 :tick-frequency 10 :title "Size of the maze") (braiding-button push-button :text "Braid" :callback 'on-braiding-button) (convert-button push-button :text "Regenerate" :callback 'on-generate-button)) (:layouts (algorithm-options-layout column-layout '(algorithm-panel) :title "Algorithms" :title-position :frame) (geometry-options-layout column-layout '(size-slider braiding-button) :title "Geometry" :title-position :frame) (draw-options-layout column-layout '(draw-options-panel) :title "Drawing options" :title-position :frame) (options-layout row-layout '(geometry-options-layout algorithm-options-layout draw-options-layout)) (main-layout column-layout '(draw-board options-layout convert-button) :adjust :center :y-ratios '(1 nil nil) :internal-border 20)) (:menu-bar application-menu) (:default-initargs :title (format nil "Procedural Maze Generator ~a" *version*) :layout 'main-layout)) (defmethod initialize-instance :after ((self maze-gen-ui) &key &allow-other-keys) (on-generate-button nil self)) (defun on-generate-button (data self) "Callback called then the user press Regenerate button" (declare (ignore data)) (with-slots (draw-board grid size-slider algorithm-panel) self (let* ((size (range-slug-start size-slider)) (algo-fun (car (choice-selected-item algorithm-panel)))) (setf grid (funcall algo-fun (make-instance 'grid :rows size :cols size))) ;; force redisplay (gp:invalidate-rectangle draw-board)))) (defun on-braiding-button (data self) (declare (ignore data)) (with-slots (draw-board grid) self (setf grid (braid grid 90)) ;; force redisplay (gp:invalidate-rectangle draw-board))) (defmethod setting-selected ((self maze-gen-ui) option) "Check if the settings checkbox selected." (when-let (selected (mapcar #'car (choice-selected-items (slot-value self 'draw-options-panel)))) (member option selected))) (defun on-redisplay-draw-board (pane x y width height) (let ((interface (capi:element-interface pane))) (with-slots (grid) interface ;; calculate draw area (let* ((area-x (+ 5 x)) (area-y (+ 5 y)) (area-w (- width 10 )) (area-h (- height 10)) ;; shortcuts for sizes (nrows (grid-nrows grid)) (ncols (grid-ncols grid)) ;; calculate labyrinth "cell" width/height (cell-w (/ area-w ncols)) (cell-h (/ area-h nrows)) (walls (grid-make-walls grid)) (pixmap (gp:create-pixmap-port pane width height :background :grey :clear t))) ;; draw border (gp:draw-rectangle pixmap area-x area-y area-w area-h :filled t :foreground :grey85) ;; optionally draw some other attributes (draw-options pixmap grid area-x area-y cell-w cell-h :draw-distances (setting-selected interface :distance-intensity) :draw-start-end (setting-selected interface :draw-start-end) :draw-shortest-path (setting-selected interface :shortest-path)) (dolist (w walls) (destructuring-bind (x1 y1 x2 y2) w (gp:draw-line pixmap (+ area-x (* x1 cell-w)) (+ area-y (* y1 cell-h)) (+ area-x (* x2 cell-w)) (+ area-y (* y2 cell-h)) :thickness 5 :foreground :purple))) ;; show the pixmap. (gp:copy-pixels pane pixmap 0 0 width height 0 0))))) (defun draw-options (pixmap grid area-x area-y cell-w cell-h &key (draw-distances nil) (draw-start-end nil) (draw-shortest-path nil)) (multiple-value-bind (start-end distances) (dijkstra-longest-path grid) (let ((max-distance (gethash (cdr start-end) distances)) (radius (max 2 (- (/ (min cell-w cell-h) 2.0) 4))) (shortest-path (dijkstra-shortest-path grid (car start-end) (cdr start-end) distances))) ;; first draw the filled cells with color = intencity, distance ;; between 2 star/end points (when draw-distances (grid-map grid (lambda (c) (let* ((col (cell-col c)) (row (cell-row c)) (d (gethash c distances)) (color (color:make-rgb 0 (/ (- max-distance d) max-distance) 0))) (gp:draw-rectangle pixmap (+ area-x (* col cell-w)) (+ area-y (* row cell-h)) (1+ cell-w) (1+ cell-h) :foreground color :filled t))))) ;; then draw the start/end points (when draw-start-end (gp:draw-circle pixmap (+ area-x (* (cell-col (car start-end)) cell-w) (/ cell-w 2.0)) (+ area-y (* (cell-row (car start-end)) cell-h) (/ cell-h 2.0)) radius :foreground :red :filled t) (gp:draw-circle pixmap (+ area-x (* (cell-col (cdr start-end)) cell-w) (/ cell-w 2.0)) (+ area-y (* (cell-row (cdr start-end)) cell-h) (/ cell-h 2.0)) radius :foreground :red :filled nil :thickness (max 4 (/ radius 2)))) (when draw-shortest-path (let* ((start-x (+ area-x (* (cell-col (car start-end)) cell-w) (/ cell-w 2.0))) (start-y (+ area-y (* (cell-row (car start-end)) cell-h) (/ cell-h 2.0))) (gp-path (mapcar (lambda (c) (let ((cx (- (+ area-x (* (cell-col c) cell-w) (/ cell-w 2.0)) start-x)) (cy (- (+ area-y (* (cell-row c) cell-h) (/ cell-h 2.0)) start-y))) (list :line cx cy))) (cdr shortest-path)))) (gp:draw-path pixmap gp-path start-x start-y :thickness 2 :foreground :yellow)))))) (defun on-resize-draw-board (pane x y width height) (on-redisplay-draw-board pane x y width height)) (defun preview-trechbroom (iface) (capi:display (make-instance 'maze-trenchbroom-window :grid (slot-value iface 'grid)))) (defun on-redisplay-tb-preview (pane x y width height) (with-slots (grid) (capi:element-interface pane) (let ((blocks (grid-make-blocks grid))) (dolist (b blocks) (destructuring-bind ((x1 . y1) (x2 . y2) (x3 . y3) (x4 . y4)) (mapcar (lambda (p) (cons (+ x (/ (car p) 4)) (+ y (/ (cdr p) 4)))) b) (gp:draw-line pane x1 y1 x2 y2) (gp:draw-line pane x2 y2 x3 y3) (gp:draw-line pane x3 y3 x4 y4) (gp:draw-line pane x4 y4 x1 y1)))))) (defun on-export-tb-button (data) (multiple-value-bind (filename successp filter-name) (prompt-for-file "Enter a filename:" :if-exists :prompt :if-does-not-exist :ok :operation :save :filter "*.map") (declare (ignore filter-name)) (when successp (export-trenchbroom data filename)))) (defmethod on-draw-options-checkbox-selected (data (self maze-gen-ui)) "Callback called when selected one of settings checkboxes" (with-slots (draw-board) self (gp:invalidate-rectangle draw-board))) (defmethod on-draw-options-checkbox-retracted (data (self maze-gen-ui)) "Callback called when retracted selection of settings checkboxes" (with-slots (draw-board) self (gp:invalidate-rectangle draw-board))) (defun save-image (interface) (with-slots (draw-board) interface ;; (gp:invalidate-rectangle draw-board)))) (multiple-value-bind (filename successp filter-name) (prompt-for-file "Enter a filename:" :if-exists :prompt :if-does-not-exist :ok :operation :save :filter "*.png") (declare (ignore filter-name)) (when successp (let ((img (gp:make-image-from-port draw-board))) (gp:externalize-and-write-image draw-board img filename)))))) (defun main-ui () (capi:display (make-instance 'maze-gen-ui)))
#pragma once #include "SharedDefines.h" #include "Render.h" #include "ErrorHandler.h" #include "HeightmapExporter.h" #include "Triangulation.h" #include "StlExporter.h" #include "DataStorage.h" class DataStorage; class Render; class BasicFrame : public wxFrame { public: BasicFrame(const wxChar *title, int xpos, int ypos, int width, int height); ~BasicFrame(); //Event handler void OnFileOpen(wxCommandEvent& event); void OnExportStl(wxCommandEvent& event); void OnExportStlAllItr(wxCommandEvent& event); void setheightMultiplicator(wxCommandEvent& event); void setDivisor(wxCommandEvent& event); void setMaxHeight(wxCommandEvent& event); void setMinHeight(wxCommandEvent& event); void removeDuplicates(wxCommandEvent& event); void triangulatePoints(wxCommandEvent& event); void generatePoints(wxCommandEvent& event); void setMinRadius(wxCommandEvent& event); void setMaxRadius(wxCommandEvent& event); void SetIteration(wxScrollEvent& event); void UpdateIterationRange(); ErrorHandler* GetErrorHandler() { return errorHandler; } void updateNmbPoints(int nmbPoints); private: wxBoxSizer* sizer; wxPanel* panelOptions; Render* panelRender; bool CreatePanels(); DECLARE_EVENT_TABLE() wxStatusBar* statusBar; //Menu wxMenuBar* menuBar; wxMenu* fileMenu; wxMenu* editMenu; wxMenu* exportMenu; wxMenu* infoMenu; bool CreateMenu(); //Option Panel wxBoxSizer* optionsSizer; wxBoxSizer* heightDivisorSizer; wxBoxSizer* heightMultiplicatorSizer; wxBoxSizer* divisorSizer; wxBoxSizer* nmbPointSizer; wxBoxSizer* maxHeightSizer; wxBoxSizer* minHeightSizer; wxStaticText* heightMultiplicatorText; wxStaticText* divisorText; wxStaticText* nmbPointsText; wxStaticText* maxHeightText; wxStaticText* minHeightText; wxTextCtrl* heightMultiplicator; wxTextCtrl* divisor; wxStaticBox* nmbPoints; wxTextCtrl* maxHeight; wxTextCtrl* minHeight; wxSizer* removeDuplicatesSizer; wxButton* removeDuplicatesButton; wxTextCtrl* removeDuplicatesVariance; wxSizer* triangulateSizer; wxButton* triangulateButton; wxGauge* triangulateGauge; wxSizer* radiusOptionSizer; wxTextCtrl* maxRadius; wxTextCtrl* minRadius; wxStaticText* radiusOption; wxSlider* iterationSlider; //Other data stores int height, width; ErrorHandler* errorHandler; DataStorage* dataStorage; };
using System; using UnityEngine; using UnityEngine.UI; public class Task : MonoBehaviour { public bool isMonsterTask; public int taskIndex; public int targetAmount; private TaskPanel taskPanel; private Text targetAmountText; private Text currentAmountText; private int currentAmount; private Button AchieveButton; private Button AchievePanelYesButton; private Transform taskAchievePanel; private void Awake() { taskPanel = transform.parent.parent.parent.GetComponent<TaskPanel>(); targetAmountText = transform.Find("TargetAmount").GetComponent<Text>(); currentAmountText = transform.Find("CurrentAmount").GetComponent<Text>(); currentAmount = Convert.ToInt32(currentAmountText.text); AchieveButton = transform.Find("AchieveButton").GetComponent<Button>(); AchieveButton.onClick.AddListener(OnClickAchieveButton); taskAchievePanel = taskPanel.transform.Find("TaskAchievePanel"); taskAchievePanel.gameObject.SetActive(false); AchievePanelYesButton = taskAchievePanel.Find("YesButton").GetComponent<Button>(); AchievePanelYesButton.onClick.AddListener(OnClickAchievePanelYesButton); if (GameRecord.Instance.taskState[taskIndex - 1] == 1) { MakeTaskToAchieveState(); enabled = false; } } private void Update() { if (currentAmount >= targetAmount) { currentAmountText.gameObject.SetActive(false); targetAmountText.gameObject.SetActive(false); AchieveButton.gameObject.SetActive(true); } else { if (isMonsterTask) currentAmountText.text = GameRecord.Instance.killMonster.ToString(); else currentAmountText.text = GameRecord.Instance.getCoin.ToString(); currentAmount = Convert.ToInt32(currentAmountText.text); } } private void OnClickAchieveButton() { taskPanel.taskGroup.GetComponent<CanvasGroup>().blocksRaycasts = false; taskAchievePanel.gameObject.SetActive(true); Text rewardMoneyText = taskAchievePanel.Find("RewardMoney").GetComponent<Text>(); int rewardMoney = 0; switch (targetAmount) { case 5: rewardMoney = 50; break; case 10: rewardMoney = 100; break; case 100: rewardMoney = 1888; break; default: rewardMoney = 0; break; } rewardMoneyText.text = rewardMoney.ToString(); GameRecord.Instance.money += rewardMoney; MakeTaskToAchieveState(); GameRecord.Instance.taskState[taskIndex - 1] = 1; } private void OnClickAchievePanelYesButton() { taskPanel.taskGroup.GetComponent<CanvasGroup>().blocksRaycasts = true; taskAchievePanel.gameObject.SetActive(false); } private void MakeTaskToAchieveState() { targetAmountText.gameObject.SetActive(false); currentAmountText.gameObject.SetActive(false); AchieveButton.gameObject.SetActive(true); CanvasGroup cg = GetComponent<CanvasGroup>(); cg.alpha = 0.5f; cg.blocksRaycasts = false; } }
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Tipe; use Illuminate\Validation\Rule; class TipeController extends Controller { public function index() { $tipes = Tipe::all(); return view('tipe.index', compact('tipes')); } public function create() { return view('tipe.tambah'); } public function store() { $this->validate(request(), [ 'nama_tipe' => 'required|unique:tipes|max:4', 'keterangan_tipe' => 'required|max:50', ]); Tipe::create([ 'nama_tipe' => request('nama_tipe'), 'keterangan_tipe' => request('keterangan_tipe') ]); return redirect()->route('tipe.index')->with('success', 'Data berhasil ditambah'); } public function edit(Tipe $tipe) { return view('tipe.edit', compact('tipe')); } public function update(Tipe $tipe) { $this->validate(request(), [ 'nama_tipe' => Rule::unique('tipes', 'nama_tipe')->ignore($tipe->id_tipe), 'nama_tipe' => 'required|max:4', 'keterangan_tipe' => 'required|max:50', ]); $tipe->update([ 'nama_tipe' => request('nama_tipe'), 'keterangan_tipe' => request('keterangan_tipe') ]); return redirect()->route('tipe.index')->with('success', 'Data berhasil diubah'); } public function destroy(Tipe $tipe) { $tipe->delete(); return redirect()->route('tipe.index')->with('success', 'Data berhasil dihapus'); } }
# Apache Kafka Introduction Presentation Introduction to Apache Kafka used at the Michigan Red Hat User Group meetings in December, 2018. Thanks to Paolo Patierno for providing the basis for the charts.
# XMUEssayTemplate-EN This is an English Template of essay created with LaTeX for XMU students. ## Table of Contents - [Table of Contents](#table-of-contents) - [Usage](#usage) - [Maintainers](#maintainers) - [License](#license) ## Usage - download essay.tex and references.bib - put your references in references.bib ## Maintainers mail: chenyiming@stu.xmu.endu.cn ## License [LICENSE](./LICENSE)
/** * @ignore * @Description nothing * @author Wang Bo (ralwayne@163.com) * @date 2020/10/10 3:57 PM */ const gitURL = /(?:git|ssh|https?|git@[-\w.]+):(\/\/)?(.*?)(\.git)(\/?|\#[-\d\w._]+?)$/; const path = /^(\/\w+){0,2}\/?$/; /** * 文字下划线中划线 * @type {RegExp} */ const dynamicDir = /(^\[[\w\-]+\]$)|(^\{[\w\-]+\}$)/ export default { gitURL, path, dynamicDir }
# fake-en-uk UK providers for [Fake](https://github.com/mightybyte/fake/)
package qiita import ( "context" "encoding/json" "fmt" "io/ioutil" "net/http" "github.com/shiimaxx/blog-aggregator/blogservice" "github.com/shiimaxx/blog-aggregator/structs" ) const baseURL = "https://qiita.com/api/v2" // FetchEntries fetch qiita entries of specified user id func FetchEntries(ctx context.Context, userID string) ([]structs.Entry, error) { endpoint := fmt.Sprintf("%s/users/%s/items", baseURL, userID) req, err := http.NewRequest("GET", endpoint, nil) if err != nil { return nil, fmt.Errorf("failed to fetch qiita entries: %s", err.Error()) } req = req.WithContext(ctx) var body []byte errCh := make(chan error) doneCh := make(chan struct{}) go func() { res, err := blogservice.HTTPClient.Do(req) if err != nil { errCh <- err return } body, err = ioutil.ReadAll(res.Body) defer res.Body.Close() if err != nil { errCh <- err return } doneCh <- struct{}{} }() var e []structs.Entry select { case err := <-errCh: return nil, fmt.Errorf("failed to fetch qiita entries: %s", err.Error()) case <-doneCh: if err := json.Unmarshal(body, &e); err != nil { return nil, fmt.Errorf("failed to fetch qiita entries: %s", err.Error()) } } return e, nil }
""" picasso.simulate-gui ~~~~~~~~~~~~~~~~ GUI for Simulate : Simulate single molcule fluorescence data :author: Maximilian Thomas Strauss, 2016 :copyright: Copyright (c) 2016 Jungmann Lab, MPI of Biochemistry """ import csv import glob as _glob import os import sys import time import yaml import matplotlib.patches as patches import matplotlib.pyplot as plt import numpy as _np from matplotlib.backends.backend_qt4agg import ( FigureCanvasQTAgg as FigureCanvas, ) from matplotlib.backends.backend_qt4agg import ( NavigationToolbar2QT as NavigationToolbar, ) from PyQt5 import QtCore, QtGui, QtWidgets from scipy.optimize import curve_fit from scipy.stats import norm import os.path as _ospath from .. import io as _io from .. import lib, simulate from . import localize from . import render def fitFuncBg(x, a, b): return (a + b * x[0]) * x[1] * x[2] def fitFuncStd(x, a, b, c): return a * x[0] * x[1] + b * x[2] + c plt.style.use("ggplot") "DEFAULT PARAMETERS" CURRENTROUND = 0 ADVANCEDMODE = 0 # 1 is with calibration of noise model # CAMERA IMAGESIZE_DEFAULT = 32 ITIME_DEFAULT = 300 FRAMES_DEFAULT = 7500 PIXELSIZE_DEFAULT = 160 # PAINT KON_DEFAULT = 1600000 IMAGERCONCENTRATION_DEFAULT = 5 MEANBRIGHT_DEFAULT = 500 # IMAGER LASERPOWER_DEFAULT = 1.5 # POWER DENSITY POWERDENSITY_CONVERSION = 20 STDFACTOR = 1.82 if ADVANCEDMODE: LASERPOWER_DEFAULT = 30 PSF_DEFAULT = 0.82 PHOTONRATE_DEFAULT = 53 PHOTONRATESTD_DEFAULT = 29 PHOTONBUDGET_DEFAULT = 1500000 PHOTONSLOPE_DEFAULT = 35 PHOTONSLOPESTD_DEFAULT = 19 if ADVANCEDMODE: PHOTONSLOPE_DEFAULT = 1.77 PHOTONSLOPESTD_DEFAULT = 0.97 # NOISE MODEL LASERC_DEFAULT = 0.012063 IMAGERC_DEFAULT = 0.003195 EQA_DEFAULT = -0.002866 EQB_DEFAULT = 0.259038 EQC_DEFAULT = 13.085473 BGOFFSET_DEFAULT = 0 BGSTDOFFSET_DEFAULT = 0 # STRUCTURE STRUCTURE1_DEFAULT = 3 STRUCTURE2_DEFAULT = 4 STRUCTURE3_DEFAULT = "20,20" STRUCTUREYY_DEFAULT = "0,20,40,60,0,20,40,60,0,20,40,60" STRUCTUREXX_DEFAULT = "0,20,40,0,20,40,0,20,40,0,20,40" STRUCTUREEX_DEFAULT = "1,1,1,1,1,1,1,1,1,1,1,1" STRUCTURE3D_DEFAULT = "0,0,0,0,0,0,0,0,0,0,0,0" STRUCTURENO_DEFAULT = 9 STRUCTUREFRAME_DEFAULT = 6 INCORPORATION_DEFAULT = 85 # Default 3D calibration CX_DEFAULT = [ 3.1638306844743706e-17, -2.2103661248660896e-14, -9.775815406044296e-12, 8.2178622893072e-09, 4.91181990105529e-06, -0.0028759382006135654, 1.1756537760039398, ] CY_DEFAULT = [ 1.710907877866197e-17, -2.4986657766862576e-15, -8.405284979510355e-12, 1.1548322314075128e-11, 5.4270591055277476e-06, 0.0018155881468011011, 1.011468185618154, ] class SimulateAndLocalizeDialog(QtWidgets.QDialog): def __init__(self, parent=None): super().__init__() self.setWindowTitle("Picasso: Simulate and Localize") self.window = parent self.resize(400, 0) self.setModal(False) self.parent = parent self.segmentation = 1000 self.filename = "" self.is_render_value = False vbox = QtWidgets.QVBoxLayout(self) self.parameters_localization = localize.ParametersDialog(parent) vbox.addWidget(self.parameters_localization) self.statusBar = QtWidgets.QStatusBar(self) vbox.addWidget(self.statusBar) render_groupbox = QtWidgets.QGroupBox("Picasso Render") vbox.addWidget(render_groupbox) self.is_render = QtWidgets.QCheckBox("Show render") self.is_render.setTristate(False) self.is_render.stateChanged.connect(self.on_is_render) undrift_grid = QtWidgets.QGridLayout(render_groupbox) undrift_grid.addWidget(self.is_render) # undrift_grid.addWidget(QtWidgets.QLabel("Undrift from RCC (Segmentation)"), 1, 0) self.undrift_rcc = QtWidgets.QSpinBox() self.undrift_rcc.setMaximum(100000) self.undrift_rcc.setValue(1000) self.undrift_rcc.valueChanged.connect(self.on_undrift_segmentation) # undrift_grid.addWidget(self.undrift_rcc, 1, 1) self.execute_button = QtWidgets.QPushButton("Execute") vbox.addWidget(self.execute_button) self.execute_button.clicked.connect(self.on_execute) self.window_localize = localize.Window() self.window_localize.on_fit_finished_callback.append(self.execute_render) self.window_render = render.Window() self.old_statusBar = self.statusBar def on_is_render(self, value): self.is_render_value = value def on_undrift_segmentation(self,value): self.segmentation = value def execute_localize(self): self.statusBar.showMessage("simulating data...") self.parent.simulate() self.statusBar.showMessage("localize data") self.filename = self.parent.fileName self.statusBar.showMessage(f"saved to {self.filename}") self.window_localize.open(self.filename) self.window_localize.status_bar = self.statusBar self.window_localize.localize() def execute_render(self): print("execute render") self.statusBar = self.old_statusBar if self.is_render_value: f, _ = os.path.splitext(self.filename) filename = f + '_locs.hdf5' self.statusBar.showMessage("rendering...") self.window_render.view.add(filename) self.window_render.show() self.statusBar.showMessage("render is done") def on_execute(self): self.execute_localize() self.statusBar.showMessage("execution done") class Window(QtWidgets.QMainWindow): def __init__(self): super().__init__() self.setWindowTitle("Picasso: Simulate") self.setSizePolicy( QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding ) this_directory = os.path.dirname(os.path.realpath(__file__)) icon_path = os.path.join(this_directory, "icons", "simulate.ico") icon = QtGui.QIcon(icon_path) self.setWindowIcon(icon) self.initUI() def initUI(self): self.currentround = CURRENTROUND self.structureMode = True self.grid = QtWidgets.QGridLayout() self.grid.setSpacing(5) # CAMERA PARAMETERS camera_groupbox = QtWidgets.QGroupBox("Camera parameters") cgrid = QtWidgets.QGridLayout(camera_groupbox) camerasize = QtWidgets.QLabel("Image size") integrationtime = QtWidgets.QLabel("Integration time") totaltime = QtWidgets.QLabel("Total acquisition time") frames = QtWidgets.QLabel("Frames") pixelsize = QtWidgets.QLabel("Pixelsize") self.camerasizeEdit = QtWidgets.QSpinBox() self.camerasizeEdit.setRange(1, 512) self.integrationtimeEdit = QtWidgets.QSpinBox() self.integrationtimeEdit.setRange(1, 10000) # 1-10.000ms self.framesEdit = QtWidgets.QSpinBox() self.framesEdit.setRange(10, 100000000) # 10-100.000.000 frames self.framesEdit.setSingleStep(1000) self.pixelsizeEdit = QtWidgets.QSpinBox() self.pixelsizeEdit.setRange(1, 1000) # 1 to 1000 nm frame size self.totaltimeEdit = QtWidgets.QLabel() # Deactivate keyboard tracking self.camerasizeEdit.setKeyboardTracking(False) self.pixelsizeEdit.setKeyboardTracking(False) self.camerasizeEdit.setValue(IMAGESIZE_DEFAULT) self.integrationtimeEdit.setValue(ITIME_DEFAULT) self.framesEdit.setValue(FRAMES_DEFAULT) self.pixelsizeEdit.setValue(PIXELSIZE_DEFAULT) self.integrationtimeEdit.valueChanged.connect(self.changeTime) self.framesEdit.valueChanged.connect(self.changeTime) self.camerasizeEdit.valueChanged.connect(self.generatePositions) self.pixelsizeEdit.valueChanged.connect(self.changeStructDefinition) cgrid.addWidget(camerasize, 1, 0) cgrid.addWidget(self.camerasizeEdit, 1, 1) cgrid.addWidget(QtWidgets.QLabel("Px"), 1, 2) cgrid.addWidget(integrationtime, 2, 0) cgrid.addWidget(self.integrationtimeEdit, 2, 1) cgrid.addWidget(QtWidgets.QLabel("ms"), 2, 2) cgrid.addWidget(frames, 3, 0) cgrid.addWidget(self.framesEdit, 3, 1) cgrid.addWidget(totaltime, 4, 0) cgrid.addWidget(self.totaltimeEdit, 4, 1) cgrid.addWidget(QtWidgets.QLabel("min"), 4, 2) cgrid.addWidget(pixelsize, 5, 0) cgrid.addWidget(self.pixelsizeEdit, 5, 1) cgrid.addWidget(QtWidgets.QLabel("nm"), 5, 2) cgrid.addItem( QtWidgets.QSpacerItem( 1, 1, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding ) ) # PAINT PARAMETERS paint_groupbox = QtWidgets.QGroupBox("PAINT parameters") pgrid = QtWidgets.QGridLayout(paint_groupbox) kon = QtWidgets.QLabel("k<sub>On</sub>") imagerconcentration = QtWidgets.QLabel("Imager concentration") taud = QtWidgets.QLabel("Dark time") taub = QtWidgets.QLabel("Bright time") self.konEdit = QtWidgets.QDoubleSpinBox() self.konEdit.setRange(1, 10000000000) self.konEdit.setDecimals(0) self.konEdit.setSingleStep(100000) self.imagerconcentrationEdit = QtWidgets.QDoubleSpinBox() self.imagerconcentrationEdit.setRange(0.01, 1000) self.taudEdit = QtWidgets.QLabel() self.taubEdit = QtWidgets.QDoubleSpinBox() self.taubEdit.setRange(1, 10000) self.taubEdit.setDecimals(0) self.taubEdit.setSingleStep(10) self.konEdit.setValue(KON_DEFAULT) self.imagerconcentrationEdit.setValue(IMAGERCONCENTRATION_DEFAULT) self.taubEdit.setValue(MEANBRIGHT_DEFAULT) self.imagerconcentrationEdit.valueChanged.connect(self.changePaint) self.konEdit.valueChanged.connect(self.changePaint) pgrid.addWidget(kon, 1, 0) pgrid.addWidget(self.konEdit, 1, 1) pgrid.addWidget(QtWidgets.QLabel("M<sup>−1</sup>s<sup>−1</sup>"), 1, 2) pgrid.addWidget(imagerconcentration, 2, 0) pgrid.addWidget(self.imagerconcentrationEdit, 2, 1) pgrid.addWidget(QtWidgets.QLabel("nM"), 2, 2) pgrid.addWidget(taud, 3, 0) pgrid.addWidget(self.taudEdit, 3, 1) pgrid.addWidget(QtWidgets.QLabel("ms"), 3, 2) pgrid.addWidget(taub, 4, 0) pgrid.addWidget(self.taubEdit, 4, 1) pgrid.addWidget(QtWidgets.QLabel("ms"), 4, 2) pgrid.addItem( QtWidgets.QSpacerItem( 1, 1, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding ) ) # IMAGER Parameters imager_groupbox = QtWidgets.QGroupBox("Imager parameters") igrid = QtWidgets.QGridLayout(imager_groupbox) laserpower = QtWidgets.QLabel("Power density") if ADVANCEDMODE: laserpower = QtWidgets.QLabel("Laserpower") psf = QtWidgets.QLabel("PSF") psf_fwhm = QtWidgets.QLabel("PSF(FWHM)") photonrate = QtWidgets.QLabel("Photonrate") photonsframe = QtWidgets.QLabel("Photons (frame)") photonratestd = QtWidgets.QLabel("Photonrate Std") photonstdframe = QtWidgets.QLabel("Photons Std (frame)") photonbudget = QtWidgets.QLabel("Photonbudget") photonslope = QtWidgets.QLabel("Photon detection rate") photonslopeStd = QtWidgets.QLabel("Photonrate Std ") self.laserpowerEdit = QtWidgets.QDoubleSpinBox() self.laserpowerEdit.setRange(0, 10) self.laserpowerEdit.setSingleStep(0.1) self.psfEdit = QtWidgets.QDoubleSpinBox() self.psfEdit.setRange(0, 3) self.psfEdit.setSingleStep(0.01) self.psf_fwhmEdit = QtWidgets.QLabel() self.photonrateEdit = QtWidgets.QDoubleSpinBox() self.photonrateEdit.setRange(0, 1000) self.photonrateEdit.setDecimals(0) self.photonsframeEdit = QtWidgets.QLabel() self.photonratestdEdit = QtWidgets.QDoubleSpinBox() self.photonratestdEdit.setRange(0, 1000) self.photonratestdEdit.setDecimals(0) self.photonstdframeEdit = QtWidgets.QLabel() self.photonbudgetEdit = QtWidgets.QDoubleSpinBox() self.photonbudgetEdit.setRange(0, 100000000) self.photonbudgetEdit.setSingleStep(100000) self.photonbudgetEdit.setDecimals(0) self.photonslopeEdit = QtWidgets.QSpinBox() self.photonslopeStdEdit = QtWidgets.QDoubleSpinBox() self.laserpowerEdit.setValue(LASERPOWER_DEFAULT) self.psfEdit.setValue(PSF_DEFAULT) self.photonrateEdit.setValue(PHOTONRATE_DEFAULT) self.photonratestdEdit.setValue(PHOTONRATESTD_DEFAULT) self.photonbudgetEdit.setValue(PHOTONBUDGET_DEFAULT) self.photonslopeEdit.setValue(PHOTONSLOPE_DEFAULT) self.photonslopeStdEdit.setValue(PHOTONSLOPESTD_DEFAULT) self.psfEdit.valueChanged.connect(self.changePSF) self.photonrateEdit.valueChanged.connect(self.changeImager) self.photonratestdEdit.valueChanged.connect(self.changeImager) self.laserpowerEdit.valueChanged.connect(self.changeImager) self.photonslopeEdit.valueChanged.connect(self.changeImager) self.photonslopeStdEdit.valueChanged.connect(self.changeImager) self.cx = CX_DEFAULT self.cy = CY_DEFAULT self.photonslopemodeEdit = QtWidgets.QCheckBox() igrid.addWidget(psf, 0, 0) igrid.addWidget(self.psfEdit, 0, 1) igrid.addWidget(QtWidgets.QLabel("Px"), 0, 2) igrid.addWidget(psf_fwhm, 1, 0) igrid.addWidget(self.psf_fwhmEdit, 1, 1) igrid.addWidget(QtWidgets.QLabel("nm"), 1, 2) igrid.addWidget(laserpower, 2, 0) igrid.addWidget(self.laserpowerEdit, 2, 1) igrid.addWidget(QtWidgets.QLabel("kW cm<sup>-2<sup>"), 2, 2) if ADVANCEDMODE: igrid.addWidget(QtWidgets.QLabel("mW"), 2, 2) igridindex = 1 if ADVANCEDMODE: igrid.addWidget(photonrate, 3, 0) igrid.addWidget(self.photonrateEdit, 3, 1) igrid.addWidget(QtWidgets.QLabel("Photons ms<sup>-1<sup>"), 3, 2) igridindex = 0 igrid.addWidget(photonsframe, 4 - igridindex, 0) igrid.addWidget(self.photonsframeEdit, 4 - igridindex, 1) igrid.addWidget(QtWidgets.QLabel("Photons"), 4 - igridindex, 2) igridindex = 2 if ADVANCEDMODE: igrid.addWidget(photonratestd, 5, 0) igrid.addWidget(self.photonratestdEdit, 5, 1) igrid.addWidget(QtWidgets.QLabel("Photons ms<sup>-1<sup"), 5, 2) igridindex = 0 igrid.addWidget(photonstdframe, 6 - igridindex, 0) igrid.addWidget(self.photonstdframeEdit, 6 - igridindex, 1) igrid.addWidget(QtWidgets.QLabel("Photons"), 6 - igridindex, 2) igrid.addWidget(photonbudget, 7 - igridindex, 0) igrid.addWidget(self.photonbudgetEdit, 7 - igridindex, 1) igrid.addWidget(QtWidgets.QLabel("Photons"), 7 - igridindex, 2) igrid.addWidget(photonslope, 8 - igridindex, 0) igrid.addWidget(self.photonslopeEdit, 8 - igridindex, 1) photonslopeUnit = QtWidgets.QLabel( "Photons ms<sup>-1</sup> kW<sup>-1</sup> cm<sup>2</sup>" ) photonslopeUnit.setWordWrap(True) igrid.addWidget(photonslopeUnit, 8 - igridindex, 2) igrid.addWidget(self.photonslopemodeEdit, 9 - igridindex, 1) igrid.addWidget( QtWidgets.QLabel("Constant detection rate"), 9 - igridindex, 0 ) if ADVANCEDMODE: igrid.addWidget(photonslopeStd, 10 - igridindex, 0) igrid.addWidget(self.photonslopeStdEdit, 10 - igridindex, 1) igrid.addWidget( QtWidgets.QLabel( "Photons ms<sup>-1</sup> kW<sup>-1</sup> cm<sup>2</sup>" ), 10 - igridindex, 2, ) if not ADVANCEDMODE: backgroundframesimple = QtWidgets.QLabel("Background (Frame)") self.backgroundframesimpleEdit = QtWidgets.QLabel() igrid.addWidget(backgroundframesimple, 12 - igridindex, 0) igrid.addWidget(self.backgroundframesimpleEdit, 12 - igridindex, 1) # Make a spinbox for adjusting the background level backgroundlevel = QtWidgets.QLabel("Background level") self.backgroundlevelEdit = QtWidgets.QSpinBox() self.backgroundlevelEdit.setRange(1, 100) igrid.addWidget(backgroundlevel, 11 - igridindex, 0) igrid.addWidget(self.backgroundlevelEdit, 11 - igridindex, 1) self.backgroundlevelEdit.valueChanged.connect(self.changeNoise) # NOISE MODEL noise_groupbox = QtWidgets.QGroupBox("Noise Model") ngrid = QtWidgets.QGridLayout(noise_groupbox) laserc = QtWidgets.QLabel("Lasercoefficient") imagerc = QtWidgets.QLabel("Imagercoefficient") EquationA = QtWidgets.QLabel("Equation A") EquationB = QtWidgets.QLabel("Equation B") EquationC = QtWidgets.QLabel("Equation C") Bgoffset = QtWidgets.QLabel("Background Offset") BgStdoffset = QtWidgets.QLabel("Background Std Offset") backgroundframe = QtWidgets.QLabel("Background (Frame)") noiseLabel = QtWidgets.QLabel("Noise (Frame)") self.lasercEdit = QtWidgets.QDoubleSpinBox() self.lasercEdit.setRange(0, 100000) self.lasercEdit.setDecimals(6) self.imagercEdit = QtWidgets.QDoubleSpinBox() self.imagercEdit.setRange(0, 100000) self.imagercEdit.setDecimals(6) self.EquationBEdit = QtWidgets.QDoubleSpinBox() self.EquationBEdit.setRange(-100000, 100000) self.EquationBEdit.setDecimals(6) self.EquationAEdit = QtWidgets.QDoubleSpinBox() self.EquationAEdit.setRange(-100000, 100000) self.EquationAEdit.setDecimals(6) self.EquationCEdit = QtWidgets.QDoubleSpinBox() self.EquationCEdit.setRange(-100000, 100000) self.EquationCEdit.setDecimals(6) self.lasercEdit.setValue(LASERC_DEFAULT) self.imagercEdit.setValue(IMAGERC_DEFAULT) self.EquationAEdit.setValue(EQA_DEFAULT) self.EquationBEdit.setValue(EQB_DEFAULT) self.EquationCEdit.setValue(EQC_DEFAULT) self.BgoffsetEdit = QtWidgets.QDoubleSpinBox() self.BgoffsetEdit.setRange(-100000, 100000) self.BgoffsetEdit.setDecimals(6) self.BgStdoffsetEdit = QtWidgets.QDoubleSpinBox() self.BgStdoffsetEdit.setRange(-100000, 100000) self.BgStdoffsetEdit.setDecimals(6) for button in [ self.lasercEdit, self.imagercEdit, self.EquationAEdit, self.EquationBEdit, self.EquationCEdit, ]: button.valueChanged.connect(self.changeNoise) backgroundframe = QtWidgets.QLabel("Background (Frame)") noiseLabel = QtWidgets.QLabel("Noise (Frame)") self.backgroundframeEdit = QtWidgets.QLabel() self.noiseEdit = QtWidgets.QLabel() tags = [ laserc, imagerc, EquationA, EquationB, EquationC, Bgoffset, BgStdoffset, backgroundframe, noiseLabel, ] buttons = [ self.lasercEdit, self.imagercEdit, self.EquationAEdit, self.EquationBEdit, self.EquationCEdit, self.BgoffsetEdit, self.BgStdoffsetEdit, self.backgroundframeEdit, self.noiseEdit, ] for i, tag in enumerate(tags): ngrid.addWidget(tag, i, 0) ngrid.addWidget(buttons[i], i, 1) calibrateNoiseButton = QtWidgets.QPushButton("Calibrate Noise Model") calibrateNoiseButton.clicked.connect(self.calibrateNoise) importButton = QtWidgets.QPushButton("Import from Experiment (hdf5)") importButton.clicked.connect(self.importhdf5) ngrid.addWidget(calibrateNoiseButton, 10, 0, 1, 3) ngrid.addWidget(importButton, 11, 0, 1, 3) # HANDLE DEFINTIIONS structureIncorporation = QtWidgets.QLabel("Incorporation") self.structureIncorporationEdit = QtWidgets.QDoubleSpinBox() self.structureIncorporationEdit.setKeyboardTracking(False) self.structureIncorporationEdit.setRange(1, 100) self.structureIncorporationEdit.setDecimals(0) self.structureIncorporationEdit.setValue(INCORPORATION_DEFAULT) handles_groupbox = QtWidgets.QGroupBox("Handles") hgrid = QtWidgets.QGridLayout(handles_groupbox) hgrid.addWidget(structureIncorporation, 0, 0) hgrid.addWidget(self.structureIncorporationEdit, 0, 1) hgrid.addWidget(QtWidgets.QLabel("%"), 0, 2) importHandlesButton = QtWidgets.QPushButton("Import handles") importHandlesButton.clicked.connect(self.importHandles) hgrid.addWidget(importHandlesButton, 1, 0, 1, 3) # 3D Settings self.mode3DEdit = QtWidgets.QCheckBox() threed_groupbox = QtWidgets.QGroupBox("3D") tgrid = QtWidgets.QGridLayout(threed_groupbox) tgrid.addWidget(self.mode3DEdit, 0, 0) tgrid.addWidget(QtWidgets.QLabel("3D"), 0, 1) load3dCalibrationButton = QtWidgets.QPushButton("Load 3D Calibration") load3dCalibrationButton.clicked.connect(self.load3dCalibration) tgrid.addWidget(load3dCalibrationButton, 0, 2) # STRUCTURE DEFINITIONS structure_groupbox = QtWidgets.QGroupBox("Structure") sgrid = QtWidgets.QGridLayout(structure_groupbox) structureno = QtWidgets.QLabel("Number of structures") structureframe = QtWidgets.QLabel("Frame") self.structure1 = QtWidgets.QLabel("Columns") self.structure2 = QtWidgets.QLabel("Rows") self.structure3 = QtWidgets.QLabel("Spacing X,Y") self.structure3Label = QtWidgets.QLabel("nm") structurexx = QtWidgets.QLabel("Stucture X") structureyy = QtWidgets.QLabel("Structure Y") structure3d = QtWidgets.QLabel("Structure 3D") structureex = QtWidgets.QLabel("Exchange labels") structurecomboLabel = QtWidgets.QLabel("Type") self.structurenoEdit = QtWidgets.QSpinBox() self.structurenoEdit.setRange(1, 1000) self.structureframeEdit = QtWidgets.QSpinBox() self.structureframeEdit.setRange(4, 16) self.structurexxEdit = QtWidgets.QLineEdit(STRUCTUREXX_DEFAULT) self.structureyyEdit = QtWidgets.QLineEdit(STRUCTUREYY_DEFAULT) self.structureexEdit = QtWidgets.QLineEdit(STRUCTUREEX_DEFAULT) self.structure3DEdit = QtWidgets.QLineEdit(STRUCTURE3D_DEFAULT) self.structurecombo = QtWidgets.QComboBox() for entry in ["Grid", "Circle", "Custom"]: self.structurecombo.addItem(entry) self.structure1Edit = QtWidgets.QSpinBox() self.structure1Edit.setKeyboardTracking(False) self.structure1Edit.setRange(1, 1000) self.structure1Edit.setValue(STRUCTURE1_DEFAULT) self.structure2Edit = QtWidgets.QSpinBox() self.structure2Edit.setKeyboardTracking(False) self.structure2Edit.setRange(1, 1000) self.structure2Edit.setValue(STRUCTURE2_DEFAULT) self.structure3Edit = QtWidgets.QLineEdit(STRUCTURE3_DEFAULT) self.structure1Edit.valueChanged.connect(self.changeStructDefinition) self.structure2Edit.valueChanged.connect(self.changeStructDefinition) self.structure3Edit.returnPressed.connect(self.changeStructDefinition) self.structurenoEdit.setValue(STRUCTURENO_DEFAULT) self.structureframeEdit.setValue(STRUCTUREFRAME_DEFAULT) self.structurenoEdit.setKeyboardTracking(False) self.structureframeEdit.setKeyboardTracking(False) self.structurexxEdit.returnPressed.connect(self.generatePositions) self.structureyyEdit.returnPressed.connect(self.generatePositions) self.structureexEdit.returnPressed.connect(self.generatePositions) self.structure3DEdit.returnPressed.connect(self.generatePositions) self.structurenoEdit.valueChanged.connect(self.generatePositions) self.structureframeEdit.valueChanged.connect(self.generatePositions) self.structurerandomOrientationEdit = QtWidgets.QCheckBox() self.structurerandomEdit = QtWidgets.QCheckBox() structurerandom = QtWidgets.QLabel("Random arrangement") structurerandomOrientation = QtWidgets.QLabel("Random orientation") self.structurerandomEdit.stateChanged.connect(self.generatePositions) self.structurerandomOrientationEdit.stateChanged.connect( self.generatePositions ) self.structureIncorporationEdit.valueChanged.connect( self.generatePositions ) self.structurecombo.currentIndexChanged.connect( self.changeStructureType ) sgrid.addWidget(structureno, 1, 0) sgrid.addWidget(self.structurenoEdit, 1, 1) sgrid.addWidget(structureframe, 2, 0) sgrid.addWidget(self.structureframeEdit, 2, 1) sgrid.addWidget(QtWidgets.QLabel("Px"), 2, 2) sgrid.addWidget(structurecomboLabel) sgrid.addWidget(self.structurecombo, 3, 1) sgrid.addWidget(self.structure1, 4, 0) sgrid.addWidget(self.structure1Edit, 4, 1) sgrid.addWidget(self.structure2, 5, 0) sgrid.addWidget(self.structure2Edit, 5, 1) sgrid.addWidget(self.structure3, 6, 0) sgrid.addWidget(self.structure3Edit, 6, 1) sgrid.addWidget(self.structure3Label, 6, 2) sgrid.addWidget(structurexx, 7, 0) sgrid.addWidget(self.structurexxEdit, 7, 1) sgrid.addWidget(QtWidgets.QLabel("nm"), 7, 2) sgrid.addWidget(structureyy, 8, 0) sgrid.addWidget(self.structureyyEdit, 8, 1) sgrid.addWidget(QtWidgets.QLabel("nm"), 8, 2) sindex = 0 sgrid.addWidget(structure3d, 9, 0) sgrid.addWidget(self.structure3DEdit, 9, 1) sindex = 1 sgrid.addWidget(structureex, 9 + sindex, 0) sgrid.addWidget(self.structureexEdit, 9 + sindex, 1) sindex += -1 sgrid.addWidget(structurerandom, 11 + sindex, 1) sgrid.addWidget(self.structurerandomEdit, 11 + sindex, 0) sgrid.addWidget(structurerandomOrientation, 12 + sindex, 1) sgrid.addWidget(self.structurerandomOrientationEdit, 12 + sindex, 0) sindex += -2 importDesignButton = QtWidgets.QPushButton("Import structure from design") importDesignButton.clicked.connect(self.importDesign) sgrid.addWidget(importDesignButton, 15 + sindex, 0, 1, 3) generateButton = QtWidgets.QPushButton("Generate positions") generateButton.clicked.connect(self.generatePositions) sgrid.addWidget(generateButton, 17 + sindex, 0, 1, 3) cgrid.addItem( QtWidgets.QSpacerItem( 1, 1, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding ) ) simulateButton = QtWidgets.QPushButton("Simulate data") simulateAndLocalize = QtWidgets.QPushButton("Simulate data, Localize, Render") self.simulate_localize = SimulateAndLocalizeDialog(self) self.exchangeroundsEdit = QtWidgets.QLineEdit("1") self.conroundsEdit = QtWidgets.QSpinBox() self.conroundsEdit.setRange(1, 1000) quitButton = QtWidgets.QPushButton("Quit", self) quitButton.clicked.connect(QtCore.QCoreApplication.instance().quit) quitButton.resize(quitButton.sizeHint()) loadButton = QtWidgets.QPushButton( "Load settings from previous simulation" ) btngridR = QtWidgets.QGridLayout() self.concatExchangeEdit = QtWidgets.QCheckBox() self.exportkinetics = QtWidgets.QCheckBox() btngridR.addWidget(loadButton, 0, 0, 1, 2) btngridR.addWidget( QtWidgets.QLabel("Exchange rounds to be simulated:"), 1, 0 ) btngridR.addWidget(self.exchangeroundsEdit, 1, 1) btngridR.addWidget(QtWidgets.QLabel("Concatenate several rounds:"), 2, 0) btngridR.addWidget(self.conroundsEdit, 2, 1) btngridR.addWidget(QtWidgets.QLabel("Concatenate Exchange")) btngridR.addWidget(self.concatExchangeEdit, 3, 1) btngridR.addWidget(QtWidgets.QLabel("Export kinetic data")) btngridR.addWidget(self.exportkinetics, 4, 1) btngridR.addWidget(simulateButton, 5, 0, 1, 2) btngridR.addWidget(simulateAndLocalize, 6, 0, 1, 2) btngridR.addWidget(quitButton, 7, 0, 1, 2) simulateButton.clicked.connect(self.simulate) loadButton.clicked.connect(self.loadSettings) simulateAndLocalize.clicked.connect(self.simulate_localize.show) self.show() self.changeTime() self.changePSF() self.changeNoise() self.changePaint() pos_groupbox = QtWidgets.QGroupBox("Positions [Px]") str_groupbox = QtWidgets.QGroupBox("Structure [nm]") posgrid = QtWidgets.QGridLayout(pos_groupbox) strgrid = QtWidgets.QGridLayout(str_groupbox) self.figure1 = plt.figure() self.figure2 = plt.figure() self.canvas1 = FigureCanvas(self.figure1) csize = 180 self.canvas1.setMinimumSize(csize, csize) self.canvas2 = FigureCanvas(self.figure2) self.canvas2.setMinimumSize(csize, csize) posgrid.addWidget(self.canvas1) strgrid.addWidget(self.canvas2) self.mainpbar = QtWidgets.QProgressBar(self) # Arrange Buttons if ADVANCEDMODE: self.grid.addWidget(pos_groupbox, 1, 0) self.grid.addWidget(str_groupbox, 1, 1) self.grid.addWidget(structure_groupbox, 2, 0, 2, 1) self.grid.addWidget(camera_groupbox, 1, 2) self.grid.addWidget(paint_groupbox, 3, 1) self.grid.addWidget(imager_groupbox, 2, 1) self.grid.addWidget(noise_groupbox, 2, 2) self.grid.addLayout(btngridR, 3, 2) self.grid.addWidget(self.mainpbar, 5, 0, 1, 4) self.grid.addWidget(threed_groupbox, 4, 0) self.grid.addWidget(handles_groupbox, 4, 1) else: # Left side self.grid.addWidget(pos_groupbox, 1, 0) self.grid.addWidget(str_groupbox, 1, 1) self.grid.addWidget(structure_groupbox, 2, 0) self.grid.addWidget(paint_groupbox, 3, 0) self.grid.addWidget(handles_groupbox, 4, 0) self.grid.addWidget(threed_groupbox, 5, 0) # Right side self.grid.addWidget(imager_groupbox, 2, 1) self.grid.addWidget(camera_groupbox, 3, 1) self.grid.addLayout(btngridR, 4, 1, 2, 1) self.grid.addWidget(self.mainpbar, 8, 0, 1, 4) mainWidget = QtWidgets.QWidget() mainWidget.setLayout(self.grid) self.setCentralWidget(mainWidget) self.setGeometry(300, 300, 300, 150) # CALL FUNCTIONS self.generatePositions() self.mainpbar.setValue(0) self.statusBar().showMessage("Simulate ready.") def load3dCalibration(self): # if hasattr(self.window, 'movie_path'): # dir = os.path.dirname(self.window.movie_path) # else: dir = None path, ext = QtWidgets.QFileDialog.getOpenFileName( self, "Load 3d calibration", directory=dir, filter="*.yaml" ) if path: with open(path, "r") as f: z_calibration = yaml.load(f) self.cx = _np.array(z_calibration["X Coefficients"]) self.cy = _np.array(z_calibration["Y Coefficients"]) self.statusBar().showMessage("Caliration loaded from: " + path) def changeTime(self): laserpower = self.laserpowerEdit.value() itime = self.integrationtimeEdit.value() frames = self.framesEdit.value() totaltime = itime * frames / 1000 / 60 totaltime = round(totaltime * 100) / 100 self.totaltimeEdit.setText(str(totaltime)) photonslope = self.photonslopeEdit.value() photonslopestd = photonslope / STDFACTOR if ADVANCEDMODE: photonslopestd = self.photonslopeStdEdit.value() photonrate = photonslope * laserpower photonratestd = photonslopestd * laserpower photonsframe = round(photonrate * itime) photonsframestd = round(photonratestd * itime) self.photonsframeEdit.setText(str(photonsframe)) self.photonstdframeEdit.setText(str(photonsframestd)) self.changeNoise() def changePaint(self): kon = self.konEdit.value() imagerconcentration = self.imagerconcentrationEdit.value() taud = round(1 / (kon * imagerconcentration * 1 / 10 ** 9) * 1000) self.taudEdit.setText(str(taud)) self.changeNoise() def changePSF(self): psf = self.psfEdit.value() pixelsize = self.pixelsizeEdit.value() psf_fwhm = round(psf * pixelsize * 2.355) self.psf_fwhmEdit.setText(str(psf_fwhm)) def changeImager(self): laserpower = self.laserpowerEdit.value() itime = self.integrationtimeEdit.value() photonslope = self.photonslopeEdit.value() photonslopestd = photonslope / STDFACTOR if ADVANCEDMODE: photonslopestd = self.photonslopeStdEdit.value() photonrate = photonslope * laserpower photonratestd = photonslopestd * laserpower photonsframe = round(photonrate * itime) photonsframestd = round(photonratestd * itime) self.photonsframeEdit.setText(str(photonsframe)) self.photonstdframeEdit.setText(str(photonsframestd)) self.photonrateEdit.setValue((photonrate)) self.photonratestdEdit.setValue((photonratestd)) self.changeNoise() def changeNoise(self): itime = self.integrationtimeEdit.value() imagerconcentration = self.imagerconcentrationEdit.value() laserpower = self.laserpowerEdit.value() * POWERDENSITY_CONVERSION bglevel = self.backgroundlevelEdit.value() if ADVANCEDMODE: # NEW NOISE MODEL laserc = self.lasercEdit.value() imagerc = self.imagercEdit.value() bgoffset = self.BgoffsetEdit.value() bgmodel = ( laserc + imagerc * imagerconcentration ) * laserpower * itime + bgoffset equationA = self.EquationAEdit.value() equationB = self.EquationBEdit.value() equationC = self.EquationCEdit.value() bgstdoffset = self.BgStdoffsetEdit.value() bgmodelstd = ( equationA * laserpower * itime + equationB * bgmodel + equationC + bgstdoffset * bglevel ) self.backgroundframeEdit.setText(str(int(bgmodel))) self.noiseEdit.setText(str(int(bgmodelstd))) else: bgmodel = ( (LASERC_DEFAULT + IMAGERC_DEFAULT * imagerconcentration) * laserpower * itime * bglevel ) self.backgroundframesimpleEdit.setText(str(int(bgmodel))) def changeStructureType(self): typeindex = self.structurecombo.currentIndex() # TYPEINDEX: 0 = GRID, 1 = CIRCLE, 2 = CUSTOM, 3 = Handles if typeindex == 0: self.structure1.show() self.structure2.show() self.structure3.show() self.structure1Edit.show() self.structure2Edit.show() self.structure3Edit.show() self.structure3Label.show() self.structure1.setText("Columns") self.structure2.setText("Rows") self.structure3.setText("Spacing X,Y") self.structure1Edit.setValue(3) self.structure2Edit.setValue(4) self.structure3Edit.setText("20,20") elif typeindex == 1: self.structure1.show() self.structure2.show() self.structure3.show() self.structure1Edit.show() self.structure2Edit.show() self.structure3Edit.show() self.structure3Label.show() self.structure1.hide() self.structure2.setText("Number of Labels") self.structure3.setText("Diameter") self.structure1Edit.hide() self.structure2Edit.setValue(12) self.structure3Edit.setText("100") elif typeindex == 2: self.structure1.hide() self.structure2.hide() self.structure3.hide() self.structure1Edit.hide() self.structure2Edit.hide() self.structure3Edit.hide() self.structure3Label.hide() elif typeindex == 3: self.structure1.hide() self.structure2.hide() self.structure3.hide() self.structure1Edit.hide() self.structure2Edit.hide() self.structure3Edit.hide() self.structure3Label.hide() self.structure3Label.hide() self.changeStructDefinition() def changeStructDefinition(self): typeindex = self.structurecombo.currentIndex() if typeindex == 0: # grid rows = self.structure1Edit.value() cols = self.structure2Edit.value() spacingtxt = _np.asarray((self.structure3Edit.text()).split(",")) try: spacingx = float(spacingtxt[0]) except ValueError: spacingx = 1 if spacingtxt.size > 1: try: spacingy = float(spacingtxt[1]) except ValueError: spacingy = 1 else: spacingy = 1 structurexx = "" structureyy = "" structureex = "" structure3d = "" for i in range(0, rows): for j in range(0, cols): structurexx = structurexx + str(i * spacingx) + "," structureyy = structureyy + str(j * spacingy) + "," structureex = structureex + "1," structure3d = structure3d + "0," structurexx = structurexx[:-1] structureyy = structureyy[:-1] structureex = structureex[:-1] self.structurexxEdit.setText(structurexx) self.structureyyEdit.setText(structureyy) self.structureexEdit.setText(structureex) self.structure3DEdit.setText(structure3d) self.generatePositions() elif typeindex == 1: # CIRCLE labels = self.structure2Edit.value() diametertxt = _np.asarray((self.structure3Edit.text()).split(",")) try: diameter = float(diametertxt[0]) except ValueError: diameter = 100 twopi = 2 * 3.1415926535 circdata = _np.arange(0, twopi, twopi / labels) xxval = _np.round(_np.cos(circdata) * diameter / 2 * 100) / 100 yyval = _np.round(_np.sin(circdata) * diameter / 2 * 100) / 100 structurexx = "" structureyy = "" structureex = "" structure3d = "" for i in range(0, xxval.size): structurexx = structurexx + str(xxval[i]) + "," structureyy = structureyy + str(yyval[i]) + "," structureex = structureex + "1," structure3d = structure3d + "0," structurexx = structurexx[:-1] structureyy = structureyy[:-1] structureex = structureex[:-1] self.structurexxEdit.setText(structurexx) self.structureyyEdit.setText(structureyy) self.structureexEdit.setText(structureex) self.structure3DEdit.setText(structure3d) self.generatePositions() elif typeindex == 2: # Custom self.generatePositions() elif typeindex == 3: # Handles print("Handles will be displayed..") def keyPressEvent(self, e): if e.key() == QtCore.Qt.Key_Escape: self.close() def vectorToString(self, x): x_arrstr = _np.char.mod("%f", x) x_str = ",".join(x_arrstr) return x_str def simulate(self): exchangeroundstoSim = _np.asarray( (self.exchangeroundsEdit.text()).split(",") ) exchangeroundstoSim = exchangeroundstoSim.astype(_np.int) noexchangecolors = len(set(exchangeroundstoSim)) exchangecolors = list(set(exchangeroundstoSim)) if self.concatExchangeEdit.checkState(): conrounds = noexchangecolors else: conrounds = self.conroundsEdit.value() self.currentround += 1 if self.currentround == 1: fileNameOld, exe = QtWidgets.QFileDialog.getSaveFileName( self, "Save movie to..", filter="*.raw" ) if fileNameOld: self.fileName = fileNameOld else: self.currentround -= 1 else: fileNameOld = self.fileName if fileNameOld: print(fileNameOld) self.statusBar().showMessage( "Set round " + str(self.currentround) + " of " + str(conrounds) ) # READ IN PARAMETERS # STRUCTURE structureNo = self.structurenoEdit.value() structureFrame = self.structureframeEdit.value() structureIncorporation = self.structureIncorporationEdit.value() structureArrangement = int(self.structurerandomEdit.checkState()) structureOrientation = int( self.structurerandomOrientationEdit.checkState() ) structurex = self.structurexxEdit.text() structurey = self.structureyyEdit.text() structureextxt = self.structureexEdit.text() structure3dtxt = self.structure3DEdit.text() # PAINT kon = self.konEdit.value() imagerconcentration = self.imagerconcentrationEdit.value() taub = self.taubEdit.value() taud = int(self.taudEdit.text()) # IMAGER PARAMETERS psf = self.psfEdit.value() photonrate = self.photonrateEdit.value() photonratestd = self.photonratestdEdit.value() photonbudget = self.photonbudgetEdit.value() laserpower = self.laserpowerEdit.value() photonslope = self.photonslopeEdit.value() photonslopeStd = photonslope / STDFACTOR if ADVANCEDMODE: photonslopeStd = self.photonslopeStdEdit.value() if self.photonslopemodeEdit.checkState(): photonratestd = 0 # CAMERA PARAMETERS imagesize = self.camerasizeEdit.value() itime = self.integrationtimeEdit.value() frames = self.framesEdit.value() pixelsize = self.pixelsizeEdit.value() # NOISE MODEL if ADVANCEDMODE: background = int(self.backgroundframeEdit.text()) noise = int(self.noiseEdit.text()) laserc = self.lasercEdit.value() imagerc = self.imagercEdit.value() bgoffset = self.BgoffsetEdit.value() equationA = self.EquationAEdit.value() equationB = self.EquationBEdit.value() equationC = self.EquationCEdit.value() bgstdoffset = self.BgStdoffsetEdit.value() else: background = int(self.backgroundframesimpleEdit.text()) noise = _np.sqrt(background) laserc = LASERC_DEFAULT imagerc = IMAGERC_DEFAULT bgoffset = BGOFFSET_DEFAULT equationA = EQA_DEFAULT equationB = EQB_DEFAULT equationC = EQC_DEFAULT bgstdoffset = BGSTDOFFSET_DEFAULT structurexx, structureyy, structureex, structure3d = ( self.readStructure() ) self.statusBar().showMessage("Simulation started") struct = self.newstruct handlex = self.vectorToString(struct[0, :]) handley = self.vectorToString(struct[1, :]) handleex = self.vectorToString(struct[2, :]) handless = self.vectorToString(struct[3, :]) handle3d = self.vectorToString(struct[4, :]) mode3Dstate = int(self.mode3DEdit.checkState()) t0 = time.time() if self.concatExchangeEdit.checkState(): noexchangecolors = ( 1 ) # Overwrite the number to not trigger the for loop for i in range(0, noexchangecolors): if noexchangecolors > 1: fileName = _io.multiple_filenames(fileNameOld, i) partstruct = struct[:, struct[2, :] == exchangecolors[i]] elif self.concatExchangeEdit.checkState(): fileName = fileNameOld partstruct = struct[ :, struct[2, :] == exchangecolors[self.currentround - 1], ] else: fileName = fileNameOld partstruct = struct[:, struct[2, :] == exchangecolors[0]] self.statusBar().showMessage("Distributing photons ...") bindingsitesx = partstruct[0, :] nosites = len( bindingsitesx ) # number of binding sites in image photondist = _np.zeros((nosites, frames), dtype=_np.int) spotkinetics = _np.zeros((nosites, 4), dtype=_np.float) timetrace = {} for i in range(0, nosites): p_temp, t_temp, k_temp = simulate.distphotons( partstruct, itime, frames, taud, taub, photonrate, photonratestd, photonbudget, ) photondist[i, :] = p_temp spotkinetics[i, :] = k_temp timetrace[i] = self.vectorToString(t_temp) outputmsg = ( "Distributing photons ... " + str(_np.round(i / nosites * 1000) / 10) + " %" ) self.statusBar().showMessage(outputmsg) self.mainpbar.setValue(_np.round(i / nosites * 1000) / 10) self.statusBar().showMessage("Converting to image ... ") onevents = self.vectorToString(spotkinetics[:, 0]) localizations = self.vectorToString(spotkinetics[:, 1]) meandarksim = self.vectorToString(spotkinetics[:, 2]) meanbrightsim = self.vectorToString(spotkinetics[:, 3]) movie = _np.zeros(shape=(frames, imagesize, imagesize)) info = { "Generated by": "Picasso simulate", "Byte Order": "<", "Camera": "Simulation", "Data Type": "uint16", "Frames": frames, "Structure.Frame": structureFrame, "Structure.Number": structureNo, "Structure.StructureX": structurex, "Structure.StructureY": structurey, "Structure.StructureEx": structureextxt, "Structure.Structure3D": structure3dtxt, "Structure.HandleX": handlex, "Structure.HandleY": handley, "Structure.HandleEx": handleex, "Structure.Handle3d": handle3d, "Structure.HandleStruct": handless, "Structure.Incorporation": structureIncorporation, "Structure.Arrangement": structureArrangement, "Structure.Orientation": structureOrientation, "Structure.3D": mode3Dstate, "Structure.CX": self.cx, "Structure.CY": self.cy, "PAINT.k_on": kon, "PAINT.imager": imagerconcentration, "PAINT.taub": taub, "Imager.PSF": psf, "Imager.Photonrate": photonrate, "Imager.Photonrate Std": photonratestd, "Imager.Constant Photonrate Std": int( self.photonslopemodeEdit.checkState() ), "Imager.Photonbudget": photonbudget, "Imager.Laserpower": laserpower, "Imager.Photonslope": photonslope, "Imager.PhotonslopeStd": photonslopeStd, "Imager.BackgroundLevel": self.backgroundlevelEdit.value(), "Camera.Image Size": imagesize, "Camera.Integration Time": itime, "Camera.Frames": frames, "Camera.Pixelsize": pixelsize, "Noise.Lasercoefficient": laserc, "Noise.Imagercoefficient": imagerc, "Noise.EquationA": equationA, "Noise.EquationB": equationB, "Noise.EquationC": equationC, "Noise.BackgroundOff": bgoffset, "Noise.BackgroundStdOff": bgstdoffset, "Spotkinetics.ON_Events": onevents, "Spotkinetics.Localizations": localizations, "Spotkinetics.MEAN_DARK": meandarksim, "Spotkinetics.MEAN_BRIGHT": meanbrightsim, "Height": imagesize, "Width": imagesize, } if conrounds != 1: app = QtCore.QCoreApplication.instance() for runner in range(0, frames): movie[runner, :, :] = simulate.convertMovie( runner, photondist, partstruct, imagesize, frames, psf, photonrate, background, noise, mode3Dstate, self.cx, self.cy, ) outputmsg = ( "Converting to Image ... " + str(_np.round(runner / frames * 1000) / 10) + " %" ) self.statusBar().showMessage(outputmsg) self.mainpbar.setValue( _np.round(runner / frames * 1000) / 10 ) app.processEvents() if self.currentround == 1: self.movie = movie else: movie = movie + self.movie self.movie = movie self.statusBar().showMessage( "Converting to image ... complete. Current round: " + str(self.currentround) + " of " + str(conrounds) + ". Please set and start next round." ) if self.currentround == conrounds: self.statusBar().showMessage( "Adding noise to movie ..." ) movie = simulate.noisy_p(movie, background) movie = simulate.check_type(movie) self.statusBar().showMessage("Saving movie ...") simulate.saveMovie(fileName, movie, info) self.statusBar().showMessage( "Movie saved to: " + fileName ) dt = time.time() - t0 self.statusBar().showMessage( "All computations finished. Last file saved to: " + fileName + ". Time elapsed: {:.2f} Seconds.".format(dt) ) self.currentround = 0 else: # just save info file # self.statusBar().showMessage('Saving yaml ...') info_path = ( _ospath.splitext(fileName)[0] + "_" + str(self.currentround) + ".yaml" ) _io.save_info(info_path, [info]) if self.exportkinetics.isChecked(): # Export the kinetic data if this is checked kinfo_path = ( _ospath.splitext(fileName)[0] + "_" + str(self.currentround) + "_kinetics.yaml" ) _io.save_info(kinfo_path, [timetrace]) self.statusBar().showMessage( "Movie saved to: " + fileName ) else: app = QtCore.QCoreApplication.instance() for runner in range(0, frames): movie[runner, :, :] = simulate.convertMovie( runner, photondist, partstruct, imagesize, frames, psf, photonrate, background, noise, mode3Dstate, self.cx, self.cy, ) outputmsg = ( "Converting to Image ... " + str(_np.round(runner / frames * 1000) / 10) + " %" ) self.statusBar().showMessage(outputmsg) self.mainpbar.setValue( _np.round(runner / frames * 1000) / 10 ) app.processEvents() movie = simulate.noisy_p(movie, background) movie = simulate.check_type(movie) self.mainpbar.setValue(100) self.statusBar().showMessage( "Converting to image ... complete." ) self.statusBar().showMessage("Saving movie ...") simulate.saveMovie(fileName, movie, info) if self.exportkinetics.isChecked(): # Export the kinetic data if this is checked kinfo_path = ( _ospath.splitext(fileName)[0] + "_kinetics.yaml" ) _io.save_info(kinfo_path, [timetrace]) self.statusBar().showMessage("Movie saved to: " + fileName) dt = time.time() - t0 self.statusBar().showMessage( "All computations finished. Last file saved to: " + fileName + ". Time elapsed: {:.2f} Seconds.".format(dt) ) self.currentround = 0 ##################################################################### def loadSettings(self): # TODO: re-write exceptions, check key path, exe = QtWidgets.QFileDialog.getOpenFileName( self, "Open yaml", filter="*.yaml" ) if path: info = _io.load_info(path) self.framesEdit.setValue(info[0]["Frames"]) self.structureframeEdit.setValue(info[0]["Structure.Frame"]) self.structurenoEdit.setValue(info[0]["Structure.Number"]) self.structurexxEdit.setText(info[0]["Structure.StructureX"]) self.structureyyEdit.setText(info[0]["Structure.StructureY"]) self.structureexEdit.setText(info[0]["Structure.StructureEx"]) try: self.structure3DEdit.setText(info[0]["Structure.Structure3D"]) self.mode3DEdit.setCheckState(info[0]["Structure.3D"]) self.cx(info[0]["Structure.CX"]) self.cy(info[0]["Structure.CY"]) except Exception as e: print(e) pass try: self.photonslopemodeEdit.setCheckState( info[0]["Imager.Constant Photonrate Std"] ) except Exception as e: print(e) pass try: self.backgroundlevelEdit.setValue( info[0]["Imager.BackgroundLevel"] ) except Exception as e: print(e) pass self.structureIncorporationEdit.setValue( info[0]["Structure.Incorporation"] ) self.structurerandomEdit.setCheckState( info[0]["Structure.Arrangement"] ) self.structurerandomOrientationEdit.setCheckState( info[0]["Structure.Orientation"] ) self.konEdit.setValue(info[0]["PAINT.k_on"]) self.imagerconcentrationEdit.setValue(info[0]["PAINT.imager"]) self.taubEdit.setValue(info[0]["PAINT.taub"]) self.psfEdit.setValue(info[0]["Imager.PSF"]) self.photonrateEdit.setValue(info[0]["Imager.Photonrate"]) self.photonratestdEdit.setValue(info[0]["Imager.Photonrate Std"]) self.photonbudgetEdit.setValue(info[0]["Imager.Photonbudget"]) self.laserpowerEdit.setValue(info[0]["Imager.Laserpower"]) self.photonslopeEdit.setValue(info[0]["Imager.Photonslope"]) self.photonslopeStdEdit.setValue(info[0]["Imager.PhotonslopeStd"]) self.camerasizeEdit.setValue(info[0]["Camera.Image Size"]) self.integrationtimeEdit.setValue( info[0]["Camera.Integration Time"] ) self.framesEdit.setValue(info[0]["Camera.Frames"]) self.pixelsizeEdit.setValue(info[0]["Camera.Pixelsize"]) if ADVANCEDMODE: self.lasercEdit.setValue(info[0]["Noise.Lasercoefficient"]) self.imagercEdit.setValue(info[0]["Noise.Imagercoefficient"]) self.BgoffsetEdit.setValue(info[0]["Noise.BackgroundOff"]) self.EquationAEdit.setValue(info[0]["Noise.EquationA"]) self.EquationBEdit.setValue(info[0]["Noise.EquationB"]) self.EquationCEdit.setValue(info[0]["Noise.EquationC"]) self.BgStdoffsetEdit.setValue( info[0]["Noise.BackgroundStdOff"] ) # SET POSITIONS handlexx = _np.asarray((info[0]["Structure.HandleX"]).split(",")) handleyy = _np.asarray((info[0]["Structure.HandleY"]).split(",")) handleex = _np.asarray((info[0]["Structure.HandleEx"]).split(",")) handless = _np.asarray( (info[0]["Structure.HandleStruct"]).split(",") ) handlexx = handlexx.astype(_np.float) handleyy = handleyy.astype(_np.float) handleex = handleex.astype(_np.float) handless = handless.astype(_np.float) handleex = handleex.astype(_np.int) handless = handless.astype(_np.int) handle3d = _np.asarray((info[0]["Structure.Handle3d"]).split(",")) handle3d = handle3d.astype(_np.float) structure = _np.array( [handlexx, handleyy, handleex, handless, handle3d] ) self.structurecombo.setCurrentIndex(2) self.newstruct = structure self.plotPositions() self.statusBar().showMessage("Settings loaded from: " + path) def importDesign(self): path, exe = QtWidgets.QFileDialog.getOpenFileName( self, "Open yaml", filter="*.yaml" ) if path: info = _io.load_info(path) self.structurexxEdit.setText(info[0]["Structure.StructureX"]) self.structureyyEdit.setText(info[0]["Structure.StructureY"]) self.structureexEdit.setText(info[0]["Structure.StructureEx"]) structure3d = "" for i in range(0, len(self.structurexxEdit.text())): structure3d = structure3d + "0," self.structure3DEdit.setText(structure3d) self.structurecombo.setCurrentIndex(2) def readLine(self, linetxt, type="float", textmode=True): if textmode: line = _np.asarray((linetxt.text()).split(",")) else: line = _np.asarray((linetxt.split(","))) values = [] for element in line: try: if type == "int": values.append(int(element)) elif type == "float": values.append(float(element)) except ValueError: pass return values def importHandles(self): # Import structure <> self.handles = {} path, exe = QtWidgets.QFileDialog.getOpenFileName( self, "Open yaml", filter="*.yaml *.hdf5" ) if path: splitpath = _ospath.splitext(path) if splitpath[-1] == ".yaml": info = _io.load_info(path) x = self.readLine( info[0]["Structure.StructureX"], textmode=False ) y = self.readLine( info[0]["Structure.StructureY"], textmode=False ) try: ex = self.readLine( info[0]["Structure.StructureEx"], type="int", textmode=False, ) except Exception as e: print(e) ex = _np.ones_like(x) try: z = self.readLine(info[0]["Structure.Structure3D"]) except Exception as e: print(e) z = _np.zeros_like(x) minlen = min(len(x), len(y), len(ex), len(z)) x = x[0:minlen] y = y[0:minlen] ex = ex[0:minlen] z = z[0:minlen] else: clusters = _io.load_clusters(path) pixelsize = self.pixelsizeEdit.value() imagesize = self.camerasizeEdit.value() x = clusters["com_x"] y = clusters["com_y"] # Align in the center of window: x = x - _np.mean(x) + imagesize / 2 y = -(y - _np.mean(y)) + imagesize / 2 x = x * pixelsize y = y * pixelsize try: z = clusters["com_z"] except Exception as e: print(e) z = _np.zeros_like(x) ex = _np.ones_like(x) minlen = len(x) self.handles["x"] = x self.handles["y"] = y self.handles["z"] = z self.handles["ex"] = ex # TODO: Check axis orientation exchangecolors = list(set(self.handles["ex"])) exchangecolorsList = ",".join(map(str, exchangecolors)) # UPDATE THE EXCHANGE COLORS IN BUTTON TO BE simulated self.exchangeroundsEdit.setText(str(exchangecolorsList)) self.structurenoEdit.setValue(1) self.structureMode = False self.generatePositions() self.statusBar().showMessage( "A total of {} points loaded.".format(minlen) ) def readStructure(self): structurexx = self.readLine(self.structurexxEdit) structureyy = self.readLine(self.structureyyEdit) structureex = self.readLine(self.structureexEdit, "int") structure3d = self.readLine(self.structure3DEdit) minlen = min( len(structureex), len(structurexx), len(structureyy), len(structure3d), ) structurexx = structurexx[0:minlen] structureyy = structureyy[0:minlen] structureex = structureex[0:minlen] structure3d = structure3d[0:minlen] return structurexx, structureyy, structureex, structure3d def plotStructure(self): structurexx, structureyy, structureex, structure3d = ( self.readStructure() ) noexchangecolors = len(set(structureex)) exchangecolors = list(set(structureex)) # self.figure2.suptitle('Structure [nm]') ax1 = self.figure2.add_subplot(111) ax1.cla() #ax1.hold(True) ax1.axis("equal") for i in range(0, noexchangecolors): plotxx = [] plotyy = [] for j in range(0, len(structureex)): if structureex[j] == exchangecolors[i]: plotxx.append(structurexx[j]) plotyy.append(structureyy[j]) ax1.plot(plotxx, plotyy, "o") distx = round(1 / 10 * (max(structurexx) - min(structurexx))) disty = round(1 / 10 * (max(structureyy) - min(structureyy))) ax1.axes.set_xlim((min(structurexx) - distx, max(structurexx) + distx)) ax1.axes.set_ylim((min(structureyy) - disty, max(structureyy) + disty)) self.canvas2.draw() exchangecolorsList = ",".join(map(str, exchangecolors)) # UPDATE THE EXCHANGE COLORS IN BUTTON TO BE simulated self.exchangeroundsEdit.setText(str(exchangecolorsList)) def generatePositions(self): self.plotStructure() pixelsize = self.pixelsizeEdit.value() if self.structureMode: structurexx, structureyy, structureex, structure3d = ( self.readStructure() ) structure = simulate.defineStructure( structurexx, structureyy, structureex, structure3d, pixelsize ) else: structurexx = self.handles["x"] structureyy = self.handles["y"] structureex = self.handles["ex"] structure3d = self.handles["z"] structure = simulate.defineStructure( structurexx, structureyy, structureex, structure3d, pixelsize, mean=False, ) number = self.structurenoEdit.value() imageSize = self.camerasizeEdit.value() frame = self.structureframeEdit.value() arrangement = int(self.structurerandomEdit.checkState()) gridpos = simulate.generatePositions( number, imageSize, frame, arrangement ) orientation = int(self.structurerandomOrientationEdit.checkState()) incorporation = self.structureIncorporationEdit.value() / 100 exchange = 0 if self.structureMode: self.newstruct = simulate.prepareStructures( structure, gridpos, orientation, number, incorporation, exchange, ) else: self.newstruct = simulate.prepareStructures( structure, _np.array([[0, 0]]), orientation, number, incorporation, exchange, ) in_x = _np.logical_and( self.newstruct[0, :] < (imageSize - frame), self.newstruct[0, :] > frame, ) in_y = _np.logical_and( self.newstruct[1, :] < (imageSize - frame), self.newstruct[1, :] > frame, ) in_frame = _np.logical_and(in_x, in_y) self.newstruct = self.newstruct[:, in_frame] # self.figure1.suptitle('Positions [Px]') ax1 = self.figure1.add_subplot(111) ax1.cla() #ax1.hold(True) ax1.axis("equal") ax1.plot(self.newstruct[0, :], self.newstruct[1, :], "+") # PLOT FRAME ax1.add_patch( patches.Rectangle( (frame, frame), imageSize - 2 * frame, imageSize - 2 * frame, linestyle="dashed", edgecolor="#000000", fill=False, # remove background ) ) ax1.axes.set_xlim(0, imageSize) ax1.axes.set_ylim(0, imageSize) self.canvas1.draw() # PLOT first structure struct1 = self.newstruct[:, self.newstruct[3, :] == 0] noexchangecolors = len(set(struct1[2, :])) exchangecolors = list(set(struct1[2, :])) self.noexchangecolors = exchangecolors # self.figure2.suptitle('Structure [nm]') ax1 = self.figure2.add_subplot(111) ax1.cla() #ax1.hold(True) ax1.axis("equal") structurexx = struct1[0, :] structureyy = struct1[1, :] structureex = struct1[2, :] structurexx_nm = _np.multiply( structurexx - min(structurexx), pixelsize ) structureyy_nm = _np.multiply( structureyy - min(structureyy), pixelsize ) for i in range(0, noexchangecolors): plotxx = [] plotyy = [] for j in range(0, len(structureex)): if structureex[j] == exchangecolors[i]: plotxx.append(structurexx_nm[j]) plotyy.append(structureyy_nm[j]) ax1.plot(plotxx, plotyy, "o") distx = round(1 / 10 * (max(structurexx_nm) - min(structurexx_nm))) disty = round(1 / 10 * (max(structureyy_nm) - min(structureyy_nm))) ax1.axes.set_xlim( (min(structurexx_nm) - distx, max(structurexx_nm) + distx) ) ax1.axes.set_ylim( (min(structureyy_nm) - disty, max(structureyy_nm) + disty) ) self.canvas2.draw() def plotPositions(self): structurexx, structureyy, structureex, structure3d = ( self.readStructure() ) pixelsize = self.pixelsizeEdit.value() structure = simulate.defineStructure( structurexx, structureyy, structureex, structure3d, pixelsize ) number = self.structurenoEdit.value() imageSize = self.camerasizeEdit.value() frame = self.structureframeEdit.value() arrangement = int(self.structurerandomEdit.checkState()) gridpos = simulate.generatePositions( number, imageSize, frame, arrangement ) orientation = int(self.structurerandomOrientationEdit.checkState()) incorporation = self.structureIncorporationEdit.value() / 100 exchange = 0 # self.figure1.suptitle('Positions [Px]') ax1 = self.figure1.add_subplot(111) ax1.cla() #ax1.hold(True) ax1.axis("equal") ax1.plot(self.newstruct[0, :], self.newstruct[1, :], "+") # PLOT FRAME ax1.add_patch( patches.Rectangle( (frame, frame), imageSize - 2 * frame, imageSize - 2 * frame, linestyle="dashed", edgecolor="#000000", fill=False, # remove background ) ) ax1.axes.set_xlim(0, imageSize) ax1.axes.set_ylim(0, imageSize) self.canvas1.draw() # PLOT first structure struct1 = self.newstruct[:, self.newstruct[3, :] == 0] noexchangecolors = len(set(struct1[2, :])) exchangecolors = list(set(struct1[2, :])) self.noexchangecolors = exchangecolors # self.figure2.suptitle('Structure [nm]') ax1 = self.figure2.add_subplot(111) ax1.cla() #ax1.hold(True) structurexx = struct1[0, :] structureyy = struct1[1, :] structureex = struct1[2, :] structurexx_nm = _np.multiply( structurexx - min(structurexx), pixelsize ) structureyy_nm = _np.multiply( structureyy - min(structureyy), pixelsize ) for i in range(0, noexchangecolors): plotxx = [] plotyy = [] for j in range(0, len(structureex)): if structureex[j] == exchangecolors[i]: plotxx.append(structurexx_nm[j]) plotyy.append(structureyy_nm[j]) ax1.plot(plotxx, plotyy, "o") distx = round(1 / 10 * (max(structurexx_nm) - min(structurexx_nm))) disty = round(1 / 10 * (max(structureyy_nm) - min(structureyy_nm))) ax1.axes.set_xlim( (min(structurexx_nm) - distx, max(structurexx_nm) + distx) ) ax1.axes.set_ylim( (min(structureyy_nm) - disty, max(structureyy_nm) + disty) ) self.canvas2.draw() def openDialog(self): path, exe = QtWidgets.QFileDialog.getOpenFileName( self, "Open design", filter="*.yaml" ) if path: self.mainscene.loadCanvas(path) self.statusBar().showMessage("File loaded from: " + path) def importhdf5(self): path, exe = QtWidgets.QFileDialog.getOpenFileName( self, "Open localizations", filter="*.hdf5" ) if path: self.readhdf5(path) def calibrateNoise(self): bg, bgstd, las, time, conc, ok = CalibrationDialog.setExt() _np.asarray(bg) _np.asarray(bgstd) _np.asarray(las) _np.asarray(time) _np.asarray(conc) x_3d = _np.array([conc, las, time]) p0 = [1, 1] fitParamsBg, fitCovariances = curve_fit(fitFuncBg, x_3d, bg, p0) print(" fit coefficients :\n", fitParamsBg) # SET VALUES TO PARAMETER self.lasercEdit.setValue(fitParamsBg[0]) self.imagercEdit.setValue(fitParamsBg[1]) x_3dStd = _np.array([las, time, bg]) p0S = [1, 1, 1] fitParamsStd, fitCovariances = curve_fit( fitFuncStd, x_3dStd, bgstd, p0S ) print(" fit coefficients2:\n", fitParamsStd) self.EquationAEdit.setValue(fitParamsStd[0]) self.EquationBEdit.setValue(fitParamsStd[1]) self.EquationCEdit.setValue(fitParamsStd[2]) # Noise model working point figure4 = plt.figure() # Background bgmodel = fitFuncBg(x_3d, fitParamsBg[0], fitParamsBg[1]) ax1 = figure4.add_subplot(121) ax1.cla() ax1.plot(bg, bgmodel, "o") x = _np.linspace(*ax1.get_xlim()) ax1.plot(x, x) title = "Background Model:" ax1.set_title(title) # Std bgmodelstd = fitFuncStd( x_3dStd, fitParamsStd[0], fitParamsStd[1], fitParamsStd[2] ) ax2 = figure4.add_subplot(122) ax2.cla() ax2.plot(bgstd, bgmodelstd, "o") x = _np.linspace(*ax2.get_xlim()) ax2.plot(x, x) title = "Background Model Std:" ax2.set_title(title) figure4.show() def sigmafilter(self, data, sigmas): # Filter data to be withing +- sigma sigma = _np.std(data) mean = _np.mean(data) datanew = data[data < (mean + sigmas * sigma)] datanew = datanew[datanew > (mean - sigmas * sigma)] return datanew def readhdf5(self, path): try: locs, self.info = _io.load_locs(path, qt_parent=self) except _io.NoMetadataFileError: return integrationtime, ok1 = QtWidgets.QInputDialog.getText( self, "Input Dialog", "Enter integration time in ms:" ) integrationtime = int(integrationtime) if ok1: imagerconcentration, ok2 = QtWidgets.QInputDialog.getText( self, "Input Dialog", "Enter imager concentration in nM:" ) imagerconcentration = float(imagerconcentration) if ok2: laserpower, ok3 = QtWidgets.QInputDialog.getText( self, "Input Dialog", "Enter Laserpower in mW:" ) laserpower = float(laserpower) if ok3: cbaseline, ok4 = QtWidgets.QInputDialog.getText( self, "Input Dialog", "Enter camera baseline" ) cbaseline = float(cbaseline) # self.le.setText(str(text)) photons = locs["photons"] sigmax = locs["sx"] sigmay = locs["sy"] bg = locs["bg"] bg = bg - cbaseline nosigmas = 3 photons = self.sigmafilter(photons, nosigmas) sigmax = self.sigmafilter(sigmax, nosigmas) sigmay = self.sigmafilter(sigmay, nosigmas) bg = self.sigmafilter(bg, nosigmas) figure3 = plt.figure() # Photons photonsmu, photonsstd = norm.fit(photons) ax1 = figure3.add_subplot(131) ax1.cla() #ax1.hold(True) # TODO: Investigate again what this causes ax1.hist(photons, bins=25, normed=True, alpha=0.6) xmin, xmax = plt.xlim() x = _np.linspace(xmin, xmax, 100) p = norm.pdf(x, photonsmu, photonsstd) ax1.plot(x, p) title = "Photons:\n mu = %.2f\n std = %.2f" % ( photonsmu, photonsstd, ) ax1.set_title(title) # Sigma X & Sigma Y sigma = _np.concatenate((sigmax, sigmay), axis=0) sigmamu, sigmastd = norm.fit(sigma) ax2 = figure3.add_subplot(132) ax2.cla() #ax2.hold(True) ax2.hist(sigma, bins=25, normed=True, alpha=0.6) xmin, xmax = plt.xlim() x = _np.linspace(xmin, xmax, 100) p = norm.pdf(x, sigmamu, sigmastd) ax2.plot(x, p) title = "PSF:\n mu = %.2f\n std = %.2f" % ( sigmamu, sigmastd, ) ax2.set_title(title) # Background bgmu, bgstd = norm.fit(bg) ax3 = figure3.add_subplot(133) ax3.cla() #ax3.hold(True) # Plot the histogram. ax3.hist(bg, bins=25, normed=True, alpha=0.6) xmin, xmax = plt.xlim() x = _np.linspace(xmin, xmax, 100) p = norm.pdf(x, bgmu, bgstd) ax3.plot(x, p) title = "Background:\n mu = %.2f\n std = %.2f" % ( bgmu, bgstd, ) ax3.set_title(title) figure3.tight_layout() figure3.show() # Calculate Rates # Photonrate, Photonrate Std, PSF photonrate = int(photonsmu / integrationtime) photonratestd = int(photonsstd / integrationtime) psf = int(sigmamu * 100) / 100 photonrate = int(photonsmu / integrationtime) # CALCULATE BG AND BG_STD FROM MODEL AND ADJUST OFFSET laserc = self.lasercEdit.value() imagerc = self.imagercEdit.value() bgmodel = ( (laserc + imagerc * imagerconcentration) * laserpower * integrationtime ) equationA = self.EquationAEdit.value() equationB = self.EquationBEdit.value() equationC = self.EquationCEdit.value() bgmodelstd = ( equationA * laserpower * integrationtime + equationB * bgmu + equationC ) # SET VALUES TO FIELDS AND CALL DEPENDENCIES self.psfEdit.setValue(psf) self.integrationtimeEdit.setValue(integrationtime) self.photonrateEdit.setValue(photonrate) self.photonratestdEdit.setValue(photonratestd) self.photonslopeEdit.setValue(photonrate / laserpower) self.photonslopeStdEdit.setValue( photonratestd / laserpower ) # SET NOISE AND FRAME self.BgoffsetEdit.setValue(bgmu - bgmodel) self.BgStdoffsetEdit.setValue(bgstd - bgmodelstd) self.imagerconcentrationEdit.setValue(imagerconcentration) self.laserpowerEdit.setValue(laserpower) class CalibrationDialog(QtWidgets.QDialog): def __init__(self, parent=None): super(CalibrationDialog, self).__init__(parent) layout = QtWidgets.QVBoxLayout(self) self.table = QtWidgets.QTableWidget() self.table.setWindowTitle("Noise Model Calibration") self.setWindowTitle("Noise Model Calibration") # self.resize(800, 400) layout.addWidget(self.table) # ADD BUTTONS: self.loadTifButton = QtWidgets.QPushButton("Load Tifs") layout.addWidget(self.loadTifButton) self.evalTifButton = QtWidgets.QPushButton("Evaluate Tifs") layout.addWidget(self.evalTifButton) self.pbar = QtWidgets.QProgressBar(self) layout.addWidget(self.pbar) self.loadTifButton.clicked.connect(self.loadTif) self.evalTifButton.clicked.connect(self.evalTif) self.buttons = QtWidgets.QDialogButtonBox( QtWidgets.QDialogButtonBox.ActionRole | QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel, self, ) layout.addWidget(self.buttons) self.buttons.accepted.connect(self.accept) self.buttons.rejected.connect(self.reject) def exportTable(self): table = dict() tablecontent = [] tablecontent.append( [ "FileName", "Imager concentration[nM]", "Integration time [ms]", "Laserpower", "Mean [Photons]", "Std [Photons]", ] ) for row in range(self.table.rowCount()): rowdata = [] for column in range(self.table.columnCount()): item = self.table.item(row, column) if item is not None: rowdata.append(item.text()) else: rowdata.append("") tablecontent.append(rowdata) table[0] = tablecontent path, ext = QtWidgets.QFileDialog.getSaveFileName( self, "Export calibration table to.", filter="*.csv" ) if path: self.savePlate(path, table) def savePlate(self, filename, data): with open(filename, "w", newline="") as csvfile: Writer = csv.writer( csvfile, delimiter=",", quotechar="|", quoting=csv.QUOTE_MINIMAL, ) for j in range(0, len(data)): exportdata = data[j] for i in range(0, len(exportdata)): Writer.writerow(exportdata[i]) def evalTif(self): baseline, ok1 = QtWidgets.QInputDialog.getText( self, "Input Dialog", "Enter Camera Baseline:" ) if ok1: baseline = int(baseline) else: baseline = 200 # default sensitvity, ok2 = QtWidgets.QInputDialog.getText( self, "Input Dialog", "Enter Camera Sensitivity:" ) if ok2: sensitvity = float(sensitvity) else: sensitvity = 1.47 counter = 0 for element in self.tifFiles: counter = counter + 1 self.pbar.setValue((counter - 1) / self.tifCounter * 100) print( "Current Dataset: " + str(counter) + " of " + str(self.tifCounter) ) QtWidgets.qApp.processEvents() movie, info = _io.load_movie(element) movie = movie[0:100, :, :] movie = (movie - baseline) * sensitvity self.table.setItem( counter - 1, 4, QtWidgets.QTableWidgetItem(str((_np.mean(movie)))) ) self.table.setItem( counter - 1, 5, QtWidgets.QTableWidgetItem(str((_np.std(movie)))) ) self.table.setItem( counter - 1, 1, QtWidgets.QTableWidgetItem(str((self.ValueFind(element, "nM_")))), ) self.table.setItem( counter - 1, 2, QtWidgets.QTableWidgetItem(str((self.ValueFind(element, "ms_")))), ) self.table.setItem( counter - 1, 3, QtWidgets.QTableWidgetItem(str((self.ValueFind(element, "mW_")))), ) self.pbar.setValue(100) def ValueFind(self, filename, unit): index = filename.index(unit) value = 0 for i in range(4): try: value += int(filename[index - 1 - i]) * (10 ** i) except ValueError: pass return value def loadTif(self): self.path = QtWidgets.QFileDialog.getExistingDirectory( self, "Select Directory" ) if self.path: self.tifCounter = len(_glob.glob1(self.path, "*.tif")) self.tifFiles = _glob.glob(os.path.join(self.path, "*.tif")) self.table.setRowCount(int(self.tifCounter)) self.table.setColumnCount(6) self.table.setHorizontalHeaderLabels( [ "FileName", "Imager concentration[nM]", "Integration time [ms]", "Laserpower", "Mean [Photons]", "Std [Photons]", ] ) for i in range(0, self.tifCounter): self.table.setItem( i, 0, QtWidgets.QTableWidgetItem(self.tifFiles[i]) ) def changeComb(self, indexval): sender = self.sender() comboval = sender.currentIndex() if comboval == 0: self.table.setItem(indexval, 2, QtWidgets.QTableWidgetItem("")) self.table.setItem(indexval, 3, QtWidgets.QTableWidgetItem("")) else: self.table.setItem( indexval, 2, QtWidgets.QTableWidgetItem(self.ImagersShort[comboval]), ) self.table.setItem( indexval, 3, QtWidgets.QTableWidgetItem(self.ImagersLong[comboval]) ) def readoutTable(self): tableshort = dict() tablelong = dict() maxcolor = 15 for i in range(0, maxcolor - 1): try: tableshort[i] = self.table.item(i, 2).text() if tableshort[i] == "": tableshort[i] = "None" except AttributeError: tableshort[i] = "None" try: tablelong[i] = self.table.item(i, 3).text() if tablelong[i] == "": tablelong[i] = "None" except AttributeError: tablelong[i] = "None" return tablelong, tableshort # get current date and time from the dialog def evalTable(self): conc = [] time = [] las = [] bg = [] bgstd = [] for i in range(0, self.tifCounter): conc.append(float(self.table.item(i, 1).text())) time.append(float(self.table.item(i, 2).text())) las.append(float(self.table.item(i, 3).text())) bg.append(float(self.table.item(i, 4).text())) bgstd.append(float(self.table.item(i, 5).text())) # self.exportTable() return bg, bgstd, las, time, conc # static method to create the dialog and return (date, time, accepted) @staticmethod def setExt(parent=None): dialog = CalibrationDialog(parent) result = dialog.exec_() bg, bgstd, las, time, conc = dialog.evalTable() return (bg, bgstd, las, time, conc, result == QtWidgets.QDialog.Accepted) def main(): app = QtWidgets.QApplication(sys.argv) window = Window() window.show() sys.exit(app.exec_()) def excepthook(type, value, tback): lib.cancel_dialogs() message = "".join(tback.format_exception(type, value, tback)) errorbox = QtWidgets.QMessageBox.critical( window, "An error occured", message ) errorbox.exec_() sys.__excepthook__(type, value, tback) sys.excepthook = excepthook if __name__ == "__main__": main()#
redis-pool ========== Golang redis pool implementation for gosexy/redis
const fs = require('fs'); if (fs.existsSync('./.gulprc')) { // eslint-disable-next-line import/no-unresolved Object.assign(exports, require('../.gulprc')); }
//! Itegration tests for all of the REST API. //! Very primitive approach. use rand::Rng; use ucare::{self, conversion, file, group, project, webhook}; mod testenv; fn rest_client_version(version: ucare::RestApiVersion) -> ucare::RestClient { let config = ucare::RestConfig { sign_based_auth: true, api_version: version, }; ucare::RestClient::new(config, testenv::api_creds()).unwrap() } fn rest_client_v05() -> ucare::RestClient { rest_client_version(ucare::RestApiVersion::V05) } fn rest_client_v06() -> ucare::RestClient { rest_client_version(ucare::RestApiVersion::V06) } #[test] fn file() { let client = rest_client_v05(); let file_svc = file::new_svc(&client); let limit = 13; let params = file::ListParams { removed: Some(false), stored: Some(false), limit: Some(3), ordering: Some(file::Ordering::Size), from: None, }; // file list let list = file_svc.list(params).unwrap(); let mut next_page = list.next; let mut files = list.results.unwrap(); while let Some(next) = next_page { let new_page = file_svc.get_page(&next).unwrap(); next_page = new_page.next; files.extend(new_page.results.unwrap()); if files.len() >= limit as usize { break; } } assert!(files.len() >= limit as usize); // file info let first_file = files.pop().unwrap(); let file = file_svc.info(&first_file.uuid).unwrap(); assert_eq!(file.uuid, first_file.uuid); // file store let info = file_svc.store(&file.uuid).unwrap(); assert_ne!(info.datetime_stored, None); // batch store let batch_info = file_svc.batch_store(&[&files.pop().unwrap().uuid]).unwrap(); assert_ne!( batch_info.result.unwrap().pop().unwrap().datetime_stored, None ); // file copy let params = file::CopyParams { source: file.uuid.to_string(), store: None, make_public: Some(file::MakePublic::True), target: None, pattern: None, }; let copy_info = file_svc.copy(params).unwrap(); assert_eq!(copy_info.result.original_filename, file.original_filename); // file delete let deleted = file_svc.delete(&file.uuid).unwrap(); assert_ne!(deleted.datetime_removed, None); } #[test] fn group() { let client = rest_client_v06(); let group_svc = group::new_svc(&client); let limit = 3; // group list let params = group::ListParams { limit: Some(1), ordering: Some(group::Ordering::CreatedAtDesc), from: None, }; let list = group_svc.list(params).unwrap(); let mut next_page = list.next; let mut groups = list.results.unwrap(); while let Some(next) = next_page { let new_page = group_svc.get_page(&next).unwrap(); next_page = new_page.next; groups.extend(new_page.results.unwrap()); if groups.len() >= limit as usize { break; } } assert!(groups.len() >= limit as usize); // group info let first_group = groups.pop().unwrap(); let group = group_svc.info(&first_group.id).unwrap(); assert_eq!(group.id, first_group.id); } #[test] fn conversion() { let client = rest_client_v06(); let file_svc = file::new_svc(&client); let conv_svc = conversion::new_svc(&client); let params = file::ListParams { removed: Some(false), stored: Some(false), limit: Some(1), ordering: Some(file::Ordering::Size), from: None, }; let list = file_svc.list(params).unwrap(); // convert file let params = conversion::JobParams { paths: vec![list.results.unwrap().pop().unwrap().uuid + "/document/-/format/pdf/"], store: Some(conversion::ToStore::False), }; let job_result = conv_svc.document(params).unwrap(); if let Some(mut jobs) = job_result.result { if let Some(job) = jobs.pop() { let token = job.token.unwrap(); let status = conv_svc.document_status(token).unwrap(); assert_eq!(status.error, None); } } } #[test] fn webhook() { let sign_secret = "test_signing_secret"; let new_sign_secret = "new_signing_secret"; let client = rest_client_v06(); let webhook_svc = webhook::new_svc(&client); // list let list = webhook_svc.list().unwrap(); assert!(list.len() > 0); assert_ne!(list.get(0).unwrap().id, 0); // create let mut rng = rand::thread_rng(); let suff: u8 = rng.gen(); let target_url = format!("https://localhost:8080/test_endpoint{}", suff); let create_params = webhook::CreateParams { event: webhook::Event::FileUploaded, target_url: target_url.clone(), signing_secret: Some(sign_secret.to_string()), is_active: None, }; let hook = webhook_svc.create(create_params).unwrap(); assert!(hook.is_active); assert!(hook.created.len() > 0); assert!(hook.updated.len() > 0); assert_eq!(hook.signing_secret, sign_secret); // update let update_params = webhook::UpdateParams { id: hook.id, event: None, target_url: None, signing_secret: Some(new_sign_secret.to_string()), is_active: Some(false), }; let hook = webhook_svc.update(update_params).unwrap(); assert!(!hook.is_active); assert_eq!(hook.signing_secret, new_sign_secret); // delete let delete_params = webhook::DeleteParams { target_url }; let res = webhook_svc.delete(delete_params).unwrap(); assert_eq!(res, ()); } #[test] fn project() { let client = rest_client_v06(); let project_svc = project::new_svc(&client); // info let info = project_svc.info().unwrap(); assert_ne!(info.name, "".to_string()); assert_ne!(info.pub_key, "".to_string()); }
#ifndef FINDER_LINEAR_HPP #define FINDER_LINEAR_HPP #include <assert.h> #include <iomanip> #include <iostream> #include <unordered_set> #include <vector> #include "../config.hpp" namespace Finder { template<typename Graph> class Linear { public: using subgraph_t = std::array<VertexID, 4>; static constexpr char const *name = "Linear"; static constexpr size_t length = 4; public: bool is_quasi_threshold(Graph const &graph, subgraph_t& certificate) { VertexID n = graph.size(); std::vector<VertexID> sortedNodes(n); // counting sort by degree in decreasing order { std::vector<VertexID> nodePos(n + 1, 0); std::vector<VertexID> key(n); for (VertexID u = 0; u < n; ++u) { key[u] = n - graph.degree(u); ++nodePos[key[u]]; } // exclusive prefix sum VertexID tmp = nodePos[0]; VertexID sum = tmp; nodePos[0] = 0; for (VertexID i = 1; i < nodePos.size(); ++i) { tmp = nodePos[i]; nodePos[i] = sum; sum += tmp; } for (VertexID u = 0; u < n; ++u) { sortedNodes[nodePos[key[u]]++] = u; } assert(std::is_sorted(sortedNodes.begin(), sortedNodes.end(), [&](VertexID u, VertexID v) { return graph.degree(u) > graph.degree(v); })); } std::vector<VertexID> parent(n, n); std::vector<bool> processed(n, false); for (VertexID u : sortedNodes) { processed[u] = true; bool found_problem = graph.for_neighbours(u, [&](VertexID v) { // node v has already been removed if (processed[v]) return false; if (parent[v] == parent[u]) { parent[v] = u; return false; } else { if (parent[u] == n || graph.has_edge(parent[u], v)) { certificate[1] = parent[v]; certificate[2] = v; certificate[3] = u; assert(certificate[1] != certificate[3]); } else { certificate[1] = parent[u]; certificate[2] = u; certificate[3] = v; assert(certificate[1] != certificate[3]); } graph.for_neighbours(certificate[1], [&](VertexID z) { if (z != certificate[2] && !graph.has_edge(z, certificate[2])) { certificate[0] = z; return true; } return false; }); return true; } }); if (found_problem) { return false; } } return true; } }; } #endif
import StyledFirebaseAuth from "react-firebaseui/StyledFirebaseAuth"; import firebase from "../firebase/firebase-config"; import { uiConfig } from "../firebase/firebaseui-config"; interface Props { redirect?: string; } export const Auth = ({ redirect = "/" }: Props) => { return ( <div className="border-2 rounded-xl p-4 shadow-lg flex flex-col items-center justify-center"> <h1 className="text-lg">Login</h1> <StyledFirebaseAuth uiConfig={{ ...uiConfig, signInSuccessUrl: redirect }} firebaseAuth={firebase.auth()} /> </div> ); };
set -xeEo pipefail source CI/tests/common.sh trap error ERR trap finish EXIT function funtional_test_pod_deletion { export scenario_type="pod_scenarios" export scenario_file="- CI/scenarios/hello_pod_killing.yml" export post_config="" envsubst < CI/config/common_test_config.yaml > CI/config/pod_config.yaml python3 run_kraken.py -c CI/config/pod_config.yaml echo $? echo "Pod scenario test: Success" } funtional_test_pod_deletion
package it.unibo.intelliserrademo.gui.util import it.unibo.intelliserra.core.action.Action import it.unibo.intelliserra.core.perception.Measure import it.unibo.intelliserra.core.state.State object StatePrintify { private[gui] def statePrintify(state: State): String = { perceptionsPrintify(state.perceptions) + " -> " + activeActionsPrintify(state.activeActions) + "\n __________________________" } private def perceptionsPrintify(perceptions: List[Measure]): String = { "(" + perceptions.map(perception => perception.category + ": " + perception.value).mkString(",") + ")" } private def activeActionsPrintify(activeActions: List[Action]): String = { "(" + activeActions.mkString(",") + ")" } }
const r = require('@lib/test-utils/r'); const files = require('@dal/files')(r); const tutil = require('@lib/test-utils')(r); const dirUtils = require('@dal/dir-utils')(r); describe('Test moveFileToDirectory', () => { let project, dir1, dir11, file1, file1Child; beforeAll(async() => { project = await tutil.createTestProject(); [dir1, dir11] = await dirUtils.createDirsFromParent('dir1/dir11', project.root_dir.id, project.id); file1 = await tutil.createFile('file1.txt', dir1.id, project.id); file1Child = await tutil.createFile('file1.txt', dir1.id, project.id); await r.table('datafiles').get(file1Child.id).update({parent: file1.id}); }); afterAll(async() => { await tutil.deleteProject(project.id); }); test('it should throw an error if file directory does not exist', async() => { await expect(files.moveFileToDirectory(file1.id, 'does-not-exist', dir11.id)).rejects.toThrow(); }); test('it should throw an error if file does not exist', async() => { await expect(files.moveFileToDirectory('does-not-exist', dir1.id, dir11.id)).rejects.toThrow(); }); test('it should move the file and all versions', async() => { let file = await files.moveFileToDirectory(file1.id, dir1.id, dir11.id); expect(file.directory.id).toBe(dir11.id); let file1dir = await r.table('datadir2datafile').getAll(file1.id, {index: 'datafile_id'}).nth(0); let file1Childdir = await r.table('datadir2datafile').getAll(file1Child.id, {index: 'datafile_id'}).nth(0); expect(file1dir.datadir_id).toBe(dir11.id); expect(file1Childdir.datadir_id).toBe(dir11.id); }); }); describe('Test renameFile', () => { let project, file1, file1Child; beforeAll(async() => { project = await tutil.createTestProject(); [dir1, dir11] = await dirUtils.createDirsFromParent('dir1/dir11', project.root_dir.id, project.id); file1 = await tutil.createFile('file1.txt', dir1.id, project.id); file1Child = await tutil.createFile('file1.txt', dir1.id, project.id); await r.table('datafiles').get(file1Child.id).update({parent: file1.id}); }); afterAll(async() => { await tutil.deleteProject(project.id); }); test('it should rename the file and its different versions', async() => { let status = await files.renameFile(file1.id, 'file1-renamed.txt'); expect(status).toBeTruthy(); let f1 = await r.table('datafiles').get(file1.id); let f1Child = await r.table('datafiles').get(file1Child.id); expect(f1.name).toBe('file1-renamed.txt'); expect(f1Child.name).toBe('file1-renamed.txt'); }); });
:- use_module(dispatch). pengine(Goal, Pid) :- self(Self), spawn(query(Goal, Pid, Self), Pid, [ monitor(true), src_predicates([query/3]) ]). query(Goal, Self, Parent) :- call_cleanup(Goal, Det=true), ( var(Det) -> Parent ! success(Self, Goal, true), receive({ next -> fail; stop -> Parent ! stop(Self) }) ; Parent ! success(Self, Goal, false) ).
using EPiServer; using EPiServer.Core; using EPiServer.Core.Transfer.Internal; using EPiServer.DataAbstraction; using EPiServer.Framework.Cache; namespace ExportImportWithVersion.DataExporter { public class DefaultRawContentRetrieverInterceptor : DefaultRawContentRetriever, IRawContentRetrieverEx { private IRawContentRetriever defaultRawContentRetriever; private IContentRepository contentRepository; private IContentTypeRepository contentTypeRepository; private ILanguageBranchRepository languageBranchRepository; private IContentCacheKeyCreator contentCacheKeyCreator; private ISynchronizedObjectInstanceCache synchronizedObjectInstanceCache; private IRawPropertyRetriever rawPropertyRetriever; public DefaultRawContentRetrieverInterceptor(IRawContentRetriever defaultRawContentRetriever , IContentRepository contentRepository , IContentTypeRepository contentTypeRepository , ILanguageBranchRepository languageBranchRepository , IContentCacheKeyCreator contentCacheKeyCreator , ISynchronizedObjectInstanceCache synchronizedObjectInstanceCache , IRawPropertyRetriever rawPropertyRetriever) : base(contentRepository, contentTypeRepository, languageBranchRepository , contentCacheKeyCreator, synchronizedObjectInstanceCache, rawPropertyRetriever) { this.defaultRawContentRetriever = defaultRawContentRetriever; this.contentRepository = contentRepository; this.contentTypeRepository = contentTypeRepository; this.languageBranchRepository = languageBranchRepository; this.contentCacheKeyCreator = contentCacheKeyCreator; this.synchronizedObjectInstanceCache = synchronizedObjectInstanceCache; this.rawPropertyRetriever = rawPropertyRetriever; } } }
module ActiveRecord module ConnectionAdapters class JdbcAdapter def supports_views? true end def nonview_tables(name = nil) tables end def views(name = nil) select_values(delegate.list_views_statement, name) end private def delegate return @delegate if @delegate if ActiveRecord::Base.configurations[Rails.env]["driver"] =~ /jtds/ @delegate = SQLServerAdapter.new(nil, nil) else raise "Views only implemented for MSSQL. Implement for other adapters. PLEASE!" end end end end end
#!/bin/bash ../../../germanium main.go -o default-gen.png
(ns moclojer.router (:require [moclojer.openapi :as openapi] [clojure.edn :as edn] [yaml.core :as yaml] [clojure.string :as str] [moclojer.handler :as handler])) (defn edn-router "Receive spec edn config Example: {::config {:ednpoints [{:endpoint {...}}, {:endpoint {...}}] :type :edn}} Then get the endpoints collection and returns an Pedestal route" [{{config :endpoints} ::config}] (handler/generate-pedestal-edn-route config)) (defn router "Receive config .yaml and return pedestal Router" [{::keys [config]}] (if (= (get config "openapi") "3.0.0") (openapi/generate-pedestal-route config) (handler/generate-pedestal-route config))) (defn make-edn-specs "Receive the name of edn config and return a map with endpoints declaration and type edn Example: (make-edn-specs moclojure.edn) => {:ednpoints [{:endpoint {...}}, {:endpoint {...}}] :type :edn} " [config] {:endpoints (edn/read-string (format "[%s]" (slurp config))) :type :edn}) (defn parse "It gets the config from envrioment and returns specs" [] (let [config (or (System/getenv "CONFIG") "moclojer.yml") mocks (yaml/from-file (or (System/getenv "MOCKS") "mocks.yml"))] (if (str/includes? config ".edn") (make-edn-specs config) (-> config (yaml/from-file) (openapi/with-mocks mocks))))) (defn smart-router "Receive a specs and return pedestal route" [specs] (if (= (:type specs) :edn) (edn-router {::config specs}) (router {::config specs}))) (defn make-smart-router "Returns a pedestal routes" [] (smart-router (parse)))
module Rubex module DataType class UInt64 include UIntHelpers def to_s 'uint64_t' end def to_ruby_object(arg) "ULONG2NUM(#{arg})" end def from_ruby_object(arg) "(int64_t)NUM2UINT(#{arg})" end def uint64? true end def p_formatter '%lu' end end end end
<?php namespace App\Http\Requests\Arsip\PM; use Carbon\Carbon; use Illuminate\Foundation\Http\FormRequest; class TambahAdministrasiDesaRequest extends FormRequest { /** * Get the validation rules that apply to the request. * * @return array */ public function rules() { $tahun = Carbon::now()->format('Y'); return [ 'id_desa' => 'required|exists:desa,id', 'nama' => 'nullable|string|max:255', 'tahun' => 'required|date_format:Y|numeric|max:' . $tahun, 'peruntukan' => 'nullable|string|max:255', 'file' => 'required|mimes:pdf', ]; } public function messages() { return [ 'id_desa.required' => 'Desa perlu diisi.', 'id_desa.integer' => 'Format desa salah.', 'id_desa.exists' => 'Desa tidak ditemukan.', 'nama.required' => 'Nama file administrasi desa perlu diisi.', 'nama.numeric' => 'Format nama file administrasi desa salah.', 'nama.max' => 'Maksimal karakter nama file administrasi desa :max.', 'tahun.required' => 'Tahun file administrasi desa perlu diisi.', 'tahun.date_format' => 'Format input tahun file administrasi desa tidak sesuai.', 'tahun.numeric' => 'Format tahun file administrasi desa salah.', 'tahun.max' => 'Maksimal tahun file administrasi desa :max.', 'peruntukan.required' => 'Peruntukan file administrasi desa perlu diisi.', 'peruntukan.numeric' => 'Format peruntukan file administrasi desa salah.', 'peruntukan.max' => 'Maksimal karakter peruntukan file administrasi desa :max.', 'file.required' => 'File administrasi desa harus ada.', 'file.mimes' => 'Format file administrasi desa yg disarankan : .pdf', ]; } }
#!/bin/bash if [ $# -gt 0 ]; then mode=mainnet fi echo -n " [+] CREATING >>" echo -n $mode | tr '[:lower:]' '[:upper:]' echo "<< PACKAGE" rm -rf package/libs/*.jar package/nis/*.jar cp -r ../nis/target/libs/*.jar package/libs rm package/libs/nem-* cp -r ../nis/target/libs/nem-*.jar package/nis cp -r ../nis/target/nem-*.jar package/nis cd package/nis sed -i "s/nem.network = .*/nem.network = $mode\r/" config.properties cd ../..
require 'paylocity_web_service/connection' require 'paylocity_web_service/authentication' require 'paylocity_web_service/configuration' require 'paylocity_web_service/error' require 'paylocity_web_service/client/companies' require 'paylocity_web_service/client/employees' require 'paylocity_web_service/client/credentials' require 'paylocity_web_service/client/onboardings' module PaylocityWebService class Client include PaylocityWebService::Authentication include PaylocityWebService::Configuration include PaylocityWebService::Connection include PaylocityWebService::Encryption include PaylocityWebService::Client::Employees include PaylocityWebService::Client::Companies include PaylocityWebService::Client::Credentials include PaylocityWebService::Client::Onboardings def initialize(options={}) options = PaylocityWebService.options.merge(options) Configuration::VALID_OPTIONS_KEYS.each do |key| send("#{key}=", options[key]) end end end end
using Ardalis.GuardClauses; using System; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Runtime.ExceptionServices; using System.Runtime.InteropServices; using KeepAChangelogParser.Wpf.SampleApp.Contracts.ReleaseNotesWindow; namespace KeepAChangelogParser.Wpf.SampleApp.Commands.ReleaseNotesWindow { public class ReleaseNotesWindowClickHyperlinkCommand : IReleaseNotesWindowClickHyperlinkCommand { public void ExecuteClick( object? param ) { Guard.Against.Null(param, nameof(param)); string? url = param.ToString(); Guard.Against.NullOrEmpty(url, nameof(url)); openUrl(url); } private static void openUrl( string url ) { try { Process.Start(url); } catch (Exception exception) when ( exception is Win32Exception || exception is ObjectDisposedException || exception is FileNotFoundException ) { // Hack because of this: https://github.com/dotnet/corefx/issues/10361 if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { url = url.Replace( "&", "^&", StringComparison.Ordinal); Process.Start( new ProcessStartInfo( "cmd", $"/c start {url}") { CreateNoWindow = true }); } else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { Process.Start( "xdg-open", url); } else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { Process.Start( "open", url); } else { ExceptionDispatchInfo.Throw( exception); } } } } }
package abi45_0_0.expo.modules.storereview import android.content.Context import abi45_0_0.expo.modules.core.BasePackage class StoreReviewPackage : BasePackage() { override fun createExportedModules(context: Context) = listOf(StoreReviewModule(context)) }
import { Component, OnInit } from '@angular/core'; import { Router } from '@angular/router'; import { UserLoginOptions } from '../../interfaces/user-options'; import { AngularFireAuth } from '@angular/fire/auth'; import { auth } from 'firebase/app'; import { UserData } from '../../providers/user-data'; import { AlertController } from '@ionic/angular'; import { AngularFirestore } from '@angular/fire/firestore'; import { format } from 'url'; import { NgForm } from '@angular/forms'; @Component({ selector: 'page-login', templateUrl: 'login.html', styleUrls: ['./login.scss'], }) export class LoginPage implements OnInit { login: UserLoginOptions = { email: '', password: '' }; submitted = false; constructor( public router: Router, public afAuth: AngularFireAuth, public userData: UserData, public alertController: AlertController, private afStore: AngularFirestore ) { } ngOnInit() { } async presentAlert(title: string, content: string) { const alert = await this.alertController.create({ header: title, message: content, buttons: ['OK'] }); await alert.present(); } async onLogin(form: NgForm) { this.submitted = true; if (form.value) { this.userData.login(this.login.email); } try { // authenticate user and retrieve result const res = await this.afAuth.auth.signInWithEmailAndPassword(this.login.email, this.login.password); console.log('Login success!'); console.log(res.user.uid); // go to space page after logging in await this.router.navigate(['/app/tabs/space'], { state: { userid: res.user.uid } }); } catch (err) { if (err.code === 'auth/user-not-found') { this.presentAlert('User not found', 'Please sign up for an account first.'); } else if (err.code === 'auth/wrong-password') { this.presentAlert('Incorrect password', 'Please try again.'); } else { console.dir(err); this.presentAlert('Unsolved error', 'Please contact admin for help'); } } } onSignup() { this.router.navigateByUrl('/signup'); } }
<?php namespace App\Repositories; use App\Interfaces\Repositories\WalletRepositoryInterface; use App\Models\Wallet; use Illuminate\Support\Facades\DB; class WalletRepository extends BaseEloquentRepository implements WalletRepositoryInterface { public function __construct(Wallet $wallet) { parent::__construct($wallet); } /** * Increments the balance of a wallet * * @param Wallet $wallet * @param double|float|int $amount * @return void */ public function incrementBalance(Wallet $wallet, $amount): void { Db::transaction(function () use ($wallet, $amount) { $wallet->increment('balance', $amount); }); } /** * Decrements the balance of a wallet * * @param Wallet $wallet * @param double|float|int $amount * @return void */ public function decrementBalance(Wallet $wallet, $amount): void { DB::transaction(function () use ($wallet, $amount) { $wallet->decrement('balance', $amount); }); } }
package models import ( "fmt" "strings" ) type Expression struct { field string symbol string value interface{} } func BinaryExpression(field, symbol string, value interface{}) Expression { switch strings.ToUpper(symbol) { case "LIKE": return LIKE(field, value) case "LLIKE": return LLIKE(field, value) case "RLIKE": return RLIKE(field, value) case "EQ": return EQ(field, value) case "NE": return NE(field, value) case "IN": return IN(field, value) case "GT": return GT(field, value) case "GE": return GE(field, value) case "LT": return LT(field, value) case "LE": return LE(field, value) } return NONE(field, value) } func (exp Expression) Statment() (format string, data interface{}) { format = fmt.Sprintf("%s %s ?", exp.field, exp.symbol) data = exp.value return } func NONE(field string, value interface{}) Expression { return Expression{ field: "", symbol: "", value: "", } } func LIKE(field string, value interface{}) Expression { return Expression{ field: field, symbol: "LIKE", value: fmt.Sprintf("%%%s%%", value), } } func LLIKE(field string, value interface{}) Expression { return Expression{ field: field, symbol: "LIKE", value: fmt.Sprintf("%%%s", value), } } func RLIKE(field string, value interface{}) Expression { return Expression{ field: field, symbol: "LIKE", value: fmt.Sprintf("%s%%", value), } } func EQ(field string, value interface{}) Expression { return Expression{ field: field, symbol: "=", value: value, } } func NE(field string, value interface{}) Expression { return Expression{ field: field, symbol: "!=", value: value, } } func IN(field string, value interface{}) Expression { return Expression{ field: field, symbol: "IN", value: value, } } func GT(field string, value interface{}) Expression { return Expression{ field: field, symbol: ">", value: value, } } func GE(field string, value interface{}) Expression { return Expression{ field: field, symbol: ">=", value: value, } } func LT(field string, value interface{}) Expression { return Expression{ field: field, symbol: "<", value: value, } } func LE(field string, value interface{}) Expression { return Expression{ field: field, symbol: "<=", value: value, } }
package org.koin.core import org.junit.Test import org.koin.dsl.koinApplication import org.koin.dsl.module import java.util.* import kotlin.test.assertEquals import kotlin.test.assertNotEquals class DeclareInstanceJVMTest { class MyScope class MyScopedData(var name: String) private val module = module { scope<MyScope> { scoped { MyScopedData("") } } } @Test fun `should resolve different scoped declared definitions`() { val koin: Koin = koinApplication { modules(module) }.koin // Create two scopes val scopeA = koin.createScope<MyScope>(UUID.randomUUID().toString(), MyScope()) val scopeB = koin.createScope<MyScope>(UUID.randomUUID().toString(), MyScope()) // Declare scope data on each scope val value_A = "A" scopeA.declare(MyScopedData(value_A)) val value_B = "B" scopeB.declare(MyScopedData(value_B)) // Get scope of each data assertNotEquals(scopeA.get<MyScopedData>().name, scopeB.get<MyScopedData>().name) } @Test fun `should resolve root declared definitions`() { val koin: Koin = koinApplication { modules(module) }.koin // Declare scope data on each scope val value_A = "A" koin.declare(MyScopedData(value_A)) val value_B = "B" koin.declare(MyScopedData(value_B)) // Get scope of each data assertEquals(koin.get<MyScopedData>().name, koin.get<MyScopedData>().name) } }
// // SKFNoDownLoadView.h // SKFDownLoadListern // // Created by 孙凯峰 on 2017/4/1. // Copyright © 2017年 孙凯峰. All rights reserved. // #import <UIKit/UIKit.h> @interface SKFNoDownLoadView : UIView + (instancetype)noDownLoadView; @property (nonatomic, strong) UIImage *noDataImg; @property(nonatomic,copy) void(^clickBlock)(); @end
Name: mn_hp_mr3ascr.asm Type: file Size: 26054 Last-Modified: '1993-08-25T07:18:46Z' SHA-1: 43DFA2924BD36EEED0DA82608865DA69CBE77294 Description: null
enum class Move { WHITE_CLOCKWISE { override fun toString(): String { return "W1" } }, RED_CLOCKWISE { override fun toString(): String { return "R1" } }, BLUE_CLOCKWISE { override fun toString(): String { return "B1" } }, ORANGE_CLOCKWISE { override fun toString(): String { return "O1" } }, GREEN_CLOCKWISE { override fun toString(): String { return "G1" } }, YELLOW_CLOCKWISE { override fun toString(): String { return "Y1" } }, WHITE_COUNTER_CLOCKWISE { override fun toString(): String { return "W3" } }, RED_COUNTER_CLOCKWISE { override fun toString(): String { return "R3" } }, BLUE_COUNTER_CLOCKWISE { override fun toString(): String { return "B3" } }, ORANGE_COUNTER_CLOCKWISE { override fun toString(): String { return "O3" } }, GREEN_COUNTER_CLOCKWISE { override fun toString(): String { return "G3" } }, YELLOW_COUNTER_CLOCKWISE { override fun toString(): String { return "Y3" } } }
using UnityEngine; using System.Collections; using System.Collections.Generic; using System; using Framework.Core.FlowControl; namespace Assets.Project { public class CableNode { public CableNode Last; public CableNode Next; //前帧/本帧的位置 public Vector3 prePos, curPos; } public class cable : MonoBehaviour { //本身的碰撞体大小 public float radius = 0.05f; public float card = 0.05f; public float time = 0.5f; //拖拉力 public Vector3 dragForce = Physics.gravity; //自己的刚性,如0.001布 10石头,由boneAxis方向 //检查碰撞 //private List<CableNode> nodes = new List<CableNode>(); private CableNode nodes = null; void Start() { var tran = this.transform; nodes = new CableNode(); nodes.Last = null; nodes.curPos = nodes.prePos = tran.position; CableNode next = nodes; while(tran.childCount > 0) { var child = tran.GetChild(0); var newNode = new CableNode(); newNode.curPos = newNode.prePos = child.transform.position; newNode.Last = next; newNode.Next = null; next.Next = newNode; tran = child; next = next.Next; } d = new Delay(time); d.OnExit += () => { OnLateUpdate(); Debug.Log("delay ...."); }; } Delay d = null; // 更新用户自己设置的力 void Update() { } public void LateUpdate() { d.Execute(); } public void OnLateUpdate() { //foreach (var node in nodes) var node = nodes; while (node != null) { #region 参考下面项目与链接 Verlet数值积分 //参考项目unitychan-crs-master //http://www.cnblogs.com/miloyip/archive/2011/06/14/alice_madness_returns_hair.html //https://www.zhihu.com/question/22531466 //简单阻尼效果的Verlet数值积分 x(t+T)=x(t)+d*(x(t)-x(t-T))+a(t)*T^2 //T-时间增量 x(t)-t时间位置 a(t)-t时间加速度(force/mass) //新的现在位置 与 旧的现在位置 与旧的上一桢位置 关系 //temp 旧的现在位置 Vector3 temp = node.curPos; //verlet计算结果 新的现在位置 x(t+T)=x(t)+d*(x(t)-x(t-T))+a(t)*T^2 node.curPos = (node.curPos - node.prePos) + node.curPos + (dragForce * Time.deltaTime * Time.deltaTime); //新位置保持与父节点的长度一样 if (node.Last != null) { var last = node.Last; var distance = (node.curPos - last.curPos); if (distance.magnitude > card) { node.curPos = distance.normalized * card + last.curPos; } } else { node.curPos = temp; } node.prePos = temp; #endregion node = node.Next; } } private void OnDrawGizmos() { if(true) { Gizmos.color = Color.yellow; var node = nodes; while(node != null) { Gizmos.DrawWireSphere(node.curPos, radius); node = node.Next; } } } } }
SECTION .data ; Section containing initialized data EatMsg: db 'Hello, world', 0x0A EatLen: equ $-EatMsg SECTION .bss ; Section containing uninitialized data SECTION .text ; Section containing code global main ; Linker needs this to find the entry point! main: nopi ; This no-op keeps gdb happy (see text) mov ebx, 4 ; Specify sys_write syscall mov ebx, 1 ; Specify File Descriptor 1: stdout mov ecx, EatMsg ; Pass offset of the msg mov edx, EatLen ; Pass the length of msg int 80H ; Make syscall to output msg to stdout mov eax, 1 ; Specify Exit syscall mov ebx, 0 ; return 0 {success) int 80H ; Make syscall tot erminate program
namespace Altinn.App.Services.Constants { /// <summary> /// app token /// </summary> public static class General { /// <summary> /// app token name /// </summary> public const string AppTokenName = "AltinnToken"; /// <summary> /// The name of the authorization token /// </summary> public const string AuthorizationTokenHeaderName = "Authorization"; /// <summary> /// The name of the cookie used for asp authentication in runtime application /// </summary> public const string RuntimeCookieName = "AltinnStudioRuntime"; /// <summary> /// The name of the cookie used for asp authentication in designer application /// </summary> public const string DesignerCookieName = "AltinnStudioDesigner"; /// <summary> /// Header key for API management subscription key /// </summary> public const string SubscriptionKeyHeaderName = "Ocp-Apim-Subscription-Key"; /// <summary> /// Header key for access token for eFormidling Integration Point /// </summary> public const string EFormidlingAccessTokenHeaderName = "AltinnIntegrationPointToken"; } }
import React, { PureComponent } from 'react' import isUrl from 'is-url-superb' import Input from '../../../components/atoms/Form/Input' import Button from '../../../components/atoms/Button' import styles from './ItemForm.module.scss' interface ItemFormProps { addFile(url: string): void placeholder: string } interface ItemFormStates { url: string hasError: boolean noUrl: boolean imageTooSmall: boolean } export default class ItemForm extends PureComponent< ItemFormProps, ItemFormStates > { public state: ItemFormStates = { url: '', hasError: false, noUrl: false, imageTooSmall: false } private handleSubmit = (e: Event) => { e.preventDefault() const { url } = this.state // return when required fields are empty, and url value is no url // Can't use browser validation cause we are in a form within a form if (!url) { this.setState({ hasError: true }) return } // Filecoin if (url.includes('cid://')) { this.props.addFile(url) return } if (url && !url.includes('ipfs://') && !isUrl(url)) { this.setState({ noUrl: true }) return } const image = new Image() image.addEventListener('load', async () => { let fileType // fetching the image twice isn't ideal but can't find a better way right now await fetch(url).then(res => res.blob()).then(blob => { fileType = blob.type }) if (image.width < 2048 && fileType !== 'image/gif') { this.setState({ imageTooSmall: true }) } else { this.props.addFile(url) } }) image.src = url } private onChangeUrl = (e: React.FormEvent<HTMLInputElement>) => { this.setState({ url: e.currentTarget.value }) this.clearErrors() } private clearErrors() { if (this.state.hasError) this.setState({ hasError: false }) if (this.state.noUrl) this.setState({ noUrl: false }) } public render() { const { url, hasError, noUrl, imageTooSmall } = this.state return ( <div className={styles.itemForm}> <Input label="Url" name="url" required type="url" placeholder={this.props.placeholder} value={url} onChange={this.onChangeUrl} help="Supported protocols are http(s)://, ipfs:// and cid://" /> <Button onClick={(e: Event) => this.handleSubmit(e)}> Add File </Button> {hasError && ( <span className={styles.error}> Please fill in all required fields. </span> )} {noUrl && ( <span className={styles.error}> Please enter a valid URL. </span> )} {imageTooSmall && ( <span className={styles.error}> The width of the picture has to be bigger than 2048 pixels. </span> )} </div> ) } }
using System.ComponentModel.DataAnnotations; namespace Singl.Models { public enum TipoCurso { Bacharelado, Licenciatura, Mestrado, Doutorado, [Display(Name="Especialização")] Especializacao } }
require "rails_helper" RSpec.describe ProjectsController, type: :controller do render_views let!(:project) { FactoryBot.create(:project, status: nil) } let!(:archived_project) { FactoryBot.create(:project, status: "archived") } before do @request.env["devise.mapping"] = Devise.mappings[:user] user = FactoryBot.create(:user) sign_in user end describe "#index without archived params" do before do get :index end it "shows me a list of all the projects" do expect(assigns(:projects)).to eq [project] end end describe "#index with archived params" do before do get :index, params: {archived: true} end it "shows me a list of all the archived projects" do expect(assigns(:projects)).to eq [archived_project] end end describe "#new" do it "redirects to the new page" do get :new expect(response).to render_template :new end end describe "#new_sub_project" do before do get :new_sub_project, params: {project_id: project.id} end it { expect(response).to render_template :new_sub_project } end describe "#edit" do before do get :edit, params: {id: project.id} end it "redirects to the edit page" do expect(response).to render_template :edit end it "shows the fields for the project" do expect(assigns(:project)).to eq project end end describe "#create" do context "with valid attributes" do let(:valid_params) { FactoryBot.attributes_for(:project) } it "creates a new project" do expect { post :create, params: {project: valid_params} }.to change(Project, :count).by(1) end it "redirects to the new project" do post :create, params: {project: valid_params} expect(response).to redirect_to "/projects" end end context "with invalid attributes" do let(:invalid_attributes) { {title: ""} } before do post :create, params: {project: invalid_attributes} end it "stays on the new template page" do expect(response).to redirect_to "projects/new" end it "shows a flash message" do expect(flash[:error]).to be_present end end context "with parent id and no title" do let(:parent_project) { {title: "parent", id: 1} } let(:child_project) { {title: ""} } let(:back_path) { project_new_sub_project_path(project_id: parent_project[:id]) } before do request.env["HTTP_REFERER"] = back_path post :create, params: {project: child_project} end it "stays on the new template page" do expect(response).to redirect_to back_path end it "shows a flash message" do expect(flash[:error]).to be_present end end end describe "#destroy" do it "deletes the project" do expect { delete :destroy, params: {id: project.id} }.to change(Project, :count).by(-1) end end describe "#show" do before do get :show, params: {id: project.id} end it "redirects to the show page" do expect(response).to render_template :show end it "shows the attributes for the right project" do expect(assigns(:project)).to eq project end end describe "#update" do it "should update the project" do put :update, params: {id: project.id, project: {title: "New Project Title"}} expect(project.reload.title).to eq "New Project Title" end end describe "duplicate" do context "with a project" do before do post :duplicate, params: {id: project.id} end it "creates a duplicate project" do expect(Project.last.title).to eq "Copy of #{project.title}" end it "redirects to new project" do expect(response).to redirect_to "/projects/#{Project.last.id}" end it "adds a success message" do expect(flash[:success]).to be_present end end context "with stories" do it "creates a duplicate project with matching stories" do story = project.stories.create({title: "Story 1"}) post :duplicate, params: {id: project.id} expect(Project.last.stories.first.id).not_to eq story.id expect(Project.last.stories.first.title).to eq story.title end it "creates stories without estimates" do story = project.stories.create({title: "Story 1"}) story.estimates.create({best_case_points: 1, worst_case_points: 3}) post :duplicate, params: {id: project.id} expect(Project.last.stories.first.estimates).to be_empty end end end end
RSpec.describe LocationSearchResultDecorator do let(:distance) { 1.0489736864844752 } let(:search_result) { double(distance: distance, lat_lng: [123, 456]) } subject(:decorator) { described_class.new(search_result) } specify { expect(decorator.distance).to eq('1.05') } it 'returns coordinates' do expect(decorator.coordinates).to eq('123,456') end end
package xls import ( "bytes" "encoding/binary" "fmt" "io" "unicode/utf16" ) type TWorkSheetVisibility byte const ( WorkSheetVisible TWorkSheetVisibility = 0 WorkSheetHidden TWorkSheetVisibility = 1 WorkSheetVeryHidden TWorkSheetVisibility = 2 ) type boundsheet struct { Filepos uint32 Visible byte Type byte Name byte } // WorkSheet in one WorkBook type WorkSheet struct { bs *boundsheet wb *WorkBook Name string Selected bool Visibility TWorkSheetVisibility rows map[uint16]*Row // NOTICE: this is the max row number of the sheet, so it should be count -1 MaxRow uint16 parsed bool rightToLeft bool } func (w *WorkSheet) Row(i int) *Row { row := w.rows[uint16(i)] if row != nil { row.wb = w.wb } return row } func (w *WorkSheet) parse(buf io.ReadSeeker) { w.rows = make(map[uint16]*Row) b := new(bof) var bof_pre *bof var col_pre interface{} for { if err := binary.Read(buf, binary.LittleEndian, b); err == nil { bof_pre, col_pre = w.parseBof(buf, b, bof_pre, col_pre) if b.Id == 0xa { break } } else { fmt.Println(err) break } } w.parsed = true } func (w *WorkSheet) parseBof(buf io.ReadSeeker, b *bof, pre *bof, col_pre interface{}) (*bof, interface{}) { var col interface{} bts := make([]byte, b.Size) binary.Read(buf, binary.LittleEndian, bts) buf = bytes.NewReader(bts) switch b.Id { // case 0x0E5: //MERGEDCELLS // ws.mergedCells(buf) case 0x23E: // WINDOW2 var sheetOptions, firstVisibleRow, firstVisibleColumn uint16 binary.Read(buf, binary.LittleEndian, &sheetOptions) binary.Read(buf, binary.LittleEndian, &firstVisibleRow) // not valuable binary.Read(buf, binary.LittleEndian, &firstVisibleColumn) // not valuable // buf.Seek(int64(b.Size)-2*3, 1) w.rightToLeft = (sheetOptions & 0x40) != 0 w.Selected = (sheetOptions & 0x400) != 0 case 0x208: // ROW r := new(rowInfo) binary.Read(buf, binary.LittleEndian, r) w.addRow(r) case 0x0BD: // MULRK mc := new(MulrkCol) size := (b.Size - 6) / 6 binary.Read(buf, binary.LittleEndian, &mc.Col) mc.Xfrks = make([]XfRk, size) for i := uint16(0); i < size; i++ { binary.Read(buf, binary.LittleEndian, &mc.Xfrks[i]) } binary.Read(buf, binary.LittleEndian, &mc.LastColB) col = mc case 0x0BE: // MULBLANK mc := new(MulBlankCol) size := (b.Size - 6) / 2 binary.Read(buf, binary.LittleEndian, &mc.Col) mc.Xfs = make([]uint16, size) for i := uint16(0); i < size; i++ { binary.Read(buf, binary.LittleEndian, &mc.Xfs[i]) } binary.Read(buf, binary.LittleEndian, &mc.LastColB) col = mc case 0x203: // NUMBER col = new(NumberCol) binary.Read(buf, binary.LittleEndian, col) case 0x06: // FORMULA c := new(FormulaCol) binary.Read(buf, binary.LittleEndian, &c.Header) c.Bts = make([]byte, b.Size-20) binary.Read(buf, binary.LittleEndian, &c.Bts) col = c case 0x207: // STRING = FORMULA-VALUE is expected right after FORMULA if ch, ok := col_pre.(*FormulaCol); ok { c := new(FormulaStringCol) c.Col = ch.Header.Col var cStringLen uint16 binary.Read(buf, binary.LittleEndian, &cStringLen) str, err := w.wb.get_string(buf, cStringLen) if nil == err { c.RenderedValue = str } col = c } case 0x27e: // RK col = new(RkCol) binary.Read(buf, binary.LittleEndian, col) case 0xFD: // LABELSST col = new(LabelsstCol) binary.Read(buf, binary.LittleEndian, col) case 0x204: c := new(labelCol) binary.Read(buf, binary.LittleEndian, &c.BlankCol) var count uint16 binary.Read(buf, binary.LittleEndian, &count) c.Str, _ = w.wb.get_string(buf, count) col = c case 0x201: // BLANK col = new(BlankCol) binary.Read(buf, binary.LittleEndian, col) case 0x1b8: // HYPERLINK var hy HyperLink binary.Read(buf, binary.LittleEndian, &hy.CellRange) buf.Seek(20, 1) var flag uint32 binary.Read(buf, binary.LittleEndian, &flag) var count uint32 if flag&0x14 != 0 { binary.Read(buf, binary.LittleEndian, &count) hy.Description = b.utf16String(buf, count) } if flag&0x80 != 0 { binary.Read(buf, binary.LittleEndian, &count) hy.TargetFrame = b.utf16String(buf, count) } if flag&0x1 != 0 { var guid [2]uint64 binary.Read(buf, binary.BigEndian, &guid) if guid[0] == 0xE0C9EA79F9BACE11 && guid[1] == 0x8C8200AA004BA90B { // URL hy.IsUrl = true binary.Read(buf, binary.LittleEndian, &count) hy.Url = b.utf16String(buf, count/2) } else if guid[0] == 0x303000000000000 && guid[1] == 0xC000000000000046 { // URL{ var upCount uint16 binary.Read(buf, binary.LittleEndian, &upCount) binary.Read(buf, binary.LittleEndian, &count) bts := make([]byte, count) binary.Read(buf, binary.LittleEndian, &bts) hy.ShortedFilePath = string(bts) buf.Seek(24, 1) binary.Read(buf, binary.LittleEndian, &count) if count > 0 { binary.Read(buf, binary.LittleEndian, &count) buf.Seek(2, 1) hy.ExtendedFilePath = b.utf16String(buf, count/2+1) } } } if flag&0x8 != 0 { binary.Read(buf, binary.LittleEndian, &count) bts := make([]uint16, count) binary.Read(buf, binary.LittleEndian, &bts) runes := utf16.Decode(bts[:len(bts)-1]) hy.TextMark = string(runes) } w.addRange(&hy.CellRange, &hy) case 0x809: buf.Seek(int64(b.Size), 1) case 0xa: default: // log.Printf("Unknow %X,%d\n", b.Id, b.Size) buf.Seek(int64(b.Size), 1) } if col != nil { w.add(col) } return b, col } func (w *WorkSheet) add(content interface{}) { if ch, ok := content.(contentHandler); ok { if col, ok := content.(Coler); ok { w.addCell(col, ch) } } } func (w *WorkSheet) addCell(col Coler, ch contentHandler) { w.addContent(col.Row(), ch) } func (w *WorkSheet) addRange(rang Ranger, ch contentHandler) { for i := rang.FirstRow(); i <= rang.LastRow(); i++ { w.addContent(i, ch) } } func (w *WorkSheet) addContent(row_num uint16, ch contentHandler) { var row *Row var ok bool if row, ok = w.rows[row_num]; !ok { info := new(rowInfo) info.Index = row_num row = w.addRow(info) } if row.info.Lcell < ch.LastCol() { row.info.Lcell = ch.LastCol() } row.cols[ch.FirstCol()] = ch } func (w *WorkSheet) addRow(info *rowInfo) (row *Row) { if info.Index > w.MaxRow { w.MaxRow = info.Index } var ok bool if row, ok = w.rows[info.Index]; ok { row.info = info } else { row = &Row{info: info, cols: make(map[uint16]contentHandler)} w.rows[info.Index] = row } return }
using Common.Worlds; namespace Common.Actors.Manager.Repositories; public interface IActorRepository { Task<Actor> CreateAsync( Id<World> worldId, Id<Actor> actorId, string name, DateTime createdOn, CancellationToken cancellationToken ); Task<Actor?> GetByIdAsync( Id<World> worldId, Id<Actor> actorId, CancellationToken cancellationToken ); }
#!/bin/bash set -e set -o pipefail npm run test:lint npm run prettier:ci npm run test pushd integration-test/nodejs sls deploy sls invoke -l true -f hello sls remove popd pushd integration-test rm -rf venv || true virtualenv venv -p python3 . venv/bin/activate popd pushd integration-test/python npm i sls deploy sls invoke -l true -f hello | grep "#LUMIGO#" sls remove popd
package io.javaoperatorsdk.operator.springboot.starter; import java.util.Set; public class ControllerProperties { private String name; private String crdName; private String finalizer; private boolean generationAware; private boolean clusterScoped; private Set<String> namespaces; private RetryProperties retry; public String getName() { return name; } public String getCRDName() { return crdName; } public String getFinalizer() { return finalizer; } public boolean isGenerationAware() { return generationAware; } public boolean isClusterScoped() { return clusterScoped; } public Set<String> getNamespaces() { return namespaces; } public RetryProperties getRetry() { return retry; } public void setRetry(RetryProperties retry) { this.retry = retry; } }
// Type definitions for response-time 2.3.2 // Project: https://github.com/expressjs/response-time // Definitions by: Uros Smolnik <https://github.com/urossmolnik>, TonyYang <https://github.com/TonyPythoneer> // Dan Manastireanu <https://github.com/danmana> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 /* =================== USAGE =================== import responseTime = require('response-time'); app.use(responseTime()); =============================================== */ /// <reference types="node" /> import http = require("http"); import express = require("express"); export = responseTime; /** * Response time header for node.js * Returns middleware that adds a X-Response-Time header to responses. */ declare function responseTime(options?: responseTime.ResponseTimeOptions): (request: http.IncomingMessage, response: http.ServerResponse, callback: (err: any) => void) => any; declare function responseTime(fn: responseTime.ResponseTimeFunction): (request: http.IncomingMessage, response: http.ServerResponse, callback: (err: any) => void) => any; declare function responseTime(fn: (request: express.Request, response: express.Response, time: number) => any): express.RequestHandler; declare namespace responseTime { export interface ResponseTimeOptions { digits?: number | undefined; header?: string | undefined; suffix?: boolean | undefined; } export interface ResponseTimeFunction { (request: http.IncomingMessage, response: http.ServerResponse, time: number ): any; } }
using PyCall import Plots # Functionality for computing band structures, mostly using pymatgen function high_symmetry_kpath(model; kline_density=20) bandstructure = pyimport("pymatgen.symmetry.bandstructure") pystructure = pymatgen_structure(model.lattice, model.atoms) symm_kpath = bandstructure.HighSymmKpath(pystructure) kcoords, labels = symm_kpath.get_kpoints(kline_density, coords_are_cartesian=false) labels_dict = Dict{String, Vector{eltype(kcoords[1])}}() for (ik, k) in enumerate(kcoords) if length(labels[ik]) > 0 labels_dict[labels[ik]] = k end end (kcoords=kcoords, klabels=labels_dict, kpath=symm_kpath.kpath["path"]) end function compute_bands(basis, ρ, kcoords, n_bands; eigensolver=lobpcg_hyper, tol=1e-3, show_progress=true, kwargs...) # Create basis with new kpoints, where we cheat by using any symmetry operations. ksymops = [[identity_symop()] for _ in 1:length(kcoords)] # For some reason rationalize(2//3) isn't supported (julia 1.4) myrationalize(x::T) where {T <: AbstractFloat} = rationalize(x, tol=10eps(T)) myrationalize(x) = x bs_basis = PlaneWaveBasis(basis, [myrationalize.(k) for k in kcoords], ksymops) ham = Hamiltonian(bs_basis; ρ=ρ) band_data = diagonalize_all_kblocks(eigensolver, ham, n_bands + 3; n_conv_check=n_bands, tol=tol, show_progress=show_progress, kwargs...) if !band_data.converged @warn "Eigensolver not converged" iterations=band_data.iterations end merge((basis=bs_basis, ), select_eigenpairs_all_kblocks(band_data, 1:n_bands)) end function prepare_band_data(band_data; datakeys=[:λ, :λerror], klabels=Dict{String, Vector{Float64}}()) # Get pymatgen to compute kpoint distances and get it to split quantities # from the band_data object into nicely plottable branches # This is a bit of abuse of the routines in pymatgen, but it works ... plotter = pyimport("pymatgen.electronic_structure.plotter") ret = Dict{Symbol, Any}(:basis => band_data.basis) for key in datakeys hasproperty(band_data, key) || continue # Compute dummy "Fermi level" for pymatgen to be happy allfinite = [filter(isfinite, x) for x in band_data[key]] eshift = sum(sum, allfinite) / sum(length, allfinite) bs = pymatgen_bandstructure(band_data.basis, band_data[key], eshift, klabels) data = plotter.BSPlotter(bs).bs_plot_data(zero_to_efermi=false) # Check number of k-Points agrees @assert length(band_data.basis.kpoints) == sum(length, data["distances"]) ret[:spins] = [:up] spinmap = [("1", :up)] if bs.is_spin_polarized ret[:spins] = [:up, :down] spinmap = [("1", :up), ("-1", :down)] end ret[:n_branches] = length(data["energy"]) ret[:n_bands] = size(data["energy"][1]["1"], 1) ret[:kdistances] = data["distances"] ret[:ticks] = data["ticks"] ret[key] = [Dict(spinsym => data["energy"][ibranch][spin] for (spin, spinsym) in spinmap) for ibranch = 1:length(data["energy"])] end (; ret...) # Make it a named tuple and return end """ is_metal(band_data, εF, tol) Determine whether the provided bands indicate the material is a metal, i.e. where bands are cut by the Fermi level. """ function is_metal(band_data, εF, tol=1e-4) # This assumes no spin polarization @assert band_data.basis.model.spin_polarization in (:none, :spinless) n_bands = length(band_data.λ[1]) n_kpoints = length(band_data.λ) for ib in 1:n_bands some_larger = any(band_data.λ[ik][ib] - εF < -tol for ik in 1:n_kpoints) some_smaller = any(εF - band_data.λ[ik][ib] < -tol for ik in 1:n_kpoints) some_larger && some_smaller && return true end false end function plot_band_data(band_data; εF=nothing, klabels=Dict{String, Vector{Float64}}(), unit=:eV, kwargs...) eshift = isnothing(εF) ? 0.0 : εF data = prepare_band_data(band_data, klabels=klabels) # For each branch, plot all bands, spins and errors p = Plots.plot(xlabel="wave vector") for ibranch = 1:data.n_branches kdistances = data.kdistances[ibranch] for spin in data.spins, iband = 1:data.n_bands yerror = nothing if hasproperty(data, :λerror) yerror = data.λerror[ibranch][spin][iband, :] ./ unit_to_au(unit) end energies = (data.λ[ibranch][spin][iband, :] .- eshift) ./ unit_to_au(unit) color = (spin == :up) ? :blue : :red Plots.plot!(p, kdistances, energies; color=color, label="", yerror=yerror, kwargs...) end end # X-range: 0 to last kdistance value Plots.xlims!(p, (0, data.kdistances[end][end])) Plots.xticks!(p, data.ticks["distance"], [replace(l, raw"$\mid$" => " | ") for l in data.ticks["label"]]) ylims = [-4, 4] is_metal(band_data, εF) && (ylims = [-10, 10]) ylims = round.(ylims * units.eV ./ unit_to_au(unit), sigdigits=2) if isnothing(εF) Plots.ylabel!(p, "eigenvalues ($(string(unit))") else Plots.ylabel!(p, "eigenvalues - ε_f ($(string(unit)))") Plots.ylims!(p, ylims...) end p end function detexify_kpoint(string) # For some reason Julia doesn't support this naively: https://github.com/JuliaLang/julia/issues/29849 replacements = ("\\Gamma" => "Γ", "\\Delta" => "Δ", "\\Sigma" => "Σ") for r in replacements string = replace(string, r) end string end # TODO This is the top-level function, which should be documented function plot_bandstructure(basis, ρ, n_bands; εF=nothing, kline_density=20, unit=:eV, kwargs...) # Band structure calculation along high-symmetry path kcoords, klabels, kpath = high_symmetry_kpath(basis.model; kline_density=kline_density) println("Computing bands along kpath:") println(" ", join(join.(detexify_kpoint.(kpath), " -> "), " and ")) band_data = compute_bands(basis, ρ, kcoords, n_bands; kwargs...) plotargs = () if kline_density ≤ 10 plotargs = (markersize=2, markershape=:circle) end plot_band_data(band_data; εF=εF, klabels=klabels, unit=unit, plotargs...) end function plot_bandstructure(scfres, n_bands; kwargs...) # Convenience wrapper for scfres named tuples plot_bandstructure(scfres.ham.basis, scfres.ρ, n_bands; εF=scfres.εF, kwargs...) end
using System.Collections; using System.Collections.Generic; using UnityEngine; [CreateAssetMenu(menuName="Custom/MapData")] public class MapData : ScriptableObject { [System.Serializable] public struct Obstacle { public Vector2 position; public Sprite sprite; public bool mirrored; } public List<Obstacle> obstacles; }
import {ChangeDetectionStrategy, Component} from '@angular/core'; import {UntypedFormControl, Validators} from '@angular/forms'; import {Observable} from 'rxjs'; import {filter, map, shareReplay, withLatestFrom} from 'rxjs/operators'; import {Controls, FlowArgumentForm} from '../../components/flow_args_form/form_interface'; import {CollectSingleFileArgs} from '../../lib/api/api_interfaces'; import {isNonNull} from '../../lib/preconditions'; import {toByteUnit} from '../form/byte_input/byte_conversion'; declare interface FormState { path: string; maxSizeBytes?: number; } /** Form that configures a CollectSingleFile flow. */ @Component({ selector: 'collect-single-file-form', templateUrl: './collect_single_file_form.ng.html', styleUrls: ['./collect_single_file_form.scss'], changeDetection: ChangeDetectionStrategy.OnPush, }) export class CollectSingleFileForm extends FlowArgumentForm<CollectSingleFileArgs, FormState> { override makeControls(): Controls<FormState> { return { path: new UntypedFormControl(), maxSizeBytes: new UntypedFormControl(null, Validators.required), }; } private readonly rawBytes$: Observable<number> = this.controls.maxSizeBytes.valueChanges.pipe( filter(isNonNull), shareReplay(1)); private readonly bytesAndUnit$ = this.rawBytes$.pipe(map(rawBytes => toByteUnit(rawBytes, 'long'))); readonly formattedBytesAtUnit$ = this.bytesAndUnit$.pipe( map(([bytes]) => bytes.toLocaleString()), ); readonly unit$ = this.bytesAndUnit$.pipe(map(([, unit]) => unit)); /** * When unit$ is plain byte(s), the raw byte number and the formatted byte * number at unit$ are equal. In this case, the hint would show duplicate * information. In this case, this observable emits `undefined`. */ readonly formattedRawBytes$ = this.formattedBytesAtUnit$.pipe( withLatestFrom(this.rawBytes$), map(([formattedBytesAtUnit, rawBytes]) => { const formattedRawBytes = rawBytes.toLocaleString(); if (formattedBytesAtUnit === formattedRawBytes) { return undefined; } else { return formattedRawBytes; } }), ); override convertFlowArgsToFormState(flowArgs: CollectSingleFileArgs): FormState { return { path: flowArgs.path ?? '', maxSizeBytes: flowArgs.maxSizeBytes ? Number(flowArgs.maxSizeBytes) : undefined, }; } override convertFormStateToFlowArgs(formState: FormState): CollectSingleFileArgs { return formState; } }
import Test.Tasty import qualified Basic import qualified Integration import qualified MockSqlQueryT import qualified Mocked import qualified SqlQueryRepTest main :: IO () main = defaultMain tests tests :: TestTree tests = testGroup "persistent-mtl" [ Basic.tests , Mocked.tests , Integration.tests , MockSqlQueryT.tests , SqlQueryRepTest.tests ]
/* * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ package sun.jvmstat.monitor; /** * Interface for Monitoring Integer Instrument Objects. * * The IntegerMonitor interface does not currently have a IntInstrument * counterpart. It is used in limited situations to expose certain * implementation specifics as performance counters. Typically, * a LongInstrument serves as a reasonable replacement for the * an IntInstrument class. * * @author Brian Doherty * @since 1.5 */ public interface IntegerMonitor extends Monitor { /** * Get the value of this Integer Instrumentation Object * * return int - the current value of this instrumentation object */ public int intValue(); }
<?php use yii\helpers\Html; use yii\helpers\Url; ?> <style type="text/css"> div.head{ margin: 7px 0; text-align: right; } div.row.custom1{ padding: 5px 0; } div.row label{ padding: 0 10px 0 5px; } </style> <div class="row content"> <div class="col-md-12"> <div class="row"> <div class="col-md-12"> <div class="panel panel-warning dummy-data"> <div class="panel-heading"> <h3 class="panel-title">Advance Search</h3> </div> <div class="panel-body advance-search-form"> <?php $form = yii\bootstrap\ActiveForm::begin([ 'action' => ['/article-search-result/index'], 'method' => 'post', 'layout' => 'horizontal', 'fieldConfig' => [ 'template' => "{beginWrapper}\n{input}\n{hint}\n{error}\n{endWrapper}", 'horizontalCssClasses' => [ 'offset' => '', 'label' => '', 'wrapper' => 'col-md-12', 'error' => '', 'hint' => '', ], ] ]); ?> <div class="row custom1"> <div class="col-md-8"> </div> <div class="col-md-4"> <button type="button" class="btn btn-success add" onclick="add_criteria_input()">Add Criteria</button> <button type="submit" class="btn btn-primary search">Search</button> </div> </div> <div id="criteria-form2"> <div class="row custom1"> <div class="col-md-1"> </div> <div class="col-md-1"> <input type="hidden" name="type" value="advance" /> <input type="hidden" name="cause[]" value="" /> <input type="hidden" name="operand[]" value="like" /> </div> <div class="col-md-3"> <input type="text" name="keyword[]" class="form-control" placeholder="Keyword" /> </div> <div class="col-md-3"> <select class="form-control" name="field[]"> <option value="topic">Topic</option> <option value="author">Author</option> <option value="journal">Journal</option> <option value="affiliation">Affiliation</option> <option value="publisher">Publisher</option> <option value="doi">Doi</option> <option value="year">Year</option> <option value="citedauthor">Cited Author</option> </select> </div> <div class="col-md-3"> </div> <div class="col-md-1"> </div> </div> </div> <div class="row custom1"> <div class="col-md-1"> </div> <div class="col-md-2 head"> Document Type </div> <div class="col-md-2"> <select class="form-control" name="doctype"> <option value="0">All</option> <option value="1">Article</option> <option value="2">Letter</option> <option value="3">Review</option> </select> </div> </div> <div class="row custom1"> <div class="col-md-2"> </div> <div class="col-md-1 head"> Years </div> <div class="col-md-2"> <input type="text" class="form-control" name="year_start" /> </div> <div class="col-md-1 head"> To </div> <div class="col-md-2"> <input type="text" class="form-control" name="year_end" value="2015" /> </div> </div> <div class="row custom1"> <div class="col-md-1"> </div> <div class="col-md-2 head"> Subject Area </div> <div class="col-md-2"> <input id="chksubjectarea-6" type="checkbox" name="subject_area[]" value="0" /> <label for="chksubjectarea-6">Select All</label> </div> <div class="col-md-2"> <input id="chksubjectarea-1" type="checkbox" name="subject_area[]" value="1" /> <label for="chksubjectarea-1">General</label> </div> <div class="col-md-2"> <input id="chksubjectarea-2" type="checkbox" name="subject_area[]" value="2" /> <label for="chksubjectarea-2">Physical Sciences</label> </div> </div> <div class="row custom1"> <div class="col-md-1"> </div> <div class="col-md-2 head"> </div> <div class="col-md-2"> <input id="chksubjectarea-3" type="checkbox" name="subject_area[]" value="3" /> <label for="chksubjectarea-3">Health Sciences</label> </div> <div class="col-md-2"> <input id="chksubjectarea-4" type="checkbox" name="subject_area[]" value="4" /> <label for="chksubjectarea-4">Social Sciences</label> </div> <div class="col-md-2"> <input id="chksubjectarea-5" type="checkbox" name="subject_area[]" value="5" /> <label for="chksubjectarea-5">Life Sciences</label> </div> <div class="col-md-2"> </div> </div> <div style="padding-bottom:50px;"></div> <?php yii\bootstrap\ActiveForm::end(); ?> </div> </div> </div> </div> </div> </div> <script type="text/javascript"> function add_criteria_input(){ jQuery('#criteria-form2').append('<div class="row custom1">\ <div class="col-md-1">\ </div>\ <div class="col-md-1">\ <select class="form-control" name="cause[]">\ <option value="AND">AND</option>\ <option value="OR">OR</option>\ <option value="NOT">NOT</option>\ </select>\ <input type="hidden" name="operand[]" value="like" />\ </div>\ <div class="col-md-3">\ <input type="text" name="keyword[]" class="form-control" placeholder="Keyword" />\ </div>\ <div class="col-md-3">\ <select class="form-control" name="field[]">\ <option value="topic">Topic</option>\ <option value="author">Author</option>\ <option value="jornal">Journal</option>\ <option value="affiliation">Affiliation</option>\ <option value="publisher">Publisher</option>\ <option value="doi">Doi</option>\ <option value="year">Year</option>\ <option value="citedauthor">Cited Author</option>\ </select>\ </div>\ <div class="col-md-2">\ <button type="button" class="btn btn-success btn-xs remove" onclick="remove_criteria_input(this)">-</button>\ </div>\ <div class="col-md-1">\ </div>\ </div>'); } function remove_criteria_input(t){ jQuery(t).parent().parent().remove(); } </script>
using UnityEngine; using System.Collections; public class MyClass : MonoBehaviour { public bool myBool; public string myString; public int myInt; public float myFloat; public GameObject myObject; }
object frmPadraoPesquisa: TfrmPadraoPesquisa Left = 0 Top = 0 BorderIcons = [biSystemMenu, biMinimize] BorderStyle = bsSingle Caption = 'Form Padr'#227'o Pesquisa' ClientHeight = 353 ClientWidth = 494 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] KeyPreview = True OldCreateOrder = False Position = poScreenCenter OnKeyDown = FormKeyDown PixelsPerInch = 96 TextHeight = 13 object Panel1: TPanel Left = 0 Top = 284 Width = 494 Height = 69 Align = alBottom TabOrder = 3 object btnEditar: TcxButton Left = 81 Top = 16 Width = 105 Height = 38 Caption = '&Editar' OptionsImage.Glyph.SourceDPI = 96 OptionsImage.Glyph.Data = { 89504E470D0A1A0A0000000D4948445200000020000000200806000000737A7A F40000000473424954080808087C0864880000000970485973000000DD000000 DD017053A2070000001974455874536F667477617265007777772E696E6B7363 6170652E6F72679BEE3C1A00000423494441545885BD974B4C5C5518C77FE75E EEBD300F080523033890C6C4340D85120D5536A58B8657228B46D3A026AE8CCB 1A374D1A17954553131BE2C2E7460D49DD541A85D4C46088ADDAD01A6DB54380 02833C8B3C9C179D997BEF7131333C073B9919FBDFCDF9BE9CDFFF9E39E77CDF 11524A32D244BB81669D40F22288438007810700C902B000D287E02A717588A7 07A3994C2B1E69C0DFEA41F20ED00DB833734B10E843709E9A6B0BD919986E29 441AE7109C011C1982772B82E41222DA43ED0F0F333730DD5101563FD0942578 B76E82DA45EDC0E2EE80B22775B2A30E618DE4045F8EC29BB3D0BC041FCC0334 21AC11263BEA76A7EE5C81E98E0A843582A43A6BF8832874AFC294B135763A02 EF56836016A93EB77D25B65660BAA510ACFE9CE02B3ABC16DA0907FC7D1653ED E324E6B6FA13ACDD06A4718E9CFE73073C73013EBA08BAB605B783CCC820B3BE 2873AF4F00342559DB0CF85B3DC9DD9E95EC7098952BC39881301C6F81C11ED0 B54D784A0BD7E3C8B551109CC1DFEAD9329038E7591D353B1C66E5EB9F882DAE B2F26133E6FC081C6F6171E0027F39AC1DB9EE2780801FB936EA48321172BCCD A0C05E26F34B660FDC0CD89B638AA11169EBE38138882B1E67ADFD5564780387 AE52F7D9229A37068028F6C6701F2E56D0AC13F982038CCEC6F9F1BD97B1FDC3 84348DD2C12F7196B8A8FB7469130E2003333A81BB6795C4DD9E1FF8D8328CFD 0D515332FED5DBD8FE616CB7CEA18F255ACDDED220256D05C9C29237784A5153 B23878964EAF97828A89F49359B11A0592152D8F708062079C3C15A320BE0F1C C07A58A26C96D43CC33BBBC151F28849AD0D636F2D785C700069A3249B89C70F 0750745381FF3610189AFC7FE0008A165140FAF68B9BB3214AEA4FA1977BF30F 0784AACF2908AEEE9760AFB910AAC681635DE8E5DEBCC201D08A2E2BC4D52112 3DDC4E499B02676DD2A9C681BAC3E895DE1D2939C1155512337A9564F7DAB73B 6ECE84510C57E247F01E22E4E3F9A31A75F5DEDCE10046A98FA6F140E2180ACE 0391EDF16F7FA9603D6243F01E0493DB445A1C6BD0683852991B5CA898BAAB1B 52E5B8E6DA02924BA9B815937CF38793572EDE66623271934961108A17B31EDB E0D993F3D9C3018ACA6F680D53BF6D190010D11EE026C0EDEB923FC7EEF3FBE8 14EF7FEF642D6A23CBC67056DDA1A46A3E0732A0B943422BEADCC4A66B4ABFF8 E49FEA95D5206F748D515418CF0DB85DAA61094765238D9377D21B80445B2EC3 DFC9A55B1EE2E13CC3AB5EA2F1FE95EDC3FB3F4CACF0805CBAD59817139A3B24 0ACB9BB77F794AE98B51EDC022AA689665477B85E6B4D3E66422A182E3C91BC2 51F6543A3864F238FDF5E011ACC8E732BA5E8F1515198115556294FA4CDDD59D DAEDFB7ACCF879FEF30B4518F36F4973E33476DC23EC98535A511D2428BA89A2 4584AACFA1155D2666F4D2341EC864DA7F0112F80E064C1EB111000000004945 4E44AE426082} SpeedButtonOptions.CanBeFocused = False SpeedButtonOptions.Flat = True TabOrder = 0 Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -16 Font.Name = 'Tahoma' Font.Style = [] ParentFont = False end object btnExcluir: TcxButton Left = 199 Top = 16 Width = 97 Height = 38 Caption = '&Deletar' OptionsImage.Glyph.SourceDPI = 96 OptionsImage.Glyph.Data = { 89504E470D0A1A0A0000000D494844520000002000000020080300000044A48A C60000000373424954080808DBE14FE00000000970485973000000DD000000DD 017053A2070000001974455874536F667477617265007777772E696E6B736361 70652E6F72679BEE3C1A0000014A504C5445FFFFFF49B69240BF9F40B59F47B8 9944B59F46B29D46B49C45B39B45B49C45B29C45B39C45B39C45B39C44B39C45 B39C45B39C45B39C4AB39D4CB39D4CB49E4DB49E4EB49E4EB59E4FB39D50B39D 51B49D58B69F5AB6A15FB39F6AB7A36AB9A56BB9A56DB6A26EB7A36EB9A570B4 A271B4A174B0A074B6A277BBA87BB0A07CB1A07EB8A680BCA980BDAA8988818A 89838B8A838C8A848E8D8691BBAA92ADA194938B96948D96BBAA97B8A698978E 9897909A98909AAFA29B99919BB7A99C9A919C9A929D9B929D9B949E9C939E9C 959F9D94A0ABA1A0C2B2A19F98A4B0A5A5B9A8A7A69DA8A69EA8A79FAAA8A0AA A9A0ABA9A1ACC4B1ADABA2AEACA2AFB0A5B0AEA5B1AFA4B3B1A5B3B2A8B4B2A7 B6C5B7B7B6ACB7C6B8B8B6ABB9BEAFBAB8ACBCBAAFBCBAB0BEBCB2C0BEB3C1BF B3C3C8BBC4C2B7C4CCB9C6C5B9C9C7BBC9C7BCCBC9BDCDD0BDCED0BD22B37AEF 0000001174524E5300070818192D49849798C1C8DAE3F2F3F5D5A8315B000001 754944415438CB8593E75BC23010C6C3EA6294BA15471DA815C1599C5805B718 5CAD0B077522FAFF7F35A6698A50E8FB214F7AF76B7277B90380CAC7F0424414 2302CFF840B3825C4CA28A71C106B79F8D4BFF1467FDF5FE40586A5238E0F843 51C945D110FD9FFA3BCEBF7F3E862941CEF03BE74FAD2612A3C7CE2D561C2CFE E89F4826C756966479FC5196E5911E6C64717E38FEBE2BC330AE5F6BB6DEBA71 2E7FD972981D32B09EAA363188CD1CAA9F559F81CD938D5CB158CCE5755DDFCD EB5BBD56C57C802101A52A6AD6344D55454B563553C4CC009EECD255AD804ED6 34B414B45A9A987920B4070410690F44804876B3EE804881999716807D85525A 73BFC20E52399DD75C83E4299059FC724B937180B99B6680B14B8D0178DF08A0 5293C79214985980B0B2BD83803D0A70F4B911B07E0861E9F20101CFB704C0CF 4D1A46815867EFD66BA79D86212D376901F0E21303D3752D67356DE7F2BEA5A3 BB72B97CD055D7B4DE6DEF3D38DEA3E73DBCADC7FF171B5F84D73307C7700000 000049454E44AE426082} SpeedButtonOptions.CanBeFocused = False SpeedButtonOptions.Flat = True TabOrder = 1 Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -16 Font.Name = 'Tahoma' Font.Style = [] ParentFont = False OnClick = btnExcluirClick end object btnNovo: TcxButton Left = 312 Top = 16 Width = 97 Height = 38 Caption = '&Novo' OptionsImage.Glyph.SourceDPI = 96 OptionsImage.Glyph.Data = { 89504E470D0A1A0A0000000D4948445200000020000000200806000000737A7A F40000000473424954080808087C086488000002C3494441545885CD97BD4F53 5118879FF7DCF6DEB6D8AE4D05174C0788263028036100070749481C0C03937B 759384C1868504376CE25FC0C0A209093398180765314170686C4C1409899178 D57E72EF71A02D50EE858B42F1999A73DE8FDF7D7B3EDE23042493C78A092328 C6D0F4684809A4763ED1218A5D511455984DA55810612E37801D24AE9C643055 20E968B21A2604E2ADF33B050F27850E5B6C1816E34F6FF0FEAF0464D7314B11 26051E0197FCEC3C051C1062465871AB8C3D1BE65760015305923578AE3483C7 843F59401DC3C20E4719F4AA866A1D98FCC8F59ACB6A90E441712A24CA36EF32 6FB9DB3A77A802530592359755255C091A3C48059A289C4882BE8395680AC8AE 6316A32C07FDF2B4314A583A887FEFA7ECD8BCDC9909A4C1B0B0C5A1B3B12642 8D895284C9D3947DC8CC92902EBE857E80E90616E05448983116815B505F0353 0592F5D5DE16AA65861FAC72AD29C0D1643966AB9D392EE254580050993C9686 89B625AF53ABD09B794322141346F038E1CE1D17D19A870AC558DB933734B88C 2B343D1726A04667A87EAB1D216D8C3264667D9DE3923A104991B9BCE16BBB56 9AF7DCA6DA2516124879F810960E12D2E52FBF15F7C8A9DE2462243CC7B54BC8 DFAB4D84346C09A45B276AFA37B6FEE2EB18971482B13FA05C5FDBB2E3DD9B88 623724B0858780BCB344BEB4E41BF47E7475FF2F522EB9AFBDBEB67E88A2A810 3E9CDAF38C506136152E8B172640B1A08A9A650D3FDB9F1D2DC29CCAA5A908CC B73B7FD862233780AD000C611ABC9BC67341A10D8BF1BD9FC04C37DB1A9EB42B BF1961A5D196353BA26899D96294DB41BBA257D5E9BD966CB7DF779F7B6158D8 6E75FF02BCF0A6F4D0513CD3CDB612EEB89ACFA7081B38B915E75EEBDBE0C85D 307B95B5B0E2862BBC3EABDC86851D49D097BBC98BA3BA3C98E9663B566244C3 63FE657728B41963591C3AFDDE88FFEFE3B495F37A9EFF01E701FA3A8D6D7B63 0000000049454E44AE426082} SpeedButtonOptions.CanBeFocused = False SpeedButtonOptions.Flat = True TabOrder = 2 Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -16 Font.Name = 'Tahoma' Font.Style = [] ParentFont = False end end object DBGrid1: TDBGrid Left = 0 Top = 80 Width = 494 Height = 204 Align = alBottom TabOrder = 4 TitleFont.Charset = DEFAULT_CHARSET TitleFont.Color = clWindowText TitleFont.Height = -11 TitleFont.Name = 'Tahoma' TitleFont.Style = [] end object edtPesquisa: TcxTextEdit Left = 111 Top = 24 BeepOnEnter = False ParentFont = False Style.Font.Charset = DEFAULT_CHARSET Style.Font.Color = clWindowText Style.Font.Height = -13 Style.Font.Name = 'Tahoma' Style.Font.Style = [] Style.IsFontAssigned = True TabOrder = 1 OnKeyDown = edtPesquisaKeyDown Width = 306 end object cbTipoPesquisa: TcxComboBox Left = 8 Top = 24 ParentFont = False Properties.DropDownListStyle = lsEditFixedList Properties.Items.Strings = ( 'PADR'#195'O') Style.Font.Charset = DEFAULT_CHARSET Style.Font.Color = clWindowText Style.Font.Height = -13 Style.Font.Name = 'Tahoma' Style.Font.Style = [] Style.IsFontAssigned = True TabOrder = 0 Text = 'PADR'#195'O' Width = 89 end object btnPesquisar: TcxButton Left = 434 Top = 15 Width = 42 Height = 42 OptionsImage.Glyph.SourceDPI = 96 OptionsImage.Glyph.Data = { 89504E470D0A1A0A0000000D4948445200000020000000200806000000737A7A F40000000473424954080808087C0864880000000970485973000000EC000000 EC01792871BD0000001974455874536F667477617265007777772E696E6B7363 6170652E6F72679BEE3C1A00000569494441545885AD966D8C54D519C77FCFB9 77E6CE0B3B0BCAAE802BB21259CB96522146D2B424D206A344AD252B24244DD7 A44DF54B134D8A318646F1832F09F2B949139B36D1B8420D2959D4045F12119B E80215A16C975D1936B2203BC3CEEECCECDCB9E7F1C32C77F6657667A2FC3F9D B9CF73CFEFFFDC739E73466850DABF2B85F1B759658B88AE0756018BA7C25960 48554F18384AB97458EE3A946B645EA90B1ED8B1C612EC1664279068D06F5EE1 0D837D59561FE8FF5E0634DD15B793B25744FF04B80D8267CB5761BF91E41E69 7FBDD8B0011DD87EA7620E023FAE472807C2F97484C1E12863E306019A9B02DA DB7CDADB7C1CA3A01C1737F88DAC3AF84D5D03DABFFD6E35E65DA06521B02A7C F6DF38473F4B929B3035739A9B2CBFDA34CEC6B54544B82862B7C91D074ECD6B 60AAF24FEAC14BBEF0D69114A707BC85D242ADEF98E4D7BF1C2316D58B62B847 DA7B2ECD31A083BF8BA99D380EAC5F683255F8E7BF9BF96A3A3C12A1D8D181DF DA8A00EEA511BC73FF43CA6500AE4D4C128F1479F5E922C691CF25CA2FE4B69E 024CDB5C36C8BF28B2301CE093138919F0E28FD632F6D0C3048B9233F29CDC18 CDFF7A87E2C92FC9E48A6480BF1F70E8EE0A36DA923C03FC05C040A5D5A676FB 822AF9C287FFA97662B1B393CCCE9D73E00041538A91071E67C2C4C2671F9CF2 285CCE22F0B40E762D0B0D5882DD34D06AE786A24C142A1B4E631ED9871F01A9 DDC9FEA8879F49507AF429CC548A5FB67CD0974433A3495BD6BD0046FB77A5A6 0E99BA3A7F311A8E0B6B3BD1787C7EF8B795650A96AE247253754FF70D26D052 09B2D96EFDE2811683F1B7D1E009776DBCDA6EFEF2E53573CAD3E0D72537AF08 C7D9A996557FD2B1C6EE3656D9D2081C40B5FAB9A5C6A7F7473D4ADFCE6D4D9D DEEDD3E6B04170BF99BA581A522A1984637764640E7C76E5A146C3B6A72961C3 B12907AB0CD0DEA88155B7FAE1387EFA34529AAC0B37D72EE18F56CDAEBF3D1F 8E158D1B20D5A8818EF612314F01907C9E546FEFC2955B4BECE03EACADBCE338 C29675D96A3CB04EED437C1EC5A396CD4B9DF0B7FFF13122FBF7620AD7E6E49A DC28897F3CCBE4D5CBE1B39F754C928C55971151C40E745D0196D6A52BC8B115 040329FE96CBD1971927335EB9618D63882E5B892E6D43AD45AEA4F12F0F636D 75BD6F4E09FBBA8770A7976C8C7581C1BA06A6E09C4FE1083C962DD157288561 1B588AC343303C54F3F59B9A84E777A467C2011C9337AA7AA25138807E7D95A6 FF8FF0DA37136CF41CCC028BE818B8778DCFBEEEAF59B228981317E35C700D1C 55F87DA3703B50D9D1D1E51E4FFD6190AB0597DEBE259C4DC7C81504055209A5 73659107378CD29C28CFEFD09877454F772DD218978019378AB570F8BDC56CBA DC42AB3833E0B2C2439FBC08AECE3F791D29E0362D5966A4B3675CE1CDD9F0B7 DF4F71EC6C94BFE6B30CA4AF54E1B7C6D027877F101CC078DE59597768C40018 ECCB4078CA7CF47992BE33956B74F86A893D13139C5C14AD54FE441A5C5B7BD6 86251889FCB1C20664F5817E15F65F0FF70F4580CA3F994CAE4810283D6DEE0D A91C40BDE871D9D0FB516800C048720FCA7180B65BCA211CA0A5199EDB75E106 540EE2BA39D78FDC1F72C340FBEB4571781448DF77EF38ADCD05520961C3EA32 AFFC364D2CF2C3E1182730C9F866D9D43B167267E7E8F9ED3F513587516DD34C 06F54BB353BE9FC40988C71E737F7AE4E08CC7B572B5BFAB450D6FA3BAF94698 10D7CD99B8F7735977E4D4EC58CD734CEEECB922767CAB8ABC208B17E72512AD 95D6081AF5BC4F8D8DB5D5825732EA4807BB96D9B2EE253BDAADBEEFD4CB87CA 21633CEF8C91C813D777FBFC161B949EDCDA6A03F9331A6C551BB463354E602B 868C581193B78EB96022EE7BC6782FC9BA432375A604E03BDC8B50E2AAE3EF1B 0000000049454E44AE426082} SpeedButtonOptions.CanBeFocused = False SpeedButtonOptions.Flat = True TabOrder = 2 Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -13 Font.Name = 'Tahoma' Font.Style = [] ParentFont = False end object dsPadrao: TDataSource Left = 368 Top = 96 end end
#!/bin/sh set -xeu if [ "$TARGETPLATFORM" = linux/arm64 ]; then HELM_PLATFORM=linux-arm64 else HELM_PLATFORM=linux-amd64 fi # Install kubectl curl --silent --show-error --fail --location -o _ \ "https://storage.googleapis.com/kubernetes-release/release/v${KUBE_VERSION}/bin/${TARGETPLATFORM}/kubectl" mv _ "${EXE_FOLDER}/kubectl" chmod +x "${EXE_FOLDER}/kubectl" mkdir -p /home/tgf/.kube touch "${KUBECONFIG}" chmod 666 "${KUBECONFIG}" # Install helm (git is also required by helm) curl --silent --show-error --fail --location "https://get.helm.sh/helm-v${HELM_VERSION}-${HELM_PLATFORM}.tar.gz" \ | tar xzo mv ./${HELM_PLATFORM}/helm "${EXE_FOLDER}/helm" rm -rf ./${HELM_PLATFORM} chmod +x "$EXE_FOLDER/helm"
/* * $Id: UpdateProcessor_T.cpp 4381 2011-03-04 20:56:23Z mitza $ * * * Distributed under the OpenDDS License. * See: http://www.opendds.org/license.html */ #ifndef UPDATEPROCESSOR_T_CPP #define UPDATEPROCESSOR_T_CPP #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "DcpsInfo_pch.h" #include "dds/DCPS/debug.h" #include "UpdateProcessor_T.h" namespace OpenDDS { namespace Federator { template<class DataType> UpdateProcessor<DataType>::UpdateProcessor() { if (OpenDDS::DCPS::DCPS_debug_level > 0) { ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) UpdateProcessor::UpdateProcessor()\n"))); } } template<class DataType> UpdateProcessor<DataType>::~UpdateProcessor() { if (OpenDDS::DCPS::DCPS_debug_level > 0) { ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) UpdateProcessor::~UpdateProcessor()\n"))); } } template<class DataType> void UpdateProcessor<DataType>::processSample( const DataType* sample, const DDS::SampleInfo* info) { if (OpenDDS::DCPS::DCPS_debug_level > 0) { ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) UpdateProcessor::processSample()\n"))); } if (info->valid_data) { switch (sample->action) { case CreateEntity: this->processCreate(sample, info); break; case UpdateQosValue1: this->processUpdateQos1(sample, info); break; case UpdateQosValue2: this->processUpdateQos2(sample, info); break; case UpdateFilterExpressionParams: this->processUpdateFilterExpressionParams(sample, info); break; case DestroyEntity: this->processDelete(sample, info); break; default: ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) ERROR: UpdateProcessor::processSample() - ") ACE_TEXT("upsupported action type: %d.\n"), sample->action)); break; } } else { if (OpenDDS::DCPS::DCPS_debug_level > 0) { ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) UpdateProcessor::processSample() - ") ACE_TEXT("sample not valid, declining to process.\n"))); } } } template<class DataType> void UpdateProcessor<DataType>::processUpdateQos2( const DataType* /* sample */, const DDS::SampleInfo* /* info */) { /* This method intentionally left unimplemented. */ } template<class DataType> void UpdateProcessor<DataType>::processUpdateFilterExpressionParams( const DataType* /* sample */, const DDS::SampleInfo* /* info */) { /* This method intentionally left unimplemented. */ } } // namespace Federator } // namespace OpenDDS #endif /* UPDATEPROCESSOR_T_CPP */
# Full Audio ## Create Dataset ```shell python3 create_dataset.py ```
# Asks for height and weight height = float(input("enter your height in m: ")) weight = float(input("enter your weight in kg: ")) # Calculates BMI bmi = round(weight / height ** 2) if bmi < 18.5: print(f"Your BMI is {bmi}, you are underweight.") elif bmi < 25: print(f"Your BMI is {bmi}, you have a normal weight.") elif bmi < 30: print(f"Your BMI is {bmi}, you are slightly overweight.") elif bmi < 35: print(f"Your BMI is {bmi}, you are obese.") else: print(f"Your BMI is {bmi}, you are clinically obese.") """ Under 18.5 is underweight Over 18.5 but below 25 is a normal weight Over 25 but below 30 is slightly overweight Over 30 but below 35 is obese Above 35 is clinically obese. """
package az.movie.az_movie.ui.fragment.movies_full.adapters import android.view.ViewGroup import androidx.paging.LoadState import androidx.paging.LoadStateAdapter class MoviesLoadStateAdapter( private val retry: () -> Unit ) : LoadStateAdapter<MoviesLoadStateViewHolder>() { override fun onBindViewHolder(holder: MoviesLoadStateViewHolder, loadState: LoadState) { holder.bind(loadState) } override fun onCreateViewHolder(parent: ViewGroup , loadState: LoadState): MoviesLoadStateViewHolder { return MoviesLoadStateViewHolder.create(parent, retry) } }
--- layout: exercise title: Exercise 9.15 permalink: /logical-inference-exercises/ex_15/ breadcrumb: 9-Inference-In-First-Order-Logic breadcrumb2: ex_15 breadcrumb3: 9inferenceInFirstOrderLogic breadcrumb4: ch9ex15 breadcrumb5: ex9.15 --- {% include mathjax_support %}
/*************************************************************************** begin : Thu Feb 20 2003 copyright : (C) 2003 - 2009 by Alper Akcan email : alper.akcan@gmail.com ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation; either version 2.1 of the * * License, or (at your option) any later version. * * * ***************************************************************************/ #include "xynth_.h" int s_event_mouse_handler_state (s_window_t *window, s_event_t *event, s_handler_mouse_t *mouse, int over) { int x = mouse->x + window->surface->buf->x; int y = mouse->y + window->surface->buf->y; int w = mouse->w; int h = mouse->h; int b = mouse->button; int overbit = EVENT_TYPE_MOUSE_OVER << 16; int type = (event->type & EVENT_TYPE_MOUSE_CLICKED) ? event->type &= ~EVENT_TYPE_MOUSE_RELEASED : event->type; if ((type & (EVENT_TYPE_MOUSE_PRESSED | EVENT_TYPE_MOUSE_CLICKED | EVENT_TYPE_MOUSE_RELEASED)) && !(event->mouse->b & b)) { return -1; } if ((event->mouse->x >= x) && (event->mouse->x <= (x + w - 1)) && (event->mouse->y >= y) && (event->mouse->y <= (y + h - 1))) { if (over != 1) { goto end; } mouse->hstate |= overbit; if (type & (EVENT_TYPE_MOUSE_RELEASED | EVENT_TYPE_MOUSE_CLICKED)) { if (mouse->hstate & event->mouse->b) { mouse->hstate &= ~event->mouse->b; return (type & ~EVENT_TYPE_MOUSE); } else { return (type & ~EVENT_TYPE_MOUSE) | EVENT_TYPE_MOUSE_HINT1; } } mouse->hstate |= event->mouse->b; return (type & ~EVENT_TYPE_MOUSE); } else { if (over != 0) { goto end; } if (type & (EVENT_TYPE_MOUSE_RELEASED | EVENT_TYPE_MOUSE_CLICKED)) { if (mouse->hstate & event->mouse->b) { mouse->hstate &= ~event->mouse->b; return (type & ~EVENT_TYPE_MOUSE) | EVENT_TYPE_MOUSE_HINT2; } } if (mouse->hstate & overbit) { mouse->hstate &= ~overbit; return (type & ~EVENT_TYPE_MOUSE) | EVENT_TYPE_MOUSE_HINT2; } } end: return -1; } int s_event_parse_handler_over (s_window_t *window, s_event_t *event, s_handler_t *work) { switch (s_event_mouse_handler_state(window, event, &(work->mouse), 1)) { case EVENT_TYPE_MOUSE_OVER: if (work->mouse.o != NULL) { s_thread_mutex_unlock(window->handlers->mut); work->mouse.o(window, event, work); s_thread_mutex_lock(window->handlers->mut); } goto not_over; case EVENT_TYPE_MOUSE_PRESSED: if (work->mouse.p != NULL) { s_thread_mutex_unlock(window->handlers->mut); work->mouse.p(window, event, work); s_thread_mutex_lock(window->handlers->mut); } goto not_over; case EVENT_TYPE_MOUSE_CLICKED: if (work->mouse.c != NULL) { s_thread_mutex_unlock(window->handlers->mut); work->mouse.c(window, event, work); s_thread_mutex_lock(window->handlers->mut); work = (s_handler_t *) s_list_get(window->handlers->list, s_list_get_pos(window->handlers->list, work)); if (work == NULL) { goto not_over; } } /* no break */ case EVENT_TYPE_MOUSE_RELEASED: if (work->mouse.r != NULL) { s_thread_mutex_unlock(window->handlers->mut); work->mouse.r(window, event, work); s_thread_mutex_lock(window->handlers->mut); } goto not_over; case (EVENT_TYPE_MOUSE_RELEASED | EVENT_TYPE_MOUSE_HINT1): /* mouse button released, but the prev. press was not on us */ if (work->mouse.hr != NULL) { s_thread_mutex_unlock(window->handlers->mut); work->mouse.hr(window, event, work); s_thread_mutex_lock(window->handlers->mut); } goto not_over; case (EVENT_TYPE_MOUSE_OVER | EVENT_TYPE_MOUSE_HINT1): /* on over, but mouse button is still pressed */ if (work->mouse.ho != NULL) { s_thread_mutex_unlock(window->handlers->mut); work->mouse.ho(window, event, work); s_thread_mutex_lock(window->handlers->mut); } goto not_over; } return -1; not_over: return 0; } int s_event_parse_handler_notover (s_window_t *window, s_event_t *event, s_handler_t *work) { switch (s_event_mouse_handler_state(window, event, &(work->mouse), 0)) { case (EVENT_TYPE_MOUSE_OVER | EVENT_TYPE_MOUSE_HINT2): /* not on over, but was on over */ if (work->mouse.oh != NULL) { s_thread_mutex_unlock(window->handlers->mut); work->mouse.oh(window, event, work); s_thread_mutex_lock(window->handlers->mut); } goto end; case (EVENT_TYPE_MOUSE_OVER | EVENT_TYPE_MOUSE_HINT1 | EVENT_TYPE_MOUSE_HINT2): /* not on over, but was on over. and button is still pressed */ if (work->mouse.hoh != NULL) { s_thread_mutex_unlock(window->handlers->mut); work->mouse.hoh(window, event, work); s_thread_mutex_lock(window->handlers->mut); } goto end; case (EVENT_TYPE_MOUSE_RELEASED | EVENT_TYPE_MOUSE_HINT2): /* mouse button released outside, but the prev. press was on us */ if (work->mouse.rh != NULL) { s_thread_mutex_unlock(window->handlers->mut); work->mouse.rh(window, event, work); s_thread_mutex_lock(window->handlers->mut); } goto end; } return -1; end: return 0; } void s_event_parse_mouse (s_window_t *window, s_event_t *event) { int pos; s_handler_t *work; pos = 0; s_thread_mutex_lock(window->handlers->mut); while (!s_list_eol(window->handlers->list, pos)) { work = (s_handler_t *) s_list_get(window->handlers->list, pos++); if (work->type != MOUSE_HANDLER) { continue; } if (s_event_parse_handler_over(window, event, work) == 0) { break; } } pos = 0; while (!s_list_eol(window->handlers->list, pos)) { work = (s_handler_t *) s_list_get(window->handlers->list, pos++); if (work->type != MOUSE_HANDLER) { continue; } if (s_event_parse_handler_notover(window, event, work) == 0) { break; } } s_thread_mutex_unlock(window->handlers->mut); return; } int s_event_parse_keybd_handler (s_window_t *window, s_event_t *event, s_handler_t *work) { if (((work->keybd.flag & event->keybd->flag) == (event->keybd->flag & ~KEYBD_MASL)) && !(work->keybd.flag & ~event->keybd->flag) && (event->keybd->button == work->keybd.button)) { if (event->type & EVENT_TYPE_KEYBOARD_PRESSED) { if (work->keybd.p != NULL) { s_thread_mutex_unlock(window->handlers->mut); work->keybd.p(window, event, work); s_thread_mutex_lock(window->handlers->mut); } return 0; } if (event->type & EVENT_TYPE_KEYBOARD_RELEASED) { if (work->keybd.r != NULL) { s_thread_mutex_unlock(window->handlers->mut); work->keybd.r(window, event, work); s_thread_mutex_lock(window->handlers->mut); } return 0; } } return -1; } int s_event_parse_keybd (s_window_t *window, s_event_t *event) { int pos; int ret = 1; s_handler_t *work; pos = 0; s_thread_mutex_lock(window->handlers->mut); while (!s_list_eol(window->handlers->list, pos)) { work = (s_handler_t *) s_list_get(window->handlers->list, pos++); if (work->type != KEYBD_HANDLER) { continue; } if (s_event_parse_keybd_handler(window, event, work) == 0) { ret = 0; break; } } s_thread_mutex_unlock(window->handlers->mut); return ret; } int s_event_parse_expos (s_window_t *window, s_event_t *event) { s_surface_changed(window, event->expose->rect, 0); return 0; } int s_event_parse_config (s_window_t *window, s_event_t *event) { s_window_form_draw(window); return 0; } int s_event_parse_timer (s_window_t *window, s_event_t *event) { if (event->timer->cb != NULL) { event->timer->cb(window, event->timer); } return 0; } int s_event_copy (s_event_t *event, s_event_t **nevent) { s_event_t *tmp; if (s_event_init(&tmp)) { return -1; } tmp->type = event->type; tmp->window = event->window; memcpy(tmp->mouse, event->mouse, sizeof(s_mouse_t)); memcpy(tmp->keybd, event->keybd, sizeof(s_keybd_t)); memcpy(tmp->expose->rect, event->expose->rect, sizeof(s_rect_t)); *nevent = tmp; return 0; } int s_event_changed (s_window_t *window) { s_event_t *event; if (window->event->type & EVENT_TYPE_MASK) { if (!s_event_copy(window->event, &event)) { s_eventq_add(window, event); } } return 0; } void s_event_dump (s_window_t *window, s_event_t *event) { if (event->type & EVENT_TYPE_QUIT) { debugf(0, "EVENT_TYPE_QUIT"); } if (event->type & EVENT_TYPE_KEYBOARD) { debugf(0, "EVENT_TYPE_KEYBOARD"); } if (event->type & EVENT_TYPE_MOUSE) { debugf(0, "EVENT_TYPE_MOUSE"); } if (event->type & EVENT_TYPE_EXPOSE) { debugf(0, "EVENT_TYPE_EXPOSE:\n" " expose->rect->x: %d\n" " expose->rect->y: %d\n" " expose->rect->w: %d\n" " expose->rect->h: %d\n", event->expose->rect->x, event->expose->rect->y, event->expose->rect->w, event->expose->rect->h); } if (event->type & EVENT_TYPE_CONFIG) { debugf(0, "EVENT_TYPE_CONFIG:\n" " win : (%d, %d) (%d x %d)\n" " buf : (%d, %d) (%d x %d)\n" " x changed : %s\n" " y changed : %s\n" " w changed : %s\n" " h changed : %s\n", window->surface->win->x, window->surface->win->y, window->surface->win->w, window->surface->win->h, window->surface->buf->x, window->surface->buf->y, window->surface->buf->w, window->surface->buf->h, (event->type & EVENT_TYPE_CONFIG_X) ? "yes" : "no", (event->type & EVENT_TYPE_CONFIG_Y) ? "yes" : "no", (event->type & EVENT_TYPE_CONFIG_W) ? "yes" : "no", (event->type & EVENT_TYPE_CONFIG_H) ? "yes" : "no"); } if (event->type & EVENT_TYPE_FOCUS) { debugf(0, "EVENT_TYPE_FOCUS:\n" " focus type : %s\n", (event->type & EVENT_TYPE_FOCUS_IN) ? "in" : (event->type & EVENT_TYPE_FOCUS_OUT) ? "out" : "unknown"); } if (event->type & EVENT_TYPE_MAP) { debugf(0, "EVENT_TYPE_MAP:\n" " map type : %s\n", (event->type & EVENT_TYPE_MAPPED) ? "mapped" : (event->type & EVENT_TYPE_UNMAPPED) ? "unmapped" : "unknown"); } if (event->type & EVENT_TYPE_DESKTOP) { debugf(0, "EVENT_TYPE_DESKTOP"); } if (event->type & EVENT_TYPE_TIMER) { debugf(0, "EVENT_TYPE_TIMER"); } } int s_event_init (s_event_t **event) { (*event) = (s_event_t *) s_calloc(1, sizeof(s_event_t)); (*event)->mouse = (s_mouse_t *) s_calloc(1, sizeof(s_mouse_t)); (*event)->keybd = (s_keybd_t *) s_calloc(1, sizeof(s_keybd_t)); (*event)->expose = (s_expose_t *) s_calloc(1, sizeof(s_expose_t)); (*event)->expose->rect = (s_rect_t *) s_calloc(1, sizeof(s_rect_t)); (*event)->desktop = (s_desktop_t *) s_calloc(1, sizeof(s_desktop_t)); if (s_list_init(&((*event)->desktop->clients))) { goto err0; } return 0; err0: s_free((*event)->desktop); s_free((*event)->expose); s_free((*event)->keybd); s_free((*event)->mouse); s_free(*event); return -1; } int s_event_uninit (s_event_t *event) { s_desktop_client_t *desktopc; while (!s_list_eol(event->desktop->clients, 0)) { desktopc = (s_desktop_client_t *) s_list_get(event->desktop->clients, 0); s_list_remove(event->desktop->clients, 0); s_free(desktopc->title); s_free(desktopc); } s_list_uninit(event->desktop->clients); s_free(event->desktop); s_free(event->expose->rect); s_free(event->expose); s_free(event->mouse); s_free(event->keybd); s_free(event); return 0; }
package routes import ( "encoding/hex" "github.com/deso-protocol/core/lib" "github.com/pkg/errors" ) // decodeBlockHashFromHex Decodes a BlockHash given a valid hex encoding. If the input does not represent a valid // BlockHash, this returns the corresponding error func decodeBlockHashFromHex(hexEncoding string) (*lib.BlockHash, error) { if hexEncoding == "" { return nil, errors.Errorf("expected valid hex encoded string but received empty string") } decodedBytes, err := hex.DecodeString(hexEncoding) if err != nil { return nil, errors.Errorf("error decoding block hash from hex encoded string %v: %v", hexEncoding, err) } if len(decodedBytes) != lib.HashSizeBytes { return nil, errors.Errorf("the hex encoded string %v does not decode into a valid block hash", hexEncoding) } return lib.NewBlockHash(decodedBytes), nil }
require 'active_record' module ActiveRecord class Base cattr_accessor :where_syntax, :instance_writer => false end end module Everywhere class Railtie < ::Rails::Railtie #:nodoc: initializer 'everywhere' do |app| ActiveSupport.on_load(:active_record) do require "everywhere/#{app.config.active_record.where_syntax || 'chain'}" end end end end
# Example: # # class ApplicationController < ActionController::Base # include Metatags::Concerns::Controller # end # # class ArticlesController < ApplicationController # before_action :find_article, only: [:show] # # # Simplest option. # # Will use Metatags::ArticleMetatags by default. # build_meta_tags instance: :article # # OR # # if you need to be specific about which class to use # build_meta_tags with: Metatags::CustomArticleMetatags, instance: :article # # OR # # if you need logic to determine which Metatags class to use, and want to build # # the meta tags in the action itself. # skip_building_metatags only: [:index] # # def index # @articles = Article.all # end # # def show # end # # protected # # def find_article # @article = Article.find(params[:id]) # end # end module Metatags module Concerns module Controller extend ActiveSupport::Concern included do class_attribute :metatags_class, :metatags_instance_sym initialize_metatags_class before_action :build_default_meta_tags attr_accessor :meta_tags helper_method :meta_tags end module ClassMethods ## Example: # # class TeamsController # build_meta_tags with: Metatags::TeamMetatags, instance: :team # end # ## The code above will build an instance of the Metatags::TeamMetatags class ## with `@team` if present. # def build_meta_tags(options = {}) self.metatags_class = options.delete(:with) self.metatags_instance_sym = options.delete(:instance) skip_before_action :build_default_meta_tags, options before_action :build_meta_tags_with_instance, options end def skip_building_meta_tags(options = {}) skip_before_action :build_default_meta_tags, options end def initialize_metatags_class self.metatags_class = "Metatags::AppMetatags".safe_constantize || Metatags::BaseMetatags end end protected # Builds the meta_tags using either the class passed by the user with the `with` # option or a class which name is inferred from the controller name. # def build_default_meta_tags klass = metatags_class || default_metatags_class build_meta_tags(with: klass, instance: metatags_instance) end alias_method :build_meta_tags_with_instance, :build_default_meta_tags def metatags_instance return nil unless metatags_instance_sym instance_variable_get("@#{metatags_instance_sym}") end # Infers the metatags class name from the controller name by default. # # The default class can be overriden with the `with` option of `build_meta_tags` # def default_metatags_class inferred_name = self.class.name.gsub("Controller", "").singularize [ # Metatags::Manage::TeamMetatags::Index "Metatags::#{inferred_name}Metatags::#{action_name.classify}", # Metatags::Manage::TeamMetatags "Metatags::#{inferred_name}Metatags", # Metatags::TeamMetatags::Index "Metatags::#{inferred_name.split("::").last}Metatags::#{action_name.classify}", # Metatags::TeamMetatags "Metatags::#{inferred_name.split("::").last}Metatags", # Metatags::AppMetatags "Metatags::AppMetatags", # Metatags::BaseMetatags "Metatags::BaseMetatags" ].detect do |class_name| klass = class_name.safe_constantize break klass if klass end end # This method is useful when the class name of the Metatags class cannot # be inferred by the gem. # # Ex: # # class TeamsController # def show # if special_case? # build_meta_tags with: Metatags::SpecialMetatags, instance: :team # end # end # end # def build_meta_tags(with: Metatags::BaseMetatags, instance: nil) self.meta_tags = with.new(instance, view_context) end end end end
module.exports = [ "Open", "WIP", "Resolved", "Non Issue" ];
package typingsSlinky.googleapis.driveactivityV2Mod.driveactivityV2 import org.scalablytyped.runtime.StObject import scala.scalajs.js import scala.scalajs.js.`|` import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess} /** * Information about the owner of a Drive item. */ @js.native trait SchemaOwner extends StObject { /** * The domain of the Drive item owner. */ var domain: js.UndefOr[SchemaDomain] = js.native /** * The Team Drive that owns the Drive item. */ var teamDrive: js.UndefOr[SchemaTeamDriveReference] = js.native /** * The user that owns the Drive item. */ var user: js.UndefOr[SchemaUser] = js.native } object SchemaOwner { @scala.inline def apply(): SchemaOwner = { val __obj = js.Dynamic.literal() __obj.asInstanceOf[SchemaOwner] } @scala.inline implicit class SchemaOwnerMutableBuilder[Self <: SchemaOwner] (val x: Self) extends AnyVal { @scala.inline def setDomain(value: SchemaDomain): Self = StObject.set(x, "domain", value.asInstanceOf[js.Any]) @scala.inline def setDomainUndefined: Self = StObject.set(x, "domain", js.undefined) @scala.inline def setTeamDrive(value: SchemaTeamDriveReference): Self = StObject.set(x, "teamDrive", value.asInstanceOf[js.Any]) @scala.inline def setTeamDriveUndefined: Self = StObject.set(x, "teamDrive", js.undefined) @scala.inline def setUser(value: SchemaUser): Self = StObject.set(x, "user", value.asInstanceOf[js.Any]) @scala.inline def setUserUndefined: Self = StObject.set(x, "user", js.undefined) } }
## Deploy / Update 1. Check files and replace "xxx.xxx.xxx.xxx" with your host IP address 2. Add new servers fingerprint to known hosts 3. Run: `ansible-playbook site.yml --ask-pass`
import { Button, Link, Popover, PopoverArrow, PopoverBody, PopoverCloseButton, PopoverContent, PopoverHeader, PopoverTrigger, } from "@chakra-ui/react"; import { SITE_PATHS } from "app/routes"; import { useHistory } from "react-router-dom"; function CancelLink() { const history = useHistory(); return ( <Popover> {() => ( <> <PopoverTrigger> <Link textDecoration="underline" color="red.400" fontSize={{ base: "sm", lg: "md" }} > Cancel </Link> </PopoverTrigger> <PopoverContent alignItems="center" maxW={{ base: "3xs", lg: "2xs" }}> <PopoverArrow /> <PopoverCloseButton /> <PopoverHeader> Are you sure you want to cancel the transfer? </PopoverHeader> <PopoverBody> <Button colorScheme="blue" onClick={async () => { history.push(SITE_PATHS.HOME); }} > Yes </Button> </PopoverBody> </PopoverContent> </> )} </Popover> ); } export default CancelLink;
begin # Starting at the current directory, recursively reads one or more # Nuxeo export files. From these, packages up records in an import file # that can be read by the CollectionSpace Import service. # IMPORTANT: # This script does NOT: # * Perform any cleanup of records, if that may also be needed. # * Generate or insert CSIDs, or macro tags for same. # Any work of this type must still be done manually. # Requires Ruby 1.8 or later, which includes the REXML library require "rexml/document" # ------------------------------------- # Configuration # ------------------------------------- # Name of the service into which records will be imported. servicename = "Persons" # The record type to be imported. recordtype = "Person" # An array of one or more schema(s) to be extracted from the # export file(s), to be included in records in the import file. schemas = [ "persons_common" ] # ------------------------------------- # Defaults # ------------------------------------- # Name of the export file(s) that will be read in, # whose data will be used to create the import file. export_filename = 'document.xml' # Name of the import file to create. (If the file exists, # it will be overwritten each time this script is run.) import_filename = 'import.xml' # XPath that is expected to match one or more elements # in a valid Nuxeo export file expected_export_xpath = "/document[@repository]" # ------------------------------------- f = File.open(import_filename, "w+") f.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n") f.write("<imports>\n") recordcount = 0 Dir.glob("**") do |dir| if File.directory?(dir) else next end path = dir + '/' + export_filename begin puts "Reading file " + path export_file = File.new( path ) rescue Exception => e puts "[ERROR] Could not read file: " + e.message next end export_doc = REXML::Document.new export_file root = export_doc.root # Simplistic check that this looks like a Nuxeo export file. if (root.elements[expected_export_xpath].nil?) puts "[ERROR] File may not be a Nuxeo export file; " + "was skipped." next end # Extract the specified schema block(s) from the export file. parts = [] for schema in schemas schema_xpath = "schema[@name='" + schema + "']" unless root.elements[schema_xpath].nil? parts << root.elements[schema_xpath].to_s end end # Create a corresponding record entry in the import file. if (parts.length > 0) f.write(" <import service=\"" + servicename + "\"") f.write(" type=\"" + recordtype + "\">\n") # Insert each schema block extracted from the export file # into the record entry. for part in parts f.write(" " + part + "\n") end f.write(" </import>\n") recordcount += 1 end end f.write("</imports>\n") f.close puts "Wrote " + recordcount.to_s + " record(s)" + " to import file " + import_filename end
package com.github.parkee.wit.converse.entity import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonValue enum class ConverseResultType(private val type: String) { MERGE("merge"), // first bot action after a user message MSG("msg"), // the bot has something to say ACTION("action"), // the bot has something to do ERROR("error"), STOP("stop"); // the bot is waiting to proceed @JsonCreator fun fromString(type: String?): ConverseResultType? { type ?: return null return ConverseResultType.valueOf(type) } @JsonValue override fun toString(): String { return type } }
#Experiment_s Run_s SRX1772607 SRR3541306 SRX1772608 SRR3541307 SRX1772609 SRR3541308 SRX1772611 SRR3541310 SRX1772610 SRR3541309 SRX1772612 SRR3541311 SRX1772613 SRR3541312 SRX1772614 SRR3541313 SRX1772615 SRR3541314 SRX1772617 SRR3541316 SRX1772616 SRR3541315 SRX1772618 SRR3541317 SRX1772620 SRR3541319 SRX1772619 SRR3541318 SRX1772621 SRR3541320 SRX1772622 SRR3541321 SRX1772623 SRR3541322 SRX1772624 SRR3541323 SRX1772625 SRR3541324 SRX1772626 SRR3541325 SRX1772627 SRR3541326 SRX1772606 SRR3541305 SRX1772604 SRR3541303 SRX1772630 SRR3541329 SRX1772631 SRR3541330 SRX1772632 SRR3541331 SRX1772633 SRR3541332 SRX1772635 SRR3541334 SRX1772634 SRR3541333 SRX1772636 SRR3541335 SRX1772637 SRR3541336 SRX1772605 SRR3541304 SRX1772628 SRR3541327 SRX1772629 SRR3541328 SRX1772638 SRR3541337 SRX1772639 SRR3541338 SRX1772640 SRR3541339 SRX1772641 SRR3541340 SRX1772642 SRR3541341 SRX1772643 SRR3541342 SRX1772644 SRR3541343 SRX1772645 SRR3541344 SRX1772646 SRR3541345 SRX1772647 SRR3541346 SRX1772648 SRR3541347 SRX1772649 SRR3541348 SRX1772650 SRR3541349 SRX1772651 SRR3541350 SRX1772652 SRR3541351 SRX1772653 SRR3541352 SRX1772654 SRR3541353 SRX1772655 SRR3541354 SRX1772656 SRR3541355 SRX1772657 SRR3541356 SRX1772658 SRR3541357 SRX1772659 SRR3541358 SRX1772660 SRR3541359 SRX1772661 SRR3541360 SRX1772662 SRR3541361 SRX1772663 SRR3541362 SRX1772664 SRR3541363 SRX1772665 SRR3541364 SRX1772666 SRR3541365 SRX1772667 SRR3541366 SRX1772668 SRR3541367 SRX1772669 SRR3541368 SRX1772670 SRR3541369 SRX1772671 SRR3541370 SRX1772672 SRR3541371 SRX1772673 SRR3541372 SRX1772674 SRR3541373 SRX1772675 SRR3541374 SRX1772676 SRR3541375 SRX1772677 SRR3541376 SRX1772678 SRR3541377 SRX1772679 SRR3541378 SRX1772680 SRR3541379 SRX1772681 SRR3541380 SRX1772682 SRR3541381 SRX1772683 SRR3541382 SRX1772684 SRR3541383 SRX1772685 SRR3541384 SRX1772686 SRR3541385 SRX1772687 SRR3541386 SRX1772688 SRR3541387 SRX1772689 SRR3541388 SRX1772690 SRR3541389 SRX1772691 SRR3541390 SRX1772692 SRR3541391 SRX1772693 SRR3541392 SRX1772694 SRR3541393 SRX1772695 SRR3541394 SRX1772696 SRR3541395 SRX1772697 SRR3541396 SRX1772698 SRR3541397 SRX1772699 SRR3541398 SRX1772700 SRR3541399 SRX1772701 SRR3541400 SRX1772702 SRR3541401 SRX1772703 SRR3541402 SRX1772704 SRR3541403 SRX1772705 SRR3541404 SRX1772706 SRR3541405 SRX1772707 SRR3541406 SRX1772708 SRR3541407 SRX1772709 SRR3541408 SRX1772710 SRR3541409 SRX1772711 SRR3541410 SRX1772712 SRR3541411 SRX1772713 SRR3541412 SRX1772714 SRR3541413 SRX1772715 SRR3541414 SRX1772716 SRR3541415 SRX1772717 SRR3541416 SRX1772718 SRR3541417 SRX1772719 SRR3541418 SRX1772720 SRR3541419 SRX1772721 SRR3541420 SRX1772722 SRR3541421 SRX1772723 SRR3541422 SRX1772724 SRR3541423 SRX1772725 SRR3541424 SRX1772726 SRR3541425 SRX1772727 SRR3541426 SRX1772728 SRR3541427 SRX1772729 SRR3541428 SRX1772730 SRR3541429 SRX1772731 SRR3541430 SRX1772732 SRR3541431 SRX1772733 SRR3541432 SRX1772734 SRR3541433 SRX1772735 SRR3541434 SRX1772736 SRR3541435 SRX1772737 SRR3541436 SRX1772738 SRR3541437 SRX1772739 SRR3541438 SRX1772740 SRR3541439 SRX1772741 SRR3541440 SRX1772742 SRR3541441 SRX1772743 SRR3541442 SRX1772744 SRR3541443 SRX1772745 SRR3541444 SRX1772746 SRR3541445 SRX1772747 SRR3541446 SRX1772748 SRR3541447 SRX1772749 SRR3541448 SRX1772750 SRR3541449 SRX1772751 SRR3541450 SRX1772752 SRR3541451 SRX1772753 SRR3541452 SRX1772754 SRR3541453 SRX1772755 SRR3541454 SRX1772756 SRR3541455 SRX1772757 SRR3541456 SRX1772758 SRR3541457 SRX1772759 SRR3541458 SRX1772760 SRR3541459 SRX1772761 SRR3541460 SRX1772762 SRR3541461 SRX1772763 SRR3541462 SRX1772764 SRR3541463 SRX1772765 SRR3541464 SRX1772766 SRR3541465 SRX1772767 SRR3541466 SRX1772768 SRR3541467 SRX1772769 SRR3541468 SRX1772770 SRR3541469 SRX1772771 SRR3541470 SRX1772772 SRR3541471 SRX1772773 SRR3541472 SRX1772774 SRR3541473 SRX1772775 SRR3541474 SRX1772776 SRR3541475 SRX1772777 SRR3541476 SRX1772778 SRR3541477 SRX1772779 SRR3541478 SRX1772780 SRR3541479 SRX1772781 SRR3541480 SRX1772782 SRR3541481 SRX1772783 SRR3541482 SRX1772784 SRR3541483 SRX1772785 SRR3541484 SRX1772786 SRR3541485 SRX1772787 SRR3541486 SRX1772788 SRR3541487 SRX1772789 SRR3541488 SRX1772790 SRR3541489 SRX1772791 SRR3541490 SRX1772792 SRR3541491 SRX1772793 SRR3541492 SRX1772794 SRR3541493 SRX1772795 SRR3541494 SRX1772796 SRR3541495 SRX1772797 SRR3541496 SRX1772798 SRR3541497 SRX1772799 SRR3541498 SRX1772800 SRR3541499 SRX1772801 SRR3541500 SRX1772802 SRR3541501 SRX1772803 SRR3541502 SRX1772804 SRR3541503 SRX1772805 SRR3541504 SRX1772806 SRR3541505 SRX1772807 SRR3541506 SRX1772808 SRR3541507 SRX1772809 SRR3541508 SRX1772810 SRR3541509 SRX1772811 SRR3541510 SRX1772812 SRR3541511 SRX1772813 SRR3541512 SRX1772814 SRR3541513 SRX1772815 SRR3541514 SRX1772816 SRR3541515 SRX1772817 SRR3541516 SRX1772818 SRR3541517 SRX1772819 SRR3541518 SRX1772820 SRR3541519 SRX1772821 SRR3541520 SRX1772822 SRR3541521 SRX1772823 SRR3541522 SRX1772824 SRR3541523 SRX1772825 SRR3541524 SRX1772826 SRR3541525 SRX1772827 SRR3541526 SRX1772828 SRR3541527 SRX1772829 SRR3541528 SRX1772830 SRR3541529 SRX1772831 SRR3541530 SRX1772832 SRR3541531 SRX1772833 SRR3541532 SRX1772834 SRR3541533 SRX1772835 SRR3541534 SRX1772836 SRR3541535 SRX1772837 SRR3541536 SRX1772838 SRR3541537 SRX1772839 SRR3541538 SRX1772840 SRR3541539 SRX1772841 SRR3541540 SRX1772842 SRR3541541 SRX1772843 SRR3541542 SRX1772844 SRR3541543 SRX1772845 SRR3541544 SRX1772846 SRR3541545 SRX1772847 SRR3541546 SRX1772848 SRR3541547 SRX1772849 SRR3541548 SRX1772850 SRR3541549 SRX1772851 SRR3541550 SRX1772852 SRR3541551 SRX1772853 SRR3541552 SRX1772854 SRR3541553 SRX1772855 SRR3541554 SRX1772856 SRR3541555 SRX1772857 SRR3541556 SRX1772858 SRR3541557 SRX1772859 SRR3541558 SRX1772860 SRR3541559 SRX1772861 SRR3541560 SRX1772862 SRR3541561 SRX1772863 SRR3541562 SRX1772864 SRR3541563 SRX1772865 SRR3541564 SRX1772866 SRR3541565 SRX1772867 SRR3541566 SRX1772868 SRR3541567 SRX1772869 SRR3541568 SRX1772870 SRR3541569 SRX1772871 SRR3541570 SRX1772872 SRR3541571 SRX1772873 SRR3541572 SRX1772874 SRR3541573 SRX1772875 SRR3541574 SRX1772876 SRR3541575 SRX1772877 SRR3541576 SRX1772878 SRR3541577 SRX1772879 SRR3541578 SRX1772880 SRR3541579 SRX1772881 SRR3541580 SRX1772882 SRR3541581 SRX1772883 SRR3541582 SRX1772884 SRR3541583 SRX1772885 SRR3541584 SRX1772886 SRR3541585 SRX1772887 SRR3541586 SRX1772888 SRR3541587 SRX1772889 SRR3541588 SRX1772890 SRR3541589 SRX1772891 SRR3541590 SRX1772892 SRR3541591 SRX1772893 SRR3541592 SRX1772894 SRR3541593 SRX1772895 SRR3541594 SRX1772896 SRR3541595 SRX1772897 SRR3541596 SRX1772898 SRR3541597 SRX1772899 SRR3541598 SRX1772900 SRR3541599 SRX1772901 SRR3541600 SRX1772902 SRR3541601 SRX1772903 SRR3541602 SRX1772904 SRR3541603 SRX1772905 SRR3541604 SRX1772906 SRR3541605 SRX1772907 SRR3541606 SRX1772908 SRR3541607 SRX1772909 SRR3541608 SRX1772910 SRR3541609 SRX1772911 SRR3541610 SRX1772912 SRR3541611 SRX1772913 SRR3541612 SRX1772914 SRR3541613 SRX1772915 SRR3541614 SRX1772916 SRR3541615 SRX1772917 SRR3541616 SRX1772918 SRR3541617 SRX1772919 SRR3541618 SRX1772920 SRR3541619 SRX1772921 SRR3541620 SRX1772922 SRR3541621 SRX1772923 SRR3541622 SRX1772924 SRR3541623 SRX1772925 SRR3541624 SRX1772926 SRR3541625 SRX1772927 SRR3541626 SRX1772928 SRR3541627 SRX1772929 SRR3541628 SRX1772930 SRR3541629 SRX1772931 SRR3541630 SRX1772932 SRR3541631 SRX1772933 SRR3541632 SRX1772934 SRR3541633 SRX1772935 SRR3541634 SRX1772936 SRR3541635 SRX1772937 SRR3541636 SRX1772938 SRR3541637 SRX1772939 SRR3541638 SRX1772940 SRR3541639 SRX1772941 SRR3541640 SRX1772942 SRR3541641 SRX1772943 SRR3541642 SRX1772944 SRR3541643 SRX1772945 SRR3541644 SRX1772946 SRR3541645 SRX1772947 SRR3541646 SRX1772948 SRR3541647 SRX1772949 SRR3541648 SRX1772950 SRR3541649 SRX1772951 SRR3541650 SRX1772952 SRR3541651 SRX1772953 SRR3541652 SRX1772954 SRR3541653 SRX1772955 SRR3541654 SRX1772956 SRR3541655 SRX1772957 SRR3541656 SRX1772958 SRR3541657 SRX1772959 SRR3541658 SRX1772960 SRR3541659 SRX1772961 SRR3541660 SRX1772962 SRR3541661 SRX1772963 SRR3541662 SRX1772964 SRR3541663 SRX1772965 SRR3541664 SRX1772966 SRR3541665 SRX1772967 SRR3541666 SRX1772968 SRR3541667 SRX1772969 SRR3541668 SRX1772970 SRR3541669 SRX1772971 SRR3541670 SRX1772972 SRR3541671 SRX1772973 SRR3541672 SRX1772974 SRR3541673 SRX1772975 SRR3541674 SRX1772976 SRR3541675 SRX1772977 SRR3541676 SRX1772978 SRR3541677 SRX1772979 SRR3541678 SRX1772980 SRR3541679 SRX1772981 SRR3541680 SRX1772982 SRR3541681 SRX1772983 SRR3541682 SRX1772984 SRR3541683 SRX1772985 SRR3541684 SRX1772986 SRR3541685 SRX1772987 SRR3541686 SRX1772988 SRR3541687 SRX1772989 SRR3541688 SRX1772990 SRR3541689 SRX1772991 SRR3541690 SRX1772992 SRR3541691 SRX1772993 SRR3541692 SRX1772994 SRR3541693 SRX1772995 SRR3541694 SRX1772996 SRR3541695 SRX1772997 SRR3541696 SRX1772998 SRR3541697 SRX1772999 SRR3541698 SRX1773000 SRR3541699 SRX1773001 SRR3541700 SRX1773002 SRR3541701 SRX1773003 SRR3541702 SRX1773004 SRR3541703 SRX1773005 SRR3541704 SRX1773006 SRR3541705 SRX1773007 SRR3541706 SRX1773008 SRR3541707 SRX1773009 SRR3541708 SRX1773010 SRR3541709 SRX1773011 SRR3541710 SRX1773012 SRR3541711 SRX1773013 SRR3541712 SRX1773014 SRR3541713 SRX1773015 SRR3541714 SRX1773016 SRR3541715 SRX1773017 SRR3541716 SRX1773018 SRR3541717 SRX1773019 SRR3541718 SRX1773020 SRR3541719 SRX1773021 SRR3541720 SRX1773022 SRR3541721 SRX1773023 SRR3541722 SRX1773024 SRR3541723 SRX1773025 SRR3541724 SRX1773026 SRR3541725 SRX1773027 SRR3541726 SRX1773028 SRR3541727 SRX1773029 SRR3541728 SRX1773030 SRR3541729 SRX1773031 SRR3541730 SRX1773032 SRR3541731 SRX1773033 SRR3541732 SRX1773034 SRR3541733 SRX1773035 SRR3541734 SRX1773036 SRR3541735 SRX1773037 SRR3541736 SRX1773038 SRR3541737 SRX1773039 SRR3541738 SRX1773040 SRR3541739 SRX1773041 SRR3541740 SRX1773042 SRR3541741 SRX1773043 SRR3541742 SRX1773044 SRR3541743 SRX1773045 SRR3541744 SRX1773046 SRR3541745 SRX1773047 SRR3541746 SRX1773048 SRR3541747 SRX1773049 SRR3541748 SRX1773050 SRR3541749 SRX1773051 SRR3541750 SRX1773052 SRR3541751 SRX1773053 SRR3541752 SRX1773054 SRR3541753 SRX1773055 SRR3541754 SRX1773056 SRR3541755 SRX1773057 SRR3541756 SRX1773058 SRR3541757 SRX1773059 SRR3541758 SRX1773060 SRR3541759 SRX1773061 SRR3541760 SRX1773062 SRR3541761 SRX1773063 SRR3541762 SRX1773064 SRR3541763 SRX1773065 SRR3541764 SRX1773066 SRR3541765 SRX1773067 SRR3541766 SRX1773068 SRR3541767 SRX1773069 SRR3541768 SRX1773070 SRR3541769 SRX1773071 SRR3541770 SRX1773072 SRR3541771 SRX1773073 SRR3541772 SRX1773074 SRR3541773 SRX1773075 SRR3541774 SRX1773076 SRR3541775 SRX1773077 SRR3541776 SRX1773078 SRR3541777 SRX1773079 SRR3541778 SRX1773080 SRR3541779 SRX1773081 SRR3541780 SRX1773082 SRR3541781 SRX1773083 SRR3541782 SRX1773084 SRR3541783 SRX1773085 SRR3541784 SRX1773086 SRR3541785 SRX1773087 SRR3541786 SRX1773088 SRR3541787 SRX1773089 SRR3541788 SRX1773090 SRR3541789 SRX1773091 SRR3541790 SRX1773092 SRR3541791 SRX1773093 SRR3541792 SRX1773094 SRR3541793 SRX1773095 SRR3541794 SRX1773096 SRR3541795 SRX1773097 SRR3541796 SRX1773098 SRR3541797 SRX1773099 SRR3541798 SRX1773100 SRR3541799 SRX1773101 SRR3541800 SRX1773102 SRR3541801 SRX1773103 SRR3541802 SRX1773104 SRR3541803 SRX1773105 SRR3541804 SRX1773106 SRR3541805 SRX1773107 SRR3541806 SRX1773108 SRR3541807 SRX1773109 SRR3541808 SRX1773110 SRR3541809 SRX1773111 SRR3541810 SRX1773112 SRR3541811 SRX1773113 SRR3541812 SRX1773114 SRR3541813 SRX1773115 SRR3541814 SRX1773116 SRR3541815 SRX1773117 SRR3541816 SRX1773118 SRR3541817 SRX1773119 SRR3541818 SRX1773120 SRR3541819 SRX1773121 SRR3541820 SRX1773122 SRR3541821 SRX1773123 SRR3541822 SRX1773124 SRR3541823 SRX1773125 SRR3541824 SRX1773126 SRR3541825 SRX1773127 SRR3541826 SRX1773128 SRR3541827 SRX1773129 SRR3541828 SRX1773130 SRR3541829 SRX1773131 SRR3541830 SRX1773132 SRR3541831 SRX1773133 SRR3541832 SRX1773134 SRR3541833 SRX1773135 SRR3541834 SRX1773136 SRR3541835 SRX1773137 SRR3541836 SRX1773138 SRR3541837 SRX1773139 SRR3541838 SRX1773140 SRR3541839 SRX1773141 SRR3541840 SRX1773142 SRR3541841 SRX1773143 SRR3541842 SRX1773144 SRR3541843 SRX1773145 SRR3541844 SRX1773146 SRR3541845 SRX1773147 SRR3541846 SRX1773148 SRR3541847 SRX1773149 SRR3541848 SRX1773150 SRR3541849 SRX1773151 SRR3541850 SRX1773152 SRR3541851 SRX1773153 SRR3541852 SRX1773154 SRR3541853 SRX1773155 SRR3541854 SRX1773156 SRR3541855 SRX1773157 SRR3541856 SRX1773158 SRR3541857 SRX1773159 SRR3541858 SRX1773160 SRR3541859 SRX1773161 SRR3541860 SRX1773162 SRR3541861 SRX1773163 SRR3541862 SRX1773164 SRR3541863 SRX1773165 SRR3541864 SRX1773166 SRR3541865 SRX1773167 SRR3541866 SRX1773168 SRR3541867 SRX1773169 SRR3541868 SRX1773170 SRR3541869 SRX1773171 SRR3541870 SRX1773172 SRR3541871 SRX1773173 SRR3541872 SRX1773174 SRR3541873 SRX1773175 SRR3541874 SRX1773176 SRR3541875 SRX1773177 SRR3541876 SRX1773178 SRR3541877 SRX1773179 SRR3541878 SRX1773180 SRR3541879 SRX1773181 SRR3541880 SRX1773182 SRR3541881 SRX1773183 SRR3541882 SRX1773184 SRR3541883 SRX1773185 SRR3541884 SRX1773186 SRR3541885 SRX1773187 SRR3541886 SRX1773188 SRR3541887 SRX1773189 SRR3541888 SRX1773190 SRR3541889 SRX1773191 SRR3541890 SRX1773192 SRR3541891 SRX1773193 SRR3541892 SRX1773194 SRR3541893 SRX1773195 SRR3541894 SRX1773196 SRR3541895 SRX1773197 SRR3541896 SRX1773198 SRR3541897 SRX1773199 SRR3541898 SRX1773200 SRR3541899 SRX1773201 SRR3541900 SRX1773202 SRR3541901 SRX1773203 SRR3541902 SRX1773204 SRR3541903 SRX1773205 SRR3541904 SRX1773206 SRR3541905 SRX1773207 SRR3541906 SRX1773208 SRR3541907 SRX1773209 SRR3541908 SRX1773210 SRR3541909 SRX1773211 SRR3541910 SRX1773212 SRR3541911 SRX1773213 SRR3541912 SRX1773214 SRR3541913 SRX1773215 SRR3541914 SRX1773216 SRR3541915 SRX1773217 SRR3541916 SRX1773218 SRR3541917 SRX1773219 SRR3541918 SRX1773220 SRR3541919 SRX1773221 SRR3541920 SRX1773222 SRR3541921 SRX1773223 SRR3541922 SRX1773224 SRR3541923 SRX1773225 SRR3541924 SRX1773226 SRR3541925 SRX1773227 SRR3541926 SRX1773228 SRR3541927 SRX1773229 SRR3541928 SRX1773230 SRR3541929 SRX1773231 SRR3541930 SRX1773232 SRR3541931 SRX1773233 SRR3541932 SRX1773234 SRR3541933 SRX1773235 SRR3541934 SRX1773236 SRR3541935 SRX1773237 SRR3541936 SRX1773238 SRR3541937 SRX1773239 SRR3541938 SRX1773240 SRR3541939 SRX1773241 SRR3541940 SRX1773242 SRR3541941 SRX1773243 SRR3541942 SRX1773244 SRR3541943 SRX1773245 SRR3541944 SRX1773246 SRR3541945 SRX1773247 SRR3541946 SRX1773248 SRR3541947 SRX1773249 SRR3541948 SRX1773250 SRR3541949 SRX1773251 SRR3541950 SRX1773252 SRR3541951 SRX1773253 SRR3541952 SRX1773254 SRR3541953 SRX1773255 SRR3541954 SRX1773256 SRR3541955 SRX1773257 SRR3541956 SRX1773258 SRR3541957 SRX1773259 SRR3541958 SRX1773260 SRR3541959 SRX1773261 SRR3541960 SRX1773262 SRR3541961 SRX1773263 SRR3541962 SRX1773264 SRR3541963 SRX1773265 SRR3541964 SRX1773266 SRR3541965 SRX1773267 SRR3541966 SRX1773268 SRR3541967 SRX1773269 SRR3541968 SRX1773270 SRR3541969 SRX1773271 SRR3541970 SRX1773272 SRR3541971 SRX1773273 SRR3541972 SRX1773274 SRR3541973 SRX1773275 SRR3541974 SRX1773276 SRR3541975 SRX1773277 SRR3541976 SRX1773278 SRR3541977 SRX1773279 SRR3541978 SRX1773280 SRR3541979 SRX1773281 SRR3541980 SRX1773282 SRR3541981 SRX1773283 SRR3541982 SRX1773284 SRR3541983 SRX1773285 SRR3541984 SRX1773286 SRR3541985 SRX1773287 SRR3541986 SRX1773288 SRR3541987 SRX1773289 SRR3541988 SRX1773290 SRR3541989 SRX1773291 SRR3541990 SRX1773292 SRR3541991 SRX1773293 SRR3541992 SRX1773294 SRR3541993 SRX1773295 SRR3541994 SRX1773296 SRR3541995 SRX1773297 SRR3541996 SRX1773298 SRR3541997 SRX1773299 SRR3541998 SRX1773300 SRR3541999 SRX1773301 SRR3542000 SRX1773302 SRR3542001 SRX1773303 SRR3542002 SRX1773304 SRR3542003 SRX1773305 SRR3542004 SRX1773306 SRR3542005 SRX1773307 SRR3542006 SRX1773308 SRR3542007 SRX1773309 SRR3542008 SRX1773310 SRR3542009 SRX1773311 SRR3542010 SRX1773312 SRR3542011 SRX1773313 SRR3542012 SRX1773314 SRR3542013 SRX1773315 SRR3542014 SRX1773316 SRR3542015 SRX1773317 SRR3542016 SRX1773318 SRR3542017 SRX1773319 SRR3542018 SRX1773320 SRR3542019 SRX1773321 SRR3542020 SRX1773322 SRR3542021 SRX1773323 SRR3542022 SRX1773324 SRR3542023 SRX1773325 SRR3542024 SRX1773326 SRR3542025 SRX1773327 SRR3542026 SRX1773328 SRR3542027 SRX1773329 SRR3542028 SRX1773330 SRR3542029 SRX1773331 SRR3542030 SRX1773332 SRR3542031 SRX1773333 SRR3542032 SRX1773334 SRR3542033 SRX1773335 SRR3542034 SRX1773336 SRR3542035 SRX1773337 SRR3542036 SRX1773338 SRR3542037 SRX1773339 SRR3542038 SRX1773340 SRR3542039 SRX1773341 SRR3542040 SRX1773342 SRR3542041 SRX1773343 SRR3542042 SRX1773344 SRR3542043 SRX1773345 SRR3542044 SRX1773346 SRR3542045 SRX1773347 SRR3542046 SRX1773348 SRR3542047 SRX1773349 SRR3542048 SRX1773350 SRR3542049 SRX1773351 SRR3542050 SRX1773352 SRR3542051 SRX1773353 SRR3542052 SRX1773354 SRR3542053 SRX1773355 SRR3542054 SRX1773356 SRR3542055 SRX1773357 SRR3542056 SRX1773358 SRR3542057 SRX1773359 SRR3542058 SRX1773360 SRR3542059 SRX1773361 SRR3542060 SRX1773362 SRR3542061 SRX1773363 SRR3542062 SRX1773364 SRR3542063 SRX1773365 SRR3542064 SRX1773366 SRR3542065 SRX1773367 SRR3542066 SRX1773368 SRR3542067 SRX1773369 SRR3542068 SRX1773370 SRR3542069 SRX1773371 SRR3542070 SRX1773372 SRR3542071 SRX1773373 SRR3542072 SRX1773374 SRR3542073 SRX1773375 SRR3542074 SRX1773376 SRR3542075 SRX1773377 SRR3542076 SRX1773378 SRR3542077 SRX1773379 SRR3542078 SRX1773380 SRR3542079 SRX1773381 SRR3542080 SRX1773382 SRR3542081 SRX1773383 SRR3542082 SRX1773384 SRR3542083 SRX1773385 SRR3542084 SRX1773386 SRR3542085 SRX1773387 SRR3542086 SRX1773388 SRR3542087 SRX1773389 SRR3542088 SRX1773390 SRR3542089 SRX1773391 SRR3542090 SRX1773392 SRR3542091 SRX1773393 SRR3542092 SRX1773394 SRR3542093 SRX1773395 SRR3542094 SRX1773396 SRR3542095 SRX1773397 SRR3542096 SRX1773398 SRR3542097 SRX1773399 SRR3542098 SRX1773400 SRR3542099 SRX1773401 SRR3542100 SRX1773402 SRR3542101 SRX1773403 SRR3542102 SRX1773404 SRR3542103 SRX1773405 SRR3542104 SRX1773406 SRR3542105 SRX1773407 SRR3542106 SRX1773408 SRR3542107 SRX1773409 SRR3542108 SRX1773410 SRR3542109 SRX1773411 SRR3542110 SRX1773412 SRR3542111 SRX1773413 SRR3542112 SRX1773414 SRR3542113 SRX1773415 SRR3542114 SRX1773416 SRR3542115 SRX1773417 SRR3542116 SRX1773418 SRR3542117 SRX1773419 SRR3542118 SRX1773420 SRR3542119 SRX1773421 SRR3542120 SRX1773422 SRR3542121 SRX1773423 SRR3542122 SRX1773424 SRR3542123 SRX1773425 SRR3542124 SRX1773426 SRR3542125 SRX1773427 SRR3542126 SRX1773428 SRR3542127 SRX1773429 SRR3542128 SRX1773430 SRR3542129 SRX1773431 SRR3542130 SRX1773432 SRR3542131 SRX1773433 SRR3542132 SRX1773434 SRR3542133 SRX1773435 SRR3542134 SRX1773436 SRR3542135 SRX1773437 SRR3542136 SRX1773438 SRR3542137 SRX1773439 SRR3542138 SRX1773440 SRR3542139 SRX1773441 SRR3542140 SRX1773442 SRR3542141 SRX1773443 SRR3542142 SRX1773444 SRR3542143 SRX1773445 SRR3542144 SRX1773446 SRR3542145 SRX1773447 SRR3542146 SRX1773448 SRR3542147 SRX1773449 SRR3542148 SRX1773450 SRR3542149 SRX1773451 SRR3542150 SRX1773452 SRR3542151 SRX1773453 SRR3542152 SRX1773454 SRR3542153 SRX1773455 SRR3542154 SRX1773456 SRR3542155 SRX1773457 SRR3542156 SRX1773458 SRR3542157 SRX1773459 SRR3542158 SRX1773460 SRR3542159 SRX1773461 SRR3542160 SRX1773462 SRR3542161 SRX1773463 SRR3542162 SRX1773464 SRR3542163 SRX1773465 SRR3542164 SRX1773466 SRR3542165 SRX1773467 SRR3542166 SRX1773468 SRR3542167 SRX1773469 SRR3542168 SRX1773470 SRR3542169 SRX1773471 SRR3542170 SRX1773472 SRR3542171 SRX1773473 SRR3542172 SRX1773474 SRR3542173 SRX1773475 SRR3542174 SRX1773476 SRR3542175 SRX1773477 SRR3542176 SRX1773478 SRR3542177 SRX1773479 SRR3542178 SRX1773480 SRR3542179 SRX1773481 SRR3542180 SRX1773482 SRR3542181 SRX1773483 SRR3542182 SRX1773484 SRR3542183 SRX1773485 SRR3542184 SRX1773486 SRR3542185 SRX1773487 SRR3542186 SRX1773488 SRR3542187 SRX1773489 SRR3542188 SRX1773490 SRR3542189 SRX1773491 SRR3542190 SRX1773492 SRR3542191 SRX1773493 SRR3542192 SRX1773494 SRR3542193 SRX1773495 SRR3542194 SRX1773496 SRR3542195 SRX1773497 SRR3542196 SRX1773498 SRR3542197 SRX1773499 SRR3542198 SRX1773500 SRR3542199 SRX1773501 SRR3542200 SRX1773502 SRR3542201 SRX1773503 SRR3542202 SRX1773504 SRR3542203 SRX1773505 SRR3542204 SRX1773506 SRR3542205 SRX1773507 SRR3542206 SRX1773508 SRR3542207 SRX1773509 SRR3542208 SRX1773510 SRR3542209 SRX1773511 SRR3542210 SRX1773512 SRR3542211 SRX1773513 SRR3542212 SRX1773514 SRR3542213 SRX1773515 SRR3542214 SRX1773516 SRR3542215 SRX1773517 SRR3542216 SRX1773518 SRR3542217 SRX1773519 SRR3542218 SRX1773520 SRR3542219 SRX1773521 SRR3542220 SRX1773522 SRR3542221 SRX1773523 SRR3542222 SRX1773524 SRR3542223 SRX1773525 SRR3542224 SRX1773526 SRR3542225 SRX1773527 SRR3542226 SRX1773528 SRR3542227 SRX1773529 SRR3542228 SRX1773530 SRR3542229 SRX1773531 SRR3542230 SRX1773532 SRR3542231 SRX1773533 SRR3542232 SRX1773534 SRR3542233 SRX1773535 SRR3542234 SRX1773536 SRR3542235 SRX1773537 SRR3542236 SRX1773538 SRR3542237 SRX1773539 SRR3542238 SRX1773540 SRR3542239 SRX1773541 SRR3542240 SRX1773542 SRR3542241 SRX1773543 SRR3542242 SRX1773544 SRR3542243 SRX1773545 SRR3542244 SRX1773546 SRR3542245 SRX1773547 SRR3542246 SRX1773548 SRR3542247 SRX1773549 SRR3542248 SRX1773550 SRR3542249 SRX1773551 SRR3542250 SRX1773552 SRR3542251 SRX1773553 SRR3542252 SRX1773554 SRR3542253 SRX1773555 SRR3542254 SRX1773556 SRR3542255 SRX1773557 SRR3542256 SRX1773558 SRR3542257 SRX1773559 SRR3542258 SRX1773560 SRR3542259 SRX1773561 SRR3542260 SRX1773562 SRR3542261 SRX1773563 SRR3542262 SRX1773564 SRR3542263 SRX1773565 SRR3542264 SRX1773566 SRR3542265 SRX1773567 SRR3542266 SRX1773568 SRR3542267 SRX1773569 SRR3542268 SRX1773570 SRR3542269 SRX1773571 SRR3542270 SRX1773572 SRR3542271 SRX1773573 SRR3542272 SRX1773574 SRR3542273 SRX1773575 SRR3542274 SRX1773576 SRR3542275 SRX1773577 SRR3542276 SRX1773578 SRR3542277 SRX1773579 SRR3542278 SRX1773580 SRR3542279 SRX1773581 SRR3542280 SRX1773582 SRR3542281 SRX1773583 SRR3542282 SRX1773584 SRR3542283 SRX1773585 SRR3542284 SRX1773586 SRR3542285 SRX1773587 SRR3542286 SRX1773588 SRR3542287 SRX1773589 SRR3542288 SRX1773590 SRR3542289 SRX1773591 SRR3542290 SRX1773592 SRR3542291 SRX1773593 SRR3542292 SRX1773594 SRR3542293 SRX1773595 SRR3542294 SRX1773596 SRR3542295 SRX1773597 SRR3542296 SRX1773598 SRR3542297 SRX1773599 SRR3542298 SRX1773600 SRR3542299 SRX1773601 SRR3542300 SRX1773602 SRR3542301 SRX1773603 SRR3542302 SRX1773604 SRR3542303 SRX1773605 SRR3542304 SRX1773606 SRR3542305 SRX1773607 SRR3542306 SRX1773608 SRR3542307 SRX1773609 SRR3542308 SRX1773610 SRR3542309 SRX1773611 SRR3542310 SRX1773612 SRR3542311 SRX1773613 SRR3542312 SRX1773614 SRR3542313 SRX1773615 SRR3542314 SRX1773616 SRR3542315 SRX1773617 SRR3542316 SRX1773618 SRR3542317 SRX1773619 SRR3542318 SRX1773620 SRR3542319 SRX1773621 SRR3542320 SRX1773622 SRR3542321 SRX1773623 SRR3542322 SRX1773624 SRR3542323 SRX1773625 SRR3542324 SRX1773626 SRR3542325 SRX1773627 SRR3542326 SRX1773628 SRR3542327 SRX1773629 SRR3542328 SRX1773630 SRR3542329 SRX1773631 SRR3542330 SRX1773632 SRR3542331 SRX1773633 SRR3542332 SRX1773634 SRR3542333 SRX1773635 SRR3542334 SRX1773636 SRR3542335 SRX1773637 SRR3542336 SRX1773638 SRR3542337 SRX1773639 SRR3542338 SRX1773640 SRR3542339 SRX1773641 SRR3542340 SRX1773642 SRR3542341 SRX1773643 SRR3542342 SRX1773644 SRR3542343 SRX1773645 SRR3542344 SRX1773646 SRR3542345 SRX1773647 SRR3542346 SRX1773648 SRR3542347 SRX1773649 SRR3542348 SRX1773650 SRR3542349 SRX1773651 SRR3542350 SRX1773652 SRR3542351 SRX1773653 SRR3542352 SRX1773654 SRR3542353 SRX1773655 SRR3542354 SRX1773656 SRR3542355 SRX1773657 SRR3542356 SRX1773658 SRR3542357 SRX1773659 SRR3542358 SRX1773660 SRR3542359 SRX1773661 SRR3542360 SRX1773662 SRR3542361 SRX1773663 SRR3542362 SRX1773664 SRR3542363 SRX1773665 SRR3542364 SRX1773666 SRR3542365 SRX1773667 SRR3542366 SRX1773668 SRR3542367 SRX1773669 SRR3542368 SRX1773670 SRR3542369 SRX1773671 SRR3542370 SRX1773672 SRR3542371 SRX1773673 SRR3542372 SRX1773674 SRR3542373 SRX1773675 SRR3542374 SRX1773676 SRR3542375 SRX1773677 SRR3542376 SRX1773678 SRR3542377 SRX1773679 SRR3542378 SRX1773680 SRR3542379 SRX1773681 SRR3542380 SRX1773682 SRR3542381 SRX1773683 SRR3542382 SRX1773684 SRR3542383 SRX1773685 SRR3542384 SRX1773686 SRR3542385 SRX1773687 SRR3542386 SRX1773688 SRR3542387 SRX1773689 SRR3542388 SRX1773690 SRR3542389 SRX1773691 SRR3542390 SRX1773692 SRR3542391 SRX1773693 SRR3542392 SRX1773694 SRR3542393 SRX1773695 SRR3542394 SRX1773696 SRR3542395 SRX1773697 SRR3542396 SRX1773698 SRR3542397 SRX1773699 SRR3542398 SRX1773700 SRR3542399 SRX1773701 SRR3542400 SRX1773702 SRR3542401 SRX1773703 SRR3542402 SRX1773704 SRR3542403 SRX1773705 SRR3542404 SRX1773706 SRR3542405 SRX1773707 SRR3542406 SRX1773708 SRR3542407 SRX1773709 SRR3542408 SRX1773710 SRR3542409 SRX1773711 SRR3542410 SRX1773712 SRR3542411 SRX1773713 SRR3542412 SRX1773714 SRR3542413 SRX1773715 SRR3542414 SRX1773716 SRR3542415 SRX1773717 SRR3542416 SRX1773718 SRR3542417 SRX1773719 SRR3542418 SRX1773720 SRR3542419 SRX1773721 SRR3542420 SRX1773722 SRR3542421 SRX1773723 SRR3542422 SRX1773724 SRR3542423 SRX1773725 SRR3542424 SRX1773726 SRR3542425 SRX1773727 SRR3542426 SRX1773728 SRR3542427 SRX1773729 SRR3542428 SRX1773730 SRR3542429 SRX1773731 SRR3542430 SRX1773732 SRR3542431 SRX1773733 SRR3542432 SRX1773734 SRR3542433 SRX1773735 SRR3542434 SRX1773736 SRR3542435 SRX1773737 SRR3542436 SRX1773738 SRR3542437 SRX1773739 SRR3542438 SRX1773740 SRR3542439 SRX1773741 SRR3542440 SRX1773742 SRR3542441 SRX1773743 SRR3542442 SRX1773744 SRR3542443 SRX1773745 SRR3542444 SRX1773746 SRR3542445 SRX1773747 SRR3542446 SRX1773748 SRR3542447 SRX1773749 SRR3542448 SRX1773750 SRR3542449 SRX1773751 SRR3542450 SRX1773752 SRR3542451 SRX1773753 SRR3542452 SRX1773754 SRR3542453 SRX1773755 SRR3542454 SRX1773756 SRR3542455 SRX1773757 SRR3542456 SRX1773758 SRR3542457 SRX1773759 SRR3542458 SRX1773760 SRR3542459 SRX1773761 SRR3542460 SRX1773762 SRR3542461 SRX1773763 SRR3542462 SRX1773764 SRR3542463 SRX1773765 SRR3542464 SRX1773766 SRR3542465 SRX1773767 SRR3542466 SRX1773768 SRR3542467 SRX1773769 SRR3542468 SRX1773770 SRR3542469 SRX1773771 SRR3542470 SRX1773772 SRR3542471 SRX1773773 SRR3542472 SRX1773774 SRR3542473 SRX1773775 SRR3542474 SRX1773776 SRR3542475 SRX1773777 SRR3542476 SRX1773778 SRR3542477 SRX1773779 SRR3542478 SRX1773780 SRR3542479 SRX1773781 SRR3542480 SRX1773782 SRR3542481 SRX1773783 SRR3542482 SRX1773784 SRR3542483 SRX1773785 SRR3542484 SRX1773786 SRR3542485 SRX1773787 SRR3542486 SRX1773788 SRR3542487 SRX1773789 SRR3542488 SRX1773790 SRR3542489 SRX1773791 SRR3542490 SRX1773792 SRR3542491 SRX1773793 SRR3542492 SRX1773794 SRR3542493 SRX1773795 SRR3542494 SRX1773796 SRR3542495 SRX1773797 SRR3542496 SRX1773798 SRR3542497 SRX1773799 SRR3542498 SRX1773800 SRR3542499 SRX1773801 SRR3542500 SRX1773802 SRR3542501 SRX1773803 SRR3542502 SRX1773804 SRR3542503 SRX1773805 SRR3542504 SRX1773806 SRR3542505 SRX1773807 SRR3542506 SRX1773808 SRR3542507 SRX1773809 SRR3542508 SRX1773810 SRR3542509 SRX1773811 SRR3542510 SRX1773812 SRR3542511 SRX1773813 SRR3542512 SRX1773814 SRR3542513 SRX1773815 SRR3542514 SRX1773816 SRR3542515 SRX1773817 SRR3542516 SRX1773818 SRR3542517 SRX1773819 SRR3542518 SRX1773820 SRR3542519 SRX1773821 SRR3542520 SRX1773822 SRR3542521 SRX1773823 SRR3542522 SRX1773824 SRR3542523 SRX1773825 SRR3542524 SRX1773826 SRR3542525 SRX1773827 SRR3542526 SRX1773828 SRR3542527 SRX1773829 SRR3542528 SRX1773830 SRR3542529 SRX1773831 SRR3542530 SRX1773832 SRR3542531 SRX1773833 SRR3542532 SRX1773834 SRR3542533 SRX1773835 SRR3542534 SRX1773836 SRR3542535 SRX1773837 SRR3542536 SRX1773838 SRR3542537 SRX1773839 SRR3542538 SRX1773840 SRR3542539 SRX1773841 SRR3542540 SRX1773842 SRR3542541 SRX1773843 SRR3542542 SRX1773844 SRR3542543 SRX1773845 SRR3542544 SRX1773846 SRR3542545 SRX1773847 SRR3542546 SRX1773848 SRR3542547 SRX1773849 SRR3542548 SRX1773850 SRR3542549 SRX1773851 SRR3542550 SRX1773852 SRR3542551 SRX1773853 SRR3542552 SRX1773854 SRR3542553 SRX1773855 SRR3542554 SRX1773856 SRR3542555 SRX1773857 SRR3542556 SRX1773858 SRR3542557 SRX1773859 SRR3542558 SRX1773860 SRR3542559 SRX1773861 SRR3542560 SRX1773862 SRR3542561 SRX1773863 SRR3542562 SRX1773864 SRR3542563 SRX1773865 SRR3542564 SRX1773866 SRR3542565 SRX1773867 SRR3542566 SRX1773868 SRR3542567 SRX1773869 SRR3542568 SRX1773870 SRR3542569 SRX1773871 SRR3542570 SRX1773872 SRR3542571 SRX1773873 SRR3542572 SRX1773874 SRR3542573 SRX1773875 SRR3542574 SRX1773876 SRR3542575 SRX1773877 SRR3542576 SRX1773878 SRR3542577 SRX1773879 SRR3542578 SRX1773880 SRR3542579 SRX1773881 SRR3542580 SRX1773882 SRR3542581 SRX1773883 SRR3542582 SRX1773884 SRR3542583 SRX1773885 SRR3542584 SRX1773886 SRR3542585 SRX1773887 SRR3542586 SRX1773888 SRR3542587 SRX1773889 SRR3542588 SRX1773890 SRR3542589 SRX1773891 SRR3542590 SRX1773892 SRR3542591 SRX1773893 SRR3542592 SRX1773894 SRR3542593 SRX1773895 SRR3542594 SRX1773896 SRR3542595 SRX1773897 SRR3542596 SRX1773898 SRR3542597 SRX1773899 SRR3542598 SRX1773900 SRR3542599 SRX1773901 SRR3542600 SRX1773902 SRR3542601 SRX1773903 SRR3542602 SRX1773904 SRR3542603 SRX1773905 SRR3542604 SRX1773906 SRR3542605 SRX1773907 SRR3542606 SRX1773908 SRR3542607 SRX1773909 SRR3542608 SRX1773910 SRR3542609 SRX1773911 SRR3542610 SRX1773912 SRR3542611 SRX1773913 SRR3542612 SRX1773914 SRR3542613 SRX1773915 SRR3542614 SRX1773916 SRR3542615 SRX1773917 SRR3542616 SRX1773918 SRR3542617 SRX1773919 SRR3542618 SRX1773920 SRR3542619 SRX1773921 SRR3542620 SRX1773922 SRR3542621 SRX1773923 SRR3542622 SRX1773924 SRR3542623 SRX1773925 SRR3542624 SRX1773926 SRR3542625 SRX1773927 SRR3542626 SRX1773928 SRR3542627 SRX1773929 SRR3542628 SRX1773930 SRR3542629 SRX1773931 SRR3542630 SRX1773932 SRR3542631 SRX1773933 SRR3542632 SRX1773934 SRR3542633 SRX1773935 SRR3542634 SRX1773936 SRR3542635 SRX1773937 SRR3542636 SRX1773938 SRR3542637 SRX1773939 SRR3542638 SRX1773940 SRR3542639 SRX1773941 SRR3542640 SRX1773942 SRR3542641 SRX1773943 SRR3542642 SRX1773944 SRR3542643 SRX1773945 SRR3542644 SRX1773946 SRR3542645 SRX1773947 SRR3542646 SRX1773948 SRR3542647 SRX1773949 SRR3542648 SRX1773950 SRR3542649 SRX1773951 SRR3542650 SRX1773952 SRR3542651 SRX1773953 SRR3542652 SRX1773954 SRR3542653 SRX1773955 SRR3542654 SRX1773956 SRR3542655 SRX1773957 SRR3542656 SRX1773958 SRR3542657 SRX1773959 SRR3542658 SRX1773960 SRR3542659 SRX1773961 SRR3542660 SRX1773962 SRR3542661 SRX1773963 SRR3542662 SRX1773964 SRR3542663 SRX1773965 SRR3542664 SRX1773966 SRR3542665 SRX1773967 SRR3542666 SRX1773968 SRR3542667 SRX1773969 SRR3542668 SRX1773970 SRR3542669 SRX1773971 SRR3542670 SRX1773972 SRR3542671 SRX1773973 SRR3542672 SRX1773974 SRR3542673 SRX1773975 SRR3542674 SRX1773976 SRR3542675 SRX1773977 SRR3542676 SRX1773978 SRR3542677 SRX1773979 SRR3542678 SRX1773980 SRR3542679 SRX1773981 SRR3542680 SRX1773982 SRR3542681 SRX1773983 SRR3542682 SRX1773984 SRR3542683 SRX1773985 SRR3542684 SRX1773986 SRR3542685 SRX1773987 SRR3542686 SRX1773988 SRR3542687 SRX1773989 SRR3542688 SRX1773990 SRR3542689 SRX1773991 SRR3542690 SRX1773992 SRR3542691 SRX1773993 SRR3542692 SRX1773994 SRR3542693 SRX1773995 SRR3542694 SRX1773996 SRR3542695 SRX1773997 SRR3542696 SRX1773998 SRR3542697 SRX1773999 SRR3542698 SRX1774000 SRR3542699 SRX1774001 SRR3542700 SRX1774002 SRR3542701 SRX1774003 SRR3542702 SRX1774004 SRR3542703 SRX1774005 SRR3542704 SRX1774006 SRR3542705 SRX1774007 SRR3542706 SRX1774008 SRR3542707 SRX1774009 SRR3542709 SRX1774010 SRR3542710 SRX1774011 SRR3542711 SRX1774012 SRR3542712 SRX1774013 SRR3542713 SRX1774014 SRR3542714 SRX1774015 SRR3542715 SRX1774016 SRR3542716 SRX1774017 SRR3542717 SRX1774018 SRR3542718 SRX1774019 SRR3542719 SRX1774020 SRR3542720 SRX1774021 SRR3542721 SRX1774022 SRR3542722 SRX1774023 SRR3542723 SRX1774024 SRR3542724 SRX1774025 SRR3542725 SRX1774026 SRR3542726 SRX1774027 SRR3542727 SRX1774028 SRR3542728 SRX1774029 SRR3542729 SRX1774030 SRR3542730 SRX1774031 SRR3542731 SRX1774032 SRR3542732 SRX1774033 SRR3542733 SRX1774034 SRR3542734 SRX1774035 SRR3542735 SRX1774036 SRR3542736 SRX1774037 SRR3542737 SRX1774038 SRR3542738 SRX1774039 SRR3542739 SRX1774040 SRR3542740 SRX1774041 SRR3542741 SRX1774042 SRR3542742 SRX1774043 SRR3542743 SRX1774044 SRR3542744 SRX1774045 SRR3542745 SRX1774046 SRR3542746 SRX1774047 SRR3542747 SRX1774048 SRR3542748 SRX1774049 SRR3542749 SRX1774050 SRR3542750 SRX1774051 SRR3542751 SRX1774052 SRR3542752 SRX1774053 SRR3542753 SRX1774054 SRR3542754 SRX1774055 SRR3542755 SRX1774056 SRR3542756 SRX1774057 SRR3542757 SRX1774058 SRR3542758 SRX1774059 SRR3542759 SRX1774060 SRR3542760 SRX1774061 SRR3542761 SRX1774062 SRR3542762 SRX1774063 SRR3542763 SRX1774064 SRR3542764 SRX1774065 SRR3542765 SRX1774066 SRR3542766 SRX1774067 SRR3542767 SRX1774068 SRR3542768 SRX1774069 SRR3542769 SRX1774070 SRR3542770 SRX1774071 SRR3542771 SRX1774072 SRR3542772 SRX1774073 SRR3542773 SRX1774074 SRR3542774 SRX1774075 SRR3542775 SRX1774076 SRR3542776 SRX1774077 SRR3542777 SRX1774078 SRR3542778 SRX1774079 SRR3542779 SRX1774080 SRR3542780 SRX1774081 SRR3542781 SRX1774082 SRR3542782 SRX1774083 SRR3542783 SRX1774084 SRR3542784 SRX1774085 SRR3542785 SRX1774086 SRR3542786 SRX1774087 SRR3542787 SRX1774088 SRR3542788 SRX1774089 SRR3542789 SRX1774090 SRR3542790 SRX1774091 SRR3542791 SRX1774092 SRR3542792 SRX1774093 SRR3542793 SRX1774094 SRR3542794 SRX1774095 SRR3542795 SRX1774096 SRR3542796 SRX1774097 SRR3542797 SRX1774098 SRR3542798 SRX1774099 SRR3542799 SRX1774100 SRR3542800 SRX1774101 SRR3542801 SRX1774102 SRR3542802 SRX1774103 SRR3542803 SRX1774104 SRR3542804 SRX1774105 SRR3542805 SRX1774106 SRR3542806 SRX1774107 SRR3542807 SRX1774108 SRR3542808 SRX1774109 SRR3542809 SRX1774110 SRR3542810 SRX1774111 SRR3542811 SRX1774112 SRR3542812 SRX1774113 SRR3542813 SRX1774114 SRR3542814 SRX1774115 SRR3542815 SRX1774116 SRR3542816 SRX1774117 SRR3542817 SRX1774118 SRR3542818 SRX1774119 SRR3542819 SRX1774120 SRR3542820 SRX1774121 SRR3542821 SRX1774122 SRR3542822 SRX1774123 SRR3542823 SRX1774124 SRR3542824 SRX1774125 SRR3542825 SRX1774126 SRR3542826 SRX1774127 SRR3542827 SRX1774128 SRR3542828 SRX1774129 SRR3542829 SRX1774130 SRR3542830 SRX1774131 SRR3542831 SRX1774132 SRR3542832 SRX1774133 SRR3542833 SRX1774134 SRR3542834 SRX1774135 SRR3542835 SRX1774136 SRR3542836 SRX1774137 SRR3542837 SRX1774138 SRR3542838 SRX1774139 SRR3542839 SRX1774140 SRR3542840 SRX1774141 SRR3542841 SRX1774142 SRR3542842 SRX1774143 SRR3542843 SRX1774144 SRR3542844 SRX1774145 SRR3542845 SRX1774146 SRR3542846 SRX1774147 SRR3542847 SRX1774148 SRR3542848 SRX1774149 SRR3542849 SRX1774150 SRR3542850 SRX1774151 SRR3542851 SRX1774152 SRR3542852 SRX1774153 SRR3542853 SRX1774154 SRR3542854 SRX1774155 SRR3542855 SRX1774156 SRR3542856 SRX1774157 SRR3542857 SRX1774158 SRR3542858 SRX1774159 SRR3542859 SRX1774160 SRR3542860 SRX1774161 SRR3542861 SRX1774162 SRR3542862 SRX1774163 SRR3542863 SRX1774164 SRR3542864 SRX1774165 SRR3542865 SRX1774166 SRR3542866 SRX1774167 SRR3542867 SRX1774168 SRR3542868 SRX1774169 SRR3542869 SRX1774170 SRR3542870 SRX1774171 SRR3542871 SRX1774172 SRR3542872 SRX1774173 SRR3542873 SRX1774174 SRR3542874 SRX1774175 SRR3542875 SRX1774176 SRR3542876 SRX1774177 SRR3542877 SRX1774178 SRR3542878 SRX1774179 SRR3542879 SRX1774180 SRR3542880 SRX1774181 SRR3542881 SRX1774182 SRR3542882 SRX1774183 SRR3542883 SRX1774184 SRR3542884 SRX1774185 SRR3542885 SRX1774186 SRR3542886 SRX1774187 SRR3542887 SRX1774188 SRR3542888 SRX1774189 SRR3542889 SRX1774190 SRR3542890 SRX1774191 SRR3542891 SRX1774192 SRR3542892 SRX1774193 SRR3542893 SRX1774194 SRR3542894 SRX1774195 SRR3542895 SRX1774196 SRR3542896 SRX1774197 SRR3542897 SRX1774198 SRR3542898 SRX1774199 SRR3542899 SRX1774200 SRR3542900 SRX1774201 SRR3542901 SRX1774202 SRR3542902 SRX1774203 SRR3542903
package com.hlag.routine import android.content.Context import android.util.Log import com.google.gson.Gson import java.io.* class FileManager { companion object { var dir = "/storage/emulated/0" fun readFile(name: String?): Routine? { val text = StringBuilder() try { val br = BufferedReader(FileReader(File(dir, name + ".txt"))) var line: String? while (br.readLine().also { line = it } != null) { text.append(line) text.append('\n') } br.close() } catch (e: IOException) { e.printStackTrace() return null } return Gson().fromJson<Routine>(text.toString(), Routine::class.java) } fun writeRoutine(context: Context, routine: Routine) { val text = Gson().toJson(routine).toString() val file = File(dir, routine.name + ".txt") val fileOutputStream = FileOutputStream(file) fileOutputStream.use { fileOutputStream -> fileOutputStream.write(text.toByteArray()) } } } }
module RuboCop module Cop module Chef class MetadataMaintainer < Cop MSG = '' end end end end
use core::cell::UnsafeCell; use core::marker::PhantomData; use crate::num::NonZeroUsize; use crate::num::Pow2Usize; use crate::num::usize_align_up; use super::NonNull; use super::Allocator; use super::AllocError; struct BumpAllocatorState<'a> { begin_addr: usize, current_addr: usize, end_addr: usize, lifeline: PhantomData<&'a u8>, } pub struct BumpAllocator<'a> { state: UnsafeCell<BumpAllocatorState<'a>> } impl<'a> BumpAllocator<'a> { pub fn new(buffer: &'a mut [u8]) -> Self { let b = buffer.as_ptr() as usize; let e = b + buffer.len(); BumpAllocator { state: BumpAllocatorState { begin_addr: b, current_addr: b, end_addr: e, lifeline: PhantomData }.into() } } fn is_last_allocation( &self, ptr: NonNull<u8>, size: NonZeroUsize ) -> bool { let state: &'a BumpAllocatorState<'a> = unsafe { &*(self.state.get() as *mut BumpAllocatorState<'a>) }; state.current_addr == (ptr.as_ptr() as usize) + size.get() } pub fn space_left(&self) -> usize { let state: &'a BumpAllocatorState<'a> = unsafe { &*(self.state.get() as *mut BumpAllocatorState<'a>) }; state.end_addr - state.current_addr } } unsafe impl<'a> Allocator for BumpAllocator<'a> { unsafe fn alloc( &self, size: NonZeroUsize, align: Pow2Usize ) -> Result<NonNull<u8>, AllocError> { let state: &'a mut BumpAllocatorState<'a> = &mut *(self.state.get() as *mut BumpAllocatorState<'a>); usize_align_up(state.current_addr, align) .map_or(None, |v| v.checked_add(size.get())) .map_or(None, |v| if v <= state.end_addr { let addr = state.current_addr; state.current_addr = v; NonNull::new(addr as *mut u8) } else { None }) .ok_or(AllocError::NotEnoughMemory) } unsafe fn free( &self, ptr: NonNull<u8>, current_size: NonZeroUsize, _align: Pow2Usize ) { if self.is_last_allocation(ptr, current_size) { let state: &'a mut BumpAllocatorState<'a> = &mut *(self.state.get() as *mut BumpAllocatorState<'a>); state.current_addr -= current_size.get(); } } unsafe fn grow( &self, ptr: NonNull<u8>, current_size: NonZeroUsize, new_larger_size: NonZeroUsize, align: Pow2Usize ) -> Result<NonNull<u8>, AllocError> { if self.is_last_allocation(ptr, current_size) && align.is_non_null_ptr_aligned(ptr) { let state: &'a mut BumpAllocatorState<'a> = &mut *(self.state.get() as *mut BumpAllocatorState<'a>); let extra_size = new_larger_size.get() - current_size.get(); if extra_size <= state.end_addr - state.current_addr { state.current_addr += extra_size; Ok(ptr) } else { Err(AllocError::NotEnoughMemory) } } else { let new_ptr = self.alloc(new_larger_size, align)?; core::ptr::copy(ptr.as_ptr(), new_ptr.as_ptr(), current_size.get()); Ok(new_ptr) } } unsafe fn shrink( &self, ptr: NonNull<u8>, current_size: NonZeroUsize, new_smaller_size: NonZeroUsize, align: Pow2Usize ) -> Result<NonNull<u8>, AllocError> { if !align.is_non_null_ptr_aligned(ptr) { Err(AllocError::UnsupportedAlignment) } else { if self.is_last_allocation(ptr, current_size) { let state: &'a mut BumpAllocatorState<'a> = &mut *(self.state.get() as *mut BumpAllocatorState<'a>); state.current_addr -= current_size.get() - new_smaller_size.get(); } Ok(ptr) } } fn supports_contains(&self) -> bool { true } fn contains(&self, ptr: NonNull<u8>) -> bool { let state: &'a BumpAllocatorState<'a> = unsafe { &*(self.state.get() as *mut BumpAllocatorState<'a>) }; let addr = ptr.as_ptr() as usize; state.begin_addr <= addr && addr < state.end_addr } fn name(&self) -> &'static str { "bump-allocator" } } #[cfg(test)] mod tests { use super::*; #[test] fn allocator_name_contains_bump() { let mut buffer = [0_u8; 16]; let a = BumpAllocator::new(&mut buffer); assert!(a.name().contains("bump")); } #[test] fn alloc_1_byte_in_a_1_byte_buffer_works() { let mut buffer = [0_u8; 1]; let a = BumpAllocator::new(&mut buffer); assert_eq!( unsafe { a.alloc(NonZeroUsize::new(1).unwrap(), Pow2Usize::one()) }.unwrap().as_ptr(), buffer.as_mut_ptr()); } #[test] fn alloc_2_bytes_in_a_1_byte_buffer_fails() { let mut buffer = [0_u8; 1]; let a = BumpAllocator::new(&mut buffer); assert_eq!( unsafe { a.alloc(NonZeroUsize::new(2).unwrap(), Pow2Usize::one()) }.unwrap_err(), AllocError::NotEnoughMemory); } #[test] fn dropping_last_allocation_reclaims_memory() { let mut buffer = [0_u8; 1]; let a = BumpAllocator::new(&mut buffer); { let mut b = a.to_ref().alloc_item(42_u8).unwrap(); assert_eq!(*b, 42_u8); *b = 0xAB_u8; assert_eq!(*b, 0xAB_u8); } { let mut b = a.to_ref().alloc_item(0x5A_u8).unwrap(); assert_eq!(*b, 0x5A_u8); *b = 0xA5_u8; assert_eq!(*b, 0xA5_u8); } } #[test] fn grow_last_allocation_succeeds() { let mut buffer = [0xAA_u8; 2]; let a = BumpAllocator::new(&mut buffer); let p1 = unsafe { a.alloc( NonZeroUsize::new(1).unwrap(), Pow2Usize::one() ) }.unwrap(); unsafe { *p1.as_ptr() = 0x99_u8 }; let p2 = unsafe { a.grow( p1, NonZeroUsize::new(1).unwrap(), NonZeroUsize::new(2).unwrap(), Pow2Usize::one()) }.unwrap(); let s = unsafe { core::slice::from_raw_parts(p2.as_ptr(), 2_usize) }; assert_eq!(s, [0x99_u8, 0xAA_u8]); } #[test] fn grow_last_allocation_fails() { let mut buffer = [0xAA_u8; 2]; let a = BumpAllocator::new(&mut buffer); let p1 = unsafe { a.alloc( NonZeroUsize::new(1).unwrap(), Pow2Usize::one() ) }.unwrap(); unsafe { *p1.as_ptr() = 0x99_u8 }; let e2 = unsafe { a.grow(p1, NonZeroUsize::new(1).unwrap(), NonZeroUsize::new(3).unwrap(), Pow2Usize::one()) }.unwrap_err(); assert_eq!(e2, AllocError::NotEnoughMemory); } #[test] fn grow_by_doing_a_new_allocation_succeeds() { let mut buffer = [0xAA_u8; 4]; let a = BumpAllocator::new(&mut buffer); let p1 = unsafe { a.alloc( NonZeroUsize::new(1).unwrap(), Pow2Usize::one() ) }.unwrap(); unsafe { *p1.as_ptr() = 0x5A_u8 }; let p2 = unsafe { a.alloc( NonZeroUsize::new(1).unwrap(), Pow2Usize::one() ) }.unwrap(); unsafe { *p2.as_ptr() = 0xA5_u8 }; let p3 = unsafe { a.grow( p1, NonZeroUsize::new(1).unwrap(), NonZeroUsize::new(2).unwrap(), Pow2Usize::one()) }.unwrap(); let s = unsafe { core::slice::from_raw_parts(p3.as_ptr(), 2_usize) }; assert_eq!(s, [0x5A_u8, 0xAA_u8]); assert_eq!(unsafe { *p2.as_ptr() }, 0xA5_u8); } #[test] fn fail_to_grow_by_reallocation() { let mut buffer = [0xAA_u8; 4]; let a = BumpAllocator::new(&mut buffer); let p1 = unsafe { a.alloc( NonZeroUsize::new(1).unwrap(), Pow2Usize::one() ) }.unwrap(); unsafe { *p1.as_ptr() = 0x5A_u8 }; let p2 = unsafe { a.alloc( NonZeroUsize::new(1).unwrap(), Pow2Usize::one() ) }.unwrap(); unsafe { *p2.as_ptr() = 0xA5_u8 }; let e3 = unsafe { a.grow( p1, NonZeroUsize::new(1).unwrap(), NonZeroUsize::new(3).unwrap(), Pow2Usize::one()) }.unwrap_err(); assert_eq!(e3, AllocError::NotEnoughMemory); assert_eq!(unsafe { *p1.as_ptr() }, 0x5A_u8); assert_eq!(unsafe { *p2.as_ptr() }, 0xA5_u8); } #[test] fn shrink_last_allocation_reclaims_memory() { let mut buffer = [0xAA_u8; 2]; let a = BumpAllocator::new(&mut buffer); let p1 = unsafe { a.alloc( NonZeroUsize::new(2).unwrap(), Pow2Usize::one() ) }.unwrap(); unsafe { *p1.as_ptr() = 0x12_u8 }; let p2 = unsafe { a.shrink( p1, NonZeroUsize::new(2).unwrap(), NonZeroUsize::new(1).unwrap(), Pow2Usize::one()) }.unwrap(); assert_eq!(unsafe { *p2.as_ptr() }, 0x12_u8); let p3 = unsafe { a.alloc( NonZeroUsize::new(1).unwrap(), Pow2Usize::one() ) }.unwrap(); assert_eq!(p3.as_ptr(), unsafe { p2.as_ptr().offset(1) }); } #[test] fn shrink_non_last_allocation() { let mut buffer = [0xAA_u8; 4]; let a = BumpAllocator::new(&mut buffer); let p1 = unsafe { a.alloc( NonZeroUsize::new(2).unwrap(), Pow2Usize::one() ) }.unwrap(); unsafe { *p1.as_ptr() = 0x5A_u8 }; unsafe { *p1.as_ptr().offset(1) = 0xA5_u8 }; let p2 = unsafe { a.alloc( NonZeroUsize::new(1).unwrap(), Pow2Usize::one() ) }.unwrap(); unsafe { *p2.as_ptr() = 0xBB_u8 }; let p3 = unsafe { a.shrink( p1, NonZeroUsize::new(2).unwrap(), NonZeroUsize::new(1).unwrap(), Pow2Usize::one()) }.unwrap(); assert_eq!(unsafe { *p3.as_ptr() }, 0x5A_u8); assert_eq!(unsafe { *p2.as_ptr() }, 0xBB_u8); } #[test] fn shrink_with_higher_alignment_fails() { let mut buffer = [0xAA_u8; 4]; let a = BumpAllocator::new(&mut buffer); let p1 = unsafe { a.alloc( NonZeroUsize::new(2).unwrap(), Pow2Usize::one() ) }.unwrap(); let e2 = unsafe { a.shrink( p1, NonZeroUsize::new(2).unwrap(), NonZeroUsize::new(1).unwrap(), Pow2Usize::max() ) }.unwrap_err(); assert_eq!(e2, AllocError::UnsupportedAlignment); } #[test] fn contains_is_supported() { let mut buffer = [0xAA_u8; 4]; let a = BumpAllocator::new(&mut buffer); assert!(a.supports_contains()); } #[test] fn contains_true_only_for_pointers_inside_buffer() { let mut buffer = [0xAA_u8; 47]; let b = buffer.as_mut_ptr(); let n = buffer.len(); let a = BumpAllocator::new(&mut buffer); assert!(a.contains(NonNull::new(b).unwrap())); assert!(a.contains(NonNull::new(unsafe { b.offset(n as isize - 1) }).unwrap())); assert!(!a.contains(NonNull::new(unsafe { b.offset(n as isize) }).unwrap())); assert!(!a.contains(NonNull::new(unsafe { b.offset(-1) }).unwrap())); } }
require 'formula' class Irstlm < Formula homepage 'https://sourceforge.net/projects/irstlm/' url 'https://downloads.sourceforge.net/project/irstlm/irstlm/irstlm-5.80/irstlm-5.80.03.tgz' sha1 'd92d048b924fde228811c81c030bf99e0ae832a9' depends_on 'autoconf' => :build depends_on 'automake' => :build depends_on 'libtool' => :build patch :DATA fails_with :clang do build 503 cause 'Uses nonstandard variable-length arrays in mdiadapt.cpp.' end def install system './regenerate-makefiles.sh' system './configure', "--prefix=#{prefix}" system 'make' system 'make', 'install' end def caveats <<-EOS.undent This formula patches `build-lm.sh` to set the "IRSTLM" environment variable to the Homebrew prefix by default, so that it does not need to be specified on the command line unless it is being overridden. EOS end test do require 'open3' corpus = "<s> lorem ipsum dolor sit amet </s>\n" File.open('lipsum', 'w') { |f| f.write(corpus) } system bin/'build-lm.sh', '-i', 'lipsum', '-o', 'lipsum-lm' Open3.popen3(bin/'score-lm', '-lm', 'lipsum-lm') do |stdin, stdout, stderr| stdin.write(corpus) stdin.close assert_equal '-49', stdout.read.strip end end end __END__ diff --git a/scripts/build-lm.sh b/scripts/build-lm.sh index 4ee4fcf..57080cf 100755 --- a/scripts/build-lm.sh +++ b/scripts/build-lm.sh @@ -29,10 +29,7 @@ OPTIONS: EOF } -if [ ! $IRSTLM ]; then - echo "Set IRSTLM environment variable with path to irstlm" - exit 2 -fi +IRSTLM=${IRSTLM:-HOMEBREW_PREFIX} #paths to scripts and commands in irstlm scr=$IRSTLM/bin
# [N-ary Tree Postorder Traversal][title] ## Description Given an n-ary tree, return the postorder traversal of its nodes' values. **Example 1:** For example, given a 3-ary tree: ![](https://ws1.sinaimg.cn/large/0062R7s4gy1fxvp285ibrj30lp0dy0ta.jpg) Return its postorder traversal as: [5,6,3,2,4,1]. **Tags:** Tree ## 解读题意 给定一个 N 叉树,返回其节点值的后序遍历。 ## 思路1 ```java class Solution { public List<Integer> postorder(Node root) { List<Integer> list = new ArrayList<>(); postorderHelper(root, list); return list; } private void postorderHelper(Node root, List<Integer> list) { if (root == null) return; for (Node node : root.children) postorderHelper(node, list); list.add(root.val); } } ``` time complexity:O(n) [title]: https://leetcode.com/problems/n-ary-tree-postorder-traversal/
<?php /** * Created by PhpStorm. * User: 卢珑文 * Date: 2017/12/8 * Time: 9:52 * description: 接口规范 */ namespace framework\dao; interface iPDO{ // 查询一条记录 public function fetchOne($sql); // 查询所有记录 public function fetchAll($sql); // 查询字段的值 public function fetchColumn($sql); // 执行增删改操作 public function exec($sql); // 引号转义包裹 public function quote($val); // 查询刚刚插入的数据的主键,一般是 ID public function lastInsertId(); }
BEGIN; CREATE OR REPLACE FUNCTION inventory_get_item_at_day (in_transdate date, in_partnumber text) RETURNS parts AS $$ DECLARE out_row RECORD; t_parts_id int; int_outrow RECORD; BEGIN SELECT id INTO t_parts_id FROM parts WHERE (partnumber like in_partnumber|| ' %' or partnumber = in_partnumber) and obsolete is not true and assembly is not true; SELECT * INTO out_row FROM parts WHERE id = t_parts_id; WITH RECURSIVE c AS ( SELECT 1::numeric as multiplier, t_parts_id as part_used, t_parts_id as current_part_id UNION ALL SELECT c.multiplier * a.qty, t_parts_id as part_used, a.parts_id as current_part_id FROM assembly a JOIN c ON c.current_part_id = a.id ) SELECT sum(coalesce(c.multiplier, 1) * i.qty) * -1 AS onhand INTO int_outrow FROM parts p LEFT JOIN c ON c.part_used = t_parts_id JOIN invoice i ON (i.parts_id = p.id OR i.parts_id = c.current_part_id) JOIN (select id, transdate from ar UNION select id, transdate from ap) a ON (i.trans_id = a.id) WHERE (p.partnumber = in_partnumber or p.partnumber like in_partnumber || ' %') AND a.transdate <= in_transdate AND assembly IS FALSE AND obsolete IS NOT TRUE GROUP BY p.id, p.partnumber, p.description, p.unit, p.listprice, p.sellprice, p.lastcost, p.priceupdate, p.weight, p.onhand, p.notes, p.makemodel, p.assembly, p.alternate, p.rop, p.inventory_accno_id, p.income_accno_id, p.expense_accno_id, p.bin, p.obsolete, p.bom, p.image, p.microfiche, p.partsgroup_id, p.avgcost; out_row.onhand := int_outrow.onhand; RETURN out_row; END; $$ LANGUAGE PLPGSQL; CREATE OR REPLACE FUNCTION product (numeric, numeric) RETURNS numeric AS $$ SELECT $1 * $2; $$ language sql; DROP AGGREGATE IF EXISTS product(numeric); CREATE AGGREGATE product( basetype = numeric, sfunc = product, stype = numeric ); CREATE OR REPLACE FUNCTION inventory_create_report(in_transdate date) RETURNS int AS $$ INSERT INTO inventory_report(transdate) values (in_transdate) RETURNING id; $$ language sql; CREATE OR REPLACE FUNCTION inventory_report__add_line (in_report_id int, in_parts_id int, in_onhand int, in_counted int) RETURNS int AS $$ INSERT INTO inventory_report_line(adjust_id, parts_id, expected, counted) VALUES (in_report_id, in_parts_id, in_onhand, in_counted) RETURNING adjust_id; $$ LANGUAGE sql; CREATE OR REPLACE FUNCTION inventory__get_item_by_partnumber(in_partnumber text) RETURNS parts LANGUAGE SQL AS $$ SELECT * FROM parts WHERE obsolete is not true AND partnumber = $1; $$; CREATE OR REPLACE FUNCTION inventory__get_item_by_id(in_id int) RETURNS parts LANGUAGE SQL AS $$ SELECT * FROM parts WHERE id = $1; $$; update defaults set value = 'yes' where setting_key = 'module_load_ok'; COMMIT;
module Joinable extend ActiveSupport::Concern included do has_many :memberships, as: :group, dependent: :destroy if self < ApplicationRecord scope :for_member, lambda{|member| joins(:memberships).where('memberships.member_id = ?', member)} end end def active_leaders(dt = DateTime.current) self.memberships.active_on(dt).as_leader end def is_active_leader?(member, dt = DateTime.current) self.active_leaders(dt).for_member(member).exists? end def active_members(dt = DateTime.current) self.memberships.active_on(dt) end def is_active_member?(member, dt = DateTime.current) self.active_members.for_member(member).exists? end def active_overseers(dt = DateTime.current) self.memberships.active_on(dt).as_overseer end def is_active_overseer?(member, dt = DateTime.current) self.active_overseers(dt).for_member(member).exists? end def assistants self.memberships.as_assistant.to_a end def leaders self.memberships.as_leader.to_a end def members return [] unless RoleContext::is_role_allowed?(self, RoleContext::MEMBER) self.memberships.as_member.to_a end def overseers return [] unless RoleContext::is_role_allowed?(self, RoleContext::OVERSEER) self.memberships.as_overseer.to_a end def participants return [] unless RoleContext::is_role_allowed?(self, RoleContext::MEMBER) self.memberships.as_participant.to_a end def visitors return [] unless RoleContext::is_role_allowed?(self, RoleContext::VISITOR) self.memberships.as_visitor.to_a end def all_leaders self.leaders + self.assistants + self.overseers end def all_members self.all_leaders + self.members end def all_participants self.all_members + self.participants end end
<?php namespace App\Http\Controllers\Admin; use App\Http\Controllers\Controller; use Illuminate\Http\Request; use App\Repositories\Admin\ClientRepositoryEloquent as Client; class DashboardController extends Controller { protected $clientRepo; function __construct(Client $clientRepo) { $this->clientRepo = $clientRepo; } public function index() { $clients = $this->clientRepo->rawAll("status = ?", ['Active']); $collection = collect($clients)->map(function ($client) { return [ 'name' => $client->company_name, 'subscription' => $client->subscription ?? 'Basic', 'storage' => $client->storage_used.'G/'.$client->storage.'G' ?? '2G', 'transaction' => rand(20, 500) ]; }); return response()->json($collection); } }
# Rake Snippets This file contains snippets of rake files that have proven useful over the years. The are listed here, together for ease of copy and pasting where needed. ### Tests The standard unit test suite: ```ruby require 'rake/testtask' #Run the Fibonacci unit test suite. Rake::TestTask.new do |t| #List out all the test files. t.test_files = FileList['tests/**/*.rb'] t.verbose = false t.warning = true end ``` The test suite is accessed via: $ rake test Sometimes there are tests that you'd like to still have, but not run as part of the standard unit tests. The following example shows a series of tests called integration tests: ```ruby #Run the fOOrth integration test suite. Rake::TestTask.new(:integration) do |t| #List out all the integration test files. t.test_files = FileList['integration/*.rb'] t.verbose = false t.warning = true end ``` This example is accessed via: $ rake integration #### Alternate Test The test environment includes a lot of wierd, funky stuff that sometimes gets in the way. The alternate test task runs tests with a minimum of extra baggage. This often helps a lot. ```ruby desc "Alternative test procedure" task :alt_test do |t| here = File.dirname(__FILE__) target = "#{here}/test/*.rb" puts "Target files = #{target}" puts block = "{|file| require file if File.basename(file) =~ /test/}" code = "Dir['#{target}'].each #{block}" system "ruby -e\"#{code}\"" end ``` ### Documentation ```ruby require 'rdoc/task' #Generate internal documentation with rdoc. RDoc::Task.new do |rdoc| rdoc.rdoc_dir = "rdoc" #List out all the files to be documented. rdoc.rdoc_files.include("lib/**/*.rb", "license.txt", "README.md") #Make all access levels visible. rdoc.options << '--visibility' << 'private' #rdoc.options << '--verbose' #rdoc.options << '--coverage-report' #Set a title. #rdoc.options << '--title' << 'Title Goes Here' end ``` This task is accessed via: $ rake rdoc Note: I am moving away from rdoc on the grounds that it is often distracting from understanding the code and is an extra maintenance burden and is often out of date and thus misleading. ### Code Smells The reek gem is a powerful tool for identifying areas of code that may be improved. This snippet run a scan on the code library and records the results: ```ruby desc "Run a scan for smelly code!" task :reek do |t| `reek --no-color lib > reek.txt` end ``` Run this via: $ rake reek Note that the output is directed toward the file reek.txt without any fancy colorization or other special effects. This is part of my workflow in that I prefer to have a record of code smells at various points in the development and saving results to a text file makes it easy to version control the smell reports as the project progresses. ### Debug/Test Console Now there are several ways to run an irb console from rake, with test code "preloaded". There are also a number of problems with this. The most severe is that rake really seems to mess up the console. The long and short of it that rake should be used for batch tasks, not interactive ones. Here is my workaround to this issue: ```ruby desc "Run an IRB Session with fibonacci_rng loaded." task :console do system "ruby irbt.rb local" end ``` Now irbt.rb is a file that resides along with the rakefile.rb file. Here is an example of this file for the fibonacci_rng mentioned above: ```ruby # coding: utf-8 # An IRB + fibonacci_rng Test bed require 'irb' puts "Starting an IRB console with fibonacci_rng loaded." if ARGV[0] == 'local' require_relative 'lib/fibonacci_rng' puts "fibonacci_rng loaded locally: #{FibonacciRng::VERSION}" ARGV.shift else require 'fibonacci_rng' puts "fibonacci_rng loaded from gem: #{FibonacciRng::VERSION}" end IRB.start ``` This is accessed via: $ rake console And yes, bundler uses a different approach, but I cannot use it since it uses bash scripts to get things working. ### Versions A tiny, useful task simply identifies the version that would be built next. ```ruby desc "What version of the Fibonacci is this?" task :vers do |t| puts puts "Fibonacci random number generator version = #{FibonacciRng::VERSION}" end ``` This code only works because the bundler adds require "bundler/gem_tasks" at the top of the rakefile. Otherwise you'll have to require_relative the appropriate file on your own. This task is accessed via: $ rake vers
export default class SingleChoiceVoting { public proposal; public votes; public strategies; public selected; constructor(proposal, votes, strategies, selected) { this.proposal = proposal; this.votes = votes; this.strategies = strategies; this.selected = selected; } // Returns an array with voter balance for each choice totalBalances() { return this.proposal.choices.map((choice, i) => this.votes .filter((vote: any) => vote.choice === i + 1) .reduce((a, b: any) => a + b.balance, 0) ); } // Returns an array with voter balance for each choice // and for each strategy totalScores() { return this.proposal.choices.map((choice, i) => this.strategies.map((strategy, sI) => this.votes .filter((vote: any) => vote.choice === i + 1) .reduce((a, b: any) => a + b.scores[sI], 0) ) ); } // Returns a string of all choices // Seperated by comma if more than one choice getChoiceString() { return this.proposal.choices[this.selected - 1]; } }
SELECT P.[FirstName] ,P.[LastName] , A.[City] , A.[State] FROM [Person] P LEFT JOIN [Address] A ON P.PersonId = A.PersonId
package main import ( "log" "github.com/bitcoinschema/go-bitcoin" ) func main() { // Use a new UTXO utxo := &bitcoin.Utxo{ TxID: "b7b0650a7c3a1bd4716369783876348b59f5404784970192cec1996e86950576", Vout: 0, ScriptPubKey: "76a9149cbe9f5e72fa286ac8a38052d1d5337aa363ea7f88ac", Satoshis: 1000, } // Add a pay-to address payTo := &bitcoin.PayToAddress{ Address: "1C8bzHM8XFBHZ2ZZVvFy2NSoAZbwCXAicL", Satoshis: 500, } // Add some op return data opReturn1 := bitcoin.OpReturnData{[]byte("prefix1"), []byte("example data"), []byte{0x13, 0x37}} opReturn2 := bitcoin.OpReturnData{[]byte("prefix2"), []byte("more example data")} // Generate the TX (use a WIF) rawTx, err := bitcoin.CreateTxWithChangeUsingWif( []*bitcoin.Utxo{utxo}, []*bitcoin.PayToAddress{payTo}, []bitcoin.OpReturnData{opReturn1, opReturn2}, "1KQG5AY9GrPt3b5xrFqVh2C3YEhzSdu4kc", nil, nil, "L3VJH2hcRGYYG6YrbWGmsxQC1zyYixA82YjgEyrEUWDs4ALgk8Vu", ) if err != nil { log.Printf("error occurred: %s", err.Error()) return } // Success! log.Printf("rawTx: %s", rawTx.ToString()) }
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using Microsoft.Win32; namespace CPUMonitor { public partial class frmCPU : Form { private RegistryKey AppRegKey; private const int LIGHT_MAX = 0x1F; public frmCPU() { InitializeComponent(); nicoNotifyIcon.Icon = this.Icon; nicoNotifyIcon.MouseClick += new MouseEventHandler(TrayIconClick); } private void Form1_Load(object sender, EventArgs e) { AppRegKey = Registry.CurrentUser.CreateSubKey("Software\\CPUMonitor"); for (int i = 1; i <= 99; i++) cmbComPort.Items.Add("COM" + i.ToString()); cmbComPort.SelectedIndex = System.Convert.ToInt32(AppRegKey.GetValue("Port", "1")) - 1; serSerialPort.PortName = cmbComPort.Text; Hide(); } private void NotifyLight(int Red, int Green, int Blue) { byte[] buffer = new byte[3]; buffer[0] = (byte)(0x80 | (Red & LIGHT_MAX)); buffer[1] = (byte)(0x40 | (Green & LIGHT_MAX)); buffer[2] = (byte)(0x20 | (Blue & LIGHT_MAX)); try { serSerialPort.PortName = cmbComPort.Text; serSerialPort.Open(); serSerialPort.Write(buffer, 0, buffer.Length); serSerialPort.Close(); } catch (Exception e) { } } private void tmrCPUTimer_Tick(object sender, EventArgs e) { float CPUUsage = pcCPUUsage.NextValue(); int Red = 0; int Green = 0; int Blue = 0; if (CPUUsage < 25) { Green = (int)((LIGHT_MAX / 25) * CPUUsage); } else if (CPUUsage < 50) { Blue = (int)((LIGHT_MAX / 25) * (CPUUsage - 25)); Green = LIGHT_MAX - Blue; } else if (CPUUsage < 75) { Red = (int)((LIGHT_MAX / 25) * (CPUUsage - 50)); Blue = LIGHT_MAX - Red; } else { Red = LIGHT_MAX; } NotifyLight(Red, Green, Blue); lblCPU.Text = ((int)CPUUsage).ToString() + "%"; } private void btnExit_Click(object sender, EventArgs e) { Application.Exit(); } private void btnMinimizeToTray_Click(object sender, EventArgs e) { this.Hide(); } private void TrayIconClick(object sender, MouseEventArgs e) { this.Show(); this.WindowState = FormWindowState.Normal; } private void cbPort_SelectedIndexChanged(object sender, EventArgs e) { AppRegKey.SetValue("Port", cmbComPort.SelectedIndex + 1); serSerialPort.PortName = cmbComPort.Text; } } }