text:
*> \brief  SPOSVXX computes the solution to system of linear equations A * X = B for PO matrices
*
*  =========== DOCUMENTATION ===========
*
* Online html documentation available at
*            http://www.netlib.org/lapack/explore-html/
*
*> \htmlonly
*> Download SPOSVXX + dependencies
*>
*> [TGZ]
*>
*> [ZIP]
*>
*> [TXT]
*> \endhtmlonly
*
*  Definition:
*  ===========
*
*       SUBROUTINE SPOSVXX( FACT, UPLO, N, NRHS, A, LDA, AF, LDAF, EQUED,
*                           S, B, LDB, X, LDX, RCOND, RPVGRW, BERR,
*                           N_ERR_BNDS, ERR_BNDS_NORM, ERR_BNDS_COMP,
*                           NPARAMS, PARAMS, WORK, IWORK, INFO )
*
*       .. Scalar Arguments ..
*       CHARACTER          EQUED, FACT, UPLO
*       INTEGER            INFO, LDA, LDAF, LDB, LDX, N, NRHS, NPARAMS,
*      $                   N_ERR_BNDS
*       REAL               RCOND, RPVGRW
*       ..
*       .. Array Arguments ..
*       INTEGER            IWORK( * )
*       REAL               A( LDA, * ), AF( LDAF, * ), B( LDB, * ),
*      $                   X( LDX, * ), WORK( * )
*       REAL               S( * ), PARAMS( * ), BERR( * ),
*      $                   ERR_BNDS_NORM( NRHS, * ),
*      $                   ERR_BNDS_COMP( NRHS, * )
*       ..
*
*
*> \par Purpose:
*  =============
*>
*> \verbatim
*>
*>    SPOSVXX uses the Cholesky factorization A = U**T*U or A = L*L**T
*>    to compute the solution to a real system of linear equations
*>    A * X = B, where A is an N-by-N symmetric positive definite matrix
*>    and X and B are N-by-NRHS matrices.
*>
*>    If requested, both normwise and maximum componentwise error bounds
*>    are returned. SPOSVXX will return a solution with a tiny
*>    guaranteed error (O(eps) where eps is the working machine
*>    precision) unless the matrix is very ill-conditioned, in which
*>    case a warning is returned. Relevant condition numbers also are
*>    calculated and returned.
*>
*>    SPOSVXX accepts user-provided factorizations and equilibration
*>    factors; see the definitions of the FACT and EQUED options.
*>    Solving with refinement and using a factorization from a previous
*>    SPOSVXX call will also produce a solution with either O(eps)
*>    errors or warnings, but we cannot make that claim for general
*>    user-provided factorizations and equilibration factors if they
*>    differ from what SPOSVXX would itself produce.
*> \endverbatim
*
*> \par Description:
*  =================
*>
*> \verbatim
*>
*>    The following steps are performed:
*>
*>    1. If FACT = 'E', real scaling factors are computed to equilibrate
*>    the system:
*>
*>      diag(S)*A*diag(S)     *inv(diag(S))*X = diag(S)*B
*>
*>    Whether or not the system will be equilibrated depends on the
*>    scaling of the matrix A, but if equilibration is used, A is
*>    overwritten by diag(S)*A*diag(S) and B by diag(S)*B.
*>
*>    2. If FACT = 'N' or 'E', the Cholesky decomposition is used to
*>    factor the matrix A (after equilibration if FACT = 'E') as
*>       A = U**T* U,  if UPLO = 'U', or
*>       A = L * L**T,  if UPLO = 'L',
*>    where U is an upper triangular matrix and L is a lower triangular
*>    matrix.
*>
*>    3. If the leading i-by-i principal minor is not positive definite,
*>    then the routine returns with INFO = i. Otherwise, the factored
*>    form of A is used to estimate the condition number of the matrix
*>    A (see argument RCOND).  If the reciprocal of the condition number
*>    is less than machine precision, the routine still goes on to solve
*>    for X and compute error bounds as described below.
*>
*>    4. The system of equations is solved for X using the factored form
*>    of A.
*>
*>    5. By default (unless PARAMS(LA_LINRX_ITREF_I) is set to zero),
*>    the routine will use iterative refinement to try to get a small
*>    error and error bounds.  Refinement calculates the residual to at
*>    least twice the working precision.
*>
*>    6. If equilibration was used, the matrix X is premultiplied by
*>    diag(S) so that it solves the original system before
*>    equilibration.
*> \endverbatim
*
*  Arguments:
*  ==========
*
*> \verbatim
*>     Some optional parameters are bundled in the PARAMS array.  These
*>     settings determine how refinement is performed, but often the
*>     defaults are acceptable.  If the defaults are acceptable, users
*>     can pass NPARAMS = 0 which prevents the source code from accessing
*>     the PARAMS argument.
*> \endverbatim
*>
*> \param[in] FACT
*> \verbatim
*>          FACT is CHARACTER*1
*>     Specifies whether or not the factored form of the matrix A is
*>     supplied on entry, and if not, whether the matrix A should be
*>     equilibrated before it is factored.
*>       = 'F':  On entry, AF contains the factored form of A.
*>               If EQUED is not 'N', the matrix A has been
*>               equilibrated with scaling factors given by S.
*>               A and AF are not modified.
*>       = 'N':  The matrix A will be copied to AF and factored.
*>       = 'E':  The matrix A will be equilibrated if necessary, then
*>               copied to AF and factored.
*> \endverbatim
*>
*> \param[in] UPLO
*> \verbatim
*>          UPLO is CHARACTER*1
*>       = 'U':  Upper triangle of A is stored;
*>       = 'L':  Lower triangle of A is stored.
*> \endverbatim
*>
*> \param[in] N
*> \verbatim
*>          N is INTEGER
*>     The number of linear equations, i.e., the order of the
*>     matrix A.  N >= 0.
*> \endverbatim
*>
*> \param[in] NRHS
*> \verbatim
*>          NRHS is INTEGER
*>     The number of right hand sides, i.e., the number of columns
*>     of the matrices B and X.  NRHS >= 0.
*> \endverbatim
*>
*> \param[in,out] A
*> \verbatim
*>          A is REAL array, dimension (LDA,N)
*>     On entry, the symmetric matrix A, except if FACT = 'F' and EQUED =
*>     'Y', then A must contain the equilibrated matrix
*>     diag(S)*A*diag(S).  If UPLO = 'U', the leading N-by-N upper
*>     triangular part of A contains the upper triangular part of the
*>     matrix A, and the strictly lower triangular part of A is not
*>     referenced.  If UPLO = 'L', the leading N-by-N lower triangular
*>     part of A contains the lower triangular part of the matrix A, and
*>     the strictly upper triangular part of A is not referenced.  A is
*>     not modified if FACT = 'F' or 'N', or if FACT = 'E' and EQUED =
*>     'N' on exit.
*>
*>     On exit, if FACT = 'E' and EQUED = 'Y', A is overwritten by
*>     diag(S)*A*diag(S).
*> \endverbatim
*>
*> \param[in] LDA
*> \verbatim
*>          LDA is INTEGER
*>     The leading dimension of the array A.  LDA >= max(1,N).
*> \endverbatim
*>
*> \param[in,out] AF
*> \verbatim
*>          AF is or output) REAL array, dimension (LDAF,N)
*>     If FACT = 'F', then AF is an input argument and on entry
*>     contains the triangular factor U or L from the Cholesky
*>     factorization A = U**T*U or A = L*L**T, in the same storage
*>     format as A.  If EQUED .ne. 'N', then AF is the factored
*>     form of the equilibrated matrix diag(S)*A*diag(S).
*>
*>     If FACT = 'N', then AF is an output argument and on exit
*>     returns the triangular factor U or L from the Cholesky
*>     factorization A = U**T*U or A = L*L**T of the original
*>     matrix A.
*>
*>     If FACT = 'E', then AF is an output argument and on exit
*>     returns the triangular factor U or L from the Cholesky
*>     factorization A = U**T*U or A = L*L**T of the equilibrated
*>     matrix A (see the description of A for the form of the
*>     equilibrated matrix).
*> \endverbatim
*>
*> \param[in] LDAF
*> \verbatim
*>          LDAF is INTEGER
*>     The leading dimension of the array AF.  LDAF >= max(1,N).
*> \endverbatim
*>
*> \param[in,out] EQUED
*> \verbatim
*>          EQUED is or output) CHARACTER*1
*>     Specifies the form of equilibration that was done.
*>       = 'N':  No equilibration (always true if FACT = 'N').
*>       = 'Y':  Both row and column equilibration, i.e., A has been
*>               replaced by diag(S) * A * diag(S).
*>     EQUED is an input argument if FACT = 'F'; otherwise, it is an
*>     output argument.
*> \endverbatim
*>
*> \param[in,out] S
*> \verbatim
*>          S is or output) REAL array, dimension (N)
*>     The row scale factors for A.  If EQUED = 'Y', A is multiplied on
*>     the left and right by diag(S).  S is an input argument if FACT =
*>     'F'; otherwise, S is an output argument.  If FACT = 'F' and EQUED
*>     = 'Y', each element of S must be positive.  If S is output, each
*>     element of S is a power of the radix. If S is input, each element
*>     of S should be a power of the radix to ensure a reliable solution
*>     and error estimates. Scaling by powers of the radix does not cause
*>     rounding errors unless the result underflows or overflows.
*>     Rounding errors during scaling lead to refining with a matrix that
*>     is not equivalent to the input matrix, producing error estimates
*>     that may not be reliable.
*> \endverbatim
*>
*> \param[in,out] B
*> \verbatim
*>          B is REAL array, dimension (LDB,NRHS)
*>     On entry, the N-by-NRHS right hand side matrix B.
*>     On exit,
*>     if EQUED = 'N', B is not modified;
*>     if EQUED = 'Y', B is overwritten by diag(S)*B;
*> \endverbatim
*>
*> \param[in] LDB
*> \verbatim
*>          LDB is INTEGER
*>     The leading dimension of the array B.  LDB >= max(1,N).
*> \endverbatim
*>
*> \param[out] X
*> \verbatim
*>          X is REAL array, dimension (LDX,NRHS)
*>     If INFO = 0, the N-by-NRHS solution matrix X to the original
*>     system of equations.  Note that A and B are modified on exit if
*>     EQUED .ne. 'N', and the solution to the equilibrated system is
*>     inv(diag(S))*X.
*> \endverbatim
*>
*> \param[in] LDX
*> \verbatim
*>          LDX is INTEGER
*>     The leading dimension of the array X.  LDX >= max(1,N).
*> \endverbatim
*>
*> \param[out] RCOND
*> \verbatim
*>          RCOND is REAL
*>     Reciprocal scaled condition number.  This is an estimate of the
*>     reciprocal Skeel condition number of the matrix A after
*>     equilibration (if done).  If this is less than the machine
*>     precision (in particular, if it is zero), the matrix is singular
*>     to working precision.  Note that the error may still be small even
*>     if this number is very small and the matrix appears ill-
*>     conditioned.
*> \endverbatim
*>
*> \param[out] RPVGRW
*> \verbatim
*>          RPVGRW is REAL
*>     Reciprocal pivot growth.  On exit, this contains the reciprocal
*>     pivot growth factor norm(A)/norm(U). The "max absolute element"
*>     norm is used.  If this is much less than 1, then the stability of
*>     the LU factorization of the (equilibrated) matrix A could be poor.
*>     This also means that the solution X, estimated condition numbers,
*>     and error bounds could be unreliable. If factorization fails with
*>     0<INFO<=N, then this contains the reciprocal pivot growth factor
*>     for the leading INFO columns of A.
*> \endverbatim
*>
*> \param[out] BERR
*> \verbatim
*>          BERR is REAL array, dimension (NRHS)
*>     Componentwise relative backward error.  This is the
*>     componentwise relative backward error of each solution vector X(j)
*>     (i.e., the smallest relative change in any element of A or B that
*>     makes X(j) an exact solution).
*> \endverbatim
*>
*> \param[in] N_ERR_BNDS
*> \verbatim
*>          N_ERR_BNDS is INTEGER
*>     Number of error bounds to return for each right hand side
*>     and each type (normwise or componentwise).  See ERR_BNDS_NORM and
*>     ERR_BNDS_COMP below.
*> \endverbatim
*>
*> \param[out] ERR_BNDS_NORM
*> \verbatim
*>          ERR_BNDS_NORM is REAL array, dimension (NRHS, N_ERR_BNDS)
*>     For each right-hand side, this array contains information about
*>     various error bounds and condition numbers corresponding to the
*>     normwise relative error, which is defined as follows:
*>
*>     Normwise relative error in the ith solution vector:
*>             max_j (abs(XTRUE(j,i) - X(j,i)))
*>            ------------------------------
*>                  max_j abs(X(j,i))
*>
*>     The array is indexed by the type of error information as described
*>     below. There currently are up to three pieces of information
*>     returned.
*>
*>     The first index in ERR_BNDS_NORM(i,:) corresponds to the ith
*>     right-hand side.
*>
*>     The second index in ERR_BNDS_NORM(:,err) contains the following
*>     three fields:
*>     err = 1 "Trust/don't trust" boolean. Trust the answer if the
*>              reciprocal condition number is less than the threshold
*>              sqrt(n) * slamch('Epsilon').
*>
*>     err = 2 "Guaranteed" error bound: The estimated forward error,
*>              almost certainly within a factor of 10 of the true error
*>              so long as the next entry is greater than the threshold
*>              sqrt(n) * slamch('Epsilon'). This error bound should only
*>              be trusted if the previous boolean is true.
*>
*>     err = 3  Reciprocal condition number: Estimated normwise
*>              reciprocal condition number.  Compared with the threshold
*>              sqrt(n) * slamch('Epsilon') to determine if the error
*>              estimate is "guaranteed". These reciprocal condition
*>              numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some
*>              appropriately scaled matrix Z.
*>              Let Z = S*A, where S scales each row by a power of the
*>              radix so all absolute row sums of Z are approximately 1.
*>
*>     See Lapack Working Note 165 for further details and extra
*>     cautions.
*> \endverbatim
*>
*> \param[out] ERR_BNDS_COMP
*> \verbatim
*>          ERR_BNDS_COMP is REAL array, dimension (NRHS, N_ERR_BNDS)
*>     For each right-hand side, this array contains information about
*>     various error bounds and condition numbers corresponding to the
*>     componentwise relative error, which is defined as follows:
*>
*>     Componentwise relative error in the ith solution vector:
*>                    abs(XTRUE(j,i) - X(j,i))
*>             max_j ----------------------
*>                         abs(X(j,i))
*>
*>     The array is indexed by the right-hand side i (on which the
*>     componentwise relative error depends), and the type of error
*>     information as described below. There currently are up to three
*>     pieces of information returned for each right-hand side. If
*>     componentwise accuracy is not requested (PARAMS(3) = 0.0), then
*>     ERR_BNDS_COMP is not accessed.  If N_ERR_BNDS .LT. 3, then at most
*>     the first (:,N_ERR_BNDS) entries are returned.
*>
*>     The first index in ERR_BNDS_COMP(i,:) corresponds to the ith
*>     right-hand side.
*>
*>     The second index in ERR_BNDS_COMP(:,err) contains the following
*>     three fields:
*>     err = 1 "Trust/don't trust" boolean. Trust the answer if the
*>              reciprocal condition number is less than the threshold
*>              sqrt(n) * slamch('Epsilon').
*>
*>     err = 2 "Guaranteed" error bound: The estimated forward error,
*>              almost certainly within a factor of 10 of the true error
*>              so long as the next entry is greater than the threshold
*>              sqrt(n) * slamch('Epsilon'). This error bound should only
*>              be trusted if the previous boolean is true.
*>
*>     err = 3  Reciprocal condition number: Estimated componentwise
*>              reciprocal condition number.  Compared with the threshold
*>              sqrt(n) * slamch('Epsilon') to determine if the error
*>              estimate is "guaranteed". These reciprocal condition
*>              numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some
*>              appropriately scaled matrix Z.
*>              Let Z = S*(A*diag(x)), where x is the solution for the
*>              current right-hand side and S scales each row of
*>              A*diag(x) by a power of the radix so all absolute row
*>              sums of Z are approximately 1.
*>
*>     See Lapack Working Note 165 for further details and extra
*>     cautions.
*> \endverbatim
*>
*> \param[in] NPARAMS
*> \verbatim
*>          NPARAMS is INTEGER
*>     Specifies the number of parameters set in PARAMS.  If .LE. 0, the
*>     PARAMS array is never referenced and default values are used.
*> \endverbatim
*>
*> \param[in,out] PARAMS
*> \verbatim
*>          PARAMS is / output) REAL array, dimension NPARAMS
*>     Specifies algorithm parameters.  If an entry is .LT. 0.0, then
*>     that entry will be filled with default value used for that
*>     parameter.  Only positions up to NPARAMS are accessed; defaults
*>     are used for higher-numbered parameters.
*>
*>       PARAMS(LA_LINRX_ITREF_I = 1) : Whether to perform iterative
*>            refinement or not.
*>         Default: 1.0
*>            = 0.0 : No refinement is performed, and no error bounds are
*>                    computed.
*>            = 1.0 : Use the double-precision refinement algorithm,
*>                    possibly with doubled-single computations if the
*>                    compilation environment does not support DOUBLE
*>                    PRECISION.
*>              (other values are reserved for future use)
*>
*>       PARAMS(LA_LINRX_ITHRESH_I = 2) : Maximum number of residual
*>            computations allowed for refinement.
*>         Default: 10
*>         Aggressive: Set to 100 to permit convergence using approximate
*>                     factorizations or factorizations other than LU. If
*>                     the factorization uses a technique other than
*>                     Gaussian elimination, the guarantees in
*>                     err_bnds_norm and err_bnds_comp may no longer be
*>                     trustworthy.
*>
*>       PARAMS(LA_LINRX_CWISE_I = 3) : Flag determining if the code
*>            will attempt to find a solution with small componentwise
*>            relative error in the double-precision algorithm.  Positive
*>            is true, 0.0 is false.
*>         Default: 1.0 (attempt componentwise convergence)
*> \endverbatim
*>
*> \param[out] WORK
*> \verbatim
*>          WORK is REAL array, dimension (4*N)
*> \endverbatim
*>
*> \param[out] IWORK
*> \verbatim
*>          IWORK is INTEGER array, dimension (N)
*> \endverbatim
*>
*> \param[out] INFO
*> \verbatim
*>          INFO is INTEGER
*>       = 0:  Successful exit. The solution to every right-hand side is
*>         guaranteed.
*>       < 0:  If INFO = -i, the i-th argument had an illegal value
*>       > 0 and <= N:  U(INFO,INFO) is exactly zero.  The factorization
*>         has been completed, but the factor U is exactly singular, so
*>         the solution and error bounds could not be computed. RCOND = 0
*>         is returned.
*>       = N+J: The solution corresponding to the Jth right-hand side is
*>         not guaranteed. The solutions corresponding to other right-
*>         hand sides K with K > J may not be guaranteed as well, but
*>         only the first such right-hand side is reported. If a small
*>         componentwise error is not requested (PARAMS(3) = 0.0) then
*>         the Jth right-hand side is the first with a normwise error
*>         bound that is not guaranteed (the smallest J such
*>         that ERR_BNDS_NORM(J,1) = 0.0). By default (PARAMS(3) = 1.0)
*>         the Jth right-hand side is the first with either a normwise or
*>         componentwise error bound that is not guaranteed (the smallest
*>         J such that either ERR_BNDS_NORM(J,1) = 0.0 or
*>         ERR_BNDS_COMP(J,1) = 0.0). See the definition of
*>         ERR_BNDS_NORM(:,1) and ERR_BNDS_COMP(:,1). To get information
*>         about all of the right-hand sides check ERR_BNDS_NORM or
*>         ERR_BNDS_COMP.
*> \endverbatim
*
*  Authors:
*  ========
*
*> \author Univ. of Tennessee
*> \author Univ. of California Berkeley
*> \author Univ. of Colorado Denver
*> \author NAG Ltd.
*
*> \date November 2011
*
*> \ingroup realPOsolve
*
*  =====================================================================
      SUBROUTINE SPOSVXX( FACT, UPLO, N, NRHS, A, LDA, AF, LDAF, EQUED,
     $                    S, B, LDB, X, LDX, RCOND, RPVGRW, BERR,
     $                    N_ERR_BNDS, ERR_BNDS_NORM, ERR_BNDS_COMP,
     $                    NPARAMS, PARAMS, WORK, IWORK, INFO )
