text:
package com.cg.apps.ipaid.ocr;

import java.io.File;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import net.sourceforge.tess4j.ITesseract;
import net.sourceforge.tess4j.Tesseract;
import net.sourceforge.tess4j.TesseractException;

import com.cg.apps.ipaid.response.PurchaseRequest;

public class ImageExtractor {

	public String extractTextFromImage(File imageFile) {
		String result = null;
		ITesseract instance = new Tesseract();
        try {
            result = instance.doOCR(imageFile);
        } catch (TesseractException e) {
            System.err.println(e.getMessage());
        }
        return result;
	}

	public PurchaseRequest processExtractedText(String extractedText) {
		PurchaseRequest purchaseRequest = new PurchaseRequest();
		String[] lines = extractedText.split("\\r?\\n");
		List<String> list = new ArrayList<String>(Arrays.asList(lines));
		list.removeAll(Arrays.asList("",null));
		purchaseRequest.setStoreName(list.get(0));
		purchaseRequest.setLocation(list.get(2).replaceAll("[^A-Za-z]", " " ).trim());
		for(int i=0; i<list.size(); i++) {
			if(list.get(i).contains("Item Name")) {
				purchaseRequest.setProductName(list.get(i+1).replaceAll("[^A-Za-z]"," ").trim());
				break;
			}
		}
		for(String line : list) {
			if(line.contains("Date:")) {
				purchaseRequest.setPurchaseDate(line.substring(line.indexOf(":")+1,line.length()).trim());
			}else if (line.contains("Gross Amount")) {
				NumberFormat nf = NumberFormat.getInstance();
				String amt = line.substring(line.indexOf("Amount")+7,line.length());
				try {
					purchaseRequest.setProductCost(nf.parse(amt).doubleValue());
				} catch(Exception e) {
					e.printStackTrace();
				}
			} else if(line.contains("Bill")) {
				purchaseRequest.setInvoiceNo(line.substring(line.indexOf(":")+1,line.indexOf("Time")-1).trim());
			}
		}
		return purchaseRequest;
	}

//	public static void main(String[] args){
//		File file = new File("testImages/bill1.png");
//		System.out.println(processExtractedText(extractTextFromImage(file)));
//	}
}


text:
using Microsoft.Practices.ServiceLocation;

namespace WinAppDeploy.GUI.ViewModels
{
    public class ViewModelLocator
    {
        public SplashViewModel SplashViewModel => ServiceLocator.Current.GetInstance<SplashViewModel>();
        public MainViewModel MainViewModel => ServiceLocator.Current.GetInstance<MainViewModel>();
        public DeviceDetailsViewModel DeviceDetailsViewModel => ServiceLocator.Current.GetInstance<DeviceDetailsViewModel>();
    }
}

redpajama_set_name: RedPajamaGithub


text:
/*
 * block-monitor.cpp
 *
 *  Created on: 2015年3月26日
 *      Author: Administrator
 */

#include "block-monitor/block-monitor.h"
#include "serialize.h"
#include "util.h"
#include "base58.h"
#include "script.h"
#include "main.h"
#include "bitcoinrpc.h"

#include <sstream>

#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/foreach.hpp>
#include <boost/asio.hpp>
#include <boost/asio/ssl.hpp>
#include <boost/iostreams/concepts.hpp>
#include <boost/iostreams/stream.hpp>
#include <boost/asio/io_service.hpp>

#include "json/json_spirit_value.h"
#include "json/json_spirit_reader_template.h"
#include "json/json_spirit_writer_template.h"
#include "json/json_spirit_utils.h"

using namespace std;
using namespace boost;
using namespace json_spirit;
using namespace boost::asio;
using boost::lexical_cast;
using std::tr1::unordered_map;

static boost::asio::io_service ioService;
static boost::asio::io_service::work threadPool(ioService);

static void io_service_run(void)
{
	ioService.run();
}

BlockMonitor::BlockMonitor(size_t nCacheSize, bool fMemory, bool fWipe) :
	CLevelDB(GetDataDir() / "blocks" / "blockmon", nCacheSize, fMemory, fWipe),
	retryDelay(0), httpPool(BLOCKMON_HTTP_POOL), sem_post(0), sem_acked(0), sem_resend(0), is_stop(false)
{
	retryDelay = GetArg("-blockmon_retry_delay", BLOCKMON_RETRY_DELAY);
	httpPool = GetArg("-blockmon_http_pool", BLOCKMON_HTTP_POOL);
}

bool BlockMonitor::LoadBlocks()
{
	leveldb::Iterator *pcursor = NewIterator();

	CDataStream ssKeySet(SER_DISK, CLIENT_VERSION);
	ssKeySet << make_pair('B', make_pair(int64_t(0), uint256(0)));
	pcursor->Seek(ssKeySet.str());

	queue<pair<pair<int64_t, uint256>, pair<int, string> > > syncConnectQueue;
	queue<pair<pair<int64_t, uint256>, pair<int, string> > > syncDisconnectQueue;

	//Load addresses
	while(pcursor->Valid())
	{
		boost::this_thread::interruption_point();
		try
		{
			leveldb::Slice slKey = pcursor->key();
			CDataStream ssKey(slKey.data(), slKey.data()+slKey.size(), SER_DISK, CLIENT_VERSION);
			char chType;
			ssKey >> chType;
			if(chType == 'B')
			{
				leveldb::Slice slValue = pcursor->value();
				CDataStream ssValue(slValue.data(), slValue.data()+slValue.size(), SER_DISK, CLIENT_VERSION);

				int64_t timestamp;
				ssKey >> timestamp;

				uint256 uuid;
				ssKey >> uuid;

				int type;
				ssValue >> type;

				string json;
				ssValue >> json;

				if(type == SYNC_CONNECT)
				{
					syncConnectQueue.push(make_pair(make_pair(timestamp, uuid), make_pair(type, json)));
				}
				else if(type == SYNC_DISCONNECT)
				{
					syncDisconnectQueue.push(make_pair(make_pair(timestamp, uuid), make_pair(type, json)));
				}
				else
				{
					throw runtime_error("unknow type: "+lexical_cast<string>(type));
				}
			}
			else
			{
				break;
			}

			pcursor->Next();
		}
		catch(std::exception &e)
		{
			throw runtime_error(strprintf("%s : Deserialize or I/O error - %s", __func__, e.what()));
		}
	}
	delete pcursor;

	threadGroup.create_thread(boost::bind(&BlockMonitor::LoadSyncConnect, this, syncConnectQueue));
	threadGroup.create_thread(boost::bind(&BlockMonitor::LoadSyncDisconnect, this, syncDisconnectQueue));

	return true;
}

bool BlockMonitor::WriteBlock(const int64_t &timestamp, const uint256 &uuid, const int type, const std::string &json)
{
	return Write(std::make_pair('B', std::make_pair(timestamp, uuid)), std::make_pair(type, json), true);
}

bool BlockMonitor::DeleteBlock(const int64_t &timestamp, const uint256 &uuid)
{
	return Erase(std::make_pair('B', std::make_pair(timestamp, uuid)), true);
}

void BlockMonitor::Load()
{
	if(!LoadBlocks())
	{
		throw runtime_error("BlockMonitor LoadTransactions fail!");
	}

	for(int i = 0; i < httpPool; i++)
	{
		threadGroup.create_thread(boost::bind(&io_service_run));
	}

    threadGroup.create_thread(boost::bind(&BlockMonitor::PostThread, this));
    threadGroup.create_thread(boost::bind(&BlockMonitor::AckThread, this));
    threadGroup.create_thread(boost::bind(&BlockMonitor::ResendThread, this));
    threadGroup.create_thread(boost::bind(&BlockMonitor::NoResponseCheckThread, this));
}

static json_spirit::Object buildValue(const CBlock *pblock,
		const string &blockHash, const int nHeight, const int64_t &time, const int status)
{
	json_spirit::Object object;

	object.push_back(Pair("time", time));
	object.push_back(Pair("coinType", 2));
	if(pblock)
	{
		object.push_back(Pair("blockHeight", nHeight));
		object.push_back(Pair("blockHash", blockHash));
	}
	object.push_back(Pair("status", status));

	return object;
}

void BlockMonitor::SyncConnectBlock(const CBlock *pblock, CBlockIndex* pindex)
{
	json_spirit::Object ret;
	int64_t now = 0;

	{
		now = GetAdjustedTime();
		const string blockHash = pblock->GetHash().GetHex();
		const int nHeight = pindex->nHeight;
		const int status = 1;

		ret = buildValue(pblock, blockHash, nHeight, now, status);
	}

	uint256 uuid = NewRandomUUID();
	string requestId = "conn-" + NewRequestId(now, uuid);

	json_spirit::Object result;
	result.push_back(Pair("requestId", requestId));
	result.push_back(Pair("content", ret));
	string json = write_string(Value(result), false);

	if(!WriteBlock(now, uuid, SYNC_CONNECT, json))
	{
		//TODO
	}

	push_post(requestId, json);
}

void BlockMonitor::SyncDisconnectBlock(const CBlock *pblock)
{
	json_spirit::Object ret;
	int64_t now = 0;

	{
		now = GetAdjustedTime();
		string blockHash = pblock->GetHash().GetHex();
		int nHeight = -2;
		const int status = -2;

		ret = buildValue(pblock, blockHash, nHeight, now, status);
	}

	uint256 uuid = NewRandomUUID();
	string requestId = "dis-" + NewRequestId(now, uuid);

	json_spirit::Object result;
	result.push_back(Pair("requestId", requestId));
	result.push_back(Pair("content", ret));
	string json = write_string(Value(result), false);

	if(!WriteBlock(now, uuid, SYNC_DISCONNECT, json))
	{
		//TODO
	}

	push_post(requestId, json);
}

bool BlockMonitor::ack(const string &requestId)
{
	push_acked(requestId);
	return true;
}

const uint256 BlockMonitor::NewRandomUUID() const
{
	uint256 uuid;
	RandAddSeedPerfmon();

	RAND_bytes(uuid.begin(), uuid.end() - uuid.begin());
	return uuid;
}

const std::string BlockMonitor::NewRequestId(const int64_t &now, const uint256 &uuid) const
{
	CDataStream ssId(SER_DISK, CLIENT_VERSION);
	ssId << now;
	ssId << uuid;

	return EncodeBase58((const unsigned char*)&ssId[0], (const unsigned char*)&ssId[0] + (int)ssId.size());
}

bool BlockMonitor::decodeRequestIdWithoutPrefix(const std::string &requestIdWithoutPrefix, int64_t &now, uint256 &uuid)
{
	std::vector<unsigned char> vch;
	if(!DecodeBase58(requestIdWithoutPrefix, vch))
	{
		return false;
	}

	CDataStream ssId(vch, SER_DISK, CLIENT_VERSION);

	ssId >> now;
	ssId >> uuid;

	return true;
}

bool BlockMonitor::decodeRequestIdWitPrefix(const std::string &requestIdWithPrefix, int64_t &now, uint256 &uuid)
{
	if(requestIdWithPrefix.substr(0, 5) == "conn-")
	{
		return decodeRequestIdWithoutPrefix(requestIdWithPrefix.substr(5), now, uuid);
	}
	else if(requestIdWithPrefix.substr(0, 5) == "dis-")
	{
		return decodeRequestIdWithoutPrefix(requestIdWithPrefix.substr(4), now, uuid);
	}
	else
	{
		return false;
	}
}

const std::string BlockMonitor::NewRequestId() const
{
	const int64_t now = GetAdjustedTime();
	const uint256 uuid = NewRandomUUID();

	return NewRequestId(now, uuid);
}

void BlockMonitor::push_post(const std::string &requestId, const std::string &json)
{
	LOCK2(cs_map, cs_post);

	requestMap.insert(make_pair(requestId, json));
	postQueue.push(requestId);

	sem_post.post();
}

void BlockMonitor::push_acked(const std::string &requestId)
{
	LOCK(cs_acked);

	ackedQueue.push(requestId);

	sem_acked.post();
}

void BlockMonitor::push_resend(const std::string &requestId)
{
	LOCK(cs_resend);

	resendQueue.push(make_pair(requestId, GetAdjustedTime() + retryDelay));

	sem_resend.post();
}

bool BlockMonitor::pull_post(std::string &requestId, const std::string ** const ppjson)
{
	sem_post.wait();
	if(is_stop)
	{
		return false;
	}

	{
		LOCK2(cs_map, cs_post);

		requestId = postQueue.front();
		postQueue.pop();

		std::tr1::unordered_map<string, string>::const_iterator it = requestMap.find(requestId);
		if(it == requestMap.end())
		{
			throw runtime_error("pull_post can not find request in map: "+requestId);
		}

		*ppjson = &it->second;
	}

	{
		LOCK(cs_postMap);
		postMap.insert(make_pair(requestId, GetAdjustedTime() + retryDelay));
	}

	return true;
}

