text:
package index

import (
	"encoding/binary"
	"errors"
	e "github.com/MG-RAST/Shock/shock-server/errors"
	"io"
	"os"
	"strconv"
	"strings"
)

type indexerFunc func(*os.File, string, string, string) Indexer

var (
	Indexers = map[string]indexerFunc{
		"chunkrecord": NewChunkRecordIndexer,
		"line":        NewLineIndexer,
		"record":      NewRecordIndexer,
		"size":        NewSizeIndexer,
	}
)

type Indexer interface {
	Create(string) (int64, string, error)
	Close() error
}

type Index interface {
	Set(map[string]interface{})
	Type() string
	GetLength() int64
	Part(string, string, int64) (int64, int64, error)
	Range(string, string, int64) ([][]int64, error)
}

type Idx struct {
	T      string
	Length int
}

func New() *Idx {
	return &Idx{
		T:      "file",
		Length: 0,
	}
}

func (i *Idx) Set(inter map[string]interface{}) {
	return
}

func (i *Idx) Type() string {
	return i.T
}

func (i *Idx) GetLength() int64 {
	return int64(i.Length)
}

func (i *Idx) Part(part string, idxFilePath string, idxLength int64) (pos int64, length int64, err error) {
	// this function is for returning a single pos and length for a given range
	// used for non-subset indices where the records are contiguous for the data file
	f, err := os.Open(idxFilePath)
	if err != nil {
		err = errors.New(e.IndexNoFile)
		return
	}
	defer f.Close()

	if strings.Contains(part, "-") {
		startend := strings.Split(part, "-")
		start, startEr := strconv.ParseInt(startend[0], 10, 64)
		end, endEr := strconv.ParseInt(startend[1], 10, 64)
		if startEr != nil || endEr != nil || start <= 0 || start > int64(idxLength) || end <= 0 || end > int64(idxLength) {
			err = errors.New(e.InvalidIndexRange)
			return
		}

		// read start offset and length from index file
		sr := io.NewSectionReader(f, (start-1)*16, 16)
		srec := make([]int64, 2)
		binary.Read(sr, binary.LittleEndian, &srec[0])
		binary.Read(sr, binary.LittleEndian, &srec[1])

		// read end offset and length from index file
		sr = io.NewSectionReader(f, (end-1)*16, 16)
		erec := make([]int64, 2)
		binary.Read(sr, binary.LittleEndian, &erec[0])
		binary.Read(sr, binary.LittleEndian, &erec[1])

		pos = srec[0]
		length = (erec[0] - srec[0]) + erec[1]
	} else {
		p, er := strconv.ParseInt(part, 10, 64)
		if er != nil || p <= 0 || p > int64(idxLength) {
			err = errors.New(e.IndexOutBounds)
			return
		}

		// read offset and length from index file
		sr := io.NewSectionReader(f, (p-1)*16, 16)
		rec := make([]int64, 2)
		binary.Read(sr, binary.LittleEndian, &rec[0])
		binary.Read(sr, binary.LittleEndian, &rec[1])

		pos = rec[0]
		length = rec[1]
	}
	return
}

func (i *Idx) Range(part string, idxFilePath string, idxLength int64) (recs [][]int64, err error) {
	// this function is for returning an array of [pos, length] for a given range
	// used for subset indices where the records are not contiguous for the data file
	f, err := os.Open(idxFilePath)
	if err != nil {
		err = errors.New(e.IndexNoFile)
		return
	}
	defer f.Close()

	if strings.Contains(part, "-") {
		startend := strings.Split(part, "-")
		start, startEr := strconv.ParseInt(startend[0], 10, 64)
		end, endEr := strconv.ParseInt(startend[1], 10, 64)
		if startEr != nil || endEr != nil || start <= 0 || start > int64(idxLength) || end <= 0 || end > int64(idxLength) {
			err = errors.New(e.InvalidIndexRange)
			return
		}

		// read beginning offset and length from index file
		sr := io.NewSectionReader(f, (start-1)*16, 16)
		rec := make([]int64, 2)
		binary.Read(sr, binary.LittleEndian, &rec[0])
		binary.Read(sr, binary.LittleEndian, &rec[1])

		curPos := rec[0]
		curLen := rec[1]
		// we only have one record
		if start == end {
			recs = append(recs, []int64{curPos, curLen})
			return
		}
		// this loop tries to only return seperate [pos, length] sets for non-contiguous records
		for x := start; x <= end-1; x++ {
			// reading next offset and length from index file
			sr = io.NewSectionReader(f, x*16, 16)
			binary.Read(sr, binary.LittleEndian, &rec[0])
			binary.Read(sr, binary.LittleEndian, &rec[1])

			nextPos := rec[0]
			nextLen := rec[1]
			// special case - last record
			if x == (end - 1) {
				if curLen == (nextPos - curPos) {
					recs = append(recs, []int64{curPos, curLen + nextLen})
				} else {
					recs = append(recs, []int64{curPos, curLen})
					recs = append(recs, []int64{nextPos, nextLen})
				}
				break
			}
			if curLen == (nextPos - curPos) {
				curLen = curLen + nextLen
				continue
			}
			recs = append(recs, []int64{curPos, curLen})
			curPos = nextPos
			curLen = nextLen
		}
	} else {
		p, er := strconv.ParseInt(part, 10, 64)
		if er != nil || p <= 0 || p > int64(idxLength) {
			err = errors.New(e.IndexOutBounds)
			return
		}

		// read offset and length from index file
		sr := io.NewSectionReader(f, (p-1)*16, 16)
		rec := make([]int64, 2)
		binary.Read(sr, binary.LittleEndian, &rec[0])
		binary.Read(sr, binary.LittleEndian, &rec[1])

		recs = append(recs, []int64{rec[0], rec[1]})
	}
	return
}


text:
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <meta http-equiv="cleartype" content="on">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <!-- PWA -->
  <meta name="HandheldFriendly" content="True">
  <meta name="MobileOptimized" content="320">
  <meta name="mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="theme-color" content="#d1323d">
  <meta name="application-name" content="Pacific Shores Shuttle">
  <!-- SEO -->
  <meta name="googlebot" content="index,follow">
  <meta name="google" content="notranslate">
  <meta name="generator" content="Angular">
  <meta name="subject" content="Transportation - Pacific Shores Center">
  <meta name="format-detection" content="telephone=no">
  <meta name="geo.region" content="US-CA">
  <meta name="geo.placename" content="Redwood City">
  <meta name="title" content="Pacific Shores Shuttle">
  <meta name="image" content="https://pacificshoresshuttle.com/assets/img/logo.jpg">
  <meta name="description" content="If you work at Pacific Shores, you can figure out when the next shuttle is coming! 🚌">
  <meta itemprop="name" content="Pacific Shores Shuttle">
  <meta itemprop="image" content="https://pacificshoresshuttle.com/assets/img/share.png">
  <meta itemprop="description" content="If you work at Pacific Shores, you can figure out when the next shuttle is coming! 🚌">
  <meta http-equiv="set-cookie" content="name=value; expires=date; path=url">
  <meta http-equiv="Content-Language" content="en">
  <!-- Google -->
  <meta property="og:title" content="Pacific Shores Shuttle">
  <meta property="og:description" content="If you work at Pacific Shores, you can figure out when the next shuttle is coming! 🚌">
  <meta property="og:image" content="https://pacificshoresshuttle.com/assets/img/share.png">
  <meta property="og:image:width" content="750">
  <meta property="og:image:height" content="500">
  <meta property="og:url" content="https://pacificshoresshuttle.com">
  <meta property="og:site_name" content="Pacific Shores Shuttle">
  <meta property="og:locale" content="en_US">
  <meta property="og:type" content="website">
  <meta property="article:author" content="">
  <!-- Microsoft -->
  <meta name="msapplication-TileColor" content="#FFFFFF">
  <meta name="msapplication-TileImage" content="favicon-144.png">
  <meta name="msapplication-window" content="width=device-width;height=device-height">
  <meta name="msapplication-tooltip" content="If you work at Pacific Shores, you can figure out when the next shuttle is coming! 🚌">
  <!-- Twitter -->
  <meta name="twitter:site" content="@fvcproductions">
  <meta name="twitter:title" content="Pacific Shores Shuttle">
  <meta name="twitter:description" content="If you work at Pacific Shores, you can figure out when the next shuttle is coming! 🚌">
  <meta name="twitter:url" content="https://pacificshoresshuttle.com">
  <meta name="twitter:card" content="summary_large_image">
  <meta name="twitter:image" content="https://pacificshoresshuttle.com/assets/img/share.png">
  <meta name="twitter:creator" content="@fvcproductions">
  <!-- Favicons -->
  <link rel="shortcut icon" href="assets/favicons/favicon.ico" />
  <link rel="icon" type="image/x-icon" sizes="16x16 32x32" href="assets/favicons/favicon.ico">
  <link rel="icon" sizes="192x192" href="assets/favicons/favicon-192.png">
  <link rel="apple-touch-icon-precomposed" sizes="152x152" href="assets/favicons/favicon-152.png">
  <link rel="apple-touch-icon-precomposed" sizes="144x144" href="assets/favicons/favicon-144.png">
  <link rel="apple-touch-icon-precomposed" sizes="120x120" href="assets/favicons/favicon-120.png">
  <link rel="apple-touch-icon-precomposed" sizes="114x114" href="assets/favicons/favicon-114.png">
  <link rel="apple-touch-icon-precomposed" sizes="180x180" href="assets/favicons/favicon-180.png">
  <link rel="apple-touch-icon-precomposed" sizes="72x72" href="assets/favicons/favicon-72.png">
  <link rel="apple-touch-icon-precomposed" href="assets/favicons/favicon-57.png">
  <link rel="manifest" href="assets/favicons/manifest.json">
  <!-- Bootstrap 4 CSS -->
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css">
  <!-- Schema.org for Google -->
  <link href="https://plus.google.com/+FVCproductions2013" rel="publisher">
  <!-- Base URL to use for all relative URLs contained within the document -->
  <base href="https://pacificshoresshuttle.com">
  <!-- <base href="/"> -->
  <!-- Document Title -->
  <title>Pacific Shores Shuttle</title>
</head>

<body>
  <app-root>
    <h1 class="loading align-middle">
      All aboard... 🚌
    </h1>
  </app-root>
  <!-- Scripts -->
  <script async="" src="https://www.google-analytics.com/analytics.js"></script>
  <script type="application/ld+json">
    {
      "@context": "https://schema.org",
      "@type": "Organization",
      "name": "Pacific Shores Shuttle",
      "url": "https://pacificshoresshuttle.com",
      "logo": "https://pacificshoresshuttle.com/assets/img/logo.jpg"
    }

  </script>
  <!-- Font Awesome -->
  <script src="https://use.fontawesome.com/c6af98755f.js"></script>
  <!-- Bootstrap 4 Beta -->
  <script src="https://code.jquery.com/jquery-3.1.1.slim.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js"></script>
  <!-- Google Analytics - All Properties -->
  <script>
    (function (i, s, o, g, r, a, m) {
      i['GoogleAnalyticsObject'] = r;
      i[r] = i[r] || function () {
        (i[r].q = i[r].q || []).push(arguments)
      }, i[r].l = 1 * new Date();
      a = s.createElement(o),
        m = s.getElementsByTagName(o)[0];
      a.async = 1;
      a.src = g;
      m.parentNode.insertBefore(a, m)
    })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
    ga('create', 'UA-63190978-1', 'auto');
    ga('send', 'pageview');

  </script>
  <!-- Google Analytics - Pacific Shores Shuttle -->
  <script>
    (function (i, s, o, g, r, a, m) {
      i['GoogleAnalyticsObject'] = r;
      i[r] = i[r] || function () {
        (i[r].q = i[r].q || []).push(arguments)
      }, i[r].l = 1 * new Date();
      a = s.createElement(o),
        m = s.getElementsByTagName(o)[0];
      a.async = 1;
      a.src = g;
      m.parentNode.insertBefore(a, m)
    })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
    ga('create', 'UA-63190978-7', 'auto');
    ga('send', 'pageview');

  </script>
  <script>
    // set up scope
    if ('serviceWorker' in navigator) {
      navigator.serviceWorker.register('/service-worker.min.js', {
          scope: '/'
        })
        .then(function (registration) {
          console.log('Service Worker Registered', registration);
        })
        .catch(function (error) {
          console.log('Error registering service worker', error)
        });
      navigator.serviceWorker.ready.then(function (registration) {
        console.log('Service Worker Ready', registration);
      });
    }

  </script>
