text:
package org.jboss.netty.handler.queue;

import java.io.IOException;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit;

import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelEvent;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.channel.ChannelStateEvent;
import org.jboss.netty.channel.ExceptionEvent;
import org.jboss.netty.channel.MessageEvent;
import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
import org.jboss.netty.util.internal.DeadLockProofWorker;
import org.jboss.netty.util.internal.QueueFactory;

/**
 * Emulates blocking read operation.  This handler stores all received messages
 * into a {@link BlockingQueue} and returns the received messages when
 * {@link #read()}, {@link #read(long, TimeUnit)}, {@link #readEvent()}, or
 * {@link #readEvent(long, TimeUnit)} method is called.
 *

 * Please note that this handler is only useful for the cases where there are
 * very small number of connections, such as testing and simple client-side
 * application development.
 *

 * Also, any handler placed after this handler will never receive
 * {@code messageReceived}, {@code exceptionCaught}, and {@code channelClosed}
 * events, hence it should be placed in the last place in a pipeline.
 *

 * Here is an example that demonstrates the usage:
 *

 * {@link BlockingReadHandler}<{@link ChannelBuffer}> reader =
 *         new {@link BlockingReadHandler}<{@link ChannelBuffer}>();
 * {@link ChannelPipeline} p = ...;
 * p.addLast("reader", reader);
 *
 * ...
 *
 * // Read a message from a channel in a blocking manner.
 * try {
 *     {@link ChannelBuffer} buf = reader.read(60, TimeUnit.SECONDS);
 *     if (buf == null) {
 *         // Connection closed.
 *     } else {
 *         // Handle the received message here.
 *     }
 * } catch ({@link BlockingReadTimeoutException} e) {
 *     // Read timed out.
 * } catch (IOException e) {
 *     // Other read errors
 * }
 *

 *
 * @param <E> the type of the received messages
 */
public class BlockingReadHandler<E> extends SimpleChannelUpstreamHandler {

    private final BlockingQueue<ChannelEvent> queue;
    private volatile boolean closed;

    /**
     * Creates a new instance with the default unbounded {@link BlockingQueue}
     * implementation.
     */
    public BlockingReadHandler() {
        this(QueueFactory.createQueue(ChannelEvent.class));
    }

    /**
     * Creates a new instance with the specified {@link BlockingQueue}.
     */
    public BlockingReadHandler(BlockingQueue<ChannelEvent> queue) {
        if (queue == null) {
            throw new NullPointerException("queue");
        }
        this.queue = queue;
    }

    /**
     * Returns the queue which stores the received messages.  The default
     * implementation returns the queue which was specified in the constructor.
     */
    protected BlockingQueue<ChannelEvent> getQueue() {
        return queue;
    }

    /**
     * Returns {@code true} if and only if the {@link Channel} associated with
     * this handler has been closed.
     *
     * @throws IllegalStateException
     *         if this handler was not added to a {@link ChannelPipeline} yet
     */
    public boolean isClosed() {
        return closed;
    }

    /**
     * Waits until a new message is received or the associated {@link Channel}
     * is closed.
     *
     * @return the received message or {@code null} if the associated
     *         {@link Channel} has been closed
     * @throws IOException
     *         if failed to receive a new message
     * @throws InterruptedException
     *         if the operation has been interrupted
     */
    public E read() throws IOException, InterruptedException {
        ChannelEvent e = readEvent();
        if (e == null) {
            return null;
        }

        if (e instanceof MessageEvent) {
            return getMessage((MessageEvent) e);
        } else if (e instanceof ExceptionEvent) {
            throw (IOException) new IOException().initCause(((ExceptionEvent) e).getCause());
        } else {
            throw new IllegalStateException();
        }
    }

    /**
     * Waits until a new message is received or the associated {@link Channel}
     * is closed.
     *
     * @param timeout
     *        the amount time to wait until a new message is received.
     *        If no message is received within the timeout,
     *        {@link BlockingReadTimeoutException} is thrown.
     * @param unit
     *        the unit of {@code timeout}
     *
     * @return the received message or {@code null} if the associated
     *         {@link Channel} has been closed
     * @throws BlockingReadTimeoutException
     *         if no message was received within the specified timeout
     * @throws IOException
     *         if failed to receive a new message
     * @throws InterruptedException
     *         if the operation has been interrupted
     */
    public E read(long timeout, TimeUnit unit) throws IOException, InterruptedException {
        ChannelEvent e = readEvent(timeout, unit);
        if (e == null) {
            return null;
        }

        if (e instanceof MessageEvent) {
            return getMessage((MessageEvent) e);
        } else if (e instanceof ExceptionEvent) {
            throw (IOException) new IOException().initCause(((ExceptionEvent) e).getCause());
        } else {
            throw new IllegalStateException();
        }
    }

    /**
     * Waits until a new {@link ChannelEvent} is received or the associated
     * {@link Channel} is closed.
     *
     * @return a {@link MessageEvent} or an {@link ExceptionEvent}.
     *         {@code null} if the associated {@link Channel} has been closed
     * @throws InterruptedException
     *         if the operation has been interrupted
     */
    public ChannelEvent readEvent() throws InterruptedException {
        detectDeadLock();
        if (isClosed()) {
            if (getQueue().isEmpty()) {
                return null;
            }
        }

        ChannelEvent e = getQueue().take();
        if (e instanceof ChannelStateEvent) {
            // channelClosed has been triggered.
            assert closed;
            return null;
        } else {
            return e;
        }
    }

    /**
     * Waits until a new {@link ChannelEvent} is received or the associated
     * {@link Channel} is closed.
     *
     * @param timeout
     *        the amount time to wait until a new {@link ChannelEvent} is
     *        received.  If no message is received within the timeout,
     *        {@link BlockingReadTimeoutException} is thrown.
     * @param unit
     *        the unit of {@code timeout}
     *
     * @return a {@link MessageEvent} or an {@link ExceptionEvent}.
     *         {@code null} if the associated {@link Channel} has been closed
     * @throws BlockingReadTimeoutException
     *         if no event was received within the specified timeout
     * @throws InterruptedException
     *         if the operation has been interrupted
     */
    public ChannelEvent readEvent(long timeout, TimeUnit unit) throws InterruptedException, BlockingReadTimeoutException {
        detectDeadLock();
        if (isClosed()) {
            if (getQueue().isEmpty()) {
                return null;
            }
        }

        ChannelEvent e = getQueue().poll(timeout, unit);
        if (e == null) {
            throw new BlockingReadTimeoutException();
        } else if (e instanceof ChannelStateEvent) {
            // channelClosed has been triggered.
            assert closed;
            return null;
        } else {
            return e;
        }
    }

    private void detectDeadLock() {
        if (DeadLockProofWorker.PARENT.get() != null) {
            throw new IllegalStateException(
                    "read*(...) in I/O thread causes a dead lock or " +
                    "sudden performance drop. Implement a state machine or " +
                    "call read*() from a different thread.");
        }
    }

    @Override
    public void messageReceived(ChannelHandlerContext ctx, MessageEvent e)
            throws Exception {
        getQueue().put(e);
    }

    @Override
    public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e)
            throws Exception {
        getQueue().put(e);
    }

    @Override
    public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e)
            throws Exception {
        closed = true;
        getQueue().put(e);
    }

    @SuppressWarnings("unchecked")
    private E getMessage(MessageEvent e) {
        return (E) e.getMessage();
    }
}


text:
package com.google.cloud.notebooks.v1.samples;

// [START notebooks_v1_generated_managednotebookserviceclient_reportruntimeevent_sync]
import com.google.cloud.notebooks.v1.Event;
import com.google.cloud.notebooks.v1.ManagedNotebookServiceClient;
import com.google.cloud.notebooks.v1.ReportRuntimeEventRequest;
import com.google.cloud.notebooks.v1.Runtime;
import com.google.cloud.notebooks.v1.RuntimeName;

public class SyncReportRuntimeEvent {

  public static void main(String[] args) throws Exception {
    syncReportRuntimeEvent();
  }

  public static void syncReportRuntimeEvent() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (ManagedNotebookServiceClient managedNotebookServiceClient =
        ManagedNotebookServiceClient.create()) {
      ReportRuntimeEventRequest request =
          ReportRuntimeEventRequest.newBuilder()
              .setName(RuntimeName.of("[PROJECT]", "[LOCATION]", "[RUNTIME]").toString())
              .setVmId("vmId3622450")
              .setEvent(Event.newBuilder().build())
              .build();
      Runtime response = managedNotebookServiceClient.reportRuntimeEventAsync(request).get();
    }
  }
}
// [END notebooks_v1_generated_managednotebookserviceclient_reportruntimeevent_sync]

redpajama_set_name: RedPajamaGithub


