text:
--TEST--
Test rawurlencode() function : usage variations  - unexpected type for arg 1.
--FILE--
<?php
/* Prototype  : proto string rawurlencode(string str)
 * Description: URL-encodes string
 * Source code: ext/standard/url.c
 * Alias to functions:
 */

// NB: basic functionality tested in tests/strings/001.phpt

function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
	echo "Error: $err_no - $err_msg, $filename($linenum)\n";
}
set_error_handler('test_error_handler');

echo "*** Testing rawurlencode() : usage variations ***\n";

// Initialise function arguments not being substituted (if any)

//get an unset variable
$unset_var = 10;
unset ($unset_var);

//array of values to iterate over
$values = array(

      // int data
      0,
      1,
      12345,
      -2345,

      // float data
      10.5,
      -10.5,
      10.1234567e10,
      10.7654321E-10,
      .5,

      // array data
      array(),
      array(0),
      array(1),
      array(1, 2),
      array('color' => 'red', 'item' => 'pen'),

      // null data
      NULL,
      null,

      // boolean data
      true,
      false,
      TRUE,
      FALSE,

      // empty data
      "",
      '',

      // object data
      new stdclass(),

      // undefined data
      $undefined_var,

      // unset data
      $unset_var,
);

// loop through each element of the array for str

foreach($values as $value) {
      echo "\nArg value $value \n";
      var_dump( rawurlencode($value) );
};

echo "Done";
?>
--EXPECTF--
*** Testing rawurlencode() : usage variations ***
Error: 8 - Undefined variable: undefined_var, %s(64)
Error: 8 - Undefined variable: unset_var, %s(67)

Arg value 0
string(1) "0"

Arg value 1
string(1) "1"

Arg value 12345
string(5) "12345"

Arg value -2345
string(5) "-2345"

Arg value 10.5
string(4) "10.5"

Arg value -10.5
string(5) "-10.5"

Arg value 101234567000
string(12) "101234567000"

Arg value 1.07654321E-9
string(13) "1.07654321E-9"

Arg value 0.5
string(3) "0.5"
Error: 8 - Array to string conversion, %srawurlencode_variation_001.php(%d)

Arg value Array
Error: 2 - rawurlencode() expects parameter 1 to be string, array given, %s(74)
NULL
Error: 8 - Array to string conversion, %srawurlencode_variation_001.php(%d)

Arg value Array
Error: 2 - rawurlencode() expects parameter 1 to be string, array given, %s(74)
NULL
Error: 8 - Array to string conversion, %srawurlencode_variation_001.php(%d)

Arg value Array
Error: 2 - rawurlencode() expects parameter 1 to be string, array given, %s(74)
NULL
Error: 8 - Array to string conversion, %srawurlencode_variation_001.php(%d)

Arg value Array
Error: 2 - rawurlencode() expects parameter 1 to be string, array given, %s(74)
NULL
Error: 8 - Array to string conversion, %srawurlencode_variation_001.php(%d)

Arg value Array
Error: 2 - rawurlencode() expects parameter 1 to be string, array given, %s(74)
NULL

Arg value
string(0) ""

Arg value
string(0) ""

Arg value 1
string(1) "1"

Arg value
string(0) ""

Arg value 1
string(1) "1"

Arg value
string(0) ""

Arg value
string(0) ""

Arg value
string(0) ""
Error: 4096 - Object of class stdClass could not be converted to string, %s(73)

Arg value
Error: 2 - rawurlencode() expects parameter 1 to be string, object given, %s(74)
NULL

Arg value
string(0) ""

Arg value
string(0) ""
Done


text:
package de.ehmkah.projects.service_example.soap_service;

import com.ehmkah.services.gardening.Wsgardening;
import org.apache.cxf.bus.spring.SpringBus;
import org.apache.cxf.jaxws.EndpointImpl;
import org.apache.cxf.transport.servlet.CXFServlet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.ws.config.annotation.EnableWs;

