text:
iBeginH(struct_, New, "new")
    iTarget(optype::refStruct)
    iOp1(optype::typeStruct, true)
iEndH

iBeginH(struct_, Get, "struct.get")
    iTarget(optype::any)
    iOp1(optype::refStruct, true)
    iOp2(optype::string, true)
iEndH

iBeginH(struct_, GetDefault, "struct.get_default")
    iTarget(optype::any)
    iOp1(optype::refStruct, true)
    iOp2(optype::string, true)
    iOp3(optype::any, false)
iEndH

iBeginH(struct_, IsSet, "struct.is_set")
    iTarget(optype::boolean)
    iOp1(optype::refStruct, true)
    iOp2(optype::string, true)
iEndH

iBeginH(struct_, Set, "struct.set")
    iOp1(optype::refStruct, false)
    iOp2(optype::string, true)
    iOp3(optype::any, false)
iEndH

iBeginH(struct_, Unset, "struct.unset")
    iOp1(optype::refStruct, false)
    iOp2(optype::string, true)
iEndH


text:
# isArrayArray

> Test if a value is an array of arrays.

## Usage

```javascript
var isArrayArray = require( '@stdlib/assert/is-array-array' );
```

#### isArrayArray( value )

Tests if a `value` is an `array` of `arrays`.

```javascript
var bool = isArrayArray( [ [], [] ] );
// returns true

bool = isArrayArray( [ {}, {} ] );
// returns false

bool = isArrayArray( [] );
// returns false

bool = isArrayArray( {} );
// returns false

bool = isArrayArray( [ null, {} ] );
// returns false
```

## Examples

```javascript
var isArrayArray = require( '@stdlib/assert/is-array-array' );

var bool = isArrayArray( [ [], [], [] ] );
// returns true

bool = isArrayArray( [ [], {} ] );
// returns false

bool = isArrayArray( [] );
// returns false

bool = isArrayArray( {} );
// returns false

bool = isArrayArray( [ 'a', 'b' ] );
// returns false

bool = isArrayArray( null );
// returns false
```

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Data.SqlClient;
using System.Reflection;
using System.Reflection.Emit;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace fdw.Common.Data.Tests
{
    [TestClass]
    public class CodeBaseTests
    {
        [TestMethod]
        public void TestDeclareTypeOfByGeneric()
        {
            using (var wrapper = new TestReaderWrapper<NullableDateTimeType>("SELECT NULL"))
            {
                var populator = new Populator<EmptyPocoTest0, SqlDataReader>(wrapper.Reader);
                var cb = new CodeBaseBody<EmptyPocoTest0, SqlDataReader>(populator);
                cb.DeclareTypeOf<int>();
                Assert.IsTrue(cb.OpCodes.Count == 0);
                Assert.IsTrue(cb.TypesToLocalOffset.ContainsKey(typeof (int)));
            }
        }
        [TestMethod]
        public void TestDeclareTypeOfByParameter()
        {
            using (var wrapper = new TestReaderWrapper<NullableDateTimeType>("SELECT NULL"))
            {
                var populator = new Populator<EmptyPocoTest0, SqlDataReader>(wrapper.Reader);
                var cb = new CodeBaseBody<EmptyPocoTest0, SqlDataReader>(populator);
                cb.DeclareTypeOf(typeof (int));
                Assert.IsTrue(cb.OpCodes.Count == 0);
                Assert.IsTrue(cb.TypesToLocalOffset.ContainsKey(typeof (int)));
            }
        }
        [TestMethod]
        public void TestJumpTo()
        {
            using (var wrapper = new TestReaderWrapper<NullableDateTimeType>("SELECT NULL"))
            {
                var populator = new Populator<EmptyPocoTest0, SqlDataReader>(wrapper.Reader);
                var cb = new CodeBaseBody<EmptyPocoTest0, SqlDataReader>(populator);
                cb.JumpTo(OpCodes.Nop, new Label());
                Assert.AreEqual(1, cb.OpCodes.Count, "Opcode count mismatch.");
                Assert.AreEqual(cb.OpCodes.Peek().OpCode, OpCodes.Nop, "Opcode type mismatch.");
            }
        }
        [TestMethod]
        public void TestNewByGeneric()
        {
            using (var wrapper = new TestReaderWrapper<NullableDateTimeType>("SELECT NULL"))
            {
                var populator = new Populator<FdwDataObjectInheritancePocoTest0, SqlDataReader>(wrapper.Reader);
                var cb = new CodeBaseBody<FdwDataObjectInheritancePocoTest0, SqlDataReader>(populator);

                var ctor =
                    typeof (FdwDataObjectInheritancePocoTest0).GetConstructor(
                        BindingFlags.Public | BindingFlags.Instance, null, new[] {typeof (int)}, null);
                Assert.IsNotNull(ctor);
                cb.New<FdwDataObjectInheritancePocoTest0>(ctor);
                Assert.AreEqual(1, cb.OpCodes.Count, "Opcode count mismatch.");
                Assert.AreEqual(cb.OpCodes.Peek().OpCode, OpCodes.Newobj, "Opcode type mismatch.");
            }
        }
        [TestMethod]
        public void TestNewByParameter()
        {
            using (var wrapper = new TestReaderWrapper<NullableDateTimeType>("SELECT NULL"))
            {
                var populator = new Populator<FdwDataObjectInheritancePocoTest0, SqlDataReader>(wrapper.Reader);
                var cb = new CodeBaseBody<FdwDataObjectInheritancePocoTest0, SqlDataReader>(populator);

                var ctor =
                    typeof (FdwDataObjectInheritancePocoTest0).GetConstructor(
                        BindingFlags.Public | BindingFlags.Instance, null, new[] {typeof (int)}, null);
                Assert.IsNotNull(ctor);
                cb.New(ctor);
                Assert.AreEqual(1, cb.OpCodes.Count, "Opcode count mismatch.");
                Assert.AreEqual(cb.OpCodes.Peek().OpCode, OpCodes.Newobj, "Opcode type mismatch.");
            }
        }
        [TestMethod]
        public void TestInitializeValueTypeOfByGeneric()
        {
            using (var wrapper = new TestReaderWrapper<NullableDateTimeType>("SELECT NULL"))
            {
                var populator = new Populator<EmptyPocoTest0, SqlDataReader>(wrapper.Reader);
                var cb = new CodeBaseBody<EmptyPocoTest0, SqlDataReader>(populator);

                cb.InitializeValueTypeOf<int>();
                Assert.AreEqual(1, cb.TypesToLocalOffset.Count);
                Assert.IsTrue(cb.TypesToLocalOffset.ContainsKey(typeof (int)));
                Assert.AreEqual(2, cb.OpCodes.Count);
                // TODO: Not a fan of binding to the opcode generation here.
                Assert.AreEqual(OpCodes.Initobj, cb.OpCodes.First().OpCode);
                Assert.AreEqual(OpCodes.Ldloca_S, cb.OpCodes.Last().OpCode);
            }
        }
        [TestMethod]
        public void TestInitializeValueTypeOfByParameter()
        {
            using (var wrapper = new TestReaderWrapper<NullableDateTimeType>("SELECT NULL"))
            {
                var populator = new Populator<EmptyPocoTest0, SqlDataReader>(wrapper.Reader);
                var cb = new CodeBaseBody<EmptyPocoTest0, SqlDataReader>(populator);

                cb.InitializeValueTypeOf(typeof (int));
                Assert.AreEqual(1, cb.TypesToLocalOffset.Count);
                Assert.IsTrue(cb.TypesToLocalOffset.ContainsKey(typeof (int)));
                Assert.AreEqual(2, cb.OpCodes.Count);
                // TODO: Not a fan of binding to the opcode generation here.
                Assert.AreEqual(OpCodes.Initobj, cb.OpCodes.First().OpCode);
                Assert.AreEqual(OpCodes.Ldloca_S, cb.OpCodes.Last().OpCode);
            }
        }
        [TestMethod]
        public void TestCall01()
        {
            using (var wrapper = new TestReaderWrapper<NullableDateTimeType>("SELECT NULL"))
            {
                var populator = new Populator<EmptyPocoTest0, SqlDataReader>(wrapper.Reader);
                var cb = new CodeBaseBody<EmptyPocoTest0, SqlDataReader>(populator);

                var method = typeof (int).GetMethod("ToString", BindingFlags.Public | BindingFlags.Instance, null,
                                                    Type.EmptyTypes, null);
                Assert.IsNotNull(method);
                var mb = cb.Call(method);
                Assert.IsNotNull(mb);
                Assert.AreEqual(1, cb.TypesToArguments.Count, "Argument count mismatch.");
                Assert.AreEqual(0, cb.TypesToLocalOffset.Count, "Local count mismatch.");
                Assert.AreEqual(mb.MethodInfo, method, "Method mutation.");
            }
        }
    }
}


text:
body {
	background: #2f2f2f; background-image: url("geoquest_bg.jpg");
	background-repeat: no-repeat; background-position: top left;
	margin: 0px; padding: 0px; scrollbar-base-color: #2f2f2f;
	color: f7f7cc;
	font-family: helvetica;
	font-size: 16px;
}
.geoquest {
	margin-left:20px;
	margin-top:75px;
	padding-top:25px;
	width:820px;
	overflow:auto;
/*	overflow: scroll;*/
	height: 550px;

 scrollbar-face-color: #cacaca;
 scrollbar-highlight-color: #cacaca;
 scrollbar-3dlight-color: #cacaca;
 scrollbar-darkshadow-color: #cacaca;
 scrollbar-shadow-color: #cacaca;
 scrollbar-arrow-color: #000000;
 scrollbar-track-color: #cacaca;

}
a:img {
  border: none;
}
a {
  text-decoration: none;
  color: #bbbb66;
}
a:hover {
  color: #ffffff;
  text-decoration: underline;
}
a:visited {
  color: #ffffff;
}
.home {
	text-align: left;
	margin: 12px 0px 0px 10px;
}
.home table {
	border: none;
	width: 820px;
}
.geoquest h1 {
	margin-top: 20px;

}
.clear {
	clear:both;
}


text:
<?php

//*** Gentoo default settings

//* Main
$conf['language'] = 'en';
$conf['distname'] = 'gentoo';
$conf['hostname'] = 'server1.domain.tld'; // Full hostname
$conf['thconfig_install_dir'] = '/usr/local/thconfig';
$conf['thconfig_config_dir'] = '/usr/local/thconfig';
$conf['thconfig_log_priority'] = 2;  // 0 = Debug, 1 = Warning, 2 = Error
$conf['thconfig_log_dir'] = '/var/log/thconfig';
$conf['server_id'] = 1;
$conf['init_scripts'] = '/etc/init.d';
$conf['runlevel'] = '/etc';
$conf['shells'] = '/etc/shells';
$conf['pam'] = '/etc/pam.d';

//* Services provided by this server, this selection will be overridden by the expert mode
$conf['services']['mail'] = true;
$conf['services']['web'] = true;
$conf['services']['dns'] = true;
$conf['services']['file'] = true;
$conf['services']['db'] = true;
$conf['services']['vserver'] = true;

//* MySQL
$conf['mysql']['installed'] = false; // will be detected automatically during installation
$conf['mysql']['init_script'] = 'mysql';
$conf['mysql']['host'] = 'localhost';
$conf['mysql']['ip'] = '127.0.0.1';
$conf['mysql']['port'] = '3306';
$conf['mysql']['database'] = 'dbthconfig';
$conf['mysql']['admin_user'] = 'root';
$conf['mysql']['admin_password'] = '';
$conf['mysql']['charset'] = 'utf8';
$conf['mysql']['thconfig_user'] = 'thconfig';
$conf['mysql']['thconfig_password'] = md5 (uniqid (rand()));
$conf['mysql']['master_slave_setup'] = 'n';
$conf['mysql']['master_host'] = '';
$conf['mysql']['master_database'] = 'dbthconfig';
$conf['mysql']['master_admin_user'] = 'root';
$conf['mysql']['master_admin_password'] = '';
$conf['mysql']['master_thconfig_user'] = '';
$conf['mysql']['master_thconfig_password'] = md5 (uniqid (rand()));

//* SuPHP
$conf['suphp']['config_file'] = '/etc/suphp.conf';