text:
namespace EDDiscovery2
{
    partial class JSONFiltersForm
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(JSONFiltersForm));
            this.panelTop = new System.Windows.Forms.Panel();
            this.label_index = new System.Windows.Forms.Label();
            this.panelOuter = new System.Windows.Forms.Panel();
            this.panelVScroll = new ExtendedControls.PanelVScroll();
            this.vScrollBarCustom1 = new ExtendedControls.VScrollBarCustom();
            this.buttonOK = new ExtendedControls.ButtonExt();
            this.buttonCancel = new ExtendedControls.ButtonExt();
            this.buttonMore = new ExtendedControls.ButtonExt();
            this.statusStripCustom = new ExtendedControls.StatusStripCustom();
            this.panel_close = new ExtendedControls.DrawnPanel();
            this.panel_minimize = new ExtendedControls.DrawnPanel();
            this.panelTop.SuspendLayout();
            this.panelOuter.SuspendLayout();
            this.panelVScroll.SuspendLayout();
            this.SuspendLayout();
            //
            // panelTop
            //
            this.panelTop.Controls.Add(this.panel_close);
            this.panelTop.Controls.Add(this.panel_minimize);
            this.panelTop.Controls.Add(this.label_index);
            this.panelTop.Dock = System.Windows.Forms.DockStyle.Top;
            this.panelTop.Location = new System.Drawing.Point(0, 0);
            this.panelTop.Name = "panelTop";
            this.panelTop.Size = new System.Drawing.Size(836, 24);
            this.panelTop.TabIndex = 4;
            this.panelTop.MouseDown += new System.Windows.Forms.MouseEventHandler(this.label_index_MouseDown);
            //
            // label_index
            //
            this.label_index.AutoSize = true;
            this.label_index.Location = new System.Drawing.Point(3, 8);
            this.label_index.Name = "label_index";
            this.label_index.Size = new System.Drawing.Size(27, 13);
            this.label_index.TabIndex = 23;
            this.label_index.Text = "N/A";
            this.label_index.MouseDown += new System.Windows.Forms.MouseEventHandler(this.label_index_MouseDown);
            //
            // panelOuter
            //
            this.panelOuter.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.panelOuter.Controls.Add(this.panelVScroll);
            this.panelOuter.Dock = System.Windows.Forms.DockStyle.Fill;
            this.panelOuter.Location = new System.Drawing.Point(0, 24);
            this.panelOuter.Name = "panelOuter";
            this.panelOuter.Padding = new System.Windows.Forms.Padding(3);
            this.panelOuter.Size = new System.Drawing.Size(836, 344);
            this.panelOuter.TabIndex = 8;
            //
            // panelVScroll
            //
            this.panelVScroll.Controls.Add(this.vScrollBarCustom1);
            this.panelVScroll.Controls.Add(this.buttonOK);
            this.panelVScroll.Controls.Add(this.buttonCancel);
            this.panelVScroll.Controls.Add(this.buttonMore);
            this.panelVScroll.Dock = System.Windows.Forms.DockStyle.Fill;
            this.panelVScroll.InternalMargin = new System.Windows.Forms.Padding(0);
            this.panelVScroll.Location = new System.Drawing.Point(3, 3);
            this.panelVScroll.Name = "panelVScroll";
            this.panelVScroll.ScrollBarWidth = 20;
            this.panelVScroll.Size = new System.Drawing.Size(828, 336);
            this.panelVScroll.TabIndex = 8;
            this.panelVScroll.VerticalScrollBarDockRight = true;
            //
            // vScrollBarCustom1
            //
            this.vScrollBarCustom1.ArrowBorderColor = System.Drawing.Color.LightBlue;
            this.vScrollBarCustom1.ArrowButtonColor = System.Drawing.Color.LightGray;
            this.vScrollBarCustom1.ArrowColorScaling = 0.5F;
            this.vScrollBarCustom1.ArrowDownDrawAngle = 270F;
            this.vScrollBarCustom1.ArrowUpDrawAngle = 90F;
            this.vScrollBarCustom1.BorderColor = System.Drawing.Color.White;
            this.vScrollBarCustom1.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.vScrollBarCustom1.HideScrollBar = false;
            this.vScrollBarCustom1.LargeChange = 10;
            this.vScrollBarCustom1.Location = new System.Drawing.Point(808, 0);
            this.vScrollBarCustom1.Maximum = -292;
            this.vScrollBarCustom1.Minimum = 0;
            this.vScrollBarCustom1.MouseOverButtonColor = System.Drawing.Color.Green;
            this.vScrollBarCustom1.MousePressedButtonColor = System.Drawing.Color.Red;
            this.vScrollBarCustom1.Name = "vScrollBarCustom1";
            this.vScrollBarCustom1.Size = new System.Drawing.Size(20, 336);
            this.vScrollBarCustom1.SliderColor = System.Drawing.Color.DarkGray;
            this.vScrollBarCustom1.SmallChange = 1;
            this.vScrollBarCustom1.TabIndex = 0;
            this.vScrollBarCustom1.Text = "vScrollBarCustom1";
            this.vScrollBarCustom1.ThumbBorderColor = System.Drawing.Color.Yellow;
            this.vScrollBarCustom1.ThumbButtonColor = System.Drawing.Color.DarkBlue;
            this.vScrollBarCustom1.ThumbColorScaling = 0.5F;
            this.vScrollBarCustom1.ThumbDrawAngle = 0F;
            this.vScrollBarCustom1.Value = -292;
            this.vScrollBarCustom1.ValueLimited = -292;
            //
            // buttonOK
            //
            this.buttonOK.BorderColorScaling = 1.25F;
            this.buttonOK.ButtonColorScaling = 0.5F;
            this.buttonOK.ButtonDisabledScaling = 0.5F;
            this.buttonOK.Location = new System.Drawing.Point(713, 7);
            this.buttonOK.Name = "buttonOK";
            this.buttonOK.Size = new System.Drawing.Size(75, 23);
            this.buttonOK.TabIndex = 7;
            this.buttonOK.Text = "OK";
            this.buttonOK.UseVisualStyleBackColor = true;
            this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
            //
            // buttonCancel
            //
            this.buttonCancel.BorderColorScaling = 1.25F;
            this.buttonCancel.ButtonColorScaling = 0.5F;
            this.buttonCancel.ButtonDisabledScaling = 0.5F;
            this.buttonCancel.Location = new System.Drawing.Point(621, 7);
            this.buttonCancel.Name = "buttonCancel";
            this.buttonCancel.Size = new System.Drawing.Size(75, 23);
            this.buttonCancel.TabIndex = 6;
            this.buttonCancel.Text = "Cancel";
            this.buttonCancel.UseVisualStyleBackColor = true;
            this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
            //
            // buttonMore
            //
            this.buttonMore.BorderColorScaling = 1.25F;
            this.buttonMore.ButtonColorScaling = 0.5F;
            this.buttonMore.ButtonDisabledScaling = 0.5F;
            this.buttonMore.Location = new System.Drawing.Point(6, 6);
            this.buttonMore.Name = "buttonMore";
            this.buttonMore.Size = new System.Drawing.Size(24, 24);
            this.buttonMore.TabIndex = 5;
            this.buttonMore.Text = "+";
            this.buttonMore.UseVisualStyleBackColor = true;
            this.buttonMore.Click += new System.EventHandler(this.buttonMore_Click);
            //
            // statusStripCustom
            //
            this.statusStripCustom.Location = new System.Drawing.Point(0, 368);
            this.statusStripCustom.Name = "statusStripCustom";
            this.statusStripCustom.Size = new System.Drawing.Size(836, 22);
            this.statusStripCustom.TabIndex = 27;
            this.statusStripCustom.Text = "statusStripCustom1";
            //
            // panel_close
            //
            this.panel_close.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.panel_close.BackColor = System.Drawing.SystemColors.Control;
            this.panel_close.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
            this.panel_close.DrawnImage = null;
            this.panel_close.ImageSelected = ExtendedControls.DrawnPanel.ImageType.Close;
            this.panel_close.ImageText = null;
            this.panel_close.Location = new System.Drawing.Point(813, 0);
            this.panel_close.MarginSize = 6;
            this.panel_close.MouseOverColor = System.Drawing.Color.White;
            this.panel_close.MouseSelectedColor = System.Drawing.Color.Green;
            this.panel_close.MouseSelectedColorEnable = true;
            this.panel_close.Name = "panel_close";
            this.panel_close.Size = new System.Drawing.Size(24, 24);
            this.panel_close.TabIndex = 27;
            this.panel_close.Click += new System.EventHandler(this.panel_close_Click);
            //
            // panel_minimize
            //
            this.panel_minimize.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.panel_minimize.BackColor = System.Drawing.SystemColors.Control;
            this.panel_minimize.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
            this.panel_minimize.DrawnImage = null;
            this.panel_minimize.ImageSelected = ExtendedControls.DrawnPanel.ImageType.Minimize;
            this.panel_minimize.ImageText = null;
            this.panel_minimize.Location = new System.Drawing.Point(783, 0);
            this.panel_minimize.MarginSize = 6;
            this.panel_minimize.MouseOverColor = System.Drawing.Color.White;
            this.panel_minimize.MouseSelectedColor = System.Drawing.Color.Green;
            this.panel_minimize.MouseSelectedColorEnable = true;
            this.panel_minimize.Name = "panel_minimize";
            this.panel_minimize.Size = new System.Drawing.Size(24, 24);
            this.panel_minimize.TabIndex = 26;
            this.panel_minimize.Click += new System.EventHandler(this.panel_minimize_Click);
            //
            // JSONFiltersForm
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(836, 390);
            this.Controls.Add(this.panelOuter);
            this.Controls.Add(this.statusStripCustom);
            this.Controls.Add(this.panelTop);
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.Name = "JSONFiltersForm";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
            this.Text = "JSONFiltersForm";
            this.Load += new System.EventHandler(this.JSONFiltersForm_Load);
            this.Layout += new System.Windows.Forms.LayoutEventHandler(this.JSONFiltersForm_Layout);
            this.Resize += new System.EventHandler(this.JSONFiltersForm_Resize);
            this.panelTop.ResumeLayout(false);
            this.panelTop.PerformLayout();
            this.panelOuter.ResumeLayout(false);
            this.panelVScroll.ResumeLayout(false);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Panel panelTop;
        private System.Windows.Forms.Label label_index;
        private ExtendedControls.ButtonExt buttonOK;
        private ExtendedControls.ButtonExt buttonCancel;
        private ExtendedControls.ButtonExt buttonMore;
        private ExtendedControls.DrawnPanel panel_minimize;
        private ExtendedControls.DrawnPanel panel_close;
        private ExtendedControls.VScrollBarCustom vScrollBarCustom1;
        private ExtendedControls.PanelVScroll panelVScroll;
        private ExtendedControls.StatusStripCustom statusStripCustom;
        private System.Windows.Forms.Panel panelOuter;
    }
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.12"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>TFKaldi: File List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

TFKaldi

File List

Here is a list of all documented files with brief descriptions:

 activation.py	Activation functions for neural networks

 classifier.py	The abstract class for a neural network classifie

 decoder.py	Neural network decoder environment

 dnn.py	The DNN neural network classifie

 feat.py	Contains the class for feature computation

 feature_reader.py	Reading features and applying cmvn and splicing them

 gmm.py	Functionality for Kaldi GMM training, aligning and testing

 main.py	Run this file to go through the neural net training procedure, look at the config files in the config directory to modify the settings

 nnet.py	Functionality for a Kaldi style neural network

 prepare_data.py	Functions used to prepare the data for GMM and DNN training

 readfiles.py	Functions to read some files created by Kaldi

 seq_convertors.py	This file contains functions that convert sequential data to non-sequential data and the other way around

 sigproc.py	Signal processing functionality

 trainer.py	Neural network trainer environment

<address class="footer">
Generated by

 1.8.12
