text:
indexer -c /root/sphinx.conf --all
supervisord -c /root/supervisord.conf

redpajama_set_name: RedPajamaGithub


text:
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/platform/web_url_loader_mock_factory.h"
#include "third_party/blink/public/web/web_view.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_gc_controller.h"
#include "third_party/blink/renderer/core/frame/frame_test_helpers.h"
#include "third_party/blink/renderer/core/frame/web_local_frame_impl.h"
#include "third_party/blink/renderer/platform/testing/unit_test_helpers.h"
#include "third_party/blink/renderer/platform/testing/url_test_helpers.h"
#include "v8/include/v8-profiler.h"
#include "v8/include/v8.h"

namespace blink {

namespace {

const v8::HeapGraphNode* GetProperty(v8::Isolate* isolate,
                                     const v8::HeapGraphNode* node,
                                     v8::HeapGraphEdge::Type type,
                                     const char* name) {
  for (int i = 0, count = node->GetChildrenCount(); i < count; ++i) {
    const v8::HeapGraphEdge* prop = node->GetChild(i);
    if (prop->GetType() == type) {
      v8::String::Utf8Value prop_name(isolate, prop->GetName());
      if (!strcmp(name, *prop_name))
        return prop->GetToNode();
    }
  }
  return nullptr;
}

int GetNumObjects(v8::Isolate* isolate, const char* constructor) {
  v8::HandleScope scope(isolate);
  v8::HeapProfiler* profiler = isolate->GetHeapProfiler();
  const v8::HeapSnapshot* snapshot = profiler->TakeHeapSnapshot();
  if (!snapshot)
    return -1;
  int count = 0;
  for (int i = 0; i < snapshot->GetNodesCount(); ++i) {
    const v8::HeapGraphNode* node = snapshot->GetNode(i);
    if (node->GetType() != v8::HeapGraphNode::kObject)
      continue;
    v8::String::Utf8Value node_name(isolate, node->GetName());
    if (!strcmp(constructor, *node_name)) {
      const v8::HeapGraphNode* constructor_prop = GetProperty(
          isolate, node, v8::HeapGraphEdge::kProperty, "constructor");
      // Skip an Object instance named after the constructor.
      if (constructor_prop) {
        v8::String::Utf8Value constructor_name(isolate,
                                               constructor_prop->GetName());
        if (!strcmp(constructor, *constructor_name))
          continue;
      }
      ++count;
    }
  }
  return count;
}

}  // namespace

class ListenerLeakTest : public testing::Test {
 public:
  void RunTestAndGC(const std::string& filename) {
    std::string base_url("http://www.example.com/");
    std::string file_name(filename);
    url_test_helpers::RegisterMockedURLLoadFromBase(
        WebString::FromUTF8(base_url), blink::test::CoreTestDataPath(),
        WebString::FromUTF8(file_name));
    web_view_helper.InitializeAndLoad(base_url + file_name);
    ThreadState::Current()->CollectAllGarbageForTesting();
  }

  v8::Isolate* isolate() const {
    return ToIsolate(web_view_helper.LocalMainFrame()->GetFrame());
  }

  void TearDown() override {
    url_test_helpers::UnregisterAllURLsAndClearMemoryCache();
  }

 protected:
  frame_test_helpers::WebViewHelper web_view_helper;
};

// This test tries to create a reference cycle between node and its listener.
// See http://crbug/17400.
TEST_F(ListenerLeakTest, ReferenceCycle) {
  RunTestAndGC("listener/listener_leak1.html");
  ASSERT_EQ(0, GetNumObjects(isolate(), "EventListenerLeakTestObject1"));
}

// This test sets node onclick many times to expose a possible memory
// leak where all listeners get referenced by the node.
TEST_F(ListenerLeakTest, HiddenReferences) {
  RunTestAndGC("listener/listener_leak2.html");
  ASSERT_EQ(1, GetNumObjects(isolate(), "EventListenerLeakTestObject2"));
}

}  // namespace blink


text:
package org.luaj.vm2.lib;

import java.util.Random;

import org.luaj.vm2.LuaDouble;
import org.luaj.vm2.LuaTable;
import org.luaj.vm2.LuaValue;
import org.luaj.vm2.Varargs;

/**
 * Subclass of {@link LibFunction} which implements the lua standard {@code math}
 * library.
 *

 * It contains only the math library support that is possible on JME.
 * For a more complete implementation based on math functions specific to JSE
 * use {@link org.luaj.vm2.lib.jse.JseMathLib}.
 * In Particular the following math functions are not implemented by this library:
 *

 *
acos

 *
asin

 *
atan

 *
cosh

 *
log

 *
sinh

 *
tanh

 *
atan2

 *

 *

 * The implementations of {@code exp()} and {@code pow()} are constructed by
 * hand for JME, so will be slower and less accurate than when executed on the JSE platform.
 *

 * Typically, this library is included as part of a call to either
 * {@link JsePlatform#standardGlobals()} or {@link JmePlatform#standardGlobals()}
 *
 {@code
 * Globals globals = JsePlatform.standardGlobals();
 * System.out.println( globals.get("math").get("sqrt").call( LuaValue.valueOf(2) ) );
 * }

 * When using {@link JsePlaform} as in this example, the subclass {@link JseMathLib} will
 * be included, which also includes this base functionality.
 *

 * To instantiate and use it directly,
 * link it into your globals table via {@link LuaValue#load(LuaValue)} using code such as:
 *
 {@code
 * Globals globals = new Globals();
 * globals.load(new JseBaseLib());
 * globals.load(new PackageLib());
 * globals.load(new MathLib());
 * System.out.println( globals.get("math").get("sqrt").call( LuaValue.valueOf(2) ) );
 * }

 * Doing so will ensure the library is properly initialized
 * and loaded into the globals table.
 *

 * This has been implemented to match as closely as possible the behavior in the corresponding library in C.
 * @see LibFunction
 * @see JsePlatform
 * @see JmePlatform
 * @see JseMathLib
 * @see Lua 5.2 Math Lib Reference
 */
public class MathLib extends TwoArgFunction {

	public static MathLib MATHLIB = null;

	public MathLib() {
		MATHLIB = this;
	}

	public LuaValue call(LuaValue modname, LuaValue env) {
		LuaTable math = new LuaTable(0,30);
		math.set("abs", new abs());
		math.set("ceil", new ceil());
		math.set("cos", new cos());
		math.set("deg", new deg());
		math.set("exp", new exp(this));
		math.set("floor", new floor());
		fmod fmod_func = new fmod();
		math.set("mod", fmod_func);
		math.set("fmod", fmod_func);
		math.set("frexp", new frexp());
		math.set("huge", LuaDouble.POSINF );
		math.set("ldexp", new ldexp());
		math.set("max", new max());
		math.set("min", new min());
		math.set("modf", new modf());
		math.set("pi", Math.PI );
		math.set("pow", new pow());
		random r;
		math.set("random", r = new random());
		math.set("randomseed", new randomseed(r));
		math.set("rad", new rad());
		math.set("sin", new sin());
		math.set("sqrt", new sqrt());
		math.set("tan", new tan());
		env.set("math", math);
		env.get("package").get("loaded").set("math", math);
		return math;
	}

	abstract protected static class UnaryOp extends OneArgFunction {
		public LuaValue call(LuaValue arg) {
			return valueOf(call(arg.checkdouble()));
		}
		abstract protected double call(double d);
	}

	abstract protected static class BinaryOp extends TwoArgFunction {
		public LuaValue call(LuaValue x, LuaValue y) {
			return valueOf(call(x.checkdouble(), y.checkdouble()));
		}
		abstract protected double call(double x, double y);
	}

	static final class abs extends UnaryOp { protected double call(double d) { return Math.abs(d); } }
	static final class ceil extends UnaryOp { protected double call(double d) { return Math.ceil(d); } }
	static final class cos extends UnaryOp { protected double call(double d) { return Math.cos(d); } }
	static final class deg extends UnaryOp { protected double call(double d) { return Math.toDegrees(d); } }
	static final class floor extends UnaryOp { protected double call(double d) { return Math.floor(d); } }
	static final class rad extends UnaryOp { protected double call(double d) { return Math.toRadians(d); } }
	static final class sin extends UnaryOp { protected double call(double d) { return Math.sin(d); } }
	static final class sqrt extends UnaryOp { protected double call(double d) { return Math.sqrt(d); } }
	static final class tan extends UnaryOp { protected double call(double d) { return Math.tan(d); } }

	static final class exp extends UnaryOp {
		final MathLib mathlib;
		exp(MathLib mathlib) {
			this.mathlib = mathlib;
		}
		protected double call(double d) {
			return mathlib.dpow_lib(Math.E,d);
		}
	}

	static final class fmod extends BinaryOp {
		protected double call(double x, double y) {
			double q = x/y;
			return x - y * (q>=0? Math.floor(q): Math.ceil(q));
		}
	}
	static final class ldexp extends BinaryOp {
		protected double call(double x, double y) {
			// This is the behavior on os-x, windows differs in rounding behavior.
			return x * Double.longBitsToDouble((((long) y) + 1023) << 52);
		}
	}
	static final class pow extends BinaryOp {
		protected double call(double x, double y) {
			return MathLib.dpow_default(x, y);
		}
	}

	static class frexp extends VarArgFunction {
		public Varargs invoke(Varargs args) {
			double x = args.checkdouble(1);
			if ( x == 0 ) return varargsOf(ZERO,ZERO);
			long bits = Double.doubleToLongBits( x );
			double m = ((bits & (~(-1L<<52))) + (1L<<52)) * ((bits >= 0)? (.5 / (1L<<52)): (-.5 / (1L<<52)));
			double e = (((int) (bits >> 52)) & 0x7ff) - 1022;
			return varargsOf( valueOf(m), valueOf(e) );
		}
	}

	static class max extends VarArgFunction {
		public Varargs invoke(Varargs args) {
			double m = args.checkdouble(1);
			for ( int i=2,n=args.narg(); i<=n; ++i )
				m = Math.max(m,args.checkdouble(i));
			return valueOf(m);
		}
	}

	static class min extends VarArgFunction {
		public Varargs invoke(Varargs args) {
			double m = args.checkdouble(1);
			for ( int i=2,n=args.narg(); i<=n; ++i )
				m = Math.min(m,args.checkdouble(i));
			return valueOf(m);
		}
	}

	static class modf extends VarArgFunction {
		public Varargs invoke(Varargs args) {
			double x = args.checkdouble(1);
			double intPart = ( x > 0 ) ? Math.floor( x ) : Math.ceil( x );
			double fracPart = x - intPart;
			return varargsOf( valueOf(intPart), valueOf(fracPart) );
		}
	}

