text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <parent>
        <groupId>com.bulain</groupId>
        <artifactId>parent</artifactId>
        <version>1.0.0</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <groupId>com.bulain</groupId>
    <artifactId>oltu-demo</artifactId>
    <packaging>jar</packaging>
    <version>1.0.1-SNAPSHOT</version>
    <name>oltu-demo</name>
    <url>https://github.com/bulain/oltu-demo</url>

    <scm>
        <connection>scm:git:git@github.com:bulain/oltu-demo.git</connection>
        <developerConnection>scm:git:git@github.com:bulain/oltu-demo.git</developerConnection>
        <url>git@github.com:bulain/oltu-demo.git</url>
    </scm>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <tools.version>1.5</tools.version>
        <oltu.version>0.31</oltu.version>
    </properties>

    <dependencies>

        <!-- logger -->
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
        </dependency>

        <!-- common -->
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.5</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
        </dependency>

        <!-- spring -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- oltu -->
        <dependency>
            <groupId>org.apache.oltu.oauth2</groupId>
            <artifactId>org.apache.oltu.oauth2.resourceserver</artifactId>
            <version>${oltu.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.oltu.oauth2</groupId>
            <artifactId>org.apache.oltu.oauth2.authzserver</artifactId>
            <version>${oltu.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.oltu.oauth2</groupId>
            <artifactId>org.apache.oltu.oauth2.client</artifactId>
            <version>${oltu.version}</version>
        </dependency>

        <!-- compile -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jsp-api</artifactId>
            <scope>provided</scope>
        </dependency>

    </dependencies>

    <build>
        <finalName>oltu-demo</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <configuration>
                    <argLine>-Xmx512m -XX:MaxPermSize=256m</argLine>
                    <scanIntervalSeconds>10</scanIntervalSeconds>
                    <stopKey>foo</stopKey>
                    <stopPort>9999</stopPort>
                    <useTestClasspath>true</useTestClasspath>
                    <webAppConfig>
                        <contextPath>/oltu-demo</contextPath>
                    </webAppConfig>
                    <connectors>
                        <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
                            <port>8082</port>
                            <maxIdleTime>60000</maxIdleTime>
                        </connector>
                    </connectors>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>


text:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Jun 29, 2016 2:06:26 PM by Hibernate Tools 3.5.0.Final -->
<hibernate-mapping>
    <class name="com.ian.hib.domain.MyEvent" table="event_inf">
        <id name="id" column="event_id" type="java.lang.Integer">
            <generator class="identity" />
        </id>
        <property name="title" type="java.lang.String">
            <column name="TITLE" />
        </property>
        <property name="happenDate" type="java.util.Date">
            <column name="HAPPENDATE" />
        </property>
        <set name="actors" table="person_event" inverse="true" lazy="true">
            <key>
                <column name="event_id" />
            </key>
            <many-to-many class="com.ian.hib.domain.Person" column="person_id"/>
        </set>
    </class>
</hibernate-mapping>

redpajama_set_name: RedPajamaGithub


text:
package io.agrest.sencha;

import io.agrest.runtime.encoder.IEncoderService;
import io.agrest.runtime.processor.select.CreateResourceEntityStage;
import io.agrest.runtime.processor.select.ParseRequestStage;
import io.agrest.runtime.protocol.IEntityUpdateParser;
import io.agrest.runtime.semantics.IRelationshipMapper;
import io.agrest.sencha.runtime.encoder.SenchaEncoderService;
import io.agrest.sencha.runtime.entity.ISenchaFilterExpressionCompiler;
import io.agrest.sencha.runtime.entity.SenchaFilterExpressionCompiler;
import io.agrest.sencha.runtime.processor.select.SenchaCreateResourceEntityStage;
import io.agrest.sencha.runtime.processor.select.SenchaParseRequestStage;
import io.agrest.sencha.runtime.protocol.ISenchaFilterParser;
import io.agrest.sencha.runtime.protocol.SenchaFilterParser;
import io.agrest.sencha.runtime.protocol.SenchaUpdateParser;
import io.agrest.sencha.runtime.semantics.SenchaRelationshipMapper;
import org.apache.cayenne.di.Binder;
import org.apache.cayenne.di.Module;

/**
 * @since 2.10
 */
public class SenchaModule implements Module {

    @Override
    public void configure(Binder binder) {
        binder.bind(ParseRequestStage.class).to(SenchaParseRequestStage.class);
        binder.bind(CreateResourceEntityStage.class).to(SenchaCreateResourceEntityStage.class);
        binder.bind(IEncoderService.class).to(SenchaEncoderService.class);
        binder.bind(IRelationshipMapper.class).to(SenchaRelationshipMapper.class);
        binder.bind(ISenchaFilterExpressionCompiler.class).to(SenchaFilterExpressionCompiler.class);
        binder.bind(ISenchaFilterParser.class).to(SenchaFilterParser.class);
        binder.bind(IEntityUpdateParser.class).to(SenchaUpdateParser.class);
    }
}


text:
package models

import "errors"

var (
	errRegistryAddressInvalid  = errors.New("Invalid Registry Address")
	errRegistryUsernameInvalid = errors.New("Invalid Registry Username")
	errRegistryPasswordInvalid = errors.New("Invalid Registry Password")
)

// RegistryService defines a service for managing registries.
type RegistryService interface {
	RegistryFind(*Repository, string) (*Registry, error)
	RegistryList(*Repository) ([]*Registry, error)
	RegistryCreate(*Repository, *Registry) error
	RegistryUpdate(*Repository, *Registry) error
	RegistryDelete(*Repository, string) error
}

// RegistryStore persists registry information to storage.
type RegistryStore interface {
	RegistryFind(*Repository, string) (*Registry, error)
	RegistryList(*Repository) ([]*Registry, error)
	RegistryCreate(*Registry) error
	RegistryUpdate(*Registry) error
	RegistryDelete(*Registry) error
}

// Registry represents a docker registry with credentials.
// swagger:model registry
type Registry struct {
	ID       int64  `json:"id"       `
	RepoID   int64  `json:"-"        `
	Address  string `json:"address"  `
	Username string `json:"username" `
	Password string `json:"password" `
	Email    string `json:"email"    `
	Token    string `json:"token"    `
}

func (t Registry) TableName() string {
	return "cncd_registry"
}

// Validate validates the registry information.
func (r *Registry) Validate() error {
	switch {
	case len(r.Address) == 0:
		return errRegistryAddressInvalid
	case len(r.Username) == 0:
		return errRegistryUsernameInvalid
	case len(r.Password) == 0:
		return errRegistryPasswordInvalid
	default:
		return nil
	}
}

// Copy makes a copy of the registry without the password.
func (r *Registry) Copy() *Registry {
	return &Registry{
		ID:       r.ID,
		RepoID:   r.RepoID,
		Address:  r.Address,
		Username: r.Username,
		Email:    r.Email,
		Token:    r.Token,
	}
}

func RegistryList(repo *Repository) ([]*Registry, error) {
	regs := make([]*Registry, 0)

	if err := x.Where("repo_id = ? ", repo.ID ).Find(&regs); err != nil {
		return nil, err
	}

	return regs, nil
}


text:
package io.chthonic.mythos.javaexample.ui.vus;

import android.app.Activity;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;

import io.chthonic.mythos.javaexample.R;
import io.chthonic.mythos.javaexample.ui.layouts.DahLayout;
import io.chthonic.mythos.mvp.Vu;

/**
 * Created by jhavatar on 3/22/2016.
 */
public class RoVu extends Vu {

    private Runnable toggleDahListener = null;

    public RoVu(LayoutInflater layoutInflater,
                Activity activity,
                Fragment fragment,
                ViewGroup parentView) {

        super(layoutInflater, activity, fragment, parentView);
    }

    @Override
    public void onCreate() {
        Button toggleButton = this.getRootView().findViewById(R.id.button_toggle_dah);
        toggleButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Runnable listener = toggleDahListener;
                if (listener != null) {
                    listener.run();
                }
            }
        });
    }

    @Override
    public int getRootViewLayoutId() {
        return R.layout.fragment_ro;
    }

    public Runnable getToggleDahListener() {
        return toggleDahListener;
    }

    public void setToggleDahListener(Runnable toggleDahListener) {
        this.toggleDahListener = toggleDahListener;
    }

    public void updateDahDisplay(boolean showDah) {
        ViewGroup rootLayout = (ViewGroup) getRootView();
        View dahLayout = getRootView().findViewById(R.id.dah_layout);
        if (showDah && (dahLayout == null)) {
            dahLayout = new DahLayout(getActivity(), getActivity().getResources().getString(R.string.ro_lifecycle_key));
            dahLayout.setId(R.id.dah_layout);
            rootLayout.addView(dahLayout);

        } else if (!showDah && (dahLayout != null)) {
            rootLayout.removeView(dahLayout);
        }
    }

    public void setText(String text) {
        ((TextView) getRootView().findViewById(R.id.ro_text)).setText(text);
    }

}


text:
package algorithms.imageProcessing;

/**
 *
 * @author nichole
 */
public class Kernel {

    final int[] a;

    private final int width;

    private final int height;

    private final int nPixels;
    /**
     * @param theWidth
     * @param theHeight
     */
    public Kernel (int theWidth, int theHeight) {

        nPixels = theWidth * theHeight;

        width = theWidth;

        height = theHeight;

        a = new int[nPixels];
    }

    public void setValue(int col, int row, int value) {

        int idx = (row * width) + col;

        a[idx] = value;
    }

    public int getValue(int col, int row) {

        int idx = (row * width) + col;

        return a[idx];
    }

    /**
     * @return the width
     */
    public int getWidth() {
        return width;
    }

    /**
     * @return the height
     */
    public int getHeight() {
        return height;
    }

    /**
     * @return the nPixels
     */
    public int getNPixels() {
        return nPixels;
    }
}


text:
<?php

final class DiffusionBrowseTableView extends DiffusionView {

  private $paths;
  private $handles = array();

  public function setPaths(array $paths) {
    assert_instances_of($paths, 'DiffusionRepositoryPath');
    $this->paths = $paths;
    return $this;
  }

  public function setHandles(array $handles) {
    assert_instances_of($handles, 'PhabricatorObjectHandle');
    $this->handles = $handles;
    return $this;
  }

