text:
import json
import os.path
from time import sleep

REPLAY = 'moves.json'
BASE_PATH = os.path.abspath(os.path.dirname(__file__))

def main():
    with open(os.path.join(BASE_PATH, REPLAY)) as f:
        moves = json.load(f)

    for move in moves:
        print()
        print('{:=^40}'.format(' MOVE %s ' % move['move']))
        print()
        if move['stderr']:
            print('STDERR')
            print(move['stderr'])
            print()

        print('STDOUT')
        print(move['stdout'])
        print()

        print('STDIN')
        print(move['stdin'])
        print()

        sleep(1)

if __name__ == '__main__':
    main()


text:
<?xml version="1.0" encoding="UTF-8"?>
<!-- *************************GO-LICENSE-START******************************
 * Copyright 2014 ThoughtWorks, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *************************GO-LICENSE-END******************************* -->

<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <artifactId>app-server</artifactId>

    <parent>
        <groupId>com.thoughtworks.go</groupId>
        <artifactId>gocd</artifactId>
        <version>16.6.0</version>
        <relativePath>../</relativePath>
    </parent>

    <properties>
      <main.dir>${project.basedir}/..</main.dir>
      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.thoughtworks.go</groupId>
            <artifactId>base</artifactId>
            <version>${project.parent.version}</version>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
        </dependency>

        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.12</version>
        </dependency>

        <!-- apache commons -->
        <dependency>
            <groupId>commons-beanutils</groupId>
            <artifactId>commons-beanutils-core</artifactId>
            <version>1.7.0</version>
            <exclusions>
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>commons-collections</groupId>
                    <artifactId>commons-collections</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>commons-validator</groupId>
            <artifactId>commons-validator</artifactId>
            <version>1.3.1</version>
            <exclusions>
                <exclusion>
                    <groupId>commons-digester</groupId>
                    <artifactId>commons-digester</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>junit</groupId>
                    <artifactId>junit</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>commons-dbcp</groupId>
            <artifactId>commons-dbcp</artifactId>
            <version>1.4</version>
        </dependency>
        <dependency>
            <groupId>commons-pool</groupId>
            <artifactId>commons-pool</artifactId>
            <version>1.5.6</version>
        </dependency>
        <!-- apache commons end -->

        <dependency>
            <groupId>org.jruby</groupId>
            <artifactId>jruby-complete</artifactId>
            <version>1.7.11</version>
        </dependency>
        <dependency>
            <groupId>org.jruby.rack</groupId>
            <artifactId>jruby-rack</artifactId>
            <version>1.1.14</version>
        </dependency>

        <dependency>
            <groupId>org.openrdf</groupId>
            <artifactId>sesame-onejar</artifactId>
            <version>2.3.1</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <dependency>
            <groupId>com.unboundid</groupId>
            <artifactId>unboundid-ldapsdk</artifactId>
            <version>2.3.6</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>web.servlet</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <dependency>
            <groupId>org.objenesis</groupId>
            <artifactId>objenesis</artifactId>
            <version>1.2</version>
        </dependency>

        <!-- test dependencies -->
        <dependency>
            <groupId>com.thoughtworks.go</groupId>
            <artifactId>common</artifactId>
            <version>${project.parent.version}</version>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.thoughtworks.go</groupId>
            <artifactId>config-server</artifactId>
            <version>${project.parent.version}</version>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.thoughtworks.go</groupId>
            <artifactId>config-api</artifactId>
            <version>${project.parent.version}</version>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.thoughtworks.go</groupId>
            <artifactId>test-utils</artifactId>
            <version>${project.parent.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <sourceDirectory>src</sourceDirectory>
        <resources>
            <resource>
                <directory>resources</directory>
            </resource>
            <resource>
                <directory>properties/src</directory>
            </resource>
        </resources>
        <testResources>
            <testResource>
                <directory>test-resources</directory>
            </testResource>
            <testResource>
                <directory>properties/test</directory>
            </testResource>
            <testResource>
                <directory>webapp</directory>
                <includes>
                    <include>WEB-INF/**/*</include>
                    <include>localize.xml</include>
                    <include>localize_ja.xml</include>
                </includes>
                <excludes>
                    <exclude>WEB-INF/classes/**/*</exclude>
                    <exclude>WEB-INF/lib/**/*</exclude>
                    <exclude>WEB-INF/rails/**/*</exclude>
                </excludes>
            </testResource>
            <testResource>
                <directory>test/data</directory>
            </testResource>
        </testResources>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>

redpajama_set_name: RedPajamaGithub


text:
package entities;

import javax.persistence.*;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.Set;

@Entity
@Table(name = "employees")
public class Employee {
    private Integer id;
    private String firstName;
    private String lastName;
    private String middleName;
    private String jobTitle;
    private Department department;
    private Employee manager;
    private Timestamp hireDate;
    private BigDecimal salary;
    private Address address;
    private Set<Project> projects;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "employee_id")
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @Column(name = "first_name")
    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    @Column(name = "last_name")
    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    @Column(name = "middle_name")
    public String getMiddleName() {
        return middleName;
    }

    public void setMiddleName(String middleName) {
        this.middleName = middleName;
    }

    @Column(name = "job_title")
    public String getJobTitle() {
        return jobTitle;
    }

    public void setJobTitle(String jobTitle) {
        this.jobTitle = jobTitle;
    }

    @ManyToOne
    @JoinColumn(name = "department_id", referencedColumnName = "department_id")
    public Department getDepartment() {
        return department;
    }

    public void setDepartment(Department department) {
        this.department = department;
    }

    @ManyToOne
    @JoinColumn(name = "manager_id", referencedColumnName = "employee_id")
    public Employee getManager() {
        return manager;
    }

    public void setManager(Employee manager) {
        this.manager = manager;
    }

    @Column(name = "hire_date")
    public Timestamp getHireDate() {
        return hireDate;
    }

    public void setHireDate(Timestamp hireDate) {
        this.hireDate = hireDate;
    }

    @Column(name = "salary")
    public BigDecimal getSalary() {
        return salary;
    }

    public void setSalary(BigDecimal salary) {
        this.salary = salary;
    }

    @ManyToOne
    @JoinColumn(name = "address_id", referencedColumnName = "address_id")
    public Address getAddress() {
        return address;
    }

    public void setAddress(Address address) {
        this.address = address;
    }

    @ManyToMany
    @JoinTable(name = "employees_projects",
            joinColumns = @JoinColumn(name = "employee_id", referencedColumnName = "employee_id"),
            inverseJoinColumns = @JoinColumn(name = "project_id", referencedColumnName = "project_id"))
    public Set<Project> getProjects() {
        return projects;
    }

    public void setProjects(Set<Project> projects) {
        this.projects = projects;
    }
}


text:
import * as React from "react";
import * as ReactDOM from "react-dom";
import { Components, Services, IState, configureStore } from "@sdl/delivery-ish-dd-webapp-gui";
import { Provider } from "react-redux";
import { Store } from "redux";

const { App } = Components.AppComp;
const { PageService, PublicationService, TaxonomyService, SearchService } = Services.Client;
const { localization} = Services.Common;

const mainElement = document.getElementById("main-view-target");

/**
 * Set instances for services
 */
const services = {
    pageService: new PageService(),
    publicationService: new PublicationService(),
    localizationService: localization,
    taxonomyService: new TaxonomyService(),
    searchService: new SearchService()
};

const store: Store<IState> = configureStore({});

localization.setStore(store);

const render = (AppComp: typeof App): void => {
    if (!mainElement) {
        console.error(`Unable to locate element to render application.`);
    } else {
        ReactDOM.render(
            <Provider store={store}>
                <AppComp services={services}/>
            </Provider>, mainElement);
    }
};
render(App);


text:
package com.ansorgit.plugins.bash.lang.parser.builtin.varDef;

import com.ansorgit.plugins.bash.lang.parser.ParsingTool;

import java.util.Arrays;

/**
 * Syntax: mapfile [-d delim] [-n count] [-O origin] [-s count] [-t] [-u fd] [-C callback] [-c quantum] [array]
 *

 * Parses the mapfile command.
 *

 *
 * @author jansorg
 */
class MapfileCommand extends AbstractVariableDefParsing implements ParsingTool {
    //arguments which take a value after this
    //fixme this needs to be improved as values may span more than one token
    private static final int[] VALUE_ARGS = new int[]{'d', 'n', 'O', 's', 'u', 'C', 'c'};

    public MapfileCommand() {
        this("mapfile");
    }

    MapfileCommand(String commandText) {
        super(false, GENERIC_COMMAND_ELEMENT, commandText, false, false);
    }

    @Override
    boolean argumentValueExpected(String name) {
        return name.chars().anyMatch(value -> Arrays.stream(VALUE_ARGS).anyMatch(c -> value == c));
    }
}


text:
export function incrementCounter() {
	return {
		type: 'INC',
	};
}

export function decrementCounter() {
	return {
		type: 'DEC',
	};
}


text:
package ml.shifu.guagua.master;

import ml.shifu.guagua.io.Bytable;
import ml.shifu.guagua.util.MemoryUtils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * {@link MemoryStatsMasterInterceptor} is used to print memory usage for each master checkpoint.
 *
 * <p>
 * {@link MemoryStatsMasterInterceptor} is set as default system interceptor. So memory usage will be found in each
 * task's log file.
 *
 * @param <MASTER_RESULT>
 *            master result for computation in each iteration.
 * @param <WORKER_RESULT>
 *            worker result for computation in each iteration.
 */
public class MemoryStatsMasterInterceptor<MASTER_RESULT extends Bytable, WORKER_RESULT extends Bytable> extends
        BasicMasterInterceptor<MASTER_RESULT, WORKER_RESULT> {

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

    @Override
    public void preIteration(MasterContext<MASTER_RESULT, WORKER_RESULT> context) {
        LOG.info("pre iteration:{} with memory info {}.", context.getCurrentIteration(),
                MemoryUtils.getRuntimeMemoryStats());
    }

    @Override
    public void postIteration(MasterContext<MASTER_RESULT, WORKER_RESULT> context) {
        LOG.info("post iteration:{} with memory info {}.", context.getCurrentIteration(),
                MemoryUtils.getRuntimeMemoryStats());
    }

    @Override
    public void preApplication(MasterContext<MASTER_RESULT, WORKER_RESULT> context) {
        LOG.info("pre application with memory info {}.", MemoryUtils.getRuntimeMemoryStats());
    }

    @Override
    public void postApplication(MasterContext<MASTER_RESULT, WORKER_RESULT> context) {
        LOG.info("post application with memory info {}.", MemoryUtils.getRuntimeMemoryStats());
    }
}


text:
package com.werdpressed.partisan.scrollhandleexample;