bool BlockMonitor::pull_acked(std::string &requestId, const std::string ** const ppjson)
{
	sem_acked.wait();
	if(is_stop)
	{
		return false;
	}

	LOCK2(cs_map, cs_acked);

	requestId = ackedQueue.front();
	ackedQueue.pop();

	std::tr1::unordered_map<string, std::string>::const_iterator it = requestMap.find(requestId);
	if(it == requestMap.end())
	{
		LogBlock("pull_acked can not find request in map: "+requestId+"\n");
		return false;
	}

	*ppjson = &it->second;

	return true;
}

bool BlockMonitor::pull_resend(std::string &requestId, const std::string ** const ppjson)
{
	if(!sem_resend.try_wait())
	{
		return false;
	}
	if(is_stop)
	{
		return false;
	}

	LOCK2(cs_map, cs_resend);

	const int64_t now = GetAdjustedTime();

	for(int i = 0; i < 100; i++)
	{
		pair<std::string, int64_t> requestAndTime = resendQueue.top();
		if(requestAndTime.second > now)
		{
			sem_resend.post();
			return false;
		}

		resendQueue.pop();

		requestId = requestAndTime.first;

		std::tr1::unordered_map<string, string>::const_iterator it = requestMap.find(requestId);
		if(it == requestMap.end())
		{
			if(resendQueue.empty())
			{
				return false;
			}
			else
			{
				continue;
			}
		}

		*ppjson = &it->second;

		resendQueue.push(make_pair(requestId, now + retryDelay));

		sem_resend.post();

		return true;
	}

	return false;
}

//
// IOStream device that speaks SSL but can also speak non-SSL
//
template <typename Protocol>
class SSLIOStreamDevice : public iostreams::device<iostreams::bidirectional> {
public:
    SSLIOStreamDevice(asio::ssl::stream<typename Protocol::socket> &streamIn, bool fUseSSLIn) : stream(streamIn)
    {
        fUseSSL = fUseSSLIn;
        fNeedHandshake = fUseSSLIn;
    }

    void handshake(ssl::stream_base::handshake_type role)
    {
        if (!fNeedHandshake) return;
        fNeedHandshake = false;
        stream.handshake(role);
    }
    std::streamsize read(char* s, std::streamsize n)
    {
        handshake(ssl::stream_base::server); // HTTPS servers read first
        if (fUseSSL) return stream.read_some(asio::buffer(s, n));
        return stream.next_layer().read_some(asio::buffer(s, n));
    }
    std::streamsize write(const char* s, std::streamsize n)
    {
        handshake(ssl::stream_base::client); // HTTPS clients write first
        if (fUseSSL) return asio::write(stream, asio::buffer(s, n));
        return asio::write(stream.next_layer(), asio::buffer(s, n));
    }
    bool connect(const std::string& server, const std::string& port)
    {
        ip::tcp::resolver resolver(stream.get_io_service());
        ip::tcp::resolver::query query(server.c_str(), port.c_str());
        ip::tcp::resolver::iterator endpoint_iterator = resolver.resolve(query);
        ip::tcp::resolver::iterator end;
        boost::system::error_code error = asio::error::host_not_found;
        while (error && endpoint_iterator != end)
        {
            stream.lowest_layer().close();
            stream.lowest_layer().connect(*endpoint_iterator++, error);
        }
        if (error)
            return false;
        return true;
    }

private:
    bool fNeedHandshake;
    bool fUseSSL;
    asio::ssl::stream<typename Protocol::socket>& stream;
};

static void CallRPC(BlockMonitor* self, const std::string &requestId, const string& body)
{
    const bool fUseSSL = false;
    asio::io_service io_service;
    ssl::context context(io_service, ssl::context::sslv23);
    context.set_options(ssl::context::no_sslv2);
    asio::ssl::stream<asio::ip::tcp::socket> sslStream(io_service, context);
    SSLIOStreamDevice<asio::ip::tcp> d(sslStream, fUseSSL);
    iostreams::stream< SSLIOStreamDevice<asio::ip::tcp> > stream(d);

    const bool fWait = false;
    const string host = GetArg("-blockmon_host", "127.0.0.1");
    const string port = GetArg("-blockmon_port", "80");
    const string url = GetArg("-blockmon_url", "");
    do {
        bool fConnected = d.connect(host, port);
        if (fConnected) break;
        if (fWait)
            MilliSleep(1000);
        else
        	LogBlock("couldn't connect to server\n");
    } while (fWait);

    // HTTP basic authentication
    map<string, string> mapRequestHeaders;

    string strPost = HTTPPost(body, mapRequestHeaders, host, url);
    stream << strPost << std::flush;

    // Receive HTTP reply status
    int nProto = 0;
    int nStatus = ReadHTTPStatus(stream, nProto);

    // Receive HTTP reply message headers and body
    map<string, string> mapHeaders;
    string strReply;
    ReadHTTPMessage(stream, mapHeaders, strReply, nProto);

    if (nStatus == HTTP_UNAUTHORIZED)
    	LogBlock("incorrect rpcuser or rpcpassword (authorization failed)\n");
    else if (nStatus >= 400 && nStatus != HTTP_BAD_REQUEST && nStatus != HTTP_NOT_FOUND && nStatus != HTTP_INTERNAL_SERVER_ERROR)
    	LogBlock("server returned HTTP error %d"+ boost::lexical_cast<string>(nStatus)+"\n");
    else if (strReply.empty())
    	LogBlock("no response from server\n");

    if(strReply.empty())
    {
    	LogBlock("empty reply -> requestId: "+requestId+"\n");
    }
    else if(strReply == "true")
    {
    	self->ack(requestId);
    	LogBlock("success reply -> requestId: "+requestId+"\n");
    }
    else
    {
    	LogBlock("wrong reply -> requestId: "+requestId+", reply: "+strReply+"\n");
    }

    // Parse reply
//    Value valReply;
//    if (!read_string(strReply, valReply))
//    	LogBlock("couldn't parse reply from server\n");
//    const Object& reply = valReply.get_obj();
//    if (reply.empty())
//    	LogBlock("expected reply to have result, error and id properties\n");
//
//    cout << "reply: " << strReply << endl;
//
//    return reply;
}

static void CallRPCWrappedException(BlockMonitor* self, const std::string &requestId, const string& body)
{
	try
	{
		CallRPC(self, requestId, body);
	}
	catch(const std::exception& e)
	{
		LogBlock("exception in CallRPC -> "+string(e.what())+"\n");
	}
	catch(...)
	{
		LogBlock("unknow exception in CallRPC\n");
	}
}

void BlockMonitor::PostThread()
{
    RenameThread("bitcoin-block-monitor-post");

    static bool fOneThread;
    if (fOneThread)
    {
        return;
    }
    fOneThread = true;

    MilliSleep(retryDelay * 1000);

	while(!is_stop)
	{
		string requestId;
		const string * pjson;

		if(!pull_post(requestId, &pjson))
		{
			MilliSleep(1000);
			continue;
		}

		try
		{
			do_post(requestId, pjson);
		}
		catch(std::exception &e)
		{
	    	LogException(&e, string("BlockMonitor::PostThread() -> "+string(e.what())).c_str());
	    	LogBlock("BlockMonitor::PostThread() -> "+string(e.what())+"\n");
		}
		catch(...)
		{
			LogBlock("BlockMonitor::PostThread() -> unknow exception\n");
		}
	}
}

void BlockMonitor::AckThread()
{
    RenameThread("bitcoin-block-monitor-ack");

    static bool fOneThread;
    if (fOneThread)
    {
        return;
    }
    fOneThread = true;

    MilliSleep(retryDelay * 1000);

	while(!is_stop)
	{
		string requestId;
		const string * pjson;
		string json;

		if(!pull_acked(requestId, &pjson))
		{
			MilliSleep(1000);
			continue;
		}
		json = *pjson;

		try
		{
			if(do_acked(requestId))
				LogBlock("do_acked success -> requestId: "+requestId+", json: "+json+"\n");
			else
				LogBlock("do_acked fail -> requestId: "+requestId+", json: "+json+"\n");
		}
		catch(std::exception &e)
		{
	    	LogException(&e, string("BlockMonitor::AckThread() -> "+string(e.what())).c_str());
	    	LogBlock("BlockMonitor::AckThread() -> "+string(e.what())+"\n");
		}
		catch(...)
		{
			LogBlock("BlockMonitor::AckThread() -> unknow exception\n");
		}
	}
}

void BlockMonitor::ResendThread()
{
    RenameThread("bitcoin-block-monitor-resend");

    static bool fOneThread;
    if (fOneThread)
    {
        return;
    }
    fOneThread = true;

    MilliSleep(retryDelay * 1000);

	while(!is_stop)
	{
		string requestId;
		const string * pjson;

		if(!pull_resend(requestId, &pjson))
		{
			MilliSleep(1000);
			continue;
		}

		try
		{
			do_resend(requestId, pjson);
		}
		catch(std::exception &e)
		{
	    	LogException(&e, string("BlockMonitor::ResendThread() -> "+string(e.what())).c_str());
	    	LogBlock("BlockMonitor::ResendThread() -> "+string(e.what())+"\n");
		}
		catch(...)
		{
			LogBlock("BlockMonitor::ResendThread() -> unknow exception\n");
		}
	}
}

void BlockMonitor::NoResponseCheckThread()
{
    RenameThread("bitcoin-block-monitor-NoResponseCheck");

    static bool fOneThread;
    if (fOneThread)
    {
        return;
    }
    fOneThread = true;

    MilliSleep(retryDelay * 1000);

	while(true)
	{
		try
		{
			NoResponseCheck();
		}
		catch(std::exception &e)
		{
	    	LogException(&e, string("BlockMonitor::NoResponseCheckThread() -> "+string(e.what())).c_str());
	    	LogBlock("BlockMonitor::NoResponseCheckThread() -> "+string(e.what())+"\n");
		}
		catch(...)
		{
			LogBlock("BlockMonitor::NoResponseCheckThread() -> unknow exception\n");
		}

		MilliSleep(retryDelay * 1000);
	}
}

bool BlockMonitor::do_post(const std::string &requestId, const std::string * pjson)
{
	LogBlock("do_post -> requestId: "+requestId+", json: "+*pjson+"\n");
	ioService.post(boost::bind(CallRPCWrappedException, this, requestId, *pjson));
	return true;
}

bool BlockMonitor::do_acked(const std::string &requestId)
{
	int64_t timestamp;
	uint256 uuid;
	if(!decodeRequestIdWitPrefix(requestId, timestamp, uuid))
	{
		return false;
	}

	{
		LOCK(cs_postMap);
		postMap.erase(requestId);
	}

	{
		LOCK(cs_map);
		requestMap.erase(requestId);
	}

	return DeleteBlock(timestamp, uuid);
}

bool BlockMonitor::do_resend(const std::string &requestId, const std::string * pjson)
{
	LogBlock("do_resend -> requestId: "+requestId+", json: "+*pjson+"\n");
	ioService.post(boost::bind(CallRPCWrappedException, this, requestId, *pjson));
	return true;
}

void BlockMonitor::NoResponseCheck()
{
	vector<string> timeoutRequestIds;

	{
		LOCK(cs_postMap);
		int64_t now = GetAdjustedTime();

		for(std::tr1::unordered_map<string, int64_t>::const_iterator it = postMap.begin(); it != postMap.end(); ++it)
		{
			if(it->second < now)
			{
				timeoutRequestIds.push_back(it->first);
			}
		}

		BOOST_FOREACH(const string &requestId, timeoutRequestIds)
		{
			postMap.erase(requestId);
		}
	}

	{
		LOCK(cs_resend);
		int64_t now = GetAdjustedTime();

		BOOST_FOREACH(const string &requestId, timeoutRequestIds)
		{
			resendQueue.push(make_pair(requestId, now));
			sem_resend.post();
		}
	}
}

void BlockMonitor::LoadSyncConnect(queue<pair<pair<int64_t, uint256>, pair<int, string> > > &syncConnectQueue)
{
    RenameThread("bitcoin-block-monitor-LoadSyncConnect");

    static bool fOneThread;
    if (fOneThread)
    {
        return;
    }
    fOneThread = true;

    MilliSleep(retryDelay * 1000);

	while(!syncConnectQueue.empty())
    {
		pair<pair<int64_t, uint256>, pair<int, string> > request = syncConnectQueue.front();
		syncConnectQueue.pop();
		const string &json = request.second.second;
		const int64_t &now = request.first.first;
		const uint256 &uuid = request.first.second;
		const string requestId = "conn-" + NewRequestId(now, uuid);

		push_post(requestId, json);
    }
}

void BlockMonitor::LoadSyncDisconnect(queue<pair<pair<int64_t, uint256>, pair<int, string> > > &syncDisconnectQueue)
{
    RenameThread("bitcoin-block-monitor-LoadSyncDisconnect");

    static bool fOneThread;
    if (fOneThread)
    {
        return;
    }
    fOneThread = true;

    MilliSleep(retryDelay * 1000);

	while(!syncDisconnectQueue.empty())
    {
		pair<pair<int64_t, uint256>, pair<int, string> > request = syncDisconnectQueue.front();
		syncDisconnectQueue.pop();
		const string &json = request.second.second;
		const int64_t &now = request.first.first;
		const uint256 &uuid = request.first.second;
		const string requestId = "dis-" + NewRequestId(now, uuid);

		push_post(requestId, json);
    }
}

