text:
/*	%TITLE "Returns the Current Time in HHMMSS(24-Hour) Form"
 */
#pragma module time_now "V3.6 Calico"

/*
 * COPYRIGHT (C) 1987 BY
 *
 * Computer Management Center, Inc.
 * Idaho Falls, Idaho.
 *
 * This software is furnished under a license and may be used and
 * copied only in accordance with terms of such license and with
 * the inclusion of the above copyright notice.  This software or
 * any other copies thereof may not be provided or otherwise made
 * available to any other person.  No title to and ownership of
 * the software is hereby transferred.
 *
 * The information in this software is subject to change without
 * notice and should not be construed as a commitment by
 * Computer Management Center, Inc.
 *
 * CMC assumes no responsibility for the use or reliability of
 * its software on equipment which is not supported by CMC.
 *
 *++
 *
 * Abstract:HELP
 *	.p
 *	Returns the current time in the HHMMSS (24-hour) form.
 *
 * Parameters:
 *
 *	Returns the current time in the HHMMSS form.
 *
 * Example:
 *
 *	NOW$ = TIME_NOW
 *
 * Compile:
 *
 *	$ CC/G_FLOAT FUNC_SOURCE:TIME_NOW
 *	$ LIB FUNC_LIB:CMC_3VECTOR/REP TIME_NOW
 *	$ DELETE TIME_NOW.OBJ;*
 *
 * AUTHOR:
 *
 *	5/28/86 - B. Craig Larsen
 *
 * MODIFICATION HISTORY:
 *
 *	08/14/90 - Kevin Handy
 *		Removed unecessary code.
 *
 *	07/13/93 - Kevin Handy
 *		Converted to C.
 *
 *	04/17/95 - Kevin Handy
 *		(V3.6)
 *		Update to V3.6 Calico coding standards.
 *
 *	05/28/99 - Kevin Handy
 *		Modified to compile with DEC-C
 *		(module, descrip.h, str$routines.h)
 *--
 */

/*
 * Include files
 */
#include <stdio.h>
#include <time.h>
#include <descrip.h>
#include <str$routines.h>

/*
 * Main function
 */
void time_now(struct dsc$descriptor_s *returnstr)
{
	/*
	 * Local Variables
	 */
	char makestring[10];
	time_t timer;
	struct tm *tblock;

	/*
	 * Get date structure
	 */
	timer = time(NULL);
	tblock = localtime(&timer);

	/*
	 * Create output date
	 */
	sprintf(makestring, "%02d%02d%02d",
		tblock->tm_hour,
		tblock->tm_min,
		tblock->tm_sec);

	/*
	 * Return output string
	 */
	str$copy_r(returnstr, &6l, &makestring);
}


text:
package org.zstack.header.storage.backup;

import org.zstack.header.vo.ForeignKey;
import org.zstack.header.vo.ForeignKey.ReferenceOption;
import org.zstack.header.vo.SoftDeletionCascade;
import org.zstack.header.vo.SoftDeletionCascades;
import org.zstack.header.zone.ZoneEO;
import org.zstack.header.zone.ZoneVO;

import javax.persistence.*;
import java.sql.Timestamp;

@Entity
@Table
@SoftDeletionCascades({
        @SoftDeletionCascade(parent = ZoneVO.class, joinColumn = "zoneUuid"),
        @SoftDeletionCascade(parent = BackupStorageVO.class, joinColumn = "backupStorageUuid")
})
public class BackupStorageZoneRefVO {
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    @Column
    private Long id;

    @Column
    @ForeignKey(parentEntityClass = BackupStorageEO.class, onDeleteAction = ReferenceOption.CASCADE)
    private String backupStorageUuid;

    @Column
    @ForeignKey(parentEntityClass = ZoneEO.class, onDeleteAction = ReferenceOption.CASCADE)
    private String zoneUuid;

    @Column
    private Timestamp createDate;

    @Column
    private Timestamp lastOpDate;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getBackupStorageUuid() {
        return backupStorageUuid;
    }

    public void setBackupStorageUuid(String backupStorageUuid) {
        this.backupStorageUuid = backupStorageUuid;
    }

    public String getZoneUuid() {
        return zoneUuid;
    }

    public void setZoneUuid(String zoneUuid) {
        this.zoneUuid = zoneUuid;
    }

    public Timestamp getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Timestamp createDate) {
        this.createDate = createDate;
    }

    public Timestamp getLastOpDate() {
        return lastOpDate;
    }

    public void setLastOpDate(Timestamp lastOpDate) {
        this.lastOpDate = lastOpDate;
    }
}

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Runtime.CompilerServices;

public class DevDiv_543057

{
    public const int Pass = 100;
    public const int Fail = -1;

    [MethodImplAttribute(MethodImplOptions.NoInlining)]
    public static float GetFloat(int i)
    {
        return (float)i;
    }
    [MethodImplAttribute(MethodImplOptions.NoInlining)]
    public static int test(int i, int j)
    {
        // x and y will be preferenced to callee-save
        //   they need to have enough references to qualify for callee-save
        // z and w will not
        // x and z will be inactive at the call to Math.Ceiling
        // y and w will be active
        float x = GetFloat(1);
        float y = GetFloat(2);
        float z = GetFloat(3);
        // We want w in f1. At this point z is likely to be in f0.
        // So define 'result' first.
        float result = x - y;
        float w = x + y + z;
        if (i != j)
        {
            // Here all our floats are in registers. z is going to be redefined, so it is inactive,
            // and w is not used except in the else clause so it is also inactive.
            z = (float) Math.Ceiling(((double)i) / ((double)j));
            // Now we use x and y so that they are live across the call to Math.Ceiling.
            result = z + y + w;
        }
        else
        {
            // Here we need to use all of our float arguments so that they are all live.
            y = x * y * z * w;
            x = y * 2;
            // Now x and y are going to be live across this call, to encourage them to get a callee-save reg.
            Console.WriteLine("FAIL");
            // And use x a couple more times.
            x *= y;
            result += x + y;
        }
        Console.WriteLine("Result: " + result);
        return Pass;
    }
    public static int Main()
    {
        return test(5, 6);
    }
}


text:
Robot Watchdog
==============

|license|

.. |license| image:: https://img.shields.io/dub/l/vibe-d.svg?style=flat-square

Idea
----

The idea is to have a means to send data related to test execution in
Robot Framework to any interested party. With that information one can
handle the data as it likes. Some exemples include displaying a real-time
dashboard and storing it in a database for further analisys.

Usage::

    $ pybot --listener robotwatchdog tests/


text:
FROM alpine:3.3
MAINTAINER Abhishek Shah <abshah@google.com>
RUN apk --no-cache add dnsmasq
ADD dnsmasq.conf /etc/dnsmasq.conf
ENTRYPOINT ["dnsmasq", "--keep-in-foreground"]


text:
<?xml version="1.0" encoding="UTF-8"?>
<services>

	<service>
		<name>GetFile</name>
		<sington>true</sington>
		<type>file</type>

		<request>
			<url>/api/file/user</url>
			<method>GET</method>
		</request>

		<statement>
			<file>example/user_list.resp</file>
		</statement>

		<response>
			<type>application/json</type>
			<charset>UTF-8</charset>
		</response>

	</service>

	<service>
		<name>Download</name>
		<sington>true</sington>
		<type>download</type>

		<request>
			<url>/api/file/download</url>
			<method>GET</method>
		</request>

		<statement>
			<path>example</path>
		</statement>

	</service>

	<service>
		<name>Upload</name>
		<sington>true</sington>
		<type>upload</type>

		<request>
			<url>/api/file/upload</url>
			<method>POST</method>
		</request>

		<statement>
			<path>example</path>
		</statement>

	</service>

</services>


text:
package io.pivotal.sensor.service;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import com.netflix.appinfo.InstanceInfo;
import com.netflix.discovery.DiscoveryClient;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;

import io.pivotal.sensor.model.TiltSwitch;
import io.pivotal.sensor.model.TiltSwitchEvent;

@Service
public class TiltSwitchServiceImpl implements TiltSwitchSensorService {

