text:
id: 587d7b7d367417b2b2512b1d
title: Iterate Through the Keys of an Object with a for...in Statement
challengeType: 1
forumTopicId: 301162
localeTitle: Итерация через ключи объекта с помощью for for ... in Statement
---

## Description

Иногда вам может потребоваться повторить все ключи внутри объекта. Для этого требуется конкретный синтаксис в JavaScript, называемый выражением <dfn>for for ... in</dfn> . Для объекта наших users это может выглядеть так:
 для (разрешить пользователям пользователей) {
 console.log (пользователь);
 };

 // logs:
 Алан
 Джефф
 Сара
 Райан
 В этом заявлении мы определили user переменной, и, как вы можете видеть, эта переменная была сброшена во время каждой итерации каждому из ключей объекта, когда оператор зациклился на объекте, в результате чего каждое имя пользователя печаталось на консоль. ЗАМЕТКА:
 Объекты не поддерживают упорядочение хранимых ключей, например массивов; таким образом, позиция клавиш на объекте или относительный порядок, в котором он появляется, не имеет значения при ссылке или доступе к этому ключу.

## Instructions

Мы определили функцию countOnline ; используйте оператор <dfn>for for ...</dfn> внутри этой функции, чтобы прокручивать пользователей в объекте users и возвращать число пользователей, у которых свойство online установлено true .

## Tests

```yml
tests:
  - text: The function <code>countOnline</code> should use a `for in` statement to iterate through the object keys of the object passed to it.
    testString: assert(code.match(/for\s*\(\s*(var|let)\s+[a-zA-Z_$]\w*\s+in\s+[a-zA-Z_$]\w*\s*\)\s*{/));
  - text: 'The function <code>countOnline</code> should return <code>1</code> when the object <code>{ Alan: { online: false }, Jeff: { online: true }, Sarah: { online: false } }</code> is passed to it'
    testString: assert(countOnline(usersObj1) === 1);
  - text: 'The function <code>countOnline</code> should return <code>2</code> when the object <code>{ Alan: { online: true }, Jeff: { online: false }, Sarah: { online: true } }</code> is passed to it'
    testString: assert(countOnline(usersObj2) === 2);
  - text: 'The function <code>countOnline</code> should return <code>0</code> when the object <code>{ Alan: { online: false }, Jeff: { online: false }, Sarah: { online: false } }</code> is passed to it'
    testString: assert(countOnline(usersObj3) === 0);

```

## Challenge Seed

```js
function countOnline(usersObj) {
  // change code below this line

  // change code above this line
}

```

### After Tests

```js
const usersObj1 = {
  Alan: {
    online: false
  },
  Jeff: {
    online: true
  },
  Sarah: {
    online: false
  }
}

const usersObj2 = {
  Alan: {
    online: true
  },
  Jeff: {
    online: false
  },
  Sarah: {
    online: true
  }
}

const usersObj3 = {
  Alan: {
    online: false
  },
  Jeff: {
    online: false
  },
  Sarah: {
    online: false
  }
}

```

## Solution

```js
function countOnline(usersObj) {
  let online = 0;
  for(let user in usersObj){
    if(usersObj[user].online) {
      online++;
    }
  }
  return online;
}
```


text:
#include <aws/ec2/model/DescribeVpnGatewaysRequest.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>

using namespace Aws::EC2::Model;
using namespace Aws::Utils;

DescribeVpnGatewaysRequest::DescribeVpnGatewaysRequest() :
    m_dryRun(false),
    m_dryRunHasBeenSet(false),
    m_vpnGatewayIdsHasBeenSet(false),
    m_filtersHasBeenSet(false)
{
}

Aws::String DescribeVpnGatewaysRequest::SerializePayload() const
{
  Aws::StringStream ss;
  ss << "Action=DescribeVpnGateways&";
  if(m_dryRunHasBeenSet)
  {
    ss << "DryRun=" << m_dryRun << "&";
  }
  if(m_vpnGatewayIdsHasBeenSet)
  {
    unsigned vpnGatewayIdsCount = 1;
    for(auto& item : m_vpnGatewayIds)
    {
      ss << "VpnGatewayIds.member." << vpnGatewayIdsCount << "="
          << StringUtils::URLEncode(item.c_str()) << "&";
      vpnGatewayIdsCount++;
    }
  }
  if(m_filtersHasBeenSet)
  {
    unsigned filtersCount = 1;
    for(auto& item : m_filters)
    {
      item.OutputToStream(ss, "Filters.member.", filtersCount, "");
      filtersCount++;
    }
  }
  ss << "Version=2015-04-15";
  return ss.str();
}

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace NilPortugues\Tests\MessageBus\Serializer;

use NilPortugues\MessageBus\Serializer\JsonObjectSerializer;

class JsonObjectSerializerTest extends \PHPUnit_Framework_TestCase
{
    public function testItCanSerialize()
    {
        $stdClass = new \stdClass();
        $stdClass->id = 1;
        $stdClass->name = ['name' => 'Nil', 'surname' => 'Portugués'];

        $serializer = new JsonObjectSerializer();

        $unserialized = $serializer->unserialize($serializer->serialize($stdClass));

        $this->assertEquals($stdClass->id, $unserialized->id);
        $this->assertEquals($stdClass->name['name'], $unserialized->name->name);
        $this->assertEquals($stdClass->name['surname'], $unserialized->name->surname);
    }
}


text:
require 'rails/engine'
require 'versioncake'

module Spree
  module Api
    class Engine < Rails::Engine
      isolate_namespace Spree
      engine_name 'spree_api'

      Rabl.configure do |config|
        config.include_json_root = false
        config.include_child_root = false

        # Motivation here it make it call as_json when rendering timestamps
        # and therefore display miliseconds. Otherwise it would fall to
        # JSON.dump which doesn't display the miliseconds
        config.json_engine = ActiveSupport::JSON
      end

      initializer 'spree.api.versioncake' do |_app|
        VersionCake.setup do |config|
          config.resources do |r|
            r.resource %r{.*}, [], [], [1]
          end

          config.missing_version = 1
          config.extraction_strategy = :http_header
        end
      end

      initializer 'spree.api.environment', before: :load_config_initializers do |_app|
        Spree::Api::Config = Spree::ApiConfiguration.new
      end

      def self.activate
        Dir.glob(File.join(File.dirname(__FILE__), '../../../app/**/*_decorator*.rb')) do |c|
          Rails.configuration.cache_classes ? require(c) : load(c)
        end
      end
      config.to_prepare &method(:activate).to_proc

      def self.root
        @root ||= Pathname.new(File.expand_path('../../../../', __FILE__))
      end
    end
  end
end


text:
<?php

/**
 * setup actions.
 *
 * @package    streeme
 * @subpackage setup
 * @author     Richard Hoar
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class setupActions extends sfActions
{
  /**
   * Always check for local or whitelisted user before running these actions
   */
  public function preExecute()
  {
    //you may add other ips to the whitelist if you wish to configure remotely using the config param below
    $allowed_ips = array_merge(array('127.0.0.1', '::1'), sfConfig::get('app_setup_acl_allowed_ips', array()));
    if (!in_array(@$_SERVER['REMOTE_ADDR'], $allowed_ips))
    {
     die('You are not allowed to access this file.'. $_SERVER['REMOTE_ADDR']);
    }
  }

   /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
  public function executeIndex(sfWebRequest $request)
  {
  }

 /**
  * Executes user setup form action
  *
  * @param sfRequest $request A request object
  */
  public function executeSetupUser(sfWebRequest $request)
  {
    $this->form = new UserSetupForm();
    $this->user_add_error = false;
    $this->user_del_error = false;

    if ($request->isMethod('post'))
    {
      $this->form->bind($request->getParameter('setup'));
      if ($this->form->isValid())
      {
        $options = $this->form->getValues();
        $generator = new UserSetupGenerator();
        switch($options['user_action'])
        {
          case 'add':
            if($generator->addUser($options['username'], $options['password']))
            {
              $this->redirect('@setup_application');
            }
            else
            {
              $this->user_add_error = true;
            }
          break;

          case 'del':
            if($generator->deleteUser($options['username']))
            {
              $this->redirect('@setup_user');
            }
            else
            {
              $this->user_del_error = true;
            }
          break;
        }
      }
    }
  }

  /**
   * Execute the database setup form action
   *
   * @param sfRequest $request A request object
   */
  public function executeSetupDb(sfWebRequest $request)
  {
    $this->form = new DatabaseSetupForm();
    $this->config_write_error = false;
    $this->db_setup_error = false;

    if ($request->isMethod('post'))
    {
      $this->form->bind($request->getParameter('setup'));
      if ($this->form->isValid())
      {
        $options = $this->form->getValues();
        $generator = new DbSetupGenerator(new sfYamlDumper);
        if($generator->create(sfConfig::get('sf_root_dir') . '/config/databases.yml', $options['database_type'], $options))
        {
          if($generator->reloadDb())
          {
            $this->redirect('@setup_user');
          }
          else
          {
            $this->db_setup_error = true;
          }
        }
        else
        {
          $this->config_write_error = true;
        }
      }
    }
  }

  /**
   * Execute the application setup form action
   *
   * @param sfRequest $request A request object
   */
  public function executeSetupApplication(sfWebRequest $request)
  {
    $this->form = new ApplicationSetupForm();
    $this->isMysql = (Doctrine_Manager::getInstance()->getCurrentConnection()->getDriverName() === 'Mysql') ? true : false;
    $this->create_error = false;
    $this->bootstrap_error = false;
    $this->clear_error = false;

    if ($request->isMethod('post'))
    {
      $this->form->bind($request->getParameter('setup'));
      if ($this->form->isValid())
      {
        $options = $this->form->getValues();
        $generator = new ApplicationSetupGenerator(new sfYamlDumper);
        if($generator->create(sfConfig::get('sf_root_dir') . '/apps/client/config/app.yml', $options))
        {
          if($generator->reloadApplication())
          {
            if($this->isMysql && $options['database_indexing'])
            {
              if(!$generator->bootstrapIndexer())
              {
                $this->bootstrap_error = true;
              }
            }
          }
          else
          {
            $this->clear_error = true;
          }
        }
        else
        {
          $this->create_error = true;
        }

        if(!$this->create_error && !$this->bootstrap_error && !$this->clear_error)
        {
          $this->redirect('@setup_scan');
        }
      }
    }
  }

  /**
   * Execute the scan media page
   *
   * @param sfRequest $request A request object
   */
  public function executeSetupScanMedia(sfWebRequest $request)
  {
    $this->scanSuccess = false;
    $this->scanError = false;

    if ($request->isMethod('post'))
    {
      $generator = new ApplicationSetupGenerator(new sfYamlDumper);
      if($generator->runMediaScan())
      {
        $this->scanSuccess = true;
      }
      else
      {
        $this->scanError = true;
      }
    }
  }
}


text:
\hypertarget{class_able_polecat___debug}{}\section{Able\+Polecat\+\_\+\+Debug Class Reference}
\label{class_able_polecat___debug}\index{Able\+Polecat\+\_\+\+Debug@{Able\+Polecat\+\_\+\+Debug}}
\subsection*{Static Public Member Functions}
\begin{DoxyCompactItemize}
\item
static \hyperlink{class_able_polecat___debug_a904fb37117d15cdf61e2d9b950b3123a}{kill} (\$object=N\+U\+L\+L)
\item
static \hyperlink{class_able_polecat___debug_a3caabc307ae63bc5356a26265df74baf}{get\+Function\+Call\+Backtrace} (\$stack\+Pos=N\+U\+L\+L)
\end{DoxyCompactItemize}

