text:
/*
 * Written by Doug Lea with assistance from members of JCP JSR-166
 * Expert Group and released to the public domain, as explained at
 * http://creativecommons.org/licenses/publicdomain
 */

package java.util.concurrent.locks;
import java.util.*;
import java.util.concurrent.*;
import java.util.concurrent.atomic.*;

/**
 * A reentrant mutual exclusion {@link Lock} with the same basic
 * behavior and semantics as the implicit monitor lock accessed using
 * <tt>synchronized</tt> methods and statements, but with extended
 * capabilities.
 *
 *
 A <tt>ReentrantLock</tt> is owned by the thread last
 * successfully locking, but not yet unlocking it. A thread invoking
 * <tt>lock</tt> will return, successfully acquiring the lock, when
 * the lock is not owned by another thread. The method will return
 * immediately if the current thread already owns the lock. This can
 * be checked using methods {@link #isHeldByCurrentThread}, and {@link
 * #getHoldCount}.
 *
 *
 The constructor for this class accepts an optional
 * fairness parameter.  When set <tt>true</tt>, under
 * contention, locks favor granting access to the longest-waiting
 * thread.  Otherwise this lock does not guarantee any particular
 * access order.  Programs using fair locks accessed by many threads
 * may display lower overall throughput (i.e., are slower; often much
 * slower) than those using the default setting, but have smaller
 * variances in times to obtain locks and guarantee lack of
 * starvation. Note however, that fairness of locks does not guarantee
 * fairness of thread scheduling. Thus, one of many threads using a
 * fair lock may obtain it multiple times in succession while other
 * active threads are not progressing and not currently holding the
 * lock.
 *
 *
 It is recommended practice to always immediately
 * follow a call to <tt>lock</tt> with a <tt>try</tt> block, most
 * typically in a before/after construction such as:
 *
 *

 * class X {
 *   private final ReentrantLock lock = new ReentrantLock();
 *   // ...
 *
 *   public void m() {
 *     lock.lock();  // block until condition holds
 *     try {
 *       // ... method body
 *     } finally {
 *       lock.unlock()
 *     }
 *   }
 * }
 *

 *
 *
In addition to implementing the {@link Lock} interface, this
 * class defines methods <tt>isLocked</tt> and
 * <tt>getLockQueueLength</tt>, as well as some associated
 * <tt>protected</tt> access methods that may be useful for
 * instrumentation and monitoring.
 *
 *
 Serialization of this class behaves in the same way as built-in
 * locks: a deserialized lock is in the unlocked state, regardless of
 * its state when serialized.
 *
 *
 This lock supports a maximum of 2147483648 recursive locks by
 * the same thread.
 *
 * @since 1.5
 * @author Doug Lea
 *
 */
public class ReentrantLock implements Lock, java.io.Serializable {
    private static final long serialVersionUID = 7373984872572414699L;
    /** Synchronizer providing all implementation mechanics */
    private final Sync sync;

    /**
     * Base of synchronization control for this lock. Subclassed
     * into fair and nonfair versions below. Uses AQS state to
     * represent the number of holds on the lock.
     */
    static abstract class Sync  extends AbstractQueuedSynchronizer {
        /** Current owner thread */
        transient Thread owner;

        /**
         * Perform {@link Lock#lock}. The main reason for subclassing
         * is to allow fast path for nonfair version.
         */
        abstract void lock();

        /**
         * Perform non-fair tryLock.  tryAcquire is
         * implemented in subclasses, but both need nonfair
         * try for trylock method
         */
        final boolean nonfairTryAcquire(int acquires) {
            final Thread current = Thread.currentThread();
            int c = getState();
            if (c == 0) {
                if (compareAndSetState(0, acquires)) {
                    owner = current;
                    return true;
                }
            }
            else if (current == owner) {
                setState(c+acquires);
                return true;
            }
            return false;
        }

        protected final boolean tryRelease(int releases) {
            int c = getState() - releases;
            if (Thread.currentThread() != owner)
                throw new IllegalMonitorStateException();
            boolean free = false;
            if (c == 0) {
                free = true;
                owner = null;
            }
            setState(c);
            return free;
        }

        protected final boolean isHeldExclusively() {
            return getState() != 0 && owner == Thread.currentThread();
        }

        final ConditionObject newCondition() {
            return new ConditionObject();
        }

        // Methods relayed from outer class

        final Thread getOwner() {
            int c = getState();
            Thread o = owner;
            return (c == 0)? null : o;
        }

        final int getHoldCount() {
            int c = getState();
            Thread o = owner;
            return (o == Thread.currentThread())? c : 0;
        }

        final boolean isLocked() {
            return getState() != 0;
        }

        /**
         * Reconstitute this lock instance from a stream
         * @param s the stream
         */
        private void readObject(java.io.ObjectInputStream s)
            throws java.io.IOException, ClassNotFoundException {
            s.defaultReadObject();
            setState(0); // reset to unlocked state
        }
    }

    /**
     * Sync object for non-fair locks
     */
    final static class NonfairSync extends Sync {
        /**
         * Perform lock.  Try immediate barge, backing up to normal
         * acquire on failure.
         */
        final void lock() {
            if (compareAndSetState(0, 1))
                owner = Thread.currentThread();
            else
                acquire(1);
        }

        protected final boolean tryAcquire(int acquires) {
            return nonfairTryAcquire(acquires);
        }
    }

    /**
     * Sync object for fair locks
     */
    final static class FairSync  extends Sync {
        final void lock() {
            acquire(1);
        }

        /**
         * Fair version of tryAcquire.  Don't grant access unless
         * recursive call or no waiters or is first.
         */
        protected final boolean tryAcquire(int acquires) {
            final Thread current = Thread.currentThread();
            int c = getState();
            if (c == 0) {
                Thread first = getFirstQueuedThread();
                if ((first == null || first == current) &&
                    compareAndSetState(0, acquires)) {
                    owner = current;
                    return true;
                }
            }
            else if (current == owner) {
                setState(c+acquires);
                return true;
            }
            return false;
        }
    }

    /**
     * Creates an instance of <tt>ReentrantLock</tt>.
     * This is equivalent to using <tt>ReentrantLock(false)</tt>.
     */
    public ReentrantLock() {
        sync = new NonfairSync();
    }

    /**
     * Creates an instance of <tt>ReentrantLock</tt> with the
     * given fairness policy.
     * @param fair true if this lock will be fair; else false
     */
    public ReentrantLock(boolean fair) {
        sync = (fair)? new FairSync() : new NonfairSync();
    }

    /**
     * Acquires the lock.
     *
     *
Acquires the lock if it is not held by another thread and returns
     * immediately, setting the lock hold count to one.
     *
     *
If the current thread
     * already holds the lock then the hold count is incremented by one and
     * the method returns immediately.
     *
     *
If the lock is held by another thread then the
     * current thread becomes disabled for thread scheduling
     * purposes and lies dormant until the lock has been acquired,
     * at which time the lock hold count is set to one.
     */
    public void lock() {
        sync.lock();
    }

    /**
     * Acquires the lock unless the current thread is
     * {@link Thread#interrupt interrupted}.
     *
     *
Acquires the lock if it is not held by another thread and returns
     * immediately, setting the lock hold count to one.
     *
     *
If the current thread already holds this lock then the hold count
     * is incremented by one and the method returns immediately.
     *
     *
If the lock is held by another thread then the
     * current thread becomes disabled for thread scheduling
     * purposes and lies dormant until one of two things happens:
     *
     *

     *
     *
The lock is acquired by the current thread; or
     *
     *
Some other thread {@link Thread#interrupt interrupts} the current
     * thread.
     *
     *

     *
     *
If the lock is acquired by the current thread then the lock hold
     * count is set to one.
     *
     *
If the current thread:
     *
     *

     *
     *
has its interrupted status set on entry to this method; or
     *
     *
is {@link Thread#interrupt interrupted} while acquiring
     * the lock,
     *
     *

     *
     * then {@link InterruptedException} is thrown and the current thread's
     * interrupted status is cleared.
     *
     *
In this implementation, as this method is an explicit interruption
     * point, preference is
     * given to responding to the interrupt over normal or reentrant
     * acquisition of the lock.
     *
     * @throws InterruptedException if the current thread is interrupted
     */
    public void lockInterruptibly() throws InterruptedException {
        sync.acquireInterruptibly(1);
    }

    /**
     * Acquires the lock only if it is not held by another thread at the time
     * of invocation.
     *
     *
Acquires the lock if it is not held by another thread and
     * returns immediately with the value <tt>true</tt>, setting the
     * lock hold count to one. Even when this lock has been set to use a
     * fair ordering policy, a call to <tt>tryLock()</tt> will
     * immediately acquire the lock if it is available, whether or not
     * other threads are currently waiting for the lock.
     * This "barging" behavior can be useful in certain
     * circumstances, even though it breaks fairness. If you want to honor
     * the fairness setting for this lock, then use
     * {@link #tryLock(long, TimeUnit) tryLock(0, TimeUnit.SECONDS) }
     * which is almost equivalent (it also detects interruption).
     *
     *
 If the current thread
     * already holds this lock then the hold count is incremented by one and
     * the method returns <tt>true</tt>.
     *
     *
If the lock is held by another thread then this method will return
     * immediately with the value <tt>false</tt>.
     *
     * @return <tt>true</tt> if the lock was free and was acquired by the
     * current thread, or the lock was already held by the current thread; and
     * <tt>false</tt> otherwise.
     */
    public boolean tryLock() {
        return sync.nonfairTryAcquire(1);
    }