*
*  -- LAPACK driver routine (version 3.4.0) --
*  -- LAPACK is a software package provided by Univ. of Tennessee,    --
*  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
*     November 2011
*
*     .. Scalar Arguments ..
      CHARACTER          EQUED, FACT, UPLO
      INTEGER            INFO, LDA, LDAF, LDB, LDX, N, NRHS, NPARAMS,
     $                   N_ERR_BNDS
      REAL               RCOND, RPVGRW
*     ..
*     .. Array Arguments ..
      INTEGER            IWORK( * )
      REAL               A( LDA, * ), AF( LDAF, * ), B( LDB, * ),
     $                   X( LDX, * ), WORK( * )
      REAL               S( * ), PARAMS( * ), BERR( * ),
     $                   ERR_BNDS_NORM( NRHS, * ),
     $                   ERR_BNDS_COMP( NRHS, * )
*     ..
*
*  ==================================================================
*
*     .. Parameters ..
      REAL               ZERO, ONE
      PARAMETER          ( ZERO = 0.0E+0, ONE = 1.0E+0 )
      INTEGER            FINAL_NRM_ERR_I, FINAL_CMP_ERR_I, BERR_I
      INTEGER            RCOND_I, NRM_RCOND_I, NRM_ERR_I, CMP_RCOND_I
      INTEGER            CMP_ERR_I, PIV_GROWTH_I
      PARAMETER          ( FINAL_NRM_ERR_I = 1, FINAL_CMP_ERR_I = 2,
     $                   BERR_I = 3 )
      PARAMETER          ( RCOND_I = 4, NRM_RCOND_I = 5, NRM_ERR_I = 6 )
      PARAMETER          ( CMP_RCOND_I = 7, CMP_ERR_I = 8,
     $                   PIV_GROWTH_I = 9 )
