text:
/**
 * Test dependencies.
 */

var sio = require('../')
  , http = require('http')
  , should = require('should')
  , client = require('./common').client
  , create = require('./common').create
  , websocket = require('./common').websocket
  , ports = 15100;

/**
 * Test.
 */

module.exports = {

  'test setting and getting a configuration flag': function (done) {
    var port = ++ports
      , io = sio.listen(http.createServer());

    io.set('a', 'b');
    io.get('a').should.eql('b');

    var port = ++ports
      , io = sio.listen(http.createServer());

    io.configure(function () {
      io.set('a', 'b');
      io.enable('tobi');
    });

    io.get('a').should.eql('b');

    done();
  },

  'test enabling and disabling a configuration flag': function (done) {
    var port = ++ports
      , io = sio.listen(http.createServer());

    io.enable('flag');
    io.enabled('flag').should.be.true;
    io.disabled('flag').should.be.false;

    io.disable('flag');
    var port = ++ports
      , io = sio.listen(http.createServer());

    io.configure(function () {
      io.enable('tobi');
    });

    io.enabled('tobi').should.be.true;

    done();
  },

  'test configuration callbacks with envs': function (done) {
    var port = ++ports
      , io = sio.listen(http.createServer());

    process.env.NODE_ENV = 'development';

    io.configure('production', function () {
      io.set('ferret', 'tobi');
    });

    io.configure('development', function () {
      io.set('ferret', 'jane');
    });

    io.get('ferret').should.eql('jane');
    done();
  },

  'test configuration callbacks conserve scope': function (done) {
    var port = ++ports
      , io = sio.listen(http.createServer())
      , calls = 0;

    process.env.NODE_ENV = 'development';

    io.configure(function () {
      this.should.eql(io);
      calls++;
    });

    io.configure('development', function () {
      this.should.eql(io);
      calls++;
    });

    calls.should.eql(2);
    done();
  },

  'test configuration update notifications': function (done) {
    var port = ++ports
      , io = sio.listen(http.createServer())
      , calls = 0;

    io.on('set:foo', function () {
      calls++;
    });

    io.set('foo', 'bar');
    io.set('baz', 'bar');

    calls.should.eql(1);

    io.enable('foo');
    io.disable('foo');

    calls.should.eql(3);

    done();
  },

  'test that normal requests are still served': function (done) {
    var server = http.createServer(function (req, res) {
      res.writeHead(200);
      res.end('woot');
    });

    var io = sio.listen(server)
      , port = ++ports
      , cl = client(port);

    server.listen(ports);

    cl.get('/socket.io', function (res, data) {
      res.statusCode.should.eql(200);
      data.should.eql('Welcome to socket.io.');

      cl.get('/woot', function (res, data) {
        res.statusCode.should.eql(200);
        data.should.eql('woot');

        cl.end();
        server.close();
        done();
      });
    });
  },

  'test that you can disable clients': function (done) {
    var port = ++ports
      , io = sio.listen(port)
      , cl = client(port);

    io.configure(function () {
      io.disable('browser client');
    });

    cl.get('/socket.io/socket.io.js', function (res, data) {
      res.statusCode.should.eql(200);
      data.should.eql('Welcome to socket.io.');

      cl.end();
      io.server.close();
      done();
    });
  },

  'test handshake': function (done) {
    var port = ++ports
      , io = sio.listen(port)
      , cl = client(port);

    cl.get('/socket.io/{protocol}/', function (res, data) {
      res.statusCode.should.eql(200);
      data.should.match(/([^:]+):([0-9]+)?:([0-9]+)?:(.+)/);

      cl.end();
      io.server.close();
      done();
    });
  },

  'test handshake with unsupported protocol version': function (done) {
    var port = ++ports
      , io = sio.listen(port)
      , cl = client(port);

    cl.get('/socket.io/-1/', function (res, data) {
      res.statusCode.should.eql(500);
      data.should.match(/Protocol version not supported/);

      cl.end();
      io.server.close();
      done();
    });
  },

  'test authorization failure in handshake': function (done) {
    var port = ++ports
      , io = sio.listen(port)
      , cl = client(port);

    io.configure(function () {
      function auth (data, fn) {
        fn(null, false);
      };

      io.set('authorization', auth);
    });

    cl.get('/socket.io/{protocol}/', function (res, data) {
      res.statusCode.should.eql(403);
      data.should.match(/handshake unauthorized/);

      cl.end();
      io.server.close();
      done();
    });
  },

  'test a handshake error': function (done) {
    var port = ++ports
      , io = sio.listen(port)
      , cl = client(port);

    io.configure(function () {
      function auth (data, fn) {
        fn(new Error);
      };

      io.set('authorization', auth);
    });

    cl.get('/socket.io/{protocol}/', function (res, data) {
      res.statusCode.should.eql(500);
      data.should.match(/handshake error/);

      cl.end();
      io.server.close();
      done();
    });
  },

  'test that a referer is accepted for *:* origin': function (done) {
    var port = ++ports
      , io = sio.listen(port)
      , cl = client(port);

    io.configure(function () {
      io.set('origins', '*:*');
    });

    cl.get('/socket.io/{protocol}', { headers: { referer: 'http://foo.bar.com:82/something' } }, function (res, data) {
      res.statusCode.should.eql(200);
      cl.end();
      io.server.close();
      done();
    });
  },

  'test that valid referer is accepted for addr:* origin': function (done) {
    var port = ++ports
      , io = sio.listen(port)
      , cl = client(port);

    io.configure(function () {
      io.set('origins', 'foo.bar.com:*');
    });

    cl.get('/socket.io/{protocol}', { headers: { referer: 'http://foo.bar.com/something' } }, function (res, data) {
      res.statusCode.should.eql(200);
      cl.end();
      io.server.close();
      done();
    });
  },

  'test that a referer with implicit port 80 is accepted for foo.bar.com:80 origin': function (done) {
    var port = ++ports
      , io = sio.listen(port)
      , cl = client(port);

    io.configure(function () {
      io.set('origins', 'foo.bar.com:80');
    });

    cl.get('/socket.io/{protocol}', { headers: { referer: 'http://foo.bar.com/something' } }, function (res, data) {
      res.statusCode.should.eql(200);
      cl.end();
      io.server.close();
      done();
    });
  },

  'test that erroneous referer is denied for addr:* origin': function (done) {
    var port = ++ports
      , io = sio.listen(port)
      , cl = client(port);

    io.configure(function () {
      io.set('origins', 'foo.bar.com:*');
    });

    cl.get('/socket.io/{protocol}', { headers: { referer: 'http://baz.bar.com/something' } }, function (res, data) {
      res.statusCode.should.eql(403);
      cl.end();
      io.server.close();
      done();
    });
  },

  'test that valid referer port is accepted for addr:port origin': function (done) {
    var port = ++ports
      , io = sio.listen(port)
      , cl = client(port);

    io.configure(function () {
      io.set('origins', 'foo.bar.com:81');
    });

    cl.get('/socket.io/{protocol}', { headers: { referer: 'http://foo.bar.com:81/something' } }, function (res, data) {
      res.statusCode.should.eql(200);
      cl.end();
      io.server.close();
      done();
    });
  },

  'test that erroneous referer port is denied for addr:port origin': function (done) {
    var port = ++ports
      , io = sio.listen(port)
      , cl = client(port);

    io.configure(function () {
      io.set('origins', 'foo.bar.com:81');
    });

    cl.get('/socket.io/{protocol}', { headers: { referer: 'http://foo.bar.com/something' } }, function (res, data) {
      res.statusCode.should.eql(403);
      cl.end();
      io.server.close();
      done();
    });
  },

  'test handshake cross domain access control': function (done) {
    var port = ++ports
      , io = sio.listen(port)
      , cl = client(port)
      , headers = {
            Origin: 'http://example.org:1337'
          , Cookie: 'name=value'
        };

    cl.get('/socket.io/{protocol}/', { headers:headers }, function (res, data) {
      res.statusCode.should.eql(200);
      res.headers['access-control-allow-origin'].should.eql('http://example.org:1337');
      res.headers['access-control-allow-credentials'].should.eql('true');

      cl.end();
      io.server.close();
      done();
    });
  },

  'test limiting the supported transports for a manager': function (done) {
    var port = ++ports
      , io = sio.listen(port)
      , cl = client(port);

    io.configure(function () {
      io.set('transports', ['tobi', 'jane']);
    });

    cl.get('/socket.io/{protocol}/', function (res, data) {
      res.statusCode.should.eql(200);
      data.should.match(/([^:]+):([0-9]+)?:([0-9]+)?:tobi,jane/);

      cl.end();
      io.server.close();
      done();
    });
  },

  'test setting a custom close timeout': function (done) {
    var port = ++ports
      , io = sio.listen(port)
      , cl = client(port);

    io.configure(function () {
      io.set('close timeout', 66);
    });

    cl.get('/socket.io/{protocol}/', function (res, data) {
      res.statusCode.should.eql(200);
      data.should.match(/([^:]+):([0-9]+)?:66?:(.*)/);

      cl.end();
      io.server.close();
      done();
    });
  },

  'test setting a custom heartbeat timeout': function (done) {
    var port = ++ports
      , io = sio.listen(port)
      , cl = client(port);

    io.configure(function () {
      io.set('heartbeat timeout', 33);
    });

    cl.get('/socket.io/{protocol}/', function (res, data) {
      res.statusCode.should.eql(200);
      data.should.match(/([^:]+):33:([0-9]+)?:(.*)/);

      cl.end();
      io.server.close();
      done();
    });
  },

  'test disabling timeouts': function (done) {
    var port = ++ports
      , io = sio.listen(port)
      , cl = client(port);

    io.configure(function () {
      io.set('heartbeat timeout', null);
      io.set('close timeout', '');
    });

    cl.get('/socket.io/{protocol}/', function (res, data) {
      res.statusCode.should.eql(200);
      data.should.match(/([^:]+)::?:(.*)/);

      cl.end();
      io.server.close();
      done();
    });
  },

  'test disabling heartbeats': function (done) {
    var port = ++ports
      , cl = client(port)
      , io = create(cl)
      , messages = 0
      , beat = false
      , ws;

    io.configure(function () {
      io.disable('heartbeats');
      io.set('heartbeat interval', .05);
      io.set('heartbeat timeout', .05);
      io.set('close timeout', .05);
    });

    io.sockets.on('connection', function (socket) {
      setTimeout(function () {
        socket.disconnect();
      }, io.get('heartbeat timeout') * 1000 + 100);

      socket.on('disconnect', function (reason) {
        beat.should.be.false;
        ws.finishClose();
        cl.end();
        io.server.close();
        done();
      });
    });

    cl.get('/socket.io/{protocol}/', function (res, data) {
      res.statusCode.should.eql(200);
      data.should.match(/([^:]+)::[\.0-9]+:(.*)/);

      cl.handshake(function (sid) {
        ws = websocket(cl, sid);
        ws.on('message', function (packet) {
          if (++messages == 1) {
            packet.type.should.eql('connect');
          } else if (packet.type == 'heartbeat'){
            beat = true;
          }
        });
      });
    });
  },

  'test passing options directly to the Manager through listen': function (done) {
    var port = ++ports
      , io = sio.listen(port, { resource: '/my resource', custom: 'opt' });

    io.get('resource').should.equal('/my resource');
    io.get('custom').should.equal('opt');
    process.nextTick(function() {
      io.server.close();
      done();
    });
  },

  'test disabling the log': function (done) {
    var port = ++ports
      , io = sio.listen(port, { log: false })
      , _console = console.log
      , calls = 0;

    // the logger uses console.log to output data, override it to see if get's
    // used
    console.log = function () { ++calls };

    io.log.debug('test');
    io.log.log('testing');

    console.log = _console;
    calls.should.equal(0);

    process.nextTick(function() {
      io.server.close();
      done();
    });
  },

  'test disabling logging with colors': function (done) {
     var port = ++ports
      , io = sio.listen(port, { 'log colors': false })
      , _console = console.log
      , calls = 0;

    // the logger uses console.log to output data, override it to see if get's
    // used
    console.log = function (data) {
      ++calls;
      data.indexOf('\033').should.equal(-1);
    };

    io.log.debug('test');
    io.log.log('testing');

    console.log = _console;
    calls.should.equal(2);

    process.nextTick(function() {
      io.server.close();
      done();
    });
  }
};


