text:
namespace net {

class FtpNetworkSession;
class HostResolver;

class FtpNetworkLayer : public FtpTransactionFactory {
 public:
  explicit FtpNetworkLayer(HostResolver* host_resolver);
  ~FtpNetworkLayer();

  static FtpTransactionFactory* CreateFactory(HostResolver* host_resolver);

  // FtpTransactionFactory methods:
  virtual FtpTransaction* CreateTransaction();
  virtual void Suspend(bool suspend);

 private:
  scoped_refptr<FtpNetworkSession> session_;
  bool suspended_;
};

}  // namespace net

#endif  // NET_FTP_FTP_NETWORK_LAYER_H_


text:
import configparser

class Config(object):
    def __init__(self, config_file):
        config = configparser.ConfigParser()
        config.read(config_file)

        self.username = config.get('Credentials', 'BotUsername', fallback=None)
        self.password = config.get('Credentials', 'BotPassword', fallback=None)

        self.mal_username = config.get('Credentials', 'MalUsername', fallback=None)
        self.mal_password = config.get('Credentials', 'MalPassword', fallback=None)

        self.command_prefix = config.get('Chat', 'CommandPrefix', fallback='!!')

        if not self.username or not self.password:
            raise ValueError('A username or password was not specified in the configuration file.')

redpajama_set_name: RedPajamaGithub


text:
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _FieldCheckbox = require("./FieldCheckbox");

Object.keys(_FieldCheckbox).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (key in exports && exports[key] === _FieldCheckbox[key]) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function get() {
      return _FieldCheckbox[key];
    }
  });
});

var _FieldCheckboxGroup = require("./FieldCheckboxGroup");

Object.keys(_FieldCheckboxGroup).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (key in exports && exports[key] === _FieldCheckboxGroup[key]) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function get() {
      return _FieldCheckboxGroup[key];
    }
  });
});

var _FieldChips = require("./FieldChips");

Object.keys(_FieldChips).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (key in exports && exports[key] === _FieldChips[key]) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function get() {
      return _FieldChips[key];
    }
  });
});

var _FieldColor = require("./FieldColor");

Object.keys(_FieldColor).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (key in exports && exports[key] === _FieldColor[key]) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function get() {
      return _FieldColor[key];
    }
  });
});

var _FieldDate = require("./FieldDate");

Object.keys(_FieldDate).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (key in exports && exports[key] === _FieldDate[key]) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function get() {
      return _FieldDate[key];
    }
  });
});

var _FieldDateRange = require("./FieldDateRange");

Object.keys(_FieldDateRange).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (key in exports && exports[key] === _FieldDateRange[key]) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function get() {
      return _FieldDateRange[key];
    }
  });
});

var _FieldRadio = require("./FieldRadio");

Object.keys(_FieldRadio).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (key in exports && exports[key] === _FieldRadio[key]) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function get() {
      return _FieldRadio[key];
    }
  });
});

var _FieldRadioGroup = require("./FieldRadioGroup");

Object.keys(_FieldRadioGroup).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (key in exports && exports[key] === _FieldRadioGroup[key]) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function get() {
      return _FieldRadioGroup[key];
    }
  });
});

var _FieldRangeSlider = require("./FieldRangeSlider");

Object.keys(_FieldRangeSlider).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (key in exports && exports[key] === _FieldRangeSlider[key]) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function get() {
      return _FieldRangeSlider[key];
    }
  });
});

var _FieldSelect = require("./FieldSelect");

Object.keys(_FieldSelect).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (key in exports && exports[key] === _FieldSelect[key]) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function get() {
      return _FieldSelect[key];
    }
  });
});

var _FieldSelectMulti = require("./FieldSelectMulti");

Object.keys(_FieldSelectMulti).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (key in exports && exports[key] === _FieldSelectMulti[key]) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function get() {
      return _FieldSelectMulti[key];
    }
  });
});

var _FieldSlider = require("./FieldSlider");

Object.keys(_FieldSlider).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (key in exports && exports[key] === _FieldSlider[key]) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function get() {
      return _FieldSlider[key];
    }
  });
});

var _FieldText = require("./FieldText");

Object.keys(_FieldText).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (key in exports && exports[key] === _FieldText[key]) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function get() {
      return _FieldText[key];
    }
  });
});

var _FieldTextArea = require("./FieldTextArea");

Object.keys(_FieldTextArea).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (key in exports && exports[key] === _FieldTextArea[key]) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function get() {
      return _FieldTextArea[key];
    }
  });
});

var _FieldToggleSwitch = require("./FieldToggleSwitch");

Object.keys(_FieldToggleSwitch).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (key in exports && exports[key] === _FieldToggleSwitch[key]) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function get() {
      return _FieldToggleSwitch[key];
    }
  });
});

var _Field = require("./Field");

Object.keys(_Field).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (key in exports && exports[key] === _Field[key]) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function get() {
      return _Field[key];
    }
  });
});

var _FieldTimeSelect = require("./FieldTimeSelect");

Object.keys(_FieldTimeSelect).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (key in exports && exports[key] === _FieldTimeSelect[key]) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function get() {
      return _FieldTimeSelect[key];
    }
  });
});
//# sourceMappingURL=index.js.map


text:
package won.bot.framework.eventbot.event.impl.analyzation.precondition;

import won.protocol.model.Connection;
import won.utils.goals.GoalInstantiationResult;

/**
 * Created by fsuda on 27.11.2017.
 */
public class PreconditionMetEvent extends PreconditionEvent {
    public PreconditionMetEvent(Connection con, String preconditionUri, GoalInstantiationResult payload) {
        super(con, preconditionUri, payload);
    }
}


text:
var grunt = require('../../lib/grunt');
var utils = grunt.utils;

// In case the grunt being used to test is different than the grunt being
// tested, initialize the task and config subsystems.
if (grunt.task.searchDirs.length === 0) {
  grunt.task.init([]);
  grunt.config.init({});
}

exports['concat'] = function(test) {
  test.expect(1);
  grunt.registerHelper('test_helper', function(a, b) { return a + b; });
  var files = [
    'test/fixtures/a.js',
    '<test_helper:x:y>',
    'test/fixtures/b.js'
  ];
  var lf = utils.linefeed;
  test.equal(grunt.helper('concat', files), 'var a = 1;\n' + lf + 'xy' + lf + 'var b = 2;\n', 'It should concatenate files and directives.');
  test.done();
};


text:
* Linear regression
* Logistic regression
* Fully-connected network
* Convolutional network
* Variational auto-encoder
* Deep Deterministic Policy Gradient (DDPG)
### Keras
* Simple network achieving 88% testing accuracy on cifar10
* Transfer learning from tiny-imagenet to cifar10
* Train a network to approximate XOR and MAX function
### PyTorch
TODO: Implement various deep-rl algorithms including
- [ ] Deep Q-Networks (DQN)
- [ ] DDPG (Deep Deterministic Policy Gradient)
- [ ] A3C (Asynchronous Advantage Actor-Critic)
- [ ] TRPO (Trust Region Policy Optimization)
- [ ] PPO (Proximal Policy Optimization)


text:
package es.magDevs.myLibrary.model.commons;

import org.hibernate.Criteria;
import org.hibernate.criterion.CriteriaQuery;
import org.hibernate.criterion.Order;

public class SqlOrder extends Order {

	public SqlOrder(String propertyName, boolean ascending) {
		super(propertyName, ascending);
	}

	@Override
	public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) {
		return getPropertyName() + " " + (isAscending() ? "asc" : "desc");
	}

}


text:
package io.cloudslang.lang.compiler.modeller.result;

import io.cloudslang.lang.compiler.modeller.model.Workflow;
import java.util.List;

/**
 * Created by Ifat Gavish on 24/02/2016
 */
public class WorkflowModellingResult implements ModellingResult {

    private final Workflow workflow;
    private final List<RuntimeException> errors;

    public WorkflowModellingResult(Workflow workflow, List<RuntimeException> errors) {
        this.workflow = workflow;
        this.errors = errors;
    }

    public Workflow getWorkflow() {
        return workflow;
    }

    public List<RuntimeException> getErrors() {
        return errors;
    }
}


text:
ComponentLoaderFactory::ComponentLoaderFactory()
{
    Bind( AutoId( "default_component" ), &CreateComponentLoader<DefaultComponentLoader> );
    SetDefault( AutoId( "default_component" ) );

    Bind( AutoId( "position_component" ), &CreateComponentLoader<PositionComponentLoader> );
    Bind( AutoId( "rotate_component" ), &CreateComponentLoader<RotateComponentLoader> );
    Bind( AutoId( "visual_box_multiplier_component" ), &CreateComponentLoader<render::VisualBoxMultiplierComponentLoader> );
    Bind( AutoId( "move_component" ), &CreateComponentLoader<MoveComponentLoader> );
    Bind( AutoId( "acceleration_component" ), &CreateComponentLoader<AccelerationComponentLoader> );
    Bind( AutoId( "player_controller_component" ), &CreateComponentLoader<PlayerControllerComponentLoader> );
    Bind( AutoId( "target_player_controller_component" ), &CreateComponentLoader<TargetPlayerControllerComponentLoader> );
    Bind( AutoId( "random_controller_component" ), &CreateComponentLoader<RandomControllerComponentLoader> );
    Bind( AutoId( "guard_controller_component" ), &CreateComponentLoader<GuardControllerComponentLoader> );
    Bind( AutoId( "path_controller_component" ), &CreateComponentLoader<PathControllerComponentLoader> );
    Bind( AutoId( "scripted_controller_component" ), &CreateComponentLoader<scriptedcontroller::ScriptedControllerComponentLoader> );

    Bind( AutoId( "pulse_component" ), &CreateComponentLoader<PulseComponentLoader> );

    Bind( AutoId( "inventory_component" ), &CreateComponentLoader<InventoryComponentLoader> );
    Bind( AutoId( "static_actor_component" ), &CreateComponentLoader<StaticActorComponentLoader> );
    Bind( AutoId( "health_component" ), &CreateComponentLoader<HealthComponentLoader> );

    Bind( AutoId( "collision_component" ), &CreateComponentLoader<CollisionComponentLoader> );
    Bind( AutoId( "shot_collision_component" ), &CreateComponentLoader<ShotCollisionComponentLoader> );
    Bind( AutoId( "wall_collision_component" ), &CreateComponentLoader<WallCollisionComponentLoader> );
    Bind( AutoId( "water_collision_component" ), &CreateComponentLoader<WaterCollisionComponentLoader> );
    Bind( AutoId( "pickup_collision_component" ), &CreateComponentLoader<PickupCollisionComponentLoader> );
    Bind( AutoId( "aoe_collision_component" ), &CreateComponentLoader<AoeCollisionComponentLoader> );
    Bind( AutoId( "bounce_collision_component" ), &CreateComponentLoader<BounceCollisionComponentLoader> );
    Bind( AutoId( "flag_collision_component" ), &CreateComponentLoader<ctf::FlagCollisionComponentLoader> );

    Bind( AutoId( "renderable_component" ), &CreateComponentLoader<RenderableComponentLoader> );
    Bind( AutoId( "border_component" ), &CreateComponentLoader<BorderComponentLoader> );

    Bind( AutoId( "remove_on_death_component" ), &CreateComponentLoader<RemoveOnDeathComponentLoader> );
    Bind( AutoId( "explode_on_death_component" ), &CreateComponentLoader<ExplodeOnDeathComponentLoader> );
    Bind( AutoId( "drop_on_death_component" ), &CreateComponentLoader<DropOnDeathComponentLoader> );
    Bind( AutoId( "stop_on_death_component" ), &CreateComponentLoader<StopOnDeathComponentLoader> );
    Bind( AutoId( "score_on_death_component" ), &CreateComponentLoader<ScoreOnDeathComponentLoader> );
    Bind( AutoId( "owner_component" ), &CreateComponentLoader<OwnerComponentLoader> );
    Bind( AutoId( "kill_score_on_death_component" ), &CreateComponentLoader<KillScoreOnDeathComponentLoader> );

    Bind( AutoId( "notify_parent_on_death_component" ), &CreateComponentLoader<NotifyParentOnDeathComponentLoader> );
    Bind( AutoId( "listen_child_death_component" ), &CreateComponentLoader<ListenChildDeathComponentLoader> );
    Bind( AutoId( "pointer_target_controller_component" ), &CreateComponentLoader<PointerTargetControllerComponentLoader> );
    Bind( AutoId( "heat_source_component" ), &CreateComponentLoader<HeatSourceComponentLoader> );

    Bind( AutoId( "fade_out_component" ), &CreateComponentLoader<FadeOutComponentLoader> );

    Bind( AutoId( "explosion_component" ), &CreateComponentLoader<ExplosionComponentLoader> );

    Bind( AutoId( "target_holder_component" ), &CreateComponentLoader<TargetHolderComponentLoader> );
    Bind( AutoId( "buff_holder_component" ), &CreateComponentLoader<BuffHolderComponentLoader> );
    Bind( AutoId( "accuracy_component" ), &CreateComponentLoader<AccuracyComponentLoader> );
    Bind( AutoId( "armor_component" ), &CreateComponentLoader<ArmorComponentLoader> );
    Bind( AutoId( "cloak_component" ), &CreateComponentLoader<CloakComponentLoader> );

    Bind( AutoId( "team_component" ), &CreateComponentLoader<TeamComponentLoader> );
    Bind( AutoId( "attachable_component" ), &CreateComponentLoader<ctf::AttachableComponentLoader> );
    Bind( AutoId( "flag_carrier_component" ), &CreateComponentLoader<ctf::FlagCarrierComponentLoader> );
    Bind( AutoId( "flag_receiver_component" ), &CreateComponentLoader<ctf::FlagReceiverComponentLoader> );

    Bind( AutoId( "worm_head_component" ), &CreateComponentLoader<WormHeadComponentLoader> );
    Bind( AutoId( "worm_body_component" ), &CreateComponentLoader<WormBodyComponentLoader> );
    Bind( AutoId( "waypoint_component" ), &CreateComponentLoader<WaypointComponentLoader> );

    Bind( AutoId( "emitter_component" ), &CreateComponentLoader<EmitterComponentLoader> );
    Bind( AutoId( "explode_on_hit_component" ), &CreateComponentLoader<ExplodeOnHitComponentLoader> );
    Bind( AutoId( "detonate_on_hit_component" ), &CreateComponentLoader<DetonateOnHitComponentLoader> );
    Bind( AutoId( "audible_component" ), &CreateComponentLoader<AudibleComponentLoader> );
    Bind( AutoId( "remove_components_on_death_component" ), &CreateComponentLoader<RemoveComponentsOnDeathComponentLoader> );
    Bind( AutoId( "cell_component" ), &CreateComponentLoader<CellComponentLoader> );
    Bind( AutoId( "level_end_component" ), &CreateComponentLoader<LevelEndComponentLoader> );

    Bind( AutoId("light_component"), &CreateComponentLoader<LightComponentLoader>);
    Bind( AutoId("activity_component"), &CreateComponentLoader<ActivityComponentLoader>);
}

void DefaultComponentLoader::BindValues()
{

}
DefaultComponentLoader::DefaultComponentLoader()
{
}


text:
<?php
namespace Rairlie\LockingSession;

use Illuminate\Session\SessionManager as BaseSessionManager;
use Illuminate\Session\NullSessionHandler;
use Symfony\Component\HttpFoundation\Session\Storage\Handler\NullSessionHandler as SymfonyNullHandler;

class SessionManager extends BaseSessionManager
{

    /**
     * Override to return our own Store/Encrypted store
     */
    protected function buildSession($handler)
    {
        if ($handler instanceOf NullSessionHandler || $handler instanceof SymfonyNullHandler) {
            return parent::buildSession($handler);
        }

        $container = isset($this->container) ? $this->container : $this->app;

        if ($container['config']['session.encrypt']) {
            return new EncryptedStore(
                $container['config']['session.cookie'],
                $handler,
                $container['encrypter'],
                $container['config']['session.lockfile_dir']
            );
        } else {
            return new Store(
                $container['config']['session.cookie'],
                $handler,
                null,
                $container['config']['session.lockfile_dir']
            );
        }
    }

}


text:
var Store = require('../../store/base')

describe('Error', function() {
  var store = new Store()

  store.Model('User', function() {
    this.hasMany('posts')
    this.belongsTo('avatar')
  })

  store.Model('Post', function() {
    this.attribute('title')
  })

  store.Model('Avatar', function() {
    this.attribute('url')
  })

  var User, phil

  before(function() {
    return store.ready(function() {
      User = store.Model('User')
      phil = new User()
    })
  })

  describe('errors.add()', function() {
    it('add attribute error', function() {
      phil.errors.add('attribute_name', 'not valid')
    })

    it('add base error', function() {
      phil.errors.add('can not be deleted')
    })

    it('is an array of errors', function() {
      phil.errors.errors['attribute_name'].should.be.an.instanceOf(Array)
      phil.errors.errors['attribute_name'][0].should.be.equal('not valid')
    })

    it('has base errors', function() {
      phil.errors.errors['base'].should.be.an.instanceOf(Array)
      phil.errors.errors['base'][0].should.be.equal('can not be deleted')
    })
  })

  describe('errors.set()', function() {
    it('set multiple attributes', function() {
      phil.errors.set({
        a: 'Error a',
        b: 'Error b'
      })
      phil.errors.errors.a.should.be.eql(['Error a'])
      phil.errors.errors.b.should.be.eql(['Error b'])
    })
  })

  describe('errors.each()', function() {
    it('add attribute error', function() {
      const tmp = []
      phil.errors.each(function(field, error) {
        tmp.push(field)
        tmp.push(error)
      })
      tmp.should.be.eql([
        'attribute_name',
        'not valid',
        'base',
        'can not be deleted',
        'a',
        'Error a',
        'b',
        'Error b'
      ])
    })
  })

  describe('errors.toJSON()', function() {
    it('returns the json representation', function() {
      phil.errors.toJSON().should.be.eql({
        attribute_name: ['not valid'],
        a: ['Error a'],
        base: ['can not be deleted'],
        b: ['Error b']
      })
    })
  })

  describe('errors.toString()', function() {
    it('set converts all errors to a string', function() {
      phil.errors
        .toString()
        .should.be.equal(
          'attribute_name: not valid\ncan not be deleted\na: Error a\nb: Error b'
        )
    })
  })
})


text:
A monobehaviour-based state machine and editor made in Unity 5 for use in simple AI

To get started:
Import the files into Unity game engine. Create a GameObject in the scene and attach AIStateMachine to it, or instantiate the provided Test State Machine prefab. Right-click the AIStateMachine component and choose "Launch Editor".

In the state machine editor, all actions other than selecting and dragging are done using the right-click context menu.


text:
import { PropTypes } from 'react';
import StringPreview from './StringPreview';

export default class BatteryCurrent extends StringPreview {
  static propTypes = {
    ...StringPreview.propTypes,
    batteryCurrent: PropTypes.number.isRequired,
  }

  content() {
    const { batteryCurrent } = this.props;

    return `${batteryCurrent.toFixed(1)}A`;
  }
}


text:
/* $Id$ $Revision$ */
/* vim:set shiftwidth=4 ts=8: */

/*************************************************************************
 * Copyright (c) 2011 AT&T Intellectual Property
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors: See CVS logs. Details at http://www.graphviz.org/
 *************************************************************************/

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <string.h>
#include <ctype.h>

int strcasecmp(const char *s1, const char *s2)
{
    while ((*s1 != '\0')
	   && (tolower(*(unsigned char *) s1) ==
	       tolower(*(unsigned char *) s2))) {
	s1++;
	s2++;
    }

    return tolower(*(unsigned char *) s1) - tolower(*(unsigned char *) s2);
}


text:
// -*- mode: C++ -*-
//
// Copyright (c) 2007, 2008, 2010, 2011, 2013 The University of Utah
// All rights reserved.
//
// This file is part of `csmith', a random generator of C programs.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
//   * Redistributions of source code must retain the above copyright notice,
//     this list of conditions and the following disclaimer.
//
//   * Redistributions in binary form must reproduce the above copyright
//     notice, this list of conditions and the following disclaimer in the
//     documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.

#include "ExpressionAssign.h"
#include <cassert>
#include "Common.h"
#include "CGContext.h"
#include "CGOptions.h"
#include "FactMgr.h"
#include "Function.h"
#include "Bookkeeper.h"
#include "Variable.h"
#include "StringUtils.h"
#include "Block.h"

///////////////////////////////////////////////////////////////////////////////

/*
 *
 */
Expression *
ExpressionAssign::make_random(CGContext &cg_context, const Type* type, const CVQualifiers* qfer)
{
	CVQualifiers qf;
	if (qfer == NULL) {
		qf = CVQualifiers::random_qualifiers(type, Effect::WRITE, cg_context, true);
		qfer = &qf;
	}
	StatementAssign* sa = StatementAssign::make_random(cg_context, type, qfer);
	FactMgr* fm = get_fact_mgr(&cg_context);
	FactMgr::update_fact_for_assign(sa, fm->global_facts);
	ExpressionAssign* ea = new ExpressionAssign(sa);
	return ea;
}

ExpressionAssign::ExpressionAssign(const StatementAssign* sa)
: Expression(eAssignment),
  assign(sa)
{
}

/*
 *
 */
ExpressionAssign::~ExpressionAssign(void)
{
	/*if (assign) {
		delete assign;
		assign = NULL;
	}*/
}

Expression*
ExpressionAssign::clone() const
{
	return new ExpressionAssign(assign);
}

CVQualifiers
ExpressionAssign::get_qualifiers(void) const
{
	return assign->get_lhs()->get_qualifiers();
}

/*
 * return if a variable is referenced in this expression
 */
bool
ExpressionAssign::use_var(const Variable* v) const
{
	if (assign->get_lhs()->use_var(v) || assign->get_expr()->use_var(v)) {
		return true;
	}
	return false;
}

bool
ExpressionAssign::equals(int num) const
{
	return assign->is_simple_assign() && assign->get_expr()->equals(num);
}

bool
ExpressionAssign::is_0_or_1(void) const
{
	return assign->is_simple_assign() && assign->get_expr()->is_0_or_1();
}