</body>

</html>

redpajama_set_name: RedPajamaGithub


text:
class AddWorkflowCompletenessToSubjectSet < ActiveRecord::Migration
  def change
    # since PG v11+ we can add a new column and a default at the same time
    # https://github.com/ankane/strong_migrations#bad-1
    # https://www.2ndquadrant.com/en/blog/add-new-table-column-default-value-postgresql-11/
    add_column :subject_sets, :completeness, :jsonb, default: {}
  end
end


text:
package org.zeroxlab.owl;

import com.googlecode.javacpp.Loader;
import com.googlecode.javacv.*;
import static com.googlecode.javacv.cpp.opencv_core.*;

public class MatchResult {
    public int x;
    public int y;
    public int w;
    public int h;
    public double maxval;

    public MatchResult() {}

    public MatchResult(int x, int y, int w, int h, double val) {
        this.x = x;
        this.y = y;
        this.w = w;
        this.h = h;
        this.maxval = val;
    }

    public int cx() {
        return x + w / 2;
    }

    public int cy() {
        return y + h / 2;
    }

    @Override
    public String toString() {
        return String.format("%s: %f", cvRect(x, y, w, h).toString(), maxval);
    }
}


text:
module QA
  module Page
    module Profile
      class TwoFactorAuth < Page::Base
        view 'app/assets/javascripts/pages/profiles/two_factor_auths/index.js' do
          element :configure_it_later_button
        end

        def click_configure_it_later_button
          click_element :configure_it_later_button
        end
      end
    end
  end
end


text:
package fr.liglab.mining.mapred;

import java.io.IOException;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.mapreduce.Mapper;

import fr.liglab.mining.mapred.writables.ItemAndSupportWritable;
import fr.liglab.mining.mapred.writables.SupportAndTransactionWritable;

public class AggregationMapper extends Mapper<IntWritable, SupportAndTransactionWritable, ItemAndSupportWritable, SupportAndTransactionWritable> {

	private final ItemAndSupportWritable keyW = new ItemAndSupportWritable();

	@Override
	protected void map(IntWritable key, SupportAndTransactionWritable value, Context context)
			throws IOException, InterruptedException {

		keyW.set(key.get(), value.getSupport());
		context.write(this.keyW, value);
	}
}


text:
package ru.job4j.generic;

import ru.job4j.service.SimpleList;

public class RoleStore extends AbstractStore<Role> {
    //SimpleList<Role> simpleList = new SimpleList<>(10);

}


text:
// Copyright (c) 2013 Krkadoni.com - Released under The MIT License.
// Full license text can be found at http://opensource.org/licenses/MIT

using System;
using System.Collections.Generic;
using System.ComponentModel;

namespace Krkadoni.EnigmaSettings.Interfaces
{
    public interface IXmlSatellite : INotifyPropertyChanged, IEditableObject, ICloneable
    {
        /// <summary>
        ///     List of transponders from xml file
        /// </summary>
        /// <value></value>
        /// <returns></returns>
        /// <remarks></remarks>
        IList<IXmlTransponder> Transponders { get; set; }

        /// <summary>
        ///     Satellite name from satellites.xml file
        /// </summary>
        /// <value></value>
        /// <returns></returns>
        /// <remarks></remarks>
        string Name { get; set; }

        /// <summary>
        ///     Satellite flags from satellites.xml file
        /// </summary>
        /// <value></value>
        /// <returns></returns>
        /// <remarks></remarks>
        string Flags { get; set; }

        /// <summary>
        ///     Satellite position
        /// </summary>
        /// <value>Position as integer number with length 3 (ie. 19.2E = 192)</value>
        /// <returns></returns>
        /// <remarks></remarks>
        string Position { get; set; }

        /// <summary>
        ///     Parses position to position string
        /// </summary>
        /// <value></value>
        /// <returns>IE. for position value '192' returns '19.2° E'</returns>
        /// <remarks></remarks>
        string PositionString { get; }

        /// <summary>
        /// Performs MemberwiseClone on current object
        /// </summary>
        /// <returns></returns>
        object ShallowCopy();
    }
}


text:
Proximos Eventos

 {{event.date | amCalendar }}

            No tienes eventos creados, deseas crear uno?


text:
class AddNumReviewsAllowedToAssignments < ActiveRecord::Migration
  def change
    add_column :assignments, :num_reviews_allowed, :integer, :default => 3
  end
end


text:
package org.opencb.hpg.bigdata.analysis.alignment.stats;

//TODO: fix using the new RegionCoverage, JT

@Deprecated
public class ReadAlignmentDepthMR {

//    public static final String OUTPUT_SUMMARY_JSON = "summary.depth.json";
//    public static final String REGIONS_PARAM = "regions";
//    public static final String MIN_MAPQ_PARAM = "min_mapq";
//
//    public static class ReadAlignmentDepthMapper extends
//            Mapper<AvroKey<ReadAlignment>, NullWritable, ChunkKey, RegionCoverageWritable> {
//
//        private RegionFilter regionFilter = null;
//        private int minMapQ = 0;
//
//        @Override
//        public void setup(Mapper.Context context) throws IOException, InterruptedException {
//            String regs = context.getConfiguration().get(REGIONS_PARAM);
//
//            if (regs != null) {
//                System.err.println(">>>>>>> mapper, regs = " + regs);
//                regionFilter = new RegionFilter(regs);
//            }
//            minMapQ = context.getConfiguration().getInt(MIN_MAPQ_PARAM, 0);
//        }
//
//        @Override
//        public void map(AvroKey<ReadAlignment> key, NullWritable value, Context context) throws
//                IOException, InterruptedException {
//            ReadAlignment ra = key.datum();
//            LinearAlignment linearAlignment = (LinearAlignment) ra.getAlignment();
//
//            ChunkKey newKey;
//            RegionCoverageWritable newValue;
//
//            if (linearAlignment == null) {
//                //newKey = new ChunkKey("*", 0L);
//                // unmapped read
//                //newValue = new RegionCoverageWritable(new RegionDepth("*", 0, 0, 0));
//                //context.write(newKey, newValue);
//                return;
//            }
//
//            RegionCoverageCalculator calculator = new AvroRegionCoverageCalculator();
//
//            //TODO: fix using the new RegionCoverage, JT
//            String chrom = linearAlignment.getPosition().getReferenceName().toString();
//            int start = linearAlignment.getPosition().getPosition().intValue();
//            int end = start + calculator.computeSizeByCigar(linearAlignment.getCigar()) - 1;
//
//            //if ((regionFilter == null) || regionFilter.apply(chrom, start, end)) {
//            if ((minMapQ < linearAlignment.getMappingQuality()) && ((regionFilter == null) || regionFilter.apply(chrom, start, end))) {
//                List<RegionCoverage> regions = calculator.computeAsList(ra);
//
//                for (RegionCoverage region: regions) {
//                    newKey = new ChunkKey(region.chrom, region.chunk);
//                    newValue = new RegionCoverageWritable(region);
//                    context.write(newKey, newValue);
//                }
//            }
//        }
//    }
//
//    public static class ReadAlignmentDepthCombiner extends
//            Reducer<ChunkKey, RegionCoverageWritable, ChunkKey, RegionCoverageWritable> {
//
//        @Override
//        public void reduce(ChunkKey key, Iterable<RegionCoverageWritable> values, Context context) throws
//                IOException, InterruptedException {
//            RegionCoverage regionDepth;
//            //TODO: fix using the new RegionCoverage, JT
//            //if (key.getName().equals("*")) {
//            //    regionDepth = new RegionDepth("*", 0, 0, 0);
//            //} else {
//                regionDepth = new RegionCoverage(key.getName(), key.getChunk() * RegionCoverage.CHUNK_SIZE, key.getChunk(),
//                        RegionDepth.CHUNK_SIZE);
//                RegionCoverageCalculator calculator = new RegionCoverageCalculator();
//                for (RegionCoverageWritable value : values) {
//                    calculator.updateChunk(value.getRegionDepth(), key.getChunk(), regionDepth);
//                }
            //}
//            context.write(key, new RegionCoverageWritable(regionDepth));
//        }
//    }

//    public static class ReadAlignmentDepthReducer extends Reducer<ChunkKey, RegionCoverageWritable, Text, NullWritable> {
//
//        private RegionFilter regionFilter = null;
//        private HashMap<String, Long> chromAccDepth = null;
//
//        @Override
//        public void setup(Context context) throws IOException, InterruptedException {
//            String regs = context.getConfiguration().get(REGIONS_PARAM);
//
//            if (regs != null) {
//                System.err.println(">>>>>>> reducer, regs = " + regs);
//                regionFilter = new RegionFilter(regs);
//            }
//
//            chromAccDepth = new HashMap<>();
//        }
//
//        @Override
//        public void cleanup(Context context) throws IOException, InterruptedException {
//            double accLen = 0, accDep = 0;
//
//            FileSystem fs = FileSystem.get(context.getConfiguration());
//            Path outPath = new Path(context.getConfiguration().get(OUTPUT_SUMMARY_JSON));
//            FSDataOutputStream out = fs.create(outPath);
//            out.writeChars("{ \"chroms\": [");
//            int size = chromAccDepth.size();
//            int i = 0;
//            for (String name : chromAccDepth.keySet()) {
//                out.writeChars("{\"name\": \"" + name + "\", \"length\": "
//                        + context.getConfiguration().get(name) + ", \"acc\": "
//                        + chromAccDepth.get(name) + ", \"depth\": "
//                        + (1.0f * chromAccDepth.get(name) / Integer.parseInt(context.getConfiguration().get(name)))
//                        + "}");
//
//                if (++i < size) {
//                    out.writeChars(", ");
//                }
//                accLen += Integer.parseInt(context.getConfiguration().get(name));
//                accDep += chromAccDepth.get(name);
//            }
//
//            out.writeChars("], \"depth\": " + (accDep / accLen));
//            out.writeChars("}");
//            out.close();
//        }

//        @Override
//        public void reduce(ChunkKey key, Iterable<RegionCoverageWritable> values, Context context) throws
//                IOException, InterruptedException {
//            if (context.getConfiguration().get(key.getName()) == null) {
//                System.out.println("Skip unknown key (name, chunk) = (" + key.getName() + ", " + key.getChunk() + ")");
//                return;
//            }
//
//            RegionDepth regionDepth = new RegionDepth(key.getName(), key.getChunk() * RegionDepth.CHUNK_SIZE,
//                    key.getChunk(), RegionDepth.CHUNK_SIZE);
//            RegionCoverageCalculator calculator = new RegionCoverageCalculator();
//            for (RegionCoverageWritable value : values) {
//                calculator.updateChunk(value.getRegionDepth(), key.getChunk(), regionDepth);
//            }
//
//            // accumulator to compute chromosome depth (further processing in cleanup)
//            long acc = 0;
//            for (int i = 0; i < RegionDepth.CHUNK_SIZE; i++) {
//                acc += regionDepth.array[i];
//            }
//            chromAccDepth.put(key.getName(), (chromAccDepth.get(key.getName()) == null
//                    ? acc
//                    : acc + chromAccDepth.get(key.getName())));
//
//            if (regionFilter == null) {
//                context.write(new Text(regionDepth.toFormat()), NullWritable.get());
//            } else {
//                context.write(new Text(regionDepth.toFormat(regionFilter)), NullWritable.get());
//            }
//        }
//    }
//
//    public static int run(String input, String output, String regions, int minMapQ) throws Exception {
//        return run(input, output, regions, minMapQ, new Configuration());
//    }
//
//    public static int run(String input, String output, String regions, int minMapQ, Configuration conf) throws Exception {
//        // read header, and save sequence name/length in config
//        byte[] data = null;
//        Path headerPath = new Path(input + ".header");
//        FileSystem hdfs = FileSystem.get(conf);
//        FSDataInputStream dis = hdfs.open(headerPath);
//        FileStatus status = hdfs.getFileStatus(headerPath);
//        data = new byte[(int) status.getLen()];
//        dis.read(data, 0, (int) status.getLen());
//        dis.close();
//
//        String textHeader = new String(data);
//        LineReader lineReader = new StringLineReader(textHeader);
//        SAMFileHeader header = new SAMTextHeaderCodec().decode(lineReader, textHeader);
//        int i = 0;
//        SAMSequenceRecord sr;
//        while ((sr = header.getSequence(i++)) != null) {
//            conf.setInt(sr.getSequenceName(), sr.getSequenceLength());
//        }

//        // filters
//        conf.set(OUTPUT_SUMMARY_JSON, output + "summary.json");
//        if (regions != null) {
//            conf.set(REGIONS_PARAM, regions);
//        }
//        conf.set(MIN_MAPQ_PARAM, "" + minMapQ);

//        Job job = Job.getInstance(conf, "ReadAlignmentDepthMR");
//        job.setJarByClass(ReadAlignmentDepthMR.class);
//
//        // input
//        AvroJob.setInputKeySchema(job, ReadAlignment.SCHEMA$);
//        FileInputFormat.setInputPaths(job, new Path(input));
//        job.setInputFormatClass(AvroKeyInputFormat.class);
//
//        // output
//        FileOutputFormat.setOutputPath(job, new Path(output));
//        job.setOutputKeyClass(RegionCoverageWritable.class);
//        job.setOutputValueClass(NullWritable.class);
//
//        // mapper
////        job.setMapperClass(ReadAlignmentDepthMapper.class);
//        job.setMapOutputKeyClass(ChunkKey.class);
//        job.setMapOutputValueClass(RegionCoverageWritable.class);
//
//        // combiner
//        job.setCombinerClass(ReadAlignmentDepthCombiner.class);
//
//        // reducer
//        job.setReducerClass(ReadAlignmentDepthReducer.class);
//        job.setNumReduceTasks(1);
//
//        return (job.waitForCompletion(true) ? 0 : 1);
//    }
}


