text:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
                        http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">

	<bean id="courseDBManager" class="org.olat.course.db.impl.CourseDBManagerImpl">
		<property name="persistedProperties">
	  	<bean class="org.olat.core.configuration.PersistedProperties" scope="prototype" init-method="init" destroy-method="destroy"
	  		depends-on="coordinatorManager,org.olat.core.util.WebappHelper">
	    	<constructor-arg index="0" ref="coordinatorManager"/>
	    	<constructor-arg index="1" ref="courseDBManager" />
	  	</bean>
		</property>
	</bean>

	<!-- default configuration -->
	<bean  class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
		<property name="targetObject" ref="courseDBManager" />
		<property name="targetMethod" value="init" />
		<property name="arguments">
			<value>
				enabled=${course.db.enabled}
			</value>
		</property>
	</bean>

	<bean id="courseDbWebService" class="org.olat.course.db.restapi.CourseDbWebService" />

	<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean" depends-on="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
		<property name="targetObject" ref="org.olat.restapi.support.RestRegistrationService" />
		<property name="targetMethod" value="addSingleton" />
		<property name="arguments" ref="courseDbWebService"/>
	</bean>

</beans>


text:
<button class="btn btn-default" ng-click="newAdministrator()">New Administrator</button>

        <button class="btn btn-default btn-sm" ng-click="edit(gridDisplayItem.id)">Edit</button>

redpajama_set_name: RedPajamaGithub