*     ..
*     .. Local Scalars ..
      LOGICAL            EQUIL, NOFACT, RCEQU
      INTEGER            INFEQU, J
      REAL               AMAX, BIGNUM, SMIN, SMAX,
     $                   SCOND, SMLNUM
*     ..
*     .. External Functions ..
      EXTERNAL           LSAME, SLAMCH, SLA_PORPVGRW
      LOGICAL            LSAME
      REAL               SLAMCH, SLA_PORPVGRW
*     ..
*     .. External Subroutines ..
      EXTERNAL           SPOEQUB, SPOTRF, SPOTRS, SLACPY, SLAQSY,
     $                   XERBLA, SLASCL2, SPORFSX
*     ..
*     .. Intrinsic Functions ..
      INTRINSIC          MAX, MIN
*     ..
*     .. Executable Statements ..
*
      INFO = 0
      NOFACT = LSAME( FACT, 'N' )
      EQUIL = LSAME( FACT, 'E' )
      SMLNUM = SLAMCH( 'Safe minimum' )
      BIGNUM = ONE / SMLNUM
      IF( NOFACT .OR. EQUIL ) THEN
         EQUED = 'N'
         RCEQU = .FALSE.
      ELSE
         RCEQU = LSAME( EQUED, 'Y' )
      ENDIF
*
*     Default is failure.  If an input parameter is wrong or
*     factorization fails, make everything look horrible.  Only the
*     pivot growth is set here, the rest is initialized in SPORFSX.
*
      RPVGRW = ZERO
*
*     Test the input parameters.  PARAMS is not tested until SPORFSX.
*
      IF( .NOT.NOFACT .AND. .NOT.EQUIL .AND. .NOT.
     $     LSAME( FACT, 'F' ) ) THEN
         INFO = -1
      ELSE IF( .NOT.LSAME( UPLO, 'U' ) .AND.
     $         .NOT.LSAME( UPLO, 'L' ) ) THEN
         INFO = -2
      ELSE IF( N.LT.0 ) THEN
         INFO = -3
      ELSE IF( NRHS.LT.0 ) THEN
         INFO = -4
      ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
         INFO = -6
      ELSE IF( LDAF.LT.MAX( 1, N ) ) THEN
         INFO = -8
      ELSE IF( LSAME( FACT, 'F' ) .AND. .NOT.
     $        ( RCEQU .OR. LSAME( EQUED, 'N' ) ) ) THEN
         INFO = -9
      ELSE
         IF ( RCEQU ) THEN
            SMIN = BIGNUM
            SMAX = ZERO
            DO 10 J = 1, N
               SMIN = MIN( SMIN, S( J ) )
               SMAX = MAX( SMAX, S( J ) )
 10         CONTINUE
            IF( SMIN.LE.ZERO ) THEN
               INFO = -10
            ELSE IF( N.GT.0 ) THEN
               SCOND = MAX( SMIN, SMLNUM ) / MIN( SMAX, BIGNUM )
            ELSE
               SCOND = ONE
            END IF
         END IF
         IF( INFO.EQ.0 ) THEN
            IF( LDB.LT.MAX( 1, N ) ) THEN
               INFO = -12
            ELSE IF( LDX.LT.MAX( 1, N ) ) THEN
               INFO = -14
            END IF
         END IF
      END IF
*
      IF( INFO.NE.0 ) THEN
         CALL XERBLA( 'SPOSVXX', -INFO )
         RETURN
      END IF
*
      IF( EQUIL ) THEN
*
*     Compute row and column scalings to equilibrate the matrix A.
*
         CALL SPOEQUB( N, A, LDA, S, SCOND, AMAX, INFEQU )
         IF( INFEQU.EQ.0 ) THEN
*
*     Equilibrate the matrix.
*
            CALL SLAQSY( UPLO, N, A, LDA, S, SCOND, AMAX, EQUED )
            RCEQU = LSAME( EQUED, 'Y' )
         END IF
      END IF
*
*     Scale the right-hand side.
*
      IF( RCEQU ) CALL SLASCL2( N, NRHS, S, B, LDB )
*
      IF( NOFACT .OR. EQUIL ) THEN
*
*        Compute the Cholesky factorization of A.
*
         CALL SLACPY( UPLO, N, N, A, LDA, AF, LDAF )
         CALL SPOTRF( UPLO, N, AF, LDAF, INFO )
*
*        Return if INFO is non-zero.
*
         IF( INFO.NE.0 ) THEN
*
*           Pivot in column INFO is exactly 0
*           Compute the reciprocal pivot growth factor of the
*           leading rank-deficient INFO columns of A.
*
            RPVGRW = SLA_PORPVGRW( UPLO, INFO, A, LDA, AF, LDAF, WORK )
            RETURN
         ENDIF
      END IF
*
*     Compute the reciprocal growth factor RPVGRW.
*
      RPVGRW = SLA_PORPVGRW( UPLO, N, A, LDA, AF, LDAF, WORK )
*
*     Compute the solution matrix X.
*
      CALL SLACPY( 'Full', N, NRHS, B, LDB, X, LDX )
      CALL SPOTRS( UPLO, N, NRHS, AF, LDAF, X, LDX, INFO )
*
*     Use iterative refinement to improve the computed solution and
*     compute error bounds and backward error estimates for it.
*
      CALL SPORFSX( UPLO, EQUED, N, NRHS, A, LDA, AF, LDAF,
     $     S, B, LDB, X, LDX, RCOND, BERR, N_ERR_BNDS, ERR_BNDS_NORM,
     $     ERR_BNDS_COMP, NPARAMS, PARAMS, WORK, IWORK, INFO )

*
*     Scale solutions.
*
      IF ( RCEQU ) THEN
         CALL SLASCL2 ( N, NRHS, S, X, LDX )
      END IF
*
      RETURN
*
*     End of SPOSVXX
*
      END


text:
package ast

// Position provides interface to store code locations.
type Position struct {
	Line   int
	Column int
}

// Pos interface provies two functions to get/set the position for expression or statement.
type Pos interface {
	Position() Position
	SetPosition(Position)
}

// PosImpl provies commonly implementations for Pos.
type PosImpl struct {
	pos Position
}

// Position return the position of the expression or statement.
func (x *PosImpl) Position() Position {
	return x.pos
}

// SetPosition is a function to specify position of the expression or statement.
func (x *PosImpl) SetPosition(pos Position) {
	x.pos = pos
}

redpajama_set_name: RedPajamaGithub


text:
package org.springframework.security.oauth.consumer;

import java.util.HashMap;

import org.junit.Test;
import org.springframework.security.oauth.common.signature.HMAC_SHA1SignatureMethod;
import org.springframework.security.oauth.common.signature.SharedConsumerSecretImpl;
import org.springframework.security.oauth.consumer.client.CoreOAuthConsumerSupport;
import org.springframework.security.oauth.consumer.net.DefaultOAuthURLStreamHandlerFactory;

/**
 * @author Ryan Heaton
 */
public class GoogleOAuthTests {

	/**
	 * tests getting a request token.
	 */
	@Test
	public void testGetRequestToken() throws Exception {
		CoreOAuthConsumerSupport support = new CoreOAuthConsumerSupport();
		support.setStreamHandlerFactory(new DefaultOAuthURLStreamHandlerFactory());
		InMemoryProtectedResourceDetailsService service = new InMemoryProtectedResourceDetailsService();
		HashMap<String, ProtectedResourceDetails> detailsStore = new HashMap<String, ProtectedResourceDetails>();
		BaseProtectedResourceDetails googleDetails = new BaseProtectedResourceDetails();
		googleDetails.setRequestTokenURL("https://www.google.com/accounts/OAuthGetRequestToken");
		googleDetails.setAccessTokenURL("https://www.google.com/accounts/OAuthAuthorizeToken");
		googleDetails.setConsumerKey("anonymous");
		googleDetails.setSharedSecret(new SharedConsumerSecretImpl("anonymous"));
		googleDetails.setId("google");
		googleDetails.setUse10a(true);
		googleDetails.setSignatureMethod(HMAC_SHA1SignatureMethod.SIGNATURE_NAME);
		googleDetails.setRequestTokenHttpMethod("GET");
		HashMap<String, String> additional = new HashMap<String, String>();
		additional.put("scope", "https://picasaweb.google.com/data");
		googleDetails.setAdditionalParameters(additional);
		detailsStore.put(googleDetails.getId(), googleDetails);
		service.setResourceDetailsStore(detailsStore);
		support.setProtectedResourceDetailsService(service);
		// uncomment to see a request to google.
		// see https://code.google.com/apis/accounts/docs/OAuth_ref.html
		// and https://jira.codehaus.org/browse/OAUTHSS-37
		// OAuthConsumerToken token = support.getUnauthorizedRequestToken("google", "urn:mycallback");
		// System.out.println(token.getValue());
		// System.out.println(token.getSecret());
	}
}


text:
package com.dotweblabs.friendscube.app.client.shared.entity.actions;

import java.io.Serializable;

/**
 * Generic request action object
 *
 * @author Kerby Martino
 * @version 1.0
 * @since 1.0
 */
public class RequestAction implements Serializable {
    private String action;
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