text:
import sys
import unittest
from platrontools import utils
from platrontools import client
from . import config

XML_RESULT = """<?xml version="1.0" encoding="utf-8"?>
<request>
<pg_salt>fedcf333</pg_salt>
<pg_order_id>37</pg_order_id>
<pg_payment_id>3120286</pg_payment_id>
<pg_payment_system>TEST</pg_payment_system>
<pg_amount>400.0000</pg_amount>
<pg_net_amount>400</pg_net_amount>
<pg_currency>RUR</pg_currency>
<pg_ps_currency>RUR</pg_ps_currency>
<pg_ps_amount>400</pg_ps_amount>
<pg_ps_full_amount>400.00</pg_ps_full_amount>
<pg_result>1</pg_result>
<pg_can_reject>0</pg_can_reject>
<pg_payment_date>2012-05-29 11:52:31</pg_payment_date>
<pg_user_phone>79688676293</pg_user_phone>
<pg_description></pg_description>
<pg_sig>2558cc22c124ef0dd0f0c1a939e26d4b</pg_sig>
</request>
"""

class TestRequest(unittest.TestCase):
    def setUp(self):
        self.client = client.Client(secret=config.SECRET,
                                    merchant_id=config.MERCHANT_ID)

    @unittest.skipIf(not config.MERCHANT_ID,
                     "config.MERCHANT_ID is not defined")
    def test_init_payment(self):
        r = self.client.init_payment(1.0, 'Test', '127.0.0.1')
        print r
        self.assertTrue(not r is None)

    def test_parse_response(self):
        r = self.client.parse_response(XML_RESULT, url='')
        # print r
        self.assertTrue(not r is None)

if __name__ == '__main__':
    unittest.main()


text:
package org.apache.jena.rdf.model;

import java.util.Calendar;

import org.apache.jena.datatypes.DatatypeFormatException ;
import org.apache.jena.datatypes.RDFDatatype ;
import org.apache.jena.graph.Node ;

/** Convenience methods which extend the {@link Model} interface.
 *
The {@link Model} interface provides a set of primitive operations on
 *    an RDF model.  This interface extends those methods with a
 *    set of convenience methods.

 *
This interface provides methods supporting typed literals.  This means
 *    that methods are provided which will translate a built in type, or an
 *    object to an RDF Literal.  This translation is done by invoking the
 *    toString() method of the object, or its built in equivalent.
 *    The reverse translation is also supported.  This is built in for built
 *    in types.  Factory objects, provided by the application, are used
 *    for application objects.

 *
This interface provides methods for supporting enhanced resources.  An
 *    enhanced resource is a resource to which the application has added
 *    behaviour.  RDF containers are examples of enhanced resources built in
 *    to this package.  Enhanced resources are supported by encapsulating a
 *    resource created by an implementation in another class which adds
 *    the extra behaviour.  Factory objects are used to construct such
 *    enhanced resources.

 */
public interface ModelCon {

/** Return a Resource instance in this model.
 *
 *
Subsequent operations on the returned object may modify this model.

 *
The resource is assumed to already exist in the model.  If it does not,
 * createResource should be used instead.

 * @return a resource instance created by the factory provided
 * @param uri the URI of the resource
 * @param f the factory object

 */
@Deprecated Resource getResource(String uri, ResourceF f) ;

/** Return a Property instance in this model.
 *
 *
Subsequent operations on the returned property may modify this model.

 *
The property is assumed to already exist in the model.  If it does not,
 * createProperty should be used instead.

 * @return a property object
 * @param uri the URI of the property

*/
    Property getProperty(String uri) ;

/** Return a Bag instance in this model.
 *
 *
Subsequent operations on the returned bag may modify this model.

 *
The bag is assumed to already exist in the model.  If it does not,
 * createBag should be used instead.

 * @return a bag instance
 * @param uri the URI of the bag.

 */
    Bag getBag(String uri) ;

/** Return a bag instance based on a given resource.
 *
 *
 This method enables an application to treat any resource as a bag.
 *     It is in effect an unsafe downcast.

 *
 *
Subsequent operations on the returned bag may modify this model.

 *
The bag is assumed to already exist in the model.  If it does not,
 * createBag should be used instead.

 * @return a bag instance
 * @param r an untyped Resource instance

 */
    Bag getBag(Resource r) ;

/** Return an Alt instance in this model.
 *
 *
Subsequent operations on the returned object may modify this model.

 *
The alt is assumed to already exist in the model.  If it does not,
 * createAlt should be used instead.

 * @return an alt instance
 * @param uri the URI of the alt

 */
    Alt getAlt(String uri) ;

/** Return an Alt instance based on a given resource.
 *
 *
 This method enables an application to treat any resource as an Alt.
 *     It is in effect an unsafe downcast.

 *
 *
Subsequent operations on the returned Alt may modify this model.

 *
The bag is assumed to already exist in the model.  If it does not,
 * createAlt should be used instead.

 * @return an Alt instance
 * @param r an untyped Resource instance

 */
    Alt getAlt(Resource r) ;
/** Return a Seq instance in this model.
 *
 *
Subsequent operations on the returned bag may modify this model.

 *
The seq is assumed to already exist in the model.  If it does not,
 * createSeq should be used instead.

 * @return a seq instance
 * @param uri the URI of the seq

 */
    Seq getSeq(String uri) ;

/** Return a Seq instance based on a given resource.
 *
 *
 This method enables an application to treat any resource as a Seq.
 *     It is in effect an unsafe downcast.

 *
 *
Subsequent operations on the returned Seq may modify this model.

 *
The Seq is assumed to already exist in the model.  If it does not,
 * createAlt should be used instead.

 * @return an Alt instance
 * @param r an untyped Resource instance

 */
    Seq getSeq(Resource r) ;

/** Create a new anonymous resource with a given type.
 *
 *
 Subsequent operations on the returned resource may modify this model.
 *

 *
 The resource is created and an rdf:type property added to the model
 * to specify its type.

 * @param type the type of the resource to be created.
 * @return a new anonymous resource linked to this model.
  */
    public Resource createResource(Resource type) ;

/**
    Create or find an RDFNode
    (a {@link Resource} or a {@link Literal})
    from a graph Node. This is provided for users and
    developers operating at the API/SPI interface, where Resources are
    constructed from Nodes. Providing this method allows each Model
    the opportunity to cache node-to-resource maps if it requires.

    @param n the graph.Node on which to base the Model.RDFNode
    @return a suitable RDFNode
*/
    public RDFNode getRDFNode( Node n );

/** Create a new resource with a given type.
 *
 *
 Subsequent operations on the returned resource may modify this model.
 *

 *
 The resource is created and an rdf:type property added to the model
 * to specify its type.

 * @param type the type of the resource to be created.
 * @return a new resource linked to this model.
 * @param uri The URI of the new resource.
  */
    public Resource createResource(String uri, Resource type);

/** Create a new anonymous resource using the supplied factory.
 *
 *
 Subsequent operations on the returned resource may modify this model.
 *

 * @return a new anonymous resource linked to this model.
 * @param f A factory object to create the returned object.
 .
 */
    @Deprecated public Resource createResource(ResourceF f) ;

/** Create a new resource using the supplied factory.
 *
 *
 Subsequent operations on the returned resource may modify this model.
 *

 * @return a new resource linked to this model.
 * @param uri the URI of the resource
 * @param f A factory to create the returned object.
 .
 */
    @Deprecated public Resource createResource(String uri, ResourceF f) ;

/** Create a property.
 *
 *
 Subsequent operations on the returned property may modify this model.
 *

 * @param uri the URI of the property

 * @return a property instance
 */
    public Property createProperty(String uri) ;

    /** create a literal from a String value.
     *
     * @param v the value of the literal
     * @return a new literal representing the value v
     */
    public Literal createLiteral( String v );

    /** create a type literal from a boolean value.
     *
     *
 The value is converted to a string using its toString
     * method.

     * @param v the value of the literal
     * @return a new literal representing the value v
     */
    public Literal createTypedLiteral(boolean v) ;

