text:
<?php

namespace Inodata\FloraBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Address.
 *
 * @ORM\Table(name="ino_address")
 * @ORM\Entity
 */
class Address
{
    /**
     * @var int
     *
     * @ORM\Column(name="id", type="integer", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $id;

    /**
     * @var string
     *
     * @ORM\Column(name="street", type="string", length=255, nullable=true)
     */
    private $street;

    /**
     * @var string
     *
     * @ORM\Column(name="no_int", type="string", length=45, nullable=true)
     */
    private $noInt;

    /**
     * @var string
     *
     * @ORM\Column(name="no_ext", type="string", length=45, nullable=true)
     */
    private $noExt;

    /**
     * @var string
     *
     * @ORM\Column(name="reference", type="string", length=255, nullable=true)
     */
    private $reference;

    /**
     * @var string
     *
     * @ORM\Column(name="state", type="string", length=45, nullable=true)
     */
    private $state;

    /**
     * @var string
     *
     * @ORM\Column(name="city", type="string", length=255, nullable=true)
     */
    private $city;

    /**
     * @var int
     *
     * @ORM\Column(name="postal_code", type="integer", nullable=true)
     */
    private $postalCode;

    /**
     * @var string
     *
     * @ORM\Column(name="neighborhood", type="string", length=255, nullable=true)
     */
    private $neighborhood;

    /**
     * @var string
     *
     * @ORM\Column(name="phone", type="string", length=45, nullable=true)
     */
    private $phone;

    /**
     * @var \Employee
     *
     * @ORM\ManyToOne(targetEntity="Employee")
     * @ORM\JoinColumns({
     *   @ORM\JoinColumn(name="messenger_id", referencedColumnName="id")
     * })
     */
    private $messenger;

    /**
     * @var \Customer
     * @ORM\ManyToOne(targetEntity="Customer", inversedBy="addresses", cascade={"persist"})
     * @ORM\JoinColumn(name="customer_id", referencedColumnName="id")
     */
    private $customer;

    /**
     * @var string
     * @ORM\Column(name="address_type", type="string", columnDefinition="ENUM('Delivery','Fiscal', 'Shipping', 'Billing')")
     */
    private $addressType;

    /**
     *@return string
     */
    //TODO: Hacer una funcion getFormatedAddress() para esta cadena, la funcion toString() se debe mantener simple.
    public function __toString()
    {
        $address = $this->street.' '.$this->noExt;
        if (!empty($this->noInt)) {
            $address .= ' Int. '.$this->noInt;
        }
        $address .= "\n".$this->neighborhood;
        $address .= "\n".$this->city.', '.$this->state.', '.$this->postalCode;

        return $address;
    }

    /**
     * Get id.
     *
     * @return int
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set street.
     *
     * @param string $street
     *
     * @return InoAddress
     */
    public function setStreet($street)
    {
        $this->street = $street;

        return $this;
    }

    /**
     * Get street.
     *
     * @return string
     */
    public function getStreet()
    {
        return $this->street;
    }

    /**
     * Set noInt.
     *
     * @param string $noInt
     *
     * @return InoAddress
     */
    public function setNoInt($noInt)
    {
        $this->noInt = $noInt;

        return $this;
    }

    /**
     * Get noInt.
     *
     * @return string
     */
    public function getNoInt()
    {
        return $this->noInt;
    }

    /**
     * Set noExt.
     *
     * @param string $noExt
     *
     * @return InoAddress
     */
    public function setNoExt($noExt)
    {
        $this->noExt = $noExt;

        return $this;
    }

    /**
     * Get noExt.
     *
     * @return string
     */
    public function getNoExt()
    {
        return $this->noExt;
    }

    /**
     * Set state.
     *
     * @param int $state
     *
     * @return InoAddress
     */
    public function setState($state)
    {
        $this->state = $state;

        return $this;
    }

    /**
     * Get state.
     *
     * @return int
     */
    public function getState()
    {
        return $this->state;
    }

    /**
     * Set city.
     *
     * @param string $city
     *
     * @return InoAddress
     */
    public function setCity($city)
    {
        $this->city = $city;

        return $this;
    }

    /**
     * Get city.
     *
     * @return string
     */
    public function getCity()
    {
        return $this->city;
    }

    /**
     * Set postalCode.
     *
     * @param int $postalCode
     *
     * @return InoAddress
     */
    public function setPostalCode($postalCode)
    {
        $this->postalCode = $postalCode;

        return $this;
    }

    /**
     * Get postalCode.
     *
     * @return int
     */
    public function getPostalCode()
    {
        return $this->postalCode;
    }

    /**
     * Set neighborhood.
     *
     * @param string $neighborhood
     *
     * @return InoAddress
     */
    public function setNeighborhood($neighborhood)
    {
        $this->neighborhood = $neighborhood;

        return $this;
    }

    /**
     * Get neighborhood.
     *
     * @return string
     */
    public function getNeighborhood()
    {
        return $this->neighborhood;
    }

    /**
     * Set phone.
     *
     * @param string $phone
     *
     * @return Address
     */
    public function setPhone($phone)
    {
        $this->phone = $phone;

        return $this;
    }

    /**
     * Get phone.
     *
     * @return string
     */
    public function getPhone()
    {
        return $this->phone;
    }

    /**
     * Set reference.
     *
     * @param string $reference
     *
     * @return Address
     */
    public function setReference($reference)
    {
        $this->reference = $reference;

        return $this;
    }

    /**
     * Get reference.
     *
     * @return string
     */
    public function getReference()
    {
        return $this->reference;
    }

    /**
     * Set messenger.
     *
     * @param \Inodata\FloraBundle\Entity\Employee $messenger
     *
     * @return Address
     */
    public function setMessenger(\Inodata\FloraBundle\Entity\Employee $messenger = null)
    {
        $this->messenger = $messenger;

        return $this;
    }

    /**
     * Get messenger.
     *
     * @return \Inodata\FloraBundle\Entity\Employee
     */
    public function getMessenger()
    {
        return $this->messenger;
    }

    /**
     * Set customer.
     *
     * @param \Inodata\FloraBundle\Entity\Customer $customer
     *
     * @return Address
     */
    public function setCustomer(\Inodata\FloraBundle\Entity\Customer $customer = null)
    {
        $this->customer = $customer;

        return $this;
    }

    /**
     * Get customer.
     *
     * @return \Inodata\FloraBundle\Entity\Customer
     */
    public function getCustomer()
    {
        return $this->customer;
    }

    /**
     * Set addressType.
     *
     * @param string $addressType
     *
     * @return Address
     */
    public function setAddressType($addressType)
    {
        $this->addressType = $addressType;

        return $this;
    }

    /**
     * Get addressType.
     *
     * @return string
     */
    public function getAddressType()
    {
        return $this->addressType;
    }
}


text:
/* MadCap Table Style: */

/*<meta Version="9" />*/

mcTableStyle
{
	name: Basic;
	border-collapse: collapse;
	border-left-style: solid;
	border-left-width: 1px;
	border-left-color: #000000;
	border-right-style: solid;
	border-right-width: 1px;
	border-right-color: #000000;
	border-top-style: solid;
	border-top-width: 1px;
	border-top-color: #000000;
	border-bottom-style: solid;
	border-bottom-width: 1px;
	border-bottom-color: #000000;
	max-id: 4;
	cell-padding-left: 4px;
	cell-padding-right: 4px;
	cell-padding-top: 4px;
	cell-padding-bottom: 4px;
	orphans: 2;
}

mcTableColumnStyle
{
	span: 1;
	separator-style: solid;
	separator-width: 1px;
	separator-color: #000000;
	name: Column1;
	id: 0;
}

mcTableHeadStyle
{
	span: 1;
	separator-style: solid;
	separator-width: 1px;
	separator-color: #000000;
	name: Header1;
	id: 2;
	background-color: #201747;
	color: #ffffff;
	font-family: Arial, sans-serif;
	font-weight: bold;
}

mcTableBodyStyle
{
	span: 1;
	separator-style: solid;
	separator-width: 1px;
	separator-color: #000000;
	name: Body1;
	id: 1;
}

mcTableBodyStyle
{
	span: 1;
	id: 4;
	name: Subheading;
	type: Manual;
	background-color: #c6d6ec;
	color: #000000;
	separator-style: solid;
	separator-width: 1px;
	separator-color: #000000;
}

mcTableFootStyle
{
	span: 1;
	separator-style: solid;
	separator-width: 1px;
	separator-color: #000000;
	name: Footer1;
	id: 3;
}

/* Cell Styles: */

.TableStyle-Basic
{
	border-collapse: collapse;
	border-left-style: solid;
	border-left-color: #000000;
	border-left-width: 1px;
	border-right-style: solid;
	border-right-color: #000000;
	border-right-width: 1px;
	border-top-style: solid;
	border-top-color: #000000;
	border-top-width: 1px;
	border-bottom-style: solid;
	border-bottom-color: #000000;
	border-bottom-width: 1px;
	orphans: 2;
	border-spacing: 0px 0px;
}

.TableStyle-Basic-Column-Column1
{

}

.TableStyle-Basic-Head-Header1
{

}

.TableStyle-Basic-HeadI-Column1-Header1
{
	padding-left: 4px;
	padding-right: 4px;
	padding-top: 4px;
	padding-bottom: 4px;
	color: #ffffff;
	font-family: Arial, sans-serif;
	font-weight: bold;
	background-color: #201747;
}

.TableStyle-Basic-HeadI-Column1-Header1 p
{
	color: #ffffff;
	font-family: Arial, sans-serif;
	font-weight: bold;
}

.TableStyle-Basic-HeadE-Column1-Header1
{
	padding-left: 4px;
	padding-right: 4px;
	padding-top: 4px;
	padding-bottom: 4px;
	border-right-width: 1px;
	border-right-color: #000000;
	border-right-style: solid;
	color: #ffffff;
	font-family: Arial, sans-serif;
	font-weight: bold;
	background-color: #201747;
	border-bottom-width: 1px;
	border-bottom-color: #000000;
	border-bottom-style: solid;
}

.TableStyle-Basic-HeadE-Column1-Header1 p
{
	color: #ffffff;
	font-family: Arial, sans-serif;
	font-weight: bold;
}

.TableStyle-Basic-HeadF-Column1-Header1
{
	padding-left: 4px;
	padding-right: 4px;
	padding-top: 4px;
	padding-bottom: 4px;
	color: #ffffff;
	font-family: Arial, sans-serif;
	font-weight: bold;
	background-color: #201747;
	border-bottom-width: 1px;
	border-bottom-color: #000000;
	border-bottom-style: solid;
}

.TableStyle-Basic-HeadF-Column1-Header1 p
{
	color: #ffffff;
	font-family: Arial, sans-serif;
	font-weight: bold;
}

.TableStyle-Basic-HeadH-Column1-Header1
{
	padding-left: 4px;
	padding-right: 4px;
	padding-top: 4px;
	padding-bottom: 4px;
	border-right-width: 1px;
	border-right-color: #000000;
	border-right-style: solid;
	color: #ffffff;
	font-family: Arial, sans-serif;
	font-weight: bold;
	background-color: #201747;
}

.TableStyle-Basic-HeadH-Column1-Header1 p
{
	color: #ffffff;
	font-family: Arial, sans-serif;
	font-weight: bold;
}

.TableStyle-Basic-HeadD-Column1-Header1
{
	padding-left: 4px;
	padding-right: 4px;
	padding-top: 4px;
	padding-bottom: 4px;
	color: #ffffff;
	font-family: Arial, sans-serif;
	font-weight: bold;
	background-color: #201747;
	border-bottom-width: 1px;
	border-bottom-color: #000000;
	border-bottom-style: solid;
}

.TableStyle-Basic-HeadD-Column1-Header1 p
{
	color: #ffffff;
	font-family: Arial, sans-serif;
	font-weight: bold;
}

.TableStyle-Basic-HeadC-Column1-Header1
{
	padding-left: 4px;
	padding-right: 4px;
	padding-top: 4px;
	padding-bottom: 4px;
	color: #ffffff;
	font-family: Arial, sans-serif;
	font-weight: bold;
	background-color: #201747;
}

.TableStyle-Basic-HeadC-Column1-Header1 p
{
	color: #ffffff;
	font-family: Arial, sans-serif;
	font-weight: bold;
}