	static class random extends LibFunction {
		Random random = new Random();
		public LuaValue call() {
			return valueOf( random.nextDouble() );
		}
		public LuaValue call(LuaValue a) {
			int m = a.checkint();
			if (m<1) argerror(1, "interval is empty");
			return valueOf( 1 + random.nextInt(m) );
		}
		public LuaValue call(LuaValue a, LuaValue b) {
			int m = a.checkint();
			int n = b.checkint();
			if (n<m) argerror(2, "interval is empty");
			return valueOf( m + random.nextInt(n+1-m) );
		}

	}

	static class randomseed extends OneArgFunction {
		final random random;
		randomseed(random random) {
			this.random = random;
		}
		public LuaValue call(LuaValue arg) {
			long seed = arg.checklong();
			random.random = new Random(seed);
			return NONE;
		}
	}

	/** compute power using installed math library, or default if there is no math library installed */
	public static LuaValue dpow(double a, double b) {
		return LuaDouble.valueOf(
				MATHLIB!=null?
				MATHLIB.dpow_lib(a,b):
				dpow_default(a,b) );
	}
	public static double dpow_d(double a, double b) {
		return MATHLIB!=null?
				MATHLIB.dpow_lib(a,b):
				dpow_default(a,b);
	}

	/**
	 * Hook to override default dpow behavior with faster implementation.
	 */
	public double dpow_lib(double a, double b) {
		return dpow_default(a,b);
	}

	/**
	 * Default JME version computes using longhand heuristics.
	 */
	protected static double dpow_default(double a, double b) {
		if ( b < 0 )
			return 1 / dpow_default( a, -b );
		double p = 1;
		int whole = (int) b;
		for ( double v=a; whole > 0; whole>>=1, v*=v )
			if ( (whole & 1) != 0 )
				p *= v;
		if ( (b -= whole) > 0 ) {
			int frac = (int) (0x10000 * b);
			for ( ; (frac&0xffff)!=0; frac<<=1 ) {
				a = Math.sqrt(a);
				if ( (frac & 0x8000) != 0 )
					p *= a;
			}
		}
		return p;
	}

}


text:
require 'spec_helper'
require 'rspec/collection_matchers'
require 'json_client'
require 'vcr'

VCR.configure do |c|
  c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
  c.hook_into :webmock
end

describe JsonClient::DSL::SerializersCollector do
  let(:collected) do
    'hello world'
  end

  subject { described_class.new }

  describe '::method_missing' do
    it 'defines the method and returns the first argument' do
      subject.on :a, :b, use: 'hello'

      expect(subject.a).to eq 'hello'
      expect(subject.b).to eq 'hello'
    end
  end
end


text:
package com.heliosdecompiler.helios.transformers.compilers;

import com.heliosdecompiler.helios.handler.ExceptionHandler;
import com.sun.tools.javac.main.Main;
import org.apache.commons.io.FileUtils;

import java.io.File;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.nio.file.Files;

public class JavaCompiler extends Compiler {

    JavaCompiler() {
        super("java", "Java");
    }

    @Override
    public byte[] compile(String name, String contents) {
        File tmpdir = null;
        File javaFile = null;
        File classFile = null;
        File classpathFile = null;
        try {
            tmpdir = Files.createTempDirectory("javac").toFile();
            javaFile = new File(tmpdir, name + ".java");
            classFile = new File(tmpdir, name + ".class");
            classpathFile = new File(tmpdir, "classpath.jar");
            FileUtils.write(javaFile, contents, "UTF-8", false);
//            Utils.save(classpathFile, FileManager.getAllLoadedData());

            StringWriter stringWriter = new StringWriter();

            com.sun.tools.javac.main.Main compiler =
                    new com.sun.tools.javac.main.Main("javac", new PrintWriter(stringWriter));
            int responseCode = compiler.compile(new String[]{
                    "-d",
                    tmpdir.getAbsolutePath(),
                    "-classpath",
                    /*buildPath(Arrays.asList(classFile)),*/
                    javaFile.getAbsolutePath()
            }).exitCode;

            if (responseCode != Main.Result.OK.exitCode) {
                System.out.println(stringWriter.toString());
//                Shell shell = SWTUtil.generateLongMessage("Error", stringWriter.toString());
//                shell.getDisplay().syncExec(() -> {
//                    SWTUtil.center(shell);
//                    shell.open();
//                });
            } else {
                return FileUtils.readFileToByteArray(classFile);
            }
        } catch (Exception e) {
            ExceptionHandler.handle(e);
        } finally {
            FileUtils.deleteQuietly(javaFile);
            FileUtils.deleteQuietly(classFile);
            FileUtils.deleteQuietly(classpathFile);
            FileUtils.deleteQuietly(tmpdir);
        }
        return null;
    }
}


text:
<tool id="spades_rnaviralspades" name="rnaviralSPAdes" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="20.01">
    <description>de novo assembler for transcriptomes, metatranscriptomes and metaviromes</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="requirements"/>
    <expand macro="stdio"/>
    <expand macro="version_command"/>
    <command detect_errors="exit_code"><![CDATA[

#set $library = 1

@PREPROCESS_INPUT_FILES_MAIN@
#if $additional_reads.selector == 'true'
    @PREPROCESS_INPUT_FILES_ADDITIONAL@
#end if
@PREPROCESS_NANOPORE_PACBIO_FILES@
@PREPROCESS_CONTIGS_FILES@
@PREPROCESS_SANGER_FILES@

## run
spades.py --rnaviral
    -o 'output'
    @RESOURCES@
    @INPUT_READS_MAIN@
    #if $additional_reads.selector == 'true'
        @INPUT_READS_ADDITIONAL@
    #end if
    ## additional reads
    @NANOPORE_PACBIO@
    @SANGER@
    @CONTIGS@
    ## parameter
    @KMER@
    @PIPELINE_OPTIONS@
    @PHREDOFFSET@

    ## postprocessing
    @STATS@
    @CORRECTED@
    ]]></command>
    <inputs>
        <expand macro="input_files_all" format="fastq,fasta,fastq.gz,fastqsanger.gz,fasta.gz" label="FASTQ RNA-seq file(s)"/>
        <expand macro="input_additional_files_all" format="fastq,fastq.gz,fastqsanger.gz,fasta,fasta.gz" label="FASTQ RNA-seq file(s)"/>

            <expand macro="sanger"/>
            <expand macro="nanopore_pacbio"/>
            <expand macro="contigs"/>

        <expand macro="pipeline_options">
            <option value="--iontorrent">Iontorrent: required when assembling IonTorrent data (--iontorrent)</option>
        </expand>
        <expand macro="kmer" help="By default rnaSPAdes uses 2 k-mer sizes, which are automatically detected using read length (approximately one third and half of the maximal read length). We recommend not to change this parameter because smaller k-mer sizes typically result in multiple chimeric (misassembled) transcripts."/>
        <expand macro="phred"/>
        <expand macro="optional_output"/>
    </inputs>
    <outputs>
        <expand macro="out_ag"/>
        <expand macro="out_ags"/>
        <expand macro="out_cn"/>
        <expand macro="out_cp"/>
        <expand macro="out_cr"/>
        <expand macro="out_cs"/>
        <expand macro="out_l"/>
        <expand macro="out_sc"/>
        <expand macro="out_sp"/>
        <expand macro="out_ss"/>
    </outputs>
    <tests>

        <test expect_num_outputs="4">
            <conditional name="singlePaired">
                <param name="sPaired" value="paired_interlaced"/>
                <param name="input1" value="ecoli_1K.fastq.gz"/>
            </conditional>
            <output name="out_ag">
                <assert_contents>
                    <has_n_lines n="36"/>
                    <has_text_matching expression=">EDGE\_3\_length.+"/>
                </assert_contents>
            </output>
            <output name="out_ags">
                <assert_contents>
                    <has_n_lines n="2"/>
                    <has_text_matching expression="S.+"/>
                </assert_contents>
            </output>
            <output name="out_cn">
                <assert_contents>
                    <has_n_lines n="18"/>
                    <has_text_matching expression=">NODE\_1\_length\_1000\_cov\_.+"/>
                </assert_contents>
            </output>
            <output name="out_sc">
                <assert_contents>
                    <has_n_lines n="18"/>
                    <has_text_matching expression=">NODE\_1\_length\_1000.+"/>
                </assert_contents>
            </output>
        </test>

        <test expect_num_outputs="10">
            <conditional name="singlePaired">
                <param name="sPaired" value="paired"/>
                <param name="input1" value="ecoli_1K_1.fastq.gz"/>
                <param name="input2" value="ecoli_1K_2.fastq.gz"/>
            </conditional>
            <conditional name="cov_cond">
                <param name="cov_cutoff" value="auto"/>
            </conditional>
            <param name="mode_sel" value="--disable-rr,--iontorrent"/>
            <param name="phred_offset" value="33"/>
            <param name="optional_output" value="ag,ags,cn,cp,cs,cr,sc,sp,ss,l"/>
            <output name="out_ag">
                <assert_contents>
                    <has_n_lines n="36"/>
                    <has_text_matching expression=">EDGE.+"/>
                </assert_contents>
            </output>
            <output name="out_ags">
                <assert_contents>
                    <has_n_lines n="1"/>
                    <has_text_matching expression="S.+"/>
                </assert_contents>
            </output>
            <output name="out_cn">
                <assert_contents>
                    <has_n_lines n="18"/>
                    <has_text_matching expression=">NODE.+"/>
                </assert_contents>
            </output>
            <output name="out_cp">
                <assert_contents>
                    <has_n_lines n="0"/>
                </assert_contents>
            </output>
            <output_collection name="out_cr" type="list" count="2">
                <element name="ecoli_1K_1.fastq.gz.fastq0_0.cor">
                    <assert_contents>
                        <has_size value="34468" delta="2000"/>
                    </assert_contents>
                </element>
                <element name="ecoli_1K_2.fastq.gz.fastq0_0.cor">
                    <assert_contents>
                        <has_size value="34468" delta="2000"/>
                    </assert_contents>
                </element>
            </output_collection>
            <output name="out_cs">
                <assert_contents>
                    <has_n_lines n="1"/>
                    <has_text_matching expression="#name	length	coverage"/>
                </assert_contents>
            </output>
            <output name="out_l">
                <assert_contents>
                    <has_text_matching expression="Thank you for using SPAdes!"/>
                </assert_contents>
            </output>
            <output name="out_sc">
                <assert_contents>
                    <has_n_lines n="0"/>
                </assert_contents>
            </output>
            <output name="out_sp">
                <assert_contents>
                    <has_n_lines n="0"/>
                </assert_contents>
            </output>
            <output name="out_ss">
                <assert_contents>
                    <has_n_lines n="0"/>
                </assert_contents>
            </output>
        </test>

        <test expect_num_outputs="4">
            <conditional name="singlePaired">
                <param name="sPaired" value="paired"/>
                <param name="input1" value="ecoli_1K_1.fastq.gz"/>
                <param name="input2" value="ecoli_1K_2.fastq.gz"/>
            </conditional>
            <output name="out_ag">
                <assert_contents>
                    <has_n_lines n="36"/>
                    <has_text_matching expression=">EDGE_3_length_1000_cov_163.370137"/>
                </assert_contents>
            </output>
            <output name="out_ags">
                <assert_contents>
                    <has_n_lines n="2"/>
                    <has_text_matching expression="S.+"/>
                </assert_contents>
            </output>
            <output name="out_cn">
                <assert_contents>
                    <has_n_lines n="18"/>
                    <has_text_matching expression=">NODE\_1\_length\_1000\_cov\_.+"/>
                </assert_contents>
            </output>
            <output name="out_sc">
                <assert_contents>
                    <has_n_lines n="18"/>
                    <has_text_matching expression=">NODE\_1\_length\_1000.+"/>
                </assert_contents>
            </output>
        </test>

        <test expect_num_outputs="4">
            <param name="operation_mode" value="--only-assembler"/>
            <conditional name="singlePaired">
                <param name="sPaired" value="single"/>
                <param name="input1" value="ecoli_1K.fastq.gz"/>
            </conditional>
            <conditional name="additional_reads">
                <param name="selector" value="true"/>
                <conditional name="singlePaired">
                    <param name="sPaired" value="paired"/>
                    <param name="input1" value="ecoli_1K_1.fastq.gz"/>
                    <param name="input2" value="ecoli_1K_2.fastq.gz"/>
                </conditional>
            </conditional>

                <param name="nanopore" value="ecoli_1K.fastq.gz"/>
                <param name="pacbio" value="ecoli_1K.fastq.gz"/>
                <param name="sanger" value="ecoli_1K.fastq.gz"/>
                <param name="trusted_contigs" value="ecoli_1K.fasta.gz"/>

            <assert_command>
                <has_text text="--nanopore"/>
                <has_text text="--pacbio"/>
                <has_text text="--sanger"/>
                <has_text text="--trusted-contigs"/>
            </assert_command>
            <output name="out_ag">
                <assert_contents>
                    <has_n_lines n="36"/>
                    <has_text_matching expression=">EDGE_.+"/>
                </assert_contents>
            </output>
            <output name="out_ags">
                <assert_contents>
                    <has_n_lines n="2"/>
                    <has_text_matching expression="S.+"/>
                </assert_contents>
            </output>
            <output name="out_cn">
                <assert_contents>
                    <has_n_lines n="18"/>
                    <has_text_matching expression=">NODE\_1\_length\_1000\_cov\_.+"/>
                </assert_contents>
            </output>
            <output name="out_sc">
                <assert_contents>
                    <has_n_lines n="18"/>
                    <has_text_matching expression=">NODE\_1\_length\_1000.+"/>
                </assert_contents>
            </output>
        </test>

        <test expect_num_outputs="4">
            <param name="operation_mode" value="--only-assembler"/>
            <conditional name="singlePaired">
                <param name="sPaired" value="single"/>
                <param name="input1" value="ecoli_1K.fastq.gz"/>
            </conditional>
            <conditional name="additional_reads">
                <param name="selector" value="true"/>
                <conditional name="singlePaired">
                    <param name="sPaired" value="paired"/>
                    <param name="input1" value="ecoli_1K_1.fastq.gz"/>
                    <param name="input2" value="ecoli_1K_2.fastq.gz"/>
                </conditional>
                <param name="library_number" value="false"/>
            </conditional>

            <output name="out_ag">
                <assert_contents>
                    <has_n_lines n="36"/>
                    <has_text_matching expression=">EDGE_3_length_1000_cov_326.740273"/>
                </assert_contents>
            </output>
            <output name="out_ags">
                <assert_contents>
                    <has_n_lines n="2"/>
                    <has_text_matching expression="S.+"/>
                </assert_contents>
            </output>
            <output name="out_cn">
                <assert_contents>
                    <has_n_lines n="18"/>
                    <has_text_matching expression=">NODE\_1\_length\_1000\_cov\_.+"/>
                </assert_contents>
            </output>
            <output name="out_sc">
                <assert_contents>
                    <has_n_lines n="18"/>
                    <has_text_matching expression=">NODE\_1\_length\_1000.+"/>
                </assert_contents>
            </output>
        </test>
    </tests>
    <help><![CDATA[
.. class:: infomark

**What it does**

@HELP_WID@

rnaviralSPAdes is a pipeline specially designed for de novo assembler tailored for RNA viral datasets (transcriptome, metatranscriptome and metavirome).

**Input**

@HELP_IN@

**Output**

@HELP_OUT_AG@
@HELP_OUT_AGS@
@HELP_OUT_C@
@HELP_OUT_CP@
@HELP_OUT_CR@
@HELP_OUT_CS@
@HELP_OUT_L@
@HELP_OUT_S@
@HELP_OUT_SP@
@HELP_OUT_SS@

-------------------

.. class:: infomark

**IonTorrent data**

@IONTORRENT@

-------------------

.. class:: infomark

**References**

More information are available on `github <https://github.com/ablab/spades>`_ and on the `project website <http://cab.spbu.ru/software/spades>`_.
    ]]></help>
    <expand macro="citations"/>