import javax.xml.ws.Endpoint;

/**
 * @author Michael Krausse (ehmkah)
 */
@EnableWs
@Configuration
public class WebServiceConfiguration {

  @Autowired
  private Wsgardening gardeningServiceV1;

  @Bean(name = "cxf")
  public SpringBus springBus() {
    return new SpringBus();
  }

  @Bean("endpointServiceV1")
  public Endpoint endpointServiceV1(SpringBus springBus) {
    EndpointImpl result = new EndpointImpl(springBus, gardeningServiceV1);
    result.setWsdlLocation("classpath:/wsdl/serviceDefinitionV2.wsdl");
    result.publish("/service");

    return result;
  }

  @Bean
  public ServletRegistrationBean servletRegistrationBean() {
    String url = "/overview/*";
    ServletRegistrationBean result = new ServletRegistrationBean(new CXFServlet(), url);
    result.setLoadOnStartup(1);
    return result;
  }

}

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Altumo\Test;

/**
* Unit tests for the \Altumo\Validation\Emails class.
*
* @author Steve Sperandeo <steve.sperandeo@altumo.com>
*/
class EmailsTest extends \Altumo\Test\UnitTest{

    /**
    * Read each line in the test suite files:
    *   test_data/email_valid.txt
    *   test_data/email_invalid.txt
    *
    * Each line in the valid urls should not throw an exception.
    * Each line in the invalid urls should throw an exception.
    *
    * @thanks to http://blogs.msdn.com/b/testing123/archive/2009/02/05/email-address-test-cases.aspx
    *
    */
    public function testTestValidAndInvalidTestSuites(){

        $valid_emails = file_get_contents( __DIR__ . '/test_data/email_valid.txt' );
        $valid_emails = explode("\n", $valid_emails);

        foreach( $valid_emails as $valid_email ){
            try{
                //good email: shouldn't throw
                $url = \Altumo\Validation\Emails::assertEmailAddress( $valid_email );
                $this->assertTrue( true );
            }catch( \Exception $e ){
                $this->assertTrue( false, $valid_email );
            }
        }

        $invalid_emails = file_get_contents( __DIR__ . '/test_data/email_invalid.txt' );
        $invalid_emails = explode("\n", $invalid_emails);

        foreach( $invalid_emails as $invalid_email ){
            try{
                //bad email: should throw exception
                $url = \Altumo\Validation\Emails::assertEmailAddress( $invalid_email );
                $this->assertTrue( false, $invalid_email );
            }catch( \Exception $e ){
                $this->assertTrue( true );
            }
        }

    }

}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale='1.0'">
    <title>Βασίλης Ιωαννίδης</title>
    <link rel="stylesheet" href="assets/css/main.css">
    <link rel="stylesheet" href="assets/css/pages/projects.css">
    <link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700" rel="stylesheet" type="text/css">
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

Βασίλης Ιωαννίδης

label

Αρχική

Λυμμένες Ασκήσεις

Projects

Πληροφορίες


text:
test_description='compare & swap push force/delete safety'

. ./test-lib.sh

setup_srcdst_basic () {
	rm -fr src dst &&
	git clone --no-local . src &&
	git clone --no-local src dst &&
	(
		cd src && git checkout HEAD^0
	)
}

test_expect_success setup '
	# create template repository
	test_commit A &&
	test_commit B &&
	test_commit C
'

test_expect_success 'push to update (protected)' '
	setup_srcdst_basic &&
	(
		cd dst &&
		test_commit D &&
		test_must_fail git push --force-with-lease=master:master origin master 2>err &&
		grep "stale info" err
	) &&
	git ls-remote . refs/heads/master >expect &&
	git ls-remote src refs/heads/master >actual &&
	test_cmp expect actual
'

