text:
#include "mongodb_store/message_store.h"
#include "geometry_msgs/Pose.h"

#include <boost/foreach.hpp>
#include <gtest/gtest.h>

#include <sstream>

using namespace geometry_msgs;
using namespace mongodb_store;
using namespace std;

// Declare a test
TEST(ROSDatacentre, cppTest)
{
	ros::NodeHandle nh;

	//Create object which does the work for us.
	MessageStoreProxy messageStore(nh, "test_collection");

	//This is the message we want to store
	Pose stored;
	string name("__this__is__a__cpp__test__pose__");
	//Insert something with a name
	string id(messageStore.insertNamed(name, stored));

	vector< boost::shared_ptr<Pose> > results;

	//Get it back, by default get one
	if(messageStore.queryNamed<Pose>(name, results)) {
		EXPECT_EQ(1, results.size());
		EXPECT_EQ(stored.position.x, results[0]->position.x);
        EXPECT_EQ(stored.position.y, results[0]->position.y);
        EXPECT_EQ(stored.position.z, results[0]->position.z);
        EXPECT_EQ(stored.orientation.x, results[0]->orientation.x);
        EXPECT_EQ(stored.orientation.y, results[0]->orientation.y);
        EXPECT_EQ(stored.orientation.z, results[0]->orientation.z);
        EXPECT_EQ(stored.orientation.w, results[0]->orientation.w);
	}
	else {
		ADD_FAILURE() << "Name query didn't find: " << name;
	}

	if(messageStore.queryID<Pose>(id, results)) {

		BOOST_FOREACH( boost::shared_ptr<Pose> p,  results)
		{
			//ROS_INFO_STREAM("Got by ID: " << *p);
		}

	}

	stored.position.x = 999;
	messageStore.updateNamed(name, stored);
	//check the update worked
	results.clear();
	if(messageStore.queryNamed<Pose>(name, results)) {
		EXPECT_EQ(1, results.size());
		EXPECT_EQ(stored.position.x, results[0]->position.x);
        EXPECT_EQ(stored.position.y, results[0]->position.y);
        EXPECT_EQ(stored.position.z, results[0]->position.z);
        EXPECT_EQ(stored.orientation.x, results[0]->orientation.x);
        EXPECT_EQ(stored.orientation.y, results[0]->orientation.y);
        EXPECT_EQ(stored.orientation.z, results[0]->orientation.z);
        EXPECT_EQ(stored.orientation.w, results[0]->orientation.w);
	}
	else {
		ADD_FAILURE() << "Name query didn't find: " << name;
	}

	//check id query
	results.clear();
	if(messageStore.queryID<Pose>(id, results)) {
		EXPECT_EQ(1, results.size());
		EXPECT_EQ(stored.position.x, results[0]->position.x);
        EXPECT_EQ(stored.position.y, results[0]->position.y);
        EXPECT_EQ(stored.position.z, results[0]->position.z);
        EXPECT_EQ(stored.orientation.x, results[0]->orientation.x);
        EXPECT_EQ(stored.orientation.y, results[0]->orientation.y);
        EXPECT_EQ(stored.orientation.z, results[0]->orientation.z);
        EXPECT_EQ(stored.orientation.w, results[0]->orientation.w);
	}
	else {
		ADD_FAILURE() << "ID query didn't find: " << id;
	}

	// try to get it back with an incorrect name, so get None instead
	std::string wrongName(name + "some garbage addition");
	results.clear();
	if(messageStore.queryNamed<Pose>(wrongName, results)) {
		ADD_FAILURE() << "Name query shouldn't have found: " << wrongName;
	}
	else {
		EXPECT_EQ(0, results.size());
	}

	// get all poses, should be at least one
	results.clear();
	EXPECT_TRUE(messageStore.query<Pose>(results));
	EXPECT_GT(results.size(), 0);

	// Now delete the thing we added before
	messageStore.deleteID(id);

	results.clear();
	if(messageStore.queryID<Pose>(id, results)) {
		ADD_FAILURE() << "ID query shouldn't have found " << id << " after deletion";
	}
	else {
		EXPECT_EQ(0, results.size());
	}

	results.clear();
	if(messageStore.queryNamed<Pose>(name, results)) {
		ADD_FAILURE() << "Name query shouldn't have found " << name << " after deletion";
	}
	else {
		EXPECT_EQ(0, results.size());
	}

}

/**
 * This tutorial demonstrates simple sending of messages over the ROS system.
 */
int main(int argc, char **argv)
{
	testing::InitGoogleTest(&argc, argv);
	ros::init(argc, argv, "example_mongodb_store_cpp_client");
	return RUN_ALL_TESTS();
}


text:
package org.apache.onami.persist;

import com.google.inject.BindingAnnotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import javax.inject.Qualifier;

/**
 * Annotation to mark bindings which are specific for container managed persistence units.
 */
