text:
const test = require('tape')
const normalizeWhere = require('../../../lib/normalize-query-options/where')

test('normalize-options, where: undefined', t => {
  t.plan(1)

  const normalized = normalizeWhere(undefined)
  t.equal(normalized, undefined)
})

test('normalize-options, where: no changes', t => {
  t.plan(1)

  const normalized = normalizeWhere('columns = \'test\'')
  t.equal(normalized, 'columns = \'test\'')
})

test('normalize-options, where: remove esri-style select-all when present', t => {
  t.plan(1)

  const normalized = normalizeWhere('1=1')
  t.equal(normalized, undefined)
})

test('normalize-options, where: convert esri/sql-style dates to ISO dates', t => {
  t.plan(1)
  const where = 'foo=\'bar\' AND ISSUE_DATE >= date 2017-01-05 AND ISSUE_DATE <= date 2018-01-05'

  const normalized = normalizeWhere(where)
  t.equal(normalized, 'foo=\'bar\' AND ISSUE_DATE >= \'2017-01-05T00:00:00.000Z\' AND ISSUE_DATE <= \'2018-01-05T00:00:00.000Z\'')
})


text:
package ai

import game.{Board, Player}

import scala.util.Random

class RandomPlayer(name: String) extends Player(name) {
    override def getMove(board: Board): Int = Random.nextInt(7)
}

redpajama_set_name: RedPajamaGithub


text:
/*
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
 */

#import <Foundation/Foundation.h>
#import "CMISSessionParameters.h"
#import "CMISAuthenticationProvider.h"

extern NSString * const kCMISBindingSessionKeyAtomPubUrl;
extern NSString * const kCMISBindingSessionKeyObjectByIdUriBuilder;
extern NSString * const kCMISBindingSessionKeyObjectByPathUriBuilder;
extern NSString * const kCMISBindingSessionKeyTypeByIdUriBuilder;
extern NSString * const kCMISBindingSessionKeyQueryUri;

extern NSString * const kCMISBindingSessionKeyQueryCollection;

extern NSString * const kCMISBindingSessionKeyLinkCache;

@interface CMISBindingSession : NSObject

@property (nonatomic, strong, readonly) NSString *username;
@property (nonatomic, strong, readonly) NSString *repositoryId;
@property (nonatomic, strong, readonly) id<CMISAuthenticationProvider> authenticationProvider;

- (id)initWithSessionParameters:(CMISSessionParameters *)sessionParameters;

// Object storage methods
- (NSArray *)allKeys;
- (id)objectForKey:(id)key;
- (id)objectForKey:(id)key withDefaultValue:(id)defaultValue;
- (void)setObject:(id)object forKey:(id)key;
- (void)addEntriesFromDictionary:(NSDictionary *)dictionary;
- (void)removeKey:(id)key;

@end


text:
package org.talend.daikon.avro.container;

/**
 * Callback for code that knows how to read a specific type from a container.
 */
public interface ContainerReaderByName<ReadContainerT, T> {

    T readValue(ReadContainerT obj, String name);
}


text:
import React, { Component } from 'react'
import { Icon } from 'stardust'

export default class IconCircularExample extends Component {
  render() {
    return (
      <div>
        <Icon circular name='users' />
        <Icon circular color='teal' name='users' />
        <Icon circular inverted name='users' />
        <Icon circular inverted color='teal' name='users' />
      </div>
    )
  }
}


text:
<?php

class Google_Service_YouTube_VideoAbuseReportReasonSnippet extends Google_Collection
{
  protected $collection_key = 'secondaryReasons';
  public $label;
  protected $secondaryReasonsType = 'Google_Service_YouTube_VideoAbuseReportSecondaryReason';
  protected $secondaryReasonsDataType = 'array';

  public function setLabel($label)
  {
    $this->label = $label;
  }
  public function getLabel()
  {
    return $this->label;
  }
  /**
   * @param Google_Service_YouTube_VideoAbuseReportSecondaryReason[]
   */
  public function setSecondaryReasons($secondaryReasons)
  {
    $this->secondaryReasons = $secondaryReasons;
  }
  /**
   * @return Google_Service_YouTube_VideoAbuseReportSecondaryReason[]
   */
  public function getSecondaryReasons()
  {
    return $this->secondaryReasons;
  }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using LanguageExt;
using static LanguageExt.Prelude;
using System.ComponentModel;
using System.Diagnostics.Contracts;
using LanguageExt.TypeClasses;

public static class HashMapEqExtensions
{
    /// <summary>
    /// Number of items in the map
    /// </summary>
    [Pure]
    public static int Count<EqK, K, V>(this HashMap<EqK, K, V> self) where EqK : struct, Eq<K> =>
        self.Count;

    [Pure]
    public static int Sum<EqK, K>(this HashMap<EqK, K, int> self) where EqK : struct, Eq<K> =>
        self.Values.Sum();

}


text: This folder stores basic codes for utilities.


text:
> <%= description %>

## Installation
TODO

## Usage
TODO

### npm scripts
Builds your workspace based on the site.zip file in your root imported from Webflow.

```bash
$ npm run build-workspace
```

Starts your server with nodemon watching all your changes in your source folder.

```bash
$ npm run dev
```

Builds your workspace and after that builds the project

```bash
$ npm run build
```

Builds your project

```bash
$ npm run build-project
```

Builds your workspace

```bash
$ npm run build-workspace
```

Starts your project process in forever

```bash
$ npm start
```

Stops your project process in forever

```bash
$ npm stop
```

Builds your project and workspace and restarts forever

```bash
$ npm restart
```

## Project Structure

Overview

    root
    ├── src
    │   ├── client
    │   │   ├── app                - All of our app specific components go in here
    │   │   ├── assets             - Custom assets: fonts, images, etc…
    │   │   │   ├── css            - Our css generated by webflow
    │   │   │   ├── images         - Our images generated by webflow
    │   │   │   └── js             - Our javascripts generated by webflow
    │
    ├── tasks                      - Our gulp/grunt tasks
    │
    └── server                     - Our server files

An example client component in `src/client/app`