test_expect_success 'push to update (protected, forced)' '
	setup_srcdst_basic &&
	(
		cd dst &&
		test_commit D &&
		git push --force --force-with-lease=master:master origin master 2>err &&
		grep "forced update" err
	) &&
	git ls-remote dst refs/heads/master >expect &&
	git ls-remote src refs/heads/master >actual &&
	test_cmp expect actual
'

test_expect_success 'push to update (protected, tracking)' '
	setup_srcdst_basic &&
	(
		cd src &&
		git checkout master &&
		test_commit D &&
		git checkout HEAD^0
	) &&
	git ls-remote src refs/heads/master >expect &&
	(
		cd dst &&
		test_commit E &&
		git ls-remote . refs/remotes/origin/master >expect &&
		test_must_fail git push --force-with-lease=master origin master &&
		git ls-remote . refs/remotes/origin/master >actual &&
		test_cmp expect actual
	) &&
	git ls-remote src refs/heads/master >actual &&
	test_cmp expect actual
'

test_expect_success 'push to update (protected, tracking, forced)' '
	setup_srcdst_basic &&
	(
		cd src &&
		git checkout master &&
		test_commit D &&
		git checkout HEAD^0
	) &&
	(
		cd dst &&
		test_commit E &&
		git ls-remote . refs/remotes/origin/master >expect &&
		git push --force --force-with-lease=master origin master
	) &&
	git ls-remote dst refs/heads/master >expect &&
	git ls-remote src refs/heads/master >actual &&
	test_cmp expect actual
'

test_expect_success 'push to update (allowed)' '
	setup_srcdst_basic &&
	(
		cd dst &&
		test_commit D &&
		git push --force-with-lease=master:master^ origin master
	) &&
	git ls-remote dst refs/heads/master >expect &&
	git ls-remote src refs/heads/master >actual &&
	test_cmp expect actual
'

test_expect_success 'push to update (allowed, tracking)' '
	setup_srcdst_basic &&
	(
		cd dst &&
		test_commit D &&
		git push --force-with-lease=master origin master 2>err &&
		! grep "forced update" err
	) &&
	git ls-remote dst refs/heads/master >expect &&
	git ls-remote src refs/heads/master >actual &&
	test_cmp expect actual
'

test_expect_success 'push to update (allowed even though no-ff)' '
	setup_srcdst_basic &&
	(
		cd dst &&
		git reset --hard HEAD^ &&
		test_commit D &&
		git push --force-with-lease=master origin master 2>err &&
		grep "forced update" err
	) &&
	git ls-remote dst refs/heads/master >expect &&
	git ls-remote src refs/heads/master >actual &&
	test_cmp expect actual
'

test_expect_success 'push to delete (protected)' '
	setup_srcdst_basic &&
	git ls-remote src refs/heads/master >expect &&
	(
		cd dst &&
		test_must_fail git push --force-with-lease=master:master^ origin :master
	) &&
	git ls-remote src refs/heads/master >actual &&
	test_cmp expect actual
'

test_expect_success 'push to delete (protected, forced)' '
	setup_srcdst_basic &&
	(
		cd dst &&
		git push --force --force-with-lease=master:master^ origin :master
	) &&
	git ls-remote src refs/heads/master >actual &&
	test_must_be_empty actual
'

test_expect_success 'push to delete (allowed)' '
	setup_srcdst_basic &&
	(
		cd dst &&
		git push --force-with-lease=master origin :master 2>err &&
		grep deleted err
	) &&
	git ls-remote src refs/heads/master >actual &&
	test_must_be_empty actual
'

test_expect_success 'cover everything with default force-with-lease (protected)' '
	setup_srcdst_basic &&
	(
		cd src &&
		git branch naster master^
	) &&
	git ls-remote src refs/heads/\* >expect &&
	(
		cd dst &&
		test_must_fail git push --force-with-lease origin master master:naster
	) &&
	git ls-remote src refs/heads/\* >actual &&
	test_cmp expect actual
'