import android.os.Bundle;
import android.support.design.widget.AppBarLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity implements AppBarManager{

    private Toolbar mToolbar;
    private RecyclerFragment mRecyclerFragment;
    private AppBarLayout mAppBarLayout;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_main);

        mToolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(mToolbar);

        mAppBarLayout = (AppBarLayout) findViewById(R.id.app_bar);

        if (getSupportFragmentManager().findFragmentById(R.id.rv_container) == null) {
            mRecyclerFragment = RecyclerFragment.newInstance();
            getSupportFragmentManager()
                    .beginTransaction()
                    .add(R.id.rv_container, mRecyclerFragment, RecyclerFragment.TAG)
                    .commit();
        }
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.menu_main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {

        if (mRecyclerFragment == null) {
            mRecyclerFragment =
                    (RecyclerFragment) getSupportFragmentManager()
                    .findFragmentByTag(RecyclerFragment.TAG);
        }

        int id = item.getItemId();
        switch (id) {
            case R.id.action_lock:
                makeToast(getString(R.string.action_lock));
                mRecyclerFragment.getConfigurableRecyclerView().setScrollingActive(true);
                break;
            case R.id.action_unlock:
                makeToast(getString(R.string.action_unlock));
                mRecyclerFragment.getConfigurableRecyclerView().setScrollingActive(false);
                break;
        }

        return super.onOptionsItemSelected(item);
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent event) {
        if (event.getAction() == MotionEvent.ACTION_UP) {
            float per = Math.abs(mAppBarLayout.getY()) / mAppBarLayout.getTotalScrollRange();
            boolean setExpanded = (per <= 0.5F);
            mAppBarLayout.setExpanded(setExpanded, true);
        }
        return super.dispatchTouchEvent(event);
    }

    private void makeToast(String content) {
        Toast.makeText(this, content, Toast.LENGTH_SHORT).show();
    }

    @Override
    public void collapseAppBar() {
        mAppBarLayout.setExpanded(false, true);
    }

    @Override
    public void expandAppBar() {
        mAppBarLayout.setExpanded(true, true);
    }

    @Override
    public int getVisibleHeightForRecyclerViewInPx() {

        if (mRecyclerFragment == null) mRecyclerFragment =
                (RecyclerFragment) getSupportFragmentManager().findFragmentByTag(RecyclerFragment.TAG);

        int windowHeight, appBarHeight, headerViewHeight;
        windowHeight = getWindow().getDecorView().getHeight();
        appBarHeight = mAppBarLayout.getHeight();
        headerViewHeight = mRecyclerFragment.getHeaderView().getHeight();
        return windowHeight - (appBarHeight + headerViewHeight);
    }
}


text:
"""Persistence Module. Perform database connection, and queries"""
from __future__ import (absolute_import, print_function,
                        division)

from .config import PersistenceConfig
from .content_database import ContentDatabase
from .relational_database import RelationalDatabase

persistence_config = PersistenceConfig()                                         # pylint: disable=invalid-name
content = ContentDatabase(persistence_config)                                    # pylint: disable=invalid-name
relational = RelationalDatabase(persistence_config)                              # pylint: disable=invalid-name

def get_serializer(arg):                                                         # pylint: disable=unused-argument
    """Select serializer according to argument"""
    # ToDo #54: use arg to select serialize
    # from .serializers import jsonpickle_serializer, jsonpickle_content
    # from .serializers import SimpleSerializer
    # return SimpleSerializer().serialize
    # return jsonpickle_serializer
    # return jsonpickle_content
    return repr

__all__ = [
    "persistence_config",
    "content",
    "relational",
    "get_serializer"
]


text:
.. WARNING FOR CONTRIBUTORS: Don't modify this file! It's generated with a mod (see below) and all changes made will be lost with the next update.

==========
UI Sprites 8/8
==========
Here you can find a list of UI sprites.
These are all the sprites available in the game.
You can use these sprites in many of the UI components that have a sprite property for example a button, panel, slider and so on

 .. figure:: /_static/UISprites/ToolbarIconHealthcare.png
    :alt: ToolbarIconHealthcare

**ToolbarIconHealthcare**

.. figure:: /_static/UISprites/ToolbarIconHealthcareDisabled.png
    :alt: ToolbarIconHealthcareDisabled

**ToolbarIconHealthcareDisabled**

.. figure:: /_static/UISprites/ToolbarIconHealthcareFocused.png
    :alt: ToolbarIconHealthcareFocused

**ToolbarIconHealthcareFocused**

.. figure:: /_static/UISprites/ToolbarIconHealthcareHovered.png
    :alt: ToolbarIconHealthcareHovered

**ToolbarIconHealthcareHovered**

.. figure:: /_static/UISprites/ToolbarIconHealthcarePressed.png
    :alt: ToolbarIconHealthcarePressed

**ToolbarIconHealthcarePressed**

.. figure:: /_static/UISprites/ToolbarIconHelp.png
    :alt: ToolbarIconHelp

**ToolbarIconHelp**

.. figure:: /_static/UISprites/ToolbarIconMoney.png
    :alt: ToolbarIconMoney

**ToolbarIconMoney**

.. figure:: /_static/UISprites/ToolbarIconMoneyDisabled.png
    :alt: ToolbarIconMoneyDisabled

**ToolbarIconMoneyDisabled**

.. figure:: /_static/UISprites/ToolbarIconMoneyFocused.png
    :alt: ToolbarIconMoneyFocused

**ToolbarIconMoneyFocused**

.. figure:: /_static/UISprites/ToolbarIconMoneyHovered.png
    :alt: ToolbarIconMoneyHovered

**ToolbarIconMoneyHovered**

.. figure:: /_static/UISprites/ToolbarIconMoneyPressed.png
    :alt: ToolbarIconMoneyPressed

**ToolbarIconMoneyPressed**

.. figure:: /_static/UISprites/ToolbarIconMonuments.png
    :alt: ToolbarIconMonuments

**ToolbarIconMonuments**

.. figure:: /_static/UISprites/ToolbarIconMonumentsDisabled.png
    :alt: ToolbarIconMonumentsDisabled

**ToolbarIconMonumentsDisabled**

.. figure:: /_static/UISprites/ToolbarIconMonumentsFocused.png
    :alt: ToolbarIconMonumentsFocused

**ToolbarIconMonumentsFocused**

.. figure:: /_static/UISprites/ToolbarIconMonumentsHovered.png
    :alt: ToolbarIconMonumentsHovered

**ToolbarIconMonumentsHovered**

.. figure:: /_static/UISprites/ToolbarIconMonumentsPressed.png
    :alt: ToolbarIconMonumentsPressed

**ToolbarIconMonumentsPressed**

.. figure:: /_static/UISprites/ToolbarIconPolice.png
    :alt: ToolbarIconPolice

**ToolbarIconPolice**

.. figure:: /_static/UISprites/ToolbarIconPoliceDisabled.png
    :alt: ToolbarIconPoliceDisabled

**ToolbarIconPoliceDisabled**

.. figure:: /_static/UISprites/ToolbarIconPoliceFocused.png
    :alt: ToolbarIconPoliceFocused

**ToolbarIconPoliceFocused**

.. figure:: /_static/UISprites/ToolbarIconPoliceHovered.png
    :alt: ToolbarIconPoliceHovered

**ToolbarIconPoliceHovered**

.. figure:: /_static/UISprites/ToolbarIconPolicePressed.png
    :alt: ToolbarIconPolicePressed

**ToolbarIconPolicePressed**

.. figure:: /_static/UISprites/ToolbarIconPolicies.png
    :alt: ToolbarIconPolicies

**ToolbarIconPolicies**

.. figure:: /_static/UISprites/ToolbarIconPoliciesDisabled.png
    :alt: ToolbarIconPoliciesDisabled

**ToolbarIconPoliciesDisabled**

.. figure:: /_static/UISprites/ToolbarIconPoliciesFocused.png
    :alt: ToolbarIconPoliciesFocused

**ToolbarIconPoliciesFocused**

.. figure:: /_static/UISprites/ToolbarIconPoliciesHovered.png
    :alt: ToolbarIconPoliciesHovered

**ToolbarIconPoliciesHovered**

.. figure:: /_static/UISprites/ToolbarIconPoliciesPressed.png
    :alt: ToolbarIconPoliciesPressed

**ToolbarIconPoliciesPressed**

.. figure:: /_static/UISprites/ToolbarIconProps.png
    :alt: ToolbarIconProps

**ToolbarIconProps**

.. figure:: /_static/UISprites/ToolbarIconPropsDisabled.png
    :alt: ToolbarIconPropsDisabled

**ToolbarIconPropsDisabled**

.. figure:: /_static/UISprites/ToolbarIconPropsFocused.png
    :alt: ToolbarIconPropsFocused

**ToolbarIconPropsFocused**

.. figure:: /_static/UISprites/ToolbarIconPropsHovered.png
    :alt: ToolbarIconPropsHovered

**ToolbarIconPropsHovered**

.. figure:: /_static/UISprites/ToolbarIconPropsPressed.png
    :alt: ToolbarIconPropsPressed

**ToolbarIconPropsPressed**

.. figure:: /_static/UISprites/ToolbarIconPublicTransport.png
    :alt: ToolbarIconPublicTransport

**ToolbarIconPublicTransport**

.. figure:: /_static/UISprites/ToolbarIconPublicTransportDisabled.png
    :alt: ToolbarIconPublicTransportDisabled

**ToolbarIconPublicTransportDisabled**

.. figure:: /_static/UISprites/ToolbarIconPublicTransportFocused.png
    :alt: ToolbarIconPublicTransportFocused

**ToolbarIconPublicTransportFocused**

.. figure:: /_static/UISprites/ToolbarIconPublicTransportHovered.png
    :alt: ToolbarIconPublicTransportHovered

**ToolbarIconPublicTransportHovered**

.. figure:: /_static/UISprites/ToolbarIconPublicTransportPressed.png
    :alt: ToolbarIconPublicTransportPressed

**ToolbarIconPublicTransportPressed**

.. figure:: /_static/UISprites/ToolbarIconRoads.png
    :alt: ToolbarIconRoads

**ToolbarIconRoads**

.. figure:: /_static/UISprites/ToolbarIconRoadsDisabled.png
    :alt: ToolbarIconRoadsDisabled

**ToolbarIconRoadsDisabled**

.. figure:: /_static/UISprites/ToolbarIconRoadsFocused.png
    :alt: ToolbarIconRoadsFocused

**ToolbarIconRoadsFocused**

.. figure:: /_static/UISprites/ToolbarIconRoadsHovered.png
    :alt: ToolbarIconRoadsHovered

**ToolbarIconRoadsHovered**

.. figure:: /_static/UISprites/ToolbarIconRoadsPressed.png
    :alt: ToolbarIconRoadsPressed

**ToolbarIconRoadsPressed**

.. figure:: /_static/UISprites/ToolbarIconTemp.png
    :alt: ToolbarIconTemp

**ToolbarIconTemp**

.. figure:: /_static/UISprites/ToolbarIconUnlock.png
    :alt: ToolbarIconUnlock

**ToolbarIconUnlock**

.. figure:: /_static/UISprites/ToolbarIconUnlockRadial.png
    :alt: ToolbarIconUnlockRadial

**ToolbarIconUnlockRadial**

.. figure:: /_static/UISprites/ToolbarIconWaterAndSewage.png
    :alt: ToolbarIconWaterAndSewage

**ToolbarIconWaterAndSewage**

.. figure:: /_static/UISprites/ToolbarIconWaterAndSewageDisabled.png
    :alt: ToolbarIconWaterAndSewageDisabled

**ToolbarIconWaterAndSewageDisabled**

.. figure:: /_static/UISprites/ToolbarIconWaterAndSewageFocused.png
    :alt: ToolbarIconWaterAndSewageFocused

**ToolbarIconWaterAndSewageFocused**

.. figure:: /_static/UISprites/ToolbarIconWaterAndSewageHovered.png
    :alt: ToolbarIconWaterAndSewageHovered

**ToolbarIconWaterAndSewageHovered**