@Target({ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
@Qualifier
@BindingAnnotation
@interface UserTransactionJndiName {

}

redpajama_set_name: RedPajamaGithub


text:
package v1alpha1

import (
	"testing"
)

func TestListBuilderFuncWithAPIList(t *testing.T) {
	tests := map[string]struct {
		availableSCs    []string
		expectedSCCount int
	}{
		"StorageClass set 1": {[]string{"sc1"}, 1},
		"StorageClass set 2": {[]string{"sc1", "sc2"}, 2},
		"StorageClass set 3": {[]string{"sc1", "sc2", "sc3"}, 3},
		"StorageClass set 4": {[]string{"sc1", "sc2", "sc3"}, 3},
	}
	for name, mock := range tests {
		name := name // pin it
		mock := mock // pin it
		t.Run(name, func(t *testing.T) {
			b := ListBuilderForAPIList(fakeStorageClassListAPI(mock.availableSCs))
			if mock.expectedSCCount != len(b.list.items) {
				t.Fatalf("Test %v failed: expected %v got %v", name, mock.expectedSCCount, len(b.list.items))
			}
		})
	}
}

func TestListBuilderFuncWithEmptyStorageClassList(t *testing.T) {
	tests := map[string]struct {
		scCount, expectedSCCount int
	}{
		"StorageClass": {5, 5},
	}
	for name, mock := range tests {
		name := name // pin it
		mock := mock // pin it
		t.Run(name, func(t *testing.T) {
			b := ListBuilderForAPIList(fakeStorageClassListEmpty(mock.scCount))
			if mock.expectedSCCount != len(b.list.items) {
				t.Fatalf("Test %v failed: expected %v got %v", name, mock.expectedSCCount, len(b.list.items))
			}
		})
	}
}

func TestListBuilderForObjects(t *testing.T) {
	tests := map[string]struct {
		availableSCs    []string
		expectedSCCount int
	}{
		"StorageClass set 1": {[]string{}, 0},
		"StorageClass set 2": {[]string{"sc1"}, 1},
		"StorageClass set 3": {[]string{"sc1", "sc2"}, 2},
		"StorageClass set 4": {[]string{"sc1", "sc2", "sc3"}, 3},
	}
	for name, mock := range tests {
		name := name // pin it
		mock := mock // pin it
		t.Run(name, func(t *testing.T) {
			b := ListBuilderForObjects(fakeStorageClassListInstance(mock.availableSCs))
			if mock.expectedSCCount != len(b.list.items) {
				t.Fatalf("Test %v failed: expected %v got %v", name, mock.expectedSCCount, len(b.list.items))
			}
		})
	}
}

func TestListBuilderToAPIList(t *testing.T) {
	tests := map[string]struct {
		availableSCs    []string
		expectedSCCount int
		expectedErr     bool
	}{
		"StorageClass set 1": {[]string{}, 0, true},
		"StorageClass set 2": {[]string{"sc1"}, 1, false},
		"StorageClass set 3": {[]string{"sc1", "sc2"}, 2, false},
		"StorageClass set 4": {[]string{"sc1", "sc2", "sc3"}, 3, false},
	}
	for name, mock := range tests {
		name := name // pin it
		mock := mock // pin it
		t.Run(name, func(t *testing.T) {
			b, err := ListBuilderForAPIList(fakeStorageClassListAPI(mock.availableSCs)).APIList()
			if err == nil && mock.expectedSCCount != len(b.Items) {
				t.Fatalf("Test %v failed: expected %v got %v", name, mock.expectedSCCount, len(b.Items))
			}
			if mock.expectedErr && err == nil {
				t.Fatalf("Test %q failed: expected error not to be nil", name)
			}
			if !mock.expectedErr && err != nil {
				t.Fatalf("Test %q failed: expected error to be nil", name)
			}
		})
	}
}


text:
/**
 * @author alteredq / http://alteredqualia.com/
 */

THREE.MorphBlendMesh = function( geometry, material ) {

	THREE.Mesh.call( this, geometry, material );

	this.animationsMap = {};
	this.animationsList = [];

	// prepare default animation
	// (all frames played together in 1 second)

	var numFrames = this.geometry.morphTargets.length;

	var name = "__default";

	var startFrame = 0;
	var endFrame = numFrames - 1;

	var fps = numFrames / 1;

	this.createAnimation( name, startFrame, endFrame, fps );
	this.setAnimationWeight( name, 1 );

};

THREE.MorphBlendMesh.prototype = Object.create( THREE.Mesh.prototype );
THREE.MorphBlendMesh.prototype.constructor = THREE.MorphBlendMesh;

THREE.MorphBlendMesh.prototype.createAnimation = function ( name, start, end, fps ) {

	var animation = {

		start: start,
		end: end,

		length: end - start + 1,

		fps: fps,
		duration: ( end - start ) / fps,

		lastFrame: 0,
		currentFrame: 0,

		active: false,

		time: 0,
		direction: 1,
		weight: 1,

		directionBackwards: false,
		mirroredLoop: false

	};

	this.animationsMap[ name ] = animation;
	this.animationsList.push( animation );

};

THREE.MorphBlendMesh.prototype.autoCreateAnimations = function ( fps ) {

	var pattern = /([a-z]+)_?(\d+)/i;

	var firstAnimation, frameRanges = {};

	var geometry = this.geometry;

	for ( var i = 0, il = geometry.morphTargets.length; i < il; i ++ ) {

		var morph = geometry.morphTargets[ i ];
		var chunks = morph.name.match( pattern );

		if ( chunks && chunks.length > 1 ) {

			var name = chunks[ 1 ];

			if ( ! frameRanges[ name ] ) frameRanges[ name ] = { start: Infinity, end: - Infinity };

			var range = frameRanges[ name ];

			if ( i < range.start ) range.start = i;
			if ( i > range.end ) range.end = i;

			if ( ! firstAnimation ) firstAnimation = name;

		}

	}

	for ( var name in frameRanges ) {

		var range = frameRanges[ name ];
		this.createAnimation( name, range.start, range.end, fps );

	}

	this.firstAnimation = firstAnimation;

};

THREE.MorphBlendMesh.prototype.setAnimationDirectionForward = function ( name ) {

	var animation = this.animationsMap[ name ];

	if ( animation ) {

		animation.direction = 1;
		animation.directionBackwards = false;

	}

};

THREE.MorphBlendMesh.prototype.setAnimationDirectionBackward = function ( name ) {

	var animation = this.animationsMap[ name ];

	if ( animation ) {

		animation.direction = - 1;
		animation.directionBackwards = true;

	}

};

THREE.MorphBlendMesh.prototype.setAnimationFPS = function ( name, fps ) {

	var animation = this.animationsMap[ name ];

	if ( animation ) {

		animation.fps = fps;
		animation.duration = ( animation.end - animation.start ) / animation.fps;

	}

};

THREE.MorphBlendMesh.prototype.setAnimationDuration = function ( name, duration ) {

	var animation = this.animationsMap[ name ];

	if ( animation ) {

		animation.duration = duration;
		animation.fps = ( animation.end - animation.start ) / animation.duration;

	}

};

THREE.MorphBlendMesh.prototype.setAnimationWeight = function ( name, weight ) {

	var animation = this.animationsMap[ name ];

	if ( animation ) {

		animation.weight = weight;

	}

};

THREE.MorphBlendMesh.prototype.setAnimationTime = function ( name, time ) {

	var animation = this.animationsMap[ name ];

	if ( animation ) {

		animation.time = time;

	}

};

THREE.MorphBlendMesh.prototype.getAnimationTime = function ( name ) {

	var time = 0;

	var animation = this.animationsMap[ name ];

	if ( animation ) {

		time = animation.time;

	}

	return time;

};

THREE.MorphBlendMesh.prototype.getAnimationDuration = function ( name ) {

	var duration = - 1;

	var animation = this.animationsMap[ name ];

	if ( animation ) {

		duration = animation.duration;

	}

	return duration;

};

THREE.MorphBlendMesh.prototype.playAnimation = function ( name ) {

	var animation = this.animationsMap[ name ];

	if ( animation ) {

		animation.time = 0;
		animation.active = true;

	} else {

		console.warn( "THREE.MorphBlendMesh: animation[" + name + "] undefined in .playAnimation()" );

	}

};

THREE.MorphBlendMesh.prototype.stopAnimation = function ( name ) {

	var animation = this.animationsMap[ name ];

	if ( animation ) {

		animation.active = false;

	}

};

THREE.MorphBlendMesh.prototype.update = function ( delta ) {

	for ( var i = 0, il = this.animationsList.length; i < il; i ++ ) {

		var animation = this.animationsList[ i ];

		if ( ! animation.active ) continue;

		var frameTime = animation.duration / animation.length;

		animation.time += animation.direction * delta;

		if ( animation.mirroredLoop ) {

			if ( animation.time > animation.duration || animation.time < 0 ) {

				animation.direction *= - 1;

				if ( animation.time > animation.duration ) {

					animation.time = animation.duration;
					animation.directionBackwards = true;

				}

				if ( animation.time < 0 ) {

					animation.time = 0;
					animation.directionBackwards = false;

				}

			}

		} else {

			animation.time = animation.time % animation.duration;

			if ( animation.time < 0 ) animation.time += animation.duration;

		}

		var keyframe = animation.start + THREE.Math.clamp( Math.floor( animation.time / frameTime ), 0, animation.length - 1 );
		var weight = animation.weight;

		if ( keyframe !== animation.currentFrame ) {

			this.morphTargetInfluences[ animation.lastFrame ] = 0;
			this.morphTargetInfluences[ animation.currentFrame ] = 1 * weight;

			this.morphTargetInfluences[ keyframe ] = 0;

			animation.lastFrame = animation.currentFrame;
			animation.currentFrame = keyframe;

		}

		var mix = ( animation.time % frameTime ) / frameTime;

		if ( animation.directionBackwards ) mix = 1 - mix;

		if ( animation.currentFrame !== animation.lastFrame ) {

			this.morphTargetInfluences[ animation.currentFrame ] = mix * weight;
			this.morphTargetInfluences[ animation.lastFrame ] = ( 1 - mix ) * weight;

		} else {

			this.morphTargetInfluences[ animation.currentFrame ] = weight;

		}

	}

};


text:
import requests
import json
from core.services.db_shell import DBShell
from core.workers.service_workers import WorkersList as ServiceWorkersList

__author__ = 'NickVeld'

class API:
    def __init__(self):
        self.telegram = Tg_api()
        self.translator = Translator()
        self.db_shell = DBShell()
        self.offset = 0

        self.admin_ids = list()
        self.BOT_NICK = ""
        self.DB_IS_ENABLED = False
        self.NO_CARDS_GROUPS = True

        self.workers_list = None

    # def __init__(self, data):
    #     self.telegram = Tg_api(data["api_key"])
    #     self.translator = Translator(data["dict_key"], data["tr_key"])
    #
    #     self.admin_ids = data["admin_ids"]
    #     self.DB_IS_ENABLED = data["db_is_enabled"]
    #     self.NO_CARDS_GROUPS = not data["cards_groups"]
    #     self.db = MongoClient(data["mongo_name"], data["mongo_port"])["e_card"] if self.DB_IS_ENABLED else None

    def get_from_config(self, cfg):
        self.DB_IS_ENABLED = cfg['mongo_settings']['isEnabled'] == 'True'
        print("DB is " + ("en" if self.DB_IS_ENABLED else "dis") + "abled")
        self.admin_ids = list(cfg['admins_ids'])
        self.NO_CARDS_GROUPS = cfg["cards_is_allowed_for_groups"] == 'False'

        self.BOT_NICK = cfg['APIs']['bot_nick']

        self.telegram.get_from_config(cfg['APIs'])
        self.translator.get_from_config(cfg['APIs'])
        self.db_shell.get_from_config(cfg)

        self.service_workers_list = ServiceWorkersList.get_workers(ServiceWorkersList
                                                                   , cfg["included_service_workers"], self)

    def get(self, toffset=0):
        return self.telegram.get(toffset)

    def get_msg(self):
        while True:
            for worker in self.service_workers_list:
                if worker.is_it_for_me():
                    cmd = worker.run()
                    if cmd != 1:
                        break
            new_msgs = self.get(self.offset)
            if new_msgs is None:
                continue

            for msg in new_msgs['result']:
                self.offset = msg['update_id']
                yield msg

    def send(self, message, chat_id, reply_to_message_id=0, keyboard=None):
        self.telegram.send(message, chat_id, reply_to_message_id)
        return message

    def send_with_id(self, message, chat_id, reply_to_message_id=0, keyboard=None):
        return self.telegram.send(message, chat_id, reply_to_message_id)

    def send_inline_keyboard(self, message, chat_id, inline_keyboard, reply_to_message_id=0):
        self.telegram.send_inline_keyboard(message, chat_id, inline_keyboard, reply_to_message_id)
        return message

    def send_inline_keyboard_with_id(self, message, chat_id, inline_keyboard, reply_to_message_id=0):
        return self.telegram.send_inline_keyboard(message, chat_id, inline_keyboard, reply_to_message_id)

    def edit(self, message, chat_id, inline_keyboard, message_id):
        return self.telegram.edit(message, chat_id, inline_keyboard, message_id)

    def get_inline_text_keyboard(self, source):
        return self.telegram.get_inline_text_keyboard(source)

    def translate(self, request, lang, userl="en"):
        return self.translator.translate(request, lang, userl)

    def translateph(self, request, lang, userl="en"):
        return self.translator.translateph(request, lang, userl)

    @property
    def db(self):
        return self.db_shell.db

    @property
    def COOLDOWN_M(self):
        return self.db_shell.COOLDOWN_M

    def get_random_doc(self, collection, request=None):
        return self.db_shell.get_random_doc(collection, request)

    def get_test_word(self, pers_id):
        return self.db_shell.get_test_word(pers_id)

    def get_doc_for_card(self, tmsg, collection, additional_condition=(lambda x: True)):
        return self.db_shell.get_doc_for_card(tmsg, collection, additional_condition)

    def update_doc_for_card(self, is_not_test_word, pers_id, doc_id, correctness):
        self.db_shell.update_doc_for_card(is_not_test_word, pers_id, doc_id, correctness)

    def insert_doc_for_card(self, tmsg, collection, tr_request, lang, tr_response):
        self.db_shell.insert_doc_for_card(tmsg, collection, tr_request, lang, tr_response)

class Tg_api:

    def __init__(self):
        pass

    # def __init__(self, api_key):
    #     self.API_KEY = api_key

    def get_from_config(self, cfg):
        self.CHAT_LINK = cfg['telegram_chatlink']
        self.API_KEY = cfg['telegram_api']

    def get(self, toffset=0, timeout=29):
        method = 'getUpdates'
        params = {
            'offset': toffset + 1,
            'timeout': timeout
        }
        try:
            req = requests.request(
                'POST',
                '{link}{api_key}/{method}'.format(
                    link=self.CHAT_LINK,
                    api_key=self.API_KEY,
                    method=method
                ),
                params=params,
                timeout=timeout+1
            )
            if req.text is "":
                return None

            new_msgs = json.loads(req.text)
            if new_msgs['ok'] and (len(new_msgs['result']) != 0):
                return new_msgs
        except requests.exceptions.Timeout:
            print("Timeout in get()!")
        except Exception as ex:
            print("Error in get()!")
            print(type(ex), ex.__str__())
        return None

    def send(self, message, chat_id, reply_to_message_id=0):
        method = 'sendMessage'
        params = {
            'chat_id': chat_id,
            'disable_web_page_preview': True,
            'text': message
        }
        if reply_to_message_id:
            params['reply_to_message_id'] = reply_to_message_id
        try:
            req = requests.request(
                'POST',
                '{link}{api_key}/{method}'.format(
                    link = self.CHAT_LINK,
                    api_key=self.API_KEY,
                    method=method
                ),
                params=params,
                timeout=30
            )
            sended = json.loads(req.text)
            if sended['ok']:
                return sended['result']['message_id']
        except requests.exceptions.Timeout:
            print("Timeout in send()!")
        except Exception as ex:
            print("Error in send()!")
            print(type(ex), ex.__str__())
        return 0

    def get_reply_keyboard(self, source):
        return [["/{}".format(c) for c in s_in.split('\t')] for s_in in source.split('\n')]

    def send_reply_keyboard(self, message, chat_id, keyboard, reply_to_message_id=0):
        method = 'sendMessage'
        params = {
            'chat_id': chat_id,
            'disable_web_page_preview': True,
            'text': message
        }
        if reply_to_message_id:
            params['reply_to_message_id'] = reply_to_message_id
        if keyboard != None:
            params["reply_markup"] = json.dumps({
                "keyboard": keyboard,
                "resize_keyboard": True,
                "one_time_keyboard": True,
                "selective": True
            })
        try:
            req = requests.request(
                'POST',
                '{link}{api_key}/{method}'.format(
                    link=self.CHAT_LINK,
                    api_key=self.API_KEY,
                    method=method
                ),
                params=params,
                timeout=30
            )
            sended = json.loads(req.text)
            if sended['ok']:
                return sended['result']['message_id']
        except requests.exceptions.Timeout:
            print("Timeout in send_reply_keyboard(...)!")
        except Exception as ex:
            print("Error in send_reply_keyboard(...)!")
            print(type(ex), ex.__str__())
        return 0

    def get_inline_text_keyboard(self, source):
        return list([[{'text': c,
                       'callback_data': "/{}".format(c)} for c in s_in.split('\t')] for s_in in source.split('\n')])

    def send_inline_keyboard(self, message, chat_id, inline_keyboard, reply_to_message_id=0):
        method = 'sendMessage'
        params = {
            'chat_id': chat_id,
            'disable_web_page_preview': True,
            'text': message
        }
        if reply_to_message_id:
            params['reply_to_message_id'] = reply_to_message_id
        if inline_keyboard != None:
            params["reply_markup"] = json.dumps({
                "inline_keyboard": inline_keyboard
            })
        try:
            req = requests.request(
                'POST',
                '{link}{api_key}/{method}'.format(
                    link=self.CHAT_LINK,
                    api_key=self.API_KEY,
                    method=method
                ),
                params=params,
                timeout=30
            )
            sended = json.loads(req.text)
            if sended['ok']:
                return sended['result']['message_id']
        except requests.exceptions.Timeout:
            print("Timeout in send_inline_keyboard(...)!")
        except Exception as ex:
            print("Error in send_inline_keyboard(...)!")
            print(type(ex), ex.__str__())
        return 0

    def edit(self, message, chat_id, inline_keyboard, message_id):
        method = 'editMessageText'
        params = {
            'chat_id': chat_id,
            'message_id': message_id,
            'disable_web_page_preview': True,
            'text': message
        }
        if inline_keyboard != None:
            params["reply_markup"] = json.dumps({
                "inline_keyboard": inline_keyboard
            })
        try:
            req = requests.request(
                'POST',
                '{link}{api_key}/{method}'.format(
                    link=self.CHAT_LINK,
                    api_key=self.API_KEY,
                    method=method
                ),
                params=params,
                timeout=30
            )
        except requests.exceptions.Timeout:
            print("Timeout in edit(...)!")
        except Exception as ex:
            print("Error in edit(...)!")
            print(type(ex), ex.__str__())
        return message

class Translator:
    def __init__(self):
        self.DICT_KEY = ""
        self.TR_KEY = ""
        self.DICT_LINK = ""
        self.TR_LINK = ""
        self.SPLR_LINK = ""

    # def __init__(self, dict_key, tr_key):
    #     self.DICT_KEY = dict_key
    #     self.TR_KEY = tr_key

    def get_from_config(self, cfg):
        self.DICT_KEY = cfg['dictionary_api']
        self.TR_KEY = cfg['translator_api']
        self.DICT_LINK = cfg['dictionary_link']
        self.TR_LINK = cfg['translator_link']
        self.SPLR_LINK = cfg['speller_link']

    def translate(self, request, lang, userl="en"):
        if len(request) > 100:
            request = request[:100]
        req = requests.get(
            "{link}&text={request}&lang={lang})".format(
                link=self.SPLR_LINK,
                lang=lang,
                request=request
            )
        ).json()

        with_mistakes = False
        for mistake in req:
            if mistake['code'] == 1 and len(mistake['s']) > 0:
                with_mistakes = True
                request = request.replace(mistake['word'], mistake['s'][0], 1)
        req = requests.get(
            "{link}key={dict_key}&lang={lang}&text={request})".format(
                link=self.DICT_LINK,
                dict_key=self.DICT_KEY,
                lang=lang,
                request=request
                # userl=userl, &ui={userl}
                # flag=12 &flags={flag}
            )
        ).json()

        res = ""
        if len(req['def']) > 0:
            nstr = 1  # number of string
            for wdef in req['def']:
                if 'tr' in wdef:
                    if len(wdef['tr']) > 0:
                        res += str(nstr) + '. '
                        nstr += 1
                        for tr in wdef['tr']:
                            res += tr['text'] + ", "
                        res = res[:-2]
                        res += '\n'
            res = res[:-1]
        if with_mistakes:
            res = "*_%" + request + "\n\n" + res
        return res

    def translateph(self, request, lang, userl="en"):
        req = requests.get(
            "{link}key={tr_key}&text={request}&lang={lang}".format(
                link=self.TR_LINK,
                tr_key=self.TR_KEY,
                lang=lang,
                request=request
                # userl=userl, &ui={userl}
                # flag=12 &flags={flag}
            )
        ).json()

        if req['code'] == 200:
            if len(req['text']) != 0:
                return req['text'][0]
            else:
                return ""
        else:
            return "Ошибочка вышла.\nСоветы:\n1) Проверьте ввод.\n2) Прочтите /help\n" \
                   "3) Надейтесь, что это не проблема с сервисом перевода."


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

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Content-Style-Type" content="text/css" />
  <meta name="generator" content="pandoc" />
  <meta name="author" content="Copyright 2015 Intel Corporation All Rights Reserved." />
  <title>IoT Services Orchestration Layer</title>

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

IoT Services Orchestration Layer

Copyright 2015 Intel Corporation All Rights Reserved.

flow

gate

Description

Inport

Outport

Example

if

Description

Inport

Outport

Example

sender

Description

Inport

Outport

Example

merge

Description

Inport

Outport

Example

flow

gate

Description

This service is a controllable gate for dataflow.

Inport

gate: Boolean. Non-trigger inport, the state of gate.

in: Any.

Outport

out: Any. Output the value of in if gate is true.

Example

For this example, the value of gate was fixed to false, no data output forever.

if

Description

This service is a splitter for dataflow, then outputs true when in is true, otherwise else outputs true.

Note that: Only one outport outputs true each time.

Inport

in: Boolean.

Outport

then: Boolean. Output true only when in is true

else: Boolean. Output true only when in is false

Example

For this example, if in is true, the upper branch will be satisfied and eventually output "path_up", otherwise the lower branch will be selected and eventually output "path_down".

sender

Description

Output the value of content to out only when trigger received message.

Inport

content: Any. Non-trigger inport

trigger: Any. The value will be discard.

Outport

out: Any.

Example

merge

Description

This service combines all inport to a JSON object and output it.

Inport

You can add/delete inport, and the name of inport is changable.

Outport

out: JSON Object. keys from the name of inports and value from each inport.

Example

For this example, the value of out is {"name":"abc", "phone":12345, "addr":"intel corp"}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Cryptosporium macrospermum Peck

### Remarks
null


text:
module NavHelper
  def page_with_sidebar_class
    class_name = page_gutter_class
    class_name << 'page-with-new-sidebar' if defined?(@new_sidebar) && @new_sidebar
    class_name << 'page-with-icon-sidebar' if collapsed_sidebar? && @new_sidebar

    class_name
  end

  def page_gutter_class
    if current_path?('merge_requests#show') ||
        current_path?('projects/merge_requests/conflicts#show') ||
        current_path?('issues#show') ||
        current_path?('milestones#show')
      if cookies[:collapsed_gutter] == 'true'
        %w[page-gutter right-sidebar-collapsed]
      else
        %w[page-gutter right-sidebar-expanded]
      end
    elsif current_path?('jobs#show')
      %w[page-gutter build-sidebar right-sidebar-expanded]
    elsif current_path?('wikis#show') ||
        current_path?('wikis#edit') ||
        current_path?('wikis#update') ||
        current_path?('wikis#history') ||
        current_path?('wikis#git_access')
      %w[page-gutter wiki-sidebar right-sidebar-expanded]
    else
      []
    end
  end

  def nav_header_class
    class_names = []
    class_names << 'with-horizontal-nav' if defined?(nav) && nav

    class_names
  end

  def layout_nav_class
    return [] if show_new_nav?

    class_names = []
    class_names << 'page-with-layout-nav' if defined?(nav) && nav
    class_names << 'page-with-sub-nav' if content_for?(:sub_nav)

    class_names
  end

  def nav_control_class
    "nav-control" if current_user
  end
end


text:
package org.apache.carbondata.spark.vectorreader;

import java.math.BigDecimal;

import org.apache.carbondata.core.metadata.datatype.DataType;
import org.apache.carbondata.core.scan.result.vector.CarbonColumnVector;
import org.apache.carbondata.core.scan.result.vector.CarbonDictionary;
import org.apache.carbondata.core.scan.scanner.LazyPageLoader;

import org.apache.spark.sql.CarbonVectorProxy;
import org.apache.spark.sql.carbondata.execution.datasources.CarbonSparkDataSourceUtil;
import org.apache.spark.sql.types.Decimal;

/**
 * Fills the vector directly with out considering any deleted rows.
 */
class ColumnarVectorWrapperDirect implements CarbonColumnVector {

  /**
   * It is one column vector adapter class.
   */
  protected CarbonVectorProxy.ColumnVectorProxy sparkColumnVectorProxy;

  /**
   * It is adapter class of complete ColumnarBatch.
   */
  protected CarbonVectorProxy carbonVectorProxy;

  protected int ordinal;

  protected boolean isDictionary;

  private DataType blockDataType;

  private CarbonColumnVector dictionaryVector;

  ColumnarVectorWrapperDirect(CarbonVectorProxy writableColumnVector, int ordinal) {
    this.sparkColumnVectorProxy = writableColumnVector.getColumnVector(ordinal);
    this.carbonVectorProxy = writableColumnVector;
    this.ordinal = ordinal;
  }

  @Override
  public void putBoolean(int rowId, boolean value) {
    sparkColumnVectorProxy.putBoolean(rowId, value);
  }

  @Override
  public void putFloat(int rowId, float value) {
    sparkColumnVectorProxy.putFloat(rowId, value);
  }

  @Override
  public void putShort(int rowId, short value) {
    sparkColumnVectorProxy.putShort(rowId, value);
  }

  @Override
  public void putShorts(int rowId, int count, short value) {
    sparkColumnVectorProxy.putShorts(rowId, count, value);
  }

  @Override
  public void putInt(int rowId, int value) {
    if (isDictionary) {
      sparkColumnVectorProxy.putDictionaryInt(rowId, value);
    } else {
      sparkColumnVectorProxy.putInt(rowId, value);
    }
  }

  @Override
  public void putInts(int rowId, int count, int value) {
    sparkColumnVectorProxy.putInts(rowId, count, value);
  }

  @Override
  public void putLong(int rowId, long value) {
    sparkColumnVectorProxy.putLong(rowId, value);
  }

  @Override
  public void putLongs(int rowId, int count, long value) {
    sparkColumnVectorProxy.putLongs(rowId, count, value);
  }

  @Override
  public void putDecimal(int rowId, BigDecimal value, int precision) {
    Decimal toDecimal = Decimal.apply(value);
    sparkColumnVectorProxy.putDecimal(rowId, toDecimal, precision);
  }

  @Override
  public void putDecimals(int rowId, int count, BigDecimal value, int precision) {
    Decimal decimal = Decimal.apply(value);
    for (int i = 0; i < count; i++) {
      sparkColumnVectorProxy.putDecimal(rowId, decimal, precision);
      rowId++;
    }
  }

  @Override
  public void putDouble(int rowId, double value) {
    sparkColumnVectorProxy.putDouble(rowId, value);
  }

  @Override
  public void putDoubles(int rowId, int count, double value) {
    sparkColumnVectorProxy.putDoubles(rowId, count, value);
  }

  @Override
  public void putByteArray(int rowId, byte[] value) {
    sparkColumnVectorProxy.putByteArray(rowId, value, 0, value.length);
  }

  @Override
  public void putByteArray(int rowId, int count, byte[] value) {
    for (int i = 0; i < count; i++) {
      sparkColumnVectorProxy.putByteArray(rowId, value);
      rowId++;
    }
  }

  @Override
  public void putByteArray(int rowId, int offset, int length, byte[] value) {
    sparkColumnVectorProxy.putByteArray(rowId, value, offset, length);
  }

  @Override
  public void putNull(int rowId) {
    sparkColumnVectorProxy.putNull(rowId);
  }

  @Override
  public void putNulls(int rowId, int count) {
    sparkColumnVectorProxy.putNulls(rowId, count);
  }

  @Override
  public void putNotNull(int rowId) {
    sparkColumnVectorProxy.putNotNull(rowId);
  }

  @Override
  public void putNotNull(int rowId, int count) {
    sparkColumnVectorProxy.putNotNulls(rowId, count);
  }

  @Override
  public boolean isNull(int rowId) {
    return sparkColumnVectorProxy.isNullAt(rowId);
  }

  @Override
  public void putObject(int rowId, Object obj) {
    //TODO handle complex types
  }

  @Override
  public Object getData(int rowId) {
    //TODO handle complex types
    return null;
  }

  @Override
  public void reset() {
    if (null != dictionaryVector) {
      dictionaryVector.reset();
    }
  }

  @Override
  public DataType getType() {
    return CarbonSparkDataSourceUtil
        .convertSparkToCarbonDataType(sparkColumnVectorProxy.dataType());
  }

  @Override
  public DataType getBlockDataType() {
    return blockDataType;
  }

  @Override
  public void setBlockDataType(DataType blockDataType) {
    this.blockDataType = blockDataType;
  }

  @Override
  public void setDictionary(CarbonDictionary dictionary) {
    sparkColumnVectorProxy.setDictionary(dictionary);
  }

  @Override
  public boolean hasDictionary() {
    return sparkColumnVectorProxy.hasDictionary();
  }

  public void reserveDictionaryIds() {
    sparkColumnVectorProxy.reserveDictionaryIds(carbonVectorProxy.numRows());
    dictionaryVector = new ColumnarVectorWrapperDirect(carbonVectorProxy, ordinal);
    ((ColumnarVectorWrapperDirect) dictionaryVector).isDictionary = true;
  }

  @Override
  public CarbonColumnVector getDictionaryVector() {
    return dictionaryVector;
  }

  @Override
  public void putByte(int rowId, byte value) {
    sparkColumnVectorProxy.putByte(rowId, value);
  }

  @Override
  public void setFilteredRowsExist(boolean filteredRowsExist) {

  }

  @Override
  public void putFloats(int rowId, int count, float[] src, int srcIndex) {
    sparkColumnVectorProxy.putFloats(rowId, count, src, srcIndex);
  }

  @Override
  public void putShorts(int rowId, int count, short[] src, int srcIndex) {
    sparkColumnVectorProxy.putShorts(rowId, count, src, srcIndex);
  }

  @Override
  public void putInts(int rowId, int count, int[] src, int srcIndex) {
    sparkColumnVectorProxy.putInts(rowId, count, src, srcIndex);
  }

  @Override
  public void putLongs(int rowId, int count, long[] src, int srcIndex) {
    sparkColumnVectorProxy.putLongs(rowId, count, src, srcIndex);
  }

  @Override
  public void putDoubles(int rowId, int count, double[] src, int srcIndex) {
    sparkColumnVectorProxy.putDoubles(rowId, count, src, srcIndex);
  }

  @Override
  public void putBytes(int rowId, int count, byte[] src, int srcIndex) {
    sparkColumnVectorProxy.putBytes(rowId, count, src, srcIndex);
  }

  @Override
  public void setLazyPage(LazyPageLoader lazyPage) {
    sparkColumnVectorProxy.setLazyPage(lazyPage);
  }

  @Override
  public void putArray(int rowId, int offset, int length) {
    sparkColumnVectorProxy.putArray(rowId, offset, length);
  }

  @Override
  public void putAllByteArray(byte[] data, int offset, int length) {
    sparkColumnVectorProxy.putAllByteArray(data, offset, length);
  }
}


text:
class Book < ActiveRecord::Base
  validates :title, presence: true

  attr_accessor :cover_image

  private

  # [START upload]
  after_create :upload_image, if: :cover_image

  def upload_image
    image = StorageBucket.files.new(
      key: "cover_images/#{id}/#{cover_image.original_filename}",
      body: cover_image.read,
      public: true
    )

    image.save

    update_columns image_url: image.public_url
  end
  # [END upload]

  # TODO what if the image is from the Pub/Sub job and NOT in Cloud Storage!?

  # [START delete]
  before_destroy :delete_image, if: :image_url

  def delete_image
    bucket_name = StorageBucket.key
    image_uri   = URI.parse image_url

    if image_uri.host == "#{bucket_name}.storage.googleapis.com"
      # Remove leading forward slash from image path
      # The result will be the image key, eg. "cover_images/:id/:filename"
      image_key = image_uri.path.sub("/", "")
      image     = StorageBucket.files.new key: image_key

      image.destroy
    end
  end
  # [END delete]

  # [START update]
  before_update :update_image, if: :cover_image

  def update_image
    delete_image if image_url?
    upload_image
  end
  # [END update]
end
# [END book]


text:
layout: page
title: Guardian Networks Show
date: 2016-05-24
author: Jessica Faulkner
tags: weekly links, java
status: published
summary: Aliquam id pretium quam. Praesent pretium quam massa, eu.
banner: images/banner/leisure-05.jpg
booking:
  startDate: 10/04/2017
  endDate: 10/06/2017
  ctyhocn: LTNLAHX
  groupCode: GNS
published: true
---
Suspendisse sodales tempor ex. Mauris ornare at ligula non dictum. Nulla euismod lorem tortor, at dictum lacus molestie quis. Fusce tellus mauris, dapibus sed turpis ut, suscipit ultrices nisi. Interdum et malesuada fames ac ante ipsum primis in faucibus. Phasellus ultricies ac risus sit amet volutpat. Proin vitae dolor turpis. Integer lacus orci, volutpat vitae blandit sit amet, bibendum vel nunc. Quisque neque erat, accumsan gravida ex sit amet, varius blandit elit. Morbi maximus eros eu tempor dignissim. Praesent ac interdum massa. Nullam vitae consectetur diam. Praesent eget massa dictum, rhoncus neque nec, tincidunt est. In aliquet nisl in ultricies vulputate.

* Quisque lobortis dui eget eros vestibulum ultricies
* Vestibulum eleifend nisl quis felis rutrum semper
* Aliquam congue ligula egestas cursus consequat.

Donec scelerisque tincidunt velit vel rhoncus. Maecenas dui orci, auctor non orci sit amet, facilisis elementum neque. Suspendisse nec ipsum lorem. Aenean non mi mattis, pulvinar nibh eget, egestas turpis. Nunc id sapien nisi. Praesent semper dapibus fermentum. Phasellus ac dolor purus.


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.LanguageServices.ProjectInfoService;
using Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem;

namespace Microsoft.VisualStudio.LanguageServices.Implementation.ProjectInfoService
{
    internal sealed class DefaultProjectInfoService : IProjectInfoService
    {
        public bool GeneratedTypesMustBePublic(Project project)
        {
            if (!(project.Solution.Workspace is VisualStudioWorkspaceImpl workspace))
            {
                return false;
            }

            // TODO: reimplement

            return false;
        }
    }
}


text:
package com.github.gwtd3.demo.client.testcases.selection;

import com.github.gwtd3.api.D3;
import com.github.gwtd3.api.arrays.Array;
import com.github.gwtd3.api.core.Selection;
import com.github.gwtd3.api.core.Value;
import com.github.gwtd3.api.functions.CountFunction;
import com.github.gwtd3.api.functions.DatumFunction;
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.NodeList;
import com.google.gwt.user.client.ui.ComplexPanel;

/**
 * Testing the internal structure of the selections and subselections.
 *
 *
 * @author Anthony Schiochet
 *
 */
public class TestSubselections extends AbstractSelectionTest {

    @Override
    public void doTest(final ComplexPanel sandbox) {
        testD3Select();
        testD3SelectAll();
        testD3SelectThenSelect();
        testD3SelectThenSelectAll();
        testD3SelectThenSelectAllByFunction();
        // testSelectAllSelectByString();
        // testSelectAllSelectAllByString();

        // testSelectSelectByFunction();
        // testSelectAllSelectByFunction();
    }

    protected void assertParentNodeIsRootHtml(final Selection s) {
        Element parentNode = s.parentNode(0);
        assertNotNull(parentNode);
        assertEquals("html", parentNode.getTagName().toLowerCase());

    }

    /**
     *
     */
    private void testD3Select() {
        clearSandbox();
        Selection select = D3.select(sandbox);
        assertEquals(sandbox.getElement(), select.node());

        // internal structure
        Array<Array<Element>> elements = select.asElementArray();
        assertEquals(1, elements.length());
        assertEquals(1, elements.get(0).length());
        assertEquals(1, select.groupCount());
        assertParentNodeIsRootHtml(select);

        // appending returns a new selection with the same parent node (html)
        Selection child = select.append("blah");
        assertParentNodeIsRootHtml(child);
        assertEquals(1, child.size());
        assertEquals(1, D3.selectAll("blah").size());

    }

    /**
     *
     */
    private void testD3SelectAll() {
        clearSandbox();

        sandbox.getElement().setInnerHTML(
                "
<blah>foo</blah>
" +
                        "
<blah>bar</blah>
" +
                        "
<blah>zing</blah>
"
                );

        Selection blahs = D3.selectAll("blah");

        // internal structure
        assertEquals(3, blahs.size());
        assertEquals(1, blahs.groupCount());
        assertEquals(1, blahs.asElementArray().length());
        assertEquals(3, blahs.asElementArray().get(0).length());

        // parentNode
        assertParentNodeIsRootHtml(blahs);

        // appending an element to the blah tags are easy
        Selection barfoos = blahs.append("barfoo");
        assertEquals(3, barfoos.size());
        assertEquals(1, barfoos.groupCount());
        assertEquals(1, barfoos.asElementArray().length());
        assertEquals(3, barfoos.asElementArray().get(0).length());
        assertParentNodeIsRootHtml(barfoos);

        // also test variant of selectAll
        Selection selection = D3.selectAll(sandbox.getElement().getChildNodes());
        assertEquals(3, selection.size());

        selection = D3.selectAll(sandbox.getElement().getChild(0).<Element> cast(),
                sandbox.getElement().getChild(1).<Element> cast(),
                sandbox.getElement().getChild(2).<Element> cast());
        assertEquals(3, selection.size());

    }

    /**
     *
     */
    private void testD3SelectThenSelect() {
        clearSandbox();
        // given 3 DIV>SPAN elements in the sandbox
        clearSandbox();
        sandbox.getElement().setInnerHTML(
                "
<zorg>foo</zorg><zorg>foo2</zorg>
" +
                        "
<zorg>bar</zorg><zorg>bar2</zorg>
" +
                        "
<zorg>zing</zorg><zorg>zing2</zorg>
"
                );
        Selection sandboxSelection = D3.select(sandbox);

        // for each element in the current selection, select the first descendant matching the selector
        Selection divs = sandboxSelection.selectAll("div");
        Selection firstZorgs = sandboxSelection.select("zorg");
        assertEquals(1, firstZorgs.size());
        assertEquals(1, firstZorgs.groupCount());
        assertParentNodeIsRootHtml(firstZorgs);
        Array<Array<Element>> array = firstZorgs.asElementArray();
        assertEquals(1, array.length());
        assertEquals(1, array.get(0).length());
        // if multiple elements match the selector, only the first matching element in document traversal order will be
        // selected.

        // if no element match for a element, the element at the current index will be null in the returned selection
        // a) operators skip null element , thereby preserving the index of the existing selection
        clearSandbox();
        sandbox.getElement().setInnerHTML(
                "

" +
                        "

" +
                        "
<zorg>zing</zorg><zorg>zing2</zorg>
"
                );
        sandboxSelection = D3.select(sandbox);
        divs = sandboxSelection.selectAll("div");
        firstZorgs = sandboxSelection.select("zorg");
        assertEquals(1, firstZorgs.size());
        assertEquals(1, firstZorgs.groupCount());
        assertParentNodeIsRootHtml(firstZorgs);

        CountFunction countFunction = new CountFunction();
        firstZorgs.each(countFunction.reset());
        assertEquals(1, countFunction.getCount());

        // if the current element has associated data, this data is inherited by the returned subselection and
        // automatically bound to the newly selected elements
        clearSandbox();
        sandbox.getElement().setInnerHTML(
                "
<zorg>foo</zorg><zorg>foo2</zorg>
" +
                        "
<zorg>bar</zorg><zorg>bar2</zorg>
" +
                        "
<zorg>zing</zorg><zorg>zing2</zorg>
"
                );
        divs = D3.select(sandbox).selectAll("div");
        divs.asElementArray().get(0).get(0).setPropertyInt(Selection.DATA_PROPERTY, 6);
        divs.asElementArray().get(0).get(1).setPropertyInt(Selection.DATA_PROPERTY, 2);
        divs.asElementArray().get(0).get(2).setPropertyInt(Selection.DATA_PROPERTY, 4);
        Selection select = divs.select("zorg");
        Array<Object> data = select.data();
        assertEquals(6.0, data.getNumber(0));
        assertEquals(2.0, data.getNumber(1));
        assertEquals(4.0, data.getNumber(2));

        // select as a function returning element or null

        // select by function
        Selection selection = sandboxSelection.select(new DatumFunction<Element>() {
            @Override
            public Element apply(final Element context, final Value d, final int index) {
                // maybe it can be any node ??? even a non child node
                return Document.get().getBody();
            }
        });
        assertEquals(1, selection.size());
        assertEquals(1, selection.groupCount());
        assertEquals(Document.get().getBody(), selection.node());
    }

    /**
     *
     */
    private void testD3SelectThenSelectAll() {
        clearSandbox();
        // given 3 DIV elements in the sandbox
        sandbox.getElement().setInnerHTML(
                "

" +
                        "

" +
                        "

"
                );
        //
        assertEquals(3, sandbox.getElement().getChildCount());
        Selection spans = D3.select(sandbox).selectAll("span");
        assertEquals(3, spans.size());
        assertEquals(1, spans.groupCount());
        assertEquals(sandbox.getElement(), spans.parentNode(0));
        // appending a node append it to each span nodes, and the parent node of the new selection is the same as before
        Selection appended = spans.append("foobar");
        assertEquals(3, appended.size());
        assertEquals(1, appended.groupCount());
        assertEquals(sandbox.getElement(), appended.parentNode(0));

        // where does the new nodes have been appended ? in the span ? or in the sanbox ?
        assertEquals(3, sandbox.getElement().getChildCount());
        // it seems in the span elements
        D3.select(sandbox).selectAll("span").each(new DatumFunction<Void>() {
            @Override
            public Void apply(final Element context, final Value d, final int index) {
                assertEquals(1, context.getChildCount());
                return null;
            }
        });

    }

    /**
     *
     */
    private void testD3SelectThenSelectAllByFunction() {
        clearSandbox();
        // given 3 DIV elements in the sandbox
        sandbox.getElement().setInnerHTML(
                "

" +
                        "

" +
                        "

"
                );
        //
        assertEquals(3, sandbox.getElement().getChildCount());
        Selection spans = D3.select(sandbox).selectAll(new DatumFunction<NodeList<Element>>() {
            @Override
            public NodeList<Element> apply(final Element context, final Value d, final int index) {
                return context.getElementsByTagName("span");
            }
        });
        assertEquals(3, spans.size());
        assertEquals(1, spans.groupCount());
        assertEquals(sandbox.getElement(), spans.parentNode(0));
        // appending a node append it to each span nodes, and the parent node of the new selection is the same as before
        Selection appended = spans.append("foobar");
        assertEquals(3, appended.size());
        assertEquals(1, appended.groupCount());
        assertEquals(sandbox.getElement(), appended.parentNode(0));

        // where does the new nodes have been appended ? in the span ? or in the sanbox ?
        assertEquals(3, sandbox.getElement().getChildCount());
        // it seems in the span elements
        D3.select(sandbox).selectAll("span").each(new DatumFunction<Void>() {
            @Override
            public Void apply(final Element context, final Value d, final int index) {
                assertEquals(1, context.getChildCount());
                return null;
            }
        });

    }

    private void testSelectAllSelectByString() {
        clearSandbox();
        // given 3 DIV>SPAN elements in the sandbox
        sandbox.getElement().setInnerHTML(
                "
foo
" +
                        "
bar
" +
                        "
zing
"
                );
        // when selecting the sandbox then selecting the div
        // I got only 1 node in the selection
        // Selection sandboxSelection = D3.select(sandbox);
        // assertEquals(1, sandboxSelection.count());
        Selection divs = D3.select(sandbox).selectAll("div");
        assertEquals(3, divs.size());
        Selection spans = divs.select("span");
        assertEquals(3, spans.size());

    }

}


text:
//Created by Joseph Rioux, 27 March 2013

//think carefully about this one very important class

//Basic attack class. The hitbox is a very versatile class, a GameObject that is sorted for
//priority in collision. A given object can usually only collide with one hitbox per frame,
//the most prior one. Subclasses will make the hitbox more focused (e.g. melee hitboxes,
//which are mounted to the attacker's position)

//Both enemy and player attacks will use hitBoxes. It has damage and power: damage is the actual
//amount dealt if it hits, while power dictates what kinds of things it can hit (e.g. the sword
//is powerful enough to break a pot, but not powerful enough to break a boulder).

//priorities: 0 - 14: hitboxes ; 15: player? ; 16 - 24: other boundingBoxes

package edu.benedictine.game.engine;

import edu.benedictine.game.media.ImageSource;
import edu.benedictine.game.engine.collision.BoundingBox;
import edu.benedictine.game.engine.collision.Hit;
import edu.benedictine.game.gui.Scene;
import java.util.ArrayList;

public class HitBox extends GameObject
{
	GameObject caster;
	int priority;
	int power;
	int damage;
	int delay = 0;

	//these key in to what the hitbox does on contact
    int hitFloor;
	int hitWalls;
	int hitCeiling;
	int hitCaster;
	int hitPlayer;
	int hitEnemies;
	int hitObjects;
	int hitHitBoxes;

	public HitBox(Scene scn, int exec, int draw, GameObject caster, double xLoc, double yLoc, double xCng, double yCng, ImageSource img, double width, double height, int priority, int power, int damage, int delay, int lifeTime, double gravity, double maxFall)
	{
		super(scn, 0, draw, xLoc, yLoc, xCng, yCng, img, -(height/2.0), (height/2.0), -(width/2.0), (width/2.0));
		this.caster = caster;
		this.priority = priority;
		this.power = power;
		this.damage = damage;
		this.delay = delay;
		this.lifeTime = lifeTime;
		setFall(gravity, maxFall);
		box = new BoundingBox(scn, this, 0, new int[]{0}, priority, 0.0, 0.0, (width/2.0), (height/2.0));
	}

	public void setHits(int hitFloor, int hitWalls, int hitCeiling, int hitCaster, int hitPlayer, int hitEnemies, int hitObjects, int hitHitBoxes)
	{
		//note: 0 is default reaction, -1 is no collision
		ArrayList<Integer> cats = new ArrayList<Integer>();
		if (hitHitBoxes >= 0)
			cats.add(0);
		if (hitPlayer >= 0)
			cats.add(1);
		if (hitEnemies >= 0)
			cats.add(2);
		if (hitObjects >= 0)
			cats.add(3);
		int[] a = new int[cats.size()];
		for (int i=0; i<cats.size(); i++)
			a[i] = cats.get(i);
		box.setCategories(a);

		if (hitFloor == -1 && hitWalls == -1 && hitCeiling == -1)
			hitTerrain = false;

		this.hitFloor = hitFloor;
		this.hitWalls = hitWalls;
		this.hitCeiling = hitCeiling;
		this.hitCaster = hitCaster;
		this.hitPlayer = hitPlayer;
		this.hitEnemies = hitEnemies;
		this.hitObjects = hitObjects;
		this.hitHitBoxes = hitHitBoxes;
	}

	public void update()
	{
		if (delay < 1)
		{
			super.update();
		}
		delay--;
	}

	public void reactFloor()
	{
		if (hitFloor == 0)
		{
			super.reactFloor();
		}
		if (hitFloor == 1)
		{
			die();
		}
		if (hitFloor == 2)
		{
			lifeTime = 1;
			super.reactFloor();
			y = onTerrain.y0;
		}
		if (hitFloor == 3)
		{
			super.reactFloor();
			y = onTerrain.y0;
			lifeTime = 1;
			//setImage(scn.store.winkSheet[6]);
			//scn.spEffects.radialParticles(7, scn.store.winkSheet[2], x, y, 120.0, 180.0, 5, 8, 5, 16, 0, 0, 0);
		}
	}

	public void reactRightWall()
	{
		if (hitWalls == 0)
		{
			super.reactRightWall();
		}
		if (hitWalls == 1)
		{
			die();
		}
		if (hitWalls == 2)
		{
			lifeTime = 1;
			super.reactRightWall();

		}
		if (hitWalls == 3)
		{
			super.reactRightWall();
			x = atRightWall.x0;
			lifeTime = 1;
			//setImage(scn.store.winkSheet[6]);
			//scn.spEffects.radialParticles(7, scn.store.winkSheet[2], x, y, 120.0, 180.0, 5, 8, 5, 16, 0, 0, 0);
		}
	}

	public void reactLeftWall()
	{
		if (hitWalls == 0)
		{
			super.reactLeftWall();
		}
		if (hitWalls == 1)
		{
			die();
		}
		if (hitWalls == 2)
		{
			lifeTime = 1;
			super.reactLeftWall();
			x = atLeftWall.x0;
		}
		if (hitWalls == 3)
		{
			super.reactLeftWall();
			x = atLeftWall.x0;
			lifeTime = 1;
			//setImage(scn.store.winkSheet[6]);
			//scn.spEffects.radialParticles(7, scn.store.winkSheet[2], x, y, 120.0, 180.0, 5, 8, 5, 16, 0, 0, 0);
		}
	}

	public void reactCeiling()
	{
		if (hitCeiling == 0)
		{
			super.reactCeiling();
		}
		if (hitCeiling == 1)
		{
			die();
		}
		if (hitCeiling == 2)
		{
			lifeTime = 1;
			super.reactCeiling();
			y = atCeiling.y0;
		}
		if (hitCeiling == 3)
		{
			super.reactCeiling();
			y = atCeiling.y0;
			lifeTime = 1;
			//setImage(scn.store.winkSheet[6]);
			//scn.spEffects.radialParticles(7, scn.store.winkSheet[2], x, y, 120.0, 180.0, 5, 8, 5, 16, 0, 0, 0);
		}
	}

	public void handleHit(Hit h)
	{
		//check to see if the hit is against the object that cast the hitbox
		//if hitCaster is enabled, keep going as usual, otherwise break.
		if ((h.b.owner != caster) || (hitCaster == -1))
		{
			if ((h.b.owner instanceof Player) && (hitPlayer >= 0))
			{
				if (((Player)h.b.owner).invincible < 1)
				{
					if (hitPlayer == 0)
					{

					}
					if (hitPlayer == 1)
					{
						//h.b.owner.x = h.x1-h.b.xOffset;
						//h.b.owner.y = h.y1-h.b.yOffset;
						((Player)h.b.owner).takeDamage(this, box, damage);
					}
				}
			}
			if ((h.b.group == 2) && (hitEnemies >= 0))
			{
				hitEnemy();
			}
		}
	}

	public void hitEnemy()
	{

	}

	public void die()
	{
		//if (img != scn.store.blank)
			//scn.spEffects.radialParticles(7, scn.store.winkSheet[2], x, y, 120.0, 180.0, 5, 8, 5, 16, 0, 0, 0);
		super.die();
	}
}

/*
 *
 *
function hitBox::onAddToScene(%this, %scenegraph)
{
	%this.enableUpdateCallback();

	%this.mark = %this; //default is to mark itself
	%this.setCollisionActive(true, true);
	%this.setCollisionPhysics(false, false);
	%this.setGraphGroup(3);
}

//Basic properties
function hitBox::baseConstructor(%this, %caster, %positionX, %positionY, %sizeX, %sizeY, %sprite, %spriteSize, %animation)
{
	%this.caster = %caster;
	%this.setPosition(%positionX, %positionY);
	%this.setSize(%sizeX, %sizeY);

	%this.head = -%sizeY/2;
	%this.feet = %sizeY/2;
	%this.leftHand = -%sizeX/2;
	%this.rightHand = %sizeX/2;

	if (%sprite == true)
	{
		%this.hasSprite = true;
		%this.sprite = new t2dAnimatedSprite();
		%this.sprite.addToScene(Player.playerSceneGraph);
		%this.sprite.setPosition(%positionX, %positionY);
		%this.sprite.setWidth(%spriteSize);
		%this.sprite.setHeight(%spriteSize);
		%this.sprite.setLayer(15);
		%this.sprite.setAnimation(%animation);
		%this.sprite.setBlendColor(Player.getBlendColor());
	}
}

//more detailed
function hitBox::constructor(%this, %power, %priority, %timer, %xSpeed, %ySpeed, %gravity, %maxFall)
{
	%this.power = %power;
	%this.priority = %priority;
	%this.timer = %timer;
	%this.xSpeed = %xSpeed;
	%this.ySpeed = %ySpeed;
	%this.gravity = %gravity;
	%this.maxFall = %maxFall;

	//Other properties, like attack type, should also be set

	//set canHitSelf, canHitPlayer, canHitEnemies, canHitObjects
		//e.g. sword slash can hit enemies and objects, but not player or self,
		//but explosions can hit anything. Some enemy attacks (e.g. body slam) can hit
		//other enemies but not the attacker (caster).
	//other properties like hitsWalls, attackType, etc.?

	//A sprite (animatedSprite) can be associated with a hitBox (e.g. fireball)
	//In fact, it should _be_ a sprite? No, some are invisible
}

function hitBox::setHits(%this, %hitWalls, %hitCaster, %hitPlayer, %hitEnemies, %hitObjects, %onHitFloor, %onHitWalls, %onHitCeiling, %onHitSelf, %onHitPlayer, %onHitEnemies, %onHitObjects)
{
	%this.hitWalls = %hitWalls;
	%this.hitCaster = %hitCaster;
	%this.hitPlayer = %hitPlayer;
	%this.hitEnemies = %hitEnemies;
	%this.hitObjects = %hitObjects;

	%this.onHitFloor = %onHitFloor;
	%this.onHitWalls = %onHitWalls;
	%this.onHitWalls = %onHitCeiling;
	%this.onHitSelf = %onHitSelf;
	%this.onHitPlayer = %onHitPlayer;
	%this.onHitEnemies = %onHitEnemies;
	%this.onHitObjects = %onHitObjects;
}

function hitBox::setMark(%this, %mark, %dieOnMark)
{
	%this.mark = %mark;
	%this.dieOnMark = %dieOnMark;
	//%mark.trail = %this;?
}

function hitBox::onUpdate(%this)
{
	if (%this.delay < 1)
	{
		if (%this.mark == %this)
			%this.setPosition(%this.getPositionX()+%this.xSpeed, %this.getPositionY()+%this.ySpeed);
		else
			%this.setPosition(%this.mark.getPosition());

		//gravity
		if (%this.ySpeed < %this.maxFall)
			%this.ySpeed += %this.gravity;

		%this.checkCollision();

		if (%this.hasSprite == true)
			%this.sprite.setPosition(%this.getPosition());

		if (%this.timer == 0)
		{
			%this.safeDelete();
			if (%this.hasSprite == true)
				%this.sprite.safeDelete();
		}
		%this.timer--;
	}
	%this.delay--;
}

function hitBox::checkCollision(%this)
{
	//hitBoxes only send collisions to entities
	//they can recieve them from walls or other hitBoxes (deflection)
	%collision = %this.castCollisionList(0.0);
	%numObjects = getWordCount(%collision);
	for (%i = 0; %i < %numObjects; %i++)
	{
		%other = getWord(%collision, %i);
		if (%other.getGraphGroup() == 1)
			%this.collided(%other);
	}
}

function hitBox::collided(%this, %other)
{
	//trying something a bit new. Using eval() to dynamically execute code that is passed as a string
	//from the caster. This would allow for simple commands like "%this.sprite.setAnimation(SmallExplosion);"
	//or "%this.safeDelete();" to be executed upon collision with specific objects, like walls.
	if (%other.getGraphGroup() == 2)
	{

	}

	if ((%other.getGraphGroup() == 1) && (%this.hitWalls == true))
	{
		if (%other.getRotation() == 0.0)
			%this.floorCollision(%other);
		if (%other.getRotation() == 270.0)
			%this.leftCollision(%other);
		if (%other.getRotation() == 90.0)
			%this.rightCollision(%other);
		if (%other.getRotation() == 180.0)
			%this.ceilCollision(%other);
	}
}

function hitBox::floorCollision(%this, %other)
{
	if (%other.basicFloor(%this, %this.feet, %this.leftHand, %this.rightHand) == true)
	{
		%priorYSpeed = %this.ySpeed;
		%this.setPositionY(%other.y0-%this.feet);
		if (%this.ySpeed > 0)
			%this.ySpeed = 0;

		%this.onGround = true;
		%this.onTerrain = %other;
		%this.struckWall(%other, %this.onHitFloor, %this.xSpeed, %priorYSpeed);
	}
}

function hitBox::leftCollision(%this, %other)
{
	if (%other.basicLeft(%this, %this.rightHand, %this.head, %this.feet) == true)
	{
		%priorXSpeed = %this.xSpeed;
		%this.setPositionX(%other.x0-%this.rightHand);
		if (%this.xSpeed > 0)
			%this.xSpeed = 0;
		%this.struckWall(%other, %this.onHitWalls, %priorXSpeed, %this.ySpeed);
	}
}

function hitBox::rightCollision(%this, %other)
{
	if (%other.basicRight(%this, %this.leftHand, %this.head, %this.feet) == true)
	{
		%priorXSpeed = %this.xSpeed;
		%this.setPositionX(%other.x0-%this.leftHand);
		if (%this.xSpeed < 0)
			%this.xSpeed = 0;
		%this.struckWall(%other, %this.onHitWalls, %priorXSpeed, %this.ySpeed);
	}
}

function hitBox::ceilCollision(%this, %other)
{
	if (%other.basicCeil(%this, %this.head, %this.leftHand, %this.rightHand) == true)
	{
		%priorYSpeed = %this.ySpeed;
		%this.setPositionY(%other.y0-%this.head);
		if (%this.ySpeed < 0)
			%this.ySpeed = 0;
		%this.struckWall(%other, %this.onHitWalls, %this.xSpeed, %priorYSpeed);
	}
}

function hitBox::struckWall(%this, %other, %index, %xSpeed, %ySpeed)
{
	//check the index for the effect a wall has on this object
	//0 = just stop
	if (%index == 1) //just delete
	{
		%this.setPositionY(%other.y0);
		%this.timer = 0;
	}
	if (%index == 2) //bounce
	{
		if ((%other.getRotation() == 0) || (%other.getRotation() == 180))
			%this.ySpeed = -%ySpeed;
		if ((%other.getRotation() == 90) || (%other.getRotation() == 270))
			%this.xSpeed  = -%xSpeed;
	}
	if (%index == 3) //small explosion
	{
		%this.setPositionY(%other.y0);
		SpecialEffects.smallExplosion(%this.getPositionX(), %this.getPositionY());
		%this.timer = 0;
	}
}

*/


text:
.mto-header .container {
background:#074f8c url(../images/mto-header.jpg) left center no-repeat;
}
#protector-series img {
border: 1px solid #ddd;
}
#protector-video li {
margin-left: 20px;
}
#protector-video ul {
margin-left:0;
}
.materials-callout h6 {
text-align: center;
color:#ff8800;
font-weight:500;
}

@media only screen and (max-width: 900px) and (min-width: 768px) {

}

/* small screen retina */
@media
only screen and (-webkit-min-device-pixel-ratio: 1.5)      and (min-width: 320px),
only screen and (   min--moz-device-pixel-ratio: 1.5)      and (min-width: 320px),
only screen and (     -o-min-device-pixel-ratio: 2/1)    and (min-width: 320px),
only screen and (        min-device-pixel-ratio: 1.5)      and (min-width: 320px),
only screen and (                min-resolution: 192dpi) and (min-width: 320px),
only screen and (                min-resolution: 2dppx)  and (min-width: 320px) {

}

/* Small display targeting */
@media only screen and (max-width: 767px) {

}


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

namespace GodLesZ.Library.Win7.Shell {
	/// <summary>
	/// Collection of all the standard system stock icons
	/// </summary>
	public class StockIcons {
		#region Private Members

		private IDictionary<StockIconIdentifier, StockIcon> stockIconCache;
		private StockIconSize defaultSize = StockIconSize.Large;
		private bool isSelected;
		private bool isLinkOverlay;

		#endregion

		#region Public Constructors

		/// <summary>
		/// Creates a stock icon collection using the default options for
		/// size, link overlay and selection state.
		/// </summary>
		public StockIcons() {
			// Create an empty dictionary. Stock icons will be created when requested
			// or when they are enumerated on this collection
			stockIconCache = new Dictionary<StockIconIdentifier, StockIcon>();

			Array allIdentifiers = Enum.GetValues(typeof(StockIconIdentifier));

			foreach (StockIconIdentifier id in allIdentifiers) {
				stockIconCache.Add(id, null);
			}
		}

		/// <summary>
		/// Overloaded constructor that takes in size and Boolean values for
		/// link overlay and selected icon state. The settings are applied to
		/// all the stock icons in the collection.
		/// </summary>
		/// <param name="size">StockIcon size for all the icons in the collection.</param>
		/// <param name="linkOverlay">Link Overlay state for all the icons in the collection.</param>
		/// <param name="selected">Selection state for all the icons in the collection.</param>
		public StockIcons(StockIconSize size, bool linkOverlay, bool selected) {
			defaultSize = size;
			isLinkOverlay = linkOverlay;
			isSelected = selected;

			// Create an empty dictionary. Stock icons will be created when requested
			// or when they are enumerated on this collection
			stockIconCache = new Dictionary<StockIconIdentifier, StockIcon>();

			Array allIdentifiers = Enum.GetValues(typeof(StockIconIdentifier));

			foreach (StockIconIdentifier id in allIdentifiers) {
				stockIconCache.Add(id, null);
			}
		}

		#endregion

		#region Public Properties

		/// <summary>
		/// Gets the default stock icon size in one of the StockIconSize values.
		/// This size applies to all the stock icons in the collection.
		/// </summary>
		public StockIconSize DefaultSize {
			get { return defaultSize; }
		}

		/// <summary>
		/// Gets the default link overlay state for the icon. This property
		/// applies to all the stock icons in the collection.
		/// </summary>
		public bool DefaultLinkOverlay {
			get { return isLinkOverlay; }
		}

		/// <summary>
		/// Gets the default selected state for the icon. This property
		/// applies to all the stock icons in the collection.
		/// </summary>
		public bool DefaultSelectedState {
			get { return isSelected; }
		}

		/// <summary>
		/// Gets a collection of all the system stock icons
		/// </summary>
		public ICollection<StockIcon> AllStockIcons {
			get { return GetAllStockIcons(); }
		}

		/// <summary>
		/// Icon for a document (blank page), no associated program.
		/// </summary>
		public StockIcon DocumentNotAssociated { get { return GetStockIcon(StockIconIdentifier.DocumentNotAssociated); } }

		/// <summary>
		/// Icon for a document with an associated program.
		/// </summary>
		public StockIcon DocumentAssociated { get { return GetStockIcon(StockIconIdentifier.DocumentAssociated); } }

		/// <summary>
		///  Icon for a generic application with no custom icon.
		/// </summary>
		public StockIcon Application { get { return GetStockIcon(StockIconIdentifier.Application); } }

		/// <summary>
		///  Icon for a closed folder.
		/// </summary>
		public StockIcon Folder { get { return GetStockIcon(StockIconIdentifier.Folder); } }

		/// <summary>
		/// Icon for an open folder.
		/// </summary>
		public StockIcon FolderOpen { get { return GetStockIcon(StockIconIdentifier.FolderOpen); } }

		/// <summary>
		/// Icon for a 5.25" floppy disk drive.
		/// </summary>
		public StockIcon Drive525 { get { return GetStockIcon(StockIconIdentifier.Drive525); } }

		/// <summary>
		///  Icon for a 3.5" floppy disk drive.
		/// </summary>
		public StockIcon Drive35 { get { return GetStockIcon(StockIconIdentifier.Drive35); } }

		/// <summary>
		///  Icon for a removable drive.
		/// </summary>
		public StockIcon DriveRemove { get { return GetStockIcon(StockIconIdentifier.DriveRemove); } }

		/// <summary>
		///  Icon for a fixed (hard disk) drive.
		/// </summary>
		public StockIcon DriveFixed { get { return GetStockIcon(StockIconIdentifier.DriveFixed); } }

		/// <summary>
		///  Icon for a network drive.
		/// </summary>
		public StockIcon DriveNetwork { get { return GetStockIcon(StockIconIdentifier.DriveNetwork); } }

		/// <summary>
		///  Icon for a disconnected network drive.
		/// </summary>
		public StockIcon DriveNetworkDisabled { get { return GetStockIcon(StockIconIdentifier.DriveNetworkDisabled); } }

		/// <summary>
		///  Icon for a CD drive.
		/// </summary>
		public StockIcon DriveCD { get { return GetStockIcon(StockIconIdentifier.DriveCD); } }

		/// <summary>
		///  Icon for a RAM disk drive.
		/// </summary>
		public StockIcon DriveRam { get { return GetStockIcon(StockIconIdentifier.DriveRam); } }

		/// <summary>
		///  Icon for an entire network.
		/// </summary>
		public StockIcon World { get { return GetStockIcon(StockIconIdentifier.World); } }

		/// <summary>
		///  Icon for a computer on the network.
		/// </summary>
		public StockIcon Server { get { return GetStockIcon(StockIconIdentifier.Server); } }

		/// <summary>
		///  Icon for a printer.
		/// </summary>
		public StockIcon Printer { get { return GetStockIcon(StockIconIdentifier.Printer); } }

		/// <summary>
		/// Icon for My Network places.
		/// </summary>
		public StockIcon MyNetwork { get { return GetStockIcon(StockIconIdentifier.MyNetwork); } }

		/// <summary>
		/// Icon for search (magnifying glass).
		/// </summary>
		public StockIcon Find { get { return GetStockIcon(StockIconIdentifier.Find); } }

		/// <summary>
		///  Icon for help.
		/// </summary>
		public StockIcon Help { get { return GetStockIcon(StockIconIdentifier.Help); } }

		/// <summary>
		///  Icon for an overlay indicating shared items.
		/// </summary>
		public StockIcon Share { get { return GetStockIcon(StockIconIdentifier.Share); } }

		/// <summary>
		///  Icon for an overlay indicating shortcuts to items.
		/// </summary>
		public StockIcon Link { get { return GetStockIcon(StockIconIdentifier.Link); } }

		/// <summary>
		/// Icon for an overlay for slow items.
		/// </summary>
		public StockIcon SlowFile { get { return GetStockIcon(StockIconIdentifier.SlowFile); } }

		/// <summary>
		///  Icon for a empty recycle bin.
		/// </summary>
		public StockIcon Recycler { get { return GetStockIcon(StockIconIdentifier.Recycler); } }

		/// <summary>
		///  Icon for a full recycle bin.
		/// </summary>
		public StockIcon RecyclerFull { get { return GetStockIcon(StockIconIdentifier.RecyclerFull); } }

		/// <summary>
		///  Icon for audio CD media.
		/// </summary>
		public StockIcon MediaCDAudio { get { return GetStockIcon(StockIconIdentifier.MediaCDAudio); } }

		/// <summary>
		///  Icon for a security lock.
		/// </summary>
		public StockIcon Lock { get { return GetStockIcon(StockIconIdentifier.Lock); } }

		/// <summary>
		///  Icon for a auto list.
		/// </summary>
		public StockIcon AutoList { get { return GetStockIcon(StockIconIdentifier.AutoList); } }

		/// <summary>
		/// Icon for a network printer.
		/// </summary>
		public StockIcon PrinterNet { get { return GetStockIcon(StockIconIdentifier.PrinterNet); } }

		/// <summary>
		///  Icon for a server share.
		/// </summary>
		public StockIcon ServerShare { get { return GetStockIcon(StockIconIdentifier.ServerShare); } }

		/// <summary>
		///  Icon for a Fax printer.
		/// </summary>
		public StockIcon PrinterFax { get { return GetStockIcon(StockIconIdentifier.PrinterFax); } }

		/// <summary>
		/// Icon for a networked Fax printer.
		/// </summary>
		public StockIcon PrinterFaxNet { get { return GetStockIcon(StockIconIdentifier.PrinterFaxNet); } }

		/// <summary>
		///  Icon for print to file.
		/// </summary>
		public StockIcon PrinterFile { get { return GetStockIcon(StockIconIdentifier.PrinterFile); } }

		/// <summary>
		/// Icon for a stack.
		/// </summary>
		public StockIcon Stack { get { return GetStockIcon(StockIconIdentifier.Stack); } }

		/// <summary>
		///  Icon for a SVCD media.
		/// </summary>
		public StockIcon MediaSvcd { get { return GetStockIcon(StockIconIdentifier.MediaSvcd); } }

		/// <summary>
		///  Icon for a folder containing other items.
		/// </summary>
		public StockIcon StuffedFolder { get { return GetStockIcon(StockIconIdentifier.StuffedFolder); } }

		/// <summary>
		///  Icon for an unknown drive.
		/// </summary>
		public StockIcon DriveUnknown { get { return GetStockIcon(StockIconIdentifier.DriveUnknown); } }

		/// <summary>
		///  Icon for a DVD drive.
		/// </summary>
		public StockIcon DriveDvd { get { return GetStockIcon(StockIconIdentifier.DriveDvd); } }

		/// <summary>
		/// Icon for DVD media.
		/// </summary>
		public StockIcon MediaDvd { get { return GetStockIcon(StockIconIdentifier.MediaDvd); } }

		/// <summary>
		///  Icon for DVD-RAM media.
		/// </summary>
		public StockIcon MediaDvdRam { get { return GetStockIcon(StockIconIdentifier.MediaDvdRam); } }

		/// <summary>
		/// Icon for DVD-RW media.
		/// </summary>
		public StockIcon MediaDvdRW { get { return GetStockIcon(StockIconIdentifier.MediaDvdRW); } }

		/// <summary>
		///  Icon for DVD-R media.
		/// </summary>
		public StockIcon MediaDvdR { get { return GetStockIcon(StockIconIdentifier.MediaDvdR); } }

		/// <summary>
		///  Icon for a DVD-ROM media.
		/// </summary>
		public StockIcon MediaDvdRom { get { return GetStockIcon(StockIconIdentifier.MediaDvdRom); } }

		/// <summary>
		///  Icon for CD+ (Enhanced CD) media.
		/// </summary>
		public StockIcon MediaCDAudioPlus { get { return GetStockIcon(StockIconIdentifier.MediaCDAudioPlus); } }

		/// <summary>
		///  Icon for CD-RW media.
		/// </summary>
		public StockIcon MediaCDRW { get { return GetStockIcon(StockIconIdentifier.MediaCDRW); } }

		/// <summary>
		///  Icon for a CD-R media.
		/// </summary>
		public StockIcon MediaCDR { get { return GetStockIcon(StockIconIdentifier.MediaCDR); } }

		/// <summary>
		///  Icon burning a CD.
		/// </summary>
		public StockIcon MediaCDBurn { get { return GetStockIcon(StockIconIdentifier.MediaCDBurn); } }

		/// <summary>
		///  Icon for blank CD media.
		/// </summary>
		public StockIcon MediaBlankCD { get { return GetStockIcon(StockIconIdentifier.MediaBlankCD); } }

		/// <summary>
		///  Icon for CD-ROM media.
		/// </summary>
		public StockIcon MediaCDRom { get { return GetStockIcon(StockIconIdentifier.MediaCDRom); } }

		/// <summary>
		///  Icon for audio files.
		/// </summary>
		public StockIcon AudioFiles { get { return GetStockIcon(StockIconIdentifier.AudioFiles); } }

		/// <summary>
		///  Icon for image files.
		/// </summary>
		public StockIcon ImageFiles { get { return GetStockIcon(StockIconIdentifier.ImageFiles); } }

		/// <summary>
		///  Icon for video files.
		/// </summary>
		public StockIcon VideoFiles { get { return GetStockIcon(StockIconIdentifier.VideoFiles); } }

		/// <summary>
		///  Icon for mixed Files.
		/// </summary>
		public StockIcon MixedFiles { get { return GetStockIcon(StockIconIdentifier.MixedFiles); } }

		/// <summary>
		/// Icon for a folder back.
		/// </summary>
		public StockIcon FolderBack { get { return GetStockIcon(StockIconIdentifier.FolderBack); } }

		/// <summary>
		///  Icon for a folder front.
		/// </summary>
		public StockIcon FolderFront { get { return GetStockIcon(StockIconIdentifier.FolderFront); } }

		/// <summary>
		///  Icon for a security shield. Use for UAC prompts only.
		/// </summary>
		public StockIcon Shield { get { return GetStockIcon(StockIconIdentifier.Shield); } }

		/// <summary>
		///  Icon for a warning.
		/// </summary>
		public StockIcon Warning { get { return GetStockIcon(StockIconIdentifier.Warning); } }

		/// <summary>
		///  Icon for an informational message.
		/// </summary>
		public StockIcon Info { get { return GetStockIcon(StockIconIdentifier.Info); } }

		/// <summary>
		///  Icon for an error message.
		/// </summary>
		public StockIcon Error { get { return GetStockIcon(StockIconIdentifier.Error); } }

		/// <summary>
		///  Icon for a key.
		/// </summary>
		public StockIcon Key { get { return GetStockIcon(StockIconIdentifier.Key); } }

		/// <summary>
		///  Icon for software.
		/// </summary>
		public StockIcon Software { get { return GetStockIcon(StockIconIdentifier.Software); } }

		/// <summary>
		///  Icon for a rename.
		/// </summary>
		public StockIcon Rename { get { return GetStockIcon(StockIconIdentifier.Rename); } }

		/// <summary>
		///  Icon for delete.
		/// </summary>
		public StockIcon Delete { get { return GetStockIcon(StockIconIdentifier.Delete); } }

		/// <summary>
		///  Icon for audio DVD media.
		/// </summary>
		public StockIcon MediaAudioDvd { get { return GetStockIcon(StockIconIdentifier.MediaAudioDvd); } }

		/// <summary>
		///  Icon for movie DVD media.
		/// </summary>
		public StockIcon MediaMovieDvd { get { return GetStockIcon(StockIconIdentifier.MediaMovieDvd); } }

		/// <summary>
		///  Icon for enhanced CD media.
		/// </summary>
		public StockIcon MediaEnhancedCD { get { return GetStockIcon(StockIconIdentifier.MediaEnhancedCD); } }

		/// <summary>
		///  Icon for enhanced DVD media.
		/// </summary>
		public StockIcon MediaEnhancedDvd { get { return GetStockIcon(StockIconIdentifier.MediaEnhancedDvd); } }

		/// <summary>
		///  Icon for HD-DVD media.
		/// </summary>
		public StockIcon MediaHDDvd { get { return GetStockIcon(StockIconIdentifier.MediaHDDvd); } }

		/// <summary>
		///  Icon for BluRay media.
		/// </summary>
		public StockIcon MediaBluRay { get { return GetStockIcon(StockIconIdentifier.MediaBluRay); } }

		/// <summary>
		///  Icon for VCD media.
		/// </summary>
		public StockIcon MediaVcd { get { return GetStockIcon(StockIconIdentifier.MediaVcd); } }

		/// <summary>
		///  Icon for DVD+R media.
		/// </summary>
		public StockIcon MediaDvdPlusR { get { return GetStockIcon(StockIconIdentifier.MediaDvdPlusR); } }

		/// <summary>
		///  Icon for DVD+RW media.
		/// </summary>
		public StockIcon MediaDvdPlusRW { get { return GetStockIcon(StockIconIdentifier.MediaDvdPlusRW); } }

		/// <summary>
		///  Icon for desktop computer.
		/// </summary>
		public StockIcon DesktopPC { get { return GetStockIcon(StockIconIdentifier.DesktopPC); } }

		/// <summary>
		///  Icon for mobile computer (laptop/notebook).
		/// </summary>
		public StockIcon MobilePC { get { return GetStockIcon(StockIconIdentifier.MobilePC); } }

		/// <summary>
		///  Icon for users.
		/// </summary>
		public StockIcon Users { get { return GetStockIcon(StockIconIdentifier.Users); } }

		/// <summary>
		///  Icon for smart media.
		/// </summary>
		public StockIcon MediaSmartMedia { get { return GetStockIcon(StockIconIdentifier.MediaSmartMedia); } }

		/// <summary>
		///  Icon for compact flash.
		/// </summary>
		public StockIcon MediaCompactFlash { get { return GetStockIcon(StockIconIdentifier.MediaCompactFlash); } }

		/// <summary>
		///  Icon for a cell phone.
		/// </summary>
		public StockIcon DeviceCellPhone { get { return GetStockIcon(StockIconIdentifier.DeviceCellPhone); } }

		/// <summary>
		///  Icon for a camera.
		/// </summary>
		public StockIcon DeviceCamera { get { return GetStockIcon(StockIconIdentifier.DeviceCamera); } }

		/// <summary>
		///  Icon for video camera.
		/// </summary>
		public StockIcon DeviceVideoCamera { get { return GetStockIcon(StockIconIdentifier.DeviceVideoCamera); } }

		/// <summary>
		///  Icon for audio player.
		/// </summary>
		public StockIcon DeviceAudioPlayer { get { return GetStockIcon(StockIconIdentifier.DeviceAudioPlayer); } }

		/// <summary>
		///  Icon for connecting to network.
		/// </summary>
		public StockIcon NetworkConnect { get { return GetStockIcon(StockIconIdentifier.NetworkConnect); } }

		/// <summary>
		///  Icon for the Internet.
		/// </summary>
		public StockIcon Internet { get { return GetStockIcon(StockIconIdentifier.Internet); } }

		/// <summary>
		///  Icon for a ZIP file.
		/// </summary>
		public StockIcon ZipFile { get { return GetStockIcon(StockIconIdentifier.ZipFile); } }

		/// <summary>
		/// Icon for settings.
		/// </summary>
		public StockIcon Settings { get { return GetStockIcon(StockIconIdentifier.Settings); } }

		/// <summary>
		/// HDDVD Drive (all types)
		/// </summary>
		public StockIcon DriveHDDVD { get { return GetStockIcon(StockIconIdentifier.DriveHDDVD); } }

		/// <summary>
		/// Icon for BluRay Drive (all types)
		/// </summary>
		public StockIcon DriveBluRay { get { return GetStockIcon(StockIconIdentifier.DriveBluRay); } }

		/// <summary>
		/// Icon for HDDVD-ROM Media
		/// </summary>
		public StockIcon MediaHDDVDROM { get { return GetStockIcon(StockIconIdentifier.MediaHDDVDROM); } }

		/// <summary>
		/// Icon for HDDVD-R Media
		/// </summary>
		public StockIcon MediaHDDVDR { get { return GetStockIcon(StockIconIdentifier.MediaHDDVDR); } }

		/// <summary>
		/// Icon for HDDVD-RAM Media
		/// </summary>
		public StockIcon MediaHDDVDRAM { get { return GetStockIcon(StockIconIdentifier.MediaHDDVDRAM); } }

		/// <summary>
		/// Icon for BluRay ROM Media
		/// </summary>
		public StockIcon MediaBluRayROM { get { return GetStockIcon(StockIconIdentifier.MediaBluRayROM); } }

		/// <summary>
		/// Icon for BluRay R Media
		/// </summary>
		public StockIcon MediaBluRayR { get { return GetStockIcon(StockIconIdentifier.MediaBluRayR); } }

		/// <summary>
		/// Icon for BluRay RE Media (Rewriable and RAM)
		/// </summary>
		public StockIcon MediaBluRayRE { get { return GetStockIcon(StockIconIdentifier.MediaBluRayRE); } }

		/// <summary>
		/// Icon for Clustered disk
		/// </summary>
		public StockIcon ClusteredDisk { get { return GetStockIcon(StockIconIdentifier.ClusteredDisk); } }

		#endregion

		#region Private Methods

		/// <summary>
		/// Returns the existing stock icon from the internal cache, or creates a new one
		/// based on the current settings if it's not in the cache.
		/// </summary>
		/// <param name="stockIconIdentifier">Unique identifier for the requested stock icon</param>
		/// <returns>Stock Icon based on the identifier given (either from the cache or created new)</returns>
		private StockIcon GetStockIcon(StockIconIdentifier stockIconIdentifier) {
			// Check the cache first
			if (stockIconCache[stockIconIdentifier] != null)
				return stockIconCache[stockIconIdentifier];
			else {
				// Create a new icon based on our default settings
				StockIcon icon = new StockIcon(stockIconIdentifier, defaultSize, isLinkOverlay, isSelected);

				try {
					// Add it to the cache
					stockIconCache[stockIconIdentifier] = icon;
				} catch {
					icon.Dispose();
					throw;
				}

				// Return
				return icon;
			}
		}

		private ICollection<StockIcon> GetAllStockIcons() {
			// Create a list of stock Identifiers
			StockIconIdentifier[] ids = new StockIconIdentifier[stockIconCache.Count];
			stockIconCache.Keys.CopyTo(ids, 0);

			// For each identifier, if our cache is null, create a new stock icon
			foreach (StockIconIdentifier id in ids) {
				if (stockIconCache[id] == null)
					GetStockIcon(id);
			}

			// return the list of stock icons
			return stockIconCache.Values;
		}

		#endregion

	}

}


text:
/* Event definitions for RegisterForEvent */
#define FC_REG_LINK_EVENT		0x0001	/* link up / down events */
#define FC_REG_RSCN_EVENT		0x0002	/* RSCN events */
#define FC_REG_CT_EVENT			0x0004	/* CT request events */
#define FC_REG_DUMP_EVENT		0x0010	/* Dump events */
#define FC_REG_TEMPERATURE_EVENT	0x0020	/* temperature events */
#define FC_REG_VPORTRSCN_EVENT		0x0040	/* Vport RSCN events */
#define FC_REG_ELS_EVENT		0x0080	/* lpfc els events */
#define FC_REG_FABRIC_EVENT		0x0100	/* lpfc fabric events */
#define FC_REG_SCSI_EVENT		0x0200	/* lpfc scsi events */
#define FC_REG_BOARD_EVENT		0x0400	/* lpfc board events */
#define FC_REG_ADAPTER_EVENT		0x0800	/* lpfc adapter events */
#define FC_REG_EVENT_MASK		(FC_REG_LINK_EVENT | \
						FC_REG_RSCN_EVENT | \
						FC_REG_CT_EVENT | \
						FC_REG_DUMP_EVENT | \
						FC_REG_TEMPERATURE_EVENT | \
						FC_REG_VPORTRSCN_EVENT | \
						FC_REG_ELS_EVENT | \
						FC_REG_FABRIC_EVENT | \
						FC_REG_SCSI_EVENT | \
						FC_REG_BOARD_EVENT | \
						FC_REG_ADAPTER_EVENT)
/* Temperature events */
#define LPFC_CRIT_TEMP		0x1
#define LPFC_THRESHOLD_TEMP	0x2
#define LPFC_NORMAL_TEMP	0x3
/*
 * All net link event payloads will begin with and event type
 * and subcategory. The event type must come first.
 * The subcategory further defines the data that follows in the rest
 * of the payload. Each category will have its own unique header plus
 * any additional data unique to the subcategory.
 * The payload sent via the fc transport is one-way driver->application.
 */

/* RSCN event header */
struct lpfc_rscn_event_header {
	uint32_t event_type;
	uint32_t payload_length; /* RSCN data length in bytes */
	uint32_t rscn_payload[];
};

/* els event header */
struct lpfc_els_event_header {
	uint32_t event_type;
	uint32_t subcategory;
	uint8_t wwpn[8];
	uint8_t wwnn[8];
};

/* subcategory codes for FC_REG_ELS_EVENT */
#define LPFC_EVENT_PLOGI_RCV		0x01
#define LPFC_EVENT_PRLO_RCV		0x02
#define LPFC_EVENT_ADISC_RCV		0x04
#define LPFC_EVENT_LSRJT_RCV		0x08
#define LPFC_EVENT_LOGO_RCV		0x10

/* special els lsrjt event */
struct lpfc_lsrjt_event {
	struct lpfc_els_event_header header;
	uint32_t command;
	uint32_t reason_code;
	uint32_t explanation;
};

/* special els logo event */
struct lpfc_logo_event {
	struct lpfc_els_event_header header;
	uint8_t logo_wwpn[8];
};

/* fabric event header */
struct lpfc_fabric_event_header {
	uint32_t event_type;
	uint32_t subcategory;
	uint8_t wwpn[8];
	uint8_t wwnn[8];
};

/* subcategory codes for FC_REG_FABRIC_EVENT */
#define LPFC_EVENT_FABRIC_BUSY		0x01
#define LPFC_EVENT_PORT_BUSY		0x02
#define LPFC_EVENT_FCPRDCHKERR		0x04

/* special case fabric fcprdchkerr event */
struct lpfc_fcprdchkerr_event {
	struct lpfc_fabric_event_header header;
	uint32_t lun;
	uint32_t opcode;
	uint32_t fcpiparam;
};

/* scsi event header */
struct lpfc_scsi_event_header {
	uint32_t event_type;
	uint32_t subcategory;
	uint32_t lun;
	uint8_t wwpn[8];
	uint8_t wwnn[8];
};

/* subcategory codes for FC_REG_SCSI_EVENT */
#define LPFC_EVENT_QFULL	0x0001
#define LPFC_EVENT_DEVBSY	0x0002
#define LPFC_EVENT_CHECK_COND	0x0004
#define LPFC_EVENT_LUNRESET	0x0008
#define LPFC_EVENT_TGTRESET	0x0010
#define LPFC_EVENT_BUSRESET	0x0020
#define LPFC_EVENT_VARQUEDEPTH	0x0040

/* special case scsi varqueuedepth event */
struct lpfc_scsi_varqueuedepth_event {
	struct lpfc_scsi_event_header scsi_event;
	uint32_t oldval;
	uint32_t newval;
};

/* special case scsi check condition event */
struct lpfc_scsi_check_condition_event {
	struct lpfc_scsi_event_header scsi_event;
	uint8_t opcode;
	uint8_t sense_key;
	uint8_t asc;
	uint8_t ascq;
};

/* event codes for FC_REG_BOARD_EVENT */
#define LPFC_EVENT_PORTINTERR		0x01

/* board event header */
struct lpfc_board_event_header {
	uint32_t event_type;
	uint32_t subcategory;
};

/* event codes for FC_REG_ADAPTER_EVENT */
#define LPFC_EVENT_ARRIVAL	0x01

/* adapter event header */
struct lpfc_adapter_event_header {
	uint32_t event_type;
	uint32_t subcategory;
};

/* event codes for temp_event */
#define LPFC_CRIT_TEMP		0x1
#define LPFC_THRESHOLD_TEMP	0x2
#define LPFC_NORMAL_TEMP	0x3

struct temp_event {
	uint32_t event_type;
	uint32_t event_code;
	uint32_t data;
};


text:
echo "Inside TCP specific setting " >> $info

# Now generate daemon for the node
if ($id == 1) then
    set dst = node-$maxnodes
    if ($perhop == 1) then
	set dst =  node-2-link-1
    endif

    echo "executing ftp: client $txdir  $logroot/ftplog.$id $dst  " >> $info
    tclsh $dtn2root/test/$proto_ftp client $txdir  $logroot/ftplog.$id $dst  >>& $info

    exit

endif

if ($id == $maxnodes) then
    echo "executing ftp: server $rcvdir  $logroot/ftplog.$id  " >> $info
    tclsh $dtn2root/test/$proto_ftp server $rcvdir  $logroot/ftplog.$id >>& $info
    exit
endif

## For other nodes which are in between
if ($perhop == 1) then
    ## set up TCP forwarding proxies
    set idplus  = `expr $id + 1`
    set idminus = `expr $id - 1`

    set myip = node-$id-link-$idminus
    set dstip = node-$idplus-link-$id
    set rconf = "$logroot/$id.rinetd-conf"
    set rinetdlogfile = "$logroot/$id.rinetd-log"

    echo $myip 17600 $dstip 17600 > $rconf
    echo "logfile $rinetdlogfile" >> $rconf

    echo " executing rinetd at router ($myip, $dstip) " >> $info
    echo " rule is:  " >> $info
    cat $rconf >> $info
    $dtnroot/rinetd/rinetd -c $rconf ;

endif


text:
namespace Postbode.Interfaces
{
    public interface IContent
    {
        string Type { get; }

        string Content { get; set; }

        bool IsMime { get; }
    }
}


text:
"use strict";
var GoalIndicatorBase = (function () {
    function GoalIndicatorBase() {
    }
    return GoalIndicatorBase;
}());
exports.GoalIndicatorBase = GoalIndicatorBase;
//# sourceMappingURL=goal-indicator.base.js.map


text:
cask 'lbry' do
  version '0.35.1'
  sha256 '2d91e0cc7388bca1b9595235d1bd8a5f6dc875bedeb7b587a282368e26d4b033'

  # github.com/lbryio/lbry-desktop was verified as official when first introduced to the cask
  url "https://github.com/lbryio/lbry-desktop/releases/download/v#{version}/LBRY_#{version}.dmg"
  appcast 'https://github.com/lbryio/lbry-desktop/releases.atom'
  name 'LBRY'
  homepage 'https://lbry.com/'

  app 'LBRY.app'
end


text:
<?php

namespace ZendTest\EventManager\TestAsset;

use Zend\EventManager\AbstractListenerAggregate;
use Zend\EventManager\EventManagerInterface;

/**
 * @group      Zend_EventManager
 */
class MockAbstractListenerAggregate extends AbstractListenerAggregate
{
    public $priority;

    public function attach(EventManagerInterface $events)
    {
        $this->listeners[] = $events->attach('foo.bar', array($this, 'doFoo'));
        $this->listeners[] = $events->attach('foo.baz', array($this, 'doFoo'));
    }

    public function getCallbacks()
    {
        return $this->listeners;
    }

    public function doFoo()
    {
    }
}


text:
import os, sys
from os.path import expanduser
import subprocess

alias_files = ['.bash_aliases',
               '.bash_profile']

class bcolors:
    HEADER = '\033[95m'
    OKBLUE = '\033[94m'
    OKGREEN = '\033[92m'
    WARNING = '\033[93m'
    FAIL = '\033[91m'
    ENDC = '\033[0m'

    def disable(self):
        self.HEADER = ''
        self.OKBLUE = ''
        self.OKGREEN = ''
        self.WARNING = ''
        self.FAIL = ''
        self.ENDC = ''

def extract_command(line, tag, verbose):
    if 'desc' not in line:
        return
    try:
        desc = aliases[aliases.index(line)]
        cmd = aliases[aliases.index(line) + 1]
    except ValueError, e:
        print "Error: %s invalid" % line
        return

    if tag and not 'tag=%s' % tag in desc:
        return
    if not tag:
        if not verbose and '-v' in line:
            return
    return (parse_cmd(cmd), parse_desc(desc))

def parse_cmd(command):
    return command.split('=')[0].split()[1]

def parse_desc(desc, tagonly=False):
    if 'tag=' in desc:
        desc, tag = desc.split('tag=')
    if tagonly:
        return tag.split()[0]
    return desc.split('desc ', 1)[1]

def bold(text):
    return '\033[1m' + text

def blue(text):
    return bcolors.OKBLUE  + text + bcolors.ENDC

def print_usage(alias):
    print "%-27s -- %-50s" % (bold(blue(alias[0])), alias[1])

def user_home():
    return expanduser("~")

#return first found defined alias file
for f in alias_files:
    aliases = os.path.join(user_home(), f)
    if os.path.exists(aliases):
        shortfile = aliases
        break

def set_opts():
    if not len(sys.argv) >= 2:
        return None, None
    verbose = False
    if '-v' in sys.argv:
        verbose = True
    if sys.argv[1] == '-v':
        return verbose, None
    else:
        return verbose, sys.argv[1]

def extract_tags(line):
    if 'tag=' in line:
        return parse_desc(line, tagonly=True)

v, tag = set_opts()

if tag:
    print "Tagged:", tag

if v:
    print "Verbose included"

aliases = open(shortfile).read().split('alias_definitions:')[1].splitlines()
#if special 'tag' literal then pull out defined tags from file
if tag == 'tag':
    for tag in set(filter(None, map(extract_tags, aliases))):
        print "%s" % (bold(blue(tag)))
else:
    map(print_usage, filter(None, map(lambda a: extract_command(a, tag, v), aliases)))


text:
package com.qixiao.qxweblib.util;

import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.widget.Toast;

import com.qixiao.qxweblib.R;

import java.util.List;

/**
 * Created by liu jun on 2017/5/12.
 */

public class Utils {

    public static Intent newEmailIntent(String toAddress, String subject, String body, String cc) {
        Intent intent = new Intent(Intent.ACTION_SENDTO);
        intent.setData(Uri.parse("mailto:" + Uri.encode(toAddress) + "?subject=" + Uri.encode(subject) + "&body=" + Uri.encode(body) + "&cc=" + Uri.encode(cc)));
        return intent;
    }

    public static Intent newTelIntent(String telurl) {
        Intent intent = new Intent(Intent.ACTION_DIAL);
        intent.setData(Uri.parse(telurl));
        return intent;
    }

    public static void execIntentIfSafe(Context context, Intent intent) {
        if(Utils.isIntentSafe(context, intent)) {
            context.startActivity(intent);
        }
        else {
            Toast.makeText(context, "No related activity found!", Toast.LENGTH_SHORT).show();
        }
    }

    private static boolean isIntentSafe(Context context, Intent intent) {
        // Verify it resolves
        PackageManager packageManager = context.getPackageManager();
        List<ResolveInfo> activities = packageManager.queryIntentActivities(intent, 0);
        return activities.size() > 0;
    }

}


text:
package org.mengyun.tcctransaction.sample.order.domain.repository;

import org.mengyun.tcctransaction.sample.order.domain.entity.Order;
import org.mengyun.tcctransaction.sample.order.domain.entity.OrderLine;
import org.mengyun.tcctransaction.sample.order.infrastructure.dao.OrderDao;
import org.mengyun.tcctransaction.sample.order.infrastructure.dao.OrderLineDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.OptimisticLockingFailureException;
import org.springframework.stereotype.Repository;

/**
 * Created by changming.xie on 4/1/16.
 */
@Repository
public class OrderRepository {

    @Autowired
    OrderDao orderDao;

    @Autowired
    OrderLineDao orderLineDao;

    public void create(Order order) {
        orderDao.insert(order);

        for (OrderLine orderLine : order.getOrderLines()) {
            orderLineDao.insert(orderLine);
        }
    }

    public void update(Order order) {
        order.updateVersion();
        int effectCount = orderDao.update(order);

        if (effectCount < 1) {
            throw new OptimisticLockingFailureException("update order failed");
        }
    }

    public Order findByMerchantOrderNo(String merchantOrderNo) {
        return orderDao.findByMerchantOrderNo(merchantOrderNo);
    }
}


text:
export default {
  userData: {},
  isAuthenticated: false,
  registrationMode: false,
  registrationFailed: false,
  attemptFailed: false,
  reviewData: []
}


text:
package ru.adios.budgeter.api;

import com.google.common.collect.ImmutableSet;
import java8.util.stream.Stream;
import org.joda.money.CurrencyUnit;

import javax.annotation.concurrent.Immutable;

/**
 * Date: 6/12/15
 * Time: 7:26 PM
 *
 * @author Mikhail Kulikov
 */
public interface Accounter {

    FundsMutationEventRepository fundsMutationEventRepository();

    SubjectPriceRepository subjectPriceRepository();

    CurrencyExchangeEventRepository currencyExchangeEventRepository();

    PostponedFundsMutationEventRepository postponedFundsMutationEventRepository();

    PostponedCurrencyExchangeEventRepository postponedCurrencyExchangeEventRepository();

    Stream<PostponingReasons> streamAllPostponingReasons();

    Stream<PostponingReasons> streamAllPostponingReasons(boolean compatMode);

    FundsMutationSubjectRepository fundsMutationSubjectRepo();

    FundsMutationAgentRepository fundsMutationAgentRepo();

    @Immutable
    final class PostponingReasons {

        public final UtcDay dayUtc;
        public final ImmutableSet<CurrencyUnit> sufferingUnits;

        public PostponingReasons(UtcDay dayUtc, ImmutableSet<CurrencyUnit> sufferingUnits) {
            this.dayUtc = dayUtc;
            this.sufferingUnits = sufferingUnits;
        }

    }

}


text:
set -e

CURRENT_DIR=$(pwd)

echo "Current directory: " $CURRENT_DIR

#echo "Installing app dependencies..."
#npm config set registry http://registry.npmjs.org
#npm install --prod

echo "Starting application..."
exec "$@"