void BlockMonitor::Stop()
{
	is_stop = true;
	sem_post.post();
	sem_acked.post();
	sem_resend.post();

	ioService.stop();
	threadGroup.interrupt_all();
	threadGroup.join_all();
}


text:
#ifndef _INPFUNC_H
#define _INPFUNC_H

//Retro_dead 15Jan2004 #define DIRECTINPUT_VERSION 0x0700
//Retro_dead 15Jan2004 #include <dinput.h>
#include <tchar.h>
#include "falclib/include/playerop.h"

#define STARTDAT_MOUSE_LEFT 0
#define STARTDAT_MOUSE_RIGHT 1

#define MAX_POV_DIR 8

typedef void (*InputFunctionType)(unsigned long, int state, void *);

typedef struct
{
    InputFunctionType func;   //this is the pointer to the appropriate function
    int   cpButtonID; //this is the ID of the associated cockpit button
} joyButton;

typedef struct
{
    InputFunctionType func[MAX_POV_DIR];   //this is the pointer to the appropriate function
    int  cpButtonID[MAX_POV_DIR]; //this is the ID of the associated cockpit button
} POVfunc;

struct FunctionPtrListEntry
{
    InputFunctionType theFunc;
    int buttonId;
    int mouseSide;
    int flags;
    long controlID;
    struct FunctionPtrListEntry* next;
};

class InputFunctionHashTable
{
public:

    // Retro 31Dec2003 - these values are also in sinput.h should not be defined in duplicate
    // FIXME
#define SIMLIB_MAX_DIGITAL 32
#define SIM_NUMDEVICES 16
#define SIMLIB_MAX_POV 4

    enum {NumHashEntries = 256 /*DIK_APPS +1*/,  NumButtons = SIMLIB_MAX_DIGITAL * SIM_NUMDEVICES, NumPOVs = SIMLIB_MAX_POV};

private:
    struct FunctionPtrListEntry* functionTable[NumHashEntries];
    joyButton  buttonTable[NumButtons];
    POVfunc  POVTable[NumPOVs];

public:
    InputFunctionHashTable(void);
    ~InputFunctionHashTable(void);
    void AddFunction(int key, int flags, int buttonId, int mouseSide, InputFunctionType funcPtr);
    void RemoveFunction(int key, int flags);
    void ClearTable(void);
    InputFunctionType GetFunction(int key, int flags, int* pbuttonId, int* pmouseSide);
    int GetButtonId(InputFunctionType funcPtr); //Wombat778 2-05-04
    long GetControl(int key, int flags);
    BOOL SetControl(int key, int flags, long control);
    BOOL SetButtonFunction(int buttonId, InputFunctionType theFunc, int cpButtonID);
    InputFunctionType GetButtonFunction(int buttonID, int* cpButtonID);
    BOOL SetPOVFunction(int POV, int dir, InputFunctionType theFunc, int cpButtonID);
    InputFunctionType GetPOVFunction(int POV, int dir, int* cpButtonID);

};

extern InputFunctionHashTable UserFunctionTable;

extern int CommandsKeyCombo;
extern int CommandsKeyComboMod;

void SetupInputFunctions(void);
void CleanupInputFunctions(void);
void CallInputFunction(unsigned long val, int state, void *);
void LoadFunctionTables(_TCHAR *fname = PlayerOptions.GetKeyfile());
InputFunctionType FindFunctionFromString(char* str);
char * FindStringFromFunction(InputFunctionType func);

#endif


text:
Ext.define('Notes.view.NotesController', {
	extend: 'Ext.app.ViewController',

	requires: [ 'Notes.view.NoteEditor' ],

	onItemDisclose: function(list, record) {
		this.showForm();

		this.lookupReference('form').setRecord(record);
	},

	onNew: function() {
		var newNote = Ext.create('Notes.model.Note', {
			dateCreated: new Date(),
			title: '',
			narrative: ''
		});
		this.lookupReference('form').setRecord(newNote);
		this.showForm();
	},

	showForm: function() {
		this.getView().getLayout().getAnimation().setReverse(false);
		this.getView().setActiveItem(1);
	},

	onHome: function() {
		this.getView().getLayout().getAnimation().setReverse(true);
		this.getView().setActiveItem(0);
	},

	onSave: function() {
		var form = this.lookupReference('form');
		var currentNote = form.getRecord();
		form.updateRecord(currentNote);

		var errors = currentNote.validate();

		if (!errors.isValid()) {
			Ext.Msg.alert('Wait!', errors.getByField('title')[0].getMessage(), Ext.emptyFn);
			currentNote.reject();
			return;
		}

		var notesStore = this.getStore('notes');

		if (currentNote.getId() <= -1) {
			notesStore.add(currentNote);
		}
		notesStore.sync();

		this.onHome();
	},

	onTrash: function() {
		var form = this.lookupReference('form');
		var currentNote = form.getRecord();
		var notesStore = this.getStore('notes');
		notesStore.remove(currentNote);
		notesStore.sync();
		this.onHome();
	}

});


text:
using System.Text;

namespace Excel.Core.BinaryFormat
{
	/// <summary>
	/// Represents a string value of formula
	/// </summary>
	internal class XlsBiffFormulaString : XlsBiffRecord
	{
		private Encoding m_UseEncoding = Encoding.Default;
		private const int LEADING_BYTES_COUNT = 3;

		internal XlsBiffFormulaString(byte[] bytes)
			: this(bytes, 0)
		{
		}

		internal XlsBiffFormulaString(byte[] bytes, uint offset)
			: base(bytes, offset)
		{
		}

		/// <summary>
		/// Encoding used to deal with strings
		/// </summary>
		public Encoding UseEncoding
		{
			get { return m_UseEncoding; }
			set { m_UseEncoding = value; }
		}

		/// <summary>
		/// Length of the string
		/// </summary>
		public ushort Length
		{
			get { return base.ReadUInt16(0x0); }
		}

		/// <summary>
		/// String text
		/// </summary>
		public string Value
		{
			get
			{
				//is unicode?
				if (base.ReadUInt16(0x01) != 0)
				{
					return Encoding.Unicode.GetString(m_bytes, m_readoffset + LEADING_BYTES_COUNT, Length * 2);
				}

				return m_UseEncoding.GetString(m_bytes, m_readoffset + LEADING_BYTES_COUNT, Length);
			}
		}
	}
}


text:
package edu.wustl.clinportal.uploadmetadata;

import java.io.FileInputStream;
import java.util.Collection;
import java.util.Iterator;

import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;

import edu.common.dynamicextensions.domain.DomainObjectFactory;
import edu.common.dynamicextensions.domaininterface.AttributeInterface;
import edu.common.dynamicextensions.domaininterface.EntityGroupInterface;
import edu.common.dynamicextensions.domaininterface.EntityInterface;
import edu.common.dynamicextensions.domaininterface.TaggedValueInterface;
import edu.common.dynamicextensions.entitymanager.EntityGroupManager;
import edu.common.dynamicextensions.entitymanager.EntityGroupManagerInterface;
import edu.common.dynamicextensions.entitymanager.EntityManager;
import edu.common.dynamicextensions.exception.DynamicExtensionsApplicationException;
import edu.common.dynamicextensions.exception.DynamicExtensionsSystemException;
import edu.wustl.clinportal.querysuite.metadata.AddAssociations;
import edu.wustl.common.util.global.ApplicationProperties;
import edu.wustl.common.util.logger.Logger;
import edu.wustl.common.util.logger.LoggerConfig;
import edu.wustl.dao.DAO;
import edu.wustl.dao.daofactory.DAOConfigFactory;
import edu.wustl.dao.daofactory.IDAOFactory;

/**
 * This class adds Tag Values for attributes and Paths
 * @author falguni_sachde
 */
public class UpdateMetadataTagPath
{

	static
	{
		LoggerConfig.configureLogger(System.getProperty("user.dir"));
	}
	//Logger
	private static final Logger LOGGER = Logger.getCommonLogger(UpdateMetadataTagPath.class);

	public static final String ELEMENT_ENTITY_GROUP = "entity-group";

	public static final String ELEMENT_ENTITY = "entity";

	public static final String ELEMENT_NAME = "name";

	public static final String ELEMENT_ATTRIBUTE = "attribute";

	public static final String ELEMENT_TAG = "tag";

	public static final String ELEMENT_TAG_NAME = "tag-name";

	public static final String ELEMENT_TAG_VALUE = "tag-value";

	public static final String TAGGED_VALUE_NOT_SEARCHABLE = "NOT_SEARCHABLE";

	public static final String TAGGED_VALUE_NOT_VIEWABLE = "NOT_VIEWABLE";

	public static final String TAGGED_VALUE_PRIMARY_KEY = "PRIMARY_KEY";

	public static final String TAGGED_VALUE_PV_FILTER = "PV_FILTER";

	/**
	 * Adds tag values for entities and attributes.
	 * @param args filename
	 */
	public static void main(String[] args)
	{
		try
		{
			LOGGER.info("UpdateMetadataTagPath start");
			if (args.length < 1)
			{
				throw new Exception(ApplicationProperties.getValue("filename.required"));
			}
			//This will add path between Participant and Evententry
			AddAssociations addAssociations = new AddAssociations();
			addAssociations.addCuratedPath("edu.wustl.clinportal.domain.Participant",
					"edu.wustl.clinportal.domain.EventEntry",
					"edu.wustl.clinportal.domain.ClinicalStudyRegistration");

			//This will add Tagged values to Participant Object
			String fileName = args[0];
			readTaggedValues(fileName);
			LOGGER.info("UpdateMetadataTagPath finishes");
		}
		catch (Exception e)
		{
			LOGGER.info("error in UpdateMetadataTagPath" + e.getMessage());
		}
	}

	/**
	 * This method reads tagged values from xml file.
	 * @param fileName name of xml file
	 * @throws DynamicExtensionsApplicationException if entity group does not exist
	 * @throws DynamicExtensionsSystemException from EntityGroupManager
	 */
	private static void readTaggedValues(String fileName)
			throws DynamicExtensionsApplicationException, DynamicExtensionsSystemException
	{
		SAXReader saxReader = new SAXReader();
		try
		{
			FileInputStream inputStream = new FileInputStream(fileName);
			Document document = saxReader.read(inputStream);
			Element rootElement = document.getRootElement();
			Iterator<Element> rootIterator = rootElement.elementIterator(ELEMENT_ENTITY_GROUP);
			//Element entityGrpEle = null;
			EntityGroupManagerInterface entityGroupManager = EntityGroupManager.getInstance();

			while (rootIterator.hasNext())
			{
				Element entityGrpEle = (Element) rootIterator.next();
				Element grpNameElement = entityGrpEle.element(ELEMENT_NAME);
				String entityGroupName = grpNameElement.getText();

				Long entitygroupId = EntityManager.getInstance().getEntityGroupId(entityGroupName);

				EntityGroupInterface entityGroup = entityGroupManager
						.getEntityGroupByName(entityGroupName);
				if (entityGroup == null)
				{
					LOGGER.info("entitygroup.doesNotExist" + entityGroupName);
				}
				else
				{
					readEntities(entityGrpEle, entitygroupId);
				}
			}
			LOGGER.info("=TAGGED VALUES ADDED SUCCESSFULLY!!!");
		}
		catch (Exception e)
		{
			LOGGER.info("=error in readTaggedValues !" + e.getMessage());
		}
	}

	/**
	 * Checks if tag is for NOT SEARCHABLE/NOT_VIEWABLE/PRIMARY KEY/PV_FILTER
	 * @param key
	 * @return
	 */
	private static boolean checkValidTag(String key)
	{
		return key.equals(TAGGED_VALUE_NOT_SEARCHABLE) || key.equals(TAGGED_VALUE_NOT_VIEWABLE)
				|| key.equals(TAGGED_VALUE_PRIMARY_KEY) || key.equals(TAGGED_VALUE_PV_FILTER);
	}

	/**
	 * This method reads entities present in the entity group, from the xml.
	 * @param entityGrpEle xml element for entity group
	 * @param entityGroup that contains the entities
	 * @throws DynamicExtensionsApplicationException if entity does not exist
	 * @throws DynamicExtensionsSystemException
	 */
	private static void readEntities(Element entityGrpEle, Long entityGroupId)
			throws DynamicExtensionsApplicationException, DynamicExtensionsSystemException
	{
		Element nameElement;
		Iterator elementIterator = entityGrpEle.elementIterator(ELEMENT_ENTITY);//entity element

		while (elementIterator.hasNext())
		{
			Element entityElement = (Element) elementIterator.next();
			nameElement = entityElement.element(ELEMENT_NAME);
			String entityName = nameElement.getText();

			EntityInterface entity = EntityManager.getInstance().getEntityByIdentifier(
					EntityManager.getInstance().getEntityId(entityName, entityGroupId));

			if (entity == null)
			{
				throw new DynamicExtensionsApplicationException(ApplicationProperties.getValue(
						"entity.doesNotExist", entityName));//String errMsg
			}
			readAttributes(entity, entityElement);
			tagValueForEntity(entity, entityElement);
			saveEntity(entity);
		}
	}