    /** create a typed literal from an integer value.
     *
     * @param v the value of the literal
     * @return a new literal representing the value v
     */
    public Literal createTypedLiteral(int v) ;

    /** create a typed literal from an integer value.
     *
     * @param v the value of the literal
     * @return a new literal representing the value v
     */
    public Literal createTypedLiteral(long v) ;

    /**
     * Create a typed literal of type xsd:dateTime from a Calendar object.
     */
    public Literal createTypedLiteral(Calendar d);

    /** create a typed literal from a char value.
     *
     * @param v the value of the literal
     * @return a new literal representing the value v
     */
    public Literal createTypedLiteral(char v) ;

    /** create a typed literal from a float value.
     *
     * @param v the value of the literal
     * @return a new literal representing the value v
     */
    public Literal createTypedLiteral(float v) ;

    /** create a typed literal from a double value.
     *
     * @param v the value of the literal
     * @return a new literal representing the value v
     */
    public Literal createTypedLiteral(double v) ;

    /** create a typed literal from a String value.
     *
     * @param v the value of the literal
     * @return a new literal representing the value v
     */
    public Literal createTypedLiteral(String v) ;

    /** create a literal from an Object.
     *
     * @return a new literal representing the value v
     * @param v the value of the literal.
     */
    public Literal createTypedLiteral(Object v) ;

    /**
     * Build a typed literal from its lexical form. The
     * lexical form will be parsed now and the value stored. If
     * the form is not legal this will throw an exception.
     *

     * Note that in preview releases of Jena2 it was also possible to specify
     *   a language type. Changes to the RDF specification mean that this is no longer
     *   legal except for plain literals. To create a plain literal with a language tag
     *   use {@link Model#createLiteral(String, String) createLiteral}.
     *

     *
     * @param lex the lexical form of the literal
     * @param typeURI the uri of the type of the literal, null for old style "plain" literals
     * @throws DatatypeFormatException if lex is not a legal form of dtype
     */
    public Literal createTypedLiteral(String lex, String typeURI)  ;

    /**
     * Build a typed literal from its value form.
     *

     * Note that in preview releases of Jena2 it was also possible to specify
     *   a language type. Changes to the RDF specification mean that this is no longer
     *   legal except for plain literals. To create a plain literal with a language tag
     *   use {@link Model#createLiteral(String, String) createLiteral}.
     *

     *
     * @param value the value of the literal
     * @param typeURI the URI of the type of the literal, null for old style "plain" literals
     */
    public Literal createTypedLiteral(Object value, String typeURI);

    /**
        Answer a new Statement object (s, p, o') where o' is the typed literal
        corresponding to o using createTypedLiteral.
    */
    public Statement createLiteralStatement( Resource s, Property p, boolean o );

    /**
        Answer a new Statement object (s, p, o') where o' is the typed literal
        corresponding to o using createTypedLiteral.
    */
    public Statement createLiteralStatement( Resource s, Property p, float o );

    /**
        Answer a new Statement object (s, p, o') where o' is the typed literal
        corresponding to o using createTypedLiteral.
    */
    public Statement createLiteralStatement( Resource s, Property p, double o );

    /**
        Answer a new Statement object (s, p, o') where o' is the typed literal
        corresponding to o using createTypedLiteral.
    */
    public Statement createLiteralStatement( Resource s, Property p, long o );

    /**
        Answer a new Statement object (s, p, o') where o' is the typed literal
        corresponding to o using createTypedLiteral.
    */
    public Statement createLiteralStatement( Resource s, Property p, int o );

    /**
        Answer a new Statement object (s, p, o') where o' is the typed literal
        corresponding to o using createTypedLiteral.
    */
    public Statement createLiteralStatement( Resource s, Property p, char o );

    /**
        Answer a new Statement object (s, p, o') where o' is the typed literal
        corresponding to o using createTypedLiteral.
    */
    public Statement createLiteralStatement( Resource s, Property p, Object o );

    /** Create a Statement instance.
     *
     *
Subsequent operations on the statement or any of its parts may
     * modify this model.

     *
Creating a statement does not add it to the set of statements in the
     * model.

     *
The Object o will be converted to a Literal.

     * @param s the subject of the statement
     * @param p the predicate of the statement
     * @param o is the value to be the object of the statement

     * @return the new statement
     */
    public Statement createStatement(Resource s, Property p, String o)  ;

    /** Create a Statement instance.
     *
     *
Subsequent operations on the statement or any of its parts may
     * modify this model.

     *
Creating a statement does not add it to the set of statements in the
     * model.

     *
The Object o will be converted to a Literal.

     * @param s the subject of the statement
     * @param p the predicate of the statement
     * @param o is the value to be the object of the statement
     * @param l the language associated with the object

     * @return the new statement
     */
    public Statement createStatement(Resource s, Property p, String o, String l) ;

    /** Create a Statement instance.
     *
     *
Subsequent operations on the statement or any of its parts may
     * modify this model.

     *
Creating a statement does not add it to the set of statements in the
     * model.

     *
The Object o will be converted to a Literal.

     * @param s the subject of the statement
     * @param p the predicate of the statement
     * @param o is the value to be the object of the statement
     * @param wellFormed true if the string is well formed XML

     * @return the new statement
     */
    public Statement createStatement(Resource s, Property p, String o,
                                     boolean wellFormed) ;

    /** Create a Statement instance.
     *
     *
Subsequent operations on the statement or any of its parts may
     * modify this model.

     *
Creating a statement does not add it to the set of statements in the
     * model.

     *
The Object o will be converted to a Literal.

     * @param s the subject of the statement
     * @param p the predicate of the statement
     * @param o is the value to be the object of the statement
     * @param l the language associated with the object
     * @param wellFormed true of the string is well formed XML

     * @return the new statement
     */
    public Statement createStatement(Resource s, Property p, String o, String l, boolean wellFormed) ;

    /** Create a new anonymous bag.
     *
     *
Subsequent operations on the bag or any of its parts may
     * modify this model.

     *
A statement defining the type of the new bag is added to this model.
     *

     * @return a new anonymous bag.
     */
    public Bag createBag() ;

    /** Create a new bag.
     *
     *
Subsequent operations on the bag or any of its parts may
     * modify this model.

     *
A statement defining the type of the new bag is added to this model.
     *

     * @param uri The URI of the new Bag.
     * @return a new bag.
     */
    public Bag createBag(String uri) ;

    /** Create a new anonymous alt.
     *
     *
Subsequent operations on the alt or any of its parts may
     * modify this model.

     *
A statement defining the type of the new alt is added to this model.
     *

     * @return a new anonymous alt.
     */
    public Alt createAlt() ;

    /** Create a new alt.
     *
     *
Subsequent operations on the alt or any of its parts may
     * modify this model.

     *
A statement defining the type of the new alt is added to this model.
     *

     * @param uri The URI of the new alt.
     * @return a new alt.
     */
    public Alt createAlt(String uri) ;

    /** Create a new anonymous seq.
     *
     *
Subsequent operations on the seq or any of its parts may
     * modify this model.

     *
A statement defining the type of the new seq is added to this model.
     *

     * @return a new anonymous seq.
     */
    public Seq createSeq() ;

    /** Create a new seq.
     *
     *
Subsequent operations on the seq or any of its parts may
     * modify this model.

     *
A statement defining the type of the new seq is added to this model.
     *

     * @param uri The URI of the new seq.
     * @return a new seq.
     */
    public Seq createSeq(String uri) ;

/** add a statement to this model.
 * @return this model
 * @param s the subject of the statement to add
 * @param p the predicate of the statement to add
 * @param o the object of the statement to add
 */
    Model add(Resource s, Property p, RDFNode o)     ;

    /**
        Add the statement (s, p, createTypedLiteral( o )) to this model and
        answer this model.
    */
    Model addLiteral( Resource s, Property p, boolean o );

    /**
        Add the statement (s, p, createTypedLiteral( o )) to this model and
        answer this model.
     */
    Model addLiteral( Resource s, Property p, long o );

    /**
        Add the statement (s, p, createTypedLiteral( o )) to this model and
        answer this model.
     */
    Model addLiteral( Resource s, Property p, int o );

    /**
        Add the statement (s, p, createTypedLiteral( o )) to this model and
        answer this model.
    */
    Model addLiteral( Resource s, Property p, char o ) ;

    /**
        Add the statement (s, p, o') to the model, where o' is the typed
        literal corresponding to o. Answer this model.
    */
    Model addLiteral( Resource s, Property p, float o );

    /**
        Add the statement (s, p, o') to the model, where o' is the typed
        literal corresponding to o. Answer this model.
     */
    Model addLiteral( Resource s, Property p, double o ) ;

    /** add a statement to this model.
     * Applications should use typed literals whereever possible.
     *
     * @return this model
     * @param s the subject of the statement to add
     * @param p the predicate of the statement to add
     * @param o the object of the statement to add
     * @deprecated Freshly (should have been done a while ago)
     */
      @Deprecated Model addLiteral( Resource s, Property p, Object o );

      /** add a statement to this model.
       *
       * @return this model
       * @param s the subject of the statement to add
       * @param p the predicate of the statement to add
       * @param o the object of the statement to add
       */
        Model addLiteral( Resource s, Property p, Literal o );

    /** add a statement to this model.
     *
     * @return this model
     * @param s the subject of the statement to add
     * @param p the predicate of the statement to add
     * @param o the object of the statement to add
     */
    Model add(Resource s, Property p, String o) ;

    /** add a statement to this model.
    *
    * @return this model
    * @param s the subject of the statement to add
    * @param p the predicate of the statement to add
    * @param lex the lexcial form of the literal
    * @param datatype the datatype of the literal
    */
    Model add(Resource s, Property p, String lex, RDFDatatype datatype) ;

/** add a statement to this model.
 *
 * @return this model
 * @param s the subject of the statement to add
 * @param p the predicate of the statement to add
 * @param o the object of the statement to add
 * @param wellFormed true if o is well formed XML
 */
    Model add(Resource s, Property p, String o, boolean wellFormed);

/** add a statement to this model.
 *
 * @return this model
 * @param s the subject of the statement to add
 * @param p the predicate of the statement to add
 * @param o the object of the statement to add
 * @param l the language associated with the object

 */
    Model add(Resource s, Property p, String o, String l) ;

/**
        remove the statement (s, p, o) from this model and
        answer this model. None of s, p, o are permitted to
        be null: for wildcard removal, see removeAll.
    */
    Model remove( Resource s, Property p, RDFNode o );

    /** Remove all the Statements returned by an iterator.
     * @return this model
     * @param iter the iterator which returns the statements to be removed.

     */
    Model remove(StmtIterator iter) ;

/** Remove all the Statements in a given model, including reified statements
 * @return this model
 * @param m the model containing the statements to be removed.

 */
    Model remove(Model m) ;

    /**
        Answer a statement iterator that will iterate over all the statements
        (S, P, O) in this model where S matches subject, P
        matches predicate, and O matches the typed literal
        corresponding to object.
    */
    StmtIterator listLiteralStatements( Resource subject, Property predicate, boolean object );

    /**
        Answer a statement iterator that will iterate over all the statements
        (S, P, O) in this model where S matches subject, P
        matches predicate, and O matches the typed literal
        corresponding to object.
    */
    StmtIterator listLiteralStatements( Resource subject, Property predicate, char object );

    /**
        Answer a statement iterator that will iterate over all the statements
        (S, P, O) in this model where S matches subject, P
        matches predicate, and O matches the typed literal
        corresponding to object.
    */
    StmtIterator listLiteralStatements(Resource subject, Property predicate, long object );