    /**
     * Acquires the lock if it is not held by another thread within the given
     * waiting time and the current thread has not been
     * {@link Thread#interrupt interrupted}.
     *
     *
Acquires the lock if it is not held by another thread and returns
     * immediately with the value <tt>true</tt>, setting the lock hold count
     * to one. If this lock has been set to use a fair ordering policy then
     * an available lock will not be acquired if any other threads
     * are waiting for the lock. This is in contrast to the {@link #tryLock()}
     * method. If you want a timed <tt>tryLock</tt> that does permit barging on
     * a fair lock then combine the timed and un-timed forms together:
     *
     *
if (lock.tryLock() || lock.tryLock(timeout, unit) ) { ... }
     *

     *
     *
If the current thread
     * already holds this lock then the hold count is incremented by one and
     * the method returns <tt>true</tt>.
     *
     *
If the lock is held by another thread then the
     * current thread becomes disabled for thread scheduling
     * purposes and lies dormant until one of three things happens:
     *
     *

     *
     *
The lock is acquired by the current thread; or
     *
     *
Some other thread {@link Thread#interrupt interrupts} the current
     * thread; or
     *
     *
The specified waiting time elapses
     *
     *

     *
     *
If the lock is acquired then the value <tt>true</tt> is returned and
     * the lock hold count is set to one.
     *
     *
If the current thread:
     *
     *

     *
     *
has its interrupted status set on entry to this method; or
     *
     *
is {@link Thread#interrupt interrupted} while acquiring
     * the lock,
     *
     *

     * then {@link InterruptedException} is thrown and the current thread's
     * interrupted status is cleared.
     *
     *
If the specified waiting time elapses then the value <tt>false</tt>
     * is returned.
     * If the time is
     * less than or equal to zero, the method will not wait at all.
     *
     *
In this implementation, as this method is an explicit interruption
     * point, preference is
     * given to responding to the interrupt over normal or reentrant
     * acquisition of the lock, and over reporting the elapse of the waiting
     * time.
     *
     * @param timeout the time to wait for the lock
     * @param unit the time unit of the timeout argument
     *
     * @return <tt>true</tt> if the lock was free and was acquired by the
     * current thread, or the lock was already held by the current thread; and
     * <tt>false</tt> if the waiting time elapsed before the lock could be
     * acquired.
     *
     * @throws InterruptedException if the current thread is interrupted
     * @throws NullPointerException if unit is null
     *
     */
    public boolean tryLock(long timeout, TimeUnit unit) throws InterruptedException {
        return sync.tryAcquireNanos(1, unit.toNanos(timeout));
    }

    /**
     * Attempts to release this lock.
     *
     *
If the current thread is the
     * holder of this lock then the hold count is decremented. If the
     * hold count is now zero then the lock is released.  If the
     * current thread is not the holder of this lock then {@link
     * IllegalMonitorStateException} is thrown.
     * @throws IllegalMonitorStateException if the current thread does not
     * hold this lock.
     */
    public void unlock() {
        sync.release(1);
    }

    /**
     * Returns a {@link Condition} instance for use with this
     * {@link Lock} instance.
     *
     *
The returned {@link Condition} instance supports the same
     * usages as do the {@link Object} monitor methods ({@link
     * Object#wait() wait}, {@link Object#notify notify}, and {@link
     * Object#notifyAll notifyAll}) when used with the built-in
     * monitor lock.
     *
     *

     *
     *
If this lock is not held when any of the {@link Condition}
     * {@link Condition#await() waiting} or {@link Condition#signal
     * signalling} methods are called, then an {@link
     * IllegalMonitorStateException} is thrown.
     *
     *
When the condition {@link Condition#await() waiting}
     * methods are called the lock is released and, before they
     * return, the lock is reacquired and the lock hold count restored
     * to what it was when the method was called.
     *
     *
If a thread is {@link Thread#interrupt interrupted} while
     * waiting then the wait will terminate, an {@link
     * InterruptedException} will be thrown, and the thread's
     * interrupted status will be cleared.
     *
     *
 Waiting threads are signalled in FIFO order
     *
     *
The ordering of lock reacquisition for threads returning
     * from waiting methods is the same as for threads initially
     * acquiring the lock, which is in the default case not specified,
     * but for fair locks favors those threads that have been
     * waiting the longest.
     *
     *

     *
     * @return the Condition object
     */
    public Condition newCondition() {
        return sync.newCondition();
    }

    /**
     * Queries the number of holds on this lock by the current thread.
     *
     *
A thread has a hold on a lock for each lock action that is not
     * matched by an unlock action.
     *
     *
The hold count information is typically only used for testing and
     * debugging purposes. For example, if a certain section of code should
     * not be entered with the lock already held then we can assert that
     * fact:
     *
     *

     * class X {
     *   ReentrantLock lock = new ReentrantLock();
     *   // ...
     *   public void m() {
     *     assert lock.getHoldCount() == 0;
     *     lock.lock();
     *     try {
     *       // ... method body
     *     } finally {
     *       lock.unlock();
     *     }
     *   }
     * }
     *

     *
     * @return the number of holds on this lock by the current thread,
     * or zero if this lock is not held by the current thread.
     */
    public int getHoldCount() {
        return sync.getHoldCount();
    }

    /**
     * Queries if this lock is held by the current thread.
     *
     *
Analogous to the {@link Thread#holdsLock} method for built-in
     * monitor locks, this method is typically used for debugging and
     * testing. For example, a method that should only be called while
     * a lock is held can assert that this is the case:
     *
     *

     * class X {
     *   ReentrantLock lock = new ReentrantLock();
     *   // ...
     *
     *   public void m() {
     *       assert lock.isHeldByCurrentThread();
     *       // ... method body
     *   }
     * }
     *

     *
     *
It can also be used to ensure that a reentrant lock is used
     * in a non-reentrant manner, for example:
     *
     *

     * class X {
     *   ReentrantLock lock = new ReentrantLock();
     *   // ...
     *
     *   public void m() {
     *       assert !lock.isHeldByCurrentThread();
     *       lock.lock();
     *       try {
     *           // ... method body
     *       } finally {
     *           lock.unlock();
     *       }
     *   }
     * }
     *

     * @return <tt>true</tt> if current thread holds this lock and
     * <tt>false</tt> otherwise.
     */
    public boolean isHeldByCurrentThread() {
        return sync.isHeldExclusively();
    }

    /**
     * Queries if this lock is held by any thread. This method is
     * designed for use in monitoring of the system state,
     * not for synchronization control.
     * @return <tt>true</tt> if any thread holds this lock and
     * <tt>false</tt> otherwise.
     */
    public boolean isLocked() {
        return sync.isLocked();
    }

    /**
     * Returns true if this lock has fairness set true.
     * @return true if this lock has fairness set true.
     */
    public final boolean isFair() {
        return sync instanceof FairSync;
    }

    /**
     * Returns the thread that currently owns the exclusive lock, or
     * <tt>null</tt> if not owned. Note that the owner may be
     * momentarily <tt>null</tt> even if there are threads trying to
     * acquire the lock but have not yet done so.  This method is
     * designed to facilitate construction of subclasses that provide
     * more extensive lock monitoring facilities.
     * @return the owner, or <tt>null</tt> if not owned.
     */
    protected Thread getOwner() {
        return sync.getOwner();
    }

    /**
     * Queries whether any threads are waiting to acquire. Note that
     * because cancellations may occur at any time, a <tt>true</tt>
     * return does not guarantee that any other thread will ever
     * acquire.  This method is designed primarily for use in
     * monitoring of the system state.
     *
     * @return true if there may be other threads waiting to acquire
     * the lock.
     */
    public final boolean hasQueuedThreads() {
        return sync.hasQueuedThreads();
    }

    /**
     * Queries whether the given thread is waiting to acquire this
     * lock. Note that because cancellations may occur at any time, a
     * <tt>true</tt> return does not guarantee that this thread
     * will ever acquire.  This method is designed primarily for use
     * in monitoring of the system state.
     *
     * @param thread the thread
     * @return true if the given thread is queued waiting for this lock.
     * @throws NullPointerException if thread is null
     */
    public final boolean hasQueuedThread(Thread thread) {
        return sync.isQueued(thread);
    }

    /**
     * Returns an estimate of the number of threads waiting to
     * acquire.  The value is only an estimate because the number of
     * threads may change dynamically while this method traverses
     * internal data structures.  This method is designed for use in
     * monitoring of the system state, not for synchronization
     * control.
     * @return the estimated number of threads waiting for this lock
     */
    public final int getQueueLength() {
        return sync.getQueueLength();
    }

    /**
     * Returns a collection containing threads that may be waiting to
     * acquire.  Because the actual set of threads may change
     * dynamically while constructing this result, the returned
     * collection is only a best-effort estimate.  The elements of the
     * returned collection are in no particular order.  This method is
     * designed to facilitate construction of subclasses that provide
     * more extensive monitoring facilities.
     * @return the collection of threads
     */
    protected Collection<Thread> getQueuedThreads() {
        return sync.getQueuedThreads();
    }

    /**
     * Queries whether any threads are waiting on the given condition
     * associated with this lock. Note that because timeouts and
     * interrupts may occur at any time, a <tt>true</tt> return does
     * not guarantee that a future <tt>signal</tt> will awaken any
     * threads.  This method is designed primarily for use in
     * monitoring of the system state.
     * @param condition the condition
     * @return <tt>true</tt> if there are any waiting threads.
     * @throws IllegalMonitorStateException if this lock
     * is not held
     * @throws IllegalArgumentException if the given condition is
     * not associated with this lock
     * @throws NullPointerException if condition null
     */
    public boolean hasWaiters(Condition condition) {
        if (condition == null)
            throw new NullPointerException();
        if (!(condition instanceof AbstractQueuedSynchronizer.ConditionObject))
            throw new IllegalArgumentException("not owner");
        return sync.hasWaiters((AbstractQueuedSynchronizer.ConditionObject)condition);
    }

    /**
     * Returns an estimate of the number of threads waiting on the
     * given condition associated with this lock. Note that because
     * timeouts and interrupts may occur at any time, the estimate
     * serves only as an upper bound on the actual number of waiters.
     * This method is designed for use in monitoring of the system
     * state, not for synchronization control.
     * @param condition the condition
     * @return the estimated number of waiting threads.
     * @throws IllegalMonitorStateException if this lock
     * is not held
     * @throws IllegalArgumentException if the given condition is
     * not associated with this lock
     * @throws NullPointerException if condition null
     */
    public int getWaitQueueLength(Condition condition) {
        if (condition == null)
            throw new NullPointerException();
        if (!(condition instanceof AbstractQueuedSynchronizer.ConditionObject))
            throw new IllegalArgumentException("not owner");
        return sync.getWaitQueueLength((AbstractQueuedSynchronizer.ConditionObject)condition);
    }