void
ExpressionAssign::get_eval_to_subexps(vector<const Expression*>& subs) const
{
	vector<const Expression*> exps;
	get_lhs()->get_eval_to_subexps(exps);
	subs.insert(subs.end(), exps.begin(), exps.end());
}

bool
ExpressionAssign::visit_facts(vector<const Fact*>& inputs, CGContext& cg_context) const
{
	return assign->visit_facts(inputs, cg_context);
}

void
ExpressionAssign::Output(std::ostream &out) const
{
	output_cast(out);
	Reducer* reducer = CGOptions::get_reducer();
	if (reducer && reducer->output_expr(this, out)) {
		return;
	}
	out << "(";
	assign->OutputAsExpr(out);
	out << ")";
}

void
ExpressionAssign::indented_output(std::ostream &out, int indent) const
{
	output_tab(out, indent);
	Output(out);
}

///////////////////////////////////////////////////////////////////////////////

// Local Variables:
// c-basic-offset: 4
// tab-width: 4
// End:

// End of file.


text:
{% extends 'templates/nhs_transaction_layout.html' %}
{% import 'includes/form_macros.html' as form_macros %}

{% block afterHeader %}
  {% include "includes/service-headers/low-income.html" %}
{% endblock %}

{% block content %}

      Which type of pensions does your partner get?

Select all the pensions they get.

  <form action="pension-type-handler" method="get" class="form">

        <input type="checkbox" id="state" value="state" name="pensiontype">

          State pension

        <input type="checkbox" id="private" value="private" name="pensiontype">

          Private pension

        <input type="checkbox" id="employment" value="employment" name="pensiontype">

          Workplace pension

        <input type="checkbox" id="war-disablement" value="war-disablement" name="pensiontype">

          War disablement pension

        <input type="checkbox" id="war-widow" value="war-widow" name="pensiontype">

          War Widow's Pension or War Widower's Pension

    {{
      form_macros.button({
        label: 'Save and continue'
      })
    }}

Save and come back later

  </form>

{% endblock %}


text:
require 'rails_helper'

# @note While this is technically a controller test, because it's testing our
# REST API, we're really using it as a feature/request test

RSpec.describe AnalyticsController, type: :controller do
  let(:parsed_body) { JSON.parse response.body }

  describe 'GET #show' do
    context 'with a work version' do
      let(:resource) { instance_double('Collection', uuid: 'abc-123') }

      before do
        allow(FindResource).to receive(:call).with(resource.uuid).and_return(resource)

        allow(resource)
          .to receive(:stats)
          .and_return(
            [
              [Date.parse('2020-06-01'), 1, 1],
              [Date.parse('2020-06-02'), 2, 3]
            ]
          )
      end

      it 'returns the view counts as json' do
        get(:show, params: { resource_id: resource.uuid, format: :json })
        expect(resource).to have_received(:stats)

        expect(response).to be_ok
        expect(parsed_body).to eq [
          ['2020-06-01', 1, 1],
          ['2020-06-02', 2, 3]
        ]
      end

      context 'when the format is not json' do
        subject { response }

        before { get(:show, params: { resource_id: resource.uuid }) }

        it { is_expected.to have_http_status(:unsupported_media_type) }
      end
    end
  end
end


text:
/* tslint:disable:no-unused-variable */

import { By }           from '@angular/platform-browser';
import { DebugElement } from '@angular/core';

import {
  beforeEach, beforeEachProviders,
  describe, xdescribe,
  expect, it, xit,
  async, inject
} from '@angular/core/testing';

import { AboutComponent } from './about.component';

describe('Component: About', () => {
  it('should create an instance', () => {
    let component = new AboutComponent();
    expect(component).toBeTruthy();
  });
});


text:
<?php
/**
 * Created by PhpStorm.
 * User: Jacky
 * Date: 3/9/2017
 * Time: 9:51 AM
 */
?>

<a href="<?= base_url()?>">Home

<a href="<?= base_url().'item' ?>">Item

Mutate

Mutate item (code:
        <a href="<?= base_url().'item/detail/'.$record->id ?>">
        <?= str_pad($record->item_type_id, 2, '0', STR_PAD_LEFT).''.str_pad($record->id, 5, '0', STR_PAD_LEFT) ?>)

Basic information

Item Type

                                    <?= html_escape($record->item_type_name) ?>

Brand

                                    <?= html_escape($record->brand_name) ?>

Model

                                    <?= html_escape($record->model_name) ?>

Capacity/Size

                                    <?php if ($record->model_capacity_size == ''): ?>
                                        N/A
                                    <?php else: ?>
                                        <?= html_escape($record->model_capacity_size.' '.$record->model_units) ?>
                                    <?php endif; ?>

Operating System

                                    <?php if ($record->operating_system_id == 0): ?>
                                        N/A
                                    <?php else: ?>
                                        <?= html_escape($operating_systems[$record->operating_system_id]->name) ?>
                                    <?php endif; ?>

Current Location

                                    <?= (($record->location_id != 0) ? ' '.html_escape($locations[$record->location_id]->name) : '') ?>
                                    <?= (($record->first_sub_location_id != 0) ? '  '.html_escape($first_sub_locations[$record->first_sub_location_id]->name) : '') ?>
                                    <?= (($record->second_sub_location_id != 0) ? '  '.html_escape($second_sub_locations[$record->second_sub_location_id]->name) : '') ?>

Current holder

Name

                                    <a href="<?= base_url().'employee/detail/'.$record->employee_id ?>">
                                        <?= html_escape($record->employee_name) ?>

Works at

                                    <a href="<?= base_url().'company/detail/'.$record->employee_company_id ?>">
                                        <?= html_escape($companies[$record->employee_company_id]->name) ?>

Item status

                                    <?php if($record->is_used == 1):?>
                                         Occupied
                                    <?php else: ?>
                                         Vacant
                                    <?php endif; ?>

Location

                                    <?php echo
                                        (($employees[$record->employee_id]->location_id != 0) ? html_escape($locations[$employees[$record->employee_id]->location_id]->name) : '').
                                        (($employees[$record->employee_id]->first_sub_location_id != 0) ? '  '.html_escape($first_sub_locations[$employees[$record->employee_id]->first_sub_location_id]->name) : '').
                                        (($employees[$record->employee_id]->second_sub_location_id != 0) ? '  '.html_escape($second_sub_locations[$employees[$record->employee_id]->second_sub_location_id]->name) : '')
                                    ?>

Mutation

                    <form class="form-horizontal" action="<?php echo base_url(); ?>item/mutate/submit/<?= $record->id ?>" method="POST">

                            Mutation date:

                                    <input type="text" class="form-control datepicker" id="mutation_date" name="mutation_date" />

                            Mutate to:
                            <input type="hidden" name="prev_employee_id" id="prev_employee_id" value="<?= $record->employee_id ?>"/>

                                <select class="form-control selectpicker" name="employee_id" id="employee_id" data-live-search="true">
                                    <?php foreach($employees as $employee){ ?>
                                        <option value="<?= $employee->id?>"
                                        <?= (($employee->id == $record->employee_id) ? 'selected' : '') ?>>
                                            <?= html_escape($employee->name) ?>
                                            (<?= html_escape($employee->company_name) ?>)
                                        </option>
                                    <?php } ?>
                                </select>

                                <input type="hidden" name="prev_location_id" id="prev_location_id" value="<?= $record->location_id ?>"/>
                                <input type="hidden" name="prev_first_sub_location_id" id="prev_first_sub_location_id" value="<?= $record->first_sub_location_id ?>"/>
                                <input type="hidden" name="prev_second_sub_location_id" id="prev_second_sub_location_id" value="<?= $record->second_sub_location_id ?>"/>
                                <select class="form-control selectpicker" name="location_id" id="location_id" data-live-search="true">
                                    <option value="0,0,0">
                                        Not specified
                                    </option>
                                    <?php foreach($locations as $location){ ?>
                                        <option value="<?= $location->id.',0,0' ?>"
                                            <?= (($record->location_id.','.$record->first_sub_location_id.','.$record->second_sub_location_id == $location->id.',0,0') ? 'selected' : '') ?>>
                                            <?= html_escape($location->name) ?>
                                        </option>
                                    <?php } ?>

                                    <?php foreach($first_sub_locations as $first_sub_location){ ?>
                                        <option value="<?= $first_sub_location->location_id.','.$first_sub_location->id.',0' ?>"
                                            <?= (($record->location_id.','.$record->first_sub_location_id.','.$record->second_sub_location_id == $first_sub_location->location_id.','.$first_sub_location->id.',0') ? 'selected' : '') ?>>
                                            <?= (($first_sub_location->location_id != 0) ? html_escape($locations[$first_sub_location->location_id]->name) : '') ?>/<?= html_escape($first_sub_location->name) ?>
                                        </option>
                                    <?php } ?>

                                    <?php foreach($second_sub_locations as $second_sub_location){ ?>
                                        <option value="<?= $first_sub_locations[$second_sub_location->first_sub_location_id]->location_id.','.$second_sub_location->first_sub_location_id.','.$second_sub_location->id ?>"
                                            <?= (($record->location_id.','.$record->first_sub_location_id.','.$record->second_sub_location_id == $first_sub_locations[$second_sub_location->first_sub_location_id]->location_id.','.$second_sub_location->first_sub_location_id.','.$second_sub_location->id) ? 'selected' : '') ?>>
                                            <?= (($first_sub_locations[$second_sub_location->first_sub_location_id]->location_id != 0) ? html_escape($locations[$first_sub_locations[$second_sub_location->first_sub_location_id]->location_id]->name) : '') ?>/<?= ($second_sub_location->first_sub_location_id != 0) ? html_escape($first_sub_locations[$second_sub_location->first_sub_location_id]->name) : ''?>/<?= html_escape($second_sub_location->name) ?>
                                        </option>
                                    <?php } ?>
                                </select>

                            Mutation status:

                                <select class="form-control selectpicker" name="mutation_status_id" id="mutation_status_id" data-live-search="true">
                                    <?php foreach($mutation_statuses as $ms){ ?>
                                        <option value="<?= $ms->id?>">
                                            <?= html_escape($ms->name) ?>
                                        </option>
                                    <?php } ?>
                                </select>

                            Note:

                                <textarea class="form-control" rows="4" id="note" name="note" placeholder="Ex: Sesuai dengan Surat no. XX, etc"></textarea>

                                    <button type="submit" class="btn btn-primary form-control">

                                        Mutate
                                    </button>

                    </form>


text:
class Person
    def initialize(id, name, prefs)
        @id      = id
        @name    = name
        @prefs   = prefs
        @partner = nil
        @choices = 0
    end

    def lonely?
        @partner.nil?
    end

    def propose(partners)
        unless self.lonely?
            raise '%s is not lonely!' % self.name
        end
        choice = @prefs[@choices]
        partners[choice].onPropose(self)
        @choices += 1
    end

    def to_s
      "#{@name.rjust(20)}: #{self.lonely? && "Lonely" || @partner.name}"
    end

    def self.generate(size, prefix, r)
        Array.new(size){|i|
            Person.new(
                i,
                "#{prefix} #{i}",
                (0 ... size).to_a.shuffle(random: r)
            )
        }
    end

    protected
    attr_reader :id, :name
    attr_writer :partner

    # Acts upon a given Proposal
    def onPropose(partner)
        unless self.lonely?
            offer = score(partner)
            current = score(@partner)
            return unless offer > current
            @partner.partner = nil
        end
        @partner = partner
        partner.partner = self
    end

    private
    # Determines the preference of a given partner
    def score(partner)
        return 0 if partner.nil?
        @prefs.size - @prefs.index(partner.id)
    end