</address>


text:
package mclub.util.shuffle;

import java.io.File;
import java.io.FileFilter;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;

import org.apache.commons.io.FileUtils;

/**
 * Hello world!
 *
 */
public class ShuffleApp {
	public static void main(String[] args) {
		if(args.length != 2){
			System.out.println("Usage: java -jar shuffle.jar source_folder destination_folder");
			return;
		}

		File source = new File(args[0]);
		File destRoot = new File(args[1]);

		// make sure both exists
		if(!source.exists() || !source.isDirectory()){
			System.out.println("Source should be a valid folder");
			return;
		}
		if(!destRoot.exists() || !destRoot.isDirectory()){
			System.out.println("Destination should be a valid folder");
			return;
		}
		long start = System.currentTimeMillis();

		// walk through the source folder
		System.out.print("Collecting file...");
		LinkedList<File> result = new LinkedList<File>();
		collectFile(source,result);
		System.out.println("" + result.size() + " found");

		if(result.size() == 0){
			return;
		}

		// shuffle
		System.out.println("Shuffling...");
		LinkedList<File> shuffled = result;
		int sTimes = 1;
		for(int i = 0;i < sTimes;i++){
			// shuffle 10 times
			shuffled =  shuffleFile(shuffled);
		}

		// copying
		System.out.println("Copying files...");
		int totalFilesCopied = 0;
		int maxFilesPerFolder = 255;
		int folders = shuffled.size() / maxFilesPerFolder + 1;
		File destFolder = null;
		for(int i = 1;i <= folders;i++){
			destFolder = new File(destRoot,"shuffled_" + i);
			destFolder.mkdirs();
			if(!destFolder.exists() || !destFolder.canWrite()){
				System.out.println("Can not write " + destFolder);
				return;
			}
			copyloop:for(;totalFilesCopied < shuffled.size();){
				File f = shuffled.get(totalFilesCopied);
				try{
					FileUtils.copyFileToDirectory(f, destFolder, true);
					totalFilesCopied++;
					if(totalFilesCopied % 10 == 0){
						System.out.println("" + totalFilesCopied + " of " + shuffled.size() + " copied, elapsed " + ((System.currentTimeMillis() - start) / 1000) + " seconds");
					}
					if(totalFilesCopied % maxFilesPerFolder == 0){
						break copyloop;
					}
				}catch(Exception e){
					System.out.println("Error copy " + f + ", " + e.getMessage());
				}
			}
		}

		System.out.println("Done, elapsed " + ((System.currentTimeMillis() - start) / 1000) + " seconds");
	}

	static Random rnd = new Random();

	public static LinkedList<File> shuffleFile(LinkedList<File> source){
		LinkedList<File> shuffled = new LinkedList<File>();
		while(source.size() > 0){
			int idx = rnd.nextInt(source.size());
			shuffled.add(source.remove(idx));
		}
		return shuffled;
	}

	public static void collectFile(File folder, List<File> result){
		if(!folder.isDirectory()){
			result.add(folder);
			return;
		}

		// a directory
		File[] children = folder.listFiles(new FileFilter(){
			public boolean accept(File c) {
				return (c.isDirectory() && !c.getName().equals(".Trashes")) || (c.getName().endsWith(".mp3") && !c.getName().startsWith("."));
            }
		});

		if(children != null && children.length > 0){
			for(File c : children){
				collectFile(c,result);
			}
		}
	}
}


text:
<!DOCTYPE HTML>

<title>Uses of Enum io.ebean.Junction.Type (ebean api 13.6.0 API)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="dc.created" content="2022-05-03">
<meta name="description" content="use: module: io.ebean.api, package: io.ebean, interface: Junction, enum: Type">
<meta name="generator" content="javadoc/ClassUseWriter">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../script-dir/jquery-ui.min.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../jquery-ui.overrides.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Module

Package

Class

Use

Tree

Deprecated

Index

Help

SEARCH:
<input type="text" id="search-input" value="search" disabled="disabled">
<input type="reset" id="reset-button" value="reset" disabled="disabled">

Uses of Enum
io.ebean.Junction.Type

Packages that use Junction.Type

Package

Description

io.ebean

Core API (see Database, DB and Query).

Uses of Junction.Type in io.ebean

Methods in io.ebean that return Junction.Type

Modifier and Type

Method

Description

static Junction.Type

Junction.Type.valueOf<wbr>(String name)

Returns the enum constant of this type with the specified name.

static Junction.Type[]

Junction.Type.values()

Returns an array containing the constants of this enum type, in
the order they are declared.

Methods in io.ebean with parameters of type Junction.Type

Modifier and Type

Method

Description

<T> Junction<T>

ExpressionFactory.junction<wbr>(Junction.Type type,
 Query<T> query,
 ExpressionList<T> parent)

Return a Text query junction for MUST, SHOULD or MUST NOT.

Copyright © 2022. All rights reserved.


text:
require File.expand_path('../../spec_helper', __dir__)

module Selenium
  module WebDriver
    module Interactions
      describe PointerMove do
        let(:source) { Interactions.pointer(:mouse) }
        let(:element) { instance_double(Element) }
        let(:origin) { PointerMove::POINTER }
        let(:duration) { 0.5 }
        let(:x) { 25 }
        let(:y) { 50 }
        let(:opts) do
          {width: 0,
           height: 0,
           pressure: 0.5,
           tangential_pressure: 0.4,
           tilt_x: -40,
           tilt_y: -10,
           twist: 177,
           altitude_angle: 1.0,
           azimuth_angle: 0.5}
        end

        describe '#initialize' do
          it 'raises a TypeError if source is not a PointerInput' do
            key = Interactions.key('key')
            expect { PointerMove.new(key, duration, x, y) }.to raise_error(TypeError)
          end
        end

        describe '#type' do
          it 'equals :pointerMove' do
            move = PointerMove.new(source, duration, x, y)
            expect(move.type).to eq(:pointerMove)
          end
        end

        describe '#encode' do
          it 'processes opts' do
            move = PointerMove.new(source, duration, x, y, origin: element, **opts)

            expect(move.encode).to eq('type' => move.type.to_s,
                                      'origin' => element,
                                      'duration' => (duration * 1000).to_i,
                                      'x' => x,
                                      'y' => y,
                                      'width' => 0,
                                      'height' => 0,
                                      'pressure' => 0.5,
                                      'tangentialPressure' => 0.4,
                                      'tiltX' => -40,
                                      'tiltY' => -10,
                                      'twist' => 177,
                                      'altitudeAngle' => 1.0,
                                      'azimuthAngle' => 0.5)
          end

          context 'with element' do
            it 'returns a Hash with source, duration, x and y' do
              move = PointerMove.new(source, duration, x, y, origin: element)

              ms = (duration * 1000).to_i
              expect(move.encode).to eq('type' => move.type.to_s,
                                        'origin' => element,
                                        'duration' => ms,
                                        'x' => x,
                                        'y' => y)
            end
          end

          context 'with origin' do
            it 'returns a Hash with source, duration, x and y' do
              move = PointerMove.new(source, duration, x, y, origin: :pointer)

              ms = (duration * 1000).to_i
              expect(move.encode).to eq('type' => move.type.to_s,
                                        'origin' => :pointer,
                                        'duration' => ms,
                                        'x' => x,
                                        'y' => y)
            end
          end
        end
      end
    end # Interactions
  end # WebDriver
end # Selenium


text:
package enqueuer

import (
	"os"
	"time"

	"github.com/jrallison/go-workers"

	"github.com/roperzh/ogg/app/services/crawler"
	"github.com/roperzh/ogg/app/services/emitter"
)

type closeEventChannelMiddleware struct{}

func (r *closeEventChannelMiddleware) Call(queue string, message *workers.Msg, next func() bool) (acknowledge bool) {
	acknowledge = next()
	channelid := message.Args().MustMap()["id"].(string)
	emitter.CloseChannel(channelid)

	return
}

// Jobs
func RenderPage(message *workers.Msg) {
	time.Sleep(10 * time.Second)
	crawler.Crawl(message.Args().MustMap())
}

// Public Methods
func Run() {

	workers.Configure(map[string]string{
		"server":   os.Getenv("REDIS_URL"),
		"password": os.Getenv("REDIS_PASS"),
		"database": "0",
		"pool":     "30",
		"process":  "1",
	})

	workers.Middleware.Append(&closeEventChannelMiddleware{})

	// Queues definitions
	workers.Process("render:page", RenderPage, 50)

	go workers.Run()
}


text:
<?php

namespace Sabre\CalDAV\Xml\Notification;

use Sabre\Xml\Writer;
use Sabre\CalDAV\Plugin;

class SystemStatus implements NotificationInterface {

    const TYPE_LOW = 1;
    const TYPE_MEDIUM = 2;
    const TYPE_HIGH = 3;

    /**
     * A unique id
     *
     * @var string
     */
    protected $id;

    /**
     * The type of alert. This should be one of the TYPE_ constants.
     *
     * @var int
     */
    protected $type;

    /**
     * A human-readable description of the problem.
     *
     * @var string
     */
    protected $description;

    /**
     * A url to a website with more information for the user.
     *
     * @var string
     */
    protected $href;

    /**
     * Notification Etag
     *
     * @var string
     */
    protected $etag;

    /**
     * Creates the notification.
     *
     * Some kind of unique id should be provided. This is used to generate a
     * url.
     *
     * @param string $id
     * @param string $etag
     * @param int $type
     * @param string $description
     * @param string $href
     */
    function __construct($id, $etag, $type = self::TYPE_HIGH, $description = null, $href = null) {

        $this->id = $id;
        $this->type = $type;
        $this->description = $description;
        $this->href = $href;
        $this->etag = $etag;

    }

    /**
     * The serialize method is called during xml writing.
     *
     * It should use the $writer argument to encode this object into XML.
     *
     * Important note: it is not needed to create the parent element. The
     * parent element is already created, and we only have to worry about
     * attributes, child elements and text (if any).
     *
     * Important note 2: If you are writing any new elements, you are also
     * responsible for closing them.
     *
     * @param Writer $writer
     * @return void
     */
    function xmlSerialize(Writer $writer) {

        switch ($this->type) {
            case self::TYPE_LOW :
                $type = 'low';
                break;
            case self::TYPE_MEDIUM :
                $type = 'medium';
                break;
            default :
            case self::TYPE_HIGH :
                $type = 'high';
                break;
        }

        $writer->startElement('{' . Plugin::NS_CALENDARSERVER . '}systemstatus');
        $writer->writeAttribute('type', $type);
        $writer->endElement();

    }