    /**
     * Returns a collection containing those threads that may be
     * waiting on the given condition associated with this lock.
     * Because the actual set of threads may change dynamically while
     * constructing this result, the returned collection is only a
     * best-effort estimate. The elements of the returned collection
     * are in no particular order.  This method is designed to
     * facilitate construction of subclasses that provide more
     * extensive condition monitoring facilities.
     * @param condition the condition
     * @return the collection of threads
     * @throws IllegalMonitorStateException if this lock
     * is not held
     * @throws IllegalArgumentException if the given condition is
     * not associated with this lock
     * @throws NullPointerException if condition null
     */
    protected Collection<Thread> getWaitingThreads(Condition condition) {
        if (condition == null)
            throw new NullPointerException();
        if (!(condition instanceof AbstractQueuedSynchronizer.ConditionObject))
            throw new IllegalArgumentException("not owner");
        return sync.getWaitingThreads((AbstractQueuedSynchronizer.ConditionObject)condition);
    }

    /**
     * Returns a string identifying this lock, as well as its lock
     * state.  The state, in brackets, includes either the String
     * "Unlocked" or the String "Locked by"
     * followed by the {@link Thread#getName} of the owning thread.
     * @return a string identifying this lock, as well as its lock state.
     */
    public String toString() {
        Thread owner = sync.getOwner();
        return super.toString() + ((owner == null) ?
                                   "[Unlocked]" :
                                   "[Locked by thread " + owner.getName() + "]");
    }
}


text:
using System.Threading;
using System.Threading.Tasks;
using MediatR;
using Moq;
using NUnit.Framework;
using SFA.DAS.ProviderApprenticeshipsService.Application.Commands.UpsertRegisteredUser;
using SFA.DAS.ProviderApprenticeshipsService.Domain.Interfaces;
using SFA.DAS.ProviderApprenticeshipsService.Web.Orchestrators;

namespace SFA.DAS.ProviderApprenticeshipsService.Web.UnitTests.Orchestrators.Authentication
{
    [TestFixture]
    public class WhenSavingIdentityAttributes
    {
        private AuthenticationOrchestrator _orchestrator;
        private Mock<IMediator> _mediator;

        [SetUp]
        public void Arrange()
        {
            _mediator = new Mock<IMediator>();
            _mediator.Setup(x => x.Send(It.IsAny<UpsertRegisteredUserCommand>(), new CancellationToken()))
                .ReturnsAsync(new Unit());

            _orchestrator = new AuthenticationOrchestrator(_mediator.Object, Mock.Of<IProviderCommitmentsLogger>());
        }