  <title>eSpeak: Phoneme tables</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

Back

INTONATION

In eSpeak's standard intonation model, a "tune" is applied to each clause depending on its punctuation.  Other intonation models may be used for some languages, such as tone languages.

Named tunes are defined in the text file: phsource/intonation.  This file must be compiled for use by eSpeak by using the espeakedit program, using the menu option: Compile -> Compile intonation data.

Clauses

The tunes which are used for a language can be specified by using a tunes statement in a voice file in espeak-data/voices. eg:

tunes   s1  c1   q1   e1

It's parameters are four tune names which are used for clauses which end in:

Full-stop.

Comma.

Question mark.

Exclamation mark.

A clause consists of the following parts:

Pre-head.
These are any unstressed syllables before the first stressed syllable.

Head.
This is the part from the first stressed syllable up to the last syllable before the nucleus.

Nucleus.
This is stressed syllable which is the focus of the clause.  eSpeak chooses the last stressed syllable of the clause.

Tail.
These are the syllables after the nucleus.

Tune definitions

Here is an example tune definition from the file phsource/intonation.

tune s1
prehead   46 57
headenv   fall 16
head       4 80 55 -8 -5
headextend 0 63 38 13 0
nucleus  fall 70 18 24 12
nucleus0 fall 64 8
endtune

It contains:

tune <tune name>

Starts the definition of a tune.  The tune name can be used in a tunes statements in voice files.

endtune <tune name>

Ends the definition of a tune.

prehead <start pitch> <end pitch>

Gives the pitch path for any series of unstressed syllables before the first stressed syllable.

headenv <envelope> <height>

Gives the pitch envelope which is used for stressed syllables in the head (before the nucleus), including onset and headlast syllables if these are specified.  height gives a pitch range for the envelope.

head <steps> <start pitch> <end pitch> <unstressed start> <unstressed end>

start pitch and end pitch give a pitch path for the stressed syllables of the head.  steps is the maximum number of stressed syllables for which this applies.  If there are additional stressed syllables, then the headextend statement is used for them.

unstressed start and unstressed end give a pitch path for unstressed syllables between two stressed syllables.  Their values are relative to the pitch of the previous stressed syllable.  Values are usually negative, meaning that the unstressed syllables have lower pitch than the previous stressed syllable.

headextend <percentage list>

If the head contains more stressed syllables than is specified by steps, then percentage list is used.  It contains up to 8 numbers which are used repeatedly for the additional stressed syllables.  A value of 0 corresponds to the lower the start pitch and end pitch values of the head statement.  100 corresponds to the higher value.  Negative values and values greater than 100 are allowed.

nucleus <envelope> <top pitch> <bottom pitch> <tail start> <tail end>

This gives the pitch envelope and pitch range of the last stressed syllable of the clause.  tail start and tail end give a pitch path for the unstressed syllables which are after the last stressed syllable.

nucleus0 <envelope> <top pitch> <bottom pitch>

This is used instead of nucleus if there are no unstressed syllables after the last stressed syllable.  In this case, the pitch changes of the nucleus and the tail and both included in the nucleus.

The following attributes may also be included:

onset <pitch> <unstressed start> <unstressed end>

This specifies the pitch for the first stressed syllable of the head. If the onset statement is present, then the head statement used for the stressed syllables after the first.

headlast <pitch> <unstressed start> <unstressed end>

This specifies the pitch for the last stressed syllable of the head (i.e. the stressed syllable before the nucleus).


text:
#ifndef vnsw_agent_oper_dhcp_options_h_
#define vnsw_agent_oper_dhcp_options_h_

#include <vnc_cfg_types.h>

namespace autogen {
    struct DhcpOptionType;
    struct RouteType;
}

// DHCP options coming from config
class OperDhcpOptions {
public:
    typedef std::vector<autogen::DhcpOptionType> DhcpOptionsList;
    typedef std::vector<autogen::RouteType> HostOptionsList;

    struct HostRoute {
        Ip4Address prefix_;
        uint32_t plen_;
        Ip4Address gw_;

        HostRoute() : prefix_(), plen_(0), gw_() {}
        bool operator<(const HostRoute &rhs) const {
            if (prefix_ != rhs.prefix_)
                return prefix_ < rhs.prefix_;
            if (plen_ != rhs.plen_)
                return plen_ < rhs.plen_;
            return gw_ < rhs.gw_;
        }
        bool operator==(const HostRoute &rhs) const {
            return prefix_ == rhs.prefix_ && plen_ == rhs.plen_ &&
                   gw_ == rhs.gw_;
        }
        std::string ToString() const {
            char len[32];
            snprintf(len, sizeof(len), "%u", plen_);
            return prefix_.to_string() + "/" + std::string(len) +
                   " -> " + gw_.to_string();
        }
    };

    OperDhcpOptions() {}
    OperDhcpOptions(const OperDhcpOptions &options) {
        dhcp_options_ = options.dhcp_options_;
        host_routes_ = options.host_routes_;
    }
    virtual ~OperDhcpOptions() {}

    const DhcpOptionsList &dhcp_options() const { return dhcp_options_; }
    const std::vector<HostRoute> &host_routes() const { return host_routes_; }
    void set_options(const DhcpOptionsList &options) { dhcp_options_ = options; }
    void set_host_routes(const HostOptionsList &host_routes) {
        host_routes_.clear();
        update_host_routes(host_routes);
    }
    void update_host_routes(const HostOptionsList &host_routes) {
        host_routes_.clear();
        for (unsigned int i = 0; i < host_routes.size(); ++i) {
            HostRoute host_route;
            boost::system::error_code ec = Ip4PrefixParse(host_routes[i].prefix,
                                                          &host_route.prefix_,
                                                          (int *)&host_route.plen_);
            if (ec || host_route.plen_ > 32) {
                continue;
            }
            host_route.gw_ = Ip4Address::from_string(host_routes[i].next_hop, ec);
            if (ec) {
                host_route.gw_ = Ip4Address();
            }
            host_routes_.push_back(host_route);
        }
    }

    bool are_dhcp_options_set() const {
        return dhcp_options_.size() > 0;
    }
    bool are_host_routes_set() const {
        return host_routes_.size() > 0;
    }

private:
    DhcpOptionsList dhcp_options_;
    std::vector<HostRoute> host_routes_;
};

#endif // vnsw_agent_oper_dhcp_options_h_


text:
function [smm_rs, smm_ps, n] = searchlightMapping_SVM(fullBrainVolumes, models, mask, runs, userOptions, localOptions)

% ARGUMENTS
% fullBrainVolumes	A voxel x condition x session matrix of activity
% 				patterns.
%
% models		A struct of model RDMs.
%
% runs          matrix describing which runs the trials were in
% mask     		A 3d or 4d mask to perform the searchlight in.
%
% userOptions and localOptions
%
% RETURN VALUES
% smm_rs        4D array of 3D maps (x by y by z by model index) of
%               correlations between the searchlight pattern similarity
%               matrix and each of the model similarity matrices.
%
% smm_ps        4D array of 3D maps (x by y by z by model index) of p
%               values computed for each corresponding entry of smm_rs.
%
% n             an array of the same dimensions as the volume, which
%               indicates for each position how many voxels contributed
%               data to the corresponding values of the infomaps.
%               this is the number of searchlight voxels, except at the
%               fringes, where the searchlight may illuminate voxels
%               outside the input-data mask or voxel with all-zero
%               time-courses (as can arise from head-motion correction).
%
% mappingMask_actual
%               3D mask indicating locations for which valid searchlight
%               statistics have been computed.
%
% Based on Niko Kriegeskorte's searchlightMapping_RDMs.m
%
% Additions by Cai Wingfield 2-2010:
% 	- Now skips points in the searchlight where there's only one voxel inside.
% 	- Now takes a userOptions struct for the input parameters.

localOptions = setIfUnset(localOptions, 'averageSessions', true);
userOptions=setIfUnset(userOptions, 'analysisType', 'SVM');
%% Figure out whether to average over sessions or not
if localOptions.averageSessions
    for sessionNumber = 1:size(fullBrainVolumes,3)
        thisSessionId = ['s' num2str(sessionNumber)];
        t_patsPerSession.(thisSessionId) = fullBrainVolumes(:,:,sessionNumber)';
    end%for:sessionNumber
else
    justThisSession = 1;
    t_pats = fullBrainVolumes(:,:,justThisSession)';

