text:
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { NotFoundComponent } from './study/not-found/not-found.component';
import {AvAccessComponent} from './study/av-access/av-access.component';
import {CalibrationComponent} from './study/calibration/calibration.component';
import {InvalidBrowserComponent} from './study/invalid-browser/invalid-browser.component';
import {BriefingComponent} from './study/briefing/briefing.component';
import {StimulusComponent} from './study/stimulus/stimulus.component';
import {AdminLoginComponent} from './admin/admin-login/admin-login.component';
import {InvalidBrowserGuardService} from './study/services/invalid-browser-guard.service';
import {EntryGuardService} from './study/services/entry-guard.service';
import {AdminDashboardComponent} from './admin/admin-dashboard/admin-dashboard.component';
import {StudiesComponent} from './admin/studies/studies.component';
import {SharesComponent} from './admin/shares/shares.component';
import {ActivityLogComponent} from './admin/activity-log/activity-log.component';
import {LoginFailureComponent} from './study/login-failure/login-failure.component';

const routes: Routes = [
  // the empty path will always be redirected via the EntryGuardService
  { path: '', component: InvalidBrowserComponent, canActivate: [EntryGuardService] },
  { path: 'invalid-browser', component: InvalidBrowserComponent, canActivate: [InvalidBrowserGuardService]},
  { path: 'av-access', component: AvAccessComponent },
  { path: 'calibration', component: CalibrationComponent },
  { path: 'briefing', component: BriefingComponent },
  { path: 'stimulus', component: StimulusComponent },
  { path: 'admin/login', component: AdminLoginComponent },
  { path: 'admin', component: AdminDashboardComponent,
    children: [
      //{ path: '', redirectTo: 'studies', pathMatch: 'full' },
      { path: 'studies', component: StudiesComponent },
      { path: 'shares', component: SharesComponent },
      { path: 'activity', component: ActivityLogComponent }
    ]
  },
  { path: 'login-failed', component: LoginFailureComponent },
  { path: 'notfound', component: NotFoundComponent },
  { path: '**', redirectTo: '/notfound' },
];

@NgModule({
  imports: [ RouterModule.forRoot(routes, { enableTracing: false }) ],
  exports: [ RouterModule ]
})

export class RoutingModule {}


text:
NO_OF_BANANA=3
# Master banana = 1

# Define some important filenames
INPUT_FILE=000_raw_data/20140612_142959t2tsevflisos006a1001.nii.gz
PHANTOM_FILE=001_phantom_master/phantom.nii.gz
PHANTOM_MASK=001_phantom_master/phantom_mask.nii.gz
PHANTOM_MASKED=001_phantom_master/phantom_masked.nii.gz
SEGMENTATION_FILE=000_raw_data/raw_segmentation.nii.gz
FILE_REFERENCE_MASK=001_phantom_master/phantom_masked.nii.gz
MASK_FILE=001_phantom_master/mask.nii.gz

# Indexing in arrays -> [NO_OF_BANANA - 1]

# Variables used to select ROIs of corresponding bananas
ROIS=()
ROIS[1]="70x40x0vox 130x120x200vox"
ROIS[2]="31x49x0vox 130x120x200vox"
ROIS[3]="80x40x0vox 130x120x210vox"
ROIS[4]="120x10x0vox 130x120x200vox"

# Setup some basic information about the processed volume
IDX_FIRST_SLICE=0
IDX_LAST_SLICE=199
RESLICE_BACKGROUND=0
SLICING_PLANE_INDEX=1

# Define short and long output volume settings:
OV_PERMUTATION='0 2 1'
OV_ORIENTATION_CODE='RAS'
OV_TYPE='uchar'
OV_ORIGIN='0 0 0'
OV_SPACING='1 1 1'
OV_FLIP='0 0 0'

OV_SETTINGS_SHORT="--permutation ${OV_PERMUTATION} --flipAxes ${OV_FLIP} --setSpacing ${OV_SPACING}  --setOrigin ${OV_ORIGIN} --setType ${OV_TYPE} --orientationCode ${OV_ORIENTATION_CODE}"
OV_SETTINGS=" --outputVolumeSpacing ${OV_SPACING} --outputVolumeOrigin ${OV_ORIGIN} --outputVolumeOrientationCode ${OV_ORIENTATION_CODE}  --outputVolumePermutationOrder ${OV_PERMUTATION} --outputVolumeScalarType ${OV_TYPE} --setFlip ${OV_FLIP}"

redpajama_set_name: RedPajamaGithub


text:
Indicator Blob upload accepts a CSV formatted input.

	It must have the following column names to be processed properly:

        Indicator, Type, Threat Type, Attack Type, Description, Campaign, Campaign Confidence, Confidence, Impact, Bucket List, Ticket, Action, Status

        Separate multiple Tickets, Actions, and/or Bucket List values with commas, and

        surround with quotes (e.g. "value1,value2,value3").

    <form id="form-{{ request.GET.dialog }}"
	  action='{% url "crits.indicators.views.upload_indicator" %}'
	  method='POST' enctype="multipart/form-data"
	  item-type="indicator" input_clear_filter="[type!='hidden'][id!='id_data']">

{{ upload_text.as_table }}

    <input type="hidden" name="svalue" value="Upload Text">
    </form>


text:
package com.thebluealliance.androidclient.helpers;

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

import androidx.test.ext.junit.runners.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

@RunWith(AndroidJUnit4.class)
public class DistrictHelperTest {

    @Test
    public void testValidateDistrictKey() {
        String[] validKeys = new String[]{"2015ne", "2016in", "2014mar"};
        String[] invliadKeys = new String[]{"f", "meowne"};

        for (String key : validKeys) {
            assertTrue(DistrictHelper.validateDistrictKey(key));
        }

        for (String key : invliadKeys) {
            assertFalse(DistrictHelper.validateDistrictKey(key));
        }
    }

    @Test
    public void testExtractYearFromKey() {
        String key = "2015ne";
        int year = DistrictHelper.extractYearFromKey(key);
        assertEquals(year, 2015);
    }

    @Test
    public void testExtractAbbrevFromKey() {
        String key = "2015ne";
        String abbrev = DistrictHelper.extractAbbrevFromKey(key);
        assertEquals(abbrev, "ne");
    }

    @Test
    public void testGenerateKey() {
        String abbrev = "ne";
        int year = 2015;
        String key = DistrictHelper.generateKey(abbrev, year);
        assertEquals(key, "2015ne");
    }
}


text:
<?php

declare(strict_types=1);

namespace Billogram\Model\Invoice;

use Billogram\Model\CreatableFromArray;

/**
 * @author Ibrahim Hizeoui <ibrahimhizeoui@gmail.com>
 */
class RegionalInformation implements CreatableFromArray
{
    /**
     * @var int
     */
    private $rotavdrag = 0;

    /**
     * @var string
     */
    private $rotavdragPersonalNumber;

    /**
     * @var string
     */
    private $rotavdragDescription;

    /**
     * @var bool
     */
    private $reversedVat = false;

    /**
     * @var string
     */
    private $autogiroBetalarnummer;

    /**
     * @var string
     */
    private $autogiroPaymentDate;

    /**
     * @var string
     */
    private $autogiroStatus;

    /**
     * @var string
     */
    private $autogiroFullStatus;

    /**
     * @var string
     */
    private $autogiroTotalSum;

    /**
     * @var string
     */
    private $efakturaRecipientIdentifier;

    /**
     * @var string
     */
    private $efakturaRecipientType;

    /**
     * @var string
     */
    private $efakturaRecipientBankName;

    /**
     * @var int
     */
    private $efakturaRecipientBankId;

    /**
     * @var string
     */
    private $efakturaRecipientBankCode;

    /**
     * @var int
     */
    private $efakturaRecipientIdNumber;

    /**
     * @var int
     */
    private $efakturaRequestedAmount;

    /**
     * @var CollectionForElectricityInvoices
     */
    private $collectionForElectricityInvoices;

    /**
     * @return int
     */
    public function getRotavdrag(): int
    {
        return $this->rotavdrag;
    }

    /**
     * @param int $rotavdrag
     *
     * @return RegionalInformation
     */
    public function withRotavdrag(int $rotavdrag)
    {
        $new = clone $this;
        $new->rotavdrag = $rotavdrag;

        return $new;
    }

    /**
     * @return string
     */
    public function getRotavdragPersonalNumber(): string
    {
        return $this->rotavdragPersonalNumber;
    }

    /**
     * @param string $rotavdragPersonalNumber
     *
     * @return RegionalInformation
     */
    public function withRotavdragPersonalNumber(string $rotavdragPersonalNumber)
    {
        $new = clone $this;
        $new->rotavdragPersonalNumber = $rotavdragPersonalNumber;

        return $new;
    }

    /**
     * @return string
     */
    public function getRotavdragDescription(): string
    {
        return $this->rotavdragDescription;
    }

    /**
     * @param string $rotavdragDescription
     *
     * @return RegionalInformation
     */
    public function withRotavdragDescription(string $rotavdragDescription)
    {
        $new = clone $this;
        $new->rotavdragDescription = $rotavdragDescription;

        return $new;
    }

