text:
                <md-button class="md-no-ink md-icon-button itbtn" ng-click="$root.tagLeftMenu()" aria-label='tagleft' style='width:39px;min-width:39px' data-toggle="tooltip" data-placement="bottom" title="显示/隐藏左侧菜单栏">

                </md-button>
                <md-divider></md-divider>

                        文件列表

                        文件列表

                <md-divider></md-divider>

                        编辑器

                        编辑器

                <md-divider></md-divider>

                        预览窗

                        预览窗

                <md-divider></md-divider>

            <md-divider></md-divider>

                <md-divider></md-divider>
                <md-menu style='padding:0'>

                    <md-menu-content width="4" style='overflow-x: hidden;'>

                                手工

                                实时

                                刷新

                                运行

                    </md-menu-content>
                </md-menu>

                <md-divider ng-show='!previewRt'></md-divider>

                        刷新

                <md-divider></md-divider>

                        手工

                        实时

        <md-divider></md-divider>

                <md-dialog layout-padding style='text-align:center;width:360px'>

                        APP标识名:

                </md-dialog>

                <md-dialog layout-padding style='text-align:left'>

类型 : {{fileinfoDialogFile.mimeType}}

大小 : {{ksize(fileinfoDialogFile.fsize)}}k

地址 : {{fileinfoDialogFile.url}}

实时地址请使用 {{toRtfilesUrl(fileinfoDialogFile.url)}}

                </md-dialog>

                <md-dialog layout-padding style='text-align:center'>

                </md-dialog>

                        <md-divider style='margin-bottom:1rem'></md-divider>

                                    <div style='background:#1ec38a;opacity:0.25;position:absolute;height:40px;margin-top:5px;' ng-style='{width:val.percent+"px"}' ng-show='val.percent<100'>

                            <md-menu style='padding:0'>

                                <md-menu-content width="3" style='overflow-x: hidden;'>

                                        编辑

                                        运行

                                        信息

                                        删除

                                </md-menu-content>
                            </md-menu>

                                <md-menu style='padding:0'>

                                    <md-menu-content width="3" style='overflow-x: hidden;'>

                                            折叠/展开

                                            上传文件

                                            删除文件夹

                                    </md-menu-content>
                                </md-menu>

                                    <md-menu style='padding:0;padding-left:2rem'>

                                        <md-menu-content width="3" style='overflow-x: hidden;'>

                                                编辑

                                                运行

                                                信息

                                                删除

                                        </md-menu-content>
                                    </md-menu>

                        <md-divider style='margin:1rem 0'></md-divider>

                            <md-menu style='padding:0'>

                                <md-menu-content style='overflow-x: hidden;'>

                                         新建文件

                                         新建文件夹

                                         上传文件

                                </md-menu-content>
                            </md-menu>

                            <md-button class="md-raised md-accent itbtn" ng-click="doSaveFile()" aria-label='tagleft' style='color:#FFF;width:80px'>

                                保存
                            </md-button>

                            <md-button ng-click="openCharBox()" ng-hide='showCharBox' aria-label='a' style='vertical-align:top;color:#000'>

                                 符号
                            </md-button>
                            <md-button ng-click="openCharBox()" ng-show='showCharBox' aria-label='a' style='vertical-align:top;color:#00bfa5'>

                                 符号
                            </md-button>
                            <md-menu style='padding:0' width='6'>

                                     更多

                                <md-menu-content>
                                    <md-menu-item>
                                        <md-button ng-click="changeCmEditorTheme()" aria-label='a'>

                                             颜色主题
                                        </md-button>
                                    </md-menu-item>

                                    <md-menu-item>
                                        <md-button ng-click="setFontSize()" aria-label='a'>

                                             小字号
                                             大字号
                                        </md-button>
                                    </md-menu-item>

                                    <md-menu-item>
                                        <md-button ng-click="setWrap()" aria-label='a'>

                                             换行开关
                                        </md-button>
                                    </md-menu-item>

                                    <md-menu-item>
                                        <md-button ng-click="setLint()" aria-label='a'>

                                             错误提示
                                        </md-button>
                                    </md-menu-item>

                                    <md-menu-item ng-hide='true'>
                                        <md-button ng-click="nextMode()" aria-label='a'>

                                            语言:

                                        </md-button>
                                    </md-menu-item>

                                    <md-menu-item ng-hide='true'>
                                        <md-button ng-click="useTemplate()" aria-label='a'>

                                            使用模版
                                        </md-button>
                                    </md-menu-item>
                                </md-menu-content>
                            </md-menu>

                <md-dialog layout-padding style='text-align:center;padding:24px;max-width:800px'>
                    <form name="userForm" style="margin-top:12px;width:400px;">
                        <md-content class="md-no-momentum" style='background:inherit'>
                            <md-input-container class="md-block" flex-gt-sm style='margin-top:48px'>
                                选择上传到文件夹
                                <md-select ng-model="selFolderPath" style="text-align:left">
                                    <md-option ng-repeat="(key,val) in appFolders" value="{{key}}" ng-bind='key.replace(appPath,"")' style="text-align:left"></md-option>
                                </md-select>
                            </md-input-container>
                        </md-content>
                    </form>

                        <md-button class="md-raised md-primary btn-lg" ng-click='doUploadFile($event)' style='width:180px;color:#FFF'>选择文件</md-button>
                        <md-button class="md-raised md-default btn-lg" ng-click='cancelDialog()'>取消</md-button>

                </md-dialog>


text:
<?php

namespace Bunq\Client;

use Bunq\Client\HttpClients\BunqCurlHttpClient;
use Bunq\Client\HttpClients\BunqHttpClientInterface;

/**
 * Class BunqClient
 * Client used to send requests to te API.
 * @package Bunq\Client
 */

class BunqClient
{
    /**
     * The serviceUrl is the base URL of the API.
     * The apiVersion is the version of the API.
     */
    const BUNQ_API_SERVICE_URL = 'https://api.bunq.com';
    const BUNQ_API_SERVICE_URL_SANDBOX = 'https://sandbox.public.api.bunq.com';
    const BUNQ_API_VERSION = 'v1';

    /**
     * The Signature Algorithm used is SHA256. (php: http://php.net/manual/en/function.openssl-sign.php#signature_alg)
     */
    const SIGNATURE_ALGORITHM = OPENSSL_ALGO_SHA256;

    /**
     * Http client handler for handling the requests.
     *
     * @var BunqHttpClientInterface
     */
    private $httpClientHandler;

    /**
     * @var string the url used to connect to the API.
     */
    private $serviceUrl;

    /**
     * BunqClient constructor.
     *
     * @param bool $sandbox
     * @param BunqHttpClientInterface|null $httpClientHandler
     */
    public function __construct($sandbox, BunqHttpClientInterface $httpClientHandler = null)
    {
        $this->httpClientHandler = $httpClientHandler ?: new BunqCurlHttpClient();

        if($sandbox) {
            $this->serviceUrl = self::BUNQ_API_SERVICE_URL_SANDBOX;
        }
        else {
            $this->serviceUrl = self::BUNQ_API_SERVICE_URL;
        }
    }

    /**
     * Prepares the request to be send to the httpClientHandler.
     *
     * @param BunqRequest $request
     * @return array
     */
    public function prepareRequestMessage(BunqRequest $request)
    {
        //The url is the serviceUrl, apiVersion and endpoint separated by a '/'.
        $url = $this->serviceUrl . '/' . self::BUNQ_API_VERSION . '/' . $request->getEndpoint();

        return [
            $url,
            $request->getMethod(),
            $request->getHeaders(),
            $request->getBody(),
        ];
    }

    /**
     * Makes the request to the httpClientHandler and returns the result.
     *
     * @param BunqRequest $request
     * @return BunqResponse
     */
    public function SendRequest(BunqRequest $request)
    {
        list($url, $method, $headers, $body) = $this->prepareRequestMessage($request);
        $rawResponse = $this->httpClientHandler->send($url, $method, $body, $headers);

        return new BunqResponse(
            $rawResponse->getBody(),
            $rawResponse->getHeaders(),
            $rawResponse->getHttpStatusCode(),
            $request
        );
    }

    /**
     * Returns the signature. The signature should be added to the X-Bunq-Client-Signature header.
     *
     * @param string $clientPrivateKey The private key corresponding to the client_public_key you provided in the
     * installation call.
     *
     * @param BunqRequest $request The request needed for the signature.
     *
     * @return string The result of the signing after we base64 encoded it. This can be used in the headers of the
     * request.
     */
    public function getRequestSignature(BunqRequest $request, $clientPrivateKey)
    {
        //The headers should be in alphabetical order when signing.
        $headers = $request->getHeaders();
        ksort($headers);

        //The first line of string that needs to be signed is for example: POST /v1/installation.
        $toSign = $request->getMethod() . ' ' . '/' . self::BUNQ_API_VERSION . '/' . $request->getEndpoint();

        foreach ($headers as $key => $value) {
            //Not all headers should be signed.
            //The User-Agent and Cash-Control headers need to be signed.
            if ($key === 'User-Agent' || $key === 'Cache-Control') {
                $toSign .= PHP_EOL . $key . ': ' . $value;
            }

            //All headers with the prefix 'X-Bunq-' need to be signed.
            if (substr($key, 0, 7) === 'X-Bunq-') {
                $toSign .= PHP_EOL . $key . ': ' . $value;
            }
        }

        //Always add two newlines after the headers.
        $toSign .= PHP_EOL . PHP_EOL;

        //If we have a body in this request: add the body to the string that needs to be signed.
        if (!is_null($request->getBody())) {
            $toSign .= $request->getBody();
        }

        openssl_sign($toSign, $signature, $clientPrivateKey, self::SIGNATURE_ALGORITHM);

        //Don't forget to base64 encode the signature.
        return base64_encode($signature);
    }

    public function verifyResponseSignature(BunqResponse $response, $serverPublicKey)
    {
        //Create the headers which should be signed.
        $headersToSign = '';

        //The Apache headers end in \r\n..
        $responseHeadersArray = explode("\r\n", $response->getHeaderString());

        foreach ($responseHeadersArray as $oneHeaderLine) {
            if (strstr($oneHeaderLine, 'X-Bunq') && !strstr($oneHeaderLine, 'X-Bunq-Server-Signature')) {
                $headersToSign[] = $oneHeaderLine;
            }
        }

        //Sort the headers.
        sort($headersToSign);

        //Create the signed string.
        $signedString = $response->getStatusCode() . "\n";
        $signedString .= implode("\n", $headersToSign);
        $signedString .= "\n\n";
        $signedString .= $response->getBodyString();

        //Extract the signature from the response headers.
        $serverSignatureBase64Encoded = '';

        foreach ($responseHeadersArray as $oneHeaderLine) {
            if (stristr($oneHeaderLine, 'X-Bunq-Server-Signature')) {
                // Remove the header name to get only the signature string.
                $serverSignatureBase64Encoded = str_replace('X-Bunq-Server-Signature: ', '', $oneHeaderLine);
            }
        }

        $serverSignature = base64_decode($serverSignatureBase64Encoded);

        //Return the openssl verification result.
        return openssl_verify($signedString, $serverSignature, $serverPublicKey, OPENSSL_ALGO_SHA256);
    }

}

redpajama_set_name: RedPajamaGithub


text:
require_relative "../path"
require Spec::Path.lib_dir.join("bundler/deprecate")
include Spec::Path

$LOAD_PATH.unshift(*Dir[Spec::Path.base_system_gems.join("gems/{artifice,mustermann,rack,tilt,sinatra}-*/lib")].map(&:to_s))

require "artifice"
require "sinatra/base"

