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

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.15"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>0.9.9 API documenation: Integer functions</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

0.9.9 API documenation

Functions

Integer functions
Core features

Provides GLSL functions on integer types.
More...

Functions

template<typename genType >

GLM_FUNC_DECL int 	bitCount (genType v)

 	Returns the number of bits set to 1 in the binary representation of value.  More...

template<length_t L, typename T , qualifier Q>

GLM_FUNC_DECL vec< L, int, Q > 	bitCount (vec< L, T, Q > const &v)

 	Returns the number of bits set to 1 in the binary representation of value.  More...

template<length_t L, typename T , qualifier Q>

GLM_FUNC_DECL vec< L, T, Q > 	bitfieldExtract (vec< L, T, Q > const &Value, int Offset, int Bits)

 	Extracts bits [offset, offset + bits - 1] from value, returning them in the least significant bits of the result.  More...

template<length_t L, typename T , qualifier Q>

GLM_FUNC_DECL vec< L, T, Q > 	bitfieldInsert (vec< L, T, Q > const &Base, vec< L, T, Q > const &Insert, int Offset, int Bits)

 	Returns the insertion the bits least-significant bits of insert into base.  More...

template<length_t L, typename T , qualifier Q>

GLM_FUNC_DECL vec< L, T, Q > 	bitfieldReverse (vec< L, T, Q > const &v)

 	Returns the reversal of the bits of value.  More...

template<typename genIUType >

GLM_FUNC_DECL int 	findLSB (genIUType x)

 	Returns the bit number of the least significant bit set to 1 in the binary representation of value.  More...

template<length_t L, typename T , qualifier Q>

GLM_FUNC_DECL vec< L, int, Q > 	findLSB (vec< L, T, Q > const &v)

 	Returns the bit number of the least significant bit set to 1 in the binary representation of value.  More...

template<typename genIUType >

GLM_FUNC_DECL int 	findMSB (genIUType x)

 	Returns the bit number of the most significant bit in the binary representation of value.  More...

template<length_t L, typename T , qualifier Q>

GLM_FUNC_DECL vec< L, int, Q > 	findMSB (vec< L, T, Q > const &v)

 	Returns the bit number of the most significant bit in the binary representation of value.  More...

template<length_t L, qualifier Q>

GLM_FUNC_DECL void 	imulExtended (vec< L, int, Q > const &x, vec< L, int, Q > const &y, vec< L, int, Q > &msb, vec< L, int, Q > &lsb)

 	Multiplies 32-bit integers x and y, producing a 64-bit result.  More...

template<length_t L, qualifier Q>

GLM_FUNC_DECL vec< L, uint, Q > 	uaddCarry (vec< L, uint, Q > const &x, vec< L, uint, Q > const &y, vec< L, uint, Q > &carry)

 	Adds 32-bit unsigned integer x and y, returning the sum modulo pow(2, 32).  More...

template<length_t L, qualifier Q>

GLM_FUNC_DECL void 	umulExtended (vec< L, uint, Q > const &x, vec< L, uint, Q > const &y, vec< L, uint, Q > &msb, vec< L, uint, Q > &lsb)

 	Multiplies 32-bit integers x and y, producing a 64-bit result.  More...

template<length_t L, qualifier Q>

GLM_FUNC_DECL vec< L, uint, Q > 	usubBorrow (vec< L, uint, Q > const &x, vec< L, uint, Q > const &y, vec< L, uint, Q > &borrow)

 	Subtracts the 32-bit unsigned integer y from x, returning the difference if non-negative, or pow(2, 32) plus the difference otherwise.  More...

Detailed Description

Provides GLSL functions on integer types.

These all operate component-wise. The description is per component. The notation [a, b] means the set of bits from bit-number a through bit-number b, inclusive. The lowest-order bit is bit 0.

Include <glm/integer.hpp> to use these core features.

Function Documentation

◆ bitCount() [1/2]

          GLM_FUNC_DECL int glm::bitCount
          (
          genType
          v	)

Returns the number of bits set to 1 in the binary representation of value.

Template Parameters

genType	Signed or unsigned integer scalar or vector types.

See also

GLSL bitCount man page

GLSL 4.20.8 specification, section 8.8 Integer Functions

◆ bitCount() [2/2]

          GLM_FUNC_DECL vec<L, int, Q> glm::bitCount
          (
          vec< L, T, Q > const &
          v	)

Returns the number of bits set to 1 in the binary representation of value.

Template Parameters

L	An integer between 1 and 4 included that qualify the dimension of the vector.

T	Signed or unsigned integer scalar or vector types.

See also

GLSL bitCount man page

GLSL 4.20.8 specification, section 8.8 Integer Functions

◆ bitfieldExtract()

          GLM_FUNC_DECL vec<L, T, Q> glm::bitfieldExtract
          (
          vec< L, T, Q > const &
          Value,

          int
          Offset,

          int
          Bits

          )

Extracts bits [offset, offset + bits - 1] from value, returning them in the least significant bits of the result.

For unsigned data types, the most significant bits of the result will be set to zero. For signed data types, the most significant bits will be set to the value of bit offset + base - 1.

If bits is zero, the result will be zero. The result will be undefined if offset or bits is negative, or if the sum of offset and bits is greater than the number of bits used to store the operand.

Template Parameters

L	An integer between 1 and 4 included that qualify the dimension of the vector.

T	Signed or unsigned integer scalar types.

See also

GLSL bitfieldExtract man page

GLSL 4.20.8 specification, section 8.8 Integer Functions

◆ bitfieldInsert()

          GLM_FUNC_DECL vec<L, T, Q> glm::bitfieldInsert
          (
          vec< L, T, Q > const &
          Base,

          vec< L, T, Q > const &
          Insert,

          int
          Offset,

          int
          Bits

          )

Returns the insertion the bits least-significant bits of insert into base.

The result will have bits [offset, offset + bits - 1] taken from bits [0, bits - 1] of insert, and all other bits taken directly from the corresponding bits of base. If bits is zero, the result will simply be base. The result will be undefined if offset or bits is negative, or if the sum of offset and bits is greater than the number of bits used to store the operand.

Template Parameters

L	An integer between 1 and 4 included that qualify the dimension of the vector.

T	Signed or unsigned integer scalar or vector types.

See also

GLSL bitfieldInsert man page

GLSL 4.20.8 specification, section 8.8 Integer Functions

◆ bitfieldReverse()

          GLM_FUNC_DECL vec<L, T, Q> glm::bitfieldReverse
          (
          vec< L, T, Q > const &
          v	)

Returns the reversal of the bits of value.

The bit numbered n of the result will be taken from bit (bits - 1) - n of value, where bits is the total number of bits used to represent value.

Template Parameters

L	An integer between 1 and 4 included that qualify the dimension of the vector.

T	Signed or unsigned integer scalar or vector types.

See also

GLSL bitfieldReverse man page

GLSL 4.20.8 specification, section 8.8 Integer Functions

◆ findLSB() [1/2]

          GLM_FUNC_DECL int glm::findLSB
          (
          genIUType
          x	)

Returns the bit number of the least significant bit set to 1 in the binary representation of value.

If value is zero, -1 will be returned.

Template Parameters

genIUType	Signed or unsigned integer scalar types.

See also

GLSL findLSB man page

GLSL 4.20.8 specification, section 8.8 Integer Functions

◆ findLSB() [2/2]

          GLM_FUNC_DECL vec<L, int, Q> glm::findLSB
          (
          vec< L, T, Q > const &
          v	)

Returns the bit number of the least significant bit set to 1 in the binary representation of value.

If value is zero, -1 will be returned.

Template Parameters

L	An integer between 1 and 4 included that qualify the dimension of the vector.

T	Signed or unsigned integer scalar types.

See also

GLSL findLSB man page

GLSL 4.20.8 specification, section 8.8 Integer Functions

◆ findMSB() [1/2]

          GLM_FUNC_DECL int glm::findMSB
          (
          genIUType
          x	)

Returns the bit number of the most significant bit in the binary representation of value.

For positive integers, the result will be the bit number of the most significant bit set to 1. For negative integers, the result will be the bit number of the most significant bit set to 0. For a value of zero or negative one, -1 will be returned.

Template Parameters

genIUType	Signed or unsigned integer scalar types.

See also

GLSL findMSB man page

GLSL 4.20.8 specification, section 8.8 Integer Functions

◆ findMSB() [2/2]

          GLM_FUNC_DECL vec<L, int, Q> glm::findMSB
          (
          vec< L, T, Q > const &
          v	)

Returns the bit number of the most significant bit in the binary representation of value.

For positive integers, the result will be the bit number of the most significant bit set to 1. For negative integers, the result will be the bit number of the most significant bit set to 0. For a value of zero or negative one, -1 will be returned.

Template Parameters

L	An integer between 1 and 4 included that qualify the dimension of the vector.

T	Signed or unsigned integer scalar types.

See also

GLSL findMSB man page

GLSL 4.20.8 specification, section 8.8 Integer Functions

◆ imulExtended()

          GLM_FUNC_DECL void glm::imulExtended
          (
          vec< L, int, Q > const &
          x,

          vec< L, int, Q > const &
          y,

          vec< L, int, Q > &
          msb,

          vec< L, int, Q > &
          lsb

          )

Multiplies 32-bit integers x and y, producing a 64-bit result.

The 32 least-significant bits are returned in lsb. The 32 most-significant bits are returned in msb.

Template Parameters

L	An integer between 1 and 4 included that qualify the dimension of the vector.

See also

GLSL imulExtended man page

GLSL 4.20.8 specification, section 8.8 Integer Functions

◆ uaddCarry()

          GLM_FUNC_DECL vec<L, uint, Q> glm::uaddCarry
          (
          vec< L, uint, Q > const &
          x,

          vec< L, uint, Q > const &
          y,

          vec< L, uint, Q > &
          carry

          )

Adds 32-bit unsigned integer x and y, returning the sum modulo pow(2, 32).

The value carry is set to 0 if the sum was less than pow(2, 32), or to 1 otherwise.

Template Parameters

L	An integer between 1 and 4 included that qualify the dimension of the vector.

See also

GLSL uaddCarry man page

GLSL 4.20.8 specification, section 8.8 Integer Functions

◆ umulExtended()

          GLM_FUNC_DECL void glm::umulExtended
          (
          vec< L, uint, Q > const &
          x,

          vec< L, uint, Q > const &
          y,

          vec< L, uint, Q > &
          msb,

          vec< L, uint, Q > &
          lsb

          )

Multiplies 32-bit integers x and y, producing a 64-bit result.

The 32 least-significant bits are returned in lsb. The 32 most-significant bits are returned in msb.

Template Parameters

L	An integer between 1 and 4 included that qualify the dimension of the vector.

See also

GLSL umulExtended man page

GLSL 4.20.8 specification, section 8.8 Integer Functions

◆ usubBorrow()

          GLM_FUNC_DECL vec<L, uint, Q> glm::usubBorrow
          (
          vec< L, uint, Q > const &
          x,

          vec< L, uint, Q > const &
          y,

          vec< L, uint, Q > &
          borrow

          )

Subtracts the 32-bit unsigned integer y from x, returning the difference if non-negative, or pow(2, 32) plus the difference otherwise.

The value borrow is set to 0 if x >= y, or to 1 otherwise.