test_expect_success 'cover everything with default force-with-lease (allowed)' '
	setup_srcdst_basic &&
	(
		cd src &&
		git branch naster master^
	) &&
	(
		cd dst &&
		git fetch &&
		git push --force-with-lease origin master master:naster
	) &&
	git ls-remote dst refs/heads/master |
	sed -e "s/master/naster/" >expect &&
	git ls-remote src refs/heads/naster >actual &&
	test_cmp expect actual
'

test_expect_success 'new branch covered by force-with-lease' '
	setup_srcdst_basic &&
	(
		cd dst &&
		git branch branch master &&
		git push --force-with-lease=branch origin branch
	) &&
	git ls-remote dst refs/heads/branch >expect &&
	git ls-remote src refs/heads/branch >actual &&
	test_cmp expect actual
'

test_expect_success 'new branch covered by force-with-lease (explicit)' '
	setup_srcdst_basic &&
	(
		cd dst &&
		git branch branch master &&
		git push --force-with-lease=branch: origin branch
	) &&
	git ls-remote dst refs/heads/branch >expect &&
	git ls-remote src refs/heads/branch >actual &&
	test_cmp expect actual
'

test_expect_success 'new branch already exists' '
	setup_srcdst_basic &&
	(
		cd src &&
		git checkout -b branch master &&
		test_commit F
	) &&
	(
		cd dst &&
		git branch branch master &&
		test_must_fail git push --force-with-lease=branch: origin branch
	)
'

test_expect_success 'background updates of REMOTE can be mitigated with a non-updated REMOTE-push' '
	rm -rf src dst &&
	git init --bare src.bare &&
	test_when_finished "rm -rf src.bare" &&
	git clone --no-local src.bare dst &&
	test_when_finished "rm -rf dst" &&
	(
		cd dst &&
		test_commit G &&
		git remote add origin-push ../src.bare &&
		git push origin-push master:master
	) &&
	git clone --no-local src.bare dst2 &&
	test_when_finished "rm -rf dst2" &&
	(
		cd dst2 &&
		test_commit H &&
		git push
	) &&
	(
		cd dst &&
		test_commit I &&
		git fetch origin &&
		test_must_fail git push --force-with-lease origin-push &&
		git fetch origin-push &&
		git push --force-with-lease origin-push
	)
'

test_done


text:
import wallaby.FX as FX

from wallaby.qt_combat import *

import sys

from ..baseWidget import *
from ..logics import *

from wallaby.pf.peer.booleanViewer import *
from wallaby.pf.peer.booleanEditor import *

class PushButton(QtGui.QPushButton, BaseWidget, EnableLogic, ViewLogic, EditLogic, TriggeredPillowsLogic):
    __metaclass__ = QWallabyMeta

    def __init__(self, *args):
        QtGui.QPushButton.__init__(self, *args)
        BaseWidget.__init__(self, QtGui.QPushButton, *args)
        EnableLogic.__init__(self)
        ViewLogic.__init__(self, BooleanViewer, self.setChecked)
        EditLogic.__init__(self, BooleanEditor, self.isChecked)

        self.released.connect(self._released)
        self.setFocusPolicy(QtCore.Qt.StrongFocus)

    def deregister(self, remove=False):
        EnableLogic.deregister(self, remove)
        ViewLogic.deregister(self, remove)
        EditLogic.deregister(self, remove)

    def register(self):
        EnableLogic.register(self)
        ViewLogic.register(self)
        EditLogic.register(self)

    def _released(self):
        if self._editor: self._editor._fieldChanged()


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>The Royal Game of Ur</title>
  <link href="css/bootstrap.min.css" rel="stylesheet">
  <link href="css/main.css" rel="stylesheet">

            <button id="black-in" @click="processClick" class="btn in-out" :class="{ 'btn-default': !isBlack, 'btn-primary': isBlack }" :disabled="!isBlack">

            {{ boardState.in.black }}
            </button>

            <button id="black-out" class="btn btn-default in-out" disabled="true">

            {{ boardState.out.black }}
            </button>

            <button id="white-out" class="btn btn-default in-out" disabled="true">

            {{ boardState.out.white }}
            </button>

            <button id="white-in" @click="processClick" class="btn in-out" :class="{ 'btn-default': !isWhite, 'btn-primary': isWhite }" :disabled="!isWhite">

            {{ boardState.in.white }}
            </button>