	/**
	 * @param entity
	 * @throws DynamicExtensionsSystemException
	 * @throws DynamicExtensionsApplicationException
	 */
	private static void saveEntity(EntityInterface entity) throws DynamicExtensionsSystemException,
			DynamicExtensionsApplicationException
	{
		IDAOFactory daoFactory = DAOConfigFactory.getInstance().getDAOFactory("dynamicExtention");
		DAO dao = null;
		try
		{
			dao = daoFactory.getDAO();
			dao.openSession(null);
			dao.update(entity);
			dao.commit();
			dao.closeSession();
		}
		catch (Exception ex)
		{
			throw new DynamicExtensionsApplicationException("error in saving object!!!!", ex);
		}
	}

	/**
	 * This method reads attributes of an entity.
	 * @param entity that contains the attributes.
	 * @param entityElement xml element for entity.
	 * @throws DynamicExtensionsApplicationException if attribute does not exist.
	 */
	private static void readAttributes(EntityInterface entity, Element entityElement)
			throws DynamicExtensionsApplicationException

	{
		Iterator<Element> attrItr = entityElement.elementIterator(ELEMENT_ATTRIBUTE);
		while (attrItr.hasNext())
		{
			Element attrElement = attrItr.next();
			Element attributeName = attrElement.element(ELEMENT_NAME);
			Iterator<Element> tagItr = attrElement.elementIterator(ELEMENT_TAG);
			String attrName = attributeName.getText();
			while (tagItr.hasNext())
			{
				AttributeInterface attribute = entity.getAttributeByName(attrName);
				LOGGER.info("==" + attrName);
				if (attribute == null)
				{
					throw new DynamicExtensionsApplicationException(ApplicationProperties.getValue(
							"attribute.doesNotExist", attrName));
				}
				Element tag = (Element) tagItr.next();
				String tagName = tag.element(ELEMENT_TAG_NAME).getText();
				String tagValue = tag.element(ELEMENT_TAG_VALUE).getText();
				checkValidTag(tagName);
				TaggedValueInterface taggedValue = getTagValue(attribute, tagName, tagValue);
				if (taggedValue != null)
				{
					attribute.addTaggedValue(taggedValue);
				}
			}
		}
	}

	/**
	 * Method creates a Tag Value object.
	 * @param tagName name of tag
	 * @param tagValue tag value.
	 * @return TaggedValueInterface
	 */
	private static TaggedValueInterface getTagValue(AttributeInterface attribute, String tagName,
			String tagValue)
	{
		TaggedValueInterface rettaggedValue = null;
		if (!attribute.getTaggedValueCollection().isEmpty())
		{
			Collection<TaggedValueInterface> taggedValues = attribute.getTaggedValueCollection();
			for (TaggedValueInterface taggedValue : taggedValues)
			{
				if (taggedValue.getKey().equalsIgnoreCase(tagName)
						&& taggedValue.getValue().equalsIgnoreCase(tagValue))
				{
					rettaggedValue = null;
					break;
				}
			}

		}
		else
		{
			rettaggedValue = DomainObjectFactory.getInstance().createTaggedValue();
			rettaggedValue.setKey(tagName);
			rettaggedValue.setValue(tagValue);

		}
		return rettaggedValue;

	}

	/**
	 * @param entity
	 * @param entityElement
	 */
	private static void tagValueForEntity(EntityInterface entity, Element entityElement)
	{

		Iterator<Element> entityTagItr = entityElement.elementIterator(ELEMENT_TAG);
		while (entityTagItr.hasNext())
		{

			Element entityTag = (Element) entityTagItr.next();
			if (entityTag != null)
			{
				String entityTagName = entityTag.element(ELEMENT_TAG_NAME).getText();
				String entityTagValue = entityTag.element(ELEMENT_TAG_VALUE).getText();
				LOGGER.info(entityTagName + "===" + entityTagValue);
				TaggedValueInterface taggedValue = createTagValue(entityTagName, entityTagValue);
				entity.addTaggedValue(taggedValue);
			}
		}
	}

	/**
	 * @param tagName
	 * @param tagValue
	 * @return
	 */
	private static TaggedValueInterface createTagValue(String tagName, String tagValue)
	{
		TaggedValueInterface taggedValue = DomainObjectFactory.getInstance().createTaggedValue();
		taggedValue.setKey(tagName);
		taggedValue.setValue(tagValue);
		return taggedValue;
	}
}


text:
package de.knightsoftnet.validators.shared.beans;

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

import javax.validation.Valid;
import javax.validation.constraints.NotNull;

/**
 * Extends Foo.
 */
public class FooFoo extends Foo {

  @NotNull
  @Valid
  private BarBar barBar;
  @Valid
  private final List<BarBar> barBarList = new ArrayList<>();

  public List<BarBar> getBarBarList() {
    return this.barBarList;
  }

  public BarBar getBarBar() {
    return this.barBar;
  }

  public void setBarBar(final BarBar barBar) {
    this.barBar = barBar;
  }

  @Override
  public String toString() {
    final StringBuilder buildy = new StringBuilder();

    buildy.append(" FooFoo: % ").append(this.barBar);
    for (final BarBar b : this.barBarList) {
      buildy.append(" # ").append(b);
    }
    return super.toString() + " " + buildy.toString();
  }
}


text:
import sys
import getopt
import arxiv_import as ai
import config
from optparse import OptionParser

def main(argv=None):
  if argv is None:
        argv = sys.argv

  parser = OptionParser()
  parser.add_option("-f", "--file", dest="filename",
                    help="write report to FILE", metavar="FILE")
  parser.add_option("-q", "--quiet",
                    action="store_false", dest="verbose", default=True,
                    help="don't print status messages to stdout")

  (options, args) = parser.parse_args()

if __name__ == "__main__":
    main()


text:
import path from 'path'
import {
  cmsData,
  config,
  Page,
  cmsTemplates,
  coreUtils
} from '../../cli'

var page = function (req, res) {
  var html = (req.query.html) ? true : false
  var json = null
  var editor = false
  if(typeof req.body.json !== 'undefined' && req.body.json !== null) {
    editor = true
    if(typeof req.body.json === 'string') {
      json = JSON.parse(req.body.json)
    }else {
      json = req.body.json
    }
  }

  var filepath = req.originalUrl.replace('/abe/page', '')

  if(typeof filepath !== 'undefined' && filepath !== null) {
    var jsonPath = null
    var linkPath = null

    var filePathTest = cmsData.revision.getDocumentRevision(filepath)
    if(typeof filePathTest !== 'undefined' && filePathTest !== null) {
      jsonPath = filePathTest.path
      linkPath = filePathTest.abe_meta.link
    }

    if(jsonPath === null || !coreUtils.file.exist(jsonPath)) {
      res.status(404).send('Not found')
      return
    }

    if(typeof json === 'undefined' || json === null) {
      json = cmsData.file.get(jsonPath)
    }

    let meta = config.meta.name

    var templateId = ''
    if(json[meta] && json[meta].template) {
      templateId = json[meta].template
    }else {
      templateId = req.params[0]
    }
    var text = cmsTemplates.template.getTemplate(templateId, json)

    if (!editor) {

      cmsData.source.getDataList(path.dirname(linkPath), text, json)
        .then(() => {
          var page = new Page(templateId, text, json, html)
          res.set('Content-Type', 'text/html')
          res.send(page.html)
        }).catch(function(e) {
          console.error(e)
        })
    }else {
      text = cmsData.source.removeDataList(text)
      var page = new Page(templateId, text, json, html)
      res.set('Content-Type', 'text/html')
      res.send(page.html)
    }
  }else {
    // not 404 page if tag abe image upload into each block
    if(/upload%20image/g.test(req.url)) {
      var b64str = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=='
      var img = new Buffer(b64str, 'base64')

      res.writeHead(200, {
        'Content-Type': 'image/jpeg',
        'Content-Length': img.length
      })
      res.end(img)
    }else {
      res.status(404).send('Not found')
    }
  }
}

export default page


text:
package de.kaiserpfalzedv.commons.webui.components;

import java.io.Serializable;
import java.util.UUID;

import javax.annotation.PostConstruct;
import javax.enterprise.inject.Default;
import javax.enterprise.inject.Produces;

import com.google.common.eventbus.EventBus;
import com.vaadin.cdi.ViewScoped;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author klenkes {@literal <rlichti@kaiserpfalz-edv.de>}
 * @version 1.0.0
 * @since 2016-07-02
 */
@ViewScoped
public class ViewConfiguration implements Serializable {
    private static final Logger LOG = LoggerFactory.getLogger(ApplicationConfiguration.class);

    @Produces
    @Default
    private final UUID ui = UUID.randomUUID();

    @Produces
    @ViewScoped
    private EventBus bus = new EventBus("kpo-view-" + ui.toString());

    @PostConstruct
    public void init() {
        LOG.info("Created {}: ui={}, bus={}", getClass().getSimpleName(), ui, bus);
    }
}


text:
<configuration>
  <include resource="org/springframework/boot/logging/logback/base.xml"/>
  <jmxConfigurator/>
</configuration>


text:
NS_ASSUME_NONNULL_BEGIN

#if UIKIT_STRING_ENUMS
typedef NSString * OKShareType NS_EXTENSIBLE_STRING_ENUM;
#else
typedef NSString * OKShareType;
#endif

UIKIT_EXTERN OKShareType const OKShareTypePostToFacebook;
UIKIT_EXTERN OKShareType const OKShareTypePostToTwitter;
UIKIT_EXTERN OKShareType const OKShareTypePostToWeibo;
UIKIT_EXTERN OKShareType const OKShareTypeMessage;
UIKIT_EXTERN OKShareType const OKShareTypeMail;
UIKIT_EXTERN OKShareType const OKShareTypePrint;
UIKIT_EXTERN OKShareType const OKShareTypeCopyToPasteboard;
UIKIT_EXTERN OKShareType const OKShareTypeAssignToContact;
UIKIT_EXTERN OKShareType const OKShareTypeSaveToCameraRoll;
UIKIT_EXTERN OKShareType const OKShareTypeAddToReadingList;
UIKIT_EXTERN OKShareType const OKShareTypePostToFlickr;
UIKIT_EXTERN OKShareType const OKShareTypePostToVimeo;
UIKIT_EXTERN OKShareType const OKShareTypePostToTencentWeibo;
UIKIT_EXTERN OKShareType const OKShareTypeAirDrop;
UIKIT_EXTERN OKShareType const OKShareTypeOpenInIBooks;

@interface OKShareItem : NSObject

@property (nonatomic, copy) NSString *itemTitle;
@property (nonatomic, strong) UIImage *itemImage;
@property (nonatomic, copy) OKShareType shareType;

@end

NS_ASSUME_NONNULL_END


text:
source_file "$ALOJA_REPO_PATH/shell/common/common_hadoop.sh"
set_hadoop_requires

get_hadoop_config_folder() {
  local config_folder_name

  if [ "$HADOOP_CUSTOM_CONFIG" ] ; then
    config_folder_name="$HADOOP_CUSTOM_CONFIG"
  elif [ "$HADOOP_EXTRA_JARS" == "AOP4Hadoop" ] ; then
    config_folder_name="hadoop1_AOP_conf_template"
  elif [ "$(get_hadoop_major_version)" == "2" ]; then
    config_folder_name="hadoop2_conf_template"
  else
    config_folder_name="hadoop1_conf_template"
  fi

  echo -e "$config_folder_name"
}

# Sets the required files to download/copy
set_hive_requires() {
  if [ "$(get_hadoop_major_version)" == "2" ]; then
    BENCH_REQUIRED_FILES["$HADOOP_VERSION"]="http://archive.apache.org/dist/hadoop/core/$HADOOP_VERSION/$HADOOP_VERSION.tar.gz"
  else
    BENCH_REQUIRED_FILES["$HADOOP_VERSION"]="http://archive.apache.org/dist/hadoop/core/$HADOOP_VERSION/$HADOOP_VERSION-bin.tar.gz"
  fi
}

# Helper to print a line with Hadoop requiered exports
get_hive_exports() {
  local to_export

  to_export="$(get_java_exports)
$(get_hadoop_exports)
export HIVE_VERSION='apache-hive-1.2.0-bin';
export HIVE_B_DIR='$TPCH_B_DIR';
export HIVE_HOME='${TPCH_B_DIR}/${HIVE_VERSION}';"

  echo -e "$to_export\n"
}

# Returns the the path to the hadoop binary with the proper exports
# $1 query path
# $2 table name
get_hive_cmd() {
  local hive_exports
  local hive_cmd

  if [ "$EXECUTE_HIBENCH" ] ; then
    hive_exports="$(get_hive_exports)
export TPCH_B_DIR='${HDD}/aplic';
export TPCH_SOURCE_DIR='${BENCH_SOURCE_DIR}/tpch-hive';
export TPCH_HOME='$TPCH_SOURCE_DIR';
cd ${TPCH_HOME};
"
  else
    hive_exports="$(get_hive_exports)"
  fi

  EXP=$(get_hive_env)

  SETTINGS="${PREFIX}/${TPCH_SETTINGS_FILE_NAME}"
  COMMAND="hive -i $SETTINGS -f ${PREFIX}/tpch_${1}.sql --database ${TABLE_NAME}"

  hive_cmd="$hive_exports hive -i $SETTINGS"

  echo -e "$hive_cmd"
}

