text:
package com.github.alezhka.wavesj.utils.crypto;

import com.github.alezhka.wavesj.utils.crypto.primitives.util.ByteStrings;

/**
 * Actor's MTProto V2 keys
 */
public class ActorProtoKey {

    private byte[] clientMacKey;
    private byte[] serverMacKey;
    private byte[] clientKey;
    private byte[] serverKey;

    private byte[] clientMacRussianKey;
    private byte[] serverMacRussianKey;
    private byte[] clientRussianKey;
    private byte[] serverRussianKey;

    public ActorProtoKey(byte[] masterKey) {
        int offset = 0;
        clientMacKey = ByteStrings.substring(masterKey, (offset++) * 32, 32);
        serverMacKey = ByteStrings.substring(masterKey, (offset++) * 32, 32);
        clientKey = ByteStrings.substring(masterKey, (offset++) * 32, 32);
        serverKey = ByteStrings.substring(masterKey, (offset++) * 32, 32);

        clientMacRussianKey = ByteStrings.substring(masterKey, (offset++) * 32, 32);
        serverMacRussianKey = ByteStrings.substring(masterKey, (offset++) * 32, 32);
        clientRussianKey = ByteStrings.substring(masterKey, (offset++) * 32, 32);
        serverRussianKey = ByteStrings.substring(masterKey, (offset++) * 32, 32);
    }

    public byte[] getClientMacKey() {
        return clientMacKey;
    }

    public byte[] getServerMacKey() {
        return serverMacKey;
    }

    public byte[] getClientKey() {
        return clientKey;
    }

    public byte[] getServerKey() {
        return serverKey;
    }

    public byte[] getClientMacRussianKey() {
        return clientMacRussianKey;
    }

    public byte[] getServerMacRussianKey() {
        return serverMacRussianKey;
    }

    public byte[] getClientRussianKey() {
        return clientRussianKey;
    }

    public byte[] getServerRussianKey() {
        return serverRussianKey;
    }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Leetcode 398</title>

    <link href="/css/bootstrap.min.css" rel="stylesheet">

    <link href="/css/clean-blog.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/animate.css@3.5.2/animate.min.css">

            Haifeng Jin's Blog

        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">

        </button>

                        Home

                        Technology

                        Competitive

                        Chinese

                              Contact

                                Linkedin

                                GitHub

                                Google Scholar

                                E-mail

            <form class="form-inline my-2 my-lg-0">
              <input class="form-control mr-sm-2" type="search" onkeydown="if(event.keyCode==13) googlesearch();" name="search-key-words" placeholder="Search" aria-label="Search">
              <button class="btn btn-outline-success my-2 my-sm-0" onclick="googlesearch()">Search</button>
            </form>

Tutorial

                        The Art of Competitive Programming

Leetcode 398

			Posted on 15 Feb 2017

			reservoir sampling

Problem Link

Tutorial

The ith time you see a candidate, you will have a probability of  to select it. (i start from 1)
So the overall probability of choosing the xth candidate is , where m is the total number of candidates. (1 <= x <= m)
It is because if we finally decide to choose xth candidate is independent from whether we changed our decision during any encounter with a candidate before the xth.
And at the encounter of the xth candidate, we choose to change which is of probability .
Then we did not change during any encounter with the rest of the candidates.
So we need to multiply p by  which would finaly result in .

Solution

from random import randint

class Solution(object):

    def __init__(self, nums):
        """

        :type nums: List[int]
        :type numsSize: int
        """
        self.nums = nums

    def pick(self, target):
        """
        :type target: int
        :rtype: int
        """
        ret = -1
        count = 0
        for i, x in enumerate(self.nums):
            if x == target:
                if randint(0, count) == 0:
                    ret = i
                count += 1
        return ret

# Your Solution object will be instantiated and called as such:
# obj = Solution(nums)
# param_1 = obj.pick(target)

    Please enable JavaScript to view the comments powered by Disqus.

<big>Introduction</big>

Here are some write-ups for the competitive programming problems I solved.

<big>Code Library</big>

My code library link on GitHub.

redpajama_set_name: RedPajamaGithub


text:
<?php

/**
 * @see ZendX_JQuery_Form_Element_UiWidget
 */
// require_once "UiWidget.php";

/**
 * Form Element for jQuery Slider View Helper
 *
 * @package    ZendX_JQuery
 * @subpackage Form
 * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
class ZendX_JQuery_Form_Element_Slider extends ZendX_JQuery_Form_Element_UiWidget
{
    public $helper = "slider";
}


text:
interface FinchCallback {
    (bindings?: any, childCallback? : () => void): any;
}

interface ExpandedCallback {
    setup?: FinchCallback;
    load?: FinchCallback;
    unload?: FinchCallback;
    teardown?: FinchCallback;
}

interface ObserveCallback {
    (...args: any[]): string;
}
interface FinchOptions {
    CoerceParameterTypes?: boolean;
}

interface FinchStatic {
    route(route: string, callback: FinchCallback): void;
    route(route: string, callbacks: ExpandedCallback): void;
    call( uri: string ): void;

    observe(argN: string[], callback: (params: ObserveCallback ) => void): void;
    observe(callback: (params: ObserveCallback) => void): void;
    observe(...args: any[]): void;
    navigate(uri:string, queryParams?:any, doUpdate?:boolean ): void;
    navigate(uri:string, doUpdate:boolean ): void;
    navigate(queryParams:any, doUpdate?:boolean ): void;
    listen(): boolean;
    ignore(): boolean;
    abort(): void;
    options(options: FinchOptions): void;
}

declare var Finch: FinchStatic;
declare module "finch" {
    export = Finch;
}


text:
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2022 Francis Laniel <flaniel@linux.microsoft.com>
#include <vmlinux.h>
#include <bpf/bpf_helpers.h>
#include <bpf/bpf_core_read.h>
#include <bpf/bpf_tracing.h>

#include "biotop.h"
#include "maps.bpf.h"
#include "core_fixes.bpf.h"

struct {
	__uint(type, BPF_MAP_TYPE_HASH);
	__uint(max_entries, 10240);
	__type(key, struct request *);
	__type(value, struct start_req_t);
} start SEC(".maps");

struct {
	__uint(type, BPF_MAP_TYPE_HASH);
	__uint(max_entries, 10240);
	__type(key, struct request *);
	__type(value, struct who_t);
} whobyreq SEC(".maps");

struct {
	__uint(type, BPF_MAP_TYPE_HASH);
	__uint(max_entries, 10240);
	__type(key, struct info_t);
	__type(value, struct val_t);
} counts SEC(".maps");

SEC("kprobe")
int BPF_KPROBE(blk_account_io_start, struct request *req)
{
	struct who_t who = {};

	/* cache PID and comm by-req */
	bpf_get_current_comm(&who.name, sizeof(who.name));
	who.pid = bpf_get_current_pid_tgid() >> 32;
	bpf_map_update_elem(&whobyreq, &req, &who, 0);

	return 0;
}

SEC("kprobe/blk_mq_start_request")
int BPF_KPROBE(blk_mq_start_request, struct request *req)
{
	/* time block I/O */
	struct start_req_t start_req;

	start_req.ts = bpf_ktime_get_ns();
	start_req.data_len = BPF_CORE_READ(req, __data_len);

	bpf_map_update_elem(&start, &req, &start_req, 0);
	return 0;
}

SEC("kprobe")
int BPF_KPROBE(blk_account_io_done, struct request *req, u64 now)
{
	struct val_t *valp, zero = {};
	struct info_t info = {};
	struct start_req_t *startp;
	unsigned int cmd_flags;
	struct gendisk *disk;
	struct who_t *whop;
	u64 delta_us;

	/* fetch timestamp and calculate delta */
	startp = bpf_map_lookup_elem(&start, &req);
	if (!startp)
		return 0;    /* missed tracing issue */

	delta_us = (bpf_ktime_get_ns() - startp->ts) / 1000;

	/* setup info_t key */
	cmd_flags = BPF_CORE_READ(req, cmd_flags);

	disk = get_disk(req);
	info.major = BPF_CORE_READ(disk, major);
	info.minor = BPF_CORE_READ(disk, first_minor);
	info.rwflag = !!((cmd_flags & REQ_OP_MASK) == REQ_OP_WRITE);

	whop = bpf_map_lookup_elem(&whobyreq, &req);
	if (whop) {
		info.pid = whop->pid;
		__builtin_memcpy(&info.name, whop->name, sizeof(info.name));
	}

	valp = bpf_map_lookup_or_try_init(&counts, &info, &zero);

	if (valp) {
		/* save stats */
		valp->us += delta_us;
		valp->bytes += startp->data_len;
		valp->io++;
	}

	bpf_map_delete_elem(&start, &req);
	bpf_map_delete_elem(&whobyreq, &req);

	return 0;
}

char LICENSE[] SEC("license") = "GPL";


text:
// ==========================================================================
//  EventConsumerBootstrapTests.cs
//  Squidex Headless CMS
// ==========================================================================
//  Copyright (c) Squidex Group
//  All rights reserved.
// ==========================================================================

using System;
using System.Threading;
using System.Threading.Tasks;
using FakeItEasy;
using Orleans;
using Orleans.Runtime;
using Xunit;

namespace Squidex.Infrastructure.Orleans
{
    public class BootstrapTests
    {
        private readonly IBackgroundGrain grain = A.Fake<IBackgroundGrain>();
        private readonly Bootstrap<IBackgroundGrain> sut;

        public BootstrapTests()
        {
            var factory = A.Fake<IGrainFactory>();

            sut = new Bootstrap<IBackgroundGrain>(factory);

            A.CallTo(() => factory.GetGrain<IBackgroundGrain>("Default", null))
                .Returns(grain);
        }

        [Fact]
        public async Task Should_activate_grain_on_run()
        {
            await sut.Execute(CancellationToken.None);

            A.CallTo(() => grain.ActivateAsync())
                .MustHaveHappened();
        }

        [Fact]
        public async Task Should_fail_on_non_rejection_exception()
        {
            A.CallTo(() => grain.ActivateAsync())
                .Throws(new InvalidOperationException());

            await Assert.ThrowsAsync<InvalidOperationException>(() => sut.Execute(CancellationToken.None));
        }

        [Fact]
        public async Task Should_retry_after_rejection_exception()
        {
            A.CallTo(() => grain.ActivateAsync())
                .Throws(new OrleansException()).Once();

            await sut.Execute(CancellationToken.None);

            A.CallTo(() => grain.ActivateAsync())
                .MustHaveHappened(Repeated.Exactly.Twice);
        }

        [Fact]
        public async Task Should_fail_after_10_rejection_exception()
        {
            A.CallTo(() => grain.ActivateAsync())
                .Throws(new OrleansException());

            await Assert.ThrowsAsync<OrleansException>(() => sut.Execute(CancellationToken.None));

            A.CallTo(() => grain.ActivateAsync())
                .MustHaveHappened(Repeated.Exactly.Times(10));
        }
    }
}


text:
package com.hortonworks.streamline.registries.model.data;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.hortonworks.registries.common.Schema;
import com.hortonworks.registries.common.Schema.Field;
import com.hortonworks.registries.common.Schema.Type;
import com.hortonworks.streamline.storage.annotation.StorableEntity;
import com.hortonworks.streamline.storage.PrimaryKey;
import com.hortonworks.streamline.storage.catalog.AbstractStorable;

import java.util.HashMap;
import java.util.Map;

/*
** Storable Entity for saving the pmml model details.
 */
@StorableEntity
@JsonIgnoreProperties(ignoreUnknown = true)
public final class MLModel extends AbstractStorable {
    public static final String NAME = "name";
    private static final String NAME_SPACE = "ml_model";
    private static final String ID = "id";
    private Long id;
    private Long timestamp;
    private String name;
    private String pmml;
    private String uploadedFileName;

