text:
package java.util.jar;

import dalvik.system.CloseGuard;
import java.io.IOException;
import java.io.InputStream;
import java.io.RandomAccessFile;
import java.security.cert.Certificate;
import java.util.HashMap;
import java.util.Iterator;
import java.util.zip.Inflater;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import libcore.io.IoUtils;
import libcore.io.Streams;

/**
 * A subset of the JarFile API implemented as a thin wrapper over
 * system/core/libziparchive.
 *
 * @hide for internal use only. Not API compatible (or as forgiving) as
 *        {@link java.util.jar.JarFile}
 */
public final class StrictJarFile {

    private final long nativeHandle;

    // NOTE: It's possible to share a file descriptor with the native
    // code, at the cost of some additional complexity.
    private final RandomAccessFile raf;

    private final Manifest manifest;
    private final JarVerifier verifier;

    private final boolean isSigned;

    private final CloseGuard guard = CloseGuard.get();
    private boolean closed;

    public StrictJarFile(String fileName) throws IOException {
        this.nativeHandle = nativeOpenJarFile(fileName);
        this.raf = new RandomAccessFile(fileName, "r");

        try {
            // Read the MANIFEST and signature files up front and try to
            // parse them. We never want to accept a JAR File with broken signatures
            // or manifests, so it's best to throw as early as possible.
            HashMap<String, byte[]> metaEntries = getMetaEntries();
            this.manifest = new Manifest(metaEntries.get(JarFile.MANIFEST_NAME), true);
            this.verifier = new JarVerifier(fileName, manifest, metaEntries, true);

            isSigned = verifier.readCertificates() && verifier.isSignedJar();
        } catch (IOException ioe) {
            nativeClose(this.nativeHandle);
            throw ioe;
        }

        guard.open("close");
    }

    public Manifest getManifest() {
        return manifest;
    }

    public Iterator<ZipEntry> iterator() throws IOException {
        return new EntryIterator(nativeHandle, "");
    }

    public ZipEntry findEntry(String name) {
        return nativeFindEntry(nativeHandle, name);
    }

    /**
     * Return all certificates for a given {@link ZipEntry} belonging to this jar.
     * This method MUST be called only after fully exhausting the InputStream belonging
     * to this entry.
     *
     * Returns {@code null} if this jar file isn't signed or if this method is
     * called before the stream is processed.
     */
    public Certificate[] getCertificates(ZipEntry ze) {
        if (isSigned) {
            return verifier.getCertificates(ze.getName());
        }

        return null;
    }

    public InputStream getInputStream(ZipEntry ze) {
        final InputStream is = getZipInputStream(ze);

        if (isSigned) {
            JarVerifier.VerifierEntry entry = verifier.initEntry(ze.getName());
            if (entry == null) {
                return is;
            }

            return new JarFile.JarFileInputStream(is, ze.getSize(), entry);
        }

        return is;
    }

    public void close() throws IOException {
        if (!closed) {
            guard.close();

            nativeClose(nativeHandle);
            IoUtils.closeQuietly(raf);
            closed = true;
        }
    }

    private InputStream getZipInputStream(ZipEntry ze) {
        if (ze.getMethod() == ZipEntry.STORED) {
            return new ZipFile.RAFStream(raf, ze.getDataOffset(),
                    ze.getDataOffset() + ze.getSize());
        } else {
            final ZipFile.RAFStream wrapped = new ZipFile.RAFStream(
                    raf, ze.getDataOffset(), ze.getDataOffset() + ze.getCompressedSize());

            int bufSize = Math.max(1024, (int) Math.min(ze.getSize(), 65535L));
            return new ZipFile.ZipInflaterInputStream(wrapped, new Inflater(true), bufSize, ze);
        }
    }

    static final class EntryIterator implements Iterator<ZipEntry> {
        private final long iterationHandle;
        private ZipEntry nextEntry;

        EntryIterator(long nativeHandle, String prefix) throws IOException {
            iterationHandle = nativeStartIteration(nativeHandle, prefix);
        }

        public ZipEntry next() {
            if (nextEntry != null) {
                final ZipEntry ze = nextEntry;
                nextEntry = null;
                return ze;
            }

            return nativeNextEntry(iterationHandle);
        }

        public boolean hasNext() {
            if (nextEntry != null) {
                return true;
            }

            final ZipEntry ze = nativeNextEntry(iterationHandle);
            if (ze == null) {
                return false;
            }

            nextEntry = ze;
            return true;
        }

        public void remove() {
            throw new UnsupportedOperationException();
        }
    }

    private HashMap<String, byte[]> getMetaEntries() throws IOException {
        HashMap<String, byte[]> metaEntries = new HashMap<String, byte[]>();

        Iterator<ZipEntry> entryIterator = new EntryIterator(nativeHandle, "META-INF/");
        while (entryIterator.hasNext()) {
            final ZipEntry entry = entryIterator.next();
            metaEntries.put(entry.getName(), Streams.readFully(getInputStream(entry)));
        }

        return metaEntries;
    }

    private static native long nativeOpenJarFile(String fileName) throws IOException;
    private static native long nativeStartIteration(long nativeHandle, String prefix);
    private static native ZipEntry nativeNextEntry(long iterationHandle);
    private static native ZipEntry nativeFindEntry(long nativeHandle, String entryName);
    private static native void nativeClose(long nativeHandle);
}


text:
var baseUrl = $('div#base-url').html();

var $generalMenu = $("nav#genaralMenu");
var stequipoApp = angular.module('stequipoApp',['ngMaterial', 'ngMessages', 'ui.grid']);

stequipoApp.service('dataService', function($http) {
	this.getData = function(params, path, callbackFunc){
		$http({
			method: 'GET',
			url: baseUrl + path,
			params: params
        	/// headers: {'Authorization': 'Token token=xxxxYYYYZzzz'}
        }).then(function(response) {
        	callbackFunc(response);
        }, function(reason) {
        	console.log('Failed: ' + reason);
        }, function(update) {
        	console.log('Got notification: ' + update);
        });
    };

    this.setData = function(params, path, callbackFunc){
    	$.ajax({
    		method: 'POST',
    		url: baseUrl + path,
    		data: params
    	}).then(function(response) {
    		callbackFunc(response);
    	}, function(reason) {
    		console.log('Failed: ' + reason);
    	}, function(update) {
    		console.log('Got notification: ' + update);
    	});

    	/*$http({
    		method: 'POST',
    		url: baseUrl + path,
    		data: params,
    		headers: {'Content-Type': 'application/x-www-form-urlencoded'}
    	}).then(function(response) {
    		callbackFunc(response);
    	}, function(reason) {
    		console.log('Failed: ' + reason);
    	}, function(update) {
    		console.log('Got notification: ' + update);
    	});*/
    };

});

stequipoApp.controller('Dashboard', ['$scope', '$window', function($scope, $window) {
	$('li#menu-home', $generalMenu).addClass('active');

	$scope.goUrl = function(params){
		console.log(params);
		$window.open(params.url, "_self");
	};
}]);

stequipoApp.controller('Users', ['$scope', '$window', 'dataService', function($scope, $window, dataService) {
	console.log("usuarios");
	$('li#menu-users', $generalMenu).addClass('active');
	$scope.Users = {};

	var usersParams = {
		elements: 'all',
		url: 'get/users'
	};

	dataService.getData(usersParams.elements, usersParams.url, function(dataResponse){
		console.log({"Usuarios ": dataResponse});
		if(typeof dataResponse.data.elements != 'undefined' && dataResponse.data.elements.status === true){
			$scope.gridOptions.data = dataResponse.data.elements.message;
		};
	});

	$scope.gridOptions = {
		modifierKeysToMultiSelectCells: true,
		showGridFooter: true,
		enableFiltering: true,
	};

	$scope.titles = {
		codcliente: "Código",
		fechaalta: "Fecha Inscripción",
		fechabaja: "Fecha Salida",
		nombre: "Nombre",
		cifnif: "Documento",
		email: "Correo",
		diaspago: "días de pago",
		observaciones: "Observaciones",
		telefono1: "Teléfono",
	};

	$scope.gridOptions.columnDefs = [
	{ name: 'codcliente', width:'150', displayName: $scope.titles.codcliente},
	{ name: 'fechaalta', width:'150', displayName: $scope.titles.fechaalta},
	{ name: 'fechabaja', width:'150', displayName: $scope.titles.fechabaja},
	{ name: 'nombre', width:'250', displayName: $scope.titles.nombre},
	{ name: 'cifnif', width:'150', displayName: $scope.titles.cifnif},
	{ name: 'email', width:'250', displayName: $scope.titles.email},
	{ name: 'diaspago', width:'150', displayName: $scope.titles.diaspago},
	{ name: 'observaciones', width:'150', displayName: $scope.titles.observaciones},
	{ name: 'telefono1', width:'150', displayName: $scope.titles.telefono1}
	//{ name: "opciones",  cellTemplate:'./opcionreporte'}
	];

	$scope.goUrl = function(params){
		console.log(params);
		$window.open(params.url, "_self");
	};
}]);

stequipoApp.controller('setUser', ['$scope', '$timeout', 'dataService', function($scope, $timeout, dataService) {
	$('li#menu-user', $generalMenu).addClass('active');

	$scope.setUserForm = {};
	$scope.control = {
		"valid": true
	};

	$scope.dataUser = {};

	$('div#setUserController').removeClass('hide');

	var urlUser = 'get/usersfilter';

	dataService.getData($scope.setUserForm, urlUser, function(dataResponse){
		console.log(dataResponse);
		if(typeof dataResponse.data.elements != 'undefined' && dataResponse.data.elements.status === true){
			$scope.Users = dataResponse.data.elements.message;
		};
	});

	var urlRoles = 'get/roles';

	dataService.getData($scope.setUserForm, urlRoles, function(dataResponse){
		console.log(dataResponse);
		if(typeof dataResponse.data.elements != 'undefined' && dataResponse.data.elements.status === true){
			$scope.Roles = dataResponse.data.elements.message;
		};
	});

	$scope.getUser = function(){
		$scope.control.send = false;
		var url = 'get/userinfo';
		var dniValue = $scope.setUserForm.cifnif;
		if(typeof dniValue != 'undefined' && dniValue.length > 5){
			dataService.getData($scope.setUserForm, url, function(dataResponse){
				if(typeof dataResponse.data.elements.status != 'undefined' && dataResponse.data.elements.status == true){
					$timeout(function () {
						$scope.setUserForm = {
							"cifnif": dataResponse.data.elements.message.cifnif,
							"nombre": dataResponse.data.elements.message.nombre,
							"razonsocial": dataResponse.data.elements.message.razonsocial,
							"email": dataResponse.data.elements.message.email,
							"direccion": dataResponse.data.elements.message.direccion,
							"telefono1": parseInt(dataResponse.data.elements.message.telefono1),
							"fechaalta": new Date(dataResponse.data.elements.message.fechaalta)
						};

						var group = parseInt(dataResponse.data.elements.message.group);
						if(!isNaN(group))
							$scope.setUserForm.group = group;

						var parent = parseInt(dataResponse.data.elements.message.parent);
						if(!isNaN(parent))
							$scope.setUserForm.parent = parent;

						var children = parseInt(dataResponse.data.elements.message.children);
						if(!isNaN(children))
							$scope.setUserForm.children = children;

					}, 500);
				}else{
					$scope.setUserForm = {
						"cifnif": dniValue
					};
				}

			});
		};
	};

	$scope.saveForm = function(){
		$scope.control.valid = $scope.setUser.$valid;
		if($scope.setUser.$valid === true){
			var url = 'set/userdata';
			dataService.setData($scope.setUserForm, url, function(dataResponse){
				if(typeof dataResponse.elements.status != 'undefined' && dataResponse.elements.status == true){
					$scope.control.send = true;
					$timeout(function () {
						$scope.dataUser = dataResponse.elements.message;
						$scope.setUserForm = {};
					}, 500);

				}else{
					///$('div#msg-caratula').html(errorMessages.save);
				}

			});

		}else{

		}
	};

}]);