    fprintf(['\nYou have selected not to average over sessions.\n         Only session number ' num2str(justThisSession) ' will be used.\n']);

end%if

%% Get parameters
voxSize_mm = userOptions.voxelSize;
searchlightRad_mm = userOptions.searchlightRadius;
monitor = localOptions.monitor;
nConditions = size(fullBrainVolumes, 2);

clear fullBrainVolumes;

% Prepare models
if strcmp(userOptions.analysisType, 'SVM')
    modelRDMs_ltv=models';
else
    modelRDMs_ltv = permute(unwrapRDMs(vectorizeRDMs(models)), [3 2 1]);
end

% Prepare masks
mask(isnan(mask)) = 0; % Just in case!
if ndims(mask)==3
    inputDataMask=logical(mask);
    mappingMask_request=logical(mask);
else
    inputDataMask=logical(mask(:,:,:,1));
    mappingMask_request=logical(mask(:,:,:,2));
end

% Check to see if there's more data than mask...
if localOptions.averageSessions
    for sessionNumber = 1:numel(fieldnames(t_patsPerSession))
        thisSessionId = ['s' num2str(sessionNumber)];
        t_patsPerSession.(thisSessionId) = t_patsPerSession.(thisSessionId)(:, inputDataMask(:));
    end%for:sessionNumber
else
    if (size(t_pats,2)>sum(inputDataMask(:)))
        t_pats=t_pats(:,inputDataMask(:));
    end%if
end%if

% Other data
volSize_vox=size(inputDataMask);
nModelRDMs=size(modelRDMs_ltv,1);
rad_vox=searchlightRad_mm./voxSize_mm;
minMargin_vox=floor(rad_vox);

%% create spherical multivariate searchlight
[x,y,z]=meshgrid(-minMargin_vox(1):minMargin_vox(1),-minMargin_vox(2):minMargin_vox(2),-minMargin_vox(3):minMargin_vox(3));
sphere=((x*voxSize_mm(1)).^2+(y*voxSize_mm(2)).^2+(z*voxSize_mm(3)).^2)<=(searchlightRad_mm^2);  % volume with sphere voxels marked 1 and the outside 0
sphereSize_vox=[size(sphere),ones(1,3-ndims(sphere))]; % enforce 3D (matlab stupidly autosqueezes trailing singleton dimensions to 2D, try: ndims(ones(1,1,1)). )

if monitor, figure(50); clf; showVoxObj(sphere); end % show searchlight in 3D

% compute center-relative sphere SUBindices
[sphereSUBx,sphereSUBy,sphereSUBz]=ind2sub(sphereSize_vox,find(sphere)); % (SUB)indices pointing to sphere voxels
sphereSUBs=[sphereSUBx,sphereSUBy,sphereSUBz];
ctrSUB=sphereSize_vox/2+[.5 .5 .5]; % (c)en(t)e(r) position (sphere necessarily has odd number of voxels in each dimension)
ctrRelSphereSUBs=sphereSUBs-ones(size(sphereSUBs,1),1)*ctrSUB; % (c)en(t)e(r)-relative sphere-voxel (SUB)indices

nSearchlightVox=size(sphereSUBs,1);

%% define masks
validInputDataMask=inputDataMask;

if localOptions.averageSessions
    for sessionNumber = 1:numel(fieldnames(t_patsPerSession))
        thisSessionId = ['s' num2str(sessionNumber)];
        sumAbsY=sum(abs(t_patsPerSession.(thisSessionId)),1);
    end%for:sessionNumber
else
    sumAbsY=sum(abs(t_pats),1);
end%if

validYspace_logical= (sumAbsY~=0) & ~isnan(sumAbsY); clear sumAbsY;
validInputDataMask(inputDataMask)=validYspace_logical; % define valid-input-data brain mask

if localOptions.averageSessions
    for sessionNumber = 1:numel(fieldnames(t_patsPerSession))
        thisSessionId = ['s' num2str(sessionNumber)];
        t_patsPerSession.(thisSessionId) = t_patsPerSession.(thisSessionId)(:,validYspace_logical);
        nVox_validInputData=size(t_patsPerSession.(thisSessionId),2);
    end%for:sessionNumber
else
    t_pats=t_pats(:,validYspace_logical); % reduce t_pats to the valid-input-data brain mask
    nVox_validInputData=size(t_pats,2);
end%if

mappingMask_request_INDs=find(mappingMask_request);
nVox_mappingMask_request=length(mappingMask_request_INDs);

if monitor
    disp([num2str(round(nVox_mappingMask_request/prod(volSize_vox)*10000)/100),'% of the cuboid volume requested to be mapped.']);
    disp([num2str(round(nVox_validInputData/prod(volSize_vox)*10000)/100),'% of the cuboid volume to be used as input data.']);
    disp([num2str(nVox_validInputData),' of ',num2str(sum(inputDataMask(:))),' declared input-data voxels included in the analysis.']);
end

volIND2YspaceIND=nan(volSize_vox);
volIND2YspaceIND(validInputDataMask)=1:nVox_validInputData;

% n voxels contributing to infobased t at each location
n=nan(volSize_vox);
nVec=nan(size(nVox_mappingMask_request));

%% similarity-graph-map the volume with the searchlight
smm_ps=nan([volSize_vox,nModelRDMs]);
smm_rs=nan([volSize_vox,nModelRDMs]);
vec_ps=nan([nVox_mappingMask_request,nModelRDMs]);
vec_rs=nan([nVox_mappingMask_request,nModelRDMs]);
if monitor
    h_progressMonitor=progressMonitor(1, nVox_mappingMask_request,  'Similarity-graph-mapping...');
end

%% THE BIG LOOP! %%

parfor cMappingVoxI=1:nVox_mappingMask_request

    if mod(cMappingVoxI,1000)==0
        if monitor
            progressMonitor(cMappingVoxI, nVox_mappingMask_request, 'Searchlight mapping Mahalanobis distance...', h_progressMonitor);
            %                 cMappingVoxI/nVox_mappingMask_request
        else
            fprintf('.');
        end%if
    end%if
    %% apply sphere to index
    [x, y, z]=ind2sub(volSize_vox,mappingMask_request_INDs(cMappingVoxI));

    % compute (sub)indices of (vox)els (c)urrently (ill)uminated by the spherical searchlight
    cIllVoxSUBs=repmat([x,y,z],[size(ctrRelSphereSUBs,1) 1])+ctrRelSphereSUBs;

    % exclude out-of-volume voxels
    outOfVolIs=(cIllVoxSUBs(:,1)<1 | cIllVoxSUBs(:,1)>volSize_vox(1)|...
        cIllVoxSUBs(:,2)<1 | cIllVoxSUBs(:,2)>volSize_vox(2)|...
        cIllVoxSUBs(:,3)<1 | cIllVoxSUBs(:,3)>volSize_vox(3));

    cIllVoxSUBs=cIllVoxSUBs(~outOfVolIs,:);

    % list of (IND)ices pointing to (vox)els (c)urrently (ill)uminated by the spherical searchlight
    cIllVox_volINDs=sub2ind(volSize_vox,cIllVoxSUBs(:,1),cIllVoxSUBs(:,2),cIllVoxSUBs(:,3));

    % restrict searchlight to voxels inside validDataBrainMask
    cIllValidVox_volINDs=cIllVox_volINDs(validInputDataMask(cIllVox_volINDs));
    cIllValidVox_YspaceINDs=volIND2YspaceIND(cIllValidVox_volINDs);

    % note how many voxels contributed to this locally multivariate stat
    nVec(cMappingVoxI)=length(cIllValidVox_YspaceINDs);

    if n(x,y,z) < 2, continue; end%if % This stops the function crashing if it accidentally encounters an out-of-brain floating voxel (these can occur if, for example, skull stripping fails)
    %% analysis-Jeff
        if localOptions.averageSessions
            t_pats=zeros(size(t_patsPerSession.s1(:,cIllValidVox_YspaceINDs)));
            for session = 1:localOptions.nSessions
                sessionId = ['s' num2str(session)];
                t_pats = t_pats+t_patsPerSession.(sessionId)(:,cIllValidVox_YspaceINDs);
                t_pats=t_pats / localOptions.nSessions;
            end
        end

        %%%%%%%
        [rs] = permutationSVM(t_pats, models, runs);
        %%%%%%%

        ps=nan;

    %    smm_bestModel(x,y,z) = bestModelI;
    vec_ps(cMappingVoxI,:) = ps;
    vec_rs(cMappingVoxI,:) = rs;
    %%
end%for:cMappingVoxI
tic
for cMappingVoxI=1:nVox_mappingMask_request
    [x, y, z]=ind2sub(volSize_vox,mappingMask_request_INDs(cMappingVoxI));
    smm_rs(x,y,z,:)=vec_rs(cMappingVoxI,:);
    smm_ps(x,y,z,:)=vec_ps(cMappingVoxI,:);
    n(x,y,z)=nVec(cMappingVoxI);
end
toc
%% END OF THE BIG LOOP! %%

if monitor
    fprintf('\n');
    close(h_progressMonitor);
end

mappingMask_actual=mappingMask_request;
mappingMask_actual(isnan(sum(vec_rs,4)))=0;

%% visualize
if monitor
    aprox_p_uncorr=0.001;
    singleModel_p_crit=aprox_p_uncorr/nModelRDMs; % conservative assumption model proximities nonoverlapping
    smm_min_p=min(vec_ps,[],4);
    smm_significant=smm_min_p<singleModel_p_crit;

    vol=map2vol(mask);
    vol2=map2vol(mask);

    colors=[1 0 0
        0 1 0
        0 1 1
        1 1 0
        1 0 1];

    for modelRDMI=1:nModelRDMs
        vol=addBinaryMapToVol(vol, smm_significant&(smm_bestModel==modelRDMI), colors(modelRDMI,:));
        % 		vol2=addBinaryMapToVol(vol2, smm_bestModel==modelRDMI, colors(modelRDMI,:));
    end

    showVol(vol);

    % 	vol2 = vol2*0.1;
    % 	vol2(vol<1) = vol(vol<1);
    %
    % 	showVol(vol2);

end%if

end%function


text:
using System;
using System.Threading.Tasks;
using Moq;
using NUnit.Framework;
using SFA.DAS.EmployerFinance.Data;
using SFA.DAS.EmployerFinance.Queries.GetEnglishFractionsUpdateRequired;
using SFA.DAS.Hmrc;

namespace SFA.DAS.EmployerFinance.UnitTests.Queries.GetEnglishFractionsUpdateRequired
{
    class WhenGettingIfEnglishFractionsUpdateIsRequired
    {
        private GetEnglishFractionsUpdateRequiredQueryHandler _handler;
        private Mock<IHmrcService> _hmrcService;
        private Mock<IEnglishFractionRepository> _englishFractionRepository;

        [SetUp]
        public void Arrange()
        {
            _hmrcService = new Mock<IHmrcService>();
            _englishFractionRepository = new Mock<IEnglishFractionRepository>();

            _handler = new GetEnglishFractionsUpdateRequiredQueryHandler(_hmrcService.Object, _englishFractionRepository.Object);
        }

        [Test]
        public async Task ThenIShouldGetThatAnUpdateIsRequiredIfIDoNotHaveTheLatestUpdate()
        {
            //Assign
            _hmrcService.Setup(x => x.GetLastEnglishFractionUpdate()).ReturnsAsync(DateTime.Now);
            _englishFractionRepository.Setup(x => x.GetLastUpdateDate()).ReturnsAsync(DateTime.Now.AddDays(-1));

            //Act
            var result = await _handler.Handle(new GetEnglishFractionUpdateRequiredRequest());

            //Assert
            Assert.IsTrue(result.UpdateRequired);
        }

        [Test]
        public async Task ThenIShouldGetThatAnUpdateIsNotRequiredIfIDoHaveTheLatestUpdate()
        {
            //Assign
            var updateTime = DateTime.Now;
            _hmrcService.Setup(x => x.GetEnglishFractions(It.IsAny<string>()));
            _hmrcService.Setup(x => x.GetLastEnglishFractionUpdate()).ReturnsAsync(updateTime);
            _englishFractionRepository.Setup(x => x.GetLastUpdateDate()).ReturnsAsync(updateTime);

            //Act
            var result = await _handler.Handle(new GetEnglishFractionUpdateRequiredRequest());

            //Assert
            Assert.IsFalse(result.UpdateRequired);
        }
    }
}


text:
require 'spec_helper'

describe MTG::API::Card do
  subject { MTG::API::Card }

  describe 'when search card' do
    context 'by id' do
      let(:valid_card)   { subject.find_by_id(1) }
      let(:invalid_card) { subject.find_by_id(0) }