# Performs the actual benchmark execution
# $1 benchmark name
# $2 command
# $3 if to time exec
execute_hive(){
  local bench="$1"
  local cmd="$2"
  local time_exec="$3"

  local hadoop_cmd="$(get_hadoop_cmd) $cmd"

  logger "DEBUG: Hadoop command:$hadoop_cmd"

  if [ "$time_exec" ] ; then
    save_disk_usage "BEFORE"
    restart_monit
    set_bench_start "$bench"
  fi

  # Run the command and time it
  time_cmd_master "$hadoop_cmd" "$time_exec"

  if [ "$time_exec" ] ; then
    set_bench_end "$bench"
    stop_monit
    save_disk_usage "AFTER"
    save_hadoop "$bench"
  fi
}


text:
require 'spec_helper'
require 'sneakers'
require 'logger'

class Foobar
  include Sneakers::Concerns::Logging
end

describe Sneakers::Concerns::Logging do
  describe ".configure" do
    before do
      Foobar.logger = nil
    end

    it "should configure a default logger when included" do
      Foobar.logger.must_be_nil
      Foobar.configure_logger
      Foobar.logger.wont_be_nil
      Foobar.logger.formatter.must_equal Sneakers::Concerns::Logging::ProductionFormatter
    end

    it "should supply accessible instance logger" do
      Foobar.logger.must_be_nil
      Foobar.configure_logger
      f = Foobar.new
      f.logger.must_equal Foobar.logger
      f.logger.wont_be_nil
    end

    it "should configure a given logger when specified" do
      Foobar.logger.must_be_nil
      log = Logger.new(STDOUT)
      Foobar.configure_logger(log)
      Foobar.logger.must_equal log
    end
  end
end


text:
package com.github.ferstl.jarscan;

import org.adoptopenjdk.jitwatch.jarscan.IJarScanOperation;
import org.adoptopenjdk.jitwatch.jarscan.methodsizehisto.MethodSizeHistoOperation;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.ResolutionScope;

/**
 * List frequencies of method bytecode sizes.
 *
 * @since 1.1
 */
@Mojo(
    name = "methodSizeHisto",
    aggregator = false,
    defaultPhase = LifecyclePhase.VERIFY,
    requiresDependencyCollection = ResolutionScope.TEST,
    requiresDependencyResolution = ResolutionScope.TEST,
    requiresDirectInvocation = false,
    threadSafe = true)
public class MethodSizeHistoMojo extends AbstractJarScanMojo {

  @Override
  protected IJarScanOperation createOperation() {
    return new MethodSizeHistoOperation();
  }

}


text:
namespace lug {
namespace Graphics {
namespace Render {

Mesh::Mesh(const std::string& name) : Resource(Resource::Type::Mesh, name) {}

Mesh::~Mesh() {
    for (auto& primitiveSet : _primitiveSets) {
        for (auto& attribute : primitiveSet.attributes) {
            delete[] attribute.buffer.data;
            attribute.buffer.data = nullptr;
        }
    }
}

} // Render
} // Graphics
} // lug


text:
module Gemsupport
  module Console
    def self.included(base)
      base.extend(ClassMethods)
    end

    module ClassMethods
      def capture_console
        old_stdout = $stdout
        old_stderr = $stderr
        $stdout = $stderr = StringIO.new('', 'w')
        yield
        $stdout.string
      ensure
        $stdout = old_stdout
        $stderr = old_stderr
      end
    end
  end
end


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.trino.operator.aggregation.listagg;

import io.trino.spi.function.AccumulatorStateFactory;

public class ListaggAggregationStateFactory
        implements AccumulatorStateFactory<ListaggAggregationState>
{
    @Override
    public ListaggAggregationState createSingleState()
    {
        return new SingleListaggAggregationState();
    }

    @Override
    public ListaggAggregationState createGroupedState()
    {
        return new GroupListaggAggregationState();
    }
}


text:
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Transdirect.Models;
namespace Transdirect
{
    public interface ITransdirectService
    {
        Task<IEnumerable<Courier>> GetCouriers(bool forceReload = false);
        Task<Quote> GetQuote(Quote quote);
        Task<Booking> CreateBooking(Booking booking);
        Task<IEnumerable<Booking>> GetBookings(DateTime? since = null, string sort = null);
        Task<Booking> GetSingleBooking(int bookingId);
        Task<Booking> UpdateBooking(int bookingId, Booking booking);
        Task DeleteBooking(int bookingId);
        Task ConfirmBooking(int bookingId, BookingConfirmation confirmation);
        Task<string> TrackBooking(int bookingId);
        Task<IEnumerable<Item>> GetBookingItems(int bookingId);
        Task<IEnumerable<Item>> AddItemToBooking(int bookingId, Item item);
        Task<Item> GetBookingSingleItem(int bookingId, int itemId);
        Task<Item> UpdateBookingItem(int bookingId, int itemId, Item item);
        Task RemoveBookingItem(int bookingId, int itemId);
        Task<Member> GetMember();
    }
}


text:
namespace Microsoft.DocAsCode.MarkdigEngine.Extensions
{
    using System.Collections.Immutable;

    using Markdig.Syntax;

    public class TabGroupBlock : ContainerBlock
    {
        public string Id { get; set; }

        public int ActiveTabIndex { get; set; }

        public ImmutableArray<TabItemBlock> Items { get; set; }

        public TabGroupBlock(string id, ImmutableArray<TabItemBlock> blocks, int startLine, int startSpan, int activeTabIndex) : base(null)
        {
            Id = id;
            ActiveTabIndex = activeTabIndex;
            Items = blocks;
            Line = startLine;

            foreach (var item in blocks)
            {
                Add(item.Title);
                Add(item.Content);
            }

            var length = blocks.Length;
            Span = new SourceSpan(startSpan, blocks[length-1].Content.Span.End);
        }
    }
}


text:
package advisor

// Copyright (c) Microsoft and contributors.  All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

import (
	"encoding/json"
	"github.com/Azure/go-autorest/autorest"
	"github.com/Azure/go-autorest/autorest/date"
	"github.com/Azure/go-autorest/autorest/to"
	"github.com/satori/go.uuid"
	"net/http"
)

// Category enumerates the values for category.
type Category string

const (
	// Cost ...
	Cost Category = "Cost"
	// HighAvailability ...
	HighAvailability Category = "HighAvailability"
	// Performance ...
	Performance Category = "Performance"
	// Security ...
	Security Category = "Security"
)

// PossibleCategoryValues returns an array of possible values for the Category const type.
func PossibleCategoryValues() []Category {
	return []Category{Cost, HighAvailability, Performance, Security}
}

// Impact enumerates the values for impact.
type Impact string

const (
	// High ...
	High Impact = "High"
	// Low ...
	Low Impact = "Low"
	// Medium ...
	Medium Impact = "Medium"
)

// PossibleImpactValues returns an array of possible values for the Impact const type.
func PossibleImpactValues() []Impact {
	return []Impact{High, Low, Medium}
}

// Risk enumerates the values for risk.
type Risk string

const (
	// Error ...
	Error Risk = "Error"
	// None ...
	None Risk = "None"
	// Warning ...
	Warning Risk = "Warning"
)

// PossibleRiskValues returns an array of possible values for the Risk const type.
func PossibleRiskValues() []Risk {
	return []Risk{Error, None, Warning}
}

// ListSuppressionContract ...
type ListSuppressionContract struct {
	autorest.Response `json:"-"`
	Value             *[]SuppressionContract `json:"value,omitempty"`
}

// OperationDisplayInfo the operation supported by Advisor.
type OperationDisplayInfo struct {
	// Description - The description of the operation.
	Description *string `json:"description,omitempty"`
	// Operation - The action that users can perform, based on their permission level.
	Operation *string `json:"operation,omitempty"`
	// Provider - Service provider: Microsoft Advisor.
	Provider *string `json:"provider,omitempty"`
	// Resource - Resource on which the operation is performed.
	Resource *string `json:"resource,omitempty"`
}

// OperationEntity the operation supported by Advisor.
type OperationEntity struct {
	// Name - Operation name: {provider}/{resource}/{operation}.
	Name *string `json:"name,omitempty"`
	// Display - The operation supported by Advisor.
	Display *OperationDisplayInfo `json:"display,omitempty"`
}

// OperationEntityListResult the list of Advisor operations.
type OperationEntityListResult struct {
	autorest.Response `json:"-"`
	// NextLink - The link used to get the next page of operations.
	NextLink *string `json:"nextLink,omitempty"`
	// Value - The list of operations.
	Value *[]OperationEntity `json:"value,omitempty"`
}

// OperationEntityListResultIterator provides access to a complete listing of OperationEntity values.
type OperationEntityListResultIterator struct {
	i    int
	page OperationEntityListResultPage
}

// Next advances to the next value.  If there was an error making
// the request the iterator does not advance and the error is returned.
func (iter *OperationEntityListResultIterator) Next() error {
	iter.i++
	if iter.i < len(iter.page.Values()) {
		return nil
	}
	err := iter.page.Next()
	if err != nil {
		iter.i--
		return err
	}
	iter.i = 0
	return nil
}

// NotDone returns true if the enumeration should be started or is not yet complete.
func (iter OperationEntityListResultIterator) NotDone() bool {
	return iter.page.NotDone() && iter.i < len(iter.page.Values())
}

// Response returns the raw server response from the last page request.
func (iter OperationEntityListResultIterator) Response() OperationEntityListResult {
	return iter.page.Response()
}

// Value returns the current value or a zero-initialized value if the
// iterator has advanced beyond the end of the collection.
func (iter OperationEntityListResultIterator) Value() OperationEntity {
	if !iter.page.NotDone() {
		return OperationEntity{}
	}
	return iter.page.Values()[iter.i]
}

// IsEmpty returns true if the ListResult contains no values.
func (oelr OperationEntityListResult) IsEmpty() bool {
	return oelr.Value == nil || len(*oelr.Value) == 0
}

// operationEntityListResultPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (oelr OperationEntityListResult) operationEntityListResultPreparer() (*http.Request, error) {
	if oelr.NextLink == nil || len(to.String(oelr.NextLink)) < 1 {
		return nil, nil
	}
	return autorest.Prepare(&http.Request{},
		autorest.AsJSON(),
		autorest.AsGet(),
		autorest.WithBaseURL(to.String(oelr.NextLink)))
}

// OperationEntityListResultPage contains a page of OperationEntity values.
type OperationEntityListResultPage struct {
	fn   func(OperationEntityListResult) (OperationEntityListResult, error)
	oelr OperationEntityListResult
}

// Next advances to the next page of values.  If there was an error making
// the request the page does not advance and the error is returned.
func (page *OperationEntityListResultPage) Next() error {
	next, err := page.fn(page.oelr)
	if err != nil {
		return err
	}
	page.oelr = next
	return nil
}

// NotDone returns true if the page enumeration should be started or is not yet complete.
func (page OperationEntityListResultPage) NotDone() bool {
	return !page.oelr.IsEmpty()
}

// Response returns the raw server response from the last page request.
func (page OperationEntityListResultPage) Response() OperationEntityListResult {
	return page.oelr
}

// Values returns the slice of values for the current page or nil if there are no values.
func (page OperationEntityListResultPage) Values() []OperationEntity {
	if page.oelr.IsEmpty() {
		return nil
	}
	return *page.oelr.Value
}

// RecommendationProperties the properties of the recommendation.
type RecommendationProperties struct {
	// Category - The category of the recommendation. Possible values include: 'HighAvailability', 'Security', 'Performance', 'Cost'
	Category Category `json:"category,omitempty"`
	// Impact - The business impact of the recommendation. Possible values include: 'High', 'Medium', 'Low'
	Impact Impact `json:"impact,omitempty"`
	// ImpactedField - The resource type identified by Advisor.
	ImpactedField *string `json:"impactedField,omitempty"`
	// ImpactedValue - The resource identified by Advisor.
	ImpactedValue *string `json:"impactedValue,omitempty"`
	// LastUpdated - The most recent time that Advisor checked the validity of the recommendation.
	LastUpdated *date.Time `json:"lastUpdated,omitempty"`
	// Metadata - The recommendation metadata.
	Metadata map[string]interface{} `json:"metadata"`
	// RecommendationTypeID - The recommendation-type GUID.
	RecommendationTypeID *string `json:"recommendationTypeId,omitempty"`
	// Risk - The potential risk of not implementing the recommendation. Possible values include: 'Error', 'Warning', 'None'
	Risk Risk `json:"risk,omitempty"`
	// ShortDescription - A summary of the recommendation.
	ShortDescription *ShortDescription `json:"shortDescription,omitempty"`
}

