text:
using Lucene.Net.Diagnostics;
using Lucene.Net.Index;
using Lucene.Net.Store;
using Lucene.Net.Util;
using System.Collections.Generic;
using JCG = J2N.Collections.Generic;

namespace Lucene.Net.Codecs.Pulsing
{

    // TODO: we now inline based on total TF of the term,
    // but it might be better to inline by "net bytes used"
    // so that a term that has only 1 posting but a huge
    // payload would not be inlined.  Though this is
    // presumably rare in practice...

    /// <summary>
    /// Writer for the pulsing format.
    /// <para/>
    /// Wraps another postings implementation and decides
    /// (based on total number of occurrences), whether a terms
    /// postings should be inlined into the term dictionary,
    /// or passed through to the wrapped writer.
    /// <para/>
    /// @lucene.experimental
    /// </summary>
    public sealed class PulsingPostingsWriter : PostingsWriterBase
    {
        internal const string CODEC = "PulsedPostingsWriter";
        internal const string SUMMARY_EXTENSION = "smy";         // recording field summary

        // To add a new version, increment from the last one, and
        // change VERSION_CURRENT to point to your new version:
        internal const int VERSION_START = 0;
        internal const int VERSION_META_ARRAY = 1;
        internal const int VERSION_CURRENT = VERSION_META_ARRAY;

        private readonly SegmentWriteState _segmentState;
        //private IndexOutput _termsOut; // LUCENENET: Never read
        private readonly IList<FieldMetaData> _fields;
        private IndexOptions _indexOptions;
        private bool _storePayloads;

        // information for wrapped PF, in current field
        private int _longsSize;
        private long[] _longs;
        private bool _absolute;

        private class PulsingTermState : BlockTermState
        {
            internal byte[] bytes;
            internal BlockTermState wrappedState;

            public override string ToString()
            {
                if (bytes != null)
                {
                    return "inlined";
                }
                return "not inlined wrapped=" + wrappedState;
            }
        }

        // one entry per position
        private readonly Position[] _pending;
        private int _pendingCount = 0;   // -1 once we've hit too many positions
        private Position _currentDoc;    // first Position entry of current doc

        private sealed class Position
        {
            internal BytesRef payload;
            internal int termFreq; // only incremented on first position for a given doc
            internal int pos;
            internal int docID;
            internal int startOffset;
            internal int endOffset;
        }

        private class FieldMetaData
        {
            internal int FieldNumber { get; private set; }

            /// <summary>
            /// NOTE: This was longsSize (field) in Lucene.
            /// </summary>
            internal int Int64sSize { get; private set; }

            public FieldMetaData(int number, int size)
            {
                FieldNumber = number;
                Int64sSize = size;
            }
        }

        // TODO: -- lazy init this?  ie, if every single term
        // was inlined (eg for a "primary key" field) then we
        // never need to use this fallback?  Fallback writer for
        // non-inlined terms:
        private readonly PostingsWriterBase _wrappedPostingsWriter;

        /// <summary>
        /// If the total number of positions (summed across all docs
        /// for this term) is less than or equal <paramref name="maxPositions"/>, then the postings are
        /// inlined into terms dict.
        /// </summary>
        public PulsingPostingsWriter(SegmentWriteState state, int maxPositions, PostingsWriterBase wrappedPostingsWriter)
        {
            _pending = new Position[maxPositions];
            for (var i = 0; i < maxPositions; i++)
            {
                _pending[i] = new Position();
            }
            _fields = new JCG.List<FieldMetaData>();

            // We simply wrap another postings writer, but only call
            // on it when tot positions is >= the cutoff:
            _wrappedPostingsWriter = wrappedPostingsWriter;
            _segmentState = state;
        }

        public override void Init(IndexOutput termsOut)
        {
            //_termsOut = termsOut; // LUCENENET: Never read
            CodecUtil.WriteHeader(termsOut, CODEC, VERSION_CURRENT);
            termsOut.WriteVInt32(_pending.Length); // encode maxPositions in header
            _wrappedPostingsWriter.Init(termsOut);
        }

        public override BlockTermState NewTermState()
        {
            var state = new PulsingTermState { wrappedState = _wrappedPostingsWriter.NewTermState() };
            return state;
        }

        public override void StartTerm()
        {
            if (Debugging.AssertsEnabled) Debugging.Assert(_pendingCount == 0);
        }

        // TODO: -- should we NOT reuse across fields?  would
        // be cleaner

        /// <summary>
        /// Currently, this instance is re-used across fields, so
        /// our parent calls setField whenever the field changes.
        /// </summary>
        public override int SetField(FieldInfo fieldInfo)
        {
            _indexOptions = fieldInfo.IndexOptions;
            _storePayloads = fieldInfo.HasPayloads;
            _absolute = false;
            _longsSize = _wrappedPostingsWriter.SetField(fieldInfo);
            _longs = new long[_longsSize];
            _fields.Add(new FieldMetaData(fieldInfo.Number, _longsSize));
            return 0;
        }

        //private bool DEBUG; // LUCENENET NOTE: Not used

        public override void StartDoc(int docId, int termDocFreq)
        {
            if (Debugging.AssertsEnabled) Debugging.Assert(docId >= 0, "Got DocID={0}", docId);

            if (_pendingCount == _pending.Length)
            {
                Push();
                _wrappedPostingsWriter.FinishDoc();
            }

            if (_pendingCount != -1)
            {
                if (Debugging.AssertsEnabled) Debugging.Assert(_pendingCount < _pending.Length);
                _currentDoc = _pending[_pendingCount];
                _currentDoc.docID = docId;
                if (_indexOptions == IndexOptions.DOCS_ONLY)
                {
                    _pendingCount++;
                }
                else if (_indexOptions == IndexOptions.DOCS_AND_FREQS)
                {
                    _pendingCount++;
                    _currentDoc.termFreq = termDocFreq;
                }
                else
                {
                    _currentDoc.termFreq = termDocFreq;
                }
            }
            else
            {
                // We've already seen too many docs for this term --
                // just forward to our fallback writer
                _wrappedPostingsWriter.StartDoc(docId, termDocFreq);
            }
        }

        public override void AddPosition(int position, BytesRef payload, int startOffset, int endOffset)
        {

            if (_pendingCount == _pending.Length)
            {
                Push();
            }

            if (_pendingCount == -1)
            {
                // We've already seen too many docs for this term --
                // just forward to our fallback writer
                _wrappedPostingsWriter.AddPosition(position, payload, startOffset, endOffset);
            }
            else
            {
                // buffer up
                Position pos = _pending[_pendingCount++];
                pos.pos = position;
                pos.startOffset = startOffset;
                pos.endOffset = endOffset;
                pos.docID = _currentDoc.docID;
                if (payload != null && payload.Length > 0)
                {
                    if (pos.payload is null)
                    {
                        pos.payload = BytesRef.DeepCopyOf(payload);
                    }
                    else
                    {
                        pos.payload.CopyBytes(payload);
                    }
                }
                else if (pos.payload != null)
                {
                    pos.payload.Length = 0;
                }
            }
        }

        public override void FinishDoc()
        {
            if (_pendingCount == -1)
            {
                _wrappedPostingsWriter.FinishDoc();
            }
        }

        private readonly RAMOutputStream _buffer = new RAMOutputStream();