	private static final Logger LOG = LoggerFactory.getLogger(TiltSwitchServiceImpl.class);
	private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");

	@Autowired
	private DiscoveryClient discoveryClient;

	@Autowired
	private RestTemplate restTemplate;

	private String getURL() {
		InstanceInfo ii = discoveryClient.getNextServerFromEureka("rfid-switch-ms", false);
		LOG.debug("Home Page Url :" + ii.getHomePageUrl());
		LOG.debug("Host Name :" + ii.getHostName());
		LOG.debug("VIP Address :" + ii.getVIPAddress());
		LOG.debug("IP Addr :" + ii.getIPAddr());
		LOG.debug("Port :" + ii.getPort());
		LOG.debug("App Name:" + ii.getAppName());
		LOG.debug("Status Page Url :" + ii.getStatusPageUrl());
		LOG.debug("Secure Port :" + ii.getSecurePort());
		return ii.getHomePageUrl();
	}

	@Override
	@SuppressWarnings("unchecked")
	@HystrixCommand(fallbackMethod = "defaultGetAllTiltSwitches")
	public Iterable<TiltSwitch> getAllTiltSwitches() {
		return restTemplate.getForObject(getURL() + "get-all-tilt-switches", Iterable.class);
	}

	@Override
	@HystrixCommand(fallbackMethod = "defaultGetTiltSwitchByTiltSwitchID")
	public TiltSwitch getTiltSwitchByTiltSwitchID(String tiltSwitchId) {
		return restTemplate.getForObject(getURL() + "get-tilt-switches-by-tiltId/" + tiltSwitchId, TiltSwitch.class);
	}

	@Override
	@SuppressWarnings("unchecked")
	@HystrixCommand(fallbackMethod = "defaultGetAllTiltSwitchEventsByTiltSwitchID")
	public Iterable<TiltSwitchEvent> getAllTiltSwitchEventsByTiltSwitchID(String tiltSwitchId) {
		return restTemplate.getForObject(getURL() + "get-tilt-events-by-tiltId/" + tiltSwitchId, Iterable.class);
	}

	@Override
	@SuppressWarnings("unchecked")
	@HystrixCommand(fallbackMethod = "defaultGetAllTiltSwitchEventsByTiltSwitchIDBetween")
	public Iterable<TiltSwitchEvent> getAllTiltSwitchEventsByTiltSwitchIDBetween(String tiltSwitchId, Date startDate, Date endDate) {
		return restTemplate.getForObject(getURL() + "get-all-tilt-events-by-tiltId/" + tiltSwitchId + "/between/" + sdf.format(startDate) + "/" + sdf.format(endDate), Iterable.class);
	}

	public Iterable<TiltSwitch> defaultGetAllTiltSwitches() {
        return new ArrayList<>();
    }

	public Iterable<TiltSwitch> defaultGetAllTiltSwitchEventsByTiltSwitchIDBetween(String tiltSwitchId, Date startDate, Date endDate) {
        return new ArrayList<>();
    }

	public Iterable<TiltSwitch> defaultGetAllTiltSwitchEventsByTiltSwitchID(String tiltSwitchId) {
        return new ArrayList<>();
    }

	public TiltSwitch defaultGetTiltSwitchByTiltSwitchID(String tiltSwitchId) {
		TiltSwitch ts = new TiltSwitch();
		ts.setId(0L);
		ts.setTiltSwitchId("N/A for " + tiltSwitchId);
		ts.setCreatedTime(new Date());
        return ts;
    }

}


text:
import React, { PropTypes } from 'react'
import { Modal, Button } from 'react-bootstrap'
import { Control, Errors, Form } from 'react-redux-form'

const CreateFlatModal = props => {
  return (
    <Modal show={props.show} onHide={props.close}>
      <Form model='forms.newFlat' onSubmit={props.onSubmit}>
        <Modal.Header closeButton>
          <Modal.Title>Create a new Flat</Modal.Title>
        </Modal.Header>
        <Modal.Body>

              Flat Name:
              <Control model='.flatName' />

          <Errors model='forms.newFlat' />
        </Modal.Body>
        <Modal.Footer>
          <Button type='submit'>Virtually create your flat</Button>
        </Modal.Footer>
      </Form>
    </Modal>
  )
}

CreateFlatModal.propTypes = {
  close: PropTypes.func.isRequired,
  onSubmit: PropTypes.func.isRequired,
  show: PropTypes.bool.isRequired
}

export default CreateFlatModal


text:
package javax.usb;

public interface UsbControlIrp extends UsbIrp {
    byte bmRequestType();

    byte bRequest();

    short wIndex();

    short wValue();
}


text:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace SmartSchoolManagementSystem
{
    public partial class IDCard : Form
    {
        public IDCard()
        {
            InitializeComponent();
        }
    }
}


text:
include( "controls/manifest.lua" )

local PANEL = {}

AccessorFunc( PANEL, "m_bInitialized", "Initialized" )

--[[---------------------------------------------------------
	Name: Paint
-----------------------------------------------------------]]
function PANEL:Init()
	self:SetInitialized( false )
end

--[[---------------------------------------------------------
	Name: ClearControls
-----------------------------------------------------------]]
function PANEL:ClearControls()
	self:Clear()
end

--[[---------------------------------------------------------
	Name: GetEmbeddedPanel
-----------------------------------------------------------]]
function PANEL:GetEmbeddedPanel()

	return self

end

--[[---------------------------------------------------------
	Name: AddPanel
-----------------------------------------------------------]]
function PANEL:AddPanel( pnl )

	self:AddItem( pnl, nil )
	self:InvalidateLayout()

end

--[[---------------------------------------------------------
	Name: MatSelect
-----------------------------------------------------------]]
function PANEL:MatSelect( strConVar, tblOptions, bAutoStretch, iWidth, iHeight )

	local MatSelect = vgui.Create( "MatSelect", self )
		Derma_Hook( MatSelect.List, "Paint", "Paint", "Panel" )

		MatSelect:SetConVar( strConVar )

		if ( bAutoStretch != nil ) then MatSelect:SetAutoHeight( bAutoStretch ) end
		if ( iWidth != nil ) then MatSelect:SetItemWidth( iWidth ) end
		if ( iHeight != nil ) then MatSelect:SetItemHeight( iHeight ) end

		if ( tblOptions != nil ) then
			for k, v in pairs( tblOptions ) do
				local label = k
				if ( isnumber( label ) ) then label = v end
				MatSelect:AddMaterial( label, v )
			end
		end

	self:AddPanel( MatSelect )
	return MatSelect

end

--[[---------------------------------------------------------
	Name: FillViaTable
-----------------------------------------------------------]]
function PANEL:FillViaTable( Table )

	self:SetInitialized( true )

	self:SetName( Table.Text )

	--
	-- If we have a function to create the control panel, use that
	--
	if ( Table.ControlPanelBuildFunction ) then

		self:FillViaFunction( Table.ControlPanelBuildFunction )

	end

end

--[[---------------------------------------------------------
	Name: FillViaFunction
-----------------------------------------------------------]]
function PANEL:FillViaFunction( func )

	func( self )

end

--[[---------------------------------------------------------
	Name: ControlValues
-----------------------------------------------------------]]
function PANEL:ControlValues( data )
	if ( data.label) then
		self:SetLabel( data.label )
	end
	if ( data.closed ) then
		self:SetExpanded( false )
	end
end