text:
[Zoom link](https://flatiron.zoom.us/j/93242638216?pwd=bjRCWmVJRW1oTGJhN09VUmxtTTJOUT09)
[What time is the meeting in my time zone](https://arewemeetingyet.com/UTC/2020-08-26/17:00/w/Conda-forge%20dev%20meeting#eyJ1cmwiOiJodHRwczovL2hhY2ttZC5pby9wUk15dFVKV1FmU3NJM2xvMGlqQzJRP2VkaXQifQ==)
[last weeks meeting](https://hackmd.io/fLFDZ8oHQJK83CXiqLc0Yg)

## Attendees

## Agenda

### Standing items

* [x] intros for new folks on the call

* [x] (CJ) budget
    * current approvals?
    * Whenever updated numbers land, please screenshare and show the budget.
        * Link is in Keybase (numfocus_spreadsheets.txt)

* [x] open votes
    * Cheng for core!

* [ ] (MRB/ED/SC) Roadmap / Funding
    * goal is to spend 15 minutes each core meeting for ~3-4 meetings to discuss this
        * Save last 15 minutes for this.
    * https://hackmd.io/0zGSUS71SbOdBsdLtDmGjg
    * notes will get added to hackmd above
    * MRB will collate into a document of sorts
    * Today I'm gonna ask you all to help us do some data collection on our infrastructure and its risk
        1. Some numbers:
            * https://github.com/conda-forge/by-the-numbers/blob/master/conda-forge-timelines.ipynb
            * conda-forge has added about 3k feedstocks per year in 2019 and will in 2020
            * the growth in the amount of data we store appears to be accelerating
        2. risk measurements
            * CJ deserves all of the credit for this idea
            * https://docs.google.com/spreadsheets/d/1ADNNauwVZWUsEdlh5aEg0OLjyDWvCX7PLoo-K34EqcM/edit#gid=0
        3. More discussion from last time

#### From previous meeting(s)

### Your __new__() agenda items

* [x] (MRB) propose moving regular core meetings to every two weeks and doing planning in the off week in this time slot

* [x] (MRB) proposed policy on when core pushes to the feedstocks they don't maintain
    * policy would be:
        1. Normal wait time is 3 days for any PR, including migrations, requests for adding maintainers, merging PRs, etc.
        2. In extenuating circumstances (i.e., bad bugs, blocking lots of other PRs/work), core reserves the right to merge before 3 days.
            * Should we have a special "break-glass" label we apply?
            * Two core member rule: If you're going to break-glass and merge before this 3 day window you need two core members to approve (merging is consider implicit approval, as is making the PR)
        3. Core will do its best to not merge PRs marked as in a draft state, either explicitly as a github draft PR or
           through a label, comment, or indication in a title.
        4. Core will do its best to not merge PRs with requested changes (via a comment, label, title, or a PR review), though if the person
           requesting the change is unresponsive to questions or to changes being made, then we may merge.
    * todo
        * [x] (MRB) put in docs PR
        * [ ] (MRB) make PR on bot to mention the policy

* TODO: Check on Forrest Watters permissions for core

* [x] (FF) Outreachy would cost 6500 USD.
      Goal: find a person to work with the bot team on documentation. This person would be mentored by Vini (our GSoC student) and Matt. Outreachy has a higher conversion rate than GSoC, that means the person usually stays in the community helping out later.
  * Next steps: write abstract and vote on spending of funds.

* [x] (IF) Pinning packages with newer macOS requirements
    * For eg:
      - tiledb 2.1 requires 10.13
      - aws-sdk-cpp 1.8.70 requires 10.12 (this is fixed in https://github.com/conda-forge/aws-sdk-cpp-feedstock/pull/153)
    * This effectively brings the required minimum macOS version of the conda-forge stack up to 10.13
    * We should either,
        * Not pin any package that has a minimum macOS version > 10.9 (I'm leaning towards this)
        * Update our minimum macOS version to 10.13
    * Added new docs https://github.com/conda-forge/conda-forge.github.io/pull/1181
    * On a related note, conda's virtual package `__osx` doesn't work as expected
        * Details - https://github.com/conda-forge/fiona-feedstock/issues/172#issuecomment-721832525
    * @mbargull:
        * bioconda moved their default to 10.13 with deploy target as 10.9.
    * Action Items:
        * Poll?
        * Maybe tie it in with apple's deprecation policy?
        * Migrate __osx to a run instead of run_contrained?
            * This would mean these packages will NOT be installable with older conda
        * Build a list of these
        * (CB) Check PyPI macOS access stats
            * Done in https://gist.github.com/chrisburr/d69cc028b2d5a87a749171a7c1c57d77

* [x] (WV) beta.mamba.pm
    * We're setting up a small quetz instance
    * run_exports plugin is enabled, e.g. https://beta.mamba.pm/api/channels/test/packages/bzip2/versions/1.0.8-h516909a_3/run_exports

### Pushed to next meeting

* [ ] (MB) CentOS 6 end of maintenance support
    * 2020-11-30
      - https://en.wikipedia.org/wiki/Centos#End-of-support_schedule
      - https://en.wikipedia.org/wiki/Red_Hat_Enterprise_Linux#Product_life_cycle
    * Some projects start to use defines from kernels newer than cos6's
      - https://github.com/conda-forge/util-linux-feedstock/pull/7/files#diff-d7075654874cb08007a21aaab3ecd4b3453a9087e7505d034d548b8938b599bcR4-R6

### Active votes

### Subteam updates

#### Bot

#### ARM

#### POWER

#### CUDA

#### Docs

#### staged-recipes

#### website

#### security+systems

### CI infrastructure

#### Compiler upgrade

### CFEP updates

#### Open PRs

* [cfep-04](https://github.com/conda-forge/conda-forge-enhancement-proposals/pull/7) X11 and CDT policy
    * INACTIVE - Merge in with some inactive-esque status?
    * Needs new champion. Thanks for your work on this pkgw! Has unaddressed comments from pkgw as from Jan 10, 2020

* [cfep-06](https://github.com/conda-forge/conda-forge-enhancement-proposals/pull/9) Staged-recipes review lifecycle
    * INACTIVE - Merge in with some inactive-esque status?
    * Lingering comment from @saraedum. @jakirkham, can you reply? Has unadressed comment from @saraedum from Jan 8, 2020
    * (MRB) The stalebot has solved the worst of the issues here. I think we could defer this one permanently.

* [cfep-10](https://github.com/conda-forge/conda-forge-enhancement-proposals/pull/15) Feedstock statuses, unmaintained
    * INACTIVE - Merge in with some inactive-esque status?
    * Needs another review. Has unaddressed updates from pkgw as of Jan 11, 2020

* [cfep-12](https://github.com/conda-forge/cfep/pull/23) Removing packages that violate the terms of the source package
    * Stalled since May 26, 2020
    * Active debate about moving to "broken" vs deleting from conda-forge channel
    * Active vote, ends on 2020-03-11
    * What were the results of the vote?
    * Did we hear back from NumFOCUS?

* [cfep-17](https://github.com/conda-forge/cfep/pull/32) Handling pin backports and dependency rebuilds
    * Stalled debate about implementation details between Isuru, CJ and Matt
    * **UPDATE 2020-07-22**: We in principle have agreement to render the extra pinnings needed directly in the feedstock
      on a temporary basis (i.e., until the migration has ended).

* [cfep-20](https://github.com/conda-forge/cfep/pull/39)

## Discussion

## Check in on previous action items
Copy previous action items from last meeting agenda.

### This meeting
2020-11-03

### Last meeting
2020-10-28

### 2 meetings ago
2020-10-21
* [ ] (Marius?) Python 2.7 migration
    * ( ) [ ] make a hint
    * ( ) [ ] make an announcement
    * ( ) [ ] make the hint a lint

### Move to Issue Tracker
2020-10-07
* [ ] Make sure to add the NVBug info to the cudatoolkit package that conda-forge makes (if we make one)

2020-09-30

2020-09-23
* [x] (MRB)
    * do libgfortran name change
    * add target platform to hashes
    * do gfortran migration with bot
    * bump pinnings

2020-09-16
* [x] Get a call set up with Jon Mease about the kaleido staged recipes PR
    * Emailed on 2020-09-16
* [x] (FF) Open up a PR on the python feedstock for python 3.9 and see what fails

2020-09-09
* [ ] (ED) Update governance docs with similar voting model as what got put into conda-tools (+3 with no -1 is a pass)
* [ ] (SC) Write jinja template to turn institutional partners yaml into a website https://github.com/conda-forge/conda-forge.github.io/blob/master/src/inst_partners.yaml
* [ ] (SC) Document what needs to be done to create an OVH account and get access

2020-08-26
**Docker hub**
* [ ] (JK) Check in on Azure build workers to see if they have the docker hub limitation.
* [ ] (JK) work with dockerhub to see if we can get OSS status
    * [ ] Check in again at some point. We haven't heard back as of 2020-09-23
* [x] (MRB) start pushing images to quay (https://github.com/conda-forge/docker-images/pull/152)

**OVH**
* [ ] (???) build webpage to credit them (and others)
* [ ] If we're adding a logo, will want to make sure that we have permission to use it.
* [ ] Shout-out on twitter at some point. "Thanks forOVHCloud for providing a VM", etc. (maybe after we ship qt on windows with it?)

* [ ] Figure out how to communicate breaking changes to users. Likely should open up an issue immediately for futher discussion. Ping @kkraus, plus capture notes from further up in these meeting notes

* [ ] John K. will update the cuda toolkit feedstock on the git repo to note the NVBug link to the internal NVIDIA issue tracker
* [ ] Jonathan will update docs to note that some non-exhaustive list of packages (like cuda-toolkit, MKL, etc.)
* [ ] Jonathan will review this [PR](https://github.com/AnacondaRecipes/cudatoolkit-feedstock/pull/7)

* [ ] (Kale) schedule conda working group
* [ ] cfep-10 next steps: CJ to call a vote for feedback
* [ ] cfep-06 next steps: Ask staged recipes team to champion this CFEP and move it forward
* [ ] jakirkham & CJ-wright to sync on adding CUDA to the migration bot
* [ ] (Eric) Scheduling Anaconda <-> conda-forge sync on anaconda.org requirements gathering
    * Will try and get this scheduled in the next month.
* [ ] (Anthony) Reach out to NumFocus to figure out legal ramifications of not including licenses in files.
* [ ] (Eric) check internally for funding levels for hotels & flying folks from the community in?
* [ ] (Eric) Figure out finances of conda-forge to support themselves?
* [ ] (jjhelmus) Open up CFEP for which python's we're going to support
* [ ] (jakirkham) write a blog post on CUDA stuff we discussed today
* [ ] (jakirkham) update docs on how to add CUDA support to feedstocks
* [ ] (jakirkham) will open an issue on conda-smithy to investigate Drone issues. (ping the aarch team)
    * https://github.com/conda-forge/conda-forge.github.io/issues/954
* [ ] (ED) Who we are page? Some combination of a FAQ and a who is everyone. FAQ things like:
    * who's the POC for CF <> Anaconda, CF <> NumFocus, CF <> Azure
    * who's the POC for the various subteams?
    * Informal information: roles, day jobs, bios, the whole nine yards, why you're here, etc.
    * Public or internal? I don't really care either way. Anyone feel strongly one way or the other?
    * opt-in to public bios
    * software carpentry has a large number of instructors and has https://carpentries.org/instructors
    * some concern about "yet another place to keep stuff up to date"
* [ ] (ED) document strategies for reproducible environments using conda-forge
* [ ] (UK) Static libraries stuff
    * [ ] Add linting hints to builds to find them
    * [x] Recommend how to package them -> CFEP-18
    * [x] We should write docs saying we don't provide support and this is a bad idea. -> CFEP-18


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

namespace ZSExcelAddIn.Controls
{
    /// <summary>
    /// Interaction logic for SortWorkSheets.xaml
    /// </summary>
    public partial class SortWorkSheets : Window
    {
        public SortWorkSheets()
        {
            InitializeComponent();
            this.Loaded += SortWorkSheets_Loaded;
            ZS_BTN_OK.Click += new RoutedEventHandler(Button_Click);
        }

        private void SortWorkSheets_Loaded(object sender, RoutedEventArgs e)
        {
            // 加载工作表数据
            TTTT.Inlines.Add(new Run("这是代码添加的!") { FontWeight = FontWeights.DemiBold});

        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {

			var obj = Globals.ThisAddIn.Application.COMAddIns.Item("XXX").Object;

			Globals.ThisAddIn.Application.Run("宏名");
        }
    }
}


text:
import argparse
import getpass
import hashlib
import os
import sys

from client import SteamClient
from steam.steamd import EMsg, EResult
from steam.mapping import EMSGS

parser = argparse.ArgumentParser(description='Python Steam client.')
parser.add_argument('user')
args = parser.parse_args()

sentry_file = os.path.expanduser('~/.sentry-%s' % args.user)
sentry_hash = None
if os.path.exists(sentry_file):
    with open(sentry_file, 'r') as f:
        sentry_hash = f.read()
try:
    password = getpass.getpass()
except KeyboardInterrupt:
    sys.exit(1)
client = SteamClient()
client.login(args.user, password, sentry_hash)

blacklist = [
    EMsg.ClientAccountInfo,
    EMsg.ClientClanState,
    EMsg.ClientEmailAddrInfo,
    EMsg.ClientFriendsGroupsList,
    EMsg.ClientFriendsList,
    EMsg.ClientLicenseList,
    EMsg.ClientPersonaState,
    EMsg.ClientPlayerNicknameList,
    EMsg.ClientServerList,
    EMsg.ClientServersAvailable,
]
for emsg, msg in client.pump():
    if not emsg in blacklist:
        print EMSGS.get(emsg)
    if emsg == EMsg.ClientUpdateMachineAuth:
        print 'got sentry hash'
        sha1 = hashlib.sha1(msg.bytes).digest()
        with open(sentry_file, 'w') as f:
            f.write(sha1)
    elif emsg == EMsg.ClientNewLoginKey:
        print 'ready!'
    elif emsg == EMsg.ClientLogOnResponse:
        if msg.eresult == EResult.AccountLogonDenied:
            token = raw_input('SteamGuard Token: ')
            client.login(args.user, password, sentry_hash, token)


text:
package org.sistemafinanciero.rest;

import java.math.BigInteger;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;

@Path("/entidades")
public interface EntidadREST {

	@GET
	@Produces({ "application/json" })
	public Response findAll();

	@GET
	@Path("/{id}")
	@Produces({ "application/json" })
	public Response findById(@PathParam("id") BigInteger id);

}


text:
import { Texture } from './Texture';
import {
  Mapping,
  Wrapping,
  TextureFilter,
  PixelFormat,
  TextureDataType,
  TextureEncoding,
} from '../constants';
import { TypedArray } from '../polyfills';

export class DataTexture extends Texture {
  constructor(
    data: ArrayBuffer | TypedArray,
    width: number,
    height: number,
    format?: PixelFormat,
    type?: TextureDataType,
    mapping?: Mapping,
    wrapS?: Wrapping,
    wrapT?: Wrapping,
    magFilter?: TextureFilter,
    minFilter?: TextureFilter,
    anisotropy?: number,
    encoding?: TextureEncoding
  );

  image: ImageData;
}


text:
import path from 'path'

import {
  MediaCategoriesTypes,
  MediaResolverTypes
} from '@bldr/type-definitions'
import { referencify } from '@bldr/core-browser'
import config from '@bldr/config'

import { validateDate } from '../main'

interface PersonFileFormat extends MediaResolverTypes.YamlFormat {
  firstname: string
  lastname: string
  personId: string
  extension: string
}

interface PersonCategory extends MediaCategoriesTypes.Category {
  abbreviation: string
  basePath: string
}

/**
 * The meta data type specification "person".
 */
export const person: MediaCategoriesTypes.Category = {
  title: 'Person',
  abbreviation: 'PR',
  basePath: path.join(config.mediaServer.basePath, 'Musik', 'Personen'),
  relPath: function ({ data }) {
    const personData = data as PersonFileFormat
    return path.join(
      personData.personId.substr(0, 1).toLowerCase(),
      personData.personId,
      `main.${personData.extension}`
    )
  },
  detectCategoryByPath: function (category) {
    const personCategory = category as PersonCategory
    return new RegExp('^' + personCategory.basePath + '/.*(jpg|png)')
  },
  normalizeWikidata: function ({ data, entity, functions }) {
    const label = functions.getLabel(entity)
    const segments = label.split(' ')
    const firstnameFromLabel = segments.shift()
    const lastnameFromLabel = segments.pop()
    // Use the label by artist names.
    // for example "Joan Baez" and not "Joan Chandos"
    if (
      firstnameFromLabel != null &&
      lastnameFromLabel != null &&
      (data.firstname !== firstnameFromLabel ||
        data.lastname !== lastnameFromLabel)
    ) {
      data.firstname = firstnameFromLabel
      data.lastname = lastnameFromLabel
      data.name = label
    }
    return data
  },
  props: {
    personId: {
      title: 'Personen-ID',
      description: 'Nachname_Vorname, zum Beispiel: Haydn_Joseph.',
      derive: function ({ data }) {
        return `${referencify(data.lastname)}_${referencify(data.firstname)}`
      },
      overwriteByDerived: true
    },
    ref: {
      title: 'Referenz der Person',
      description: 'PR_Nachname_Vorname, zum Beispiel: PR_Haydn_Joseph.',
      derive: function ({ data, category }) {
        const personCategory = category as PersonCategory
        return `${personCategory.abbreviation}_${referencify(
          data.lastname
        )}_${referencify(data.firstname)}`
      },
      overwriteByDerived: true
    },
    title: {
      title: 'Titel der Person',
      derive: function ({ data }) {
        const personData = data as PersonFileFormat
        return `Portrait-Bild von "${personData.firstname} ${personData.lastname}"`
      },
      overwriteByDerived: true
    },
    firstname: {
      title: 'Vorname',
      required: true,
      wikidata: {
        // Vornamen der Person
        fromClaim: 'P735',
        secondQuery: 'queryLabels',
        format: function (value, category) {
          if (Array.isArray(value)) {
            return value.join(' ')
          }
          return value
        }
      }
    },
    lastname: {
      title: 'Familienname',
      required: true,
      wikidata: {
        // Familienname einer Person
        fromClaim: 'P734',
        secondQuery: 'queryLabels',
        format: function (value) {
          if (Array.isArray(value)) {
            return value.join(' ')
          }
          return value
        }
      }
    },
    name: {
      title: 'Name (Vor- und Familienname)',
      derive: function ({ data }) {
        const personData = data as PersonFileFormat
        return `${personData.firstname} ${personData.lastname}`
      },
      overwriteByDerived: false
    },
    shortBiography: {
      title: 'Kurzbiographie',
      required: true,
      wikidata: {
        fromEntity: 'getDescription'
      }
    },
    birth: {
      title: 'Geburtstag',
      validate: validateDate,
      wikidata: {
        // Geburtsdatum
        fromClaim: 'P569',
        format: 'formatDate',
        alwaysUpdate: true
      }
    },
    death: {
      title: 'Todestag',
      validate: validateDate,
      wikidata: {
        // Sterbedatum
        fromClaim: 'P570',
        format: 'formatDate',
        alwaysUpdate: true
      }
    },
    mainImage: {
      title: 'Hauptbild',
      wikidata: {
        // Bild
        fromClaim: 'P18',
        format: 'formatWikicommons'
      }
    },
    famousPieces: {
      title: 'Bekannte Stücke',
      validate: function (value) {
        return Array.isArray(value)
      }
    },
    wikicommons: {
      title: 'Wikicommons',
      state: 'absent'
    }
  }
}


text:
package storage::emc::isilon::snmp::plugin;

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

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

    $self->{version} = '1.0';
    %{$self->{modes}} = (
                         'cluster-usage'    => 'storage::emc::isilon::snmp::mode::clusterusage',
                         'hardware'         => 'storage::emc::isilon::snmp::mode::hardware',
                         );

    return $self;
}

1;

__END__

=head1 PLUGIN DESCRIPTION

Check EMC Isilon in SNMP.

=cut


text:
"""
Copyright [2009-2017] EMBL-European Bioinformatics Institute
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""

import json

from lxml import etree as ET

from rnacentral_pipeline.rnacentral.search_export import data

def test_create_tag_with_complete_dict():
    root = ET.Element("a")
    entry = {"attrib": {"name": "bob"}, "text": "nice"}
    element = data.create_tag(root, "example", entry)
    assert element.tag == "example"
    assert element.attrib == {"name": "bob"}
    assert element.text == "nice"
    assert element in list(root)

def create_tag_can_handle_unicode():
    root = ET.Element("a")
    entry = u"tRNA Asp ⊄UC"
    element = data.create_tag(root, "example", entry)
    assert element.tag == "example"
    assert element.attrib == {}
    assert element.text == u"tRNA Asp ⊄UC"
    assert element in list(root)

def test_create_tag_can_use_simple_text():
    root = ET.Element("a")
    element = data.create_tag(root, "example", "hi")
    assert element.tag == "example"
    assert element.attrib == {}
    assert element.text == "hi"
    assert element in list(root)

def test_create_tag_can_use_simple_text_and_attribs():
    root = ET.Element("a")
    attrib = {"type": "important"}
    element = data.create_tag(root, "example", "hi", attrib=attrib)
    assert element.tag == "example"
    assert element.attrib == {"type": "important"}
    assert element.text == "hi"
    assert element in list(root)

def test_create_tag_overrides_given_attributes_with_tag_dict():
    root = ET.Element("a")
    entry = {"attrib": {"name": "bob"}, "text": "nice"}
    attrib = {"name": "steve", "help": "never"}
    element = data.create_tag(root, "example", entry, attrib=attrib)
    assert element.attrib == {"name": "bob", "help": "never"}
    assert element.text == "nice"
    assert element in list(root)

def test_parse_note_can_parse_space_note():
    assert data.parse_note("GO:3333 SO:5000 extra") == {
        "GO": {"GO:3333"},
        "SO": {"SO:5000"},
    }

def test_parse_note_can_handle_json_note():
    ans = {"ontology": {"GO": ["GO:100"]}}
    assert data.parse_note(json.dumps(ans)) == ans

def test_can_build_references_with_complex_note():
    refs = data.note_references(
        [
            "6911",
            "6911",
            "Quality score:93.74 Alignment:reference ECO:0000053 SO:0001000 GO:0003735 GO:0005840",
        ]
    )
    assert sorted(refs, key=lambda d: d["attrib"]["dbkey"]) == [
        {"attrib": {"dbname": "ECO", "dbkey": "ECO:0000053"}},
        {"attrib": {"dbname": "GO", "dbkey": "GO:0003735"}},
        {"attrib": {"dbname": "GO", "dbkey": "GO:0005840"}},
        {"attrib": {"dbname": "SO", "dbkey": "SO:0001000"}},
    ]

def test_references_build_correct_data():
    xrefs = []
    notes = [
        "",  # Old style empty note
        "GO:3333 SO:5000 extra",  # Old style note
        None,  # New style empty note
        json.dumps({"ontology": {"GO": ["GO:100"]}}),
        json.dumps({"GO": ["GO:500", "GO:100"]}),
    ]
    val = data.references(
        10,
        xrefs,
        [10000, None, 50000],
        [None, "10.1093/nar/9.13.2999", "", "10.1016/s0923-1811(03)00030-6"],
        notes,
    )
    assert val == [
        {"attrib": {"dbname": "PUBMED", "dbkey": "10000"}},
        {"attrib": {"dbname": "PUBMED", "dbkey": "50000"}},
        {"attrib": {"dbname": "DOI", "dbkey": "10.1093/nar/9.13.2999"}},
        {"attrib": {"dbname": "DOI", "dbkey": "10.1016/s0923-1811(03)00030-6"}},
        {"attrib": {"dbname": "GO", "dbkey": "GO:3333"}},
        {"attrib": {"dbname": "SO", "dbkey": "SO:5000"}},
        {"attrib": {"dbname": "GO", "dbkey": "GO:100"}},
        {"attrib": {"dbname": "GO", "dbkey": "GO:500"}},
        {"attrib": {"dbname": "ncbi_taxonomy_id", "dbkey": "10"}},
    ]

def notes_can_parse_weird_notes():
    notes = [
        "Valine tRNA (tRNA-Val), predicted by tRNAscan-SE analysis; GO_component: GO:0005829 - cytosol [Evidence NAS] [PMID 9159473]; GO_function: GO:0030533 - triplet codon-amino acid adaptor activity [Evidence TAS] [PMID 9443958]; GO_process: GO:0006414 - translational elongation [Evidence NAS] [PMID 9159473]",
        '{"text": ["Valine tRNA (tRNA-Val), predicted by tRNAscan-SE analysis; GO_component: GO:0005829 - cytosol [Evidence IC] [PMID 9023104]; GO_function: GO:0030533 - triplet codon-amino acid adaptor activity [Evidence ISM] [PMID 9023104]; GO_process: GO:0006414 - translational elongation [Evidence IC] [PMID 9023104]"]}',
        '{"isotype": "Val", "anticodon_positions": [{"relative_stop": 37, "relative_start": 35}], "anticodon": "AAC", "url": "http://gtrnadb.ucsc.edu/genomes/eukaryota/Scere3/genes/tRNA-Val-AAC-2-1.html", "score": 66.3}',
        "Valine tRNA (tRNA-Val), predicted by tRNAscan-SE analysis; GO_component: GO:0005829 - cytosol [Evidence NAS] [PMID 9159473]; GO_function: GO:0030533 - triplet codon-amino acid adaptor activity [Evidence TAS] [PMID 9443958]; GO_process: GO:0006414 - translational elongation [Evidence NAS] [PMID 9159473]",
        '{"text": ["Valine tRNA (tRNA-Val), predicted by tRNAscan-SE analysis; GO_component: GO:0005829 - cytosol [Evidence IC] [PMID 9023104]; GO_function: GO:0030533 - triplet codon-amino acid adaptor activity [Evidence ISM] [PMID 9023104]; GO_process: GO:0006414 - translational elongation [Evidence IC] [PMID 9023104]"]}',
        '{"text": ["Valine tRNA (tRNA-Val), predicted by tRNAscan-SE analysis; GO_component: GO:0005829 - cytosol [Evidence IC] [PMID 9023104]; GO_function: GO:0030533 - triplet codon-amino acid adaptor activity [Evidence ISM] [PMID 9023104]; GO_process: GO:0006414 - translational elongation [Evidence IC] [PMID 9023104]"]}',
        '{"text": ["Covariance Model: Eukaryote; CM Score: 67.95", "Legacy ID: chrXV.trna15-ValAAC"], "ontology": ["ECO:0000202", "GO:0030533", "SO:0000253"]}',
        "Valine tRNA (tRNA-Val), predicted by tRNAscan-SE analysis; GO_component: GO:0005829 - cytosol [Evidence NAS] [PMID 9159473]; GO_function: GO:0030533 - triplet codon-amino acid adaptor activity [Evidence TAS] [PMID 9443958]; GO_process: GO:0006414 - translational elongation [Evidence NAS] [PMID 9159473]",
        '{"text": ["Covariance Model: Eukaryote; CM Score: 67.95", "Legacy ID: chrXV.trna15-ValAAC"], "ontology": ["ECO:0000202", "GO:0030533", "SO:0000253"]}',
        "Valine tRNA (tRNA-Val), predicted by tRNAscan-SE analysis; GO_component: GO:0005829 - cytosol [Evidence NAS] [PMID 9159473]; GO_function: GO:0030533 - triplet codon-amino acid adaptor activity [Evidence TAS] [PMID 9443958]; GO_process: GO:0006414 - translational elongation [Evidence NAS] [PMID 9159473]",
        '{"text": ["Valine tRNA (tRNA-Val), predicted by tRNAscan-SE analysis; GO_component: GO:0005829 - cytosol [Evidence IC] [PMID 9023104]; GO_function: GO:0030533 - triplet codon-amino acid adaptor activity [Evidence ISM] [PMID 9023104]; GO_process: GO:0006414 - translational elongation [Evidence IC] [PMID 9023104]"]}',
        "Valine tRNA (tRNA-Val), predicted by tRNAscan-SE analysis; GO_component: GO:0005829 - cytosol [Evidence NAS] [PMID 9159473]; GO_function: GO:0030533 - triplet codon-amino acid adaptor activity [Evidence TAS] [PMID 9443958]; GO_process: GO:0006414 - translational elongation [Evidence NAS] [PMID 9159473]",
        '{"text": ["Valine tRNA (tRNA-Val), predicted by tRNAscan-SE analysis; GO_component: GO:0005829 - cytosol [Evidence IC] [PMID 9023104]; GO_function: GO:0030533 - triplet codon-amino acid adaptor activity [Evidence ISM] [PMID 9023104]; GO_process: GO:0006414 - translational elongation [Evidence IC] [PMID 9023104]"]}',
        '{"text": ["Valine tRNA (tRNA-Val), predicted by tRNAscan-SE analysis; GO_component: GO:0005829 - cytosol [Evidence IC] [PMID 9023104]; GO_function: GO:0030533 - triplet codon-amino acid adaptor activity [Evidence ISM] [PMID 9023104]; GO_process: GO:0006414 - translational elongation [Evidence IC] [PMID 9023104]"]}',
        '{"text": ["Valine tRNA (tRNA-Val), predicted by tRNAscan-SE analysis; GO_component: GO:0005829 - cytosol [Evidence IC] [PMID 9023104]; GO_function: GO:0030533 - triplet codon-amino acid adaptor activity [Evidence ISM] [PMID 9023104]; GO_process: GO:0006414 - translational elongation [Evidence IC] [PMID 9023104]"]}',
    ]
    refs = data.note_references(notes)
    assert refs


text:
/**
 * The tree object. Encapsulate the webfx tree.
 */
Class.create("FoldersTree", AjxpPane, {

	__implements : ["IFocusable", "IContextMenuable"],

	/**
	 * Constructor
	 * @param $super klass Superclass reference
	 * @param oElement HTMLElement
	 * @param options Object
	 */
	initialize: function ($super, oElement, options)
	{
		$super(oElement, options);
		this.treeContainer = new Element('div', {id:'tree_container', style:'overflow:auto;height:100%;width:100%;'});
        if(this.options.replaceScroller){
            this.scroller = new Element('div', {id:'tree_scroller', className:'scroller_track', style:"right:"+(parseInt(oElement.getStyle("marginRight"))-parseInt(oElement.getStyle("paddingRight")))+"px"});
            this.scroller.insert('

');
            oElement.insert(this.scroller);
            this.treeContainer.setStyle({overflow:"hidden"});
        }
        this.registeredObservers = $H();
		oElement.insert(this.treeContainer);
		disableTextSelection(this.treeContainer);
        if(this.options.replaceScroller){
            this.scrollbar = new Control.ScrollBar('tree_container','tree_scroller');
            var scrollbarLayoutObserver = this.scrollbar.recalculateLayout.bind(this.scrollbar);
            document.observe("ajaxplorer:tree_change",  scrollbarLayoutObserver);
            this.registeredObservers.set("ajaxplorer:tree_change", scrollbarLayoutObserver);
        }

		this.options = {};
		if(options){
			this.options = options;
		}
		var thisObject = this;
		var action = function(e){
			if(!ajaxplorer) return;
			ajaxplorer.focusOn(thisObject);
			if(this.ajxpNode){
                if(ajaxplorer.getUserSelection().getContextNode() != this.ajxpNode){
                    ajaxplorer.actionBar.fireDefaultAction("dir", this.ajxpNode);
                }
                ajaxplorer.getUserSelection().setSelectedNodes([this.ajxpNode], thisObject);
			}
		};

		var filter = this.createFilter();
		var fakeRootNode = new AjxpNode("/", true, MessageHash[391], "folder.png");
		fakeRootNode._isLoaded = true;
		this.tree = new AJXPTree(fakeRootNode,  action, filter);

		this.treeContainer.update(this.tree.toString());
		$(this.tree.id).ajxpNode = this.tree.ajxpNode;
		$(this.tree.id).observe("click", function(e){
			this.action(e);
			Event.stop(e);
		}.bind(this.tree));

		AjxpDroppables.add(this.tree.id, this.tree.ajxpNode);
		if(!this.tree.open && !this.tree.loading) {
			this.tree.toggle();
		}
		this.treeContainer.observe("click", function(){
			ajaxplorer.focusOn(this);
		}.bind(this));

		this.rootNodeId = this.tree.id;
		this.hasFocus;

        var ctxChangedObs =function(event){
			var path = event.memo.getPath();
			window.setTimeout(function(e){
				this.setSelectedPath(path);
			}.bind(this), 100);
		}.bind(this);
		document.observe("ajaxplorer:context_changed",  ctxChangedObs);
        this.registeredObservers.set("ajaxplorer:context_changed", ctxChangedObs);

        var rootNodeObs = function(event){
			var ajxpRootNode = event.memo;
			this.tree.setAjxpRootNode(ajxpRootNode);
			this.changeRootLabel(ajxpRootNode.getLabel(), ajxpRootNode.getIcon());
		}.bind(this);
		document.observe("ajaxplorer:root_node_changed", rootNodeObs);
        this.registeredObservers.set("ajaxplorer:root_node_changed", rootNodeObs);

        var compConfChanged = function(event){
			if(event.memo.className == "FoldersTree"){
				var config = event.memo.classConfig.get('all');
				var options = XPathSelectNodes(config, 'property');
				for(var i=0;i<options.length;i++){
					this.options[options[i].getAttribute('name')] = options[i].getAttribute('value');
				}
				if(this.tree){
					this.tree.filter = this.createFilter();
				}
			}
		}.bind(this);
		document.observe("ajaxplorer:component_config_changed",  compConfChanged);
        this.registeredObservers.set("ajaxplorer:component_config_changed", compConfChanged);

	},

    destroy : function(){
        this.registeredObservers.each(function (pair){
            document.stopObserving(pair.key, pair.value);
        });
        if(this.scrollbar) this.scrollbar.destroy();
        if(this.tree) this.tree.destroy();
        if(window[this.htmlElement.id]){
            try{delete window[this.htmlElement.id];}catch(e){}
        }
    },

	/**
	 * Create a filtering function based on the options display
	 * @returns Function
	 */
	createFilter : function(){
		var displayOptions = this.options.display || "dz";
		if(displayOptions.indexOf("a") > -1) displayOptions = "dzf";
		if(displayOptions.indexOf("z") > -1 && window.zipEnabled === false) displayOptions = displayOptions.split("z").join("");
		this.options.display  = displayOptions;

		var d = (displayOptions.indexOf("d") > -1);
		var z = (displayOptions.indexOf("z") > -1);
		var f = (displayOptions.indexOf("f") > -1);
		var filter = function(ajxpNode){
			return (((d && !ajxpNode.isLeaf()) || (f && ajxpNode.isLeaf()) || (z && (ajxpNode.getAjxpMime()=="zip" || ajxpNode.getAjxpMime()=="ajxp_browsable_archive"))) && (ajxpNode.getParent().getAjxpMime() != "ajxp_recycle"));
		};
		return filter;
	},

	/**
	 * Focus implementation of IAjxpWidget
	 */
	focus: function(){
		if(webFXTreeHandler.selected)
		{
			webFXTreeHandler.selected.focus();
            if(webFXTreeHandler.selected.ajxpNode){
                ajaxplorer.getUserSelection().setSelectedNodes([webFXTreeHandler.selected.ajxpNode], this);
            }
		}
		webFXTreeHandler.setFocus(true);
		this.hasFocus = true;
	},

	/**
	 * Blur implementation of IAjxpWidget
	 */
	blur: function(){
		if(webFXTreeHandler.selected)
		{
			webFXTreeHandler.selected.blur();
		}
		webFXTreeHandler.setFocus(false);
		this.hasFocus = false;
	},

	/**
	 * Resize implementation of IAjxpWidget
	 */
	resize : function(){
		fitHeightToBottom(this.treeContainer, null);
        if(this.scrollbar){
            this.scroller.setStyle({height:parseInt(this.treeContainer.getHeight())+'px'});
            this.scrollbar.recalculateLayout();
        }
        document.fire("ajaxplorer:resize-FoldersTree-" + this.htmlElement.id, this.htmlElement.getDimensions());
	},

	/**
	 * ShowElement implementation of IAjxpWidget
	 */
	showElement : function(show){
		if (show) this.treeContainer.show();
		else this.treeContainer.hide();
	},

	/**
	 * Sets the contextual menu
	 * @param protoMenu Proto.Menu
	 */
	setContextualMenu: function(protoMenu){
        Event.observe(this.rootNodeId+'','contextmenu', function(event){
            this.select();
            this.action();
            Event.stop(event);
        }.bind(webFXTreeHandler.all[this.rootNodeId]));
         protoMenu.addElements('#'+this.rootNodeId+'');
		webFXTreeHandler.contextMenu = protoMenu;
	},

	/**
	 * Find a tree node by its path
	 * @param path String
	 * @returns WebFXTreeItem
	 */
	getNodeByPath : function(path){
		for(var key in webFXTreeHandler.all){
			if(webFXTreeHandler.all[key] && webFXTreeHandler.all[key].ajxpNode && webFXTreeHandler.all[key].ajxpNode.getPath() == path){
				return webFXTreeHandler.all[key];
			}
		}
	},

	/**
	 * Finds the node and select it
	 * @param path String
	 */
	setSelectedPath : function(path){
		if(path == "" || path == "/"){
			this.tree.select();
			return;
		}
		var parts = this.cleanPathToArray(path);
		var crtPath = "";
		for(var i=0;i<parts.length;i++){
			crtPath += "/" + parts[i];
			var node = this.getNodeByPath(crtPath);
			if(node && node.childNodes.length){
				node._webfxtree_expand();
			}
		}
		if(node){
			node.select();
		}
	},

	/**
	 * Transforms url to a path array
	 * @param url String
	 * @returns Array
	 */
	cleanPathToArray: function(url){
		var splitPath = url.split("/");
		var path = new Array();
		var j = 0;
		for(i=0; i<splitPath.length; i++)
		{
			if(splitPath[i] != '')
			{
				path[j] = splitPath[i];
				j++;
			}
		}
		return path;
	},

	/**
	 * Change the root node label
	 * @param newLabel String
	 * @param newIcon String
	 */
	changeRootLabel: function(newLabel, newIcon){
		this.changeNodeLabel(this.tree.id, newLabel, newIcon);
	},

	/**
	 * Change a node label
	 * @param nodeId String the Id of the node (webFX speaking)
	 * @param newLabel String
	 * @param newIcon String
	 */
	changeNodeLabel: function(nodeId, newLabel, newIcon){
		var node = $(nodeId+'-label').update(newLabel);
		if(newIcon){
			var realNode = webFXTreeHandler.all[nodeId];
			realNode.icon = newIcon;
			realNode.openIcon = newIcon;
		}
	},

    /**
   	 * Inline Editing of label
   	 * @param callback Function Callback after the label is edited.
   	 */
   	switchCurrentLabelToEdition : function(callback){
   		var sel = webFXTreeHandler.selected;
        if(!sel) return;
        var nodeId = webFXTreeHandler.selected.id;
   		var item = this.treeContainer.down('#' + nodeId); // We assume this action was triggered with a single-selection active.
   		var offset = {top:0,left:0};
   		var scrollTop = 0;

        var span = item.down('a');
        var posSpan = item;
        offset.top=1;
        offset.left=43;
        scrollTop = this.treeContainer.scrollTop;

   		var pos = posSpan.cumulativeOffset();
   		var text = span.innerHTML;
   		var edit = new Element('input', {value:item.ajxpNode.getLabel('text'), id:'editbox'}).setStyle({
   			zIndex:5000,
   			position:'absolute',
   			marginLeft:'0px',
   			marginTop:'0px',
   			height:'24px',
               padding: 0
   		});
   		$(document.getElementsByTagName('body')[0]).insert({bottom:edit});
   		modal.showContent('editbox', (posSpan.getWidth()-offset.left)+'', '20', true, false, {opacity:0.25, backgroundColor:'#fff'});
   		edit.setStyle({left:(pos.left+offset.left)+'px', top:(pos.top+offset.top-scrollTop)+'px'});
   		window.setTimeout(function(){
   			edit.focus();
   			var end = edit.getValue().lastIndexOf("\.");
   			if(end == -1){
   				edit.select();
   			}else{
   				var start = 0;
   				if(edit.setSelectionRange)
   				{
   					edit.setSelectionRange(start,end);
   				}
   				else if (edit.createTextRange) {
   					var range = edit.createTextRange();
   					range.collapse(true);
   					range.moveStart('character', start);
   					range.moveEnd('character', end);
   					range.select();
   				}
   			}

   		}, 300);
   		var onOkAction = function(){
   			var newValue = edit.getValue();
   			hideLightBox();
   			modal.close();
   			callback(item.ajxpNode, newValue);
   		};
   		edit.observe("keydown", function(event){
   			if(event.keyCode == Event.KEY_RETURN){
   				Event.stop(event);
   				onOkAction();
   			}
   		}.bind(this));
   		// Add ok / cancel button, for mobile devices among others
   		var buttons = modal.addSubmitCancel(edit, null, false, "after");
        buttons.addClassName("inlineEdition");
   		var ok = buttons.select('input[name="ok"]')[0];
   		ok.observe("click", onOkAction);
   		var origWidth = edit.getWidth()-44;
   		var newWidth = origWidth;
   		if(origWidth < 70){
   			// Offset edit box to be sure it's always big enough.
   			edit.setStyle({left:pos.left+offset.left - 70 + origWidth});
   			newWidth = 70;
   		}
   		edit.setStyle({width:newWidth+'px'});

   		buttons.select('input').invoke('setStyle', {
   			margin:0,
   			width:'22px',
   			border:0,
   			backgroundColor:'transparent'
   		});
   		buttons.setStyle({
   			position:'absolute',
   			width:'46px',
   			zIndex:2500,
   			left:(pos.left+offset.left+origWidth)+'px',
   			top:((pos.top+offset.top-scrollTop)-1)+'px'
   		});
   		var closeFunc = function(){
   			span.setStyle({color:''});
   			edit.remove();
   			buttons.remove();
   		};
   		span.setStyle({color:'#ddd'});
   		modal.setCloseAction(closeFunc);
   	}

});


text:
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>W28870_text</title>
        <link rel="stylesheet" type="text/css" href="style.css" />

                «

    <p class="styleSans5.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">'NDINELNINU

    <p class="styleSans8.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">6724 Corporation Pkwy Fort Worth, Texas 76126 (817) 717-1820

    <p class="styleSans8.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Directional Survey Certification Form

    <p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">HESS Company
ND-HES-0233

    <p class="styleSans6.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Job Number
AR 97 32 "R? N

    <p class="styleSans10.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">
Surface Latitude Surface Longitude Sec. :TWP - Range
NAD83 H&P309 24.40 Datum Rig Contractor/ Name RKB Height Survey Depths 0' to 2054.00 ft Type of Survey Measurements While Drilling gMWD!
Survey Depths ( 'J C5 L/ ft
Type of Survey

Site Supervisor
The data submitted in this report conforms to the standards and procedures as set forth by Schlumberger. This report represents a true and correct directional wellbore survey based an original survey data obtained at the well site.
Ax" Signature  [7 T / T
[/(k 5:", z /6 3C LI (IT'C'I/m Printed Name Date ST" '7 Title
_.I
This document has been subscribed and affirmed, or sworn before me in the county of Adams in the state of Colorado, this day of . 20 .

    <p class="styleSans1.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">

    <p class="styleSans6.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">GN-Halseth 158-97-3130H-3 Well Name
Williams, ND

    <p class="styleSans8.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">County/State
103 15 94 5918 W

    <p class="styleSans8.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">18/08/2014 02:51 Final Report Date
33-1 05-03601

    <p class="styleSans6.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">API Number
31 .1 58-97


text:
package gol

import (
	"github.com/ianremmler/gordian"
	"github.com/jakecoffman/cp"

	"fmt"
	"math"
	"math/rand"
	"sync"
	"time"
)

const (
	frameRate    = 30
	simTime      = time.Second / (2 * frameRate)
	updateTime   = time.Second / frameRate
	pauseTime    = time.Second
	maxScore     = 10
	fieldWidth   = 1000
	fieldHeight  = 500
	edgeRadius   = 5
	goalSize     = 200
	playerRadius = 15
	playerMass   = 1
	ballRadius   = 10
	ballMass     = 0.05
)

const (
	ballType = iota + 1
)

const (
	fieldCat = 1 << iota
	ballCat
	goalCat
	team0Cat
	team1Cat
)

type player struct {
	id          gordian.ClientId
	team        int
	shape       *cp.Shape
	cursorBody  *cp.Body
	cursorJoint *cp.Constraint
}

func (p *player) place() {
	widthRange := 0.5*fieldWidth - 2*playerRadius
	heightRange := 0.5*fieldHeight - playerRadius
	sign := float64(2*p.team - 1)
	pos := cp.Vector{
		(widthRange*rand.Float64() + playerRadius) * sign,
		heightRange * (2*rand.Float64() - 1),
	}
	minDist := 0.25*fieldHeight + playerRadius
	dist := pos.Length()
	if dist < minDist {
		pos = pos.Mult(minDist / dist)
	}
	p.shape.Body().SetPosition(pos)
}

func (p *player) enableCursorJoint(enable bool) {
	sp := p.shape.Space()
	isEnabled := sp.ContainsConstraint(p.cursorJoint)
	switch {
	case enable && !isEnabled:
		sp.AddConstraint(p.cursorJoint)
	case !enable && isEnabled:
		sp.RemoveConstraint(p.cursorJoint)
	}
}

type Player struct {
	Pos  cp.Vector
	Team int
}

type Ball struct {
	Pos cp.Vector
}

type configMsg struct {
	Id           string
	FieldWidth   float64
	FieldHeight  float64
	GoalSize     float64
	PlayerRadius float64
	BallRadius   float64
	EdgeRadius   float64
}

type stateMsg struct {
	Players map[string]Player
	Ball    Ball
	Score   []int
}

type Gol struct {
	players      map[gordian.ClientId]*player
	score        []int
	pauseTicks   int
	simTimer     <-chan time.Time
	updateTimer  <-chan time.Time
	curId        int
	ball         *cp.Shape
	centerLine   *cp.Shape
	centerCircle *cp.Shape
	space        *cp.Space
	sync.Mutex
	*gordian.Gordian
}

func New() *Gol {
	g := &Gol{
		players:     map[gordian.ClientId]*player{},
		score:       []int{0, 0},
		simTimer:    time.Tick(simTime),
		updateTimer: time.Tick(updateTime),
		Gordian:     gordian.New(frameRate), // buffer max 1 second
	}
	g.setup()
	return g
}

func (g *Gol) setup() {
	g.space = cp.NewSpace()
	g.space.SetDamping(0.25)
	hfw, hfh, hgs := 0.5*fieldWidth, 0.5*fieldHeight, 0.5*goalSize
	sidePts := []cp.Vector{{-hfw, hgs}, {-hfw, hfh}, {hfw, hfh}, {hfw, hgs}}
	numSideSegs := len(sidePts) - 1
	for i := 0; i < 2; i++ {
		sign := float64(2*i - 1)
		for j := 0; j < numSideSegs; j++ {
			p0, p1 := sidePts[j], sidePts[j+1]
			p0.Y *= sign
			p1.Y *= sign
			fieldSeg := cp.NewSegment(g.space.StaticBody, p0, p1, edgeRadius)
			fieldSeg.SetElasticity(1.0)
			fieldSeg.SetFriction(1.0)
			g.space.AddShape(fieldSeg)
		}
		p0, p1 := cp.Vector{sign * hfw, -hgs}, cp.Vector{sign * hfw, hgs}
		goal := cp.NewSegment(g.space.StaticBody, p0, p1, edgeRadius)
		goal.Filter.Categories = goalCat
		goal.SetElasticity(1.0)
		goal.SetFriction(1.0)
		g.space.AddShape(goal)
	}

	g.centerLine = cp.NewSegment(g.space.StaticBody, cp.Vector{0.0, -0.5 * fieldHeight},
		cp.Vector{0.0, 0.5 * fieldHeight}, edgeRadius)
	g.centerLine.Filter.Categories = fieldCat
	g.centerLine.Filter.Mask = 0
	g.centerLine.SetElasticity(1.0)
	g.centerLine.SetFriction(1.0)
	g.space.AddShape(g.centerLine)

	g.centerCircle = cp.NewCircle(g.space.StaticBody, 0.5*goalSize+edgeRadius, cp.Vector{})
	g.centerCircle.Filter.Categories = fieldCat
	g.centerCircle.Filter.Mask = 0
	g.centerCircle.SetElasticity(1.0)
	g.centerCircle.SetFriction(1.0)
	g.space.AddShape(g.centerCircle)

	moment := cp.MomentForCircle(ballMass, 0, ballRadius, cp.Vector{})
	body := cp.NewBody(ballMass, moment)
	g.space.AddBody(body)
	g.ball = cp.NewCircle(body, ballRadius, cp.Vector{})
	g.ball.SetCollisionType(ballType)
	g.ball.Filter.Categories = ballCat
	g.ball.Filter.Mask &^= goalCat
	g.ball.SetElasticity(1.0)
	g.ball.SetFriction(1.0)
	g.space.AddShape(g.ball)

	g.space.NewWildcardCollisionHandler(ballType).BeginFunc =
		func(arb *cp.Arbiter, space *cp.Space, data interface{}) bool {
			g.centerLine.Filter.Mask = 0
			g.centerCircle.Filter.Mask = 0
			return true
		}
}

func (g *Gol) Run() {
	go g.run()
	go g.sim()
	g.Gordian.Run()
}

func (g *Gol) run() {
	for {
		select {
		case client := <-g.Control:
			g.clientCtrl(client)
		case msg := <-g.InBox:
			g.handleMessage(&msg)
		case <-g.updateTimer:
			g.update()
		}
	}
}

func (g *Gol) sim() {
	for {
		<-g.simTimer

		g.Lock()

		g.space.Step(simTime.Seconds())
		g.handlePauses()
		g.handleGoals()

		g.Unlock()
	}
}

func (g *Gol) handlePauses() {
	// enable control if pause is ending
	if g.pauseTicks == 1 {
		for _, player := range g.players {
			player.enableCursorJoint(true)
		}
	}
	// update pause countdown
	if g.pauseTicks > 0 {
		g.pauseTicks--
	}
}

func (g *Gol) handleGoals() {
	ballX := g.ball.Body().Position().X
	if math.Abs(ballX) > fieldWidth/2 { // GOL!
		team := 0
		if ballX < 0 {
			team = 1
		}
		g.score[team]++
		if g.score[0] >= maxScore || g.score[1] >= maxScore {
			g.score[0], g.score[1] = 0, 0
			team = rand.Intn(2)
		}
		g.kickoff(team)
	}
}

func (g *Gol) kickoff(team int) {
	g.ball.Body().SetPosition(cp.Vector{})
	g.ball.Body().SetVelocityVector(cp.Vector{})
	for _, player := range g.players {
		player.place()
		player.shape.Body().SetVelocityVector(cp.Vector{})
		player.enableCursorJoint(false) // disable control for a bit
	}
	g.centerLine.Filter.Mask = team0Cat | team1Cat
	if len(g.players) > 1 {
		g.centerCircle.Filter.Mask = team0Cat << uint(team)
	}
	g.pauseTicks = int(pauseTime / simTime)
}

func (g *Gol) clientCtrl(client *gordian.Client) {
	switch client.Ctrl {
	case gordian.Connect:
		g.connect(client)
	case gordian.Close:
		g.close(client)
	}
}

func (g *Gol) nextTeam() int {
	teamSize := []int{0, 0}
	for _, player := range g.players {
		teamSize[player.team]++
	}
	switch {
	case teamSize[0] < teamSize[1]:
		return 0
	case teamSize[0] > teamSize[1]:
		return 1
	default:
		return rand.Intn(2)
	}
}

func (g *Gol) addPlayer(id gordian.ClientId) *player {
	player := &player{id: id, team: g.nextTeam()}

	moment := cp.MomentForCircle(playerMass, 0, playerRadius, cp.Vector{})
	body := cp.NewBody(playerMass, moment)
	g.space.AddBody(body)

	player.shape = cp.NewCircle(body, playerRadius, cp.Vector{})
	player.shape.Filter.Categories = team0Cat << uint(player.team)
	player.shape.SetElasticity(1.0)
	player.shape.SetFriction(1.0)
	g.space.AddShape(player.shape)

	player.cursorBody = cp.NewBody(math.Inf(0), math.Inf(0))
	player.cursorJoint =
		cp.NewPivotJoint2(player.cursorBody, body, cp.Vector{}, cp.Vector{})
	player.cursorJoint.SetMaxForce(1000.0)
	player.enableCursorJoint(true)

	g.players[player.id] = player

	return player
}

func (g *Gol) removePlayer(id gordian.ClientId) {
	player, ok := g.players[id]
	if !ok {
		return
	}
	player.enableCursorJoint(false)
	g.space.RemoveBody(player.shape.Body())
	g.space.RemoveShape(player.shape)

	delete(g.players, id)
	if len(g.players) < 2 {
		g.centerCircle.Filter.Mask = 0
	}
}

func (g *Gol) connect(client *gordian.Client) {
	client.Id = g.curId
	client.Ctrl = gordian.Register
	g.Control <- client
	client = <-g.Control
	if client.Ctrl != gordian.Establish {
		return
	}
	g.curId++

	g.Lock()

	player := g.addPlayer(client.Id)
	player.place()

	g.Unlock()

	data := configMsg{
		FieldWidth:   fieldWidth,
		FieldHeight:  fieldHeight,
		GoalSize:     goalSize,
		PlayerRadius: playerRadius,
		BallRadius:   ballRadius,
		EdgeRadius:   edgeRadius,
		Id:           fmt.Sprintf("%d", client.Id),
	}
	msg := gordian.Message{
		To:   client.Id,
		Type: "config",
		Data: data,
	}
	g.OutBox <- msg
}

func (g *Gol) close(client *gordian.Client) {
	g.Lock()
	defer g.Unlock()

	g.removePlayer(client.Id)
}

func (g *Gol) handleMessage(msg *gordian.Message) {
	g.Lock()
	defer g.Unlock()

	id := msg.From
	player, ok := g.players[id]
	if !ok {
		return
	}
	switch msg.Type {
	case "player":
		state := &Player{}
		err := msg.Unmarshal(state)
		if err != nil {
			return
		}
		player.cursorBody.SetPosition(state.Pos)
	}
}

func (g *Gol) update() {
	g.Lock()

	state := stateMsg{
		Players: map[string]Player{},
		Ball:    Ball{g.ball.Body().Position()},
		Score:   g.score,
	}
	for i, player := range g.players {
		state.Players[fmt.Sprintf("%d", i)] = Player{
			Pos:  player.shape.Body().Position(),
			Team: player.team,
		}
	}

	g.Unlock()

	msg := gordian.Message{
		Type: "state",
		Data: state,
	}
	for id := range g.players {
		msg.To = id
		g.OutBox <- msg
	}
}


text:
/*global define:true, require:true, suites:true */

require.config({
  // You wil most likely need to adapt the paths accordingly with your environment
  "baseUrl" : '../',
  "shim"    : {
    "mocha": { "exports": 'mocha' }
  },
  "paths"   : {
    "sinon"       : '../test/node_modules/sinon-chai/node_modules/sinon/lib',
    "chai"        : '../test/node_modules/chai/chai',
    "sinon-chai"  : '../test/node_modules/sinon-chai/lib/sinon-chai',
    "mocha"       : '../test/node_modules/mocha/mocha',
    "init"        : '../test/init'
  }
});

define(['mocha'], function (mocha) {
  'use strict';
  mocha.setup('bdd');
  require(suites.map(function (s) { return '../test/suites/' + s; }), function () {
    mocha.run();
  });
});


text:
import { getAddresses, getNetworks } from '~/selectors';
import HookedWalletEthTx from 'web3-provider-engine/subproviders/hooked-wallet-ethtx';

import { showTxSigningModal } from '~/actions/session';

export default class ReduxSubProvider extends HookedWalletEthTx {
  constructor({ store, networkId }, opts) {
    super({
      ...opts,
      getAccounts(cb) {
        // TODO filter by networkId?
        const addresses = getAddresses(store.getState()).map(a => a.address);
        cb(null, addresses);
      },
    });
  }

  static sanitizeData = (txData, network) => ({
    to: txData.to,
    from: txData.from,
    gas: txData.gas || txData.gasLimit,
    gasPrice: txData.gasPrice,
    value: txData.value || '0x00',
    data: txData.data || '',
    nonce: txData.nonce,
    chainId: (txData.chainId && parseInt(txData.chainId, 10)) || (network.chainId && parseInt(network.chainId, 10)),
  });

    // overriding https://github.com/MetaMask/provider-engine/blob/master/subproviders/hooked-wallet-ethtx.js
  static signTransaction = ({ ui, ...data }, cb) => {
    const network = (getNetworks(store.getState()).find(({ id }) => id === networkId) || {});
    const txData = this.sanitizeData(data, network);
    const address = getAddresses(store.getState()).find(a => a.address === txData.from);
    store.dispatch(showTxSigningModal({ address, txData, ui, network })).then(({ signedTx }) => {
      cb(null, signedTx);
    }).catch(cb);
  };
}


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

using namespace Aws::ElastiCache::Model;
using namespace Aws::Utils;

DescribeCacheParameterGroupsRequest::DescribeCacheParameterGroupsRequest() :
    m_cacheParameterGroupNameHasBeenSet(false),
    m_maxRecords(0),
    m_maxRecordsHasBeenSet(false),
    m_markerHasBeenSet(false)
{
}

Aws::String DescribeCacheParameterGroupsRequest::SerializePayload() const
{
  Aws::StringStream ss;
  ss << "Action=DescribeCacheParameterGroups&";
  if(m_cacheParameterGroupNameHasBeenSet)
  {
    ss << "CacheParameterGroupName=" << StringUtils::URLEncode(m_cacheParameterGroupName.c_str()) << "&";
  }

  if(m_maxRecordsHasBeenSet)
  {
    ss << "MaxRecords=" << m_maxRecords << "&";
  }

  if(m_markerHasBeenSet)
  {
    ss << "Marker=" << StringUtils::URLEncode(m_marker.c_str()) << "&";
  }

  ss << "Version=2015-02-02";
  return ss.str();
}


text:
package core_test

import (
	log "github.com/Sirupsen/logrus"
)

func init() {
	log.SetLevel(log.WarnLevel)
}


text:
from __future__ import unicode_literals

from django.db import models, migrations

class Migration(migrations.Migration):

    dependencies = [
        ('jass', '0007_auto_20151104_1012'),
    ]

    operations = [
        migrations.AlterField(
            model_name='inputrequest',
            name='url',
            field=models.URLField(max_length=20000, null=True, blank=True),
        ),
    ]


text:
package main

import (
	"context"
	"io"
	"io/ioutil"
	"strings"
	"testing"
)

func TestStdoutNotify_SendBuildReport(t *testing.T) {
	ctx := context.Background()
	type args struct {
		ctx    context.Context
		r      io.ReadCloser
		report BuildReport
	}
	tests := []struct {
		name string
		out  StdoutNotify
		args args
	}{
		{"empty", StdoutNotify{}, args{ctx, ioutil.NopCloser(strings.NewReader("")), BuildReport{}}},
		{"success", StdoutNotify{}, args{ctx, ioutil.NopCloser(strings.NewReader(`{"stream": "Successfully built abcd1234abcd"}`)), BuildReport{}}},
		{
			"success",
			StdoutNotify{},
			args{
				ctx,
				ioutil.NopCloser(strings.NewReader(`{"stream": "Successfully built abcd1234abcd"}`)),
				BuildReport{
					RepoName:     "test-repo",
					Owner:        "test-user",
					ImageName:    "test-repo/test-user",
					Tag:          "latest",
					BuildContext: "git://git/repository",
				},
			},
		},
		{"error", StdoutNotify{}, args{ctx, ioutil.NopCloser(strings.NewReader("ERROR")), BuildReport{}}},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			out := StdoutNotify{}
			out.SendBuildReport(tt.args.ctx, tt.args.r, tt.args.report)
		})
	}
}

func TestStdoutNotify_SendPushReport(t *testing.T) {
	ctx := context.Background()
	type args struct {
		ctx   context.Context
		r     io.ReadCloser
		image string
	}
	tests := []struct {
		name string
		out  StdoutNotify
		args args
	}{
		{"oneline", StdoutNotify{}, args{ctx, ioutil.NopCloser(strings.NewReader(`{"stream": "output line"}`)), "test/image"}},
		{"multiline", StdoutNotify{}, args{ctx, ioutil.NopCloser(strings.NewReader(`{"stream": "output line"}
			{"stream": "second line"}
			{"stream": "third line"}`)), "test/image"}},
		{"empty", StdoutNotify{}, args{ctx, ioutil.NopCloser(strings.NewReader("")), "test/image"}},
		{"error", StdoutNotify{}, args{ctx, ioutil.NopCloser(strings.NewReader("ERROR")), "test/image"}},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			out := StdoutNotify{}
			out.SendPushReport(tt.args.ctx, tt.args.r, tt.args.image)
		})
	}
}


text:
<?php

namespace Alex\MailCatcher;

class Person
{
    protected $name;
    protected $email;

    /**
     * @param $name
     * @param $email
     */
    public function __construct($name, $email)
    {
        $this->name  = null === $name  ? null : (string) $name;
        $this->email = null === $email ? null : (string) $email;
    }

    /**
     * @param $text
     *
     * @return bool
     */
    public function match($text)
    {
        return false !== strpos((string) $this->name, $text) || false !== strpos((string) $this->email, $text);
    }

    /**
     * @return null|string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * @return null|string
     */
    public function getEmail()
    {
        return $this->email;
    }

    /**
     * @param Person $person
     *
     * @return bool
     */
    public function equals(Person $person)
    {
        return $person->getName() === $this->name && $person->getEmail() === $this->email;
    }

    /**
     * @param $string
     *
     * @return Person
     */
    public static function createFromString($string)
    {
        if (preg_match('/^(?:(.+) )?<(.+)>$/', $string, $vars)) {
            $name  = $vars[1] === '' ? null : $vars[1];
            $email = $vars[2] === '' ? null : $vars[2];
            return new Person($name, $email);
        }

        throw new \InvalidArgumentException(sprintf('Unable to parse Person "%s".', $string));
    }
}


text:
module.exports = function getErrorHandler() {
    return function errorHandler(err, req, res, next) { // eslint-disable-line
        let code = 500;
        let error = 'Internal Server Error';

        // mongoose threw us an error
        if (err.name === 'ValidationError' || err.name === 'CastError') {
            code = 400;
            error = err.name;
        } else if (err.code) {
            code = err.code;
            error = err.error;
            console.log(err.code, err.error);
        } else {
            console.log('reporting err', err);
        }
        res.status(code).send({ error });
    };
};


text:
SYNONYM

#### According to
Index Fungorum

#### Published in
Linnaea 25: 740 (1852)

#### Original name
Botrypes Preuss

### Remarks
null


text:
The WebSharper Formlets library provides a high-level abstraction for
working with web forms and constructing interactive user interfaces.

One of the most common tasks in web development is creating web forms
for collecting user data.  Among other things this involves:

* Creating forms to collect data.
* Looking up the submitted data on the server.
* Validating data.
* Providing validation feedback to the user.

Formlets address all of the above tasks.  The advantages of using
formlets for web-form construction are:

### Type Safety

Every `Formlet<'T>` collects data of type `'T`, preventing typing
errors.  The data type is not limited to primitive values, and often
includes convenient to consume records and unions.

### Composabilty

Complex formlets are built from simple components.  In basic
composition, two formlets `Formlet<'T1>` and a `Formlet<'T2>` can be
combined into a `Formlet<'T3>` using a function `'T1->'T2->'T3`.
Additional formlet composition methods allow to express wizard-like
workflows.

### Reusability

Once defined, a formlet may be reused as a component of many other
formlets and pages.

### Validation

Formlets are aware of the need to validate the collected data and
provide interactive feedback to the user.

### Declarative Style

Formlets are defined in a declarative way, meaning that you only need
to specify the descriptive parts of your form applications, i.e. which
controls to include, what validation logic to apply and how to
aggregate the result of the sub-forms.  All the tedious work of
creating HTML elements, extracting the form data and displaying error
messages is automated.

## Overview

The Formlets library contains a set of components for creating
primitive form controls, composing formlets, adding validation, and
enhancing formlets in various ways.

### Primitive Formlet Controls

In the `Control` module you find a set of predefined formlets
corresponding to some basic web form components such as input text
fields, text areas and check boxes.

As an example, the `TextArea` formlet is exposed as a function from
the default value to a `Formlet<string>`.

    let textForm = Controls.TextArea ""
    let selForm =
        [ "Option A", "A"; "Option B", "B" ]
        |> Controls.Select 0
    let buttoForm = Controls.Button "Click"

### Formlet Composition

The most important property of formlets is the ability to build
complex formlets by composing simpler ones.

### Static Composition

The `Formlet.Yield` and `Formlet.Apply` (or `<*>`) functions provide
the default way to combine formlets.  `Formlet.Yield` accepts a
function specifying how to combine the values of several formlets, and
`Formlet.Apply` incrementally provides the formlets to compose.

A composed formlet `Formlet.Yield f <*> g1 <*> g2 .. <*> gn` at any
point in time carries the value of `f g1.value g2.value... gn.value`.
Visually it renders as a concatenation of the component formlets `g1
.. gn`.

In the following example two string formlets are composed:

    [<JavaScript>]
    let ComposedFormlet: Formlet<string> =
        Formlet.Yield (fun x y -> x + " " + y)
        <*> Controls.Select ["Email", "E"; "Mail", "M"] 0
        <*> Controls.Input ""

The value of the `ComposedFormlet` is the concatenation of the
component formlet values.  The result looks like this:

![Statically Composed Formlet](static-comp-form.png)

Formlets are closed under composition. This means that
`ComposedFormlet` may itself be composed with other formlets.

### Dynamic Composition

Dynamic/Dependent formlets are formlets that depend on the values
produced by some other formlet.  You can specify such dependencies
using F# computation expressions:

    [<JavaScript>]
    let DependentFormlet () =
        Formlet.Do {
            let! x = Controls.Input ""
            return! Controls.Input x
        }

The formlet above uses the values produced by the first text-box as
input when constructing an additional (dependent) text-box.

![Dependent Formlet](dep-form.png)

### Enhancing Formlets

The `Enhance` module provides a set of predefined functions for
enhancing formlets with additional properties.

Common for these functions is that they accept a formlet of type `T`
along with additional arguments as an input and return a formlet of
the same type extended with some properties.

As an example, the `Enhance.WitTextLabel` accepts a string value
corresponding to the label, and a formlet, returning a new formlet
with a label.

    [<JavaScript>]
    let LabeledFormlet =
        let label = Text "Label"
        Controls.Enhance.WithLabel label (Control.Input "")

![Labelled Formlet](label-form.png)

The function `Control.Enhance.WithLegend` has a similar signature but
instead of returning a formlet with a label, the body of the formlet
is wrapped within an HTML `legend` element, visually creating a small
box around the formlet.

You may also apply several transformation functions for enhancing
formlets in different ways. Below is an example combining the
`Enhance.WithTextLabel` and `WithSubmitAndResetButtons` functions for
creating a text field formlet with a legend enhanced with submit and
reset buttons:

    let InputForm =
        Controls.Input ""
        |> Enhance.WithTextLabel "Label"
        |> Enhance.WithSubmitAndResetButtons
        |> Enhance.WithFormContainer

![Enhanced Formlet](enhance-form.png)

Note that the order in which the functions are applied is important.

### Adding Validation

By adding validation you restrict the admissible formlet values by
putting the formlet into a failing state whenever the current value is
invalid.  Among other things, this means that the formlet cannot be
submitted since no value is available. Some predefined validators are
found in the `Validator` module.  Here is an example enhancing a
text-box formlet with validation requiring that the input string is
not empty:

    let ValidationForm =
         Controls.Input ""
         |> Enhance.WithTextLabel "Label"
         |> Validator.IsNotEmpty "Enter non-empty value"
         |> Enhance.WithValidationIcon
         |> Enhance.WithSubmitAndResetButtons
         |> Enhance.WithFormContainer

![Validation Formlet](validation-form.png)

### Layout

Each formlet carries a layout-manager responsible for rendering the
visual components produced when running the formlet.  You can use the
function `Formlet.WithLayout` to specify the layout manager to be
used. Three default layout managers are provided:

* `Layout.Vertical` - Lays out components vertically.

* `Layout.Horizontal` - Lays out components horizontally.

* `Layout.Flowlet` - Creates a wizard-like interface where subsequent
  components replace the previous ones.

Instead of using the `Formlet.WithLayout` the above layouts may be
applied directly via the functions `Formlet.Vertical`,
`Formlet.Horizontal` and `Formlet.Flowlet`.

### Displaying Formlets

Since formlets implement the `IPagelet` interface, they may be
directly embedded inside HTML combinators:

    [<JavaScript>]
    let Main () =
        Div [
            Controls.Input "Text-field formlet in div tag"
        ]

If you want to handle the values produced by a formlet, you may use
the `Run` method. It accepts a handler that is invoked every time a
new value is produced by the formlet, and returns an `IPagelet`
instance corresponding to the form body:

    [<JavaScript>]
    let Main () =
        let input =
            Controls.Input ""
            |> Enhance.WithSubmitButton
        Div [
            input.Run (fun s ->
                processResult s
            )
        ]

## Examples

### Statically Composed Formlet

Below is an example of a formlet for entering name and email
information:

    type Person = {
        Name: string
        Email: string
    }

    [<JavaScript>]
    let PersonFormlet : Formlet<Person> =
        let nameF =
            Controls.Input ""
            |> Validator.IsNotEmpty "Empty name not allowed"
            |> Enhance.WithValidationIcon
            |> Enhance.WithTextLabel "Name"
        let emailF =
            Controls.Input ""
            |> Validator.IsEmail "Please enter valid email address"
            |> Enhance.WithValidationIcon
            |> Enhance.WithTextLabel "Email"
        Formlet.Yield (fun name email -> {Name = name; Email = email})
        <*> nameF
        <*> emailF
        |> Enhance.WithSubmitAndResetButtons
        |> Enhance.WithLegend "Add a New Person"
        |> Enhance.WithFormContainer

    [<JavaScript>]
    let Main () =
        Div [PersonFormlet]

`PersonFormlet` defines a formlet parameterized with the user-defined
type `Person`. It contains validation logic to guarantee that the
`Name` field is not empty and the email address is of the correct
format.

![Person Formlet](person-form-ex.png)

## Dependent Formlet

Below is an exmaple of using computation expressions to define a
dependent formlet:

    type ContactData =
        | Phone of string
        | Email of string

    [<JavaScript>]
    let ContactFormlet : Formlet<ContactData> =
        let phone =
            Controls.Input ""
            |> Enhance.WithTextLabel "Phone"
            |> Formlet.Map Phone
        let email =
            Controls.Input ""
            |> Validator.IsEmail "Please enter a valid email address."
            |> Formlet.Map Email
            |> Enhance.WithTextLabel "Email"
        Formlet.Do {
            let! contactTypeFormlet =
                Controls.Select 0 [("Phone", phone); ("Email", email)]
                |> Enhance.WithTextLabel "Type"
            return! contactTypeFormlet
        }
        |> Enhance.WithSubmitAndResetButtons
        |> Enhance.WithFormContainer

This formlet will interactively present either the `phone` or `email`
form depending on the user's choice in the select box.  Each time the
user changes the selected option, the dependent form is updated.

![Dependent Form](dep-form-ex.png)


text:
import { Component, OnInit } from '@angular/core';

@Component({
    selector: 'not-found',
    template: `Stránka nebyla nalezena`
})

export class NotFoundComponent implements OnInit {
    constructor() { }

    ngOnInit() { }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>Uses of Class org.apache.poi.ss.usermodel.BorderStyle (POI API Documentation)</title>
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

PREV

NEXT

FRAMES

NO FRAMES

All Classes

Uses of Class
org.apache.poi.ss.usermodel.BorderStyle

Packages that use BorderStyle

Package
Description

org.apache.poi.hssf.converter

org.apache.poi.hssf.usermodel

usermodel package maps HSSF low level strutures to familiar workbook/sheet model

org.apache.poi.ss.usermodel

org.apache.poi.ss.util

org.apache.poi.xssf.usermodel

org.apache.poi.xssf.usermodel.extensions

Uses of BorderStyle in org.apache.poi.hssf.converter

Methods in org.apache.poi.hssf.converter with parameters of type BorderStyle

Modifier and Type
Method and Description

static java.lang.String
AbstractExcelUtils.getBorderStyle(BorderStyle xlsBorder)

static java.lang.String
AbstractExcelUtils.getBorderWidth(BorderStyle xlsBorder)

protected void
ExcelToFoConverter.processCellStyleBorder(HSSFWorkbook workbook,
                      org.w3c.dom.Element cellTarget,
                      java.lang.String type,
                      BorderStyle xlsBorder,
                      short borderColor)

Uses of BorderStyle in org.apache.poi.hssf.usermodel

Methods in org.apache.poi.hssf.usermodel that return BorderStyle

Modifier and Type
Method and Description

BorderStyle
HSSFCellStyle.getBorderBottomEnum()

get the type of border to use for the bottom border of the cell

BorderStyle
HSSFBorderFormatting.getBorderBottomEnum()

BorderStyle
HSSFBorderFormatting.getBorderDiagonalEnum()

BorderStyle
HSSFCellStyle.getBorderLeftEnum()

get the type of border to use for the left border of the cell

BorderStyle
HSSFBorderFormatting.getBorderLeftEnum()

BorderStyle
HSSFCellStyle.getBorderRightEnum()

get the type of border to use for the right border of the cell

BorderStyle
HSSFBorderFormatting.getBorderRightEnum()

BorderStyle
HSSFCellStyle.getBorderTopEnum()

get the type of border to use for the top border of the cell

BorderStyle
HSSFBorderFormatting.getBorderTopEnum()

Methods in org.apache.poi.hssf.usermodel with parameters of type BorderStyle

Modifier and Type
Method and Description

void
HSSFCellStyle.setBorderBottom(BorderStyle border)

set the type of border to use for the bottom border of the cell

void
HSSFBorderFormatting.setBorderBottom(BorderStyle border)

void
HSSFBorderFormatting.setBorderDiagonal(BorderStyle border)

void
HSSFCellStyle.setBorderLeft(BorderStyle border)

set the type of border to use for the left border of the cell

void
HSSFBorderFormatting.setBorderLeft(BorderStyle border)

void
HSSFCellStyle.setBorderRight(BorderStyle border)

set the type of border to use for the right border of the cell

void
HSSFBorderFormatting.setBorderRight(BorderStyle border)

void
HSSFCellStyle.setBorderTop(BorderStyle border)

set the type of border to use for the top border of the cell

void
HSSFBorderFormatting.setBorderTop(BorderStyle border)

Uses of BorderStyle in org.apache.poi.ss.usermodel

Methods in org.apache.poi.ss.usermodel that return BorderStyle

Modifier and Type
Method and Description

BorderStyle
BorderFormatting.getBorderBottomEnum()

BorderStyle
CellStyle.getBorderBottomEnum()

get the type of border to use for the bottom border of the cell

BorderStyle
BorderFormatting.getBorderDiagonalEnum()

BorderStyle
BorderFormatting.getBorderLeftEnum()

BorderStyle
CellStyle.getBorderLeftEnum()

get the type of border to use for the left border of the cell

BorderStyle
BorderFormatting.getBorderRightEnum()

BorderStyle
CellStyle.getBorderRightEnum()

get the type of border to use for the right border of the cell

BorderStyle
BorderFormatting.getBorderTopEnum()

BorderStyle
CellStyle.getBorderTopEnum()

get the type of border to use for the top border of the cell

static BorderStyle
BorderStyle.valueOf(short code)

static BorderStyle
BorderStyle.valueOf(java.lang.String name)

Returns the enum constant of this type with the specified name.

static BorderStyle[]
BorderStyle.values()

Returns an array containing the constants of this enum type, in
the order they are declared.

Methods in org.apache.poi.ss.usermodel with parameters of type BorderStyle

Modifier and Type
Method and Description

void
BorderFormatting.setBorderBottom(BorderStyle border)

Set bottom border.

void
CellStyle.setBorderBottom(BorderStyle border)

set the type of border to use for the bottom border of the cell

void
BorderFormatting.setBorderDiagonal(BorderStyle border)

Set diagonal border.

void
BorderFormatting.setBorderLeft(BorderStyle border)

Set left border.

void
CellStyle.setBorderLeft(BorderStyle border)

set the type of border to use for the left border of the cell

void
BorderFormatting.setBorderRight(BorderStyle border)

Set right border.

void
CellStyle.setBorderRight(BorderStyle border)

set the type of border to use for the right border of the cell

void
BorderFormatting.setBorderTop(BorderStyle border)

Set top border.

void
CellStyle.setBorderTop(BorderStyle border)

set the type of border to use for the top border of the cell

Uses of BorderStyle in org.apache.poi.ss.util

Methods in org.apache.poi.ss.util that return BorderStyle

Modifier and Type
Method and Description

BorderStyle
PropertyTemplate.getBorderStyle(CellAddress cell,
              java.lang.String property)

Retrieves the border style for a given cell

BorderStyle
PropertyTemplate.getBorderStyle(int row,
              int col,
              java.lang.String property)

Retrieves the border style for a given cell

Methods in org.apache.poi.ss.util with parameters of type BorderStyle

Modifier and Type
Method and Description

void
PropertyTemplate.drawBorders(CellRangeAddress range,
           BorderStyle borderType,
           BorderExtent extent)

Draws a group of cell borders for a cell range.

void
PropertyTemplate.drawBorders(CellRangeAddress range,
           BorderStyle borderType,
           short color,
           BorderExtent extent)

Draws a group of cell borders for a cell range.

static void
RegionUtil.setBorderBottom(BorderStyle border,
               CellRangeAddress region,
               Sheet sheet)

Sets the bottom border style for a region of cells by manipulating the cell style of the individual
 cells on the bottom

static void
RegionUtil.setBorderLeft(BorderStyle border,
             CellRangeAddress region,
             Sheet sheet)

Sets the left border style for a region of cells by manipulating the cell style of the individual
 cells on the left

static void
RegionUtil.setBorderRight(BorderStyle border,
              CellRangeAddress region,
              Sheet sheet)

Sets the right border style for a region of cells by manipulating the cell style of the individual
 cells on the right

static void
RegionUtil.setBorderTop(BorderStyle border,
            CellRangeAddress region,
            Sheet sheet)

Sets the top border style for a region of cells by manipulating the cell style of the individual
 cells on the top

Uses of BorderStyle in org.apache.poi.xssf.usermodel

Methods in org.apache.poi.xssf.usermodel that return BorderStyle

Modifier and Type
Method and Description

BorderStyle
XSSFCellStyle.getBorderBottomEnum()

Get the type of border to use for the bottom border of the cell
 Will be removed when XSSFCellStyle.getBorderBottom() returns a BorderStyle enum

BorderStyle
XSSFBorderFormatting.getBorderBottomEnum()

BorderStyle
XSSFBorderFormatting.getBorderDiagonalEnum()

BorderStyle
XSSFCellStyle.getBorderLeftEnum()

Get the type of border to use for the left border of the cell
 Will be removed when XSSFCellStyle.getBorderLeft() returns a BorderStyle enum

BorderStyle
XSSFBorderFormatting.getBorderLeftEnum()

BorderStyle
XSSFCellStyle.getBorderRightEnum()

Get the type of border to use for the right border of the cell
 Will be removed when XSSFCellStyle.getBorderRight() returns a BorderStyle enum

BorderStyle
XSSFBorderFormatting.getBorderRightEnum()

BorderStyle
XSSFCellStyle.getBorderTopEnum()

Get the type of border to use for the top border of the cell
 Will be removed when XSSFCellStyle.getBorderTop() returns a BorderStyle enum

BorderStyle
XSSFBorderFormatting.getBorderTopEnum()

Methods in org.apache.poi.xssf.usermodel with parameters of type BorderStyle

Modifier and Type
Method and Description

void
XSSFCellStyle.setBorderBottom(BorderStyle border)

Set the type of border to use for the bottom border of the cell

void
XSSFBorderFormatting.setBorderBottom(BorderStyle border)

void
XSSFBorderFormatting.setBorderDiagonal(BorderStyle border)

void
XSSFCellStyle.setBorderLeft(BorderStyle border)

Set the type of border to use for the left border of the cell

void
XSSFBorderFormatting.setBorderLeft(BorderStyle border)

void
XSSFCellStyle.setBorderRight(BorderStyle border)

Set the type of border to use for the right border of the cell

void
XSSFBorderFormatting.setBorderRight(BorderStyle border)

void
XSSFCellStyle.setBorderTop(BorderStyle border)

Set the type of border to use for the top border of the cell

void
XSSFBorderFormatting.setBorderTop(BorderStyle border)

Uses of BorderStyle in org.apache.poi.xssf.usermodel.extensions

Methods in org.apache.poi.xssf.usermodel.extensions that return BorderStyle

Modifier and Type
Method and Description

BorderStyle
XSSFCellBorder.getBorderStyle(XSSFCellBorder.BorderSide side)

Get the type of border to use for the selected border

Methods in org.apache.poi.xssf.usermodel.extensions with parameters of type BorderStyle

Modifier and Type
Method and Description

void
XSSFCellBorder.setBorderStyle(XSSFCellBorder.BorderSide side,
              BorderStyle style)

Set the type of border to use for the selected border

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

PREV

NEXT

FRAMES

NO FRAMES

All Classes

                Copyright 2016 The Apache Software Foundation or
        its licensors, as applicable.


text:
import Benchmark = require("benchmark");

var suite = new Benchmark.Suite;

// add tests
suite.add('RegExp#test', function() {
  /o/.test('Hello World!');
})
.add('String#indexOf', function() {
  'Hello World!'.indexOf('o') > -1;
})
.add('String#match', function() {
  !!'Hello World!'.match(/o/);
})
// add listeners
.on('cycle', function(event: {target: any}) {
  console.log(String(event.target));
})
.on('complete', function() {
  console.log('Fastest is ' + this.filter('fastest').pluck('name'));
})
// run async
.run({ 'async': true });

var fn: Function;
var onStart: Function;
var onCycle: Function;
var onAbort: Function;
var onError: Function;
var onReset: Function;
var onComplete: Function;
var setup: Function;
var teardown: Function;
var benches: Benchmark[];
var listener: Function;
var count: number;

// basic usage (the `new` operator is optional)
var bench = new Benchmark(fn);

// or using a name first
var bench = new Benchmark('foo', fn);

// or with options
var bench = new Benchmark('foo', fn, {

  // displayed by Benchmark#toString if `name` is not available
  'id': 'xyz',

  // called when the benchmark starts running
  'onStart': onStart,

  // called after each run cycle
  'onCycle': onCycle,

  // called when aborted
  'onAbort': onAbort,

  // called when a test errors
  'onError': onError,

  // called when reset
  'onReset': onReset,

  // called when the benchmark completes running
  'onComplete': onComplete,

  // compiled/called before the test loop
  'setup': setup,

  // compiled/called after the test loop
  'teardown': teardown
});

// or name and options
var bench = new Benchmark('foo', {

  // a flag to indicate the benchmark is deferred
  'defer': true,

  // benchmark test function
  'fn': function(deferred: {resolve(): void}) {
    // call resolve() when the deferred test is finished
    deferred.resolve();
  }
});

// or options only
var bench = new Benchmark({

  // benchmark name
  'name': 'foo',

  // benchmark test as a string
  'fn': '[1,2,3,4].sort()'
});

// a test's `this` binding is set to the benchmark instance
var bench = new Benchmark('foo', function() {
  'My name is '.concat(this.name); // My name is foo
});

// get odd numbers
Benchmark.filter([1, 2, 3, 4, 5], function(n) {
  return n % 2;
}); // -> [1, 3, 5];

// get fastest benchmarks
Benchmark.filter(benches, 'fastest');

// get slowest benchmarks
Benchmark.filter(benches, 'slowest');

// get benchmarks that completed without erroring
Benchmark.filter(benches, 'successful');

// invoke `reset` on all benchmarks
Benchmark.invoke(benches, 'reset');

// invoke `emit` with arguments
Benchmark.invoke(benches, 'emit', 'complete', listener);

// invoke `run(true)`, treat benchmarks as a queue, and register invoke callbacks
Benchmark.invoke(benches, {

  // invoke the `run` method
  'name': 'run',

  // pass a single argument
  'args': true,

  // treat as queue, removing benchmarks from front of `benches` until empty
  'queued': true,

  // called before any benchmarks have been invoked.
  'onStart': onStart,

  // called between invoking benchmarks
  'onCycle': onCycle,

  // called after all benchmarks have been invoked.
  'onComplete': onComplete
});

var element: HTMLElement;
// basic usage
var bench = new Benchmark({
  'setup': function() {
    var c = this.count,
      element = document.getElementById('container');
    while (c--) {
      element.appendChild(document.createElement('div'));
    }
  },
  'fn': function() {
    element.removeChild(element.lastChild);
  }
});

// or using strings
var bench = new Benchmark({
  'setup': '\
    var a = 0;\n\
    (function() {\n\
      (function() {\n\
        (function() {',
  'fn': 'a += 1;',
  'teardown': '\
         }())\n\
       }())\n\
     }())'
});

var bizarro = bench.clone({
  'name': 'doppelganger'
});

// unregister a listener for an event type
bench.off('cycle', listener);

// unregister a listener for multiple event types
bench.off('start cycle', listener);

// unregister all listeners for an event type
bench.off('cycle');

// unregister all listeners for multiple event types
bench.off('start cycle complete');

// unregister all listeners for all event types
bench.off();

// register a listener for an event type
bench.on('cycle', listener);

// register a listener for multiple event types
bench.on('start cycle', listener);

// basic usage
bench.run();

// or with options
bench.run({ 'async': true });

// basic usage
suite.add(fn);

// or using a name first
suite.add('foo', fn);

// or with options
suite.add('foo', fn, {
  'onCycle': onCycle,
  'onComplete': onComplete
});

// or name and options
suite.add('foo', {
  'fn': fn,
  'onCycle': onCycle,
  'onComplete': onComplete
});

// or options only
suite.add({
  'name': 'foo',
  'fn': fn,
  'onCycle': onCycle,
  'onComplete': onComplete
});

// basic usage
suite.run();

// or with options
suite.run({ 'async': true, 'queued': true });