ALL_REQUESTS = [] # rubocop:disable Style/MutableConstant
ALL_REQUESTS_MUTEX = Mutex.new

at_exit do
  if expected = ENV["BUNDLER_SPEC_ALL_REQUESTS"]
    expected = expected.split("\n").sort
    actual = ALL_REQUESTS.sort

    unless expected == actual
      raise "Unexpected requests!\nExpected:\n\t#{expected.join("\n\t")}\n\nActual:\n\t#{actual.join("\n\t")}"
    end
  end
end

class Endpoint < Sinatra::Base
  def self.all_requests
    @all_requests ||= []
  end

  GEM_REPO = Pathname.new(ENV["BUNDLER_SPEC_GEM_REPO"] || Spec::Path.gem_repo1)
  set :raise_errors, true
  set :show_exceptions, false

  def call!(*)
    super.tap do
      ALL_REQUESTS_MUTEX.synchronize do
        ALL_REQUESTS << @request.url
      end
    end
  end

  helpers do
    def dependencies_for(gem_names, gem_repo = GEM_REPO)
      return [] if gem_names.nil? || gem_names.empty?

      require "#{Spec::Path.lib_dir}/bundler"
      Bundler::Deprecate.skip_during do
        all_specs = %w[specs.4.8 prerelease_specs.4.8].map do |filename|
          Marshal.load(File.open(gem_repo.join(filename)).read)
        end.inject(:+)

        all_specs.map do |name, version, platform|
          spec = load_spec(name, version, platform, gem_repo)
          next unless gem_names.include?(spec.name)
          {
            :name         => spec.name,
            :number       => spec.version.version,
            :platform     => spec.platform.to_s,
            :dependencies => spec.dependencies.select {|dep| dep.type == :runtime }.map do |dep|
              [dep.name, dep.requirement.requirements.map {|a| a.join(" ") }.join(", ")]
            end,
          }
        end.compact
      end
    end

    def load_spec(name, version, platform, gem_repo)
      full_name = "#{name}-#{version}"
      full_name += "-#{platform}" if platform != "ruby"
      Marshal.load(Bundler.rubygems.inflate(File.binread(gem_repo.join("quick/Marshal.4.8/#{full_name}.gemspec.rz"))))
    end
  end

  get "/quick/Marshal.4.8/:id" do
    redirect "/fetch/actual/gem/#{params[:id]}"
  end

  get "/fetch/actual/gem/:id" do
    File.read("#{GEM_REPO}/quick/Marshal.4.8/#{params[:id]}")
  end

  get "/gems/:id" do
    File.read("#{GEM_REPO}/gems/#{params[:id]}")
  end

  get "/api/v1/dependencies" do
    Marshal.dump(dependencies_for(params[:gems]))
  end

  get "/specs.4.8.gz" do
    File.read("#{GEM_REPO}/specs.4.8.gz")
  end

  get "/prerelease_specs.4.8.gz" do
    File.read("#{GEM_REPO}/prerelease_specs.4.8.gz")
  end
end

Artifice.activate_with(Endpoint)


text:
namespace content {
class NavigationController;
}

namespace autofill {

// An interface for the dialog that appears when a site initiates an Autofill
// action via the imperative autocomplete API.
class AutofillDialogView {
 public:
  virtual ~AutofillDialogView();

  // Shows the dialog.
  virtual void Show() = 0;

  // Hides the dialog as if a user pressed cancel.
  virtual void Hide() = 0;

  // Called when a different notification is available.
  virtual void UpdateNotificationArea() = 0;

  // Called when account details may have changed (user logs in to GAIA, creates
  // a new account, etc.).
  virtual void UpdateAccountChooser() = 0;

  // Updates the button strip based on the current controller state.
  virtual void UpdateButtonStrip() = 0;

  // Called when the contents of a section have changed. Depending on |action|,
  // the view may also clobber all manual inputs.
  virtual void UpdateSection(DialogSection section, UserInputAction action) = 0;

  // Fills |output| with data the user manually input.
  virtual void GetUserInput(DialogSection section, DetailOutputMap* output) = 0;

  // Gets the CVC value the user typed to go along with the stored credit card
  // data. If the user is inputing credit card data from scratch, this is not
  // relevant.
  virtual string16 GetCvc() = 0;

  // Returns the state of the "use billing address for shipping" checkbox.
  virtual bool UseBillingForShipping() = 0;

  // Returns true if new or edited autofill details should be saved.
  virtual bool SaveDetailsLocally() = 0;

  // Triggers dialog to sign in to Google.
  // Returns a NotificationSource to be used to monitor for sign-in completion.
  virtual const content::NavigationController* ShowSignIn() = 0;

  // Closes out any signin UI and returns to normal operation.
  virtual void HideSignIn() = 0;

  // Updates the progress bar based on the Autocheckout progress. |value| should
  // be in [0.0, 1.0].
  virtual void UpdateProgressBar(double value) = 0;

  // Called when the active suggestions data model changed.
  virtual void ModelChanged() = 0;

  // Simulates the user pressing 'Submit' to accept the dialog.
  virtual void SubmitForTesting() = 0;

  // Simulates the user pressing 'Cancel' to abort the dialog.
  virtual void CancelForTesting() = 0;

  // Factory function to create the dialog (implemented once per view
  // implementation). |controller| will own the created dialog.
  static AutofillDialogView* Create(AutofillDialogController* controller);
};

}  // namespace autofill

#endif  // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_VIEW_H_


text:
package net.soundvibe.reacto.vertx.events;

import io.reactivex.Flowable;
import io.reactivex.exceptions.MissingBackpressureException;
import io.reactivex.processors.*;
import io.reactivex.schedulers.Schedulers;
import io.vertx.core.Vertx;
import io.vertx.core.buffer.Buffer;
import io.vertx.core.http.*;
import io.vertx.core.logging.*;
import net.soundvibe.reacto.client.events.CommandHandler;
import net.soundvibe.reacto.discovery.types.*;
import net.soundvibe.reacto.errors.*;
import net.soundvibe.reacto.internal.InternalEvent;
import net.soundvibe.reacto.mappers.Mappers;
import net.soundvibe.reacto.types.*;
import net.soundvibe.reacto.vertx.server.handlers.WebSocketFrameHandler;

import java.io.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.concurrent.atomic.*;

import static net.soundvibe.reacto.mappers.Mappers.commandToBytes;
import static net.soundvibe.reacto.utils.WebUtils.*;

/**
 * @author OZY on 2015.11.23.
 */
public class VertxWebSocketCommandHandler implements CommandHandler, Closeable {

    private static final Logger log = LoggerFactory.getLogger(VertxWebSocketCommandHandler.class);
    public static final int INITIAL_CAPACITY = 10000;
    private final ServiceRecord serviceRecord;
    private final HttpClient httpClient;

    private final Map<String, FlowableProcessor<Event>> streams = new ConcurrentHashMap<>(INITIAL_CAPACITY);
    private CompletableFuture<WebSocket> webSocketStream;
    private final AtomicBoolean closed = new AtomicBoolean(false);

    public VertxWebSocketCommandHandler(ServiceRecord serviceRecord, Vertx vertx) {
        Objects.requireNonNull(serviceRecord, "serviceRecord cannot be null");
        Objects.requireNonNull(vertx, "vertx cannot be null");
        if (serviceRecord.type != ServiceType.WEBSOCKET)
            throw new IllegalStateException("Unexpected service type: expected WEBSOCKET, but got: " + serviceRecord.type);
        this.serviceRecord = serviceRecord;
        final HttpClientOptions httpClientOptions = new HttpClientOptions()
                //.setMaxPoolSize(32)
                .setUsePooledBuffers(true)
                .setTryUseCompression(true)
                .setReuseAddress(true)
                .setSsl(serviceRecord.location.asBoolean(ServiceRecord.LOCATION_SSL).orElse(false))
                .setKeepAlive(true)
                .setTcpKeepAlive(true)
                .setDefaultHost(serviceRecord.location.asString(ServiceRecord.LOCATION_HOST).orElse("localhost"))
                .setDefaultPort(serviceRecord.location.asInteger(ServiceRecord.LOCATION_PORT).orElse(80));
        this.httpClient = vertx.createHttpClient(httpClientOptions);
        createStream();
    }

    @Override
    public Flowable<Event> observe(Command command) {
        final String cmdId = command.id.toString();
        if (streams.size() > INITIAL_CAPACITY) return Flowable.error(new MissingBackpressureException("WebSocket Event Handler exceeded command limit"));

        final Flowable<Event> eventObservable = streams.compute(cmdId, (id, subject) ->
                subject != null ? subject : ReplayProcessor.create())
                .doOnCancel(() -> streams.remove(cmdId));

        if (isClosed()) {
            createStream();
        }

        return Flowable.fromFuture(webSocketStream, Schedulers.computation())
                .doOnNext(webSocket -> sendCommandForExecution(command, webSocket))
                .flatMap(webSocket -> eventObservable);
    }

    @Override
    public ServiceRecord serviceRecord() {
        return serviceRecord;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        VertxWebSocketCommandHandler that = (VertxWebSocketCommandHandler) o;
        return Objects.equals(serviceRecord, that.serviceRecord);
    }

    @Override
    public int hashCode() {
        return Objects.hash(serviceRecord);
    }

    @Override
    public String name() {
        return serviceRecord.name;
    }

    @Override
    public void close() throws IOException {
        if (!webSocketStream.isCompletedExceptionally() && !webSocketStream.isCancelled()) {
            try {
                webSocketStream.get().close();
            } catch (InterruptedException | ExecutionException e) {
                log.error("Error when closing WebSocket: " + e);
            }
        }
    }

    private boolean isClosed() {
        return closed.get();
    }

    private synchronized void createStream() {
        this.webSocketStream = CompletableFuture.supplyAsync(this::connect, Executors.newCachedThreadPool());
    }

    private static void sendCommandForExecution(Command command, WebSocket webSocket) {
        if (log.isDebugEnabled()) {
            log.debug("Sending command for execution: " + command);
        }
        webSocket.writeBinaryMessage(Buffer.buffer(commandToBytes(command)));
    }

    private WebSocket connect() {
        final CountDownLatch countDownLatch = new CountDownLatch(1);
        final AtomicReference<WebSocket> webSocketResult = new AtomicReference<>();
        log.info("Connecting to WebSocket...");
        httpClient.websocketStream(includeStartDelimiter(includeEndDelimiter(serviceRecord.location
                .asString(ServiceRecord.LOCATION_ROOT).orElse(serviceRecord.name))))
                .exceptionHandler(error -> {
                    countDownLatch.countDown();
                    doOnException(error);
                })
                .handler(webSocket -> {
                            webSocket
                                    .exceptionHandler(this::doOnException)
                                    .closeHandler(__ -> doOnClose())
                                    .frameHandler(new WebSocketFrameHandler(buffer -> handleEvent(buffer.getBytes())));
                            webSocketResult.set(webSocket);
                            countDownLatch.countDown();
                            closed.set(false);
                        }
                );
        try {
            countDownLatch.await(5L, TimeUnit.SECONDS);
            final WebSocket webSocket = webSocketResult.get();
            if (webSocket == null) {
                throw new CannotDiscoverService("Unable to connect to service's WebSocket: " + serviceRecord);
            }
            return webSocket;
        } catch (InterruptedException e) {
            throw new CannotDiscoverService("Interrupted when trying to connect to service's WebSocket: " + serviceRecord);
        }
    }

    private void doOnException(Throwable error) {
        log.error("WebSocket error: " + error);
        closed.set(true);
        failWithError(error);
    }