    public MLModel() {
    }

    public void setPmml(String pmml) {
        this.pmml = pmml;
    }

    public String getPmml() {
        return pmml;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

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

    public Long getId() {
        return id;
    }

    public void setTimestamp(Long timestamp) {
        this.timestamp = timestamp;
    }

    public Long getTimestamp() {
        return timestamp;
    }

    public String getNameSpace() {
        return NAME_SPACE;
    }

    public String getUploadedFileName() {
        return uploadedFileName;
    }

    public void setUploadedFileName(String fileName) {
        this.uploadedFileName = fileName;
    }

    @JsonIgnore
    @Override
    public PrimaryKey getPrimaryKey() {
        Map<Field, Object> fieldObjectMap = new HashMap<>();
        fieldObjectMap.put(new Schema.Field(ID, Type.LONG), this.id);
        return new PrimaryKey(fieldObjectMap);
    }
}


text:
<!DOCTYPE html>

        <?php
            $assetUrl = Yii::app()->assetPublisher->publish(Yii::getPathOfAlias('application.views.assets'));
            $bootstrap = Yii::app()->assetPublisher->publish(Yii::getPathOfAlias('composer.twbs.bootstrap.dist'));
            $datepicker = Yii::app()->assetPublisher->publish(Yii::getPathOfAlias('composer.eternicode.bootstrap-datepicker'));
        ?>

        <meta charset="utf8" />

        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

        <link href="<?php echo $bootstrap; ?>/css/bootstrap.min.css" rel="stylesheet" type="text/css" media="all" />

        <link  href="<?php echo $assetUrl; ?>/css/main.css" rel="stylesheet" type="text/css" media="all" />

        <link  href='http://fonts.googleapis.com/css?family=Ubuntu:400,700' rel='stylesheet' type='text/css'>
        <link  href='http://fonts.googleapis.com/css?family=Raleway:400,300' rel='stylesheet' type='text/css'>
        <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300' rel='stylesheet' type='text/css'>

        <title>
            OSRS Market - Price Statistics and More!
        </title>