Template Parameters

L	An integer between 1 and 4 included that qualify the dimension of the vector.

See also

GLSL usubBorrow man page

GLSL 4.20.8 specification, section 8.8 Integer Functions

<address class="footer">
Generated by

 1.8.15
</address>


text:
package org.apache.ignite.visor.commands.deploy

import org.apache.ignite.internal.util.io.GridFilenameUtils
import org.apache.ignite.internal.util.typedef.X
import org.apache.ignite.internal.util.{IgniteUtils => U}

import com.jcraft.jsch._

import java.io._
import java.net.UnknownHostException
import java.util.concurrent._

import org.apache.ignite.visor.VisorTag
import org.apache.ignite.visor.commands.VisorConsoleCommand
import org.apache.ignite.visor.visor._

import scala.language.{implicitConversions, reflectiveCalls}
import scala.util.control.Breaks._

/**
 * Host data.
 */
private case class VisorHost(
    name: String,
    port: Int,
    uname: String,
    passwd: Option[String]
) {
    assert(name != null)
    assert(port > 0)
    assert(uname != null)
    assert(passwd != null)

    override def equals(r: Any) =
        if (this eq r.asInstanceOf[AnyRef])
            true
        else if (r == null || !r.isInstanceOf[VisorHost])
            false
        else
            r.asInstanceOf[VisorHost].name == name

    override def hashCode() =
        name.hashCode()
}

/**
 * Runnable that copies file or directory.
 */
private case class VisorCopier(
    host: VisorHost,
    key: Option[String],
    src: String,
    dest: String
) extends Runnable {
    assert(host != null)
    assert(key != null)
    assert(src != null)
    assert(dest != null)

    assert(host.passwd.isDefined || key.isDefined)
    assert(!(host.passwd.isDefined && key.isDefined))

    /** SSH session. */
    private var ses: Session = null

    override def run() {
        assert(ses == null)

        val ssh = new JSch

        if (key.isDefined)
            ssh.addIdentity(key.get)

        ses = ssh.getSession(host.uname, host.name, host.port)

        if (host.passwd.isDefined)
            ses.setPassword(host.passwd.get)

        ses.setConfig("StrictHostKeyChecking", "no")

        try {
            ses.connect()

            var ch: ChannelSftp = null

            try {
                val ggh = ggHome()

                if (ggh == "")
                    warn("IGNITE_HOME is not set on " + host.name)
                else {
                    ch = ses.openChannel("sftp").asInstanceOf[ChannelSftp]

                    ch.connect()

                    copy(ch, src, GridFilenameUtils.separatorsToUnix(ggh + "/" + dest))

                    println("ok => " + host.name)
                }
            }
            finally {
                if (ch != null && ch.isConnected)
                    ch.disconnect()
            }
        }
        catch {
            case e: JSchException if X.hasCause(e, classOf[UnknownHostException]) =>
                println("Visor Console failed to deploy. Reason: unknown host - " + host.name)

            case e: JSchException =>
                println("Visor Console failed to deploy. Reason: " + e.getMessage)

            case e: Exception =>
                warn(e.getMessage)
        }
        finally {
            if (ses.isConnected)
                ses.disconnect()
        }
    }

    /**
     * Gets `IGNITE_HOME` from remote host.
     *
     * @return `IGNITE_HOME` value.
     */
    private def ggHome(): String = {
        /**
         * Non interactively execute command.
         *
         * @param cmd command.
         * @return command results
         */
        def exec(cmd: String) = {
            val ch = ses.openChannel("exec").asInstanceOf[ChannelExec]

            try {
                ch.setCommand(cmd)

                ch.connect()

                new BufferedReader(new InputStreamReader(ch.getInputStream)).readLine
            }
            catch {
                case e: JSchException =>
                    warn(e.getMessage)

                    ""
            }
            finally {
                if (ch.isConnected)
                    ch.disconnect()
            }
        }

        /**
         * Interactively execute command.
         *
         * @param cmd command.
         * @return command results.
         */
        def shell(cmd: String): String = {
            val ch = ses.openChannel("shell").asInstanceOf[ChannelShell]

            try {
                ch.connect()

                // Added to skip login message.
                U.sleep(1000)

                val writer = new PrintStream(ch.getOutputStream, true)

                val reader = new BufferedReader(new InputStreamReader(ch.getInputStream))

                // Send command.
                writer.println(cmd)

                // Read echo command.
                reader.readLine()

                // Read command result.
                reader.readLine()
            }
            catch {
                case e: JSchException =>
                    warn(e.getMessage)

                    ""
            }
            finally {
                if (ch.isConnected)
                    ch.disconnect()
            }
        }

        /**
         * Checks whether host is running Windows OS.
         *
         * @return Whether host is running Windows OS.
         * @throws JSchException In case of SSH error.
         */
        def windows = {
            try
                exec("cmd.exe") != null
            catch {
                case ignored: IOException => false
            }
        }

        if (windows)
            exec("echo %IGNITE_HOME%")
        else
            shell("echo $IGNITE_HOME") // Use interactive shell under nix because need read env from .profile and etc.
    }

    /**
     * Copies file or directory.
     *
     * @param ch SFTP channel.
     * @param src Source path.
     * @param dest Destination path.
     */
    private def copy(ch: ChannelSftp, src: String, dest: String) {
        assert(ch != null)
        assert(src != null)
        assert(dest != null)

        val root = new File(src)

        if (!root.exists)
            throw new Exception("File or folder not found: " + src)

        try {
            if (root.isDirectory) {
                try
                    ch.ls(dest)
                catch {
                    case _: SftpException => ch.mkdir(dest)
                }

                root.listFiles.foreach(
                    f => copy(ch, f.getPath, GridFilenameUtils.separatorsToUnix(dest + "/" + f.getName)))
            }
            else
                ch.put(src, dest)
        }
        catch {
            case e: SftpException =>
                println("Visor Console failed to deploy from: " + src + " to: " + dest + ". Reason: " + e.getMessage)
            case e: IOException =>
                println("Visor Console failed to deploy from: " + src + " to: " + dest + ". Reason: " + e.getMessage)
        }
    }
}

/**
 * ==Overview==
 * Visor 'deploy' command implementation.
 *
 * ==Help==
 * {{{
 * +---------------------------------------------------+
 * | deploy | Copies file or directory to remote host. |
 * |        | Command relies on SFTP protocol.         |
 * +---------------------------------------------------+
 * }}}
 *
 * ====Specification====
 * {{{
 *     deploy "-h={<username>{:<password>}@}<host>{:<port>} {-u=<username>}
 *         {-p=<password>} {-k=<path>} -s=<path> {-d<path>}"
 * }}}
 *
 * ====Arguments====
 * {{{
 *     -h={<username>{:<password>}@}<host>{:<port>}
 *         Host specification.
 *
 *         <host> can be a hostname, IP or range of IPs.
 *         Example of range is 192.168.1.100~150,
 *         which means all IPs from 192.168.1.100 to 192.168.1.150 inclusively.
 *
 *         Default port number is 22.
 *
 *         This option can be provided multiple times.
 *     -u=<username>
 *         Default username.
 *         Used if specification doesn't contain username.
 *         If default is not provided as well, current local username will be used.
 *     -p=<password>
 *         Default password.
 *         Used if specification doesn't contain password.
 *         If default is not provided as well, it will be asked interactively.
 *     -k=<path>
 *         Path to private key file.
 *         If provided, it will be used for all specifications that doesn't contain password.
 *     -s=<path>
 *         Source path.
 *     -d=<path>
 *         Destination path (relative to IGNITE_HOME).
 *         If not provided, files will be copied to the root of IGNITE_HOME.
 * }}}
 *
 * ====Examples====
 * {{{
 *     deploy "-h=uname:passwd@host -s=/local/path -d=remote/path"
 *         Copies file or directory to remote host (password authentication).
 *     deploy "-h=uname@host -k=ssh-key.pem -s=/local/path -d=remote/path"
 *         Copies file or directory to remote host (private key authentication).
 * }}}
 */
class VisorDeployCommand {
    /** Default port. */
    private val DFLT_PORT = 22

    /** String that specifies range of IPs. */
    private val RANGE_SMB = "~"

    /**
     * Prints error message and advise.
     *
     * @param errMsgs Error messages.
     */
    private def scold(errMsgs: Any*) {
        assert(errMsgs != null)

        nl()

        warn(errMsgs: _*)
        warn("Type 'help deploy' to see how to use this command.")
    }

    /**
     * Catch point for missing arguments case.
     */
    def deploy() {
        scold("Missing arguments.")
    }

    /**
     * ===Command===
     * Copies file or directory to remote host.
     *
     * ===Examples===
     * <ex>deploy "-h=uname:passwd@host -s=/local/path -d=/remote/path"</ex>
     * Copies file or directory to remote host (password authentication).
     *
     * <ex>deploy "-h=uname@host -k=ssh-key.pem -s=/local/path -d=/remote/path"</ex>
     * Copies file or directory to remote host (private key authentication).
     */
    def deploy(args: String) = breakable {
        assert(args != null)

        val argLst = parseArgs(args)

        val dfltUname = argValue("u", argLst)
        val dfltPasswd = argValue("p", argLst)
        val key = argValue("k", argLst)
        val src = argValue("s", argLst)
        val dest = argValue("d", argLst)

        if (!src.isDefined)
            scold("Source is not defined.").^^

        var hosts = Set.empty[VisorHost]

        argLst.filter(_._1 == "h").map(_._2).foreach(h => {
            try
                hosts ++= mkHosts(h, dfltUname, dfltPasswd, key.isDefined)
            catch {
                case e: IllegalArgumentException => scold(e.getMessage).^^
            }
        })

        if (hosts.isEmpty)
            scold("At least one remote host should be specified.").^^

        val copiers = hosts.map(VisorCopier(_, key, src.get, dest getOrElse ""))

        try
            copiers.map(pool.submit(_)).foreach(_.get)
        catch {
            case _: RejectedExecutionException => scold("Failed due to system error.").^^
        }
    }

    /**
     * Parses host string.
     *
     * @param host Host string.
     * @param dfltUname `Option` for default username.
     * @param dfltPasswd `Option` for default password.
     * @param hasKey Whether private key file is defined.
     * @return Set of `Host` instances.
     */
    private def mkHosts(
        host: String,
        dfltUname: Option[String],
        dfltPasswd: Option[String],
        hasKey: Boolean): Set[VisorHost] = {
        assert(host != null)
        assert(dfltUname != null)
        assert(dfltPasswd != null)

        assert(host != null)
        assert(dfltUname != null)
        assert(dfltPasswd != null)

        var arr = host.split('@')

        def extractHostsPort(s: String) = {
            val hostPort = s.split(':')

            val hosts = expandHost(hostPort(0))

            val port =
                try
                    if (hostPort.size > 1) hostPort(1).toInt else DFLT_PORT
                catch {
                    case e: NumberFormatException =>
                        scold("Invalid port number: " + hostPort(1)).^^

                        // Never happens.
                        0
                }

            if (port <= 0)
                scold("Invalid port number: " + port).^^

            (hosts, port)
        }

        if (arr.size == 1) {
            val (hosts, port) = extractHostsPort(arr(0))

            val uname = dfltUname getOrElse System.getProperty("user.name")
            val passwd = if (!hasKey) Some(dfltPasswd getOrElse askPassword(uname)) else None

            hosts.map(VisorHost(_, port, uname, passwd))
        }
        else if (arr.size == 2) {
            val (hosts, port) = extractHostsPort(arr(1))

            arr = arr(0).split(':')

            val uname = arr(0)

            val passwd =
                if (arr.size > 1)
                    Some(arr(1))
                else if (!hasKey)
                    Some(dfltPasswd getOrElse askPassword(uname))
                else
                    None

            hosts.map(VisorHost(_, port, uname, passwd))
        }
        else {
            scold("Invalid host string: " + host).^^

            // Never happens.
            Set.empty
        }
    }