{{ sideDisplay }}'s move

            <button :disabled="currentRoll >= 0" class="btn btn-primary" type="button" @click="rollDice">
                Roll Dice = 0" class="badge">{{ currentRoll }}
            </button>

{{ errorMessage }}


text:
namespace Burrows.Saga
{
    using System;
    using System.Collections.Generic;
    using Configuration;
    using Context;
    using Magnum.Extensions;
    using Magnum.StateMachine;

    public static class ExtensionsToStateMachine
    {
        public static DataEventAction<T, TData> Publish<T, TData, TMessage>(this DataEventAction<T, TData> eventAction,
            Func<T, TData, TMessage> action)
            where T : SagaStateMachine<T>, ISaga
            where TData : class
            where TMessage : class
        {
            eventAction.Call((saga, message) => saga.Bus.Publish(action(saga, message)));
            return eventAction;
        }

        public static BasicEventAction<T> Publish<T, TMessage>(this BasicEventAction<T> eventAction,
            Func<T, TMessage> action)
            where T : SagaStateMachine<T>, ISaga
            where TMessage : class
        {
            Action<T> f = saga => saga.Bus.Publish(action(saga));
            eventAction.Call(saga => f(saga));
            return eventAction;
        }

        public static DataEventAction<T, TData> RespondWith<T, TData, TMessage>(
            this DataEventAction<T, TData> eventAction, Func<T, TData, TMessage> action)
            where T : SagaStateMachine<T>, ISaga
            where TData : class
            where TMessage : class
        {
            eventAction.Call((saga, message) => ContextStorage.Context().Respond(action(saga, message)));
            return eventAction;
        }

        public static DataEventAction<T, TData> RetryLater<T, TData>(this DataEventAction<T, TData> eventAction)
            where T : SagaStateMachine<T>, ISaga
            where TData : class
        {
            eventAction.Call((saga, message) => ContextStorage.MessageContext<TData>().RetryLater());
            return eventAction;
        }

        public static void EnumerateDataEvents<T>(this T saga, Action<Type> messageAction)
            where T : SagaStateMachine<T>, ISaga
        {
            var inspector = new SagaStateMachineEventInspector<T>();
            saga.Inspect(inspector);

            inspector.GetResults().Each(x => { messageAction(x.SagaEvent.MessageType); });
        }

        public static void EnumerateDataEvents<T>(this T saga, Action<SagaEvent<T>, IEnumerable<State>> messageAction)
            where T : SagaStateMachine<T>, ISaga
        {
            var inspector = new SagaStateMachineEventInspector<T>();
            saga.Inspect(inspector);

            inspector.GetResults().Each(x => { messageAction(x.SagaEvent, x.States); });
        }
    }
}


text:
namespace Sarene
{
	class GraphicsContext
	{
	public:
		virtual void Init() = 0;
		virtual void SwapBuffers() = 0;
	};
}


text:
ACCEPTED

#### According to
International Plant Names Index

#### Published in
null

#### Original name
Polylychnis fulgens Bremek.

### Remarks
null


text:
using namespace std;
using namespace utils;

double MCTS::UCB[UCB_N][UCB_n];
bool MCTS::InitialisedFastUCB = false;