</tool>


text:
	<?php $nextPost = get_next_post(true); if($nextPost) { $nextThumbnail = get_the_post_thumbnail($nextPost->ID, 'x1'); } ?><?php if($nextPost) next_post_link( '%link', $nextThumbnail); ?>

	<?php if ($nextPost) { $nextCustomTitle = get_post_meta($nextPost->ID, 'custom_title', true); } // getting custom_title value from the next post ?>
	<?php
	if ($nextPost && $nextCustomTitle) { ?>

<?php  next_post_link( '%link', $nextCustomTitle, true );?>

		<?php } else { // if post custom_title is not set fallback to original post title ?>

<?php  next_post_link( '%link', '%title', true );?>

	<?php } ?>
		<?php if($nextPost) next_post_link( '%link', '' ); // left arrow with link ?>

	<?php $prevPost = get_previous_post(true); if($prevPost) previous_post_link( '%link', '' ); // right arrow with link ?>

	<?php if ($prevPost) { $prevCustomTitle = get_post_meta($prevPost->ID, 'custom_title', true); } // getting custom_title value from the previous post ?>
	<?php
	if ($prevPost && $prevCustomTitle) { ?>

<?php  previous_post_link( '%link', $prevCustomTitle, true );?>

		<?php } else { // if post custom_title is not set fallback to original post title ?>

<?php  previous_post_link( '%link', '%title', true );?>

	<?php } ?>

	<?php if($prevPost) { $prevThumbnail = get_the_post_thumbnail($prevPost->ID, 'x1'); } ?><?php if($prevPost) previous_post_link( '%link', $prevThumbnail); ?>


text:
<?php
/**
 * The wire sidebar
 */

echo elgg_view('page/elements/tagcloud_block', array(
	'subtypes' => 'thewire',
	'owner_guid' => elgg_get_page_owner_guid(),
));


text:
<ion-view>
    <ion-nav-bar class="bar-positive">
        <ion-nav-title>

        </ion-nav-title>
        <ion-nav-back-button class="button-clear">
             Back
        </ion-nav-back-button>
    </ion-nav-bar>
    <ion-content padding="true" class="has-header">

  ion-help-circled question gestures: swipt left=skip swipe right=back swipe up=discard swipe down=hint tap=show answer answer gestures: swipe right: back to question swipe left: next question swipe down: wrong swipe up: discard

    </ion-content>
</ion-view>


text:
import 'core-js'
import 'regenerator-runtime/runtime'
import React from 'react'
import { RelayEnvironmentProvider } from 'relay-hooks'
import { BrowserProtocol } from 'farce'
import { createInitialFarceRouter } from 'found'
import { hydrate } from 'react-dom'
import { createStore } from 'redux'
import { Provider } from 'react-redux'
import '@primer/css/index.scss?global'

import ClientFetcher from './ClientFetcher'
import {
  createResolver,
  createRouteConfig,
  historyMiddlewares,
  render,
} from '../router'
import './global.scss'

/* eslint no-underscore-dangle: 0 */

const reducer = (store: any) => store

const init = async () => {
  const fetcher = new ClientFetcher(window.__RELAY_PAYLOADS__ || {})
  delete window.__RELAY_PAYLOADS__
  const resolver = createResolver(fetcher)

  const preloadedState = window.__PRELOADED_STATE__
  delete window.__PRELOADED_STATE__
  const store = createStore(reducer, preloadedState)
  const routeConfig = createRouteConfig(store)

  const Router = await createInitialFarceRouter({
    historyProtocol: new BrowserProtocol(),
    historyMiddlewares,
    resolver,
    render,
    routeConfig,
  })

  const element = document.getElementById('root')

  if (element) {
    hydrate(
      <RelayEnvironmentProvider environment={resolver.environment}>
        <Provider store={store}>
          <Router resolver={resolver} />
        </Provider>
      </RelayEnvironmentProvider>,
      element,
    )
  }

  if (module.hot) module.hot.accept()
}

init()


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/select_parent"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <androidx.appcompat.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
        app:contentInsetStart="72dp"
        android:background="@color/setting_sub_toolbar"/>

    <FrameLayout
        android:id="@+id/no_content_frame"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:layout_marginTop="48dp">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="16dp"
                android:layout_marginEnd="16dp"
                android:gravity="center"
                android:textSize="16sp"
                android:text="Data fetching is turned off.  Turn on data fetching to configure options."/>

        </LinearLayout>

    </FrameLayout>

    <FrameLayout
        android:id="@+id/content_frame"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</LinearLayout>


text:
package com.felixlaura.java.entity;

import java.sql.Timestamp;
import java.util.Calendar;
import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;

@Entity
public class VerificationToken {

	private static final int EXPIRATION = 60*24;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;

	private String token;

	@OneToOne(targetEntity = User.class, fetch = FetchType.EAGER)
	@JoinColumn(nullable = false, name = "user_id")
	private User user;

	private Date expiryDate;

	private boolean verified;

	public VerificationToken() {
		super();
	}

	public VerificationToken(String token, User user) {
		super();
		this.token = token;
		this.user = user;
		this.expiryDate = calculateExpiryDate(EXPIRATION);
		this.verified = false;
	}

	public Long getId() {
		return id;
	}

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

	public String getToken() {
		return token;
	}

	public void setToken(String token) {
		this.token = token;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public Date getExpiryDate() {
		return expiryDate;
	}

	public void setExpiryDate(Date expiryDate) {
		this.expiryDate = expiryDate;
	}

	public boolean isVerified() {
		return verified;
	}

	public void setVerified(boolean verified) {
		this.verified = verified;
	}

	public static int getExpiration() {
		return EXPIRATION;
	}

	private Date calculateExpiryDate(int expiryTimeMinutes) {
		Calendar cal = Calendar.getInstance();
		cal.setTime(new Timestamp(cal.getTime().getTime()));
		cal.add(Calendar.MINUTE, expiryTimeMinutes);
		return new Date(cal.getTime().getTime());
	}

}


text:
class AlterCustomers1 < ActiveRecord::Migration
  def change
    add_column :customers, :birth_year, :integer
    add_column :customers, :birth_month, :integer
    add_column :customers, :birth_mday, :integer