--[[---------------------------------------------------------
	Name: AddControl
-----------------------------------------------------------]]
function PANEL:AddControl( control, data )

	local data = table.LowerKeyNames( data )
	local original = control
	control = string.lower( control )

	-- Retired
	if ( control == "header" ) then

		if ( data.description ) then
			local ctrl = self:Help( data.description )
			return ctrl
		end

		return
	end

	if ( control == "textbox" ) then

		local ctrl = self:TextEntry( data.label or "Untitled", data.command )
		return ctrl

	end

	if ( control == "label" ) then

		local ctrl = self:Help( data.text )
		return ctrl

	end

	if ( control == "checkbox" || control == "toggle" ) then

		local ctrl = self:CheckBox( data.label or "Untitled", data.command )

		if ( data.help ) then
			self:ControlHelp( data.label .. ".help" )
		end

		return ctrl

	end

	if ( control == "slider" ) then

		local Decimals = 0
		if ( data.type && string.lower(data.type) == "float" ) then Decimals = 2 end

		local ctrl = self:NumSlider( data.label or "Untitled", data.command, data.min or 0, data.max or 100, Decimals )

		if ( data.help ) then
			self:ControlHelp( data.label .. ".help" )
		end

		return ctrl

	end

	if ( control == "propselect" ) then

		local ctrl = vgui.Create( "PropSelect", self )
		ctrl:ControlValues( data ) -- Yack.
		self:AddPanel( ctrl )
		return ctrl

	end

	if ( control == "matselect" ) then

		local ctrl = vgui.Create( "MatSelect", self )
		ctrl:ControlValues( data ) -- Yack.
		self:AddPanel( ctrl )

		Derma_Hook( ctrl.List, "Paint", "Paint", "Panel" )

		return ctrl

	end

	if ( control == "ropematerial" ) then

		local ctrl = vgui.Create( "RopeMaterial", self )
		ctrl:SetConVar( data.convar )
		self:AddPanel( ctrl )

		return ctrl

	end

	if ( control == "button" ) then

		local ctrl = vgui.Create( "DButton", self )

		-- Note: Buttons created this way use the old method of calling commands,
		-- via LocalPlayer:ConCommand. This way is flawed. This way is legacy.
		-- The new way is to make buttons via controlpanel:Button( name, command, commandarg1, commandarg2 ) etc
		if ( data.command ) then
			function ctrl:DoClick() LocalPlayer():ConCommand( data.command ) end
		end

		ctrl:SetText( data.label or data.text or "No Label" )
		self:AddPanel( ctrl )
		return ctrl

	end

	if ( control == "numpad" ) then

		local ctrl = vgui.Create( "CtrlNumPad", self )
			ctrl:SetConVar1( data.command )
			ctrl:SetConVar2( data.command2 )
			ctrl:SetLabel1( data.label )
			ctrl:SetLabel2( data.label2 )
		self:AddPanel( ctrl )
		return ctrl

	end

	if ( control == "color" ) then

		local ctrl = vgui.Create( "CtrlColor", self )

			ctrl:SetLabel( data.label )
			ctrl:SetConVarR( data.red )
			ctrl:SetConVarG( data.green )
			ctrl:SetConVarB( data.blue )
			ctrl:SetConVarA( data.alpha )

		self:AddPanel( ctrl )
		return ctrl

	end

	if ( control == "combobox" ) then

		if ( tostring( data.menubutton ) == "1" ) then

			local ctrl = vgui.Create( "ControlPresets", self )
			ctrl:SetPreset( data.folder )
			if ( data.options ) then
				for k, v in pairs( data.options ) do
					ctrl:AddOption( k, v )
				end
			end

			if ( data.cvars ) then
				for k, v in pairs( data.cvars ) do
					ctrl:AddConVar( v )
				end
			end

			self:AddPanel( ctrl )
			return ctrl

		end

		control = "listbox"

	end

	if ( control == "listbox" ) then

		if ( data.height ) then

			local ctrl = vgui.Create( "DListView" )
			ctrl:SetMultiSelect( false )
			ctrl:AddColumn( data.label or "unknown" )

			if ( data.options ) then

				for k, v in pairs( data.options ) do

					local line = ctrl:AddLine( k )
					line.data = v

					-- This is kind of broken because it only checks one convar
					-- instead of all of them. But this is legacy. It will do for now.
					for k, v in pairs( line.data ) do
						if ( GetConVarString( k ) == v ) then
							line:SetSelected( true )
						end
					end

				end

			end

			ctrl:SetTall( data.height )
			ctrl:SortByColumn( 1, false )

			function ctrl:OnRowSelected( LineID, Line )
				for k, v in pairs( Line.data ) do
					RunConsoleCommand( k, v )
				end
			end

			self:AddItem( ctrl )

			return ctrl

		else

			local ctrl = vgui.Create( "CtrlListBox", self )

			if ( data.options ) then
				for k, v in pairs( data.options ) do
					ctrl:AddOption( k, v )
				end
			end

			local left = vgui.Create( "DLabel", self )
			left:SetText( data.label )
			left:SetDark( true )
			ctrl:SetHeight( 25 )
			ctrl:Dock( TOP )

			self:AddItem( left, ctrl )

			return ctrl

		end

	end

	if ( control == "materialgallery" ) then

		local ctrl = vgui.Create( "MatSelect", self )
		--ctrl:ControlValues( data ) -- Yack.

		ctrl:SetItemWidth( data.width or 32 )
		ctrl:SetItemHeight( data.height or 32 )
		ctrl:SetNumRows( data.rows or 4 )
		ctrl:SetConVar( data.convar or nil )

		Derma_Hook( ctrl.List, "Paint", "Paint", "Panel" )

		for name, tab in pairs( data.options ) do

			local mat = tab.material
			local value = tab.value

			tab.material = nil
			tab.value = nil

			ctrl:AddMaterialEx( name, mat, value, tab )

		end

		self:AddPanel( ctrl )
		return ctrl

	end

	local ctrl = vgui.Create( original, self )
	-- Fallback for scripts that relied on the old behaviour
	if ( !ctrl ) then
		ctrl = vgui.Create( control, self )
	end
	if ( ctrl ) then

		if ( ctrl.ControlValues ) then
			ctrl:ControlValues( data )
		end

		self:AddPanel( ctrl )
		return ctrl

	end

	MsgN( "UNHANDLED CONTROL: ", control )
	PrintTable( data )
	MsgN( "\n\n" )

end
vgui.Register( "ControlPanel", PANEL, "DForm" )


text:
SYNONYM

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

#### Published in
Sovetsk. Bot. 3-4:162. 1933 (Desv. , J. Bot. Agric. 1:120. 1813, nom. inval. )

#### Original name
null

### Remarks
null


text:
package org.elasticsearch.xpack.core.ilm;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.action.support.ActiveShardCount;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.cluster.routing.allocation.decider.AllocationDeciders;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.settings.ClusterSettings;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.index.Index;
import org.elasticsearch.xpack.cluster.routing.allocation.DataTierAllocationDecider;
import org.elasticsearch.xpack.core.ilm.step.info.AllocationInfo;

import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Optional;
import java.util.Set;

import static org.elasticsearch.xpack.cluster.routing.allocation.DataTierAllocationDecider.INDEX_ROUTING_PREFER_SETTING;
import static org.elasticsearch.xpack.core.ilm.AllocationRoutedStep.getPendingAllocations;
import static org.elasticsearch.xpack.core.ilm.step.info.AllocationInfo.waitingForActiveShardsAllocationInfo;

/**
 * Checks whether all shards have been correctly routed in response to updating the allocation rules for an index in order
 * to migrate the index to a new tier.
 */
public class DataTierMigrationRoutedStep extends ClusterStateWaitStep {
    public static final String NAME = "check-migration";

    private static final Logger logger = LogManager.getLogger(DataTierMigrationRoutedStep.class);

    private static final Set<Setting<?>> ALL_CLUSTER_SETTINGS;

    static {
        Set<Setting<?>> allSettings = new HashSet<>(ClusterSettings.BUILT_IN_CLUSTER_SETTINGS);
        allSettings.add(DataTierAllocationDecider.CLUSTER_ROUTING_REQUIRE_SETTING);
        allSettings.add(DataTierAllocationDecider.CLUSTER_ROUTING_INCLUDE_SETTING);
        allSettings.add(DataTierAllocationDecider.CLUSTER_ROUTING_EXCLUDE_SETTING);
        ALL_CLUSTER_SETTINGS = allSettings;
    }

    DataTierMigrationRoutedStep(StepKey key, StepKey nextStepKey) {
        super(key, nextStepKey);
    }

    @Override
    public boolean isRetryable() {
        return true;
    }