    private void doOnClose() {
        log.warn("WebSocket is closed for: " + serviceRecord);
        closed.set(true);
        failWithError(new ConnectionClosedUnexpectedly(
                "WebSocket connection closed without completion"));
    }

    private void handleEvent(byte[] eventBytes) {
        final InternalEvent internalEvent = Mappers.fromBytesToInternalEvent(eventBytes);
        final String cmdId = internalEvent.commandId().orElse("");
        if (log.isDebugEnabled()) {
            log.debug("InternalEvent [" + cmdId + "] is being handled: " + internalEvent.name + ": " + internalEvent.eventType);
        }
        final FlowableProcessor<Event> subject = streams.get(cmdId);
        if (subject == null) return;
        switch (internalEvent.eventType) {
            case NEXT: {
                subject.onNext(Mappers.fromInternalEvent(internalEvent));
                break;
            }
            case ERROR: {
                streams.remove(cmdId);
                subject.onError(internalEvent.error
                        .orElse(ReactiveException.from(new UnknownError("Unknown error from internalEvent: " + internalEvent))));

                break;
            }
            case COMPLETED: {
                streams.remove(cmdId);
                subject.onComplete();
                break;
            }
        }
    }

    private void failWithError(Throwable error) {
        streams.forEach((objectId, subject) -> subject.onError(error));
        streams.clear();
    }

}


text:
import os
# from collections import defaultdict, Counter
import gzip
import argparse
import logging

from freki.readers import tetml, pdfminer
from freki.analyzers import base as basic_analyzer, xycut

from freki.serialize import FrekiDoc, FrekiBlock, FrekiLine

INTERLINEAR_THRESHOLD = 0.6

readers = {
    'tetml': tetml.TetmlReader,
    'pdfminer': pdfminer.PdfMinerReader
}
analyzers = {
    'xycut': xycut.XYCutAnalyzer
}

def run(args):
    reader = readers[args.reader](args.infile, debug=args.debug)
    analyzer = analyzers[args.analyzer](debug=args.debug)

    logging.info('Analyzing {}'.format(args.infile))
    doc_id = _doc_id_from_path(args.infile)
    doc = analyzer.analyze(reader, id=doc_id)

    if args.outfile is None or hasattr(args.outfile, 'write'):
        if args.gzip:
            raise Exception('Cannot gzip to an open stream.')
        process(doc, args.outfile)
    else:
        if args.gzip:
            openfile = gzip.open
            if not args.outfile.endswith('.gz'):
                args.outfile += '.gz'
        else:
            openfile = open
        dirs = os.path.dirname(args.outfile)
        if dirs:
            os.makedirs(dirs, exist_ok=True)
        with openfile(args.outfile, 'wb') as outfile:
            process(doc, outfile)

def process(doc, outfile):
    # Initialize the freki document
    fd = FrekiDoc()
    line_no = 1

    # find minimum left-coordinate if available
    l_margin = [t.llx for p in doc.pages for t in p.tokens]
    l_margin = min(l_margin) if l_margin else 0.0

    for page in doc.pages:
        for blk in page.blocks:
            fb = FrekiBlock(
                doc_id=doc.id,
                page=page.id,
                block_id='{}-{}'.format(page.id, blk.id),
                bbox='{},{},{},{}'.format(blk.llx, blk.lly, blk.urx, blk.ury),
                doc=fd,
                label=blk.label
            )

            for i, data in enumerate(respace(blk, xoffset=(l_margin * -1))):
                line, iscore = data
                fonts = ','.join(
                    sorted(set(['{}-{}'.format(t.font, round(t.height, 1))
                                for t in blk.lines[i].tokens]))
                )
                bbox = blk.lines[i].bbox
                fl = FrekiLine(
                    line,
                    line=line_no+i,
                    fonts=fonts,
                    bbox='{0.llx},{0.lly},{0.urx},{0.ury}'.format(bbox),
                    iscore=None if iscore is None else '{:.2f}'.format(iscore)
                )
                fb.add_line(fl)

            fd.add_block(fb)

            line_no += len(blk.lines)
    if outfile is None:
        print(str(fd))
    else:
        outfile.write(str(fd).encode('utf-8'))

def _llx_col(x, dx):
    if dx == 0:
        dx = 1  # avoid division by zero
    return int((x/dx) + 0.5)

def _interlinear_score(toklist, prev):
    a_llxs = [t[0] for t in toklist]
    left = min(a_llxs)
    b_llxs = set(c for c, _ in prev if c >= left)
    if len(a_llxs) > len(b_llxs):
        a_llxs, b_llxs = b_llxs, a_llxs
    return sum(1 if c in b_llxs else 0 for c in a_llxs) / float(len(b_llxs))

def _columnized_tokens(tokens, min_dx, char_dx, xoffset):
    last_x = 0
    toklist = []
    for t in tokens:
        dx = t.llx - last_x
        text = t.text or ''
        # this doesn't belong here, but it's currently the last time we
        # have the token feature data available with the text
        if t.features.get('sup') == True:
            text = '^{{{}}}'.format(text)
        elif t.features.get('sub') == True:
            text = '_{{{}}}'.format(text)
        # rejoin tokens not separated by spaces
        # print(text, char_dx, dx, min_dx)
        if not toklist or (char_dx > 0 and dx >= min_dx):
            col = _llx_col(t.llx + xoffset, char_dx)
            toklist.append([col, text])
        else:
            toklist[-1][1] += text
        last_x = t.urx
    return toklist

def _respace_group(group):
    cols = {}  # column : [ rowidx, ... ]
    colidx = {}  # rowidx : colidx
    nextcol = {}  # rowidx : column
    for i, data in enumerate(group):
        toklist, iscore = data
        for col, text in toklist:
            cols[col] = cols.get(col, []) + [i]
        colidx[i] = 0
        nextcol[i] = 0

    for col, rowidxs in sorted(cols.items()):
        start = max(col, max(nextcol[i] for i in rowidxs))
        for i in rowidxs:
            tok = group[i][0][colidx[i]]
            tok[0] = start
            nextcol[i] = start + len(tok[1]) + 1
            colidx[i] += 1

def respace(block, xoffset=0.0):
    # -------------------------------------------
    # We want to calculate the average character
    # width for a block. The numerator is the sum of
    # the point widths of the characters
    # -------------------------------------------
    char_num = sum(t.width for line in block.lines for t in line.tokens)

    # -------------------------------------------
    # The denominator is the number of characters
    # in the text in the block.
    # -------------------------------------------
    char_den = 0
    for line in block.lines:
        for t in line.tokens:
            if t.text is not None:
                char_den += len(t.text)

    char_dx = char_num / char_den if char_den > 0 else 1.0
    min_dx = char_dx / 3

    groups = []
    toklists = []
    prev = None
    for line in block.lines:
        toklist = _columnized_tokens(line.tokens, min_dx, char_dx, xoffset)
        iscore = _interlinear_score(toklist, prev) if prev else None
        if iscore is None or iscore < INTERLINEAR_THRESHOLD:
            groups.append([(toklist, iscore)])
        else:
            groups[-1].append((toklist, iscore))
        prev = toklist

    lines = []
    for group in groups:
        _respace_group(group)
        for toklist, iscore in group:
            lastcol = 0
            toks = []
            for col, text in toklist:
                toks.append(' ' * (col - lastcol))
                toks.append(text)
                lastcol += (col - lastcol) + len(text)
            lines.append((''.join(toks), iscore))
    return lines

def _doc_id_from_path(path):
    bn = os.path.basename(path)
    if bn.endswith('.gz'):
        bn = bn[:-3]
    return os.path.splitext(bn)[0]

def main(arglist=None):
    parser = argparse.ArgumentParser(
        formatter_class=argparse.RawDescriptionHelpFormatter,
        description="Analyze the document structure of text in a PDF",
        prog='freki',
        epilog='examples:\n'
               '    freki --reader tetml --analyzer=xycut in.xml > out.txt'
    )
    parser.add_argument(
        '-v', '--verbose',
        action='count', dest='verbosity', default=2,
        help='increase the verbosity (can be repeated: -vvv)'
    )
    parser.add_argument(
        '--debug',
        action='store_true',
        help='show debugging visualizations'
    )
    parser.add_argument(
        '-r', '--reader',
        choices=('tetml', 'pdfminer'), default='tetml'
    )
    parser.add_argument(
        '-a', '--analyzer',
        choices=(['xycut']), default='xycut'
    )
    parser.add_argument(
        '-z', '--gzip',
        action='store_true', help='gzip output file'
    )
    parser.add_argument('infile')
    parser.add_argument('outfile')
    args = parser.parse_args(arglist)
    logging.basicConfig(level=50-(args.verbosity*10))
    run(args)

if __name__ == '__main__':
    main()


text:
package org.ereunao.ereunao.api.service;

import org.ereunao.ereunao.api.resource.CatalogueEntry;
import org.ereunao.ereunao.api.resource.Reference;
import java.util.Collection;

public interface ReferenceService {
    Collection<Reference> findReferencesTo(CatalogueEntry entry);
    Collection<Reference> findReferencesFrom(CatalogueEntry entry);
    Collection<String> findReferencedUrlsFrom(CatalogueEntry entry);
    Reference find(String from, String to);
    void save(Reference reference);
    void saveAll(Reference... references);
    void saveAll(Collection<Reference> references);
}


text:
package com.silicornio.googlyeyes.dbandexample.model;

import java.util.Calendar;

/**
 * Created by SilicorniO
 */
public class GEMessage {

    private String title;

    private String tag;

    private boolean checkBoolean;

    private int numViews;

    private Calendar messageDate;

    private GEMessageText text;

