text:
/** Event.java
 * 24/mag/2012 17:54:23
 * Last edit: 24/mag/2012 17:54:23
 *
 *
 */

package object.actor;

/**
 *
 * Questa è la classe di costruzione e gestione degli Eventi.
 * Un evento conserva semplicemente soggetto, predicato, complemento oggetto, ecc.
 * Più specificatamente, ogni oggetto ha:
 * 	un tipo
 *	un soggetto
 * 	un predicato
 * 	un complemento oggetto
 * 	ed eventualmente un personaggio "partner".
 */
public class Event extends object.GameObject {

	/** L'enum predicate può essere del tipo:
	 *

	 * Da
	 * Posside
	 * Si trova in
	 * Esce da
	 * Domanda
	 * Parla
	 */
	public enum Predicate {DA, POSSIEDE, SI_TROVA_IN, ESCE_DA, DOMANDA, PARLA};

	/** L'enum EventType può essere del tipo:
	 *

	 * Locazione
	 * Interazione
	 * Possesso
	 * Domanda
	 */
	public enum EventType {LOCATION, INTERACTION, POSSESSION, QUESTION};

	/* Attributi di stato. */
	private Actor subject;
	private Predicate verb;
	private object.GameObject cobject;
	private Actor atobject;

	private EventType type;

	/** Questo è il più semplice costruttore di evento, semplicemente un soggetto, un verbo, e un complemento oggetto.
	 * Esempio:
	 * a Possiede o */
	public Event(Actor subject, Predicate verb, object.thing.Thing cobject) {
		super(createEventCode(EventType.POSSESSION, subject, verb, cobject, null), createEventCode(EventType.POSSESSION, subject, verb, cobject, null));
		this.subject = subject;
		this.verb = verb;
		this.cobject = cobject;
		this.type = EventType.POSSESSION;
		atobject = null;
	}

	/** Questo costruttore invece, si riferisce agli eventi del tipo:
	 * 	a SI_TROVA_IN b, oppure
	 * a ESCE_DA b */
	public Event(Actor subject, Predicate verb, object.location.Location cobject) {
		super(createEventCode(EventType.LOCATION, subject, verb, cobject, null), createEventCode(EventType.LOCATION, subject, verb, cobject, null));
		this.subject = subject;
		this.verb = verb;
		this.cobject = cobject;
		this.type = EventType.LOCATION;
		atobject = null;
	}

	/** Questo costruttore invece riguarda le interazioni tra i personaggi, ad esempio:
	 * a DA o1 A b
	 */
	public Event(Actor subject, Predicate verb, object.thing.Thing cobject, Actor atobject) {
		super(createEventCode(EventType.INTERACTION, subject, verb, cobject, atobject), createEventCode(EventType.INTERACTION, subject, verb, cobject, atobject));
		this.type = EventType.INTERACTION;
		this.atobject = atobject;
	}

	/** Questo costruttore riguarda le interazioni tra personaggi:
	 * a domanda cobject a b
	 */
	public Event(Actor subject, Predicate verb, Event cobject, Actor atobject) {
		super(createEventCode(EventType.QUESTION, subject, verb, cobject, atobject), createEventCode(EventType.QUESTION, subject, verb, cobject, atobject));
		this.subject = subject;
		this.verb = verb;
		this.cobject = cobject;
		this.type = EventType.QUESTION;
		this.atobject = atobject;
	}

	/** Questo costruttore riguarda il parlare semplicemente:
	 * a parla (con) b
	 * @param subject
	 * @param verb
	 * @param atobject
	 */
	public Event(Actor subject, Predicate verb, Actor atobject) {
		super(createEventCode(EventType.QUESTION, subject, verb, null, atobject),createEventCode(EventType.QUESTION, subject, verb, null, atobject));
		this.subject = subject;
		this.verb = verb;
		this.type = EventType.QUESTION;
		this.atobject = atobject;
	}

	/** Questo metodo ha il compito di fornire ad ogni Evento un codice univoco, in modo da poter tratteri gli eventi come oggetti di gioco.
	 * In realta' univoco è una parola forte: tale codice sarà associato alle componenenti dell'evento. Quindi a parita' di componenti, anche il codice evento sarà lo stesso. */
	public static String createEventCode(EventType type, Actor subject, Predicate verb, object.GameObject cobject, Actor atobject) {
		String sr = "EV_";
		sr += type.toString() + "_" + subject.getCode() + "_" + verb.toString();

		if (cobject != null) {
			sr += "_" + cobject.toString();
		}

		if (atobject != null) {
			sr += "_" + atobject.toString();
		}

		return sr;
	}

	public Actor getSubject() {
		return subject;
	}

	public Predicate getVerb() {
		return verb;
	}

	public object.GameObject getCobject() {
		return cobject;
	}

	public EventType getType() {
		return type;
	}

	public Actor getAtobject() {
		return atobject;
	}

	@Override
	/** Il metodo toString degli eventi ritorna, con una grammatica a dir poco stilizzata, la descrizione dell'evento. */
	public String toString() {
		String s;

		if (this.type == EventType.POSSESSION || this.type == EventType.LOCATION ) {
			s = subject.toString() + " " + verb.toString() + " " + cobject.toString();
		}

		else if (this.type == EventType.QUESTION && this.cobject == null) {
			s = subject.toString() + " " + verb.toString() + " " + atobject.toString();
		}

		else {
			s = subject.toString() + " " + verb.toString() + " " + cobject.toString() + " " + atobject.toString();
		}

		return s;
	}
}


text:
// This file contains common part of defintions for rx.time.d.ts and rx.lite.d.ts
// Do not include the file separately.

///<reference path="rx-lite.d.ts" />

declare module Rx {
	export interface TimeInterval<T> {
		value: T;
		interval: number;
	}

	export interface Timestamp<T> {
		value: T;
		timestamp: number;
	}

	export interface Observable<T> {
		delay(dueTime: number, scheduler?: IScheduler): Observable<T>;
		throttle(dueTime: number, scheduler?: IScheduler): Observable<T>;
		timeInterval(scheduler?: IScheduler): Observable<TimeInterval<T>>;
		timestamp(scheduler?: IScheduler): Observable<Timestamp<T>>;
		sample(interval: number, scheduler?: IScheduler): Observable<T>;
		sample<TSample>(sampler: Observable<TSample>, scheduler?: IScheduler): Observable<T>;
		timeout(dueTime: Date, other?: Observable<T>, scheduler?: IScheduler): Observable<T>;
		timeout(dueTime: number, other?: Observable<T>, scheduler?: IScheduler): Observable<T>;

		delaySubscription(dueTime: number, scheduler?: IScheduler): Observable<T>;
		delayWithSelector(delayDurationSelector: (item: T) => number): Observable<T>;
		delayWithSelector(subscriptionDelay: number, delayDurationSelector: (item: T) => number): Observable<T>;

		timeoutWithSelector<TTimeout>(firstTimeout: Observable<TTimeout>, timeoutdurationSelector?: (item: T) => Observable<TTimeout>, other?: Observable<T>): Observable<T>;
		throttleWithSelector<TTimeout>(throttleDurationSelector: (item: T) => Observable<TTimeout>): Observable<T>;

		skipLastWithTime(duration: number, scheduler?: IScheduler): Observable<T>;
		takeLastWithTime(duration: number, timerScheduler?: IScheduler, loopScheduler?: IScheduler): Observable<T>;

		takeLastBufferWithTime(duration: number, scheduler?: IScheduler): Observable<T[]>;
		takeWithTime(duration: number, scheduler?: IScheduler): Observable<T>;
		skipWithTime(duration: number, scheduler?: IScheduler): Observable<T>;

		skipUntilWithTime(startTime: Date, scheduler?: IScheduler): Observable<T>;
		skipUntilWithTime(duration: number, scheduler?: IScheduler): Observable<T>;
		takeUntilWithTime(endTime: Date, scheduler?: IScheduler): Observable<T>;
		takeUntilWithTime(duration: number, scheduler?: IScheduler): Observable<T>;
	}

	interface ObservableStatic {
		interval(period: number, scheduler?: IScheduler): Observable<number>;
		interval(dutTime: number, period: number, scheduler?: IScheduler): Observable<number>;
		timer(dueTime: number, period: number, scheduler: IScheduler): Observable<number>;
		timer(dueTime: number, scheduler: IScheduler): Observable<number>;
		generateWithRelativeTime<TState, TResult>(
			initialState: TState,
			condition: (state: TState) => boolean,
			iterate: (state: TState) => TState,
			resultSelector: (state: TState) => TResult,
			timeSelector: (state: TState) => number,
			scheduler?: IScheduler): Observable<TResult>;
	}
}

redpajama_set_name: RedPajamaGithub


text:
function LoginWindow(api){

	var self = Ti.UI.createWindow({
		title : "Login",
		backgroundColor : "white"
	});

	self.add(Ti.UI.createLabel({
		text:"Username",
		top:10,
		left:5,
        width: 'auto', height: 'auto'
	}));
	var username = Ti.UI.createTextField({
        borderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED,
		top:10,
		left:90,
		width:100,
		height:25

	});
	self.add(username);

	self.add(Ti.UI.createLabel({
		text:"Password",
		top:40,
		left:5,
        width: 'auto', height: 'auto'
	}));
	var password = Ti.UI.createTextField({
        borderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED,
		top:40,
		left:90,
		width:100,height:25
	});
	self.add(password);

	var loginButton = Ti.UI.createButton({
		top:70,
		right:20,
		title:"Login",
        width: 'auto', height: 'auto'
	});

	self.add(loginButton);

	loginButton.addEventListener("click",function(){
		Ti.API.info(api.url + " : " + username.text);
		api.login(nickname.value,password.value,self.onLogin);
	});

	return self;

}

module.exports = LoginWindow;


text:
Turbinia can read Evidence from either cloud Persistent Disks, or from other
Evidence types saved as GCS objects. Turbinia can also write output to GCS. Note
that you can operate multiple Turbinia instances within the same GCP Project as
long as you're careful to make sure your config options (Pub/Sub
topics/subscriptions, output paths, instance name, etc) don't overlap.

### Persistent Disks

Persistent disks are the default when processing disks that come from the Cloud.
The account you run Turbinia as must have access to the persistent disks that
you want to process, and those disks must also be in the same zone as the
Turbinia workers. If you process GoogleCloudDisk Evidence with Turbinia, the
worker node will attach the disk automatically before it runs its tasks. If you
already have access to a persistent disk in a separate project, Turbinia can
copy this into the project where Turbinia is being run.

### Processing non-cloud disks in GCP

If you have raw disk images from physical machines or elsewhere that you want to
process in the cloud, the best option is to create a new Cloud Persistent Disk,
and then copy the image into the filesystem of the new disk. Then you can use
the GoogleCloudDiskRawEmbedded Evidence type.