        [Test]
        public async Task TheMediatorIsCalled()
        {
            //Act
            await _orchestrator.SaveIdentityAttributes("UserRef", 12345, "DisplayName", "Email");

            //Assert
            _mediator.Verify(x => x.Send(It.IsAny<UpsertRegisteredUserCommand>(), It.IsAny<CancellationToken>()));
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
  module Vim
    module Netbeans

      SERVER_MUTEX = Mutex.new

      class Message
        attr_reader :message
        def initialize(message)
          @message = message
        end

        def to_s
          @message
        end
      end
      class Event < Message
        attr_reader :buffer, :name, :value, :rest
        def initialize(message)
          super
          if match = message.match(/^(\d+):(\w+)=(\d)\s*/)
            @buffer = match[1].to_i
            @name =   match[2]
            @value =  match[3]
            @rest =   match.post_match.split(/\s/)
            @rest = @rest.map do |arg|
              case arg
              when /^"(.*)"$/
                $1
              when 'T'
                true
              when 'F'
                false
              when /^\d+$/
                arg.to_i
              else
                arg
              end
            end
          end
        end
        def to_s
          %Q~#{@buffer}:#{@name}=#{@value} #{@rest.inspect}~
        end
      end
      class Reply < Message
        attr_reader :seqno, :value
        def initialize(message)
          super
          @seqno, @value = message.split(/\s/)
          @seqno = @seqno.to_i
        end
      end

      def replies
        @replies ||= {}
      end

      def remember_reply(reply)
        replies[reply.seqno] = reply
      end

      def interpret_message(mess)
        if mess.index ':'
          event = Event.new(mess)
          case event.name
          when 'fileOpened'
            path = event.rest.first
            if event.buffer == 0
              send_command(new_buffer(path), 'putBufferNumber', path)
              send_command(last_buffer, 'startDocumentListen')
            else
              @buffers[event.buffer] = path
              send_command(event.buffer, 'startDocumentListen')
            end
          else
            mess
          end
          event
        else
          reply = Reply.new(mess)
          remember_reply reply
          reply
        end
      end

      attr_reader :port
      def server
        if @server
          @server
        else
          @server = TCPServer.open('localhost', 0)
          @port = @server.addr[1]
          @server
        end
      end

      def vim
        begin
          @vim_session ||= server.accept_nonblock
        rescue Errno::EAGAIN, Errno::EWOULDBLOCK, Errno::ECONNABORTED, Errno::EPROTO, Errno::EINTR
          IO.select([server])
          retry
        end
        return @vim_session
      end

      attr_reader :seqno
      def new_seqno
        if @seqno
          @seqno += 1
        else
          @seqno = 1
        end
      end
      def send_command(buf,name,*args)
        command = %Q~#{buf}:#{name}!#{new_seqno}~
        unless args.empty?
          command << ' ' + args.map do |arg|
            case arg
            when String
              %Q~"#{arg.gsub('"','\\"')}"~
            when Array # lnum/col
              arg.length == 2 ? arg.join('/') : arg.join('-')
            when true
              'T'
            when false
              'F'
            else
              arg
            end
          end.join(' ')
        end
        send_message command
      end

      # TODO timeout
      def send_function(buf,name)
        seq = new_seqno
        send_message %Q~#{buf}:#{name}/#{seq}~
        while not reply = replies[seq]
          sleep 0.005
        end
        replies.delete(seq)
        reply
      end

      def send_message(message)
        SERVER_MUTEX.synchronize do
          vim.puts message
        end
      end

    end
  end


text:
import {CommonModule, PlatformLocation, ɵPLATFORM_BROWSER_ID as PLATFORM_BROWSER_ID} from '@angular/common';
import {APP_ID, ApplicationModule, ClassProvider, ConstructorSansProvider, ErrorHandler, ExistingProvider, FactoryProvider, Inject, InjectionToken, ModuleWithProviders, NgModule, NgZone, Optional, PLATFORM_ID, PLATFORM_INITIALIZER, PlatformRef, RendererFactory2, RootRenderer, Sanitizer, SkipSelf, StaticProvider, Testability, TypeProvider, ValueProvider, createPlatformFactory, platformCore, ɵAPP_ROOT as APP_ROOT, ɵConsole as Console} from '@angular/core';

import {BrowserDomAdapter} from './browser/browser_adapter';
import {BrowserPlatformLocation} from './browser/location/browser_platform_location';
import {Meta} from './browser/meta';
import {SERVER_TRANSITION_PROVIDERS, TRANSITION_ID} from './browser/server-transition';
import {BrowserGetTestability} from './browser/testability';
import {Title} from './browser/title';
import {ELEMENT_PROBE_PROVIDERS} from './dom/debug/ng_probe';
import {getDOM} from './dom/dom_adapter';
import {DomRendererFactory2} from './dom/dom_renderer';
import {DOCUMENT} from './dom/dom_tokens';
import {DomEventsPlugin} from './dom/events/dom_events';
import {EVENT_MANAGER_PLUGINS, EventManager, EventManagerPlugin} from './dom/events/event_manager';
import {HAMMER_GESTURE_CONFIG, HAMMER_LOADER, HammerGestureConfig, HammerGesturesPlugin} from './dom/events/hammer_gestures';
import {KeyEventsPlugin} from './dom/events/key_events';
import {DomSharedStylesHost, SharedStylesHost} from './dom/shared_styles_host';
import {DomSanitizer, DomSanitizerImpl} from './security/dom_sanitization_service';

export const INTERNAL_BROWSER_PLATFORM_PROVIDERS: StaticProvider[] = [
  {provide: PLATFORM_ID, useValue: PLATFORM_BROWSER_ID},
  {provide: PLATFORM_INITIALIZER, useValue: initDomAdapter, multi: true},
  {provide: PlatformLocation, useClass: BrowserPlatformLocation, deps: [DOCUMENT]},
  {provide: DOCUMENT, useFactory: _document, deps: []},
];

/**
 * @security Replacing built-in sanitization providers exposes the application to XSS risks.
 * Attacker-controlled data introduced by an unsanitized provider could expose your
 * application to XSS risks. For more detail, see the [Security Guide](http://g.co/ng/security).
 * @experimental
 */
export const BROWSER_SANITIZATION_PROVIDERS: StaticProvider[] = [
  {provide: Sanitizer, useExisting: DomSanitizer},
  {provide: DomSanitizer, useClass: DomSanitizerImpl, deps: [DOCUMENT]},
];

export const platformBrowser: (extraProviders?: StaticProvider[]) => PlatformRef =
    createPlatformFactory(platformCore, 'browser', INTERNAL_BROWSER_PLATFORM_PROVIDERS);

export function initDomAdapter() {
  BrowserDomAdapter.makeCurrent();
  BrowserGetTestability.init();
}

export function errorHandler(): ErrorHandler {
  return new ErrorHandler();
}

export function _document(): any {
  return document;
}

export const BROWSER_MODULE_PROVIDERS: StaticProvider[] = [
  BROWSER_SANITIZATION_PROVIDERS,
  {provide: APP_ROOT, useValue: true},
  {provide: ErrorHandler, useFactory: errorHandler, deps: []},
  {
    provide: EVENT_MANAGER_PLUGINS,
    useClass: DomEventsPlugin,
    multi: true,
    deps: [DOCUMENT, NgZone, PLATFORM_ID]
  },
  {provide: EVENT_MANAGER_PLUGINS, useClass: KeyEventsPlugin, multi: true, deps: [DOCUMENT]},
  {
    provide: EVENT_MANAGER_PLUGINS,
    useClass: HammerGesturesPlugin,
    multi: true,
    deps: [DOCUMENT, HAMMER_GESTURE_CONFIG, Console, [new Optional(), HAMMER_LOADER]]
  },
  {provide: HAMMER_GESTURE_CONFIG, useClass: HammerGestureConfig, deps: []},
  {
    provide: DomRendererFactory2,
    useClass: DomRendererFactory2,
    deps: [EventManager, DomSharedStylesHost]
  },
  {provide: RendererFactory2, useExisting: DomRendererFactory2},
  {provide: SharedStylesHost, useExisting: DomSharedStylesHost},
  {provide: DomSharedStylesHost, useClass: DomSharedStylesHost, deps: [DOCUMENT]},
  {provide: Testability, useClass: Testability, deps: [NgZone]},
  {provide: EventManager, useClass: EventManager, deps: [EVENT_MANAGER_PLUGINS, NgZone]},
  ELEMENT_PROBE_PROVIDERS,
  {provide: Meta, useClass: Meta, deps: [DOCUMENT]},
  {provide: Title, useClass: Title, deps: [DOCUMENT]},
];

/**
 * The ng module for the browser.
 *
 *
 */
@NgModule({providers: BROWSER_MODULE_PROVIDERS, exports: [CommonModule, ApplicationModule]})
export class BrowserModule {
  constructor(@Optional() @SkipSelf() @Inject(BrowserModule) parentModule: BrowserModule|null) {
    if (parentModule) {
      throw new Error(
          `BrowserModule has already been loaded. If you need access to common directives such as NgIf and NgFor from a lazy loaded module, import CommonModule instead.`);
    }
  }

  /**
   * Configures a browser-based application to transition from a server-rendered app, if
   * one is present on the page. The specified parameters must include an application id,
   * which must match between the client and server applications.
   *
   * @experimental
   */
  static withServerTransition(params: {appId: string}): ModuleWithProviders {
    return {
      ngModule: BrowserModule,
      providers: [
        {provide: APP_ID, useValue: params.appId},
        {provide: TRANSITION_ID, useExisting: APP_ID},
        SERVER_TRANSITION_PROVIDERS,
      ],
    };
  }
}


text:
class Connection;

#define CONNECTION_BUFF_SIZE_HALF 1024
#define WEBSOCK_MAX_BUFF_SIZE 16384

class WebSock_processer{
public:
  WebSock_processer();
  ~WebSock_processer();
  void ClearState();
  void ClearMultFlameState();
  void Process(int sock, unsigned char *buff, int index, int data_start, ProcessResult &ret);

  ASOS_Node asos_node;

  Connection *conn;
  unsigned char buff[WEBSOCK_MAX_BUFF_SIZE];

  int state; // 0: start, 1:extend_length16, 2:extend_length64, 3:mask, 4:payload
  unsigned long long int length;
  unsigned long long int pos;
  unsigned long long int buff_index;
  int is_masked;
  unsigned char mask[4];

  int is_fin;
  unsigned char opcode;
  unsigned char original_opcode;

  void Close();
};

#endif


text:
namespace EFAdventure
{
    using System;
    using System.Collections.Generic;

    public partial class ProductInventory
    {
        public int ProductID { get; set; }
        public short LocationID { get; set; }
        public string Shelf { get; set; }
        public byte Bin { get; set; }
        public short Quantity { get; set; }
        public System.Guid rowguid { get; set; }
        public System.DateTime ModifiedDate { get; set; }

        public virtual Location Location { get; set; }
        public virtual Product Product { get; set; }
    }
}


text:
layout: post
title: XML Parsing with Groovy
---

[Groovy](http://www.groovy-lang.org) is a powerful, optionally typed and dynamic language and in this post i will show how easily you can parse XML by using a few lines of code. So, let's do it.

The XML used for this example contains a list of consumers:

{% highlight groovy %}
def xml = """
<consumers>
    <consumer>
        <name>Fábio Santos</name>
        <email>fabio@example.com</email>
    </consumer>
    <consumer>
        <name>John Doe</name>
        <email>john@example.com</email>
    </consumer>
</consumers>
"""
{% endhighlight %}

Let's assume that you want to check if a consumer exists by matching an email:

{% highlight groovy %}
def email_to_match = "fabio@example.com"
{% endhighlight %}

So, just parse XML and return `true` if the consumer's email exists in the XML:

{% highlight groovy %}
def consumers = new XmlParser().parseText(xml)

for (consumer in consumers) {
    if (email_to_match.equals(consumer.email.text())) {
        return true
    }
}

return false
{% endhighlight %}


text:
<?php
/**
 * @package WordPress
 * @subpackage Traveler
 * @since 1.0
 *
 * Single hotel
 *
 * Created by ShineTheme
 *
 */
get_header();
get_template_part('breadcrumb');
?>

        <?php
        $detail_hotel_layout=apply_filters('st_hotel_detail_layout',st()->get_option('hotel_single_layout'));
        if($detail_hotel_layout) {
            $content=STTemplate::get_vc_pagecontent($detail_hotel_layout);
            echo balanceTags($content);
        }else{
            echo st()->load_template('hotel/single','default');
        }
        ?>

<?php get_footer( ) ?>


text:
import React from 'react';

import styles from './styles.css';

class ListItem extends React.Component {
  render() {
    return (

          { this.props.content }

    );
  }
}

export default ListItem;


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title>Integer Objects — Python 3.3.6 documentation</title>

    <link rel="stylesheet" href="../_static/pydoctheme.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />

    <link rel="search" type="application/opensearchdescription+xml"
          title="Search within Python 3.3.6 documentation"
          href="../_static/opensearch.xml"/>
    <link rel="author" title="About these documents" href="../about.html" />
    <link rel="copyright" title="Copyright" href="../copyright.html" />
    <link rel="top" title="Python 3.3.6 documentation" href="../index.html" />
    <link rel="up" title="Concrete Objects Layer" href="concrete.html" />
    <link rel="next" title="Boolean Objects" href="bool.html" />
    <link rel="prev" title="The None Object" href="none.html" />
    <link rel="shortcut icon" type="image/png" href="../_static/py.png" />

Navigation

          index

          modules |

          next |

          previous |

Python »

          3.3.6 Documentation »

Python/C API Reference Manual »

Concrete Objects Layer »

Integer Objects¶

All integers are implemented as “long” integer objects of arbitrary size.

<tt class="descname">PyLongObject</tt>¶

This subtype of <tt class="xref c c-type docutils literal">PyObject</tt> represents a Python integer object.

PyTypeObject <tt class="descname">PyLong_Type</tt>¶

This instance of <tt class="xref c c-type docutils literal">PyTypeObject</tt> represents the Python integer type.
This is the same object as <tt class="xref py py-class docutils literal">int</tt> in the Python layer.

int <tt class="descname">PyLong_Check</tt><big>(</big>PyObject *p<big>)</big>¶

Return true if its argument is a <tt class="xref c c-type docutils literal">PyLongObject</tt> or a subtype of
<tt class="xref c c-type docutils literal">PyLongObject</tt>.

int <tt class="descname">PyLong_CheckExact</tt><big>(</big>PyObject *p<big>)</big>¶

Return true if its argument is a <tt class="xref c c-type docutils literal">PyLongObject</tt>, but not a subtype of
<tt class="xref c c-type docutils literal">PyLongObject</tt>.

PyObject* <tt class="descname">PyLong_FromLong</tt><big>(</big>long v<big>)</big>¶

Return value: New reference.
Return a new <tt class="xref c c-type docutils literal">PyLongObject</tt> object from v, or NULL on failure.

The current implementation keeps an array of integer objects for all integers
between <tt class="docutils literal">-5</tt> and <tt class="docutils literal">256</tt>, when you create an int in that range you actually
just get back a reference to the existing object. So it should be possible to
change the value of <tt class="docutils literal">1</tt>.  I suspect the behaviour of Python in this case is
undefined. :-)

PyObject* <tt class="descname">PyLong_FromUnsignedLong</tt><big>(</big>unsigned long v<big>)</big>¶

Return value: New reference.
Return a new <tt class="xref c c-type docutils literal">PyLongObject</tt> object from a C <tt class="xref c c-type docutils literal">unsigned long</tt>, or
NULL on failure.

PyObject* <tt class="descname">PyLong_FromSsize_t</tt><big>(</big>Py_ssize_t v<big>)</big>¶

Return a new <tt class="xref c c-type docutils literal">PyLongObject</tt> object from a C <tt class="xref c c-type docutils literal">Py_ssize_t</tt>, or
NULL on failure.

PyObject* <tt class="descname">PyLong_FromSize_t</tt><big>(</big>size_t v<big>)</big>¶

Return a new <tt class="xref c c-type docutils literal">PyLongObject</tt> object from a C <tt class="xref c c-type docutils literal">size_t</tt>, or
NULL on failure.

PyObject* <tt class="descname">PyLong_FromLongLong</tt><big>(</big>PY_LONG_LONG v<big>)</big>¶

Return value: New reference.
Return a new <tt class="xref c c-type docutils literal">PyLongObject</tt> object from a C <tt class="xref c c-type docutils literal">long long</tt>, or NULL
on failure.

PyObject* <tt class="descname">PyLong_FromUnsignedLongLong</tt><big>(</big>unsigned PY_LONG_LONG v<big>)</big>¶

Return value: New reference.
Return a new <tt class="xref c c-type docutils literal">PyLongObject</tt> object from a C <tt class="xref c c-type docutils literal">unsigned long long</tt>,
or NULL on failure.

PyObject* <tt class="descname">PyLong_FromDouble</tt><big>(</big>double v<big>)</big>¶

Return value: New reference.
Return a new <tt class="xref c c-type docutils literal">PyLongObject</tt> object from the integer part of v, or
NULL on failure.

PyObject* <tt class="descname">PyLong_FromString</tt><big>(</big>char *str, char **pend, int base<big>)</big>¶

Return value: New reference.
Return a new <tt class="xref c c-type docutils literal">PyLongObject</tt> based on the string value in str, which
is interpreted according to the radix in base.  If pend is non-NULL,
*pend will point to the first character in str which follows the
representation of the number.  If base is <tt class="docutils literal">0</tt>, the radix will be
determined based on the leading characters of str: if str starts with
<tt class="docutils literal">'0x'</tt> or <tt class="docutils literal">'0X'</tt>, radix 16 will be used; if str starts with <tt class="docutils literal">'0o'</tt> or
<tt class="docutils literal">'0O'</tt>, radix 8 will be used; if str starts with <tt class="docutils literal">'0b'</tt> or <tt class="docutils literal">'0B'</tt>,
radix 2 will be used; otherwise radix 10 will be used.  If base is not
<tt class="docutils literal">0</tt>, it must be between <tt class="docutils literal">2</tt> and <tt class="docutils literal">36</tt>, inclusive.  Leading spaces are
ignored.  If there are no digits, <tt class="xref py py-exc docutils literal">ValueError</tt> will be raised.

PyObject* <tt class="descname">PyLong_FromUnicode</tt><big>(</big>Py_UNICODE *u, Py_ssize_t length, int base<big>)</big>¶

Return value: New reference.
Convert a sequence of Unicode digits to a Python integer value.  The Unicode
string is first encoded to a byte string using <tt class="xref c c-func docutils literal">PyUnicode_EncodeDecimal()</tt>
and then converted using <tt class="xref c c-func docutils literal">PyLong_FromString()</tt>.

Part of the old-style <tt class="xref c c-type docutils literal">Py_UNICODE</tt> API; please migrate to using
<tt class="xref c c-func docutils literal">PyLong_FromUnicodeObject()</tt>.

Deprecated since version 3.3, will be removed in version 4.0.

PyObject* <tt class="descname">PyLong_FromUnicodeObject</tt><big>(</big>PyObject *u, int base<big>)</big>¶

Convert a sequence of Unicode digits in the string u to a Python integer
value.  The Unicode string is first encoded to a byte string using
<tt class="xref c c-func docutils literal">PyUnicode_EncodeDecimal()</tt> and then converted using
<tt class="xref c c-func docutils literal">PyLong_FromString()</tt>.

New in version 3.3.

PyObject* <tt class="descname">PyLong_FromVoidPtr</tt><big>(</big>void *p<big>)</big>¶

Return value: New reference.
Create a Python integer from the pointer p. The pointer value can be
retrieved from the resulting value using <tt class="xref c c-func docutils literal">PyLong_AsVoidPtr()</tt>.

long <tt class="descname">PyLong_AsLong</tt><big>(</big>PyObject *obj<big>)</big>¶

Return a C <tt class="xref c c-type docutils literal">long</tt> representation of obj.  If obj is not an
instance of <tt class="xref c c-type docutils literal">PyLongObject</tt>, first call its <tt class="xref py py-meth docutils literal">__int__()</tt> method
(if present) to convert it to a <tt class="xref c c-type docutils literal">PyLongObject</tt>.

Raise <tt class="xref py py-exc docutils literal">OverflowError</tt> if the value of obj is out of range for a
<tt class="xref c c-type docutils literal">long</tt>.

long <tt class="descname">PyLong_AsLongAndOverflow</tt><big>(</big>PyObject *obj, int *overflow<big>)</big>¶

Return a C <tt class="xref c c-type docutils literal">long</tt> representation of obj.  If obj is not an
instance of <tt class="xref c c-type docutils literal">PyLongObject</tt>, first call its <tt class="xref py py-meth docutils literal">__int__()</tt> method
(if present) to convert it to a <tt class="xref c c-type docutils literal">PyLongObject</tt>.

If the value of obj is greater than <tt class="xref py py-const docutils literal">LONG_MAX</tt> or less than
<tt class="xref py py-const docutils literal">LONG_MIN</tt>, set *overflow to <tt class="docutils literal">1</tt> or <tt class="docutils literal">-1</tt>, respectively, and
return <tt class="docutils literal">-1</tt>; otherwise, set *overflow to <tt class="docutils literal">0</tt>.  If any other exception
occurs set *overflow to <tt class="docutils literal">0</tt> and return <tt class="docutils literal">-1</tt> as usual.

PY_LONG_LONG <tt class="descname">PyLong_AsLongLong</tt><big>(</big>PyObject *obj<big>)</big>¶

Return a C <tt class="xref c c-type docutils literal">long long</tt> representation of obj.  If obj is not an
instance of <tt class="xref c c-type docutils literal">PyLongObject</tt>, first call its <tt class="xref py py-meth docutils literal">__int__()</tt> method
(if present) to convert it to a <tt class="xref c c-type docutils literal">PyLongObject</tt>.

Raise <tt class="xref py py-exc docutils literal">OverflowError</tt> if the value of obj is out of range for a
<tt class="xref c c-type docutils literal">long</tt>.

PY_LONG_LONG <tt class="descname">PyLong_AsLongLongAndOverflow</tt><big>(</big>PyObject *obj, int *overflow<big>)</big>¶

Return a C <tt class="xref c c-type docutils literal">long long</tt> representation of obj.  If obj is not an
instance of <tt class="xref c c-type docutils literal">PyLongObject</tt>, first call its <tt class="xref py py-meth docutils literal">__int__()</tt> method
(if present) to convert it to a <tt class="xref c c-type docutils literal">PyLongObject</tt>.

If the value of obj is greater than <tt class="xref py py-const docutils literal">PY_LLONG_MAX</tt> or less than
<tt class="xref py py-const docutils literal">PY_LLONG_MIN</tt>, set *overflow to <tt class="docutils literal">1</tt> or <tt class="docutils literal">-1</tt>, respectively,
and return <tt class="docutils literal">-1</tt>; otherwise, set *overflow to <tt class="docutils literal">0</tt>.  If any other
exception occurs set *overflow to <tt class="docutils literal">0</tt> and return <tt class="docutils literal">-1</tt> as usual.

New in version 3.2.

Py_ssize_t <tt class="descname">PyLong_AsSsize_t</tt><big>(</big>PyObject *pylong<big>)</big>¶

Return a C <tt class="xref c c-type docutils literal">Py_ssize_t</tt> representation of pylong.  pylong must
be an instance of <tt class="xref c c-type docutils literal">PyLongObject</tt>.

Raise <tt class="xref py py-exc docutils literal">OverflowError</tt> if the value of pylong is out of range for a
<tt class="xref c c-type docutils literal">Py_ssize_t</tt>.

unsigned long <tt class="descname">PyLong_AsUnsignedLong</tt><big>(</big>PyObject *pylong<big>)</big>¶

Return a C <tt class="xref c c-type docutils literal">unsigned long</tt> representation of pylong.  pylong
must be an instance of <tt class="xref c c-type docutils literal">PyLongObject</tt>.

Raise <tt class="xref py py-exc docutils literal">OverflowError</tt> if the value of pylong is out of range for a
<tt class="xref c c-type docutils literal">unsigned long</tt>.

size_t <tt class="descname">PyLong_AsSize_t</tt><big>(</big>PyObject *pylong<big>)</big>¶

Return a C <tt class="xref c c-type docutils literal">size_t</tt> representation of pylong.  pylong must be
an instance of <tt class="xref c c-type docutils literal">PyLongObject</tt>.

Raise <tt class="xref py py-exc docutils literal">OverflowError</tt> if the value of pylong is out of range for a
<tt class="xref c c-type docutils literal">size_t</tt>.

unsigned PY_LONG_LONG <tt class="descname">PyLong_AsUnsignedLongLong</tt><big>(</big>PyObject *pylong<big>)</big>¶

Return a C <tt class="xref c c-type docutils literal">unsigned PY_LONG_LONG</tt> representation of pylong.
pylong must be an instance of <tt class="xref c c-type docutils literal">PyLongObject</tt>.

Raise <tt class="xref py py-exc docutils literal">OverflowError</tt> if the value of pylong is out of range for an
<tt class="xref c c-type docutils literal">unsigned PY_LONG_LONG</tt>.

Changed in version 3.1: A negative pylong now raises <tt class="xref py py-exc docutils literal">OverflowError</tt>, not <tt class="xref py py-exc docutils literal">TypeError</tt>.

unsigned long <tt class="descname">PyLong_AsUnsignedLongMask</tt><big>(</big>PyObject *obj<big>)</big>¶

Return a C <tt class="xref c c-type docutils literal">unsigned long</tt> representation of obj.  If obj
is not an instance of <tt class="xref c c-type docutils literal">PyLongObject</tt>, first call its <tt class="xref py py-meth docutils literal">__int__()</tt>
method (if present) to convert it to a <tt class="xref c c-type docutils literal">PyLongObject</tt>.

If the value of obj is out of range for an <tt class="xref c c-type docutils literal">unsigned long</tt>,
return the reduction of that value modulo <tt class="xref py py-const docutils literal">ULONG_MAX + 1</tt>.

unsigned PY_LONG_LONG <tt class="descname">PyLong_AsUnsignedLongLongMask</tt><big>(</big>PyObject *obj<big>)</big>¶

Return a C <tt class="xref c c-type docutils literal">unsigned long long</tt> representation of obj.  If obj
is not an instance of <tt class="xref c c-type docutils literal">PyLongObject</tt>, first call its <tt class="xref py py-meth docutils literal">__int__()</tt>
method (if present) to convert it to a <tt class="xref c c-type docutils literal">PyLongObject</tt>.

If the value of obj is out of range for an <tt class="xref c c-type docutils literal">unsigned long long</tt>,
return the reduction of that value modulo <tt class="xref py py-const docutils literal">PY_ULLONG_MAX + 1</tt>.

double <tt class="descname">PyLong_AsDouble</tt><big>(</big>PyObject *pylong<big>)</big>¶

Return a C <tt class="xref c c-type docutils literal">double</tt> representation of pylong.  pylong must be
an instance of <tt class="xref c c-type docutils literal">PyLongObject</tt>.

Raise <tt class="xref py py-exc docutils literal">OverflowError</tt> if the value of pylong is out of range for a
<tt class="xref c c-type docutils literal">double</tt>.

void* <tt class="descname">PyLong_AsVoidPtr</tt><big>(</big>PyObject *pylong<big>)</big>¶

Convert a Python integer pylong to a C <tt class="xref c c-type docutils literal">void</tt> pointer.
If pylong cannot be converted, an <tt class="xref py py-exc docutils literal">OverflowError</tt> will be raised.  This
is only assured to produce a usable <tt class="xref c c-type docutils literal">void</tt> pointer for values created
with <tt class="xref c c-func docutils literal">PyLong_FromVoidPtr()</tt>.

Previous topic

The None Object

Next topic

Boolean Objects

This Page

Report a Bug

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>

    Enter search terms or a module, class or function name.

Navigation

          index

          modules |

          next |

          previous |

Python »

          3.3.6 Documentation »

Python/C API Reference Manual »

Concrete Objects Layer »

    © Copyright 1990-2014, Python Software Foundation.

    The Python Software Foundation is a non-profit corporation.
    Please donate.

    Last updated on Oct 12, 2014.
    Found a bug?

    Created using Sphinx 1.2.


text:
package org.kolich.cappuccino.http;

import org.apache.http.HttpVersion;
import org.apache.http.client.HttpClient;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.conn.params.ConnManagerParams;
import org.apache.http.conn.scheme.PlainSocketFactory;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.conn.ssl.SSLSocketFactory;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpParams;
import org.apache.http.params.HttpProtocolParams;

public class CappuccinoDefaultHttpClient {

	/**
	 * The various static Http schemes we support.
	 */
	private static final String HTTP = "http";
	private static final String HTTPS = "https";

	/**
	 * A default set of basic Http parameters.
	 */
	private static final BasicHttpParams defaultParams__;

	/**
	 * A connection manager of some sort, in our case, a
	 * ThreadSafeClientConnManager.
	 */
	private static final ClientConnectionManager manager__;

	/**
	 * A SchemeRegistry tells the HttpClient we must follow
	 * certain protocols on specific ports.  For example,
	 * Port 80 is always HTTP but Port 443 is always HTTPS.
	 */
	private static final SchemeRegistry scheme__;

	/**
	 * "THE" HttpClient of them all; the Big Kahuna;
	 * the head honcho; he's a singleton BTW
	 */
	private static final HttpClient client__;

	static {

		// The max number of connections per host is equal to the max
		// number of total connections.  This is our default.
		// We have the ability to configure the default maximum number
		// of connections allowed per host, and the default maximum
		// number of connections allowed overall.  In this case, we
		// make these equal to each other.
		defaultParams__ = new BasicHttpParams();
		ConnManagerParams.setMaxTotalConnections(defaultParams__,
				ConnManagerParams.getMaxTotalConnections( defaultParams__ ));
		HttpProtocolParams.setVersion(defaultParams__, HttpVersion.HTTP_1_1);

		// We supposedely have to tell the client to do
		// HTTP on some ports, and HTTPS on others.  It dosen't
		// figure that out on it's own anymore.  So the
		// scheme registry is how we tell it to do what, and
		// where.
		scheme__ = new SchemeRegistry();
		scheme__.register(
                new Scheme(HTTP, PlainSocketFactory.getSocketFactory(), 80));
		scheme__.register(
                new Scheme(HTTPS, SSLSocketFactory.getSocketFactory(), 443));

		manager__ = new ThreadSafeClientConnManager(defaultParams__, scheme__);

		// Get a new client instance with a default set of parameters we
		// setup here in this static context.
		client__ = getInstance(defaultParams__, manager__);

	}

	/**
	 * Shouldn't call this. We made the constructor private so
	 * the consumers of this class don't try to instantiate a new
	 * CappuccinoDefaultHttpClient for any reason.
	 */
	private CappuccinoDefaultHttpClient () {
		throw new Error("Not supposed to call this!");
	}

	/**
	 * Does the real work to instantiate a new HttpClient
	 * instance using the set HttpParams and requested
	 * ClientConnectionManager.  You can call this method
	 * to instantiate a new HttpClient with your own
	 * HttpClient parameters or connection manager.
	 * @return
	 */
	public static final HttpClient getInstance(
		HttpParams params, ClientConnectionManager manager ){
		return new DefaultHttpClient(manager, params);
	}

	/**
	 * Get a new thread safe HttpClient using the
	 * Cappuccino HttpClient defaults. This should be
	 * called when you just want to get the Cappuccino default
	 * HttpClient singleton. If you need your own special
	 * thread safe HttpClient with slightly tweaked connection
	 * parameters, then use the getInstance(HttpConnectionManagerParams)
	 * method instead.  Note that the HttpClient returned from
	 * this method has the DEFAULT Jre ProxySelector set which
	 * obeys web-proxy configurations.
	 * @return
	 */
	public static final HttpClient getDefaultInstance(){
		return client__;
	}

	/**
	 * Returns a clone of the default Cappuccino HttpClient
	 * parameters. If for any reason you need to get the
	 * default set of connection manager parameters, you can
	 * do so using this method.  This lets you read the
	 * defaults, tweak the HttpConnectionManagerParams with
	 * your own tunables and then get an HttpClient using
	 * your newly tweaked connection tunables.
	 * @return
	 */
	public static final BasicHttpParams getDefaultParameters(){
		try {
			return (BasicHttpParams)defaultParams__.clone();
		} catch (CloneNotSupportedException e) {
			throw new RuntimeException(e);
		}
	}

}


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright 2017 Yan Zhenjie.

    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

       http://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.
-->
<com.yanzhenjie.album.widget.SquareCardView xmlns:android="http://schemas.android.com/apk/res/android"
    style="@style/Album.Item.Card.MatchParent">

    <RelativeLayout style="@style/Album.MatchParent">

        <ImageView
            android:id="@+id/iv_album_content_image"
            style="@style/Album.MatchParent"
            android:contentDescription="@string/album_title"
            android:scaleType="centerCrop" />

        <com.yanzhenjie.album.widget.TransferLayout
            style="@style/Album.WrapContent.Transfer"
            android:layout_alignParentEnd="true"
            android:layout_alignParentRight="true">

            <android.support.v7.widget.AppCompatCheckBox
                android:id="@+id/check_box"
                style="@style/Album.CheckBox.WrapContent" />
        </com.yanzhenjie.album.widget.TransferLayout>

    </RelativeLayout>

    <FrameLayout
        android:id="@+id/layout_layer"
        style="@style/Album.MatchParent"
        android:background="@color/albumSheetLayer">

        <TextView
            style="@style/Album.WrapContent"
            android:layout_gravity="center"
            android:text="@string/album_item_unavailable"
            android:textColor="@color/albumFontLight"
            android:textSize="@dimen/album_sp_16" />

    </FrameLayout>

</com.yanzhenjie.album.widget.SquareCardView>


text:
import { Text } from 'react-native';
import PropTypes from 'prop-types';
import React from 'react';

const FloatingHeading = ({ style, children, ...rest }) => (
  <Text
    style={[
      {
        fontSize: 15,
        fontWeight: '600',
        // textAlign: 'center',
        // color: secondaryColor,
      },
      style,
    ]}
    {...rest}
  >
    {children}
  </Text>
);

FloatingHeading.propTypes = {
  style: PropTypes.any,
  children: PropTypes.any,
};

export default FloatingHeading;


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Mag = mko.Newton.OrderOfMagnitude;

namespace mko.Newton
{
    /// <summary>
    /// Messwerte von erfassten Wegen/Strecken
    /// </summary>
    public abstract partial class Length : MeasuredVector
    {
        public Length(int Dimension) : base(Dimension) { }
        public Length(params double[] coordinates) : base(coordinates) { }

        public Length(Length mVector) : base(mVector) { }

        public override string SiBaseUnitId
        {
            get { return "s"; }
        }

        public override string SiBaseUnitDefinition
        {
            get { return "The SI base unit of length, defined as the length of the path travelled by light in absolute vacuum during 1/299792458 of a second."; }
        }

    }
}


text:
package org.jivesoftware.openfire.plugin;

import java.io.File;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import org.jivesoftware.openfire.PresenceManager;
import org.jivesoftware.openfire.XMPPServer;
import org.jivesoftware.openfire.container.Plugin;
import org.jivesoftware.openfire.container.PluginManager;
import org.jivesoftware.openfire.user.User;
import org.jivesoftware.openfire.user.UserManager;
import org.jivesoftware.openfire.user.UserNotFoundException;
import org.jivesoftware.util.JiveGlobals;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xmpp.component.Component;
import org.xmpp.component.ComponentManager;
import org.xmpp.component.ComponentManagerFactory;
import org.xmpp.packet.JID;
import org.xmpp.packet.Packet;
import org.xmpp.packet.Presence;

/**
 * Plugin that includes a servlet that provides information about users' and components'
 * presence in the server. For security reasons, the XMPP spec does not allow anyone to see
 * the presence of any user. Only the users that are subscribed to the presence of other
 * users may see their presences.

 *
 * However, in order to make the servlet more useful it is possible to configure this plugin
 * so that anyone or only the users that are subscribed to a user presence may see the presence
 * of other users.

 *
 * Currently, the servlet provides presence information in two formats: 1) In XML format
 * and 2) using images.

 *
 * The presence plugin is also a component so that it can probe presences of other components.
 * The new component will use <tt>presence</tt> as the subdomain subdomain.
 *
 * @author Gaston Dombiak
 */
public class PresencePlugin implements Plugin, Component {

	private static final Logger Log = LoggerFactory.getLogger(PresencePlugin.class);

    private static final String subdomain = "presence";

    private UserManager userManager;
    private PresenceManager presenceManager;
    private PluginManager pluginManager;
    private ComponentManager componentManager;
    private String hostname;
    private Map<String, Presence> probedPresence;
    private JID componentJID;

    public void initializePlugin(PluginManager manager, File pluginDirectory) {
        pluginManager = manager;
        XMPPServer server = XMPPServer.getInstance();
        userManager = server.getUserManager();
        presenceManager = server.getPresenceManager();
        hostname = server.getServerInfo().getXMPPDomain();
        probedPresence = new ConcurrentHashMap<String, Presence>();
        componentJID = new JID(subdomain + "." + hostname);
        // Register new component
        componentManager = ComponentManagerFactory.getComponentManager();
        try {
            componentManager.addComponent(subdomain, this);
        }
        catch (Exception e) {
            Log.error(e.getMessage(), e);
        }
    }

    public void destroyPlugin() {
        userManager = null;
        presenceManager = null;
        // Remove presence plugin component
        try {
            componentManager.removeComponent(subdomain);
            componentManager = null;
        }
        catch (Exception e) {
            Log.error(e.getMessage(), e);
        }
    }

    public String getName() {
        return pluginManager.getName(this);
    }

    public String getDescription() {
        return pluginManager.getDescription(this);
    }

    public void initialize(JID jid, ComponentManager componentManager) {
    }

    public void start() {
    }

    public void shutdown() {
    }

    public void processPacket(Packet packet) {
        // Check that we are getting an answer to a presence probe
        if (packet instanceof Presence) {
            Presence presence = (Presence) packet;
            if (presence.isAvailable() || presence.getType() == Presence.Type.unavailable ||
                    presence.getType() == Presence.Type.error) {
                // Store answer of presence probes
                probedPresence.put(presence.getFrom().toString(), presence);
            }
        }
    }

    /**
     * Returns true if anyone is allowed to see the presence of other users. False means that
     * only the users that are subscribed to a user presence will be able to get information
     * about the user. By default, presence information is not publicly available.
     *
     * @return true if anyone is allowed to see the presence of other users.
     */
    public boolean isPresencePublic() {
        return JiveGlobals.getBooleanProperty("plugin.presence.public", false);
    }

    /**
     * Sets if anyone is allowed to see the presence of other users. A false value means that
     * only the users that are subscribed to a user presence will be able to get information
     * about the user. By default, presence information is not publicly available.
     *
     * @param presencesPublic if anyone is allowed to see the presence of other users.
     */
    public void setPresencePublic(boolean presencesPublic) {
        JiveGlobals.setProperty("plugin.presence.public", presencesPublic ? "true" : "false");
    }

    /**
     * Returns the status message for the unavailable presence. This setting allows
     * a different string to be used for the status on this presence which is
     * "Unavailable" by default.
     *
     * @return the status message for the unavailable presence.
     */
    public String getUnavailableStatus() {
        return JiveGlobals.getProperty("plugin.presence.unavailable.status", "Unavailable");
    }

    /**
     * Sets the status message for the unavailable presence. This setting allows
     * a different string to be used for the status on this presence which is
     * "Unavailable" by default.
     *
     * @param statusMessage the status message for the unavailable presence.
     */
    public void setUnavailableStatus(String statusMessage) {
        JiveGlobals.setProperty("plugin.presence.unavailable.status", statusMessage);
    }

    /**
     * Returns the presence of the requested user or <tt>null</tt> if the user is offline. If
     * presences are not public then the user presence will be returned if and only if the sender
     * of the request is subscribed to the user presence.
     *
     * @param sender the bare JID of the user making the request.
     * @param jid the bare JID of the entity whose presence is being probed.
     * @return the presence of the requested user.
     * @throws UserNotFoundException If presences are not public and the sender is null or the
     *         sender cannot probe the presence of the requested user. Or if the requested user
     *         does not exist in the local server.
     */
    public Presence getPresence(String sender, String jid) throws UserNotFoundException {
        if (jid == null) {
            throw new UserNotFoundException("Target JID not found in request");
        }
        JID targetJID = new JID(jid);
        // Check that the sender is not requesting information of a remote server entity
        if (targetJID.getDomain() == null || XMPPServer.getInstance().isRemote(targetJID)) {
            throw new UserNotFoundException("Domain does not matches local server domain");
        }
        if (!hostname.equals(targetJID.getDomain())) {
            // Sender is requesting information about component presence, so we send a
            // presence probe to the component.
            presenceManager.probePresence(componentJID, targetJID);

            // Wait 30 seconds until we get the probe presence result
            int count = 0;
            Presence presence = probedPresence.get(jid);
            while (presence == null) {
                if (count > 300) {
                    // After 30 seconds, timeout
                    throw new UserNotFoundException(
                            "Request for component presence has timed-out.");
                }
                try {
                    Thread.sleep(100);
                }
                catch (InterruptedException e) {
                    // don't care!
                }
                presence = probedPresence.get(jid);

                count++;
            }
            // Clean-up probe presence result
            probedPresence.remove(jid);
            // Return component presence
            return presence;
        }
        if (targetJID.getNode() == null ||
                !UserManager.getInstance().isRegisteredUser(targetJID.getNode())) {
            // Sender is requesting presence information of an anonymous user
            throw new UserNotFoundException("Username is null");
        }
        if (!isPresencePublic()) {
            if (sender == null) {
                throw new UserNotFoundException("Sender is null");
            }
            else if (!presenceManager.canProbePresence(new JID(sender), targetJID.getNode())) {
                throw new UserNotFoundException("Sender is not allowed to probe this user");
            }
        }
        User user = userManager.getUser(targetJID.getNode());
        return presenceManager.getPresence(user);
    }
}


text:
package com.shekhargulati.java8_tutorial.ch01;

public class App2 implements B, D {
    public static void main(String[] args) {
        new App2().doSth();
    }
}

interface B {
    default void doSth() {
        System.out.println("inside B");
    }
}

interface D extends B {
    default void doSth() {
        System.out.println("inside D");
    }
}


text:
hello-world
===========

My first repository on GitHub.


text:
    <meta content='Scribble' property='og:title' />
    <title>Scribble</title>
    <link href='http://localhost:4000/images/fav.png' rel='shortcut icon'>
    <link rel="stylesheet" href="http://localhost:4000/stylesheets/style.css"/>
    <meta content='width=device-width, initial-scale=1.0, user-scalable=no' name='viewport'>
    <meta content='text/html; charset=utf-8' http-equiv='content-type' />
    <meta content='http://localhost:4000' property='og:url' />
    <meta content="Something about Iris and her data work." property='og:description' />
    <meta content="blog" property="og:type" />

      Home


text:
@implementation Expression

@synthesize value;

- (id)initWithSyntaxTree:(CPSyntaxTree *)syntaxTree
{
    self = [self init];

    if (nil != self)
    {
        NSArray *components = [syntaxTree children];
        if ([components count] == 1)
        {
            [self setValue:[(Term *)[components objectAtIndex:0] value]];
        }
        else
        {
            [self setValue:[(Expression *)[components objectAtIndex:0] value] + [(Term *)[components objectAtIndex:2] value]];
        }
    }

    return self;
}

@end


text:
package org.drools.games.wumpus;

public interface Command {

}


text:
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames
// Copyright (C) 2015 Faust Logic, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//

#include <typeinfo>
#include "afx/arcaneFX.h"
#include "afx/afxEffectDefs.h"
#include "afx/afxEffectWrapper.h"
#include "afx/ce/afxAnimLock.h"

//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
// afxEA_AnimLock

class afxEA_AnimLock : public afxEffectWrapper
{
  typedef afxEffectWrapper Parent;

  bool              started;
  U32               lock_tag;

public:
  /*C*/             afxEA_AnimLock();

  virtual bool      ea_update(F32 dt);
  virtual void      ea_finish(bool was_stopped);
};

//~~~~~~~~~~~~~~~~~~~~//

afxEA_AnimLock::afxEA_AnimLock()
{
  started = false;
  lock_tag = 0;
}

bool afxEA_AnimLock::ea_update(F32 dt)
{
  afxConstraint* pos_constraint = getPosConstraint();
  if (!started && pos_constraint != 0)
  {
    lock_tag = pos_constraint->lockAnimation();
    started = true;
  }

  return true;
}

void afxEA_AnimLock::ea_finish(bool was_stopped)
{
  afxConstraint* pos_constraint = getPosConstraint();
  if (pos_constraint && lock_tag != 0)
  {
    pos_constraint->unlockAnimation(lock_tag);
  }

  started = false;
}

//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//

class afxEA_AnimLockDesc : public afxEffectAdapterDesc, public afxEffectDefs
{
  static afxEA_AnimLockDesc desc;

public:
  virtual bool  testEffectType(const SimDataBlock*) const;
  virtual bool  requiresStop(const afxEffectWrapperData*, const afxEffectTimingData&) const;
  virtual bool  runsOnServer(const afxEffectWrapperData*) const { return true; }
  virtual bool  runsOnClient(const afxEffectWrapperData*) const { return true; }
  virtual bool  isPositional(const afxEffectWrapperData*) const { return false; }

  virtual afxEffectWrapper* create() const { return new afxEA_AnimLock; }
};

afxEA_AnimLockDesc afxEA_AnimLockDesc::desc;

bool afxEA_AnimLockDesc::testEffectType(const SimDataBlock* db) const
{
  return (typeid(afxAnimLockData) == typeid(*db));
}

bool afxEA_AnimLockDesc::requiresStop(const afxEffectWrapperData* ew, const afxEffectTimingData& timing) const
{
  return (timing.lifetime < 0);
}

//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//


text:
{% extends "cradmin_legacy/base.django.html" %}
{% load devilry_theme3_tags %}

{% block title %}
    WCAG debug
{% endblock title %}

{% block content %}

        Simple link without class directly in body (deprecated)

        Link with class plain-link directly in body

        Simple link without class directly in body (deprecated)

        Link with class plain-link directly in body

        Simple link without class directly in body (deprecated)

        Link with class plain-link directly in body

                        admin role link

                        examiner role link

                        student role link

        {% comment %}
Testing here

Testing here

Testing here

Testing here

Testing here

Testing here
 {% endcomment %}

            alert success

            alert info

            alert warning

            alert danger

        focus styled container

        success styled container

        info styled container

        warning styled container

        danger styled container

                            Search

                            <input id="cradmin_legacy_listfilter_search_input" type="text" class="form-control ng-isolate-scope" placeholder="Search ..." value="" aria-controls="cradmin_legacy_listbuilderview_listwrapper" cradmin-legacy-listfilter-urlpattern="#" cradmin-legacy-listfilter-emptyvalue-url="#" cradmin-legacy-listfilter-textinput="{"loadingmessage": "Searching", "timeout_milliseconds": 500, "urlpattern_replace_text": "_-_TEXTINPUT_-_VALUE_-_"}">
                            <button type="button" class="btn btn-link cradmin-legacy-clearable-textinput-button" cradmin-legacy-clearable-textinput="#cradmin_legacy_listfilter_search_input" aria-label="Clear Search">

                            </button>

                            subject.period - Assignment

                                Status:

                                    waiting for deliveries

                                Deadline:

                                Thursday March 15, 2040, 23:59

                                    0 comments from student.

                                    1 files from student.

                                    2 comments from examiner.

                                Stud Ent
                                (student@example.com)

                                Status:

                                waiting for deliveries

                                Deadline:

                                Tuesday January 31, 2040, 12:30

                                    0 comment from student.

                                    1 files from student.

                                    2 comment from examiner.

                                Stud Ent
                                (student@example.com)

                                Status:

                                waiting for deliveries

                                Deadline:

                                Tuesday January 31, 2040, 12:30

                                    0 comment from student.

                                    1 files from student.

                                    2 comment from examiner.

                                            Feb 8 2016, 20:00
                                        :

                                            Deadline expired

                                            Oct 15 2018, 11:54
                                        :

                                                This delivery was corrected, and given:

                                                    passed

                                                    (1/1)

                                            by

                                                        Exa Miner
                                                        (examiner@example.com)

                                            Oct 15 2018, 11:54
                                        :

                                                This delivery was corrected, and given:

                                                    failed

                                                    (0/1)

                                            by

                                                        Exa Miner
                                                        (examiner@example.com)

        <hello-world data-what="cruel"></hello-world>
        <custom-button data-what="fancy"></custom-button>
        <custom-button data-what="shitty"></custom-button>

{% endblock content %}


text:
<?php

namespace Lug\Component\Grid\Tests\Sort\Type;

use Lug\Component\Grid\DataSource\DataSourceBuilderInterface;
use Lug\Component\Grid\Sort\Type\ResourceType;
use Lug\Component\Grid\Sort\Type\TypeInterface;
use Lug\Component\Registry\Model\RegistryInterface;
use Lug\Component\Resource\Model\ResourceInterface;
use Lug\Component\Resource\Repository\RepositoryInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

/**
 * @author GeLo <geloen.eric@gmail.com>
 */
class ResourceTypeTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var ResourceType
     */
    private $type;

    /**
     * @var \PHPUnit_Framework_MockObject_MockObject|RegistryInterface
     */
    private $resourceRegistry;

    /**
     * @var \PHPUnit_Framework_MockObject_MockObject|RegistryInterface
     */
    private $repositoryRegistry;

    /**
     * {@inheritdoc}
     */
    protected function setUp()
    {
        $this->resourceRegistry = $this->createServiceRegistryMock();
        $this->repositoryRegistry = $this->createServiceRegistryMock();

        $this->type = new ResourceType($this->resourceRegistry, $this->repositoryRegistry);
    }

    public function testInheritance()
    {
        $this->assertInstanceOf(TypeInterface::class, $this->type);
    }

    public function testSort()
    {
        $builder = $this->createDataSourceBuilderMock();
        $builder
            ->expects($this->once())
            ->method('getAliases')
            ->will($this->returnValue([]));

        $builder
            ->expects($this->once())
            ->method('getProperty')
            ->with($this->identicalTo($resourceField = 'resource_field'))
            ->will($this->returnValue($resourceProperty = 'resource_property'));

        $builder
            ->expects($this->once())
            ->method('leftJoin')
            ->with(
                $this->identicalTo($resourceProperty),
                $this->identicalTo($resourceField)
            );

        $resource = $this->createResourceMock();
        $resource
            ->expects($this->once())
            ->method('getName')
            ->will($this->returnValue($name = 'name'));

        $resource
            ->expects($this->once())
            ->method('getLabelPropertyPath')
            ->will($this->returnValue($resourcePath = 'resource_path'));

        $this->repositoryRegistry
            ->expects($this->once())
            ->method('offsetGet')
            ->with($this->identicalTo($name))
            ->will($this->returnValue($repository = $this->createRepositoryMock()));

        $repository
            ->expects($this->once())
            ->method('getProperty')
            ->with(
                $this->identicalTo($resourceField),
                $this->identicalTo($resourcePath)
            )
            ->will($this->returnValue($property = 'property'));

        $builder
            ->expects($this->once())
            ->method('orderBy')
            ->with(
                $this->identicalTo($property),
                $this->identicalTo($data = 'data')
            );

        $this->type->sort($data, [
            'resource' => $resource,
            'builder'  => $builder,
            'field'    => $resourceField,
        ]);
    }

    public function testSortWithJoin()
    {
        $builder = $this->createDataSourceBuilderMock();
        $builder
            ->expects($this->once())
            ->method('getAliases')
            ->will($this->returnValue([$resourceField = 'resource_field']));

        $resource = $this->createResourceMock();
        $resource
            ->expects($this->once())
            ->method('getName')
            ->will($this->returnValue($name = 'name'));

        $resource
            ->expects($this->once())
            ->method('getLabelPropertyPath')
            ->will($this->returnValue($resourcePath = 'resource_path'));

        $this->repositoryRegistry
            ->expects($this->once())
            ->method('offsetGet')
            ->with($this->identicalTo($name))
            ->will($this->returnValue($repository = $this->createRepositoryMock()));

        $repository
            ->expects($this->once())
            ->method('getProperty')
            ->with(
                $this->identicalTo($resourceField),
                $this->identicalTo($resourcePath)
            )
            ->will($this->returnValue($property = 'property'));

        $builder
            ->expects($this->once())
            ->method('orderBy')
            ->with(
                $this->identicalTo($property),
                $this->identicalTo($data = 'data')
            );

        $this->type->sort($data, [
            'resource' => $resource,
            'builder'  => $builder,
            'field'    => $resourceField,
        ]);
    }

    public function testConfigureOptions()
    {
        $this->type->configureOptions($resolver = new OptionsResolver());

        $this->assertSame($options = [
            'field'    => 'field',
            'resource' => $this->createResourceMock(),
        ], $resolver->resolve($options));
    }

    public function testConfigureOptionsWithStringResource()
    {
        $this->type->configureOptions($resolver = new OptionsResolver());

        $this->resourceRegistry
            ->expects($this->once())
            ->method('offsetGet')
            ->with($this->identicalTo($name = 'name'))
            ->will($this->returnValue($resource = $this->createResourceMock()));

        $this->assertSame([
            'field'    => $field = 'field',
            'resource' => $resource,
        ], $resolver->resolve([
            'field'    => $field,
            'resource' => $name,
        ]));
    }

    /**
     * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
     */
    public function testConfigureOptionsWithInvalidResource()
    {
        $this->type->configureOptions($resolver = new OptionsResolver());

        $resolver->resolve(['field' => 'field', 'resource' => true]);
    }

    public function testName()
    {
        $this->assertSame('resource', $this->type->getName());
    }

    /**
     * @return \PHPUnit_Framework_MockObject_MockObject|RegistryInterface
     */
    private function createServiceRegistryMock()
    {
        return $this->createMock(RegistryInterface::class);
    }

    /**
     * @return \PHPUnit_Framework_MockObject_MockObject|DataSourceBuilderInterface
     */
    private function createDataSourceBuilderMock()
    {
        return $this->createMock(DataSourceBuilderInterface::class);
    }

    /**
     * @return \PHPUnit_Framework_MockObject_MockObject|ResourceInterface
     */
    private function createResourceMock()
    {
        return $this->createMock(ResourceInterface::class);
    }

    /**
     * @return \PHPUnit_Framework_MockObject_MockObject|RepositoryInterface
     */
    private function createRepositoryMock()
    {
        return $this->createMock(RepositoryInterface::class);
    }
}


text:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/splash"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:screenOrientation="portrait"
    tools:context=".MainActivity" >