    /**
        Answer a statement iterator that will iterate over all the statements
        (S, P, O) in this model where S matches subject, P
        matches predicate, and O matches the typed literal
        corresponding to object.
    */
    StmtIterator listLiteralStatements(Resource subject, Property predicate, int object );

    /**
        Answer a statement iterator that will iterate over all the statements
        (S, P, O) in this model where S matches subject, P
        matches predicate, and O matches the typed literal
        corresponding to object.
    */
    StmtIterator listLiteralStatements( Resource subject, Property predicate, float object );

    /**
        Answer a statement iterator that will iterate over all the statements
        (S, P, O) in this model where S matches subject, P
        matches predicate, and O matches the typed literal
        corresponding to object.
    */
    StmtIterator listLiteralStatements(Resource subject, Property predicate, double  object );

    /** Find all the statements matching a pattern.
     *
Return an iterator over all the statements in a model
     *  that match a pattern.  The statements selected are those
     *  whose subject matches the subject argument,
     *  whose predicate matches the predicate argument
     *  and whose object matchesthe object argument.

     * @return an iterator over the subjects
     * @param subject   The subject sought
     * @param predicate The predicate sought
     * @param object    The value sought

     */
    StmtIterator listStatements( Resource subject, Property predicate, String  object );

/** Find all the statements matching a pattern.
 *
Return an iterator over all the statements in a model
 *  that match a pattern.  The statements selected are those
 *  whose subject matches the subject argument,
 *  whose predicate matches the predicate argument
 *  and whose object matchesthe object argument.
 *  If an argument is null it matches anything.

 * @return an iterator over the subjects
 * @param subject   The subject sought
 * @param predicate The predicate sought
 * @param object    The value sought
 * @param lang      The lang code ofthe string.

 */
    StmtIterator listStatements(Resource subject,
                                Property predicate,
                                String   object,
                                String   lang)
                                           ;

    /**
        Answer an iterator [without duplicates] over all the resources in this
        model which have value o' for property p, where o' is the typed literal
        corresponding to o.
    */
    ResIterator listResourcesWithProperty( Property p, boolean o );

    /**
        Answer an iterator [without duplicates] over all the resources in this
        model which have value o' for property p, where o' is the typed literal
        corresponding to o.
    */
    ResIterator listResourcesWithProperty( Property p, long o );

    /**
        Answer an iterator [without duplicates] over all the resources in this
        model which have value o' for property p, where o' is the typed literal
        corresponding to o.
    */
    ResIterator listResourcesWithProperty( Property p, char o );

    /**
        Answer an iterator [without duplicates] over all the resources in this
        model which have value o' for property p, where o' is the typed literal
        corresponding to o.
    */
    ResIterator listResourcesWithProperty( Property p, float o );

    /**
        Answer an iterator [without duplicates] over all the resources in this
        model which have value o' for property p, where o' is the typed literal
        corresponding to o.
    */
    ResIterator listResourcesWithProperty( Property p, double o );

    /**
        Answer an iterator [without duplicates] over all the resources in this
        model which have value o' for property p, where o' is the typed literal
        corresponding to o.
    */
    ResIterator listResourcesWithProperty( Property p, Object o );

    /** lists all subjects with a given property and property value.
     * @return an iterator over the set of subjects
     * @param p The predicate sought.
     * @param o The property value sought.
     */
    ResIterator listSubjectsWithProperty( Property p, String o );

    /** lists all subjects with a given property and property value.

     * @return an iterator over the set of subjects
     * @param p The predicate sought.
     * @param o The property value sought.
     * @param l the language associated with the object

     */
    ResIterator listSubjectsWithProperty( Property p, String o, String l );

    /**
        Answer true iff this model contains the statement (s, p, o') where
        o' is the typed literal corresponding to the value o.
    */
    boolean containsLiteral( Resource s, Property p, boolean o );

    /**
        Answer true iff this model contains the statement (s, p, o') where
        o' is the typed literal corresponding to the value o.
    */
    boolean containsLiteral( Resource s, Property p, long o );

    /**
        Answer true iff this model contains the statement (s, p, o') where
        o' is the typed literal corresponding to the value o.
    */
    boolean containsLiteral( Resource s, Property p, int o );

    /**
        Answer true iff this model contains the statement (s, p, o') where
        o' is the typed literal corresponding to the value o.
    */
    boolean containsLiteral( Resource s, Property p, char o );

    /**
        Answer true iff this model contains (s, p, o') where o' is the typed
        literal corresponding to o.
    */
    boolean containsLiteral( Resource s, Property p, float o );

    /**
        Answer true iff this model contains the statement (s, p, o') where
        o' is the typed literal corresponding to the value o.
    */
    boolean containsLiteral( Resource s, Property p, double o );

    /**
        Answer true iff this model contains the statement (s, p, o') where
        o' is the typed literal corresponding to the value o.
    */
    boolean containsLiteral( Resource s, Property p, Object o );

/** Determine if a statement is present in this model.
 * @return true if the statement with subject s, property p and object o
 * is in the model, false otherwise
 * @param s The subject of the statment tested.
 * @param p The predicate of the statement tested.
 * @param o The object of the statement tested.
 */
    boolean contains( Resource s, Property p, String o );

/** Determine if a statement is present in this model.
 * @return true if the statement with subject s, property p and object o
 * is in the model, false otherwise
 * @param s The subject of the statment tested.
 * @param p The predicate of the statement tested.
 * @param o The object of the statement tested.
 * @param l the language associated with the object
 */
    boolean contains( Resource s, Property p, String o, String l );
}


text:
var Maybe = require('../../../bower_components/purescript-maybe/src/Data/Maybe')

var compile = function (js) {
  return eval('(' + js + ')') // eslint-disable-line
}

exports._eval = function (js) {
  try {
    var compiled = compile(js)
    if (typeof compiled !== 'string') compiled = String(compiled)
    return Maybe.Just.create(compiled)
  } catch (e) {
    console.warn('Failed to eval', e)
    return Maybe.Nothing.value
  }
}


text:
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE457_Use_of_Uninitialized_Variable__char_pointer_10.c
Label Definition File: CWE457_Use_of_Uninitialized_Variable.c.label.xml
Template File: sources-sinks-10.tmpl.c
*/
/*
 * @description
 * CWE: 457 Use of Uninitialized Variable
 * BadSource: no_init Don't initialize data
 * GoodSource: Initialize data
 * Sinks: use
 *    GoodSink: Initialize then use data
 *    BadSink : Use data
 * Flow Variant: 10 Control flow: if(globalTrue) and if(globalFalse)
 *
 * */

#include "std_testcase.h"

#include <wchar.h>

#ifndef OMITBAD

void CWE457_Use_of_Uninitialized_Variable__char_pointer_10_bad()
{
    char * data;
    if(globalTrue)
    {
        /* POTENTIAL FLAW: Don't initialize data */
        ; /* empty statement needed for some flow variants */
    }
    if(globalTrue)
    {
        /* POTENTIAL FLAW: Use data without initializing it */
        printLine(data);
    }
}

#endif /* OMITBAD */

#ifndef OMITGOOD

/* goodB2G1() - use badsource and goodsink by changing the second globalTrue to globalFalse */
static void goodB2G1()
{
    char * data;
    if(globalTrue)
    {
        /* POTENTIAL FLAW: Don't initialize data */
        ; /* empty statement needed for some flow variants */
    }
    if(globalFalse)
    {
        /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
        printLine("Benign, fixed string");
    }
    else
    {
        /* FIX: Ensure data is initialized before use */
        data = "string";
        printLine(data);
    }
}

/* goodB2G2() - use badsource and goodsink by reversing the blocks in the second if */
static void goodB2G2()
{
    char * data;
    if(globalTrue)
    {
        /* POTENTIAL FLAW: Don't initialize data */
        ; /* empty statement needed for some flow variants */
    }
    if(globalTrue)
    {
        /* FIX: Ensure data is initialized before use */
        data = "string";
        printLine(data);
    }
}

/* goodG2B1() - use goodsource and badsink by changing the first globalTrue to globalFalse */
static void goodG2B1()
{
    char * data;
    if(globalFalse)
    {
        /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
        printLine("Benign, fixed string");
    }
    else
    {
        /* FIX: Initialize data */
        data = "string";
    }
    if(globalTrue)
    {
        /* POTENTIAL FLAW: Use data without initializing it */
        printLine(data);
    }
}

/* goodG2B2() - use goodsource and badsink by reversing the blocks in the first if */
static void goodG2B2()
{
    char * data;
    if(globalTrue)
    {
        /* FIX: Initialize data */
        data = "string";
    }
    if(globalTrue)
    {
        /* POTENTIAL FLAW: Use data without initializing it */
        printLine(data);
    }
}

void CWE457_Use_of_Uninitialized_Variable__char_pointer_10_good()
{
    goodB2G1();
    goodB2G2();
    goodG2B1();
    goodG2B2();
}

#endif /* OMITGOOD */

/* Below is the main(). It is only used when building this testcase on
   its own for testing or for building a binary to use in testing binary
   analysis tools. It is not used when compiling all the testcases as one
   application, which is how source code analysis tools are tested. */

#ifdef INCLUDEMAIN

int main(int argc, char * argv[])
{
    /* seed randomness */
    srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
    printLine("Calling good()...");
    CWE457_Use_of_Uninitialized_Variable__char_pointer_10_good();
    printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
    printLine("Calling bad()...");
    CWE457_Use_of_Uninitialized_Variable__char_pointer_10_bad();
    printLine("Finished bad()");
#endif /* OMITBAD */
    return 0;
}

#endif


text:
require_relative 'middleware/backoff'
require_relative 'middleware/limit'
require_relative 'middleware/start_key'

module Dynamoid
  # @private
  module AdapterPlugin
    class AwsSdkV3
      class Query
        OPTIONS_KEYS = %i[
          limit hash_key hash_value range_key consistent_read scan_index_forward
          select index_name batch_size exclusive_start_key record_limit scan_limit
          project
        ].freeze

        attr_reader :client, :table, :options, :conditions

        def initialize(client, table, opts = {})
          @client = client
          @table = table

          opts = opts.symbolize_keys
          @options = opts.slice(*OPTIONS_KEYS)
          @conditions = opts.except(*OPTIONS_KEYS)
        end

        def call
          request = build_request

          Enumerator.new do |yielder|
            api_call = lambda do |req|
              client.query(req).tap do |response|
                yielder << response
              end
            end

            middlewares = Middleware::Backoff.new(
              Middleware::StartKey.new(
                Middleware::Limit.new(api_call, record_limit: record_limit, scan_limit: scan_limit)
              )
            )

            catch :stop_pagination do
              loop do
                middlewares.call(request)
              end
            end
          end
        end

        private

        def build_request
          request = options.slice(
            :consistent_read,
            :scan_index_forward,
            :select,
            :index_name,
            :exclusive_start_key
          ).compact

          # Deal with various limits and batching
          batch_size = options[:batch_size]
          limit = [record_limit, scan_limit, batch_size].compact.min

          request[:limit]             = limit if limit
          request[:table_name]        = table.name
          request[:key_conditions]    = key_conditions
          request[:query_filter]      = query_filter
          request[:attributes_to_get] = attributes_to_get

          request
        end

        def record_limit
          options[:record_limit]
        end

        def scan_limit
          options[:scan_limit]
        end

        def hash_key_name
          (options[:hash_key] || table.hash_key)
        end

        def range_key_name
          (options[:range_key] || table.range_key)
        end

        def key_conditions
          result = {
            hash_key_name => {
              comparison_operator: AwsSdkV3::EQ,
              attribute_value_list: AwsSdkV3.attribute_value_list(AwsSdkV3::EQ, options[:hash_value].freeze)
            }
          }

          conditions.slice(*AwsSdkV3::RANGE_MAP.keys).each do |k, _v|
            op = AwsSdkV3::RANGE_MAP[k]

            result[range_key_name] = {
              comparison_operator: op,
              attribute_value_list: AwsSdkV3.attribute_value_list(op, conditions[k].freeze)
            }
          end

          result
        end

        def query_filter
          conditions.except(*AwsSdkV3::RANGE_MAP.keys).reduce({}) do |result, (attr, cond)|
            condition = {
              comparison_operator: AwsSdkV3::FIELD_MAP[cond.keys[0]],
              attribute_value_list: AwsSdkV3.attribute_value_list(AwsSdkV3::FIELD_MAP[cond.keys[0]], cond.values[0].freeze)
            }
            result[attr] = condition
            result
          end
        end

        def attributes_to_get
          return if options[:project].nil?

          options[:project].map(&:to_s)
        end
      end
    end
  end