Another option is to
[convert the raw image to a cloud image](https://cloud.google.com/compute/docs/images/import-existing-image),
and then create a Persistent Disk from that and process it as the
GoogleCloudDisk Evidence type, but this is not generally recommended as it
requires zero-padding the disk to a GB boundary which can change the hash of the
disk, and isn't considered forensically sound.

One last option is to copy the image into GCS and process them directly from
there, but the GoogleCloudDiskRawEmbeded option is generally recommended because
this method requires setting up
[GCS FUSE](https://cloud.google.com/storage/docs/gcs-fuse), and this is less
stable than using Persistent Disks. If you do choose this option you will need
to configure all of your worker nodes to mounting your GCS bucket at a common
path. Once your GCS bucket is mounted, you can process these images as the
'rawdisk' Evidence type.

### Stackdriver Logging
Stackdriver Logging can be enabled within Turbinia, which would allow for all Turbinia logs to be centralized into the Stackdriver Logging console.

In order to enable this feature, please set the `STACKDRIVER_LOGGING` config variable to `True` within the `.turbiniarc` configuration file as illustrated below.
```
# Set this to True if you would like to enable Google Cloud Stackdriver Logging.
STACKDRIVER_LOGGING = True
```
### Stackdriver Error Reporting
Stackdriver Error Reporting can be enabled within Turbinia, which would allow for full Traceback logging and alerting within the GCP Error Reporting console. Please note that Error Reporting will only alert on failures of a `Task` running on a `Worker`.

In order to enable this feature, please set the `STACKDRIVER_TRACEBACK` config variable to `True` within the `.turbiniarc` configuration file as illustrated below.
```
# Set this to True if you would like to enable Google Cloud Error Reporting.
STACKDRIVER_TRACEBACK = True
```

### Prometheus instrumentation
The Turbinia worker and server expose metrics based on [Prometheus](https://prometheus.io/). The implementation exposes a port so monitoring systems can poll the server and worker to fetch running metrics. The configuration (listening port and address) are defined within the `.turbiniarc` configuration file as illustrated below.
```
# Prometheus listen address and port
PROMETHEUS_ADDR = '0.0.0.0'
PROMETHEUS_PORT = 8000
```
By default it will listen on all interfaces on port 8000.

## General Notes

*   Turbinia currently assumes that Evidence is equally available to all worker
    nodes (e.g. through locally mapped storage, or through attachable persistent
    Google Cloud Disks, etc).


text:
package com.amazonaws.services.dynamodbv2.datamodeling.unmarshallers;

import java.nio.ByteBuffer;

import com.amazonaws.services.dynamodbv2.model.AttributeValue;

/**
 * An unmarshaller that unmarshals Binary values as Java {@code byte[]}s.
 */
public class ByteArrayUnmarshaller extends BUnmarshaller {

    private static final ByteArrayUnmarshaller INSTANCE =
            new ByteArrayUnmarshaller();

    public static ByteArrayUnmarshaller instance() {
        return INSTANCE;
    }

    private ByteArrayUnmarshaller() {
    }

    @Override
    public Object unmarshall(AttributeValue value) {
        ByteBuffer buffer = value.getB();

        if (buffer.hasArray()) {
            return buffer.array();
        }

        byte[] array = new byte[buffer.remaining()];
        buffer.get(array);
        return array;
    }
}


text:
<?php
	//include 'framework/models/employee.php';
	$employees = (new Employee())->_all();

	if( isset($_GET['edit']))
		$current_employee = (new Employee())->_find($_GET['edit']);
	else
		$current_employee = (new Employee());
 ?>

Employés

<?php if (isset($_GET['error'])): ?>

			Vous devez remplir tous les champs

<?php endif ?>

		<?php
			if( isset($_GET['edit']) ) {
				$action = "/framework/controllers/employees/edit.php";
			} else {
				$action = "/framework/controllers/employees/ajout.php";
			}
		 ?>
		<form action="<?= $action ?>" method="post">
			Nom de l'employée
			<input type="text" name="name" value="<?= $current_employee->name ?>">
			Type d'employé
			<select name="type_id">
				<?php foreach ($current_employee->return_type_user() as $key => $value): ?>
					<?php $select = ($current_employee->type_id == $key ? 'SELECTED=SELECTED' : ''); ?>
					<option value="<?= $key ?>" <?= $select ?>><?= $value; ?></option>
				<?php endforeach ?>
			</select>

			<?php if ( isset($_GET['edit']) ): ?>

			Annuler
			<input type="hidden" name="employee" value="<?= $current_employee->id ?>">
			<input type="submit" value="Modifier" class="secondary radius right button" style="margin-right: 10px;">

			<?php else: ?>

			<input type="submit" value="Ajouter" class="secondary radius right button">

			<?php endif ?>
		</form>

					Employé
					Type
					Action

			<?php foreach($employees as $employee):?>

					<?= $employee->name ?>
					<?= $employee->type_user() ?>

						<a href="/?page=employes&edit=<?= $employee->id ?>" class="radius secondary label">Modifier<a href="#" class="radius alert label" data-action="delete" data-type="employees" data-id="<?= $employee->id ?>">Supprimer

			<?php endforeach; ?>


text:
<component name="libraryTable">
  <library name="Leiningen: org.clojure/data.priority-map:0.0.4">
    <CLASSES>
      <root url="jar://$MAVEN_REPOSITORY$/org/clojure/data.priority-map/0.0.4/data.priority-map-0.0.4.jar!/" />
    </CLASSES>
    <JAVADOC />
    <SOURCES />
  </library>
</component>


text:
=====================
procmgr User's Manual
=====================

Introduction
============

This describes the use and configuration of |procmgr|_.

procmgr is a *process manager*, similar to ``init(1)``. It allows managing
processes by invoking certain user-defined actions_.

The actual process management happens by a daemon running in the background;
to invoke actions, a client (embedded in the same executable) connects to
the daemon via a UNIX domain socket and sends a request to perform a certain
action.

Command-line usage
==================

**Usage**: ``procmgr [-h|-V] [-c conffile] [-l log] [-L level] [-P pidfile]
[-d [-f] [-A autostart]|-t|-s|-r|-a [-0]] [program action [args ...]]``

========================= ===================================================
``-h`` (``--help``)       This help.
``-V`` (``--version``)    Print version.
``-c`` (``--config``)     Configuration file location (defaults to the
                          environment variable ``PROCMGR_CONFFILE``, or to
                          the compile-time constant ``DEFAULT_CONFFILE``,
                          which defaults to ``/etc/procmgr.cfg``).
``-l`` (``--log``)        Syslog facility to log to, or the string
                          ``stderr``. Facility keywords override each other,
                          ``stderr`` is a set-only flag.
``-L`` (``--loglevel``)   Minimum severity of messages to log. ``level`` is
                          one of ``DEBUG``, ``INFO``, ``NOTE`` (the default),
                          ``WARN``, ``ERROR``, ``CRITICAL``, or ``FATAL``.
``-P`` (``--pidfile``)    Write a PID file to the given location.
``-d`` (``--daemon``)     Start daemon (as opposed to the default "client"
                          mode).
``-f`` (``--foreground``) Stay in foreground (daemon mode only).
``-A`` (``--autostart``)  Start the specified autostart group (``yes`` for
                          the default, ``no`` for none; daemon mode only).
``-t`` (``--test``)       Check whether the daemon is running.
``-s`` (``--stop``)       Signal the daemon (if any running) to stop.
``-r`` (``--reload``)     Signal the daemon (if any running) to reload its
                          configuration.
``-a`` (``--all``)        List the status of all programs (not invoking the
                          ``status`` action). Output is in a nice tabular
                          form. See `Extended status`_.
``-0`` (``--null``)       Use ``NUL`` characters as list delimiters.
========================= ===================================================

If none of ``-dtsra`` are supplied, ``program`` and ``action`` must be
present and contain the program and action to invoke; additional
command-line arguments may be passed to those.

If no ``-l`` option is specified, nothing is logged (except fatal messages,
which are always copied to (at least) stderr). Logging happens only in server
mode; in client mode, messages are written to stderr (and the settings are
ignored).

Extended status
---------------

Accessed by the ``-a`` command-line arguments, th ``extended status`` conveys
information about procmgr's view of its programs. Output consists of two
fields for each program, the program name and a space-separated list of
tokens about its status.

============= ===============================================================
``running``   The program is running.
``dead``      The program is not running.
``lingering`` The program has been removed from configuration, but remains in
              memory because either it is still running, or procmgr has bugs
              (see also ``?!``).
``?!``        An inconsistent state (*i.e.* a dead lingering program) which
              should never be seen was encountered. File a bug report.
============= ===============================================================

Configuration
=============

To load configuration data, a derivate of the ``.ini`` format is used; all
values described are optional, although leaving some (*i.e.*, ``cmd-start``;
see Actions_) out would be unwise. The order of declarations does not matter
(apart from global values, which must be specified before any section not to
be taken as part of that section).

::

    socket-path = <communication socket path>
    allow-uid = <default numerical UID to allow>
    allow-gid = <similar to allow-uid>
    default-suid = <default UID to switch to>
    default-sgid = <default GID to switch to>
    do-autostart = <autostart group to run>

    [prog-<name>]
    allow-uid = <default UID for all uid-* in this section>
    allow-gid = <default GID for gid-*>
    default-suid = <default UID for all suid-* in this section>
    default-sgid = <default GID for sgid-*>
    cmd-<action> = <shell command to run for the given action>
    uid-<action> = <UID to allow to perform this action>
    gid-<action> = <GID to allow to perform this action>
    suid-<action> = <UID to switch to when performing the action>
    sgid-<action> = <GID to switch to when performing the action>
    cwd = <directory to switch to before performing actions>
    restart-delay = <seconds after which approximately to restart>
    autostart = <yes, no, or integer autostart group>

For the UID and GID fields, and ``restart-delay``, the special value ``none``
(which is equal to -1) may be used, indicating that no UID/GID should be
allowed to perform an action or be changed to when performing it (thus
staying at the UID/GID the daemon itself had), or that the program should not
be automatically restarted (as it happens for every non-positive value of
restart-delay), respectively. ``cwd`` is only set at program level since an
individual command can change its directory itself. ``autostart`` tells
procmgr to automatically start a process (or not). The value ``no`` is
aliased to ``0``, which is a special autostart group that is not, in fact,
auto-started; ``yes`` is aliased to ``1``. Other autostart groups can be
specified as well, for example for an emergency or a maintenance profile.
The global ``do-autostart`` value specifies which autostart group to run (and
can be overridden using the corresponding command-line option); the
default is ``1``, so that programs with ``autostart=yes`` actually start
automatically.

Arbitrarily many program sections can be specified; out of same-named
ones, only the last is considered; similarly for all values. Spacing
between sections is purely decorational, although it increases legibility.
An example::

    socket-path = /var/local/procmgr-local
    # If GID 99 is, say, wheel, and members of that group should be
    # allowed to perform actions without elevating privileges.
    allow-gid = 99

    # Interaction with this would happen via "procmgr game-server ..."
    [prog-game-server]
    # If John Doe is UID 1000.
    allow-uid = 1000
    # Note the exec, to ensure procmgr sees the UID of the server itself
    # and not of the shell.
    cmd-start = exec /home/johndoe/bin/game.server
    # Change to the account of johndoe.
    suid-start = 1000
    sgid-start = 1000
    # Note the use of the $PID variable, which (following from above)
    # is the UID of the server.
    cmd-reload = kill -HUP $PID

Actions
=======

For each action, a (shell) *script* can be defined by using the
``cmd-<action>`` configuration value; for most actions, procmgr can perform
a *default action* if no script is supplied.

Scripts are run as children of the procmgr daemon [1]_; their standard I/O
streams are connected to those of the client that caused the action.

=========== =================================================================
``start``   **Start the program.** The script's PID is noted as the PID of
            the program — therefore, the script should preferably ``exec``
            the actual program to run —, and the client exits immediately
            with a success status.

            Since procmgr cannot really know how to start some arbitrary
            program, there is no default action, and trying to start a
            program without a script for this action will fail.

``restart`` **Restart the program.** Similarly to ``start``, the program's
            PID is updated to the PID of the script; the client does not wait
            for the script to exit (again). See also the ``stop`` action.

            The default action is to ``stop`` the program and to ``start`` it
            again.

``reload``  **Reload the program's configuration.** For programs that support
            that, this can cause the program to reload its configuration
            without downtime, if properly configured. The client waits for
            the script (if any) to exit, and exits with the script's exit
            status.

            The default action is to ``restart`` the program, under the
            assumption that it does not support on-line reloading.

``signal``  **Arbitrary user-defined action.** This does not have any
            semantical binding; the script may do whatever it wishes.

            The default action is not to do anything and to return a success
            status.

``stop``    **Stop the program.** The script can use the ``PID`` environment
            variable to check which process to signal. Instead of waiting for
            the script to finish, procmgr will wait for the *program* to exit
            and return its exit status.

            The default action is to send the currently-running process a
            ``SIGTERM`` signal.

``status``  **Check the program's status.** The script should print a short
            message and return an exit code depending on whether the program
            is running or not.

            The default is to print ``running`` (with a terminating newline)
            and to exit with a status code of zero if there is a process
            running as the program, or ``not running`` with an exit status of
            one if there is no process running.
=========== =================================================================

Action execution
----------------

Actions commands are run by ``ACTION_SHELL`` (as specified at compile time;
the upstream default is ``/bin/sh``), appended after a ``-c`` parameter;
additional positional arguments are passed after commands. The environment is
empty, save for the following variables:

============ ================================================================
``PATH``     The path to get executables from. All other ones must be fetched
             by absolute path. Equal to the ``ACTION_PATH`` compile-time
             constant.
``SHELL``    The shell used to run the command. Equal to the ``ACTION_SHELL``
             compile-time constant.
``PROGNAME`` The name of the current program.
``ACTION``   The name of the action being executed now.
``PID``      The PID of the process of the current program, or the empty
             string if none.
============ ================================================================

For an action to be allowed, either the UID or the GID specified in the
configuration must match the UID or GID sent by the client (the built-in
client sends the EUID and the EGID of its process; the real or saved UID/GID
could be sent by a modified client as well), respectively, or the client must
have an EUID of 0 (*i.e.*, be root).

**Note:** Since only the "primary" group of a process is sent (and *can*
be sent), it might be necessary to change the primary group of the client
process to make use of it; use the ``sg`` UNIX utility for that. For
example, if user ``johndoe`` was member of the ``wheel`` group, he could
use ``sg wheel procmgr ...`` to run ``procmgr ...`` as the ``wheel``
group.

.. [1] Each script is run in an own process group, if that matters.

   Also, this means that scripts cannot ``wait`` on the program since they
   are not its parents.

.. |procmgr| replace:: ``procmgr``
.. _procmgr: https://github.com/CylonicRaider/procmgr


text:
// Type definition specific to utility mode.
type UtilityEnergySource = 'coalccs' | 'ngccs' | EnergySource;
type ProfileSeries = 'supply' | 'demand' | 'unmet' | UtilityEnergySource;

// Object literal types keyed by a fixed set of values.
type UtilityEnergySourceMap<T> = {[K in UtilityEnergySource]: T};
type UtilityEnergySourceSubsetMap<T> = {[K in UtilityEnergySource]?: T};
type ProfileSeriesMap<T> = {[K in ProfileSeries]: T};

type UtilityOutcomeBreakdown = ScenarioOutcomeBreakdown<UtilityEnergySource>;

/**
 * A collection of energy supply and demand profiles with a common time domain.
 */
interface ProfileDataset {
  // Time domain index that maps 1:1 with each profile series.
  //
  // Each value should be an integer timestamp that is milliseconds since
  // 1 January, 1970 UTC (i.e., UNIX epoch, but in milliseconds).
  index: number[];

  // Common energy profile units for each series.
  //
  // Used for validating conversion of data during dimensional analysis; i.e.,
  // a string consumed by humans while auditing rather than for display;
  // e.g., 'MW'.
  units: string;

  // A set of energy profiles that map 1:1 with one another and the time index.
  //
  // i.e., for all i, series.foo[i] <=> series.bar[i] <=> index[i].
  series: ProfileSeriesMap<number[]>;
}

/**
 * Per-energy source allocation fractions.
 *
 * Values are in [0, 1] inclusive, with 0 indicating 0% allocation and
 * 1 indicating 100% allocation for the given energy source (e.g., 'nuclear').
 */
type ProfileAllocations = UtilityEnergySourceMap<number>;

/**
 * Utility mode data and configuration view.
 */
interface UtilityDataView extends SummaryDataView<UtilityEnergySource> {
  // The allocated time profile for each available energy source.
  profiles: ProfileDataset;

  // The per-energy source allocations.
  //
  // The utility view configuration state is determined by the allocations.
  allocations: ProfileAllocations;
}

/**
 * Components that render views of the utility data.
 */
interface UtilityDataComponent {
  /**
   * Updates the component to render data within the new data view.
   *
   * @param view The new data view to render.
   */
  update(view: UtilityDataView);
}


text:
template "/etc/init.d/newspring_vpn" do
  source "newspring_vpn.init.erb"
  mode 0777
  owner "root"
  group "root"
  action :create_if_missing
end

execute "apt-get update" do
  command "apt-get update"
end

package "openconnect" do
  action :install
end

ruby_block "Adding Private IP of AD Server to /etc/hosts" do
  block do
    file = Chef::Util::FileEdit.new("/etc/hosts")
    file.insert_line_if_no_match(
      "cen-dc001.ad.newspring.cc",
      "10.0.60.10 cen-dc001.ad.newspring.cc"
    )
    file.write_file
  end
end

package "monit" do
  action :install
end

template "/etc/monit/monitrc" do
  source "monit.erb"
  mode 0700
  owner "root"
  group "root"
end

template "/etc/monit/conf.d/newspring_vpn" do
  source "newspring_vpn.monit.erb"
  mode 0777
  owner "root"
  group "root"
  action :create_if_missing
end

execute "monit start" do
  command "monit start all"
  only_if do File.exists?("/var/run/monit.pid") end
  action :nothing
end

execute "monit load daemon" do
  command "/etc/init.d/monit restart"
  notifies :run, "execute[monit start]"
end


text:
<?php

namespace Application\Controller;

use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;

class IndexController extends AbstractActionController
{
    public function indexAction()
    {
        return new ViewModel();
    }

    public function exemploaAction()
    {
        $nome = "Zend Framework 2 (exemplo a)";
        $exemploService = $this->getServiceLocator()->get("Application\Service\ExemploService");
        //         print_r($exemploService);//die;
        return new ViewModel(array('nome'=>$nome));
    }

    public function exemplobAction()
    {
        // alternativa
        // $arr_view = array('nome' => "Zend Framework 2 (exemplo b)");
        $arr_view = array();
        $arr_view['nome'] = "Zend Framework 2 (exemplo b)";
        return new ViewModel($arr_view);
    }

    public function exemplocAction()
    {
        $obj_view = new ViewModel();
        $obj_view->nome = "Zend Framework 2 (exemplo c)";
        return $obj_view;
    }
}


text:
<!DOCTYPE html>

<title>TUPUNCO GitHub Pages</title>
<meta http-equiv="refresh" content="10">
<meta http-equiv="refresh" content="1;url=https://github.com/tupunco">

refresh to:	https://github.com/tupunco ...


text:
#include <algorithm>
#include <vector>
using namespace std;

/*
Time complexity: O(n) [where n is the length of damage]
Space complexity: O(1)
*/

class Solution
{
    public:
        long long minimumHealth(vector<int> & damage, int armor)
        {
            long long result=numeric_limits<long long>::max();

            int n=damage.size();

            long long totalDamage=accumulate(begin(damage), end(damage), static_cast<long long>(0));

            for(int i=0;i<n;i++)
            {
                int protectedFrom=min(damage[i], armor);

                long long healthNeeded=static_cast<long long>((totalDamage - protectedFrom) + 1);

                result=min(result, healthNeeded);
            }

            return result;
        }
};


text:
*tls* extra TLS configuration.

## Syntax

~~~ txt
tls [STUFF]
~~~

**STUFF** is things you'll need to configure TLS.

## Examples


text:
using System.Windows;

namespace Gold_Client.View
{
    public partial class PrivateMessageWindow : Window
    {
        public PrivateMessageWindow(string FriendName, string firstMessage = null)
        {
            InitializeComponent();
            if (DataContext != null)
            {
                ((dynamic)DataContext).FriendName = FriendName;
                if (firstMessage != null)
                    ((dynamic)DataContext).ShowFirstMessageWhenWindowShow(firstMessage);
            }
        }
    }
}


text:
require 'dragonfly/job/step'

module Dragonfly
  class Job
    class Process < Step
      def init
        processor.update_url(job.url_attributes, *arguments) if processor.respond_to?(:update_url)
      end

      def name
        args.first.to_sym
      end

      def arguments
        args[1..-1]
      end

      def processor
        @processor ||= app.get_processor(name)
      end

      def apply
        processor.call(job.content, *arguments)
      end
    end
  end
end


text:
module Azure::Network::Mgmt::V2020_04_01
  module Models
    #
    # Load balancer backend addresses.
    #
    class LoadBalancerBackendAddress

      include MsRestAzure

      # @return [SubResource] Reference to an existing virtual network.
      attr_accessor :virtual_network

      # @return [String] IP Address belonging to the referenced virtual
      # network.
      attr_accessor :ip_address

      # @return [SubResource] Reference to IP address defined in network
      # interfaces.
      attr_accessor :network_interface_ipconfiguration

      # @return [String] Name of the backend address.
      attr_accessor :name

      #
      # Mapper for LoadBalancerBackendAddress class as Ruby Hash.
      # This will be used for serialization/deserialization.
      #
      def self.mapper()
        {
          client_side_validation: true,
          required: false,
          serialized_name: 'LoadBalancerBackendAddress',
          type: {
            name: 'Composite',
            class_name: 'LoadBalancerBackendAddress',
            model_properties: {
              virtual_network: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.virtualNetwork',
                type: {
                  name: 'Composite',
                  class_name: 'SubResource'
                }
              },
              ip_address: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.ipAddress',
                type: {
                  name: 'String'
                }
              },
              network_interface_ipconfiguration: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'properties.networkInterfaceIPConfiguration',
                type: {
                  name: 'Composite',
                  class_name: 'SubResource'
                }
              },
              name: {
                client_side_validation: true,
                required: false,
                serialized_name: 'name',
                type: {
                  name: 'String'
                }
              }
            }
          }
        }
      end
    end
  end