    add_index :customers, [:birth_year, :birth_month, :birth_mday]
    add_index :customers, [:birth_month, :birth_mday]
    add_index :customers, :given_name_kana
    add_index :customers, [:birth_year, :family_name_kana, :given_name_kana],
      name: 'index_customers_on_birth_year_and_furigana'
    add_index :customers, [:birth_year, :given_name_kana]
    add_index :customers, [:birth_month, :family_name_kana, :given_name_kana],
      name: 'index_customers_on_birth_month_and_furigana'
    add_index :customers, [:birth_month, :given_name_kana]
    add_index :customers, [:birth_mday, :family_name_kana, :given_name_kana],
      name: 'index_customers_on_birth_mday_and_furigana'
    add_index :customers, [:birth_mday, :given_name_kana]
  end
end


text:
[![Latest Version](https://img.shields.io/github/release/php-http/react-client.svg?style=flat-square)](https://github.com/php-http/react-client/releases)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)
[![Build Status](https://img.shields.io/travis/php-http/react-client.svg?style=flat-square)](https://travis-ci.org/php-http/react-client)
[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/php-http/react-client.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-http/react-client)
[![Quality Score](https://img.shields.io/scrutinizer/g/php-http/react-client.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-http/react-client)
[![Total Downloads](https://img.shields.io/packagist/dt/php-http/react-client.svg?style=flat-square)](https://packagist.org/packages/php-http/react-client)

[ReactHTTP](http://reactphp.org/) client.

## Install

Via Composer

``` bash
$ composer require php-http/react-client
```

## Usage

## Testing

``` bash
$ composer test
```

## Contributing

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.

## Security

If you discover any security related issues, please contact us at [security@php-http.org](mailto:security@php-http.org).

## License

The MIT License (MIT). Please see [License File](LICENSE) for more information.


text:
<?php
function fragment_footer()
{
?>

    This web site was created by District Education.

<?php
}
?>


text:
[![Build Status](https://travis-ci.org/cjdrake/boolexpr.svg?branch=master)](https://travis-ci.org/cjdrake/boolexpr)

BoolExpr is a C++ library for symbolic Boolean algebra.

[Read the docs!][boolexpr]

## System Dependencies

This code is known to compile on Ubuntu Trusty Linux.
Install the following dependencies:

    sudo apt-get install -y build-essential cmake doxygen

## Getting Started

To get started using the code,
first clone the repository and its `third_party` dependencies:

    git clone --recursive https://github.com/cjdrake/boolexpr
    cd boolexpr

Create a local build directory, and run `cmake`:

    mkdir build
    cd build
    cmake -DCMAKE_BUILD_TYPE=Coverage ..
    make

## Run Tests

After the dependencies have been built,
to run the functional test suite::

    make do_test

To collect code coverage data::

    make cover

The coverage report will be in `build/html/index.html`.

## Build Documentation

The documentation uses [Doxygen][doxygen] and [Sphinx][sphinx].
To build the html version:

    pip install sphinx
    make pyhtml

The documentation will be in `build/python/build/sphinx/html/index.html`.

## Contributing

If you have some idea you would like to see realized,
please email me.

[boolexpr]: http://www.boolexpr.org
[doxygen]: http://www.doxygen.org
[sphinx]: http://www.sphinx-doc.org


text:
<?php
// 收支趋势统计部件

class StatisticTrendPart extends PartBase implements PartInterface {

	public function getTemplateFile(){
		return '/pbs/part/StatisticTrendPart.html';
	}
}

?>


text:
<?php declare(strict_types = 1);

namespace Contributte\Psr7;

use GuzzleHttp\Psr7\Uri;
use Nette\Http\UrlScript;

class Psr7Uri extends Uri
{

	/** @var UrlScript */
	protected $urlScript;

	public function getUrlScript(): UrlScript
	{
		return $this->urlScript;
	}

	/**
	 * @return static
	 */
	public function withUrlScript(UrlScript $url): self
	{
		$new = clone $this;
		$new->urlScript = $url;

		return $new;
	}

}


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

module ProjectSpecs
  describe AbstractTarget do
    describe 'In general' do

      before do
        @target = @project.new_target(:static_library, 'Pods', :ios)
      end

      it 'returns the product name, which is the name of the binary (minus prefix/suffix)' do
        @target.name.should == 'Pods'
        @target.product_name.should == 'Pods'
      end
    end

    #----------------------------------------#

    describe 'Helpers' do

      before do
        @target = @project.new_target(:static_library, 'Pods', :ios)
      end

      describe '#common_resolved_build_setting' do

        it 'returns the resolved build setting for the given key as indicated in the target build configuration' do
          @project.build_configuration_list.set_setting('ARCHS', nil)
          @target.build_configuration_list.set_setting('ARCHS', 'VALID_ARCHS')
          @target.resolved_build_setting('ARCHS').should == { 'Release' => 'VALID_ARCHS', 'Debug' => 'VALID_ARCHS' }
        end

        it 'returns the resolved build setting for the given key as indicated in the project build configuration' do
          @project.build_configuration_list.set_setting('ARCHS', 'VALID_ARCHS')
          @target.build_configuration_list.set_setting('ARCHS', nil)
          @target.resolved_build_setting('ARCHS').should == { 'Release' => 'VALID_ARCHS', 'Debug' => 'VALID_ARCHS' }
        end

        it 'overrides the project settings with the target ones' do
          @project.build_configuration_list.set_setting('ARCHS', 'VALID_ARCHS')
          @target.build_configuration_list.set_setting('ARCHS', 'arm64')
          @target.resolved_build_setting('ARCHS').should == { 'Release' => 'arm64', 'Debug' => 'arm64' }
        end

      end

      #----------------------------------------#

      describe '#common_resolved_build_setting' do

        it 'returns the common resolved build setting for the given key as indicated in the target build configuration' do
          @project.build_configuration_list.set_setting('ARCHS', nil)
          @target.build_configuration_list.set_setting('ARCHS', 'VALID_ARCHS')
          @target.common_resolved_build_setting('ARCHS').should == 'VALID_ARCHS'
        end

        it 'returns the common resolved build setting for the given key as indicated in the project build configuration' do
          @project.build_configuration_list.set_setting('ARCHS', 'VALID_ARCHS')
          @target.build_configuration_list.set_setting('ARCHS', nil)
          @target.common_resolved_build_setting('ARCHS').should == 'VALID_ARCHS'
        end

        it 'raises if the build setting has multiple values across the build configurations' do
          @target.build_configuration_list.build_configurations.first.build_settings['ARCHS'] = 'arm64'
          @target.build_configuration_list.build_configurations.last.build_settings['ARCHS'] = 'VALID_ARCHS'
          should.raise do
            @target.common_resolved_build_setting('ARCHS')
          end.message.should.match /multiple values/
        end

        it 'ignores nil values when determining if an unique value exists' do
          @target.build_configuration_list.build_configurations.first.build_settings['ARCHS'] = nil
          @target.build_configuration_list.build_configurations.last.build_settings['ARCHS'] = 'VALID_ARCHS'
          should.not.raise do
            @target.common_resolved_build_setting('ARCHS')
          end

        end

      end

      #----------------------------------------#

      it 'returns the SDK specified in its build configuration' do
        @project.build_configuration_list.set_setting('SDKROOT', nil)
        @target.build_configuration_list.set_setting('SDKROOT', 'iphoneos')
        @target.sdk.should == 'iphoneos'
      end

      it 'returns the SDK of the project if one is not specified in the build configurations' do
        @project.build_configuration_list.set_setting('SDKROOT', 'iphoneos')
        @target.build_configuration_list.set_setting('SDKROOT', nil)
        @target.sdk.should == 'iphoneos'
      end

      it 'returns the platform name' do
        @project.new_target(:static_library, 'Pods', :ios).platform_name.should == :ios
        @project.new_target(:static_library, 'Pods', :osx).platform_name.should == :osx
      end

      it 'returns the SDK version' do
        @project.new_target(:static_library, 'Pods', :ios).sdk_version.should.nil?
        @project.new_target(:static_library, 'Pods', :osx).sdk_version.should.nil?

        t1 = @project.new_target(:static_library, 'Pods', :ios)
        t1.build_configuration_list.set_setting('SDKROOT', 'iphoneos7.0')
        t1.sdk_version.should == '7.0'

        t2 = @project.new_target(:static_library, 'Pods', :osx)
        t2.build_configuration_list.set_setting('SDKROOT', 'macosx10.8')
        t2.sdk_version.should == '10.8'
      end

      it 'returns the deployment target specified in its build configuration' do
        @project.build_configuration_list.set_setting('IPHONEOS_DEPLOYMENT_TARGET', nil)
        @project.build_configuration_list.set_setting('MACOSX_DEPLOYMENT_TARGET', nil)
        @project.new_target(:static_library, 'Pods', :ios).deployment_target.should == '4.3'
        @project.new_target(:static_library, 'Pods', :osx).deployment_target.should == '10.7'
      end

      it 'returns the deployment target' do
        @project.build_configuration_list.set_setting('IPHONEOS_DEPLOYMENT_TARGET', '4.3')
        @project.build_configuration_list.set_setting('MACOSX_DEPLOYMENT_TARGET', '10.7')
        mac_target = @project.new_target(:static_library, 'Pods', :ios)
        mac_target.build_configurations.first.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = nil
        mac_target.deployment_target.should == '4.3'
      end

      it 'returns the build configuration' do
        build_configurations = @target.build_configurations
        build_configurations.map(&:isa).uniq.should == ['XCBuildConfiguration']
        build_configurations.map(&:name).sort.should == %w(Debug Release)
      end

      #----------------------------------------#

      describe '#add_build_configuration' do

        it 'adds a new build configuration' do
          @target.add_build_configuration('App Store', :release)
          @target.build_configurations.map(&:name).sort.should == ['App Store', 'Debug', 'Release']
        end

        it 'configures new build configurations according to the given type' do
          @target.add_build_configuration('App Store', :release)
          @target.build_settings('App Store')['OTHER_CFLAGS'].should == ['-DNS_BLOCK_ASSERTIONS=1', '$(inherited)']
        end

        it "doesn't duplicate build configurations with existing names" do
          @target.add_build_configuration('App Store', :release)
          @target.add_build_configuration('App Store', :release)
          @target.build_configurations.map(&:name).grep('App Store').size.should == 1
        end

        it 'returns the new build configuration' do
          conf = @target.add_build_configuration('App Store', :release)
          conf.name.should == 'App Store'
        end

        it 'returns the existing build configuration' do
          conf_1 = @target.add_build_configuration('App Store', :release)
          conf_2 = @target.add_build_configuration('App Store', :release)
          conf_1.object_id.should == conf_2.object_id
        end

      end

      #----------------------------------------#

      it 'returns the build settings of the configuration with the given name' do
        @target.build_settings('Debug')['PRODUCT_NAME'].should == '$(TARGET_NAME)'
      end

      describe '#add_dependency' do

        it 'adds a dependency on another target' do
          dependency_target = @project.new_target(:static_library, 'Pods-SMCalloutView', :ios)
          @target.add_dependency(dependency_target)
          @target.dependencies.count.should == 1
          target_dependency = @target.dependencies.first
          target_dependency.target.should == dependency_target
          container_proxy = target_dependency.target_proxy
          container_proxy.container_portal.should == @project.root_object.uuid
          container_proxy.proxy_type.should == '1'
          container_proxy.remote_global_id_string.should == dependency_target.uuid
          container_proxy.remote_info.should == dependency_target.name
        end

        it 'adds a dependency on a target in a subproject' do
          path = fixture_path('Sample Project/ReferencedProject/ReferencedProject.xcodeproj')
          subproject = Xcodeproj::Project.open(path)
          dependency_target = subproject.targets.first
          subproject_file_reference = @project.main_group.new_file(path)
          @target.add_dependency(dependency_target)

          @target.dependencies.count.should == 1
          target_dependency = @target.dependencies.first
          target_dependency.target.should == dependency_target

          target_dependency.target_proxy.container_portal.should == subproject_file_reference.uuid
        end

        it "doesn't add a dependency on a target in an unknown project" do
          unknown_project = Xcodeproj::Project.new('/other_project_dir/OtherProject.xcodeproj')
          dependency_target = unknown_project.new_target(:static_library, 'Pods-SMCalloutView', :ios)

          should.raise ArgumentError do
            @target.add_dependency(dependency_target)
          end.message.should.match /not this project/
        end

        it "doesn't duplicate dependencies" do
          dependency_target = @project.new_target(:static_library, 'Pods-SMCalloutView', :ios)
          @target.add_dependency(dependency_target)
          @target.add_dependency(dependency_target)
          @target.dependencies.count.should == 1
        end
      end
    end

    #----------------------------------------#

    describe 'Build phases' do
      before do
        @target = @project.new_target(:static_library, 'Pods', :ios)
        @target.build_phases << @project.new(PBXCopyFilesBuildPhase)
        @target.build_phases << @project.new(PBXShellScriptBuildPhase)
      end

      {
        :headers_build_phase       => PBXHeadersBuildPhase,
        :source_build_phase        => PBXSourcesBuildPhase,
        :frameworks_build_phase    => PBXFrameworksBuildPhase,
        :resources_build_phase     => PBXResourcesBuildPhase,
        :copy_files_build_phases   => PBXCopyFilesBuildPhase,
        :shell_script_build_phases => PBXShellScriptBuildPhase,
      }.each do |association_method, klass|

        it "returns an empty #{klass.isa}" do
          phase = @target.send(association_method)
          if phase.is_a? Array
            phase = phase.first
          end

          phase.should.be.instance_of klass
          if phase.is_a? PBXFrameworksBuildPhase
            phase.files.count.should == 1
          else
            phase.files.to_a.should == []
          end
        end
      end

      it 'returns the frameworks build phase' do
        @target.frameworks_build_phases.class.should == PBXFrameworksBuildPhase
      end

      it "creates a new 'copy files build phase'" do
        before = @target.copy_files_build_phases.count
        @target.new_copy_files_build_phase
        @target.copy_files_build_phases.count.should == before + 1
      end

      it "creates a new 'shell script build phase'" do
        before = @target.shell_script_build_phases.count
        @target.new_shell_script_build_phase
        @target.shell_script_build_phases.count.should == before + 1
      end
    end

    #----------------------------------------#

    describe 'System frameworks' do

      before do
        @target = @project.new_target(:static_library, 'Pods', :ios)
        @target.frameworks_build_phase.clear
        @project.frameworks_group.clear
      end

      describe '#add_system_framework' do

        it 'adds a file reference for a system framework, in a dedicated subgroup of the Frameworks group' do
          @target.add_system_framework('QuartzCore')
          file = @project['Frameworks/iOS'].files.first
          file.path.should == 'Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/System/Library/Frameworks/QuartzCore.framework'
          file.source_tree.should == 'DEVELOPER_DIR'
        end

        it 'uses the sdk version of the target' do
          @target.build_configuration_list.set_setting('SDKROOT', 'iphoneos6.0')
          @target.add_system_framework('QuartzCore')
          file = @project['Frameworks/iOS'].files.first
          file.path.scan(/\d\.\d/).first.should == '6.0'
        end

        it 'uses the last known SDK version if none is specified in the target' do
          @target.build_configuration_list.set_setting('SDKROOT', 'iphoneos')
          @target.add_system_framework('QuartzCore')
          file = @project['Frameworks/iOS'].files.first
          file.path.scan(/\d\.\d/).first.should == Xcodeproj::Constants::LAST_KNOWN_IOS_SDK
        end

        it "doesn't duplicate references to a frameworks if one already exists" do
          @target.add_system_framework('QuartzCore')
          @target.add_system_framework('QuartzCore')
          @project['Frameworks/iOS'].files.count.should == 1
        end

        it 'adds the framework to the framework build phases' do
          @target.add_system_framework('QuartzCore')
          @target.frameworks_build_phase.file_display_names.should == ['QuartzCore.framework']
        end

        it "doesn't duplicate the frameworks in the build phases" do
          @target.add_system_framework('QuartzCore')
          @target.add_system_framework('QuartzCore')
          @target.frameworks_build_phase.files.count.should == 1
        end

        it 'can add multiple frameworks' do
          @target.add_system_frameworks(%w(CoreData QuartzCore))
          names = @target.frameworks_build_phase.file_display_names
          names.should == ['CoreData.framework', 'QuartzCore.framework']
        end
      end

      #----------------------------------------#

      describe '#add_system_library' do

        it 'adds a file reference for a system framework, to the Frameworks group' do
          @target.add_system_library('xml')
          file = @project['Frameworks'].files.first
          file.path.should == 'usr/lib/libxml.dylib'
          file.source_tree.should == 'SDKROOT'
        end

        it "doesn't duplicate references to a frameworks if one already exists" do
          @target.add_system_library('xml')
          @target.add_system_library('xml')
          @project.frameworks_group.files.count.should == 1
        end

        it 'adds the framework to the framework build phases' do
          @target.add_system_library('xml')
          @target.frameworks_build_phase.file_display_names.should == ['libxml.dylib']
        end

        it "doesn't duplicate the frameworks in the build phases" do
          @target.add_system_library('xml')
          @target.add_system_library('xml')
          @target.frameworks_build_phase.files.count.should == 1
        end

        it 'can add multiple libraries' do
          @target.add_system_libraries(%w(z xml))
          names = @target.frameworks_build_phase.file_display_names
          names.should == ['libz.dylib', 'libxml.dylib']
        end
      end

    end

    #----------------------------------------#

    describe 'AbstractObject Hooks' do

      before do
        @target = @project.new_target(:static_library, 'Pods', :ios)
      end

      it 'returns the pretty print representation' do
        pretty_print = @target.pretty_print
        pretty_print['Pods']['Build Phases'].should == [
          { 'SourcesBuildPhase' => [] },
          { 'FrameworksBuildPhase' => ['Foundation.framework'] },
        ]
        build_configurations = pretty_print['Pods']['Build Configurations']
        build_configurations.map { |bf| bf.keys.first } .should == %w(Release Debug)
      end
    end
  end

  #---------------------------------------------------------------------------#

  describe PBXNativeTarget do

    describe 'In general' do

      before do
        @target = @project.new_target(:static_library, 'Pods', :ios)
      end

      it 'returns the product name, which is the name of the binary (minus prefix/suffix)' do
        @target.name.should == 'Pods'
        @target.product_name.should == 'Pods'
      end

      it 'returns the product' do
        @target.product_reference.should.be.instance_of PBXFileReference
        @target.product_reference.path.should == 'libPods.a'
      end

      it 'returns that product type is a static library' do
        @target.product_type.should == 'com.apple.product-type.library.static'
      end

      it 'returns an empty list of dependencies and build rules' do
        @target.dependencies.to_a.should == []
        @target.build_rules.to_a.should == []
      end

      describe '#sort' do

        it 'can be sorted' do
          dep_2 = @project.new_target(:static_library, 'Dep_2', :ios)
          dep_1 = @project.new_target(:static_library, 'Dep_1', :ios)
          @target.add_dependency(dep_2)
          @target.add_dependency(dep_1)
          @target.sort
          @target.dependencies.map(&:display_name).should == %w(Dep_1 Dep_2)
        end

        it "doesn't sort the build phases" do
          @target.build_phases << @project.new(PBXSourcesBuildPhase)
          @target.build_phases << @project.new(PBXHeadersBuildPhase)
          @target.build_phases << @project.new(PBXSourcesBuildPhase)
          @target.sort
          @target.build_phases.map(&:isa).should == %w(PBXSourcesBuildPhase PBXFrameworksBuildPhase PBXSourcesBuildPhase PBXHeadersBuildPhase PBXSourcesBuildPhase)
        end
      end
    end

    #----------------------------------------#

    describe 'Helpers' do

      before do
        @target = @project.new_target(:static_library, 'Pods', :ios)
      end

      describe '#symbol_type' do
        it 'returns the symbol type' do
          @target.symbol_type.should == :static_library
        end

        it 'returns nil if the product type is unknown' do
          @target.stubs(:product_type => 'com.apple.product-type.new-stuff')
          @target.symbol_type.should.be.nil?
        end
      end

      it 'adds a list of sources file to the target to the source build phase' do
        ref = @project.main_group.new_file('Class.m')
        @target.add_file_references([ref], '-fobjc-arc')
        build_files = @target.source_build_phase.files
        build_files.count.should == 1
        build_files.first.file_ref.path.should == 'Class.m'
        build_files.first.settings.should == { 'COMPILER_FLAGS' => '-fobjc-arc' }
      end

      it 'adds a list of headers file to the target header build phases' do
        ref = @project.main_group.new_file('Class.h')
        @target.add_file_references([ref], '-fobjc-arc')
        build_files = @target.headers_build_phase.files
        build_files.count.should == 1
        build_files.first.file_ref.path.should == 'Class.h'
        build_files.first.settings.should.be.nil
      end

      it 'adds a list of resources to the resources build phase' do
        ref = @project.main_group.new_file('Image.png')
        @target.add_resources([ref])
        build_files = @target.resources_build_phase.files
        build_files.count.should == 1
        build_files.first.file_ref.path.should == 'Image.png'
        build_files.first.settings.should.be.nil
      end

    end

  end

  #---------------------------------------------------------------------------#
end


text:
import re
import mido
import melete.accom as Accom

class Composer:
    def __init__(self, rhythm, beats, chord_prog, pitch_range, accoms={}, skip_prob=0.5, bpm=180):
        self.rhythm = rhythm
        self.beats = beats
        self.chords = chord_prog
        self.pitch_range = pitch_range
        self.accoms = accoms
        self.skip_prob = skip_prob
        self.bpm = bpm

    def compose(self):
        notes = self.create_melody()
        tempo = int(1000000 / (self.bpm / 60.0))
        elapsed = 0

        with mido.MidiFile(ticks_per_beat=48, charset='utf-8') as midi:
            melody = mido.MidiTrack()
            melody.append(mido.MetaMessage('set_tempo', tempo=tempo))
            for t in range(len(self.beats.pairs)):
                time = int(self.beats.pairs[t][1] * 48 * 4 * self.rhythm.simple)
                note_off = int(48 * 4 * self.rhythm.simple)
                note_off = ((time + note_off) / note_off) * note_off - time
                if t + 1 < len(self.beats.pairs):
                    note_off = min(note_off, int(self.beats.pairs[t + 1][1] * 48 * 4 * self.rhythm.simple - time))
                melody.append(mido.Message('note_on', note=notes[t], time=time - elapsed))
                melody.append(mido.Message('note_off', note=notes[t], time=note_off))
                elapsed = time + note_off
            midi.tracks.append(melody)

            accom_track = Accom.create_midi_track(self.rhythm, self.beats.time, self.chords, self.accoms)
            midi.tracks.append(accom_track)
        return midi

    def create_melody(self):
        dp = dict((p, [0.0] * len(self.beats.pairs)) for p in self.pitch_range)
        trace = dict((p, [None] * len(self.beats.pairs)) for p in self.pitch_range)

        sounds = self.chords.current(0).sounds
        for sound in sounds:
            for pitch in self.pitch_range:
                if pitch % 12 == sound % 12:
                    dp[pitch][0] = 1.0

        for t in range(len(self.beats.pairs) - 1):
            for p in self.pitch_range:
                for np in range(p - 5, p + 5):
                    if np not in self.pitch_range:
                        continue

                    pair = self.beats.pairs[t]
                    word = re.findall('\^|_', pair[0])
                    chord = self.chords.current(pair[1])
                    prob = dp[p][t]

                    if p % 12 in map(lambda s: s % 12, chord.sounds):
                        prob *= 0.9
                    else:
                        prob *= 0.1

                    if len(word) > 0 and word[0] == '^':
                        if np > p:
                            prob *= 0.8
                        else:
                            prob *= 0.2
                    elif len(word) > 0 and word[0] == '_':
                        if np > p:
                            prob *= 0.2
                        else:
                            prob *= 0.8
                    else:
                        if np == p:
                            prob *= 0.9
                        else:
                            prob *= 0.1

                    if prob > dp[np][t + 1]:
                        dp[np][t + 1] = prob
                        trace[np][t + 1] = p

        last_chord = self.chords.current(self.beats.pairs[-1][1])
        last_probs = dict((p, dp[p][-1]) for p in self.pitch_range if p % 12 == last_chord.root)
        last_pitch = min(last_probs, key=last_probs.get)

        notes = [last_pitch]
        for t in range(len(self.beats.pairs) - 1, 0, -1):
            notes.append(trace[last_pitch][t])
            last_pitch = trace[last_pitch][t]

        return list(reversed(notes))

def concat_midi(head, tail):
    time = 0
    for i, track in enumerate(head.tracks):
        track_time = 0
        for message in track:
            if hasattr(message, 'time'):
                track_time += message.time
        time = max(track_time, time)

    with mido.MidiFile(ticks_per_beat=48, charset='utf-8') as midi:
        for i in range(max(len(head.tracks), len(tail.tracks))):
            track = mido.MidiTrack()
            elapsed = 0

            if i < len(head.tracks):
                for message in head.tracks[i]:
                    if message.type in ['note_on', 'note_off', 'set_tempo']:
                        track.append(message)
                        elapsed += message.time

            if i < len(tail.tracks):
                for j, message in enumerate(tail.tracks[i]):
                    if message.type in ['note_on', 'note_off', 'set_tempo']:
                        if j == 0:
                            message.time += (time - elapsed)
                        track.append(message)
            midi.tracks.append(track)

    return midi

def create(rhythm, beats, chord_progs, pitch_range, accoms=[], skip_prob=0.5, bpm=180):
    with mido.MidiFile(ticks_per_beat=48, charset='utf-8') as midi:
        for i in range(len(beats)):
            accom = {}
            if i < len(accoms):
                accom = accoms[i]
            composer = Composer(rhythm, beats[i], chord_progs[i], pitch_range, accom, skip_prob, bpm)
            midi = concat_midi(midi, composer.compose())
    return midi


text:
module Specinfra
  class Processor
    def self.check_service_is_running(service)
      cmd = Specinfra.command.get(:check_service_is_running, service)
      ret = Specinfra.backend.run_command(cmd)

      # In Ubuntu, some services are under upstart and "service foo status" returns
      # exit status 0 even though they are stopped.
      # So return false if stdout contains "stopped/waiting" or "stop/waiting".
      return false if ret.stdout =~ /stop(ped)?\/waiting/

      # If the service is not registered, check by ps command
      if ret.exit_status == 1 && !Specinfra.configuration.no_service_process_fallback
        cmd = Specinfra.command.get(:check_process_is_running, service)
        ret = Specinfra.backend.run_command(cmd)
      end

      ret.success?
    end

    def self.check_service_is_monitored_by_monit(process)
      cmd = Specinfra.command.get(:check_service_is_monitored_by_monit, process)
      ret = Specinfra.backend.run_command(cmd)
      return false unless ret.stdout != nil && ret.success?

      retlines = ret.stdout.split(/[\r\n]+/).map(&:strip)
      proc_index = retlines.index("Process '#{process}'")
      return false unless proc_index

      retlines[proc_index+2].match(/\Amonitoring status\s+monitored\Z/i) != nil
    end

    def self.check_file_is_readable(file, by_whom)
      cmd = Specinfra.command.get(:get_file_mode, file)
      mode = sprintf('%04s',Specinfra.backend.run_command(cmd).stdout.strip)
      mode = mode.split('')
      mode_octal = mode[0].to_i * 512 + mode[1].to_i * 64 + mode[2].to_i * 8 + mode[3].to_i * 1
      case by_whom.to_s
      when ''
        mode_octal & 0444 != 0
      when 'owner'
        mode_octal & 0400 != 0
      when 'group'
        mode_octal & 0040 != 0
      when 'others'
        mode_octal & 0004 != 0
      end
    end

    def self.check_file_is_writable(file, by_whom)
      cmd = Specinfra.command.get(:get_file_mode, file)
      mode = sprintf('%04s',Specinfra.backend.run_command(cmd).stdout.strip)
      mode = mode.split('')
      mode_octal = mode[0].to_i * 512 + mode[1].to_i * 64 + mode[2].to_i * 8 + mode[3].to_i * 1
      case by_whom.to_s
      when ''
        mode_octal & 0222 != 0
      when 'owner'
        mode_octal & 0200 != 0
      when 'group'
        mode_octal & 0020 != 0
      when 'others'
        mode_octal & 0002 != 0
      end
    end

    def self.check_file_is_executable(file, by_whom)
      cmd  = Specinfra.command.get(:get_file_mode, file)
      mode = sprintf('%04s',Specinfra.backend.run_command(cmd).stdout.strip)
      mode = mode.split('')
      mode_octal = mode[0].to_i * 512 + mode[1].to_i * 64 + mode[2].to_i * 8 + mode[3].to_i * 1
      case by_whom.to_s
      when ''
        mode_octal & 0111 != 0
      when 'owner'
        mode_octal & 0100 != 0
      when 'group'
        mode_octal & 0010 != 0
      when 'others'
        mode_octal & 0001 != 0
      end
    end

    def self.check_file_is_mounted(path, expected_attr, only_with)
      cmd = Specinfra.command.get(:check_file_is_mounted, path)
      ret = Specinfra.backend.run_command(cmd)
      if expected_attr.nil? || ret.failure?
        return ret.success?
      end

      mount = ret.stdout.scan(/\S+/)
      actual_attr = { }
      actual_attr[:device] = mount[0]
      # Output of mount depends on os:
      # a)  proc on /proc type proc (rw,noexec,nosuid,nodev)
      # b)  procfs on /proc (procfs, local)
      actual_attr[:type] = mount[4] if mount[3] == 'type' # case a.
      if match = ret.stdout.match(/\((.*)\)/)
        options = match[1].split(',')
        actual_attr[:type] ||= options.shift              # case b.
        options.each do |option|
          name, val = option.split('=')
          if val.nil?
            actual_attr[name.strip.to_sym] = true
          else
            val = val.to_i if val.match(/^\d+$/)
            actual_attr[name.strip.to_sym] = val
          end
        end
      end

      if ! expected_attr[:options].nil?
        expected_attr.merge!(expected_attr[:options])
        expected_attr.delete(:options)
      end

      if only_with
        actual_attr == expected_attr
      else
        expected_attr.each do |key, val|
          return false if actual_attr[key] != val
        end
        true
      end
    end

    def self.check_fstab_has_entry(expected_attr)
      return false unless expected_attr[:mount_point]
      cmd = Specinfra.command.get(:get_fstab_entry, expected_attr[:mount_point])
      ret = Specinfra.backend.run_command(cmd)
      return false if ret.failure?

      fstab = ret.stdout.scan(/\S+/)
      actual_attr = {
        :device      => fstab[0],
        :mount_point => fstab[1],
        :type        => fstab[2],
        :dump        => fstab[4].to_i,
        :pass        => fstab[5].to_i
      }
      fstab[3].split(',').each do |option|
        name, val = option.split('=')
        if val.nil?
          actual_attr[name.to_sym] = true
        else
          val = val.to_i if val.match(/^\d+$/)
          actual_attr[name.to_sym] = val
        end
      end

      unless expected_attr[:options].nil?
        expected_attr.merge!(expected_attr[:options])
        expected_attr.delete(:options)
      end

      expected_attr.each do |key, val|
        return false if actual_attr[key] != val
      end
      true
    end

    def self.check_routing_table_has_entry(expected_attr)
      return false if ! expected_attr[:destination]
      cmd = Specinfra.command.get(:get_routing_table_entry, expected_attr[:destination])
      ret = Specinfra.backend.run_command(cmd)
      return false if ret.failure?

      ret.stdout.gsub!(/\r\n/, "\n")

      if os[:family] == 'openbsd'
        match = ret.stdout.match(/^(\S+)\s+(\S+).*?(\S+[0-9]+)(\s*)$/)
        actual_attr = {
          :destination => $1,
          :gateway     => $2,
          :interface   => expected_attr[:interface] ? $3 : nil
        }
      else
        matches = ret.stdout.scan(/^(\S+)(?: via (\S+))? dev (\S+).+\n|^(\S+).*\n|\s+nexthop via (\S+)\s+dev (\S+).+/)
        if matches.length > 1
          # ECMP route
          destination = nil
          matches.each do |groups|
            if groups[3]
              destination = groups[3]
              next
            end
            next if expected_attr[:gateway] && expected_attr[:gateway] != groups[4]
            next if expected_attr[:interface] && expected_attr[:interface] != groups[5]

            actual_attr = {
              :destination => destination,
              :gateway => groups[4],
              :interface => groups[5]
            }
          end
        elsif matches.length == 1
          # Non-ECMP route
          groups = matches[0]
          actual_attr = {
            :destination => groups[0],
            :gateway     => groups[1] ? groups[1] : groups[3],
            :interface   => expected_attr[:interface] ? groups[2] : nil
          }
        end

      end

      expected_attr.each do |key, val|
        return false if actual_attr[key] != val
      end
      true
    end

    def self.get_default_gateway(attr)
      cmd = Specinfra.command.get(:get_routing_table_entry, 'default')
      ret = Specinfra.backend.run_command(cmd)
      return false if ret.failure?

      ret.stdout.gsub!(/\r\n/, "\n")

      if os[:family] == 'openbsd'
        match = ret.stdout.match(/^(\S+)\s+(\S+).*?(\S+[0-9]+)(\s*)$/)
        if attr == :gateway
          $2
        elsif attr == :interface
          $3
        end
      else
        ret.stdout =~ /^(\S+)(?: via (\S+))? dev (\S+).+\n(?:default via (\S+))?/
        if attr == :gateway
          $2 ? $2 : $4
        elsif attr == :interface
          $3
        end
      end
    end
  end
end


text:
// -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil; -*-
//
// Copyright 2019 LSBD Autonomous Databases Group
//
// 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.

#include <iostream>
using namespace std;

#include <metis/Common/Unique.hpp>
#include <metis/Parser/Scanner.hpp>
using namespace metis;

int main() {

  // clang-format off
  StringRef src = R"(
    /* An example MQL source to be tokenized */
    /* which ignores these unuseful comments */
    SELECT Teacher, DayOfWeek FROM Courses;
    SELECT Name, Salary FROM Employees;
  )";
  // clang-format on

  auto scan = make<parser::Scanner>(src);

  while (scan->advance()) {
    auto token = scan->token();
    cout << '[' << token << ']' << endl;
  }

  cout << "Scanning ended at line " << scan->line_number() << endl;

  return 0;
}


text:
import { TestBed } from '@angular/core/testing';
import { MatDialog, MatDialogRef } from '@angular/material/dialog';
import { Actions } from '@ngrx/effects';
import { provideMockActions } from '@ngrx/effects/testing';
import { Store } from '@ngrx/store';
import { MockStore, provideMockStore } from '@ngrx/store/testing';
import { cold } from 'jasmine-marbles';
import { Observable, of } from 'rxjs';
import { State } from 'src/app/reducers';
import { UploadActions } from '../actions';
import { closeDialog } from '../actions/upload.actions';
import { UploadDialogComponent } from '../containers';
import { Modal } from '../models';
import * as fromUI from '../selectors/ui.selectors';
import { NormalizationService } from '../services';
import { UploadEffects } from './upload.effects';

describe('UploadEffects', () => {
  let actions$: Observable<any>;
  let effects: UploadEffects;
  let _store: MockStore<State>;
  let dialog: jasmine.SpyObj<MatDialogRef<UploadDialogComponent>>;
  let matDialog: jasmine.SpyObj<MatDialog>;
  let _normalizationService: jasmine.SpyObj<NormalizationService>;

  beforeEach(() => {
    dialog = jasmine.createSpyObj('dialog', ['close', 'afterClosed']);

    TestBed.configureTestingModule({
      providers: [
        UploadEffects,
        {
          provide: MatDialog,
          useValue: jasmine.createSpyObj('matDialog', ['getDialogById', 'open']),
        },
        {
          provide: NormalizationService,
          useValue: jasmine.createSpyObj('normalizationService', ['normalizeScenario']),
        },
        provideMockStore({
          selectors: [{ selector: fromUI.selectModal, value: Modal.Upload }],
        }),
        provideMockActions(() => actions$),
      ],
    });

    matDialog = TestBed.inject(MatDialog) as jasmine.SpyObj<MatDialog>;
    _normalizationService = TestBed.inject(
      NormalizationService
    ) as jasmine.SpyObj<NormalizationService>;
    _store = TestBed.inject(Store) as MockStore<State>;
    actions$ = TestBed.inject(Actions);
    effects = TestBed.inject<UploadEffects>(UploadEffects);
  });

  it('should be created', () => {
    expect(effects).toBeTruthy();
  });

  describe('openDialog$', () => {
    it('should open upload dialog', () => {
      matDialog.getDialogById.and.callFake(() => null);
      matDialog.open.and.callFake(() => dialog as any);
      dialog.afterClosed.and.callFake(() => of(null));

      actions$ = cold('-a-----', { a: UploadActions.openDialog() });
      effects.openDialog$.subscribe(() => {
        expect(matDialog.getDialogById).toHaveBeenCalledWith(Modal.Upload);
        expect(matDialog.open).toHaveBeenCalledWith(UploadDialogComponent, {
          id: Modal.Upload,
          maxWidth: jasmine.any(String),
        });
      });
    });

    it('dialog close should dispatch close dialog', () => {
      matDialog.getDialogById.and.callFake(() => null);
      matDialog.open.and.callFake(() => dialog as any);
      dialog.afterClosed.and.callFake(() => of(null));

      actions$ = cold('-a-----', { a: UploadActions.openDialog() });
      expect(effects.openDialog$).toBeObservable(cold('-a---', { a: closeDialog() }));
    });
  });
});


text:
package com;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;

import com.simbest.cores.exceptions.Exceptions;
import com.simbest.cores.utils.Constants;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang.StringUtils;

import com.baidubce.auth.DefaultBceCredentials;
import com.baidubce.services.bos.BosClient;
import com.baidubce.services.bos.BosClientConfiguration;
import com.baidubce.services.bos.model.BosObject;
import com.baidubce.services.bos.model.BosObjectSummary;
import com.baidubce.services.bos.model.ListObjectsResponse;
import com.baidubce.services.bos.model.ObjectMetadata;
import com.simbest.cores.utils.AppFileUtils;
import com.simbest.cores.utils.Encodes;

public class BCE {
	private static final String ACCESS_KEY_ID = "aee1ca18d56a47c1845227bd335ed0d4";
	private static final String SECRET_ACCESS_KEY = "10856598e09b4f9a9536c83a10ed6fa8";
	private static final String BUCKET = "onegym1011";

	public static void main(String[] args) throws IOException {
	    String ENDPOINT = "http://bj.bcebos.com";
	    BosClientConfiguration config = new BosClientConfiguration();
	    config.setCredentials(new DefaultBceCredentials(ACCESS_KEY_ID, SECRET_ACCESS_KEY));
	    config.setEndpoint(ENDPOINT);
	    BosClient client = new BosClient(config);
//	    File targetFile = new File("C:\\Users\\lenovo\\Desktop\\清华大学MBA.txt");
//	    String storePath = "/static/test/";
//	    putObject(client, targetFile, storePath);
//	    deleteObject(client, "http://bj.bcebos.com/v1/onegymbucket/static/test/aaa.jpg");
        //上传url文件
        String fileurl = "http://bj.bcebos.com/v1/onegymbucket/static/uploadFiles/manager1/2015-10-28/e082e0bfc93d40d29b62afd087ee9f88/logo.jpg";
        String uploadedUrl =uploadFromUrl(client, BUCKET, fileurl, AppFileUtils.getFileBaseName(fileurl), "/static/uploadFiles/");
        System.out.println("uploadedUrl is: "+uploadedUrl);
	}

	public static void putObject(BosClient client,File targetFile, String storePath) throws FileNotFoundException{
		storePath += targetFile.getName();
		ObjectMetadata meta = new ObjectMetadata();
		meta.setContentLength(targetFile.length());
		meta.setContentType(AppFileUtils.getContentType(targetFile.getAbsolutePath()));
		client.putObject(BUCKET, storePath, new FileInputStream(targetFile), meta);
		String savePath = client.generatePresignedUrl(BUCKET, storePath, -1).toString()+"&responseContentDisposition=attachment";
    	int index = savePath.indexOf("?authorization");
    	savePath = savePath.substring(0, index);
    	System.out.println(savePath);
	}

	public static void listObject(BosClient client){
	    ListObjectsResponse listing = client.listObjects(BUCKET);
	    // 遍历所有Object
	    for (BosObjectSummary objectSummary : listing.getContents()) {
	        System.out.println("ObjectKey: " + objectSummary.getKey());
	    }
	}

	public static void deleteObject(BosClient client, String fileUrl){
		String remoteUrl = Encodes.urlDecode(fileUrl);
		try{
			String url = StringUtils.substringAfterLast(remoteUrl, BUCKET+"/");
			BosObject object = client.getObject(BUCKET, url);
			client.deleteObject(BUCKET, object.getKey());
		}catch(Exception e){
			e.printStackTrace();
		}
	}

    public static String uploadFromUrl(BosClient bosClient, String bucket, String fileUrl, String fileName, String storePath){
        String savePath = null;
        HttpURLConnection conn = null;
        try{
            String urlStr = FilenameUtils.getFullPath(fileUrl)+Encodes.urlEncode(AppFileUtils.getFileName(fileUrl));
            URL url = new URL(urlStr);
            conn = (HttpURLConnection) url.openConnection();
            conn.setDoInput(true);
            conn.setRequestMethod(Constants.HTTPGET);
            conn.connect();
            storePath += fileName;
            ObjectMetadata meta = new ObjectMetadata();
            meta.setContentLength(conn.getContentLengthLong());
            meta.setContentType(conn.getContentType());
            bosClient.putObject(bucket, storePath, conn.getInputStream(), meta);
            savePath = bosClient.generatePresignedUrl(bucket, storePath, -1).toString()+"&responseContentDisposition=attachment";
            int index = savePath.indexOf("?authorization");
            savePath = savePath.substring(0, index);
            conn.disconnect();
        } catch(Exception e){
            if(conn != null){
                conn.disconnect();
                conn = null;
            }
            savePath = null;
        }finally{
            if(conn != null){
                conn.disconnect();
                conn = null;
            }
        }
        if(StringUtils.isNotEmpty(savePath)) {
            savePath = StringUtils.replace(savePath, Constants.SEPARATOR, "/");
        }
        return savePath;
    }
}


text:
#ifndef HAWQ_RESOURCE_MANAGER_COMMUNICATION_TO_GLOBAL_RESOURCE_MANAGER_H
#define HAWQ_RESOURCE_MANAGER_COMMUNICATION_TO_GLOBAL_RESOURCE_MANAGER_H

#include "envswitch.h"

#include "dynrm.h"

/******************************************************************************
 * This is part of the high-level interface of resource broker in HAWQ RM. This
 * file contains all interfaces for connecting to one global resource manager
 * (YARN, MESOS, etc) to acquire/return resource. The implementation includes 2
 * tiers, the global interface, and YARN specific implementation.
 *
 * Firstly, libyarn for YARN is implemented. Potential implementations:
 * native JNI client for YARN, client for Mesos.
 *
 *****************************************************************************/

typedef int ( * RM2GRM_FPTR_loadParameters) (void);
typedef int ( * RM2GRM_FPTR_connect) (void);
typedef int ( * RM2GRM_FPTR_disconnect) (void);
typedef int ( * RM2GRM_FPTR_register) (void);
typedef int ( * RM2GRM_FPTR_unregister) (void);

typedef int ( * RM2GRM_FPTR_getConnectReport)(DQueue);
typedef int ( * RM2GRM_FPTR_getClusterReport)(DQueue);
typedef int ( * RM2GRM_FPTR_getResQueueReport)(DQueue);
typedef int ( * RM2GRM_FPTR_acquireResource)(uint32_t,
											 uint32_t,
											 uint32_t,
											 DQueue);
typedef int ( * RM2GRM_FPTR_returnResource)(DQueue);
typedef int ( * RM2GRM_FPTR_cleanup)(void);

struct RM2GRM_FunctionEntriesData {
	RM2GRM_FPTR_loadParameters		loadParameters;
	RM2GRM_FPTR_connect				connect;
	RM2GRM_FPTR_disconnect			disconnect;
	RM2GRM_FPTR_register			registerHAWQ;
	RM2GRM_FPTR_unregister			unregisterHAWQ;
	RM2GRM_FPTR_getConnectReport	getConnectReport;
	RM2GRM_FPTR_getClusterReport	getClusterReport;
	RM2GRM_FPTR_getResQueueReport	getResQueueReport;
	RM2GRM_FPTR_acquireResource		acquireResource;
	RM2GRM_FPTR_returnResource		returnResource;
	RM2GRM_FPTR_cleanup				cleanup;
};

typedef struct RM2GRM_FunctionEntriesData  RM2GRM_FunctionEntriesData;
typedef struct RM2GRM_FunctionEntriesData *RM2GRM_FunctionEntries;

/* Prepare communication implementation. */
int RM2GRM_prepareImplementation(enum RB_IMP_TYPE imptype);

/* Load parameters from file system. */
int RM2GRM_loadParameters(void);

/* Connect and disconnect to the global resource manager. */
int RM2GRM_connect(void);
int RM2GRM_disconnect(void);

/* Register and unregister this application. */
int RM2GRM_register(void);
int RM2GRM_unregister(void);

/* Get information. */
int RM2GRM_getConnectReport(DQueue report);
int RM2GRM_getClusterReport(DQueue machines);
int RM2GRM_getResQueueReport(DQueue queues);

/* Acquire and return resource. */
int RM2GRM_acquireResource(uint32_t memorymb,
						   uint32_t core,
						   uint32_t contcount,
						   DQueue   containers);
int RM2GRM_returnResource(DQueue containers);

/* Clean all used memory and connections */
int RM2GRM_cleanup(void);

/* Get error message */
char *RM2GRM_getErrorMessage(void);
int   RM2GRM_getErrorCode(void);
void  RM2GRM_clearError(void);

extern int RM2GRM_LIBYARN_createEntries(RM2GRM_FunctionEntries entries);
extern int RM2GRM_NONE_createEntries(RM2GRM_FunctionEntries entries);

/*
 * Resource broker message.
 */
enum RESOURCE_BROKER_MSG_TYPES {
	REQUEST_MESSAGE_START = 0,
	GET_CLUSTER_REPORT,
	REQUEST_CONTAINERS,
	RETURN_CONTAINERS,

	RESPONSE_MESSAGE_START = 100,
	CLUSTER_REPORT,
	CONTAINERS_ALLOCATED,
	CONTAINERS_RETURNED
};

struct ResourceBrokerMessageData
{
	int32_t		Type;
	uint32_t	IssueTime;
	void	   *Data;
};

typedef struct ResourceBrokerMessageData *ResourceBrokerMessage;
typedef struct ResourceBrokerMessageData  ResourceBrokerMessageData;

extern int 	ErrorCode;
extern char	ErrorTrack[1024];
#endif /* HAWQ_RESOURCE_MANAGER_COMMUNICATION_TO_GLOBAL_RESOURCE_MANAGER_H */


text:
@class CJTextView;
@protocol CJTextViewDelegate <NSObject>

@optional

- (void)textViewAttributedTextDidChange:(CJTextView *)textView;

@end

@interface CJTextView : UITextView
// 占位文字
@property (nonatomic ,copy) NSString *placeholder;

@property (weak, nonatomic) id <CJTextViewDelegate> CJdelegate;

@end


text:
#include <stdio.h>
#include <syslog.h>
#include <string.h>
#include <ctype.h>
#include <sys/param.h>
#include <stdarg.h>

#include "ssl.h"
#include "smbftpd.h"

extern smbftpd_conf_t smbftpd_conf;
extern smbftpd_session_t smbftpd_session;

#ifdef WITH_SSL
/*
 * Wrapper around SSL_read(), arguments and return codes are the same.
 * This function handles SSL_ERROR_WANT_READ and SSL_ERROR_WANT_WRITE result
 * codes of TLS/SSL I/O operation.
 */
int ssl_read(SSL *ssl, void *buf, int num)
{
	int ret, err = SSL_ERROR_NONE;

	do {
		ret = SSL_read(ssl, buf, num);
		if (ret <= 0) {
			err = SSL_get_error(ssl, ret);
			if (smbftpd_conf.debug_mode)
				syslog(LOG_ERR, "ssl_read(): SSL_ERROR %d", err);
		}
	} while (ret<0 && (err==SSL_ERROR_WANT_READ || err==SSL_ERROR_WANT_WRITE));
	return ret;
}

/*
 * Wrapper around SSL_write(), arguments and return codes are the same.
 * This function handles SSL_ERROR_WANT_READ and SSL_ERROR_WANT_WRITE result
 * codes of TLS/SSL I/O operation.
 */
int ssl_write(SSL *ssl, void *buf, int num)
{
	int ret, err = SSL_ERROR_NONE;

	do {
		ret = SSL_write(ssl, buf, num);
		if (ret <= 0) {
			err = SSL_get_error(ssl, ret);
			if (smbftpd_conf.debug_mode)
				syslog(LOG_ERR, "ssl_write(): SSL_ERROR %d", err);
		}
	} while (ret<0 && (err==SSL_ERROR_WANT_READ || err==SSL_ERROR_WANT_WRITE));
	return ret;
}

static int ssl_getc(SSL *ssl)
{
	char onebyte;
	int ret;

	if ((ret = ssl_read(ssl, &onebyte, 1)) != 1) {
		if (smbftpd_conf.debug_mode || (ret < 0)) {
			syslog(LOG_ERR, "ssl_getc: ssl_read failed (SSL code: %d, errno: %d)\n",
				   ret, errno);
		}
		return -1;
	} else {
		return onebyte & 0xff;
	}
}

/* got back to this an implemented some rather "simple" buffering */
static char	putc_buf[BUFSIZ];
static int	putc_buf_pos = 0;

static int ssl_putc_flush(SSL *ssl)
{
	if (putc_buf_pos > 0) {
		if (ssl_write(ssl, putc_buf, putc_buf_pos) != putc_buf_pos) {
			if (smbftpd_conf.debug_mode)
				syslog(LOG_ERR, "ssl_putc_flush: WRITE FAILED");
			putc_buf_pos = 0;
			return -1;
		}
	}
	putc_buf_pos = 0;
	return 0;
}

static int ssl_putc(SSL *ssl, int oneint)
{
	char onebyte;

	onebyte = oneint & 0xff;

	/* make sure there is space */
	if (putc_buf_pos >= sizeof(putc_buf))
		if (ssl_putc_flush(ssl) != 0)
			return EOF;
	putc_buf[putc_buf_pos++] = onebyte;

	return onebyte;
}
#endif

int smbftpd_socket_getc(FILE *stream, int data)
{
#ifdef	WITH_SSL
	if (data && smbftpd_session.ssl_ctrl.ssl_data_active_flag) {
		return ssl_getc(ssl_data_con);
	} else if (!data && smbftpd_session.ssl_ctrl.ssl_active_flag) {
		return ssl_getc(ssl_con);
	} else
#endif
		return getc(stream);
}

int smbftpd_socket_putc(int c, FILE *stream, int data)
{
#ifdef	WITH_SSL
	if (data && smbftpd_session.ssl_ctrl.ssl_data_active_flag) {
		return ssl_putc(ssl_data_con, c);
	} else if (!data && smbftpd_session.ssl_ctrl.ssl_active_flag) {
		return ssl_putc(ssl_con, c);
	} else
#endif
		return putc(c, stream);
}

int smbftpd_socket_fflush(FILE *stream, int data)
{
#ifdef	WITH_SSL
	if (data && smbftpd_session.ssl_ctrl.ssl_data_active_flag) {
		return ssl_putc_flush(ssl_data_con);
	} else if (!data && smbftpd_session.ssl_ctrl.ssl_active_flag) {
		return 1;
	} else
#endif
		return fflush(stream);
}

/**
 *
 * @param fd     The fd to write. When using SSL, the fd is dummy.
 * @param buf    Buffer to write.
 * @param len    Buffer length
 * @param data   Is this data connection.
 *
 * @return
 */
void smbftpd_socket_printf(const char *fmt, ...)
{
	va_list ap;

#ifdef WITH_SSL
	/* The size seems to be enough for normal use */
	char outputbuf[BUFSIZ + MAXPATHLEN + MAXHOSTNAMELEN];
#endif /*WITH_SSL*/
	va_start(ap,fmt);
#ifdef WITH_SSL
	(void)vsnprintf(outputbuf, sizeof(outputbuf), fmt, ap);
	if (smbftpd_session.ssl_ctrl.ssl_active_flag) {
		ssl_write(ssl_con, outputbuf, strlen(outputbuf));
	} else {
		printf("%s", outputbuf);
		fflush(stdout);
	}
#else /*!WITH_SSL*/
	vfprintf(stdout, fmt, ap);
#endif /*WITH_SSL*/
	va_end(ap);
}