    /**
     * This method serializes the entire notification, as it is used in the
     * response body.
     *
     * @param Writer $writer
     * @return void
     */
    function xmlSerializeFull(Writer $writer) {

        $cs = '{' . Plugin::NS_CALENDARSERVER . '}';
        switch ($this->type) {
            case self::TYPE_LOW :
                $type = 'low';
                break;
            case self::TYPE_MEDIUM :
                $type = 'medium';
                break;
            default :
            case self::TYPE_HIGH :
                $type = 'high';
                break;
        }

        $writer->startElement($cs . 'systemstatus');
        $writer->writeAttribute('type', $type);

        if ($this->description) {
            $writer->writeElement($cs . 'description', $this->description);
        }
        if ($this->href) {
            $writer->writeElement('{DAV:}href', $this->href);
        }

        $writer->endElement(); // systemstatus

    }

    /**
     * Returns a unique id for this notification
     *
     * This is just the base url. This should generally be some kind of unique
     * id.
     *
     * @return string
     */
    function getId() {

        return $this->id;

    }

    /*
     * Returns the ETag for this notification.
     *
     * The ETag must be surrounded by literal double-quotes.
     *
     * @return string
     */
    function getETag() {

        return $this->etag;

    }

}


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

namespace SimpleQA.Markdown
{
    public interface IMarkdown
    {
        String TransformIntoHTML(String markdown);
    }
}


text:
#ifndef PHALCON_DEBUG_H
#define PHALCON_DEBUG_H

#include "php_phalcon.h"

extern zend_class_entry *phalcon_debug_ce;

PHALCON_INIT_CLASS(Phalcon_Debug);

#endif /* PHALCON_DEBUG_H */


text:
using System.Collections.Generic;
using NUnit.Framework;
using TSQLLint.Infrastructure.Rules;
using TSQLLint.Infrastructure.Rules.RuleViolations;

namespace TSQLLint.Tests.UnitTests.LintingRules
{
    public class SchemaQualifyRuleTests
    {
        private const string RuleName = "schema-qualify";

        private static readonly object[] TestCases =
        {
            new object[]
            {
                "schema-qualify-no-error", new List<RuleViolation>()
            },
            new object[]
            {
                "schema-qualify-one-error", new List<RuleViolation>
                {
                    new ("schema-qualify", 1, 17)
                }
            },
            new object[]
            {
                "schema-qualify-two-errors", new List<RuleViolation>
                {
                    new ("schema-qualify", 1, 17),
                    new ("schema-qualify", 2, 17)
                }
            },
            new object[]
            {
                "schema-qualify-one-error-mixed-state", new List<RuleViolation>
                {
                    new ("schema-qualify", 3, 21)
                }
            },
            new object[]
            {
                "schema-qualify-multi-error", new List<RuleViolation>
                {
                    new (RuleName, 1, 15),
                    new (RuleName, 3, 8),
                    new (RuleName, 5, 8),
                    new (RuleName, 7, 13),
                    new (RuleName, 9, 16),
                    new (RuleName, 11, 14),
                    new (RuleName, 13, 12),
                    new (RuleName, 15, 13),
                    new (RuleName, 17, 13)
                }
            }
        };

        private static readonly object[] DynamicSqlTestCases =
        {
            new object[]
            {
                @"EXEC('SELECT FOO FROM BAR;');",
                new List<RuleViolation>
                {
                    new (RuleName, 1, 23),
                }
            },
            new object[]
            {
                @"EXEC('
                    SELECT FOO FROM BAR;');",
                new List<RuleViolation>
                {
                    new (RuleName, 2, 37),
                }
            }
        };

        [TestCaseSource(nameof(TestCases))]
        public void TestRule(string testFileName, List<RuleViolation> expectedRuleViolations)
        {
            RulesTestHelper.RunRulesTest(RuleName, testFileName, typeof(SchemaQualifyRule), expectedRuleViolations);
        }

        [TestCaseSource(nameof(DynamicSqlTestCases))]
        public void TestRuleWithDynamicSql(string sql, List<RuleViolation> expectedViolations)
        {
            RulesTestHelper.RunDynamicSQLRulesTest(typeof(SchemaQualifyRule), sql, expectedViolations);
        }
    }
}


text:
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE component SYSTEM "dtds/component.dtd">

<component name="ServiceInvoice">

	<entity>
		<property name="oid" type="String" key="true" hidden="true">
			<default-value-calculator class="org.openxava.calculators.UUIDCalculator" on-create="true"/>
		</property>
		<property name="year" type="int" search-key="true" size="4">
			<default-value-calculator class="org.openxava.calculators.CurrentYearCalculator"/>
		</property>
		<property name="number" type="int" search-key="true" size="6"/>
		<property name="description" stereotype="MEMO">
			<default-value-calculator class="org.openxava.calculators.ConcatCalculator">
				<set property="string1" value="Service invoice of "/>
				<set property="string2" from="year"/>
			</default-value-calculator>
		</property>
		<property name="amount" stereotype="MONEY"/>
	</entity>

	<view members="year, number, amount; description"/>

	<tab >
		<properties>year, number, description, amount+</properties>
	</tab>

	<!--
	Do not put here a mapping,
	because this entity is for testing default mapping
	-->

</component>


text:
<?php
/**
 * Created by PhpStorm.
 * User: sonaa
 * Date: 4/1/17
 * Time: 11:09 AM
 */

namespace Ashrafi\PaymentGateways\Responses;

use Ashrafi\PaymentGateways\Requests\Request;

class TransferResponse extends Response
{
    protected $payer,$payee,$payeeInfo=null;
    /**
     * @param Request $request
     * @param bool|false $status
     * @param string $message
     * @param int $code
     */
    public function __construct(Request $request=null,$status=false,$message='',$code=1){
        parent::__construct($request,$status,$message,$code);
    }

    /**
     * @return mixed
     */
    public function getPayer()
    {
        return $this->payer;
    }

    /**
     * @param mixed $payer
     * @return $this
     */
    public function setPayer($payer)
    {
        $this->payer = $payer;
        return $this;
    }

    /**
     * @return mixed
     */
    public function getPayee()
    {
        return $this->payee;
    }

    /**
     * @param mixed $payee
     * @return $this
     */
    public function setPayee($payee)
    {
        $this->payee = $payee;
        return $this;
    }

    /**
     * @return null
     */
    public function getPayeeInfo()
    {
        return $this->payeeInfo;
    }

    /**
     * @param null $payeeInfo
     * @return $this
     */
    public function setPayeeInfo($payeeInfo)
    {
        $this->payeeInfo = $payeeInfo;
        return $this;
    }

}


text:
<?php

/**
 * Methods accessible through the 'TbWidget' class:
 * @method string resolveId($id = null)
 * @method string publishAssets($path, $forceCopy = false)
 * @method void registerCssFile($url, $media = '')
 * @method void registerScriptFile($url, $position = null)
 * @method string resolveScriptVersion($filename, $minified = false)
 * @method boolean registerPlugin($name, $selector, $options = array(), $position = CClientScript::POS_END)
 * @method boolean registerEvents($selector, $events, $position = CClientScript::POS_END)
 * @method CClientScript getClientScript()
 */
class TbFileUpload extends CInputWidget
{
    /**
     * @var string the button label text.
     */
    public $label = 'Select file';

    /**
     * @var mixed url to call with ajax when a file is uploaded.
     */
    public $url;

    /**
     * @var array HTML attributes for the button element.
     */
    public $buttonOptions = array();

    /**
     * @var array options that are passed to the plugin.
     */
    public $pluginOptions = array();

    /**
     * @var string path to widget assets.
     */
    public $assetPath;

    /**
     * @var bool whether to register the associated JavaScript script files.
     */
    public $registerJs = true;

    /**
     * @var bool whether to bind the plugin to the associated dom element.
     */
    public $bindPlugin = true;

    /**
     * Initializes the widget.
     */
    public function init()
    {
        parent::init();
        if (!isset($this->url)) {
            throw new CException('You must specify an url property.');
        }
        Yii::import('bootstrap.behaviors.TbWidget');
        $this->attachBehavior('tbWidget', new TbWidget);
        if (!isset($this->assetPath)) {
            $this->assetPath = Yii::getPathOfAlias('lib.jquery-file-upload');
        }
        $this->pluginOptions['url'] = $this->url;
        if (!$this->bindPlugin) {
            $this->htmlOptions['data-plugin'] = 'fileupload';
            $this->htmlOptions['data-plugin-options'] = CJSON::encode($this->pluginOptions);
        }
        if (!isset($this->buttonOptions['class'])) {
            TbHtml::addCssClass('btn btn-primary', $this->htmlOptions);
        }
        TbHtml::addCssClass('fileinput-button', $this->buttonOptions);
    }

    /**
     * Runs the widget.
     */
    public function run()
    {
        list($name, $id) = $this->resolveNameID();
        $this->resolveId($id);

        if ($this->hasModel()) {
            $input = TbHtml::activeFileField($this->model, $this->attribute, $this->htmlOptions);
        } else {
            $input = TbHtml::fileField($name, $this->value, $this->htmlOptions);
        }

        echo TbHtml::tag('span', $this->buttonOptions, $this->label . ' ' . $input);

        if ($this->assetPath !== false) {
            $this->publishAssets($this->assetPath);
            $this->registerCssFile('css/jquery.fileupload-ui.css');

            if ($this->registerJs) {
                $this->getClientScript()->registerCoreScript('jquery');
                $this->registerScriptFile('js/vendor/jquery.ui.widget.js', CClientScript::POS_END);
                $this->registerScriptFile('js/jquery.iframe-transport.js', CClientScript::POS_END);
                $this->registerScriptFile('js/jquery.fileupload.js', CClientScript::POS_END);
            }
        }

        if ($this->bindPlugin) {
            TbArray::defaultValue('dataType', 'json', $this->pluginOptions);
            $options = !empty($this->pluginOptions) ? CJavaScript::encode($this->pluginOptions) : '';
            $script = <<<EOD
jQuery('#{$id}')
    .fileupload({$options})
    .prop('disabled', !jQuery.support.fileInput)
    .parent().addClass(jQuery.support.fileInput ? undefined : 'disabled');
EOD;
            $this->getClientScript()->registerScript(__CLASS__ . '#' . $id, $script);
        }
    }
}