//* Apache
$conf['apache']['installed'] = false; // will be detected automatically during installation
$conf['apache']['user'] = 'apache';
$conf['apache']['group'] = 'apache';
$conf['apache']['init_script'] = 'apache2';
$conf['apache']['version'] = '2.2';
$conf['apache']['config_dir'] = '/etc/apache2';
$conf['apache']['config_file'] = $conf['apache']['config_dir'] .'/httpd.conf';
$conf['apache']['ssl_dir'] = '/etc/ssl/apache2';
$conf['apache']['vhost_conf_dir'] = $conf['apache']['config_dir'] . '/vhosts.d';
$conf['apache']['vhost_conf_enabled_dir'] = $conf['apache']['vhost_conf_dir'];
$conf['apache']['vhost_default'] = '00_default_vhost.conf';
$conf['apache']['vhost_port'] = '8080';
$conf['apache']['php_ini_path_apache'] = '/etc/php/apache2-php5/php.ini';
$conf['apache']['php_ini_path_cgi'] = '/etc/php/cgi-php5/php.ini';

//* Website base settings
$conf['web']['website_basedir'] = '/var/www';
$conf['web']['website_path'] = '/var/www/clients/client[client_id]/web[website_id]';
$conf['web']['website_symlinks'] = '/var/www/[website_domain]/:/var/www/clients/client[client_id]/[website_domain]/';

//* Apps base settings
$conf['web']['apps_vhost_ip'] = '_default_';
$conf['web']['apps_vhost_port'] = '8081';
$conf['web']['apps_vhost_servername'] = '';
$conf['web']['apps_vhost_user'] = 'ispapps';
$conf['web']['apps_vhost_group'] = 'ispapps';

//* Awstats settings
$conf['awstats']['conf_dir'] = '/etc/awstats';
$conf['awstats']['data_dir'] = '/var/lib/awstats';
$conf['awstats']['pl'] = '/usr/bin/awstats.pl';
$conf['awstats']['buildstaticpages_pl'] = '/usr/bin/awstats_buildstaticpages.pl';

//* Fastcgi
$conf['fastcgi']['fastcgi_phpini_path'] = '/etc/php/cgi-php5';
$conf['fastcgi']['fastcgi_starter_path'] = '/var/www/php-fcgi-scripts/[system_user]/';
$conf['fastcgi']['fastcgi_bin'] = '/usr/bin/php-cgi';

//* Postfix
$conf['postfix']['installed'] = false; // will be detected automatically during installation
$conf['postfix']['config_dir'] = '/etc/postfix';
$conf['postfix']['init_script'] = 'postfix';
$conf['postfix']['user'] = 'postfix';
$conf['postfix']['group'] = 'postfix';
$conf['postfix']['vmail_userid'] = '5000';
$conf['postfix']['vmail_username'] = 'vmail';
$conf['postfix']['vmail_groupid'] = '5000';
$conf['postfix']['vmail_groupname'] = 'vmail';
$conf['postfix']['vmail_mailbox_base'] = '/var/vmail';

//* Mailman
$conf['mailman']['installed'] = false; // will be detected automatically during installation
$conf['mailman']['config_dir'] = '/etc/mailman';
$conf['mailman']['init_script'] = 'mailman';

//* Getmail
$conf['getmail']['installed'] = false; // will be detected automatically during installation
$conf['getmail']['user'] = 'getmail';
$conf['getmail']['config_dir'] = '/etc/getmail';
$conf['getmail']['program'] = '/usr/bin/getmail';

//* Courier
$conf['courier']['installed'] = false; // will be detected automatically during installation
$conf['courier']['config_dir'] = '/etc/courier/authlib';
$conf['courier']['courier-authdaemon'] = 'courier-authlib';
$conf['courier']['courier-imap'] = 'courier-imapd';
$conf['courier']['courier-imap-ssl'] = 'courier-imapd-ssl';
$conf['courier']['courier-pop'] = 'courier-pop3d';
$conf['courier']['courier-pop-ssl'] = 'courier-pop3d-ssl';

//* Dovecot
$conf['dovecot']['installed'] = false; // will be detected automatically during installation
$conf['dovecot']['config_dir'] = '/etc/dovecot';
$conf['dovecot']['init_script'] = 'dovecot';

//* SASL
$conf['saslauthd']['installed'] = false; // will be detected automatically during installation
$conf['saslauthd']['config_file'] = '/etc/conf.d/saslauthd';
$conf['saslauthd']['config_dir'] = '/etc/sasl2';
$conf['saslauthd']['init_script'] = 'saslauthd';

//* Amavisd
$conf['amavis']['installed'] = false; // will be detected automatically during installation
$conf['amavis']['config_file'] = '/etc/amavisd.conf';
$conf['amavis']['init_script'] = 'amavisd';

//* ClamAV
$conf['clamav']['installed'] = false; // will be detected automatically during installation
$conf['clamav']['init_script'] = 'clamd';

//* Pureftpd
$conf['pureftpd']['installed'] = false; // will be detected automatically during installation
$conf['pureftpd']['config_file'] = '/etc/conf.d/pure-ftpd';
$conf['pureftpd']['mysql_config_file'] = '/etc/pureftpd-mysql.conf';
$conf['pureftpd']['init_script'] = 'pure-ftpd';

//* MyDNS
$conf['mydns']['installed'] = false; // will be detected automatically during installation
$conf['mydns']['config_dir'] = '/etc';
$conf['mydns']['init_script'] = 'mydns';

//* PowerDNS
$conf['powerdns']['installed'] = false; // will be detected automatically during installation
$conf['powerdns']['database'] = 'powerdns';
$conf["powerdns"]["config_dir"] = '/etc/powerdns';
$conf["powerdns"]["config_file"] = 'pdns-local.conf';
$conf['powerdns']['init_script'] = 'pdns.local';

//* BIND DNS Server
$conf['bind']['installed'] = false; // will be detected automatically during installation
$conf['bind']['bind_user'] = 'root';
$conf['bind']['bind_group'] = 'named';
$conf['bind']['bind_zonefiles_dir'] = '/etc/bind';
$conf['bind']['named_conf_path'] = '/etc/bind/named.conf';
$conf['bind']['named_conf_local_path'] = '/etc/bind/named.conf.local';
$conf['bind']['init_script'] = 'named';

//* Jailkit
$conf['jailkit']['installed'] = false; // will be detected automatically during installation
$conf['jailkit']['config_dir'] = '/etc/jailkit';
$conf['jailkit']['jk_init'] = 'jk_init.ini';
$conf['jailkit']['jk_chrootsh'] = 'jk_chrootsh.ini';
$conf['jailkit']['jailkit_chroot_app_programs'] = '/bin/groups /usr/bin/id /usr/bin/dircolors /usr/bin/less /usr/bin/basename /usr/bin/dirname /usr/bin/nano /usr/bin/vim';

//* Squid
$conf['squid']['installed'] = false; // will be detected automatically during installation
$conf['squid']['config_dir'] = '/etc/squid';
$conf['squid']['init_script'] = 'squid';

//* Nginx
$conf['nginx']['installed'] = false; // will be detected automatically during installation
$conf['nginx']['user'] = 'nginx';
$conf['nginx']['group'] = 'nginx';
$conf['nginx']['config_dir'] = '/etc/nginx';
$conf['nginx']['vhost_conf_dir'] = '/etc/nginx/sites-available';
$conf['nginx']['vhost_conf_enabled_dir'] = '/etc/nginx/sites-enabled';
$conf['nginx']['init_script'] = 'nginx';
$conf['nginx']['vhost_port'] = '8080';
$conf['nginx']['cgi_socket'] = '/var/run/fcgiwrap.socket';
$conf['nginx']['php_fpm_init_script'] = 'php5-fpm';
$conf['nginx']['php_fpm_ini_path'] = '/etc/php5/fpm/php.ini';
$conf['nginx']['php_fpm_pool_dir'] = '/etc/php5/fpm/pool.d';
$conf['nginx']['php_fpm_start_port'] = 9010;
$conf['nginx']['php_fpm_socket_dir'] = '/var/lib/php5-fpm';

//* vlogger
$conf['vlogger']['config_dir'] = '/etc/vlogger';

//* cron
$conf['cron']['init_script'] = 'vixie-cron';
$conf['cron']['crontab_dir'] = '/etc/cron.d';
$conf['cron']['group'] = 'cron';
$conf['cron']['wget'] = '/usr/bin/wget';

//* OpenVZ
$conf['openvz']['installed'] = false;

?>


text:
Internal Assets Tracking System for Maintain different Components.