                                <?php echo CHtml::link('
Rising
', array('/stats/rising')); ?>
                                <?php echo CHtml::link('
Falling
', array('/stats/falling')); ?>
                                <?php echo CHtml::link('
Merchant
', array('/stats/merchant')); ?>

                                <?php echo CHtml::link(
                                CHtml::image($assetUrl . '/images/logo.png', 'Logo', array('class' => 'img-responsive')),
                                Yii::app()->user->getReturnUrl(Yii::app()->homeUrl),
                                array());
                                ?>

                                <?php echo CHtml::link('
Pro
', array('/account/pro')); ?>
                                <?php echo CHtml::link('
Register
', array('/account/register')); ?>
                                <?php echo CHtml::link('
Login
', array('/login')); ?>

            <?php if(!($this->id == "home" && $this->action->id == "index")): ?>
                <?php if($this->breadcrumbs): ?>

                            <?php
                            $this->widget('zii.widgets.CBreadcrumbs', array(
                                'links' => $this->breadcrumbs,
                            ));
                            ?>

                <?php endif; ?>

            <?php endif; ?>

            <?php if(Yii::app()->user->hasFlash("success")): ?>

                    <button type="button" class="close" data-dismiss="alert">×Close</button>
                    Hell Yeah!    <?php echo Yii::app()->user->getFlash("success"); ?>

            <?php endif; ?>

            <?php if(Yii::app()->user->hasFlash("danger")): ?>

                    <button type="button" class="close" data-dismiss="alert">×Close</button>
                    Hold Up!    <?php echo Yii::app()->user->getFlash("danger"); ?>

            <?php endif; ?>

            <?php if(Yii::app()->user->hasFlash("warning")): ?>

                    <button type="button" class="close" data-dismiss="alert">×Close</button>
                    Wait a second!    <?php echo Yii::app()->user->getFlash("warning"); ?>

            <?php endif; ?>

            <?php echo $content; ?>

            <?php if(!($this->id == "home" && $this->action->id == "index")): ?>

            <?php endif; ?>


text:
package cn.org.eshow.framwork.util;

import android.app.DialogFragment;
import android.app.Fragment;
import android.app.FragmentTransaction;
import android.content.Context;
import android.content.DialogInterface;
import android.support.v4.app.FragmentActivity;
import android.view.Gravity;
import android.view.View;

import cn.org.eshow.framwork.fragment.AbAlertDialogFragment;
import cn.org.eshow.framwork.fragment.AbAlertDialogFragment.AbDialogOnClickListener;
import cn.org.eshow.framwork.fragment.AbDialogFragment.AbDialogOnLoadListener;
import cn.org.eshow.framwork.fragment.AbLoadDialogFragment;
import cn.org.eshow.framwork.fragment.AbProgressDialogFragment;
import cn.org.eshow.framwork.fragment.AbRefreshDialogFragment;
import cn.org.eshow.framwork.fragment.AbSampleDialogFragment;

// TODO: Auto-generated Javadoc
/**
 * Dialog工具类.
 *
 */

public class AbDialogUtil {

	/** dialog 标记*/
	public static String dialogTag = "dialog";

	public static int ThemeHoloLightDialog = android.R.style.Theme_Holo_Light_Dialog;

	public static int ThemeLightPanel = android.R.style.Theme_Light_Panel;

	private static int defaultStyle = ThemeHoloLightDialog;

	/**
	 * 全屏显示一个对话框.
	 * @param view
	 * @return
	 */
	public static AbSampleDialogFragment showFullScreenDialog(View view) {
		FragmentActivity activity = (FragmentActivity)view.getContext();
        // Create and show the dialog.
        AbSampleDialogFragment newFragment = AbSampleDialogFragment.newInstance(DialogFragment.STYLE_NORMAL, android.R.style.Theme_Black_NoTitleBar_Fullscreen);
        newFragment.setContentView(view);
        FragmentTransaction ft = activity.getFragmentManager().beginTransaction();
        // 指定一个系统转场动画
        ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
        newFragment.show(ft, dialogTag);
        return newFragment;
    }

	/**
	 * 显示一个隐藏的的对话框.
	 * @param context
     * @param fragment
	 */
	public static void showDialog(Context context,DialogFragment fragment) {
		FragmentActivity activity = (FragmentActivity)context;
		fragment.show(activity.getFragmentManager(), dialogTag);
    }

	/**
	 * 显示一个自定义的对话框.
	 * @param view
	 */
	public static AbSampleDialogFragment showDialog(View view) {
        return showDialog(view,Gravity.CENTER);
    }

	/**
	 *
	 * 描述:显示一个自定义的对话框.
	 * @param view
	 * @param gravity 位置
	 * @return
	 */
	public static AbSampleDialogFragment showDialog(View view,int gravity) {
		return showDialog(view,gravity,defaultStyle);
    }

	/**
	 *
	 * 描述:显示一个自定义的对话框.
	 * @param view
	 * @param gravity 位置
	 * @param style
	 * @return
	 */
	public static AbSampleDialogFragment showDialog(View view,int gravity,int style) {
		FragmentActivity activity = (FragmentActivity)view.getContext();
        // Create and show the dialog.
        AbSampleDialogFragment newFragment = AbSampleDialogFragment.newInstance(DialogFragment.STYLE_NO_TITLE, style, gravity);
        newFragment.setContentView(view);

        FragmentTransaction ft = activity.getFragmentManager().beginTransaction();
        // 指定一个系统转场动画
        ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
        newFragment.show(ft, dialogTag);

        return newFragment;
    }

	/**
	 * 显示一个自定义的对话框
	 * @param view
	 * @param onCancelListener
	 * @return
	 */
	public static AbSampleDialogFragment showDialog(View view,DialogInterface.OnCancelListener onCancelListener) {
        return showDialog(view,Gravity.CENTER,defaultStyle,onCancelListener);
    }

	/**
	 * 显示一个自定义的对话框
	 * @param view
	 * @param onCancelListener
	 * @return
	 */
	public static AbSampleDialogFragment showDialog(View view,int style,DialogInterface.OnCancelListener onCancelListener) {
        return showDialog(view,Gravity.CENTER,style,onCancelListener);
    }

	/**
	 *
	 * 描述:显示一个自定义的对话框.
	 * @param view
	 * @param gravity 位置
	 * @param style
	 * @param onCancelListener 取消事件
	 * @return
	 */
	public static AbSampleDialogFragment showDialog(View view,int gravity,int style,DialogInterface.OnCancelListener onCancelListener) {
		FragmentActivity activity = (FragmentActivity)view.getContext();
        // Create and show the dialog.
        AbSampleDialogFragment newFragment = AbSampleDialogFragment.newInstance(DialogFragment.STYLE_NO_TITLE, style, gravity);
        newFragment.setContentView(view);
        FragmentTransaction ft = activity.getFragmentManager().beginTransaction();
        // 指定一个系统转场动画
        ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
        newFragment.setOnCancelListener(onCancelListener);
        newFragment.show(ft, dialogTag);
        return newFragment;
    }

	/**
	 *
	 * 描述:显示一个自定义的对话框.
	 * @param view
	 * @param animEnter
	 * @param animExit
	 * @param animPopEnter
	 * @param animPopExit
	 * @param onCancelListener
	 * @return
	 */
	public static AbSampleDialogFragment showDialog(View view,int animEnter, int animExit, int animPopEnter, int animPopExit,DialogInterface.OnCancelListener onCancelListener) {
        return showDialog(view,animEnter,animExit,animPopEnter,animPopExit,Gravity.CENTER,defaultStyle,onCancelListener);
    }

	/**
	 *
	 * 描述:显示一个自定义的对话框.
	 * @param view
	 * @param animEnter
	 * @param animExit
	 * @param animPopEnter
	 * @param animPopExit
	 * @param onCancelListener
	 * @return
	 */
	public static AbSampleDialogFragment showDialog(View view,int animEnter, int animExit, int animPopEnter, int animPopExit,int style,DialogInterface.OnCancelListener onCancelListener) {
        return showDialog(view,animEnter,animExit,animPopEnter,animPopExit,Gravity.CENTER,style,onCancelListener);
    }

	/**
	 *
	 * 描述:显示一个自定义的对话框.
	 * @param view
	 * @param animEnter
	 * @param animExit
	 * @param animPopEnter
	 * @param animPopExit
	 * @param gravity
	 * @param onCancelListener
	 * @return
	 */
	public static AbSampleDialogFragment showDialog(View view,int animEnter, int animExit, int animPopEnter, int animPopExit,int gravity,int style,DialogInterface.OnCancelListener onCancelListener) {
		FragmentActivity activity = (FragmentActivity)view.getContext();
        // Create and show the dialog.
        AbSampleDialogFragment newFragment = AbSampleDialogFragment.newInstance(DialogFragment.STYLE_NO_TITLE, style, gravity);
        newFragment.setContentView(view);
        FragmentTransaction ft = activity.getFragmentManager().beginTransaction();
        ft.setCustomAnimations(animEnter,animExit,animPopEnter,animPopExit);
        newFragment.setOnCancelListener(onCancelListener);
        newFragment.show(ft, dialogTag);
        return newFragment;
    }

	/**
	 * 显示一个自定义的对话框.
	 * @param view
	 * @param animEnter
	 * @param animExit
	 * @param animPopEnter
	 * @param animPopExit
	 * @return
	 */
	public static AbSampleDialogFragment showDialog(View view,int animEnter, int animExit, int animPopEnter, int animPopExit) {
        return showDialog(view,animEnter,animExit,animPopEnter,animPopExit,Gravity.CENTER,defaultStyle);
    }

	/**
	 * 显示一个自定义的对话框.
	 * @param view
	 * @param animEnter
	 * @param animExit
	 * @param animPopEnter
	 * @param animPopExit
	 * @return
	 */
	public static AbSampleDialogFragment showDialog(View view,int animEnter, int animExit, int animPopEnter, int animPopExit,int style) {
        return showDialog(view,animEnter,animExit,animPopEnter,animPopExit,Gravity.CENTER,style);
    }

	/**
	 *
	 * 描述:显示一个自定义的对话框.
	 * @param view
	 * @param animEnter
	 * @param animExit
	 * @param animPopEnter
	 * @param animPopExit
	 * @param gravity 位置
	 * @return
	 */
	public static AbSampleDialogFragment showDialog(View view,int animEnter, int animExit, int animPopEnter, int animPopExit,int gravity,int style) {
		FragmentActivity activity = (FragmentActivity)view.getContext();
        // Create and show the dialog.
        AbSampleDialogFragment newFragment = AbSampleDialogFragment.newInstance(DialogFragment.STYLE_NO_TITLE, style, gravity);
        newFragment.setContentView(view);
        //自定义转场动画
        FragmentTransaction ft = activity.getFragmentManager().beginTransaction();
        ft.setCustomAnimations(animEnter,animExit,animPopEnter,animPopExit);
        newFragment.show(ft, dialogTag);
        return newFragment;
    }

	/**
	 * 描述:对话框dialog (图标,标题,String内容).
	 * @param context
	 * @param icon
	 * @param title 对话框标题内容
	 * @param message  对话框提示内容
	 */
	public static AbAlertDialogFragment showAlertDialog(Context context,int icon,String title,String message) {
		FragmentActivity activity = (FragmentActivity)context;
		AbAlertDialogFragment newFragment = AbAlertDialogFragment.newInstance(icon, title, message, null, null);
		FragmentTransaction ft = activity.getFragmentManager().beginTransaction();
	    // 指定一个系统转场动画
	    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
		newFragment.show(ft, dialogTag);
	    return newFragment;
	}

	/**
	 * 显示一个一般的对话框(图标,标题,string内容,确认,取消).
	 * @param context
	 * @param icon
	 * @param title 对话框标题内容
	 * @param message 对话框提示内容
	 * @param onClickListener 点击确认按钮的事件监听
	 */
	public static AbAlertDialogFragment showAlertDialog(Context context,int icon,String title,String message,AbDialogOnClickListener onClickListener) {
		FragmentActivity activity = (FragmentActivity)context;
		AbAlertDialogFragment newFragment = AbAlertDialogFragment.newInstance(icon, title, message, null, onClickListener);
		FragmentTransaction ft = activity.getFragmentManager().beginTransaction();
        // 指定一个系统转场动画
        ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
		newFragment.show(ft, dialogTag);
	    return newFragment;
	}

	/**
	 * 显示一个一般的对话框(标题,String内容,确认,取消).
	 * @param context
	 * @param title 对话框标题内容
	 * @param message 对话框提示内容
	 * @param onClickListener 点击确认按钮的事件监听
	 */
	public static AbAlertDialogFragment showAlertDialog(Context context,String title,String message,AbDialogOnClickListener onClickListener) {
		FragmentActivity activity = (FragmentActivity)context;
		AbAlertDialogFragment newFragment = AbAlertDialogFragment.newInstance(0, title, message, null, onClickListener);
		FragmentTransaction ft = activity.getFragmentManager().beginTransaction();
        // 指定一个系统转场动画
        ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
		newFragment.show(ft, dialogTag);
	    return newFragment;
	}

	/**
	 * 显示一个一般的对话框(View内容).
	 * @param view 对话框标题内容
	 */
	public static AbAlertDialogFragment showAlertDialog(View view) {
		FragmentActivity activity = (FragmentActivity)view.getContext();
		AbAlertDialogFragment newFragment = AbAlertDialogFragment.newInstance(0, null, null, view, null);
		FragmentTransaction ft = activity.getFragmentManager().beginTransaction();
        // 指定一个系统转场动画
        ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
		newFragment.show(ft, dialogTag);
	    return newFragment;
	}

	/**
	 * 显示一个一般的对话框(String内容).
	 * @param context
	 * @param message 对话框标题内容
	 */
	public static AbAlertDialogFragment showAlertDialog(Context context,String message) {
		FragmentActivity activity = (FragmentActivity)context;
		AbAlertDialogFragment newFragment = AbAlertDialogFragment.newInstance(0, null, message, null, null);
		FragmentTransaction ft = activity.getFragmentManager().beginTransaction();
        // 指定一个系统转场动画
        ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
		newFragment.show(ft, dialogTag);
	    return newFragment;
	}

	/**
	 * 描述:对话框dialog (图标,标题,View内容).
	 * @param icon
	 * @param title 对话框标题内容
	 * @param view  对话框提示内容
	 */
	public static AbAlertDialogFragment showAlertDialog(int icon,String title,View view) {
		FragmentActivity activity = (FragmentActivity)view.getContext();
		AbAlertDialogFragment newFragment = AbAlertDialogFragment.newInstance(icon, title, null, view, null);
		FragmentTransaction ft = activity.getFragmentManager().beginTransaction();
        // 指定一个系统转场动画
        ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
		newFragment.show(ft, dialogTag);
	    return newFragment;
	}

	/**
	 * 显示一个一般的对话框(图标,标题,View内容,确认,取消).
	 * @param icon
	 * @param title 对话框标题内容
	 * @param view 对话框提示内容
	 * @param onClickListener 点击确认按钮的事件监听
	 */
	public static AbAlertDialogFragment showAlertDialog(int icon,String title,View view,AbDialogOnClickListener onClickListener) {
		FragmentActivity activity = (FragmentActivity)view.getContext();
		AbAlertDialogFragment newFragment = AbAlertDialogFragment.newInstance(icon, title, null, view, onClickListener);
		FragmentTransaction ft = activity.getFragmentManager().beginTransaction();
        // 指定一个系统转场动画
        ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
		newFragment.show(ft, dialogTag);
	    return newFragment;
	}

	/**
	 * 描述:对话框dialog (标题,View内容).
	 * @param title 对话框标题内容
	 * @param view  对话框提示内容
	 */
	public static AbAlertDialogFragment showAlertDialog(String title,View view) {
		FragmentActivity activity = (FragmentActivity)view.getContext();
		AbAlertDialogFragment newFragment = AbAlertDialogFragment.newInstance(0, title, null, view, null);
		FragmentTransaction ft = activity.getFragmentManager().beginTransaction();
        // 指定一个系统转场动画
        ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
		newFragment.show(ft, dialogTag);
	    return newFragment;
	}

	/**
	 * 显示一个一般的对话框(标题,View内容,确认,取消).
	 * @param title 对话框标题内容
	 * @param view 对话框提示内容
	 * @param onClickListener 点击确认按钮的事件监听
	 */
	public static AbAlertDialogFragment showAlertDialog(String title,View view,AbDialogOnClickListener onClickListener) {
		FragmentActivity activity = (FragmentActivity)view.getContext();
		AbAlertDialogFragment newFragment = AbAlertDialogFragment.newInstance(0, title, null, view, onClickListener);
		FragmentTransaction ft = activity.getFragmentManager().beginTransaction();
        // 指定一个系统转场动画
        ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
		newFragment.show(ft, dialogTag);
	    return newFragment;
	}

	/**
	 * 描述:对话框dialog (标题,String内容).
	 * @param context
	 * @param title 对话框标题内容
	 * @param message  对话框提示内容
	 */
	public static AbAlertDialogFragment showAlertDialog(Context context,String title,String message) {
		FragmentActivity activity = (FragmentActivity)context;
		AbAlertDialogFragment newFragment = AbAlertDialogFragment.newInstance(0, title, message, null, null);
		FragmentTransaction ft = activity.getFragmentManager().beginTransaction();
        // 指定一个系统转场动画
        ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
		newFragment.show(ft, dialogTag);
	    return newFragment;
	}

	/**
	 * 描述:显示进度框.
	 * @param context the context
	 * @param indeterminateDrawable 用默认请写0
	 * @param message the message
	 */
	public static AbProgressDialogFragment showProgressDialog(Context context,int indeterminateDrawable,String message) {
		FragmentActivity activity = (FragmentActivity)context;
		AbProgressDialogFragment newFragment = AbProgressDialogFragment.newInstance(indeterminateDrawable, message);
		FragmentTransaction ft = activity.getFragmentManager().beginTransaction();
        // 指定一个系统转场动画
        ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
		newFragment.show(ft, dialogTag);
	    return newFragment;
    }

	/**
	 * 描述:显示加载框.
	 * @param context the context
	 * @param indeterminateDrawable
	 * @param message the message
	 */
	public static AbLoadDialogFragment showLoadDialog(Context context,int indeterminateDrawable,String message) {
		AbLoadDialogFragment dialogFragment= showLoadDialog(context,indeterminateDrawable,message,defaultStyle);
		dialogFragment.setCancelable(false);
		return dialogFragment ;
    }

	/**
	 * 描述:显示加载框.
	 * @param context the context
	 * @param indeterminateDrawable
	 * @param message the message
	 */
	public static AbLoadDialogFragment showLoadDialog(Context context,int indeterminateDrawable,String message,AbDialogOnLoadListener abDialogOnLoadListener) {
	    return showLoadDialog(context,indeterminateDrawable,message,defaultStyle,abDialogOnLoadListener);
    }

	/**
	 * 描述:显示加载框.
	 * @param context the context
	 * @param indeterminateDrawable
	 * @param message the message
	 * @param style
	 */
	public static AbLoadDialogFragment showLoadDialog(Context context,int indeterminateDrawable,String message,int style) {
		FragmentActivity activity = (FragmentActivity)context;
		AbLoadDialogFragment newFragment = AbLoadDialogFragment.newInstance(DialogFragment.STYLE_NO_TITLE, style);
		newFragment.setIndeterminateDrawable(indeterminateDrawable);
		newFragment.setMessage(message);
		FragmentTransaction ft = activity.getFragmentManager().beginTransaction();
        // 指定一个系统转场动画
        ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
	    newFragment.show(ft, dialogTag);
	    return newFragment;
    }

	/**
	 * 描述:显示加载框.
	 * @param context the context
	 * @param indeterminateDrawable
	 * @param message the message
	 * @param style
	 * @param abDialogOnLoadListener
	 */
	public static AbLoadDialogFragment showLoadDialog(Context context,int indeterminateDrawable,String message,int style,AbDialogOnLoadListener abDialogOnLoadListener) {
		FragmentActivity activity = (FragmentActivity)context;
		AbLoadDialogFragment newFragment = AbLoadDialogFragment.newInstance(DialogFragment.STYLE_NO_TITLE, style);
		newFragment.setIndeterminateDrawable(indeterminateDrawable);
		newFragment.setMessage(message);
		newFragment.setAbDialogOnLoadListener(abDialogOnLoadListener);
		FragmentTransaction ft = activity.getFragmentManager().beginTransaction();
        // 指定一个系统转场动画
        ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
	    newFragment.show(ft, dialogTag);
	    return newFragment;
    }

	/**
	 * 描述:显示刷新框.
	 * @param context the context
	 * @param indeterminateDrawable
	 * @param message the message
	 */
	public static AbRefreshDialogFragment showRefreshDialog(Context context,int indeterminateDrawable,String message) {
		return showRefreshDialog(context,indeterminateDrawable,message,defaultStyle);
    }

	/**
	 * 描述:显示刷新框.
	 * @param context
	 * @param indeterminateDrawable
	 * @param message
	 * @param abDialogOnLoadListener
	 * @return
	 */
	public static AbRefreshDialogFragment showRefreshDialog(Context context,int indeterminateDrawable,String message,AbDialogOnLoadListener abDialogOnLoadListener) {
		return showRefreshDialog(context,indeterminateDrawable,message,defaultStyle,abDialogOnLoadListener);
    }

	/**
	 * 描述:显示刷新框.
	 * @param context the context
	 * @param indeterminateDrawable
	 * @param message the message
	 * @param style
	 */
	public static AbRefreshDialogFragment showRefreshDialog(Context context,int indeterminateDrawable,String message,int style) {
		FragmentActivity activity = (FragmentActivity)context;
		AbRefreshDialogFragment newFragment = AbRefreshDialogFragment.newInstance(DialogFragment.STYLE_NO_TITLE, style);
		newFragment.setIndeterminateDrawable(indeterminateDrawable);
		newFragment.setMessage(message);
		newFragment.setAbDialogOnLoadListener(null);
		FragmentTransaction ft = activity.getFragmentManager().beginTransaction();
        // 指定一个系统转场动画
        ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
		newFragment.show(ft, dialogTag);
	    return newFragment;
    }

	/**
	 * 描述:显示刷新框.
	 * @param context
	 * @param indeterminateDrawable
	 * @param message
	 * @param style
	 * @param abDialogOnLoadListener
	 * @return
	 */
	public static AbRefreshDialogFragment showRefreshDialog(Context context,int indeterminateDrawable,String message,int style,AbDialogOnLoadListener abDialogOnLoadListener) {
		FragmentActivity activity = (FragmentActivity)context;
		AbRefreshDialogFragment newFragment = AbRefreshDialogFragment.newInstance(DialogFragment.STYLE_NO_TITLE, style);
		newFragment.setIndeterminateDrawable(indeterminateDrawable);
		newFragment.setMessage(message);
		newFragment.setAbDialogOnLoadListener(abDialogOnLoadListener);
		FragmentTransaction ft = activity.getFragmentManager().beginTransaction();
        // 指定一个系统转场动画
        ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
		newFragment.show(ft, dialogTag);
	    return newFragment;
    }

	/**
	 * 描述:移除Fragment.
	 * @param context the context
	 */
	public static void removeDialog(final Context context){
		try {
			FragmentActivity activity = (FragmentActivity)context;
			FragmentTransaction ft = activity.getFragmentManager().beginTransaction();
	        // 指定一个系统转场动画
	        ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_CLOSE);
			Fragment prev = activity.getFragmentManager().findFragmentByTag(dialogTag);
			if (prev != null) {
			    ft.remove(prev);
			}
			ft.addToBackStack(null);
		    ft.commit();
		} catch (Exception e) {
			//可能有Activity已经被销毁的异常
			e.printStackTrace();
		}
	}

	/**
	 * 描述:移除Fragment和View
	 * @param view
	 */
	public static void removeDialog(View view){
		removeDialog(view.getContext());
		AbViewUtil.removeSelfFromParent(view);
	}

}


text:
/**
 * Distributed collection primitives.
 */
package io.atomix.core.collection;


text:
<quiz>
	<config>
		<showScore>false</showScore>
		<showCorrect>false</showCorrect>
		<showQuit>false</showQuit>
		<timeLimit>true</timeLimit>
		<waitTime>40000</waitTime>
		<maxIncorrect>9999</maxIncorrect>
	</config>

	<item>
		<title>
			Round 3, Question 1:
		</title>
		<question>
			Select the one word that is closest in meaning to the word in capitals.
		</question>
		 <info type="text">
			ASPERSION
		</info>
		<responses type="text">
			<response>plan</response>
			<response>statement</response>
			<response>spell</response>
			<response>slur</response>
			<response>confirmation</response>
			</responses>
		<answer>
			3
		</answer>
	</item>

	<item>
		<title>
			Round 3, Question 2:
		</title>
		<question>
			Select the one word that is closest in meaning to the word in capitals.
		</question>
		 <info type="text">
			PREFATORY
		</info>
		<responses type="text">
			<response>dividend</response>
			<response>opening</response>
			<response>predilection</response>
			<response>hunch</response>
			<response>majority</response>
			</responses>
		<answer>
			1
		</answer>
	</item>

	<item>
		<title>
			Round 3, Question 3:
		</title>
		<question>
			Select the one word that is closest in meaning to the word in capitals.
		</question>
		 <info type="text">
			TRENCHANT
		</info>
		<responses type="text">
			<response>deep</response>
			<response>tough</response>
			<response>hard</response>
			<response>vitriolic</response>
			<response>cold</response>
			</responses>
		<answer>
			3
		</answer>
	</item>

	<item>
		<title>
			Round 3, Question 4:
		</title>
		<question>
			Select the one word that does not belong.
		</question>
		<responses type="text">
			<response>plight</response>
			<response>quandary</response>
			<response>straits</response>
			<response>snag</response>
			<response>predicament</response>
			</responses>
		<answer>
			3
		</answer>
	</item>

	<item>
		<title>
			Round 3, Question 5:
		</title>
		<question>
			Select the one word that does not belong.
		</question>
		<responses type="text">
			<response>hindmost</response>
			<response>ultimate</response>
			<response>end</response>
			<response>final</response>
			<response>primary</response>
			</responses>
		<answer>
			4
		</answer>
	</item>

	<item>
		<title>
			Round 3, Question 6:
		</title>
		<question>
			Select the one word that does not belong.
		</question>
		<responses type="text">
			<response>interim</response>
			<response>provisionary</response>
			<response>temporary</response>
			<response>perennial</response>
			<response>transitional</response>
			</responses>
		<answer>
			3
		</answer>
	</item>

	<item>
		<title>
			Round 3, Question 7:
		</title>
		<question>
			Select the one word that does not belong.
		</question>
		<responses type="text">
			<response>ninety degrees</response>
			<response>thirty seconds</response>
			<response>fifteen minutes</response>
			<response>thirteen weeks</response>
			<response>twenty-five per cent</response>
			</responses>
		<answer>
			1
		</answer>
	</item>

	<item>
		<title>
			Round 3, Question 8:
		</title>
		<question>
			Select the one word that does not belong.
		</question>
		<responses type="text">
			<response>cornea</response>
			<response>lens</response>
			<response>lobe</response>
			<response>pupil</response>
			<response>iris</response>
			</responses>
		<answer>
			2
		</answer>
	</item>
</quiz>


text:
<?php
namespace Kwf\Deploy\Db;

use Symfony\Component\Process\Process;

class Dump
{
    public static function dump()
    {
        $ret = '';

        if (!isset(\Kwf_Setup::$configClass)) {
            throw new Exception("Run Kwf_Setup::setUp() before using this method");
        }

        $dbConfig = \Kwf_Registry::get('dao')->getDbConfig();
        $cacheTables = \Kwf_Util_ClearCache::getInstance()->getDbCacheTables();

        $dumpCmd = "mysqldump";
        $dumpCmd .= " --host=".escapeshellarg($dbConfig['host']);
        $dumpCmd .= " --user=".escapeshellarg($dbConfig['username']);
        $dumpCmd .= " --password=".escapeshellarg($dbConfig['password']);

        $cmd = $dumpCmd;
        foreach ($cacheTables as $t) {
            $cmd .=" --ignore-table=".escapeshellarg($dbConfig['dbname'].'.'.$t);
        }
        $cmd .= " $dbConfig[dbname]";
        $process = new Process($cmd);
        $process->run();
        if (!$process->isSuccessful()) {
            throw new \RuntimeException($process->getErrorOutput());
        }

        $ret .= $process->getOutput();

        foreach ($cacheTables as $t) {
            $cmd = $dumpCmd;
            $cmd .= " --no-data ".escapeshellarg($dbConfig['dbname'])." ".escapeshellarg($t);
            $process = new Process($cmd);
            $process->run();
            if (!$process->isSuccessful()) {
                throw new \RuntimeException($process->getErrorOutput());
            }
            $ret .= $process->getOutput();
        }

        return $ret;
    }
}


text:
/* --------------------------
 * NeighborIndex.java
 * --------------------------
 * (C) Copyright 2005-2008, by Charles Fry and Contributors.
 *
 * Original Author:  Charles Fry
 *
 * $Id$
 *
 * Changes
 * -------
 * 13-Dec-2005 : Initial revision (CF);
 *
 */
package org.jgrapht.alg;

import java.util.*;

import org.jgrapht.*;
import org.jgrapht.event.*;
import org.jgrapht.util.*;

/**
 * Maintains a cache of each vertex's neighbors. While lists of neighbors can be
 * obtained from {@link Graphs}, they are re-calculated at each invocation by
 * walking a vertex's incident edges, which becomes inordinately expensive when
 * performed often.
 *
 *
Edge direction is ignored when evaluating neighbors; to take edge
 * direction into account when indexing neighbors, use {@link
 * DirectedNeighborIndex}.
 *
 *
A vertex's neighbors are cached the first time they are asked for (i.e.
 * the index is built on demand). The index will only be updated automatically
 * if it is added to the associated graph as a listener. If it is added as a
 * listener to a graph other than the one it indexes, results are undefined.

 *
 * @author Charles Fry
 * @since Dec 13, 2005
 */
public class NeighborIndex<V, E>
    implements GraphListener<V, E>
{

    Map<V, Neighbors<V, E>> neighborMap = new HashMap<V, Neighbors<V, E>>();
    private Graph<V, E> graph;

    /**
     * Creates a neighbor index for the specified undirected graph.
     *
     * @param g the graph for which a neighbor index is to be created.
     */
    public NeighborIndex(Graph<V, E> g)
    {
        // no need to distinguish directedgraphs as we don't do traversals
        graph = g;
    }

    /**
     * Returns the set of vertices which are adjacent to a specified vertex. The
     * returned set is backed by the index, and will be updated when the graph
     * changes as long as the index has been added as a listener to the graph.
     *
     * @param v the vertex whose neighbors are desired
     *
     * @return all unique neighbors of the specified vertex
     */
    public Set<V> neighborsOf(V v)
    {
        return getNeighbors(v).getNeighbors();
    }

    /**
     * Returns a list of vertices which are adjacent to a specified vertex. If
     * the graph is a multigraph, vertices may appear more than once in the
     * returned list. Because a list of neighbors can not be efficiently
     * maintained, it is reconstructed on every invocation, by duplicating
     * entries in the neighbor set. It is thus more efficient to use {@link
     * #neighborsOf(Object)} unless duplicate neighbors are important.
     *
     * @param v the vertex whose neighbors are desired
     *
     * @return all neighbors of the specified vertex
     */
    public List<V> neighborListOf(V v)
    {
        return getNeighbors(v).getNeighborList();
    }

    /**
     * @see GraphListener#edgeAdded(GraphEdgeChangeEvent)
     */
    public void edgeAdded(GraphEdgeChangeEvent<V, E> e)
    {
        E edge = e.getEdge();
        V source = graph.getEdgeSource(edge);
        V target = graph.getEdgeTarget(edge);

        // if a map does not already contain an entry,
        // then skip addNeighbor, since instantiating the map
        // will take care of processing the edge (which has already
        // been added)

        if (neighborMap.containsKey(source)) {
            getNeighbors(source).addNeighbor(target);
        } else {
            getNeighbors(source);
        }
        if (neighborMap.containsKey(target)) {
            getNeighbors(target).addNeighbor(source);
        } else {
            getNeighbors(target);
        }
    }

    /**
     * @see GraphListener#edgeRemoved(GraphEdgeChangeEvent)
     */
    public void edgeRemoved(GraphEdgeChangeEvent<V, E> e)
    {
        E edge = e.getEdge();
        V source = e.getEdgeSource();
        V target = e.getEdgeTarget();
        if (neighborMap.containsKey(source)) {
            neighborMap.get(source).removeNeighbor(target);
        }
        if (neighborMap.containsKey(target)) {
            neighborMap.get(target).removeNeighbor(source);
        }
    }

    /**
     * @see VertexSetListener#vertexAdded(GraphVertexChangeEvent)
     */
    public void vertexAdded(GraphVertexChangeEvent<V> e)
    {
        // nothing to cache until there are edges
    }

    /**
     * @see VertexSetListener#vertexRemoved(GraphVertexChangeEvent)
     */
    public void vertexRemoved(GraphVertexChangeEvent<V> e)
    {
        neighborMap.remove(e.getVertex());
    }

    private Neighbors<V, E> getNeighbors(V v)
    {
        Neighbors<V, E> neighbors = neighborMap.get(v);
        if (neighbors == null) {
            neighbors = new Neighbors<V, E>(v,
                Graphs.neighborListOf(graph, v));
            neighborMap.put(v, neighbors);
        }
        return neighbors;
    }

    /**
     * Stores cached neighbors for a single vertex. Includes support for live
     * neighbor sets and duplicate neighbors.
     */
    static class Neighbors<V, E>
    {
        private Map<V, ModifiableInteger> neighborCounts =
            new LinkedHashMap<V, ModifiableInteger>();

        // TODO could eventually make neighborSet modifiable, resulting
        // in edge removals from the graph
        private Set<V> neighborSet =
            Collections.unmodifiableSet(
                neighborCounts.keySet());

        public Neighbors(V v, Collection<V> neighbors)
        {
            // add all current neighbors
            for (V neighbor : neighbors) {
                addNeighbor(neighbor);
            }
        }

        public void addNeighbor(V v)
        {
            ModifiableInteger count = neighborCounts.get(v);
            if (count == null) {
                count = new ModifiableInteger(1);
                neighborCounts.put(v, count);
            } else {
                count.increment();
            }
        }

        public void removeNeighbor(V v)
        {
            ModifiableInteger count = neighborCounts.get(v);
            if (count == null) {
                throw new IllegalArgumentException(
                    "Attempting to remove a neighbor that wasn't present");
            }

            count.decrement();
            if (count.getValue() == 0) {
                neighborCounts.remove(v);
            }
        }

        public Set<V> getNeighbors()
        {
            return neighborSet;
        }

        public List<V> getNeighborList()
        {
            List<V> neighbors = new ArrayList<V>();
            for (
                Map.Entry<V, ModifiableInteger> entry
                : neighborCounts.entrySet())
            {
                V v = entry.getKey();
                int count = entry.getValue().intValue();
                for (int i = 0; i < count; i++) {
                    neighbors.add(v);
                }
            }
            return neighbors;
        }
    }
}

// End NeighborIndex.java


text:
import Drop from './Drop';
import Divider from './Divider';
import Header from './Header';
import Item from './Item';
import Link from './Link';
import Menu from './Menu';
import Toggle from './Toggle';

export { Divider, Header, Item, Link, Menu, Toggle };
export default Drop;


text:
package org.apache.flink.streaming.api.operators;

import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.typeinfo.TypeInformation;
import org.apache.flink.api.java.typeutils.InputTypeConfigurable;
import org.apache.flink.streaming.api.functions.sink.OutputFormatSinkFunction;
import org.apache.flink.streaming.api.functions.source.InputFormatSourceFunction;

import static org.apache.flink.util.Preconditions.checkNotNull;

/**
 * Simple factory which just wrap existed {@link StreamOperator}.
 *
 * @param <OUT> The output type of the operator
 */
@Internal
public class SimpleOperatorFactory<OUT> extends AbstractStreamOperatorFactory<OUT> {

    private final StreamOperator<OUT> operator;

    /** Create a SimpleOperatorFactory from existed StreamOperator. */
    @SuppressWarnings("unchecked")
    public static <OUT> SimpleOperatorFactory<OUT> of(StreamOperator<OUT> operator) {
        if (operator == null) {
            return null;
        } else if (operator instanceof StreamSource
                && ((StreamSource) operator).getUserFunction()
                        instanceof InputFormatSourceFunction) {
            return new SimpleInputFormatOperatorFactory<OUT>((StreamSource) operator);
        } else if (operator instanceof StreamSink
                && ((StreamSink) operator).getUserFunction() instanceof OutputFormatSinkFunction) {
            return new SimpleOutputFormatOperatorFactory<>((StreamSink) operator);
        } else if (operator instanceof AbstractUdfStreamOperator) {
            return new SimpleUdfStreamOperatorFactory<OUT>((AbstractUdfStreamOperator) operator);
        } else {
            return new SimpleOperatorFactory<>(operator);
        }
    }

    protected SimpleOperatorFactory(StreamOperator<OUT> operator) {
        this.operator = checkNotNull(operator);
        if (operator instanceof SetupableStreamOperator) {
            this.chainingStrategy = ((SetupableStreamOperator) operator).getChainingStrategy();
        }
    }

    public StreamOperator<OUT> getOperator() {
        return operator;
    }

    @SuppressWarnings("unchecked")
    @Override
    public <T extends StreamOperator<OUT>> T createStreamOperator(
            StreamOperatorParameters<OUT> parameters) {
        if (operator instanceof AbstractStreamOperator) {
            ((AbstractStreamOperator) operator).setProcessingTimeService(processingTimeService);
        }
        if (operator instanceof SetupableStreamOperator) {
            ((SetupableStreamOperator) operator)
                    .setup(
                            parameters.getContainingTask(),
                            parameters.getStreamConfig(),
                            parameters.getOutput());
        }
        return (T) operator;
    }

    @Override
    public void setChainingStrategy(ChainingStrategy strategy) {
        this.chainingStrategy = strategy;
        if (operator instanceof SetupableStreamOperator) {
            ((SetupableStreamOperator) operator).setChainingStrategy(strategy);
        }
    }

    @Override
    public boolean isStreamSource() {
        return operator instanceof StreamSource;
    }

    @Override
    public boolean isLegacySource() {
        return operator instanceof StreamSource;
    }

    @Override
    public boolean isOutputTypeConfigurable() {
        return operator instanceof OutputTypeConfigurable;
    }

    @SuppressWarnings("unchecked")
    @Override
    public void setOutputType(TypeInformation<OUT> type, ExecutionConfig executionConfig) {
        ((OutputTypeConfigurable<OUT>) operator).setOutputType(type, executionConfig);
    }

    @Override
    public boolean isInputTypeConfigurable() {
        return operator instanceof InputTypeConfigurable;
    }

    @Override
    public void setInputType(TypeInformation<?> type, ExecutionConfig executionConfig) {
        ((InputTypeConfigurable) operator).setInputType(type, executionConfig);
    }

    @Override
    public Class<? extends StreamOperator> getStreamOperatorClass(ClassLoader classLoader) {
        return operator.getClass();
    }
}


text:
Allegro YACE
============
Allegro YACE is a front end for YACE (Yet Another Chip8 Emulator) written in C++ using Allegro 5.

Usage
-----
###Running
To run Allegro YACE, type the following command in a terminal\\command line (inside of the Allegro YACE directory):
`yace [<game>] [<configuration-file>]`

`[<game>]` - The Chip8 game to run. **(Optional)**
`[<configuration-file>]` - The configuration file to use. **(Optional)**

The easiest way to run Allegro YACE is simply by typing `yace` or double-clicking the executable.

###Keys
`ESCAPE - Exit Allegro YACE`
`F1 - Load game`
`F2 - Toggle timer on/off`
`F3 - Step emulation (Only if the timer is stopped)`

###Configurations
In the configuration file it's possible to change key-bindings (and soon BG-/FG-color). It's possible to have several configuration files, however, only one can be used at a time.

The default configuration has the following key layout:

Compiling
---------
###Requirements
* [YACE Back end](https://github.com/Johoel/YACE)
* Allegro 5.0.4 (or greater)

**The file hierarchy should look something like this with the YACE back end in place.**

Allegro YACE/

include/

src/

YACE/

include/

src/

###Compiling
There's a *makefile* provided with Allegro YACE. It's very basic and doesn't allow for adding new source files without having to add them manually into the makefile. Follow these steps to compile Allegro YACE:

1. Open a terminal\\command line
2. Change directory to the Allegro YACE directory.
3.  * To compile Allegro YACE **without** debugging enabled, simply write
    `make ALLEGRO_PATH=<path-to-allegro>`

    The output file will be named *yace*.

    * To compile Allegro YACE **with** debugging enabled, simply write
    `make debug ALLEGRO_PATH=<path-to-allegro>`

    The output file will be named *yace-debug*.

Example 1 - Compiling **without** debugging:

`make ALLEGRO_PATH="C:\allegro-5.0.4"`

**(Note: Don't put a front-/backslash at the end of the path.)**

To-Do list
----------
+ Improve event handling (like keyboard input)
+ Add sound support
+ Add possibility to set user-defined colors in configuration file (default is White BG & Black FG).


text:
import { Meteor } from 'meteor/meteor';
import { AssessmentItems } from '../../../api/databet_collections/AssessmentItems';
import { UploadedFiles } from '../../../api/databet_collections/UploadedFiles';

Template.UnreachableFiles.onCreated(function () {
  this.download_error = new ReactiveVar();
  this.waiting_for_list_of_unreachable_assessment_files = new ReactiveVar();
  this.list_of_unreachable_assessment_files = new ReactiveVar();

  Template.instance().download_error.set(false);
  Template.instance().waiting_for_list_of_unreachable_assessment_files.set(true);
  Template.instance().list_of_unreachable_assessment_files.set([]);
});

Template.UnreachableFiles.helpers({

  "waiting_for_list_of_unreachable_assessment_files": function () {
    return Template.instance().waiting_for_list_of_unreachable_assessment_files.get();
  },

  "list_of_unreachable_assessment_files": function () {
    return Template.instance().list_of_unreachable_assessment_files.get();
  },

  "construct_list_of_unreachable_assessment_files": function () {
    var set_to_false_when_done = Template.instance().waiting_for_list_of_unreachable_assessment_files;
    var set_to_true_if_error = Template.instance().download_error;
    var set_to_results = Template.instance().list_of_unreachable_assessment_files;

    // Asynchronous call with callbacks
    Meteor.call("get_list_of_uploaded_files", "assessment_uploads", function (error, result) {
      if (error) {
        set_to_true_if_error.set(true);
      } else {

        let list_of_known_files = UploadedFiles.find({}).fetch();
        let list_of_known_filenames = [];
        for (let i=0; i < list_of_known_files.length; i++) {
          list_of_known_filenames.push(list_of_known_files[i].path.replace(result[0]+"/",""));
        }

        // Build list of unreachable filenames
        let list_of_unreachable_filenames = [];
        for (let j = 1; j < result.length; j++) {
          if (list_of_known_filenames.indexOf(result[j]) < 0) {
            list_of_unreachable_filenames.push(result[0] + result[j]);
          } else {
          }
        }
        set_to_results.set(list_of_unreachable_filenames);
        set_to_false_when_done.set(false);
      }
    });
    return "";
  },

});


text:
var VM;

function updateSankey(nodes,links,vm)
{

var svg, tooltip, biHiSankey, path, defs, colorScale, highlightColorScale, isTransitioning;

var OPACITY = {
    NODE_DEFAULT: 0.9,
    NODE_FADED: 0.1,
    NODE_HIGHLIGHT: 0.8,
    LINK_DEFAULT: 0.6,
    LINK_FADED: 0.05,
    LINK_HIGHLIGHT: 0.9
  },
  TYPES = [],
  TYPE_COLORS = ["#1b9e77", "#d95f02", "#7570b3", "#e7298a", "#66a61e", "#e6ab02", "#a6761d"],
  TYPE_HIGHLIGHT_COLORS = ["#66c2a5", "#fc8d62", "#8da0cb", "#e78ac3", "#a6d854", "#ffd92f", "#e5c494"],
  LINK_COLOR = "#b3b3b3",
  INFLOW_COLOR = "#2E86D1",
  OUTFLOW_COLOR = "#D63028",
  NODE_WIDTH = 36,
  COLLAPSER = {
    RADIUS: NODE_WIDTH / 2,
    SPACING: 2
  },
  OUTER_MARGIN = 10,
  MARGIN = {
    TOP: 2 * (COLLAPSER.RADIUS + OUTER_MARGIN),
    RIGHT: OUTER_MARGIN,
    BOTTOM: OUTER_MARGIN,
    LEFT: OUTER_MARGIN
  },
  TRANSITION_DURATION = 400,
  HEIGHT = 500 - MARGIN.TOP - MARGIN.BOTTOM,
  WIDTH = 960 - MARGIN.LEFT - MARGIN.RIGHT,
  LAYOUT_INTERATIONS = 32,
  REFRESH_INTERVAL = 7000;

var formatNumber = function (d) {
  var numberFormat = d3.format(",.0f"); // zero decimal places
  return numberFormat(d);
},

formatFlow = function (d) {
  var flowFormat = d3.format(",.0f"); // zero decimal places with sign
  return flowFormat(Math.abs(d)) + (d < 0 ? " CR" : " DR");
},

// Used when temporarily disabling user interractions to allow animations to complete
disableUserInterractions = function (time) {
  isTransitioning = true;
  setTimeout(function(){
    isTransitioning = false;
  }, time);
},

hideTooltip = function () {
  return tooltip.transition()
    .duration(TRANSITION_DURATION)
    .style("opacity", 0);
},

showTooltip = function () {
  return tooltip
    .style("left", d3.event.pageX + "px")
    .style("top", d3.event.pageY + 15 + "px")
    .transition()
      .duration(TRANSITION_DURATION)
      .style("opacity", 1);
};
colorScale = d3.scale.ordinal().domain(TYPES).range(TYPE_COLORS),
highlightColorScale = d3.scale.ordinal().domain(TYPES).range(TYPE_HIGHLIGHT_COLORS),

svg = d3.select("#chart_dep").append("svg")
        .attr("width", WIDTH + MARGIN.LEFT + MARGIN.RIGHT)
        .attr("height", HEIGHT + MARGIN.TOP + MARGIN.BOTTOM)
      .append("g")
        .attr("transform", "translate(" + MARGIN.LEFT + "," + MARGIN.TOP + ")");

svg.append("g").attr("id", "links");
svg.append("g").attr("id", "nodes");
svg.append("g").attr("id", "collapsers");

tooltip = d3.select("#chart_dep").append("div").attr("id", "tooltip");

tooltip.style("opacity", 0)
    .append("p")
      .attr("class", "value");

biHiSankey = d3.biHiSankey();

// Set the biHiSankey diagram properties
biHiSankey
  .nodeWidth(NODE_WIDTH)
  .nodeSpacing(10)
  .linkSpacing(4)
  .arrowheadScaleFactor(0.5) // Specifies that 0.5 of the link's stroke WIDTH should be allowed for the marker at the end of the link.
  .size([WIDTH, HEIGHT]);

path = biHiSankey.link().curvature(0.45);

defs = svg.append("defs");

defs.append("marker")
  .style("fill", LINK_COLOR)
  .attr("id", "arrowHead")
  .attr("viewBox", "0 0 6 10")
  .attr("refX", "1")
  .attr("refY", "5")
  .attr("markerUnits", "strokeWidth")
  .attr("markerWidth", "1")
  .attr("markerHeight", "1")
  .attr("orient", "auto")
  .append("path")
    .attr("d", "M 0 0 L 1 0 L 6 5 L 1 10 L 0 10 z");

defs.append("marker")
  .style("fill", OUTFLOW_COLOR)
  .attr("id", "arrowHeadInflow")
  .attr("viewBox", "0 0 6 10")
  .attr("refX", "1")
  .attr("refY", "5")
  .attr("markerUnits", "strokeWidth")
  .attr("markerWidth", "1")
  .attr("markerHeight", "1")
  .attr("orient", "auto")
  .append("path")
    .attr("d", "M 0 0 L 1 0 L 6 5 L 1 10 L 0 10 z");

defs.append("marker")
  .style("fill", INFLOW_COLOR)
  .attr("id", "arrowHeadOutlow")
  .attr("viewBox", "0 0 6 10")
  .attr("refX", "1")
  .attr("refY", "5")
  .attr("markerUnits", "strokeWidth")
  .attr("markerWidth", "1")
  .attr("markerHeight", "1")
  .attr("orient", "auto")
  .append("path")
    .attr("d", "M 0 0 L 1 0 L 6 5 L 1 10 L 0 10 z");
function update () {
  var link, linkEnter, node, nodeEnter, collapser, collapserEnter;

  function dragmove(node) {
    node.x = Math.max(0, Math.min(WIDTH - node.width, d3.event.x));
    node.y = Math.max(0, Math.min(HEIGHT - node.height, d3.event.y));
    d3.select(this).attr("transform", "translate(" + node.x + "," + node.y + ")");
    biHiSankey.relayout();
    svg.selectAll(".node").selectAll("circle").attr("height", function (d) { return d.height; });
    link.attr("d", path);
  }

  function containChildren(node) {
    node.children.forEach(function (child) {
      child.state = "contained";
      child.parent = this;
      child._parent = null;
      containChildren(child);
    }, node);
  }

  function expand(node) {
    VM.setcurrentTask(node.name);

    node.state = "expanded";
    node.children.forEach(function (child) {
      child.state = "collapsed";
      child._parent = this;
      child.parent = null;
      containChildren(child);
    }, node);
  }

  function collapse(node) {
    node.state = "collapsed";
    containChildren(node);
  }

  function restoreLinksAndNodes() {
    link
      .style("stroke", LINK_COLOR)
      .style("marker-end", function () { return 'url(#arrowHead)'; })
      .transition()
        .duration(TRANSITION_DURATION)
        .style("opacity", OPACITY.LINK_DEFAULT);

    node
      .selectAll("circle")
        .style("fill", function (d) {
          d.color = colorScale(d.type.replace(/ .*/, ""));
          return d.color;
        })
        .style("stroke", function (d) {
          return d3.rgb(colorScale(d.type.replace(/ .*/, ""))).darker(0.1);
        })
        .style("fill-opacity", OPACITY.NODE_DEFAULT);

    node.filter(function (n) { return n.state === "collapsed"; })
      .transition()
        .duration(TRANSITION_DURATION)
        .style("opacity", OPACITY.NODE_DEFAULT);
  }

  function showHideChildren(node) {
    disableUserInterractions(2 * TRANSITION_DURATION);
    hideTooltip();
    if (node.state === "collapsed") { expand(node); }
    else { collapse(node); }

    biHiSankey.relayout();
    update();
    link.attr("d", path);
    restoreLinksAndNodes();
  }

  function highlightConnected(g) {
    link.filter(function (d) { return d.source === g; })
      .style("marker-end", function () { return 'url(#arrowHeadInflow)'; })
      .style("stroke", OUTFLOW_COLOR)
      .style("opacity", OPACITY.LINK_DEFAULT);

    link.filter(function (d) { return d.target === g; })
      .style("marker-end", function () { return 'url(#arrowHeadOutlow)'; })
      .style("stroke", INFLOW_COLOR)
      .style("opacity", OPACITY.LINK_DEFAULT);
  }

  function fadeUnconnected(g) {
    link.filter(function (d) { return d.source !== g && d.target !== g; })
      .style("marker-end", function () { return 'url(#arrowHead)'; })
      .transition()
        .duration(TRANSITION_DURATION)
        .style("opacity", OPACITY.LINK_FADED);

    node.filter(function (d) {
      return (d.name === g.name) ? false : !biHiSankey.connected(d, g);
    }).transition()
      .duration(TRANSITION_DURATION)
      .style("opacity", OPACITY.NODE_FADED);
  }

  link = svg.select("#links").selectAll("path.link")
    .data(biHiSankey.visibleLinks(), function (d) { return d.id; });

  link.transition()
    .duration(TRANSITION_DURATION)
    .style("stroke-WIDTH", function (d) { return Math.max(1, d.thickness); })
    .attr("d", path)
    .style("opacity", OPACITY.LINK_DEFAULT);

  link.exit().remove();

  linkEnter = link.enter().append("path")
    .attr("class", "link")
    .style("fill", "none");

  linkEnter.on('mouseenter', function (d) {
    if (!isTransitioning) {
      showTooltip().select(".value").text(function () {
        if (d.dicircleion > 0) {
	return d.source.name + " -> " + d.target.name + "\n" + formatNumber(d.value);
        }
	return d.target.name + " -> " + d.source.name + "\n" + formatNumber(d.value);
      });

      d3.select(this)
        .style("stroke", LINK_COLOR)
        .transition()
          .duration(TRANSITION_DURATION / 2)
          .style("opacity", OPACITY.LINK_HIGHLIGHT);
    }
  });

  linkEnter.on('mouseleave', function () {
    if (!isTransitioning) {
      hideTooltip();

      d3.select(this)
        .style("stroke", LINK_COLOR)
        .transition()
          .duration(TRANSITION_DURATION / 2)
          .style("opacity", OPACITY.LINK_DEFAULT);
    }
  });

  linkEnter.sort(function (a, b) { return b.thickness - a.thickness; })
    .classed("leftToRight", function (d) {
      return d.dicircleion > 0;
    })
    .classed("rightToLeft", function (d) {
      return d.dicircleion < 0;
    })
    .style("marker-end", function () {
      return 'url(#arrowHead)';
    })
    .style("stroke", LINK_COLOR)
    .style("opacity", 0)
    .transition()
      .delay(TRANSITION_DURATION)
      .duration(TRANSITION_DURATION)
      .attr("d", path)
      .style("stroke-WIDTH", function (d) { return 5; })
      .style("opacity", OPACITY.LINK_DEFAULT);

  node = svg.select("#nodes").selectAll(".node")
      .data(biHiSankey.collapsedNodes(), function (d) { return d.id; });

  node.transition()
    .duration(TRANSITION_DURATION)
    .attr("transform", function (d) { return "translate(" + d.x + "," + d.y + ")"; })
    .style("opacity", OPACITY.NODE_DEFAULT)
    .select("circle")
      .style("fill", function (d) {

        d.color = colorScale(d.type.replace(/ .*/, ""));
        return d.color;
      })
      .style("stroke", function (d) { return d3.rgb(colorScale(d.type.replace(/ .*/, ""))).darker(0.1); })
      .style("stroke-WIDTH", "1px")
      .attr("height", function (d) { return d.height; })
      .attr("width", biHiSankey.nodeWidth());

  node.exit()
    .transition()
      .duration(TRANSITION_DURATION)
      .attr("transform", function (d) {
        var collapsedAncestor, endX, endY;
        collapsedAncestor = d.ancestors.filter(function (a) {
          return a.state === "collapsed";
        })[0];
        endX = collapsedAncestor ? collapsedAncestor.x : d.x;
        endY = collapsedAncestor ? collapsedAncestor.y : d.y;
        return "translate(" + endX + "," + endY + ")";
      })
      .remove();

  nodeEnter = node.enter().append("g").attr("class", "node");

  nodeEnter
    .attr("transform", function (d) {
      var startX = d._parent ? d._parent.x : d.x,
          startY = d._parent ? d._parent.y : d.y;
      return "translate(" + startX + "," + startY + ")";
    })
    .style("opacity", 1e-6)
    .transition()
      .duration(TRANSITION_DURATION)
      .style("opacity", OPACITY.NODE_DEFAULT)
      .attr("transform", function (d) { return "translate(" + d.x + "," + d.y + ")"; });

  nodeEnter.append("text");
  nodeEnter.append("circle")
    .style("fill", function (d) {
      d.color = colorScale(d.type.replace(/ .*/, ""));
      return d.color;
    })
    .style("stroke", function (d) {
      return d3.rgb(colorScale(d.type.replace(/ .*/, ""))).darker(0.1);
    })
    .style("stroke-WIDTH", "1px")
    .attr("r", 20)

  node.on("mouseenter", function (g) {
    if (!isTransitioning) {
      restoreLinksAndNodes();
      highlightConnected(g);
      fadeUnconnected(g);

      d3.select(this).select("circle")
        .style("fill", function (d) {
          d.color = d.netFlow > 0 ? INFLOW_COLOR : OUTFLOW_COLOR;
          return d.color;
        })
        .style("stroke", function (d) {
          return d3.rgb(d.color).darker(0.1);
        })
        .style("fill-opacity", OPACITY.LINK_DEFAULT);

      tooltip
        .style("left", g.x + MARGIN.LEFT + "px")
        .style("top", g.y + g.height + MARGIN.TOP + 15 + "px")
        .transition()
          .duration(TRANSITION_DURATION)
          .style("opacity", 1).select(".value")
          .text(function () {
            var additionalInstructions = g.children.length ? "\n(Double click to expand)" : "";
            return g.name + "\n" + additionalInstructions;
          });
    }
  });

  node.on("mouseleave", function () {
    if (!isTransitioning) {
      hideTooltip();
      restoreLinksAndNodes();
    }
  });

  node.filter(function (d) { return d.children.length; })
    .on("dblclick", showHideChildren);

  // allow nodes to be dragged to new positions
  node.call(d3.behavior.drag()
    .origin(function (d) { return d; })
    .on("dragstart", function () { this.parentNode.appendChild(this); })
    .on("drag", dragmove));

  // add in the text for the nodes
  node.filter(function (d) { return d.value !== 0; })
    .select("text")
      .attr("x", -6)
      .attr("y", function (d) { return d.height / 2; })
      .attr("dy", ".35em")
      .attr("text-anchor", "end")
      .attr("transform", null)
      .text(function (d) { return d.name; })
    .filter(function (d) { return d.x < WIDTH / 2; })
      .attr("x", 6 + biHiSankey.nodeWidth())
      .attr("text-anchor", "start");

  collapser = svg.select("#collapsers").selectAll(".collapser")
    .data(biHiSankey.expandedNodes(), function (d) { return d.id; });

  collapserEnter = collapser.enter().append("g").attr("class", "collapser");

  collapserEnter.append("circle")
    .attr("r", COLLAPSER.RADIUS)
    .style("fill", function (d) {
      d.color = colorScale(d.type.replace(/ .*/, ""));
      return d.color;
    });

  collapserEnter
    .style("opacity", OPACITY.NODE_DEFAULT)
    .attr("transform", function (d) {
      return "translate(" + (d.x + d.width / 2) + "," + (d.y + COLLAPSER.RADIUS) + ")";
    });

  collapserEnter.on("dblclick", showHideChildren);

  collapser.select("circle")
    .attr("r", COLLAPSER.RADIUS);

  collapser.transition()
    .delay(TRANSITION_DURATION)
    .duration(TRANSITION_DURATION)
    .attr("transform", function (d, i) {
      return "translate("
        + (COLLAPSER.RADIUS + i * 2 * (COLLAPSER.RADIUS + COLLAPSER.SPACING))
        + ","
        + (-COLLAPSER.RADIUS - OUTER_MARGIN)
        + ")";
    });

  collapser.on("mouseenter", function (g) {
    if (!isTransitioning) {
      showTooltip().select(".value")
        .text(function () {
          return g.name + "\n(Double click to collapse)";
        });

      var highlightColor = highlightColorScale(g.type.replace(/ .*/, ""));

      d3.select(this)
        .style("opacity", OPACITY.NODE_HIGHLIGHT)
        .select("circle")
          .style("fill", highlightColor);

      node.filter(function (d) {
        return d.ancestors.indexOf(g) >= 0;
      }).style("opacity", OPACITY.NODE_HIGHLIGHT)
        .select("circle")
          .style("fill", highlightColor);
    }
  });

  collapser.on("mouseleave", function (g) {
    if (!isTransitioning) {
      hideTooltip();
      d3.select(this)
        .style("opacity", OPACITY.NODE_DEFAULT)
        .select("circle")
          .style("fill", function (d) { return d.color; });

      node.filter(function (d) {
        return d.ancestors.indexOf(g) >= 0;
      }).style("opacity", OPACITY.NODE_DEFAULT)
        .select("circle")
          .style("fill", function (d) { return d.color; });
    }
  });

  collapser.exit().remove();

}
    VM = vm;
    biHiSankey
        .nodes(nodes)
        .links(links)
        .initializeNodes(function (node) {
           node.state = node.parent ? "contained" : "collapsed";
        })
        .layout(LAYOUT_INTERATIONS);

    disableUserInterractions(2 * TRANSITION_DURATION);

    update();

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<groupId>net.ccfish</groupId>
	<artifactId>sctalk</artifactId>
	<version>0.3.0-SNAPSHOT</version>
	<packaging>pom</packaging>

    <modules>
        <module>talk-common</module>
        <module>eureka-server</module>
        <module>message-server</module>
        <module>talk-db-proxy</module>
    </modules>

</project>


text:
package org.usergrid.persistence.query;

import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.usergrid.cassandra.Concurrent;

/**
 * @author tnine
 *
 */
public class SingleOrderByComplexIntersectionCollectionIT extends AbstractIteratingQueryIT
{
    @Test
    public void singleOrderByComplexIntersectionCollection() throws Exception {
        singleOrderByComplexIntersection(new CollectionIoHelper());
    }
}


text:
<?php echo lang('forgot_password_heading');?>

<?php echo $message;?>

					<?php echo form_open("auth/forgot_password");?>
					<fieldset>

								<?php echo (($type=='email') ? sprintf(lang('forgot_password_email_label'), $identity_label) : sprintf(lang('forgot_password_identity_label'), $identity_label));?>
								<?php echo form_input($identity);?>

						<?php echo form_submit('submit', lang('forgot_password_submit_btn'),'class="btn btn-primary"');?>
					</fieldset>
					<?php echo form_close();?>


text:
/* TypoPRO Open Sans Condensed Bold */
@font-face {
    font-family:  'TypoPRO Open Sans';
    src:          url('TypoPRO-OpenSans-CondBold.eot');
    src:          local('*'),
                  url('TypoPRO-OpenSans-CondBold.eot?#iefix') format('embedded-opentype'),
                  url('TypoPRO-OpenSans-CondBold.woff') format('woff'),
                  url('TypoPRO-OpenSans-CondBold.ttf') format('truetype');
    font-style:   normal;
    font-weight:  bold;
    font-stretch: condensed;
    font-variant: normal;
}


text:
aliases:
- /installation/configuration/export
tags:
- automatic export
- configuration
- export
- preferences
title: Export
weight: 11
---

{{% preferences/header %}}

## BibTeX

### Export unicode as plain-text latex commands (recommended)

default: `yes`

BibTeX has really spotty Unicode support, so you generally want this on. It will translate things like accented characters to their equivalent LaTeX constructs on export.

### Disregard name prefixes when sorting

default: `no`

Name handling is a lot more complex than I had ever thought it to be. A *lot* more complex. BibTeX has really limited ways of dealing with names with particles (van, von, de, etc). If you turn this on, BBT will add code to have `van Gogh` sorted under `Gogh`.

### Add URLs to BibTeX export:

default: `no`

Most BibTeX styles do not support DOI/URL fields. Of the styles that do support them, many forget to load the required 'url' package, so make sure to load it yourself. DOI and URL fields are so-called 'verbatim' fields, and without the 'url' package loaded compilation will likely fail.

Options:

* no
* in the 'note' field
* in the 'note' field, but assuming the 'url' package is not loaded
* in the 'url' field
* in the 'url' field, but assuming the 'url' package is not loaded

## BibLaTeX

### Export unicode as plain-text latex commands

default: `no`

BibLaTeX actually has really good Unicode support, so you generally want this off. But for some geezers such as me it is simply more pleasing to have things like accented characters translated to their equivalent LaTeX constructs on export.

### Use BibLaTeX extended name format (requires biblatex 3.5)

default: `no`

Use the extended biber 2.7 format for names with particles - only works in BibLaTeX 3.5 or later. This biblatex has a new (less ambiguous) way to store creator names. It's technically superior, but the LaTeX world moves slowly, so many people won't have it yet. But if you're an early adopter, you can enable it here

## Fields

### Export language as

default: `langid`

Export either langid, language or both fields based on the item language (if any).

Options:

* langid
* language
* both

### When an item has both a DOI and a URL, export

default: `both`

Does what it says on the tin, really. If an item has both a DOI and an URL, you can choose to have them both exported, or either one of them. Note that for BibTeX, you must load the `url` package when you have `doi` or `url` fields. `doi` and `url` fields are so-called `verbatim` fields with different escaping rules, and BibTeX compilation will likely error out without the package loaded.

Options:

* both
* DOI
* URL

### Fields to omit from export (comma-separated):

default: `<not set>`

If there are some fields you don't want in your bibtex files (such as `note` for example), add a list of them here, separated by comma's.

### Include JabRef-specific metadata:

default: `no`

Export JabRef-specific fields: timestamps, titles for attachments, and groups for each collection an item is part of. Note that having this on will disable caching in exports, which is really undesirable specifically for auto-exports.

Options:

* no
* for JabRef 3
* for JabRef 4
* for JabRef 5

## Quick-Copy

### Quick-Copy/drag-and-drop citations

#### Quick-Copy format

default: `LaTeX citation`

Used for drag-and-drop/quick copy using Better BibTeX citation keys. In the Zotero "Export" pane, choose `Better BibTeX Quick Copy` as the default export format for quick copy, and choose the desired format for the drag-and-drop citations here.

Options:

* LaTeX citation
* Cite Keys
* Pandoc citation
* Org-mode select link
* org-ref citation
* org-ref v3 citation
* RTF Scan marker
* Roam Cite Key
* Atom (https://atom.io/packages/zotero-citations)
* GitBook
* Zotero select link
* Eta template

#### LaTeX command

default: `cite`

Used for drag-and-drop/quick copy citations in `LaTeX` format. Set the desired LaTeX citation command here. If you set this to `citep`, drag-and-drop citations will yield `\citep{key1,key2,...}`

#### Surround Pandoc citations with brackets

default: `no`

Used for drag-and-drop/quick copy citations in `Pandoc` format. You can use this option to select whether you want to have these pandoc citations surrounded with brackets or not.

#### Org-mode select link

default: `using Zotero item key`

OrgMode to select items in your library

Options:

* using Zotero item key
* using Better BibTeX citation key

#### Zotero select link

default: `using Zotero item key`

Hyperlink to select items in your library

Options:

* using Zotero item key
* using Better BibTeX citation key

#### Eta template

default: `<not set>`

Used for drag-and-drop/quick copy citations in `Build your own` format. This is going to get pretty technical, sorry. You can paste a [Eta](https://eta.js.org/) template here. Inside the template, you will find an array `it.items`, each of which is a serialized Zotero item. To find out what an item looks like inside the template, export some items as BetterBibTeX JSON.

## postscript

### postscript

default: `<not set>`

Snippet of javascript to run [after each entry generation]({{ ref . "exporting/scripting.md" }}).

## Miscellaneous

### Automatically abbreviate journal title if none is set explicitly

default: `no`

If set, generates journal abbreviations on export using the Zotero journal abbreviator, according to the abbreviation style selected in the list below the checkbox.

### Include comments about potential problems with the exported entries

default: `no`

Generate quality reports for exported entries. These show up only in BibTeX and BibLaTeX report formats and indicate things like missing required fields and duplicate citation keys.

### Include automatic tags in export

default: `yes`

Some importers or Zotero extensions (such as the ShortDOI manager for example) create tags on items that are more for item management than that they are descriptive of the item. When this is off, such tags will not be included in the export.

### When converting to plain-text latex commands:

default: `Minimize the number of switches between math-mode and text-mode`

When a unicode character can be exported as either a math-mode or text-mode command, map to:

* `minimal-packages`: if both a math-mode and a text-mode mapping is available, use the version that does not require extra packages to be loaded. * `conservative`: if both a math-mode and a text-mode mapping is available, stay in the mode of the previously mapped character if possible. This minimizes the number of generated `$`s in the output. * `text`: if both a math-mode and a text-mode mapping is available, prefer text. * `math`: if both a math-mode and a text-mode mapping is available, prefer math.

Options:

* Minimize additional latex packages required
* Minimize the number of switches between math-mode and text-mode
* Prefer text-mode replacements
* Prefer math-mode replacements

### Apply title-casing to titles

default: `yes`

If you're dead-set on ignoring both BibTeX/BibLaTeX best practice (see the BBT FAQ) and the Zotero recommendations on title/sentence casing, you can turn this off to suppress [title casing for English items]({{ ref . "support/faq#bbt-is-changing-the-capitalization-of-my-titles-why" }})

### Apply case-protection to capitalized words by enclosing them in braces

default: `yes`

If you're dead-set on ignoring both BibTeX/BibLaTeX best practice (see the BBT FAQ) and the Zotero recommendations on title/sentence casing, you can turn this off to suppress [automatic brace-protection for words with uppercase letters]({{ ref . "support/faq#why-the-double-braces" }}).

### Cache

#### Retain export cache across upgrades

default: `no`

By default, BBT clears all caches whenever BBT or Zotero is upgraded. I can't realistically predict whether a change in Zotero or BBT is going to affect the output generated for any given item, so to be sure you always have the latest export-affecting fixes, the caches are discarded when a new version of either is detected. If you have a very large library however, of which you regularly export significant portions, you might want to retain the cached items even if that does come with the risk that you get wrong output on export that has been fixed in the interim.

If you have this on, and you experience any problem that is not the cache getting dropped on upgrade, you *must* clear the cache and reproduce the problem. When you change this setting, as with any setting change, the cache will be dropped.

#### Enable caching for background exports

default: `yes`

Even though BBT exports happen in a separate thread, some work needs to be done before the background export can start. Part of this work is preloading the cache. You can shorten the (blocking) preparation time by turning off the cache, at the cost of longer export times.


text:
import MatchDetails from '../MatchDetails';
import RelicRecoveryMatchDetails from './RelicRecoveryMatchDetails';
import VelocityVortexMatchDetails from './VelocityVortexMatchDetails';
import RoverRuckusMatchDetails from './RoverRuckusMatchDetails';
import SkystoneMatchDetails from './SkystoneMatchDetails';
import UltimateGoalMatchDetails from './UltimateGoalMatchDetails';
import FreightFrenzyMatchDetails from './FreightFrenzyMatchDetails';

export function getMatchDetails(seasonKey: string): MatchDetails {
  switch (seasonKey) {
    case '1617':
      return new VelocityVortexMatchDetails();
    case '1718':
      return new RelicRecoveryMatchDetails();
    case '1819':
      return new RoverRuckusMatchDetails();
    case '1920':
      return new SkystoneMatchDetails();
    case '2021':
      return new UltimateGoalMatchDetails();
    case '2122':
      return new FreightFrenzyMatchDetails();
    default:
      return new MatchDetails();
  }
}


text:
import React from 'react';
import PropTypes from 'prop-types';
import { LocalForm, actions, Control } from 'react-redux-form';

import { Input, Combobox, PokeCombobox, FormsCombobox, ToggleGroup, MovesList,
  Check } from './controls/Controls'
import validate from './controls/validate';

export class RRForm extends React.Component {
  constructor() {
    super();
    this.getDispatch = this.getDispatch.bind(this);
    this.handleSubmitFailed = this.handleSubmitFailed.bind(this);
  }

  getDispatch(dispatch) {
    this.dispatch = dispatch;
    if (this.props.getDispatch)
      this.props.getDispatch(dispatch);
  }

  handleSubmitFailed(form) {
    this.dispatch(actions.setDirty('local'));
    let toFocus;
    for (let i in form) {
      let model = 'local.' + i;
      let valid = form[i].valid;
      if (valid == null) {
        valid = form[i].$form.valid;
      }
      if (!valid) {
        toFocus = model;
      }
    }
    this.dispatch(actions.focus(toFocus));
  }

  render() {
    return (
      <LocalForm autoComplete='off' hideNativeErrors
        getDispatch={this.getDispatch}
        onUpdate={this.props.onUpdate}
        onSubmitFailed={this.handleSubmitFailed}
        onSubmit={this.props.onSubmit}>
        {this.props.children}
      </LocalForm>
    );
  }
};

RRForm.propTypes = {
  getDispatch: PropTypes.func,
  onUpdate: PropTypes.func,
  onSubmit: PropTypes.func
};

export class RRFControl extends React.Component {
  constructor(props) {
    super(props);
    switch (props.component) {
      case 'combobox':
        this.component = validate(Combobox);
        break;
      case 'pokemon':
        this.component = validate(PokeCombobox);
        break;
      case 'forms':
        this.component = validate(FormsCombobox);
        break;
      case 'moves':
        this.component = validate(MovesList);
        break;
      case 'check':
        this.component = validate(Check);
        break;
      case 'toggle':
        this.component = validate(ToggleGroup);
        break;
      default:
        this.component = validate(Input);
    }
  }

  render() {
    return (
      <Control model={this.props.model}
        component={this.component}
        type={this.props.type}
        componentClass={this.props.componentClass}
        id={this.props.id}
        label={this.props.label}
        placeholder={this.props.placeholder}
        required={this.props.required}
        pokemon={this.props.pokemon}
        validators={{
          required: (val) => !this.props.required || val && val.trim().length
        }}
        mapProps={{
          pristine: ({fieldValue}) => fieldValue.pristine,
          valid: ({fieldValue}) => fieldValue.valid,
          focus: ({fieldValue}) => fieldValue.focus
        }}
        defaultValue={this.props.componentClass == 'select' ?
          this.props.children[0].props.value : undefined}
        onChange={this.props.onChange}>
        {this.props.children}
      </Control>
    )
  }
};


text:
package org.colorcoding.tools.btulz.util;

import java.util.Objects;
import java.util.function.Predicate;

import javax.xml.bind.annotation.XmlType;

import org.colorcoding.tools.btulz.Environment;

/**
 * 集合数组
 *
 * @author Niuren.Zhu
 *
 * @param <E> 集合类型
 */
@XmlType(name = "ArrayList", namespace = Environment.NAMESPACE_BTULZ_UTIL)
public class ArrayList<E> extends java.util.ArrayList<E> implements List<E> {

	private static final long serialVersionUID = -3667786953103150180L;

	public E firstOrDefault() {
		if (this.size() > 0)
			return this.get(0);
		return null;
	}

	public E lastOrDefault() {
		if (this.size() > 0)
			return this.get(this.size() - 1);
		return null;
	}

	public E firstOrDefault(Predicate<? super E> filter) {
		Objects.requireNonNull(filter);
		for (int i = 0; i < this.size(); i++) {
			E item = this.get(i);
			if (item == null)
				continue;
			if (filter.test(item))
				return item;
		}
		return null;
	}

	public E lastOrDefault(Predicate<? super E> filter) {
		Objects.requireNonNull(filter);
		for (int i = this.size() - 1; i >= 0; i--) {
			E item = this.get(i);
			if (item == null)
				continue;
			if (filter.test(item))
				return item;
		}
		return null;
	}

	public boolean addAll(E[] c) {
		if (c != null) {
			for (E item : c) {
				this.add(item);
			}
		}
		return true;
	}

	public boolean addAll(Iterable<? extends E> c) {
		if (c != null) {
			for (E item : c) {
				this.add(item);
			}
		}
		return true;
	}

}


text:
package org.drip.analytics.definition;

/*
 * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 */

/*!
 * Copyright (C) 2012 Lakshmi Krishnamurthy
 *
 * This file is part of CreditAnalytics, a free-software/open-source library for fixed income analysts and
 * 		developers - http://www.credit-trader.org
 *
 * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special
 * 		focus towards the needs of the bonds and credit products community.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *   	you may not use this file except in compliance with the License.
 *
 *  You may obtain a copy of the License at
 *  	http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  	distributed under the License is distributed on an "AS IS" BASIS,
 *  	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *
 *  See the License for the specific language governing permissions and
 *  	limitations under the License.
 */

/**
 * This class contains the baseline abstract zero curve holder object. In addition to the discount
 * 		functionality, it provides the functionality to calculate the zero rate.
 *
 * @author Lakshmi Krishnamurthy
 */

public abstract class ZeroCurve extends org.drip.analytics.definition.DiscountCurve {
	/**
	 * Retrieves the zero rate corresponding to the given date
	 *
	 * @param dblDate Date for which the zero rate is requested
	 *
	 * @return Zero Rate
	 *
	 * @throws java.lang.Exception Thrown if the date is not represented in the map
	 */

	public abstract double getZeroRate (
		final double dblDate)
		throws java.lang.Exception;
}


text:
namespace Models.Migrations
{
    using System;
    using System.Data.Entity.Migrations;

    public partial class DropPersonIsCheckedInBoolean : DbMigration
    {
        public override void Up()
        {
            DropColumn("dbo.Commitment", "PersonIsCheckedIn");
        }

        public override void Down()
        {
            AddColumn("dbo.Commitment", "PersonIsCheckedIn", c => c.Boolean(nullable: false));
        }
    }
}


text:
import sys,gzip

workdir = sys.argv[1]

infiles = ["/9_alignment.sam.gz","/10_alignment.sam.gz"]
outfile = gzip.open(workdir + "/11_alignment.sam.gz","wb")

for file in infiles:
	infile = gzip.open(workdir + file,"rb")

	#running lists
	Alignment = []
	AlignmentScore = []

	#current read
	SequenceID = ""

	for line in infile:
		RawLine = line
		line = line.split()

		seqID = ""
		s1 = ""
		s2 = 0

		seqID = line[0].split('_')

		if len(seqID) > 1:
			s1 = seqID[0]
			s2 = seqID[1]
		else:
			s1 = seqID[0]
			s2 = 0

		line2 = line[:]
		line2[0] = s1
		line2[7] = str(s2)
		NewLine = "\t".join(line2) + '\n'

		#add alignments of the same read to the running list
		if line2[0] == SequenceID:
			#add only alignments lacking gaps and clipped bases
			if line[5].count("D") == 0 and line[5].count("I") == 0 and line[5].count("S") == 0:
				AS = line[11].split(":")
				AlignmentScore.append(int(AS[2]))
				#Alignment.append(RawLine)
				Alignment.append(NewLine)

		else:
			if len(Alignment) > 0:
				#write alignment with the best alignment score
				outfile.write(Alignment[AlignmentScore.index(max(AlignmentScore))])
#			print s2, NewLine
			SequenceID = line2[0]
			Alignment = []
			AlignmentScore = []