end

# Deterministic Output, feel free to change seed
r = Random.new(42)

# Determines Output Columns
men = Person.generate(4, "Man", r)
women = Person.generate(4, "Woman", r)

# Assume no Name is longer than 20 characters
spacer = '-' * (20 * 2 + 2)

# Solve the Problem
1.step do |round|
    singles = men.select(&:lonely?)
    singles.each do |m|
        m.propose(women)
    end

    break if singles.empty?

    puts "Round #{round}"
    puts spacer
    puts men, women
    puts spacer
end


text:
![](https://raw.githubusercontent.com/cat-in-the-dark/old48_36_game/master/client/assets/textures/title.png)

### [Download](https://github.com/cat-in-the-dark/old48_36_game/releases)

## Controls

- WASD - walking
- Mouse - aiming
- Left Mouse Button - shooting
- Enter - in case of undefined

## Gameplay video

## About

- Engine: [libgdx](http://libgdx.badlogicgames.com/)
- Language: [scala](http://www.scala-lang.org/)
- Platform: Cross platform, required java runtime environment(jre). [download jre](http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html)

## From Siberia with love by [CAT_IN_THE_DARK](https://catinthedark.itch.io/)

Team: Blan4, BOOtak, Over64, Svsoyka


text:
using System;
using System.ServiceModel;

namespace SoapCore.Tests.Wsdl.Services
{
	[ServiceContract]
	public interface INullableEnumService
	{
		[OperationContract]
		NulEnum? GetEnum(string text);
	}

	public class NullableEnumService : INullableEnumService
	{
		public NulEnum? GetEnum(string text)
		{
			throw new NotImplementedException();
		}
	}
}


text:
class AddScheduledSaleTables < ActiveRecord::Migration
  def change
    create_table :spree_scheduled_sales do |t|
      t.string :name
      t.string :title
      t.string :permalink
      t.attachment :image
      t.datetime :start_date_time
      t.datetime :end_date_time
      t.boolean :clearance, default: false
      t.boolean :weekly_sale, default: false
      t.boolean :is_active, default: true
      t.integer :discount
      t.timestamps
    end

    create_table :spree_items_scheduled_sales do |t|
      t.integer :scheduled_sale_id
      t.integer :item_id
      t.string :item_type
      t.integer :override_price_as_cents
      t.boolean :exclude_item_from_sale, :default => true
      t.timestamps
    end

    create_table :spree_items_scheduled_description_placements do |t|
      t.integer :spree_scheduled_sales_id
      t.integer :spree_scheduled_sales_placement_location_id
      t.text :description
      t.boolean :exclude_item_from_sale, :default => true
      t.timestamps
    end

    create_table :spree_scheduled_sales_placement_locations do |t|
      t.string :description
      t.timestamps
    end
  end
end


text:
set -e

# Options
NODE_INSTALLATION_PATH="$INSTALLATION_PATH/node"

if [[ -z $NODE ]]; then
  typeset -u NODE
  if [[ $DEFAULT_INSTALLATION_MODE != 'Y' ]]; then
    read -p "$LANG_INSTALL_NODE[Y/N]: ($DEFAULT_NODE) " NODE
  fi
  if [[ -z $NODE ]]; then
    NODE=$DEFAULT_NODE
  fi
fi

if [[ $NODE == 'Y' && -d $NODE_INSTALLATION_PATH ]]; then
  typeset -u NODE
  if [[ -z $NODE_OVERWRITE ]]; then
    if [[ $DEFAULT_INSTALLATION_MODE != 'Y' ]]; then
      read -p "$LANG_NODE_OVERWRITE[Y/N]: ($DEFAULT_NODE_OVERWRITE) " NODE
    fi
    if [[ -z $NODE ]]; then
      NODE=$DEFAULT_NODE_OVERWRITE
    fi
  else
    NODE=$NODE_OVERWRITE
  fi
fi

if [[ $NODE == 'Y' ]]; then
  if [[ -z $NODE_VERSION ]]; then
    if [[ $DEFAULT_INSTALLATION_MODE != 'Y' ]]; then
      read -p "$LANG_NODE_VERSION: ($DEFAULT_NODE_VERSION) " NODE_VERSION
    fi
    if [[ -z $NODE_VERSION ]]; then
      NODE_VERSION=$DEFAULT_NODE_VERSION
    fi
  fi
fi

# Install
install_node() {
  if [[ $NODE != 'Y' ]]; then
    return
  fi

  set -x
  if [[ -d $NODE_INSTALLATION_PATH ]]; then
    mv $NODE_INSTALLATION_PATH "$NODE_INSTALLATION_PATH.`date +%Y%m%d%H%M%S`"
  fi
  # if [[ ! -f "node-v$NODE_VERSION-linux-x64.tar.xz" ]]; then
  #   curl --compressed -fLO "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz"
  # else
  if [[ -f "node-v$NODE_VERSION-linux-x64.tar.xz" ]]; then
    rm -rf "node-v$NODE_VERSION-linux-x64"
  fi
  wget -c "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz"
  tar xvf "node-v$NODE_VERSION-linux-x64.tar.xz"
  chown root:root -R "node-v$NODE_VERSION-linux-x64"
  mv "node-v$NODE_VERSION-linux-x64" $NODE_INSTALLATION_PATH
  echo "export PATH=$NODE_INSTALLATION_PATH/bin:"'$PATH' > /etc/profile.d/node.sh
  source /etc/profile.d/node.sh
  # npm config set disturl https://npm.taobao.org/dist --global
  # npm config set registry https://registry.npm.taobao.org --global
  # npm install -g --registry=https://registry.npm.taobao.org npm@latest yarn
  # yarn config set disturl https://npm.taobao.org/dist --global
  # yarn config set registry https://registry.npm.taobao.org --global
  set +x
}


text:
'use strict';

const authentication = require('../controllers/authentication.controllers');

module.exports = function (app, passport) {

    app.route('/api/login')
        .post(authentication.login);

    app.route('/api/register')
        .post(authentication.register);

    app.route('/api/logout')
       .delete(authentication.logout);

    // app.route('/api/customer')
    //     .get(customer.details);
};


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.picketlink.quickstarts</groupId>
    <artifactId>picketlink-federation-saml-sp-redirect-basic</artifactId>
    <version>2.7.0.Beta2</version>

    <packaging>war</packaging>

    <name>PicketLink Quickstart: picketlink-federation-saml-sp-redirect-basic</name>
    <description>PicketLink Quickstart: PicketLink Service Provider With a Basic Configuration using SAML HTTP Redirect Binding</description>

    <url>http://www.picketlink.org</url>

    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <distribution>repo</distribution>
            <url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
        </license>
    </licenses>

    <properties>

        <!-- PicketLink dependency versions -->
        <version.picketlink.javaee.bom>2.7.0.Beta2</version.picketlink.javaee.bom>

        <!-- Default target container. -->
        <target.container>jboss-eap</target.container>

        <!-- maven-compiler-plugin -->
        <version.compiler.plugin>3.1</version.compiler.plugin>
        <!-- maven-deploy-plugin -->
        <version.deploy.plugin>2.8.1</version.deploy.plugin>
        <!-- JBoss AS dependency versions -->
        <version.jboss.maven.plugin>7.4.Final</version.jboss.maven.plugin>
        <!-- maven-war-plugin -->
        <version.war.plugin>2.1.1</version.war.plugin>
        <!-- WildFly dependency versions -->
        <version.wildfly.maven.plugin>1.0.1.Final</version.wildfly.maven.plugin>

        <maven.compiler.target>1.6</maven.compiler.target>
        <maven.compiler.source>1.6</maven.compiler.source>
    </properties>

    <build>
        <!-- Set the name of the war, used as the context root when the app is deployed -->
        <finalName>${project.artifactId}</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>${version.deploy.plugin}</version>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <version>${version.war.plugin}</version>
                <configuration>
                    <!-- Java EE 6 doesn't require web.xml, Maven needs to catch up! -->
                    <failOnMissingWebXml>false</failOnMissingWebXml>

                    <!-- We need to get the configuration resources for the provided target container. -->
                    <classifier>${target.container}</classifier>

                    <!-- Instead of duplicating resources for each example application, we just reuse all resources from the
                    base application. -->
                    <webResources>
						<resource>
							<directory>${basedir}/conf/${target.container}</directory>
						</resource>
                    </webResources>
                </configuration>
            </plugin>
            <!-- JBoss AS plugin to deploy war -->
            <plugin>
                <groupId>org.jboss.as.plugins</groupId>
                <artifactId>jboss-as-maven-plugin</artifactId>
                <version>${version.jboss.maven.plugin}</version>
                <configuration>
                    <filename>${project.build.finalName}-${target.container}.${project.packaging}</filename>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>wildfly</id>
            <properties>
                <target.container>wildfly</target.container>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.wildfly.plugins</groupId>
                        <artifactId>wildfly-maven-plugin</artifactId>
                        <version>${version.wildfly.maven.plugin}</version>
                        <configuration>
                            <filename>${project.build.finalName}-${target.container}.${project.packaging}</filename>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>


text:
import tempfile

from git import InvalidGitRepositoryError

try:
    from unittest2 import TestCase
    from mock import patch, Mock
except ImportError:
    from unittest import TestCase
    from mock import patch, Mock

import textwrap
from datetime import datetime

from botocore.exceptions import ClientError
from dateutil.tz import tzutc

from cfn_sphere import util, CloudFormationStack
from cfn_sphere.exceptions import CfnSphereException, CfnSphereBotoError
from cfn_sphere.template import CloudFormationTemplate

class UtilTests(TestCase):
    def test_convert_yaml_to_json_string_returns_valid_json_string(self):
        data = textwrap.dedent("""
        foo:
          foo: baa
        """)

        self.assertEqual('{\n  "foo": {\n    "foo": "baa"\n  }\n}', util.convert_yaml_to_json_string(data))

    def test_convert_yaml_to_json_string_returns_valid_json_string_on_empty_string_input(self):
        data = ""
        self.assertEqual('{}', util.convert_yaml_to_json_string(data))

    def test_convert_json_to_yaml_string_returns_valid_yaml_string(self):
        data = textwrap.dedent("""
        {
            "foo": {
                "foo": "baa"
            }
        }
        """)

        self.assertEqual('foo:\n  foo: baa\n', util.convert_json_to_yaml_string(data))

    def test_convert_json_to_yaml_string_returns_empty_string_on_empty_json_input(self):
        data = {}
        self.assertEqual('', util.convert_json_to_yaml_string(data))

    @patch("cfn_sphere.util.urllib2.urlopen")
    def test_get_cfn_api_server_time_returns_gmt_datetime(self, urlopen_mock):
        urlopen_mock.return_value.info.return_value.get.return_value = "Mon, 21 Sep 2015 17:17:26 GMT"
        expected_timestamp = datetime(year=2015, month=9, day=21, hour=17, minute=17, second=26, tzinfo=tzutc())
        self.assertEqual(expected_timestamp, util.get_cfn_api_server_time())

    @patch("cfn_sphere.util.urllib2.urlopen")
    def test_get_cfn_api_server_time_raises_exception_on_empty_date_header(self, urlopen_mock):
        urlopen_mock.return_value.info.return_value.get.return_value = ""
        with self.assertRaises(CfnSphereException):
            util.get_cfn_api_server_time()

    def test_with_boto_retry_retries_method_call_for_throttling_exception(self):
        count_func = Mock()

        @util.with_boto_retry(max_retries=1, pause_time_multiplier=1)
        def my_retried_method(count_func):
            count_func()
            exception = CfnSphereBotoError(
                ClientError(error_response={"Error": {"Code": "Throttling", "Message": "Rate exceeded"}},
                            operation_name="DescribeStacks"))
            raise exception

        with self.assertRaises(CfnSphereBotoError):
            my_retried_method(count_func)

        self.assertEqual(2, count_func.call_count)

    def test_with_boto_retry_does_not_retry_for_simple_exception(self):
        count_func = Mock()

        @util.with_boto_retry(max_retries=1, pause_time_multiplier=1)
        def my_retried_method(count_func):
            count_func()
            raise Exception

        with self.assertRaises(Exception):
            my_retried_method(count_func)

        self.assertEqual(1, count_func.call_count)

    def test_with_boto_retry_does_not_retry_for_another_boto_client_error(self):
        count_func = Mock()

        @util.with_boto_retry(max_retries=1, pause_time_multiplier=1)
        def my_retried_method(count_func):
            count_func()
            exception = ClientError(error_response={"Error": {"Code": "Another Error", "Message": "Foo"}},
                                    operation_name="DescribeStacks")
            raise exception

        with self.assertRaises(ClientError):
            my_retried_method(count_func)

        self.assertEqual(1, count_func.call_count)

    def test_with_boto_retry_does_not_retry_without_exception(self):
        count_func = Mock()

        @util.with_boto_retry(max_retries=1, pause_time_multiplier=1)
        def my_retried_method(count_func):
            count_func()
            return "foo"

        self.assertEqual("foo", my_retried_method(count_func))
        self.assertEqual(1, count_func.call_count)

    def test_get_pretty_parameters_string(self):
        template_body = {
            'Parameters': {
                'myParameter1': {
                    'Type': 'String',
                    'NoEcho': True
                },
                'myParameter2': {
                    'Type': 'String'
                },
                'myParameter3': {
                    'Type': 'Number',
                    'NoEcho': 'true'
                },
                'myParameter4': {
                    'Type': 'Number',
                    'NoEcho': 'false'
                },
                'myParameter5': {
                    'Type': 'Number',
                    'NoEcho': False
                }
            }
        }

        parameters = {
            'myParameter1': 'super-secret',
            'myParameter2': 'not-that-secret',
            'myParameter3': 'also-super-secret',
            'myParameter4': 'could-be-public',
            'myParameter5': 'also-ok'
        }

        template = CloudFormationTemplate(template_body, 'just-another-template')
        stack = CloudFormationStack(template, parameters, 'just-another-stack', 'eu-west-1')

        expected_string = """+--------------+-----------------+
|  Parameter   |      Value      |
+--------------+-----------------+
| myParameter1 |       ***       |
| myParameter2 | not-that-secret |
| myParameter3 |       ***       |
| myParameter4 | could-be-public |
| myParameter5 |     also-ok     |
+--------------+-----------------+"""

        self.assertEqual(expected_string, util.get_pretty_parameters_string(stack))

    def test_get_pretty_stack_outputs_returns_proper_table(self):
        outputs = [
            {
                'OutputKey': 'key1',
                'OutputValue': 'value1',
                'Description': 'desc1'
            }, {
                'OutputKey': 'key2',
                'OutputValue': 'value2',
                'Description': 'desc2'
            }, {
                'OutputKey': 'key3',
                'OutputValue': 'value3',
                'Description': 'desc3'
            }
        ]

        expected = """+--------+--------+
| Output | Value  |
+--------+--------+
|  key1  | value1 |
|  key2  | value2 |
|  key3  | value3 |
+--------+--------+"""

        result = util.get_pretty_stack_outputs(outputs)
        self.assertEqual(expected, result)

    def test_strip_string_strips_string(self):
        s = "sfsdklgashgslkadghkafhgaknkbndkjfbnwurtqwhgsdnkshGLSAKGKLDJFHGSKDLGFLDFGKSDFLGKHAsdjdghskjdhsdcxbvwerA323"
        result = util.strip_string(s)
        self.assertEqual(
            "sfsdklgashgslkadghkafhgaknkbndkjfbnwurtqwhgsdnkshGLSAKGKLDJFHGSKDLGFLDFGKSDFLGKHAsdjdghskjdhsdcxbvwe...",
            result)

    def test_strip_string_doesnt_strip_short_strings(self):
        s = "my-short-string"
        result = util.strip_string(s)
        self.assertEqual("my-short-string...", result)

    @patch("cfn_sphere.util.Repo")
    def test_get_git_repository_remote_url_returns_none_if_no_repository_present(self, repo_mock):
        repo_mock.side_effect = InvalidGitRepositoryError
        self.assertEqual(None, util.get_git_repository_remote_url(tempfile.mkdtemp()))

    @patch("cfn_sphere.util.Repo")
    def test_get_git_repository_remote_url_returns_repo_url(self, repo_mock):
        url = "http://config.repo.git"
        repo_mock.return_value.remotes.origin.url = url
        self.assertEqual(url, util.get_git_repository_remote_url(tempfile.mkdtemp()))

    @patch("cfn_sphere.util.Repo")
    def test_get_git_repository_remote_url_returns_repo_url_from_parent_dir(self, repo_mock):
        url = "http://config.repo.git"
        repo_object_mock = Mock()
        repo_object_mock.remotes.origin.url = url
        repo_mock.side_effect = [InvalidGitRepositoryError, repo_object_mock]

        self.assertEqual(url, util.get_git_repository_remote_url(tempfile.mkdtemp()))

    def test_get_git_repository_remote_url_returns_none_for_none_working_dir(self):
        self.assertEqual(None, util.get_git_repository_remote_url(None))

    def test_get_git_repository_remote_url_returns_none_for_empty_string_working_dir(self):
        self.assertEqual(None, util.get_git_repository_remote_url(""))

    def test_kv_list_to_dict_returns_empty_dict_for_empty_list(self):
        result = util.kv_list_to_dict([])
        self.assertEqual({}, result)

    def test_kv_list_to_dict(self):
        result = util.kv_list_to_dict(["k1=v1", "k2=v2"])
        self.assertEqual({"k1": "v1", "k2": "v2"}, result)

    def test_kv_list_to_dict_raises_exception_on_syntax_error(self):
        with self.assertRaises(CfnSphereException):
            util.kv_list_to_dict(["k1=v1", "k2:v2"])


text:
id: functions-develop-api
title: Use APIs
sidebar_label: "Use APIs"
---

````mdx-code-block
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
````

The following table outlines the APIs that you can use to develop Pulsar Functions in Java, Python, and Go.

| Interface | Description | Use case|
|---------|------------|---------|
| [Language-native interface for Java/Python](#use-language-native-interface-for-javapython) | No Pulsar-specific libraries or special dependencies required (only core libraries). | Functions that do not require access to the [context](functions-concepts.md#context).|
| [Pulsar Functions SDK for Java/Python/Go](#use-sdk-for-javapythongo) | Pulsar-specific libraries that provide a range of functionality not available in the language-native interfaces,  such as state management or user configuration. | Functions that require access to the [context](functions-concepts.md#context).|
| [Extended Pulsar Functions SDK for Java](#use-extended-sdk-for-java) | An extension to Pulsar-specific libraries, providing the initialization and close interfaces in Java. | Functions that require initializing and releasing external resources.|

## Use language-native interface for Java/Python

The language-native interface provides a simple and clean approach to writing Java/Python functions, by adding an exclamation point to all incoming strings and publishing the output string to a topic. It has no external dependencies.

The following examples are language-native functions.

````mdx-code-block
<Tabs groupId="lang-choice"
  defaultValue="Java"
  values={[{"label":"Java","value":"Java"},{"label":"Python","value":"Python"}]}>
<TabItem value="Java">

To use a piece of Java code as a "language-native" function, you need to implement the `java.util.Function` interface. You can include any sort of complex logic inside the `apply` method to provide more processing capabilities.

```java
import java.util.function.Function;

public class JavaNativeExclamationFunction implements Function<String, String> {
    @Override
    public String apply(String input) {
        return String.format("%s!", input);
    }
}
```

For more details, see [code example](https://github.com/apache/pulsar/blob/master/pulsar-functions/java-examples/src/main/java/org/apache/pulsar/functions/api/examples/JavaNativeExclamationFunction.java).

</TabItem>
<TabItem value="Python">

To use a piece of Python code as a "language-native" function, you must have a method named `process` as follows. It appends an exclamation point to any string value it receives.

```python
def process(input):
    return "{}!".format(input)
```

For more details, see [code example](https://github.com/apache/pulsar/blob/master/pulsar-functions/python-examples/native_exclamation_function.py).

:::note

Write Pulsar Functions in Python 3. To make sure your functions can run, you need to have Python 3 installed for functions workers and set Python 3 as the default interpreter.

:::

</TabItem>
</Tabs>
````

## Use SDK for Java/Python/Go

The implementation of Pulsar Functions SDK specifies a functional interface that includes the [context](functions-concepts.md#context) object as a parameter.

The following examples use Pulsar Functions SDK for different languages.

````mdx-code-block
<Tabs groupId="lang-choice"
  defaultValue="Java"
  values={[{"label":"Java","value":"Java"},{"label":"Python","value":"Python"},{"label":"Go","value":"Go"}]}>
<TabItem value="Java">

When developing a function using the Java SDK, you need to implement the `org.apache.pulsar.functions.api.Function` interface. It specifies only one method that you need to implement called `process`.

```java
import org.apache.pulsar.functions.api.Context;
import org.apache.pulsar.functions.api.Function;

public class ExclamationFunction implements Function<String, String> {
    @Override
    public String process(String input, Context context) {
        return String.format("%s!", input);
    }
}
```

For more details, see [code example](https://github.com/apache/pulsar/blob/master/pulsar-functions/java-examples/src/main/java/org/apache/pulsar/functions/api/examples/ExclamationFunction.java).

The return type of the function can be wrapped in a `Record` generic which gives you more control over the output messages, such as topics, schemas, properties, and so on.
Use the `Context::newOutputRecordBuilder` method to build this `Record` output.

```java
import java.util.HashMap;
import java.util.Map;
import org.apache.pulsar.functions.api.Context;
import org.apache.pulsar.functions.api.Function;
import org.apache.pulsar.functions.api.Record;

public class RecordFunction implements Function<String, Record<String>> {

    @Override
    public Record<String> process(String input, Context context) throws Exception {
        String output = String.format("%s!", input);
        Map<String, String> properties = new HashMap<>(context.getCurrentRecord().getProperties());
        context.getCurrentRecord().getTopicName().ifPresent(topic -> properties.put("input_topic", topic));

        return context.newOutputRecordBuilder(Schema.STRING)
                .value(output)
                .properties(properties)
                .build();
    }
}
```

For more details, see [code example](https://github.com/apache/pulsar/blob/master/pulsar-functions/java-examples/src/main/java/org/apache/pulsar/functions/api/examples/RecordFunction.java).

</TabItem>
<TabItem value="Python">

To develop a function using the Python SDK, you need to add the pulsar client dependency to your Python installation.

```python
from pulsar import Function

class ExclamationFunction(Function):
  def __init__(self):
    pass

  def process(self, input, context):
    return input + '!'
```

For more details, see [code example](https://github.com/apache/pulsar/blob/master/pulsar-functions/python-examples/exclamation_function.py).

</TabItem>
<TabItem value="Go">

To develop a function using the Go SDK, you need to add the pulsar client dependency to your Go installation and provide the name of the function to the `pf.Start()` method inside the `main()` method. This registers the function with the Pulsar Functions framework and ensures that the specified function can be invoked when a new message arrives.

```go
package main

import (
	"context"
	"fmt"

	"github.com/apache/pulsar/pulsar-function-go/pf"
)

func HandleRequest(ctx context.Context, in []byte) error{
	fmt.Println(string(in) + "!")
	return nil
}

func main() {
	pf.Start(HandleRequest)
}
```

For more details, see [code example](https://github.com/apache/pulsar/blob/77cf09eafa4f1626a53a1fe2e65dd25f377c1127/pulsar-function-go/examples/inputFunc/inputFunc.go#L20-L36).

</TabItem>
</Tabs>
````

## Use extended SDK for Java

This extended Pulsar Functions SDK provides two additional interfaces to initialize and release external resources.
- By using the `initialize` interface, you can initialize external resources which only need one-time initialization when the function instance starts.
- By using the `close` interface, you can close the referenced external resources when the function instance closes.

:::note

The extended Pulsar Functions SDK for Java is only available in Pulsar 2.10.0 or later versions. Before using it, you need to [set up function workers](functions-worker.md) in Pulsar 2.10.0 or later versions.

:::

The following example uses the extended interface of Pulsar Functions SDK for Java to initialize RedisClient when the function instance starts and release it when the function instance closes.

````mdx-code-block
<Tabs groupId="lang-choice"
  defaultValue="Java"
  values={[{"label":"Java","value":"Java"}]}>
<TabItem value="Java">

```java
import org.apache.pulsar.functions.api.Context;
import org.apache.pulsar.functions.api.Function;
import io.lettuce.core.RedisClient;

public class InitializableFunction implements Function<String, String> {
    private RedisClient redisClient;

    private void initRedisClient(Map<String, Object> connectInfo) {
        redisClient = RedisClient.create(connectInfo.get("redisURI"));
    }

    @Override
    public void initialize(Context context) {
        Map<String, Object> connectInfo = context.getUserConfigMap();
        redisClient = initRedisClient(connectInfo);
    }

    @Override
    public String process(String input, Context context) {
        String value = client.get(key);
        return String.format("%s-%s", input, value);
    }

    @Override
    public void close() {
        redisClient.close();
    }
}
```

</TabItem>
</Tabs>
````


text:
package com.amazonaws.services.simpleemail.model.transform;

import javax.xml.stream.events.XMLEvent;
import javax.annotation.Generated;

import com.amazonaws.services.simpleemail.model.*;
import com.amazonaws.transform.Unmarshaller;

import com.amazonaws.transform.StaxUnmarshallerContext;
import com.amazonaws.transform.SimpleTypeStaxUnmarshallers.*;

/**
 * IdentityNotificationAttributes StAX Unmarshaller
 */

@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class IdentityNotificationAttributesStaxUnmarshaller implements Unmarshaller<IdentityNotificationAttributes, StaxUnmarshallerContext> {

    public IdentityNotificationAttributes unmarshall(StaxUnmarshallerContext context) throws Exception {
        IdentityNotificationAttributes identityNotificationAttributes = new IdentityNotificationAttributes();
        int originalDepth = context.getCurrentDepth();
        int targetDepth = originalDepth + 1;

        if (context.isStartOfDocument())
            targetDepth += 1;

        while (true) {
            XMLEvent xmlEvent = context.nextEvent();
            if (xmlEvent.isEndDocument())
                return identityNotificationAttributes;

            if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {

                if (context.testExpression("BounceTopic", targetDepth)) {
                    identityNotificationAttributes.setBounceTopic(StringStaxUnmarshaller.getInstance().unmarshall(context));
                    continue;
                }

                if (context.testExpression("ComplaintTopic", targetDepth)) {
                    identityNotificationAttributes.setComplaintTopic(StringStaxUnmarshaller.getInstance().unmarshall(context));
                    continue;
                }

                if (context.testExpression("DeliveryTopic", targetDepth)) {
                    identityNotificationAttributes.setDeliveryTopic(StringStaxUnmarshaller.getInstance().unmarshall(context));
                    continue;
                }

                if (context.testExpression("ForwardingEnabled", targetDepth)) {
                    identityNotificationAttributes.setForwardingEnabled(BooleanStaxUnmarshaller.getInstance().unmarshall(context));
                    continue;
                }

                if (context.testExpression("HeadersInBounceNotificationsEnabled", targetDepth)) {
                    identityNotificationAttributes.setHeadersInBounceNotificationsEnabled(BooleanStaxUnmarshaller.getInstance().unmarshall(context));
                    continue;
                }

                if (context.testExpression("HeadersInComplaintNotificationsEnabled", targetDepth)) {
                    identityNotificationAttributes.setHeadersInComplaintNotificationsEnabled(BooleanStaxUnmarshaller.getInstance().unmarshall(context));
                    continue;
                }

                if (context.testExpression("HeadersInDeliveryNotificationsEnabled", targetDepth)) {
                    identityNotificationAttributes.setHeadersInDeliveryNotificationsEnabled(BooleanStaxUnmarshaller.getInstance().unmarshall(context));
                    continue;
                }
            } else if (xmlEvent.isEndElement()) {
                if (context.getCurrentDepth() < originalDepth) {
                    return identityNotificationAttributes;
                }
            }
        }
    }

    private static IdentityNotificationAttributesStaxUnmarshaller instance;

    public static IdentityNotificationAttributesStaxUnmarshaller getInstance() {
        if (instance == null)
            instance = new IdentityNotificationAttributesStaxUnmarshaller();
        return instance;
    }
}


text:
Two versions have been developed, the first one is a simple Java client application implementing a Java swing GUI, the second one is a web application implementing a Tomcat server and Primefaces acting as a "glue" between the Java core and the HTML page. The project has been developed using a MVC architecture with a Proxy/Skeleton pattern including a multi-threaded environment, the application setup is modular and easily extendable, the core is essentially a web crawler written in Java.

----
## GG well trade! (BETA)

...allows you to find trades from the most used Rocket League trades platforms.

# How to

To perform a new search please follow these easy steps:

1. Put in the [H]ave panel the item you WANT
2. Put in the [W]ant panel the item you HAVE
3. To run press the Start button
4. Press the Stop button to cancel the current search
5. Double-click on a trade to open it

###### Remember that you don't need to Start Stop the current search to find new trades, they will be added to the list automatically.

If new items are added to the game please use the "Update items" function under the Menu and expect a new update.
For newer versions please refer to this page or to my profiles.

If you like my work, please donate, I really appreciated any type of donations :)

[![Paypal](https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QH56EW28TJGEY)

*Donators*

-------------
**ENJOY!**

# Terms and conditions

This application is published under the MIT License, modified version of the original work must contains original author's references.
By downloading, copying or using the Software, You agree to the terms and conditions of this Agreement.

*Softwares under [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0.html) were used for the project.*

*Copyright (c) Antonio Santoro - 2016*


text:
package twatcher.exceptions

class TwatcherException(msg: String, parent: Throwable = null) extends RuntimeException(msg, parent)

class InsertZipTweetException(msg: String, parent: Throwable = null) extends TwatcherException(msg, parent)


text:
<?php

namespace SocialiteProviders\Everyplay;

use SocialiteProviders\Manager\SocialiteWasCalled;

class EveryplayExtendSocialite
{
    /**
     * Register the provider.
     *
     * @param \SocialiteProviders\Manager\SocialiteWasCalled $socialiteWasCalled
     */
    public function handle(SocialiteWasCalled $socialiteWasCalled)
    {
        $socialiteWasCalled->extendSocialite(
            'everyplay', __NAMESPACE__.'\Provider'
        );
    }
}


text:
package org.apache.geode.admin;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Date;

import org.apache.geode.internal.i18n.LocalizedStrings;

/**
 * AdminConfig loads/stores the member information list. The list contains all of the members being
 * monitored.
 *
 * Config must be of the format:
 *

 *
Name=What you want displayed as a name for the instance
 *
Type=SERVER|CLIENT
 *
Host=A valid hostname or IP Address where the instance is running
 *
Port=The port you are using to open the monitor port for the instance
 *
 * @deprecated as of 7.0 use the management
 *             package instead
 */
public class AdminConfig {
  // Name, Type, Host, Port
  public static Entry[] loadConfig(File file) throws IOException {

    // Place all lines into stack
    ArrayList entryList = new ArrayList();
    FileReader reader = null;
    BufferedReader fileReader = null;
    try {
      reader = new FileReader(file);
      fileReader = new BufferedReader(reader);
      // Read the first line.
      String line = fileReader.readLine();

      while (line != null) {
        line = line.trim();

        // Replace tabs with spaces
        line = line.replace('\t', ' ');

        // Skip all empty and comment lines
        if (line.length() != 0 && line.startsWith("#") == false) {
          try {
            entryList.add(new Entry(line));
          } catch (Exception ex) {
            // ignore - drop any lines that are not valid
          }
        }
        line = fileReader.readLine();
      }
    } finally {
      if (fileReader != null) {
        fileReader.close();
      }
      if (reader != null) {
        reader.close();
      }
    }

    return (Entry[]) entryList.toArray(new Entry[0]);
  }

  public static void storeConfig(File file, AdminConfig.Entry entries[]) throws IOException {
    FileOutputStream fos = null;
    PrintStream ps = null;
    try {
      fos = new FileOutputStream(file);
      ps = new PrintStream(fos);

      // Header
      ps.print("#");
      ps.println(
          LocalizedStrings.AdminConfig_THIS_FILE_IS_GENERATED_BY_ADMINCONSOLE_EDIT_AS_YOU_WISH_BUT_IT_WILL_BE_OVERWRITTEN_IF_IT_IS_MODIFIED_IN_ADMINCONSOLE
              .toLocalizedString());
      ps.println("#");
      ps.println(LocalizedStrings.AdminConfig_MODIFIED_0.toLocalizedString(new Date()));
      ps.println("#");
      ps.println("# Name, Type, Host, Port");
      ps.println("#");
      int len = entries.length;
      for (int i = 0; i < len; i++) {
        ps.println(entries[i].toString());
      }
      ps.flush();
    } finally {
      if (ps != null) {
        ps.close();
      }
      if (fos != null) {
        fos.close();
      }
    }
  }

  public static class Entry {
    public String name;
    public String type;
    public String host;
    public int port;

    public Entry(String line) {
      // Split
      String split[] = line.split(",");

      // Convert line to parameters
      name = split[0].trim();
      type = split[1].trim();
      host = split[2].trim();
      port = Integer.parseInt(split[3]);
    }

    public Entry(String name, String type, String host, int port) {
      this.name = name;
      this.type = type;
      this.host = host;
      this.port = port;
    }

    @Override // GemStoneAddition
    public String toString() {
      return name + "," + type + "," + host + "," + port;
    }
  }
}


text:
package fr.sgr.formation.voteapp.vote.services;

import lombok.Builder;
import lombok.Getter;

public class VoteInvalideException extends Exception {
	@Getter
	private ErreurVote erreur;

	@Builder
	public VoteInvalideException(ErreurVote erreur, Throwable cause) {
		super(cause);

		this.erreur = erreur;
	}

	public VoteInvalideException(ErreurVote erreur) {
		this.erreur = erreur;
	}

	public enum ErreurVote {
		VOTEKEY_OBLIGATOIRE("L'utilisateur et l'élection sont obligatoires."),
		CHOIX_OBLIGATOIRE("Le choix est obligatoire."),
		VOTE_OBLIGATOIRE("Le vote est obligatoire pour effectuer l'opération."),
		VOTE_EXISTANT("Ce vote existe déjà."),
		VOTEKEY_NON_EXISTANT("Ce couple utilisateur/élection n'existe pas"),
		UTILISATEUR_NON_ENREGISTRE("Cette utilisateur est non enregistré, il ne peut donc pas voter"),
		ELECTION_INEXISTANTE("Cette élection n'existe pas"),
		ELECTION_CLOTURE("Cette élection est cloturé"),
		DEJA_VOTE("Vous avez déja voté pour cette élection"),
		CHOIX_NON_AUTORISE("Ce choix n'est pas autorisé, veuillez choisir oui ou non");

		@Getter
		public String message;

		private ErreurVote(String message) {
			this.message = message;
		}
	}
}


text:
class ElectroBounce::PageController < ApplicationController
  def index
    @title = "Electro Bounce"
  end
end


text:
<?php
namespace RikardKarlsson\Dice100;

//include('CPlayer.php');
/**
 * @author Rikard Karlsson
 * @version 2014-02-15
 */
class CDiceGame100 implements \Serializable {
    private $players; //an array containing objects of Player
    private $noPlayers;
    private $dice;
    private $activePlayerIndex;
    private $state;

    const ADD_PLAYER_STATE = 0;
    const PLAY_GAME_STATE = 1;
    const DISPLAY_WINNER_STATE = 2;
    const PLAY_GAME_NR_1_STATE = 3;
    const MAX_NO_PLAYERS = 4;
    const COMPUTER_STAY_LIMIT = 22;

    public function __construct() {
        $this->players = array();
        $this->dice = new CDice();
        $this->dice->roll();
        $this->noPlayers = 0;
        $this->activePlayerIndex = 0;
        $this->state = self::ADD_PLAYER_STATE;
    }
    public function restart() {
        $this->dice->roll();
        $this->activePlayerIndex = 0;
        $this->state = self::PLAY_GAME_STATE;
        foreach ($this->players as $player) {
            $player->reset();
        }
    }
    public function serialize() {
        $players = array();
        foreach ($this->players as $key => $player) {
            $players[$key] = serialize($player);
        }
        return serialize(array('players' => $players,
                            'noPlayers' => $this->noPlayers,
                            'dice' => serialize($this->dice),
                            'activePlayerIndex' => $this->activePlayerIndex,
                            'state' => $this->state
        ));
    }
    public function unserialize($serializedData) {
        $data = unserialize($serializedData);
        $this->dice = unserialize($data['dice']);
        //$this->players = $data['players'];
        $this->players = array();
        foreach ($data['players'] as $key => $serialPlayer) {
            $this->players[$key] = unserialize($serialPlayer);
        }
        $this->noPlayers = $data['noPlayers'];
        $this->activePlayerIndex = $data['activePlayerIndex'];
        $this->state = $data['state'];
    }
    public function addPlayer(CPlayer $player) {
        $this->players[] = $player;
        ++$this->noPlayers;
    }
    private function getActivePlayer() {
        //dump($this->players[$this->activePlayerIndex]);
        //var_dump($this->activePlayerIndex);
        //dump($this->players);
        return $this->players[$this->activePlayerIndex];
    }
    public function run() {
        //dump($this->players[0], "in function run");
        //$this->dice->roll();
        //var_dump($this->state);
        //var_dump(self::PLAY_GAME_STATE);
        if ( $this->state == self::ADD_PLAYER_STATE ) {

        }
        if ( $this->state == self::PLAY_GAME_STATE || $this->state == self::PLAY_GAME_NR_1_STATE) {
            //dump($_GET);
            //$this->dice->roll();
            $activePlayer = $this->getActivePlayer();

            if (isset($_GET['do']) && $_GET['do'] == 'next'){
                $this->nextPlayer();
                $activePlayer = $this->getActivePlayer();
                $this->state = self::PLAY_GAME_STATE;
            }

            if (isset($_GET['do']) && $_GET['do'] == 'save'){
                $activePlayer->saveScore();
                if ( $activePlayer->isWinner()) {
                    $this->state = self::DISPLAY_WINNER_STATE;
                }
                else {
                    $this->nextPlayer();
                    $activePlayer = $this->getActivePlayer();
                }
            }
            if ( !$activePlayer->isWinner() ) {
                $this->dice->roll();
                //echo "roll";
                if ( $this->dice->getNumber() == 1) {
                    //next player turn
                    $activePlayer->resetUnsavedScore();

                    $this->state = self::PLAY_GAME_NR_1_STATE;
                }
                else {
                    $activePlayer->incUnsavedScoreWith($this->dice->getNumber());
                    /*
                    if ( $activePlayer->isWinner() ) {
                        //is winner
                        $activePlayer->saveScore();
                    }*/
                }
            }
        }
    }
    private function nextPlayer() {
        $this->activePlayerIndex++;
        $this->activePlayerIndex %= $this->noPlayers;
    }
    public function getHtml() {
        if ( $this->state == self::ADD_PLAYER_STATE )
        {
            //Display the names of choosen players
            $htmlPlayerNames = "";
            foreach ($this->players as $player) {
                //$playerNames .="($playerNo)" . $player->getName() . " ";
                //++$playerNo;
                $htmlPlayerNames .= "
";
                $htmlPlayerNames .= "
" . $player->getName() . "
";
                $htmlPlayerNames .= "
";
            }
            $html = "
Lägg till en spelare och spela eller lägg till fler spelare
";
            $html .= "<form class='form' method='post'>";
            $html .= "
";
            $html .= "Spelarens namn
";
            $html .= "<input type='text' name='player_name'/>";
            $html .= "
";
            $html .= "
";
            $html .= "Välj mellan datorspelare och mänsklig spelare";
            $html .= "
";
            $html .= "
";
            $html .= "<select name='is_human_player'>";
            $html .= "<option value='human'>Människa</option>";
            $html .= "<option value='computer'>Dator</option>";
            $html .= "</select>";
            $html .= "
";
            $html .= "
";
            $html .= "<input  class='button button--smaller' type='submit' name='play_game' value = 'Spela'/>";
            $html .= "
";
            if ( $this->noPlayers < self::MAX_NO_PLAYERS - 1 ) {
                $html .= "
";
                $html .= "<input class='button button--smaller' type='submit' name='add_player' value = 'Lägg till fler spelare'/>";
                $html .= "
";
            }
            $html .= "</form>";
            $html .= $htmlPlayerNames;
            $html .= "";

        }
        else {

            $html = "
";
            //$html .= "
Start om
";
            $html .= "<form method='post'>";
            $html .= "
<input class='button button--smaller' type='submit' name='restart' value = 'Starta om med nya spelare' />
";
            $html .= "</form>";

            $activePlayer = $this->players[$this->activePlayerIndex];
            //($activePlayer, "\$activePlayer");
            foreach ($this->players as $key => $player) {

                $html .= "
";
                $html .= "
" . $player->getName() . "
";
                //$html .= "
";
                $html .= "
Sparad poäng: " . $player->getSavedScore() . "
";
                if ( $key == $this->activePlayerIndex ) {

                    $html .= "
Ej sparad poäng: " . $activePlayer->getUnsavedScore() . "
";
                    //$html .= "
Antal ögon: " . $this->dice->getNumber() . "
";
                    $html .= $this->dice->getHtml();
                    if ( $this->state == self::PLAY_GAME_NR_1_STATE ) {
                        $html .= "
Nästa spelare
";
                    }
                    else if ( $this->state == self::PLAY_GAME_STATE )
                    {
                        if ( $activePlayer->isHuman() ) {
                            $html .= "
Kasta
                                    Spara
";
                        }
                        else { //is computer
                            //$html .= "<input type='hidden' name='do' value='roll' />";
                            $computerChoice = $this->getComputerChoice();
                            $html .= "

                                    Låt datorn välja
";
                        }
                    }
                    else if ( $this->state == self::DISPLAY_WINNER_STATE) {
                        $html .= "
WINNER!
";
                        $html .= "<form method='post'>";//"
Spela igen
";
                        $html .= "<input class='button button--smaller' type='submit' name='new_game' value = 'Spela igen med samma spelare'  />";
                        $html .= "</form>";
                    }
                }
                $html .= "
";
            }
            $html .= "
";
        }
        return $html;
    }
    private function getComputerChoice() {
        $activePlayer = $this->getActivePlayer();
        if ( $activePlayer->getUnsavedScore() < self::COMPUTER_STAY_LIMIT ) {
            return "roll";
        }
        return "save";
    }
    public function setPlayGameState() {
        $this->state = self::PLAY_GAME_STATE;
    }
}


text:
import setuptools
from setuptools import find_packages, setup
import sys

from caar import __version__

INSTALL_REQUIRES = [
    'future',
    'numpy',
    'pandas',
]
EXTRAS_REQUIRE = {
    'testing': ['pytest'],
}

if int(setuptools.__version__.split(".", 1)[0]) < 18:
    assert "bdist_wheel" not in sys.argv
    if sys.version_info[0:2] < (3, 5):
        INSTALL_REQUIRES.append("configparser")
else:
    EXTRAS_REQUIRE[":python_version<'3.5'"] = ["configparser"]

setup(
    name='caar',
    version=__version__,
    url='http://github.com/nickpowersys/CaaR/',
    license='BSD 3-Clause License',
    author='Nicholas A. Brown',
    author_email='nbprofessional@gmail.com',
    description='Accelerating analysis of time stamped sensor observations and '
                'cycling device operations.',
    install_requires=INSTALL_REQUIRES,
    packages=find_packages(exclude=['docs']),
    package_data={
    },
    data_files=[
    ],
    include_package_data=True,
    platforms='any',
    classifiers=[
        'Development Status :: 4 - Beta',
        'Intended Audience :: Science/Research',
        'License :: OSI Approved :: BSD License',
        'Natural Language :: English',
        'Operating System :: MacOS :: MacOS X',
        'Operating System :: Microsoft :: Windows',
        'Operating System :: POSIX :: Linux',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3.4',
        'Programming Language :: Python :: 3.5',
        'Topic :: Scientific/Engineering :: Information Analysis',
        'Topic :: Software Development :: Libraries :: Python Modules',
        ],
    extras_require=EXTRAS_REQUIRE,
)


text:
package com.emc.storageos.model.compute;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

import org.codehaus.jackson.annotate.JsonProperty;

import com.emc.storageos.model.valid.Length;

@XmlRootElement(name = "compute_imageserver_create")
public class ComputeImageServerCreate {
    private String name;
    private String imageServerIp;
    private String imageServerSecondIp;
    private String imageServerUser;
    private String imageServerPassword;
    private String tftpBootDir;
    private Integer osInstallTimeout;
    private Integer sshTimeout;
    private Integer imageImportTimeout;

    public ComputeImageServerCreate() {
    }

    /**
     * ComputeImageServerCreate Constructor
     * @param name
     * @param imageServerAddress
     * @param imageServerSecondIp
     * @param imageServerUser
     * @param imageServerPassword
     * @param tftpBootDir
     * @param osInstallTimeout
     * @param sshTimeout
     * @param imageImportTimeout
     */
    public ComputeImageServerCreate(String name, String imageServerAddress,
            String imageServerSecondIp, String imageServerUser,
            String imageServerPassword, String tftpBootDir,
            Integer osInstallTimeout, Integer sshTimeout, Integer imageImportTimeout) {
        super();
        this.name = name;
        this.imageServerIp = imageServerAddress;
        this.imageServerSecondIp = imageServerSecondIp;
        this.imageServerUser = imageServerUser;
        this.imageServerPassword = imageServerPassword;
        this.tftpBootDir = tftpBootDir;
        this.osInstallTimeout = osInstallTimeout;
        this.sshTimeout = sshTimeout;
        this.imageImportTimeout = imageImportTimeout;
    }

    /**
     * @return the imageServerIp
     */
    @XmlElement(required = true, name = "imageserver_ip")
    @JsonProperty("imageserver_ip")
    public String getImageServerIp() {
        return imageServerIp;
    }

    /**
     * @param imageServerIp
     *            the imageServerIp to set
     */
    public void setImageServerIp(String imageServerIp) {
        this.imageServerIp = imageServerIp;
    }

    /**
     * @return the imageServerSecondIp
     */
    @XmlElement(required = true, name = "imageserver_secondip")
    @JsonProperty("imageserver_secondip")
    public String getImageServerSecondIp() {
        return imageServerSecondIp;
    }

    /**
     * @param imageServerSecondIp
     *            the imageServerSecondIp to set
     */
    public void setImageServerSecondIp(String imageServerSecondIp) {
        this.imageServerSecondIp = imageServerSecondIp;
    }

    /**
     * @return the imageServerUser
     */
    @XmlElement(required = true, name = "imageserver_user")
    @JsonProperty("imageserver_user")
    public String getImageServerUser() {
        return imageServerUser;
    }

    /**
     * @param imageServerUser
     *            the imageServerUser to set
     */
    public void setImageServerUser(String imageServerUser) {
        this.imageServerUser = imageServerUser;
    }

    /**
     * @return the password
     */
    @XmlElement(required = true , name = "imageserver_password")
    @JsonProperty("imageserver_password")
    public String getImageServerPassword() {
        return imageServerPassword;
    }

    /**
     * @param imageServerPassword
     *            the password to set
     */
    public void setImageServerPassword(String imageServerPassword) {
        this.imageServerPassword = imageServerPassword;
    }

    /**
     * @return the tftpBootDir
     */
    @XmlElement(required = true, name = "tftpBootDir")
    @JsonProperty("tftpBootDir")
    public String getTftpBootDir() {
        return tftpBootDir;
    }

    /**
     * @param tftpBootDir
     *            the tftpBootDir to set
     */
    public void setTftpBootDir(String tftpBootDir) {
        this.tftpBootDir = tftpBootDir;
    }

    /**
     * @return the osInstallTimeout
     */
    @XmlElement(required = true, name = "osinstall_timeout")
    @JsonProperty("osinstall_timeout")
    public Integer getOsInstallTimeout() {
        return osInstallTimeout;
    }

    /**
     * @param osInstallTimeout
     *            the osInstallTimeout to set
     */
    public void setOsInstallTimeout(Integer osInstallTimeout) {
        this.osInstallTimeout = osInstallTimeout;
    }

    /**
     * @return the name
     */
    @XmlElement(required = true)
    @Length(min = 2, max = 128)
    public String getName() {
        return name;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @return the sshTimeout
     */
    @XmlElement(required = true, name = "ssh_timeout")
    @JsonProperty("ssh_timeout")
    public Integer getSshTimeout() {
        return sshTimeout;
    }

    /**
     * @param sshTimeout the sshTimeout to set
     */
    public void setSshTimeout(Integer sshTimeout) {
        this.sshTimeout = sshTimeout;
    }

    /**
     * @return the imageImportTimeout
     */
    @XmlElement(required = true, name = "imageimport_timeout")
    @JsonProperty("imageimport_timeout")
    public Integer getImageImportTimeout() {
        return imageImportTimeout;
    }

    /**
     * @param imageImportTimeout the imageImportTimeout to set
     */
    public void setImageImportTimeout(Integer imageImportTimeout) {
        this.imageImportTimeout = imageImportTimeout;
    }

}


text:
TAG=${TAG:-dev}
IMAGE=cattle/agent-instance:${TAG}

cd $(dirname $0)
docker build -t ${IMAGE} .

if [ -n "$IMAGE_REGISTRY" ]; then
    echo $IMAGE >> ${IMAGE_REGISTRY}
fi


text:
import { connect } from "react-redux";
import TargetSequence from "../components/target-sequence";
import AppState from "../model/app-state";
import { IStateProps } from "../props/target-sequence-props";

const mapStateToProps = (state: AppState): IStateProps => {
  return {
    isGameOver: state.isGameLost || state.isGameWon,
    targetSequence: state.targetSequence.toArray(),
  };
};

export default connect<IStateProps, null, null>(
  mapStateToProps,
  null,
)(TargetSequence);


text:
*+SCAN_RAIN_GAUGE

       subroutine scan_rain_gauge (ifile, isamp1, isamp2, ivar, log,
     :                                                    rmax, status)
C      ----------------------------------------------------------------
C
C  Scans rain gauge readings within sample file.
C
C  Given:
C      IFILE         integer       sample file logical unit number
C      ISAMP1        integer       first sample
C      ISAMP2        integer       last sample
C      IVAR          integer       selects display variable
C      LOG           logical       log fluctuations control flag
C      RMAX          real          log fluctuations > RMAX
C
C  Returned:
C      STATUS        integer       status value
C
C  [RYLE Telescope only].
C
C  Subroutine to scan the sample file currently opened on logical unit
C  IFILE, and report the rain gauge readings recorded during the observation,
C  for the aerials included in the given aerial list.  A table is produced
C  of the minimum, maximum and mean readings within the specified sample
C  range.
C
C  Changes in the readings during the run may also be logged.
C
C  If IVAR=1, the rain gauge readings themselves are displayed.
C  If IVAR=2, the derived rain correction factors are displayed.
C
C  The STATUS value should be zero on entry.
C
C  [DJT, 3/4/90]
*-
       integer    ifile, isamp1, isamp2, ivar, status
       real       rmax
       logical    log
c
       include '/mrao/post/include/5km_constants.inc'
       include '/mrao/include/chrlib_functions.inc'
       include '/mrao/include/iolib_functions.inc'
c
       character  stime*8
       integer    i, iae, isamp, n, nae
       integer    itime(3), isecs, iout, length
       integer    samp_status, samp_sid_time, samp_wt
       real*8     samp_ra, samp_dec
       logical    report
c
c  Workspace
c
       real*8     rain_mean(max_aes), rain_rms(max_aes)
       real*4     rain_min(max_aes), rain_max(max_aes)
       real*4     rain(max_aes), value(max_aes)
c
       common /post/ rain_mean, rain_rms, rain_min, rain_max, rain,
     :               value
c
c
       if (status.ne.0) return
c
       call io_enqout(iout)
c
       nae = max_aes
       do iae=1,nae
         rain_min(iae)=10.0
         rain_max(iae)=-10.0
         rain_mean(iae)=0.d0
         rain_rms(iae)=0.d0
       enddo
c
       if (log) then
         write(iout,'(/20X,A,8I6)')'aerials',(i,i=1,nae)
         write(iout,*)
       endif
c
       n=0
       do isamp=isamp1,isamp2
         call set_monitor(ifile,isamp,status)
         call enq_samp_rt(ifile,samp_status,samp_ra,samp_dec,
     *                          samp_sid_time,samp_wt,status)
         if (status.eq.0) then
c
c  For each aerial
c
           report=.false.
           do iae=1,nae
c
c    Report fluctuations greater than RMAX
c
             if (ivar.eq.1) then
               call enq_mon_rain( ifile, iae, value(iae), status )
             elseif (ivar.eq.2) then
               call enq_mon_rfac( ifile, iae, value(iae), status )
             endif
             if (abs(rain(iae)-value(iae)).gt.rmax) then
               if (log) report=.true.
             endif
c
c    Accumulate min, max, sum, sum**2
c
             if (value(iae).lt.rain_min(iae)) then
               rain_min(iae)=value(iae)
             elseif (value(iae).gt.rain_max(iae)) then
               rain_max(iae)=value(iae)
             endif
             rain_mean(iae)=rain_mean(iae)+value(iae)
             rain_rms(iae)=rain_rms(iae)+value(iae)*value(iae)
           enddo
           n=n+1
         endif
c
         if (report) then
           do iae=1,nae
             rain(iae)=value(iae)
           enddo
           isecs=samp_sid_time/10
           call util_stohms(isecs,itime)
           call chr_chtime(itime,stime,length)
           write(iout,1)isamp,stime,(rain(iae),iae=1,nae)
    1      format(' sample',I5,2X,A,' ST',2X,8F6.2)
           if (io_attn(status)) return
         endif
c
       enddo
c
c    Print out min, max, mean, rms by aerial
c
       if (n.gt.0 .and. .not.log) then
         do iae=1,nae
           rain_mean(iae)=rain_mean(iae)/n
           rain_rms(iae)=rain_rms(iae)/n-rain_mean(iae)*rain_mean(iae)
           rain_rms(iae)=dsqrt(dmax1(0.d0,rain_rms(iae)))
         enddo
         if (ivar.eq.1) then
           write(iout,2)n,isamp1,isamp1+n-1
         elseif (ivar.eq.2) then
           write(iout,3)n,isamp1,isamp1+n-1
         endif
         do iae=1,nae
           write(iout,4)iae,rain_min(iae),rain_max(iae),
     :                      rain_mean(iae),rain_rms(iae)
         enddo
c
    2    format(I6,' samples read, ',I5,' to',I5//
     :             ' Min, max, mean rain gauge readings:'/X,34('-'))
    3    format(I6,' samples read, ',I5,' to',I5//
     :             ' Min, max, mean rain correction factors:'/X,39('-'))
    4    format(2X,'ae',I3,2X,2(2F7.2,F7.1,'  (',F4.1,')'))
c
       endif
c
       end