text:
#include <cstring>
#include <cerrno>

#include <bmx/XMLWriter.h>
#include <bmx/BMXException.h>
#include <bmx/Logging.h>

using namespace std;
using namespace bmx;

static const string INTERNAL_DEFAULT_NAMESPACE_PREFIX = " ";

static const string LT   = "<";
static const string GT   = ">";
static const string AMP  = "&";
static const string QUOT = """;
static const string APOS = "'";

XMLWriter* XMLWriter::Open(string filename)
{
    FILE *xml_file = fopen(filename.c_str(), "wb");
    if (!xml_file) {
        log_error("Failed to open XML file '%s' for writing: %s\n", filename.c_str(), strerror(errno));
        return 0;
    }

    return new XMLWriter(xml_file);
}

XMLWriter::XMLWriter(FILE *xml_file)
{
    mXMLFile = xml_file;
    mPrevWriteType = NONE;
    mLevel = 0;
}

XMLWriter::~XMLWriter()
{
    size_t i;
    for (i = 0; i < mElementStack.size(); i++)
        WriteElementEnd();

    if (mXMLFile)
        fclose(mXMLFile);
}

void XMLWriter::WriteDocumentStart()
{
    BMX_CHECK(mPrevWriteType == NONE);

    WriteProlog();

    mPrevWriteType = START;
}

void XMLWriter::WriteDocumentEnd()
{
    size_t i;
    for (i = 0; i < mElementStack.size(); i++)
        WriteElementEnd();
    mElementStack.clear();

    mPrevWriteType = END;
}

void XMLWriter::WriteElementStart(std::string ns, string local_name)
{
    BMX_CHECK(mPrevWriteType == START ||
              mPrevWriteType == ELEMENT_START ||
              mPrevWriteType == DELAYED_ELEMENT_START ||
              mPrevWriteType == ATTRIBUTE_START ||
              mPrevWriteType == ATTRIBUTE_CONTENT ||
              mPrevWriteType == ATTRIBUTE_END ||
              mPrevWriteType == ELEMENT_CONTENT ||
              mPrevWriteType == ELEMENT_END ||
              mPrevWriteType == COMMENT ||
              mPrevWriteType == PROC_INSTRUCTION);

    if (mPrevWriteType == ATTRIBUTE_START || mPrevWriteType == ATTRIBUTE_CONTENT)
        WriteAttributeEnd();

    if (mPrevWriteType == ELEMENT_START || mPrevWriteType == ATTRIBUTE_END)
    {
        Write(">\n", 2);
    }
    else if (mPrevWriteType == ELEMENT_CONTENT ||
             mPrevWriteType == COMMENT ||
             mPrevWriteType == PROC_INSTRUCTION)
    {
        WriteElementEnd();
    }

    Element *parent_element = (mElementStack.empty() ? 0 : mElementStack.back());
    Element *element = new Element(parent_element, ns, local_name);
    mElementStack.push_back(element);

    string prefix = element->GetPrefix(ns);
    if (prefix.empty()) {
        mPrevWriteType = DELAYED_ELEMENT_START;
        return;
    }

    WriteIndent(mLevel);
    Write("<", 1);
    if (prefix != INTERNAL_DEFAULT_NAMESPACE_PREFIX) {
        Write(prefix);
        Write(":", 1);
    }
    Write(local_name);

    mLevel++;
    mPrevWriteType = ELEMENT_START;
}

void XMLWriter::DeclareNamespace(string ns, std::string prefix)
{
    BMX_CHECK(mPrevWriteType == DELAYED_ELEMENT_START ||
              mPrevWriteType == ELEMENT_START);
    BMX_CHECK(!ns.empty());

    BMX_CHECK(!mElementStack.empty());
    Element *element = mElementStack.back();

    bool was_added;
    if (prefix.empty())
        was_added = element->AddNamespaceDecl(ns, INTERNAL_DEFAULT_NAMESPACE_PREFIX);
    else
        was_added = element->AddNamespaceDecl(ns, prefix);

    if (was_added) {
        if (mPrevWriteType == DELAYED_ELEMENT_START) {
            WriteIndent(mLevel);
            Write("<", 1);
            if (!prefix.empty()) {
                Write(prefix);
                Write(":", 1);
            }
            Write(element->GetLocalName());

            mLevel++;
            mPrevWriteType = ELEMENT_START;
        }

        Write(" xmlns", 6);
        if (!prefix.empty()) {
            Write(":", 1);
            Write(prefix);
        }
        Write("=\"", 2);
        WriteAttributeData(ns);
        Write("\"", 1);
    }
}

void XMLWriter::WriteAttribute(std::string ns, string local_name, string value)
{
    BMX_CHECK(mPrevWriteType == ELEMENT_START ||
              mPrevWriteType == ATTRIBUTE_START ||
              mPrevWriteType == ATTRIBUTE_CONTENT ||
              mPrevWriteType == ATTRIBUTE_END);

    if (mPrevWriteType == ATTRIBUTE_START || mPrevWriteType == ATTRIBUTE_CONTENT)
        WriteAttributeEnd();

    Write(" ", 1);

    if (!ns.empty()) {
        string prefix = GetNonDefaultNSPrefix(ns);
        if (!prefix.empty()) {
            Write(prefix);
            Write(":", 1);
        }
    }

    Write(local_name);
    Write("=\"", 2);
    WriteAttributeData(value);
    Write("\"", 1);

    mPrevWriteType = ATTRIBUTE_END;
}

void XMLWriter::WriteAttributeStart(std::string ns, string local_name)
{
    BMX_CHECK(mPrevWriteType == ELEMENT_START ||
              mPrevWriteType == ATTRIBUTE_START ||
              mPrevWriteType == ATTRIBUTE_CONTENT ||
              mPrevWriteType == ATTRIBUTE_END);

    if (mPrevWriteType == ATTRIBUTE_START || mPrevWriteType == ATTRIBUTE_CONTENT)
        WriteAttributeEnd();

    Write(" ", 1);

    if (!ns.empty()) {
        string prefix = GetNonDefaultNSPrefix(ns);
        if (!prefix.empty()) {
            Write(prefix);
            Write(":", 1);
        }
    }

    Write(local_name);
    Write("=\"", 2);

    mPrevWriteType = ATTRIBUTE_START;
}

void XMLWriter::WriteAttributeContent(string value)
{
    BMX_CHECK(mPrevWriteType == ATTRIBUTE_START ||
              mPrevWriteType == ATTRIBUTE_CONTENT);

    WriteAttributeData(value);

    mPrevWriteType = ATTRIBUTE_CONTENT;
}

void XMLWriter::WriteAttributeEnd()
{
    BMX_CHECK(mPrevWriteType == ATTRIBUTE_START ||
              mPrevWriteType == ATTRIBUTE_CONTENT);

    Write("\"", 1);

    mPrevWriteType = ATTRIBUTE_END;
}

void XMLWriter::WriteElementContent(string content)
{
    BMX_CHECK(mPrevWriteType == ELEMENT_START ||
              mPrevWriteType == ATTRIBUTE_START ||
              mPrevWriteType == ATTRIBUTE_CONTENT ||
              mPrevWriteType == ATTRIBUTE_END ||
              mPrevWriteType == ELEMENT_CONTENT);

    if (mPrevWriteType == ATTRIBUTE_START || mPrevWriteType == ATTRIBUTE_CONTENT)
        WriteAttributeEnd();

    if (mPrevWriteType == ELEMENT_START || mPrevWriteType == ATTRIBUTE_END)
        Write(">", 1);

    WriteElementData(content);

    mPrevWriteType = ELEMENT_CONTENT;
}

void XMLWriter::WriteElementEnd()
{
    BMX_CHECK(mPrevWriteType == ELEMENT_START ||
              mPrevWriteType == ATTRIBUTE_START ||
              mPrevWriteType == ATTRIBUTE_CONTENT ||
              mPrevWriteType == ATTRIBUTE_END ||
              mPrevWriteType == ELEMENT_CONTENT ||
              mPrevWriteType == ELEMENT_END ||
              mPrevWriteType == COMMENT ||
              mPrevWriteType == PROC_INSTRUCTION);

    mLevel--;

    BMX_CHECK(!mElementStack.empty());
    Element *element = mElementStack.back();
    const string &prefix = element->GetPrefix();
    BMX_CHECK(!prefix.empty());

    if (mPrevWriteType == ATTRIBUTE_START || mPrevWriteType == ATTRIBUTE_CONTENT)
        WriteAttributeEnd();

    if (mPrevWriteType == ELEMENT_START || mPrevWriteType == ATTRIBUTE_END) {
        Write("/>\n", 3);
    } else {
        if (mPrevWriteType != ELEMENT_CONTENT) {
            if (mPrevWriteType != ELEMENT_END &&
                mPrevWriteType != COMMENT &&
                mPrevWriteType != PROC_INSTRUCTION)
            {
                Write("\n", 1);
            }
            WriteIndent(mLevel);
        }

        Write("</", 2);
        if (prefix != INTERNAL_DEFAULT_NAMESPACE_PREFIX) {
            Write(prefix);
            Write(":", 1);
        }
        Write(element->GetLocalName());
        Write(">\n", 2);
    }

    mElementStack.pop_back();
    delete element;

    mPrevWriteType = ELEMENT_END;
}

void XMLWriter::WriteElement(string ns, string local_name, string content)
{
    WriteElementStart(ns, local_name);
    WriteElementContent(content);
    WriteElementEnd();
}

void XMLWriter::WriteComment(string comment)
{
    BMX_CHECK(mPrevWriteType == START ||
              mPrevWriteType == ELEMENT_START ||
              mPrevWriteType == ATTRIBUTE_START ||
              mPrevWriteType == ATTRIBUTE_CONTENT ||
              mPrevWriteType == ATTRIBUTE_END ||
              mPrevWriteType == ELEMENT_END ||
              mPrevWriteType == COMMENT ||
              mPrevWriteType == PROC_INSTRUCTION);

    if (mPrevWriteType == ATTRIBUTE_START || mPrevWriteType == ATTRIBUTE_CONTENT)
        WriteAttributeEnd();

    if (mPrevWriteType == ELEMENT_START || mPrevWriteType == ATTRIBUTE_END)
        Write(">\n", 2);

    WriteIndent(mLevel);
    Write("<!--", 4);
    Write(comment);
    Write("-->\n", 4);

    if (mPrevWriteType != ELEMENT_END && mPrevWriteType != START)
        mPrevWriteType = COMMENT;
}

void XMLWriter::WriteProcInstruction(string target, string instruction)
{
    BMX_CHECK(mPrevWriteType == START ||
              mPrevWriteType == ELEMENT_START ||
              mPrevWriteType == ATTRIBUTE_START ||
              mPrevWriteType == ATTRIBUTE_CONTENT ||
              mPrevWriteType == ATTRIBUTE_END ||
              mPrevWriteType == ELEMENT_END ||
              mPrevWriteType == COMMENT ||
              mPrevWriteType == PROC_INSTRUCTION);

    if (mPrevWriteType == ATTRIBUTE_START || mPrevWriteType == ATTRIBUTE_CONTENT)
        WriteAttributeEnd();

    if (mPrevWriteType == ELEMENT_START || mPrevWriteType == ATTRIBUTE_END)
        Write(">\n", 2);

    WriteIndent(mLevel);
    Write("<?", 2);
    Write(target);
    Write(" ", 1);
    Write(instruction);
    Write("?>\n", 3);

    if (mPrevWriteType != ELEMENT_END && mPrevWriteType != START)
        mPrevWriteType = PROC_INSTRUCTION;
}

void XMLWriter::WriteText(string text)
{
    Write(text);
}

void XMLWriter::Flush()
{
    fflush(mXMLFile);
}

string XMLWriter::GetPrefix(string ns)
{
    if (mElementStack.empty())
        return "";

    return mElementStack.back()->GetPrefix(ns);
}

string XMLWriter::GetNonDefaultNSPrefix(string ns)
{
    if (mElementStack.empty())
        return "";

    return mElementStack.back()->GetNonDefaultNSPrefix(ns);
}

XMLWriter::Element::Element(Element *parent_element, string ns, string local_name)
{
    mParentElement = parent_element;
    mNS = ns;
    mLocalName = local_name;
    mDefaultNS = "";

    if (parent_element) {
        mNSpaceDecls = parent_element->GetNamespaceDecls();
        mDefaultNS = parent_element->GetDefaultNamespace();
    }
    mPrefix = GetPrefix(ns);
}

XMLWriter::Element::~Element()
{
}

bool XMLWriter::Element::AddNamespaceDecl(string ns, string prefix)
{
    BMX_CHECK(!ns.empty());
    BMX_CHECK(!prefix.empty());

    if (prefix == INTERNAL_DEFAULT_NAMESPACE_PREFIX) {
        mDefaultNS = ns;
        if (mNS == ns)
            mPrefix = prefix;
    } else {
        pair<map<string, string>::iterator, bool> result = mNSpaceDecls.insert(pair<string, string>(ns, prefix));
        if (!result.second) {
            if (result.first->first == ns && result.first->second == prefix)
                return false;
            mNSpaceDecls.erase(result.first);
            mNSpaceDecls.insert(make_pair(ns, prefix));
        }

        if (mNS == ns && mDefaultNS != ns)
            mPrefix = prefix;
    }

    return true;
}

string XMLWriter::Element::GetPrefix(const std::string &ns) const
{
    if (mDefaultNS == ns) {
        return INTERNAL_DEFAULT_NAMESPACE_PREFIX;
    } else {
        map<string, string>::const_iterator result = mNSpaceDecls.find(ns);
        if (result == mNSpaceDecls.end())
            return "";

        return result->second;
    }
}

string XMLWriter::Element::GetNonDefaultNSPrefix(const std::string &ns) const
{
    map<string, string>::const_iterator result = mNSpaceDecls.find(ns);
    if (result == mNSpaceDecls.end())
        return "";

    return result->second;
}

void XMLWriter::WriteProlog()
{
    Write("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
}

void XMLWriter::WriteElementData(const string &data)
{
    string escaped_data;
    escaped_data.reserve(data.size() * 2);
    const char *data_ptr = data.c_str();
    size_t i;
    for (i = 0; i < data.size(); i++) {
        if (*data_ptr == '>')
            escaped_data.append(GT);
        else if (*data_ptr == '<')
            escaped_data.append(LT);
        else if (*data_ptr == '&')
            escaped_data.append(AMP);
        else
            escaped_data.append(data_ptr, 1);

        data_ptr++;
    }

    Write(escaped_data);
}

void XMLWriter::WriteAttributeData(const string &data)
{
    string escaped_data;
    escaped_data.reserve(data.size() * 2);
    const char *data_ptr = data.c_str();
    size_t i;
    for (i = 0; i < data.size(); i++) {
        if (*data_ptr == '\"')
            escaped_data.append(QUOT);
        else if (*data_ptr == '\'')
            escaped_data.append(APOS);
        else if (*data_ptr == '&')
            escaped_data.append(AMP);
        else
            escaped_data.append(data_ptr, 1);

        data_ptr++;
    }

    Write(escaped_data);
}

void XMLWriter::WriteIndent(int level)
{
    BMX_CHECK(level >= 0);

    int i;
    for (i = 0; i < level; i++)
        Write("  ", 2);
}

void XMLWriter::Write(const string &data)
{
    Write(data.c_str(), data.size());
}

void XMLWriter::Write(const char *data, size_t len)
{
    if (fwrite(data, 1, len, mXMLFile) != len)
        log_error("XML fwrite failed: %s\n", strerror(errno));
}


text:
<?php

class ModelMenuEcoverticalmenu extends Model {

    /**
     *
     */
    private $_editString = '';

    /**
     *
     */
    private $children;

    /**
     *
     */
    private $shopUrl ;

    /**
     *
     */
    private $megaConfig = array();

    private $_editStringCol = '';

    private $_isLiveEdit = true;
    /**
     *
     */
    public function getChilds( $id=null, $store_id = 0 ){
        $sql = ' SELECT m.*, md.title,md.description FROM ' . DB_PREFIX . 'verticalmenu m LEFT JOIN '
            .DB_PREFIX.'verticalmenu_description md ON m.verticalmenu_id=md.verticalmenu_id AND language_id='.(int)$this->config->get('config_language_id') ;
        $sql .= ' WHERE m.`published`=1 ';
        $sql .= ' AND store_id='.(int)$store_id;
        if( $id != null ) {
            $sql .= ' AND parent_id='.(int)$id;
        }
        $sql .= ' ORDER BY `position`  ';
        $query = $this->db->query( $sql );
        return $query->rows;
    }

    /**
     * get get all  Menu Childrens by Id
     */
    public function getChild( $id=null, $store_id = 0){
        $sql = ' SELECT m.*, md.title,md.description FROM ' . DB_PREFIX . 'verticalmenu m LEFT JOIN '
            .DB_PREFIX.'verticalmenu_description md ON m.verticalmenu_id=md.verticalmenu_id AND language_id='.(int)$this->config->get('config_language_id') ;

        $sql .= ' WHERE store_id='.(int)$store_id;
        if( $id != null ) {
            $sql .= ' AND parent_id='.(int)$id;
        }
        $sql .= ' ORDER BY `position`  ';
        $query = $this->db->query( $sql );
        return $query->rows;
    }

    /**
     *
     */
    public function hasChild( $id ){
        return isset($this->children[$id]);
    }

    /**
     *
     */
    public function getNodes( $id ){
        return $this->children[$id];
    }

    /**
     * delete mega menu data by id
     */
    public function delete( $id, $store_id){
        $childs = $this->getChild( null, $store_id );
        foreach($childs as $child ){
            $this->children[$child['parent_id']][] = $child;
        }
        $this->recursiveDelete($id, $store_id);
    }
    /**
     * recursive delete tree
     */
    public function recursiveDelete($parent_id, $store_id)
    {
        $sql = " DELETE FROM ".DB_PREFIX ."verticalmenu_description WHERE verticalmenu_id=".(int)$parent_id .";";
        $this->db->query($sql);
        $sql = " DELETE FROM ".DB_PREFIX ."verticalmenu WHERE store_id = ".$store_id." AND verticalmenu_id=".(int)$parent_id .";";
        $this->db->query($sql);

        if( $this->hasChild($parent_id) ){
            $data = $this->getNodes( $parent_id );
            foreach( $data as $menu ){
                if($menu['verticalmenu_id'] > 1) {
                    $this->recursiveDelete( $menu['verticalmenu_id'], $store_id );
                }
            }
        }
    }

    /**
     *
     */
    public function getTree( $parent=1 , $edit=false, $params, $store_id = 0 ){

        $this->parserMegaConfig( $params );
        if( $edit ){
            $this->_editString  = ' data-id="%s" data-group="%s"  data-cols="%s" data-level="%s" data-align="%s" data-subwidth="%s" ';
        }
        $this->_editStringCol = ' data-colwidth="%s" data-class="%s" ' ;

        $childs = $this->getChilds( null, $store_id );
        foreach($childs as $child ){
            $child['megaconfig'] = $this->hasMegaMenuConfig( $child );
            if( isset($child['megaconfig']->group) ){
                $child['is_group'] = $child['megaconfig']->group;
            }

            if( isset($child['megaconfig']->submenu) && $child['megaconfig']->submenu == 0){
                $child['menu_class'] = $child['menu_class'] .' disable-menu';
            }

            $child['menu_subwidth'] = isset($child['megaconfig']->subwidth) ? $child['megaconfig']->subwidth : '';

            $child['menu_align'] = isset($child['megaconfig']->align) ? $child['megaconfig']->align : 'left';

            $this->children[$child['parent_id']][] = $child;
        }

        $parent = 0 ;
        $this->load->model('catalog/category');
        $this->load->model('catalog/product');
        $this->load->model('tool/image');
        if (isset($this->request->server['HTTPS']) && (($this->request->server['HTTPS'] == 'on') || ($this->request->server['HTTPS'] == '1'))) {
            $this->shopUrl = $this->config->get('config_ssl') ;
        } else {
            $this->shopUrl = $this->config->get('config_url') ;
        }
        $output = '';
        if( $this->hasChild($parent) ){
            $data = $this->getNodes( $parent );

            // render menu at level 0
            foreach( $data as $menu ){

                if( isset($menu['megaconfig']->align) ){
                    $menu['menu_class'] .= ' mega-align-'.$menu['megaconfig']->align;
                }
                $menu['menu_level'] = 1;
                if( $this->hasChild($menu['verticalmenu_id']) || $menu['type_submenu'] == 'html'){
                    $output .= '
renderAttrs($menu).'>
					getLink( $menu ).'">';

                    if( $menu['image']){ $output .= 'shopUrl."image/".$menu['image'].'\') no-repeat;">';	}

                    $output .= ''.$menu['title']."";
                    if( $menu['description'] ){
                        $output .= '' . $menu['description'] . "";
                    }
                    $output .= "";
                    if( $menu['image']){  $output .= ''; }

                    $output .= $this->genTree( $menu['verticalmenu_id'], 1, $menu );
                    $output .= '
';
                } else if ( !$this->hasChild($menu['verticalmenu_id']) && $menu['megaconfig'] && $menu['megaconfig']->rows ){
                    $output .= $this->genMegaMenuByConfig( $menu['verticalmenu_id'], 1, $menu );
                }else {
                    $output .= '
renderAttrs($menu).'>
					getLink( $menu ).'">';

                    if( $menu['image']){ $output .= 'shopUrl."image/".$menu['image'].'\') no-repeat;">';	}

                    $output .= ''.$menu['title']."";
                    if( $menu['description'] ){
                        $output .= '' . $menu['description'] . "";
                    }
                    if( $menu['image']){ $output .= '';	}
                    $output .= '
';
                }
            }

        }

        return $output;

    }

    /**
     *
     */
    public function genMegaMenuByConfig( $parentId, $level,$menu  ){

        $attrw = '';
        $class = $level > 1 ? "dropdown-submenu":"dropdown";
        $output = '
renderAttrs($menu).'>
					getLink( $menu ).'" class="dropdown-toggle" data-toggle="dropdown">';

        if( $menu['image']){ $output .= 'shopUrl."image/".$menu['image'].'\') no-repeat;">';	}

        $output .= ''.$menu['title']."";
        if( $menu['description'] ){
            $output .= '' . $menu['description'] . "";
        }
        if( $menu['image']){ $output .= '';	}
        $output .= "";

        if( isset($menu['megaconfig']->subwidth) &&  $menu['megaconfig']->subwidth ){
            $attrw .= ' style="width:'.$menu['megaconfig']->subwidth.'px"' ;
        }
        $class  = 'menu-child  dropdown-menu';
        $output .= '

';

        foreach( $menu['megaconfig']->rows  as $row ){

            $output .= '
';
            foreach( $row->cols as $col ){
                $output .= '
colwidth .' mega-col col-sm-'.$col->colwidth.'" '.$this->getColumnDataConfig( $col ).'>
';
                $output .= $col->module_name;
                $output .= '

';
            }
            $output .= '
';
        }

        $output .= '

';
        $output .= '
';
        return $output;
    }

    public function getColumnDataConfig( $col ){
        $output = '';
        if( is_object($col)  && $this->_isLiveEdit ){
            $vars = get_object_vars($col);
            foreach( $vars as $key => $var ){
                $output .= ' data-'.$key.'="'.$var . '" ' ;
            }
        }
        return $output;
    }

    /**
     *
     */
    public function parserMegaConfig( $params ){
        if( !empty($params) ) {
            foreach( $params as $param ){
                if( $param && isset($param->id) ){
                    $this->megaConfig[$param->id] = $param;
                }
            }
        }
    }

    public function hasMegaMenuConfig( $menu ){
        $id = $menu['verticalmenu_id'];
        return isset( $this->megaConfig[$id] )?$this->megaConfig[$id] :array();
    }
    /**
     *
     */
    public function genTree( $parentId, $level,$parent  ){

        $attrw = '';
        $class = 'menu-child ' . ($parent['is_group']?"dropdown-mega":"dropdown-menu");
        if( isset($parent['megaconfig']->subwidth) &&  $parent['megaconfig']->subwidth ){
            $attrw .= ' style="width:'.$parent['megaconfig']->subwidth.'px"' ;
        }

        if( $this->hasChild($parentId) ){

            $data = $this->getNodes( $parentId );
            $parent['colums'] = (int)$parent['colums'];
            if( $parent['colums'] > 1  ){

                if( !empty($parent['megaconfig']->rows) ) {

                    $cols   = array_chunk( $data, ceil(count($data)/$parent['colums'])  );
                    $output = '

';
                    foreach( $parent['megaconfig']->rows as $rows ){
                        foreach( $rows as $rowcols ){
                            $output .='
';

                            foreach( $rowcols as $key => $col ) {
                                $col->colwidth = isset($col->colwidth)?$col->colwidth:6;
                                if( isset($col->type) && $col->type == 'menu' && isset($cols[$key]) ){
                                    $scol = '
colwidth .' mega-col col-sm-'.$col->colwidth.'" data-type="menu" '.$this->getColumnDataConfig( $col ).'>
';
                                    $scol .= '
';
                                    foreach( $cols[$key] as $menu ) {
                                        $scol .= $this->renderMenuContent( $menu, $level+1 );
                                    }
                                    $scol .='

';
                                }else {
                                    $scol = '
colwidth.'"  '.$this->getColumnDataConfig( $col ).'>
';

                                    $scol .= '

';
                                }
                                $output .= $scol;
                            }

                            $output .= '
';
                        }
                    }
                    $output .= '

';

                }else {
                    $output = '

';
                    $cols   = array_chunk( $data, ceil(count($data)/$parent['colums'])  );

                    $oSpans = $this->getColWidth( $parent, (int)$parent['colums'] );

                    foreach( $cols as $i =>  $menus ){

                        $output .='

';
                        foreach( $menus as $menu ) {
                            $output .= $this->renderMenuContent( $menu, $level+1 );
                        }
                        $output .='

';
                    }

                    $output .= '

';
                }
                return $output;
            }else {

                if( !empty($parent['megaconfig']->rows) ) {
                    $output = '

';
                    foreach( $parent['megaconfig']->rows as $rows ){
                        foreach( $rows as $rowcols ){
                            $output .='
';
                            foreach( $rowcols as $col ) {

                                if( isset($col->type) && $col->type == 'menu' ){
                                    $colwidth = isset($col->colwidth)?$col->colwidth:'';
                                    $scol = '
getColumnDataConfig( $col ).'>
';
                                    $scol .= '
';
                                    foreach( $data as $menu ){
                                        $scol .= $this->renderMenuContent( $menu , $level+1 );
                                    }
                                    $scol .= '
';

                                }else {
                                    $scol = '
colwidth .' mega-col col-sm-'.$col->colwidth.'"  '.$this->getColumnDataConfig( $col ).'>
';
                                    $scol .= $col->module_name;
                                }

                                $scol .= '

';
                                $output .= $scol;
                            }
                            $output .= '
';
                        }

                    }$output .= '

';
                } else {
                    $output = '

';
                    $row = '

';
                    foreach( $data as $menu ){
                        $row .= $this->renderMenuContent( $menu , $level+1 );
                    }
                    $row .= '

';

                    $output .= $row;

                }

            }

            return $output;

        }
        return ;
    }

    /**
     *
     */
    public function renderAttrs( $menu ){
        $t = sprintf( $this->_editString, $menu['verticalmenu_id'], $menu['is_group'], $menu['colums'], $menu['menu_level'], $menu['menu_align'], $menu['menu_subwidth']  );
        return $t;
    }

    /**
     *
     */
    public function renderMenuContent( $menu , $level ){

        $output = '';
        $class = $menu['is_group']?"mega-group":"";
        $menu['menu_class'] = ' '.$class;
        $menu['menu_level'] = $level-1;
        if( $menu['type'] == 'html' ){
            $output .= '
renderAttrs($menu).'>';
            $output .= '
'.html_entity_decode($menu['content_text']).'
';
            $output .= '
';
            return $output;
        }
        if( $this->hasChild($menu['verticalmenu_id']) ){

            $output .= '
renderAttrs($menu). '>';
            if( $menu['show_title'] ){
                $output .= 'getLink( $menu ).'">';
                $t = '%s';
                if( $menu['image']){ $output .= 'shopUrl."image/".$menu['image'].'\') no-repeat;">';	}
                $output .= ''.$menu['title']."";
                if( $menu['description'] ){
                    $output .= '' . $menu['description'] . "";
                }
                $output .= "";
                if( $menu['image']){
                    $output .= '';
                }
                $output .= '';
            }
            $output .= $this->genTree( $menu['verticalmenu_id'], $level, $menu );
            $output .= '
';

        } else if (  $menu['megaconfig'] && $menu['megaconfig']->rows ){
            $output .= $this->genMegaMenuByConfig( $menu['verticalmenu_id'], $level, $menu );
        }else {
            $output .= '
renderAttrs($menu).'>';
            if( $menu['show_title'] ){
                $output .= 'getLink( $menu ).'">';

                if( $menu['image']){ $output .= 'shopUrl."image/".$menu['image'].'\') no-repeat;">';	}
                $output .= ''.$menu['title']."";
                if( $menu['description'] ){
                    $output .= '' . $menu['description'] . "";
                }
                if( $menu['image']){
                    $output .= '';
                }

                $output .= '';
            }
            $output .= '
';
        }
        return $output;
    }

    /**
     *
     */
    public function getLink( $menu ){
        $id = (int)$menu['item'];
        switch( $menu['type'] ){
            case 'category'     :
                return $this->url->link('product/category', 'path=' . $id);
            case 'product'      :
                return  $this->url->link('product/product', 'product_id=' . $id);
            case 'information'  :
                return   $this->url->link('information/information', 'information_id=' . $id);
            case 'manufacturer' :
                return  $this->url->link('product/manufacturer/info', 'manufacturer_id=' . $id);
            default:
                return $menu['url'];
        }
    }

    /**
     *
     */
    public function getColWidth( $menu, $cols ){
        $output = array();

        $split = preg_split('#\s+#',$menu['submenu_colum_width'] );
        if( !empty($split) && !empty($menu['submenu_colum_width']) ){
            foreach( $split as $sp ) {
                $tmp = explode("=",$sp);
                if( count($tmp) > 1 ){
                    $output[trim(preg_replace("#col#","",$tmp[0]))]=(int)$tmp[1];
                }
            }
        }
        $tmp = array_sum($output);
        $spans = array();
        $t = 0;
        for( $i=1; $i<= $cols; $i++ ){
            if( array_key_exists($i,$output) ){
                $spans[$i] = 'col-sm-'.$output[$i];
            }else{
                if( (12-$tmp)%($cols-count($output)) == 0 ){
                    $spans[$i] = "col-sm-".((12-$tmp)/($cols-count($output)));
                }else {
                    if( $t == 0 ) {
                        $spans[$i] = "col-sm-".( ((11-$tmp)/($cols-count($output))) + 1 ) ;
                    }else {
                        $spans[$i] = "col-sm-".( ((11-$tmp)/($cols-count($output))) + 0 ) ;
                    }
                    $t++;
                }
            }
        }
        return $spans;
    }

    public function importCategories($store_id = 0){
        $sql = "SELECT cd.`name`,c.* FROM ".DB_PREFIX ."category c
				LEFT JOIN ".DB_PREFIX ."category_description cd ON c.category_id = cd.category_id
				WHERE  cd.language_id = '" . (int)$this->config->get('config_language_id') . "'
				ORDER BY parent_id ASC";
        $query = $this->db->query( $sql );
        if($query->num_rows){
            $categories = $query->rows;
        }
        $this->load->model('catalog/category');
        foreach ($categories as &$category){
            $category['language'] = $this->model_catalog_category->getCategoryDescriptions($category['category_id']);

            if($this->checkExitItemMenu($category, $store_id) == 0){
                if((int)$category['parent_id'] > 0){
                    $query1 = $this->db->query("SELECT verticalmenu_id FROM ".DB_PREFIX."verticalmenu WHERE store_id = ".$store_id." AND `type`='category' AND item='".$category['parent_id']."'");
                    $str = "SELECT verticalmenu_id FROM ".DB_PREFIX."verticalmenu WHERE store_id = ".(int)$store_id." AND `type`='category' AND item='".$category['parent_id']."'";

                    if($query1->num_rows){
                        $megamenu_parent_id = (int)$query1->row['megamenu_id'];
                    }
                } else {
                    $megamenu_parent_id = 1;
                }
                $this->insertCategory($category, $megamenu_parent_id, $store_id);
            }
        }
    }

    public function insertMenu(array $dataInput = array()){
        $data = array();

        $data['megamenu']['position'] = 99;
        $data['megamenu']['item'] = $dataInput['item_id'];
        $data['megamenu']['published'] = 1;
        $data['megamenu']['parent_id'] = $dataInput['parent_id'];
        $data['megamenu']['show_title'] = 1;
        $data['megamenu']['widget_id'] = 1;
        $data['megamenu']['type_submenu'] = 'menu';
        $data['megamenu']['type'] = $dataInput['type'];
        $data['megamenu']['colums'] = 1;
        $data['megamenu']['url'] = $dataInput['url'];
        $data['megamenu']['store_id'] = $dataInput['store_id'];
        $data['megamenu']['is_group'] = 0;

        $sql = "INSERT INTO ".DB_PREFIX . "verticalmenu ( `";
        $tmp = array();
        $vals = array();
        foreach( $data["megamenu"] as $key => $value ){
            $tmp[] = $key;
            $vals[]=$this->db->escape($value);
        }
        $sql .= implode("` , `",$tmp)."`) VALUES ('".implode("','",$vals)."') ";
        $this->db->query( $sql );
        $data['megamenu']['verticalmenu_id'] = $this->db->getLastId();

        $sql = " DELETE FROM ".DB_PREFIX ."verticalmenu_description WHERE verticalmenu_id=".(int)$data["megamenu"]['verticalmenu_id'] ;
        $this->db->query( $sql );

        $sql = "INSERT INTO ".DB_PREFIX ."verticalmenu_description(`language_id`, `verticalmenu_id`,`title`)
							VALUES('1','".$data['megamenu']['verticalmenu_id']."','".$this->db->escape($dataInput['name'])."') ";
        $this->db->query( $sql );

        return $data['megamenu']['verticalmenu_id'];
    }

    public function insertCategory($category = array(), $megamenu_parent_id, $store_id = 0){
        $data = array();
        $data['megamenu']['position'] = 99;
        $data['megamenu']['item'] = $category['category_id'];
        $data['megamenu']['published'] = 1;
        $data['megamenu']['parent_id'] = $megamenu_parent_id;
        $data['megamenu']['show_title'] = 1;
        $data['megamenu']['widget_id'] = 1;
        $data['megamenu']['type_submenu'] = 'menu';
        $data['megamenu']['type'] = 'category';
        $data['megamenu']['colums'] = 1;
        $data['megamenu']['store_id'] = $store_id;
        $data['megamenu']['is_group'] = 0;

        $sql = "INSERT INTO ".DB_PREFIX . "verticalmenu ( `";
        $tmp = array();
        $vals = array();
        foreach( $data["megamenu"] as $key => $value ){
            $tmp[] = $key;
            $vals[]=$this->db->escape($value);
        }
        $sql .= implode("` , `",$tmp)."`) VALUES ('".implode("','",$vals)."') ";
        $this->db->query( $sql );
        $data['megamenu']['verticalmenu_id'] = $this->db->getLastId();

        $sql = " DELETE FROM ".DB_PREFIX ."verticalmenu_description WHERE verticalmenu_id=".(int)$data["megamenu"]['verticalmenu_id'] ;

        $this->load->model('localisation/language');
        $languages = $this->model_localisation_language->getLanguages();

        if( isset($category["language"]) ){
            $sql = " DELETE FROM ".DB_PREFIX ."verticalmenu_description WHERE verticalmenu_id=".(int)$data["megamenu"]['verticalmenu_id'] ;
            $this->db->query( $sql );

            foreach( $category["language"] as $key => $categorydes ){

                $sql = "INSERT INTO ".DB_PREFIX ."verticalmenu_description(`language_id`, `verticalmenu_id`,`title`)
							VALUES(".$key.",'".$data['megamenu']['verticalmenu_id']."','".$this->db->escape($categorydes['name'])."') ";
                $this->db->query( $sql );
            }
        }
    }

    public function checkExitItemMenu($category, $store_id){
        $query = $this->db->query("SELECT verticalmenu_id FROM ".DB_PREFIX."verticalmenu WHERE store_id = ".$store_id." AND `type`='category' AND item=".$category['category_id']);
        return $query->num_rows;
    }

    /**
     * Automatic checking installation to whethere creating tables and data sample, configuration of modules.
     */
    public function install(){
        $sql = " SHOW TABLES LIKE '".DB_PREFIX."verticalmenu'";
        $query = $this->db->query( $sql );

        if( count($query->rows) <=0 ){
            $sql = array();
            $sql[]  = "
				CREATE TABLE IF NOT EXISTS `".DB_PREFIX."verticalmenu` (
				  `verticalmenu_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
				  `image` varchar(255) NOT NULL DEFAULT '',
				  `parent_id` int(11) NOT NULL DEFAULT '0',
				  `is_group` smallint(6) NOT NULL DEFAULT '2',
				  `width` varchar(255) DEFAULT NULL,
				  `submenu_width` varchar(255) DEFAULT NULL,
				  `colum_width` varchar(255) DEFAULT NULL,
				  `submenu_colum_width` varchar(255) DEFAULT NULL,
				  `item` varchar(255) DEFAULT NULL,
				  `colums` varchar(255) DEFAULT '1',
				  `type` varchar(255) NOT NULL,
				  `is_content` smallint(6) NOT NULL DEFAULT '2',
				  `show_title` smallint(6) NOT NULL DEFAULT '1',
				  `type_submenu` varchar(10) NOT NULL DEFAULT '1',
				  `level_depth` smallint(6) NOT NULL DEFAULT '0',
				  `published` smallint(6) NOT NULL DEFAULT '1',
				  `store_id` smallint(5) unsigned NOT NULL DEFAULT '0',
				  `position` int(11) unsigned NOT NULL DEFAULT '0',
				  `show_sub` smallint(6) NOT NULL DEFAULT '0',
				  `url` varchar(255) DEFAULT NULL,
				  `target` varchar(25) DEFAULT NULL,
				  `privacy` smallint(5) unsigned NOT NULL DEFAULT '0',
				  `position_type` varchar(25) DEFAULT 'top',
				  `menu_class` varchar(25) DEFAULT NULL,
				  `description` text,
				  `content_text` text,
				  `submenu_content` text,
				  `level` int(11) NOT NULL,
				  `left` int(11) NOT NULL,
				  `right` int(11) NOT NULL,
				  `widget_id` int(11) DEFAULT '0',
				  PRIMARY KEY (`verticalmenu_id`)
				) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=41 ;
			";
            $sql[] = "
						CREATE TABLE IF NOT EXISTS `".DB_PREFIX."verticalmenu_description` (
						  `verticalmenu_id` int(11) NOT NULL,
						  `language_id` int(11) NOT NULL,
						  `title` varchar(255) NOT NULL,
						  `description` text NOT NULL,
						  PRIMARY KEY (`verticalmenu_id`,`language_id`),
						  KEY `name` (`title`)
						) ENGINE=MyISAM DEFAULT CHARSET=utf8;

			";

            foreach( $sql as $q ){
                $this->db->query( $q );
            }
        }

    }
}
?>

redpajama_set_name: RedPajamaGithub


text:
module Foil

  class Notifier

    def initialize(url)
      @url = url
      @mutex = Mutex.new
      @queue = []
      start
    end

    def notify(action, path, secondary_path = nil)
      if @running
        @mutex.synchronize do
          item = [Time.now, action.to_s, path.to_s]
          item << secondary_path.to_s if secondary_path
          @queue.push(item)
        end
      end
    end

    def start
      if @url
        @running = true
        @thread = Thread.start { check_queue_loop }
      end
    end

    def stop
      if @running
        @running = false
        @thread.try(:join)
      end
    end

    private

      def check_queue_loop
        while @running
          begin
            items = @mutex.synchronize {
              items = @queue
              @queue = [] if items.any?
              items
            }
            if items.any?
              post(items)
            end
            sleep(5)
          rescue Exception => e
            logger.error "Unhandled exception in notification queue processing: #{e}"
            sleep(1)
          end
        end
      end

      def post(items)
        retries_left = 5
        begin
          logger.info("Notifying #{@url} with changes: #{items.inspect}")
          response = Faraday.post @url, Yajl.dump({'changes' => items}),
            'Content-Type' => 'application/json'
          if response.status != 200
            logger.warn("Notification URL #{@url} returned #{response.status} instead of 200, ignoring")
          end
        rescue Exception => e
          retries_left -= 1
          if retries_left > 0
            logger.error("Error posting notification to #{@url} (will retry): #{e}")
            sleep(1)
            retry
          else
            logger.error("Could not post notification to #{@url}: #{e}")
          end
        end
      end

      def logger
        Application.get.logger
      end

  end

end


text:
from django.db.models.signals import post_init, post_save, pre_delete
from django.core import serializers

from registry.models import AuditTrail
from registry.utils import get_id_or_none
from registry.signals import AllNormalModels

def jsonify(model_instance):
    return serializers.serialize('json', [model_instance])

def generate_json_before(**kwargs):
    instance = kwargs.get('instance')
    instance.audit_trail = AuditTrail()
    if get_id_or_none(instance):
        instance.audit_trail.json_before = jsonify(instance)

def generate_json_after(**kwargs):
    instance = kwargs.get('instance')
    instance.audit_trail.json_after = jsonify(instance)
    instance.audit_trail.save()

def on_pre_delete(**kwargs):
    empty_json_fixture = '[]'
    instance = kwargs.get('instance')
    instance.audit_trail.json_after = empty_json_fixture
    instance.audit_trail.save()

def connect_signals():
    for qipr_Model in AllNormalModels:
        post_init.connect(generate_json_before, qipr_Model)
        post_save.connect(generate_json_after, qipr_Model)
        pre_delete.connect(on_pre_delete, qipr_Model)


text:
date: 2018-06-04 09:57:12-05:00
layout: post
tags:
- technology
- github
- gitlab
timestamp: 1528124232
title: GitLab and The Old Reader
type: status

---
Remember when Google Reader was shutting down, and it took forever to import your GReader stuff into The Old Reader? That's what it's like with importing GitHub repos into GitLab right now.


text:
using System;
using MbUnit.Framework;
using Rhino.Mocks.Constraints;

namespace Rhino.Mocks.Tests.FieldsProblem
{
    [TestFixture]
    public class FieldProblem_Roy
    {
        [Test]
        public void StubNeverFailsTheTest()
        {
            MockRepository repository = new MockRepository();
            IGetResults resultGetter = repository.Stub<IGetResults>();
            using (repository.Record())
            {
                resultGetter.GetSomeNumber("a");
                LastCall.Return(1);
            }

            int result = resultGetter.GetSomeNumber("b");
            Assert.AreEqual(0, result);
            repository.VerifyAll(); //<- should not fail the test methinks
        }

        [Test]
        public void CanGetSetupResultFromStub()
        {
            MockRepository repository = new MockRepository();
            IGetResults resultGetter = repository.Stub<IGetResults>();
            using (repository.Record())
            {
                resultGetter.GetSomeNumber("a");
                LastCall.Return(1);
            }

            int result = resultGetter.GetSomeNumber("a");
            Assert.AreEqual(1, result);
            repository.VerifyAll();
        }

        [Test]
        [ExpectedException(typeof(InvalidOperationException),
            "You have already specified constraints for this method. (IGetResults.GetSomeNumber(contains \"b\");)")]
        public void CannotCallLastCallConstraintsMoreThanOnce()
        {
            MockRepository repository = new MockRepository();
            IGetResults resultGetter = repository.Stub<IGetResults>();
            using (repository.Record())
            {
                resultGetter.GetSomeNumber("a");
                LastCall.Constraints(Text.Contains("b"));
                LastCall.Constraints(Text.Contains("a"));
            }
        }
    }

    public interface IGetResults
    {
        int GetSomeNumber(string s);
    }
}


text:
module DORB
  class Image

    include Resource

    self.collection_resource_name = 'images'
    self.singular_resource_name = 'image'

    define_attribute :distribution

  end
end


text:
// Licensed to eXtensoft LLC under one or more agreements.
// eXtensoft LLC licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

namespace XF.Common
{
    public enum ScaleOption
    {
        None = 0,
        Low = 1,
        MediumLow = 2,
        Medium = 3,
        MediumHigh = 4,
        High = 5,
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<com.zhy.autolayout.AutoLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ptr="http://schemas.android.com/apk/res-auto"
    android:id="@+id/activity_find_company"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="@color/background">

    <include layout="@layout/title"/>

    <com.zhy.autolayout.AutoLinearLayout
        android:id="@+id/ll_tab"
        android:layout_width="match_parent"
        android:layout_height="80px"
        android:orientation="horizontal">

        <TextView
            android:id="@+id/tv_city"
            android:gravity="center"
            android:layout_width="0px"
            android:layout_weight="1"
            android:layout_height="match_parent"
            android:text="全城"
            android:textSize="30px"
            android:textColor="#1692d7"
            android:background="@drawable/order_notselect"/>

        <View
            android:layout_width="1px"
            android:layout_height="match_parent"
            android:background="#335fd7"/>

        <TextView
            android:id="@+id/tv_sort"
            android:gravity="center"
            android:layout_width="0px"
            android:layout_weight="1"
            android:layout_height="match_parent"
            android:text="综合排序"
            android:textSize="30px"
            android:textColor="#1692d7"
            android:background="@drawable/order_notselect"/>

    </com.zhy.autolayout.AutoLinearLayout>

    <com.zhy.autolayout.AutoRelativeLayout
        android:visibility="gone"
        android:layout_width="match_parent"
        android:layout_height="80px">

        <TextView
            android:id="@+id/tv_text1"
            android:layout_marginLeft="20px"
            android:layout_centerVertical="true"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="当前位置:"
            android:textColor="#989898"/>

        <TextView
            android:id="@+id/tv_location"
            android:layout_toRightOf="@+id/tv_text1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerVertical="true"
            android:textColor="#989898"
            android:text="青岛市市北区敦化路328号诺德广场"/>

        <ImageView
            android:layout_centerVertical="true"
            android:layout_marginRight="20px"
            android:layout_width="42px"
            android:layout_height="42px"
            android:layout_alignParentRight="true"
            android:src="@mipmap/location"/>
    </com.zhy.autolayout.AutoRelativeLayout>

    <com.handmark.pulltorefresh.library.PullToRefreshListView
        android:id="@+id/plv_company"
        android:layout_width="match_parent"
        android:layout_weight="1"
        android:layout_height="0px"
        android:divider="#002d64"
        android:dividerHeight="2px"
        ptr:ptrHeaderSubTextColor="#fff"
        ptr:ptrHeaderTextColor="#fff"
        android:layout_marginTop="10px"
        android:layout_marginRight="20px"
        android:layout_marginLeft="20px">
    </com.handmark.pulltorefresh.library.PullToRefreshListView>

    <ImageView
        android:visibility="gone"
        android:id="@+id/iv_map"
        android:padding="20px"
        android:layout_gravity="right"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@mipmap/map"/>

</com.zhy.autolayout.AutoLinearLayout>


text:
layout: base
title:  'Munduruku UD'
udver: '2'
---

# UD for Mundurukú

## Tokenization and Word Segmentation

* Words are delimited by whitespace characters
* According to typographical rules, many punctuation marks are attached to a neighboring word. They are given as separate tokens (words);
* There are no adjectives in Tupinambá. Modification is made by composition, juxtaposing lexical roots, so when a lexical root is modified by another a new word appears as in *kuɲãporaŋ(a)* 'beautiful woman' (*kuɲã* 'woman' + *poraŋ-(a)* 'beauty'). Such words are treated sometimes as [multiword tokens](https://universaldependencies.org/format.html#morphological-annotation), sometimes as a single word.
* Some compound words from Portuguese are written as one word, e.g. _santaCruz_ 'holy cross'.

## Morphology

### Tags

* Mundurukú uses 16 ofthe 17 universal POS categories. `ADJ` is not used since there is no separate class of adjectives.
Stative-verbs and possessed nouns behave alike, in a way that is not possible to distinguish them morphologically
(I am ugly / I have uglyness; ugly boy / boy with uglyness).

Mapping UPOS to XPOS Mundurukú

 UPOS | XPOS |
:----: | :------: |
 ADJ   | adj      |
 ADV   | adv      |
 INTJ  | intj     |
 NOUN  | n        |
 PROPN | ppn      |
 VERB  | v, vi, vt|
 ADP   | pp       |
 AUX   | aux      |
 CCONJ | cc       |
 DET   | det      |
 NUM   | num      |
 PART  | pcl      |
 PRON  | pro      |
 SCONJ | sc       |
 PUNCT | punct    |
 SYM   | sym      |
 X     | x        |

### Nominal Features

* [NOUN](https://universaldependencies.org/u/pos/NOUN.html), [PROPN](https://universaldependencies.org/u/pos/PROPN.html) and [PRON](https://universaldependencies.org/u/pos/PRON.html), are not marked for [Gender](https://universaldependencies.org/u/feat/Gender.html).
* Personal Pronouns and Person Markers distinguish [Number](https://universaldependencies.org/u/feat/Number.html)(Singular or Plural). They also distinguish [Clusivity](https://universaldependencies.org/u/feat/Clusivity.html) in the 1st person plural. Mundurukú marks the 3rd person plural by adding the partical _ip_.
* Another way to express existential predication is through the reduplication of a noun with the vowel *e* replacing
the original vowel, e.g, *xat* 'food' *xaxet* 'there is food'. These nouns receive a marked `Redup=Ex` (reduplication existential) in the FEATS column.
* Mundurukú classifiers are lexical roots. Nouns in this function have the feature `Noun=Clf`.
* The relational markers `Rel`, which indicate contiguity or non-contiguity between a head and its dependent, take respectively the following features: `Rel=Cont` and `Rel=NCont`.
* Mundurukú has possessor markers that distinguish alienably and inalienably possessed nouns. These types of possession have the feature [Poss](https://universaldependencies.org/u/feat/Poss.html) and the values alienable `(Poss=Ali)`, and inalienable `(Poss=Inal)`.

### Verbal Features

* Verbs have a lexical [Aspect](https://universaldependencies.org/u/feat/Aspect.html): imperfective (Imp), perfective (Perf), iterative (Iter).
* Some lexical roots can not easily be assigned to a  specific lexical category. This is the case with *kake* and *opop*.
These are tagged as [AUX](https://universaldependencies.org/u/pos/AUX_.html) in the [UPOS](), and v:ex (existential verb) and `aux` respectively in the XPOS.
* As a head marking language, Tupinambá cross-references both arguments of a two-place predicate, S and O, only when O is third person: *a-s-epjak* 1.SG-3(RELNCONT)-see 'I see him/her/it/them'. The [PERSON](https://universaldependencies.org/u/feat/Person.html) feature in this case ha sthe value `Person=13` indicating that A is 1st and O 3rd person.
* The protmanteau markers indicating 1 -> 2 (A is 1st and U is 2nd person) are asigned the [PERSON](https://universaldependencies.org/u/feat/Person.html) feature `Person12Sg` and `Person12Pl`.

---

Mundurukú has some auxiliary verbs, which are tagged as [AUX](https://universaldependencies.org/u/pos/AUX_.html). The have two specific functions:
indicate *tense* or *posture*. The table below, shows auxiliaries, giving their functions and giving their plural forms, which for some for some of the verbs have different forms for the singular and plural:

|Auxiliary | Tense | Posture | Plural | Meaning |
|:-------------:| :--------:|:-------:|:------:|:------:|
|osusnuy | past |  |  | was/were |
|oeku | past | | | was/were in movement |
|osodop | past |  |  | was/were |
|e'em |  |  |  | |
|dopdom |  |  | nuynuy | |
|g̃uy |  |  |  | remain |
|jop | |  |  | remain |
|cũg̃'i |  | standing | kacũg̃cũg̃'i |  |
|xik'i |  | sitting | kaxikxik'i |  |
|toro'i |  | hanging | katororo'i |  |
|mũg̃'i |  | leaning | kamũg̃mũg̃'i |  |
|po'i |  | laying | kapopo'i | |

* Particles or reduplication mark [Aspect](https://universaldependencies.org/u/feat/Aspect.html) or [Tense](https://universaldependencies.org/u/feat/Tense.html).
* [Person](https://universaldependencies.org/u/feat/Person.html) can have the value [1](), [2](), and [3]().
* The feature [Evident](https://universaldependencies.org/u/feat/Evident.html) can take the following values in:
* [Clusivity](https://universaldependencies.org/u/feat/Clusivity.html) is also distinguished.
* There are three values for the [Voice](https://universaldependencies.org/u/feat/Voice.html) feature: Act, Mid Pass. All other verb forms have Voice=Act.

## Syntax

### Core Arguments, Oblique Arguments and Adjuncts
* As a head-marking language, core arguments, except oblique core arguments are cross-referenced on the predicate.
For this reason the feature [Person](https://universaldependencies.org/u/feat/Person.html) takes values combining both arguments (A dn P): `Person=13`, `Person=23`, and `Person=33`. No other combinations occur.
* The order of arguments cross-referenced on the predicate is SOV. These NPs are marked as `obl` ' obliques', since they are not the core arguments.
* Transitivity is found only with third person objects.
* There is a split in alignment type based on verbal aspect.

### Non-verbal clauses

* Mundurukú has some lexemes that function as [copula](https://universaldependencies.org/u/dep/cop.html) in non-verbal clauses for existentia and locational predicates. Examples are: *opop*, *kug̃*, and *kake*. These copular elements are not treated as the head of a clause, but rather the dependent of a lexical predicate
---

## Treebanks

There is 1 Mundurukú UD treebank:

  * [Munduruku-TuDeT](../treebanks/myu_tudet/index.html)


text:
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/**
 * ApproveAndOverbookOrders.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis 1.4 Mar 02, 2009 (07:08:06 PST) WSDL2Java emitter.
 */

package com.google.api.ads.admanager.axis.v202211;

/**
 * The action used for approving and overbooking {@link Order} objects.
 * All {@link LineItem} objects
 *             within the order will be approved as well. For more information
 * on what happens to an order and
 *             its line items when it is approved and overbooked, see
 * the
 *             Ad
 * Manager Help Center.
 */
public class ApproveAndOverbookOrders  extends com.google.api.ads.admanager.axis.v202211.ApproveOrders  implements java.io.Serializable {
    public ApproveAndOverbookOrders() {
    }

    public ApproveAndOverbookOrders(
           java.lang.Boolean skipInventoryCheck) {
        super(
            skipInventoryCheck);
    }

    @Override
    public String toString() {
        return com.google.common.base.MoreObjects.toStringHelper(this.getClass())
            .omitNullValues()
            .add("skipInventoryCheck", getSkipInventoryCheck())
            .toString();
    }
    private java.lang.Object __equalsCalc = null;
    public synchronized boolean equals(java.lang.Object obj) {
        if (!(obj instanceof ApproveAndOverbookOrders)) return false;
        ApproveAndOverbookOrders other = (ApproveAndOverbookOrders) obj;
        if (obj == null) return false;
        if (this == obj) return true;
        if (__equalsCalc != null) {
            return (__equalsCalc == obj);
        }
        __equalsCalc = obj;
        boolean _equals;
        _equals = super.equals(obj);
        __equalsCalc = null;
        return _equals;
    }

    private boolean __hashCodeCalc = false;
    public synchronized int hashCode() {
        if (__hashCodeCalc) {
            return 0;
        }
        __hashCodeCalc = true;
        int _hashCode = super.hashCode();
        __hashCodeCalc = false;
        return _hashCode;
    }

    // Type metadata
    private static org.apache.axis.description.TypeDesc typeDesc =
        new org.apache.axis.description.TypeDesc(ApproveAndOverbookOrders.class, true);

    static {
        typeDesc.setXmlType(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v202211", "ApproveAndOverbookOrders"));
    }

    /**
     * Return type metadata object
     */
    public static org.apache.axis.description.TypeDesc getTypeDesc() {
        return typeDesc;
    }

    /**
     * Get Custom Serializer
     */
    public static org.apache.axis.encoding.Serializer getSerializer(
           java.lang.String mechType,
           java.lang.Class _javaType,
           javax.xml.namespace.QName _xmlType) {
        return
          new  org.apache.axis.encoding.ser.BeanSerializer(
            _javaType, _xmlType, typeDesc);
    }

    /**
     * Get Custom Deserializer
     */
    public static org.apache.axis.encoding.Deserializer getDeserializer(
           java.lang.String mechType,
           java.lang.Class _javaType,
           javax.xml.namespace.QName _xmlType) {
        return
          new  org.apache.axis.encoding.ser.BeanDeserializer(
            _javaType, _xmlType, typeDesc);
    }

}


text:
package jme3tools.converters.model.strip;

import java.util.ArrayList;

class FaceInfoVec extends ArrayList<FaceInfo> {

    private static final long serialVersionUID = 1L;

	public FaceInfoVec() {
        super();
    }

    public FaceInfo at(int index) {
        return get(index);
    }

    public void reserve(int i) {
        super.ensureCapacity(i);
    }

}


text:
<?php namespace Context\DQL\Modelling\Aggregate\Context\Command;

use BoundedContext\Command\AbstractCommand;
use BoundedContext\Contracts\Command\Command;
use EventSourced\ValueObject\ValueObject\Uuid;
use Context\DQL\Modelling\ValueObject\Name;

/** @id 3f338909-125e-4f27-91bf-bd0dbcd7aa90 */
class Rename extends AbstractCommand implements Command
{
    public $name;

    public function __construct(Uuid $id, Uuid $context_id, Name $name)
    {
        parent::__construct($id, $context_id);

        $this->name = $name;
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:mvc="http://www.springframework.org/schema/mvc"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:util="http://www.springframework.org/schema/util"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
		http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
		http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">

    <!-- Configure the multipart resolver -->
    <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
        <!-- one of the properties available; the maximum file size in bytes -->
        <property name="maxUploadSize" value="9000000"/>
    </bean>

</beans>


text:
title: "Spark ML -- Multilayer Perceptron"
aliases:
  - reference/sparklyr/latest/ml_multilayer_perceptron_classifier.html
---

Arguments

Value

Details

See also

Classification model based on the Multilayer Perceptron. Each layer has sigmoid activation function, output layer has softmax.

ml_multilayer_perceptron_classifier(x, formula = NULL, layers,
  max_iter = 100L, step_size = 0.03, tol = 1e-06, block_size = 128L,
  solver = "l-bfgs", seed = NULL, initial_weights = NULL,
  features_col = "features", label_col = "label",
  prediction_col = "prediction",
  uid = random_string("multilayer_perceptron_classifier_"), ...)

ml_multilayer_perceptron(x, formula = NULL, layers, max_iter = 100L,
  step_size = 0.03, tol = 1e-06, block_size = 128L, solver = "l-bfgs",
  seed = NULL, initial_weights = NULL, features_col = "features",
  label_col = "label", prediction_col = "prediction",
  uid = random_string("multilayer_perceptron_classifier_"), response = NULL,
  features = NULL, ...)

Arguments

    <colgroup>
      <col class="name" />
      <col class="desc" />
    </colgroup>

      x

A spark_connection, ml_pipeline, or a tbl_spark.

      formula

Used when x is a tbl_spark. R formula as a character string or a formula. This is used to transform the input dataframe before fitting, see ft_r_formula for details.

      layers

A numeric vector describing the layers -- each element in the vector gives the size of a layer. For example, c(4, 5, 2) would imply three layers, with an input (feature) layer of size 4, an intermediate layer of size 5, and an output (class) layer of size 2.

      max_iter

The maximum number of iterations to use.

      step_size

Step size to be used for each iteration of optimization (> 0).

      tol

Param for the convergence tolerance for iterative algorithms.

      block_size

Block size for stacking input data in matrices to speed up the computation. Data is stacked within partitions. If block size is more than remaining data in a partition then it is adjusted to the size of this data. Recommended size is between 10 and 1000. Default: 128

      solver

The solver algorithm for optimization. Supported options: "gd" (minibatch gradient descent) or "l-bfgs". Default: "l-bfgs"

      seed

A random seed. Set this value if you need your results to be
reproducible across repeated calls.

      initial_weights

The initial weights of the model.

      features_col

Features column name, as a length-one character vector. The column should be single vector column of numeric values. Usually this column is output by ft_r_formula.

      label_col

Label column name. The column should be a numeric column. Usually this column is output by ft_r_formula.

      prediction_col

Prediction column name.

      uid

A character string used to uniquely identify the ML estimator.

      ...

Optional arguments; currently unused.

      response

(Deprecated) The name of the response column (as a length-one character vector.)

      features

(Deprecated) The name of features (terms) to use for the model fit.

Value

The object returned depends on the class of x.

spark_connection: When x is a spark_connection, the function returns an instance of a ml_predictor object. The object contains a pointer to
  a Spark Predictor object and can be used to compose
  Pipeline objects.

ml_pipeline: When x is a ml_pipeline, the function returns a ml_pipeline with
  the predictor appended to the pipeline.

tbl_spark: When x is a tbl_spark, a predictor is constructed then
  immediately fit with the input tbl_spark, returning a prediction model.

tbl_spark, with formula: specified When formula
    is specified, the input tbl_spark is first transformed using a
    RFormula transformer before being fit by
    the predictor. The object returned in this case is a ml_model which is a
    wrapper of a ml_pipeline_model.

Details

ml_multilayer_perceptron() is an alias for ml_multilayer_perceptron_classifier() for backwards compatibility.

See also

See http://spark.apache.org/docs/latest/ml-classification-regression.html for
  more information on the set of supervised learning algorithms.

Other ml algorithms: ml_aft_survival_regression,
  ml_decision_tree_classifier,
  ml_gbt_classifier,
  ml_generalized_linear_regression,
  ml_isotonic_regression,
  ml_linear_regression,
  ml_linear_svc,
  ml_logistic_regression,
  ml_naive_bayes,
  ml_one_vs_rest,
  ml_random_forest_classifier


text:
  Chamesson est
       un village
       localisé dans le département de Côte-d'Or en Bourgogne. Elle comptait 296 habitants en 2008.

Le parc de logements, à Chamesson, était réparti en 2011 en six appartements et 137 maisons soit
 un marché relativement équilibré.

La commune propose quelques  équipements, elle dispose, entre autres, de un terrain de sport.

À proximité de Chamesson sont situées les villes de
Ampilly-le-Sec à 2 km, 373 habitants,
Aisey-sur-Seine à 5 km, 215 habitants,
Chemin-d'Aisey située à 5 km, 56 habitants,
Balot à 8 km, 91 habitants,
Buncey à 3 km, 381 habitants,
Nod-sur-Seine à 3 km, 267 habitants,
 entre autres. De plus, Chamesson est située à seulement sept km de Châtillon-sur-Seine.

Si vous pensez demenager à Chamesson, vous pourrez aisément trouver une maison à acheter.


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

import org.apache.ignite.visor.visor
import org.scalatest._

import org.apache.ignite.visor.commands.open.VisorOpenCommand._
import org.apache.ignite.visor.commands.kill.VisorKillCommand._

/**
 * Unit test for 'kill' command.
 */
class VisorKillCommandSpec extends FunSpec with Matchers {
    describe("A 'kill' visor command") {
        it("should print error message with null argument") {
            visor.open("-d")
            visor.kill(null)
            visor.close()
        }

        it("should print error message if both kill and restart specified") {
            visor.open("-d")
            visor.kill("-k -r")
            visor.close()
        }

        it("should print error message if not connected") {
            visor.kill("-k")
        }

        it("should restart node") {
            visor.open("-d")
            visor.kill("-r -id8=@n1")
            visor.close()
        }

        it("should print error message") {
            visor.open("-d")
            visor.kill("-r -id=xxx")
            visor.close()
        }
    }
}


text:
'use strict';

/**
 * Module dependencies.
 */
var should = require('should'),
	mongoose = require('mongoose'),
	User = mongoose.model('User'),
	Ikebox = mongoose.model('Ikebox'),
	faker = require('faker'),
	moment = require('moment');

/**
 * Globals
 */
var user, ikebox;

/**
 * Unit tests
 */
describe('ikebox Model Unit Tests:', function() {
	beforeEach(function(done) {

		user = new User({
			firstName: faker.name.firstName(),
			lastName: faker.name.lastName(),
			email: faker.internet.email(),
			username: faker.internet.userName(),
			password: faker.internet.password()
		});

		user.save(function() {
			ikebox = new Ikebox({
				title: faker.lorem.words(2),
				description: faker.lorem.sentence(2),
				createdBy: user._id
			});

			done();
		});
	});

	describe('Method Save', function() {
		it('should be able to save without problems', function(done) {
			return ikebox.save(function(err) {
				should.not.exist(err);
				done();
			});
		});
		it('should not save without a title', function(done) {
			ikebox.title = '';
			return ikebox.save(function(err){
				should.exist(err);
				done();
			});
		});
		it('should not save without a description', function(done) {
			ikebox.description = '';
			return ikebox.save(function(err){
				should.exist(err);
				done();
			});
		});
	});

	afterEach(function(done) {
		Ikebox.remove().exec();
		User.remove().exec();

		done();
	});
});


text:
package com.github.neunkasulle.chronocommand.control;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.assertTrue;

/**
 * Created by Janze on 28.02.2016.
 *
 */
public class MonthlyReminderTest extends UeberTest {

    @Before
    public void setUp() throws Exception {
        super.setUp();
    }

    @After
    public void tearDown() throws Exception {
        super.tearDown();
    }

    @Test
    public void testExecute() throws Exception {
        MonthlyReminder monthlyReminder = new MonthlyReminder();

        monthlyReminder.execute(null);
        assertTrue(true);
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!-- From: file:/C:/Users/RXUsagi/Desktop/volleyball/MyApplication5/facebook/build/intermediates/bundles/debug/res/values-el/values-el.xml -->
    <eat-comment/>
    <string name="messenger_send_button_text">Αποστολή</string>
</resources>


text:
package org.elasticsearch.painless.node;

import org.elasticsearch.painless.Definition;
import org.elasticsearch.painless.Definition.Method;
import org.elasticsearch.painless.Definition.MethodKey;
import org.elasticsearch.painless.FunctionRef;
import org.elasticsearch.painless.Globals;
import org.elasticsearch.painless.Locals;
import org.elasticsearch.painless.Location;
import org.elasticsearch.painless.MethodWriter;
import org.objectweb.asm.Type;

import java.lang.invoke.LambdaMetafactory;
import java.util.Objects;
import java.util.Set;

import static org.elasticsearch.painless.WriterConstants.LAMBDA_BOOTSTRAP_HANDLE;

/**
 * Represents a function reference.
 */
public final class EFunctionRef extends AExpression implements ILambda {
    private final String type;
    private final String call;

    private FunctionRef ref;
    private String defPointer;

    public EFunctionRef(Location location, String type, String call) {
        super(location);

        this.type = Objects.requireNonNull(type);
        this.call = Objects.requireNonNull(call);
    }

    @Override
    void extractVariables(Set<String> variables) {}

    @Override
    void analyze(Locals locals) {
        if (expected == null) {
            ref = null;
            actual = Definition.getType("String");
            defPointer = "S" + type + "." + call + ",0";
        } else {
            defPointer = null;
            try {
                if ("this".equals(type)) {
                    // user's own function
                    Method interfaceMethod = expected.struct.getFunctionalMethod();
                    if (interfaceMethod == null) {
                        throw new IllegalArgumentException("Cannot convert function reference [" + type + "::" + call + "] " +
                                                           "to [" + expected.name + "], not a functional interface");
                    }
                    Method implMethod = locals.getMethod(new MethodKey(call, interfaceMethod.arguments.size()));
                    if (implMethod == null) {
                        throw new IllegalArgumentException("Cannot convert function reference [" + type + "::" + call + "] " +
                                                           "to [" + expected.name + "], function not found");
                    }
                    ref = new FunctionRef(expected, interfaceMethod, implMethod, 0);
                } else {
                    // whitelist lookup
                    ref = new FunctionRef(expected, type, call, 0);
                }
            } catch (IllegalArgumentException e) {
                throw createError(e);
            }
            actual = expected;
        }
    }

    @Override
    void write(MethodWriter writer, Globals globals) {
        if (ref != null) {
            writer.writeDebugInfo(location);
            // convert MethodTypes to asm Type for the constant pool.
            String invokedType = ref.invokedType.toMethodDescriptorString();
            Type samMethodType = Type.getMethodType(ref.samMethodType.toMethodDescriptorString());
            Type interfaceType = Type.getMethodType(ref.interfaceMethodType.toMethodDescriptorString());
            if (ref.needsBridges()) {
                writer.invokeDynamic(ref.invokedName,
                                     invokedType,
                                     LAMBDA_BOOTSTRAP_HANDLE,
                                     samMethodType,
                                     ref.implMethodASM,
                                     samMethodType,
                                     LambdaMetafactory.FLAG_BRIDGES,
                                     1,
                                     interfaceType);
            } else {
                writer.invokeDynamic(ref.invokedName,
                                     invokedType,
                                     LAMBDA_BOOTSTRAP_HANDLE,
                                     samMethodType,
                                     ref.implMethodASM,
                                     samMethodType,
                                     0);
            }
        } else {
            // TODO: don't do this: its just to cutover :)
            writer.push((String)null);
        }
    }

    @Override
    public String getPointer() {
        return defPointer;
    }

    @Override
    public Type[] getCaptures() {
        return new Type[0]; // no captures
    }
}


text:
<!doctype html>

  <title>Form Elements</title>
  <link href="../lib/bootstrap/dist/css/bootstrap.css" rel="stylesheet" />
  <link href="../dist/ui-form.css" rel="stylesheet" />

Angular form element directives

    <ui-form name="sampleForm" class="form-horizontal" data-edit-mode="{{ctrl.model.editMode}}"
             data-ng-submit="ctrl.submitHandler()">

        <ui-form-input-text data-element-name="sampleText"
                            data-ng-model="ctrl.model.payload.name"
                            data-label="ctrl.model.metadata.name.label"
                            data-config="ctrl.model.metadata.name"
                            data-flush="true"
                            class="col-md-6">
        </ui-form-input-text>
        <ui-form-input-text data-element-name="sampleText2"
                            data-ng-model="ctrl.model.payload.last"
                            data-label="ctrl.model.metadata.last.label"
                            data-config="ctrl.model.metadata.last"
                            class="col-md-6">
        </ui-form-input-text>

        <ui-form-input-text data-element-name="sampleNumber"
                            data-ng-model="ctrl.model.payload.age"
                            data-label="ctrl.model.metadata.age.label"
                            data-config="ctrl.model.metadata.age"
                            class="col-md-6">
        </ui-form-input-text>
        <ui-form-input-text data-element-name="sampleDate"
                            data-ng-model="ctrl.model.payload.birthDay"
                            data-label="ctrl.model.metadata.birthDay.label"
                            data-config="ctrl.model.metadata.birthDay"
                            class="col-md-6">
        </ui-form-input-text>

          <ui-form-fieldset data-legend="{{ctrl.model.metadata.hobbies.label}}" class="col-sm-offset-4" >

              <ui-form-input-checkbox data-element-name="sampleCheckbox"
                                      data-ng-model="item.value"
                                      data-label="item.label"
                                      data-config="ctrl.model.metadata.hobbies"
                                      class="col-sm-6">
              </ui-form-input-checkbox>

          </ui-form-fieldset>

          <ui-form-input-text data-element-name="item.name"
                              data-ng-model="item.value"
                              data-label="item.label"
                              data-config="item"
                              class="col-md-6">

          </ui-form-input-text>

          <ui-form-input-checkbox data-element-name="sampleCheckbox2"
            data-ng-model="ctrl.model.payload.acceptLicenseAgreement.value"
            data-label="ctrl.model.payload.acceptLicenseAgreement.label"
            data-config="ctrl.model.metadata.acceptLicenseAgreement"
            class="col-md-6">
          </ui-form-input-checkbox>

          <input type="button" class="btn btn-primary btn-block" data-ng-click="ctrl.editMode();" value="Edit Mode" />
          <input type="button" class="btn btn-primary btn-block" data-ng-click="ctrl.viewMode();" value="View Mode" />

    </ui-form>


text:
//
//  CallValidator.h
//  Pods
//
//  Created by Dailingchi on 16/6/20.
//
//

#import <Foundation/Foundation.h>

/**
 *  用于请求验证
 */
@protocol CallValidator <NSObject>

- (BOOL)validatorResponse:(NSHTTPURLResponse *)response
           responseObject:(id)responseObject
                    error:(NSError **)error;

@end


text:
A simple example that runs a websocket echo server

## Usage

```
var ws = new WebSocket("ws://localhost:5050");
ws.onmessage = function(msg) { console.log(msg); }
ws.send("foo")
```

## License

Copyright © 2015 FIXME

Distributed under the Eclipse Public License either version 1.0 or (at
your option) any later version.


text:
require 'capistrano'

Capistrano::Configuration.instance(:must_exist).load do

  set :python, "python"

  set :django_project_subdirectory, "project"
  set :django_use_south, false
  set :django_databases, nil

  depend :remote, :command, "#{python}"

  def django_manage(cmd, options={})
    path = options.delete(:path) || "#{latest_release}"
    manage_py = fetch(:django_manage_py, "#{python} manage.py")
    run "cd #{path}/#{django_project_subdirectory}; #{manage_py} #{cmd}", options
  end

  namespace :django do
    desc <<EOF
Run custom Django management command in latest release.

Pass the management command and arguments in COMMAND="..." variable.
If COMMAND variable is not provided, Capistrano will ask for a command.
EOF
    task :manage do
      set_from_env_or_ask :command, "Enter management command"
      django_manage "#{command}"
    end
  end

  namespace :deploy do
    desc "Run manage.py syncdb in latest release."
    task :migrate, :roles => :db, :only => { :primary => true } do
      # FIXME: path, see default railsy deploy:migrate
      m = if fetch(:django_use_south, false) then "--migrate" else "" end
      if fetch(:django_databases, nil)
        fetch(:django_databases, nil).each { |db|
          django_manage "syncdb --noinput #{m} --database=#{db}"
        }
      else
        django_manage "syncdb --noinput #{m}"
      end
    end
  end

  # depend :remote, :python_module, "module_name"
  # runs #{python} and tries to import module_name.
  class Capistrano::Deploy::RemoteDependency
    def python_module(module_name, options={})
      @message ||= "Cannot import `#{module_name}'"
      python = configuration.fetch(:python, "python")
      try("#{python} -c 'import #{module_name}'", options)
      self
    end
  end
end


text:
from __future__ import absolute_import, division, print_function, unicode_literals

import logging
import os.path
from abc import abstractproperty
from builtins import object, str

from six import string_types

from pants.build_graph.target import Target
from pants.engine.addressable import addressable_list
from pants.engine.fs import GlobExpansionConjunction, PathGlobs
from pants.engine.objects import Locatable
from pants.engine.rules import UnionRule, union
from pants.engine.struct import Struct, StructWithDeps
from pants.source import wrapped_globs
from pants.util.collections_abc_backport import MutableSequence, MutableSet
from pants.util.contextutil import exception_logging
from pants.util.meta import AbstractClass, classproperty
from pants.util.objects import Exactly, SubclassesOf, datatype

logger = logging.getLogger(__name__)

class TargetAdaptor(StructWithDeps):
  """A Struct to imitate the existing Target.

  Extends StructWithDeps to add a `dependencies` field marked Addressable.
  """

  def get_sources(self):
    """Returns target's non-deferred sources if exists or the default sources if defined.

    :rtype: :class:`GlobsWithConjunction`

    NB: once ivy is implemented in the engine, we can fetch sources natively here, and/or
    refactor how deferred sources are implemented.
      see: https://github.com/pantsbuild/pants/issues/2997
    """
    source = getattr(self, 'source', None)
    sources = getattr(self, 'sources', None)

    if source is not None and sources is not None:
      raise Target.IllegalArgument(
        self.address.spec,
        'Cannot specify both source and sources attribute.'
      )

    if source is not None:
      if not isinstance(source, string_types):
        raise Target.IllegalArgument(
          self.address.spec,
          'source must be a string containing a path relative to the target, but got {} of type {}'
            .format(source, type(source))
        )
      sources = [source]

    # N.B. Here we check specifically for `sources is None`, as it's possible for sources
    # to be e.g. an explicit empty list (sources=[]).
    if sources is None:
      if self.default_sources_globs is not None:
        globs = Globs(*self.default_sources_globs,
                      spec_path=self.address.spec_path,
                      exclude=self.default_sources_exclude_globs or [])
        conjunction_globs = GlobsWithConjunction(globs, GlobExpansionConjunction.any_match)
      else:
        globs = None
        conjunction_globs = None
    else:
      globs = BaseGlobs.from_sources_field(sources, self.address.spec_path)
      conjunction_globs = GlobsWithConjunction(globs, GlobExpansionConjunction.all_match)

    return conjunction_globs

  @property
  def field_adaptors(self):
    """Returns a tuple of Fields for captured fields which need additional treatment."""
    with exception_logging(logger, 'Exception in `field_adaptors` property'):
      conjunction_globs = self.get_sources()

      if conjunction_globs is None:
        return tuple()

      sources = conjunction_globs.non_path_globs
      conjunction = conjunction_globs.conjunction

      if not sources:
        return tuple()
      base_globs = BaseGlobs.from_sources_field(sources, self.address.spec_path)
      path_globs = base_globs.to_path_globs(self.address.spec_path, conjunction)

      return (SourcesField(
        self.address,
        'sources',
        base_globs.filespecs,
        base_globs,
        path_globs,
        self.validate_sources,
      ),)

  @classproperty
  def default_sources_globs(cls):
    return None

  @classproperty
  def default_sources_exclude_globs(cls):
    return None

  def validate_sources(self, sources):
    """"
    Validate that the sources argument is allowed.

    Examples may be to check that the number of sources is correct, that file extensions are as
    expected, etc.

    TODO: Replace this with some kind of field subclassing, as per
    https://github.com/pantsbuild/pants/issues/4535

    :param sources EagerFilesetWithSpec resolved sources.
    """
    pass

@union
class HydrateableField(object):
  """A marker for Target(Adaptor) fields for which the engine might perform extra construction."""

class SourcesField(
  datatype(['address', 'arg', 'filespecs', 'base_globs', 'path_globs', 'validate_fn'])
):
  """Represents the `sources` argument for a particular Target.

  Sources are currently eagerly computed in-engine in order to provide the `BuildGraph`
  API efficiently; once tasks are explicitly requesting particular Products for Targets,
  lazy construction will be more natural.
    see https://github.com/pantsbuild/pants/issues/3560

  :param address: The Address of the TargetAdaptor for which this field is an argument.
  :param arg: The name of this argument: usually 'sources', but occasionally also 'resources' in the
    case of python resource globs.
  :param filespecs: The merged filespecs dict the describes the paths captured by this field.
  :param path_globs: A PathGlobs describing included files.
  :param validate_fn: A function which takes an EagerFilesetWithSpec and throws if it's not
    acceptable. This API will almost certainly change in the near future.
  """

  def __hash__(self):
    return hash((self.address, self.arg))

  def __repr__(self):
    return str(self)

  def __str__(self):
    return '{}(address={}, input_globs={}, arg={}, filespecs={!r})'.format(
      type(self).__name__, self.address, self.base_globs, self.arg, self.filespecs)

class JvmBinaryAdaptor(TargetAdaptor):
  def validate_sources(self, sources):
    if len(sources.files) > 1:
      raise Target.IllegalArgument(self.address.spec,
                'jvm_binary must have exactly 0 or 1 sources (typically used to specify the class '
                'containing the main method). '
                'Other sources should instead be placed in a java_library, which '
                'should be referenced in the jvm_binary\'s dependencies.'
              )

class PageAdaptor(TargetAdaptor):
  def validate_sources(self, sources):
    if len(sources.files) != 1:
      raise Target.IllegalArgument(
        self.address.spec,
        'page targets must have exactly 1 source, but found {} ({})'.format(
          len(sources.files),
          ', '.join(sources.files),
        )
      )

class BundlesField(datatype(['address', 'bundles', 'filespecs_list', 'path_globs_list'])):
  """Represents the `bundles` argument, each of which has a PathGlobs to represent its `fileset`."""

  def __hash__(self):
    return hash(self.address)

class BundleAdaptor(Struct):
  """A Struct to capture the args for the `bundle` object.

  Bundles have filesets which we need to capture in order to execute them in the engine.

  TODO: Bundles should arguably be Targets, but that distinction blurs in the `exp` examples
  package, where a Target is just a collection of configuration.
  """

class AppAdaptor(TargetAdaptor):
  def __init__(self, bundles=None, **kwargs):
    """
    :param list bundles: A list of `BundleAdaptor` objects
    """
    super(AppAdaptor, self).__init__(**kwargs)
    self.bundles = bundles

  @addressable_list(Exactly(BundleAdaptor))
  def bundles(self):
    """The BundleAdaptors for this JvmApp."""
    return self.bundles

  @property
  def field_adaptors(self):
    with exception_logging(logger, 'Exception in `field_adaptors` property'):
      field_adaptors = super(AppAdaptor, self).field_adaptors
      if getattr(self, 'bundles', None) is None:
        return field_adaptors

      bundles_field = self._construct_bundles_field()
      return field_adaptors + (bundles_field,)

  def _construct_bundles_field(self):
    filespecs_list = []
    path_globs_list = []
    for bundle in self.bundles:
      # NB: if a bundle has a rel_path, then the rel_root of the resulting file globs must be
      # set to that rel_path.
      rel_root = getattr(bundle, 'rel_path', self.address.spec_path)

      base_globs = BaseGlobs.from_sources_field(bundle.fileset, rel_root)
      # TODO: we want to have this field set from the global option --glob-expansion-failure, or
      # something set on the target. Should we move --glob-expansion-failure to be a bootstrap
      # option? See #5864.
      path_globs = base_globs.to_path_globs(rel_root, GlobExpansionConjunction.all_match)

      filespecs_list.append(base_globs.filespecs)
      path_globs_list.append(path_globs)
    return BundlesField(self.address,
                        self.bundles,
                        filespecs_list,
                        path_globs_list)

class JvmAppAdaptor(AppAdaptor): pass

class PythonAppAdaptor(AppAdaptor): pass

class RemoteSourcesAdaptor(TargetAdaptor):
  def __init__(self, dest=None, **kwargs):
    """
    :param dest: A target constructor.
    """
    if not isinstance(dest, string_types):
      dest = dest._type_alias
    super(RemoteSourcesAdaptor, self).__init__(dest=dest, **kwargs)

class PythonTargetAdaptor(TargetAdaptor):
  @property
  def field_adaptors(self):
    with exception_logging(logger, 'Exception in `field_adaptors` property'):
      field_adaptors = super(PythonTargetAdaptor, self).field_adaptors
      if getattr(self, 'resources', None) is None:
        return field_adaptors
      base_globs = BaseGlobs.from_sources_field(self.resources, self.address.spec_path)
      path_globs = base_globs.to_path_globs(self.address.spec_path, GlobExpansionConjunction.all_match)
      sources_field = SourcesField(self.address,
                                   'resources',
                                   base_globs.filespecs,
                                   base_globs,
                                   path_globs,
                                   lambda _: None)
      return field_adaptors + (sources_field,)

class PythonBinaryAdaptor(PythonTargetAdaptor):
  def validate_sources(self, sources):
    if len(sources.files) > 1:
      raise Target.IllegalArgument(self.address.spec,
        'python_binary must have exactly 0 or 1 sources (typically used to specify the file '
        'containing the entry point). '
        'Other sources should instead be placed in a python_library, which '
        'should be referenced in the python_binary\'s dependencies.'
      )

class PythonTestsAdaptor(PythonTargetAdaptor): pass

class PantsPluginAdaptor(PythonTargetAdaptor):
  def get_sources(self):
    return GlobsWithConjunction.for_literal_files(['register.py'], self.address.spec_path)

class BaseGlobs(Locatable, AbstractClass):
  """An adaptor class to allow BUILD file parsing from ContextAwareObjectFactories."""

  @staticmethod
  def from_sources_field(sources, spec_path):
    """Return a BaseGlobs for the given sources field.

    `sources` may be None, a list/tuple/set, a string or a BaseGlobs instance.
    """
    if sources is None:
      return Files(spec_path=spec_path)
    elif isinstance(sources, BaseGlobs):
      return sources
    elif isinstance(sources, string_types):
      return Files(sources, spec_path=spec_path)
    elif isinstance(sources, (MutableSet, MutableSequence, tuple)) and \
         all(isinstance(s, string_types) for s in sources):
      return Files(*sources, spec_path=spec_path)
    else:
      raise ValueError('Expected either a glob or list of literal sources: got: {}'.format(sources))

  @staticmethod
  def _filespec_for_exclude(raw_exclude, spec_path):
    if isinstance(raw_exclude, string_types):
      raise ValueError('Excludes of type `{}` are not supported: got "{}"'
                       .format(type(raw_exclude).__name__, raw_exclude))

    excluded_patterns = []
    for raw_element in raw_exclude:
      exclude_filespecs = BaseGlobs.from_sources_field(raw_element, spec_path).filespecs
      if exclude_filespecs.get('exclude', []):
        raise ValueError('Nested excludes are not supported: got {}'.format(raw_element))
      excluded_patterns.extend(exclude_filespecs.get('globs', []))
    return {'globs': excluded_patterns}

  @abstractproperty
  def path_globs_kwarg(self):
    """The name of the `PathGlobs` parameter corresponding to this BaseGlobs instance."""

  @abstractproperty
  def legacy_globs_class(self):
    """The corresponding `wrapped_globs` class for this BaseGlobs."""

  def __init__(self, *patterns, **kwargs):
    self._patterns = patterns
    self._kwargs = kwargs
    raw_spec_path = kwargs.pop('spec_path')
    self._file_globs = self.legacy_globs_class.to_filespec(patterns).get('globs', [])
    raw_exclude = kwargs.pop('exclude', [])
    self._excluded_file_globs = self._filespec_for_exclude(raw_exclude, raw_spec_path).get('globs', [])
    self._spec_path = raw_spec_path

    if kwargs:
      raise ValueError('kwargs not supported for {}. Got: {}'.format(type(self), kwargs))

  @property
  def filespecs(self):
    """Return a filespecs dict representing both globs and excludes."""
    filespecs = {'globs': self._file_globs}
    exclude_filespecs = self._exclude_filespecs
    if exclude_filespecs:
      filespecs['exclude'] = exclude_filespecs
    return filespecs

  @property
  def _exclude_filespecs(self):
    if self._excluded_file_globs:
      return [{'globs': self._excluded_file_globs}]
    else:
      return []

  def to_path_globs(self, relpath, conjunction):
    """Return a PathGlobs representing the included and excluded Files for these patterns."""
    return PathGlobs(
      include=tuple(os.path.join(relpath, glob) for glob in self._file_globs),
      exclude=tuple(os.path.join(relpath, exclude) for exclude in self._excluded_file_globs),
      conjunction=conjunction)

  def _gen_init_args_str(self):
    all_arg_strs = []
    positional_args = ', '.join([repr(p) for p in self._patterns])
    if positional_args:
      all_arg_strs.append(positional_args)
    keyword_args = ', '.join([
      '{}={}'.format(k, repr(v)) for k, v in self._kwargs.items()
    ])
    if keyword_args:
      all_arg_strs.append(keyword_args)

    return ', '.join(all_arg_strs)

  def __repr__(self):
    return '{}({})'.format(type(self).__name__, self._gen_init_args_str())

  def __str__(self):
    return '{}({})'.format(self.path_globs_kwarg, self._gen_init_args_str())

class Files(BaseGlobs):
  path_globs_kwarg = 'files'
  legacy_globs_class = wrapped_globs.Globs

  def __str__(self):
    return '[{}]'.format(', '.join(repr(p) for p in self._patterns))

class Globs(BaseGlobs):
  path_globs_kwarg = 'globs'
  legacy_globs_class = wrapped_globs.Globs

class RGlobs(BaseGlobs):
  path_globs_kwarg = 'rglobs'
  legacy_globs_class = wrapped_globs.RGlobs

class ZGlobs(BaseGlobs):
  path_globs_kwarg = 'zglobs'
  legacy_globs_class = wrapped_globs.ZGlobs

class GlobsWithConjunction(datatype([
    ('non_path_globs', SubclassesOf(BaseGlobs)),
    ('conjunction', GlobExpansionConjunction),
])):

  @classmethod
  def for_literal_files(cls, file_paths, spec_path):
    return cls(Files(*file_paths, spec_path=spec_path), GlobExpansionConjunction.all_match)

def rules():
  return [
    UnionRule(HydrateableField, SourcesField),
    UnionRule(HydrateableField, BundlesField),
  ]


text:
<!doctype html>

	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="description" content="">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title></title>

	<meta name="msapplication-tap-highlight" content="no">

	<link rel="manifest" href="manifest.json">

	<meta name="mobile-web-app-capable" content="yes">
	<meta name="application-name" content="Web Starter Kit">
	<link rel="icon" sizes="192x192" href="images/touch/chrome-touch-icon-192x192.png">

	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-title" content="Web Starter Kit">
	<link rel="apple-touch-icon" href="images/touch/apple-touch-icon.png">

	<meta name="msapplication-TileImage" content="images/touch/ms-touch-icon-144x144-precomposed.png">
	<meta name="msapplication-TileColor" content="#2F3BA2">

	<meta name="theme-color" content="#2F3BA2">

	<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
	<link rel="stylesheet" href="styles/materialize.css">
	<link rel="stylesheet" href="styles/animate.css">
	<link rel="stylesheet" href="styles/fixed-positioning.css">
	<link rel="stylesheet" href="styles/hoge.css">

					Materialize

							arrow_back

					menu

KEEP CHANGING

				NEW MEMBERS ADDED

s12

s12 m4

s12 m4

s12 m4

s12 m6 l3

s12 m6 l3

s12 m6 l3

s12 m6 l3

スクロールの値 | 0


text:
"""Stateless random ops which take seed as a tensor input.

Instead of taking `seed` as an attr which initializes a mutable state within
the op, these random ops take `seed` as an input, and the random numbers are
a deterministic function of `shape` and `seed`.

WARNING: These ops are in contrib, and are not stable.  They should be
consistent across multiple runs on the same hardware, but only for the same
version of the code.

@@stateless_random_uniform
@@stateless_random_normal
@@stateless_truncated_normal
"""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

# pylint: disable=wildcard-import
from tensorflow.contrib.stateless.gen_stateless_random_ops import *

from tensorflow.python.framework import ops
from tensorflow.python.util.all_util import remove_undocumented

ops.NotDifferentiable("StatelessRandomNormal")
ops.NotDifferentiable("StatelessRandomUniform")
ops.NotDifferentiable("StatelessTruncatedNormal")

remove_undocumented(__name__)