text:
/**
 * Autogenerated by Thrift Compiler (0.14.1)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package org.apache.hadoop.hive.metastore.api;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.14.1)")
@org.apache.hadoop.classification.InterfaceAudience.Public @org.apache.hadoop.classification.InterfaceStability.Stable public class FireEventResponse implements org.apache.thrift.TBase<FireEventResponse, FireEventResponse._Fields>, java.io.Serializable, Cloneable, Comparable<FireEventResponse> {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("FireEventResponse");

  private static final org.apache.thrift.protocol.TField EVENT_IDS_FIELD_DESC = new org.apache.thrift.protocol.TField("eventIds", org.apache.thrift.protocol.TType.LIST, (short)1);

  private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new FireEventResponseStandardSchemeFactory();
  private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new FireEventResponseTupleSchemeFactory();

  private @org.apache.thrift.annotation.Nullable java.util.List<java.lang.Long> eventIds; // required

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    EVENT_IDS((short)1, "eventIds");

    private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();

    static {
      for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
        byName.put(field.getFieldName(), field);
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // EVENT_IDS
          return EVENT_IDS;
        default:
          return null;
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, throwing an exception
     * if it is not found.
     */
    public static _Fields findByThriftIdOrThrow(int fieldId) {
      _Fields fields = findByThriftId(fieldId);
      if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByName(java.lang.String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final java.lang.String _fieldName;

    _Fields(short thriftId, java.lang.String fieldName) {
      _thriftId = thriftId;
      _fieldName = fieldName;
    }

    public short getThriftFieldId() {
      return _thriftId;
    }

    public java.lang.String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.EVENT_IDS, new org.apache.thrift.meta_data.FieldMetaData("eventIds", org.apache.thrift.TFieldRequirementType.DEFAULT,
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(FireEventResponse.class, metaDataMap);
  }

  public FireEventResponse() {
  }

  public FireEventResponse(
    java.util.List<java.lang.Long> eventIds)
  {
    this();
    this.eventIds = eventIds;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public FireEventResponse(FireEventResponse other) {
    if (other.isSetEventIds()) {
      java.util.List<java.lang.Long> __this__eventIds = new java.util.ArrayList<java.lang.Long>(other.eventIds);
      this.eventIds = __this__eventIds;
    }
  }

  public FireEventResponse deepCopy() {
    return new FireEventResponse(this);
  }

  @Override
  public void clear() {
    this.eventIds = null;
  }

  public int getEventIdsSize() {
    return (this.eventIds == null) ? 0 : this.eventIds.size();
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.Iterator<java.lang.Long> getEventIdsIterator() {
    return (this.eventIds == null) ? null : this.eventIds.iterator();
  }

  public void addToEventIds(long elem) {
    if (this.eventIds == null) {
      this.eventIds = new java.util.ArrayList<java.lang.Long>();
    }
    this.eventIds.add(elem);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.List<java.lang.Long> getEventIds() {
    return this.eventIds;
  }

  public void setEventIds(@org.apache.thrift.annotation.Nullable java.util.List<java.lang.Long> eventIds) {
    this.eventIds = eventIds;
  }

  public void unsetEventIds() {
    this.eventIds = null;
  }

  /** Returns true if field eventIds is set (has been assigned a value) and false otherwise */
  public boolean isSetEventIds() {
    return this.eventIds != null;
  }

  public void setEventIdsIsSet(boolean value) {
    if (!value) {
      this.eventIds = null;
    }
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case EVENT_IDS:
      if (value == null) {
        unsetEventIds();
      } else {
        setEventIds((java.util.List<java.lang.Long>)value);
      }
      break;

    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.Object getFieldValue(_Fields field) {
    switch (field) {
    case EVENT_IDS:
      return getEventIds();

    }
    throw new java.lang.IllegalStateException();
  }

  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
  public boolean isSet(_Fields field) {
    if (field == null) {
      throw new java.lang.IllegalArgumentException();
    }

    switch (field) {
    case EVENT_IDS:
      return isSetEventIds();
    }
    throw new java.lang.IllegalStateException();
  }

  @Override
  public boolean equals(java.lang.Object that) {
    if (that instanceof FireEventResponse)
      return this.equals((FireEventResponse)that);
    return false;
  }

  public boolean equals(FireEventResponse that) {
    if (that == null)
      return false;
    if (this == that)
      return true;

    boolean this_present_eventIds = true && this.isSetEventIds();
    boolean that_present_eventIds = true && that.isSetEventIds();
    if (this_present_eventIds || that_present_eventIds) {
      if (!(this_present_eventIds && that_present_eventIds))
        return false;
      if (!this.eventIds.equals(that.eventIds))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    int hashCode = 1;

    hashCode = hashCode * 8191 + ((isSetEventIds()) ? 131071 : 524287);
    if (isSetEventIds())
      hashCode = hashCode * 8191 + eventIds.hashCode();

    return hashCode;
  }

  @Override
  public int compareTo(FireEventResponse other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetEventIds(), other.isSetEventIds());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetEventIds()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.eventIds, other.eventIds);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  @org.apache.thrift.annotation.Nullable
  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    scheme(iprot).read(iprot, this);
  }

  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    scheme(oprot).write(oprot, this);
  }

  @Override
  public java.lang.String toString() {
    java.lang.StringBuilder sb = new java.lang.StringBuilder("FireEventResponse(");
    boolean first = true;

    sb.append("eventIds:");
    if (this.eventIds == null) {
      sb.append("null");
    } else {
      sb.append(this.eventIds);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    // check for sub-struct validity
  }

  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
    try {
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
    try {
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private static class FireEventResponseStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public FireEventResponseStandardScheme getScheme() {
      return new FireEventResponseStandardScheme();
    }
  }

  private static class FireEventResponseStandardScheme extends org.apache.thrift.scheme.StandardScheme<FireEventResponse> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, FireEventResponse struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TField schemeField;
      iprot.readStructBegin();
      while (true)
      {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
          break;
        }
        switch (schemeField.id) {
          case 1: // EVENT_IDS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list952 = iprot.readListBegin();
                struct.eventIds = new java.util.ArrayList<java.lang.Long>(_list952.size);
                long _elem953;
                for (int _i954 = 0; _i954 < _list952.size; ++_i954)
                {
                  _elem953 = iprot.readI64();
                  struct.eventIds.add(_elem953);
                }
                iprot.readListEnd();
              }
              struct.setEventIdsIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();
      struct.validate();
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot, FireEventResponse struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.eventIds != null) {
        oprot.writeFieldBegin(EVENT_IDS_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I64, struct.eventIds.size()));
          for (long _iter955 : struct.eventIds)
          {
            oprot.writeI64(_iter955);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class FireEventResponseTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public FireEventResponseTupleScheme getScheme() {
      return new FireEventResponseTupleScheme();
    }
  }

  private static class FireEventResponseTupleScheme extends org.apache.thrift.scheme.TupleScheme<FireEventResponse> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, FireEventResponse struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetEventIds()) {
        optionals.set(0);
      }
      oprot.writeBitSet(optionals, 1);
      if (struct.isSetEventIds()) {
        {
          oprot.writeI32(struct.eventIds.size());
          for (long _iter956 : struct.eventIds)
          {
            oprot.writeI64(_iter956);
          }
        }
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, FireEventResponse struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      java.util.BitSet incoming = iprot.readBitSet(1);
      if (incoming.get(0)) {
        {
          org.apache.thrift.protocol.TList _list957 = iprot.readListBegin(org.apache.thrift.protocol.TType.I64);
          struct.eventIds = new java.util.ArrayList<java.lang.Long>(_list957.size);
          long _elem958;
          for (int _i959 = 0; _i959 < _list957.size; ++_i959)
          {
            _elem958 = iprot.readI64();
            struct.eventIds.add(_elem958);
          }
        }
        struct.setEventIdsIsSet(true);
      }
    }
  }

  private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
    return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
  }
}


text:
package org.apache.arrow.flight;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.apache.arrow.flight.grpc.AddWritableBuffer;
import org.apache.arrow.flight.grpc.GetReadableBuffer;
import org.apache.arrow.flight.impl.Flight.FlightData;
import org.apache.arrow.flight.impl.Flight.FlightDescriptor;
import org.apache.arrow.memory.BufferAllocator;
import org.apache.arrow.util.AutoCloseables;
import org.apache.arrow.util.Preconditions;
import org.apache.arrow.vector.ipc.message.ArrowDictionaryBatch;
import org.apache.arrow.vector.ipc.message.ArrowRecordBatch;
import org.apache.arrow.vector.ipc.message.MessageMetadataResult;
import org.apache.arrow.vector.ipc.message.MessageSerializer;
import org.apache.arrow.vector.types.pojo.Schema;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import com.google.common.io.ByteStreams;
import com.google.protobuf.ByteString;
import com.google.protobuf.CodedInputStream;
import com.google.protobuf.CodedOutputStream;
import com.google.protobuf.WireFormat;

import io.grpc.Drainable;
import io.grpc.MethodDescriptor;
import io.grpc.MethodDescriptor.Marshaller;
import io.grpc.protobuf.ProtoUtils;
import io.netty.buffer.ArrowBuf;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufInputStream;
import io.netty.buffer.CompositeByteBuf;
import io.netty.buffer.Unpooled;

/**
 * The in-memory representation of FlightData used to manage a stream of Arrow messages.
 */
class ArrowMessage implements AutoCloseable {

  public static final boolean FAST_PATH = true;

  private static final int DESCRIPTOR_TAG =
      (FlightData.FLIGHT_DESCRIPTOR_FIELD_NUMBER << 3) | WireFormat.WIRETYPE_LENGTH_DELIMITED;
  private static final int BODY_TAG =
      (FlightData.DATA_BODY_FIELD_NUMBER << 3) | WireFormat.WIRETYPE_LENGTH_DELIMITED;
  private static final int HEADER_TAG =
      (FlightData.DATA_HEADER_FIELD_NUMBER << 3) | WireFormat.WIRETYPE_LENGTH_DELIMITED;
  private static final int APP_METADATA_TAG =
      (FlightData.APP_METADATA_FIELD_NUMBER << 3) | WireFormat.WIRETYPE_LENGTH_DELIMITED;

  private static Marshaller<FlightData> NO_BODY_MARSHALLER = ProtoUtils.marshaller(FlightData.getDefaultInstance());

  /** Get the application-specific metadata in this message. The ArrowMessage retains ownership of the buffer. */
  public ArrowBuf getApplicationMetadata() {
    return appMetadata;
  }

  /** Types of messages that can be sent. */
  public enum HeaderType {
    NONE,
    SCHEMA,
    DICTIONARY_BATCH,
    RECORD_BATCH,
    TENSOR
    ;

    public static HeaderType getHeader(byte b) {
      switch (b) {
        case 0: return NONE;
        case 1: return SCHEMA;
        case 2: return DICTIONARY_BATCH;
        case 3: return RECORD_BATCH;
        case 4: return TENSOR;
        default:
          throw new UnsupportedOperationException("unknown type: " + b);
      }
    }

  }

  // Pre-allocated buffers for padding serialized ArrowMessages.
  private static List<ByteBuf> PADDING_BUFFERS = Arrays.asList(
      null,
      Unpooled.copiedBuffer(new byte[] { 0 }),
      Unpooled.copiedBuffer(new byte[] { 0, 0 }),
      Unpooled.copiedBuffer(new byte[] { 0, 0, 0 }),
      Unpooled.copiedBuffer(new byte[] { 0, 0, 0, 0 }),
      Unpooled.copiedBuffer(new byte[] { 0, 0, 0, 0, 0 }),
      Unpooled.copiedBuffer(new byte[] { 0, 0, 0, 0, 0, 0 }),
      Unpooled.copiedBuffer(new byte[] { 0, 0, 0, 0, 0, 0, 0 })
  );

  private final FlightDescriptor descriptor;
  private final MessageMetadataResult message;
  private final ArrowBuf appMetadata;
  private final List<ArrowBuf> bufs;

  public ArrowMessage(FlightDescriptor descriptor, Schema schema) {
    ByteBuffer serializedMessage = MessageSerializer.serializeMetadata(schema);
    this.message = MessageMetadataResult.create(serializedMessage.slice(),
        serializedMessage.remaining());
    bufs = ImmutableList.of();
    this.descriptor = descriptor;
    this.appMetadata = null;
  }

  /**
   * Create an ArrowMessage from a record batch and app metadata.
   * @param batch The record batch.
   * @param appMetadata The app metadata. May be null. Takes ownership of the buffer otherwise.
   */
  public ArrowMessage(ArrowRecordBatch batch, ArrowBuf appMetadata) {
    ByteBuffer serializedMessage = MessageSerializer.serializeMetadata(batch);
    this.message = MessageMetadataResult.create(serializedMessage.slice(), serializedMessage.remaining());
    this.bufs = ImmutableList.copyOf(batch.getBuffers());
    this.descriptor = null;
    this.appMetadata = appMetadata;
  }

  public ArrowMessage(ArrowDictionaryBatch batch) {
    ByteBuffer serializedMessage = MessageSerializer.serializeMetadata(batch);
    serializedMessage = serializedMessage.slice();
    this.message = MessageMetadataResult.create(serializedMessage, serializedMessage.remaining());
    // asInputStream will free the buffers implicitly, so increment the reference count
    batch.getDictionary().getBuffers().forEach(buf -> buf.getReferenceManager().retain());
    this.bufs = ImmutableList.copyOf(batch.getDictionary().getBuffers());
    this.descriptor = null;
    this.appMetadata = null;
  }

  private ArrowMessage(FlightDescriptor descriptor, MessageMetadataResult message, ArrowBuf appMetadata,
                       ArrowBuf buf) {
    this.message = message;
    this.descriptor = descriptor;
    this.appMetadata = appMetadata;
    this.bufs = buf == null ? ImmutableList.of() : ImmutableList.of(buf);
  }

  public MessageMetadataResult asSchemaMessage() {
    return message;
  }

  public FlightDescriptor getDescriptor() {
    return descriptor;
  }

  public HeaderType getMessageType() {
    return HeaderType.getHeader(message.headerType());
  }

  public Schema asSchema() {
    Preconditions.checkArgument(bufs.size() == 0);
    Preconditions.checkArgument(getMessageType() == HeaderType.SCHEMA);
    return MessageSerializer.deserializeSchema(message);
  }

  public ArrowRecordBatch asRecordBatch() throws IOException {
    Preconditions.checkArgument(bufs.size() == 1, "A batch can only be consumed if it contains a single ArrowBuf.");
    Preconditions.checkArgument(getMessageType() == HeaderType.RECORD_BATCH);

    ArrowBuf underlying = bufs.get(0);

    underlying.getReferenceManager().retain();
    return  MessageSerializer.deserializeRecordBatch(message, underlying);
  }

  public ArrowDictionaryBatch asDictionaryBatch() throws IOException {
    Preconditions.checkArgument(bufs.size() == 1, "A batch can only be consumed if it contains a single ArrowBuf.");
    Preconditions.checkArgument(getMessageType() == HeaderType.DICTIONARY_BATCH);
    ArrowBuf underlying = bufs.get(0);
    // Retain a reference to keep the batch alive when the message is closed
    underlying.getReferenceManager().retain();
    return MessageSerializer.deserializeDictionaryBatch(message, underlying);
  }

  public Iterable<ArrowBuf> getBufs() {
    return Iterables.unmodifiableIterable(bufs);
  }

  private static ArrowMessage frame(BufferAllocator allocator, final InputStream stream) {

    try {
      FlightDescriptor descriptor = null;
      MessageMetadataResult header = null;
      ArrowBuf body = null;
      ArrowBuf appMetadata = null;
      while (stream.available() > 0) {
        int tag = readRawVarint32(stream);
        switch (tag) {

          case DESCRIPTOR_TAG: {
            int size = readRawVarint32(stream);
            byte[] bytes = new byte[size];
            ByteStreams.readFully(stream, bytes);
            descriptor = FlightDescriptor.parseFrom(bytes);
            break;
          }
          case HEADER_TAG: {
            int size = readRawVarint32(stream);
            byte[] bytes = new byte[size];
            ByteStreams.readFully(stream, bytes);
            header = MessageMetadataResult.create(ByteBuffer.wrap(bytes), size);
            break;
          }
          case APP_METADATA_TAG: {
            int size = readRawVarint32(stream);
            appMetadata = allocator.buffer(size);
            GetReadableBuffer.readIntoBuffer(stream, appMetadata, size, FAST_PATH);
            break;
          }
          case BODY_TAG:
            if (body != null) {
              // only read last body.
              body.getReferenceManager().release();
              body = null;
            }
            int size = readRawVarint32(stream);
            body = allocator.buffer(size);
            GetReadableBuffer.readIntoBuffer(stream, body, size, FAST_PATH);
            break;

          default:
            // ignore unknown fields.
        }
      }

      return new ArrowMessage(descriptor, header, appMetadata, body);
    } catch (Exception ioe) {
      throw new RuntimeException(ioe);
    }

  }

  private static int readRawVarint32(InputStream is) throws IOException {
    int firstByte = is.read();
    return CodedInputStream.readRawVarint32(firstByte, is);
  }

  /**
   * Convert the ArrowMessage to an InputStream.
   * @return InputStream
   */
  private InputStream asInputStream(BufferAllocator allocator) {
    try {

      final ByteString bytes = ByteString.copyFrom(message.getMessageBuffer(),
          message.bytesAfterMessage());

      if (getMessageType() == HeaderType.SCHEMA) {

        final FlightData.Builder builder = FlightData.newBuilder()
            .setDataHeader(bytes);

        if (descriptor != null) {
          builder.setFlightDescriptor(descriptor);
        }

        Preconditions.checkArgument(bufs.isEmpty());
        return NO_BODY_MARSHALLER.stream(builder.build());
      }

      Preconditions.checkArgument(getMessageType() == HeaderType.RECORD_BATCH ||
          getMessageType() == HeaderType.DICTIONARY_BATCH);
      Preconditions.checkArgument(!bufs.isEmpty());
      Preconditions.checkArgument(descriptor == null, "Descriptor should only be included in the schema message.");

      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      CodedOutputStream cos = CodedOutputStream.newInstance(baos);
      cos.writeBytes(FlightData.DATA_HEADER_FIELD_NUMBER, bytes);

      if (appMetadata != null && appMetadata.capacity() > 0) {
        // Must call slice() as CodedOutputStream#writeByteBuffer writes -capacity- bytes, not -limit- bytes
        cos.writeByteBuffer(FlightData.APP_METADATA_FIELD_NUMBER, appMetadata.asNettyBuffer().nioBuffer().slice());
        // This is weird, but implicitly, writing an ArrowMessage frees any references it has
        appMetadata.getReferenceManager().release();
      }

      cos.writeTag(FlightData.DATA_BODY_FIELD_NUMBER, WireFormat.WIRETYPE_LENGTH_DELIMITED);
      int size = 0;
      List<ByteBuf> allBufs = new ArrayList<>();
      for (ArrowBuf b : bufs) {
        allBufs.add(b.asNettyBuffer());
        size += b.readableBytes();
        // [ARROW-4213] These buffers must be aligned to an 8-byte boundary in order to be readable from C++.
        if (b.readableBytes() % 8 != 0) {
          int paddingBytes = 8 - (b.readableBytes() % 8);
          assert paddingBytes > 0 && paddingBytes < 8;
          size += paddingBytes;
          allBufs.add(PADDING_BUFFERS.get(paddingBytes).retain());
        }
      }
      // rawvarint is used for length definition.
      cos.writeUInt32NoTag(size);
      cos.flush();

      ArrowBuf initialBuf = allocator.buffer(baos.size());
      initialBuf.writeBytes(baos.toByteArray());
      final CompositeByteBuf bb = new CompositeByteBuf(allocator.getAsByteBufAllocator(), true, bufs.size() + 1,
          ImmutableList.<ByteBuf>builder().add(initialBuf.asNettyBuffer()).addAll(allBufs).build());
      // Implicitly, transfer ownership of our buffers to the input stream (which will decrement the refcount when done)
      final ByteBufInputStream is = new DrainableByteBufInputStream(bb);
      return is;
    } catch (Exception ex) {
      throw new RuntimeException("Unexpected IO Exception", ex);
    }

  }

  private class DrainableByteBufInputStream extends ByteBufInputStream implements Drainable {

    private final CompositeByteBuf buf;

    public DrainableByteBufInputStream(CompositeByteBuf buffer) {
      super(buffer, buffer.readableBytes(), true);
      this.buf = buffer;
    }

    @Override
    public int drainTo(OutputStream target) throws IOException {
      int size = buf.readableBytes();
      if (FAST_PATH && AddWritableBuffer.add(buf, target)) {
        return size;
      }

      buf.getBytes(0, target, buf.readableBytes());
      return size;
    }

    @Override
    public void close() {
      buf.release();
    }

  }

  public static Marshaller<ArrowMessage> createMarshaller(BufferAllocator allocator) {
    return new ArrowMessageHolderMarshaller(allocator);
  }

  private static class ArrowMessageHolderMarshaller implements MethodDescriptor.Marshaller<ArrowMessage> {

    private final BufferAllocator allocator;

    public ArrowMessageHolderMarshaller(BufferAllocator allocator) {
      this.allocator = allocator;
    }

    @Override
    public InputStream stream(ArrowMessage value) {
      return value.asInputStream(allocator);
    }

    @Override
    public ArrowMessage parse(InputStream stream) {
      return ArrowMessage.frame(allocator, stream);
    }

  }

  @Override
  public void close() throws Exception {
    AutoCloseables.close(bufs);
    if (appMetadata != null) {
      appMetadata.close();
    }
  }
}


text:
package foss.devmapal.axis_allies_calc.axis_allies_calc;

import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.preference.PreferenceFragment;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

/**
 * A simple {@link android.support.v4.app.Fragment} subclass.
 * Activities that contain this fragment must implement the
 * {@link SettingsFragment.OnFragmentInteractionListener} interface
 * to handle interaction events.
 * Use the {@link SettingsFragment#newInstance} factory method to
 * create an instance of this fragment.
 *
 */
public class SettingsFragment extends PreferenceFragment {
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        addPreferencesFromResource(R.xml.pref_general);
    }
}