// MarshalJSON is the custom marshaler for RecommendationProperties.
func (rp RecommendationProperties) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]interface{})
	if rp.Category != "" {
		objectMap["category"] = rp.Category
	}
	if rp.Impact != "" {
		objectMap["impact"] = rp.Impact
	}
	if rp.ImpactedField != nil {
		objectMap["impactedField"] = rp.ImpactedField
	}
	if rp.ImpactedValue != nil {
		objectMap["impactedValue"] = rp.ImpactedValue
	}
	if rp.LastUpdated != nil {
		objectMap["lastUpdated"] = rp.LastUpdated
	}
	if rp.Metadata != nil {
		objectMap["metadata"] = rp.Metadata
	}
	if rp.RecommendationTypeID != nil {
		objectMap["recommendationTypeId"] = rp.RecommendationTypeID
	}
	if rp.Risk != "" {
		objectMap["risk"] = rp.Risk
	}
	if rp.ShortDescription != nil {
		objectMap["shortDescription"] = rp.ShortDescription
	}
	return json.Marshal(objectMap)
}

// Resource an Azure resource.
type Resource struct {
	// ID - The resource ID.
	ID *string `json:"id,omitempty"`
	// Name - The name of the resource.
	Name *string `json:"name,omitempty"`
	// Type - The type of the resource.
	Type *string `json:"type,omitempty"`
	// Location - The location of the resource. This cannot be changed after the resource is created.
	Location *string `json:"location,omitempty"`
	// Tags - The tags of the resource.
	Tags map[string]*string `json:"tags"`
}

// MarshalJSON is the custom marshaler for Resource.
func (r Resource) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]interface{})
	if r.ID != nil {
		objectMap["id"] = r.ID
	}
	if r.Name != nil {
		objectMap["name"] = r.Name
	}
	if r.Type != nil {
		objectMap["type"] = r.Type
	}
	if r.Location != nil {
		objectMap["location"] = r.Location
	}
	if r.Tags != nil {
		objectMap["tags"] = r.Tags
	}
	return json.Marshal(objectMap)
}

// ResourceRecommendationBase advisor Recommendation.
type ResourceRecommendationBase struct {
	autorest.Response `json:"-"`
	// ID - The fully qualified recommendation ID, for example /subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.ClassicCompute/virtualMachines/vm1/providers/Microsoft.Advisor/recommendations/recommendationGUID.
	ID *string `json:"id,omitempty"`
	// Name - The name of recommendation.
	Name *string `json:"name,omitempty"`
	// RecommendationProperties - The properties of the recommendation.
	*RecommendationProperties `json:"properties,omitempty"`
	// SuppressionIds - The list of snoozed and dismissed rules for the recommendation.
	SuppressionIds *[]uuid.UUID `json:"suppressionIds,omitempty"`
	// Type - The recommendation type: Microsoft.Advisor/recommendations.
	Type *string `json:"type,omitempty"`
}

// MarshalJSON is the custom marshaler for ResourceRecommendationBase.
func (rrb ResourceRecommendationBase) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]interface{})
	if rrb.ID != nil {
		objectMap["id"] = rrb.ID
	}
	if rrb.Name != nil {
		objectMap["name"] = rrb.Name
	}
	if rrb.RecommendationProperties != nil {
		objectMap["properties"] = rrb.RecommendationProperties
	}
	if rrb.SuppressionIds != nil {
		objectMap["suppressionIds"] = rrb.SuppressionIds
	}
	if rrb.Type != nil {
		objectMap["type"] = rrb.Type
	}
	return json.Marshal(objectMap)
}

// UnmarshalJSON is the custom unmarshaler for ResourceRecommendationBase struct.
func (rrb *ResourceRecommendationBase) UnmarshalJSON(body []byte) error {
	var m map[string]*json.RawMessage
	err := json.Unmarshal(body, &m)
	if err != nil {
		return err
	}
	for k, v := range m {
		switch k {
		case "id":
			if v != nil {
				var ID string
				err = json.Unmarshal(*v, &ID)
				if err != nil {
					return err
				}
				rrb.ID = &ID
			}
		case "name":
			if v != nil {
				var name string
				err = json.Unmarshal(*v, &name)
				if err != nil {
					return err
				}
				rrb.Name = &name
			}
		case "properties":
			if v != nil {
				var recommendationProperties RecommendationProperties
				err = json.Unmarshal(*v, &recommendationProperties)
				if err != nil {
					return err
				}
				rrb.RecommendationProperties = &recommendationProperties
			}
		case "suppressionIds":
			if v != nil {
				var suppressionIds []uuid.UUID
				err = json.Unmarshal(*v, &suppressionIds)
				if err != nil {
					return err
				}
				rrb.SuppressionIds = &suppressionIds
			}
		case "type":
			if v != nil {
				var typeVar string
				err = json.Unmarshal(*v, &typeVar)
				if err != nil {
					return err
				}
				rrb.Type = &typeVar
			}
		}
	}

	return nil
}

// ResourceRecommendationBaseListResult the list of Advisor recommendations.
type ResourceRecommendationBaseListResult struct {
	autorest.Response `json:"-"`
	// NextLink - The link used to get the next page of recommendations.
	NextLink *string `json:"nextLink,omitempty"`
	// Value - The list of recommendations.
	Value *[]ResourceRecommendationBase `json:"value,omitempty"`
}

// ResourceRecommendationBaseListResultIterator provides access to a complete listing of ResourceRecommendationBase
// values.
type ResourceRecommendationBaseListResultIterator struct {
	i    int
	page ResourceRecommendationBaseListResultPage
}

// Next advances to the next value.  If there was an error making
// the request the iterator does not advance and the error is returned.
func (iter *ResourceRecommendationBaseListResultIterator) Next() error {
	iter.i++
	if iter.i < len(iter.page.Values()) {
		return nil
	}
	err := iter.page.Next()
	if err != nil {
		iter.i--
		return err
	}
	iter.i = 0
	return nil
}

// NotDone returns true if the enumeration should be started or is not yet complete.
func (iter ResourceRecommendationBaseListResultIterator) NotDone() bool {
	return iter.page.NotDone() && iter.i < len(iter.page.Values())
}

// Response returns the raw server response from the last page request.
func (iter ResourceRecommendationBaseListResultIterator) Response() ResourceRecommendationBaseListResult {
	return iter.page.Response()
}

// Value returns the current value or a zero-initialized value if the
// iterator has advanced beyond the end of the collection.
func (iter ResourceRecommendationBaseListResultIterator) Value() ResourceRecommendationBase {
	if !iter.page.NotDone() {
		return ResourceRecommendationBase{}
	}
	return iter.page.Values()[iter.i]
}

// IsEmpty returns true if the ListResult contains no values.
func (rrblr ResourceRecommendationBaseListResult) IsEmpty() bool {
	return rrblr.Value == nil || len(*rrblr.Value) == 0
}

// resourceRecommendationBaseListResultPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (rrblr ResourceRecommendationBaseListResult) resourceRecommendationBaseListResultPreparer() (*http.Request, error) {
	if rrblr.NextLink == nil || len(to.String(rrblr.NextLink)) < 1 {
		return nil, nil
	}
	return autorest.Prepare(&http.Request{},
		autorest.AsJSON(),
		autorest.AsGet(),
		autorest.WithBaseURL(to.String(rrblr.NextLink)))
}

// ResourceRecommendationBaseListResultPage contains a page of ResourceRecommendationBase values.
type ResourceRecommendationBaseListResultPage struct {
	fn    func(ResourceRecommendationBaseListResult) (ResourceRecommendationBaseListResult, error)
	rrblr ResourceRecommendationBaseListResult
}

// Next advances to the next page of values.  If there was an error making
// the request the page does not advance and the error is returned.
func (page *ResourceRecommendationBaseListResultPage) Next() error {
	next, err := page.fn(page.rrblr)
	if err != nil {
		return err
	}
	page.rrblr = next
	return nil
}

// NotDone returns true if the page enumeration should be started or is not yet complete.
func (page ResourceRecommendationBaseListResultPage) NotDone() bool {
	return !page.rrblr.IsEmpty()
}

// Response returns the raw server response from the last page request.
func (page ResourceRecommendationBaseListResultPage) Response() ResourceRecommendationBaseListResult {
	return page.rrblr
}

// Values returns the slice of values for the current page or nil if there are no values.
func (page ResourceRecommendationBaseListResultPage) Values() []ResourceRecommendationBase {
	if page.rrblr.IsEmpty() {
		return nil
	}
	return *page.rrblr.Value
}

// ShortDescription a summary of the recommendation.
type ShortDescription struct {
	// Problem - The issue or opportunity identified by the recommendation.
	Problem *string `json:"problem,omitempty"`
	// Solution - The remediation action suggested by the recommendation.
	Solution *string `json:"solution,omitempty"`
}

// SuppressionContract the details of the snoozed or dismissed rule; for example, the duration, name, and GUID
// associated with the rule.
type SuppressionContract struct {
	autorest.Response `json:"-"`
	// SuppressionID - The GUID of the suppression.
	SuppressionID *string `json:"suppressionId,omitempty"`
	// TTL - The duration for which the suppression is valid.
	TTL *string `json:"ttl,omitempty"`
	// ID - The resource ID.
	ID *string `json:"id,omitempty"`
	// Name - The name of the resource.
	Name *string `json:"name,omitempty"`
	// Type - The type of the resource.
	Type *string `json:"type,omitempty"`
	// Location - The location of the resource. This cannot be changed after the resource is created.
	Location *string `json:"location,omitempty"`
	// Tags - The tags of the resource.
	Tags map[string]*string `json:"tags"`
}

// MarshalJSON is the custom marshaler for SuppressionContract.
func (sc SuppressionContract) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]interface{})
	if sc.SuppressionID != nil {
		objectMap["suppressionId"] = sc.SuppressionID
	}
	if sc.TTL != nil {
		objectMap["ttl"] = sc.TTL
	}
	if sc.ID != nil {
		objectMap["id"] = sc.ID
	}
	if sc.Name != nil {
		objectMap["name"] = sc.Name
	}
	if sc.Type != nil {
		objectMap["type"] = sc.Type
	}
	if sc.Location != nil {
		objectMap["location"] = sc.Location
	}
	if sc.Tags != nil {
		objectMap["tags"] = sc.Tags
	}
	return json.Marshal(objectMap)
}


text:
@interface Video : NSObject

@property (nonatomic, assign) int videoId;
@property (nonatomic, strong) NSString *videoTitle;
@property (nonatomic, strong) NSString *videoDescription;
@property (nonatomic, strong) NSString *videoIframe;
@property (nonatomic, strong) NSString *thumbnailUrl;
@property (nonatomic, strong) NSArray *comments;

@end


text:
#ifndef _ARPA_TELNET_H
#define	_ARPA_TELNET_H 1

/*
 * Definitions for the TELNET protocol.
 */
#define	IAC	255		/* interpret as command: */
#define	DONT	254		/* you are not to use option */
#define	DO	253		/* please, you use option */
#define	WONT	252		/* I won't use option */
#define	WILL	251		/* I will use option */
#define	SB	250		/* interpret as subnegotiation */
#define	GA	249		/* you may reverse the line */
#define	EL	248		/* erase the current line */
#define	EC	247		/* erase the current character */
#define	AYT	246		/* are you there */
#define	AO	245		/* abort output--but let prog finish */
#define	IP	244		/* interrupt process--permanently */
#define	BREAK	243		/* break */
#define	DM	242		/* data mark--for connect. cleaning */
#define	NOP	241		/* nop */
#define	SE	240		/* end sub negotiation */
#define EOR     239             /* end of record (transparent mode) */
#define	ABORT	238		/* Abort process */
#define	SUSP	237		/* Suspend process */
#define	xEOF	236		/* End of file: EOF is already used... */

#define SYNCH	242		/* for telfunc calls */

#ifdef TELCMDS
char *telcmds[] = {
	"EOF", "SUSP", "ABORT", "EOR",
	"SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC",
	"EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0,
};
#else
extern char *telcmds[];
#endif

#define	TELCMD_FIRST	xEOF
#define	TELCMD_LAST	IAC
#define	TELCMD_OK(x)	((unsigned int)(x) <= TELCMD_LAST && \
			 (unsigned int)(x) >= TELCMD_FIRST)
#define	TELCMD(x)	telcmds[(x)-TELCMD_FIRST]

