text:
<?php
/*
 urls to test :
 Url1: /
 Url2: /index.php
 Url3: /index.php/foo/bar
 Url4: /index.php/foo/bar?baz=2
 Url5: /index
 Url6: /index/foo/bar
 Url7: /index/foo/bar?baz=2
 Url8: /info/
 Url9: /info/index.php
 Url10: /info/index.php/foo/bar
 Url11: /info/index.php/foo/bar?baz=2
 url12: /info/index
 url13: /info/index/foo/bar
 url14: /info/index/foo/bar?baz=2
 url15: https://testapp.local:8080/index.php/foo/bar
*/

class ApacheFastcgiFPMTest extends PHPUnit_Framework_TestCase {

    protected function getFakeServer($scriptName, $url, $method='get', $body='') {
        $server = new \Jelix\FakeServerConf\ApacheCGI(null, $scriptName, '/usr/lib/cgi-bin/php5-fcgi');
        $server->setHttpRequest($url, $method, $body);
        return $server;
    }
/*
system: Linux laurent-VirtualBox 3.2.0-23-generic #36-Ubuntu SMP Tue Apr 10 20:39:51 UTC 2012 x86_64
SAPI: fpm-fcgi
PHP VERSION: 5.3.10-1ubuntu3.4

Tests here are equals to ApacheCGITest, except the value of ORIG_SCRIPT_FILENAME which is not equal.
In the apache configuration, the cgi-bin was not defined with the same value.
*/

    function testUrl1() {
        $server = $this->getFakeServer('/index.php','http://testapp.local/');
        $this->assertEquals('testapp.local',                            $_SERVER['HTTP_HOST']);
        $this->assertFalse(                                       isset($_SERVER['HTTPS']));
        $this->assertEquals('GET',                                      $_SERVER['REQUEST_METHOD']);
        $this->assertEquals('testapp.local',                            $_SERVER['SERVER_NAME']);
        $this->assertEquals('127.0.0.1',                                $_SERVER['SERVER_ADDR']);
        $this->assertEquals('80',                                       $_SERVER['SERVER_PORT']);
        $this->assertEquals('/',                                        $_SERVER['REQUEST_URI']);
        $this->assertEquals('',                                         $_SERVER['QUERY_STRING']);
        $this->assertEquals('/var/www/',                                $_SERVER['DOCUMENT_ROOT']);
        $this->assertEquals('/index.php',                               $_SERVER['SCRIPT_NAME']);
        $this->assertEquals('/var/www/index.php',                       $_SERVER['SCRIPT_FILENAME']);
        $this->assertFalse(                                       isset($_SERVER['PATH_INFO']));
        $this->assertFalse(                                       isset($_SERVER['PATH_TRANSLATED']));
        $this->assertEquals('/index.php',                               $_SERVER['PHP_SELF']);
        $this->assertEquals('/index.php',                               $_SERVER['ORIG_PATH_INFO']);
        $this->assertEquals('/var/www/index.php',                       $_SERVER['ORIG_PATH_TRANSLATED']);
        $this->assertEquals('/usr/lib/cgi-bin/php5-fcgi',               $_SERVER['ORIG_SCRIPT_FILENAME']);
        $this->assertFalse(                                       isset($_SERVER['PHPRC']));
        $this->assertEquals('/index.php',                               $_SERVER['REDIRECT_URL']);
        $this->assertFalse(                                       isset($_SERVER['CONTENT_TYPE']));
        $this->assertEquals(array (
),                                       $_GET);

        }

    function testUrl2() {
        $server = $this->getFakeServer('/index.php','http://testapp.local/index.php');
        $this->assertEquals('testapp.local',                            $_SERVER['HTTP_HOST']);
        $this->assertFalse(                                       isset($_SERVER['HTTPS']));
        $this->assertEquals('GET',                                      $_SERVER['REQUEST_METHOD']);
        $this->assertEquals('testapp.local',                            $_SERVER['SERVER_NAME']);
        $this->assertEquals('127.0.0.1',                                $_SERVER['SERVER_ADDR']);
        $this->assertEquals('80',                                       $_SERVER['SERVER_PORT']);
        $this->assertEquals('/index.php',                               $_SERVER['REQUEST_URI']);
        $this->assertEquals('',                                         $_SERVER['QUERY_STRING']);
        $this->assertEquals('/var/www/',                                $_SERVER['DOCUMENT_ROOT']);
        $this->assertEquals('/index.php',                               $_SERVER['SCRIPT_NAME']);
        $this->assertEquals('/var/www/index.php',                       $_SERVER['SCRIPT_FILENAME']);
        $this->assertFalse(                                       isset($_SERVER['PATH_INFO']));
        $this->assertFalse(                                       isset($_SERVER['PATH_TRANSLATED']));
        $this->assertEquals('/index.php',                               $_SERVER['PHP_SELF']);
        $this->assertEquals('/index.php',                               $_SERVER['ORIG_PATH_INFO']);
        $this->assertEquals('/var/www/index.php',                       $_SERVER['ORIG_PATH_TRANSLATED']);
        $this->assertEquals('/usr/lib/cgi-bin/php5-fcgi',               $_SERVER['ORIG_SCRIPT_FILENAME']);
        $this->assertFalse(                                       isset($_SERVER['PHPRC']));
        $this->assertEquals('/index.php',                               $_SERVER['REDIRECT_URL']);
        $this->assertFalse(                                       isset($_SERVER['CONTENT_TYPE']));
        $this->assertEquals(array (
),                                       $_GET);

        }

    function testUrl3() {
        $server = $this->getFakeServer('/index.php','http://testapp.local/index.php/foo/bar');
        $this->assertEquals('testapp.local',                            $_SERVER['HTTP_HOST']);
        $this->assertFalse(                                       isset($_SERVER['HTTPS']));
        $this->assertEquals('GET',                                      $_SERVER['REQUEST_METHOD']);
        $this->assertEquals('testapp.local',                            $_SERVER['SERVER_NAME']);
        $this->assertEquals('127.0.0.1',                                $_SERVER['SERVER_ADDR']);
        $this->assertEquals('80',                                       $_SERVER['SERVER_PORT']);
        $this->assertEquals('/index.php/foo/bar',                       $_SERVER['REQUEST_URI']);
        $this->assertEquals('',                                         $_SERVER['QUERY_STRING']);
        $this->assertEquals('/var/www/',                                $_SERVER['DOCUMENT_ROOT']);
        $this->assertEquals('/index.php',                               $_SERVER['SCRIPT_NAME']);
        $this->assertEquals('/var/www/index.php',                       $_SERVER['SCRIPT_FILENAME']);
        $this->assertEquals('/foo/bar',                                 $_SERVER['PATH_INFO']);
        $this->assertEquals('/var/www/foo/bar',                         $_SERVER['PATH_TRANSLATED']);
        $this->assertEquals('/index.php/foo/bar',                       $_SERVER['PHP_SELF']);
        $this->assertEquals('/index.php/foo/bar',                       $_SERVER['ORIG_PATH_INFO']);
        $this->assertEquals('/var/www/index.php/foo/bar',               $_SERVER['ORIG_PATH_TRANSLATED']);
        $this->assertEquals('/usr/lib/cgi-bin/php5-fcgi',               $_SERVER['ORIG_SCRIPT_FILENAME']);
        $this->assertFalse(                                       isset($_SERVER['PHPRC']));
        $this->assertEquals('/index.php/foo/bar',                       $_SERVER['REDIRECT_URL']);
        $this->assertFalse(                                       isset($_SERVER['CONTENT_TYPE']));
        $this->assertEquals(array (
),                                       $_GET);

        }

    function testUrl4() {
        $server = $this->getFakeServer('/index.php','http://testapp.local/index.php/foo/bar?baz=2');
        $this->assertEquals('testapp.local',                            $_SERVER['HTTP_HOST']);
        $this->assertFalse(                                       isset($_SERVER['HTTPS']));
        $this->assertEquals('GET',                                      $_SERVER['REQUEST_METHOD']);
        $this->assertEquals('testapp.local',                            $_SERVER['SERVER_NAME']);
        $this->assertEquals('127.0.0.1',                                $_SERVER['SERVER_ADDR']);
        $this->assertEquals('80',                                       $_SERVER['SERVER_PORT']);
        $this->assertEquals('/index.php/foo/bar?baz=2',                 $_SERVER['REQUEST_URI']);
        $this->assertEquals('baz=2',                                    $_SERVER['QUERY_STRING']);
        $this->assertEquals('/var/www/',                                $_SERVER['DOCUMENT_ROOT']);
        $this->assertEquals('/index.php',                               $_SERVER['SCRIPT_NAME']);
        $this->assertEquals('/var/www/index.php',                       $_SERVER['SCRIPT_FILENAME']);
        $this->assertEquals('/foo/bar',                                 $_SERVER['PATH_INFO']);
        $this->assertEquals('/var/www/foo/bar',                         $_SERVER['PATH_TRANSLATED']);
        $this->assertEquals('/index.php/foo/bar',                       $_SERVER['PHP_SELF']);
        $this->assertEquals('/index.php/foo/bar',                       $_SERVER['ORIG_PATH_INFO']);
        $this->assertEquals('/var/www/index.php/foo/bar',               $_SERVER['ORIG_PATH_TRANSLATED']);
        $this->assertEquals('/usr/lib/cgi-bin/php5-fcgi',               $_SERVER['ORIG_SCRIPT_FILENAME']);
        $this->assertFalse(                                       isset($_SERVER['PHPRC']));
        $this->assertEquals('/index.php/foo/bar',                       $_SERVER['REDIRECT_URL']);
        $this->assertFalse(                                       isset($_SERVER['CONTENT_TYPE']));
        $this->assertEquals(array (
  'baz' => '2',
),                                       $_GET);

        }

    function testUrl5() {
        $server = $this->getFakeServer('/index.php','http://testapp.local/index');
        $this->assertEquals('testapp.local',                            $_SERVER['HTTP_HOST']);
        $this->assertFalse(                                       isset($_SERVER['HTTPS']));
        $this->assertEquals('GET',                                      $_SERVER['REQUEST_METHOD']);
        $this->assertEquals('testapp.local',                            $_SERVER['SERVER_NAME']);
        $this->assertEquals('127.0.0.1',                                $_SERVER['SERVER_ADDR']);
        $this->assertEquals('80',                                       $_SERVER['SERVER_PORT']);
        $this->assertEquals('/index',                                   $_SERVER['REQUEST_URI']);
        $this->assertEquals('',                                         $_SERVER['QUERY_STRING']);
        $this->assertEquals('/var/www/',                                $_SERVER['DOCUMENT_ROOT']);
        $this->assertEquals('/index.php',                               $_SERVER['SCRIPT_NAME']);
        $this->assertEquals('/var/www/index.php',                       $_SERVER['SCRIPT_FILENAME']);
        $this->assertFalse(                                       isset($_SERVER['PATH_INFO']));
        $this->assertFalse(                                       isset($_SERVER['PATH_TRANSLATED']));
        $this->assertEquals('/index.php',                               $_SERVER['PHP_SELF']);
        $this->assertEquals('/index.php',                               $_SERVER['ORIG_PATH_INFO']);
        $this->assertEquals('/var/www/index.php',                       $_SERVER['ORIG_PATH_TRANSLATED']);
        $this->assertEquals('/usr/lib/cgi-bin/php5-fcgi',               $_SERVER['ORIG_SCRIPT_FILENAME']);
        $this->assertFalse(                                       isset($_SERVER['PHPRC']));
        $this->assertEquals('/index.php',                               $_SERVER['REDIRECT_URL']);
        $this->assertFalse(                                       isset($_SERVER['CONTENT_TYPE']));
        $this->assertEquals(array (
),                                       $_GET);

        }

    function testUrl6() {
        $server = $this->getFakeServer('/index.php','http://testapp.local/index/foo/bar');
        $this->assertEquals('testapp.local',                            $_SERVER['HTTP_HOST']);
        $this->assertFalse(                                       isset($_SERVER['HTTPS']));
        $this->assertEquals('GET',                                      $_SERVER['REQUEST_METHOD']);
        $this->assertEquals('testapp.local',                            $_SERVER['SERVER_NAME']);
        $this->assertEquals('127.0.0.1',                                $_SERVER['SERVER_ADDR']);
        $this->assertEquals('80',                                       $_SERVER['SERVER_PORT']);
        $this->assertEquals('/index/foo/bar',                           $_SERVER['REQUEST_URI']);
        $this->assertEquals('',                                         $_SERVER['QUERY_STRING']);
        $this->assertEquals('/var/www/',                                $_SERVER['DOCUMENT_ROOT']);
        $this->assertEquals('/index.php',                               $_SERVER['SCRIPT_NAME']);
        $this->assertEquals('/var/www/index.php',                       $_SERVER['SCRIPT_FILENAME']);
        $this->assertEquals('/foo/bar',                                 $_SERVER['PATH_INFO']);
        $this->assertEquals('/var/www/foo/bar',                         $_SERVER['PATH_TRANSLATED']);
        $this->assertEquals('/index.php/foo/bar',                       $_SERVER['PHP_SELF']);
        $this->assertEquals('/index.php/foo/bar',                       $_SERVER['ORIG_PATH_INFO']);
        $this->assertEquals('/var/www/index.php/foo/bar',               $_SERVER['ORIG_PATH_TRANSLATED']);
        $this->assertEquals('/usr/lib/cgi-bin/php5-fcgi',               $_SERVER['ORIG_SCRIPT_FILENAME']);
        $this->assertFalse(                                       isset($_SERVER['PHPRC']));
        $this->assertEquals('/index.php/foo/bar',                       $_SERVER['REDIRECT_URL']);
        $this->assertFalse(                                       isset($_SERVER['CONTENT_TYPE']));
        $this->assertEquals(array (
),                                       $_GET);

        }

    function testUrl7() {
        $server = $this->getFakeServer('/index.php','http://testapp.local/index/foo/bar?baz=2');
        $this->assertEquals('testapp.local',                            $_SERVER['HTTP_HOST']);
        $this->assertFalse(                                       isset($_SERVER['HTTPS']));
        $this->assertEquals('GET',                                      $_SERVER['REQUEST_METHOD']);
        $this->assertEquals('testapp.local',                            $_SERVER['SERVER_NAME']);
        $this->assertEquals('127.0.0.1',                                $_SERVER['SERVER_ADDR']);
        $this->assertEquals('80',                                       $_SERVER['SERVER_PORT']);
        $this->assertEquals('/index/foo/bar?baz=2',                     $_SERVER['REQUEST_URI']);
        $this->assertEquals('baz=2',                                    $_SERVER['QUERY_STRING']);
        $this->assertEquals('/var/www/',                                $_SERVER['DOCUMENT_ROOT']);
        $this->assertEquals('/index.php',                               $_SERVER['SCRIPT_NAME']);
        $this->assertEquals('/var/www/index.php',                       $_SERVER['SCRIPT_FILENAME']);
        $this->assertEquals('/foo/bar',                                 $_SERVER['PATH_INFO']);
        $this->assertEquals('/var/www/foo/bar',                         $_SERVER['PATH_TRANSLATED']);
        $this->assertEquals('/index.php/foo/bar',                       $_SERVER['PHP_SELF']);
        $this->assertEquals('/index.php/foo/bar',                       $_SERVER['ORIG_PATH_INFO']);
        $this->assertEquals('/var/www/index.php/foo/bar',               $_SERVER['ORIG_PATH_TRANSLATED']);
        $this->assertEquals('/usr/lib/cgi-bin/php5-fcgi',               $_SERVER['ORIG_SCRIPT_FILENAME']);
        $this->assertFalse(                                       isset($_SERVER['PHPRC']));
        $this->assertEquals('/index.php/foo/bar',                       $_SERVER['REDIRECT_URL']);
        $this->assertFalse(                                       isset($_SERVER['CONTENT_TYPE']));
        $this->assertEquals(array (
  'baz' => '2',
),                                       $_GET);

        }

    function testUrl8() {
        $server = $this->getFakeServer('/info/index.php','http://testapp.local/info/');
        $this->assertEquals('testapp.local',                            $_SERVER['HTTP_HOST']);
        $this->assertFalse(                                       isset($_SERVER['HTTPS']));
        $this->assertEquals('GET',                                      $_SERVER['REQUEST_METHOD']);
        $this->assertEquals('testapp.local',                            $_SERVER['SERVER_NAME']);
        $this->assertEquals('127.0.0.1',                                $_SERVER['SERVER_ADDR']);
        $this->assertEquals('80',                                       $_SERVER['SERVER_PORT']);
        $this->assertEquals('/info/',                                   $_SERVER['REQUEST_URI']);
        $this->assertEquals('',                                         $_SERVER['QUERY_STRING']);
        $this->assertEquals('/var/www/',                                $_SERVER['DOCUMENT_ROOT']);
        $this->assertEquals('/info/index.php',                          $_SERVER['SCRIPT_NAME']);
        $this->assertEquals('/var/www/info/index.php',                  $_SERVER['SCRIPT_FILENAME']);
        $this->assertFalse(                                       isset($_SERVER['PATH_INFO']));
        $this->assertFalse(                                       isset($_SERVER['PATH_TRANSLATED']));
        $this->assertEquals('/info/index.php',                          $_SERVER['PHP_SELF']);
        $this->assertEquals('/info/index.php',                          $_SERVER['ORIG_PATH_INFO']);
        $this->assertEquals('/var/www/info/index.php',                  $_SERVER['ORIG_PATH_TRANSLATED']);
        $this->assertEquals('/usr/lib/cgi-bin/php5-fcgi',               $_SERVER['ORIG_SCRIPT_FILENAME']);
        $this->assertFalse(                                       isset($_SERVER['PHPRC']));
        $this->assertEquals('/info/index.php',                          $_SERVER['REDIRECT_URL']);
        $this->assertFalse(                                       isset($_SERVER['CONTENT_TYPE']));
        $this->assertEquals(array (
),                                       $_GET);

        }

    function testUrl9() {
        $server = $this->getFakeServer('/info/index.php','http://testapp.local/info/index.php');
        $this->assertEquals('testapp.local',                            $_SERVER['HTTP_HOST']);
        $this->assertFalse(                                       isset($_SERVER['HTTPS']));
        $this->assertEquals('GET',                                      $_SERVER['REQUEST_METHOD']);
        $this->assertEquals('testapp.local',                            $_SERVER['SERVER_NAME']);
        $this->assertEquals('127.0.0.1',                                $_SERVER['SERVER_ADDR']);
        $this->assertEquals('80',                                       $_SERVER['SERVER_PORT']);
        $this->assertEquals('/info/index.php',                          $_SERVER['REQUEST_URI']);
        $this->assertEquals('',                                         $_SERVER['QUERY_STRING']);
        $this->assertEquals('/var/www/',                                $_SERVER['DOCUMENT_ROOT']);
        $this->assertEquals('/info/index.php',                          $_SERVER['SCRIPT_NAME']);
        $this->assertEquals('/var/www/info/index.php',                  $_SERVER['SCRIPT_FILENAME']);
        $this->assertFalse(                                       isset($_SERVER['PATH_INFO']));
        $this->assertFalse(                                       isset($_SERVER['PATH_TRANSLATED']));
        $this->assertEquals('/info/index.php',                          $_SERVER['PHP_SELF']);
        $this->assertEquals('/info/index.php',                          $_SERVER['ORIG_PATH_INFO']);
        $this->assertEquals('/var/www/info/index.php',                  $_SERVER['ORIG_PATH_TRANSLATED']);
        $this->assertEquals('/usr/lib/cgi-bin/php5-fcgi',               $_SERVER['ORIG_SCRIPT_FILENAME']);
        $this->assertFalse(                                       isset($_SERVER['PHPRC']));
        $this->assertEquals('/info/index.php',                          $_SERVER['REDIRECT_URL']);
        $this->assertFalse(                                       isset($_SERVER['CONTENT_TYPE']));
        $this->assertEquals(array (
),                                       $_GET);

        }

    function testUrl10() {
        $server = $this->getFakeServer('/info/index.php','http://testapp.local/info/index.php/foo/bar');
        $this->assertEquals('testapp.local',                            $_SERVER['HTTP_HOST']);
        $this->assertFalse(                                       isset($_SERVER['HTTPS']));
        $this->assertEquals('GET',                                      $_SERVER['REQUEST_METHOD']);
        $this->assertEquals('testapp.local',                            $_SERVER['SERVER_NAME']);
        $this->assertEquals('127.0.0.1',                                $_SERVER['SERVER_ADDR']);
        $this->assertEquals('80',                                       $_SERVER['SERVER_PORT']);
        $this->assertEquals('/info/index.php/foo/bar',                  $_SERVER['REQUEST_URI']);
        $this->assertEquals('',                                         $_SERVER['QUERY_STRING']);
        $this->assertEquals('/var/www/',                                $_SERVER['DOCUMENT_ROOT']);
        $this->assertEquals('/info/index.php',                          $_SERVER['SCRIPT_NAME']);
        $this->assertEquals('/var/www/info/index.php',                  $_SERVER['SCRIPT_FILENAME']);
        $this->assertEquals('/foo/bar',                                 $_SERVER['PATH_INFO']);
        $this->assertEquals('/var/www/foo/bar',                         $_SERVER['PATH_TRANSLATED']);
        $this->assertEquals('/info/index.php/foo/bar',                  $_SERVER['PHP_SELF']);
        $this->assertEquals('/info/index.php/foo/bar',                  $_SERVER['ORIG_PATH_INFO']);
        $this->assertEquals('/var/www/info/index.php/foo/bar',          $_SERVER['ORIG_PATH_TRANSLATED']);
        $this->assertEquals('/usr/lib/cgi-bin/php5-fcgi',               $_SERVER['ORIG_SCRIPT_FILENAME']);
        $this->assertFalse(                                       isset($_SERVER['PHPRC']));
        $this->assertEquals('/info/index.php/foo/bar',                  $_SERVER['REDIRECT_URL']);
        $this->assertFalse(                                       isset($_SERVER['CONTENT_TYPE']));
        $this->assertEquals(array (
),                                       $_GET);

        }

    function testUrl11() {
        $server = $this->getFakeServer('/info/index.php','http://testapp.local/info/index.php/foo/bar?baz=2');
        $this->assertEquals('testapp.local',                            $_SERVER['HTTP_HOST']);
        $this->assertFalse(                                       isset($_SERVER['HTTPS']));
        $this->assertEquals('GET',                                      $_SERVER['REQUEST_METHOD']);
        $this->assertEquals('testapp.local',                            $_SERVER['SERVER_NAME']);
        $this->assertEquals('127.0.0.1',                                $_SERVER['SERVER_ADDR']);
        $this->assertEquals('80',                                       $_SERVER['SERVER_PORT']);
        $this->assertEquals('/info/index.php/foo/bar?baz=2',            $_SERVER['REQUEST_URI']);
        $this->assertEquals('baz=2',                                    $_SERVER['QUERY_STRING']);
        $this->assertEquals('/var/www/',                                $_SERVER['DOCUMENT_ROOT']);
        $this->assertEquals('/info/index.php',                          $_SERVER['SCRIPT_NAME']);
        $this->assertEquals('/var/www/info/index.php',                  $_SERVER['SCRIPT_FILENAME']);
        $this->assertEquals('/foo/bar',                                 $_SERVER['PATH_INFO']);
        $this->assertEquals('/var/www/foo/bar',                         $_SERVER['PATH_TRANSLATED']);
        $this->assertEquals('/info/index.php/foo/bar',                  $_SERVER['PHP_SELF']);
        $this->assertEquals('/info/index.php/foo/bar',                  $_SERVER['ORIG_PATH_INFO']);
        $this->assertEquals('/var/www/info/index.php/foo/bar',          $_SERVER['ORIG_PATH_TRANSLATED']);
        $this->assertEquals('/usr/lib/cgi-bin/php5-fcgi',               $_SERVER['ORIG_SCRIPT_FILENAME']);
        $this->assertFalse(                                       isset($_SERVER['PHPRC']));
        $this->assertEquals('/info/index.php/foo/bar',                  $_SERVER['REDIRECT_URL']);
        $this->assertFalse(                                       isset($_SERVER['CONTENT_TYPE']));
        $this->assertEquals(array (
  'baz' => '2',
),                                       $_GET);

        }

    function testUrl12() {
        $server = $this->getFakeServer('/info/index.php','http://testapp.local/info/index');
        $this->assertEquals('testapp.local',                            $_SERVER['HTTP_HOST']);
        $this->assertFalse(                                       isset($_SERVER['HTTPS']));
        $this->assertEquals('GET',                                      $_SERVER['REQUEST_METHOD']);
        $this->assertEquals('testapp.local',                            $_SERVER['SERVER_NAME']);
        $this->assertEquals('127.0.0.1',                                $_SERVER['SERVER_ADDR']);
        $this->assertEquals('80',                                       $_SERVER['SERVER_PORT']);
        $this->assertEquals('/info/index',                              $_SERVER['REQUEST_URI']);
        $this->assertEquals('',                                         $_SERVER['QUERY_STRING']);
        $this->assertEquals('/var/www/',                                $_SERVER['DOCUMENT_ROOT']);
        $this->assertEquals('/info/index.php',                          $_SERVER['SCRIPT_NAME']);
        $this->assertEquals('/var/www/info/index.php',                  $_SERVER['SCRIPT_FILENAME']);
        $this->assertFalse(                                       isset($_SERVER['PATH_INFO']));
        $this->assertFalse(                                       isset($_SERVER['PATH_TRANSLATED']));
        $this->assertEquals('/info/index.php',                          $_SERVER['PHP_SELF']);
        $this->assertEquals('/info/index.php',                          $_SERVER['ORIG_PATH_INFO']);
        $this->assertEquals('/var/www/info/index.php',                  $_SERVER['ORIG_PATH_TRANSLATED']);
        $this->assertEquals('/usr/lib/cgi-bin/php5-fcgi',               $_SERVER['ORIG_SCRIPT_FILENAME']);
        $this->assertFalse(                                       isset($_SERVER['PHPRC']));
        $this->assertEquals('/info/index.php',                          $_SERVER['REDIRECT_URL']);
        $this->assertFalse(                                       isset($_SERVER['CONTENT_TYPE']));
        $this->assertEquals(array (
),                                       $_GET);

        }

    function testUrl13() {
        $server = $this->getFakeServer('/info/index.php','http://testapp.local/info/index/foo/bar');
        $this->assertEquals('testapp.local',                            $_SERVER['HTTP_HOST']);
        $this->assertFalse(                                       isset($_SERVER['HTTPS']));
        $this->assertEquals('GET',                                      $_SERVER['REQUEST_METHOD']);
        $this->assertEquals('testapp.local',                            $_SERVER['SERVER_NAME']);
        $this->assertEquals('127.0.0.1',                                $_SERVER['SERVER_ADDR']);
        $this->assertEquals('80',                                       $_SERVER['SERVER_PORT']);
        $this->assertEquals('/info/index/foo/bar',                      $_SERVER['REQUEST_URI']);
        $this->assertEquals('',                                         $_SERVER['QUERY_STRING']);
        $this->assertEquals('/var/www/',                                $_SERVER['DOCUMENT_ROOT']);
        $this->assertEquals('/info/index.php',                          $_SERVER['SCRIPT_NAME']);
        $this->assertEquals('/var/www/info/index.php',                  $_SERVER['SCRIPT_FILENAME']);
        $this->assertEquals('/foo/bar',                                 $_SERVER['PATH_INFO']);
        $this->assertEquals('/var/www/foo/bar',                         $_SERVER['PATH_TRANSLATED']);
        $this->assertEquals('/info/index.php/foo/bar',                  $_SERVER['PHP_SELF']);
        $this->assertEquals('/info/index.php/foo/bar',                  $_SERVER['ORIG_PATH_INFO']);
        $this->assertEquals('/var/www/info/index.php/foo/bar',          $_SERVER['ORIG_PATH_TRANSLATED']);
        $this->assertEquals('/usr/lib/cgi-bin/php5-fcgi',               $_SERVER['ORIG_SCRIPT_FILENAME']);
        $this->assertFalse(                                       isset($_SERVER['PHPRC']));
        $this->assertEquals('/info/index.php/foo/bar',                  $_SERVER['REDIRECT_URL']);
        $this->assertFalse(                                       isset($_SERVER['CONTENT_TYPE']));
        $this->assertEquals(array (
),                                       $_GET);

        }

    function testUrl14() {
        $server = $this->getFakeServer('/info/index.php','http://testapp.local/info/index/foo/bar?baz=2');
        $this->assertEquals('testapp.local',                            $_SERVER['HTTP_HOST']);
        $this->assertFalse(                                       isset($_SERVER['HTTPS']));
        $this->assertEquals('GET',                                      $_SERVER['REQUEST_METHOD']);
        $this->assertEquals('testapp.local',                            $_SERVER['SERVER_NAME']);
        $this->assertEquals('127.0.0.1',                                $_SERVER['SERVER_ADDR']);
        $this->assertEquals('80',                                       $_SERVER['SERVER_PORT']);
        $this->assertEquals('/info/index/foo/bar?baz=2',                $_SERVER['REQUEST_URI']);
        $this->assertEquals('baz=2',                                    $_SERVER['QUERY_STRING']);
        $this->assertEquals('/var/www/',                                $_SERVER['DOCUMENT_ROOT']);
        $this->assertEquals('/info/index.php',                          $_SERVER['SCRIPT_NAME']);
        $this->assertEquals('/var/www/info/index.php',                  $_SERVER['SCRIPT_FILENAME']);
        $this->assertEquals('/foo/bar',                                 $_SERVER['PATH_INFO']);
        $this->assertEquals('/var/www/foo/bar',                         $_SERVER['PATH_TRANSLATED']);
        $this->assertEquals('/info/index.php/foo/bar',                  $_SERVER['PHP_SELF']);
        $this->assertEquals('/info/index.php/foo/bar',                  $_SERVER['ORIG_PATH_INFO']);
        $this->assertEquals('/var/www/info/index.php/foo/bar',          $_SERVER['ORIG_PATH_TRANSLATED']);
        $this->assertEquals('/usr/lib/cgi-bin/php5-fcgi',               $_SERVER['ORIG_SCRIPT_FILENAME']);
        $this->assertFalse(                                       isset($_SERVER['PHPRC']));
        $this->assertEquals('/info/index.php/foo/bar',                  $_SERVER['REDIRECT_URL']);
        $this->assertFalse(                                       isset($_SERVER['CONTENT_TYPE']));
        $this->assertEquals(array (
  'baz' => '2',
),                                       $_GET);

        }

    function testUrl15() {
        $server = $this->getFakeServer('/index.php','http://testapp.local/index','post','aaa=bbb');
        $this->assertEquals('testapp.local',                            $_SERVER['HTTP_HOST']);
        $this->assertFalse(                                       isset($_SERVER['HTTPS']));
        $this->assertEquals('POST',                                     $_SERVER['REQUEST_METHOD']);
        $this->assertEquals('testapp.local',                            $_SERVER['SERVER_NAME']);
        $this->assertEquals('127.0.0.1',                                $_SERVER['SERVER_ADDR']);
        $this->assertEquals('80',                                       $_SERVER['SERVER_PORT']);
        $this->assertEquals('/index',                                   $_SERVER['REQUEST_URI']);
        $this->assertEquals('',                                         $_SERVER['QUERY_STRING']);
        $this->assertEquals('/var/www/',                                $_SERVER['DOCUMENT_ROOT']);
        $this->assertEquals('/index.php',                               $_SERVER['SCRIPT_NAME']);
        $this->assertEquals('/var/www/index.php',                       $_SERVER['SCRIPT_FILENAME']);
        $this->assertFalse(                                       isset($_SERVER['PATH_INFO']));
        $this->assertFalse(                                       isset($_SERVER['PATH_TRANSLATED']));
        $this->assertEquals('/index.php',                               $_SERVER['PHP_SELF']);
        $this->assertEquals('/index.php',                               $_SERVER['ORIG_PATH_INFO']);
        $this->assertEquals('/var/www/index.php',                       $_SERVER['ORIG_PATH_TRANSLATED']);
        $this->assertEquals('/usr/lib/cgi-bin/php5-fcgi',               $_SERVER['ORIG_SCRIPT_FILENAME']);
        $this->assertFalse(                                       isset($_SERVER['PHPRC']));
        $this->assertEquals('/index.php',                               $_SERVER['REDIRECT_URL']);
        $this->assertEquals('application/x-www-form-urlencoded',        $_SERVER['CONTENT_TYPE']);
        $this->assertEquals(array (
),                                       $_GET);
        $this->assertEquals(array (
  'aaa' => 'bbb',
),                                       $_POST);

        }

    function testUrl16() {
        $server = $this->getFakeServer('/index.php','http://testapp.local/index/foo/bar','post','aaa=bbb');
        $this->assertEquals('testapp.local',                            $_SERVER['HTTP_HOST']);
        $this->assertFalse(                                       isset($_SERVER['HTTPS']));
        $this->assertEquals('POST',                                     $_SERVER['REQUEST_METHOD']);
        $this->assertEquals('testapp.local',                            $_SERVER['SERVER_NAME']);
        $this->assertEquals('127.0.0.1',                                $_SERVER['SERVER_ADDR']);
        $this->assertEquals('80',                                       $_SERVER['SERVER_PORT']);
        $this->assertEquals('/index/foo/bar',                           $_SERVER['REQUEST_URI']);
        $this->assertEquals('',                                         $_SERVER['QUERY_STRING']);
        $this->assertEquals('/var/www/',                                $_SERVER['DOCUMENT_ROOT']);
        $this->assertEquals('/index.php',                               $_SERVER['SCRIPT_NAME']);
        $this->assertEquals('/var/www/index.php',                       $_SERVER['SCRIPT_FILENAME']);
        $this->assertEquals('/foo/bar',                                 $_SERVER['PATH_INFO']);
        $this->assertEquals('/var/www/foo/bar',                         $_SERVER['PATH_TRANSLATED']);
        $this->assertEquals('/index.php/foo/bar',                       $_SERVER['PHP_SELF']);
        $this->assertEquals('/index.php/foo/bar',                       $_SERVER['ORIG_PATH_INFO']);
        $this->assertEquals('/var/www/index.php/foo/bar',               $_SERVER['ORIG_PATH_TRANSLATED']);
        $this->assertEquals('/usr/lib/cgi-bin/php5-fcgi',               $_SERVER['ORIG_SCRIPT_FILENAME']);
        $this->assertFalse(                                       isset($_SERVER['PHPRC']));
        $this->assertEquals('/index.php/foo/bar',                       $_SERVER['REDIRECT_URL']);
        $this->assertEquals('application/x-www-form-urlencoded',        $_SERVER['CONTENT_TYPE']);
        $this->assertEquals(array (
),                                       $_GET);
        $this->assertEquals(array (
  'aaa' => 'bbb',
),                                       $_POST);

        }

}


text:
// ***************************************** //
//  Algorithme d'Edmonds Karp pour les graphes
//      non orientes.
//  SP 2003
// ***************************************** //
package mascoptLib.algos.graph;

// MascoptLib
import mascoptLib.graphs.*;
import mascoptLib.algos.digraph.MinCut;
import mascoptLib.abstractGraph.MascoptFixedSet;

// Java
import java.util.*;

/**
 * Provides an algorithm to compute a s-t cut min in a graph.
 *
 * We consider the digraph associated to the graph given and we
 * apply the algorithm of Edmonds Karps (which is implemented in
 * the class MinCut).
 * The name of the capacities is "capacity" but can be change (CAPACITY="name_given")
 * It is necessary to define the value of the variable INFINITY (which equals 999999)
 * if some capacity is greater than the default value.
 *
 * Entries : A graph g and the two vertices to consider (s,t).
 * Results : vertexSetCutMin() returns the set of vertices which give the minimal cut
 *           edgeSetCutMin() returns the set of edges which belong to the minimal cut
 *           minCutValue() returns the value of the minimal cut
 */
public class STMinCut {
    private Graph g_;
    private Vertex s_;
    private Vertex t_;
    private EdgeSet es;
    private VertexSet ns;
    private VertexSet nodecutmin;
    private EdgeSet edgecutmin = new EdgeSet(ns);

    /**
     * The string used to search the capacity on edges.
     */
    public String CAPACITY = "capacity";

    /**
     * A constant for the "infinity" number.
     */
    public double INFINITY = Double.MAX_VALUE;

    /**
     * Build the algorithm on a graph.
     * s and t are the two vertices to consider for the cut.
     *
     * @param g the graph
     * @param s the first vertex
     * @param t the second vertex
     */
    public STMinCut(Graph g, Vertex s, Vertex t) {
        g_ = g;
        s_ = s;
        t_ = t;
        es = g_.getEdgeSet();
        ns = g_.getVertexSet();
    }

    // transformation du graphe g non oriente en un grahe gd oriente
    // (chaque arete est transformee en 2 arcs de sens inverse et de meme
    // capacite
    private DiGraph orientation() {
        VertexSet Vd = g_.getVertexSet();
        ArcSet Ad = new ArcSet(Vd);
        DiGraph Gd = new DiGraph(Vd, Ad);
        double cap;

        Iterator ites = es.iterator();

        while (ites.hasNext()) {
            Edge currentEdge = (Edge) ites.next();
            Vertex[] ext = currentEdge.getVertices();
            Arc forward = new Arc(ext[0], ext[1]);
            cap = currentEdge.getDouValue(CAPACITY);
            forward.setDouValue(CAPACITY, cap);

            Arc backward = new Arc(ext[1], ext[0]);
            backward.setDouValue(CAPACITY, cap);
            Ad.add(forward);
            Ad.add(backward);
        }

        return Gd;
    }

    /**
     * Returns the set for the min cut.
     *
     * @return a vertex set
     */
    public VertexSet vertexSetCutMin() {
        DiGraph diG = this.orientation();
        MinCut coupeGd = new MinCut(diG, s_, t_);
        coupeGd.CAPACITY = CAPACITY;
        coupeGd.INFINITY = INFINITY;
        coupeGd.run();
        nodecutmin = coupeGd.vertexSetCutMin();

        return nodecutmin;
    }

    /**
     * Returns the edges of the min cut
     *
     * @return an edge set.
     */
    public EdgeSet edgeSetCutMin() {
        Vertex ncurrent;
        Vertex neighbour;
        Edge ecurrent;
        VertexSet nodec;

        if (nodecutmin.isEmpty()) {
            nodec = this.vertexSetCutMin();
        }

        Iterator nodesIt = nodecutmin.iterator();

        while (nodesIt.hasNext()) {
            ncurrent = (Vertex) nodesIt.next();

            // on recupere les aretes incidentes au sommet courant
            MascoptFixedSet esetcurrent = ncurrent.getIncidentEdges(g_);

            // on regarde si l'autre extremite de l'arete est dans S,sinon,
            // l'arete appartient a la coupe min
            Iterator edgesIt = esetcurrent.iterator();

            while (edgesIt.hasNext()) {
                ecurrent = (Edge) edgesIt.next();
                neighbour = (Vertex) ecurrent.getConnected(ncurrent);

                if (!nodecutmin.contains(neighbour)) {
                    edgecutmin.add(ecurrent);
                }
            }
        }

        return edgecutmin;
    }

    /**
     * Computes the value of the min cut.
     *
     * @return a double
     */
    public double minCutValue() {
        EdgeSet esmin;
        double value;

        value = 0.0;

        if (edgecutmin.isEmpty()) {
            esmin = this.edgeSetCutMin();
        }
	else {
            esmin = edgecutmin;
        }

        Iterator itesmin = esmin.iterator();

        while (itesmin.hasNext()) {
            Edge ecur = (Edge) itesmin.next();
            value = value + ecur.getDouValue(CAPACITY);
        }

        return value;
    }
}

redpajama_set_name: RedPajamaGithub


text:
@interface ProductViewController : UIViewController<UITableViewDataSource, UITableViewDelegate>
{
    NSMutableArray *dataSource;
}

@property(nonatomic, retain) NSManagedObjectContext *managedObjectContext;

@end


text:
This is a demonstration application for the [Termbox UI Kit library](https://www.github.com/gabriel-comeau/termbox-uikit)

To run it, you'll also need the server running, found at: [SimpleChatServer](https://www.github.com/gabriel-comeau/SimpleChatServer)


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ReferralsReboot.Model
{
    public class Subject
    {
        public int Id { get; set; }
        public string LongName { get; set; }
        public string ShortName { get; set; }
    }
}


text:
OAuth::CLI::Twitter
===================

Description
-----------

Twitter OAuth interface for CLI applications.

Usage
-----

### Interface

 * simple

        require 'oauth/cli/twitter'

        access_token = OAuth::CLI::Twitter.get_access_token(:pit => 'oauth-cli-twitter-simple')
        access_token.post(
          'http://twitter.com/statuses/update.json',
          'status'=> 'hello from ruby-oauth-cli-twitter simple example'
        )

 * define constants

        require 'rubygems'
        require 'rubytter'
        require 'oauth/cli/twitter'

        CONSUMER_TOKEN  = '358RyJ77o4BYJUViVRQ'
        CONSUMER_SECRET = 'aOHsTInoyOjNewpvC9c5uwBqF3XOd5xSGlHFtaB8A'

        access_token = OAuth::CLI::Twitter.get_access_token(:pit => 'oauth-cli-twitter-dc')
        rubytter = OAuthRubytter.new(access_token)
        rubytter.update('hello from ruby-oauth-cli-twitter define constant example')

 * include

        require 'rubygems'
        require 'twitter'
        require 'oauth/cli/twitter'

        class MyApplication
          include OAuth::CLI::Twitter

          CONSUMER_TOKEN  = '358RyJ77o4BYJUViVRQ'
          CONSUMER_SECRET = 'aOHsTInoyOjNewpvC9c5uwBqF3XOd5xSGlHFtaB8A'

          def initialize
            access_token = get_access_token(:pit => 'oauth-cli-twitter-inclusion')
            oauth = Twitter::OAuth.new(CONSUMER_TOKEN, CONSUMER_SECRET)
            oauth.authorize_from_access(access_token.token, access_token.secret)
            @twitter = Twitter::Base.new(oauth)
          end

          def update(status)
            @twitter.update(status)
          end
        end

        app = MyApplication.new
        app.update('hello from ruby-oauth-cli-twitter inclusion example')

### Save Config

 * save config to file

        include OAuth::CLI::Twitter
        p get_acccess_token(:file => ENV['HOME'] + '/.my_app')

 * save config to pit

        include OAuth::CLI::Twitter
        p get_acccess_token(:pit => 'my_app')

Requirement
-----------

 * readline
 * oauth
 * termtter
 * [pit](http://rubygems.org/gems/pit)

Install
-------

### Archive Installation

        rake install

### Gem Installation

        gem install oauth-cli-twitter

Copyright
---------

Copyright (c) 2010 tily. See LICENSE for details.


text:
package io.milton.http;

/**
 *
 * @author brad
 */
public interface Cookie {

   /**
    * This returns the version for this cookie. The version is
    * not optional and so will always return the version this
    * cookie uses. If no version number is specified this will
    * return a version of 1, to comply with RFC 2109.
    *
    * @return the version value from this cookie instance
    */
   int getVersion();

   /**
    * This enables the version of the Cookie to be
    * set. By default the version of the Cookie is
    * set to 1. It is not advisable to set the version higher
    * than 1, unless it is known that the client will accept it.
    *

    * Some old browsers can only handle cookie version 0. This
    * can be used to comply with the original Netscape cookie
    * specification. Version 1 complies with RFC 2109.
    *
    * @param version this is the version number for the cookie
    */
   void setVersion(int version);

   /**
    * This returns the name for this cookie. The name and value
    * attributes of a cookie define what the Cookie
    * is for, these values will always be present. These are
    * mandatory for both the Cookie and Set-Cookie headers.
    *

    * Because the cookie may be stored by name, the cookie name
    * cannot be modified after the creation of the cookie object.
    *
    * @return the name from this cookie instance object
    */
   String getName();

   /**
    * This returns the value for this cookie. The name and value
    * attributes of a cookie define what the Cookie
    * is for, these values will always be present. These are
    * mandatory for both the Cookie and Set-Cookie headers.
    *
    * @return the value from this cookie instance object
    */
   String getValue();

   /**
    * This enables the value of the cookie to be changed. This
    * can be set to any value the server wishes to send. Cookie
    * values can contain space characters as they are transmitted
    * in quotes. For example a value of some value
    * is perfectly legal. However for maximum compatibility
    * across the different plaforms such as PHP, JavaScript and
    * others, quotations should be avoided. If quotations are
    * required they must be added to the string. For example a
    * quoted value could be created as "some value".
    *
    * @param value this is the new value of this cookie object
    */
   void setValue(String value);

   /**
    * This determines whether the cookie is secure. The cookie
    * is secure if it has the "secure" token set, as defined
    * by RFC 2109. If this token is set then the cookie is only
    * sent over secure channels such as SSL and TLS and ensures
    * that a third party cannot intercept and spoof the cookie.
    *
    * @return this returns true if the "secure" token is set
    */
   boolean getSecure();

   /**
    * This is used to determine if the client browser should send
    * this cookie over a secure protocol. If this is true then
    * the client browser should only send the cookie over secure
    * channels such as SSL and TLS. This ensures that the value
    * of the cookie cannot be intercepted by a third party.
    *
    * @param secure if true then the cookie should be protected
    */
   void setSecure(boolean secure);

   /**
    * This returns the number of seconds a cookie lives for. This
    * determines how long the cookie will live on the client side.
    * If the expiry is less than zero the cookie lifetime is the
    * duration of the client browser session, if it is zero then
    * the cookie will be deleted from the client browser.
    *
    * @return returns the duration in seconds the cookie lives
    */
   int getExpiry();

   /**
    * This allows a lifetime to be specified for the cookie. This
    * will make use of the "max-age" token specified by RFC 2109
    * the specifies the number of seconds a browser should keep
    * a cookie for. This is useful if the cookie is to be kept
    * beyond the lifetime of the client session. If the valie of
    * this is zero then this will remove the client cookie, if
    * it is less than zero then the "max-age" field is ignored.
    *
    * @param expiry the duration in seconds the cookie lives
    */
   void setExpiry(int expiry);

   /**
    * This returns the path for this cookie. The path is in both
    * the Cookie and Set-Cookie headers and so may return null
    * if there is no domain value. If the toString
    * or toClientString is invoked the path will
    * not be present if the path attribute is null.
    *
    * @return this returns the path value from this cookie
    */
   String getPath();

   /**
    * This is used to set the cookie path for this cookie. This
    * is set so that the cookie can specify the directories that
    * the cookie is sent with. For example if the path attribute
    * is set to /pub/bin, then requests for the
    * resource http://hostname:port/pub/bin/README
    * will be issued with this cookie. The cookie is issued for
    * all resources in the path and all subdirectories.
    *
    * @param path this is the path value for this cookie object
    */
   void setPath(String path);

   /**
    * This returns the domain for this cookie. The domain is in
    * both the Cookie and Set-Cookie headers and so may return
    * null if there is no domain value. If either the
    * toString or toClientString is
    * invoked the domain will not be present if this is null.
    *
    * @return this returns the domain value from this cookie
    */
   String getDomain();

   /**
    * This enables the domain for this Cookie to be
    * set. The form of the domain is specified by RFC 2109. The
    * value can begin with a dot, like .host.com.
    * This means that the cookie is visible within a specific
    * DNS zone like www.host.com. By default this
    * value is null which means it is sent back to its origin.
    *
    * @param domain this is the domain value for this cookie
    */
   void setDomain(String domain);

   boolean isHttpOnly();

   void setHttpOnly(boolean  b);
}


text:
package com.mongodb.jvm.json.rhino;

import org.mozilla.javascript.Context;
import org.mozilla.javascript.ScriptRuntime;
import org.mozilla.javascript.Scriptable;
import org.mozilla.javascript.UniqueTag;

import com.threecrickets.jvm.json.JsonImplementation;
import com.threecrickets.jvm.json.JsonTransformer;

/**
 * Transforms a Rhino {@link Scriptable} with a "$regex" key into a Rhino
 * NativeRegExp (the class is private in Rhino).
 *
 * @author Tal Liron
 */
public class NativeRegExpTransformer implements JsonTransformer
{
	//
	// JsonTransformer
	//

	public Object transform( Object object, JsonImplementation implementation )
	{
		if( object instanceof Scriptable )
		{
			Scriptable scriptable = (Scriptable) object;

			Object regex = scriptable.get( "$regex", scriptable );
			if( ( regex != null ) && ( regex.getClass() != UniqueTag.class ) )
			{
				Object options = scriptable.get( "$options", scriptable );

				Context context = Context.getCurrentContext();
				Scriptable scope = ScriptRuntime.getTopCallScope( context );
				if( ( options != null ) && ( options.getClass() != UniqueTag.class ) )
					return context.newObject( scope, "RegExp", new Object[]
					{
						regex.toString(), options.toString()
					} );
				else
					return context.newObject( scope, "RegExp", new Object[]
					{
						regex.toString()
					} );
			}
		}

		return null;
	}
}


text:
angular.module('schemaForm').directive('sfSortHealthHistoryColumns', [function() {

  return {
    restrict: 'A',
    controller: ['$scope', function($scope) {
      // TODO: make this order array configurable from formbuidler
      var t = [
        $scope.form.schema.properties.problem.title,
        $scope.form.schema.properties.treated.title,
        $scope.form.schema.properties.limited.title
      ];

      var getPropName = function(v, properties) {
        for (p in properties) {
          if (v == properties[p].title) return p;
        }
      }

      $scope.sortedForm = t.map(function(v) {
        var item;

        for (var i = 0; i < $scope.form.items.length; i++) {
          if ($scope.form.items[i].title == v) {
            item = $scope.form.items[i];
            break;
          }
        }

        return {
          prop: getPropName(v, $scope.form.schema.properties),
          form: item
        };

      });
    }]
  };

}]);


text:
import {IConsoleLogConfig, IConsoleColorTheme, IConsoleLevelMapping} from './config';
import {DefaultConsoleConfig, DefaultConsoleLevelMapping} from './config';
import {coalesce} from '../../common/utils';
import {ILogMessage} from '../../log-message';

export class ConsoleLogger {
    private colorize: boolean;
    private theme: IConsoleColorTheme;
    private levelMap: IConsoleLevelMapping;

    constructor(config?: IConsoleLogConfig) {
        config = config || {};
        this.colorize = coalesce(config.colorize, DefaultConsoleConfig.colorize);
        this.theme = coalesce(config.theme, <any>{});
        this.levelMap = coalesce(config.levelMappings, <any>{});
        this.colorizeText = this.colorizeText.bind(this);
    }

    async log(msg: ILogMessage): Promise<void> {
        let colorize = this.colorizeText;
        let level = msg.level.name;
        let message = colorize(level, msg.message);
        let timestampText = msg.timestamp.format('MM-DD-YYYY HH:mm:ss.SSS');
        let timestamp = colorize('timestamp', `[${timestampText}]`);
        let logNamespace = msg.namespace ? colorize('namespace', `[${msg.namespace}]`) : null;
        let levelName = colorize(level, `[${level.toUpperCase()}]`);
        let logFunc = this.getLogFunc(level);

        if (logNamespace) {
            logFunc.call(console, timestamp, logNamespace, levelName, message);
        } else {
            logFunc.call(console, timestamp, levelName, message);
        }
    }

    private colorizeText(themeItem: string, text: string): string {
        if (!this.colorize) {
            return text;
        }

        let formatter = this.theme[themeItem] || DefaultConsoleConfig.theme[themeItem];
        if (!formatter) {
            throw new Error(`No property in theme for item '${themeItem}'`);
        }

        return formatter(text);
    }

    private getLogFunc(name: string): Function {
        let logFunc = this.levelMap[name] || DefaultConsoleLevelMapping[name];
        if (!logFunc) {
            throw new Error(`Could not find log func for '${name}'`);
        }

        return logFunc;
    }
}


text:
(function($){

	$(document).ready(function(){

		$('.googlemap').each(function(){
			var $this = $(this);
			var m = $this.get(0);
			var loc;
			var myOptions = {
			zoom: parseInt($this.attr('data-zoom')),
			center: loc,
			mapTypeId: google.maps.MapTypeId.ROADMAP
			};

			var map = new google.maps.Map(m, myOptions);
			var marker = new google.maps.Marker({
				position: loc,
				map: map
			});

			var geocoder = new google.maps.Geocoder();
			geocoder.geocode( { 'address': $this.attr('data-address')}, function(results, status) {
				if (status == google.maps.GeocoderStatus.OK) {
					map.setCenter(results[0].geometry.location);
					var marker = new google.maps.Marker({
					map: map,
					position: results[0].geometry.location
					});
				} else {
					alert("Geocode was not successful for the following reason: " + status);
				}
			});
		});

	});

})(jQuery);


text:
package ee.tuleva.onboarding.auth.smartid;

public class SmartIdSessionNotFoundException extends RuntimeException {
  public SmartIdSessionNotFoundException() {
    super("Smart-ID session was not found.");
  }
}


text:
<?php

namespace Rry\Reminder;

use Illuminate\Support\Facades\Facade;

class ReminderFacade extends Facade
{
    protected static function getFacadeAccessor()
    {
        return 'reminder';
    }
}


text:
package org.apache.kafka.streams.state;

import java.io.File;
import java.io.IOException;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.concurrent.atomic.AtomicLong;

/**
 * A utility for tests to create and manage unique and isolated directories on the file system for local state.
 */
public class StateUtils {

    private static final AtomicLong INSTANCE_COUNTER = new AtomicLong();

    /**
     * Create a new temporary directory that will be cleaned up automatically upon shutdown.
     * @return the new directory that will exist; never null
     */
    public static File tempDir() {
        try {
            final File dir = Files.createTempDirectory("test").toFile();
            dir.mkdirs();
            dir.deleteOnExit();

            Runtime.getRuntime().addShutdownHook(new Thread() {
                @Override
                public void run() {
                    deleteDirectory(dir);
                }
            });
            return dir;
        } catch (IOException ex) {
            throw new RuntimeException("failed to create a temp dir", ex);
        }
    }

    private static void deleteDirectory(File dir) {
        if (dir != null && dir.exists()) {
            try {
                Files.walkFileTree(dir.toPath(), new SimpleFileVisitor<Path>() {
                    @Override
                    public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
                        Files.delete(file);
                        return FileVisitResult.CONTINUE;
                    }

                    @Override
                    public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
                        Files.delete(dir);
                        return FileVisitResult.CONTINUE;
                    }

                });
            } catch (IOException e) {
                // do nothing
            }
        }
    }
}


text:
module WOW::Capture::Packets::Records
  class MovementSceneObj < WOW::Capture::Packets::Records::Base
    structure do
      reset_bit_reader

      bit       :has_scene_local_script_data
      bit       :has_pet_battle_full_update

      struct    :scene_local_script_data,       if: proc { has_scene_local_script_data } do
                  reset_bit_reader

                  bits    :data_length, length: 7
                  string  :data,        length: 7
                end

      struct    :pet_battle_full_update,        if: proc { has_pet_battle_full_update },
                                                source: :pet_battle_full_update
    end
  end
end


text:
BINDIR=/usr/local/bin
CONFDIR=/etc
LAUNCH_DAEMONS=/Library/LaunchDaemons
PLIST=com.canishe.ddupd.plist

install: $(BINDIR)/ddupd $(CONFDIR)/ddupd.conf $(LAUNCH_DAEMONS)/$(PLIST)

$(BINDIR)/ddupd: ddupd.sh
	sudo mkdir -p $(BINDIR)
	sudo cp $? $@
	sudo chown root:admin $@

$(CONFDIR)/ddupd.conf: ddupd.conf
	sudo mkdir -p $(CONFDIR)
	sudo cp $? $@
	sudo chmod 400 $@
	sudo chown root:admin $@

$(LAUNCH_DAEMONS)/$(PLIST): $(PLIST)
	sudo cp $? $@
	sudo chown root:admin $@
	sudo launchctl load $@


text:
/// <reference path="../../../typings/index.d.ts" />
import { PlainStory, EncryptedStory } from '../model/radon';
import { StorageService } from './storage';
import * as sjcl from 'sjcl';
import * as Q from 'q';

export class EncryptionService {
  private EncryptionKey: sjcl.BitArray;
  private Hash: sjcl.BitArray;
  private Salt: string;

  /** @ngInject */
  constructor(StorageService: StorageService) {
    StorageService.onSet('salt', salt => {
      this.Salt = salt;
    });
    StorageService.onSet('hash', hash => {
      this.Hash = hash;
    });
  }

  public encryptStory(PlainStory: PlainStory): EncryptedStory {
    if (!this.isReady()) { throw 'Encryption key not loaded'; }
    let x = sjcl.encrypt(this.EncryptionKey, PlainStory.Contents);
    return new EncryptedStory(PlainStory.Date, x as any as string);
  }

  public decryptStory(EncryptedStory: EncryptedStory): PlainStory {
    if (!this.isReady()) { throw 'Encryption key not loaded'; }
    let decrypted = sjcl.decrypt(this.EncryptionKey, EncryptedStory.Contents as any as sjcl.SjclCipherEncrypted);
    return new PlainStory(EncryptedStory.Date, decrypted);
  }

  public loadEncryptionKey(passphrase: string): Q.Promise<{}> {
    let deferred = Q.defer();
    let saltBitArray = this.loadSaltBitArray();
    if (sjcl.bitArray.equal(this.Hash, sjcl.hash.sha256.hash(passphrase + this.Salt))) {
      this.EncryptionKey = sjcl.misc.pbkdf2(passphrase, saltBitArray, 1000, 256, sjcl.misc.hmac);
      deferred.resolve();
    } else {
      deferred.reject('Incorrect passphrase');
    }
    return deferred.promise;
  }

  public isReady(): boolean {
    return this.EncryptionKey !== undefined && this.EncryptionKey.length > 0;
  }

  public hasSalt(): boolean {
    return this.Salt != null;
  }

  private loadSaltBitArray(): sjcl.BitArray {
    if (!this.hasSalt()) { throw 'Salt not initialized!'; }
    return sjcl.codec.utf8String.toBits(this.Salt);
  }
};


text:
// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

using System;
using System.IO;
using System.Security;

namespace Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.Completion.FileSystem
{
    internal static class IOUtilities
    {
        public static T PerformIO<T>(Func<T> function, T defaultValue = default(T))
        {
            try
            {
                return function();
            }
            catch (IOException)
            {
            }
            catch (SecurityException)
            {
            }
            catch (ArgumentException)
            {
            }
            catch (UnauthorizedAccessException)
            {
            }
            catch (NotSupportedException)
            {
            }
            catch (InvalidOperationException)
            {
            }

            return defaultValue;
        }
    }
}


text:
import {Injectable} from 'angular2/core';

@Injectable()
export class RootActionCreator {
    constructor() {}

}


text:
// This file is part of the dune-gdt project:
//   https://github.com/dune-community/dune-gdt
// Copyright 2010-2018 dune-gdt developers and contributors. All rights reserved.
// License: Dual licensed as BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
//      or  GPL-2.0+ (http://opensource.org/licenses/gpl-license)
//          with "runtime exception" (http://www.dune-project.org/license.html)
// Authors:
//   Felix Schindler (2020)

#ifndef PYTHON_DUNE_GDT_OPERATORS_INTERFACES_BINDINGS_HH
#define PYTHON_DUNE_GDT_OPERATORS_INTERFACES_BINDINGS_HH

#include <python/dune/xt/grid/grids.bindings.hh>

#include "interfaces.hh"
#include "lincomb.hh"
#include "matrix-based.hh"

/**
 * We require ConstLincombOperator and LincombOperator for the numeric operators and MatrixOperator for the jacobian.
 */
template <class M, class MT, class ST, class GridTypes = Dune::XT::Grid::bindings::AvailableGridTypes>
struct OperatorInterface_for_all_grids
{
  using G = Dune::XT::Common::tuple_head_t<GridTypes>;
  using GV = typename G::LeafGridView;
  static const constexpr size_t d = G::dimension;

  static void bind(pybind11::module& m, const std::string& matrix_id)
  {
    using Dune::GDT::bindings::ConstLincombOperator;
    using Dune::GDT::bindings::LincombOperator;
    using Dune::GDT::bindings::MatrixOperator;
    using Dune::GDT::bindings::OperatorInterface;
    using Dune::XT::Grid::bindings::grid_name;

    OperatorInterface<M, GV>::bind(m, matrix_id, grid_name<G>::value());
    ConstLincombOperator<M, GV>::bind(m, matrix_id, grid_name<G>::value());
    LincombOperator<M, GV>::bind(m, matrix_id, grid_name<G>::value());
    MatrixOperator<M, MT, ST, GV>::bind_type(m, matrix_id, grid_name<G>::value());
    if (d > 1) {
      OperatorInterface<M, GV, d, 1>::bind(m, matrix_id, grid_name<G>::value());
      ConstLincombOperator<M, GV, d, 1>::bind(m, matrix_id, grid_name<G>::value());
      LincombOperator<M, GV, d, 1>::bind(m, matrix_id, grid_name<G>::value());
      MatrixOperator<M, MT, ST, GV, d, 1>::bind_type(m, matrix_id, grid_name<G>::value());

      OperatorInterface<M, GV, 1, d>::bind(m, matrix_id, grid_name<G>::value());
      ConstLincombOperator<M, GV, 1, d>::bind(m, matrix_id, grid_name<G>::value());
      LincombOperator<M, GV, 1, d>::bind(m, matrix_id, grid_name<G>::value());
      MatrixOperator<M, MT, ST, GV, 1, d>::bind_type(m, matrix_id, grid_name<G>::value());

      OperatorInterface<M, GV, d, d>::bind(m, matrix_id, grid_name<G>::value());
      ConstLincombOperator<M, GV, d, d>::bind(m, matrix_id, grid_name<G>::value());
      LincombOperator<M, GV, d, d>::bind(m, matrix_id, grid_name<G>::value());
      MatrixOperator<M, MT, ST, GV, d, d>::bind_type(m, matrix_id, grid_name<G>::value());
    }
    // add your extra dimensions here
    // ...

    OperatorInterface_for_all_grids<M, MT, ST, Dune::XT::Common::tuple_tail_t<GridTypes>>::bind(m, matrix_id);
  }
};

template <class M, class MT, class ST>
struct OperatorInterface_for_all_grids<M, MT, ST, Dune::XT::Common::tuple_null_type>
{
  static void bind(pybind11::module& /*m*/, const std::string& /*matrix_id*/) {}
};

#endif // PYTHON_DUNE_GDT_OPERATORS_INTERFACES_BINDINGS_HH


text:
import 'yfiles/yfiles.css';
import * as umlModel from '../../uml/nodes/UMLClassModel.js'

import {
    Class,
    GraphEditorInputMode,
    GraphSnapContext,
    GridSnapTypes,
    HierarchicLayout,
    HierarchicLayoutData,
    //IEdge,
    LabelSnapContext,
    LayoutExecutor,
    OrthogonalEdgeEditingContext,
    PolylineEdgeStyle,
} from 'yfiles'

import '../../styles/layout.css'
import '../../styles/paper.css'
import '../../styles/stencil.css'
import '../../styles/style.css'
import '../../styles/toolbar.css'
import '../../styles/sidebar.css'
import * as umlEdgeModel from '../../uml/edges/UMLEdgeModel'
import Exporter from "../../export/Exporter";
import {isSuccessStatus, ZetaApiWrapper} from "../../utils/ZetaApiWrapper";
import {showExportFailure, showSnackbar} from "../../utils/Snackbar";
import {Attribute} from "../../uml/attributes/Attribute";
import {Parameter} from "../../uml/parameters/Parameter";
import {Method} from "../../uml/methods/Method";
import {createAggregationStyle, createAssociationStyle, createCompositionStyle, createGeneralizationStyle, isInheritance} from "../../uml/edges/styles/UMLEdgeStyleFactory";
import VuejsNodeStyle from "../../uml/nodes/styles/VuejsNodeStyle";
import axios from "axios";
import { EventBus } from "@/eventbus/eventbus";

// We need to load the yfiles/view-layout-bridge module explicitly to prevent the webpack
// tree shaker from removing this dependency which is needed for 'morphLayout' in this demo.
Class.ensure(LayoutExecutor);

/**
 * Returns a zeta specific default input mode for the graph graphEditor.
 * - SnapContext specifies the snapping behaviour of elements in the graph. Especially
 *   interesting for grid related behaviour. Snapping is disabled (enabled = false) on default
 *
 * @returns {GraphEditorInputMode}
 */
export function getDefaultGraphEditorInputMode() {
    return new GraphEditorInputMode({
        orthogonalEdgeEditingContext: new OrthogonalEdgeEditingContext(),
        allowAddLabel: false,
        allowGroupingOperations: false,
        allowCreateNode: false,
        labelSnapContext: new LabelSnapContext({
            enabled: false
        }),
        snapContext: new GraphSnapContext({
            nodeToNodeDistance: 30,
            nodeToEdgeDistance: 20,
            snapDistance: 10,
            gridSnapType: GridSnapTypes.ALL,
            enabled: false,
            snapBendAdjacentSegments: true,
            snapNodesToSnapLines: true,
            snapPortAdjacentSegments: true,
            snapSegmentsToSnapLines: true,
            snapBendsToSnapLines: true,
            snapOrthogonalMovement: true,
        })
    });
}

/**
 * Validation TODO
 * @param graphComponent
 * @param loadedMetaModel
 */
export function saveGraph(graphComponent, loadedMetaModel, metamodelID) {
    if (loadedMetaModel.constructor === Object && Object.entries(loadedMetaModel).length > 0) {

        const graph = graphComponent.graph;

        const exporter = new Exporter(graph);
        const exportedMetaModel = exporter.export();
        if (exportedMetaModel.isValid()) {
            console.log(exportedMetaModel)
            let data = JSON.stringify({
                name: loadedMetaModel.name,
                classes: exportedMetaModel.getClasses(),
                references: exportedMetaModel.getReferences(),
                enums: exportedMetaModel.getEnums(),
                attributes: exportedMetaModel.getAttributes(),
                methods: exportedMetaModel.getMethods(),
                uiState: JSON.stringify({"empty": "value"})
            });

            // ZetaApiWrapper.prototype.postConceptDefinition(loadedMetaModel.uuid, data)
            const url = "http://localhost:9000" + "/rest/v1/meta-models/" + metamodelID + "/definition";
            axios.put(
                url,
                data,
                {
                    withCredentials: true,
                    headers: {
                        'Content-Type': 'application/json'
                    }
                }
            ).then(
                response => {
                    EventBus.$emit('successMessage', "Successfully saved concept")
                },
                error => {
                    EventBus.$emit('errorMessage', "Failed to save concept: " + error)
                }
            )

        } else {
            let errorMessage = "";
            exportedMetaModel.getMessages().forEach(message => {
                errorMessage += message + '\n';
            });
            EventBus.$emit('errorMessage', "Failed to save concept: " + errorMessage );
        }
    } else {
        EventBus.$emit('errorMessage', "No loaded meta model found.");
    }
}

/**
 * Sets new HierarchicLayout, target nodes are drawn on top
 * This method gets executed after building the sampleGraph since the nodes got no coordinates
 * @returns {Promise<any>}
 */
export function executeLayout(graphComponent) {
    // configures the hierarchic layout
    const layout = new HierarchicLayout({
        orthogonalRouting: true
    })
    layout.edgeLayoutDescriptor.minimumFirstSegmentLength = 100
    layout.edgeLayoutDescriptor.minimumLastSegmentLength = 100
    layout.edgeLayoutDescriptor.minimumDistance = 100

    const layoutData = new HierarchicLayoutData({
        // mark all inheritance edges (generalization, realization) as directed so their target nodes
        // will be placed above their source nodes
        // all other edges are treated as undirected
        edgeDirectedness: () => (0),
        // combine all inheritance edges (generalization, realization) in edge groups according to
        // their line type
        // do not group the other edges
        sourceGroupIds: edge => getGroupId(edge, 'src'),
        targetGroupIds: edge => getGroupId(edge, 'tgt')
    })

    return graphComponent.morphLayout(layout, '500ms', layoutData)
}

/**
 * Returns an edge group id according to the edge style.
 * @param {IEdge} edge
 * @param {string} marker
 * @return {object|null}
 */
export function getGroupId(edge, marker) {
    if (edge.style instanceof PolylineEdgeStyle) {
        const edgeStyle = edge.style
        return isInheritance(edgeStyle) ? edgeStyle.stroke.dashStyle + marker : null
    }

    return null
}

/**
 * Returns a list of nodes based on the classes of the definition.
 * The nodes are modelled after the default zeta node model
 * @param graph: graphComponent.graph
 * @param classes: classes of definition
 * @returns {*}
 */
export function getNodesFromClasses(graph, classes) {
    return classes.map(node => {
        const attributes = node.attributes.map(attribute => new Attribute(attribute));
        const methods = node.methods.map(method => {
            const parameters = method.parameters.map(parameter => new Parameter(parameter));
            return new Method({
                name: method.name,
                parameters: parameters,
                description: method.description,
                returnType: method.returnType,
                code: method.code
            })
        });

        return {
            ...node,
            attributes: attributes,
            methods: methods
        };
    });
}

/**
 * Adds the default zeta node style to every node given
 * @param nodes: list of nodes
 * @returns {*}
 */
export function addNodeStyleToNodes(vuejsComponent, nodes) {
    return nodes.map(node => {
        let style = new VuejsNodeStyle(
            vuejsComponent,
            new umlModel.UMLClassModel({
                className: node.name,
                description: node.description,
                abstract: node.abstractness,
                superTypeNames: node.superTypeNames,
                attributes: node.attributes,
                methods: node.methods
            })
        );

        /*if (node.abstractness === true) {
            style.model.constraint = 'abstract';
            style.model.stereotype = '';
            style.fill = Fill.CRIMSON;
        }*/

        return {
            ...node,
            style: style
        };
    })
}

/**
 * Returns a list of edges based on the default zeta edge model. Takes a list of references
 * from the definition. Requires a list of all nodes to filter all relevant edges
 * @param graph
 * @param references
 * @param nodes
 * @returns {*}
 */
export function getEdgesFromReferences(graph, references, nodes) {
    // Filter all relevant references
    // Remove all references that don't have a target AND source
    references = references.filter(reference => {
        return nodes.some(node => (node.tag.name === reference.sourceClassName) || (node.tag.name === reference.targetClassName))
    });
    // Transform references to Zeta specific EdgeModels
    return references.map(reference => {
        const source = nodes.find(node => node.tag.name === reference.sourceClassName);
        const target = nodes.find(node => node.tag.name === reference.targetClassName);
        const model = new umlEdgeModel.UMLEdgeModel({
            name: reference.name,
            description: reference.description,
            sourceDeletionDeletesTarget: reference.sourceDeletionDeletesTarget,
            targetDeletionDeletesSource: reference.targetDeletionDeletesSource,
            sourceClassName: reference.sourceClassName,
            targetClassName: reference.targetClassName,
            sourceLowerBounds: reference.sourceLowerBounds,
            sourceUpperBounds: reference.sourceUpperBounds,
            targetLowerBounds: reference.targetLowerBounds,
            targetUpperBounds: reference.targetUpperBounds,
            methods: reference.methods,
            attributes: reference.attributes,
        });

        model.source = source;
        model.target = target;
        return model;
    });
}

/**
 *  Adds the default zeta edge style to every edge given
 * @returns {*}
 * @param edge
 */
export function getStyleForEdge(edge) {
    let edgeStyle;
    if (edge.sourceDeletionDeletesTarget === true && edge.targetDeletionDeletesSource === true) {
        edgeStyle = createCompositionStyle();
    } else if (edge.sourceDeletionDeletesTarget === false && edge.targetDeletionDeletesSource === true) {
        edgeStyle = createGeneralizationStyle();
    } else if (edge.sourceDeletionDeletesTarget === true && edge.targetDeletionDeletesSource === false) {
        edgeStyle = createAggregationStyle();
    } else {
        edgeStyle = createAssociationStyle();
    }

    return edgeStyle
}

export function buildGraphFromDefinition() {
    // legacy
}


text:
var OrganisationConversion = {
    "South West Aboriginal Land and Sea Council": "Noongar+OR+Nyungar",
    "NTSCORP Limited": "Koori",
    "Queensland South Native Title Services Ltd": "Murri",
    "Carpentaria Land Council Aboriginal Corporation": "Murri",
    "Cape York Land Council": "Murri",
    "North Queensland Land Council Aboriginal Corp": "Murri",
    "Native Title Services Victoria": "Koorie",
    "South Australian Native Title Services Ltd": "Nunga",
    "Goldfields Land and Sea Council Aboriginal Corp": "Wongi",
    "Yamatji Marlpa Aboriginal Corporation": "Yamatji",
    "Central Desert Native Title Services": "Wongi+OR+Central Desert",
    "Kimberley Land Council Aboriginal Corporation": "Nyamba+OR+Buru+OR+Yawuru",
    "Tasmania - no recognised body": "Palawah"
};


text:
<?php
require_once('application/libraries/EI_HDR.php');
?>

TICKLER HISTORY

    <form id="TH_form_customername" name="TH_form_customername" class="form-horizontal content" role="form">

            <fieldset>

                    CUSTOMER NAME

                        <input  type="text" name="TH_ta_customername" id="TH_ta_customername" class = " amtsubmitval  amountonly" style="width:400px">

                    <input type="button"   id="TH_btn_search_customername"   value="SEARCH" class="btn" disabled hidden />

 </fieldset>

    </form>


text:
package org.opensingular.flow.core;

import javax.annotation.Nonnull;
import java.util.Date;

@SuppressWarnings("unchecked")
public class STaskWait extends STaskUserExecutable<STaskWait> {

    private final IExecutionDateStrategy<FlowInstance> executionDateStrategy;

    public STaskWait(FlowMap flowMap, String name, String abbreviation, IExecutionDateStrategy<?> executionDateStrategy) {
        super(flowMap, name, abbreviation);
        this.executionDateStrategy = (IExecutionDateStrategy<FlowInstance>) executionDateStrategy;
    }

    public Date getExecutionDate(FlowInstance instance, TaskInstance taskInstance) {
        return executionDateStrategy.apply(instance, taskInstance);
    }

    public boolean hasExecutionDateStrategy() {
        return executionDateStrategy != null;
    }

    @Override
    @Nonnull
    public <T extends FlowInstance> STaskWait withTargetDate(@Nonnull IExecutionDateStrategy<T> targetDateExecutionStrategy) {
        if (executionDateStrategy != null) {
            throw new SingularFlowException("Tarefas agendadas não suportam data alvo.", this);
        }
        super.withTargetDate(targetDateExecutionStrategy);
        return this;
    }

    @Override
    public boolean isImmediateExecution() {
        return false;
    }

    @Override
    public boolean canReallocate() {
        return false;
    }

    @Override
    public TaskType getTaskType() {
        return TaskType.WAIT;
    }

    @Override
    void verifyConsistency() {
        super.verifyConsistency();
        if (getExecutionPage() != null && getAccessStrategy() == null) {
            throw new SingularFlowException(
                    createErrorMsg("Não foi definida a estrategia de verificação de acesso da tarefa"), this);
        }
        if(getTransitions().size() > 1 && getDefaultTransition() == null && hasExecutionDateStrategy()){
            throw new SingularFlowException(createErrorMsg("A transição default não foi definida"), this)
                    .addTransitions(this);
        }
    }
}


text:
<?php
if (!isset($_SESSION)) {
    ob_start();
    @session_start();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Giải pháp của bạn</title>

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

    <form class="ans" method="post" action="insert_answer.php" name="info" onsubmit="return check();">
        <textarea placeholder="Hãy chia sẻ "bí quyết" của bạn..." name="answer" id="answer"   ></textarea>

Được gửi bởi

        <input type="radio" name="radiog_dark"  id="radio1" class="css-checkbox"  value="email"  checked="true">
        <input type="text" placeholder="Email của bạn" id="email" name="email"   >
        <input type="radio" name="radiog_dark" id="radio2" class="css-checkbox" value="facebook"/>

        <input type="hidden" id="hide" name="avatar" value="1" />
        <input type="submit" name="submit" value="ok" />
        Xem các giải pháp của các mẹ!
    </form>


text:
package com.bazaarvoice.ostrich.discovery;

import com.bazaarvoice.ostrich.HostDiscovery;
import com.bazaarvoice.ostrich.HostDiscoverySource;
import com.bazaarvoice.ostrich.ServiceEndPoint;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import org.junit.Test;

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

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;

public class ConfiguredFixedHostDiscoverySourceTest {
    @Test(expected = NullPointerException.class)
    public void testNullMap() {
        new ConfiguredFixedHostDiscoverySource<Void>(null);
    }

    @Test
    public void testDefaultConstructor() {
        HostDiscoverySource source = new ConfiguredFixedHostDiscoverySource<Void>();
        assertNull(source.forService("payload"));
    }

    @Test
    public void testEmptyMap() {
        HostDiscoverySource source = new ConfiguredFixedHostDiscoverySource<Void>(Collections.<String, Void>emptyMap());
        assertNull(source.forService("payload"));
    }

    @Test
    public void testNonEmptyMap() {
        Map<String, String> endPoints = ImmutableMap.of("id", "payload");
        HostDiscoverySource source = new ConfiguredFixedHostDiscoverySource<String>(endPoints);
        assertNotNull(source.forService("service"));
    }

    @Test
    public void testSingleEndPoint() {
        Map<String, String> endPoints = ImmutableMap.of("id", "payload");
        HostDiscoverySource source = new ConfiguredFixedHostDiscoverySource<String>(endPoints);
        HostDiscovery hostDiscovery = source.forService("service");
        assertNotNull(hostDiscovery);

        List<ServiceEndPoint> hosts = Lists.newArrayList(hostDiscovery.getHosts());
        assertEquals(1, hosts.size());

        ServiceEndPoint endPoint = hosts.get(0);
        assertEquals("service", endPoint.getServiceName());
        assertEquals("id", endPoint.getId());
        assertEquals("payload", endPoint.getPayload());
    }

    @Test
    public void testOverridePayloadSerialize() {
        final Object customPayload = new Object();
        Map<String, Object> endPoints = ImmutableMap.of("id", customPayload);
        HostDiscoverySource source = new ConfiguredFixedHostDiscoverySource<Object>(endPoints) {
            @Override
            protected String serialize(String serviceName, String id, Object payload) {
                assertEquals("service", serviceName);
                assertEquals("id", id);
                assertEquals(customPayload, payload);
                return "custom-payload";
            }
        };
        HostDiscovery hostDiscovery = source.forService("service");
        assertNotNull(hostDiscovery);

        List<ServiceEndPoint> hosts = Lists.newArrayList(hostDiscovery.getHosts());
        assertEquals("custom-payload", hosts.get(0).getPayload());
    }
}


text:
package arez.integration.context_ref;

import arez.Arez;
import arez.ArezContext;
import arez.annotations.ArezComponent;
import arez.annotations.ContextRef;
import arez.integration.AbstractArezIntegrationTest;
import org.testng.annotations.Test;
import static org.testng.Assert.*;

public final class ContextRefTest
  extends AbstractArezIntegrationTest
{
  @ArezComponent( allowEmpty = true )
  static abstract class TestComponent
  {
    @ContextRef
    abstract ArezContext getContext();
  }

  @Test
  public void contextRef()
  {
    final ArezContext context = Arez.context();

    final TestComponent component = new ContextRefTest_Arez_TestComponent();
    assertEquals( component.getContext(), context );
  }
}


text:
from django.apps import AppConfig

class FakeAppConfig(AppConfig):
    name = 'fake_app'


text:
use failure;
use {EchoType, Point};
use scanifc_sys;
use std::path::Path;
use std::ffi::CString;

const LAST_ERROR_BUFFER_LEN: usize = 512;

macro_rules! scanifc_try {
    ($expr:expr) => {{
        let result = $expr;
        if result != 0 {
            if let Some(last_error) = last_error() {
                return Err(Error{
                    code: result,
                    message: last_error
                }.into());
            } else {
                return Err(Error{
                    code: result,
                    message: String::new()
                }.into());
            }
        }
    }}
}

#[derive(Debug)]
pub struct Stream {
    handle: *mut scanifc_sys::point3dstream,
}

#[derive(Debug, Fail)]
#[fail(display = "scanifc error, code {}: {}", code, message)]
pub struct Error {
    code: i32,
    message: String,
}

impl Stream {
    pub fn open<P: AsRef<Path>>(path: P, sync_to_pps: bool) -> Result<Stream, failure::Error> {
        use std::ptr;

        let path = CString::new(path.as_ref().to_string_lossy().as_ref())?;
        let sync_to_pps = if sync_to_pps { 1 } else { 0 };
        let mut handle = ptr::null_mut();
        unsafe {
            scanifc_try!(scanifc_sys::scanifc_point3dstream_open(
                path.as_ptr(),
                sync_to_pps,
                &mut handle
            ));
        }
        Ok(Stream { handle: handle })
    }

    pub fn read(&mut self, want: u32) -> Result<Vec<Point>, Error> {
        let want_usize = want as usize;
        let mut points = vec![Default::default(); want_usize];
        let mut attributes = vec![Default::default(); want_usize];
        let mut times = vec![Default::default(); want_usize];
        let mut got = 0;
        // We ignore end of frame b/c it doesn't seem to be set.
        let mut _end_of_frame = 0;
        unsafe {
            scanifc_try!(scanifc_sys::scanifc_point3dstream_read(
                self.handle,
                want,
                points.as_mut_ptr(),
                attributes.as_mut_ptr(),
                times.as_mut_ptr(),
                &mut got,
                &mut _end_of_frame
            ));
        }
        // TODO test point mappings
        let points = points
            .into_iter()
            .zip(attributes)
            .zip(times)
            .take(got as usize)
            .map(|((point, attribute), time)| Point {
                x: point.x,
                y: point.y,
                z: point.z,
                amplitude: attribute.amplitude,
                reflectance: attribute.reflectance,
                deviation: attribute.deviation,
                echo_type: EchoType::from(attribute.flags),
                is_waveform_available: attribute.flags & 8 == 8,
                is_pseudo_echo: attribute.flags & 16 == 16,
                is_sw_target: attribute.flags & 32 == 32,
                with_fresh_pps: attribute.flags & 64 == 64,
                is_time_in_pps_timeframe: attribute.flags & 128 == 128,
                facet_number: ((attribute.flags >> 8) & 3) as u8,
                time: time as f64 * 1e9,
            })
            .collect::<Vec<_>>();
        Ok(points)
    }
}

impl Drop for Stream {
    fn drop(&mut self) {
        unsafe {
            scanifc_sys::scanifc_point3dstream_close(self.handle);
        }
    }
}

fn last_error() -> Option<String> {
    let mut buffer = vec![0; LAST_ERROR_BUFFER_LEN];
    let mut message_size = 0;
    let result = unsafe {
        scanifc_sys::scanifc_get_last_error(
            buffer.as_mut_ptr(),
            buffer.len() as u32,
            &mut message_size,
        )
    };
    if result == 0 {
        CString::new(
            buffer
                .iter()
                .take(message_size as usize)
                .filter_map(|&n| if n >= 0 { Some(n as u8) } else { None })
                .collect::<Vec<_>>(),
        ).ok()
            .and_then(|s| s.into_string().ok())
    } else {
        None
    }
}


text:
package org.springframework.boot.actuate.autoconfigure.health;

import reactor.core.publisher.Mono;

import org.springframework.boot.actuate.health.HealthContributorRegistry;
import org.springframework.boot.actuate.health.ReactiveHealthContributorRegistry;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.CollectionUtils;

/**
 * Configuration to adapt legacy deprecated health endpoint classes and interfaces.
 *
 * @author Phillip Webb
 * @author Scott Frederick
 * @see HealthEndpointAutoConfiguration
 */
@Configuration(proxyBeanMethods = false)
@SuppressWarnings("deprecation")
@EnableConfigurationProperties(org.springframework.boot.actuate.autoconfigure.health.HealthIndicatorProperties.class)
class LegacyHealthEndpointCompatibilityConfiguration {

	@Bean
	@ConditionalOnMissingBean
	org.springframework.boot.actuate.health.HealthAggregator healthAggregator(
			HealthIndicatorProperties healthIndicatorProperties) {
		org.springframework.boot.actuate.health.OrderedHealthAggregator aggregator = new org.springframework.boot.actuate.health.OrderedHealthAggregator();
		if (!CollectionUtils.isEmpty(healthIndicatorProperties.getOrder())) {
			aggregator.setStatusOrder(healthIndicatorProperties.getOrder());
		}
		return aggregator;
	}

	@Bean
	@ConditionalOnMissingBean(org.springframework.boot.actuate.health.HealthIndicatorRegistry.class)
	HealthContributorRegistryHealthIndicatorRegistryAdapter healthIndicatorRegistry(
			HealthContributorRegistry healthContributorRegistry) {
		return new HealthContributorRegistryHealthIndicatorRegistryAdapter(healthContributorRegistry);
	}

	@Configuration(proxyBeanMethods = false)
	@ConditionalOnClass(Mono.class)
	static class LegacyReactiveHealthEndpointCompatibilityConfiguration {

		@Bean
		@ConditionalOnMissingBean(org.springframework.boot.actuate.health.ReactiveHealthIndicatorRegistry.class)
		ReactiveHealthContributorRegistryReactiveHealthIndicatorRegistryAdapter reactiveHealthIndicatorRegistry(
				ReactiveHealthContributorRegistry reactiveHealthContributorRegistry) {
			return new ReactiveHealthContributorRegistryReactiveHealthIndicatorRegistryAdapter(
					reactiveHealthContributorRegistry);
		}

	}

}


text:
Thank you so much for your interest in contributing! All types of contributions are encouraged.

## How do I...
  * [Request Support](#request-support)
  * [Report an Error or Bug](#report-an-error-or-bug)
  * [Request a Feature](#request-a-feature)
  * [Contribute Code](#contribute-code)
  * [Contribute Documentation](#contribute-documentation)
  * [Provide Support on Issues](#provide-support-on-issues)
  * [Join the Project Team](#join-the-project-team)

## Request Support

If you have a question.

* Ask on [gitter](https://gitter.im/junkdog/artemis-odb) or the [Libgdx Discord #ecs channel](https://discord.gg/7c6Wg8H).
* Feel free to open an Issue at https://github.com/junkdog/artemis-odb/issues.
* Provide as much context as you can about what you're running into.

## Report an Error or Bug

If you run into an error or bug with the project:

* Ask on [gitter](https://gitter.im/junkdog/artemis-odb) or the [Libgdx Discord #ecs channel](https://discord.gg/7c6Wg8H).
* Open an Issue at https://github.com/junkdog/artemis-odb/issues
* Include *reproduction steps* that someone else can follow to recreate the bug or error on their own.

## Request a Feature

If the project does not do something you need or want it to do:

* Open an Issue at https://github.com/junkdog/artemis-odb/issues
* Provide as much context as you can about what you're running into.
* Please try and be clear about why existing features and alternatives would not work for you.

Once it's filed:

* The project team will evaluate the feature request, possibly asking you more questions to understand its purpose and any relevant requirements. If the issue is closed, the team will convey their reasoning and suggest an alternative path forward.
* If the feature request is accepted, the issue will become part of the roadmap. Depending on the feature and time available, we might ask you to provide a pull request.

Note: The team is unlikely to be able to accept every single feature request that is filed.

## Contribute Documentation

Documentation contributions of any size are welcome. Feel free to file a PR even if you're just rewording a sentence to
be more clear, or fixing a spelling mistake.

## Contribute Code

Code contributions of just about any size are acceptable!

Please provide relevant tests for the code being added or changed. Contributions without accompanying tests will
be held off until a test is added, unless the maintainers consider the specific tests to be either impossible,
or way too much of a burden for such a contribution.

To contribute code:

* Set up the project (see below)
* Make any necessary changes to the source code.
* Include any [additional documentation](#contribute-documentation) the changes might need.
* Write tests that verify that your contribution works as expected. If you need help with this, just ask!
* Write clear, concise commit message(s) that describe the change.
* Go to https://github.com/junkdog/artemis-odb and open a new pull request with your changes.
* If your PR is connected to an open issue, add a line in your PR's description that says `Fixes: #123`, where `#123` is the number of the issue you're fixing.

Once you've filed the PR:

* One or more maintainers will review your PR.
* If the maintainer asks for any changes, edit your changes, push, and ask for another review.
* If the maintainer decides to pass on your PR, they will thank you for the contribution and explain why they won't be accepting the changes.
* If your PR gets accepted, it will be marked as such, and merged soon after.

### Project Setup

So you wanna contribute some code! That's great! This project uses GitHub Pull Requests to manage contributions, so [read up on how to fork a GitHub project and file a PR](https://guides.github.com/activities/forking) if you've never done it before.

If this seems like a lot or you aren't able to do all this setup, you might also be able to [edit the files directly](https://help.github.com/articles/editing-files-in-another-user-s-repository/) without having to do any of this setup. Yes, [even code](#contribute-code).

If you want to go the usual route and run the project locally, though:

* Make sure you have a recent version of [Maven](https://maven.apache.org/) installed, or an IDE with maven built in (like IntellIJ-IDEA).
* [Fork the project](https://guides.github.com/activities/forking/#fork)

Then in your terminal:
* `cd path/to/your/clone`
* `mvn clean install`

And you should be ready to go!

## Provide Support on Issues

Helping out other users with their questions is a really awesome way of contributing. It's not uncommon for most of the issues on an open source projects being support-related questions by users trying to understand something they ran into, or find their way around a known bug.

In order to help other folks out with their questions:

* Go to the [issue tracker](https://github.com/junkdog/artemis-odb/issues).
* Read through the list until you find something that you're familiar enough with to give an answer to.
* Respond to the issue with whatever details are needed to clarify the question, or get more details about what's going on.
* Once the discussion wraps up and things are clarified, either close the issue, or ask the original issue filer (or a maintainer) to close it for you.

## Join the Project Team

### Ways to Join

There are many ways to contribute! Most of them don't require any official status unless otherwise noted.

If you would like to join the maintenance team, the process is relatively informal and typically depends on contributing over a longer period of time.


text:
from django.conf.urls import url

from oscar.core.application import DashboardApplication
from oscar.core.loading import get_class

class RangeDashboardApplication(DashboardApplication):
    name = None
    default_permissions = ['is_staff', ]

    list_view = get_class('dashboard.ranges.views', 'RangeListView')
    create_view = get_class('dashboard.ranges.views', 'RangeCreateView')
    update_view = get_class('dashboard.ranges.views', 'RangeUpdateView')
    delete_view = get_class('dashboard.ranges.views', 'RangeDeleteView')
    products_view = get_class('dashboard.ranges.views', 'RangeProductListView')
    reorder_view = get_class('dashboard.ranges.views', 'RangeReorderView')

    def get_urls(self):
        urlpatterns = [
            url(r'^$', self.list_view.as_view(), name='range-list'),
            url(r'^create/$', self.create_view.as_view(), name='range-create'),
            url(r'^(?P<pk>\d+)/$', self.update_view.as_view(),
                name='range-update'),
            url(r'^(?P<pk>\d+)/delete/$', self.delete_view.as_view(),
                name='range-delete'),
            url(r'^(?P<pk>\d+)/products/$', self.products_view.as_view(),
                name='range-products'),
            url(r'^(?P<pk>\d+)/reorder/$', self.reorder_view.as_view(),
                name='range-reorder'),
        ]
        return self.post_process_urls(urlpatterns)

application = RangeDashboardApplication()


text:
{-# LANGUAGE ImplicitParams #-}
{-# LANGUAGE TemplateHaskell #-}
import Language.Haskell.TH

$(fmap (:[]) (implicitParamBindD "x" [e| 1 |]))


text:
/**
 * Created by maomao on 2020/4/23.
 */
Java.perform(function() {
    var cn = "java.nio.channels.FileChannel";
    var target = Java.use(cn);
    if (target) {
        target.lock.overloads[0].implementation = function(dest) {
            var myArray=new Array()
            myArray[0] = "INTERESTED"  //INTERESTED & SENSITIVE
            myArray[1] = cn + "." + "lock";
            myArray[2] = Java.use("android.util.Log").getStackTraceString(Java.use("java.lang.Exception").$new()).split('\n\tat');
            send(myArray);
            return this.lock.overloads[0].apply(this, arguments);
        };
        target.lock.overloads[1].implementation = function(dest) {
            var myArray=new Array()
            myArray[0] = "INTERESTED"  //INTERESTED & SENSITIVE
            myArray[1] = cn + "." + "lock";
            myArray[2] = Java.use("android.util.Log").getStackTraceString(Java.use("java.lang.Exception").$new()).split('\n\tat');
            send(myArray);
            return this.lock.overloads[1].apply(this, arguments);
        };
    }
});