      it 'with invalid id', vcr: { cassette_name: 'find_by_invalid_id' } do
        expect(invalid_card).to respond_to(:Error)
      end

      it 'with valid id', vcr: { cassette_name: 'find_by_valid_id' } do
        expect(valid_card).to_not respond_to(:Error)

        expect(valid_card.id).to         eql "1"
        expect(valid_card.name).to       eql "Ankh of Mishra"
        expect(valid_card.mana).to       eql ["2"]
        expect(valid_card.cmc).to        eql "2"
        expect(valid_card.type).to       eql ["Artifact"]
        expect(valid_card.text).to       eql ["Whenever a land enters the battlefield, Ankh of Mishra deals 2 damage to that land's controller."]
        expect(valid_card.flavor).to     be_empty
        expect(valid_card.power).to      be_empty
        expect(valid_card.toughness).to  be_empty
        expect(valid_card.loyalty).to    be_empty
        expect(valid_card.watermark).to  be_empty
        expect(valid_card.set).to        eql "Limited Edition Alpha"
        expect(valid_card.rarity).to     eql "Rare"
        expect(valid_card.number).to     be_empty
        expect(valid_card.artist).to     eql "Amy Weber"
        expect(valid_card.prints).to     eql [{"set" => "1E", "id" => "1"},
                                              {"set" => "2E", "id" => "296"},
                                              {"set" => "2U", "id" => "598"},
                                              {"set" => "3E", "id" => "1094"},
                                              {"set" => "4E", "id" => "2017"},
                                              {"set" => "5E", "id" => "3760"},
                                              {"set" => "6E", "id" => "14771"},
                                              {"set" => "MED", "id" => "159251"}]
      end
    end

    context 'by text' do
      let(:valid_cards)  { subject.find_by_text('tundra') }
      let(:invalid_card) { subject.find_by_text('invalid-name') }

      it 'with invalid card name', vcr: { cassette_name: 'find_by_invalid_text' } do
        pending 'API is raising {"code":"500","error":"internal server error"} so far :('
        expect(invalid_card).to raise_error(/500 - Internal Server Error/)
      end

      it 'with valid card name', vcr: { cassette_name: 'find_by_valid_text' } do
        valid_card = valid_cards.first

        expect(valid_cards).to have(3).cards

        expect(valid_card).to_not respond_to(:Error)

        expect(valid_card.id).to         eql "202424"
        expect(valid_card.name).to       eql "Tundra"
        expect(valid_card.mana).to       be_empty
        expect(valid_card.cmc).to        be_empty
        expect(valid_card.type).to       eql ["Land ", "Plains Island"]
        expect(valid_card.text).to       be_empty
        expect(valid_card.flavor).to     be_empty
        expect(valid_card.power).to      be_empty
        expect(valid_card.toughness).to  be_empty
        expect(valid_card.loyalty).to    be_empty
        expect(valid_card.watermark).to  be_empty
        expect(valid_card.set).to        eql "Masters Edition IV"
        expect(valid_card.rarity).to     eql "Rare"
        expect(valid_card.number).to     eql "255"
        expect(valid_card.artist).to     eql "Jesper Myrfors"
        expect(valid_card.prints).to     eql [{"set" => "1E", "id" => "286"},
                                              {"set" => "2E", "id" => "583"},
                                              {"set" => "2U", "id" => "885"},
                                              {"set" => "3E", "id" => "1383"},
                                              {"set" => "ME2", "id" => "184751"},
                                              {"set" => "ME4", "id" => "202424"}]
      end
    end
  end
end


text: git clone https://github.com/JakeWharton/butterknife.git


text:
<!doctype html>
<html lang="es">
  <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# website: http://ogp.me/ns/website#">
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>{% block title %}{%endblock title%}</title>

    <link rel="canonical" href="{% block rel_canonical%}{% endblock rel_canonical%}" />
    <!--  propuesta Chuko
    <meta name="description" content="{% block descripcion %}{% endblock descripcion %}" >
    <meta name="keywords" content="{% block keywords %}{% endblock keywords %}">
    -->
    <!-- propuesta Chano -->
    <meta name="description" content="{{meta_descripcion}}" >
    <meta name="keywords" content="{{meta_keywords}}">
    <meta property="fb:app_id" content="{%block fb_app_id%}504922086287468{% endblock fb_app_id%}" />
    <meta property="og:type" content="{%block og_type%}website{%endblock og_type%}" />
    <meta property="og:title" content="{% block og_title %}Phyro Server Tehuacán{% endblock og_title %}">
    <meta property="og:url" content="{%block og_url%}{% endblock og_url%}" />
    <meta property="og:description" content="{% block og_descripcion %}{% endblock og_descripcion %}">
    <meta property="og:image" content="{% block og_img %}{% endblock og_img %}">
    <link rel="stylesheet" href="{{STATIC_URL}}css/normalize.css">
    <link rel="stylesheet" href="{{STATIC_URL}}css/foundation.css" />
    <link rel="stylesheet" href="{{STATIC_URL}}css/foundation-icons.css">
    <link rel="stylesheet" href="{{STATIC_URL}}dist/css/phyrostyles.css">
    <script src="{{STATIC_URL}}js/vendor/modernizr.js"></script>
    <!-- Apple Icons -->
    <meta name="apple-mobile-web-app-capable" content="yes">
    <link rel="apple-touch-startup-image" media="(max-device-width: 480px) and (-webkit-min-device-pixel-ratio: 2)" href="{{STATIC_URL}}img/icons/startup-retina.png">
    <link rel="shortcut icon" href="{{STATIC_URL}}img/icons/favicon.ico">
    <link rel="apple-touch-icon" sizes="57x57" href="{{STATIC_URL}}img/icons/apple-touch-icon-57x57.png">
    <link rel="apple-touch-icon" sizes="114x114" href="{{STATIC_URL}}img/icons/apple-touch-icon-114x114.png">
    <link rel="apple-touch-icon" sizes="72x72" href="{{STATIC_URL}}img/icons/apple-touch-icon-72x72.png">
    <link rel="apple-touch-icon" sizes="144x144" href="{{STATIC_URL}}img/icons/apple-touch-icon-144x144.png">
    <link rel="apple-touch-icon" sizes="60x60" href="{{STATIC_URL}}img/icons/apple-touch-icon-60x60.png">
    <link rel="apple-touch-icon" sizes="120x120" href="{{STATIC_URL}}img/icons/apple-touch-icon-120x120.png">
    <link rel="apple-touch-icon" sizes="76x76" href="{{STATIC_URL}}img/icons/apple-touch-icon-76x76.png">
    <link rel="apple-touch-icon" sizes="152x152" href="{{STATIC_URL}}img/icons/apple-touch-icon-152x152.png">
    <link rel="icon" type="image/png" href="{{STATIC_URL}}img/icons/favicon-196x196.png" sizes="196x196">
    <link rel="icon" type="image/png" href="{{STATIC_URL}}img/icons/favicon-160x160.png" sizes="160x160">
    <link rel="icon" type="image/png" href="{{STATIC_URL}}img/icons/favicon-96x96.png" sizes="96x96">
    <link rel="icon" type="image/png" href="{{STATIC_URL}}img/icons/favicon-16x16.png" sizes="16x16">
    <link rel="icon" type="image/png" href="{{STATIC_URL}}img/icons/favicon-32x32.png" sizes="32x32">
    <meta name="msapplication-TileColor" content="#00aba9">
    <meta name="msapplication-TileImage" content="{{STATIC_URL}}img/icons/mstile-144x144.png">
    <meta name="msapplication-config" content="{{STATIC_URL}}img/icons/browserconfig.xml">
    <link rel="author" href="{%block rel_author%}{%endblock rel_author%}" />
    <link rel="author" href="/humans.txt" />
    <link rel="sitemap" type="application/xml" title="Sitemap" href="/sitemap.xml">
    {%block head_scripts%}{%endblock head_scripts%}
  </head>
  <body>

    {% block facebook_sdk %}{% endblock facebook_sdk %}
    {% block contenido_base %}{% endblock contenido_base %}

    <!-- Javascript Vendor y de APpjs-->
    <script src="{{STATIC_URL}}js/vendor/jquery.js"></script>
    <script src="{{STATIC_URL}}js/foundation.min.js"></script>
    <script src="{{STATIC_URL}}js/vendor/jquery.cookie.js"></script>
    <script>
      $(document).foundation();
    </script>
    <script src="{{STATIC_URL}}js/codigo.js"></script>
    <!-- mas Javascript despues de inicializar-->
    {%block body_scripts%} {%endblock body_scripts%}
    <!-- Google Analytics Here-->
    {% block analytics%}{% endblock analytics%}
  </body>
</html>


text:
/*
 * Terrain.cpp
 *
 *  Created on: 15 Dec 2010
 *      Author: Mohab
 */
#include <stdio.h>
#include <GL/glut.h>
#include "Terrain.h"

bool Terrain::Create(char *hFileName, char *textureName, int Width, int Height)
{
	terHeight = Height;
	terWidth = Width;

	FILE *fp;
	fp = fopen(hFileName, "rb");
	fread(byteHeightField, 1, Width * Height, fp);
	fclose(fp);

	texture = LoadTexture(textureName, Width, Height);

	for(int i = 0; i < 1024; i++)
		for(int j = 0; j < 1024; j++)
			heightField[i][j] = (int)byteHeightField[i][j];

	int temp = heightField[0][0];
	for(int i = 0; i < 1024; i++)
		for(int j = 0; j < 1024; j++)
			heightField[i][j] -= temp;

	return true;
}

void Terrain::Render(void)
{
	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, texture);
	glColor3f(1,1,1);
	for (int hMapX = 0; hMapX < terWidth-skip; hMapX += skip)
	{
		for (int hMapZ = 0; hMapZ < terHeight-skip; hMapZ += skip)
		{
			glBegin(GL_TRIANGLE_STRIP);

			glTexCoord2f((float) hMapX / terWidth, (float) hMapZ / terHeight);
			glVertex3f(hMapX, heightField[hMapX][hMapZ], hMapZ);

			glTexCoord2f((float) hMapX / terWidth, (float) (hMapZ + skip)
					/ terHeight);
			glVertex3f(hMapX, heightField[hMapX][hMapZ + skip], hMapZ + skip);

			glTexCoord2f((float) (hMapX + skip) / terWidth, (float) hMapZ
					/ terHeight);
			glVertex3f(hMapX + skip, heightField[hMapX + skip][hMapZ], hMapZ);

			glTexCoord2f((float) (hMapX + skip) / terWidth, (float) (hMapZ
					+ skip) / terHeight);
			glVertex3f(hMapX + skip, heightField[hMapX + skip][hMapZ + skip],
					hMapZ + skip);
			glEnd();
		}
	}
	glDisable(GL_TEXTURE_2D);