end


text:
""" Test scripts

If we appear to be running from the development directory, use the scripts in
the top-level folder ``scripts``.  Otherwise try and get the scripts from the
path
"""
from __future__ import with_statement

import sys
import os
from os.path import dirname, join as pjoin, isfile, isdir, abspath, realpath

from subprocess import Popen, PIPE

import numpy as np

from nibabel.tmpdirs import InTemporaryDirectory

from nipy import load_image, save_image
from nipy.core.api import rollimg

from nose.tools import assert_true, assert_false, assert_equal

from ..testing import funcfile
from numpy.testing import decorators, assert_almost_equal

from nipy.testing.decorators import make_label_dec

from nibabel.optpkg import optional_package

matplotlib, HAVE_MPL, _ = optional_package('matplotlib')
needs_mpl = decorators.skipif(not HAVE_MPL, "Test needs matplotlib")
script_test = make_label_dec('script_test')

# Need shell to get path to correct executables
USE_SHELL = True

DEBUG_PRINT = os.environ.get('NIPY_DEBUG_PRINT', False)

def local_script_dir():
    # Check for presence of scripts in development directory.  ``realpath``
    # checks for the situation where the development directory has been linked
    # into the path.
    below_nipy_dir = realpath(pjoin(dirname(__file__), '..', '..'))
    devel_script_dir = pjoin(below_nipy_dir, 'scripts')
    if isfile(pjoin(below_nipy_dir, 'setup.py')) and isdir(devel_script_dir):
        return devel_script_dir
    return None