    /**
     * @return bool
     */
    public function isReversedVat(): bool
    {
        return $this->reversedVat;
    }

    /**
     * @param bool $reversedVat
     *
     * @return RegionalInformation
     */
    public function withReversedVat(bool $reversedVat)
    {
        $new = clone $this;
        $new->reversedVat = $reversedVat;

        return $new;
    }

    /**
     * @return string
     */
    public function getAutogiroBetalarnummer(): string
    {
        return $this->autogiroBetalarnummer;
    }

    /**
     * @param string $autogiroBetalarnummer
     *
     * @return RegionalInformation
     */
    public function withAutogiroBetalarnummer(string $autogiroBetalarnummer)
    {
        $new = clone $this;
        $new->autogiroBetalarnummer = $autogiroBetalarnummer;

        return $new;
    }

    /**
     * @return string
     */
    public function getAutogiroPaymentDate(): string
    {
        return $this->autogiroPaymentDate;
    }

    /**
     * @param string $autogiroPaymentDate
     *
     * @return RegionalInformation
     */
    public function withAutogiroPaymentDate(string $autogiroPaymentDate)
    {
        $new = clone $this;
        $new->autogiroPaymentDate = $autogiroPaymentDate;

        return $new;
    }

    /**
     * @return string
     */
    public function getAutogiroStatus(): string
    {
        return $this->autogiroStatus;
    }

    /**
     * @param string $autogiroStatus
     *
     * @return RegionalInformation
     */
    public function withAutogiroStatus(string $autogiroStatus)
    {
        $new = clone $this;
        $new->autogiroStatus = $autogiroStatus;

        return $new;
    }

    /**
     * @return string
     */
    public function getAutogiroFullStatus(): string
    {
        return $this->autogiroFullStatus;
    }

    /**
     * @param string $autogiroFullStatus
     *
     * @return RegionalInformation
     */
    public function withAutogiroFullStatus(string $autogiroFullStatus)
    {
        $new = clone $this;
        $new->autogiroFullStatus = $autogiroFullStatus;

        return $new;
    }

    /**
     * @return string
     */
    public function getAutogiroTotalSum(): string
    {
        return $this->autogiroTotalSum;
    }

    /**
     * @param string $autogiroTotalSum
     *
     * @return RegionalInformation
     */
    public function withAutogiroTotalSum(string $autogiroTotalSum)
    {
        $new = clone $this;
        $new->autogiroTotalSum = $autogiroTotalSum;

        return $new;
    }

    /**
     * @return string
     */
    public function getEfakturaRecipientIdentifier(): string
    {
        return $this->efakturaRecipientIdentifier;
    }

    /**
     * @param string $efakturaRecipientIdentifier
     *
     * @return RegionalInformation
     */
    public function withEfakturaRecipientIdentifier(string $efakturaRecipientIdentifier)
    {
        $new = clone $this;
        $new->efakturaRecipientIdentifier = $efakturaRecipientIdentifier;

        return $new;
    }

    /**
     * @return string
     */
    public function getEfakturaRecipientType(): string
    {
        return $this->efakturaRecipientType;
    }

    /**
     * @param string $efakturaRecipientType
     *
     * @return RegionalInformation
     */
    public function withEfakturaRecipientType(string $efakturaRecipientType)
    {
        $new = clone $this;
        $new->efakturaRecipientType = $efakturaRecipientType;

        return $new;
    }

    /**
     * @return string
     */
    public function getEfakturaRecipientBankName(): string
    {
        return $this->efakturaRecipientBankName;
    }

    /**
     * @param string $efakturaRecipientBankName
     *
     * @return RegionalInformation
     */
    public function withEfakturaRecipientBankName(string $efakturaRecipientBankName)
    {
        $new = clone $this;
        $new->efakturaRecipientBankName = $efakturaRecipientBankName;

        return $new;
    }

    /**
     * @return int
     */
    public function getEfakturaRecipientBankId(): int
    {
        return $this->efakturaRecipientBankId;
    }

    /**
     * @param int $efakturaRecipientBankId
     *
     * @return RegionalInformation
     */
    public function withEfakturaRecipientBankId(int $efakturaRecipientBankId)
    {
        $new = clone $this;
        $new->efakturaRecipientBankId = $efakturaRecipientBankId;

        return $new;
    }

    /**
     * @return string
     */
    public function getEfakturaRecipientBankCode(): string
    {
        return $this->efakturaRecipientBankCode;
    }

    /**
     * @param string $efakturaRecipientBankCode
     *
     * @return RegionalInformation
     */
    public function withEfakturaRecipientBankCode(string $efakturaRecipientBankCode)
    {
        $new = clone $this;
        $new->efakturaRecipientBankCode = $efakturaRecipientBankCode;

        return $new;
    }

    /**
     * @return int
     */
    public function getEfakturaRecipientIdNumber(): int
    {
        return $this->efakturaRecipientIdNumber;
    }

    /**
     * @param int $efakturaRecipientIdNumber
     *
     * @return RegionalInformation
     */
    public function withEfakturaRecipientIdNumber(int $efakturaRecipientIdNumber)
    {
        $new = clone $this;
        $new->efakturaRecipientIdNumber = $efakturaRecipientIdNumber;

        return $new;
    }

    /**
     * @return int
     */
    public function getEfakturaRequestedAmount(): int
    {
        return $this->efakturaRequestedAmount;
    }

    /**
     * @param int $efakturaRequestedAmount
     *
     * @return RegionalInformation
     */
    public function withEfakturaRequestedAmount(int $efakturaRequestedAmount)
    {
        $new = clone $this;
        $new->efakturaRequestedAmount = $efakturaRequestedAmount;

        return $new;
    }

    /**
     * @return CollectionForElectricityInvoices
     */
    public function getCollectionForElectricityInvoices(): CollectionForElectricityInvoices
    {
        return $this->collectionForElectricityInvoices;
    }

    /**
     * @param CollectionForElectricityInvoices $collectionForElectricityInvoices
     *
     * @return RegionalInformation
     */
    public function withCollectionForElectricityInvoices(CollectionForElectricityInvoices $collectionForElectricityInvoices)
    {
        $new = clone $this;
        $new->collectionForElectricityInvoices = $collectionForElectricityInvoices;

        return $new;
    }

    public function toArray()
    {
        $data = [];
        if ($this->rotavdrag !== null) {
            $data['rotavdrag'] = $this->rotavdrag;
        }
        if ($this->rotavdragPersonalNumber !== null) {
            $data['rotavdrag_personal_number'] = $this->rotavdragPersonalNumber ?? null;
        }
        if ($this->rotavdragDescription !== null) {
            $data['rotavdrag_description'] = $this->rotavdragDescription ?? null;
        }
        if ($this->reversedVat !== null) {
            $data['reversed_vat'] = $this->reversedVat ?? null;
        }
        if ($this->autogiroBetalarnummer !== null) {
            $data['autogiro_betalarnummer'] = $this->autogiroBetalarnummer;
        }
        if ($this->autogiroPaymentDate !== null) {
            $data['autogiro_payment_date'] = $this->autogiroPaymentDate;
        }
        if ($this->autogiroStatus !== null) {
            $data['autogiro_status'] = $this->autogiroStatus;
        }
        if ($this->autogiroFullStatus !== null) {
            $data['autogiro_full_status'] = $this->autogiroFullStatus;
        }
        if ($this->autogiroTotalSum !== null) {
            $data['autogiro_total_sum'] = $this->autogiroTotalSum;
        }
        if ($this->efakturaRecipientIdentifier !== null) {
            $data['efaktura_recipient_identifier'] = $this->efakturaRecipientIdentifier;
        }
        if ($this->efakturaRecipientType !== null) {
            $data['efaktura_recipient_type'] = $this->efakturaRecipientType;
        }
        if ($this->efakturaRecipientBankName !== null) {
            $data['efaktura_recipient_bank_name'] = $this->efakturaRecipientBankName;
        }
        if ($this->efakturaRecipientBankId !== null) {
            $data['efaktura_recipient_bank_id'] = $this->efakturaRecipientBankId;
        }
        if ($this->efakturaRecipientBankCode !== null) {
            $data['efaktura_recipient_bank_code'] = $this->efakturaRecipientBankCode;
        }
        //
        if ($this->efakturaRecipientIdNumber !== null) {
            $data['efaktura_recipient_id_number'] = $this->efakturaRecipientIdNumber;
        }
        if ($this->efakturaRequestedAmount !== null) {
            $data['efaktura_requested_amount'] = $this->efakturaRequestedAmount;
        }
        if ($this->collectionForElectricityInvoices !== null) {
            $data['efaktura_recipient_bank_code'] = $this->collectionForElectricityInvoices->toArray();
        }

        return $data;
    }