        /// <summary>
        /// Called when we are done adding docs to this term.
        /// </summary>
        public override void FinishTerm(BlockTermState state)
        {
            var state2 = (PulsingTermState)state;

            if (Debugging.AssertsEnabled) Debugging.Assert(_pendingCount > 0 || _pendingCount == -1);

            if (_pendingCount == -1)
            {
                state2.wrappedState.DocFreq = state2.DocFreq;
                state2.wrappedState.TotalTermFreq = state2.TotalTermFreq;
                state2.bytes = null;
                _wrappedPostingsWriter.FinishTerm(state2.wrappedState);
            }
            else
            {
                // There were few enough total occurrences for this
                // term, so we fully inline our postings data into
                // terms dict, now:

                // TODO: it'd be better to share this encoding logic
                // in some inner codec that knows how to write a
                // single doc / single position, etc.  This way if a
                // given codec wants to store other interesting
                // stuff, it could use this pulsing codec to do so

                // LUCENENET specific - to avoid boxing, changed from CompareTo() to IndexOptionsComparer.Compare()
                if (IndexOptionsComparer.Default.Compare(_indexOptions, IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0)
                {
                    var lastDocID = 0;
                    var pendingIDX = 0;
                    var lastPayloadLength = -1;
                    var lastOffsetLength = -1;
                    while (pendingIDX < _pendingCount)
                    {
                        var doc = _pending[pendingIDX];

                        var delta = doc.docID - lastDocID;
                        lastDocID = doc.docID;

                        // if (DEBUG) System.out.println("  write doc=" + doc.docID + " freq=" + doc.termFreq);

                        if (doc.termFreq == 1)
                        {
                            _buffer.WriteVInt32((delta << 1) | 1);
                        }
                        else
                        {
                            _buffer.WriteVInt32(delta << 1);
                            _buffer.WriteVInt32(doc.termFreq);
                        }

                        var lastPos = 0;
                        var lastOffset = 0;
                        for (var posIDX = 0; posIDX < doc.termFreq; posIDX++)
                        {
                            var pos = _pending[pendingIDX++];
                            if (Debugging.AssertsEnabled) Debugging.Assert(pos.docID == doc.docID);
                            var posDelta = pos.pos - lastPos;
                            lastPos = pos.pos;

                            var payloadLength = pos.payload is null ? 0 : pos.payload.Length;
                            if (_storePayloads)
                            {
                                if (payloadLength != lastPayloadLength)
                                {
                                    _buffer.WriteVInt32((posDelta << 1) | 1);
                                    _buffer.WriteVInt32(payloadLength);
                                    lastPayloadLength = payloadLength;
                                }
                                else
                                {
                                    _buffer.WriteVInt32(posDelta << 1);
                                }
                            }
                            else
                            {
                                _buffer.WriteVInt32(posDelta);
                            }

                            // LUCENENET specific - to avoid boxing, changed from CompareTo() to IndexOptionsComparer.Compare()
                            if (IndexOptionsComparer.Default.Compare(_indexOptions, IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0)
                            {
                                //System.out.println("write=" + pos.startOffset + "," + pos.endOffset);
                                var offsetDelta = pos.startOffset - lastOffset;
                                var offsetLength = pos.endOffset - pos.startOffset;
                                if (offsetLength != lastOffsetLength)
                                {
                                    _buffer.WriteVInt32(offsetDelta << 1 | 1);
                                    _buffer.WriteVInt32(offsetLength);
                                }
                                else
                                {
                                    _buffer.WriteVInt32(offsetDelta << 1);
                                }
                                lastOffset = pos.startOffset;
                                lastOffsetLength = offsetLength;
                            }

                            if (payloadLength > 0)
                            {
                                if (Debugging.AssertsEnabled) Debugging.Assert(_storePayloads);
                                _buffer.WriteBytes(pos.payload.Bytes, 0, pos.payload.Length);
                            }
                        }
                    }
                }
                else if (_indexOptions == IndexOptions.DOCS_AND_FREQS)
                {
                    int lastDocId = 0;
                    for (int posIdx = 0; posIdx < _pendingCount; posIdx++)
                    {
                        Position doc = _pending[posIdx];
                        int delta = doc.docID - lastDocId;

                        if (Debugging.AssertsEnabled) Debugging.Assert(doc.termFreq != 0);

                        if (doc.termFreq == 1)
                        {
                            _buffer.WriteVInt32((delta << 1) | 1);
                        }
                        else
                        {
                            _buffer.WriteVInt32(delta << 1);
                            _buffer.WriteVInt32(doc.termFreq);
                        }
                        lastDocId = doc.docID;
                    }
                }
                else if (_indexOptions == IndexOptions.DOCS_ONLY)
                {
                    int lastDocId = 0;
                    for (int posIdx = 0; posIdx < _pendingCount; posIdx++)
                    {
                        Position doc = _pending[posIdx];
                        _buffer.WriteVInt32(doc.docID - lastDocId);
                        lastDocId = doc.docID;
                    }
                }

                state2.bytes = new byte[(int)_buffer.Position]; // LUCENENET specific: Renamed from getFilePointer() to match FileStream
                _buffer.WriteTo(state2.bytes, 0);
                _buffer.Reset();
            }
            _pendingCount = 0;
        }

        public override void EncodeTerm(long[] empty, DataOutput output, FieldInfo fieldInfo, BlockTermState state,
            bool abs)
        {
            var _state = (PulsingTermState)state;
            if (Debugging.AssertsEnabled) Debugging.Assert(empty.Length == 0);
            _absolute = _absolute || abs;
            if (_state.bytes is null)
            {
                _wrappedPostingsWriter.EncodeTerm(_longs, _buffer, fieldInfo, _state.wrappedState, _absolute);
                for (var i = 0; i < _longsSize; i++)
                {
                    output.WriteVInt64(_longs[i]);
                }
                _buffer.WriteTo(output);
                _buffer.Reset();
                _absolute = false;
            }
            else
            {
                output.WriteVInt32(_state.bytes.Length);
                output.WriteBytes(_state.bytes, 0, _state.bytes.Length);
                _absolute = _absolute || abs;
            }
        }

        private bool disposed = false; // LUCENENET specific
        protected override void Dispose(bool disposing)
        {
            if (disposing && !disposed)
            {
                disposed = true;
                _wrappedPostingsWriter.Dispose();
                _buffer.Dispose(); // LUCENENET specific

                if (_wrappedPostingsWriter is PulsingPostingsWriter ||
                    VERSION_CURRENT < VERSION_META_ARRAY)
                {
                    return;
                }

                var summaryFileName = IndexFileNames.SegmentFileName(_segmentState.SegmentInfo.Name,
                    _segmentState.SegmentSuffix, SUMMARY_EXTENSION);
                IndexOutput output = null;
                try
                {
                    output =
                        _segmentState.Directory.CreateOutput(summaryFileName, _segmentState.Context);
                    CodecUtil.WriteHeader(output, CODEC, VERSION_CURRENT);
                    output.WriteVInt32(_fields.Count);
                    foreach (var field in _fields)
                    {
                        output.WriteVInt32(field.FieldNumber);
                        output.WriteVInt32(field.Int64sSize);
                    }
                    output.Dispose();
                }
                finally
                {
                    IOUtils.DisposeWhileHandlingException(output);
                }
            }
        }

        /// <summary>
        /// Pushes pending positions to the wrapped codec.
        /// </summary>
        private void Push()
        {
            if (Debugging.AssertsEnabled) Debugging.Assert(_pendingCount == _pending.Length);

            _wrappedPostingsWriter.StartTerm();

            // Flush all buffered docs
            // LUCENENET specific - to avoid boxing, changed from CompareTo() to IndexOptionsComparer.Compare()
            if (IndexOptionsComparer.Default.Compare(_indexOptions, IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0)
            {
                Position doc = null;

                foreach (var pos in _pending)
                {
                    if (doc is null)
                    {
                        doc = pos;
                        _wrappedPostingsWriter.StartDoc(doc.docID, doc.termFreq);
                    }
                    else if (doc.docID != pos.docID)
                    {
                        if (Debugging.AssertsEnabled) Debugging.Assert(pos.docID > doc.docID);
                        _wrappedPostingsWriter.FinishDoc();
                        doc = pos;
                        _wrappedPostingsWriter.StartDoc(doc.docID, doc.termFreq);
                    }
                    _wrappedPostingsWriter.AddPosition(pos.pos, pos.payload, pos.startOffset, pos.endOffset);
                }
                //wrappedPostingsWriter.finishDoc();
            }
            else
            {
                foreach (var doc in _pending)
                {
                    _wrappedPostingsWriter.StartDoc(doc.docID, _indexOptions == IndexOptions.DOCS_ONLY ? 0 : doc.termFreq);
                }
            }
            _pendingCount = -1;
        }
    }
}


text:
package com.cloud.api.command;

import com.cloud.api.APICommand;
import com.cloud.api.BaseCmd;
import com.cloud.api.response.LDAPConfigResponse;
import com.cloud.api.response.LDAPRemoveResponse;
import com.cloud.ldap.LdapConfigurationVO;
import com.cloud.ldap.LdapManager;
import com.cloud.user.Account;
import com.cloud.utils.Pair;

import javax.inject.Inject;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @deprecated as of 4.3 use the new api {@link LdapDeleteConfigurationCmd}
 */
@Deprecated
@APICommand(name = "ldapRemove", description = "Remove the LDAP context for this site.", responseObject = LDAPConfigResponse.class, since = "3.0.1",
        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class LDAPRemoveCmd extends BaseCmd {
    public static final Logger s_logger = LoggerFactory.getLogger(LDAPRemoveCmd.class.getName());
    private static final String s_name = "ldapremoveresponse";
    @Inject
    private LdapManager _ldapManager;

    @Override
    public void execute() {
        final boolean result = this.removeLDAP();
        if (result) {
            final LDAPRemoveResponse lr = new LDAPRemoveResponse();
            lr.setObjectName("ldapremove");
            lr.setResponseName(getCommandName());
            this.setResponseObject(lr);
        }
    }

    private boolean removeLDAP() {
        final LdapListConfigurationCmd listConfigurationCmd = new LdapListConfigurationCmd(_ldapManager);
        final Pair<List<? extends LdapConfigurationVO>, Integer> result = _ldapManager.listConfigurations(listConfigurationCmd);
        for (final LdapConfigurationVO config : result.first()) {
            _ldapManager.deleteConfiguration(config.getHostname());
        }
        return true;
    }

    @Override
    public String getCommandName() {
        return s_name;
    }

    @Override
    public long getEntityOwnerId() {
        return Account.ACCOUNT_ID_SYSTEM;
    }
}

redpajama_set_name: RedPajamaGithub


text:
package com.github.sahasatvik.game;

import java.util.List;
import java.util.ArrayList;
import com.github.sahasatvik.game.Board;

public class BoardSequencer {

	public static <T> boolean isSequenceMatchingAny (Board<T> board, List<List<Point>> sequence, T item) {
		for (List<Point> subSequence : sequence)
			if (BoardSequencer.<T>isSequenceMatching(board, subSequence, item))
				return true;
		return false;
	}

	public static <T> boolean isSequenceMatching (Board<T> board, List<Point> sequence, T item) {
		for (Point p : sequence)
			if (board.getItemAt(p) != item)
				return false;
		return true;
	}

	public static <T> int getItemCount (Board<T> board, List<Point> sequence, T item) {
		int count = 0;
		for (Point p : sequence)
			if (board.getItemAt(p) == item)
				count++;
		return count;
	}

	public static List<List<Point>> getSequences (Board<?> b, int size) {
		List<List<Point>> sequences = new ArrayList<>();
		if (size <= b.columns) {
			for (int i = 0; i < b.rows; i++) {
				for (int j = 0; j < (b.columns - size + 1); j++) {
					List<Point> row = new ArrayList<>();
					for (int k = 0; k < size; k++) {
						row.add(new Point(i, (j + k)));
					}
					sequences.add(row);
				}
			}
		}
		if (size <= b.rows) {
			for (int i = 0; i < (b.rows - size + 1); i++) {
				for (int j = 0; j < b.columns; j++) {
					List<Point> column = new ArrayList<>();
					for (int k = 0; k < size; k++) {
						column.add(new Point((i + k), j));
					}
					sequences.add(column);
				}
			}
		}
		if ((size <= b.columns) && (size <= b.rows)) {
			for (int i = 0; i < (b.rows - size + 1); i++) {
				for (int j = 0; j < (b.columns - size + 1); j++) {
					List<Point> rightDiagonal = new ArrayList<>();
					List<Point> leftDiagonal = new ArrayList<>();
					for (int k = 0; k < size; k++) {
						rightDiagonal.add(new Point((i + k), (j + k)));
						leftDiagonal.add(new Point((i + k), (j + (size - k - 1))));
					}
					sequences.add(rightDiagonal);
					sequences.add(leftDiagonal);

				}
			}
		}
		return sequences;
	}

}


text:
// $Id: VocabTranslator.java 48 2006-07-12 16:15:40Z caron $

package thredds.catalog.dl;

/**
 * @author john
 */
public interface VocabTranslator {
  public String translate(String from);
}


text:
package org.cuacfm.members.model.eventservice;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Locale;

import org.cuacfm.members.model.account.Account;
import org.cuacfm.members.model.account.AccountDTO;
import org.cuacfm.members.model.accountservice.AccountService;
import org.cuacfm.members.model.event.Event;
import org.cuacfm.members.model.event.EventDTO;
import org.cuacfm.members.model.event.EventRepository;
import org.cuacfm.members.model.util.Constants.levels;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;

/**
 * The Class EventServiceImpl.
 */
@Service("eventService")
public class EventServiceImpl implements EventService {

	@Autowired
	private MessageSource messageSource;

	@Autowired
	private EventRepository eventRepository;

	@Autowired
	private AccountService accountService;

	@Override
	public Event save(Event event) {
		return eventRepository.save(event);
	}

	@Override
	public String save(String message, Account account, levels priority, Object[] arguments) {
		String messageI18n = messageSource.getMessage(message, arguments, Locale.getDefault());

		// Si es nula se asume que es el administrador
		if (account == null) {
			Authentication auth = SecurityContextHolder.getContext().getAuthentication();
			if (auth != null) {
				account = accountService.findByLogin(auth.getName());
			}
		}
		// If account is null, it is not save message
		if (account != null) {
			eventRepository.save(new Event(account, new Date(), priority.getValue(), messageI18n));
		}

		return messageI18n;
	}

	@Override
	public String save(String message, Account account, levels priority) {
		Authentication auth = SecurityContextHolder.getContext().getAuthentication();
		String adminName = null;
		if (auth != null) {
			adminName = auth.getName();
		}
		Object[] arguments = { adminName, account.getName() + " " + account.getSurname() };
		return save(message, account, priority, arguments);
	}

	@Override
	public Event findById(Long id) {
		return eventRepository.findById(id);
	}

	@Override
	public List<Event> findAllByAccountId(Long accountId) {
		return eventRepository.findAllByAccountId(accountId);
	}

	@Override
	public List<Event> findAll() {
		return eventRepository.findAll();
	}

	@Override
	public List<Event> findAllOpen() {
		return eventRepository.findAllOpen();
	}

	@Override
	public List<Event> findAllClose() {
		return eventRepository.findAllClose();
	}

	@Override
	public Event highlight(Event event, int priority) {
		event.setPriority(priority);
		return eventRepository.update(event);
	}

	@Override
	public EventDTO getDTO(Event event) {
		AccountDTO accountDTO = accountService.getAccountDTO(accountService.findById(event.getAccount().getId()));
		return new EventDTO(event.getId(), accountDTO, event.getDateEvent(), event.getPriority(), event.getDescription());
	}

	@Override
	public List<EventDTO> getDTOs(List<Event> events) {
		List<EventDTO> eventsDTO = new ArrayList<>();
		for (Event event : events) {
			eventsDTO.add(getDTO(event));
		}
		return eventsDTO;
	}
}


text:
.ezmaster-applications {
  min-height: 500px;
}

/* to remove horizontal scrollbars on the big table list */
.ezmaster-applications .row {
  margin-right: 0px;
  margin-left: 0px;
}
.ezmaster-applications .col {
  padding-right: 0px;
  padding-left: 0px;
}

.ezmaster-applications-table {
  color: #616161;
  margin-top: 10px;
}

.ezmaster-applications-add {
  font-size: 1.2rem;
}
.ezmaster-applications-add.justify-content-md-center {
  margin-top: 50px;
}

.ezmaster-applications-add-top {
  margin-top: 10px;
  margin-bottom: 0px;
}

table.ezmaster-applications-table td,
table.ezmaster-applications-table th {
  padding: 0.4rem;
}
table.ezmaster-applications-table th {
  border-top: 0px;
}

/* Responsive table,
   see https://bootsnipp.com/snippets/featured/no-more-tables-respsonsive-table */
@media only screen and (max-width: 800px) {
  /* Force table to not be like tables anymore */
  .ezmaster-applications-table table,
  .ezmaster-applications-table thead,
  .ezmaster-applications-table tbody,
  .ezmaster-applications-table th,
  .ezmaster-applications-table td,
  .ezmaster-applications-table tr {
    display: block;
  }

  /* Hide table headers (but not display: none;, for accessibility) */
  .ezmaster-applications-table thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }

  .ezmaster-applications-table tr {
    border: 1px solid #ccc;
  }

  .ezmaster-applications-table td {
    /* Behave  like a "row" */
    border: none;
    border-bottom: 1px solid #eee;
    position: relative;
    white-space: normal;
    text-align: left;
  }
}


text:
<!DOCTYPE html>

	<meta charset="utf-8"/>
	<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
	<meta http-equiv="X-UA-Compatible" content="IE=edge"/>

	<title>OpenSurfaces - A Richly Annotated Catalog of Surface Appearance</title>
	<meta name="description" content='OpenSurfaces is a large database of annotated surfaces created from real-world consumer photographs. Our annotation framework draws on crowdsourcing to segment surfaces from photos, and then annotate them with rich surface properties, including material, texture and contextual information.'/>
	<meta name="author" content="Cornell University"/>

	<link href="/static/css/opensurfaces-segmentation-ui.css" rel="stylesheet" type="text/css" />

					Instructions: carefully trace around regions that have a single material or texture.
					Draw six polygons to complete the task.

					<button type="button" id='btn-submit' class="btn btn-primary" disabled="disabled">Submit</button>

					<button id='btn-draw' type="button" class="btn" disabled="disabled">
						 Draw (D)</button>
					<button id='btn-edit' type="button" class="btn" disabled="disabled">
						 Adjust (A)</button>

					<button id='btn-undo' type="button" disabled="disabled" class="btn">
						 Undo (Ctrl-Z)</button>
					<button id='btn-redo' type="button" disabled="disabled" class="btn">
						 Redo (Ctrl-Y)</button>

					<button id='btn-close' type="button" disabled="disabled" class="btn">
						 Close (Right-click)</button>
					<button id='btn-delete' type="button" disabled="disabled" class="btn">
						 Delete (Delete)</button>

					<button id='btn-zoom-reset' type="button" disabled="disabled" class="btn">
						 Reset Zoom (Esc)</button>

					Instructions

			<button type="button" class="close" data-dismiss="modal"
				aria-hidden="true">×</button>

Instructions

What to draw

Please draw shapes around regions that have a
				single material or texture.  Some example materials: wood, steel,
				bricks, tiles, ceramic, plastic.  If you don't know what to draw, floors,
				walls, and countertops are usually one material -- just be careful to exclude
				things on top.

Please make the region as tight as possible.  Your shape should exactly
					follow the material boundary.  Use the "adjust" button (or
				press 'A') to improve the shape boundary.

If there is something like a brick wall or tiled floor, please include all
				the tiles; do not draw a square around one tile.  Large regions are
				preferable.

Example: if a wood cabinet has a metal handle, then the metal portion is a
				different material and should be excluded.  If you are drawing a shape around a
				person, their skin and clothing should not be in two different shapes.  You can
				also exclude regions by overlapping shapes.  See the below examples.

Draw six polygons to complete
				the task.

Good examples

Large flat regions are preferable, though not necessary.

Make the boundary as tight as possible.

Be careful to not include items of a different material.

Shapes can be nested.

Shapes can intersect.

Please do not draw around individual bricks; draw a shape around larger wall portions.

Bad examples

We will reject HITs that do not follow these instructions.

These are sloppy shapes.

Please do not do this.

Please make the regions bigger than this.

These shapes contain multiple materials and are nowhere near the correct boundaries.

This shape includes more than one type of material.

This includes other objects; the other objects should have shapes around them.

This includes the edges of other objects.

This shape is too sloppy.

This contains more than one type of material.

This contains many substances.

How to draw

								1 Click on the material boundary.

								2 Continue clicking along the boundary.

								3 Right-click to close the polygon.

To close the shape, you do not need to click near the first point. You can
				right-click to connect the first and last point.

Adjust your shapes

After drawing a polygon, please adjust its edges so that it better fits the true boundary.
				When you are done adjusting, switch back to "Draw" mode to draw more polygons.

You can press the D and A key to quickly switch modes.

								1 Switch to "Adjust" mode.

								2 Click on the polygon.

								3 Drag the small white circles.

Zoom in to see better

Scroll with the mouse wheel to zoom in.  Click "Reset Zoom" or press escape to reset back to normal.

Move around in the image

Press 'space' and drag with the mouse to move around in the image (panning).  You can also move press the arrow keys to move.

Other controls

Undo

If you make a mistake, click "Undo" or press Ctrl-Z.

Redo

You can also re-do an action with Ctrl-Y.

Close

To close a polygon, right-click on the image or you can click the "Close" button.

Delete

You can delete polygons by selecting them with the "Adjust" button and pressing delete.

Reset Zoom

When zoomed in, you you can click "Reset Zoom" to zoom out again.

Instructions

Show this page during the task.

Mirrors and windows

If there is a mirror, draw a shape around the mirror surface itself, not the
				things that you can see in the reflection.  Similarly, draw a shape around the
				window glass, and not the things you can see through the window.

Why are we doing this?

We are building a database of materials from images on the web.  This is part of ongoing research at Cornell University.

Thank you for participating!

			<button class="btn btn-primary" data-dismiss="modal" aria-hidden="true">Close</button>

Please Wait

			<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>

Error!

			<button class="btn btn-primary" data-dismiss="modal" aria-hidden="true">OK</button>

			<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>

Are you sure?

			<button class="btn" data-dismiss="modal" aria-hidden="true" id="modal-areyousure-no">No</button>
			<button class="btn btn-primary" data-dismiss="modal" aria-hidden="true" id="modal-areyousure-yes">Yes</button>

			<button type="button" class="close" data-dismiss="modal"
				aria-hidden="true">×</button>

Feedback

			<form id='modal-feedback-form' class='form-horizontal'>

					What did you think of this task?

						<textarea id="feedback-thoughts" rows="6"></textarea>

					What parts didn't you understand?

						<textarea id="feedback-understand" rows="6"></textarea>

					Any other feedback, improvements, or suggestions?

						<textarea id="feedback-other" rows="6"></textarea>

			</form>

			<button class="btn" data-dismiss="modal" aria-hidden="true" id="modal-feedback-cancel">Cancel</button>
			<button class="btn btn-primary" data-dismiss="modal" aria-hidden="true" id="modal-feedback-submit">Submit</button>

			<button type="button" class="close" data-dismiss="modal"
				aria-hidden="true">×</button>

Not a valid polygon!

Polygons must contain at least
			four
			points and cannot intersect themselves.  Try adding more points so
			that the first and last point can connect.

This polygon cannot close.

This edge cannot be added.

This polygon can be closed.

			<button class="btn btn-primary" data-dismiss="modal" aria-hidden="true">OK</button>

</html


text:
enzyme was originally designed to work with Mocha, so getting it up and running with Mocha should
be no problem at all. Simply install it and start using it:

```bash
npm i --save-dev enzyme
```

```jsx
import React from 'react';
import { expect } from 'chai';
import { mount } from 'enzyme';
import { spy } from 'sinon';
import Foo from './src/Foo';

spy(Foo.prototype, 'componentDidMount');

describe('<Foo />', () => {
  it('calls componentDidMount', () => {
    const wrapper = mount(<Foo />);
    expect(Foo.prototype.componentDidMount).to.have.property('callCount', 1);
  });
});

```


text:
package org.avaje.metric;

import java.util.Map;

/**
 * A TimedMetric for measuring execution time for methods and events.
 */
public interface TimedMetric extends Metric {

  /**
   * Start an event.
   *

   * At the completion of the event one of {@link TimedEvent#endWithSuccess()},
   * {@link TimedEvent#endWithError()} or {@link TimedEvent#end(boolean)} is called to record the
   * event duration and success or otherwise.
   *

   * This is an alternative to using {@link #addEventSince(boolean, long)} or
   * {@link #addEventDuration(boolean, long)}. Note that this startEvent() method has slightly
   * higher overhead as it instantiates a TimedEvent object which must be later GC'ed. In this sense
   * generally addEventSince() is the preferred method to use.
   */
  TimedEvent startEvent();

  /**
   * Add an event based on a startNanos (determined by {@link System#nanoTime()}).
   *

   * Success and failure statistics are kept separately.
   *

   * This is an alternative to using {@link #startEvent()}. Note that using startEvent() has
   * slightly higher overhead as it instantiates a TimedEvent object which must be later GC'ed. In
   * this sense generally addEventSince() is the preferred method to use.
   */
  void addEventSince(boolean success, long startNanos);

  /**
   * Add an event duration in nanoseconds noting if it was a success or failure result.
   *

   * Success and failure statistics are kept separately.
   *

   * This is an alternative to using {@link #addEventSince(boolean, long)} where you pass in the
   * duration rather than the start nanoseconds.
   */
  void addEventDuration(boolean success, long durationNanos);

  /**
   * Return true if this timed metric is part of a bucket range (and hence only hold statistics for the
   * bucket range returned by bucketRange().
   */
  boolean isBucket();

  /**
   * Return the bucket range or empty string if not a bucket.
   */
  String getBucketRange();

  /**
   * Add an event duration with opCode indicating success or failure. This is intended for use by
   * enhanced code and not general use.
   *

   * Although this looks redundant and a little ugly having this method means that for enhancement
   * the added byte code is minimised. In the case where metric collection is turned off overhead is
   * limited to a System.nanoTime() call and a noop method call.
   */
  void operationEnd(int opCode, long startNanos, boolean activeThreadContext);

  /**
   * Add an event duration with opCode indicating success or failure. This is intended for use by
   * enhanced code and not general use.
   */
  void operationEnd(int opCode, long startNanos);

  /**
   * Return true if this TimedMetric has been pushed onto an active context for this thread.
   *

   * This means that the current thread is actively collecting timing entries and this metric
   * has been pushed onto the nested context.
   *

   */
  boolean isActiveThreadContext();

  /**
   * Specify to collect per request detailed timing collection. The collectionCount is the number
   * of requests to collect detailed timing for and then automatically turn off.
   *

   * This is expected to only be explicitly called on 'top level' metrics such as web endpoints.
   * Once a request timing context has been created by the top level metric then 'nested metrics'
   * (typically service and data access layers) can append to that existing context.  In this way
   * detailed per request level timing entries can be collected for only selected endpoints.
   *

   */
  void setRequestTimingCollection(int collectionCount);

  /**
   * Return the number of remaining requests to collect detailed timing on.
   *

   * This value starts out as the value set by #setRequestTimingCollection and then decrements
   * after a request timing is reported until it reaches 0 at which point request timing automatically
   * turns off for this metric.
   *

   */
  int getRequestTimingCollection();

  /**
   * Decrement the request timing collection count.
   *

   * This is typically called internally when a request timing is reported and generally not
   * expected to be called by application code.
   */
  void decrementCollectionCount();

  /**
   * Return extra attributes that can be included in the request logging.
   */
  Map<String, String> attributes();
}


text:
"""Copyright 2019 Google LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""

import tensorflow as tf
import numpy as np
import PIL.Image
import os
from multiprocessing import dummy as multiprocessing
import saliency

ROW_MIN = 0
COL_MIN = 1
ROW_MAX = 2
COL_MAX = 3

# Same as in https://github.com/tensorflow/models/blob/master/official/resnet/imagenet_preprocessing.py
_R_MEAN = 123.68
_G_MEAN = 116.78
_B_MEAN = 103.94
_CHANNEL_MEANS = [_R_MEAN, _G_MEAN, _B_MEAN]

SAL_DIR = 'sal_scratch'
ATTR_DIR = 'attr_scratch'
RESNET_SHAPE = (224, 224)
IMG_SHAPE = (128, 128)

def load_imgs(fnames, num_threads=1, shape=RESNET_SHAPE):
  """Load and preprocess images for ResNet by subtracting means."""

  def load_img(f):
    img = PIL.Image.open(tf.gfile.Open(f, 'rb'))
    img = img.convert('RGB').resize(shape, PIL.Image.BILINEAR)
    channel_means = np.expand_dims(np.expand_dims(_CHANNEL_MEANS, 0), 0)
    img_arr = np.array(img, dtype=np.float32) - channel_means.astype(np.float32)
    return img_arr

  pool = multiprocessing.Pool(num_threads)
  return pool.map(load_img, fnames)

def visualize_pos_attr(image_3d, percentile=99):
  """Returns a 3D tensor as a grayscale 2D tensor by summing the positive attributions of a 3D tensor across axis=2, and then clips values at a given percentile."""

  image_2d = np.sum(image_3d.clip(min=0), axis=2)
  vmax = np.percentile(image_2d, percentile)
  vmin = np.min(image_2d)
  return np.clip((image_2d - vmin) / (vmax - vmin), 0, 1)

def single_attr(map_2d, loc, obj_mask):
  """Given a 2D saliency map, the location of an object, and the binary mask of that object, compute the attribution of the object by averaging over its pixel-wise attributions."""

  obj_mask_resized = np.array(
      PIL.Image.fromarray(obj_mask).resize(
          (loc[COL_MAX] - loc[COL_MIN], loc[ROW_MAX] - loc[ROW_MIN]),
          PIL.Image.BILINEAR))
  avg = np.sum(
      map_2d[:, loc[ROW_MIN]:loc[ROW_MAX], loc[COL_MIN]:loc[COL_MAX]] *
      obj_mask_resized,
      axis=(-1, -2)) / np.count_nonzero(obj_mask_resized)
  return avg

def compute_and_save_attr(model, data, indices, num_threads):
  """Given the name of a model and a set of data, select a set of images based on provided indices, and compute and save their saliency maps and object attributions."""

  base_dir = os.getcwd()
  data_dir = os.path.join(base_dir, 'data', data, 'val')
  model_dir = os.path.join(base_dir, 'models', model)
  sal_output_dir = os.path.join(base_dir, SAL_DIR, model + '-' + data)
  attr_output_dir = os.path.join(base_dir, ATTR_DIR, model + '-' + data)
  if not tf.gfile.Exists(sal_output_dir):
    tf.gfile.MakeDirs(sal_output_dir)
  if not tf.gfile.Exists(attr_output_dir):
    tf.gfile.MakeDirs(attr_output_dir)

  img_names = [sorted(tf.gfile.ListDirectory(data_dir))[i] for i in indices]
  img_paths = [os.path.join(data_dir, img_name) for img_name in img_names]
  imgs = load_imgs(img_paths, num_threads)

  input_name = 'input_tensor:0'
  logit_name = 'resnet_model/final_dense:0'
  conv_name = 'resnet_model/block_layer4:0'

  with tf.Session(graph=tf.Graph()) as sess:
    tf.saved_model.loader.load(sess, ['serve'], model_dir)
    graph = tf.get_default_graph()
    input_tensor = graph.get_tensor_by_name(input_name)
    logit_tensor = graph.get_tensor_by_name(logit_name)
    neuron_selector = tf.placeholder(tf.int32)
    y = logit_tensor[:, neuron_selector]
    pred_tensor = tf.argmax(logit_tensor, 1)

    vg = saliency.GradientSaliency(graph, sess, y, input_tensor)
    gb = saliency.GuidedBackprop(graph, sess, y, input_tensor)
    ig = saliency.IntegratedGradients(graph, sess, y, input_tensor)
    gc = saliency.GradCam(graph, sess, y, input_tensor,
                          graph.get_tensor_by_name(conv_name))

    def single_map(img, img_name):
      pred = sess.run(pred_tensor, feed_dict={input_tensor: [img]})[0]
      vg_mask = vg.GetMask(img, feed_dict={neuron_selector: pred})
      # *s is SmoothGrad
      vgs_mask = vg.GetSmoothedMask(
          img, feed_dict={neuron_selector: pred})
      gb_mask = gb.GetMask(img, feed_dict={neuron_selector: pred})
      gbs_mask = gb.GetSmoothedMask(
          img, feed_dict={neuron_selector: pred})
      baseline = np.zeros(img.shape) - np.expand_dims(
          np.expand_dims(_CHANNEL_MEANS, 0), 0)
      ig_mask = ig.GetMask(
          img, feed_dict={neuron_selector: pred}, x_baseline=baseline)
      igs_mask = ig.GetSmoothedMask(
          img,
          feed_dict={neuron_selector: pred},
          x_baseline=baseline)
      gc_mask = gc.GetMask(img, feed_dict={neuron_selector: pred})
      gcs_mask = gc.GetSmoothedMask(
          img, feed_dict={neuron_selector: pred})
      # gbgc is guided GradCam
      gbgc_mask = gb_mask * gc_mask
      gbgcs_mask = gbs_mask * gcs_mask
      # Also include gradient x input
      masks = np.array([
          vg_mask, vgs_mask, gb_mask, gbs_mask, ig_mask, igs_mask, gc_mask,
          gcs_mask, gbgc_mask, gbgcs_mask, vg_mask * img, vgs_mask * img
      ])
      return masks, pred

    sal_maps = []
    preds = []
    for img, img_name in zip(imgs, img_names):
      sal_path = tf.gfile.Glob(
          os.path.join(sal_output_dir, img_name[:-4] + '*'))
      if len(sal_path) > 0:
        sal_maps.append(np.load(tf.gfile.GFile(sal_path[0], 'rb')))
        preds.append(sal_path[0].split('_')[-1])
        tf.logging.info('Loaded saliency maps for {}.'.format(img_name))
      else:
        masks, pred = single_map(img, img_name)
        sal_maps.append(masks)
        preds.append(pred)
        out_path = os.path.join(sal_output_dir, img_name[:-4] + '_' + str(pred))
        np.save(tf.gfile.GFile(out_path, 'w'), masks)
        tf.logging.info('Saved saliency maps for {}.'.format(img_name))

  # Locate the objects, convert 3D saliency maps to 2D, and compute
  # the attributions of the object segments by averaging over the
  # per-pixel attributions of the objects.
  loc_fpath = os.path.join(base_dir, 'data', data, 'val_loc.txt')
  lines = [tf.gfile.Open(loc_fpath).readlines()[i] for i in indices]
  locs = np.array([[
      int(int(l) * float(RESNET_SHAPE[0]) / IMG_SHAPE[0])
      for l in line.rstrip('\n').split(' ')[-1].split(',')
  ]
                   for line in lines])
  pool = multiprocessing.Pool(num_threads)
  maps_3d = np.array(sal_maps).reshape(-1, RESNET_SHAPE[0], RESNET_SHAPE[1], 3)
  maps_2d = np.array(pool.map(visualize_pos_attr, maps_3d))
  maps_2d = maps_2d.reshape(
      len(indices), int(maps_2d.shape[0] // len(indices)), RESNET_SHAPE[0],
      RESNET_SHAPE[1])
  mask_fpath = os.path.join(base_dir, 'data', data, 'val_mask')

  if data in ['obj', 'scene', 'scene_only']:
    # MCS and IDR are evaluated on 10000 images and masks are 10x100.
    # Find the right mask.
    obj_dict = {'backpack': 0,
                'bird': 1,
                'dog': 2,
                'elephant': 3,
                'kite': 4,
                'pizza': 5,
                'stop_sign': 6,
                'toilet': 7,
                'truck': 8,
                'zebra': 9,
    }

    # Loading val_mask from the data directory
    masks_mat = np.load(tf.gfile.GFile(mask_fpath, 'rb'), allow_pickle=True)
    # Getting obj indices
    obj_inds = [obj_dict[i.split('.')[0].split('-')[0]] for i in img_names]
    # getting indices for a particular object class
    temp_inds = [int(i.split('.')[0][-2:]) for i in img_names]

    obj_masks = [masks_mat[obj_inds[i]*100 + temp_inds[i]]
                 for i, _ in enumerate(img_names)]

  else:
    obj_masks = [
      np.load(tf.gfile.GFile(mask_fpath, 'rb'), allow_pickle=True)[i]
      for i in indices
    ]

  attrs = []
  for i in range(len(indices)):
    attr = single_attr(maps_2d[i], locs[i], obj_masks[i])
    attrs.append(attr)
    out_path = os.path.join(attr_output_dir,
                            img_names[i][:-4] + '_' + str(preds[i]))
    np.save(tf.gfile.GFile(out_path, 'w'), attr)


text:
<?php

declare(strict_types=1);

namespace StructType;

use InvalidArgumentException;
use WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for XrmActivityStreamType StructType
 * @package Ews
 * @subpackage Structs
 * @author WsdlToPhp <contact@wsdltophp.com>
 */
class EwsXrmActivityStreamType extends AbstractStructBase
{
    /**
     * The Id
     * Meta information extracted from the WSDL
     * - maxOccurs: 1
     * - minOccurs: 0
     * @var string|null
     */
    protected ?string $Id = null;
    /**
     * The ClientSessionId
     * Meta information extracted from the WSDL
     * - maxOccurs: 1
     * - minOccurs: 0
     * @var string|null
     */
    protected ?string $ClientSessionId = null;
    /**
     * The EventTime
     * Meta information extracted from the WSDL
     * - maxOccurs: 1
     * - minOccurs: 0
     * @var string|null
     */
    protected ?string $EventTime = null;
    /**
     * The SourceUser
     * Meta information extracted from the WSDL
     * - maxOccurs: 1
     * - minOccurs: 0
     * @var string|null
     */
    protected ?string $SourceUser = null;
    /**
     * The ActionVerb
     * Meta information extracted from the WSDL
     * - maxOccurs: 1
     * - minOccurs: 0
     * @var string|null
     */
    protected ?string $ActionVerb = null;
    /**
     * The Subtype
     * Meta information extracted from the WSDL
     * - maxOccurs: 1
     * - minOccurs: 0
     * @var string|null
     */
    protected ?string $Subtype = null;
    /**
     * The TargetEntities
     * Meta information extracted from the WSDL
     * - maxOccurs: 1
     * - minOccurs: 0
     * @var \ArrayType\EwsArrayOfStringsType|null
     */
    protected ?\ArrayType\EwsArrayOfStringsType $TargetEntities = null;
    /**
     * The OtherRelatedEntities
     * Meta information extracted from the WSDL
     * - maxOccurs: 1
     * - minOccurs: 0
     * @var \ArrayType\EwsArrayOfStringsType|null
     */
    protected ?\ArrayType\EwsArrayOfStringsType $OtherRelatedEntities = null;
    /**
     * The Flags
     * Meta information extracted from the WSDL
     * - maxOccurs: 1
     * - minOccurs: 0
     * @var string|null
     */
    protected ?string $Flags = null;
    /**
     * The ModifiedProperties
     * Meta information extracted from the WSDL
     * - maxOccurs: 1
     * - minOccurs: 0
     * @var string|null
     */
    protected ?string $ModifiedProperties = null;
    /**
     * The AdditionalActivityDetails
     * Meta information extracted from the WSDL
     * - maxOccurs: 1
     * - minOccurs: 0
     * @var string|null
     */
    protected ?string $AdditionalActivityDetails = null;
    /**
     * Constructor method for XrmActivityStreamType
     * @uses EwsXrmActivityStreamType::setId()
     * @uses EwsXrmActivityStreamType::setClientSessionId()
     * @uses EwsXrmActivityStreamType::setEventTime()
     * @uses EwsXrmActivityStreamType::setSourceUser()
     * @uses EwsXrmActivityStreamType::setActionVerb()
     * @uses EwsXrmActivityStreamType::setSubtype()
     * @uses EwsXrmActivityStreamType::setTargetEntities()
     * @uses EwsXrmActivityStreamType::setOtherRelatedEntities()
     * @uses EwsXrmActivityStreamType::setFlags()
     * @uses EwsXrmActivityStreamType::setModifiedProperties()
     * @uses EwsXrmActivityStreamType::setAdditionalActivityDetails()
     * @param string $id
     * @param string $clientSessionId
     * @param string $eventTime
     * @param string $sourceUser
     * @param string $actionVerb
     * @param string $subtype
     * @param \ArrayType\EwsArrayOfStringsType $targetEntities
     * @param \ArrayType\EwsArrayOfStringsType $otherRelatedEntities
     * @param string $flags
     * @param string $modifiedProperties
     * @param string $additionalActivityDetails
     */
    public function __construct(?string $id = null, ?string $clientSessionId = null, ?string $eventTime = null, ?string $sourceUser = null, ?string $actionVerb = null, ?string $subtype = null, ?\ArrayType\EwsArrayOfStringsType $targetEntities = null, ?\ArrayType\EwsArrayOfStringsType $otherRelatedEntities = null, ?string $flags = null, ?string $modifiedProperties = null, ?string $additionalActivityDetails = null)
    {
        $this
            ->setId($id)
            ->setClientSessionId($clientSessionId)
            ->setEventTime($eventTime)
            ->setSourceUser($sourceUser)
            ->setActionVerb($actionVerb)
            ->setSubtype($subtype)
            ->setTargetEntities($targetEntities)
            ->setOtherRelatedEntities($otherRelatedEntities)
            ->setFlags($flags)
            ->setModifiedProperties($modifiedProperties)
            ->setAdditionalActivityDetails($additionalActivityDetails);
    }
    /**
     * Get Id value
     * @return string|null
     */
    public function getId(): ?string
    {
        return $this->Id;
    }
    /**
     * Set Id value
     * @param string $id
     * @return \StructType\EwsXrmActivityStreamType
     */
    public function setId(?string $id = null): self
    {
        // validation for constraint: string
        if (!is_null($id) && !is_string($id)) {
            throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($id, true), gettype($id)), __LINE__);
        }
        $this->Id = $id;

        return $this;
    }
    /**
     * Get ClientSessionId value
     * @return string|null
     */
    public function getClientSessionId(): ?string
    {
        return $this->ClientSessionId;
    }
    /**
     * Set ClientSessionId value
     * @param string $clientSessionId
     * @return \StructType\EwsXrmActivityStreamType
     */
    public function setClientSessionId(?string $clientSessionId = null): self
    {
        // validation for constraint: string
        if (!is_null($clientSessionId) && !is_string($clientSessionId)) {
            throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($clientSessionId, true), gettype($clientSessionId)), __LINE__);
        }
        $this->ClientSessionId = $clientSessionId;

        return $this;
    }
    /**
     * Get EventTime value
     * @return string|null
     */
    public function getEventTime(): ?string
    {
        return $this->EventTime;
    }
    /**
     * Set EventTime value
     * @param string $eventTime
     * @return \StructType\EwsXrmActivityStreamType
     */
    public function setEventTime(?string $eventTime = null): self
    {
        // validation for constraint: string
        if (!is_null($eventTime) && !is_string($eventTime)) {
            throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($eventTime, true), gettype($eventTime)), __LINE__);
        }
        $this->EventTime = $eventTime;

        return $this;
    }
    /**
     * Get SourceUser value
     * @return string|null
     */
    public function getSourceUser(): ?string
    {
        return $this->SourceUser;
    }
    /**
     * Set SourceUser value
     * @param string $sourceUser
     * @return \StructType\EwsXrmActivityStreamType
     */
    public function setSourceUser(?string $sourceUser = null): self
    {
        // validation for constraint: string
        if (!is_null($sourceUser) && !is_string($sourceUser)) {
            throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($sourceUser, true), gettype($sourceUser)), __LINE__);
        }
        $this->SourceUser = $sourceUser;

        return $this;
    }
    /**
     * Get ActionVerb value
     * @return string|null
     */
    public function getActionVerb(): ?string
    {
        return $this->ActionVerb;
    }
    /**
     * Set ActionVerb value
     * @param string $actionVerb
     * @return \StructType\EwsXrmActivityStreamType
     */
    public function setActionVerb(?string $actionVerb = null): self
    {
        // validation for constraint: string
        if (!is_null($actionVerb) && !is_string($actionVerb)) {
            throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($actionVerb, true), gettype($actionVerb)), __LINE__);
        }
        $this->ActionVerb = $actionVerb;

        return $this;
    }
    /**
     * Get Subtype value
     * @return string|null
     */
    public function getSubtype(): ?string
    {
        return $this->Subtype;
    }
    /**
     * Set Subtype value
     * @param string $subtype
     * @return \StructType\EwsXrmActivityStreamType
     */
    public function setSubtype(?string $subtype = null): self
    {
        // validation for constraint: string
        if (!is_null($subtype) && !is_string($subtype)) {
            throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($subtype, true), gettype($subtype)), __LINE__);
        }
        $this->Subtype = $subtype;

        return $this;
    }
    /**
     * Get TargetEntities value
     * @return \ArrayType\EwsArrayOfStringsType|null
     */
    public function getTargetEntities(): ?\ArrayType\EwsArrayOfStringsType
    {
        return $this->TargetEntities;
    }
    /**
     * Set TargetEntities value
     * @param \ArrayType\EwsArrayOfStringsType $targetEntities
     * @return \StructType\EwsXrmActivityStreamType
     */
    public function setTargetEntities(?\ArrayType\EwsArrayOfStringsType $targetEntities = null): self
    {
        $this->TargetEntities = $targetEntities;

        return $this;
    }
    /**
     * Get OtherRelatedEntities value
     * @return \ArrayType\EwsArrayOfStringsType|null
     */
    public function getOtherRelatedEntities(): ?\ArrayType\EwsArrayOfStringsType
    {
        return $this->OtherRelatedEntities;
    }
    /**
     * Set OtherRelatedEntities value
     * @param \ArrayType\EwsArrayOfStringsType $otherRelatedEntities
     * @return \StructType\EwsXrmActivityStreamType
     */
    public function setOtherRelatedEntities(?\ArrayType\EwsArrayOfStringsType $otherRelatedEntities = null): self
    {
        $this->OtherRelatedEntities = $otherRelatedEntities;

        return $this;
    }
    /**
     * Get Flags value
     * @return string|null
     */
    public function getFlags(): ?string
    {
        return $this->Flags;
    }
    /**
     * Set Flags value
     * @uses \EnumType\EwsXrmActivityStreamFlagsType::valueIsValid()
     * @uses \EnumType\EwsXrmActivityStreamFlagsType::getValidValues()
     * @throws InvalidArgumentException
     * @param string $flags
     * @return \StructType\EwsXrmActivityStreamType
     */
    public function setFlags(?string $flags = null): self
    {
        // validation for constraint: enumeration
        if (!\EnumType\EwsXrmActivityStreamFlagsType::valueIsValid($flags)) {
            throw new InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \EnumType\EwsXrmActivityStreamFlagsType', is_array($flags) ? implode(', ', $flags) : var_export($flags, true), implode(', ', \EnumType\EwsXrmActivityStreamFlagsType::getValidValues())), __LINE__);
        }
        $this->Flags = $flags;

        return $this;
    }
    /**
     * Get ModifiedProperties value
     * @return string|null
     */
    public function getModifiedProperties(): ?string
    {
        return $this->ModifiedProperties;
    }
    /**
     * Set ModifiedProperties value
     * @param string $modifiedProperties
     * @return \StructType\EwsXrmActivityStreamType
     */
    public function setModifiedProperties(?string $modifiedProperties = null): self
    {
        // validation for constraint: string
        if (!is_null($modifiedProperties) && !is_string($modifiedProperties)) {
            throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($modifiedProperties, true), gettype($modifiedProperties)), __LINE__);
        }
        $this->ModifiedProperties = $modifiedProperties;

        return $this;
    }
    /**
     * Get AdditionalActivityDetails value
     * @return string|null
     */
    public function getAdditionalActivityDetails(): ?string
    {
        return $this->AdditionalActivityDetails;
    }
    /**
     * Set AdditionalActivityDetails value
     * @param string $additionalActivityDetails
     * @return \StructType\EwsXrmActivityStreamType
     */
    public function setAdditionalActivityDetails(?string $additionalActivityDetails = null): self
    {
        // validation for constraint: string
        if (!is_null($additionalActivityDetails) && !is_string($additionalActivityDetails)) {
            throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($additionalActivityDetails, true), gettype($additionalActivityDetails)), __LINE__);
        }
        $this->AdditionalActivityDetails = $additionalActivityDetails;

        return $this;
    }
}


text:
import logging, os
logging.basicConfig(level=logging.INFO)

from deepy.dataset import MnistDataset, MiniBatches
from deepy.networks import NeuralClassifier
from deepy.layers import Convolution, Dense, Flatten, DimShuffle, Reshape, RevealDimension, Softmax, Dropout
from deepy.trainers import MomentumTrainer, LearningRateAnnealer

default_model = os.path.join(os.path.dirname(__file__), "models", "deep_conv.gz")

if __name__ == '__main__':
    model = NeuralClassifier(input_dim=28*28)
    model.stack(# Reshape to 3D tensor
                Reshape((-1, 28, 28)),
                # Add a new dimension for convolution
                DimShuffle((0, 'x', 1, 2)),
                Convolution((4, 1, 5, 5), activation="relu"),
                Dropout(0.15),
                Convolution((8, 4, 5, 5), activation="relu"),
                Dropout(0.1),
                Convolution((16, 8, 3, 3), activation="relu"),
                Flatten(),
                Dropout(0.1),
                # As dimension information was lost, reveal it to the pipe line
                RevealDimension(16),
                Dense(10, 'linear'),
                Softmax())

    trainer = MomentumTrainer(model)

    annealer = LearningRateAnnealer(trainer)

    mnist = MiniBatches(MnistDataset(), batch_size=20)

    trainer.run(mnist, controllers=[annealer])

    model.save_params(default_model)


text:
'use strict';

/*!
 * grunt-monic
 * https://github.com/MonicBuilder/grunt-monic
 *
 * Released under the MIT license
 * https://github.com/MonicBuilder/grunt-monic/blob/master/LICENSE
 */

const
	monic = require('monic'),
	async = require('async');

module.exports = function (grunt) {
	grunt.registerMultiTask('monic', 'Using Monic', function () {
		const
			done = this.async(),
			opts = Object.assign(this.options(), {saveFiles: true, cwd: process.cwd()}),
			tasks = [];

		this.files.forEach((file) => {
			let baseSrc = null;
			function reduce(res, src) {
				if (!grunt.file.exists(src)) {
					grunt.log.warn(`Source file "${src}" not found`);
					return res;
				}

				if (baseSrc === null) {
					baseSrc = src;
				}

				return res + grunt.file.read(src);
			}

			tasks.push((cb) => {
				const params = Object.assign({file: file.dest}, opts, {
					content: file.src.reduce(reduce, '')
				});

				monic.compile(baseSrc, params, (err) => {
					if (!err) {
						grunt.log.writeln(`File "${baseSrc}" was successfully built -> "${params.file}"`);
					}

					cb(err);
				});
			});
		});

		async.parallel(tasks, (err) => {
			if (err) {
				return grunt.log.error('Monic error: %s. \nFile: %s. \nLine: %s', err.message, err.fileName, err.lineNumber);
			}

			done();
		});
	});
};


text:
ACCEPTED

#### According to
International Plant Names Index

#### Published in
Plantsman 15:204. 1994

#### Original name
null

### Remarks
null


text:
package org.trafodion.dcs.servermt.serverDriverInputOutput;

import java.net.*;
import java.io.*;
import java.nio.*;
import java.nio.channels.*;
import java.nio.channels.spi.*;
import java.sql.SQLException;

import org.trafodion.dcs.Constants;
import org.trafodion.dcs.util.*;
import org.trafodion.dcs.servermt.ServerConstants;
import org.trafodion.dcs.servermt.ServerUtils;
import org.trafodion.dcs.servermt.serverHandler.*;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class SQLWarningOrError {
    private static  final Log LOG = LogFactory.getLog(SQLWarningOrError.class);
    private int rowId;
    private int sqlCode;
    private String text;
    private String sqlState;

    public SQLWarningOrError() {
        rowId = 0;
        sqlCode = 0;
        text = "";
        sqlState = "";
    }
    public SQLWarningOrError(SQLException ex, int rowId) {

        this.rowId = rowId;
        sqlCode = ex.getErrorCode();
        text = ex.getMessage();
        sqlState = ex.getSQLState();
        if(LOG.isDebugEnabled()){
            LOG.debug("SQLWarningOrError() rowId: " + rowId + ", Messge: " + sqlCode + ",Vendor Code: " + text + ",SQLState: " + sqlState);
        }
    }
    public void extractFromByteBuffer(ByteBuffer bbBuf) throws UnsupportedEncodingException{
        rowId = bbBuf.getInt();
        sqlCode = bbBuf.getInt();
        text = ByteBufferUtils.extractString(bbBuf);
        byte[] dst = new byte[5];
        bbBuf.get(dst,0,5);                        // is it 5 or 6??????
        sqlState = new String(dst);
        bbBuf.get(); //null terminator
    }
    public void insertIntoByteBuffer(ByteBuffer bbBuf) throws UnsupportedEncodingException {
        bbBuf.putInt(rowId);
        bbBuf.putInt(sqlCode);
        ByteBufferUtils.insertString(text,bbBuf);
        sqlState = (sqlState == null)? "HY024" : sqlState;
        bbBuf.put(sqlState.getBytes(),0,5);
        bbBuf.put((byte)0); //null terminator
    }
    public int lengthOfData() {
        int dataLength = 0;

        dataLength += ServerConstants.INT_FIELD_SIZE;         //rowId
        dataLength += ServerConstants.INT_FIELD_SIZE;         //sqlcode
        dataLength += ByteBufferUtils.lengthOfString(text);
        dataLength += 6;                                //sqlstate + null terminator
        return dataLength;
    }
    public int getRowId(){
        return rowId;
    }
    public int getSqlCode(){
        return sqlCode;
    }
    public String getText(){
        return text;
    }
    public String getSqlState(){
        return sqlState;
    }

    public void setRowId(int rowId){
        this.rowId = rowId;
    }
    public void setSqlCode(int sqlCode){
        this.sqlCode = sqlCode;
    }
    public void setText(String text){
        this.text = text;
    }
    public void setSqlState(String sqlState){
        this.sqlState = sqlState;
    }
}


text:
Zmień bazę danych

W górnej części strony znajdują się rzędy ikon, z których każdy
reprezentuje jedną tabelę w bazie danych. Aby zmienić strukturę tabeli,
po prostu kliknij jedną z tych ikon.

Poniżej znajdują sie przyciski do tworzenia nowych tabel w bazie danych,
uruchamiania SQL dla tabel bazy oraz usuwania bazy danych wraz ze wszystkimi
tabelami w niej zawartymi. Z ostatniego przycisku należy korzystać
ostrożnie, gdyż jego działanie jest nieodwracalne!


text:
<phpunit
        backupGlobals="true"
        backupStaticAttributes="false"
        cacheTokens="false"
        colors="true"
        convertErrorsToExceptions="true"
        convertNoticesToExceptions="true"
        convertWarningsToExceptions="true"
        forceCoversAnnotation="false"
        mapTestClassNameToCoveredClassName="false"
        processIsolation="false"
        stopOnError="false"
        stopOnFailure="false"
        stopOnIncomplete="false"
        stopOnSkipped="false"
        stopOnRisky="false"
        verbose="false">
    <filter>
        <whitelist processUncoveredFilesFromWhitelist="true">
            <directory suffix=".php">./src/FieldNation</directory>
        </whitelist>
    </filter>
    <testsuites>
        <testsuite name="Tests">
            <directory>./tests</directory>
        </testsuite>
    </testsuites>
    <logging>
        <log type="junit" target="test-results.xml" logIncompleteSkipped="true"/>
    </logging>
</phpunit>


text:
class ListsController < ApplicationController

  get '/trips/:id/lists/new' do
    if is_logged_in?
      @trip = Trip.find(params[:id])
      erb :'/lists/new'
    else
      erb :'/users/login', locals: {message: "Access denied. Please log-in to view."}
    end
  end

  post '/trips/:id/lists' do
    if params[:title].empty? || params[:content].empty?
      @trip = Trip.find(session[:user_id])
      erb :'/lists/new', locals: {message: "There seems to be an error. Please try again."}
    else
      @trip = Trip.find(params[:id])
      @list = List.new(title: params[:title], content: params[:content])
      @list.save
      @trip.lists << @list
      redirect "/trips/#{@trip.id}"
    end
  end

  get '/trips/:id/lists/:id' do
    if is_logged_in?
      @list = List.find(params[:id])
      erb :'/lists/show'
    else
      erb :'/users/login', locals: {message: "Access denied. Please log-in to view."}
    end
  end

  get '/trips/:id/lists/:id/edit' do
    if is_logged_in?
      @list = List.find(params[:id])
      @trip = Trip.find(@list.trip_id)
      if @trip.user_id == session[:user_id]
        erb :'/lists/edit'
      else
        erb :'/trips/show', locals: {message: "Sorry, you do not have permission to edit this list."}
      end
    else
      erb :'/users/login', locals: {message: "Access denied. Please log-in to view."}
    end
  end

  patch '/trips/:id/lists/:id' do
    if params[:title].empty? || params[:content].empty?
      @list = List.find(params[:id])
      erb :'/lists/edit', locals: {message: "There seems to be an error. Please try again."}
    else
      @list = List.find(params[:id])
      @list.update(title: params[:title], content: params[:content])
      redirect "trips/#{@list.trip_id}/lists/#{@list.id}"
    end
  end

  delete '/trips/:id/lists/:id/delete' do
    @list = List.find(params[:id])
    @list.delete
    redirect "/trips/#{@list.trip_id}"
  end

end


text:
pyKML Modules
=============

The pyKML library is separated into several modules, based on similar
functionality.

.. _pykml-factory:

:mod:`pykml.factory`
--------------------

.. automodule:: pykml.factory
    :members:
    :undoc-members:
    :show-inheritance:

:mod:`pykml.parser`
-------------------

.. automodule:: pykml.parser
    :members:
    :undoc-members:
    :show-inheritance:

:mod:`pykml.helpers`
--------------------

.. automodule:: pykml.helpers
    :members:
    :undoc-members:
    :show-inheritance:

:mod:`pykml.util`
--------------------

.. automodule:: pykml.util
    :members:
    :undoc-members:
    :show-inheritance: