text:
const assert = require('power-assert')
const Store = require('../lib/store')

describe('store', () => {
  const store = new Store()
  const methods = ['set', 'get', 'reset']

  it('test', () => {
    const methods1 = {}
    const methods2 = {}

    methods.forEach((m) => {
      methods1[m] = store[m].bind({ context: store, namespace: 'script:script.js' })
      methods2[m] = store[m].bind({ context: store, namespace: 'plugin:plugin' })
    })

    const store1 = { ...store, ...methods1 }
    const store2 = { ...store, ...methods2 }

    store1.set('key', 'key')
    assert(store.store[0].data === 'key')
    assert(store.store[0].key === 'script:script.js:key')
    assert(store1.get('key') === 'key')

    store1.set('key', 'key1')
    assert(store1.get('key') === 'key1')

    store2.set('key', 'key')
    assert(store.store.length === 2)

    store2.reset()
    assert(store.store.length === 1)
    assert(store2.get('key') === undefined)

    assert(store2.get('key', 'script.js') === 'key1')
    assert(store1.get('key', 'plugin') === undefined)
  })
})

redpajama_set_name: RedPajamaGithub


text:
require 'mongoid'
require 'engine' if defined?(Rails) && Rails::VERSION::MAJOR == 3
require 'carrierwave'
require 'ext/carrierwave'
require 'ext/constantize'
require 'nested_db/property'
require 'nested_db/data_types'
require 'nested_db/controllers'
require 'nested_db/encryption'
require 'nested_db/dynamic_attributes'
require 'nested_db/models'
require 'nested_db/routes' if defined?(ActionDispatch)
require 'nested_db/liquidizable' unless defined?(Liquidizable)
require 'nested_db/liquid'
require 'nested_db/callbacks'


text:
/*================================================================================
  code generated by: java2cpp
  author: Zoran Angelov, mailto://baldzar@gmail.com
  class: org.xml.sax.helpers.NamespaceSupport
================================================================================*/

#ifndef J2CPP_INCLUDE_IMPLEMENTATION

#ifndef J2CPP_ORG_XML_SAX_HELPERS_NAMESPACESUPPORT_HPP_DECL
#define J2CPP_ORG_XML_SAX_HELPERS_NAMESPACESUPPORT_HPP_DECL

namespace j2cpp { namespace java { namespace lang { class String; } } }
namespace j2cpp { namespace java { namespace lang { class Object; } } }
namespace j2cpp { namespace java { namespace util { class Enumeration; } } }

#include <java/lang/Object.hpp>
#include <java/lang/String.hpp>
#include <java/util/Enumeration.hpp>

namespace j2cpp {

namespace org { namespace xml { namespace sax { namespace helpers {

	class NamespaceSupport;
	class NamespaceSupport
		: public object<NamespaceSupport>
	{
	public:

		J2CPP_DECLARE_CLASS

		J2CPP_DECLARE_METHOD(0)
		J2CPP_DECLARE_METHOD(1)
		J2CPP_DECLARE_METHOD(2)
		J2CPP_DECLARE_METHOD(3)
		J2CPP_DECLARE_METHOD(4)
		J2CPP_DECLARE_METHOD(5)
		J2CPP_DECLARE_METHOD(6)
		J2CPP_DECLARE_METHOD(7)
		J2CPP_DECLARE_METHOD(8)
		J2CPP_DECLARE_METHOD(9)
		J2CPP_DECLARE_METHOD(10)
		J2CPP_DECLARE_METHOD(11)
		J2CPP_DECLARE_METHOD(12)
		J2CPP_DECLARE_FIELD(0)
		J2CPP_DECLARE_FIELD(1)

		explicit NamespaceSupport(jobject jobj)
		: object<NamespaceSupport>(jobj)
		{
		}

		operator local_ref<java::lang::Object>() const;

		NamespaceSupport();
		void reset();
		void pushContext();
		void popContext();
		jboolean declarePrefix(local_ref< java::lang::String >  const&, local_ref< java::lang::String >  const&);
		local_ref< array< local_ref< java::lang::String >, 1> > processName(local_ref< java::lang::String >  const&, local_ref< array< local_ref< java::lang::String >, 1> >  const&, jboolean);
		local_ref< java::lang::String > getURI(local_ref< java::lang::String >  const&);
		local_ref< java::util::Enumeration > getPrefixes();
		local_ref< java::lang::String > getPrefix(local_ref< java::lang::String >  const&);
		local_ref< java::util::Enumeration > getPrefixes(local_ref< java::lang::String >  const&);
		local_ref< java::util::Enumeration > getDeclaredPrefixes();
		void setNamespaceDeclUris(jboolean);
		jboolean isNamespaceDeclUris();

		static static_field< J2CPP_CLASS_NAME, J2CPP_FIELD_NAME(0), J2CPP_FIELD_SIGNATURE(0), local_ref< java::lang::String > > XMLNS;
		static static_field< J2CPP_CLASS_NAME, J2CPP_FIELD_NAME(1), J2CPP_FIELD_SIGNATURE(1), local_ref< java::lang::String > > NSDECL;
	}; //class NamespaceSupport

} //namespace helpers
} //namespace sax
} //namespace xml
} //namespace org

} //namespace j2cpp

#endif //J2CPP_ORG_XML_SAX_HELPERS_NAMESPACESUPPORT_HPP_DECL

#else //J2CPP_INCLUDE_IMPLEMENTATION

#ifndef J2CPP_ORG_XML_SAX_HELPERS_NAMESPACESUPPORT_HPP_IMPL
#define J2CPP_ORG_XML_SAX_HELPERS_NAMESPACESUPPORT_HPP_IMPL

namespace j2cpp {

org::xml::sax::helpers::NamespaceSupport::operator local_ref<java::lang::Object>() const
{
	return local_ref<java::lang::Object>(get_jobject());
}

org::xml::sax::helpers::NamespaceSupport::NamespaceSupport()
: object<org::xml::sax::helpers::NamespaceSupport>(
	call_new_object<
		org::xml::sax::helpers::NamespaceSupport::J2CPP_CLASS_NAME,
		org::xml::sax::helpers::NamespaceSupport::J2CPP_METHOD_NAME(0),
		org::xml::sax::helpers::NamespaceSupport::J2CPP_METHOD_SIGNATURE(0)
	>()
)
{
}

void org::xml::sax::helpers::NamespaceSupport::reset()
{
	return call_method<
		org::xml::sax::helpers::NamespaceSupport::J2CPP_CLASS_NAME,
		org::xml::sax::helpers::NamespaceSupport::J2CPP_METHOD_NAME(1),
		org::xml::sax::helpers::NamespaceSupport::J2CPP_METHOD_SIGNATURE(1),
		void
	>(get_jobject());
}

void org::xml::sax::helpers::NamespaceSupport::pushContext()
{
	return call_method<
		org::xml::sax::helpers::NamespaceSupport::J2CPP_CLASS_NAME,
		org::xml::sax::helpers::NamespaceSupport::J2CPP_METHOD_NAME(2),
		org::xml::sax::helpers::NamespaceSupport::J2CPP_METHOD_SIGNATURE(2),
		void
	>(get_jobject());
}

void org::xml::sax::helpers::NamespaceSupport::popContext()
{
	return call_method<
		org::xml::sax::helpers::NamespaceSupport::J2CPP_CLASS_NAME,
		org::xml::sax::helpers::NamespaceSupport::J2CPP_METHOD_NAME(3),
		org::xml::sax::helpers::NamespaceSupport::J2CPP_METHOD_SIGNATURE(3),
		void
	>(get_jobject());
}

jboolean org::xml::sax::helpers::NamespaceSupport::declarePrefix(local_ref< java::lang::String > const &a0, local_ref< java::lang::String > const &a1)
{
	return call_method<
		org::xml::sax::helpers::NamespaceSupport::J2CPP_CLASS_NAME,
		org::xml::sax::helpers::NamespaceSupport::J2CPP_METHOD_NAME(4),
		org::xml::sax::helpers::NamespaceSupport::J2CPP_METHOD_SIGNATURE(4),
		jboolean
	>(get_jobject(), a0, a1);
}

local_ref< array< local_ref< java::lang::String >, 1> > org::xml::sax::helpers::NamespaceSupport::processName(local_ref< java::lang::String > const &a0, local_ref< array< local_ref< java::lang::String >, 1> > const &a1, jboolean a2)
{
	return call_method<
		org::xml::sax::helpers::NamespaceSupport::J2CPP_CLASS_NAME,
		org::xml::sax::helpers::NamespaceSupport::J2CPP_METHOD_NAME(5),
		org::xml::sax::helpers::NamespaceSupport::J2CPP_METHOD_SIGNATURE(5),
		local_ref< array< local_ref< java::lang::String >, 1> >
	>(get_jobject(), a0, a1, a2);
}

local_ref< java::lang::String > org::xml::sax::helpers::NamespaceSupport::getURI(local_ref< java::lang::String > const &a0)
{
	return call_method<
		org::xml::sax::helpers::NamespaceSupport::J2CPP_CLASS_NAME,
		org::xml::sax::helpers::NamespaceSupport::J2CPP_METHOD_NAME(6),
		org::xml::sax::helpers::NamespaceSupport::J2CPP_METHOD_SIGNATURE(6),
		local_ref< java::lang::String >
	>(get_jobject(), a0);
}

local_ref< java::util::Enumeration > org::xml::sax::helpers::NamespaceSupport::getPrefixes()
{
	return call_method<
		org::xml::sax::helpers::NamespaceSupport::J2CPP_CLASS_NAME,
		org::xml::sax::helpers::NamespaceSupport::J2CPP_METHOD_NAME(7),
		org::xml::sax::helpers::NamespaceSupport::J2CPP_METHOD_SIGNATURE(7),
		local_ref< java::util::Enumeration >
	>(get_jobject());
}

local_ref< java::lang::String > org::xml::sax::helpers::NamespaceSupport::getPrefix(local_ref< java::lang::String > const &a0)
{
	return call_method<
		org::xml::sax::helpers::NamespaceSupport::J2CPP_CLASS_NAME,
		org::xml::sax::helpers::NamespaceSupport::J2CPP_METHOD_NAME(8),
		org::xml::sax::helpers::NamespaceSupport::J2CPP_METHOD_SIGNATURE(8),
		local_ref< java::lang::String >
	>(get_jobject(), a0);
}

local_ref< java::util::Enumeration > org::xml::sax::helpers::NamespaceSupport::getPrefixes(local_ref< java::lang::String > const &a0)
{
	return call_method<
		org::xml::sax::helpers::NamespaceSupport::J2CPP_CLASS_NAME,
		org::xml::sax::helpers::NamespaceSupport::J2CPP_METHOD_NAME(9),
		org::xml::sax::helpers::NamespaceSupport::J2CPP_METHOD_SIGNATURE(9),
		local_ref< java::util::Enumeration >
	>(get_jobject(), a0);
}

local_ref< java::util::Enumeration > org::xml::sax::helpers::NamespaceSupport::getDeclaredPrefixes()
{
	return call_method<
		org::xml::sax::helpers::NamespaceSupport::J2CPP_CLASS_NAME,
		org::xml::sax::helpers::NamespaceSupport::J2CPP_METHOD_NAME(10),
		org::xml::sax::helpers::NamespaceSupport::J2CPP_METHOD_SIGNATURE(10),
		local_ref< java::util::Enumeration >
	>(get_jobject());
}

void org::xml::sax::helpers::NamespaceSupport::setNamespaceDeclUris(jboolean a0)
{
	return call_method<
		org::xml::sax::helpers::NamespaceSupport::J2CPP_CLASS_NAME,
		org::xml::sax::helpers::NamespaceSupport::J2CPP_METHOD_NAME(11),
		org::xml::sax::helpers::NamespaceSupport::J2CPP_METHOD_SIGNATURE(11),
		void
	>(get_jobject(), a0);
}

jboolean org::xml::sax::helpers::NamespaceSupport::isNamespaceDeclUris()
{
	return call_method<
		org::xml::sax::helpers::NamespaceSupport::J2CPP_CLASS_NAME,
		org::xml::sax::helpers::NamespaceSupport::J2CPP_METHOD_NAME(12),
		org::xml::sax::helpers::NamespaceSupport::J2CPP_METHOD_SIGNATURE(12),
		jboolean
	>(get_jobject());
}

static_field<
	org::xml::sax::helpers::NamespaceSupport::J2CPP_CLASS_NAME,
	org::xml::sax::helpers::NamespaceSupport::J2CPP_FIELD_NAME(0),
	org::xml::sax::helpers::NamespaceSupport::J2CPP_FIELD_SIGNATURE(0),
	local_ref< java::lang::String >
> org::xml::sax::helpers::NamespaceSupport::XMLNS;

static_field<
	org::xml::sax::helpers::NamespaceSupport::J2CPP_CLASS_NAME,
	org::xml::sax::helpers::NamespaceSupport::J2CPP_FIELD_NAME(1),
	org::xml::sax::helpers::NamespaceSupport::J2CPP_FIELD_SIGNATURE(1),
	local_ref< java::lang::String >
> org::xml::sax::helpers::NamespaceSupport::NSDECL;

J2CPP_DEFINE_CLASS(org::xml::sax::helpers::NamespaceSupport,"org/xml/sax/helpers/NamespaceSupport")
J2CPP_DEFINE_METHOD(org::xml::sax::helpers::NamespaceSupport,0,"<init>","()V")
J2CPP_DEFINE_METHOD(org::xml::sax::helpers::NamespaceSupport,1,"reset","()V")
J2CPP_DEFINE_METHOD(org::xml::sax::helpers::NamespaceSupport,2,"pushContext","()V")
J2CPP_DEFINE_METHOD(org::xml::sax::helpers::NamespaceSupport,3,"popContext","()V")
J2CPP_DEFINE_METHOD(org::xml::sax::helpers::NamespaceSupport,4,"declarePrefix","(Ljava/lang/String;Ljava/lang/String;)Z")
J2CPP_DEFINE_METHOD(org::xml::sax::helpers::NamespaceSupport,5,"processName","(Ljava/lang/String;[java.lang.StringZ)[java.lang.String")
J2CPP_DEFINE_METHOD(org::xml::sax::helpers::NamespaceSupport,6,"getURI","(Ljava/lang/String;)Ljava/lang/String;")
J2CPP_DEFINE_METHOD(org::xml::sax::helpers::NamespaceSupport,7,"getPrefixes","()Ljava/util/Enumeration;")
J2CPP_DEFINE_METHOD(org::xml::sax::helpers::NamespaceSupport,8,"getPrefix","(Ljava/lang/String;)Ljava/lang/String;")
J2CPP_DEFINE_METHOD(org::xml::sax::helpers::NamespaceSupport,9,"getPrefixes","(Ljava/lang/String;)Ljava/util/Enumeration;")
J2CPP_DEFINE_METHOD(org::xml::sax::helpers::NamespaceSupport,10,"getDeclaredPrefixes","()Ljava/util/Enumeration;")
J2CPP_DEFINE_METHOD(org::xml::sax::helpers::NamespaceSupport,11,"setNamespaceDeclUris","(Z)V")
J2CPP_DEFINE_METHOD(org::xml::sax::helpers::NamespaceSupport,12,"isNamespaceDeclUris","()Z")
J2CPP_DEFINE_FIELD(org::xml::sax::helpers::NamespaceSupport,0,"XMLNS","Ljava/lang/String;")
J2CPP_DEFINE_FIELD(org::xml::sax::helpers::NamespaceSupport,1,"NSDECL","Ljava/lang/String;")

} //namespace j2cpp

#endif //J2CPP_ORG_XML_SAX_HELPERS_NAMESPACESUPPORT_HPP_IMPL

#endif //J2CPP_INCLUDE_IMPLEMENTATION


text:
#include "slib/render/vertex_buffer.h"

namespace slib
{

	SLIB_DEFINE_OBJECT(VertexBufferInstance, RenderBaseObjectInstance)

	VertexBufferInstance::VertexBufferInstance()
	{
	}

	VertexBufferInstance::~VertexBufferInstance()
	{
	}

	void VertexBufferInstance::notifyUpdated(sl_size offset, sl_size size)
	{
		ObjectLocker lock(this);
		if (m_flagUpdated) {
			sl_size oldLeft = m_updatedOffset;
			sl_size oldRight = oldLeft + m_updatedSize;
			sl_size newRight = offset + size;
			if (oldLeft < offset) {
				offset = oldLeft;
			}
			if (oldRight > newRight) {
				newRight = oldRight;
			}
			m_updatedOffset = offset;
			m_updatedSize = newRight - offset;
		} else {
			m_updatedOffset = offset;
			m_updatedSize = size;
			m_flagUpdated = sl_true;
		}
	}

	SLIB_DEFINE_OBJECT(VertexBuffer, RenderBaseObject)

	VertexBuffer::VertexBuffer()
	{
		m_flagStatic = sl_true;
	}

	VertexBuffer::~VertexBuffer()
	{
	}

	Ref<VertexBuffer> VertexBuffer::create(const Memory& mem)
	{
		if (mem.isNotNull()) {
			Ref<VertexBuffer> ret = new VertexBuffer();
			if (ret.isNotNull()) {
				ret->m_mem = mem;
				return ret;
			}
		}
		return sl_null;
	}

	Ref<VertexBuffer> VertexBuffer::create(const void* buf, sl_size size)
	{
		return VertexBuffer::create(Memory::create(buf, size));
	}

	sl_size VertexBuffer::getSize()
	{
		return m_mem.getSize();
	}

	sl_uint8* VertexBuffer::getBuffer()
	{
		return (sl_uint8*)(m_mem.getData());
	}

	sl_bool VertexBuffer::isStatic()
	{
		return m_flagStatic;
	}

	void VertexBuffer::setStatic(sl_bool flag)
	{
		m_flagStatic = flag;
	}

	void VertexBuffer::update(sl_size offset, sl_size size)
	{
		sl_size total = m_mem.getSize();
		if (offset >= total) {
			return;
		}
		if (size > total - offset) {
			size = total - offset;
		}
		for (int i = 0; i < SLIB_MAX_RENDER_ENGINE_COUNT_PER_OBJECT; i++) {
			Ref<RenderBaseObjectInstance> instance = m_instances[i];
			if (instance.isNotNull()) {
				((VertexBufferInstance*)(instance.get()))->notifyUpdated(offset, size);
			}
		}
	}

	void VertexBuffer::update()
	{
		update(0, getSize());
	}

	Ref<VertexBufferInstance> VertexBuffer::getInstance(RenderEngine* engine)
	{
		return Ref<VertexBufferInstance>::from(RenderBaseObject::getInstance(engine));
	}

}


text:
/**
 * @fileoverview
 * The global object gadgets.json contains two methods.
 *
 * gadgets.json.stringify(value) takes a JavaScript value and produces a JSON
 * text. The value must not be cyclical.
 *
 * gadgets.json.parse(text) takes a JSON text and produces a JavaScript value.
 * It will return false if there is an error.
 */

/**
 * @static
 * @class Provides operations for translating objects to and from JSON.
 * @name gadgets.json
 */

/**
 * Port of the public domain JSON library by Douglas Crockford.
 * See: http://www.json.org/json2.js
 */
if (window.JSON && window.JSON.parse && window.JSON.stringify) {
  // HTML5 implementation, or already defined.
  // Not a direct alias as the opensocial specification disagrees with the HTML5 JSON spec.
  // JSON says to throw on parse errors and to support filtering functions. OS does not.
  gadgets['json'] = (function() {
    var endsWith___ = /___$/;
    return {
      /* documented below */
      'parse': function(str) {
        try {
          return window.JSON.parse(str);
        } catch (e) {
          return false;
        }
      },
      /* documented below */
      'stringify': function(obj) {
        try {
          return window.JSON.stringify(obj, function(k,v) {
            return !endsWith___.test(k) ? v : null;
          });
        } catch (e) {
          return null;
        }
      }
    };
  })();
} else {
  /**
 * Port of the public domain JSON library by Douglas Crockford.
 * See: http://www.json.org/json2.js
 */
  gadgets['json'] = function() {

    /**
     * Formats integers to 2 digits.
     * @param {number} n
     * @private
     */
    function f(n) {
      return n < 10 ? '0' + n : n;
    }

    Date.prototype.toJSON = function() {
      return [this.getUTCFullYear(), '-',
        f(this.getUTCMonth() + 1), '-',
        f(this.getUTCDate()), 'T',
        f(this.getUTCHours()), ':',
        f(this.getUTCMinutes()), ':',
        f(this.getUTCSeconds()), 'Z'].join('');
    };

    // table of character substitutions
    /**
     * @const
     * @enum {string}
     */
    var m = {
      '\b': '\\b',
      '\t': '\\t',
      '\n': '\\n',
      '\f': '\\f',
      '\r': '\\r',
      '"' : '\\"',
      '\\': '\\\\'
    };

    /**
     * Converts a json object into a string.
     * @param {*} value
     * @return {string}
     * @member gadgets.json
     */
    function stringify(value) {
      var a,          // The array holding the partial texts.
          i,          // The loop counter.
          k,          // The member key.
          l,          // Length.
          r = /["\\\x00-\x1f\x7f-\x9f]/g,
          v;          // The member value.

      switch (typeof value) {
        case 'string':
          // If the string contains no control characters, no quote characters, and no
          // backslash characters, then we can safely slap some quotes around it.
          // Otherwise we must also replace the offending characters with safe ones.
          return r.test(value) ?
              '"' + value.replace(r, function(a) {
                var c = m[a];
                if (c) {
                  return c;
                }
                c = a.charCodeAt();
                return '\\u00' + Math.floor(c / 16).toString(16) +
                   (c % 16).toString(16);
              }) + '"' : '"' + value + '"';
        case 'number':
          // JSON numbers must be finite. Encode non-finite numbers as null.
          return isFinite(value) ? String(value) : 'null';
        case 'boolean':
        case 'null':
          return String(value);
        case 'object':
          // Due to a specification blunder in ECMAScript,
          // typeof null is 'object', so watch out for that case.
          if (!value) {
            return 'null';
          }
          // toJSON check removed; re-implement when it doesn't break other libs.
          a = [];
          if (typeof value.length === 'number' &&
              !value.propertyIsEnumerable('length')) {
            // The object is an array. Stringify every element. Use null as a
            // placeholder for non-JSON values.
            l = value.length;
            for (i = 0; i < l; i += 1) {
              a.push(stringify(value[i]) || 'null');
            }
            // Join all of the elements together and wrap them in brackets.
            return '[' + a.join(',') + ']';
          }
          // Otherwise, iterate through all of the keys in the object.
          for (k in value) {
            if (k.match('___$'))
              continue;
            if (value.hasOwnProperty(k)) {
              if (typeof k === 'string') {
                v = stringify(value[k]);
                if (v) {
                  a.push(stringify(k) + ':' + v);
                }
              }
            }
          }
          // Join all of the member texts together and wrap them in braces.
          return '{' + a.join(',') + '}';
      }
      return '';
    }

    return {
      'stringify': stringify,
      'parse': function(text) {
        // Parsing happens in three stages. In the first stage, we run the text against
        // regular expressions that look for non-JSON patterns. We are especially
        // concerned with '()' and 'new' because they can cause invocation, and '='
        // because it can cause mutation. But just to be safe, we want to reject all
        // unexpected forms.

        // We split the first stage into 4 regexp operations in order to work around
        // crippling inefficiencies in IE's and Safari's regexp engines. First we
        // replace all backslash pairs with '@' (a non-JSON character). Second, we
        // replace all simple value tokens with ']' characters. Third, we delete all
        // open brackets that follow a colon or comma or that begin the text. Finally,
        // we look to see that the remaining characters are only whitespace or ']' or
        // ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.

        if (/^[\],:{}\s]*$/.test(text.replace(/\\["\\\/b-u]/g, '@').
            replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
            replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
          return eval('(' + text + ')');
        }
        // If the text is not JSON parseable, then return false.

        return false;
      }
    };
  }();
}
/**
 * Flatten an object to a stringified values. Useful for dealing with
 * json->querystring transformations. Note: not in official specification yet
 *
 * @param {Object} obj
 * @return {Object} object with only string values.
 */

gadgets['json'].flatten = function(obj) {
  var flat = {};

  if (obj === null || obj === undefined) return flat;

  for (var k in obj) {
    if (obj.hasOwnProperty(k)) {
      var value = obj[k];
      if (null === value || undefined === value) {
        continue;
      }
      flat[k] = (typeof value === 'string') ? value : gadgets.json.stringify(value);
    }
  }
  return flat;
};


text:
package au.gov.amsa.ais;

import java.io.File;
import java.nio.charset.StandardCharsets;

import au.gov.amsa.streams.StringSockets;
import au.gov.amsa.util.nmea.saver.FileFactoryPerDay;
import au.gov.amsa.util.nmea.saver.NmeaSaver;
import rx.Observable;
import rx.schedulers.Schedulers;

public class UweExample {

    public static void main(String[] args) {
        File directory = new File("target/days");
        directory.mkdir();
        int quietTimeoutMs = 10000;
        long reconnectDelayMs = 5000;
        Observable<String> nmea = StringSockets.from("mariweb.amsa.gov.au", 9010, quietTimeoutMs,
                reconnectDelayMs, StandardCharsets.UTF_8, Schedulers.trampoline());

        // Uwe you would use
        // StringSockets.from(socketCreator, quietTimeoutMs, reconnectDelayMs,
        // StandardCharsets.UTF_8, Schedulers.trampoline());
        // and the socketCreator lambda would set up an SSL socket

        NmeaSaver saver = new NmeaSaver(nmea, new FileFactoryPerDay(directory));
        saver.start(Schedulers.trampoline());
    }

}


text:
namespace Slang
{
    struct ResultTypeLoweringContext
    {
        IRModule* module;
        DiagnosticSink* sink;

        SharedIRBuilder sharedBuilderStorage;

        List<IRInst*> workList;
        HashSet<IRInst*> workListSet;

        struct LoweredResultTypeInfo : public RefObject
        {
            IRType* resultType = nullptr;
            IRType* errorType = nullptr;
            IRType* valueType = nullptr;
            IRType* loweredType = nullptr;
            IRStructField* valueField = nullptr;
            IRStructField* errorField = nullptr;
        };
        Dictionary<IRInst*, RefPtr<LoweredResultTypeInfo>> mapLoweredTypeToResultTypeInfo;
        Dictionary<IRInst*, RefPtr<LoweredResultTypeInfo>> loweredResultTypes;

        IRType* maybeLowerResultType(IRBuilder* builder, IRType* type)
        {
            if (auto info = getLoweredResultType(builder, type))
                return info->loweredType;
            else
                return type;
        }

        LoweredResultTypeInfo* getLoweredResultType(IRBuilder* builder, IRInst* type)
        {
            if (auto loweredInfo = loweredResultTypes.TryGetValue(type))
                return loweredInfo->Ptr();
            if (auto loweredInfo = mapLoweredTypeToResultTypeInfo.TryGetValue(type))
                return loweredInfo->Ptr();

            if (!type)
                return nullptr;
            if (type->getOp() != kIROp_ResultType)
                return nullptr;

            RefPtr<LoweredResultTypeInfo> info = new LoweredResultTypeInfo();
            info->resultType = (IRType*)type;
            info->errorType = cast<IRResultType>(type)->getErrorType();

            auto resultType = cast<IRResultType>(type);
            auto valueType = resultType->getValueType();
            if (valueType->getOp() != kIROp_VoidType)
            {
                auto structType = builder->createStructType();
                info->loweredType = structType;
                builder->addNameHintDecoration(structType, UnownedStringSlice("ResultType"));

                info->valueType = valueType;
                auto valueKey = builder->createStructKey();
                builder->addNameHintDecoration(valueKey, UnownedStringSlice("value"));
                info->valueField = builder->createStructField(structType, valueKey, (IRType*)valueType);

                auto errorType = resultType->getErrorType();
                auto errorKey = builder->createStructKey();
                builder->addNameHintDecoration(errorKey, UnownedStringSlice("error"));
                info->errorField = builder->createStructField(structType, errorKey, (IRType*)errorType);
            }
            else
            {
                info->loweredType = resultType->getErrorType();
            }
            mapLoweredTypeToResultTypeInfo[info->loweredType] = info;
            loweredResultTypes[type] = info;
            return info.Ptr();
        }

        void addToWorkList(
            IRInst* inst)
        {
            for (auto ii = inst->getParent(); ii; ii = ii->getParent())
            {
                if (as<IRGeneric>(ii))
                    return;
            }

            if (workListSet.Contains(inst))
                return;

            workList.add(inst);
            workListSet.Add(inst);
        }

        IRInst* getSuccessErrorValue(IRType* type)
        {
            switch (type->getOp())
            {
            case kIROp_Int8Type:
            case kIROp_Int16Type:
            case kIROp_IntType:
            case kIROp_Int64Type:
            case kIROp_IntPtrType:
            case kIROp_UInt8Type:
            case kIROp_UInt16Type:
            case kIROp_UIntType:
            case kIROp_UInt64Type:
            case kIROp_UIntPtrType:
                break;
            default:
                SLANG_ASSERT_FAILURE("error type is not lowered to an integer type.");
            }
            IRBuilder builderStorage(sharedBuilderStorage);
            auto builder = &builderStorage;
            builder->setInsertInto(module);
            return builder->getIntValue(type, 0);
        }

        void processMakeResultValue(IRMakeResultValue* inst)
        {
            IRBuilder builderStorage(sharedBuilderStorage);
            auto builder = &builderStorage;
            builder->setInsertBefore(inst);

            auto info = getLoweredResultType(builder, inst->getDataType());
            if (info->loweredType->getOp() == kIROp_StructType)
            {
                List<IRInst*> operands;
                operands.add(inst->getOperand(0));
                operands.add(getSuccessErrorValue(info->errorType));
                auto makeStruct = builder->emitMakeStruct(info->loweredType, operands);
                inst->replaceUsesWith(makeStruct);
            }
            else
            {
                auto errCode = getSuccessErrorValue(info->errorType);
                inst->replaceUsesWith(errCode);
            }
            inst->removeAndDeallocate();
        }

        void processMakeResultError(IRMakeResultError* inst)
        {
            IRBuilder builderStorage(sharedBuilderStorage);
            auto builder = &builderStorage;
            builder->setInsertBefore(inst);

            auto info = getLoweredResultType(builder, inst->getDataType());
            if (info->valueField)
            {
                List<IRInst*> operands;
                operands.add(builder->emitConstructorInst(info->valueType, 0, nullptr));
                operands.add(inst->getErrorValue());
                auto makeStruct = builder->emitMakeStruct(info->loweredType, operands);
                inst->replaceUsesWith(makeStruct);
            }
            else
            {
                inst->replaceUsesWith(inst->getErrorValue());
            }
            inst->removeAndDeallocate();
        }

        IRInst* getResultError(IRBuilder* builder, IRInst* resultInst)
        {
            auto loweredResultTypeInfo = getLoweredResultType(builder, resultInst->getDataType());
            SLANG_ASSERT(loweredResultTypeInfo);
            if (loweredResultTypeInfo->valueField)
            {
                auto value = builder->emitFieldExtract(
                    loweredResultTypeInfo->errorType,
                    resultInst,
                    loweredResultTypeInfo->errorField->getKey());
                return value;
            }
            else
            {
                return resultInst;
            }
        }

        void processGetResultError(IRGetResultError* inst)
        {
            IRBuilder builderStorage(sharedBuilderStorage);
            auto builder = &builderStorage;
            builder->setInsertBefore(inst);

            auto resultValue = inst->getResultOperand();
            auto errValue = getResultError(builder, resultValue);
            inst->replaceUsesWith(errValue);
            inst->removeAndDeallocate();
        }

        void processGetResultValue(IRGetResultValue* inst)
        {
            IRBuilder builderStorage(sharedBuilderStorage);
            auto builder = &builderStorage;
            builder->setInsertBefore(inst);

            auto base = inst->getResultOperand();
            auto loweredResultTypeInfo = getLoweredResultType(builder, base->getDataType());
            SLANG_ASSERT(loweredResultTypeInfo);
            SLANG_ASSERT(loweredResultTypeInfo->valueField);
            auto getElement = builder->emitFieldExtract(
                loweredResultTypeInfo->errorType,
                base,
                loweredResultTypeInfo->valueField->getKey());
            inst->replaceUsesWith(getElement);
            inst->removeAndDeallocate();
        }

        void processIsResultError(IRIsResultError* inst)
        {
            IRBuilder builderStorage(sharedBuilderStorage);
            auto builder = &builderStorage;
            builder->setInsertBefore(inst);

            auto base = inst->getResultOperand();
            auto loweredResultTypeInfo = getLoweredResultType(builder, base->getDataType());
            SLANG_ASSERT(loweredResultTypeInfo);
            SLANG_ASSERT(loweredResultTypeInfo->valueField);

            auto resultValue = inst->getResultOperand();
            auto errValue = getResultError(builder, resultValue);
            auto isSuccess =
                builder->emitNeq(errValue, getSuccessErrorValue(loweredResultTypeInfo->errorType));
            inst->replaceUsesWith(isSuccess);
            inst->removeAndDeallocate();
        }

        void processResultType(IRResultType* inst)
        {
            IRBuilder builderStorage(sharedBuilderStorage);
            auto builder = &builderStorage;
            builder->setInsertBefore(inst);

            auto loweredResultTypeInfo = getLoweredResultType(builder, inst);
            SLANG_ASSERT(loweredResultTypeInfo);
            SLANG_UNUSED(loweredResultTypeInfo);
        }

        void processInst(IRInst* inst)
        {
            switch (inst->getOp())
            {
            case kIROp_MakeResultValue:
                processMakeResultValue((IRMakeResultValue*)inst);
                break;
            case kIROp_MakeResultError:
                processMakeResultError((IRMakeResultError*)inst);
                break;
            case kIROp_GetResultError:
                processGetResultError((IRGetResultError*)inst);
                break;
            case kIROp_GetResultValue:
                processGetResultValue((IRGetResultValue*)inst);
                break;
            case kIROp_IsResultError:
                processIsResultError((IRIsResultError*)inst);
                break;
            case kIROp_ResultType:
                processResultType((IRResultType*)inst);
                break;
            default:
                break;
            }
        }

        void processModule()
        {
            SharedIRBuilder* sharedBuilder = &sharedBuilderStorage;
            sharedBuilder->init(module);

            // Deduplicate equivalent types.
            sharedBuilder->deduplicateAndRebuildGlobalNumberingMap();

            addToWorkList(module->getModuleInst());

            while (workList.getCount() != 0)
            {
                IRInst* inst = workList.getLast();

                workList.removeLast();
                workListSet.Remove(inst);

                processInst(inst);

                for (auto child = inst->getLastChild(); child; child = child->getPrevInst())
                {
                    addToWorkList(child);
                }
            }

            // Replace all result types with lowered struct types.
            for (auto kv : loweredResultTypes)
            {
                kv.Key->replaceUsesWith(kv.Value->loweredType);
            }
        }
    };

    void lowerResultType(IRModule* module, DiagnosticSink* sink)
    {
        ResultTypeLoweringContext context;
        context.module = module;
        context.sink = sink;
        context.processModule();
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you 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.
-->

<forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://ofbiz.apache.org/Widget-Form" xsi:schemaLocation="http://ofbiz.apache.org/Widget-Form http://ofbiz.apache.org/dtds/widget-form.xsd">
    <form name="ListWorkEffortCommEvents" separate-columns="false" target="updateCommunicationEventWorkEff" title="" type="list"
        odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar">
        <actions>
            <entity-condition entity-name="WorkEffortCommunicationEventView">
                <condition-list combine="and">
                    <condition-expr field-name="workEffortId" operator="equals" from-field="workEffortId"/>
                </condition-list>
                <order-by field-name="communicationEventId"/>
            </entity-condition>
        </actions>
        <field name="workEffortId"><hidden/></field>
        <field name="communicationEventId"  widget-style="buttontext">
            <hyperlink description="${communicationEventId}" target="/partymgr/control/EditCommunicationEvent" target-type="inter-app">
                <parameter param-name="communicationEventId"/>
            </hyperlink>
        </field>
        <field name="statusId"><display-entity entity-name="StatusItem"/></field>
        <field name="contactMechTypeId"><display-entity entity-name="ContactMechType"/></field>
        <field name="description"><text size="40"/></field>
        <field name="submitButton" title="${uiLabelMap.CommonUpdate}" widget-style="buttontext"><submit button-type="text-link"/></field>
        <field name="deleteLink" title=" " widget-style="buttontext">
            <hyperlink description="${uiLabelMap.CommonDelete}" target="deleteCommunicationEventWorkEff" also-hidden="false">
                <parameter param-name="workEffortId"/>
                <parameter param-name="communicationEventId"/>
            </hyperlink>
        </field>
    </form>
    <form name="AddWorkEffortCommEvent" default-map-name="communicationEvent" target="createWorkEffortCommEvent" title="" type="single" extends="EditCommEvent"
        extends-resource="component://party/widget/partymgr/CommunicationEventForms.xml" header-row-style="header-row" default-table-style="basic-table">
        <actions>
            <set field="communicationEvent"/>
        </actions>
        <field name="workEffortId"><hidden/></field>
        <field name="description"><textarea/></field>
        <field name="communicationEventId"><lookup target-form-name="LookupCommEvent"/></field>
        <field name="submitButton" title="${uiLabelMap.CommonAdd}" widget-style="buttontext"><submit button-type="text-link"/></field>
        <sort-order>
            <banner left-text="${uiLabelMap.WorkEffortBanner3}"/>
            <sort-field name="workEffortId"/>
            <sort-field name="communicationEventId"/>
            <banner left-text="${uiLabelMap.WorkEffortBanner4}"/>
            <sort-field name="description"/>
        </sort-order>
    </form>
</forms>


text:
// Copyright 2012 Google Inc.
//
// 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.

/** @param {Element} element */
var getEventListeners = function(element) { };

/**
 * @type {Element}
 */
HTMLLabelElement.prototype.control;

/**
 * @type {ShadowRoot}
 */
ShadowRoot.prototype.olderShadowRoot;

/**
 * @constructor
 * @extends {HTMLElement}
 */
function HTMLContentElement() {}

/**
 * @return {Array.<Node>}
 */
HTMLContentElement.prototype.getDistributedNodes = function() {};

/**
 * @constructor
 * @extends {HTMLElement}
 */
function HTMLShadowElement() {}

/**
 * @return {Array.<Node>}
 */
HTMLShadowElement.prototype.getDistributedNodes = function() {};

/**
 * Note: will be deprecated at some point; prefer shadowRoot if it exists.
 * @type {HTMLShadowElement}
 */
HTMLElement.prototype.webkitShadowRoot;


text:
<?php

class ingresos extends CI_Controller{

public function __construct(){

	parent::__construct();
	$this->load->model('ingreso');
	$this->load->helper('url');
	$this->load->library('session');

	//Si no hay session redirige a Login
	if(! $this->session->userdata('logged_in')){
	redirect('dashboard');
	}

	if( ! ini_get('date.timezone') ){
	    date_default_timezone_set('GMT');
	    setlocale(LC_ALL,"es_ES");
	    setlocale(LC_TIME, 'es_AR');
	}

	$this->data['thumbnail_sizes'] = array(); //thumbnails sizes

}

public function index(){
	//Pagination
	$per_page = 4;
	$page = $this->uri->segment(3);
	if(!$page){ $start =0; $page =1; }else{ $start = ($page -1 ) * $per_page; }
		$data['pagination_links'] = "";
		$total_pages = ceil($this->ingreso->count_rows() / $per_page);

		if ($total_pages > 1){
			for ($i=1;$i<=$total_pages;$i++){
			if ($page == $i)
				//si muestro el índice de la página actual, no coloco enlace
				$data['pagination_links'] .=  '
'.$i.'
';
			else
				//si el índice no corresponde con la página mostrada actualmente, coloco el enlace para ir a esa pagina
				$data['pagination_links']  .= '
 '. $i .'
';
		}
	}
	//End Pagination

	$data['title'] = 'ingresos';
	$data['menu'] = 'control/ingresos/menu_ingreso';
	$data['content'] = 'control/ingresos/all';
	$data['query'] = $this->ingreso->get_records($per_page,$start);

	$this->load->view('control/control_layout', $data);

}

//detail
public function detail(){

$data['title'] = 'ingreso';
$data['content'] = 'control/ingresos/detail';
$data['menu'] = 'control/ingresos/menu_ingreso';
$data['query'] = $this->ingreso->get_record($this->uri->segment(4));
$this->load->view('control/control_layout', $data);
}

//new
public function form_new(){
$this->load->helper('form');
$data['title'] = 'Nuevo ingreso';
$data['content'] = 'control/ingresos/new_ingreso';
$data['menu'] = 'control/ingresos/menu_ingreso';
$this->load->view('control/control_layout', $data);
}

//create
public function create(){

	$this->load->helper('form');
	$this->load->library('form_validation');
$this->form_validation->set_rules('pedido_id', 'Pedido_id', 'required');

$this->form_validation->set_rules('monto', 'Monto', 'required');

$this->form_validation->set_rules('porcentaje', 'Porcentaje', 'required');

$this->form_validation->set_rules('tipo', 'Tipo', 'required');

$this->form_validation->set_rules('banco', 'Banco', 'required');

$this->form_validation->set_rules('numero_cheque', 'Numero_cheque', 'required');

$this->form_validation->set_rules('vencimiento', 'Vencimiento', 'required');

$this->form_validation->set_rules('fecha', 'Fecha', 'required');

$this->form_validation->set_rules('created_at', 'Created_at', 'required');

$this->form_validation->set_rules('observaciones', 'Observaciones', 'required');

	if ($this->form_validation->run() === FALSE){

		$this->load->helper('form');
		$data['title'] = 'Nuevo ingresos';
		$data['content'] = 'control/ingresos/new_ingreso';
		$data['menu'] = 'control/ingresos/menu_ingreso';
		$this->load->view('control/control_layout', $data);

	}else{

		if($this->input->post('slug')){
			$this->load->helper('url');
			$slug = url_title($this->input->post('titulo'), 'dash', TRUE);
		}

		$newingreso = array( 'pedido_id' => $this->input->post('pedido_id'),
 'monto' => $this->input->post('monto'),
 'porcentaje' => $this->input->post('porcentaje'),
 'tipo' => $this->input->post('tipo'),
 'banco' => $this->input->post('banco'),
 'numero_cheque' => $this->input->post('numero_cheque'),
 'vencimiento' => $this->input->post('vencimiento'),
 'fecha' => $this->input->post('fecha'),
 'created_at' => $this->input->post('created_at'),
 'observaciones' => $this->input->post('observaciones'),
);
		#save
		$this->ingreso->add_record($newingreso);
		$this->session->set_flashdata('success', 'ingreso creado. db->insert_id().'">Ver');
		redirect('control/ingresos', 'refresh');

	}

}

//edit
public function editar(){
	$this->load->helper('form');
	$data['title']= 'Editar ingreso';
	$data['content'] = 'control/ingresos/edit_ingreso';
	$data['menu'] = 'control/ingresos/menu_ingreso';
	$data['query'] = $this->ingreso->get_record($this->uri->segment(4));
	$this->load->view('control/control_layout', $data);
}

//update
public function update(){
	$this->load->helper('form');
	$this->load->library('form_validation');
$this->form_validation->set_rules('pedido_id', 'Pedido_id', 'required');

$this->form_validation->set_rules('monto', 'Monto', 'required');

$this->form_validation->set_rules('porcentaje', 'Porcentaje', 'required');

$this->form_validation->set_rules('tipo', 'Tipo', 'required');

$this->form_validation->set_rules('banco', 'Banco', 'required');

$this->form_validation->set_rules('numero_cheque', 'Numero_cheque', 'required');

$this->form_validation->set_rules('vencimiento', 'Vencimiento', 'required');

$this->form_validation->set_rules('fecha', 'Fecha', 'required');

$this->form_validation->set_rules('created_at', 'Created_at', 'required');

$this->form_validation->set_rules('observaciones', 'Observaciones', 'required');

	$this->form_validation->set_message('required','El campo %s es requerido.');

	if ($this->form_validation->run() === FALSE){
		$this->load->helper('form');

		$data['title'] = 'Nuevo ingreso';
		$data['content'] = 'control/ingresos/edit_ingreso';
		$data['menu'] = 'control/ingresos/menu_ingreso';
		$data['query'] = $this->ingreso->get_record($this->input->post('id'));
		$this->load->view('control/control_layout', $data);
	}else{
		$id=  $this->input->post('id');

		if($this->input->post('slug')){
			$this->load->helper('url');
			$slug = url_title($this->input->post('titulo'), 'dash', TRUE);
		}

		$editedingreso = array(
'pedido_id' => $this->input->post('pedido_id'),

'monto' => $this->input->post('monto'),

'porcentaje' => $this->input->post('porcentaje'),

'tipo' => $this->input->post('tipo'),

'banco' => $this->input->post('banco'),

'numero_cheque' => $this->input->post('numero_cheque'),

'vencimiento' => $this->input->post('vencimiento'),

'fecha' => $this->input->post('fecha'),

'created_at' => $this->input->post('created_at'),

'observaciones' => $this->input->post('observaciones'),
);
		#save
		$this->session->set_flashdata('success', 'ingreso Actualizado!');
		$this->ingreso->update_record($id, $editedingreso);
		if($this->input->post('id')!=""){
			redirect('control/ingresos', 'refresh');
		}else{
			redirect('control/ingresos', 'refresh');
		}

	}

}

//delete comfirm
public function delete_comfirm(){
	$this->load->helper('form');
	$data['content'] = 'control/ingresos/comfirm_delete';
	$data['title'] = 'Eliminar ingreso';
	$data['menu'] = 'control/ingresos/menu_ingreso';
	$data['query'] = $data['query'] = $this->ingreso->get_record($this->uri->segment(4));
	$this->load->view('control/control_layout', $data);

}

//delete
public function delete(){

	$this->load->helper('form');
	$this->load->library('form_validation');

	$this->form_validation->set_rules('comfirm', 'comfirm', 'required');
	$this->form_validation->set_message('required','Por favor, confirme para eliminar.');

	if ($this->form_validation->run() === FALSE){
		#validation failed
		$this->load->helper('form');

		$data['content'] = 'control/ingresos/comfirm_delete';
		$data['title'] = 'Eliminar ingreso';
		$data['menu'] = 'control/ingresos/menu_ingreso';
		$data['query'] = $this->ingreso->get_record($this->input->post('id'));
		$this->load->view('control/control_layout', $data);
	}else{
		#validation passed
		$this->session->set_flashdata('success', 'ingreso eliminado!');

		$prod = $this->ingreso->get_record($this->input->post('id'));
			$path = 'images-ingresos/'.$prod->filename;
			if(is_link($path)){
				unlink($path);
			}

		$this->ingreso->delete_record();
		redirect('control/ingresos', 'refresh');

	}
}

} //end class

?>


text:
package com.appleframework.pay.trade.utils;

import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;

import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 功能说明:商户API工具类
 *
 * @author  Cruise.Xu
 * appleframework(http://www.appleframework.com)
 */
public class MerchantApiUtil {

    private static final Logger logger = LoggerFactory.getLogger(MerchantApiUtil.class);

    /**
     * 获取参数签名
     * @param paramMap  签名参数
     * @param paySecret 签名密钥
     * @return
     */
    public static String  getSign (Map<String , Object> paramMap , String paySecret){
        SortedMap<String, Object> smap = new TreeMap<String, Object>(paramMap);
        StringBuffer stringBuffer = new StringBuffer();
        for (Map.Entry<String, Object> m : smap.entrySet()) {
            Object value = m.getValue();
            if (value != null && StringUtils.isNotBlank(String.valueOf(value))){
                stringBuffer.append(m.getKey()).append("=").append(value).append("&");
            }
        }
        stringBuffer.delete(stringBuffer.length() - 1, stringBuffer.length());

        String argPreSign = stringBuffer.append("&paySecret=").append(paySecret).toString();
        String signStr = MD5Util.encode(argPreSign).toUpperCase();

        return signStr;
    }

    /**
     * 获取参数拼接串
     * @param paramMap
     * @return
     */
    public static String  getParamStr(Map<String , Object> paramMap){
        SortedMap<String, Object> smap = new TreeMap<String, Object>(paramMap);
        StringBuffer stringBuffer = new StringBuffer();
        for (Map.Entry<String, Object> m : smap.entrySet()) {
            Object value = m.getValue();
            if (value != null && StringUtils.isNotBlank(String.valueOf(value))){
                stringBuffer.append(m.getKey()).append("=").append(value).append("&");
            }
        }
        stringBuffer.delete(stringBuffer.length() - 1, stringBuffer.length());

        return stringBuffer.toString();
    }

    /**
     * 验证商户签名
     * @param paramMap  签名参数
     * @param paySecret 签名私钥
     * @param signStr   原始签名密文
     * @return
     */
    public static boolean isRightSign(Map<String , Object> paramMap , String paySecret ,String signStr){

        if (StringUtils.isBlank(signStr)){
            return false;
        }

        String sign = getSign(paramMap, paySecret);
        if(signStr.equals(sign)){
            return true;
		} else {
			logger.warn("the right sign: " + sign);
            return false;
        }
    }

}


text:
require 'date'
require 'rest_client'

module BlowOrSlow
  class Visitor
    def initialize position, key, options
      @position = position
      @api_key = key
      @options = options || {}
      @base_url = "https://api.forecast.io/forecast/#{@api_key}/#{@position[:lat]},#{@position[:long]}"
    end

    def get(date)
      @date = date

      response = RestClient.get url, { :params => @options }
      response.body
    end

    def url
      @base_url + ",#{@date.to_time.to_i}"
    end

  end
end


text:
# dmskabs2

> Compute the [squared absolute value][@stdlib/math/base/special/abs2] for each element in a double-precision floating-point strided array according to a strided mask array.

## Usage

```javascript
var dmskabs2 = require( '@stdlib/math/strided/special/dmskabs2' );
```

#### dmskabs2( N, x, sx, m, sm, y, sy )

Computes the [squared absolute value][@stdlib/math/base/special/abs2] for each element in a double-precision floating-point strided array `x` according to a strided mask array and assigns the results to elements in a double-precision floating-point strided array `y`.

```javascript
var Float64Array = require( '@stdlib/array/float64' );
var Uint8Array = require( '@stdlib/array/uint8' );

var x = new Float64Array( [ -2.0, 1.0, -3.0, -5.0, 4.0 ] );
var m = new Uint8Array( [ 0, 0, 1, 0, 1 ] );
var y = new Float64Array( x.length );

dmskabs2( x.length, x, 1, m, 1, y, 1 );
// y => <Float64Array>[ 4.0, 1.0, 0.0, 25.0, 0.0 ]
```

The function accepts the following arguments:

-   **N**: number of indexed elements.
-   **x**: input [`Float64Array`][@stdlib/array/float64].
-   **sx**: index increment for `x`.
-   **m**: mask [`Uint8Array`][@stdlib/array/uint8].
-   **sm**: index increment for `m`.
-   **y**: output [`Float64Array`][@stdlib/array/float64].
-   **sy**: index increment for `y`.

The `N` and stride parameters determine which strided array elements are accessed at runtime. For example, to index every other value in `x` and to index the first `N` elements of `y` in reverse order,

```javascript
var Float64Array = require( '@stdlib/array/float64' );
var Uint8Array = require( '@stdlib/array/uint8' );

var x = new Float64Array( [ -2.0, 1.0, -3.0, -5.0, 4.0, 0.0 ] );
var m = new Uint8Array( [ 0, 0, 1, 0, 1, 1 ] );
var y = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );

dmskabs2( 3, x, 2, m, 2, y, -1 );
// y => <Float64Array>[ 0.0, 0.0, 4.0, 0.0, 0.0, 0.0 ]
```

Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][@stdlib/array/float64] views.

```javascript
var Float64Array = require( '@stdlib/array/float64' );
var Uint8Array = require( '@stdlib/array/uint8' );

// Initial arrays...
var x0 = new Float64Array( [ -2.0, 1.0, -3.0, -5.0, 4.0, 0.0 ] );
var m0 = new Uint8Array( [ 0, 0, 1, 0, 1, 1 ] );
var y0 = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );

// Create offset views...
var x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
var m1 = new Uint8Array( m0.buffer, m0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
var y1 = new Float64Array( y0.buffer, y0.BYTES_PER_ELEMENT*3 ); // start at 4th element

dmskabs2( 3, x1, -2, m1, -2, y1, 1 );
// y0 => <Float64Array>[ 0.0, 0.0, 0.0, 0.0, 25.0, 1.0 ]
```

#### dmskabs2.ndarray( N, x, sx, ox, m, sm, om, y, sy, oy )

Computes the [squared absolute value][@stdlib/math/base/special/abs2] for each element in a double-precision floating-point strided array `x` according to a strided mask array and assigns the results to elements in a double-precision floating-point strided array `y` using alternative indexing semantics.

```javascript
var Float64Array = require( '@stdlib/array/float64' );
var Uint8Array = require( '@stdlib/array/uint8' );

var x = new Float64Array( [ -2.0, 1.0, -3.0, -5.0, 4.0 ] );
var m = new Uint8Array( [ 0, 0, 1, 0, 1 ] );
var y = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0 ] );

dmskabs2.ndarray( x.length, x, 1, 0, m, 1, 0, y, 1, 0 );
// y => <Float64Array>[ 4.0, 1.0, 0.0, 25.0, 0.0 ]
```

The function accepts the following additional arguments:

-   **ox**: starting index for `x`.
-   **om**: starting index for `m`.
-   **oy**: starting index for `y`.

While [`typed array`][@stdlib/array/float64] views mandate a view offset based on the underlying `buffer`, the offset parameters support indexing semantics based on starting indices. For example, to index every other value in `x` starting from the second value and to index the last `N` elements in `y`,

```javascript
var Float64Array = require( '@stdlib/array/float64' );
var Uint8Array = require( '@stdlib/array/uint8' );

var x = new Float64Array( [ -2.0, 1.0, -3.0, -5.0, 4.0, 0.0 ] );
var m = new Uint8Array( [ 0, 0, 1, 0, 1, 1 ] );
var y = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );

dmskabs2.ndarray( 3, x, 2, 1, m, 2, 1, y, -1, y.length-1 );
// y => <Float64Array>[ 0.0, 0.0, 0.0, 0.0, 25.0, 1.0 ]
```

## Examples

```javascript
var uniform = require( '@stdlib/random/base/uniform' );
var Float64Array = require( '@stdlib/array/float64' );
var Uint8Array = require( '@stdlib/array/uint8' );
var dmskabs2 = require( '@stdlib/math/strided/special/dmskabs2' );

var x = new Float64Array( 10 );
var m = new Uint8Array( 10 );
var y = new Float64Array( 10 );

var i;
for ( i = 0; i < x.length; i++ ) {
    x[ i ] = uniform( -100.0, 100.0 );
    if ( uniform( 0.0, 1.0 ) < 0.5 ) {
        m[ i ] = 1;
    }
}
console.log( x );
console.log( m );
console.log( y );

dmskabs2.ndarray( x.length, x, 1, 0, m, 1, 0, y, -1, y.length-1 );
console.log( y );
```

* * *

## C APIs

### Usage

```c
#include "stdlib/math/strided/special/dmskabs2.h"
```

#### stdlib_strided_dmskabs2( N, \*X, strideX, \*Mask, strideMask, \*Y, strideY )

Computes the [squared absolute value][@stdlib/math/base/special/abs2] for each element in a double-precision floating-point strided array `X` according to a strided mask array and assigns the results to elements in a double-precision floating-point strided array `Y`.

```c
#include <stdint.h>

double X[] = { -2.0, 1.0, -3.0, -5.0, 4.0, 0.0, -1.0, -3.0 };
uint8_t Mask[] = { 0, 0, 1, 0, 1, 1, 0, 0 };
double Y[] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };

int64_t N = 4;

stdlib_strided_dmskabs2( N, X, 2, Mask, 2, Y, 2 );
```

The function accepts the following arguments:

-   **N**: `[in] int64_t` number of indexed elements.
-   **X**: `[in] double*` input array.
-   **strideX**: `[in] int64_t` index increment for `X`.
-   **Mask**: `[in] uint8_t*` mask array.
-   **strideMask**: `[in] int64_t` index increment for `Mask`.
-   **Y**: `[out] double*` output array.
-   **strideY**: `[in] int64_t` index increment for `Y`.

```c
void stdlib_strided_dmskabs2( const int64_t N, const double *X, const int64_t strideX, const uint8_t *Mask, const int64_t strideMask, double *Y, const int64_t strideY );
```

### Examples

```c
#include "stdlib/math/strided/special/dmskabs2.h"
#include <stdint.h>
#include <stdio.h>

int main() {
    // Create an input strided array:
    double X[] = { -2.0, 1.0, -3.0, -5.0, 4.0, 0.0, -1.0, -3.0 };

    // Create a mask strided array:
    uint8_t M[] = { 0, 0, 1, 0, 1, 1, 0, 0 };

    // Create an output strided array:
    double Y[] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };

    // Specify the number of elements:
    int64_t N = 4;

    // Specify the stride lengths:
    int64_t strideX = 2;
    int64_t strideM = 2;
    int64_t strideY = 2;

    // Compute the results:
    stdlib_strided_dmskabs2( N, X, strideX, M, strideM, Y, strideY );

    // Print the results:
    for ( int i = 0; i < 8; i++ ) {
        printf( "Y[ %i ] = %lf\n", i, Y[ i ] );
    }
}
```

* * *

## See Also

-   [`@stdlib/math/strided/special/dabs2`][@stdlib/math/strided/special/dabs2]: compute the squared absolute value for each element in a double-precision floating-point strided array.
-   [`@stdlib/math/strided/special/dmskabs`][@stdlib/math/strided/special/dmskabs]: compute the absolute value for each element in a double-precision floating-point strided array according to a strided mask array.
-   [`@stdlib/math/strided/special/smskabs2`][@stdlib/math/strided/special/smskabs2]: compute the squared absolute value for each element in a single-precision floating-point strided array according to a strided mask array.

[@stdlib/array/float64]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/float64

[@stdlib/math/base/special/abs2]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/base/special/abs2

[@stdlib/array/uint8]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/uint8

[@stdlib/math/strided/special/dabs2]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/strided/special/dabs2

[@stdlib/math/strided/special/dmskabs]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/strided/special/dmskabs

[@stdlib/math/strided/special/smskabs2]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/strided/special/smskabs2


text:
use serde::{Deserialize, Serialize};

// Generate Rust types for the Google Docs API
//
// The `./gdoc.json` file was downloaded manually from https://docs.googleapis.com/$discovery/rest?version=v1
// and the top level property "schemas" changed to "definitions".
//
// That URL requires authentication (?!) and is not expected to change much. That's why we haven't bothered
// creating a curl+sed script for doing the above.
schemafy::schemafy!("src/gdoc.json");


text:
(function ($) {
    'use strict';

    $('table thead th.sortable').on('click', function () {
        window.location = $(this).find('a').attr('href');
    })
}) (jQuery);


text:
MozTrap
=======

This is the MozTrap test case management system.  It lives at
https://github.com/mozilla/moztrap/.

Documentation
-------------

For more information about setting up, developing, and using MozTrap, see the
documentation in the `docs/` directory (or `read it online`_).

To build and view an HTML version of the documentation::

    $ cd docs
    $ pip install sphinx
    $ make html
    $ firefox _build/html/index.html

.. _read it online: http://moztrap.readthedocs.org

Related repositories
--------------------

There are `Selenium`_ tests for MozTrap in the `moztrap-tests`_ repository.

MozTrap's Python dependencies are available as sdist tarballs in the
`moztrap-reqs`_ repository, and as an unpacked vendor library in the
`moztrap-vendor-lib`_ repository. These are included as submodules of
this repository, at ``requirements/dist`` and ``requirements/vendor``
respectively.

.. _Selenium: http://seleniumhq.org
.. _moztrap-tests: https://github.com/mozilla/moztrap-tests
.. _moztrap-reqs: https://github.com/mozilla/moztrap-reqs
.. _moztrap-vendor-lib: https://github.com/mozilla/moztrap-vendor-lib

Live Site
=======
you can see moztrap in action at

[https://moztrap.mozilla.org](https://moztrap.mozilla.org) Live site

[https://moztrap.allizom.org](https://moztrap.allizom.org) Stage site


text:
var mongo = require('mongodb').MongoClient;

/**
 * This is used to connect to mongodb.
 **/
var dbinfo = require ('./config.json');
var url = 'mongodb://' + dbinfo.user + ':' + dbinfo.password + '@' + dbinfo.location +
			':' + dbinfo.port +'/' + dbinfo.name;

/**
 * Author: Jason Klamert
 * Date: 3/15/2017
 * Description: Gets the framework catalog of a specific framework
 **/
exports.findFrameworkByName = function(req, res) {
    var name = req.params.name;
    console.log('Retrieving framework: ' + name);
    //set up connection with db
	mongo.connect (url, function (err, db)
	{
        if (err)throw err;

			//query collection by pattern
			db.collection('frameworks').find ({"framework": "" + name, "type": "catalog"}).toArray (function (err, result)
			{

				res.send (result);
			});

		db.close ();
	});
};

/**
 * Author: Jason Klamert
 * Date: 3/15/2017
 * Description: Gets all of the frameworks.
 **/
exports.findAllFrameworks = function(req, res) {

    console.log("Retrieving all frameworks!");
	//set up connection with db
	mongo.connect (url, function (err, db)
	{
        if (err)throw err;

			//query collection by pattern
			db.collection('frameworks').find ({"type": "catalog"}).toArray (function (err, result)
			{
				res.send (result);
			});

		db.close ();
	});
};

/**
 * Author: Jason Klamert
 * Date: 3/15/2017
 * Description: Gets all of the controls for a framework.
 **/
exports.findAllFrameworkControls = function(req, res) {
    var name = req.params.name;
    console.log('Retrieving framework: ' + name + " and all framework controls!");

	//connect using mongo and the database url then close
	mongo.connect (url, function (err, db){
		if (err)throw err;

		//query collection by pattern
		db.collection('frameworks').find ({"framework": ""  + name, "type": "control" }).toArray (function (err, result)
		{
				res.send (result);
		});

		//close the database connection after query
		db.close ();
	});

};

/**
 * Author: Jacob Taylor
 * Date: 4/30/2017
 * Description: Gets a associative array with a key of bustype and children of the different
 *	frameworks that belong to it.
 **/
exports.findBuisnessTypesList = function (req, res)
{
	//connect using mongo and the database url then close
	mongo.connect (url, function (err, db){
		if (err)throw err;

		console.log ("Getting a list of buisness types and corresponding frameowrks");
		//query collection for all catelogs and sort in ascending order
		db.collection('frameworks').find ({"type":"catalog"}).sort ({"busType": 1}).toArray (function (err, result)
		{

			var endResult = {};
			for (var i = 0; i < result.length; i++)
			{
				if (!endResult["" + result[i].busType])
					endResult[ "" + result[i].busType] = new Array();

				var temp = endResult[''+ result[i].busType];
				endResult["" + result[i].busType][temp.length] = "" +result[i].name + "";
			}

			console.log (endResult);
			var h = JSON.stringify (endResult);
			console.log (h);
			res.send (endResult);
		});

		//close the database connection after query
		db.close ();
	});
};

/**
 * Author: Jason Klamert
 * Date: 3/15/2017
 * Description: Find control by both framework name and control name.
 **/
exports.findFrameworkControlByFrameworkNameAndControlName = function(req, res) {
	var fname = req.params.fname;
	var name = req.params.name;

	console.log ("Getting control " + name + " from framework " + fname);

	//set up connection with db
	mongo.connect (url, function (err, db)
	{ if (err)throw err;

			//query collection by pattern
			db.collection('frameworks').find ({"framework": "" + fname, "name": "" + name, "type": "control"}).toArray (function (err, result)
			{

				res.send (result);
			});

		db.close ();
	});
};

/**
 * Author: Jason Klamert
 * Date: 3/15/2017
 * Description: Function that finds all frameworks with a given business type.
 **/
exports.findFrameworkByBusinessType = function(req, res) {
    var type = req.params.type;

    console.log ("Getting set of frameworks from type " + type);

    //set up connection with db
    mongo.connect (url, function (err, db)
    { if (err)throw err;

            //query collection by pattern
            db.collection('frameworks').find ({"busType": "" + type, "type": "catalog"}).toArray (function (err, result)
            {
                res.send (result);
            });

        db.close ();
    });
};

/**
 * Author: Jacob Taylor
 * Date: 3/15/2017
 * Description: Function that gets a reference document then finds all controls related to it
 **/
exports.findControlsByReference = function (req, res)
{
	var name = req.params.name;

	  console.log ("Getting controls by reference document " + name);

	  //get the controls from  a list of given references
	  var getcontrolsfromreference = function (references)
	  {
		   //set up connection with db
			mongo.connect (url, function (err, db)
			{ if (err)throw err;

				if (references.references)
				{
					db.collection('frameworks').find ({"id": {$in: references.references}}).toArray (function (err, result)
					{
						console.log (result);
						res.send (result);
					});
				}
				else if (references.description)
				{
					db.collection('frameworks').find ({"$text": {"$search": references.description}}).toArray (function (err, result)
					{
						console.log (result);
						res.send (result);
					});
				}

			db.close ();
		});
	  }

	  //get a reference document by name
	  var getreferencebyname = function (name, callback)
	  {
		   //set up connection with db
			mongo.connect (url, function (err, db)
			{ if (err)throw err;

				 //first get the reference document
				db.collection('references').find ({"name" : name}).toArray (function (err, result)
				{
					callback (result[0]);
				});

			db.close ();
		});
	  }

	  //do the various calls
	  getreferencebyname (name, getcontrolsfromreference);

};

/**
 * Author: Jason Klamert
 * Date: 4/16/2017
 * Description: Function that finds all similar controls from the provided description.
 **/
exports.findSimilarControlsByDescription = function (req, res)
{
	var description = req.params.description;

    console.log ("Getting set of similar controls based on description: " + description);

    //set up connection with db
    mongo.connect (url, function (err, db)
    { if (err)throw err;

    //query frameworks collection for similar controls by using the search text feature of mongodb.
    db.collection('frameworks').find ({
	"type": "control",
	"$text" : {
		"$search": "" + description
	}
	}).toArray (function (err, result)
            {
                res.send (result);
            });

        db.close ();
    });
}

/**
 * Author: Jason Klamert
 * Date: 4/21/2017
 * Description: Function that finds all similar controls from tag.
 **/
exports.findControlsByTag = function (req, res)
{
	var tag = req.params.tag;

    console.log ("Getting set of controls based on tag: " + tag);

    mongo.connect (url, function (err, db)
    { if (err)throw err;

    db.collection('frameworks').find ({
	"type": "control",
	"tag" : "" + tag

	}).toArray (function (err, result)
            {
                res.send (result);
            });

        db.close ();
    });
}

/**
 * Author: Jason Klamert
 * Date: 4/21/2017
 * Description: Function that updates a control object to have the given tag passed to the api.
 **/
exports.addTagToControl = function (req, res)
{
	var tag = req.params.tag;
	var control = req.params.control;

    console.log ("Adding tag: \"" + tag + "\" to control: \"" + control + "\".");

	/**
	 * Update the tag on the control from the database.
	 **/
	var updateControlWithTag = function(foundTag)
	{
			mongo.connect (url, function (err, db)
			{
				if (err)throw err;

	    		foundTag.push(tag);

			    /**
				 * Query the frameworks collection to take existing tags and insert a new tag.
				 **/
				db.collection('frameworks').updateOne({
					"_id" : "" + control,
					"type": "control",
					"name" : "" + control
				},
				{
					$set: {"tag": foundTag}
				});

				res.send();

			db.close ();
		});
	  }

	/**
	 * Get the control from the database.
	 **/
	var getControlByName = function (name, callback)
	{
		mongo.connect (url, function (err, db)
		{
			if (err)throw err;

			db.collection('frameworks').find({"_id" : "" + control, "name": "" + control, "type": "control"}).toArray(function (err, result)
			{
				callback (result[0].tag);
			});

		db.close ();
		});
	  }

	  getControlByName(control, updateControlWithTag);
}

/**
 * Author: Jacob Taylor
 * Date: 4/30/2017
 * Description: authenticate credentils with database
 **/
 exports.authenticateCredentials = function (username, password, callback)
 {
	 console.log ("Authenticating user with username " + username);

	//set up connection with db
    mongo.connect (url, function (err, db)
    { if (err)throw err;

			console.log (password);
            //query collection by pattern
            db.collection('credentials').find ({"username": "" + username, "password": "" + password}).toArray (function (err, result)
            {
				if (result.length > 0)
				{
					console.log (result);
					callback(null, "ACK");
				}
				else
					callback (null, "NACK");
            });

        db.close ();
    });
 }


text:
package org.workcraft.formula.sat;

import org.workcraft.formula.BooleanFormula;

public class OptimisationTask<T> {
    private final BooleanFormula[][] encodingVars;
    private final BooleanFormula[] functionVars;
    private final T task;

    public OptimisationTask(BooleanFormula[] functionVars, BooleanFormula[][] encodingVars, T task) {
        this.functionVars = functionVars;
        this.encodingVars = encodingVars;
        this.task = task;
    }

    public BooleanFormula[][] getEncodingVars() {
        return encodingVars;
    }
    public BooleanFormula[] getFunctionVars() {
        return functionVars;
    }

    public T getTask() {
        return task;
    }
}


text:
package prompt

import (
	"runtime"

	"github.com/c-bata/go-prompt/internal/debug"
	runewidth "github.com/mattn/go-runewidth"
)

// Render to render prompt information from state of Buffer.
type Render struct {
	out                ConsoleWriter
	prefix             string
	livePrefixCallback func() (prefix string, useLivePrefix bool)
	breakLineCallback  func(*Document)
	title              string
	row                uint16
	col                uint16

	previousCursor int

	// colors,
	prefixTextColor              Color
	prefixBGColor                Color
	inputTextColor               Color
	inputBGColor                 Color
	previewSuggestionTextColor   Color
	previewSuggestionBGColor     Color
	suggestionTextColor          Color
	suggestionBGColor            Color
	selectedSuggestionTextColor  Color
	selectedSuggestionBGColor    Color
	descriptionTextColor         Color
	descriptionBGColor           Color
	selectedDescriptionTextColor Color
	selectedDescriptionBGColor   Color
	scrollbarThumbColor          Color
	scrollbarBGColor             Color
}

// Setup to initialize console output.
func (r *Render) Setup() {
	if r.title != "" {
		r.out.SetTitle(r.title)
		debug.AssertNoError(r.out.Flush())
	}
}

// getCurrentPrefix to get current prefix.
// If live-prefix is enabled, return live-prefix.
func (r *Render) getCurrentPrefix() string {
	if prefix, ok := r.livePrefixCallback(); ok {
		return prefix
	}
	return r.prefix
}

func (r *Render) renderPrefix() {
	r.out.SetColor(r.prefixTextColor, r.prefixBGColor, false)
	r.out.WriteStr(r.getCurrentPrefix())
	r.out.SetColor(DefaultColor, DefaultColor, false)
}

// TearDown to clear title and erasing.
func (r *Render) TearDown() {
	r.out.ClearTitle()
	r.out.EraseDown()
	debug.AssertNoError(r.out.Flush())
}

func (r *Render) prepareArea(lines int) {
	for i := 0; i < lines; i++ {
		r.out.ScrollDown()
	}
	for i := 0; i < lines; i++ {
		r.out.ScrollUp()
	}
}

// UpdateWinSize called when window size is changed.
func (r *Render) UpdateWinSize(ws *WinSize) {
	r.row = ws.Row
	r.col = ws.Col
}

func (r *Render) renderWindowTooSmall() {
	r.out.CursorGoTo(0, 0)
	r.out.EraseScreen()
	r.out.SetColor(DarkRed, White, false)
	r.out.WriteStr("Your console window is too small...")
}

func (r *Render) renderCompletion(buf *Buffer, completions *CompletionManager) {
	suggestions := completions.GetSuggestions()
	if len(completions.GetSuggestions()) == 0 {
		return
	}
	prefix := r.getCurrentPrefix()
	formatted, width := formatSuggestions(
		suggestions,
		int(r.col)-runewidth.StringWidth(prefix)-1, // -1 means a width of scrollbar
	)
	// +1 means a width of scrollbar.
	width++

	windowHeight := len(formatted)
	if windowHeight > int(completions.max) {
		windowHeight = int(completions.max)
	}
	formatted = formatted[completions.verticalScroll : completions.verticalScroll+windowHeight]
	r.prepareArea(windowHeight)

	cursor := runewidth.StringWidth(prefix) + runewidth.StringWidth(buf.Document().TextBeforeCursor())
	x, _ := r.toPos(cursor)
	if x+width >= int(r.col) {
		cursor = r.backward(cursor, x+width-int(r.col))
	}

	contentHeight := len(completions.tmp)

	fractionVisible := float64(windowHeight) / float64(contentHeight)
	fractionAbove := float64(completions.verticalScroll) / float64(contentHeight)

	scrollbarHeight := int(clamp(float64(windowHeight), 1, float64(windowHeight)*fractionVisible))
	scrollbarTop := int(float64(windowHeight) * fractionAbove)

	isScrollThumb := func(row int) bool {
		return scrollbarTop <= row && row <= scrollbarTop+scrollbarHeight
	}

	selected := completions.selected - completions.verticalScroll
	r.out.SetColor(White, Cyan, false)
	for i := 0; i < windowHeight; i++ {
		r.out.CursorDown(1)
		if i == selected {
			r.out.SetColor(r.selectedSuggestionTextColor, r.selectedSuggestionBGColor, true)
		} else {
			r.out.SetColor(r.suggestionTextColor, r.suggestionBGColor, false)
		}
		r.out.WriteStr(formatted[i].Text)

		if i == selected {
			r.out.SetColor(r.selectedDescriptionTextColor, r.selectedDescriptionBGColor, false)
		} else {
			r.out.SetColor(r.descriptionTextColor, r.descriptionBGColor, false)
		}
		r.out.WriteStr(formatted[i].Description)

		if isScrollThumb(i) {
			r.out.SetColor(DefaultColor, r.scrollbarThumbColor, false)
		} else {
			r.out.SetColor(DefaultColor, r.scrollbarBGColor, false)
		}
		r.out.WriteStr(" ")
		r.out.SetColor(DefaultColor, DefaultColor, false)

		r.lineWrap(cursor + width)
		r.backward(cursor+width, width)
	}

	if x+width >= int(r.col) {
		r.out.CursorForward(x + width - int(r.col))
	}

	r.out.CursorUp(windowHeight)
	r.out.SetColor(DefaultColor, DefaultColor, false)
}

// Render renders to the console.
func (r *Render) Render(buffer *Buffer, completion *CompletionManager) {
	// In situations where a pseudo tty is allocated (e.g. within a docker container),
	// window size via TIOCGWINSZ is not immediately available and will result in 0,0 dimensions.
	if r.col == 0 {
		return
	}
	defer func() { debug.AssertNoError(r.out.Flush()) }()
	r.move(r.previousCursor, 0)

	line := buffer.Text()
	prefix := r.getCurrentPrefix()
	cursor := runewidth.StringWidth(prefix) + runewidth.StringWidth(line)

	// prepare area
	_, y := r.toPos(cursor)

	h := y + 1 + int(completion.max)
	if h > int(r.row) || completionMargin > int(r.col) {
		r.renderWindowTooSmall()
		return
	}

	// Rendering
	r.out.HideCursor()
	defer r.out.ShowCursor()

	r.renderPrefix()
	r.out.SetColor(r.inputTextColor, r.inputBGColor, false)
	r.out.WriteStr(line)
	r.out.SetColor(DefaultColor, DefaultColor, false)
	r.lineWrap(cursor)

	r.out.EraseDown()

	cursor = r.backward(cursor, runewidth.StringWidth(line)-buffer.DisplayCursorPosition())

	r.renderCompletion(buffer, completion)
	if suggest, ok := completion.GetSelectedSuggestion(); ok {
		cursor = r.backward(cursor, runewidth.StringWidth(buffer.Document().GetWordBeforeCursorUntilSeparator(completion.wordSeparator)))

		r.out.SetColor(r.previewSuggestionTextColor, r.previewSuggestionBGColor, false)
		r.out.WriteStr(suggest.Text)
		r.out.SetColor(DefaultColor, DefaultColor, false)
		cursor += runewidth.StringWidth(suggest.Text)

		rest := buffer.Document().TextAfterCursor()
		r.out.WriteStr(rest)
		cursor += runewidth.StringWidth(rest)
		r.lineWrap(cursor)

		cursor = r.backward(cursor, runewidth.StringWidth(rest))
	}
	r.previousCursor = cursor
}

// BreakLine to break line.
func (r *Render) BreakLine(buffer *Buffer) {
	// Erasing and Render
	cursor := runewidth.StringWidth(buffer.Document().TextBeforeCursor()) + runewidth.StringWidth(r.getCurrentPrefix())
	r.clear(cursor)
	r.renderPrefix()
	r.out.SetColor(r.inputTextColor, r.inputBGColor, false)
	r.out.WriteStr(buffer.Document().Text + "\n")
	r.out.SetColor(DefaultColor, DefaultColor, false)
	debug.AssertNoError(r.out.Flush())
	if r.breakLineCallback != nil {
		r.breakLineCallback(buffer.Document())
	}

	r.previousCursor = 0
}

// clear erases the screen from a beginning of input
// even if there is line break which means input length exceeds a window's width.
func (r *Render) clear(cursor int) {
	r.move(cursor, 0)
	r.out.EraseDown()
}

// backward moves cursor to backward from a current cursor position
// regardless there is a line break.
func (r *Render) backward(from, n int) int {
	return r.move(from, from-n)
}

// move moves cursor to specified position from the beginning of input
// even if there is a line break.
func (r *Render) move(from, to int) int {
	fromX, fromY := r.toPos(from)
	toX, toY := r.toPos(to)

	r.out.CursorUp(fromY - toY)
	r.out.CursorBackward(fromX - toX)
	return to
}

// toPos returns the relative position from the beginning of the string.
func (r *Render) toPos(cursor int) (x, y int) {
	col := int(r.col)
	return cursor % col, cursor / col
}

func (r *Render) lineWrap(cursor int) {
	if runtime.GOOS != "windows" && cursor > 0 && cursor%int(r.col) == 0 {
		r.out.WriteRaw([]byte{'\n'})
	}
}

func clamp(high, low, x float64) float64 {
	switch {
	case high < x:
		return high
	case x < low:
		return low
	default:
		return x
	}
}


text:
if (( $+commands[ansible-playbook] )); then
  alias aplay='ansible-playbook'
fi


text:
package com.tornado.sysmgr.dao.po;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import lombok.Data;

/**
 * 资源 PO
 *
 * @author dante
 *
 */
@Entity
@Table(name = "t_resource")
@Data
public class ResourcePO implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue
	private Long id;
	/**
	 * 资源名称
	 */
	private String name;
	/**
	 * 访问 url
	 */
	private String url;
	/**
	 * 层级Id
	 */
	private String fullId;
	/**
	 * 显示顺序
	 */
	private Integer showOrder;
	/**
	 * 更新人
	 */
	@ManyToOne(cascade = { CascadeType.REFRESH }, fetch = FetchType.LAZY)
	@JoinColumn(name = "update_user")
	private UserPO updateUser;
	/**
	 * 更新时间
	 */
	private Date updateDate;
	/**
	 * 服务模块
	 */
	@ManyToOne(cascade = { CascadeType.REFRESH }, fetch = FetchType.LAZY)
	@JoinColumn(name = "service_module_id")
	private ServiceModulePO serviceModule;

	/**
	 * 父节点
	 */
	@ManyToOne(cascade = { CascadeType.REFRESH }, fetch = FetchType.LAZY)
	@JoinColumn(name = "pid")
	private ResourcePO parentResource;

	/**
	 * 权限
	 */
	@ManyToOne(cascade = { CascadeType.REFRESH }, fetch = FetchType.LAZY)
	@JoinColumn(name = "authority_id")
	private AuthorityPO authority;

	public ResourcePO() {
		// 默认构造函数
	}

	public ResourcePO(Long id) {
		this.id = id;
	}

}


text:
package pib.gui;

import org.javatuples.Pair;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * This class is the main UI entity which enables the interaction with a user. UI state changes
 * (such as a triggered call to the backend) will be propagated to a registered UI listener (which
 * is most likely the Controller in this simple use-case).
 *
 * @author MD
 * @version 0.1
 * @since 30/12/2014
 */
public class PiBellWindow extends JFrame implements ActionListener {

    // The name of the Window
    private String title        = "PiBell-GUI";
    // Whether the PiBell-GUI runs in local mode or not
    private boolean isLocal     = false;
    // The UI listener that should be notified about state changes
    private UIListener listener;
    // Maps from contact name to Pair<online status label, last seen label>
    private Map<String, Pair<JLabel, JLabel>> statusMap = new HashMap<>();

    /**
     * Creates a new PiBell window object for the given listener and the network mode.
     * @param aListener The listener object that should be notified about state changes in the UI.
     * @param isLocal True - The PiBell-GUI runs in local mode.
     *                False - Otherwise.
     */
    public PiBellWindow(UIListener aListener, boolean isLocal) {
        this.listener = aListener;
        this.isLocal = isLocal;
        setSize(300, 100);
        setLocationRelativeTo(null);
        // Adjust the window title, if we're running in local mode
        if (this.isLocal) title += " - LOCAL VERSION";
        setTitle(title);
        setDefaultCloseOperation(DISPOSE_ON_CLOSE);
        setLayout(new GridLayout(1,3));
    }

    /**
     * Create a new entry in the window for a given contact name.
     * @param name The name of the contact for which a new row should be added to the UI.
     */
    public void showContact(String name) {
        JButton callButton = new JButton("Call somebody");
        callButton.setSize(150, 50);
        callButton.addActionListener(this);

        add(new JLabel(name));
        add(callButton);
        JLabel onlineStatus = new JLabel("offline");
        onlineStatus.setOpaque(true);
        onlineStatus.setBackground(Color.red);
        JLabel lastSeen     = new JLabel("never");
        this.statusMap.put(name, new Pair<>(onlineStatus, lastSeen));
        add(onlineStatus);
        add(lastSeen);
    }

    /**
     * Changes the visible 'status' flag of the given contact name.
     * @param name The name of the contact whose status should be changed.
     * @param isOnline Whether to change the status to online or offline.
     * @param lastSeen MS from 1970 when the contact was last seen online.
     */
    public void changeOnlineStatus(String name, boolean isOnline, long lastSeen) {
        if (this.statusMap.containsKey(name)) {
            System.out.println("Changing status of name: " + name);
            JLabel curStatus = this.statusMap.get(name).getValue0();
            if (isOnline) {
                curStatus.setBackground(Color.green);
                curStatus.setText("online");
            } else {
                curStatus.setBackground(Color.red);
                curStatus.setText("offline");
            }
            JLabel lastSeenLabel = this.statusMap.get(name).getValue1();
            String lastSeenText = lastSeen <= 0 ? "never" : new Date(lastSeen).toString();
            lastSeenLabel.setText(lastSeenText);
        }
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        // Currently, we're only having one action that could possible be propagated
        // (which is a triggered call)
        this.listener.callTriggered();
    }
}


text:
  {% include header-h1.html %}

    BRG loves conducting events ...


text:
//
//  GJGCInformationCellConstans.h
//  GJGroupChat
//
//  Created by ZYVincent QQ:1003081775 on 14-11-6.
//  Copyright (c) 2014年 ZYV. All rights reserved.
//

#import <Foundation/Foundation.h>

/**
 *  资料cell类型
 */
typedef NS_ENUM(NSUInteger, GJGCInformationContentType) {
    /**
     *  基本内容cell
     */
    GJGCInformationContentTypeBaseTextContent,
    /**
     *  等级cell
     */
    GJGCInformationContentTypeLevelType,
    /**
     *  个人加入的最近三个群组
     */
    GJGCInformationContentTypeGroupShow,
    /**
     *  群成员三个
     */
    GJGCInformationContentTypeMemberShow,
    /**
     *  文本内容带右侧icon
     */
    GJGCInformationContentTypeBaseTextAndIcon,
    /**
     *  个人相册展示
     */
    GJGCInformationContentTypePersonPhotoBox,
    /**
     *  群组相册展示
     */
    GJGCInformationContentTypeGroupPhotoBox,
    /**
     *  动态展示
     */
    GJGCInformationContentTypeFeedList,
    /**
     *  群组头像信息
     */
    GJGCInformationContentTypeGroupHeadInfo,
};

@interface GJGCInformationCellConstans : NSObject

+ (NSString *)identifierForContentType:(GJGCInformationContentType)contentType;

+ (Class)classForContentType:(GJGCInformationContentType)contentType;

@end


text:
namespace Silphid.Injexit
{
    public abstract class RootInstaller : Installer
    {
        protected override IContainer CreateContainer() =>
            new Container(new Reflector(), ShouldInject);

        protected virtual bool ShouldInject(object obj)
        {
            var ns = obj.GetType()
                        .Namespace;
            return ns == null || !ns.StartsWith("Unity") && !ns.StartsWith("TMPro");
        }
    }
}


text:
// Copyright 2020 The Bazel Authors. 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.

package com.google.devtools.build.skydoc.fakebuildapi.proto;

import com.google.common.collect.ImmutableList;
import com.google.devtools.build.lib.collect.nestedset.Depset;
import com.google.devtools.build.lib.starlarkbuildapi.FileApi;
import com.google.devtools.build.lib.starlarkbuildapi.ProtoInfoApi;
import net.starlark.java.eval.EvalException;
import net.starlark.java.eval.Printer;

/** Fake implementation of {@link ProtoInfoApi}. */
public class FakeProtoInfo implements ProtoInfoApi<FileApi> {

  @Override
  public Depset getTransitiveImports() {
    return null;
  }

  @Override
  public Depset getTransitiveProtoSourcesForStarlark() {
    return null;
  }

  @Override
  public ImmutableList<FileApi> getDirectProtoSources() {
    return null;
  }

  @Override
  public Depset getStrictImportableProtoSourcesForDependentsForStarlark() {
    return null;
  }

  @Override
  public FileApi getDirectDescriptorSet() {
    return null;
  }

  @Override
  public Depset getTransitiveDescriptorSetsForStarlark() {
    return null;
  }

  @Override
  public Depset getTransitiveProtoSourceRootsForStarlark() {
    return null;
  }

  @Override
  public String getDirectProtoSourceRoot() {
    return null;
  }

  @Override
  public String toProto() throws EvalException {
    return null;
  }

  @Override
  public String toJson() throws EvalException {
    return null;
  }

  @Override
  public void repr(Printer printer) {}

  /** Fake implementation of {@link ProtoInfoProviderApi}. */
  public static class FakeProtoInfoProvider implements ProtoInfoProviderApi {
    @Override
    public void repr(Printer printer) {}
  }
}


text:
package PracticeLeetCode;

public class _285InorderSuccessor {
	psvm

}


text:
<?php

namespace branding\LolitaFramework\Core\Decorators;

use \WP_Error;

class Error extends WP_Error
{
    /**
     * Add an error or append additional message to an existing error.
     *
     * @since 2.1.0
     * @access public
     *
     * @param string|int|WP_Error $code Error code.
     * @param string $message Error message.
     * @param mixed $data Optional. Error data.
     */
    public function add($code, $message, $data = '')
    {
        if (is_wp_error($code)) {
            $this->errors = array_merge($this->errors, $code->errors);
        } else {
            $this->errors[$code][] = $message;
            if (!empty($data)) {
                $this->error_data[$code] = $data;
            }
        }
    }

    /**
     * Maybe aadd
     * @param  mixed $code
     * @param  string $message
     * @param  string $data
     * @return boolean
     */
    public function maybeAdd($code, $message = '', $data = '')
    {
        if (self::is($code) || '' !== $message) {
            $this->add($code, $message, $data);
            return true;
        }
        return false;
    }

    /**
     * Has errors
     *
     * @return boolean
     */
    public function hasErrors()
    {
        return count($this->errors) > 0;
    }

    /**
     * Is wp error?
     *
     * @param  mixed  $mixed
     * @return boolean
     */
    public static function is($mixed)
    {
        return is_wp_error($mixed);
    }
}


text:
import ast
import sys
import os

# Writes a message to the shell
# Use for debugging your program
# Channels stdout and stdin are captured to enable communication with the maze
# Do not edit this code

def debug(text):

    # Writes to the stderr channel
    sys.stderr.write(str(text) + "\n")
    sys.stderr.flush()

##################################################################################################################

# Reads one line of information sent by the maze application
# This function is blocking, and will wait for a line to terminate
# The received information is automatically converted to the correct type
# Do not edit this code

def readFromPipe():

    # Reads from the stdin channel and returns the structure associated to the string
    try:
        text = sys.stdin.readline()
        return ast.literal_eval(text.strip())
    except:
        os._exit(-1)

##################################################################################################################

# Sends the text to the maze application
# Do not edit this code

def writeToPipe (text) :

    # Writes to the stdout channel
    sys.stdout.write(text)
    sys.stdout.flush()

##################################################################################################################

# Reads the initial maze information
# The function processes the text and returns the associated variables
# The dimensions of the maze are positive integers
# Maze map is a dictionary associating to a location its adjacent locations and the associated weights
# The preparation time gives the time during which 'initializationCode' can make computations before the game starts
# The turn time gives the time during which 'determineNextMove' can make computations before returning a decision
# Player locations are tuples (line, column)
# Coins are given as a list of locations where they appear
# A boolean indicates if the game is over
# Do not edit this code

def processInitialInformation () :

    # We read from the pipe
    data = readFromPipe()
    return (data['mazeWidth'], data['mazeHeight'], data['mazeMap'], data['preparationTime'], data['turnTime'], data['playerLocation'], data['opponentLocation'], data['coins'], data['gameIsOver'])

##################################################################################################################

# Reads the information after each player moved
# The maze map and allowed times are no longer provided since they do not change
# Do not edit this code

def processNextInformation () :

    # We read from the pipe
    data = readFromPipe()
    return (data['playerLocation'], data['opponentLocation'], data['coins'], data['gameIsOver'])

################################################################################
################# MAIN LOOP ################################################
##############################################################################

# This is the entry point when executing this file
# We first send the name of the team to the maze
# The first message we receive from the maze includes its dimensions and map, the times allowed to the various steps, and the players and coins locations
# Then, at every loop iteration, we get the maze status and determine a move
# Do not edit this code

def initGame(teamName):
    writeToPipe(teamName + "\n")
    return  processInitialInformation()

def startGameMainLoop(determineNextMove):
    # We decide how to move and wait for the next step
    gameIsOver = False
    while not gameIsOver:
        (playerLocation, opponentLocation, coins, gameIsOver) = processNextInformation()
        if gameIsOver:
            break
        nextMove = determineNextMove(playerLocation, opponentLocation, coins)
        writeToPipe(nextMove)

# We process the initial information and have a delay to compute things using it
# (mazeWidth, mazeHeight, mazeMap, preparationTime, turnTime, playerLocation, opponentLocation, coins, gameIsOver) = processInitialInformation()
# initializationCode(mazeWidth, mazeHeight, mazeMap, preparationTime, playerLocation, opponentLocation, coins)