    /**
     * Parses and expands range of IPs, if needed. Host names without the range
     * returned as is.
     *
     * @param addr Host host with or without `~` range.
     * @return Set of individual host names (IPs).
     */
    private def expandHost(addr: String): Set[String] = {
        assert(addr != null)

        if (addr.contains(RANGE_SMB)) {
            val parts = addr.split(RANGE_SMB)

            if (parts.size != 2)
                scold("Invalid IP range: " + addr).^^

            val lastDot = parts(0).lastIndexOf('.')

            if (lastDot < 0)
                scold("Invalid IP range: " + addr).^^

            val (base, begin) = parts(0).splitAt(lastDot)
            val end = parts(1)

            try {
                val a = begin.substring(1).toInt
                val b = end.toInt

                if (a > b)
                    scold("Invalid IP range: " + addr).^^

                (a to b).map(base + "." + _).toSet
            }
            catch {
                case _: NumberFormatException =>
                    scold("Invalid IP range: " + addr).^^

                    // Never happens.
                    Set.empty
            }
        }
        else
            Set(addr)
    }

    /**
     * Interactively asks for password.
     *
     * @param uname Username.
     * @return Password.
     */
    private def askPassword(uname: String): String = {
        assert(uname != null)

        ask("Password for '" + uname + "': ", "", true)
    }
}

/**
 * Companion object that does initialization of the command.
 */
object VisorDeployCommand {
    addHelp(
        name = "deploy",
        shortInfo = "Copies file or folder to remote host.",
        longInfo = List(
            "Copies file or folder to remote host.",
            "Command relies on SFTP protocol."
        ),
        spec = List(
            "deploy -h={<username>{:<password>}@}<host>{:<port>} {-u=<username>}",
            "    {-p=<password>} {-k=<path>} -s=<path> {-d<path>}"
        ),
        args = List(
            "-h={<username>{:<password>}@}<host>{:<port>}" -> List(
                "Host specification.",
                " ",
                "<host> can be a hostname, IP or range of IPs.",
                "Example of range is 192.168.1.100~150,",
                "which means all IPs from 192.168.1.100 to 192.168.1.150 inclusively.",
                " ",
                "Default port number is 22.",
                " ",
                "This option can be provided multiple times."
            ),
            "-u=<username>" -> List(
                "Default username.",
                "Used if specification doesn't contain username.",
                "If default is not provided as well, current local username will be used."
            ),
            "-p=<password>" -> List(
                "Default password.",
                "Used if specification doesn't contain password.",
                "If default is not provided as well, it will be asked interactively."
            ),
            "-k=<path>" -> List(
                "Path to private key file.",
                "If provided, it will be used for all specifications that doesn't contain password."
            ),
            "-s=<path>" -> "Source path.",
            "-d=<path>" -> List(
                "Destination path (relative to $IGNITE_HOME).",
                "If not provided, files will be copied to the root of $IGNITE_HOME."
            )
        ),
        examples = List(
            "deploy -h=uname:passwd@host -s=/local/path -d=/remote/path" ->
                "Copies file or folder to remote host (password authentication).",
            "deploy -h=uname@host -k=ssh-key.pem -s=/local/path -d=/remote/path" ->
                "Copies file or folder to remote host (private key authentication)."
        ),
        ref = VisorConsoleCommand(cmd.deploy, cmd.deploy)
    )

    /** Singleton command. */
    private val cmd = new VisorDeployCommand

    /**
     * Singleton.
     */
    def apply() = cmd

    /**
     * Implicit converter from visor to commands "pimp".
     *
     * @param vs Visor tagging trait.
     */
    implicit def fromDeploy2Visor(vs: VisorTag): VisorDeployCommand = cmd
}

redpajama_set_name: RedPajamaGithub


text:
//  This program is free software: you can redistribute it and/or modify
//  it under the terms of the GNU Lesser General Public License as published by
//  the Free Software Foundation, either version 3 of the License, or
//  (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU Lesser General Public License for more details.
//
//  You should have received a copy of the GNU Lesser General Public License
//  along with this program.  If not, see <http://www.gnu.org/licenses/>.

package org.uma.jmetal.example.multiobjective;

import org.uma.jmetal.algorithm.Algorithm;
import org.uma.jmetal.algorithm.multiobjective.fame.FAME;
import org.uma.jmetal.example.AlgorithmRunner;
import org.uma.jmetal.operator.selection.SelectionOperator;
import org.uma.jmetal.operator.selection.impl.SpatialSpreadDeviationSelection;
import org.uma.jmetal.problem.Problem;
import org.uma.jmetal.solution.doublesolution.DoubleSolution;
import org.uma.jmetal.util.AbstractAlgorithmRunner;
import org.uma.jmetal.util.JMetalException;
import org.uma.jmetal.util.JMetalLogger;
import org.uma.jmetal.util.ProblemUtils;
import org.uma.jmetal.util.evaluator.impl.SequentialSolutionListEvaluator;

import java.io.FileNotFoundException;
import java.util.List;

/**
 * Class to configure and run the FAME algorithm, described in:
 * A. Santiago, B. Dorronsoro, A.J. Nebro, J.J. Durillo, O. Castillo, H.J. Fraire
 * A Novel Multi-Objective Evolutionary Algorithm with Fuzzy Logic Based Adaptive Selection of Operators: FAME.
 * Information Sciences. Volume 471, January 2019, Pages 233-251.
 * DOI: https://doi.org/10.1016/j.ins.2018.09.005
 *
 * @author Alejandro Santiago <aurelio.santiago@upalt.edu.mx>
 */
public class FAMERunner extends AbstractAlgorithmRunner {
  /**
   * @param args Command line arguments.
   * @throws JMetalException
   * @throws FileNotFoundException
   * Invoking command:
    java org.uma.jmetal.runner.multiobjective.FAMERunner problemName
   */
  public static void main(String[] args) throws JMetalException, FileNotFoundException {
    Problem<DoubleSolution> problem;
    Algorithm<List<DoubleSolution>> algorithm;
    SelectionOperator<List<DoubleSolution>, DoubleSolution> selection;

    String problemName = null ;
    if(args.length==0){
      problemName = "org.uma.jmetal.problem.multiobjective.glt.GLT1";
    }else if (args.length == 1) {
      problemName = args[0];
    }

    problem = ProblemUtils.<DoubleSolution> loadProblem(problemName);

    selection = new SpatialSpreadDeviationSelection<DoubleSolution>(5);

    int populationSize=25 ;
    int archiveSize=200 ;
    int maxEvaluations=45000;

    algorithm = new FAME<>(problem,
            populationSize,
            archiveSize,
            maxEvaluations,
            selection,
            new SequentialSolutionListEvaluator<>()) ;

    AlgorithmRunner algorithmRunner = new AlgorithmRunner.Executor(algorithm)
        .execute() ;

    List<DoubleSolution> population = algorithm.getResult() ;
    long computingTime = algorithmRunner.getComputingTime() ;

    JMetalLogger.logger.info("Total execution time: " + computingTime + "ms");

    printFinalSolutionSet(population);
  }
}


text:
package org.jgentleframework.services.datalocator.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.jgentleframework.configure.enums.PathType;
import org.jgentleframework.services.datalocator.data.RepositoryProcessor;

/**
 * This annotation provides configuration information for repository.
 *
 * @author Quoc Chung - mailto: skydunkpro@yahoo.com
 * @date May 5, 2007
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface Repository {
	/** The Constant DEFAULT_SAVE_FILE. */
	public static final String	DEFAULT_SAVE_FILE	= "repository.rps";

	/**
	 * The name of specified file which is saved.
	 *

	 * Default value is {@link Repository#DEFAULT_SAVE_FILE} ("repository.rps")
	 */
	String saveFile() default DEFAULT_SAVE_FILE;

	/**
	 * The specified path type of {@link #saveFile()}.
	 *

	 * Note: if specify {@link PathType#CLASSPATH}, only
	 * {@link RepositoryProcessor#loadRepository() loadRepository} method can be
	 * invoked, but {@link RepositoryProcessor#saveRepository() saveRepository}
	 * method will not be able to invoke. In this case, if
	 * {@link RepositoryProcessor#saveRepository() saveRepository} is invoked by
	 * client, one exception will be thrown at runtime.
	 *

	 * Default value is {@link PathType#USERHOME}
	 */
	PathType pathType() default PathType.USERHOME;
}


text:
package net.i2p.sam;
/*
 * free (adj.): unencumbered; not under the control of others
 * Written by human in 2004 and released into the public domain
 * with no warranty of any kind, either expressed or implied.
 * It probably won't  make your computer catch on fire, or eat
 * your children, but it might.  Use at your own risk.
 *
 */

import java.io.IOException;
import java.nio.channels.SocketChannel;
import java.nio.ByteBuffer;
import java.util.Properties;

import net.i2p.I2PAppContext;
import net.i2p.data.DataHelper;
import net.i2p.util.I2PAppThread;
import net.i2p.util.Log;

/**
 * Base class for SAM protocol handlers.  It implements common
 * methods, but is not able to actually parse the protocol itself:
 * this task is delegated to subclasses.
 *
 * @author human
 */
abstract class SAMHandler implements Runnable {

    protected final Log _log;

    protected I2PAppThread thread = null;
    protected SAMBridge bridge = null;

    private final Object socketWLock = new Object(); // Guards writings on socket
    protected final SocketChannel socket;

    protected final int verMajor;
    protected final int verMinor;

    /** I2CP options configuring the I2CP connection (port, host, numHops, etc) */
    protected final Properties i2cpProps;

    private final Object stopLock = new Object();
    private volatile boolean stopHandler;

    /**
     * SAMHandler constructor (to be called by subclasses)
     *
     * @param s Socket attached to a SAM client
     * @param verMajor SAM major version to manage
     * @param verMinor SAM minor version to manage
     * @param i2cpProps properties to configure the I2CP connection (host, port, etc)
     * @throws IOException
     */
    protected SAMHandler(SocketChannel s,
                         int verMajor, int verMinor, Properties i2cpProps) throws IOException {
        _log = I2PAppContext.getGlobalContext().logManager().getLog(getClass());
        socket = s;

        this.verMajor = verMajor;
        this.verMinor = verMinor;
        this.i2cpProps = i2cpProps;
    }

    /**
     * Start handling the SAM connection, detaching an handling thread.
     *
     */
    public final void startHandling() {
        thread = new I2PAppThread(this, "SAMHandler");
        thread.start();
    }

    public void setBridge(SAMBridge bridge) { this.bridge = bridge; }

    /**
     * Actually handle the SAM protocol.
     *
     */
    protected abstract void handle();