/* telnet options */
#define TELOPT_BINARY	0	/* 8-bit data path */
#define TELOPT_ECHO	1	/* echo */
#define	TELOPT_RCP	2	/* prepare to reconnect */
#define	TELOPT_SGA	3	/* suppress go ahead */
#define	TELOPT_NAMS	4	/* approximate message size */
#define	TELOPT_STATUS	5	/* give status */
#define	TELOPT_TM	6	/* timing mark */
#define	TELOPT_RCTE	7	/* remote controlled transmission and echo */
#define TELOPT_NAOL 	8	/* negotiate about output line width */
#define TELOPT_NAOP 	9	/* negotiate about output page size */
#define TELOPT_NAOCRD	10	/* negotiate about CR disposition */
#define TELOPT_NAOHTS	11	/* negotiate about horizontal tabstops */
#define TELOPT_NAOHTD	12	/* negotiate about horizontal tab disposition */
#define TELOPT_NAOFFD	13	/* negotiate about formfeed disposition */
#define TELOPT_NAOVTS	14	/* negotiate about vertical tab stops */
#define TELOPT_NAOVTD	15	/* negotiate about vertical tab disposition */
#define TELOPT_NAOLFD	16	/* negotiate about output LF disposition */
#define TELOPT_XASCII	17	/* extended ascii character set */
#define	TELOPT_LOGOUT	18	/* force logout */
#define	TELOPT_BM	19	/* byte macro */
#define	TELOPT_DET	20	/* data entry terminal */
#define	TELOPT_SUPDUP	21	/* supdup protocol */
#define	TELOPT_SUPDUPOUTPUT 22	/* supdup output */
#define	TELOPT_SNDLOC	23	/* send location */
#define	TELOPT_TTYPE	24	/* terminal type */
#define	TELOPT_EOR	25	/* end or record */
#define	TELOPT_TUID	26	/* TACACS user identification */
#define	TELOPT_OUTMRK	27	/* output marking */
#define	TELOPT_TTYLOC	28	/* terminal location number */
#define	TELOPT_3270REGIME 29	/* 3270 regime */
#define	TELOPT_X3PAD	30	/* X.3 PAD */
#define	TELOPT_NAWS	31	/* window size */
#define	TELOPT_TSPEED	32	/* terminal speed */
#define	TELOPT_LFLOW	33	/* remote flow control */
#define TELOPT_LINEMODE	34	/* Linemode option */
#define TELOPT_XDISPLOC	35	/* X Display Location */
#define TELOPT_OLD_ENVIRON 36	/* Old - Environment variables */
#define	TELOPT_AUTHENTICATION 37/* Authenticate */
#define	TELOPT_ENCRYPT	38	/* Encryption option */
#define TELOPT_NEW_ENVIRON 39	/* New - Environment variables */
#define	TELOPT_EXOPL	255	/* extended-options-list */

#define	NTELOPTS	(1+TELOPT_NEW_ENVIRON)
#ifdef TELOPTS
char *telopts[NTELOPTS+1] = {
	"BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME",
	"STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP",
	"NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS",
	"NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO",
	"DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT",
	"SEND LOCATION", "TERMINAL TYPE", "END OF RECORD",
	"TACACS UID", "OUTPUT MARKING", "TTYLOC",
	"3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW",
	"LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION",
	"ENCRYPT", "NEW-ENVIRON",
	0,
};
#define	TELOPT_FIRST	TELOPT_BINARY
#define	TELOPT_LAST	TELOPT_NEW_ENVIRON
#define	TELOPT_OK(x)	((unsigned int)(x) <= TELOPT_LAST)
#define	TELOPT(x)	telopts[(x)-TELOPT_FIRST]
#endif

/* sub-option qualifiers */
#define	TELQUAL_IS	0	/* option is... */
#define	TELQUAL_SEND	1	/* send option */
#define	TELQUAL_INFO	2	/* ENVIRON: informational version of IS */
#define	TELQUAL_REPLY	2	/* AUTHENTICATION: client version of IS */
#define	TELQUAL_NAME	3	/* AUTHENTICATION: client version of IS */

#define	LFLOW_OFF		0	/* Disable remote flow control */
#define	LFLOW_ON		1	/* Enable remote flow control */
#define	LFLOW_RESTART_ANY	2	/* Restart output on any char */
#define	LFLOW_RESTART_XON	3	/* Restart output only on XON */

/*
 * LINEMODE suboptions
 */

#define	LM_MODE		1
#define	LM_FORWARDMASK	2
#define	LM_SLC		3

#define	MODE_EDIT	0x01
#define	MODE_TRAPSIG	0x02
#define	MODE_ACK	0x04
#define MODE_SOFT_TAB	0x08
#define MODE_LIT_ECHO	0x10

#define	MODE_MASK	0x1f

/* Not part of protocol, but needed to simplify things... */
#define MODE_FLOW		0x0100
#define MODE_ECHO		0x0200
#define MODE_INBIN		0x0400
#define MODE_OUTBIN		0x0800
#define MODE_FORCE		0x1000

#define	SLC_SYNCH	1
#define	SLC_BRK		2
#define	SLC_IP		3
#define	SLC_AO		4
#define	SLC_AYT		5
#define	SLC_EOR		6
#define	SLC_ABORT	7
#define	SLC_EOF		8
#define	SLC_SUSP	9
#define	SLC_EC		10
#define	SLC_EL		11
#define	SLC_EW		12
#define	SLC_RP		13
#define	SLC_LNEXT	14
#define	SLC_XON		15
#define	SLC_XOFF	16
#define	SLC_FORW1	17
#define	SLC_FORW2	18

#define	NSLC		18

/*
 * For backwards compatibility, we define SLC_NAMES to be the
 * list of names if SLC_NAMES is not defined.
 */
#define	SLC_NAMELIST	"0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \
			"ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \
			"LNEXT", "XON", "XOFF", "FORW1", "FORW2", 0,
#ifdef	SLC_NAMES
char *slc_names[] = {
	SLC_NAMELIST
};
#else
extern char *slc_names[];
#define	SLC_NAMES SLC_NAMELIST
#endif

#define	SLC_NAME_OK(x)	((unsigned int)(x) <= NSLC)
#define SLC_NAME(x)	slc_names[x]

#define	SLC_NOSUPPORT	0
#define	SLC_CANTCHANGE	1
#define	SLC_VARIABLE	2
#define	SLC_DEFAULT	3
#define	SLC_LEVELBITS	0x03

#define	SLC_FUNC	0
#define	SLC_FLAGS	1
#define	SLC_VALUE	2

#define	SLC_ACK		0x80
#define	SLC_FLUSHIN	0x40
#define	SLC_FLUSHOUT	0x20

#define	OLD_ENV_VAR	1
#define	OLD_ENV_VALUE	0
#define	NEW_ENV_VAR	0
#define	NEW_ENV_VALUE	1
#define	ENV_ESC		2
#define ENV_USERVAR	3

/*
 * AUTHENTICATION suboptions
 */

/*
 * Who is authenticating who ...
 */
#define	AUTH_WHO_CLIENT		0	/* Client authenticating server */
#define	AUTH_WHO_SERVER		1	/* Server authenticating client */
#define	AUTH_WHO_MASK		1

/*
 * amount of authentication done
 */
#define	AUTH_HOW_ONE_WAY	0
#define	AUTH_HOW_MUTUAL		2
#define	AUTH_HOW_MASK		2

#define	AUTHTYPE_NULL		0
#define	AUTHTYPE_KERBEROS_V4	1
#define	AUTHTYPE_KERBEROS_V5	2
#define	AUTHTYPE_SPX		3
#define	AUTHTYPE_MINK		4
#define	AUTHTYPE_CNT		5

#define	AUTHTYPE_TEST		99

#ifdef	AUTH_NAMES
char *authtype_names[] = {
	"NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", 0,
};
#else
extern char *authtype_names[];
#endif

#define	AUTHTYPE_NAME_OK(x)	((unsigned int)(x) < AUTHTYPE_CNT)
#define	AUTHTYPE_NAME(x)	authtype_names[x]

/*
 * ENCRYPTion suboptions
 */
#define	ENCRYPT_IS		0	/* I pick encryption type ... */
#define	ENCRYPT_SUPPORT		1	/* I support encryption types ... */
#define	ENCRYPT_REPLY		2	/* Initial setup response */
#define	ENCRYPT_START		3	/* Am starting to send encrypted */
#define	ENCRYPT_END		4	/* Am ending encrypted */
#define	ENCRYPT_REQSTART	5	/* Request you start encrypting */
#define	ENCRYPT_REQEND		6	/* Request you send encrypting */
#define	ENCRYPT_ENC_KEYID	7
#define	ENCRYPT_DEC_KEYID	8
#define	ENCRYPT_CNT		9

#define	ENCTYPE_ANY		0
#define	ENCTYPE_DES_CFB64	1
#define	ENCTYPE_DES_OFB64	2
#define	ENCTYPE_CNT		3

#ifdef	ENCRYPT_NAMES
char *encrypt_names[] = {
	"IS", "SUPPORT", "REPLY", "START", "END",
	"REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID",
	0,
};
char *enctype_names[] = {
	"ANY", "DES_CFB64",  "DES_OFB64",  0,
};
#else
extern char *encrypt_names[];
extern char *enctype_names[];
#endif

#define	ENCRYPT_NAME_OK(x)	((unsigned int)(x) < ENCRYPT_CNT)
#define	ENCRYPT_NAME(x)		encrypt_names[x]

#define	ENCTYPE_NAME_OK(x)	((unsigned int)(x) < ENCTYPE_CNT)
#define	ENCTYPE_NAME(x)		enctype_names[x]

#endif /* arpa/telnet.h */


text:
/* ###
 * IP: GHIDRA
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package ghidra.graph.viewer.layout;

import java.awt.geom.Point2D;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

import ghidra.graph.viewer.GraphViewerUtils;

/**
 * A row in a grid.   This class stores its row index, its y offset and its height.   The
 * y value is the layout space y value of a {@link Point2D} object.   That is, unlike the
 * {@link GridLocationMap}, the y value of this object is in layout space and not indexes
 * of a grid.
 *
 *
This class maintains a collection of vertices on this row, organized by column index.  You
 * can get the column of a vertex from {@link #getColumn(Object) getColumn(V)}.
 *
 * @param <V> the vertex type
 */
public class Row<V> {

	/** The layout y coordinate of the column */
	public int y = -1;
	public int height = -1;

	/** The grid index of this row (0, 1...n) for the number of rows */
	public int index = Integer.MAX_VALUE;

	// Note: this must change together (they are effectively a BiDi map)
	private TreeMap<Integer, V> verticesByColumn = new TreeMap<>();
	private Map<V, Integer> columnsByVertex = new HashMap<>();

	Row() {
		// default; index not yet known
	}

	Row(int index) {
		this.index = index;
	}

	/**
	 * Sets the column index in this row for the given vertex
	 *
	 * @param v the vertex
	 * @param col the column index
	 */
	public void setColumn(V v, int col) {
		columnsByVertex.put(v, col);
		verticesByColumn.put(col, v);
	}

	/**
	 * Returns the column index for the given vertex
	 *
	 * @param v the vertex
	 * @return the column index for the given vertex
	 */
	public int getColumn(V v) {
		if (!columnsByVertex.containsKey(v)) {
			throw new IllegalArgumentException("Vertex is not in row: " + v);
		}
		return columnsByVertex.get(v);
	}

	/**
	 * Returns the vertex at the given column index or null if there is no vertex at that column
	 *
	 * @param column the column index
	 * @return the vertex
	 */
	public V getVertex(int column) {
		return verticesByColumn.get(column);
	}

	/**
	 * Represents the range of columns in this row.  For this given row in a grid:
	 *

	 * 	0 1 2 3 4 5 6
	 * 	- - v - v - -
	 *

	 * the column count is 3--where the column range is 2-4, inclusive.
	 *
	 *
Note: this differs from then number of vertices in this row, as the column count
	 * includes columns that have no vertex.
	 *
	 * @return the number of columns in this row, including empty columns between start and end
	 */
	public int getColumnCount() {
		if (verticesByColumn.isEmpty()) {
			return 0;
		}
		Integer largestColumn = verticesByColumn.lastKey();
		Integer smallestColumn = verticesByColumn.firstKey();
		int diff = Math.abs(largestColumn - smallestColumn); // abs for negative column values
		return diff + 1; // +1 for zero-based values
	}

	/**
	 * Returns the smallest column index in this row
	 *
	 * @return the smallest column index in this row
	 */
	public Integer getStartColumn() {
		return verticesByColumn.firstKey();
	}

	/**
	 * Returns the largest column index in this row
	 *
	 * @return the largest column index in this row
	 */
	public int getEndColumn() {
		return verticesByColumn.lastKey();
	}

	/**
	 * Returns all vertices in this row, sorted by column index (min to max).
	 *
	 *
Note: the index of a vertex in the list does not match the column index.  To get the
	 * column index for a vertex, call {@link #getColumn(Object) getColumn(V)}.
	 *
	 * @return all vertices in this row
	 */
	public List<V> getVertices() {

		// fill a list with vertices or null values
		//@formatter:off
		Integer start = verticesByColumn.firstKey();
		Integer n = getColumnCount();
		IntStream columnIndexes = IntStream.range(start, start + n);
		List<V> vertices =
			columnIndexes
			.mapToObj(col -> verticesByColumn.get(col))
			.filter(v -> v != null)
			.collect(Collectors.toList())
			;
		//@formatter:on
		return vertices;
	}

	public int getPaddedHeight(boolean isCondensed) {
		if (!isCondensed) {
			return height + GraphViewerUtils.EXTRA_LAYOUT_ROW_SPACING;
		}

		if (height == 0) {
			return 0;
		}

		return height + GraphViewerUtils.EXTRA_LAYOUT_ROW_SPACING_CONDENSED;
	}

	public boolean isInitialized() {
		return y > -1 && height > -1 && index > Integer.MAX_VALUE;
	}

	@Override
	public String toString() {

		//@formatter:off
		return getClass().getSimpleName() + "{\n" +
			"\trow: " + index + ",\n" +
			"\ty: " + y + ",\n" +
			"\theight: " + height + ",\n" +
			"\tpadded height: " + getPaddedHeight(false) + ",\n" +
			"\tcolumn count: " + getColumnCount() + "\n" +
		"}";
		//@formatter:on
	}