end


text:
namespace Materials {
   extern "C"{
      DLL_PUBLIC SubtractNode* SubtractNodeCreateInstance()
      {
         return new SubtractNode();
      }

      DLL_PUBLIC const char* SubtractNodeGetInputASrc(SubtractNode* SubtractNode)
      {
         return SubtractNode->mInputASrc;
      }

      DLL_PUBLIC void SubtractNodeSetInputASrc(SubtractNode* SubtractNode, const char* src)
      {
         SubtractNode->mInputASrc = src;
      }

      DLL_PUBLIC const char* SubtractNodeGetInputBSrc(SubtractNode* SubtractNode)
      {
         return SubtractNode->mInputBSrc;
      }

      DLL_PUBLIC void SubtractNodeSetInputBSrc(SubtractNode* SubtractNode, const char* src)
      {
         SubtractNode->mInputBSrc = src;
      }
   }
}


text:
Currently, this is just a little Ruby script to output a random suburb to the terminal. A random suburb has the following:
- A name
- A zipcode
- A population number
- A second most common language (after English)
- Two interesting attractions
- A high school with:
  * A name
  * A mascot
  * A championship-winning team (with a year, region, and activity)
- A historical fact about its location


text:
package org.camunda.bpm.engine.impl.cmd;

import org.camunda.bpm.engine.impl.ProcessEngineLogger;
import org.camunda.bpm.engine.impl.cfg.CommandChecker;
import org.camunda.bpm.engine.impl.interceptor.Command;
import org.camunda.bpm.engine.impl.interceptor.CommandContext;
import org.camunda.bpm.engine.impl.persistence.entity.AuthorizationManager;
import org.camunda.bpm.engine.impl.persistence.entity.PropertyEntity;
import org.camunda.bpm.engine.impl.telemetry.TelemetryLogger;

public class IsTelemetryEnabledCmd implements Command<Boolean> {

  protected static final TelemetryLogger LOG = ProcessEngineLogger.TELEMETRY_LOGGER;

  public Boolean execute(CommandContext commandContext) {

    AuthorizationManager authorizationManager = commandContext.getAuthorizationManager();
    authorizationManager.checkCamundaAdminOrPermission(CommandChecker::checkReadTelemetryCollectionStatusData);

    PropertyEntity telemetryProperty = commandContext.getPropertyManager().findPropertyById("camunda.telemetry.enabled");
    if (telemetryProperty != null) {
      if (telemetryProperty.getValue().toLowerCase().equals("null")) {
        return null;
      } else {
        return Boolean.parseBoolean(telemetryProperty.getValue());
      }
    } else {
      LOG.databaseTelemetryPropertyMissingInfo();
      return null;
    }
  }
}


text:
module Repeatable
  class ParseError < StandardError
  end
end


text:
var varint = require('varint')

  , uncompressedLength = function(compressed) {
      return varint.decode(compressed)
    }

module.exports = uncompressedLength


text:
<!DOCTYPE HTML>
<html>
	<head>
	</head>
	<body>
		<img src="teste.jpg" id="image" style="display:none;width:500px;height:375;" />
		<canvas id="simpleCanvas" width="500" height="375">
			Seja mais feliz, use Firefox, Chrome, Safari ou Opera!
		</canvas>
		<script type="text/javascript">
			window.onload = function(){

			   var canvas = document.getElementById('simpleCanvas');

			   if (canvas && canvas.getContext) {

					var image = document.getElementById('image');

					canvas.width = image.height;
					canvas.height = image.width;

			      	var context = canvas.getContext('2d');

					//mover de um ponto a outro do grid
					context.translate(image.height, 0);
					context.rotate(Math.PI/2);

					context.drawImage(image, 0, 0);

					context.restore();
			   }
			}
		</script>
	</body>
</html>


text:
<?php
namespace WebSocket\Application;

/**
 * Shiny WSS Status Application
 * Provides live server infos/messages to client/browser.
 *
 * @author Simon Samtleben <web@lemmingzshadow.net>
 */
class StatusApplication extends Application
{
    private $_clients = array();
	private $_serverClients = array();
	private $_serverInfo = array();
	private $_serverClientCount = 0;

	public function onConnect($client)
    {
		$id = $client->getClientId();
        $this->_clients[$id] = $client;
		$this->_sendServerinfo($client);
    }

    public function onDisconnect($client)
    {
        $id = $client->getClientId();
		unset($this->_clients[$id]);
    }

    public function onData($data, $client)
    {
        // currently not in use...
    }

	public function setServerInfo($serverInfo)
	{
		if(is_array($serverInfo))
		{
			$this->_serverInfo = $serverInfo;
			return true;
		}
		return false;
	}

	public function clientConnected($ip, $port)
	{
		$this->_serverClients[$port] = $ip;
		$this->_serverClientCount++;
		$this->statusMsg('Client connected: ' .$ip.':'.$port);
		$data = array(
			'ip' => $ip,
			'port' => $port,
			'clientCount' => $this->_serverClientCount,
		);
		$encodedData = $this->_encodeData('clientConnected', $data);
		$this->_sendAll($encodedData);
	}

	public function clientDisconnected($ip, $port)
	{
		if(!isset($this->_serverClients[$port]))
		{
			return false;
		}
		unset($this->_serverClients[$port]);
		$this->_serverClientCount--;
		$this->statusMsg('Client disconnected: ' .$ip.':'.$port);
		$data = array(
			'port' => $port,
			'clientCount' => $this->_serverClientCount,
		);
		$encodedData = $this->_encodeData('clientDisconnected', $data);
		$this->_sendAll($encodedData);
	}

	public function clientActivity($port)
	{
		$encodedData = $this->_encodeData('clientActivity', $port);
		$this->_sendAll($encodedData);
	}

	public function statusMsg($text, $type = 'info')
	{
		$data = array(
			'type' => $type,
			'text' => '['. strftime('%m-%d %H:%M', time()) . '] ' . $text,
		);
		$encodedData = $this->_encodeData('statusMsg', $data);
		$this->_sendAll($encodedData);
	}

	private function _sendServerinfo($client)
	{
		if(count($this->_clients) < 1)
		{
			return false;
		}
		$currentServerInfo = $this->_serverInfo;
		$currentServerInfo['clientCount'] = count($this->_serverClients);
		$currentServerInfo['clients'] = $this->_serverClients;
		$encodedData = $this->_encodeData('serverInfo', $currentServerInfo);
		$client->send($encodedData);
	}

	private function _sendAll($encodedData)
	{
		if(count($this->_clients) < 1)
		{
			return false;
		}
		foreach($this->_clients as $sendto)
		{
            $sendto->send($encodedData);
        }
	}
}


text:
package indi.itsyshao.jsch.io;

import java.io.IOException;
import java.io.OutputStream;
import java.io.PipedOutputStream;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;

import org.apache.commons.lang3.StringUtils;

import indi.itsyshao.jsch.JschUtils.DoShell;

/**
 * shell 输出流
 * 自动判断命令执行执行后续需要执行的命令
 * @author itsyshao
 *
 */
public class ShellOutputStream extends OutputStream {

	private DoShell doShell;
	private PipedOutputStream pipeOut;
	private Queue<String> quene = new LinkedList<String>();
	private List<CmdExec> cmdList = new ArrayList<CmdExec>();
	private boolean isLoginResult = true;

	public static final String EXEC_CMD = "~]# ";

	public static final String MYSQL_CMD = "mysql> ";

	public ShellOutputStream(DoShell doShell, PipedOutputStream pipeOut) {
		super();
		this.doShell = doShell;
		this.pipeOut = pipeOut;
	}

	private StringWriter sw = new StringWriter();
	private StringWriter csw = new StringWriter();

	@Override
	public void write(int b) throws IOException {
		sw.write(b);
		csw.write(b);
		String cmd = null;
		String content = csw.toString();
		String type = getCanPerform(content);
		if (StringUtils.isNotBlank(type)) {
			String filterContent = content;
			if (isLoginResult) {
				isLoginResult = false;
			} else {
				cmd = getCmd(content);
				filterContent = getCmdResult(content);
				CmdExec cmdExec = new CmdExec();
				cmdExec.setCmd(cmd);
				cmdExec.setType(type);
				cmdList.add(cmdExec);
			}
			String result = doShell.doOutput(cmd, filterContent);
			if (StringUtils.isNotBlank(result)) {
				quene.offer(result);
			}
			if ((cmd = quene.poll()) != null) {
				pipeOut.write((cmd + "\n").getBytes());
			} else {
				pipeOut.write(("exit" + "\n").getBytes());
			}
			System.out.println(content);
			csw = new StringWriter();
		}
	}

	private String getCanPerform(String content) {
		String performType = "";
		if (content.endsWith(EXEC_CMD)) {
			performType = EXEC_CMD;
		} else if (content.endsWith(MYSQL_CMD)) {
			performType = MYSQL_CMD;
		}
		return performType;
	}

	private String getCmd(String content) {
		String result = "";
		if (StringUtils.isNotBlank(content) && content.contains("\n")) {
			result = content.substring(0, content.indexOf("\n") - 1);
		}
		return result;
	}

	private String getCmdResult(String content) {
		String result = "";
		if (StringUtils.isNotBlank(content) && content.contains("\n")) {
			result = content.substring(content.indexOf("\n") + 1, content.lastIndexOf("\n") - 1);
		}
		return result;
	}

	public List<CmdExec> getCmdList() {
		return cmdList;
	}

	public void setCmdList(List<CmdExec> cmdList) {
		this.cmdList = cmdList;
	}

	public StringWriter getSw() {
		return sw;
	}

	public void setSw(StringWriter sw) {
		this.sw = sw;
	}

	/*
	 * 命令执行结果
	 */
	public class CmdExec {
		String cmd;

		String execResult;

		String type;

		public String getCmd() {
			return cmd;
		}

		public void setCmd(String cmd) {
			this.cmd = cmd;
		}

		public String getExecResult() {
			return execResult;
		}

		public void setExecResult(String execResult) {
			this.execResult = execResult;
		}

		public String getType() {
			return type;
		}

		public void setType(String type) {
			this.type = type;
		}

	}

}


text:
import MaxLengthValidator from '../../../src/validators/max-length';