  public function render() {
    $request = $this->getDiffusionRequest();
    $repository = $request->getRepository();

    $base_path = trim($request->getPath(), '/');
    if ($base_path) {
      $base_path = $base_path.'/';
    }

    $need_pull = array();
    $rows = array();
    $show_edit = false;
    foreach ($this->paths as $path) {

      $dir_slash = null;
      $file_type = $path->getFileType();
      if ($file_type == DifferentialChangeType::FILE_DIRECTORY) {
        $browse_text = $path->getPath().'/';
        $dir_slash = '/';

        $browse_link = phutil_tag('strong', array(), $this->linkBrowse(
          $base_path.$path->getPath().$dir_slash,
          array(
            'type' => $file_type,
            'name' => $browse_text,
          )));
      } else if ($file_type == DifferentialChangeType::FILE_SUBMODULE) {
        $browse_text = $path->getPath().'/';
        $browse_link = phutil_tag('strong', array(), $this->linkBrowse(
          null,
          array(
            'type' => $file_type,
            'name' => $browse_text,
            'hash' => $path->getHash(),
            'external' => $path->getExternalURI(),
          )));
      } else {
        $browse_text = $path->getPath();
        $browse_link = $this->linkBrowse(
          $base_path.$path->getPath(),
          array(
            'type' => $file_type,
            'name' => $browse_text,
          ));
      }

      $dict = array(
        'lint'      => celerity_generate_unique_node_id(),
        'commit'    => celerity_generate_unique_node_id(),
        'date'      => celerity_generate_unique_node_id(),
        'time'      => celerity_generate_unique_node_id(),
        'author'    => celerity_generate_unique_node_id(),
        'details'   => celerity_generate_unique_node_id(),
      );

      $need_pull[$base_path.$path->getPath().$dir_slash] = $dict;
      foreach ($dict as $k => $uniq) {
        $dict[$k] = phutil_tag('span', array('id' => $uniq), '');
      }

      $rows[] = array(
        $browse_link,
        idx($dict, 'lint'),
        $dict['commit'],
        $dict['author'],
        $dict['details'],
        $dict['date'],
        $dict['time'],
      );
    }

    if ($need_pull) {
      Javelin::initBehavior(
        'diffusion-pull-lastmodified',
        array(
          'uri'   => (string)$request->generateURI(
            array(
              'action' => 'lastmodified',
              'stable' => true,
            )),
          'map' => $need_pull,
        ));
    }

    $branch = $this->getDiffusionRequest()->loadBranch();
    $show_lint = ($branch && $branch->getLintCommit());
    $lint = $request->getLint();

    $view = new AphrontTableView($rows);
    $view->setHeaders(
      array(
        pht('Path'),
        ($lint ? $lint : pht('Lint')),
        pht('Modified'),
        pht('Author/Committer'),
        pht('Details'),
        pht('Date'),
        pht('Time'),
      ));
    $view->setColumnClasses(
      array(
        '',
        'n',
        'n',
        '',
        'wide',
        '',
        'right',
      ));
    $view->setColumnVisibility(
      array(
        true,
        $show_lint,
        true,
        true,
        true,
        true,
        true,
      ));

    $view->setDeviceVisibility(
      array(
        true,
        false,
        true,
        false,
        true,
        false,
        false,
      ));

    return $view->render();
  }

}


text: require 'knife-do/version'


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Monogr. Cantharelloid Fungi 203 (1966)

#### Original name
Trogia ceraceomollis Corner

### Remarks
null


text:
package com.microsoft.azure.management.appplatform.v2020_07_01.implementation;

import com.microsoft.azure.management.appplatform.v2020_07_01.NameAvailability;
import com.microsoft.azure.arm.model.implementation.WrapperImpl;

class NameAvailabilityImpl extends WrapperImpl<NameAvailabilityInner> implements NameAvailability {
    private final AppPlatformManager manager;
    NameAvailabilityImpl(NameAvailabilityInner inner, AppPlatformManager manager) {
        super(inner);
        this.manager = manager;
    }

    @Override
    public AppPlatformManager manager() {
        return this.manager;
    }

    @Override
    public String message() {
        return this.inner().message();
    }

    @Override
    public Boolean nameAvailable() {
        return this.inner().nameAvailable();
    }

    @Override
    public String reason() {
        return this.inner().reason();
    }

}


text:
owner_slack: "#govuk-2ndline-tech"
title: Jenkins agent not connected to master
parent: "/manual.html"
layout: manual_layout
section: Icinga alerts
---

If the Jenkins agent is not connect to the master you can have a look at the [Jenkins Nodes UI][jenkins-nodes] and see
if it's possible to diagnose and solve the problem from there.

[jenkins-nodes]: https://ci.integration.publishing.service.gov.uk/computer/

View the log for the relevant agent, for example by clicking on the hostname of the agent and then choosing Log from the menu on the left-hand side.

Logs can also be found on the agent machine under `/var/lib/jenkins/remoting/logs`.

## Agent process failing to start

If the agent process is repeatedly starting up and failing with messages like:

```
deleting obsolete workspace /var/lib/jenkins/workspace/ishing-e2e-tests_govuk-test-TBY2AGKJXBE42MNITWCQM63I6R6XJSSGHBHBPH6P4IOBGXQK5OMA
...
Unexpected termination of the channel
```

then try clearing out the workspace directory on the agent:

```
$ gds govuk connect ssh -e ci ci_agent:0
$ sudo rm -r /var/lib/jenkins/workspace/*
```

## Agent SSH host key changed

If the master is failing to SSH into the agent with a message like "Host key verification failed", then delete the relevant entry from the known hosts file on the master:

```
$ gds govuk connect ssh -e integration ci_master
$ sudo -u jenkins ssh ci-agent-<n>.blue.integration.govuk-internal.digital
```

where \<n\> is the number assigned to the node.
You should receive a message from ssh telling you what line to get rid of in known_hosts.
Then you can edit the known_hosts acccordingly.

```
$ sudo nano /var/lib/jenkins/.ssh/known_hosts
```

Then restart the master process.

This problem should only occur if the agent machine gets recreated, which will change its SSH host key.

## Restarting the master process

If there doesn't seem to be way to solve the problem it may be necessary to restart the master process:

```
$ gds govuk connect ssh -e integration ci_master
$ sudo service jenkins restart
```

Restarting the master process will temporarily suspend all CI jobs while the master reconnects to the agents, but it should not cause any jobs to fail.


text:
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
# here : /branch/tests/Poshbox.Test
. "$here\..\TestCommon.ps1"

Describe 'ItIs-Expression' {
    It 'returns Aether.Class.Mock.Expression' {
        $actualResult = ItIs-Expression {}
        (ObjectIs-PSClassInstance $actualResult -PSClassName 'Aether.Class.Mock.Expression') | Should Be $true
    }

    It 'has accurate representation of provided expression when ToString()' {
        $sb = {param($a) return $true}
        $actualResult = ItIs-Expression $sb
        $actualResult.ToString() | Should Be $sb.ToString()
    }

    It 'returns a func[object, bool] from scripblock' {
        $sb = {param($a) return $true}
        $actualResult = ItIs-Expression $sb
        $actualResult.Predicate -is [func[object, bool]] | Should Be $true
    }

    It 'returns a func[object, bool] from func[object, bool]' {
        $actualResult = ItIs-Expression {param($a) return $true}
        $actualResult.Predicate -is [func[object, bool]] | Should Be $true
    }

    It 'returns original expression in func[object, bool] form' {
        $actualResult = ItIs-Expression {return $true}
        $actualResult.Predicate.Invoke($null) | Should Be $true
    }
}


text:
public class HelloActivity {
  static final String TASK_QUEUE = "HelloCron";
  static final String CRON_WORKFLOW_ID = "HelloCron";

  // workflow interface
  @WorkflowInterface
  public interface GreetingWorkflow {
    @WorkflowMethod
    String getGreeting(String name);
  }
  // activity interface
  @ActivityInterface
  public interface GreetingActivities {
    @ActivityMethod
    String greet(String greeting);
  }

  public static class GreetingWorkflowImpl implements GreetingWorkflow {
    private final GreetingActivities activities =
        Workflow.newActivityStub(
            GreetingActivities.class,
            ActivityOptions.newBuilder().setScheduleToCloseTimeout(Duration.ofSeconds(10)).build());

    @Override
    public String greet(String name) {
      activities.greet("Hello " + name + "!");
    }
  }

  // impl of the activities method
  static class GreetingActivitiesImpl implements GreetingActivities {
    @Override
    public String greet(String greeting) {
      System.out.println(
          "From " + Activity.getExecutionContext().getInfo().getWorkflowId() + ": " + greeting);
    }
  }

  // main method
  public static void main(String[] args) {
    WorkflowServiceStubs service = WorkflowServiceStubs.newInstance();
    WorkflowClient client = WorkflowClient.newInstance(service);
    WorkerFactory factory = WorkerFactory.newInstance(client);
    Worker worker = factory.newWorker(TASK_QUEUE);

    // create workflow instance
    worker.registerWorkflowImplementationTypes(GreetingWorkflowImpl.class);
    // register activity
    worker.registerActivitiesImplementations(new GreetingActivitiesImpl());
    factory.start();

    WorkflowOptions workflowOptions =
        WorkflowOptions.newBuilder()
            .setWorkflowId(CRON_WORKFLOW_ID)
            .setTaskQueue(TASK_QUEUE)
            .setCronSchedule("* * * * *")
            .setWorkflowExecutionTimeout(Duration.ofMinutes(10))
            .setWorkflowRunTimeout(Duration.ofMinutes(1))
            .build();

    // start workflow exec
    GreetingWorkflow workflow = client.newWorkflowStub(GreetingWorkflow.class, workflowOptions);
    // exec workflow
    try {
      WorkflowExecution execution = WorkflowClient.start(workflow::greet, "World");
      System.out.println("Started " + execution);
    } catch (WorkflowExecutionAlreadyStarted e) {
      System.out.println("Already running as " + e.getExecution());
    } catch (Throwable e) {
      e.printStackTrace();
      System.exit(1);
    }
  }
}


text:
package com.asy.animations.ui.activity.list;

import com.asy.animations.R;
import com.asy.animations.model.User;

import java.util.ArrayList;
import java.util.List;

/**
 * Class Description.
 *
 * @author asanchezyu@gmail.com.
 * @version 1.0.
 * @since 26/4/16.
 */
public class UserListPresenterImpl implements UserListPresenter {

    private UserListView mUserListView;

    public UserListPresenterImpl() {

    }

    @Override
    public void setView(UserListView userListView) {
        this.mUserListView = userListView;
    }

    @Override
    public void searchUsers() {

        List<User> users = new ArrayList<>();

        users.add(
                new User.Builder()
                        .setName("Cersei")
                        .setSurname("Lannister")
                        .setAvatarUrl(R.drawable.avatar_cersei)
                        .setActor("Lena Headey")
                        .build()
        );

        users.add(
                new User.Builder()
                        .setName("Daenerys")
                        .setSurname("Targaryen")
                        .setAvatarUrl(R.drawable.avatar_daenerys)
                        .setActor("Emilia Clarke")
                        .build()
        );

        users.add(
                new User.Builder()
                        .setName("Jon")
                        .setSurname("Snow")
                        .setAvatarUrl(R.drawable.avatar_jon)
                        .setActor("Kit Harington")
                        .build()
        );

        users.add(
                new User.Builder()
                        .setName("Sansa")
                        .setSurname("Stark")
                        .setAvatarUrl(R.drawable.avatar_sansa)
                        .setActor("Sophie Turner")
                        .build()
        );

        users.add(
                new User.Builder()
                        .setName("Tyrion")
                        .setSurname("Lannister")
                        .setAvatarUrl(R.drawable.avatar_tyrion)
                        .setActor("Peter Dinklage")
                        .build()
        );

        mUserListView.setUsers(users);
    }
}


text:
package org.jboss.osgi.repository;

import javax.xml.stream.Location;

import org.jboss.logging.Messages;
import org.jboss.logging.annotations.Cause;
import org.jboss.logging.annotations.Message;
import org.jboss.logging.annotations.MessageBundle;
import org.jboss.modules.ModuleIdentifier;
import org.jboss.osgi.resolver.XResource;
import org.osgi.service.repository.RequirementExpression;

/**
 * Logging Id ranges: 20500-20599
 *
 * https://docs.jboss.org/author/display/JBOSGI/JBossOSGi+Logging
 *
 * @author Thomas.Diesler@jboss.com
 * @author David Bosschaert
 */
@MessageBundle(projectCode = "JBOSGI")
public interface RepositoryMessages {

    RepositoryMessages MESSAGES = Messages.getBundle(RepositoryMessages.class);

    @Message(id = 20500, value = "%s is null")
    IllegalArgumentException illegalArgumentNull(String name);

    @Message(id = 20501, value = "Resource already exists: %s")
    IllegalStateException resourceAlreadyExists(XResource res);

    @Message(id = 20502, value = "Cannot initialize repository reader")
    IllegalStateException cannotInitializeRepositoryReader(@Cause Throwable th);

    @Message(id = 20503, value = "Cannot read repository element: %s")
    IllegalStateException cannotReadRepositoryElement(@Cause Throwable th, Location location);