\subsection{Member Function Documentation}
\hypertarget{class_able_polecat___debug_a3caabc307ae63bc5356a26265df74baf}{}\index{Able\+Polecat\+\_\+\+Debug@{Able\+Polecat\+\_\+\+Debug}!get\+Function\+Call\+Backtrace@{get\+Function\+Call\+Backtrace}}
\index{get\+Function\+Call\+Backtrace@{get\+Function\+Call\+Backtrace}!Able\+Polecat\+\_\+\+Debug@{Able\+Polecat\+\_\+\+Debug}}
\subsubsection[{get\+Function\+Call\+Backtrace}]{\setlength{\rightskip}{0pt plus 5cm}static get\+Function\+Call\+Backtrace (
\begin{DoxyParamCaption}
\item[{}]{\$stack\+Pos = {\ttfamily NULL}}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}\label{class_able_polecat___debug_a3caabc307ae63bc5356a26265df74baf}
Debug information helper. \hypertarget{class_able_polecat___debug_a904fb37117d15cdf61e2d9b950b3123a}{}\index{Able\+Polecat\+\_\+\+Debug@{Able\+Polecat\+\_\+\+Debug}!kill@{kill}}
\index{kill@{kill}!Able\+Polecat\+\_\+\+Debug@{Able\+Polecat\+\_\+\+Debug}}
\subsubsection[{kill}]{\setlength{\rightskip}{0pt plus 5cm}static kill (
\begin{DoxyParamCaption}
\item[{}]{\$object = {\ttfamily NULL}}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}\label{class_able_polecat___debug_a904fb37117d15cdf61e2d9b950b3123a}
die and vomit on screen.

\begin{DoxyParams}[1]{Parameters}
mixed & {\em \$object} & A D\+O\+M object to examine. \\
\hline
\end{DoxyParams}

The documentation for this class was generated from the following file\+:\begin{DoxyCompactItemize}
\item
C\+:/wamp/www/polecat/public/core/Debug.\+php\end{DoxyCompactItemize}


text:
"use strict";

module.exports = require("./streams").BufferStream;


text:
<?php

namespace Rawebone\Ormish\Exceptions;

class ExecutionException extends \RuntimeException
{
    protected $sqlStateCode;
    protected $errorMsg;
    protected $query;
    protected $params;

    public function __construct($code, $msg, $query, array $params)
    {
        $this->sqlStateCode = $code;
        $this->errorMsg = $msg;
        $this->query = $query;
        $this->params = $params;

        $exMsg = "Execution Exception: [$code] $msg";
        parent::__construct($exMsg);
    }

    public function getSqlState()
    {
        return $this->sqlStateCode;
    }

    public function getErrorMsg()
    {
        return $this->errorMsg;
    }

    public function getQueryString()
    {
        return $this->query;
    }

    public function getQueryParams()
    {
        return $this->params;
    }
}


text:
package com.jcwhatever.nucleus.utils.observer.update;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

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

public class UpdateAgentTest {

    @Test
    public void basicTest() {

        final List<String> updateResults = new ArrayList<>(10);

        final UpdateAgent<String> agent = new UpdateAgent<>();

        UpdateSubscriber<String> subscriber = new UpdateSubscriber<String>() {
            @Override
            public void on(String argument) {

                updateResults.add(argument);
            }
        };

        assertEquals(0, agent.getSubscribers().size());

        agent.addSubscriber(subscriber);

        // ensure subscriber is added to agent
        assertEquals(1, agent.getSubscribers().size());

        // ensure agent added itself to subscriber
        assertEquals(1, subscriber.getAgents().size());

        // test update
        agent.update("testUpdate");

        // ensure the event was called on the subscriber
        assertEquals(1, updateResults.size());

        updateResults.clear();

        // test unregister
        agent.removeSubscriber(subscriber);

        // ensure subscriber is removed from agent
        assertEquals(0, agent.getSubscribers().size());

        // ensure the agent removed itself from the subscriber
        assertEquals(0, subscriber.getAgents().size());

        // test update
        agent.update("testUpdate");

        // ensure the event was NOT called on the subscriber
        assertEquals(0, updateResults.size());
    }

}


text:
/**
* Symbl.io AI as a Service Platform
* MIT License
* https://symbl.io
* https://github.com/getsymbl/symbl
*/

/**
* System dependencies
*/

const aws			= require('aws-sdk');
const benchmark		= require('benchmark');
const cryptography	= require('node-forge');
const express		= require('express');
const forge			= require('forge');
const cjson			= require('circular-json');
const getmac		= require('getmac');
const http 			= require('http');
const https 		= require('https');
const os			= require('os');
const platform		= require('platform');
const should		= require('should');
const gremlin		= require('gremlin');
const storage 		= require('node-persist');

/**
* Dependency initialization
*/

storage.init( {
		dir: 'data',
		stringify: cjson.stringify,
		parse: cjson.parse,
		encoding: 'utf8',
		logging: false,
		continuous: true,
		interval: false,
		ttl: false,
	} );

/**
* Initialize Symbl
*/
var symbl = {

	ai			: {},
	api			: {},
	bootstrap	: {},
	cloud		: {},
	cli			: {},
	lambda		: {},
	log			: {},
	test		: {},

}

module.exports = symbl;

symbl.ai				= {};
symbl.api				= express();
symbl.bootstrap			= {};
symbl.cloud				= {};
symbl.cli 				= require('commander');
symbl.graph				= {};
symbl.lambda 			= require('q');
symbl.log				= {};
symbl.repository		= {};
symbl.schema			= {};
symbl.test				= {};

/**
* Initialize symbl repository
*/
symbl.repository = storage;

/**
* Initialize AI
*/
symbl.ai = {

	entityPrototype : {
			name 		: "",
			code		: "",
			resources	: "",
	},
	copy			: function(entity) {
		//return _.cloneDeep(entity);
	},
	test 			: function() {
		return this.copy(symbl.ai);
	},
	add				: function() {},
	remove			: function() {},

}

/**
* Initialize API
*/
symbl.api.get('/', function (req, res) {
	res.send('/');
})

symbl.api.get('/test', function(req, res) {
	res.send('/test');
});

symbl.api.get('/cloud', function(req, res) {
	res.send('/cloud');
});

symbl.api.get('/api', function(req, res) {
	res.send('/api');
});

symbl.bootstrap = {

	generateUuid 	: function(){},
	setup 			: function(){},
	hash			: {},
	test	: function() {
		return this.copy(symbl.bootstrap);
	},
	copy	: function(entity) {
		//return _.cloneDeep(entity);
	},
}

/**
* Initialize bootstrap
*/
symbl.bootstrap.hash = cryptography.md.sha512.create();

symbl.bootstrap.generateUuid = function() {
    var d = new Date().getTime();
    var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
        var r = (d + Math.random()*16)%16 | 0;
        d = Math.floor(d/16);
        return (c=='x' ? r : (r&0x3|0x8)).toString(16);
    });
    return uuid;
}

symbl.bootstrap.setup = function(email, password) {

	var userUuid = symbl.bootstrap.generateUuid();
	var userKey = symbl.bootstrap.hash.digest().getBytes();

		var setupUser = {

			email 				: email,
			emailSecondary		: "",
			mobile				: "",
			password 			: password,
			publicKey			: "",
			privateKey			: "",
			uuid				: userUuid,
			services			: {}

		}

		symbl.repository.setItemSync('user', setupUser);
		symbl.repository.persist();

}

/**
* Initialize Cli
*/
symbl.cli
	.version('0.1.0')
	.option('-T, -Test', 'Execute tests.')

symbl.cli
	.command('')
	.description('')
	.action(function() {
		console.log(1);
	});

symbl.cli
	.command('test')
	.description('run test commands')
	.action(function() {
		symbl.test.run();
	});

symbl.cli
   .command('setup')
   .description('run setup <email> <password>')
   .action(function(email, password) { symbl.bootstrap.setup(email, password) } );

symbl.cli
   .command('service <host> <port>')
   .description('run as a service on <host> <port>')
   .action(function(host, port) {
		if(port == undefined) { host = "localhost", port = 80; }
		getmac.getMac(function(err,macAddress){
			if (err)  throw err;
			http.createServer(symbl.api).listen(port, host);
			symbl.log.info("Starting service on " + os.hostname() + " " + macAddress + " " + host + ":" + port);
		});

   });

symbl.cli
   .command('import <type> <dir> [otherDirs...]')
   .description('import entites')
   .action(function(dir, otherDirs) {
     symbl.log.debug('dir "%s"', dir);
     if (otherDirs) {
       otherDirs.forEach(function (oDir) {
         symbl.log.debug('dir "%s"', oDir);
       });
     }
   });

symbl.cli
   .command('export <entity> <type> <dir> [otherDirs...]')
   .description('export <entity> <type> <dir>')
   .action(function(dir, otherDirs) {
     symbl.log.debug('dir "%s"', dir);
     if (otherDirs) {
       otherDirs.forEach(function (oDir) {
         symbl.log.debug('dir "%s"', oDir);
       });
     }
   });

symbl.cli
   .command('*')
   .description('run <*>')
   .action(function(env) {
		storage.getItem('user', function (err, value) {

		});
   });

/**
* Initialize cloud
*/
symbl.cloud = {

	entityPrototype	: {

		name 	: "",
		graphs	: {},

	},
	add			: function() {

	},
	remove		: function() {},
	copy		: function() {},

}

/**
* Initialize graph
*/
symbl.graph = {

	entityPrototype	:
	{
		x 				: 0,
		y 				: 0,
		z 				: 0,
		name			: "",
		cssClass 		: "",
		schema			: ""
	},
	copy				: function(entity) {

		//return _.cloneDeep(entity);

	},
	addNode				: function() {},
	addConnection 		: function() {},
	removeNode			: function() {},
	removeConnection	: function() {},
	fold				: function() {},
	intersection		: function() {},
	metric				: function() {},
	test				: function() {

		return this.copy(symbl.graph);

	},

};

symbl.schema = {

	entityPrototype		:
	{
		name	: "",
		model	: {},
	},
	test	: function() {
		return this.copy(symbl.schema);
	},
	copy	: function(entity) {
		//return _.cloneDeep(entity);
	},

}

/**
* Initialize lambda
*/
symbl.lambda = {

	entityPrototype		:
	{
		name	: "",
		code	: "",
	},
	test	: function() {
		return this.copy(symbl.lambda);
	},
	copy	: function(entity) {
		//return _.cloneDeep(entity);
	},

};
/**
* Initialize log
*/
symbl.log = {

	debug	: function() {},
	error	: function() {},
	info	: function() {},
	warn	: function() {},
	test	: function() {
		return this.copy(symbl.log);
	},
	copy	: function(entity) {
		//return _.cloneDeep(entity);
	},

};

symbl.log.debug = function(message, e) { if(true) { console.log(message); } };
symbl.log.info = function(message, e) { console.log(message); }
symbl.log.warn = function(message, e) { console.log("Warning: " + message); }
symbl.log.error = function(message, e) { console.log("Error: " + message); }

/**
* Initialize test
*/
symbl.test = {

	benchmark	: {},
	unit		: {},
	integration	: {},
	run			: function() {}

};

symbl.test.benchmark = new benchmark.Suite;

symbl.test.benchmark
.add('RegExp#test', function() {
  /o/.test('Hello World!');
	})
.add('String#indexOf', function() {
  'Hello World!'.indexOf('o') > -1;
	})
.add('symbl.graph.test', function(){
	symbl.graph.test();
	})
.add('symbl.ai.test', function(){
	symbl.ai.test();
	})
.add('symbl.lambda.test', function(){
	symbl.lambda.test();
	})
.add('symbl.log.test', function(){
	symbl.log.test();
	})
.on('cycle', function(event) {
  symbl.log.debug(String(event.target));
	})
.on('complete', function() {
  symbl.log.debug('Fastest is ' + this.filter('fastest').map('name'));
	})

symbl.test.run = function() {

	symbl.test.benchmark.run({ 'async': true });

}

/**
* Cli entry point
*/
symbl.cli
	.parse(process.argv);


text:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class p08_Melrah_Shake {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder inputLine = new StringBuilder(reader.readLine());
        StringBuilder pattern = new StringBuilder(reader.readLine());

        while (pattern.length() > 0) {
            int firstMatch = inputLine.indexOf(pattern.toString());
            int lastMatch = inputLine.lastIndexOf(pattern.toString());

            if (firstMatch != -1 && lastMatch != -1) {
                inputLine.replace(firstMatch, firstMatch + pattern.length(), "");
                inputLine.replace(lastMatch - pattern.length(), lastMatch, "");

                pattern.deleteCharAt(pattern.length() / 2);
                System.out.println("Shaked it.");
            } else {
                break;
            }
        }
        System.out.println("No shake.");
        System.out.println(inputLine);
    }
}


text:
Visualization of concepts from Russell And Norvig's "Artificial Intelligence — A Modern Approach", and Javascript code for algorithms. Unlike aima-python, aima-java, and other sibling projects, this project is primarily about the visualizations and secondarily about the code.