    /**
     * Get the input stream of the socket connected to the SAM client
     *
     * @return input stream
     * @throws IOException
     */
    protected final SocketChannel getClientSocket() {
        return socket ;
    }

    /**
     * Write a byte array on the handler's socket.  This method must
     * always be used when writing data, unless you really know what
     * you're doing.
     *
     * @param data A byte array to be written
     * @throws IOException
     */
    protected final void writeBytes(ByteBuffer data) throws IOException {
        synchronized (socketWLock) {
            writeBytes(data, socket);
        }
    }

    static public void writeBytes(ByteBuffer data, SocketChannel out) throws IOException {
        while (data.hasRemaining()) out.write(data);
        out.socket().getOutputStream().flush();
    }

    /**
     * If you're crazy enough to write to the raw socket, grab the write lock
     * with getWriteLock(), synchronize against it, and write to the getOut()
     *
     * @return socket Write lock object
     */
    protected Object getWriteLock() { return socketWLock; }

    /**
     * Write a string to the handler's socket.  This method must
     * always be used when writing strings, unless you really know what
     * you're doing.
     *
     * @param str A byte array to be written
     *
     * @return True if the string was successfully written, false otherwise
     */
    protected final boolean writeString(String str) {
        synchronized (socketWLock) {
            if (_log.shouldLog(Log.DEBUG))
                _log.debug("Sending the client: [" + str + "]");
            return writeString(str, socket);
        }
    }

    /** @return success */
    public static boolean writeString(String str, SocketChannel out)
    {
    	try {
            writeBytes(ByteBuffer.wrap(DataHelper.getASCII(str)), out);
        } catch (IOException e) {
            //_log.debug("Caught IOException", e);
            return false;
        }
        return true ;
    }

    /**
     * Close the socket connected to the SAM client.
     *
     * @throws IOException
     */
    protected final void closeClientSocket() throws IOException {
            socket.close();
    }

    /**
     * Stop the SAM handler
     *
     */
    public final void stopHandling() {
        synchronized (stopLock) {
            stopHandler = true;
        }
    }

    /**
     * Should the handler be stopped?
     *
     * @return True if the handler should be stopped, false otherwise
     */
    protected final boolean shouldStop() {
        synchronized (stopLock) {
            return stopHandler;
        }
    }

    /**
     * Get a string describing the handler.
     *
     * @return A String describing the handler;
     */
    @Override
    public final String toString() {
        return ("SAM handler (class: " + this.getClass().getName()
                + "; SAM version: " + verMajor + "." + verMinor
                + "; client: "
                + this.socket.socket().getInetAddress().toString() + ":"
                + this.socket.socket().getPort() + ")");
    }

    public final void run() {
        handle();
    }
}


text:
function smf_NewsFader(oOptions)
{
	this.opt = oOptions;

	this.oFaderHandle = document.getElementById(this.opt.sFaderControlId);

	// Fade from... what text color? Default to black.
	this.oFadeFrom = 'oFadeFrom' in this.opt ? this.opt.oFadeFrom : {
		r: 0,
		g: 0,
		b: 0
	};

	// To which background color? Default to white.
	this.oFadeTo = 'oFadeTo' in this.opt ? this.opt.oFadeTo : {
		r: 255,
		g: 255,
		b: 255
	};

	// Surround each item with... anything special?
	this.sItemTemplate = 'sItemTemplate' in this.opt ? this.opt.sItemTemplate : '%1$s';

	// Fade delay (in milliseconds).
	this.iFadeDelay = 'iFadeDelay' in this.opt ? this.opt.iFadeDelay : 5000;

	// The array that contains all the lines of the news for display.
	this.aFaderItems = 'aFaderItems' in this.opt ? this.opt.aFaderItems : [];

	// Should we look for fader data, still?
	this.bReceivedItemsOnConstruction = 'aFaderItems' in this.opt;

	// The current item in smfFadeContent.
	this.iFadeIndex = -1;

	// Percent of fade (-64 to 510).
	this.iFadePercent = 510

	// Direction (in or out).
	this.bFadeSwitch = false;

	// Just make sure the page is loaded before calling the init.
	setTimeout(this.opt.sSelf + '.init();', 1);
}

smf_NewsFader.prototype.init = function init()
{
	var oForeEl, oForeColor, oBackEl, oBackColor;

	// Try to find the fore- and background colors.
	if ('currentStyle' in this.oFaderHandle)
	{
		oForeColor = this.oFaderHandle.currentStyle.color.match(/#([\da-f][\da-f])([\da-f][\da-f])([\da-f][\da-f])/);
		this.oFadeFrom = {
			r: parseInt(oForeColor[1]),
			g: parseInt(oForeColor[2]),
			b: parseInt(oForeColor[3])
		};

		oBackEl = this.oFaderHandle;
		while (oBackEl.currentStyle.backgroundColor == 'transparent' && 'parentNode' in oBackEl)
			oBackEl = oBackEl.parentNode;

		oBackColor = oBackEl.currentStyle.backgroundColor.match(/#([\da-f][\da-f])([\da-f][\da-f])([\da-f][\da-f])/);
		this.oFadeTo = {
			r: eval('0x' + oBackColor[1]),
			g: eval('0x' + oBackColor[2]),
			b: eval('0x' + oBackColor[3])
		};
	}
	else if (!('opera' in window) && 'defaultView' in document)
	{
		oForeEl = this.oFaderHandle;
		while (document.defaultView.getComputedStyle(oForeEl, null).getPropertyCSSValue('color') == null && 'parentNode' in oForeEl && 'tagName' in oForeEl.parentNode)
			oForeEl = oForeEl.parentNode;

		oForeColor = document.defaultView.getComputedStyle(oForeEl, null).getPropertyValue('color').match(/rgb\((\d+), (\d+), (\d+)\)/);
		this.oFadeFrom = {
			r: parseInt(oForeColor[1]),
			g: parseInt(oForeColor[2]),
			b: parseInt(oForeColor[3])
		};

		oBackEl = this.oFaderHandle;
		while (document.defaultView.getComputedStyle(oBackEl, null).getPropertyCSSValue('background-color') == null && 'parentNode' in oBackEl && 'tagName' in oBackEl.parentNode)
			oBackEl = oBackEl.parentNode;

		oBackColor = document.defaultView.getComputedStyle(oBackEl, null).getPropertyValue('background-color');
		this.oFadeTo = {
			r: parseInt(oBackColor[1]),
			g: parseInt(oBackColor[2]),
			b: parseInt(oBackColor[3])
		};
	}

	// Did we get our fader items on construction, or should we be gathering them instead?
	if (!this.bReceivedItemsOnConstruction)
	{
		// Get the news from the list in boardindex
		var oNewsItems = this.oFaderHandle.getElementsByTagName('li');

		// Fill the array that has previously been created
		for (var i = 0, n = oNewsItems.length; i < n; i ++)
			this.aFaderItems[i] = oNewsItems[i].innerHTML;
	}

	// The ranges to fade from for R, G, and B. (how far apart they are.)
	this.oFadeRange = {
		'r': this.oFadeFrom.r - this.oFadeTo.r,
		'g': this.oFadeFrom.g - this.oFadeTo.g,
		'b': this.oFadeFrom.b - this.oFadeTo.b
	};

	// Divide by 20 because we are doing it 20 times per one ms.
	this.iFadeDelay /= 20;

	// Start the fader!
	window.setTimeout(this.opt.sSelf + '.fade();', 20);
}

// Main	fading function... called 50 times every second.
smf_NewsFader.prototype.fade = function fade()
{
	if (this.aFaderItems.length <= 1)
		return;

	// A fix for Internet Explorer 4: wait until the document is loaded so we can use setInnerHTML().
	if ('readyState' in document && document.readyState != 'complete')
	{
		window.setTimeout(this.opt.sSelf + '.fade();', 20);
		return;
	}

	// Starting out?  Set up the first item.
	if (this.iFadeIndex == -1)
	{
		setInnerHTML(this.oFaderHandle, this.sItemTemplate.replace('%1$s', this.aFaderItems[0]));
		this.iFadeIndex = 1;

		// In Mozilla, text jumps around from this when 1 or 0.5, etc...
		if ('MozOpacity' in this.oFaderHandle.style)
			this.oFaderHandle.style.MozOpacity = '0.90';
		else if ('opacity' in this.oFaderHandle.style)
			this.oFaderHandle.style.opacity = '0.90';
		// In Internet Explorer, we have to define this to use it.
		else if ('filter' in this.oFaderHandle.style)
			this.oFaderHandle.style.filter = 'alpha(opacity=100)';
	}

	// Are we already done fading in?  If so, fade out.
	if (this.iFadePercent >= 510)
		this.bFadeSwitch = !this.bFadeSwitch;

	// All the way faded out?
	else if (this.iFadePercent <= -64)
	{
		this.bFadeSwitch = !this.bFadeSwitch;

		// Go to the next item, or first if we're out of items.
		setInnerHTML(this.oFaderHandle, this.sItemTemplate.replace('%1$s', this.aFaderItems[this.iFadeIndex ++]));
		if (this.iFadeIndex >= this.aFaderItems.length)
			this.iFadeIndex = 0;
	}

	// Increment or decrement the fade percentage.
	if (this.bFadeSwitch)
		this.iFadePercent -= 255 / this.iFadeDelay * 2;
	else
		this.iFadePercent += 255 / this.iFadeDelay * 2;

	// If it's not outside 0 and 256... (otherwise it's just delay time.)
	if (this.iFadePercent < 256 && this.iFadePercent > 0)
	{
		// Easier... also faster...
		var tempPercent = this.iFadePercent / 255, rounded;

		if ('MozOpacity' in this.oFaderHandle.style)
		{
			rounded = Math.round(tempPercent * 100) / 100;
			this.oFaderHandle.style.MozOpacity = rounded == 1 ? '0.99' : rounded;
		}
		else if ('opacity' in this.oFaderHandle.style)
		{
			rounded = Math.round(tempPercent * 100) / 100;
			this.oFaderHandle.style.opacity = rounded == 1 ? '0.99' : rounded;
		}
		else
		{
			var done = false;
			if ('alpha' in this.oFaderHandle.filters)
			{
				try
				{
					this.oFaderHandle.filters.alpha.opacity = Math.round(tempPercent * 100);
					done = true;
				}
				catch (err)
				{
				}
			}

			if (!done)
			{
				// Get the new R, G, and B. (it should be bottom + (range of color * percent)...)
				var r = Math.ceil(this.oFadeTo.r + this.oFadeRange.r * tempPercent);
				var g = Math.ceil(this.oFadeTo.g + this.oFadeRange.g * tempPercent);
				var b = Math.ceil(this.oFadeTo.b + this.oFadeRange.b * tempPercent);

				// Set the color in the style, thereby fading it.
				this.oFaderHandle.style.color = 'rgb(' + r + ', ' + g + ', ' + b + ')';
			}
		}
	}

	// Keep going.
	window.setTimeout(this.opt.sSelf + '.fade();', 20);
}


text:
#include "paddle/fluid/framework/device_worker_factory.h"
#include <memory>
#include <string>
#include <unordered_map>

namespace paddle {
namespace framework {

typedef std::shared_ptr<DeviceWorker> (*Createdevice_workerFunction)();
typedef std::unordered_map<std::string, Createdevice_workerFunction>
    device_workerMap;
device_workerMap g_device_worker_map;
#define REGISTER_DEVICE_WORKER_CLASS(device_worker_class)                \
  namespace {                                                            \
  std::shared_ptr<DeviceWorker> Creator_##device_worker_class() {        \
    return std::shared_ptr<DeviceWorker>(new device_worker_class);       \
  }                                                                      \
  class __Registerer_##device_worker_class {                             \
   public:                                                               \
    __Registerer_##device_worker_class() {                               \
      g_device_worker_map[#device_worker_class] =                        \
          &Creator_##device_worker_class;                                \
    }                                                                    \
  };                                                                     \
  __Registerer_##device_worker_class g_registerer_##device_worker_class; \
  }  // namespace

std::string DeviceWorkerFactory::DeviceWorkerTypeList() {
  std::string device_worker_types;
  for (auto iter = g_device_worker_map.begin();
       iter != g_device_worker_map.end(); ++iter) {
    if (iter != g_device_worker_map.begin()) {
      device_worker_types += ", ";
    }
    device_worker_types += iter->first;
  }
  return device_worker_types;
}

std::shared_ptr<DeviceWorker> DeviceWorkerFactory::CreateDeviceWorker(
    std::string device_worker_class) {
  if (g_device_worker_map.count(device_worker_class) < 1) {
    exit(-1);
  }
  return g_device_worker_map[device_worker_class]();
}

REGISTER_DEVICE_WORKER_CLASS(HogwildWorker);
REGISTER_DEVICE_WORKER_CLASS(DownpourWorker);
#if defined(PADDLE_WITH_CUDA) && !defined(_WIN32)
REGISTER_DEVICE_WORKER_CLASS(SectionWorker);
#endif
}  // namespace framework
}  // namespace paddle