LOCAL_SCRIPT_DIR = local_script_dir()

def run_command(cmd):
    if not LOCAL_SCRIPT_DIR is None:
        # Windows can't run script files without extensions natively so we need
        # to run local scripts (no extensions) via the Python interpreter.  On
        # Unix, we might have the wrong incantation for the Python interpreter
        # in the hash bang first line in the source file.  So, either way, run
        # the script through the Python interpreter
        cmd = "%s %s" % (sys.executable, pjoin(LOCAL_SCRIPT_DIR, cmd))
    if DEBUG_PRINT:
        print("Running command '%s'" % cmd)
    proc = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=USE_SHELL)
    stdout, stderr = proc.communicate()
    if proc.poll() == None:
        proc.terminate()
    if proc.returncode != 0:
        raise RuntimeError('Command "%s" failed with stdout\n%s\nstderr\n%s\n'
                           % (cmd, stdout, stderr))
    return proc.returncode

@needs_mpl
@script_test
def test_nipy_diagnose():
    # Test nipy diagnose script
    fimg = load_image(funcfile)
    ncomps = 12
    with InTemporaryDirectory() as tmpdir:
        # Need to quote out path in case it has spaces
        cmd = 'nipy_diagnose "%s" --ncomponents=%d --out-path="%s"' % (
            funcfile, ncomps, tmpdir)
        run_command(cmd)
        for out_fname in ('components_functional.png',
                          'pcnt_var_functional.png',
                          'tsdiff_functional.png',
                          'vectors_components_functional.npz'):
            assert_true(isfile(out_fname))
        for out_img in ('max_functional.nii.gz',
                        'mean_functional.nii.gz',
                        'min_functional.nii.gz',
                        'std_functional.nii.gz'):
            img = load_image(out_img)
            assert_equal(img.shape, fimg.shape[:-1])
            del img
        pca_img = load_image('pca_functional.nii.gz')
        assert_equal(pca_img.shape, fimg.shape[:-1] + (ncomps,))
        vecs_comps = np.load('vectors_components_functional.npz')
        vec_diff = vecs_comps['slice_mean_diff2'].copy()# just in case
        assert_equal(vec_diff.shape, (fimg.shape[-1]-1, fimg.shape[2]))
        del pca_img, vecs_comps
    with InTemporaryDirectory() as tmpdir:
        # Check we can pass in slice and time flags
        s0_img = rollimg(fimg, 'k')
        save_image(s0_img, 'slice0.nii')
        cmd = ('nipy_diagnose slice0.nii --ncomponents=%d --out-path="%s" '
               '--time-axis=t --slice-axis=0' % (ncomps, tmpdir))
        run_command(cmd)
        pca_img = load_image('pca_slice0.nii')
        assert_equal(pca_img.shape, s0_img.shape[:-1] + (ncomps,))
        vecs_comps = np.load('vectors_components_slice0.npz')
        assert_almost_equal(vecs_comps['slice_mean_diff2'], vec_diff)
        del pca_img, vecs_comps

@needs_mpl
@script_test
def test_nipy_tsdiffana():
    # Test nipy_tsdiffana script
    out_png = 'ts_out.png'
    with InTemporaryDirectory():
        # Quotes in case of space in arguments
        cmd = 'nipy_tsdiffana "%s" --out-file="%s"' % (funcfile, out_png)
        run_command(cmd)
        assert_true(isfile(out_png))

@script_test
def test_nipy_3_4d():
    # Test nipy_3dto4d and nipy_4dto3d
    fimg = load_image(funcfile)
    N = fimg.shape[-1]
    out_4d = 'func4d.nii'
    with InTemporaryDirectory() as tmpdir:
        # Quotes in case of space in arguments
        cmd = 'nipy_4dto3d "%s" --out-path="%s"' % (funcfile, tmpdir)
        run_command(cmd)
        imgs_3d = ['functional_%04d.nii' % i for i in range(N)]
        for iname in imgs_3d:
            assert_true(isfile(iname))
        cmd = 'nipy_3dto4d "%s" --out-4d="%s"' % ('" "'.join(imgs_3d), out_4d)
        run_command(cmd)
        fimg_back = load_image(out_4d)
        assert_almost_equal(fimg.get_data(), fimg_back.get_data())
        del fimg_back


text:
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.plugins.groovy.lang.psi.controlFlow;

import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.search.PsiShortNamesCache;
import com.intellij.util.ArrayUtil;
import com.intellij.util.ArrayUtilRt;
import com.intellij.util.containers.ObjectIntHashMap;
import gnu.trove.TObjectIntHashMap;
import org.jetbrains.plugins.groovy.lang.psi.GroovyFile;
import org.jetbrains.plugins.groovy.lang.psi.GroovyFileBase;
import org.jetbrains.plugins.groovy.lang.psi.api.GrBlockLambdaBody;
import org.jetbrains.plugins.groovy.lang.psi.api.GrInExpression;
import org.jetbrains.plugins.groovy.lang.psi.api.formatter.GrControlStatement;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.*;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.blocks.GrClosableBlock;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.blocks.GrCodeBlock;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.blocks.GrOpenBlock;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.branch.GrBreakStatement;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.clauses.GrCaseSection;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.*;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod;
import org.jetbrains.plugins.groovy.lang.psi.api.toplevel.imports.GrImportStatement;
import org.jetbrains.plugins.groovy.lang.psi.dataFlow.DFAEngine;
import org.jetbrains.plugins.groovy.lang.psi.dataFlow.readWrite.ReadBeforeWriteInstance;
import org.jetbrains.plugins.groovy.lang.psi.dataFlow.readWrite.ReadBeforeWriteSemilattice;
import org.jetbrains.plugins.groovy.lang.psi.dataFlow.readWrite.ReadBeforeWriteState;

import java.util.ArrayList;
import java.util.BitSet;
import java.util.List;

/**
 * @author ven
 */
public class ControlFlowBuilderUtil {
  private ControlFlowBuilderUtil() {
  }

  public static ReadWriteVariableInstruction[] getReadsWithoutPriorWrites(Instruction[] flow, boolean onlyFirstRead) {
    DFAEngine<ReadBeforeWriteState> engine = new DFAEngine<>(
      flow,
      new ReadBeforeWriteInstance(buildVariablesIndex(flow), onlyFirstRead),
      ReadBeforeWriteSemilattice.INSTANCE
    );
    List<ReadBeforeWriteState> dfaResult = engine.performDFAWithTimeout();
    if (dfaResult == null) {
      return ReadWriteVariableInstruction.EMPTY_ARRAY;
    }
    List<ReadWriteVariableInstruction> result = new ArrayList<>();
    BitSet reads = dfaResult.get(dfaResult.size() - 1).getReads();
    for (int i = reads.nextSetBit(0); i >= 0; i = reads.nextSetBit(i + 1)) {
      if (i == Integer.MAX_VALUE) break;
      result.add((ReadWriteVariableInstruction)flow[i]);
    }
    return result.toArray(ReadWriteVariableInstruction.EMPTY_ARRAY);
  }

  private static TObjectIntHashMap<VariableDescriptor> buildVariablesIndex(Instruction[] flow) {
    TObjectIntHashMap<VariableDescriptor> variablesIndex = new ObjectIntHashMap<>();
    int idx = 0;
    for (Instruction instruction : flow) {
      if (instruction instanceof ReadWriteVariableInstruction) {
        VariableDescriptor descriptor = ((ReadWriteVariableInstruction)instruction).getDescriptor();
        if (!variablesIndex.contains(descriptor)) {
          variablesIndex.put(descriptor, idx++);
        }
      }
    }
    return variablesIndex;
  }

  public static boolean isInstanceOfBinary(GrBinaryExpression binary) {
    if (binary instanceof GrInExpression) {
      GrExpression left = binary.getLeftOperand();
      GrExpression right = binary.getRightOperand();
      if (left instanceof GrReferenceExpression && ((GrReferenceExpression)left).getQualifier() == null &&
          right instanceof GrReferenceExpression && findClassByText((GrReferenceExpression)right)) {
        return true;
      }
    }
    return false;
  }

  private static boolean findClassByText(GrReferenceExpression ref) {
    final String text = ref.getText();
    final int i = text.indexOf('<');
    String className = i == -1 ? text : text.substring(0, i);

    PsiClass[] names = PsiShortNamesCache.getInstance(ref.getProject()).getClassesByName(className, ref.getResolveScope());
    if (names.length > 0) return true;

    PsiFile file = ref.getContainingFile();
    if (file instanceof GroovyFile) {
      GrImportStatement[] imports = ((GroovyFile)file).getImportStatements();
      for (GrImportStatement anImport : imports) {
        if (className.equals(anImport.getImportedName())) return true;
      }
    }

    return false;
  }

  /**
   * check whether statement is return (the statement which provides return value) statement of method or closure.
   *
   * @param st
   * @return
   */
  public static boolean isCertainlyReturnStatement(GrStatement st) {
    final PsiElement parent = st.getParent();
    if (parent instanceof GrOpenBlock) {
      if (st != ArrayUtil.getLastElement(((GrOpenBlock)parent).getStatements())) return false;

      PsiElement pparent = parent.getParent();
      if (pparent instanceof GrMethod) {
        return true;
      }

      if (pparent instanceof GrBlockStatement || pparent instanceof GrCatchClause || pparent instanceof GrLabeledStatement) {
        pparent = pparent.getParent();
      }
      if (pparent instanceof GrControlStatement || pparent instanceof GrTryCatchStatement) {
        return isCertainlyReturnStatement((GrStatement)pparent);
      }
    }

    else if (parent instanceof GrClosableBlock || parent instanceof GrBlockLambdaBody) {
      return st == ArrayUtil.getLastElement(((GrCodeBlock)parent).getStatements());
    }

    else if (parent instanceof GroovyFileBase) {
      return st == ArrayUtil.getLastElement(((GroovyFileBase)parent).getStatements());
    }

    else if (parent instanceof GrForStatement ||
             parent instanceof GrIfStatement && st != ((GrIfStatement)parent).getCondition() ||
             parent instanceof GrSynchronizedStatement && st != ((GrSynchronizedStatement)parent).getMonitor() ||
             parent instanceof GrWhileStatement && st != ((GrWhileStatement)parent).getCondition() ||
             parent instanceof GrConditionalExpression && st != ((GrConditionalExpression)parent).getCondition() ||
             parent instanceof GrElvisExpression) {
      return isCertainlyReturnStatement((GrStatement)parent);
    }

    else if (parent instanceof GrCaseSection) {
      final GrStatement[] statements = ((GrCaseSection)parent).getStatements();
      final GrStatement last = ArrayUtil.getLastElement(statements);
      final GrSwitchStatement switchStatement = (GrSwitchStatement)parent.getParent();

      if (last instanceof GrBreakStatement && statements.length > 1 && statements[statements.length - 2] == st) {
        return isCertainlyReturnStatement(switchStatement);
      }
      else if (st == last) {
        if (st instanceof GrBreakStatement || isLastStatementInCaseSection((GrCaseSection)parent, switchStatement)) {
          return isCertainlyReturnStatement(switchStatement);
        }
      }
    }
    return false;
  }