    @Message(id = 20504, value = "Cannot read resource element: %s")
    IllegalStateException cannotReadResourceElement(@Cause Throwable th, Location location);

    @Message(id = 20505, value = "Cannot obtain content capability: %s")
    RepositoryStorageException cannotObtainContentCapablility(XResource res);

    @Message(id = 20506, value = "Cannot obtain content URL: %s")
    RepositoryStorageException cannotObtainContentURL(XResource res);

    @Message(id = 20507, value = "Cannot access content URL: %s")
    RepositoryStorageException cannotAccessContentURL(@Cause Throwable th, String contentURL);

    @Message(id = 20508, value = "Invalid content URL: %s")
    RepositoryStorageException invalidContentURL(String contentURL);

    @Message(id = 20509, value = "No such digest algorithm: %s")
    RepositoryStorageException noSuchAlgorithm(@Cause Throwable th, String algorithm);

    @Message(id = 20510, value = "Cannot add resource to storage: %s")
    RepositoryStorageException cannotAddResourceToStorage(@Cause Throwable th, String mime);

    @Message(id = 20511, value = "Cannot obtain input stream for: %s")
    RepositoryStorageException cannotObtainInputStream(@Cause Throwable th, XResource res);

    @Message(id = 20512, value = "Cannot initialize repository writer")
    IllegalStateException cannotInitializeRepositoryWriter(@Cause Throwable th);

    @Message(id = 20513, value = "Cannot write repository element")
    RepositoryStorageException cannotWriteRepositoryElement(@Cause Throwable th);

    @Message(id = 20514, value = "Invalid filter directive: %s")
    IllegalArgumentException invalidFilterDirective(String filter);

    @Message(id = 20515, value = "Cannot obtain RepositoryStorageFactory service")
    IllegalStateException cannotObtainRepositoryStorageFactory();

    @Message(id = 20516, value = "Invalid repository base: %s")
    IllegalArgumentException invalidRepositoryBase(String urlspec);

    @Message(id = 20517, value = "Cannot create repository storage area")
    RepositoryStorageException cannotCreateRepositoryStorageArea(@Cause Throwable th);

    @Message(id = 20518, value = "Cannot add maven resource to storage: %s")
    RepositoryStorageException cannotAddMavenResourceToStorage(@Cause Throwable cause, XResource res);

    @Message(id = 20519, value = "Invalid maven resource: %s")
    RepositoryStorageException invalidMavenResource(@Cause Throwable cause, XResource res);

    @Message(id = 20520, value = "Cannot obtain required attribute: %s")
    IllegalArgumentException cannotObtainRequiredAttribute(String attrname);

    @Message(id = 20521, value = "Cannot obtain module resource: %s")
    IllegalArgumentException cannotObtainModuleResource(@Cause Throwable cause, ModuleIdentifier moduleId);

    @Message(id = 20522, value = "Cannot obtain metadata for resource: %s")
    IllegalArgumentException cannotObtainResourceMetadata(XResource res);

    @Message(id = 20523, value = "Unsupported resource: %s")
    IllegalArgumentException unsupportedResource(XResource res);

    @Message(id = 20524, value = "Malformed Requirement Expression: %s")
    IllegalArgumentException malformedRequirementExpression(RequirementExpression re);
}


text:
FOUNDATION_EXPORT double Pods_LVModalQueue_TestsVersionNumber;
FOUNDATION_EXPORT const unsigned char Pods_LVModalQueue_TestsVersionString[];


text:
/**
 * @fileoverview Helper to locate and load configuration files.
 * @author Nicholas C. Zakas
 */

"use strict";

//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------

const fs = require("fs"),
    path = require("path"),
    stringify = require("json-stable-stringify-without-jsonify");

const debug = require("debug")("eslint:config-file");

//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------

/**
 * Determines sort order for object keys for json-stable-stringify
 *
 * see: https://github.com/samn/json-stable-stringify#cmp
 * @param   {Object} a The first comparison object ({key: akey, value: avalue})
 * @param   {Object} b The second comparison object ({key: bkey, value: bvalue})
 * @returns {number}   1 or -1, used in stringify cmp method
 */
function sortByKey(a, b) {
    return a.key > b.key ? 1 : -1;
}

//------------------------------------------------------------------------------
// Private
//------------------------------------------------------------------------------

/**
 * Writes a configuration file in JSON format.
 * @param {Object} config The configuration object to write.
 * @param {string} filePath The filename to write to.
 * @returns {void}
 * @private
 */
function writeJSONConfigFile(config, filePath) {
    debug(`Writing JSON config file: ${filePath}`);

    const content = `${stringify(config, { cmp: sortByKey, space: 4 })}\n`;

    fs.writeFileSync(filePath, content, "utf8");
}

/**
 * Writes a configuration file in YAML format.
 * @param {Object} config The configuration object to write.
 * @param {string} filePath The filename to write to.
 * @returns {void}
 * @private
 */
function writeYAMLConfigFile(config, filePath) {
    debug(`Writing YAML config file: ${filePath}`);

    // lazy load YAML to improve performance when not used
    const yaml = require("js-yaml");

    const content = yaml.safeDump(config, { sortKeys: true });

    fs.writeFileSync(filePath, content, "utf8");
}

/**
 * Writes a configuration file in JavaScript format.
 * @param {Object} config The configuration object to write.
 * @param {string} filePath The filename to write to.
 * @throws {Error} If an error occurs linting the config file contents.
 * @returns {void}
 * @private
 */
function writeJSConfigFile(config, filePath) {
    debug(`Writing JS config file: ${filePath}`);

    let contentToWrite;
    const stringifiedContent = `module.exports = ${stringify(config, { cmp: sortByKey, space: 4 })};\n`;

    try {
        const { CLIEngine } = require("../cli-engine");
        const linter = new CLIEngine({
            baseConfig: config,
            fix: true,
            useEslintrc: false
        });
        const report = linter.executeOnText(stringifiedContent);

        contentToWrite = report.results[0].output || stringifiedContent;
    } catch (e) {
        debug("Error linting JavaScript config file, writing unlinted version");
        const errorMessage = e.message;

        contentToWrite = stringifiedContent;
        e.message = "An error occurred while generating your JavaScript config file. ";
        e.message += "A config file was still generated, but the config file itself may not follow your linting rules.";
        e.message += `\nError: ${errorMessage}`;
        throw e;
    } finally {
        fs.writeFileSync(filePath, contentToWrite, "utf8");
    }
}

/**
 * Writes a configuration file.
 * @param {Object} config The configuration object to write.
 * @param {string} filePath The filename to write to.
 * @returns {void}
 * @throws {Error} When an unknown file type is specified.
 * @private
 */
function write(config, filePath) {
    switch (path.extname(filePath)) {
        case ".js":
            writeJSConfigFile(config, filePath);
            break;

        case ".json":
            writeJSONConfigFile(config, filePath);
            break;

        case ".yaml":
        case ".yml":
            writeYAMLConfigFile(config, filePath);
            break;

        default:
            throw new Error("Can't write to unknown file type.");
    }
}

//------------------------------------------------------------------------------
// Public Interface
//------------------------------------------------------------------------------

module.exports = {
    write
};


text:
export enum SwordLogic {
  Randomized,
  UncleAssured,
  Swordless
}


text:
package com.gitblit.manager;

import java.io.File;
import java.util.Collection;
import java.util.Date;
import java.util.List;

import org.eclipse.jgit.lib.Repository;

import com.gitblit.GitBlitException;
import com.gitblit.models.ForkModel;
import com.gitblit.models.Metric;
import com.gitblit.models.RegistrantAccessPermission;
import com.gitblit.models.RepositoryModel;
import com.gitblit.models.SearchResult;
import com.gitblit.models.UserModel;

public interface IRepositoryManager extends IManager {

	/**
	 * Returns the path of the repositories folder. This method checks to see if
	 * Gitblit is running on a cloud service and may return an adjusted path.
	 *
	 * @return the repositories folder path
	 */
	File getRepositoriesFolder();

	/**
	 * Returns the path of the hooks folder. This method checks to see if
	 * Gitblit is running on a cloud service and may return an adjusted path.
	 *
	 * @return the Groovy hook scripts folder path
	 */
	File getHooksFolder();

	/**
	 * Returns the path of the grapes folder. This method checks to see if
	 * Gitblit is running on a cloud service and may return an adjusted path.
	 *
	 * @return the Groovy grapes folder path
	 */
	File getGrapesFolder();

	/**
	 * Returns the most recent change date of any repository served by Gitblit.
	 *
	 * @return a date
	 */
	Date getLastActivityDate();

	/**
	 * Returns the effective list of permissions for this user, taking into account
	 * team memberships, ownerships.
	 *
	 * @param user
	 * @return the effective list of permissions for the user
	 */
	List<RegistrantAccessPermission> getUserAccessPermissions(UserModel user);

	/**
	 * Returns the list of users and their access permissions for the specified
	 * repository including permission source information such as the team or
	 * regular expression which sets the permission.
	 *
	 * @param repository
	 * @return a list of RegistrantAccessPermissions
	 */
	List<RegistrantAccessPermission> getUserAccessPermissions(RepositoryModel repository);

	/**
	 * Sets the access permissions to the specified repository for the specified users.
	 *
	 * @param repository
	 * @param permissions
	 * @return true if the user models have been updated
	 */
	boolean setUserAccessPermissions(RepositoryModel repository, Collection<RegistrantAccessPermission> permissions);

	/**
	 * Returns the list of all users who have an explicit access permission
	 * for the specified repository.
	 *
	 * @see IUserService.getUsernamesForRepositoryRole(String)
	 * @param repository
	 * @return list of all usernames that have an access permission for the repository
	 */
	List<String> getRepositoryUsers(RepositoryModel repository);

	/**
	 * Returns the list of teams and their access permissions for the specified
	 * repository including the source of the permission such as the admin flag
	 * or a regular expression.
	 *
	 * @param repository
	 * @return a list of RegistrantAccessPermissions
	 */
	List<RegistrantAccessPermission> getTeamAccessPermissions(RepositoryModel repository);

	/**
	 * Sets the access permissions to the specified repository for the specified teams.
	 *
	 * @param repository
	 * @param permissions
	 * @return true if the team models have been updated
	 */
	boolean setTeamAccessPermissions(RepositoryModel repository, Collection<RegistrantAccessPermission> permissions);

	/**
	 * Returns the list of all teams who have an explicit access permission for
	 * the specified repository.
	 *
	 * @see IUserService.getTeamnamesForRepositoryRole(String)
	 * @param repository
	 * @return list of all teamnames with explicit access permissions to the repository
	 */
	List<String> getRepositoryTeams(RepositoryModel repository);

	/**
	 * Adds the repository to the list of cached repositories if Gitblit is
	 * configured to cache the repository list.
	 *
	 * @param model
	 */
	void addToCachedRepositoryList(RepositoryModel model);

	/**
	 * Resets the repository list cache.
	 *
	 */
	void resetRepositoryListCache();

	/**
	 * Returns the list of all repositories available to Gitblit. This method
	 * does not consider user access permissions.
	 *
	 * @return list of all repositories
	 */
	List<String> getRepositoryList();

	/**
	 * Returns the JGit repository for the specified name.
	 *
	 * @param repositoryName
	 * @return repository or null
	 */
	Repository getRepository(String repositoryName);

	/**
	 * Returns the JGit repository for the specified name.
	 *
	 * @param repositoryName
	 * @param logError
	 * @return repository or null
	 */
	Repository getRepository(String repositoryName, boolean logError);

	/**
	 * Returns the list of repository models that are accessible to the user.
	 *
	 * @param user
	 * @return list of repository models accessible to user
	 */
	List<RepositoryModel> getRepositoryModels(UserModel user);

