answer
stringlengths
15
1.25M
<?php namespace App\Models\Rme; use App\Models\Orm\Entity; use App\Models\Structs\Exercises\ScalarExercise; use Orm; /** * @property string $answer * @property bool $correct * @property bool $hint has user seen hint? {default false} * @property bool $inactivity browser tab hidden during exercise {default false} * @property int $seed * @property int $time ms elapsed until answer * @property bool $firstTry {default TRUE} * * @property Blueprint $content {m:1 contents $answers} * @property User $user {m:1 users $answers} */ class Answer extends Entity { public function __construct(ScalarExercise $exercise, $answer) { parent::__construct(); $this->content = $exercise->getBlueprint(); $this->seed = $exercise->getSeed(); $this->answer = $answer; } }
<?php namespace Easy\EspaceMembreBundle; use Symfony\Component\HttpKernel\Bundle\Bundle; class <API key> extends Bundle { }
#ifdef HAVE_CONFIG_H #include "../ext_config.h" #endif #include <php.h> #include "../php_ext.h" #include "../ext.h" #include <Zend/zend_operators.h> #include <Zend/zend_exceptions.h> #include <Zend/zend_interfaces.h> #include "kernel/main.h" #include "kernel/memory.h" #include "kernel/array.h" #include "kernel/operators.h" #include "kernel/string.h" #include "kernel/fcall.h" /** * Control Flow */ ZEPHIR_INIT_CLASS(Test_NativeArray) { <API key>(Test, NativeArray, test, nativearray, <API key>, 0); return SUCCESS; } PHP_METHOD(Test_NativeArray, testArray1) { zval a; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&a); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); array_init(&a); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, testArray2) { zval a, _0; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&a); ZVAL_UNDEF(&_0); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(&_0); ZVAL_LONG(&_0, 1); <API key>(&a, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 2); <API key>(&a, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 3); <API key>(&a, &_0); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, testArray3) { zval a, _0; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&a); ZVAL_UNDEF(&_0); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(&_0); ZVAL_DOUBLE(&_0, 1.1); <API key>(&a, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_DOUBLE(&_0, 2.2); <API key>(&a, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_DOUBLE(&_0, 3.3); <API key>(&a, &_0); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, testArray4) { zval __$false, __$true, a; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_BOOL(&__$false, 0); ZVAL_BOOL(&__$true, 1); ZVAL_UNDEF(&a); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0 TSRMLS_CC); <API key>(&a, &__$false); <API key>(&a, &__$true); <API key>(&a, &__$false); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, testArray5) { zval __$null, a; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_NULL(&__$null); ZVAL_UNDEF(&a); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0 TSRMLS_CC); <API key>(&a, &__$null); <API key>(&a, &__$null); <API key>(&a, &__$null); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, testArray6) { zval a, _0; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&a); ZVAL_UNDEF(&_0); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "x"); <API key>(&a, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "y"); <API key>(&a, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "z"); <API key>(&a, &_0); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, testArray7) { int a = 0, b = 0, c = 0; zval d, _0; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&d); ZVAL_UNDEF(&_0); ZEPHIR_MM_GROW(); a = 1; b = 2; c = 3; ZEPHIR_INIT_VAR(&d); zephir_create_array(&d, 3, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(&_0); ZVAL_LONG(&_0, a); <API key>(&d, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, b); <API key>(&d, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, c); <API key>(&d, &_0); RETURN_CCTOR(d); } PHP_METHOD(Test_NativeArray, testArray8) { double a = 0, b = 0, c = 0; zval d, _0; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&d); ZVAL_UNDEF(&_0); ZEPHIR_MM_GROW(); a = (double) (1); b = (double) (2); c = (double) (3); ZEPHIR_INIT_VAR(&d); zephir_create_array(&d, 3, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(&_0); ZVAL_DOUBLE(&_0, a); <API key>(&d, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_DOUBLE(&_0, b); <API key>(&d, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_DOUBLE(&_0, c); <API key>(&d, &_0); RETURN_CCTOR(d); } PHP_METHOD(Test_NativeArray, testArray9) { zend_bool a = 0, b = 0, c = 0; zval d, _0; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&d); ZVAL_UNDEF(&_0); ZEPHIR_MM_GROW(); a = 1; b = 0; c = 1; ZEPHIR_INIT_VAR(&d); zephir_create_array(&d, 3, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(&_0); ZVAL_BOOL(&_0, a); <API key>(&d, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_BOOL(&_0, b); <API key>(&d, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_BOOL(&_0, c); <API key>(&d, &_0); RETURN_CCTOR(d); } PHP_METHOD(Test_NativeArray, testArray10) { zval a, b, c; zval d; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&d); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZVAL_UNDEF(&c); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); ZVAL_STRING(&a, "hello1"); ZEPHIR_INIT_VAR(&b); ZVAL_STRING(&b, "hello2"); ZEPHIR_INIT_VAR(&c); ZVAL_STRING(&c, "hello3"); ZEPHIR_INIT_VAR(&d); zephir_create_array(&d, 3, 0 TSRMLS_CC); <API key>(&d, &a); <API key>(&d, &b); <API key>(&d, &c); RETURN_CCTOR(d); } PHP_METHOD(Test_NativeArray, testArray11) { zval a, b, c, _0; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZVAL_UNDEF(&c); ZVAL_UNDEF(&_0); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(&_0); ZVAL_LONG(&_0, 1); <API key>(&a, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 2); <API key>(&a, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 3); <API key>(&a, &_0); ZEPHIR_INIT_VAR(&b); zephir_create_array(&b, 3, 0 TSRMLS_CC); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 4); <API key>(&b, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 5); <API key>(&b, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 6); <API key>(&b, &_0); ZEPHIR_INIT_VAR(&c); zephir_create_array(&c, 2, 0 TSRMLS_CC); <API key>(&c, &a); <API key>(&c, &b); RETURN_CCTOR(c); } PHP_METHOD(Test_NativeArray, testArray12) { zval a, b, c, _0; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZVAL_UNDEF(&c); ZVAL_UNDEF(&_0); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(&_0); ZVAL_LONG(&_0, 1); <API key>(&a, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 2); <API key>(&a, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 3); <API key>(&a, &_0); ZEPHIR_INIT_VAR(&b); zephir_create_array(&b, 1, 0 TSRMLS_CC); <API key>(&b, &a); ZEPHIR_INIT_VAR(&c); zephir_create_array(&c, 1, 0 TSRMLS_CC); <API key>(&c, &b); RETURN_CCTOR(c); } PHP_METHOD(Test_NativeArray, testArray13) { zval a; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&a); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0 TSRMLS_CC); add_index_stringl(&a, 1, SL("hello1")); add_index_stringl(&a, 2, SL("hello2")); add_index_stringl(&a, 3, SL("hello3")); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, testArray14) { zval a; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&a); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0 TSRMLS_CC); add_assoc_long_ex(&a, SL("hello1"), 1); add_assoc_long_ex(&a, SL("hello2"), 2); add_assoc_long_ex(&a, SL("hello3"), 3); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, testArray15) { zval __$true, __$false, a; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_BOOL(&__$true, 1); ZVAL_BOOL(&__$false, 0); ZVAL_UNDEF(&a); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0 TSRMLS_CC); <API key>(&a, SL("hello1"), &__$true, PH_COPY | PH_SEPARATE); <API key>(&a, SL("hello2"), &__$false, PH_COPY | PH_SEPARATE); <API key>(&a, SL("hello3"), &__$true, PH_COPY | PH_SEPARATE); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, testArray16) { zval a; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&a); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0 TSRMLS_CC); add_assoc_double_ex(&a, SL("hello1"), 1.0); add_assoc_double_ex(&a, SL("hello2"), 2.0); add_assoc_double_ex(&a, SL("hello3"), 3.0); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, testArray17) { zval __$null, a; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_NULL(&__$null); ZVAL_UNDEF(&a); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0 TSRMLS_CC); <API key>(&a, SL("hello1"), &__$null, PH_COPY | PH_SEPARATE); <API key>(&a, SL("hello2"), &__$null, PH_COPY | PH_SEPARATE); <API key>(&a, SL("hello3"), &__$null, PH_COPY | PH_SEPARATE); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, testArray18) { zval a; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&a); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0 TSRMLS_CC); <API key>(&a, SL("hello1"), SL("a")); <API key>(&a, SL("hello2"), SL("b")); <API key>(&a, SL("hello3"), SL("c")); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, testArray19) { zval __$true, __$false, a; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_BOOL(&__$true, 1); ZVAL_BOOL(&__$false, 0); ZVAL_UNDEF(&a); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0 TSRMLS_CC); <API key>(&a, 0, &__$true, PH_COPY <API key>); <API key>(&a, 1, &__$false, PH_COPY <API key>); <API key>(&a, 2, &__$true, PH_COPY <API key>); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, testArray20) { zval a; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&a); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0 TSRMLS_CC); add_index_double(&a, 0, 1.0); add_index_double(&a, 1, 2.0); add_index_double(&a, 2, 3.0); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, testArray21) { zval __$null, a; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_NULL(&__$null); ZVAL_UNDEF(&a); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0 TSRMLS_CC); <API key>(&a, 0, &__$null, PH_COPY <API key>); <API key>(&a, 1, &__$null, PH_COPY <API key>); <API key>(&a, 2, &__$null, PH_COPY <API key>); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, testArray22) { zval a; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&a); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0 TSRMLS_CC); add_index_long(&a, 0, 4); add_index_long(&a, 1, 5); add_index_long(&a, 2, 6); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, testArray23) { int b = 0; zval a, _0; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&a); ZVAL_UNDEF(&_0); ZEPHIR_MM_GROW(); b = 0; ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(&_0); ZVAL_LONG(&_0, b); <API key>(&a, 0, &_0, PH_COPY <API key>); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, b); <API key>(&a, 1, &_0, PH_COPY <API key>); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, b); <API key>(&a, 2, &_0, PH_COPY <API key>); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, testArray24) { double b = 0; zval a, _0; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&a); ZVAL_UNDEF(&_0); ZEPHIR_MM_GROW(); b = 0.0; ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(&_0); ZVAL_DOUBLE(&_0, b); <API key>(&a, 0, &_0, PH_COPY <API key>); ZEPHIR_INIT_NVAR(&_0); ZVAL_DOUBLE(&_0, b); <API key>(&a, 1, &_0, PH_COPY <API key>); ZEPHIR_INIT_NVAR(&_0); ZVAL_DOUBLE(&_0, b); <API key>(&a, 2, &_0, PH_COPY <API key>); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, testArray25) { zend_bool b = 0; zval a, _0; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&a); ZVAL_UNDEF(&_0); ZEPHIR_MM_GROW(); b = 0; ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(&_0); ZVAL_BOOL(&_0, b); <API key>(&a, 0, &_0, PH_COPY <API key>); ZEPHIR_INIT_NVAR(&_0); ZVAL_BOOL(&_0, b); <API key>(&a, 1, &_0, PH_COPY <API key>); ZEPHIR_INIT_NVAR(&_0); ZVAL_BOOL(&_0, b); <API key>(&a, 2, &_0, PH_COPY <API key>); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, testArray26) { zval a, b; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&b); ZVAL_NULL(&b); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0 TSRMLS_CC); <API key>(&a, 0, &b, PH_COPY <API key>); <API key>(&a, 1, &b, PH_COPY <API key>); <API key>(&a, 2, &b, PH_COPY <API key>); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, testArray27) { zval b; zval a; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&b); ZVAL_STRING(&b, "hello"); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0 TSRMLS_CC); <API key>(&a, 0, &b, PH_COPY <API key>); <API key>(&a, 1, &b, PH_COPY <API key>); <API key>(&a, 2, &b, PH_COPY <API key>); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, testArray28) { zval b; zval a; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&b); ZVAL_STRING(&b, "hello"); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0 TSRMLS_CC); <API key>(&a, 0, &b, PH_COPY <API key>); <API key>(&a, 1, &b, PH_COPY <API key>); <API key>(&a, 2, &b, PH_COPY <API key>); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, testArray29) { long b = 0; zval a; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&a); ZEPHIR_MM_GROW(); b = 1; ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 1, 0 TSRMLS_CC); add_index_stringl(&a, b, SL("hello")); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, testArray30) { zval b; zval a; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&b); ZVAL_STRING(&b, "hello"); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 1, 0 TSRMLS_CC); <API key>(&a, Z_STRVAL_P(&b), Z_STRLEN_P(&b), SL("hello")); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, testArrayAccess1) { zval a, b, _0; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZVAL_UNDEF(&_0); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(&_0); ZVAL_LONG(&_0, 1); <API key>(&a, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 2); <API key>(&a, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 3); <API key>(&a, &_0); <API key>(&b, &a, 0, PH_NOISY | PH_READONLY, "test/nativearray.zep", 248 TSRMLS_CC); RETURN_CTOR(b); } PHP_METHOD(Test_NativeArray, testArrayAccess2) { zval a, b; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0 TSRMLS_CC); add_assoc_long_ex(&a, SL("a"), 1); add_assoc_long_ex(&a, SL("b"), 2); add_assoc_long_ex(&a, SL("c"), 3); <API key>(&b, &a, SL("a"), PH_NOISY | PH_READONLY, "test/nativearray.zep", 258 TSRMLS_CC); RETURN_CTOR(b); } PHP_METHOD(Test_NativeArray, testArrayAccess3) { long c = 0; zval a, b, _0; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZVAL_UNDEF(&_0); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(&_0); ZVAL_LONG(&_0, 1); <API key>(&a, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 2); <API key>(&a, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 3); <API key>(&a, &_0); c = 0; <API key>(&b, &a, c, PH_NOISY | PH_READONLY, "test/nativearray.zep", 270 TSRMLS_CC); RETURN_CTOR(b); } PHP_METHOD(Test_NativeArray, testArrayAccess4) { zval c; zval a, b; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZVAL_UNDEF(&c); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0 TSRMLS_CC); add_assoc_long_ex(&a, SL("a"), 1); add_assoc_long_ex(&a, SL("b"), 2); add_assoc_long_ex(&a, SL("c"), 3); ZEPHIR_INIT_VAR(&c); ZVAL_STRING(&c, "a"); zephir_array_fetch(&b, &a, &c, PH_NOISY | PH_READONLY, "test/nativearray.zep", 282 TSRMLS_CC); RETURN_CTOR(b); } PHP_METHOD(Test_NativeArray, testArrayAccess5) { zval a, b, c; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZVAL_UNDEF(&c); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0 TSRMLS_CC); add_assoc_long_ex(&a, SL("a"), 1); add_assoc_long_ex(&a, SL("b"), 2); add_assoc_long_ex(&a, SL("c"), 3); ZEPHIR_INIT_VAR(&c); ZVAL_STRING(&c, "a"); zephir_array_fetch(&b, &a, &c, PH_NOISY | PH_READONLY, "test/nativearray.zep", 293 TSRMLS_CC); RETURN_CTOR(b); } PHP_METHOD(Test_NativeArray, testArrayAccess6) { zval a, b, _0, _1; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0 TSRMLS_CC); add_assoc_long_ex(&a, SL("a"), 1); add_assoc_long_ex(&a, SL("b"), 2); add_assoc_long_ex(&a, SL("c"), 3); <API key>(&_0, &a, SL("a"), PH_NOISY | PH_READONLY, "test/nativearray.zep", 303 TSRMLS_CC); <API key>(&_1, &a, SL("b"), PH_NOISY | PH_READONLY, "test/nativearray.zep", 303 TSRMLS_CC); ZEPHIR_INIT_VAR(&b); zephir_add_function(&b, &_0, &_1); RETURN_CCTOR(b); } PHP_METHOD(Test_NativeArray, <API key>) { zval _0; zval a, b, _1; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_0); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 1, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(&_0); zephir_create_array(&_0, 2, 0 TSRMLS_CC); add_index_stringl(&_0, 0, SL("a")); add_index_stringl(&_0, 1, SL("b")); <API key>(&a, 0, &_0, PH_COPY <API key>); <API key>(&_1, &a, 0, PH_NOISY | PH_READONLY, "test/nativearray.zep", 313 TSRMLS_CC); <API key>(&b, &_1, 0, PH_NOISY | PH_READONLY, "test/nativearray.zep", 313 TSRMLS_CC); RETURN_CTOR(b); } PHP_METHOD(Test_NativeArray, <API key>) { zval _0; zval a, b, _1, _2; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_0); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 1, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(&_0); zephir_create_array(&_0, 2, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, "a"); <API key>(&_0, &_1); ZEPHIR_INIT_NVAR(&_1); ZVAL_STRING(&_1, "b"); <API key>(&_0, &_1); <API key>(&a, &_0); <API key>(&_2, &a, 0, PH_NOISY | PH_READONLY, "test/nativearray.zep", 323 TSRMLS_CC); <API key>(&b, &_2, 1, PH_NOISY | PH_READONLY, "test/nativearray.zep", 323 TSRMLS_CC); RETURN_CTOR(b); } PHP_METHOD(Test_NativeArray, <API key>) { zval _0, _1; zval a, b, _2, _3, _4; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); ZVAL_UNDEF(&_4); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 1, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(&_0); zephir_create_array(&_0, 1, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(&_1); zephir_create_array(&_1, 2, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(&_2); ZVAL_STRING(&_2, "a"); <API key>(&_1, &_2); ZEPHIR_INIT_NVAR(&_2); ZVAL_STRING(&_2, "b"); <API key>(&_1, &_2); <API key>(&_0, &_1); <API key>(&a, &_0); <API key>(&_3, &a, 0, PH_NOISY | PH_READONLY, "test/nativearray.zep", 333 TSRMLS_CC); <API key>(&_4, &_3, 0, PH_NOISY | PH_READONLY, "test/nativearray.zep", 333 TSRMLS_CC); <API key>(&b, &_4, 1, PH_NOISY | PH_READONLY, "test/nativearray.zep", 333 TSRMLS_CC); RETURN_CTOR(b); } PHP_METHOD(Test_NativeArray, <API key>) { zval _0, _1; zval a, b, _2, _3, _4; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); ZVAL_UNDEF(&_4); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 1, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(&_0); zephir_create_array(&_0, 1, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(&_1); zephir_create_array(&_1, 2, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(&_2); ZVAL_STRING(&_2, "a"); <API key>(&_1, &_2); ZEPHIR_INIT_NVAR(&_2); ZVAL_STRING(&_2, "b"); <API key>(&_1, &_2); <API key>(&_0, &_1); <API key>(&a, &_0); <API key>(&_3, &a, 0, PH_NOISY | PH_READONLY, "test/nativearray.zep", 343 TSRMLS_CC); <API key>(&_4, &_3, 0, PH_NOISY | PH_READONLY, "test/nativearray.zep", 343 TSRMLS_CC); <API key>(&b, &_4, 1, PH_NOISY | PH_READONLY, "test/nativearray.zep", 343 TSRMLS_CC); RETURN_CTOR(b); } PHP_METHOD(Test_NativeArray, <API key>) { zval _0, _1; zval a, b, _2, _3; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 1, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(&_0); zephir_create_array(&_0, 1, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(&_1); zephir_create_array(&_1, 2, 0 TSRMLS_CC); add_assoc_long_ex(&_1, SL("c"), 0); add_assoc_long_ex(&_1, SL("d"), 1); <API key>(&_0, SL("b"), &_1, PH_COPY | PH_SEPARATE); <API key>(&a, SL("a"), &_0, PH_COPY | PH_SEPARATE); <API key>(&_2, &a, SL("a"), PH_NOISY | PH_READONLY, "test/nativearray.zep", 353 TSRMLS_CC); <API key>(&_3, &_2, SL("b"), PH_NOISY | PH_READONLY, "test/nativearray.zep", 353 TSRMLS_CC); <API key>(&b, &_3, SL("c"), PH_NOISY | PH_READONLY, "test/nativearray.zep", 353 TSRMLS_CC); RETURN_CTOR(b); } PHP_METHOD(Test_NativeArray, testArrayUpdate1) { zval a, _0; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&a); ZVAL_UNDEF(&_0); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(&_0); ZVAL_LONG(&_0, 1); <API key>(&a, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 2); <API key>(&a, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 3); <API key>(&a, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 4); <API key>(&a, 0, &_0, PH_COPY | PH_SEPARATE <API key>); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, testArrayUpdate2) { int b = 0; zval a, _0; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&a); ZVAL_UNDEF(&_0); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(&_0); ZVAL_LONG(&_0, 1); <API key>(&a, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 2); <API key>(&a, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 3); <API key>(&a, &_0); b = 0; ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 4); <API key>(&a, b, &_0, PH_COPY | PH_SEPARATE <API key>); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, testArrayUpdate3) { int b = 0; zval a, _0, _1; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&a); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(&_0); ZVAL_LONG(&_0, 1); <API key>(&a, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 2); <API key>(&a, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 3); <API key>(&a, &_0); b = 0; ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 4); <API key>(&a, b, &_0, PH_COPY | PH_SEPARATE <API key>); b = 1; ZEPHIR_INIT_VAR(&_1); ZVAL_LONG(&_1, 5); <API key>(&a, b, &_1, PH_COPY | PH_SEPARATE <API key>); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, testArrayUpdate4) { zval a, _0; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&a); ZVAL_UNDEF(&_0); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0 TSRMLS_CC); add_assoc_long_ex(&a, SL("a"), 1); add_assoc_long_ex(&a, SL("b"), 2); add_assoc_long_ex(&a, SL("c"), 3); ZEPHIR_INIT_VAR(&_0); ZVAL_LONG(&_0, 4); <API key>(&a, SL("a"), &_0, PH_COPY | PH_SEPARATE); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, testArrayUpdate5) { zval _1, _2, _3; zval a, _0; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&a); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(&_0); ZVAL_LONG(&_0, 1); <API key>(&a, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 2); <API key>(&a, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 3); <API key>(&a, &_0); ZEPHIR_INIT_VAR(&_1); zephir_create_array(&_1, 3, 0 TSRMLS_CC); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 1); <API key>(&_1, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 2); <API key>(&_1, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 3); <API key>(&_1, &_0); <API key>(&a, 0, &_1, PH_COPY | PH_SEPARATE <API key>); ZEPHIR_INIT_VAR(&_2); zephir_create_array(&_2, 3, 0 TSRMLS_CC); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 1); <API key>(&_2, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 2); <API key>(&_2, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 3); <API key>(&_2, &_0); <API key>(&a, 1, &_2, PH_COPY | PH_SEPARATE <API key>); ZEPHIR_INIT_VAR(&_3); zephir_create_array(&_3, 3, 0 TSRMLS_CC); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 1); <API key>(&_3, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 2); <API key>(&_3, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 3); <API key>(&_3, &_0); <API key>(&a, 2, &_3, PH_COPY | PH_SEPARATE <API key>); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, testArrayAppend1) { zval _1; zval __$null, a, _0; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_NULL(&__$null); ZVAL_UNDEF(&a); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); array_init(&a); ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "hello"); zephir_array_append(&a, &_0, PH_SEPARATE, "test/nativearray.zep", 405); zephir_array_append(&a, &__$null, PH_SEPARATE, "test/nativearray.zep", 405); ZEPHIR_INIT_NVAR(&_0); ZVAL_BOOL(&_0, 0); zephir_array_append(&a, &_0, PH_SEPARATE, "test/nativearray.zep", 405); ZEPHIR_INIT_NVAR(&_0); ZVAL_DOUBLE(&_0, 1.10); zephir_array_append(&a, &_0, PH_SEPARATE, "test/nativearray.zep", 405); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 5); zephir_array_append(&a, &_0, PH_SEPARATE, "test/nativearray.zep", 405); ZEPHIR_INIT_VAR(&_1); zephir_create_array(&_1, 3, 0 TSRMLS_CC); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 1); <API key>(&_1, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 2); <API key>(&_1, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 3); <API key>(&_1, &_0); zephir_array_append(&a, &_1, PH_SEPARATE, "test/nativearray.zep", 405); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, testArrayAppend2) { int f; double e; zend_bool d; zval b; zval a, c, g, _0; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&a); ZVAL_UNDEF(&c); ZVAL_UNDEF(&g); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&b); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&b); ZVAL_STRING(&b, "hello"); ZEPHIR_INIT_VAR(&c); ZVAL_NULL(&c); d = 0; e = 1.10; f = 5; ZEPHIR_INIT_VAR(&g); zephir_create_array(&g, 3, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(&_0); ZVAL_LONG(&_0, 1); <API key>(&g, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 2); <API key>(&g, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 3); <API key>(&g, &_0); ZEPHIR_INIT_VAR(&a); array_init(&a); zephir_array_append(&a, &b, PH_SEPARATE, "test/nativearray.zep", 412); zephir_array_append(&a, &c, PH_SEPARATE, "test/nativearray.zep", 412); ZEPHIR_INIT_NVAR(&_0); ZVAL_BOOL(&_0, d); zephir_array_append(&a, &_0, PH_SEPARATE, "test/nativearray.zep", 412); ZEPHIR_INIT_NVAR(&_0); ZVAL_DOUBLE(&_0, e); zephir_array_append(&a, &_0, PH_SEPARATE, "test/nativearray.zep", 412); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, f); zephir_array_append(&a, &_0, PH_SEPARATE, "test/nativearray.zep", 412); zephir_array_append(&a, &g, PH_SEPARATE, "test/nativearray.zep", 412); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, <API key>) { zval __$null, a; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_NULL(&__$null); ZVAL_UNDEF(&a); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); array_init(&a); <API key>(&a, &__$null TSRMLS_CC, SL("ss"), 4, SL("x"), SL("y")); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, <API key>) { zval __$null, a; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_NULL(&__$null); ZVAL_UNDEF(&a); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); array_init(&a); <API key>(&a, &__$null TSRMLS_CC, SL("sss"), 6, SL("x"), SL("y"), SL("z")); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, <API key>) { zval __$null, a; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_NULL(&__$null); ZVAL_UNDEF(&a); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); array_init(&a); <API key>(&a, &__$null TSRMLS_CC, SL("ll"), 2, 0, 1); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, <API key>) { zval __$null, a; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_NULL(&__$null); ZVAL_UNDEF(&a); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); array_init(&a); <API key>(&a, &__$null TSRMLS_CC, SL("lll"), 3, 0, 1, 2); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, <API key>) { zval __$null, a; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_NULL(&__$null); ZVAL_UNDEF(&a); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); array_init(&a); <API key>(&a, &__$null TSRMLS_CC, SL("sls"), 5, SL("a"), 1, SL("c")); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, <API key>) { zval __$null, a; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_NULL(&__$null); ZVAL_UNDEF(&a); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); array_init(&a); <API key>(&a, &__$null TSRMLS_CC, SL("lsl"), 4, 0, SL("b"), 2); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, <API key>) { zval __$true, __$false, a; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_BOOL(&__$true, 1); ZVAL_BOOL(&__$false, 0); ZVAL_UNDEF(&a); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); array_init(&a); <API key>(&a, &__$true TSRMLS_CC, SL("sls"), 5, SL("a"), 1, SL("c")); <API key>(&a, &__$false TSRMLS_CC, SL("lsl"), 4, 0, SL("b"), 2); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, <API key>) { zval __$null, __$true, __$false, a; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_NULL(&__$null); ZVAL_BOOL(&__$true, 1); ZVAL_BOOL(&__$false, 0); ZVAL_UNDEF(&a); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); array_init(&a); <API key>(&a, &__$null TSRMLS_CC, SL("sl"), 3, SL("a"), 0); <API key>(&a, &__$true TSRMLS_CC, SL("sl"), 3, SL("a"), 1); <API key>(&a, &__$false TSRMLS_CC, SL("sl"), 3, SL("a"), 2); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, <API key>) { zval __$null, __$true, __$false, a; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_NULL(&__$null); ZVAL_BOOL(&__$true, 1); ZVAL_BOOL(&__$false, 0); ZVAL_UNDEF(&a); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); array_init(&a); <API key>(&a, &__$null TSRMLS_CC, SL("sl"), 3, SL("a"), 0); <API key>(&a, &__$true TSRMLS_CC, SL("sl"), 3, SL("a"), 1); <API key>(&a, &__$false TSRMLS_CC, SL("sl"), 3, SL("a"), 1); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, <API key>) { zval __$null, __$true, __$false, a; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_NULL(&__$null); ZVAL_BOOL(&__$true, 1); ZVAL_BOOL(&__$false, 0); ZVAL_UNDEF(&a); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); array_init(&a); <API key>(&a, &__$null TSRMLS_CC, SL("sl"), 3, SL("a"), 0); <API key>(&a, &__$true TSRMLS_CC, SL("sl"), 3, SL("a"), 1); <API key>(&a, &__$false TSRMLS_CC, SL("sls"), 5, SL("a"), 1, SL("c")); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, <API key>) { zval __$null, a, b, c; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_NULL(&__$null); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZVAL_UNDEF(&c); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&b); ZVAL_STRING(&b, "y"); ZEPHIR_INIT_VAR(&c); ZVAL_STRING(&c, "x"); ZEPHIR_INIT_VAR(&a); array_init(&a); <API key>(&a, &__$null TSRMLS_CC, SL("zz"), 2, &b, &c); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, <API key>) { zval __$null, a, b, c, d; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_NULL(&__$null); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZVAL_UNDEF(&c); ZVAL_UNDEF(&d); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&b); ZVAL_STRING(&b, "y"); ZEPHIR_INIT_VAR(&c); ZVAL_STRING(&c, "x"); ZEPHIR_INIT_VAR(&d); ZVAL_STRING(&d, "z"); ZEPHIR_INIT_VAR(&a); array_init(&a); <API key>(&a, &__$null TSRMLS_CC, SL("zzz"), 3, &b, &c, &d); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, <API key>) { zval b, c, d, _0; zval __$null, __$false, a; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_NULL(&__$null); ZVAL_BOOL(&__$false, 0); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZVAL_UNDEF(&c); ZVAL_UNDEF(&d); ZVAL_UNDEF(&_0); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&d); zephir_create_array(&d, 3, 0 TSRMLS_CC); <API key>(&d, SL("x"), &__$null, PH_COPY | PH_SEPARATE); <API key>(&d, SL("y"), &__$null, PH_COPY | PH_SEPARATE); <API key>(&d, SL("z"), &__$null, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_VAR(&b); zephir_create_array(&b, 3, 0 TSRMLS_CC); add_assoc_long_ex(&b, SL("a"), 1); add_assoc_long_ex(&b, SL("b"), 2); <API key>(&b, SL("c"), &d, PH_COPY | PH_SEPARATE); ZEPHIR_CPY_WRT(&c, &b); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 2, 0 TSRMLS_CC); <API key>(&a, 0, &b, PH_COPY <API key>); ZEPHIR_INIT_VAR(&_0); zephir_create_array(&_0, 3, 0 TSRMLS_CC); add_assoc_long_ex(&_0, SL("a"), 1); add_assoc_long_ex(&_0, SL("b"), 2); add_assoc_long_ex(&_0, SL("c"), 3); <API key>(&a, 1, &_0, PH_COPY <API key>); <API key>(&a, &__$false TSRMLS_CC, SL("lss"), 5, 0, SL("a"), SL("y")); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, <API key>) { zval __$null, a, b; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_NULL(&__$null); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); array_init(&a); ZEPHIR_INIT_VAR(&b); ZVAL_STRING(&b, "y"); <API key>(&a, &__$null TSRMLS_CC, SL("lsza"), 5, 0, SL("hello"), &b); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, <API key>) { zval x; int b; zval __$null, a; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_NULL(&__$null); ZVAL_UNDEF(&a); ZVAL_UNDEF(&x); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); array_init(&a); b = 100; ZEPHIR_INIT_VAR(&x); ZVAL_STRING(&x, "hello"); <API key>(&a, &__$null TSRMLS_CC, SL("lslza"), 6, 0, SL("hello"), b, &x); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, <API key>) { zval _2; zval __$null, __$false, a, b, _0, _1, _3; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_NULL(&__$null); ZVAL_BOOL(&__$false, 0); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_3); ZVAL_UNDEF(&_2); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&a); array_init(&a); ZEPHIR_INIT_VAR(&b); ZVAL_STRING(&b, "y"); <API key>(&a, &__$null TSRMLS_CC, SL("lsz"), 4, 0, SL("hello"), &b); ZEPHIR_INIT_VAR(&_0); ZVAL_LONG(&_0, 100); <API key>(&a, &_0 TSRMLS_CC, SL("lsza"), 5, 0, SL("hello"), &b); <API key>(&a, &__$false TSRMLS_CC, SL("lsza"), 5, 0, SL("hello"), &b); ZEPHIR_INIT_VAR(&_1); ZVAL_DOUBLE(&_1, 1.2); <API key>(&a, &_1 TSRMLS_CC, SL("lsza"), 5, 0, SL("hello"), &b); ZEPHIR_INIT_VAR(&_2); zephir_create_array(&_2, 3, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(&_3); ZVAL_LONG(&_3, 1); <API key>(&_2, &_3); ZEPHIR_INIT_NVAR(&_3); ZVAL_LONG(&_3, 2); <API key>(&_2, &_3); ZEPHIR_INIT_NVAR(&_3); ZVAL_LONG(&_3, 3); <API key>(&_2, &_3); <API key>(&a, &_2 TSRMLS_CC, SL("lsza"), 5, 0, SL("hello"), &b); RETURN_CCTOR(a); } PHP_METHOD(Test_NativeArray, <API key>) { zval x, y, _0; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&x); ZVAL_UNDEF(&y); ZVAL_UNDEF(&_0); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&x); array_init(&x); ZEPHIR_INIT_VAR(&y); ZVAL_STRING(&y, "hello"); ZEPHIR_INIT_VAR(&_0); object_init(&_0); <API key>(&x, &y, &_0, PH_COPY | PH_SEPARATE); ZEPHIR_MM_RESTORE(); } PHP_METHOD(Test_NativeArray, testArrayKeys) { zval *param, param_sub; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&param_sub); zephir_fetch_params(0, 1, 0, &param); zephir_array_keys(return_value, param TSRMLS_CC); return; } PHP_METHOD(Test_NativeArray, testImplodeArray) { zval *param, param_sub, _0; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&param_sub); ZVAL_UNDEF(&_0); ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &param); ZEPHIR_INIT_VAR(&_0); zephir_array_keys(&_0, param TSRMLS_CC); <API key>(return_value, SL("|"), &_0 TSRMLS_CC); RETURN_MM(); } PHP_METHOD(Test_NativeArray, issue110) { zval byteUnits, _0; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&byteUnits); ZVAL_UNDEF(&_0); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&byteUnits); zephir_create_array(&byteUnits, 9, 0 TSRMLS_CC); add_assoc_long_ex(&byteUnits, SL("B"), 0); add_assoc_long_ex(&byteUnits, SL("K"), 10); add_assoc_long_ex(&byteUnits, SL("M"), 20); add_assoc_long_ex(&byteUnits, SL("G"), 30); add_assoc_long_ex(&byteUnits, SL("T"), 40); add_assoc_long_ex(&byteUnits, SL("KB"), 10); add_assoc_long_ex(&byteUnits, SL("MB"), 20); add_assoc_long_ex(&byteUnits, SL("GB"), 30); add_assoc_long_ex(&byteUnits, SL("TB"), 40); ZEPHIR_INIT_VAR(&_0); zephir_array_keys(&_0, &byteUnits TSRMLS_CC); <API key>(return_value, SL("|"), &_0 TSRMLS_CC); RETURN_MM(); } PHP_METHOD(Test_NativeArray, issue264) { zval *tokens_param = NULL; zval tokens; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&tokens); ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &tokens_param); zephir_get_arrval(&tokens, tokens_param); RETURN_MM_BOOL(!(<API key>(&tokens, 1))); } PHP_METHOD(Test_NativeArray, issue743a) { zval *current_param = NULL, _0; zval current; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&current); ZVAL_UNDEF(&_0); ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &current_param); zephir_get_arrval(&current, current_param); ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "ok"); <API key>(&current, &_0 TSRMLS_CC, SL("ls"), 3, 42, SL("str")); RETURN_CTOR(current); } PHP_METHOD(Test_NativeArray, issue743b) { zval *current_param = NULL, _0; zval current; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&current); ZVAL_UNDEF(&_0); ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &current_param); zephir_get_arrval(&current, current_param); ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "ok"); <API key>(&current, &_0 TSRMLS_CC, SL("sl"), 3, SL("str"), 42); RETURN_CTOR(current); } PHP_METHOD(Test_NativeArray, issue743c) { zval *current_param = NULL, key, _0; zval current; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&current); ZVAL_UNDEF(&key); ZVAL_UNDEF(&_0); ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &current_param); zephir_get_arrval(&current, current_param); ZEPHIR_INIT_VAR(&key); ZVAL_STRING(&key, "hey"); ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "ok"); <API key>(&current, &_0 TSRMLS_CC, SL("sz"), 3, SL("str"), &key); RETURN_CTOR(current); } PHP_METHOD(Test_NativeArray, issue709) { zend_bool works, _0, _7$$3; zval c, arr, _3$$3, _4$$3, _5$$3; int <API key>, _1, _2; <API key> *_6 = NULL; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&c); ZVAL_UNDEF(&arr); ZVAL_UNDEF(&_3$$3); ZVAL_UNDEF(&_4$$3); ZVAL_UNDEF(&_5$$3); ZEPHIR_MM_GROW(); works = 1; _2 = 50; _1 = 0; _0 = 0; if (_1 <= _2) { while (1) { if (_0) { _1++; if (!(_1 <= _2)) { break; } } else { _0 = 1; } ZEPHIR_INIT_NVAR(&c); ZVAL_LONG(&c, _1); ZEPHIR_INIT_NVAR(&arr); zephir_create_array(&arr, 2, 0 TSRMLS_CC); ZEPHIR_INIT_NVAR(&_3$$3); ZVAL_LONG(&_3$$3, 1); <API key>(&arr, &_3$$3); ZEPHIR_INIT_NVAR(&_3$$3); ZVAL_LONG(&_3$$3, 2); <API key>(&arr, &_3$$3); <API key>(&_5$$3, "array_rand", &_6, 46, &arr); <API key>(); zephir_array_fetch(&_4$$3, &arr, &_5$$3, PH_NOISY | PH_READONLY, "test/nativearray.zep", 636 TSRMLS_CC); ZEPHIR_CPY_WRT(&arr, &_4$$3); _7$$3 = ZEPHIR_LT_LONG(&arr, 0); if (!(_7$$3)) { _7$$3 = ZEPHIR_GT_LONG(&arr, 2); } if (_7$$3) { works = 0; } } } RETURN_MM_BOOL(works); }
import axios from 'axios'; import {globalState} from '../state'; import BaseModel from './base'; export default class Guild extends BaseModel { constructor(obj) { super(); this.fromData(obj); this.config = null; } fromData(obj) { this.id = obj.id; this.ownerID = obj.owner_id; this.name = obj.name; this.icon = obj.icon; this.splash = obj.splash; this.region = obj.region; this.enabled = obj.enabled; this.whitelist = obj.whitelist; this.features = obj.features; this.role = obj.role; this.events.emit('update', this); } update() { return new Promise((resolve, reject) => { axios.get(`/api/guilds/${this.id}`).then((res) => { this.fromData(res.data); resolve(res.data); }).catch((err) => { reject(err.response.data); }); }); } getConfig(refresh = false) { if (this.config && !refresh) { return new Promise((resolve) => { resolve(this.config); }); } return new Promise((resolve, reject) => { axios.get(`/api/guilds/${this.id}/config`).then((res) => { resolve(res.data); }).catch((err) => { reject(); }); }); } getConfigHistory() { return new Promise((resolve, reject) => { axios.get(`/api/guilds/${this.id}/config/history`).then((res) => { let data = res.data data = data.map(obj => { obj.created_timestamp = Math.floor(new Date(obj.created_at).getTime() / 1000); obj.created = new Date(obj.created_at).toLocaleString(); obj.user.discriminator = String(obj.user.discriminator).padStart(4, "0"); return obj; }); resolve(data); }).catch((err) => { reject(); }); }); } getMessageStats() { return new Promise((resolve, reject) => { axios.get(`/api/guilds/${this.id}/stats/messages`).then((res) => { resolve(res.data); }).catch((err) => { reject(); }); }); } getSelfStats() { return new Promise((resolve, reject) => { axios.get(`/api/guilds/${this.id}/stats/self`).then((res) => { resolve(res.data); }).catch((err) => { reject(); }); }); } putConfig(config) { return new Promise((resolve, reject) => { axios.post(`/api/guilds/${this.id}/config`, {config: config}).then((res) => { resolve(); }).catch((err) => { reject(err.response.data); }); }); } getInfractions(page, limit, sorted, filtered) { let params = {page, limit}; if (sorted) { params.sorted = JSON.stringify(sorted) } if (filtered) { params.filtered = JSON.stringify(filtered) } return new Promise((resolve, reject) => { axios.get(`/api/guilds/${this.id}/infractions`, {params: params}).then((res) => { resolve(res.data); }).catch((err) => { reject(err.response.data); }); }); } delete() { return new Promise((resolve, reject) => { axios.delete(`/api/guilds/${this.id}`).then((res) => { resolve(); }).catch((err) => { reject(err.response.data); }) }); } }
<?php /* * PHPUnit is required in order to run these tests. * You can install PHPUnit by running requirements.sh * packaged with MTV. * * You'll also need to edit the accompanying settings.json file * in this directory and update the hostname of the WordPress * install you're using to run these tests. * * Note: if you encounter errors and/or failures when * running tests, you should try fixing errors first. They're * usually easier to tackle and might resolve failures. */ require_once 'lib/cli-load.php'; require_once 'PHPUnit/Autoload.php'; require_once 'PHPUnit/Util/ErrorHandler.php'; // All tests $tests = array(); // Printer object will eventually print results $printer = new <API key>( NULL, true, !stristr(PHP_OS, 'WIN')); // Results object tracks results for all tests $result = new <API key>; $result->addListener($printer); // Test core MTV functions require_once 'test_core.php'; $tests['MTVCoreTest'] = new <API key>('MTVCoreTest'); // Test MTV's http lib require_once 'test_http.php'; $tests['MTVHttpTest'] = new <API key>('MTVHttpTest'); // Test Model model require_once 'test_model.php'; $tests['MTVModelTest'] = new <API key>('MTVModelTest'); // Test Collection model require_once 'test_collection.php'; $tests['MTVCollectionTest'] = new <API key>('MTVCollectionTest'); // TODO: // Test Post model // Stub // Test PostCollection model // Stub // Test User model // Stub // Test UserCollection model // stub // Test Site model // stub // Test SiteCollection model // stub // Add above test suites to master suite and run, printing the result $suite = new <API key>(); foreach ($tests as $k => $v) $suite->addTestSuite($k); $suite->run($result); $printer->printResult($result);
class Screen_Name class << self def create *args r = new r.create *args end end # Possible args: # hash # customer, 'screen_name' def create *args raise ":create no longer accepts #{args.first.inspect}" if args.first.is_a?(Symbol) raw_data = if args.size == 2 && args.first.is_a?(Customer) && args.last.is_a?(String) {:customer=>args.first, :screen_name=>args.last} else args.shift end @new_data = raw_data @clean_data = {} is_new_owner = !new_data[:customer].data[:id] validate(:screen_name).required validate(:class_id) validate(:read_able). one_of_these(['@W', '@P', '@N'], "Allowed values: @W (world) @P (private) @N (no one)") insert_data = { :owner_id => is_new_owner ? 0 : new_data[:customer].data[:id], :screen_name => clean_data[:screen_name], :display_name => clean_data[:screen_name] } begin new_record = TABLE.returning.insert(insert_data).first rescue Sequel::<API key> => e raise e unless e.message['"<API key>"'] raise self.class::Invalid.new(self, "Screen name already taken: #{clean_data[:screen_name]}") end me = self.class.new(new_record) if is_new_owner me.data[:owner_id] = me.id new_data[:customer].clean_data[:id] = me.id end return me unless is_new_owner new_row = TABLE.returning.where(:id=>me.id).update(:owner_id=>me.id).first new_data[:customer].data[:id] = me.id new_data[:customer].clear_cache self.class.new(me.data.merge new_row) end end
import { Component, EventEmitter, Output } from '@angular/core'; import { fadeAnimation, slideAnimation } from '@app/framework'; @Component({ selector: '<API key>', styleUrls: ['./onboarding-dialog.component.scss'], templateUrl: './onboarding-dialog.component.html', animations: [ fadeAnimation, slideAnimation, ], }) export class <API key> { public step = 0; @Output() public close = new EventEmitter(); public next() { this.step += 1; } }
<?php namespace Application\Database\Video; use Application\Database\Video\Video; use Zend\Db\ResultSet\ResultSet; use Zend\Db\TableGateway\TableGateway; class <API key> { public function __invoke($serviceManager) { $adapter = $serviceManager->get('Application\Database\DatabaseService')->getAdapter(); $resultSet = new ResultSet(); $resultSet-><API key>(new Video()); return new TableGateway('video', $adapter, null, $resultSet); } }
<div class="ink-shade fade"> <div class="ink-modal" data-trigger="dummy" data-bind="attr: {'data-width': modalWidth, 'data-height': modalHeight}"> <div class="modal-header"> <button class="modal-close ink-dismiss"></button> <h5 data-bind="text: title"></h5> </div> <div class="modal-body" id="modalContent"></div> <div class="modal-footer"> <div class="push-right"> <button class="ink-button blue" data-bind="click: confirm, disable: confirmDisabled, text: confirmCaption"></button> <button class="ink-button red ink-dismiss" data-bind="click: cancel, visible: cancelVisible">Cancel</button> </div> <div class="push-left" data-bind="foreach: taskButtons"> <button class="ink-button" data-bind="click: $parent.handleTask.bind($parent, handler), css: cssClass"> <i data-bind="css: icon"></i> <span data-bind="text: caption"></span> </button> </div> </div> </div> </div>
'use strict'; var isA = require("Espresso/oop").isA; var oop = require("Espresso/oop").oop; var init = require("Espresso/oop").init; var trim = require("Espresso/trim").trim; var isA = require("Espresso/oop").isA; var oop = require("Espresso/oop").oop; var <API key> = require("Espresso/Security/Core/Authentication/Provider/<API key>); var TypeException = require("Espresso/TypeException"); var <API key> = require("Espresso/Security/Core/Exception/<API key>"); var RememberMeToken = require("Espresso/Security/Core/Authentication/Token/RememberMeToken"); var authenticate = function(token){ if(!isA(token,"Espresso/Security/Core/Authentication/Token/TokenInterface")) throw new TypeException('token has to be of type "Espresso/Security/Core/Authentication/Token/TokenInterface"'); if (!this.supports(token)) { return; } if (this.__.secret !== token.getSecret()) { throw new <API key>('The presented secret does not match.'); } var user = token.getUser(); this.__.userChecker.checkPreAuth(user); var authenticatedToken = new RememberMeToken(user, this.__.providerKey, this.__.secret); authenticatedToken.setAttributes(token.getAttributes()); return authenticatedToken; } var supports = function(token){ if(!isA(token,"Espresso/Security/Core/Authentication/Token/TokenInterface")) throw new TypeException('token has to be of type "Espresso/Security/Core/Authentication/Token/TokenInterface"'); return isA(token,"Espresso/Security/Core/Authentication/Token/RememberMeToken") && token.getProviderKey() === this.__.providerKey; } var RememberMe<API key> = function(userChecker, secret, providerKey){ if(!isA(userChecker,"Espresso/Security/Core/User/<API key>")) throw new TypeException('userChecker has to be of type "Espresso/Security/Core/User/<API key>"'); if(!isA(this,"Espresso/Security/Core/Authentication/Provider/<API key>)) init(this,<API key>); oop(this,"Espresso/Security/Core/Authentication/Provider/RememberMe<API key>); this.__.secret = secret; this.__.providerKey = providerKey; } RememberMe<API key>.prototype.authenticate = authenticate; RememberMe<API key>.prototype.supports = supports; module.exports = RememberMe<API key>;
#include "common_core.h" #include <stdlib.h> /* atoi(3) */ #include <string.h> /* strerror(3) */ #include <errno.h> #include "ipc.h" #include "memory.h" #include "mod_api/lexicon.h" #include "mod_api/hash.h" typedef struct { uint32_t last_wordid; } lexicon_shared_t; typedef struct { lexicon_shared_t *shared; api_hash_t* wordtoid_hash; api_hash_t* idtoword_hash; } lexicon_t; typedef struct _word_db_set_t { int set; int <API key>; int wordtoid_hash_set; int <API key>; int idtoword_hash_set; int set_shared_file; char shared_file[MAX_PATH_LEN]; } word_db_set_t; static word_db_set_t* word_db_set = NULL; static int current_word_db_set = -1; static word_db_t* singleton_word_db[MAX_WORD_DB_SET]; static int <API key>[MAX_WORD_DB_SET]; static int init() { int i; for ( i = 0; i < MAX_WORD_DB_SET; i++ ) { singleton_word_db[i] = NULL; } return SUCCESS; } static int <API key>(lexicon_t *lexicon, char* shared_file, int *mmap_attr) { ipc_t mmap; mmap.type = IPC_TYPE_MMAP; mmap.pathname = shared_file; mmap.size = sizeof(lexicon_shared_t); if ( alloc_mmap(&mmap, 0) != SUCCESS ) { crit("error while allocating mmap for word_db [%s]", shared_file); return FAIL; } if ( mmap.attr == MMAP_CREATED ) memset( mmap.addr, 0, mmap.size ); lexicon->shared = mmap.addr; *mmap_attr = mmap.attr; return SUCCESS; } static int free_shared_word_db(lexicon_t *lexicon) { int ret; ret = free_mmap(lexicon->shared, sizeof(lexicon_shared_t)); if ( ret == SUCCESS ) lexicon->shared = NULL; return ret; } static int open_word_db(word_db_t** word_db, int opt) { int ret, mmap_attr; lexicon_t *db = NULL; if ( word_db_set == NULL ) { warn("word_db_set is NULL. you must set WordDbSet in config file"); return DECLINE; } if ( opt >= MAX_WORD_DB_SET || opt < 0 ) { error("opt[%d] is invalid. MAX_WORD_DB_SET[%d]", opt, MAX_WORD_DB_SET); return FAIL; } if ( !word_db_set[opt].set ) { warn("WordDbSet[opt:%d] is not defined", opt); return DECLINE; } if ( singleton_word_db[opt] != NULL ) { *word_db = singleton_word_db[opt]; <API key>[opt]++; info("reopened word db[set:%d, ref:%d]", opt, <API key>[opt]); return SUCCESS; } if ( !word_db_set[opt].<API key> ) { error("WordToIdHashSet is not set [WordDbSet:%d]. see config", opt); return FAIL; } if ( !word_db_set[opt].set_shared_file ) { error("SharedFile is not set [WordDbSet:%d]. see config", opt); return FAIL; } *word_db = (word_db_t*) sb_calloc(1, sizeof(word_db_t)); if ( *word_db == NULL ) { error("sb_calloc failed: %s", strerror(errno)); goto error; } db = (lexicon_t*) sb_calloc(1, sizeof(lexicon_t)); if ( db == NULL ) { error("sb_calloc failed: %s", strerror(errno)); goto error; } ret = <API key>(db, word_db_set[opt].shared_file, &mmap_attr); if ( ret != SUCCESS ) { error("<API key> failed"); return FAIL; } ret = sb_run_hash_open( &db->wordtoid_hash, word_db_set[opt].wordtoid_hash_set ); if ( ret != SUCCESS ) { error("word->id hash[opt:%d] open failed", word_db_set[opt].wordtoid_hash_set); goto error; } if ( word_db_set[opt].<API key> ) { ret = sb_run_hash_open( &db->idtoword_hash, word_db_set[opt].idtoword_hash_set ); if ( ret != SUCCESS ) { error("id->word hash[opt:%d] open failed", word_db_set[opt].idtoword_hash_set); goto error; } } (*word_db)->set = opt; (*word_db)->db = (void*) db; singleton_word_db[opt] = *word_db; <API key>[opt] = 1; return SUCCESS; error: if ( db ) { if ( db->idtoword_hash ) sb_run_hash_close( db->idtoword_hash ); if ( db->wordtoid_hash ) sb_run_hash_close( db->wordtoid_hash ); if ( db->shared ) free_shared_word_db( db ); sb_free( db ); } if ( *word_db ) { sb_free( *word_db ); *word_db = NULL; } return FAIL; } static int sync_word_db(word_db_t* word_db) { lexicon_t* db; if ( word_db_set == NULL || !word_db_set[word_db->set].set ) return DECLINE; db = (lexicon_t*) word_db->db; info("saving word db[set:%d]...", word_db->set); if ( sync_mmap( db->shared, sizeof(lexicon_shared_t) ) != SUCCESS ) { error("write word_db->shared failed"); return FAIL; } if ( sb_run_hash_sync( db->wordtoid_hash ) != SUCCESS ) { error("word->id hash sync failed"); return FAIL; } if ( !db->idtoword_hash && sb_run_hash_sync( db->idtoword_hash ) != SUCCESS ) { error("id->word hash sync failed"); return FAIL; } info("word db[set:%d] saved", word_db->set); return SUCCESS; } static int close_word_db(word_db_t* word_db) { lexicon_t* db; int set; if ( word_db_set == NULL || !word_db_set[word_db->set].set ) return DECLINE; db = (lexicon_t*) word_db->db; set = word_db->set; info("word db[set:%d] closing...", set); <API key>[set] if ( <API key>[set] ) { info("word db[set:%d, ref:%d] is not closing now", set, <API key>[set]); return SUCCESS; } if ( sb_run_hash_close( db->wordtoid_hash ) != SUCCESS ) error("word->id hash close failed"); if ( db->idtoword_hash && sb_run_hash_close( db->idtoword_hash ) != SUCCESS ) error("id->word hash close failed"); if ( free_shared_word_db( db ) != SUCCESS ) error("word db shared free failed"); info("word db[set:%d] closed", word_db->set); sb_free( word_db->db ); sb_free( word_db ); singleton_word_db[set] = NULL; return SUCCESS; } static int get_new_wordid( word_db_t* word_db, word_t *word ) { lexicon_t* db; hash_data_t wordid, string, oldwordid; int len, ret; if ( word_db_set == NULL || !word_db_set[word_db->set].set ) return DECLINE; db = (lexicon_t*) word_db->db; len = strlen(word->string); if ( len <=0 ) return WORD_NOT_REGISTERED; word->id = db->shared->last_wordid + 1; wordid.data = &word->id; wordid.size = (int) sizeof(word->id); wordid.data_len = (int) sizeof(word->id); wordid.partial_op = 0; string.data = word->string; string.size = len+1; string.data_len = sizeof(word->string); string.partial_op = 0; oldwordid.data = &word->id; oldwordid.data_len = (int) sizeof(word->id); oldwordid.partial_op = 0; ret = sb_run_hash_put( db->wordtoid_hash, &string, &wordid, 0, &oldwordid ); if ( ret == HASH_KEY_EXISTS ) return WORD_OLD_REGISTERED; else if ( ret != SUCCESS ) { error("write to hash (word->id) failed. word[%s]", word->string); return FAIL; } db->shared->last_wordid++; if ( !db->idtoword_hash ) return WORD_NEW_REGISTERED; ret = sb_run_hash_put( db->idtoword_hash, &wordid, &string, 0, NULL ); if ( ret == HASH_KEY_EXISTS ) { crit("that's problem"); error("word[%s] is in invalid state. wordid in hash[%u]", word->string, word->id ); return FAIL; } else if ( ret != SUCCESS ) { error("write to hash (id->word) failed. word[%s]", word->string); return FAIL; } return WORD_NEW_REGISTERED; } static int get_wordid(word_db_t* word_db, word_t *word ) { lexicon_t* db; int len, ret; hash_data_t wordid, string; if ( word_db_set == NULL || !word_db_set[word_db->set].set ) return DECLINE; db = (lexicon_t*) word_db->db; len = strlen(word->string); if ( len <= 0 ) return WORD_NOT_REGISTERED; string.data = word->string; string.size = len+1; string.data_len = sizeof(word->string); wordid.data = &word->id; wordid.data_len = sizeof(word->id); wordid.partial_op = 0; ret = sb_run_hash_get( db->wordtoid_hash, &string, &wordid ); if ( ret == HASH_KEY_NOTEXISTS ) return WORD_NOT_REGISTERED; else if ( ret != SUCCESS ) { error("hash_get failed[%d]. word[%s]", ret, word->string); return FAIL; } else return WORD_OLD_REGISTERED; } static int get_word_by_wordid(word_db_t* word_db, word_t *word ) { lexicon_t* db; int ret; hash_data_t wordid, string; if ( word_db_set == NULL || !word_db_set[word_db->set].set ) return DECLINE; db = (lexicon_t*) word_db->db; if ( !db->idtoword_hash ) { warn("id->word hash is not exists. see config"); return DECLINE; } // id check if ( word->id <= 0 || db->shared->last_wordid < word->id ) { warn("not proper wordid [%u]", word->id); return WORD_NOT_REGISTERED; } wordid.data = &word->id; wordid.size = sizeof(word->id); wordid.data_len = sizeof(word->id); string.data = word->string; string.data_len = sizeof(word->string); string.partial_op = 0; ret = sb_run_hash_get( db->idtoword_hash, &wordid, &string ); if ( ret == HASH_KEY_NOTEXISTS ) return WORD_NOT_REGISTERED; else if ( ret != SUCCESS ) { error("hash_get failed[%d]. wordid[%u]", ret, word->id); return FAIL; } else return WORD_OLD_REGISTERED; } static int get_num_of_wordid(word_db_t* word_db, uint32_t *num_of_word ) { if ( word_db_set == NULL || !word_db_set[word_db->set].set ) return DECLINE; *num_of_word = ((lexicon_t*)word_db->db)->shared->last_wordid; return SUCCESS; } static void get_word_db_set(configValue v) { static word_db_set_t local_word_db_set[MAX_WORD_DB_SET]; int value = atoi( v.argument[0] ); if ( value < 0 || value >= MAX_WORD_DB_SET ) { error("Invalid WordDbSet value[%s], MAX_WORD_DB_SET[%d]", v.argument[0], MAX_WORD_DB_SET); return; } if ( word_db_set == NULL ) { memset( local_word_db_set, 0, sizeof(local_word_db_set) ); word_db_set = local_word_db_set; } current_word_db_set = value; word_db_set[value].set = 1; } static void <API key>(configValue v) { if ( word_db_set == NULL || current_word_db_set < 0 ) { error("first, set WordDbSet"); return; } word_db_set[current_word_db_set].wordtoid_hash_set = atoi( v.argument[0] ); word_db_set[current_word_db_set].<API key> = 1; } static void <API key>(configValue v) { if ( word_db_set == NULL || current_word_db_set < 0 ) { error("first, set WordDbSet"); return; } word_db_set[current_word_db_set].idtoword_hash_set = atoi( v.argument[0] ); word_db_set[current_word_db_set].<API key> = 1; } static void get_shared_file(configValue v) { if ( word_db_set == NULL || current_word_db_set < 0 ) { error("first, set WordDbSet"); return; } strncpy( word_db_set[current_word_db_set].shared_file, v.argument[0], MAX_PATH_LEN ); word_db_set[current_word_db_set].set_shared_file = 1; } static config_t config[] = { CONFIG_GET("WordDbSet", get_word_db_set, 1, "WordDbSet {number}"), CONFIG_GET("WordToIdHashSet", <API key>, 1, "hash for word -> id"), CONFIG_GET("IdToWordHashSet", <API key>, 1, "hash for id -> word"), CONFIG_GET("SharedFile", get_shared_file, 1, "full filename of lexicon_t.shared"), {NULL} }; static void register_hooks(void) { <API key> (open_word_db, NULL, NULL, HOOK_MIDDLE); <API key> (sync_word_db ,NULL, NULL, HOOK_MIDDLE); <API key> (close_word_db, NULL, NULL, HOOK_MIDDLE); <API key> (get_new_wordid, NULL, NULL, HOOK_MIDDLE); sb_hook_get_word (get_wordid, NULL, NULL, HOOK_MIDDLE); <API key> (get_word_by_wordid,NULL, NULL, HOOK_MIDDLE); <API key> (get_num_of_wordid ,NULL, NULL, HOOK_MIDDLE); } module lexicon2_module= { <API key>, config, /* config */ NULL, /* registry */ init, /* initialize function */ NULL, /* child_main */ NULL, /* scoreboard */ register_hooks /* register hook api */ };
package com.myriadmobile.library.shove; import android.app.IntentService; import android.content.Intent; /** * Handles GCM push notifications */ public class ShoveIntentService extends IntentService { public static final String TAG = ShoveIntentService.class.getSimpleName(); public ShoveIntentService() { super(TAG); } @Override public void onHandleIntent(Intent intent) { ShoveClient.INSTANCE.getDelegate().onReceive(this, intent); // Release the wake lock provided by the <API key>. <API key>.<API key>(intent); } }
import React, { Component, PropTypes } from 'react' import classNames from 'classnames' import './List.scss' export default class List extends Component { static propTypes = { className: PropTypes.string, children: PropTypes.node, value: PropTypes.any, onChange: PropTypes.func, onSelect: PropTypes.func, onCheckBoxChange: PropTypes.func, focusOnMount: PropTypes.bool, multiSelect: PropTypes.bool, filter: PropTypes.func } static defaultProps = { focusOnMount: false, multiSelect: false } constructor(props) { super(props) this.state = { focusedIndex: -1 } } componentWillMount() { const { multiSelect, children } = this.props const indicies = [] React.Children.map(children, (child, index) => { const selected = this.isChildSelected(child) if (selected) { indicies.push(index) } }) if (indicies.length === 0) { this.setState({ focusedIndex: -1 }) } else if (multiSelect) { this.setState({ focusedIndex: indicies }) } else { this.setState({ focusedIndex: indicies[0] }) } } componentDidMount() { // Set focus on selected item if (this.props.focusOnMount) { this.requestFocus() } } <API key>(nextProps, nextState) { const { focusedIndex } = this.state if (focusedIndex !== nextState.focusedIndex) return false return true } handleItemSelected = (item, index) => { const { value, onChange, onSelect, multiSelect } = this.props if (onSelect) onSelect(item, item.props.value) // Don't call handle if nut defined, or already selected item is clicked // For multi select is is always called, because items are toggled if (!onChange || (!multiSelect && item.props.value === value)) { return } onChange(item, item.props.value, index, !this.isChildSelected(item)) } <API key> = (item, index, on) => { const { onCheckBoxChange } = this.props if (!onCheckBoxChange) { return } onCheckBoxChange(item, item.props.value, index, on) } handleItemFocused = (index) => { this.setState({ focusedIndex: index }) } handleItemKeyUp = (e, item, index) => { if (e.keyCode === 13) { this.handleItemSelected(item, index) } } handleItemKeyDown = (e, item, index) => { const { focusedIndex } = this.state if (e.keyCode === 38 && focusedIndex > 0) { this[`item-${index - 1}`].focus() this.setState({ focusedIndex: index - 1 }) } else if (e.keyCode === 40 && focusedIndex < this.itemCount - 1) { // Down this[`item-${index + 1}`].focus() this.setState({ focusedIndex: index + 1 }) } } isChildSelected = (child) => { const { value, multiSelect } = this.props if (multiSelect && Array.isArray(value)) { return value.indexOf(child.props.value) > -1 } return value === child.props.value } requestFocus() { const index = this.state.focusedIndex === -1 ? 0 : this.state.focusedIndex const node = this[`item-${index}`] if (node) node.focus() } render() { const { multiSelect, onCheckBoxChange, className, onChange, filter } = this.props let { children } = this.props if (children && !Array.isArray(children)) children = [children] if (children && filter) { children = children.filter(filter) } this.itemCount = children ? children.length : 0 const clonedChildren = React.Children.map(children, (child, index) => { const selected = this.isChildSelected(child) return React.cloneElement(child, { key: index, itemRef: node => this[`item-${index}`] = node, selected, withCheckbox: multiSelect, onCheckBoxChange: (on) => { if (onCheckBoxChange) { this.<API key>(child, index, on) } else { this.handleItemSelected(child, index) } }, onClick: () => { this.handleItemSelected(child, index) }, onFocus: () => { this.handleItemFocused(index) }, onKeyDown: (e) => { this.handleItemKeyDown(e, child, index) }, onKeyUp: (e) => { this.handleItemKeyUp(e, child, index) } }) }) const wrapperProps = { className: classNames('ladbList', className, { ladbListCHdlr: !!onChange }), onKeyUp: this.handleKeyUp } return ( <ul {...wrapperProps}> {clonedChildren} </ul> ) } }
layout: post title: "Sample Link Post" description: "" tags: [, ] comments: true link: https://thisangblog.wordpress.com/ **link post** YAML `link:https://thisangblog.wordpress.com/`,OK This theme supports **link posts**, made famous by John Gruber. To use, just add `link: http://url-you-want-linked` to the post's YAML front matter and you're done.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>rational: Not compatible</title> <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" /> <link href="../../../../../bootstrap.min.css" rel="stylesheet"> <link href="../../../../../bootstrap-custom.css" rel="stylesheet"> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <script src="../../../../../moment.min.js"></script> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file: <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif] </head> <body> <div class="container"> <div class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="../..">clean / released</a></li> <li class="active"><a href="">8.7.0 / rational - 8.5.0</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> rational <small> 8.5.0 <span class="label label-info">Not compatible</span> </small> </h1> <p><em><script>document.write(moment("2020-07-31 07:04:33 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2020-07-31 07:04:33 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-num base Num library distributed with the OCaml compiler base-threads base base-unix base camlp5 7.12 <API key> of OCaml conf-findutils 1 Virtual package relying on findutils conf-m4 1 Virtual package relying on m4 coq 8.7.0 Formal proof management system. num 0 The Num library for arbitrary-precision integer and rational arithmetic ocaml 4.05.0 The OCaml compiler (virtual package) ocaml-base-compiler 4.05.0 Official 4.05.0 release ocaml-config 1 OCaml Switch Configuration ocamlfind 1.8.1 A library manager for OCaml # opam file: opam-version: &quot;2.0&quot; maintainer: &quot;matej.kosik@inria.fr&quot; homepage: &quot;https://github.com/coq-contribs/rational&quot; license: &quot;LGPL 2&quot; build: [make] install: [make &quot;install&quot;] remove: [&quot;rm&quot; &quot;-R&quot; &quot;%{lib}%/coq/user-contrib/Rational&quot;] depends: [ &quot;ocaml&quot; &quot;coq&quot; {&gt;= &quot;8.5&quot; &amp; &lt; &quot;8.6~&quot;} ] tags: [ &quot;keyword:integers&quot; &quot;keyword:rational numbers&quot; &quot;keyword:quotient types&quot; &quot;keyword:subset types&quot; &quot;category:Mathematics/Arithmetic and Number Theory/Rational numbers&quot; ] authors: [ &quot;Samuel Boutin &lt;&gt;&quot; ] bug-reports: &quot;https://github.com/coq-contribs/rational/issues&quot; dev-repo: &quot;git+https://github.com/coq-contribs/rational.git&quot; synopsis: &quot;A definition of rational numbers&quot; description: &quot;&quot;&quot; Definition of integers as the usual symetric completion of a semi-group and of rational numbers as the product of integers and strictly positive integers quotiented by the usual relation. This implementation assumes two sets of axioms allowing to define quotient types and subset types. These sets of axioms should be proved coherent by mixing up the deliverable model and the setoid model (both are presented in Martin Hofmann&#39; thesis).&quot;&quot;&quot; flags: light-uninstall url { src: &quot;https://github.com/coq-contribs/rational/archive/v8.5.0.tar.gz&quot; checksum: &quot;md5=<API key>&quot; } </pre> <h2>Lint</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Dry install</h2> <p>Dry install with the current Coq version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam install -y --show-action coq-rational.8.5.0 coq.8.7.0</code></dd> <dt>Return code</dt> <dd>5120</dd> <dt>Output</dt> <dd><pre>[NOTE] Package coq is already installed (current version is 8.7.0). The following dependencies couldn&#39;t be met: - coq-rational -&gt; coq &lt; 8.6~ -&gt; ocaml &lt; 4.03.0 base of this switch (use `--unlock-base&#39; to force) Your request can&#39;t be satisfied: - No available version of coq satisfies the constraints No solution found, exiting </pre></dd> </dl> <p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-rational.8.5.0</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Install dependencies</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Install</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Installation size</h2> <p>No files were installed.</p> <h2>Uninstall</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Missing removes</dt> <dd> none </dd> <dt>Wrong removes</dt> <dd> none </dd> </dl> </div> </div> </div> <hr/> <div class="footer"> <p class="text-center"> <small>Sources are on <a href="https: </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
class Solution: # @param {integer[]} nums # @return {boolean} def containsDuplicate(self, nums): return len(nums) != len(set(nums))
layout: page title: "Lingshuang Mao" comments: true description: "blanks" keywords: "Lingshuang Mao,CU,Boulder" <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script src="https://dl.dropboxusercontent.com/s/pc42nxpaw1ea4o9/highcharts.js?dl=0"></script> <!-- <script src="../assets/js/highcharts.js"></script> --> <style type="text/css">@font-face { font-family: "Bebas Neue"; src: url(https: } h1.Bebas { font-family: "Bebas Neue", Verdana, Tahoma; } </style> </head> # TEACHING INFORMATION **College**: College of Arts and Sciences **Classes taught**: LING 1020, LING 3100 # LING 1020: Languages of the World **Terms taught**: Fall 2016 **Instructor rating**: 4.88 **Standard deviation in instructor rating**: 0.0 **Average grade** (4.0 scale): 2.98 **Standard deviation in grades** (4.0 scale): 0.0 **Average workload** (raw): 2.22 **Standard deviation in workload** (raw): 0.0 # LING 3100: Language Sound Structures **Terms taught**: Spring 2017 **Instructor rating**: 4.84 **Standard deviation in instructor rating**: 0.0 **Average grade** (4.0 scale): 3.48 **Standard deviation in grades** (4.0 scale): 0.0 **Average workload** (raw): 2.6 **Standard deviation in workload** (raw): 0.0
# <API key>: true describe Nylas::RawMessage do describe ".#send!" do it "calls execute on api with params" do message_string = "MIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\n" \ "Subject: A mime email\n" \ "From: You <your-email@example.com>\n" \ "To: You <#{ENV.fetch('NYLAS_EXAMPLE_EMAIL', 'not-real@example.com')}>\n\n" \ "This is the body of the message sent as a raw mime!" api = FakeAPI.new <API key> = { id: "1234" } allow(api).to receive(:execute).and_return(<API key>) message = described_class.new(message_string, api: api) message.send! expect(api).to have_received(:execute).with( method: :post, path: "/send", payload: message_string, headers: { "Content-type" => "message/rfc822" } ) end end end
<?php defined('BASEPATH') OR exit('No direct script access allowed'); class CI_Log { /** * Path to save log files * * @var string */ protected $_log_path; protected $_file_permissions = 0644; /** * Level of logging * * @var int */ protected $_threshold = 1; /** * Array of threshold levels to log * * @var array */ protected $_threshold_array = array(); /** * Format of timestamp for log files * * @var string */ protected $_date_fmt = 'Y-m-d H:i:s'; /** * Filename extension * * @var string */ protected $_file_ext; /** * Whether or not the logger can write to the log files * * @var bool */ protected $_enabled = TRUE; /** * Predefined logging levels * * @var array */ protected $_levels = array('ERROR' => 1, 'DEBUG' => 2, 'INFO' => 3, 'ALL' => 4); /** * Class constructor * * @return void */ public function __construct() { $config =& get_config(); $this->_log_path = ($config['log_path'] !== '') ? $config['log_path'] : APPPATH.'logs/'; $this->_file_ext = (isset($config['log_file_extension']) && $config['log_file_extension'] !== '') ? ltrim($config['log_file_extension'], '.') : 'php'; file_exists($this->_log_path) OR mkdir($this->_log_path, 0755, TRUE); if ( ! is_dir($this->_log_path) OR ! is_really_writable($this->_log_path)) { $this->_enabled = FALSE; } if (is_numeric($config['log_threshold'])) { $this->_threshold = (int) $config['log_threshold']; } elseif (is_array($config['log_threshold'])) { $this->_threshold = 0; $this->_threshold_array = array_flip($config['log_threshold']); } if ( ! empty($config['log_date_format'])) { $this->_date_fmt = $config['log_date_format']; } if ( ! empty($config['<API key>']) && is_int($config['<API key>'])) { $this->_file_permissions = $config['<API key>']; } } /** * Write Log File * * Generally this function will be called using the global log_message() function * * @param string the error level: 'error', 'debug' or 'info' * @param string the error message * @return bool */ public function write_log($level, $msg) { if ($this->_enabled === FALSE) { return FALSE; } $level = strtoupper($level); if (( ! isset($this->_levels[$level]) OR ($this->_levels[$level] > $this->_threshold)) && ! isset($this->_threshold_array[$this->_levels[$level]])) { return FALSE; } $filepath = $this->_log_path.'log-'.date('Y-m-d').'.'.$this->_file_ext; $message = ''; if ( ! file_exists($filepath)) { $newfile = TRUE; // Only add protection to php files if ($this->_file_ext === 'php') { $message .= "<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>\n\n"; } } if ( ! $fp = @fopen($filepath, 'ab')) { return FALSE; } // Instantiating DateTime with microseconds appended to initial date is needed for proper support of this format if (strpos($this->_date_fmt, 'u') !== FALSE) { $microtime_full = microtime(TRUE); $microtime_short = sprintf("%06d", ($microtime_full - floor($microtime_full)) * 1000000); $date = new DateTime(date('Y-m-d H:i:s.'.$microtime_short, $microtime_full)); $date = $date->format($this->_date_fmt); } else { $date = date($this->_date_fmt); } $message .= $level.' - '.$date.' --> '.$msg."\n"; flock($fp, LOCK_EX); for ($written = 0, $length = strlen($message); $written < $length; $written += $result) { if (($result = fwrite($fp, substr($message, $written))) === FALSE) { break; } } flock($fp, LOCK_UN); fclose($fp); if (isset($newfile) && $newfile === TRUE) { chmod($filepath, $this->_file_permissions); } return is_int($result); } }
# Saving and loading variables in Julia Data format (JLD) [![Build Status](https: [![Build status](https: [![codecov.io](http: [![JLD](http: JLD, for which files conventionally have the extension `.jld`, is a widely-used format for data storage with the Julia programming language. JLD is a specific "dialect" of [HDF5][HDF5], a cross-platform, multi-language data storage format most frequently used for scientific data. By comparison with "plain" HDF5, JLD files automatically add attributes and naming conventions to preserve type information for each object. For lossless storage of arbitrary Julia objects, the only other complete solution appears to be Julia's serializer, which can be accessed via the `serialize` and `deserialize` commands. However, because the serializer is also used for inter-process communication, long-term backwards compatibility is currently uncertain. (The [JLDArchives](https://github.com/JuliaIO/JLDArchives.jl.git) repository exists to test compatibility of older JLD file formats.) If you choose to save data using the serializer, please use the file extension `.jls` to distinguish the files from `.jld` files. **Note:** You should only read JLD files from trusted sources, as JLD files are capable of executing arbitrary code when read in. ## Installation Within Julia, use the package manager: julia Pkg.add("JLD") Currently this also requires the [HDF5 package](https://github.com/timholy/HDF5.jl). ## Quickstart To use the JLD module, begin your code with julia using JLD If you just want to save a few variables and don't care to use the more advanced features, then a simple syntax is: julia t = 15 z = [1,3] save("/tmp/myfile.jld", "t", t, "arr", z) Here we're explicitly saving `t` and `z` as `"t"` and `"arr"` within `myfile.jld`. You can alternatively pass `save` a dictionary; the keys must be strings and are saved as the variable names of their values within the JLD file. You can read these variables back in with julia d = load("/tmp/myfile.jld") which reads the entire file into a returned dictionary `d`. Or you can be more specific and just request particular variables of interest. For example, `z = load("/tmp/myfile.jld", "arr")` will return the value of `arr` from the file and assign it back to z. JLD uses the [FileIO](https://github.com/JuliaIO/FileIO.jl) package to provide a generic interface to `save` and `load` files. However this means that the user needs to explicitly request for the JLD format to be used while saving a new file. julia save("/tmp/foo","bar",0.0) # ambiguous save("/tmp/foo.jld","bar",0.0) # JLD format is inferred from the file extension using FileIO; save(File(format"JLD","/tmp/foo"),"bar",0.0) # JLD format explicitly requested using FileIO This problem is not encountered while loading a JLD file because FileIO can use magic bytes at the beginning of the file to infer its data format. There are also convenience macros `@save` and `@load` that work on the variables themselves. `@save "/tmp/myfile.jld" t z` will create a file with just `t` and `z`; if you don't mention any variables, then it saves all the variables in the current module. Conversely, `@load` will pop the saved variables directly into the global workspace of the current module. However, keep in mind that these macros have significant limitations: for example, you can't use `@load` inside a function, there are constraints on using string interpolation inside filenames, etc. These limitations stem from the fact that Julia compiles functions to machine code before evaluation, so you cannot introduce new variables at runtime or evaluate expressions in other workspaces. The `save` and `load` functions do not have these limitations, and are therefore recommended as being considerably more robust, at the cost of some slight reduction in convenience. More fine-grained control can be obtained using functional syntax: julia jldopen("mydata.jld", "w") do file write(file, "A", A) # alternatively, say "@write file A" end c = jldopen("mydata.jld", "r") do file read(file, "A") end This allows you to add variables as they are generated to an open JLD file. You don't have to use the `do` syntax (`file = jldopen("mydata.jld", "w")` works just fine), but an advantage is that it will automatically close the file (`close(file)`) for you, even in cases of error. Julia's high-level wrapper, providing a dictionary-like interface, may also be of interest: julia using JLD, HDF5 jldopen("test.jld", "w") do file g = g_create(file, "mygroup") # create a group g["dset1"] = 3.2 # create a scalar dataset inside the group g["dest2"] = rand(2,2) end Note that the features of HDF5 generally can also be used on JLD files. ## Types and their definitions You can save objects that have user-defined type; in a fresh Julia session, before loading those objects these types need to be defined. If no definition is available, the JLD module will automatically create the types for you. However, it's important to note that `MyType`, defined automatically by JLD, is not the same `MyType` as defined in an external module---in particular, module functions will not work for types defined by JLD. To ensure that loaded types have the full suite of behaviors provided by their definition in external modules, you should ensure that such modules are available before reading such variables from a `.jld` file. To ensure automatic loading of modules, use `addrequire` to specify any dependencies. For example, suppose you have a file `"MyTypes.jl"` somewhere on your default `LOAD_PATH`, defined this way: julia module MyTypes export MyType struct MyType value::Int end end and you have an object `x` of type `MyType`. Then save `x` in the following way: julia jldopen("somedata.jld", "w") do file addrequire(file, MyTypes) write(file, "x", x) end This will cause `"MyTypes.jl"` to be loaded automatically whenever `"somedata.jld"` is opened. ## If you have performance problems... Please see the complete documentation, particularly the section about custom serializers. ## Complete documentation More extensive documentation, including information about the JLD format conventions, can be found in the [`doc`](doc/) directory. The [`test`](test/) directory contains a number of test scripts that also demonstrate usage. ## Credits - Simon Kornblith and Tim Holy (co-maintainers and primary authors) - Tom Short contributed to string->type conversion - Thanks also to the users who have reported bugs and tested fixes [Julia]: http://julialang.org "Julia" [HDF5]: http:
<?php namespace Sifter; class RequestException extends \Exception { } class Request { private static $host; private static $token; public static function config($host, $token) { static::$host = $host; static::$token = $token; } public static function make($endpoint, $params = array()) { $headers = array( 'X-Sifter-Token: ' . static::$token, 'Accept: application/json', ); $query = http_build_query($params); $request_url = 'https://' . static::$host.$endpoint . '?' . $query; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $request_url); curl_setopt($ch, <API key>, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $raw = curl_exec($ch); curl_close($ch); $response = json_decode($raw, true); if (is_null($response)) { throw new RequestException(strip_tags($raw)); } elseif (isset($response['error'])) { throw new RequestException($response['error'] . ': ' . $response['detail']); } return $response; } }
using System; using UAOOI.Configuration.Networking.Serialization; using UAOOI.SemanticData.UANodeSetValidation.DataSerialization; namespace UAOOI.Networking.Simulator.Boiler.AddressSpace { public abstract partial class DataItemState : <API key> { [Obsolete("This constructor is provided only to make auto-generated code error free")] public DataItemState(NodeState parent) : base(parent) { } public DataItemState(NodeState parent, QualifiedName browseName) : base(parent, browseName) { } } public abstract class AnalogItemState : DataItemState { public AnalogItemState(NodeState parent, QualifiedName browseName) : base(parent, browseName) { } [Obsolete("This constructor is provided only to make auto-generated code error free")] public AnalogItemState(NodeState parent) : base(parent) { } <summary> Gets or sets the engineering unit range. </summary> <value>The eu range.</value> public PropertyState<Range> EURange { get { return m_eURange; } set { if (!Object.ReferenceEquals(m_eURange, value)) ChangeMasks |= <API key>.Children; m_eURange = value; } } private PropertyState<Range> m_eURange; } public class AnalogItemState<type> : AnalogItemState { #region Constructors public AnalogItemState(NodeState parent) : this(parent, "AnalogItemState", ModelExtensions.CreateRange(1, 0)) { } <summary> Initializes the instance with its default attribute values. </summary> public AnalogItemState(NodeState parent, QualifiedName browseName, Range range, type value = default(type)) : base(parent, browseName) { this.EURange = new PropertyState<Range>(this, nameof(EURange)); this.EURange.Value = range; this.Value = value; } #endregion #region Public Members <summary> The value of the variable. </summary> public new type Value { get { return (type)base.Value; } set { base.Value = value; } } #endregion <summary> Gets the type of the value. </summary> <returns>Type.</returns> protected override UATypeInfo GetValueType() { return typeof(type).GetUATypeInfo(); } } public class StateMachineState : BaseObjectState { [Obsolete("This constructor is provided only to make auto-generated code error free")] public StateMachineState(NodeState parent) : base(parent) { } public StateMachineState(NodeState parent, QualifiedName browseName) : base(parent, browseName) { } } public class <API key> : StateMachineState { [Obsolete("This constructor is provided only to make auto-generated code error free")] public <API key>(NodeState parent) : base(parent) { } public <API key>(NodeState parent, QualifiedName browseName) : base(parent, browseName) { } } public class <API key> : <API key> { [Obsolete("This constructor is provided only to make auto-generated code error free")] public <API key>(NodeState parent) : base(parent) { } public <API key>(NodeState parent, QualifiedName browseName) : base(parent, browseName) { } } }
// Description // A Hubot script that returns videos // Configuration: // <API key> // Commands: // hubot F<N> - returns videos // bouzuya <m@bouzuya.net> module.exports = function(robot) { var API_KEY, request; request = require('request-b'); API_KEY = process.env.<API key>; return robot.respond(/(?:umi||)(?:hara|||)(?:kawa||)(?:se|||) (F\d+)$/i, function(res) { var field, keyword, options; field = res.match[1]; keyword = ' ' + field; options = { method: 'GET', url: 'https: qs: { part: 'id,snippet', q: keyword, key: API_KEY } }; return request(options).then(function(r) { var json, messages; json = JSON.parse(r.body); messages = json.items.filter(function(item) { var pattern; pattern = new RegExp(field); return item.snippet.title.match(pattern); }).filter(function(_, i) { return i < 3; }).map(function(item) { return "" + item.snippet.thumbnails["default"].url + "\n" + item.snippet.title + "\n https://youtu.be/" + item.id.videoId; }).join('\n'); return res.send(messages); }); }); };
class FarmCat < ActiveRecord::Base belongs_to :has_farm_cats, :polymorphic => true # has_many :events belongs_to :farm_cat has_many :sub_cats, :class_name => 'FarmCat', :foreign_key => 'farm_cat_id' validates :name, :presence => true def FarmCat.for_class(klass) FarmCat.where(:master_class => klass) end end
<?php // We hide the comments and links now so that we can render them later. hide($content['comments']); hide($content['links']); hide($content['field_title']); hide($content['field_event_banner']); hide($content['field_event_date']); hide($content['<API key>']); hide($content['field_event_title']); hide($content['<API key>']); $file_event_banner = file_load($node->field_event_banner['und'][0]['fid']); ?> <div href="<?php print $node_url; ?>" id="node-<?php print $node->nid; ?>" class="clearfix isolate <?php print $classes; ?>" <?php print $attributes; ?>> <a href="<?php print $node_url; ?>" class="event_teaser"> <div class="event_photo" style="background-image:url('<?php print file_create_url($file_event_banner->uri); ?>');"> <div class="event_date"> <?php print render($content['field_event_date']); ?> </div> <div class="event_title"> <?php print render($title_prefix); ?> <?php if (!$page): ?> <h4<?php print $title_attributes; ?>><?php print $title; ?></h4> <?php endif; ?> <?php print render($title_suffix); ?> </div> <div class="event_location"> <?php print render($content['<API key>']); ?> </div> </div> <div class="event_content"> <?php if ($display_submitted): ?> <div class="submitted"> <?php print $submitted; ?> </div> <?php endif; ?> <div class="content"<?php print $content_attributes; ?>> <h3><?php print render($content['field_event_title']); ?></h3> <?php print render($content); ?> </div> </div> </a> </div>
import { isTranslucent } from './Util'; declare var Cesium; /** * This is the default implementation of a primitive, all primitives extend this class. */ export abstract class Primitive{ protected _show:boolean; protected _modelMatrix: any; protected _renderState: any; protected _drawCommand: any; protected _points: any; protected _indicesArray: number[]; protected _boundingVolume: any; protected _dirty: boolean = true; protected _lastMode: any; protected _color: number[]; protected _vertexArray: any; protected _shaderProgram: any; constructor(options: {show?: boolean, color?: number[]}) { this._show = Cesium.defaultValue(options.show, true); this._color = options.color || [0.0, 0.0, 0.0, 1.0]; this._modelMatrix = Cesium.Matrix4.clone(Cesium.Matrix4.IDENTITY); this._drawCommand = new Cesium.DrawCommand({owner: this}); } get color(): number[] { return this._color; } set color(value: number[]) { this._color = value; this._dirty = true; } get show(): boolean { return this._show; } set show(value: boolean) { this._show = value; } public isTranslucent(){ return isTranslucent(this._color); } protected shouldRender() { return this._show; } protected setupDrawCommand(drawCommand, vertexArray, primitiveType, translucent:boolean = false, <API key>: boolean = false) { drawCommand.modelMatrix = this._modelMatrix; drawCommand.renderState = this._renderState; drawCommand.shaderProgram = this._shaderProgram; drawCommand.boundingVolume = this._boundingVolume; drawCommand.pass = translucent ? Cesium.Pass.TRANSLUCENT : Cesium.Pass.OPAQUE; drawCommand.<API key> = <API key>; drawCommand.primitiveType = primitiveType; drawCommand.vertexArray = vertexArray; } }
#include <headers/hash.h> Hash::Hash(CryptoPP::HashTransformation* h) { this->hashType = h; plaintext = ""; digest = ""; saltlen = 0; salt = ""; } Hash::Hash(){ this->hashType = new CryptoPP::SHA1(); name = "SHA 1"; } Hash::Hash(const Hash &h) { saltlen = h.saltlen; salt = h.salt; plaintext = h.plaintext; digest = h.digest; name = h.name; hashType = h.hashType; } Hash& Hash::operator=(const Hash& h) { saltlen = h.saltlen; salt = h.salt; plaintext = h.plaintext; digest = h.digest; name = h.name; hashType = h.hashType; return *this; } Hash::~Hash() { if(hashType != NULL) { delete hashType; } } void Hash::compute() { digest = ""; using CryptoPP::StringSource; using CryptoPP::HashFilter; using CryptoPP::HexEncoder; using CryptoPP::StringSink; StringSource(salt + plaintext, true, new HashFilter(*hashType, new HexEncoder(new StringSink(digest)))); } void Hash::generateSalt(int len) { unsigned char* buf = new unsigned char[len]; CryptoPP::AutoSeededX917RNG<CryptoPP::DES> securePrg; securePrg.GenerateBlock(buf, len); //hex encoding salt = ""; using CryptoPP::StringSource; using CryptoPP::StringSink; using CryptoPP::HexEncoder; StringSource ss(buf, len, true, new HexEncoder(new StringSink(salt))); } void Hash::setPlaintext(QString s) { plaintext = s.toStdString(); } void Hash::setSalt(QString s) { salt = s.toStdString(); } QString Hash::getDigest() { return QString::fromStdString(digest); } QString Hash::getPlaintext() { return QString::fromStdString(plaintext); } QString Hash::getSalt() { return QString::fromStdString(salt); }
var http = require('http') , URL = require('url') , fs = require('fs') , path = require('path') , async = require('async'); exports.exec = function(config, data, callback) { var url = config.url , outDir = path.resolve(config.dir) , urls = []; if (url) { urls.push(url); } if (Array.isArray(data)) { urls = urls.concat(data); } else { urls.push(data); } if (!path.existsSync(outDir)) { console.debug(outDir); fs.mkdirSync(outDir, '755'); } console.debug(urls); async.forEachSeries(urls, function(url, next) { var u = URL.parse(url), options = { host: u.hostname, port: 80, path: u.pathname + '?' + u.query }; console.debug(u, options); http.get(options, function(res) { var contentType = res.headers['content-type'] , responseData = '' , ext = '.' + contentType.substring(contentType.lastIndexOf('/') + 1); res.setEncoding('binary'); res.on('data', function(chunk) { responseData += chunk; }); res.on('end', function() { var buf = new Buffer(responseData, 'binary'), outFile = path.join(outDir, u.pathname.replace(/\//g, '_') + ext); console.info('Save %s to %s', url, outFile); fs.writeFile(outFile, buf, function(err) { err ? next(err) : next(); }); }) }).on('error', function(err) { next(err); }); }, function(err) { err ? callback(err) : callback(null, data); }); };
// Karma configuration // Generated on Sat Sep 20 2014 20:50:04 GMT+0000 (UTC) module.exports = function(config) { config.set({ // base path that will be used to resolve all patterns (eg. files, exclude) basePath: '../', // frameworks to use frameworks: ['jasmine'], // list of files / patterns to load in the browser files: [ 'bower_components/angular/angular.js', 'bower_components/angular-classy/angular-classy.js', 'classy-initScope.js', 'bower_components/angular-mocks/angular-mocks.js',
/* HIT_START * BUILD: %t %s ../test_common.cpp * TEST: %t * HIT_END */ #include <hip/hip_runtime.h> #include <hip/device_functions.h> #include "test_common.h" #pragma GCC diagnostic ignored "-Wall" #pragma clang diagnostic ignored "-Wunused-variable" __device__ void <API key>() { float fX, fY; __cosf(0.0f); __exp10f(0.0f); __expf(0.0f); #if defined <API key> __fadd_rd(0.0f, 1.0f); #endif __fadd_rn(0.0f, 1.0f); #if defined <API key> __fadd_ru(0.0f, 1.0f); __fadd_rz(0.0f, 1.0f); __fdiv_rd(4.0f, 2.0f); #endif __fdiv_rn(4.0f, 2.0f); #if defined <API key> __fdiv_ru(4.0f, 2.0f); __fdiv_rz(4.0f, 2.0f); #endif __fdividef(4.0f, 2.0f); #if defined <API key> __fmaf_rd(1.0f, 2.0f, 3.0f); #endif __fmaf_rn(1.0f, 2.0f, 3.0f); #if defined <API key> __fmaf_ru(1.0f, 2.0f, 3.0f); __fmaf_rz(1.0f, 2.0f, 3.0f); __fmul_rd(1.0f, 2.0f); #endif __fmul_rn(1.0f, 2.0f); #if defined <API key> __fmul_ru(1.0f, 2.0f); __fmul_rz(1.0f, 2.0f); __frcp_rd(2.0f); #endif __frcp_rn(2.0f); #if defined <API key> __frcp_ru(2.0f); __frcp_rz(2.0f); #endif __frsqrt_rn(4.0f); #if defined <API key> __fsqrt_rd(4.0f); #endif __fsqrt_rn(4.0f); #if defined <API key> __fsqrt_ru(4.0f); __fsqrt_rz(4.0f); __fsub_rd(2.0f, 1.0f); #endif __fsub_rn(2.0f, 1.0f); #if defined <API key> __fsub_ru(2.0f, 1.0f); __fsub_rz(2.0f, 1.0f); #endif __log10f(1.0f); __log2f(1.0f); __logf(1.0f); __powf(1.0f, 0.0f); __saturatef(0.1f); __sincosf(0.0f, &fX, &fY); __sinf(0.0f); __tanf(0.0f); } __global__ void <API key>(int ignored) { <API key>(); } int main() { hipLaunchKernelGGL(<API key>, dim3(1, 1, 1), dim3(1, 1, 1), 0, 0, 1); passed(); }
// Generated by class-dump 3.4 (64 bit) (Debug version compiled Mar 6 2013 16:24:16). @class NSBundle; @interface BRSystemLanguages : NSObject { NSBundle *_promptBundle; } + (id)currentLanguage; - (id)_promptFileForLang:(id)arg1; - (void)dealloc; - (id)getLangsAndPrompts:(BOOL)arg1; - (id)init; @end
var data = [ { stars: 5, secondsPerPlaces: 2, touchDiv: 5 }, { stars: 4, secondsPerPlaces: 3, touchDiv: 4 }, { stars: 3, secondsPerPlaces: 4, touchDiv: 3 }, { stars: 2, secondsPerPlaces: 5, touchDiv: 2 }, { stars: 1, secondsPerPlaces: 6, touchDiv: 1 } ]; function CounterCoins(_level) { this.level = _level; this.start; this.end; this.diff = 0; this.countTouch = 0; this.stars = 0; this.coins = 0; this.alreadyStarted = false; this.alreadyFinish = false; }; CounterCoins.prototype = { touch: function() { if (!this.alreadyStarted) { this.alreadyStarted = true; this.start = +new Date(); // get unix-timestamp in milliseconds } this.countTouch = this.countTouch + 1; }, stop: function() { this.end = +new Date(); // get unix-timestamp in milliseconds this.diff = this.end - this.start; // time difference in milliseconds }, getCoins: function(_stars) { var coins = (_stars * this.level) - this.countTouch; return (coins > 0) ? coins : 0; }, getStars: function() { var places = this.level + 1; for(var i=0;i<data.length;i++) { /* First criterion: number of seconds per place */ var firstCriterion = false; var secondsPerPlaces = (this.diff / 1000) / places; if (secondsPerPlaces <= data[i].secondsPerPlaces) { firstCriterion = true; } /* Second criterion: number of touchs */ var secondCriterion = false; var result = (this.level / data[i].touchDiv) + 1; if (this.countTouch <= result) { secondCriterion = true; } if (firstCriterion && secondCriterion) { return data[i].stars; } } /* Zero stars */ return 0; }, get: function(_won) { if (_won && (this.alreadyFinish === false)) { this.alreadyFinish = true; this.stars = this.getStars(); this.coins = this.getCoins(this.stars); } return { stars: this.stars, coins: this.coins, time: this.diff, touchs: this.countTouch }; } };
# $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'cnp_one_click' require 'capybara' require 'capybara/rspec' require 'webmock/rspec' require 'support/stub_helpers' Capybara.default_driver = :selenium RSpec.configure do |config| config.include Capybara::DSL config.include StubHelpers end
# <API key> A Symfony2 bundle for parsing the contents of a url that specifies which mailer to use. ## Installation and configuration Using [Composer][composer] add the bundle to your dependencies using the require command: `composer require bravesheep/mailer-url-bundle:dev-master`. Add the bundle to your AppKernel Add the bundle in your `app/AppKernel.php`. **Note**: in order for the parameters defined by this bundle to be picked up by Swiftmailer, you need to include this bundle before including the `Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle` bundle. php public function registerBundles() { return array( new Bravesheep\MailerUrlBundle\<API key>(), ); } Configure which urls should be rewritten to parameters For this bundle to work you need to specify which urls need to be rewritten to basic parameters. This bundle can handle any number of urls by configuring the correct properties under `<API key>.urls`. Take a look at this example configuration: yaml <API key>: urls: default: url: %mailer_url% prefix: mailer_ In this case we take the value of the `mailer_url` parameter and create parameters from it prefixed with `mailer_`. ## Usage Take a look at this `parameters.yml.dist` which is distributed by the Symfony2 Standard Edition: yaml parameters: database_driver: pdo_mysql database_host: 127.0.0.1 database_port: ~ database_name: symfony database_user: root database_password: ~ mailer_transport: smtp mailer_host: 127.0.0.1 mailer_user: ~ mailer_password: ~ locale: en <API key> debug_toolbar: true debug_redirects: false <API key>: true As you can see we need 4 parameters to specify the smtp settings, and that doesn't even include setting the port, encryption or authentication methods in the case of SMTP (which might actually vary on different environments). It would be nice if we could reduce the number of parameters required and specify which mailer to use by specifying a single URL: yaml parameters: database_driver: pdo_mysql database_host: 127.0.0.1 database_port: ~ database_name: symfony database_user: root database_password: ~ mailer_url: smtp://127.0.0.1 locale: en <API key> debug_toolbar: true debug_redirects: false <API key>: true Still easily readable, but a lot more concise. The <API key> can do exactly this. Given the configuration as shown in the previous section and this configuration the bundle uses `mailer_url` to create the `mailer_transport` and `mailer_host` with the correct data. In general this bundle takes any valid mailer url and creates the following parameters, prefixed with the specified prefix: `transport`, `host`, `port`, `user`, `password`, `encryption` and `auth_mode`. Accepted URLs URLs are generally formatted in `scheme://user:password@host:port` format. The following schemes are understood: * `smtp` for basic SMTP * `smtp+ssl` or `ssl+smtp` for SMTP with SSL encryption * `smtp+tls` or `tls+smtp` for SMTP with TLS encryption * `gmail` for the GMail mail transport provided by Symfony * `mail` for using the internal `mail()` function in PHP * `sendmail` for using the sendmail binary your system provides The `encryption` (besides using the scheme, which is preferred) and `auth_mode` parameters can be specified via query parameters, for example: `smtp://user:pass@localhost/?encryption=tls&auth_mode=plain`. Valid values for `auth_mode` are `plain`, `login` and `cram-md5`. Gmail URLs may be specified by leaving the everything after the authentication string out, for example: `gmail://user@gmail.com:password`. For mail and sendmail you can use: `mail://` or `mail`, and `sendmail://` or `sendmail` respectively. [composer]: https://getcomposer.org/
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>infotheo: Not compatible </title> <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" /> <link href="../../../../../bootstrap.min.css" rel="stylesheet"> <link href="../../../../../bootstrap-custom.css" rel="stylesheet"> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <script src="../../../../../moment.min.js"></script> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file: <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif] </head> <body> <div class="container"> <div class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="../..">clean / released</a></li> <li class="active"><a href="">8.13.2 / infotheo - 0.1</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> infotheo <small> 0.1 <span class="label label-info">Not compatible </span> </small> </h1> <p> <em><script>document.write(moment("2022-03-02 03:01:05 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-03-02 03:01:05 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-threads base base-unix base conf-findutils 1 Virtual package relying on findutils conf-gmp 4 Virtual package relying on a GMP lib system installation coq 8.13.2 Formal proof management system num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic ocaml 4.09.1 The OCaml compiler (virtual package) ocaml-base-compiler 4.09.1 Official release 4.09.1 ocaml-config 1 OCaml Switch Configuration ocamlfind 1.9.3 A library manager for OCaml zarith 1.12 Implements arithmetic and logical operations over arbitrary-precision integers # opam file: opam-version: &quot;2.0&quot; maintainer: &quot;reynald.affeldt@aist.go.jp&quot; homepage: &quot;https://github.com/affeldt-aist/infotheo&quot; bug-reports: &quot;https://github.com/affeldt-aist/infotheo/issues&quot; dev-repo: &quot;git+https://github.com/affeldt-aist/infotheo.git&quot; license: &quot;GPL-3.0-or-later&quot; authors: [ &quot;Reynald Affeldt&quot; &quot;Manabu Hagiwara&quot; &quot;Jonas Senizergues&quot; &quot;Jacques Garrigue&quot; &quot;Kazuhiko Sakaguchi&quot; &quot;Taku Asai&quot; &quot;Takafumi Saikawa&quot; &quot;Naruomi Obata&quot; &quot;Erik Martin-Dorel&quot; &quot;Ryosuke Obi&quot; &quot;Mitsuharu Yamamoto&quot; ] build: [ [make &quot;-j%{jobs}%&quot;] [make &quot;-C&quot; &quot;extraction&quot; &quot;tests&quot;] {with-test} ] install: [ [make &quot;install&quot;] ] depends: [ &quot;coq&quot; {&gt;= &quot;8.10~&quot;} &quot;coq-mathcomp-field&quot; {&gt;= &quot;1.10.0&quot;} &quot;<API key>&quot; {(&gt;= &quot;0.2.0&quot; &amp; &lt;= &quot;0.2.3&quot;)} ] synopsis: &quot;Infotheo&quot; description: &quot;&quot;&quot; a Coq formalization of information theory and linear error-correcting codes &quot;&quot;&quot; tags: [ &quot;category:Computer Science/Data Types and Data Structures&quot; &quot;keyword: information theory&quot; &quot;keyword: probability&quot; &quot;keyword: error-correcting codes&quot; &quot;logpath:infotheo&quot; &quot;date:2020-03-21&quot; ] url { http: &quot;https://github.com/affeldt-aist/infotheo/archive/v0.1.tar.gz&quot; checksum: &quot;sha512=2565b063c1dd9e6ef0999da7004c2901ab52e6c3667d07dab4ffe8251b7ac2527b69fe7a667f1329d001bb7fb2076d75cae45258037bd1a5fcc2414571479bf5&quot; } </pre> <h2>Lint</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Dry install </h2> <p>Dry install with the current Coq version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam install -y --show-action coq-infotheo.0.1 coq.8.13.2</code></dd> <dt>Return code</dt> <dd>5120</dd> <dt>Output</dt> <dd><pre>[NOTE] Package coq is already installed (current version is 8.13.2). The following dependencies couldn&#39;t be met: - coq-infotheo -&gt; <API key> &lt; 0.3.1 -&gt; coq-mathcomp-finmap &lt; 1.4~ -&gt; coq &lt; 8.11.1 -&gt; ocaml &lt; 4.06.0 base of this switch (use `--unlock-base&#39; to force) - coq-infotheo -&gt; <API key> &lt; 0.3.1 -&gt; coq-mathcomp-finmap &lt; 1.4~ -&gt; <API key> &lt; 1.8~ -&gt; coq &lt; 8.10~ -&gt; ocaml &lt; 4.06.0 base of this switch (use `--unlock-base&#39; to force) - coq-infotheo -&gt; <API key> &lt; 0.3.1 -&gt; coq &lt; 8.9~ -&gt; ocaml &lt; 4.06.0 base of this switch (use `--unlock-base&#39; to force) Your request can&#39;t be satisfied: - No available version of coq satisfies the constraints No solution found, exiting </pre></dd> </dl> <p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-infotheo.0.1</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Install dependencies</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Install </h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Installation size</h2> <p>No files were installed.</p> <h2>Uninstall 🧹</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Missing removes</dt> <dd> none </dd> <dt>Wrong removes</dt> <dd> none </dd> </dl> </div> </div> </div> <hr/> <div class="footer"> <p class="text-center"> Sources are on <a href="https: </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
namespace JsonBuilder.Tests { using NUnit.Framework; public class <API key> : <API key> { private string elementName = "MyObject"; private string firstValue = "firstValue"; private string secondValue = "secondValue"; private string collectionName = "collection"; public override void Given() { this.SUT.WithObject(this.elementName) .WithCollection(this.collectionName) .WithValue(this.firstValue) .WithValue(this.secondValue); } [Test] public void <API key>() { StringAssert.Contains(this.elementName, this.result); } [Test] public void <API key>() { StringAssert.Contains(this.firstValue, this.result); } [Test] public void <API key>() { StringAssert.Contains("[", this.result); StringAssert.Contains("]", this.result); } [Test] public void <API key>() { StringAssert.Contains(this.secondValue, this.result); } } }
# <API key>: true module GitHubPages # Dependencies is where all the public dependencies for GitHub Pages are defined, # and versions locked. Any plugin for Pages must be specified here with a # corresponding version to which it shall be locked in the runtime dependencies. class Dependencies VERSIONS = { # Jekyll "jekyll" => "3.4.3", "<API key>" => "1.5.0", # Converters "kramdown" => "1.13.2", # Misc "liquid" => "3.0.6", "rouge" => "1.11.1", "<API key>" => "1.3.3", # Plugins "<API key>" => "0.12.1", "jekyll-sitemap" => "1.0.0", "jekyll-feed" => "0.9.2", "jekyll-gist" => "1.4.0", "jekyll-paginate" => "1.1.0", "jekyll-coffeescript" => "1.0.1", "jekyll-seo-tag" => "2.1.0", "<API key>" => "2.3.1", "jekyll-avatar" => "0.4.2", # Plugins to match GitHub.com Markdown "jemoji" => "0.8.0", "jekyll-mentions" => "1.2.0", "<API key>" => "0.4.0", "<API key>" => "0.1.2", "jekyll-readme-index" => "0.1.0", "<API key>" => "0.1.4", "<API key>" => "0.1.5", # Pin listen because it's broken on 2.1 & that's what we recommend. "listen" => "3.0.6", # Pin activesupport because 5.0 is broken on 2.1 "activesupport" => "4.2.7", }.freeze # Jekyll and related dependency versions as used by GitHub Pages. # For more information see: def self.gems VERSIONS.merge(GitHubPages::Plugins::THEMES) end # Versions used by GitHub Pages, including github-pages gem and ruby version # Useful for programmatically querying for the current-running version def self.versions gems.merge version_report end def self.version_report require "html/pipeline/version" require "sass/version" require "safe_yaml/version" require "nokogiri" { "ruby" => RUBY_VERSION, # Gem versions we're curious about "github-pages" => VERSION.to_s, "html-pipeline" => HTML::Pipeline::VERSION, "sass" => Sass.version[:number], "safe_yaml" => SafeYAML::VERSION, "nokogiri" => Nokogiri::VERSION, } end end end
var qrsInteract = require('./qrsInstance'); var Promise = require('bluebird'); var getAppOwner = { getAppOwner : function(appId) { return new Promise(function(resolve,reject) { var path = "/app/full"; path += "?filter=id eq " + appId; return qrsInteract.Get(path) .then(function(result) { resolve(result.body[0].owner); }) .catch(function(error) { reject(error); }); }) } }; module.exports = getAppOwner;
import {Application} from "@nativescript/core"; declare var GMSServices: any; if(Application.ios) { GMSServices.provideAPIKey("<Google Api>"); } Application.run({ moduleName: "main-page" }); /* Do not place any code after the application has been started as it will not be executed on iOS. */
## Purpose **java-to-typescript** creates namespaced Typescript classes from Java classes. It correctly handles inner classes (creates inner typescript namespaces) and inheritance. Using this library you can export your Java DTO objects for use in typescript/javascript. ## Usage 1) Register the repository in your pom.xml <repositories> <repository> <id><API key></id> <url>https://raw.github.com/nikosk/java-to-typescript/releases/</url> </repository> </repositories> 2) Add the plugin in your build: <plugin> <groupId>gr.dsigned</groupId> <artifactId><API key></artifactId> <version>1.0.0</version> <dependencies> [Add your dependencies here. The generator will scan only the dependencies registered here.] <dependency> <groupId>my.group</groupId> <artifactId>my.classes.to.be.converted</artifactId> <version>${dto.version}</version> </dependency> </dependencies> </plugin> 3) Create a file named ```application.conf``` in ```src/main/resources```. Place your configuration there (see reference.conf for info). 4) run ```mvn gr.dsigned:<API key>:generator``` to generate your Typescript classes. This project is licensed under the MIT license. ## Credits Inspired by [java2typescript](https://github.com/raphaeljolivet/java2typescript).
<?php namespace PhpugTest\Cache\Populator; use Phpug\Cache\Populator\CountryCode; use Mockery as M; class CountryCodeTest extends \<API key> { public function testActualCaching() { $return = M::mock('stdObject'); $return->shouldReceive('getCountryCode') ->andReturn('foo'); $Geocoding = M::mock('stdObject'); $Geocoding->shouldReceive('reverse') ->once() ->andReturn($return); $sm = M::mock('\Zend\ServiceManager\ServiceManager'); $sm->shouldReceive('get') ->with('Phpug\Service\Geocoder') ->andReturn($Geocoding); $ug = M::mock('Phpug\Entity\Usergroup'); $ug->shouldReceive('getLatitude')->once()->andReturn('a'); $ug->shouldReceive('getLongitude')->once()->andReturn('b'); $m = new CountryCode(); $this->assertEquals('foo', $m->populate($ug, $sm)); } public function <API key>() { $Geocoding = M::mock('stdObject'); $Geocoding->shouldReceive('reverse')->andThrow('Exception'); $sm = M::mock('\Zend\ServiceManager\ServiceManager'); $sm->shouldReceive('get') ->with('Phpug\Service\Geocoder') ->andReturn($Geocoding); $ug = M::mock('Phpug\Entity\Usergroup'); $ug->shouldReceive('getLatitude')->once()->andReturn('a'); $ug->shouldReceive('getLongitude')->once()->andReturn('b'); $m = new CountryCode(); $this->assertEquals('', $m->populate($ug, $sm)); } public function testGettingType() { $testClass = new CountryCode(); $this->assertEquals('countrycode', $testClass->getType()); } }
<?php namespace Checkout\Models\Payments; class Payer extends Source { /** * Qualified name of the class. * * @var string */ const QUALIFIED_NAME = __CLASS__; /** * Name of the model. * * @var string */ const MODEL_NAME = 'payer'; /** * Magic Methods */ /** * Initialise payer. * * @param string $name The customer's name. * @param string $email The customer's email. * @param string $document The document. */ public function __construct($name, $email, $document) { $this->name = $name; $this->email = $email; $this->document = $document; } }
from __future__ import unicode_literals from . import exceptions DEFAULT_HOST = 'http://api.acoustid.org/' FORMATS = ('json', 'jsonp', 'xml') META = ( 'recordings', 'recordingids', 'releases', 'releaseids', 'releasegroups', 'releasegroupids', 'tracks', 'compress', 'usermeta', 'sources' ) ERRORS = { 1: exceptions.UnknownFormat, 2: exceptions.MissingParameter, 3: exceptions.InvalidFingerprint, 4: exceptions.InvalidClientKey, 5: exceptions.InternalError, 6: exceptions.InvalidUserApiKey, 7: exceptions.InvalidUUID, 8: exceptions.InvalidDuration, 9: exceptions.InvalidBitrate, 10: exceptions.InvalidForeignID, 11: exceptions.<API key>, 12: exceptions.NotAllowed, 13: exceptions.ServiceUnavailable, 14: exceptions.TooManyRequests, }
<!DOCTYPE html> <html ng-app="gta"> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> <title></title> <link href="lib/ionic/css/ionic.css" rel="stylesheet"> <link href="css/style.css" rel="stylesheet"> <!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above <link href="css/ionic.app.css" rel="stylesheet"> <!-- ionic/angularjs js --> <script src="lib/ionic/js/ionic.bundle.js"></script> <!-- cordova script (this will be a 404 during development) --> <script src="cordova.js"></script> <!-- Non-ionic dependencies --> <script src="lib/deepstream.io-client-js/dist/deepstream.js" charset="utf-8"></script> <script src='lib/lodash/dist/lodash.js'></script> <script src='lib/<API key>/dist/<API key>.js'></script> <script src='lib/angular-google-maps/dist/angular-google-maps.js'></script> <!-- your app's js --> <script src="js/app.js"></script> <script src="js/controllers.js"></script> <script src="js/services.js"></script> </head> <body ng-controller="MainCtrl"> <! The nav bar that will be updated as we navigate between views. <ion-nav-bar class="bar-stable"> <ion-nav-back-button> </ion-nav-back-button> </ion-nav-bar> <! The views will be rendered in the <ion-nav-view> directive below Templates are in the /templates folder (but you could also have templates inline in this html file if you'd like). <ion-nav-view></ion-nav-view> </body> </html>
!function(){"use strict";var d=document.createElementNS("http:
module Braincron module Queue def self.configure RosettaQueue::Destinations.define do |queue| queue.map :requests, "/queue/braincron/requests" queue.map :results, "/queue/braincron/results" queue.map :exceptions, "/queue/braincron/exceptions" end config = Braincron.queue_config RosettaQueue::Adapter.define do |a| a.user = config["user"] a.password = config["password"] a.host = config["host"] a.port = config["port"] a.type = config["type"] end RosettaQueue::Filters.define do |filter_for| filter_for.receiving { |message| ActiveSupport::JSON.decode(message).<API key> } filter_for.sending { |hash| hash.to_json } end end end end
#pragma once #include <iterator> #include <bbb/core.hpp> #include <bbb/container/iterator/traits.hpp> namespace bbb { namespace container { namespace iterator { template <typename container> struct iterator_providers { using traits = <API key><container>; struct <API key> { protected: <API key>(container &) {} }; struct <API key> { using iterator = typename container::iterator; iterator begin() { return body.begin(); } iterator end() { return body.end(); } protected: <API key>(container &body) : body(body) {}; private: container &body; }; struct <API key> { using const_iterator = typename container::const_iterator; const_iterator begin() const { return body.begin(); } const_iterator end() const { return body.end(); } const_iterator cbegin() const { return body.cbegin(); } const_iterator cend() const { return body.cend(); } protected: <API key>(container &body) : body(body) {}; private: container &body; }; struct <API key> : <API key> , <API key> { using typename <API key>::iterator; using <API key>::begin; using <API key>::end; using typename <API key>::const_iterator; using <API key>::begin; using <API key>::end; using <API key>::cbegin; using <API key>::cend; protected: <API key>(container &body) : <API key>(body) , <API key>(body) {} }; struct <API key> { protected: <API key>(container &) {} }; struct <API key> { using reverse_iterator = typename container::reverse_iterator; reverse_iterator rbegin() { return body.rbegin(); } reverse_iterator rend() { return body.rend(); } protected: <API key>(container &body) : body(body) {} private: container &body; }; struct <API key> { using <API key> = typename container::<API key>; <API key> rbegin() const { return body.rbegin(); } <API key> rend() const { return body.rend(); } <API key> crbegin() const { return body.crbegin(); } <API key> crend() const { return body.crend(); } protected: <API key>(container &body) : body(body) {} private: container &body; }; struct <API key> : <API key> , <API key> { using typename <API key>::reverse_iterator; using <API key>::rbegin; using <API key>::rend; using typename <API key>::<API key>; using <API key>::rbegin; using <API key>::rend; using <API key>::crbegin; using <API key>::crend; protected: <API key>(container &body) : <API key>(body) , <API key>(body) {} }; template <bool has, typename impl, typename not_impl> using type_if = get_type<std::conditional<has, impl, not_impl>>; template <bool has_mutable, bool has_const, typename mutable_impl, typename const_impl, typename impl, typename not_impl> using quad_if = type_if< has_mutable, type_if<has_const, impl, mutable_impl>, type_if<has_const, const_impl, not_impl> >; using <API key> = quad_if< traits::has_iterator, traits::has_const_iterator, <API key>, <API key>, <API key>, <API key> >; using <API key> = quad_if< traits::<API key>, traits::<API key>, <API key>, <API key>, <API key>, <API key> >; }; }; }; };
<md-toolbar class="md-table-toolbar md-default"> <div class="md-toolbar-tools"> <md-button id="main" class="md-icon-button md-primary" aria-label="{{'Vouchers' | translate }}"> <md-icon md-font-icon="arrow_back" ng-click="back()">arrow_back</md-icon> </md-button> <p translate>Back to Voucher</p> <div flex></div> </div> <md-divider></md-divider> </md-toolbar> <md-content class="md-padding" layout="column" layout-gt-sm='row' layout-wrap> <div flex ng-show="codes.length === 0 && !searching && !query.filter"> <md-card> <md-card-title> <md-card-title-text> <span class="md-headline" translate> No codes found </span> <span class="md-subhead"> <md-progress-linear md-mode="query"></md-progress-linear> <translate>Your codes are still generating, please wait.</translate> </span> </md-card-title-text> </md-card-title> </md-card> </div> <div flex ng-show="codes.length > 0 || searching || query.filter"> <md-card> <md-card-content> <md-table-container> <table md-table md-row-select="options.rowSelection" ng-model="selected" md-progress="promise"> <thead md-head md-order="query.order" md-on-reorder="logOrder"> <tr md-row> <th md-column md-order-by="active"><span translate>Active</span></th> <th hide show-gt-sm md-column md-order-by="serial"><span translate>Serial</span></th> <th md-column md-order-by="username"><span hide show-gt-sm translate>Username</span><span hide-gt-sm translate>Details</span></th> <th hide show-gt-sm md-column md-order-by="password"><span translate>Password</span></th> <th hide show-gt-sm md-column md-order-by="date_activated"><span translate>Activated</span></th> <th md-column><span translate>Action</span></th> </tr> </thead> <tbody md-body> <tr md-row md-select="code" ng-repeat="code in filtered = (codes | filter: query.filter | orderBy: query.order)"> <td md-cell> <md-icon md-menu-origin md-font-icon="">{{ code.active ? "check_circle" : 'cancel' }}</md-icon> </td> <td hide show-gt-sm md-cell> {{ ::code.serial }} </td> <td md-cell> {{ ::code.username }} <span hide-gt-sm>/ {{ ::code.password }}</span> <md-tooltip hide-gt-sm> <translate> Activated: {{ ::(code.date_activated | humanTime) }} </translate> </md-tooltip> </td> <td hide show-gt-sm md-cell> {{ ::code.password }} </td> <td hide show-gt-sm md-cell> <span>{{ ::(code.date_activated | humanTime) }}</span> </td> <td md-cell> <md-menu> <md-button aria-label="{{ 'Open Boxes Menu' | translate }}" class="md-icon-button" ng-click="$mdOpenMenu($event)"> <md-icon md-menu-origin md-font-icon="more_black" class="s48">more_vert</md-icon> </md-button> <md-menu-content width="4" > <md-menu-item ng-repeat="item in menuItems"> <md-button ng-disabled="isDisabled(item.type,code)" ng-click="action(item.type,code)"> <md-icon ng-if="item.icon" md-menu-origin md-font-icon="{{ item.icon }}">{{ ::item.icon }}</md-icon> <p flex>{{ itemName(item,code) }}</p> </md-button> </md-menu-item> </md-menu-content> </md-menu> </td> </td> </tr> </tbody> </table> </md-table-container> <md-table-pagination md-limit="query.limit" md-limit-options="query.options" md-page="query.page" md-total="{{ ::_links.total_entries }}" md-label="{{pagination_labels}}" md-on-paginate="onPaginate" md-page-select></md-table-pagination> </md-card-content> </md-card> </div> </md-content>
# Cordova Content Security Policy / iOS 9 ATS Demo App ## Introduction This is a Cordova 5 app that demonstrates the steps needed to successfully make an Ajax request for data from a server, and how to configure the Content Security Policy meta tag to allow this. For iOS 9 / Xcode 7 users this also demonstrates the configuration of App Transport Security (ATS) which by default will block non SSL requests to backend servers. The app is very simple, it calls out to an exchange rate API (```http://api.fixer.io```) and aims to tell us the current value of the Euro in US Dollars. It uses JQuery, but nothing about the Content Security Policy or ATS setup is framework specific - configurations apply to any JS framework. ## Environment Setup **This project contains iOS specifics, so you will need to build it on a Macintosh.** You will need the following installed to be able to use this app properly: * Cordova CLI 5.3.3 or newer * XCode 7 or newer (must be XCode 7 as 6.x doesn't build for iOS 9 and use ATS) * Android SDK installed and SDK API level 22 (Android 5.1.1) or higher installed * Internet connection * Optional: Android emulator configured * Optional: Android and iOS device(s) To check you have Cordova CLI configured properly, open up a Terminal window on your Mac and type: cordova -version You should expect to see something like: 5.3.3 If your version doesn't begin with 5, or the cordova binary can't be found then update your Cordova version and Terminal path appropriately. ## Clone and Initial Build Clone the GitHub repo to your Macintosh, then open up a Terminal and cd to wherever you cloned the repo. To get the app running in the first of three demo states, enter these commands: cd <folder where repo was cloned> cd app cordova platform add ios android cordova build ios cordova build android You should now be able to run the app in the emulators or on your device in the normal way. When first cloned, the app will be in the "Step 1" state (broken). ## App States There are 3 states, or steps, to this app: * **Step 1:** Initial out of the box app using default Content Security Policy and ATS configurations that the Cordova CLI uses when creating an app. This will fail to get the remote data on iOS < 9, iOS 9 and Android because the Content Security Policy meta tag in index.html does not permit it * **Step 2:** Here, the Content Security Policy meta tag in index.html has been modified to allow data connections to the API that we are using. This will work on iOS < 9 and Android, but will continue to fail on iOS 9 because even though we have Cordova configured correctly now, iOS 9 is still blocking our http URL request because the default ATS configuration disallows all non-SSL backends * **Step 3:** Here, we have modified the iOS app's .plist (using a Cordova build hook script) to configure an ATS exception allowing non-SSL connections to our API host. This version of the app will now work on all iOS and Android versions After cloning the repo and following the initial build instructions, you will be at step 1 with a pretty broken app for both Android and iOS. ## Transitioning Between States When first cloned, the app is at step 1 (default Cordova configuration) and will fail to get the data from the API. To transition it to step 2 (fixed Content Security Policy meta tag, works on iOS <9 and Android): cd <folder where repo was cloned>/app ./step2.sh cordova build ios cordova build android To then transition to step 3 (fixed Content Security Policy and patches iOS 9 ATS in the project's .plist file - works on all devices): cd <folder where repo was cloned>/app ./step3.sh cordova build ios cordova build android To go back to step 1 (not working on iOS <9, 9 or Android): cd <folder where repo was cloned>/app ./step1.sh cordova build ios cordova build android
"""The template component.""" from __future__ import annotations import asyncio from collections.abc import Callable import logging from homeassistant import config as conf_util from homeassistant.const import ( CONF_UNIQUE_ID, <API key>, SERVICE_RELOAD, ) from homeassistant.core import CoreState, Event, HomeAssistant, ServiceCall, callback from homeassistant.exceptions import HomeAssistantError from homeassistant.helpers import ( discovery, trigger as trigger_helper, update_coordinator, ) from homeassistant.helpers.reload import <API key> from homeassistant.helpers.typing import ConfigType from homeassistant.loader import <API key> from .const import CONF_TRIGGER, DOMAIN, PLATFORMS _LOGGER = logging.getLogger(__name__) async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the template integration.""" if DOMAIN in config: await _process_config(hass, config) async def _reload_config(call: Event | ServiceCall) -> None: """Reload top-level + platforms.""" try: unprocessed_conf = await conf_util.<API key>(hass) except HomeAssistantError as err: _LOGGER.error(err) return conf = await conf_util.<API key>( hass, unprocessed_conf, await <API key>(hass, DOMAIN) ) if conf is None: return await <API key>(hass, DOMAIN, PLATFORMS) if DOMAIN in conf: await _process_config(hass, conf) hass.bus.async_fire(f"event_{DOMAIN}_reloaded", context=call.context) hass.helpers.service.<API key>( DOMAIN, SERVICE_RELOAD, _reload_config ) return True async def _process_config(hass: HomeAssistant, hass_config: ConfigType) -> None: """Process config.""" coordinators: list[<API key>] | None = hass.data.pop(DOMAIN, None) # Remove old ones if coordinators: for coordinator in coordinators: coordinator.async_remove() async def init_coordinator(hass, conf_section): coordinator = <API key>(hass, conf_section) await coordinator.async_setup(hass_config) return coordinator coordinator_tasks = [] for conf_section in hass_config[DOMAIN]: if CONF_TRIGGER in conf_section: coordinator_tasks.append(init_coordinator(hass, conf_section)) continue for platform_domain in PLATFORMS: if platform_domain in conf_section: hass.async_create_task( discovery.async_load_platform( hass, platform_domain, DOMAIN, { "unique_id": conf_section.get(CONF_UNIQUE_ID), "entities": conf_section[platform_domain], }, hass_config, ) ) if coordinator_tasks: hass.data[DOMAIN] = await asyncio.gather(*coordinator_tasks) class <API key>(update_coordinator.<API key>): """Class to handle incoming data.""" REMOVE_TRIGGER = object() def __init__(self, hass, config): """Instantiate trigger data.""" super().__init__(hass, _LOGGER, name="Trigger Update Coordinator") self.config = config self._unsub_start: Callable[[], None] | None = None self._unsub_trigger: Callable[[], None] | None = None @property def unique_id(self) -> str | None: """Return unique ID for the entity.""" return self.config.get("unique_id") @callback def async_remove(self): """Signal that the entities need to remove themselves.""" if self._unsub_start: self._unsub_start() if self._unsub_trigger: self._unsub_trigger() async def async_setup(self, hass_config: ConfigType) -> None: """Set up the trigger and create entities.""" if self.hass.state == CoreState.running: await self._attach_triggers() else: self._unsub_start = self.hass.bus.async_listen_once( <API key>, self._attach_triggers ) for platform_domain in PLATFORMS: if platform_domain in self.config: self.hass.async_create_task( discovery.async_load_platform( self.hass, platform_domain, DOMAIN, {"coordinator": self, "entities": self.config[platform_domain]}, hass_config, ) ) async def _attach_triggers(self, start_event=None) -> None: """Attach the triggers.""" if start_event is not None: self._unsub_start = None self._unsub_trigger = await trigger_helper.<API key>( self.hass, self.config[CONF_TRIGGER], self._handle_triggered, DOMAIN, self.name, self.logger.log, start_event is not None, ) @callback def _handle_triggered(self, run_variables, context=None): self.<API key>( {"run_variables": run_variables, "context": context} )
#import <CoreFoundation/CFCharacterSet.h> #import <Foundation/NSObject.h> #import <Foundation/NSRange.h> #import <Foundation/NSString.h> @class NSData; enum { <API key> = 0xF400 }; @interface NSCharacterSet : NSObject <NSCopying, NSMutableCopying, NSCoding> + (id)controlCharacterSet; + (id)<API key>; + (id)<API key>; + (id)<API key>; + (id)letterCharacterSet; + (id)<API key>; + (id)<API key>; + (id)nonBaseCharacterSet; + (id)<API key>; + (id)<API key>; + (id)illegalCharacterSet; + (id)<API key>; + (id)<API key>; + (id)symbolCharacterSet; + (id)newlineCharacterSet NS_AVAILABLE(10_5, 2_0); + (id)<API key>:(NSRange)aRange; + (id)<API key>:(NSString *)aString; + (id)<API key>:(NSData *)data; + (id)<API key>:(NSString *)fName; - (BOOL)characterIsMember:(unichar)aCharacter; - (NSData *)<API key>; - (NSCharacterSet *)invertedSet; - (BOOL)<API key>:(UTF32Char)theLongChar; - (BOOL)isSupersetOfSet:(NSCharacterSet *)theOtherSet; - (BOOL)hasMemberInPlane:(uint8_t)thePlane; @end @interface <API key> : NSCharacterSet <NSCopying, NSMutableCopying> - (void)<API key>:(NSRange)aRange; - (void)<API key>:(NSRange)aRange; - (void)<API key>:(NSString *)aString; - (void)<API key>:(NSString *)aString; - (void)<API key>:(NSCharacterSet *)otherSet; - (void)<API key>:(NSCharacterSet *)otherSet; - (void)invert; @end
class <API key> < ActiveRecord::Migration def change change_table :personal_histories do |t| t.integer :address_id end end end
require 'test_helper' class CredoraxTest < Test::Unit::TestCase include CommStub def setup @gateway = CredoraxGateway.new(merchant_id: 'login', cipher_key: 'password') @credit_card = credit_card @amount = 100 @options = { billing_address: address, description: 'Store Purchase' } @<API key> = { reference: '345123', shopper_email: 'john.smith@test.com', shopper_ip: '77.110.174.153', shopper_reference: 'John Smith', billing_address: address, shipping_address: address, order_id: '123', execute_threed: true, three_ds_initiate: '03', f23: '1', <API key>: '04', <API key>: '01', stored_credential: { reason_type: 'unscheduled' }, three_ds_2: { channel: 'browser', notification_url: 'www.example.com', browser_info: { accept_header: 'unknown', depth: 100, java: false, language: 'US', height: 1000, width: 500, timezone: '-120', user_agent: 'unknown' } } } end def <API key> response = stub_comms do @gateway.purchase(@amount, @credit_card) end.check_request do |_endpoint, data, _headers| assert_no_match(/i8=sample-eci%3Asample-cavv%3Asample-xid/, data) end.respond_with(<API key>) assert_success response assert_equal '<API key>;006596;<API key>;purchase', response.authorization assert_equal 'Succeeded', response.message assert response.test? end def <API key> response = stub_comms do @gateway.purchase(@amount, @credit_card) end.respond_with(<API key>) assert_failure response assert_equal 'Transaction not allowed for cardholder', response.message assert response.test? end def test_successful_<API key> response = stub_comms do @gateway.authorize(@amount, @credit_card) end.respond_with(<API key>) assert_success response assert_equal '<API key>;006597;<API key>;authorize', response.authorization capture = stub_comms do @gateway.capture(@amount, response.authorization) end.check_request do |_endpoint, data, _headers| assert_match(/<API key>/, data) end.respond_with(<API key>) assert_success capture assert_equal 'Succeeded', response.message end def <API key> response = stub_comms do @gateway.authorize(@amount, @credit_card) end.respond_with(<API key>) assert_failure response assert_equal 'Transaction not allowed for cardholder', response.message assert response.test? end def test_failed_capture response = stub_comms do @gateway.capture(100, '') end.respond_with(<API key>) assert_failure response assert_equal '2. At least one of input parameters is malformed.: Parameter [g4] cannot be empty.', response.message end def <API key> response = stub_comms do @gateway.purchase(@amount, @credit_card) end.respond_with(<API key>) assert_success response assert_equal '<API key>;006597;<API key>;purchase', response.authorization void = stub_comms do @gateway.void(response.authorization) end.check_request do |_endpoint, data, _headers| assert_match(/<API key>/, data) end.respond_with(<API key>) assert_success void assert_equal 'Succeeded', void.message end def test_failed_void response = stub_comms do @gateway.void('<API key>') end.check_request do |_endpoint, data, _headers| assert_match(/<API key>/, data) end.respond_with(<API key>) assert_failure response assert_equal '2. At least one of input parameters is malformed.: Parameter [g4] cannot be empty.', response.message end def <API key> response = stub_comms do @gateway.purchase(@amount, @credit_card) end.respond_with(<API key>) assert_success response assert_equal '<API key>;006596;<API key>;purchase', response.authorization refund = stub_comms do @gateway.refund(@amount, response.authorization) end.check_request do |_endpoint, data, _headers| assert_match(/<API key>/, data) end.respond_with(<API key>) assert_success refund assert_equal 'Succeeded', refund.message end def test_failed_refund response = stub_comms do @gateway.refund(nil, '') end.respond_with(<API key>) assert_failure response assert_equal '2. At least one of input parameters is malformed.: Parameter [g4] cannot be empty.', response.message end def <API key> response = stub_comms do @gateway.purchase(@amount, @credit_card) end.respond_with(<API key>) assert_success response assert_equal '<API key>;006596;<API key>;purchase', response.authorization referral_cft = stub_comms do @gateway.refund(@amount, response.authorization, { referral_cft: true, first_name: 'John', last_name: 'Smith' }) end.check_request do |_endpoint, data, _headers| assert_match(/<API key>/, data) # Confirm that `j5` (first name) and `j13` (surname) parameters are present # These fields are required for CFT payouts as of Sept 1, 2020 assert_match(/j5=John/, data) assert_match(/j13=Smith/, data) # Confirm that the transaction type is `referral_cft` assert_match(/O=34/, data) end.respond_with(<API key>) assert_success referral_cft assert_equal 'Succeeded', referral_cft.message end def <API key> response = stub_comms do @gateway.refund(nil, '', referral_cft: true) end.check_request do |_endpoint, data, _headers| # Confirm that the transaction type is `referral_cft` assert_match(/O=34/, data) end.respond_with(<API key>) assert_failure response assert_equal 'Referred to transaction has not been found.', response.message end def <API key> response = stub_comms do @gateway.credit(@amount, @credit_card) end.respond_with(<API key>) assert_success response assert_equal '<API key>;;<API key>;credit', response.authorization assert_equal 'Succeeded', response.message assert response.test? end def test_failed_credit response = stub_comms do @gateway.credit(@amount, @credit_card) end.respond_with(<API key>) assert_failure response assert_equal 'Transaction not allowed for cardholder', response.message assert response.test? end def <API key> response = stub_comms do @gateway.verify(@credit_card) end.respond_with(<API key>, <API key>) assert_success response assert_equal 'Succeeded', response.message end def test_failed_verify response = stub_comms do @gateway.verify(@credit_card) end.respond_with(<API key>, <API key>) assert_failure response assert_equal 'Transaction not allowed for cardholder', response.message end def <API key> response = stub_comms do @gateway.purchase(@amount, @credit_card) end.respond_with(<API key>) assert_failure response assert_equal 'Unable to read error message', response.message end def <API key> assert_equal scrubbed_transcript, @gateway.scrub(transcript) end def <API key> options_with_3ds = @<API key> response = stub_comms do @gateway.purchase(@amount, @credit_card, options_with_3ds) end.check_request do |_endpoint, data, _headers| assert_match(/3ds_channel=02/, data) assert_match(/3ds_transtype=01/, data) assert_match(/3ds_initiate=03/, data) assert_match(/f23=1/, data) assert_match(/3ds_reqchallengeind=04/, data) assert_match(/3ds_redirect_url=www.example.com/, data) assert_match(/<API key>=01/, data) assert_match(/d5=unknown/, data) assert_match(/3ds_browsertz=-120/, data) assert_match(/<API key>=500/, data) assert_match(/<API key>=1000/, data) assert_match(/<API key>=100/, data) assert_match(/d6=US/, data) assert_match(/<API key>=false/, data) assert_match(/<API key>=unknown/, data) assert_match(/3ds_shipaddrstate=ON/, data) assert_match(/<API key>=K1C2N6/, data) assert_match(/3ds_shipaddrline2=Apt\+1/, data) assert_match(/3ds_shipaddrline1=456\+My\+Street/, data) assert_match(/3ds_shipaddrcountry=CA/, data) assert_match(/3ds_shipaddrcity=Ottawa/, data) refute_match(/3ds_version/, data) end.respond_with(<API key>) assert_success response assert_equal '<API key>;006596;<API key>;purchase', response.authorization assert response.test? end def <API key> <API key> = { state: 'ON', zip: 'K1C2N6', address1: '456 My Street', address2: '', country: 'CA', city: 'Ottawa' } options_with_3ds = @<API key>.merge(shipping_address: <API key>) response = stub_comms do @gateway.purchase(@amount, @credit_card, options_with_3ds) end.check_request do |_endpoint, data, _headers| assert_match(/3ds_initiate=03/, data) assert_not_match(/3ds_shipaddrstate=/, data) assert_not_match(/<API key>=/, data) assert_not_match(/3ds_shipaddrline1=/, data) assert_not_match(/3ds_shipaddrline2=/, data) assert_not_match(/3ds_shipaddrcountry=/, data) assert_not_match(/3ds_shipaddrcity=/, data) end.respond_with(<API key>) assert_success response assert response.test? end def <API key> @<API key>[:three_ds_2][:browser_info][:depth] = 30 response = stub_comms do @gateway.purchase(@amount, @credit_card, @<API key>) end.check_request do |_endpoint, data, _headers| assert_match(/<API key>=32/, data) end.respond_with(<API key>) assert_success response assert_equal '<API key>;006596;<API key>;purchase', response.authorization assert response.test? end def <API key> options_with_3ds = @<API key>.merge(three_ds_transtype: '03') response = stub_comms do @gateway.purchase(@amount, @credit_card, options_with_3ds) end.check_request do |_endpoint, data, _headers| assert_match(/3ds_channel=02/, data) assert_match(/3ds_transtype=03/, data) end.respond_with(<API key>) assert_success response assert_equal '<API key>;006596;<API key>;purchase', response.authorization assert response.test? end def <API key> options_with_3ds = @options.merge({ eci: 'sample-eci', cavv: 'sample-cavv', xid: 'sample-xid', three_ds_version: '1.0.2' }) response = stub_comms do @gateway.purchase(@amount, @credit_card, options_with_3ds) end.check_request do |_endpoint, data, _headers| assert_match(/i8=sample-eci%3Asample-cavv%3Asample-xid/, data) assert_match(/3ds_version=1.0&/, data) end.respond_with(<API key>) assert_success response assert_equal '<API key>;006596;<API key>;purchase', response.authorization assert response.test? end def <API key> version = '1.0.2' eci = 'sample-eci' cavv = 'sample-cavv' xid = 'sample-xid' <API key> = @options.merge( three_d_secure: { version: version, eci: eci, cavv: cavv, xid: xid } ) stub_comms do @gateway.purchase(@amount, @credit_card, <API key>) end.check_request do |_endpoint, data, _headers| assert_match(/i8=#{eci}%3A#{cavv}%3A#{xid}/, data) assert_match(/3ds_version=1.0&/, data) end.respond_with(<API key>) end def <API key> options_with_3ds = @<API key>.merge(<API key>(:merchant, :unscheduled, id: 'abc123')) response = stub_comms do @gateway.purchase(@amount, @credit_card, options_with_3ds) end.check_request do |_endpoint, data, _headers| assert_match(/3ds_channel=03/, data) end.respond_with(<API key>) assert_success response assert_equal '<API key>;006596;<API key>;purchase', response.authorization assert response.test? end def test_<API key> options_with_3ds = @options.merge({ eci: 'sample-eci', cavv: 'sample-cavv', xid: 'sample-xid' }) response = stub_comms do @gateway.authorize(@amount, @credit_card, options_with_3ds) end.check_request do |_endpoint, data, _headers| assert_match(/i8=sample-eci%3Asample-cavv%3Asample-xid/, data) assert_match(/3ds_version=1.0/, data) end.respond_with(<API key>) assert_success response assert_equal '<API key>;006596;<API key>;authorize', response.authorization assert response.test? end def <API key> options_with_3ds = @options.merge({ eci: 'sample-eci', xid: 'sample-xid' }) response = stub_comms do @gateway.purchase(@amount, @credit_card, options_with_3ds) end.check_request do |_endpoint, data, _headers| assert_match(/i8=sample-eci%3Anone%3Asample-xid/, data) end.respond_with(<API key>) assert_success response assert_equal '<API key>;006596;<API key>;purchase', response.authorization assert response.test? end def <API key> version = '2' eci = '05' cavv = '<SHA1-like>' ds_transaction_id = '<API key>' <API key> = @options.merge( three_d_secure: { version: version, eci: eci, cavv: cavv, ds_transaction_id: ds_transaction_id } ) stub_comms do @gateway.purchase(@amount, @credit_card, <API key>) end.check_request do |_endpoint, data, _headers| assert_match(/i8=#{eci}%3A#{cavv}%3Anone/, data) assert_match(/3ds_version=2.0/, data) assert_match(/3ds_dstrxid=#{ds_transaction_id}/, data) end.respond_with(<API key>) end def <API key> version = '2.2.0' eci = '05' ds_transaction_id = '<API key>' <API key> = @options.merge( three_d_secure: { version: version, eci: eci, ds_transaction_id: ds_transaction_id } ) stub_comms do @gateway.purchase(@amount, @credit_card, <API key>) end.check_request do |_endpoint, data, _headers| assert_match(/i8=#{eci}%3Anone%3Anone/, data) assert_match(/3ds_version=2.0/, data) assert_match(/3ds_dstrxid=#{ds_transaction_id}/, data) end.respond_with(<API key>) end def <API key> options_with_3ds = @options.merge({ transaction_type: '8' }) stub_comms do @gateway.purchase(@amount, @credit_card, options_with_3ds) end.check_request do |_endpoint, data, _headers| assert_match(/a9=8/, data) end.respond_with(<API key>) end def test_<API key> options_with_3ds = @options.merge({ transaction_type: '8' }) stub_comms do @gateway.authorize(@amount, @credit_card, options_with_3ds) end.check_request do |_endpoint, data, _headers| assert_match(/a9=8/, data) end.respond_with(<API key>) end def <API key> options_with_3ds = @options.merge({ transaction_type: '8' }) stub_comms do @gateway.credit(@amount, @credit_card, options_with_3ds) end.check_request do |_endpoint, data, _headers| assert_match(/a9=8/, data) end.respond_with(<API key>) end def test_<API key> <API key> = @options.merge({ authorization_type: '2', <API key>: '5' }) stub_comms do @gateway.authorize(@amount, @credit_card, <API key>) end.check_request do |_endpoint, data, _headers| assert_match(/a10=2/, data) assert_match(/a11=5/, data) end.respond_with(<API key>) end def <API key> @options[:submerchant_id] = '12345' stub_comms do @gateway.purchase(@amount, @credit_card, @options) end.check_request do |_endpoint, data, _headers| assert_match(/h3=12345/, data) end.respond_with(<API key>) end def <API key> @options[:metadata] = { manual_entry: true } stub_comms do @gateway.purchase(@amount, @credit_card, @options) end.check_request do |_endpoint, data, _headers| assert_match(/a2=3/, data) end.respond_with(<API key>) end def test_<API key> @options[:submerchant_id] = '12345' stub_comms do @gateway.authorize(@amount, @credit_card, @options) end.check_request do |_endpoint, data, _headers| assert_match(/h3=12345/, data) end.respond_with(<API key>) end def <API key> response = stub_comms do @gateway.authorize(@amount, @credit_card) end.respond_with(<API key>) @options[:submerchant_id] = '12345' stub_comms do @gateway.capture(@amount, response.authorization, @options) end.check_request do |_endpoint, data, _headers| assert_match(/h3=12345/, data) end.respond_with(<API key>) end def <API key> response = stub_comms do @gateway.purchase(@amount, @credit_card) end.respond_with(<API key>) @options[:submerchant_id] = '12345' stub_comms do @gateway.void(response.authorization, @options) end.check_request do |_endpoint, data, _headers| assert_match(/h3=12345/, data) end.respond_with(<API key>) end def <API key> response = stub_comms do @gateway.purchase(@amount, @credit_card) end.respond_with(<API key>) @options[:submerchant_id] = '12345' stub_comms do @gateway.refund(@amount, response.authorization, @options) end.check_request do |_endpoint, data, _headers| assert_match(/h3=12345/, data) end.respond_with(<API key>) end def <API key> @options[:submerchant_id] = '12345' stub_comms do @gateway.credit(@amount, @credit_card, @options) end.check_request do |_endpoint, data, _headers| assert_match(/h3=12345/, data) end.respond_with(<API key>) end def <API key> @options[:billing_descriptor] = 'abcdefghijkl' stub_comms do @gateway.purchase(@amount, @credit_card, @options) end.check_request do |_endpoint, data, _headers| assert_match(/i2=abcdefghijkl/, data) end.respond_with(<API key>) end def test_<API key> @options[:billing_descriptor] = 'abcdefghijkl' stub_comms do @gateway.authorize(@amount, @credit_card, @options) end.check_request do |_endpoint, data, _headers| assert_match(/i2=abcdefghijkl/, data) end.respond_with(<API key>) end def <API key> response = stub_comms do @gateway.authorize(@amount, @credit_card) end.respond_with(<API key>) @options[:billing_descriptor] = 'abcdefghijkl' stub_comms do @gateway.capture(@amount, response.authorization, @options) end.check_request do |_endpoint, data, _headers| assert_match(/i2=abcdefghijkl/, data) end.respond_with(<API key>) end def <API key> response = stub_comms do @gateway.purchase(@amount, @credit_card) end.respond_with(<API key>) @options[:billing_descriptor] = 'abcdefghijkl' stub_comms do @gateway.refund(@amount, response.authorization, @options) end.check_request do |_endpoint, data, _headers| assert_match(/i2=abcdefghijkl/, data) end.respond_with(<API key>) end def <API key> @options[:billing_descriptor] = 'abcdefghijkl' stub_comms do @gateway.credit(@amount, @credit_card, @options) end.check_request do |_endpoint, data, _headers| assert_match(/i2=abcdefghijkl/, data) end.respond_with(<API key>) end def <API key> @options[:processor] = 'TEST' @options[:<API key>] = '123' stub_comms do @gateway.purchase(@amount, @credit_card, @options) end.check_request do |_endpoint, data, _headers| assert_match(/r1=TEST/, data) assert_match(/r2=123/, data) end.respond_with(<API key>) end def test_<API key> @options[:processor] = 'TEST' @options[:<API key>] = '123' stub_comms do @gateway.authorize(@amount, @credit_card, @options) end.check_request do |_endpoint, data, _headers| assert_match(/r1=TEST/, data) assert_match(/r2=123/, data) end.respond_with(<API key>) end def <API key> response = stub_comms do @gateway.authorize(@amount, @credit_card) end.respond_with(<API key>) @options[:processor] = 'TEST' @options[:<API key>] = '123' stub_comms do @gateway.capture(@amount, response.authorization, @options) end.check_request do |_endpoint, data, _headers| assert_match(/r1=TEST/, data) assert_match(/r2=123/, data) end.respond_with(<API key>) end def <API key> response = stub_comms do @gateway.purchase(@amount, @credit_card) end.respond_with(<API key>) @options[:processor] = 'TEST' @options[:<API key>] = '123' stub_comms do @gateway.void(response.authorization, @options) end.check_request do |_endpoint, data, _headers| assert_match(/r1=TEST/, data) assert_match(/r2=123/, data) end.respond_with(<API key>) end def <API key> response = stub_comms do @gateway.purchase(@amount, @credit_card) end.respond_with(<API key>) @options[:processor] = 'TEST' @options[:<API key>] = '123' stub_comms do @gateway.refund(@amount, response.authorization, @options) end.check_request do |_endpoint, data, _headers| assert_match(/r1=TEST/, data) assert_match(/r2=123/, data) end.respond_with(<API key>) end def <API key> @options[:processor] = 'TEST' @options[:<API key>] = '123' stub_comms do @gateway.credit(@amount, @credit_card, @options) end.check_request do |_endpoint, data, _headers| assert_match(/r1=TEST/, data) assert_match(/r2=123/, data) end.respond_with(<API key>) end def <API key> @options[:echo] = 'Echo Parameter' stub_comms do @gateway.purchase(@amount, @credit_card, @options) end.check_request do |_endpoint, data, _headers| assert_match(/d2=Echo\+Parameter/, data) end.respond_with(<API key>) end def test_<API key> @options[:echo] = 'Echo Parameter' stub_comms do @gateway.authorize(@amount, @credit_card, @options) end.check_request do |_endpoint, data, _headers| assert_match(/d2=Echo\+Parameter/, data) end.respond_with(<API key>) end def <API key> response = stub_comms do @gateway.authorize(@amount, @credit_card) end.respond_with(<API key>) @options[:echo] = 'Echo Parameter' stub_comms do @gateway.capture(@amount, response.authorization, @options) end.check_request do |_endpoint, data, _headers| assert_match(/d2=Echo\+Parameter/, data) end.respond_with(<API key>) end def <API key> response = stub_comms do @gateway.purchase(@amount, @credit_card) end.respond_with(<API key>) @options[:echo] = 'Echo Parameter' stub_comms do @gateway.void(response.authorization, @options) end.check_request do |_endpoint, data, _headers| assert_match(/d2=Echo\+Parameter/, data) end.respond_with(<API key>) end def <API key> response = stub_comms do @gateway.purchase(@amount, @credit_card) end.respond_with(<API key>) @options[:echo] = 'Echo Parameter' stub_comms do @gateway.refund(@amount, response.authorization, @options) end.check_request do |_endpoint, data, _headers| assert_match(/d2=Echo\+Parameter/, data) end.respond_with(<API key>) end def <API key> @options[:echo] = 'Echo Parameter' stub_comms do @gateway.credit(@amount, @credit_card, @options) end.check_request do |_endpoint, data, _headers| assert_match(/d2=Echo\+Parameter/, data) end.respond_with(<API key>) end def <API key> # purchase passes the phone number when provided @options[:billing_address][:phone] = '555-444-3333' stub_comms do @gateway.purchase(@amount, @credit_card, @options) end.check_request do |_endpoint, data, _headers| assert_match(/c2=555-444-3333/, data) end.respond_with(<API key>) # purchase doesn't pass the phone number when nil @options[:billing_address][:phone] = nil stub_comms do @gateway.purchase(@amount, @credit_card, @options) end.check_request do |_endpoint, data, _headers| assert_not_match(/c2=/, data) end.respond_with(<API key>) end def <API key> # purchase passes <API key> when it and phone number are provided @options[:billing_address][:phone] = '555-444-3333' @options[:three_ds_2] = { optional: { '<API key>': 'US' } } stub_comms do @gateway.purchase(@amount, @credit_card, @options) end.check_request do |_endpoint, data, _headers| assert_match(/c2=555-444-3333/, data) assert_match(/<API key>=US/, data) end.respond_with(<API key>) # purchase doesn't pass <API key> when phone number is nil @options[:billing_address][:phone] = nil @options[:three_ds_2] = { optional: { '<API key>': 'US' } } stub_comms do @gateway.purchase(@amount, @credit_card, @options) end.check_request do |_endpoint, data, _headers| assert_not_match(/c2=/, data) assert_not_match(/<API key>=/, data) end.respond_with(<API key>) end def <API key> options = <API key>(:cardholder, :recurring, :initial) response = stub_comms do @gateway.authorize(@amount, @credit_card, options) end.check_request do |_endpoint, data, _headers| assert_match(/a9=9/, data) end.respond_with(<API key>) assert_success response end def <API key> options = <API key>(:cardholder, :recurring, id: 'abc123') response = stub_comms do @gateway.authorize(@amount, @credit_card, options) end.check_request do |_endpoint, data, _headers| assert_match(/a9=9/, data) end.respond_with(<API key>) assert_success response end def <API key> options = <API key>(:merchant, :recurring, :initial) response = stub_comms do @gateway.authorize(@amount, @credit_card, options) end.check_request do |_endpoint, data, _headers| assert_match(/a9=1/, data) end.respond_with(<API key>) assert_success response end def <API key> options = <API key>(:merchant, :recurring, id: 'abc123') response = stub_comms do @gateway.authorize(@amount, @credit_card, options) end.check_request do |_endpoint, data, _headers| assert_match(/a9=2/, data) end.respond_with(<API key>) assert_success response end def <API key> options = <API key>(:cardholder, :installment, :initial) response = stub_comms do @gateway.authorize(@amount, @credit_card, options) end.check_request do |_endpoint, data, _headers| assert_match(/a9=9/, data) end.respond_with(<API key>) assert_success response end def <API key> options = <API key>(:cardholder, :installment, id: 'abc123') response = stub_comms do @gateway.authorize(@amount, @credit_card, options) end.check_request do |_endpoint, data, _headers| assert_match(/a9=9/, data) end.respond_with(<API key>) assert_success response end def <API key> options = <API key>(:merchant, :installment, :initial) response = stub_comms do @gateway.authorize(@amount, @credit_card, options) end.check_request do |_endpoint, data, _headers| assert_match(/a9=8/, data) end.respond_with(<API key>) assert_success response end def <API key> options = <API key>(:merchant, :installment, id: 'abc123') response = stub_comms do @gateway.authorize(@amount, @credit_card, options) end.check_request do |_endpoint, data, _headers| assert_match(/a9=8/, data) end.respond_with(<API key>) assert_success response end def <API key> options = <API key>(:cardholder, :unscheduled, :initial) response = stub_comms do @gateway.authorize(@amount, @credit_card, options) end.check_request do |_endpoint, data, _headers| assert_match(/a9=9/, data) end.respond_with(<API key>) assert_success response end def <API key> options = <API key>(:cardholder, :unscheduled, id: 'abc123') response = stub_comms do @gateway.authorize(@amount, @credit_card, options) end.check_request do |_endpoint, data, _headers| assert_match(/a9=9/, data) end.respond_with(<API key>) assert_success response end def <API key> options = <API key>(:merchant, :unscheduled, :initial) response = stub_comms do @gateway.authorize(@amount, @credit_card, options) end.check_request do |_endpoint, data, _headers| assert_match(/a9=8/, data) end.respond_with(<API key>) assert_success response end def <API key> options = <API key>(:merchant, :unscheduled, id: 'abc123') response = stub_comms do @gateway.authorize(@amount, @credit_card, options) end.check_request do |_endpoint, data, _headers| assert_match(/a9=8/, data) end.respond_with(<API key>) assert_success response end def <API key> options = <API key>(:merchant, :recurring, id: 'abc123') response = stub_comms do @gateway.purchase(@amount, @credit_card, options) end.check_request do |_endpoint, data, _headers| assert_match(/a9=2/, data) end.respond_with(<API key>) assert_success response end def <API key> options = <API key>(:merchant, :unscheduled, id: 'abc123').merge(transaction_type: '6') response = stub_comms do @gateway.authorize(@amount, @credit_card, options) end.check_request do |_endpoint, data, _headers| assert_match(/a9=6/, data) end.respond_with(<API key>) assert_success response end def <API key> stub_comms do @gateway.authorize(200, @credit_card, @options.merge(currency: 'JPY')) end.check_request do |_endpoint, data, _headers| assert_match(/a4=2&a1=/, data) end.respond_with(<API key>) end def <API key> post = {} options = { three_ds_2: { optional: { '<API key>': :a, '<API key>': :b } } } @gateway.<API key>(post, options) assert_equal post, { '<API key>': :a, '<API key>': :b } end def <API key> post = { '<API key>': :existing_value } options = { three_ds_2: { optional: { '<API key>': :a, '<API key>': :b } } } @gateway.<API key>(post, options) assert_equal post, { '<API key>': :existing_value, '<API key>': :b } end def <API key> post = {} options = { three_ds_2: { optional: { '<API key>': '', '<API key>': 'null', '<API key>': nil } } } @gateway.<API key>(post, options) assert_equal post, {} end private def <API key>(*args, id: nil) { order_id: '#1001', description: 'AM test', currency: 'GBP', customer: '123', stored_credential: stored_credential(*args, id: id) } end def <API key> 'M=SPREE978&O=1&T=03%2F09%2F2016+03%3A05%3A16&V=413&a1=<API key>&a2=2&a4=100&a9=6&z1=<API key>&z13=606944188282&z14=U&z15=100&z2=0&z3=Transaction+has+been+executed+successfully.&z4=006596&z5=0&z6=00&z9=X&K=<API key>' end def <API key> 'M=SPREE978&O=1&T=03%2F09%2F2016+03%3A05%3A47&V=413&a1=<API key>&a2=2&a4=100&a9=6&z1=<API key>&z13=606944188283&z15=100&z2=05&z3=Transaction+has+been+declined.&z5=0&z6=57&K=<API key>' end def <API key> 'M=SPREE978&O=2&T=03%2F09%2F2016+03%3A08%3A58&V=413&a1=<API key>&a2=2&a4=100&a9=6&z1=<API key>&z13=606944188284&z14=U&z15=100&z2=0&z3=Transaction+has+been+executed+successfully.&z4=006597&z5=0&z6=00&z9=X&K=<API key>' end def <API key> 'M=SPREE978&O=2&T=03%2F09%2F2016+03%3A10%3A02&V=413&a1=<API key>&a2=2&a4=100&a9=6&z1=<API key>&z13=606944188285&z15=100&z2=05&z3=Transaction+has+been+declined.&z5=0&z6=57&K=<API key>' end def <API key> 'M=SPREE978&O=3&T=03%2F09%2F2016+03%3A09%3A03&V=413&a1=<API key>&a2=2&a4=100&g2=<API key>&g3=006597&g4=<API key>&z1=<API key>&z13=606944188284&z15=100&z2=0&z3=Transaction+has+been+executed+successfully.&z4=006597&z5=0&z6=00&K=<API key>' end def <API key> 'M=SPREE978&O=3&T=03%2F09%2F2016+03%3A10%3A33&V=413&a1=<API key>&a2=2&a4=100&a5=EUR&b1=-&z1=1A-1&z2=-9&z3=2.+At+least+one+of+input+parameters+is+malformed.%3A+Parameter+%5Bg4%5D+cannot+be+empty.&K=<API key>' end def <API key> 'M=SPREE978&O=4&T=03%2F09%2F2016+03%3A11%3A11&V=413&a1=&a2=2&a4=100&g2=<API key>&g3=006598&g4=<API key>&z1=<API key>&z13=606944188287&z15=100&z2=0&z3=Transaction+has+been+executed+successfully.&z4=006598&z5=0&z6=00&K=<API key>' end def <API key> 'M=SPREE978&O=4&T=03%2F09%2F2016+03%3A11%3A37&V=413&a1=-&a2=2&a4=-&a5=-&b1=-&z1=1A-1&z2=-9&z3=2.+At+least+one+of+input+parameters+is+malformed.%3A+Parameter+%5Bg4%5D+cannot+be+empty.&K=<API key>' end def <API key> 'M=SPREE978&O=5&T=03%2F09%2F2016+03%3A15%3A32&V=413&a1=<API key>&a2=2&a4=100&g2=<API key>&g3=006600&g4=<API key>&z1=<API key>&z13=606944188288&z15=100&z2=0&z3=Transaction+has+been+executed+successfully.&z4=006600&z5=0&z6=00&K=<API key>' end def <API key> 'M=SPREE978&O=5&T=03%2F09%2F2016+03%3A16%3A06&V=413&a1=<API key>&a2=2&a4=-&a5=EUR&b1=-&z1=1A-1&z2=-9&z3=2.+At+least+one+of+input+parameters+is+malformed.%3A+Parameter+%5Bg4%5D+cannot+be+empty.&K=<API key>' end def <API key> 'M=SPREE978&O=34&T=11%2F15%2F2019+15%3A56%3A08&V=413&a1=<API key>&a2=2&a4=100&a9=9&b2=2&g2=<API key>&z1=<API key>&z13=931924132623&z2=0&z3=Transaction+has+been+executed+successfully.&z33=CREDORAX&z34=59990010&z39=<API key>&z4=HOSTOK&z6=00&K=<API key>' end def <API key> 'T=11%2F15%2F2019+17%3A17%3A45&a1=<API key>&z1=<API key>&z2=-9&z3=Referred+to+transaction+has+not+been+found.' end def <API key> 'M=SPREE978&O=6&T=03%2F09%2F2016+03%3A16%3A35&V=413&a1=<API key>&a2=2&a4=100&z1=<API key>&z13=606944188289&z15=100&z2=0&z3=Transaction+has+been+executed+successfully.&z5=0&z6=00&K=<API key>' end def <API key> 'M=SPREE978&O=6&T=03%2F09%2F2016+03%3A16%3A59&V=413&a1=<API key>&a2=2&a4=100&z1=<API key>&z13=606944188290&z15=100&z2=05&z3=Transaction+has+been+declined.&z5=0&z6=57&K=<API key>' end def <API key> %( ) end def transcript %( opening connection to intconsole.credorax.com:443... opened starting SSL for intconsole.credorax.com:443... SSL established <- "POST /intenv/service/gateway HTTP/1.1\r\nContent-Type: application/<API key>\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*\r\nUser-Agent: Ruby\r\nConnection: close\r\nHost: intconsole.credorax.com\r\nContent-Length: 264\r\n\r\n" <- "a4=100&a1=<API key>&a5=EUR&c1=Longbob+Longsen&b2=1&b1=5223450000000007&b5=090&b4=25&b3=12&d1=127.0.0.1&c3=unspecified%40example.com&c5=456+My+StreetApt+1&c7=Ottawa&c10=K1C2N6&c2=+555+555-5555&M=SPREE978&O=1&K=<API key>" -> "HTTP/1.1 200 OK\r\n" -> "Date: Wed, 09 Mar 2016 03:03:00 GMT\r\n" -> "Content-Type: application/<API key>\r\n" -> "Content-Length: 283\r\n" -> "Connection: close\r\n" -> "\r\n" reading 283 bytes... -> "M=SPREE978&O=1&T=03%2F09%2F2016+03%3A03%3A01&V=413&a1=<API key>&a2=2&a4=100&a9=6&z1=<API key>&z13=606944188276&z14=U&z15=100&z2=0&z3=Transaction+has+been+executed+successfully.&z4=006592&z5=0&z6=00&z9=X&K=<API key>" read 283 bytes Conn close ) end def scrubbed_transcript %( opening connection to intconsole.credorax.com:443... opened starting SSL for intconsole.credorax.com:443... SSL established <- "POST /intenv/service/gateway HTTP/1.1\r\nContent-Type: application/<API key>\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*\r\nUser-Agent: Ruby\r\nConnection: close\r\nHost: intconsole.credorax.com\r\nContent-Length: 264\r\n\r\n" <- "a4=100&a1=<API key>&a5=EUR&c1=Longbob+Longsen&b2=1&b1=[FILTERED]&b5=[FILTERED]&b4=25&b3=12&d1=127.0.0.1&c3=unspecified%40example.com&c5=456+My+StreetApt+1&c7=Ottawa&c10=K1C2N6&c2=+555+555-5555&M=SPREE978&O=1&K=<API key>" -> "HTTP/1.1 200 OK\r\n" -> "Date: Wed, 09 Mar 2016 03:03:00 GMT\r\n" -> "Content-Type: application/<API key>\r\n" -> "Content-Length: 283\r\n" -> "Connection: close\r\n" -> "\r\n" reading 283 bytes... -> "M=SPREE978&O=1&T=03%2F09%2F2016+03%3A03%3A01&V=413&a1=<API key>&a2=2&a4=100&a9=6&z1=<API key>&z13=606944188276&z14=U&z15=100&z2=0&z3=Transaction+has+been+executed+successfully.&z4=006592&z5=0&z6=00&z9=X&K=<API key>" read 283 bytes Conn close ) end end
<?php namespace frontend\modules\admin\models; use common\models\User; use yii\base\Model; use Yii; use yii\helpers\VarDumper; use yii\web\HttpException; class CreateUserForm extends Model { public $username; public $email; public $password; public $role; /** * @inheritdoc */ public function rules() { return [ ['username', 'filter', 'filter' => 'trim'], ['username', 'required'], ['username', 'unique', 'targetClass' => '\common\models\User', 'message' => 'This username has already been taken.', 'on' => 'create'], ['username', 'string', 'min' => 2, 'max' => 255], ['email', 'filter', 'filter' => 'trim'], ['email', 'required'], ['email', 'email'], ['email', 'unique', 'targetClass' => '\common\models\User', 'message' => 'This email address has already been taken.', 'on' => 'create'], ['password', 'required', 'on' => 'create'], ['password', 'string', 'min' => 6], ]; } /** * Creates a new user * @return User|null */ public function create() { if($this->validate()) { $user = new User(); $user->username = $this->username; $user->email = $this->email; $user->setPassword($this->password); $user->generateAuthKey(); if($user->save()) { $auth = Yii::$app->authManager; if(is_array($this->role) && count($this->role)) { foreach($this->role as $roleName) { $role = $auth->getRole($roleName); $auth->assign($role, $user->getId()); } } elseif(trim($this->role) != '') { $role = $auth->getRole($this->role); $auth->assign($role, $user->getId()); } else { $role = $auth->getRole('subscriber'); $auth->assign($role, $user->getId()); } return $user; } } return null; } /** * Updates a user * @param $id user id * @return User|null * @throws HttpException when the user not exists */ public function update($id) { if($this->validate()) { $user = $this->loadModel($id); $user->username = $this->username; $user->email = $this->email; if($this->password != null || trim($this->password) != '') { $user->setPassword($this->password); } if($user->save()) { $auth = Yii::$app->authManager; $auth->revokeAll($user->getId()); if(is_array($this->role) && count($this->role)) { foreach($this->role as $roleName) { $role = $auth->getRole($roleName); $auth->assign($role, $user->getId()); } } elseif(trim($this->role) != '') { $role = $auth->getRole($this->role); $auth->assign($role, $user->getId()); } else { $role = $auth->getRole('subscriber'); $auth->assign($role, $user->getId()); } return $user; } } return null; } public function getErrors() { $getErrors = parent::getErrors(); $errors = []; foreach($getErrors as $attr => $attrErrors) { foreach($attrErrors as $errorMsg) { $errors[] = $errorMsg; } } return $errors; } public function getRoles() { $auth = Yii::$app->authManager; $roles = []; foreach($auth->getRoles() as $role) { $roles[$role->name] = strtoupper($role->name); } return $roles; } /** * Get the model * @param string $id The model id * @return \common\models\User * @throws HttpException */ protected function loadModel($id) { $model = User::findOne([ "id" => $id ]); if($model == null) { throw new HttpException(403, "The request is invalid!"); } return $model; } }
import Promise from 'bluebird' import getMemberInfo from 'src/server/actions/getMemberInfo' import {Cycle, Phase, Project} from 'src/server/services/dataService' export default async function <API key>(cycleId) { const [cycle, phases] = await Promise.all([ await Cycle.get(cycleId), await Phase.filter({hasRetrospective: true}) ]) const message = _buildMessage(cycle) await Promise.each(phases, async phase => { await <API key>(cycle, phase, message) await <API key>(cycle, phase, message) }) } async function <API key>(cycle, phase, message) { const chatService = require('src/server/services/chatService') try { await chatService.sendChannelMessage(phase.channelName, message) } catch (err) { console.warn(`Failed to send cycle reflection announcement to Phase ${phase.number} for cycle ${cycle.cycleNumber}: ${err}`) } } async function <API key>(cycle, phase, message) { const chatService = require('src/server/services/chatService') const phaseProjects = await Project.filter({phaseId: phase.id}) const <API key> = Object.keys(phaseProjects.reduce((result, project) => { result[project.memberIds] = true // in case anyone is in multiple projects return result }, {})) const phaseMembers = await getMemberInfo(<API key>) const phaseMemberHandles = phaseMembers.map(u => u.handle) try { await chatService.sendDirectMessage(phaseMemberHandles, message) } catch (err) { console.warn(`Failed to send cycle reflection announcement to Phase ${phase.number} for cycle ${cycle.cycleNumber}: ${err}`) } } function _buildMessage(cycle) { const announcement = `🤔 *Time to start your reflection process for cycle ${cycle.cycleNumber}*!\n` const <API key> = 'To get started check out `/retro --help`' return announcement + <API key> }
<!DOCTYPE html PUBLIC "- <html xmlns="http: <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="GENERATOR" content="VSdocman - documentation generator; https: <link rel="icon" href="favicon.ico"> <title><API key>.FirstName Property</title> <link rel="stylesheet" type="text/css" href="msdn2019/toc.css" /> <script src="msdn2019/toc.js"></script> <link rel="stylesheet" type="text/css" href="msdn2019/msdn2019.css"></link> <script src="msdn2019/msdn2019.js" type="text/javascript"></script> <script src="SyntaxHighlighter/scripts/shCore_helixoft.js" type="text/javascript"></script> <script src="SyntaxHighlighter/scripts/shBrushVb.js" type="text/javascript"></script> <script src="SyntaxHighlighter/scripts/shBrushCSharp.js" type="text/javascript"></script> <script src="SyntaxHighlighter/scripts/shBrushFSharp.js" type="text/javascript"></script> <script src="SyntaxHighlighter/scripts/shBrushCpp.js" type="text/javascript"></script> <script src="SyntaxHighlighter/scripts/shBrushJScript.js" type="text/javascript"></script> <link href="SyntaxHighlighter/styles/shCore.css" rel="stylesheet" type="text/css" /> <link href="SyntaxHighlighter/styles/shThemeMsdnLW.css" rel="stylesheet" type="text/css" /> <script type="text/javascript"> SyntaxHighlighter.all(); </script> <link rel="stylesheet" type="text/css" href="vsdocman_overrides.css"></link> </head> <body style="direction: ltr;"> <div id="topic"> <!--HEADER START <div id="header"> <div id="<API key>"> <div id="<API key>"> <div id="<API key>"> <div id="runningHeaderText1"><a id="headerLogo" href="#" onclick="window.location.href = <API key>('--headerLogoLink'); return false;">logo</a></div> <div id="runningHeaderText1b"><script> document.write(<API key>('--<API key>')); </script></div> </div> </div> <div id="<API key>"> <div id="runningHeaderText">SOLUTION-WIDE PROPERTIES Reference</div> <div id="<API key>"> <form id="search-bar" action="search--.html"> <input id="HeaderSearchInput" type="search" name="search" placeholder="Search" > <button id="btn-search" class="c-glyph" title="Search"> <span>Search</span> </button> </form> <button id="cancel-search" class="cancel-search" title="Cancel"> <span>Cancel</span> </button> </div> </div> </div> <hr /> <div id="header-breadcrumbs"></div> <div id="headerLinks"> </div> <hr /> </div> <!--HEADER END <div id="mainSection"> <div id="toc-area"> <div id="toc-container" class="stickthis full-height"> <div id="-1"></div> <div id="c-1"> <div id="ci-1" class="inner-for-height"></div> </div> </div> </div> <div id="mainBody"> <h1 class="title"><API key>.FirstName Property</h1> <div class="metadata"> Namespace: <a href="<API key>.html">Tlece.Recruitment.Models</a> <br />Assembly: Tlece.Recruitment (in Tlece.Recruitment.dll) </div> <div class="section_container"> <div id="syntaxSection" class="section"> <div id="syntaxCodeBlocks"> <div class="<API key>"> <div class="codeSnippetTabs"> <div class="<API key>"> </div> <div class="codeSnippetTab csFirstTab csActiveTab codeVB"> <a>VB</a> </div> <div class="codeSnippetTab csNaTab codeCsharp"> <a href="javascript: <API key>('Csharp');">C </div> <div class="codeSnippetTab csNaTab codeFsharp"> <a href="javascript: <API key>('Fsharp');">F </div> <div class="codeSnippetTab csNaTab codeCpp"> <a href="javascript: <API key>('Cpp');">C++</a> </div> <div class="codeSnippetTab csLastTab csNaTab codeJScript"> <a href="javascript: <API key>('JScript');">JScript</a> </div> <div class="<API key>"> </div> <div style="clear:both;"> </div> </div> <div class="<API key>"> <div class="codeSnippetToolbar"> <a title="Copy to clipboard." href="javascript:void(0)" onclick="CopyCode(this);">Copy</a> </div> <div class="codeSnippetCode codeVB"> <pre xml:space="preserve" class="brush: vb">Public Property FirstName() As <a target="_top" href="https://docs.microsoft.com/en-us/dotnet/api/system.string">String</a></pre> </div> <div class="codeSnippetCode codeNA"> <pre xml:space="preserve">This language is not supported or no code example is available.</pre> </div> </div> </div> <div class="<API key>"> <div class="codeSnippetTabs"> <div class="<API key>"> </div> <div class="codeSnippetTab csFirstTab csNaTab codeVB"> <a>VB</a> </div> <div class="codeSnippetTab csActiveTab codeCsharp"> <a href="javascript: <API key>('Csharp');">C </div> <div class="codeSnippetTab csNaTab codeFsharp"> <a href="javascript: <API key>('Fsharp');">F </div> <div class="codeSnippetTab csNaTab codeCpp"> <a href="javascript: <API key>('Cpp');">C++</a> </div> <div class="codeSnippetTab csLastTab csNaTab codeJScript"> <a href="javascript: <API key>('JScript');">JScript</a> </div> <div class="<API key>"> </div> <div style="clear:both;"> </div> </div> <div class="<API key>"> <div class="codeSnippetToolbar"> <a title="Copy to clipboard." href="javascript:void(0)" onclick="CopyCode(this);">Copy</a> </div> <div class="codeSnippetCode codeCsharp"> <pre xml:space="preserve" class="brush: csharp">public <a target="_top" href="https://docs.microsoft.com/en-us/dotnet/api/system.string">string</a> FirstName {get; set;}</pre> </div> <div class="codeSnippetCode codeNA"> <pre xml:space="preserve">This language is not supported or no code example is available.</pre> </div> </div> </div> <div class="<API key>"> <div class="codeSnippetTabs"> <div class="<API key>"> </div> <div class="codeSnippetTab csFirstTab csNaTab codeVB"> <a>VB</a> </div> <div class="codeSnippetTab csNaTab codeCsharp"> <a href="javascript: <API key>('Csharp');">C </div> <div class="codeSnippetTab csNaTab codeFsharp"> <a href="javascript: <API key>('Fsharp');">F </div> <div class="codeSnippetTab csActiveTab codeCpp"> <a href="javascript: <API key>('Cpp');">C++</a> </div> <div class="codeSnippetTab csLastTab csNaTab codeJScript"> <a href="javascript: <API key>('JScript');">JScript</a> </div> <div class="<API key>"> </div> <div style="clear:both;"> </div> </div> <div class="<API key>"> <div class="codeSnippetToolbar"> <a title="Copy to clipboard." href="javascript:void(0)" onclick="CopyCode(this);">Copy</a> </div> <div class="codeSnippetCode codeCpp"> <pre xml:space="preserve" class="brush: cpp">public: &nbsp;<br />property <a target="_top" href="https: </div> <div class="codeSnippetCode codeNA"> <pre xml:space="preserve">This language is not supported or no code example is available.</pre> </div> </div> </div> <div class="<API key>"> <div class="codeSnippetTabs"> <div class="<API key>"> </div> <div class="codeSnippetTab csFirstTab csNaTab codeVB"> <a>VB</a> </div> <div class="codeSnippetTab csNaTab codeCsharp"> <a href="javascript: <API key>('Csharp');">C </div> <div class="codeSnippetTab csNaTab codeFsharp"> <a href="javascript: <API key>('Fsharp');">F </div> <div class="codeSnippetTab csNaTab codeCpp"> <a href="javascript: <API key>('Cpp');">C++</a> </div> <div class="codeSnippetTab csActiveTab csLastTab codeJScript"> <a href="javascript: <API key>('JScript');">JScript</a> </div> <div class="<API key>"> </div> <div style="clear:both;"> </div> </div> <div class="<API key>"> <div class="codeSnippetToolbar"> <a title="Copy to clipboard." href="javascript:void(0)" onclick="CopyCode(this);">Copy</a> </div> <div class="codeSnippetCode codeJScript"> <pre xml:space="preserve" class="brush: js">public function get FirstName() : <a target="_top" href="https: </div> <div class="codeSnippetCode codeNA"> <pre xml:space="preserve">This language is not supported or no code example is available.</pre> </div> </div> </div> </div> <h4 class="subHeading"> Property Value</h4> <a target="_top" href="https://docs.microsoft.com/en-us/dotnet/api/system.string">string</a> </div> </div> <div class="section_container"> <div class="section_heading"> <span><a href="javascript:void(0)" title="Collapse" onclick="toggleSection(this);">Applies to</a></span> <div>&nbsp;</div> </div> <div id="frameworksSection" class="section"> <h4 class="subHeading">.NET Framework</h4>Supported in: 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1<br /> </div> </div> <div class="section_container"> <div class="section_heading"> <span><a href="javascript:void(0)" title="Collapse" onclick="toggleSection(this);">See Also</a></span> <div>&nbsp;</div> </div> <div id="seeAlsoSection" class="section"> <div> <a href="<API key>.html"><API key> Class</a><br /> <a href="<API key>.html">Tlece.Recruitment.Models Namespace</a><br /> </div> </div> </div> </div> <div id="internal-toc-area"> <div id="<API key>" class="stickthis"> <h3 id="<API key>">In this article</h3> <span id="<API key>">Definition</span> </div> </div> </div> <div id="footer"> <div id="footer-container"> <p><span style="color: </div> </div> </div> </body> </html>
<?php declare(strict_types=1); namespace Eloquent\Phony\Mock\Method; use Eloquent\Phony\Mock\Builder\MockBuilderFactory; use Eloquent\Phony\Mock\Handle\HandleFactory; use Eloquent\Phony\Test\TestClassA; use PHPUnit\Framework\TestCase; use ReflectionMethod; class <API key> extends TestCase { protected function setUp(): void { $this->mockBuilderFactory = MockBuilderFactory::instance(); $this->callParentMethod = new ReflectionMethod($this, 'setUp'); $this->method = new ReflectionMethod(TestClassA::class . '::testClassAMethodE'); $this->mockBuilder = $this->mockBuilderFactory->create(); $this->mock = $this->mockBuilder->partial(); $this->handleFactory = HandleFactory::instance(); $this->handle = $this->handleFactory->instanceHandle($this->mock); $this->subject = new WrappedParentMethod($this->callParentMethod, $this->method, $this->handle); } public function testConstructor() { $this->assertSame($this->callParentMethod, $this->subject->callParentMethod()); $this->assertSame($this->method, $this->subject->method()); $this->assertSame('testClassAMethodE', $this->subject->name()); $this->assertSame($this->handle, $this->subject->handle()); $this->assertSame($this->mock, $this->subject->mock()); $this->assertFalse($this->subject->isAnonymous()); $this->assertNull($this->subject->callback()); $this->assertSame('', $this->subject->label()); } public function <API key>() { $this->method = new ReflectionMethod(TestClassA::class . '::<API key>'); $this->handle = $this->handleFactory->staticHandle($this->mockBuilder->build()); $this->subject = new WrappedParentMethod($this->callParentMethod, $this->method, $this->handle); $this->assertSame($this->callParentMethod, $this->subject->callParentMethod()); $this->assertSame($this->method, $this->subject->method()); $this->assertSame('<API key>', $this->subject->name()); $this->assertSame($this->handle, $this->subject->handle()); $this->assertNull($this->subject->mock()); $this->assertFalse($this->subject->isAnonymous()); $this->assertNull($this->subject->callback()); $this->assertSame('', $this->subject->label()); } public function testSetLabel() { $this->assertSame($this->subject, $this->subject->setLabel('')); $this->assertSame('', $this->subject->label()); $this->subject->setLabel('label'); $this->assertSame('label', $this->subject->label()); } public function testInvokeMethods() { $mockBuilder = $this->mockBuilderFactory->create(TestClassA::class); $class = $mockBuilder->build(); $callParentMethod = $class->getMethod('_callParent'); $callParentMethod->setAccessible(true); $method = new ReflectionMethod(TestClassA::class . '::testClassAMethodC'); $mock = $mockBuilder->get(); $handle = $this->handleFactory->instanceHandle($mock); $subject = new WrappedParentMethod($callParentMethod, $method, $handle); $this->assertSame('protected ab', $subject('a', 'b')); $this->assertSame('protected ab', $subject->invoke('a', 'b')); $this->assertSame('protected ab', $subject->invokeWith(['a', 'b'])); $this->assertSame('protected ', $subject->invokeWith()); } public function <API key>() { $mockBuilder = $this->mockBuilderFactory->create(TestClassA::class); $class = $mockBuilder->build(); $callParentMethod = $class->getMethod('_callParentStatic'); $callParentMethod->setAccessible(true); $method = new ReflectionMethod(TestClassA::class . '::<API key>'); $handle = $this->handleFactory->staticHandle($mockBuilder->build()); $subject = new WrappedParentMethod($callParentMethod, $method, $handle); $this->assertSame('protected ab', $subject('a', 'b')); $this->assertSame('protected ab', $subject->invoke('a', 'b')); $this->assertSame('protected ab', $subject->invokeWith(['a', 'b'])); $this->assertSame('protected ', $subject->invokeWith()); } }
<footer class="main-footer"> <a class="main-footer__link" href="https://github.com/moonbrv/<API key>"> <img src="./img/github.svg" alt="see code on github" class="main-footer__img"> </a> </footer>
var StickyNav = { config: { viewportHeight : Helpers.windowHeight(), navSelector : document.querySelector('[data-js="nav"]') }, init: function(options) { if( typeof options === "object" ) { this.config = options; } var $this = this; window.addEventListener( 'scroll' , function() { var topOffset = this.pageYOffset; if(topOffset >= $this.config.viewportHeight) { $this.config.navSelector.classList.add('nav-anchor-top'); } if(topOffset <= $this.config.viewportHeight) { $this.config.navSelector.classList.remove('nav-anchor-top'); } }, false ); } };
<?php return array( 'global_password' => 'mjaumjau', );
package com.microsoft.azure.spring.cloud.feature.manager.targeting; /** * The settings that are used to configure the TargetingFilter feature filter. */ public class <API key> { private Audience audience; /** * @return the audience */ public Audience getAudience() { return audience; } /** * @param audience the audience to set */ public void setAudience(Audience audience) { this.audience = audience; } }
require 'rails_helper' RSpec.describe Api::<API key>, type: :controller do end
module.exports = require('util-ex/lib/is/type/undefined');
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>paco: Not compatible </title> <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" /> <link href="../../../../../bootstrap.min.css" rel="stylesheet"> <link href="../../../../../bootstrap-custom.css" rel="stylesheet"> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <script src="../../../../../moment.min.js"></script> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file: <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif] </head> <body> <div class="container"> <div class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="../..">clean / released</a></li> <li class="active"><a href="">8.12.1 / paco - 1.2.9</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> paco <small> 1.2.9 <span class="label label-info">Not compatible </span> </small> </h1> <p> <em><script>document.write(moment("2021-10-12 20:31:15 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2021-10-12 20:31:15 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-num base Num library distributed with the OCaml compiler base-threads base base-unix base conf-findutils 1 Virtual package relying on findutils coq 8.12.1 Formal proof management system num 0 The Num library for arbitrary-precision integer and rational arithmetic ocaml 4.05.0 The OCaml compiler (virtual package) ocaml-base-compiler 4.05.0 Official 4.05.0 release ocaml-config 1 OCaml Switch Configuration ocamlfind 1.9.1 A library manager for OCaml # opam file: opam-version: &quot;2.0&quot; maintainer: &quot;paco@sf.snu.ac.kr&quot; version: &quot;1.2.9&quot; homepage: &quot;https://github.com/snu-sf/paco/&quot; dev-repo: &quot;git+https://github.com/snu-sf/paco.git&quot; bug-reports: &quot;https://github.com/snu-sf/paco/issues/&quot; authors: [ &quot;Chung-Kil Hur &lt;gil.hur@sf.snu.ac.kr&gt;&quot; &quot;Georg Neis &lt;neis@mpi-sws.org&gt;&quot; &quot;Derek Dreyer &lt;dreyer@mpi-sws.org&gt;&quot; &quot;Viktor Vafeiadis &lt;viktor@mpi-sws.org&gt;&quot; ] license: &quot;BSD-3&quot; build: [ [make &quot;-C&quot; &quot;src&quot; &quot;all&quot; &quot;-j%{jobs}%&quot;] ] install: [ [make &quot;-C&quot; &quot;src&quot; &quot;-f&quot; &quot;Makefile.coq&quot; &quot;install&quot;] ] remove: [&quot;rm&quot; &quot;-r&quot; &quot;-f&quot; &quot;%{lib}%/coq/user-contrib/Paco&quot;] depends: [ &quot;ocaml&quot; &quot;coq&quot; {&gt;= &quot;8.6&quot; &amp; &lt; &quot;8.10&quot;} ] synopsis: &quot;Coq library implementing parameterized coinduction&quot; tags: [ &quot;date:2018-02-11&quot; &quot;category:Computer Science/Programming Languages/Formal Definitions and Theory&quot; &quot;category:Mathematics/Logic&quot; &quot;keyword:co-induction&quot; &quot;keyword:simulation&quot; &quot;keyword:parameterized greatest fixed point&quot; ] flags: light-uninstall url { src: &quot;https://github.com/snu-sf/paco/archive/v1.2.9.tar.gz&quot; checksum: &quot;md5=<API key>&quot; } </pre> <h2>Lint</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Dry install </h2> <p>Dry install with the current Coq version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam install -y --show-action coq-paco.1.2.9 coq.8.12.1</code></dd> <dt>Return code</dt> <dd>5120</dd> <dt>Output</dt> <dd><pre>[NOTE] Package coq is already installed (current version is 8.12.1). The following dependencies couldn&#39;t be met: - coq-paco -&gt; coq &lt; 8.10 -&gt; ocaml &lt; 4.03.0 base of this switch (use `--unlock-base&#39; to force) Your request can&#39;t be satisfied: - No available version of coq satisfies the constraints No solution found, exiting </pre></dd> </dl> <p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-paco.1.2.9</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Install dependencies</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Install </h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Installation size</h2> <p>No files were installed.</p> <h2>Uninstall 🧹</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Missing removes</dt> <dd> none </dd> <dt>Wrong removes</dt> <dd> none </dd> </dl> </div> </div> </div> <hr/> <div class="footer"> <p class="text-center"> Sources are on <a href="https: </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>random: Not compatible </title> <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" /> <link href="../../../../../bootstrap.min.css" rel="stylesheet"> <link href="../../../../../bootstrap-custom.css" rel="stylesheet"> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <script src="../../../../../moment.min.js"></script> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file: <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif] </head> <body> <div class="container"> <div class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="../..">clean / released</a></li> <li class="active"><a href="">8.11.2 / random - 8.7.0</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> random <small> 8.7.0 <span class="label label-info">Not compatible </span> </small> </h1> <p> <em><script>document.write(moment("2021-11-26 20:00:27 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2021-11-26 20:00:27 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-threads base base-unix base conf-findutils 1 Virtual package relying on findutils coq 8.11.2 Formal proof management system num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic ocaml 4.06.1 The OCaml compiler (virtual package) ocaml-base-compiler 4.06.1 Official 4.06.1 release ocaml-config 1 OCaml Switch Configuration ocamlfind 1.9.1 A library manager for OCaml # opam file: opam-version: &quot;2.0&quot; maintainer: &quot;Hugo.Herbelin@inria.fr&quot; homepage: &quot;https://github.com/coq-contribs/random&quot; license: &quot;LGPL 2.1&quot; build: [make &quot;-j%{jobs}%&quot;] install: [make &quot;install&quot;] remove: [&quot;rm&quot; &quot;-R&quot; &quot;%{lib}%/coq/user-contrib/Random&quot;] depends: [ &quot;ocaml&quot; &quot;coq&quot; {&gt;= &quot;8.7&quot; &amp; &lt; &quot;8.8~&quot;} ] tags: [ &quot;keyword: randomized algorithms&quot; &quot;keyword: monads&quot; &quot;keyword: probability&quot; &quot;category: Computer Science/Decision Procedures and Certified Algorithms/Correctness proofs of algorithms&quot; ] authors: [ &quot;Christine Paulin&quot; ] bug-reports: &quot;https://github.com/coq-contribs/random/issues&quot; dev-repo: &quot;git+https://github.com/coq-contribs/random.git&quot; synopsis: &quot;Interpretation of random programs&quot; description: &quot;&quot;&quot; This contribution is a modelisation of random programs as measures in Coq. It started in 2004 in the context of the AVERROES project (http://www-verimag.imag.fr/AVERROES/). It is based on comon work with Philippe Audebaud (ENS Lyon). It was last updated in february 2007. It contains the following elements - an axiomatisation of the interval [0,1] and derived properties (files Ubase.v and Uprop.v); - a definition of measures on a type A as functions of type (A-&gt;[0,1])-&gt;[0,1] enjoying special stability properties (files Monads.v and Probas.v); proofs that these constructions have a monadic structure; - an interpretation of programs of type A as measures, in particular a fixpoint construction; the definition of an axiomatic semantic for deriving judgements such as ``the probability of an expression e to evaluate to a result satisfying property q belongs to an interval [p,q]&#39;&#39; (file Prog.v); - Proof of probabilistic termination of a linear random walk (file Iterflip.v); - Proof of a program implementing a bernoulli distribution (Proba(bernouilli(p)=true)=p) using a coin flip and the derived binomial law (Proba(binomial p n=k)=C(n,k)p^k(1-p)^{n-k}) (file Bernoulli.v); - Proof of estimation of the combination of two random executions (file Choice.v) - Proof of partial termination of parameterized random walk (file Ycart.v) - Definition of a measure on traces from a mesure on transitions steps (file Nelist.v, Transitions.v) The document random.pdf contains a short introduction to the library associated to the Gallina source code of the library.&quot;&quot;&quot; flags: light-uninstall url { src: &quot;https://github.com/coq-contribs/random/archive/v8.7.0.tar.gz&quot; checksum: &quot;md5=<API key>&quot; } </pre> <h2>Lint</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Dry install </h2> <p>Dry install with the current Coq version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam install -y --show-action coq-random.8.7.0 coq.8.11.2</code></dd> <dt>Return code</dt> <dd>5120</dd> <dt>Output</dt> <dd><pre>[NOTE] Package coq is already installed (current version is 8.11.2). The following dependencies couldn&#39;t be met: - coq-random -&gt; coq &lt; 8.8~ -&gt; ocaml &lt; 4.06.0 base of this switch (use `--unlock-base&#39; to force) Your request can&#39;t be satisfied: - No available version of coq satisfies the constraints No solution found, exiting </pre></dd> </dl> <p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-random.8.7.0</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Install dependencies</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Install </h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Installation size</h2> <p>No files were installed.</p> <h2>Uninstall 🧹</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Missing removes</dt> <dd> none </dd> <dt>Wrong removes</dt> <dd> none </dd> </dl> </div> </div> </div> <hr/> <div class="footer"> <p class="text-center"> Sources are on <a href="https: </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
from .sender import SignalSender, connect_with from .base import ValueModel, AttachAbility from .base import ValueInterface, ChangedInterface from .base import AbstractItem, Item, AbstractProperty from .multi_types import StringValueModel, StringProperty, StringItemInterface, StringItem from .multi_types import IntValueModel, IntProperty, IntItemInterface, IntItem from .multi_types import FloatValueModel, FloatProperty, FloatItemInterface, FloatItem from .multi_types import DictValueModel, DictProperty, DictItemInterface, DictItem from .multi_types import ListValueModel, ListProperty, ListItemInterface, ListItem from .multi_types import <API key>, StringListProperty, <API key>, StringListItem from .multi_types import DictListValueModel, DictListProperty, <API key>, DictListItem from .multi_types import StringIntProperty, <API key> from .multi_types import StringFloatProperty, <API key> from .project import AbstractProject, AbstractProjectItem from .project import StringProjectItem, IntProjectItem, FloatProjectItem from .project import TimePointItem from .setting import AbstractSetting, AbstractSettingItem from .setting import StringSettingItem, <API key>, IntSettingItem, FloatSettingItem from .widget_interface import WidgetStringItem, <API key> from .widget_interface import IndexItem, <API key> from .widget_interface import StringsItem, <API key> from .widget_interface import WidgetDictItem, WidgetDictInterface from .widget_interface import <API key>
# copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # and/or sell copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following conditions: # all copies or substantial portions of the Software. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. import sys from functools import wraps from rply import ParserGenerator from hy.models.complex import HyComplex from hy.models.cons import HyCons from hy.models.dict import HyDict from hy.models.expression import HyExpression from hy.models.float import HyFloat from hy.models.integer import HyInteger from hy.models.keyword import HyKeyword from hy.models.list import HyList from hy.models.set import HySet from hy.models.string import HyString from hy.models.symbol import HySymbol from .lexer import lexer from .exceptions import LexException, PrematureEndOfInput pg = ParserGenerator( [rule.name for rule in lexer.rules] + ['$end'], cache_id="hy_parser" ) def set_boundaries(fun): @wraps(fun) def wrapped(p): start = p[0].source_pos end = p[-1].source_pos ret = fun(p) ret.start_line = start.lineno ret.start_column = start.colno if start is not end: ret.end_line = end.lineno ret.end_column = end.colno else: ret.end_line = start.lineno ret.end_column = start.colno + len(p[0].value) return ret return wrapped def <API key>(fun): @wraps(fun) def wrapped(p): start = p[0].source_pos ret = fun(p) ret.start_line = start.lineno ret.start_column = start.colno ret.end_line = p[-1].end_line ret.end_column = p[-1].end_column return ret return wrapped @pg.production("main : HASHBANG real_main") def main_hashbang(p): return p[1] @pg.production("main : real_main") def main(p): return p[0] @pg.production("real_main : list_contents") def real_main(p): return p[0] @pg.production("real_main : $end") def real_main_empty(p): return [] def <API key>(*items): "Reject the spurious dots from items" for list in items: for tok in list: if tok == "." and type(tok) == HySymbol: raise LexException("Malformed dotted list", tok.start_line, tok.start_column) @pg.production("paren : LPAREN list_contents RPAREN") @set_boundaries def paren(p): cont = p[1] # Dotted lists are expressions of the form # (a b c . d) # that evaluate to nested cons cells of the form # (a . (b . (c . d))) if len(cont) >= 3 and isinstance(cont[-2], HySymbol) and cont[-2] == ".": <API key>(cont[:-2], cont[-1:]) if len(cont) == 3: # Two-item dotted list: return the cons cell directly return HyCons(cont[0], cont[2]) else: # Return a nested cons cell return HyCons(cont[0], paren([p[0], cont[1:], p[2]])) # Warn preemptively on a malformed dotted list. # Only check for dots after the first item to allow for a potential # attribute accessor shorthand <API key>(cont[1:]) return HyExpression(p[1]) @pg.production("paren : LPAREN RPAREN") @set_boundaries def empty_paren(p): return HyExpression([]) @pg.production("list_contents : term list_contents") def list_contents(p): return [p[0]] + p[1] @pg.production("list_contents : term") def <API key>(p): return [p[0]] @pg.production("term : identifier") @pg.production("term : paren") @pg.production("term : dict") @pg.production("term : list") @pg.production("term : set") @pg.production("term : string") def term(p): return p[0] @pg.production("term : QUOTE term") @<API key> def term_quote(p): return HyExpression([HySymbol("quote"), p[1]]) @pg.production("term : QUASIQUOTE term") @<API key> def term_quasiquote(p): return HyExpression([HySymbol("quasiquote"), p[1]]) @pg.production("term : UNQUOTE term") @<API key> def term_unquote(p): return HyExpression([HySymbol("unquote"), p[1]]) @pg.production("term : UNQUOTESPLICE term") @<API key> def term_unquote_splice(p): return HyExpression([HySymbol("unquote_splice"), p[1]]) @pg.production("term : HASHREADER term") @<API key> def hash_reader(p): st = p[0].getstr()[1] str_object = HyString(st) expr = p[1] return HyExpression([HySymbol("<API key>"), str_object, expr]) @pg.production("set : HLCURLY list_contents RCURLY") @set_boundaries def t_set(p): return HySet(p[1]) @pg.production("set : HLCURLY RCURLY") @set_boundaries def empty_set(p): return HySet([]) @pg.production("dict : LCURLY list_contents RCURLY") @set_boundaries def t_dict(p): return HyDict(p[1]) @pg.production("dict : LCURLY RCURLY") @set_boundaries def empty_dict(p): return HyDict([]) @pg.production("list : LBRACKET list_contents RBRACKET") @set_boundaries def t_list(p): return HyList(p[1]) @pg.production("list : LBRACKET RBRACKET") @set_boundaries def t_empty_list(p): return HyList([]) if sys.version_info[0] >= 3: def uni_hystring(s): return HyString(eval(s)) else: def uni_hystring(s): return HyString(eval('u'+s)) @pg.production("string : STRING") @set_boundaries def t_string(p): # remove trailing quote s = p[0].value[:-1] # get the header header, s = s.split('"', 1) # remove unicode marker header = header.replace("u", "") # build python string s = header + '' return uni_hystring(s) @pg.production("string : PARTIAL_STRING") def t_partial_string(p): # Any unterminated string requires more input raise PrematureEndOfInput("Premature end of input") @pg.production("identifier : IDENTIFIER") @set_boundaries def t_identifier(p): obj = p[0].value try: return HyInteger(obj) except ValueError: pass if '/' in obj: try: lhs, rhs = obj.split('/') return HyExpression([HySymbol('fraction'), HyInteger(lhs), HyInteger(rhs)]) except ValueError: pass try: return HyFloat(obj) except ValueError: pass if obj != 'j': try: return HyComplex(obj) except ValueError: pass table = { "true": "True", "false": "False", "nil": "None", "null": "None", } if obj in table: return HySymbol(table[obj]) if obj.startswith(":"): return HyKeyword(obj) def mangle(p): if p.startswith("*") and p.endswith("*") and p not in ("*", "**"): p = p[1:-1].upper() if "-" in p and p != "-": p = p.replace("-", "_") if p.endswith("?") and p != "?": p = "is_%s" % (p[:-1]) return p obj = ".".join([mangle(part) for part in obj.split(".")]) return HySymbol(obj) @pg.error def error_handler(token): tokentype = token.gettokentype() if tokentype == '$end': raise PrematureEndOfInput("Premature end of input") else: raise LexException( "Ran into a %s where it wasn't expected." % tokentype, token.source_pos.lineno, token.source_pos.colno) parser = pg.build()
import sys import os import requests import json import twitter import config def <API key>(s): # My code here return { 'userid': str(s.user.id), 'id': str(s.id), 'sourceid': 'python-twitter', 'contenttype': 'text/plain', 'language': s.lang, 'content': s.text, 'created': s.<API key>, 'reply': (s.<API key> is None), 'forward': False } def run_twitter(handle): twitter_api = twitter.Api(consumer_key=os.environ.get('<TwitterConsumerkey>'), consumer_secret=os.environ.get('<TwitterConsumerkey>'), access_token_key=os.environ.get('<TwitterConsumerkey>'), access_token_secret=os.environ.get('<TwitterConsumerkey>'), ) max_id = None statuses = [] for x in range(0, 16): # Pulls max number of tweets from an account if x == 0: statuses_portion = twitter_api.GetUserTimeline(screen_name=handle, count=200, include_rts=False) status_count = len(statuses_portion) if status_count is not 0: max_id = statuses_portion[status_count - 1].id - 1 # get id of last tweet and bump below for next tweet set else: statuses_portion = twitter_api.GetUserTimeline(screen_name=handle, count=200, max_id=max_id, include_rts=False) status_count = len(statuses_portion) if status_count is not 0: max_id = statuses_portion[status_count - 1].id - 1 # get id of last tweet and bump below for next tweet set for status in statuses_portion: statuses.append(status) <API key> = map(<API key>, statuses) pi_content_items = {'contentItems': <API key>} r = requests.post(os.environ.get('PI_URL') + '/v2/profile', auth=(os.environ.get('PI_USERNAME'), os.environ.get('PI_PASSWORD')), headers={ 'content-type': 'application/json', 'accept': 'application/json' }, data=json.dumps(pi_content_items) ) print("Profile Request sent. Status code: %d, content-type: %s" % (r.status_code, r.headers['content-type'])) return json.loads(r.text) def run_text(text): r = requests.post(os.environ.get('PI_URL') + '/v2/profile', auth=(os.environ.get('PI_USERNAME'), os.environ.get('PI_PASSWORD')), headers={ 'content-type': 'text/plain', 'accept': 'application/json' }, data=text ) print("Profile Request sent. Status code: %d, content-type: %s" % (r.status_code, r.headers['content-type'])) return json.loads(r.text)
<TS language="mk_MK" version="2.1"> <context> <name>AddressBookPage</name> <message> <source>Right-click to edit address or label</source> <translation>Десен клик за уредување на адреса или етикета</translation> </message> <message> <source>Create a new address</source> <translation>Креирај нова адреса</translation> </message> <message> <source>&amp;New</source> <translation>&amp;Нова</translation> </message> <message> <source>Copy the currently selected address to the system clipboard</source> <translation>Копирај ја избраната адреса на системскиот клипборд</translation> </message> <message> <source>&amp;Copy</source> <translation>&amp;Копирај</translation> </message> <message> <source>C&amp;lose</source> <translation>З&amp;атвори</translation> </message> <message> <source>Delete the currently selected address from the list</source> <translation>Избриши ја избраната адреса од листата</translation> </message> <message> <source>Export the data in the current tab to a file</source> <translation>Експортирај ги податоците од активното јазиче во датотека</translation> </message> <message> <source>&amp;Export</source> <translation>&amp;Експорт</translation> </message> <message> <source>&amp;Delete</source> <translation>&amp;Избриши</translation> </message> </context> <context> <name>AddressTableModel</name> </context> <context> <name>AskPassphraseDialog</name> <message> <source>Enter passphrase</source> <translation>Внеси тајна фраза</translation> </message> <message> <source>New passphrase</source> <translation>Нова тајна фраза</translation> </message> <message> <source>Repeat new passphrase</source> <translation>Повторете ја новата тајна фраза</translation> </message> </context> <context> <name>BanTableModel</name> </context> <context> <name>UralsGUI</name> <message> <source>Sign &amp;message...</source> <translation>Потпиши &amp;порака...</translation> </message> <message> <source>Synchronizing with network...</source> <translation>Синхронизација со мрежата...</translation> </message> <message> <source>&amp;Overview</source> <translation>&amp;Преглед</translation> </message> <message> <source>Node</source> <translation>Јазол</translation> </message> <message> <source>&amp;Transactions</source> <translation>&amp;Трансакции</translation> </message> <message> <source>Browse transaction history</source> <translation>Преглед на историјата на трансакции</translation> </message> <message> <source>E&amp;xit</source> <translation>И&amp;злез</translation> </message> <message> <source>Quit application</source> <translation>Напушти ја апликацијата</translation> </message> <message> <source>About &amp;Qt</source> <translation>За &amp;Qt</translation> </message> <message> <source>Show information about Qt</source> <translation>Прикажи информации за Qt</translation> </message> <message> <source>&amp;Options...</source> <translation>&amp;Опции...</translation> </message> <message> <source>&amp;Encrypt Wallet...</source> <translation>&amp;Криптирање на Паричник...</translation> </message> <message> <source>&amp;Backup Wallet...</source> <translation>&amp;Бекап на Паричник...</translation> </message> <message> <source>&amp;Change Passphrase...</source> <translation>&amp;Измени Тајна Фраза...</translation> </message> <message> <source>&amp;Sending addresses...</source> <translation>&amp;Адреси за Испраќање...</translation> </message> <message> <source>&amp;Receiving addresses...</source> <translation>&amp;Адреси за Примање...</translation> </message> <message> <source>Open &amp;URI...</source> <translation>Отвори &amp;URI...</translation> </message> <message> <source>Reindexing blocks on disk...</source> <translation>Повторно индексирање на блокови од дискот...</translation> </message> <message> <source>Send coins to a Urals address</source> <translation>Испрати биткоини на Биткоин адреса</translation> </message> <message> <source>&amp;Verify message...</source> <translation>&amp;Потврди порака...</translation> </message> <message> <source>Urals</source> <translation>Биткоин</translation> </message> <message> <source>Wallet</source> <translation>Паричник</translation> </message> <message> <source>&amp;Send</source> <translation>&amp;Испрати</translation> </message> <message> <source>&amp;Receive</source> <translation>&amp;Прими</translation> </message> <message> <source>&amp;Show / Hide</source> <translation>&amp;Прикажи / Сокриј</translation> </message> <message> <source>Encrypt the private keys that belong to your wallet</source> <translation>Криптирај ги приватните клучеви кои припаѓаат на твојот паричник</translation> </message> <message> <source>&amp;Settings</source> <translation>&amp;Подесувања</translation> </message> <message> <source>&amp;Help</source> <translation>&amp;Помош</translation> </message> <message numerus="yes"> <source>Processed %n block(s) of transaction history.</source> <translation><numerusform>Обработен %n блок од историјата на трансакции.</numerusform><numerusform>Обработени %n блокови од историјата на трансакции.</numerusform></translation> </message> <message> <source>%1 behind</source> <translation>%1 позади</translation> </message> <message> <source>Error</source> <translation>Грешка</translation> </message> <message> <source>Warning</source> <translation>Предупредување</translation> </message> <message> <source>Up to date</source> <translation>Во тек</translation> </message> <message> <source>Date: %1 </source> <translation>Дата: %1 </translation> </message> <message> <source>Amount: %1 </source> <translation>Сума: %1 </translation> </message> <message> <source>Type: %1 </source> <translation>Тип: %1 </translation> </message> <message> <source>Label: %1 </source> <translation>Етикета: %1 </translation> </message> <message> <source>Address: %1 </source> <translation>Адреса: %1 </translation> </message> </context> <context> <name>CoinControlDialog</name> <message> <source>Bytes:</source> <translation>Бајти:</translation> </message> <message> <source>Amount:</source> <translation>Сума:</translation> </message> <message> <source>Fee:</source> <translation>Провизија:</translation> </message> <message> <source>Dust:</source> <translation>Прашина:</translation> </message> <message> <source>After Fee:</source> <translation>После Провизија:</translation> </message> <message> <source>Change:</source> <translation>Кусур:</translation> </message> <message> <source>Amount</source> <translation>Сума</translation> </message> <message> <source>Date</source> <translation>Дата</translation> </message> </context> <context> <name>EditAddressDialog</name> <message> <source>Edit Address</source> <translation>Измени Адреса</translation> </message> <message> <source>&amp;Label</source> <translation>&amp;Етикета</translation> </message> <message> <source>&amp;Address</source> <translation>&amp;Адреса</translation> </message> </context> <context> <name>FreespaceChecker</name> <message> <source>name</source> <translation>име</translation> </message> </context> <context> <name>HelpMessageDialog</name> <message> <source>version</source> <translation>верзија</translation> </message> <message> <source>(%1-bit)</source> <translation>(%1-бит)</translation> </message> </context> <context> <name>Intro</name> <message> <source>Error</source> <translation>Грешка</translation> </message> </context> <context> <name>ModalOverlay</name> </context> <context> <name>OpenURIDialog</name> <message> <source>Open URI</source> <translation>Отвори URI</translation> </message> <message> <source>URI:</source> <translation>URI:</translation> </message> </context> <context> <name>OptionsDialog</name> <message> <source>Options</source> <translation>Опции</translation> </message> <message> <source>MB</source> <translation>МБ</translation> </message> <message> <source>&amp;Network</source> <translation>&amp;Мрежа</translation> </message> <message> <source>W&amp;allet</source> <translation>П&amp;аричник</translation> </message> <message> <source>&amp;Window</source> <translation>&amp;Прозорец</translation> </message> <message> <source>&amp;OK</source> <translation>&amp;ОК</translation> </message> <message> <source>&amp;Cancel</source> <translation>&amp;Откажи</translation> </message> <message> <source>none</source> <translation>нема</translation> </message> </context> <context> <name>OverviewPage</name> <message> <source>Total:</source> <translation>Вкупно:</translation> </message> </context> <context> <name>PaymentServer</name> </context> <context> <name>PeerTableModel</name> </context> <context> <name>QObject</name> <message> <source>Amount</source> <translation>Сума</translation> </message> <message> <source>%1 d</source> <translation>%1 д</translation> </message> <message> <source>%1 h</source> <translation>%1 ч</translation> </message> <message> <source>%1 m</source> <translation>%1 м</translation> </message> <message> <source>%1 s</source> <translation>%1 с</translation> </message> <message> <source>%1 ms</source> <translation>%1 мс</translation> </message> <message> <source>%1 and %2</source> <translation>%1 и %2</translation> </message> </context> <context> <name>QObject::QObject</name> </context> <context> <name>QRImageWidget</name> </context> <context> <name>RPCConsole</name> <message> <source>Network</source> <translation>Мрежа</translation> </message> <message> <source>Name</source> <translation>Име</translation> </message> <message> <source>Number of connections</source> <translation>Број на конекции</translation> </message> <message> <source>Block chain</source> <translation>Block chain</translation> </message> <message> <source>Sent</source> <translation>Испратени</translation> </message> <message> <source>Version</source> <translation>Верзија</translation> </message> <message> <source>&amp;Console</source> <translation>&amp;Конзола</translation> </message> <message> <source>%1 B</source> <translation>%1 Б</translation> </message> <message> <source>%1 KB</source> <translation>%1 КБ</translation> </message> <message> <source>%1 MB</source> <translation>%1 МБ</translation> </message> <message> <source>%1 GB</source> <translation>%1 ГБ</translation> </message> </context> <context> <name>ReceiveCoinsDialog</name> <message> <source>&amp;Amount:</source> <translation>&amp;Сума:</translation> </message> <message> <source>&amp;Label:</source> <translation>&amp;Етикета:</translation> </message> <message> <source>&amp;Message:</source> <translation>&amp;Порака:</translation> </message> <message> <source>Show</source> <translation>Прикажи</translation> </message> </context> <context> <name><API key></name> <message> <source>QR Code</source> <translation>QR Код</translation> </message> <message> <source>Copy &amp;URI</source> <translation>Копирај &amp;URI</translation> </message> <message> <source>Copy &amp;Address</source> <translation>Копирај &amp;Адреса</translation> </message> <message> <source>&amp;Save Image...</source> <translation>&amp;Сними Слика...</translation> </message> </context> <context> <name><API key></name> </context> <context> <name>SendCoinsDialog</name> <message> <source>Bytes:</source> <translation>Бајти:</translation> </message> <message> <source>Amount:</source> <translation>Сума:</translation> </message> <message> <source>Fee:</source> <translation>Провизија:</translation> </message> <message> <source>After Fee:</source> <translation>После Провизија:</translation> </message> <message> <source>Change:</source> <translation>Кусур:</translation> </message> <message> <source>Dust:</source> <translation>Прашина:</translation> </message> </context> <context> <name>SendCoinsEntry</name> <message> <source>A&amp;mount:</source> <translation>Сума:</translation> </message> <message> <source>&amp;Label:</source> <translation>&amp;Етикета:</translation> </message> <message> <source>Message:</source> <translation>Порака:</translation> </message> </context> <context> <name><API key></name> </context> <context> <name>ShutdownWindow</name> </context> <context> <name><API key></name> </context> <context> <name>SplashScreen</name> </context> <context> <name>TrafficGraphWidget</name> </context> <context> <name>TransactionDesc</name> </context> <context> <name><API key></name> </context> <context> <name><API key></name> </context> <context> <name>TransactionView</name> </context> <context> <name><API key></name> </context> <context> <name>WalletFrame</name> </context> <context> <name>WalletModel</name> </context> <context> <name>WalletView</name> </context> <context> <name>urals-core</name> <message> <source>Options:</source> <translation>Опции:</translation> </message> <message> <source>Urals Core</source> <translation>Биткоин Core</translation> </message> <message> <source>Warning</source> <translation>Предупредување</translation> </message> <message> <source>Error</source> <translation>Грешка</translation> </message> </context> </TS>
<?php /** * @param $httpUrl * @param array $httpData * @return array|mixed|null */ function httpPostSend($httpUrl, $httpData = array()) { if (!$httpUrl) { return null; } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $httpUrl); curl_setopt($ch, <API key>, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 10); if ($httpData) { curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $httpData); } $output = json_decode(curl_exec($ch), true); curl_close($ch); if (!$output) { $output = []; } return $output; } /** * @param $min * @param $max * @param $in * @return bool */ function in_between($min, $max, $in) { if ($min <= $in && $max >= $in) { return TRUE; } return FALSE; } /** * @param $input * @return string */ function base64_url_encode($input) { return strtr(base64_encode($input), '+/', '-_'); } /** * @param $input * @return string */ function base64_url_decode($input) { return base64_decode(strtr($input, '-_', '+/')); } /** * @param $str * @param $len * @return string */ function utf8_mb_substr($str, $len) { return mb_substr(iconv('UTF-8', 'UTF-8//IGNORE', $str), 0, $len, 'UTF-8'); } /** * * @param $a * @param $b * @return mixed */ function array_add($a, $b) { foreach ($b as $key => $value) { if (isset($a[$key])) { if (is_array($a[$key]) && is_array($value)) { $a[$key] = array_add($a[$key], $value); } elseif (is_numeric($a[$key]) && is_numeric($value)) { $a[$key] += $value; } else { echo "";die; } } else { $a[$key] = $value; } } return $a; } /** * * @param $arr * @param $num * @return mixed */ function <API key>($arr, $num) { foreach ($arr as $key => $value) { if (is_array($value)) { $arr[$key] = <API key>($value, $num); } else { $arr[$key] = $value * $num; } } return $arr; }
using System; using System.Collections.Generic; using System.Configuration; using System.Text; using System.Web; using PayPal.<API key>; using PayPal.<API key>.Model; using Payment.Business.Model; using Payment.Repository; using Payment.Repository.Entity; using Profile.Repository.Entity; namespace Payment.Business.PayPal { public class PayPalService { private PaymentRepository _payPalRepository; public PaymentRepository PayPalRepository { get { return _payPalRepository ?? (_payPalRepository = new PaymentRepository()); } } private UserAccount _currentUser; public PayPalService(UserAccount user) { _currentUser = user; } public <API key> SendRequest(HttpContextBase context, string amount) { double cAmount = Converter.ParseToDouble(amount); var model = new <API key>(); var sumAmountInLastDay = PayPalRepository.<API key>(_currentUser.Id); if ((sumAmountInLastDay + cAmount) > 1000) { model.IsSucces = false; return model; } var request = new <API key>(); this.PopulateRequest(request, cAmount); var wrapper = new <API key>(); wrapper.<API key> = request; var service = new <API key>(); var setECResponse = service.SetExpressCheckout(wrapper); context.Items.Add("paymentDetails", request.<API key>.PaymentDetails); var <API key> = new Dictionary<string, string>(); <API key>.Add("API Status", setECResponse.Ack.ToString()); if (setECResponse.Ack.Equals(AckCodeType.FAILURE) || (setECResponse.Errors != null && setECResponse.Errors.Count > 0)) { context.Items.Add("Response_error", setECResponse.Errors); context.Items.Add("<API key>", null); } else { context.Items.Add("Response_error", null); <API key>.Add("EC token", setECResponse.Token); context.Items.Add("<API key>", <API key>.AppSettings["PAYPAL_REDIRECT_URL"].ToString() + "_express-checkout&token=" + setECResponse.Token); } context.Items.Add("<API key>", <API key>); context.Items.Add("Response_apiName", "SetExpressCheckout"); context.Items.Add("<API key>", service.getLastRequest()); context.Items.Add("<API key>", service.getLastResponse()); if (setECResponse.Ack.Equals(AckCodeType.SUCCESS)) { var entity = new Payment.Repository.Entity.PayPal { Id = Guid.NewGuid().ToString(), UserId = _currentUser.Id, State = "pending",//StateType.Complete.ToString(), UpdateTime = DateTime.UtcNow, CreateTime = DateTime.UtcNow, Amount = Converter.ParseToDouble(amount), CurrencyCode = "USD", InternalPaymentId = setECResponse.Token, Intent = "SALE", PayerEmail = _currentUser.Email }; PayPalRepository.<API key>(entity); model.Url = string.Format("https: setECResponse.Token); model.IsSucces = true; } else { var errors = (List<ErrorType>)context.Items["Response_error"]; StringBuilder errorText = new StringBuilder(); foreach (ErrorType errorType in errors) { errorText.AppendFormat("{0} {1};", errorType.ErrorCode, errorType.ShortMessage); } model.Errors = errorText.ToString(); model.IsSucces = false; } return model; } private void PopulateRequest(<API key> request, double itemTotal) { string rUrl = <API key>.AppSettings["HOSTING_ENDPOINT"]; string returnUrl = string.Empty; string cancelUrl = string.Empty; string ipnNotificationUrl = string.Empty; string requestUrl = rUrl;//<API key>.AppSettings["HOSTING_ENDPOINT"].ToString(); UriBuilder uriBuilder = new UriBuilder(requestUrl); uriBuilder.Path = "/PayPal/PayPalResponse"; returnUrl = uriBuilder.Uri.ToString(); uriBuilder = new UriBuilder(requestUrl); uriBuilder.Path = "/Payment.html"; cancelUrl = uriBuilder.Uri.ToString(); uriBuilder = new UriBuilder(requestUrl); //TODO:!!! uriBuilder.Path = "/PayPal/PayPalResponse"; ipnNotificationUrl = uriBuilder.Uri.ToString(); var <API key> = new <API key>(); if (returnUrl != "") { <API key>.ReturnURL = returnUrl; } if (cancelUrl != "") { <API key>.CancelURL = cancelUrl; } var email = _currentUser.Email; //todo:!!! if (!string.IsNullOrEmpty(email)) { <API key>.BuyerEmail = email; } var paymentDetails = new PaymentDetailsType(); <API key>.PaymentDetails.Add(paymentDetails); double orderTotal = 0.0; var currency = (CurrencyCodeType) Enum.Parse(typeof(CurrencyCodeType), "USD"); string orderDescription = "Payment to Webrunes"; if (orderDescription != "") { paymentDetails.OrderDescription = orderDescription; } paymentDetails.PaymentAction = (<API key>) Enum.Parse(typeof(<API key>), "SALE"); orderTotal += itemTotal; paymentDetails.ItemTotal = new BasicAmountType(currency, itemTotal.ToString()); paymentDetails.OrderTotal = new BasicAmountType(currency, orderTotal.ToString()); paymentDetails.NotifyURL = ipnNotificationUrl.Trim(); request.<API key> = <API key>; } public static string <API key>(string token, string payerId) { var repository = new PaymentRepository(); var request = new <API key>(); request.Token = token; var wrapper = new <API key>(); wrapper.<API key> = request; var service = new <API key>(); <API key> ecResponse = service.<API key>(wrapper); var <API key> = new <API key>(); var requestDetails = new <API key>(); <API key>.<API key> = requestDetails; requestDetails.PaymentDetails = ecResponse.<API key>.PaymentDetails; requestDetails.Token = token; requestDetails.PayerID = payerId; requestDetails.PaymentAction = (<API key>) Enum.Parse(typeof(<API key>), "SALE"); var doCheckoutWrapper = new <API key>(); doCheckoutWrapper.<API key> = <API key>; <API key> doECResponse = service.<API key>(doCheckoutWrapper); PaymentInfoType paymentInfoType = doECResponse.<API key>.PaymentInfo[0]; bool isPaid = doECResponse.Ack.Equals(AckCodeType.SUCCESS); var payPalStatus = paymentInfoType.PaymentStatus; Payment.Repository.Entity.PayPal payPal = repository.GetPayPalBy(token); if (payPal == null) { return "PayPal response fail !!!"; } var amount = Converter.ParseToDouble(paymentInfoType.GrossAmount.value); //var currencyCode = paymentInfoType.GrossAmount.currencyID; var payPalEntity = payPal as Payment.Repository.Entity.PayPal; if (amount != payPalEntity.Amount) { return "<b>Not enough money in the account!</b>"; } var entity = new Payment.Repository.Entity.PayPal(); entity.Id = payPalEntity.Id; entity.UpdateTime = DateTime.UtcNow; entity.State = doECResponse.Ack.Value.ToString().ToLower(); entity.InternalPaymentId = payPalEntity.InternalPaymentId; entity.PayerId = payerId; entity.UserId = payPalEntity.UserId; entity.Amount = payPalEntity.Amount; entity.Fee = Converter.ParseToDouble(paymentInfoType.FeeAmount.value); entity.CurrencyCode = payPalEntity.CurrencyCode; Payment.Repository.Entity.PayPal paypalEntity = repository.GetPayPalBy(entity.InternalPaymentId); bool needToDeposit = false; needToDeposit = paypalEntity.State.Equals("pending", StringComparison.<API key>) && isPaid; // this.PayPalRepository["UpdatePayPal"].Invoke(dto); repository.UpdatePayPal(entity); if (needToDeposit) { Deposit(entity, repository); } return payPalStatus.ToString().ToLower(); } private static void Deposit(Payment.Repository.Entity.PayPal entity, PaymentRepository repository) { if (!entity.CurrencyCode.Equals("USD", StringComparison.<API key>)) { throw new <API key>(string.Format("Unable to deposit. Unconfigured currency {0}.", entity.CurrencyCode)); } var account = repository.GetAccountBy(entity.UserId); double amount = entity.Amount - entity.Fee; if(account == null) { account = new Account(); account.Id = Guid.NewGuid().ToString(); account.UserId = entity.UserId; account.GldAmount = 0; account.UsdAmount = 0; repository.CreateAccount(account); } if (account.UsdAmount != 0) { account.UsdAmount = account.UsdAmount + amount; } else { account.UsdAmount = amount; } account.GldAmount = new <API key>().ConvertFromUsdToGld(account.UsdAmount); repository.UpdateAccount(account); //var accountEntity = new Account(); //if (account == null) // accountEntity.Id = Guid.NewGuid().ToString(); // accountEntity.UserId = entity.UserId; // accountEntity.GldAmount = 0; // accountEntity.UsdAmount = 0; // repository.CreateAccount(accountEntity); //else // accountEntity.Id = account.Id; // accountEntity.GldAmount = account.GldAmount; //if (account.UsdAmount != 0) // accountEntity.UsdAmount = account.UsdAmount + entity.Amount; //else // accountEntity.UsdAmount = entity.Amount; // accountEntity.UserId = entity.UserId; var <API key> = new PaymentHistory(); <API key>.Id = Guid.NewGuid().ToString(); <API key>.PaymentType = ((int)PaymentType.PayPal).ToString(); <API key>.PaymentMethod = ((int)PaymentMethod.Credit).ToString(); <API key>.Date = DateTime.UtcNow; // double amount = entity.Amount - entity.Fee; //accountEntity.GldAmount = accountEntity.GldAmount + <API key>.ConvertFromUsdToGld(entity.Amount); <API key>.Amount = amount; <API key>.Currency = "USD"; <API key>.TransactionStatus = entity.State; //<API key>.ReceivedEmail //UpdateAccount(accountEntity.UsdAmount, account.UserId); <API key>.AccountId = account.Id; <API key>.UserId = entity.UserId; repository.<API key>(<API key>); } public static IList<PaymentHistory> <API key>(string userId) { return new PaymentRepository().GetPaymentHistoryBy(userId); } public static void PayPalWithdraw(Payment.Repository.Entity.PayPal entity, string emailTo) { var repository = new PaymentRepository(); double curAmount = entity.Amount; var account = repository.GetAccountBy(entity.UserId); account.UsdAmount = account.UsdAmount - curAmount; //account.UsdAmount repository.UpdateAccount(account); var paymenthistory = new PaymentHistory(); paymenthistory.Id = Guid.NewGuid().ToString(); paymenthistory.UserId = entity.UserId; paymenthistory.Amount = curAmount; paymenthistory.Date = DateTime.UtcNow; paymenthistory.Currency = "USD"; paymenthistory.AccountId = account.Id; paymenthistory.PaymentMethod = entity.PaymentMethod; paymenthistory.PaymentType = ((int)PaymentType.Transfer).ToString(); paymenthistory.TransactionType = "Sent"; paymenthistory.TransactionStatus = "Pending"; paymenthistory.ReceivedEmail = emailTo; repository.<API key>(paymenthistory); } public static double <API key>(string userId) { var repository = new PaymentRepository(); return repository.<API key>(userId); } public static double <API key>(string userId) { var repository = new PaymentRepository(); return repository.<API key>(userId); } public static AccountBalanceModel GetLastTransaction(string userId) { var repository = new PaymentRepository(); var tModel = repository.GetLastTransaction(userId); var accountBalanceModel = new AccountBalanceModel(); accountBalanceModel.Usd = tModel.Amount; accountBalanceModel.Gs = (Int64) new <API key>().ConvertFromUsdToGld(tModel.Amount); return accountBalanceModel; } } }
<HTML xmlns="http: <HEAD> {# Start off with the script imports... #} <script type="text/javascript" src="static/jquery-easyui/jquery.min.js"></script> <script type="text/javascript" src="static/jquery-easyui/jquery.easyui.min.js"></script> {# And our own scripts... #} <script type="text/javascript" src="static/browser.js"></script> {# And the stylesheet.. #} <link rel="stylesheet" type="text/css" href="static/jquery-easyui/themes/gray/easyui.css"> </HEAD> <BODY> {# BEGIN LAYOUT ELEMENT #} <div class="easyui-layout" style="width: 100%;height: 100%"> <div id="querybox" class="easyui-panel" data-options="title:'Query Box',region:'north'"> Test </div> <!-- First, let's start off with the file browser window. --> <div id="course-list" data-options="split:true,region:'west',title:'Elements'" style="width:20%"> <ul class="easyui-datalist" data-options="onSelect:function(index, data){browseTo(index, data)}" lines="true" style="width:100%"> {% for filename in filelist %} <li value="{{ filename }}" id="{{ filename }}">{{ filename }}</li> {% endfor %} </ul> </div> <div id="editor-panel" class="easyui-panel" data-options="region:'center',split:'true',title:'Editor'" style="width:80%"> <div style="font-size:large;margin:20px"> <P>Nothing currently selected.</P> <P>To select an element to edit, please click on it in the left-hand menu.</P> </div> </div> </div> {# END LAYOUT ELEMENT #} </BODY> </HTML>
#!/usr/bin/env bash ## Evaluate some Erlang code against the running node set -e release_ctl eval "$@"
<?php namespace ModernPdf\Builder\StreamWriter; use \ModernPdf\Component\ObjectType; class State { protected $stream; public function __construct(&$stream) { $this->stream = $stream; } /** * Saves the current graphic state. */ public function saveGraphicState() { $this->stream->push('q'); return $this; } public function restoreGraphicState() { $this->stream->push('Q'); return $this; } /** * Sets the line width. * * @param integer $points The line width in points. */ public function setLineWidth($points) { $this->stream->push($points.' w'); return $this; } /** * Sets the gray color used for stroke. * * @param integer $scolor The gray color between 0. and 1. */ public function setGrayStrokeColor($color) { $this->stream->push($color . ' g'); return $this; } /** * Sets the gray color used for fill. * * @param integer $scolor The gray color between 0. and 1. */ public function setGrayFillColor($color) { $this->stream->push($color . ' G'); return $this; } /** * Sets the RGB color used for stroke. * * @param integer $r The red color between 0. and 1. * @param integer $g The green color between 0. and 1. * @param integer $b The blue color between 0. and 1. */ public function setRgbStrokeColor($r, $g, $b) { $this->stream->push($r . ' ' . $g . ' ' . $b . ' rg'); return $this; } /** * Sets the RGB color used for fill. * * @param integer $r The red color between 0. and 1. * @param integer $g The green color between 0. and 1. * @param integer $b The blue color between 0. and 1. */ public function setRgbFillColor($r, $g, $b) { $this->stream->push($r . ' ' . $g . ' ' . $b . ' RG'); return $this; } /** * Concatenate a translation matrix to the current translation matrix. * * @param integer $x The x axis translation. * @param integer $y The y axis translation. */ public function addTranslation($x, $y) { $this->stream->push('1 0 0 1 ' . $x . ' ' . $y . ' cm'); return $this; } /** * Concatenate a scaling matrix to the current transformation matrix. * * @param integer $sx The x axis scaling. * @param integer $sy The y axis scaling. */ public function addScaling($sx, $sy) { $this->stream->push($sx . ' 0 0 ' . $sy . ' 0 0 cm'); return $this; } /** * Concatenate a rotation matrix to the current transformation matrix. * * @param integer $x The rotation in counterclockwise radians. */ public function addRotation($x) { $cos = round(cos($x)*100)/100; $sin = round(sin($x)*100)/100; $this->stream->push($cos . ' ' . $sin . ' ' . -$sin . ' ' . $cos . ' 0 0 cm'); return $this; } /** * The line cap for the ends of any lines to be stroked. Possible values are: * * 0 : Butt. The stroke is square at the end of the path and does not project * beyond the end of the path. * * 1 : Round. A semicircle is added at the end of the path projecting beyond * the endpoints. * * 2 : Projecting Square. The stroke is square but projects a distance of * half the line width beyond the ends of the path. */ public function setLineCap($cap) { $this->stream->push($cap.' J'); return $this; } /** * The line join for the shape of joints between connected segments of a path. * Possible values are: * * 0 : Miter. The outer edges for the two segments are extended until they meet. * This is the same way that wooden segments are joined to make a picture * frame. If the segments meet at an overly steep angle a bevel join is used * instead. The precise cut-off point is called the Miter Limit (see below). * * 1 : Round. A pie slice is added to the junction of the two segments to * produce a rounded corner. * * 2 : Bevel. The two segments are finished with butt caps and any notch between * the two is filled in. */ public function setLineJoin($join) { $this->stream->push($join.' j'); return $this; } /** * The maximum length of mitered line joins for paths. * * The miter limit is expressed in terms of the ratio of the thickness of * the line to the thickness of the join. * * For example a value of 1.5 will allow the width of the line at the join * to be up to one and a half times the thickness of the width of an * individual line segment. * * @param integer $limit The miter limit. */ public function setMiterLimit($limit) { $this->stream->push($limit.' M'); return $this; } /** * Sets the dashing pattern for the line. * * [] 0 is a continuous line. * [10 10] 0 is a 10 points line then 10 points space dashing pattern. * * @param Model\Type\PdfArray $pattern The dashing pattern. * @param integer $offset The initial offset in the pattern. */ public function setLineDash(ObjectType\PdfArray $pattern, $offset) { $this->stream->push($pattern . ' ' . $offset . ' d'); return $this; } }
import { createCanvas } from "../sys/canvas"; import { createImage } from "../sys/image"; /** * Base class for all images. */ export abstract class BaseImage { /** The image width in pixels. */ protected width: number; /** The image height in pixels. */ protected height: number; /** * Creates a new image with the given size. * * @param width The image width in pixels. * @param height The image height in pixels. */ protected constructor(width: number, height: number) { this.width = width; this.height = height; } /** * Returns the image width in pixels. * * @return The image width in pixels. */ public getWidth(): number { return this.width; } /** * Returns the image height in pixels. * * @return The image height in pixels. */ public getHeight(): number { return this.height; } /** * Returns the RGBA color at the specified position. * * @param x The horizontal pixel position. * @param y The vertical pixel position. * @return The RGBA color at the specified position. */ public abstract getColor(x: number, y: number): number; /** * Draws the image onto the given rendering context. * * @param ctx The rendering context to draw the image to. * @param x Optional horizontal target position. Defaults to 0. * @param y Optional vertical target position. Defaults to 0. */ public draw(ctx: <API key>, x: number = 0, y: number = 0): void { const width = this.width; const height = this.height; const imageData = ctx.createImageData(width, height); const pixels = imageData.data; let rgbaIndex = 0; for (let y = 0; y < height; ++y) { for (let x = 0; x < width; ++x) { const color = this.getColor(x, y); pixels[rgbaIndex++] = (color >> 24) & 0xff; pixels[rgbaIndex++] = (color >> 16) & 0xff; pixels[rgbaIndex++] = (color >> 8) & 0xff; pixels[rgbaIndex++] = color & 0xff; } } ctx.putImageData(imageData, x, y); } /** * Creates and returns a new canvas containing the image. * * @return The created canvas. */ public toCanvas(): HTMLCanvasElement { const canvas = createCanvas(this.width, this.height); const ctx = canvas.getContext("2d"); if (ctx == null) { throw new Error("Unable to create 2D rendering context"); } this.draw(ctx); return canvas; } /** * Creates and returns an image data URL. * * @param type - Optional image mime type. Defaults to image/png. * @param quality - Optional quality parameter for encoder. For image/jpeg this is the image quality between 0 and * 1 with a default value of 0.92. * @return The created data URL. */ public toDataUrl(type?: string, quality?: unknown): string { const canvas = this.toCanvas(); return canvas.toDataURL(type, quality); } /** * Creates and returns a HTML image. * * @param type - Optional image mime type. Defaults to image/png. * @param quality - Optional quality parameter for encoder. For image/jpeg this is the image quality between 0 and * 1 with a default value of 0.92. * @return The created HTML image. */ public toImage(type?: string, quality?: unknown): HTMLImageElement { const image = createImage(); image.src = this.toDataUrl(type, quality); return image; } }
# Process the attendance data by adding fields for day of week and school year and reoder the fields # so that they match the enrollment file: date, lasid, status (ABS), day, school year # also, clean the bad data. Many absence records are on days not in the calendar. Check the date # of the absence against the calendar and delete bad records # Input files: Attendance.csv - pulled from X2 (attendance records) # NewCalendar.csv - pulled from X2, must be updated annually to get previous year and current year # Output File: ProcessedAttend.csv import csv, time from datetime import datetime # convert X2 date format to Python format mm/dd/yyyy def date_func(date): return date.split("/")[0].zfill(2)+"/"+date.split("/")[1].zfill(2)+"/"+date.split("/")[2] def schoolyear(date): if int(date.split("/")[0]) <8 : return date.split("/")[2] else: return str(int(date.split("/")[2])+1) def calday(date): cal_date = datetime.strptime(date_func(date),'%m/%d/%Y') return cal_date.strftime("%a") AttFile = "C:\Users\Elaine\Documents\BKL\Lowell\\2016-2017\Attendance.csv" OutFile = "C:\Users\Elaine\Documents\BKL\Lowell\\2016-2017\TableauFormat\ProcessedAttend.csv" CalendFile ="C:\Users\Elaine\Documents\BKL\Lowell\\2016-2017\NewCalendar.csv" csvfile=open(AttFile,'rb') reader=csv.reader(csvfile) Ccsvfile = open(CalendFile,'rb') Creader = csv.reader(Ccsvfile) with open(OutFile,'a+b') as csvout: wr=csv.writer(csvout,delimiter=',') wr.writerow(['Date','Lasid','Status','Day','SchoolYear','Term']) # skip all the headers next(reader) for row in reader: output = [row[0],row[1],'ABS',calday(row[0]), schoolyear(row[0])] for crow in Creader: if crow[0] == date_func(row[0]) : output.append(crow[2]) if crow[1]=='TRUE': wr.writerow(output) break Ccsvfile.seek(0) csvout.close() csvfile.close()
from os import environ class BaseConfig: # flask options DEBUG = False ENV = '' JSON_AS_ASCII = False JSON_SORT_KEYS = True TESTING = False SECRET_KEY = '' # JWT options <API key> = True JWT_SECRET_KEY = '' <API key> = ['identity'] <API key> = False <API key> = False # database configs DATABASE = {} def __str__(self): return 'app.config.{0}'.format(type(self).__name__) class ProductionConfig(BaseConfig): ENV = 'production' JWT_SECRET_KEY = '' class StagingConfig(BaseConfig): ENV = 'production' JWT_SECRET_KEY = '' class TestConfig(BaseConfig): ENV = 'test' TESTING = True TEST_ROOT_DIR = './app/tests' DATABASE = { 'host': 'localhost', 'dbname': 'siphon_test', 'user': 'kenta', 'password': 'kenta' } <API key> = False JWT_SECRET_KEY = 'testing' class DevelopmentConfig(BaseConfig): DEBUG = True ENV = 'development' DATABASE = { 'host': 'localhost', 'dbname': 'siphon_dev', 'user': 'kenta', 'password': 'kenta' } <API key> = True JWT_SECRET_KEY = 'development' def get_config(): configs = { 'production': ProductionConfig(), 'test': TestConfig(), 'development': DevelopmentConfig()} app_env = environ.get('APP_TYPE') if app_env not in configs: raise RuntimeError() return configs[app_env]
package com.pholser.util.properties.it.boundtypes; import com.pholser.util.properties.BoundProperty; public interface <API key> { @BoundProperty("generic.array.type.class") <T> Class<T[]> <API key>(); }
local Timer, Label = Component.load({"Timer", "Label"}) function createInvunerable(parent) local entity = Entity(parent) entity:add(Timer(1)) entity:add(Label("Invunerable")) return entity end
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Mono.Cecil.Cil; using Mono.Cecil; namespace Teh.Decompiler.Builders.Matchers { public class CallMatcher : Matcher { public override void Build(CodeWriter writer, MatcherData data) { Instruction call = data.Code.Dequeue(); MethodReference reference = call.Operand as MethodReference; // Get passed parameters string[] args = new string[reference.Parameters.Count]; for (int i = 0; i < reference.Parameters.Count; i++) { args[i] = data.Stack.Pop(); } // TODO: Come up with a better naming scheme string built = $"{data.Namer.GetName(reference.DeclaringType)}.{reference.Name}({string.Join(", ", args)})"; if (reference.ReturnType.FullName == "System.Void") { writer.WriteLine($"{built};"); } else { data.Stack.Push(built); } } public override bool Matches(MatcherData data) { return data.Code.Peek().OpCode == OpCodes.Call; } } }
'use strict'; import 'vs/css!./media/shell'; import * as nls from 'vs/nls'; import {TPromise} from 'vs/base/common/winjs.base'; import * as platform from 'vs/base/common/platform'; import {Dimension, Builder, $} from 'vs/base/browser/builder'; import dom = require('vs/base/browser/dom'); import aria = require('vs/base/browser/ui/aria/aria'); import {dispose, IDisposable, Disposables} from 'vs/base/common/lifecycle'; import errors = require('vs/base/common/errors'); import product from 'vs/platform/product'; import pkg from 'vs/platform/package'; import {ContextViewService} from 'vs/platform/contextview/browser/contextViewService'; import timer = require('vs/base/common/timer'); import {Workbench} from 'vs/workbench/electron-browser/workbench'; import {Storage, <API key>} from 'vs/workbench/common/storage'; import {ITelemetryService, <API key>} from 'vs/platform/telemetry/common/telemetry'; import {<API key>, <API key>} from 'vs/platform/telemetry/common/telemetryIpc'; import {TelemetryService, <API key>} from 'vs/platform/telemetry/common/telemetryService'; import {IdleMonitor, UserStatus} from 'vs/platform/telemetry/browser/idleMonitor'; import ErrorTelemetry from 'vs/platform/telemetry/browser/errorTelemetry'; import {<API key>} from 'vs/platform/telemetry/node/<API key>'; import {ElectronIntegration} from 'vs/workbench/electron-browser/integration'; import {Update} from 'vs/workbench/electron-browser/update'; import {WorkspaceStats} from 'vs/workbench/services/telemetry/common/workspaceStats'; import {IWindowService, WindowService} from 'vs/workbench/services/window/electron-browser/windowService'; import {MessageService} from 'vs/workbench/services/message/electron-browser/messageService'; import {IRequestService} from 'vs/platform/request/common/request'; import {RequestService} from 'vs/platform/request/node/requestService'; import {<API key>} from 'vs/platform/configuration/common/configuration'; import {FileService} from 'vs/workbench/services/files/electron-browser/fileService'; import {SearchService} from 'vs/workbench/services/search/node/searchService'; import {LifecycleService} from 'vs/workbench/services/lifecycle/electron-browser/lifecycleService'; import {MainThreadService} from 'vs/workbench/services/thread/electron-browser/threadService'; import {MarkerService} from 'vs/platform/markers/common/markerService'; import {IModelService} from 'vs/editor/common/services/modelService'; import {ModelServiceImpl} from 'vs/editor/common/services/modelServiceImpl'; import {<API key>} from 'vs/editor/common/services/compatWorkerService'; import {<API key>} from 'vs/editor/common/services/<API key>'; import {<API key>} from 'vs/editor/browser/services/<API key>'; import {ICodeEditorService} from 'vs/editor/common/services/codeEditorService'; import {<API key>} from 'vs/editor/common/services/<API key>'; import {<API key>} from 'vs/editor/common/services/editorWorkerService'; import {<API key>} from 'vs/workbench/api/node/<API key>'; import {IOptions} from 'vs/workbench/common/options'; import {IStorageService} from 'vs/platform/storage/common/storage'; import {ServiceCollection} from 'vs/platform/instantiation/common/serviceCollection'; import {<API key>} from 'vs/platform/instantiation/common/<API key>'; import {IContextViewService} from 'vs/platform/contextview/browser/contextView'; import {IEventService} from 'vs/platform/event/common/event'; import {IFileService} from 'vs/platform/files/common/files'; import {ILifecycleService} from 'vs/platform/lifecycle/common/lifecycle'; import {IMarkerService} from 'vs/platform/markers/common/markers'; import {IEnvironmentService} from 'vs/platform/environment/common/environment'; import {IMessageService, Severity} from 'vs/platform/message/common/message'; import {ISearchService} from 'vs/platform/search/common/search'; import {IThreadService} from 'vs/workbench/services/thread/common/threadService'; import {ICommandService} from 'vs/platform/commands/common/commands'; import {CommandService} from 'vs/platform/commands/common/commandService'; import {<API key>, IWorkspace} from 'vs/platform/workspace/common/workspace'; import {IExtensionService} from 'vs/platform/extensions/common/extensions'; import {<API key>} from 'vs/editor/common/services/modeServiceImpl'; import {IModeService} from 'vs/editor/common/services/modeService'; import {<API key>, <API key>} from 'vs/workbench/services/untitled/common/<API key>'; import {CrashReporter} from 'vs/workbench/electron-browser/crashReporter'; import {IThemeService} from 'vs/workbench/services/themes/common/themeService'; import {ThemeService} from 'vs/workbench/services/themes/electron-browser/themeService'; import {getDelayedChannel} from 'vs/base/parts/ipc/common/ipc'; import {connect as connectNet} from 'vs/base/parts/ipc/node/ipc.net'; import {Client as ElectronIPCClient} from 'vs/base/parts/ipc/common/ipc.electron'; import {ipcRenderer} from 'electron'; import {<API key>, <API key>} from 'vs/platform/extensionManagement/common/<API key>'; import {<API key>} from 'vs/platform/extensionManagement/common/extensionManagement'; import {URLChannelClient} from 'vs/platform/url/common/urlIpc'; import {IURLService} from 'vs/platform/url/common/url'; import {ReloadWindowAction} from 'vs/workbench/electron-browser/actions'; // self registering services import 'vs/platform/opener/browser/opener.contribution'; /** * Services that we require for the Shell */ export interface ICoreServices { contextService: <API key>; eventService: IEventService; <API key>: <API key>; environmentService: IEnvironmentService; } /** * The workbench shell contains the workbench with a rich header containing navigation and the activity bar. * With the Shell being the top level element in the page, it is also responsible for driving the layouting. */ export class WorkbenchShell { private storageService: IStorageService; private messageService: MessageService; private eventService: IEventService; private environmentService:IEnvironmentService; private contextViewService: ContextViewService; private windowService: IWindowService; private threadService: MainThreadService; private <API key>: <API key>; private themeService: ThemeService; private contextService: <API key>; private telemetryService: ITelemetryService; private container: HTMLElement; private toUnbind: IDisposable[]; private previousErrorValue: string; private previousErrorTime: number; private content: HTMLElement; private contentsContainer: Builder; private workspace: IWorkspace; private options: IOptions; private workbench: Workbench; constructor(container: HTMLElement, workspace: IWorkspace, services: ICoreServices, options: IOptions) { this.container = container; this.workspace = workspace; this.options = options; this.contextService = services.contextService; this.eventService = services.eventService; this.<API key> = services.<API key>; this.environmentService = services.environmentService; this.toUnbind = []; this.previousErrorTime = 0; } private createContents(parent: Builder): Builder { // ARIA aria.setARIAContainer(document.body); // Workbench Container const workbenchContainer = $(parent).div(); // Instantiation service with services const [<API key>, serviceCollection] = this.<API key>(); //crash reporting if (!!product.crashReporter) { const crashReporter = <API key>.createInstance(CrashReporter, pkg.version, product.commit); crashReporter.start(product.crashReporter); } // Workbench this.workbench = <API key>.createInstance(Workbench, workbenchContainer.getHTMLElement(), this.workspace, this.options, serviceCollection); this.workbench.startup({ onWorkbenchStarted: (<API key>) => { this.onWorkbenchStarted(<API key>); } }); // Electron integration this.workbench.<API key>().createInstance(ElectronIntegration).integrate(this.container); // Update this.workbench.<API key>().createInstance(Update); // Handle case where workbench is not starting up properly const timeoutHandle = setTimeout(() => { console.warn('Workbench did not finish loading in 10 seconds, that might be a problem that should be reported.'); }, 10000); this.workbench.joinCreation().then(() => { clearTimeout(timeoutHandle); }); return workbenchContainer; } private onWorkbenchStarted(<API key>: number): void { // Log to telemetry service const windowSize = { innerHeight: window.innerHeight, innerWidth: window.innerWidth, outerHeight: window.outerHeight, outerWidth: window.outerWidth }; this.telemetryService.publicLog('workspaceLoad', { userAgent: navigator.userAgent, windowSize: windowSize, emptyWorkbench: !this.contextService.getWorkspace(), <API key>, theme: this.themeService.getColorTheme(), language: platform.language }); const workspaceStats: WorkspaceStats = <WorkspaceStats>this.workbench.<API key>().createInstance(WorkspaceStats); workspaceStats.reportWorkspaceTags(); if ((platform.isLinux || platform.isMacintosh) && process.getuid() === 0) { this.messageService.show(Severity.Warning, nls.localize('runningAsRoot', "It is recommended not to run Code as 'root'.")); } } private <API key>(): [<API key>, ServiceCollection] { const disposables = new Disposables(); const sharedProcess = connectNet(process.env['<API key>']); sharedProcess.done(service => { service.onClose(() => { this.messageService.show(Severity.Error, { message: nls.localize('<API key>', "The shared process terminated unexpectedly. Please reload the window to recover."), actions: [<API key>.createInstance(ReloadWindowAction, ReloadWindowAction.ID, ReloadWindowAction.LABEL)] }); }); }, errors.onUnexpectedError); const mainProcessClient = new ElectronIPCClient(ipcRenderer); disposables.add(mainProcessClient); const serviceCollection = new ServiceCollection(); serviceCollection.set(IEventService, this.eventService); serviceCollection.set(<API key>, this.contextService); serviceCollection.set(<API key>, this.<API key>); serviceCollection.set(IEnvironmentService, this.environmentService); const <API key> = new <API key>(serviceCollection, true); this.windowService = <API key>.createInstance(WindowService); serviceCollection.set(IWindowService, this.windowService); // Storage const <API key> = this.environmentService.extensionTestsPath || (!this.workspace && !this.environmentService.<API key>); // without workspace or in any extension test, we use inMemory storage unless we develop an extension where we want to preserve state this.storageService = <API key>.createInstance(Storage, window.localStorage, <API key> ? <API key> : window.localStorage); serviceCollection.set(IStorageService, this.storageService); // Telemetry if (this.environmentService.isBuilt && !this.environmentService.<API key> && !!product.enableTelemetry) { const channel = getDelayedChannel<<API key>>(sharedProcess.then(c => c.getChannel('telemetryAppender'))); const commit = product.commit; const version = pkg.version; const config: <API key> = { appender: new <API key>(channel), commonProperties: <API key>(this.storageService, commit, version), piiPaths: [this.environmentService.appRoot, this.environmentService.extensionsPath] }; const telemetryService = <API key>.createInstance(TelemetryService, config); this.telemetryService = telemetryService; const errorTelemetry = new ErrorTelemetry(telemetryService); const idleMonitor = new IdleMonitor(2 * 60 * 1000); // 2 minutes const listener = idleMonitor.onStatusChange(status => this.telemetryService.publicLog(status === UserStatus.Active ? TelemetryService.<API key> : TelemetryService.<API key> )); disposables.add(telemetryService, errorTelemetry, listener, idleMonitor); } else { this.telemetryService = <API key>; } serviceCollection.set(ITelemetryService, this.telemetryService); this.messageService = <API key>.createInstance(MessageService); serviceCollection.set(IMessageService, this.messageService); const fileService = disposables.add(<API key>.createInstance(FileService)); serviceCollection.set(IFileService, fileService); const lifecycleService = <API key>.createInstance(LifecycleService); this.toUnbind.push(lifecycleService.onShutdown(() => disposables.dispose())); serviceCollection.set(ILifecycleService, lifecycleService); this.threadService = <API key>.createInstance(MainThreadService); serviceCollection.set(IThreadService, this.threadService); const extensionService = <API key>.createInstance(<API key>); serviceCollection.set(IExtensionService, extensionService); serviceCollection.set(ICommandService, new CommandService(<API key>, extensionService)); this.contextViewService = <API key>.createInstance(ContextViewService, this.container); serviceCollection.set(IContextViewService, this.contextViewService); const requestService = <API key>.createInstance(RequestService); serviceCollection.set(IRequestService, requestService); const markerService = <API key>.createInstance(MarkerService); serviceCollection.set(IMarkerService, markerService); const modeService = <API key>.createInstance(<API key>); serviceCollection.set(IModeService, modeService); const modelService = <API key>.createInstance(ModelServiceImpl); serviceCollection.set(IModelService, modelService); const compatWorkerService = <API key>.createInstance(<API key>); serviceCollection.set(<API key>, compatWorkerService); const editorWorkerService = <API key>.createInstance(<API key>); serviceCollection.set(<API key>, editorWorkerService); const <API key> = <API key>.createInstance(<API key>); serviceCollection.set(<API key>, <API key>); this.themeService = <API key>.createInstance(ThemeService); serviceCollection.set(IThemeService, this.themeService); const searchService = <API key>.createInstance(SearchService); serviceCollection.set(ISearchService, searchService); const codeEditorService = <API key>.createInstance(<API key>); serviceCollection.set(ICodeEditorService, codeEditorService); const <API key> = getDelayedChannel<<API key>>(sharedProcess.then(c => c.getChannel('extensions'))); const <API key> = new <API key>(<API key>); serviceCollection.set(<API key>, <API key>); const urlChannel = mainProcessClient.getChannel('url'); const urlChannelClient = new URLChannelClient(urlChannel, this.windowService.getWindowId()); serviceCollection.set(IURLService, urlChannelClient); return [<API key>, serviceCollection]; } public open(): void { // Listen on unexpected errors errors.<API key>((error: any) => { this.onUnexpectedError(error); }); // Shell Class for CSS Scoping $(this.container).addClass('monaco-shell'); // Controls this.content = $('.<API key>').appendTo(this.container).getHTMLElement(); // Handle Load Performance Timers this.writeTimers(); // Create Contents this.contentsContainer = this.createContents($(this.content)); // Layout this.layout(); // Listeners this.registerListeners(); // Enable theme support this.themeService.initialize(this.container).then(null, error => { errors.onUnexpectedError(error); }); } private registerListeners(): void { // Resize $(window).on(dom.EventType.RESIZE, () => this.layout(), this.toUnbind); } private writeTimers(): void { const timers = (<any>window).MonacoEnvironment.timers; if (timers) { const events: timer.IExistingTimerEvent[] = []; // Window if (timers.vscodeStart) { events.push({ startTime: timers.vscodeStart, stopTime: timers.beforeLoad, topic: 'Startup', name: 'VSCode Startup', description: 'Time it takes to create a window and startup VSCode' }); } // Load events.push({ startTime: timers.beforeLoad, stopTime: timers.afterLoad, topic: 'Startup', name: 'Load Modules', description: 'Time it takes to load VSCodes main modules' }); // Ready events.push({ startTime: timers.beforeReady, stopTime: timers.afterReady, topic: 'Startup', name: 'Event DOMContentLoaded', description: 'Time it takes for the DOM to emit DOMContentLoaded event' }); // Write to Timer timer.getTimeKeeper().<API key>(events, timers.start); } } public onUnexpectedError(error: any): void { const errorMsg = errors.toErrorMessage(error, true); if (!errorMsg) { return; } const now = Date.now(); if (errorMsg === this.previousErrorValue && now - this.previousErrorTime <= 1000) { return; // Return if error message identical to previous and shorter than 1 second } this.previousErrorTime = now; this.previousErrorValue = errorMsg; // Log to console console.error(errorMsg); // Show to user if friendly message provided if (error && error.friendlyMessage && this.messageService) { this.messageService.show(Severity.Error, error.friendlyMessage); } } public layout(): void { const clArea = $(this.container).getClientArea(); const contentsSize = new Dimension(clArea.width, clArea.height); this.contentsContainer.size(contentsSize.width, contentsSize.height); this.contextViewService.layout(); this.workbench.layout(); } public joinCreation(): TPromise<boolean> { return this.workbench.joinCreation(); } public dispose(): void { // Workbench if (this.workbench) { this.workbench.dispose(); } this.contextViewService.dispose(); // Listeners this.toUnbind = dispose(this.toUnbind); // Container $(this.container).empty(); } }
package br.senac.tads4.playgroundweb; import java.io.Serializable; import java.math.BigDecimal; import java.util.List; /** * * @author Fernando */ public class Produto implements Serializable { private long id = 0; private String nome; private String descricao; private BigDecimal preco; private List<Categoria> categorias; public Produto() { } public Produto(String nome, String descricao, BigDecimal preco) { this.nome = nome; this.descricao = descricao; this.preco = preco; } public Produto(long id, String nome, String descricao, BigDecimal preco) { this(nome, descricao, preco); this.id = id; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public String getDescricao() { return descricao; } public void setDescricao(String descricao) { this.descricao = descricao; } public BigDecimal getPreco() { return preco; } public void setPreco(BigDecimal preco) { this.preco = preco; } public List<Categoria> getCategorias() { return categorias; } public void setCategorias(List<Categoria> categorias) { this.categorias = categorias; } }
layout: e17page title: RL Circuits date: 2017-06-24 description: Transient response of RL circuits section: EL # RL circuit, Transient response ___ - A voltage step is applied to a series RL circuit and the voltage across the inductor is recorded. ## Schematic ___ ![](images/schematics/RLcircuit.svg){: width="700px"} ## The following constant voltage charging/discharging transitions can be recorded with the above schematic + 0 - 5V step : OD1 is first set to to 0V . After a stabilisation delay of 0.5 seconds, it is set to 5V , and the transient behaviour is recorded + 5V - 0V step : OD1 is first set to to 5V . After a stabilisation delay of 0.5 seconds, it is set to 0V , and the transient behaviour is recorded ![](images/screenshots/RLcircuit.png){: width="700px"} ## Analysis ___ - Drag the blue region using its handles on either side, and click on the 'Calculate RL' button . - The RL time constant of the last obtained data is calculated , and a new plot is overlaid on the original dataset ## Photograph of the setup ___ ![](images/photographs/RLcircuit.jpg){: width="700px"}
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>constructors: Not compatible </title> <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" /> <link href="../../../../../bootstrap.min.css" rel="stylesheet"> <link href="../../../../../bootstrap-custom.css" rel="stylesheet"> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <script src="../../../../../moment.min.js"></script> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file: <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif] </head> <body> <div class="container"> <div class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="../..">clean / released</a></li> <li class="active"><a href="">8.7.0 / constructors - 1.0.0</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> constructors <small> 1.0.0 <span class="label label-info">Not compatible </span> </small> </h1> <p> <em><script>document.write(moment("2022-01-26 20:55:43 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-01-26 20:55:43 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-num base Num library distributed with the OCaml compiler base-threads base base-unix base camlp5 7.14 <API key> of OCaml conf-findutils 1 Virtual package relying on findutils conf-perl 2 Virtual package relying on perl coq 8.7.0 Formal proof management system num 0 The Num library for arbitrary-precision integer and rational arithmetic ocaml 4.05.0 The OCaml compiler (virtual package) ocaml-base-compiler 4.05.0 Official 4.05.0 release ocaml-config 1 OCaml Switch Configuration ocamlfind 1.9.2 A library manager for OCaml # opam file: opam-version: &quot;2.0&quot; maintainer: &quot;mattam@mattam.org&quot; homepage: &quot;https://github.com/mattam82/Constructors&quot; bug-reports: &quot;https://github.com/mattam82/Constructors/issues&quot; license: &quot;MIT&quot; dev-repo: &quot;git+https://github.com/mattam82/Constructors.git#v8.4&quot; build: [ [&quot;coq_makefile&quot; &quot;-f&quot; &quot;Make&quot; &quot;-o&quot; &quot;Makefile&quot;] [make &quot;-j%{jobs}%&quot;] ] install: [ [make &quot;install&quot;] ] remove: [&quot;rm&quot; &quot;-R&quot; &quot;%{lib}%/coq/user-contrib/Constructors&quot;] depends: [ &quot;ocaml&quot; &quot;coq&quot; {&gt;= &quot;8.4.5&quot; &amp; &lt; &quot;8.5~&quot;} ] synopsis: &quot;An example Coq plugin, defining a tactic to get the constructors of an inductive type in a list&quot; authors: &quot;Matthieu Sozeau &lt;mattam@mattam.org&gt;&quot; flags: light-uninstall url { src: &quot;https://github.com/mattam82/Constructors/archive/1.0.0.tar.gz&quot; checksum: &quot;md5=<API key>&quot; } </pre> <h2>Lint</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Dry install </h2> <p>Dry install with the current Coq version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam install -y --show-action coq-constructors.1.0.0 coq.8.7.0</code></dd> <dt>Return code</dt> <dd>5120</dd> <dt>Output</dt> <dd><pre>[NOTE] Package coq is already installed (current version is 8.7.0). The following dependencies couldn&#39;t be met: - coq-constructors -&gt; coq &lt; 8.5~ -&gt; ocaml &lt; 4.03.0 base of this switch (use `--unlock-base&#39; to force) No solution found, exiting </pre></dd> </dl> <p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-constructors.1.0.0</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Install dependencies</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Install </h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Installation size</h2> <p>No files were installed.</p> <h2>Uninstall 🧹</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Missing removes</dt> <dd> none </dd> <dt>Wrong removes</dt> <dd> none </dd> </dl> </div> </div> </div> <hr/> <div class="footer"> <p class="text-center"> Sources are on <a href="https: </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>higman-s: Not compatible </title> <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" /> <link href="../../../../../bootstrap.min.css" rel="stylesheet"> <link href="../../../../../bootstrap-custom.css" rel="stylesheet"> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <script src="../../../../../moment.min.js"></script> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file: <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif] </head> <body> <div class="container"> <div class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="../..">clean / released</a></li> <li class="active"><a href="">8.6.1 / higman-s - 8.5.0</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> higman-s <small> 8.5.0 <span class="label label-info">Not compatible </span> </small> </h1> <p> <em><script>document.write(moment("2021-12-14 22:10:28 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2021-12-14 22:10:28 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-num base Num library distributed with the OCaml compiler base-threads base base-unix base camlp5 7.14 <API key> of OCaml conf-findutils 1 Virtual package relying on findutils conf-perl 1 Virtual package relying on perl coq 8.6.1 Formal proof management system num 0 The Num library for arbitrary-precision integer and rational arithmetic ocaml 4.03.0 The OCaml compiler (virtual package) ocaml-base-compiler 4.03.0 Official 4.03.0 release ocaml-config 1 OCaml Switch Configuration ocamlfind 1.9.1 A library manager for OCaml # opam file: opam-version: &quot;2.0&quot; maintainer: &quot;matej.kosik@inria.fr&quot; homepage: &quot;https://github.com/coq-contribs/higman-s&quot; license: &quot;LGPL&quot; build: [make &quot;-j%{jobs}%&quot;] install: [make &quot;install&quot;] remove: [&quot;rm&quot; &quot;-R&quot; &quot;%{lib}%/coq/user-contrib/HigmanS&quot;] depends: [ &quot;ocaml&quot; &quot;coq&quot; {&gt;= &quot;8.5&quot; &amp; &lt; &quot;8.6~&quot;} ] tags: [ &quot;keyword:Higman&#39;s lemma&quot; &quot;keyword:well quasi ordering&quot; &quot;category:Mathematics/Combinatorics and Graph Theory&quot; &quot;date:2007-09-14&quot; ] authors: [ &quot;William Delobel &lt;william.delobel@lif.univ-mrs.fr&gt;&quot; ] bug-reports: &quot;https://github.com/coq-contribs/higman-s/issues&quot; dev-repo: &quot;git+https://github.com/coq-contribs/higman-s.git&quot; synopsis: &quot;Higman&#39;s lemma on an unrestricted alphabet&quot; description: &quot;This proof is more or less the proof given by Monika Seisenberger in \&quot;An Inductive Version of Nash-Williams&#39; <API key> Argument for Higman&#39;s Lemma\&quot;.&quot; flags: light-uninstall url { src: &quot;https://github.com/coq-contribs/higman-s/archive/v8.5.0.tar.gz&quot; checksum: &quot;md5=<API key>&quot; } </pre> <h2>Lint</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Dry install </h2> <p>Dry install with the current Coq version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam install -y --show-action coq-higman-s.8.5.0 coq.8.6.1</code></dd> <dt>Return code</dt> <dd>5120</dd> <dt>Output</dt> <dd><pre>[NOTE] Package coq is already installed (current version is 8.6.1). The following dependencies couldn&#39;t be met: - coq-higman-s -&gt; coq &lt; 8.6~ -&gt; ocaml &lt; 4.03.0 base of this switch (use `--unlock-base&#39; to force) Your request can&#39;t be satisfied: - No available version of coq satisfies the constraints No solution found, exiting </pre></dd> </dl> <p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-higman-s.8.5.0</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Install dependencies</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Install </h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Installation size</h2> <p>No files were installed.</p> <h2>Uninstall 🧹</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Missing removes</dt> <dd> none </dd> <dt>Wrong removes</dt> <dd> none </dd> </dl> </div> </div> </div> <hr/> <div class="footer"> <p class="text-center"> Sources are on <a href="https: </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
class CreateSegments < ActiveRecord::Migration def change create_table :segments do |t| t.string :name t.integer :first_clause t.integer :first_condition t.string :email t.integer :second_clause t.integer :second_condition t.integer :age t.integer :third_clause t.integer :third_condition t.string :province t.integer :fourth_clause t.integer :fourth_condition t.string :role t.integer :fifth_condition t.timestamps end end end
require 'blackjack-service' ENV['RACK_ENV'] = 'test' # This file was generated by the `rspec --init` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. # The generated `.rspec` file contains `--require spec_helper` which will cause # this file to always be loaded, without a need to explicitly require it in any # files. # Given that it is always loaded, you are encouraged to keep this file as # light-weight as possible. Requiring heavyweight dependencies from this file # will add to the boot time of your test suite on EVERY test run, even for an # individual file that may not need all of that loaded. Instead, consider making # a separate helper file that requires the additional dependencies and performs # the additional setup, and require it from the spec files that actually need # The `.rspec` file also contains a few flags that are not defaults but that # users commonly want. RSpec.configure do |config| # rspec-expectations config goes here. You can use an alternate # assertion/expectation library such as wrong or the stdlib/minitest # assertions if you prefer. config.expect_with :rspec do |expectations| # This option will default to `true` in RSpec 4. It makes the `description` # and `failure_message` of custom matchers include text for helper methods # defined using `chain`, e.g.: # be_bigger_than(2).and_smaller_than(4).description # # => "be bigger than 2 and smaller than 4" # ...rather than: # # => "be bigger than 2" expectations.<API key> = true end # rspec-mocks config goes here. You can use an alternate test double # library (such as bogus or mocha) by changing the `mock_with` option here. config.mock_with :rspec do |mocks| # Prevents you from mocking or stubbing a method that does not exist on # a real object. This is generally recommended, and will default to # `true` in RSpec 4. mocks.<API key> = true end # The settings below are suggested to provide a good initial experience # with RSpec, but feel free to customize to your heart's content. =begin # These two settings work together to allow you to limit a spec run # to individual examples or groups you care about by tagging them with # `:focus` metadata. When nothing is tagged with `:focus`, all examples # get run. config.filter_run :focus config.<API key> = true # Allows RSpec to persist some state between runs in order to support # the `--only-failures` and `--next-failure` CLI options. We recommend # you configure your source control system to ignore this file. config.<API key> = "spec/examples.txt" # Limits the available syntax to the non-monkey patched syntax that is # recommended. For more details, see: config.<API key>! # This setting enables warnings. It's recommended, but in some cases may # be too noisy due to issues in dependencies. config.warnings = true # Many RSpec users commonly either run the entire suite or an individual # file, and it's useful to allow more verbose output when running an # individual spec file. if config.files_to_run.one? # Use the documentation formatter for detailed output, # unless a formatter has already been configured # (e.g. via a command-line flag). config.default_formatter = 'doc' end # Print the 10 slowest examples and example groups at the # end of the spec run, to help surface which specs are running # particularly slow. config.profile_examples = 10 # Run specs in random order to surface order dependencies. If you find an # order dependency and want to debug it, you can fix the order by providing # the seed, which is printed after each run. # --seed 1234 config.order = :random # Seed global randomization in this process using the `--seed` CLI option. # Setting this allows you to use `--seed` to deterministically reproduce # test failures related to randomization by passing the same `--seed` value # as the one that triggered the failure. Kernel.srand config.seed =end end
using UnityEngine; using System.Collections; public class Flipper : MonoBehaviour { public float pressPos = 45f; public float power = 10F; public KeyCode keyCode; private bool isFlipup; void Start() { isFlipup = false; hingeJoint.useSpring = true; JointSpring js = hingeJoint.spring; js.spring = power; js.damper = 0; hingeJoint.spring = js; } void Update () { JointSpring js = hingeJoint.spring; if (Input.GetKey(keyCode) || isFlipup) { js.targetPosition = pressPos; } else { js.targetPosition = 0; } hingeJoint.spring = js; } public void FlipperUp() { isFlipup = true; } public void FlipperDown() { isFlipup = false; } }
import <API key> from './<API key>'; import { locales } from 'mwp-config'; describe('<API key>', () => { it('has a localized name for every item in `mwp-config/locales`', () => { locales.forEach(locale => { expect(Object.keys(<API key>).includes(locale)).toBeTruthy(); }); }); });
<?php namespace AppBundle\Controller; use AppBundle\Entity\Affiliate; use AppBundle\Form\AffiliateType; use DateTime; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use AppBundle\Helper\Helper; use Symfony\Component\Routing\Annotation\Route; class AffiliateController extends BaseController { /** * @Route("/new/affiliate", name="new_affiliate") * @param Request $request * @return RedirectResponse|Response */ public function newAffiliateAction(Request $request) { $affiliate = new Affiliate(); $form = $this->createForm(AffiliateType::class, $affiliate); $form->handleRequest($request); if ($form->isSubmitted()) { $em = $this->getEntityManager(); $categories = $em->getRepository('AppBundle:Category')->findAll(); $affiliate->setCategories($categories); $affiliate->setToken(Helper::getToken(40)); $affiliate->setReleasedAt(new DateTime('now')); $affiliate->setIsActive(false); $em->persist($affiliate); $em->flush(); $this->get('session')->getFlashBag()->add( 'success', 'Your Request was successfully added, wait until the manager will confirm it, and check your Email.' ); return $this->redirectToRoute( 'homepage' ); } return $this->render( 'affiliate/new_affiliate.html.twig', array( 'form' => $form->createView(), ) ); } }
package org.snf4j.core; import java.net.SocketAddress; import java.nio.ByteBuffer; import org.snf4j.core.future.IFuture; interface IEncodeTaskWriter { IFuture<Void> write(SocketAddress remoteAddress, ByteBuffer buffer, boolean withFuture); IFuture<Void> write(SocketAddress remoteAddress, byte[] bytes, boolean withFuture); }
const MAX = 2147483647; const FACTOR_A = 16807; const FACTOR_B = 48271; const B16 = 0b1111111111111111; function getGeneratorsStart(input) { const [, genA, genB] = input.match(/Generator A starts with (\d+)\nGenerator B starts with (\d+)/); return { genA, genB }; } exports.part1 = (input) => { let matches = 0; let { genA, genB } = getGeneratorsStart(input); for (let i = 0; i < 40000000; i++) { genA = (genA * FACTOR_A) % MAX; genB = (genB * FACTOR_B) % MAX; const genA16b = genA & B16; const genB16b = genB & B16; if (genA16b === genB16b) { matches++; } } return matches; }; exports.part2 = (input) => { let matches = 0; let { genA, genB } = getGeneratorsStart(input); for (let i = 0; i < 5000000; i++) { do { genA = (genA * FACTOR_A) % MAX; } while (genA % 4 !== 0); do { genB = (genB * FACTOR_B) % MAX; } while (genB % 8 !== 0); const genA16b = genA & B16; const genB16b = genB & B16; if (genA16b === genB16b) { matches++; } } return matches; };
<!DOCTYPE html> <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]--> <!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]--> <!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]--> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title>EcentricArts Mockup</title> <meta name="description" content=""> <meta name="viewport" content="width=device-width"> <!-- <link rel="icon" type="image/png" href="apple-touch-icon.png"> --> <!-- Place favicon.ico and apple-touch-icon.png in the root directory --> <link href='http://fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'> <link rel="stylesheet" href="css/normalize.css"> <link rel="stylesheet" href="css/main.css"> <script src="js/vendor/modernizr-2.6.1.min.js"></script> </head> <body> <!--[if lt IE 7]> <p class="chromeframe">You are using an outdated browser. <a href="http: <![endif] <div id="wrapper"> <section id="top"> <div class="container"> <header> <a id="logo" href="/"></a> <nav> <ul> <li><a href="#about">about</a></li> <li><a href="#work">work</a></li> <li><a href="#blog">blog</a></li> <li><a href="#contact">contact</a></li> </ul> </nav> <section id="social"> <a id="fb" class="social" href="http: <a id="twitter" class="social" href="http://twitter.com/ecentricarts" target="blank"></a> </section> </header> <div class="divider"></div> <h1 id="blurb">We are a digital-focused service company that provides <span class="highlight">strategic, creative</span> and <span class="highlight">technical</span> services with &nbsp;artisanal precision and care.</h1> <section> <h4 id="new-and-noteworthy" class="line-through">New and Noteworthy</h4> <section id="slides"> <div id="slide-1" class="slide"> <img class="slide-pic" src="img/slide1.png" /> <div class="slide-info"> <p class="title">Munk Debates</p> <p class="highlight">We helped scuplt the columns that support the Munk forum for debate</p> <p>Building a platform to support the combined intellectual weight of Henry Kissinger, Tony Blair, Christopher Hitchens. Building a platform to support the combined intellectual weight of Henry Kissinger, Tony Blair, Christopher Hitchens.</p> <a class="learn-more" href="#slide-1-info"></a> </div> </div> <div id="slide-2" class="slide"> <div class="slide-pic"></div> <div class="slide-info"> <p class="title">Slide Two</p> <p class="highlight">Slide Two Highlights</p> <p>These are some words about slide two. These are some words about slide two. These are some words about slide two. These are some words about slide two. These are some words about slide two. These are some words about slide two.</p> <a class="learn-more" href="#slide-2-info"></a> </div> </div> <div id="slide-3" class="slide"> <div class="slide-pic"></div> <div class="slide-info"> <p class="title">Slide Three</p> <p class="highlight">Slide Three Highlights</p> <p>These are some words about slide three. These are some words about slide three. These are some words about slide three. These are some words about slide three. These are some words about slide three. These are some words about slide three. These are some words about slide three.</p> <a class="learn-more" href="#slide-3-info"></a> </div> </div> <ul id="controls"> <li class="active" data-slide="1"></li> <li data-slide="2"></li> <li data-slide="3"></li> </ul> </section> </section> </div> </section> <section id="bottom"> <div class="container"> <section id="pictures"> <h4 id="we-are-driven" class="title line-through">We are driven by a belief that every user experience should <span class="highlight">engage</span>, <span class="highlight">enrich</span> and <span class="highlight">enlighten</span></h4> <ul id="cards"> <li id="left"> <a href="#blog-1"> <div class="overlay"> <span class="secret">Read More in Our <span class="highlight">Blog</span></span> </div> <img src="img/left.png" /> </a> <div class="text"> <h4 class="heading">We devote ourselves to our craft</h4> <p>We've been lovingly crafting websites for over 11 years and we've learned a thing or two along the way.</p> </div> </li> <li id="middle"> <a href="#blog-2"> <div class="overlay"> <span class="secret">Read More in Our <span class="highlight">Blog</span></span> </div> <img src="img/middle.png" /> </a> <div class="text"> <h4 class="heading">Our work speaks volumes</h4> <p>We love working with clients to help ensure their success in the digital world - and the proof is in the pixels.</p> </div> </li> <li id="right"> <a href="#blog-3"> <div class="overlay"> <span class="secret">Read More in Our <span class="highlight">Blog</span></span> </div> <img src="img/right.png" /> </a> <div class="text"> <h4 class="heading">We share useful and useable advice</h4> <p>We're lucky to work with the knowledge of exceptional artisans and we like to share our riches.</p> </div> </li> </ul> </section> <section id="tricks"> <h4 id="bag-of-tricks" class="title line-through">In our bag of tricks</h4> <p id="our-service">Our <span class="highlight">Service</span> offerings go from laying digital foundations to detailed pixel decoration, from strategy to project design, build, deployment and maintenance, as required.</p> <div id="services"> <div id="description"> <span>Leveraging our unique blend of creative, technical, communications and business expertise, ecentricarts <span class="highlight">designs</span> and <span class="highlight">develops</span> digital solutions that are engaging and highly functional, and meet your organization's needs and objectives.</span> </div> <div id="lists"> <p class="our-services">Our services include:</p> <ul id="strategy-list"> <li class="title">Strategy</li> <li class="ticked">Competitive analysis</li> <li class="ticked">Persona development</li> <li class="ticked">Website analytics</li> <li class="ticked">Search engine optimization</li> <li class="ticked">Project planning</li> <li class="learn-more"><a href="#learn-more-strategy">Learn More</a></li> </ul> <ul id="design-list"> <li class="title">Design</li> <li class="ticked">Information architecture</li> <li class="ticked">Usability studies</li> <li class="ticked">Interaction design</li> <li class="ticked">Visual design</li> <li class="ticked">Style guides</li> <li class="learn-more"><a href="#learn-more-design">Learn More</a></li> </ul> <ul id="technology-list"> <li class="title">Technology</li> <li class="ticked">iPhone and mobile</li> <li class="ticked">Facebook connect</li> <li class="ticked">Video transcoding</li> <li class="ticked">Flex development</li> <li class="ticked">Hosting and moderation</li> <li class="learn-more"><a href="#<API key>">Learn More</a></li> </ul> </div> </div> </section> </div> </section> <footer> <div class="container"> <span class="legal">&copy;2011 ecentricarts Inc. / All Rights Reserved</span> <nav> <ul> <li><a href="/">Home</a></li> <li><a href="#about">About</a></li> <li><a href="#work">Work</a></li> <li><a href="#blog">Blog</a></li> <li><a href="#contact">Contact</a></li> </ul> </nav> </div> </footer> </div> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script> <script>window.jQuery || document.write('<script src="js/vendor/jquery-1.8.0.min.js"><\/script>')</script> <script src="js/plugins.js"></script> <script src="js/main.js"></script> </body> </html>
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>mini-compiler: Not compatible </title> <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" /> <link href="../../../../../bootstrap.min.css" rel="stylesheet"> <link href="../../../../../bootstrap-custom.css" rel="stylesheet"> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <script src="../../../../../moment.min.js"></script> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file: <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif] </head> <body> <div class="container"> <div class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="../..">clean / released</a></li> <li class="active"><a href="">8.7.0 / mini-compiler - 8.10.0</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> mini-compiler <small> 8.10.0 <span class="label label-info">Not compatible </span> </small> </h1> <p> <em><script>document.write(moment("2022-03-09 10:28:59 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-03-09 10:28:59 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-num base Num library distributed with the OCaml compiler base-ocamlbuild base OCamlbuild binary and libraries distributed with the OCaml compiler base-threads base base-unix base camlp5 7.14 <API key> of OCaml conf-findutils 1 Virtual package relying on findutils conf-perl 2 Virtual package relying on perl coq 8.7.0 Formal proof management system num 0 The Num library for arbitrary-precision integer and rational arithmetic ocaml 4.02.3 The OCaml compiler (virtual package) ocaml-base-compiler 4.02.3 Official 4.02.3 release ocaml-config 1 OCaml Switch Configuration ocamlfind 1.9.3 A library manager for OCaml # opam file: opam-version: &quot;2.0&quot; maintainer: &quot;Hugo.Herbelin@inria.fr&quot; homepage: &quot;https://github.com/coq-contribs/mini-compiler&quot; license: &quot;LGPL 2.1&quot; build: [make &quot;-j%{jobs}%&quot;] install: [make &quot;install&quot;] remove: [&quot;rm&quot; &quot;-R&quot; &quot;%{lib}%/coq/user-contrib/MiniCompiler&quot;] depends: [ &quot;ocaml&quot; &quot;coq&quot; {&gt;= &quot;8.10&quot; &amp; &lt; &quot;8.11~&quot;} ] tags: [ &quot;keyword: compilation&quot; &quot;keyword: correctness&quot; &quot;keyword: arithmetic&quot; &quot;category: Computer Science/Semantics and Compilation/Compilation&quot; &quot;date: 2003&quot; ] authors: [ &quot;Jean-Christophe Filliâtre&quot; ] bug-reports: &quot;https://github.com/coq-contribs/mini-compiler/issues&quot; dev-repo: &quot;git+https://github.com/coq-contribs/mini-compiler.git&quot; synopsis: &quot;Correctness of a tiny compiler for arithmetic expressions&quot; description: &quot;&quot;&quot; Tutorial correctness proof of a tiny compiler from simple arithmetic expressions (constants, variables and additions) to simple assembly-like code (one accumulator, infinitly many registers and addition)&quot;&quot;&quot; flags: light-uninstall url { src: &quot;https://github.com/coq-contribs/mini-compiler/archive/v8.10.0.tar.gz&quot; checksum: &quot;md5=<API key>&quot; } </pre> <h2>Lint</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Dry install </h2> <p>Dry install with the current Coq version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam install -y --show-action coq-mini-compiler.8.10.0 coq.8.7.0</code></dd> <dt>Return code</dt> <dd>5120</dd> <dt>Output</dt> <dd><pre>[NOTE] Package coq is already installed (current version is 8.7.0). The following dependencies couldn&#39;t be met: - coq-mini-compiler -&gt; coq &gt;= 8.10 -&gt; ocaml &gt;= 4.05.0 base of this switch (use `--unlock-base&#39; to force) No solution found, exiting </pre></dd> </dl> <p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-mini-compiler.8.10.0</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Install dependencies</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Install </h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Installation size</h2> <p>No files were installed.</p> <h2>Uninstall 🧹</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Missing removes</dt> <dd> none </dd> <dt>Wrong removes</dt> <dd> none </dd> </dl> </div> </div> </div> <hr/> <div class="footer"> <p class="text-center"> Sources are on <a href="https: </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>interval: 6 m 26 s </title> <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" /> <link href="../../../../../bootstrap.min.css" rel="stylesheet"> <link href="../../../../../bootstrap-custom.css" rel="stylesheet"> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <script src="../../../../../moment.min.js"></script> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file: <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif] </head> <body> <div class="container"> <div class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="../..">clean / released</a></li> <li class="active"><a href="">8.13.1 / interval - 4.4.0</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> interval <small> 4.4.0 <span class="label label-success">6 m 26 s </span> </small> </h1> <p> <em><script>document.write(moment("2022-02-04 18:52:19 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-02-04 18:52:19 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-threads base base-unix base conf-findutils 1 Virtual package relying on findutils conf-gmp 4 Virtual package relying on a GMP lib system installation coq 8.13.1 Formal proof management system num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic ocaml 4.07.1 The OCaml compiler (virtual package) ocaml-base-compiler 4.07.1 Official release 4.07.1 ocaml-config 1 OCaml Switch Configuration ocamlfind 1.9.3 A library manager for OCaml zarith 1.12 Implements arithmetic and logical operations over arbitrary-precision integers # opam file: opam-version: &quot;2.0&quot; maintainer: &quot;guillaume.melquiond@inria.fr&quot; homepage: &quot;https://coqinterval.gitlabpages.inria.fr/&quot; dev-repo: &quot;git+https://gitlab.inria.fr/coqinterval/interval.git&quot; bug-reports: &quot;https://gitlab.inria.fr/coqinterval/interval/issues&quot; license: &quot;CeCILL-C&quot; build: [ [&quot;autoconf&quot;] {dev} [&quot;./configure&quot;] [&quot;./remake&quot; &quot;-j%{jobs}%&quot;] ] install: [&quot;./remake&quot; &quot;install&quot;] depends: [ &quot;coq&quot; {&gt;= &quot;8.8&quot;} &quot;coq-bignums&quot; &quot;coq-flocq&quot; {&gt;= &quot;3.1&quot;} &quot;<API key>&quot; {&gt;= &quot;1.6&quot;} &quot;coq-coquelicot&quot; {&gt;= &quot;3.0&quot;} &quot;conf-autoconf&quot; {build &amp; dev} (&quot;conf-g++&quot; {build} | &quot;conf-clang&quot; {build}) ] tags: [ &quot;keyword:interval arithmetic&quot; &quot;keyword:decision procedure&quot; &quot;keyword:floating-point arithmetic&quot; &quot;keyword:reflexive tactic&quot; &quot;keyword:Taylor models&quot; &quot;category:Mathematics/Real Calculus and Topology&quot; &quot;category:Computer Science/Decision Procedures and Certified Algorithms/Decision procedures&quot; &quot;logpath:Interval&quot; &quot;date:2022-01-15&quot; ] authors: [ &quot;Guillaume Melquiond &lt;guillaume.melquiond@inria.fr&gt;&quot; &quot;Érik Martin-Dorel &lt;erik.martin-dorel@irit.fr&gt;&quot; &quot;Pierre Roux &lt;pierre.roux@onera.fr&gt;&quot; &quot;Thomas Sibut-Pinote &lt;thomas.sibut-pinote@inria.fr&gt;&quot; ] synopsis: &quot;A Coq tactic for proving bounds on real-valued expressions automatically&quot; url { src: &quot;https://coqinterval.gitlabpages.inria.fr/releases/interval-4.4.0.tar.gz&quot; checksum: &quot;sha512=47b56fb496a8ca39e2b0cafbea30bd769674ca35d9140b17dc48f18d87903a70a11efd49f9235a675923e9f5e1b0d86db6931b1ffd32ab1a25dc16c9fc7e4dee&quot; } </pre> <h2>Lint</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Dry install </h2> <p>Dry install with the current Coq version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam install -y --show-action coq-interval.4.4.0 coq.8.13.1</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Install dependencies</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam list; echo; ulimit -Sv 4000000; timeout 4h opam install -y --deps-only coq-interval.4.4.0 coq.8.13.1</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>14 m 28 s</dd> </dl> <h2>Install </h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam list; echo; ulimit -Sv 16000000; timeout 4h opam install -y -v coq-interval.4.4.0 coq.8.13.1</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>6 m 26 s</dd> </dl> <h2>Installation size</h2> <p>Total: 11 M</p> <ul> <li>2 M <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Tactic.vo</code></li> <li>1 M <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Interval/Float.vo</code></li> <li>636 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Float/Primitive_ops.vo</code></li> <li>608 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Tactics/Integral_helper.vo</code></li> <li>598 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Eval/Prog.vo</code></li> <li>597 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Poly/Taylor_model_sharp.vo</code></li> <li>386 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Tactics/Plot_helper.vo</code></li> <li>374 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Eval/Eval.vo</code></li> <li>369 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Interval/Float_full.vo</code></li> <li>368 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Poly/Taylor_model.vo</code></li> <li>320 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Poly/Datatypes.vo</code></li> <li>310 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Integral/Integral.vo</code></li> <li>302 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Interval/Transcend.vo</code></li> <li>299 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Tactics/Interval_helper.vo</code></li> <li>225 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Float/Specific_ops.vo</code></li> <li>219 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Float/Generic_proof.vo</code></li> <li>192 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Integral/Bertrand.vo</code></li> <li>166 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Poly/Bound.vo</code></li> <li>145 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Poly/Basic_rec.vo</code></li> <li>143 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Real/Xreal_derive.vo</code></li> <li>132 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Interval/Interval.vo</code></li> <li>131 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Float/Specific_bigint.vo</code></li> <li>121 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Integral/Refine.vo</code></li> <li>119 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Missing/Stdlib.vo</code></li> <li>115 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Poly/Bound_quad.vo</code></li> <li>113 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Missing/Coquelicot.vo</code></li> <li>111 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Eval/Reify.vo</code></li> <li>110 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Float/Specific_stdz.vo</code></li> <li>103 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Float/Sig.vo</code></li> <li>99 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Eval/Tree.vo</code></li> <li>98 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Integral/Priority.vo</code></li> <li>94 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Float/Generic.vo</code></li> <li>91 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Interval/Interval_compl.vo</code></li> <li>85 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Missing/MathComp.vo</code></li> <li>78 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Float/Generic_ops.vo</code></li> <li>71 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Real/Taylor.vo</code></li> <li>66 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Tactic_float.vo</code></li> <li>64 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/interval_plot.cmxs</code></li> <li>60 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Real/Xreal.vo</code></li> <li>58 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Float/Basic.vo</code></li> <li>57 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Interval/Univariate_sig.vo</code></li> <li>55 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Poly/Taylor_poly.vo</code></li> <li>47 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Float/Specific_sig.vo</code></li> <li>13 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/interval_plot.cmo</code></li> <li>2 K <code>../ocaml-base-compiler.4.07.1/lib/coq/user-contrib/Interval/Plot.vo</code></li> </ul> <h2>Uninstall 🧹</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq-interval.4.4.0</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Missing removes</dt> <dd> none </dd> <dt>Wrong removes</dt> <dd> none </dd> </dl> </div> </div> </div> <hr/> <div class="footer"> <p class="text-center"> Sources are on <a href="https: </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
using FakeXrmEasy; using Microsoft.Xrm.Sdk; using NUnit.Framework; using System; using System.Management.Automation.Runspaces; namespace Xrm.Framework.CI.PowerShell.Cmdlets.Test { public static class TestData { public static XrmFakedContext XrmFakedContext = new XrmFakedContext(); public static Runspace Runspace; } public class <API key> : <API key> { protected override void BeginProcessing() { } protected override <API key> OrganizationService => TestData.XrmFakedContext.<API key>(); } [SetUpFixture] public class TestSetup { <API key> config = <API key>.Create(); Runspace runspace; [OneTimeSetUp] public void Setup() { Environment.CurrentDirectory = TestContext.CurrentContext.TestDirectory; config.Cmdlets.Append( new <API key>("<API key>", typeof(<API key>), "")); runspace = RunspaceFactory.CreateRunspace(config); runspace.Open(); TestData.Runspace = runspace; } [OneTimeTearDown] public void TearDown() => runspace?.Close(); } }
<head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content="{{ site.description }}"> <title>{% if page.title %}{{ page.title }} | {{ site.title }}{% else %}{{ site.title }} | {{ site.description }}{% endif %} </title> <link rel="canonical" href="{{ page.url | replace:'index.html','' | prepend: site.baseurl | prepend: site.url }}"> <link href="//cdn-images.mailchimp.com/embedcode/<API key>.css" rel="stylesheet" type="text/css"> <!-- Bootstrap Core CSS --> <link rel="stylesheet" href="{{ "/css/bootstrap.min.css" | prepend: site.baseurl }}"> <!-- Custom CSS --> <link rel="stylesheet" href="{{ "/css/clean-blog.css" | prepend: site.baseurl }}"> <!-- Pygments Github CSS --> <link rel="stylesheet" href="{{ "/css/syntax.css" | prepend: site.baseurl }}"> <!-- Custom Fonts --> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet" type="text/css"> <link href="https://fonts.googleapis.com/css?family=Lato:300,400,700" rel="stylesheet"> <link href="https://fonts.googleapis.com/css?family=Sumana:400,700" rel="stylesheet"> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file: <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script> <![endif] {% feed_meta %} </head>
// Class Implementation : // COXCaptionInfo & COXCaptionPainter // This software along with its related components, documentation and files ("The Libraries") #include "StdAfx.h" #include <shlwapi.h> #include "OXCaptionPainter.h" #include "UTBStrOp.h" #include "UTB64Bit.h" #include "WTypes.h" #ifndef __OXMFCIMPL_H__ #if _MFC_VER >= 0x0700 #if _MFC_VER >= 1400 #include <afxtempl.h> #endif #include <..\src\mfc\afximpl.h> #else #include <..\src\afximpl.h> #endif #define __OXMFCIMPL_H__ #endif #ifndef OXCP_NO_SAVESTATE #include "OXRegistryValFile.h" #endif // OXCP_NO_SAVESTATE #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif #define IDT_UPDATECAPTION 421 #define <API key> 300 static void PaintRect(CDC* pDC, int x, int y, int w, int h, COLORREF color); static BOOL IsSmallFont(BOOL& bIsSmall); UINT COXCaptionPainter::<API key>= <API key>(_T("<API key>")); UINT COXCaptionPainter::<API key>= <API key>(_T("<API key>")); IMPLEMENT_SERIAL(COXCaptionInfo, CObject, 1) // Constructor COXCaptionInfo::COXCaptionInfo() { Reset(); } // Sets COXCaptionInfo properties to their default value void COXCaptionInfo::Reset() { m_bGradient=TRUE; <API key>=ID_GRADIENT_LEFT; <API key>=ID_GRADIENT_SQUARE; m_nTextFormat=DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS; m_nNumberShade=64; m_clrBackground=ID_OXCP_COLOR_NONE; m_clrText=ID_OXCP_COLOR_NONE; if((HFONT)m_font!=NULL) m_font.DeleteObject(); if((HFONT)m_fontSm!=NULL) m_fontSm.DeleteObject(); } // Returns color used to fill caption. If an user preffered not to set any // custom color then function returns standard color. COLORREF COXCaptionInfo::GetBackgroundColor(BOOL bActive) const { if(m_clrBackground==ID_OXCP_COLOR_NONE) { if(bActive) { return GetSysColor(COLOR_ACTIVECAPTION); // return RGB(255,0,0); } else { return GetSysColor(<API key>); // return RGB(0,255,0); } } return m_clrBackground; } // Returns color used to draw text in caption. If an user preffered not to set any // custom color then function returns standard color. COLORREF COXCaptionInfo::GetTextColor(BOOL bActive) const { if(m_clrText==ID_OXCP_COLOR_NONE) { if(bActive) return ::GetSysColor(COLOR_CAPTIONTEXT); else return ::GetSysColor(<API key>); } return m_clrText; } // returns TRUE if succeeds and sets plf to the LOGINFO of the font used to draw text, // otherwise returns FALSE and plf is undefined BOOL COXCaptionInfo::GetCaptionLogFont(LOGFONT* plf) const { if((HFONT)m_font==NULL) { BOOL bIsSmall; IsSmallFont(bIsSmall); NONCLIENTMETRICS ncm; ncm.cbSize=sizeof(NONCLIENTMETRICS); if(<API key>(<API key>,0,&ncm,0)) { CFont font; if(font.CreateFontIndirect(&ncm.lfCaptionFont)) return font.GetObject(sizeof(*plf),plf); } return FALSE; } return m_font.GetObject(sizeof(*plf),plf); } // returns TRUE if succeeds and sets plf to the LOGINFO of the font used to // draw text (Small caption), otherwise returns FALSE and plf is undefined BOOL COXCaptionInfo::GetSmCaptionLogFont(LOGFONT* plf) const { if((HFONT)m_fontSm==NULL) { NONCLIENTMETRICS ncm; ncm.cbSize=sizeof(NONCLIENTMETRICS); if(<API key>(<API key>,0,&ncm,0)) { CFont font; if(font.CreateFontIndirect(&ncm.lfSmCaptionFont)) return font.GetObject(sizeof(*plf),plf); } return FALSE; } return m_fontSm.GetObject(sizeof(*plf),plf); } // returns TRUE if succeeds and creates font used to draw text from plf, // otherwise returns FALSE. If plf is NULL then any custom font previosly // set by SetCaptionLogFont function will be deleted (i.e. standard font // will be used to draw text in caption) BOOL COXCaptionInfo::SetCaptionLogFont(LOGFONT* plf) { if ((HFONT)m_font!=NULL) m_font.DeleteObject(); if(plf!=NULL) return m_font.CreateFontIndirect(plf); return TRUE; } // returns TRUE if succeeds and creates font used to draw text from plf, // otherwise returns FALSE. If plf is NULL then any custom font previosly // set by SetCaptionLogFont function will be deleted (i.e. standard font // will be used to draw text in caption) BOOL COXCaptionInfo::SetSmCaptionLogFont(LOGFONT* plf) { if ((HFONT)m_fontSm!=NULL) m_fontSm.DeleteObject(); if(plf!=NULL) return m_fontSm.CreateFontIndirect(plf); return TRUE; } // copy constructor. COXCaptionInfo& COXCaptionInfo::operator=(const COXCaptionInfo& ci) { ASSERT_VALID(this); ASSERT_VALID(&ci); if(this==&ci) return *this; m_clrBackground=ci.m_clrBackground; m_clrText=ci.m_clrText; m_bGradient=ci.m_bGradient; <API key>=ci.<API key>; <API key>=ci.<API key>; m_nNumberShade=ci.m_nNumberShade; LOGFONT lf; if ((HFONT)m_font!=NULL) m_font.DeleteObject(); if(ci.GetCaptionLogFont(&lf)) SetCaptionLogFont(&lf); if ((HFONT)m_fontSm!=NULL) m_fontSm.DeleteObject(); if(ci.GetSmCaptionLogFont(&lf)) SetSmCaptionLogFont(&lf); m_nTextFormat=ci.m_nTextFormat; return *this; } // serialization void COXCaptionInfo::Serialize(CArchive& ar) { // Only CObject-derived objects and six data-type // primitives are serializable. However, you // can cast any data type to a serializable data type, // and then you can serialize your data. The serializable // data types are // BYTE: 8 bits unsigned // WORD: 16 bits unsigned // LONG: 32 bits unsigned // DWORD: 32 bits unsigned // float 32 bits // double 64 bits, IEEE standard if (ar.IsStoring()) { ar << m_clrBackground; ar << m_bGradient; ar << <API key>; ar << <API key>; ar << m_nTextFormat; ar << m_clrText; ar << m_nNumberShade; } else { ar >> m_clrBackground; ar >> m_bGradient; ar >> <API key>; ar >> <API key>; ar >> m_nTextFormat; ar >> m_clrText; ar >> m_nNumberShade; } SerializeFont(ar,&m_font); SerializeFont(ar,&m_fontSm); } // helper function to serialize any font to opened archive void COXCaptionInfo::SerializeFont(CArchive& ar, CFont* pFont) { // Only CObject-derived objects and six data-type // primitives are serializable. However, you // can cast any data type to a serializable data type, // and then you can serialize your data. The serializable // data types are // BYTE: 8 bits unsigned // WORD: 16 bits unsigned // LONG: 32 bits unsigned // DWORD: 32 bits unsigned // float 32 bits // double 64 bits, IEEE standard LOGFONT lf; if (ar.IsStoring()) { if((HFONT)*pFont==NULL) { ar << FALSE; } else { ar << TRUE; if(!pFont->GetLogFont(&lf)) { // Throw the same exception as before on older compilers, for compatibility #if _MSC_VER >= 1400 <API key>(CArchiveException::badClass); #else <API key>(CArchiveException::generic); #endif } ar << lf.lfHeight; ar << lf.lfWidth; ar << lf.lfEscapement; ar << lf.lfOrientation; ar << lf.lfWeight; ar << lf.lfItalic; ar << lf.lfUnderline; ar << lf.lfStrikeOut; ar << lf.lfCharSet; ar << lf.lfOutPrecision; ar << lf.lfClipPrecision; ar << lf.lfQuality; ar << lf.lfPitchAndFamily; CString string=lf.lfFaceName; ar << string; } } else { if ((HFONT)*pFont!=NULL) { pFont->DeleteObject(); } BOOL bFontWasSaved; ar >> bFontWasSaved; if(bFontWasSaved) { ar >> lf.lfHeight; ar >> lf.lfWidth; ar >> lf.lfEscapement; ar >> lf.lfOrientation; ar >> lf.lfWeight; ar >> lf.lfItalic; ar >> lf.lfUnderline; ar >> lf.lfStrikeOut; ar >> lf.lfCharSet; ar >> lf.lfOutPrecision; ar >> lf.lfClipPrecision; ar >> lf.lfQuality; ar >> lf.lfPitchAndFamily; CString string; ar >> string; try { UTBStr::tcscpy(lf.lfFaceName, string.GetLength() + 1, string.GetBuffer(LF_FACESIZE)); } catch(CMemoryException* e) { <API key>(e); // Throw the same exception as before on older compilers, for compatibility #if _MSC_VER >= 1400 <API key>(CArchiveException::badClass); #else <API key>(CArchiveException::generic); #endif } if(!pFont->CreateFontIndirect(&lf)) { // Throw the same exception as before on older compilers, for compatibility #if _MSC_VER >= 1400 <API key>(CArchiveException::badClass); #else <API key>(CArchiveException::generic); #endif } } } } IMPLEMENT_DYNAMIC(COXCaptionPainter, COXHookWnd); // Constructor COXCaptionPainter::COXCaptionPainter() { Reset(); m_bHackStyleSet=FALSE; m_bHackStyleExSet=FALSE; m_bAnimation=FALSE; m_bActive=TRUE; m_bUpdate=FALSE; m_sWindowText.Empty(); m_nIdleFlags=0; } // Destructor COXCaptionPainter::~COXCaptionPainter() { } #ifndef PACKVERSION #define PACKVERSION(major,minor) MAKELONG(minor,major) #endif DWORD COXCaptionPainter::GetDllVersion(LPCTSTR lpszDllName) { HINSTANCE hinstDll; DWORD dwVersion = 0; hinstDll = LoadLibrary(lpszDllName); if(hinstDll) { DLLGETVERSIONPROC pDllGetVersion; pDllGetVersion = (DLLGETVERSIONPROC) GetProcAddress(hinstDll, "DllGetVersion"); /*Because some DLLs may not implement this function, you *must test for it explicitly. Depending on the particular *DLL, the lack of a DllGetVersion function may *be a useful indicator of the version. */ if(pDllGetVersion) { DLLVERSIONINFO dvi; HRESULT hr; ZeroMemory(&dvi, sizeof(dvi)); dvi.cbSize = sizeof(dvi); hr = (*pDllGetVersion)(&dvi); if(SUCCEEDED(hr)) { dwVersion = PACKVERSION(dvi.dwMajorVersion, dvi.dwMinorVersion); } } FreeLibrary(hinstDll); } return dwVersion; } BOOL COXCaptionPainter::IsAppSkinned() { OSVERSIONINFO osvi; osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); ::GetVersionEx(&osvi); if (osvi.dwMajorVersion >= 5 && osvi.dwMinorVersion >= 1) { // We have XP or higher // Call ::IsAppThemed() HMODULE hLib = ::LoadLibrary(_T("Uxtheme.dll")); typedef int (WINAPI* LPISAPPTHEMED) (void); LPISAPPTHEMED pIsAppThemed = (LPISAPPTHEMED) GetProcAddress(hLib, "IsAppThemed"); BOOL bThemed = pIsAppThemed(); ::FreeLibrary(hLib); if (bThemed) { // Check is we are using common controls v.6.0 if(GetDllVersion(_T("comctl32.dll")) >= PACKVERSION(6,00)) return TRUE; // we have the XP skins on else return FALSE; } else return FALSE; } else return FALSE; } // Attach caption handler. BOOL COXCaptionPainter::Attach(CWnd* pWnd) { if (IsAppSkinned()) return FALSE; // we have Windows XP or higher and the skins are turned on, // making the caption painter obsolete ASSERT_VALID(pWnd); ASSERT(::IsWindow(pWnd->m_hWnd)); DWORD dwStyle=pWnd->GetStyle(); if((dwStyle&WS_CAPTION)==WS_CAPTION) { HookWindow(pWnd); m_nColorBits=GetNumColorBits(); if(pWnd->SetTimer(IDT_UPDATECAPTION,<API key>,NULL)!= IDT_UPDATECAPTION) { UnhookWindow(); return FALSE; } return TRUE; } return FALSE; } // Detach caption handler. Called by default when hooked window is about // to be destroyed. void COXCaptionPainter::Detach() { UnhookWindow(); } // sets caption properties void COXCaptionPainter::SetCaptionInfo(COXCaptionInfo* pCI, BOOL bActive) { ASSERT_VALID(pCI); if(bActive) m_ciActive=*pCI; else m_ciInactive=*pCI; } // retrievs any COXCaptionPainter object associated with any CWnd BOOL COXCaptionPainter::GetCaptionPainter(CWnd* pWnd, COXCaptionPainter* pCP) { ASSERT_VALID(pWnd); ASSERT(::IsWindow(pWnd->m_hWnd)); return (BOOL)pWnd->SendMessage(<API key>,0,(LPARAM)pCP); } // sets properties of existed COXCaptionPainter object to the COXCaptionPainter // associated with any window BOOL COXCaptionPainter::SetCaptionPainter(CWnd* pWnd, COXCaptionPainter* pCP) { ASSERT_VALID(pWnd); ASSERT(::IsWindow(pWnd->m_hWnd)); return (BOOL)pWnd->SendMessage(<API key>,0,(LPARAM)pCP); } // Sets/removes hooked window's style void COXCaptionPainter::SetHackStyle(LONG dwStyle, UINT nAction) { ASSERT(nAction==ID_OXHACK_ADDSTYLE || nAction==<API key>); ASSERT(::IsWindow(m_hWndHooked)); ASSERT_VALID(this); if(!m_bHackStyleSet) { ASSERT(GetHookedWnd()!=NULL); // save original size m_dwSavedStyle=GetHookedWnd()->GetStyle(); switch(nAction) { case ID_OXHACK_ADDSTYLE: { ::SetWindowLongPtr(m_hWndHooked,GWL_STYLE,m_dwSavedStyle|dwStyle); break; } case <API key>: { ::SetWindowLongPtr(m_hWndHooked,GWL_STYLE,(m_dwSavedStyle & ~dwStyle)); break; } } m_bHackStyleSet=TRUE; } } // Sets hooked window's original style void COXCaptionPainter::RemoveHackStyle() { ASSERT(::IsWindow(m_hWndHooked)); ASSERT_VALID(this); if(m_bHackStyleSet) { ASSERT(m_hWndHooked!=NULL); // have to put it here m_bHackStyleSet=FALSE; ::SetWindowLongPtr(m_hWndHooked, GWL_STYLE, m_dwSavedStyle); } } // Sets/removes hooked window's extended style void COXCaptionPainter::SetHackStyleEx(LONG dwStyleEx, UINT nAction) { ASSERT(nAction==ID_OXHACK_ADDSTYLE || nAction==<API key>); ASSERT(::IsWindow(m_hWndHooked)); ASSERT_VALID(this); if(!m_bHackStyleExSet) { ASSERT(m_hWndHooked!=NULL); // save original extended size m_dwSavedStyleEx=GetHookedWnd()->GetExStyle(); switch(nAction) { case ID_OXHACK_ADDSTYLE: { ::SetWindowLongPtr(m_hWndHooked, GWL_EXSTYLE, m_dwSavedStyleEx|dwStyleEx); break; } case <API key>: { ::SetWindowLongPtr(m_hWndHooked, GWL_EXSTYLE, m_dwSavedStyleEx & ~ dwStyleEx); break; } } m_bHackStyleExSet=TRUE; } } // Sets hooked window's original extended style void COXCaptionPainter::RemoveHackStyleEx() { ASSERT(::IsWindow(m_hWndHooked)); ASSERT_VALID(this); if(m_bHackStyleExSet) { ASSERT(m_hWndHooked!=NULL); // have to put it here m_bHackStyleExSet=FALSE; ::SetWindowLongPtr(m_hWndHooked, GWL_EXSTYLE, m_dwSavedStyleEx); } } // Handle animation effects LRESULT COXCaptionPainter::HackAnimation(UINT msg, WPARAM wp, LPARAM lp) { ASSERT(::IsWindow(m_hWndHooked)); LRESULT result; if(!m_bAnimation) { // animation structure ANIMATIONINFO aniInfo; aniInfo.cbSize=sizeof(ANIMATIONINFO); <API key>(SPI_GETANIMATION,sizeof(ANIMATIONINFO),&aniInfo,0); // save original state BOOL bAnimated=aniInfo.iMinAnimate==0 ? FALSE : TRUE; if(bAnimated) { aniInfo.iMinAnimate=0; <API key>(SPI_SETANIMATION,sizeof(ANIMATIONINFO), &aniInfo,0); } result=COXHookWnd::WindowProc(msg,wp,lp); // animation if(bAnimated) { // load original state aniInfo.iMinAnimate=1; <API key>(SPI_SETANIMATION,sizeof(ANIMATIONINFO),&aniInfo,0); } } else { result=COXHookWnd::WindowProc(msg,wp,lp); } return result; } // Message handler handles caption-related and other messages LRESULT COXCaptionPainter::WindowProc(UINT msg, WPARAM wp, LPARAM lp) { #if defined (_WINDLL) #if defined (_AFXDLL) AFX_MANAGE_STATE(<API key>()); #else AFX_MANAGE_STATE(<API key>()); #endif #endif ASSERT(::IsWindow(m_hWndHooked)); // The purpose of SetHackStyle() and SetHackStyleEx() functions is to // force Windows to handle some messages in a special way. As soon as // the message is handled we have to restore the original settings calling // RemoveHackStyle() and RemoveHackStyleEx(). The best place for that is // when next message for hooked window will be handled. But when SetHackStyle() // or SetHackStyleEx() are called then WM_STYLECHANGING and WM_STYLECHANGED // messages are sent. So we have to treat them a little bit differently. if(msg!=WM_STYLECHANGING && msg!=WM_STYLECHANGED) { UINT oldMsg=msg; RemoveHackStyle(); RemoveHackStyleEx(); msg=oldMsg; } // first of all handle or registered messages if(msg==<API key>) { ASSERT_VALID((COXCaptionPainter*)lp); ((COXCaptionPainter*)lp)->Reset(); ((COXCaptionPainter*)lp)->SetCaptionInfo(GetCaptionInfo(TRUE),TRUE); ((COXCaptionPainter*)lp)->SetCaptionInfo(GetCaptionInfo(FALSE),FALSE); return TRUE; } else if(msg==<API key>) { ASSERT_VALID((COXCaptionPainter*)lp); Reset(); SetCaptionInfo(((COXCaptionPainter*)lp)->GetCaptionInfo(TRUE),TRUE); SetCaptionInfo(((COXCaptionPainter*)lp)->GetCaptionInfo(FALSE),FALSE); return TRUE; } // Handle all messages which standard handlers could draw in caption rect. // I am sure you'll be amased to know that there are so many places where // Windows draws different element of caption. It is mostly due to problem // with MDI window. Just look through the code and you will figure out // how Windows inconsistent internally. switch (msg) { case WM_HELP: case WM_MENUSELECT: case WM_INITMENUPOPUP: case WM_CANCELMODE: { LRESULT result=COXHookWnd::WindowProc(msg,wp,lp); DrawCaption(); return result; } case WM_SETCURSOR: { if(LOWORD(lp)==HTBOTTOM || LOWORD(lp)==HTBOTTOMLEFT || LOWORD(lp)==HTBOTTOMRIGHT || LOWORD(lp)==HTLEFT || LOWORD(lp)==HTRIGHT || LOWORD(lp)==HTTOP || LOWORD(lp)==HTTOPLEFT || LOWORD(lp)==HTTOPRIGHT) { SetHackStyle(WS_CAPTION); LRESULT result=COXHookWnd::WindowProc(msg,wp,lp); RemoveHackStyle(); return result; } break; } case WM_NCLBUTTONDOWN: { return OnNCLButtonDown(wp,lp); } case WM_NCLBUTTONDBLCLK: { if(wp==HTCAPTION && (GetHookedWnd()->GetStyle()&WS_MAXIMIZEBOX)!=0) { LRESULT result=::SendMessage(m_hWndHooked,WM_SYSCOMMAND, (GetHookedWnd()->IsZoomed() ? SC_RESTORE : SC_MAXIMIZE),0); DrawCaption(); return result; } break; } case WM_SYSCOMMAND: { if(wp==SC_MINIMIZE || wp==SC_MAXIMIZE || wp==SC_RESTORE || wp==SC_CLOSE) { DrawCaption(); if(wp!=SC_CLOSE) { return HackAnimation(msg,wp,lp); } } break; } case WM_COMMAND: { if(LOWORD(wp)==ID_WINDOW_TILE_HORZ || LOWORD(wp)==ID_WINDOW_TILE_VERT || LOWORD(wp)==ID_WINDOW_CASCADE || LOWORD(wp)==ID_WINDOW_ARRANGE) { return HackAnimation(msg,wp,lp); } break; } case WM_SIZE: { if(GetHookedWnd()->IsKindOf(RUNTIME_CLASS(CMDIChildWnd))) { if(wp==SIZE_MAXIMIZED || wp==SIZE_MINIMIZED || wp==SIZE_RESTORED) { LRESULT result=COXHookWnd::WindowProc(msg,wp,lp); DrawCaption(); return result; } } break; } case WM_NCPAINT: { OnNcPaint(HRGN(wp)); return 0; } case WM_NCACTIVATE: { return OnNcActivate((BOOL)wp); } case WM_SETTEXT: { OnSetText((LPCTSTR)lp); return TRUE; } case WM_SYSCOLORCHANGE: case WM_SETTINGCHANGE: { m_nColorBits=GetNumColorBits(); Reset(); DrawCaption(); return 0; } case WM_STYLECHANGED: { LRESULT result=COXHookWnd::WindowProc(msg,wp,lp); Reset(); DrawCaption(); return result; } case WM_TIMER: { if(wp==IDT_UPDATECAPTION) { // force new bitmap CString sText; GetHookedWnd()->GetWindowText(sText); if(sText!=m_sWindowText) { Reset(); DrawCaption(); } else { // redraw the toolbar if necessary if(m_nIdleFlags & oxidleRedrawCaption) { if(GetHookedWnd()->IsWindowVisible()) { Reset(); DrawCaption(); } } } return 0L; } } case WM_DESTROY: { GetHookedWnd()->KillTimer(IDT_UPDATECAPTION); break; } } // I don't handle it: pass along return COXHookWnd::WindowProc(msg,wp,lp); } // Handle WM_NCPAINT for main window void COXCaptionPainter::OnNcPaint(HRGN hRgn) { ASSERT(::IsWindow(m_hWndHooked)); CWnd& wnd=*GetHookedWnd(); // caption rectangle in window coordinates CRect rect; GetCaptionRect(rect); // window rect CRect rectWindow; // .. get window rect wnd.GetWindowRect(&rectWindow); // convert caption rect to screen coords rect+=rectWindow.TopLeft(); // Don't bother painting if the caption doesn't lie within the region. if ((WORD)hRgn>1 && !::RectInRegion(hRgn,&rect)) { // just do default thing Default(); return; } // Exclude caption from update region HRGN hRgnCaption=::<API key>(&rect); HRGN hRgnNew=::<API key>(&rect); if((WORD)hRgn>1) { // wParam is a valid region: subtract caption from it ::CombineRgn(hRgnNew, hRgn, hRgnCaption, RGN_DIFF); } else { // wParam is not a valid region: create one that's the whole // window minus the caption bar HRGN hRgnAll = ::<API key>(&rectWindow); CombineRgn(hRgnNew, hRgnAll, hRgnCaption, RGN_DIFF); DeleteObject(hRgnAll); } // Call Windows to do WM_NCPAINT with altered update region MSG& msg=AfxGetThreadState()->m_lastSentMsg; // save original wParam WPARAM oldWP=msg.wParam; // set new region for DefWindowProc msg.wParam=(WPARAM)hRgnNew; Default(); // clean up DeleteObject(hRgnCaption); DeleteObject(hRgnNew); // restore original wParam msg.wParam=oldWP; // Now paint the special caption DrawCaption(); } // Handle WM_NCACTIVATE for main window BOOL COXCaptionPainter::OnNcActivate(BOOL bActive) { ASSERT(::IsWindow(m_hWndHooked)); // Handle it differently for MDIFrame window if(GetHookedWnd()->IsKindOf(RUNTIME_CLASS(CFrameWnd))) { CFrameWnd& frame=*((CFrameWnd*)GetHookedWnd()); ASSERT_KINDOF(CFrameWnd, &frame); // Mimic MFC kludge to stay active if WF_STAYACTIVE bit is on if (frame.m_nFlags & WF_STAYACTIVE) { bActive = TRUE; } if (!frame.IsWindowEnabled()) { // but not if disabled bActive = FALSE; } if (bActive==m_bActive && bActive==FALSE) { // nothing to do DrawCaption(); return TRUE; } // In case this is a MDI app, manually activate/paint active MDI child // window, because Windows won't do it if parent frame is invisible. // Must do this BEFORE calling Default, or it will not work. if (!m_bUpdate) { m_bUpdate=TRUE; CFrameWnd* pActiveFrame = frame.GetActiveFrame(); if (pActiveFrame) { pActiveFrame->SendMessage(WM_NCACTIVATE,TRUE); pActiveFrame->SendMessage(WM_NCPAINT, 1); } CWnd* pWnd=frame.GetNextWindow(); CWnd* pStartWnd=pWnd; while (pWnd) { CFrameWnd* pFrame=DYNAMIC_DOWNCAST(CFrameWnd, pWnd); if (pFrame && pFrame!=pActiveFrame) { pFrame->SendMessage(WM_NCACTIVATE,FALSE); } pWnd=pWnd->GetNextWindow(); } pWnd=pStartWnd; if (pWnd) pWnd=pWnd->GetNextWindow(GW_HWNDPREV); while (pWnd) { CFrameWnd* pFrame=DYNAMIC_DOWNCAST(CFrameWnd, pWnd); if (pFrame /*&& pFrame!=pActiveFrame*/) { pFrame->SendMessage(WM_NCACTIVATE,FALSE); } pWnd=pWnd->GetNextWindow(GW_HWNDPREV); } m_bUpdate=FALSE; } // Turn WS_CAPTION off before calling DefWindowProc, // so DefWindowProc won't paint and thereby cause flicker. MSG& msg=AfxGetThreadState()->m_lastSentMsg; msg.wParam=bActive; Default(); // RemoveHackStyle(); // At this point, nothing has happened (since WS_CAPTION was off). // Now it's time to paint. // update state m_bActive = bActive; // paint non-client area (frame too) frame.SendMessage(WM_NCPAINT); return TRUE; } else { CWnd& wnd = *GetHookedWnd(); if (bActive==m_bActive) { // nothing to do return TRUE; } // SetHackStyle(WS_CAPTION); MSG& msg=AfxGetThreadState()->m_lastSentMsg; msg.wParam=bActive; Default(); // RemoveHackStyle(); // Now it's time to paint. // update state m_bActive = bActive; // paint non-client area (frame too) wnd.SendMessage(WM_NCPAINT); return TRUE; } } // Handle WM_SETTEXT for main window void COXCaptionPainter::OnSetText(LPCTSTR lpText) { <API key>(lpText); ASSERT(::IsWindow(m_hWndHooked)); CWnd& wnd=*GetHookedWnd(); // Turn WS_CAPTION style off before calling Windows to set the text, // then turn it back on again after. // When MDIChild window is maximized then it draws the caption of // its parent, MDIFrame window. if this is a case then we have to // apply hack to parent window. CMDIFrameWnd* pFrameWnd=NULL; BOOL bMDIFrameChanged=FALSE; BOOL bMaximizedMDIChild=FALSE; BOOL bIsMDIChild=wnd.IsKindOf(RUNTIME_CLASS(CMDIChildWnd)); BOOL bIsMDIFrame=wnd.IsKindOf(RUNTIME_CLASS(CMDIFrameWnd)); ASSERT(!(bIsMDIChild&bIsMDIFrame)); if(bIsMDIChild) { pFrameWnd=((CMDIChildWnd*)&wnd)->GetMDIFrame(); if(pFrameWnd!=NULL) { BOOL bMaximize=FALSE; CWnd* pActiveWnd=pFrameWnd->MDIGetActive(&bMaximize); if(pActiveWnd->GetSafeHwnd()==wnd.GetSafeHwnd() && bMaximize) { pFrameWnd->ModifyStyle(WS_VISIBLE,0); bMDIFrameChanged=TRUE; } } } else if(bIsMDIFrame) { pFrameWnd=(CMDIFrameWnd*)GetHookedWnd(); BOOL bMaximize=FALSE; CWnd* pActiveWnd=pFrameWnd->MDIGetActive(&bMaximize); if(pActiveWnd!=NULL && bMaximize) { SetHackStyle(WS_VISIBLE); bMaximizedMDIChild=TRUE; } } if(!bMDIFrameChanged && !bMaximizedMDIChild) { SetHackStyle(WS_CAPTION); } Default(); if(bMDIFrameChanged) { pFrameWnd->ModifyStyle(0,WS_VISIBLE); } else { RemoveHackStyle(); } // force new bitmap Reset(); DrawCaption(); } // Handle WM_NCLBUTTONDOWN for main window LRESULT COXCaptionPainter::OnNCLButtonDown(WPARAM wp, LPARAM lp) { // Treat caption area in a special way if(wp==HTCAPTION) { if(!m_bActive) { if(!GetHookedWnd()->IsKindOf(RUNTIME_CLASS(CMDIChildWnd))) { GetHookedWnd()->SendMessage(WM_ACTIVATE,TRUE); DrawCaption(); } else { CWnd* pWnd=GetHookedWnd()->GetParent(); if(pWnd!=NULL) { pWnd->SendMessage(WM_ACTIVATE,TRUE); DrawCaption(); } } } // It sounds crazy but we have to handle it this way. if(m_nColorBits<=8 && !GetHookedWnd()->IsKindOf(RUNTIME_CLASS(CMiniDockFrameWnd))) { return GetHookedWnd()->SendMessage(WM_SYSCOMMAND,SC_MOVE); } } // area of caption's buttons is treated differently if(wp!=HTCLOSE && wp!=HTHELP && wp!=HTMAXBUTTON && wp!=HTMINBUTTON && wp!=HTREDUCE && wp!=HTZOOM) { SetHackStyle(WS_CAPTION); } LRESULT result=COXHookWnd::WindowProc(WM_NCLBUTTONDOWN, wp, lp); // in result of operation the window might have been destroyed if(!IsHooked()) return result; if(wp!=HTCLOSE && wp!=HTHELP && wp!=HTMAXBUTTON && wp!=HTMINBUTTON && wp!=HTREDUCE && wp!=HTZOOM) { RemoveHackStyle(); } if(wp==HTHELP) { DrawCaption(); } return result; } // Paint custom caption. Flag tells whether active or not. Just blast the // bitmap to the title bar, but not if minimized (iconic). void COXCaptionPainter::DrawCaption() { ASSERT(::IsWindow(m_hWndHooked)); CWnd& wnd=*GetHookedWnd(); m_nIdleFlags&=~oxidleRedrawCaption; // Get caption DC and rectangle // window DC CWindowDC dc(&wnd); // memory DC CDC dcCompatible; dcCompatible.CreateCompatibleDC(&dc); CRect rect; // get caption rectangle GetCaptionRect(rect); // if the saved size of caption doesn't match the real one then mark // bitmaps for both active/inactive state as "dirty" if(m_sizeCaption!=rect.Size()) { m_sizeCaption=rect.Size(); // invalidate bitmaps m_bmActive.DeleteObject(); m_bmInactive.DeleteObject(); } // Get active/inactive bitmap & determine if needs to be regenerated CBitmap &bm=m_bActive ? m_bmActive : m_bmInactive; COXCaptionInfo &ci=m_bActive ? m_ciActive : m_ciInactive; BOOL bPaint=FALSE; if(bm.GetSafeHandle()==NULL) { // no bitmap: bm.<API key>(&dc, rect.Width(), rect.Height()); bPaint=TRUE; } // select bitmap into memory DC CBitmap* pOldBitmap=dcCompatible.SelectObject(&bm); // If bitmap needs painting then do it. if (bPaint) { // first of all draw background <API key>(&dcCompatible,&ci,&rect); CSize sizeConstraints(0,0); CSize sizeCaption(rect.Width(),rect.Height()); // then draw icon sizeConstraints.cx=DrawCaptionIcon(&dcCompatible,&ci,&sizeCaption); sizeConstraints.cy=DrawCaptionButtons(&dcCompatible,&ci,&sizeCaption); DrawCaptionText(&dcCompatible,&ci,&sizeCaption,&sizeConstraints); } // blast bits to screen dc.BitBlt(rect.left,rect.top,rect.Width(),rect.Height(), &dcCompatible,0,0,SRCCOPY); dcCompatible.SelectObject(pOldBitmap); // restore DC } // Draw caption background. // Compute new color brush for each band from x to x + xDelta. // Excel uses a linear algorithm from black to normal, i.e. // color = CaptionColor * r // where r is the ratio x/w, which ranges from 0 (x=0, left) // to 1 (x=w, right). This results in a mostly black title bar, // since we humans don't distinguish dark colors as well as light // ones. So instead, I use the formula // color = CaptionColor * [1-(1-r)^2] // which still equals black when r=0 and CaptionColor when r=1, // but spends more time near CaptionColor. For example, when r=.5, // the multiplier is [1-(1-.5)^2] = .75, closer to 1 than .5. // I leave the algebra to the reader to verify that the above formula // is equivalent to // color = CaptionColor - (CaptionColor*(w-x)*(w-x))/(w*w) // The computation looks horrendous, but it's only done once each // time the caption changes size; thereafter BitBlt'ed to the screen. void COXCaptionPainter::<API key>(CDC* pDC, const COXCaptionInfo* pCI, const CRect* pCaptionRect) { ASSERT(::IsWindow(m_hWndHooked)); ASSERT_VALID(pCI); ASSERT(pDC); int cxCap=pCaptionRect->Width(); int cyCap=pCaptionRect->Height(); // red, green and blue color vals COLORREF clrBackground=pCI->GetBackgroundColor(m_bActive); int red=GetRValue(clrBackground); int green=GetGValue(clrBackground); int blue=GetBValue(clrBackground); if(!pCI->GetGradient()) { PaintRect(pDC,0,0,cxCap,cyCap,clrBackground); } else { int nCurBlock; // width of area to shade and width squared int nWidth, nWidth_x_2; // width of one shade band int nDelta; UINT nAlignment=pCI-><API key>(); UINT nAlgorithm=pCI-><API key>(); UINT nNumberShade=pCI->GetNumberShade(); switch(nAlignment) { case ID_GRADIENT_LEFT: { nCurBlock=cxCap; nWidth=cxCap; nWidth_x_2=cxCap*cxCap; nDelta=__max(nWidth/nNumberShade,1); while(nCurBlock>0) { switch(nAlgorithm) { case ID_GRADIENT_LINEAR: { // paint bands right to left PaintRect(pDC, nCurBlock, 0, nDelta, cyCap, RGB((red*nCurBlock)/nWidth, (green*nCurBlock)/nWidth, (blue*nCurBlock)/nWidth)); break; } case ID_GRADIENT_SQUARE: { // paint bands right to left int nRest_x_2=(nWidth-nCurBlock)*(nWidth-nCurBlock); PaintRect(pDC, nCurBlock, 0, nDelta, cyCap, RGB(red-(red*nRest_x_2)/nWidth_x_2, green-(green*nRest_x_2)/nWidth_x_2, blue-(blue*nRest_x_2)/nWidth_x_2)); break; } } // next band nCurBlock-=nDelta; } // whatever's left ==> black PaintRect(pDC,0,0,nCurBlock+nDelta,cyCap,RGB(0,0,0)); break; } case ID_GRADIENT_CENTER: { nCurBlock=cxCap/2; nWidth=cxCap/2; nWidth_x_2=cxCap*cxCap/4; nDelta=__max(nWidth/(2*nNumberShade),1); while(nCurBlock>0) { switch(nAlgorithm) { case ID_GRADIENT_LINEAR: { // paint bands right to left PaintRect(pDC, nWidth+nCurBlock, 0, nDelta, cyCap, RGB((red*nCurBlock)/nWidth, (green*nCurBlock)/nWidth, (blue*nCurBlock)/nWidth)); break; } case ID_GRADIENT_SQUARE: { // paint bands right to left int nRest_x_2=(nWidth-nCurBlock)*(nWidth-nCurBlock); PaintRect(pDC, nWidth+nCurBlock, 0, nDelta, cyCap, RGB(red-(red*nRest_x_2)/nWidth_x_2, green-(green*nRest_x_2)/nWidth_x_2, blue-(blue*nRest_x_2)/nWidth_x_2)); break; } } // next band nCurBlock-=nDelta; } // whatever's left ==> black PaintRect(pDC,nWidth,0,nCurBlock+nDelta,cyCap,RGB(0,0,0)); nCurBlock=0; while(nCurBlock<=nWidth) { switch(nAlgorithm) { case ID_GRADIENT_LINEAR: { // paint bands left to right PaintRect(pDC, nCurBlock, 0, nDelta, cyCap, RGB(red-(red*nCurBlock)/nWidth, green-(green*nCurBlock)/nWidth, blue-(blue*nCurBlock)/nWidth)); break; } case ID_GRADIENT_SQUARE: { // paint bands left to right int nRest_x_2=nCurBlock*nCurBlock; PaintRect(pDC, nCurBlock, 0, nDelta, cyCap, RGB(red-(red*nRest_x_2)/nWidth_x_2, green-(green*nRest_x_2)/nWidth_x_2, blue-(blue*nRest_x_2)/nWidth_x_2)); break; } } // next band nCurBlock+=nDelta; } // whatever's left ==> black PaintRect(pDC,nCurBlock-nDelta,0,nWidth-nCurBlock+nDelta, cyCap,RGB(0,0,0)); break; } case ID_GRADIENT_RIGHT: { nCurBlock=0; nWidth=cxCap; nWidth_x_2=cxCap*cxCap; nDelta=__max(nWidth/nNumberShade,1); while(nCurBlock<nWidth) { switch(nAlgorithm) { case ID_GRADIENT_LINEAR: { // paint bands left to right PaintRect(pDC, nCurBlock, 0, nDelta, cyCap, RGB(red-(red*nCurBlock)/nWidth, green-(green*nCurBlock)/nWidth, blue-(blue*nCurBlock)/nWidth)); break; } case ID_GRADIENT_SQUARE: { // paint bands left to right int nRest_x_2=nCurBlock*nCurBlock; PaintRect(pDC, nCurBlock, 0, nDelta, cyCap, RGB(red-(red*nRest_x_2)/nWidth_x_2, green-(green*nRest_x_2)/nWidth_x_2, blue-(blue*nRest_x_2)/nWidth_x_2)); break; } } // next band nCurBlock+=nDelta; } // whatever's left ==> black PaintRect(pDC,nCurBlock-nDelta,0,nWidth-nCurBlock+nDelta-1, cyCap,RGB(0,0,0)); break; } } } } // Draw caption icon int COXCaptionPainter::DrawCaptionIcon(CDC* pDC, const COXCaptionInfo* pCI, const CSize* pCaptionSize) { <API key>(pCI); <API key>(pCaptionSize); ASSERT(::IsWindow(m_hWndHooked)); CWnd& wnd = *GetHookedWnd(); ASSERT_VALID(pCI); ASSERT(pDC); if((wnd.GetStyle() & WS_SYSMENU)!=0) { HICON hIcon = (HICON)(UINT_PTR)GetClassLongPtr(wnd.m_hWnd, GCL_HICONSM); if(hIcon==NULL) hIcon=wnd.GetIcon(FALSE); if(hIcon) { // Within the basic button rectangle, Windows 95 uses a 1 or 2 pixel border // Icon has 2 pixel border on left, 1 pixel on top/bottom, 0 right int cxIcon=GetSystemMetrics(SM_CXSIZE); CRect rect(0, 0, cxIcon, GetSystemMetrics(SM_CYSIZE)); rect.DeflateRect(2,1,0,1); DrawIconEx(pDC->m_hDC, rect.left, rect.top, hIcon, rect.Width(), rect.Height(), 0, NULL, DI_NORMAL); return cxIcon+2; } } return 2; } // Draw min, max/restore, close buttons. int COXCaptionPainter::DrawCaptionButtons(CDC* pDC, const COXCaptionInfo* pCI, const CSize* pCaptionSize) { <API key>(pCI); ASSERT(::IsWindow(m_hWndHooked)); CWnd& wnd=*GetHookedWnd(); ASSERT_VALID(pCI); ASSERT(pDC); int nButtonsWidth=0; DWORD dwStyle=wnd.GetStyle(); int cxIcon; int cyIcon; if((GetHookedWnd()->GetExStyle() & WS_EX_TOOLWINDOW)==WS_EX_TOOLWINDOW) { cxIcon=GetSystemMetrics(SM_CXSMSIZE); cyIcon=GetSystemMetrics(SM_CYSMSIZE); } else { cxIcon=GetSystemMetrics(SM_CXSIZE); cyIcon=GetSystemMetrics(SM_CYSIZE); } BOOL bCloseBox=(dwStyle & WS_SYSMENU)!=0; BOOL bMaxBox=bCloseBox & ((dwStyle&WS_MAXIMIZEBOX)!=0 || (dwStyle&WS_MINIMIZEBOX)!=0); BOOL bMinBox=bCloseBox & ((dwStyle&WS_MINIMIZEBOX)!=0 || (dwStyle&WS_MAXIMIZEBOX)!=0); BOOL bHelpBox=bCloseBox & !bMaxBox & !bMinBox & ((wnd.GetExStyle()&WS_EX_CONTEXTHELP)!=0); //changed 11/17/99 BOOL bCloseBoxGrayed=FALSE; BOOL bMaxBoxGrayed=FALSE; BOOL bMinBoxGrayed=FALSE; BOOL bHelpBoxGrayed=FALSE; // Draw caption buttons. These are all drawn inside a rectangle // of dimensions SM_CXSIZE by SM_CYSIZE CRect rect(pCaptionSize->cx-cxIcon, 0, pCaptionSize->cx, cyIcon); if(bCloseBox) { // Close box has a 2 pixel border on all sides but left, which is zero rect.DeflateRect(0,2,2,2); UINT nState=DFCS_CAPTIONCLOSE; nState|=(bCloseBoxGrayed?DFCS_INACTIVE:NULL); pDC->DrawFrameControl(&rect, DFC_CAPTION, nState); nButtonsWidth+=cxIcon; } // Max/restore button is like close box; just shift rectangle left if(bMaxBox) { ASSERT(bCloseBox); rect-=CPoint(cxIcon,0); UINT nState=wnd.IsZoomed() ? DFCS_CAPTIONRESTORE : DFCS_CAPTIONMAX; if((dwStyle&WS_MAXIMIZEBOX)==0) { ASSERT(bMinBox); nState|=DFCS_INACTIVE; } nState|=(bMaxBoxGrayed?DFCS_INACTIVE:NULL); pDC->DrawFrameControl(&rect, DFC_CAPTION, nState); nButtonsWidth+=cxIcon; } // Minimize button has 2 pixel border on all sides but right. if(bMinBox) { ASSERT(bCloseBox); rect-=CPoint(cxIcon-2,0); UINT nState=(wnd.IsIconic() ? DFCS_CAPTIONRESTORE : DFCS_CAPTIONMIN); if((dwStyle&WS_MINIMIZEBOX)==0) { ASSERT(bMaxBox); nState|=DFCS_INACTIVE; } nState|=(bMinBoxGrayed?DFCS_INACTIVE:NULL); pDC->DrawFrameControl(&rect, DFC_CAPTION, nState); nButtonsWidth+=cxIcon; } // help button, if any. if(bHelpBox) { ASSERT(bCloseBox); rect-=CPoint(cxIcon, 0); UINT nState=DFCS_CAPTIONHELP; nState|=(bHelpBoxGrayed?DFCS_INACTIVE:NULL); pDC->DrawFrameControl(&rect, DFC_CAPTION, nState); nButtonsWidth+=cxIcon; } return nButtonsWidth; } // Draw caption background. void COXCaptionPainter::DrawCaptionText(CDC* pDC, const COXCaptionInfo* pCI, const CSize* pCaptionSize, const CSize* pIndentsSize) { ASSERT(::IsWindow(m_hWndHooked)); CWnd& wnd=*GetHookedWnd(); ASSERT_VALID(pCI); ASSERT(pDC); int cxCap=pCaptionSize->cx-(pIndentsSize->cx+pIndentsSize->cy); int cyCap=pCaptionSize->cy; wnd.GetWindowText(m_sWindowText); if(m_sWindowText.IsEmpty() || cxCap<=0) return; CFont font; CFont* pOldFont=NULL; BOOL bUseFont=FALSE; LOGFONT lf; BOOL bResult=FALSE; if((GetHookedWnd()->GetExStyle() & WS_EX_TOOLWINDOW)==WS_EX_TOOLWINDOW) { bResult=pCI->GetSmCaptionLogFont(&lf); } else { bResult=pCI->GetCaptionLogFont(&lf); } if(bResult && font.CreateFontIndirect(&lf)) { pOldFont=pDC->SelectObject(&font); bUseFont=TRUE; } COLORREF clr=pCI->GetTextColor(m_bActive); pDC->SetTextColor(clr); CRect rect(pIndentsSize->cx,0,pIndentsSize->cx+cxCap,cyCap); // draw on top of our shading pDC->SetBkMode(TRANSPARENT); pDC->DrawText(m_sWindowText, &rect, pCI->GetTextFormat()); if(bUseFont) { ASSERT(pOldFont!=NULL); // Restore DC pDC->SelectObject(pOldFont); } } void COXCaptionPainter::GetCaptionRect(CRect& rect) { ASSERT(::IsWindow(m_hWndHooked)); CWnd& wnd=*GetHookedWnd(); DWORD dwStyle=wnd.GetStyle(); // Get size of frame around window CSize szFrame=(dwStyle & WS_THICKFRAME) ? CSize(GetSystemMetrics(SM_CXSIZEFRAME), GetSystemMetrics(SM_CYSIZEFRAME)) : CSize(GetSystemMetrics(SM_CXFIXEDFRAME), GetSystemMetrics(SM_CYFIXEDFRAME)); // Compute rectangle // window rect in screen coords wnd.GetWindowRect(rect); // shift origin to (0,0) rect-=CPoint(rect.left,rect.top); // frame rect.left+=szFrame.cx; // frame rect.right-=szFrame.cx; // top = end of frame rect.top+=szFrame.cy; // height of caption minus gray shadow border rect.bottom=rect.top+ (((GetHookedWnd()->GetExStyle() & WS_EX_TOOLWINDOW)==WS_EX_TOOLWINDOW) ? GetSystemMetrics(SM_CYSMCAPTION) : GetSystemMetrics(SM_CYCAPTION))- GetSystemMetrics(SM_CYBORDER); if(wnd.IsIconic()) { rect.InflateRect(1,1,1,-1); } } UINT COXCaptionPainter::GetNumColorBits() { ASSERT(::IsWindow(m_hWndHooked)); // get the number of bits in current system pallete CWindowDC dc(GetHookedWnd()); return dc.GetDeviceCaps(BITSPIXEL); } #ifndef OXCP_NO_SAVESTATE BOOL COXCaptionPainter::SaveState(LPCTSTR lpszProfileName) { #ifndef _MAC CWinApp* pApp=AfxGetApp(); // make sure you called CWinApp::SetRegistryKey() functions before if(pApp->m_pszRegistryKey==NULL || pApp->m_pszProfileName==NULL) { TRACE(_T("COXCaptionPainter::SaveState: haven't called SetRegistryKey()\n")); return FALSE; } // we use default registry key assigned to your application by MFC HKEY hSecKey=pApp->GetSectionKey(_T("")); if (hSecKey==NULL) { TRACE(_T("COXCaptionPainter::SaveState: unable to get section key\n")); return FALSE; } BOOL bResult=TRUE; try { COXRegistryValFile regActive(hSecKey, lpszProfileName, _T("Active")); CArchive arActive(&regActive, CArchive::store); m_ciActive.Serialize(arActive); arActive.Close(); COXRegistryValFile regInactive(hSecKey, lpszProfileName, _T("Inactive")); CArchive arInactive(&regInactive, CArchive::store); m_ciInactive.Serialize(arInactive); arInactive.Close(); } catch(CException* e) { <API key>(e); bResult=FALSE; } ::RegCloseKey(hSecKey); return bResult; #else return FALSE; #endif } BOOL COXCaptionPainter::LoadState(LPCTSTR lpszProfileName, BOOL bApply/*=TRUE*/) { #ifndef _MAC CWinApp* pApp=AfxGetApp(); // make sure you called CWinApp::SetRegistryKey() functions before if(pApp->m_pszRegistryKey==NULL || pApp->m_pszProfileName==NULL) { TRACE(_T("COXCaptionPainter::SaveState: haven't called SetRegistryKey()\n")); return FALSE; } // we use default registry key assigned to your application by MFC HKEY hSecKey=pApp->GetSectionKey(_T("")); if (hSecKey==NULL) { TRACE(_T("COXCaptionPainter::SaveState: unable to get section key\n")); return FALSE; } BOOL bResult=TRUE; try { COXRegistryValFile regActive(hSecKey, lpszProfileName, _T("Active")); if(regActive.GetLength()>0) { CArchive arActive(&regActive, CArchive::load); m_ciActive.Serialize(arActive); arActive.Close(); } COXRegistryValFile regInactive(hSecKey, lpszProfileName, _T("Inactive")); if(regInactive.GetLength()>0) { CArchive arInactive(&regInactive, CArchive::load); m_ciInactive.Serialize(arInactive); arInactive.Close(); } } catch(CException* e) { <API key>(e); bResult=FALSE; } ::RegCloseKey(hSecKey); if(bResult && bApply) { Reset(); CWnd* pWnd = GetHookedWnd(); if (pWnd != NULL) pWnd->SendMessage(WM_NCPAINT); } return bResult; #else return FALSE; #endif } #endif // OXCP_NO_SAVESTATE // Helper to paint rectangle with a color. static void PaintRect(CDC* pDC, int x, int y, int w, int h, COLORREF color) { CBrush brush(color); CBrush* pOldBrush = pDC->SelectObject(&brush); pDC->PatBlt(x, y, w, h, PATCOPY); pDC->SelectObject(pOldBrush); } BOOL IsSmallFont(BOOL& bIsSmall) { CWnd* pWnd=CWnd::GetDesktopWindow(); if(pWnd) { CDC* pDC=pWnd->GetWindowDC(); if(pDC) { TEXTMETRIC tm; if(pDC->GetTextMetrics(&tm)) { if(tm.tmHeight>16) { bIsSmall=FALSE; } else { bIsSmall=TRUE; } pWnd->ReleaseDC(pDC); return TRUE; } pWnd->ReleaseDC(pDC); } } return FALSE; } // static variables CMap<DWORD,DWORD,<API key>*,<API key>*> <API key>::<API key>; HHOOK <API key>::<API key>=NULL; HHOOK <API key>::<API key>=NULL; <API key>::~<API key>() { if(<API key>()) { DetachAllInThread(); } else { Detach(NULL); } int nCount= (int)m_arrUsedPainters.GetSize(); for(int nIndex=0; nIndex<nCount; nIndex++) { COXCaptionPainter* pPainter=m_arrUsedPainters[nIndex]; ASSERT(pPainter!=NULL); ASSERT(!pPainter->IsHooked()); delete pPainter; } m_arrUsedPainters.RemoveAll(); ASSERT(<API key>==NULL); ASSERT(m_pfnOldCBTHookProc==NULL); ASSERT(<API key>==NULL); } COXCaptionPainter* <API key>::Attach(CWnd* pWnd) { ASSERT(pWnd!=NULL); if(pWnd==NULL) return NULL; HWND hWndAttached=pWnd->GetSafeHwnd(); ASSERT(::IsWindow(hWndAttached)); COXCaptionPainter* pPainter=NULL; if(m_arrAttachedWnd.Lookup(hWndAttached,pPainter)) { ASSERT(pPainter!=NULL); TRACE(_T("<API key>::Attach: specified window already attached to a caption painter object\n")); return pPainter; } if(m_arrUsedPainters.GetSize()>0) { pPainter=m_arrUsedPainters[0]; ASSERT(pPainter!=NULL); ASSERT(!pPainter->IsHooked()); m_arrUsedPainters.RemoveAt(0); } else { pPainter=new COXCaptionPainter; } if(pPainter->Attach(pWnd)) { m_arrAttachedWnd.SetAt(hWndAttached,pPainter); return pPainter; } else { // save the object in the array of COXCaptionPainter objects // that can be used later m_arrUsedPainters.Add(pPainter); return NULL; } } BOOL <API key>::Detach(const CWnd* pWnd/*=NULL*/, BOOL bRedraw/*=TRUE*/) { if(pWnd==NULL) { POSITION pos=m_arrAttachedWnd.GetStartPosition(); HWND hAttachedWnd=NULL; COXCaptionPainter* pPainter=NULL; while(pos!=NULL) { m_arrAttachedWnd.GetNextAssoc(pos,hAttachedWnd,pPainter); ASSERT(::IsWindow(hAttachedWnd)); ASSERT(pPainter!=NULL); if(bRedraw) { WINDOWPOS wPos; ::ZeroMemory(&wPos, sizeof(wPos)); CRect rect; ::GetWindowRect(hAttachedWnd,&rect); wPos.cx=rect.Width(); wPos.cy=rect.Height(); wPos.x=rect.left; wPos.y=rect.top; wPos.hwnd=hAttachedWnd; wPos.flags=SWP_DRAWFRAME | SWP_FRAMECHANGED; ::SendMessage(hAttachedWnd,WM_WINDOWPOSCHANGED, NULL, (LPARAM) &wPos); HDC hDC=::GetWindowDC(hAttachedWnd); ::SendMessage(hAttachedWnd,WM_ERASEBKGND,(WPARAM) hDC, NULL); pPainter->Reset(); ::ReleaseDC(hAttachedWnd,hDC); } if(pPainter!=NULL) { if(pPainter->IsHooked()) pPainter->Detach(); // save the object in the array of COXCaptionPainter objects // that can be used later m_arrUsedPainters.Add(pPainter); } } m_arrAttachedWnd.RemoveAll(); } else { COXCaptionPainter* pPainter=NULL; CWnd* pAttachedWnd=(CWnd*)pWnd; if(!m_arrAttachedWnd.Lookup(pAttachedWnd->GetSafeHwnd(),pPainter)) return FALSE; ASSERT(pPainter!=NULL); m_arrAttachedWnd.RemoveKey(pAttachedWnd->GetSafeHwnd()); if(bRedraw && ::IsWindow(pAttachedWnd->GetSafeHwnd())) { pPainter->Reset(); pAttachedWnd->SendMessage(WM_NCPAINT); } if(pPainter!=NULL) { if(pPainter->IsHooked()) pPainter->Detach(); // save the object in the array of COXCaptionPainter objects // that can be used later m_arrUsedPainters.Add(pPainter); } } return TRUE; } BOOL <API key>::SetCaptionInfo(const CWnd* pWnd, COXCaptionInfo* pCI, BOOL bActive, BOOL bRedraw/*=TRUE*/) const { if(pWnd==NULL) { POSITION pos=m_arrAttachedWnd.GetStartPosition(); HWND hAttachedWnd=NULL; COXCaptionPainter* pPainter=NULL; while(pos!=NULL) { m_arrAttachedWnd.GetNextAssoc(pos,hAttachedWnd,pPainter); ASSERT(::IsWindow(hAttachedWnd)); ASSERT(pPainter!=NULL); if(pPainter!=NULL) pPainter->SetCaptionInfo(pCI,bActive); if(bRedraw) { pPainter->Reset(); ::SendMessage(hAttachedWnd,WM_NCPAINT,NULL,NULL); } } } else { COXCaptionPainter* pPainter=NULL; CWnd* pAttachedWnd=(CWnd*)pWnd; if(!m_arrAttachedWnd.Lookup(pAttachedWnd->GetSafeHwnd(),pPainter)) return FALSE; ASSERT(pPainter!=NULL); if(pPainter!=NULL) pPainter->SetCaptionInfo(pCI,bActive); if(bRedraw && ::IsWindow(pAttachedWnd->GetSafeHwnd())) { pPainter->Reset(); pAttachedWnd->SendMessage(WM_NCPAINT); } } return TRUE; } BOOL <API key>::Reset(CWnd* pWnd, BOOL bRedraw/*=TRUE*/) const { if(pWnd==NULL) { POSITION pos=m_arrAttachedWnd.GetStartPosition(); HWND hAttachedWnd=NULL; COXCaptionPainter* pPainter=NULL; while(pos!=NULL) { m_arrAttachedWnd.GetNextAssoc(pos,hAttachedWnd,pPainter); ASSERT(::IsWindow(hAttachedWnd)); ASSERT(pPainter!=NULL); if(pPainter!=NULL) pPainter->Reset(); if(bRedraw) { ::SendMessage(hAttachedWnd,WM_NCPAINT,NULL,NULL); } } } else { COXCaptionPainter* pPainter=NULL; CWnd* pAttachedWnd=(CWnd*)pWnd; if(!m_arrAttachedWnd.Lookup(pAttachedWnd->GetSafeHwnd(),pPainter)) return FALSE; ASSERT(pPainter!=NULL); if(pPainter!=NULL) pPainter->Reset(); if(bRedraw && ::IsWindow(pAttachedWnd->GetSafeHwnd())) { pAttachedWnd->SendMessage(WM_NCPAINT); } } return TRUE; } #ifndef OXCP_NO_SAVESTATE BOOL <API key>::LoadState(const CWnd* pWnd, LPCTSTR lpszProfileName, BOOL bApply/*=TRUE*/) { if(pWnd==NULL) { POSITION pos=m_arrAttachedWnd.GetStartPosition(); HWND hAttachedWnd=NULL; COXCaptionPainter* pPainter=NULL; while(pos!=NULL) { m_arrAttachedWnd.GetNextAssoc(pos,hAttachedWnd,pPainter); ASSERT(::IsWindow(hAttachedWnd)); ASSERT(pPainter!=NULL); if(pPainter!=NULL) pPainter->LoadState(lpszProfileName,bApply); } } else { COXCaptionPainter* pPainter=NULL; CWnd* pAttachedWnd=(CWnd*)pWnd; if(!m_arrAttachedWnd.Lookup(pAttachedWnd->GetSafeHwnd(),pPainter)) return FALSE; ASSERT(pPainter!=NULL); if(pPainter!=NULL) pPainter->LoadState(lpszProfileName,bApply); } return TRUE; } #endif // OXCP_NO_SAVESTATE COXCaptionPainter* <API key>::GetPainter(const CWnd* pWnd) const { ASSERT(pWnd!=NULL); if(pWnd==NULL) return NULL; COXCaptionPainter* pPainter=NULL; CWnd* pAttachedWnd=(CWnd*)pWnd; if(!m_arrAttachedWnd.Lookup(pAttachedWnd->GetSafeHwnd(),pPainter)) pPainter=NULL; return pPainter; } BOOL <API key>::IsAttached(const CWnd* pWnd) const { ASSERT(pWnd!=NULL); if(pWnd==NULL) return FALSE; COXCaptionPainter* pPainter=NULL; CWnd* pAttachedWnd=(CWnd*)pWnd; if(m_arrAttachedWnd.Lookup(pAttachedWnd->GetSafeHwnd(),pPainter)) { ASSERT(pPainter!=NULL); if(pPainter!=NULL) return TRUE; } return FALSE; } BOOL <API key>:: AttachAllInThread(DWORD dwThreadID/*=::GetCurrentThreadId()*/) { if(<API key>()) { TRACE(_T("<API key>::AttachAllInThread: this object already attached to a thread\n")); return FALSE; } <API key>* pOrganizer=NULL; if(<API key>.Lookup(dwThreadID,pOrganizer)) { ASSERT(pOrganizer!=NULL); TRACE(_T("<API key>::AttachAllInThread: specified thread already attached to a <API key> object\n")); return FALSE; } <API key>.SetAt(dwThreadID,this); m_dwThreadID=dwThreadID; // go through all windows and attach them ::EnumWindows(&EnumThreadWindows,(LPARAM)this); // setup hooks for Computer Based Training if(<API key>==NULL) { <API key>= ::SetWindowsHookEx(WH_CBT,<API key>,NULL,dwThreadID); m_pfnOldCBTHookProc=<API key>; } else { m_pfnOldCBTHookProc= ::SetWindowsHookEx(WH_CBT,<API key>,NULL,dwThreadID); } // setup hooks for GetMessage if(<API key>==NULL) { <API key>=::SetWindowsHookEx(WH_GETMESSAGE, <API key>,NULL,dwThreadID); <API key>=<API key>; } else { <API key>=::SetWindowsHookEx(WH_GETMESSAGE, <API key>,NULL,dwThreadID); } return TRUE; } void <API key>::AttachAllWindows(HWND hWndStartFrom) { ASSERT(hWndStartFrom!=NULL); HWND hWnd=hWndStartFrom; while(hWnd!=NULL) { CWnd* pWnd=CWnd::FromHandlePermanent(hWnd); if(pWnd!=NULL && !IsAttached(pWnd)) { Attach(pWnd); } // loop through children HWND hWndChild=::GetWindow(hWnd,GW_CHILD); if(hWndChild!=NULL) AttachAllWindows(hWndChild); // loop through windows hWnd=::GetWindow(hWnd,GW_HWNDNEXT); } } LRESULT CALLBACK <API key>:: <API key>(int nCode, WPARAM wParam, LPARAM lParam) { #if defined (_WINDLL) #if defined (_AFXDLL) AFX_MANAGE_STATE(<API key>()); #else AFX_MANAGE_STATE(<API key>()); #endif #endif if(nCode>=0 && ::IsWindow((HWND)wParam)) { DWORD dwThreadID=::<API key>((HWND)wParam,NULL); <API key>* pOrganizer=NULL; if(<API key>::<API key>. Lookup(dwThreadID,pOrganizer)) { ASSERT(pOrganizer!=NULL); ASSERT(pOrganizer-><API key>()); if(nCode==HCBT_DESTROYWND) { // check if the window that is about to be destroyed // had been added to caption organizer list CWnd* pWnd=CWnd::FromHandlePermanent((HWND)wParam); if(pWnd!=NULL && pOrganizer->IsAttached(pWnd)) pOrganizer->Detach(pWnd,FALSE); } else { // check if new window is created and attach it. CWnd* pWnd=CWnd::FromHandlePermanent((HWND)wParam); if(pWnd!=NULL && !pOrganizer->IsAttached(pWnd)) { POSITION pos=NULL; COXCaptionPainter* pPainter=pOrganizer->GetFirstPainter(pos); if(pOrganizer->Attach(pWnd)!=NULL && pPainter!=NULL) { COXCaptionPainter::SetCaptionPainter(pWnd,pPainter); } } } return ::CallNextHookEx(pOrganizer->GetSavedCBTHookProc(), nCode,wParam,lParam); } } return ::CallNextHookEx(<API key>::<API key>(), nCode,wParam,lParam); } LRESULT CALLBACK <API key>:: <API key>(int nCode, WPARAM wParam, LPARAM lParam) { #if defined (_WINDLL) #if defined (_AFXDLL) AFX_MANAGE_STATE(<API key>()); #else AFX_MANAGE_STATE(<API key>()); #endif #endif if(nCode>=0 && ::IsWindow(((MSG*)lParam)->hwnd)) { DWORD dwThreadID=::<API key>(((MSG*)lParam)->hwnd,NULL); <API key>* pOrganizer=NULL; if(<API key>:: <API key>.Lookup(dwThreadID,pOrganizer)) { ASSERT(pOrganizer!=NULL); ASSERT(pOrganizer-><API key>()); // check if new window is created and attach it. CWnd* pWnd=CWnd::FromHandlePermanent(((MSG*)lParam)->hwnd); if(pWnd!=NULL && !pOrganizer->IsAttached(pWnd)) { POSITION pos=NULL; COXCaptionPainter* pPainter=pOrganizer->GetFirstPainter(pos); if(pOrganizer->Attach(pWnd)!=NULL && pPainter!=NULL) { COXCaptionPainter::SetCaptionPainter(pWnd,pPainter); } } return ::CallNextHookEx(pOrganizer-><API key>(), nCode,wParam,lParam); } } return ::CallNextHookEx(<API key>::<API key>(), nCode,wParam,lParam); } BOOL CALLBACK <API key>::EnumThreadWindows(HWND hWnd, LPARAM lParam) { #if defined (_WINDLL) #if defined (_AFXDLL) AFX_MANAGE_STATE(<API key>()); #else AFX_MANAGE_STATE(<API key>()); #endif #endif ASSERT(lParam!=NULL); ASSERT(::IsWindow(hWnd)); <API key>* pOrganizer=(<API key>*)lParam; ASSERT(pOrganizer-><API key>()); DWORD dwThreadID=::<API key>(hWnd,NULL); if(dwThreadID==pOrganizer->GetAttachedThread()) { pOrganizer->AttachAllWindows(hWnd); return FALSE; } return TRUE; } BOOL <API key>::DetachAllInThread(BOOL bRedraw/*=TRUE*/) { if(!<API key>()) return FALSE; ASSERT(m_dwThreadID!=NULL); ASSERT(m_pfnOldCBTHookProc!=NULL); ASSERT(<API key>!=NULL); ASSERT(<API key>!=NULL); ASSERT(<API key>!=NULL); // unhook CBT if(m_pfnOldCBTHookProc!=NULL) { VERIFY(::UnhookWindowsHookEx(m_pfnOldCBTHookProc)); m_pfnOldCBTHookProc=NULL; <API key>=NULL; } // unhook GetMessage if(<API key>!=NULL) { VERIFY(::UnhookWindowsHookEx(<API key>)); <API key>=NULL; <API key>=NULL; } <API key>.RemoveKey(m_dwThreadID); m_dwThreadID=NULL; return Detach(NULL,bRedraw); }
layout: post title: 'Using Wiremock to Mock API Responses: Part 3 - Response Templating using Handlebars Helpers' date: '2021-10-18' author: Fred Muya excerpt: Making use of Wiremock's Response Templating for dynamic responses using Handlebars helpers tags: - wiremock - api - mock - response-templating - tutorial - wiremock tutorial - wiremock handlebars - handlebars In the previous 2 parts of this series, we: - [Part 1]({{ site.url }}/<API key>/): introduced Wiremock, and showed how it could be used to mock a simple response from a dummy "Songs API" - [Part 2]({{ site.url }}/<API key>/): showed how to return dynamic responses using details from the incoming request (i.e. request parameters) In this part, we'll continue with the topic of dynamic responses, but this time making use of Handlebars Helpers, as well as other built-in helpers, to generate even more dynamic responses. This post is full of practical examples to ease understanding of Handlebars usage. **Note:** Before proceeding, please ensure you've enabled response templating in Wiremock; this has been outlined in [Part 2]({{ site.url }}/<API key>/) of the series. Let's take another look at our Songs API response which we're using for a demo: {% highlight json %} { "metadata": { "searchQueryParam": "liked", "requestMethodType": "GET" }, "data": [ { "id": "<API key>", "songInfo": "Jam Now, Simmer Down - Blinky Bill", "likedOn": "2021-06-19", "listenCount": 34 }, { "id": "<API key>", "songInfo": "Dunia Ina Mambo - Just a Band", "likedOn": "2020-12-04", "listenCount": 182 } ] } {% endhighlight %} Let's say, for example, that we want the `songInfo` to be in `UPPER CASE`; i.e. have the API return: {% highlight json %} { "metadata": { "requestMethodType": "GET" }, "data": [ { "id": "<API key>", "songInfo": "JAM NOW, SIMMER DOWN - BLINKY BILL", "likedOn": "2021-06-19", "listenCount": 34 }, { "id": "<API key>", "songInfo": "DUNIA INA MAMBO - JUST A BAND", "likedOn": "2020-12-04", "listenCount": 182 } ] } {% endhighlight %} We can make use of the `upper` helper which is enabled by Handlebars: {% highlight json %} { "metadata": { }, "request": { "method": "ANY", "urlPattern": "/api/songs\\?dynamic=true" }, "response": { "jsonBody": { "metadata": { "searchQueryParam": "{% raw %}{{ request.query.search.0 }}{% endraw %}", "requestMethodType": "{% raw %}{{ request.method }}{% endraw %}" }, "data": [ { "id": "<API key>", "songInfo": "{% raw %}{{ upper 'Jam Now, Simmer Down - Blinky Bill' }}{% endraw %}", "likedOn": "2021-06-19", "listenCount": 34 }, { "id": "<API key>", "songInfo": "{% raw %}{{ upper 'Dunia Ina Mambo - Just a Band' }}{% endraw %}", "likedOn": "2020-12-04", "listenCount": 182 } ] } } } {% endhighlight %} **Note:** we're using a new URL pattern (`dynamic=true`) to allow differentiation between this and the previous version in Part 2. Handlebars also provides a helper to get the current timestamp. For example, let's say we wanted to add a `"requestedAt"` field to the response metadata. For this, we can use the `now` helper: {% highlight json %} { "metadata": { }, "request": { }, "response": { "jsonBody": { "metadata": { "requestedAt": "{% raw %}{{ now }}{% endraw %}" }, "data": [ { }, { } ] } } } {% endhighlight %} The response would be: {% highlight json %} { "metadata": { "requestMethodType": "GET", "requestedAt": "2021-09-26T20:31:32Z" }, "data": [ { "id": "<API key>", "songInfo": "JAM NOW, SIMMER DOWN - BLINKY BILL", "likedOn": "Monday, June 21, 2021", "listenCount": 34 }, { "id": "<API key>", "songInfo": "DUNIA INA MAMBO - JUST A BAND", "likedOn": "Saturday, December 4, 2021", "listenCount": 182 } ] } {% endhighlight %} Handlebars also provides date helpers to allow for formatting of timestamps. For example, let's say we wanted the `likedOn` date format to be something like 'Saturday, 4th December, 2021'. To do this, we can use the `dateFormat` helper: {% highlight json %} { "metadata": { }, "request": { "method": "ANY", "urlPattern": "/api/songs\\?dynamic=true" }, "response": { "jsonBody": { "data": [ { "id": "<API key>", "songInfo": "{% raw %}{{ upper 'Jam Now, Simmer Down - Blinky Bill' }}{% endraw %}", "likedOn": "{% raw %}{{ dateFormat '2021-06-19' full }}{% endraw %}", "listenCount": 34 }, { "id": "<API key>", "songInfo": "{% raw %}{{ upper 'Dunia Ina Mambo - Just a Band' }}{% endraw %}", "likedOn": "{% raw %}{{ dateFormat '2020-12-04' full }}{% endraw %}", "listenCount": 182 } ] } } } {% endhighlight %} This would produce: {% highlight json %} { "metadata": { "requestMethodType": "GET", "requestedAt": "2021-10-17T15:27:32Z" }, "data": [ { "id": "<API key>", "songInfo": "JAM NOW, SIMMER DOWN - BLINKY BILL", "likedOn": "Monday, June 21, 2021", "listenCount": 34 }, { "id": "<API key>", "songInfo": "DUNIA INA MAMBO - JUST A BAND", "likedOn": "Saturday, December 4, 2021", "listenCount": 182 } ] } {% endhighlight %} `upper`, `now`, `dateFormat` are only a subset of all the available helpers. For a full list, check out the [`StringHelpers.java`](https://github.com/jknack/handlebars.java/blob/master/handlebars/src/main/java/com/github/jknack/handlebars/helper/StringHelpers.java) file on the Handlebars repo. Additionally, I've provided a "kitchen sink" API that demonstrates all of these helpers. {% highlight json %} { "metadata": { "description": "Provides a demo API utilizing all the supported Handlebars String Helpers in Wiremock", "blogPost": "https://blog.muya.co.ke/<API key>/" }, "request": { "method": "GET", "urlPattern": "/<API key>" }, "response": { "status": 200, "headers": { "Content-Type": "application/json" }, "jsonBody": { "abbreviate": "{% raw %}{{ abbreviate 'Truncate long sentence up to # of characters and add ellipses' 28 }}{% endraw %}", "capitalize": { "capitalize first letter of all words": "{% raw %}{{ capitalize 'ONLY first letter capitalized' }}{% endraw %}", "capitalize first letter of all words AND lower case other characters": "{% raw %}{{ capitalize 'FULLY first letter capitalized' fully=true }}{% endraw %}" }, "capitalizeFirst": "{% raw %}{{ capitalize 'only first string' }}{% endraw %}", "center": { "center a string": "{% raw %}{{ center '<API key>' size=40 }}{% endraw %}", "center string with padding": "{% raw %}{{ center '<API key>' size=40 pad='*' }}{% endraw %}" }, "cut": { "remove number 7 from a string": "{% raw %}{{ cut 'string 7 with 7 number 7s' '7' }}{% endraw %}", "remove spaces from a string": "{% raw %}{{ cut 'string with spaces' }}{% endraw %}" }, "dateFormat": { "display current date and time in custom format": "{% raw %}{{ dateFormat (now) format='yyyy-MM-dd HH:mm:ss'}}{% endraw %}", "display current date in full format": "{% raw %}{{ dateFormat (now) format='full' }}{% endraw %}", "display current date in medium format": "{% raw %}{{ dateFormat (now) format='medium' }}{% endraw %}", "display current date in short format": "{% raw %}{{ dateFormat (now) format='short' }}{% endraw %}", "parse timestamp from value in specific format, and display in full format": "{% raw %}{{ dateFormat (parseDate '2021-06-21' format='yyyy-MM-dd') format='full' }}{% endraw %}" }, "defaultIfEmpty": { "set NOTHING as value provided value is empty ": "{% raw %}{{ defaultIfEmpty '' 'NOTHING' }}{% endraw %}", "set empty string if value provided is empty": "{% raw %}{{ defaultIfEmpty '' }}{% endraw %}" }, "join": { "join a list of items with custom joiner (last item in list is considered the joiner)": "{% raw %}{{ join 'a' 'b' '-' }}{% endraw %}", "join a list of items with custom joiner and prefix": "{% raw %}{{ join 'a' 'b' '-' prefix='[' }}{% endraw %}", "join a list of items with custom joiner and suffix": "{% raw %}{{ join 'a' 'b' '-' suffix=']' }}{% endraw %}", "join a list of items with custom joiner, prefix and suffix": "{% raw %}{{ join 'a' 'b' '-' prefix='[' suffix=']' }}{% endraw %}" }, "ljust": { "left align a given string in a 30 width space": "{% raw %}{{ ljust 'left aligned' size=30 }}{% endraw %}", "left align a given string in a 30 width space with padding": "{% raw %}{{ ljust 'left aligned' size=30 pad='*' }}{% endraw %}" }, "lower": "{% raw %}{{ lower 'CHANGE VALUE TO LOWER CASE' }}{% endraw %}", "now": { "display current date time": "{% raw %}{{ now }}{% endraw %}", "display current date time in custom format": "{% raw %}{{ now format='yyyy-MM-dd HH:mm:ss.SSSSSS' tz='Africa/Nairobi' }}{% endraw %}" }, "numberFormat": { "format number in currency format": "{% raw %}{{ numberFormat 30 'currency' }}{% endraw %}", "format number in currency format with locale": "{% raw %}{{ numberFormat 30 'currency' 'fr'}}{% endraw %}", "format number in custom decimal format": "{% raw %}{{ numberFormat 3000000 ' "format number in integer format": "{% raw %}{{ numberFormat 30 'integer' }}{% endraw %}", "format number in percent format": "{% raw %}{{ numberFormat 30 'percent' }}{% endraw %}", "format number with defined maximum integer and fraction digits": "{% raw %}{{ numberFormat 4542.3733 <API key>=3 <API key>=2 }}{% endraw %}", "format number with defined minimum integer and fraction digits": "{% raw %}{{ numberFormat 0.37 <API key>=3 <API key>=2 }}{% endraw %}" }, "replace": "{% raw %}{{ replace 'Replaces placeholder with another string' 'another string' 'provided replacement' }}{% endraw %}", "rjust": { "right align a given string in a 30 width space": "{% raw %}{{ rjust 'right aligned' size=30 }}{% endraw %}", "right align a given string in a 30 width space with padding": "{% raw %}{{ rjust 'right aligned' size=30 pad='*' }}{% endraw %}" }, "slugify": "{% raw %}{{ slugify 'Creates A Slug Useful For Blog Post URLs' }}{% endraw %}", "stringFormat": { "boolean": "{% raw %}{{ stringFormat 'isSet: %b isNotSet: %b' 'yes' null }}{% endraw %}", "string": "{% raw %}{{ stringFormat 'applies %s formatting capabilities. All Java formatting options supported.' 'string' }}{% endraw %}" }, "stripTags": "{% raw %}{{ stripTags '<span>Removes all (X)HTML tags</span>' }}{% endraw %}", "substring": { "substring from 3rd (exclusive) to 7th character": "{% raw %}{{ substring '0123456789' 3 7 }}{% endraw %}", "substring from 5th character (exclusive)": "{% raw %}{{ substring '0123456789' 5 }}{% endraw %}" }, "upper": "{% raw %}{{ upper 'change value to upper case' }}{% endraw %}", "yesno": { "set true/false/null to yes/no/maybe": "{% raw %}{{ yesno true }} | {{ yesno false }} | {{ yesno null }}{% endraw %}", "set true/false/null to ndio/hapana/labda (Swahili)": "{% raw %}{{ yesno true yes='ndio' }} | {{ yesno false no='hapana' }} | {{ yesno null maybe='labda' }}{% endraw %}", "set true/false/null to sí/no/quizás (Spanish)": "{% raw %}{{ yesno true yes='sí' }} | {{ yesno false no='no' }} | {{ yesno null maybe='quizás' }}{% endraw %}" } } } } {% endhighlight %} NB: Some special notes on exclusions from the kitchen sink: - There seems to be a bug with handling of JSON that has special characters (e.g. newline characters) between Handlebars and Wiremock. As a result, the following helpers have not been added to the kitchen sink: `wordWrap` - `numberFormat` has flags for `parseIntegerOnly` and `roundingMode`, but these don't seem to be in use We'll use these exclusions as use-cases later in this series to build custom extensions for Wiremock. ## Summary In this part of the series, we dove deeper into Response Templating in Wiremock, seeing how to make use of Handlebars Helpers to enable us to generate even more dynamic responses. We also showed how (almost) all of the string helpers can be used via a "Kitchen Sink API" (this is available on this series' accompanying repository on GitHub: [`<API key>`](https://github.com/muya/<API key>)). ## References Shout out to [rodolpheche](https://github.com/rodolpheche/wiremock-docker) for building and maintaining the Wiremock docker image. All the code used in this blog post is available in this repository: [<API key>](https://github.com/muya/<API key>) ## Coming in Part 4: Using Custom Extensions in Wiremock In the next part, we'll see how to load custom extensions to Wiremock, for when we want to enable very customized functionality in our mocked APIs. We'll use the custom extensions to go around some of the exclusions noted above. Until then, happy coding, and stay safe!
<footer class="site-footer"> <nav class="wrapper"> <ul class="nav-footer"> <li class="<API key>"> <a href="/about/" class="nav-footer__item"> About Frend </a> </li> <li class="<API key>"> <a href="https://github.com/frend/frend.co" class="nav-footer__item" target="_blank" title="Link opens in an external window"> Frend on GitHub </a> </li> <li class="<API key>"> <a href="https://twitter.com/ffffrend" class="nav-footer__item" target="_blank" title="Link opens in an external window"> <span aria-hidden="true">@ffffrend</span><span class="visually-hidden">Frend on Twitter</span> </a> </li> </ul> </nav> </footer>