MCTS::PARAMS::PARAMS()
    : Verbose(0),
      MaxDepth(100),
      NumSimulations(1000),
      NumStartStates(1000),
      UseTransforms(true),
      UseParticleFilter(false),
      NumTransforms(0),
      MaxAttempts(0),
      ReuseTree(false),
      ThompsonSampling(false),
      TimeOutPerAction(-1),
      Polling(true),
      Stack(true),
      LocalReward(false),
      ActionAbstraction(true),
      Hplanning(false),
      MemoryLess(false) { }

MCTS::MCTS(const SIMULATOR &simulator, const PARAMS &params, int first_observation)
    : Simulator(simulator), History(first_observation),
      Params(params), TreeDepth(0), TreeSize(0) {
}

MCTS::~MCTS() {
}

void MCTS::InitFastUCB() {
  cout << "Initialising fast UCB table... ";

  for (int N = 0; N < UCB_N; ++N)
    for (int n = 0; n < UCB_n; ++n)
      if (n == 0)
        UCB[N][n] = Infinity;
      else
        UCB[N][n] = sqrt(log(N + 1) / n);

  cout << "done" << endl;
  InitialisedFastUCB = true;
}

double MCTS::FastUCB(int N, int n, double exploration) const {
  if (InitialisedFastUCB && N < UCB_N && n < UCB_n)
    return n == 0? Infinity: exploration * UCB[N][n];

  return n == 0? Infinity: exploration * sqrt(log(N + 1) / n);
}

void MCTS::Search() {
  TreeDepth = 0;
  TreeSize = 0;

  if (Params.TimeOutPerAction > 0.0) {  // Anytime mode
    boost::timer timer;
    int i = 0;

    while (1) {
      i += 1;
      SearchImp();

      if (timer.elapsed() > Params.TimeOutPerAction) {
        break;
      }
    }
  } else {
    for (int i = 0; i < Params.NumSimulations; i++)
    {
      SearchImp();
    }
  }
}


text:
using Caliburn.Micro.FluentValidation.Utils;
using System;
using System.Linq.Expressions;
using FluentValidation;
using FluentValidation.Results;
using System.ComponentModel;
using System.Collections.Generic;
using System.Linq;

namespace Caliburn.Micro.FluentValidation
{

    /// <summary>
    /// A base implementation of IScreen and IDataErrorInfo. Use in scenarios where user input validation is required.
    /// </summary>
    public abstract class ValidatingScreen : Screen, IDataErrorInfo
    {
        private IList<ValidationFailure> errors;

        public IValidator Validator { get; set; }

        /// <summary>
        /// Creates a new instance of <see cref="ValidatingScreen"/>.
        /// </summary>
        public ValidatingScreen()
        {

        }

        /// <summary>
        /// Creates a new instance of <see cref="ValidatingScreen"/> using the provided <see cref="IValidator"/>.
        /// </summary>
        /// <param name="validator"></param>
        public ValidatingScreen(IValidator validator)
        {
            this.Validator = validator;
        }

        /// <summary>
        /// Notifies any bound elements that value of the <see cref="Error" /> property has changed.
        /// </summary>
        void NotifyErrorChanged()
        {
          Deferred.Execute(() =>
            {
              NotifyOfPropertyChange(() => Error);
            }, 100);
        }

        /// <summary>
        /// Validates the screen. Returns true if validation was passed, false otherwise.
        /// </summary>
        public bool Validate()
        {
            NotifyErrorChanged();

            var res = this.Validator.Validate(this);

            errors = res.Errors;

            return res.IsValid;
        }

        /// <summary>
        /// Gets an error message indicating what is wrong with this screen.
        /// </summary>
        public string Error
        {
            get { return this.errors.Count > 0 ? $"There are {this.errors.Count} errors that need correcting." : string.Empty; }
        }

        /// <summary>
        /// Gets the error message for the property with the given name.
        /// </summary>
        public string this[string propertyName]
        {
            get
            {
                Validate();

                var failure = this.errors.FirstOrDefault(r => r.PropertyName == propertyName);

                return failure?.ErrorMessage;
            }
        }
    }
}