[![Go Report Card](https://goreportcard.com/badge/github.com/improwised/cantaloupe)](https://goreportcard.com/report/github.com/improwised/cantaloupe)

# Development

## Dependencies
* Go 1.6
* [Glide](https://github.com/Masterminds/glide) - Package manager for Go
* PostgreSQL 9.4.4+
* npm

## Run postgres inside docker container from project directory

```
docker-compose up -d
```

## OR

```
docker run -d -it -v /Users/ashwin/cantaloupe/src/github.com/improwised/cantaloupe/postgres_data:/var/lib/postgresql/data -e POSTGRES_PASSWORD=123123 -e POSTGRES_USER=postgres -e POSTGRES_DB=cantaloupe -p 5432:5432 postgres:9.6-alpine
```

## Installation

### Back - end

* Setup go workspace by following this [Guide](https://golang.org/doc/code.html#Organization)
* Set Go vendor flag. Add the following to your `.bashrc` or `.zshrc` along with `$GOPATH` above
```
export GO15VENDOREXPERIMENT=1
```
* Install dependencies
```
$ glide install
```
* Create Database
```
$ create database cantaloupe
```
* Database Migration
```
$ go run ./db/migration.go
```
* Run project from cantaloupe
```
$ go run main.go
```
* access system on port 8000

# OR
### Using Makefile

To make necessary directories.
```
    $ make makedir
```

To download all dependencies.
```
    $ make get
```

To build the project and generate executable file.
```
    $ make build
```

To run the project.
```
    $ make run
```

To test the project.
```
    $ make test
```

To delete project dependencies and executable files.
```
    $ make clean
```

To make diractories, download dependencies, generating executable and then run the project.
```
    $ make all
```

# OR

### Docker-way
* Create database `cantaloupe`.
* Run migrations script from db directory `go run migrations.go`.
* Execute `docker-compose  up` from root.

### Front - end

* Switch to front-end directory.

* Run following commands to download dependencies.
```
    $ npm init

    $ npm install
```

* Start server by $ npm start

* Access system on port 8080

## Testing

TODO: How to run tests

Run following command from cantaloupe
```
GO_ENV2=testing go test
```
# Copyright & License

Copyright 2016 Improwised Technologies Pvt Ltd
www.improwised.com

This work is the sole property of Improwised Technologies Pvt Ltd brand
you may not use this work except in compliance with the License.

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.


text:
i_want_pets = ["I", "want", 3, "pets", "but", "only", "have", 2]
my_family_pets_ages = {"Evi" => 6, "Ditto" => 3, "Hoobie" => 3, "George" => 12, "Bogart" => 4, "Poly" => 4, "Annabelle" => 0}

# Person 1's solution
def my_array_finding_method(source, thing_to_find)
    found_array = source.grep(/#{thing_to_find}/)
    return found_array
end

def my_hash_finding_method(source, thing_to_find)
source.select { |key, value| value==thing_to_find }.keys
end

# Identify and describe the Ruby method(s) you implemented.
# iterate over the array to find all elements that contain thing_to_find
# return new array of elements that contain thing_to_find
# iterate over the array to find all of the keys associated with the input value.
#return keys

# Identify and describe the Ruby method(s) you implemented.
#I'm using grep. Grep is a way to look through an array for elements containing certain patterns. In this case, we're looking for array elements containing a letter.
# I used select to iterate over the hash and I also used .keys.
#

# Release 1: Identify and describe the Ruby method you implemented. Teach your
# accountability group how to use the methods.
#Grep is a way to look through an array for elements containing certain patterns. In this case, we're looking for array elements containing a letter. The cool thing about grep is that you can also look for multiple letters in a specific order. If you wanted to see all words that contain "th" for example, you'd be able to use grep.
#We use select for the hash. Select is a cool one because it returns all of the elements of what you enter in your block. In this case, we're saying return all things in the hash when the value is equal to the input. This gives us keys and values. We use .keys to let the program know that we only want the keys returned and not the values.
#

# Release 3: Reflect!
# What did you learn about researching and explaining your research to others?
# Explaining what I learned to others was a helpful experience for me. it forced me to dig deep for understanding of the concepts. I feel like this was a really helpful challenge because it forced me to really understand the methods.
#
#
#


text:
package ru.alttiri.stepik.contest_java.functionals;

import java.util.function.BinaryOperator;

/**
 2.9 Writing simple lambda expressions

 Write a lambda expression that accepts two integers arguments and returns max of them.

 Try not to use the Math library.

 You may write the expression in any valid format but with ; on the end.

 Examples: (x, y) -> x + y; (x, y) -> { return x + y; };

 Sample Input:
 1 4
 Sample Output:
 4

 */
public class Main9 {
    public static void main(String[] args) {
        BinaryOperator<Integer> max = (x, y) -> x >= y ? x : y;
        System.out.println(max.apply(100, 120));
        System.out.println(max.apply(200, 120));
    }
}


text: Collection of public AutoPkg recipes.


text:
set -e

if [ -z "$AWS_ACCESS_KEY_ID" ]; then
    echo "AWS_ACCESS_KEY_ID is not set"
    exit 1
fi

if [ -z "$AWS_SECRET_ACCESS_KEY" ]; then
    echo "AWS_SECRET_ACCESS_KEY is not set"
    exit 1
fi

function execute {
    local workflowId="$(uuidgen)"
    local input="$(<execute.json)"
    aws swf start-workflow-execution \
        --domain hello-world \
        --workflow-id "$workflowId" \
        --workflow-type name=HelloWorld,version=1.0 \
        --task-list name=hello-world-queue \
        --input "$input"
}

function execute-loop {
    execute
    sleep 30
    execute-loop
}

stack exec wolf-decider -- --config config.yaml --plan plan.yaml &
stack exec wolf-actor   -- --config config.yaml --queue hello-queue --command "python hello.py" &
stack exec wolf-actor   -- --config config.yaml --queue world-queue --command "python world.py" &

execute-loop &

wait


text:
import wavelet
import attribute
import avo


text:
package org.xmlcml.ami.visitor.tree;

import java.io.File;
import java.io.FileOutputStream;
import java.util.List;

import org.apache.log4j.Logger;
import org.junit.Assert;
import org.junit.Test;
import org.xmlcml.ami.Fixtures;
import org.xmlcml.euclid.Real2;
import org.xmlcml.graphics.svg.SVGElement;
import org.xmlcml.graphics.svg.SVGG;
import org.xmlcml.graphics.svg.SVGLine;
import org.xmlcml.graphics.svg.SVGPolyline;
import org.xmlcml.graphics.svg.SVGSVG;
import org.xmlcml.graphics.svg.SVGUtil;
import org.xmlcml.graphics.svg.linestuff.ComplexLine;
import org.xmlcml.graphics.svg.linestuff.ComplexLine.LineOrientation;
import org.xmlcml.graphics.svg.linestuff.ComplexLine.SideOrientation;
import org.xmlcml.graphics.svg.linestuff.LineMerger;
import org.xmlcml.graphics.svg.linestuff.LineMerger.MergeMethod;

public class TreeTest {

	private final static Logger LOG = Logger.getLogger(TreeTest.class);

	public static final double EPS = 0.01;

	@Test
	public void testCluster() throws Exception {
		SVGSVG svg = (SVGSVG) SVGElement.readAndCreateSVG(Fixtures.TREE_CLUSTER1_SVG);
		List<SVGLine> svgLines = SVGLine.extractSelfAndDescendantLines((SVGElement)svg.getChildElements().get(0));
		Assert.assertEquals("lines", 249, svgLines.size());
		List<SVGLine> zeroLines = ComplexLine.createSubsetAndRemove(svgLines, LineOrientation.ZERO, EPS);
		Assert.assertEquals("lines", 71, zeroLines.size());
		Assert.assertEquals("lines", 178, svgLines.size());
		List<SVGLine> verticalLines = ComplexLine.createSubset(svgLines, LineOrientation.VERTICAL, EPS);
		Assert.assertEquals(83, verticalLines.size());
		List<SVGLine> horizontalLines = ComplexLine.createSubset(svgLines, LineOrientation.HORIZONTAL, EPS);
		Assert.assertEquals(95, horizontalLines.size());
		SVGUtil.debug(svg, new FileOutputStream(Fixtures.TREE_CLUSTER1A_SVG),1);
	}

	@Test
	public void testClusterRedrawTree() throws Exception {
		SVGSVG svg = (SVGSVG) SVGElement.readAndCreateSVG(Fixtures.TREE_CLUSTER1_SVG);
		List<SVGLine> svgLines = SVGLine.extractSelfAndDescendantLines((SVGElement)svg.getChildElements().get(0));
		List<SVGLine> zeroLines = ComplexLine.createSubsetAndRemove(svgLines, LineOrientation.ZERO, EPS);
		extendZeroLines(zeroLines, LineOrientation.HORIZONTAL, 1.5f);
		SVGUtil.debug(svg, new FileOutputStream(Fixtures.TREE_CLUSTER1B_SVG),1);
	}

	private void extendZeroLines(List<SVGLine> svgLines, LineOrientation lineOrientation, double length) {
		for (SVGLine line : svgLines) {
			if (line.isZero(EPS)) {
				Real2 point = line.getXY(0);
				Real2 extension = (lineOrientation.equals(LineOrientation.HORIZONTAL)) ? new Real2(length, 0.0) : new Real2(0.0, length);
				point = point.plus(extension);
				line.setXY(point, 1);
			}
		}
	}

	@Test
	public void testCluster1() throws Exception {
		double EPS1 = 0.3;
		SVGSVG svg = (SVGSVG) SVGElement.readAndCreateSVG(Fixtures.TREE_CLUSTER1_SVG);
		List<SVGLine> svgLines = SVGLine.extractSelfAndDescendantLines((SVGElement)svg.getChildElements().get(0));
		for (SVGLine line : svgLines) {
			line.setStrokeWidth(0.3);
		}
		List<SVGLine> zeroLines = ComplexLine.createSubsetAndRemove(svgLines, LineOrientation.ZERO, EPS1);
		Assert.assertTrue(72 >= zeroLines.size() && zeroLines.size() >= 71);
		//addZeroAsPoints(zeroLines, svg);
		List<SVGLine> verticalLines = ComplexLine.createSubset(svgLines, LineOrientation.VERTICAL, EPS1);
		Assert.assertEquals(83, verticalLines.size());
		List<SVGLine> joinedVerticalLines = LineMerger.mergeLines(verticalLines, EPS1, MergeMethod.TOUCHING_LINES);
		int size = joinedVerticalLines.size();
		Assert.assertTrue("size "+size, 81 >= size && size >= 80);
		List<SVGLine> horizontalLines = ComplexLine.createSubset(svgLines, LineOrientation.HORIZONTAL, EPS1);
		extendZeroLines(zeroLines, LineOrientation.HORIZONTAL, 0.5f);
		List<ComplexLine> verticalComplexLines =
				ComplexLine.createComplexLines(joinedVerticalLines, horizontalLines, EPS1);
		//SVGXTree tree = new SVGXTree();
		//tree.analyzeLines(verticalComplexLines, SideOrientation.MINUS);

		SVGUtil.debug(svg, new FileOutputStream(Fixtures.TREE_CLUSTER2A_SVG),1);
	}

	@Test
	public void testCluster7() throws Exception {
		double EPS1 = 0.3;
		SVGSVG svg = (SVGSVG) SVGElement.readAndCreateSVG(Fixtures.TREE_CLUSTER1_SVG);
		List<SVGElement> lineElements = SVGUtil.getQuerySVGElements(svg,  ".//svg:line");
		List<SVGLine> svgLines = SVGLine.extractLines(lineElements);
		Assert.assertEquals(249, svgLines.size());
		for (SVGLine line : svgLines) {
			line.setStrokeWidth(0.3);
		}
		List<SVGLine> zeroLines = ComplexLine.createSubsetAndRemove(svgLines, LineOrientation.ZERO, EPS1);
		Assert.assertEquals(72, zeroLines.size());
		List<SVGLine> verticalLines = ComplexLine.createSubset(svgLines, LineOrientation.VERTICAL, EPS1);
		Assert.assertEquals(83, verticalLines.size());
		List<SVGLine> horizontalLines = ComplexLine.createSubset(svgLines, LineOrientation.HORIZONTAL, EPS1);
		Assert.assertEquals(94, horizontalLines.size());
		List<ComplexLine> verticalComplexLines = ComplexLine.createComplexLines(verticalLines, horizontalLines, EPS1);
		List<ComplexLine> horizontalComplexLines = ComplexLine.createComplexLines(horizontalLines, verticalLines, EPS1);

		SVGXTree tree = new SVGXTree((SVGG)svgLines.get(0).getParent());

		List<ComplexLine> emptyEndedHorizontalLines =
				ComplexLine.extractLinesWithBranchAtEnd(horizontalComplexLines, SideOrientation.EMPTYLIST);
		Assert.assertEquals(0, emptyEndedHorizontalLines.size());
		List<ComplexLine> doubleEndedHorizontalLines =
				ComplexLine.extractLinesWithBranchAtEnd(horizontalComplexLines, SideOrientation.MINUSPLUSLIST);
		Assert.assertEquals(57, doubleEndedHorizontalLines.size());
		List<ComplexLine> minusEndedHorizontalLines =
				ComplexLine.extractLinesWithBranchAtEnd(horizontalComplexLines, SideOrientation.MINUSLIST);
		Assert.assertEquals(37, minusEndedHorizontalLines.size());
		List<ComplexLine> plusEndedHorizontalLines =
				ComplexLine.extractLinesWithBranchAtEnd(horizontalComplexLines, SideOrientation.PLUSLIST);
		Assert.assertEquals(0, plusEndedHorizontalLines.size()); // 0

		List<ComplexLine> emptyEndedVerticalLines =
				ComplexLine.extractLinesWithBranchAtEnd(verticalComplexLines, SideOrientation.EMPTYLIST);
		Assert.assertEquals(18, emptyEndedVerticalLines.size());
		List<ComplexLine> doubleEndedVerticalLines =
				ComplexLine.extractLinesWithBranchAtEnd(verticalComplexLines, SideOrientation.MINUSPLUSLIST);
		Assert.assertEquals(31, doubleEndedVerticalLines.size());
		List<ComplexLine> minusEndedVerticalLines =
				ComplexLine.extractLinesWithBranchAtEnd(verticalComplexLines, SideOrientation.MINUSLIST);
		Assert.assertEquals(11, minusEndedVerticalLines.size());
		List<ComplexLine> plusEndedVerticalLines =
				ComplexLine.extractLinesWithBranchAtEnd(verticalComplexLines, SideOrientation.PLUSLIST);
		Assert.assertEquals(23, plusEndedVerticalLines.size()); // 0

		tree.getTreeAnalyzer().extractLinesWithBranchAtEnd(LineOrientation.HORIZONTAL, SideOrientation.EMPTYLIST);

		SVGUtil.debug(svg, new FileOutputStream(Fixtures.TREE_CLUSTER2A_SVG),1);
	}

	@Test
	public void testCluster7a() {
		SVGSVG svg = (SVGSVG) SVGElement.readAndCreateSVG(Fixtures.TREE_PANEL1_SVG);
		List<SVGElement> lineElements = SVGUtil.getQuerySVGElements(svg,  ".//svg:line");
		List<SVGLine> svgLines = SVGLine.extractLines(lineElements);

		SVGXTree tree = new SVGXTree((SVGG)svgLines.get(0).getParent());
		TreeAnalyzer treeAnalyzer = tree.getTreeAnalyzer();
		treeAnalyzer.analyzeBranchesAtLineEnds(tree, svgLines, EPS);

		Assert.assertEquals(0, treeAnalyzer.extractLinesWithBranchAtEnd(LineOrientation.HORIZONTAL, SideOrientation.EMPTYLIST).size());
		Assert.assertEquals(13, treeAnalyzer.extractLinesWithBranchAtEnd(LineOrientation.HORIZONTAL, SideOrientation.MINUSPLUSLIST).size());
		Assert.assertEquals(15, treeAnalyzer.extractLinesWithBranchAtEnd(LineOrientation.HORIZONTAL, SideOrientation.MINUSLIST).size());
		Assert.assertEquals(0, treeAnalyzer.extractLinesWithBranchAtEnd(LineOrientation.HORIZONTAL, SideOrientation.PLUSLIST).size());

		Assert.assertEquals(0, treeAnalyzer.extractLinesWithBranchAtEnd(LineOrientation.VERTICAL, SideOrientation.EMPTYLIST).size());
		Assert.assertEquals(14, treeAnalyzer.extractLinesWithBranchAtEnd(LineOrientation.VERTICAL, SideOrientation.MINUSPLUSLIST).size());
		Assert.assertEquals(0, treeAnalyzer.extractLinesWithBranchAtEnd(LineOrientation.VERTICAL, SideOrientation.MINUSLIST).size());
		Assert.assertEquals(0, treeAnalyzer.extractLinesWithBranchAtEnd(LineOrientation.VERTICAL, SideOrientation.PLUSLIST).size());
	}

	@Test
	public void testPanel1Tree() {
		SVGSVG svg = (SVGSVG) SVGElement.readAndCreateSVG(Fixtures.TREE_PANEL1_SVG);
		List<SVGElement> lineElements = SVGUtil.getQuerySVGElements(svg, ".//svg:line");
		Assert.assertEquals("lines", 42, lineElements.size());
		List<SVGLine> svgLines = SVGLine.extractLines(lineElements);
		Assert.assertEquals("svgLines", 42, svgLines.size());

		SVGG g = (SVGG)svgLines.get(0).getParent();
		//g.debug("g");
		SVGXTree tree = new SVGXTree(g);

		TreeAnalyzer treeAnalyzer = tree.getTreeAnalyzer();
		Assert.assertNull("singleEnd null", treeAnalyzer.getSingleEndedLines());
		treeAnalyzer.analyzeBranchesAtLineEnds(tree, svgLines, EPS);
		int[] counts = { 14, 14, 0, 0, 14,
				         28, 28, 15, 0, 13,
				         15};
		assertHorizontalVerticalLines(treeAnalyzer, counts, LineOrientation.HORIZONTAL);
		tree.buildTree();
		SVGSVG.wrapAndWriteAsSVG(tree, new File("target/panel1Tree.svg"));
		//tree.debug("Tree");
	}

	@Test
	public void testImage82SmallTree() {
		int[] countsa = {28, 28, 21};
		int[] countsb = {7, 7, 0, 0, 7,
		        14, 14, 8, 0,  6,
		        8};
		testTree(Fixtures.TREE_GIBBONS_SMALL_SVG, countsa, countsb, "target/82smallTree.svg", LineOrientation.HORIZONTAL);
	}

	@Test
	public void testImage82Tree() {
		int[] countsa = {43, 43, 32};
		int[] countsb = {11, 11, 0, 1, 10,
		        21, 21, 11, 0,  10,
		        11};
		testTree(Fixtures.TREE_GIBBONS_LARGE_SVG, countsa, countsb, "target/82Tree.svg", LineOrientation.HORIZONTAL);

	}

	@Test
	public void testImage32aTree() {
		int[] countsa = {229, 229, 173};
		int[] countsb = new int[] {57, 57, 0, 1, 56,
		        115, 115, 60, 0,  52,
		        60};
		testTree(Fixtures.TREE_BIRDS_CLEAN_SVG, countsa, countsb, "target/tree32a.svg", LineOrientation.HORIZONTAL);
	}

	@Test
	public void testImage32aNewTree() {
		SVGElement svg =  SVGElement.readAndCreateSVG(Fixtures.TREE_GIBBONS_SMALL_SVG);
		SVGXTree tree = makeTree(svg, 1.0, MergeMethod.TOUCHING_LINES);
		SVGSVG.wrapAndWriteAsSVG(tree, new File("target/newTree.svg"));
	}

	@Test
	public void testMakeTree() {
		SVGElement svg =  SVGElement.readAndCreateSVG(Fixtures.TREE_GIBBONS_SMALL_SVG);
		SVGXTree tree = SVGXTree.makeTree(svg, 1.0, MergeMethod.TOUCHING_LINES);
		SVGSVG.wrapAndWriteAsSVG(tree, new File("target/makeTree.svg"));
	}

	@Test
	public void testMakeTree32() {
		SVGElement svg =  SVGElement.readAndCreateSVG(Fixtures.TREE_BIRDS_CLEAN_SVG);
		SVGXTree tree = SVGXTree.makeTree(svg, 1.0, MergeMethod.TOUCHING_LINES);
		SVGSVG.wrapAndWriteAsSVG(tree, new File("target/makeTree32.svg"));
	}

	@Test
	public void testTreeWithNexML() {
		SVGElement svg =  SVGElement.readAndCreateSVG(Fixtures.TREE_GIBBONS_SMALL_SVG);
		SVGXTree tree = SVGXTree.makeTree(svg, 1.0, MergeMethod.TOUCHING_LINES);
		//CMLUtil.debug(tree.getNEXML(), "nexml");
		SVGSVG.wrapAndWriteAsSVG(tree, new File("target/smallGibbons.svg"));
	}

	@Test
	public void testLargeTreeWithNexML() {
		SVGElement svg =  SVGElement.readAndCreateSVG(Fixtures.TREE_GIBBONS_LARGE_SVG);
		SVGXTree tree = SVGXTree.makeTree(svg, 1.0, MergeMethod.TOUCHING_LINES);
		//CMLUtil.debug(tree.getNEXML(), "nexml");
		SVGSVG.wrapAndWriteAsSVG(tree, new File("target/Gibbons.svg"));
	}

	@Test
	public void testBirds() {
		SVGElement svg =  SVGElement.readAndCreateSVG(Fixtures.TREE_BIRDS_CLEAN_SVG);
		SVGXTree tree = SVGXTree.makeTree(svg, 1.0, MergeMethod.TOUCHING_LINES);
		//CMLUtil.debug(tree.getNEXML(), "nexml");
		SVGSVG.wrapAndWriteAsSVG(tree, new File("target/birds.svg"));
	}

	/**
	 * Checks matching of species to nodes
	 *
	 * <text stroke="none" fill="#000000"
     *       x="400.984"              y="105.165" font-size="8.762" font-family="Helvetica" font-weight="normal" font-style="italic" xmlns:svgx="http://www.xml-cml.org/schema/svgx">L</text>
	 * Luscinia   / ((400.984,439.925),(96.403,105.165))
	 */
	@Test
	public void testBirdsSmall() {
		SVGElement svg =  SVGElement.readAndCreateSVG(Fixtures.TREE_BIRDS_CLEAN_SMALL_SVG);
		SVGXTree tree = SVGXTree.makeTree(svg, 1.0, MergeMethod.TOUCHING_LINES);
		//CMLUtil.debug(tree.getNEXML(), "nexml");
		SVGSVG.wrapAndWriteAsSVG(tree, new File("target/birdsSmall.svg"));
	}

	// ========================================================

	private void testTree(File insvg, int[] countsa, int[] countsb, String outfile, LineOrientation orientation) {
		SVGSVG svg = (SVGSVG) SVGElement.readAndCreateSVG(insvg);
		SVGPolyline.replacePolyLinesBySplitLines(svg);
		List<SVGElement> lineElements = SVGUtil.getQuerySVGElements(svg, ".//svg:line");
		Assert.assertEquals("lines", countsa[0], lineElements.size());
		List<SVGLine> svgLines = SVGLine.extractLines(lineElements);
		Assert.assertEquals(countsa[1], svgLines.size());
		svgLines = LineMerger.mergeLines(svgLines, 1.0, MergeMethod.TOUCHING_LINES);
		Assert.assertEquals(countsa[2], svgLines.size());
		SVGG g = (SVGG)svgLines.get(0).getParent();
		SVGXTree tree = new SVGXTree(g);

		TreeAnalyzer treeAnalyzer = tree.getTreeAnalyzer();
		treeAnalyzer.analyzeBranchesAtLineEnds(svgLines);
		assertHorizontalVerticalLines(treeAnalyzer, countsb, orientation);
		tree.buildTree();
		SVGSVG.wrapAndWriteAsSVG(tree, new File(outfile));
		//tree.debug("Tree");
	}

	private void assertHorizontalVerticalLines(TreeAnalyzer treeAnalyzer, int[] counts, LineOrientation treeOrientation ) {
		Assert.assertEquals("vertical", counts[0], treeAnalyzer.getVerticalLineContainer().getLines().size());
		Assert.assertEquals("verticalComplex", counts[1], treeAnalyzer.getVerticalLineContainer().getComplexLines().size());
		Assert.assertEquals("verticalPlus", counts[2], treeAnalyzer.getVerticalLineContainer().getMinusEndedLines().size());
		Assert.assertEquals("verticalMinus", counts[3], treeAnalyzer.getVerticalLineContainer().getPlusEndedLines().size());
		Assert.assertEquals("verticalDouble", counts[4], treeAnalyzer.getVerticalLineContainer().getDoubleEndedLines().size());
		Assert.assertEquals("horizontal", counts[5], treeAnalyzer.getHorizontalLineContainer().getLines().size());
		Assert.assertEquals("horizontalComplex", counts[6], treeAnalyzer.getHorizontalLineContainer().getComplexLines().size());
		Assert.assertEquals("horizontalPlus", counts[7], treeAnalyzer.getHorizontalLineContainer().getMinusEndedLines().size());
		Assert.assertEquals("horizontalMinus", counts[8], treeAnalyzer.getHorizontalLineContainer().getPlusEndedLines().size());
		Assert.assertEquals("horizontalDouble", counts[9], treeAnalyzer.getHorizontalLineContainer().getDoubleEndedLines().size());
		Assert.assertEquals("treeOrientation", treeOrientation, treeAnalyzer.getTreeOrientation());
		Assert.assertNotNull("singleEnd not null", treeAnalyzer.getSingleEndedLines());
		Assert.assertEquals("singleEnd", counts[10], treeAnalyzer.getSingleEndedLines().size());
	}

	// MergeMethod.TOUCHING_LINES
	private SVGXTree makeTree(SVGElement root, double eps, MergeMethod method) {
		SVGPolyline.replacePolyLinesBySplitLines(root);
		List<SVGLine> lines = SVGLine.extractSelfAndDescendantLines(root);
		lines = LineMerger.mergeLines(lines, eps, method);
		SVGXTree tree = new SVGXTree(root);
		TreeAnalyzer treeAnalyzer = tree.getTreeAnalyzer();
		treeAnalyzer.analyzeBranchesAtLineEnds(tree, lines, eps);
		tree.buildTree();
		return tree;
	}

}


text:
import BasicLayout from "../../src/layouts/BasicLayout";
import {LogLevel} from "../../src/LogLevel";
describe('BasicLayout', ()=>{
    var layout;
    beforeEach(()=>{
        layout = new BasicLayout();
    });
    it('formats as intended', ()=>{
        expect(layout.format({
            message: 'test message',
            level: LogLevel.ERROR,
            tag: 'tag',
            time: new Date(Date.parse("21 May 2015 10:12:42"))
        })).toBe("2015-05-21 10:12:42 ERROR [tag] - test message");
    });
});


text:
require 'yaml'

reference_tree_yaml = File.read('../../docs/prototype-rails-references.yaml')
reference_tree = YAML.load(reference_tree_yaml)

solutions_file_name = '../../docs/prototype-rails-solutions.yaml'
solutions_yaml = File.read(solutions_file_name)
solutions = YAML.load(solutions_yaml)

reference_tree.each do |name, block|
  next if(solutions[name])
  next if(name.start_with?("BASE/"))
  solutions[name] = {
    "solution"=> nil,
    "rational"=> nil,
    "story"=> nil
  }
end

sorted_solutions = solutions.sort.to_h
puts "Writing: #{solutions_file_name}"
File.open(solutions_file_name, 'w') do |f|
  f.write "# This was generated using: cd rails/script; ruby prototype-railsupdate-solutions.rb\n"
  f.write sorted_solutions.to_yaml
end

unsolved_files = sorted_solutions.filter{|name, solution| solution["solution"].nil?}
puts unsolved_files.map{|name, solutions| name}.to_yaml
puts "Unsolved files: #{unsolved_files.length}"
puts "Total files #{sorted_solutions.length}"


text:
- The process of writing state of ab object to a file is caleed seralization
- using ObjectOutStream(FileOutPutStream f) class we can achieve serialization

```java
FileOutputStream fos = new FileOutputStream("abc.txt", true);
ObjectOutputStream oos = new ObjectOutputStream(fos);

oos.writeObject(object)
```

```java
FileInPutStream fos = new FileInPutStream("abc.txt", true);
ObjectInputStream oos = new ObjectInputStream(fos);

oos.readObject()
```


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

    public class InvalidRangeException<T> : ApplicationException
    {
        private const string ErrorMessage = "The value is out of range.";

        public InvalidRangeException(T start, T end)
            : base(ErrorMessage)
        {
            this.Start = start;
            this.End = end;
        }

        public T Start { get; private set; }

        public T End { get; private set; }
    }
}


text:
<?php

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

class CreateProductImagesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('product_images', function (Blueprint $table) {
            $table->increments('id');
            $table->string('image');
            $table->string('thumb');
            $table->integer('product_id')->unsigned()->nullable();
            $table->foreign('product_id')->references('id')->on('products')->onDelete('cascade');
            $table->timestamps();
        });
    }

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


text:
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace BrawlManagerLib {
	public static class BitmapUtilities {
		/// <summary>
		/// Swaps the alpha and value channels of a monochrome image. Transparent areas become black, and black areas become transparent.
		/// </summary>
		public static Bitmap AlphaSwap(Bitmap source) {
			Color c;
			if (IsSolidColor(source, out c) && c.A == 0) {
				// fully transparent image
				return source;
			}
			Bitmap ret = new Bitmap(source.Width, source.Height);
			for (int x = 0; x < ret.Width; x++) {
				for (int y = 0; y < ret.Height; y++) {
					Color fromColor = source.GetPixel(x, y);
					int toColor = fromColor.A == 0 ? -0x01000000 : fromColor.A * 0x10101 + fromColor.R * 0x1000000;
					ret.SetPixel(x, y, Color.FromArgb(toColor));
				}
			}
			return ret;
		}

		public static Bitmap ApplyMask(Bitmap source, Bitmap mask) {
			source = Resize(source, mask.Size);
			Bitmap ret = new Bitmap(source.Width, source.Height);
			for (int x = 0; x < ret.Width; x++) {
				for (int y = 0; y < ret.Height; y++) {
					Color c = source.GetPixel(x, y);
					ret.SetPixel(x, y, Color.FromArgb(
						mask.GetPixel(x, y).R,
						c.R, c.G, c.B));
				}
			}
			return ret;
		}

		/// <summary>
		/// Combines two images. The size of the second (foreground) image will be used for the final image.
		/// </summary>
		public static Bitmap Combine(Bitmap bg, Image fg) {
			int w = fg.Width, h = fg.Height;
			Bitmap both = new Bitmap(w, h);
			Graphics g = Graphics.FromImage(both);
			g.DrawImage(Resize(bg, both.Size), 0, 0);
			g.DrawImage(fg, 0, 0);
			return both;
		}

		/// <summary>
		/// Inverts the colors in a bitmap.
		/// </summary>
		public static Bitmap Invert(Bitmap source) {
			Bitmap ret = new Bitmap(source.Width, source.Height);
			for (int x = 0; x < ret.Width; x++) {
				for (int y = 0; y < ret.Height; y++) {
					Color c = source.GetPixel(x, y);
					ret.SetPixel(x, y, Color.FromArgb(c.A, 255-c.R, 255-c.G, 255-c.B));
				}
			}
			return ret;
		}

		/// <summary>
		/// Makes a scaled version of an image using BrawlLib's texture converter.
		/// </summary>
		public static Bitmap Resize(Bitmap orig, Size resizeTo) {
			return orig.Resize(resizeTo.Width, resizeTo.Height);
		}

		public static Bitmap Border(Bitmap orig, Color color, int penwidth = 1) {
			Bitmap b = new Bitmap(orig.Width, orig.Height);
			Graphics g = Graphics.FromImage(b);
			g.DrawImage(orig, 0, 0);
			g.DrawRectangle(new Pen(color, penwidth),
				penwidth - 1, penwidth - 1,
				orig.Width - penwidth, orig.Height - penwidth);
			return b;
		}

		/// <summary>
		/// Checks if the given bitmap is a single color. If the result is true, its color will be stored in the second parameter.
		/// </summary>
		public static bool IsSolidColor(Bitmap bmp, out Color c) {
			c = bmp.GetPixel(0, 0);
			for (int y = 0; y < bmp.Height; y++) {
				for (int x = 0; x < bmp.Width; x++) {
					if (bmp.GetPixel(x, y) != c) {
						return false;
					}
				}
			}
			return true;
		}

        /// <summary>
        /// Checks if an image has any transparency.
        /// </summary>
        public static bool HasAlpha(Bitmap bmp) {
            for (int y = 0; y < bmp.Height; y++) {
                for (int x = 0; x < bmp.Width; x++) {
                    if (bmp.GetPixel(x, y).A < 255) {
                        return true;
                    }
                }
            }
            return false;
        }

        /// <summary>
        /// Checks if an image has varying RGB values among pixels that are partially or fully opaque.
        /// </summary>
        public static bool HasNonAlpha(Bitmap bmp) {
            int? found = null;
			for (int y = 0; y < bmp.Height; y++) {
				for (int x = 0; x < bmp.Width; x++) {
                    Color color = bmp.GetPixel(x, y);
                    if (color.A == 0) continue;

                    int rgb = color.ToArgb() & 0xFFFFFF;
					if (found == null) {
                        found = rgb;
                    } else if (rgb != found) {
                        return true;
                    }
				}
			}
			return false;
		}

		/// <summary>
		/// Counts the number of colors in a bitmap, up through the given maximum. If the maximum is reached, the method will return early.
		/// </summary>
		public static int CountColors(Bitmap bmp, int max) {
			int count = 0;
			HashSet<Color> colors = new HashSet<Color>();
			for (int y = 0; y < bmp.Height && count < max; y++) {
				for (int x = 0; x < bmp.Width && count < max; x++) {
					Color color = bmp.GetPixel(x, y);
					if (!colors.Contains(color)) {
						colors.Add(color);
						count++;
					}
				}
			}
			return count;
		}

		/// <summary>
		/// Creates a new image, 2 pixels wider and taller than the original.
		/// Each pixel's alpha value is the largest alpha value among adjacent pixels on the original image.
		/// The color of each pixel will be the color given in the second argument.
		/// </summary>
		public static Bitmap Blur(Bitmap orig, Color blurColor) {
			Bitmap b = new Bitmap(orig.Width + 2, orig.Height + 2);
			for (int y = -1; y < orig.Height + 1; y++) {
				for (int x = -1; x < orig.Width + 1; x++) {
					byte[] vals = {TryGetAlpha(orig, x-1, y-1) ?? 0,
									TryGetAlpha(orig, x-1, y) ?? 0,
									TryGetAlpha(orig, x-1, y+1) ?? 0,
									TryGetAlpha(orig, x, y-1) ?? 0,
									TryGetAlpha(orig, x, y) ?? 0,
									TryGetAlpha(orig, x, y+1) ?? 0,
									TryGetAlpha(orig, x+1, y-1) ?? 0,
									TryGetAlpha(orig, x+1, y) ?? 0,
									TryGetAlpha(orig, x+1, y+1) ?? 0};
					byte alpha = vals.Max();
					b.SetPixel(x + 1, y + 1, Color.FromArgb(alpha, blurColor));
				}
			}
			return b;
		}

		/// <summary>
		/// Used for Blur.
		/// </summary>
		private static byte? TryGetAlpha(Bitmap b, int x, int y) {
			if (x < 0 || x >= b.Width || y < 0 || y >= b.Height) {
				return null;
			} else {
				return b.GetPixel(x, y).A;
			}
		}

		/// <summary>
		/// Creates a new bitmap with the original bitmap centered on top of the result of the Blur function.
		/// </summary>
		public static Bitmap BlurCombine(Bitmap fg, Color blurColor) {
			Bitmap both = Blur(fg, blurColor);
			Graphics g = Graphics.FromImage(both);
			g.DrawImage(fg, 1, 1);
			return both;
		}

		public static bool HasSolidCorners(Bitmap newBitmap) {
			int w = newBitmap.Width;
			int h = newBitmap.Height;
			return newBitmap.GetPixel(0, 0).A == 255
				&& newBitmap.GetPixel(w - 1, 0).A == 255
				&& newBitmap.GetPixel(0, h - 1).A == 255
				&& newBitmap.GetPixel(w - 1, h - 1).A == 255;
		}
	}
}


text:
<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "grade".
 *
 * @property string $id
 * @property string $enrolled_id
 * @property integer $grading_period
 * @property integer $core_value_1
 * @property integer $core_value_2
 * @property integer $core_value_3
 * @property integer $core_value_4
 * @property integer $subject_1
 * @property integer $subject_2
 * @property integer $subject_3
 * @property integer $subject_4
 * @property integer $subject_5
 * @property integer $subject_6
 * @property integer $subject_7
 * @property integer $subject_8
 * @property integer $subject_9
 * @property integer $subject_10
 *
 * @property Enrolled $enrolled
 */
class SPEDForm extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'grade';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['enrolled_id', 'grading_period', 'core_value_1', 'core_value_2', 'core_value_3', 'core_value_4', 'subject_1', 'subject_2', 'subject_3', 'subject_4', 'subject_5', 'subject_6', 'subject_7', 'subject_8', 'subject_9', 'subject_10'], 'integer'],
            [['grading_period'], 'unique']
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'enrolled_id' => 'Enrolled ID',
            'grading_period' => 'Grading Period',
            'core_value_1' => 'Core Value 1',
            'core_value_2' => 'Core Value 2',
            'core_value_3' => 'Core Value 3',
            'core_value_4' => 'Core Value 4',
            'subject_1' => 'Subject 1',
            'subject_2' => 'Subject 2',
            'subject_3' => 'Subject 3',
            'subject_4' => 'Subject 4',
            'subject_5' => 'Subject 5',
            'subject_6' => 'Subject 6',
            'subject_7' => 'Subject 7',
            'subject_8' => 'Subject 8',
            'subject_9' => 'Subject 9',
            'subject_10' => 'Subject 10',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getEnrolled()
    {
        return $this->hasOne(Enrolled::className(), ['id' => 'enrolled_id']);
    }
}


text:
package es.usc.citius.hipster.examples.problem;

import java.util.Arrays;
import java.util.Random;

/**
 *

 * General N-Queens problem. The goal is to place N-Queens in a N-Chess Board
 * without any queen attacking each other.
 *

 *
 * There is a good description of the problem
 * in Peter Alfeld's Web Page (University of Utah)
 */
public class NQueens {
    private static final String LS = System.getProperty("line.separator");

    // if N = 8:
    // board[0] means queen at row 0.
    // Example: if board[0] == 2 then there is a queen in
    // the third column of the first row:
    //
    //   0 1 2 3 4 5 6 7
    // 0     Q           <- row 0
    // 1
    // 2
    // ...

    private int queens[];

    public NQueens(int size) {
        this.queens = new int[size];
        // Initialize randomly
        Random r = new Random();
        for (int i = 0; i < size; i++) {
            this.queens[i] = r.nextInt(size);
        }
    }

    public NQueens(int queens[]) {
        this.queens = queens;
    }

    @Override
    public String toString() {
        String output = "" + LS;
        // Build string row by row
        for (int i = 0; i < queens.length; i++) {
            // Check if there is a queen in this row
            for (int j = 0; j < queens.length; j++) {
                // if queens[i]==j then row i has a queen in column j
                output += queens[i] == j ? " O " : " . ";
            }
            output += LS;
        }
        return output;
    }

    public boolean isAttacked(int row, int column) {
        for (int i = 0; i < queens.length; i++) {
            if (i != row) {
                // Same column
                if (queens[i] == column) return true;
                // Same major diagonal
                if ((queens[i] - column) == (row - i)) return true;
                // Same minor diagonal
                if ((column - queens[i]) == (row - i)) return true;
            }
        }
        return false;
    }

    public boolean isAttacked(int row) {
        return isAttacked(row, queens[row]);
    }

    public int attackedQueens() {
        int attacked = 0;
        // Explore each row
        for (int i = 0; i < queens.length; i++) {
            if (isAttacked(i)) attacked++;
        }
        return attacked;
    }

    // Implement equals & hashcode using queens array attribute

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        NQueens state = (NQueens) o;

        if (!Arrays.equals(queens, state.queens)) return false;

        return true;
    }

    @Override
    public int hashCode() {
        return Arrays.hashCode(queens);
    }

    public int[] getQueens() {
        return queens;
    }
}