	/*glBegin(GL_POINTS);
	 for (int hMapX = 0; hMapX < terWidth; hMapX++)
	 {
	 for (int hMapZ = 0; hMapZ < terHeight; hMapZ++)
	 {
	 glVertex3f(hMapX, heightField[hMapX][hMapZ], hMapZ);
	 glBegin(GL_TRIANGLE_STRIP);
	 glVertex3f(hMapX, hHeightField[hMapX][hMapZ], hMapZ);
	 glVertex3f(hMapX, hHeightField[hMapX][hMapZ + 1], hMapZ + 1);
	 glVertex3f(hMapX + 1, hHeightField[hMapX + 1][hMapZ], hMapZ);
	 glVertex3f(hMapX + 1, hHeightField[hMapX + 1][hMapZ + 1], hMapZ + 1);
	 glEnd();
	 }
	 }
	 glEnd();*/
}

unsigned int Terrain::LoadTexture(const char * filename, int width, int height)
{
	unsigned char * data;
	FILE * file;
	file = fopen(filename, "rb");
	if (file == NULL)
		return 0;

	data = (unsigned char *) malloc(width * height * 3);// assign the necessary memory for the texture

	fread(data, width * height * 3, 1, file);
	fclose(file);
	glGenTextures(1, &texture);
	glBindTexture(GL_TEXTURE_2D, texture);
	glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB,
			GL_UNSIGNED_BYTE, data);
	free(data);

	return texture;
}


text:
//
//  SQLOperation.h
//  I366_V1_4
//
//  操作信息记录中最后一条记录的数据库表格
//
//  Created by  on 11-12-28.
//  Copyright (c) 2011年 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <sqlite3.h>
#import "FMDatabase.h"
#import "FMResultSet.h"
#import "FMDatabaseQueue.h"

@interface SQLOperation : NSObject
{
    sqlite3 *database;

    //    FMDatabase *db;

    FMDatabaseQueue *_dbQueue;
}

@property(nonatomic, retain) FMDatabaseQueue *dbQueue;

+ (SQLOperation *)sharedSQLOperation;
+ (void)closeOperation;
- (void)openDatabase;
- (void)closeDatabase;

//信息表
- (void)createTable;

///用户信息表
-(void)UpdateUSERINFO:(NSString*)userID levelNumber:(int)levelnumber;
-(void)UpdateUSERINFO:(NSString*)userID GoldNumber:(int)goldnumber;
-(void)UpdateUSERINFO:(NSString*)userID userIDType:(int)userIDType lastLogintime:(NSString*)timeInter nickName:(NSString*)nickName roletype:(int)roleType winConut:(int)wincount
            losecount:(int)loseCount goldNumber:(int)goldNumber score:(int)score maxconwinnumber:(int)maxconnumber gamecenterID:(NSString*)gamecenterID gameCenterDisplayName:(NSString*)gamedisplayname LastBeatleatLevel:(int)lastBeatleatLevel isPayed:(int)isPayed;
-(void)insertToUSERINFO:(NSString*)userID userIDType:(int)userIDType lastLogintime:(NSString*)timeInter nickName:(NSString*)nickName roletype:(int)roleType winConut:(int)wincount
              losecount:(int)loseCount goldNumber:(int)goldNumber score:(int)score maxconwinnumber:(int)maxconnumber gamecenterID:(NSString*)gamecenterID gameCenterDisplayName:(NSString*)gamedisplayname LastBeatleatLevel:(int)lastBeatleatLevel ispayedUser:(int)isPayed;
- (NSMutableArray *)queryUserInfoByUserID:(int)userID;
- (NSMutableArray *)queryAllUserInfo;

/**
 *
 *
 *  @param type 1 为闯关类型 2为竞赛
 *
 *  @return 查询到的题目
 */
- (NSMutableArray *)queryIdiomInfoAccordType:(int)type userID:(NSString*)userID;
- (int )queryIdiomCountAccordType:(int)type userID:(NSString*)userID;

- (NSMutableArray *)queryIdiomInfoAccordpackageIndex:(int)packageindex secondIndex:(int)secondIndex;

- (NSMutableArray *)queryIdiomInfoAccordLevelIndex:(int)llevelIndex userID:(NSString*)userID;

- (int )queryIdiomCountAccordType:(int)type userID:(NSString*)userID  index:(int)index packageIndex:(int)packageindex;
-(void)UpdateIdiom:(int)packageindex secondIndex:(int)index levelIndex:(int)levelIndex answer:(NSString*)strAnswer optionStr:(NSString*)optionStr IsAnswer:(int)isAnswer
              Type:(int)type explain:(NSString*)explain source:(NSString*)source picName:(NSString*)picName isUnlock:(BOOL)isUnlocked userID:(NSString*)userID;

-(void)insertToIdiom:(int)packageindex secondIndex:(int)index levelIndex:(int)levelIndex answer:(NSString*)strAnswer optionStr:(NSString*)optionStr IsAnswer:(int)isAnswer
                Type:(int)type explain:(NSString*)explain source:(NSString*)source picName:(NSString*)picName isUnlock:(BOOL)isUnlocked userID:(NSString*)userID;

-(void)UpdateIdiomLevel:(int)levelIndex isUnlocked:(BOOL)isUnlock userID:(NSString*)userID;
-(void)UpdateIdiomLevel:(int)levelIndex isAnswer:(int)isAnswer userID:(NSString*)userID;
-(void)UpdateIdiomLevel:(int)levelIndex isAnswer:(int)isAnswer isunlock:(int)isunlock userID:(NSString*)userID;
-(void)DeleteIdiomAccordLevel:(int)levelIndex userID:(NSString*)userID type:(int)type;
-(void)DeleteAllIdiomAccorduserID:(NSString*)userID type:(int)type;

//
-(void)insertGameCenterID:(NSString*)gameCenterID   userID:(NSString*)userID;
- (NSString *)queryUserAccordGameCenteID:(NSString*)strGameCenterID;
- (void)createGameCenterAndUserIDtable;
-(void)UpdateLoginTime:(NSString*)gameCenterID;

- (BOOL)queryUserHasRoleIDInfo:(NSString*)userID  roleID:(int)roleID;
- (BOOL)queryUserRoleIDIsUnlock:(NSString*)userID  roleID:(int)roleID;
-(void)UpdateRoleLockInfo:(NSString*)userID roleID:(int)roleID  isUnlock:(int)isUnlock;
-(void)inserRoleLockInfo:(NSString*)userID  roleID:(int)roleID isUnlock:(int)isUnlock;

//
- (void)createChargeUnDealTable;
-(void)inserchargeUnDealTable:(NSString*)userID  PayID:(NSString*)payID ChanelID:(int)channelID receipt:(NSString*)receipt;
-(void)UpdatechargeUnDealTable:(NSString*)userID  PayID:(NSString*)payID ChanelID:(int)channelID receipt:(NSString*)receipt;
- (BOOL)queryIsHasUnchargeInfo:(NSString*)userID;
- (NSMutableArray*)queryAllUnchargeInfobyUserID:(NSString*)userID;
- (NSMutableArray*)queryAllUnchargeInfoByPayID:(NSString*)payID;
- (NSMutableArray*)queryAllUnchargeInfobyUserID:(NSString*)userID andPayID:(NSString*)payID;
- (void)deleteUndealInfoByPayID:(NSString*)payID;

//
- (BOOL)queryLevelIspurchased:(int)level;
-(void)insertToUnlockPurchaseTableLevel:(int)level ispurchade:(int)ispurchased;
-(void)UpdateUnlockPurchaseTableAccordLevel:(int)level ispurchade:(int)ispurchade;
- (BOOL)queryhasLevelpurchasedinfo:(int)level;

//

-(void)insertPuzzleTabel:(NSString*)strQuestion Answer:(NSString*)strAnswer mainType:(int)mainType subType:(int)subType
                TextType:(NSString*)strTextType puzzleIndex:(int)index levelType:(int)leveltype isAnswer:(int)isAnswer;
-(int)getMaxIndexINTablePUZZLEINFO;
-(BOOL)getIsHasSameQuestion:(NSString*)strQuestion;

//成语大战

-(void)insertIdiomTabelTabel:(int)index hardType:(int)hardType imagePath:(NSString*)imagePath Answer:(NSString*)answer optionStr:(NSString*)optionStr from:(NSString*)strFrom
                     Explain:(NSString*)explain;
//获取所有的数据
-(NSMutableArray*)getAllIdiomModels;
-(void)deleteAllIdioms;

//问答天下
-(void)UpdateQuestionsTabel:(int)index question:(NSString*)question Answer:(NSString*)answer cateary:(NSString*)strCateary AoptionStr:(NSString*)AoptionStr BoptionStr:(NSString*)BoptionStr CoptionStr:(NSString*)CoptionStr DoptionStr:(NSString*)DoptionStr RightoptionStr:(NSString*)rightoptionStr Explain:(NSString*)explain;
-(void)insertQuestionsTabel:(int)index question:(NSString*)question Answer:(NSString*)answer cateary:(NSString*)strCateary AoptionStr:(NSString*)AoptionStr BoptionStr:(NSString*)BoptionStr CoptionStr:(NSString*)CoptionStr DoptionStr:(NSString*)DoptionStr RightoptionStr:(NSString*)rightoptionStr Explain:(NSString*)explain;
-(void)deleteQuestionsTabel;

@end


text:
from django.test import LiveServerTestCase, override_settings, tag
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from django.contrib.auth.models import User

from selenium import webdriver
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.support.ui import WebDriverWait

from studygroups.models import Course
from studygroups.models import StudyGroup
from custom_registration.models import create_user, confirm_user_email
from e2e.tests.selenium.page_objects import LearningCircleCreationPage
from e2e.tests.selenium.locators import LearningCircleCreationPageLocators
from e2e.tests.selenium.locators import RegistrationModalLocators

from unittest.mock import patch
import socket