    @Override
    public Result isConditionMet(Index index, ClusterState clusterState) {
        AllocationDeciders allocationDeciders = new AllocationDeciders(
            List.of(
                new DataTierAllocationDecider(clusterState.getMetadata().settings(),
                    new ClusterSettings(Settings.EMPTY, ALL_CLUSTER_SETTINGS))
            )
        );
        IndexMetadata idxMeta = clusterState.metadata().index(index);
        if (idxMeta == null) {
            // Index must have been since deleted, ignore it
            logger.debug("[{}] lifecycle action for index [{}] executed but index no longer exists", getKey().getAction(), index.getName());
            return new Result(false, null);
        }
        String preferredTierConfiguration = INDEX_ROUTING_PREFER_SETTING.get(idxMeta.getSettings());
        Optional<String> availableDestinationTier = DataTierAllocationDecider.preferredAvailableTier(preferredTierConfiguration,
            clusterState.getNodes());

        if (ActiveShardCount.ALL.enoughShardsActive(clusterState, index.getName()) == false) {
            if (Strings.isEmpty(preferredTierConfiguration)) {
                logger.debug("[{}] lifecycle action for index [{}] cannot make progress because not all shards are active",
                    getKey().getAction(), index.getName());
            } else {
                if (availableDestinationTier.isPresent()) {
                    logger.debug("[{}] migration of index [{}] to the [{}] tier preference cannot progress, as not all shards are active",
                        getKey().getAction(), index.getName(), preferredTierConfiguration);
                } else {
                    logger.debug("[{}] migration of index [{}] to the next tier cannot progress as there is no available tier for the " +
                            "configured preferred tiers [{}] and not all shards are active", getKey().getAction(), index.getName(),
                        preferredTierConfiguration);
                }
            }
            return new Result(false, waitingForActiveShardsAllocationInfo(idxMeta.getNumberOfReplicas()));
        }

        if (Strings.isEmpty(preferredTierConfiguration)) {
            logger.debug("index [{}] has no data tier routing preference setting configured and all its shards are active. considering " +
                "the [{}] step condition met and continuing to the next step", index.getName(), getKey().getName());
            // the user removed the tier routing setting and all the shards are active so we'll cary on
            return new Result(true, null);
        }

        int allocationPendingAllShards = getPendingAllocations(index, allocationDeciders, clusterState);

        if (allocationPendingAllShards > 0) {
            String statusMessage = availableDestinationTier.map(
                s -> String.format(Locale.ROOT, "[%s] lifecycle action [%s] waiting for [%s] shards to be moved to the [%s] tier (tier " +
                        "migration preference configuration is [%s])", index.getName(), getKey().getAction(), allocationPendingAllShards, s,
                    preferredTierConfiguration)
            ).orElseGet(
                () -> String.format(Locale.ROOT, "index [%s] has a preference for tiers [%s], but no nodes for any of those tiers are " +
                    "available in the cluster", index.getName(), preferredTierConfiguration));
            logger.debug(statusMessage);
            return new Result(false, new AllocationInfo(idxMeta.getNumberOfReplicas(), allocationPendingAllShards, true, statusMessage));
        } else {
            logger.debug("[{}] migration of index [{}] to tier [{}] (preference [{}]) complete",
                getKey().getAction(), index, availableDestinationTier, preferredTierConfiguration);
            return new Result(true, null);
        }
    }
}


text:
from corehq.messaging.scheduling.models.abstract import Schedule, Event, Broadcast, Content
from corehq.messaging.scheduling import util
from datetime import timedelta, time
from memoized import memoized
from django.db import models, transaction

class AlertSchedule(Schedule):

    @property
    @memoized
    def memoized_events(self):
        """
        This is named with a memoized_ prefix to be clear that it should only be used
        when the event set is not changing.
        """
        return list(self.alertevent_set.order_by('order'))

    def set_first_event_due_timestamp(self, instance, start_date=None):
        instance.next_event_due = util.utcnow()
        self.set_next_event_due_timestamp(instance)

    def set_next_event_due_timestamp(self, instance):
        current_event = self.memoized_events[instance.current_event_num]
        instance.next_event_due += timedelta(minutes=current_event.minutes_to_wait)

    def get_current_event_content(self, instance):
        current_event = self.memoized_events[instance.current_event_num]
        return current_event.memoized_content

    def delete_related_events(self):
        for event in self.alertevent_set.all():
            event.content.delete()

        self.alertevent_set.all().delete()

    def total_iterations_complete(self, instance):
        # AlertSchedules do not repeat
        return instance.schedule_iteration_num > 1

    @classmethod
    def create_simple_alert(cls, domain, content, extra_options=None):
        schedule = cls(domain=domain)
        schedule.set_simple_alert(content, extra_options=extra_options)
        return schedule

    def set_simple_alert(self, content, extra_options=None):
        with transaction.atomic():
            self.ui_type = Schedule.UI_TYPE_IMMEDIATE
            self.set_extra_scheduling_options(extra_options)
            self.save()

            self.delete_related_events()

            if content.pk is None:
                content.save()

            event = AlertEvent(
                order=1,
                schedule=self,
                minutes_to_wait=0,
            )
            event.content = content
            event.save()

    @classmethod
    def create_custom_alert(cls, domain, event_and_content_objects, extra_options=None):
        schedule = cls(domain=domain)
        schedule.set_custom_alert(event_and_content_objects, extra_options=extra_options)
        return schedule

    def set_custom_alert(self, event_and_content_objects, extra_options=None):
        if len(event_and_content_objects) == 0:
            raise ValueError("Expected at least one (event, content) tuple")

        with transaction.atomic():
            self.ui_type = Schedule.UI_TYPE_CUSTOM_IMMEDIATE
            self.set_extra_scheduling_options(extra_options)
            self.save()

            self.delete_related_events()

            # passing `start` just controls where order starts counting at, it doesn't
            # cause elements to be skipped
            for order, event_and_content in enumerate(event_and_content_objects, start=1):
                event, content = event_and_content

                if not isinstance(event, AlertEvent):
                    raise TypeError("Expected AlertEvent")

                if not isinstance(content, Content):
                    raise TypeError("Expected Content")

                content.save()
                event.schedule = self
                event.content = content
                event.order = order
                event.save()

class AlertEvent(Event):
    schedule = models.ForeignKey('scheduling.AlertSchedule', on_delete=models.CASCADE)
    minutes_to_wait = models.IntegerField()

    def create_copy(self):
        """
        See Event.create_copy() for docstring.
        """
        return AlertEvent(
            minutes_to_wait=self.minutes_to_wait,
        )

class ImmediateBroadcast(Broadcast):
    schedule = models.ForeignKey('scheduling.AlertSchedule', on_delete=models.CASCADE)

    def soft_delete(self):
        from corehq.messaging.scheduling.tasks import delete_alert_schedule_instances

        with transaction.atomic():
            self.deleted = True
            self.save()
            self.schedule.deleted = True
            self.schedule.save()
            delete_alert_schedule_instances.delay(self.schedule_id.hex)


text:
module GatedRelease
  class ApplicationJob < ActiveJob::Base
  end
end


text:
<?php

/* @SRVDVServer/admin/ProfileAdmin.html.twig */
class __TwigTemplate_1deea1c30d2092cdde108401dcf880cad8f977fe9a6d2cf55201beddea093fa2 extends Twig_Template
{
    public function __construct(Twig_Environment $env)
    {
        parent::__construct($env);

        $this->parent = false;

        $this->blocks = array(
            'fos_user_content' => array($this, 'block_fos_user_content'),
        );
    }