    public GEMessage(String title, GEMessageText text){
        this.title = title;
        this.text = text;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getTag() {
        return tag;
    }

    public void setTag(String tag) {
        this.tag = tag;
    }

    public int getNumViews() {
        return numViews;
    }

    public void setNumViews(int numViews) {
        this.numViews = numViews;
    }

    public Calendar getMessageDate() {
        return messageDate;
    }

    public void setMessageDate(Calendar messageDate) {
        this.messageDate = messageDate;
    }

    public GEMessageText getText() {
        return text;
    }

    public void setText(GEMessageText text) {
        this.text = text;
    }

    public boolean isCheckBoolean() {
        return checkBoolean;
    }

    public void setCheckBoolean(boolean checkBoolean) {
        this.checkBoolean = checkBoolean;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        GEMessage geMessage = (GEMessage) o;

        if (!title.equals(geMessage.title)) return false;
        return text != null ? text.equals(geMessage.text) : geMessage.text == null;

    }

    @Override
    public int hashCode() {
        int result = 31 + title.hashCode();
        result = 31 * result + (text != null ? text.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "GEMessage{" +
                "title='" + title + '\'' +
                ", tag='" + tag + '\'' +
                ", numViews=" + numViews +
                ", messageDate=" + messageDate +
                ", text=" + text +
                '}';
    }
}


text:
package com.wistronits.wh.annbot.utils.auth;

/**
 * Created by WH1705002 on 2017/8/24.
 */

@Deprecated
public interface MetricAware {
    boolean isMetricActivated();
}


text:
export default {
  isLoading: true,
  stream: null,
  streams: {},
  ui: {
    isOtherChatActive: false,
    chatSize: localStorage ? Number(localStorage.getItem('chatSize')) || 400 : 400,
  },
  self: {
    isLoggedIn: false,
    profile: {
      err: null,
      isFetching: false,
      data: null,
    },
  },
  users: [],
};


text:
namespace language {

using testing::ElementsAre;
using Ld = LanguageModel::LanguageDetails;

constexpr static float kFloatEps = 0.00001f;

struct PrefRegistration {
  explicit PrefRegistration(user_prefs::PrefRegistrySyncable* registry) {
    language::LanguagePrefs::RegisterProfilePrefs(registry);
    translate::TranslatePrefs::RegisterProfilePrefs(registry);
  }
};

class FluentLanguageModelTest : public testing::Test {
 protected:
  FluentLanguageModelTest()
      : prefs_(new sync_preferences::TestingPrefServiceSyncable()),
        prefs_registration_(prefs_->registry()) {}

  std::unique_ptr<sync_preferences::TestingPrefServiceSyncable> prefs_;
  PrefRegistration prefs_registration_;
};

// Compares LanguageDetails.
MATCHER_P(EqualsLd, lang_details, "") {
  return arg.lang_code == lang_details.lang_code &&
         std::abs(arg.score - lang_details.score) < kFloatEps;
}

TEST_F(FluentLanguageModelTest, Defaults) {
  // By default, languages that are blocked from translation should match the
  // list of fluent languages. Note that when using default prefs, only the UI
  // language is returned as a blocked language.
  std::string default_locale_code = base::i18n::GetConfiguredLocale();
  // Blocked languages are stored in Translate format so some languages need to
  // be converted.
  ToTranslateLanguageSynonym(&default_locale_code);

  FluentLanguageModel model(prefs_.get());
  std::vector<Ld> languages = model.GetLanguages();

  EXPECT_EQ(size_t(1), languages.size());
  EXPECT_THAT(languages[0], EqualsLd(Ld(default_locale_code, 1.0)));
}

TEST_F(FluentLanguageModelTest, ThreeBlockedLanguages) {
  base::Value fluent_languages(base::Value::Type::LIST);
  fluent_languages.Append("fr");
  fluent_languages.Append("ja");
  fluent_languages.Append("en");
  prefs_->Set(translate::prefs::kBlockedLanguages, fluent_languages);

  FluentLanguageModel model(prefs_.get());
  EXPECT_THAT(model.GetLanguages(), ElementsAre(EqualsLd(Ld("fr", 1.0f / 1)),
                                                EqualsLd(Ld("ja", 1.0f / 2)),
                                                EqualsLd(Ld("en", 1.0f / 3))));
}

}  // namespace language


text:
The following people made this project possible. They did not make contributions
through git or GitHub so there is no official space in which they are
acknowledged automatically. I have taken the time to make sure that they are
acknowledged for their work because they deserve credit.

* **Kay Schwink:** proofreading
* **Arielle Ampeh:** proofreading


text:
//
// This code was auto-generated by AFNOR StoredProcedureSystem, version 1.0
//

using System.Runtime.Serialization;
using System;

namespace AnnuaireCertifies.Domaine
{
    public partial class EntiteDto
    {

        [DataMember]
        public long ID { get; set; }

        [DataMember]
        public Nullable<long> OrganismeID { get; set; }

        [DataMember]
        public string Code { get; set; }

        [DataMember]
        public string CodeEchange { get; set; }

        [DataMember]
        public string Description { get; set; }

        [DataMember]
        public bool Archive { get; set; }

        [DataMember]
        public Nullable<long> PersonneID { get; set; }
    }
}


text:
/*
 * Advent of Code 2016
 * Day 21 (part 2)
 *
 * Command: clang++ -std=c++14 day21b.cpp
 *
 */

#include <algorithm>
#include <cmath>
#include <fstream>
#include <iostream>
#include <iterator>
#include <sstream>
#include <string>
#include <vector>

using namespace std;

const string INPUT_FILE = "input21.txt";
const int MAX_LINE_LENGTH = 2000;
const string START_TEXT = "fbgdceah";

void split(const string &s, char delim, vector<string> &elems) {
	stringstream ss;
	ss.str(s);
	string item;
	while (getline(ss, item, delim)) {
		elems.push_back(item);
	}
}

vector<string> split(const string &s, char delim) {
	vector<string> elems;
	split(s, delim, elems);
	return elems;
}

string _swap(string input, int posX, int posY) {
	auto result = input;
	result[posX] = input[posY];
	result[posY] = input[posX];

	return result;
}

string _rotate(string input, int steps) {
	auto result = input;

	for (auto i = 0; i < abs(steps); i++) {
		if (steps >= 0) {
			rotate(begin(result), begin(result) + 1, end(result));
		} else {
			rotate(rbegin(result), rbegin(result) + 1, rend(result));
		}
	}

	return result;
}

string _reverse(string input, int posX, int posY) {
	auto result = input;
	reverse(begin(result) + posX, begin(result) + posY + 1);
	return result;
}

string _move(string input, int posX, int posY) {
	auto result = input;
	auto tempPos = posX;
	posX = posY;
	posY = tempPos;
	auto temp = string(1, input.at(posX));

	result.erase(posX, 1);
	result.insert(posY, temp);

	return result;
}

int main(void) {
	// Open the input file
	ifstream fin(INPUT_FILE);
	if (!fin) {
		cerr << "Error reading input file " << INPUT_FILE << endl;
		return -1;
	}

	// Read the input
	vector<string> input;
	char cInput[MAX_LINE_LENGTH];
	while (fin.getline(cInput, MAX_LINE_LENGTH)) {
		input.push_back(string(cInput));
	}
	fin.close();

	// Reverse the input since we're now un-scrambling
	reverse(begin(input), end(input));

	// Solve the problem
	auto answer = START_TEXT;
	for (auto line : input) {
		auto bits = split(line, ' ');

		if (bits[0] == "swap") {
			auto posX = 0;
			auto posY = 0;

			if (bits[1] == "position") {
				posX = stoi(bits[2]);
				posY = stoi(bits[5]);
			} else {
				posX = answer.find_first_of(bits[2][0]);
				posY = answer.find_first_of(bits[5][0]);
			}

			answer = _swap(answer, posX, posY);
		} else if (bits[0] == "rotate") {
			if (bits[1] == "based") {
				auto letterX = bits[6];
				auto pos = answer.find_first_of(letterX);
				auto steps = -1 * (1 + pos + (pos >= 4 ? 1 : 0));

				answer = _rotate(answer, steps);
			} else {
				auto steps = stoi(bits[2]);

				if (bits[1] == "left") {
					steps *= -1;
				}

				answer = _rotate(answer, steps);
			}
		} else if (bits[0] == "reverse") {
			auto posX = stoi(bits[2]);
			auto posY = stoi(bits[4]);

			answer = _reverse(answer, posX, posY);
		} else if (bits[0] == "move") {
			auto posX = stoi(bits[2]);
			auto posY = stoi(bits[5]);

			answer = _move(answer, posX, posY);
		} else {
			cerr << "error: cannot understand instruction \"" << line << "\"" << endl;
			return 1;
		}
	}

	cout << "Password: " << answer << endl;

	return 0;
}


text:
require 'delocalize/localized_date_time_parser'

Date.class_eval do
  class << self
    def parse_localized(date)
      Delocalize::LocalizedDateTimeParser.parse(date, self)
    end
  end
end


text:
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.model.search;

import com.intellij.model.Symbol;
import com.intellij.model.psi.PsiSymbolDeclaration;

/**
 * Convenience interface for searchers providing additional queries to find {@link PsiSymbolDeclaration}s by {@link Symbol}.
 */
public interface PsiSymbolDeclarationSearcher extends Searcher<PsiSymbolDeclarationSearchParameters, PsiSymbolDeclaration> {
}


text:
=pod

=head1 NAME

DSA_do_sign, DSA_do_verify - raw DSA signature operations

=head1 SYNOPSIS

 #include <openssl/dsa.h>

 DSA_SIG *DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa);