text:
	#include <android/log.h>
#elif IOS
	#import <Foundation/Foundation.h>
#endif

#undef LOG_TAG
#undef LOGD
#undef LOGW
#undef LOGE
#define LOG_TAG "libtalkingdata"
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)
#define LOGW(...) __android_log_print(ANDROID_LOG_WARN,LOG_TAG,__VA_ARGS__)
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)

#endif // __TDGALog_h__


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

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

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

#import <Foundation/Foundation.h>
#import "CMISNetworkProvider.h"

@interface CMISDefaultNetworkProvider : NSObject <CMISNetworkProvider>

@end

@interface CMISDefaultNetworkProvider (Protected)

+ (NSMutableURLRequest *)createRequestForUrl:(NSURL *)url
                                  httpMethod:(CMISHttpRequestMethod)httpRequestMethod
                                     session:(CMISBindingSession *)session;

@end


text:
package picard.sam;

import htsjdk.samtools.SAMException;
import htsjdk.samtools.SAMSequenceDictionary;
import htsjdk.samtools.SAMSequenceDictionaryCodec;
import htsjdk.samtools.SAMSequenceRecord;
import htsjdk.samtools.reference.ReferenceSequence;
import htsjdk.samtools.reference.ReferenceSequenceFileFactory;
import htsjdk.samtools.util.AsciiWriter;
import htsjdk.samtools.util.IOUtil;
import htsjdk.samtools.util.Log;
import htsjdk.samtools.util.Md5CalculatingOutputStream;
import htsjdk.samtools.util.SequenceUtil;
import htsjdk.samtools.util.StringUtil;
import org.broadinstitute.barclay.argparser.Argument;
import org.broadinstitute.barclay.argparser.CommandLineProgramProperties;
import org.broadinstitute.barclay.help.DocumentedFeature;
import picard.PicardException;
import picard.cmdline.CommandLineProgram;
import picard.cmdline.StandardOptionDefinitions;
import picard.cmdline.argumentcollections.ReferenceArgumentCollection;
import picard.cmdline.programgroups.ReferenceProgramGroup;
import picard.util.SequenceDictionaryUtils;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;