    protected function doDisplay(array $context, array $blocks = array())
    {
        $__internal_ee851bf0d90e9359fb3640ba2cacc298ba6b7498008f1977995a85bf3d094bee = $this->env->getExtension("Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension");
        $__internal_ee851bf0d90e9359fb3640ba2cacc298ba6b7498008f1977995a85bf3d094bee->enter($__internal_ee851bf0d90e9359fb3640ba2cacc298ba6b7498008f1977995a85bf3d094bee_prof = new Twig_Profiler_Profile($this->getTemplateName(), "template", "@SRVDVServer/admin/ProfileAdmin.html.twig"));

        // line 1
        echo "
  ";
        // line 2
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\HttpKernelExtension')->renderFragment($this->env->getExtension('Symfony\Bridge\Twig\Extension\HttpKernelExtension')->controller("SRVDVServerBundle:Default:nombreInscription", array("id" => 47)));
        echo "

  ";
        // line 6
        if (array_key_exists("profile", $context)) {
            // line 7
            echo "
Votre profile a été  modifié avec success !

    ";
        } else {
            // line 9
            echo "    ";
            $this->displayBlock('fos_user_content', $context, $blocks);
            // line 12
            echo "  ";
        }
        // line 13
        echo "  ";
        $this->loadTemplate("SRVDVServerBundle:admin:footerAdmin.html.twig", "@SRVDVServer/admin/ProfileAdmin.html.twig", 13)->display($context);

        $__internal_ee851bf0d90e9359fb3640ba2cacc298ba6b7498008f1977995a85bf3d094bee->leave($__internal_ee851bf0d90e9359fb3640ba2cacc298ba6b7498008f1977995a85bf3d094bee_prof);

    }

    // line 9
    public function block_fos_user_content($context, array $blocks = array())
    {
        $__internal_e9855ab4201aef6428e0702c6975c862469dd2d2fc23b60325adda8a3cc66c34 = $this->env->getExtension("Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension");
        $__internal_e9855ab4201aef6428e0702c6975c862469dd2d2fc23b60325adda8a3cc66c34->enter($__internal_e9855ab4201aef6428e0702c6975c862469dd2d2fc23b60325adda8a3cc66c34_prof = new Twig_Profiler_Profile($this->getTemplateName(), "block", "fos_user_content"));

        // line 10
        echo "      ";
        $this->loadTemplate("FOSUserBundle:Profile:edit_content.html.twig", "@SRVDVServer/admin/ProfileAdmin.html.twig", 10)->display($context);
        // line 11
        echo "    ";

        $__internal_e9855ab4201aef6428e0702c6975c862469dd2d2fc23b60325adda8a3cc66c34->leave($__internal_e9855ab4201aef6428e0702c6975c862469dd2d2fc23b60325adda8a3cc66c34_prof);

    }

    public function getTemplateName()
    {
        return "@SRVDVServer/admin/ProfileAdmin.html.twig";
    }

    public function isTraitable()
    {
        return false;
    }

    public function getDebugInfo()
    {
        return array (  62 => 11,  59 => 10,  53 => 9,  45 => 13,  42 => 12,  39 => 9,  35 => 7,  33 => 6,  26 => 2,  23 => 1,);
    }

    /** @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead */
    public function getSource()
    {
        @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', E_USER_DEPRECATED);

        return $this->getSourceContext()->getCode();
    }