- [View the visualizations](http://aimacode.github.io/aima-javascript/)
- [How to contribute](https://github.com/aimacode/aima-javascript/wiki/How-to-Contribute)
- [Chat on Gitter](https://gitter.im/aimacode/Lobby)

Some Javascript visualizations that I admire, and would like to see similar kinds of things here:
- [Red Blob Games: A* Tutorial](http://www.redblobgames.com/pathfinding/a-star/introduction.html)
- [Qiao Search Demo](https://qiao.github.io/PathFinding.js/visual/)
- [Nicky Case: Simulating the World](http://ncase.me/simulating/)
- [Rafael Matsunaga: Genetic Car Thingy](http://rednuht.org/genetic_cars_2/)
- [Lee Yiyuan: 2048 Bot](http://leeyiyuan.github.io/2048ai/)


text:
import os.path

def simple_router(item, *args, **kwargs):
    if item.path == 'index.html':
        return item.path
    split = os.path.splitext(item.path)
    return "%s/index%s" % split


text:
BODY {background-color:#3967A7; FONT-FAMILY: "宋体"; FONT-SIZE: 9pt; FONT-STYLE: normal;TEXT-DECORATION: none}
TD {FONT-FAMILY: "宋体"; FONT-SIZE: 9pt; color:white; FONT-STYLE: normal; TEXT-DECORATION: none}
TEXTAREA {FONT-FAMILY: "宋体"; FONT-SIZE: 9pt; FONT-STYLE: normal; TEXT-DECORATION: none}
INPUT {FONT-FAMILY: "宋体"; FONT-SIZE: 9pt; FONT-STYLE: normal; TEXT-DECORATION: none;}
SELECT {FONT-FAMILY: "宋体"; FONT-SIZE: 9pt; FONT-STYLE: normal; LIST-STYLE: none; TEXT-DECORATION: none;}

hr { border:solid 1;
		background-color:#CCCCCC;
 		border-color:gray #ffffff #ffffff gray ;
}
.date {width: 90px}
.chkbox {FONT-FAMILY: "宋体"; FONT-SIZE: 9pt; FONT-STYLE: normal; TEXT-DECORATION: none;height: 15px}
.free {width:48}
.selectA {width: 90px}
.selectB {width: 105px}
.select {width: 110px}
.select1 {width: 120px}
.select2 {width: 132px}
.select3 {width: 158px}
.select4 {width: 252px}
.select41 {width: 309px}
.select5 {width: 190px}
.select6 {width: 220px}
.select7 {width: 240px}
.select8 {width: 220px}
.select9 {width: 96px}
.select10 {width: 120px}
.text1 {width: 311px}
.text2 {width: 99px}
.text3 {width: 171px}
.text4 {width: 70px}
.button1 {width: 190px}
.browser {width: 21px;height: 18px}
.browser {height: 20px}
.calendar {height: 20px}
.calendar2 {height: 18px;VERTICAL-ALIGN: top;}
.textarea1 {width: 157px}
.H16 {height: 20px}
.text208 {width: 208px}

.btn {  font-family: "Arial", "Helvetica", "sans-serif"; font-size: 9px; height: 20px; width: 20px}
.lbtn { font-family: "Arial", "Helvetica", "sans-serif"; font-size: 9px; height: 20px; width: 40px}
.text11 {width: 247px}
.text12 {width: 280px}
.bb {height:20;width:64}
.timeput {width: 86px}

.disabledMenuItem {FILTER: chroma(color=#010101) dropshadow(color=ButtonHighlight, offx=1, offy=1); color: graytext; font-family: sans-serif; font-size:9pt; width:145; height=17;padding-left:20;padding-top:3;}
.menuItem {font-family: sans-serif; font-size:9pt; width:145; height=17;padding-left:5;padding-top:3;color:black;filter: black();}

.highlightItem { font-family: sans-serif; font-size: 9pt; width: 145;height=17; padding-left: 5;padding-top:3;background-Color: highlight; color: white; }
.clickableDiv { padding: 4; width: 500; background-Color: blue; color: white; border: 10px double blue; }
.blankItem {font-family: sans-serif; font-size:7px; width:145; height:7;background-Color: menu;color:black; }

.MouseDown{
	 background-color: ButtonFace;
	 border-color: "#000000";
	 BORDER-LEFT: graytext 1px solid;
	 BORDER-TOP: graytext 1px solid;
	 BORDER-RIGHT: graytext 1px solid;
	 BORDER-BOTTOM: ButtonHighlight 0px solid;
}
.MouseUp{
	 background-color: ButtonFace;

	 BORDER-LEFT: ButtonHighlight 1px solid;
	 BORDER-TOP: graytext  0px solid ;
	 BORDER-RIGHT: black  1px solid;
	 BORDER-BOTTOM: ButtonShadow  1px solid
}
.flat{
	  border-color: gray;
	 BORDER-LEFT: gray 0px solid;
	 BORDER-TOP: gray  1px solid ;
	 BORDER-RIGHT: gray  1px solid;
	 BORDER-BOTTOM: gray  0px solid
}

.flat0{
	 border-color: white;
	 BORDER-LEFT: white 1px solid;
	 BORDER-TOP: white  1px solid ;
	 BORDER-RIGHT: white  1px solid;
	 BORDER-BOTTOM: white  1px solid
}

.flat2{
	 border-color: gray;
	 BORDER-LEFT: gray 2px solid;
	 BORDER-TOP: gray  2px solid ;
	 BORDER-RIGHT: gray  2px solid;
	 BORDER-BOTTOM: gray  2px solid
}

.flat1{
	 border-color: gray;
	 BORDER-LEFT: gray 1px solid;
	 BORDER-TOP: gray  1px solid ;
	 BORDER-RIGHT: gray  1px solid;
	 BORDER-BOTTOM: gray  1px solid
}

.flat1_MouseOver{
	 border-color: gray;
	 background-color:ButtonFace;
	 BORDER-LEFT: gray 1px solid;
	 BORDER-TOP: gray  1px solid ;
	 BORDER-RIGHT: gray  1px solid;
	 BORDER-BOTTOM: gray  1px solid
}

HTML {
	FONT-WEIGHT: normal; FONT-SIZE: 9pt; LINE-HEIGHT: normal; FONT-STYLE: normal; FONT-VARIANT: normal
}

.ButtonTable {
	BORDER-RIGHT: 0px groove; BORDER-TOP: 0px groove; BORDER-LEFT: 1px #cccccc; BORDER-BOTTOM: 0px groove
}
.Button {
	BORDER-RIGHT: buttonface 0px solid; PADDING-RIGHT: 2px; BORDER-TOP: buttonface 0px solid; PADDING-LEFT: 2px; FONT-WEIGHT: normal; PADDING-BOTTOM: 2px; FONT: Icon; VERTICAL-ALIGN: middle; BORDER-LEFT: buttonface 0px solid; CURSOR: hand; PADDING-TOP: 2px; BORDER-BOTTOM: buttonface 0px solid; WHITE-SPACE: nowrap;
}
.ButtonHover {
	BORDER-RIGHT: buttonface 0px solid; PADDING-RIGHT: 2px; BORDER-TOP: buttonface 0px solid; PADDING-LEFT: 2px; FONT-WEIGHT: normal; PADDING-BOTTOM: 2px; FONT: Icon; VERTICAL-ALIGN: middle; BORDER-LEFT: buttonface 0px solid; CURSOR: hand; PADDING-TOP: 2px; BORDER-BOTTOM: buttonface 0px solid; WHITE-SPACE: nowrap;
}
.ButtonHover {
	BORDER-TOP-WIDTH: 1px; PADDING-RIGHT: 1px; PADDING-LEFT: 1px; BORDER-LEFT-WIDTH: 1px; BORDER-LEFT-COLOR: buttonhighlight; BORDER-BOTTOM-WIDTH: 1px; BORDER-BOTTOM-COLOR: black; PADDING-BOTTOM: 1px; BORDER-TOP-COLOR: buttonhighlight; PADDING-TOP: 1px; BORDER-RIGHT-WIDTH: 1px; BORDER-RIGHT-COLOR: black
}
.ButtonActiveHover {
	BORDER-RIGHT: buttonface 0px solid; PADDING-RIGHT: 2px; BORDER-TOP: buttonface 0px solid; PADDING-LEFT: 2px; FONT-WEIGHT: normal; PADDING-BOTTOM: 2px; FONT: Icon; VERTICAL-ALIGN: middle; BORDER-LEFT: buttonface 0px solid; CURSOR: hand; PADDING-TOP: 2px; BORDER-BOTTOM: buttonface 0px solid; WHITE-SPACE: nowrap; BACKGROUND-COLOR: buttonface
}
.ButtonActive {
	BORDER-RIGHT: buttonface 0px solid; PADDING-RIGHT: 2px; BORDER-TOP: buttonface 0px solid; PADDING-LEFT: 2px; FONT-WEIGHT: normal; PADDING-BOTTOM: 2px; FONT: Icon; VERTICAL-ALIGN: middle; BORDER-LEFT: buttonface 0px solid; CURSOR: hand; PADDING-TOP: 2px; BORDER-BOTTOM: buttonface 0px solid; WHITE-SPACE: nowrap;
}
.ButtonActiveDisabled {
	BORDER-RIGHT: buttonface 0px solid; PADDING-RIGHT: 5px; BORDER-TOP: buttonface 0px solid; PADDING-LEFT: 5px; FONT-WEIGHT: normal; PADDING-BOTTOM: 2px; FONT: Icon; VERTICAL-ALIGN: middle; BORDER-LEFT: buttonface 0px solid; CURSOR: default; PADDING-TOP: 2px; BORDER-BOTTOM: buttonface 0px solid; WHITE-SPACE: nowrap; BACKGROUND-COLOR: buttonface
}
.ButtonDisabled {
	BORDER-RIGHT: buttonface 0px solid; PADDING-RIGHT: 5px; BORDER-TOP: buttonface 0px solid; PADDING-LEFT: 5px; FONT-WEIGHT: normal; PADDING-BOTTOM: 2px; FONT: Icon; VERTICAL-ALIGN: middle; BORDER-LEFT: buttonface 0px solid; CURSOR: default; PADDING-TOP: 2px; BORDER-BOTTOM: buttonface 0px solid; WHITE-SPACE: nowrap; BACKGROUND-COLOR: buttonface
}
.ButtonUpDisabled {
	BORDER-RIGHT: buttonface 0px solid; PADDING-RIGHT: 5px; BORDER-TOP: buttonface 0px solid; PADDING-LEFT: 5px; FONT-WEIGHT: normal; PADDING-BOTTOM: 2px; FONT: Icon; VERTICAL-ALIGN: middle; BORDER-LEFT: buttonface 0px solid; CURSOR: default; PADDING-TOP: 2px; BORDER-BOTTOM: buttonface 0px solid; WHITE-SPACE: nowrap; BACKGROUND-COLOR: buttonface
}

.ButtonActiveHover {
	BORDER-TOP-WIDTH: 1px; PADDING-RIGHT: 3px; PADDING-LEFT: 5px; BORDER-LEFT-WIDTH: 1px; BORDER-LEFT-COLOR: black; BORDER-BOTTOM-WIDTH: 1px; BORDER-BOTTOM-COLOR: buttonhighlight; PADDING-BOTTOM: 0px; BORDER-TOP-COLOR: black; PADDING-TOP: 2px; BORDER-RIGHT-WIDTH: 1px; BORDER-RIGHT-COLOR: buttonhighlight
}
.ButtonActive {
	BORDER-TOP-WIDTH: 1px; PADDING-RIGHT: 0px; PADDING-LEFT: 2px; BORDER-LEFT-WIDTH: 1px; BORDER-LEFT-COLOR: black; BACKGROUND-IMAGE: url(images/cbback.gif); BORDER-BOTTOM-WIDTH: 1px; BORDER-BOTTOM-COLOR: buttonhighlight; PADDING-BOTTOM: 0px; BORDER-TOP-COLOR: black; PADDING-TOP: 2px; BORDER-RIGHT-WIDTH: 1px; BORDER-RIGHT-COLOR: buttonhighlight
}
.ButtonUpDisabled {
	BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 5px; PADDING-LEFT: 5px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 2px; COLOR: graytext; PADDING-TOP: 2px; BORDER-RIGHT-WIDTH: 0px
}
.ButtonActiveDisabled {
	BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 5px; PADDING-LEFT: 5px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 2px; COLOR: graytext; PADDING-TOP: 2px; BORDER-RIGHT-WIDTH: 0px
}
.ButtonDisabled {
	BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 5px; PADDING-LEFT: 5px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 2px; COLOR: graytext; PADDING-TOP: 2px; BORDER-RIGHT-WIDTH: 0px
}
.ButtonActiveDisabled {
	BORDER-TOP-WIDTH: 1px; PADDING-RIGHT: 3px; PADDING-LEFT: 5px; BORDER-LEFT-WIDTH: 1px; BORDER-LEFT-COLOR: buttonshadow; BORDER-BOTTOM-WIDTH: 1px; BORDER-BOTTOM-COLOR: buttonhighlight; PADDING-BOTTOM: 0px; BORDER-TOP-COLOR: buttonshadow; PADDING-TOP: 2px; BORDER-RIGHT-WIDTH: 1px; BORDER-RIGHT-COLOR: buttonhighlight
}
.ButtonUpDisabled {
	BORDER-TOP-WIDTH: 1px; BORDER-LEFT-WIDTH: 1px; BORDER-LEFT-COLOR: buttonhighlight; BORDER-BOTTOM-WIDTH: 1px; BORDER-BOTTOM-COLOR: buttonshadow; BORDER-TOP-COLOR: buttonhighlight; BORDER-RIGHT-WIDTH: 1px; BORDER-RIGHT-COLOR: buttonshadow
}

.ButtonHover2 {
	BORDER-RIGHT: buttonface 0px solid; PADDING-RIGHT: 5px; BORDER-TOP: buttonface 0px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; VERTICAL-ALIGN: bottom; BORDER-LEFT: buttonface 0px solid; CURSOR: default; PADDING-TOP: 2px; BORDER-BOTTOM: buttonface 0px solid; WHITE-SPACE: nowrap;
}

.ButtonHover2 {
	BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 4px; PADDING-LEFT: 4px; BORDER-LEFT-WIDTH: 0px; BORDER-LEFT-COLOR: buttonhighlight; BORDER-BOTTOM-WIDTH: 1px; BORDER-BOTTOM-COLOR: buttonshadow; PADDING-BOTTOM: 1px; BORDER-TOP-COLOR: buttonhighlight; PADDING-TOP: 1px; BORDER-RIGHT-WIDTH: 1px; BORDER-RIGHT-COLOR: buttonshadow
}

.yToolbar {
	BACKGROUND-COLOR: buttonface; BORDER-BOTTOM: buttonshadow 1px solid; BORDER-LEFT: buttonhighlight 1px solid; BORDER-RIGHT: buttonshadow 1px solid; BORDER-TOP: buttonhighlight 1px solid; HEIGHT: 27px; LEFT: 0px; POSITION: relative; TOP: 0px
}

.TBHandle {
	BACKGROUND-COLOR: #cccccc; BORDER-LEFT: buttonhighlight 1px solid; BORDER-RIGHT: buttonshadow 1px solid; BORDER-TOP: buttonhighlight 1px solid; FONT-SIZE: 1px; HEIGHT: 22px; POSITION: absolute; TOP: 1px; WIDTH: 3px
}
.TabUp{
	 height:21;
	 font-size:13pt;
	 background-color: white;
	 BORDER-LEFT: #cccccc 1px solid;
	 BORDER-TOP: #cccccc  1px solid ;
	 BORDER-RIGHT: ButtonShadow  1px solid;
	 BORDER-BOTTOM: white  1px solid;
	 PADDING-TOP: 0px;
}

.TabDn{
	 height:21;
	 color:white;
	 font-size:13pt;
	 background-color: #6699ff;
	 BORDER-LEFT: #cccccc 1px solid;
	 BORDER-TOP: #cccccc  1px solid ;
	 BORDER-RIGHT: ButtonShadow  1px solid;
	 BORDER-BOTTOM: #cccccc  1px solid;
	 PADDING-TOP: 0px;
}


text:
db.comments.insert([
{
databaseID:'Internet Archive',
reviews:'random comment'
},
{
databaseID:'African American Registry',
reviews:'random comment'
},
{
databaseID:'Internet Movie Database',
reviews:'random comment'
},
{
databaseID:'Animal Diversity Web',
reviews:'random comment'
},
{
databaseID:'ArchINFORM',
reviews:'random comment'
},
{
databaseID:'American National Corpus',
reviews:'random comment'
},
{
databaseID:'Internet Archive',
reviews:'random comment'
},
{
databaseID:'Philosophy',
reviews:'random comment'
},
{
databaseID:'Animal Diversity Web',
reviews:'random comment'
},
{
databaseID:'American National Corpus',
reviews:'random comment'
},
{
databaseID:'Arachne',
reviews:'random comment'
},
{
databaseID:'Airdisaster',
reviews:'random comment'
},
{
databaseID:'American National Corpus',
reviews:'random comment'
},
{
databaseID:'Airliners.net',
reviews:'random comment'
},
{
databaseID:'Aeiou Encyclopedia',
reviews:'random comment'
},
{
databaseID:'Internet Public Library',
reviews:'random comment'
},
{
databaseID:'Animal Genome Size Database',
reviews:'random comment'
},
{
databaseID:'ArtCyclopedia',
reviews:'random comment'
},
{
databaseID:'ArchINFORM',
reviews:'random comment'
},
{
databaseID:'American National Corpus',
reviews:'random comment'
},
{
databaseID:'ArchINFORM',
reviews:'random comment'
},
{
databaseID:'Airliners.net',
reviews:'random comment'
},
{
databaseID:'Acronym Finder',
reviews:'random comment'
},
{
databaseID:'ArtCyclopedia',
reviews:'random comment'
},
{
databaseID:'Airliners.net',
reviews:'random comment'
},
{
databaseID:'Allmovie',
reviews:'random comment'
},
{
databaseID:'Allmovie',
reviews:'random comment'
},
{
databaseID:'The Internet Book Database',
reviews:'random comment'
},
{
databaseID:'Allmusic',
reviews:'random comment'
},
{
databaseID:'Airiti Inc',
reviews:'random comment'
},
])


text:
package main

import (
	"fmt"
	"os"
	"time"

	"github.com/moov-io/ach"
)

func main() {
	// To create a file
	fh := ach.NewFileHeader()
	fh.ImmediateDestination = "231380104"
	fh.ImmediateOrigin = "121042882"
	fh.FileCreationDate = time.Now().Format("060102")
	fh.ImmediateDestinationName = "Federal Reserve Bank"
	fh.ImmediateOriginName = "My Bank Name"
	file := ach.NewFile()
	file.SetHeader(fh)

	// To create a batch.
	// Errors only if payment type is not supported.
	bh := ach.NewBatchHeader()
	bh.ServiceClassCode = ach.MixedDebitsAndCredits
	bh.CompanyName = "Your Company"
	bh.CompanyIdentification = file.Header.ImmediateOrigin
	bh.StandardEntryClassCode = ach.PPD
	bh.CompanyEntryDescription = "Trans. Description"
	bh.EffectiveEntryDate = time.Now().AddDate(0, 0, 1).Format("060102") // YYMMDD
	bh.ODFIIdentification = "121042882"

	batch, _ := ach.NewBatch(bh)

	// To create an entry
	entry := ach.NewEntryDetail()
	entry.TransactionCode = ach.CheckingCredit
	entry.SetRDFI("231380104")
	entry.DFIAccountNumber = "81967038518"
	entry.Amount = 1000000
	entry.IndividualName = "Wade Arnold"
	entry.SetTraceNumber(bh.ODFIIdentification, 1)
	entry.IdentificationNumber = "ABC##jvkdjfuiwn"
	entry.Category = ach.CategoryForward
	entry.AddendaRecordIndicator = 1

	// To add one or more optional addenda records for an entry

	addenda := ach.NewAddenda05()
	addenda.PaymentRelatedInformation = "bonus pay for amazing work on #OSS"
	entry.AddAddenda05(addenda)

	// Entries are added to batches like so:

	batch.AddEntry(entry)

	// When all of the Entries are added to the batch we must create it.

	if err := batch.Create(); err != nil {
		fmt.Printf("%T: %s", err, err)
	}

	// And batches are added to files much the same way:

	file.AddBatch(batch)

	// Now add a new batch for accepting payments on the web

	bh2 := ach.NewBatchHeader()
	bh2.ServiceClassCode = ach.CreditsOnly
	bh2.CompanyName = "Your Company"
	bh2.CompanyIdentification = file.Header.ImmediateOrigin
	bh2.StandardEntryClassCode = ach.WEB
	bh2.CompanyEntryDescription = "Subscribe"
	bh2.EffectiveEntryDate = time.Now().AddDate(0, 0, 1).Format("060102") // YYMMDD
	bh2.ODFIIdentification = "121042882"

	batch2, _ := ach.NewBatch(bh2)

	// Add an entry and define if it is a single or recurring payment
	// The following is a recurring payment for $7.99

	entry2 := ach.NewEntryDetail()
	entry2.TransactionCode = ach.CheckingCredit
	entry2.SetRDFI("231380104")
	entry2.DFIAccountNumber = "81967038518"
	entry2.Amount = 799
	entry2.IndividualName = "Wade Arnold"
	entry2.SetTraceNumber(bh2.ODFIIdentification, 2)
	entry2.IdentificationNumber = "#123456"
	entry2.DiscretionaryData = "R"
	entry2.Category = ach.CategoryForward
	entry2.AddendaRecordIndicator = 1

	// To add one or more optional addenda records for an entry
	addenda2 := ach.NewAddenda05()
	addenda2.PaymentRelatedInformation = "Monthly Membership Subscription"
	entry2.AddAddenda05(addenda2)

	// add the entry to the batch
	batch2.AddEntry(entry2)

	// Create and add the second batch
	if err := batch2.Create(); err != nil {
		fmt.Printf("%T: %s", err, err)
	}
	file.AddBatch(batch2)

	// Once we added all our batches we must create the file

	if err := file.Create(); err != nil {
		fmt.Printf("%T: %s", err, err)
	}

	// Finally we wnt to write the file to an io.Writer
	w := ach.NewWriter(os.Stdout)
	if err := w.Write(file); err != nil {
		fmt.Printf("%T: %s", err, err)
	}
	w.Flush()
}


text:
#region Usings

using System;
using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;

#endregion

namespace Extend
{
    /// <summary>
    ///     Class containing some extension methods for <see cref="IEnumerable{T}" />.
    /// </summary>
    // ReSharper disable once InconsistentNaming
    public static partial class IEnumerableTEx
    {
        /// <summary>
        ///     Partitions the given sequence into blocks with the specified size.
        /// </summary>
        /// <exception cref="ArgumentNullException">source can not be null.</exception>
        /// <exception cref="ArgumentOutOfRangeException">size is smaller than 1.</exception>
        /// <typeparam name="T">The type of the items in the IEnumerable.</typeparam>
        /// <param name="source">The sequence to partition.</param>
        /// <param name="size">The number of items per block.</param>
        /// <returns>Returns the created blocks.</returns>
        [Pure]
        [PublicAPI]
        [NotNull]
        public static IEnumerable<IEnumerable<T>> Partition<T>( [NotNull] [ItemCanBeNull] this IEnumerable<T> source, Int32 size )
        {
            source.ThrowIfNull( nameof(source) );
            if ( size < 1 )
                throw new ArgumentOutOfRangeException( nameof(size), size, $"{nameof(size)} is out of range. Size must be > 1." );

            return source
                   .WithIndex()
                   .GroupBy( x => x.Index / size )
                   .Select( x => x.WithoutIndex() );
        }
    }
}


text:
using Microsoft.AspNet.Identity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Text;
using System.Threading.Tasks;

namespace Dongbo.AspNet.Identity.Extension
{
    public class ApplicationClaimsIdentityFactory<TUser> : ClaimsIdentityFactory<TUser> where TUser : class, IUser<string>
    {
        internal const string DefaultNicknameClaimType = "urn:axeslide:identity:nickname";
        public ApplicationClaimsIdentityFactory()
            : base()
        {
            NicknameClaimsType = DefaultNicknameClaimType;
        }
        public string NicknameClaimsType { get; set; }
        public override Task<ClaimsIdentity> CreateAsync(UserManager<TUser, string> manager, TUser user, string authenticationType)
        {

            if (manager == null)
            {
                throw new ArgumentNullException("manager");
            }
            if (user == null)
            {
                throw new ArgumentNullException("user");
            }
            var id = new ClaimsIdentity(authenticationType, UserNameClaimType, RoleClaimType);
            id.AddClaim(new Claim(UserIdClaimType, ConvertIdToString(user.Id), ClaimValueTypes.String));
            id.AddClaim(new Claim(UserNameClaimType, user.UserName, ClaimValueTypes.String));
            id.AddClaim(new Claim(IdentityProviderClaimType, DefaultIdentityProviderClaimValue, ClaimValueTypes.String));
            if (manager.SupportsUserSecurityStamp)
            {
                id.AddClaim(new Claim(SecurityStampClaimType,
                    await manager.GetSecurityStampAsync(user.Id).WithCurrentCulture()));
            }
            if (manager.SupportsUserRole)
            {
                IList<string> roles = await manager.GetRolesAsync(user.Id).WithCurrentCulture();
                foreach (string roleName in roles)
                {
                    id.AddClaim(new Claim(RoleClaimType, roleName, ClaimValueTypes.String));
                }
            }
            if (manager.SupportsUserClaim)
            {
                id.AddClaims(await manager.GetClaimsAsync(user.Id).WithCurrentCulture());
            }
            return id;
            return base.CreateAsync(manager, user, authenticationType);
        }
    }
}


text:
<?php
namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Storage extends Model {

    protected $table = 'storage';

    protected $fillable = [
        'xinghao', 'material_name', 'store_place','storage_num','category_id','remark','danwei','xianding_num'
    ];
}


text:
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

/*

DROP TABLE IF EXISTS `pw_windid_user`;
CREATE TABLE `pw_windid_user` (
  `uid` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '用户ID',
  `username` varchar(15) NULL DEFAULT '' COMMENT '用户名字',
  `email` varchar(80) NULL DEFAULT '' COMMENT 'Email',
  `password` char(32) NULL DEFAULT '' COMMENT '密码',
  `salt` char(6) NULL DEFAULT '' COMMENT '盐值',
  `safecv` char(8) NULL DEFAULT '' COMMENT '安全问题',
  `regdate` int(10) unsigned NULL DEFAULT '0' COMMENT '注册时间',
  `regip` varchar(20) NULL DEFAULT '' COMMENT '注册IP',
  PRIMARY KEY (`uid`),
  UNIQUE KEY `idx_username` (`username`),
  KEY `idx_email` (`email`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COMMENT='windid用户基本信息表';

 */

class PwWindidUserTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function run()
    {
        Schema::create('pw_windid_user', function (Blueprint $table) {
            if (env('DB_CONNECTION', false) === 'mysql') {
                $table->engine = 'InnoDB';
            }
        }
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('pw_windid_user');
    }
}


text:
import os

import flask
from oslo.config import cfg

from driverlog.dashboard import api
from driverlog.openstack.common import log as logging
from driverlog.processor import config

# Application objects ---------

app = flask.Flask(__name__)
app.register_blueprint(api.blueprint)

LOG = logging.getLogger(__name__)

conf = cfg.CONF
conf.register_opts(config.OPTS)

def main():
    conf_file = os.getenv('DRIVERLOG_CONF')
    if conf_file and os.path.isfile(conf_file):
        conf(default_config_files=[conf_file])
        app.config['DEBUG'] = cfg.CONF.debug
        app.config['CONF'] = cfg.CONF
        LOG.info('DriverLog.dashboard is configured via "%s"', conf_file)
    else:
        conf(project='driverlog')

    logging.setup('driverlog')

    app.run(cfg.CONF.listen_host, cfg.CONF.listen_port)

if __name__ == '__main__':
    main()


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

	<!-- Licensed to the Apache Software Foundation (ASF) under one or more
		contributor license agreements. See the NOTICE file distributed with this
		work for additional information regarding copyright ownership. The ASF licenses
		this file to You under the Apache License, Version 2.0 (the "License"); you
		may not use this file except in compliance with the License. You may obtain
		a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless
		required by applicable law or agreed to in writing, software distributed
		under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
		OR CONDITIONS OF ANY KIND, either express or implied. See the License for
		the specific language governing permissions and limitations under the License. -->

	<parent>
		<groupId>ch.sourcepond</groupId>
		<artifactId>bundle-test</artifactId>
		<version>0.5.2</version>
		<relativePath />
	</parent>
	<modelVersion>4.0.0</modelVersion>
	<groupId>ch.sourcepond.utils</groupId>
	<artifactId>mdcwrapper-test</artifactId>
	<version>0.1-SNAPSHOT</version>
	<inceptionYear>2015</inceptionYear>
	<description>
		OSGi integration test for bundle mdcwrapper-impl.
	</description>

	<dependencies>
		<!-- Testing -->
		<dependency>
			<groupId>ch.sourcepond.utils</groupId>
			<artifactId>mdcwrapper-impl</artifactId>
			<version>0.1-SNAPSHOT</version>
		</dependency>
		<dependency>
			<type>test-jar</type>
			<groupId>ch.sourcepond.utils</groupId>
			<artifactId>mdcwrapper-impl</artifactId>
			<version>0.1-SNAPSHOT</version>
		</dependency>
	</dependencies>

	<!-- Remove this when MNG-3244, MNG-5951 are resolved -->
	<url>https://sourcepond.github.io/${repo.project}</url>

	<!-- Remove this when MNG-3244, MNG-5951 are resolved -->
	<scm>
		<url>https://${repo.domain}/${repo.path}</url>
		<connection>scm:git:${project.scm.url}.git</connection>
		<developerConnection>scm:git:ssh://${repo.domain}/${repo.path}.git</developerConnection>
	</scm>
</project>


text:
/* eslint-disable lines-around-comment */
// @ts-expect-error
import { AUDIO_ONLY_SCREEN_SHARE_NO_TRACK } from '../../../../modules/UI/UIErrors';
import { IReduxState, IStore } from '../../app/types';
import { shouldShowModeratedNotification } from '../../av-moderation/functions';
import { setNoiseSuppressionEnabled } from '../../noise-suppression/actions';
import { showNotification } from '../../notifications/actions';
import { NOTIFICATION_TIMEOUT_TYPE } from '../../notifications/constants';
// @ts-ignore
import { stopReceiver } from '../../remote-control/actions';
// @ts-ignore
import { setScreenAudioShareState, setScreenshareAudioTrack } from '../../screen-share/actions';
import { isAudioOnlySharing, isScreenVideoShared } from '../../screen-share/functions';
// @ts-ignore
import { isScreenshotCaptureEnabled, toggleScreenshotCaptureSummary } from '../../screenshot-capture';
// @ts-ignore
import { AudioMixerEffect } from '../../stream-effects/audio-mixer/AudioMixerEffect';
import { setAudioOnly } from '../audio-only/actions';
import { getCurrentConference } from '../conference/functions';
import { JitsiTrackErrors, JitsiTrackEvents } from '../lib-jitsi-meet';
import { setScreenshareMuted } from '../media/actions';
import { MEDIA_TYPE, VIDEO_TYPE } from '../media/constants';
/* eslint-enable lines-around-comment */

import {
    addLocalTrack,
    replaceLocalTrack
} from './actions.any';
import {
    createLocalTracksF,
    getLocalDesktopTrack,
    getLocalJitsiAudioTrack
} from './functions';
import { IShareOptions, IToggleScreenSharingOptions } from './types';

export * from './actions.any';

/**
 * Signals that the local participant is ending screensharing or beginning the screensharing flow.
 *
 * @param {boolean} enabled - The state to toggle screen sharing to.
 * @param {boolean} audioOnly - Only share system audio.
 * @param {Object} shareOptions - The options to be passed for capturing screenshare.
 * @returns {Function}
 */
export function toggleScreensharing(
        enabled?: boolean,
        audioOnly = false,
        shareOptions: IShareOptions = {}) {
    return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
        // check for A/V Moderation when trying to start screen sharing
        if ((enabled || enabled === undefined) && shouldShowModeratedNotification(MEDIA_TYPE.VIDEO, getState())) {

            return Promise.reject();
        }

        return _toggleScreenSharing({
            enabled,
            audioOnly,
            shareOptions
        }, {
            dispatch,
            getState
        });
    };
}

/**
 * Displays a UI notification for screensharing failure based on the error passed.
 *
 * @private
 * @param {Object} error - The error.
 * @param {Object} store - The redux store.
 * @returns {void}
 */
function _handleScreensharingError(
        error: Error | AUDIO_ONLY_SCREEN_SHARE_NO_TRACK,
        { dispatch }: IStore): void {
    if (error.name === JitsiTrackErrors.SCREENSHARING_USER_CANCELED) {
        return;
    }
    let descriptionKey, titleKey;

    if (error.name === JitsiTrackErrors.PERMISSION_DENIED) {
        descriptionKey = 'dialog.screenSharingPermissionDeniedError';
        titleKey = 'dialog.screenSharingFailedTitle';
    } else if (error.name === JitsiTrackErrors.CONSTRAINT_FAILED) {
        descriptionKey = 'dialog.cameraConstraintFailedError';
        titleKey = 'deviceError.cameraError';
    } else if (error.name === JitsiTrackErrors.SCREENSHARING_GENERIC_ERROR) {
        descriptionKey = 'dialog.screenSharingFailed';
        titleKey = 'dialog.screenSharingFailedTitle';
    } else if (error === AUDIO_ONLY_SCREEN_SHARE_NO_TRACK) {
        descriptionKey = 'notify.screenShareNoAudio';
        titleKey = 'notify.screenShareNoAudioTitle';
    }

    dispatch(showNotification({
        titleKey,
        descriptionKey
    }, NOTIFICATION_TIMEOUT_TYPE.MEDIUM));
}

/**
 * Applies the AudioMixer effect on the local audio track if applicable. If there is no local audio track, the desktop
 * audio track is added to the conference.
 *
 * @private
 * @param {JitsiLocalTrack} desktopAudioTrack - The audio track to be added to the conference.
 * @param {*} state - The redux state.
 * @returns {void}
 */
async function _maybeApplyAudioMixerEffect(desktopAudioTrack: any, state: IReduxState): Promise<void> {
    const localAudio = getLocalJitsiAudioTrack(state);
    const conference = getCurrentConference(state);

    if (localAudio) {
        // If there is a localAudio stream, mix in the desktop audio stream captured by the screen sharing API.
        const mixerEffect = new AudioMixerEffect(desktopAudioTrack);

        await localAudio.setEffect(mixerEffect);
    } else {
        // If no local stream is present ( i.e. no input audio devices) we use the screen share audio
        // stream as we would use a regular stream.
        await conference.replaceTrack(null, desktopAudioTrack);
    }
}

/**
 * Toggles screen sharing.
 *
 * @private
 * @param {boolean} enabled - The state to toggle screen sharing to.
 * @param {Store} store - The redux store.
 * @returns {void}
 */
async function _toggleScreenSharing(
        {
            enabled,
            audioOnly = false,
            shareOptions = {}
        }: IToggleScreenSharingOptions,
        store: IStore
): Promise<void> {
    const { dispatch, getState } = store;
    const state = getState();
    const audioOnlySharing = isAudioOnlySharing(state);
    const screenSharing = isScreenVideoShared(state);
    const conference = getCurrentConference(state);
    const localAudio = getLocalJitsiAudioTrack(state);
    const localScreenshare = getLocalDesktopTrack(state['features/base/tracks']);

    // Toggle screenshare or audio-only share if the new state is not passed. Happens in the following two cases.
    // 1. ShareAudioDialog passes undefined when the user hits continue in the share audio demo modal.
    // 2. Toggle screenshare called from the external API.
    const enable = audioOnly
        ? enabled ?? !audioOnlySharing
        : enabled ?? !screenSharing;
    const screensharingDetails: { sourceType?: string; } = {};

    if (enable) {
        let tracks;

        // Spot proxy stream.
        if (shareOptions.desktopStream) {
            tracks = [ shareOptions.desktopStream ];
        } else {
            const { _desktopSharingSourceDevice } = state['features/base/config'];

            if (!shareOptions.desktopSharingSources && _desktopSharingSourceDevice) {
                shareOptions.desktopSharingSourceDevice = _desktopSharingSourceDevice;
            }

            const options = {
                devices: [ VIDEO_TYPE.DESKTOP ],
                ...shareOptions
            };

            try {
                tracks = await createLocalTracksF(options) as any[];
            } catch (error) {
                _handleScreensharingError(error as any, store);

                throw error;
            }
        }

        const desktopAudioTrack = tracks.find(track => track.getType() === MEDIA_TYPE.AUDIO);
        const desktopVideoTrack = tracks.find(track => track.getType() === MEDIA_TYPE.VIDEO);

        if (audioOnly) {
            // Dispose the desktop track for audio-only screensharing.
            desktopVideoTrack.dispose();

            if (!desktopAudioTrack) {
                _handleScreensharingError(AUDIO_ONLY_SCREEN_SHARE_NO_TRACK, store);

                throw new Error(AUDIO_ONLY_SCREEN_SHARE_NO_TRACK);
            }
        } else if (desktopVideoTrack) {
            if (localScreenshare) {
                await dispatch(replaceLocalTrack(localScreenshare.jitsiTrack, desktopVideoTrack, conference));
            } else {
                await dispatch(addLocalTrack(desktopVideoTrack));
            }
            if (isScreenshotCaptureEnabled(state, false, true)) {
                dispatch(toggleScreenshotCaptureSummary(true));
            }
            screensharingDetails.sourceType = desktopVideoTrack.sourceType;
        }

        // Apply the AudioMixer effect if there is a local audio track, add the desktop track to the conference
        // otherwise without unmuting the microphone.
        if (desktopAudioTrack) {
            // Noise suppression doesn't work with desktop audio because we can't chain track effects yet, disable it
            // first. We need to to wait for the effect to clear first or it might interfere with the audio mixer.
            await dispatch(setNoiseSuppressionEnabled(false));
            _maybeApplyAudioMixerEffect(desktopAudioTrack, state);
            dispatch(setScreenshareAudioTrack(desktopAudioTrack));

            // Handle the case where screen share was stopped from the browsers 'screen share in progress' window.
            if (audioOnly) {
                desktopAudioTrack?.on(
                    JitsiTrackEvents.LOCAL_TRACK_STOPPED,
                    () => dispatch(toggleScreensharing(undefined, true)));
            }
        }

        // Disable audio-only or best performance mode if the user starts screensharing. This doesn't apply to
        // audio-only screensharing.
        const { enabled: bestPerformanceMode } = state['features/base/audio-only'];

        if (bestPerformanceMode && !audioOnly) {
            dispatch(setAudioOnly(false));
        }
    } else {
        const { desktopAudioTrack } = state['features/screen-share'];

        dispatch(stopReceiver());

        dispatch(toggleScreenshotCaptureSummary(false));

        // Mute the desktop track instead of removing it from the conference since we don't want the client to signal
        // a source-remove to the remote peer for the screenshare track. Later when screenshare is enabled again, the
        // same sender will be re-used without the need for signaling a new ssrc through source-add.
        dispatch(setScreenshareMuted(true));
        if (desktopAudioTrack) {
            if (localAudio) {
                localAudio.setEffect(undefined);
            } else {
                await conference.replaceTrack(desktopAudioTrack, null);
            }
            desktopAudioTrack.dispose();
            dispatch(setScreenshareAudioTrack(null));
        }
    }

    if (audioOnly) {
        dispatch(setScreenAudioShareState(enable));
    } else {
        // Notify the external API.
        APP.API.notifyScreenSharingStatusChanged(enable, screensharingDetails);
    }
}


text:
<?php

/**
 * sfValidatorChoiceMany validates than an array of values is in the array of the expected values.
 *
 * @package    symfony
 * @subpackage validator
 * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
 * @version    SVN: $Id: sfValidatorChoiceMany.class.php 22140 2009-09-18 11:28:09Z fabien $
 */
class sfValidatorChoiceMany extends sfValidatorChoice
{
  /**
   * Configures the current validator.
   *
   * @see sfValidatorChoice
   */
  protected function configure($options = array(), $messages = array())
  {
    parent::configure($options, $messages);

    $this->setOption('multiple', true);
  }
}


text:
<?php

/**
 *  README for sample service
 *
 *  This generated sample service contains functions that illustrate typical service operations.
 *  Use these functions as a starting point for creating your own service implementation. Modify the
 *  function signatures, references to the database, and implementation according to your needs.
 *  Delete the functions that you do not use.
 *
 *  Save your changes and return to Flash Builder. In Flash Builder Data/Services View, refresh
 *  the service. Then drag service operations onto user interface components in Design View. For
 *  example, drag the getAllItems() operation onto a DataGrid.
 *
 *  This code is for prototyping only.
 *
 *  Authenticate the user prior to allowing them to call these methods. You can find more
 *  information at http://www.adobe.com/go/flex_security
 *
 */
class SbranchService {

	var $username = "root";
	var $password = "";
	var $server = "localhost";
	var $port = 3306;
	var $databasename = "stechschema";
	var $tablename = "_branch";

	var $connection;

	/**
	 * The constructor initializes the connection to database. Everytime a request is
	 * received by Zend AMF, an instance of the service class is created and then the
	 * requested method is invoked.
	 */
	public function __construct() {
	  	$this->connection = mysqli_connect(
	  							$this->server,
	  							$this->username,
	  							$this->password,
	  							$this->databasename,
	  							$this->port
	  						);

		$this->throwExceptionOnError($this->connection);

		mysqli_query($this->connection, "SET NAMES 'utf8'");
	}

	/**
	 * Returns all the rows from the table.
	 *
	 * Add authroization or any logical checks for secure access to your data
	 *
	 * @return array
	 */
	public function getAll_branch() {

		$stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename");
		$this->throwExceptionOnError();

		mysqli_stmt_execute($stmt);
		$this->throwExceptionOnError();

		$rows = array();

		mysqli_stmt_bind_result($stmt, $row->branchIndex, $row->branchID, $row->name, $row->address, $row->contactNo, $row->faxNo, $row->taxID, $row->CRE_DTE, $row->CRE_USR, $row->UPD_DTE, $row->UPD_USR, $row->DEL_DTE, $row->DEL_USR);

	    while (mysqli_stmt_fetch($stmt)) {
	      $row->CRE_DTE = new DateTime($row->CRE_DTE);
	      $row->UPD_DTE = new DateTime($row->UPD_DTE);
	      $row->DEL_DTE = new DateTime($row->DEL_DTE);
	      $rows[] = $row;
	      $row = new stdClass();
	      mysqli_stmt_bind_result($stmt, $row->branchIndex, $row->branchID, $row->name, $row->address, $row->contactNo, $row->faxNo, $row->taxID, $row->CRE_DTE, $row->CRE_USR, $row->UPD_DTE, $row->UPD_USR, $row->DEL_DTE, $row->DEL_USR);
	    }

		mysqli_stmt_free_result($stmt);
	    mysqli_close($this->connection);

	    return $rows;
	}

	/**
	 * Returns _branch matched the search criteria (KP)
	 *
	 * Add authorization or any logical checks for secure access to your data
	 *
	 *
	 * @return stdClass
	 */
	public function getSearch_branch($searchCause) {

	    $stmt = mysqli_prepare($this->connection, $searchCause);
		$this->throwExceptionOnError();

		//mysqli_stmt_bind_param($stmt,  , $searchCause);
		//$this->throwExceptionOnError();

		mysqli_stmt_execute($stmt);
		$this->throwExceptionOnError();

		$rows = array();

		mysqli_stmt_bind_result($stmt, $row->branchIndex, $row->branchID, $row->name, $row->address, $row->contactNo, $row->faxNo, $row->taxID, $row->CRE_DTE, $row->CRE_USR, $row->UPD_DTE, $row->UPD_USR, $row->DEL_DTE, $row->DEL_USR);

	    while (mysqli_stmt_fetch($stmt)) {
	      $row->CRE_DTE = new DateTime($row->CRE_DTE);
	      $row->UPD_DTE = new DateTime($row->UPD_DTE);
	      $row->DEL_DTE = new DateTime($row->DEL_DTE);
	      $rows[] = $row;
	      $row = new stdClass();
	      mysqli_stmt_bind_result($stmt, $row->branchIndex, $row->branchID, $row->name, $row->address, $row->contactNo, $row->faxNo, $row->taxID, $row->CRE_DTE, $row->CRE_USR, $row->UPD_DTE, $row->UPD_USR, $row->DEL_DTE, $row->DEL_USR);
	    }

		mysqli_stmt_free_result($stmt);
		mysqli_close($this->connection);

		return $rows;
	}

	/**
	 * Returns the item corresponding to the value specified for the primary key.
	 *
	 * Add authorization or any logical checks for secure access to your data
	 *
	 *
	 * @return stdClass
	 */
	public function get_branchByID($itemID) {

		$stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename where branchIndex=?");
		$this->throwExceptionOnError();

		mysqli_stmt_bind_param($stmt, 'i', $itemID);
		$this->throwExceptionOnError();

		mysqli_stmt_execute($stmt);
		$this->throwExceptionOnError();

		mysqli_stmt_bind_result($stmt, $row->branchIndex, $row->branchID, $row->name, $row->address, $row->contactNo, $row->faxNo, $row->taxID, $row->CRE_DTE, $row->CRE_USR, $row->UPD_DTE, $row->UPD_USR, $row->DEL_DTE, $row->DEL_USR);

		if(mysqli_stmt_fetch($stmt)) {
	      $row->CRE_DTE = new DateTime($row->CRE_DTE);
	      $row->UPD_DTE = new DateTime($row->UPD_DTE);
	      $row->DEL_DTE = new DateTime($row->DEL_DTE);
	      return $row;
		} else {
	      return null;
		}
	}

	/**
	 * Returns the item corresponding to the value specified for the primary key.
	 *
	 * Add authorization or any logical checks for secure access to your data
	 *
	 *
	 * @return stdClass
	 */
	public function create_branch($item) {

		$stmt = mysqli_prepare($this->connection, "INSERT INTO $this->tablename (branchID, name, address, contactNo, faxNo, taxID, CRE_DTE, CRE_USR, UPD_DTE, UPD_USR, DEL_DTE, DEL_USR) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
		$this->throwExceptionOnError();

		mysqli_stmt_bind_param($stmt, 'ssssssssssss', $item->branchID, $item->name, $item->address, $item->contactNo, $item->faxNo, $item->taxID, $item->CRE_DTE->toString('YYYY-MM-dd HH:mm:ss'), $item->CRE_USR, $item->UPD_DTE->toString('YYYY-MM-dd HH:mm:ss'), $item->UPD_USR, $item->DEL_DTE->toString('YYYY-MM-dd HH:mm:ss'), $item->DEL_USR);
		$this->throwExceptionOnError();

		mysqli_stmt_execute($stmt);
		$this->throwExceptionOnError();

		$autoid = mysqli_stmt_insert_id($stmt);

		mysqli_stmt_free_result($stmt);
		mysqli_close($this->connection);

		return $autoid;
	}

	/**
	 * Returns the item corresponding to the value specified for the primary key.
	 *
	 * Add authorization or any logical checks for secure access to your data
	 *
	 *
	 * @return stdClass
	 */
	public function myCreate_branch($SQLInsert) {

		$stmt = mysqli_prepare($this->connection, $SQLInsert);
		$this->throwExceptionOnError();

		mysqli_stmt_execute($stmt);
		$this->throwExceptionOnError();

		mysqli_stmt_free_result($stmt);
		mysqli_close($this->connection);

	}

	/**
	 * Updates the passed item in the table.
	 *
	 * Add authorization or any logical checks for secure access to your data
	 *
	 * @param stdClass $item
	 * @return void
	 */
	public function update_branch($item) {

		$stmt = mysqli_prepare($this->connection, "UPDATE $this->tablename SET branchID=?, name=?, address=?, contactNo=?, faxNo=?, taxID=?, CRE_DTE=?, CRE_USR=?, UPD_DTE=?, UPD_USR=?, DEL_DTE=?, DEL_USR=? WHERE branchIndex=?");
		$this->throwExceptionOnError();

		mysqli_stmt_bind_param($stmt, 'ssssssssssssi', $item->branchID, $item->name, $item->address, $item->contactNo, $item->faxNo, $item->taxID, $item->CRE_DTE->toString('YYYY-MM-dd HH:mm:ss'), $item->CRE_USR, $item->UPD_DTE->toString('YYYY-MM-dd HH:mm:ss'), $item->UPD_USR, $item->DEL_DTE->toString('YYYY-MM-dd HH:mm:ss'), $item->DEL_USR, $item->branchIndex);
		$this->throwExceptionOnError();

		mysqli_stmt_execute($stmt);
		$this->throwExceptionOnError();

		mysqli_stmt_free_result($stmt);
		mysqli_close($this->connection);
	}

	/**
	 * Updates the passed item in the table.
	 *
	 * Add authorization or any logical checks for secure access to your data
	 *
	 * @param stdClass $item
	 * @return void
	 */
	public function myUpdate_branch($item) {

		$stmt = mysqli_prepare($this->connection, "UPDATE $this->tablename SET branchID=?, name=?, address=?, contactNo=?, faxNo=?, taxID=?, CRE_DTE=?, CRE_USR=?, UPD_DTE=?, UPD_USR=?, DEL_DTE=?, DEL_USR=? WHERE branchIndex=?");
		$this->throwExceptionOnError();

		mysqli_stmt_bind_param($stmt, 'ssssssssssssi', $item->branchID, $item->name, $item->address, $item->contactNo, $item->faxNo, $item->taxID, $item->CRE_DTE->toString('YYYY-MM-dd HH:mm:ss'), $item->CRE_USR, $item->UPD_DTE->toString('YYYY-MM-dd HH:mm:ss'), $item->UPD_USR, $item->DEL_DTE->toString('YYYY-MM-dd HH:mm:ss'), $item->DEL_USR, $item->branchIndex);
		$this->throwExceptionOnError();

		mysqli_stmt_execute($stmt);
		$this->throwExceptionOnError();

		mysqli_stmt_free_result($stmt);
		mysqli_close($this->connection);
	}

	/**
	 * Deletes the item corresponding to the passed primary key value from
	 * the table.
	 *
	 * Add authorization or any logical checks for secure access to your data
	 *
	 *
	 * @return void
	 */
	public function delete_branch($itemID) {

		$stmt = mysqli_prepare($this->connection, "DELETE FROM $this->tablename WHERE branchIndex = ?");
		$this->throwExceptionOnError();

		mysqli_stmt_bind_param($stmt, 'i', $itemID);
		mysqli_stmt_execute($stmt);
		$this->throwExceptionOnError();

		mysqli_stmt_free_result($stmt);
		mysqli_close($this->connection);
	}

	/**
	 * Returns the number of rows in the table.
	 *
	 * Add authorization or any logical checks for secure access to your data
	 *
	 *
	 */
	public function count() {
		$stmt = mysqli_prepare($this->connection, "SELECT COUNT(*) AS COUNT FROM $this->tablename");
		$this->throwExceptionOnError();

		mysqli_stmt_execute($stmt);
		$this->throwExceptionOnError();

		mysqli_stmt_bind_result($stmt, $rec_count);
		$this->throwExceptionOnError();

		mysqli_stmt_fetch($stmt);
		$this->throwExceptionOnError();

		mysqli_stmt_free_result($stmt);
		mysqli_close($this->connection);

		return $rec_count;
	}

	/**
	 * Returns $numItems rows starting from the $startIndex row from the
	 * table.
	 *
	 * Add authorization or any logical checks for secure access to your data
	 *
	 *
	 *
	 * @return array
	 */
	public function get_branch_paged($startIndex, $numItems) {

		$stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename LIMIT ?, ?");
		$this->throwExceptionOnError();

		mysqli_stmt_bind_param($stmt, 'ii', $startIndex, $numItems);
		mysqli_stmt_execute($stmt);
		$this->throwExceptionOnError();

		$rows = array();

		mysqli_stmt_bind_result($stmt, $row->branchIndex, $row->branchID, $row->name, $row->address, $row->contactNo, $row->faxNo, $row->taxID, $row->CRE_DTE, $row->CRE_USR, $row->UPD_DTE, $row->UPD_USR, $row->DEL_DTE, $row->DEL_USR);

	    while (mysqli_stmt_fetch($stmt)) {
	      $row->CRE_DTE = new DateTime($row->CRE_DTE);
	      $row->UPD_DTE = new DateTime($row->UPD_DTE);
	      $row->DEL_DTE = new DateTime($row->DEL_DTE);
	      $rows[] = $row;
	      $row = new stdClass();
	      mysqli_stmt_bind_result($stmt, $row->branchIndex, $row->branchID, $row->name, $row->address, $row->contactNo, $row->faxNo, $row->taxID, $row->CRE_DTE, $row->CRE_USR, $row->UPD_DTE, $row->UPD_USR, $row->DEL_DTE, $row->DEL_USR);
	    }

		mysqli_stmt_free_result($stmt);
		mysqli_close($this->connection);

		return $rows;
	}

	/**
	 * Utility function to throw an exception if an error occurs
	 * while running a mysql command.
	 */
	private function throwExceptionOnError($link = null) {
		if($link == null) {
			$link = $this->connection;
		}
		if(mysqli_error($link)) {
			$msg = mysqli_errno($link) . ": " . mysqli_error($link);
			throw new Exception('MySQL Error - '. $msg);
		}
	}
}

?>


text:
using System;
using UnityEngine;

namespace UnityStandardAssets.ImageEffects
{
    [RequireComponent (typeof(Camera))]
    [AddComponentMenu ("Image Effects/Camera/Tilt Shift (Lens Blur)")]
    class TiltShift : PostEffectsBase {
        public enum TiltShiftMode
        {
            TiltShiftMode,
            IrisMode,
        }
        public enum TiltShiftQuality
        {
            Preview,
			Low,
            Normal,
            High,
        }

        public TiltShiftMode mode = TiltShiftMode.TiltShiftMode;
        public TiltShiftQuality quality = TiltShiftQuality.Normal;

        [Range(0.0f, 15.0f)]
        public float blurArea = 1.0f;

        [Range(0.0f, 25.0f)]
        public float maxBlurSize = 5.0f;

        [Range(0, 1)]
        public int downsample = 0;

        public Shader tiltShiftShader = null;
        private Material tiltShiftMaterial = null;

        public override bool CheckResources () {
            CheckSupport (false);

            tiltShiftMaterial = CheckShaderAndCreateMaterial (tiltShiftShader, tiltShiftMaterial);

            if (!isSupported)
                ReportAutoDisable ();
            return isSupported;
        }

        void OnRenderImage (RenderTexture source, RenderTexture destination) {
            if (CheckResources() == false) {
                Graphics.Blit (source, destination);
                return;
            }

            tiltShiftMaterial.SetFloat("_BlurSize", maxBlurSize < 0.0f ? 0.0f : maxBlurSize);
            tiltShiftMaterial.SetFloat("_BlurArea", blurArea);
            source.filterMode = FilterMode.Bilinear;

            RenderTexture rt = destination;
            if (downsample > 0f) {
                rt = RenderTexture.GetTemporary (source.width>>downsample, source.height>>downsample, 0, source.format);
                rt.filterMode = FilterMode.Bilinear;
            }

            int basePassNr = (int) quality; basePassNr *= 2;
            Graphics.Blit (source, rt, tiltShiftMaterial, mode == TiltShiftMode.TiltShiftMode ? basePassNr : basePassNr + 1);

            if (downsample > 0) {
                tiltShiftMaterial.SetTexture ("_Blurred", rt);
                Graphics.Blit (source, destination, tiltShiftMaterial, 8);
            }

            if (rt != destination)
                RenderTexture.ReleaseTemporary (rt);
        }
    }
}


text:
package org.camunda.bpm.engine.test.standalone.pvm;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

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

import org.camunda.bpm.engine.impl.pvm.ProcessDefinitionBuilder;
import org.camunda.bpm.engine.impl.pvm.PvmExecution;
import org.camunda.bpm.engine.impl.pvm.PvmProcessDefinition;
import org.camunda.bpm.engine.impl.pvm.PvmProcessInstance;
import org.camunda.bpm.engine.impl.pvm.process.ActivityImpl;
import org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl;
import org.camunda.bpm.engine.test.standalone.pvm.activities.Automatic;
import org.camunda.bpm.engine.test.standalone.pvm.activities.EmbeddedSubProcess;
import org.camunda.bpm.engine.test.standalone.pvm.activities.End;
import org.camunda.bpm.engine.test.standalone.pvm.activities.ParallelGateway;
import org.camunda.bpm.engine.test.standalone.pvm.activities.WaitState;
import org.junit.Test;

/**
 * @author Tom Baeyens
 */
public class PvmEmbeddedSubProcessTest {

  /**
   *           +------------------------------+
   *           | embedded subprocess          |
   * +-----+   |  +-----------+   +---------+ |   +---+
   * |start|-->|  |startInside|-->|endInside| |-->|end|
   * +-----+   |  +-----------+   +---------+ |   +---+
   *           +------------------------------+
   */
  @Test
  public void testEmbeddedSubProcess() {
    PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder()
      .createActivity("start")
        .initial()
        .behavior(new Automatic())
        .transition("embeddedsubprocess")
      .endActivity()
      .createActivity("embeddedsubprocess")
        .scope()
        .behavior(new EmbeddedSubProcess())
        .createActivity("startInside")
          .behavior(new Automatic())
          .transition("endInside")
        .endActivity()
        .createActivity("endInside")
          .behavior(new End())
        .endActivity()
        .transition("end")
      .endActivity()
      .createActivity("end")
        .behavior(new WaitState())
      .endActivity()
    .buildProcessDefinition();

    PvmProcessInstance processInstance = processDefinition.createProcessInstance();
    processInstance.start();

    List<String> expectedActiveActivityIds = new ArrayList<String>();
    expectedActiveActivityIds.add("end");

    assertEquals(expectedActiveActivityIds, processInstance.findActiveActivityIds());
  }

  /**
   *           +----------------------------------------+
   *           | embeddedsubprocess        +----------+ |
   *           |                     +---->|endInside1| |
   *           |                     |     +----------+ |
   *           |                     |                  |
   * +-----+   |  +-----------+   +----+   +----------+ |   +---+
   * |start|-->|  |startInside|-->|fork|-->|endInside2| |-->|end|
   * +-----+   |  +-----------+   +----+   +----------+ |   +---+
   *           |                     |                  |
   *           |                     |     +----------+ |
   *           |                     +---->|endInside3| |
   *           |                           +----------+ |
   *           +----------------------------------------+
   */
  @Test
  public void testMultipleConcurrentEndsInsideEmbeddedSubProcess() {
    PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder()
      .createActivity("start")
        .initial()
        .behavior(new Automatic())
        .transition("embeddedsubprocess")
      .endActivity()
      .createActivity("embeddedsubprocess")
        .scope()
        .behavior(new EmbeddedSubProcess())
        .createActivity("startInside")
          .behavior(new Automatic())
          .transition("fork")
        .endActivity()
        .createActivity("fork")
          .behavior(new ParallelGateway())
          .transition("endInside1")
          .transition("endInside2")
          .transition("endInside3")
        .endActivity()
        .createActivity("endInside1")
          .behavior(new End())
        .endActivity()
        .createActivity("endInside2")
          .behavior(new End())
        .endActivity()
        .createActivity("endInside3")
          .behavior(new End())
        .endActivity()
        .transition("end")
      .endActivity()
      .createActivity("end")
        .behavior(new End())
      .endActivity()
    .buildProcessDefinition();

    PvmProcessInstance processInstance = processDefinition.createProcessInstance();
    processInstance.start();

    assertTrue(processInstance.isEnded());
  }

  /**
   *           +-------------------------------------------------+
   *           | embeddedsubprocess        +----------+          |
   *           |                     +---->|endInside1|          |
   *           |                     |     +----------+          |
   *           |                     |                           |
   * +-----+   |  +-----------+   +----+   +----+   +----------+ |   +---+
   * |start|-->|  |startInside|-->|fork|-->|wait|-->|endInside2| |-->|end|
   * +-----+   |  +-----------+   +----+   +----+   +----------+ |   +---+
   *           |                     |                           |
   *           |                     |     +----------+          |
   *           |                     +---->|endInside3|          |
   *           |                           +----------+          |
   *           +-------------------------------------------------+
   */
  @Test
  public void testMultipleConcurrentEndsInsideEmbeddedSubProcessWithWaitState() {
    PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder()
      .createActivity("start")
        .initial()
        .behavior(new Automatic())
        .transition("embeddedsubprocess")
      .endActivity()
      .createActivity("embeddedsubprocess")
        .scope()
        .behavior(new EmbeddedSubProcess())
        .createActivity("startInside")
          .behavior(new Automatic())
          .transition("fork")
        .endActivity()
        .createActivity("fork")
          .behavior(new ParallelGateway())
          .transition("endInside1")
          .transition("wait")
          .transition("endInside3")
        .endActivity()
        .createActivity("endInside1")
          .behavior(new End())
        .endActivity()
        .createActivity("wait")
          .behavior(new WaitState())
          .transition("endInside2")
        .endActivity()
        .createActivity("endInside2")
          .behavior(new End())
        .endActivity()
        .createActivity("endInside3")
          .behavior(new End())
        .endActivity()
        .transition("end")
      .endActivity()
      .createActivity("end")
        .behavior(new End())
      .endActivity()
    .buildProcessDefinition();

    PvmProcessInstance processInstance = processDefinition.createProcessInstance();
    processInstance.start();

    assertFalse(processInstance.isEnded());
    PvmExecution execution = processInstance.findExecution("wait");
    execution.signal(null, null);

    assertTrue(processInstance.isEnded());
  }

  /**
   *           +-------------------------------------------------------+
   *           | embedded subprocess                                   |
   *           |                  +--------------------------------+   |
   *           |                  | nested embedded subprocess     |   |
   * +-----+   | +-----------+    |  +-----------+   +---------+   |   |   +---+
   * |start|-->| |startInside|--> |  |startInside|-->|endInside|   |   |-->|end|
   * +-----+   | +-----------+    |  +-----------+   +---------+   |   |   +---+
   *           |                  +--------------------------------+   |
   *           |                                                       |
   *           +-------------------------------------------------------+
   */
  @Test
  public void testNestedSubProcessNoEnd() {
    PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder()
      .createActivity("start")
        .initial()
        .behavior(new Automatic())
        .transition("embeddedsubprocess")
      .endActivity()
      .createActivity("embeddedsubprocess")
        .scope()
        .behavior(new EmbeddedSubProcess())
        .createActivity("startInside")
          .behavior(new Automatic())
          .transition("nestedSubProcess")
        .endActivity()
          .createActivity("nestedSubProcess")
          .scope()
          .behavior(new EmbeddedSubProcess())
          .createActivity("startNestedInside")
            .behavior(new Automatic())
            .transition("endInside")
            .endActivity()
          .createActivity("endInside")
            .behavior(new End())
            .endActivity()
        .endActivity()
      .transition("end")
      .endActivity()
      .createActivity("end")
        .behavior(new WaitState())
      .endActivity()
    .buildProcessDefinition();

    PvmProcessInstance processInstance = processDefinition.createProcessInstance();
    processInstance.start();

    List<String> expectedActiveActivityIds = new ArrayList<String>();
    expectedActiveActivityIds.add("end");

    assertEquals(expectedActiveActivityIds, processInstance.findActiveActivityIds());
  }

  /**
   *           +------------------------------+
   *           | embedded subprocess          |
   * +-----+   |  +-----------+               |
   * |start|-->|  |startInside|               |
   * +-----+   |  +-----------+               |
   *           +------------------------------+
   */
  @Test
  public void testEmbeddedSubProcessWithoutEndEvents() {
    PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder()
      .createActivity("start")
        .initial()
        .behavior(new Automatic())
        .transition("embeddedsubprocess")
      .endActivity()
      .createActivity("embeddedsubprocess")
        .scope()
        .behavior(new EmbeddedSubProcess())
        .createActivity("startInside")
          .behavior(new Automatic())
        .endActivity()
      .endActivity()
    .buildProcessDefinition();

    PvmProcessInstance processInstance = processDefinition.createProcessInstance();
    processInstance.start();

    assertTrue(processInstance.isEnded());
  }

  /**
   *           +-------------------------------------------------------+
   *           | embedded subprocess                                   |
   *           |                  +--------------------------------+   |
   *           |                  | nested embedded subprocess     |   |
   * +-----+   | +-----------+    |  +-----------+                 |   |
   * |start|-->| |startInside|--> |  |startInside|                 |   |
   * +-----+   | +-----------+    |  +-----------+                 |   |
   *           |                  +--------------------------------+   |
   *           |                                                       |
   *           +-------------------------------------------------------+
   */
  @Test
  public void testNestedSubProcessBothNoEnd() {
    PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder()
      .createActivity("start")
        .initial()
        .behavior(new Automatic())
        .transition("embeddedsubprocess")
      .endActivity()
      .createActivity("embeddedsubprocess")
        .scope()
        .behavior(new EmbeddedSubProcess())
        .createActivity("startInside")
          .behavior(new Automatic())
          .transition("nestedSubProcess")
        .endActivity()
          .createActivity("nestedSubProcess")
          .scope()
          .behavior(new EmbeddedSubProcess())
          .createActivity("startNestedInside")
            .behavior(new Automatic())
            .endActivity()
        .endActivity()
      .endActivity()
    .buildProcessDefinition();

    PvmProcessInstance processInstance = processDefinition.createProcessInstance();
    processInstance.start();

    assertTrue(processInstance.isEnded());
  }

  /**
   *           +------------------------------+
   *           | embedded subprocess          |
   * +-----+   |  +-----------+   +---------+ |
   * |start|-->|  |startInside|-->|endInside| |
   * +-----+   |  +-----------+   +---------+ |
   *           +------------------------------+
   */
  @Test
  public void testEmbeddedSubProcessNoEnd() {
    PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder()
      .createActivity("start")
        .initial()
        .behavior(new Automatic())
        .transition("embeddedsubprocess")
      .endActivity()
      .createActivity("embeddedsubprocess")
        .scope()
        .behavior(new EmbeddedSubProcess())
        .createActivity("startInside")
          .behavior(new Automatic())
          .transition("endInside")
        .endActivity()
        .createActivity("endInside")
          .behavior(new End())
        .endActivity()
      .endActivity()
    .buildProcessDefinition();

    PvmProcessInstance processInstance = processDefinition.createProcessInstance();
    processInstance.start();

    assertTrue(processInstance.isEnded());
  }

}


text:
namespace cc {
class Layer;
}

namespace blink {

class GPUCanvasContext;
class GPUDevice;
class GPUTexture;

class GPUSwapChain : public ScriptWrappable,
                     public DawnObjectBase,
                     public WebGPUSwapBufferProvider::Client {
  DEFINE_WRAPPERTYPEINFO();

 public:
  explicit GPUSwapChain(GPUCanvasContext*,
                        GPUDevice*,
                        WGPUTextureUsage,
                        WGPUTextureFormat,
                        SkFilterQuality);
  ~GPUSwapChain() override;

  void Trace(Visitor* visitor) override;

  void Neuter();
  cc::Layer* CcLayer();
  void SetFilterQuality(SkFilterQuality);

  // gpu_swap_chain.idl
  GPUTexture* getCurrentTexture();

  // WebGPUSwapBufferProvider::Client implementation
  void OnTextureTransferred() override;

 private:
  DISALLOW_COPY_AND_ASSIGN(GPUSwapChain);

  scoped_refptr<WebGPUSwapBufferProvider> swap_buffers_;

  Member<GPUDevice> device_;
  Member<GPUCanvasContext> context_;
  WGPUTextureUsage usage_;
  WGPUTextureFormat format_;

  Member<GPUTexture> texture_;
};

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_RENDERER_MODULES_WEBGPU_GPU_SWAP_CHAIN_H_


text:
//
//  NSMutableAttributedString+HTML.h
//  DTCoreText
//
//  Created by Oliver Drobnik on 4/14/11.
//  Copyright 2011 Drobnik.com. All rights reserved.
//

#import "DTCoreTextConstants.h"

@class DTHTMLAttributedStringBuilderContext;
@class DTCoreTextParagraphStyle, DTCoreTextFontDescriptor;

/**
 Methods for appending `NSString` instances to mutable attributed strings
 */
@interface NSMutableAttributedString (HTML)

/**
 Appends a string with the same attributes as this string to this string.

 If the last character of the receiver contains a placeholder for a <DTTextAttachment> it is removed from the appended string. Also fields (e.g. list prefixes) are not extended
 @param string The string to be appended to this string. */
- (void)appendString:(NSString *)string;

/**
 Appends a string with a given paragraph style and font to this string.
 @param string The string to be appended to this string.
 @param paragraphStyle Paragraph style to be attributed to the appended string.
 @param fontDescriptor Font descriptor to be attributed to the appended string.
 @param context The context holding the stringBuilder configuration
 */
- (void)appendString:(NSString *)string withParagraphStyle:(DTCoreTextParagraphStyle *)paragraphStyle
      fontDescriptor:(DTCoreTextFontDescriptor *)fontDescriptor
             context:(DTHTMLAttributedStringBuilderContext*)context;
/**
 Adds the paragraph terminator `\n` and makes sure that the previous font and paragraph styles extend to include it
 @param context The context holding the stringBuilder configuration
 */
- (void)appendEndOfParagraphWithContext:(DTHTMLAttributedStringBuilderContext*)context;

/**
 @name Working with Custom HTML Attributes
 */

/**
 Adds the custom HTML attributes with the given value on the given range, optionally replacing occurences of an attribute with the same name.
 @param name The name of the custom HTML attribute
 @param value The value to set for the custom attribute
 @param range The range to add the custom attribute for
 @param replaceExisting `YES` if ranges that have an attribute with the same name should be replaced. With `NO` the attribute is only added for ranges where there is no attribute with the given name
 */
- (void)addHTMLAttribute:(NSString *)name value:(id)value range:(NSRange)range replaceExisting:(BOOL)replaceExisting;

/**
 Adds the custom HTML attributes with the given value from the given range.
 @param name The name of the custom HTML attribute
 @param range The range to add the custom attribute for
 */
- (void)removeHTMLAttribute:(NSString *)name range:(NSRange)range;

@end


text:
package siren.factories;

import siren.Link;

/**
 * Constructs instances of {@link Link.Builder}.
 * @author jonfreer
 * @since 8/19/17
 */
public class LinkBuilderFactory implements BuilderFactory<Link.Builder> {

    /**
     * Constructs an instance of {@link LinkBuilderFactory}.
     */
    public LinkBuilderFactory() {}

    /**
     * Constructs an instance of {@link LinkBuilderFactory}.
     * @return An instance of {@link LinkBuilderFactory}.
     */
    @Override
    public Link.Builder create() {
        return new Link.Builder();
    }
}


text:
from __future__ import print_function
import sys
from io import StringIO
from code import compile_command
import traceback

# Inspired from doctest module

# Override some StringIO methods.
class OutputCapture(StringIO):
    def getvalue(self):
        result = StringIO.getvalue(self)
        # If anything at all was written, make sure there's a trailing
        # newline.  There's no way for the expected output to indicate
        # that a trailing newline is missing.
        if result and not result.endswith("\n"):
            result += "\n"
        return result

    def truncate(self, size=None):
        self.seek(size)
        StringIO.truncate(self)
        self.buf = ''

    def write(self, content):
        if sys.version_info < (3, 0):
            content = unicode(content)
            StringIO.write(self, content)
        else:
            StringIO.write(self, content)

def get_result(code, scope, filename, multi):
    try:
        oldout = sys.stdout
        sys.stdout = OutputCapture()
        try:
            if not code.strip()[0] == '#':
                # Exec the code
                mode = "single" if not multi else "exec"
                if sys.version_info >= (3, 0):
                    exec(compile(code + "\n", filename, mode, 0, 1), scope)
                else:
                    ncode = code + "\n"
                    exec(compile(ncode, filename, mode, 0, 1), scope)
            # Get the output
            ret = sys.stdout.getvalue()
            if ret == "":
                ret = None
            if ret is not None:
                # Eval for output
                try:
                    ret = eval(ret)
                except:
                    ret = ret

            return (code, ret)
        except:
            return (code, traceback.format_exc())

    finally:
        sys.stdout = oldout

def count_start_spaces(string):
    spaces = 0

    for char in string:
        if char.isspace():
            spaces += 1
        else:
            break

    return spaces

def snippet_needs_more(snippet, filename):
    try:
        code = compile_command(snippet, filename, "single")
        if code is None:
            return True
        return False

    except:
        return False

def snippet_result(snippet, filename, scope, multi):
    try:
        if len(snippet.strip()) == 0:
            return ("", None)

        code = compile_command(snippet, filename,
                               "exec" if multi else "single")

        if code is not None:
            return get_result(snippet, scope, filename, multi)

        return (snippet, None)

    except:
        return (snippet.strip(), traceback.format_exc())

def eval_code(code, filename="stdin"):
    snippets = []

    scope = {}
    snippet = ""
    multi = False

    for line in code.strip().splitlines():
        # Count spaces
        # If zero, must evaluate (no continuation possible)
        #  (to avoid comments being eat with valid instructions)
        # Else, should concatenate until zero again
        #  and evaluate as "exec", not "single"
        cur_spaces = count_start_spaces(line)

        if ((cur_spaces > 0 or
             (len(snippet) == 0 and snippet_needs_more(line, filename)) or
             snippet_needs_more(snippet, filename))):
            snippet = snippet + line + "\n"
            multi = True
            continue

        if multi:
            res = snippet_result(snippet, filename, scope, True)
            snippet = ""
        else:
            res = snippet_result(line, filename, scope, False)

        snippets.append(res)
        multi = False

    if multi:
        res = snippet_result(snippet, filename, scope, multi)
        snippets.append(res)
    return snippets

if __name__ == "__main__":
    for snippet, res in eval_code(open(sys.argv[1]).read(), sys.argv[1]):
        for idx, line in enumerate(snippet.splitlines()):
            if idx == 0:
                print(">>>", line)
            else:
                print("...", line)
        if res is not None:
            print(res)


text:
package com.github.dakusui.scriptiveunit.drivers;

import com.github.dakusui.scriptiveunit.annotations.Scriptable;
import com.github.dakusui.scriptiveunit.model.func.Func;

import java.util.stream.Collectors;

import static java.util.Arrays.stream;
import static java.util.Objects.requireNonNull;

public class Strings {
  @SuppressWarnings("unused")
  @Scriptable
  public Func<String> substr(Func<String> str, Func<Integer> begin, Func<Integer> end) {
    return input -> requireNonNull(str.apply(input)).substring(
        requireNonNull(begin.apply(input)),
        requireNonNull(end.apply(input)));
  }

  @SuppressWarnings("unused")
  @Scriptable
  public Func<Integer> length(Func<String> str) {
    return input -> requireNonNull(str.apply(input)).length();
  }

  @SuppressWarnings("unused")
  @Scriptable
  public Func<Boolean> endsWith(Func<String> str, Func<String> a) {
    return input -> requireNonNull(str.apply(input)).endsWith(requireNonNull(a.apply(input)));
  }

  @SuppressWarnings("unused")
  @Scriptable
  public Func<Boolean> startsWith(Func<String> str, Func<String> a) {
    return input -> requireNonNull(str.apply(input)).startsWith(requireNonNull(a.apply(input)));
  }

  @SuppressWarnings("unused")
  @Scriptable
  public Func<Boolean> matches(Func<String> str, Func<String> regex) {
    return input -> requireNonNull(str.apply(input)).matches(requireNonNull(regex.apply(input)));
  }

  @SafeVarargs
  @SuppressWarnings("unused")
  @Scriptable
  public final Func<String> format(Func<String> in, Func<Object>... args) {
    return input -> String.format(requireNonNull(in.apply(input)),
        stream(args)
            .map(each -> each.apply(input))
            .collect(Collectors.toList())
            .toArray()
    );
  }
}