@override_settings(ALLOWED_HOSTS=['*'])
class LearningCircleCreation(StaticLiveServerTestCase):
    fixtures = ['test_courses.json', 'e2e/fixtures/test_studygroups.json']
    host = '0.0.0.0'

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
        cls.host = socket.gethostbyname(socket.gethostname())
        chrome_options = webdriver.ChromeOptions()
        chrome_options.add_argument('--disable-web-security')
        #chrome_options.add_argument('--headless')
        chrome_options.add_argument('--no-sandbox')
        chrome_options.add_argument('--disable-gpu')
        #chrome_options.add_argument('--auto-open-devtools-for-tabs')
        #chrome_options.add_argument('--start-maximized')
        capabilities = DesiredCapabilities.CHROME
        capabilities['loggingPrefs'] = { 'browser':'ALL' }
        cls.driver = webdriver.Remote(
          command_executor='http://selenium:4444/wd/hub',
          desired_capabilities=capabilities,
          options=chrome_options
        )
        timeout = 10
        #cls.driver.implicitly_wait(timeout)
        cls.wait = WebDriverWait(cls.driver, timeout)

    @classmethod
    def tearDownClass(cls):
        cls.driver.quit()
        super().tearDownClass()

    def setUp(self):
        mailchimp_patcher = patch('studygroups.models.profile.update_mailchimp_subscription')
        self.mock_maichimp = mailchimp_patcher.start()
        self.addCleanup(mailchimp_patcher.stop)

    def test_page_title(self):
        self.driver.get('%s%s' % (self.live_server_url, '/en/studygroup/create/'))
        self.assertTrue(expected_conditions.title_is('Learning circles'))

    def test_courses_tab(self):
        self.driver.get('%s%s' % (self.live_server_url, '/en/studygroup/create/'))
        creation_page = LearningCircleCreationPage(self.driver, self.wait)
        course_cards = self.driver.find_elements(*LearningCircleCreationPageLocators.COURSE_CARDS)
        published_courses = Course.objects.active().filter(unlisted=False).count()

        self.assertTrue(expected_conditions.text_to_be_present_in_element(LearningCircleCreationPageLocators.TAB_1, 'Step 1: Select a Course *'))
        self.assertEqual(len(course_cards), published_courses)

    def test_learning_circle_errors(self):
        studygroup_count = StudyGroup.objects.all().count()
        user_data = {
            "email": "teddy@test.com",
            "first_name": "Ted",
            "last_name": "Danson",
            "password": "password"
        }
        facilitator = create_user(user_data["email"], user_data["first_name"], user_data["last_name"], user_data["password"])
        self.driver.get('%s%s' % (self.live_server_url, '/en/studygroup/create/'))

        creation_page = LearningCircleCreationPage(self.driver, self.wait)

        creation_page.go_to_tab_5()

        creation_page.click_publish_button()
        self.assertTrue(expected_conditions.visibility_of_element_located(RegistrationModalLocators.REGISTRATION_MODAL))

        creation_page.click_login_link()
        self.assertTrue(expected_conditions.text_to_be_present_in_element(RegistrationModalLocators.REGISTRATION_MODAL_TITLE, 'Log in'))

        creation_page.fill_out_login_modal(user_data)

        self.assertTrue(expected_conditions.alert_is_present())
        self.assertTrue(expected_conditions.text_to_be_present_in_element(LearningCircleCreationPageLocators.SUCCESS_ALERT, "You're logged in! You can now save or publish your learning circle."))

        overlay = self.driver.find_element(*RegistrationModalLocators.MODAL_OVERLAY)
        self.wait.until(expected_conditions.staleness_of(overlay))

        creation_page.click_publish_button()

        self.assertTrue(expected_conditions.alert_is_present())
        self.assertTrue(expected_conditions.text_to_be_present_in_element(LearningCircleCreationPageLocators.DANGER_ALERT, "There was a problem saving your learning circle. Please check the error messages in the form and make the necessary changes."))
        creation_page.close_alert()

        self.assertTrue(expected_conditions.text_to_be_present_in_element(LearningCircleCreationPageLocators.TAB_1_TITLE, "Step 1: Select a Course *"))
        self.assertTrue(expected_conditions.visibility_of_element_located(LearningCircleCreationPageLocators.ERROR_MESSAGE))

        creation_page.go_to_tab_2()
        self.assertTrue(expected_conditions.visibility_of_all_elements_located(LearningCircleCreationPageLocators.ERROR_MESSAGE))

        creation_page.go_to_tab_3()
        self.assertTrue(expected_conditions.visibility_of_all_elements_located(LearningCircleCreationPageLocators.ERROR_MESSAGE))

        creation_page.go_to_tab_4()
        self.assertTrue(expected_conditions.visibility_of_all_elements_located(LearningCircleCreationPageLocators.ERROR_MESSAGE))

        self.assertEqual(studygroup_count, StudyGroup.objects.all().count())

    def test_save_draft_learning_circle(self):
        user_data = {
            "email": "teddy@test.com",
            "first_name": "Ted",
            "last_name": "Danson",
            "password": "password"
        }
        facilitator = create_user(user_data["email"], user_data["first_name"], user_data["last_name"], user_data["password"])
        self.driver.get('%s%s' % (self.live_server_url, '/en/studygroup/create/'))

        creation_page = LearningCircleCreationPage(self.driver, self.wait)
        creation_page.fill_out_form_correctly()

        creation_page.click_save_button()
        self.assertTrue(expected_conditions.visibility_of_element_located(RegistrationModalLocators.REGISTRATION_MODAL))

        creation_page.click_login_link()
        self.assertTrue(expected_conditions.text_to_be_present_in_element(RegistrationModalLocators.REGISTRATION_MODAL_TITLE, 'Log in'))

        creation_page.fill_out_login_modal(user_data)

        self.assertTrue(expected_conditions.alert_is_present())
        self.assertTrue(expected_conditions.text_to_be_present_in_element(LearningCircleCreationPageLocators.SUCCESS_ALERT, "You're logged in! You can now save or publish your learning circle."))

        overlay = self.driver.find_element(*RegistrationModalLocators.MODAL_OVERLAY)
        self.wait.until(expected_conditions.staleness_of(overlay))

        creation_page.click_save_button()

        data = self.driver.get_log('browser')

        self.wait.until(expected_conditions.url_changes('%s%s' % (self.live_server_url, '/en/studygroup/create/')))

        saved_studygroup = StudyGroup.objects.filter(draft=True).last()
        self.assertEqual(saved_studygroup.created_by, facilitator)
        self.assertTrue(expected_conditions.url_to_be('{}/en/studygroup/{}/'.format(self.live_server_url, saved_studygroup.id)))

    def test_publish_learning_circle(self):
        user_data = {
            "email": "teddy@test.com",
            "first_name": "Ted",
            "last_name": "Danson",
            "password": "password"
        }
        facilitator = create_user(user_data["email"], user_data["first_name"], user_data["last_name"], user_data["password"])
        confirm_user_email(facilitator)

        self.driver.get('%s%s' % (self.live_server_url, '/en/studygroup/create/'))

        creation_page = LearningCircleCreationPage(self.driver, self.wait)
        creation_page.fill_out_form_correctly()

        creation_page.click_publish_button()
        self.assertTrue(expected_conditions.visibility_of_element_located(RegistrationModalLocators.REGISTRATION_MODAL))

        creation_page.click_login_link()
        self.assertTrue(expected_conditions.text_to_be_present_in_element(RegistrationModalLocators.REGISTRATION_MODAL_TITLE, 'Log in'))

        creation_page.fill_out_login_modal(user_data)

        self.assertTrue(expected_conditions.alert_is_present())
        self.assertTrue(expected_conditions.text_to_be_present_in_element(LearningCircleCreationPageLocators.SUCCESS_ALERT, "You're logged in! You can now save or publish your learning circle."))

        overlay = self.driver.find_element(*RegistrationModalLocators.MODAL_OVERLAY)
        self.wait.until(expected_conditions.staleness_of(overlay))

        creation_page.click_publish_button()

        data = self.driver.get_log('browser')
        # print(data)

        self.wait.until(expected_conditions.url_changes('%s%s' % (self.live_server_url, '/en/studygroup/create/')))

        published_studygroup = StudyGroup.objects.published().last()
        self.assertEqual(published_studygroup.created_by, facilitator)
        self.assertTrue(expected_conditions.url_to_be('{}/en/studygroup/{}/'.format(self.live_server_url, published_studygroup.id)))


text:
<!-- Author :   Webox Team
     Date   :   July 27, 2015
     Place  :   Boarding House
-->
<html>
    <head>
    <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="keywords" content="" />
        <meta name="description" content="Easy job searh and posting in Bacolod, Cagayan de Oro, Cebu, Davao, Iloilo. We are now lunch our site with free jobposting for the employeer and easily search for the people who very in need job."/>
        <title><?php echo $title; ?></title>
        <link href="/user/favicon.ico?v=1" type="image/x-icon" rel="icon" />
        <link href="/user/favicon.ico?v=1" type="image/x-icon" rel="shortcut icon" />
        <link rel="stylesheet" href="<?php echo base_url(); ?>css/bootstrap.min.css"/>
        <link rel="stylesheet" href="<?php echo base_url(); ?>css/bootstrap-theme.min.css">
        <link rel="stylesheet" href="<?php echo base_url(); ?>css/admin-style.css">
        <script src="<?php echo base_url(); ?>js/jquery.min.js"></script>
        <script src="<?php echo base_url(); ?>js/bootstrap.min.js"></script>

        <script src= "<?php echo base_url();?>js/angular.min.js"></script>

        <link href="<?php echo base_url(); ?>font-awesome-4.2.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    </head>
    <body>
        <div class="container-fluid">


text:
DROP TABLE IF EXISTS `story`;
CREATE TABLE `story`(
  `id`                  INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
  `user_id`             INT(11) NOT NULL,
  `type`                VARCHAR(20) NOT NULL,
  `title`               VARCHAR(100) NOT NULL,
  `image_url`           VARCHAR(100) DEFAULT NULL,
  `body`                VARCHAR(100) DEFAULT NULL,
  `created_time`        TIMESTAMP NOT NULL DEFAULT '2017-001-01 00:00:00'
);


text:
PEAR_Config->isDefinedLayer()
--SKIPIF--
<?php
if (!getenv('PHP_PEAR_RUNTESTS')) {
    echo 'skip';
}
?>
--FILE--
<?php

require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'setup.php.inc';
$config = new PEAR_Config($temp_path . DIRECTORY_SEPARATOR . 'pear.ini', $temp_path .
    DIRECTORY_SEPARATOR . 'nofile');
$phpunit->assertFalse($config->isDefinedLayer('foo'), 'foo');
$phpunit->assertTrue($config->isDefinedLayer('user'), 'user');
$phpunit->assertTrue($config->isDefinedLayer('system'), 'system');
echo 'tests done';
?>
--CLEAN--
<?php
require_once dirname(__FILE__) . '/teardown.php.inc';
?>
--EXPECT--
tests done