text:
import { Color } from "./general";
import { Texture } from "./general";
import { Shape } from "./general";
import { Settings } from "./settings";
import { Canvas } from "./canvas";

export class Environment {
  static treernglimit = 9;
  color: Color;
  texture: Texture;
  name: string;
  shape: Shape;
  offset = {
    x: 0,
    y: 0
  };
  size = {
    x: 0,
    y: 0
  };
  constructor() {

  }

  draw(x: number, y: number) {
    Canvas.context.beginPath();
    x = x - this.offset.x;
    y = y - this.offset.y;
    if (Settings.useenvironmentcolor) {
      Canvas.context.fillStyle = this.color.toRGBA();
      switch (this.shape) {
        case Shape.CIRCLE:
          Canvas.context.arc(x, y, this.size.x / 2, 0, 2 * Math.PI);
          Canvas.context.fill();
          break;
        case Shape.RECTANGLE:
          Canvas.context.fillRect(x, y, this.size.x, this.size.y);
          break;
        case Shape.TRIANGLE:
          Canvas.context.moveTo(x + this.size.x, y + this.size.y);
          Canvas.context.lineTo(x, y + this.size.y);
          Canvas.context.lineTo(x + (this.size.x / 2), y);
          Canvas.context.fill();
          break;
        default:
          console.log("Unknown shape: " + this.shape);
      }
    } else {
      Canvas.context.drawImage(this.texture.element, x, y, this.size.x, this.size.y);
    }
  }
}