describe('Length validator', () => {
    let validator: MaxLengthValidator = null;

    beforeEach(() => validator = new MaxLengthValidator(4));

    describe('isValid', () => {
        describe('When the field length is greater than the max length', () => {
            it('Should be invalid', () => {
                // Act
                let valid = validator.isValid('12345');

                // Assert
                expect(valid).toBe(false);
            });
        });

        describe('When field length is equal to the max length', () => {
            it('Should be valid', () => {
                // Act
                let valid = validator.isValid('1234');

                // Assert
                expect(valid).toBe(true);
            });
        });

        describe('When field length is less than the max length', () => {
            it('Should be valid', () => {
                // Act
                let valid = validator.isValid('123');

                // Assert
                expect(valid).toBe(true);
            });
        });
    });
});


text:
using namespace std;

static size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp)
{
    ((std::string*)userp)->append((char*)contents, size * nmemb);
    return size * nmemb;
}
//for (int i = 0; std::getline(f, line); ++i)
string remove(std::string input, char m)
{
  input.erase(std::remove(input.begin(),input.end(), m),input.end());

  return input;
}

std::string replacestring(std::string subject, const std::string& search,
                          const std::string& replace) {
    size_t pos = 0;
    while((pos = subject.find(search, pos)) != std::string::npos) {
         subject.replace(pos, search.length(), replace);
         pos += replace.length();
    }
    return subject;
}

double Bidtracker::getbalance(std::string url)
{
    const char * c = url.c_str();

      std::string readBuffer;
      CAmount balance;
      curl = curl_easy_init();
      if(curl) {
		curl_global_init(CURL_GLOBAL_ALL);
		curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
		curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
        curl_easy_setopt(curl, CURLOPT_URL, c);
        curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
        curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
		curl_easy_setopt(curl, CURLOPT_USERAGENT, "Bitcredit/0.30");
        res = curl_easy_perform(curl);
        curl_easy_cleanup(curl);
		}
		if(res != CURLE_OK) {
			if (fDebug) LogPrintf("Curl Error on Bidtracker::getbalance() - %s - on URL:%s.\n", curl_easy_strerror(res), url);
		}
		else {
			if (fDebug) LogPrintf("Curl Response on Bidtracker::getbalance() - Lenght %lu - Buffer - %s .\n", (long)readBuffer.size(), readBuffer);
		}
		std::string response = readBuffer;
		if ( ! (std::istringstream(response) >> balance) ) balance = 0;
    return balance;
}

void Bidtracker::btcsortunspent(){

	std::ifstream myfile ((GetDataDir()/ "bidtracker/btcunspentraw.dat").string().c_str());
	std::ofstream myfile2;
	myfile2.open((GetDataDir()/ "bidtracker/btcbids.dat").string().c_str(),std::fstream::out);

	std::string line, txid, url;
    try
    {

	if (myfile.is_open()){
		while ( myfile.good() ){
			getline (myfile,line);
			std::string temp = line;
			std::string search,search2;
			size_t pos;
			size_t f = line.find("tx_hash_big_endian:");
			size_t g = line.find("value:");

			search = "tx_hash_big_endian";
			pos = temp.find(search);
			if (pos != std::string::npos){
				std::string semp =line;
				semp = semp.replace(f, std::string("tx_hash_big_endian:").length(), "");
				semp = remove(semp, ',');
				txid = semp;
				url = "https://blockchain.info/rawtx/"+ txid ;
				const char * d = url.c_str();
				string readBuffer;
				curl = curl_easy_init();
				if(curl) {
					curl_global_init(CURL_GLOBAL_ALL);
					curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
					curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
					curl_easy_setopt(curl, CURLOPT_URL, d);
					curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
					curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
					curl_easy_setopt(curl, CURLOPT_USERAGENT, "Bitcredit/0.30");
					res = curl_easy_perform(curl);
					curl_easy_cleanup(curl);
				}
				if(res != CURLE_OK) {
					if (fDebug) LogPrintf("Curl Error on Bidtracker::btcsortunspent() - %s - on URL:%s.\n", curl_easy_strerror(res), url);
				}
				else {
					if (fDebug) LogPrintf("Curl Response on Bidtracker::btcsortunspent() - Lenght %lu - Buffer - %s .\n", (long)readBuffer.size(), readBuffer);
					std::size_t pos1 = readBuffer.find("value");
					readBuffer = readBuffer.substr(0,pos1);
					readBuffer = remove(readBuffer, '"');
					readBuffer = remove(readBuffer, '{');
					readBuffer = remove(readBuffer,'}');
					readBuffer = remove(readBuffer, '[');
					readBuffer = remove(readBuffer, '\n');
					std::string uemp =readBuffer;
					std::size_t pos2 = uemp.find("addr:");
					uemp = uemp.substr(pos2);
					uemp = replacestring(uemp, "addr:", "");
					boost::algorithm::erase_all(uemp, " ");
					myfile2 << uemp;
				}
			}

			search2 = "value:";
			pos = temp.find(search2);
			if (pos != std::string::npos){
				std::string semp =line;
				semp = semp.replace(g, std::string("value:").length(), "");
				string value = semp;
				value = remove(value, ',');
				long double amount = atof(value.c_str());
				myfile2 << std::fixed <<  amount << std::endl;
			}
		}
		myfile.close();
		myfile2.close();
	}
	}

    catch (std::exception const &exc)
    {
		if (fDebug) LogPrintf("Bidtracker Error on Bidtracker::btcsortunspent() - %s .\n", exc.what());
    }
    catch (...)
    {
		if (fDebug) LogPrintf("Bidtracker Unknown Error on Bidtracker::btcsortunspent().\n");
    }
}

void Bidtracker::btcsortunspentbackup(){

	std::ifstream myfile ((GetDataDir()/ "bidtracker/btcunspentrawbackup.dat").string().c_str());
	std::ofstream myfile2;
	myfile2.open((GetDataDir()/ "bidtracker/btcbidsbackup.dat").string().c_str(),fstream::out);
    try
    {
	std::string line, txid, url;
    char * pEnd;
	if (myfile.is_open()){
		while (myfile.good()){
			getline(myfile,line);
			line = line.erase(line.find("txid:"), 5);
			line = line.erase(line.find("amount:"), 7);
			std::vector<std::string> strs;
			boost::split(strs, line, boost::is_any_of(","));
			long double amount = strtoll(strs[5].c_str(),&pEnd,10) *COIN;
			txid = strs[1].c_str();
			url = "https://blockchain.info/rawtx/"+ txid ;
			const char * d = url.c_str();
			string readBuffer;
			curl = curl_easy_init();
			if(curl) {
				curl_global_init(CURL_GLOBAL_ALL);
				curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
				curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
				curl_easy_setopt(curl, CURLOPT_URL, d);
				curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
				curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
				curl_easy_setopt(curl, CURLOPT_USERAGENT, "Bitcredit/0.30");
				res = curl_easy_perform(curl);
				curl_easy_cleanup(curl);
			}
			if(res != CURLE_OK) {
				if (fDebug) LogPrintf("Curl Error on Bidtracker::btcsortunspentbackup() - %s - on URL:%s.\n", curl_easy_strerror(res), url);
			}
			else {
				if (fDebug) LogPrintf("Curl Response on Bidtracker::btcsortunspentbackup() - Lenght %lu - Buffer - %s .\n", (long)readBuffer.size(), readBuffer);
				std::size_t pos1 = readBuffer.find("value");
				readBuffer = readBuffer.substr(0,pos1);
				readBuffer = remove(readBuffer, '"');
				readBuffer = remove(readBuffer, '{');
				readBuffer = remove(readBuffer,'}');
				readBuffer = remove(readBuffer, '[');
				readBuffer = remove(readBuffer, '\n');
				std::string uemp =readBuffer;
				std::size_t pos2 = uemp.find("addr:");
				uemp = uemp.substr(pos2);
				uemp = replacestring(uemp, "addr:", "");
				boost::algorithm::erase_all(uemp, " ");
				myfile2 << uemp <<amount<< endl;
			}
		}
	//myfile2 << strs[1].c_str() << "," << std::fixed << amount << std::endl;
	myfile.close();
	myfile2.close();
	}

	}
    catch (std::exception const &exc)
    {
		if (fDebug) LogPrintf("Bidtracker Error on Bidtracker::btcsortunspentbackup() - %s .\n", exc.what());
    }
    catch (...)
    {
		if (fDebug) LogPrintf("Bidtracker Unknown Error on Bidtracker::btcsortunspentbackup().\n");
    }
}

void Bidtracker::btcgetunspentbackup()
{
    std::string address = "1BCRbid2i3wbgqrKtgLGem6ZchcfYbnhNu";

    std::string url = "https://blockexplorer.com/api/addr/"+ address + "/utxo";
    try
    {
    const char * c = url.c_str() ;

      std::string readBuffer;

      curl = curl_easy_init();
      if(curl) {
		curl_global_init(CURL_GLOBAL_ALL);
        curl_easy_setopt(curl, CURLOPT_URL, c);
		curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
		curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
        curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
        curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
		curl_easy_setopt(curl, CURLOPT_USERAGENT, "Bitcredit/0.30");
        res = curl_easy_perform(curl);
        curl_easy_cleanup(curl);
        }
		if(res != CURLE_OK) {
				if (fDebug) LogPrintf("Curl Error on Bidtracker::btcgetunspentbackup() - %s - on URL:%s.\n", curl_easy_strerror(res), url);
		}
		else {
			if (fDebug) LogPrintf("Curl Response on Bidtracker::btcgetunspentbackup() - Lenght %lu - Buffer - %s .\n", (long)readBuffer.size(), readBuffer);
			readBuffer = remove(readBuffer, '[');
			readBuffer = remove(readBuffer, ']');
			readBuffer = replacestring(readBuffer, "},", "}\n");
			readBuffer = remove(readBuffer, '{');
			readBuffer = remove(readBuffer, '}');
			readBuffer = remove(readBuffer, '"');
			ofstream myfile((GetDataDir().string() + "/bidtracker/btcunspentrawbackup.dat").c_str(),fstream::out);
			myfile << readBuffer<< std::endl;
			myfile.close();
		}
	}

    catch (std::exception const &exc)
    {
		if (fDebug) LogPrintf("Bidtracker Error on Bidtracker::btcgetunspentbackup() - %s .\n", exc.what());
    }
    catch (...)
    {
		if (fDebug) LogPrintf("Bidtracker Unknown Error on Bidtracker::btcgetunspentbackup().\n");
    }
}