	/**
	 * Returns a repository model if the repository exists and the user may
	 * access the repository.
	 *
	 * @param user
	 * @param repositoryName
	 * @return repository model or null
	 */
	RepositoryModel getRepositoryModel(UserModel user, String repositoryName);

	/**
	 * Returns the repository model for the specified repository. This method
	 * does not consider user access permissions.
	 *
	 * @param repositoryName
	 * @return repository model or null
	 */
	RepositoryModel getRepositoryModel(String repositoryName);

	/**
	 * Returns the star count of the repository.
	 *
	 * @param repository
	 * @return the star count
	 */
	long getStarCount(RepositoryModel repository);

	/**
	 * Determines if this server has the requested repository.
	 *
	 * @param n
	 * @return true if the repository exists
	 */
	boolean hasRepository(String repositoryName);

	/**
	 * Determines if this server has the requested repository.
	 *
	 * @param n
	 * @param caseInsensitive
	 * @return true if the repository exists
	 */
	boolean hasRepository(String repositoryName, boolean caseSensitiveCheck);

	/**
	 * Determines if the specified user has a fork of the specified origin
	 * repository.
	 *
	 * @param username
	 * @param origin
	 * @return true the if the user has a fork
	 */
	boolean hasFork(String username, String origin);

	/**
	 * Gets the name of a user's fork of the specified origin
	 * repository.
	 *
	 * @param username
	 * @param origin
	 * @return the name of the user's fork, null otherwise
	 */
	String getFork(String username, String origin);

	/**
	 * Returns the fork network for a repository by traversing up the fork graph
	 * to discover the root and then down through all children of the root node.
	 *
	 * @param repository
	 * @return a ForkModel
	 */
	ForkModel getForkNetwork(String repository);

	/**
	 * Updates the last changed fields and optionally calculates the size of the
	 * repository.  Gitblit caches the repository sizes to reduce the performance
	 * penalty of recursive calculation. The cache is updated if the repository
	 * has been changed since the last calculation.
	 *
	 * @param model
	 * @return size in bytes of the repository
	 */
	long updateLastChangeFields(Repository r, RepositoryModel model);

	/**
	 * Returns the metrics for the default branch of the specified repository.
	 * This method builds a metrics cache. The cache is updated if the
	 * repository is updated. A new copy of the metrics list is returned on each
	 * call so that modifications to the list are non-destructive.
	 *
	 * @param model
	 * @param repository
	 * @return a new array list of metrics
	 */
	List<Metric> getRepositoryDefaultMetrics(RepositoryModel model, Repository repository);

	/**
	 * Creates/updates the repository model keyed by reopsitoryName. Saves all
	 * repository settings in .git/config. This method allows for renaming
	 * repositories and will update user access permissions accordingly.
	 *
	 * All repositories created by this method are bare and automatically have
	 * .git appended to their names, which is the standard convention for bare
	 * repositories.
	 *
	 * @param repositoryName
	 * @param repository
	 * @param isCreate
	 * @throws GitBlitException
	 */
	void updateRepositoryModel(String repositoryName, RepositoryModel repository, boolean isCreate)
			throws GitBlitException;

	/**
	 * Updates the Gitblit configuration for the specified repository.
	 *
	 * @param r
	 *            the Git repository
	 * @param repository
	 *            the Gitblit repository model
	 */
	void updateConfiguration(Repository r, RepositoryModel repository);

	/**
	 * Deletes the repository from the file system and removes the repository
	 * permission from all repository users.
	 *
	 * @param model
	 * @return true if successful
	 */
	boolean deleteRepositoryModel(RepositoryModel model);

	/**
	 * Deletes the repository from the file system and removes the repository
	 * permission from all repository users.
	 *
	 * @param repositoryName
	 * @return true if successful
	 */
	boolean deleteRepository(String repositoryName);

	/**
	 * Returns the list of all Groovy push hook scripts. Script files must have
	 * .groovy extension
	 *
	 * @return list of available hook scripts
	 */
	List<String> getAllScripts();

	/**
	 * Returns the list of pre-receive scripts the repository inherited from the
	 * global settings and team affiliations.
	 *
	 * @param repository
	 *            if null only the globally specified scripts are returned
	 * @return a list of scripts
	 */
	List<String> getPreReceiveScriptsInherited(RepositoryModel repository);

	/**
	 * Returns the list of all available Groovy pre-receive push hook scripts
	 * that are not already inherited by the repository. Script files must have
	 * .groovy extension
	 *
	 * @param repository
	 *            optional parameter
	 * @return list of available hook scripts
	 */
	List<String> getPreReceiveScriptsUnused(RepositoryModel repository);

	/**
	 * Returns the list of post-receive scripts the repository inherited from
	 * the global settings and team affiliations.
	 *
	 * @param repository
	 *            if null only the globally specified scripts are returned
	 * @return a list of scripts
	 */
	List<String> getPostReceiveScriptsInherited(RepositoryModel repository);

	/**
	 * Returns the list of unused Groovy post-receive push hook scripts that are
	 * not already inherited by the repository. Script files must have .groovy
	 * extension
	 *
	 * @param repository
	 *            optional parameter
	 * @return list of available hook scripts
	 */
	List<String> getPostReceiveScriptsUnused(RepositoryModel repository);

	/**
	 * Search the specified repositories using the Lucene query.
	 *
	 * @param query
	 * @param page
	 * @param pageSize
	 * @param repositories
	 * @return
	 */
	List<SearchResult> search(String query, int page, int pageSize, List<String> repositories);

	/**
	 *
	 * @return true if we are running the gc executor
	 */
	boolean isCollectingGarbage();

	/**
	 * Returns true if Gitblit is actively collecting garbage in this repository.
	 *
	 * @param repositoryName
	 * @return true if actively collecting garbage
	 */
	boolean isCollectingGarbage(String repositoryName);

}


text:
"""
--------------------------------------------------------------------------------
Created:   Jackson Lee 7/1/14
This script reads in a fastq file and a text file of numbers and filters all
sequences in order

Input fasta file format:
Input fastq file
@2402:1:1101:1392:2236/2
CATAGTCTTCGGCGCCATCGTCATCCTCTACACCCTCAAGGCGAGCGGCGCGATGGAGACAATCCAGTGGGGCATGCAGCAGGTGACACCGGACTCCCGGATCCA
+
@@CFFFFFGHHHHIJJIIJIHIJIIIIJIIGEIJJIJJJJJIIIJHFFDDBD8BBD>BCBCCDDDCDCCCDBDDDDDDDDDDD<CDDDDDDDDBBCDDBD<<BDD

Input filter file format:
one number per line matching the sequence order number in order. 0 being first

0
5
10
22
etc.

Output file format:
sequence.filtered.fastq

--------------------------------------------------------------------------------
usage:   filter_fastq_by_linenum.py -i input.fastq -f filter.txt
"""

#-------------------------------------------------------------------------------
#Header - Linkers, Libs, Constants
from string import strip
from argparse import ArgumentParser, RawDescriptionHelpFormatter
import sys
#sys.path.insert(0, '~/bin/')
from Bio import SeqIO

#-------------------------------------------------------------------------------
#function declarations

def process_and_generate(input_iterator, filterfile, filterflag):
    """Reusable function that processes a record, then generates each record.

    input_iterator is an iterator that returns one record at a time
    process_function is a function that takes one record and does some
      processing on it
    """

    for count, rec in input_iterator:
        global linenum_next
        if filterflag:
            if count+1 == linenum_next:
                linenum_next = int(filterfile.next().strip())
            else:
                #print count+1
                yield rec
        else:
            if count+1 == linenum_next:
                linenum_next = int(filterfile.next().strip())
                #print count+1
                yield rec

#-------------------------------------------------------------------------------
#Body
print "Running..."

if __name__ == '__main__':
    parser = ArgumentParser(usage = "filter_fastq_by_linenum.py -i input.fastq -f filter.txt",
                            description=__doc__,
                            formatter_class=RawDescriptionHelpFormatter)
    parser.add_argument("-i", "--input_fasta", action="store",
                        dest="inputfilename",
                        help="fastq file of input sequences")
    parser.add_argument("-f", "--filter_text", action="store",
                        dest="filterfilename",
                        help="filter text file (See DocString for format)")
    parser.add_argument("-r", "--reverse_filter_flag", action="store_true",
                        dest="reverseflag",
                        help="set to enable exclusion filtering")
    options = parser.parse_args()

    mandatories = ["inputfilename", "filterfilename"]
    for m in mandatories:
        if not options.__dict__[m]:
            print "\nError: Missing Arguments\n"
            parser.print_help()
            exit(-1)

    inputfilename = options.inputfilename
    filterfilename = options.filterfilename
    left, __, right = inputfilename.rpartition('.')
    outputfilename = left +'.filtered.' + right

    with open(filterfilename, 'U') as filterfile:
        linenum_next = int(filterfile.next().strip())

    print "Opening and parsing..."
    if options.reverseflag:
        print "Exclusion filtering enabled.  Saving sequences not in " + filterfilename
        outputfilename = left +'.exclusion.filtered.' + right
    with open(outputfilename, 'w') as outfile, open(inputfilename, 'U') as inputfile:
        parse_iterator = SeqIO.parse(inputfile, "fastq")
        record_generator = enumerate(parse_iterator)
        SeqIO.write(process_and_generate(record_generator, filterfile, options.reverseflag), outfile, "fastq")

    #SeqIO.write([fastq_record for fastqcount, fastq_record in enumerate(SeqIO.parse(inputfile, "fastq")) if fastqcount+1 in linenums], outfile, "fastq")
    #for fastqcount, fastq_record in enumerate(SeqIO.parse(inputfile, "fastq")):
    #    if fastqcount+1 in linenums:
            #print "seq " + str(fastqcount)
    #        linenums.remove(fastqcount)
    #        SeqIO.write(fastq_record, outfile, "fastq")
    #outfile.close()
    #filterfile.close()

    print "Done!"


text:
Modules
=============
The modules which interagte Semantic-Ui in react components.

# Accordion
A standard Accordion.

### Example

```html
<Accordion className="exampleaccordion" init={true}></Accordion>
```

is equal to

```html
<div class="ui accordion examplebutton"></div>
```

and call below Sementic-ui init function when element in the `componentDidMount` life cycle.
```js
$('.ui.accordion').accordion();
```

You also can use `init={param}` to transfer parameter.

ex.
```js
<Accordion init='refresh'></Accordion>
```

will transfer `'refresh'` to init function.

```js
$('.ui.accordion').accordion('refresh');
```

### Properties