    /**
     * Create an API response object from the HTTP response from the API server.
     *
     * @param array $data
     *
     * @return self
     */
    public static function createFromArray(array $data)
    {
        $regionalInfo = new self();
        $regionalInfo->rotavdrag = $data['rotavdrag'] ?? null;
        $regionalInfo->rotavdragPersonalNumber = $data['rotavdrag_personal_number'] ?? null;
        $regionalInfo->rotavdragDescription = $data['rotavdrag_description'] ?? null;
        $regionalInfo->reversedVat = $data['reversed_vat'] ?? null;
        $regionalInfo->autogiroBetalarnummer = $data['autogiro_betalarnummer'] ?? null;
        $regionalInfo->autogiroPaymentDate = $data['autogiro_payment_date'] ?? null;
        $regionalInfo->autogiroStatus = $data['autogiro_status'] ?? null;
        $regionalInfo->autogiroFullStatus = $data['autogiro_full_status'] ?? null;
        $regionalInfo->autogiroTotalSum = $data['autogiro_total_sum'] ?? null;
        $regionalInfo->efakturaRecipientType = $data['efaktura_recipient_type'] ?? null;
        $regionalInfo->efakturaRecipientIdentifier = $data['efaktura_recipient_identifier'] ?? null;
        $regionalInfo->efakturaRecipientBankName = $data['efaktura_recipient_bank_name'] ?? null;
        $regionalInfo->efakturaRecipientBankId = $data['efaktura_recipient_bank_id'] ?? null;
        $regionalInfo->efakturaRecipientBankCode = $data['efaktura_recipient_bank_code'] ?? null;
        $regionalInfo->rotavdragPersonalNumber = $data['efaktura_recipient_id_number'] ?? null;
        $regionalInfo->efakturaRequestedAmount = $data['efaktura_requested_amount'] ?? null;
        $regionalInfo->collectionForElectricityInvoices = CollectionForElectricityInvoices::createFromArray($data['electricity_collection']);

        return $regionalInfo;
    }
}


text:
package org.elasticsearch.common.io.streams;

import org.apache.lucene.util.Constants;
import org.elasticsearch.common.io.stream.BytesStreamInput;
import org.elasticsearch.common.io.stream.BytesStreamOutput;
import org.elasticsearch.test.ElasticsearchTestCase;
import org.junit.Test;

import static org.hamcrest.Matchers.closeTo;
import static org.hamcrest.Matchers.equalTo;

/**
 *
 */
public class BytesStreamsTests extends ElasticsearchTestCase {

    @Test
    public void testSimpleStreams() throws Exception {
        assumeTrue(Constants.JRE_IS_64BIT);
        BytesStreamOutput out = new BytesStreamOutput();
        out.writeBoolean(false);
        out.writeByte((byte) 1);
        out.writeShort((short) -1);
        out.writeInt(-1);
        out.writeVInt(2);
        out.writeLong(-3);
        out.writeVLong(4);
        out.writeFloat(1.1f);
        out.writeDouble(2.2);
        int[] intArray = {1, 2, 3};
        out.writeGenericValue(intArray);
        long[] longArray = {1, 2, 3};
        out.writeGenericValue(longArray);
        float[] floatArray = {1.1f, 2.2f, 3.3f};
        out.writeGenericValue(floatArray);
        double[] doubleArray = {1.1, 2.2, 3.3};
        out.writeGenericValue(doubleArray);
        out.writeString("hello");
        out.writeString("goodbye");
        BytesStreamInput in = new BytesStreamInput(out.bytes().toBytes(), false);
        assertThat(in.readBoolean(), equalTo(false));
        assertThat(in.readByte(), equalTo((byte) 1));
        assertThat(in.readShort(), equalTo((short) -1));
        assertThat(in.readInt(), equalTo(-1));
        assertThat(in.readVInt(), equalTo(2));
        assertThat(in.readLong(), equalTo((long) -3));
        assertThat(in.readVLong(), equalTo((long) 4));
        assertThat((double) in.readFloat(), closeTo(1.1, 0.0001));
        assertThat(in.readDouble(), closeTo(2.2, 0.0001));
        assertThat(in.readGenericValue(), equalTo((Object)intArray));
        assertThat(in.readGenericValue(), equalTo((Object)longArray));
        assertThat(in.readGenericValue(), equalTo((Object)floatArray));
        assertThat(in.readGenericValue(), equalTo((Object)doubleArray));
        assertThat(in.readString(), equalTo("hello"));
        assertThat(in.readString(), equalTo("goodbye"));
    }

    @Test
    public void testGrowLogic() throws Exception {
        assumeTrue(Constants.JRE_IS_64BIT);
        BytesStreamOutput out = new BytesStreamOutput();
        out.writeBytes(new byte[BytesStreamOutput.DEFAULT_SIZE - 5]);
        assertThat(out.bufferSize(), equalTo(2048)); // remains the default
        out.writeBytes(new byte[1 * 1024]);
        assertThat(out.bufferSize(), equalTo(4608));
        out.writeBytes(new byte[32 * 1024]);
        assertThat(out.bufferSize(), equalTo(40320));
        out.writeBytes(new byte[32 * 1024]);
        assertThat(out.bufferSize(), equalTo(90720));
    }
}


text:
layout: post
category : lessons
tagline: "How to test your Jekyll site locally"
tags : [intro, beginner, jekyll, tutorial]
img : helium-theme-post.jpg
img-mobile :
img2 :
img3 :
author : Antonio Trento
title2 :
title3 :
css:
js:
bgcolor: ff5a71
keywords: helium, html, css, landing page, jekyll, ruby, web marketing, advertising
canonical: https://heliumjk.github.io
---
{% include JB/setup %}

In this tutorial I will teach you *how to test your Jekyll Bootstrap3* site locally.

Jekyll is a parsing engine bundled as a ruby gem used to build static websites from
dynamic components such as templates, partials, liquid code, markdown, etc. Jekyll is known as "a simple, blog aware, static site generator".

To test your site locally, you'll need