.. figure:: /_static/UISprites/ToolbarIconWaterAndSewagePressed.png
    :alt: ToolbarIconWaterAndSewagePressed

**ToolbarIconWaterAndSewagePressed**

.. figure:: /_static/UISprites/ToolbarIconWonders.png
    :alt: ToolbarIconWonders

**ToolbarIconWonders**

.. figure:: /_static/UISprites/ToolbarIconWondersDisabled.png
    :alt: ToolbarIconWondersDisabled

**ToolbarIconWondersDisabled**

.. figure:: /_static/UISprites/ToolbarIconWondersFocused.png
    :alt: ToolbarIconWondersFocused

**ToolbarIconWondersFocused**

.. figure:: /_static/UISprites/ToolbarIconWondersHovered.png
    :alt: ToolbarIconWondersHovered

**ToolbarIconWondersHovered**

.. figure:: /_static/UISprites/ToolbarIconWondersPressed.png
    :alt: ToolbarIconWondersPressed

**ToolbarIconWondersPressed**

.. figure:: /_static/UISprites/ToolbarIconZoning.png
    :alt: ToolbarIconZoning

**ToolbarIconZoning**

.. figure:: /_static/UISprites/ToolbarIconZoningDisabled.png
    :alt: ToolbarIconZoningDisabled

**ToolbarIconZoningDisabled**

.. figure:: /_static/UISprites/ToolbarIconZoningFocused.png
    :alt: ToolbarIconZoningFocused

**ToolbarIconZoningFocused**

.. figure:: /_static/UISprites/ToolbarIconZoningHovered.png
    :alt: ToolbarIconZoningHovered

**ToolbarIconZoningHovered**

.. figure:: /_static/UISprites/ToolbarIconZoningPressed.png
    :alt: ToolbarIconZoningPressed

**ToolbarIconZoningPressed**

.. figure:: /_static/UISprites/ToolbarIconZoomOutbase.png
    :alt: ToolbarIconZoomOutbase

**ToolbarIconZoomOutbase**

.. figure:: /_static/UISprites/ToolbarIconZoomOutbaseHovered.png
    :alt: ToolbarIconZoomOutbaseHovered

**ToolbarIconZoomOutbaseHovered**

.. figure:: /_static/UISprites/ToolbarIconZoomOutbasePressed.png
    :alt: ToolbarIconZoomOutbasePressed

**ToolbarIconZoomOutbasePressed**

.. figure:: /_static/UISprites/ToolbarIconZoomOutbasetDisabled.png
    :alt: ToolbarIconZoomOutbasetDisabled

**ToolbarIconZoomOutbasetDisabled**

.. figure:: /_static/UISprites/ToolbarIconZoomOutbasetFocused.png
    :alt: ToolbarIconZoomOutbasetFocused

**ToolbarIconZoomOutbasetFocused**

.. figure:: /_static/UISprites/ToolbarIconZoomOutCity.png
    :alt: ToolbarIconZoomOutCity

**ToolbarIconZoomOutCity**

.. figure:: /_static/UISprites/ToolbarIconZoomOutCityDisabled.png
    :alt: ToolbarIconZoomOutCityDisabled

**ToolbarIconZoomOutCityDisabled**

.. figure:: /_static/UISprites/ToolbarIconZoomOutCityFocused.png
    :alt: ToolbarIconZoomOutCityFocused

**ToolbarIconZoomOutCityFocused**

.. figure:: /_static/UISprites/ToolbarIconZoomOutCityHovered.png
    :alt: ToolbarIconZoomOutCityHovered

**ToolbarIconZoomOutCityHovered**

.. figure:: /_static/UISprites/ToolbarIconZoomOutCityPressed.png
    :alt: ToolbarIconZoomOutCityPressed

**ToolbarIconZoomOutCityPressed**

.. figure:: /_static/UISprites/ToolbarIconZoomOutGlobe.png
    :alt: ToolbarIconZoomOutGlobe

**ToolbarIconZoomOutGlobe**

.. figure:: /_static/UISprites/ToolbarIconZoomOutGlobeDisabled.png
    :alt: ToolbarIconZoomOutGlobeDisabled

**ToolbarIconZoomOutGlobeDisabled**

.. figure:: /_static/UISprites/ToolbarIconZoomOutGlobeFocused.png
    :alt: ToolbarIconZoomOutGlobeFocused

**ToolbarIconZoomOutGlobeFocused**

.. figure:: /_static/UISprites/ToolbarIconZoomOutGlobeHovered.png
    :alt: ToolbarIconZoomOutGlobeHovered

**ToolbarIconZoomOutGlobeHovered**

.. figure:: /_static/UISprites/ToolbarIconZoomOutGlobePressed.png
    :alt: ToolbarIconZoomOutGlobePressed

**ToolbarIconZoomOutGlobePressed**

.. figure:: /_static/UISprites/TutorialBubble.png
    :alt: TutorialBubble

**TutorialBubble**

.. figure:: /_static/UISprites/TutorialBubbleFlipRight.png
    :alt: TutorialBubbleFlipRight

**TutorialBubbleFlipRight**

.. figure:: /_static/UISprites/TutorialBubbleLeft.png
    :alt: TutorialBubbleLeft

**TutorialBubbleLeft**

.. figure:: /_static/UISprites/TutorialBubbleRight.png
    :alt: TutorialBubbleRight

**TutorialBubbleRight**

.. figure:: /_static/UISprites/TutorialGlow.png
    :alt: TutorialGlow

**TutorialGlow**

.. figure:: /_static/UISprites/TutorialHighlite.png
    :alt: TutorialHighlite

**TutorialHighlite**

.. figure:: /_static/UISprites/UnlockingArrowLeft.png
    :alt: UnlockingArrowLeft

**UnlockingArrowLeft**

.. figure:: /_static/UISprites/UnlockingArrowLeftDisabled.png
    :alt: UnlockingArrowLeftDisabled

**UnlockingArrowLeftDisabled**

.. figure:: /_static/UISprites/UnlockingArrowLeftFocused.png
    :alt: UnlockingArrowLeftFocused

**UnlockingArrowLeftFocused**

.. figure:: /_static/UISprites/UnlockingArrowLeftHovered.png
    :alt: UnlockingArrowLeftHovered

**UnlockingArrowLeftHovered**

.. figure:: /_static/UISprites/UnlockingArrowLeftPressed.png
    :alt: UnlockingArrowLeftPressed

**UnlockingArrowLeftPressed**

.. figure:: /_static/UISprites/UnlockingArrowRight.png
    :alt: UnlockingArrowRight

**UnlockingArrowRight**

.. figure:: /_static/UISprites/UnlockingArrowRightDisabled.png
    :alt: UnlockingArrowRightDisabled

**UnlockingArrowRightDisabled**

.. figure:: /_static/UISprites/UnlockingArrowRightFocused.png
    :alt: UnlockingArrowRightFocused

**UnlockingArrowRightFocused**

.. figure:: /_static/UISprites/UnlockingArrowRightHovered.png
    :alt: UnlockingArrowRightHovered

**UnlockingArrowRightHovered**

.. figure:: /_static/UISprites/UnlockingArrowRightPressed.png
    :alt: UnlockingArrowRightPressed

**UnlockingArrowRightPressed**

.. figure:: /_static/UISprites/UnlockingBackground.png
    :alt: UnlockingBackground

**UnlockingBackground**

.. figure:: /_static/UISprites/UnlockingBar.png
    :alt: UnlockingBar

**UnlockingBar**

.. figure:: /_static/UISprites/UnlockingItemBackground.png
    :alt: UnlockingItemBackground

**UnlockingItemBackground**

.. figure:: /_static/UISprites/UnlockingItemBackgroundDisabled.png
    :alt: UnlockingItemBackgroundDisabled

**UnlockingItemBackgroundDisabled**

.. figure:: /_static/UISprites/UnlockingItemBackgroundFocused.png
    :alt: UnlockingItemBackgroundFocused

**UnlockingItemBackgroundFocused**

.. figure:: /_static/UISprites/UnlockingItemBackgroundHovered.png
    :alt: UnlockingItemBackgroundHovered

**UnlockingItemBackgroundHovered**

.. figure:: /_static/UISprites/UnlockingItemBackgroundPressed.png
    :alt: UnlockingItemBackgroundPressed

**UnlockingItemBackgroundPressed**

.. figure:: /_static/UISprites/UnlockingPanel.png
    :alt: UnlockingPanel

**UnlockingPanel**

.. figure:: /_static/UISprites/UnlockingPanel2.png
    :alt: UnlockingPanel2

**UnlockingPanel2**

.. figure:: /_static/UISprites/UnlockingProgressBar.png
    :alt: UnlockingProgressBar

**UnlockingProgressBar**

.. figure:: /_static/UISprites/UnlockingProgressBarFill.png
    :alt: UnlockingProgressBarFill

**UnlockingProgressBarFill**

About this page
---------------
This wiki page was created in game with the `SpriteDumper mod <https://github.com/worstboy32/SpriteDumper>`__ .
To modify the text in this document please create a PR on the mod on github.
If there are sprites missing you can run the mod and create a PR on the docs repo with the new generated file.

Kudos to `Permutation <http://www.skylinesmodding.com/users/permutation/>`__ for sharing the method for dumping sprites.


text:
using System;

namespace DDCloud.Platform.Core.CodeAnalysis
{
	/// <summary>
	///     Mark a type as not supporting comparison using the '==' or '!=' operators (<c>Equals()</c> should be used instead).
	/// </summary>
	/// <example>
	///     <code>
	///			[CannotApplyEqualityOperator]
	///			class NoEquality
	///			{
	///			}
	///
	///			class UsesNoEquality
	///			{
	///				public void Test()
	///				{
	///					NoEquality ne1 = new NoEquality();
	///					NoEquality ne2 = new NoEquality();
	///
	///					if (ne1 != null) // OK
	///					{
	///						bool condition = ne1 == ne2; // Warning
	///					}
	///				}
	///			}
	///		</code>
	/// </example>
	/// <remarks>
	///			Using '==' or '!=' for comparison with <c>null</c> is always permitted.
	/// </remarks>
	[AttributeUsage(AttributeTargets.Interface | AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = true)]
	public sealed class CannotApplyEqualityOperatorAttribute
		: Attribute
	{
		/// <summary>
		///		Mark the specified type as not supporting comparison using the '==' or '!=' operators (<c>Equals()</c> should be used instead).
		/// </summary>
		public CannotApplyEqualityOperatorAttribute()
		{
		}
	}
}


text:
Use easily the database SQLite on android using the DAO and transformer design patterns, I modified the library of the professor [@jvprofe][11], I learned it from him.

Basic methods are already implemented in the class `SQLiteDelegate<T>`, if you need further queries you should extend from it.

#How to use

####Import EasySQLite dependency:

Grab via maven:

```xml
<dependency>
    <groupId>com.github.tonilopezmr</groupId>
    <artifactId>easysqlite</artifactId>
    <version>2.1.0</version>
</dependency>
```

or gradle:

```gradle
compile 'com.github.tonilopezmr:easysqlite:2.1.0'
````

####1. Create the object Transformer which implements SQLiteTransformer<T>

```java
	public class SubjectTransformer implements SQLiteTransformer<SubjectEntity>{

	    public static final String ID = "id";
	    public static final String NAME = "name";

	    public static final String TABLE_NAME = "subject";
	    public static final String[] FIELDS = {ID, NAME};

	    @Override
	    public SubjectEntity transform(Cursor cursor) throws Exception {
	        int id = cursor.getInt(0);
	        String name = cursor.getString(1);
	        return new SubjectEntity(id, name);
	    }

	    @Override
	    public ContentValues transform(SubjectEntity dto) throws Exception {
	        ContentValues values = new ContentValues();
			//values.put(ID, dto.getId());   it is not necessary, autoincrement!
	        values.put(NAME, dto.getName());

	        return values;
	    }

	    @Override
	    public String getWhereClause(SubjectEntity dto) throws Exception {
	        return  ID+"="+dto.getId();
	    }

	    @Override
	    public SubjectEntity setId(SubjectEntity dto, Object id) throws Exception {
	        dto.setId((Integer.valueOf(id.toString())));
	        return dto;
	    }

	    @Override
	    public String[] getFields() throws Exception {
	        return FIELDS;
	    }

	    @Override
	    public String getTableName() throws Exception {
	        return TABLE_NAME;
	    }
	}
```
####2. Create the object DAO which extends SQLiteDelegate<T>

The `SQLiteDelegate<T>` has implemented the following methods:

    //Default methods implement with SQLiteDelegate
    T create(T dto)
    int update(T dto)
    T read(T id)
    Collection<T> readAll()
    boolean delete(T dto)
    int deleteAll()

```java
	public class SubjectDAO extends SQLiteDelegate<SubjectEntity> {

	    public SubjectDAO(SQLiteDatabase db) {
	        super(db, new SubjectTransformer());
	    }

	    //In the case you need more querys, write this for example:
	    public List<T> getSubjectsApproved() {
	    	...
	    }

	}
```
####If you need one relation between objects (foreign key)

```java
	public class SubjectTransformer implements SQLiteTransformer<SubjectEntity>{

		...

		private ExamDAO examDAO;

	   	public SubjectTransformer(SQLiteDatabase db){
	   		examDAO = new ExamDAO(db);
	   	}

		...
	}
```
####and

```java
	public class SubjectDAO extends SQLiteDelegate<SubjectEntity> {

	    	public SubjectDAO(SQLiteDatabase db) {
	        	super(db, new SubjectTransformer(db));
	    	}

	}
```

####3. Instance the object DAO and use the CRUD methods

```java

    ...

    SubjectDAO subjectDAO = new SubjectDAO(database);
    Subject subject = new Subject("maths");

    //Create
    subject = subjectDAO.create(subject);

    //Delete
    boolean isDelete = subjectDAO.delete(subject);
    ...

```

Use the SQLiteHelper and get rid of SQLiteOpenHelper
---------------------------------------------------

####If you need one simple database:

```java
//Create table
final private String SUBJECT_TABLE =
        "CREATE TABLE SUBJECT(" +
	        "ID INTEGER PRIMARY KEY AUTOINCREMENT," +
	        "NAME TEXT NOT NULL" +
        ")";

//Table name
final private String SUBJECT = "SUBJECT";

final private String[] TABLES = {SUBJECT_TABLE};
final private String[] TABLE_NAMES = {SUBJECT};

```

Important:

- The array `TABLES` in database must be sorted in order of creation, to avoid problems with the foreign keys!.

- The array tables in database must be sorted in opposite order by the array of creation tables, for example:

```java
final private String[] TABLES = {SUBJECT_TABLE, EXAM_TABLE, PROFESSOR_TABLE};
//Very important, sorted in opposite order.
final private String[] TABLE_NAMES = {PROFESSOR, EXAM, SUBJECT_TABLE};
```

Create SQLiteHelper:

```java
SQLiteHelper helper = SQLiteHelper.builder()
	.tables(TABLES)
 	.tableNames(TABLE_NAMES)
 	.build(context);

SQLiteDatabase dataBase = helper.getWritableDatabase();
```

In this case, the name and version of the database by default are Name: `com.easysqlite` and Version: `1`. For put the name and version you can do:

```java
SQLiteHelper helper = SQLiteHelper.builder()
	.tables(TABLES)
 	.tableNames(TABLE_NAMES)
 	.build(context, DATABASE_NAME, SQLITE_VERSION);
```

OR

```java
SQLiteHelper helper = SQLiteHelper.builder()
	.tables(TABLES)
 	.tableNames(TABLE_NAMES)
 	.name(DATABASE_NAME)
 	.version(DATABASE_VERSION)
 	.build(context);
```

####If you need one custom implementation:

```java
private static SQLiteHelper.SQLiteHelperCallback helperCallback = new SQLiteHelper.SQLiteHelperCallback() {
        @Override
        public void onCreate(SQLiteDatabase db) {
            db.execSQL(SUBJECT_TABLE);
            db.execSQL("INSERT INTO "+SUBJECT+"(name) VALUES ('Maths')");

            ...
        }

        @Override
        public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
            ...
        }
};

```

```java
SQLiteHelper helper = SQLiteHelper.builder()
	.beginConfig()
		.helperCallback(helperCallback)
		.foreignKey(true)		//PRAGMA foreign_keys = ON
	.endConfig()
	.tables(TABLES)
	.tableNames(TABLE_NAMES)
	.build(context, DATABASE_NAME, cursorFactory, SQLITE_VERSION);