    <RadioGroup
        android:id="@+id/rg"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:textColor="@android:color/white" >

        <RadioButton
            android:id="@+id/rDovahzul"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="Search in Dovahzul"
            android:textColor="@android:color/white" />

        <RadioButton
            android:id="@+id/rEnglish"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:checked="true"
            android:text="Search in English"
            android:textColor="@android:color/white" />
    </RadioGroup>

    <EditText
        android:id="@+id/tvSearch"
        android:textCursorDrawable="@null"
        android:layout_width="wrap_content"
        android:layout_height="39dip"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/rg"
        android:layout_toLeftOf="@+id/bSearch"
        android:background="@null"
        android:ems="10"
        android:hint="Type the words to search here"
        android:singleLine="true" />

    <requestFocus />

    <Button
        android:id="@+id/search"
        android:layout_width="wrap_content"
        android:layout_height="39dip"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/rg"
        android:background="#55a6a6a6"
        android:text="Search"
        android:textColor="@android:color/white" />

    <CheckBox
        android:id="@+id/exactMatch"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/tvSearch"
        android:layout_below="@+id/tvSearch"
        android:text="Only display exact matches?"
        android:textColor="@android:color/white"
        android:textSize="14sp" />

</RelativeLayout>


text:
FROM linuxkit/alpine:0c069d0fd7defddb6e03925fcd4915407db0c9e1 AS mirror
RUN mkdir -p /out/etc/apk && cp -r /etc/apk/* /out/etc/apk/
RUN apk add --no-cache --initdb -p /out  \
    alpine-baselayout \
    busybox

# Remove apk residuals
RUN rm -rf /out/etc/apk /out/lib/apk /out/var/cache

FROM scratch
ENTRYPOINT []
WORKDIR /
COPY --from=mirror /out/ /

COPY loopy.sh /usr/bin/loopy
RUN chmod +x /usr/bin/loopy

CMD ["/usr/bin/loopy"]


text:
package org.apache.camel;

import javax.xml.bind.annotation.XmlEnum;

/**
 * Level of granularity for performance statistics enabled
 *
 * @version
 */
@XmlEnum
public enum ManagementStatisticsLevel {

    All, RoutesOnly, Off

}


text: "use strict";module.exports=require("./components/spinner/Spinner");


text:
module Azure::Network::Mgmt::V2019_11_01
  module Models
    #
    # Defines values for HubVirtualNetworkConnectionStatus
    #
    module HubVirtualNetworkConnectionStatus
      Unknown = "Unknown"
      Connecting = "Connecting"
      Connected = "Connected"
      NotConnected = "NotConnected"
    end
  end
end


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Novitates Mycologicae Novissimae 113 (1947)

#### Original name
Crustula fraxini Velen.

### Remarks
null