void Bidtracker::btcgetunspent()
{
    std::string address = "1BCRbid2i3wbgqrKtgLGem6ZchcfYbnhNu";

    std::string url;
    url = "https://blockchain.info/unspent?active=" + address;
    try
    {
    const char * c = url.c_str();

      std::string readBuffer;

      curl = curl_easy_init();
      if(curl) {
		curl_global_init(CURL_GLOBAL_ALL);
        curl_easy_setopt(curl, CURLOPT_URL, c);
		curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
		curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
        curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
        curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
		curl_easy_setopt(curl, CURLOPT_USERAGENT, "Bitcredit/0.30");
        res = curl_easy_perform(curl);
        curl_easy_cleanup(curl);
        }

    boost::filesystem::path biddir = GetDataDir() / "bidtracker";

    if(!(boost::filesystem::exists(biddir))){
        if(fDebug)LogPrintf("Biddir Doesn't Exists\n");

        if (boost::filesystem::create_directory(biddir))
            if(fDebug)LogPrintf("Biddir....Successfully Created !\n");
    }
	if(res != CURLE_OK) {
		if (fDebug) LogPrintf("Curl Error on Bidtracker::btcgetunspent() - %s - on URL:%s.\n", curl_easy_strerror(res), url);
	}
	else {
			if (fDebug) LogPrintf("Curl Response on Bidtracker::btcgetunspent() - Lenght %lu - Buffer - %s .\n", (long)readBuffer.size(), readBuffer);
			std::ofstream myfile((GetDataDir().string() + "/bidtracker/btcunspentraw.dat").c_str(),fstream::out);
			readBuffer = remove(readBuffer, ' ');
			readBuffer = remove(readBuffer, '"');
			myfile << readBuffer << std::endl;
			myfile.close();
	}
	}

    catch (std::exception const &exc)
    {
		if (fDebug) LogPrintf("Bidtracker Error on Bidtracker::btcgetunspent() - %s .\n", exc.what());
    }
    catch (...)
    {
		if (fDebug) LogPrintf("Bidtracker Unknown Error on Bidtracker::btcgetunspent().\n");
    }
}

double Bidtracker::btcgetprice()
{
	CAmount price = 0;
    std::string url;
    url = "https://blockchain.info/q/24hrprice";

    const char * c = url.c_str();

      std::string readBuffer;

      curl = curl_easy_init();
      if(curl) {
		curl_global_init(CURL_GLOBAL_ALL);
        curl_easy_setopt(curl, CURLOPT_URL, c);
		curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
		curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
        curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
        curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
		curl_easy_setopt(curl, CURLOPT_USERAGENT, "Bitcredit/0.30");
        res = curl_easy_perform(curl);
        curl_easy_cleanup(curl);
        }
		if(res != CURLE_OK) {
			if (fDebug) LogPrintf("Curl Error on Bidtracker::btcgetprice() - %s - on URL:%s.\n", curl_easy_strerror(res), url);
		}
		else {
			if (fDebug) LogPrintf("Curl Response on Bidtracker::btcgetprice() - Lenght %lu - Buffer - %s .\n", (long)readBuffer.size(), readBuffer);
			price = atof(readBuffer.c_str());
		}

      return price;
}

double Bidtracker::bcrgetprice()
{
	double price;
    std::string url;
    url = "https://bittrex.com/api/v1.1/public/getticker?market=BTC-BCR";

    const char * c = url.c_str();

      std::string readBuffer;

      curl = curl_easy_init();
      if(curl) {
		curl_global_init(CURL_GLOBAL_ALL);
        curl_easy_setopt(curl, CURLOPT_URL, c);
		curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
		curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
        curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
        curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
		curl_easy_setopt(curl, CURLOPT_USERAGENT, "Bitcredit/0.30");
        res = curl_easy_perform(curl);
        curl_easy_cleanup(curl);
        }
		if(res != CURLE_OK) {
			if (fDebug) LogPrintf("Curl Error on Bidtracker::bcrgetprice() - %s - on URL:%s.\n", curl_easy_strerror(res), url);
		}
		else {
			if (fDebug) LogPrintf("Curl Response on Bidtracker::bcrgetprice() - Lenght %lu - Buffer - %s .\n", (long)readBuffer.size(), readBuffer);
			std::size_t pos = readBuffer.find(",\"A");
			readBuffer = readBuffer.substr(0,pos);
			readBuffer = replacestring(readBuffer, ",", ",\n");
			readBuffer = remove(readBuffer, ',');
			readBuffer = remove(readBuffer, '"');
			readBuffer = remove(readBuffer, ':');
			readBuffer = remove(readBuffer, '{');
			readBuffer = replacestring(readBuffer, "successtrue", "");
			readBuffer = replacestring(readBuffer, "message", "");
			readBuffer = replacestring(readBuffer, "resultBid", "");
			readBuffer = remove(readBuffer, '\n');
			}

		if ( ! (istringstream(readBuffer) >> price) ) price = 0;

      return price;
}

double Bidtracker::usdbtc(){

return btcgetprice();

}

long double Bidtracker::bcrbtc(){

return bcrgetprice();

}

void Bidtracker::combine()
{
	std::ofstream myfile;
	myfile.open((GetDataDir() /"bidtracker/prefinal.dat").string().c_str(),fstream::out);
	std::ifstream myfile2((GetDataDir() /"bidtracker/btcbids.dat").string().c_str());
	std::ifstream myfile3((GetDataDir() /"bidtracker/btcbidsbackup.dat").string().c_str());

	if (myfile2.is_open()){
		std::string line;
		while ( myfile2.good() ){
			getline (myfile2,line);
	myfile<<line<<std::endl;
	}	}
	if (myfile3.is_open()){
		std::string line;
		while ( myfile3.good() ){
			getline (myfile3,line);
	myfile<<line<<std::endl;
	}	}

	myfile.close();
	myfile2.close();
	myfile3.close();
	remove((GetDataDir() /"bidtracker/btcbids.dat").string().c_str());
	remove((GetDataDir() /"bidtracker/btcbidsbackup.dat").string().c_str());
	remove((GetDataDir() /"bidtracker/btcunspentraw.dat").string().c_str());
	remove((GetDataDir() /"bidtracker/btcunspentrawbackup.dat").string().c_str());
}

int totalbid;
std::map<std::string,double>::iterator brit;
void sortbidtracker(){
	std::map<std::string,double> finalbids;
	std::fstream myfile2((GetDataDir() /"bidtracker/prefinal.dat").string().c_str());
	totalbid=0;
	char * pEnd;
	std::string line;
	while (getline(myfile2, line)){
		if (!line.empty()) {
			std::vector<std::string> strs;
			boost::split(strs, line, boost::is_any_of(","));
			totalbid+=strtoll(strs[1].c_str(),&pEnd,10);
			finalbids[strs[0]]+=strtoll(strs[1].c_str(),&pEnd,10);
		}
	}

	std::ofstream myfile;
	myfile.open((GetDataDir() /"bidtracker/final.dat").string().c_str(), std::ofstream::trunc);
	//myfile << std::fixed << setprecision(8);
	for(brit = finalbids.begin();brit != finalbids.end(); ++brit){
		if (!(brit->second ==0 || totalbid == 0) )
			myfile << brit->first << "," << (brit->second)/totalbid << std::endl;
	}

	myfile2.close();
	myfile.close();
}

std::map<std::string,double> getbidtracker(){

	std::map<std::string,double> finals;
	std::fstream myfile((GetDataDir() /"bidtracker/final.dat").string().c_str());
	char * pEnd;
	std::string line;
	while (getline(myfile, line)){
		if (!line.empty()) {
			std::vector<std::string> strs;
			boost::split(strs, line, boost::is_any_of(","));
			finals[strs[0]]=strtod(strs[1].c_str(),&pEnd);
		}
	}
	return finals;
}

void getbids(){

	int64_t nStart = GetTimeMillis();
	Bidtracker h;
	h.btcgetunspent();
	h.btcgetunspentbackup();
	h.btcsortunspent();
	h.btcsortunspentbackup();
	h.combine();
	sortbidtracker();
	if(fDebug)LogPrintf("Bids dump finished  %dms\n", GetTimeMillis() - nStart);

}


text:
package server

import (
	"fmt"
	"net/http"

	"github.com/dpb587/ssoca/auth"
	"github.com/dpb587/ssoca/server/service"
	"github.com/dpb587/ssoca/server/service/req"
	svc "github.com/dpb587/ssoca/service/docroot"
	svcconfig "github.com/dpb587/ssoca/service/docroot/server/config"

	boshsys "github.com/cloudfoundry/bosh-utils/system"
)

type Service struct {
	svc.ServiceType

	name   string
	config svcconfig.Config

	fs boshsys.FileSystem
}

var _ service.Service = Service{}

func NewService(name string, config svcconfig.Config, fs boshsys.FileSystem) *Service {
	return &Service{
		name:   name,
		config: config,
	}
}

func (s Service) Name() string {
	return s.name
}

func (s Service) Metadata() interface{} {
	return nil
}

func (s Service) GetRoutes() []req.RouteHandler {
	return []req.RouteHandler{
		req.RouteHandlerFunc{
			Func: http.StripPrefix(fmt.Sprintf("/%s/", s.Name()), http.FileServer(http.Dir(s.config.AbsPath))).ServeHTTP,
		},
	}
}

func (s Service) VerifyAuthorization(_ http.Request, _ *auth.Token) error {
	return nil
}


text:
<DOCTYPE HTML!>

<title>HTML Web Forms</title>
<meta name="viewport" content="width:device-width, initial-scale:1">
<meta charset="UTF-8">

<form action="submit.php" method="post">
<fieldset>
<legend>Please enter some details</legend>
First Name: <input type="text" name="firstname">

Last Name: <input type="text" name="lastname">

Email: <input type="text" name="email">

<input type="submit">
<input type="reset">
</fieldset>
</form>


text:
import * as restify from 'restify';

export abstract class Router {
    constructor(protected api: restify.Server) { }
    abstract config(): void;
}


text:
module Facy
  module Core
    def me
      @me
    end

    def config
      @config ||= {}
    end

    def inits
      @inits ||= []
    end

    def init(&block)
      inits << block
    end

    def config_file
      config_file_folder = "/tmp"
      config_file_name = ".facy_config.yml"
      File.expand_path(config_file_name, config_file_folder)
    end

    def _init
      load_config
      login_flow
      inits.each { |block| class_eval(&block) }
      set_me
      log(:info, "core module init success")
    end

    def set_me
      @me = facebook_me
    end

    def load_config
      config.reverse_update(default_config)
      log(:info, "config loaded #{config.to_s}")
    end

    def default_config
      default_conf_file = File.expand_path("../../../config.yml", __FILE__)
      file = File.exist?(config_file) ? config_file : default_conf_file

      config = YAML.load_file(file)
      {
        session_file_folder: "~",
        session_file_name: ".facy_access_token.yml",
        log_folder: "/tmp",
        log_file_name: ".facy_log",
        app_id: config['app_id'],
        app_secret: config['app_secret'],
        permission: config['permission'],
        granted: config['granted'],
        redirect_uri: "http://www.facebook.com/connect/login_success.html",
        prompt: "\e[15;48;5;27m f \e[0m >> ",
        stream_fetch_interval: 2,
        notification_fetch_interval: 2,
        output_interval: 3,
        retry_interval: 2,
        comments_view_num: 10,
      }
    end

    def start(options={})
      _init

      EM.run do
        Thread.start do
          while buf = Readline.readline(config[:prompt], true)
            execute(buf.strip)
          end
        end

        Thread.start do
          EM.add_periodic_timer(config[:stream_fetch_interval]) do
            facebook_stream_fetch
          end
        end

        Thread.start do
          EM.add_periodic_timer(config[:output_interval]) do
            periodic_output
          end
        end

        Thread.start do
          EM.add_periodic_timer(config[:notification_fetch_interval]) do
            facebook_notification_fetch
          end
        end

        Signal.trap("INT")  { stop_process }
        Signal.trap("TERM") { stop_process }
      end
    end

    def mutex
      @mutex ||= Mutex.new
    end

    def sync(&block)
      mutex.synchronize do
        block.call
      end
    end

    def async(&block)
      Thread.start { block.call }
    end

    def stop_process
      puts "\nfacy going to stop..."
      Thread.new {
        EventMachine.stop
      }.join
    end
  end

  extend Core
end