```

If you need change only the method `onCreate` or `onUpgrade`, use `onCreateCallback(OnCreateCallback callback)` or `onUpgradeCallback(OnUpgradeCallback callback)`.

Sample Clean architecture
-------------------------
The code which uses this library is in the package `'com.tonilopezmr.sample.data.SQLite'`.

I use the Clean architecture with the pattern MVP, I have been motivated for the speaker [pedrovgs][10] in DroidCon 2014.

After see the MVP implementations of:

* [MVPCleanArchitecture][6] by [glmoadrian][5]
* [EffectiveAndroidUI][7] by [pedrovgs][4]
* [Android-CleanArchitecture][8] by [android10][9]

Libraries used on the sample project
------------------------------------

* [Dagger][1]
* [Butterknife][2]
* [FloatingActionButton][3]

If anything is wrong contact me
-------------------------------------------

* Antonio López Marín - <tonilopezmr@gmail.com>

######Sorry for my English :(

License
-------

    Copyright 2015 Antonio López Marín <tonilopezmr.com>

    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.

[1]: https://github.com/square/dagger
[2]: https://github.com/JakeWharton/butterknife
[3]: https://github.com/makovkastar/FloatingActionButton
[4]: https://github.com/pedrovgs
[5]: https://github.com/glomadrian
[6]: https://github.com/glomadrian/MvpCleanArchitecture
[7]: https://github.com/pedrovgs/EffectiveAndroidUI
[8]: https://github.com/android10/Android-CleanArchitecture
[9]: https://github.com/android10
[10]: http://www.slideshare.net/PedroVicenteGmezSnch/effective-android-ui-english
[11]: https://twitter.com/jvprofe


text:
function [lambdas, eta, rho, kappa, chosenLambda, chosenRho, chosenEta, s, betaCut, xi] = lcurvecriterion(time, data, t2Vector, plotLcurve,plotCurvature)
% find lambda
% plot L-curve and kappa curve (and where the ideal lamda value is located)

%% Double check that time and data are columns or rows (whatever it needs to be)
%% double check that time is in ms (or whatever it needs to be)
% maybe I just pass it the xSpec array already generated. NEed to figure
% that out.

% Make time and data a column vector if not already
time = time(:);
data = data(:);

%% Construct an array of logarithmically spaced possible T2 values
% xSpec = logspace(log10(t2Min),log10(t2Max),nPts);

%% Generate A matrix (contains set of all possible T2 decays based on the min and max T2 defined as an input to the equation)
A = exp(-time*(1./t2Vector));

%% Perform singular value decomposition (SVD) on the A matrix
%   csvd is a function in the regtools (Hansen's matlab toolbox). It is an svd function (which is built in to Matlab) but with some checks and changes depending on the size of the matrix.
[U,s,V] = csvd(A,'full');

%% Intermediate Calculations
% Initialize variables and calculate lengths
b = data; % Let's call data 'b' to be consistent with Hansen's nomenclature
[m,n] = size(U);
[p, ps] = size(s);
% npoints = length(s);
npoints = 500; % # of points on L-curve. Can edit this # if you want more or less points on the curve.
eta = zeros(npoints,1); rho=eta; lambdas = eta; % intialize vectors with 0's

% Calculate intermediate variables
beta = U'*b; % equation 15 in Hansen paper
betaCut = beta(1:p); % Trim beta vector to be the same size as 's' vector
xi = betaCut ./s; xi( isinf(xi) ) = 0;
s2 = s.^2;

%% Create vector of regularization parameters (lambda's)
smin_ratio = 16*eps;  % Smallest regularization parameter.
lambdas(npoints) = max([s(p), s(1)*smin_ratio]); % fill the last value in the lambda vector with the smallest possible lambda
ratio = (s(1)/lambdas(npoints))^(1/(npoints-1));
for i=npoints-1:-1:1
    lambdas(i) = ratio*lambdas(i+1); % fill in each successive value in the lambda vector by multiplying the smallest possible lambda by the ratio
end

%% Calculate eta, rho, and phi (i.e. eta prime) vectors
for i = 1:npoints
    f = s2 ./(s2 +lambdas(i)^2); % Equation 6 in Hansen's paper
    eta(i) = norm(f.*xi); % Equation 12 (left) in Hansen's paper
    rho(i) = norm((1-f).*betaCut); % Equation 12 (right) in Hansen's paper

    phi(i) = sum(-4.*f.*(1-f).*f.*xi.^2/lambdas(i));  % Equation 15 (left) in Hansen's paper. Phi (in code) = eta prime (in paper)
                     % Off by factor of 2 from lcfun's phi, but this expression matches eq. 15 in the paper. I chose to match what the paper says.
                     % I DO NOT understand when to use (i) and when not to??
end

%% Calculate Kappa (equation 18 in Hansen's paper)
for i = 1:npoints
    % Note: I broke up the expression for kappa into 3 parts (a,b,c), otherwise the line of code would have been too long and hard to understand
    a = eta.*rho./phi'; % left-most fraction, eq.18
    b = lambdas.^2.*rho.*phi' + 2.*lambdas(i).*rho.*eta + lambdas.^4.*eta.*phi'; % top of right-most fraction, eq.18
    c = (lambdas.^4.*eta.^2 + rho.^2).^1.5; % bottom of right-most fraction, eq.18
    %c2 = (reg_param.^2.*eta.^2 + rho.^2).^1.5; % This is the lambda^2 that Hansen's paper has for eq. 18 but I showed this is wrong by
                                                % calculating kappa with this c2 value. It doesn't even have the right shape (just looks like an exponential decay)

    kappa = 2.*a.*b./c; %  put parts of eq.18 together
end

%% Calculate the proper lambda value (corner of the L-curve)
[kappaMax, kappaMaxID] = max(kappa);
chosenLambda = lambdas(kappaMaxID);
chosenRho = rho(kappaMaxID);
chosenEta = eta(kappaMaxID);

%% Plot L-Curve
if plotLcurve==1
    figure; %plot(log10(rho), log10(eta), 'o-');
    loglog(rho, eta,'o-')
    xlabel('Residual Norm ||Ax-b|| (rho)'); ylabel('Solution Norm ||x|| (eta)')
    title('L-curve')
    hold on;
    loglog(chosenRho, chosenEta, '*','MarkerSize',20)
    %plot(log10(chosenRho), log10(chosenEta),'*','MarkerSize',20)
    set(gcf,'color','w'); set(gca,'fontsize',16)
    annotation('textbox','String',sprintf('Corner of L-curve: Lambda = %.3f',chosenLambda),'LineStyle','none','FontSize',16)
end

%% Plot Kappa (Curvature)
if plotCurvature==1
    figure; plot(kappa, 'LineWidth',3);
    set(gcf,'color','w'); set(gca,'fontsize',16)
    hold on;
    plot(kappaMaxID, kappaMax,'*','MarkerSize',20)
    title('Curvature Plot of L-curve (kappa)')
    annotation('textbox','String',sprintf('Max kappa is %.2f at ID # %.0f, \nwhich corresponds to lambda = %.3f',kappaMax, kappaMaxID, chosenLambda),'LineStyle','none','FontSize',16)
end

%figure; plot(eta, rho,'o-')

% save rho, eta, kappa, lambda. L-curve plot with chosen point (both jpeg and fig). Kappa plot (both jpeg and fig).
% create prettyfigure function that white background, big font, no line around legend
% create save figure function that saves things as both png and fig ?


text:
<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;

use App\Repositories\Contracts\UserRepository as UserRepositoryContract;
use App\Repositories\Contracts\PostRepository as PostRepositoryContract;
use App\Repositories\Contracts\RoleRepository as RoleRepositoryContract;
use App\Repositories\Contracts\PermissionRepository as PermissionRepositoryContract;

use App\Repositories\Eloquent\PermissionRepository;
use App\Repositories\Eloquent\RoleRepository;
use App\Repositories\Eloquent\UserRepository;
use App\Repositories\Eloquent\PostRepository;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        //
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        $this->app->bind(UserRepositoryContract::class, UserRepository::class);
        $this->app->bind(PostRepositoryContract::class, PostRepository::class);
        $this->app->bind(RoleRepositoryContract::class, RoleRepository::class);
        $this->app->bind(PermissionRepositoryContract::class, PermissionRepository::class);
    }
}


text:
package ie.macinnes.tvheadend.player.reader;

import android.content.Context;
import android.support.annotation.NonNull;

import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.util.MimeTypes;

import ie.macinnes.htsp.HtspMessage;

public class Mpeg2VideoStreamReader extends PlainStreamReader {

    public Mpeg2VideoStreamReader(Context context) {
        super(context, C.TRACK_TYPE_VIDEO);
    }

    @NonNull
    @Override
    protected Format buildFormat(int streamIndex, @NonNull HtspMessage stream) {
        return Format.createVideoSampleFormat(
                Integer.toString(streamIndex),
                MimeTypes.VIDEO_MPEG2,
                null,
                Format.NO_VALUE,
                Format.NO_VALUE,
                stream.getInteger("width"),
                stream.getInteger("height"),
                StreamReaderUtils.frameDurationToFrameRate(stream.getInteger("duration", Format.NO_VALUE)),
                null,
                null);
    }

    @Override
    protected int getTrackType() {
        return C.TRACK_TYPE_VIDEO;
    }
}


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

<title>Uses of Interface javax.swing.tree.TreeNode (Java Platform SE 7 )</title>
<meta name="date" content="2014-12-18">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Java™ Platform
Standard Ed. 7

Prev

Next

Frames

No Frames

All Classes

Uses of Interface
javax.swing.tree.TreeNode

Packages that use TreeNode

Package
Description

javax.swing

Provides a set of "lightweight"
(all-Java language) components that,
to the maximum degree possible, work the same on all platforms.

javax.swing.text

Provides classes and interfaces that deal with editable
and noneditable text components.

javax.swing.text.html

Provides the class HTMLEditorKit and supporting classes
for creating HTML text editors.

javax.swing.tree

Provides classes and interfaces for dealing with
javax.swing.JTree.

Uses of TreeNode in javax.swing

Classes in javax.swing that implement TreeNode

Modifier and Type
Class and Description

static class
JTree.DynamicUtilTreeNode

DynamicUtilTreeNode can wrap
 vectors/hashtables/arrays/strings and
 create the appropriate children tree nodes as necessary.

Methods in javax.swing that return TreeNode

Modifier and Type
Method and Description

TreeNode
JTree.DynamicUtilTreeNode.getChildAt(int index)

Subclassed to load the children, if necessary.

Constructors in javax.swing with parameters of type TreeNode

Constructor and Description

JTree(TreeNode root)

Returns a JTree with the specified
 TreeNode as its root,
 which displays the root node.

JTree(TreeNode root,
     boolean asksAllowsChildren)

Returns a JTree with the specified TreeNode
 as its root, which
 displays the root node and which decides whether a node is a
 leaf node in the specified manner.

Uses of TreeNode in javax.swing.text

Classes in javax.swing.text that implement TreeNode

Modifier and Type
Class and Description

class
AbstractDocument.AbstractElement

Implements the abstract part of an element.

class
AbstractDocument.BranchElement

Implements a composite element that contains other elements.

class
AbstractDocument.LeafElement

Implements an element that directly represents content of
 some kind.

protected class
DefaultStyledDocument.SectionElement

Default root element for a document...

Methods in javax.swing.text that return TreeNode

Modifier and Type
Method and Description

TreeNode
AbstractDocument.AbstractElement.getChildAt(int childIndex)

Returns the child TreeNode at index
 childIndex.

TreeNode
AbstractDocument.AbstractElement.getParent()

Returns the parent TreeNode of the receiver.

Methods in javax.swing.text with parameters of type TreeNode

Modifier and Type
Method and Description

int
AbstractDocument.AbstractElement.getIndex(TreeNode node)

Returns the index of node in the receivers children.

Uses of TreeNode in javax.swing.text.html

Classes in javax.swing.text.html that implement TreeNode

Modifier and Type
Class and Description

class
HTMLDocument.BlockElement

An element that represents a structural block of
 HTML.

class
HTMLDocument.RunElement

An element that represents a chunk of text that has
 a set of HTML character level attributes assigned to
 it.

Uses of TreeNode in javax.swing.tree

Subinterfaces of TreeNode in javax.swing.tree

Modifier and Type
Interface and Description

interface
MutableTreeNode

Defines the requirements for a tree node object that can change --
 by adding or removing child nodes, or by changing the contents
 of a user object stored in the node.

Classes in javax.swing.tree that implement TreeNode

Modifier and Type
Class and Description

class
DefaultMutableTreeNode

A DefaultMutableTreeNode is a general-purpose node in a tree data
 structure.

Fields in javax.swing.tree declared as TreeNode

Modifier and Type
Field and Description

protected TreeNode
DefaultTreeModel.root

Root of the tree.

Fields in javax.swing.tree with type parameters of type TreeNode

Modifier and Type
Field and Description

static Enumeration<TreeNode>
DefaultMutableTreeNode.EMPTY_ENUMERATION

An enumeration that is always empty.

Methods in javax.swing.tree that return TreeNode

Modifier and Type
Method and Description

TreeNode
DefaultMutableTreeNode.getChildAfter(TreeNode aChild)

Returns the child in this node's child array that immediately
 follows aChild, which must be a child of this node.

TreeNode
TreeNode.getChildAt(int childIndex)

Returns the child TreeNode at index
 childIndex.

TreeNode
DefaultMutableTreeNode.getChildAt(int index)

Returns the child at the specified index in this node's child array.

TreeNode
DefaultMutableTreeNode.getChildBefore(TreeNode aChild)

Returns the child in this node's child array that immediately
 precedes aChild, which must be a child of this node.

TreeNode
DefaultMutableTreeNode.getFirstChild()

Returns this node's first child.

TreeNode
DefaultMutableTreeNode.getLastChild()

Returns this node's last child.

TreeNode
TreeNode.getParent()

Returns the parent TreeNode of the receiver.

TreeNode
DefaultMutableTreeNode.getParent()

Returns this node's parent or null if this node has no parent.

TreeNode[]
DefaultMutableTreeNode.getPath()

Returns the path from the root, to get to this node.

TreeNode[]
DefaultTreeModel.getPathToRoot(TreeNode aNode)

Builds the parents of node up to and including the root node,
 where the original node is the last element in the returned array.

protected TreeNode[]
DefaultTreeModel.getPathToRoot(TreeNode aNode,
             int depth)

Builds the parents of node up to and including the root node,
 where the original node is the last element in the returned array.

protected TreeNode[]
DefaultMutableTreeNode.getPathToRoot(TreeNode aNode,
             int depth)

Builds the parents of node up to and including the root node,
 where the original node is the last element in the returned array.

TreeNode
DefaultMutableTreeNode.getRoot()

Returns the root of the tree that contains this node.

TreeNode
DefaultMutableTreeNode.getSharedAncestor(DefaultMutableTreeNode aNode)

Returns the nearest common ancestor to this node and aNode.

Methods in javax.swing.tree with parameters of type TreeNode

Modifier and Type
Method and Description

TreeNode
DefaultMutableTreeNode.getChildAfter(TreeNode aChild)

Returns the child in this node's child array that immediately
 follows aChild, which must be a child of this node.

TreeNode
DefaultMutableTreeNode.getChildBefore(TreeNode aChild)

Returns the child in this node's child array that immediately
 precedes aChild, which must be a child of this node.

int
TreeNode.getIndex(TreeNode node)

Returns the index of node in the receivers children.

int
DefaultMutableTreeNode.getIndex(TreeNode aChild)

Returns the index of the specified child in this node's child array.

TreeNode[]
DefaultTreeModel.getPathToRoot(TreeNode aNode)

Builds the parents of node up to and including the root node,
 where the original node is the last element in the returned array.

protected TreeNode[]
DefaultTreeModel.getPathToRoot(TreeNode aNode,
             int depth)

Builds the parents of node up to and including the root node,
 where the original node is the last element in the returned array.

protected TreeNode[]
DefaultMutableTreeNode.getPathToRoot(TreeNode aNode,
             int depth)

Builds the parents of node up to and including the root node,
 where the original node is the last element in the returned array.

boolean
DefaultMutableTreeNode.isNodeAncestor(TreeNode anotherNode)

Returns true if anotherNode is an ancestor of this node
 -- if it is this node, this node's parent, or an ancestor of this
 node's parent.

boolean
DefaultMutableTreeNode.isNodeChild(TreeNode aNode)

Returns true if aNode is a child of this node.

boolean
DefaultMutableTreeNode.isNodeSibling(TreeNode anotherNode)

Returns true if anotherNode is a sibling of (has the
 same parent as) this node.

void
DefaultTreeModel.nodeChanged(TreeNode node)

Invoke this method after you've changed how node is to be
 represented in the tree.

void
DefaultTreeModel.nodesChanged(TreeNode node,
            int[] childIndices)

Invoke this method after you've changed how the children identified by
 childIndicies are to be represented in the tree.

void
DefaultTreeModel.nodeStructureChanged(TreeNode node)

Invoke this method if you've totally changed the children of
 node and its childrens children...

void
DefaultTreeModel.nodesWereInserted(TreeNode node,
                 int[] childIndices)

Invoke this method after you've inserted some TreeNodes into
 node.

void
DefaultTreeModel.nodesWereRemoved(TreeNode node,
                int[] childIndices,
                Object[] removedChildren)

Invoke this method after you've removed some TreeNodes from
 node.

Enumeration
DefaultMutableTreeNode.pathFromAncestorEnumeration(TreeNode ancestor)

Creates and returns an enumeration that follows the path from
 ancestor to this node.

void
DefaultTreeModel.reload(TreeNode node)

Invoke this method if you've modified the TreeNodes upon which
 this model depends.

void
DefaultTreeModel.setRoot(TreeNode root)

Sets the root to root.

Constructors in javax.swing.tree with parameters of type TreeNode

Constructor and Description

DefaultTreeModel(TreeNode root)

Creates a tree in which any node can have children.

DefaultTreeModel(TreeNode root,
                boolean asksAllowsChildren)

Creates a tree specifying whether any node can have children,
 or whether only certain nodes can have children.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Java™ Platform
Standard Ed. 7

Prev

Next

Frames

No Frames

All Classes

 Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
 Copyright © 1993, 2015, Oracle and/or its affiliates.  All rights reserved.


text:
"""
Created on Thu May 25 12:55:32 2017

@author: azkei
Sorting and Ranking indexes
"""
# 1. Sorting items in a Series
ser = pd.Series([5,0,3,8,4], index=['red','blue','yellow','white','green'])
ser
# Sorting row indexes based alphabetical order in ascending order
ser.sort_index()
# Sorting descending order
ser.sort_index(ascending=False)

# Sorting based on rows and column labels
frame = pd.DataFrame(np.arange(16).reshape((4,4)),
                     index = ['red','blue','yellow','white'],
                     columns = ['ball','pen','pencil','paper'])
frame
# Row Sort
frame.sort_index()
# Column Sort
frame.sort_index(axis = 1)

# Sorting values in the Series
ser.order()

# Specify the name of the column which to sort
frame.sort_index(by='pen')

# If the criteria of sorting will be based on two or more columns
# You can assign an array containing the names of the columns to the by option
frame.sort_index(by=['pen','pencil'])

# Ranking - consists of assigning a rank(value 0 - ascending) to each elemnt of the series.
ser.rank()
# In this case the lowest value got the lowest rank and the highest value got the highest
# The rank can be assigned in the order in which the data is already okaced
ser.rank(method = 'first')

# Reverse the criterion - the largest value is the lowest rank, vice versa
ser.rank(ascending = False)


text:
FROM ubuntu
MAINTAINER Rey Tucker <docker@reytucker.us>
RUN sed -i -e "s|archive.ubuntu.com|mirrors.linode.com|g" /etc/apt/sources.list
RUN apt-get update
RUN apt-get dist-upgrade -y

RUN dpkg --add-architecture i386
RUN apt-get update
RUN apt-get install -y build-essential libstdc++6:i386 language-pack-en git clang curl
RUN apt-get build-dep -y bladerf

ADD inc/autobuild.sh        /bladerf/autobuild.sh
ADD inc/autobuild_inc.sh    /bladerf/autobuild_inc.sh
ADD inc/builder_loop.sh     /bladerf/builder_loop.sh
ADD inc/clean_builds.sh     /bladerf/clean_builds.sh
ADD inc/coverity_upload.sh  /bladerf/coverity_upload.sh
ADD inc/update_html.sh      /bladerf/update_html.sh

WORKDIR /srv/bladerf

ENV BINDIR          /bladerf
ENV WORKDIR         /srv/bladerf
ENV QUARTUS_PATH    /opt/altera/17.0
#ENV COVERITY_PATH   /opt/coverity/cov-analysis-linux64-7.6.0/bin
ENV TZ              Etc/UTC
ENV REVISION        HEAD

RUN git config --global user.email "bladeRF-buildbot@reytucker.us"
RUN git config --global user.name "bladeRF buildbot"

CMD ["bash", "/bladerf/builder_loop.sh"]


text:
                                General web application settings

                                <?=form_open_multipart($form_action,' role="form" ')?>

                                                Company name :

                                                   <input autofocus class="form-control form-control-solid placeholder-no-fix form-group" type="text" autocomplete="off" placeholder="Company name" minlength="1" maxlength="255" name="company" value="<?=$settings->company;?>" required/>

                                                Address :

                                                    <input autofocus class="form-control form-control-solid placeholder-no-fix form-group" type="text" autocomplete="off" placeholder="Address" name="address" minlength="3" maxlength="255" value="<?=$settings->address;?>" required/>

                                                City :

                                                    <input autofocus class="form-control form-control-solid placeholder-no-fix form-group" type="text" autocomplete="off" placeholder="City" name="city" minlength="3" maxlength="60" value="<?=humanize($settings->city);?>" required/>

                                                Contact Person :

                                                    <input autofocus class="form-control form-control-solid placeholder-no-fix form-group" type="text" autocomplete="off" placeholder="Contact person" minlength="3" maxlength="150" name="contact_person" value="<?=humanize($settings->contact_person);?>" required/>

                                                Contact Number :

                                                    <input autofocus class="form-control form-control-solid placeholder-no-fix form-group" type="text" autocomplete="off" placeholder="Contact number" maxlength="15" name="contact_number" value="<?=humanize($settings->contact_number);?>" required/>

                                                User credential email subject :

                                                    <input autofocus class="form-control form-control-solid placeholder-no-fix form-group" type="text" autocomplete="off" placeholder="Credential email subject" maxlength="150" name="credentials_mail_subject" value="<?=$settings->credentials_mail_subject;?>" required/>

                                                User password reset subject :

                                                    <input autofocus class="form-control form-control-solid placeholder-no-fix form-group" type="text" autocomplete="off" placeholder="Password reset subject" maxlength="150" name="pw_reset_mail_subject" value="<?=$settings->pw_reset_mail_subject;?>" required/>

                                                Logo :

                                                          Select file
                                                          Change
                                                          <input type="file" name="logo">

                                                      Remove

                                                    NOTE! Max picture dimention is 800x800

                                                    <img src="files/media/<?=$settings->logo;?>" alt="Logo" width="30%">

                                                Email :

                                                    <input autofocus class="form-control form-control-solid placeholder-no-fix form-group" type="email" autocomplete="off" placeholder="Email" name="email" maxlength="150" value="<?=$settings->email;?>" required/>

                                                Domain :

                                                    <input autofocus class="form-control form-control-solid placeholder-no-fix form-group" type="url" autocomplete="off" placeholder="Domain" name="domain" maxlength="60" value="<?=$settings->domain;?>" required/>

                                                    Full URL to your web application installation. Including subfolder i.e. http://www.yoursite.com/webapp/

                                                User Idle time :

                                                    <input autofocus class="form-control form-control-solid placeholder-no-fix form-group" type="number" name="idle" min="1" value="<?=$settings->idle;?>" required/>

                                                    Number of seconds before the system locks down when user is idle.

                                                Rectangle logo :

                                                          Select file
                                                          Change
                                                          <input type="file" name="small-logo">

                                                      Remove

                                                    NOTE! Max picture dimention is 94x14

                                                    <img style="background-color: #000; width: 60%;" alt="Logo" src="files/media/<?=$settings->small_logo;?>">

                                                Maintenance mode :

                                                         <input type="checkbox" name='maintenance' class='checkbox-fullsize' data-labelauty="Maintenance mode disabled|Maintenance mode enabled" <?php echo ($settings->maintenance)? "checked": "";?>/>

                                                 Short website description :

                                                   <textarea name="short_description" maxlength="1000" class="form-control" rows="13"><?=$settings->short_description;?></textarea>

                                                 Full website description :

                                                    <textarea name="full_description" maxlength="10000" id="settings_about"><?=$settings->full_description;?></textarea>

                                                        <button type="submit" class="btn blue">Save</button>

                                  <?=form_close();?>


text:
<!DOCTYPE html >

          <title>local - io.gearpump.jarstore.local</title>
          <meta name="description" content="local - io.gearpump.jarstore.local" />
          <meta name="keywords" content="local io.gearpump.jarstore.local" />
          <meta http-equiv="content-type" content="text/html; charset=UTF-8" />

      <link href="../../../../lib/template.css" media="screen" type="text/css" rel="stylesheet" />
      <link href="../../../../lib/diagrams.css" media="screen" type="text/css" rel="stylesheet" id="diagrams-css" />

io.gearpump.jarstore

local

        package

        local

<input id="mbrsel-input" type="text" accesskey="/" />

            Visibility

Public

All

Type Members

        class

        LocalJarStore extends Actor with Stash

LocalJarStore store the uploaded jar on local disk.

        class

        LocalJarStoreService extends JarStoreService

LocalJarStoreService store the uploaded jar on local disk.

Ungrouped


text:
#ifndef _PROTO_CAP
#define _PROTO_CAP

/**
* @class ProtoCap
* @brief This class is a generic base class for simple
 *       link layer packet capture (ala libpcap) and
 *       raw link layer packet transmission.
 */

#include "protoChannel.h"
#include "protoAddress.h"

class ProtoCap : public ProtoChannel
{
    public:
        static ProtoCap* Create();
        virtual ~ProtoCap();

        // Packet capture "direction"
        enum Direction
        {
            UNSPECIFIED,
            INBOUND,
            OUTBOUND
        };

        // These must be overridden for different implementations
        // ProtoCap::Open() MUST also be called at the _end_ of derived
        // implementations' Open() method
        virtual bool Open(const char* interfaceName = NULL)
            {return ProtoChannel::Open();}
        virtual bool IsOpen()
            {return ProtoChannel::IsOpen();}
        // ProtoCap::Close() should also be called at the _beginning_ of
        // derived implementations' Close() method
        virtual void Close()
        {
            ProtoChannel::Close();
            if_index = -1;
        }

        unsigned int GetInterfaceIndex() const
            {return if_index;}

        const ProtoAddress& GetInterfaceAddr() const
            {return if_addr;}

        virtual bool Recv(char* buffer, unsigned int& numBytes, Direction* direction = NULL) = 0;
        virtual bool Send(const char* buffer, unsigned int& numBytes) = 0;

        bool Forward(char* buffer, unsigned int& numBytes);

        bool ForwardFrom(char* buffer, unsigned int& numBytes, const ProtoAddress& srcMacAddr);

        void SetUserData(const void* userData)
            {user_data = userData;}
        const void* GetUserData() const
            {return user_data;}

    protected:
        ProtoCap();
        unsigned int    if_index; // interface index (if applicable)
        ProtoAddress    if_addr;  // interface MAC addr (if applicable)

    private:
        const void*     user_data;

};  // end class ProtoCap

#endif // _PROTO_CAP


text:
Rails is a web-application framework that includes everything needed to
create database-backed web applications according to the
[Model-View-Controller (MVC)](http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller)
pattern.

Understanding the MVC pattern is key to understanding Rails. MVC divides your
application into three layers, each with a specific responsibility.

The _View layer_ is composed of "templates" that are responsible for providing
appropriate representations of your application's resources. Templates can
come in a variety of formats, but most view templates are HTML with embedded
Ruby code (ERB files).

The _Model layer_ represents your domain model (such as Account, Product,
Person, Post, etc.) and encapsulates the business logic that is specific to
your application. In Rails, database-backed model classes are derived from
`ActiveRecord::Base`. Active Record allows you to present the data from
database rows as objects and embellish these data objects with business logic
methods. Although most Rails models are backed by a database, models can also
be ordinary Ruby classes, or Ruby classes that implement a set of interfaces
as provided by the Active Model module. You can read more about Active Record
in its [README](activerecord/README.rdoc).

The _Controller layer_ is responsible for handling incoming HTTP requests and
providing a suitable response. Usually this means returning HTML, but Rails
controllers can also generate XML, JSON, PDFs, mobile-specific views, and
more. Controllers manipulate models and render view templates in order to
generate the appropriate HTTP response.

In Rails, the Controller and View layers are handled together by Action Pack.
These two layers are bundled in a single package due to their heavy interdependence.
This is unlike the relationship between Active Record and Action Pack, which are
independent. Each of these packages can be used independently outside of Rails. You
can read more about Action Pack in its [README](actionpack/README.rdoc).

## Getting Started

1. Install Rails at the command prompt if you haven't yet:

        gem install rails

2. At the command prompt, create a new Rails application:

        rails new myapp

   where "myapp" is the application name.

3. Change directory to `myapp` and start the web server:

        cd myapp
        rails server

   Run with `--help` or `-h` for options.

4. Go to http://localhost:3000 and you'll see: "Welcome aboard: You're riding Ruby on Rails!"

5. Follow the guidelines to start developing your application. You may find
   the following resources handy:
    * [Getting Started with Rails](http://guides.rubyonrails.org/getting_started.html)
    * [Ruby on Rails Guides](http://guides.rubyonrails.org)
    * [The API Documentation](http://api.rubyonrails.org)
    * [Ruby on Rails Tutorial](http://ruby.railstutorial.org/ruby-on-rails-tutorial-book)

## Contributing

We encourage you to contribute to Ruby on Rails! Please check out the
[Contributing to Ruby on Rails guide](http://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html) for guidelines about how to proceed. [Join us!](http://contributors.rubyonrails.org)

## Code Status

* [![Build Status](https://api.travis-ci.org/rails/rails.png)](https://travis-ci.org/rails/rails)
* [![Dependencies](https://gemnasium.com/rails/rails.png?travis)](https://gemnasium.com/rails/rails)

## License

Ruby on Rails is released under the [MIT License](http://www.opensource.org/licenses/MIT).


text:
import Tooltip from 'tooltip.js';
import './press-tip.scss';
import { IDirective } from 'angular';

export function PressTip(): IDirective {
  'ngInject';

  return {
    restrict: 'A',
    link($scope, $element, $attrs) {
      let tooltip: Tooltip | null = null;
      let timer: number | null = null;

      function showTip() {
        if (!tooltip) {
          let title = $attrs.pressTip;
          if ($attrs.pressTipTitle) {
            title = `<h2>${$attrs.pressTipTitle}</h2>${title}`;
          }
          tooltip = new Tooltip($element[0], {
            placement: 'top', // or bottom, left, right, and variations
            title,
            html: true,
            trigger: 'manual',
            container: 'body'
          });
          tooltip.show();
        }
      }

      $element.on('mouseenter', () => {
        timer = window.setTimeout(() => {
          showTip();
        }, 100);
      });

      $element.on('mousedown touchstart', (e) => {
        e.preventDefault();
        showTip();
      });

      $element.on('mouseup mouseleave touchend', (e) => {
        e.preventDefault();
        if (tooltip) {
          tooltip.dispose();
          tooltip = null;
        }
        if (timer) {
          clearTimeout(timer);
        }
      });

      $scope.$on('$destroy', () => {
        if (tooltip) {
          tooltip.dispose();
          tooltip = null;
        }
      });
    }
  };
}


text:
<?php

namespace bl\emailTemplates\models\entities;

use bl\multilang\behaviors\TranslationBehavior;
use yii\db\ActiveRecord;

use bl\emailTemplates\EmailTemplates;

/**
 * This is the model class for table "email_template".
 *
 * @property integer $id
 * @property string $key
 *
 * @property EmailTemplateTranslation[] $translations
 * @property EmailTemplateTranslation $translation
 *
 * @author Vladimir Kuprienko <vldmr.kuprienko@gmail.com>
 */
class EmailTemplate extends ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'email_template';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['key'], 'unique']
        ];
    }

    public function behaviors()
    {
        return [
            'translation' => [
                'class' => TranslationBehavior::className(),
                'translationClass' => EmailTemplateTranslation::className(),
                'relationColumn' => 'template_id'
            ]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id'  => EmailTemplates::t('model', 'ID'),
            'key' => EmailTemplates::t('model', 'Key'),
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getTranslations()
    {
        return $this->hasMany(EmailTemplateTranslation::className(), ['template_id' => 'id']);
    }

    /**
     * Get template id by key
     *
     * @param string $key Key of the template
     * @return false|null|string
     */
    public static function getIdByKey($key)
    {
        return static::find()
            ->select('id')
            ->where(['key' => $key])
            ->scalar();
    }
}


text:
package picard.vcf;

import htsjdk.samtools.util.CollectionUtil;
import htsjdk.variant.variantcontext.Allele;
import htsjdk.variant.variantcontext.Genotype;
import htsjdk.variant.variantcontext.GenotypeBuilder;
import htsjdk.variant.variantcontext.VariantContext;
import htsjdk.variant.variantcontext.VariantContextBuilder;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

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

/**
 * Created by farjoun on 12/26/15.
 */
public class CallingMetricAccumulatorTest {

    @DataProvider(name = "getSingletonSampleData")
    public Object[][] getSingletonSampleData() {
        final List<Object[]> retval = new ArrayList<>(10);

        final Allele ARef = Allele.create("A", true);
        final Allele G = Allele.create("G", false);
        final Allele C = Allele.create("C", false);

        final GenotypeBuilder genotypeBuilder = new GenotypeBuilder().alleles(CollectionUtil.makeList(ARef, C));
        final VariantContextBuilder builder = new VariantContextBuilder();

        // one het
        final Genotype het = genotypeBuilder.name("het").make();
        builder.chr("1").start(1).stop(1).alleles(CollectionUtil.makeList(ARef, C, G)).genotypes(Collections.singletonList(het));
        retval.add(new Object[]{builder.make(), "het"});

        //a het and a hom ref
        final Genotype homref = genotypeBuilder.name("homref").alleles(CollectionUtil.makeList(ARef)).make();
        builder.genotypes(CollectionUtil.makeList(het, homref));
        retval.add(new Object[]{builder.make(), "het"});

        // a het, a homvar and a homref
        final Genotype homvar = genotypeBuilder.name("homvar").alleles(CollectionUtil.makeList(C)).make();
        builder.genotypes(CollectionUtil.makeList(het, homref, homvar));
        retval.add(new Object[]{builder.make(), null});

        // two hets and a homref
        final Genotype het2 = genotypeBuilder.name("het2").alleles(CollectionUtil.makeList(ARef, G)).make();
        builder.genotypes(CollectionUtil.makeList(het, homref, het2));
        retval.add(new Object[]{builder.make(), null});

        // a homvar
        builder.genotypes(CollectionUtil.makeList(homvar));
        retval.add(new Object[]{builder.make(), null});

        // a homvar, and a homref
        builder.genotypes(CollectionUtil.makeList(homvar, homref));
        retval.add(new Object[]{builder.make(), null});

        // two homrefs
        final Genotype homref2 = genotypeBuilder.name("homref2").alleles(CollectionUtil.makeList(ARef)).make();
        builder.genotypes(CollectionUtil.makeList(homref, homref2));
        retval.add(new Object[]{builder.make(), null});

        return retval.toArray(new Object[retval.size()][]);
    }

    @Test(dataProvider = "getSingletonSampleData")
    public void testGetSingletonSample(final VariantContext vc, final String sample) throws Exception {
        Assert.assertEquals(CallingMetricAccumulator.getSingletonSample(vc), sample);
    }
}


text:
$(function(){
    // user page
    // user delete
    $(".user-delete").click(function(){
        if(!confirm("你确定要删除此账号吗")){
            return false
        }
        $.ajax({
            method: "DELETE",
            url: $(this).data('url'),
            data: {
                "user-id" : $(this).data('id')
            },
            success: data => {
                if(data.success){
                    $("body").append(`

                        删除成功!
                        <button type="button" class="close" data-dismiss="alert" aria-label="Close" onclick="window.location.reload()"
                        ×
                        </button>

                    `)
                    setTimeout(() => {
                        window.location.reload()
                    }, 1000);
                }else{
                    $("body").append(`

                        服务器错误!请联系管理员
                        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                        ×
                        </button>

                  `);
                }
            },
            error: ()=>{
                $("body").append(`

                        服务器错误!请联系管理员
                        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                        ×
                        </button>

                  `);
            }
        })
    })

    //user edit
    $("#editUserModal").on('show.bs.modal', function(event){
        $(this).find('#user-name-edit').val($(event.relatedTarget).data('name'))
        $(this).find('#user-email-edit').val($(event.relatedTarget).data('email'))
        $(this).find('#user-id').text($(event.relatedTarget).data('id'))
    })
    $("#user-name-edit").change(function(){
        if($(this).val()==""){
            $(this).removeClass("is-valid").addClass("is-invalid").siblings(".invalid-feedback").text("请输入用户名")
            return false
        }else{
            $(this).removeClass("is-invalid").addClass("is-valid").siblings(".invalid-feedback").text("")
        }
    })
    $("#user-edit").on("click", function(){
        if($("#user-name-edit").val()==""){
            $("#user-name-edit").removeClass("is-valid").addClass("is-invalid").siblings(".invalid-feedback").text("请输入用户名")
            return false
        }else{
            $("#role-name-edit").removeClass("is-invalid").addClass("is-valid").siblings(".invalid-feedback").text("")
        }
        $.ajax({
            type: "PUT",
            url: $(this).data("url"),
            data: {
                "user-id" : $('#user-id').text(),
                "user-name" : $('#user-name-edit').val(),
                "user-email" : $('#user-email-edit').val()
            },
            success: data => {
                if(data.success){
                    $("#editUserModal").modal("hide")
                    $("body").append(`

                        修改成功!
                        <button type="button" class="close" data-dismiss="alert" aria-label="Close" onclick="window.location.reload()"
                        ×
                        </button>

                    `)
                    setTimeout(() => {
                        window.location.reload()
                    }, 1000);
                }else{
                    $("body").append(`

                        服务器错误!请联系管理员
                        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                        ×
                        </button>

                  `);
                }
            },
            error: ()=>{
                $("body").append(`

                        服务器错误!请联系管理员
                        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                        ×
                        </button>

                `);
            }
        })
    })

    // User role select
    $(".get-user-id").click(function(){
        $($('#role-select').children()).each(function(){
            $(this).attr('selected', false)
        })
        $.ajax({
            type: 'GET',
            url: $(this).data('url'),
            data: {
                "id" : $(this).data('id'),
            },
            success: data =>{
                // $('#role-select').children(":first").attr('selected', false)

                $($('#role-select').children()).each(function(){
                    data.forEach(element => {
                        if($(this).val()==element){
                            $(this).attr('selected', true)
                        }
                    });
                })
            },
            error: ()=>{

            }
        })
    })

    $("#editUserRoleModal").on('show.bs.modal', function(event){
        $(this).find('#user-id-2').text($(event.relatedTarget).data('id'))
    })
    $("#user-role-edit").click(function(){
        $.ajax({
            type: "POST",
            url: $(this).data("url"),
            data: {
                "user-id" : $('#user-id-2').text(),
                "user-roles" : $('#role-select').val(),
            },
            success: data => {
                if(data.success){
                    $("#editUserRoleModal").modal("hide")
                    $("body").append(`

                        修改成功!
                        <button type="button" class="close" data-dismiss="alert" aria-label="Close" onclick="window.location.reload()"
                        ×
                        </button>

                    `)
                    setTimeout(() => {
                        window.location.reload()
                    }, 1000);
                }else if(data.notify){
                    $(".toast").toast('show')
                }else{
                    $("body").append(`

                        服务器错误!请联系管理员
                        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                        ×
                        </button>

                  `);
                }
            },
            error: ()=>{
                $("body").append(`

                        服务器错误!请联系管理员
                        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                        ×
                        </button>

                `);
            }
        })
    })
})


text:
import time

import praw

__all__ = ['PrawOAuth2Mini']

REDIRECT_URL = 'http://127.0.0.1:9999/authorize_callback'
SCOPES = ['identity', 'read']
EXPIRY_DURATION = 3500

class PrawOAuth2Mini:

    """
    Creates a `PrawOAuth2Mini` instance. `PrawOAuth2Mini` meant to be
    used in the bot and it needs valid `access_token` and `refresh_token`
    to operate. Once the `access_token` is expired, it will be refreshed
    using the `refresh_token`

    :param reddit_client: An Instance of praw
    :param app_key: App Secret (or also known as Client Id) of your
        app. Find them here: https://www.reddit.com/prefs/apps/
    :param app_secret: App Key (or also known as Client Secret) of your
        app. Find them here: https://www.reddit.com/prefs/apps/
    :param access_token: Once you have authorized your Reddit account with
        the app/bot/script using `PrawOAuth2Server`, you get a valid
        `access_token` (which expires after 60 minutes).
    :param refresh_token: Once you have authorized your Reddit account with
        the app/bot/script using `PrawOAuth2Server`, you get a valid
        `refresh_token`.
    :param scopes: List of scopes for OAuth. Default is `['identity', 'read']`.
        https://praw.readthedocs.org/en/latest/pages/oauth.html#oauth-scopes
    :param redirect_url: Redirect URL used in authorization process using
        `PrawOAuth2Server`. Default is `http://127.0.0.1:9999/authorize_callback`
        (which is recommended by praw).

    Make sure you provide same `scopes` and `redirect_url` which you used
    with `PrawOAuth2Server`.
    """

    def __init__(self, reddit_client, app_key,
                 app_secret, access_token,
                 refresh_token, scopes=SCOPES,
                 redirect_url=REDIRECT_URL):
        self.reddit_client = reddit_client
        self.app_key = app_key
        self.app_secret = app_secret
        self.access_token = access_token
        self.refresh_token = refresh_token
        self.scopes = set(scopes)
        self.redirect_url = redirect_url
        self.validity = 0

        self._set_app_info()
        self._set_access_credentials_first_time()

    def _set_validity(self):
        self.validity = time.time() + EXPIRY_DURATION

    def _is_token_expired(self):
        return time.time() > self.validity

    def _set_app_info(self):
        self.reddit_client.set_oauth_app_info(client_id=self.app_key,
                                              client_secret=self.app_secret,
                                              redirect_uri=self.redirect_url)

    def _set_access_credentials(self):
        self.reddit_client.set_access_credentials(
            scope=self.scopes, access_token=self.access_token,
            refresh_token=self.refresh_token)
        self._set_validity()

    def _set_access_credentials_first_time(self):
        try:
            self._set_access_credentials()
        except praw.errors.OAuthInvalidToken:
            self.refresh()

    def _get_refresh_access(self):
        return self.reddit_client.refresh_access_information(
            refresh_token=self.refresh_token)

    def refresh(self, force=False):
        """Refreshes the `access_token` and sets the praw instance `reddit_client`
        with a valid one.

        :param force: Boolean. Refresh will be done only when last refresh was
            done before `EXPIRY_DURATION`, which is 3500 seconds. However
            passing `force` will overrides this and refresh operation will be
            done everytime.
        """
        if self._is_token_expired() or force:
            tokens = self._get_refresh_access()
            self.access_token = tokens['access_token']
            self.refresh_token = tokens['refresh_token']
            self._set_access_credentials()

    def get_access_codes(self):
        """Returns the `access_token` and `refresh_token`.

        :returns: A dictionary containing `access_token` and `refresh_token`.
        """
        return {'access_token': self.access_token,
                'refresh_token': self.refresh_token}


text:
from PyQt4 import QtCore, QtGui

class Ui_LinBckndDialog(object):
    def setupUi(self, LinBckndDialog):
        LinBckndDialog.setObjectName("LinBckndDialog")
        LinBckndDialog.resize(735, 275)
        self.buttonBox = QtGui.QDialogButtonBox(LinBckndDialog)
        self.buttonBox.setGeometry(QtCore.QRect(520, 210, 191, 32))
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.imageComboBox0 = QtGui.QComboBox(LinBckndDialog)
        self.imageComboBox0.setGeometry(QtCore.QRect(385, 80, 346, 31))
        self.imageComboBox0.setObjectName("imageComboBox0")
        self.normrankSpinBox = QtGui.QDoubleSpinBox(LinBckndDialog)
        self.normrankSpinBox.setGeometry(QtCore.QRect(360, 10, 62, 27))
        self.normrankSpinBox.setMaximum(1.0)
        self.normrankSpinBox.setSingleStep(0.1)
        self.normrankSpinBox.setProperty("value", QtCore.QVariant(0.5))
        self.normrankSpinBox.setObjectName("normrankSpinBox")
        self.label = QtGui.QLabel(LinBckndDialog)
        self.label.setGeometry(QtCore.QRect(20, 15, 346, 17))
        self.label.setObjectName("label")
        self.label_2 = QtGui.QLabel(LinBckndDialog)
        self.label_2.setGeometry(QtCore.QRect(20, 55, 341, 16))
        self.label_2.setObjectName("label_2")
        self.label_3 = QtGui.QLabel(LinBckndDialog)
        self.label_3.setGeometry(QtCore.QRect(390, 55, 246, 17))
        self.label_3.setObjectName("label_3")
        self.imagefracLineEdit0 = QtGui.QLineEdit(LinBckndDialog)
        self.imagefracLineEdit0.setGeometry(QtCore.QRect(0, 85, 376, 27))
        self.imagefracLineEdit0.setObjectName("imagefracLineEdit0")
        self.imagefracLineEdit1 = QtGui.QLineEdit(LinBckndDialog)
        self.imagefracLineEdit1.setGeometry(QtCore.QRect(0, 125, 376, 27))
        self.imagefracLineEdit1.setObjectName("imagefracLineEdit1")
        self.imageComboBox1 = QtGui.QComboBox(LinBckndDialog)
        self.imageComboBox1.setGeometry(QtCore.QRect(385, 120, 346, 31))
        self.imageComboBox1.setObjectName("imageComboBox1")
        self.precisionSpinBox = QtGui.QDoubleSpinBox(LinBckndDialog)
        self.precisionSpinBox.setGeometry(QtCore.QRect(285, 180, 76, 27))
        self.precisionSpinBox.setDecimals(3)
        self.precisionSpinBox.setSingleStep(0.01)
        self.precisionSpinBox.setProperty("value", QtCore.QVariant(0.01))
        self.precisionSpinBox.setObjectName("precisionSpinBox")
        self.label_4 = QtGui.QLabel(LinBckndDialog)
        self.label_4.setGeometry(QtCore.QRect(30, 185, 251, 17))
        self.label_4.setObjectName("label_4")
        self.zerofracSpinBox = QtGui.QDoubleSpinBox(LinBckndDialog)
        self.zerofracSpinBox.setGeometry(QtCore.QRect(285, 215, 76, 27))
        self.zerofracSpinBox.setDecimals(3)
        self.zerofracSpinBox.setSingleStep(0.01)
        self.zerofracSpinBox.setProperty("value", QtCore.QVariant(0.05))
        self.zerofracSpinBox.setObjectName("zerofracSpinBox")
        self.label_5 = QtGui.QLabel(LinBckndDialog)
        self.label_5.setGeometry(QtCore.QRect(80, 220, 206, 17))
        self.label_5.setObjectName("label_5")
        self.propogateCheckBox = QtGui.QCheckBox(LinBckndDialog)
        self.propogateCheckBox.setGeometry(QtCore.QRect(390, 245, 276, 22))
        self.propogateCheckBox.setObjectName("propogateCheckBox")

        self.retranslateUi(LinBckndDialog)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), LinBckndDialog.accept)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), LinBckndDialog.reject)
        QtCore.QMetaObject.connectSlotsByName(LinBckndDialog)

    def retranslateUi(self, LinBckndDialog):
        LinBckndDialog.setWindowTitle(QtGui.QApplication.translate("LinBckndDialog", "Dialog", None, QtGui.QApplication.UnicodeUTF8))
        self.label.setText(QtGui.QApplication.translate("LinBckndDialog", "intensity rank to use for mean intensity calibration:", None, QtGui.QApplication.UnicodeUTF8))
        self.label_2.setText(QtGui.QApplication.translate("LinBckndDialog", "trial background weights for search algorithm:", None, QtGui.QApplication.UnicodeUTF8))
        self.label_3.setText(QtGui.QApplication.translate("LinBckndDialog", "background images:", None, QtGui.QApplication.UnicodeUTF8))
        self.imagefracLineEdit0.setText(QtGui.QApplication.translate("LinBckndDialog", "0.00001, 0.1, 0.4, 0.6, 0.75, 0.88, 0.96, 1.05, 1.2, 1.8", None, QtGui.QApplication.UnicodeUTF8))
        self.imagefracLineEdit1.setText(QtGui.QApplication.translate("LinBckndDialog", "0.00001, 0.1, 0.4, 0.6, 0.75, 0.88, 0.96, 1.05, 1.2, 1.8", None, QtGui.QApplication.UnicodeUTF8))
        self.label_4.setText(QtGui.QApplication.translate("LinBckndDialog", "precision for final background weights:", None, QtGui.QApplication.UnicodeUTF8))
        self.label_5.setText(QtGui.QApplication.translate("LinBckndDialog", "fraction of pixels to be zeroed:", None, QtGui.QApplication.UnicodeUTF8))
        self.propogateCheckBox.setText(QtGui.QApplication.translate("LinBckndDialog", "Propogate to all groups in .h5", None, QtGui.QApplication.UnicodeUTF8))


text:
package de.mklinger.commons.junitsupport;

import java.lang.reflect.InvocationTargetException;

import org.junit.Test;

/**
 * @author Marc Klinger - mklinger[at]mklinger[dot]de - klingerm
 */
public class TestBean3Test extends BeanTestBase<TestBean3> {
	public TestBean3Test() {
		super(TestBean3.class);
	}

	@Override
	protected ConstructorParameters[] getConstructorParameters() {
		return new ConstructorParameters[] {
				DEFAULT_CONSTRUCTOR_PARAMETERS,
				new ConstructorParameters(new Class[] { String.class, Integer.TYPE, Boolean.TYPE }, new String[] { "s", "n", "b" })
		};
	}

	@Override
	@Test(expected = AssertionError.class)
	public void copyConstructorEmptyEqualsTest() throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchFieldException {
		super.copyConstructorEmptyEqualsTest();
	}

	@Override
	@Test(expected = AssertionError.class)
	public void copyConstructorEqualsTest() throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchFieldException {
		super.copyConstructorEqualsTest();
	}

	@Override
	@Test(expected = AssertionError.class)
	public void copyConstructorValuesTest() throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchFieldException {
		super.copyConstructorValuesTest();
	}
}


text:
set -x -e

export LD_LIBRARY_PATH="${PREFIX}/lib"
make all PREFIX=${PREFIX}
make install PREFIX=${PREFIX}
make test