text:
.class Landroid/support/v7/widget/SearchView$3;
.super Ljava/lang/Object;
.source "SearchView.java"

# interfaces
.implements Ljava/lang/Runnable;

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/support/v7/widget/SearchView;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation

# instance fields
.field final synthetic this$0:Landroid/support/v7/widget/SearchView;

# direct methods
.method constructor <init>(Landroid/support/v7/widget/SearchView;)V
    .locals 0

    .prologue
    .line 189
    iput-object p1, p0, Landroid/support/v7/widget/SearchView$3;->this$0:Landroid/support/v7/widget/SearchView;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

# virtual methods
.method public run()V
    .locals 2

    .prologue
    .line 191
    iget-object v0, p0, Landroid/support/v7/widget/SearchView$3;->this$0:Landroid/support/v7/widget/SearchView;

    # getter for: Landroid/support/v7/widget/SearchView;->mSuggestionsAdapter:Landroid/support/v4/widget/CursorAdapter;
    invoke-static {v0}, Landroid/support/v7/widget/SearchView;->access$100(Landroid/support/v7/widget/SearchView;)Landroid/support/v4/widget/CursorAdapter;

    move-result-object v0

    if-eqz v0, :cond_0

    iget-object v0, p0, Landroid/support/v7/widget/SearchView$3;->this$0:Landroid/support/v7/widget/SearchView;

    # getter for: Landroid/support/v7/widget/SearchView;->mSuggestionsAdapter:Landroid/support/v4/widget/CursorAdapter;
    invoke-static {v0}, Landroid/support/v7/widget/SearchView;->access$100(Landroid/support/v7/widget/SearchView;)Landroid/support/v4/widget/CursorAdapter;

    move-result-object v0

    instance-of v0, v0, Landroid/support/v7/widget/SuggestionsAdapter;

    if-eqz v0, :cond_0

    .line 192
    iget-object v0, p0, Landroid/support/v7/widget/SearchView$3;->this$0:Landroid/support/v7/widget/SearchView;

    # getter for: Landroid/support/v7/widget/SearchView;->mSuggestionsAdapter:Landroid/support/v4/widget/CursorAdapter;
    invoke-static {v0}, Landroid/support/v7/widget/SearchView;->access$100(Landroid/support/v7/widget/SearchView;)Landroid/support/v4/widget/CursorAdapter;

    move-result-object v0

    const/4 v1, 0x0

    invoke-virtual {v0, v1}, Landroid/support/v4/widget/CursorAdapter;->changeCursor(Landroid/database/Cursor;)V

    .line 194
    :cond_0
    return-void
.end method


text:
from AppKit import NSImageView, NSImage, NSImageAlignCenter, NSImageAlignLeft, NSImageAlignRight, NSImageAlignTop, NSImageAlignTopLeft, NSImageAlignTopRight, NSImageAlignBottom, NSImageAlignBottomLeft, NSImageAlignBottomRight, NSScaleProportionally, NSScaleNone, NSScaleToFit
from vanilla.vanillaBase import VanillaBaseObject

_imageAlignmentMap = {
    ("center", "center") : NSImageAlignCenter,
    ("left", "center") : NSImageAlignLeft,
    ("right", "center") : NSImageAlignRight,
    ("center", "top") : NSImageAlignTop,
    ("left", "top") : NSImageAlignTopLeft,
    ("right", "top") : NSImageAlignTopRight,
    ("center", "bottom") : NSImageAlignBottom,
    ("left", "bottom") : NSImageAlignBottomLeft,
    ("right", "bottom") : NSImageAlignBottomRight
}

_imageScaleMap = {
    "proportional" : NSScaleProportionally,
    "none" : NSScaleNone,
    "fit" : NSScaleToFit
}

class ImageView(VanillaBaseObject):

    """
    A view that displays an image.

    **posSize** Tuple of form *(left, top, width, height)* representing
    the position and size of the view.

    **horizontalAlignment** A string representing the desired horizontal
    alignment of the image in the view. The options are:

    +-------------+-------------------------+
    | "left"      | Image is aligned left.  |
    +-------------+-------------------------+
    | "right"     | Image is aligned right. |
    +-------------+-------------------------+
    | "center"    | Image is centered.      |
    +-------------+-------------------------+

    **verticalAlignment** A string representing the desired vertical alignment
    of the image in the view. The options are:

    +-------------+--------------------------+
    | "top"       | Image is aligned top.    |
    +-------------+--------------------------+
    | "bottom"    | Image is aligned bottom. |
    +-------------+--------------------------+
    | "center"    | Image is centered.       |
    +-------------+--------------------------+

    **scale** A string representing the desired scale style of the image in the
    view. The options are:

    +----------------+----------------------------------------------+
    | "porportional" | Proportionally scale the image to fit in the |
    |                | view if it is larger than the view.          |
    +----------------+----------------------------------------------+
    | "fit"          | Distort the proportions of the image until   |
    |                | it fits exactly in the view.                 |
    +----------------+----------------------------------------------+
    | "none"         | Do not scale the image.                      |
    +----------------+----------------------------------------------+
    """

    nsImageViewClass = NSImageView

    def __init__(self, posSize, horizontalAlignment="center", verticalAlignment="center", scale="proportional"):
        self._setupView(self.nsImageViewClass, posSize)
        align = _imageAlignmentMap[(horizontalAlignment, verticalAlignment)]
        self._nsObject.setImageAlignment_(align)
        scale = _imageScaleMap[scale]
        self._nsObject.setImageScaling_(scale)

    def getNSImageView(self):
        """
        Return the *NSImageView* that this object wraps.
        """
        return self._nsObject

    def setImage(self, imagePath=None, imageNamed=None, imageObject=None):
        """
        Set the image in the view.

        **imagePath** A file path to an image.

        **imageNamed** The name of an image already load as a *NSImage*
        by the application.

        **imageObject** A *NSImage* object.

        *Only one of imagePath, imageNamed, imageObject should be set.*
        """
        if imagePath is not None:
            image = NSImage.alloc().initWithContentsOfFile_(imagePath)
        elif imageNamed is not None:
            image = NSImage.imageNamed_(imageNamed)
        elif imageObject is not None:
            image = imageObject
        else:
            raise ValueError("no image source defined")
        self._nsObject.setImage_(image)


text:
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
'use strict';

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

function _typeof(obj) { return obj && obj.constructor === Symbol ? "symbol" : typeof obj; }