 int DSA_do_verify(const unsigned char *dgst, int dgst_len,
	     DSA_SIG *sig, DSA *dsa);

=head1 DESCRIPTION

DSA_do_sign() computes a digital signature on the B<len> byte message
digest B<dgst> using the private key B<dsa> and returns it in a
newly allocated B<DSA_SIG> structure.

L<DSA_sign_setup(3)|DSA_sign_setup(3)> may be used to precompute part
of the signing operation in case signature generation is
time-critical.

DSA_do_verify() verifies that the signature B<sig> matches a given
message digest B<dgst> of size B<len>.  B<dsa> is the signer's public
key.

=head1 RETURN VALUES

DSA_do_sign() returns the signature, NULL on error.  DSA_do_verify()
returns 1 for a valid signature, 0 for an incorrect signature and -1
on error. The error codes can be obtained by
L<ERR_get_error(3)|ERR_get_error(3)>.

=head1 SEE ALSO

L<dsa(3)|dsa(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, L<rand(3)|rand(3)>,
L<DSA_SIG_new(3)|DSA_SIG_new(3)>,
L<DSA_sign(3)|DSA_sign(3)>

=head1 HISTORY

DSA_do_sign() and DSA_do_verify() were added in OpenSSL 0.9.3.

=cut


text:
Made At Penn
==============

Made At Penn is a showcase for startups and projects created by Penn students
and alumni. Originally intended as a place to submit open source projects
created at Penn, it is now open to the wider CS community to submit projects and
startups that they are proud of.

## Development

1. Install Node.js and MongoDB
2. Install dependencies with `npm install`
3. Create a `.env` file using the `sample.env` as a template and fill in with
   appropriate values.
4. Run the app with `node app.js`

TODO
----

- [ ] Design
- [ ] Better auto-complete for tagging
- [ ] Image uploading
- [ ] Approval section


text:
Suspicion
----------
Suspicion is a property-based testing library for Go.

Property testing?
=================

Property-based testing uses random generation of data to find edge cases that violate some property.

An example is a simple sort function

```
func sortFloats(f []float64) {
	sort.Slice(f, func(i, j int) bool {
		return f[i] < f[j]
	})
}
```

After this function has been called and our implementation is correct, you can assume the property `f[i] <= f[i+1]`

With Suspicion, you can write a short test that verifies this property

```
func TestSort(t *testing.T) {
	s := suss.NewTest(t)
	s.Run(func() {
		var f []float64
		s.Slice().Gen(func() {
			n := s.Float64()
			f = append(f, n)
		})
		sortFloats(f)
		for i := 0; i < len(f)-1; i++ {
			if f[i] > f[i+1] {
				s.Fatalf("invalid sort len=%v, %v\n", len(f), f)
			}
		}
	})

```

Suspicion not only finds a counter example, but also tries to find a minimal example.

```
invalid sort len=13, [NaN 0 0 0 0 4.394777251413336e+230 0 0 0 0 0 0 0]
--- FAIL: TestSort (0.02s)
```

In this case, we find that a 13 length slice with a NaN and a non-zero value results in a invalid sort. Note that this condition doesn't fail with a 12 length array. Go uses a different sort algorithm for smaller slices and because of the float comparisons involved, it sorts NaNs at the end of the slice.

Suspicion is heavily influenced by the python library Hypothesis. [Their website](http://hypothesis.works/) has a lot of useful information on what property-based testing is and how to use it effectively.


text:
const mongoose = require('mongoose');
const Schema = mongoose.Schema;

const topicSchema = new Schema({
  title: {
    type: String,
    required: true
  },
  color: {
    type: String
  }
});

module.exports = mongoose.model('Topic', topicSchema);


text:
#include <linux/wait.h>

#include <drm/drm_atomic.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_crtc_helper.h>
#include <drm/drm_fb_helper.h>

#include "omap_dmm_tiler.h"
#include "omap_drv.h"

#define DRIVER_NAME		MODULE_NAME
#define DRIVER_DESC		"OMAP DRM"
#define DRIVER_DATE		"20110917"
#define DRIVER_MAJOR		1
#define DRIVER_MINOR		0
#define DRIVER_PATCHLEVEL	0

static int num_crtc = CONFIG_DRM_OMAP_NUM_CRTCS;

MODULE_PARM_DESC(num_crtc, "Number of overlays to use as CRTCs");
module_param(num_crtc, int, 0600);

/*
 * mode config funcs
 */

/* Notes about mapping DSS and DRM entities:
 *    CRTC:        overlay
 *    encoder:     manager.. with some extension to allow one primary CRTC
 *                 and zero or more video CRTC's to be mapped to one encoder?
 *    connector:   dssdev.. manager can be attached/detached from different
 *                 devices
 */

static void omap_fb_output_poll_changed(struct drm_device *dev)
{
	struct omap_drm_private *priv = dev->dev_private;
	DBG("dev=%p", dev);
	if (priv->fbdev)
		drm_fb_helper_hotplug_event(priv->fbdev);
}

struct omap_atomic_state_commit {
	struct work_struct work;
	struct drm_device *dev;
	struct drm_atomic_state *state;
	u32 crtcs;
};

static void omap_atomic_wait_for_completion(struct drm_device *dev,
					    struct drm_atomic_state *old_state)
{
	struct drm_crtc_state *old_crtc_state;
	struct drm_crtc *crtc;
	unsigned int i;
	int ret;

	for_each_crtc_in_state(old_state, crtc, old_crtc_state, i) {
		if (!crtc->state->enable)
			continue;

		ret = omap_crtc_wait_pending(crtc);

		if (!ret)
			dev_warn(dev->dev,
				 "atomic complete timeout (pipe %u)!\n", i);
	}
}

static void omap_atomic_complete(struct omap_atomic_state_commit *commit)
{
	struct drm_device *dev = commit->dev;
	struct omap_drm_private *priv = dev->dev_private;
	struct drm_atomic_state *old_state = commit->state;

	/* Apply the atomic update. */
	dispc_runtime_get();

	drm_atomic_helper_commit_modeset_disables(dev, old_state);
	drm_atomic_helper_commit_planes(dev, old_state);
	drm_atomic_helper_commit_modeset_enables(dev, old_state);

	omap_atomic_wait_for_completion(dev, old_state);

	drm_atomic_helper_cleanup_planes(dev, old_state);

	dispc_runtime_put();

	drm_atomic_state_free(old_state);

	/* Complete the commit, wake up any waiter. */
	spin_lock(&priv->commit.lock);
	priv->commit.pending &= ~commit->crtcs;
	spin_unlock(&priv->commit.lock);

	wake_up_all(&priv->commit.wait);

	kfree(commit);
}

static void omap_atomic_work(struct work_struct *work)
{
	struct omap_atomic_state_commit *commit =
		container_of(work, struct omap_atomic_state_commit, work);

	omap_atomic_complete(commit);
}

static bool omap_atomic_is_pending(struct omap_drm_private *priv,
				   struct omap_atomic_state_commit *commit)
{
	bool pending;

	spin_lock(&priv->commit.lock);
	pending = priv->commit.pending & commit->crtcs;
	spin_unlock(&priv->commit.lock);

	return pending;
}

static int omap_atomic_commit(struct drm_device *dev,
			      struct drm_atomic_state *state, bool async)
{
	struct omap_drm_private *priv = dev->dev_private;
	struct omap_atomic_state_commit *commit;
	unsigned long flags;
	unsigned int i;
	int ret;

	ret = drm_atomic_helper_prepare_planes(dev, state);
	if (ret)
		return ret;

	/* Allocate the commit object. */
	commit = kzalloc(sizeof(*commit), GFP_KERNEL);
	if (commit == NULL) {
		ret = -ENOMEM;
		goto error;
	}

	INIT_WORK(&commit->work, omap_atomic_work);
	commit->dev = dev;
	commit->state = state;

	/* Wait until all affected CRTCs have completed previous commits and
	 * mark them as pending.
	 */
	for (i = 0; i < dev->mode_config.num_crtc; ++i) {
		if (state->crtcs[i])
			commit->crtcs |= 1 << drm_crtc_index(state->crtcs[i]);
	}

	wait_event(priv->commit.wait, !omap_atomic_is_pending(priv, commit));

	spin_lock(&priv->commit.lock);
	priv->commit.pending |= commit->crtcs;
	spin_unlock(&priv->commit.lock);

	/* Keep track of all CRTC events to unlink them in preclose(). */
	spin_lock_irqsave(&dev->event_lock, flags);
	for (i = 0; i < dev->mode_config.num_crtc; ++i) {
		struct drm_crtc_state *cstate = state->crtc_states[i];

		if (cstate && cstate->event)
			list_add_tail(&cstate->event->base.link,
				      &priv->commit.events);
	}
	spin_unlock_irqrestore(&dev->event_lock, flags);

	/* Swap the state, this is the point of no return. */
	drm_atomic_helper_swap_state(dev, state);

	if (async)
		schedule_work(&commit->work);
	else
		omap_atomic_complete(commit);

	return 0;

error:
	drm_atomic_helper_cleanup_planes(dev, state);
	return ret;
}

static const struct drm_mode_config_funcs omap_mode_config_funcs = {
	.fb_create = omap_framebuffer_create,
	.output_poll_changed = omap_fb_output_poll_changed,
	.atomic_check = drm_atomic_helper_check,
	.atomic_commit = omap_atomic_commit,
};

static int get_connector_type(struct omap_dss_device *dssdev)
{
	switch (dssdev->type) {
	case OMAP_DISPLAY_TYPE_HDMI:
		return DRM_MODE_CONNECTOR_HDMIA;
	case OMAP_DISPLAY_TYPE_DVI:
		return DRM_MODE_CONNECTOR_DVID;
	default:
		return DRM_MODE_CONNECTOR_Unknown;
	}
}

static bool channel_used(struct drm_device *dev, enum omap_channel channel)
{
	struct omap_drm_private *priv = dev->dev_private;
	int i;

	for (i = 0; i < priv->num_crtcs; i++) {
		struct drm_crtc *crtc = priv->crtcs[i];

		if (omap_crtc_channel(crtc) == channel)
			return true;
	}

	return false;
}
static void omap_disconnect_dssdevs(void)
{
	struct omap_dss_device *dssdev = NULL;

	for_each_dss_dev(dssdev)
		dssdev->driver->disconnect(dssdev);
}

static int omap_connect_dssdevs(void)
{
	int r;
	struct omap_dss_device *dssdev = NULL;
	bool no_displays = true;

	for_each_dss_dev(dssdev) {
		r = dssdev->driver->connect(dssdev);
		if (r == -EPROBE_DEFER) {
			omap_dss_put_device(dssdev);
			goto cleanup;
		} else if (r) {
			dev_warn(dssdev->dev, "could not connect display: %s\n",
				dssdev->name);
		} else {
			no_displays = false;
		}
	}

	if (no_displays)
		return -EPROBE_DEFER;

	return 0;

cleanup:
	/*
	 * if we are deferring probe, we disconnect the devices we previously
	 * connected
	 */
	omap_disconnect_dssdevs();

	return r;
}

static int omap_modeset_create_crtc(struct drm_device *dev, int id,
				    enum omap_channel channel)
{
	struct omap_drm_private *priv = dev->dev_private;
	struct drm_plane *plane;
	struct drm_crtc *crtc;

	plane = omap_plane_init(dev, id, DRM_PLANE_TYPE_PRIMARY);
	if (IS_ERR(plane))
		return PTR_ERR(plane);

	crtc = omap_crtc_init(dev, plane, channel, id);

	BUG_ON(priv->num_crtcs >= ARRAY_SIZE(priv->crtcs));
	priv->crtcs[id] = crtc;
	priv->num_crtcs++;

	priv->planes[id] = plane;
	priv->num_planes++;

	return 0;
}

static int omap_modeset_init_properties(struct drm_device *dev)
{
	struct omap_drm_private *priv = dev->dev_private;

	if (priv->has_dmm) {
		dev->mode_config.rotation_property =
			drm_mode_create_rotation_property(dev,
				BIT(DRM_ROTATE_0) | BIT(DRM_ROTATE_90) |
				BIT(DRM_ROTATE_180) | BIT(DRM_ROTATE_270) |
				BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y));
		if (!dev->mode_config.rotation_property)
			return -ENOMEM;
	}

	priv->zorder_prop = drm_property_create_range(dev, 0, "zorder", 0, 3);
	if (!priv->zorder_prop)
		return -ENOMEM;

	return 0;
}

static int omap_modeset_init(struct drm_device *dev)
{
	struct omap_drm_private *priv = dev->dev_private;
	struct omap_dss_device *dssdev = NULL;
	int num_ovls = dss_feat_get_num_ovls();
	int num_mgrs = dss_feat_get_num_mgrs();
	int num_crtcs;
	int i, id = 0;
	int ret;

	drm_mode_config_init(dev);

	omap_drm_irq_install(dev);

	ret = omap_modeset_init_properties(dev);
	if (ret < 0)
		return ret;

	/*
	 * We usually don't want to create a CRTC for each manager, at least
	 * not until we have a way to expose private planes to userspace.
	 * Otherwise there would not be enough video pipes left for drm planes.
	 * We use the num_crtc argument to limit the number of crtcs we create.
	 */
	num_crtcs = min3(num_crtc, num_mgrs, num_ovls);

	dssdev = NULL;

	for_each_dss_dev(dssdev) {
		struct drm_connector *connector;
		struct drm_encoder *encoder;
		enum omap_channel channel;
		struct omap_overlay_manager *mgr;

		if (!omapdss_device_is_connected(dssdev))
			continue;

		encoder = omap_encoder_init(dev, dssdev);

		if (!encoder) {
			dev_err(dev->dev, "could not create encoder: %s\n",
					dssdev->name);
			return -ENOMEM;
		}

		connector = omap_connector_init(dev,
				get_connector_type(dssdev), dssdev, encoder);

		if (!connector) {
			dev_err(dev->dev, "could not create connector: %s\n",
					dssdev->name);
			return -ENOMEM;
		}

		BUG_ON(priv->num_encoders >= ARRAY_SIZE(priv->encoders));
		BUG_ON(priv->num_connectors >= ARRAY_SIZE(priv->connectors));

		priv->encoders[priv->num_encoders++] = encoder;
		priv->connectors[priv->num_connectors++] = connector;

		drm_mode_connector_attach_encoder(connector, encoder);

		/*
		 * if we have reached the limit of the crtcs we are allowed to
		 * create, let's not try to look for a crtc for this
		 * panel/encoder and onwards, we will, of course, populate the
		 * the possible_crtcs field for all the encoders with the final
		 * set of crtcs we create
		 */
		if (id == num_crtcs)
			continue;

		/*
		 * get the recommended DISPC channel for this encoder. For now,
		 * we only try to get create a crtc out of the recommended, the
		 * other possible channels to which the encoder can connect are
		 * not considered.
		 */

		mgr = omapdss_find_mgr_from_display(dssdev);
		channel = mgr->id;
		/*
		 * if this channel hasn't already been taken by a previously
		 * allocated crtc, we create a new crtc for it
		 */
		if (!channel_used(dev, channel)) {
			ret = omap_modeset_create_crtc(dev, id, channel);
			if (ret < 0) {
				dev_err(dev->dev,
					"could not create CRTC (channel %u)\n",
					channel);
				return ret;
			}

			id++;
		}
	}

	/*
	 * we have allocated crtcs according to the need of the panels/encoders,
	 * adding more crtcs here if needed
	 */
	for (; id < num_crtcs; id++) {

		/* find a free manager for this crtc */
		for (i = 0; i < num_mgrs; i++) {
			if (!channel_used(dev, i))
				break;
		}

		if (i == num_mgrs) {
			/* this shouldn't really happen */
			dev_err(dev->dev, "no managers left for crtc\n");
			return -ENOMEM;
		}

		ret = omap_modeset_create_crtc(dev, id, i);
		if (ret < 0) {
			dev_err(dev->dev,
				"could not create CRTC (channel %u)\n", i);
			return ret;
		}
	}

	/*
	 * Create normal planes for the remaining overlays:
	 */
	for (; id < num_ovls; id++) {
		struct drm_plane *plane;

		plane = omap_plane_init(dev, id, DRM_PLANE_TYPE_OVERLAY);
		if (IS_ERR(plane))
			return PTR_ERR(plane);

		BUG_ON(priv->num_planes >= ARRAY_SIZE(priv->planes));
		priv->planes[priv->num_planes++] = plane;
	}

	for (i = 0; i < priv->num_encoders; i++) {
		struct drm_encoder *encoder = priv->encoders[i];
		struct omap_dss_device *dssdev =
					omap_encoder_get_dssdev(encoder);
		struct omap_dss_device *output;

		output = omapdss_find_output_from_display(dssdev);

		/* figure out which crtc's we can connect the encoder to: */
		encoder->possible_crtcs = 0;
		for (id = 0; id < priv->num_crtcs; id++) {
			struct drm_crtc *crtc = priv->crtcs[id];
			enum omap_channel crtc_channel;

			crtc_channel = omap_crtc_channel(crtc);

			if (output->dispc_channel == crtc_channel) {
				encoder->possible_crtcs |= (1 << id);
				break;
			}
		}

		omap_dss_put_device(output);
	}

	DBG("registered %d planes, %d crtcs, %d encoders and %d connectors\n",
		priv->num_planes, priv->num_crtcs, priv->num_encoders,
		priv->num_connectors);

	dev->mode_config.min_width = 32;
	dev->mode_config.min_height = 32;

	/* note: eventually will need some cpu_is_omapXYZ() type stuff here
	 * to fill in these limits properly on different OMAP generations..
	 */
	dev->mode_config.max_width = 2048;
	dev->mode_config.max_height = 2048;

	dev->mode_config.funcs = &omap_mode_config_funcs;

	drm_mode_config_reset(dev);

	return 0;
}

static void omap_modeset_free(struct drm_device *dev)
{
	drm_mode_config_cleanup(dev);
}

/*
 * drm ioctl funcs
 */

static int ioctl_get_param(struct drm_device *dev, void *data,
		struct drm_file *file_priv)
{
	struct omap_drm_private *priv = dev->dev_private;
	struct drm_omap_param *args = data;

	DBG("%p: param=%llu", dev, args->param);

	switch (args->param) {
	case OMAP_PARAM_CHIPSET_ID:
		args->value = priv->omaprev;
		break;
	default:
		DBG("unknown parameter %lld", args->param);
		return -EINVAL;
	}

	return 0;
}

static int ioctl_set_param(struct drm_device *dev, void *data,
		struct drm_file *file_priv)
{
	struct drm_omap_param *args = data;

	switch (args->param) {
	default:
		DBG("unknown parameter %lld", args->param);
		return -EINVAL;
	}

	return 0;
}

static int ioctl_gem_new(struct drm_device *dev, void *data,
		struct drm_file *file_priv)
{
	struct drm_omap_gem_new *args = data;
	VERB("%p:%p: size=0x%08x, flags=%08x", dev, file_priv,
			args->size.bytes, args->flags);
	return omap_gem_new_handle(dev, file_priv, args->size,
			args->flags, &args->handle);
}

static int ioctl_gem_cpu_prep(struct drm_device *dev, void *data,
		struct drm_file *file_priv)
{
	struct drm_omap_gem_cpu_prep *args = data;
	struct drm_gem_object *obj;
	int ret;

	VERB("%p:%p: handle=%d, op=%x", dev, file_priv, args->handle, args->op);

	obj = drm_gem_object_lookup(dev, file_priv, args->handle);
	if (!obj)
		return -ENOENT;

	ret = omap_gem_op_sync(obj, args->op);

	if (!ret)
		ret = omap_gem_op_start(obj, args->op);

	drm_gem_object_unreference_unlocked(obj);

	return ret;
}

static int ioctl_gem_cpu_fini(struct drm_device *dev, void *data,
		struct drm_file *file_priv)
{
	struct drm_omap_gem_cpu_fini *args = data;
	struct drm_gem_object *obj;
	int ret;

	VERB("%p:%p: handle=%d", dev, file_priv, args->handle);

	obj = drm_gem_object_lookup(dev, file_priv, args->handle);
	if (!obj)
		return -ENOENT;

	/* XXX flushy, flushy */
	ret = 0;

	if (!ret)
		ret = omap_gem_op_finish(obj, args->op);

	drm_gem_object_unreference_unlocked(obj);

	return ret;
}

static int ioctl_gem_info(struct drm_device *dev, void *data,
		struct drm_file *file_priv)
{
	struct drm_omap_gem_info *args = data;
	struct drm_gem_object *obj;
	int ret = 0;

	VERB("%p:%p: handle=%d", dev, file_priv, args->handle);

	obj = drm_gem_object_lookup(dev, file_priv, args->handle);
	if (!obj)
		return -ENOENT;

	args->size = omap_gem_mmap_size(obj);
	args->offset = omap_gem_mmap_offset(obj);

	drm_gem_object_unreference_unlocked(obj);

	return ret;
}

static const struct drm_ioctl_desc ioctls[DRM_COMMAND_END - DRM_COMMAND_BASE] = {
	DRM_IOCTL_DEF_DRV(OMAP_GET_PARAM, ioctl_get_param, DRM_UNLOCKED|DRM_AUTH),
	DRM_IOCTL_DEF_DRV(OMAP_SET_PARAM, ioctl_set_param, DRM_UNLOCKED|DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
	DRM_IOCTL_DEF_DRV(OMAP_GEM_NEW, ioctl_gem_new, DRM_UNLOCKED|DRM_AUTH),
	DRM_IOCTL_DEF_DRV(OMAP_GEM_CPU_PREP, ioctl_gem_cpu_prep, DRM_UNLOCKED|DRM_AUTH),
	DRM_IOCTL_DEF_DRV(OMAP_GEM_CPU_FINI, ioctl_gem_cpu_fini, DRM_UNLOCKED|DRM_AUTH),
	DRM_IOCTL_DEF_DRV(OMAP_GEM_INFO, ioctl_gem_info, DRM_UNLOCKED|DRM_AUTH),
};

/*
 * drm driver funcs
 */

/**
 * load - setup chip and create an initial config
 * @dev: DRM device
 * @flags: startup flags
 *
 * The driver load routine has to do several things:
 *   - initialize the memory manager
 *   - allocate initial config memory
 *   - setup the DRM framebuffer with the allocated memory
 */
static int dev_load(struct drm_device *dev, unsigned long flags)
{
	struct omap_drm_platform_data *pdata = dev->dev->platform_data;
	struct omap_drm_private *priv;
	unsigned int i;
	int ret;

	DBG("load: dev=%p", dev);

	priv = kzalloc(sizeof(*priv), GFP_KERNEL);
	if (!priv)
		return -ENOMEM;

	priv->omaprev = pdata->omaprev;

	dev->dev_private = priv;

	priv->wq = alloc_ordered_workqueue("omapdrm", 0);
	init_waitqueue_head(&priv->commit.wait);
	spin_lock_init(&priv->commit.lock);
	INIT_LIST_HEAD(&priv->commit.events);

	spin_lock_init(&priv->list_lock);
	INIT_LIST_HEAD(&priv->obj_list);

	omap_gem_init(dev);

	ret = omap_modeset_init(dev);
	if (ret) {
		dev_err(dev->dev, "omap_modeset_init failed: ret=%d\n", ret);
		dev->dev_private = NULL;
		kfree(priv);
		return ret;
	}

	/* Initialize vblank handling, start with all CRTCs disabled. */
	ret = drm_vblank_init(dev, priv->num_crtcs);
	if (ret)
		dev_warn(dev->dev, "could not init vblank\n");

	for (i = 0; i < priv->num_crtcs; i++)
		drm_crtc_vblank_off(priv->crtcs[i]);

	priv->fbdev = omap_fbdev_init(dev);
	if (!priv->fbdev) {
		dev_warn(dev->dev, "omap_fbdev_init failed\n");
		/* well, limp along without an fbdev.. maybe X11 will work? */
	}

	/* store off drm_device for use in pm ops */
	dev_set_drvdata(dev->dev, dev);

	drm_kms_helper_poll_init(dev);

	return 0;
}

static int dev_unload(struct drm_device *dev)
{
	struct omap_drm_private *priv = dev->dev_private;

	DBG("unload: dev=%p", dev);

	drm_kms_helper_poll_fini(dev);

	if (priv->fbdev)
		omap_fbdev_free(dev);

	omap_modeset_free(dev);
	omap_gem_deinit(dev);

	destroy_workqueue(priv->wq);

	drm_vblank_cleanup(dev);
	omap_drm_irq_uninstall(dev);

	kfree(dev->dev_private);
	dev->dev_private = NULL;

	dev_set_drvdata(dev->dev, NULL);

	return 0;
}

static int dev_open(struct drm_device *dev, struct drm_file *file)
{
	file->driver_priv = NULL;

	DBG("open: dev=%p, file=%p", dev, file);

	return 0;
}

/**
 * lastclose - clean up after all DRM clients have exited
 * @dev: DRM device
 *
 * Take care of cleaning up after all DRM clients have exited.  In the
 * mode setting case, we want to restore the kernel's initial mode (just
 * in case the last client left us in a bad state).
 */
static void dev_lastclose(struct drm_device *dev)
{
	int i;

	/* we don't support vga-switcheroo.. so just make sure the fbdev
	 * mode is active
	 */
	struct omap_drm_private *priv = dev->dev_private;
	int ret;

	DBG("lastclose: dev=%p", dev);

	if (dev->mode_config.rotation_property) {
		/* need to restore default rotation state.. not sure
		 * if there is a cleaner way to restore properties to
		 * default state?  Maybe a flag that properties should
		 * automatically be restored to default state on
		 * lastclose?
		 */
		for (i = 0; i < priv->num_crtcs; i++) {
			drm_object_property_set_value(&priv->crtcs[i]->base,
					dev->mode_config.rotation_property, 0);
		}

		for (i = 0; i < priv->num_planes; i++) {
			drm_object_property_set_value(&priv->planes[i]->base,
					dev->mode_config.rotation_property, 0);
		}
	}

	if (priv->fbdev) {
		ret = drm_fb_helper_restore_fbdev_mode_unlocked(priv->fbdev);
		if (ret)
			DBG("failed to restore crtc mode");
	}
}

static void dev_preclose(struct drm_device *dev, struct drm_file *file)
{
	struct omap_drm_private *priv = dev->dev_private;
	struct drm_pending_event *event;
	unsigned long flags;

	DBG("preclose: dev=%p", dev);

	/*
	 * Unlink all pending CRTC events to make sure they won't be queued up
	 * by a pending asynchronous commit.
	 */
	spin_lock_irqsave(&dev->event_lock, flags);
	list_for_each_entry(event, &priv->commit.events, link) {
		if (event->file_priv == file) {
			file->event_space += event->event->length;
			event->file_priv = NULL;
		}
	}
	spin_unlock_irqrestore(&dev->event_lock, flags);
}

static void dev_postclose(struct drm_device *dev, struct drm_file *file)
{
	DBG("postclose: dev=%p, file=%p", dev, file);
}

static const struct vm_operations_struct omap_gem_vm_ops = {
	.fault = omap_gem_fault,
	.open = drm_gem_vm_open,
	.close = drm_gem_vm_close,
};

static const struct file_operations omapdriver_fops = {
	.owner = THIS_MODULE,
	.open = drm_open,
	.unlocked_ioctl = drm_ioctl,
	.release = drm_release,
	.mmap = omap_gem_mmap,
	.poll = drm_poll,
	.read = drm_read,
	.llseek = noop_llseek,
};

static struct drm_driver omap_drm_driver = {
	.driver_features = DRIVER_MODESET | DRIVER_GEM  | DRIVER_PRIME,
	.load = dev_load,
	.unload = dev_unload,
	.open = dev_open,
	.lastclose = dev_lastclose,
	.preclose = dev_preclose,
	.postclose = dev_postclose,
	.set_busid = drm_platform_set_busid,
	.get_vblank_counter = drm_vblank_count,
	.enable_vblank = omap_irq_enable_vblank,
	.disable_vblank = omap_irq_disable_vblank,
#ifdef CONFIG_DEBUG_FS
	.debugfs_init = omap_debugfs_init,
	.debugfs_cleanup = omap_debugfs_cleanup,
#endif
	.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
	.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
	.gem_prime_export = omap_gem_prime_export,
	.gem_prime_import = omap_gem_prime_import,
	.gem_free_object = omap_gem_free_object,
	.gem_vm_ops = &omap_gem_vm_ops,
	.dumb_create = omap_gem_dumb_create,
	.dumb_map_offset = omap_gem_dumb_map_offset,
	.dumb_destroy = drm_gem_dumb_destroy,
	.ioctls = ioctls,
	.num_ioctls = DRM_OMAP_NUM_IOCTLS,
	.fops = &omapdriver_fops,
	.name = DRIVER_NAME,
	.desc = DRIVER_DESC,
	.date = DRIVER_DATE,
	.major = DRIVER_MAJOR,
	.minor = DRIVER_MINOR,
	.patchlevel = DRIVER_PATCHLEVEL,
};

static int pdev_probe(struct platform_device *device)
{
	int r;

	if (omapdss_is_initialized() == false)
		return -EPROBE_DEFER;

	omap_crtc_pre_init();

	r = omap_connect_dssdevs();
	if (r) {
		omap_crtc_pre_uninit();
		return r;
	}

	DBG("%s", device->name);
	return drm_platform_init(&omap_drm_driver, device);
}

static int pdev_remove(struct platform_device *device)
{
	DBG("");

	drm_put_dev(platform_get_drvdata(device));

	omap_disconnect_dssdevs();
	omap_crtc_pre_uninit();

	return 0;
}

#ifdef CONFIG_PM_SLEEP
static int omap_drm_suspend(struct device *dev)
{
	struct drm_device *drm_dev = dev_get_drvdata(dev);

	drm_kms_helper_poll_disable(drm_dev);

	return 0;
}

static int omap_drm_resume(struct device *dev)
{
	struct drm_device *drm_dev = dev_get_drvdata(dev);

	drm_kms_helper_poll_enable(drm_dev);

	return omap_gem_resume(dev);
}
#endif

static SIMPLE_DEV_PM_OPS(omapdrm_pm_ops, omap_drm_suspend, omap_drm_resume);

static struct platform_driver pdev = {
	.driver = {
		.name = DRIVER_NAME,
		.pm = &omapdrm_pm_ops,
	},
	.probe = pdev_probe,
	.remove = pdev_remove,
};

static int __init omap_drm_init(void)
{
	int r;

	DBG("init");

	r = platform_driver_register(&omap_dmm_driver);
	if (r) {
		pr_err("DMM driver registration failed\n");
		return r;
	}

	r = platform_driver_register(&pdev);
	if (r) {
		pr_err("omapdrm driver registration failed\n");
		platform_driver_unregister(&omap_dmm_driver);
		return r;
	}

	return 0;
}

static void __exit omap_drm_fini(void)
{
	DBG("fini");

	platform_driver_unregister(&pdev);

	platform_driver_unregister(&omap_dmm_driver);
}

/* need late_initcall() so we load after dss_driver's are loaded */
late_initcall(omap_drm_init);
module_exit(omap_drm_fini);

MODULE_AUTHOR("Rob Clark <rob@ti.com>");
MODULE_DESCRIPTION("OMAP DRM Display Driver");
MODULE_ALIAS("platform:" DRIVER_NAME);
MODULE_LICENSE("GPL v2");


text:
package org.opencb.biodata.models.variation;

import org.opencb.biodata.models.protein.ProteinFeature;
import org.opencb.biodata.models.variant.annotation.Score;

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

/**
 * Created by fjlopez on 18/09/15.
 */
public class ProteinVariantAnnotation {

    private String uniprotAccession;
    private String uniprotName;
    private int position;
    private String reference;
    private String alternate;
    private String uniprotVariantId;
    private String functionalDescription;
    private List<Score> substitutionScores = null;
    private List<String> keywords;
    private List<ProteinFeature> features;

    public ProteinVariantAnnotation() {
    }

    public ProteinVariantAnnotation(int aaPosition, String aaReference, String aaAlternate,
                                    List<Score> substitutionScores) {
        this(null, null, aaPosition, aaReference, aaAlternate, null, null, substitutionScores, null, null);

    }

    public ProteinVariantAnnotation(String uniprotAccession, String uniprotName, int position, String reference,
                                    String alternate, String uniprotVariantId, String functionalDescription,
                                    List<Score> substitutionScores, List<String> keywords,
                                    List<ProteinFeature> features) {
        this.uniprotAccession = uniprotAccession;
        this.uniprotName = uniprotName;
        this.position = position;
        this.reference = reference;
        this.alternate = alternate;
        this.uniprotVariantId = uniprotVariantId;
        this.functionalDescription = functionalDescription;
        this.substitutionScores = substitutionScores;
        this.keywords = keywords;
        this.features = features;
    }

    public String getUniprotAccession() {
        return uniprotAccession;
    }

    public void setUniprotAccession(String uniprotAccession) {
        this.uniprotAccession = uniprotAccession;
    }

    public String getUniprotName() {
        return uniprotName;
    }

    public void setUniprotName(String uniprotName) {
        this.uniprotName = uniprotName;
    }

    public int getPosition() {
        return position;
    }

    public void setPosition(int position) {
        this.position = position;
    }

    public String getReference() {
        return reference;
    }

    public void setReference(String reference) {
        this.reference = reference;
    }

    public String getAlternate() {
        return alternate;
    }

    public void setAlternate(String alternate) {
        this.alternate = alternate;
    }

    public String getUniprotVariantId() {
        return uniprotVariantId;
    }

    public void setUniprotVariantId(String uniprotVariantId) {
        this.uniprotVariantId = uniprotVariantId;
    }

    public String getFunctionalDescription() {
        return functionalDescription;
    }

    public void setFunctionalDescription(String functionalDescription) {
        this.functionalDescription = functionalDescription;
    }

    public List<Score> getSubstitutionScores() {
        return substitutionScores;
    }

    public void setSubstitutionScores(List<Score> substitutionScores) {
        this.substitutionScores = substitutionScores;
    }

    public void addSubstitutionScore(Score score) {
        if (this.substitutionScores == null) {
            substitutionScores = new ArrayList<>();
        }
        substitutionScores.add(score);
    }

    public List<String> getKeywords() {
        return keywords;
    }

    public void setKeywords(List<String> keywords) {
        this.keywords = keywords;
    }

    public void addUniprotKeyword(String keyword) {
        if (keywords == null) {
            keywords = new ArrayList<>();
        }
        keywords.add(keyword);
    }

    public List<ProteinFeature> getFeatures() {
        return features;
    }

    public void setFeatures(List<ProteinFeature> features) {
        this.features = features;
    }

    public void addProteinFeature(ProteinFeature proteinFeature) {
        if(features ==null) {
            features = new ArrayList<>();
        }
        features.add(proteinFeature);
    }
}


text:
package com.osp.base.controller;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONObject;
import com.osp.base.entity.ResultModel;
import com.osp.base.service.UserService;
import com.osp.base.system.OSPResource;

import jodd.util.StringUtil;

@Controller
@Scope("prototype")
@RequestMapping("/user")
public class UserController extends BaseController {
	@Resource
	private UserService userService;

	/**
	 * 系统登录
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value="/login", method=RequestMethod.POST, produces=CONTENT_TYPE_JSON)
	@ResponseBody
	public String login() {
		String account = this.getParamMap().get("account");
		String password = this.getParamMap().get("password");
		ResultModel rm = userService.login(account, password);
		return rm.toString();
	}

	@RequestMapping(value={"/listall", "/listall/{id}"}, method=RequestMethod.GET)
	@ResponseBody
	public String findUser(@PathVariable(value="id", required=false) String id) throws Exception {
		JSONObject obj = this.ospCache.getCacheMap().get(OSPResource.OSP_CACHE_USER);
		if(StringUtil.isEmpty(id)) {
			return this.returnJSON(true, "OK", obj);
		}else {
			return this.returnJSON(true, "OK", obj.get(id));
		}
	}

	@RequestMapping(value={"/code", "/code/{type}", "/code/{type}/{item}"}, method=RequestMethod.GET)
	@ResponseBody
	public String findCode(@PathVariable(value="type", required=false) String type, @PathVariable(value="item", required=false) String item) throws Exception {
		JSONObject obj = this.ospCache.getCacheMap().get(OSPResource.OSP_CACHE_CODE);
		if(StringUtil.isAllEmpty(type, item)) {
			return this.returnJSON(true, "OK", obj);
		}else if(StringUtil.isEmpty(item)) {
			return this.returnJSON(true, "OK", obj.get(type));
		}else {
			return this.returnJSON(true, "OK", ((JSONObject)obj.get(type)).get(item));
		}
	}

}


text:
Extra projects and web inspiration.

My sandbox !


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0"></meta>

API Policies

Here is a list of all Policies defined for this API.  These Policies will be applied to all invocations of this API by any Client App, regardless of the Plan used in its Contract.

              Add Policy

 0">

It looks like there aren't any policies defined! That may be exactly what you want (of course) but if not, you may try defining one using the Add Policy button above...

              <apiman-policy-list ng-model="policies"
                                  remove-function="removePolicy"
                                  reorder-function="reorderPolicies"
                                  type="apis"
                                  org-id="{{ org.id }}"
                                  page-id="{{ api.id }}"
                                  version="{{ version.version }}"></apiman-policy-list>


text:
package at.irian.ankor.big.modify;

import at.irian.ankor.big.MissingPropertyActionFiringBigList;
import at.irian.ankor.big.MissingPropertyActionFiringBigMap;
import at.irian.ankor.change.Change;
import at.irian.ankor.ref.Ref;

import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;

/**
 * @author Manfred Geiler
 */
public class SimpleTreeBigDataChangeModifier {
    //private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory.getLogger(SimpleTreeBigDataChangeModifier.class);

    public Change modify(Change change, Ref changedProperty) {
        Object value = change.getValue();
        return change.withValue(handleChangeValueAfterReceive(changedProperty, value));
    }

    private Object handleChangeValueAfterReceive(Ref property, Object value) {
        if (value == null) {
            return null;
        } else if (isBigList(value)) {
            return handleBigList(property, (List) value);
        } else if (isBigMap(value)) {
            return handleBigMap(property, (Map) value);
        } else if (value instanceof List) {
            return handleList(property, (List) value);
        } else if (value instanceof Map) {
            return handleMap(property, (Map) value);
        } else {
            return handleObject(property, value);
        }
    }

    @SuppressWarnings("UnusedParameters")
    protected Object handleObject(Ref property, Object value) {
        return value;
    }

    @SuppressWarnings("unchecked")
    protected List handleList(Ref property, List list) {
        for (int i = 0; i < list.size(); i++) {
            Object o1 = list.get(i);
            Object o2 = handleChangeValueAfterReceive(property.appendIndex(i), o1);
            if (o2 != o1) {
                list.set(i, o2);
            }
        }
        return list;
    }

    @SuppressWarnings("unchecked")
    protected Map handleMap(Ref property, Map map) {
        for (Map.Entry entry : (Iterable<Map.Entry>) map.entrySet()) {
            Object key = entry.getKey();
            if (key instanceof String) {
                Object o1 = entry.getValue();
                Object o2 = handleChangeValueAfterReceive(property.appendLiteralKey((String) key), o1);
                if (o2 != o1) {
                    entry.setValue(o2);
                }
            }
        }
        return map;
    }

    private boolean isBigList(Object value) {
        if (value instanceof Collection) {
            if (((Collection) value).size() == 1) {
                Object firstEntry = ((Collection) value).iterator().next();
                if (firstEntry instanceof Map) {
                    Object size = ((Map) firstEntry).get(ListToBigListDummyConverter.SIZE_KEY);
                    if (size != null && size instanceof Number) {
                        return true;
                    }
                }
            }
        }
        return false;
    }

    @SuppressWarnings("unchecked")
    protected List handleBigList(Ref property, List serializedList) {
        int size = getBigListSize(serializedList);
        Object substitute = getBigListMissingElementSubstitute(serializedList);
        int chunkSize = getChunkSize(serializedList);
        List initialElements = getBigListInitialElements(serializedList);
        return new MissingPropertyActionFiringBigList(size, property, substitute, chunkSize, initialElements);
    }

    private int getBigListSize(List list) {
        Object size = ((Map) list.get(0)).get(ListToBigListDummyConverter.SIZE_KEY);
        return ((Number)size).intValue();
    }

    private Object getBigListMissingElementSubstitute(List list) {
        return ((Map) list.get(0)).get(ListToBigListDummyConverter.SUBSTITUTE_KEY);
    }

    private int getChunkSize(List list) {
        Object size = ((Map) list.get(0)).get(ListToBigListDummyConverter.CHUNK_SIZE_KEY);
        return ((Number)size).intValue();
    }

    private List getBigListInitialElements(List list) {
        List initialList = (List) ((Map) list.get(0)).get(ListToBigListDummyConverter.INITIAL_LIST_KEY);
        if (initialList != null) {
            return initialList;
        } else {
            return Collections.emptyList();
        }
    }

    private boolean isBigMap(Object value) {
        if (value instanceof Map) {
            Object size = ((Map) value).get(MapToBigMapDummyConverter.SIZE_KEY);
            if (size != null && size instanceof Number) {
                return true;
            }
        }
        return false;
    }

    @SuppressWarnings("unchecked")
    protected Map handleBigMap(Ref property, Map serializedMap) {
        int size = getBigMapSize(serializedMap);
        Object substitute = getBigMapMissingValueSubstitute(serializedMap);
        Map bigMap = new MissingPropertyActionFiringBigMap(size, property, false, substitute);
        for (Map.Entry entry : (Iterable<? extends Map.Entry>) serializedMap.entrySet()) {
            Object key = entry.getKey();
            if (!isSpecialBigMapKey(key)) {
                bigMap.put(key, entry.getValue());
            }
        }
        return bigMap;
    }

    private boolean isSpecialBigMapKey(Object key) {
        return MapToBigMapDummyConverter.SIZE_KEY.equals(key) || MapToBigMapDummyConverter.SUBSTITUTE_KEY.equals(key);
    }

    private int getBigMapSize(Map map) {
        return ((Number) map.get(MapToBigMapDummyConverter.SIZE_KEY)).intValue();
    }

    private Object getBigMapMissingValueSubstitute(Map map) {
        return map.get(MapToBigMapDummyConverter.SUBSTITUTE_KEY);
    }

}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Point3D_UI
{
	public class Path3D
	{
		private readonly List<Point3D> points = new List<Point3D>();

		public IEnumerable<Point3D> Points
		{
			get
			{
				return points;
			}
		}
		public void AddPoint(Point3D newPoint)
		{
			points.Add(newPoint);
		}
		public override string ToString()
		{
			return String.Join(", ", Points);
		}
	}
}


text:
#ifndef MATH_LAPACK_INTERFACE_H
#define MATH_LAPACK_INTERFACE_H

#include "MatrixTemplate.h"

namespace Math {

/** @ingroup Math
 * @brief An interface to BLAS.  Activated with the preprocessor flag
 * HAVE_BLAS=1.
 */
struct BLASInterface
{
  /// Level 1 BLAS
  static float Dot(const fVector& x,const fVector& y);
  static double Dot(const dVector& x,const dVector& y);
  static float Norm_L2(const fVector& x);
  static double Norm_L2(const dVector& x);
  static float Norm_L1(const fVector& x);
  static double Norm_L1(const dVector& x);
  static int MaxAbsIndex(const fVector& x);
  static int MaxAbsIndex(const dVector& x);
  static void Madd(fVector& v,const fVector& x,float a);
  static void Madd(dVector& v,const dVector& x,double a);
  static void InplaceMul(fVector& v,float a);
  static void InplaceMul(dVector& v,double a);

  /// Level 2 BLAS
  static void Mul(const fMatrix& A,const fVector& x,fVector& out);
  static void Mul(const dMatrix& A,const dVector& x,dVector& out);
  static void MulTranspose(const fMatrix& A,const fVector& x,fVector& out);
  static void MulTranspose(const dMatrix& A,const dVector& x,dVector& out);
  //y = alpha*A*x + beta*y
  static void Madd(const fMatrix& A,const fVector& x,fVector& y,float alpha=1.0,float beta=1.0);
  static void Madd(const dMatrix& A,const dVector& x,dVector& y,double alpha=1.0,double beta=1.0);
  //y = alpha*A^T*x + beta*y
  static void MaddTranspose(const fMatrix& A,const fVector& x,fVector& y,float alpha=1.0,float beta=1.0);
  static void MaddTranspose(const dMatrix& A,const dVector& x,dVector& y,double alpha=1.0,double beta=1.0);

  /// Level 3 BLAS
  static void Mul(const fMatrix& A,const fMatrix& B,fMatrix& X);
  static void Mul(const dMatrix& A,const dMatrix& B,dMatrix& X);
  //X = alpha*op(A)*op(B) + beta*X
  static void Madd(const fMatrix& A,const fMatrix& B,fMatrix& X,bool Atranspose=false,bool Btranspose=false,float alpha=1.0,float beta=1.0);
  static void Madd(const dMatrix& A,const dMatrix& B,dMatrix& X,bool Atranspose=false,bool Btranspose=false,double alpha=1.0,double beta=1.0);
};

} //namespace Math

#endif


text:
var alt = angular.module('alt', ['ngResource', 'ngRoute', 'toaster', 'restangular', 'wu.masonry', 'ngProgress']);

alt
.config(function($routeProvider, $locationProvider, RestangularProvider) {
  $locationProvider.html5Mode({
    enabled: true,
    requireBase: false
  });
  RestangularProvider.setBaseUrl('/data');
  $routeProvider

  .when('/', { templateUrl: '/pages/index' })
  /* ==========================================================================
  explore page
  ========================================================================== */
  .when('/explore', { templateUrl: '/pages/explore/explore' })
    /* ==========================================================================
  showroom page
  ========================================================================== */
  .when('/showroom', { templateUrl: '/pages/showroom/showroom' })
  /* ==========================================================================
  Search page
  ========================================================================== */
  .when('/search', { templateUrl: '/pages/search/search' })
  .when('/search/:section', { templateUrl: '/pages/search/search-section' })
  /* ==========================================================================
  Signup page
  ========================================================================== */
  .when('/signup', { templateUrl: '/pages/signup/signup' })
  /* ==========================================================================
  Product page
  ========================================================================== */
  .when('/product', { templateUrl: '/pages/product-detail/product' })
  /* ==========================================================================
  Info page
  ========================================================================== */
  .when('/info', { templateUrl: '/pages/info/about' })
  .when('/join-us', { templateUrl: '/pages/info/join-us' })
  .when('/customer-care', { templateUrl: '/pages/info/customer-care' })
  /* ==========================================================================
  Pro Account page
  ========================================================================== */
  .when('/account/recentnews', { templateUrl: '/pages/account/vip-recentNews-content' })
  .when('/account/otherprofile', { templateUrl: '/pages/account/vip-otherMemberProfile-content' })
  .when('/account/otherprofile-connected', { templateUrl: '/pages/account/vip-otherMemberProfile-connected' })
  .when('/account/new-member', { templateUrl: '/pages/account/vip-newmember' })
  .when('/account/myconnections', { templateUrl: '/pages/account/vip-myConnections-content' })
  .when('/account/otherconnections', { templateUrl: '/pages/account/vip-otherconnections' })
  .when('/account/inbox', { templateUrl: '/pages/account/vip-accountInbox-content' })
  .when('/account/compose', { templateUrl: '/pages/account/vip-accountCompose-content' })
  .when('/account/maildetail', { templateUrl: '/pages/account/vip-accountMailDetails-content' })
  .when('/account/invite', { templateUrl: '/pages/account/vip-accountInvitation-content' })
  /* ==========================================================================
  Account page
  ========================================================================== */
  .when('/account/love-looks', { templateUrl: '/pages/account/love-looks' })
  .when('/account/love-products', { templateUrl: '/pages/account/love-products' })
  .when('/account/love-brand', { templateUrl: '/pages/account/love-brand' })
  .when('/account/order', { templateUrl: '/pages/account/order' })
  .when('/account/profile', { templateUrl: '/pages/account/profile' })
  .when('/account/cart', { templateUrl: '/pages/account/cart' })
  /* ==========================================================================
  Brand page
  ========================================================================== */
  .when('/brand', { templateUrl: '/pages/brand/brand-products-all' })
  .when('/brand/products', { templateUrl: '/pages/brand/brand-products-all' })
  .when('/cn/brand/products', { templateUrl: '/pages/brand/brand-products-all' })
  .when('/brand/products/all', { templateUrl: '/pages/brand/brand-products-all' })
  .when('/cn/brand/products/all', { templateUrl: '/pages/brand/brand-products-all' })
  .when('/brand/products/featured', { templateUrl: '/pages/brand/brand-products-featured' })
  .when('/cn/brand/products/featured', { templateUrl: '/pages/brand/brand-products-featured' })
  .when('/brand/trace', { templateUrl: '/pages/brand/brand-trace' })
  .when('/cn/brand/trace', { templateUrl: '/pages/brand/brand-trace' })
  .when('/brand/inspirations', { templateUrl: '/pages/brand/brand-Inspirations' })
  .when('/cn/brand/inspirations', { templateUrl: '/pages/brand/brand-Inspirations' })
  .when('/brand/:chapter', { templateUrl: '/pages/brand/brand-chapter' })
  .when('/cn/brand/:chapter', { templateUrl: '/pages/brand/brand-chapter' });
});


text:
<!DOCTYPE html>

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>perfect-scrollbar example</title>
        <link href="../src/perfect-scrollbar.css" rel="stylesheet">

No minimum

100px minimum