  private static boolean isLastStatementInCaseSection(GrCaseSection caseSection, GrSwitchStatement switchStatement) {
    final GrCaseSection[] sections = switchStatement.getCaseSections();
    final int i = ArrayUtilRt.find(sections, caseSection);
    if (i == sections.length - 1) {
      return true;
    }

    for (int j = i + 1; j < sections.length; j++) {
      GrCaseSection section = sections[j];
      for (GrStatement statement : section.getStatements()) {
        if (!(statement instanceof GrBreakStatement)) {
          return false;
        }
      }
    }
    return true;
  }
}


text:
The pure Mesos Go binding that started in this project has been contributed and ported to http://github.com/mesos/mesos-go.  There will be no futher development in this repository.

# Gomes
Gomes is a (100%) pure Go framework API for the [Apache Mesos](http://mesos.apache.org/) cluster manager.  Gomes uses the HTTP wire protocol to send message and receive events to and from a running Mesos master.  This project provides an  idiomatic Go API that makes it super easy to create Mesos frameworks using Go.

#### Gomes Example
See a simple Gomes test - https://github.com/vladimirvivien/gomes/blob/master/gomestest/gomestest.go

### What's Working
Gomes is at its (very early) infancy.  However, here is what the API can already do today:

* Register with running Master
* Receive Framework-Reisgered event
* Receive Framework-Reregistered event
* Receive Resource Offers event
* Receive Offer Rescinded event
* Receive Status Update
* ... and  more features to come out soon!

### Future Plans

* Gomes still needs tons of work to be done.
* There many pieces missing to get it stable and ready for usage.
* The goal is to get it on par to its C++ counterpart, libprocess.

### Background
Munch of the inspiration for this work came from:

* Ben Hindman Presentation at ApacheCon 2014 - https://www.youtube.com/watch?v=hTcZGODnyf0&list=FLrFKzp-3UzcAXfZy6DbkbHg
* And changes made to 0.19 version of Mesos.
* Email exchange and guidance from other Mesos members.


text:
module Infer where

import qualified Source as S
import qualified Target as T
import Target (RegVar(..), frv)

import Control.Monad.State
import Control.Monad.Except

data InferState = InferState {
    _regVarCount :: Int
}

initInferState :: InferState
initInferState = InferState 0

type Infer = ExceptT String (State InferState)

runInfer :: S.Expr -> Either String T.Expr
runInfer e = evalState (runExceptT (infer' e)) initInferState

infer' :: S.Expr -> Infer T.Expr
infer' sexpr = do
    texpr <- infer sexpr
    let regvars = frv texpr
    return (foldr T.ENew texpr regvars)

infer :: S.Expr -> Infer T.Expr
infer (S.EInt i) = T.EInt i <$> freshRegVar
infer (S.EVar x) = return $ T.EVar x
infer (S.EApp e1 e2) = T.EApp <$> infer e1 <*> infer e2
infer (S.EAbs x e) = T.EAbs x <$> infer e <*> freshRegVar

freshRegVar :: Infer RegVar
freshRegVar = do
    s <- get
    let i = _regVarCount s
    put s { _regVarCount = i + 1 }
    return $ RegVar ("ρ" ++ show i)


text:
#include <aws/route53/model/ListQueryLoggingConfigsResult.h>
#include <aws/core/utils/xml/XmlSerializer.h>
#include <aws/core/AmazonWebServiceResult.h>
#include <aws/core/utils/StringUtils.h>

#include <utility>

using namespace Aws::Route53::Model;
using namespace Aws::Utils::Xml;
using namespace Aws::Utils;
using namespace Aws;

ListQueryLoggingConfigsResult::ListQueryLoggingConfigsResult()
{
}

ListQueryLoggingConfigsResult::ListQueryLoggingConfigsResult(const Aws::AmazonWebServiceResult<XmlDocument>& result)
{
  *this = result;
}

ListQueryLoggingConfigsResult& ListQueryLoggingConfigsResult::operator =(const Aws::AmazonWebServiceResult<XmlDocument>& result)
{
  const XmlDocument& xmlDocument = result.GetPayload();
  XmlNode resultNode = xmlDocument.GetRootElement();

  if(!resultNode.IsNull())
  {
    XmlNode queryLoggingConfigsNode = resultNode.FirstChild("QueryLoggingConfigs");
    if(!queryLoggingConfigsNode.IsNull())
    {
      XmlNode queryLoggingConfigsMember = queryLoggingConfigsNode.FirstChild("QueryLoggingConfig");
      while(!queryLoggingConfigsMember.IsNull())
      {
        m_queryLoggingConfigs.push_back(queryLoggingConfigsMember);
        queryLoggingConfigsMember = queryLoggingConfigsMember.NextNode("QueryLoggingConfig");
      }

    }
    XmlNode nextTokenNode = resultNode.FirstChild("NextToken");
    if(!nextTokenNode.IsNull())
    {
      m_nextToken = Aws::Utils::Xml::DecodeEscapedXmlText(nextTokenNode.GetText());
    }
  }

  return *this;
}


text:
import pygame
from pygame.locals import *

class fish(pygame.sprite.Sprite):
	def __init__(self,image):
		pygame.sprite.Sprite.__init__(self)
		self.image = image
		self.move = 9
		self.rect = self.image.get_rect()
	def update(self):
		if self.rect.left > 300 or self.rect.left < 0:
			self.move = -self.move
		self.rect.move_ip(self.move,0)

class hand(pygame.sprite.Sprite):
	def __init__(self,image):
		pygame.sprite.Sprite.__init__(self)
		self.image = image
		self.rect = image.get_rect()
	def update(self):
		self.rect.midtop = pygame.mouse.get_pos()

def main():
	pygame.init()
	screen = pygame.display.set_mode((300 ,100))
	back_ground = pygame.Surface(screen.get_size()).convert()
	back_ground.fill((255,255,255))
	img = pygame.image.load('chimp.bmp').convert()
	print img.get_at((0,0))
	img.set_colorkey(img.get_at((0,0)),RLEACCEL)
	f = fish(img)
	img2 = pygame.image.load('fist.bmp').convert()
	img2.set_colorkey(img2.get_at((0,0)),RLEACCEL)
	h = hand(img2)
	pygame.mouse.set_visible(False)
	allsprites = pygame.sprite.RenderPlain((f,h))
	clock = pygame.time.Clock()
	while True:
		clock.tick(20)
		for event in pygame.event.get():
			if event.type == pygame.QUIT:
				pygame.quit()
		screen.blit(back_ground,screen.get_rect())
		allsprites.update()
		allsprites.draw(screen)
		pygame.display.flip()

if __name__ == "__main__":
	main()


text:
ansible-playbooks
=================

My ansible playbooks for study


text: Rails.application.config.session_store :cookie_store, key: '_Soap-Stone_session'


text:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Telerik.Data.Core;

namespace Telerik.UI.Xaml.Controls.Grid
{
    /// <summary>
    /// Base class used to sort items based on the item's <see cref="DescriptionBase.PropertyName"/> value.
    /// </summary>
    internal abstract class SortDescription : DescriptionBase
    {
        private SortOrder sortOrder;

        /// <summary>
        /// Gets or sets the custom name that will be used as display name.
        /// </summary>
        public SortOrder SortOrder
        {
            get
            {
                return this.sortOrder;
            }

            set
            {
                if (this.sortOrder != value)
                {
                    this.sortOrder = value;
                    this.OnPropertyChanged("SortOrder");
                    this.NotifyChange(new SettingsChangedEventArgs());
                }
            }
        }

        /// <summary>
        /// Returns the value that will be passed in the aggregate for given item.
        /// </summary>
        /// <param name="item">The item which value will be extracted.</param>
        /// <returns>Returns the value for given item.</returns>
        protected internal virtual object GetValueForItem(object item)
        {
            if (this.MemberAccess == null)
            {
                throw new System.InvalidOperationException("Member access has not been initialized");
            }

            return this.MemberAccess.GetValue(item);
        }

        /// <inheritdoc />
        protected sealed override void CloneCore(Cloneable source)
        {
            base.CloneCore(source);
            SortDescription original = source as SortDescription;
            if (original != null)
            {
                this.SortOrder = original.SortOrder;
            }
            this.CloneOverride(source);
        }

        /// <summary>
        /// Makes the instance a clone (deep copy) of the specified <see cref="Telerik.Data.Core.Cloneable"/>.
        /// </summary>
        /// <param name="source">The object to clone.</param>
        /// <remarks>Notes to Inheritors
        /// If you derive from <see cref="Telerik.Data.Core.Cloneable"/>, you need to override this method to copy all properties.
        /// It is essential that all implementations call the base implementation of this method (if you don't call base you should manually copy all needed properties including base properties).
        /// </remarks>
        protected abstract void CloneOverride(Cloneable source);
    }
}


text:
<?php

class GroupsController extends \BaseController {

	/**
	 * Display a listing of the resource.
	 * GET /groups
	 *
	 * @return Response
	 */
	public function index()
	{
		//
	}

	/**
	 * Show the form for creating a new resource.
	 * GET /groups/create
	 *
	 * @return Response
	 */
	public function create()
	{
		//
	}

	/**
	 * Store a newly created resource in storage.
	 * POST /groups
	 *
	 * @return Response
	 */
	public function store()
	{
		//
	}

	/**
	 * Display the specified resource.
	 * GET /groups/{id}
	 *
	 * @param  int  $id
	 * @return Response
	 */
	public function show($id)
	{
		//
	}

	/**
	 * Show the form for editing the specified resource.
	 * GET /groups/{id}/edit
	 *
	 * @param  int  $id
	 * @return Response
	 */
	public function edit($id)
	{
		//
	}

	/**
	 * Update the specified resource in storage.
	 * PUT /groups/{id}
	 *
	 * @param  int  $id
	 * @return Response
	 */
	public function update($id)
	{
		//
	}

	/**
	 * Remove the specified resource from storage.
	 * DELETE /groups/{id}
	 *
	 * @param  int  $id
	 * @return Response
	 */
	public function destroy($id)
	{
		//
	}

}


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Gard. dict. ed. 8: no. 22. 1768

#### Original name
null

### Remarks
null


text:
<?php

declare(strict_types=1);

namespace Difra;

use Difra\View\HTML\Element\HTML;
use Difra\View\HttpError;

/**
 * Class View
 * @package Difra
 */
class View
{
    /** @var bool Page rendered status */
    public static bool $rendered = false;
    /** @var string XSLT Resourcer instance */
    public static string $instance = 'main';
    // options
    /** @var string|null Template instance */
    private ?string $templateInstance;
    /** @var bool Echo output (return otherwise) */
    private bool $echo = false;
    /** @var int Fill XML with various data */
    private int $fillXML = self::FILL_XML_NONE;
    /** @var bool Normalize output HTML */
    private bool $normalize = true;
    /** @var \XSLTProcessor|null */
    private ?\XSLTProcessor $xslProcessor = null;
    /** @var ?HTML HTML */
    private ?HTML $html = null;

    public const FILL_XML_NONE = 0;
    public const FILL_XML_LOCALE = 1;
    public const FILL_XML_MENU = 1 << 1;
    public const FILL_XML_OTHER = 1 << 2;
    public const FILL_XML_ALL = self::FILL_XML_LOCALE | self::FILL_XML_MENU | self::FILL_XML_OTHER;
    public const FILL_XML_PAGE = self::FILL_XML_ALL;

    /**
     * View constructor
     */
    public function __construct()
    {
        $this->templateInstance = self::$instance ?: 'main';
    }

    /**
     * Set template instance
     * @param string $templateInstance
     * @return View
     */
    public function setTemplateInstance(string $templateInstance): static
    {
        if ($this->templateInstance !== $templateInstance) {
            $this->templateInstance = $templateInstance;
            $this->xslProcessor = null;
        }
        return $this;
    }

    /**
     * Set echo flag
     * @param bool $echo
     * @return View
     */
    public function setEcho(bool $echo): static
    {
        if ($this->echo !== $echo) {
            $this->echo = $echo;
            $this->xslProcessor = null;
        }
        return $this;
    }

    /**
     * Set fill XML flag
     * @param int|bool $fillXML
     * @return View
     */
    public function setFillXML(int|bool $fillXML): static
    {
        // backwards compatibility
        if ($fillXML === true) {
            $fillXML = self::FILL_XML_ALL;
        } elseif ($fillXML === false) {
            $fillXML = self::FILL_XML_NONE;
        }

        if ($this->fillXML !== $fillXML) {
            $this->fillXML = $fillXML;
            $this->xslProcessor = null;
        }
        return $this;
    }

    /**
     * Set normalize flag
     * @param bool $normalize
     * @return View
     */
    public function setNormalize(bool $normalize): static
    {
        if ($this->normalize !== $normalize) {
            $this->normalize = $normalize;
            $this->xslProcessor = null;
        }
        return $this;
    }

    /**
     * Render
     * @param \DOMDocument|\DOMElement $xml
     * @return bool|string
     * @throws \Difra\Exception
     */
    public function process(\DOMDocument|\DOMElement $xml): bool|string
    {
        Debugger::addLine("Render start (instance '$this->templateInstance')");

        if (is_null($this->xslProcessor)) {
            if (!$resource = Resourcer::getInstance('xslt')->compile($this->templateInstance)) {
                throw new Exception('XSLT resource not found');
            }

            $time = microtime(true);
            $xslDom = new \DomDocument();
            $xslDom->resolveExternals = true;
            $xslDom->substituteEntities = true;
            if (!$xslDom->loadXML($resource)) {
                throw new Exception("XSLT load problem for instance '$this->templateInstance'");
            }
            Debugger::addLine('XSLT XML loaded in ' . round(1000 * (microtime(true) - $time), 2) . 'ms');

            $time = microtime(true);
            $this->xslProcessor = new \XSLTProcessor();
            $this->xslProcessor->importStylesheet($xslDom);
            Debugger::addLine('XSLTProcessor initialized in ' . round(1000 * (microtime(true) - $time), 2) . 'ms');
        }

        $this->html?->getXML($xml->documentElement);

        if (!HttpError::$error and !Debugger::$shutdown) {
            View\XML::fillXML($xml, $this->templateInstance, $this->fillXML);
        }

        // transform template
        if ($html = $this->xslProcessor->transformToDoc($xml)) {
            if ($this->normalize) {
                $html = self::normalize($html);
            } else {
                $html->formatOutput = true;
                $html = $html->saveXML();
            }

            if (!$this->echo) {
                return $html;
            }

            echo $html;
            self::$rendered = true;
            if (Debugger::isEnabled()) {
                echo '<!-- Page rendered in ' . Debugger::getTimer() . ' seconds -->';
            }
            if (function_exists('fastcgi_finish_request')) {
                fastcgi_finish_request();
            }
        } else {
            $errorMessage = libxml_get_errors(); //error_get_last();
            throw new Exception($errorMessage ? $errorMessage['message'] : "Can't render templates");
        }
        return true;
    }

    /**
     * @param \DOMDocument $xml
     * @param bool|string $specificInstance
     * @param bool $dontEcho
     * @param bool $dontFillXML
     * @param bool $normalize
     * @return bool|string
     * @throws Exception
     * @deprecated
     */
    public static function render(
        \DOMDocument $xml,
        bool|string $specificInstance = false,
        bool $dontEcho = false,
        bool $dontFillXML = false,
        bool $normalize = true
    ): bool|string {
        $view = new self();
        $view->setTemplateInstance($specificInstance);
        $view->setEcho(!$dontEcho);
        $view->setFillXML(!$dontFillXML);
        $view->setNormalize($normalize);
        return $view->process($xml);
    }

    /**
     * Convert XHTML to HTML5
     * @param \DOMDocument $htmlDoc
     * @return string
     */
    public static function normalize(\DOMDocument $htmlDoc): string
    {
        $normalizerXml = View\Normalizer::getXML();
        $normalizerDoc = new \DOMDocument();
        $normalizerDoc->loadXML($normalizerXml);
        $normalizerProc = new \XSLTProcessor();
        $normalizerProc->importStylesheet($normalizerDoc);
        return $normalizerProc->transformToXml($htmlDoc);
    }

    /**
     * HTTP redirect
     * @param string $url
     * @param ?bool $permanent
     */
    public static function redirect(string $url, ?bool $permanent = null): void
    {
        self::$rendered = true;
        if ($permanent) {
            http_response_code(301);
        }
        header('Location: ' . $url);
        die();
    }

    /**
     * Add Expires and X-Accel-Expires headers
     * @param $ttl
     */
    public static function addExpires($ttl)
    {
        header('Expires: ' . gmdate('D, d M Y H:i:s', $ttl ? (time() + $ttl) : 0) . ' GMT');
        if (isset($_SERVER['SERVER_SOFTWARE']) and str_starts_with($_SERVER['SERVER_SOFTWARE'], 'nginx')) {
            header('X-Accel-Expires: ' . ($ttl ?: 'off'));
        }
    }

    /**
     * @param string $instance
     * @param string $rootNodeName
     * @return bool|string
     * @throws \Difra\Exception
     * @deprecated
     */
    public static function simpleTemplate(string $instance, string $rootNodeName): bool|string
    {
        $xml = new \DOMDocument();
        $xml->appendChild($xml->createElement($rootNodeName));
        $view = new static();
        $view->setTemplateInstance($instance);
        return $view->process($xml);
    }

    /**
     * @param \DOMElement $node
     * @param string $template
     * @return bool|string
     * @throws \Difra\Exception
     */
    public static function simpleRender(\DOMElement $node, string $template = 'modals'): bool|string
    {
        $view = new static();
        $view->setFillXML(false);
        $view->setEcho(false);
        $view->setTemplateInstance($template);
        $view->setNormalize(false);
        return $view->process($node);
    }

    /**
     * @param \Difra\View\HTML\Element\HTML|null $html
     */
    public function setHTML(?HTML $html): void
    {
        $this->html =& $html;
    }
}


text:
typedef short sa_family_t;

struct iovec {
  void *iov_base;
  unsigned int iov_len;
};

unsigned int writev(int fd, struct iovec *, unsigned int);
#endif
int socketclose(int fd);


text:
[<%= display_name %>](<%= homepage %>)
===

## 🎉 Release highlights (v<%= version %>)

<%= changelog %>

## ⚙ Installation and Configuration

See [the project's wiki](https://github.com/streamlink/streamlink-twitch-gui/wiki) for detailed installation and configuration guides.

<% if ( donation && donation.length ) { %>
## ❤ Support

If you think that Streamlink Twitch GUI is useful and if you want to keep the project alive, then please consider supporting its creator/maintainer by sending a small and optionally recurring tip via the available options listed below.
Your support is very much appreciated, thank you!

<% JSON.parse( donation ).forEach(function( item ) { %>* [<%= item.text %>](<%= item.url %>)<% if ( item.coinaddress ) { %> (`<%= item.coinaddress %>`)<% } %>
<% }) %>
<% } %>


text:
<?php

namespace app\models;

use Yii;

use app\models\general\GeneralLabel;
use app\models\general\GeneralMessage;

/**
 * This is the model class for table "tbl_penilaian_penganjur_kursus".
 *
 * @property integer $penilaian_peserta_terhadap_kursus_id
 * @property integer $pengurusan_permohonan_kursus_persatuan_id
 * @property string $tarikh_kursus
 * @property string $nama_penganjur_kursus
 * @property string $kod_kursus
 * @property string $tempat_kursus
 * @property string $nama_penyelaras
 * @property integer $created_by
 * @property integer $updated_by
 * @property string $created
 * @property string $updated
 */
class PenilaianPesertaTerhadapKursus extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'tbl_penilaian_peserta_terhadap_kursus';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['pengurusan_permohonan_kursus_persatuan_id', 'nama_penganjur_kursus'], 'required', 'skipOnEmpty' => true, 'message' => GeneralMessage::yii_validation_required],
            [['pengurusan_permohonan_kursus_persatuan_id', 'created_by', 'updated_by', 'tahap', 'lain_lain1', 'lain_lain2'], 'integer'],
            [['tarikh_kursus', 'created', 'updated', 'kelemahan', 'tarikh_tamat_kursus'], 'safe'],
            [['nama_penganjur_kursus', 'nama_penyelaras', 'nama_kursus'], 'string', 'max' => 80],
            [['kod_kursus'], 'string', 'max' => 30],
            [['tempat_kursus'], 'string', 'max' => 90],
            [['nama_penganjur_kursus', 'nama_penyelaras', 'nama_kursus','kod_kursus','tempat_kursus'], 'filter', 'filter' => function ($value) {
                return  \common\models\general\GeneralFunction::filterXSS($value);
            }],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'penilaian_peserta_terhadap_kursus_id' => 'Penilaian Penganjur Kursus ID',
            'pengurusan_permohonan_kursus_persatuan_id' => GeneralLabel::agensi,
            'tarikh_kursus' => GeneralLabel::tarikh_mula_kursus,
            'nama_penganjur_kursus' => GeneralLabel::nama_penganjur_kursus,
            'kod_kursus' => GeneralLabel::kod_kursus,
            'tempat_kursus' => GeneralLabel::tempat_kursus,
            'nama_penyelaras' => GeneralLabel::nama_penyelaras,
            'kelemahan' => GeneralLabel::testimonial_peserta,
			'tahap' => GeneralLabel::tahap,
			'nama_kursus' => GeneralLabel::nama_kursus,
			'tarikh_tamat_kursus' => GeneralLabel::tarikh_tamat_kursus,
            'created_by' => 'Created By',
            'updated_by' => 'Updated By',
            'created' => 'Created',
            'updated' => 'Updated',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getRefPengurusanPermohonanKursusPersatuan(){
        return $this->hasOne(PengurusanPermohonanKursusPersatuan::className(), ['pengurusan_permohonan_kursus_persatuan_id' => 'pengurusan_permohonan_kursus_persatuan_id']);
    }
}


text:
<?php

abstract class Command_Abstract
{
    protected $_source_dir;
    protected $_output_dir;
    protected $_docs_dir;
    protected $_excludes;
    protected $_docmode = 'online';
    protected $_img_root = '/upload/docs';
    static protected $_texy_options = array();

    function docmode($mode)
    {
        $this->_docmode = $mode;
        return $this;
    }

    function sourceDir($source_dir)
    {
        $this->_source_dir = rtrim($source_dir, '/\\');
        return $this;
    }

    function outputDir($output_dir)
    {
        $this->_output_dir = rtrim($output_dir, '/\\');
        return $this;
    }

    function docsDir($docs_dir)
    {
        $this->_docs_dir = trim($docs_dir, '/\\');
        return $this;
    }

    function excludes($excludes)
    {
        $this->_excludes = Q::normalize($excludes);
        return $this;
    }

    function imgRoot($root)
    {
        $this->_img_root = rtrim($root, '/\\');
        return $this;
    }

    abstract function execute();

    protected function _displayErrors($errors)
    {
        echo "\n\n";
        foreach ($errors as $ex)
        {
            echo $ex->getMessage();
            echo "\n";
        }

        echo "\n\n";
    }

    protected function _copyAssets($source)
    {
        $sources = array(
            $this->_source_dir . '/_assets',
            dirname(__FILE__) . '/../_assets',
            $source,
        );

        foreach ($sources as $source_dir)
        {
            $dir = realpath($source_dir);
            if (empty($dir)) continue;
            Helper_FileSys::copyDir($dir, $this->_output_dir, array('level' => 1));
        }
    }

    static function formatting($string, $formatter = 'texy')
    {
        switch ($formatter)
        {
        case 'markdown':
            return self::formattingByMarkdown($string);
            break;
        case 'texy':
            return self::formattingByTexy($string);
            break;
        default:
            return nl2br(h($string));
        }
    }

    static function formattingByMarkdown($source)
    {
        if (!function_exists('Markdown'))
        {
            require_once Q::ini('vendor_dir') . '/markdown/markdown.php';
        }

        return Markdown($source);
    }

    static function formattingByTexy($source)
    {
        static $texy;

        if (is_null($texy))
        {
            if (!class_exists('Texy', false))
            {
                $dir = Q::ini('vendor_dir');
                require_once "{$dir}/geshi/geshi.php";
                require_once "{$dir}/texy/texy.php";
            }

            Texy::$advertisingNotice = false;
            $texy = new Texy();
            $options = self::$_texy_options;
            foreach ($options as $module => $config)
            {
                foreach ($config as $key => $value)
                {
                    $m = $module . 'Module';
                    $texy->{$m}->{$key} = $value;
                }
            }

            $texy->addHandler('block', array(__CLASS__, 'texyBlockHandler'));
        }

        return $texy->process($source);
    }

    static function texySetting(array $options)
    {
        self::$_texy_options = $options;
    }

    static function texyBlockHandler($invocation, $blocktype, $content, $lang, $modifier)
    {
        if ($blocktype !== 'block/code')
        {
            return $invocation->proceed();
        }

        $texy = $invocation->getTexy();

        if ($lang == 'html')
        {
            $lang = 'html4strict';
        }
        elseif ($lang == 'yaml')
        {
            $lang = 'python';
        }
        $content = Texy::outdent($content);
        $geshi = new GeSHi($content, $lang);

        // GeSHi could not find the language
        if ($geshi->error)
        {
            return $invocation->proceed();
        }

        // do syntax-highlighting
        $geshi->set_encoding('UTF-8');
        $geshi->set_header_type(GESHI_HEADER_PRE);
        $geshi->enable_classes();
        $geshi->enable_keyword_links(false);
        $geshi->set_overall_style('');
        $geshi->set_overall_class('code');

        // save generated stylesheet
        $content = $geshi->parse_code();

        // check buggy GESHI, it sometimes produce not UTF-8 valid code :-((
        $content = iconv('UTF-8', 'UTF-8//IGNORE', $content);

        // protect output is in HTML
        $content = $texy->protect($content, Texy::CONTENT_BLOCK);

        $el = TexyHtml::el();
        $el->setText($content);
        return $el;
    }
}


text:
var utils = require("../utils.js");
var fs = require('fs');

var method = 'PUT';
var input_file = 'sample1.xlsx';
var request_url = 'storage/file/' + input_file;
var input_path = getPath(__filename, input_file);
var buffer = fs.readFileSync(input_path);

UploadFileBinary(
    method,
    Sign(request_url),
    buffer,
    function (response) {
        if (response.Status == 'OK') {
            console.log(input_path, 'has been uploaded');
        }

        var sURL = 'cells/' + input_file + '/worksheets/Sheet1/cells/maxdatarow';
        var sMethod = 'GET';

        var sSignedURL = Sign(sURL);

        ProcessCommand(	sMethod, sSignedURL, null,
            function(response)
            {
                console.log(
                    JSON.stringify(response, null, 2)
                );
            }
        );

    }
);


text:
@import "../node_modules/materialize-css/dist/css/materialize.css";
@import "../node_modules/material-design-icons/iconfont/material-icons.css";

#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #000000;
}

nav {
  background-color: #fff59d;
}

nav ul a {
  color: #000000;
}

nav .brand-logo {
  color: #000000;
}

.page-footer {
  color: #000000;
  background-color: #fff59d;
}

.page-footer .footer-copyright {
  color: #000000;
}

footer {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 100px;
    width: 100%;
    overflow:hidden;
}


text:
from __future__ import absolute_import, division, print_function, unicode_literals

import pytest ; pytest

#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------

# Standard library imports

# External imports

# Bokeh imports
from bokeh.layouts import column
from bokeh.models import Circle, ColumnDataSource, CustomAction, CustomJS, PasswordInput, Plot, Range1d
from bokeh._testing.util.selenium import enter_text_in_element, RECORD

#-----------------------------------------------------------------------------
# Tests
#-----------------------------------------------------------------------------

pytest_plugins = (
    "bokeh._testing.plugins.bokeh",
)

def modify_doc(doc):
    source = ColumnDataSource(dict(x=[1, 2], y=[1, 1], val=["a", "b"]))
    plot = Plot(plot_height=400, plot_width=400, x_range=Range1d(0, 1), y_range=Range1d(0, 1), min_border=0)
    plot.add_glyph(source, Circle(x='x', y='y', size=20))
    plot.add_tools(CustomAction(callback=CustomJS(args=dict(s=source), code=RECORD("data", "s.data"))))
    text_input = PasswordInput(css_classes=["foo"])
    def cb(attr, old, new):
        source.data['val'] = [old, new]
    text_input.on_change('value', cb)
    doc.add_root(column(text_input, plot))

@pytest.mark.integration
@pytest.mark.selenium
class Test_PasswordInput(object):

    def test_displays_password_input(self, bokeh_model_page):
        pw_input = PasswordInput(css_classes=["foo"])

        page = bokeh_model_page(pw_input)

        el = page.driver.find_element_by_css_selector('.foo input')
        assert el.get_attribute('type') == "password"

        assert page.has_no_console_errors()

    def test_displays_title(self, bokeh_model_page):
        pw_input = PasswordInput(title="title", css_classes=["foo"])

        page = bokeh_model_page(pw_input)

        el = page.driver.find_element_by_css_selector('.foo label')
        assert el.text == "title"
        el = page.driver.find_element_by_css_selector('.foo input')
        assert el.get_attribute('placeholder') == ""
        assert el.get_attribute('type') == "password"

        assert page.has_no_console_errors()

    def test_displays_placeholder(self, bokeh_model_page):
        pw_input = PasswordInput(placeholder="placeholder", css_classes=["foo"])

        page = bokeh_model_page(pw_input)

        el = page.driver.find_element_by_css_selector('.foo label')
        assert el.text == ""
        el = page.driver.find_element_by_css_selector('.foo input')
        assert el.get_attribute('placeholder') == "placeholder"
        assert el.get_attribute('type') == "password"

        assert page.has_no_console_errors()

    # XXX (bev) always works locally but fails intermittently (often) on TravisCI
    @pytest.mark.skip
    def test_server_on_change_no_round_trip_without_enter_or_click(self, bokeh_server_page):
        page = bokeh_server_page(modify_doc)

        el = page.driver.find_element_by_css_selector('.foo input')
        enter_text_in_element(page.driver, el, "pre", enter=False) # not change event if enter is not pressed

        page.click_custom_action()

        results = page.results
        assert results['data']['val'] == ["a", "b"]

        # XXX (bev) disabled until https://github.com/bokeh/bokeh/issues/7970 is resolved
        #assert page.has_no_console_errors()

    def test_server_on_change_round_trip(self, bokeh_server_page):
        page = bokeh_server_page(modify_doc)

        el = page.driver.find_element_by_css_selector('.foo input')
        enter_text_in_element(page.driver, el, "val1")

        page.click_custom_action()

        results = page.results
        assert results['data']['val'] == ["", "val1"]

        # double click to highlight and overwrite old text
        enter_text_in_element(page.driver, el, "val2", click=2)

        page.click_custom_action()

        results = page.results
        assert results['data']['val'] == ["val1", "val2"]

        # Check clicking outside input also triggers
        enter_text_in_element(page.driver, el, "val3", click=2, enter=False)
        page.click_canvas_at_position(10, 10)

        page.click_custom_action()

        results = page.results
        assert results['data']['val'] == ["val2", "val3"]

        # XXX (bev) disabled until https://github.com/bokeh/bokeh/issues/7970 is resolved
        #assert page.has_no_console_errors()

    def test_callback_property_executes(self, single_plot_page):
        source = ColumnDataSource(dict(x=[1, 2], y=[1, 1]))
        plot = Plot(plot_height=400, plot_width=400, x_range=Range1d(0, 1), y_range=Range1d(0, 1), min_border=0)
        plot.add_glyph(source, Circle(x='x', y='y', size=20))
        text_input = PasswordInput(css_classes=['foo'])
        text_input.callback = CustomJS(code=RECORD("value", "cb_obj.value"))

        page = single_plot_page(column(text_input, plot))

        el = page.driver.find_element_by_css_selector('.foo input')
        enter_text_in_element(page.driver, el, "val1")

        results = page.results
        assert results['value'] == 'val1'

        # double click to highlight and overwrite old text
        enter_text_in_element(page.driver, el, "val2", click=2)

        results = page.results
        assert results['value'] == 'val2'

        # Check clicking outside input also triggers
        enter_text_in_element(page.driver, el, "val3", click=2, enter=False)
        page.click_canvas_at_position(10, 10)
        results = page.results

        assert results['value'] == 'val3'

        assert page.has_no_console_errors()

    def test_js_on_change_executes(self, single_plot_page):
        source = ColumnDataSource(dict(x=[1, 2], y=[1, 1]))
        plot = Plot(plot_height=400, plot_width=400, x_range=Range1d(0, 1), y_range=Range1d(0, 1), min_border=0)
        plot.add_glyph(source, Circle(x='x', y='y', size=20))
        text_input = PasswordInput(css_classes=['foo'])
        text_input.js_on_change('value', CustomJS(code=RECORD("value", "cb_obj.value")))

        page = single_plot_page(column(text_input, plot))

        el = page.driver.find_element_by_css_selector('.foo input')
        enter_text_in_element(page.driver, el, "val1")

        results = page.results
        assert results['value'] == 'val1'

        # double click to highlight and overwrite old text
        enter_text_in_element(page.driver, el, "val2", click=2)

        results = page.results
        assert results['value'] == 'val2'

        # Check clicking outside input also triggers
        enter_text_in_element(page.driver, el, "val3", click=2, enter=False)
        page.click_canvas_at_position(10, 10)
        results = page.results

        assert results['value'] == 'val3'

        assert page.has_no_console_errors()


text:
//----------------------------------------------------------------------
//This code is developed as part of the Java CoG Kit project
//The terms of the license can be found at http://www.cogkit.org/license
//This message may not be removed or altered.
//----------------------------------------------------------------------

/*
 * Created on Jun 18, 2008
 */
package k.rt;

public class Futures {
    public static Object futureCheck(final Object o) {
        if (o instanceof FutureValue) {
            return ((FutureValue) o).getValue();
        }
        else {
            return o;
        }
    }
}


text:
package com.clearlyspam23.GLE.GUI.template;

import java.util.List;

import com.clearlyspam23.GLE.PluginManager;
import com.clearlyspam23.GLE.Template;
import com.clearlyspam23.GLE.GUI.NamedPanel;

public abstract class TemplateSubPanel extends NamedPanel{

	/**
	 *
	 */
	private static final long serialVersionUID = 1L;
	public final PluginManager pluginManager;

	public TemplateSubPanel(PluginManager pluginManager)
	{
		this.pluginManager = pluginManager;
	}

	/**
	 * called before the template is finalized, in order to ensure that any preconditions are met
	 * this method should return a String for everything that is "wrong" with this panel
	 * if everything is ok, this method should return either an empty List, or null
	 * @return a List of Strings with 1 String for every error with this panel
	 */
	public abstract List<String> verify();

	/**
	 * optional method, called after verify. This method should be used to issue warnings prior to template finalization.
	 * Acceptable usage would be to pop up a JOptionDialog, verifying that it is ok for a file to be overwritten
	 * @return true if it is ok to continue with template creation, false if not.
	 */
	public boolean getWarnings(){
		return true;
	}

	public abstract void setToTemplate(Template template);

	public abstract void generateTemplate(Template template);

	public abstract void reset();

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<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>

  <parent>
    <groupId>org.hisp.dhis</groupId>
    <artifactId>dhis</artifactId>
    <version>2.39-SNAPSHOT</version>
  </parent>

  <artifactId>dhis-api</artifactId>
  <packaging>jar</packaging>
  <name>DHIS API</name>

  <dependencies>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-collections4</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jfree</groupId>
      <artifactId>jfreechart</artifactId>
    </dependency>
    <dependency>
      <groupId>net.sf.jasperreports</groupId>
      <artifactId>jasperreports</artifactId>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-core</artifactId>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-annotations</artifactId>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.dataformat</groupId>
      <artifactId>jackson-dataformat-xml</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-jdbc</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-tx</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-context</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-beans</artifactId>
    </dependency>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
    </dependency>
    <dependency>
      <groupId>org.cache2k</groupId>
      <artifactId>cache2k-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.cache2k</groupId>
      <artifactId>cache2k-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-slf4j-impl</artifactId>
    </dependency>
    <dependency>
      <groupId>joda-time</groupId>
      <artifactId>joda-time</artifactId>
    </dependency>
    <dependency>
      <groupId>javax.validation</groupId>
      <artifactId>validation-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.hisp.dhis.rules</groupId>
      <artifactId>rule-engine</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jboss.aerogear</groupId>
      <artifactId>aerogear-otp-java</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.security</groupId>
      <artifactId>spring-security-core</artifactId>
    </dependency>
    <dependency>
      <groupId>commons-codec</groupId>
      <artifactId>commons-codec</artifactId>
    </dependency>
    <dependency>
      <groupId>org.locationtech.jts</groupId>
      <artifactId>jts-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.locationtech.jts.io</groupId>
      <artifactId>jts-io-common</artifactId>
    </dependency>
    <dependency>
      <groupId>org.geotools</groupId>
      <artifactId>gt-geojson</artifactId>
    </dependency>
    <dependency>
      <groupId>javax.xml.bind</groupId>
      <artifactId>jaxb-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-core</artifactId>
    </dependency>
    <dependency>
      <groupId>com.google.code.findbugs</groupId>
      <artifactId>jsr305</artifactId>
    </dependency>
    <dependency>
      <groupId>commons-beanutils</groupId>
      <artifactId>commons-beanutils</artifactId>
    </dependency>
    <dependency>
      <groupId>org.geotools</groupId>
      <artifactId>gt-opengis</artifactId>
    </dependency>
    <dependency>
      <groupId>javax.persistence</groupId>
      <artifactId>javax.persistence-api</artifactId>
    </dependency>

    <!-- SMPP -->
    <dependency>
      <groupId>org.jsmpp</groupId>
      <artifactId>jsmpp</artifactId>
    </dependency>

    <!-- Test -->
    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-params</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.awaitility</groupId>
      <artifactId>awaitility</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jeasy</groupId>
      <artifactId>easy-random-core</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <properties>
    <rootDir>../</rootDir>
  </properties>
</project>


text:
package org.springframework.instrument.classloading.websphere;

import java.lang.instrument.ClassFileTransformer;

import org.springframework.instrument.classloading.LoadTimeWeaver;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;

/**
 * {@link LoadTimeWeaver} implementation for WebSphere's instrumentable ClassLoader.
 * Compatible with WebSphere 7 as well as 8.
 *
 * @author Costin Leau
 * @since 3.1
 */
public class WebSphereLoadTimeWeaver implements LoadTimeWeaver {

	private final WebSphereClassLoaderAdapter classLoader;

	/**
	 * Create a new instance of the {@link WebSphereLoadTimeWeaver} class using
	 * the default {@link ClassLoader class loader}.
	 * @see org.springframework.util.ClassUtils#getDefaultClassLoader()
	 */
	public WebSphereLoadTimeWeaver() {
		this(ClassUtils.getDefaultClassLoader());
	}

	/**
	 * Create a new instance of the {@link WebSphereLoadTimeWeaver} class using
	 * the supplied {@link ClassLoader}.
	 * @param classLoader the {@code ClassLoader} to delegate to for weaving
	 * (must not be {@code null})
	 */
	public WebSphereLoadTimeWeaver(ClassLoader classLoader) {
		Assert.notNull(classLoader, "ClassLoader must not be null");
		this.classLoader = new WebSphereClassLoaderAdapter(classLoader);
	}

	@Override
	public void addTransformer(ClassFileTransformer transformer) {
		this.classLoader.addTransformer(transformer);
	}

	@Override
	public ClassLoader getInstrumentableClassLoader() {
		return this.classLoader.getClassLoader();
	}

	@Override
	public ClassLoader getThrowawayClassLoader() {
		return this.classLoader.getThrowawayClassLoader();
	}

}


text:
#define _GNU_SOURCE /* asprintf, basename */

#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sysexits.h>
#include <syslog.h>
#include <unistd.h>

#include "subprocess.h"
#include "tempdir.h"

char* lock_filename = NULL;
volatile sig_atomic_t timeout_expired = 0;

static void usage(char* prog) {
  fprintf(stderr,
          "Usage: %s [options] command [arg [arg] ...]\n\n"
          "This program prevents concurrent execution of a process\n"
          "by holding an exclusive lock while the subprocess is running.\n"
          "Subsequent attempts to run a process with the same lock,\n"
          "while another process has the lock open, and is still\n"
          "executing, will exit with a failure exit code.\n",
          prog);
  fprintf(stderr,
          "\noptions:\n"
          " -d       send log messages to stderr as well as syslog.\n"
          " -f lock_filename path to use as a lock file\n"
          " -t timeout  time in seconds to wait to acquire the lock\n"
          " -h       this help.\n");
}

static void alarm_handler(int signum);
static void alarm_handler(int signum) {
  (void)signum; /* suppress unused variable warning */
  timeout_expired = 1;
}

int main(int argc, char** argv) {
  char* progname;
  int arg;
  char* command;
  char** command_args;
  int status = 0;
  struct flock fl;
  int fd;
  char buf[BUFSIZ];
  struct sigaction sa, old_sa;
  int debug = 0;
  int timeout = 5;
  char* endptr;

  memset(&fl, 0, sizeof(fl));
  fl.l_type = F_WRLCK;
  fl.l_whence = SEEK_SET;

  progname = argv[0];

  while ((arg = getopt(argc, argv, "+df:ht:")) > 0) {
    switch (arg) {
      case 'h':
        usage(progname);
        exit(EXIT_SUCCESS);
        break;
      case 'd':
        debug = LOG_PERROR;
        break;
      case 'f':
        if (asprintf(&lock_filename, "%s", optarg) == -1) {
          perror("asprintf");
          exit(EX_OSERR);
        }
        break;
      case 't':
        timeout = strtol(optarg, &endptr, 10);
        if (*endptr || !optarg) {
          fprintf(stderr, "invalid timeout specified: %s\n", optarg);
          exit(EX_DATAERR);
        }
        break;
      default:
        break;
    }
  }
  if (optind >= argc) {
    usage(progname);
    exit(EXIT_FAILURE);
  } else {
    command = strdup(argv[optind]);
    command_args = &argv[optind];
  }

  openlog(progname, debug | LOG_ODELAY | LOG_PID | LOG_NOWAIT, LOG_CRON);
  if (debug)
    setlogmask(LOG_UPTO(LOG_DEBUG));
  else
    setlogmask(LOG_UPTO(LOG_INFO));

  if (lock_filename == NULL) {
    if (asprintf(&lock_filename, "%s/%s.pid", make_tempdir(),
                 basename(command)) == -1) {
      perror("asprintf");
      exit(EX_OSERR);
    }
  }
  syslog(LOG_DEBUG, "lock filename is %s", lock_filename);

  sa.sa_handler = alarm_handler;
  sigemptyset(&sa.sa_mask);
  sa.sa_flags = 0;
  sigaction(SIGALRM, &sa, &old_sa);
  alarm(timeout);
  if ((fd = open(lock_filename, O_CREAT | O_RDWR | O_TRUNC,
                 S_IRUSR | S_IWUSR)) < 0) {
    perror(lock_filename);
    exit(EX_NOINPUT);
  } else {
    if (fcntl(fd, F_SETLKW, &fl) < 0) {
      switch (errno) {
        case EINTR:
          if (timeout_expired) {
            syslog(LOG_INFO,
                   "waited %d seconds, already locked by another process",
                   timeout);
            exit(EX_CANTCREAT);
          }
          break;
        case EACCES:
        case EAGAIN:
          syslog(LOG_INFO, "already locked by another process");
          exit(EX_CANTCREAT);
          break;
        default:
          perror("fcntl");
          exit(EXIT_FAILURE);
      }
    } else {
      alarm(0);
      sigaction(SIGALRM, &old_sa, NULL);
      snprintf(buf, BUFSIZ, "%d\n", getpid());
      if (write(fd, buf, strlen(buf)) == -1) {
        perror("write");
      }
      fsync(fd);
      syslog(LOG_DEBUG, "lock granted");
      status = run_subprocess(command, command_args, NULL);
      close(fd);
    }
  }
  closelog();
  return status;
}