var cookie = exports.cookie = (function () {

    /**
     * Set of helper functions
     * @type {*}
     */
    var helpers = {

        /**
         * Is the given value a plain object / an object whose constructor is `Object`?
         * @param {*} value
         * @returns {boolean}
         */
        isPlainObject: function isPlainObject(value) {
            return !!value && Object.prototype.toString.call(value) === '[object Object]';
        },

        /**
         * Unlike JavaScript's built-in escape functions, this method
         * only escapes characters that are not allowed in cookies.
         * @param {string} value
         * @returns {string}
         */
        encode: function encode(value) {
            return String(value).replace(/[,;"\\=\s%]/g, function (character) {
                return encodeURIComponent(character);
            });
        },

        /**
         * Decode
         * @param {string} value
         * @returns {string}
         */
        decode: function decode(value) {
            return decodeURIComponent(value);
        },

        /**
         * Return fallback if the value is not defined, otherwise return value.
         * @param value
         * @param fallback
         * @returns {*}
         */
        retrieve: function retrieve(value, fallback) {
            return value == null ? fallback : value;
        }
    };

    /**
     * Main module object
     * @type {*}
     * @note
     * Why I'm using 'function() {}' instead of 'Arrow function' ?
     * Pay attention that I'm using 'arrow function' _AND_ regular function declaration with 'function() {}'
     * It's not an accident. 'Arrow function' will keep 'this' of outer scope and in this case it wouldn't be
     * the main 'cookie' object as you hope. It will be global 'this' and in case of module it will get 'undefined'
     * @source https://github.com/babel/babel/issues/562#issuecomment-70914673
     */
    var cookie = {

        /**
         * Default options
         */
        defaultOptions: {
            expires: '',
            domain: null,
            path: null,
            secure: false
        },

        /**
         * By default expires time in the options is in days.
         */
        expiresMultiplier: 60 * 60 * 24,

        /**
         * Set cookie. Value will be escaped for you
         * @param key
         * @param value
         * @param userOptions
         * @returns {*}
         * @example
         *    cookie.set('key', 'value');
         * @example
         *    cookie.set({
         *       key1: 'value1',
         *       key2: 'value2'
         *    });
         * @example
         *    cookie.set('key', 'value', {
         *       expires: 7, // expires in one week
         *    });
         * @note
         * Yes, I'm using 'function() {}' instead of 'Arrow function', see explanation above
         */
        set: function set(key, value, userOptions) {
            if (helpers.isPlainObject(key)) {
                // `key` contains an object with keys and values for cookies, `value` contains the options object.

                for (var k in key) {
                    if (key.hasOwnProperty(k)) this.set(k, key[k], value);
                }
            } else {
                var options = Object.assign(this.defaultOptions, userOptions);

                // Empty string for session cookies.
                var expiresType = _typeof(options.expires);

                if (expiresType === 'string' && options.expires !== '') {
                    options.expires = new Date(options.expires);
                } else if (expiresType === 'number') {
                    // This is needed because IE does not support the `max-age` cookie attribute.
                    options.expires = new Date(+new Date() + 1000 * this.expiresMultiplier * options.expires);
                }

                if (options.expires !== '' && 'toGMTString' in options.expires) {
                    options.expires = ';expires=' + options.expires.toGMTString();
                }

                var path = options.path ? ';path=' + options.path : '';
                var domain = options.domain ? ';domain=' + options.domain : '';
                var secure = options.secure ? ';secure' : '';

                document.cookie = helpers.encode(key) + '=' + helpers.encode(value) + options.expires + path + domain + secure;
            }

            return this; // Return the `cookie` object to make chaining possible.
        },

        /**
         *
         * @param key
         * @param value
         * @param options
         * @returns {*}
         * @note
         * Yes, I'm using 'function() {}' instead of 'Arrow function', see explanation above
         */
        setDefault: function setDefault(key, value, options) {
            if (helpers.isPlainObject(key)) {
                for (var k in key) {
                    if (key.hasOwnProperty(k) && this.get(k) === undefined) this.set(k, key[k], value);
                }
                return cookie;
            } else if (this.get(key) === undefined) {
                return this.set.apply(this, arguments);
            }
        },

        /**
         *
         * @param keyArguments
         * @returns {cookie} - Return the `cookie` object to make chaining possible.
         * @note
         * Yes, I'm using 'function() {}' instead of 'Arrow function', see explanation above
         */
        remove: function remove() {
            for (var _len = arguments.length, keyArguments = Array(_len), _key = 0; _key < _len; _key++) {
                keyArguments[_key] = arguments[_key];
            }

            var keys = Array.isArray(keyArguments[0]) ? keyArguments[0] : keyArguments;

            for (var i = 0, len = keys.length; i < len; i++) {
                this.set(keys[i], '', -1);
            }

            return this;
        },

        /**
         * Remove all cookies
         * @note
         * Yes, I'm using 'function() {}' instead of 'Arrow function', see explanation above
         */
        empty: function empty() {
            this.remove(Object.keys(this.all()));
        },

        /**
         *
         * @param keys
         * @param fallback
         * @returns {*}
         * @note
         * Yes, I'm using 'function() {}' instead of 'Arrow function', see explanation above
         */
        get: function get(keys, fallback) {
            var cookies = this.all();

            if (Array.isArray(keys)) {
                var result = {};

                for (var i = 0, len = keys.length; i < len; i++) {
                    var value = keys[i];
                    result[value] = helpers.retrieve(cookies[value], fallback);
                }

                return result;
            }

            return helpers.retrieve(cookies[keys], fallback);
        },

        /**
         * Returns objet with all available cookie
         * @returns {{}}
         */
        all: function all() {
            if (document.cookie === '') return {};

            var cookies = document.cookie.split('; '),
                result = {};

            for (var i = 0, len = cookies.length; i < len; i++) {
                var item = cookies[i].split('=');
                var key = helpers.decode(item.shift());
                result[key] = helpers.decode(item.join('='));
            }

            return result;
        },

        /**
         * Check whether cookies are enabled in the browser
         * @returns {boolean}
         */
        enabled: function enabled() {
            if (navigator.cookieEnabled) return true;

            var result = cookie.set('_', '_').get('_') === '_';
            cookie.remove('_');
            return result;
        }
    };

    return cookie;
})();

},{}],2:[function(require,module,exports){
'use strict';

var _cookie = require('./cookie.es6.js');

if (_cookie.cookie.enabled()) {
    console.log('Cookie enabled');

    _cookie.cookie.set('my-name', 'artem');

    console.log(_cookie.cookie.all());
} else {
    console.error('Cookie is not enabled in your browser');
}

},{"./cookie.es6":1}]},{},[2])

//# sourceMappingURL=example.es6.js.map


text:
#ifndef RTC_BASE_OPENSSLDIGEST_H_
#define RTC_BASE_OPENSSLDIGEST_H_

#include <openssl/evp.h>

#include "rtc_base/messagedigest.h"

namespace rtc {

// An implementation of the digest class that uses OpenSSL.
class OpenSSLDigest : public MessageDigest {
 public:
  // Creates an OpenSSLDigest with |algorithm| as the hash algorithm.
  explicit OpenSSLDigest(const std::string& algorithm);
  ~OpenSSLDigest() override;
  // Returns the digest output size (e.g. 16 bytes for MD5).
  size_t Size() const override;
  // Updates the digest with |len| bytes from |buf|.
  void Update(const void* buf, size_t len) override;
  // Outputs the digest value to |buf| with length |len|.
  size_t Finish(void* buf, size_t len) override;

  // Helper function to look up a digest's EVP by name.
  static bool GetDigestEVP(const std::string &algorithm,
                           const EVP_MD** md);
  // Helper function to look up a digest's name by EVP.
  static bool GetDigestName(const EVP_MD* md,
                            std::string* algorithm);
  // Helper function to get the length of a digest.
  static bool GetDigestSize(const std::string &algorithm,
                            size_t* len);

 private:
  EVP_MD_CTX ctx_;
  const EVP_MD* md_;
};

}  // namespace rtc

#endif  // RTC_BASE_OPENSSLDIGEST_H_


text:
<md-toast ng-class="messageType == 'error' ? 'errorToast' : 'successToast'">

  		 1">- {{message}}

</md-toast>


text:
package com.amazonaws.services.elasticmapreduce.model.transform;

import java.util.Map;
import java.util.List;

import com.amazonaws.AmazonClientException;
import com.amazonaws.services.elasticmapreduce.model.*;
import com.amazonaws.transform.Marshaller;
import com.amazonaws.util.BinaryUtils;
import com.amazonaws.util.StringUtils;
import com.amazonaws.util.IdempotentUtils;
import com.amazonaws.util.StringInputStream;
import com.amazonaws.protocol.json.*;

/**
 * Ec2InstanceAttributesMarshaller
 */
public class Ec2InstanceAttributesJsonMarshaller {

    /**
     * Marshall the given parameter object, and output to a SdkJsonGenerator
     */
    public void marshall(Ec2InstanceAttributes ec2InstanceAttributes,
            StructuredJsonGenerator jsonGenerator) {

        if (ec2InstanceAttributes == null) {
            throw new AmazonClientException(
                    "Invalid argument passed to marshall(...)");
        }

        try {
            jsonGenerator.writeStartObject();

            if (ec2InstanceAttributes.getEc2KeyName() != null) {
                jsonGenerator.writeFieldName("Ec2KeyName").writeValue(
                        ec2InstanceAttributes.getEc2KeyName());
            }
            if (ec2InstanceAttributes.getEc2SubnetId() != null) {
                jsonGenerator.writeFieldName("Ec2SubnetId").writeValue(
                        ec2InstanceAttributes.getEc2SubnetId());
            }
            if (ec2InstanceAttributes.getEc2AvailabilityZone() != null) {
                jsonGenerator.writeFieldName("Ec2AvailabilityZone").writeValue(
                        ec2InstanceAttributes.getEc2AvailabilityZone());
            }
            if (ec2InstanceAttributes.getIamInstanceProfile() != null) {
                jsonGenerator.writeFieldName("IamInstanceProfile").writeValue(
                        ec2InstanceAttributes.getIamInstanceProfile());
            }
            if (ec2InstanceAttributes.getEmrManagedMasterSecurityGroup() != null) {
                jsonGenerator.writeFieldName("EmrManagedMasterSecurityGroup")
                        .writeValue(
                                ec2InstanceAttributes
                                        .getEmrManagedMasterSecurityGroup());
            }
            if (ec2InstanceAttributes.getEmrManagedSlaveSecurityGroup() != null) {
                jsonGenerator.writeFieldName("EmrManagedSlaveSecurityGroup")
                        .writeValue(
                                ec2InstanceAttributes
                                        .getEmrManagedSlaveSecurityGroup());
            }
            if (ec2InstanceAttributes.getServiceAccessSecurityGroup() != null) {
                jsonGenerator.writeFieldName("ServiceAccessSecurityGroup")
                        .writeValue(
                                ec2InstanceAttributes
                                        .getServiceAccessSecurityGroup());
            }

            com.amazonaws.internal.SdkInternalList<String> additionalMasterSecurityGroupsList = (com.amazonaws.internal.SdkInternalList<String>) ec2InstanceAttributes
                    .getAdditionalMasterSecurityGroups();
            if (!additionalMasterSecurityGroupsList.isEmpty()
                    || !additionalMasterSecurityGroupsList.isAutoConstruct()) {
                jsonGenerator.writeFieldName("AdditionalMasterSecurityGroups");
                jsonGenerator.writeStartArray();
                for (String additionalMasterSecurityGroupsListValue : additionalMasterSecurityGroupsList) {
                    if (additionalMasterSecurityGroupsListValue != null) {
                        jsonGenerator
                                .writeValue(additionalMasterSecurityGroupsListValue);
                    }
                }
                jsonGenerator.writeEndArray();
            }

            com.amazonaws.internal.SdkInternalList<String> additionalSlaveSecurityGroupsList = (com.amazonaws.internal.SdkInternalList<String>) ec2InstanceAttributes
                    .getAdditionalSlaveSecurityGroups();
            if (!additionalSlaveSecurityGroupsList.isEmpty()
                    || !additionalSlaveSecurityGroupsList.isAutoConstruct()) {
                jsonGenerator.writeFieldName("AdditionalSlaveSecurityGroups");
                jsonGenerator.writeStartArray();
                for (String additionalSlaveSecurityGroupsListValue : additionalSlaveSecurityGroupsList) {
                    if (additionalSlaveSecurityGroupsListValue != null) {
                        jsonGenerator
                                .writeValue(additionalSlaveSecurityGroupsListValue);
                    }
                }
                jsonGenerator.writeEndArray();
            }

            jsonGenerator.writeEndObject();
        } catch (Throwable t) {
            throw new AmazonClientException(
                    "Unable to marshall request to JSON: " + t.getMessage(), t);
        }
    }

    private static Ec2InstanceAttributesJsonMarshaller instance;

    public static Ec2InstanceAttributesJsonMarshaller getInstance() {
        if (instance == null)
            instance = new Ec2InstanceAttributesJsonMarshaller();
        return instance;
    }

}


text:
A solution for finding words started by a string. It works well on both front-end and back-end.