stequipoApp.controller('getGroup', ['$scope', '$timeout', 'dataService', function($scope, $timeout, dataService) {
	$('li#menu-group', $generalMenu).addClass('active');
	$('div#getGroupController').removeClass('hide');

	$scope.getUserInfoForm = {};
	$scope.control = {
		"valid": true
	};
	$scope.dataResponse = {};

	$scope.searchForm = function(){
		$scope.control.valid = $scope.getUserInfo.$valid;
		if($scope.getUserInfo.$valid === true){

			var url = 'get/userinfo';
			dataService.getData($scope.getUserInfoForm, url, function(dataResponse){
				if(typeof dataResponse.data.elements.status != 'undefined'){
					$scope.dataResponse = dataResponse.data.elements;
				}

				if(typeof dataResponse.data.elements.status != 'undefined' && dataResponse.data.elements.status == true){
					$timeout(function () {
						$scope.dataUser = dataResponse.data.elements.message;
						$scope.dataChildren = dataResponse.data.elements.message2;
					}, 500);

				}else{
					$scope.dataUser = {};
					$scope.dataChildren = {};
				}

			});

		}else{

		}
	};

}]);

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>

    <meta charset="utf-8"/>
    <meta http-equiv="cache-control" content="no-cache"/>
    <meta http-equiv="pragma" content="no-cache"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>

<link   rel="stylesheet"
        href="../../css/style.min.0a7442460ca45a8d1ffa9d4f0a0163976899fc7820ce2bb76f693ba0527afb57.css"
        integrity="sha256-CnRCRgykWo0f+p1PCgFjl2iZ/Hggziu3b2k7oFJ6+1c="
        type="text/css"
        media="screen">

<link   rel="stylesheet"
        href="../../css/mobile.min.9d1271f82d33327493aaf7c1818ceac101a822559d694bd14a222d686e28c391.css"
        integrity="sha256-nRJx+C0zMnSTqvfBgYzqwQGoIlWdaUvRSiItaG4ow5E="
        type="text/css"
        media="handheld, only screen and (max-device-width: 960px)">

    <link href="https://unwiredcouch.com/atom.xml" type="application/atom+xml" rel="alternate" title="unwiredcouch.com: All Posts" />

    <title>A Field Guide to Getting Lost on unwiredcouch.com</title>

Writing

Reading

Setup

About

Drawing

Mastodon

 A Field Guide to Getting Lost

 by
           Rebecca Solnit

 Read: Jan 22, 2020

This was another purchase while rummaging at the book  store. I’ve read Solnit's "Men explain things to me" a couple of years ago. And since I really enjoyed that one, I wanted to read another one of her works. I’m not usually one for essays so it was definitely a different experience from reading more science related books.

I thoroughly enjoyed reading "A Field Guide to Getting Lost" even though (or maybe because of?) I often found myself getting lost myself in an essay and wondering what’s the point she’s trying to bring across. It was also at times deeply emotional to read for me as I was reminded of personal loss (or the fear of it) with many of her essays.

Imprint


text:
package network::hp::procurve::plugin;

use strict;
use warnings;
use base qw(centreon::plugins::script_snmp);

sub new {
    my ($class, %options) = @_;
    my $self = $class->SUPER::new(package => __PACKAGE__, %options);
    bless $self, $class;

    $self->{version} = '1.0';
    %{$self->{modes}} = (
                         'cpu'              => 'network::hp::procurve::mode::cpu',
                         'environment'      => 'network::hp::procurve::mode::environment',
                         'interfaces'       => 'snmp_standard::mode::interfaces',
                         'list-interfaces'  => 'snmp_standard::mode::listinterfaces',
                         'memory'           => 'network::hp::procurve::mode::memory',
                         );

    return $self;
}

1;

__END__

=head1 PLUGIN DESCRIPTION

Check Switch HP Procurve in SNMP.

=cut


text:
<?php
namespace SASEdev\Doctrine\DBAL\Pgsql\Types;

use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Types\ConversionException;
use Doctrine\DBAL\Types\Type;

/**
 *
 * @author sasedev <sasedev.bifidis@gmail.com>
 *
 */
class TimeType extends Type
{

    /**
     *
     * @var string
     */
    const TIME = 'time';

    /**
     * (non-PHPdoc)
     * @see \Doctrine\DBAL\Types\Type::getName()
     */
    public function getName()
    {
        return self::TIME;
    }

    /**
     * (non-PHPdoc)
     * @see \Doctrine\DBAL\Types\Type::getSQLDeclaration()
     */
    public function getSQLDeclaration (array $fieldDeclaration, AbstractPlatform $platform)
    {
        return $platform->getDoctrineTypeMapping('TIME');
    }

    /**
     * (non-PHPdoc)
     * @see \Doctrine\DBAL\Types\Type::convertToDatabaseValue()
     */
    public function convertToDatabaseValue ($value, AbstractPlatform $platform)
    {
        return ($value !== null) ? $value->format('H:i:s.u') : null;
    }

    /**
     * (non-PHPdoc)
     * @see \Doctrine\DBAL\Types\Type::convertToPHPValue()
     */
    public function convertToPHPValue ($value, AbstractPlatform $platform)
    {
        if ($value === null) {
            return null;
        }
        try {
            $val = \DateTime::createFromFormat('H:i:s', $value);
            if ($val === false) {
                throw ConversionException::conversionFailedFormat($value, $this->getName(), 'H:i:s');
            }
        } catch (\Exception $e) {
            $val = \DateTime::createFromFormat('H:i:s.u', $value);
            if (! $val) {
                throw ConversionException::conversionFailedFormat($value, $this->getName(), 'H:i:s.u');
            }
        }
        return $val;
    }
}


text:
package org.jparsec.error;

import org.jparsec.Parsers;

import java.util.List;

/**
 * Describes details of a parsing error to support fine-grained error handling.
 *
 * @author Ben Yu
 */
public interface ParseErrorDetails {

  /** Returns the 0-based index in the source where the error happened. */
  int getIndex();

  /** Returns the physical input encountered when the error happened. */
  String getEncountered();

  /** Returns all that are logically expected. */
  List<String> getExpected();

  /** Returns what is logically unexpected, or {@code null} if none. */
  String getUnexpected();

  /**
   * Returns the error message incurred by {@link Parsers#fail(String)},
   * or {@code null} if none.
   */
  String getFailureMessage();
}


text:
layout: post
title: HFSP Young Investigator Award
picture: /assets/img/posts/20200326_AndiHFSP_small.jpg
published: true
---
Delighted that my lab will join forces with Verena Ruprecht (coordinator) at the CRG in Barcelona, Spain, and Liu Yan-Jun at Fudan University, Shanghai, China, in a **HFSP Young Investigator Grant** to study biophysical aspects of fertilization. Our project is one of eight Young Investigator Grants chosen for funding in the latest call of the Human Frontier Science Program (HFSP).
Having been awarded this grant means that I/my lab have benefited from continous funding from the HFSP since 2010 (postdoc fellowship, Career Development Award, Young Investigator Grant), and we are extremely grateful for this continous support of our research. Thank you HFSP!