.TableStyle-Basic-HeadB-Column1-Header1
{
	padding-left: 4px;
	padding-right: 4px;
	padding-top: 4px;
	padding-bottom: 4px;
	border-right-width: 1px;
	border-right-color: #000000;
	border-right-style: solid;
	color: #ffffff;
	font-family: Arial, sans-serif;
	font-weight: bold;
	background-color: #201747;
}

.TableStyle-Basic-HeadB-Column1-Header1 p
{
	color: #ffffff;
	font-family: Arial, sans-serif;
	font-weight: bold;
}

.TableStyle-Basic-HeadA-Column1-Header1
{
	padding-left: 4px;
	padding-right: 4px;
	padding-top: 4px;
	padding-bottom: 4px;
	color: #ffffff;
	font-family: Arial, sans-serif;
	font-weight: bold;
	background-color: #201747;
}

.TableStyle-Basic-HeadA-Column1-Header1 p
{
	color: #ffffff;
	font-family: Arial, sans-serif;
	font-weight: bold;
}

.TableStyle-Basic-HeadG-Column1-Header1
{
	padding-left: 4px;
	padding-right: 4px;
	padding-top: 4px;
	padding-bottom: 4px;
	color: #ffffff;
	font-family: Arial, sans-serif;
	font-weight: bold;
	background-color: #201747;
}

.TableStyle-Basic-HeadG-Column1-Header1 p
{
	color: #ffffff;
	font-family: Arial, sans-serif;
	font-weight: bold;
}

.TableStyle-Basic-Foot-Footer1
{

}

.TableStyle-Basic-FootI-Column1-Footer1
{
	padding-left: 4px;
	padding-right: 4px;
	padding-top: 4px;
	padding-bottom: 4px;
}

.TableStyle-Basic-FootI-Column1-Footer1 p
{

}

.TableStyle-Basic-FootE-Column1-Footer1
{
	padding-left: 4px;
	padding-right: 4px;
	padding-top: 4px;
	padding-bottom: 4px;
	border-right-width: 1px;
	border-right-color: #000000;
	border-right-style: solid;
	border-top-width: 1px;
	border-top-color: #000000;
	border-top-style: solid;
}

.TableStyle-Basic-FootE-Column1-Footer1 p
{

}

.TableStyle-Basic-FootF-Column1-Footer1
{
	padding-left: 4px;
	padding-right: 4px;
	padding-top: 4px;
	padding-bottom: 4px;
	border-top-width: 1px;
	border-top-color: #000000;
	border-top-style: solid;
}

.TableStyle-Basic-FootF-Column1-Footer1 p
{

}

.TableStyle-Basic-FootH-Column1-Footer1
{
	padding-left: 4px;
	padding-right: 4px;
	padding-top: 4px;
	padding-bottom: 4px;
	border-right-width: 1px;
	border-right-color: #000000;
	border-right-style: solid;
}

.TableStyle-Basic-FootH-Column1-Footer1 p
{

}

.TableStyle-Basic-FootD-Column1-Footer1
{
	padding-left: 4px;
	padding-right: 4px;
	padding-top: 4px;
	padding-bottom: 4px;
	border-top-width: 1px;
	border-top-color: #000000;
	border-top-style: solid;
}

.TableStyle-Basic-FootD-Column1-Footer1 p
{

}

.TableStyle-Basic-FootC-Column1-Footer1
{
	padding-left: 4px;
	padding-right: 4px;
	padding-top: 4px;
	padding-bottom: 4px;
}

.TableStyle-Basic-FootC-Column1-Footer1 p
{

}

.TableStyle-Basic-FootB-Column1-Footer1
{
	padding-left: 4px;
	padding-right: 4px;
	padding-top: 4px;
	padding-bottom: 4px;
	border-right-width: 1px;
	border-right-color: #000000;
	border-right-style: solid;
}

.TableStyle-Basic-FootB-Column1-Footer1 p
{

}

.TableStyle-Basic-FootA-Column1-Footer1
{
	padding-left: 4px;
	padding-right: 4px;
	padding-top: 4px;
	padding-bottom: 4px;
}

.TableStyle-Basic-FootA-Column1-Footer1 p
{

}

.TableStyle-Basic-FootG-Column1-Footer1
{
	padding-left: 4px;
	padding-right: 4px;
	padding-top: 4px;
	padding-bottom: 4px;
}

.TableStyle-Basic-FootG-Column1-Footer1 p
{

}

.TableStyle-Basic-Body-Body1
{

}

.TableStyle-Basic-BodyI-Column1-Body1
{
	padding-left: 4px;
	padding-right: 4px;
	padding-top: 4px;
	padding-bottom: 4px;
}

.TableStyle-Basic-BodyI-Column1-Body1 p
{

}

.TableStyle-Basic-BodyE-Column1-Body1
{
	padding-left: 4px;
	padding-right: 4px;
	padding-top: 4px;
	padding-bottom: 4px;
	border-bottom-width: 1px;
	border-bottom-color: #000000;
	border-bottom-style: solid;
	border-right-width: 1px;
	border-right-color: #000000;
	border-right-style: solid;
}

.TableStyle-Basic-BodyE-Column1-Body1 p
{

}

.TableStyle-Basic-BodyF-Column1-Body1
{
	padding-left: 4px;
	padding-right: 4px;
	padding-top: 4px;
	padding-bottom: 4px;
	border-bottom-width: 1px;
	border-bottom-color: #000000;
	border-bottom-style: solid;
}

.TableStyle-Basic-BodyF-Column1-Body1 p
{

}

.TableStyle-Basic-BodyH-Column1-Body1
{
	padding-left: 4px;
	padding-right: 4px;
	padding-top: 4px;
	padding-bottom: 4px;
	border-right-width: 1px;
	border-right-color: #000000;
	border-right-style: solid;
}

.TableStyle-Basic-BodyH-Column1-Body1 p
{

}

.TableStyle-Basic-BodyD-Column1-Body1
{
	padding-left: 4px;
	padding-right: 4px;
	padding-top: 4px;
	padding-bottom: 4px;
	border-bottom-width: 1px;
	border-bottom-color: #000000;
	border-bottom-style: solid;
}

.TableStyle-Basic-BodyD-Column1-Body1 p
{

}

.TableStyle-Basic-BodyC-Column1-Body1
{
	padding-left: 4px;
	padding-right: 4px;
	padding-top: 4px;
	padding-bottom: 4px;
}

.TableStyle-Basic-BodyC-Column1-Body1 p
{

}

.TableStyle-Basic-BodyB-Column1-Body1
{
	padding-left: 4px;
	padding-right: 4px;
	padding-top: 4px;
	padding-bottom: 4px;
	border-right-width: 1px;
	border-right-color: #000000;
	border-right-style: solid;
}

.TableStyle-Basic-BodyB-Column1-Body1 p
{

}

.TableStyle-Basic-BodyA-Column1-Body1
{
	padding-left: 4px;
	padding-right: 4px;
	padding-top: 4px;
	padding-bottom: 4px;
}

.TableStyle-Basic-BodyA-Column1-Body1 p
{

}

.TableStyle-Basic-BodyG-Column1-Body1
{
	padding-left: 4px;
	padding-right: 4px;
	padding-top: 4px;
	padding-bottom: 4px;
}

.TableStyle-Basic-BodyG-Column1-Body1 p
{

}

.TableStyle-Basic-Body-Subheading
{

}

.TableStyle-Basic-BodyI-Column1-Subheading
{
	padding-left: 4px;
	padding-right: 4px;
	padding-top: 4px;
	padding-bottom: 4px;
	color: #000000;
	background-color: #c6d6ec;
}

.TableStyle-Basic-BodyI-Column1-Subheading p
{
	color: #000000;
}

.TableStyle-Basic-BodyE-Column1-Subheading
{
	padding-left: 4px;
	padding-right: 4px;
	padding-top: 4px;
	padding-bottom: 4px;
	color: #000000;
	background-color: #c6d6ec;
	border-bottom-width: 1px;
	border-bottom-color: #000000;
	border-bottom-style: solid;
	border-right-width: 1px;
	border-right-color: #000000;
	border-right-style: solid;
}

.TableStyle-Basic-BodyE-Column1-Subheading p
{
	color: #000000;
}

.TableStyle-Basic-BodyF-Column1-Subheading
{
	padding-left: 4px;
	padding-right: 4px;
	padding-top: 4px;
	padding-bottom: 4px;
	color: #000000;
	background-color: #c6d6ec;
	border-bottom-width: 1px;
	border-bottom-color: #000000;
	border-bottom-style: solid;
}

.TableStyle-Basic-BodyF-Column1-Subheading p
{
	color: #000000;
}

.TableStyle-Basic-BodyH-Column1-Subheading
{
	padding-left: 4px;
	padding-right: 4px;
	padding-top: 4px;
	padding-bottom: 4px;
	color: #000000;
	background-color: #c6d6ec;
	border-right-width: 1px;
	border-right-color: #000000;
	border-right-style: solid;
}

.TableStyle-Basic-BodyH-Column1-Subheading p
{
	color: #000000;
}

.TableStyle-Basic-BodyD-Column1-Subheading
{
	padding-left: 4px;
	padding-right: 4px;
	padding-top: 4px;
	padding-bottom: 4px;
	color: #000000;
	background-color: #c6d6ec;
	border-bottom-width: 1px;
	border-bottom-color: #000000;
	border-bottom-style: solid;
}

.TableStyle-Basic-BodyD-Column1-Subheading p
{
	color: #000000;
}

.TableStyle-Basic-BodyC-Column1-Subheading
{
	padding-left: 4px;
	padding-right: 4px;
	padding-top: 4px;
	padding-bottom: 4px;
	color: #000000;
	background-color: #c6d6ec;
}

.TableStyle-Basic-BodyC-Column1-Subheading p
{
	color: #000000;
}

.TableStyle-Basic-BodyB-Column1-Subheading
{
	padding-left: 4px;
	padding-right: 4px;
	padding-top: 4px;
	padding-bottom: 4px;
	color: #000000;
	background-color: #c6d6ec;
	border-right-width: 1px;
	border-right-color: #000000;
	border-right-style: solid;
}

.TableStyle-Basic-BodyB-Column1-Subheading p
{
	color: #000000;
}

.TableStyle-Basic-BodyA-Column1-Subheading
{
	padding-left: 4px;
	padding-right: 4px;
	padding-top: 4px;
	padding-bottom: 4px;
	color: #000000;
	background-color: #c6d6ec;
}

.TableStyle-Basic-BodyA-Column1-Subheading p
{
	color: #000000;
}

.TableStyle-Basic-BodyG-Column1-Subheading
{
	padding-left: 4px;
	padding-right: 4px;
	padding-top: 4px;
	padding-bottom: 4px;
	color: #000000;
	background-color: #c6d6ec;
}

.TableStyle-Basic-BodyG-Column1-Subheading p
{
	color: #000000;
}

redpajama_set_name: RedPajamaGithub


text: gnome-do style widget that allows keyboard navigation through hierarchal data.


text:
using System.Reflection;

[assembly: AssemblyTitle("NCrontabConsole")]
[assembly: AssemblyDescription("NCrontab console sample")]