1. [ruby](https://www.ruby-lang.org/en/)
2. [Jekyll](https://http://jekyllrb.com/)
3. [github-pages](https://github.com/github/pages-gem) gem

### Installing ruby

There are
[lots of different ways to install ruby](https://www.ruby-lang.org/en/installation/).

In Mac OS X, older versions of ruby will already be installed.  But I
use the [Ruby Version Manager (RVM)](http://rvm.io/) to have a more
recent version.  You could also use [Homebrew](http://brew.sh/).

In Windows, use [RubyInstaller](http://rubyinstaller.org/). (In most
of this tutorial, I've assumed you're using a Mac or some flavor of
Unix. It's possible that none of this was usable for Windows
folks. Sorry!)

### Installing the github-pages gem

Run the following command:
``` HTML
    gem install github-pages

```
This will install the `github-pages` gem and all dependencies
(including [jekyll](http://jekyllrb.com/)).

Later, to update the gem, type:
``` HTML
    gem update github-pages

```
### Testing your site locally

To construct and test your site locally, go into the directory and
type
``` HTML
    jekyll build

```
This will create (or modify) a `_site/` directory, containing
everything from `assets/`, and then the `index.md` and all
`pages/*.md` files, converted to html. (So there'll be
`_site/index.html` and the various `_site/pages/*.html`.)

Type the following in order to “serve” the site.
This will first run `build`, and so it does _not_ need to be
preceded by `jekyll build`.
``` HTML
    jekyll serve

```
To make jekyll automatically re-build your changes you can also add the `--watch` option:
``` HTML
    jekyll serve --watch

```
Now open your browser and go to <http://localhost:4000>.

Read the complete tutorial on <http://jekyllrb.com/docs/usage/>.

## Testing images

![Lost in space]({{ BASE_PATH }}/assets/img/big/lost_in_404_space.jpg){: .image-fluid }

***
#### #Code
``` HTML

	![Lost in space]({{ BASE_PATH }}/assets/img/big/lost_in_404_space.jpg){: .image-fluid }

```

### IMG With description on hover

![Lost in space with description]({{ BASE_PATH }}/assets/img/big/universe1.jpg "Description of lost in space image"){: .image-fluid }

***
#### #Code
``` HTML

	![Lost in space with description]({{ BASE_PATH }}/assets/img/big/universe1.jpg "Description of lost in space image"){: .image-fluid }

```

### With floating in markdown

| In markdown you can quikly use tables to align your images in right way, remember to style as you like the CSS of your table to have a amazing results. Use to size your pics in right way for best results. | ![Lost in space with description]({{ BASE_PATH }}/assets/img/big/universe2.jpg "Description of lost in space image"){: .image-fluid } |

***
#### #Code
``` HTML

	| In markdown you can quikly use tables to align your images in right way, remember to style as you like the CSS of your table to have a amazing results. Use to size your pics in right way for best results. | ![Lost in space with description]({{ BASE_PATH }}/assets/img/big/universe2.jpg "Description of lost in space image"){: .image-fluid } |

```

| ![Lost in space with description]({{ BASE_PATH }}/assets/img/big/universe3.jpg "Description of lost in space image"){: .image-fluid } | I am text to the right I am text to the right I am text to the right I am text to the right |

***
#### #Code
``` HTML

	| ![Lost in space with description]({{ BASE_PATH }}/assets/img/big/universe3.jpg "Description of lost in space image"){: .image-fluid } | I am text to the right I am text to the right I am text to the right I am text to the right |

```

### Video embed sample

***
#### #Code
``` HTML
	<div class="video-container">
	<iframe width="560" height="315" src="https://www.youtube.com/embed/ikbYpAHkurs?ecver=1" frameborder="0" allowfullscreen></iframe>
	</div>

```

## License

[MIT](http://opensource.org/licenses/MIT)


text:
/*
  THIS IS THE CEREBRAL-REACT-IMMUTABLE-STORE CONTROLLER IMPLEMENTATION
*/
var cerebral = require('cerebral');
var React = require('react');
var Store = require('immutable-store');
var EventEmitter = require('events').EventEmitter;

var Value = cerebral.Value;

var Factory = function (state, defaultArgs) {

  var eventEmitter = new EventEmitter();
  var initialState = Store(state);

  state = initialState;

  var controller = cerebral.Controller({
    defaultArgs: defaultArgs,
    onReset: function () {
      state = initialState;
    },
    onGetRecordingState: function () {
      return state.export();
    },
    onSeek: function (seek, isPlaying, currentRecording) {
      state = state.import(currentRecording.initialState);
      eventEmitter.emit('change', state);
    },
    onUpdate: function () {
      eventEmitter.emit('change', state);
    },
    onRemember: function () {
      eventEmitter.emit('remember', state);
    },
    onGet: function (path) {
      return Value(path, state);
    },
    onSet: function (path, value) {
      var key = path.pop();
      state = Value(path, state).set(key, value);
    },
    onUnset: function (path, key) {
      state = Value(path, state).unset(key);
    },
    onPush: function (path, value) {
      state = Value(path, state).push(value);
    },
    onSplice: function () {
      var args = [].slice.call(arguments);
      var value = Value(args.shift(), state);
      state = value.splice.apply(value, args);
    },
    onMerge: function (path, value) {
      state = Value(path, state).merge(value);
    },
    onConcat: function () {
      var args = [].slice.call(arguments);
      var value = Value(args.shift(), state);
      state = value.concat.apply(value, args);
    },
    onPop: function (path) {
      state = Value(path, state).pop();
    },
    onShift: function (path) {
      state = Value(path, state).shift();
    },
    onUnshift: function (path, value) {
      state = Value(path, state).unshift(value);
    }
  });

  controller.injectInto = function (AppComponent) {
    return React.createElement(React.createClass({
      displayName: 'CerebralContainer',
      childContextTypes: {
        controller: React.PropTypes.object.isRequired
      },
      getChildContext: function () {
        return {
          controller: controller
        }
      },
      render: function () {
        return React.createElement(AppComponent);
      }
    }));
  };

  controller.eventEmitter = eventEmitter;

  return controller;

};

Factory.Mixin = {
  contextTypes: {
    controller: React.PropTypes.object
  },
  componentWillMount: function () {
    this.signals = this.context.controller.signals;
    this.recorder = this.context.controller.recorder;
    this.get = this.context.controller.get;
    this.context.controller.eventEmitter.on('change', this._update);
    this.context.controller.eventEmitter.on('remember', this._update);
    this._update(this.context.controller.get([]));
  },
  componentWillUnmount: function () {
    this._isUmounting = true;
    this.context.controller.eventEmitter.removeListener('change', this._update);
    this.context.controller.eventEmitter.removeListener('remember', this._update);
  },
  shouldComponentUpdate: function (nextProps, nextState) {
    var propKeys = Object.keys(nextProps);
    var stateKeys = Object.keys(nextState);

    // props
    for (var x = 0; x < propKeys.length; x++) {
      var key = propKeys[x];
      if (this.props[key] !== nextProps[key]) {
        return true;
      }
    }

    // State
    for (var x = 0; x < stateKeys.length; x++) {
      var key = stateKeys[x];
      if (this.state[key] !== nextState[key]) {
        return true;
      }
    }

    return false;
  },
  _update: function (state) {
    if (this._isUmounting || !this.getStatePaths) {
      return;
    }
    var statePaths = this.getStatePaths();
    var newState = Object.keys(statePaths).reduce(function (newState, key) {
      newState[key] = Value(statePaths[key], state);
      return newState;
    }, {});
    this.setState(newState);
  }
};

var Render = function (Component) {
  return function () {
    var state = this.state || {};
    var props = this.props || {};

    var propsToPass = Object.keys(state).reduce(function (props, key) {
      props[key] = state[key];
      return props;
    }, {});

    propsToPass = Object.keys(props).reduce(function (propsToPass, key) {
      propsToPass[key] = props[key];
      return propsToPass;
    }, propsToPass);

    propsToPass.signals = this.signals;
    propsToPass.recorder = this.recorder;
    propsToPass.get = this.get;

    return React.createElement(Component, propsToPass);
  };
};

Factory.Decorator = function (paths) {
  return function (Component) {
    return React.createClass({
      displayName: Component.name + 'Container',
      mixins: [Factory.Mixin],
      getStatePaths: function () {
        return paths || {};
      },
      render: Render(Component)
    });
  };
};

Factory.HOC = function (Component, paths) {
  return React.createClass({
    displayName: Component.name + 'Container',
    mixins: [Factory.Mixin],
    getStatePaths: function () {
      return paths || {};
    },
    render: Render(Component)
  });
};

module.exports = Factory;


text:
from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
import copy
import logging
import lxml.etree
import lxml.builder
from indra.statements import *
from indra.assemblers.pysb.assembler import PysbPreassembler

logger = logging.getLogger(__name__)

sbgn_ns = 'http://sbgn.org/libsbgn/0.2'
emaker = lxml.builder.ElementMaker(nsmap={None: sbgn_ns})

class SBGNAssembler(object):
    """This class assembles an SBGN model from a set of INDRA Statements.

    The Systems Biology Graphical Notation (SBGN) is a widely used
    graphical notation standard for systems biology models.
    This assembler creates SBGN models following the Process Desctiption (PD)
    standard, documented at:
    https://github.com/sbgn/process-descriptions/blob/master/UserManual/sbgn_PD-level1-user-public.pdf.
    For more information on SBGN, see: http://sbgn.github.io/sbgn/

    Parameters
    ----------
    stmts : Optional[list[indra.statements.Statement]]
        A list of INDRA Statements to be assembled.

    Attributes
    ----------
    statements : list[indra.statements.Statement]
        A list of INDRA Statements to be assembled.
    sbgn : lxml.etree.ElementTree
        The structure of the SBGN model that is assembled, represented as an
        XML ElementTree.
    """

    process_style = {'x': '0', 'y': '0', 'w': '10', 'h': '10'}
    source_sink_style = {'x': '0', 'y': '0', 'w': '10', 'h': '10'}
    monomer_style = {'x': '0', 'y': '0', 'w': '60', 'h': '30'}
    complex_style = {'x': '1', 'y': '1', 'w': '60', 'h': '65'}
    entity_type_style = {'x': '0', 'y': '0', 'w': '30', 'h': '12'}
    entity_state_style = {'x': '1', 'y': '1', 'w': '28', 'h': '12'}

    def __init__(self, statements=None):
        if not statements:
            self.statements = []
        else:
            self.statements = statements
        self.sbgn = emaker.sbgn()
        self._map = emaker.map(language='process description')
        self.sbgn.append(self._map)
        self._id_counter = 0
        self._agent_ids = {}

    def add_statements(self, stmts):
        """Add INDRA Statements to the assembler's list of statements.

        Parameters
        ----------
        stmts : list[indra.statements.Statement]
            A list of :py:class:`indra.statements.Statement`
            to be added to the statement list of the assembler.
        """
        for stmt in stmts:
            if not self.statement_exists(stmt):
                self.statements.append(stmt)

    def make_model(self):
        """Assemble the SBGN model from the collected INDRA Statements.

        This method assembles an SBGN model from the set of INDRA Statements.
        The assembled model is set as the assembler's sbgn attribute (it is
        represented as an XML ElementTree internally). The model is returned
        as a serialized XML string.

        Returns
        -------
        sbgn_str : str
            The XML serialized SBGN model.
        """
        ppa = PysbPreassembler(self.statements)
        ppa.replace_activities()
        self.statements = ppa.statements
        self.sbgn = emaker.sbgn()
        self._map = emaker.map()
        self.sbgn.append(self._map)
        for stmt in self.statements:
            if isinstance(stmt, Modification):
                self._assemble_modification(stmt)
            elif isinstance(stmt, RegulateActivity):
                self._assemble_regulateactivity(stmt)
            elif isinstance(stmt, RegulateAmount):
                self._assemble_regulateamount(stmt)
            elif isinstance(stmt, Complex):
                self._assemble_complex(stmt)
            elif isinstance(stmt, ActiveForm):
                #self._assemble_activeform(stmt)
                pass
            else:
                logger.warning("Unhandled Statement type %s" % type(stmt))
                continue
        sbgn_str = self.print_model()
        return sbgn_str

    def print_model(self, pretty=True, encoding='utf8'):
        """Return the assembled SBGN model as an XML string.

        Parameters
        ----------
        pretty : Optional[bool]
            If True, the SBGN string is formatted with indentation (for human
            viewing) otherwise no indentation is used. Default: True

        Returns
        -------
        sbgn_str : bytes (str in Python 2)
            An XML string representation of the SBGN model.
        """
        return lxml.etree.tostring(self.sbgn, pretty_print=pretty,
                                   encoding=encoding, xml_declaration=True)

    def save_model(self, file_name='model.sbgn'):
        """Save the assembled SBGN model in a file.

        Parameters
        ----------
        file_name : Optional[str]
            The name of the file to save the SBGN network to.
            Default: model.sbgn
        """
        model = self.print_model()
        with open(file_name, 'wb') as fh:
            fh.write(model)

    def _assemble_modification(self, stmt):
        if not stmt.enz:
            return
        # Make glyph for enz
        enz_glyph = self._agent_glyph(stmt.enz)
        mc_changed = stmt._get_mod_condition()
        mc_unchanged = stmt._get_mod_condition()
        mc_unchanged.is_modified = not mc_unchanged.is_modified
        # Make glyphs for sub
        sub_changed = copy.deepcopy(stmt.sub)
        sub_changed.mods.append(mc_changed)
        sub_unchanged = copy.deepcopy(stmt.sub)
        sub_unchanged.mods.append(mc_unchanged)
        sub_in, sub_out = \
            (sub_unchanged, sub_changed) if isinstance(stmt, AddModification) else \
            (sub_changed, sub_unchanged)
        sub_in_glyph = self._agent_glyph(sub_in)
        sub_out_glyph = self._agent_glyph(sub_out)
        # Make the process glyph
        process_glyph = self._process_glyph('process')
        # Add the arcs
        self._arc('consumption', sub_in_glyph, process_glyph)
        self._arc('production', process_glyph, sub_out_glyph)
        self._arc('catalysis', enz_glyph, process_glyph)

    def _assemble_regulateactivity(self, stmt):
        # Make glyph for subj
        subj_glyph = self._agent_glyph(stmt.subj)
        # Make glyphs for obj
        obj_act = copy.deepcopy(stmt.obj)
        obj_inact = copy.deepcopy(stmt.obj)
        obj_act.activity = ActivityCondition(stmt.obj_activity, True)
        obj_inact.activity = ActivityCondition(stmt.obj_activity, False)
        obj_in, obj_out = (obj_inact, obj_act) if stmt.is_activation else \
                          (obj_act, obj_inact)
        obj_in_glyph = self._agent_glyph(obj_in)
        obj_out_glyph = self._agent_glyph(obj_out)
        # Make the process glyph
        process_glyph = self._process_glyph('process')
        # Add the arcs
        self._arc('consumption', obj_in_glyph, process_glyph)
        self._arc('production', process_glyph, obj_out_glyph)
        self._arc('catalysis', subj_glyph, process_glyph)

    def _assemble_regulateamount(self, stmt):
        # Make glyphs for obj
        obj_glyph = self._agent_glyph(stmt.obj)
        # Make the process glyph
        process_glyph = self._process_glyph('process')
        # Add the arcs
        if isinstance(stmt, DecreaseAmount):
            self._arc('consumption', obj_glyph, process_glyph)
        else:
            self._arc('production', process_glyph, obj_glyph)
        # Make glyph for subj and add arc if needed
        if stmt.subj:
            subj_glyph = self._agent_glyph(stmt.subj)
            self._arc('catalysis', subj_glyph, process_glyph)

    def _assemble_complex(self, stmt):
        # Make glyph for individual members
        member_glyphs = [self._agent_glyph(m) for m in stmt.members]
        # Make glyph for complex
        # First we need to unroll all members and their bound conditions
        # into a single list with a single prime agent
        all_members = []
        for i, member in enumerate(stmt.members):
            member_tmp = copy.deepcopy(member)
            bound = [bc.agent for bc in member_tmp.bound_conditions
                     if bc.is_bound]
            member_tmp.bound_conditions = []
            if i == 0:
                prime_agent = member_tmp
            else:
                all_members.append(member_tmp)
            all_members += bound
        # Now we set all the other members as bound conditions on the prime
        # agent
        prime_agent.bound_conditions = \
            [BoundCondition(m, True) for m in all_members]
        complex_glyph = self._agent_glyph(prime_agent)
        process_glyph = self._process_glyph('association')
        for member_glyph in member_glyphs:
            self._arc('consumption', member_glyph, process_glyph)
        self._arc('production', process_glyph, complex_glyph)

    def _assemble_activeform(self, stmt):
        agent_glyph = self._agent_glyph(stmt.agent)
        agent_active = copy.deepcopy(stmt.agent)
        agent_active.activity = ActivityCondition(stmt.activity,
                                                  stmt.is_active)
        agent_active_glyph = self._agent_glyph(agent_active)
        process_glyph = self._process_glyph('process')
        self._arc('consumption', agent_glyph, process_glyph)
        self._arc('production', process_glyph, agent_active_glyph)

    def _arc(self, class_name, source, target):
        arc_id = self._make_id()
        arc = emaker.arc(class_(class_name), source=source, target=target,
                         id=arc_id)
        self._map.append(arc)

    def _process_glyph(self, class_name):
        process_id = self._make_id()
        process_glyph = emaker.glyph(emaker.bbox(**self.process_style),
                                     class_(class_name), id=process_id)
        self._map.append(process_glyph)
        return process_id

    def _none_glyph(self):
        glyph_id = self._make_id()
        none_glyph = emaker.glyph(emaker.bbox(**self.source_sink_style),
                                  class_('source and sink'), id=glyph_id)
        self._map.append(none_glyph)
        return glyph_id

    def _agent_glyph(self, agent, append=True):
        # Make the main glyph for the agent
        # TODO: handle bound conditions
        agent_id = self._make_agent_id(agent)
        agent_type = _get_agent_type(agent)
        glyph = emaker.glyph(emaker.label(text=agent.name),
                             emaker.bbox(**self.monomer_style),
                             class_(agent_type), id=agent_id)

        # Temporarily remove
        # Make a glyph for the agent type
        # TODO: handle other agent types
        #type_glyph = emaker.glyph(emaker.label(text='mt:prot'),
        #                          class_('unit of information'),
        #                          emaker.bbox(**self.entity_type_style),
        #                          id=self._make_id())
        #glyph.append(type_glyph)

        # Make glyphs for agent state
        # TODO: handle location, mutation
        for m in agent.mods:
            if m.residue is not None:
                mod = m.residue
            else:
                mod = abbrevs[m.mod_type]
            mod_pos = m.position if m.position is not None else ''
            variable = '%s%s' % (mod, mod_pos)
            value = states[m.mod_type][1 if m.is_modified else 0]
            state = emaker.state(variable=variable, value=value)
            state_glyph = \
                emaker.glyph(state, emaker.bbox(**self.entity_state_style),
                             class_('state variable'), id=self._make_id())
            glyph.append(state_glyph)
        if agent.activity:
            value = 'a' if agent.activity.is_active else 'i'
            state = emaker.state(variable=abbrevs[agent.activity.activity_type],
                                 value=value)
            state_glyph = \
                emaker.glyph(state, emaker.bbox(**self.entity_state_style),
                             class_('state variable'), id=self._make_id())
            glyph.append(state_glyph)

        # Handle bound conditions as complexes
        if agent.bound_conditions:
            members = [glyph]
            for bc in agent.bound_conditions:
                if bc.is_bound:
                    member_glyph = self._agent_glyph(bc.agent, append=False)
                    members.append(member_glyph)
            # Exclude the case where only negative bound conditions
            # are given and so members has only 1 element
            if len(members) > 1:
                complex_glyph = \
                    emaker.glyph(emaker.bbox(**self.complex_style),
                                 class_('complex'), id=self._make_id())
                for member in members:
                    complex_glyph.append(member)
                glyph = complex_glyph
        if append:
            self._map.append(glyph)
            return agent_id
        return glyph

    def _glyph_for_complex_pattern(self, pattern):
        """Add glyph and member glyphs for a PySB ComplexPattern."""
        # Make the main glyph for the agent
        monomer_glyphs = []
        for monomer_pattern in pattern.monomer_patterns:
            glyph = self._glyph_for_monomer_pattern(monomer_pattern)
            monomer_glyphs.append(glyph)

        if len(monomer_glyphs) > 1:
            pattern.matches_key = lambda: str(pattern)
            agent_id = self._make_agent_id(pattern)
            complex_glyph = \
                emaker.glyph(emaker.bbox(**self.complex_style),
                             class_('complex'), id=agent_id)
            for glyph in monomer_glyphs:
                glyph.attrib['id'] = agent_id + glyph.attrib['id']
                complex_glyph.append(glyph)
            return complex_glyph
        return monomer_glyphs[0]

    def _glyph_for_monomer_pattern(self, pattern):
        """Add glyph for a PySB MonomerPattern."""
        pattern.matches_key = lambda: str(pattern)
        agent_id = self._make_agent_id(pattern)
        # Handle sources and sinks
        if pattern.monomer.name in ('__source', '__sink'):
            return None
        # Handle molecules
        glyph = emaker.glyph(emaker.label(text=pattern.monomer.name),
                             emaker.bbox(**self.monomer_style),
                             class_('macromolecule'), id=agent_id)
        # Temporarily remove this
        # Add a glyph for type
        #type_glyph = emaker.glyph(emaker.label(text='mt:prot'),
        #                          class_('unit of information'),
        #                          emaker.bbox(**self.entity_type_style),
        #                          id=self._make_id())
        #glyph.append(type_glyph)
        for site, value in pattern.site_conditions.items():
            if value is None or isinstance(value, int):
                continue
            # Make some common abbreviations
            if site == 'phospho':
                site = 'p'
            elif site == 'activity':
                site = 'act'
                if value == 'active':
                    value = 'a'
                elif value == 'inactive':
                    value = 'i'
            state = emaker.state(variable=site, value=value)
            state_glyph = \
                emaker.glyph(state, emaker.bbox(**self.entity_state_style),
                             class_('state variable'), id=self._make_id())
            glyph.append(state_glyph)
        return glyph

    def _make_id(self):
        element_id = 'id_%d' % self._id_counter
        self._id_counter += 1
        return element_id

    def _make_agent_id(self, agent):
        key = agent.matches_key()
        mapped_id = self._agent_ids.get(key)
        if mapped_id:
            return mapped_id
        new_id = self._make_id()
        self._agent_ids[key] = new_id
        return new_id

    def statement_exists(self, stmt):
        for s in self.statements:
            if stmt.matches(s):
                return True
        return False

def _get_agent_type(agent):
    if agent.db_refs.get('UP') or agent.db_refs.get('HGNC') or \
        agent.db_refs.get('FPLX') or agent.db_refs.get('PF'):
        return 'macromolecule'
    elif agent.db_refs.get('CHEBI') or agent.db_refs.get('PUBCHEM'):
        return 'simple chemical'
    elif agent.db_refs.get('GO'):
        return 'phenotype'
    return 'unspecified entity'

def class_(name):
    return {'class': name}

abbrevs = {
    'phosphorylation': 'phospho',
    'ubiquitination': 'ub',
    'farnesylation': 'farnesyl',
    'hydroxylation': 'hydroxyl',
    'acetylation': 'acetyl',
    'sumoylation': 'sumo',
    'glycosylation': 'glycosyl',
    'methylation': 'methyl',
    'modification': 'mod',
    'activity': 'act',
    'kinase': 'kin'
}

states = {
    'phosphorylation': ['u', 'p'],
    'ubiquitination': ['n', 'y'],
    'farnesylation': ['n', 'y'],
    'hydroxylation': ['n', 'y'],
    'acetylation': ['n', 'y'],
    'sumoylation': ['n', 'y'],
    'glycosylation': ['n', 'y'],
    'methylation': ['n', 'y'],
    'modification': ['n', 'y'],
}


text:
package org.apache.commons.io.input;

import static org.apache.commons.io.IOUtils.EOF;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.junit.jupiter.api.Test;

/**
 * Test case for {@link SequenceReader}.
 */
public class SequenceReaderTest {

    private static class CustomReader extends Reader {

        boolean closed;

        protected void checkOpen() throws IOException {
            if (closed) {
                throw new IOException("emptyReader already closed");
            }
        }

        @Override
        public int read(final char[] cbuf, final int off, final int len) throws IOException {
            checkOpen();
            close();
            return EOF;
        }

        @Override
        public void close() throws IOException {
            closed = true;
        }

        public boolean isClosed() {
            return closed;
        }
    };

    private static final char NUL = 0;

    private void checkArray(final char[] expected, final char[] actual) {
        for (int i = 0; i < expected.length; i++) {
            assertEquals(expected[i], actual[i], "Compare[" + i + "]");
        }
    }

    private void checkRead(final Reader reader, final String expected) throws IOException {
        for (int i = 0; i < expected.length(); i++) {
            assertEquals(expected.charAt(i), (char) reader.read(), "Read[" + i + "] of '" + expected + "'");
        }
    }

    private void checkReadEof(final Reader reader) throws IOException {
        for (int i = 0; i < 10; i++) {
            assertEquals(-1, reader.read());
        }
    }

    @Test
    public void testAutoClose() throws IOException {
        try (Reader reader = new SequenceReader(new CharSequenceReader("FooBar"))) {
            checkRead(reader, "Foo");
            reader.close();
            checkReadEof(reader);
        }
    }

    @Test
    public void testClose() throws IOException {
        final Reader reader = new SequenceReader(new CharSequenceReader("FooBar"));
        checkRead(reader, "Foo");
        reader.close();
        checkReadEof(reader);
    }

    @Test
    public void testCloseReaders() throws IOException {
        final CustomReader reader0 = new CustomReader();
        final CustomReader reader1 = new CustomReader() {

            private final char[] content = {'A'};
            private int position;

            @Override
            public int read(final char[] cbuf, final int off, final int len) throws IOException {
                checkOpen();

                if (off < 0) {
                    throw new IndexOutOfBoundsException("off is negative");
                } else if (len < 0) {
                    throw new IndexOutOfBoundsException("len is negative");
                } else if (len > cbuf.length - off) {
                    throw new IndexOutOfBoundsException("len is greater than cbuf.length - off");
                }

                if (position > 0) {
                    return EOF;
                }

                cbuf[off] = content[0];
                position++;
                return 1;
            }

        };

        try (SequenceReader sequenceReader = new SequenceReader(reader1, reader0)) {
            assertEquals('A', sequenceReader.read());
            assertEquals(EOF, sequenceReader.read());
        } finally {
            assertTrue(reader1.isClosed());
            assertTrue(reader0.isClosed());
        }
        assertTrue(reader1.isClosed());
        assertTrue(reader0.isClosed());

    }

    @Test
    public void testMarkSupported() throws Exception {
        try (Reader reader = new SequenceReader()) {
            assertFalse(reader.markSupported());
        }
    }

    @Test
    public void testRead() throws IOException {
        try (Reader reader = new SequenceReader(new StringReader("Foo"), new StringReader("Bar"))) {
            assertEquals('F', reader.read());
            assertEquals('o', reader.read());
            assertEquals('o', reader.read());
            assertEquals('B', reader.read());
            assertEquals('a', reader.read());
            assertEquals('r', reader.read());
            checkReadEof(reader);
        }
    }

    @Test
    public void testReadCharArray() throws IOException {
        try (Reader reader = new SequenceReader(new StringReader("Foo"), new StringReader("Bar"))) {
            char[] chars = new char[2];
            assertEquals(2, reader.read(chars));
            checkArray(new char[] { 'F', 'o' }, chars);
            chars = new char[3];
            assertEquals(3, reader.read(chars));
            checkArray(new char[] { 'o', 'B', 'a' }, chars);
            chars = new char[3];
            assertEquals(1, reader.read(chars));
            checkArray(new char[] { 'r', NUL, NUL }, chars);
            assertEquals(-1, reader.read(chars));
        }
    }

    @Test
    public void testReadCharArrayPortion() throws IOException {
        final char[] chars = new char[10];
        try (Reader reader = new SequenceReader(new StringReader("Foo"), new StringReader("Bar"))) {
            assertEquals(3, reader.read(chars, 3, 3));
            checkArray(new char[] { NUL, NUL, NUL, 'F', 'o', 'o' }, chars);
            assertEquals(3, reader.read(chars, 0, 3));
            checkArray(new char[] { 'B', 'a', 'r', 'F', 'o', 'o', NUL }, chars);
            assertEquals(-1, reader.read(chars));
            assertThrows(IndexOutOfBoundsException.class, () -> reader.read(chars, 10, 10));
            assertThrows(NullPointerException.class, () -> reader.read(null, 0, 10));
        }
    }

    @Test
    public void testReadClosedReader() throws IOException {
        @SuppressWarnings("resource")
        final Reader reader = new SequenceReader(new CharSequenceReader("FooBar"));
        reader.close();
        checkReadEof(reader);
    }

    @Test
    public void testReadCollection() throws IOException {
        final Collection<Reader> readers = new ArrayList<>();
        readers.add(new StringReader("F"));
        readers.add(new StringReader("B"));
        try (Reader reader = new SequenceReader(readers)) {
            assertEquals('F', reader.read());
            assertEquals('B', reader.read());
            checkReadEof(reader);
        }
    }

    @Test
    public void testReadIterable() throws IOException {
        final Collection<Reader> readers = new ArrayList<>();
        readers.add(new StringReader("F"));
        readers.add(new StringReader("B"));
        final Iterable<Reader> iterable = readers;
        try (Reader reader = new SequenceReader(iterable)) {
            assertEquals('F', reader.read());
            assertEquals('B', reader.read());
            checkReadEof(reader);
        }
    }

    @Test
    public void testReadLength0Readers() throws IOException {
        try (Reader reader = new SequenceReader(new StringReader(StringUtils.EMPTY),
            new StringReader(StringUtils.EMPTY), new StringReader(StringUtils.EMPTY))) {
            checkReadEof(reader);
        }
    }

    @Test
    public void testReadLength1Readers() throws IOException {
        try (Reader reader = new SequenceReader(
        // @formatter:off
            new StringReader("0"),
            new StringReader("1"),
            new StringReader("2"),
            new StringReader("3"))) {
            // @formatter:on
            assertEquals('0', reader.read());
            assertEquals('1', reader.read());
            assertEquals('2', reader.read());
            assertEquals('3', reader.read());
        }
    }

    @Test
    public void testReadList() throws IOException {
        final List<Reader> readers = new ArrayList<>();
        readers.add(new StringReader("F"));
        readers.add(new StringReader("B"));
        try (Reader reader = new SequenceReader(readers)) {
            assertEquals('F', reader.read());
            assertEquals('B', reader.read());
            checkReadEof(reader);
        }
    }

    @Test
    public void testSkip() throws IOException {
        try (Reader reader = new SequenceReader(new StringReader("Foo"), new StringReader("Bar"))) {
            assertEquals(3, reader.skip(3));
            checkRead(reader, "Bar");
            assertEquals(0, reader.skip(3));
        }
    }
}


text:
<?php
echo cubrid_version();
?>


text:
{% extends 'layouts/master.html' %}

{% block embed %}

Home

Current Contest Command Center

Edit

Edit Current Sidebar Contest

      <form action="/current-sidebar-contest" method="POST" class="form-horizontal">
        <input type="hidden" name="_method" value="PUT">

                Title:

                <input id="title-input" type="text" name="title" class="form-control" value="{{ currentContest.title }}" required>

                  Examples: RPGC #5: Fear OR TTL: The Fourth Labour

                Topic URL:

                <input id="topic-url-input" type="text" name="topic_url" class="form-control" value="{{ currentContest.topic_url }}" placeholder="URL of the official contest info thread" required>

                Deadline:

                <input id="deadline-input" type="text" name="deadline" class="form-control" value="{{ currentContest.deadline }}" required>

                  Examples: October 4th OR CLOSED

                Image URL: (Optional)

                <input id="image-url-input" type="text" name="image_url" class="form-control" value="{{ currentContest.image_url }}" placeholder="http://example.com/path/to/image.png">

                  Ideally upload it to imgur.com and ensure it is no wider than 231px. Consider cropping the height so it's around 110px tall to avoid taking up too much vertical sidebar room. (You can resize and crop on Imgur by clicking its "Edit" button)

                Cancel

              <button type="submit" class="btn btn-primary">
                Update Contest
              </button>

      </form>

{% endblock %}

{% block scripts %}

{% endblock %}


text:
package com.smartdevicelink.proxy.rpc;

import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;

import java.util.Hashtable;
import java.util.List;

/**
 * Provides information to the user using either TTS, the Display or both and
 * can include a system-generated alert tone.
 *

 * If connecting to SDL Core v.6.0+, the alert can be canceled programmatically using the `cancelID`. Canceling will not dismiss the alert's speech - only the modal view will be dismissed. On older versions of SDL Core, the alert will persist until the user has interacted with the alert or the specified timeout has elapsed.
 *
 *

 *
The displayed portion of the Alert, if any, will persist until the
 * specified timeout has elapsed, or the Alert is preempted

 *
An Alert will preempt (abort) any SmartDeviceLink Operation that is in-progress,
 * except an already-in-progress Alert

 *
An Alert cannot be preempted by any SmartDeviceLink Operation

 *
An Alert can be preempted by a user action (button push)

 *
An Alert will fail if it is issued while another Alert is in progress

 *
Although each Alert parameter is optional, in fact each Alert request
 * must supply at least one of the following parameters:
 *

 *
alertText1

 *
alertText2

 *
alertText3

 *
ttsChunks

 *

 *

 *

 *
 *
HMILevel needs to be FULL or LIMITED.

 * If the app has been granted function group Notification the HMILevel can
 * also be BACKGROUND
 *

 *

 * 			Name
 * 			Type
 * 			Description
 *          Req.
 * 			Notes
 * 			Version Available
 *

 *

 * 			alertText1
 * 			String
 * 			Text to be displayed in the first field of the display during the Alert.
 *          N
 * 			Length is limited to what is indicated in RegisterAppInterface response.  If omitted, top display line will be cleared. Text is always centered
 * 			SmartDeviceLink 1.0
 *

 *

 * 			alertText2
 * 			String
 * 			Text to be displayed in the second field of the display during the Alert.
 *          N
 * 			Only permitted if HMI supports a second display line.	Length is limited to what is indicated in RegisterAppInterface response. 	If omitted, second display line will be cleared.
 * 			SmartDeviceLink 1.0
 *

 *

 * 			alertText3
 * 			String
 * 			Text to be displayed in the third field of the display during the Alert.
 *          N
 * 			Array must have a least one element.
 * 			SmartDeviceLink 1.0
 *

 *

 * 			ttsChunks
 * 			TTSChunk[]
 * 			Array of type TTSChunk which, taken together, specify what is to be spoken to the user.
 *          N
 * 			Array must have a least one element.
 * 			SmartDeviceLink 1.0
 *

 *

 * 			duration
 * 			Integer
 * 			The duration of the displayed portion of the alert, in milliseconds. After this amount of time has passed, the display fields alertText1 and alertText2 will revert to what was displayed in those fields before the alert began.
 *          N
 * 			Min Value: 3000 Max Value: 10000. If omitted, the default is 5000 milliseconds
 * 			SmartDeviceLink 1.0
 *

 *

 * 			playTone
 * 			Boolean
 * 			Specifies whether the alert tone should be played before the TTS (if any) is spoken.
 *          N
 * 			If omitted, default is true.
 * 			SmartDeviceLink 1.0
 *

 *

 * 			softButtons
 * 			SoftButton[]
 * 			Specifies the soft buttons, the apps wants to use in this alert.
 *          N
 * 			If omitted on supported displays, the alert will not have any SoftButton.ArrayMin: 0; ArrayMax: 4
 * 			SmartDeviceLink 1.0
 *

 *

 * 			progressIndicator
 * 			Boolean
 * 			If supported on the given platform, the alert GUI will include some sort of animation indicating that loading of a feature is progressing.  e.g. a spinning wheel or hourglass, etc.
 *         	N
 *
 * 			SmartDeviceLink 1.0
 *

 *

 * 			cancelID
 * 			Integer
 * 			An ID for this specific alert to allow cancellation through the `CancelInteraction` RPC.
 *          N
 *
 * 			SmartDeviceLink 6.0
 *

 *

 * 			alertIcon
 * 			Image
 * 			Image struct determining whether the icon is static or dynamic. If omitted on supported displays, no (or the default if applicable) icon should be displayed.
 *          N
 *
 * 			SmartDeviceLink 6.0.0
 *

 *

 *
 * @see GetVehicleData
 * @see OnVehicleData
 * @see Show
 * @see Speak
 * @since SmartDeviceLink 1.0
 */
public class Alert extends RPCRequest {
    public static final String KEY_PLAY_TONE = "playTone";
    public static final String KEY_DURATION = "duration";
    public static final String KEY_ALERT_TEXT_1 = "alertText1";
    public static final String KEY_ALERT_TEXT_2 = "alertText2";
    public static final String KEY_ALERT_TEXT_3 = "alertText3";
    public static final String KEY_PROGRESS_INDICATOR = "progressIndicator";
    public static final String KEY_TTS_CHUNKS = "ttsChunks";
    public static final String KEY_SOFT_BUTTONS = "softButtons";
    public static final String KEY_CANCEL_ID = "cancelID";
    public static final String KEY_ALERT_ICON = "alertIcon";

    /**
     * Constructs a new Alert object
     */
    public Alert() {
        super(FunctionID.ALERT.toString());
    }

    /**
     * Constructs a new Alert object indicated by the Hashtable parameter
     *
     * @param hash The Hashtable to use
     */
    public Alert(Hashtable<String, Object> hash) {
        super(hash);
    }

    /**
     * Gets the text which is displayed in the first field of the display during the Alert
     *
     * @return String - a String value representing the text which is displayed in the first field during the Alert
     */
    public String getAlertText1() {
        return getString(KEY_ALERT_TEXT_1);
    }

    /**
     * Sets the String to be displayed in the first field of the display during the Alert
     *
     * @param alertText1 a String value representing the text which is displayed in the first field during the Alert
     */
    public Alert setAlertText1(String alertText1) {
        setParameters(KEY_ALERT_TEXT_1, alertText1);
        return this;
    }

    /**
     * Gets the text which is displayed in the second field of the display during the Alert
     *
     * @return String -a String value representing the text which is displayed in the second field during the Alert
     */
    public String getAlertText2() {
        return getString(KEY_ALERT_TEXT_2);
    }

    /**
     * Sets the String to be displayed in the second field of the display during the Alert
     *
     * @param alertText2 a String value representing the text which is displayed in the third field during the Alert
     */
    public Alert setAlertText2(String alertText2) {
        setParameters(KEY_ALERT_TEXT_2, alertText2);
        return this;
    }

    /**
     * Gets the text which is displayed in the third field of the display during the Alert
     *
     * @return String -a String value representing the text which is displayed in the third field during the Alert
     * @since SmartDeviceLink 2.0
     */
    public String getAlertText3() {
        return getString(KEY_ALERT_TEXT_3);
    }

    /**
     * Sets the String to be displayed in the third field of the display during
     * the Alert
     *
     * @param alertText3 a String value representing the text which is displayed in the third field during the Alert
     * @since SmartDeviceLink 2.0
     */
    public Alert setAlertText3(String alertText3) {
        setParameters(KEY_ALERT_TEXT_3, alertText3);
        return this;
    }

    /**
     * Gets TTSChunk[], the Array of type TTSChunk which, taken together,
     * specify what is to be spoken to the user
     *
     * @return List -a List<TTSChunk> value specify what is to be spoken to
     * the user
     */
    @SuppressWarnings("unchecked")
    public List<TTSChunk> getTtsChunks() {
        return (List<TTSChunk>) getObject(TTSChunk.class, KEY_TTS_CHUNKS);
    }

    /**
     * Sets array of type TTSChunk which, taken together, specify what is to be
     * spoken to the user
     *
     * @param ttsChunks
 Notes: Array must have a least one element

     */
    public Alert setTtsChunks(List<TTSChunk> ttsChunks) {
        setParameters(KEY_TTS_CHUNKS, ttsChunks);
        return this;
    }

    /**
     * Gets the duration of the displayed portion of the alert, in milliseconds
     *
     * @return Integer -an Integer value representing the duration of the displayed portion of the alert, in milliseconds
     */
    public Integer getDuration() {
        return getInteger(KEY_DURATION);
    }

    /**
     * Sets the duration of the displayed portion of the alert, in milliseconds.
     * After this amount of time has passed, the display fields alertText1 and
     * alertText2 will revert to what was displayed in those fields before the
     * alert began
     *
     * @param duration -an Integer value representing the duration of the displayed portion of the alert, in milliseconds
     */
    public Alert setDuration(Integer duration) {
        setParameters(KEY_DURATION, duration);
        return this;
    }

    /**
     * Gets a Boolean value representing the alert tone
     *
     * @return Boolean -If TRUE, means an alert tone will be played before the
     * TTS (if any) is spoken
     */
    public Boolean getPlayTone() {
        return getBoolean(KEY_PLAY_TONE);
    }

    /**
     * Sets whether the alert tone should be played before the TTS (if any) is
     * spoken
     *
     * @param playTone a Boolean value which specifies whether the alert tone should be played before the TTS (if any) is spoken.
 Notes: If omitted, default is true

     */
    public Alert setPlayTone(Boolean playTone) {
        setParameters(KEY_PLAY_TONE, playTone);
        return this;
    }

    /**
     * Gets the SoftButton List object
     *
     * @return List<SoftButton> -a List<SoftButton> representing the List object
     * @since SmartDeviceLink 2.0
     */
    @SuppressWarnings("unchecked")
    public List<SoftButton> getSoftButtons() {
        return (List<SoftButton>) getObject(SoftButton.class, KEY_SOFT_BUTTONS);
    }

    /**
     * Sets the SoftButtons
     *
     * @param softButtons a List<SoftButton> value. If omitted on supported displays, the alert will not have any SoftButton. ArrayMin: 0. ArrayMax: 4.
     * @since SmartDeviceLink 2.0
     */
    public Alert setSoftButtons(List<SoftButton> softButtons) {
        setParameters(KEY_SOFT_BUTTONS, softButtons);
        return this;
    }

    /**
     * Gets a Boolean value representing the progress indicator
     *
     * @return Boolean - If TRUE, the alert GUI will include some sort of animation indicating that loading of a feature is progressing. e.g. a spinning wheel or hourglass, etc.
     * @since SmartDeviceLink 3.0
     */
    public Boolean getProgressIndicator() {
        return getBoolean(KEY_PROGRESS_INDICATOR);
    }

    /**
     * Sets whether the progress indicator should be shown
     *
     * @param progressIndicator A Boolean value which specifies whether the alert GUI will include some sort of animation indicating that loading of a feature is progressing. e.g. a spinning wheel or hourglass, etc.
     * @since SmartDeviceLink 3.0
     */
    public Alert setProgressIndicator(Boolean progressIndicator) {
        setParameters(KEY_PROGRESS_INDICATOR, progressIndicator);
        return this;
    }

    /**
     * Gets an Integer value representing the cancel ID
     *
     * @return Integer - An Integer value representing the ID for this specific alert to allow cancellation through the `CancelInteraction` RPC.
     * @since SmartDeviceLink 6.0
     */
    public Integer getCancelID() {
        return getInteger(KEY_CANCEL_ID);
    }

    /**
     * Sets the cancel ID
     *
     * @param cancelID An Integer ID for this specific alert to allow cancellation through the `CancelInteraction` RPC.
     * @since SmartDeviceLink 6.0
     */
    public Alert setCancelID(Integer cancelID) {
        setParameters(KEY_CANCEL_ID, cancelID);
        return this;
    }

    /**
     *
Sets the Image
     * If provided, defines the image to be shown along with the alert

     *
     * @param alertIcon an Image object representing the Image shown along with the alert. Notes: If omitted on supported displays, no (or the default if applicable) icon will be displayed

     */
    public Alert setAlertIcon(Image alertIcon) {
        setParameters(KEY_ALERT_ICON, alertIcon);
        return this;
    }

    /**
     *
Gets the image to be shown along with the alert

     *
     * @return Image -an Image object
     */
    public Image getAlertIcon() {
        return (Image) getObject(Image.class, KEY_ALERT_ICON);
    }
}


text:
describe("Moonshot Controllers", function () {

  var ctrl, $rootScope, $scope, mockResolvedPath;
  beforeEach(module('moonshot'));

  beforeEach(inject(function (_$rootScope_) {
    $rootScope = _$rootScope_;
  }));

  beforeEach(inject(function ($controller) {
    $scope = $rootScope.$new();

    mockResolvedPath = {
      data: {
        data: {context: {_id: 1}}
      }
    };

//    spyOn(mockResolvedPath, 'context').andCallThrough();

    ctrl = $controller('TraverserCtrl', {
      '$scope': $scope,
      'resolvedPath': mockResolvedPath
    });
  }));

  describe("The Basics", function () {

    it("should be true", function () {
      expect(ctrl.context).toBe(939);
    });
//      var state = ctrl.$state;
//      expect(state.current.name).toBe('');
//    })

  });

});


text:
// Copyright (c) Committed Software 2018, opensource@committed.io
package uk.gov.dstl.baleen.transports.serialisation;

import java.io.IOException;
import java.util.Collection;
import java.util.Map;

import org.apache.uima.jcas.JCas;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.type.MapLikeType;
import com.fasterxml.jackson.databind.type.TypeFactory;

import uk.gov.dstl.baleen.types.BaleenAnnotation;
import uk.gov.dstl.baleen.uima.UimaMonitor;
import uk.gov.dstl.baleen.uima.UimaSupport;

/** Class to serialise and deserialise the JCas to a JSON string. */
public class JsonJCasConverter {

  private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();

  private final JCasSerialiser serialiser;
  private final JCasDeserialiser deserialiser;

  private final MapLikeType mapLikeType =
      TypeFactory.defaultInstance().constructMapLikeType(Map.class, String.class, Object.class);

  /**
   * Construct a JsonJCasConverter using the given {@link UimaSupport}, {@link UimaMonitor} and,
   * optional, white and black lists to filter by.
   *
   * <p>NB: a null or empty filter list implies no filtering.
   *
   * @param monitor the {@link UimaMonitor} to use
   * @param whiteList given annotation classes (optional)
   * @param blackList given annotation classes (optional)
   */
  public JsonJCasConverter(
      final UimaMonitor monitor,
      final Collection<Class<? extends BaleenAnnotation>> whiteList,
      final Collection<Class<? extends BaleenAnnotation>> blackList) {
    serialiser = new JCasSerialiser(monitor, whiteList, blackList);
    deserialiser = new JCasDeserialiser(monitor, whiteList, blackList);
  }

  /**
   * Serialise the JCas to a JSON string
   *
   * @param jCas to serialise
   * @return a JSON string representation
   * @throws IOException if the serialisation cannot be performed
   */
  public String serialise(final JCas jCas) throws IOException {
    final Map<String, Object> map = serialiser.serialise(jCas);
    return OBJECT_MAPPER.writeValueAsString(map);
  }

  /**
   * Deserialise the given JSON string by populating the given JCas.
   *
   * @param jCas to populate
   * @param jsonString to deserialise
   * @return the populated JCas (for convenient method chaining)
   * @throws IOException if there is an error while deserialising.
   */
  public JCas deserialise(final JCas jCas, final String jsonString) throws IOException {
    final Map<String, Object> map = OBJECT_MAPPER.readValue(jsonString, mapLikeType);
    deserialiser.deseralize(jCas, map);
    return jCas;
  }
}