    main
    ├── controllers                 - Controllers
    │   ├── main-controller.js      - Controller
    │   └── main-controller-spec.js - Test
    ├── decorators                  - Decorators
    │   └── main-decorator.js       - Decorator
    ├── directives                  - Directives
    │   └── main-directive.js       - Directive
    ├── factories                   - Factories
    │   ├── main-factory.js         - Factory
    │   └── main-factory-spec.js    - Test
    ├── filters                     - Filters
    │   ├── main-filter.js          - Filter
    │   └── main-filter-spec.js     - Test
    ├── providers                   - Providers
    │   ├── main-provider.js        - Provider
    │   └── main-provider-spec.js   - Test
    ├── routes                      - Routes
    │   └── main-route.js           - Route
    ├── services                    - Services
    │   ├── main-service.js         - Service
    │   └── main-service-spec.js    - Test
    └── index.js

## Dependencies

Package | Version | Dev
--- |:---:|:---:
[express](https://www.npmjs.com/package/express) | 4.13.3 | ✖
[ejs](https://www.npmjs.com/package/ejs) | 2.3.4 | ✖
[angular](https://www.npmjs.com/package/angular) | 1.4.8 | ✖
[angular-ui-router](https://www.npmjs.com/package/angular-ui-router) | 0.2.15 | ✖
[ng-annotations](https://www.npmjs.com/package/ng-annotations) | 0.1.12 | ✖
[babel](https://www.npmjs.com/package/babel-core) | 5.8.34 | ✔
[babel-eslint](https://www.npmjs.com/package/babel-eslint) | 3.1.1 | ✔
[babelify](https://www.npmjs.com/package/babelify) | 6.1.0 | ✔
[browserify](https://www.npmjs.com/package/browserify) | 9.0.8 | ✔
[eslint](https://www.npmjs.com/package/eslint) | 0.21.0 | ✔
[gulp](https://www.npmjs.com/package/gulp) | 3.9.0 | ✔
[gulp-babel](https://www.npmjs.com/package/gulp-babel) | 5.1.0 | ✔
[gulp-browserify](https://www.npmjs.com/package/gulp-browserify) | 0.5.1 | ✔
[gulp-clean](https://www.npmjs.com/package/gulp-clean) | 0.3.1 | ✔
[gulp-eslint](https://www.npmjs.com/package/gulp-eslint) | 0.13.2 | ✔
[gulp-imagemin](https://www.npmjs.com/package/gulp-imagemin) | 2.4.0 | ✔
[gulp-minify-css](https://www.npmjs.com/package/gulp-minify-css) | 1.2.3 | ✔
[gulp-minify-html](https://www.npmjs.com/package/gulp-minify-html) | 1.0.5 | ✔
[gulp-nodemon](https://www.npmjs.com/package/gulp-nodemon) | 2.0.6 | ✔
[gulp-tinypng](https://www.npmjs.com/package/gulp-tinypng) | 1.0.2 | ✔
[gulp-unzip](https://www.npmjs.com/package/gulp-unzip) | 0.1.3 | ✔

## License

<%= license %> © [<%= author.name %>](<%= author.url %>)

[npm-image]: https://badge.fury.io/js/<%= projectName %>.svg
[npm-url]: https://npmjs.org/package/<%= projectName %>
[travis-image]: https://travis-ci.org/<%= githubAccount %>/<%= projectName %>.svg?branch=master
[travis-url]: https://travis-ci.org/<%= githubAccount %>/<%= projectName %>
[daviddm-image]: https://david-dm.org/<%= githubAccount %>/<%= projectName %>.svg?theme=shields.io
[daviddm-url]: https://david-dm.org/<%= githubAccount %>/<%= projectName %>


text:
package org.cc.dexlib2.iface.value;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

/**
 * This class represents an encoded integer value.
 */
public interface IntEncodedValue extends EncodedValue {
    /**
     * Gets the integer value.
     *
     * @return the int value
     */
    int getValue();

    /**
     * Returns a hashcode for this EncodedIntValue.
     *
     * This hashCode is defined to be the following:
     *
     *

     * {@code
     * int hashCode = getValue();
     * }

     *
     * @return The hash code value for this EncodedIntValue
     */
    @Override int hashCode();

    /**
     * Compares this IntEncodedValue to another IntEncodedValue for equality.
     *
     * This IntEncodedValue is equal to another IntEncodedValue if the values returned by getValue() are equal.
     *
     * @param o The object to be compared for equality with this IntEncodedValue
     * @return true if the specified object is equal to this IntEncodedValue
     */
    @Override boolean equals(@Nullable Object o);

    /**
     * Compare this IntEncodedValue to another EncodedValue.
     *
     * The comparison is first done on the return values of getValueType(). If the other value is another
     * IntEncodedValue, the return values of getValue() are compared.
     *
     * @param o The EncodedValue to compare with this IntEncodedValue
     * @return An integer representing the result of the comparison
     */
    @Override int compareTo(@Nonnull EncodedValue o);
}


text:
from base_service import BaseService
from dao import ElasticSearchDAO

from helpers import *

class SearchService:
    def __init__(self):
        self.dao = ElasticSearchDAO()

    def autocomplete(self, query, category, field):
        if query == '':
            return {"results": None}

        if not field or field != 'name_key':
            return {"results": format_autocomplete_results(
                self.dao.search_by_body(build_aggregation_autocomplete_search_body_request(query, category, field)), field)}

        return {"results": format_autocomplete_results(
            self.dao.search_by_body(build_autocomplete_search_body_request(query, category, field)), field)}

    def search(self, query, limit, offset, category, sort_by, params):
        # This needs to become a generic search object but for now this works
        category_filters = {
            "gene": ['soTermName', 'gene_biological_process', 'gene_molecular_function', 'gene_cellular_component',
                     'species'],
            "go": ['go_type', 'go_species', 'go_genes'],
            "disease": ['disease_species', 'disease_genes', 'diseases']
        }

        search_fields = ['primaryId', 'name', 'symbol', 'symbol.raw', 'synonyms', 'synonyms.raw', 'description',
                         'external_ids', 'species', 'gene_biological_process', 'gene_molecular_function',
                         'gene_cellular_component', 'go_type', 'go_genes', 'go_synonyms', 'disease_genes',
                         'disease_synonyms', 'diseases']

        json_response_fields = ['name', 'symbol', 'synonyms', 'soTermName', 'gene_chromosomes', 'gene_chromosome_starts',
                                'gene_chromosome_ends', 'description', 'external_ids', 'species',
                                'gene_biological_process', 'gene_molecular_function', 'gene_cellular_component',
                                'go_type', 'go_genes', 'go_synonyms', 'disease_genes', 'disease_synonyms', 'homologs',
                                'crossReferences', 'category', 'href', 'diseases']

        es_query = build_search_query(query, search_fields, category, category_filters, params)

        search_body = build_es_search_body_request(query, category, es_query, json_response_fields, search_fields,
                                                   sort_by)

        search_results = self.dao.search_by_query(search_body, limit, offset, query)

        if search_results['hits']['total'] == 0:
            return {'total': 0, 'results': [], 'aggregations': []}

        aggregation_body = build_es_aggregation_body_request(es_query, category, category_filters)

        aggregation_results = self.dao.search_by_body(aggregation_body)

        return {
            'total': search_results['hits']['total'],
            'results': format_search_results(search_results, json_response_fields),
            'aggregations': format_aggregation_results(aggregation_results, category, category_filters)
        }


text:
/**
 *
 */
package org.geek.pipe.api.policy;

/**
 * @author haichuan
 * 2012-2-2
 */
public interface Policy<C> {

	void done() throws PolicyException;
	void setCondition(C condition);
}


text:
//
//  NSAOrderedDictionary.h
//  FoundationExtension
//
//  Created by Jeong YunWon on 12. 11. 4..
//  Copyright (c) 2012 youknowone.org. All rights reserved.
//

/*!
 *  @file
 *  @brief Dictionary with ordered keys, guaranting its order is keeped.
 *  @see [NSDictionary][0]
 *      [0]: https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSDictionary_Class/Reference/Reference.html
 */

/*!
 *  @brief Immutable ordered dictionary.
 */
@interface NSAOrderedDictionary : NSDictionary {
    NSDictionary *_impl;
    NSOrderedSet *_order;
}

- (id)keyAtIndex:(NSUInteger)index;
- (id)objectAtIndex:(NSUInteger)index;
- (NSUInteger)indexOfKey:(id)key;
- (NSEnumerator *)reversedKeyEnumerator;

@end

/*!
 *  @brief Mutable ordered dictionary.
 */
@interface NSAMutableOrderedDictionary : NSMutableDictionary {
    NSMutableDictionary *_impl;
    NSMutableOrderedSet *_order;
}

- (id)keyAtIndex:(NSUInteger)index;
- (id)objectAtIndex:(NSUInteger)index;
- (NSUInteger)indexOfKey:(id)key;
- (NSEnumerator *)reversedKeyEnumerator;

@end


text:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/white"
    android:descendantFocusability="beforeDescendants"
    android:focusableInTouchMode="true"
    tools:context="fr.conferencehermes.confhermexam.fragments.DownloadsFragment" >

    <RelativeLayout
        android:id="@+id/headerExersice"
        android:layout_width="match_parent"
        android:layout_height="80dp"
        android:layout_alignParentTop="true"
        android:background="@color/app_main_color_dark" >

        <ImageView
            android:layout_width="@dimen/header_logo_width"
            android:layout_height="match_parent"
            android:layout_alignParentLeft="true"
            android:layout_marginLeft="20dp"
            android:src="@drawable/logo_with_text" >
        </ImageView>

        <TextView
            android:id="@+id/score"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:textColor="#fff"
            android:textSize="20sp" />

        <TextView
            android:id="@+id/teacher"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_marginRight="20dp"
            android:layout_marginTop="20dp"
            android:text="Teacher"
            android:textColor="#fff" />

        <TextView
            android:id="@+id/examName"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_below="@+id/teacher"
            android:layout_marginRight="20dp"
            android:text="Exam"
            android:textColor="#fff" />
    </RelativeLayout>

    <ToggleButton
        android:id="@+id/timerToggle"
        android:layout_width="40dp"
        android:layout_height="40dp"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/headerExersice"
        android:layout_marginRight="20dp"
        android:layout_marginTop="10dp"
        android:background="@drawable/bgtoggle"
        android:textOff=""
        android:textOn=""
        android:visibility="invisible" />

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/headerExersice"
        android:orientation="horizontal" >

        <ScrollView
            android:id="@+id/scrollView4"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1" >

            <LinearLayout
                android:id="@+id/leftSideLayout"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="50dp"
                android:orientation="vertical"
                android:paddingBottom="40dp" >

                <TextView
                    android:id="@+id/questionTitle"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="20dp"
                    android:layout_marginTop="10dp"
                    android:text="QUESTION"
                    android:textColor="@color/app_main_color"
                    android:textSize="20sp" />

                <ScrollView
                    android:id="@+id/scrollviewQR"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="20dp"
                    android:layout_marginLeft="20dp"
                    android:layout_marginTop="10dp" >

                    <TextView
                        android:id="@+id/question"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:textSize="16sp" />
                </ScrollView>

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="right"
                    android:layout_marginRight="30dp"
                    android:gravity="center"
                    android:orientation="horizontal" >

                    <Button
                        android:id="@+id/btnImage"
                        android:layout_width="20dp"
                        android:layout_height="18dp"
                        android:background="@drawable/ic_camera"
                        android:clickable="true" >
                    </Button>

                    <Button
                        android:id="@+id/btnAudio"
                        android:layout_width="20dp"
                        android:layout_height="20dp"
                        android:layout_marginLeft="15dp"
                        android:background="@drawable/ic_sound"
                        android:clickable="true" >
                    </Button>

                    <Button
                        android:id="@+id/btnVideo"
                        android:layout_width="20dp"
                        android:layout_height="20dp"
                        android:layout_marginLeft="15dp"
                        android:background="@drawable/ic_video"
                        android:clickable="true" >
                    </Button>
                </LinearLayout>

                <TextView
                    android:id="@+id/reponse"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="20dp"
                    android:layout_marginTop="20dp"
                    android:text="@string/reponse"
                    android:textColor="@color/app_main_color"
                    android:textSize="20sp" />

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="40dp"
                    android:layout_marginTop="30dp"
                    android:orientation="horizontal"
                    android:weightSum="10" >

                    <ScrollView
                        android:id="@+id/scrollView1"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="10dp"
                        android:layout_weight="1" >

                        <LinearLayout
                            android:id="@+id/correctionsLayout"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:orientation="vertical" >
                        </LinearLayout>
                    </ScrollView>

                    <ScrollView
                        android:id="@+id/scrollView2"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_marginRight="10dp"
                        android:layout_weight="9" >

                        <LinearLayout
                            android:id="@+id/answersLayout"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:orientation="vertical" >
                        </LinearLayout>
                    </ScrollView>
                </LinearLayout>

                <Button
                    android:id="@+id/validerBtn"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="right"
                    android:layout_marginRight="25dp"
                    android:background="@color/app_main_color"
                    android:drawableLeft="@drawable/ic_check_white"
                    android:drawablePadding="10dp"
                    android:gravity="center"
                    android:padding="10dp"
                    android:text="VALIDER"
                    android:textColor="@android:color/white" />

                <TextView
                    android:id="@+id/correctionAnswer"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_margin="20dp"
                    android:padding="20dp"
                    android:textColor="@color/app_main_color_dark" />

                <LinearLayout
                    android:id="@+id/correctionButtons"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="right"
                    android:layout_marginRight="30dp"
                    android:gravity="center"
                    android:orientation="horizontal"
                    android:visibility="invisible" >

                    <Button
                        android:id="@+id/btnImageCorrection"
                        android:layout_width="20dp"
                        android:layout_height="18dp"
                        android:background="@drawable/ic_camera"
                        android:clickable="true" >
                    </Button>

                    <Button
                        android:id="@+id/btnAudioCorrection"
                        android:layout_width="20dp"
                        android:layout_height="20dp"
                        android:layout_marginLeft="15dp"
                        android:background="@drawable/ic_sound"
                        android:clickable="true" >
                    </Button>

                    <Button
                        android:id="@+id/btnVideoCorrection"
                        android:layout_width="20dp"
                        android:layout_height="20dp"
                        android:layout_marginLeft="15dp"
                        android:background="@drawable/ic_video"
                        android:clickable="true" >
                    </Button>
                </LinearLayout>
            </LinearLayout>
        </ScrollView>

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_margin="15dp"
            android:layout_weight="2"
            android:orientation="vertical" >

            <TextView
                android:id="@+id/temps1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginRight="10dp"
                android:layout_marginTop="10dp"
                android:text="Temps epreuve - "
                android:textColor="@color/app_main_color" />

            <TextView
                android:id="@+id/temps2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginRight="10dp"
                android:text="Temps exercice - "
                android:textColor="@color/app_main_color" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center_horizontal"
                android:orientation="vertical" >

                <Button
                    android:id="@+id/ennouncer"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_alignParentTop="true"
                    android:layout_marginTop="10dp"
                    android:layout_weight="0.5"
                    android:background="@color/app_main_color"
                    android:gravity="center"
                    android:padding="5dp"
                    android:text="ENONCÉ"
                    android:textColor="@android:color/white"
                    android:textSize="23sp" />

                <ListView
                    android:id="@+id/questionsListView"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/ennouncer"
                    android:layout_marginTop="10dp"
                    android:layout_weight="10"
                    android:choiceMode="singleChoice"
                    android:divider="@android:color/transparent"
                    android:dividerHeight="1dp"
                    android:minHeight="250dp" >
                </ListView>

                <Button
                    android:id="@+id/abandonner"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/questionsListView"
                    android:layout_marginTop="10dp"
                    android:layout_weight="0.5"
                    android:background="@color/app_main_color"
                    android:gravity="center"
                    android:padding="5dp"
                    android:text="ABANDONNER"
                    android:textColor="@android:color/white"
                    android:textSize="23sp" />
            </LinearLayout>
        </LinearLayout>
    </LinearLayout>

</RelativeLayout>


text:
def CheckChangeOnUpload(input_api, output_api):
  return input_api.canned_checks.CheckChangedLUCIConfigs(input_api, output_api)

def CheckChangeOnCommit(input_api, output_api):
  return input_api.canned_checks.CheckChangedLUCIConfigs(input_api, output_api)


text:
Recommendation Results

{{result.RecAreaName}}

{{result.RecAreaDescription}}

				<button class="btn detailsButton" data-toggle="modal" data-target="#myModal{{$index}}">Details</button>
				<button ng-click="savePark(result.RecAreaID)" class="btn saveButton pull-right">Add to My WanderList</button>

                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>

{{result.RecAreaName}}

                            {{result.RecAreaDescription}}

                            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>


text:
package li.kazu.java.dragtag.view.listeners;

import li.kazu.java.dragtag.lookup.LookupAlbum;
import li.kazu.java.dragtag.lookup.LookupTrack;

/**
 * result within the search-result has been selected
 *
 * @author kazu
 *
 */
public interface SearchSelectListener {

	/** album/track combination has been selected */
	public void onSelect(LookupAlbum album, LookupTrack track);

}


text:
module Ryodo
  class Parser
    def initialize
      @rules = Ryodo::RuleSet.new
    end

    def build_query(domain)
      domain.split('.').reverse
    end

    def parse(domain)
      @rules.match build_query(domain)
    end

    class << self
      def run(domain)
        instance.parse(domain)
      end

      def instance
        @instance ||= new
      end
    end
  end
end


text:
extern int jackClientCallback(jack_nframes_t nframes, void* arg);

int jackProcess(jack_nframes_t nframes, void *arg) {
  jackClientCallback(nframes, arg);
  return 0;
}

jack_client_t* wrap_jack_client_open(char* client_name) {
  jack_client_t* client = jack_client_open(client_name, JackNullOption, NULL);
  return client;
}

void register_callback(jack_client_t *client, void* arg) {
  jack_set_process_callback(client, jackProcess, arg);
}


text:
import pandas as pd
from sklearn.metrics import accuracy_score, log_loss
from sklearn.neighbors import KNeighborsClassifier
from sklearn.svm import SVC, LinearSVC, NuSVC
from sklearn.tree import DecisionTreeClassifier
from sklearn.ensemble import RandomForestClassifier, AdaBoostClassifier, GradientBoostingClassifier
from sklearn.naive_bayes import GaussianNB
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
from sklearn.discriminant_analysis import QuadraticDiscriminantAnalysis

classifiers = [
    KNeighborsClassifier(3),
    SVC(kernel="rbf", C=0.025, probability=True),
    NuSVC(probability=True),
    DecisionTreeClassifier(),
    RandomForestClassifier(),
    AdaBoostClassifier(),
    GradientBoostingClassifier(),
    GaussianNB(),
    LinearDiscriminantAnalysis(),
    QuadraticDiscriminantAnalysis()]

def classify_test(X_train,y_train,X_test,y_test):
    for clf in classifiers:
        try:
            clf.fit(X_train, y_train)
        except:
            print('{} is wrong'.format(clf.__class__.__name__))
        else:
            name = clf.__class__.__name__
            print("="*30)
            print(name)
            print('****Results****')
            train_predictions = clf.predict(X_test)
            acc = accuracy_score(y_test, train_predictions)
            print("Accuracy: {:.4%}".format(acc))
            train_predictions = clf.predict_proba(X_test)
            ll = log_loss(y_test, train_predictions)
            print("Log Loss: {}".format(ll))
    print("="*30)


text:
package me.aybabt.couverture;

/**
 * Inspect where you are!
 */
public class Meta {

  public static String methodName() {
    try {
      throw new Exception();
    } catch (Exception e) {
      return e.getStackTrace()[1].getMethodName();
    }
  }

  public static int lineNumber() {
    try {
      throw new Exception();
    } catch (Exception e) {
      return e.getStackTrace()[1].getLineNumber();
    }
  }

  public static String className() {
    try {
      throw new Exception();
    } catch (Exception e) {
      return e.getStackTrace()[1].getClassName();
    }
  }

  public static String fileName() {
    try {
      throw new Exception();
    } catch (Exception e) {
      return e.getStackTrace()[1].getFileName();
    }
  }

  public static String prettyPrint() {
    StackTraceElement elem;
    try {
      throw new Exception();
    } catch (Exception e) {
      elem = e.getStackTrace()[1];
    }

    return elem.getFileName() +
           ":" + elem.getClassName() +
           "." + elem.getMethodName() +
           "(" + elem.getLineNumber() + ")";
  }
}


text:
using namespace llvm;
using namespace llvm::codeview;

static inline MethodKind getMethodKind(uint16_t Attrs) {
  Attrs &= uint16_t(MethodOptions::MethodKindMask);
  Attrs >>= 2;
  return MethodKind(Attrs);
}

static inline bool isIntroVirtual(uint16_t Attrs) {
  MethodKind MK = getMethodKind(Attrs);
  return MK == MethodKind::IntroducingVirtual ||
         MK == MethodKind::PureIntroducingVirtual;
}

static inline PointerMode getPointerMode(uint32_t Attrs) {
  return static_cast<PointerMode>((Attrs >> PointerRecord::PointerModeShift) &
                                  PointerRecord::PointerModeMask);
}

static inline bool isMemberPointer(uint32_t Attrs) {
  PointerMode Mode = getPointerMode(Attrs);
  return Mode == PointerMode::PointerToDataMember ||
         Mode == PointerMode::PointerToMemberFunction;
}

static inline uint32_t getEncodedIntegerLength(ArrayRef<uint8_t> Data) {
  uint16_t N = support::endian::read16le(Data.data());
  if (N < LF_NUMERIC)
    return 2;

  assert(N <= LF_UQUADWORD);

  constexpr uint32_t Sizes[] = {
      1,  // LF_CHAR
      2,  // LF_SHORT
      2,  // LF_USHORT
      4,  // LF_LONG
      4,  // LF_ULONG
      4,  // LF_REAL32
      8,  // LF_REAL64
      10, // LF_REAL80
      16, // LF_REAL128
      8,  // LF_QUADWORD
      8,  // LF_UQUADWORD
  };

  return 2 + Sizes[N - LF_NUMERIC];
}

static inline uint32_t getCStringLength(ArrayRef<uint8_t> Data) {
  const char *S = reinterpret_cast<const char *>(Data.data());
  return strlen(S) + 1;
}

static void handleMethodOverloadList(ArrayRef<uint8_t> Content,
                                     SmallVectorImpl<TiReference> &Refs) {
  uint32_t Offset = 0;

  while (!Content.empty()) {
    // Array of:
    //   0: Attrs
    //   2: Padding
    //   4: TypeIndex
    //   if (isIntroVirtual())
    //     8: VFTableOffset

    // At least 8 bytes are guaranteed.  4 extra bytes come iff function is an
    // intro virtual.
    uint32_t Len = 8;

    uint16_t Attrs = support::endian::read16le(Content.data());
    Refs.push_back({TiRefKind::TypeRef, Offset + 4, 1});

    if (LLVM_UNLIKELY(isIntroVirtual(Attrs)))
      Len += 4;
    Offset += Len;
    Content = Content.drop_front(Len);
  }
}

static uint32_t handleBaseClass(ArrayRef<uint8_t> Data, uint32_t Offset,
                                SmallVectorImpl<TiReference> &Refs) {
  // 0: Kind
  // 2: Padding
  // 4: TypeIndex
  // 8: Encoded Integer
  Refs.push_back({TiRefKind::TypeRef, Offset + 4, 1});
  return 8 + getEncodedIntegerLength(Data.drop_front(8));
}

static uint32_t handleEnumerator(ArrayRef<uint8_t> Data, uint32_t Offset,
                                 SmallVectorImpl<TiReference> &Refs) {
  // 0: Kind
  // 2: Padding
  // 4: Encoded Integer
  // <next>: Name
  uint32_t Size = 4 + getEncodedIntegerLength(Data.drop_front(4));
  return Size + getCStringLength(Data.drop_front(Size));
}

static uint32_t handleDataMember(ArrayRef<uint8_t> Data, uint32_t Offset,
                                 SmallVectorImpl<TiReference> &Refs) {
  // 0: Kind
  // 2: Padding
  // 4: TypeIndex
  // 8: Encoded Integer
  // <next>: Name
  Refs.push_back({TiRefKind::TypeRef, Offset + 4, 1});
  uint32_t Size = 8 + getEncodedIntegerLength(Data.drop_front(8));
  return Size + getCStringLength(Data.drop_front(Size));
}

static uint32_t handleOverloadedMethod(ArrayRef<uint8_t> Data, uint32_t Offset,
                                       SmallVectorImpl<TiReference> &Refs) {
  // 0: Kind
  // 2: Padding
  // 4: TypeIndex
  // 8: Name
  Refs.push_back({TiRefKind::TypeRef, Offset + 4, 1});
  return 8 + getCStringLength(Data.drop_front(8));
}

static uint32_t handleOneMethod(ArrayRef<uint8_t> Data, uint32_t Offset,
                                SmallVectorImpl<TiReference> &Refs) {
  // 0: Kind
  // 2: Attributes
  // 4: Type
  // if (isIntroVirtual)
  //   8: VFTableOffset
  // <next>: Name
  uint32_t Size = 8;
  Refs.push_back({TiRefKind::TypeRef, Offset + 4, 1});

  uint16_t Attrs = support::endian::read16le(Data.drop_front(2).data());
  if (LLVM_UNLIKELY(isIntroVirtual(Attrs)))
    Size += 4;

  return Size + getCStringLength(Data.drop_front(Size));
}

static uint32_t handleNestedType(ArrayRef<uint8_t> Data, uint32_t Offset,
                                 SmallVectorImpl<TiReference> &Refs) {
  // 0: Kind
  // 2: Padding
  // 4: TypeIndex
  // 8: Name
  Refs.push_back({TiRefKind::TypeRef, Offset + 4, 1});
  return 8 + getCStringLength(Data.drop_front(8));
}

static uint32_t handleStaticDataMember(ArrayRef<uint8_t> Data, uint32_t Offset,
                                       SmallVectorImpl<TiReference> &Refs) {
  // 0: Kind
  // 2: Padding
  // 4: TypeIndex
  // 8: Name
  Refs.push_back({TiRefKind::TypeRef, Offset + 4, 1});
  return 8 + getCStringLength(Data.drop_front(8));
}

static uint32_t handleVirtualBaseClass(ArrayRef<uint8_t> Data, uint32_t Offset,
                                       bool IsIndirect,
                                       SmallVectorImpl<TiReference> &Refs) {
  // 0: Kind
  // 2: Attrs
  // 4: TypeIndex
  // 8: TypeIndex
  // 12: Encoded Integer
  // <next>: Encoded Integer
  uint32_t Size = 12;
  Refs.push_back({TiRefKind::TypeRef, Offset + 4, 2});
  Size += getEncodedIntegerLength(Data.drop_front(Size));
  Size += getEncodedIntegerLength(Data.drop_front(Size));
  return Size;
}

static uint32_t handleVFPtr(ArrayRef<uint8_t> Data, uint32_t Offset,
                            SmallVectorImpl<TiReference> &Refs) {
  // 0: Kind
  // 2: Padding
  // 4: TypeIndex
  Refs.push_back({TiRefKind::TypeRef, Offset + 4, 1});
  return 8;
}

static uint32_t handleListContinuation(ArrayRef<uint8_t> Data, uint32_t Offset,
                                       SmallVectorImpl<TiReference> &Refs) {
  // 0: Kind
  // 2: Padding
  // 4: TypeIndex
  Refs.push_back({TiRefKind::TypeRef, Offset + 4, 1});
  return 8;
}

static void handleFieldList(ArrayRef<uint8_t> Content,
                            SmallVectorImpl<TiReference> &Refs) {
  uint32_t Offset = 0;
  uint32_t ThisLen = 0;
  while (!Content.empty()) {
    TypeLeafKind Kind =
        static_cast<TypeLeafKind>(support::endian::read16le(Content.data()));
    switch (Kind) {
    case LF_BCLASS:
      ThisLen = handleBaseClass(Content, Offset, Refs);
      break;
    case LF_ENUMERATE:
      ThisLen = handleEnumerator(Content, Offset, Refs);
      break;
    case LF_MEMBER:
      ThisLen = handleDataMember(Content, Offset, Refs);
      break;
    case LF_METHOD:
      ThisLen = handleOverloadedMethod(Content, Offset, Refs);
      break;
    case LF_ONEMETHOD:
      ThisLen = handleOneMethod(Content, Offset, Refs);
      break;
    case LF_NESTTYPE:
      ThisLen = handleNestedType(Content, Offset, Refs);
      break;
    case LF_STMEMBER:
      ThisLen = handleStaticDataMember(Content, Offset, Refs);
      break;
    case LF_VBCLASS:
    case LF_IVBCLASS:
      ThisLen =
          handleVirtualBaseClass(Content, Offset, Kind == LF_VBCLASS, Refs);
      break;
    case LF_VFUNCTAB:
      ThisLen = handleVFPtr(Content, Offset, Refs);
      break;
    case LF_INDEX:
      ThisLen = handleListContinuation(Content, Offset, Refs);
      break;
    default:
      return;
    }
    Content = Content.drop_front(ThisLen);
    Offset += ThisLen;
    if (!Content.empty()) {
      uint8_t Pad = Content.front();
      if (Pad >= LF_PAD0) {
        uint32_t Skip = Pad & 0x0F;
        Content = Content.drop_front(Skip);
        Offset += Skip;
      }
    }
  }
}

static void handlePointer(ArrayRef<uint8_t> Content,
                          SmallVectorImpl<TiReference> &Refs) {
  Refs.push_back({TiRefKind::TypeRef, 0, 1});

  uint32_t Attrs = support::endian::read32le(Content.drop_front(4).data());
  if (isMemberPointer(Attrs))
    Refs.push_back({TiRefKind::TypeRef, 8, 1});
}

static void discoverTypeIndices(ArrayRef<uint8_t> Content, TypeLeafKind Kind,
                                SmallVectorImpl<TiReference> &Refs) {
  uint32_t Count;
  // FIXME: In the future it would be nice if we could avoid hardcoding these
  // values.  One idea is to define some structures representing these types
  // that would allow the use of offsetof().
  switch (Kind) {
  case TypeLeafKind::LF_FUNC_ID:
    Refs.push_back({TiRefKind::IndexRef, 0, 1});
    Refs.push_back({TiRefKind::TypeRef, 4, 1});
    break;
  case TypeLeafKind::LF_MFUNC_ID:
    Refs.push_back({TiRefKind::TypeRef, 0, 2});
    break;
  case TypeLeafKind::LF_STRING_ID:
    Refs.push_back({TiRefKind::IndexRef, 0, 1});
    break;
  case TypeLeafKind::LF_SUBSTR_LIST:
    Count = support::endian::read32le(Content.data());
    if (Count > 0)
      Refs.push_back({TiRefKind::IndexRef, 4, Count});
    break;
  case TypeLeafKind::LF_BUILDINFO:
    Count = support::endian::read16le(Content.data());
    if (Count > 0)
      Refs.push_back({TiRefKind::IndexRef, 2, Count});
    break;
  case TypeLeafKind::LF_UDT_SRC_LINE:
    Refs.push_back({TiRefKind::TypeRef, 0, 1});
    Refs.push_back({TiRefKind::IndexRef, 4, 1});
    break;
  case TypeLeafKind::LF_UDT_MOD_SRC_LINE:
    Refs.push_back({TiRefKind::TypeRef, 0, 1});
    break;
  case TypeLeafKind::LF_MODIFIER:
    Refs.push_back({TiRefKind::TypeRef, 0, 1});
    break;
  case TypeLeafKind::LF_PROCEDURE:
    Refs.push_back({TiRefKind::TypeRef, 0, 1});
    Refs.push_back({TiRefKind::TypeRef, 8, 1});
    break;
  case TypeLeafKind::LF_MFUNCTION:
    Refs.push_back({TiRefKind::TypeRef, 0, 3});
    Refs.push_back({TiRefKind::TypeRef, 16, 1});
    break;
  case TypeLeafKind::LF_ARGLIST:
    Count = support::endian::read32le(Content.data());
    if (Count > 0)
      Refs.push_back({TiRefKind::TypeRef, 4, Count});
    break;
  case TypeLeafKind::LF_ARRAY:
    Refs.push_back({TiRefKind::TypeRef, 0, 2});
    break;
  case TypeLeafKind::LF_CLASS:
  case TypeLeafKind::LF_STRUCTURE:
  case TypeLeafKind::LF_INTERFACE:
    Refs.push_back({TiRefKind::TypeRef, 4, 3});
    break;
  case TypeLeafKind::LF_UNION:
    Refs.push_back({TiRefKind::TypeRef, 4, 1});
    break;
  case TypeLeafKind::LF_ENUM:
    Refs.push_back({TiRefKind::TypeRef, 4, 2});
    break;
  case TypeLeafKind::LF_BITFIELD:
    Refs.push_back({TiRefKind::TypeRef, 0, 1});
    break;
  case TypeLeafKind::LF_VFTABLE:
    Refs.push_back({TiRefKind::TypeRef, 0, 2});
    break;
  case TypeLeafKind::LF_VTSHAPE:
    break;
  case TypeLeafKind::LF_METHODLIST:
    handleMethodOverloadList(Content, Refs);
    break;
  case TypeLeafKind::LF_FIELDLIST:
    handleFieldList(Content, Refs);
    break;
  case TypeLeafKind::LF_POINTER:
    handlePointer(Content, Refs);
    break;
  default:
    break;
  }
}

static bool discoverTypeIndices(ArrayRef<uint8_t> Content, SymbolKind Kind,
                                SmallVectorImpl<TiReference> &Refs) {
  uint32_t Count;
  // FIXME: In the future it would be nice if we could avoid hardcoding these
  // values.  One idea is to define some structures representing these types
  // that would allow the use of offsetof().
  switch (Kind) {
  case SymbolKind::S_GPROC32:
  case SymbolKind::S_LPROC32:
  case SymbolKind::S_GPROC32_ID:
  case SymbolKind::S_LPROC32_ID:
  case SymbolKind::S_LPROC32_DPC:
  case SymbolKind::S_LPROC32_DPC_ID:
    Refs.push_back({TiRefKind::IndexRef, 24, 1}); // LF_FUNC_ID
    break;
  case SymbolKind::S_UDT:
    Refs.push_back({TiRefKind::TypeRef, 0, 1}); // UDT
    break;
  case SymbolKind::S_GDATA32:
  case SymbolKind::S_LDATA32:
    Refs.push_back({TiRefKind::TypeRef, 0, 1}); // Type
    break;
  case SymbolKind::S_BUILDINFO:
    Refs.push_back({TiRefKind::IndexRef, 0, 1}); // Compile flags
    break;
  case SymbolKind::S_LTHREAD32:
  case SymbolKind::S_GTHREAD32:
    Refs.push_back({TiRefKind::TypeRef, 0, 1}); // Type
    break;
  case SymbolKind::S_FILESTATIC:
    Refs.push_back({TiRefKind::TypeRef, 0, 1}); // Type
    break;
  case SymbolKind::S_LOCAL:
    Refs.push_back({TiRefKind::TypeRef, 0, 1}); // Type
    break;
  case SymbolKind::S_REGISTER:
    Refs.push_back({TiRefKind::TypeRef, 0, 1}); // Type
    break;
  case SymbolKind::S_CONSTANT:
    Refs.push_back({TiRefKind::TypeRef, 0, 1}); // Type
    break;
  case SymbolKind::S_BPREL32:
  case SymbolKind::S_REGREL32:
    Refs.push_back({TiRefKind::TypeRef, 4, 1}); // Type
    break;
  case SymbolKind::S_CALLSITEINFO:
    Refs.push_back({TiRefKind::TypeRef, 8, 1}); // Call signature
    break;
  case SymbolKind::S_CALLERS:
  case SymbolKind::S_CALLEES:
  case SymbolKind::S_INLINEES:
    // The record is a count followed by an array of type indices.
    Count = *reinterpret_cast<const ulittle32_t *>(Content.data());
    Refs.push_back({TiRefKind::IndexRef, 4, Count}); // Callees
    break;
  case SymbolKind::S_INLINESITE:
    Refs.push_back({TiRefKind::IndexRef, 8, 1}); // ID of inlinee
    break;
  case SymbolKind::S_HEAPALLOCSITE:
    Refs.push_back({TiRefKind::TypeRef, 8, 1}); // UDT allocated
    break;

  // Defranges don't have types, just registers and code offsets.
  case SymbolKind::S_DEFRANGE_REGISTER:
  case SymbolKind::S_DEFRANGE_REGISTER_REL:
  case SymbolKind::S_DEFRANGE_FRAMEPOINTER_REL:
  case SymbolKind::S_DEFRANGE_FRAMEPOINTER_REL_FULL_SCOPE:
  case SymbolKind::S_DEFRANGE_SUBFIELD_REGISTER:
  case SymbolKind::S_DEFRANGE_SUBFIELD:
    break;

  // No type references.
  case SymbolKind::S_LABEL32:
  case SymbolKind::S_OBJNAME:
  case SymbolKind::S_COMPILE:
  case SymbolKind::S_COMPILE2:
  case SymbolKind::S_COMPILE3:
  case SymbolKind::S_ENVBLOCK:
  case SymbolKind::S_BLOCK32:
  case SymbolKind::S_FRAMEPROC:
  case SymbolKind::S_THUNK32:
  case SymbolKind::S_FRAMECOOKIE:
  case SymbolKind::S_UNAMESPACE:
    break;
  // Scope ending symbols.
  case SymbolKind::S_END:
  case SymbolKind::S_INLINESITE_END:
  case SymbolKind::S_PROC_ID_END:
    break;
  default:
    return false; // Unknown symbol.
  }
  return true;
}

void llvm::codeview::discoverTypeIndices(const CVType &Type,
                                         SmallVectorImpl<TiReference> &Refs) {
  ::discoverTypeIndices(Type.content(), Type.kind(), Refs);
}

static void resolveTypeIndexReferences(ArrayRef<uint8_t> RecordData,
                                       ArrayRef<TiReference> Refs,
                                       SmallVectorImpl<TypeIndex> &Indices) {
  Indices.clear();

  if (Refs.empty())
    return;

  RecordData = RecordData.drop_front(sizeof(RecordPrefix));

  BinaryStreamReader Reader(RecordData, support::little);
  for (const auto &Ref : Refs) {
    Reader.setOffset(Ref.Offset);
    FixedStreamArray<TypeIndex> Run;
    cantFail(Reader.readArray(Run, Ref.Count));
    Indices.append(Run.begin(), Run.end());
  }
}

void llvm::codeview::discoverTypeIndices(const CVType &Type,
                                         SmallVectorImpl<TypeIndex> &Indices) {
  return discoverTypeIndices(Type.RecordData, Indices);
}

void llvm::codeview::discoverTypeIndices(ArrayRef<uint8_t> RecordData,
                                         SmallVectorImpl<TypeIndex> &Indices) {
  SmallVector<TiReference, 4> Refs;
  discoverTypeIndices(RecordData, Refs);
  resolveTypeIndexReferences(RecordData, Refs, Indices);
}

void llvm::codeview::discoverTypeIndices(ArrayRef<uint8_t> RecordData,
                                         SmallVectorImpl<TiReference> &Refs) {
  const RecordPrefix *P =
      reinterpret_cast<const RecordPrefix *>(RecordData.data());
  TypeLeafKind K = static_cast<TypeLeafKind>(uint16_t(P->RecordKind));
  ::discoverTypeIndices(RecordData.drop_front(sizeof(RecordPrefix)), K, Refs);
}

bool llvm::codeview::discoverTypeIndicesInSymbol(
    const CVSymbol &Sym, SmallVectorImpl<TiReference> &Refs) {
  SymbolKind K = Sym.kind();
  return ::discoverTypeIndices(Sym.content(), K, Refs);
}

bool llvm::codeview::discoverTypeIndicesInSymbol(
    ArrayRef<uint8_t> RecordData, SmallVectorImpl<TiReference> &Refs) {
  const RecordPrefix *P =
      reinterpret_cast<const RecordPrefix *>(RecordData.data());
  SymbolKind K = static_cast<SymbolKind>(uint16_t(P->RecordKind));
  return ::discoverTypeIndices(RecordData.drop_front(sizeof(RecordPrefix)), K,
                               Refs);
}

bool llvm::codeview::discoverTypeIndicesInSymbol(
    ArrayRef<uint8_t> RecordData, SmallVectorImpl<TypeIndex> &Indices) {
  SmallVector<TiReference, 2> Refs;
  if (!discoverTypeIndicesInSymbol(RecordData, Refs))
    return false;
  resolveTypeIndexReferences(RecordData, Refs, Indices);
  return true;
}


text:
layout: post
title: "Geoffrey Hinton's Dark Knowledge of Machine Learning"
description: "Recently Geoffrey Hinton had made a presentation about \"Dark Knowledge\" in TTIC to shared his insights about ensemble methods in machine learning and deep neural network. This blog is kind of a summary of his presentation afer I watched the video and the slide"
category:
tags: []
---

Recently Geoffrey Hinton had made a presentation about "Dark Knowledge" in TTIC to shared his insights about ensemble methods in machine learning and deep neural network. This blog is kind of a summary of his presentation after I watched the [video](https://www.youtube.com/watch?v=EK61htlw8hY) and the [slide](http://www.ttic.edu/dl/dark14.pdf).

### Model Ensemble

> The easiest way to extract a lot of knowledge from the training data is to learn many different models in parallel.
> At test time we average the predictions of all the models or of a selected subset of good models that make different errors.

Different models may be focusing on different parts of the model, and averaging them gives us more comprehensive knowledge (In this case, overfitting each individual model can be helpful) -- "That's how almost all ML competitions are won". However, for a big ensemble, it might take a lot of memory and a long time to produce the prediction, which is not desirably in a production environment. Besides, a big ensemble is highly redundant and has very little knowledge per parameter.

**So, here's the problem: can we transfer the knowledge of a big ensemble into a single smaller model?**

### Soft targets: A way to transfer the function

While training a classification model, we usually use "hard targets": a category vector with one entry be 1 and the rest be 0, like [0, 0, 1, 0]; "Soft targets" are somewhat probabilistic distributions of different categories, like [0.15, 0.2, 0.6, 0.05]. Now, if we have a big ensemble, we can divide the averaged logits from the ensemble by a "temperature" to get a very soft distribution: .

Then, instead of using "hard targets", we might choose to minimize the cross enthropy between softmax prediction and the given "soft target" distributions(which are generated by the big ensemble we have --- we're trying to transfer the knowledge of the big ensemble into our new model). Geoffey claims "this is the dark knowledge" because such "soft targets" can reveal knowledges about different categories, and yield more constraints on the model function. In practise, it works better to fit **both the hard targets and the soft targets from the ensemble**. The cross entropy with "hard targets" needs to be down-weighted -- but even it's down-weighted, this term is very important to get the best result.

### Training an ensemble of models

How to efficiently train an ensemble? We can choose to parallelize, but it's still expensive.

In the case of neural nets, we can use Dropout --- each hidden unit has a probability(usually 0.5) to be omitted. Consider a neural net with a single hidden layer contains H hidden units, we're actually sampling from 2^H different architectures, all of which share weights. In this way each model is strongly regularized.

Then, in test time, we can either: sample many different architectures and take the geometric mean of their outputs, or: use all hidden units, but multiply their outputs with their associated probabilities. The latter one computes the expectation exactly, and is much faster. For multi-layer neural nets, we use dropout for each hidden layer, and use all hidden units in test time(it's not exactly the expection in multi-layer case, but it's a pretty approximation).

### How good is the effect of knowledge transfer? Experiments

**MNIST experiment:**

1. Train a 784 -> 800 -> 800 -> 10 neural net with vanilla backprop: **146 test errors**
2. Train a 784 -> 1200 -> 1200 -> 10 net using **dropout and weight constraints and jittering the input**: **67 errors**
3. Using both the soft targets obtained from the big net and the hard targets, still uses vanilla backprop to train a 784 -> 800 -> 800 -> 10 neural net: **74 test errors!**

More experimental results can be found on the original slide.

This shows the soft targets do contain a lot of useful knowledge. It gives us an idea that in object recognitions, besides transforming input images(e.g. feature learning), transforming targets can also have big effects on improving the generalization of models. There're also other ways to transform the targets, e.g. organize the labels into a tree.

### Training a community of neural nets

> If we train ten 784 -> 500 -> 300 -> 10 nets independently on MNIST, they average about 158 test errors, but the geometric ensemble gets 143 errors
> If we let each net try to match soft targets derived by averaging the opinions of the whole community as it is training: The nets now average 126 errors, The ensemble gets 120 errors!

### Mine knowledge more efficiently

> We can encourage different members of the ensemble to focus on resolving different confusions

The idea is to train "specialists" focusing on certain domains of the problem. For example, by feeding examples enriched in mushrooms during training, we can get a model specialize on distinguishing "mushroom" and "non-mushroom". To achieve, we may use k-means to cluster soft target vectors we have.

The problem for such specialists is they easily overfit. One way to prevent this is during training, each specialist uses **a reduced softmax that has one dustbin class for all the classes it does not specialize in**. In addition, "The specialist is initialized with the weights of a previously trained generalist model and uses early stopping to prevent over-fitting". What's more, for 50% data we fit the hard targets only, for 50% others we fit the soft targets only, and the soft targets can prevent overfitting.

Another problem is how to use such reduced softmax result during test time. One way to do it is to for each test or transfer case we run a fast iterative loop to find the set of logits that fit best with the partial distributions produced by the
trained specialists.

### Summary
Basically the most two important concepts in this presentation are:

1. Use soft targets together with hard targets
2. Train specialist to obtain more knowledge from data

Here're the links to the [video](https://www.youtube.com/watch?v=EK61htlw8hY) and the [slide](http://www.ttic.edu/dl/dark14.pdf).


text:
export ForwardBatcher, next!, current, release!

type ForwardBatcher{C, A} <: Batcher
    ctx::C
    inputs::A
    targets::A
    size::Int
    index::Int
    inputSeg::A
    targetSeg::A
end

function ForwardBatcher(ctx, inputs, targets, size)
    @assert dims(inputs, 0) == dims(targets, 0)
    @assert size < dims(inputs, 0)
    @assert dims(inputs, 0) % size == 0
    A = typeof(inputs)
    ForwardBatcher(ctx, inputs, targets, size, 0, array(ctx), array(ctx))
end

function release!(br::ForwardBatcher)
    release(br.inputSeg)
    release(br.targetSeg)
end

function next!(br::ForwardBatcher)
    scope!(br.ctx) do this
        startPos = br.index * br.size
        endPos = startPos + br.size - 1

        br.inputSeg[] = br.inputs[seq(br.ctx, startPos, endPos), :]
        br.targetSeg[] = br.targets[seq(br.ctx, startPos, endPos), :]

        if endPos == dims(br.inputs, 0) - 1
            br.index = 0
        else
            br.index += 1
        end
    end
end

current(br::ForwardBatcher) = (isEmpty(br.inputSeg) && error("Bacher is not initialized."); (br.inputSeg, br.targetSeg))


text:
/*
The Bellman-Ford algorithm solves the single-source shortest-paths problem in
the general case in which edge weights may be negative. Give a weighted,
directed graph G = (V, E) with source s and weight function w: E -> R, the
Bellman-Ford algorithm returns a boolean value indicating whether or not there
is a negative-weight cycle that is reachable from the source. If there is such a
cycle, the algorithm indicates that no solution exists. If there is no such
cycle, the algorithm produces the shortest paths and their weights.

The algorithm relaxes edges, progressively decreasing an estimate v.d on the
weight of a shortest path from the source s to each vertex v in V until it
archieves the actual shortest-path weight. The algorithm return TRUE if and only
if the graph contains no negative-weight cycles that are reachable from the
source.
*/

package main

import (
	"fmt"
	"math"
)

type Vertex struct {
	id       int
	estimate int
	parent   *Vertex
}

type Edge struct {
	v_id   int
	weight int
}

type Graph struct {
	adjacency   map[int][]Edge
	vertex_list map[int]*Vertex
}

func (graph *Graph) add_vertex(id int) {
	if graph.vertex_list == nil {
		graph.vertex_list = make(map[int]*Vertex)
	}
	graph.vertex_list[id] = &Vertex{
		id:       id,
		parent:   nil,
		estimate: math.MaxInt32,
	}
}

func (graph *Graph) add_edge(from_id int, to_id int, weight int) {
	if graph.adjacency == nil {
		graph.adjacency = make(map[int][]Edge)
	}
	graph.adjacency[from_id] = append(graph.adjacency[from_id], Edge{
		v_id:   to_id,
		weight: weight,
	})
}

func bellman_ford(source_id int, graph *Graph) bool {
	graph.vertex_list[source_id].estimate = 0

	for i := 0; i < len(graph.vertex_list)-1; i++ {
		for u_id, adj := range graph.adjacency {
			u := graph.vertex_list[u_id]
			for _, edge := range adj {
				v := graph.vertex_list[edge.v_id]
				// Relax
				if u.estimate+edge.weight < v.estimate {
					v.estimate = u.estimate + edge.weight
				}
			}
		}
	}

	// Detect negative weight cycles
	for u_id, adj := range graph.adjacency {
		u := graph.vertex_list[u_id]
		for _, edge := range adj {
			v := graph.vertex_list[edge.v_id]
			if v.estimate > u.estimate+edge.weight {
				// Has negative cycles
				return false
			}
		}
	}

	// Print result
	for _, vertex := range graph.vertex_list {
		fmt.Printf("Vectex(%d) Estimate(%d)\n", vertex.id, vertex.estimate)
	}
	return true
}

func main() {
	graph := &Graph{}

	graph.add_edge(1, 2, 1)
	graph.add_edge(1, 3, 2)
	graph.add_edge(1, 4, 3)
	// graph.add_edge(4, 1, -4)

	graph.add_vertex(1)
	graph.add_vertex(2)
	graph.add_vertex(3)
	graph.add_vertex(4)

	fmt.Printf("Has Negative Cycles: %v\n", !bellman_ford(1, graph))
}


text:
function mTypeNext = jsp_get_next_mach_type(stJspCfg, astQuingTask, astRelTimeMachType, astQuingTaskMachType, stJobSet)

    mTypeNext = 0;
    tSumProcessingTimeArrivalTime = 0;
    tSumProcessingTime = 0;
%    tSumMachineReleaseTime = zeros()
    for kk = 1:1:stJspCfg.iTotalMachine
        if astQuingTaskMachType(kk).iTotalTask >= 1
            tMeanMachineRelTime = mean(astRelTimeMachType(kk).tRelTimeAtOneMach);
            tSumProcessingTimeArrivalTime = 0;
            tSumProcessingTime = 0;
            for ii = 1:1:astQuingTaskMachType(kk).iTotalTask
                jJobId = astQuingTaskMachType(kk).iJobSet(ii);
                iProcId = astQuingTask(jJobId).iProcessToStart;
                if iProcId >= 2
                    tTaskArriveTime = stJobSet(jJobId).iProcessEndTime(iProcId - 1);
                else
                    tTaskArriveTime = 0;
                end
                tSumProcessingTimeArrivalTime = tSumProcessingTimeArrivalTime + astQuingTask(jJobId).ProcessTime + tTaskArriveTime;
                tSumProcessingTime = tSumProcessingTime + astQuingTask(jJobId).ProcessTime;
                if tTaskArriveTime > tMeanMachineRelTime
                    tMeanMachRelTimeAfterSche = tTaskArriveTime + astQuingTask(jJobId).ProcessTime;
                else
                    tMeanMachRelTimeAfterSche = tMeanMachineRelTime + astQuingTask(jJobId).ProcessTime;
                end
                if ii == 1
                    tExpectMachRelTime = tMeanMachRelTimeAfterSche;
                else
                    if tExpectMachRelTime > tMeanMachRelTimeAfterSche
                        tExpectMachRelTime = tMeanMachRelTimeAfterSche;
                    end
                end
            end

            tSumMachineReleaseTime = sum(astRelTimeMachType(kk).tRelTimeAtOneMach);
            if mTypeNext == 0
                mTypeNext = kk;
                tMinSumProcessingTimeArrivalTime = tSumProcessingTimeArrivalTime;
                tMaxSumProcessingTimeArrivalTime = tSumProcessingTimeArrivalTime;
                tMinSumMachineRelaeseTime = tSumMachineReleaseTime;
                tMaxSumMachineRelaeseTime = tSumMachineReleaseTime;
                tMinSumProcessingTime = tSumProcessingTime;
                tMinExpectMachRelTime = tExpectMachRelTime;
                tMaxExpectMachRelTime = tExpectMachRelTime;
            else
                if tMinExpectMachRelTime > tExpectMachRelTime % & kk ~= mm
                    mTypeNext = kk;
                    tMinExpectMachRelTime = tExpectMachRelTime;
                end
%                 if tMaxExpectMachRelTime < tExpectMachRelTime % & kk ~= mm
%                     mTypeNext = kk;
%                     tMaxExpectMachRelTime = tExpectMachRelTime;
%                 end
%                 if tMinSumProcessingTime > tSumProcessingTime % & kk ~= mm
%                     mTypeNext = kk;
%                     tMinSumProcessingTime = tSumProcessingTime;
%                 end
%                 if tMinSumProcessingTimeArrivalTime > tSumProcessingTimeArrivalTime % & kk ~= mm
%                     mTypeNext = kk;
%                     tMinSumProcessingTimeArrivalTime = tSumProcessingTimeArrivalTime;
%                 end
%                 if tMaxSumProcessingTimeArrivalTime < tSumProcessingTimeArrivalTime % & kk ~= mm
%                     mTypeNext = kk;
%                     tMaxSumProcessingTimeArrivalTime = tSumProcessingTimeArrivalTime;
%                 end
%                 if tMinSumMachineRelaeseTime > tSumMachineReleaseTime % & kk ~= mm
%                     mTypeNext = kk;
%                     tMinSumMachineRelaeseTime = tSumMachineReleaseTime;
%                 end
%                 if tMaxSumMachineRelaeseTime < tSumMachineReleaseTime % & kk ~= mm
%                     mTypeNext = kk;
%                     tMaxSumMachineRelaeseTime = tSumMachineReleaseTime;
%                 end
            end
        end
    end


text:
//
//  GON_NSManagedObject+SortDescriptors.h
//
//  Created by Nicolas Goutaland on 14/08/15.
//  Copyright 2015 Nicolas Goutaland. All rights reserved.
//
#import <CoreData/CoreData.h>

@interface NSManagedObject (SortDescriptors)
/* Must be implemented in subclasses to provide an array of NSSortDescriptors used in fetch request */
+ (NSArray *)sortDescriptors;
@end


text:
- [![npm version](https://badge.fury.io/js/spiraljs.svg)](https://badge.fury.io/js/spiraljs)
- [![Build Status](https://travis-ci.org/nlesc-sherlock/spiraljs.svg?branch=master)](https://travis-ci.org/nlesc-sherlock/spiraljs)
- [![bitHound Overall Score](https://www.bithound.io/github/nlesc-sherlock/spiraljs/badges/score.svg)](https://www.bithound.io/github/nlesc-sherlock/spiraljs)
- [![bitHound Dependencies](https://www.bithound.io/github/nlesc-sherlock/spiraljs/badges/dependencies.svg)](https://www.bithound.io/github/nlesc-sherlock/spiraljs/master/dependencies/npm)
- [![bitHound Dev Dependencies](https://www.bithound.io/github/nlesc-sherlock/spiraljs/badges/devDependencies.svg)](https://www.bithound.io/github/nlesc-sherlock/spiraljs/master/dependencies/npm)
- [![bitHound Code](https://www.bithound.io/github/nlesc-sherlock/spiraljs/badges/code.svg)](https://www.bithound.io/github/nlesc-sherlock/spiraljs)
- [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

_this library is still a work in progress_

The sibling repository [https://github.com/nlesc-sherlock/spiraljs-demo](https://github.com/nlesc-sherlock/spiraljs-demo) contains various examples of how spiraljs can be used.

Find the TypeDoc [here](http://nlesc-sherlock.github.io/spiraljs/sites/tsdoc/).

# codepen.io live examples

- [``BubbleSpiral``](http://codepen.io/jspaaks/pen/mOjeda)

# Gallery (static images)

## ArcSpiral

![ArcSpiral-example.png](https://github.com/nlesc-sherlock/spiraljs/raw/master/docs/ArcSpiral-example.png "ArcSpiral-example.png")

## BubbleSpiral

### with ``color_map``

![BubbleSpiral-with-colormap-example.png](https://github.com/nlesc-sherlock/spiraljs/raw/master/docs/BubbleSpiral-with-colormap-example.png "BubbleSpiral-with-colormap-example.png")

### with ``radius_map``

![BubbleSpiral-with-radiusmap-example.png](https://github.com/nlesc-sherlock/spiraljs/raw/master/docs/BubbleSpiral-with-radiusmap-example.png "BubbleSpiral-with-radiusmap-example.png")

## LineSpiral

![LineSpiral-example.png](https://github.com/nlesc-sherlock/spiraljs/raw/master/docs/LineSpiral-example.png "LineSpiral-example.png")

## TimedBubbleSpiral

TODO

# Documentation for users

Installation of the library through ``npm`` in the normal way:
```
npm install spiraljs
```

See also:

- GitHub [repo](http://github.com/nlesc-sherlock/spiraljs-demo) with a website illustrating spiraljs;
- [code coverage](http://nlesc-sherlock.github.io/spiraljs/sites/coverage/remapped/src/index.html);
- [documentation](http://nlesc-sherlock.github.io/spiraljs/sites/tsdoc/);

# Documentation for developers

(this section describes the complete repository on GitHub, only part of which is included in the package on https://www.npmjs.com/package/spiraljs).

## Setting up, building and running

Get a local copy of the spiraljs repository using ``git``:

```bash
# use package manager to install git
sudo apt-get install git

# make a local copy of this repository
git clone https://github.com/nlesc-sherlock/spiraljs.git

# change into spiraljs directory
cd spiraljs
```

Download dependencies:

```bash
# Assuming you already have ``npm`` installed on your system, install with:
npm install
```

We use ``npm`` for the various build tasks (see ``scripts`` in ``packages.json`` for the complete list and their definitions). Here's a summary of the most relevant tasks (see also below for the dependency graph):

```bash
# make a distributable js file, spiral.js
npm run dist

# run the unit tests against the distributable
npm run test

# do all types of linting:
# tslint on the TypeScript from src/
# csslint on the CSS from src/
# jslint and jshint on the JS from test/
npm run lint

# clean up generated files
npm run clean

# do an npm run clean and additionally throw away any downloaded files
npm run purge

# generate the TypeDoc, inspect afterwards in a browser (output will be at <projectroot>/docs/sites/tsdoc)
npm run tsdoc

# generate code coverage in various formats. output will be at <projectroot>/docs/sites/coverage/, e.g.
# <projectroot>/docs/sites/coverage/remapped/ts/spiraljs/index.html
npm run cover

```

## How it all fits together

### General

So you wrote some **source code**. A **distributable** can be created from the source code. Distributables are great, because that's what people can use in their own websites later. However, distributables are only good if they work --you don't want to break other people's websites, now do you? So, the distributable needs to be tested using **unit tests**. For this you typically need to do two things: first, you need to be able to do **assertions**. Assertions help you test different kinds of equality (''is the test result what it is supposed to be?''). Secondly, you need a  **test runner**, i.e. something that runs the tests (and then, typically, reports on their results). Now that you have tests, you also want to generate **code coverage** reports. Code coverage helps to make transparent which parts of the code are covered by tests.

### In our case

- Our **source code** lives at ``src``. The meat of it is written in TypeScript 2.
- We create the **distributable** using ``npm run`` scripting, so there are no Gulp or Grunt files.
- We use **unit tests** written in the style of [``Jasmine``](http://jasmine.github.io/2.0/introduction.html) (i.e. ``describe()`` and ``it()``).
- Our **assertion** library is also [``Jasmine``](http://jasmine.github.io/2.0/introduction.html) (e.g. ``expect(actual).toEqual(expected)``).
- [Karma](https://karma-runner.github.io/1.0/index.html) is our **test runner**.
- We generate code coverage in different formats using [``karma-coverage``](https://www.npmjs.com/package/karma-coverage). However, this gives us code coverage of the (generated) JavaScript, which is not really what we're interested in. So we have [``remap-istanbul``](https://www.npmjs.com/package/remap-istanbul) figure out which parts of the generated JavaScript correspond with which parts of the (written) TypeScript.

Here is a visual representation of our build process:

![visual-description-of-setup.png](https://github.com/nlesc-sherlock/spiraljs/raw/master/docs/visual-description-of-setup.png "visual-description-of-setup.png")

and here is a callgraph generated from [package.json](https://github.com/nlesc-sherlock/spiraljs/blob/master/package.json) using [https://github.com/jspaaks/npm-scripts-callgraph](https://github.com/jspaaks/npm-scripts-callgraph):

![callgraph.png](https://github.com/nlesc-sherlock/spiraljs/raw/master/docs/callgraph.png "callgraph.png")


text:
package com.quarkworks.dynamicpageradapter_android.multi_view_type;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;

import com.quarkworks.dynamicpageradapter_android.R;

/**
 * @author jacobamuchow@gmail.com (Jacob Muchow)
 */
public class MultiPagerActivity extends AppCompatActivity {
    private static final String TAG = MultiPagerActivity.class.getSimpleName();

    public static Intent newIntent(Context context) {
        return new Intent(context, MultiPagerActivity.class);
    }

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

        ViewPager viewPager = (ViewPager) findViewById(R.id.pager_activity_view_pager);

        viewPager.setPageMarginDrawable(null);
        viewPager.setPageMargin(30);
        viewPager.setOffscreenPageLimit(2);

        PagerAdapter pagerAdapter = new PagerAdapter();
        viewPager.setAdapter(pagerAdapter);
    }
}


text:
<?xml version="1.0"?>
<Document>

	<Sentence>
		<value>A prolactinoma is a noncancerous (benign) pituitary tumor that produces a hormone called prolactin.</value>
		<pattern_crowdsource> A [[prolactinoma|C0033375]] is a noncancerous (benign) [[pituitary tumor|C0032019]] that produces a [[hormone|C0019932]] called prolactin.		</pattern_crowdsource>
		<annotations>
			<annotation>
				<surface-form>prolactinoma</surface-form>
				<RDF-ID>C0033375</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>benign</surface-form>
				<RDF-ID>C0205183</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>pituitary tumor</surface-form>
				<RDF-ID>C0032019</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>hormone</surface-form>
				<RDF-ID>C0019932</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>prolactin</surface-form>
				<RDF-ID>C0033371</RDF-ID>
			</annotation>
		</annotations>
		<triples>
			<triple>C0033375 ISA C0032019</triple>
			<triple>C0032019 PRODUCES C0019932</triple>
			<triple>C0033375 PRODUCES C0019932</triple>
		</triples>
	</Sentence>
	<Sentence>
		<value>This results in too much prolactin in the blood.</value>
		<pattern_crowdsource> This results in too much [[prolactin|C0033371]] in the [[blood|C0005767]].		</pattern_crowdsource>
		<annotations>
			<annotation>
				<surface-form>results</surface-form>
				<RDF-ID>C1274040</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>prolactin</surface-form>
				<RDF-ID>C0033371</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>blood</surface-form>
				<RDF-ID>C0005767</RDF-ID>
			</annotation>
		</annotations>
		<triples>
			<triple>C0005767 LOCATION_OF C0033371</triple>
		</triples>
	</Sentence>

</Document>


text:
package garethflowers.retagit;

import java.awt.Cursor;

import javax.swing.JOptionPane;

/**
 * TagUpdater
 */
public class TagUpdater extends Thread {

    private Tag CurrentTag;
    private MainGUI Parent;

    public TagUpdater(MainGUI j, Tag current) {
        this.CurrentTag = current;
        this.Parent = j;
    }

    @Override
    public void run() {
        TagWriter writer = new TagWriter(this.CurrentTag);
        boolean written = writer.write();

        if (written) {
            this.CurrentTag = TagReader.read(this.CurrentTag.getFilename());
            Parent.setGuiFromCurrent();
        }

        Parent.Updating(false);
        Parent.LockGUI(false);
        Parent.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));

        if (written) {
            JOptionPane.showMessageDialog(Parent, "Tag Updating Complete",
                    "Complete", JOptionPane.INFORMATION_MESSAGE);
        } else {
            JOptionPane.showMessageDialog(Parent, "Tag Updating Failed!",
                    "Failed", JOptionPane.ERROR_MESSAGE);
        }
    }
}


text:
package plantsInsects.styles;

import java.awt.Color;
import java.awt.Font;

import plantsInsects.Insect;
import repast.simphony.visualizationOGL2D.DefaultStyleOGL2D;
import repast.simphony.visualizationOGL2D.StyleOGL2D;
import saf.v3d.ShapeFactory2D;
import saf.v3d.scene.Position;
import saf.v3d.scene.VSpatial;

public class InsectStyle extends DefaultStyleOGL2D {

	@Override
	public Color getColor(Object o) {
		Insect agent = (Insect)o;
		return agent.getSpeciesParams().getDisplayCol();
	}
}


text:
require 'vagrant/action/builtin/call'
require_relative 'action/configure_apt_proxy'
require_relative 'action/configure_chef_proxy'
require_relative 'action/configure_docker_proxy'
require_relative 'action/configure_env_proxy'
require_relative 'action/configure_git_proxy'
require_relative 'action/configure_npm_proxy'
require_relative 'action/configure_pear_proxy'
require_relative 'action/configure_svn_proxy'
require_relative 'action/configure_yum_proxy'
require_relative 'action/is_enabled'
require_relative 'action/only_once'

module VagrantPlugins
  module ProxyConf
    # Middleware stack builders
    class Action
      # Shortcut
      Builtin = Vagrant::Action::Builtin

      # Returns an action middleware stack that configures the VM
      #
      # @param opts [Hash] the options to be passed to {OnlyOnce}
      # @option (see OnlyOnce#initialize)
      def self.configure(opts = {})
        Vagrant::Action::Builder.build(OnlyOnce, opts, &config_actions)
      end

      # Returns an action middleware stack that configures the VM
      # after provisioner runs.
      def self.configure_after_provisoner
        Vagrant::Action::Builder.new.tap do |b|
          b.use Builtin::Call, IsEnabled do |env, b2|
            next if !env[:result]

            b2.use ConfigureDockerProxy
            b2.use ConfigureGitProxy
            b2.use ConfigureNpmProxy
            b2.use ConfigurePearProxy
            b2.use ConfigureSvnProxy
          end
        end
      end

      private

      # @return [Proc] the block that adds config actions to the specified
      #   middleware builder
      def self.config_actions
        @config_actions ||= Proc.new do |b|
          b.use Builtin::Call, IsEnabled do |env, b2|
            next if !env[:result]

            b2.use ConfigureAptProxy
            b2.use ConfigureChefProxy
            b2.use ConfigureDockerProxy
            b2.use ConfigureEnvProxy
            b2.use ConfigureGitProxy
            b2.use ConfigureNpmProxy
            b2.use ConfigurePearProxy
            b2.use ConfigureSvnProxy
            b2.use ConfigureYumProxy
          end
        end
      end
    end
  end
end


text:
<?php

declare(strict_types=1);

namespace Sylius\Bundle\ReviewBundle;

use Sylius\Bundle\ResourceBundle\AbstractResourceBundle;
use Sylius\Bundle\ResourceBundle\SyliusResourceBundle;
use Sylius\Bundle\ReviewBundle\DependencyInjection\Compiler\RegisterReviewFactoryPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;

final class SyliusReviewBundle extends AbstractResourceBundle
{
    public function getSupportedDrivers(): array
    {
        return [
            SyliusResourceBundle::DRIVER_DOCTRINE_ORM,
        ];
    }

    public function build(ContainerBuilder $container): void
    {
        parent::build($container);

        $container->addCompilerPass(new RegisterReviewFactoryPass());
    }

    /**
     * @psalm-suppress MismatchingDocblockReturnType https://github.com/vimeo/psalm/issues/2345
     */
    protected function getModelNamespace(): string
    {
        return 'Sylius\Component\Review\Model';
    }
}


text:
package vcs

//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.
//
// Code generated by Alibaba Cloud SDK Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

import (
	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
)

// GetDeviceLiveUrl invokes the vcs.GetDeviceLiveUrl API synchronously
func (client *Client) GetDeviceLiveUrl(request *GetDeviceLiveUrlRequest) (response *GetDeviceLiveUrlResponse, err error) {
	response = CreateGetDeviceLiveUrlResponse()
	err = client.DoAction(request, response)
	return
}

// GetDeviceLiveUrlWithChan invokes the vcs.GetDeviceLiveUrl API asynchronously
func (client *Client) GetDeviceLiveUrlWithChan(request *GetDeviceLiveUrlRequest) (<-chan *GetDeviceLiveUrlResponse, <-chan error) {
	responseChan := make(chan *GetDeviceLiveUrlResponse, 1)
	errChan := make(chan error, 1)
	err := client.AddAsyncTask(func() {
		defer close(responseChan)
		defer close(errChan)
		response, err := client.GetDeviceLiveUrl(request)
		if err != nil {
			errChan <- err
		} else {
			responseChan <- response
		}
	})
	if err != nil {
		errChan <- err
		close(responseChan)
		close(errChan)
	}
	return responseChan, errChan
}

// GetDeviceLiveUrlWithCallback invokes the vcs.GetDeviceLiveUrl API asynchronously
func (client *Client) GetDeviceLiveUrlWithCallback(request *GetDeviceLiveUrlRequest, callback func(response *GetDeviceLiveUrlResponse, err error)) <-chan int {
	result := make(chan int, 1)
	err := client.AddAsyncTask(func() {
		var response *GetDeviceLiveUrlResponse
		var err error
		defer close(result)
		response, err = client.GetDeviceLiveUrl(request)
		callback(response, err)
		result <- 1
	})
	if err != nil {
		defer close(result)
		callback(nil, err)
		result <- 0
	}
	return result
}

// GetDeviceLiveUrlRequest is the request struct for api GetDeviceLiveUrl
type GetDeviceLiveUrlRequest struct {
	*requests.RpcRequest
	OutProtocol string           `position:"Body" name:"OutProtocol"`
	StreamType  requests.Integer `position:"Body" name:"StreamType"`
	CorpId      string           `position:"Body" name:"CorpId"`
	GbId        string           `position:"Body" name:"GbId"`
	DeviceId    string           `position:"Body" name:"DeviceId"`
}

// GetDeviceLiveUrlResponse is the response struct for api GetDeviceLiveUrl
type GetDeviceLiveUrlResponse struct {
	*responses.BaseResponse
	Code        string `json:"Code" xml:"Code"`
	Message     string `json:"Message" xml:"Message"`
	RequestId   string `json:"RequestId" xml:"RequestId"`
	Url         string `json:"Url" xml:"Url"`
	OutProtocol string `json:"OutProtocol" xml:"OutProtocol"`
	StreamType  int    `json:"StreamType" xml:"StreamType"`
}

// CreateGetDeviceLiveUrlRequest creates a request to invoke GetDeviceLiveUrl API
func CreateGetDeviceLiveUrlRequest() (request *GetDeviceLiveUrlRequest) {
	request = &GetDeviceLiveUrlRequest{
		RpcRequest: &requests.RpcRequest{},
	}
	request.InitWithApiInfo("Vcs", "2020-05-15", "GetDeviceLiveUrl", "", "")
	request.Method = requests.POST
	return
}

// CreateGetDeviceLiveUrlResponse creates a response to parse from GetDeviceLiveUrl response
func CreateGetDeviceLiveUrlResponse() (response *GetDeviceLiveUrlResponse) {
	response = &GetDeviceLiveUrlResponse{
		BaseResponse: &responses.BaseResponse{},
	}
	return
}


text:
<?php

namespace SiteBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Slide
 *
 * @ORM\Table(name="slide")
 * @ORM\Entity(repositoryClass="SiteBundle\Repository\SlideRepository")
 */
class Slide
{
    const REPOSITORY_CLASS = "SiteBundle:Slide";
    const DEFAULT_TRANSP_ZONE_OPACITY = 0.7;
    const DEFAULT_TRANSP_ZONE_WIDTH = 280;
    const DEFAULT_TRANSP_ZONE_POSITION = 20;
    const DEFAULT_TRANSP_ZONE_COLOR = "000000";
    const DEFAULT_TRANSP_ZONE_CLOSABLE = false;

    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var \Application\Sonata\MediaBundle\Entity\Media
     * @ORM\OneToOne(targetEntity="Application\Sonata\MediaBundle\Entity\Media", cascade={"persist", "remove"})
     * @ORM\JoinColumn(name="image_content", referencedColumnName="id", nullable=false)
     */
    private $imageContent;

    /**
     * @var string
     *
     * @ORM\Column(name="text_content", type="text", nullable=true)
     */
    private $textContent;

    /**
     * @var integer
     *
     * @ORM\Column(name="display_order", type="string", length=6)
     */
    private $displayOrder;

    /**
     * @ORM\ManyToOne(targetEntity="SiteBundle\Entity\GalleryPage", inversedBy="slides", cascade={"persist"})
     * @ORM\JoinColumn(name="gallery_page", referencedColumnName="id")
     */
    private $parentGallery;

    /**
     * @var boolean
     *
     * @ORM\Column(name="transparent_zone_params", type="string", length=255)
     */
    private $transparentZoneParameters;

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set imageContent
     *
     * @param \Application\Sonata\MediaBundle\Entity\Media $imageContent
     * @return Slide
     */
    public function setImageContent(\Application\Sonata\MediaBundle\Entity\Media $imageContent)
    {
        $this->imageContent = $imageContent;

        return $this;
    }

    /**
     * Get imageContent
     *
     * @return \Application\Sonata\MediaBundle\Entity\Media
     */
    public function getImageContent()
    {
        return $this->imageContent;
    }

    /**
     * Set textContent
     *
     * @param string $textContent
     * @return Slide
     */
    public function setTextContent($textContent)
    {
        $this->textContent = $textContent;

        return $this;
    }

    /**
     * Get textContent
     *
     * @return string
     */
    public function getTextContent()
    {
        return $this->textContent;
    }

    /**
     * Set displayOrder
     *
     * @param integer $displayOrder
     * @return Slide
     */
    public function setDisplayOrder($displayOrder)
    {
        $this->displayOrder = $displayOrder;

        return $this;
    }

    /**
     * Get transparentZoneColor
     *
     * @return integer
     */
    public function getDisplayOrder()
    {
        return $this->displayOrder;
    }

    /**
     * Set parentGallery
     *
     * @param \SiteBundle\Entity\GalleryPage $parentGallery
     * @return Slide
     */
    public function setParentGallery(\SiteBundle\Entity\GalleryPage $parentGallery = null)
    {
        $this->parentGallery = $parentGallery;

        return $this;
    }

    /**
     * Get parentGallery
     *
     * @return \SiteBundle\Entity\GalleryPage
     */
    public function getParentGallery()
    {
        return $this->parentGallery;
    }

    /**
     * Set transparentZoneParameters
     *
     * @param string $transparentZoneParameters
     * @return Slide
     */
    public function setTransparentZoneParameters($transparentZoneParameters)
    {
        $this->transparentZoneParameters = $transparentZoneParameters;

        return $this;
    }

    /**
     * Get transparentZoneParameters
     *
     * @return string
     */
    public function getTransparentZoneParameters()
    {
        return $this->transparentZoneParameters;
    }

    public function __toString() {
        return "Slide #" . (string)$this->getId();
    }
}


text:
<?php defined('C5_EXECUTE') or die("Access Denied."); ?>

<?php

$site_menu->render();

?>

        <a href="javascript:void(0)" class="btn btn-danger" data-dialog="delete-site" data-dialog-title="<?=t('Delete %s', $site->getSiteName())?>"><?=t('Delete %s', $site->getSiteName())?>

        <form method="post" action="<?=$view->action('delete_site')?>">
            <?=Loader::helper("validation/token")->output('delete_site')?>
            <input type="hidden" name="id" value="<?=$site->getSiteID()?>">

<?=t('Are you sure you want to delete this site? This cannot be undone.')?>

                <button class="btn btn-default pull-left" onclick="jQuery.fn.dialog.closeTop()"><?=t('Cancel')?></button>
                <button class="btn btn-danger pull-right" onclick="$('div[data-dialog-wrapper=delete-site] form').submit()"><?=t('Delete Site')?></button>

        </form>

    <?=$form->label('handle', t('Handle'))?>

<?=$site->getSiteHandle()?>

    <?=$form->label('name', t('Name'))?>

<?=$site->getSiteName()?>

    <?=$form->label('canonical_url', t('Canonical URL'))?>

<?=$site->getSiteCanonicalURL()?>

    <?=$form->label('type', t('Site Type'))?>

<?=$site->getType()->getSiteTypeName()?>

    <?=$form->label('type', t('Time Zone'))?>

<?=$site->getConfigRepository()->get('timezone');?>


text:
package com.mercury.platform.ui.misc.note;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;

import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class NotesLoader {
    private final Logger logger = LogManager.getLogger(NotesLoader.class.getSimpleName());

    public NotesLoader() {
    }

    public List<Note> getNotesOnFirstStart() {
        return getNotes("notes/first/first-start.json");
    }

    public List<Note> getPatchNotesFromString(String source) {
        return getNotesFromString(source);
    }

    public List<Note> getPatchNotes() {
        return getNotes("notes/patch/patch-notes.json");
    }

    public String getVersionFrom(String source) {
        String version = "";
        JSONParser parser = new JSONParser();
        try {
            JSONObject root = (JSONObject) parser.parse(source);
            version = (String) root.get("version");
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return version;
    }

    private List<Note> getNotes(String filePath) {
        List<Note> notes = new ArrayList<>();
        JSONParser parser = new JSONParser();
        try {
            JSONObject root = (JSONObject) parser.parse(new InputStreamReader(getClass().getClassLoader().getResourceAsStream(filePath)));
            JSONArray notesArray = (JSONArray) root.get("notes");
            notes = getNotesList(notesArray);
        } catch (Exception e) {
            logger.error(e);
        }
        return notes;
    }

    private List<Note> getNotesFromString(String source) {
        List<Note> notes = new ArrayList<>();
        JSONParser parser = new JSONParser();
        try {
            JSONObject root = (JSONObject) parser.parse(source);
            JSONArray notesArray = (JSONArray) root.get("notes");
            notes = getNotesList(notesArray);
        } catch (Exception e) {
            logger.error(e);
        }
        return notes;
    }

    private List<Note> getNotesList(JSONArray notesArray) {
        List<Note> notes = new ArrayList<>();
        for (JSONObject next : (Iterable<JSONObject>) notesArray) {
            Note note = new Note();
            note.setTitle((String) next.get("title"));
            note.setText((String) next.get("text"));
            note.setImagePath((String) next.get("image"));
            note.setLayout(NoteLayout.valueOf((String) next.get("layout")));
            notes.add(note);
        }
        return notes;
    }
}