## How does it work?
This implementation is inspired by the [binary search algorithm](https://en.wikipedia.org/wiki/Binary_search_algorithm). Like the famous algorithm, this solution uses the divide-and-conquer strategy and when it finds the first item, it searches for items on the left and right, stopping the loop when the first attempt fails.

## Installation
```shell
npm install find-by-words
```

## Parameters
* **wordsList** Array
* **word** String
* **caseSensitive** Boolean (false by default)

## How to use?
```js
findByWords(['python', 'ruby', 'java', 'javascript', 'lua'], 'Java', true);
// output: ['java', 'javascript']
```


text:
@title('Delete Comment')
@extends('app')

@section('content')

        Delete comment by
        @if ($comment->user)
            @avatar($comment->user inline)
        @else
            [nobody]
        @endif

Are you sure you want to delete this comment?

{!! $comment->content_html !!}

    @form(comment/delete)
        @hidden(id $comment)
        @submit = Delete Comment
    @endform
@endsection


text:
package org.syphr.mythtv.monitor.config;

import java.io.IOException;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.syphr.mythtv.api.MythVersion;
import org.syphr.mythtv.api.backend.Backend;
import org.syphr.mythtv.api.frontend.Frontend;
import org.syphr.mythtv.monitor.xsd.config.x10.BackendType;
import org.syphr.mythtv.monitor.xsd.config.x10.BackendsType;
import org.syphr.mythtv.monitor.xsd.config.x10.FrontendType;
import org.syphr.mythtv.monitor.xsd.config.x10.FrontendsType;
import org.syphr.mythtv.monitor.xsd.config.x10.MythTvType;

public class MythTvEnvironment
{
    private static final Logger LOGGER = LoggerFactory.getLogger(MythTvEnvironment.class);

    private final MythVersion mythVersion;

    private Backend masterBackend;
    private final Map<String, Backend> slaveBackends;

    private final Map<String, Frontend> frontends;

    public MythTvEnvironment(MythTvType config) throws MonitorConfigException
    {
        mythVersion = MythVersion.valueOf("_" + config.getVersion().replace('.', '_'));

        slaveBackends = new HashMap<String, Backend>();
        BackendsType backendsType = config.getBackends();
        if (backendsType != null)
        {
            try
            {
                masterBackend = buildBackend(backendsType.getMaster());
            }
            catch (IOException e)
            {
                throw new MonitorConfigException("Failed to connect to master backend", e);
            }

            for (BackendType slave : backendsType.getSlaveArray())
            {
                try
                {
                    slaveBackends.put(slave.getHost(), buildBackend(slave));
                }
                catch (IOException e)
                {
                    LOGGER.error("Failed to connect to slave backend "
                            + slave.getHost()
                            + "; it will not be available for monitoring", e);
                }
            }
        }

        frontends = new HashMap<String, Frontend>();
        FrontendsType frontendsType = config.getFrontends();
        if (frontendsType != null)
        {
            for (FrontendType frontendType : frontendsType.getFrontendArray())
            {
                Frontend frontend = new Frontend(mythVersion);
                frontend.setFrontendConnectionParameters(frontendType.getHost(),
                                                         frontendType.getControlPort(),
                                                         frontendType.getHttpPort());
                frontend.setConnectionTimeout(frontendType.getControlTimeout(),
                                              TimeUnit.MILLISECONDS);

                frontends.put(frontendType.getHost(), frontend);
            }
        }
    }

    private Backend buildBackend(BackendType backendType) throws IOException
    {
        String localHost;
        try
        {
            localHost = InetAddress.getLocalHost().getHostName();
        }
        catch (IOException e)
        {
            localHost = "localhost";
        }

        Backend backend = new Backend(mythVersion);
        backend.setBackendConnectionParameters(localHost,
                                               backendType.getHost(),
                                               backendType.getProtocolPort(),
                                               backendType.getHttpPort());

        return backend;
    }

    public MythVersion getMythVersion()
    {
        return mythVersion;
    }

    public Backend getMasterBackend()
    {
        return masterBackend;
    }

    public List<Backend> getSlaveBackends()
    {
        return new ArrayList<Backend>(slaveBackends.values());
    }

    public List<Backend> getAllBackends()
    {
        List<Backend> backends = new ArrayList<Backend>();
        backends.add(masterBackend);
        backends.addAll(slaveBackends.values());

        return backends;
    }

    public Backend getBackend(String host)
    {
        // TODO
        return null;
    }

    public List<Frontend> getAllFrontends()
    {
        return new ArrayList<Frontend>(frontends.values());
    }

    public Frontend getFrontend(String host)
    {
        return frontends.get(host);
    }
}


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

    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>statsmodels.regression.recursive_ls.RecursiveLSResults.plot_recursive_coefficient — statsmodels 0.9.0 documentation</title>
    <link rel="stylesheet" href="../_static/nature.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />

    <link rel="shortcut icon" href="../_static/statsmodels_hybi_favico.ico"/>
    <link rel="author" title="About these documents" href="../about.html" />
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="statsmodels.regression.recursive_ls.RecursiveLSResults.predict" href="statsmodels.regression.recursive_ls.RecursiveLSResults.predict.html" />
    <link rel="prev" title="statsmodels.regression.recursive_ls.RecursiveLSResults.plot_diagnostics" href="statsmodels.regression.recursive_ls.RecursiveLSResults.plot_diagnostics.html" />
<link rel="stylesheet" href="../_static/examples.css" type="text/css" />
<link rel="stylesheet" href="../_static/facebox.css" type="text/css" />

Navigation

          index

          modules |

          next |

          previous |

Install
  |

Support
  |

Bugs
  |

Develop
  |

Examples
  |

FAQ
  |

Linear Regression |

statsmodels.regression.recursive_ls.RecursiveLSResults |

statsmodels.regression.recursive_ls.RecursiveLSResults.plot_recursive_coefficient¶

RecursiveLSResults.plot_recursive_coefficient(variables=0, alpha=0.05, legend_loc='upper left', fig=None, figsize=None)[source]¶

Plot the recursively estimated coefficients on a given variable

<col class="field-name" />
<col class="field-body" />

Parameters:

variables (int or str or iterable of int or string, optional) – Integer index or string name of the variable whose coefficient will
be plotted. Can also be an iterable of integers or strings. Default
is the first variable.

alpha (float, optional) – The confidence intervals for the coefficient are (1 - alpha) %

legend_loc (string, optional) – The location of the legend in the plot. Default is upper left.

fig (Matplotlib Figure instance, optional) – If given, subplots are created in this figure instead of in a new
figure. Note that the grid will be created in the provided
figure using fig.add_subplot().

figsize (tuple, optional) – If a figure is created, this argument allows specifying a size.
The tuple is (width, height).

Notes

All plots contain (1 - alpha) %  confidence intervals.

Previous topic

statsmodels.regression.recursive_ls.RecursiveLSResults.plot_diagnostics

Next topic

statsmodels.regression.recursive_ls.RecursiveLSResults.predict

This Page

Show Source

Quick search

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

        © Copyright 2009-2017, Josef Perktold, Skipper Seabold, Jonathan Taylor, statsmodels-developers.
      Created using Sphinx 1.7.4.


text:
/****************************************************************************************/
/*                                                                                */
/*                                       Pegasus                                        */
/*                                                                                */
/****************************************************************************************/

//! \file	Log.h
//! \author	Karolyn Boulanger
//! \date	22th August 2013
//! \brief	Log manager, for debug output

#ifndef EDITOR_LOG_H
#define EDITOR_LOG_H

#include "Editor.h"

#include "Pegasus/Core/Shared/LogChannel.h"

#include <QObject>

//! Macro to send a formatted message to the editor log channel
//! \param str String of the message to log, with the same formatting syntax as printf()
//! \warning The number of parameters following str must match the list of formatting
//!          strings inside msgStr.
//! \warning Do not use QString directly as a parameter, call .toLatin1().constData() first.
#define ED_LOG(str, ...)        { Editor::GetInstance().GetLogManager().Log('EDIT', str, __VA_ARGS__); }

//----------------------------------------------------------------------------------------

//! Log manager (singleton) that outputs text to the console dock widget
class LogManager : public QObject
{
    Q_OBJECT

public:

    LogManager(Editor * parent);
    virtual ~LogManager();

    //! Send a formatted message to the console dock widget, for a specific log channel.
    //! \param logChannel Log channel that receives the message
    //! \param msgStr String of the message to log, with the same formatting syntax as printf()
    //! \warning The number of parameters following msgStr must match the list of formatting
    //!          strings inside msgStr.
    //! \warning Do not use QString directly as a parameter, call .toLatin1().constData() first.
    void Log(Pegasus::Core::LogChannel logChannel, const char * msgStr, ...);

    //! Send an unformatted message to the console dock widget, for a specific log channel.
    //! \param logChannel Log channel that receives the message
    //! \param msgStr String of the message to log
    void LogNoFormat(Pegasus::Core::LogChannel logChannel, const QString & msgStr);

private:

    //! Pointer to the parent Editor object
    Editor * mEditor;
};

#endif  // EDITOR_LOG_H


text:
module Incline
  class AccessGroupsController < ApplicationController

    before_action :set_access_group, only: [ :show, :edit, :update, :destroy ]
    before_action :set_dt_request, only: [ :index, :locate ]

    require_admin true

    layout :layout_to_use

    ##
    # GET /incline/access_groups
    def index
    end

    ##
    # GET /incline/access_groups/1
    def show
    end

    ##
    # GET /incline/access_groups/new
    def new
      @access_group = Incline::AccessGroup.new
    end

    ##
    # GET /incline/access_groups/1/edit
    def edit
    end

    ##
    # POST /incline/access_groups
    def create
      @access_group = Incline::AccessGroup.create(access_group_params :before_create)
      if @access_group
        if @access_group.update(access_group_params :after_create)
          handle_update_success notice: 'Access group was successfully created.'
        else
          handle_update_failure :new
        end
      else
        handle_update_failure :new
      end
    end

    ##
    # PATCH/PUT /incline/access_groups/1
    def update
      if @access_group.update(access_group_params)
        handle_update_success notice: 'Access group was successfully updated.'
      else
        handle_update_failure :edit
      end
    end

    ##
    # DELETE /incline/access_groups/1
    def destroy
      @access_group.destroy
      handle_update_success notice: 'Access group was successfully destroyed.'
    end

    # POST /incline/access_groups/1/locate
    def locate
      render json: { record: @dt_request.record_location }
    end

    # GET/POST /incline/access_groups/api?action=...
    def api
      process_api_action
    end

    private

    def layout_to_use
      inline_request? ? false : nil
    end

    def handle_update_failure(action)
      if json_request?
        # add a model-level error and render the json response.
        @access_group.errors.add(:base, 'failed to save')
        render 'show', formats: [ :json ]
      else
        # render the appropriate action.
        render action
      end
    end

    def handle_update_success(*messages)
      if inline_request?
        # inline and json requests expect json on success.
        render 'show', formats: [ :json ]
      else
        # otherwise, we redirect.

        # The default behavior in rails is to redirect to the item that was updated.
        # The default behavior in incline is to redirect to the item collection.

        # To reinstate the default rails behavior, uncomment the line below.
        # redirect_to @<%= singular_table_name %>, *messages unless @<%= singular_table_name %>.destroyed?
        redirect_to access_groups_url, *messages
      end
    end

    def set_dt_request
      @dt_request = Incline::DataTablesRequest.new(params) do
        Incline::AccessGroup.all
      end
    end

    # Use callbacks to share common setup or constraints between actions.
    def set_access_group
      @access_group = Incline::AccessGroup.find(params[:id])
    end

    # Only allow a trusted parameter "white list" through.
    def access_group_params(mode = :all)
      list = []
      list += [ :name ] if mode == :before_create || mode == :all
      list += [ { group_ids: [], user_ids: [] } ] if mode == :after_create || mode == :all

      params.require(:access_group).permit(list)
    end
  end
end


text:
<?php

namespace OrganisationApiTest\Service\Validator;

use DvsaCommon\Enum\AuthorisationForAuthorisedExaminerStatusCode;
use DvsaCommon\Enum\OrganisationSiteStatusCode;
use DvsaCommon\Enum\SiteStatusCode;
use DvsaCommonApi\Service\Exception\BadRequestException;
use DvsaEntities\Entity\AuthForAeStatus;
use DvsaEntities\Entity\AuthorisationForAuthorisedExaminer;
use DvsaEntities\Entity\Organisation;
use DvsaEntities\Entity\Site;
use OrganisationApi\Service\Validator\SiteLinkValidator;
use DvsaEntities\Entity\SiteStatus;

/**
 * Class SiteLinkValidatorTest.
 */
class SiteLinkValidatorTest extends \PHPUnit\Framework\TestCase
{
    const ORGANISATION_ID = 1;
    const SITE_NUMBER = 1;
    const AE_REF = 'AE1234';

    /** @var SiteLinkValidator */
    private $validator;

    public function setUp()
    {
        $this->validator = new SiteLinkValidator();
    }

    /**
     * @dataProvider dataProviderTestValidator
     * @doesNotPerformAssertions
     */
    public function testValidator($organisation, $site, $orgId, $siteNumber, $isExpectError = false)
    {
        if ($isExpectError === true) {
            $this->expectException(BadRequestException::class, 'Validation errors encountered');
        }

        $this->validator->validateLink($organisation, $site, $orgId, $siteNumber);
    }

    public function dataProviderTestValidator()
    {
        $orgEntity = (new Organisation())
            ->setAuthorisedExaminer(
                (new AuthorisationForAuthorisedExaminer())
                    ->setStatus(
                        (new AuthForAeStatus())
                            ->setCode(AuthorisationForAuthorisedExaminerStatusCode::APPROVED)
                    )
            );

        $siteEntity = new Site();
        $siteEntity->setStatus(
            (new SiteStatus())->setCode(SiteStatusCode::APPROVED)
        );

        return [
            //  logical block :: check validateLink method
            //  no errors
            [
                'organisation' => $orgEntity,
                'site' => $siteEntity,
                'orgId' => self::ORGANISATION_ID,
                'siteNumber' => self::SITE_NUMBER,
                'errors' => false,
            ],
            //  Error no organisation
            [
                'organisation' => null,
                'site' => $siteEntity,
                'orgId' => self::ORGANISATION_ID,
                'siteNumber' => self::SITE_NUMBER,
                'errors' => true,
            ],
            //  Error no site
            [
                'organisation' => new Organisation(),
                'site' => null,
                'orgId' => self::ORGANISATION_ID,
                'siteNumber' => self::SITE_NUMBER,
                'errors' => true,
            ],
            //  Error site not approved
            [
                'organisation' => new Organisation(),
                'site' => (new Site())->setStatus((new SiteStatus())->setCode(SiteStatusCode::APPLIED)),
                'orgId' => self::ORGANISATION_ID,
                'siteNumber' => self::SITE_NUMBER,
                'errors' => true,
            ],
            //  Error site already linked
            [
                'organisation' => $orgEntity,
                'site' => (new Site())->setOrganisation(
                                        (new Organisation())->setAuthorisedExaminer(
                                            (new AuthorisationForAuthorisedExaminer())->setNumber(self::AE_REF)
                                        )
                                  )->setStatus((new SiteStatus())->setCode(SiteStatusCode::APPROVED)),
                'orgId' => self::ORGANISATION_ID,
                'siteNumber' => self::SITE_NUMBER,
                'errors' => true,
            ],
            //  Error organisation not approved
            [
                'organisation' => (new Organisation())
                    ->setAuthorisedExaminer(
                        (new AuthorisationForAuthorisedExaminer())
                            ->setStatus(
                                (new AuthForAeStatus())
                                    ->setCode(AuthorisationForAuthorisedExaminerStatusCode::APPLIED)
                            )
                    ),
                'site' => $siteEntity,
                'orgId' => self::ORGANISATION_ID,
                'siteNumber' => self::SITE_NUMBER,
                'errors' => true,
            ],
        ];
    }

    /**
     * @dataProvider dataProviderTestValidateUnlink
     * @doesNotPerformAssertions
     */
    public function testValidateUnlink($status, $isExpectError)
    {
        if ($isExpectError === true) {
            $this->expectException(BadRequestException::class, 'Validation errors encountered');
        }

        $this->validator->validateUnlink($status);
    }

    public function dataProviderTestValidateUnlink()
    {
        return [
            //  success
            [
                'status' => OrganisationSiteStatusCode::SURRENDERED,
                'errors' => false,
            ],
            //  error :: not allowed status
            [
                'status' => OrganisationSiteStatusCode::APPLIED,
                'errors' => true,
            ],
            //  error :: status not provided
            [
                'status' => '',
                'errors' => true,
            ],
        ];
    }
}


text:
<?php

namespace IndicateursBundle\Command;

use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Helper\ProgressBar;
use IndicateursBundle\Model\ImportJtrac;
use IndicateursBundle\Entity\Indic_items;
use IndicateursBundle\Entity\Indic_history;

class ImportJtracCommand extends ContainerAwareCommand
{
    protected function configure()
    {
        $this
            ->setName('import:jtrac')
            ->setDescription('Import des tickets jtrac.')
            ->setHelp("Commande permettant d'importer des tickets jtracs.")
            ->addArgument('fileItems', InputArgument::REQUIRED, 'Jtrac item.')
            ->addArgument('fileHistory', InputArgument::REQUIRED, 'Jtrac history.')
        ;
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $container      = $this->getContainer();
        $itemsFile      = $input->getArgument('fileItems');
        $historyFile    = $input->getArgument('fileHistory');
        $list_project   = $container->getParameter('list_project');
        $dateFormat     = 'Y-m-d H:i:s';

        $output->writeln([
            'Début de l\'import',
            '============',
            '',
        ]);
        $output->writeln([
            'Ouverture des fichiers jtracs',
            '',
        ]);

        $t_jtrac  = $container->get('indicateurs.importjtrac')->getXMLValue($itemsFile,$historyFile);

        $entityManager = $this->getContainer()->get('doctrine')->getManager();

        $output->writeln([
            '',
            'Mise en base des items',
            '',
        ]);
        $t_items = $t_jtrac['items'];

        //Pour faire jolie on créé une progress bar
        $progress = new ProgressBar($output, count($t_items));
        $progress->start();

        if (count($t_items)>0){
            foreach($t_items as $item){
                $itemId = $item['id'];
                //Vérification si le contenu n'existe pas déjà
                $entity_item = $entityManager->getRepository('IndicateursBundle:Indic_items')->getItemByItemId($itemId);
                if($entity_item == Null) {
                    //L'item n'existe pas on le créé
                    $entity_item = new Indic_items();
                }
                $entity_item->setItemId($item['id']);
                /*Traitement pour les id jtrac*/
                $entity_item->setJtracId($list_project[$item['project_id']]['prefix'].'-'.$item['jtrac_id']);
                $entity_item->setProjectId($item['project_id']);
                $entity_item->setCreatedDate($item['created_date']);
                $entity_item->setCreatedBy($item['created_by']);
                $entity_item->setTitle($item['title']);
                $entity_item->setDescription($item['description']);
                $entity_item->setStatus($item['status']);
                if(isset($item['severity'])){
                    $entity_item->setSeverity($item['severity']);
                }
                if(isset($item['priority'])){
                    $entity_item->setPriority($list_project[$item['project_id']]['priority'][$item['priority']]);
                }else{
                    $entity_item->setPriority('-');
                }
                if(isset($item['request_nature'])){
                    //On uniformise la request nature
                    $entity_item->setRequestNature($list_project[$item['project_id']]['type'][$item['request_nature']]);
                }else{
                    $entity_item->setRequestNature('-');
                }
                if(isset($item['cadre'])){
                    $entity_item->setCadre($item['cadre']);
                }
                $entityManager->persist($entity_item);
                //La progressbar avance
                $progress->advance();
            }
            //Sauvegarde en base
            $entityManager->flush();
            //Fin de la barre de progression
            $progress->finish();
        }else{
            echo 'Aucun Item a traiter.', PHP_EOL;
        }

        $output->writeln([
            '',
            'Mise en base des history',
            '',
        ]);

        $t_history = $t_jtrac['historys'];

        //Pour faire jolie on créé une progress bar
        $progress = new ProgressBar($output, count($t_history));
        $progress->start();

        if (count($t_history)>0){
            foreach($t_history as $history){
                $historyId = $history['id'];
                //On ne peut créer une history que si celle ci est rattachée a un item
                //On recherche l'item auquel est rattaché l'history
                $entity_item = $entityManager->getRepository('IndicateursBundle:Indic_Items')->getItemByItemId($history['item_id']);
                if($entity_item != null) {
                    //Vérification si le contenu n'existe pas déjà
                    $entity_history = $entityManager->getRepository('IndicateursBundle:Indic_history')->getHistoryByHistoryId($historyId);
                    if($entity_history == Null) {
                        //L'item n'existe pas on le créé
                        $entity_history = new Indic_history();
                    }
                    $entity_history->setHistoryId($history['id']);
                    $entity_history->setCreatedDate($history['created_date']);
                    if(isset($history['date_qualified']) && $history['date_qualified'] != ""){
                        $entity_history->setQualifiedDate($history['date_qualified']);
                    }
                    $entity_history->setCreatedBy($history['created_by']);
                    if(isset($history['request_nature']) && $history['request_nature'] != ""){
                        $entity_history->setRequestNature($history['request_nature']);
                    }
                    if(isset($history['assigned_to']) && $history['assigned_to'] != ""){
                        $entity_history->setAssignedTo($history['assigned_to']);
                    }
                    if(isset($history['status']) && $history['status'] != ""){
                        $entity_history->setStatus($history['status']);
                    }
                    $entity_history->setIndicItems($entity_item);

                    $entityManager->persist($entity_history);
                }else{
                    //History sans item
                }
                //La progressbar avance
                $progress->advance();
            }
            //Sauvegarde en base
            $entityManager->flush();
            //Fin de la barre de progression
            $progress->finish();
        }else{
            echo 'Aucune History a traiter.', PHP_EOL;
        }

        $output->writeln([
            '',
            'Import terminé',
            '========================',
            '',
        ]);
    }
}


text:
/**
 * APIs and classes used by the {@link org.apache.solr.handler.component.SpellCheckComponent}
 * <p>
 * See {@link org.apache.lucene.search.spell} and {@link org.apache.lucene.search.suggest} for additional information.
 */
package org.apache.solr.spelling;


text:
package org.keycloak.services.x509;

import org.jboss.logging.Logger;
import org.jboss.resteasy.spi.HttpRequest;
import java.security.cert.X509Certificate;

/**
 * The provider retrieves a client certificate and the certificate chain
 * (if any) from the incoming TLS connection.
 * @author Peter Nalyvayko
 * @version $Revision: 1 $
 * @since 3/26/2017
 */

public class DefaultClientCertificateLookup implements X509ClientCertificateLookup {

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

    public static final String JAVAX_SERVLET_REQUEST_X509_CERTIFICATE = "javax.servlet.request.X509Certificate";

    public DefaultClientCertificateLookup() {
    }

    @Override
    public void close() {

    }

    @Override
    public X509Certificate[] getCertificateChain(HttpRequest httpRequest) {

        X509Certificate[] certs = (X509Certificate[]) httpRequest.getAttribute(JAVAX_SERVLET_REQUEST_X509_CERTIFICATE);
        if (certs != null) {
            for (X509Certificate cert : certs) {
                logger.tracef("Certificate's SubjectDN => \"%s\"", cert.getSubjectDN().getName());
            }
        }
        return certs;
    }
}