    public function getSourceContext()
    {
        return new Twig_Source("
  {{ render (controller(\"SRVDVServerBundle:Default:nombreInscription\", { 'id': 47 })) }}

  {% if profile is defined %}

Votre profile a été  modifié avec success !

    {% else %}
    {% block fos_user_content %}
      {% include \"FOSUserBundle:Profile:edit_content.html.twig\" %}
    {% endblock fos_user_content %}
  {% endif %}
  {% include \"SRVDVServerBundle:admin:footerAdmin.html.twig\" %}", "@SRVDVServer/admin/ProfileAdmin.html.twig", "C:\\wamp64\\www\\serveurDeVoeux\\src\\SRVDV\\ServerBundle\\Resources\\views\\admin\\ProfileAdmin.html.twig");
    }
}


text:
'use strict';

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

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _hash = require('../vendor/glamor/hash');

var _hash2 = _interopRequireDefault(_hash);

var _flatten = require('../utils/flatten');

var _flatten2 = _interopRequireDefault(_flatten);

var _parse = require('../vendor/postcss-safe-parser/parse');

var _parse2 = _interopRequireDefault(_parse);

var _postcssNested = require('../vendor/postcss-nested');

var _postcssNested2 = _interopRequireDefault(_postcssNested);

var _autoprefix = require('../utils/autoprefix');

var _autoprefix2 = _interopRequireDefault(_autoprefix);

var _StyleSheet = require('./StyleSheet');

var _StyleSheet2 = _interopRequireDefault(_StyleSheet);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var babelPluginFlowReactPropTypes_proptype_GlamorInsertedRule = require('../types').babelPluginFlowReactPropTypes_proptype_GlamorInsertedRule || require('prop-types').any;

var babelPluginFlowReactPropTypes_proptype_NameGenerator = require('../types').babelPluginFlowReactPropTypes_proptype_NameGenerator || require('prop-types').any;

var babelPluginFlowReactPropTypes_proptype_RuleSet = require('../types').babelPluginFlowReactPropTypes_proptype_RuleSet || require('prop-types').any;

/*
 ComponentStyle is all the CSS-specific stuff, not
 the React-specific stuff.
 */
exports.default = function (nameGenerator) {
  var inserted = {};

  var ComponentStyle = function () {
    function ComponentStyle(rules) {
      _classCallCheck(this, ComponentStyle);

      this.rules = rules;
      if (!_StyleSheet2.default.injected) _StyleSheet2.default.inject();
      this.insertedRule = _StyleSheet2.default.insert('');
    }

    /*
     * Flattens a rule set into valid CSS
     * Hashes it, wraps the whole chunk in a ._hashName {}
     * Parses that with PostCSS then runs PostCSS-Nested on it
     * Returns the hash to be injected on render()
     * */

    _createClass(ComponentStyle, [{
      key: 'generateAndInjectStyles',
      value: function generateAndInjectStyles(executionContext) {
        var flatCSS = (0, _flatten2.default)(this.rules, executionContext).join('').replace(/^\s*\/\/.*$/gm, ''); // replace JS comments
        var hash = (0, _hash2.default)(flatCSS);
        if (!inserted[hash]) {
          var selector = nameGenerator(hash);
          inserted[hash] = selector;
          var root = (0, _parse2.default)('.' + selector + ' { ' + flatCSS + ' }');
          (0, _postcssNested2.default)(root);
          (0, _autoprefix2.default)(root);
          this.insertedRule.appendRule(root.toResult().css);
        }
        return inserted[hash];
      }
    }]);

    return ComponentStyle;
  }();

  return ComponentStyle;
};

module.exports = exports['default'];


text:
hqDefine('accounting/ko/accounting.pricing_table.js', function () {
    var PricingTable = function (pricing_table, current_edition, isRenewal) {
        'use strict';
        var self = this;

        self.currentEdition = current_edition;
        self.title = ko.observable(pricing_table.title);
        self.isRenewal = isRenewal;
        self.editions = ko.observableArray(_.map(pricing_table.editions, function (edition) {
            return new PricingTableEdition(edition, self.currentEdition);
        }));
        self.sections = ko.observableArray(_.map(pricing_table.sections, function (section) {
            return new PricingTableSection(section);
        }));
        self.footer = ko.observableArray(pricing_table.footer);

        self.table_colspan = ko.computed(function () {
            return self.editions().length + 2;
        });

        self.visit_wiki_text = ko.observable(pricing_table.visit_wiki_text);

        self.selected_edition = ko.observable(isRenewal ? current_edition : false);
        self.isSubmitVisible = ko.computed(function () {
            if (isRenewal){
                return true;
            }
            return !! self.selected_edition() && !(self.selected_edition() === self.currentEdition);
        });
        self.selectCurrentPlan = function () {
            self.selected_edition(self.currentEdition);
        };

        self.init = function () {
            $('.edition-heading').tooltip();
            $('.col-edition').click(function () {
                self.selected_edition($(this).data('edition'));
            });
        };
    };

    var PricingTableEdition = function (data, current_edition) {
        'use strict';
        var self = this;

        self.slug = ko.observable(data[0]);
        self.name = ko.observable(data[1].name);
        self.description = ko.observable(data[1].description);
        self.currentEdition = ko.observable(data[0] === current_edition);
        self.notCurrentEdition = ko.computed(function (){
            return !self.currentEdition();
        });
        self.col_css = ko.computed(function () {
            return 'col-edition col-edition-' + self.slug();
        });
        self.isCommunity = ko.computed(function () {
            return self.slug() === 'community';
        });
        self.isStandard = ko.computed(function () {
            return self.slug() === 'standard';
        });
        self.isPro = ko.computed(function () {
            return self.slug() === 'pro';
        });
        self.isAdvanced = ko.computed(function () {
            return self.slug() === 'advanced';
        });
        self.isEnterprise = ko.computed(function () {
            return self.slug() === 'enterprise';
        });
    };

    var PricingTableSection = function (section) {
        'use strict';
        var self = this;

        self.show_header = ko.observable(section.category !== 'core');
        self.edition = ko.observable(section.edition);

        self.title = ko.observable(section.title);
        self.url = ko.observable(section.url);
        self.features = ko.observableArray(_.map(section.features, function (feature) {
            return new PricingTableFeature(feature);
        }));

        self.tbody_css = ko.computed(function () {
            return (self.show_header()) ? 'tbody-feature-details' : '';
        });
    };

    var PricingTableFeature = function (feature) {
        'use strict';
        var self = this;

        self.title = ko.observable(feature.title);
        self.columns = ko.observableArray(_.map(feature.columns, function (column) {
            return new PricingTableColumn(column);
        }));
    };

    var PricingTableColumn = function (data) {
        'use strict';
        var self = this;

        self.edition = ko.observable(data[0]);
        self.content = ko.observable(data[1]);

        self.col_css = ko.computed(function () {
            return 'col-edition col-edition-' + self.edition();
        });

    };

    return {PricingTable: PricingTable};
});


text:
from haystack.constants import DEFAULT_ALIAS

class BaseRouter(object):
    # Reserved for future extension.
    pass

class DefaultRouter(BaseRouter):
    def for_read(self, **hints):
        return DEFAULT_ALIAS

    def for_write(self, **hints):
        return DEFAULT_ALIAS


text:
/**
 * IXmlAttribute is just the standard Attr
 */
export type IXmlAttribute = Attr;

/**
 * Just a wrapper for an XML Element object.
 * It facilitates handling of XML elements by OSMD
 */
export class IXmlElement {
    public name: string;
    public value: string;
    public hasAttributes: boolean = false;
    public firstAttribute: IXmlAttribute;
    public hasElements: boolean;

    private attrs: IXmlAttribute[];
    private elem: Element;

    /**
     * Wraps 'elem' Element in a IXmlElement
     * @param elem
     */
    constructor(elem: Element) {
        if (!elem) {
            throw new Error("IXmlElement: expected Element, got undefined");
        }
        this.elem = elem;
        this.name = elem.nodeName.toLowerCase();

        if (elem.hasAttributes()) {
            this.hasAttributes = true;
            this.firstAttribute = elem.attributes[0];
        }
        this.hasElements = elem.hasChildNodes();
        // Look for a value
        if (elem.childNodes.length === 1 && elem.childNodes[0].nodeType === Node.TEXT_NODE) {
            this.value = elem.childNodes[0].nodeValue;
        } else {
            this.value = "";
        }
    }

    /**
     * Get the attribute with the given name
     * @param attributeName
     * @returns {Attr}
     */
    public attribute(attributeName: string): IXmlAttribute {
        return this.elem.attributes.getNamedItem(attributeName);
    }

    /**
     * Get all attributes
     * @returns {IXmlAttribute[]}
     */
    public attributes(): IXmlAttribute[] {
        if (!this.attrs) {
            const attributes: NamedNodeMap = this.elem.attributes;
            const attrs: IXmlAttribute[] = [];
            for (let i: number = 0; i < attributes.length; i += 1) {
                attrs.push(attributes[i]);
            }
            this.attrs = attrs;
        }
        return this.attrs;
    }

    /**
     * Get the first child element with the given node name
     * @param elementName
     * @returns {IXmlElement}
     */
    public element(elementName: string): IXmlElement {
        const nodes: NodeList = this.elem.childNodes;
        for (let i: number = 0, length: number = nodes.length; i < length; i += 1) {
            const node: Node = nodes[i];
            if (node.nodeType === Node.ELEMENT_NODE && node.nodeName.toLowerCase() === elementName) {
                return new IXmlElement(node as Element);
            }
        }
    }

    /**
     * Get the children with the given node name (if given, otherwise all child elements)
     * @param nodeName
     * @returns {IXmlElement[]}
     */
    public elements(nodeName?: string): IXmlElement[] {
        const nodes: NodeList = this.elem.childNodes;
        const ret: IXmlElement[] = [];
        const nameUnset: boolean = !nodeName;
        if (!nameUnset) {
            nodeName = nodeName.toLowerCase();
        }
        for (let i: number = 0; i < nodes.length; i += 1) {
            const node: Node = nodes[i];
            if (node.nodeType === Node.ELEMENT_NODE &&
                (nameUnset || node.nodeName.toLowerCase() === nodeName)
            ) {
                ret.push(new IXmlElement(node as Element));
            }
        }
        return ret;
    }
}


text:
<?php
// +-----------------------------------------------------------------------+
// | Piwigo - a PHP based photo gallery                                    |
// +-----------------------------------------------------------------------+
// | Copyright(C) 2008-2014 Piwigo Team                  http://piwigo.org |
// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
// +-----------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify  |
// | it under the terms of the GNU General Public License as published by  |
// | the Free Software Foundation                                          |
// |                                                                       |
// | This program is distributed in the hope that it will be useful, but   |
// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
// | General Public License for more details.                              |
// |                                                                       |
// | You should have received a copy of the GNU General Public License     |
// | along with this program; if not, write to the Free Software           |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA.                                                                  |
// +-----------------------------------------------------------------------+

/**
 * API method
 * Returns a list of users
 * @param mixed[] $params
 *    @option int[] user_id (optional)
 *    @option string username (optional)
 *    @option string[] status (optional)
 *    @option int min_level (optional)
 *    @option int[] group_id (optional)
 *    @option int per_page
 *    @option int page
 *    @option string order
 *    @option string display
 */
function ws_users_getList($params, &$service)
{
  global $conf;

  $where_clauses = array('1=1');

  if (!empty($params['user_id']))
  {
    $where_clauses[] = 'u.'.$conf['user_fields']['id'].' IN('. implode(',', $params['user_id']) .')';
  }

  if (!empty($params['username']))
  {
    $where_clauses[] = 'u.'.$conf['user_fields']['username'].' LIKE \''.pwg_db_real_escape_string($params['username']).'\'';
  }

  if (!empty($params['status']))
  {
    $params['status'] = array_intersect($params['status'], get_enums(USER_INFOS_TABLE, 'status'));
    if (count($params['status']) > 0)
    {
      $where_clauses[] = 'ui.status IN("'. implode('","', $params['status']) .'")';
    }
  }

  if (!empty($params['min_level']))
  {
    if ( !in_array($params['min_level'], $conf['available_permission_levels']) )
    {
      return new PwgError(WS_ERR_INVALID_PARAM, 'Invalid level');
    }
    $where_clauses[] = 'ui.level >= '.$params['min_level'];
  }

  if (!empty($params['group_id']))
  {
    $where_clauses[] = 'ug.group_id IN('. implode(',', $params['group_id']) .')';
  }

  $display = array('u.'.$conf['user_fields']['id'] => 'id');

  if ($params['display'] != 'none')
  {
    $params['display'] = array_map('trim', explode(',', $params['display']));

    if (in_array('all', $params['display']))
    {
      $params['display'] = array(
        'username','email','status','level','groups','language','theme',
        'nb_image_page','recent_period','expand','show_nb_comments','show_nb_hits',
        'enabled_high','registration_date','registration_date_string',
        'registration_date_since', 'last_visit', 'last_visit_string',
        'last_visit_since'
        );
    }
    else if (in_array('basics', $params['display']))
    {
      $params['display'] = array_merge($params['display'], array(
        'username','email','status','level','groups',
        ));
    }
    $params['display'] = array_flip($params['display']);

    // if registration_date_string or registration_date_since is requested,
    // then registration_date is automatically added
    if (isset($params['display']['registration_date_string']) or isset($params['display']['registration_date_since']))
    {
      $params['display']['registration_date'] = true;
    }

    // if last_visit_string or last_visit_since is requested, then
    // last_visit is automatically added
    if (isset($params['display']['last_visit_string']) or isset($params['display']['last_visit_since']))
    {
      $params['display']['last_visit'] = true;
    }

    if (isset($params['display']['username']))
    {
      $display['u.'.$conf['user_fields']['username']] = 'username';
    }
    if (isset($params['display']['email']))
    {
      $display['u.'.$conf['user_fields']['email']] = 'email';
    }

    $ui_fields = array(
      'status','level','language','theme','nb_image_page','recent_period','expand',
      'show_nb_comments','show_nb_hits','enabled_high','registration_date'
      );
    foreach ($ui_fields as $field)
    {
      if (isset($params['display'][$field]))
      {
        $display['ui.'.$field] = $field;
      }
    }
  }
  else
  {
    $params['display'] = array();
  }

  $query = '
SELECT DISTINCT ';

  $first = true;
  foreach ($display as $field => $name)
  {
    if (!$first) $query.= ', ';
    else $first = false;
    $query.= $field .' AS '. $name;
  }
  if (isset($params['display']['groups']))
  {
    if (!$first) $query.= ', ';
    $query.= '"" AS groups';
  }

  $query.= '
  FROM '. USERS_TABLE .' AS u
    INNER JOIN '. USER_INFOS_TABLE .' AS ui
      ON u.'. $conf['user_fields']['id'] .' = ui.user_id
    LEFT JOIN '. USER_GROUP_TABLE .' AS ug
      ON u.'. $conf['user_fields']['id'] .' = ug.user_id
  WHERE
    '. implode(' AND ', $where_clauses) .'
  ORDER BY '. $params['order'] .'
  LIMIT '. $params['per_page'] .'
  OFFSET '. ($params['per_page']*$params['page']) .'
;';

  $users = array();
  $result = pwg_query($query);
  while ($row = pwg_db_fetch_assoc($result))
  {
    $row['id'] = intval($row['id']);
    $users[ $row['id'] ] = $row;
  }

  if (count($users) > 0)
  {
    if (isset($params['display']['groups']))
    {
      $query = '
SELECT user_id, group_id
  FROM '. USER_GROUP_TABLE .'
  WHERE user_id IN ('. implode(',', array_keys($users)) .')
;';
      $result = pwg_query($query);

      while ($row = pwg_db_fetch_assoc($result))
      {
        $users[ $row['user_id'] ]['groups'][] = intval($row['group_id']);
      }
    }

    if (isset($params['display']['registration_date_string']))
    {
      foreach ($users as $cur_user)
      {
        $users[$cur_user['id']]['registration_date_string'] = format_date($cur_user['registration_date'], array('day', 'month', 'year'));
      }
    }

    if (isset($params['display']['registration_date_since']))
    {
      foreach ($users as $cur_user)
      {
        $users[ $cur_user['id'] ]['registration_date_since'] = time_since($cur_user['registration_date'], 'month');
      }
    }

    if (isset($params['display']['last_visit']))
    {
      $query = '
SELECT
    MAX(id) as history_id
  FROM '.HISTORY_TABLE.'
  WHERE user_id IN ('.implode(',', array_keys($users)).')
  GROUP BY user_id
;';
      $history_ids = array_from_query($query, 'history_id');

      if (count($history_ids) == 0)
      {
        $history_ids[] = -1;
      }

      $query = '
SELECT
    user_id,
    date,
    time
  FROM '.HISTORY_TABLE.'
  WHERE id IN ('.implode(',', $history_ids).')
;';
      $result = pwg_query($query);
      while ($row = pwg_db_fetch_assoc($result))
      {
        $last_visit = $row['date'].' '.$row['time'];
        $users[ $row['user_id'] ]['last_visit'] = $last_visit;

        if (isset($params['display']['last_visit_string']))
        {
          $users[ $row['user_id'] ]['last_visit_string'] = format_date($last_visit, array('day', 'month', 'year'));
        }

        if (isset($params['display']['last_visit_since']))
        {
          $users[ $row['user_id'] ]['last_visit_since'] = time_since($last_visit, 'day');
        }
      }
    }
  }

  $users = trigger_change('ws_users_getList', $users);

  return array(
    'paging' => new PwgNamedStruct(
      array(
        'page' => $params['page'],
        'per_page' => $params['per_page'],
        'count' => count($users)
        )
      ),
    'users' => new PwgNamedArray(array_values($users), 'user')
    );
}

/**
 * API method
 * Adds a user
 * @param mixed[] $params
 *    @option string username
 *    @option string password (optional)
 *    @option string email (optional)
 */
function ws_users_add($params, &$service)
{
  if (get_pwg_token() != $params['pwg_token'])
  {
    return new PwgError(403, 'Invalid security token');
  }

  global $conf;

  if ($conf['double_password_type_in_admin'])
  {
    if ($params['password'] != $params['password_confirm'])
    {
      return new PwgError(WS_ERR_INVALID_PARAM, l10n('The passwords do not match'));
    }
  }

  $user_id = register_user(
    $params['username'],
    $params['password'],
    $params['email'],
    false, // notify admin
    $errors,
    $params['send_password_by_mail']
    );

  if (!$user_id)
  {
    return new PwgError(WS_ERR_INVALID_PARAM, $errors[0]);
  }

  return $service->invoke('pwg.users.getList', array('user_id'=>$user_id));
}

/**
 * API method
 * Deletes users
 * @param mixed[] $params
 *    @option int[] user_id
 *    @option string pwg_token
 */
function ws_users_delete($params, &$service)
{
  if (get_pwg_token() != $params['pwg_token'])
  {
    return new PwgError(403, 'Invalid security token');
  }

  global $conf, $user;

  include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');

  $protected_users = array(
    $user['id'],
    $conf['guest_id'],
    $conf['default_user_id'],
    $conf['webmaster_id'],
    );

  // an admin can't delete other admin/webmaster
  if ('admin' == $user['status'])
  {
    $query = '
SELECT
    user_id
  FROM '.USER_INFOS_TABLE.'
  WHERE status IN (\'webmaster\', \'admin\')
;';
    $protected_users = array_merge($protected_users, query2array($query, null, 'user_id'));
  }

  // protect some users
  $params['user_id'] = array_diff($params['user_id'], $protected_users);

  $counter = 0;

  foreach ($params['user_id'] as $user_id)
  {
    delete_user($user_id);
    $counter++;
  }

  return l10n_dec(
    '%d user deleted', '%d users deleted',
    $counter
    );
}

/**
 * API method
 * Updates users
 * @param mixed[] $params
 *    @option int[] user_id
 *    @option string username (optional)
 *    @option string password (optional)
 *    @option string email (optional)
 *    @option string status (optional)
 *    @option int level (optional)
 *    @option string language (optional)
 *    @option string theme (optional)
 *    @option int nb_image_page (optional)
 *    @option int recent_period (optional)
 *    @option bool expand (optional)
 *    @option bool show_nb_comments (optional)
 *    @option bool show_nb_hits (optional)
 *    @option bool enabled_high (optional)
 */
function ws_users_setInfo($params, &$service)
{
  if (get_pwg_token() != $params['pwg_token'])
  {
    return new PwgError(403, 'Invalid security token');
  }

  global $conf, $user;

  include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');

  $updates = $updates_infos = array();
  $update_status = null;

  if (count($params['user_id']) == 1)
  {
    if (get_username($params['user_id'][0]) === false)
    {
      return new PwgError(WS_ERR_INVALID_PARAM, 'This user does not exist.');
    }

    if (!empty($params['username']))
    {
      $user_id = get_userid($params['username']);
      if ($user_id and $user_id != $params['user_id'][0])
      {
        return new PwgError(WS_ERR_INVALID_PARAM, l10n('this login is already used'));
      }
      if ($params['username'] != strip_tags($params['username']))
      {
        return new PwgError(WS_ERR_INVALID_PARAM, l10n('html tags are not allowed in login'));
      }
      $updates[ $conf['user_fields']['username'] ] = $params['username'];
    }

    if (!empty($params['email']))
    {
      if ( ($error = validate_mail_address($params['user_id'][0], $params['email'])) != '')
      {
        return new PwgError(WS_ERR_INVALID_PARAM, $error);
      }
      $updates[ $conf['user_fields']['email'] ] = $params['email'];
    }

    if (!empty($params['password']))
    {
      $updates[ $conf['user_fields']['password'] ] = $conf['password_hash']($params['password']);
    }
  }

  if (!empty($params['status']))
  {
    if (in_array($params['status'], array('webmaster', 'admin')) and !is_webmaster() )
    {
      return new PwgError(403, 'Only webmasters can grant "webmaster/admin" status');
    }

    if ( !in_array($params['status'], array('guest','generic','normal','admin','webmaster')) )
    {
      return new PwgError(WS_ERR_INVALID_PARAM, 'Invalid status');
    }

    $protected_users = array(
      $user['id'],
      $conf['guest_id'],
      $conf['webmaster_id'],
      );

    // an admin can't change status of other admin/webmaster
    if ('admin' == $user['status'])
    {
      $query = '
SELECT
    user_id
  FROM '.USER_INFOS_TABLE.'
  WHERE status IN (\'webmaster\', \'admin\')
;';
      $protected_users = array_merge($protected_users, query2array($query, null, 'user_id'));
    }

    // status update query is separated from the rest as not applying to the same
    // set of users (current, guest and webmaster can't be changed)
    $params['user_id_for_status'] = array_diff($params['user_id'], $protected_users);

    $update_status = $params['status'];
  }

  if (!empty($params['level']) or @$params['level']===0)
  {
    if ( !in_array($params['level'], $conf['available_permission_levels']) )
    {
      return new PwgError(WS_ERR_INVALID_PARAM, 'Invalid level');
    }
    $updates_infos['level'] = $params['level'];
  }

  if (!empty($params['language']))
  {
    if ( !in_array($params['language'], array_keys(get_languages())) )
    {
      return new PwgError(WS_ERR_INVALID_PARAM, 'Invalid language');
    }
    $updates_infos['language'] = $params['language'];
  }

  if (!empty($params['theme']))
  {
    if ( !in_array($params['theme'], array_keys(get_pwg_themes())) )
    {
      return new PwgError(WS_ERR_INVALID_PARAM, 'Invalid theme');
    }
    $updates_infos['theme'] = $params['theme'];
  }

  if (!empty($params['nb_image_page']))
  {
    $updates_infos['nb_image_page'] = $params['nb_image_page'];
  }

  if (!empty($params['recent_period']) or @$params['recent_period']===0)
  {
    $updates_infos['recent_period'] = $params['recent_period'];
  }

  if (!empty($params['expand']) or @$params['expand']===false)
  {
    $updates_infos['expand'] = boolean_to_string($params['expand']);
  }

  if (!empty($params['show_nb_comments']) or @$params['show_nb_comments']===false)
  {
    $updates_infos['show_nb_comments'] = boolean_to_string($params['show_nb_comments']);
  }

  if (!empty($params['show_nb_hits']) or @$params['show_nb_hits']===false)
  {
    $updates_infos['show_nb_hits'] = boolean_to_string($params['show_nb_hits']);
  }

  if (!empty($params['enabled_high']) or @$params['enabled_high']===false)
  {
    $updates_infos['enabled_high'] = boolean_to_string($params['enabled_high']);
  }

  // perform updates
  single_update(
    USERS_TABLE,
    $updates,
    array($conf['user_fields']['id'] => $params['user_id'][0])
    );

  if (isset($update_status) and count($params['user_id_for_status']) > 0)
  {
    $query = '
UPDATE '. USER_INFOS_TABLE .' SET
    status = "'. $update_status .'"
  WHERE user_id IN('. implode(',', $params['user_id_for_status']) .')
;';
    pwg_query($query);
  }

  if (count($updates_infos) > 0)
  {
    $query = '
UPDATE '. USER_INFOS_TABLE .' SET ';

    $first = true;
    foreach ($updates_infos as $field => $value)
    {
      if (!$first) $query.= ', ';
      else $first = false;
      $query.= $field .' = "'. $value .'"';
    }

    $query.= '
  WHERE user_id IN('. implode(',', $params['user_id']) .')
;';
    pwg_query($query);
  }

  // manage association to groups
  if (!empty($params['group_id']))
  {
    $query = '
DELETE
  FROM '.USER_GROUP_TABLE.'
  WHERE user_id IN ('.implode(',', $params['user_id']).')
;';
    pwg_query($query);

    // we remove all provided groups that do not really exist
    $query = '
SELECT
    id
  FROM '.GROUPS_TABLE.'
  WHERE id IN ('.implode(',', $params['group_id']).')
;';
    $group_ids = array_from_query($query, 'id');

    // if only -1 (a group id that can't exist) is in the list, then no
    // group is associated

    if (count($group_ids) > 0)
    {
      $inserts = array();

      foreach ($group_ids as $group_id)
      {
        foreach ($params['user_id'] as $user_id)
        {
          $inserts[] = array('user_id' => $user_id, 'group_id' => $group_id);
        }
      }

      mass_inserts(USER_GROUP_TABLE, array_keys($inserts[0]), $inserts);
    }
  }

  invalidate_user_cache();

  return $service->invoke('pwg.users.getList', array(
    'user_id' => $params['user_id'],
    'display' => 'basics,'.implode(',', array_keys($updates_infos)),
    ));
}

?>


text:
package com.cognifide.aet.runner.processing.data.wrappers;

import com.cognifide.aet.communication.api.metadata.Test;
import com.cognifide.aet.communication.api.metadata.Url;
import com.cognifide.aet.communication.api.wrappers.Run;
import com.cognifide.aet.runner.processing.data.UrlPacket;
import java.util.List;
import java.util.Optional;

public abstract class RunIndexWrapper<T> {

  protected Run<T> objectToRunWrapper;

  RunIndexWrapper(Run<T> objectToRunWrapper) {
    this.objectToRunWrapper = objectToRunWrapper;
  }

  public static void cleanUrlFromExecutionData(Url url) {
    url.setCollectionStats(null);
    url.getSteps()
        .forEach(step -> {
          step.setStepResult(null);
          if (step.getComparators() != null) {
            step.getComparators()
                .forEach(comparator ->
                    comparator.setStepResult(null)
                );
          }
        });
  }

  public Optional<Url> getTestUrl(String testName, final String urlName) {
    Optional<Test> test = getTest(testName);
    Optional<Url> url = Optional.ofNullable(null);
    if (test.isPresent()) {
      url = test.get().getUrl(urlName);
    }
    return url;
  }

  public Optional<Test> getTest(String testName) {
    return objectToRunWrapper.getRealSuite().getTest(testName);
  }

  public Run<T> get() {
    return objectToRunWrapper;
  }

  public abstract List<UrlPacket> getUrlPackets();

  public abstract int countUrls();

  @Override
  public String toString() {
    return "RunIndexWrapper{" +
        "objectToRunWrapper=" + objectToRunWrapper +
        '}';
  }
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Jber. schles. Ges. vaterl. Kultur 42: 117 (1875)

#### Original name
Puccinia pedunculata J. Schröt.

### Remarks
null


text:
int main(void)
{
    leveldb::DB *db;
    leveldb::Options options;
    options.create_if_missing = true;
    leveldb::Status status = leveldb::DB::Open(options, "./test", &db);
    assert(status.ok());

    leveldb::WriteOptions writeOptions;
    leveldb::Slice s = "hello";
    leveldb::Slice t = "world";

    std::cout<<"Writing <hello, world>\n";
    db->Put(writeOptions, s, t);

    delete db;

    return 0;
}


text:
<?php

/**
 * Returns the last message from the server
 *
 * @phpstub
 *
 * @return string Returns last error message from server, or an empty string if
 *                no error messages are returned from MSSQL.
 */
function mssql_get_last_message()
{
}


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="app_intro_skip_button">跳过</string>
    <string name="app_intro_done_button">完成</string>
</resources>