/**
 * Create a SAM/BAM file from a fasta containing reference sequence. The output SAM file contains a header but no
 * SAMRecords, and the header contains only sequence records.
 */
@DocumentedFeature
@CommandLineProgramProperties(
        summary = CreateSequenceDictionary.USAGE_SUMMARY + CreateSequenceDictionary.USAGE_DETAILS,
        oneLineSummary = CreateSequenceDictionary.USAGE_SUMMARY,
        programGroup = ReferenceProgramGroup.class
)
public class CreateSequenceDictionary extends CommandLineProgram {
    static final String USAGE_SUMMARY = "Creates a sequence dictionary for a reference sequence.  ";
    static final String USAGE_DETAILS = "This tool creates a sequence dictionary file (with \".dict\" extension) from a reference " +
            "sequence provided in FASTA format, which is required by many processing and analysis tools. The output file contains a " +
            "header but no SAMRecords, and the header contains only sequence records." +
            "

" +
            "The reference sequence can be gzipped (both .fasta and .fasta.gz are supported)." +
            "" +
            "
Usage example:
" +
            "
" +
            "java -jar picard.jar CreateSequenceDictionary \\
" +
            "      R=reference.fasta \\
" +
            "      O=reference.dict" +
            "" +
            "
" +
            "
";
    // The following attributes define the command-line arguments

    private static final Log logger = Log.getInstance(CreateSequenceDictionary.class);

    @Argument(doc = "Output SAM file containing only the sequence dictionary. By default it will use the base name of the input reference with the .dict extension",
            shortName = StandardOptionDefinitions.OUTPUT_SHORT_NAME, optional = true)
    public File OUTPUT;

    @Argument(shortName = "AS", doc = "Put into AS field of sequence dictionary entry if supplied", optional = true)
    public String GENOME_ASSEMBLY;

    @Argument(shortName = "UR", doc = "Put into UR field of sequence dictionary entry.  If not supplied, input reference file is used",
            optional = true)
    public String URI;

    @Argument(shortName = "SP", doc = "Put into SP field of sequence dictionary entry", optional = true)
    public String SPECIES;

    @Argument(doc = "Make sequence name the first word from the > line in the fasta file.  " +
            "By default the entire contents of the > line is used, excluding leading and trailing whitespace.")
    public boolean TRUNCATE_NAMES_AT_WHITESPACE = true;

    @Argument(doc = "Stop after writing this many sequences.  For testing.")
    public int NUM_SEQUENCES = Integer.MAX_VALUE;

    @Argument(shortName = "AN", doc = "Optional file containing the alternative names for the contigs. "
            + "Tools may use this information to consider different contig notations as identical (e.g: 'chr1' and '1'). "
            + "The alternative names will be put into the appropriate @AN annotation for each contig. "
            + "No header. "
            + "First column is the original name, the second column is an alternative name. "
            + "One contig may have more than one alternative name.",
            optional = true)
    public File ALT_NAMES = null;

    private final MessageDigest md5;
    /**
     * Regular expression defined in the sam spec. Any alternative contig should match this regular expression
     * TODO: replace the pattern with a constant : see https://github.com/samtools/htsjdk/pull/956/files
     */
    private static final Pattern ALTERNATIVE_CONTIG_NAME_PATTERN = Pattern.compile("[0-9A-Za-z][0-9A-Za-z\\*\\+@\\|\\-]*");

    /**
     * 'AN' attribute in the dictionary
     * TODO: replace "AN" with a constant : see https://github.com/samtools/htsjdk/pull/956/files
     */
    private static final String AN_ATTRIBUTE = "AN";

    public CreateSequenceDictionary() {
        try {
            md5 = MessageDigest.getInstance("MD5");
        } catch (NoSuchAlgorithmException e) {
            throw new PicardException("MD5 algorithm not found", e);
        }
    }

    /**
     * Read all the sequences from the given reference file, and convert into SAMSequenceRecords
     *
     * @param referenceFile fasta or fasta.gz
     * @return SAMSequenceRecords containing info from the fasta, plus from cmd-line arguments.
     */
    public SAMSequenceDictionary makeSequenceDictionary(final File referenceFile) {
        final Iterable<SAMSequenceRecord> samSequenceRecordsIterable = getSamSequenceRecordsIterable();

        final List<SAMSequenceRecord> ret = new ArrayList<>();
        final Set<String> sequenceNames = new HashSet<>();
        for (SAMSequenceRecord rec : samSequenceRecordsIterable) {

            if (sequenceNames.contains(rec.getSequenceName())) {
                throw new PicardException("Sequence name appears more than once in reference: " + rec.getSequenceName());
            }
            sequenceNames.add(rec.getSequenceName());
            ret.add(rec);
        }
        return new SAMSequenceDictionary(ret);
    }

    private Iterable<SAMSequenceRecord> getSamSequenceRecordsIterable() {
        return () -> {
            final SequenceDictionaryUtils.SamSequenceRecordsIterator iterator =
                    new SequenceDictionaryUtils.SamSequenceRecordsIterator(REFERENCE_SEQUENCE,
                            TRUNCATE_NAMES_AT_WHITESPACE);
            iterator.setGenomeAssembly(GENOME_ASSEMBLY);
            iterator.setSpecies(SPECIES);
            iterator.setUri(URI);
            return iterator;
        };
    }

    /**
     * Use reference filename to create URI to go into header if URI was not passed on cmd line.
     */
    protected String[] customCommandLineValidation() {
        if (URI == null) {
            URI = "file:" + referenceSequence.getReferenceFile().getAbsolutePath();
        }
        if (OUTPUT == null) {
            OUTPUT = ReferenceSequenceFileFactory.getDefaultDictionaryForReferenceSequence(referenceSequence.getReferenceFile());
            logger.info("Output dictionary will be written in ", OUTPUT);
        }
        return super.customCommandLineValidation();
    }

    // return a custom argument collection because this tool uses the argument name
    // "REFERENCE" instead of "REFERENCE_SEQUENCE"
    @Override
    protected ReferenceArgumentCollection makeReferenceArgumentCollection() {
        return new CreateSeqDictReferenceArgumentCollection();
    }

