text:
The GRA uses its own database to store reading program data. This database can be completely segregated from any other databases on the same SQL Server.

There are two options when creating the database: you can execute a script or manually create the database and users using [SQL Server Management Studio (SSMS)](https://msdn.microsoft.com/en-us/library/ms174173.aspx).

### From a script

1. Connect to the database server to run a query (this can be done with SQL Server Management Studio by right-clicking on the server in the Object Explorer on the left and choosing **New Query**).
2. Copy the text from the [database create script](https://raw.githubusercontent.com/MCLD/greatreadingadventure/develop/db/SQL-Server-createdb.sql) and paste it into the query window.
3. Click the **Execute** button in the toolbar.

### From the user interface

#### Create the database
1. Launch SQL Server Management Studio and connect to the database server.
2. Double-click the server name to show the **Databases** folder.
3. Right-click on the **Databases** folder and select the **New Database...** option.
4. In the New Database window, enter a database name, for example: `SRP`.
5. If you wish to have the database files stored in a [different location than the default](https://support.microsoft.com/en-us/kb/2033523), scroll the **Database files** list to the right and change the presented **Path** to where you'd like to store the database files.
6. Select **Options** from the page list on the left.
7. For the [**Recovery model** drop-down](https://msdn.microsoft.com/en-us/library/ms189275.aspx), change the selection from `Full` to `Simple`.
8. Select **OK** to create the database.

#### Create the logins and users

1. Right-click the **Security** folder and select **New** **->** **Login...**.
2. Enter the **Login name** for the database owner user, for example: `srp_owner`.
3. Select `SQL Server authentication`.
4. Enter a secure password for this user in the **Password** and **Confirm password** fields. Make a note of this password.
5. You can uncheck `Enforce password policy` so that the password for this account will not expire.
6. Select `User mapping` from the **Select a page** list on the left.
7. Locate the name of the database (this tutorial used `SRP` in *Create the database* step 4 above) in the **Users mapped to this login** list on the left.
8. Check the appropriate box in the `Map` column to map this login to a user in the database.
9. In the **Database role membership for:** list, select `db_owner`.
10. Select **OK** to create the login and user.


text:
package javax.crypto;

import java.util.StringTokenizer;
import java.util.NoSuchElementException;
import java.security.AlgorithmParameters;
import java.security.Provider;
import java.security.Key;
import java.security.SecureRandom;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.InvalidKeyException;
import java.security.InvalidAlgorithmParameterException;
import java.security.ProviderException;
import java.security.spec.AlgorithmParameterSpec;

import java.nio.ByteBuffer;

/**
 * This class defines the Service Provider Interface (SPI)
 * for the Cipher class.
 * All the abstract methods in this class must be implemented by each
 * cryptographic service provider who wishes to supply the implementation
 * of a particular cipher algorithm.
 *
 *
In order to create an instance of Cipher, which
 * encapsulates an instance of this CipherSpi class, an
 * application calls one of the
 * {@link Cipher#getInstance(java.lang.String) getInstance}
 * factory methods of the
 * {@link Cipher Cipher} engine class and specifies the requested
 * transformation.
 * Optionally, the application may also specify the name of a provider.
 *
 *
A transformation is a string that describes the operation (or
 * set of operations) to be performed on the given input, to produce some
 * output. A transformation always includes the name of a cryptographic
 * algorithm (e.g., DES), and may be followed by a feedback mode and
 * padding scheme.
 *
 *
 A transformation is of the form:
 *
 *

 *
"algorithm/mode/padding" or
 *
 *
"algorithm"
 *

 *
 *
 (in the latter case,
 * provider-specific default values for the mode and padding scheme are used).
 * For example, the following is a valid transformation:
 *
 *

 *     Cipher c = Cipher.getInstance("DES/CBC/PKCS5Padding");
 *

 *
 *
A provider may supply a separate class for each combination
 * of algorithm/mode/padding, or may decide to provide more generic
 * classes representing sub-transformations corresponding to
 * algorithm or algorithm/mode or algorithm//padding
 * (note the double slashes),
 * in which case the requested mode and/or padding are set automatically by
 * the getInstance methods of Cipher, which invoke
 * the {@link #engineSetMode(java.lang.String) engineSetMode} and
 * {@link #engineSetPadding(java.lang.String) engineSetPadding}
 * methods of the provider's subclass of CipherSpi.
 *
 *
A Cipher property in a provider master class may have one of
 * the following formats:
 *
 *

 *
 *

 *

 *     // provider's subclass of "CipherSpi" implements "algName" with
 *     // pluggable mode and padding
 *     Cipher.algName
 *

 *
 *

 *

 *     // provider's subclass of "CipherSpi" implements "algName" in the
 *     // specified "mode", with pluggable padding
 *     Cipher.algName/mode
 *

 *
 *

 *

 *     // provider's subclass of "CipherSpi" implements "algName" with the
 *     // specified "padding", with pluggable mode
 *     Cipher.algName//padding
 *

 *
 *

 *

 *     // provider's subclass of "CipherSpi" implements "algName" with the
 *     // specified "mode" and "padding"
 *     Cipher.algName/mode/padding
 *

 *
 *

 *
 *
For example, a provider may supply a subclass of CipherSpi
 * that implements DES/ECB/PKCS5Padding, one that implements
 * DES/CBC/PKCS5Padding, one that implements
 * DES/CFB/PKCS5Padding, and yet another one that implements
 * DES/OFB/PKCS5Padding. That provider would have the following
 * Cipher properties in its master class:
 *
 *

 *
 *

 *

 *     Cipher.DES/ECB/PKCS5Padding
 *

 *
 *

 *

 *     Cipher.DES/CBC/PKCS5Padding
 *

 *
 *

 *

 *     Cipher.DES/CFB/PKCS5Padding
 *

 *
 *

 *

 *     Cipher.DES/OFB/PKCS5Padding
 *

 *
 *

 *
 *
Another provider may implement a class for each of the above modes
 * (i.e., one class for ECB, one for CBC, one for CFB,
 * and one for OFB), one class for PKCS5Padding,
 * and a generic DES class that subclasses from CipherSpi.
 * That provider would have the following
 * Cipher properties in its master class:
 *
 *

 *
 *

 *

 *     Cipher.DES
 *

 *
 *

 *
 *
The getInstance factory method of the Cipher
 * engine class follows these rules in order to instantiate a provider's
 * implementation of CipherSpi for a
 * transformation of the form "algorithm":
 *
 *

 *

 * Check if the provider has registered a subclass of CipherSpi
 * for the specified "algorithm".
 *
If the answer is YES, instantiate this
 * class, for whose mode and padding scheme default values (as supplied by
 * the provider) are used.
 *
If the answer is NO, throw a NoSuchAlgorithmException
 * exception.
 *

 *
 *
The getInstance factory method of the Cipher
 * engine class follows these rules in order to instantiate a provider's
 * implementation of CipherSpi for a
 * transformation of the form "algorithm/mode/padding":
 *
 *

 *

 * Check if the provider has registered a subclass of CipherSpi
 * for the specified "algorithm/mode/padding" transformation.
 *
If the answer is YES, instantiate it.
 *
If the answer is NO, go to the next step.
 *

 * Check if the provider has registered a subclass of CipherSpi
 * for the sub-transformation "algorithm/mode".
 *
If the answer is YES, instantiate it, and call
 * engineSetPadding(padding) on the new instance.
 *
If the answer is NO, go to the next step.
 *

 * Check if the provider has registered a subclass of CipherSpi
 * for the sub-transformation "algorithm//padding" (note the double
 * slashes).
 *
If the answer is YES, instantiate it, and call
 * engineSetMode(mode) on the new instance.
 *
If the answer is NO, go to the next step.
 *

 * Check if the provider has registered a subclass of CipherSpi
 * for the sub-transformation "algorithm".
 *
If the answer is YES, instantiate it, and call
 * engineSetMode(mode) and
 * engineSetPadding(padding) on the new instance.
 *
If the answer is NO, throw a NoSuchAlgorithmException
 * exception.
 *

 *
 * @author Jan Luehe
 * @see KeyGenerator
 * @see SecretKey
 * @since 1.4
 */

public abstract class CipherSpi {

    /**
     * Sets the mode of this cipher.
     *
     * @param mode the cipher mode
     *
     * @exception NoSuchAlgorithmException if the requested cipher mode does
     * not exist
     */
    protected abstract void engineSetMode(String mode)
        throws NoSuchAlgorithmException;

    /**
     * Sets the padding mechanism of this cipher.
     *
     * @param padding the padding mechanism
     *
     * @exception NoSuchPaddingException if the requested padding mechanism
     * does not exist
     */
    protected abstract void engineSetPadding(String padding)
        throws NoSuchPaddingException;

    /**
     * Returns the block size (in bytes).
     *
     * @return the block size (in bytes), or 0 if the underlying algorithm is
     * not a block cipher
     */
    protected abstract int engineGetBlockSize();

    /**
     * Returns the length in bytes that an output buffer would
     * need to be in order to hold the result of the next update
     * or doFinal operation, given the input length
     * inputLen (in bytes).
     *
     *
This call takes into account any unprocessed (buffered) data from a
     * previous update call, padding, and AEAD tagging.
     *
     *
The actual output length of the next update or
     * doFinal call may be smaller than the length returned by
     * this method.
     *
     * @param inputLen the input length (in bytes)
     *
     * @return the required output buffer size (in bytes)
     */
    protected abstract int engineGetOutputSize(int inputLen);

    /**
     * Returns the initialization vector (IV) in a new buffer.
     *
     *
 This is useful in the context of password-based encryption or
     * decryption, where the IV is derived from a user-provided passphrase.
     *
     * @return the initialization vector in a new buffer, or null if the
     * underlying algorithm does not use an IV, or if the IV has not yet
     * been set.
     */
    protected abstract byte[] engineGetIV();

    /**
     * Returns the parameters used with this cipher.
     *
     *
The returned parameters may be the same that were used to initialize
     * this cipher, or may contain a combination of default and random
     * parameter values used by the underlying cipher implementation if this
     * cipher requires algorithm parameters but was not initialized with any.
     *
     * @return the parameters used with this cipher, or null if this cipher
     * does not use any parameters.
     */
    protected abstract AlgorithmParameters engineGetParameters();

    /**
     * Initializes this cipher with a key and a source
     * of randomness.
     *
     *
The cipher is initialized for one of the following four operations:
     * encryption, decryption, key wrapping or key unwrapping, depending on
     * the value of opmode.
     *
     *
If this cipher requires any algorithm parameters that cannot be
     * derived from the given key, the underlying cipher
     * implementation is supposed to generate the required parameters itself
     * (using provider-specific default or random values) if it is being
     * initialized for encryption or key wrapping, and raise an
     * InvalidKeyException if it is being
     * initialized for decryption or key unwrapping.
     * The generated parameters can be retrieved using
     * {@link #engineGetParameters() engineGetParameters} or
     * {@link #engineGetIV() engineGetIV} (if the parameter is an IV).
     *
     *
If this cipher requires algorithm parameters that cannot be
     * derived from the input parameters, and there are no reasonable
     * provider-specific default values, initialization will
     * necessarily fail.
     *
     *
If this cipher (including its underlying feedback or padding scheme)
     * requires any random bytes (e.g., for parameter generation), it will get
     * them from random.
     *
     *
Note that when a Cipher object is initialized, it loses all
     * previously-acquired state. In other words, initializing a Cipher is
     * equivalent to creating a new instance of that Cipher and initializing
     * it.
     *
     * @param opmode the operation mode of this cipher (this is one of
     * the following:
     * ENCRYPT_MODE, DECRYPT_MODE,
     * WRAP_MODE or UNWRAP_MODE)
     * @param key the encryption key
     * @param random the source of randomness
     *
     * @exception InvalidKeyException if the given key is inappropriate for
     * initializing this cipher, or requires
     * algorithm parameters that cannot be
     * determined from the given key.
     * @throws UnsupportedOperationException if {@code opmode} is
     * {@code WRAP_MODE} or {@code UNWRAP_MODE} is not implemented
     * by the cipher.
     */
    protected abstract void engineInit(int opmode, Key key,
                                       SecureRandom random)
        throws InvalidKeyException;

    /**
     * Initializes this cipher with a key, a set of
     * algorithm parameters, and a source of randomness.
     *
     *
The cipher is initialized for one of the following four operations:
     * encryption, decryption, key wrapping or key unwrapping, depending on
     * the value of opmode.
     *
     *
If this cipher requires any algorithm parameters and
     * params is null, the underlying cipher implementation is
     * supposed to generate the required parameters itself (using
     * provider-specific default or random values) if it is being
     * initialized for encryption or key wrapping, and raise an
     * InvalidAlgorithmParameterException if it is being
     * initialized for decryption or key unwrapping.
     * The generated parameters can be retrieved using
     * {@link #engineGetParameters() engineGetParameters} or
     * {@link #engineGetIV() engineGetIV} (if the parameter is an IV).
     *
     *
If this cipher requires algorithm parameters that cannot be
     * derived from the input parameters, and there are no reasonable
     * provider-specific default values, initialization will
     * necessarily fail.
     *
     *
If this cipher (including its underlying feedback or padding scheme)
     * requires any random bytes (e.g., for parameter generation), it will get
     * them from random.
     *
     *
Note that when a Cipher object is initialized, it loses all
     * previously-acquired state. In other words, initializing a Cipher is
     * equivalent to creating a new instance of that Cipher and initializing
     * it.
     *
     * @param opmode the operation mode of this cipher (this is one of
     * the following:
     * ENCRYPT_MODE, DECRYPT_MODE,
     * WRAP_MODE or UNWRAP_MODE)
     * @param key the encryption key
     * @param params the algorithm parameters
     * @param random the source of randomness
     *
     * @exception InvalidKeyException if the given key is inappropriate for
     * initializing this cipher
     * @exception InvalidAlgorithmParameterException if the given algorithm
     * parameters are inappropriate for this cipher,
     * or if this cipher requires
     * algorithm parameters and params is null.
     * @throws UnsupportedOperationException if {@code opmode} is
     * {@code WRAP_MODE} or {@code UNWRAP_MODE} is not implemented
     * by the cipher.
     */
    protected abstract void engineInit(int opmode, Key key,
                                       AlgorithmParameterSpec params,
                                       SecureRandom random)
        throws InvalidKeyException, InvalidAlgorithmParameterException;

    /**
     * Initializes this cipher with a key, a set of
     * algorithm parameters, and a source of randomness.
     *
     *
The cipher is initialized for one of the following four operations:
     * encryption, decryption, key wrapping or key unwrapping, depending on
     * the value of opmode.
     *
     *
If this cipher requires any algorithm parameters and
     * params is null, the underlying cipher implementation is
     * supposed to generate the required parameters itself (using
     * provider-specific default or random values) if it is being
     * initialized for encryption or key wrapping, and raise an
     * InvalidAlgorithmParameterException if it is being
     * initialized for decryption or key unwrapping.
     * The generated parameters can be retrieved using
     * {@link #engineGetParameters() engineGetParameters} or
     * {@link #engineGetIV() engineGetIV} (if the parameter is an IV).
     *
     *
If this cipher requires algorithm parameters that cannot be
     * derived from the input parameters, and there are no reasonable
     * provider-specific default values, initialization will
     * necessarily fail.
     *
     *
If this cipher (including its underlying feedback or padding scheme)
     * requires any random bytes (e.g., for parameter generation), it will get
     * them from random.
     *
     *
Note that when a Cipher object is initialized, it loses all
     * previously-acquired state. In other words, initializing a Cipher is
     * equivalent to creating a new instance of that Cipher and initializing
     * it.
     *
     * @param opmode the operation mode of this cipher (this is one of
     * the following:
     * ENCRYPT_MODE, DECRYPT_MODE,
     * WRAP_MODE or UNWRAP_MODE)
     * @param key the encryption key
     * @param params the algorithm parameters
     * @param random the source of randomness
     *
     * @exception InvalidKeyException if the given key is inappropriate for
     * initializing this cipher
     * @exception InvalidAlgorithmParameterException if the given algorithm
     * parameters are inappropriate for this cipher,
     * or if this cipher requires
     * algorithm parameters and params is null.
     * @throws UnsupportedOperationException if {@code opmode} is
     * {@code WRAP_MODE} or {@code UNWRAP_MODE} is not implemented
     * by the cipher.
     */
    protected abstract void engineInit(int opmode, Key key,
                                       AlgorithmParameters params,
                                       SecureRandom random)
        throws InvalidKeyException, InvalidAlgorithmParameterException;

    /**
     * Continues a multiple-part encryption or decryption operation
     * (depending on how this cipher was initialized), processing another data
     * part.
     *
     *
The first inputLen bytes in the input
     * buffer, starting at inputOffset inclusive, are processed,
     * and the result is stored in a new buffer.
     *
     * @param input the input buffer
     * @param inputOffset the offset in input where the input
     * starts
     * @param inputLen the input length
     *
     * @return the new buffer with the result, or null if the underlying
     * cipher is a block cipher and the input data is too short to result in a
     * new block.
     */
    protected abstract byte[] engineUpdate(byte[] input, int inputOffset,
                                           int inputLen);

    /**
     * Continues a multiple-part encryption or decryption operation
     * (depending on how this cipher was initialized), processing another data
     * part.
     *
     *
The first inputLen bytes in the input
     * buffer, starting at inputOffset inclusive, are processed,
     * and the result is stored in the output buffer, starting at
     * outputOffset inclusive.
     *
     *
If the output buffer is too small to hold the result,
     * a ShortBufferException is thrown.
     *
     * @param input the input buffer
     * @param inputOffset the offset in input where the input
     * starts
     * @param inputLen the input length
     * @param output the buffer for the result
     * @param outputOffset the offset in output where the result
     * is stored
     *
     * @return the number of bytes stored in output
     *
     * @exception ShortBufferException if the given output buffer is too small
     * to hold the result
     */
    protected abstract int engineUpdate(byte[] input, int inputOffset,
                                        int inputLen, byte[] output,
                                        int outputOffset)
        throws ShortBufferException;

    /**
     * Continues a multiple-part encryption or decryption operation
     * (depending on how this cipher was initialized), processing another data
     * part.
     *
     *
All input.remaining() bytes starting at
     * input.position() are processed. The result is stored
     * in the output buffer.
     * Upon return, the input buffer's position will be equal
     * to its limit; its limit will not have changed. The output buffer's
     * position will have advanced by n, where n is the value returned
     * by this method; the output buffer's limit will not have changed.
     *
     *
If output.remaining() bytes are insufficient to
     * hold the result, a ShortBufferException is thrown.
     *
     *
Subclasses should consider overriding this method if they can
     * process ByteBuffers more efficiently than byte arrays.
     *
     * @param input the input ByteBuffer
     * @param output the output ByteByffer
     *
     * @return the number of bytes stored in output
     *
     * @exception ShortBufferException if there is insufficient space in the
     * output buffer
     *
     * @throws NullPointerException if either parameter is null
     * @since 1.5
     */
    protected int engineUpdate(ByteBuffer input, ByteBuffer output)
            throws ShortBufferException {
        try {
            return bufferCrypt(input, output, true);
        } catch (IllegalBlockSizeException e) {
            // never thrown for engineUpdate()
            throw new ProviderException("Internal error in update()");
        } catch (BadPaddingException e) {
            // never thrown for engineUpdate()
            throw new ProviderException("Internal error in update()");
        }
    }

    /**
     * Encrypts or decrypts data in a single-part operation,
     * or finishes a multiple-part operation.
     * The data is encrypted or decrypted, depending on how this cipher was
     * initialized.
     *
     *
The first inputLen bytes in the input
     * buffer, starting at inputOffset inclusive, and any input
     * bytes that may have been buffered during a previous update
     * operation, are processed, with padding (if requested) being applied.
     * If an AEAD mode such as GCM/CCM is being used, the authentication
     * tag is appended in the case of encryption, or verified in the
     * case of decryption.
     * The result is stored in a new buffer.
     *
     *
Upon finishing, this method resets this cipher object to the state
     * it was in when previously initialized via a call to
     * engineInit.
     * That is, the object is reset and available to encrypt or decrypt
     * (depending on the operation mode that was specified in the call to
     * engineInit) more data.
     *
     *
Note: if any exception is thrown, this cipher object may need to
     * be reset before it can be used again.
     *
     * @param input the input buffer
     * @param inputOffset the offset in input where the input
     * starts
     * @param inputLen the input length
     *
     * @return the new buffer with the result
     *
     * @exception IllegalBlockSizeException if this cipher is a block cipher,
     * no padding has been requested (only in encryption mode), and the total
     * input length of the data processed by this cipher is not a multiple of
     * block size; or if this encryption algorithm is unable to
     * process the input data provided.
     * @exception BadPaddingException if this cipher is in decryption mode,
     * and (un)padding has been requested, but the decrypted data is not
     * bounded by the appropriate padding bytes
     * @exception AEADBadTagException if this cipher is decrypting in an
     * AEAD mode (such as GCM/CCM), and the received authentication tag
     * does not match the calculated value
     */
    protected abstract byte[] engineDoFinal(byte[] input, int inputOffset,
                                            int inputLen)
        throws IllegalBlockSizeException, BadPaddingException;

    /**
     * Encrypts or decrypts data in a single-part operation,
     * or finishes a multiple-part operation.
     * The data is encrypted or decrypted, depending on how this cipher was
     * initialized.
     *
     *
The first inputLen bytes in the input
     * buffer, starting at inputOffset inclusive, and any input
     * bytes that may have been buffered during a previous update
     * operation, are processed, with padding (if requested) being applied.
     * If an AEAD mode such as GCM/CCM is being used, the authentication
     * tag is appended in the case of encryption, or verified in the
     * case of decryption.
     * The result is stored in the output buffer, starting at
     * outputOffset inclusive.
     *
     *
If the output buffer is too small to hold the result,
     * a ShortBufferException is thrown.
     *
     *
Upon finishing, this method resets this cipher object to the state
     * it was in when previously initialized via a call to
     * engineInit.
     * That is, the object is reset and available to encrypt or decrypt
     * (depending on the operation mode that was specified in the call to
     * engineInit) more data.
     *
     *
Note: if any exception is thrown, this cipher object may need to
     * be reset before it can be used again.
     *
     * @param input the input buffer
     * @param inputOffset the offset in input where the input
     * starts
     * @param inputLen the input length
     * @param output the buffer for the result
     * @param outputOffset the offset in output where the result
     * is stored
     *
     * @return the number of bytes stored in output
     *
     * @exception IllegalBlockSizeException if this cipher is a block cipher,
     * no padding has been requested (only in encryption mode), and the total
     * input length of the data processed by this cipher is not a multiple of
     * block size; or if this encryption algorithm is unable to
     * process the input data provided.
     * @exception ShortBufferException if the given output buffer is too small
     * to hold the result
     * @exception BadPaddingException if this cipher is in decryption mode,
     * and (un)padding has been requested, but the decrypted data is not
     * bounded by the appropriate padding bytes
     * @exception AEADBadTagException if this cipher is decrypting in an
     * AEAD mode (such as GCM/CCM), and the received authentication tag
     * does not match the calculated value
     */
    protected abstract int engineDoFinal(byte[] input, int inputOffset,
                                         int inputLen, byte[] output,
                                         int outputOffset)
        throws ShortBufferException, IllegalBlockSizeException,
               BadPaddingException;

    /**
     * Encrypts or decrypts data in a single-part operation,
     * or finishes a multiple-part operation.
     * The data is encrypted or decrypted, depending on how this cipher was
     * initialized.
     *
     *
All input.remaining() bytes starting at
     * input.position() are processed.
     * If an AEAD mode such as GCM/CCM is being used, the authentication
     * tag is appended in the case of encryption, or verified in the
     * case of decryption.
     * The result is stored in the output buffer.
     * Upon return, the input buffer's position will be equal
     * to its limit; its limit will not have changed. The output buffer's
     * position will have advanced by n, where n is the value returned
     * by this method; the output buffer's limit will not have changed.
     *
     *
If output.remaining() bytes are insufficient to
     * hold the result, a ShortBufferException is thrown.
     *
     *
Upon finishing, this method resets this cipher object to the state
     * it was in when previously initialized via a call to
     * engineInit.
     * That is, the object is reset and available to encrypt or decrypt
     * (depending on the operation mode that was specified in the call to
     * engineInit) more data.
     *
     *
Note: if any exception is thrown, this cipher object may need to
     * be reset before it can be used again.
     *
     *
Subclasses should consider overriding this method if they can
     * process ByteBuffers more efficiently than byte arrays.
     *
     * @param input the input ByteBuffer
     * @param output the output ByteByffer
     *
     * @return the number of bytes stored in output
     *
     * @exception IllegalBlockSizeException if this cipher is a block cipher,
     * no padding has been requested (only in encryption mode), and the total
     * input length of the data processed by this cipher is not a multiple of
     * block size; or if this encryption algorithm is unable to
     * process the input data provided.
     * @exception ShortBufferException if there is insufficient space in the
     * output buffer
     * @exception BadPaddingException if this cipher is in decryption mode,
     * and (un)padding has been requested, but the decrypted data is not
     * bounded by the appropriate padding bytes
     * @exception AEADBadTagException if this cipher is decrypting in an
     * AEAD mode (such as GCM/CCM), and the received authentication tag
     * does not match the calculated value
     *
     * @throws NullPointerException if either parameter is null
     * @since 1.5
     */
    protected int engineDoFinal(ByteBuffer input, ByteBuffer output)
            throws ShortBufferException, IllegalBlockSizeException,
            BadPaddingException {
        return bufferCrypt(input, output, false);
    }

    // copied from sun.security.jca.JCAUtil
    // will be changed to reference that method once that code has been
    // integrated and promoted
    static int getTempArraySize(int totalSize) {
        return Math.min(4096, totalSize);
    }

    /**
     * Implementation for encryption using ByteBuffers. Used for both
     * engineUpdate() and engineDoFinal().
     */
    private int bufferCrypt(ByteBuffer input, ByteBuffer output,
            boolean isUpdate) throws ShortBufferException,
            IllegalBlockSizeException, BadPaddingException {
        if ((input == null) || (output == null)) {
            throw new NullPointerException
                ("Input and output buffers must not be null");
        }
        int inPos = input.position();
        int inLimit = input.limit();
        int inLen = inLimit - inPos;
        if (isUpdate && (inLen == 0)) {
            return 0;
        }
        int outLenNeeded = engineGetOutputSize(inLen);
        if (output.remaining() < outLenNeeded) {
            throw new ShortBufferException("Need at least " + outLenNeeded
                + " bytes of space in output buffer");
        }

        boolean a1 = input.hasArray();
        boolean a2 = output.hasArray();

        if (a1 && a2) {
            byte[] inArray = input.array();
            int inOfs = input.arrayOffset() + inPos;
            byte[] outArray = output.array();
            int outPos = output.position();
            int outOfs = output.arrayOffset() + outPos;
            int n;
            if (isUpdate) {
                n = engineUpdate(inArray, inOfs, inLen, outArray, outOfs);
            } else {
                n = engineDoFinal(inArray, inOfs, inLen, outArray, outOfs);
            }
            input.position(inLimit);
            output.position(outPos + n);
            return n;
        } else if (!a1 && a2) {
            int outPos = output.position();
            byte[] outArray = output.array();
            int outOfs = output.arrayOffset() + outPos;
            byte[] inArray = new byte[getTempArraySize(inLen)];
            int total = 0;
            do {
                int chunk = Math.min(inLen, inArray.length);
                if (chunk > 0) {
                    input.get(inArray, 0, chunk);
                }
                int n;
                if (isUpdate || (inLen != chunk)) {
                    n = engineUpdate(inArray, 0, chunk, outArray, outOfs);
                } else {
                    n = engineDoFinal(inArray, 0, chunk, outArray, outOfs);
                }
                total += n;
                outOfs += n;
                inLen -= chunk;
            } while (inLen > 0);
            output.position(outPos + total);
            return total;
        } else { // output is not backed by an accessible byte[]
            byte[] inArray;
            int inOfs;
            if (a1) {
                inArray = input.array();
                inOfs = input.arrayOffset() + inPos;
            } else {
                inArray = new byte[getTempArraySize(inLen)];
                inOfs = 0;
            }
            byte[] outArray = new byte[getTempArraySize(outLenNeeded)];
            int outSize = outArray.length;
            int total = 0;
            boolean resized = false;
            do {
                int chunk =
                    Math.min(inLen, (outSize == 0? inArray.length : outSize));
                if (!a1 && !resized && chunk > 0) {
                    input.get(inArray, 0, chunk);
                    inOfs = 0;
                }
                try {
                    int n;
                    if (isUpdate || (inLen != chunk)) {
                        n = engineUpdate(inArray, inOfs, chunk, outArray, 0);
                    } else {
                        n = engineDoFinal(inArray, inOfs, chunk, outArray, 0);
                    }
                    resized = false;
                    inOfs += chunk;
                    inLen -= chunk;
                    if (n > 0) {
                        output.put(outArray, 0, n);
                        total += n;
                    }
                } catch (ShortBufferException e) {
                    if (resized) {
                        // we just resized the output buffer, but it still
                        // did not work. Bug in the provider, abort
                        throw (ProviderException)new ProviderException
                            ("Could not determine buffer size").initCause(e);
                    }
                    // output buffer is too small, realloc and try again
                    resized = true;
                    outSize = engineGetOutputSize(chunk);
                    outArray = new byte[outSize];
                }
            } while (inLen > 0);
            if (a1) {
                input.position(inLimit);
            }
            return total;
        }
    }

    /**
     * Wrap a key.
     *
     *
This concrete method has been added to this previously-defined
     * abstract class. (For backwards compatibility, it cannot be abstract.)
     * It may be overridden by a provider to wrap a key.
     * Such an override is expected to throw an IllegalBlockSizeException or
     * InvalidKeyException (under the specified circumstances),
     * if the given key cannot be wrapped.
     * If this method is not overridden, it always throws an
     * UnsupportedOperationException.
     *
     * @param key the key to be wrapped.
     *
     * @return the wrapped key.
     *
     * @exception IllegalBlockSizeException if this cipher is a block cipher,
     * no padding has been requested, and the length of the encoding of the
     * key to be wrapped is not a multiple of the block size.
     *
     * @exception InvalidKeyException if it is impossible or unsafe to
     * wrap the key with this cipher (e.g., a hardware protected key is
     * being passed to a software-only cipher).
     *
     * @throws UnsupportedOperationException if this method is not supported.
     */
    protected byte[] engineWrap(Key key)
        throws IllegalBlockSizeException, InvalidKeyException
    {
        throw new UnsupportedOperationException();
    }

    /**
     * Unwrap a previously wrapped key.
     *
     *
This concrete method has been added to this previously-defined
     * abstract class. (For backwards compatibility, it cannot be abstract.)
     * It may be overridden by a provider to unwrap a previously wrapped key.
     * Such an override is expected to throw an InvalidKeyException if
     * the given wrapped key cannot be unwrapped.
     * If this method is not overridden, it always throws an
     * UnsupportedOperationException.
     *
     * @param wrappedKey the key to be unwrapped.
     *
     * @param wrappedKeyAlgorithm the algorithm associated with the wrapped
     * key.
     *
     * @param wrappedKeyType the type of the wrapped key. This is one of
     * SECRET_KEY, PRIVATE_KEY, or
     * PUBLIC_KEY.
     *
     * @return the unwrapped key.
     *
     * @exception NoSuchAlgorithmException if no installed providers
     * can create keys of type wrappedKeyType for the
     * wrappedKeyAlgorithm.
     *
     * @exception InvalidKeyException if wrappedKey does not
     * represent a wrapped key of type wrappedKeyType for
     * the wrappedKeyAlgorithm.
     *
     * @throws UnsupportedOperationException if this method is not supported.
     */
    protected Key engineUnwrap(byte[] wrappedKey,
                               String wrappedKeyAlgorithm,
                               int wrappedKeyType)
        throws InvalidKeyException, NoSuchAlgorithmException
    {
        throw new UnsupportedOperationException();
    }

    /**
     * Returns the key size of the given key object in bits.
     *
This concrete method has been added to this previously-defined
     * abstract class. It throws an UnsupportedOperationException
     * if it is not overridden by the provider.
     *
     * @param key the key object.
     *
     * @return the key size of the given key object.
     *
     * @exception InvalidKeyException if key is invalid.
     */
    protected int engineGetKeySize(Key key)
        throws InvalidKeyException
    {
        throw new UnsupportedOperationException();
    }

    /**
     * Continues a multi-part update of the Additional Authentication
     * Data (AAD), using a subset of the provided buffer.
     *

     * Calls to this method provide AAD to the cipher when operating in
     * modes such as AEAD (GCM/CCM).  If this cipher is operating in
     * either GCM or CCM mode, all AAD must be supplied before beginning
     * operations on the ciphertext (via the {@code update} and {@code
     * doFinal} methods).
     *
     * @param src the buffer containing the AAD
     * @param offset the offset in {@code src} where the AAD input starts
     * @param len the number of AAD bytes
     *
     * @throws IllegalStateException if this cipher is in a wrong state
     * (e.g., has not been initialized), does not accept AAD, or if
     * operating in either GCM or CCM mode and one of the {@code update}
     * methods has already been called for the active
     * encryption/decryption operation
     * @throws UnsupportedOperationException if this method
     * has not been overridden by an implementation
     *
     * @since 1.7
     */
    protected void engineUpdateAAD(byte[] src, int offset, int len) {
        throw new UnsupportedOperationException(
            "The underlying Cipher implementation "
            +  "does not support this method");
    }

    /**
     * Continues a multi-part update of the Additional Authentication
     * Data (AAD).
     *

     * Calls to this method provide AAD to the cipher when operating in
     * modes such as AEAD (GCM/CCM).  If this cipher is operating in
     * either GCM or CCM mode, all AAD must be supplied before beginning
     * operations on the ciphertext (via the {@code update} and {@code
     * doFinal} methods).
     *

     * All {@code src.remaining()} bytes starting at
     * {@code src.position()} are processed.
     * Upon return, the input buffer's position will be equal
     * to its limit; its limit will not have changed.
     *
     * @param src the buffer containing the AAD
     *
     * @throws IllegalStateException if this cipher is in a wrong state
     * (e.g., has not been initialized), does not accept AAD, or if
     * operating in either GCM or CCM mode and one of the {@code update}
     * methods has already been called for the active
     * encryption/decryption operation
     * @throws UnsupportedOperationException if this method
     * has not been overridden by an implementation
     *
     * @since 1.7
     */
    protected void engineUpdateAAD(ByteBuffer src) {
        throw new UnsupportedOperationException(
            "The underlying Cipher implementation "
            +  "does not support this method");
    }
}

redpajama_set_name: RedPajamaGithub


text:
define("dojox/charting/axis2d/Invisible",["dojo/_base/lang","dojo/_base/declare","./Base","../scaler/linear","dojox/lang/utils"],function(_1,_2,_3,_4,du){
return _2("dojox.charting.axis2d.Invisible",_3,{defaultParams:{vertical:false,fixUpper:"none",fixLower:"none",natural:false,leftBottom:true,includeZero:false,fixed:true},optionalParams:{min:0,max:1,from:0,to:1,majorTickStep:4,minorTickStep:2,microTickStep:1},constructor:function(_5,_6){
this.opt=_1.clone(this.defaultParams);
du.updateWithObject(this.opt,_6);
du.updateWithPattern(this.opt,_6,this.optionalParams);
},dependOnData:function(){
return !("min" in this.opt)||!("max" in this.opt);
},clear:function(){
delete this.scaler;
delete this.ticks;
this.dirty=true;
return this;
},initialized:function(){
return "scaler" in this&&!(this.dirty&&this.dependOnData());
},setWindow:function(_7,_8){
this.scale=_7;
this.offset=_8;
return this.clear();
},getWindowScale:function(){
return "scale" in this?this.scale:1;
},getWindowOffset:function(){
return "offset" in this?this.offset:0;
},calculate:function(_9,_a,_b){
if(this.initialized()){
return this;
}
var o=this.opt;
this.labels=o.labels;
this.scaler=_4.buildScaler(_9,_a,_b,o);
var _c=this.scaler.bounds;
if("scale" in this){
o.from=_c.lower+this.offset;
o.to=(_c.upper-_c.lower)/this.scale+o.from;
if(!isFinite(o.from)||isNaN(o.from)||!isFinite(o.to)||isNaN(o.to)||o.to-o.from>=_c.upper-_c.lower){
delete o.from;
delete o.to;
delete this.scale;
delete this.offset;
}else{
if(o.from<_c.lower){
o.to+=_c.lower-o.from;
o.from=_c.lower;
}else{
if(o.to>_c.upper){
o.from+=_c.upper-o.to;
o.to=_c.upper;
}
}
this.offset=o.from-_c.lower;
}
this.scaler=_4.buildScaler(_9,_a,_b,o);
_c=this.scaler.bounds;
if(this.scale==1&&this.offset==0){
delete this.scale;
delete this.offset;
}
}
return this;
},getScaler:function(){
return this.scaler;
},getTicks:function(){
return this.ticks;
}});
});


text:
Copyright (C) 2013-2018 Draios Inc dba Sysdig.

This file is part of sysdig.

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.

--]]

-- Chisel description
description = "Sorted list of containers that use the most network bandwidth."
short_description = "Top containers by network I/O"
category = "Net"

-- Chisel argument list
args = {}

-- Initialization callback
function on_init()
	chisel.exec("table_generator",
		"container.name",
		"container.name",
		"evt.rawarg.res",
		"Bytes",
		"(fd.type=ipv4 or fd.type=ipv6) and evt.is_io=true and container.name!=host",
		"100",
		"bytes")

	return true
end


text:
from __future__ import absolute_import
from .diffusion import *
from .featurecreator import GenerateCsfClippedFromClassifiedImage
from .segmentation import *
from .filtering import *
from .brains import *
from .testing import *
from .utilities import *
from .legacy import *
from .registration import *
from .converters import DWISimpleCompare, DWICompare


text:
namespace TheStore.Data.MongoDb
{
    using System.Collections.Generic;
    using MongoDB.Driver;

    public class ComputersContextMongoDb : IComputersContextMongoDb
    {
        // private const string LocalDatabaseHost = "mongodb://127.0.0.1:27017";
        private const string MongoDataBaseHost = "mongodb://Team-Dysprosium:telerik@ds041144.mongolab.com:41144/computers";
        private const string LaptopsDatabaseName = "computers";

        private readonly MongoDatabase database;

        public ComputersContextMongoDb()
        {
            this.database = this.ConnectToDatabase(LaptopsDatabaseName);
        }

        public MongoCollection<TDefaultDocument> GetCollection<TDefaultDocument>(string collectionName)
        {
            return this.database.GetCollection<TDefaultDocument>(collectionName);
        }

        public void SaveToCollection<TDefaultDocument>(string collectionName, List<TDefaultDocument> collectionToInsert)
        {
            this.database.GetCollection<TDefaultDocument>(collectionName).InsertBatch(collectionToInsert);
        }

        public void DropCollection(string collectionName)
        {
            this.database.DropCollection(collectionName);
        }

        private MongoDatabase ConnectToDatabase(string dataBaseName)
        {
            var client = new MongoClient(MongoDataBaseHost);
            MongoServer server = client.GetServer();
            return server.GetDatabase(dataBaseName);
        }
    }
}


text:
<?php
class User extends Record {

	const TABLE = 'Users'; // table name
	const PK = 'idUser'; // primary key

	/**
	 * Validate and search for an user data from their
	 * username and password. This is the conventional
	 * method to perform an user login.
	 * @param  	string 		$username
	 * @param  	string 		$password
	 * @return 	mixed
	 */
	static function logIn($username = null, $password = null) {
		global $def_systemSettings;

		// Verify if user and password were defined
		if ($username && $password) {
			$userVerify = User::userVerify($username, $password);
			$data = $userVerify['data'];

			// Verify whether there's an user with this username and password
			if ($data) {

				// Verify whether user was approved by the community
				if (!$data->approved && $def_systemSettings->voting) {
					return "l2";
				}

				$_SESSION['user']['idUser'] = $data->idUser;
				$_SESSION['user']['loggedin'] = true;

				return 0;
			} else {
				// Incorrect username/password
				return "l1";
			}
		} else {
			return "l0";
		}
	}

	/**
	 * Search for an user with corresponding username and password in the database
	 * @param  string 	$user
	 * @param  string 	$password
	 * @return array          		Query result
	 */
	static function userVerify($username, $password) {
		$userExists = false;
		$where = array("name = ?", $username);
		$options = array(
			'limit' =>  1
		);

		// Verify whether user exists
		$user = User::find($where, $options);

		if (!empty($user)) {
			$userExists = true;

			// Verify whether the passwords match
			if (!password_verify($password , $user[0]->password)) {
				$user[0] = null; // Deny access to users data
			}
		}

		return array('exists' => $userExists, 'data' => $user[0]);
	}
}
?>


text:
package com.google.cloud.dataflow.sdk.transforms;

import com.google.cloud.dataflow.sdk.Pipeline;
import com.google.cloud.dataflow.sdk.coders.CannotProvideCoderException;
import com.google.cloud.dataflow.sdk.coders.Coder;
import com.google.cloud.dataflow.sdk.coders.CoderRegistry;
import com.google.cloud.dataflow.sdk.coders.VoidCoder;
import com.google.cloud.dataflow.sdk.runners.DirectPipelineRunner;
import com.google.cloud.dataflow.sdk.util.WindowingStrategy;
import com.google.cloud.dataflow.sdk.values.KV;
import com.google.cloud.dataflow.sdk.values.PCollection;
import com.google.cloud.dataflow.sdk.values.PCollection.IsBounded;
import com.google.cloud.dataflow.sdk.values.PInput;
import com.google.cloud.dataflow.sdk.values.TimestampedValue;
import com.google.cloud.dataflow.sdk.values.TimestampedValue.TimestampedValueCoder;
import com.google.cloud.dataflow.sdk.values.TypeDescriptor;
import com.google.common.base.Function;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.collect.Iterables;

import org.joda.time.Instant;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;

/**
 * {@code Create<T>} takes a collection of elements of type {@code T}
 * known when the pipeline is constructed and returns a
 * {@code PCollection<T>} containing the elements.
 *
 *
Example of use:
 *
 {@code
 * Pipeline p = ...;
 *
 * PCollection<Integer> pc = p.apply(Create.of(3, 4, 5).withCoder(BigEndianIntegerCoder.of()));
 *
 * Map<String, Integer> map = ...;
 * PCollection<KV<String, Integer>> pt =
 *     p.apply(Create.of(map)
 *      .withCoder(KvCoder.of(StringUtf8Coder.of(),
 *                            BigEndianIntegerCoder.of())));
 * }

 *
 *
{@code Create} can automatically determine the {@code Coder} to use
 * if all elements have the same run-time class, and a default coder is registered for that
 * class. See {@link CoderRegistry} for details on how defaults are determined.
 *
 *
If a coder can not be inferred, {@link Create.Values#withCoder} must be called
 * explicitly to set the encoding of the resulting
 * {@code PCollection}.
 *
 *
A good use for {@code Create} is when a {@code PCollection}
 * needs to be created without dependencies on files or other external
 * entities.  This is especially useful during testing.
 *
 *
Caveat: {@code Create} only supports small in-memory datasets,
 * particularly when submitting jobs to the Google Cloud Dataflow
 * service.
 *
 * @param <T> the type of the elements of the resulting {@code PCollection}
 */
public class Create<T> {
  /**
   * Returns a new {@code Create.Values} transform that produces a
   * {@link PCollection} containing elements of the provided
   * {@code Iterable}.
   *
   *
The argument should not be modified after this is called.
   *
   *
The elements of the output {@link PCollection} will have a timestamp of negative infinity,
   * see {@link Create#timestamped} for a way of creating a {@code PCollection} with timestamped
   * elements.
   *
   *
By default, {@code Create.Values} can automatically determine the {@code Coder} to use
   * if all elements have the same non-parameterized run-time class, and a default coder is
   * registered for that class. See {@link CoderRegistry} for details on how defaults are
   * determined.
   * Otherwise, use {@link Create.Values#withCoder} to set the coder explicitly.
   */
  public static <T> Values<T> of(Iterable<T> elems) {
    return new Values<>(elems, Optional.<Coder<T>>absent());
  }

  /**
   * Returns a new {@code Create.Values} transform that produces a
   * {@link PCollection} containing the specified elements.
   *
   *
The elements will have a timestamp of negative infinity, see
   * {@link Create#timestamped} for a way of creating a {@code PCollection}
   * with timestamped elements.
   *
   *
The arguments should not be modified after this is called.
   *
   *
By default, {@code Create.Values} can automatically determine the {@code Coder} to use
   * if all elements have the same non-parameterized run-time class, and a default coder is
   * registered for that class. See {@link CoderRegistry} for details on how defaults are
   * determined.
   * Otherwise, use {@link Create.Values#withCoder} to set the coder explicitly.
   */
  @SafeVarargs
  public static <T> Values<T> of(T... elems) {
    return of(Arrays.asList(elems));
  }

  /**
   * Returns a new {@code Create.Values} transform that produces a
   * {@link PCollection} of {@link KV}s corresponding to the keys and
   * values of the specified {@code Map}.
   *
   *
The elements will have a timestamp of negative infinity, see
   * {@link Create#timestamped} for a way of creating a {@code PCollection}
   * with timestamped elements.
   *
   *
By default, {@code Create.Values} can automatically determine the {@code Coder} to use
   * if all elements have the same non-parameterized run-time class, and a default coder is
   * registered for that class. See {@link CoderRegistry} for details on how defaults are
   * determined.
   * Otherwise, use {@link Create.Values#withCoder} to set the coder explicitly.
   */
  public static <K, V> Values<KV<K, V>> of(Map<K, V> elems) {
    List<KV<K, V>> kvs = new ArrayList<>(elems.size());
    for (Map.Entry<K, V> entry : elems.entrySet()) {
      kvs.add(KV.of(entry.getKey(), entry.getValue()));
    }
    return of(kvs);
  }

  /**
   * Returns a new {@link Create.TimestampedValues} transform that produces a
   * {@link PCollection} containing the elements of the provided {@code Iterable}
   * with the specified timestamps.
   *
   *
The argument should not be modified after this is called.
   *
   *
By default, {@code Create.TimestampedValues} can automatically determine the {@code Coder}
   * to use if all elements have the same non-parameterized run-time class, and a default coder is
   * registered for that class. See {@link CoderRegistry} for details on how defaults are
   * determined.
   * Otherwise, use {@link Create.TimestampedValues#withCoder} to set the coder explicitly.
   */
  public static <T> TimestampedValues<T> timestamped(Iterable<TimestampedValue<T>> elems) {
    return new TimestampedValues<>(elems, Optional.<Coder<T>>absent());
  }

  /**
   * Returns a new {@link Create.TimestampedValues} transform that produces a {@link PCollection}
   * containing the specified elements with the specified timestamps.
   *
   *
The arguments should not be modified after this is called.
   */
  @SafeVarargs
  public static <T> TimestampedValues<T> timestamped(
      @SuppressWarnings("unchecked") TimestampedValue<T>... elems) {
    return timestamped(Arrays.asList(elems));
  }

  /**
   * Returns a new root transform that produces a {@link PCollection} containing
   * the specified elements with the specified timestamps.
   *
   *
The arguments should not be modified after this is called.
   *
   *
By default, {@code Create.TimestampedValues} can automatically determine the {@code Coder}
   * to use if all elements have the same non-parameterized run-time class, and a default coder
   * is registered for that class. See {@link CoderRegistry} for details on how defaults are
   * determined.
   * Otherwise, use {@link Create.TimestampedValues#withCoder} to set the coder explicitly.

   * @throws IllegalArgumentException if there are a different number of values
   * and timestamps
   */
  public static <T> TimestampedValues<T> timestamped(
      Iterable<T> values, Iterable<Long> timestamps) {
    List<TimestampedValue<T>> elems = new ArrayList<>();
    Iterator<T> valueIter = values.iterator();
    Iterator<Long> timestampIter = timestamps.iterator();
    while (valueIter.hasNext() && timestampIter.hasNext()) {
      elems.add(TimestampedValue.of(valueIter.next(), new Instant(timestampIter.next())));
    }
    Preconditions.checkArgument(
        !valueIter.hasNext() && !timestampIter.hasNext(),
        "Expect sizes of values and timestamps are same.");
    return timestamped(elems);
  }

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

  /**
   * A {@code PTransform} that creates a {@code PCollection} from a set of in-memory objects.
   */
  public static class Values<T> extends PTransform<PInput, PCollection<T>> {
    /**
     * Returns a {@link Create.Values} PTransform like this one that uses the given
     * {@code Coder<T>} to decode each of the objects into a
     * value of type {@code T}.
     *
     *
By default, {@code Create.Values} can automatically determine the {@code Coder} to use
     * if all elements have the same non-parameterized run-time class, and a default coder is
     * registered for that class. See {@link CoderRegistry} for details on how defaults are
     * determined.
     *
     *
Note that for {@link Create.Values} with no elements, the {@link VoidCoder} is used.
     */
    public Values<T> withCoder(Coder<T> coder) {
      return new Values<>(elems, Optional.of(coder));
    }

    public Iterable<T> getElements() {
      return elems;
    }

    @Override
    public PCollection<T> apply(PInput input) {
      try {
        Coder<T> coder = getDefaultOutputCoder(input);
        return PCollection
            .<T>createPrimitiveOutputInternal(
                input.getPipeline(),
                WindowingStrategy.globalDefault(),
                IsBounded.BOUNDED)
            .setCoder(coder);
      } catch (CannotProvideCoderException e) {
        throw new IllegalArgumentException("Unable to infer a coder and no Coder was specified. "
            + "Please set a coder by invoking Create.withCoder() explicitly.", e);
      }
    }

    @Override
    public Coder<T> getDefaultOutputCoder(PInput input) throws CannotProvideCoderException {
      if (coder.isPresent()) {
        return coder.get();
      }
      // First try to deduce a coder using the types of the elements.
      Class<?> elementClazz = Void.class;
      for (T elem : elems) {
        if (elem == null) {
          continue;
        }
        Class<?> clazz = elem.getClass();
        if (elementClazz.equals(Void.class)) {
          elementClazz = clazz;
        } else if (!elementClazz.equals(clazz)) {
          // Elements are not the same type, require a user-specified coder.
          throw new CannotProvideCoderException(
              "Cannot provide coder for Create: The elements are not all of the same class.");
        }
      }

      if (elementClazz.getTypeParameters().length == 0) {
        try {
          @SuppressWarnings("unchecked") // elementClazz is a wildcard type
          Coder<T> coder = (Coder<T>) input.getPipeline().getCoderRegistry()
              .getDefaultCoder(TypeDescriptor.of(elementClazz));
          return coder;
        } catch (CannotProvideCoderException exc) {
          // let the next stage try
        }
      }

      // If that fails, try to deduce a coder using the elements themselves
      Optional<Coder<T>> coder = Optional.absent();
      for (T elem : elems) {
        Coder<T> c = input.getPipeline().getCoderRegistry().getDefaultCoder(elem);
        if (!coder.isPresent()) {
          coder = Optional.of(c);
        } else if (!Objects.equals(c, coder.get())) {
          throw new CannotProvideCoderException(
              "Cannot provide coder for elements of " + Create.class.getSimpleName() + ":"
              + " For their common class, no coder could be provided."
              + " Based on their values, they do not all default to the same Coder.");
        }
      }

      if (!coder.isPresent()) {
        throw new CannotProvideCoderException("Unable to infer a coder. Please register "
            + "a coder for ");
      }
      return coder.get();
    }

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

    /** The elements of the resulting PCollection. */
    private final transient Iterable<T> elems;

    /** The coder used to encode the values to and from a binary representation. */
    private final transient Optional<Coder<T>> coder;

    /**
     * Constructs a {@code Create.Values} transform that produces a
     * {@link PCollection} containing the specified elements.
     *
     *
The arguments should not be modified after this is called.
     */
    private Values(Iterable<T> elems, Optional<Coder<T>> coder) {
      this.elems = elems;
      this.coder = coder;
    }
  }

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

  /**
   * A {@code PTransform} that creates a {@code PCollection} whose elements have
   * associated timestamps.
   */
  public static class TimestampedValues<T> extends Values<T> {
    /**
     * Returns a {@link Create.TimestampedValues} PTransform like this one that uses the given
     * {@code Coder<T>} to decode each of the objects into a
     * value of type {@code T}.
     *
     *
By default, {@code Create.TimestampedValues} can automatically determine the
     * {@code Coder} to use if all elements have the same non-parameterized run-time class,
     * and a default coder is registered for that class. See {@link CoderRegistry} for details
     * on how defaults are determined.
     *
     *
Note that for {@link Create.TimestampedValues with no elements}, the {@link VoidCoder}
     * is used.
     */
    @Override
    public TimestampedValues<T> withCoder(Coder<T> coder) {
      return new TimestampedValues<>(elems, Optional.<Coder<T>>of(coder));
    }

    @Override
    public PCollection<T> apply(PInput input) {
      try {
        Coder<T> coder = getDefaultOutputCoder(input);
        PCollection<TimestampedValue<T>> intermediate = Pipeline.applyTransform(input,
            Create.of(elems).withCoder(TimestampedValueCoder.of(coder)));

        PCollection<T> output = intermediate.apply(ParDo.of(new ConvertTimestamps<T>()));
        output.setCoder(coder);
        return output;
      } catch (CannotProvideCoderException e) {
        throw new IllegalArgumentException("Unable to infer a coder and no Coder was specified. "
            + "Please set a coder by invoking CreateTimestamped.withCoder() explicitly.", e);
      }
    }

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

    /** The timestamped elements of the resulting PCollection. */
    private final transient Iterable<TimestampedValue<T>> elems;

    private TimestampedValues(Iterable<TimestampedValue<T>> elems,
        Optional<Coder<T>> coder) {
      super(
          Iterables.transform(elems, new Function<TimestampedValue<T>, T>() {
            @Override
            public T apply(TimestampedValue<T> input) {
              return input.getValue();
            }
          }), coder);
      this.elems = elems;
    }

    private static class ConvertTimestamps<T> extends DoFn<TimestampedValue<T>, T> {
      @Override
      public void processElement(ProcessContext c) {
        c.outputWithTimestamp(c.element().getValue(), c.element().getTimestamp());
      }
    }
  }

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

  static {
    registerDefaultTransformEvaluator();
  }

  @SuppressWarnings({"rawtypes", "unchecked"})
  private static void registerDefaultTransformEvaluator() {
    DirectPipelineRunner.registerDefaultTransformEvaluator(
        Create.Values.class,
        new DirectPipelineRunner.TransformEvaluator<Create.Values>() {
          @Override
          public void evaluate(
              Create.Values transform,
              DirectPipelineRunner.EvaluationContext context) {
            evaluateHelper(transform, context);
          }
        });
  }

  private static <T> void evaluateHelper(
      Create.Values<T> transform,
      DirectPipelineRunner.EvaluationContext context) {
    // Convert the Iterable of elems into a List of elems.
    List<T> listElems;
    if (transform.elems instanceof Collection) {
      Collection<T> collectionElems = (Collection<T>) transform.elems;
      listElems = new ArrayList<>(collectionElems.size());
    } else {
      listElems = new ArrayList<>();
    }
    for (T elem : transform.elems) {
      listElems.add(
          context.ensureElementEncodable(context.getOutput(transform), elem));
    }
    context.setPCollection(context.getOutput(transform), listElems);
  }
}


text:
-	[`3.4.5-apache`, `3.4.5`, `3.4-apache`, `3.4`, `3-apache`, `apache`, `3`, `latest` (*apache/Dockerfile*)](https://github.com/joomla/docker-joomla/blob/fe2fb4aa4cbab28d3a44ff757895d8664a4c04b4/apache/Dockerfile)
-	[`3.4.5-fpm`, `3.4-fpm`, `3-fpm`, `fpm` (*fpm/Dockerfile*)](https://github.com/joomla/docker-joomla/blob/fe2fb4aa4cbab28d3a44ff757895d8664a4c04b4/fpm/Dockerfile)

For more information about this image and its history, please see [the relevant manifest file (`library/joomla`)](https://github.com/docker-library/official-images/blob/master/library/joomla). This image is updated via pull requests to [the `docker-library/official-images` GitHub repo](https://github.com/docker-library/official-images).

For detailed information about the virtual/transfer sizes and individual layers of each of the above supported tags, please see [the `joomla/tag-details.md` file](https://github.com/docker-library/docs/blob/master/joomla/tag-details.md) in [the `docker-library/docs` GitHub repo](https://github.com/docker-library/docs).

# What is Joomla?

Joomla is a free and open-source content management system (CMS) for publishing web content. It is built on a model–view–controller web application framework that can be used independently of the CMS. Joomla is written in PHP, uses object-oriented programming (OOP) techniques and software design patterns, stores data in a MySQL, MS SQL, or PostgreSQL database, and includes features such as page caching, RSS feeds, printable versions of pages, news flashes, blogs, search, and support for language internationalization.

> [wikipedia.org/wiki/Joomla](https://en.wikipedia.org/wiki/Joomla)

![logo](https://raw.githubusercontent.com/docker-library/docs/593aeead7600f80c50ea4f0cdde05998f743789b/joomla/logo.png)

# How to use this image

```console
$ docker run --name some-joomla --link some-mysql:mysql -d joomla
```

The following environment variables are also honored for configuring your Joomla instance:

-	`-e JOOMLA_DB_HOST=...` (defaults to the IP and port of the linked `mysql` container)
-	`-e JOOMLA_DB_USER=...` (defaults to "root")
-	`-e JOOMLA_DB_PASSWORD=...` (defaults to the value of the `MYSQL_ROOT_PASSWORD` environment variable from the linked `mysql` container)
-	`-e JOOMLA_DB_NAME=...` (defaults to "joomla")

If the `JOOMLA_DB_NAME` specified does not already exist on the given MySQL server, it will be created automatically upon startup of the `joomla` container, provided that the `JOOMLA_DB_USER` specified has the necessary permissions to create it.

If you'd like to be able to access the instance from the host without the container's IP, standard port mappings can be used:

```console
$ docker run --name some-joomla --link some-mysql:mysql -p 8080:80 -d joomla
```

Then, access it via `http://localhost:8080` or `http://host-ip:8080` in a browser.

If you'd like to use an external database instead of a linked `mysql` container, specify the hostname and port with `JOOMLA_DB_HOST` along with the password in `JOOMLA_DB_PASSWORD` and the username in `JOOMLA_DB_USER` (if it is something other than `root`):

```console
$ docker run --name some-joomla -e JOOMLA_DB_HOST=10.1.2.3:3306 \
    -e JOOMLA_DB_USER=... -e JOOMLA_DB_PASSWORD=... -d joomla
```

## ... via [`docker-compose`](https://github.com/docker/compose)

Example `docker-compose.yml` for `joomla`:

```yaml
joomla:
  image: joomla
  links:
    - joomladb:mysql
  ports:
    - 8080:80

joomladb:
  image: mysql:5.6
  environment:
    MYSQL_ROOT_PASSWORD: example
```

Run `docker-compose up`, wait for it to initialize completely, and visit `http://localhost:8080` or `http://host-ip:8080`.

## Adding additional libraries / extensions

This image does not provide any additional PHP extensions or other libraries, even if they are required by popular plugins. There are an infinite number of possible plugins, and they potentially require any extension PHP supports. Including every PHP extension that exists would dramatically increase the image size.

If you need additional PHP extensions, you'll need to create your own image `FROM` this one. The [documentation of the `php` image](https://github.com/docker-library/docs/blob/master/php/README.md#how-to-install-more-php-extensions) explains how to compile additional extensions. Additionally, the [`joomla` Dockerfile](https://github.com/joomla/docker-joomla/blob/966275ada2148e343a68c8c03870f11cc7f5b89c/apache/Dockerfile#L7-L11) has an example of doing this.

The following Docker Hub features can help with the task of keeping your dependent images up-to-date:

-	[Automated Builds](https://docs.docker.com/docker-hub/builds/) let Docker Hub automatically build your Dockerfile each time you push changes to it.
-	[Repository Links](https://docs.docker.com/docker-hub/builds/#repository-links) can ensure that your image is also rebuilt any time `joomla` is updated.

# License

View [license information](http://www.gnu.org/licenses/gpl-2.0.txt) for the software contained in this image.

# Supported Docker versions

This image is officially supported on Docker version 1.9.1.

Support for older versions (down to 1.6) is provided on a best-effort basis.

Please see [the Docker installation documentation](https://docs.docker.com/installation/) for details on how to upgrade your Docker daemon.

# User Feedback

## Documentation

Documentation for this image is stored in the [`joomla/` directory](https://github.com/docker-library/docs/tree/master/joomla) of the [`docker-library/docs` GitHub repo](https://github.com/docker-library/docs). Be sure to familiarize yourself with the [repository's `README.md` file](https://github.com/docker-library/docs/blob/master/README.md) before attempting a pull request.

## Issues

If you have any problems with or questions about this image, please contact us through a [GitHub issue](https://github.com/joomla/docker-joomla/issues).

You can also reach many of the official image maintainers via the `#docker-library` IRC channel on [Freenode](https://freenode.net).

## Contributing

You are invited to contribute new features, fixes, or updates, large or small; we are always thrilled to receive pull requests, and do our best to process them as fast as we can.

Before you start to code, we recommend discussing your plans through a [GitHub issue](https://github.com/joomla/docker-joomla/issues), especially for more ambitious contributions. This gives other contributors a chance to point you in the right direction, give you feedback on your design, and help you find out if someone else is working on the same thing.


text:
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/cloud/domains/v1/domains.proto

package com.google.cloud.domains.v1;

public interface ResetAuthorizationCodeRequestOrBuilder
    extends
    // @@protoc_insertion_point(interface_extends:google.cloud.domains.v1.ResetAuthorizationCodeRequest)
    com.google.protobuf.MessageOrBuilder {

  /**
   *
   *
   *

   * Required. The name of the `Registration` whose authorization code is being reset,
   * in the format `projects/*/locations/*/registrations/*`.
   *

   *
   *
   * string registration = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
   *
   *
   * @return The registration.
   */
  java.lang.String getRegistration();
  /**
   *
   *
   *

   * Required. The name of the `Registration` whose authorization code is being reset,
   * in the format `projects/*/locations/*/registrations/*`.
   *

   *
   *
   * string registration = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
   *
   *
   * @return The bytes for registration.
   */
  com.google.protobuf.ByteString getRegistrationBytes();
}


text:
<!DOCTYPE html>

    <meta charset="UTF-8">
    <title>File Upload</title>

 Uplooooaad

 click button to upload

<form action="/ClubWeb/inc/scripts/upload.php" method="POST" enctype="multipart/form-data">
    Select image to upload:
    <input type="file" name="file" id="fileToUpload">
    <input type="submit" value="Upload Image" name="submit">
</form>


text:
<!DOCTYPE html>

		<title>Riecoin Multi Signature Address</title>
        	<meta http-equiv="content-type" content="text/html;charset=utf-8" />
		<meta name="keywords" content="bitcoin, multi, signature, escrow, trust, free, opensource" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">

		<link rel="stylesheet" href="css/bootstrap.min.css" media="screen">
		<link rel="stylesheet" type="text/css" href="css/style.css" media="screen" />

					<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
						Toggle navigation

					</button>
					Riecoin MultiSig

							New

Multi Signature Address

Riecoin Keys

Verify

Sign

About

					This page requires javascript, please enable it to continue.

Riecoin MultiSig

Multi signature addresses generated in your browser!

This page is written in javascript and is open source.

							Read more...

New Multi Sig Address from the comfort of your browser

Public keys can be generated in your browser or exported from your riecoin client.

Enter the CORRECT compressed public keys of all the participants, to create a multi signature address. Maximum of 20 allowed. There is no warranty on this service so you must make sure that you have entered the correct information. Please triple check before submitting.

										<input type="text" class="form-control pubkey" placeholder="03 Or 02 ONLY! If 04, then uncompressed key.">

Enter the amount of signatures required to release the coins

									<select id="releaseCoins" class="form-control">
										<option>1</option>
										<option selected>2</option>
										<option>3</option>
										<option>4</option>
										<option>5</option>
										<option>6</option>
										<option>7</option>
										<option>8</option>
										<option>9</option>
										<option>10</option>
										<option>11</option>
										<option>12</option>
										<option>13</option>
										<option>14</option>
										<option>15</option>
										<option>16</option>
										<option>17</option>
										<option>18</option>
										<option>19</option>
										<option>20</option>
									</select>

								Address

Payment should be made to this address:

											<input type="text" class="form-control address" value="" readonly>

												<button class="multisigaddressQrcodeBtn btn btn-default" type="button" data-toggle="modal" data-target="#modalQrcode"></button>

								Redeem Script

This script should be saved and should be shared with all the participants before a payment is made, so they may validate the authenticity of the address, it will also be used later to release the bitcoins.

								<textarea class="form-control script" style="height:160px" readonly></textarea>

									<input type="button" class="btn btn-primary" value="Submit" id="createMultiSigAddress">

Agents

You can optionally include a mediators pubkey to help with mediation.

											<select class="form-control" id="multisigAgentSelect">
												<option value="">OutCast3k</option>
												<option value="">ssinc</option>
											</select>

												<input type="button" class="btn btn-default" value="View" data-toggle="modal" data-target="#modalMediatorAgent">

New Keys inside your browser using javascript

Creating a multi signature address requires multiple uncompressed public keys, these can be extracted from the riecoin client or generated using the form below. Any keys used, should be stored safely as they will be needed later to redeem the bitcoins from the multi signature address.

					Address
					<input id="newBitcoinAddress" type="text" class="form-control" placeholder="R" readonly>
					Pubkey (Share this)
					<input id="newPubKey" type="text" class="form-control" placeholder="Key MUST start with 03 Or 02, if 04 then it is an uncompressed key." readonly>
					Privkey (Keep this private)
					<input id="newPrivKey" type="text" class="form-control" placeholder="5" readonly>

					<input type="button" class="btn btn-primary" value="Generate" id="newKeysBtn">

New Transaction release the bitcoins from a multi sig address

The form below is used to craft a transaction that should be given to the other users to sign.

					Redeem Script

							<textarea class="form-control redeemScript"></textarea>

							Multi Signature Address

								3

							Balance

0 BTC

Inputs (0.00000000)

Outputs (0.00000000)

Enter the details of inputs you wish to spend.

									Transaction ID (Txid):

									N

									Amount

										<input type="text" class="form-control txId" placeholder="">

										<input type="text" class="form-control txIdN" placeholder="0">

										<input type="text" class="form-control txIdAmount" placeholder="0.00">

Enter the address and amount you wish to make a payment to.

									Address

									Amount

										<input type="text" class="form-control address" placeholder="1">

										<input type="text" class="form-control amount" placeholder="0.00">

							Transacton Fee
							<input type="text" id="transactionFee" class="form-control" value="0.0000" readonly>

Make sure you include an adequate fee, otherwise your transaction maybe rejected. 0.0005 btc or more is recommended.

						Transaction

The transaction below should be passed to the other partcipants. They will sign the transaction and return their signature, which you add to the transaction before broadcasting.

						<textarea class="form-control" style="height:150px" readonly></textarea>

					<input type="button" class="btn btn-primary" id="transactionCreateBtn" value="Submit">

Verify Script before signing a transaction

Enter the raw transaction or redeem script to verify that it is for the correct amount and is being sent to the correct address.

							<textarea type="text" id="verifyTransaction" class="form-control" style="height:125px"></textarea>

Redeem Script

The above redeem script has been decoded

						Multi Signature Address

									<input type="text" class="form-control address" value="" readonly>

										<button class="multisigaddressQrcodeBtn btn btn-default" type="button" data-toggle="modal" data-target="#modalQrcode"></button>

						Required Signatures

?

						Signatures Required from

Transaction

Below is a decoded version of the above serialized transaction. Ideally you should see and validate the transaction id of the payment made to the multi signature address, as well the amount and address the coins will be released to.

							Inputs

#	Transaction	Redeem Script	Min Signed	Signed No.

							Outputs

#	Address	Amount

Unable to decode

					<input type="button" value="Submit" class="btn btn-primary" id="verifyBtn">

Sign Transaction once a transaction has been verified

Complete the form below to sign a transaction in your browser, or follow these instructions to use your desktop client.

							Private key
							<input type="text" id="signPrivateKey" class="form-control" value="" placeholder="5">

							Transaction
							<textarea type="text" id="signTransaction" class="form-control" style="height:125px"></textarea>

						Signed transaction

The above transaction has been signed:

						<textarea class="form-control script" style="height:160px" readonly></textarea>

					<input type="button" value="Submit" class="btn btn-primary" id="signBtn">

About

Riecoin Multi Signature Address Generation within your browser using javascript.

This multiaddress generator was forked from OutCast3k. Source code is located here: Github (Click Here).

Version 0.2 forked from OutCast3k. Using jQuery, a modified version bitcoinjs and bootstrap 3.0.x.

Compatible with riecoin-qt

Join the discussion https://bitcointalk.org/index.php?topic=390046

Github https://github.com/OutCast3k/bitcoin-multisig/

Donate to OutCast3k: 145XMArsPcJYU3BPsXFX8Hd3WgDWoxCAFa

Donate to personal fund: RRfX7TMuU9sYTJEG2RJEjEn4Z1vK3agkJM

Donate to the Riecoin Foundation: 3Pvb65ey4a1oFRRRkTYH5WYvg8hoLEr1Tu

How it works

This page uses javascript to generate a multi signature address, the buyer sends the funds to the address. Once the agreement between all parties has completed a transaction can be created using the redeem script which is then signed by the participants. You can then broadcast the signed transaction into the network, releasing the funds to the choosen address.

Riecoin MultiSig Version 0.2.

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

Mediator

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

Signing with a Desktop Client

If you wish to manually sign your transaction using another riecoin client, you can follow the instructions below.

Riecoin-qt

Load riecoin-qt

From the toolbar select, Help -> Debug Window -> and then choose the Console Tab.

Enter the following: signrawtransaction <hex string> [{"txid":txid,"vout":n,"scriptPubKey":hex,"redeemScript":hex}]

Where hex, txid, n, pubkey and script is listed, replaced with the appropriate value.

					<button type="button" class="btn btn-default" data-dismiss="modal">Ok</button>

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

Broadcast with a Desktop Client

If you wish to manually broadcast your transaction using another riecoin client, you can follow the instructions below.

Riecoin-qt

Load Riecoin-qt

From the toolbar select, Help -> Debug Window -> and then choose the Console Tab.

Enter the following: sendrawtransaction <hex string>

Where hex is listed, replaced with the appropriate value.

					<button type="button" class="btn btn-default" data-dismiss="modal">Ok</button>

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

Locating pubkeys with a Desktop Client

If you wish to manually generate pubkeys using another riecoin client, you can follow the instructions below.

Riecoin-qt

Load riecoin-qt

From the toolbar select, Help -> Debug Window -> and then choose the Console Tab.

Enter the following: validateaddress <riecoinaddress>

You can only view a pubkey of addresses in your wallet.

					<button type="button" class="btn btn-default" data-dismiss="modal">Ok</button>

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

qrcode


text:
<?php
	/**
	 * Class related to Plugin Objects
	 * @author Felipe Nascimento
	 * @name Plugin
	 * @package framework
	 */
	class Plugin
	{
		public $name= '';
		public $date= '';
		public $authors= Array();
		public $link= '';
		public $description= '';
		public $conf= '';
		public $dir= '';
		public $disabled = false;

		public function code($c = false)
		{
			if($c)
				$this->name= $c;
			else
				return $this->name;
		}

		function conf($confName, $confValue=false)
		{
			if($confValue)
			{
				$this->conf[$confName]= $confValue;
			}else{
					return $this->conf[$confName];
				 }
		}
		function name($n=false)
		{
			if($n)
				$this->name= $n;
			else
				return $this->name;
		}
		function date($n=false)
		{
			if($n)
				$this->date= $n;
			else
				return $this->date;
		}
		function authors($n=false)
		{
			if($n)
				$this->authors[]= $n;
			else
				return $this->authors;
		}
		function link($n=false)
		{
			if($n)
				$this->link= $n;
			else
				return $this->link;
		}
		function description($n=false)
		{
			if($n)
				$this->description= $n;
			else
				return $this->description;
		}
		function __construct($pluginName= false)
		{
			GLOBAL $_MIND;
			$dir= $_MIND['rootDir'];
			$this->dir= $_MIND['pluginDir'];
			if($pluginName)
				$this->load($pluginName);
		}

		/**
		 * Loads the information of one plugin
		 * @name getPlugin
		 * @param $cod the name of the plugins, itself
		 * @return Plugin Object
		 */
		static function getPlugin($cod)
		{
			GLOBAL $_MIND;
			$d = dir($_MIND['rootDir'].$_MIND['pluginDir']);
			while (false !== ($entry = $d->read()))
			{
				if($entry == $cod)
				{
					$pl= new Plugin($entry);
					break;
				}
			}
			$d->close();
			if(isset($pl))
				return $pl;
			else
				return false;
		}

		/**
		 * Loads the list of plugins
		 * @name getPlugins
		 * @author Felipe Nacimento
		 * @return Numeric Array of Plugin objects
		 */
		static function getPlugins()
		{
			GLOBAL $_MIND;
			$dir= $_MIND['rootDir'];
			$d = dir($dir.$_MIND['pluginDir']);
			$ret= Array();
			$list= Array();
			while (false !== ($entry = $d->read()))
			{
				if($entry != "." && $entry != ".." && $entry != ".svn" && is_dir($d->path)
					&& !isset($list[$entry]))
				{
					$ret[]= new Plugin($entry);
					$ret[sizeof($ret)-1]->code($ret[sizeof($ret)-1]->name());
					$list[$entry]= true;
				}
			}
			return $ret;
		}

		/**
		 * Populates the Plugin Object
		 * @param $ar with the data to be used
		 * @author Felipe Nascimento
		 */
		function populate($ar)
		{
			$this->code($ar['name']);
			$this->name($ar['name']);
			$this->date($ar['date']);
			$this->author($ar['author']);
			$this->link($ar['link']);
			$this->description($ar['description']);
			$this->conf['openAs']= $ar['openAs'];
			$this->conf['runAt']= $ar['runAt'];
			$this->conf['openEvent']= $ar['openEvent'];
			$this->conf['status']= $ar['status'];
			$this->conf['useIcon']= $ar['useIcon'];
		}

		/**
		 * Loads a specific plugin data (conf and info)
		 * @param $plugin Object
		 * @author Felipe Nascimento
		 */
		function load($plugin)
		{
			$flagActive = false;
			GLOBAL $_MIND;
			if(!file_exists($_MIND['rootDir'].$_MIND['pluginDir'].'/'.$plugin)){
				$plugin = ".".$plugin;
				$flagActive = true;
			}

			if(file_exists($_MIND['rootDir'].$_MIND['pluginDir'].'/'.$plugin))
			{
				$conf= simplexml_load_file($_MIND['rootDir'].$_MIND['pluginDir'].'/'.$plugin.'/conf.xml');
				$info= simplexml_load_file($_MIND['rootDir'].$_MIND['pluginDir'].'/'.$plugin.'/info.xml');

				$this->name= (string)$info->name['value'];
				$this->date= (string)$info->date['value'];
				foreach($info->authors->author as $aut)
					$this->authors[]= (string)$aut['value'];
				$this->link= (string)$info->link['value'];
				$this->description= (string)$info->description;

				$this->conf['openAs']= (string)$conf->openas['value'];
				$this->conf['runAt']= (string)$conf->runAt['value'];
				$this->conf['extraConfFile']= (string)$conf->extraconffile['value'];
				$this->conf['version']= (string)$conf->version['value'];
				$this->conf['useIcon']= (string)$conf->useicon['value'];
				$this->conf['dependsOnProject']= (string)$conf->dependsonproject['value'];
				if($flagActive){
					$this->disabled = true;
				}else{
					$this->disabled = false;
				}
			}
		}

		/**
		 * Saves the current situation of the instance
		 * @param [$obj] Optionaly, you can send other object to save
		 */
		function save($obj=false)
		{
			$obj= ($obj)? $obj: $this;
			GLOBAL $_MIND;
			$dir= $_MIND['rootDir'].$_MIND['pluginDir'].'/'.$obj->name();
			if(!file_exists($dir))
			{
				mkdir($dir);
			}
			$confF= $dir.'/conf.xml';
			$infoF= $dir.'/info.xml';
			$conf= $_MIND['fw']->mkXML($confF);
			$info= $_MIND['fw']->mkXML($infoF);
			$info->addChild('name');
			$info->name['value']= $this->name();
			$info->addChild('date');
			$info->date['value']= $this->date();
			$info->addChild('author');
			$info->author['value']= $this->author();
			$info->addChild('link');
			$info->link['value']= $this->link();

			$conf->addChild('openAs');
			$conf->openAs['value']= $this->conf['openAs'];
			$conf->addChild('runAt');
			$conf->runAt['value']= $this->conf['runAt'];
			$conf->addChild('openEvent');
			$conf->openEvent['value']= $this->conf['openEvent'];
			$conf->addChild('openEvent');
			$conf->openEvent['value']= $this->conf['openEvent'];
			$conf->addChild('useicon');
			$conf->useicon['value']= $this->conf['useIcon'];

			$_MIND['fw']->saveXML($conf, $confF);
			$_MIND['fw']->saveXML($info, $infoF);
		}

		/**
		* Disable a Plugin (Just add dot(".") in the begin of folder)
		* @name disable
		* @author Felipe Nascimento
		* @return void
		*/
		function disable(){
			GLOBAL $_MIND;
			$dir= $_MIND['rootDir'].$_MIND['pluginDir'].'/';
			rename($dir.$this->code(), $dir.".".$this->code());
		}

		/**
		* Remove a Plugin (Delete the folder)
		* @name remove
		* @author Felipe Nascimento
		* @return boolean
		*/
		function remove(){
			GLOBAL $_MIND;
			$dir= $_MIND['rootDir'].$_MIND['pluginDir'].'/';
			if(!file_exists($dir))
				$dir= '.'.$dir;
			if(!file_exists($dir))
				return false;
			$_MIND['fw']->deleteDirectory($dir.$this->code());
			return true;
		}

		/**
		* Enable a Plugin (Just remove the dot(".") in the begin of folder)
		* @name enable
		* @author Felipe Nascimento
		* @return void
		*/
		function enable(){
			GLOBAL $_MIND;
			$dir= $_MIND['rootDir'].$_MIND['pluginDir'].'/';
			rename($dir.".".$this->code(), $dir.$this->code());
		}
	}


text:
/**
 * \file
 */

/*
 * Copyright (c) 2014, University of Washington.
 * All rights reserved.
 *
 * This file is distributed under the terms in the attached LICENSE file.
 * If you do not find this file, copies can be found by writing to:
 * ETH Zurich D-INFK, CAB F.78, Universitaetstr. 6, CH-8092 Zurich.
 * Attn: Systems Group.
 */

#ifndef INTEL_VMX_H
#define INTEL_VMX_H

#include <stdint.h>
#include <barrelfish_kpi/vmx_controls.h>
#include <barrelfish_kpi/vmx_encodings.h>
#include <barrelfish_kpi/vmx_exit_reasons.h>

// Number of MSRs that are stored/loaded for the guest on VM-exit/VM-entry
#define VMX_MSR_COUNT 5

// Size of the guest MSR store/load area
#define VMX_MSR_AREA_SIZE (VMX_MSR_COUNT * 16)

#define VMX_EXIT_REASON_SWINT 57
#define RFLAGS_CF (1UL << 0)
#define RFLAGS_IF (1UL << 9)
#define CR0_PE (1UL << 0)
#define CR0_PG (1UL << 31)
#define CR4_PAE (1UL << 5)
#define EFER_LMA (1UL << 10)
#define ACCESS_RIGHTS_LONG_MODE (1UL << 13)

/**
 * \brief Convenience macro to write real-mode segmentation registers
 *
 * Write the selector, base and limit to a selector reg according to real-mode
 * segmentation rules to the VMCS.
 */

#define VMCS_WRITE_SEGREG_REALMODE(dcb_cap,reg,selector)		                                \
do {									                                \
    errval_t err_val = invoke_dispatcher_vmwrite(dcb_cap, VMX_GUEST_ ##reg## _SEL, (selector));         \
    err_val += invoke_dispatcher_vmwrite(dcb_cap, VMX_GUEST_ ##reg## _BASE, (selector) << 4);           \
    err_val += invoke_dispatcher_vmwrite(dcb_cap, VMX_GUEST_ ##reg## _LIM, ((selector) << 4) + 0xffff); \
    assert(err_is_ok(err_val));                                                                         \
} while (0)

#endif // INTEL_VMX_H


text:
package spark.api;

/**
 *
{@link Result} interface to wrap the result of executing a SPARQL ASK query so that it can
 * be returned from a call to {@link Command#execute()}. An ASK query takes a query pattern and
 * tests whether a solution for the pattern exists in the dataset. It always returns a single
 * boolean result: <tt>true</tt> if a solution exists for the pattern, or <tt>false</tt> if no
 * solution is known to exist.

 *
 *
This interface is designed to be returned from the {@link Command#execute()} method for
 * executing general SPARQL commands. If you have prior knowledge that a command is an ASK query,
 * then you can access the boolean result directy by calling the {@link Command#executeAsk()}
 * method.

 *
 * @author Alex Hall
 * @created Aug 9, 2011
 */
public interface BooleanResult extends Result {

  /**
   * Gets the boolean result value that was produced by executing the ASK query.
   *
   * @return <tt>true</tt> if a solution exists for the query pattern, or <tt>false</tt> if no
   * solution is known to exist.

   */
  boolean getResult();
}


text:
package com.allogy.app;

import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ListActivity;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.EditText;

import com.allogy.app.adapter.PreferenceAdapter;

public class SettingsActivity extends ListActivity {

	private static final int DIALOG_GATEWAY = 0;
	private static final int DIALOG_PHONE = 1;

	@Override
	protected Dialog onCreateDialog(int id, Bundle args) {
		final SettingsActivity activity = this;

		final View layout = LayoutInflater.from(this).inflate(
				R.layout.dialog_preference_change, null);
		final EditText value = (EditText) layout
				.findViewById(R.id.dialog_preference_change);

		AlertDialog.Builder builder = new AlertDialog.Builder(this);
		builder.setView(layout);
		builder.setCancelable(true);

		switch (id) {
		case DIALOG_GATEWAY:
			builder.setTitle("Change Gateway Number");
			builder.setPositiveButton("Save",
					new DialogInterface.OnClickListener() {

						@Override
						public void onClick(DialogInterface dialog, int which) {
							String num = value.getText().toString();

							if (num.length() < 10) {
								num = null;
							}

							PreferenceManager
									.getDefaultSharedPreferences(activity)
									.edit().putString(PREF_GATEWAY, num)
									.commit();
							activity.dismissDialog(DIALOG_GATEWAY);
							activity.refresh();
						}
					});
			builder.setNegativeButton(getResources().getString(R.string.cancel),
					new DialogInterface.OnClickListener() {

						@Override
						public void onClick(DialogInterface dialog, int which) {
							value.setText("");
							dismissDialog(DIALOG_GATEWAY);
						}
					});
			break;
		case DIALOG_PHONE:
			builder.setTitle("Change Phone Number");
			builder.setPositiveButton("Save",
					new DialogInterface.OnClickListener() {

						@Override
						public void onClick(DialogInterface dialog, int which) {
							String num = value.getText().toString();

							if (num.length() < 10) {
								num = null;
							}

							PreferenceManager
									.getDefaultSharedPreferences(activity)
									.edit().putString(PREF_PHONE, num).commit();
							activity.dismissDialog(DIALOG_PHONE);
							activity.refresh();
						}
					});
			builder.setNegativeButton(getResources().getString(R.string.cancel),
					new DialogInterface.OnClickListener() {

						@Override
						public void onClick(DialogInterface dialog, int which) {
							value.setText("");
							dismissDialog(DIALOG_PHONE);
						}
					});
			break;
		}
		return builder.create();
	}

	public static final String PREF_PHONE = "phone_num";
	public static final String PREF_VERIFIED = "verified";
	public static final String PREF_GATEWAY = "gateway";

	private static final String[] preferences = new String[] {
			"Gateway Number", "Phone Number" };

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		refresh();

	}

	private void refresh() {
		setListAdapter(new PreferenceAdapter(this, preferences,
				getCurrentValues()));
		getListView().setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> parent, View view,
					int position, long id) {
				if (position == 0) {
					showDialog(DIALOG_GATEWAY);
				} else {
					showDialog(DIALOG_PHONE);
				}
			}
		});
	}

	private String[] getCurrentValues() {
		SharedPreferences preferences = PreferenceManager
				.getDefaultSharedPreferences(this);
		String gateway = preferences.getString(PREF_GATEWAY, null);
		String phone = preferences.getString(PREF_PHONE, null);

		String[] values = new String[2];
		values[0] = gateway == null ? "Not Set" : gateway;
		values[1] = phone == null ? "Not Set" : phone;

		return values;
	}

}


text:
require 'binero_deploy/remote_host'
require 'binero_deploy/config'
require 'binero_deploy/console'
require 'binero_deploy/utils'

require 'binero_deploy/deploy'
require 'binero_deploy/revert'
require 'binero_deploy/backup'
require 'binero_deploy/setup'


text:
You can run Pacto as a server in order to test non-Ruby projects. In order to get the full set
of options, run:

```sh
bundle exec pacto-server -h
```

You probably want to run with the -sv option, which will display verbose output to stdout. You can
run server that proxies to a live endpoint:

```sh
bundle exec pacto-server -sv --port 9000 --live http://example.com &
bundle exec pacto-server -sv --port 9001 --stub &

pkill -f pacto-server
```


text:
<?php
namespace Dcs\Arpg;

use Gaia\Bundle\HandlerSocketBundle\Parameter\Query;
use Gaia\Bundle\HandlerSocketBundle\Parameter\Table;

/**
 * データアクセスオブジェクトベースクラス
 */
class Logic{
	use \Dcs\Base;
	public function __construct(\Symfony\Component\DependencyInjection\ContainerInterface $services){
		$this->mSc = $services;
	}

	/**
	 * サービスを取得する
	 * @param string $id サービスID
	 * @return サービスコンテナ
	 */
	protected function get($id){
		return $this->mSc->get($id);
	}

	private $mSc;
}
?>


text:
ACCEPTED

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

#### Published in
Beih. Nova Hedwigia 50: 103 (1974)

#### Original name
Favolaschia oligogloea Singer, 1974

### Remarks
null