export class Tree extends Environment {
  color: Color = new Color(0, 100, 0);
  texture: Texture = new Texture(["src/img/big_oak.png"]);
  name: string = "Tree";
  shape: Shape = Shape.TRIANGLE;
  size = {
    x: 50,
    y: 50
  };
}

export class Rock extends Environment {
  color: Color = new Color(128, 132, 135);
  texture: Texture = new Texture(["src/img/big_oak.png"]);
  name: string = "Rock";
  shape: Shape = Shape.CIRCLE;
  size = {
    x: 50,
    y: 50
  };
}


text:
@charset "utf-8";
/*
Template Name: Educational Theory
Author: OS Templates
Author URI: http://www.os-templates.com/
Licence: Free to use under our free template licence terms
Licence URI: http://www.os-templates.com/template-terms
File: Featured Slider CSS
*/

#featured_slide_{position:relative; /* important */ margin:0 auto 20px; display:block; width:940px; height:340px; color:#FFFFFF; background-color:#444A4F; border:10px solid #737E86; overflow:hidden; /* important */}
#featured_slide_Content{width:940px; /* important to be same as image width */ position:absolute; display:inline; margin:0; padding:0; list-style:none;}

.featured_slide_Image{position:relative; display:none; float:left; margin:0; padding:0; width:940px; /* important - must be same as image width and slider width */ height:340px; /* important - must be same as image height and slider height */ list-style:none;}
.featured_slide_Image img{width:940px; height:340px;}
.featured_slide_Image div.introtext{position:absolute; display:none; top:0; left:0; width:180px; height:305px; padding:20px 15px 15px 15px; color:#FFFFFF; background-color:#000000; opacity:0.7;}

#featured_slide_ h2{margin:0 0 8px 0; padding:0 0 8px 0; text-transform:uppercase; border-bottom:1px solid #949BA0;}
#featured_slide_ p{line-height:1.6em;}
#featured_slide_ a{color:#179CFF; background-color:#000000;}


text:
Lexicon.add('hassar/ironMine/guardsReturn', {

  layout: 'tall_event',
  background: 'mobs/Yarl.jpg',
  links: [
    { name:"Leave", action:'go:hassarMain' },
    { name:"Pay 100 sin", action:'event:maw_guards_paid_again', requirements:['|C|Currency>99'] },
    { name:"Fuck it, attack.", action:'event:maw_guards_attack' },
  ],
  linkFormat:'long',

  unsetFlag:'Maw:Trigger',

  body:[
    { text:"TODO: Return to the Maw" },
  ],

});


text:
<?php
/**
 * Created by PhpStorm.
 * User: chenyihong
 * Date: 16/8/3
 * Time: 11:32
 */

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Repositories\UserRepository;
use App\User;

class UserController extends Controller
{
    /**
     * @var UserRepository
     */
    protected $userRepository;

    /**
     * UserController constructor.
     * @param UserRepository $userRepository
     */
    public function __construct(UserRepository $userRepository)
    {
        $this->userRepository = $userRepository;
    }

    public function index(Request $request)
    {
        $page    = $request->get('page', 1);
        $limit   = 20;
        $search  = $request->get('search', '');
        $enabled = $request->get('enabled', null);
        if ($enabled === '') {
            $enabled = null;
        }
        $users = $this->userRepository->getList($search, $enabled, null, $page, $limit);
        foreach ($users as $user) {
            $user->load('oauth');
        }

        return view(
            'admin.user',
            [
                'users' => $users,
                'query' => [
                    'search'   => $search,
                    'enabled' => is_null($enabled) ? '' : $enabled,
                ],
            ]
        );
    }

    public function store(Request $request)
    {
        $user = $this->userRepository->create($request->all());

        return response()->json(['msg' => trans('admin.user.add_ok')]);
    }

    public function update(User $user, Request $request)
    {
        $user = $this->userRepository->update($request->all(), $user);

        return response()->json(['msg' => trans('admin.user.edit_ok')]);
    }
}


text:
require 'spec_helper'

describe HalfAndHalf::Trial do

  describe 'token' do

    it 'should return token containing experiment, variant and number' do
      trial = HalfAndHalf::Trial.new(
        experiment: HalfAndHalf::Experiment.new(name: :ab),
        variant: HalfAndHalf::Variant.new(result: 'a', name: 'a'),
        number: 2
      )
      trial.token.should == 'ab.a.2'
    end
  end

  describe 'call' do

    it 'should call variant' do
      variant = HalfAndHalf::Control.new
      trial = HalfAndHalf::Trial.new(variant: variant)
      variant.should_receive(:call).with('foo')
      trial.call('foo')
    end
  end
end


text:
class SoundFXManager: public Ogre::ResourceManager,
                      public Ogre::Singleton<SoundFXManager> {
 public:
  SoundFXManager();
  virtual ~SoundFXManager();

  virtual SoundFXPtr load(const Ogre::String& name,
			  const Ogre::String& group = \
			  Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);

  static SoundFXManager& getSingleton();
  static SoundFXManager* getSingletonPtr();

  static int getAvailableChannels();

 protected:
  Ogre::Resource* createImpl(const Ogre::String& name, Ogre::ResourceHandle handle,
			     const Ogre::String& group, bool isManual,
			     Ogre::ManualResourceLoader* loader,
			     const Ogre::NameValuePairList* createParams);
 private:
  static int _numChannels;
};
#endif


text:
import rospy
import os
import sys
import threading

from actionlib_msgs.msg import GoalID
from std_msgs.msg import Bool

from python_qt_binding.QtGui import *
from python_qt_binding.QtCore import *
from python_qt_binding import loadUi

from airbus_cobot_gui.alarm import Alarm
from airbus_cobot_gui.res import R

## @class EmergencyStopState
class EmergencyStopState:
    LOCKED   = True
    UNLOCKED = False

## @class EmergencyStopButton
class EmergencyStopButton(QPushButton):

    EMERGENCY_STOP_TOPIC_NAME = rospy.get_param('emergency_stop_topic_name','/emergency_stop/state')

    def __init__(self, context):
        """! The constructor."""
        QPushButton.__init__(self)

        self._context = context
        self._context.addLanguageEventListner(self.onTranslate)
        self._context.addCloseEventListner(self.onDestroy)

        self.setCheckable(True)
        self.setFocusPolicy(Qt.NoFocus)
        self.setStyleSheet(R.values.styles.transparent_background)

        self.setIcon(R.getIconById("icon_pause"))
        self.setIconSize(QSize(80,80))

        self._button_state  = EmergencyStopState.UNLOCKED
        self._keep_running = True

        self.connect(self,SIGNAL('clicked(bool)'),self._trigger_button)

        self._estop_pub = rospy.Publisher(self.EMERGENCY_STOP_TOPIC_NAME,
                                          Bool, latch=True, queue_size=1)

        self._preempt_move_base_pub = rospy.Publisher("/move_base/cancel", GoalID, queue_size=1)

        self._estop_pub_thread = threading.Thread(name='emergency_stop_publisher_loop',
                                                  target=self._emergency_stop_publisher_loop)
        self._estop_pub_thread.start()

    def _trigger_button(self, checked):
        """Called when user click on ermergency stop button.
        @param checked: Button status (True/False).
        @type checked: bool.
        """
        self._context.resquestEmergencyStop(checked)

        self._button_state = checked

        if checked == EmergencyStopState.LOCKED:
            lng = self._context.getLanguage()
            self._context.sendAlarm(Alarm.CRITICAL, R.values.strings.emergency_stop(lng))
            self.setIcon(R.getIconById("icon_play"))
        else:
            self.setIcon(R.getIconById("icon_pause"))

    def _emergency_stop_publisher_loop(self):
        """Loop to publish the emergency stop status."""

        r = rospy.Rate(10) # 10hz

        while not rospy.is_shutdown() and self._keep_running:

            if self._button_state == EmergencyStopState.UNLOCKED:
                self._estop_pub.publish(Bool(True))
            else:
                self._preempt_move_base_pub.publish(GoalID())
                self._estop_pub.publish(Bool(False))

            r.sleep()

    def onTranslate(self, lng):
        pass

    def onDestroy(self):
        """Called when appli closes."""
        self._keep_running = False

##Unittest
if __name__ == "__main__":

    from airbus_cobot_gui.context import Context

    rospy.init_node('unittest_emergency_stop_2')

    a = QApplication(sys.argv)
    utt_appli = QMainWindow()
    context = Context(utt_appli)
    context.requestNewLanguage('fr')
    estop = EmergencyStopButton(context)
    estop.setIconSize(QSize(80,80))
    utt_appli.setCentralWidget(estop)
    utt_appli.show()
    a.exec_()
    estop.onDestroy()

#End of file


text:
//
//  NSPathUtilities.h
//  FoundationExtension
//
//  Created by Jeong YunWon on 10. 11. 2..
//  Copyright 2010 youknowone.org All rights reserved.
//

/*!
 *  @file
 *  @brief NSPathUtilities.h extension function collection
 */

/*! @name Path utilities */

/*!
 *  @brief Returns directory path relative to user directory.
 *  @see [NSSearchPathForDirectoriesInDomains][0]
 *      [0]: https://developer.apple.com/library/mac/documentation/cocoa/reference/foundation/miscellaneous/foundation_functions/reference/reference.html#//apple_ref/c/func/NSSearchPathForDirectoriesInDomains
 */
FOUNDATION_EXTERN NSString *NSPathForUserDirectory(NSSearchPathDirectory directory);
/*!
 *  @brief Returns file path relative to user directory.
 *  @see [NSSearchPathForDirectoriesInDomains][0]
 *      [0]: https://developer.apple.com/library/mac/documentation/cocoa/reference/foundation/miscellaneous/foundation_functions/reference/reference.html#//apple_ref/c/func/NSSearchPathForDirectoriesInDomains
 */
FOUNDATION_EXTERN NSString *NSPathForUserFileInDirectory(NSSearchPathDirectory directory, NSString *filename);

/*!
 *  @brief Returns file path relative to home directory.
 *  @see [NSHomeDirectory][0]
 *      [0]: https://developer.apple.com/library/mac/documentation/cocoa/reference/foundation/miscellaneous/foundation_functions/reference/reference.html#//apple_ref/c/func/NSHomeDirectory
 */
FOUNDATION_EXTERN NSString *NSPathForHomeFile(NSString *filename);
/*!
 *  @brief Returns file path relative to home directory for user.
 *  @see [NSHomeDirectoryForUser][0]
 *      [0]: https://developer.apple.com/library/mac/documentation/cocoa/reference/foundation/miscellaneous/foundation_functions/reference/reference.html#//apple_ref/c/func/NSHomeDirectoryForUser
 */
FOUNDATION_EXTERN NSString *NSPathForHomeFileForUser(NSString *filename, NSString *userName);

/*!
 *  @brief Returns user configuration directory.
 *  @details For OS X, this returns ~/Library. For iOS, this returns ~/Documents. This is used for smart URL prefix 'conf://'
 *  @see [NSSearchPathForDirectoriesInDomains][0]
 *  @see [NSDocumentDirectory][1]
 *  @see [NSLibraryDirectory][2]
 *  @see [NSUserDomainMask][3]
 *      [0]: https://developer.apple.com/library/mac/documentation/cocoa/reference/foundation/miscellaneous/foundation_functions/reference/reference.html#//apple_ref/c/func/NSSearchPathForDirectoriesInDomains
 *      [1]: https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Miscellaneous/Foundation_Constants/Reference/reference.html#//apple_ref/doc/c_ref/NSDocumentDirectory
 *      [2]: https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Miscellaneous/Foundation_Constants/Reference/reference.html#//apple_ref/doc/c_ref/NSLibraryDirectory
 *      [3]: https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Miscellaneous/Foundation_Constants/Reference/reference.html#//apple_ref/doc/c_ref/NSUserDomainMask
 */
FOUNDATION_EXTERN NSString *NSUserConfigurationDirectory(void);
/*!
 *  @brief Returns user configuration file.
 *  @details For OS X, this returns ~/Library. For iOS, this returns ~/Documents. This is used for smart URL prefix 'conf://'
 *  @see NSUserConfigurationDirectory
 */
FOUNDATION_EXTERN NSString *NSPathForUserConfigurationFile(NSString *filename);

/*!
 *  @brief Returns file path relative to temporary directory.
 *  @details This is used for smart URL prefix 'tmp://'
 *  @see [NSTemporaryDirectory][0]
 *      [0]: https://developer.apple.com/library/mac/documentation/cocoa/reference/foundation/miscellaneous/foundation_functions/reference/reference.html#//apple_ref/c/func/NSTemporaryDirectory
 */
FOUNDATION_EXTERN NSString *NSPathForTemporaryFile(NSString *filename);

/*!
 *  @brief Extensions of NSString(NSStringPathExtensions)
 */
@interface NSString (NSPathUtilities)

/*!
 *  @brief Returns a new string made by appending to the receiver a given string.
 *  @param format A format string.
 *  @param ... A comma-separated list of arguments to substitute into format.
 *  @see stringByAppendingPathComponent:
 */
- (NSString *)stringByAppendingPathFormat:(NSString *)format, ... NS_FORMAT_FUNCTION(1, 2);

@end


text:
package com.aemreunal.controller.api;

import net.minidev.json.JSONObject;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import com.aemreunal.exception.scenario.NoScenarioForQueryException;
import com.aemreunal.helper.json.JsonBuilderFactory;

@ControllerAdvice
public class APIControllerAdvice {
    @ExceptionHandler(NoScenarioForQueryException.class)
    public ResponseEntity<JSONObject> beaconDoesntHaveScenarioExceptionHandler(NoScenarioForQueryException ex) {
        JSONObject responseBody = JsonBuilderFactory.object().add("reason", "scenario")
                                                   .add("error", ex.getLocalizedMessage())
                                                   .build();
        return new ResponseEntity<JSONObject>(responseBody, HttpStatus.BAD_REQUEST);
    }
}


text:
using System;
using System.ComponentModel;

namespace Alphora.Dataphor.Frontend.Client
{
	public abstract class ShowLinkAction : Action, IShowLinkAction
	{
		// URL

		string _uRL = String.Empty;

		[DefaultValue("")]
		[Description("A URL pointing to the web page to be loaded.")]
		public string URL
		{
			get	{ return _uRL; }
			set	{ _uRL = (new Uri(value)).AbsoluteUri;	}
		}
	}
}


text:
import os

from six.moves import urllib

import pytest

import schema_salad.main
import schema_salad.ref_resolver
import schema_salad.schema

from cwltool.context import LoadingContext
from cwltool.load_tool import load_tool
from cwltool.main import main
from cwltool.resolver import Path, resolve_local
from cwltool.utils import onWindows
from cwltool.workflow import default_make_tool

from .util import get_data, working_directory

def test_fetcher():
    class TestFetcher(schema_salad.ref_resolver.Fetcher):
        def __init__(self, a, b):
            pass

        def fetch_text(self, url):  # type: (unicode) -> unicode
            if url == "baz:bar/foo.cwl":
                return """
cwlVersion: v1.0
class: CommandLineTool
baseCommand: echo
inputs: []
outputs: []
"""
            raise RuntimeError("Not foo.cwl, was %s" % url)

        def check_exists(self, url):  # type: (unicode) -> bool
            return  url == "baz:bar/foo.cwl"

        def urljoin(self, base, url):
            urlsp = urllib.parse.urlsplit(url)
            if urlsp.scheme:
                return url
            basesp = urllib.parse.urlsplit(base)

            if basesp.scheme == "keep":
                return base + "/" + url
            return urllib.parse.urljoin(base, url)

    def test_resolver(d, a):
        if a.startswith("baz:bar/"):
            return a
        return "baz:bar/" + a

    loadingContext = LoadingContext({"construct_tool_object": default_make_tool,
                                     "resolver": test_resolver,
                                     "fetcher_constructor": TestFetcher})

    load_tool("foo.cwl", loadingContext)

    assert main(["--print-pre", "--debug", "foo.cwl"], loadingContext=loadingContext) == 0

root = Path(os.path.join(get_data("")))

path_fragments = [
    (os.path.join("tests", "echo.cwl"), "/tests/echo.cwl"),
    (os.path.join("tests", "echo.cwl") + "#main", "/tests/echo.cwl#main"),
    (str(root / "tests" / "echo.cwl"), "/tests/echo.cwl"),
    (str(root / "tests" / "echo.cwl") + "#main", "/tests/echo.cwl#main")
]

def norm(uri):
    if onWindows():
        return uri.lower()
    return uri

@pytest.mark.parametrize('path,expected_path', path_fragments)
def test_resolve_local(path, expected_path):
    with working_directory(root):
        expected = norm(root.as_uri() + expected_path)
        assert norm(resolve_local(None, path)) == expected


text:
//
//
// const Label = require('./Label');
//
// /**
//  * Uses and requires Google maps library
//  */
// class WorldMap {
//   /**
//    * @param {{longitude:number, latitude:number}} params.centerCoordinates
//    * @param {{topLeft:{latitude:number, longitude:number},bottomRight:{latitude:number, longitude:number}}} params.cornerCoordinates
//    * @param {Object} params.htmlElement
//    * @param {number} [params.minZoom]
//    * @param {number} [params.zoomLevel]
//    * @param {number} [params.maxZoom]
//    * @param {number} [params.maxShortDescLength]
//    * @param {string} [params.backgroundColor]
//    */
//   constructor({ centerCoordinates, cornerCoordinates, zoomLevel, htmlElement, minZoom, maxZoom, maxShortDescLength, backgroundColor }) {
//     // Will stop if external files have not finished loading
//     if (typeof google === 'undefined' || typeof MarkerClusterer === 'undefined' || typeof MapLabel === 'undefined') {
//       throw new Error();
//     }
//
//     this.MapViewEnum = {
//       NONE: 1,
//       ME: 2,
//       CLUSTER: 3,
//       ALL: 4,
//       GAMEAREA: 5,
//     };
//     this.markers = new Map();
//     this.lines = new Map();
//     this.labels = new Map();
//     this.cornerCoordinates = cornerCoordinates;
//     this.mapView = this.MapViewEnum.GAMEAREA;
//     this.maxShortDescLength = maxShortDescLength || 200;
//     this.map = new google.maps.Map(htmlElement, {
//       center: {
//         lat: centerCoordinates.latitude || 0,
//         lng: centerCoordinates.longitude || 0,
//       },
//       zoom: zoomLevel || 0,
//       disableDefaultUI: true,
//       fullscreenControl: false,
//       keyboardShortcuts: false,
//       mapTypeControl: false,
//       noClear: true,
//       zoomControl: false,
//       panControl: false,
//       overviewMapControl: false,
//       rotateControl: false,
//       scaleControl: false,
//       streetViewControl: false,
//       backgroundColor: backgroundColor || '#001e15',
//       minZoom: minZoom || 3,
//       maxZoom: maxZoom || 19,
//       styles: [
//         {
//           featureType: 'all',
//           elementType: 'all',
//           stylers: [
//             { color: '#001e15' },
//           ],
//         }, {
//           featureType: 'road',
//           elementType: 'geometry',
//           stylers: [
//             { color: '#00cca3' },
//           ],
//         }, {
//           featureType: 'road',
//           elementType: 'labels',
//           stylers: [
//             { visibility: 'off' },
//           ],
//         }, {
//           featureType: 'poi',
//           elementType: 'all',
//           stylers: [
//             { visibility: 'off' },
//           ],
//         }, {
//           featureType: 'administrative',
//           elementType: 'all',
//           stylers: [
//             { visibility: 'off' },
//           ],
//         }, {
//           featureType: 'water',
//           elementType: 'all',
//           stylers: [
//             { color: '#00cca3' },
//           ],
//         },
//       ],
//     });
//   }
//
//   /**
//    * Sets new map view. Affects how the map is realigned and shown
//    * @param {number} view - Type of map view
//    */
//   set mapView(view) {
//     this.mapView = view;
//   }
//
//   /**
//    * Creates a map marker, adds it to the map and calls the creation of a label (if flag is set)
//    * @param {Object} params - Parameters
//    * @param {string} params.markerName - Name of the map marker
//    * @param {string} params.title - Title of the marker description
//    * @param {string} params.markerType - Type of the marker
//    * @param {number} params.opacity - Opacity of the marker in the view
//    * @param {boolean} params.hideLabel - Should the label be hidden in the view?
//    * @param {boolean} params.ignoreCluster - Should the marker be excluded from clusters?
//    * @param {string} params.iconUrl - Path to a custom icon image
//    * @param {{longitude: Number, latitude: Number}} params.position - Long and lat coordinates of the map marker
//    * @param {string} params.description - Description for map marker, which will be shown on click or command
//    */
//   createMarker({ markerName, position, iconUrl, description, title, markerType, opacity, hideLabel, ignoreCluster }) {
//     const icon = {
//       url: iconUrl || '/images/mapicon.png',
//       size: new google.maps.Size(16, 16),
//       origin: new google.maps.Point(0, 0),
//       anchor: new google.maps.Point(8, 8),
//     };
//     const snakeCaseTitle = title.replace(/\s/g, '_');
//     const markerId = this.markers.size + 1;
//     const marker = {
//       marker: new google.maps.Marker({
//         position: {
//           lat: position.latitude,
//           lng: position.longitude,
//         },
//         opacity: opacity || 0.9,
//         icon,
//         map: this.map,
//       }),
//       addedTitle: title,
//       markerId: markerId,
//       markerType: markerType,
//     };
//
//     if (description) {
//       marker.addedShortDesc = description.length > this.maxShortDescLength ? `${description.slice(0, this.maxShortDescLength)}..` : `${description}`;
//       marker.addedExpandedDesc = description.length > this.maxShortDescLength ? `${description.slice(this.maxShortDescLength)}` : undefined;
//     }
//
//     if (!hideLabel) {
//       this.labels.set(title, new Label({
//         positionName: title,
//         labelText: snakeCaseTitle.length > 18 ? `${markerId}:${snakeCaseTitle.slice(0, 18)}..` : `${markerId}:${snakeCaseTitle}`,
//         position,
//       }));
//     }
//
//     if (!ignoreCluster && markerClusterer) {
//       markerClusterer.addMarker(mapMarkers[markerName]);
//     }
//
//     google.maps.event.addListener(marker, 'click', () => {
//       const projection = overlay.getProjection();
//       const xy = projection.fromLatLngToContainerPixel(marker.getPosition());
//
//       // TODO Create marker info window
//       console.log(xy);
//     });
//
//     this.markers.set(markerName, marker);
//   }
//
//   /**
//    * Sets new position for a map marker
//    * Creates a new map marker if it doesn't exist
//    * @param {Object} params - Parameters
//    * @param {string} params.positionName - Name of the map marker
//    * @param {{latitude: Number, longitude: Number}} params.position - Latitude and longitude coordinates for the map marker
//    * @param {string} params.description - Description for map marker, which will be shown on click or command
//    * @param {string} params.markerType - Type of marker
//    * @param {Date} [params.lastUpdated] - Time of last update
//    * @param {boolean} [params.hideLabel] - Should the label be hidden?
//    * @param {string} [params.iconUrl] - Path to custom map marker icon
//    */
//   setMarkerPosition({ positionName, position, lastUpdated, markerType, description, hideLabel, iconUrl }) {
//     const lowerMarkerName = positionName.toLowerCase();
//     const marker = mapMarkers[lowerMarkerName];
//
//     if (marker) {
//       marker.setPosition(new google.maps.LatLng(position.latitude, position.longitude));
//       marker.lastUpdated = lastUpdated;
//     } else {
//       this.createMarker({
//         lastUpdated,
//         position,
//         hideLabel,
//         iconUrl,
//         description,
//         markerType,
//         markerName: lowerMarkerName,
//         title: positionName,
//       });
//     }
//   }
//
//   /**
//    * Creates a polygon and adds it to the map
//    * @param {Object} params - Parameters
//    * @param {string} params.positionName - Name of the polygon
//    * @param {Object[]} params.coordsCollection - Collection of x and y coordinates of the polygon
//    * @param {boolean} [params.hideLabel] - Should the label be hidden?
//    */
//   createPolygon({ positionName, coordsCollection, hideLabel }) {
//     mapPolygons[positionName] = new google.maps.Polygon({
//       paths: coordsCollection,
//       strokeColor: '#008766',
//       strokeOpacity: 0.9,
//       strokeWeight: 2,
//       fillColor: '#00ffcc',
//       fillOpacity: 0.35,
//     });
//
//     if (!hideLabel) {
//       // TODO Should center the label inside the polygon
//       createLabel({
//         positionName,
//         labelText: positionName,
//         position: getPolygonCenter(coordsCollection),
//         align: 'center',
//       });
//     }
//
//     mapPolygons[positionName].setMap(map || null);
//   }
//
//   /**
//    * Sets new positions of the polygon
//    * Creates a new polygon if one with the sent name doesn't exist
//    * @param {Object} params - Parameters
//    * @param {string} params.positionName - Name of the polygon
//    * @param {Object[]} params.coordsCollection - Collection of x and y coordinates of the polygon
//    */
//   setPolygonPosition({ positionName, coordsCollection }) {
//     if (mapPolygons[positionName]) {
//       mapPolygons[positionName].setPaths(coordsCollection);
//     } else {
//       createPolygon({
//         coordsCollection,
//         positionName,
//       });
//     }
//   }
//
//   /**
//    * Creates a line and adds it to the map
//    * The line can have multiple points
//    * @param {Object} params - Parameters
//    * @param {string} params.positionName - Name of the line
//    * @param {Object[]} params.coordsCollection - Collection of Long and lat coordinates of the line
//    */
//   createLine({ positionName, coordsCollection }) {
//     mapLines[positionName] = new google.maps.Polyline({
//       path: coordsCollection,
//       strokeColor: '#008766',
//       strokeOpacity: 1.0,
//       strokeWeight: 2,
//     });
//
//     mapLines[positionName].setMap(map || null);
//   }
//
//   /**
//    * Sets new positions for the line
//    * Creates a new line if a line with the sent name doesn't exist
//    * @param {Object} params - Parameters
//    * @param {string} params.positionName - Name of the line
//    * @param {Object[]} params.coordsCollection - Collection of long and lat coordinates for the line
//    */
//   setLinePosition({ positionName, coordsCollection }) {
//     if (mapLines[positionName]) {
//       mapLines[positionName].setPath(coordsCollection);
//     } else {
//       createLine({
//         positionName,
//         coordsCollection,
//       });
//     }
//   }
//
//   /**
//    * @returns {string} - Returns string representing the type of map view
//    */
//   get mapView() {
//     return this.mapView;
//   }
//
//   /**
//    * @returns {Object} - Returns map marker representing this user
//    */
//   getThisUserMarker() {
//     return this.mapMarkers.I;
//   }
//
//   /**
//    * Creates the map marker representing this user
//    * @param {{longitude: Number, latitude:Number}} position - Long and lat coordinates of the map marker
//    */
//   createThisUserMarker(position) {
//     this.createMarker({
//       markerName: 'I',
//       position,
//       title: 'You',
//       iconUrl: '/images/mapiconyou.png',
//       hideLabel: true,
//     });
//   }
//
//   /**
//    * Sets new position to the user's map marker
//    * Creates a new map marker if it doesn't exist
//    * @param {{longitude: Number, latitude:Number}} position - Long and lat coordinates of the map marker
//    */
//   setUserPosition(position) {
//     if (mapMarkers.I) {
//       mapMarkers.I.setPosition(new google.maps.LatLng(position.latitude, position.longitude));
//     } else {
//       createThisUserMarker(position);
//     }
//   }
//
//   /**
//    * Resets map on all labels, in case any of the connected markers are no longer on the map
//    */
//   toggleMapLabels() {
//     const markerKeys = Object.keys(mapMarkers);
//
//     for (let i = 0; i < markerKeys.length; i += 1) {
//       const markerName = markerKeys[i];
//
//       if (mapLabels[markerName] && mapLabels[markerName].getMap() !== mapMarkers[markerName].getMap()) {
//         mapLabels[markerName].setMap(mapMarkers[markerName].getMap());
//       }
//     }
//   }
//
//   /**
//    * Creates new bounds and re-centers the map based on the map view
//    * @param {Object[]} markers - worldMap markers used to create bounds if map view is "cluster"
//    */
//   realignMap(markers) {
//     const bounds = new google.maps.LatLngBounds();
//     let centerPos = map.getCenter();
//
//     google.maps.event.trigger(map, 'resize');
//
//     if (mapView === 'overview') {
//       const markerKeys = Object.keys(mapMarkers);
//
//       for (let i = 0; i < markerKeys.length; i += 1) {
//         const marker = markerKeys[i];
//
//         bounds.extend(mapMarkers[marker].getPosition());
//       }
//
//       map.fitBounds(bounds);
//       centerPos = bounds.getCenter();
//     } else if (mapView === 'me' && mapMarkers.I) {
//       centerPos = mapMarkers.I.getPosition();
//       map.setZoom(18);
//     } else if (mapView === 'cluster') {
//       if (markers) {
//         for (let i = 0; i < markers.length; i += 1) {
//           const marker = markers[i];
//
//           bounds.extend(marker.getPosition());
//         }
//
//         map.fitBounds(bounds);
//         centerPos = bounds.getCenter();
//       }
//     } else if (mapView === 'area') {
//       bounds.extend(new google.maps.LatLng(cornerCoords.cornerOne.latitude, cornerCoords.cornerOne.longitude));
//       bounds.extend(new google.maps.LatLng(cornerCoords.cornerTwo.latitude, cornerCoords.cornerTwo.longitude));
//
//       map.fitBounds(bounds);
//       centerPos = bounds.getCenter();
//     } else if (mapMarkers[mapView]) {
//       bounds.extend(mapMarkers[mapView].getPosition());
//
//       map.fitBounds(bounds);
//       centerPos = bounds.getCenter();
//     }
//
//     map.setCenter(centerPos);
//     // TODO Hide marker info window
//   }
//
//   /**
//    * Set map to current map on all objects in the collection
//    * @param {Object} collections - Collection of objects to be attached to the map
//    */
//   setMap(collections) {
//     for (let i = 0; i < collections.length; i += 1) {
//       const collection = collections[i];
//       const collectionKeys = Object.keys(collection);
//
//       for (let j = 0; j < collectionKeys.length; j += 1) {
//         collection[collectionKeys[j]].setMap(map);
//       }
//     }
//   }
//
//   /**
//    * Add listeners to map
//    */
//   attachMapListeners() {
//     google.maps.event.addListener(markerClusterer, 'clusterclick', (cluster) => {
//       const bounds = new google.maps.LatLngBounds();
//       const markers = cluster.getMarkers();
//
//       for (let i = 0; i < markers.length; i += 1) {
//         bounds.extend(markers[i].getPosition());
//       }
//
//       setMapView('cluster');
//       realignMap(cluster.getMarkers());
//     });
//
//     google.maps.event.addListener(map, 'click', () => {
//       // TODO Hide marker info window
//     });
//
//     google.maps.event.addListener(map, 'dragstart', () => {
//       // TODO Hide marker info window
//     });
//
//     google.maps.event.addListener(map, 'zoom_changed', () => {
//       // TODO Hide marker info window
//     });
//
//     google.maps.event.addListener(map, 'idle', () => {
//       toggleMapLabels();
//     });
//   }
//
//   /**
//    * Create map clusterer and add all map markers to it
//    */
//   createMarkerClusterer() {
//     markerClusterer = new MarkerClusterer(map, Object.keys(mapMarkers).map(key => mapMarkers[key]), {
//       gridSize: 24,
//       maxZoom: 17,
//       zoomOnClick: false,
//       singleSize: true,
//       averageCenter: true,
//       styles: [{
//         width: 22,
//         height: 22,
//         iconAnchor: [11, 11],
//         textSize: 11,
//         url: 'images/m.png',
//       }],
//     });
//   }
//
//   /**
//    * Create map, sets this map on all polygons, markers, lines, creates map clusterer and attaches listeners
//    * @param {Object} params - Parameters
//    * @param {Object} params.centerCoordinates - Long and lat coordinates
//    * @param {Number} params.centerCoordinates.latitude - Center latitude for the map
//    * @param {Number} params.centerCoordinates.longitude - Center longitude for the map
//    * @param {Number} params.zoomLevel - Default zoom level
//    * @param {string} params.elementId - Id of map element
//    */
//   createMap(params) {
//     const elementId = params.elementId;
//
//     map =
//
//     setMap([mapMarkers, mapPolygons, mapLines, mapLabels]);
//     createMarkerClusterer();
//     attachMapListeners(elementId);
//
//     /**
//      * Overlay is used to catch mouse clicks and easily retrieve x and y instead of lot and lang coordinates
//      */
//     overlay = new google.maps.OverlayView();
//     overlay.draw = () => {};
//     overlay.setMap(map);
//   }
//
//   /**
//    * Reset view port, which recreates all clusters
//    */
//   resetClusters() {
//     markerClusterer.resetViewport();
//   }
//
//   /**
//    * @static
//    * @returns {google.maps.Map} - worldMap
//    */
//   getMap() {
//     return map;
//   }
//
//   /**
//    * @static
//    * @param {{latitude: Number, longitude: Number}} position - Long and lat coordinates for the new map center
//    */
//   setMapCenter(position) {
//     if (map) {
//       map.setCenter(new google.maps.LatLng(parseFloat(position.latitude), parseFloat(position.longitude)));
//     }
//   }
//
//   /**
//    * Set corner coordinates of the bounds for the map
//    * @param {{longitude: Number, latitude: Number}} cornerOneCoords - Corner lat and long coordinates
//    * @param {{longitude: Number, latitude: Number}} cornerTwoCoords - Corner lat and long coordinates
//    */
//   setCornerCoords(cornerOneCoords, cornerTwoCoords) {
//     cornerCoords.cornerOne = cornerOneCoords;
//     cornerCoords.cornerTwo = cornerTwoCoords;
//   }
//
//   /**
//    * Increase the zoom level of the map by 1
//    */
//   increaseZoom() {
//     mapView = '';
//     map.setZoom(map.getZoom() + 1);
//   }
//
//   /**
//    * Decrease the zoom level of the map by 1
//    */
//   decreaseZoom() {
//     mapView = '';
//     map.setZoom(map.getZoom() - 1);
//   }
//
//   /**
//    * Get description from the map marker
//    * @static
//    * @param {Number} markerId - ID of the map marker
//    * @returns {{title: string, description: string}} - Title and escription of the map marker
//    */
//   getInfoText(markerId) {
//     const marker = mapMarkers[Object.keys(mapMarkers).find(markerName => mapMarkers[markerName].markerId === parseInt(markerId, 10))];
//
//     if (!marker) {
//       return null;
//     }
//
//     let description = marker.addedShortDesc;
//
//     if (marker.addedExpandedDesc) {
//       description = marker.addedShortDesc.slice(0, marker.addedShortDesc.length - 2) + marker.addedExpandedDesc;
//     }
//
//     return { title: marker.addedTitle, description };
//   }
//
//   /**
//    * Called on mapPositions emit. Adds new map positions
//    * @param {Object} params - Parameters
//    * @param {Object[]} params.positions - New map positions
//    * @param {string} [params.team] - Name of the team that the user in the position belongs to. Valid for user positions
//    * @param {Date} [params.currentTime] - Time of update of the positions
//    */
//   onMapPositions(params) {
//     const mapPositions = params.positions || [];
//     const team = params.team;
//     // TODO Get name of the user
//     const userName = '';
//
//     for (let i = 0; i < mapPositions.length; i += 1) {
//       const mapPosition = mapPositions[i];
//
//       if (mapPosition.positionName.toLowerCase() !== userName) {
//         const positionName = mapPosition.positionName;
//         const latitude = parseFloat(mapPosition.position.latitude);
//         const longitude = parseFloat(mapPosition.position.longitude);
//         const coordsCollection = mapPosition.position.coordsCollection;
//         const geometry = mapPosition.geometry;
//         const type = mapPosition.type;
//         const group = mapPosition.group;
//         const description = mapPosition.description;
//
//         if (geometry === 'line') {
//           setLinePosition({
//             coordsCollection,
//             positionName,
//           });
//         } else if (geometry === 'polygon') {
//           setPolygonPosition({
//             positionName,
//             coordsCollection,
//           });
//         } else if (geometry === 'point') {
//           setMarkerPosition({
//             positionName,
//             position: {
//               latitude,
//               longitude,
//             },
//             description,
//             markerType: 'location',
//           });
//         } else if (type && type === 'user' && mapPosition.lastUpdated) {
//           const currentTime = new Date(params.currentTime);
//           const lastUpdated = new Date(mapPosition.lastUpdated);
//
//           if (currentTime - lastUpdated < (20 * 60 * 1000)) {
//             // TODO Create time stamp
//             const userDescription = `Team: ${mapPosition.group || '-'}. Last seen: `;
//
//             setMarkerPosition({
//               lastUpdated,
//               positionName,
//               position: {
//                 latitude,
//                 longitude,
//               },
//               iconUrl: team && group && team === group ? 'images/mapiconteam.png' : 'images/mapiconuser.png',
//               hideLabel: true,
//               description: userDescription,
//               markerType: type,
//             });
//           }
//         }
//       }
//     }
//
//     toggleMapLabels();
//   }
// }
//
// module.exports = WorldMap;