text:
package com.ilivoo.common.resource.exception;

public class ResourceParseException extends ResourceException {

    private static final long serialVersionUID = -41324674643432906L;

    public ResourceParseException(){
	super();
    }

    public ResourceParseException(String message){
	super(message);
    }

    public ResourceParseException(Throwable throwable){
	super(throwable);
    }

    public ResourceParseException(String message, Throwable throwable){
	super(message, throwable);
    }
}

redpajama_set_name: RedPajamaGithub


text:
from azure.identity import DefaultAzureCredential
from azure.mgmt.elasticsan import ElasticSanManagement

"""
# PREREQUISITES
    pip install azure-identity
    pip install azure-mgmt-elasticsan
# USAGE
    python volume_groups_create_maximum_set_gen.py

    Before run the sample, please set the values of the client ID, tenant ID and client secret
    of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
    AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
    https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""

def main():
    client = ElasticSanManagement(
        credential=DefaultAzureCredential(),
        subscription_id="aaaaaaaaaaaaaaaaaa",
    )

    response = client.volume_groups.begin_create(
        resource_group_name="rgelasticsan",
        elastic_san_name="ti7q-k952-1qB3J_5",
        volume_group_name="u_5I_1j4t3",
        parameters={
            "properties": {
                "encryption": "EncryptionAtRestWithPlatformKey",
                "networkAcls": {"virtualNetworkRules": [{"action": "Allow", "id": "aaaaaaaaaaaaaaaa"}]},
                "protocolType": "Iscsi",
            },
            "tags": {"key5933": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"},
        },
    ).result()
    print(response)

# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2021-11-20-preview/examples/VolumeGroups_Create_MaximumSet_Gen.json
if __name__ == "__main__":
    main()


text:
<?php
namespace Application\Model;

use Zend\Authentication\AuthenticationService;
use Zend\Cache\Exception\LogicException;

class KittyService {
    private $table,
            $auth_service;

    public function __construct(AuthenticationService $auth_service, KittyTable $table) {
        $this->auth_service = $auth_service;
        $this->table = $table;
    }

    public function createForUser() {
        if (!$this->auth_service->hasIdentity()) {
            throw new LogicException("User must be logged in");
        }

        $user = $this->auth_service->getIdentity();
        $kitty = new Kitty();

        $kitty->setUserId($user->getId());

        return $kitty;
    }

    public function getBigRandom() {
        $width  = rand(1200, 1500);
        $height = rand(500, 700);

        return new Kitty($widht, $height);
    }

    public function getRandomSet() {
        $kitties = array();

        for ($i = 0; $i < 12; $i++) {
            $width = 250;
            $height = rand(200, 500);

            $kitties[] = new Kitty($width, $height);
        }

        return $kitties;
    }

    public function getUserKitties() {
        if (!$this->auth_service->hasIdentity()) {
            throw new LogicException("User must be logged in");
        }

        $user = $this->auth_service->getIdentity();
        return $this->table->fetchForUser($user);
    }

    public function delete($id) {
        if (!$this->auth_service->hasIdentity()) {
            throw new LogicException("User must be logged in");
        }

        $user = $this->auth_service->getIdentity();

        return $this->table->deleteUserKitty($user, $id);
    }
}


text:
..
      Copyright 2014 Mirantis, Inc.

      Licensed under the Apache License, Version 2.0 (the "License"); you may
      not use this file except in compliance with the License. You may obtain
      a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
      WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
      License for the specific language governing permissions and limitations
      under the License.

.. _install:

=========================
Murano Installation Guide
=========================

Content
=======

.. toctree::
   :maxdepth: 2

   prepare
   development
   manual
   ssl


text:
namespace Microsoft.Azure.Management.RecoveryServices.SiteRecovery.Models
{
    using Microsoft.Azure;
    using Microsoft.Azure.Management;
    using Microsoft.Azure.Management.RecoveryServices;
    using Microsoft.Azure.Management.RecoveryServices.SiteRecovery;
    using Newtonsoft.Json;
    using System.Linq;

    /// <summary>
    /// Provider details.
    /// </summary>
    public partial class RecoveryServicesProvider : Resource
    {
        /// <summary>
        /// Initializes a new instance of the RecoveryServicesProvider class.
        /// </summary>
        public RecoveryServicesProvider()
        {
          CustomInit();
        }

        /// <summary>
        /// Initializes a new instance of the RecoveryServicesProvider class.
        /// </summary>
        /// <param name="id">Resource Id</param>
        /// <param name="name">Resource Name</param>
        /// <param name="type">Resource Type</param>
        /// <param name="location">Resource Location</param>
        /// <param name="properties">Provider properties.</param>
        public RecoveryServicesProvider(string id = default(string), string name = default(string), string type = default(string), string location = default(string), RecoveryServicesProviderProperties properties = default(RecoveryServicesProviderProperties))
            : base(id, name, type, location)
        {
            Properties = properties;
            CustomInit();
        }

        /// <summary>
        /// An initialization method that performs custom operations like setting defaults
        /// </summary>
        partial void CustomInit();

        /// <summary>
        /// Gets or sets provider properties.
        /// </summary>
        [JsonProperty(PropertyName = "properties")]
        public RecoveryServicesProviderProperties Properties { get; set; }

    }
}


text:
<?php
	header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found");
	$location = array(0, 0, 0);
	include $_SERVER['DOCUMENT_ROOT'].'/PHP-includes/ZZ-Swordion-DO-NOT-EDIT/02-base-PHP/template.php';
?>


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace FSMEditor
{
    public partial class AddStorageDialog : Window
    {
        int m_data_type =2;
        ViewModel m_view;
        public AddStorageDialog( ViewModel view)
        {
            InitializeComponent();
            m_view = view;
        }
        private void RadioButton_Click(object sender, RoutedEventArgs e)
        {
            var obj = sender as RadioButton;
            Console.WriteLine(obj.Content);

            switch (obj.Content as string)
            {
                case "int":
                    m_data_type = 0;
                    break;
                case "float":
                    m_data_type = 1;
                    break;

                default:
                    m_data_type = 2;
                    break;
            }
        }

        private void StorageButton_Click(object sender, RoutedEventArgs e)
        {
            if (m_data_type == 1)
            {
                m_view.m_fsm.set_float_value(keyName.Text, 0.0f);
            }
            else if (m_data_type == 0)
            {
                m_view.m_fsm.set_int_value(keyName.Text, 0);
            }
            else if (m_data_type == 2)
            {
                m_view.m_fsm.set_bool_value(keyName.Text, false);
            }
            this.Close();
            //this is just to trigger the property changed, maybe there is a better way?
            //maybe .... but do i really care right now? ahahah NO
            var b =m_view.Storage;
        }

    }
}


text:
<!DOCTYPE html>

<meta charset="utf-8"/>
<title>Zlib Compression</title>
<link type="text/css" rel="stylesheet" href="style.css"/>

Zlib Compression

By Ross Smith

#include "rs-core/zlib.hpp"

This header provides wrappers around some of the compression functions in
Zlib. Including this header will also import the
contents of <zlib.h>.

Contents

Zlib Compression

Contents

Error handling

Compression functions

I/O class

Error handling

class ZlibCategory: public std::error_category

const std::error_category& zlib_category() noexcept

A system error category for Zlib error codes.

Compression functions

struct Zlib

static std::string compress(std::string_view src, int level = Z_DEFAULT_COMPRESSION)

static std::string uncompress(std::string_view src)

Basic compression and uncompression functions. Either of these may throw
std::system_error or std::bad_alloc if anything goes wrong. For
compression, std::bad_alloc is normally the only possible exception, unless
there is an internal error in Zlib; for uncompression, a corrupt archive will
trigger a std::system_error with a ZlibCategory error category.

I/O class

class Gzio: public IO

using Gzio::handle_type = gzFile

Gzio::Gzio()

explicit Gzio::Gzio(const Unicorn::Path& f, IO::mode m = IO::mode::read_only)

Gzio::Gzio(const Unicorn::Path& f, Uview iomode)

virtual Gzio::~Gzio()

Gzio::Gzio(Gzio&& io)

Gzio& Gzio::operator=(Gzio&& io)

gzFile Gzio::get() const noexcept

void Gzio::ungetc(char c)

An I/O class that reads and writes Gzip files. A compressed file can't be
opened for reading and writing at the same time, so the IO::mode argument to
the second constructor can only be read_only, write_only, or append;
anything else will fail. The mode argument to the third constructor follows
the same format as the corresponding argument to gzopen() in Zlib.


text:
package com.zimbra.qa.selenium.projects.admin.items;

import com.zimbra.qa.selenium.framework.items.IItem;
import com.zimbra.qa.selenium.framework.util.HarnessException;
import com.zimbra.qa.selenium.framework.util.ZimbraAccount;
import com.zimbra.qa.selenium.framework.util.ZimbraSeleniumProperties;

public class ResourceItem implements IItem {
	protected String resourceLocalName;
	protected String resourceDomainName;
	protected String resourceId;

	public ResourceItem() {
		super();

		resourceLocalName = "resource" + ZimbraSeleniumProperties.getUniqueString();
		resourceDomainName = ZimbraSeleniumProperties.getStringProperty("testdomain");
		resourceId = null;
	}

	@Override
	public void createUsingSOAP(ZimbraAccount account) throws HarnessException {
		// TODO Auto-generated method stub

	}

	@Override
	public String prettyPrint() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String getName() {
		return (getLocalName());
	}

	public String getID() {
		return (resourceId);
	}

	public String getEmailAddress() {
		return (resourceLocalName + "@" + resourceDomainName);
	}

	public void setLocalName(String name) {
		resourceLocalName = name;
	}

	public String getLocalName() {
		return (resourceLocalName);
	}

	public void setDomainName(String domain) {
		resourceDomainName = domain;
	}

	public String getDomainName() {
		return (resourceDomainName);
	}
}


text:
import {handleActions} from 'redux-actions'
import {constant, forEach, map, random, range, sampleSize, some, times, union} from 'lodash'

import * as types from './WordGame.actionTypes'
import GuessChecker from 'utils/guessChecker'

const makeNArray = function (n) {
	    return range(n).map(() => [])
}

const makeHints = function (word) {
	    const determineNumberOfHints = function (wordLength) {
		    var numHints
		    if (wordLength < 7) {
			    numHints = 1
		} else if (wordLength < 10) {
			    numHints = 2
		} else if (wordLength < 12) {
			    numHints = 3
		} else if (wordLength < 14) {
			    numHints = 4
		} else if (wordLength > 13) {
			    numHints = 5
		}

		    return numHints
	}

	    const wordLength = word.length
	    const numHints = determineNumberOfHints(wordLength)

	    const randomIndexes = sampleSize(range(wordLength), numHints)

	    return randomIndexes
}

// INITIAL STATE //
var testWord = 'TRAPEZE'
var lettersGuessed = makeNArray(testWord.length)
const GUESSES_ALLOWED = 3
const activeAttempts = times(GUESSES_ALLOWED, constant(0))
const hints = makeHints(testWord)
const initialState = {
	    currentGuess: [],
	    guessesAllowed: GUESSES_ALLOWED,
	    lettersGuessed: lettersGuessed,
	    word: testWord,
	    isFetching: false,
	    activeAttempts: activeAttempts,
	    hints
}

export default handleActions({
	    [types.UPDATE_GUESS]: (state, action) => {
		    const guessChecker = GuessChecker(
			state.currentGuess,
			state.lettersGuessed,
			state.word,
			state.guessesAllowed)

		    var newCurrentGuess

		    if (guessChecker.gameIsWon() || guessChecker.gameIsLost() ) {
			// We don't update currentGuess if game is over
			    newCurrentGuess = []
		} else {
			// If there's space, add new letter, otherwise don't
		     newCurrentGuess = (state.currentGuess.length === state.word.length)
			? [...state.currentGuess]
			: [...state.currentGuess, action.payload]
		}

		    return {
			    ...state,
			    currentGuess: newCurrentGuess,
			    guessError: false,
			    guessCorrect: false
		}
	},
	    [types.BACKSPACE_GUESS]: (state, action) => {
		    return {
			    ...state,
			    currentGuess: [...state.currentGuess.slice(0, state.currentGuess.length - 1)],
			    guessError: false
		}
	},
	    [types.REGISTER_GUESS]: (state, action) => {
		    const guessChecker = GuessChecker(
			state.currentGuess,
			state.lettersGuessed,
			state.word,
			state.guessesAllowed,
			state.hints
			)

		    if (
			// not correct length
			!guessChecker.guessIsCorrectLength() ||
			// incorrect letter at spot already chosen correct
			some(range(state.currentGuess.length), guessChecker.letterIsAlreadyCorrectAndNotChosen.bind(guessChecker)) ||
			// incorrect letter already chosen
			some(range(state.currentGuess.length), guessChecker.letterIsAlreadyIncorrectAndChosen.bind(guessChecker))
			) {
			    return {
				    ...state,
				    guessError: true,
				    guessCorrect: false
			}
		}

		// all good, register guess
		// get the newLettersGuessed by adding unique and new values
		    var newLettersGuessed = state.lettersGuessed.map(
			function (lettersGuessedAtSlot, index) {
					    return union(lettersGuessedAtSlot, [state.currentGuess[index]])
		})

		// check if any of newly guessed letters were correct
		    var guessCorrect = some(range(state.word.length, guessChecker.letterWasJustChosenCorrectly))

		    return {
			    ...state,
			    currentGuess: [],
			    lettersGuessed: newLettersGuessed,
			    guessCorrect: guessCorrect
		}
	},
	    [types.FETCH_WORD_REQUEST]: (state, action) => {
		    return {
			    ...state,
			    isFetching: true
		}
	},
	    [types.FETCH_WORD_SUCCESS]: (state, action) => {
		    const word = action.payload.toUpperCase()
		    return {
			    ...state,
			    isFetching: false,
			    word,
		}
	},
	    [types.RESET_GAME]: (state, action) => {
		    const word = action.payload.toUpperCase()
		    const lettersGuessed = makeNArray(word.length)
		    const hints = makeHints(word)
		    var guessesAllowed
		    if (word.length > 15) {
			    guessesAllowed = 5
		} else if (word.length > 8) {
			    guessesAllowed = 4
		} else {
			    guessesAllowed = 3
		}
		    return {
			    ...state,
			    currentGuess: [],
			    guessCorrect: false,
			    guessError: false,
			    lettersGuessed,
			    word,
			    guessesAllowed,
			    hints
		}
	},
	    [types.SET_ACTIVE_ATTEMPTS]: (state, action) => {
		    return {
			    ...state,
			    activeAttempts: action.payload
		}
	},
	    [types.SET_INFO_SHOW]: (state, action) => {
		    const infoShow = action.payload === 'open' ? 'open' : 'closed'
		    return {
			    ...state,
			    infoShow: infoShow
		}
	}
}, initialState)


text:
namespace Poco {
namespace RemotingNG {

POCO_DECLARE_EXCEPTION(RemotingNG_API, RemotingException, Poco::LogicException)
POCO_DECLARE_EXCEPTION(RemotingNG_API, TransportException, RemotingException)
POCO_DECLARE_EXCEPTION(RemotingNG_API, ProtocolException, RemotingException)
POCO_DECLARE_EXCEPTION(RemotingNG_API, RemoteException, RemotingException)
POCO_DECLARE_EXCEPTION(RemotingNG_API, SerializerException, RemotingException)
POCO_DECLARE_EXCEPTION(RemotingNG_API, DeserializerException, RemotingException)
POCO_DECLARE_EXCEPTION(RemotingNG_API, UnknownTransportException, RemotingException)
POCO_DECLARE_EXCEPTION(RemotingNG_API, UnknownTypeException, RemotingException)
POCO_DECLARE_EXCEPTION(RemotingNG_API, UnknownObjectException, RemotingException)
POCO_DECLARE_EXCEPTION(RemotingNG_API, ORBDisabledException, RemotingException)
POCO_DECLARE_EXCEPTION(RemotingNG_API, MissingParamException, DeserializerException)
POCO_DECLARE_EXCEPTION(RemotingNG_API, WrongReplyException, DeserializerException)
POCO_DECLARE_EXCEPTION(RemotingNG_API, UnexpectedMessageException, DeserializerException)
POCO_DECLARE_EXCEPTION(RemotingNG_API, MethodNotFoundException, DeserializerException)

} } // namespace Poco::RemotingNG

#endif // RemotingNG_RemotingException_INCLUDED


text:
namespace TRACER
{
    /// The time frame class.
    class TimeFrame
    {
        public:
            /// The time frame constructor.
            ///
            /// @param rTimestamp The initial timestamp.
            /// @param rFile The output stream.
            TimeFrame(const TIME::Timestamp &rTimestamp, std::ofstream &rFile) :
                m_Timestamp(rTimestamp),
                m_rFile(rFile),
                m_FrameSignals(),
                m_Signals()
            {
            }

            /// Sets the beginning of the frame.
            ///
            /// @param frameStart New timestamp characterizing a frame.
            void SetTime(TIME::Timestamp frameStart)
            {
                m_Timestamp = frameStart;
            }

            /// Adds the signal information to the time frame.
            ///
            /// @param pSignal The signal.
            void Add(const SIGNAL::Signal *pSignal);

            /// Dumps the time frame information.
            ///
            /// Time frame is dumped to the file and then the frame is cleared.
            void DumpAndClear();

        private:

            /// Write on line to output file.
            void DumpLine(const std::string &rLine)
            {
                m_rFile << rLine << '\n';
            }

            /// Check weather given signal value has been already added.
            ///
            /// @param pSignal The signal.
            /// @retval true Signal with this value has been already added.
            /// @retval false Signal with this value has not been added.
            bool WasSignalValueAdded(const SIGNAL::Signal *pSignal);

            /// The timestamp of the time frame.
            TIME::Timestamp m_Timestamp;

            /// The output stream.
            std::ofstream &m_rFile;

            /// Time frame signals.
            SIGNAL::UniqueSignalsCollectionT m_FrameSignals;

            /// All signals.
            SIGNAL::UniqueSignalsCollectionT m_Signals;
    };
}


text:
package org.kaaproject.kaa.demo.smarthousedemo.util;

public class Utils {

    /**
     * A function that converts time in milliseconds into the timer format
     * Hours:Minutes:Seconds
     * */
    public static String milliSecondsToTimer(long milliseconds){
        String finalTimerString = "";
        String secondsString = "";

        // Convert total duration into time in milliseconds.
           int hours = (int)( milliseconds / (1000*60*60));
           int minutes = (int)(milliseconds % (1000*60*60)) / (1000*60);
           int seconds = (int) ((milliseconds % (1000*60*60)) % (1000*60) / 1000);

           // Add hours.
           if(hours > 0){
               finalTimerString = hours + ":";
           }

           // Prepend 0 to seconds if there is one digit.
           if(seconds < 10){
               secondsString = "0" + seconds;
           }else{
               secondsString = "" + seconds;}

           finalTimerString = finalTimerString + minutes + ":" + secondsString;

        // Return the timer string.
        return finalTimerString;
    }

    /**
     * A function that obtains the progress percentage.
     * @param currentDuration
     * @param totalDuration
     * */
    public static int getProgressPercentage(long currentDuration, long totalDuration){
        Double percentage = (double) 0;

        long currentSeconds = (int) (currentDuration / 1000);
        long totalSeconds = (int) (totalDuration / 1000);

        // Calculate the percentage.
        percentage =(((double)currentSeconds)/totalSeconds)*100;

        // Return the percentage.
        return percentage.intValue();
    }

    /**
     * Function that converts the progress into the timer format.
     * @param progress -
     * @param totalDuration
     * Returns the current duration in milliseconds.
     * */
    public static int progressToTimer(int progress, int totalDuration) {
        int currentDuration = 0;
        totalDuration = (int) (totalDuration / 1000);
        currentDuration = (int) ((((double)progress) / 100) * totalDuration);

        // Return the current duration in milliseconds.
        return currentDuration * 1000;
    }
}


text:
using System.Collections.Generic;
using UnityEngine;
using System;

namespace UnityEngine.Experimental.Rendering.HDPipeline
{
    [GenerateHLSL]
    public enum ColorPickerDebugMode
    {
        None,
        Byte,
        Byte4,
        Float,
        Float4,
    }

    [Serializable]
    public class ColorPickerDebugSettings
    {
        public ColorPickerDebugMode colorPickerMode = ColorPickerDebugMode.None;
        public Color fontColor = new Color(1.0f, 0.0f, 0.0f);

        public void OnValidate()
        {
        }
    }
}


text:
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, ForeignKey, UniqueConstraint, Index
from sqlalchemy.orm import sessionmaker, relationship
from sqlalchemy import create_engine
engine=create_engine("mysql+pymysql://xiaoyong:1@10.0.0.25:3306/s13",max_overflow=5)  #链接数据库
Base=declarative_base()

class Users(Base):
#一对一
    __tablename__="users"  #表名
    id=Column(Integer,primary_key=True)
    name=Column(String(32))
    extra=Column(String(16))

    __table_args__=(
        UniqueConstraint("id","name",name="uix_id_name"),
        Index("ix_id_name","name","extra")
    )

#一对多
class Favor(Base):
    __tablename__="favor"
    nid=Column(Integer,primary_key=True)
    caption=Column(String(50),default="red",unique=True)

class Person(Base):
    __tablename__="person"
    nid=Column(Integer,primary_key=True)
    name=Column(String(32),index=True,nullable=True)
    favor_id=Column(Integer,ForeignKey("favor.nid"))

# 多对多
class ServerToGroup(Base):
    __tablename__="servertogroup"
    nid=Column(Integer,primary_key=True,autoincrement=True)
    server_id=Column(Integer,ForeignKey("server.id"))
    group_id=Column(Integer,ForeignKey("group.id"))

class Group(Base):
    __tablename__="group"
    id=Column(Integer,primary_key=True)
    name=Column(String(64),unique=True,nullable=False)

class server(Base):
    __tablename__="server"
    id=Column(Integer,primary_key=True,autoincrement=True)
    hostname=Column(String(64),unique=True,nullable=False)

#unique=true是指这个字段的值在这张表里不能重复,所有记录值都要唯一,就像主键那样
#nullable=false是这个字段在保存时必需有值

Base.metadata.create_all(engine)  #创建表
#Base.metadata.drop_all(engine)  #删除表


text:
using Aspose.Email.Storage.Pst;

/* This project uses Automatic Package Restore feature of NuGet to resolve Aspose.Email for .NET
   API reference when the project is build. Please check https://Docs.nuget.org/consume/nuget-faq
   for more information. If you do not wish to use NuGet, you can manually download
   Aspose.Email for .NET API from https://www.nuget.org/packages/Aspose.Email/,
   install it and then add its reference to this project. For any issues, questions or suggestions
   please feel free to contact us using https://forum.aspose.com/c/email
*/

namespace Aspose.Email.Examples.CSharp.Email.Outlook
{
    class ConvertOSTToPST
    {
        public static void Run()
        {
            // ExStart:ConvertOSTToPST
            string dataDir = RunExamples.GetDataDir_Outlook();

            // Load the Outlook file
            string path = dataDir + "PersonalStorage.pst";

            // Get the Display Name of the file
            using (PersonalStorage ost = PersonalStorage.FromFile(path))
            {
                ost.SaveAs(dataDir + "ConvertOSTToPST_out.pst", FileFormat.Pst);
            }
            // ExEnd:ConvertOSTToPST
        }
    }
}


text:
package dk.brics.tajs.analysis.dom.event;

import dk.brics.tajs.analysis.State;

/**
 * Initial State Builder for DOM Events.
 *

 * More information at:
 *

 * http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/
 * http://www.w3.org/TR/2003/NOTE-DOM-Level-3-Events-20031107/
 *

 * http://www.w3.org/TR/REC-html40/interact/scripts.html#h-18.2.3
 */
public class EventBuilder {

    public static void build(State s) {
        Event.build(s);
        EventTarget.build(s);
        EventListener.build(s);
        EventException.build(s);
        DocumentEvent.build(s);
        MutationEvent.build(s);
        UIEvent.build(s);
        KeyboardEvent.build(s);
        MouseEvent.build(s);
        WheelEvent.build(s);
    }

}


text:
package gardenruntimetest

import (
	"context"
	"testing"

	"github.com/concourse/concourse/atc/runtime/runtimetest"
	"github.com/concourse/concourse/worker/baggageclaim"
	"github.com/stretchr/testify/require"
)

func TestVolume_P2PStreamInOut_Root(t *testing.T) {
	content := runtimetest.VolumeContent{
		"file1":        {Data: []byte("file 1 content")},
		"file2":        {Data: []byte("file 2 content")},
		"folder/file3": {Data: []byte("file 3 content")},
	}
	volume1 := NewVolume("volume1").WithContent(content)
	volume2 := NewVolume("volume2")

	ctx := context.Background()

	url, err := volume2.GetStreamInP2pUrl(ctx, ".")
	require.NoError(t, err)

	err = volume1.StreamP2pOut(ctx, ".", url, baggageclaim.GzipEncoding)
	require.NoError(t, err)

	require.Equal(t, content, volume2.Content)
}


text:
/**
 * Calender helpers
 * @module built.core.calendar.calendar
 */
define(function(require, exports, module){

    function _isDate(obj){
        // taken directly from underscore.js to avoid the _ dependency.
        // perhaps this should be moved to datetime?
        return Object.prototype.toString.call(obj) == '[object Date]';
    }

    /**
     * used to get the first day of the month for a date
     *
     * Example :ref:`example.calendar.firstOfMonth`
     *
     * @function
     * @memberOf built.core.calendar.calendar
     * @param  {Date|Number} [year]  any date
     * @param  {Number} [month] Date object
     * @return {Date}       the first day of the month passed in
     *
     */
    function firstOfMonth(year, month){

        if(_isDate(year)){
            return new Date(year.getFullYear(), year.getMonth(), 1);
        }

        if (!year && !month){
            var now = new Date();
            year = now.getFullYear();
            month = now.getMonth();
        } else {

            // javascript months are 0 based, 0 would be January
            // the interface here expects 1 for January.
            month = month - 1;
        }

        return new Date(year, month, 1);
    }

    /**
     * get the previous month for given year and month
     *
     * Example :ref:`example.calendar.previousMonthForYearMonth`
     *
     * @function
     * @memberOf built.core.calendar.calendar
     * @param  {Date} year  any date
     * @param  {Date} month Date object
     * @return {Date}       previous month
     *
     */
    function previousMonthForYearMonth(year, month){
        var date = new Date(year, (month - 1), 1);
        return previousMonthForDate(date);
    }

    /**
     * get the next month for given year and month
     *
     * Example :ref:`example.calendar.nextMonthForYearMonth`
     *
     * @function
     * @memberOf built.core.calendar.calendar
     * @param  {Number} year  Year
     * @param  {Number} month Month
     * @return {Date}       next month
     *
     */
    function nextMonthForYearMonth(year, month){
        var date = new Date(year, (month - 1), 1);
        return nextMonthForDate(date);
    }

    /**
     * get the previous month for given date
     *
     * Example :ref:`example.calendar.previousMonthForDate`
     *
     * @function
     * @memberOf built.core.calendar.calendar
     * @param  {Date} [date]  any date
     * @return {Date}       previous month
     *
     */
    function previousMonthForDate(date){
        // day zero represents the last day of the previous month
        return new Date(date.getFullYear(), date.getMonth(), 0);
    }

    /**
     * get the next month for given date
     *
     * Example :ref:`example.calendar.nextMonthForDate`
     *
     * @function
     * @memberOf built.core.calendar.calendar
     * @param  {Date} [date]  any date
     * @return {Date}       next month
     *
     */
    function nextMonthForDate(date){

        if(date.getDate() != 1){
            date = new Date(date.getFullYear(), date.getMonth(), 1);
        }

        var startTZ = date.getTimezoneOffset();
        var endTZ;

        var days = daysInJavaScriptMonth(date.getFullYear(), date.getMonth());
        result  = new Date(date.getTime() + ((86400 * (days)) * 1000));

        endTZ = result.getTimezoneOffset();
        var tzShift = (endTZ - startTZ) * 60 * 1000;

        return new Date(result.getTime() + tzShift);
    }

    /**
     * returns a 0 based index version of the month
     *
     * Example :ref:`example.calendar.daysInJavaScriptMonth`
     *
     * * .. note ::
     *
     *     JS is 0 based months, 0 = January
     *     passing 0 for the day in the below is syaing
     *     give me the last day of the previous month.
     *     So we need to add 1 to our month, so that
     *     "last month", is effectively the request month.
     *
     * @function
     * @memberOf built.core.calendar.calendar
     * @param  {Number} year  any date
     * @param  {Number} month  any date
     * @return {Date}       next month
     *
     */
    function daysInJavaScriptMonth(year, month){

        if (!year && !month){
            var now = new Date();
            year = now.getFullYear();
            month = now.getMonth();
        }

        month = month + 1;

        var d = new Date(year, month, 0);
        return d.getDate();
    }

    /**
     * gets you the number of days in a given month
     *
     * Example :ref:`example.calendar.calendarMonthDays`
     *
     * @function
     * @memberOf built.core.calendar.calendar
     * @param  {Number} year  desired year
     * @param  {Number} month  desired month
     * @param  {Object} options  { firstDayOfWeek: Number, useDates: Boolean}
     * @return {Date}       next month
     *
     */

    function calendarMonthDays(year, month, options){
        options = options || {};
        var firstDayOfWeek = options.firstDayOfWeek || 0;
        var useDates = options.useDates || false;

        var date = _isDate(year) ? year : firstOfMonth(year, month);
        var days = daysInJavaScriptMonth(date.getFullYear(), date.getMonth());

        if(date.getDate() != 1){
            date = new Date(date.getFullYear(), date.getMonth(), 1);
        }

        var first = date.getDay();
        // var weekdaysCount = date.getDay() - firstDayOfWeek;
        // if (weekdaysCount == -1) weekdaysCount = 6;

        var result = [];

        // push in undefined's to represent where the month
        // should start.
        // for(var i = 0; i < weekdaysCount; i++){
        //     result.push(undefined);
        // }

        year = date.getFullYear();
        month = date.getMonth();

        for(i = 1; i <= days; i++) {
            result.push(useDates ? new Date(year, month, i) : i);
        }

        return result;
    }

    /**
     * get a buffered (42 days (6 weeks * 7 days)) array of date objects
     * for any given year and month
     *
     * Example :ref:`example.calendar.bufferedCalendarMonthDays`
     *
     * .. note ::
     *     Returns a 42 (7x6) item array representing the last
     *     days of the previous month, the days of the desired month
     *     and the first days of the next month.
     *
     *     This is intended to be used to build a 7x6 block calendar
     *     representation. If you just want the days for the current month,
     *     omitting the prefix and duffix days, use calendarMonthDays()
     *
     * @function
     * @memberOf built.core.calendar.calendar
     * @param  {Number} year  desired year
     * @param  {Number} month  desired month
     * @param  {Object} options  { firstDayOfWeek: Number, useDates: Boolean}
     * @return {Date}       next month
     *
     */

    function bufferedCalendarMonthDays(year, month, options){
        options = options || {};
        options.firstDayOfWeek = options.firstDayOfWeek || 0;
        options.useDates = options.useDates || false;

        if(options.prefixDays === undefined){
            options.prefixDays = true;
        }

        if(options.suffixDays === undefined){
            options.suffixDays = true;
        }

        var firstDayOfWeek = options.firstDayOfWeek;
        var useDates = options.useDates;
        var date = _isDate(year) ? year : firstOfMonth(year, month);

        if(date.getDate() != 1){
            date = new Date(date.getFullYear(), date.getMonth(), 1);
        }

        var weekdaysCount = date.getDay() - firstDayOfWeek;

        if (weekdaysCount == -1) weekdaysCount = 6;

        var lastMonth = previousMonthForDate(date);
        var nextMonth = nextMonthForDate(date);

        var results = [];
        var week = [];
        var value;

        // days last month
        for(var i = 0; i < weekdaysCount; i++) {
            var day = lastMonth.getDate() - (weekdaysCount - i) + 1;
            var d = new Date(lastMonth.getFullYear(), lastMonth.getMonth(), day);
            value = useDates ? d : d.getDate();
            results.push(options.prefixDays ? value : undefined);
        }

        results = results.concat(calendarMonthDays(date, null, options));

        // days next month to round us off to 6 weeks
        var nextMonthYear = nextMonth.getFullYear();
        var nextMonthMonth = nextMonth.getMonth();
        var nextMonthDay = 1;

        while(results.length < 42){
            value = useDates ? new Date(nextMonthYear, nextMonthMonth, nextMonthDay) : nextMonthDay;
            results.push(options.suffixDays ? value : undefined);
            nextMonthDay++;
        }

        return results;
    }

    /**
     * returns back an array of arrays for a given year/month with all
     * of the dates populated in each slot.  used for building calendars
     *
     * Example :ref:`example.calendar.bufferedCalendarMonthWeeks`
     *
     *
     * @function
     * @memberOf built.core.calendar.calendar
     * @param  {Number} year  desired year
     * @param  {Number} month  desired month
     * @param  {Object} options  { firstDayOfWeek: Number, useDates: Boolean}
     * @return {Date}       next month
     *
     */

    function bufferedCalendarMonthWeeks(year, month, options){
        var days = bufferedCalendarMonthDays(year, month, options);
        return _splitDaysToWeeks(days);
    }

    function _splitDaysToWeeks(days, result){
        result = result || [];

        while (days.length){
            result.push(days.splice(0, 7));
        }

        return result;
    }

    exports.daysInJavaScriptMonth = daysInJavaScriptMonth;
    exports.calendarMonthDays = calendarMonthDays;
    exports.bufferedCalendarMonthDays = bufferedCalendarMonthDays;
    exports.bufferedCalendarMonthWeeks = bufferedCalendarMonthWeeks;
    exports.previousMonthForYearMonth = previousMonthForYearMonth;
    exports.previousMonthForDate = previousMonthForDate;
    exports.nextMonthForYearMonth = nextMonthForYearMonth;
    exports.nextMonthForDate = nextMonthForDate;
    exports.firstOfMonth = firstOfMonth;
});


text:
namespace g{
namespace Fuse{
namespace Elements{

// public enum HitTestMode :887
uEnumType* HitTestMode_typeof();

}}} // ::g::Fuse::Elements


text:
namespace EZOper.TechTester.JWTOAuthWebSI.Services.JWTCommon
{
    public class RedisOptions
    {
        public string MasterServer { get; set; }
        public string SlaveServer { get; set; }
    }
}


text:
"""This module is the tcp client that gets targets and sends them to a robot.