    public static class CreateSeqDictReferenceArgumentCollection implements ReferenceArgumentCollection {
        @Argument(doc = "Input reference fasta or fasta.gz", shortName = StandardOptionDefinitions.REFERENCE_SHORT_NAME)
        public File REFERENCE;

        @Override
        public File getReferenceFile() {
            return REFERENCE;
        }
    }

    /**
     * Do the work after command line has been parsed.
     * RuntimeException may be thrown by this method, and are reported appropriately.
     *
     * @return program exit status.
     */
    protected int doWork() {
        int sequencesWritten = 0;

        if (OUTPUT.exists()) {
            throw new PicardException(OUTPUT.getAbsolutePath() +
                    " already exists.  Delete this file and try again, or specify a different output file.");
        }
        IOUtil.assertFileIsWritable(OUTPUT);

        // map for aliases mapping a contig to its aliases
        final Map<String, Set<String>> aliasesByContig = loadContigAliasesMap();

        try (BufferedWriter writer = makeWriter()) {
            final Iterable<SAMSequenceRecord> samSequenceRecordIterable = getSamSequenceRecordsIterable();
            SAMSequenceDictionaryCodec samDictCodec = new SAMSequenceDictionaryCodec(writer);

            samDictCodec.encodeHeaderLine(false);
            // read reference sequence one by one and write its metadata
            for (SAMSequenceRecord samSequenceRecord : samSequenceRecordIterable) {
                // retrieve aliases, if any
                final Set<String> aliases = aliasesByContig.get(samSequenceRecord.getSequenceName());
                if (aliases != null) {
                    // "Alternative names is a comma separated list of alternative names"
                    samSequenceRecord.setAttribute(AN_ATTRIBUTE, String.join(",", aliases));
                }
                samDictCodec.encodeSequenceRecord(samSequenceRecord);

                if (++sequencesWritten >= NUM_SEQUENCES) {
                    break;
                }
            }
        } catch (IOException e) {
            throw new PicardException("Can't write to or close output file " + OUTPUT.getAbsolutePath(), e);
        } catch (IllegalArgumentException e) {
            // in case of an unexpected error delete the file so that there isn't a
            // truncated result which might be valid yet wrong.
            OUTPUT.delete();
            throw new PicardException("Unknown problem. Partial dictionary file was deleted.", e);
        }

        return 0;
    }

    private BufferedWriter makeWriter() throws FileNotFoundException {
        return new BufferedWriter(
                new AsciiWriter(this.CREATE_MD5_FILE ?
                        new Md5CalculatingOutputStream(
                                new FileOutputStream(OUTPUT, false),
                                new File(OUTPUT.getAbsolutePath() + ".md5")
                        )
                        : new FileOutputStream(OUTPUT)
                )
        );
    }

    /**
     * Load the file ALT_NAMES containing the alternative contig names
     *
     * @return a Map<src_contig,Set<new_names>>. Never null. May be empty if ALT_NAMES is null.
     * @throws PicardException if there is any error in the file ALT_NAMES
     * @author Pierre Lindenbaum
     */
    private Map<String, Set<String>> loadContigAliasesMap() throws PicardException {
        // return an empty map if no mapping file was provided
        if (this.ALT_NAMES == null) {
            return Collections.emptyMap();
        }
        // the map returned by the function
        final Map<String, Set<String>> aliasesByContig = new HashMap<>();
        try {
            for (final String line : IOUtil.slurpLines(this.ALT_NAMES)) {
                if (StringUtil.isBlank(line)) {
                    continue;
                }
                final int tab = line.indexOf('\t');
                if (tab == -1) {
                    throw new IOException("tabulation missing in " + line);
                }
                final String contigName = line.substring(0, tab);
                final String altName = line.substring(tab + 1);
                // check for empty values
                if (StringUtil.isBlank(contigName)) {
                    throw new IOException("empty contig in " + line);
                }
                if (StringUtil.isBlank(altName)) {
                    throw new IOException("empty alternative name in " + line);
                }
                if (altName.equals(contigName)) {
                    continue;
                }
                try {
                    SAMSequenceRecord.validateSequenceName(altName);
                } catch (final SAMException exception) {
                    throw new IOException("Illegal alternative reference sequence name in " + line, exception);
                }
                // check alias not previously defined as contig
                if (aliasesByContig.containsKey(altName)) {
                    throw new IOException("alternate name " + altName +
                            " previously defined as a contig in " + line);
                }
                // check contig not previously defined as alias
                if (aliasesByContig.keySet().stream()
                        // not an error if defined twice for same contig
                        .filter(K -> !K.equals(contigName))
                        .anyMatch(K -> aliasesByContig.get(K).contains(contigName))) {
                    throw new IOException("contig  " + contigName +
                            " previously defined as an alternate name in " + line);
                }
                // add alias
                if (!aliasesByContig.containsKey(contigName)) {
                    aliasesByContig.put(contigName, new HashSet<>());
                }
                aliasesByContig.get(contigName).add(altName);
            }
            return aliasesByContig;
        } catch (final IOException e) {
            throw new PicardException("Can't read alias file " + ALT_NAMES, e);
        }
    }
}


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

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;

using ForgottenSchism.engine;

namespace ForgottenSchism.control
{
    class Select: Control
    {
        /// <summary>
        /// Time to show that the user pressed an arrow key (yellow arrow)
        /// </summary>
        static readonly TimeSpan actionLength = TimeSpan.FromMilliseconds(300);

        /// <summary>
        /// When to stop showing that the user pressed an arrow key (yellow arrow)
        /// </summary>
        TimeSpan stopAction;

        /// <summary>
        /// Unselected Left Arrow Texture
        /// </summary>
        Texture2D ula;

        /// <summary>
        /// Selected Left Arrow Texture
        /// </summary>
        Texture2D sla;

        /// <summary>
        /// Unselected Right Arrow Texture
        /// </summary>
        Texture2D ura;

        /// <summary>
        /// Selected Right Arrow Texture
        /// </summary>
        Texture2D sra;

        /// <summary>
        /// Activated Right Arrow Texture
        /// </summary>
        Texture2D ara;

        /// <summary>
        /// Activated Left Arrow Texture
        /// </summary>
        Texture2D ala;

        SpriteFont font;
        bool r;

        /// <summary>
        /// Element List
        /// </summary>
        List<String> els;

        /// <summary>
        /// Curent selected element index
        /// </summary>
        int sel;

        public EventHandler selectionChanged;

        public Select()
        {
            stopAction = new TimeSpan(0);
            els = new List<String>();
            sel = 0;

            font = Content.Graphics.Instance.DefaultFont;

            loadContent();
        }

        public void add(String e)
        {
            els.Add(e);

            if (font.MeasureString(e).X+48 > Size.X)
                Size = new Vector2(font.MeasureString(e).X + 48, Size.Y);

            if (font.MeasureString(e).Y > Size.Y)
                Size = new Vector2(Size.X, font.MeasureString(e).Y);
        }

        public String SelectedValue
        {
            get { if(els.Count!=0) return els[sel]; else return null; }
        }

        public int Selection
        {
            get { return sel; }
            set { sel = value; }
        }

        private void loadContent()
        {
            ura = Graphic.Instance.arrowRight(20, 20, Color.Blue);
            sra = Graphic.Instance.arrowRight(20, 20, ColorTheme.Default.getColor(true, true));
            ula = Graphic.Instance.arrowLeft(20, 20, Color.Blue);
            sla = Graphic.Instance.arrowLeft(20, 20, ColorTheme.Default.getColor(true, true));
            ala = Graphic.Instance.arrowLeft(20, 20, ColorTheme.Default.ActionColor);
            ara = Graphic.Instance.arrowRight(20, 20, ColorTheme.Default.ActionColor);

            Size=new Vector2(48, 20);
        }

        public override void handleInput(GameTime gameTime)
        {
            if (InputHandler.keyReleased(Keys.Right))
            {
                sel++;
                if (sel > els.Count - 1)
                    sel = 0;

                r = true;

                stopAction = gameTime.TotalGameTime + actionLength;
            }
            else if(InputHandler.keyReleased(Keys.Left))
            {
                sel--;
                if (sel < 0)
                    sel = els.Count - 1;

                r = false;

                stopAction = gameTime.TotalGameTime + actionLength;
            }

            if (InputHandler.arrowReleased() && selectionChanged != null)
                selectionChanged(this, new EventArgObject(els[sel]));

        }

        public override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);

            if (els.Count == 0)
                els.Add(" ");

            if(HasFocus)
                if(stopAction>gameTime.TotalGameTime)
                    if(!r)
                        Graphic.Instance.SB.Draw(ala, new Rectangle((int)Position.X, (int)Position.Y, 20, (int)Size.Y), Color.White);
                    else
                        Graphic.Instance.SB.Draw(sla, new Rectangle((int)Position.X, (int)Position.Y, 20, (int)Size.Y), Color.White);
                else
                    Graphic.Instance.SB.Draw(sla, new Rectangle((int)Position.X, (int)Position.Y, 20, (int)Size.Y), Color.White);
            else
                Graphic.Instance.SB.Draw(ula, new Rectangle((int)Position.X, (int)Position.Y, 20, (int)Size.Y), Color.White);

            Graphic.Instance.SB.DrawString(font, els[sel], new Vector2(Position.X + 23, Position.Y), ColorTheme.Default.LabelCT.get(ColorTheme.LabelColorTheme.LabelFunction.NORM));

            if (HasFocus)
                if (stopAction > gameTime.TotalGameTime)
                    if (r)
                        Graphic.Instance.SB.Draw(ara, new Rectangle((int)(Position.X + (Size.X - 20)), (int)Position.Y, 20, (int)Size.Y), Color.White);
                    else
                        Graphic.Instance.SB.Draw(sra, new Rectangle((int)(Position.X + (Size.X - 20)), (int)Position.Y, 20, (int)Size.Y), Color.White);
                else
                    Graphic.Instance.SB.Draw(sra, new Rectangle((int)(Position.X + (Size.X - 20)), (int)Position.Y, 20, (int)Size.Y), Color.White);
            else
                Graphic.Instance.SB.Draw(ura, new Rectangle((int)(Position.X + (Size.X - 20)), (int)Position.Y, 20, (int)Size.Y), Color.White);
        }
    }
}