text:
[![PyPi version](https://img.shields.io/pypi/v/fifostr.svg)](https://pypi.org/project/FIFOStr/)
[![Build Status](https://travis-ci.com/deftio/fifostr.svg?branch=master)](https://travis-ci.com/deftio/fifostr)
[![Coverage Status](https://coveralls.io/repos/github/deftio/fifostr/badge.svg?branch=master)](https://coveralls.io/github/deftio/fifostr?branch=master)
[![License](https://img.shields.io/badge/License-BSD%202--Clause-blue.svg)](https://opensource.org/licenses/BSD-2-Clause)

# fifostr.py

FIFOStr - A python language string library designed to look for patterns in a stream, such as serial connection or look back parser.  FIFOStr works by allowing character(s) to be inserted in to a FIFOstr object which is treated as FIFO (First-In-First-Out) buffer.  The FIFOstr object can be set to a fixed size so that when a new character is inserted the last character is removed.

Trigger patterns (either strings, regular experssions, or customer parsers written in Python) can be attached to a FIFOstr object.  If that pattern is deteced in a string, a callback function will is called to trigger an action.  There is no limit to the number of patterns that can be deteted and each pattern can have a separate callback.

Since a FIFOstr is a fixed length buffer it can be attached to any stream with predictable resource consumption.  FIFOstr also supports mutable character injection / mutable string support (used to inject / to test patterns).

Example code and a full test suite with CI are provided.  See coverage and test section below.

Logically FIFOstr works as follows:

```python
from fifostr import FIFOStr

#initialize from a given string
myString = FIFOStr("this is a test") # initialize with a string
len(myString) == 14 #true

# The FIFOStr function head( int N) returns the the first N characters
myString.head(4) == "this"  #true

myString+= " more" # this addes the string " more" to myString, each character is fed in and the last character in the FIFOstr is removed.

#initialize with max fixed length
myString.head(4) == "is a"  #true because the string is also a true FIFO and keeps fixed length.  Look at example below for more on pattern matching (and multiple pattern matching for more details)

myString = FIFOStr(10)  # creates a blank FIFOStr max length FIFOStr of 10 chars
len(myString)  # returns 0, there is no data in FIFOstr yet
myString += "This"
len(myString) == 4  # true
myString += " is more stuff"  # add characters to end of string
len(myString) == 10  #true
myString == "more stuff"  # true, string is at max len of 10 chars

#mutable support
myString[2] == 'd' # in place modification (mutable string)
myString == "mode stuff" # string position[2] is changed

#For pattern matching & triggers see examples section.

```

Originally a lighter version of this was used in a python serial terminal program which allowed the serial terminal to parse commands sent/received by both sides.

## Pattern Triggering Features

Built-in pattern matching and triggering:  simply add / remove patterns which then call a callback function (E.g. if the pattern is "seen" then trigger the function).  Patterns can be strings, regexes or user-supplied-functions (parsers written in python). A pattern consists of:
  * pattern: string *or* compiled regex *or* user-supplied-parser-function
  * label: user supplied 'name' for this pattern
  * start index : position in fifostr to begin pattern match.  default is 0  (also accepts the character '^' as start anchor for those familiar with regexes)
  * stop index : position in fifostr to end pattern match.  default is end of fifostr.  the letter '$' has special meaning as end of string no matter the length  (again regex)
  * callback_fn : called if pattern is found, fifostr(start:end) and the label are passed to the callback function  (callback('thematchingstring','label'))
  * active : default is True, sets whether this pattern should be actively looked for
  * mutable string support for changing the contents middle position characters to look at callback responses.

### Installation
```
pip install fifostr # or just pull fifostr.py from the source repository and put in your source path
```

### Original Usage

Originally part of a terminal program called 'dioterm' (albeit in much more compact form), this library was used used to 'listen' to traffic in either direction on a serial port.  When certain patterns were found such as a command sent from the host or a special piece of data from the embedded microntroller client, fifostr would trigger a callback to do something.  This was very useful when sequences of commands had to be set up between the host and client.  Many of these sequences where conditional based on what either the host or client sent resulting in many variations of sequence-test cases, especially if this results in the host then having to make some other call to an unrelated process or hardware to reply correctly.

### Functionality
FIFOStr is a string which is (derived from deque) with these properties:
  * add/remove chars or strings at either end
  * mutable (can set a char to any value like an array with [])
  * use slices, lists, or tuples to retrieve members (just like a real str object)
  * get head/tail (returns as a str)
  * match head/tail  --> match a supplied string to either the head or tail
  * use patterns to trigger callbacks  --> pattern can be string | regex | user_supplied_parser any of which triggers user supplied callback_fn
    * all patterns can look at either the whole fifostr or any subset e.g. addPattern("foo",myCallback,2,5,"bar")
        --> only looks for "foo" between positions 2 and 5 in the fifostr and will call myCallback with ("foo","bar")  if found
    * all patterns have optional label which can be used for logging purposes (eg. when pattern found, in addition to callback, emit label)
    * user supplied callback_fn is called with both the string-match section and the label
    * patterns can be added/deleted from the list of patterns "watching" the fifostr content
    * all (active) patterns are always matched.  fifostr matches multiple different patterns over the same string.
  * clear all patterns --> removes patterns from processing
  * get/setPattern Active/Inactive  --> allows a stored pattern to set on or off
  * Python 2.7+, Python 3+ support, derived from built-in deque package
  * 100% test coverage in both 2.7 and 3.x

### Usage example

See example.py to run in tests dir -- same examples as here but more comments, more use cases

```python
from fifostr import FIFOStr
def main():
    myFifoStr=FIFOStr(5) #make a fifostr of length 5 (for unlimited length omit number)
    myFifoStr+='1234567' #adds 1234567 to fifostr ... but len of fifostr is 5
                         # so only 34567 is retained

    print "myFifoStr.head(3)= ",myFifoStr.head(3) #shows 345
    print "myFifoStr.tail(4)= ",myFifoStr.tail(4) #shows 4567

    # the eqhead and eqtail functions allow string compares against
    # the head or the tail

    myFifoStr.eqhead("3456")    #True
    myFifoStr.eqhead("567")     #False
    myFifoStr.eqtail("4567")    #True
    myFifoStr.eqtail("abc")     #False

    #fifostr.testPattern() allows you to test if the pattern is present in the fifostr object
    #test a  string pattern directly
    myFifoStr.testPattern('67890') #False

    #test a regex pattern directly.  to do this pass any valid regex in compiled form
    r1=re.compile("[0-9]+")
    myFifoStr.testPattern(r1)   #True

    r2=re.compile("[a-z]+")
    myFifoStr.testPattern(r2)   #False

    #more generally we can add (and remove) patterns which will scan and trigger a call back everytime the fifostr
    #internal content changes (whether adding or deleting chars from either end or even rotating/reversing the fifstr object)

    #adding patterns
    p1 = myFifoStr.addPattern("234",logf,label="234 was here") #integer index returned managing pattern
    p2 = myFifoStr.addPattern("67890",logf,label="67890 detected")
    p3 = myFifoStr.addPattern(r1,logf,label="r1 detected")
    myFifoStr.addPattern(r2,logf,label="r2 hit")
    myFifoStr.addPattern(f1,logf,label="f1 hit")
    myFifoStr.addPattern(f2,logf,label="f2 hit")

    #patterns can be set active/inactive via pattern management fns
    myFifoStr.setPatternActiveState(p1,False) #based on index returned from addPattern

    #now show searching for stored pattern matchers in the pattern dict
    #this is not searching the fifo-string itself, just the stored patterns that we have entered
    print("find pattern by label 'foo':",myFifoStr.findPatternByLabel("foo")) #no matches returns empty list
    print("find pattern by label '234 hit':",myFifoStr.findPatternByLabel("234 hit")) #shows match
    print("find pattern by label using regex '[rf][0-9]':")
    pp.pprint(myFifoStr.findPatternByLabel(re.compile("[rf][0-9]")))

    #and finally demonstrate that patterns auto-trigger when items inserted in fifostr .. which afterall
    #is the point of the whole thing.. ;)
    print("\n fifo operations ============")
    for c in '01234567890abcdefghijklmnop':  #show using inc which accomplishes same thing
        myFifoStr += c

    myFifoStr+= 'abcdefghi'
    print (myFifoStr.all())

```

### Notes

FIFOstr is not meant replacement for a compiler/parser front end though it can be used as complex tokenizer.  Internally just iterates over stored patterns every time something is added to the fifostr object.  If you do have a parser you wish to be called then just add it as a callback function so that every time the fifostr is updated with a char(s) it will call your parser to do the work.   Your parser must return a boolean result if you wish to use the callback based triggering.  Multiple custom parsers can be run in along with static string patterns or regexes.

```python
#let your own parser do the work
    myFifo = fifostr(20)  # make a 20 char fifostr
    myFifo.addPattern(myParser,myCallbk) #myParser passed entire fifostr (as str) when char(s) added
    myFifo.addPattern(myParser,myCallbk2,3,5) #myParser passed fifostr btw (3,5).  My Parser must return True if match found for callback to be invoked

```

### Source code
all source is at github:
https://github.com/deftio/fifostr

### Project Home
https://deftio.com/fifostr

### Company Home
docs and other projects at
https://deftio.com/

### Tests & Coverage
for quick usage see
see __main__ in example.py file

for test coverage look in the /tests directory
to run tests pytest needs to be installed.

#### on Ubuntu
```bash
pip install -U pytest pytest-cov
pip install coveralls
```
note: more info at pytest.org  for installation on other OSes

```bash
# running basic tests
cd tests
pytest  #or py.test

# coverage stats below
coverage run --source fifostr -m pytest
coverage report -m
```
### Generating docs
Documenation is generated using pandoc and pydoc from the build scripts.

```bash
sudo apt-get install pandoc
```
documentation is in /docs directory (generated by pydoc)
to (re)generate the docs.  cd to the docs directory. then type:
```bash
pydoc -w ../fifostr.py
```
note that as of this writing pydoc generates its output in the current directory and doesn't seem to be pipeable to another.

### Release History
* 1.1.19 added sys.displayhook chaining for interactive mode display
* 1.1.18 added Str constructor
* 1.1.17 updated to support 3.9x
* 1.1.16 updated to support python 3.7 3.8 3.9 in tests
* 1.1.15 updated PyPi to use README.md instead of README.rst (no other changes)
* 1.1.10 Updated docs and related usage info for repo
* 1.1.9  rebuild for README.md to README.rst conversion using pandoc (no code changes) for PyPi
* 1.1.8  rebuild to make sure proper pkg loaded to PyPi (no code changes)
* 1.1.7  updated MANIFEST.in to use README.rst
* 1.1.6  added PyPi version badge in README.md
* 1.1.5  coverage to 100%, added badging, added README.rst
* 1.1.x  changed class name from fifostr to FIFOStr to make PEP8 compliant.  fixed bug in setup.py (package_dir)
* 1.0.x  documentation clean up
* 1.0.0  Initial release

### README.md vs README.rst
The README.rst is generated from the README.md using pandoc but the content is identical.  (used for PyPi in earlier releases)

### License
See LICENSE.txt file in this directory.   The license is the OSI approved "FreeBSD" 2 clause license.

(c) 2018 m a chatterjee


text:
module Loudmouth
  module Controllers
    module Helpers
      extend ActiveSupport::Concern
      include ActionView::Helpers::SanitizeHelper

      included do
        # helper_method :render_comment_form_for, :render_comments_for
      end

      def render_comment_form_for(topic, user)
        unless Loudmouth.treasure_map.has_key?(topic.class.name.underscore.to_sym)
          raise "loudmouth not setup for #{topic.class.name.underscore.downcase.to_sym}"
        end

        render :partial => 'loudmouth/comments/comment_form',
                :locals => { :topic => topic, :user => user, :content => Loudmouth.new_comment_content }
      end

      def render_comments_for(topic)
        unless Loudmouth.treasure_map.has_key?(topic.class.name.underscore.to_sym)
          raise "loudmouth not setup for #{topic.class.name.underscore.downcase.to_sym}"
        end

        render :partial => 'loudmouth/comments/comment', :collection => topic.comments,
                  :locals => { :topic => topic }
      end

      def has_comments?(topic)
        unless Loudmouth.treasure_map.has_key?(topic.class.name.underscore.to_sym)
          raise "loudmouth not setup for #{topic.class.name.underscore.downcase.to_sym}"
        end
        if topic.comments
          if topic.comments.count > 0
            return true
          end
        end
        return false
      end

      def topic_comment_path(topic)
        send("#{topic.class.name.underscore}_comments_path", topic)
      end

      def break_big_words(text, *args)
         options = args.extract_options!
         unless args.blank?
           options[:max_word_length] = args[0] || 75
         end
         options.reverse_merge!(:max_word_length => 75)
         text = text.split(" ").collect do |word|
           word.length > options[:max_word_length] ? word.gsub(/(.{1,#{options[:max_word_length]}})/, "\\1 ") : word
         end * " "
      end

    end
    module InternalHelpers #:nodoc:
      extend ActiveSupport::Concern
    end
  end
end


text:
/**
 *
 */
package com.github.nest.arcteryx.meta.annotation;

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

/**
 * resource property annotation, to declare an annotation is for annotating a
 * resource property.<br>
 *
 * @author brad.wu
 */
@Target({ ElementType.ANNOTATION_TYPE })
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface ArcteryxResourceProperty {
	/**
	 * generator class
	 *
	 * @return
	 */
	Class<? extends IResourcePropertyDescriptorGenerator> generator();
}


text:
@implementation RAIIBenchmarkTests

- (void)setUp {
    [super setUp];

    // Set-up code here.
}

- (void)tearDown {
    // Tear-down code here.

    [super tearDown];
}

- (void)testExample {

    beginBench(@"single test", {
        NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
        dateFormatter.calendar = [NSCalendar currentCalendar];
        [dateFormatter stringFromDate:[NSDate date]];
    })

    beginBenchLoop(@"loop case", 1000, {
        NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
        dateFormatter.calendar = [NSCalendar currentCalendar];
        [dateFormatter stringFromDate:[NSDate date]];
    })

    // not require __block
    NSMutableArray *array = [NSMutableArray array];
    beginBenchLoop(@"mutable case", 1000, {
        [array addObject:@"test"];
    })

}

@end


text:
import json

import requests
from requests.exceptions import HTTPError

class SmartLogic(object):
    BASE_URL = 'https://cloud.smartlogic.com/'
    SERVICE_URL = 'svc/d3807554-347e-4091-90ea-f107a906aaff/ses/CombinedModel/'

    def __init__(self, api_key):
        self.api_key = api_key
        self._token = self.token()['access_token']

    @property
    def auth_headers(self):
        return {
            'Content-Type': 'application/x-www-form-urlencoded',
            'Authorization': 'Bearer {}'.format(self._token)
        }

    def endpoint(self, method, route, **kwargs):
        url = self.BASE_URL + route

        try:
            response = getattr(requests, method)(url, **kwargs)
        except HTTPError as e:
            raise

        try:
            return response.json()
        except json.JSONDecodeError:
            return response

    def token(self):
        data = {'grant_type': 'apikey', 'key': self.api_key}
        return self.endpoint('post', 'token', data=data)

    def terms(self, params):
        return self.endpoint(
            'post',
            self.SERVICE_URL + 'terms.json',
            params=params,
            headers=self.auth_headers
        )


text:
module Gitlab
  module GitlabImport
    class Importer
      attr_reader :project, :client

      def initialize(project)
        @project = project
        import_data = project.import_data
        if import_data && import_data.credentials && import_data.credentials[:password]
          @client = Client.new(import_data.credentials[:password])
          @formatter = Gitlab::ImportFormatter.new
        else
          raise Projects::ImportService::Error, "Unable to find project import data credentials for project ID: #{@project.id}"
        end
      end

      def execute
        project_identifier = CGI.escape(project.import_source)

        #Issues && Comments
        issues = client.issues(project_identifier)

        issues.each do |issue|
          body = @formatter.author_line(issue["author"]["name"])
          body += issue["description"]

          comments = client.issue_comments(project_identifier, issue["id"])

          if comments.any?
            body += @formatter.comments_header
          end

          comments.each do |comment|
            body += @formatter.comment(comment["author"]["name"], comment["created_at"], comment["body"])
          end

          project.issues.create!(
            description: body,
            title: issue["title"],
            state: issue["state"],
            author_id: gl_user_id(project, issue["author"]["id"])
          )
        end

        true
      end

      private

      def gl_user_id(project, gitlab_id)
        user = User.joins(:identities).find_by("identities.extern_uid = ? AND identities.provider = 'gitlab'", gitlab_id.to_s)
        (user && user.id) || project.creator_id
      end
    end
  end
end


text:
from __future__ import absolute_import
"""
Draw a termite plot to visualize topics and words from an LDA.
"""

import logging

import blaze as blz
from odo import into
import pandas as pd
import bokeh.plotting as plt
from bokeh.models.sources import ColumnDataSource

from topik.tests import test_data_path

class Termite(object):
    """A Bokeh Termite Visualization for LDA results analysis.

    Parameters
    ----------
    input_file: string
        A csv file from an LDA output containing columns "word", "topic" and "weight".
    title: string
        The title for your termite plot

    >>> termite = Termite("{}/termite.csv".format(test_data_path),
    ...                   "My lda results")
    >>> termite.plot('my_termite.html')

    """
    def __init__(self, input_file, title):
        self.input_file = input_file
        self.title = title

    def plot(self, output_file="termite.html"):
        t = blz.Data(self.input_file)
        df = pd.read_csv(self.input_file)

        MAX =  blz.compute(t.weight.max())
        MIN = blz.compute(t.weight.min())

        # Create a size variable to define the size of the the circle for the plot.
        t = blz.transform(t, size=blz.sqrt((t.weight - MIN)/(MAX - MIN))*50)

        WORDS = t['word'].distinct()
        WORDS = into(list, WORDS)
        topics = t['topic'].distinct()
        topics = into(list, topics)
        # Convert topics to strings
        TOPICS = [str(i) for i in topics]

        source = into(pd.DataFrame, t)

        plt.output_file(output_file)

        data_source = ColumnDataSource(source)

        p = plt.figure(x_range=TOPICS, y_range=WORDS,
               plot_width=1000, plot_height=1700,
               title=self.title)

        p.circle(x="topic", y="word", size="size", fill_alpha=0.6, source=data_source)
        #p.xaxis().major_label_orientation = np.pi/3
        logging.info("generating termite plot for file %s" % self.input_file)
        plt.show(p)


text:
package org.springframework.boot.testsupport.runner.classpath;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;

import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.CoreMatchers.isA;

/**
 * Tests for {@link ModifiedClassPathRunner} excluding entries from the class path.
 *
 * @author Andy Wilkinson
 */
@RunWith(ModifiedClassPathRunner.class)
@ClassPathExclusions("hibernate-validator-*.jar")
public class ModifiedClassPathRunnerExclusionsTests {

	private static final String EXCLUDED_RESOURCE = "META-INF/services/"
			+ "javax.validation.spi.ValidationProvider";

	@Rule
	public ExpectedException thrown = ExpectedException.none();

	@Test
	public void entriesAreFilteredFromTestClassClassLoader() {
		assertThat(getClass().getClassLoader().getResource(EXCLUDED_RESOURCE)).isNull();
	}

	@Test
	public void entriesAreFilteredFromThreadContextClassLoader() {
		assertThat(Thread.currentThread().getContextClassLoader()
				.getResource(EXCLUDED_RESOURCE)).isNull();
	}

	@Test
	public void testsThatUseHamcrestWorkCorrectly() {
		this.thrown.expect(isA(IllegalStateException.class));
		throw new IllegalStateException();
	}

}


text:
  Crosey-le-Petit est
       un village
       localisé dans le département des Doubs en Franche-Comté. Elle comptait 107 habitants en 2008.

À proximité de Crosey-le-Petit sont positionnées géographiquement les villes de
Lomont-sur-Crête située à 4 km, 158 habitants,
Branne à 2 km, 173 habitants,
Chaux-lès-Clerval localisée à 3 km, 183 habitants,
Randevillers située à 5 km, 103 habitants,
Montivernage localisée à 5 km, 35 habitants,
Crosey-le-Grand à 3 km, 175 habitants,
 entre autres. De plus, Crosey-le-Petit est située à seulement 29 km de Montbéliard.

La ville propose quelques  équipements, elle propose entre autres un centre d'équitation.

Si vous envisagez de venir habiter à Crosey-le-Petit, vous pourrez facilement trouver une maison à acheter.

Le parc d'habitations, à Crosey-le-Petit, se décomposait en 2011 en trois appartements et 48 maisons soit
 un marché relativement équilibré.


text:
package de.unistuttgart.iaas.chor.instance.management.util;

import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;

import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.sax.SAXSource;

import org.apache.camel.converter.jaxp.XmlConverter;
import org.apache.ode.pmapi.types._2006._08._02.TVariableRef;
import org.apache.ode.pmapi.types._2006._08._02.TVariableRefList;
import org.w3c.dom.Element;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;

import de.unistuttgart.iaas.chor.commons.constants.Constants;

public class XMLFactory {

	private static XMLFactory instance;

	public static XMLFactory instance() {

		if (instance == null) {
			instance = new XMLFactory();
		}
		return instance;
	}

	public List<Element> createXMLElementsList(String method, String content) {

		List<Element> elements = new ArrayList<Element>();

		try {

			XmlConverter converter = new XmlConverter();
			String xml = getXML(method, content);

			Element element = converter.toDOMElement(new SAXSource(new InputSource(new StringReader(xml))));
			elements.add(element);

		} catch (TransformerException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (ParserConfigurationException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (SAXException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		return elements;

	}

	public List<Element> createXMLElementsList(String method, long iid, String parameter ) {

		List<Element> elements = new ArrayList<Element>();

		try {

			XmlConverter converter = new XmlConverter();
			String xml = getXML(method, iid, parameter);
			Element element = converter.toDOMElement(new SAXSource(new InputSource(new StringReader(xml))));
			elements.add(element);

		} catch (TransformerException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (ParserConfigurationException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (SAXException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		return elements;

	}

	public List<Element> createXMLElementsList(String content) {

		List<Element> elements = new ArrayList<Element>();

		try {

			XmlConverter converter = new XmlConverter();

			Element element = converter.toDOMElement(new SAXSource(new InputSource(new StringReader(content))));
			elements.add(element);

		} catch (TransformerException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (ParserConfigurationException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (SAXException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		return elements;

	}

	private String getXML(String method, String content) {

		if (method.equals(Constants.METHOD_SUSPEND)) {

			return "<suspend xmlns=\"http://www.apache.org/ode/pmapi\"><iid>" + content + "</iid></suspend>";

		} else if (method.equals(Constants.METHOD_TERMINATE)) {
			return "<terminate xmlns=\"http://www.apache.org/ode/pmapi\"><iid>" + content + "</iid></terminate>";
		}
		else if (method.equals(Constants.METHOD_FINISH)) {
			return "<finish xmlns=\"http://www.apache.org/ode/pmapi\"><iid>" + content + "</iid></finish>";
		}
		else if (method.equals(Constants.METHOD_RESUME)) {
			return "<resume xmlns=\"http://www.apache.org/ode/pmapi\"><iid>" + content + "</iid></resume>";
		}

		return "";
	}

	private String getXML(String method, long iid, String parameter) {

		if (method.equals(Constants.METHOD_GET_SNAPSHOTS)) {

			return "<getSnapshots xmlns=\"http://www.apache.org/ode/pmapi\"><iid>" + iid + "</iid><activityXPath>"+ parameter + "</activityXPath></getSnapshots>";

		}
		else if (method.equals(Constants.METHOD_GET_SNAPSHOT_VARIABLES)) {
			return "<getSnapshotVariables xmlns=\"http://www.apache.org/ode/pmapi\"><iid>" + iid + "</iid><snapshotId>"+ parameter + "</snapshotId></getSnapshotVariables>";
		}

		return "";
	}

	public List<Element> createXMLElementsListForRepetition(long iid, String xpath, String snapshotXPath, long version, TVariableRefList list, String method) {

		List<Element> elements = new ArrayList<Element>();

		try {

			XmlConverter converter = new XmlConverter();

			StringBuffer sb = new StringBuffer();

			if(method.equals(Constants.METHOD_PREPARE_ITERATE)){
				sb.append("<iterate xmlns=\"http://www.apache.org/ode/pmapi\">");
				sb.append(createIterationContent(iid, xpath));
				sb.append("</iterate>");
			}
			else if(method.equals(Constants.METHOD_PREPARE_ITERATE_EXT)){
				sb.append("<iterateExt xmlns=\"http://www.apache.org/ode/pmapi\">");
				sb.append(createIterationExtContent(iid, xpath,snapshotXPath,version, list));
				sb.append("</iterateExt>");
			}
			else if(method.equals(Constants.METHOD_RESET_AND_TERMINATE)){
				sb.append("<resetAndTerminate xmlns=\"http://www.apache.org/ode/pmapi\">");
				sb.append(createIterationContent(iid, xpath));
				sb.append("</resetAndTerminate>");
			}

			// TODO: implement a changed version of the reexecute method that does not need the snapshot xpath
			// but will select them automatically. This has also to be changed in the workflow engine.
			else if(method.equals(Constants.METHOD_PREPARE_REEXECUTE)){
				sb.append("<reexecute xmlns=\"http://www.apache.org/ode/pmapi\">");
				sb.append(createReexecutionContent(iid, xpath,snapshotXPath,version));
				sb.append("</reexecute>");
			}
			else if(method.equals(Constants.METHOD_PREPARE_REEXECUTE_EXT)){
				sb.append("<reexecuteExt xmlns=\"http://www.apache.org/ode/pmapi\">");
				sb.append(createReexecutionExtContent(iid,xpath,snapshotXPath,version,list));
				sb.append("</reexecuteExt>");
			}

			Element element = converter.toDOMElement(new SAXSource(new InputSource(new StringReader(sb.toString()))));
			elements.add(element);

		} catch (TransformerException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (ParserConfigurationException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (SAXException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		return elements;

	}

	private String createIterationContent(long iid, String xpath){

		StringBuffer sb = new StringBuffer();
		sb.append("<iid>");
		sb.append(iid);
		sb.append("</iid>");
		sb.append("<xpath>");
		sb.append(xpath);
		sb.append("</xpath>");

		return sb.toString();
	}

	private String createIterationExtContent(long iid, String xpath, String snapshotXPath, long version, TVariableRefList list){

		StringBuffer sb = new StringBuffer();
		sb.append("<iid>");
		sb.append(iid);
		sb.append("</iid>");
		sb.append("<xpath>");
		sb.append(xpath);
		sb.append("</xpath>");
		sb.append("<snapshotXPath>");
		sb.append(snapshotXPath);
		sb.append("</snapshotXPath>");
		sb.append("<version>");
		sb.append(version);
		sb.append("</version>");

		sb.append("<variables>");
		for(TVariableRef variable: list.getVariable()){

			sb.append("<variable iid=\"" + variable.getIid()+ "\" siid=\"" + variable.getSiid() + "\" name=\"" + variable.getName() +  "\"/>");

		}
		sb.append("</variables>");

		return sb.toString();

	}

	private String createReexecutionContent(long iid, String xpath, String snapshotXPath, long version){

		StringBuffer sb = new StringBuffer();
		sb.append("<iid>");
		sb.append(iid);
		sb.append("</iid>");
		sb.append("<xpath>");
		sb.append(xpath);
		sb.append("</xpath>");
		sb.append("<snapshotXPath>");
		sb.append(snapshotXPath);
		sb.append("</snapshotXPath>");
		sb.append("<version>");
		sb.append(version);
		sb.append("</version>");

		return sb.toString();

	}

	private String createReexecutionExtContent(long iid, String xpath, String snapshotXPath, long version, TVariableRefList list){

		StringBuffer sb = new StringBuffer();
		sb.append("<iid>");
		sb.append(iid);
		sb.append("</iid>");
		sb.append("<xpath>");
		sb.append(xpath);
		sb.append("</xpath>");
		sb.append("<snapshotXPath>");
		sb.append(snapshotXPath);
		sb.append("</snapshotXPath>");
		sb.append("<version>");
		sb.append(version);
		sb.append("</version>");

		sb.append("<variables>");
		for(TVariableRef variable: list.getVariable()){

			sb.append("<variable iid=\"" + variable.getIid()+ "\" siid=\"" + variable.getSiid() + "\" name=\"" + variable.getName() +  "\"/>");

		}
		sb.append("</variables>");

		return sb.toString();

	}

}


text:
[![Packagist](https://img.shields.io/packagist/v/mouseeatscat/phpquicktranslate.svg?style=flat-square)](https://packagist.org/packages/mouseeatscat/phpquicktranslate)

A class for quickly providing multiple translations in PHP.

This script was developed as a personal project by [Michel Descoteaux](https://micheldescoteaux.com) and is free to use and distribute.

## Requirements

* PHP >= 7.4
* Composer - [Install](https://getcomposer.org/download/)

## Installation
1. Run `composer require mouseeatscat/phpquicktranslate`

2. Add this code to the top of your php document:
  ```php
  <?php

  use MouseEatsCat\PhpQuickTranslate;

  require_once __DIR__ . '/vendor/autoload.php';

  // Get the current language
  $lang = !empty($_GET['lang']) ? $_GET['lang']: 'en';

  // Instantiate PHP Quick Translate
  $qt = new PhpQuickTranslate($lang);
  ```

You can optionally add a [mulilingal](#single-language-json-example) JSON translation file or multiple [single-language](#single-language-json-example) files.
```php
// Single-Language JSON files
$qt->addTranslationSource('/translations/en.json', 'en');
$qt->addTranslationSource('/translations/fr.json', 'fr');
// OR Multilingual JSON file
$qt->addTranslationSource('/translations/multilingual.json');
// OR Path to translations directory
$qt->addTranslationSource('/translations/');
```
You can then load a translation by it's key:
```php
echo $qt->t('translation_key');
// OR echo using a method
$qt->et('translation_key');
```
### JSON translation file examples
#### Single-Language JSON Example
Assuming you have one json file for each language. Each file would contain something like this:
```json
{
  "translation_example": "Translated Text"
}
```
#### Multilingual JSON Example
Assuming you have one json file containing all translations for all languages. The file would contain something like this:
```json
{
  "translation_example": {
    "en": "English Translated Text",
    "fr": "French Translated Text"
  }
}
```
### Translating without translation files
You can also create a one-time translation as you go. (both alternatives below are equivalent)
```php
$qt->et([
  'en' => 'English Test',
  'fr' => 'French Text'
]);

// OR Alternative

$qt->et('[:en]English Text[:fr]French Text');
```
If the url is `http://website.com/?lang=en` OR `http://website.com/`, the result will be:
```
English Text
```
If the url is `http://website.com/?lang=fr`, the result will be:
```
French Text
```

## PHPQuickTranslate Methods
```php
// Instantiate PHP Quick Translate
$qt = new PHPQuickTranslate('lang');

// Translate
$qt->t('translation_key');

// Same as t() except with echo
$qt->et('translation_key');

// Set the current language
$qt->setLang('lang');

// Get the current language
$qt->getLang();

// Add a translation
$qt->addTranslation('lang', 'translation_key', 'translation_value');

// Add a JSON translation source file directory
// translation source file directory
$qt->addTranslationSource('path/to/json/translations/');
// Individual translation source file
$qt->addTranslationSource('path/to/json/translations/lang.json', 'lang');
$qt->addTranslationSource('path/to/json/translations/multilingual.json');

// Add array or translations
// (single language + multilingual)
$qt->addTranslations(['translation_key' => 'translation_value'], 'lang');
$qt->addTranslations([
  'translation_key' => [
    'en' => 'translation_value',
    'fr' => 'translation_value'
  ]
]);

// Determine if a translation exists for given key
// If lang isn't provided, the current language will be used
$qt->hasTranslation('translation_key', 'lang');

// Gets the translation for given key
// If lang isn't provided, the current language will be used
$qt->getTranslation('translation_key', 'lang');
```


text:
package com.KeanuWeather.app.model;

/**
 * Created by Keanu on 2014-11-10 .
 */
public class Province {
    private int provinceId;
    private String provinceName;
    private String provinceCode;

    public int getProvinceId() {
        return provinceId;
    }

    public String getProvinceName() {
        return provinceName;
    }

    public String getProvinceCode() {
        return provinceCode;
    }

    public void setProvinceId(int provinceId) {
        this.provinceId = provinceId;
    }

    public void setProvinceName(String provinceName) {
        this.provinceName = provinceName;
    }

    public void setProvinceCode(String provinceCode) {
        this.provinceCode = provinceCode;
    }
}


text:
module NoBrainer
  module Simple
    module OAuth2
      # ResourceOwner role mixin for NoBrainer.
      # Includes all the required API, associations, validations and callbacks
      module ResourceOwner
        extend ActiveSupport::Concern

        # Fields Declaration.
        include NoBrainer::Simple::OAuth2::Fields::ResourceOwner

        included do
          # Database updates are skipped when no attributes changed during a save.
          # This callback is always triggered even when no attributes changed.
          # @see http://nobrainer.io/docs/timestamps/
          #
          before_save { self.updated_at = Time.now }

          # Searches for ResourceOwner record with the specific params.
          #
          # @param _client [Object] Client instance.
          # @param username [String, #to_s] username value (any object that responds to `#to_s`).
          # @param password [String] password value.
          #
          # @return [Object, nil] ResourceOwner object or nil if there is no record with such params.
          #
          def self.oauth_authenticate(_client, username, password)
            user = where(username: username.to_s).first
            user if user && user.encrypted_password == password
          end
        end
      end
    end
  end
end


text:
package com.mokelab.demo.kiilib.page.menu;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.mokelab.demo.kiilib.R;

/**
 * Adapter for menu
 */
public class MainMenuAdapter extends ArrayAdapter<Void> {
    private final LayoutInflater mInflater;

    public MainMenuAdapter(Context context) {
        super(context, 0);
        mInflater = LayoutInflater.from(context);
    }

    @Override
    public int getCount() {
        return 2;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if (convertView == null) {
            convertView = mInflater.inflate(R.layout.item_main_menu, null);
        }
        ImageView iconView = (ImageView) convertView.findViewById(R.id.icon);
        TextView labelView = (TextView) convertView.findViewById(R.id.text_label);
        switch (position) {
        case 0:
            iconView.setImageResource(R.drawable.ic_description_black_48dp);
            labelView.setText(R.string.menu_label_my_memo);
            break;
        case 1:
            iconView.setImageResource(R.drawable.ic_group_black_48dp);
            labelView.setText(R.string.menu_label_group);
            break;
        }

        return convertView;
    }
}


text:
package aQute.lib.json;

import java.io.IOException;
import java.lang.reflect.Type;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.Locale;
import java.util.Map;

import aQute.lib.date.Dates;

public class DateHandler extends Handler {
	private static final DateTimeFormatter	DATE_TIME_FORMATTER	= DateTimeFormatter.ISO_LOCAL_DATE_TIME
		.withLocale(Locale.ENGLISH)
		.withZone(Dates.UTC_ZONE_ID);

	@Override
	public void encode(Encoder app, Object object, Map<Object, Type> visited) throws IOException, Exception {
		long epochMilli = ((Date) object).getTime();
		String s = Dates.formatMillis(DATE_TIME_FORMATTER, epochMilli);
		StringHandler.string(app, s);
	}

	@Override
	public Object decode(Decoder dec, String s) throws Exception {
		long epochMilli = Dates.parseMillis(DATE_TIME_FORMATTER, s);
		return new Date(epochMilli);
	}

	@Override
	public Object decode(Decoder dec, Number s) throws Exception {
		return new Date(s.longValue());
	}

}


text:
/* -*- Mode: C++; -*- */
/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkPostgreSQLDatabase.h

  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
/*-------------------------------------------------------------------------
  Copyright 2008 Sandia Corporation.
  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
  the U.S. Government retains certain rights in this software.
-------------------------------------------------------------------------*/
// .NAME vtkPostgreSQLDatabase - maintain a connection to a PostgreSQL database
//
// .SECTION Description
//
// PostgreSQL (http://www.postgres.org) is a BSD-licensed SQL database.
// It's large, fast, and can not be easily embedded
// inside other applications.  Its databases are stored in files that
// belong to another process.
//
// This class provides a VTK interface to PostgreSQL.  You do need to
// download external libraries: we need a copy of PostgreSQL 8
// (currently 8.2 or 8.3) so that we can link against the libpq C
// interface.
//
// .SECTION Thanks
//
// Thanks to David Thompson and Andy Wilson from Sandia National
// Laboratories for implementing this class.
//
// .SECTION See Also
// vtkPostgreSQLQuery

#ifndef vtkPostgreSQLDatabase_h
#define vtkPostgreSQLDatabase_h

#include "vtkIOPostgreSQLModule.h" // For export macro
#include "vtkSQLDatabase.h"

class vtkPostgreSQLQuery;
class vtkStringArray;
class vtkPostgreSQLDatabasePrivate;
struct PQconn;

class VTKIOPOSTGRESQL_EXPORT vtkPostgreSQLDatabase : public vtkSQLDatabase
{
  //BTX
  friend class vtkPostgreSQLQuery;
  friend class vtkPostgreSQLQueryPrivate;
  //ETX

public:
  vtkTypeMacro(vtkPostgreSQLDatabase, vtkSQLDatabase);
  void PrintSelf(ostream& os, vtkIndent indent);
  static vtkPostgreSQLDatabase *New();

  // Description:
  // Open a new connection to the database.  You need to set the
  // filename before calling this function.  Returns true if the
  // database was opened successfully; false otherwise.
  bool Open( const char* password = 0 );

  // Description:
  // Close the connection to the database.
  void Close();

  // Description:
  // Return whether the database has an open connection
  bool IsOpen();

  // Description:
  // Return an empty query on this database.
  vtkSQLQuery* GetQueryInstance();

  // Description:
  // Did the last operation generate an error
  virtual bool HasError();

  // Description:
  // Get the last error text from the database
  const char* GetLastErrorText();

  // Description:
  // String representing database type (e.g. "psql").
  vtkGetStringMacro(DatabaseType);

  // Description:
  // The database server host name.
  virtual void SetHostName( const char* );
  vtkGetStringMacro(HostName);

  // Description:
  // The user name for connecting to the database server.
  virtual void SetUser( const char* );
  vtkGetStringMacro(User);

  // Description:
  // The user's password for connecting to the database server.
  virtual void SetPassword( const char* );

  // Description:
  // The name of the database to connect to.
  virtual void SetDatabaseName( const char* );
  vtkGetStringMacro(DatabaseName);

  // Description:
  // Additional options for the database.
  virtual void SetConnectOptions( const char* );
  vtkGetStringMacro(ConnectOptions);

  // Description:
  // The port used for connecting to the database.
  virtual void SetServerPort( int );
  virtual int GetServerPortMinValue()
    {
    return 0;
    }
  virtual int GetServerPortMaxValue()
    {
    return VTK_INT_MAX;
    }
  vtkGetMacro(ServerPort, int);

  // Description:
  // Get a URL referencing the current database connection.
  // This is not well-defined if the HostName and DatabaseName
  // have not been set. The URL will be of the form
  // <code>'psql://'[username[':'password]'@']hostname[':'port]'/'database</code> .
  virtual vtkStdString GetURL();

  // Description:
  // Get the list of tables from the database
  vtkStringArray* GetTables();

  // Description:
  // Get the list of fields for a particular table
  vtkStringArray* GetRecord( const char* table );

  // Description:
  // Return whether a feature is supported by the database.
  bool IsSupported( int feature );

  // Description:
  // Return a list of databases on the server.
  vtkStringArray* GetDatabases();

  // Description:
  // Create a new database, optionally dropping any existing database of the same name.
  // Returns true when the database is properly created and false on failure.
  bool CreateDatabase( const char* dbName, bool dropExisting = false );

  // Description:
  // Drop a database if it exists.
  // Returns true on success and false on failure.
  bool DropDatabase( const char* dbName );

  // Description:
  // Return the SQL string with the syntax to create a column inside a
  // "CREATE TABLE" SQL statement.
  // NB: this method implements the PostgreSQL-specific syntax:
  // <column name> <column type> <column attributes>
  virtual vtkStdString GetColumnSpecification(
    vtkSQLDatabaseSchema* schema, int tblHandle, int colHandle );

  // Description:
  // Overridden to determine connection parameters given the URL.
  // This is called by CreateFromURL() to initialize the instance.
  // Look at CreateFromURL() for details about the URL format.
  virtual bool ParseURL(const char* url);

protected:
  vtkPostgreSQLDatabase();
  ~vtkPostgreSQLDatabase();

  // Description:
  // Create or refresh the map from Postgres column types to VTK array types.
  //
  // Postgres defines a table for types so that users may define types.
  // This adaptor does not support user-defined types or even all of the
  // default types defined by Postgres (some are inherently difficult to
  // translate into VTK since Postgres allows columns to have composite types,
  // vector-valued types, and extended precision types that vtkVariant does
  // not support.
  //
  // This routine examines the pg_types table to get a map from Postgres column
  // type IDs (stored as OIDs) to VTK array types. It is called whenever a new
  // database connection is initiated.
  void UpdateDataTypeMap();

  vtkSetStringMacro(DatabaseType);
  vtkSetStringMacro(LastErrorText);
  void NullTrailingWhitespace( char* msg );
  bool OpenInternal( const char* connectionOptions );

  vtkTimeStamp URLMTime;
  vtkPostgreSQLDatabasePrivate *Connection;
  vtkTimeStamp ConnectionMTime;
  vtkStringArray *Tables;
  char* DatabaseType;
  char* HostName;
  char* User;
  char* Password;
  char* DatabaseName;
  int ServerPort;
  char* ConnectOptions;
  char* LastErrorText;

private:
  vtkPostgreSQLDatabase( const vtkPostgreSQLDatabase& ); // Not implemented.
  void operator = ( const vtkPostgreSQLDatabase& ); // Not implemented.
};

// This is basically the body of the SetStringMacro but with a
// call to update an additional vtkTimeStamp. We inline the implementation
// so that wrapping will work.
#define vtkSetStringPlusMTimeMacro(className,name,timeStamp) \
  inline void className::Set##name (const char* _arg) \
  { \
    vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting " << #name " to " << (_arg?_arg:"(null)") ); \
    if ( this->name == NULL && _arg == NULL) { return;} \
    if ( this->name && _arg && (!strcmp(this->name,_arg))) { return;} \
    delete [] this->name; \
    if (_arg) \
      { \
          size_t n = strlen(_arg) + 1; \
          char *cp1 =  new char[n]; \
          const char *cp2 = (_arg); \
          this->name = cp1; \
          do { *cp1++ = *cp2++; } while ( --n ); \
      } \
     else \
      { \
          this->name = NULL; \
      } \
    this->Modified(); \
    this->timeStamp.Modified(); \
    this->Close(); /* Force a re-open on next query */ \
    }

vtkSetStringPlusMTimeMacro(vtkPostgreSQLDatabase,HostName,URLMTime);
vtkSetStringPlusMTimeMacro(vtkPostgreSQLDatabase,User,URLMTime);
vtkSetStringPlusMTimeMacro(vtkPostgreSQLDatabase,Password,URLMTime);
vtkSetStringPlusMTimeMacro(vtkPostgreSQLDatabase,DatabaseName,URLMTime);
vtkSetStringPlusMTimeMacro(vtkPostgreSQLDatabase,ConnectOptions,URLMTime);

inline void vtkPostgreSQLDatabase::SetServerPort( int _arg )
{
  vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting ServerPort to " << _arg );
  if ( this->ServerPort != ( _arg < 0 ? 0 : ( _arg > VTK_INT_MAX ? VTK_INT_MAX : _arg ) ) )
    {
    this->ServerPort = ( _arg < 0 ? 0 : ( _arg > VTK_INT_MAX ? VTK_INT_MAX : _arg ) );
    this->Modified();
    this->URLMTime.Modified();
    this->Close(); // Force a re-open on next query
    }
}

#endif // vtkPostgreSQLDatabase_h


text:
Imports System.ComponentModel
Imports Newtonsoft.Json

Namespace Links.Response.User

	'''
	''' Returns the changed link (just an echo of the short link, after an edit)
	''' in a user's history.
	'''
	Public Class LinkEdit
		Inherits ResponseBase

		'''
		''' An echo back of the edited bitly link.
		'''
		<JsonProperty("data")>
		<EditorBrowsable(EditorBrowsableState.Advanced)>
		Property Data As EditedLink

		'''
		''' An echo back of the edited bitly link.
		'''
		ReadOnly Property Link As String
			Get
				Return Data.EditedLink.Link
			End Get
		End Property

		<EditorBrowsable(EditorBrowsableState.Advanced)>
		Class EditedLink
			<JsonProperty("link_edit")>
			Property EditedLink As Model.User.EditedLink
		End Class

	End Class

End Namespace


text:
/*custom font*/
@import url(https://fonts.googleapis.com/css?family=Montserrat);

html {
    min-height: 100%;
}

body {
    height: 100%;
    min-height: 100%;
    font-family: Helvetica Neue, Arial, Verdana;
}

input {
    font-family: Helvetica Neue, Arial, Verdana;
}

input[type="button"],
input[type="submit"],
button {
    text-transform: uppercase;
}

/*form styles*/
.form-wrapper {
    margin: 50px auto;
    text-align: center;
    position: relative;
}

.form-custom {
    background: white;
    border: 0 none;
    border-radius: 3px;
    box-shadow: 0 0 15px 1px rgba(0, 0, 0, 0.4);
    padding: 20px 30px;
    box-sizing: border-box;
    width: 90%;
    margin: 0 5%;

    /*stacking fieldsets above each other*/
    position: relative;
}

/*inputs*/
.form-group-custom {
    margin-top: 15px;
    background-color: #fff;
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.07);
    border-radius: 2px;
    padding-top: 7px;
    padding-left: 12px;
    padding-right: 12px;
    padding-bottom: 4px;
    overflow: hidden;
    -webkit-transition: background-color 0.2s ease;
    transition: background-color 0.2s ease;
}

.form-group-custom.form-group-select {
    overflow: visible;
}

.form-control {
    display: block;
    width: 100%;
    -webkit-appearance: none;
    color: #2c2c2c;
    outline: 0;
    line-height: normal;
    font-size: 14px;
    font-weight: normal;
    vertical-align: middle;
    box-shadow: none;
    border: none;
    font-size: 16px;
    margin-top: -4px;
    background: none;
    height: 29px;
    min-height: 29px;
    padding-left: 1px;
}

.form-control:focus {
    outline: 0;
    border: 0;
    box-shadow: none;
}

.form-group-custom-select.focused, .form-group-custom.focused {
    border-color: rgba(0, 0, 0, 0.1) !important;
    background-color: #f0f0f0;
}

.select2-container--focus {
    border-color: rgba(0, 0, 0, 0.1) !important;
    background-color: #f0f0f0;
}

.form-group-custom-select.required.incomplete,
.form-group-custom.required.incomplete
{
    border-color: #f55753 !important;
}

.form-group-custom-select.required.incomplete > label,
.form-group-custom.required.incomplete > label
{
    color: #f55753 !important;
}

input, input:focus {
    -webkit-transition: none !important;
}

/*form label*/
.form-group-custom-select label:not(.error), .form-group-custom label:not(.error) {
    font-family: 'Montserrat';
    font-size: 13px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-weight: 500;
}

.form-group-custom-select label, .form-group-custom label {
    text-align: left;
    margin: 0;
    display: block;
    opacity: 1;
    -webkit-transition: opacity 0.2s ease;
    transition: opacity 0.2s ease;
}

.form-group-custom-select.focused label, .form-group-custom.focused label {
    opacity: .4;
    -webkit-backface-visibility: hidden;
    -moz-backface-visibility: hidden;
    backface-visibility: hidden;
}

.form-group-custom-select label {
    position: relative;
}

/* form required */

.form-group-custom-select.required:after, .form-group-custom.required:after {
    color: #f55753;
    content: "*";
    font-family: arial;
    font-size: 20px;
    position: absolute;
    right: 12px;
    top: 6px;
}

/*buttons*/
.action-button {
    width: 100px !important;
    background: #000639 !important;
    font-weight: bold;
    color: white;
    border: 0 none;
    border-radius: 1px;
    cursor: pointer;
    padding: 10px 5px;
    margin: 20px 5px;
}

.action-button:hover, #msform .action-button:focus {
    box-shadow: 0 0 0 2px white, 0 0 0 3px rgb(26, 82, 119);
}

/*headings*/
.fs-title {
    font-size: 20px;
    text-transform: uppercase;
    color: rgb(18, 62, 84);
    margin-bottom: 10px;
}

.fs-subtitle {
    font-weight: normal;
    font-size: 15px;
    color: rgb(26, 82, 119);
    margin-bottom: 30px;
}

/* logo */

.logo {
    width: 20%;
    margin-bottom: 15px;
}

/*progressbar*/
#progressbar {
    margin-bottom: 30px;
    overflow: hidden;
    padding-left: 0px;
    /*CSS counters to number the steps*/
    counter-reset: step;
}

#progressbar li {
    list-style-type: none;
    color: #000639;
    text-transform: uppercase;
    font-size: 9px;
    font-weight: bold;
    width: 25%;
    float: left;
    position: relative;
}

#progressbar li:before {
    content: counter(step);
    counter-increment: step;
    width: 20px;
    line-height: 20px;
    display: block;
    font-size: 10px;
    color: #000639;
    background: white;
    border: 1px solid #000639;
    border-radius: 3px;
    margin: 0 auto 5px auto;
}

/*progressbar connectors*/
#progressbar li:after {
    content: '';
    width: 100%;
    height: 2px;
    background: white;
    position: absolute;
    left: -50%;
    top: 9px;
    z-index: -1; /*put it behind the numbers*/
}

#progressbar li:first-child:after {
    /*connector not needed before the first step*/
    content: none;
}

/*marking active/completed steps green*/
/*The number of the step and the connector before it = green*/
#progressbar li.active:before, #progressbar li.active:after {
    background: #000639;
    color: white;
}

.bg-gradient-blue {
    background-color: #6bd6e8;
    background-image: -webkit-linear-gradient(45deg, #6bd6e8, #365fda);
    background-image: -moz-linear-gradient(45deg, #6bd6e8, #365fda);
    background-image: -ms-linear-gradient(45deg, #6bd6e8, #365fda);
    background-image: -o-linear-gradient(45deg, #6bd6e8, #365fda);
    background-image: linear-gradient(45deg, #6bd6e8, #365fda);
}

.bg-gradient-red {
    background-color: #033d53;
    background-image: -webkit-linear-gradient(45deg, #033d53, #f02c57);
    background-image: -moz-linear-gradient(45deg, #033d53, #f02c57);
    background-image: -ms-linear-gradient(45deg, #033d53, #f02c57);
    background-image: -o-linear-gradient(45deg, #033d53, #f02c57);
    background-image: linear-gradient(45deg, #033d53, #f02c57);
}

.bg-gradient-charcoal {
    background-color: #314e5f;
    background-image: -webkit-linear-gradient(45deg, #314e5f, #242425);
    background-image: -moz-linear-gradient(45deg, #314e5f, #242425);
    background-image: -ms-linear-gradient(45deg, #314e5f, #242425);
    background-image: -o-linear-gradient(45deg, #314e5f, #242425);
    background-image: linear-gradient(45deg, #314e5f, #242425);
}

.bg-gradient-ember {
    background-color: #eee;
}

.bg-gradient-purple {
    background-color: #c86dd7;
    background-image: -webkit-linear-gradient(45deg, #c86dd7, #3023ae);
    background-image: -moz-linear-gradient(45deg, #c86dd7, #3023ae);
    background-image: -ms-linear-gradient(45deg, #c86dd7, #3023ae);
    background-image: -o-linear-gradient(45deg, #c86dd7, #3023ae);
    background-image: linear-gradient(45deg, #c86dd7, #3023ae);
}

.bg-gradient-green {
    background-color: #1ac9c0;
    background-image: -webkit-linear-gradient(45deg, #1ac9c0, #066187);
    background-image: -moz-linear-gradient(45deg, #1ac9c0, #066187);
    background-image: -ms-linear-gradient(45deg, #1ac9c0, #066187);
    background-image: -o-linear-gradient(45deg, #1ac9c0, #066187);
    background-image: linear-gradient(45deg, #1ac9c0, #066187);
}

.bg-gradient-blue .btn-white:hover {
    color: #6bd6e8;
    border-color: #fff;
    background-color: #fff;
}

.bg-gradient-red .btn-white:hover {
    color: #033d53;
    border-color: #fff;
    background-color: #fff;
}

.bg-gradient-charcoal .btn-white:hover {
    color: #314e5f;
    border-color: #fff;
    background-color: #fff;
}

.bg-gradient-ember .btn-white:hover {
    color: #fad961;
    border-color: #fff;
    background-color: #fff;
}

.bg-gradient-purple .btn-white:hover {
    color: #c86dd7;
    border-color: #fff;
    background-color: #fff;
}

.bg-gradient-green .btn-white:hover {
    color: #1ac9c0;
    border-color: #fff;
    background-color: #fff;
}

.flag-text {
    margin-left: 10px;
}

.ladda-button {
    /*width: auto !important;*/
}

.ladda-button .ladda-spinner {
    width: 16px !important;
    height: 16px !important;
}

.ladda-button[data-style=expand-right][data-loading] {
    padding-right: 45px !important;
}

.ladda-button[data-style=expand-right] .ladda-spinner {
    right: 7px !important;
}

.ladda-button[disabled], .ladda-button[data-loading] {
    border-color: rgba(0, 0, 0, 0.07) !important;
    cursor: not-allowed !important;
    background-color: #999 !important;
}

.ladda-button[disabled]:hover, .ladda-button[data-loading]:hover {
    cursor: not-allowed !important;
    background-color: #999 !important;
}


text:
  <title>The source code</title>
    <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />

/**
 * @class Ext.ensible
 * Extensible core utilities and functions.
 * @singleton
 */
(function(){

    Ext.ns('Ext.ensible.ux', 'Ext.ensible.sample', 'Ext.ensible.plugins', 'Ext.ensible.cal');

    Ext.apply(Ext.ensible, {

/**
         * The version of the framework
         * @type String
         */
        version : '1.0.1',

/**
         * The version of the framework, broken out into its numeric parts. This returns an
         * object that contains the following integer properties: major, minor and patch.
         * @type Object
         */
        versionDetails : {
            major: 1,
            minor: 0,
            patch: 1
        },

        hasBorderRadius : !(Ext.isIE || Ext.isOpera),

        log : function(s){
            //console.log(s);
        },

/**
        * @class Ext.ensible.cal.Date
        * @extends Object
        *
Contains utility date functions used by the calendar components.

        * @singleton
        */
	    Date : {

/**
             * Determines whether times used throughout all Extensible components should be displayed as
             * 12 hour times with am/pm (default) or 24 hour / military format. Note that some locale files
             * may override this value by default.
             * @type Boolean
             * @property use24HourTime
             */
            use24HourTime : false,

/**
             * Returns the time duration between two dates in the specified units. For finding the number
             * of calendar days (ignoring time) between two dates use {@link Ext.ensible.Date.diffDays diffDays} instead.
             * @param {Date} start The start date
             * @param {Date} end The end date
             * @param {String} unit (optional) The time unit to return. Valid values are 'ms' (milliseconds, the default), 's' (seconds),
             * 'm' (minutes) or 'h' (hours).
             * @return {Number} The time difference between the dates in the units specified by the unit param
             */
            diff : function(start, end, unit){
                var denom = 1,
                    diff = end.getTime() - start.getTime();

                if(unit == 's'){
                    denom = 1000;
                }
                else if(unit == 'm'){
                    denom = 1000*60;
                }
                else if(unit == 'h'){
                    denom = 1000*60*60;
                }
                return Math.round(diff/denom);
            },

/**
             * Calculates the number of calendar days between two dates, ignoring time values.
             * A time span that starts at 11pm (23:00) on Monday and ends at 1am (01:00) on Wednesday is
             * only 26 total hours, but it spans 3 calendar days, so this function would return 3. For the
             * exact time difference, use {@link Ext.ensible.Date.diff diff} instead.
             * @param {Date} start The start date
             * @param {Date} end The end date
             * @return {Number} The number of calendar days difference between the dates
             */
            diffDays : function(start, end){
                var day = 1000*60*60*24,
                    diff = end.clearTime(true).getTime() - start.clearTime(true).getTime();

                return Math.ceil(diff/day);
            },

/**
             * Copies the time value from one date object into another without altering the target's
             * date value. This function returns a new Date instance without modifying either original value.
             * @param {Date} fromDt The original date from which to copy the time
             * @param {Date} toDt The target date to copy the time to
             * @return {Date} The new date/time value
             */
            copyTime : function(fromDt, toDt){
                var dt = toDt.clone();
                dt.setHours(
                    fromDt.getHours(),
                    fromDt.getMinutes(),
                    fromDt.getSeconds(),
                    fromDt.getMilliseconds());

                return dt;
            },

/**
             * Compares two dates and returns a value indicating how they relate to each other.
             * @param {Date} dt1 The first date
             * @param {Date} dt2 The second date
             * @param {Boolean} precise (optional) If true, the milliseconds component is included in the comparison,
             * else it is ignored (the default).
             * @return {Number} The number of milliseconds difference between the two dates. If the dates are equal
             * this will be 0.  If the first date is earlier the return value will be positive, and if the second date
             * is earlier the value will be negative.
             */
            compare : function(dt1, dt2, precise){
                var d1 = dt1, d2 = dt2;
                if(precise !== true){
                    d1 = dt1.clone();
                    d1.setMilliseconds(0);
                    d2 = dt2.clone();
                    d2.setMilliseconds(0);
                }
                return d2.getTime() - d1.getTime();
            },

	        // private helper fn
	        maxOrMin : function(max){
	            var dt = (max ? 0 : Number.MAX_VALUE), i = 0, args = arguments[1], ln = args.length;
	            for(; i < ln; i++){
	                dt = Math[max ? 'max' : 'min'](dt, args[i].getTime());
	            }
	            return new Date(dt);
	        },

/**
             * Returns the maximum date value passed into the function. Any number of date
             * objects can be passed as separate params.
             * @param {Date} dt1 The first date
             * @param {Date} dt2 The second date
             * @param {Date} dtN (optional) The Nth date, etc.
             * @return {Date} A new date instance with the latest date value that was passed to the function
             */
			max : function(){
	            return this.maxOrMin.apply(this, [true, arguments]);
	        },

/**
             * Returns the minimum date value passed into the function. Any number of date
             * objects can be passed as separate params.
             * @param {Date} dt1 The first date
             * @param {Date} dt2 The second date
             * @param {Date} dtN (optional) The Nth date, etc.
             * @return {Date} A new date instance with the earliest date value that was passed to the function
             */
			min : function(){
	            return this.maxOrMin.apply(this, [false, arguments]);
	        },

            isInRange : function(dt, rangeStart, rangeEnd) {
                return  (dt >= rangeStart && dt <= rangeEnd);
            },

/**
             * Returns true if two date ranges overlap (either one starts or ends within the other, or one completely
             * overlaps the start and end of the other), else false if they do not.
             * @param {Date} start1 The start date of range 1
             * @param {Date} end1   The end date of range 1
             * @param {Date} start2 The start date of range 2
             * @param {Date} end2   The end date of range 2
             * @return {Booelan} True if the ranges overlap, else false
             */
            rangesOverlap : function(start1, end1, start2, end2){
                var startsInRange = (start1 >= start2 && start1 <= end2),
                    endsInRange = (end1 >= start2 && end1 <= end2),
                    spansRange = (start1 <= start2 && end1 >= end2);

                return (startsInRange || endsInRange || spansRange);
            },

/**
             * Returns true if the specified date is a Saturday or Sunday, else false.
             * @param {Date} dt The date to test
             * @return {Boolean} True if the date is a weekend day, else false
             */
            isWeekend : function(dt){
                return dt.getDay() % 6 === 0;
            },

/**
             * Returns true if the specified date falls on a Monday through Fridey, else false.
             * @param {Date} dt The date to test
             * @return {Boolean} True if the date is a week day, else false
             */
            isWeekday : function(dt){
                return dt.getDay() % 6 !== 0;
            }
	    }
    });
})();


text:
<?php
/*
	返回码说明

	11000-11099	命令通道管理系统
	11100-11199	任务服务器
	11200-11299	鉴权服务器
	11300-11399	命令通道agent端
	11400-11499	附加脚本错误码
	11800-11899	旧系统接口层
	11900-11999	旧系统通道服务器
		class SingleShellTask	11900-11919
		class Ssh2Helper		11920-11929
		class AgentHelper		11930-11939
*/

error_reporting(E_ALL );
ini_set('display_errors','On');
require_once "KLogger.php";
require_once "config.php";
$path = __DIR__.'/phpseclib/';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);

$task = new SingleShellTask();
$task_log = new KLogger(dirname(__FILE__), '../logs/SingleShellTask', KLogger::DEBUG);
$async_cmd = '';
$ip_c_list = array();
$data = json_decode($argv[1],true);

$ret = $task->startTask($data);
$ret['data']['task_id'] = $data['task_id'];
$ret['data']['ip'] = $data['ip'];
echo json_encode($ret)."\n";

class SingleShellTask
{
	public function __construct()
	{
		$this->local_ip = AREA_CONFIG::getLocalIP();
		$this->ssh2_helper = new Ssh2Helper();
		$this->mysqlServer = AREA_CONFIG::$dbHost;
		$this->mysqlPort = AREA_CONFIG::$dbPort;
		$this->mysqlDbName = AREA_CONFIG::$dbName;
		$this->mysqlUsername = AREA_CONFIG::$dbUser;
		$this->mysqlPasswd = AREA_CONFIG::$dbPassword;
		$this->passwordUrl= AREA_CONFIG::$passwordUrl;
		$this->passwordHost = AREA_CONFIG::$passwordHost;
        require_once __DIR__."/MagicTool.class.php";
        $this->magic = new MagicTool();
		$this->log = new KLogger(dirname(__FILE__), '../logs/SingleShellTask', KLogger::DEBUG);
	}

	public function startTask($data)
	{
		$task_id = $data['task_id'];
		$ip = $data['ip'];
		$this->log->logDebug('line'.__LINE__.': Input: task_id = '.$task_id.', ip = '.$ip);

		$type = empty($data['type']) ? '' : $data['type'];
		$message = empty($data['message']) ? '' : $data['message'];

		$connect_ip = $ip;
		$connect_port = AREA_CONFIG::$sshPort;
		$this->connect_ip = $connect_ip;
		$this->connect_port = $connect_port;
		$this->task_id = $task_id;
		$this->ip = $ip;

		if('develop' == AREA_CONFIG::$server_type)
		{
			$this->mysqlTableName = 'pkg_test';
		}
		else
		{
			$this->mysqlTableName = 'pkg_'.substr($task_id,0,8);
		}

		$ret = $this->mysqlConnect();
		if(false == $ret)
		{
			return $this->formatReturn(-11900,'mysqlConnect failed, code='.$this->code.', msg='.$this->msg);
		}

		$sql = 'select * from  '.$this->mysqlTableName.'  where task_id="'.$task_id.'" and ip="'.$ip.'"';
		$mysql_ret = $this->mysqlQuery($sql);
		if(empty($mysql_ret))
		{
			return $this->formatReturn(-11901,'mysqli query failed, errno='. $this->mysqli->errno .'error='. $this->mysqli->error .' | sql = '.$sql);
		}

		$task_info = $mysql_ret->fetch_assoc();
		if(empty($task_info))
		{
			return $this->formatReturn(-11902, 'mysqli query null !');
		}

		$task_status = $task_info['task_status'];
		$srcPassword = $task_info['password'];
		$user_name = $task_info['user_name'];
		$timeout = $task_info['timeout'];
        $input_cmd = base64_decode($task_info['input_cmd']);
		if('wait' !== $task_status)
		{
			//return $this->formatReturn(-11903, 'task_status invalid, task_status= '.$task_status);
		}

		//从消息队列拿出来先置状态
		$sql = "update ".$this->mysqlTableName." set task_status='connect',end_time=CURRENT_TIMESTAMP,server_ip='".$this->local_ip.":".getmypid()."' where task_id='".$task_id."' and ip='".$ip."'";
		$ret = $this->mysqlQuery($sql);
		if(false == $ret)
		{
			return $this->formatReturn(-11904,'mysqli update (connect) err, errno='. $this->mysqli->errno .'error='. $this->mysqli->error .' | sql = '.$sql);
		}

        if(empty($srcPassword))
        {
            //$srcPassword = AREA_CONFIG::getRootPassword($ip);
            $srcPassword = $this->getPassword($ip);
        }
        $this->ssh2 = $this->ssh2_helper;
        $ret = $this->ssh2->connect($ip,$connect_port,$srcPassword,$user_name);
        if(0 != $ret)
        {
            return $this->formatReturn($ret, 'ssh2 connect failed !');
        }

        //连接上目标机器置connect状态
        $sql = "update  ".$this->mysqlTableName."  set task_status='run',end_time=CURRENT_TIMESTAMP where task_id='".$task_id."' and ip='".$ip."'";
        $ret = $this->mysqlQuery($sql);
        if(false == $ret)
        {
            return $this->formatReturn(-11910,'mysqli update (run) err, errno='. $this->mysqli->errno .' , error='. $this->mysqli->error .' | sql = '.$sql);
        }

        $shell_result = $this->ssh2->runShell($input_cmd,$timeout);
        if(false === $shell_result)
        {
            return $this->formatReturn(-11911, 'runShell failed !');
        }

        $shell_result = addslashes(mb_convert_encoding($shell_result,'utf-8','utf-8,GBK,GB2312'));
        $sql = "update  ".$this->mysqlTableName."  set task_status='suc', result ='". $shell_result ."', end_time=CURRENT_TIMESTAMP where task_id='".$task_id."' and ip='".$ip."'";
        $ret = $this->mysqlQuery($sql);
        if(false == $ret)
        {
            return $this->formatReturn(-11912,'mysqli update suc err, errno='. $this->mysqli->errno .' error='. $this->mysqli->error .' | sql = '.$sql);
        }

        return $this->formatReturn(0, 'OK');
    }

    public function formatReturn($code,$msg,$data = array())
    {
        //获取调用所在行号
        $debug_info = debug_backtrace();
        $line = $debug_info[0]['line'];

        if(0 == $code)
        {
            $this->log->logDebug('line'.$line.':  Output: code = '.$code.' msg = '.$msg.' task_id = '.$this->task_id.' ip = '.$this->ip.' connect_ip = '.$this->connect_ip.' connect_port = '.$this->connect_port);
        }
        else
        {
            $this->log->logError('line'.$line.':  Output: code = '.$code.' msg = '.$msg.' task_id = '.$this->task_id.' ip = '.$this->ip.' connect_ip = '.$this->connect_ip.' connect_port = '.$this->connect_port);

            //失败则更新数据记录状态
            if($this->mysqli)
            {
				$sql = 'update '.$this->mysqlTableName.' set task_status="fail", ret_code ="'.$code.'", result =" '. $msg .'", end_time = CURRENT_TIMESTAMP where task_id="'.$this->task_id.'" and ip="'.$this->ip.'"';
				$ret = $this->mysqlQuery($sql);
				if(false == $ret)
				{
					$this->log->logError('line'.__LINE__.': '.$this->mysqli->errno.' mysqli update(fail) err, err='. $this->mysqli->error .' | sql = '.$sql);
				}
				else
				{
					$this->log->logDebug('line'.__LINE__.': '.$this->mysqli->errno.' mysqli update(fail) suc, error='. $this->mysqli->error .' | sql = '.$sql);
				}
			}
			else
			{
				$this->log->logError('line'.__LINE__.': this->mysqli is null');
			}
		}

		$this->mysqli->close();

		return array('code'=>$code,'msg'=>$msg,'data'=>$data,'time'=>date('Ymd H:i:s', time()));
	}

    public function getPassword($ip)
    {
        $opt = array(
                'ip'=>$this->passwordHost,
                'data'=>'deviceId='.$ip,
                "method"=>"GET",
                "timeout"=>60,
                );
        $ret = $this->magic->http_request($this->passwordUrl,$opt);
        $data = json_decode($ret,true);
        $password = $data['password'];
        return $password;
    }
    private function mysqlConnect()
    {
        $mysqli = new mysqli($this->mysqlServer,
                $this->mysqlUsername,$this->mysqlPasswd,$this->mysqlDbName,$this->mysqlPort);

        if($mysqli->connect_errno)
        {
            sleep(1);
            $mysqli = new mysqli($this->mysqlServer,
                    $this->mysqlUsername,$this->mysqlPasswd,$this->mysqlDbName,$this->mysqlPort);
            if($mysqli->connect_errno)
            {
                sleep(1);
                $mysqli = new mysqli($this->mysqlServer,
                        $this->mysqlUsername,$this->mysqlPasswd,$this->mysqlDbName,$this->mysqlPort);
                if($mysqli->connect_errno)
                {
                    $this->log->logError('line'.__LINE__.': mysqli connect err, errno='. $mysqli->connect_errno .'error='. $mysqli->connect_error);
                    $this->code = $mysqli->connect_errno;
                    $this->msg = 'mysqli connect failed, err='. $mysqli->connect_error;
                    return false;
                }
            }
        }

        $this->mysqli = $mysqli;

        $sql = "SET NAMES 'utf8'";
        $ret = $this->mysqlQuery($sql);
        if(true != $ret)
		{
			$this->log->logError('line'.__LINE__.': mysqli query err, errno='. $mysqli->errno .'error='. $mysqli->error .'sql = '.$sql);
			$this->code = $mysqli->errno;
			$this->msg = 'mysqli query failed, err='. $mysqli->error .'sql = '.$sql;
			return false;
		}

		return true;
	}

	private function mysqlQuery($sql)
	{
		$ret = $this->mysqli->query($sql);
		if(false == $ret)
		{
			sleep(1);
			$ret = $this->mysqli->query($sql);
			if(false == $ret)
			{
				sleep(1);
				$ret = $this->mysqli->query($sql);
			}
		}

		return $ret;
	}

	private $mysqlServer;
	private $mysqlPort;
	private $mysqlDbName;
	private $mysqlTableName;
	private $mysqlUsername;
	private $mysqlPasswd;
	private $mysqli;
	private $local_ip;
	private $ssh2;
	private $ssh2_helper;
	private $log;
	private $code;
	private $msg;
	private $task_id;
	private $ip;
	private $connect_ip;
	private $connect_port;
}

class Ssh2Helper
{
	private $ssh;
	private $sftp;
	private $connect_timeout = 60;
	private $log;
	private $last_buf = "";
	private $agent;
	public function __construct()
	{
	//	set_include_path('/usr/local/services/MagicFlowExtension/lib');
		require_once 'Net/SSH2.php';
		require_once 'Net/SFTP.php';
		require_once 'Crypt/RSA.php';
		$this->log = new KLogger(dirname(__FILE__), '../logs/SingleShellTask', KLogger::DEBUG);
	}
	public function connect($ip,$port,$password,$user_name = 'user_00')
	{
		//获取密码出错
		if(empty($password) && AREA_CONFIG::$authentication == "password" )
		{
			$this->log->logError('line'.__LINE__.': Get Password Error: ip = '.$ip.', user_name = '.$user_name);
			return -11920;
		}

		//ip不在密码库里
		if((false !== strpos($password,':{"result":false,"message":')) || (false !== strpos($password,"\n")))
		{
			$this->log->logError('line'.__LINE__.': Get Password Failed: ip = '.$ip.', user_name = '.$user_name.', password = '.$password);
			return -11921;
		}
        if(AREA_CONFIG::$authentication == "publickey")
        {

            $key = new Crypt_RSA();
            $key->loadKey(file_get_contents(AREA_CONFIG::$privatekey));

            $this->ssh = new Net_SSH2($ip,$port,$this->connect_timeout);
            if (!$this->ssh->login($user_name, $key))
            {
                $this->log->logError('line'.__LINE__.': Net_SSH2 Login Failed: ip = '.$ip.', user_name = '.$user_name.', key= '.AREA_CONFIG::$privatekey);
                return -11922;
            }
        }
        else
        {
            $this->ssh = new Net_SSH2($ip,$port,$this->connect_timeout);
            if (!$this->ssh->login($user_name, $password))
            {
                usleep(mt_rand(5, 30)*100000);
                if (!$this->ssh->login($user_name, $password))
                {
                    usleep(mt_rand(5, 30)*100000);
                    if (!$this->ssh->login($user_name, $password))
                    {
                        $this->log->logError('line'.__LINE__.': Net_SSH2 Login Failed: ip = '.$ip.', user_name = '.$user_name.', password = '.$password);
                        return -11922;
                    }
                }
            }
        }
        return 0;
        }

        public function runShell($shell,$timeout)
        {
            // Run a command that will probably write to stderr (unless you have a folder named /hom)
            $this->ssh->setTimeout($timeout);
            $shell_return = $this->ssh->exec($shell);
            return $shell_return;
        }
        public function close()
        {
            //$ret = $this->ssh->exec('exit');
        }
    }