- *init*: You can see [Accordion usage](http://semantic-ui.com/modules/accordion.html#/usage) on the Semantic-ui web site.

# Checkbox
A standard Checkbox.

### Example

```html
<Checkbox className="examplecheckbox" init={true}></Checkbox>
```

is equal to

```html
<div class="ui checkbox examplecheckbox"></div>
```

and call below Sementic-ui init function when element in the `componentDidMount` life cycle.
```js
$('.ui.checkbox').checkbox();
```

You also can use `init={param}` to transfer parameter.

ex.
```js
<Checkbox init={{uncheckable: false}}></Checkbox>
```

will transfer `{uncheckable: false}` to init function.

```js
$('.ui.checkbox').checkbox({uncheckable: false});
```

### Properties

- *init*: You can see [Checkbox usage](http://semantic-ui.com/modules/checkbox.html#/usage) on the Semantic-ui web site.
- *disabled*: This is a booling type. If `true`, the `disabled` would be part of `class` attribute.
- *readOnly*: This is a booling type. If `true`, the `read-only` would be part of `class` attribute.

# Dimmer
A standard Dimmer.

### Example

```html
<Dimmer className="exampledimmer" init={true}></Dimmer>
```

is equal to

```html
<div class="ui dimmer exampledimmer"></div>
```

and call below Sementic-ui init function when element in the `componentDidMount` life cycle.
```js
$('.ui.dimmer').dimmer();
```

You also can use `init={param}` to transfer parameter.

ex.
```js
<Dimmer init={{on: 'hover'}}></Dimmer>
```

will transfer `{{on: 'hover'}}` to init function.

```js
$('.ui.dimmer').dimmer({on: 'hover'});
```

### Properties

- *init*: You can see [Dimmer usage](http://semantic-ui.com/modules/dimmer.html#/usage) on the Semantic-ui web site.
- *disabled*: This is a booling type. If `true`, the `disabled` would be part of `class` attribute.
- *active*: This is a booling type. If `true`, the `active` would be part of `class` attribute.

# Dropdown
A standard Dropdown.

### Example

```html
<Dropdown className="exampledropdown" init={true}></Dropdown>
```

is equal to

```html
<div class="ui dropdown exampledropdown"></div>
```

and call below Sementic-ui init function when element in the `componentDidMount` life cycle.
```js
$('.ui.dropdown').dropdown();
```

You also can use `init={param}` to transfer parameter.

ex.
```js
<Dropdown init={{transition: 'drop'}}></Dropdown>
```

will transfer `{{transition: 'drop'}}` to init function.

```js
$('.ui.dropdown').dropdown({transition: 'drop'});
```

### Properties

- *init*: You can see [Dropdown usage](http://semantic-ui.com/modules/dropdown.html#/usage) on the Semantic-ui web site.
- *disabled*: This is a booling type. If `true`, the `disabled` would be part of `class` attribute.
- *active*: This is a booling type. If `true`, the `active` would be part of `class` attribute.
- *error*: This is a booling type. If `true`, the `error` would be part of `class` attribute.

# Modal
A standard Modal.

### Example

```html
<Modal className="examplemodal" init={true}></Modal>
```

is equal to

```html
<div class="ui modal examplemodal"></div>
```

and call below Sementic-ui init function when element in the `componentDidMount` life cycle.
```js
$('.ui.modal').modal();
```

You also can use `init={param}` to transfer parameter.

ex.
```js
<Modal init='show'></Modal>
```

will transfer `'show'` to init function.

```js
$('.ui.modal').modal('show');
```

### Properties

- *init*: You can see [Modal usage](http://semantic-ui.com/modules/modal.html#/usage) on the Semantic-ui web site.
- *active*: This is a booling type. If `true`, the `active` would be part of `class` attribute.

# Popup
A standard Popup. This is a Pre-Existing popup usage. The inline popup will comming.

### Example

```html
<Popup className="examplepopup"></Popup>
```

is equal to

```html
<div class="ui popup examplepopup"></div>
```

and you can trigger popup by jQuery method.
```js
$('.custom.button').popup({
  popup: $('.custom.popup'),
  on: 'click'
});
```
```html
<Button className="custom">Show custom popup</Button>
<Popup className="custom">Hi! I'm custom popup</Popup>
```

### Properties

# Progress
A standard Progress.

### Example

```html
<Progress className="exampleprogress" init={true}></Progress>
```

is equal to

```html
<div class="ui progress exampleprogress"></div>
```

and call below Sementic-ui init function when element in the `componentDidMount` life cycle.
```js
$('.ui.progress').progress();
```

You also can use `init={param}` to transfer parameter.

ex.
```js
<Progress init={{percent: 22}}></Progress>
```

will transfer `{percent: 22}` to init function.

```js
$('.ui.progress').progress({percent: 22});
```

### Properties

- *init*: You can see [Progress usage](http://semantic-ui.com/modules/progress.html#/usage) on the Semantic-ui web site.
- *percent*: This is a string type. Use to be a progress `data-percent` state. You can see [Progress usage](http://semantic-ui.com/modules/progress.html#/usage) for more detail.
- *value*: This is a string type. Use to be a progress `data-value` state. You can see [Progress usage](http://semantic-ui.com/modules/progress.html#/usage) for more detail.
- *total*: This is a string type. Use to be a progress `data-total` state. You can see [Progress usage](http://semantic-ui.com/modules/progress.html#/usage) for more detail.
- *active*: This is a booling type. If `true`, the `active` would be part of `class` attribute.
- *success*: This is a booling type. If `true`, the `success` would be part of `class` attribute.
- *warning*: This is a booling type. If `true`, the `warning` would be part of `class` attribute.
- *error*: This is a booling type. If `true`, the `error` would be part of `class` attribute.
- *disabled*: This is a booling type. If `true`, the `disabled` would be part of `class` attribute.

# Rating
A standard Rating.

### Example

```html
<Rating className="examplerating" init={true}></Rating>
```

is equal to

```html
<div class="ui rating examplerating"></div>
```

and call below Sementic-ui init function when element in the `componentDidMount` life cycle.
```js
$('.ui.rating').rating();
```

You also can use `init={param}` to transfer parameter.

ex.
```js
<Rating init={{initialRating: 3, maxRating: 5}}></Rating>
```

will transfer `{initialRating: 3, maxRating: 5}` to init function.

```js
$('.ui.rating').rating({initialRating: 3, maxRating: 5});
```

### Properties

- *init*: You can see [Rating usage](http://semantic-ui.com/modules/rating.html#/usage) on the Semantic-ui web site.
- *rating*: This is a string type. Use to be a rating `data-rating` state. You can see [Rating usage](http://semantic-ui.com/modules/rating.html#/usage) for more detail.
- *maxRating*: This is a string type. Use to be a rating `data-max-rating` state. You can see [Rating usage](http://semantic-ui.com/modules/rating.html#/usage) for more detail.

# Search
A standard Search.

### Example

```html
<Search className="examplesearch" init={true}></Search>
```

is equal to

```html
<div class="ui search examplesearch"></div>
```

and call below Sementic-ui init function when element in the `componentDidMount` life cycle.
```js
$('.ui.search').search();
```

You also can use `init={param}` to transfer parameter.

ex.
```js
<Search init={{type: 'category'}}></Search>
```

will transfer `{type: 'category'}` to init function.

```js
$('.ui.search').search({type: 'category'});
```

### Properties

- *init*: You can see [Search usage](http://semantic-ui.com/modules/search.html#/usage) on the Semantic-ui web site.
- *loading*: This is a booling type. If `true`, the `loading` would be part of `class` attribute.

# Shape
A standard Shape.

### Example

```html
<Shape className="exampleshape" init={true}></Shape>
```

is equal to

```html
<div class="ui shape exampleshape"></div>
```

and call below Sementic-ui init function when element in the `componentDidMount` life cycle.
```js
$('.ui.shape').shape();
```

You also can use `init={param}` to transfer parameter.

ex.
```js
<Shape init='flip up'}></Shape>
```

will transfer `'flip up'` to init function.

```js
$('.ui.shape').shape('flip up');
```

### Properties

- *init*: You can see [Shape usage](http://semantic-ui.com/modules/shape.html#/usage) on the Semantic-ui web site.

# Sidebar
A standard Sidebar.

### Example

```html
<Sidebar className="examplesidebar" init={true}></Sidebar>
```

is equal to

```html
<div class="ui sidebar examplesidebar"></div>
```

and call below Sementic-ui init function when element in the `componentDidMount` life cycle.
```js
$('.ui.sidebar').sidebar();
```

You also can use `init={param}` to transfer parameter.

ex.
```js
<Sidebar init='show'></Sidebar>
```

will transfer `'show'` to init function.

```js
$('.ui.sidebar').sidebar('show');
```

### Properties

- *init*: You can see [Sidebar usage](http://semantic-ui.com/modules/sidebar.html#/usage) on the Semantic-ui web site.

# Sticky
A standard Sticky.

### Example

```html
<Sticky className="examplesticky" init={true}></Sticky>
```

is equal to

```html
<div class="ui sticky examplesticky"></div>
```

and call below Sementic-ui init function when element in the `componentDidMount` life cycle.
```js
$('.ui.sticky').sticky();
```

You also can use `init={param}` to transfer parameter.

ex.
```js
<Sticky init={{context: '#example'}}></Sticky>
```

will transfer `{context: '#example'}` to init function.

```js
$('.ui.sticky').sticky({context: '#example'});
```

### Properties

- *init*: You can see [Sticky usage](http://semantic-ui.com/modules/sticky.html#/usage) on the Semantic-ui web site.

# Tab
A standard Tab.

### Example

```html
<Tab className="exampletab" init={true}></Tab>
```

is equal to

```html
<div class="ui tab exampletab"></div>
```

and call below Sementic-ui init function when element in the `componentDidMount` life cycle.
```js
$('.ui.tab').tab();
```

You also can use `init={param}` to transfer parameter.

ex.
```js
<Tab init={{history: true, historyType: 'hash'}}></Tab>
```

will transfer `{history: true, historyType: 'hash'}` to init function.

```js
$('.ui.tab').tab({history: true, historyType: 'hash'});
```

### Properties

- *init*: You can see [Tab usage](http://semantic-ui.com/modules/tab.html#/usage) on the Semantic-ui web site.
- *active*: This is a booling type. If `true`, the `active` would be part of `class` attribute.
- *loading*: This is a booling type. If `true`, the `loading` would be part of `class` attribute.


text:
var reviewController = {};

reviewController.insert = function(req, res) {
};

module.exports = foodController;


text:
``tornado.options`` --- Command-line parsing
============================================

.. automodule:: tornado.options

   Global functions
   ----------------

   .. autofunction:: define

   .. py:data:: options

       Global options object.  All defined options are available as attributes
       on this object.

   .. autofunction:: parse_command_line
   .. autofunction:: parse_config_file
   .. autofunction:: print_help(file=sys.stderr)
   .. autofunction:: add_parse_callback
   .. autoexception:: Error

   OptionParser class
   ------------------

   .. autoclass:: OptionParser

   .. automethod:: OptionParser.define
   .. automethod:: OptionParser.parse_command_line
   .. automethod:: OptionParser.parse_config_file
   .. automethod:: OptionParser.print_help
   .. automethod:: OptionParser.add_parse_callback
   .. automethod:: OptionParser.mockable
   .. automethod:: OptionParser.items
   .. automethod:: OptionParser.as_dict
   .. automethod:: OptionParser.groups
   .. automethod:: OptionParser.group_dict


text:
#include "Runtime/World/CDestroyableRock.hpp"
#include "Runtime/World/CActorParameters.hpp"
#include "Runtime/CPlayerState.hpp"
#include "Runtime/CStateManager.hpp"
#include "TCastTo.hpp" // Generated file, do not modify include path
namespace metaforce {

CDestroyableRock::CDestroyableRock(TUniqueId id, bool active, std::string_view name, const CEntityInfo& info,
                                   const zeus::CTransform& xf, CModelData&& modelData, float mass,
                                   const CHealthInfo& health, const CDamageVulnerability& vulnerability,
                                   const CMaterialList& matList, CAssetId fsm, const CActorParameters& actParams,
                                   const CStaticRes& phazonModel, s32 w1)
: CAi(id, active, name, info, xf, std::move(modelData), modelData.GetBounds(), mass, health, vulnerability, matList,
      fsm, actParams, 0.3f, 0.8f)
, x2d8_phazonModel(phazonModel)
, x32c_thermalMag(actParams.GetThermalMag())
, x338_healthInfo(health)
, x341_(w1 != 0) {
  /* This is now in UsePhazonModel
  x2d8_phazonModel->SetSortThermal(true);
   */
  CreateShadow(false);
}

void CDestroyableRock::Accept(metaforce::IVisitor& visitor) { visitor.Visit(this); }
void CDestroyableRock::PreRender(CStateManager& mgr, const zeus::CFrustum& frustum) {
  if (GetActive()) {
    if (mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::EPlayerVisor::Thermal) {
      xb4_drawFlags = CModelFlags(0, 0, 1, zeus::skWhite);
    } else {
      u8 r;
      u8 g;
      u8 b;
      u8 a;
      x330_.toRGBA8(r, g, b, a);
      if ((r & g & b) == 0xFF) {
        xb4_drawFlags = CModelFlags(0, 0, 3, zeus::skWhite);
      } else {
        x330_.a() = 1.f;
        xb4_drawFlags = CModelFlags(2, 0, 3, x330_);
      }
    }
  }

  CActor::PreRender(mgr, frustum);
}
void CDestroyableRock::Think(float dt, CStateManager& mgr) {
  if (!GetActive()) {
    return;
  }

  float damageMag = x32c_thermalMag;
  if (x324_ > 0.f) {
    x324_ = std::max(0.f, x324_ - dt);
    zeus::CColor tmpColor = zeus::CColor(0.5, 0.f, 0.f, 1.f);
    // TODO: Use skBlack once CModelFlags is properly reverse engineered
    x330_ = zeus::CColor::lerp(/*zeus::skBlack*/ zeus::skWhite, tmpColor, x324_);
    damageMag = ((x335_usePhazonModel ? 0.5f : 0.25f) * x324_) + damageMag;
  }
  xd0_damageMag = damageMag;
  CEntity::Think(dt, mgr);
}
} // namespace metaforce


text:
package edu.uci.python.runtime.builtin;

import edu.uci.python.runtime.*;
import edu.uci.python.runtime.standardtype.*;

/**
 * Storage for initialized Python built-in modules and types.
 *
 * @author zwei
 *
 */
public interface PythonBuiltinsLookup {

    PythonModule populateBuiltins(PythonContext context);

    PythonModule lookupModule(String name);

    PythonBuiltinClass lookupType(Class<? extends PythonBuiltinObject> clazz);

}


text:
<?php

require_once 'lib/init.php';

require_once Config::get('prefix') . '/templates/header.inc.php';

/* Switch on Action */
switch ($_REQUEST['action']) {
	case 'clear_art':
		if (!$GLOBALS['user']->has_access('75')) { access_denied(); }
		$album = new Album($_REQUEST['album_id']);
		$album->clear_art();
		show_confirmation(_('Album Art Cleared'),_('Album Art information has been removed from the database'),"/albums.php?action=show&album=" . $album->id);
	break;
	// Upload album art
	case 'upload_art':

		// we didn't find anything
		if (empty($_FILES['file']['tmp_name'])) {
			show_confirmation(_('Album Art Not Located'),_('Album Art could not be located at this time. This may be due to write access error, or the file is not received correctly.'),"/albums.php?action=show&album=" . $album->id);
			break;
		}

		$album = new Album($_REQUEST['album_id']);

		// Pull the image information
		$data = array('file'=>$_FILES['file']['tmp_name']);
		$image_data = Album::get_image_from_source($data);

		// If we got something back insert it
		if ($image_data) {
			$album->insert_art($image_data,$_FILES['file']['type']);
			show_confirmation(_('Album Art Inserted'),'',"/albums.php?action=show&album=" . $album->id);
		}
		// Else it failed
		else {
			show_confirmation(_('Album Art Not Located'),_('Album Art could not be located at this time. This may be due to write access error, or the file is not received correctly.'),"/albums.php?action=show&album=" . $album->id);
		}

	break;
	case 'find_art':

		// If not a user then kick em out
		if (!Access::check('interface','25')) { access_denied(); exit; }

		// get the Album information
	        $album = new Album($_REQUEST['album_id']);
		$album->format();
		$images = array();
		$cover_url = array();

		// If we've got an upload ignore the rest and just insert it
		if (!empty($_FILES['file']['tmp_name'])) {
			$path_info = pathinfo($_FILES['file']['name']);
			$upload['file'] = $_FILES['file']['tmp_name'];
			$upload['mime'] = 'image/' . $path_info['extension'];
			$image_data = Album::get_image_from_source($upload);

			if ($image_data) {
				$album->insert_art($image_data,$upload['0']['mime']);
				show_confirmation(_('Album Art Inserted'),'',"/albums.php?action=show&album=" . $_REQUEST['album_id']);
				break;

			} // if image data

		} // if it's an upload

		// Build the options for our search
		if (isset($_REQUEST['artist_name'])) {
			$artist = scrub_in($_REQUEST['artist_name']);
		}
		elseif ($album->artist_count == '1') {
			$artist = $album->f_artist_name;
		}
		if (isset($_REQUEST['album_name'])) {
			$album_name = scrub_in($_REQUEST['album_name']);
		}
		else {
			$album_name = $album->full_name;
		}

		$options['artist'] 	= $artist;
		$options['album_name']	= $album_name;
		$options['keyword']	= $artist . " " . $album_name;

		// Attempt to find the art.
		$images = $album->find_art($options,'6');

		if (!empty($_REQUEST['cover'])) {
			$path_info = pathinfo($_REQUEST['cover']);
			$cover_url[0]['url'] 	= scrub_in($_REQUEST['cover']);
			$cover_url[0]['mime'] 	= 'image/' . $path_info['extension'];
		}
		$images = array_merge($cover_url,$images);

		// If we've found anything then go for it!
		if (count($images)) {
			// We don't want to store raw's in here so we need to strip them out into a seperate array
			foreach ($images as $index=>$image) {
				if ($image['raw']) {
					unset($images[$index]['raw']);
				}
			} // end foreach
			// Store the results for further use
			$_SESSION['form']['images'] = $images;
			require_once Config::get('prefix') . '/templates/show_album_art.inc.php';
		}
		// Else nothing
		else {
			show_confirmation(_('Album Art Not Located'),_('Album Art could not be located at this time. This may be due to write access error, or the file is not received correctly.'),"/albums.php?action=show&album=" . $album->id);
		}

		$albumname = $album->name;
		$artistname = $artist;

		// Remember the last typed entry, if there was one
		if (!empty($_REQUEST['album_name'])) {   $albumname = scrub_in($_REQUEST['album_name']); }
		if (!empty($_REQUEST['artist_name'])) {  $artistname = scrub_in($_REQUEST['artist_name']); }

		require_once Config::get('prefix') . '/templates/show_get_albumart.inc.php';

	break;
	case 'select_art':

		/* Check to see if we have the image url still */
		$image_id = $_REQUEST['image'];
		$album_id = $_REQUEST['album_id'];

		$image 	= Album::get_image_from_source($_SESSION['form']['images'][$image_id]);
		$mime	= $_SESSION['form']['images'][$image_id]['mime'];

		$album = new Album($album_id);
		$album->insert_art($image,$mime);

		header("Location:" . Config::get('web_path') . "/albums.php?action=show&album=" . $album->id);
	break;
	case 'update_from_tags':
		// Make sure they are a 'power' user at least
		if (!Access::check('interface','75')) {
			access_denied();
			exit;
		}

		$type 		= 'album';
		$object_id 	= intval($_REQUEST['album_id']);
		$target_url	= Config::get('web_path') . '/albums.php?action=show&album=' . $object_id;
		require_once Config::get('prefix') . '/templates/show_update_items.inc.php';
	break;
	// Browse by Album
	default:
	case 'show':
		$album = new Album($_REQUEST['album']);
		$album->format();
		Browse::reset_filters();
		require Config::get('prefix') . '/templates/show_album.inc.php';

	break;
} // switch on view

show_footer();
?>


text:
  {{ pub['title'] }}<span
  *ngIf="i+1 < publications.length">,


text:
const path = require('path');

const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const ManifestPlugin = require('webpack-manifest-plugin');
const S3Plugin = require('webpack-s3-plugin');

const config = require('./config/main');

module.exports = function (env) {
  const webpackConfig = {
    entry: {
      app: [
        './client/client.jsx',
      ],
      vendor: [
        'babel-polyfill',
        'react',
        'react-dom',
      ],
    },
    output: {
      path: path.resolve(__dirname, 'build'),
      filename: 'public/[name].[chunkhash].js',
      publicPath: config.cdn,
    },
    resolve: {
      alias: {
      },
      modules: [
        'node_modules',
        path.resolve(__dirname, 'client'),
      ],
      extensions: [
        '*',
        '.js',
        '.json',
        '.jsx',
      ],
    },
    module: {
      loaders: [
        {
          test: /\.css$/,
          loader: ExtractTextPlugin.extract({
            fallbackLoader: 'style-loader',
            loader: 'css-loader',
          }),
        },
        { test: /\.gql(\?.*)?$/, loader: 'raw-loader' },
        { test: /\.(jpg|png|gif)$/, loader: 'file-loader?name=public/img/[hash].[ext]' },
        { test: /\.json$/, loader: 'json-loader' },
        {
          test: /\.(eot|ttf|woff|woff2|svg)$/,
          loader: 'file?name=public/fonts/[name].[ext]',
        },
        {
          test: /\.jsx?$/,
          exclude: /(node_modules)/,
          loader: 'babel-loader',
        },
      ],
    },
    plugins: [
      new CleanWebpackPlugin(['build']),
      new webpack.ProvidePlugin({
        React: 'react',
        ReactDOM: 'react-dom',
      }),
      new webpack.DefinePlugin({
        isBrowser: JSON.stringify(false),
        __env: JSON.stringify(),
        'process.env': {
          // This has effect on the react lib size
          NODE_ENV: JSON.stringify('production'),
        },
      }),
      new ExtractTextPlugin('public/bundle.[contenthash].css'),
      new webpack.optimize.CommonsChunkPlugin({
        name: 'vendor',
        filename: 'public/vendor.[chunkhash].js',
      }),
      new webpack.optimize.UglifyJsPlugin({
        compress: {
          warnings: false,
        },
      }),
      new ManifestPlugin(),
    ],
    devtool: 'source-map',
    stats: {
      children: false,
      assets: false,
      colors: true,
      version: false,
      hash: false,
      timings: false,
      chunks: false,
      chunkModules: false,
    },
  };

  if (!env.noDeploy) {
    webpackConfig.plugins.push(new S3Plugin({
      directory: 'build',
      s3Options: {
        accessKeyId: process.env.AWS_KEY,
        secretAccessKey: process.env.AWS_SECRET,
        region: env.region,
      },
      s3UploadOptions: {
        Bucket: env.bucket,
      },
      cacheOptions: {
        cacheControl: 'max-age=315360000, no-transform, public',
      },
    }));
  }

  return webpackConfig;
};


text:
const check = require("check-types");
const clone = require("clone");
const log = require("debug")("bow:Bow");
const deepFreeze = require("deep-freeze");

const assert = require("./utils/assert");
const InboundServer = require("./InboundServer");
const normalizeVersion = require("./utils/normalizeVersion");
const Server = require("./Server");

const validateMiddlewareConfig = (middlewareConfig) => {
  if (check.assigned(middlewareConfig)) {
    assert.object(middlewareConfig, "config.middleware");
    if (check.assigned(middlewareConfig.logInterval)) {
      assert.integer(middlewareConfig.logInterval, "config.middleware.logInterval");
    }
  }
};

const validateInboundConfig = (inboundConfig) => {
  assert.object(inboundConfig, "config.inbound");
  assert.nonEmptyString(inboundConfig.realm, "config.inbound.realm");
  assert.nonEmptyString(inboundConfig.username, "config.inbound.username");
  assert.nonEmptyString(inboundConfig.password, "config.inbound.password");
};

const validateOutboundConfig = (outboundConfig) => {
  assert.object(outboundConfig, "config.outbound");
  assert.integer(outboundConfig.timeout, "config.outbound.timeout");
  assert.positive(outboundConfig.timeout, "config.outbound.timeout");
};

const validateConfig = (config) => {
  assert.object(config, "config");
  assert.integer(config.port, "config.port");
  assert.positive(config.port, "config.port");
  if (check.assigned(config.https)) {
    assert.object(config.https, "config.https");
  } else {
    log("WARNING: no HTTPS config has been provided, your Bow server will run on HTTP");
  }
  if (check.assigned(config.redis)) {
    assert.redisConfig(config.redis);
  } else {
    log("WARNING: no Redis config has been provided, your Bow server will be inconsistent if deployed on a clustered environment");
  }
  validateMiddlewareConfig(config.middleware);
  validateInboundConfig(config.inbound);
  validateOutboundConfig(config.outbound);
};

const findDuplicates = (array) => {
  const counts = new Map();
  array.forEach((element) => {
    const count = counts.get(element);
    counts.set(element, (check.assigned(count) ? count : 0) + 1);
  });
  return Array.from(counts.keys())
    .filter((count) => 1 < counts.get(count));
};

function validateMiddlewareState(middlewareVersions, inboundMiddlewareVersions, outboundMiddlewareVersions) {
  const middlewareDuplicatedVersions = findDuplicates(middlewareVersions);
  if (0 < middlewareDuplicatedVersions.length) {
    throw new Error(`Some middlewares have duplicated versions: 'v${middlewareDuplicatedVersions.join("', 'v")}'`);
  }
  const unusedByInboundsMiddlewareVersions = middlewareVersions.filter((middlewareVersion) =>
    inboundMiddlewareVersions.indexOf(middlewareVersion) < 0);
  if (0 < unusedByInboundsMiddlewareVersions.length) {
    throw new Error(`Some middlewares are unused by inbounds: 'v${unusedByInboundsMiddlewareVersions.join("', 'v")}'`);
  }
  const unusedByOutboundsMiddlewareVersions = middlewareVersions.filter((middlewareVersion) =>
    outboundMiddlewareVersions.indexOf(middlewareVersion) < 0);
  if (0 < unusedByOutboundsMiddlewareVersions.length) {
    throw new Error(`Some middlewares are unused by outbounds: 'v${unusedByOutboundsMiddlewareVersions.join("', 'v")}'`);
  }
}

function validateBoundState(boundName, idName, middlewareVersions, boundMiddlewareVersions) {
  const boundDuplicatedPaths = findDuplicates(this[`${boundName}s`].map((bound) => bound[idName]));
  if (0 < boundDuplicatedPaths.length) {
    throw new Error(`Some ${boundName}s have duplicated ${idName}s: '${boundDuplicatedPaths.join("', '")}'`);
  }
  const unexistingBoundMiddlewareVersions = boundMiddlewareVersions.filter((boundMiddlewareVersion) =>
    middlewareVersions.indexOf(boundMiddlewareVersion) < 0);
  if (0 < unexistingBoundMiddlewareVersions.length) {
    throw new Error(`Some ${boundName}s have unexisting middleware versions: 'v${unexistingBoundMiddlewareVersions.join("', 'v")}'`);
  }
}

function validateState() {
  if (0 === this.middlewares.length) {
    throw new Error("No middleware has been registered");
  }
  if (0 === this.inbounds.length) {
    throw new Error("No inbound has been registered");
  }
  if (0 === this.outbounds.length) {
    throw new Error("No outbound has been registered");
  }
  const middlewareVersions = this.middlewares.map((middleware) => middleware.version);
  const inboundMiddlewareVersions = this.inbounds.map((inbound) => inbound.middlewareVersion);
  const outboundMiddlewareVersions = this.outbounds.map((outbound) => outbound.middlewareVersion);
  validateMiddlewareState.call(this, middlewareVersions, inboundMiddlewareVersions, outboundMiddlewareVersions);
  validateBoundState.call(this, "inbound", "path", middlewareVersions, inboundMiddlewareVersions);
  validateBoundState.call(this, "outbound", "version", middlewareVersions, outboundMiddlewareVersions);
}

module.exports = class Bow {

  constructor(config) {
    validateConfig(config);
    const clonedConfig = clone(config);
    if (!check.assigned(clonedConfig.middleware)) {
      clonedConfig.middleware = {};
    }
    this.config = Object.freeze(clonedConfig);
    deepFreeze(this.config.middleware);
    deepFreeze(this.config.inbound);
    deepFreeze(this.config.outbound);
    this.middlewares = [];
    this.inbounds = [];
    this.outbounds = [];
    this.healthCheckDecorator = () => {}; // eslint-disable-line no-empty-function
    Object.seal(this);
  }

  middleware(config) {
    assert.object(config, "middleware's config");
    const normalizedVersion = normalizeVersion(config.version);
    assert.nonEmptyString(normalizedVersion, "middleware's version");
    assert.function(config.createCriteriaFromListenerDetails, "middleware's createCriteriaFromListenerDetails");
    this.middlewares.push(deepFreeze(clone({
      version: normalizedVersion,
      createCriteriaFromListenerDetails: config.createCriteriaFromListenerDetails
    })));
    return this;
  }

  inbound(config) {
    assert.object(config, "inbound's config");
    const normalizedMiddlewareVersion = normalizeVersion(config.middlewareVersion);
    assert.nonEmptyString(config.path, "inbound's path");
    if (InboundServer.healthCheckPath === config.path) {
      throw new Error(`'${config.path}' is reserved, it cannot be used for an inbound`);
    }
    assert.function(config.createMessageFromRequestBody, "inbound's createMessageFromRequestBody");
    assert.nonEmptyString(normalizedMiddlewareVersion, "inbound's middlewareVersion");
    this.inbounds.push(deepFreeze(clone({
      path: config.path,
      createMessageFromRequestBody: config.createMessageFromRequestBody,
      middlewareVersion: normalizedMiddlewareVersion
    })));
    return this;
  }

  outbound(config) {
    assert.object(config, "outbound's config");
    const normalizedVersion = normalizeVersion(config.version);
    const normalizedMiddlewareVersion = normalizeVersion(config.middlewareVersion);
    assert.nonEmptyString(normalizedVersion, "outbound's version");
    assert.function(config.createListenerDetailsFromToken, "outbound's createListenerDetailsFromToken");
    assert.nonEmptyString(normalizedMiddlewareVersion, "outbound's middlewareVersion");
    this.outbounds.push(deepFreeze(clone({
      version: normalizedVersion,
      createListenerDetailsFromToken: config.createListenerDetailsFromToken,
      middlewareVersion: normalizedMiddlewareVersion
    })));
    return this;
  }

  healthCheck(healthCheckDecorator) {
    assert.function(healthCheckDecorator, "health check decorator");
    this.healthCheckDecorator = healthCheckDecorator;
    return this;
  }

  start() {
    validateState.call(this);
    deepFreeze(this.middlewares);
    deepFreeze(this.inbounds);
    deepFreeze(this.outbounds);
    return new Server(this).start();
  }

};


text:
package android.test.anno;

import java.lang.annotation.*;

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@Documented
public @interface AnnoSimpleType {}


text:
package edu.cmu.cs.cloudlet.application.esvmtrainer;

import java.io.File;
import java.io.FilenameFilter;
import java.util.LinkedList;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import edu.cmu.cs.cloudlet.application.esvmtrainer.R;
import edu.cmu.cs.cloudlet.application.esvmtrainer.cropimage.CropImage;
import edu.cmu.cs.cloudlet.application.esvmtrainer.network.ESVMNetworkClient;
import edu.cmu.cs.cloudlet.application.esvmtrainer.util.AnnotatedImageDS;
import edu.cmu.cs.cloudlet.application.esvmtrainer.util.AnnotationDBHelper;
import edu.cmu.cs.cloudlet.application.esvmtrainer.util.ImageAdapter;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.graphics.drawable.Drawable;
import android.content.ActivityNotFoundException;
import android.content.ContentValues;
import android.content.CursorLoader;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Rect;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.provider.MediaStore;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.EditText;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.Toast;

public class AnnotationActivity extends Activity {
	public static final int PIC_CROP = 1121312;
	public static Drawable CHECKMARK_DONE;

	public static final String INTENT_ARGS_IMAGE_DIR = "imageDirectory";
	public static final String INTENT_ARGS_VIDEO_FILE = "video_file_size";

	public static final String CROP_EXT = ".crop";
	private static final String ESVM_SERVER = "hail.elijah.cs.cmu.edu";
	private static final int ESVM_PORT = 9121;

	protected File imageSourceDir = null;
	protected ImageAdapter imageAdapter = null;
	LinkedList<AnnotatedImageDS> allImageList = null;
	private File currentProcessingImage = null;
	private AnnotationDBHelper dbHelper = null;
	private File videoFile = null;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_annotation_main);

		this.CHECKMARK_DONE = getResources().getDrawable(
				R.drawable.checkmark_done);

		// Get information either from bundle or fixed location (for testing)
		Bundle extras = getIntent().getExtras();
		if (extras != null && extras.getString(INTENT_ARGS_IMAGE_DIR) != null) {
			this.imageSourceDir = new File(
					extras.getString(INTENT_ARGS_IMAGE_DIR));
		} else {
			this.imageSourceDir = new File(ESVMTrainActivity.VIDEO_TEST_DIR);
		}
		if (extras != null && extras.getString(INTENT_ARGS_VIDEO_FILE) != null) {
			this.videoFile = new File(extras.getString(INTENT_ARGS_VIDEO_FILE));
		} else {
			this.videoFile = new File(ESVMTrainActivity.VIDEO_TEST_VIDEO_FILE);
		}

		allImageList = new LinkedList<AnnotatedImageDS>();
		File[] imageFiles = this.imageSourceDir.listFiles(new FilenameFilter() {
			@Override
			public boolean accept(File dir, String filename) {
				if (filename.endsWith(".jpg"))
					return true;
				return false;
			}
		});
		for (File originalFile : imageFiles) {
			allImageList.add(new AnnotatedImageDS(originalFile));
		}
		this.dbHelper = new AnnotationDBHelper(this);
		this.dbHelper.updateImageFromDB(allImageList);

		imageAdapter = new ImageAdapter(this, allImageList);
		GridView gridView = (GridView) findViewById(R.id.grid_view);
		gridView.setAdapter(imageAdapter);
		gridView.setOnItemClickListener(clickListener);
		;

		// start training button
		findViewById(R.id.startTraining).setOnClickListener(
				startTrainingListener);
	}

	private void starTraining(String objectName) {
		Log.d("krha", "training object name : " + objectName);
		JSONObject jsonObj = dbHelper.getJSONAnnotation(this.allImageList);
		if (jsonObj != null) {
			// start progress bar
			if (this.progDialog == null) {
				this.progDialog = ProgressDialog.show(this, "Info",
						"Connecting to " + this.ESVM_SERVER, true);
				this.progDialog.setIcon(R.drawable.ic_launcher);
			} else {
				this.progDialog.setMessage("Connecting to " + this.ESVM_SERVER);
			}
			this.progDialog.show();

			// send request + image files
			File[] imageList = new File[this.allImageList.size()];
			for (int i = 0; i < imageList.length; i++){
				imageList[i] = this.allImageList.get(i).getOriginalFile();
			}
			try {
				jsonObj.put(ESVMNetworkClient.JSON_HEADER_MODEL_NAME, objectName);
			} catch (JSONException e) {
			}

			ESVMNetworkClient client = new ESVMNetworkClient(
					this.networkHandler, jsonObj, imageList, this.ESVM_SERVER, this.ESVM_PORT);
			client.start();

		} else {
			AlertDialog.Builder ab = new AlertDialog.Builder(this);
			ab.setTitle("Warning");
			ab.setMessage("Annotation is not finished");
			ab.setIcon(R.drawable.ic_launcher);
			ab.setPositiveButton("Confirm", null);
			ab.show();
		}

	}

	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
		if (resultCode == RESULT_OK) {
			if (requestCode == PIC_CROP) {
				Bundle extras = data.getExtras();
				AnnotatedImageDS processedImage = null;
				for (AnnotatedImageDS image : this.allImageList) {
					if (image.getOriginalFile() == this.currentProcessingImage) {
						processedImage = image;
						break;
					}
				}

				if (processedImage != null) {
					// save annotation information to DS
					int cropLeft = extras.getInt("crop-left");
					int cropRight = extras.getInt("crop-right");
					int cropBottom = extras.getInt("crop-bottom");
					int cropTop = extras.getInt("crop-top");
					Rect cropRect = new Rect(cropLeft, cropTop, cropRight,
							cropBottom);
					processedImage.setCropRect(cropRect);
					this.dbHelper.updateDB(processedImage);
					Toast.makeText(AnnotationActivity.this, "SUCCESS",
							Toast.LENGTH_SHORT).show();

					// update image to cropped region
					this.imageAdapter.notifyDataSetChanged();
				} else {
					Toast.makeText(AnnotationActivity.this, "FAILED",
							Toast.LENGTH_SHORT).show();
				}
			}
		}
	}

	View.OnClickListener startTrainingListener = new View.OnClickListener() {
		@Override
		public void onClick(View v) {
			if (v.getId() == R.id.startTraining) {
				// ask model name
				AlertDialog.Builder ab = new AlertDialog.Builder(AnnotationActivity.this);
				final EditText input = new EditText(getApplicationContext());
				ab.setTitle("Training");
				ab.setMessage("Enter the name of this object");
				ab.setView(input);
				ab.setIcon(R.drawable.ic_launcher);
				ab.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
					public void onClick(DialogInterface dialog, int whichButton) {
						String value = input.getText().toString();
						starTraining(value);
					}
				});
				ab.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
					public void onClick(DialogInterface dialog, int whichButton) {
					}
				});
				ab.show();
			}
		}
	};

	OnItemClickListener clickListener = new OnItemClickListener() {
		@Override
		public void onItemClick(AdapterView<?> parent, View v, int position,
				long id) {

			AnnotatedImageDS image = (AnnotatedImageDS) imageAdapter
					.getItem(position);
			File cropImageFile = image.getCropFile();
			currentProcessingImage = image.getOriginalFile();
			Uri picUri = Uri.fromFile(image.getOriginalFile());
			try {
				Intent cropIntent = new Intent(AnnotationActivity.this,
						CropImage.class);
				cropIntent.putExtra("image-path", picUri.getPath());
				cropIntent.putExtra("scale", true);
				cropIntent.putExtra(MediaStore.EXTRA_OUTPUT,
						Uri.fromFile(cropImageFile));

				cropIntent.putExtra("outputFormat",
						Bitmap.CompressFormat.JPEG.toString());
				startActivityForResult(cropIntent, PIC_CROP);
			} catch (ActivityNotFoundException e) {
				// display an error message
				String errorMessage = "Whoops - your device doesn't support the crop action!";
				Toast toast = Toast.makeText(AnnotationActivity.this,
						errorMessage, Toast.LENGTH_SHORT);
				toast.show();
			}
		}
	};

	// network progress dialog
	private ProgressDialog progDialog;
	private Handler networkHandler = new Handler() {
		protected void updateMessage(String msg) {
			if ((progDialog != null) && (progDialog.isShowing())) {
				progDialog.setMessage(msg);
			}
		}

		public void handleMessage(Message msg) {
			if (msg.what == ESVMNetworkClient.CALLBACK_SUCCESS) {
				String retMsg = (String) msg.obj;
				this.updateMessage("SUCCESS: " + retMsg);
				AlertDialog.Builder ab = new AlertDialog.Builder(
						AnnotationActivity.this);
				ab.setTitle("SUCCESS");
				ab.setMessage(retMsg);
				ab.setIcon(R.drawable.ic_launcher);
				ab.setPositiveButton("Confirm", null);
				ab.show();
			} else if (msg.what == ESVMNetworkClient.CALLBACK_UPDATE) {
				String retMsg = (String) msg.obj;
				this.updateMessage(retMsg);
			} else if (msg.what == ESVMNetworkClient.CALLBACK_FAILED) {
				String retMsg = (String) msg.obj;
				this.updateMessage("Failed : " + retMsg);
				AlertDialog.Builder ab = new AlertDialog.Builder(
						AnnotationActivity.this);
				ab.setTitle("Failed");
				ab.setMessage("ESVM update failed : " + retMsg);
				ab.setIcon(R.drawable.ic_launcher);
				ab.setPositiveButton("Confirm", null);
				ab.show();
			}

			if ((progDialog != null) && (progDialog.isShowing())) {
				progDialog.dismiss();
			}
		}
	};

	public boolean onKeyDown(int keyCode, KeyEvent event) {
		if (keyCode == KeyEvent.KEYCODE_BACK) {
			this.close();
			this.finish();
		}
		return super.onKeyDown(keyCode, event);
	}

	public String getRealPathFromURI(Uri contentUri) {
		String[] proj = { MediaStore.Images.Media.DATA };
		CursorLoader loader = new CursorLoader(this, contentUri, proj, null,
				null, null);
		Cursor cursor = loader.loadInBackground();
		int column_index = cursor
				.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
		cursor.moveToFirst();
		return cursor.getString(column_index);
	}

	private void close() {
		if (this.dbHelper != null) {
			this.dbHelper.close();
			this.dbHelper = null;
		}
	}

}


text:
=head1 LICENSE

See the NOTICE file distributed with this work for additional information
regarding copyright ownership.

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.

=cut

=head1 CONTACT

  Please email comments or questions to the public Ensembl
  developers list at <http://lists.ensembl.org/mailman/listinfo/dev>.

  Questions may also be sent to the Ensembl help desk at
  <http://www.ensembl.org/Help/Contact>.

=head1 NAME

Bio::EnsEMBL::Compara::RunnableDB::MercatorPecan::Mercator

=head1 DESCRIPTION

Wrapper around Bio::EnsEMBL::Compara::Production::Analysis::Mercator

Supported keys:
    'mlss_id' => <number>
        The id of the pecan method link species set.

     'input_dir' => <directory_path>
        Location of input files

     'output_dir' => <directory_path>
        Location to write output files

     'method_link_type' => <type>
        Synteny method link type
        eg "method_link_type" => "SYNTENY"

=cut

package Bio::EnsEMBL::Compara::RunnableDB::MercatorPecan::Mercator;

use strict;
use warnings;
use Bio::EnsEMBL::Compara::Production::Analysis::Mercator;
use Bio::EnsEMBL::Compara::DnaFragRegion;
use Data::Dumper;

use base ('Bio::EnsEMBL::Compara::RunnableDB::BaseRunnable');

sub fetch_input {
    my ($self) = @_;

    my $mlss = $self->compara_dba->get_MethodLinkSpeciesSetAdaptor()->fetch_by_dbID($self->param_required('mlss_id'));
    my @gdb_ids = map {$_->dbID} @{ $mlss->species_set->genome_dbs };
    $self->param('genome_db_ids', \@gdb_ids);
}

sub run
{
  my $self = shift;

  unless (defined $self->param('output_dir')) {
    my $output_dir = $self->worker_temp_directory . "/output_dir";
    $self->param('output_dir', $output_dir);
  }
  if (! -e $self->param('output_dir')) {
    mkdir($self->param('output_dir'));
  }
  my $mercator_output = Bio::EnsEMBL::Compara::Production::Analysis::Mercator::run_mercator($self);
  $self->param('mercator_output', $mercator_output);
}

sub write_output {
  my ($self) = @_;

  my $synteny_regions = $self->store_synteny();
  foreach my $sr (@{$synteny_regions}) {
    #Flow into pecan
    my $dataflow_output_id = { synteny_region_id => $sr->dbID , dnafrag_count => $sr->{'__dnafrag_count'}, total_residues_count => $sr->{'__total_residues_count'} };
    $self->dataflow_output_id($dataflow_output_id,2);
  }
  return 1;
}

=head2 store_synteny

  Example     : $self->store_synteny();
  Description : This method will store the syntenies defined by Mercator
                into the compara DB. The MethodLinkSpecieSet for these
                syntenies is created and stored if needed at this point.
                The IDs for the new Bio::EnsEMBL::Compara::SyntenyRegion
                objects are returned in an arrayref.
  ReturnType  : arrayref of integer
  Exceptions  :
  Status      : stable

=cut

sub store_synteny {
  my ($self) = @_;

  my $mlssa = $self->compara_dba->get_MethodLinkSpeciesSetAdaptor;
  my $sra = $self->compara_dba->get_SyntenyRegionAdaptor;
  my $dfa = $self->compara_dba->get_DnaFragAdaptor;

  my $mlss_id = $self->param_required('mlss_id');

  # Now we add new regions for the non-nuclear cellular components
  my @extra_synteny_groups;
  my $genome_dbs = $mlssa->fetch_by_dbID($mlss_id)->species_set->genome_dbs;
  foreach my $cellular_component (qw(MT PT)) {
      my @regions;
      foreach my $genome_db (@$genome_dbs) {
          foreach my $dnafrag (@{ $dfa->fetch_all_by_GenomeDB($genome_db, -CELLULAR_COMPONENT => $cellular_component) }) {
              push @regions, [$cellular_component, $dnafrag->genome_db_id, $dnafrag->name.'--1', 1, $dnafrag->length, '+'];
          }
      }
      push @extra_synteny_groups, \@regions if scalar(@regions) > 1;
  }

  my $synteny_regions;
  foreach my $sr (@{$self->param('mercator_output')}, @extra_synteny_groups) {
    my @regions;
    my $run_id;
    my $total_residues_count = 0;
    foreach my $dfr (@{$sr}) {
      my ($gdb_id, $seq_region_name, $start, $end, $strand);
      ($run_id, $gdb_id, $seq_region_name, $start, $end, $strand) = @{$dfr};
      next if ($seq_region_name eq 'NA' && $start eq 'NA' && $end eq 'NA' && $strand eq 'NA');
      $seq_region_name =~ s/\-\-\d+$//;
      my $dnafrag = $dfa->fetch_by_GenomeDB_and_name($gdb_id, $seq_region_name);
      $strand = ($strand eq "+")?1:-1;
      my $dnafrag_region = Bio::EnsEMBL::Compara::DnaFragRegion->new_fast( {
              'dnafrag_id'      => $dnafrag->dbID,
              'dnafrag_start'   => $start+1, # because half-open coordinate system
              'dnafrag_end'     => $end,
              'dnafrag_strand'  => $strand,
      } );
      $total_residues_count += $end - $start;
      push @regions, $dnafrag_region;
    }
    my $synteny_region = Bio::EnsEMBL::Compara::SyntenyRegion->new_fast( {
        'method_link_species_set_id' => $mlss_id,
        'regions' => \@regions,
        # These two fields are not part of SyntenyRegion, but needed to populate the dataflow event
        '__dnafrag_count'           => scalar(@regions),
        '__total_residues_count'    => $total_residues_count,
    } );
    $sra->store($synteny_region);
    push @{$synteny_regions}, $synteny_region;
  }

  return $synteny_regions;
}

1;


text:
/**
 *    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.
 */
package org.cdlflex.ui.util.function;

import java.io.Serializable;
import java.util.function.Function;

/**
 * A serializable Function.
 *
 * @param <T> the type of the input to the function
 * @param <R> the type of the result of the function
 */
@FunctionalInterface
public interface SerializableFunction<T, R> extends Function<T, R>, Serializable {
    @Override
    R apply(T t);
}