NOTE: THIS RUNS ON THE DRIVER STATION, NOT ON THE ROBOT.

DO NOT UPLOAD TO THE ROBOT!!

"""

import json_helper
import logging
import socket
import sys
import target
import targeting
import time

class ImageProcessor(object):
    """Gets targets and sends them to a tcp server."""

    _logger = None
    _targeting = None

    def __init__(self, port=1180, log_handler=None):
        """Initialize the image processor."""
        self._logger = logging.getLogger(__name__)
        handler = None
        if log_handler:
            handler = log_handler
        else:
            formatter = logging.Formatter('%(asctime)s - %(levelname)s:'
                                          '%(name)s:%(message)s')
            handler = logging.StreamHandler(stream=sys.stdout)
            handler.setLevel(logging.DEBUG)
            handler.setFormatter(formatter)
        self._logger.addHandler(handler)
        self._logger.setLevel(logging.DEBUG)

        self.port = port
        self._sock = None
        self._targeting = targeting.Targeting()

    def process(self):
        """Gets images and sends them to the server."""
        robot_connected = False
        camera_connected = False
        # Loop continuously
        while True:
            # Try to connect to the robot
            if not robot_connected:
                try:
                    self._logger.info("Attempting to connect to robot...")
                    if self._sock == None:
                        # Create a socket (SOCK_STREAM means a TCP socket)
                        self._sock = socket.socket(socket.AF_INET,
                                                   socket.SOCK_STREAM)
                    # Connect to server and send data
                    address = ("10.0.94.2", self.port)
                    self._sock.connect(address)
                    robot_connected = True
                except KeyboardInterrupt:
                    raise
                except Exception as excep:
                    self._logger.warn("Robot connection failed: " + str(excep))
                    self._sock = None
                    robot_connected = False
            # Try to connect to the camera
            if not camera_connected:
                self._logger.info("Attempting to connect to the camera...")
                if not self._targeting.open():
                    self._logger.warn("Camera connection failed.")
                    camera_connected = False
                else:
                    camera_connected = True
            # If one of the two isn't connected, we can't continue yet
            if not camera_connected or not robot_connected:
                self._logger.info("Retrying in 5 seconds.")
                time.sleep(5)
                continue
            # Both connections are active; time to get to work
            self._logger.info("Connected to both! Processing targets...")
            # Loop as long as we're connected
            while True:
                try:
                    data = None
                    # Get an image from the webcam and process it into a List of
                    # Targets
                    targets = self._targeting.get_targets()
                    if not targets:
                        self._logger.debug("Got None from get_targets()")
                        targets = []
                    # If there weren't any targets, create a 'no targets' object
                    if len(targets) <= 0:
                        self._logger.debug("No targets found.")
                        no_target = target.Target()
                        no_target.no_targets = True
                        targets.append(no_target)
                    # Convert Target list to JSON and send it to the robot
                    data = json_helper.to_json(targets)
                    self._logger.debug("Sending: " + str(data))
                    if data:
                        # Python3
                        #self._sock.send(bytes(data + '\n', "utf-8"))
                        # Python2
                        self._sock.send(bytes(data + '\n'))
                # If anything fails, bail out and try to reconnect
                except KeyboardInterrupt:
                    raise
                except Exception as excep:
                    self._logger.error("Connection error, disconnected: " +
                                       str(excep))
                    if self._sock:
                        self._sock.close()
                    #self._targeting.close()
                    self._sock = None
                    break
                # Wait before getting new targets
                #time.sleep(0.2)
            # Wait before trying to reconnect
            time.sleep(1)

# This lets us run this as a script
if __name__ == '__main__':
    # Create the Image Processor and start it
    iproc = ImageProcessor()
    iproc.process()


text:
from django.conf.urls.defaults import *

from swaps import views, models
from swaps.forms import *

urlpatterns = patterns('',
    # offer
    url(r'^offer/(?P<offer_id>\d+)/$', 'swaps.views.offer', name='offer'),

    # all offers
    url(r'^$', 'swaps.views.offers', name="offer_list_all"),

    # your offers
    url(r'^your_offers/$', 'swaps.views.your_offers', name='offer_list_yours'),

    # swap
    url(r'^swap/(?P<swap_id>\d+)/$', 'swaps.views.swap', name='swap'),

    # swaps proposed_to_you
    url(r'^proposed_to_you/$', 'swaps.views.proposed_to_you', name='proposed_to_you'),

    # swaps proposed_by_you
    url(r'^proposed_by_you/$', 'swaps.views.proposed_by_you', name='proposed_by_you'),

    # your accepted swaps
    url(r'^accepted/$', 'swaps.views.accepted_swaps', name='accepted_swaps'),

    # your dead swaps
    url(r'^dead/$', 'swaps.views.dead_swaps', name='dead_swaps'),

    # new offer
    url(r'^new/$', 'swaps.views.new', name='offer_new'),

    # edit offer
    url(r'^edit/(?P<offer_id>\d+)/$', 'swaps.views.edit_offer', name='offer_edit'),

    # cancel offer
    url(r'^cancel/(?P<offer_id>\d+)/$', 'swaps.views.cancel_offer', name='offer_cancel'),

    # delete offer
    url(r'^delete/(?P<offer_id>\d+)/$', 'swaps.views.delete_offer', name='offer_delete'),

    # propose swap
    url(r'^proposal/(?P<offer_id>\d+)/$', 'swaps.views.propose_swap', name='propose_swap'),

    # accept swap
    url(r'^accept/(?P<swap_id>\d+)/$', 'swaps.views.accept_swap', name='accept_swap'),

    # reject swap
    url(r'^reject/(?P<swap_id>\d+)/$', 'swaps.views.reject_swap', name='reject_swap'),

    # cancel swap
    url(r'^cancel/(?P<swap_id>\d+)/$', 'swaps.views.cancel_swap', name='cancel_swap'),

    # ajax validation
    #(r'^validate/$', 'ajax_validation.views.validate', {'form_class': BlogForm, 'callback': lambda request, *args, **kwargs: {'user': request.user}}, 'blog_form_validate'),
)


text:
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2017.11.30 at 08:24:17 PM JST
//

package uk.org.siri.siri;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;

/**
 * Type for Revocation of a previous message.
 *
 *
Java class for InfoMessageCancellationStructure complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="InfoMessageCancellationStructure">
 *   <complexContent>
 *     <extension base="{http://www.siri.org.uk/siri}AbstractReferencingItemStructure">
 *       <sequence>
 *         <element name="InfoMessageIdentifier" type="{http://www.siri.org.uk/siri}InfoMessageRefStructure"/>
 *         <element name="InfoChannelRef" type="{http://www.siri.org.uk/siri}InfoChannelRefStructure" minOccurs="0"/>
 *         <element ref="{http://www.siri.org.uk/siri}Extensions" minOccurs="0"/>
 *       </sequence>
 *     </extension>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "InfoMessageCancellationStructure", propOrder = {
    "infoMessageIdentifier",
    "infoChannelRef",
    "extensions"
})
public class InfoMessageCancellationStructure
    extends AbstractReferencingItemStructure
{

    @XmlElement(name = "InfoMessageIdentifier", required = true)
    protected InfoMessageRefStructure infoMessageIdentifier;
    @XmlElement(name = "InfoChannelRef")
    protected InfoChannelRefStructure infoChannelRef;
    @XmlElement(name = "Extensions")
    protected ExtensionsStructure extensions;

    /**
     * Gets the value of the infoMessageIdentifier property.
     *
     * @return
     *     possible object is
     *     {@link InfoMessageRefStructure }
     *
     */
    public InfoMessageRefStructure getInfoMessageIdentifier() {
        return infoMessageIdentifier;
    }

    /**
     * Sets the value of the infoMessageIdentifier property.
     *
     * @param value
     *     allowed object is
     *     {@link InfoMessageRefStructure }
     *
     */
    public void setInfoMessageIdentifier(InfoMessageRefStructure value) {
        this.infoMessageIdentifier = value;
    }

    /**
     * Gets the value of the infoChannelRef property.
     *
     * @return
     *     possible object is
     *     {@link InfoChannelRefStructure }
     *
     */
    public InfoChannelRefStructure getInfoChannelRef() {
        return infoChannelRef;
    }

    /**
     * Sets the value of the infoChannelRef property.
     *
     * @param value
     *     allowed object is
     *     {@link InfoChannelRefStructure }
     *
     */
    public void setInfoChannelRef(InfoChannelRefStructure value) {
        this.infoChannelRef = value;
    }

    /**
     * Gets the value of the extensions property.
     *
     * @return
     *     possible object is
     *     {@link ExtensionsStructure }
     *
     */
    public ExtensionsStructure getExtensions() {
        return extensions;
    }

    /**
     * Sets the value of the extensions property.
     *
     * @param value
     *     allowed object is
     *     {@link ExtensionsStructure }
     *
     */
    public void setExtensions(ExtensionsStructure value) {
        this.extensions = value;
    }

}