More information on the Young Investigator Grant can be found here:
- [HFSP press release for 2020 research grants](https://www.hfsp.org/sites/default/files/Communications/PR%20HFSP%202020%20Research%20Grants.pdf)
- [IMP news feature](https://www.imp.ac.at/news/article/hfsp-grant-to-study-fertilisation/)
- [CRG news feature](https://www.crg.eu/en/news/how-do-sperm-and-egg-fuse-together-new-funding-uncover-mysteries-fertilisation)


text:
// Check if "useQRcodes" is true in personalData before calling this!
// because I'm not gonna check!
var spawn = require('child_process').spawn;
var webModel = require('./webModel');
var robotModel = require('./robotModel');
var kill = require('./reallyKillProcess.js');

/*
  getQRcodes will run the zbarcam application to look for QR codes,
  if a QR code is found it will behave in one of two ways:
  1. If the first line is '{' then it will keep accepting lines until
     it receives a '}' and use it as a JSON string.
  2. Otherwise, if it does not start with a '{' it will stop and use
     the single line as the input.
*/
module.exports = function() {
    var killProcess;
    var process = spawn('../scripts/getQRcodes.sh');
    var foundJSON = false;
    var qrJSONstring = '';
    var killOnTimeout = setTimeout(function() {
        //console.log('timeout');
        kill(process.pid);
        robotModel.gettingQRcode = false;
    }, 5000);
    process.stdout.setEncoding('utf8');
    process.stdout.on('data', function(data) {
        var receivedLine = data.split('\n')[0];
        if (receivedLine !== 'Waiting for zbarcam to close . . .') {
            if (receivedLine == '{') {
                var qrJSONstring = JSON.parse(data);
                if (qrJSONstring.mapName) {
                    if (webModel.mapName === '' && webModel.mapList.indexOf(qrJSONstring.mapName) > -1) {
                        webModel.mapName = qrJSONstring.mapName;
                    }
                }
                // THESE items will only be triggered ONCE per run via a QR code!
                // to avoid fighting the robot when he is at the "initial" station.
                if (!webModel.hasSetupViaQRcode) {
                    if (qrJSONstring.unplugYourself) {
                        webModel.hasSetupViaQRcode = true;
                        webModel.unplugYourself = qrJSONstring.unplugYourself;
                    }
                    if (qrJSONstring.ROSstart) {
                        webModel.hasSetupViaQRcode = true;
                        webModel.ROSstart = qrJSONstring.ROSstart;
                    }
                }
            } else
                webModel.QRcode = receivedLine;
            kill(process.pid);
        }
    });
    //process.stderr.setEncoding('utf8');
    //process.stderr.on('data', function(data) {
    //    console.log('stderr data:' + data);
    //});
    //process.on('error', function(err) {
    //    console.log('getQRcodes Error:' + err);
    //});
    process.on('exit', function() {
        clearTimeout(killOnTimeout);
        robotModel.gettingQRcode = false;
    });
};


text:
<?php

use yupe\components\WebModule;

/**
 * Class CategoryModule
 */
class CategoryModule extends WebModule
{
    /**
     *
     */
    const VERSION = '1.0';

    /**
     * @var string
     */
    public $uploadPath = 'category';

    /**
     * @return array|bool
     */
    public function checkSelf()
    {
        $messages = [];

        $uploadPath = Yii::app()->uploadManager->getBasePath().DIRECTORY_SEPARATOR.$this->uploadPath;

        if (!is_writable($uploadPath)) {
            $messages[WebModule::CHECK_ERROR][] = [
                'type' => WebModule::CHECK_ERROR,
                'message' => Yii::t(
                    'CategoryModule.category',
                    'Directory "{dir}" is available for write! {link}',
                    [
                        '{dir}' => $uploadPath,
                        '{link}' => CHtml::link(
                            Yii::t('CategoryModule.category', 'Change settings'),
                            [
                                '/yupe/backend/modulesettings/',
                                'module' => 'category',
                            ]
                        ),
                    ]
                ),
            ];
        }

        return isset($messages[WebModule::CHECK_ERROR]) ? $messages : true;
    }

    /**
     * @return bool
     */
    public function getInstall()
    {
        if (parent::getInstall()) {
            @mkdir(Yii::app()->uploadManager->getBasePath().DIRECTORY_SEPARATOR.$this->uploadPath, 0755);
        }

        return false;
    }

    /**
     * @return array
     */
    public function getEditableParams()
    {
        return [
            'uploadPath',
        ];
    }

    /**
     * @return array
     */
    public function getParamsLabels()
    {
        return [
            'uploadPath' => Yii::t(
                'CategoryModule.category',
                'File uploading catalog (uploads)'
            ),
        ];
    }

    /**
     * @return bool
     */
    public function getIsInstallDefault()
    {
        return true;
    }

    /**
     * @return string
     */
    public function getVersion()
    {
        return self::VERSION;
    }

    /**
     * @return string
     */
    public function getCategory()
    {
        return Yii::t('CategoryModule.category', 'Structure');
    }

    /**
     * @return string
     */
    public function getName()
    {
        return Yii::t('CategoryModule.category', 'Categories');
    }

    /**
     * @return string
     */
    public function getDescription()
    {
        return Yii::t('CategoryModule.category', 'Module for categories/sections management');
    }

    /**
     * @return string
     */
    public function getAuthor()
    {
        return Yii::t('CategoryModule.category', 'yupe team');
    }

    /**
     * @return string
     */
    public function getAuthorEmail()
    {
        return Yii::t('CategoryModule.category', 'team@yupe.ru');
    }

    /**
     * @return string
     */
    public function getUrl()
    {
        return Yii::t('CategoryModule.category', 'http://yupe.ru');
    }

    /**
     * @return string
     */
    public function getIcon()
    {
        return 'fa fa-fw fa-folder-open';
    }

    /**
     * @return bool
     */
    public function isMultiLang()
    {
        return true;
    }

    /**
     *
     */
    public function init()
    {
        parent::init();

        $this->setImport(
            [
                'category.models.*',
                'category.components.*',
            ]
        );
    }

    /**
     * @return array
     */
    public function getNavigation()
    {
        return [
            [
                'icon' => 'fa fa-fw fa-list-alt',
                'label' => Yii::t('CategoryModule.category', 'Categories list'),
                'url' => ['/category/categoryBackend/index'],
            ],
            [
                'icon' => 'fa fa-fw fa-plus-square',
                'label' => Yii::t('CategoryModule.category', 'Create category'),
                'url' => ['/category/categoryBackend/create'],
            ],
        ];
    }

    /**
     * @return string
     */
    public function getAdminPageLink()
    {
        return '/category/categoryBackend/index';
    }

    /**
     * @return array
     */
    public function getAuthItems()
    {
        return [
            [
                'name' => 'Category.CategoryManager',
                'description' => Yii::t('CategoryModule.category', 'Manage categories'),
                'type' => AuthItem::TYPE_TASK,
                'items' => [
                    [
                        'type' => AuthItem::TYPE_OPERATION,
                        'name' => 'Category.CategoryBackend.Create',
                        'description' => Yii::t('CategoryModule.category', 'Creating category'),
                    ],
                    [
                        'type' => AuthItem::TYPE_OPERATION,
                        'name' => 'Category.CategoryBackend.Delete',
                        'description' => Yii::t('CategoryModule.category', 'Removing category'),
                    ],
                    [
                        'type' => AuthItem::TYPE_OPERATION,
                        'name' => 'Category.CategoryBackend.Index',
                        'description' => Yii::t('CategoryModule.category', 'List of categories'),
                    ],
                    [
                        'type' => AuthItem::TYPE_OPERATION,
                        'name' => 'Category.CategoryBackend.Update',
                        'description' => Yii::t('CategoryModule.category', 'Editing categories'),
                    ],
                    [
                        'type' => AuthItem::TYPE_OPERATION,
                        'name' => 'Category.CategoryBackend.View',
                        'description' => Yii::t('CategoryModule.category', 'Viewing categories'),
                    ],
                ],
            ],
        ];
    }
}


text:
controller_ip=192.168.1.5
#Node ID: When OpenDayLight controller starts, this is the switch ID known
#to the controller. Check "printNodes" at the OSGI interface
openflow_node=openflow:123638411226060

#clear all groups
curl -v -H "Content-Type: application/xml"\
     -H "Accept: application/xml"\
     -H "Authorization: Basic YWRtaW46YWRtaW4="\
	 -X DELETE \
     --data "@$(pwd)/../../deleteAllGroup.xml" \
     http://$controller_ip:8181/restconf/config/opendaylight-inventory:nodes/node/$openflow_node/group/4294967292

#PUT L2 Interface Group, ouput port1, vlan2, pop
curl -v -H "Content-Type: application/xml"\
     -H "Accept: application/xml"\
     -H "Authorization: Basic YWRtaW46YWRtaW4="\
	 -X PUT \
     --data "@l2-interface-group.xml" \
     http://$controller_ip:8181/restconf/config/opendaylight-inventory:nodes/node/$openflow_node/group/131073


text:
package api

import (
	"github.com/aws/amazon-ecs-agent/agent/ecs_client/model/ecs"
	"github.com/aws/amazon-ecs-agent/agent/logger"
)

var log = logger.ForModule("api client")

// ECSClient is an interface over the ECSSDK interface which abstracts away some
// details around constructing the request and reading the response down to the
// parts the agent cares about.
// For example, the ever-present 'Cluster' member is abstracted out so that it
// may be configured once and used throughout transparently.
type ECSClient interface {
	// RegisterContainerInstance calculates the appropriate resources, creates
	// the default cluster if necessary, and returns the registered
	// ContainerInstanceARN if successful. Supplying a non-empty container
	// instance ARN allows a container instance to update its registered
	// resources.
	RegisterContainerInstance(existingContainerInstanceArn string, attributes []string) (string, error)
	// SubmitTaskStateChange sends a state change and returns an error
	// indicating if it was submitted
	SubmitTaskStateChange(change TaskStateChange) error
	// SubmitContainerStateChange sends a state change and returns an error
	// indicating if it was submitted
	SubmitContainerStateChange(change ContainerStateChange) error
	// DiscoverPollEndpoint takes a ContainerInstanceARN and returns the
	// endpoint at which this Agent should contact ACS
	DiscoverPollEndpoint(containerInstanceArn string) (string, error)
	// DiscoverTelemetryEndpoint takes a ContainerInstanceARN and returns the
	// endpoint at which this Agent should contact Telemetry Service
	DiscoverTelemetryEndpoint(containerInstanceArn string) (string, error)
}

// ECSSDK is an interface that specifies the subset of the AWS Go SDK's ECS
// client that the Agent uses.  This interface is meant to allow injecting a
// mock for testing.
type ECSSDK interface {
	CreateCluster(*ecs.CreateClusterInput) (*ecs.CreateClusterOutput, error)
	RegisterContainerInstance(*ecs.RegisterContainerInstanceInput) (*ecs.RegisterContainerInstanceOutput, error)
	DiscoverPollEndpoint(*ecs.DiscoverPollEndpointInput) (*ecs.DiscoverPollEndpointOutput, error)
}

type ECSSubmitStateSDK interface {
	SubmitContainerStateChange(*ecs.SubmitContainerStateChangeInput) (*ecs.SubmitContainerStateChangeOutput, error)
	SubmitTaskStateChange(*ecs.SubmitTaskStateChangeInput) (*ecs.SubmitTaskStateChangeOutput, error)
}


text:
using System;
using NUnit.Framework;
using OpenQA.Selenium.Environment;

namespace OpenQA.Selenium
{
    [TestFixture]
    public class FrameSwitchingTest : DriverTestFixture
    {
        // ----------------------------------------------------------------------------------------------
        //
        // Tests that WebDriver doesn't do anything fishy when it navigates to a page with frames.
        //
        // ----------------------------------------------------------------------------------------------

        [Test]
        public void ShouldAlwaysFocusOnTheTopMostFrameAfterANavigationEvent()
        {
            driver.Url = framesetPage;
            IWebElement element = driver.FindElement(By.TagName("frameset"));
            Assert.That(element, Is.Not.Null);
        }

        [Test]
        public void ShouldNotAutomaticallySwitchFocusToAnIFrameWhenAPageContainingThemIsLoaded()
        {
            driver.Url = iframePage;
            driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(1);
            IWebElement element = driver.FindElement(By.Id("iframe_page_heading"));
            driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(0);
            Assert.That(element, Is.Not.Null);
        }

        [Test]
        public void ShouldOpenPageWithBrokenFrameset()
        {
            driver.Url = EnvironmentManager.Instance.UrlBuilder.WhereIs("framesetPage3.html");

            IWebElement frame1 = driver.FindElement(By.Id("first"));
            driver.SwitchTo().Frame(frame1);

            driver.SwitchTo().DefaultContent();

            IWebElement frame2 = driver.FindElement(By.Id("second"));

            try
            {
                driver.SwitchTo().Frame(frame2);
            }
            catch (WebDriverException)
            {
                // IE9 can not switch to this broken frame - it has no window.
            }
        }

        // ----------------------------------------------------------------------------------------------
        //
        // Tests that WebDriver can switch to frames as expected.
        //
        // ----------------------------------------------------------------------------------------------

        [Test]
        public void ShouldBeAbleToSwitchToAFrameByItsIndex()
        {
            driver.Url = framesetPage;
            driver.SwitchTo().Frame(1);

            Assert.AreEqual("2", driver.FindElement(By.Id("pageNumber")).Text);
        }

        [Test]
        public void ShouldBeAbleToSwitchToAnIframeByItsIndex()
        {
            driver.Url = iframePage;
            driver.SwitchTo().Frame(0);

            Assert.AreEqual("name", driver.FindElement(By.Name("id-name1")).GetAttribute("value"));
        }

        [Test]
        public void ShouldBeAbleToSwitchToAFrameByItsName()
        {
            driver.Url = framesetPage;
            driver.SwitchTo().Frame("fourth");
            Assert.AreEqual("child1", driver.FindElement(By.TagName("frame")).GetAttribute("name"));

        }

        [Test]
        public void ShouldBeAbleToSwitchToAnIframeByItsName()
        {
            driver.Url = iframePage;
            driver.SwitchTo().Frame("iframe1-name");
            Assert.AreEqual("name", driver.FindElement(By.Name("id-name1")).GetAttribute("value"));

        }

        [Test]
        public void ShouldBeAbleToSwitchToAFrameByItsID()
        {
            driver.Url = framesetPage;
            driver.SwitchTo().Frame("fifth");
            Assert.AreEqual("Open new window", driver.FindElement(By.Name("windowOne")).Text);

        }

        [Test]
        public void ShouldBeAbleToSwitchToAnIframeByItsID()
        {
            driver.Url = iframePage;
            driver.SwitchTo().Frame("iframe1");
            Assert.AreEqual("name", driver.FindElement(By.Name("id-name1")).GetAttribute("value"));
        }

        [Test]
        public void ShouldBeAbleToSwitchToFrameWithNameContainingDot()
        {
            driver.Url = framesetPage;
            driver.SwitchTo().Frame("sixth.iframe1");
            Assert.That(driver.FindElement(By.TagName("body")).Text, Does.Contain("Page number 3"));
        }

        [Test]
        public void ShouldBeAbleToSwitchToAFrameUsingAPreviouslyLocatedWebElement()
        {
            driver.Url = framesetPage;
            IWebElement frame = driver.FindElement(By.TagName("frame"));
            driver.SwitchTo().Frame(frame);
            Assert.AreEqual("1", driver.FindElement(By.Id("pageNumber")).Text);
        }

        [Test]
        public void ShouldBeAbleToSwitchToAnIFrameUsingAPreviouslyLocatedWebElement()
        {
            driver.Url = iframePage;
            IWebElement frame = driver.FindElement(By.TagName("iframe"));
            driver.SwitchTo().Frame(frame);
            Assert.AreEqual("name", driver.FindElement(By.Name("id-name1")).GetAttribute("value"));

        }

        [Test]
        public void ShouldEnsureElementIsAFrameBeforeSwitching()
        {
            driver.Url = framesetPage;
            IWebElement frame = driver.FindElement(By.TagName("frameset"));
            Assert.That(() => driver.SwitchTo().Frame(frame), Throws.InstanceOf<NoSuchFrameException>());
        }

        [Test]
        public void FrameSearchesShouldBeRelativeToTheCurrentlySelectedFrame()
        {
            driver.Url = framesetPage;

            IWebElement frameElement = WaitFor(() => driver.FindElement(By.Name("second")), "did not find frame");
            driver.SwitchTo().Frame(frameElement);
            Assert.AreEqual("2", driver.FindElement(By.Id("pageNumber")).Text);

            try
            {
                driver.SwitchTo().Frame("third");
                Assert.Fail();
            }
            catch (NoSuchFrameException)
            {
                // Do nothing
            }

            driver.SwitchTo().DefaultContent();
            driver.SwitchTo().Frame("third");

            try
            {
                driver.SwitchTo().Frame("second");
                Assert.Fail();
            }
            catch (NoSuchFrameException)
            {
                // Do nothing
            }

            driver.SwitchTo().DefaultContent();
            driver.SwitchTo().Frame("second");
            Assert.AreEqual("2", driver.FindElement(By.Id("pageNumber")).Text);
        }

        [Test]
        public void ShouldSelectChildFramesByChainedCalls()
        {
            driver.Url = framesetPage;
            driver.SwitchTo().Frame("fourth").SwitchTo().Frame("child2");
            Assert.AreEqual("11", driver.FindElement(By.Id("pageNumber")).Text);
        }

        [Test]
        public void ShouldThrowFrameNotFoundExceptionLookingUpSubFramesWithSuperFrameNames()
        {
            driver.Url = framesetPage;
            driver.SwitchTo().Frame("fourth");
            Assert.That(() => driver.SwitchTo().Frame("second"), Throws.InstanceOf<NoSuchFrameException>());

        }

        [Test]
        public void ShouldThrowAnExceptionWhenAFrameCannotBeFound()
        {
            driver.Url = xhtmlTestPage;
            Assert.That(() => driver.SwitchTo().Frame("Nothing here"), Throws.InstanceOf<NoSuchFrameException>());
        }

        [Test]
        public void ShouldThrowAnExceptionWhenAFrameCannotBeFoundByIndex()
        {
            driver.Url = xhtmlTestPage;
            Assert.That(() => driver.SwitchTo().Frame(27), Throws.InstanceOf<NoSuchFrameException>());
        }

        [Test]
        [IgnoreBrowser(Browser.Opera, "Browser does not support parent frame navigation")]
        public void ShouldBeAbleToSwitchToParentFrame()
        {
            driver.Url = framesetPage;
            driver.SwitchTo().Frame("fourth").SwitchTo().ParentFrame().SwitchTo().Frame("first");
            Assert.AreEqual("1", driver.FindElement(By.Id("pageNumber")).Text);
        }

        [Test]
        [IgnoreBrowser(Browser.Opera, "Browser does not support parent frame navigation")]
        public void ShouldBeAbleToSwitchToParentFrameFromASecondLevelFrame()
        {
            driver.Url = framesetPage;

            driver.SwitchTo().Frame("fourth").SwitchTo().Frame("child1").SwitchTo().ParentFrame().SwitchTo().Frame("child2");
            Assert.AreEqual("11", driver.FindElement(By.Id("pageNumber")).Text);
        }

        [Test]
        [IgnoreBrowser(Browser.Opera, "Browser does not support parent frame navigation")]
        public void SwitchingToParentFrameFromDefaultContextIsNoOp()
        {
            driver.Url = xhtmlTestPage;
            driver.SwitchTo().ParentFrame();
            Assert.AreEqual("XHTML Test Page", driver.Title);
        }

        [Test]
        [IgnoreBrowser(Browser.Opera, "Browser does not support parent frame navigation")]
        public void ShouldBeAbleToSwitchToParentFromAnIframe()
        {
            driver.Url = iframePage;
            driver.SwitchTo().Frame(0);

            driver.SwitchTo().ParentFrame();
            driver.FindElement(By.Id("iframe_page_heading"));
        }

        // ----------------------------------------------------------------------------------------------
        //
        // General frame handling behavior tests
        //
        // ----------------------------------------------------------------------------------------------
        [Test]
        public void ShouldContinueToReferToTheSameFrameOnceItHasBeenSelected()
        {
            driver.Url = framesetPage;

            driver.SwitchTo().Frame(2);
            IWebElement checkbox = driver.FindElement(By.XPath("//input[@name='checky']"));
            checkbox.Click();
            checkbox.Submit();
            IWebElement result = WaitFor<IWebElement>(() => driver.FindElement(By.XPath("//p")), "result element not found");
            Assert.AreEqual("Success!", result.Text);
        }

        [Test]
        [IgnoreBrowser(Browser.Firefox, "Marionette throws 'Cannot access dead object' in subsequent tests when frame is deleted")]
        public void ShouldFocusOnTheReplacementWhenAFrameFollowsALinkToA_TopTargettedPage()
        {
            driver.Url = framesetPage;

            driver.SwitchTo().Frame(0);
            driver.FindElement(By.LinkText("top")).Click();

            // TODO(simon): Avoid going too fast when native events are there.
            System.Threading.Thread.Sleep(1000);
            Assert.AreEqual("XHTML Test Page", driver.Title);
        }

        [Test]
        public void ShouldAllowAUserToSwitchFromAnIframeBackToTheMainContentOfThePage()
        {
            driver.Url = iframePage;
            driver.SwitchTo().Frame(0);

            driver.SwitchTo().DefaultContent();
            driver.FindElement(By.Id("iframe_page_heading"));
        }

        [Test]
        public void ShouldAllowTheUserToSwitchToAnIFrameAndRemainFocusedOnIt()
        {
            driver.Url = iframePage;
            driver.SwitchTo().Frame(0);

            driver.FindElement(By.Id("submitButton")).Click();

            string hello = GetTextOfGreetingElement();
            Assert.AreEqual(hello, "Success!");
        }

        [Test]
        public void ShouldBeAbleToClickInAFrame()
        {
            driver.Url = framesetPage;
            driver.SwitchTo().Frame("third");

            // This should replace frame "third" ...
            driver.FindElement(By.Id("submitButton")).Click();

            // driver should still be focused on frame "third" ...
            Assert.AreEqual("Success!", GetTextOfGreetingElement());

            // Make sure it was really frame "third" which was replaced ...
            driver.SwitchTo().DefaultContent().SwitchTo().Frame("third");
            Assert.AreEqual("Success!", GetTextOfGreetingElement());
        }

        [Test]
        public void ShouldBeAbleToClickInAFrameThatRewritesTopWindowLocation()
        {
            driver.Url = EnvironmentManager.Instance.UrlBuilder.WhereIs("click_tests/issue5237.html");
            driver.SwitchTo().Frame("search");
            driver.FindElement(By.Id("submit")).Click();
            driver.SwitchTo().DefaultContent();
            WaitFor(() => { return driver.Title == "Target page for issue 5237"; }, "Browser title was not 'Target page for issue 5237'");
        }

        [Test]
        public void ShouldBeAbleToClickInASubFrame()
        {
            driver.Url = framesetPage;
            driver.SwitchTo().Frame("sixth").SwitchTo().Frame("iframe1");

            // This should replaxe frame "iframe1" inside frame "sixth" ...
            driver.FindElement(By.Id("submitButton")).Click();

            // driver should still be focused on frame "iframe1" inside frame "sixth" ...
            Assert.AreEqual("Success!", GetTextOfGreetingElement());

            // Make sure it was really frame "iframe1" inside frame "sixth" which was replaced ...
            driver.SwitchTo().DefaultContent().SwitchTo().Frame("sixth").SwitchTo().Frame("iframe1");
            Assert.AreEqual("Success!", driver.FindElement(By.Id("greeting")).Text);
        }

        [Test]
        public void ShouldBeAbleToFindElementsInIframesByXPath()
        {
            driver.Url = iframePage;

            driver.SwitchTo().Frame("iframe1");

            IWebElement element = driver.FindElement(By.XPath("//*[@id = 'changeme']"));

            Assert.That(element, Is.Not.Null);
        }

        [Test]
        public void GetCurrentUrlShouldReturnTopLevelBrowsingContextUrl()
        {
            driver.Url = framesetPage;
            Assert.AreEqual(framesetPage, driver.Url);

            driver.SwitchTo().Frame("second");
            Assert.AreEqual(framesetPage, driver.Url);
        }

        [Test]
        public void GetCurrentUrlShouldReturnTopLevelBrowsingContextUrlForIframes()
        {
            driver.Url = iframePage;
            Assert.AreEqual(iframePage, driver.Url);

            driver.SwitchTo().Frame("iframe1");
            Assert.AreEqual(iframePage, driver.Url);
        }

        [Test]
        public void ShouldBeAbleToSwitchToTheTopIfTheFrameIsDeletedFromUnderUs()
        {
            driver.Url = deletingFrame;
            driver.SwitchTo().Frame("iframe1");

            IWebElement killIframe = driver.FindElement(By.Id("killIframe"));
            killIframe.Click();
            driver.SwitchTo().DefaultContent();

            AssertFrameNotPresent("iframe1");

            IWebElement addIFrame = driver.FindElement(By.Id("addBackFrame"));
            addIFrame.Click();

            WaitFor(() => driver.FindElement(By.Id("iframe1")), "Did not find frame element");

            driver.SwitchTo().Frame("iframe1");
            WaitFor(() => driver.FindElement(By.Id("success")), "Did not find element in frame");
        }

        [Test]
        public void ShouldBeAbleToSwitchToTheTopIfTheFrameIsDeletedFromUnderUsWithFrameIndex()
        {
            driver.Url = deletingFrame;
            int iframe = 0;
            WaitFor(() => FrameExistsAndSwitchedTo(iframe), "Did not switch to frame");

            // we should be in the frame now
            IWebElement killIframe = driver.FindElement(By.Id("killIframe"));
            killIframe.Click();
            driver.SwitchTo().DefaultContent();

            IWebElement addIFrame = driver.FindElement(By.Id("addBackFrame"));
            addIFrame.Click();
            WaitFor(() => FrameExistsAndSwitchedTo(iframe), "Did not switch to frame");

            WaitFor(() => driver.FindElement(By.Id("success")), "Did not find element in frame");
        }

        [Test]
        public void ShouldBeAbleToSwitchToTheTopIfTheFrameIsDeletedFromUnderUsWithWebelement()
        {
            driver.Url = deletingFrame;
            IWebElement iframe = driver.FindElement(By.Id("iframe1"));
            WaitFor(() => FrameExistsAndSwitchedTo(iframe), "Did not switch to frame");

            // we should be in the frame now
            IWebElement killIframe = driver.FindElement(By.Id("killIframe"));
            killIframe.Click();
            driver.SwitchTo().DefaultContent();

            IWebElement addIFrame = driver.FindElement(By.Id("addBackFrame"));
            addIFrame.Click();

            iframe = driver.FindElement(By.Id("iframe1"));
            WaitFor(() => FrameExistsAndSwitchedTo(iframe), "Did not switch to frame");
            WaitFor(() => driver.FindElement(By.Id("success")), "Did not find element in frame");
        }

        [Test]
        [IgnoreBrowser(Browser.Chrome, "Chrome driver throws NoSuchElementException, spec is unclear")]
        [IgnoreBrowser(Browser.Edge, "Edge driver throws NoSuchElementException, spec is unclear")]
        [IgnoreBrowser(Browser.Firefox, "Marionette throws 'Cannot access dead object' in subsequent tests when frame is deleted")]
        [IgnoreBrowser(Browser.IE, "IE driver throws NoSuchElementException, spec is unclear")]
        public void ShouldNotBeAbleToDoAnythingTheFrameIsDeletedFromUnderUs()
        {
            driver.Url = deletingFrame;
            driver.SwitchTo().Frame("iframe1");

            IWebElement killIframe = driver.FindElement(By.Id("killIframe"));
            killIframe.Click();

            Assert.That(() => driver.FindElement(By.Id("killIframe")), Throws.InstanceOf<NoSuchFrameException>());
        }

        [Test]
        public void ShouldReturnWindowTitleInAFrameset()
        {
            driver.Url = framesetPage;
            driver.SwitchTo().Frame("third");
            Assert.AreEqual("Unique title", driver.Title);
        }

        [Test]
        public void JavaScriptShouldExecuteInTheContextOfTheCurrentFrame()
        {
            IJavaScriptExecutor executor = driver as IJavaScriptExecutor;

            driver.Url = framesetPage;
            Assert.That((bool)executor.ExecuteScript("return window == window.top"), Is.True);

            driver.SwitchTo().Frame("third");
            Assert.That((bool)executor.ExecuteScript("return window != window.top"), Is.True);
        }

        [Test]
        public void ShouldNotSwitchMagicallyToTheTopWindow()
        {
            string baseUrl = EnvironmentManager.Instance.UrlBuilder.WhereIs("frame_switching_tests/");
            driver.Url = baseUrl + "bug4876.html";
            driver.SwitchTo().Frame(0);
            WaitFor(() => driver.FindElement(By.Id("inputText")), "Could not find element");

            for (int i = 0; i < 20; i++)
            {
                try
                {
                    IWebElement input = WaitFor(() => driver.FindElement(By.Id("inputText")), "Did not find element");
                    IWebElement submit = WaitFor(() => driver.FindElement(By.Id("submitButton")), "Did not find input element");
                    input.Clear();
                    input.SendKeys("rand" + new Random().Next());
                    submit.Click();
                }
                finally
                {
                    System.Threading.Thread.Sleep(100);
                    string url = (string)((IJavaScriptExecutor)driver).ExecuteScript("return window.location.href");
                    // IE6 and Chrome add "?"-symbol to the end of the URL
                    if (url.EndsWith("?"))
                    {
                        url = url.Substring(0, url.Length - 1);
                    }
                    Assert.AreEqual(baseUrl + "bug4876_iframe.html", url);
                }
            }
        }

        [Test]
        [NeedsFreshDriver(IsCreatedAfterTest = true)]
        public void GetShouldSwitchToDefaultContext()
        {
            driver.Url = iframePage;
            driver.SwitchTo().Frame(driver.FindElement(By.Id("iframe1")));
            driver.FindElement(By.Id("cheese")); // Found on formPage.html but not on iframes.html.

            driver.Url = iframePage; // This must effectively switchTo().defaultContent(), too.
            driver.FindElement(By.Id("iframe1"));
        }

        // ----------------------------------------------------------------------------------------------
        //
        // Frame handling behavior tests not included in Java tests
        //
        // ----------------------------------------------------------------------------------------------

        [Test]
        public void ShouldBeAbleToFlipToAFrameIdentifiedByItsId()
        {
            driver.Url = framesetPage;

            driver.SwitchTo().Frame("fifth");
            driver.FindElement(By.Id("username"));
        }

        [Test]
        public void ShouldBeAbleToSelectAFrameByName()
        {
            driver.Url = framesetPage;

            driver.SwitchTo().Frame("second");
            Assert.AreEqual(driver.FindElement(By.Id("pageNumber")).Text, "2");

            driver.SwitchTo().DefaultContent().SwitchTo().Frame("third");
            driver.FindElement(By.Id("changeme")).Click();

            driver.SwitchTo().DefaultContent().SwitchTo().Frame("second");
            Assert.AreEqual(driver.FindElement(By.Id("pageNumber")).Text, "2");
        }

        [Test]
        public void ShouldBeAbleToFindElementsInIframesByName()
        {
            driver.Url = iframePage;

            driver.SwitchTo().Frame("iframe1");
            IWebElement element = driver.FindElement(By.Name("id-name1"));

            Assert.That(element, Is.Not.Null);
        }

        private string GetTextOfGreetingElement()
        {
            string text = string.Empty;
            DateTime end = DateTime.Now.Add(TimeSpan.FromMilliseconds(3000));
            while (DateTime.Now < end)
            {
                try
                {
                    IWebElement element = driver.FindElement(By.Id("greeting"));
                    text = element.Text;
                    break;
                }
                catch (NoSuchElementException)
                {
                }
            }

            return text;
        }

        private void AssertFrameNotPresent(string locator)
        {
            driver.SwitchTo().DefaultContent();
            WaitFor(() => !FrameExistsAndSwitchedTo(locator), "Frame still present after timeout");
            driver.SwitchTo().DefaultContent();
        }

        private bool FrameExistsAndSwitchedTo(string locator)
        {
            try
            {
                driver.SwitchTo().Frame(locator);
                return true;
            }
            catch (NoSuchFrameException)
            {
            }

            return false;
        }

        private bool FrameExistsAndSwitchedTo(int index)
        {
            try
            {
                driver.SwitchTo().Frame(index);
                return true;
            }
            catch (NoSuchFrameException)
            {
            }

            return false;
        }

        private bool FrameExistsAndSwitchedTo(IWebElement frameElement)
        {
            try
            {
                driver.SwitchTo().Frame(frameElement);
                return true;
            }
            catch (NoSuchFrameException)
            {
            }

            return false;
        }
    }
}


text:
namespace SomeOrderThing.Messages
{
    using System;

    public interface IMessage
    {
        Guid MessageId { get; }

        Guid CorrelationId { get; }

        Guid CausationId { get; }
    }
}


text:
<!-- Generated by Rakefile:build -->
 - [checkdate](/functions/checkdate)
 - [date](/functions/date)
 - [date_default_timezone_get](/functions/date_default_timezone_get)
 - [date_default_timezone_set](/functions/date_default_timezone_set)
 - [date_parse](/functions/date_parse)
 - [getdate](/functions/getdate)
 - [gettimeofday](/functions/gettimeofday)
 - [gmdate](/functions/gmdate)
 - [gmmktime](/functions/gmmktime)
 - [gmstrftime](/functions/gmstrftime)
 - [idate](/functions/idate)
 - [localtime](/functions/localtime)
 - [microtime](/functions/microtime)
 - [mktime](/functions/mktime)
 - [strftime](/functions/strftime)
 - [strptime](/functions/strptime)
 - [strtotime](/functions/strtotime)
 - [time](/functions/time)
 - [timezone_abbreviations_list](/functions/timezone_abbreviations_list)
 - [timezone_identifiers_list](/functions/timezone_identifiers_list)


text:
package util

import (
	"fmt"
	"sort"
	"strconv"
	"strings"

	"k8s.io/kubernetes/pkg/api"
	"k8s.io/kubernetes/pkg/labels"
	"k8s.io/kubernetes/pkg/runtime"

	deployapi "github.com/openshift/origin/pkg/deploy/api"
	"github.com/openshift/origin/pkg/util/namer"
)

// LatestDeploymentNameForConfig returns a stable identifier for config based on its version.
func LatestDeploymentNameForConfig(config *deployapi.DeploymentConfig) string {
	return fmt.Sprintf("%s-%d", config.Name, config.Status.LatestVersion)
}

// LatestDeploymentInfo returns info about the latest deployment for a config,
// or nil if there is no latest deployment. The latest deployment is not
// always the same as the active deployment.
func LatestDeploymentInfo(config *deployapi.DeploymentConfig, deployments []api.ReplicationController) (bool, *api.ReplicationController) {
	if config.Status.LatestVersion == 0 || len(deployments) == 0 {
		return false, nil
	}
	sort.Sort(ByLatestVersionDesc(deployments))
	candidate := &deployments[0]
	return DeploymentVersionFor(candidate) == config.Status.LatestVersion, candidate
}

// ActiveDeployment returns the latest complete deployment, or nil if there is
// no such deployment. The active deployment is not always the same as the
// latest deployment.
func ActiveDeployment(config *deployapi.DeploymentConfig, deployments []api.ReplicationController) *api.ReplicationController {
	sort.Sort(ByLatestVersionDesc(deployments))
	var activeDeployment *api.ReplicationController
	for _, deployment := range deployments {
		if DeploymentStatusFor(&deployment) == deployapi.DeploymentStatusComplete {
			activeDeployment = &deployment
			break
		}
	}
	return activeDeployment
}

// DeployerPodSuffix is the suffix added to pods created from a deployment
const DeployerPodSuffix = "deploy"

// DeployerPodNameForDeployment returns the name of a pod for a given deployment
func DeployerPodNameForDeployment(deployment string) string {
	return namer.GetPodName(deployment, DeployerPodSuffix)
}

// LabelForDeployment builds a string identifier for a Deployment.
func LabelForDeployment(deployment *api.ReplicationController) string {
	return fmt.Sprintf("%s/%s", deployment.Namespace, deployment.Name)
}

// LabelForDeploymentConfig builds a string identifier for a DeploymentConfig.
func LabelForDeploymentConfig(config *deployapi.DeploymentConfig) string {
	return fmt.Sprintf("%s/%s", config.Namespace, config.Name)
}

// DeploymentNameForConfigVersion returns the name of the version-th deployment
// for the config that has the provided name
func DeploymentNameForConfigVersion(name string, version int64) string {
	return fmt.Sprintf("%s-%d", name, version)
}

// ConfigSelector returns a label Selector which can be used to find all
// deployments for a DeploymentConfig.
//
// TODO: Using the annotation constant for now since the value is correct
// but we could consider adding a new constant to the public types.
func ConfigSelector(name string) labels.Selector {
	return labels.Set{deployapi.DeploymentConfigAnnotation: name}.AsSelector()
}

// DeployerPodSelector returns a label Selector which can be used to find all
// deployer pods associated with a deployment with name.
func DeployerPodSelector(name string) labels.Selector {
	return labels.Set{deployapi.DeployerPodForDeploymentLabel: name}.AsSelector()
}

// AnyDeployerPodSelector returns a label Selector which can be used to find
// all deployer pods across all deployments, including hook and custom
// deployer pods.
func AnyDeployerPodSelector() labels.Selector {
	sel, _ := labels.Parse(deployapi.DeployerPodForDeploymentLabel)
	return sel
}

// HasChangeTrigger returns whether the provided deployment configuration has
// a config change trigger or not
func HasChangeTrigger(config *deployapi.DeploymentConfig) bool {
	for _, trigger := range config.Spec.Triggers {
		if trigger.Type == deployapi.DeploymentTriggerOnConfigChange {
			return true
		}
	}
	return false
}

// DecodeDeploymentConfig decodes a DeploymentConfig from controller using codec. An error is returned
// if the controller doesn't contain an encoded config.
func DecodeDeploymentConfig(controller *api.ReplicationController, decoder runtime.Decoder) (*deployapi.DeploymentConfig, error) {
	encodedConfig := []byte(EncodedDeploymentConfigFor(controller))
	decoded, err := runtime.Decode(decoder, encodedConfig)
	if err == nil {
		if config, ok := decoded.(*deployapi.DeploymentConfig); ok {
			return config, nil
		}
		return nil, fmt.Errorf("decoded object from controller is not a DeploymentConfig")
	}
	return nil, fmt.Errorf("failed to decode DeploymentConfig from controller: %v", err)
}

// EncodeDeploymentConfig encodes config as a string using codec.
func EncodeDeploymentConfig(config *deployapi.DeploymentConfig, codec runtime.Codec) (string, error) {
	if bytes, err := runtime.Encode(codec, config); err == nil {
		return string(bytes[:]), nil
	} else {
		return "", err
	}
}

// MakeDeployment creates a deployment represented as a ReplicationController and based on the given
// DeploymentConfig. The controller replica count will be zero.
func MakeDeployment(config *deployapi.DeploymentConfig, codec runtime.Codec) (*api.ReplicationController, error) {
	var err error
	var encodedConfig string

	if encodedConfig, err = EncodeDeploymentConfig(config, codec); err != nil {
		return nil, err
	}

	deploymentName := LatestDeploymentNameForConfig(config)

	podSpec := api.PodSpec{}
	if err := api.Scheme.Convert(&config.Spec.Template.Spec, &podSpec); err != nil {
		return nil, fmt.Errorf("couldn't clone podSpec: %v", err)
	}

	controllerLabels := make(labels.Set)
	for k, v := range config.Labels {
		controllerLabels[k] = v
	}
	// Correlate the deployment with the config.
	// TODO: Using the annotation constant for now since the value is correct
	// but we could consider adding a new constant to the public types.
	controllerLabels[deployapi.DeploymentConfigAnnotation] = config.Name

	// Ensure that pods created by this deployment controller can be safely associated back
	// to the controller, and that multiple deployment controllers for the same config don't
	// manipulate each others' pods.
	selector := map[string]string{}
	for k, v := range config.Spec.Selector {
		selector[k] = v
	}
	selector[deployapi.DeploymentConfigLabel] = config.Name
	selector[deployapi.DeploymentLabel] = deploymentName

	podLabels := make(labels.Set)
	for k, v := range config.Spec.Template.Labels {
		podLabels[k] = v
	}
	podLabels[deployapi.DeploymentConfigLabel] = config.Name
	podLabels[deployapi.DeploymentLabel] = deploymentName

	podAnnotations := make(labels.Set)
	for k, v := range config.Spec.Template.Annotations {
		podAnnotations[k] = v
	}
	podAnnotations[deployapi.DeploymentAnnotation] = deploymentName
	podAnnotations[deployapi.DeploymentConfigAnnotation] = config.Name
	podAnnotations[deployapi.DeploymentVersionAnnotation] = strconv.FormatInt(config.Status.LatestVersion, 10)

	deployment := &api.ReplicationController{
		ObjectMeta: api.ObjectMeta{
			Name: deploymentName,
			Annotations: map[string]string{
				deployapi.DeploymentConfigAnnotation:        config.Name,
				deployapi.DeploymentStatusAnnotation:        string(deployapi.DeploymentStatusNew),
				deployapi.DeploymentEncodedConfigAnnotation: encodedConfig,
				deployapi.DeploymentVersionAnnotation:       strconv.FormatInt(config.Status.LatestVersion, 10),
				// This is the target replica count for the new deployment.
				deployapi.DesiredReplicasAnnotation:    strconv.Itoa(int(config.Spec.Replicas)),
				deployapi.DeploymentReplicasAnnotation: strconv.Itoa(0),
			},
			Labels: controllerLabels,
		},
		Spec: api.ReplicationControllerSpec{
			// The deployment should be inactive initially
			Replicas: 0,
			Selector: selector,
			Template: &api.PodTemplateSpec{
				ObjectMeta: api.ObjectMeta{
					Labels:      podLabels,
					Annotations: podAnnotations,
				},
				Spec: podSpec,
			},
		},
	}
	if value, ok := config.Annotations[deployapi.DeploymentIgnorePodAnnotation]; ok {
		deployment.Annotations[deployapi.DeploymentIgnorePodAnnotation] = value
	}

	return deployment, nil
}

func DeploymentConfigNameFor(obj runtime.Object) string {
	return annotationFor(obj, deployapi.DeploymentConfigAnnotation)
}

func DeploymentNameFor(obj runtime.Object) string {
	return annotationFor(obj, deployapi.DeploymentAnnotation)
}

func DeployerPodNameFor(obj runtime.Object) string {
	return annotationFor(obj, deployapi.DeploymentPodAnnotation)
}

func DeploymentStatusFor(obj runtime.Object) deployapi.DeploymentStatus {
	return deployapi.DeploymentStatus(annotationFor(obj, deployapi.DeploymentStatusAnnotation))
}

func DeploymentStatusReasonFor(obj runtime.Object) string {
	return annotationFor(obj, deployapi.DeploymentStatusReasonAnnotation)
}

func DeploymentDesiredReplicas(obj runtime.Object) (int32, bool) {
	return int32AnnotationFor(obj, deployapi.DesiredReplicasAnnotation)
}

func DeploymentReplicas(obj runtime.Object) (int32, bool) {
	return int32AnnotationFor(obj, deployapi.DeploymentReplicasAnnotation)
}

func EncodedDeploymentConfigFor(obj runtime.Object) string {
	return annotationFor(obj, deployapi.DeploymentEncodedConfigAnnotation)
}

func DeploymentVersionFor(obj runtime.Object) int64 {
	v, err := strconv.ParseInt(annotationFor(obj, deployapi.DeploymentVersionAnnotation), 10, 64)
	if err != nil {
		return -1
	}
	return v
}

func IsDeploymentCancelled(deployment *api.ReplicationController) bool {
	value := annotationFor(deployment, deployapi.DeploymentCancelledAnnotation)
	return strings.EqualFold(value, deployapi.DeploymentCancelledAnnotationValue)
}

func Instantiate(dc *deployapi.DeploymentConfig) {
	if dc.Annotations == nil {
		dc.Annotations = make(map[string]string)
	}
	dc.Annotations[deployapi.DeploymentInstantiatedAnnotation] = deployapi.DeploymentInstantiatedAnnotationValue
}

func IsInstantiated(dc *deployapi.DeploymentConfig) bool {
	value := annotationFor(dc, deployapi.DeploymentInstantiatedAnnotation)
	return strings.EqualFold(value, deployapi.DeploymentInstantiatedAnnotationValue)
}

func HasSynced(dc *deployapi.DeploymentConfig) bool {
	return dc.Status.ObservedGeneration >= dc.Generation
}

// IsTerminatedDeployment returns true if the passed deployment has terminated (either
// complete or failed).
func IsTerminatedDeployment(deployment *api.ReplicationController) bool {
	current := DeploymentStatusFor(deployment)
	return current == deployapi.DeploymentStatusComplete || current == deployapi.DeploymentStatusFailed
}

// CanTransitionPhase returns whether it is allowed to go from the current to the next phase.
func CanTransitionPhase(current, next deployapi.DeploymentStatus) bool {
	switch current {
	case deployapi.DeploymentStatusNew:
		switch next {
		case deployapi.DeploymentStatusPending,
			deployapi.DeploymentStatusRunning,
			deployapi.DeploymentStatusFailed,
			deployapi.DeploymentStatusComplete:
			return true
		}
	case deployapi.DeploymentStatusPending:
		switch next {
		case deployapi.DeploymentStatusRunning,
			deployapi.DeploymentStatusFailed,
			deployapi.DeploymentStatusComplete:
			return true
		}
	case deployapi.DeploymentStatusRunning:
		switch next {
		case deployapi.DeploymentStatusFailed, deployapi.DeploymentStatusComplete:
			return true
		}
	}
	return false
}

// annotationFor returns the annotation with key for obj.
func annotationFor(obj runtime.Object, key string) string {
	meta, err := api.ObjectMetaFor(obj)
	if err != nil {
		return ""
	}
	return meta.Annotations[key]
}

func int32AnnotationFor(obj runtime.Object, key string) (int32, bool) {
	s := annotationFor(obj, key)
	if len(s) == 0 {
		return 0, false
	}
	i, err := strconv.ParseInt(s, 10, 32)
	if err != nil {
		return 0, false
	}
	return int32(i), true
}

// ByLatestVersionAsc sorts deployments by LatestVersion ascending.
type ByLatestVersionAsc []api.ReplicationController

func (d ByLatestVersionAsc) Len() int      { return len(d) }
func (d ByLatestVersionAsc) Swap(i, j int) { d[i], d[j] = d[j], d[i] }
func (d ByLatestVersionAsc) Less(i, j int) bool {
	return DeploymentVersionFor(&d[i]) < DeploymentVersionFor(&d[j])
}

// ByLatestVersionDesc sorts deployments by LatestVersion descending.
type ByLatestVersionDesc []api.ReplicationController

func (d ByLatestVersionDesc) Len() int      { return len(d) }
func (d ByLatestVersionDesc) Swap(i, j int) { d[i], d[j] = d[j], d[i] }
func (d ByLatestVersionDesc) Less(i, j int) bool {
	return DeploymentVersionFor(&d[j]) < DeploymentVersionFor(&d[i])
}

// ByMostRecent sorts deployments by most recently created.
type ByMostRecent []*api.ReplicationController

func (s ByMostRecent) Len() int      { return len(s) }
func (s ByMostRecent) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
func (s ByMostRecent) Less(i, j int) bool {
	return !s[i].CreationTimestamp.Before(s[j].CreationTimestamp)
}


text:
package eu.hyvar.feature.expression.resource.hyexpression;

/**
 * A TokenResolverFactory creates TokenResolvers. The concrete resolver to be
 * created is determined by the given token name (i.e., the type of the token).
 * One may consider TokenResolverFactories as a registry, which maps token types
 * to TokenResolvers.
 */
public interface IHyexpressionTokenResolverFactory {

	/**
	 * Creates a token resolver for normal tokens of type tokenName.
	 */
	public eu.hyvar.feature.expression.resource.hyexpression.IHyexpressionTokenResolver createTokenResolver(String tokenName);

	/**
	 * Creates a token resolver for COLLECT-IN tokens that are stored in feature
	 * featureName.
	 */
	public eu.hyvar.feature.expression.resource.hyexpression.IHyexpressionTokenResolver createCollectInTokenResolver(String featureName);

}


text:
from django.db import migrations

class Migration(migrations.Migration):

    dependencies = [
        ('flashcards', '0013_auto_20160826_0243'),
    ]

    operations = [
        migrations.DeleteModel(
            name='CardTemplate',
        ),
        migrations.DeleteModel(
            name='FactType',
        ),
        migrations.DeleteModel(
            name='FieldContent',
        ),
    ]


text:
211213  home :: cj==1  consistent w/ ci ...and lua arrays

This module defines a buffer object.

A buffer contains
  - a text, as a list of lines. Lines are UTF8-encoded.
  - a cursor that points to a location in the text.
	the cursor is implemented as 2 numbers: ci, cj
	ci is a line index (starting at 1)
	cj is an UTF8 character position in the line
		(not a byte offset)
  - a "mark" that points to the beginning or the end of the current
    selection. The selection is the text between the cursor and the mark.
  - operations to give access to the text, the cursor and the selection
  - support undoing operations performed on the text

]]

-- some local definitions (used by the module term and/or by the editor

local strf = string.format
local byte, char, rep = string.byte, string.char, string.rep

local utf8 = require("utf8")
local ulen = utf8.len
local uchar = utf8.char
local uoff = utf8.offset

local function lines(s)
	-- split s into a list of lines
	lt = {}
	s = s .. "\n"
	for l in string.gmatch(s, "(.-)\r?\n") do table.insert(lt, l) end
	return lt
end

------------------------------------------------------------------------
-- BUFFER AND CURSOR MANIPULATION
--
-- 		use these functions instead of direct buf.ll manipulation.
-- 		This will make it easier to change or enrich the
-- 		representation later. (eg. syntax coloring, undo/redo, ...)

buffer = {}; buffer.__index = buffer -- this is the buffer class

-- (note: 'b' is a buffer object in all functions below)

function buffer.new(ll)
	-- create and initialize a new buffer object
	-- ll is a list of lines (lines should not contain newline bytes)
	local b = {
	  ll=ll,	-- list of text lines
	  ci=1, cj=1,	-- text cursor (line ci, offset cj)
	  unsaved=false,-- true if content has changed since last save
	  chgd=true,	-- true if buffer has changed since last display
			--    (content, cursor or mark changes)
	  ual = {},	-- undo action list
	  ualtop = 0,	-- current top of the undo list
			--    (~= #ual !! see undo)
	-- XXX li, hs should move to a window object
	  li=1,		-- index in ll of the line at the top of the box
	  hs=0,		-- horizontal scroll (number of columns)

	}
	setmetatable(b, buffer)
	return b
end--new

-- various predicates and accessors

-- these functions assume that the TEXT IS VALID UTF8
-- (no invalid byte sequence)

-- test if cursor is at end / beginning of  line  (eol, bol)
function buffer.ateol(b) return b.cj > ulen(b.ll[b.ci]) end
function buffer.atbol(b) return b.cj <= 1 end
-- test if cursor is at  first or last line of text
function buffer.atfirst(b) return (b.ci <= 1) end
function buffer.atlast(b) return (b.ci >= #b.ll) end
-- test if cursor is at  end or beginning of  text (eot, bot)
function buffer.ateot(b) return b:atlast() and b:ateol() end
function buffer.atbot(b) return b:atfirst() and b:atbol() end

function buffer.beforecur(b, di, dj)
	-- return true if point (di, dj) is before the cursor
	-- in the text
	return ((di < b.ci) or (di == b.ci and dj < b.cj))
end

function buffer.markbeforecur(b)
	-- return true if the mark is defined and is before the
	-- cursor in the text
	return b.si and b:beforecur(b.si, b.sj)
end

function buffer.getcur(b) return b.ci, b.cj end -- get the cursor
function buffer.getsel(b) return b.si, b.sj end -- get the mark

function buffer.curcode(b)
	-- return code of utf8 char at cursor
	local s = b.ll[b.ci]
	if b:ateol() then return nil end
	return utf8.codepoint(s, uoff(s, b.cj))
end

function buffer.curch(b)
	-- return utf8 char at cursor
	local u = buffer.curcode(b)
	return u and uchar(u)
end

function buffer.eol(b)
	-- return coord of current end of line
	local ci = b.ci
	return ci, ulen(b.ll[ci])
end

function buffer.eot(b)
	-- return coord of buffer end of text
	local ci = #b.ll
	return ci, ulen(b.ll[ci])+1
end

function buffer.getline(b, i)
	-- return current line. if i is provided, return line i
	return b.ll[i or b.ci]
end

function buffer.getlines(b, di, dj)
	-- return the text between the cursor and point (di, dj) as
	-- a list of lines. this assumes that (di, dj) is after the cursor.
	local s
	local ci, cj = b:getcur()
	if di == ci then
		s = b.ll[ci]
		return { s:sub(uoff(s,cj), uoff(s,dj)-1) }
	end
	local sl = {}
	for i = ci, di do
		local l = b.ll[i]
		if i == ci then l = l:sub(uoff(l,cj)) end
		if i == di then l = l:sub(1, uoff(l,dj)-1) end
		table.insert(sl, l)
	end
	return sl
end--getlines

function buffer.gettext(b)
	return table.concat(b.ll, '\n')
end

--- cursor movement

-- MAX: used to indicate the last line or the end of line
buffer.MAX = math.maxinteger

--~ function buffer.setcurj(b, j) -- set cursor on the current line
--~ 	local ci = b:getcur()
--~ 	local ln = ulen(b.ll[ci])
--~ 	if not j or j > ln then j = ln end
--~ 	if j < 1 then j = 1 end
--~ 	b.cj = j
--~ 	return j
--~ end

function buffer.setcur(b, i, j)
	-- set cursor absolute
	-- if i or j are nil/false the corresponding cursor coordinate
	-- is not modified.
	-- if i or j are not positive or too large they are adjusted
	-- respectively to the first or last line, and to the bol/eol
	-- position.
	if i then
		if i > #b.ll then
			b.ci = #b.ll
		elseif i < 1 then
			b.ci = 1
		else
			b.ci = i
		end
	end
	if j then
		local eol = ulen(b.ll[b.ci]) + 1
		if j > eol then
			b.cj = eol
		elseif j < 1 then
			b.cj = 1
		else
			b.cj = j
		end
	end
	return true
end

function buffer.movecur(b, di, dj)
	-- move cursor relative to the current position
	-- di, dj can be positive or negative for upward/downward
	-- or forward/backward movement, or zero for no movement.
	return buffer.setcur(b, b.ci + di, b.cj + dj)
end

--- text modification at cursor

-- all modifications should be performed by the following functions:
--   bufins(strlist)
--	insert list of string at cursor. if strlist is a string, it is
--	equivalent to a list with only one element
--	if buffer contains one line "abc" and cursor is between b and c
--	(ie screen cursor is on 'c') then
--	bufins{"xx"}  changes the buffer line to "abxxc"
--	bufins{"xx", "yy"}  now the buffer has two lines: "abxx", "yyc"
--	bufins{"", ""}  inserts a newline:   "ab", "c"
--
--   bufdel(di, dj)
--	delete all characters between the cursor and point (di, dj)
--	(bufdel assumes that di, dj is after the cursor)
--	if the buffer is  ("abxx", "yyc") and the cursor is just after 'b',
--	bufdel(2,2) changes the buffer to ("abc")

local ualpush -- defined further down with all undo functions

function buffer.bufins(b, sl, no_undo)
	-- if no_undo is true, don't record the modification
	local slc = {} -- dont push directly sl. make a copy.
	if type(sl) == "string" then
		if not ulen(sl) then return nil, "invalid UTF8 sequence" end
		slc[1] = sl
	elseif #sl == 0 then
		return true -- insert an empty list: nothing to do
	else
		for i = 1, #sl do
			if not ulen(sl[i]) then return nil, "invalid UTF8 sequence" end
			slc[i] = sl[i]
		end
	end
	if not no_undo then ualpush(b, 'ins', slc) end
	local ci, cj = b:getcur()
	local l = b.ll[ci]
	local l1 = l:sub(1,uoff(l,cj)-1)
	local l2 = l:sub(uoff(l,cj))
	local s1 = nil
	if type(sl) == "string" then	s1 = sl
	elseif #sl == 1 then  s1 = sl[1]
	end
	if s1 then -- insert s1 in current line
		b.ll[ci] = l1 .. s1 .. l2
		b:setcur(ci, cj + ulen(s1))
	else -- several lines in sl
		b.ll[ci] = l1 .. sl[1]
		ci = ci + 1
		for i = 2, #sl-1 do
			table.insert(b.ll, ci, sl[i])
			ci = ci + 1
		end
		local last = sl[#sl]
		cj = ulen(last) + 1
		table.insert(b.ll, ci, last .. l2)
		b:setcur(ci, cj)
	end
	b.chgd = true
	b.unsaved = true
	return true
end--bufins

function buffer.bufdel(b, di, dj, no_undo)
	-- if no_undo is true, don't record the modification
	assert(not b:beforecur(di, dj), "point must be after cursor")
	if not no_undo then ualpush(b, 'del', b:getlines(di, dj)) end
	local ci, cj = b:getcur()
	local l1, l2 = b.ll[ci], b.ll[di]
	l1 = l1:sub(1, uoff(l1, cj) - 1)
	l2 = l2:sub(uoff(l2, dj))
	if di == ci then -- delete in current line at cursor
		b.ll[ci] = l1 .. l2
	else -- delete several lines
		local ci1 = ci + 1
		for i = ci1, di do
			-- the next line to remove is always the line at ci+1
			table.remove(b.ll, ci1)
		end
		b.ll[ci] = l1 .. l2
	end
	b.chgd = true
	b.unsaved = true
	return true
end--bufdel

function buffer.settext(b, txt)
	-- replace the buffer text
	-- !! it cannot be undone and it clears the undo stack !!
	-- the cursor and display are reinitialized at the top
	-- of the new text.
	buffer.undo_clearall(b)
	if not ulen(txt) then return nil, "invalid UTF8 sequence" end
	b.ll = lines(txt)
	b.chgd = true
	b.unsaved = true
	b.ci = 1 -- line index
	b.cj = 0 -- cursor offset
	return true
end--settext

------------------------------------------------------------------------
-- undo functions

function ualpush(b, op, sl)
	-- push enough context to be able to undo a core operation (ins, del)
	-- sl is always a list of lines
	local top = #b.ual
	if top > b.ualtop then -- remove the remaining redo actions
		for i = top, b.ualtop+1, -1 do table.remove(b.ual, i) end
		assert(#b.ual == b.ualtop)
	end
	local last = b.ual[top]

	-- in the future, try to merge successive insch()

	sl.op, sl.ci, sl.cj = op, b.ci, b.cj
	table.insert(b.ual, sl)
	b.ualtop = b.ualtop + 1
	return
end

function buffer.op_undo(b, sl)
	b:setcur(sl.ci, sl.cj)
	if sl.op == "del" then
		return b:bufins(sl, true)
	elseif sl.op == "ins" then
		return b:bufdel(sl.ci+#sl-1, sl.cj+ulen(sl[#sl]), true)
	else
		return nil, "unknown op"
	end
end

function buffer.op_redo(b, sl)
	b:setcur(sl.ci, sl.cj)
	if sl.op == "ins" then
		return b:bufins(sl, true)
	elseif sl.op == "del" then
		return b:bufdel(sl.ci+#sl-1, sl.cj+ulen(sl[#sl]), true)
	else
		return nil, "unknown op"
	end
end

function buffer.undo_clearall(b)
	b.ual = {}
	b.ualtop = 0
end

function buffer.undo(b)
	if b.ualtop == 0 then return nil, "nothing to undo" end
	b:op_undo(b.ual[b.ualtop])
	b.ualtop = b.ualtop - 1
	return true
end--undo

function buffer.redo(b)
	if b.ualtop == #b.ual then return nil, "nothing to redo!" end
	b.ualtop = b.ualtop + 1
	b:op_redo(b.ual[b.ualtop])
	return true
end--redo

------------------------------------------------------------------------
-- to be removed later (or not?)

buffer.MAX = 0xffffffff

function buffer.setcurj(b, cj)
	return b:setcur(nil, cj)
end

------------------------------------------------------------------------
return buffer


text:
{extend name="public/base" /}

{block name="body"}

{$info['id']?'编辑':'新增'} [{:get_model_by_id($info['model_id'])}] 属性 : 返回列表

基 础

高 级

			<form id="form" action="{:url('update')}" method="post" class="form-horizontal doc-modal-form">

						字段名(请输入字段名 英文字母开头,长度不超过30)

							<input type="text" class="text input-large" name="name" value="{present name="info.name"}{$info.name}{/present}">

						字段标题(请输入字段标题,用于表单显示)

							<input type="text" class="text input-large" name="title" value="{present name="info.title"}{$info.title}{/present}">

						字段类型(用于表单中的展示方式)

							<select name="type" id="data-type">
								<option value="">----请选择----</option>
								{volist name=":get_attribute_type()" id="type"}
								<option value="{$key}" rule="{$type[1]}">{$type[0]}</option>
								{/volist}
							</select>

						字段定义(字段属性的sql表示)

							<input type="text" class="text input-large" name="field" value="{present name="info.field"}{$info.field}{/present}" id="data-field">

						参数(布尔、枚举、多选字段类型的定义数据)

								<textarea name="extra">{present name="info.extra"}{$info.extra}{/present}</textarea>

						默认值(字段的默认值)

							<input type="text" class="text input-large" name="value" value="{present name="info.value"}{$info.value}{/present}">

						字段备注(用于表单中的提示)

							<input type="text" class="text input-large" name="remark" value="{present name="info.remark"}{$info.remark}{/present}">

						是否显示(是否显示在表单中)

							<select name="is_show">
								<option value="1">始终显示</option>
								<option value="2">新增显示</option>
								<option value="3">编辑显示</option>
								<option value="0">不显示</option>
							</select>

						是否必填(用于自动验证)

							<select name="is_must">
								<option value="0">否</option>
								<option value="1">是</option>
							</select>

						验证规则(require|max:25)

							<input type="text" class="text input-large" name="validate_rule" value="{present name="info.validate_rule"}{$info.validate_rule}{/present}">

						出错提示(名称必须|名称最多不能超过25个字符)

							<input type="text" class="text input-large" name="error_info" value="{present name="info.error_info"}{$info.error_info}{/present}">

						验证时间

							<select name="validate_time">
                                <option value="3">始 终</option>
								<option value="1">新 增</option>
								<option value="2">编 辑</option>
								</select>

						自动完成规则(填写验证函数或方法)

							<input type="text" class="text input-large" name="auto_rule" value="{present name="info.auto_rule"}{$info.auto_rule}{/present}">

						自动完成时间

							<select name="auto_time">
								<option value="3">始 终</option>
								<option value="1">新 增</option>
								<option value="2">编 辑</option>
							</select>

						<input type="hidden" name="id" value="{present name="info.id"}{$info.id}{/present}"/>
						<input type="hidden" name="model_id" value="{$info['model_id']}"/>
						<button class="btn submit-btn ajax-post no-refresh" type="submit" target-form="form-horizontal">确 定</button>
						<button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>

			</form>

{/block}
{block name="script"}

{/block}


text:
package com.musketeer.ten.adapters;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.musketeer.ten.ui.fragments.DiagramShowFragment;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Kevin on 2016/9/21.
 */
public class DiagramAdapter extends FragmentPagerAdapter {

    private List<DiagramShowFragment> data;
    public DiagramAdapter(FragmentManager fm,List<DiagramShowFragment> data) {
        super(fm);
        if (data != null) {
            this.data = data;
        }else {
            this.data = new ArrayList<>();
        }
    }

    public void addData(List<DiagramShowFragment> updata){
        data.addAll(updata);
        notifyDataSetChanged();
    }

    @Override
    public DiagramShowFragment getItem(int position) {
        return data.get(position);
    }

    @Override
    public int getCount() {
        return data != null ? data.size() : 0;
    }
}


text:
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="Pragma" content="no-cache">
<title>XMLHttpRequest</title>
</head>
<body>
<form name="form">
<input type="text" name="result"><br>
<button type="button" name="button">Load</button>
</form>
<embed type="application/es-npapi-xhr" width="0" height="0">
</body>
</html>


text:
var socket = io.connect('http://localhost:3000',{'sync disconnect on unload': true});

// adds a message to the screen
function userMessage(msg, username){
	$('#chatEntries').append('

' + username + ": " + msg + '

');
	$("#chatEntries").animate({ scrollTop: document.getElementById('chatEntries').scrollHeight }, "fast");
}

function generalMessage(html){
	$('#chatEntries').append(html);
	$("#chatEntries").animate({ scrollTop: document.getElementById('chatEntries').scrollHeight }, "fast");
}

// send our message
function sendMessage(){
	var msg = $('#messageInput').val().trim();
	if(msg != "") {
		socket.emit('message', msg);
		userMessage(msg, "You");
		$('#messageInput').val("");
	}
}

function emptyUserList() {

}

// set our username
function login(){
	//$("#loginErrors").empty();
	//$("#loginErrors").hide();
	var username = $("#username").val().trim();
	var gender = document.querySelector('input[name="gender"]:checked').value;
	if(username != ""){
		socket.emit('connectToServer', {username: username, gender: gender});
	}
}

$(document).ready(function() {
	// GENERAL JS
	$(".navbar-toggle").on("click",function(e){
		$(".left-bar").toggleClass("left-bar-active");
		//$(".middle-bar").toggleClass("left-bar-active");
		//$(".chat-bar").toggleClass("left-bar-active");
	});

	socket.on("login response", function(data) {
		if(data.success) {
			$("#login-page").hide();
		    $("#main-page").show();
		    $("body").css("background-color", "#FFFFFF");
		    $('#messageInput').focus();
		    generalMessage("

Welcome to Node Chat! Click on any room in the left bar to join and start chatting now!

");
		} else {
			console.log(data.msg)
			$("#loginErrors").empty();
			$("#loginErrors").append("
<button type='button' data-dismiss='alert' class='close'>×</button>Error!"+data.msg+"
");
			$("#loginErrors").show();
		}
	});

	socket.on("join room response", function(data) {
		if(data.success) {
			$("#messageInput").focus();
			$("#"+data.roomId).addClass("active");
			console.log(data.people);
		} else {
			generalMessage("

"+data.msg+"

");
		}
	});

	// receive incoming messages
	socket.on('message', function(data) {
		if(data.type === 'chat') {
			userMessage(data.msg, data.username);
		} else if (data.type === 'alert') {
			generalMessage("

"+data.msg+"

");
		}
	});

	socket.on('update', function(data) {
		switch(data.type) {
			case "user_count":
				$("#usercount").text(data.count);
				break;
			case "room_count":
				$("#"+data.roomId+" a span").text(data.roomCount);
				break;
			case "room_list":
				generalRooms = $("#generalRooms ul");
				themedRooms = $("#themedRooms ul");
				// clear the rooms lists
				generalRooms.empty();
				themedRooms.empty();

				$.each(data.rooms, function(id, room) {
					li = "
"+room.people.length+""+room.name+"
";
					if(room.type === "general") {
						generalRooms.append(li);
					}else if(room.type === "themed") {
						themedRooms.append(li);
					}
				});

				// If there are no rooms, inform user
				var html = "
There are no rooms to display.
";
				if(generalRooms.children().length == 0) {
					generalRooms.append(html);
				} else if(themedRooms.children().length == 0) {
					themedRooms.append(html);
				}
				break;

			case "user_list":
				console.log(data.list);
				$("#userlist ul").empty();
				for(var i = 0; i < data.list.length; i++) {
					$("#userlist ul").append("

"+data.list[i]+"

");
				}
				break;
		}
	});

	$("#username").keyup(function(e){
		if(e.keyCode == 13){
			$("#login").click();
			$("#messageInput").focus();
		}
	});

	$("#messageInput").keyup(function(e){
		if(e.keyCode == 13){
			$("#submit").click();
			$(this).focus();
		}
	});

	// initialize some stuff on load
	$(function() {
		$("#username").focus();
	    $("#login").click(function() {login()});
	    $("#submit").click(function(e) {e.preventDefault(); sendMessage();});

	    // NOTE: this is the on click syntax for binding to dynamically loaded elements
  		$(".left-bar ul").on('click', 'li:not(.active)', function(e){
  			e.preventDefault();
  			socket.emit("join room", $(this).attr('id'));
  		});
	    // FOR TESTING
	    //$("#login-page").hide();
	    //$("#main-page").show();
	    //$("body").css("background-color", "#FFFFFF");
		//$("#userlist ul").append("

Mike

");
		//$("#userlist ul").append("

Bryon

");
	});
});


text:
package com.comsysto.dcc.auth.controller;

import com.comsysto.dcc.auth.role.Role;
import com.comsysto.dcc.auth.role.RoleRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/role")
@PreAuthorize("hasAuthority('ADMIN')")
public class RoleController {

    @Autowired
    RoleRepository roleRepository;

    @RequestMapping(value = "/all", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
    public List<Role> getUsers() {
        return roleRepository.findAll();
    }

    @RequestMapping(value = "{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
    public Role getRole(@PathVariable String id) {
        return roleRepository.findOne(id);
    }

    @RequestMapping(value = "{id}", method = RequestMethod.DELETE)
    public void deleteRole(@PathVariable String id) {
        roleRepository.delete(id);
    }

    @RequestMapping(value = "/add", method=RequestMethod.POST)
    public Role create(@RequestBody Role role) {
        role.setId(role.getId().toUpperCase());
        return roleRepository.save(role);
    }

    @RequestMapping(value = "{id}", method = RequestMethod.PUT)
    public Role update(@PathVariable String id, @RequestBody Role role) {
        Role fromDB = validate(id);

        fromDB.setDisplayName(role.getDisplayName());

        return roleRepository.save(fromDB);
    }

    private Role validate(String id) {
        return this.roleRepository
                .findById(id)
                .orElseThrow(() -> new RoleNotFoundException(id));
    }

}


text:
const React = require('react-native');

module.exports = React.StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    backgroundColor: '#000000'
  },
  containerTop: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#000000'
  },
  homeHeader: {
    color: '#FFFFFF',
    fontWeight: 'bold',
    fontSize: 45,
    fontFamily: 'Righteous'
  },
  doneHeader: {
    color: '#EB219B',
    fontWeight: 'bold',
    fontSize: 45,
    fontFamily: 'Righteous'
  },
  home: {
    color: '#EB219B',
    fontSize: 30
  },
  button: {
    margin: 20,
    padding: 10,
    borderRadius: 10,
    borderWidth: 1,
    backgroundColor: '#333333'
  },
  timerControl: {
    color: '#FFFFFF',
    fontSize: 30,
    fontFamily: 'Righteous'
  },
  input: {
    backgroundColor: '#FFFFFF'
  }
});


text:
<?php
namespace Inventory\Controller;

use Inventory\Application\Service\MfgCatalog\Tree\MfgCatalogTree;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;

/**
 *
 * @author Nguyen Mau Tri
 *
 */
class MfgCatalogControllerFactory implements FactoryInterface
{

    /**
     *
     * {@inheritdoc}
     *
     * @see \Zend\ServiceManager\FactoryInterface::createService()
     */
    public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $container = $serviceLocator->getServiceLocator();

        $controller = new MfgCatalogController();

        $sv = $container->get(MfgCatalogTree::class);
        $controller->setMfgCatalogTree($sv);

        $sv = $container->get('doctrine.entitymanager.orm_default');
        $controller->setDoctrineEM($sv);

        $sv = $container->get('AppLogger');
        $controller->setLogger($sv);

        $sv = $container->get("AppCache");
        $controller->setCache($sv);

        return $controller;
    }
}


text:
from django.db import migrations, models

import saleor.core.utils.json_serializer

class Migration(migrations.Migration):

    dependencies = [
        ("product", "0120_auto_20200714_0539"),
    ]

    operations = [
        migrations.AlterField(
            model_name="attribute",
            name="metadata",
            field=models.JSONField(
                blank=True,
                default=dict,
                encoder=saleor.core.utils.json_serializer.CustomJsonEncoder,
                null=True,
            ),
        ),
        migrations.AlterField(
            model_name="attribute",
            name="private_metadata",
            field=models.JSONField(
                blank=True,
                default=dict,
                encoder=saleor.core.utils.json_serializer.CustomJsonEncoder,
                null=True,
            ),
        ),
        migrations.AlterField(
            model_name="category",
            name="description_json",
            field=models.JSONField(blank=True, default=dict),
        ),
        migrations.AlterField(
            model_name="category",
            name="metadata",
            field=models.JSONField(
                blank=True,
                default=dict,
                encoder=saleor.core.utils.json_serializer.CustomJsonEncoder,
                null=True,
            ),
        ),
        migrations.AlterField(
            model_name="category",
            name="private_metadata",
            field=models.JSONField(
                blank=True,
                default=dict,
                encoder=saleor.core.utils.json_serializer.CustomJsonEncoder,
                null=True,
            ),
        ),
        migrations.AlterField(
            model_name="categorytranslation",
            name="description_json",
            field=models.JSONField(blank=True, default=dict),
        ),
        migrations.AlterField(
            model_name="collection",
            name="description_json",
            field=models.JSONField(blank=True, default=dict),
        ),
        migrations.AlterField(
            model_name="collection",
            name="metadata",
            field=models.JSONField(
                blank=True,
                default=dict,
                encoder=saleor.core.utils.json_serializer.CustomJsonEncoder,
                null=True,
            ),
        ),
        migrations.AlterField(
            model_name="collection",
            name="private_metadata",
            field=models.JSONField(
                blank=True,
                default=dict,
                encoder=saleor.core.utils.json_serializer.CustomJsonEncoder,
                null=True,
            ),
        ),
        migrations.AlterField(
            model_name="collectiontranslation",
            name="description_json",
            field=models.JSONField(blank=True, default=dict),
        ),
        migrations.AlterField(
            model_name="digitalcontent",
            name="metadata",
            field=models.JSONField(
                blank=True,
                default=dict,
                encoder=saleor.core.utils.json_serializer.CustomJsonEncoder,
                null=True,
            ),
        ),
        migrations.AlterField(
            model_name="digitalcontent",
            name="private_metadata",
            field=models.JSONField(
                blank=True,
                default=dict,
                encoder=saleor.core.utils.json_serializer.CustomJsonEncoder,
                null=True,
            ),
        ),
        migrations.AlterField(
            model_name="product",
            name="metadata",
            field=models.JSONField(
                blank=True,
                default=dict,
                encoder=saleor.core.utils.json_serializer.CustomJsonEncoder,
                null=True,
            ),
        ),
        migrations.AlterField(
            model_name="product",
            name="private_metadata",
            field=models.JSONField(
                blank=True,
                default=dict,
                encoder=saleor.core.utils.json_serializer.CustomJsonEncoder,
                null=True,
            ),
        ),
        migrations.AlterField(
            model_name="producttype",
            name="metadata",
            field=models.JSONField(
                blank=True,
                default=dict,
                encoder=saleor.core.utils.json_serializer.CustomJsonEncoder,
                null=True,
            ),
        ),
        migrations.AlterField(
            model_name="producttype",
            name="private_metadata",
            field=models.JSONField(
                blank=True,
                default=dict,
                encoder=saleor.core.utils.json_serializer.CustomJsonEncoder,
                null=True,
            ),
        ),
        migrations.AlterField(
            model_name="productvariant",
            name="metadata",
            field=models.JSONField(
                blank=True,
                default=dict,
                encoder=saleor.core.utils.json_serializer.CustomJsonEncoder,
                null=True,
            ),
        ),
        migrations.AlterField(
            model_name="productvariant",
            name="private_metadata",
            field=models.JSONField(
                blank=True,
                default=dict,
                encoder=saleor.core.utils.json_serializer.CustomJsonEncoder,
                null=True,
            ),
        ),
    ]