	void dispose() {
		verticesByColumn.clear();
		columnsByVertex.clear();
	}
}


text:
package com.jayantkrish.jklol.training;

import com.jayantkrish.jklol.models.parametric.SufficientStatistics;

/**
 * The aggregate sufficient statistics for a collection of examples. This class
 * is used for batch computation of sufficient statistics, see
 * {@link SufficientStatisticsMapper} and {@link SufficientStatisticsReducer}.
 *
 * @author jayantk
 */
public class SufficientStatisticsBatch {

  private SufficientStatistics statistics;
  private double loglikelihood;
  private int numExamples;

  public SufficientStatisticsBatch(SufficientStatistics statistics,
      double loglikelihood, int numExamples) {
    this.statistics = statistics;
    this.loglikelihood = loglikelihood;
    this.numExamples = numExamples;
  }

  public SufficientStatistics getStatistics() {
    return statistics;
  }

  /**
   * Gets the sum of the unnormalized loglikelihood of each training example in
   * the batch. The actual loglikelihood of the training data is equal to
   * {@code this.getLoglikelihood() - this.getNumExamples() * logPartitionFunction}
   * , where {@code logPartitionFunction} is the log partition function of the
   * factor graph the statistics were computed on.
   *
   * @return
   */
  public double getLoglikelihood() {
    return loglikelihood;
  }

  public int getNumExamples() {
    return numExamples;
  }

  /**
   * Adds the statistics in {@code other} to {@code this}.
   *
   * @param other
   */
  public void increment(SufficientStatisticsBatch other) {
    statistics.increment(other.statistics, 1.0);
    loglikelihood += other.loglikelihood;
    numExamples += other.numExamples;
  }

  public void incrementLogLikelihood(double increment) {
    loglikelihood += increment;
  }

  public void incrementNumExamples(double increment) {
    numExamples += increment;
  }
}


text:
import 'c3/c3.css!'
import {dataLayer, dataLayerClass, ParameterSync, legend,
  TimeAxis, VerticalAxis, VerticalProfilePlot, COVJSON_VERTICALPROFILE} from 'leaflet-coverage'
import 'leaflet-coverage/leaflet-coverage.css!'

import {default as Action, VIEW} from './Action.js'
import {i18n} from '../util.js'

import CovJSON from '../formats/CovJSON.js'

const ModelObservationComparisonActivity = 'ModelObservationComparisonActivity'

/**
 * Displays geospatial coverages on a map.
 */
export default class GeoCoverageView extends Action {
  constructor (data, context) {
    super(context)
    this.cov = data

    this._setHidden()

    this.layers = []
  }

  _setVisible () {
    this.visible = true
    this.label = 'Hide'
    this.icon = ''
    this.fire('labelChange')
  }

  _setHidden () {
    this.visible = false
    this.label = 'View'
    this.icon = ''
    this.fire('labelChange')
  }

  get isSupported () {
    let cov = this.cov
    // TODO for collections, parameters have to be defined at collection level
    // see https://github.com/Reading-eScience-Centre/coveragejson/issues/55

    // check if leaflet-coverage can directly visualize it
    if (dataLayerClass(cov)) {
      return true
    }
    // otherwise, if it's a 1-element collection, check if the single coverage can be visualized
    if (cov.coverages && cov.coverages.length === 1) {
      if (dataLayerClass(cov.coverages[0])) {
        return true
      }
    }
    return false
  }

  run () {
    let map = this.context.map

    let dataset = this.context.dataset
    let datasetTitle = i18n(dataset.title)

    if (this.visible) {
      this.remove()
      this._setHidden()
      return
    }

    this._setVisible()

    let cov = this.cov
    if (!dataLayerClass(cov)) {
      if (cov.coverages && cov.coverages.length === 1) {
        cov = cov.coverages[0]
      }
    }

    let formatLabel = this.context.distribution.formatImpl.shortLabel
    let layerNamePrefix = '' + formatLabel + ' '

    // TODO param sync not needed anymore as we use the built-in collection layer classes of leaflet-coverage
    //  -> will this be needed later maybe?
    this.paramSync = new ParameterSync({
      syncProperties: {
        palette: (p1, p2) => p1,
        paletteExtent: (e1, e2) => e1 && e2 ? [Math.min(e1[0], e2[0]), Math.max(e1[1], e2[1])] : null
      }
    }).on('parameterAdd', e => {
        // The virtual sync layer proxies the synced palette, paletteExtent, and parameter.
        // The sync layer will fire a 'remove' event if all real layers for that parameter were removed.
        let layer = e.syncLayer
        if (layer.palette) {
          legend(layer, {
            position: 'bottomright'
          }).addTo(map)
        }
      })

    // each parameter becomes a layer
    for (let key of cov.parameters.keys()) {
      let layerName = i18n(cov.parameters.get(key).observedProperty.label)
      let fullLayerName = layerNamePrefix + layerName
      let layer = this._createLayer(cov, {parameter: key})
      map.layerControl.addOverlay(layer, fullLayerName, {groupName: datasetTitle, expanded: true})
      this.layers.push(layer)
    }

    // display the first layer
    let firstLayer = this.layers[0]
    map.addLayer(firstLayer)
  }

  _createLayer (cov, opts) {
    let isCollection = cov.coverages

    let map = this.context.map
    let layer = dataLayer(cov, opts)
      .on('afterAdd', e => {
        let covLayer = e.target

        // This registers the layer with the sync manager.
        // By doing that, the palette and extent get unified (if existing)
        // and an event gets fired if a new parameter was added.
        // See the code above where ParameterSync gets instantiated.
        this.paramSync.addLayer(covLayer)

        if (isCollection) {
          // we could display a time range control for filtering the displayed collection items
          // same for vertical axis where in addition a target value could be chosen
        } else {
          if (covLayer.timeSlices) {
            let timeAxis = new TimeAxis(covLayer)
            timeAxis.addTo(map)
          }

          if (covLayer.verticalSlices) {
            let vertAxis = new VerticalAxis(covLayer)
            vertAxis.addTo(map)
          }
        }
      })
      .on('dataLoading', () => this.fire('loading'))
      .on('dataLoad', () => this.fire('load'))
    layer.on('axisChange', () => {
      layer.paletteExtent = 'subset'
    })

    if (cov.domainType === COVJSON_VERTICALPROFILE) {
      if (cov.coverages) {
        layer.bindPopupEach(coverage => new VerticalProfilePlot(coverage))
      } else {
        layer.bindPopup(new VerticalProfilePlot(cov))
      }
    } else {
      // can't use bindPopup here as we fetch data asynchronously
      layer.on('click', ({coverage, latlng}) => {
        let genBy = coverage.ld.wasGeneratedBy

        if (genBy && genBy.type === ModelObservationComparisonActivity) {
          let usage = genBy.qualifiedUsage
          let modelParamKey = usage.model.parameterKey
          let obsParamKey = usage.observation.parameterKey

          // display a plot of the input model (subsetting to a point) and observation
          // TODO we are at JS Coverage Data API abstraction here, how do we know the format of the linked cov?
          // -> should the media type be included in the prov data?
          let modelCovUrl = usage.model.entity
          let obsCovUrl = usage.observation.entity
          let covJSON = new CovJSON()
          Promise.all([covJSON.load(modelCovUrl), covJSON.load(obsCovUrl, {eagerload: true})]).then(([modelCov, obsCov]) => {
            return obsCov.loadDomain().then(obsDomain => {
              // TODO handle CRS, reproject
              let x = obsDomain.axes.get('x').values[0]
              let y = obsDomain.axes.get('y').values[0]
              return modelCov.subsetByValue({x: {start: x, stop: x}, y: {start: y, stop: y}}, {eagerload: true}).then(modelSubset => {
                new VerticalProfilePlot([obsCov,modelSubset], {
                  keys: [[obsParamKey, modelParamKey]],
                  labels: ['Observation', 'Model']
                }).setLatLng(latlng).addTo(map)
              })
            })
          }).catch(e => {
            console.log(e)
            // TODO display error
          })
        }

      })
    }

    return layer
  }

  remove () {
    let map = this.context.map

    for (let layer of this.layers) {
      if (map.hasLayer(layer)) {
        map.removeLayer(layer)
      }
      map.layerControl.removeLayer(layer)
    }
    this.layers = []
  }
}

GeoCoverageView.type = VIEW


text:
package com.microsoft.azure.management.network.v2020_03_01;

import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * Describes the connection monitor endpoint.
 */
public class ConnectionMonitorEndpoint {
    /**
     * The name of the connection monitor endpoint.
     */
    @JsonProperty(value = "name", required = true)
    private String name;

    /**
     * Resource ID of the connection monitor endpoint.
     */
    @JsonProperty(value = "resourceId")
    private String resourceId;

    /**
     * Address of the connection monitor endpoint (IP or domain name).
     */
    @JsonProperty(value = "address")
    private String address;

    /**
     * Filter for sub-items within the endpoint.
     */
    @JsonProperty(value = "filter")
    private ConnectionMonitorEndpointFilter filter;

    /**
     * Get the name of the connection monitor endpoint.
     *
     * @return the name value
     */
    public String name() {
        return this.name;
    }

    /**
     * Set the name of the connection monitor endpoint.
     *
     * @param name the name value to set
     * @return the ConnectionMonitorEndpoint object itself.
     */
    public ConnectionMonitorEndpoint withName(String name) {
        this.name = name;
        return this;
    }

    /**
     * Get resource ID of the connection monitor endpoint.
     *
     * @return the resourceId value
     */
    public String resourceId() {
        return this.resourceId;
    }

    /**
     * Set resource ID of the connection monitor endpoint.
     *
     * @param resourceId the resourceId value to set
     * @return the ConnectionMonitorEndpoint object itself.
     */
    public ConnectionMonitorEndpoint withResourceId(String resourceId) {
        this.resourceId = resourceId;
        return this;
    }

    /**
     * Get address of the connection monitor endpoint (IP or domain name).
     *
     * @return the address value
     */
    public String address() {
        return this.address;
    }

    /**
     * Set address of the connection monitor endpoint (IP or domain name).
     *
     * @param address the address value to set
     * @return the ConnectionMonitorEndpoint object itself.
     */
    public ConnectionMonitorEndpoint withAddress(String address) {
        this.address = address;
        return this;
    }

    /**
     * Get filter for sub-items within the endpoint.
     *
     * @return the filter value
     */
    public ConnectionMonitorEndpointFilter filter() {
        return this.filter;
    }

    /**
     * Set filter for sub-items within the endpoint.
     *
     * @param filter the filter value to set
     * @return the ConnectionMonitorEndpoint object itself.
     */
    public ConnectionMonitorEndpoint withFilter(ConnectionMonitorEndpointFilter filter) {
        this.filter = filter;
        return this;
    }

}


text:
class EnvConfig < ActiveRecord::Base
  attr_accessible :name, :value
end


text:
DOCUMENT=$1

CP=.
CP=$CP:lib/*

java -cp $CP net.geocentral.geometria.view.GFrame $DOCUMENT


text:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const chalk = require("chalk");
const command_1 = require("@ionic/cli-utils/lib/command");
const serve_1 = require("@ionic/cli-utils/lib/serve");
let DocsCommand = class DocsCommand extends command_1.Command {
    run(inputs, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            const { isSuperAgentError } = yield Promise.resolve().then(function () { return require('@ionic/cli-utils/guards'); });
            const { createRequest } = yield Promise.resolve().then(function () { return require('@ionic/cli-utils/lib/http'); });
            const browser = options['browser'] ? String(options['browser']) : undefined;
            const opn = yield Promise.resolve().then(function () { return require('opn'); });
            const docsHomepage = 'https://ionicframework.com/docs';
            let url = docsHomepage;
            const project = this.env.project.directory ? yield this.env.project.load() : undefined;
            if (project) {
                if (project.type === 'ionic1') {
                    url = 'https://ionicframework.com/docs/v1/';
                }
                else if (project.type === 'ionic-angular') {
                    url = 'https://ionicframework.com/docs/api'; // TODO: can know framework version, HEAD request, etc
                }
            }
            try {
                const { req } = yield createRequest(this.env.config, 'head', url);
                yield req;
            }
            catch (e) {
                if (isSuperAgentError(e)) {
                    if (e.response.status === 404) {
                        this.env.log.warn(`Docs not found for your specific version of Ionic. Directing you to latest docs.`);
                        opn(`${docsHomepage}/api`, { wait: false });
                        return;
                    }
                }
                throw e;
            }
            yield opn(url, { app: browser, wait: false });
            this.env.log.ok('Launched Ionic docs in your browser!');
        });
    }
};
DocsCommand = tslib_1.__decorate([
    command_1.CommandMetadata({
        name: 'docs',
        type: 'global',
        description: 'Open the Ionic documentation website',
        options: [
            {
                name: 'browser',
                description: `Specifies the browser to use (${serve_1.BROWSERS.map(b => chalk.green(b)).join(', ')})`,
                aliases: ['w'],
                advanced: true,
            },
        ],
    })
], DocsCommand);
exports.DocsCommand = DocsCommand;