text:
package algoliasearch

import (
	"errors"
	"net/url"
	"reflect"
	"strconv"
	"time"
)

type Index struct {
	name        string
	nameEncoded string
	client      *Client
}

func NewIndex(name string, client *Client) *Index {
	index := new(Index)
	index.name = name
	index.client = client
	index.nameEncoded = client.transport.urlEncode(name)
	return index
}

func (i *Index) Delete() (interface{}, error) {
	return i.client.transport.request("DELETE", "/1/indexes/"+i.nameEncoded, nil, write)
}

func (i *Index) Clear() (interface{}, error) {
	return i.client.transport.request("POST", "/1/indexes/"+i.nameEncoded+"/clear", nil, write)
}

func (i *Index) GetObject(objectID string, attribute ...string) (interface{}, error) {
	v := url.Values{}
	if len(attribute) > 1 {
		return nil, errors.New("Too many parametter")
	}
	if len(attribute) > 0 {
		v.Add("attribute", attribute[0])
	}
	return i.client.transport.request("GET", "/1/indexes/"+i.nameEncoded+"/"+i.client.transport.urlEncode(objectID)+"?"+v.Encode(), nil, read)
}

func (i *Index) GetObjects(objectIDs ...string) (interface{}, error) {
	requests := make([]interface{}, len(objectIDs))
	for it := range objectIDs {
		object := make(map[string]interface{})
		object["indexName"] = i.name
		object["objectID"] = objectIDs[it]
		requests[it] = object
	}
	body := make(map[string]interface{})
	body["requests"] = requests
	return i.client.transport.request("POST", "/1/indexes/*/objects", body, read)
}

func (i *Index) DeleteObject(objectID string) (interface{}, error) {
	return i.client.transport.request("DELETE", "/1/indexes/"+i.nameEncoded+"/"+i.client.transport.urlEncode(objectID), nil, write)
}

func (i *Index) GetSettings() (interface{}, error) {
	return i.client.transport.request("GET", "/1/indexes/"+i.nameEncoded+"/settings", nil, read)
}

func (i *Index) SetSettings(settings interface{}) (interface{}, error) {
	return i.client.transport.request("PUT", "/1/indexes/"+i.nameEncoded+"/settings", settings, write)
}

func (i *Index) getStatus(taskID float64) (interface{}, error) {
	return i.client.transport.request("GET", "/1/indexes/"+i.nameEncoded+"/task/"+strconv.FormatFloat(taskID, 'f', -1, 64), nil, read)
}

func (i *Index) WaitTask(task interface{}) (interface{}, error) {
	if reflect.TypeOf(task).Name() == "float64" {
		return i.WaitTaskWithInit(task.(float64), 100)
	}
	return i.WaitTaskWithInit(task.(map[string]interface{})["taskID"].(float64), 100)
}

func (i *Index) WaitTaskWithInit(taskID float64, timeToWait float64) (interface{}, error) {
	for true {
		status, err := i.getStatus(taskID)
		if err != nil {
			return nil, err
		}
		if status.(map[string]interface{})["status"] == "published" {
			return status, nil
		}
		time.Sleep(time.Duration(timeToWait) * time.Millisecond)
		timeToWait = timeToWait * 2
		if timeToWait > 10000 {
			timeToWait = 10000
		}
	}
	return nil, errors.New("Code not reachable")
}

func (i *Index) ListKeys() (interface{}, error) {
	return i.client.transport.request("GET", "/1/indexes/"+i.nameEncoded+"/keys", nil, read)
}

func (i *Index) GetKey(key string) (interface{}, error) {
	return i.client.transport.request("GET", "/1/indexes/"+i.nameEncoded+"/keys/"+key, nil, read)
}

func (i *Index) DeleteKey(key string) (interface{}, error) {
	return i.client.transport.request("DELETE", "/1/indexes/"+i.nameEncoded+"/keys/"+key, nil, write)
}

func (i *Index) AddObject(object interface{}) (interface{}, error) {
	method := "POST"
	path := "/1/indexes/" + i.nameEncoded
	return i.client.transport.request(method, path, object, write)
}

func (i *Index) UpdateObject(object interface{}) (interface{}, error) {
	id := object.(map[string]interface{})["objectID"]
	path := "/1/indexes/" + i.nameEncoded + "/" + i.client.transport.urlEncode(id.(string))
	return i.client.transport.request("PUT", path, object, write)
}

func (i *Index) PartialUpdateObject(object interface{}) (interface{}, error) {
	id := object.(map[string]interface{})["objectID"]
	path := "/1/indexes/" + i.nameEncoded + "/" + i.client.transport.urlEncode(id.(string)) + "/partial"
	return i.client.transport.request("POST", path, object, write)
}

func (i *Index) AddObjects(objects interface{}) (interface{}, error) {
	return i.sameBatch(objects, "addObject")
}

func (i *Index) UpdateObjects(objects interface{}) (interface{}, error) {
	return i.sameBatch(objects, "updateObject")
}

func (i *Index) PartialUpdateObjects(objects interface{}) (interface{}, error) {
	return i.sameBatch(objects, "partialUpdateObject")
}

func (i *Index) DeleteObjects(objectIDs []string) (interface{}, error) {
	objects := make([]interface{}, len(objectIDs))
	for i := range objectIDs {
		object := make(map[string]interface{})
		object["objectID"] = objectIDs[i]
		objects[i] = object
	}
	return i.sameBatch(objects, "deleteObject")
}

func (i *Index) DeleteByQuery(query string, params map[string]interface{}) (interface{}, error) {
	if params == nil {
		params = make(map[string]interface{})
	}
	params["attributesToRetrieve"] = "[\"objectID\"]"
	params["hitsPerPage"] = 1000
	params["distinct"] = false

	results, error := i.Search(query, params)
	if error != nil {
		return results, error
	}
	for results.(map[string]interface{})["nbHits"].(float64) != 0 {
		objectIDs := make([]string, len(results.(map[string]interface{})["hits"].([]interface{})))
		for i := range results.(map[string]interface{})["hits"].([]interface{}) {
			hits := results.(map[string]interface{})["hits"].([]interface{})[i].(map[string]interface{})
			objectIDs[i] = hits["objectID"].(string)
		}
		task, error := i.DeleteObjects(objectIDs)
		if error != nil {
			return task, error
		}

		_, error = i.WaitTask(task)
		if error != nil {
			return nil, error
		}
		results, error = i.Search(query, params)
		if error != nil {
			return results, error
		}
	}
	return nil, nil
}

func (i *Index) sameBatch(objects interface{}, action string) (interface{}, error) {
	length := len(objects.([]interface{}))
	method := make([]string, length)
	for i := range method {
		method[i] = action
	}
	return i.Batch(objects, method)
}

func (i *Index) Batch(objects interface{}, actions []string) (interface{}, error) {
	array := objects.([]interface{})
	queries := make([]map[string]interface{}, len(array))
	for i := range array {
		queries[i] = make(map[string]interface{})
		queries[i]["action"] = actions[i]
		queries[i]["body"] = array[i]
	}
	return i.CustomBatch(queries)
}

func (i *Index) CustomBatch(queries interface{}) (interface{}, error) {
	request := make(map[string]interface{})
	request["requests"] = queries
	return i.client.transport.request("POST", "/1/indexes/"+i.nameEncoded+"/batch", request, write)
}

// Deprecated use BrowseFrom or BrowseAll
func (i *Index) Browse(page, hitsPerPage int) (interface{}, error) {
	return i.client.transport.request("GET", "/1/indexes/"+i.nameEncoded+"/browse?page="+strconv.Itoa(page)+"&hitsPerPage="+strconv.Itoa(hitsPerPage), nil, read)
}

func (i *Index) makeIndexIterator(params interface{}, cursor string) (*IndexIterator, error) {
	it := new(IndexIterator)
	it.answer = map[string]interface{}{"cursor": cursor}
	it.params = params
	it.pos = 0
	it.index = i
	ok := it.loadNextPage()
	return it, ok
}

func (i *Index) BrowseFrom(params interface{}, cursor string) (interface{}, error) {
	if len(cursor) != 0 {
		cursor = "&cursor=" + i.client.transport.urlEncode(cursor)
	} else {
		cursor = ""
	}
	return i.client.transport.request("GET", "/1/indexes/"+i.nameEncoded+"/browse?"+i.client.transport.EncodeParams(params)+cursor, nil, read)
}

func (i *Index) BrowseAll(params interface{}) (*IndexIterator, error) {
	return i.makeIndexIterator(params, "")
}

func (i *Index) Search(query string, params interface{}) (interface{}, error) {
	if params == nil {
		params = make(map[string]interface{})
	}
	params.(map[string]interface{})["query"] = query
	body := make(map[string]interface{})
	body["params"] = i.client.transport.EncodeParams(params)
	return i.client.transport.request("POST", "/1/indexes/"+i.nameEncoded+"/query", body, search)
}

func (i *Index) operation(name, op string) (interface{}, error) {
	body := make(map[string]interface{})
	body["operation"] = op
	body["destination"] = name
	return i.client.transport.request("POST", "/1/indexes/"+i.nameEncoded+"/operation", body, write)
}

func (i *Index) Copy(name string) (interface{}, error) {
	return i.operation(name, "copy")
}

func (i *Index) Move(name string) (interface{}, error) {
	return i.operation(name, "move")
}

func (i *Index) AddKey(acl []string, validity int, maxQueriesPerIPPerHour int, maxHitsPerQuery int) (interface{}, error) {
	body := make(map[string]interface{})
	body["acl"] = acl
	body["maxHitsPerQuery"] = maxHitsPerQuery
	body["maxQueriesPerIPPerHour"] = maxQueriesPerIPPerHour
	body["validity"] = validity
	return i.AddKeyWithParam(body)
}

func (i *Index) AddKeyWithParam(params interface{}) (interface{}, error) {
	return i.client.transport.request("POST", "/1/indexes/"+i.nameEncoded+"/keys", params, write)
}

func (i *Index) UpdateKey(key string, acl []string, validity int, maxQueriesPerIPPerHour int, maxHitsPerQuery int) (interface{}, error) {
	body := make(map[string]interface{})
	body["acl"] = acl
	body["maxHitsPerQuery"] = maxHitsPerQuery
	body["maxQueriesPerIPPerHour"] = maxQueriesPerIPPerHour
	body["validity"] = validity
	return i.UpdateKeyWithParam(key, body)
}

func (i *Index) UpdateKeyWithParam(key string, params interface{}) (interface{}, error) {
	return i.client.transport.request("PUT", "/1/indexes/"+i.nameEncoded+"/keys/"+key, params, write)
}


text:
/* file: D:/MICOM_DEV/prj/framework/osal/osek/Appl/GenData/intvect_c0.c */
/* automatically generated by genRH850.exe, Version: 1.06 */
/* Configuration file: C:/Users/sdi/AppData/Local/Temp/Cfg_Gen-1473129565770-1/OsProxyFiles-1473129625245-0/Os_ActiveEcuC.arxml */
/* Generation time: Tue Sep 06 11:40:26 2016 */
/* Unlimited license CBD1500749 for LG Electronics, Product License, AVN */
/* Implementation: RH850_F1L */
/* Version of general code: 9.01.04 */
#if defined USE_QUOTE_INCLUDES
 #include "vrm.h"
#else
 #include <vrm.h>
#endif

#define osdVrmGenMajRelNum 1
#define osdVrmGenMinRelNum 6
#if defined USE_QUOTE_INCLUDES
 #include "vrm.h"
#else
 #include <vrm.h>
#endif

#if defined USE_QUOTE_INCLUDES
 #include "Os.h"
#else
 #include <Os.h>
#endif

#if defined USE_QUOTE_INCLUDES
 #include "osekext.h"
#else
 #include <osekext.h>
#endif

#pragma asm

   .align 512
   .section ".osExceptionVectorTable_c0", "ax"

   .globl _osExceptionVectorTable_c0   /* start of the core exception vector table */
_osExceptionVectorTable_c0:

   .offset 0x0000
   .globl _osCoreException_c0_0x0000
_osCoreException_c0_0x0000:
   jr _osUnhandledCoreLgeException

   .offset 0x0010
   .globl _osCoreException_c0_0x0010
_osCoreException_c0_0x0010:
   jr _osUnhandledCoreLgeException

   .offset 0x0020
   .globl _osCoreException_c0_0x0020
_osCoreException_c0_0x0020:
   jr _osUnhandledCoreLgeException

   .offset 0x0030
   .globl _osCoreException_c0_0x0030
_osCoreException_c0_0x0030:
   jr _osUnhandledCoreLgeException

   .offset 0x0040
   .globl _osCoreException_c0_0x0040
_osCoreException_c0_0x0040:
   jr _osTrapDispatcher_c0

   .offset 0x0050
   .globl _osCoreException_c0_0x0050
_osCoreException_c0_0x0050:
   jr _osUnhandledCoreLgeException

   .offset 0x0060
   .globl _osCoreException_c0_0x0060
_osCoreException_c0_0x0060:
   jr _osUnhandledCoreLgeException

   .offset 0x0070
   .globl _osCoreException_c0_0x0070
_osCoreException_c0_0x0070:
   jr _osUnhandledCoreLgeException

   .offset 0x0080
   .globl _osCoreException_c0_0x0080
_osCoreException_c0_0x0080:
   jr _osUnhandledCoreLgeException

   .offset 0x0090
   .globl _osCoreException_c0_0x0090
_osCoreException_c0_0x0090:
   jr _osUnhandledCoreLgeException

   .offset 0x00a0
   .globl _osCoreException_c0_0x00a0
_osCoreException_c0_0x00a0:
   jr _osUnhandledCoreLgeException

   .offset 0x00b0
   .globl _osCoreException_c0_0x00b0
_osCoreException_c0_0x00b0:
   jr _osUnhandledCoreLgeException

   .offset 0x00c0
   .globl _osCoreException_c0_0x00c0
_osCoreException_c0_0x00c0:
   jr _osUnhandledCoreLgeException

   .offset 0x00d0
   .globl _osCoreException_c0_0x00d0
_osCoreException_c0_0x00d0:
   jr _osUnhandledCoreLgeException

   .offset 0x00e0
   .globl _osCoreException_c0_0x00e0
_osCoreException_c0_0x00e0:
   jr _osUnhandledCoreLgeException

   .offset 0x00f0
   .globl _osCoreException_c0_0x00f0
_osCoreException_c0_0x00f0:
   jr _osUnhandledCoreLgeException

   .offset 0x0100
   .globl _osCoreException_c0_0x0100
_osCoreException_c0_0x0100:
   jr _osUnhandledDirectBranchException

   .offset 0x0110
   .globl _osCoreException_c0_0x0110
_osCoreException_c0_0x0110:
   jr _osUnhandledDirectBranchException

   .offset 0x0120
   .globl _osCoreException_c0_0x0120
_osCoreException_c0_0x0120:
   jr _osUnhandledDirectBranchException

   .offset 0x0130
   .globl _osCoreException_c0_0x0130
_osCoreException_c0_0x0130:
   jr _osUnhandledDirectBranchException

   .offset 0x0140
   .globl _osCoreException_c0_0x0140
_osCoreException_c0_0x0140:
   jr _osUnhandledDirectBranchException

   .offset 0x0150
   .globl _osCoreException_c0_0x0150
_osCoreException_c0_0x0150:
   jr _osUnhandledDirectBranchException

   .offset 0x0160
   .globl _osCoreException_c0_0x0160
_osCoreException_c0_0x0160:
   jr _osUnhandledDirectBranchException

   .offset 0x0170
   .globl _osCoreException_c0_0x0170
_osCoreException_c0_0x0170:
   jr _osUnhandledDirectBranchException

   .globl _osExceptionVectorTableEnd_c0
_osExceptionVectorTableEnd_c0:   /* end of the core exception vector table */

#pragma endasm

#pragma asm

   .align 512
   .section ".osEIINTVectorTable_c0", "ax"

   .globl _osEIINTVectorTable_c0   /* start of the EIINT exception vector table */
_osEIINTVectorTable_c0:
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _INTTAUD0I12_CAT2   /* interrupt index = 6 */
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _CanIsrGlobalStatus_CAT2   /* interrupt index = 14 */
   .word _CanIsrRxFifo_CAT2   /* interrupt index = 15 */
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _INTP0_CAT2   /* interrupt index = 29 */
   .word _INTP1_CAT2   /* interrupt index = 30 */
   .word _INTP2_CAT2   /* interrupt index = 31 */
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _INTP4_CAT2   /* interrupt index = 35 */
   .word _INTP5_CAT2   /* interrupt index = 36 */
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _INTADCA0ERR_CAT2   /* interrupt index = 47 */
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _INTRIIC0TI_CAT2   /* interrupt index = 68 */
   .word _INTRIIC0TEI_CAT2   /* interrupt index = 69 */
   .word _INTRIIC0RI_CAT2   /* interrupt index = 70 */
   .word _INTRIIC0EE_CAT2   /* interrupt index = 71 */
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osOstmInterrupt_c0_CAT2   /* interrupt index = 76 */
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _CanIsrStatus_1_CAT2   /* interrupt index = 105 */
   .word _osUnhandledEIINTException
   .word _CanIsrTx_1_CAT2   /* interrupt index = 107 */
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _INTP6_CAT2   /* interrupt index = 120 */
   .word _INTP7_CAT2   /* interrupt index = 121 */
   .word _INTP8_CAT2   /* interrupt index = 122 */
   .word _INTP12_CAT2   /* interrupt index = 123 */
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _INTP9_CAT2   /* interrupt index = 197 */
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _INTRLIN33UR1_CAT2   /* interrupt index = 222 */
   .word _INTRLIN33UR2_CAT2   /* interrupt index = 223 */
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _INTRLIN34UR1_CAT2   /* interrupt index = 226 */
   .word _INTRLIN34UR2_CAT2   /* interrupt index = 227 */
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .word _osUnhandledEIINTException
   .globl _osEIINTVectorTableEnd_c0
_osEIINTVectorTableEnd_c0:   /* end of the EIINT exception vector table */

#pragma endasm

#pragma asm

   .section ".os_text", "ax"

   /* MISRA RULE 14.1 not violated: INTTAUD0I12 is branched via EIINT vector table. */
   osCAT2ISRC0(INTTAUD0I12, 2) /* PRQA S 1503 */

   /* MISRA RULE 14.1 not violated: CanIsrGlobalStatus is branched via EIINT vector table. */
   osCAT2ISRC0(CanIsrGlobalStatus, 1) /* PRQA S 1503 */

   /* MISRA RULE 14.1 not violated: CanIsrRxFifo is branched via EIINT vector table. */
   osCAT2ISRC0(CanIsrRxFifo, 1) /* PRQA S 1503 */

   /* MISRA RULE 14.1 not violated: INTP0 is branched via EIINT vector table. */
   osCAT2ISRC0(INTP0, 1) /* PRQA S 1503 */

   /* MISRA RULE 14.1 not violated: INTP1 is branched via EIINT vector table. */
   osCAT2ISRC0(INTP1, 1) /* PRQA S 1503 */

   /* MISRA RULE 14.1 not violated: INTP2 is branched via EIINT vector table. */
   osCAT2ISRC0(INTP2, 7) /* PRQA S 1503 */

   /* MISRA RULE 14.1 not violated: INTP4 is branched via EIINT vector table. */
   osCAT2ISRC0(INTP4, 7) /* PRQA S 1503 */

   /* MISRA RULE 14.1 not violated: INTP5 is branched via EIINT vector table. */
   osCAT2ISRC0(INTP5, 7) /* PRQA S 1503 */

   /* MISRA RULE 14.1 not violated: INTADCA0ERR is branched via EIINT vector table. */
   osCAT2ISRC0(INTADCA0ERR, 2) /* PRQA S 1503 */

   /* MISRA RULE 14.1 not violated: INTRIIC0TI is branched via EIINT vector table. */
   osCAT2ISRC0(INTRIIC0TI, 7) /* PRQA S 1503 */

   /* MISRA RULE 14.1 not violated: INTRIIC0TEI is branched via EIINT vector table. */
   osCAT2ISRC0(INTRIIC0TEI, 7) /* PRQA S 1503 */

   /* MISRA RULE 14.1 not violated: INTRIIC0RI is branched via EIINT vector table. */
   osCAT2ISRC0(INTRIIC0RI, 7) /* PRQA S 1503 */

   /* MISRA RULE 14.1 not violated: INTRIIC0EE is branched via EIINT vector table. */
   osCAT2ISRC0(INTRIIC0EE, 7) /* PRQA S 1503 */

   /* MISRA RULE 14.1 not violated: osOstmInterrupt_c0 is branched via EIINT vector table. */
   osCAT2ISRC0(osOstmInterrupt_c0, 0) /* PRQA S 1503 */

   /* MISRA RULE 14.1 not violated: CanIsrStatus_1 is branched via EIINT vector table. */
   osCAT2ISRC0(CanIsrStatus_1, 1) /* PRQA S 1503 */

   /* MISRA RULE 14.1 not violated: CanIsrTx_1 is branched via EIINT vector table. */
   osCAT2ISRC0(CanIsrTx_1, 1) /* PRQA S 1503 */

   /* MISRA RULE 14.1 not violated: INTP6 is branched via EIINT vector table. */
   osCAT2ISRC0(INTP6, 7) /* PRQA S 1503 */

   /* MISRA RULE 14.1 not violated: INTP7 is branched via EIINT vector table. */
   osCAT2ISRC0(INTP7, 7) /* PRQA S 1503 */

   /* MISRA RULE 14.1 not violated: INTP8 is branched via EIINT vector table. */
   osCAT2ISRC0(INTP8, 7) /* PRQA S 1503 */

   /* MISRA RULE 14.1 not violated: INTP12 is branched via EIINT vector table. */
   osCAT2ISRC0(INTP12, 7) /* PRQA S 1503 */

   /* MISRA RULE 14.1 not violated: INTP9 is branched via EIINT vector table. */
   osCAT2ISRC0(INTP9, 7) /* PRQA S 1503 */

   /* MISRA RULE 14.1 not violated: INTRLIN33UR1 is branched via EIINT vector table. */
   osCAT2ISRC0(INTRLIN33UR1, 0) /* PRQA S 1503 */

   /* MISRA RULE 14.1 not violated: INTRLIN33UR2 is branched via EIINT vector table. */
   osCAT2ISRC0(INTRLIN33UR2, 0) /* PRQA S 1503 */

   /* MISRA RULE 14.1 not violated: INTRLIN34UR1 is branched via EIINT vector table. */
   osCAT2ISRC0(INTRLIN34UR1, 3) /* PRQA S 1503 */

   /* MISRA RULE 14.1 not violated: INTRLIN34UR2 is branched via EIINT vector table. */
   osCAT2ISRC0(INTRLIN34UR2, 3) /* PRQA S 1503 */

#pragma endasm

redpajama_set_name: RedPajamaGithub


text:
#ifndef GrContextFactory_DEFINED
#define GrContextFactory_DEFINED

#include "GrContext.h"

#include "gl/SkGLContext.h"
#include "SkTArray.h"

/**
 * This is a simple class that is useful in test apps that use different
 * GrContexts backed by different types of GL contexts. It manages creating the
 * GL context and a GrContext that uses it. The GL/Gr contexts persist until the
 * factory is destroyed (though the caller can always grab a ref on the returned
 * Gr and GL contexts to make them outlive the factory).
 */
class GrContextFactory : SkNoncopyable {
public:
    /**
     * Types of GL contexts supported. For historical and testing reasons the native GrContext will
     * not use "GL_NV_path_rendering" even when the driver supports it. There is a separate context
     * type that does not remove NVPR support and which will fail when the driver does not support
     * the extension.
     */
    enum GLContextType {
      kNative_GLContextType,
#if SK_ANGLE
      kANGLE_GLContextType,
#endif
#if SK_MESA
      kMESA_GLContextType,
#endif
      /** Similar to kNative but does not filter NVPR. It will fail if the GL driver does not
          support NVPR */
      kNVPR_GLContextType,
      kNull_GLContextType,
      kDebug_GLContextType,

      kLastGLContextType = kDebug_GLContextType
    };

    static const int kGLContextTypeCnt = kLastGLContextType + 1;

    static bool IsRenderingGLContext(GLContextType type) {
        switch (type) {
            case kNull_GLContextType:
            case kDebug_GLContextType:
                return false;
            default:
                return true;
        }
    }

    static const char* GLContextTypeName(GLContextType type) {
        switch (type) {
            case kNative_GLContextType:
                return "native";
            case kNull_GLContextType:
                return "null";
#if SK_ANGLE
            case kANGLE_GLContextType:
                return "angle";
#endif
#if SK_MESA
            case kMESA_GLContextType:
                return "mesa";
#endif
            case kNVPR_GLContextType:
                return "nvpr";
            case kDebug_GLContextType:
                return "debug";
            default:
                SkFAIL("Unknown GL Context type.");
        }
    }

    explicit GrContextFactory(const GrContext::Options& opts) : fGlobalOptions(opts) { }
    GrContextFactory() { }

    ~GrContextFactory() { this->destroyContexts(); }

    void destroyContexts() {
        for (int i = 0; i < fContexts.count(); ++i) {
            if (fContexts[i].fGLContext) {  //  could be abandoned.
                fContexts[i].fGLContext->makeCurrent();
            }
            fContexts[i].fGrContext->unref();
            if (fContexts[i].fGLContext) {
                fContexts[i].fGLContext->unref();
            }
        }
        fContexts.reset();
    }

    void abandonContexts() {
        for (int i = 0; i < fContexts.count(); ++i) {
            if (fContexts[i].fGLContext) {
                fContexts[i].fGLContext->testAbandon();
                SkSafeSetNull(fContexts[i].fGLContext);
            }
            fContexts[i].fGrContext->abandonContext();
        }
    }

    /**
     * Get a GrContext initialized with a type of GL context. It also makes the GL context current.
     */
    GrContext* get(GLContextType type, GrGLStandard forcedGpuAPI = kNone_GrGLStandard);

    // Returns the GLContext of the given type. If it has not been created yet,
    // NULL is returned instead.
    SkGLContext* getGLContext(GLContextType type) {
        for (int i = 0; i < fContexts.count(); ++i) {
            if (fContexts[i].fType == type) {
                return fContexts[i].fGLContext;
            }
        }

        return NULL;
    }

    const GrContext::Options& getGlobalOptions() const { return fGlobalOptions; }

private:
    struct GPUContext {
        GLContextType             fType;
        SkGLContext*              fGLContext;
        GrContext*                fGrContext;
    };
    SkTArray<GPUContext, true>    fContexts;
    const GrContext::Options      fGlobalOptions;
};

#endif


text:
<?php

declare(strict_types=1);

namespace Sonata\AdminBundle\Tests\Fixtures\Bundle\Entity;

class Comment
{
    public function __toString()
    {
        return 'this is a comment';
    }
}


text:
require 'kinja/client'

module Kinja
  autoload :VERSION, File.join(File.dirname(__FILE__), 'kinja/version')

  class << self
    def new(options={})
      Kinja::Client.new(options)
    end
  end
end


text:
SYNONYM

#### According to
GRIN Taxonomy for Plants

#### Published in
Rev. Hort. (Paris) 43:502. 1871

#### Original name
null

### Remarks
null


text:
package io.grpc;

import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.mock;

import io.grpc.ClientStreamTracer;
import io.grpc.LoadBalancer.PickResult;
import io.grpc.LoadBalancer.Subchannel;
import io.grpc.Status;
import java.net.SocketAddress;
import java.util.Arrays;
import java.util.List;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/** Unit tests for the inner classes in {@link LoadBalancer}. */
@RunWith(JUnit4.class)
public class LoadBalancerTest {
  private final Subchannel subchannel = mock(Subchannel.class);
  private final Subchannel subchannel2 = mock(Subchannel.class);
  private final ClientStreamTracer.Factory tracerFactory = mock(ClientStreamTracer.Factory.class);
  private final Status status = Status.UNAVAILABLE.withDescription("for test");
  private final Status status2 = Status.UNAVAILABLE.withDescription("for test 2");
  private final EquivalentAddressGroup eag = new EquivalentAddressGroup(new SocketAddress() {});
  private final Attributes attrs = Attributes.newBuilder()
      .set(Attributes.Key.create("trash"), new Object())
      .build();
  private final Subchannel emptySubchannel = new EmptySubchannel();

  @Test
  public void pickResult_withSubchannel() {
    PickResult result = PickResult.withSubchannel(subchannel);
    assertThat(result.getSubchannel()).isSameAs(subchannel);
    assertThat(result.getStatus()).isSameAs(Status.OK);
    assertThat(result.getStreamTracerFactory()).isNull();
    assertThat(result.isDrop()).isFalse();
  }

  @Test
  public void pickResult_withSubchannelAndTracer() {
    PickResult result = PickResult.withSubchannel(subchannel, tracerFactory);
    assertThat(result.getSubchannel()).isSameAs(subchannel);
    assertThat(result.getStatus()).isSameAs(Status.OK);
    assertThat(result.getStreamTracerFactory()).isSameAs(tracerFactory);
    assertThat(result.isDrop()).isFalse();
  }

  @Test
  public void pickResult_withNoResult() {
    PickResult result = PickResult.withNoResult();
    assertThat(result.getSubchannel()).isNull();
    assertThat(result.getStatus()).isSameAs(Status.OK);
    assertThat(result.getStreamTracerFactory()).isNull();
    assertThat(result.isDrop()).isFalse();
  }

  @Test
  public void pickResult_withError() {
    PickResult result = PickResult.withError(status);
    assertThat(result.getSubchannel()).isNull();
    assertThat(result.getStatus()).isSameAs(status);
    assertThat(result.getStreamTracerFactory()).isNull();
    assertThat(result.isDrop()).isFalse();
  }

  @Test
  public void pickResult_withDrop() {
    PickResult result = PickResult.withDrop(status);
    assertThat(result.getSubchannel()).isNull();
    assertThat(result.getStatus()).isSameAs(status);
    assertThat(result.getStreamTracerFactory()).isNull();
    assertThat(result.isDrop()).isTrue();
  }

  @Test
  public void pickResult_equals() {
    PickResult sc1 = PickResult.withSubchannel(subchannel);
    PickResult sc2 = PickResult.withSubchannel(subchannel);
    PickResult sc3 = PickResult.withSubchannel(subchannel, tracerFactory);
    PickResult sc4 = PickResult.withSubchannel(subchannel2);
    PickResult nr = PickResult.withNoResult();
    PickResult error1 = PickResult.withError(status);
    PickResult error2 = PickResult.withError(status2);
    PickResult error3 = PickResult.withError(status2);
    PickResult drop1 = PickResult.withDrop(status);
    PickResult drop2 = PickResult.withDrop(status);
    PickResult drop3 = PickResult.withDrop(status2);

    assertThat(sc1).isNotEqualTo(nr);
    assertThat(sc1).isNotEqualTo(error1);
    assertThat(sc1).isNotEqualTo(drop1);
    assertThat(sc1).isEqualTo(sc2);
    assertThat(sc1).isNotEqualTo(sc3);
    assertThat(sc1).isNotEqualTo(sc4);

    assertThat(error1).isNotEqualTo(error2);
    assertThat(error2).isEqualTo(error3);

    assertThat(drop1).isEqualTo(drop2);
    assertThat(drop1).isNotEqualTo(drop3);

    assertThat(error1.getStatus()).isEqualTo(drop1.getStatus());
    assertThat(error1).isNotEqualTo(drop1);
  }

  @Test
  public void helper_createSubchannel_delegates() {
    class OverrideCreateSubchannel extends NoopHelper {
      boolean ran;

      @Override
      public Subchannel createSubchannel(List<EquivalentAddressGroup> addrsIn, Attributes attrsIn) {
        assertThat(addrsIn).hasSize(1);
        assertThat(addrsIn.get(0)).isSameAs(eag);
        assertThat(attrsIn).isSameAs(attrs);
        ran = true;
        return subchannel;
      }
    }

    OverrideCreateSubchannel helper = new OverrideCreateSubchannel();
    assertThat(helper.createSubchannel(eag, attrs)).isSameAs(subchannel);
    assertThat(helper.ran).isTrue();
  }

  @Test(expected = UnsupportedOperationException.class)
  public void helper_createSubchannelList_throws() {
    new NoopHelper().createSubchannel(Arrays.asList(eag), attrs);
  }

  @Test
  public void helper_updateSubchannelAddresses_delegates() {
    class OverrideUpdateSubchannel extends NoopHelper {
      boolean ran;

      @Override
      public void updateSubchannelAddresses(
          Subchannel subchannelIn, List<EquivalentAddressGroup> addrsIn) {
        assertThat(subchannelIn).isSameAs(emptySubchannel);
        assertThat(addrsIn).hasSize(1);
        assertThat(addrsIn.get(0)).isSameAs(eag);
        ran = true;
      }
    }

    OverrideUpdateSubchannel helper = new OverrideUpdateSubchannel();
    helper.updateSubchannelAddresses(emptySubchannel, eag);
    assertThat(helper.ran).isTrue();
  }

  @Test(expected = UnsupportedOperationException.class)
  public void helper_updateSubchannelAddressesList_throws() {
    new NoopHelper().updateSubchannelAddresses(null, Arrays.asList(eag));
  }

  @Test
  public void subchannel_getAddresses_delegates() {
    class OverrideGetAllAddresses extends EmptySubchannel {
      boolean ran;

      @Override public List<EquivalentAddressGroup> getAllAddresses() {
        ran = true;
        return Arrays.asList(eag);
      }
    }

    OverrideGetAllAddresses subchannel = new OverrideGetAllAddresses();
    assertThat(subchannel.getAddresses()).isEqualTo(eag);
    assertThat(subchannel.ran).isTrue();
  }

  @Test(expected = IllegalStateException.class)
  public void subchannel_getAddresses_throwsOnTwoAddrs() {
    new EmptySubchannel() {
      boolean ran;

      @Override public List<EquivalentAddressGroup> getAllAddresses() {
        ran = true;
        // Doubling up eag is technically a bad idea, but nothing here cares
        return Arrays.asList(eag, eag);
      }
    }.getAddresses();
  }

  private static class NoopHelper extends LoadBalancer.Helper {
    @Override
    public ManagedChannel createOobChannel(EquivalentAddressGroup eag, String authority) {
      return null;
    }

    @Override
    public void updateBalancingState(
        ConnectivityState newState, LoadBalancer.SubchannelPicker newPicker) {}

    @Override public void runSerialized(Runnable task) {}

    @Override public NameResolver.Factory getNameResolverFactory() {
      return null;
    }

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

  private static class EmptySubchannel extends LoadBalancer.Subchannel {
    @Override public void shutdown() {}

    @Override public void requestConnection() {}

    @Override public Attributes getAttributes() {
      return null;
    }
  }
}


text:
package org.apache.hadoop.mapreduce.v2.util;

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URI;
import java.security.AccessController;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.mapred.InvalidJobConfException;
import org.apache.hadoop.mapreduce.JobID;
import org.apache.hadoop.mapreduce.MRJobConfig;
import org.apache.hadoop.mapreduce.TaskAttemptID;
import org.apache.hadoop.mapreduce.TaskID;
import org.apache.hadoop.mapreduce.TypeConverter;
import org.apache.hadoop.mapreduce.filecache.DistributedCache;
import org.apache.hadoop.mapreduce.v2.api.records.JobId;
import org.apache.hadoop.mapreduce.v2.api.records.TaskAttemptId;
import org.apache.hadoop.mapreduce.v2.api.records.TaskAttemptState;
import org.apache.hadoop.mapreduce.v2.api.records.TaskId;
import org.apache.hadoop.mapreduce.v2.api.records.TaskType;
import org.apache.hadoop.util.StringUtils;
import org.apache.hadoop.yarn.ContainerLogAppender;
import org.apache.hadoop.yarn.api.ApplicationConstants;
import org.apache.hadoop.yarn.api.ApplicationConstants.Environment;
import org.apache.hadoop.yarn.api.records.LocalResource;
import org.apache.hadoop.yarn.api.records.LocalResourceType;
import org.apache.hadoop.yarn.api.records.LocalResourceVisibility;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
import org.apache.hadoop.yarn.util.ApplicationClassLoader;
import org.apache.hadoop.yarn.util.Apps;
import org.apache.hadoop.yarn.util.ConverterUtils;

/**
 * Helper class for MR applications
 */
@Private
@Unstable
public class MRApps extends Apps {
  public static final Log LOG = LogFactory.getLog(MRApps.class);

  public static String toString(JobId jid) {
    return jid.toString();
  }

  public static JobId toJobID(String jid) {
    return TypeConverter.toYarn(JobID.forName(jid));
  }

  public static String toString(TaskId tid) {
    return tid.toString();
  }

  public static TaskId toTaskID(String tid) {
    return TypeConverter.toYarn(TaskID.forName(tid));
  }

  public static String toString(TaskAttemptId taid) {
    return taid.toString();
  }

  public static TaskAttemptId toTaskAttemptID(String taid) {
    return TypeConverter.toYarn(TaskAttemptID.forName(taid));
  }

  public static String taskSymbol(TaskType type) {
    switch (type) {
      case MAP:           return "m";
      case REDUCE:        return "r";
    }
    throw new YarnRuntimeException("Unknown task type: "+ type.toString());
  }

  public static enum TaskAttemptStateUI {
    NEW(
        new TaskAttemptState[] { TaskAttemptState.NEW,
            TaskAttemptState.STARTING }),
    RUNNING(
        new TaskAttemptState[] { TaskAttemptState.RUNNING,
            TaskAttemptState.COMMIT_PENDING }),
    SUCCESSFUL(new TaskAttemptState[] { TaskAttemptState.SUCCEEDED}),
    FAILED(new TaskAttemptState[] { TaskAttemptState.FAILED}),
    KILLED(new TaskAttemptState[] { TaskAttemptState.KILLED});

    private final List<TaskAttemptState> correspondingStates;

    private TaskAttemptStateUI(TaskAttemptState[] correspondingStates) {
      this.correspondingStates = Arrays.asList(correspondingStates);
    }

    public boolean correspondsTo(TaskAttemptState state) {
      return this.correspondingStates.contains(state);
    }
  }

  public static TaskType taskType(String symbol) {
    // JDK 7 supports switch on strings
    if (symbol.equals("m")) return TaskType.MAP;
    if (symbol.equals("r")) return TaskType.REDUCE;
    throw new YarnRuntimeException("Unknown task symbol: "+ symbol);
  }

  public static TaskAttemptStateUI taskAttemptState(String attemptStateStr) {
    return TaskAttemptStateUI.valueOf(attemptStateStr);
  }

  private static void setMRFrameworkClasspath(
      Map<String, String> environment, Configuration conf) throws IOException {
    // Propagate the system classpath when using the mini cluster
    if (conf.getBoolean(YarnConfiguration.IS_MINI_YARN_CLUSTER, false)) {
      Apps.addToEnvironment(environment, Environment.CLASSPATH.name(),
          System.getProperty("java.class.path"));
    }

    // Add standard Hadoop classes
    for (String c : conf.getStrings(
        YarnConfiguration.YARN_APPLICATION_CLASSPATH,
        YarnConfiguration.DEFAULT_YARN_APPLICATION_CLASSPATH)) {
      Apps.addToEnvironment(environment, Environment.CLASSPATH.name(), c
          .trim());
    }
    for (String c : conf.getStrings(
        MRJobConfig.MAPREDUCE_APPLICATION_CLASSPATH,
        StringUtils.getStrings(
            MRJobConfig.DEFAULT_MAPREDUCE_APPLICATION_CLASSPATH))){
      Apps.addToEnvironment(environment, Environment.CLASSPATH.name(), c
          .trim());
    }
    // TODO: Remove duplicates.
  }

  @SuppressWarnings("deprecation")
  public static void setClasspath(Map<String, String> environment,
      Configuration conf) throws IOException {
    boolean userClassesTakesPrecedence =
      conf.getBoolean(MRJobConfig.MAPREDUCE_JOB_USER_CLASSPATH_FIRST, false);

    String classpathEnvVar =
      conf.getBoolean(MRJobConfig.MAPREDUCE_JOB_CLASSLOADER, false)
        ? Environment.APP_CLASSPATH.name() : Environment.CLASSPATH.name();

    Apps.addToEnvironment(environment,
      classpathEnvVar,
      Environment.PWD.$());
    if (!userClassesTakesPrecedence) {
      MRApps.setMRFrameworkClasspath(environment, conf);
    }
    Apps.addToEnvironment(
        environment,
        classpathEnvVar,
        MRJobConfig.JOB_JAR + Path.SEPARATOR + MRJobConfig.JOB_JAR);
    Apps.addToEnvironment(
        environment,
        classpathEnvVar,
        MRJobConfig.JOB_JAR + Path.SEPARATOR + "classes" + Path.SEPARATOR);
    Apps.addToEnvironment(
        environment,
        classpathEnvVar,
        MRJobConfig.JOB_JAR + Path.SEPARATOR + "lib" + Path.SEPARATOR + "*");
    Apps.addToEnvironment(
        environment,
        classpathEnvVar,
        Environment.PWD.$() + Path.SEPARATOR + "*");
    // a * in the classpath will only find a .jar, so we need to filter out
    // all .jars and add everything else
    addToClasspathIfNotJar(DistributedCache.getFileClassPaths(conf),
        DistributedCache.getCacheFiles(conf),
        conf,
        environment, classpathEnvVar);
    addToClasspathIfNotJar(DistributedCache.getArchiveClassPaths(conf),
        DistributedCache.getCacheArchives(conf),
        conf,
        environment, classpathEnvVar);
    if (userClassesTakesPrecedence) {
      MRApps.setMRFrameworkClasspath(environment, conf);
    }
  }

  /**
   * Add the paths to the classpath if they are not jars
   * @param paths the paths to add to the classpath
   * @param withLinks the corresponding paths that may have a link name in them
   * @param conf used to resolve the paths
   * @param environment the environment to update CLASSPATH in
   * @throws IOException if there is an error resolving any of the paths.
   */
  private static void addToClasspathIfNotJar(Path[] paths,
      URI[] withLinks, Configuration conf,
      Map<String, String> environment,
      String classpathEnvVar) throws IOException {
    if (paths != null) {
      HashMap<Path, String> linkLookup = new HashMap<Path, String>();
      if (withLinks != null) {
        for (URI u: withLinks) {
          Path p = new Path(u);
          FileSystem remoteFS = p.getFileSystem(conf);
          p = remoteFS.resolvePath(p.makeQualified(remoteFS.getUri(),
              remoteFS.getWorkingDirectory()));
          String name = (null == u.getFragment())
              ? p.getName() : u.getFragment();
          if (!name.toLowerCase().endsWith(".jar")) {
            linkLookup.put(p, name);
          }
        }
      }

      for (Path p : paths) {
        FileSystem remoteFS = p.getFileSystem(conf);
        p = remoteFS.resolvePath(p.makeQualified(remoteFS.getUri(),
            remoteFS.getWorkingDirectory()));
        String name = linkLookup.get(p);
        if (name == null) {
          name = p.getName();
        }
        if(!name.toLowerCase().endsWith(".jar")) {
          Apps.addToEnvironment(
              environment,
              classpathEnvVar,
              Environment.PWD.$() + Path.SEPARATOR + name);
        }
      }
    }
  }

  /**
   * Sets a {@link ApplicationClassLoader} on the given configuration and as
   * the context classloader, if
   * {@link MRJobConfig#MAPREDUCE_JOB_CLASSLOADER} is set to true, and
   * the APP_CLASSPATH environment variable is set.
   * @param conf
   * @throws IOException
   */
  public static void setJobClassLoader(Configuration conf)
      throws IOException {
    if (conf.getBoolean(MRJobConfig.MAPREDUCE_JOB_CLASSLOADER, false)) {
      String appClasspath = System.getenv(Environment.APP_CLASSPATH.key());
      if (appClasspath == null) {
        LOG.warn("Not using job classloader since APP_CLASSPATH is not set.");
      } else {
        LOG.info("Using job classloader");
        if (LOG.isDebugEnabled()) {
          LOG.debug("APP_CLASSPATH=" + appClasspath);
        }
        String[] systemClasses = conf.getStrings(
            MRJobConfig.MAPREDUCE_JOB_CLASSLOADER_SYSTEM_CLASSES);
        ClassLoader jobClassLoader = createJobClassLoader(appClasspath,
            systemClasses);
        if (jobClassLoader != null) {
          conf.setClassLoader(jobClassLoader);
          Thread.currentThread().setContextClassLoader(jobClassLoader);
        }
      }
    }
  }

  private static ClassLoader createJobClassLoader(final String appClasspath,
      final String[] systemClasses) throws IOException {
    try {
      return AccessController.doPrivileged(
        new PrivilegedExceptionAction<ClassLoader>() {
          @Override
          public ClassLoader run() throws MalformedURLException {
            return new ApplicationClassLoader(appClasspath,
                MRApps.class.getClassLoader(), Arrays.asList(systemClasses));
          }
      });
    } catch (PrivilegedActionException e) {
      Throwable t = e.getCause();
      if (t instanceof MalformedURLException) {
        throw (MalformedURLException) t;
      }
      throw new IOException(e);
    }
  }

  private static final String STAGING_CONSTANT = ".staging";
  public static Path getStagingAreaDir(Configuration conf, String user) {
    return new Path(conf.get(MRJobConfig.MR_AM_STAGING_DIR,
        MRJobConfig.DEFAULT_MR_AM_STAGING_DIR)
        + Path.SEPARATOR + user + Path.SEPARATOR + STAGING_CONSTANT);
  }

  public static String getJobFile(Configuration conf, String user,
      org.apache.hadoop.mapreduce.JobID jobId) {
    Path jobFile = new Path(MRApps.getStagingAreaDir(conf, user),
        jobId.toString() + Path.SEPARATOR + MRJobConfig.JOB_CONF_FILE);
    return jobFile.toString();
  }

  public static Path getEndJobCommitSuccessFile(Configuration conf, String user,
      JobId jobId) {
    Path endCommitFile = new Path(MRApps.getStagingAreaDir(conf, user),
        jobId.toString() + Path.SEPARATOR + "COMMIT_SUCCESS");
    return endCommitFile;
  }

  public static Path getEndJobCommitFailureFile(Configuration conf, String user,
      JobId jobId) {
    Path endCommitFile = new Path(MRApps.getStagingAreaDir(conf, user),
        jobId.toString() + Path.SEPARATOR + "COMMIT_FAIL");
    return endCommitFile;
  }

  public static Path getStartJobCommitFile(Configuration conf, String user,
      JobId jobId) {
    Path startCommitFile = new Path(MRApps.getStagingAreaDir(conf, user),
        jobId.toString() + Path.SEPARATOR + "COMMIT_STARTED");
    return startCommitFile;
  }

  public static void setupDistributedCache(
      Configuration conf,
      Map<String, LocalResource> localResources)
  throws IOException {

    // Cache archives
    parseDistributedCacheArtifacts(conf, localResources,
        LocalResourceType.ARCHIVE,
        DistributedCache.getCacheArchives(conf),
        DistributedCache.getArchiveTimestamps(conf),
        getFileSizes(conf, MRJobConfig.CACHE_ARCHIVES_SIZES),
        DistributedCache.getArchiveVisibilities(conf));

    // Cache files
    parseDistributedCacheArtifacts(conf,
        localResources,
        LocalResourceType.FILE,
        DistributedCache.getCacheFiles(conf),
        DistributedCache.getFileTimestamps(conf),
        getFileSizes(conf, MRJobConfig.CACHE_FILES_SIZES),
        DistributedCache.getFileVisibilities(conf));
  }

  private static String getResourceDescription(LocalResourceType type) {
    if(type == LocalResourceType.ARCHIVE || type == LocalResourceType.PATTERN) {
      return "cache archive (" + MRJobConfig.CACHE_ARCHIVES + ") ";
    }
    return "cache file (" + MRJobConfig.CACHE_FILES + ") ";
  }

  private static String toString(org.apache.hadoop.yarn.api.records.URL url) {
    StringBuffer b = new StringBuffer();
    b.append(url.getScheme()).append("://").append(url.getHost());
    if(url.getPort() >= 0) {
      b.append(":").append(url.getPort());
    }
    b.append(url.getFile());
    return b.toString();
  }

  // TODO - Move this to MR!
  // Use TaskDistributedCacheManager.CacheFiles.makeCacheFiles(URI[],
  // long[], boolean[], Path[], FileType)
  private static void parseDistributedCacheArtifacts(
      Configuration conf,
      Map<String, LocalResource> localResources,
      LocalResourceType type,
      URI[] uris, long[] timestamps, long[] sizes, boolean visibilities[])
  throws IOException {

    if (uris != null) {
      // Sanity check
      if ((uris.length != timestamps.length) || (uris.length != sizes.length) ||
          (uris.length != visibilities.length)) {
        throw new IllegalArgumentException("Invalid specification for " +
            "distributed-cache artifacts of type " + type + " :" +
            " #uris=" + uris.length +
            " #timestamps=" + timestamps.length +
            " #visibilities=" + visibilities.length
            );
      }

      for (int i = 0; i < uris.length; ++i) {
        URI u = uris[i];
        Path p = new Path(u);
        FileSystem remoteFS = p.getFileSystem(conf);
        p = remoteFS.resolvePath(p.makeQualified(remoteFS.getUri(),
            remoteFS.getWorkingDirectory()));
        // Add URI fragment or just the filename
        Path name = new Path((null == u.getFragment())
          ? p.getName()
          : u.getFragment());
        if (name.isAbsolute()) {
          throw new IllegalArgumentException("Resource name must be relative");
        }
        String linkName = name.toUri().getPath();
        LocalResource orig = localResources.get(linkName);
        org.apache.hadoop.yarn.api.records.URL url =
          ConverterUtils.getYarnUrlFromURI(p.toUri());
        if(orig != null && !orig.getResource().equals(url)) {
          LOG.warn(
              getResourceDescription(orig.getType()) +
              toString(orig.getResource()) + " conflicts with " +
              getResourceDescription(type) + toString(url) +
              " This will be an error in Hadoop 2.0");
          continue;
        }
        localResources.put(linkName, LocalResource.newInstance(ConverterUtils
          .getYarnUrlFromURI(p.toUri()), type, visibilities[i]
            ? LocalResourceVisibility.PUBLIC : LocalResourceVisibility.PRIVATE,
          sizes[i], timestamps[i]));
      }
    }
  }

  // TODO - Move this to MR!
  private static long[] getFileSizes(Configuration conf, String key) {
    String[] strs = conf.getStrings(key);
    if (strs == null) {
      return null;
    }
    long[] result = new long[strs.length];
    for(int i=0; i < strs.length; ++i) {
      result[i] = Long.parseLong(strs[i]);
    }
    return result;
  }

  /**
   * Add the JVM system properties necessary to configure {@link ContainerLogAppender}.
   * @param logLevel the desired log level (eg INFO/WARN/DEBUG)
   * @param logSize See {@link ContainerLogAppender#setTotalLogFileSize(long)}
   * @param vargs the argument list to append to
   */
  public static void addLog4jSystemProperties(
      String logLevel, long logSize, List<String> vargs) {
    vargs.add("-Dlog4j.configuration=container-log4j.properties");
    vargs.add("-D" + YarnConfiguration.YARN_APP_CONTAINER_LOG_DIR + "=" +
        ApplicationConstants.LOG_DIR_EXPANSION_VAR);
    vargs.add(
        "-D" + YarnConfiguration.YARN_APP_CONTAINER_LOG_SIZE + "=" + logSize);
    vargs.add("-Dhadoop.root.logger=" + logLevel + ",CLA");
  }
}


text:
/**
 * @license
 * SPDX-License-Identifier: Apache-2.0
 */

import '../environment/dev';

import {ensureTokenIsValid, secretToken} from './secrets';

/** A prefix with which an attribute is safe to set using plain strings. */
export abstract class SafeAttributePrefix {
  // @ts-ignore: error TS6133: 'brand' is declared but its value is never read.
  private readonly brand!: never;  // To prevent structural typing.
}

/** Implementation for `SafeAttributePrefix` */
class AttributePrefixImpl extends SafeAttributePrefix {
  readonly privateDoNotAccessOrElseWrappedAttrPrefix: string;

  constructor(attrPrefix: string, token: object) {
    super();
    if (process.env.NODE_ENV !== 'production') {
      ensureTokenIsValid(token);
    }
    this.privateDoNotAccessOrElseWrappedAttrPrefix = attrPrefix;
  }

  override toString(): string {
    return this.privateDoNotAccessOrElseWrappedAttrPrefix;
  }
}

/**
 * Builds a new `SafeAttribute` from the given string, without enforcing
 * safety guarantees. This shouldn't be exposed to application developers, and
 * must only be used as a step towards safe builders or safe constants.
 */
export function createAttributePrefix(attrPrefix: string): SafeAttributePrefix {
  return new AttributePrefixImpl(attrPrefix, secretToken);
}

/**
 * Returns the string value of the passed `SafeAttributePrefix` object while
 * ensuring it has the correct type.
 */
export function unwrapAttributePrefix(value: SafeAttributePrefix): string {
  if (value instanceof AttributePrefixImpl) {
    return value.privateDoNotAccessOrElseWrappedAttrPrefix;
  } else {
    let message = '';
    if (process.env.NODE_ENV !== 'production') {
      message = 'Unexpected type when unwrapping SafeAttributePrefix';
    }
    throw new Error(message);
  }
}


text:
import * as html from '../../ml_parser/ast';
import * as i18n from '../i18n_ast';
import { Serializer } from './serializer';
export declare class Xmb implements Serializer {
    write(messageMap: {
        [k: string]: i18n.Message;
    }): string;
    load(content: string, url: string, placeholders: {
        [id: string]: {
            [name: string]: string;
        };
    }): {
        [id: string]: html.Node[];
    };
}


text:
#include <OCPlatform.h>
#include <OCApi.h>
#include <gtest/gtest.h>

namespace OCAccountManagerTest
{
    using namespace OC;

    // Callbacks
    void accountHandler(const HeaderOptions& /*headerOptions*/, const OCRepresentation& /*rep*/,
            const int /*eCode*/)
    {
    }

    void deleteHandler(const HeaderOptions& /*headerOptions*/, const int /*eCode*/)
    {
    }

    void onObserve(const HeaderOptions /*headerOptions*/, const OCRepresentation& /*rep*/,
                        const int& /*eCode*/, const int& /*sequenceNumber*/)
    {
    }

    // Helper method
    OCAccountManager::Ptr ConstructAccountManagerObject(std::string host)
    {
        auto ret = OCPlatform::constructAccountManagerObject(host, CT_DEFAULT);

        if (!ret)
        {
            ADD_FAILURE() << "ConstructAccountManagerObject result was null";
            throw std::runtime_error("ConstructAccountManagerObject result was null");
        }

        return ret;
    }

    // Host Test
    TEST(HostTest, Host)
    {
        std::string host("coap://192.168.1.2:5000");
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_TRUE(accountManager->host() == host);
    }

    // ConnectivityType Test
    TEST(ConnectivityTypeTest, ConnectivityType)
    {
        std::string host("coap://192.168.1.2:5000");
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_TRUE(accountManager->connectivityType() == CT_DEFAULT);
    }

    // SignUp Test
    TEST(SignUpTest, DISABLED_SignUpWithoutOptionForValid)
    {
        std::string host("coap://192.168.1.2:5000");
        std::string authProvider("AnyAuthProvider");
        std::string authCode("AnyAuthCode");
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_EQ(OC_STACK_OK, accountManager->signUp(authProvider, authCode, &accountHandler));
    }

    TEST(SignUpTest, DISABLED_SignUpForValid)
    {
        std::string host("coap://192.168.1.2:5000");
        std::string authProvider("AnyAuthProvider");
        std::string authCode("AnyAuthCode");
        QueryParamsMap options = {};
        options.insert(std::pair<std::string, std::string>("AnyOptionKey", "AnyOptionValue"));
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_EQ(OC_STACK_OK, accountManager->signUp(authProvider, authCode, options,
                                                      &accountHandler));
    }

    TEST(SignUpTest, SignUpWithNullCallback)
    {
        std::string host("coap://192.168.1.2:5000");
        std::string authProvider("AnyAuthProvider");
        std::string authCode("AnyAuthCode");
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_ANY_THROW(accountManager->signUp(authProvider, authCode, nullptr));
    }

    // SignIn Test
    TEST(SignInTest, DISABLED_SignInForValid)
    {
        std::string host("coap://192.168.1.2:5000");
        std::string userId("AnyUserId");
        std::string accessToken("AnyAccessToken");
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_EQ(OC_STACK_OK, accountManager->signIn(userId, accessToken, &accountHandler));
    }

    TEST(SignInTest, SignInWithNullCallback)
    {
        std::string host("coap://192.168.1.2:5000");
        std::string userId("AnyUserId");
        std::string accessToken("AnyAccessToken");
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_ANY_THROW(accountManager->signIn(userId, accessToken, nullptr));
    }

    // SignOut Test
    TEST(SignOutTest, DISABLED_SignOutForValid)
    {
        std::string host("coap://192.168.1.2:5000");
        std::string accessToken("AnyAccessToken");
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_EQ(OC_STACK_OK, accountManager->signOut(accessToken, &accountHandler));
    }

    TEST(SignOutTest, SignOutWithNullCallback)
    {
        std::string host("coap://192.168.1.2:5000");
        std::string accessToken("AnyAccessToken");
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_ANY_THROW(accountManager->signOut(accessToken, nullptr));
    }

    // RefreshAccessToken Test
    TEST(RefreshAccessTokenTest, DISABLED_RefreshAccessTokenForValid)
    {
        std::string host("coap://192.168.1.2:5000");
        std::string userId("AnyUserId");
        std::string refreshToken("AnyRefreshToken");
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_EQ(OC_STACK_OK, accountManager->refreshAccessToken(userId, refreshToken,
                                                                  &accountHandler));
    }

    TEST(RefreshAccessTokenTest, RefreshAccessTokenWithNullCallback)
    {
        std::string host("coap://192.168.1.2:5000");
        std::string userId("AnyUserId");
        std::string refreshToken("AnyRefreshToken");
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_ANY_THROW(accountManager->refreshAccessToken(userId, refreshToken, nullptr));
    }

    // SearchUser Test
    TEST(SearchUserTest, DISABLED_SearchUserForValid)
    {
        std::string host("coap://192.168.1.2:5000");
        std::string key("AnyKey");
        std::string value("AnyValue");
        QueryParamsMap query = {};
        query.insert(std::pair<std::string, std::string>(key, value));
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_EQ(OC_STACK_OK, accountManager->searchUser(query, &accountHandler));
    }

    TEST(SearchUserTest, SearchUserWithNullCallback)
    {
        std::string host("coap://192.168.1.2:5000");
        std::string key("AnyKey");
        std::string value("AnyValue");
        QueryParamsMap query = {};
        query.insert(std::pair<std::string, std::string>(key, value));
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_ANY_THROW(accountManager->searchUser(query, nullptr));
    }

    // DeleteDevice Test
    TEST(DeleteDeviceTest, DISABLED_DeleteDeviceForValid)
    {
        std::string host("coap://192.168.1.2:5000");
        std::string accessToken("AnyAccessToken");
        std::string deviceId("AnyDeviceId");
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_EQ(OC_STACK_OK, accountManager->deleteDevice(accessToken, deviceId,
                                                            &deleteHandler));
    }

    TEST(DeleteDeviceTest, DeleteDeviceWithNullCallback)
    {
        std::string host("coap://192.168.1.2:5000");
        std::string accessToken("AnyAccessToken");
        std::string deviceId("AnyDeviceId");
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_ANY_THROW(accountManager->deleteDevice(accessToken, deviceId, nullptr));
    }

    // CreateGroup Test
    TEST(CreateGroupTest, DISABLED_CreateGroupForValid)
    {
        std::string host("coap://192.168.1.2:5000");
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_EQ(OC_STACK_OK, accountManager->createGroup(&accountHandler));
    }

    TEST(CreateGroupTest, DISABLED_CreateGroupWithOptionForValid)
    {
        std::string host("coap://192.168.1.2:5000");
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        std::string property("AnyProperty");
        std::string value("AnyValue");
        QueryParamsMap query = {};
        query.insert(std::pair<std::string, std::string>(property, value));
        EXPECT_EQ(OC_STACK_OK, accountManager->createGroup(query, &accountHandler));
    }

    TEST(CreateGroupTest, CreateGroupWithNullCallback)
    {
        std::string host("coap://192.168.1.2:5000");
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_ANY_THROW(accountManager->createGroup(nullptr));
    }

    // DeleteGroup Test
    TEST(DeleteGroupTest, DISABLED_DeleteGroupForValid)
    {
        std::string host("coap://192.168.1.2:5000");
        std::string groupId("AnyGroupId");
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_EQ(OC_STACK_OK, accountManager->deleteGroup(groupId, &deleteHandler));
    }

    TEST(DeleteGroupTest, DeleteGroupWithNullCallback)
    {
        std::string host("coap://192.168.1.2:5000");
        std::string groupId("AnyGroupId");
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_ANY_THROW(accountManager->deleteGroup(groupId, nullptr));
    }

    // GetGroupInfoAll Test
    TEST(GetGroupInfoAllTest, DISABLED_GetGroupInfoAllForValid)
    {
        std::string host("coap://192.168.1.2:5000");
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_EQ(OC_STACK_OK, accountManager->getGroupInfoAll(&accountHandler));
    }

    TEST(GetGroupInfoAllTest, GetGroupInfoAllWithNullCallback)
    {
        std::string host("coap://192.168.1.2:5000");
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_ANY_THROW(accountManager->getGroupInfoAll(nullptr));
    }

    // GetGroupInfo Test
    TEST(GetGroupInfoTest, DISABLED_GetGroupInfoForValid)
    {
        std::string host("coap://192.168.1.2:5000");
        std::string groupId("AnyGroupId");
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_EQ(OC_STACK_OK, accountManager->getGroupInfo(groupId, &accountHandler));
    }

    TEST(GetGroupInfoTest, GetGroupInfoWithNullCallback)
    {
        std::string host("coap://192.168.1.2:5000");
        std::string groupId("AnyGroupId");
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_ANY_THROW(accountManager->getGroupInfo(groupId, nullptr));
    }

    // AddPropertyValueToGroup Test
    TEST(AddPropertyValueToGroupTest, DISABLED_AddPropertyValueToGroupForValid)
    {
        std::string host("coap://192.168.1.2:5000");
        std::string groupId("AnyGroupId");
        OCRepresentation propertyValue;
        propertyValue.setValue("AnyProperty", "AnyValue");
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_EQ(OC_STACK_OK, accountManager->addPropertyValueToGroup(groupId, propertyValue,
                                                                       &accountHandler));
    }

    TEST(AddPropertyValueToGroupTest, AddPropertyValueToGroupWithNullCallback)
    {
        std::string host("coap://192.168.1.2:5000");
        std::string groupId("AnyGroupId");
        OCRepresentation propertyValue;
        propertyValue.setValue("AnyProperty", "AnyValue");
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_ANY_THROW(accountManager->addPropertyValueToGroup(groupId, propertyValue,
                                                                 nullptr));
    }

    // DeletePropertyValueFromGroup Test
    TEST(DeletePropertyValueFromGroupTest, DISABLED_DeletePropertyValueFromGroupForValid)
    {
        std::string host("coap://192.168.1.2:5000");
        std::string groupId("AnyGroupId");
        OCRepresentation propertyValue;
        propertyValue.setValue("AnyProperty", "AnyValue");
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_EQ(OC_STACK_OK, accountManager->deletePropertyValueFromGroup(groupId, propertyValue,
                                                                            &accountHandler));
    }

    TEST(DeletePropertyValueFromGroupTest, DeletePropertyValueFromGroupWithNullCallback)
    {
        std::string host("coap://192.168.1.2:5000");
        std::string groupId("AnyGroupId");
        OCRepresentation propertyValue;
        propertyValue.setValue("AnyProperty", "AnyValue");
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_ANY_THROW(accountManager->deletePropertyValueFromGroup(groupId, propertyValue,
                                                                      nullptr));
    }

    // UpdatePropertyValueOnGroup Test
    TEST(UpdatePropertyValueOnGroupTest, DISABLED_UpdatePropertyValueOnGroupForValid)
    {
        std::string host("coap://192.168.1.2:5000");
        std::string groupId("AnyGroupId");
        OCRepresentation propertyValue;
        propertyValue.setValue("AnyProperty", "AnyValue");
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_EQ(OC_STACK_OK, accountManager->updatePropertyValueOnGroup(groupId, propertyValue,
                                                                       &accountHandler));
    }

    TEST(UpdatePropertyValueOnGroupTest, UpdatePropertyValueOnGroupWithNullCallback)
    {
        std::string host("coap://192.168.1.2:5000");
        std::string groupId("AnyGroupId");
        OCRepresentation propertyValue;
        propertyValue.setValue("AnyProperty", "AnyValue");
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_ANY_THROW(accountManager->updatePropertyValueOnGroup(groupId, propertyValue,
                                                                 nullptr));
    }

    // ObserveGroup Test
    TEST(ObserveGroupTest, DISABLED_ObserveGroupForValid)
    {
        std::string host("coap://192.168.1.2:5000");
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_EQ(OC_STACK_OK, accountManager->observeGroup(&onObserve));
    }

    TEST(ObserveGroupTest, ObserveGroupWithNullCallback)
    {
        std::string host("coap://192.168.1.2:5000");
        std::string groupId("AnyGroupId");
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_ANY_THROW(accountManager->observeGroup(nullptr));
    }

    // CancelObserveGroup Test
    TEST(CancelObserveGroupTest, DISABLED_CancelObserveGroupForValid)
    {
        std::string host("coap://192.168.1.2:5000");
        std::string groupId("AnyGroupId");
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_EQ(OC_STACK_OK, accountManager->observeGroup(&onObserve));
        EXPECT_EQ(OC_STACK_OK, accountManager->cancelObserveGroup());
    }

    TEST(CancelObserveGroupTest, CancelObserveGroupWithoutObserve)
    {
        std::string host("coap://192.168.1.2:5000");
        std::string groupId("AnyGroupId");
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_ANY_THROW(accountManager->cancelObserveGroup());
    }

    // ObserveInvitation Test
    TEST(ObserveInvitationTest, DISABLED_ObserveInvitationForValid)
    {
        std::string host("coap://192.168.1.2:5000");
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_EQ(OC_STACK_OK, accountManager->observeInvitation(&onObserve));
    }

    TEST(ObserveInvitationTest, ObserveInvitationWithNullCallback)
    {
        std::string host("coap://192.168.1.2:5000");
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_ANY_THROW(accountManager->observeInvitation(nullptr));
    }

    // CancelObserveInvitation Test
    TEST(CancelObserveInvitationTest, DISABLED_CancelObserveInvitationForValid)
    {
        std::string host("coap://192.168.1.2:5000");
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_EQ(OC_STACK_OK, accountManager->observeInvitation(&onObserve));
        EXPECT_EQ(OC_STACK_OK, accountManager->cancelObserveInvitation());
    }

    TEST(CancelObserveInvitationTest, CancelObserveInvitationWithoutObserve)
    {
        std::string host("coap://192.168.1.2:5000");
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_ANY_THROW(accountManager->cancelObserveInvitation());
    }

    // SendInvitation Test
    TEST(SendInvitationTest, DISABLED_SendInvitationForValid)
    {
        std::string host("coap://192.168.1.2:5000");
        std::string groupId("AnyGroupId");
        std::string userId("AnyUserId");
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_EQ(OC_STACK_OK, accountManager->sendInvitation(groupId, userId, &accountHandler));
    }

    TEST(SendInvitationTest, SendInvitationWithNullCallback)
    {
        std::string host("coap://192.168.1.2:5000");
        std::string groupId("AnyGroupId");
        std::string userId("AnyUserId");
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_ANY_THROW(accountManager->sendInvitation(groupId, userId, nullptr));
    }

    // CancelInvitation Test
    TEST(CancelInvitationTest, DISABLED_CancelInvitationForValid)
    {
        std::string host("coap://192.168.1.2:5000");
        std::string groupId("AnyGroupId");
        std::string userId("AnyUserId");
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_EQ(OC_STACK_OK, accountManager->cancelInvitation(groupId, userId, &deleteHandler));
    }

    TEST(CancelInvitationTest, CancelInvitationWithNullCallback)
    {
        std::string host("coap://192.168.1.2:5000");
        std::string groupId("AnyGroupId");
        std::string userId("AnyUserId");
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_ANY_THROW(accountManager->cancelInvitation(groupId, userId, nullptr));
    }

    // ReplyToInvitation Test
    TEST(ReplyToInvitationTest, DISABLED_ReplyToInvitationForValid)
    {
        std::string host("coap://192.168.1.2:5000");
        std::string groupId("AnyGroupId");
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_EQ(OC_STACK_OK, accountManager->replyToInvitation(groupId, true, &deleteHandler));
    }

    TEST(ReplyToInvitationTest, ReplyToInvitationWithNullCallback)
    {
        std::string host("coap://192.168.1.2:5000");
        std::string groupId("AnyGroupId");
        OCAccountManager::Ptr accountManager = ConstructAccountManagerObject(host);
        EXPECT_TRUE(NULL != accountManager);
        EXPECT_ANY_THROW(accountManager->replyToInvitation(groupId, true, nullptr));
    }
}


text:
              __  __
     __      _\ \/ /___  _ __
     \ \ /\ / /\  // _ \| '__|
      \ V  V / /  \ (_) | |
       \_/\_/ /_/\_\___/|_|

Custom encyrption system, run from the Command line.
Written in C, with an alternate version in C++.

### To compile
###### C Version
navigate to the `/C` directory of the repo, then run
`gcc main.cpp -o wXOR` (wXOR is the output executable in this case)
###### C++ Version
navigate to the `/CPP` directory of the repo, then run
`g++ main.cpp -o wXOR` (wXOR is the output executable in this case)
### To use
`./wXOR -e <input file> <output file>` encrypts input file
`./wXOR -d <input file> <output file>` decrypts input file
In the C++ version only, the output file is optional, and defaults to wXOR.txt.
#Features
- Randomly generated 64-bit encryption, using XOR.
- *Because it does not use hashes, it is incredible time consuming to crack*
- Also, anyone can change bit-count of the encryption by changing simple setting in the header file.
- The output filename is also settable.
- Uses binary read and write to encrypt any file type, of any length.
- Clearly documented.
- Written in both C and C++, if for whatever reasons you need one or the other.
- Works cross-platform, on every platform.

#ToDo
1. Allow people to set their own passwords
2. Optimize code better, make code more compact.
3. Add extra security:
  - Set variables to clear from debuggers
  - Other cool stuff
4. Allow key to be used from command line


text:
class AddTimeZoneToCalendars < ActiveRecord::Migration
  def change
    add_column :calendars, :time_zone, :string
  end
end


text:
(function(){
	angular.module('jb', [])
	.directive('jbTruncate',[function(){
		return{
			restrict:'E',
			template:'
						{{attrs.string}}
					    {{truncatedString}}

							{{truncatedString}}
						',
			link: function($scope, element, attrs){
				$scope.attrs = attrs;				//	currrntly 3 attrs 1)string which is to be truncate 2)truncateAfter
				if(!$scope.attrs.truncateAfter){		//i.e after how many characters string is to be trunacted
					$scope.attrs.truncateAfter = 30;		//by default it is 30 characters
				}								//toggle means allow show more show less by default it is false
				var dots = "...";
				if($scope.attrs.string){
					if($scope.attrs.string.length > $scope.attrs.truncateAfter){
					    $scope.truncatedString = $scope.attrs.string.substring(0,$scope.attrs.truncateAfter) + dots;
					    $scope.ShowTruncatedString = true;
				    }
				}
				else{
					console.log('no string found to truncate....!!!!');
				}
			}
		}
	}])
})();


text:
using System;

namespace Medo.Security.Cryptography.PasswordSafe {
    /// <summary>
    /// Record field types.
    /// </summary>
    public enum RecordType {
        /// <summary>
        /// UUID.
        /// </summary>
        Uuid = 0x01,
        /// <summary>
        /// Group.
        /// </summary>
        Group = 0x02,
        /// <summary>
        /// Title.
        /// </summary>
        Title = 0x03,
        /// <summary>
        /// User name.
        /// </summary>
        UserName = 0x04,
        /// <summary>
        /// Notes.
        /// </summary>
        Notes = 0x05,
        /// <summary>
        /// Password.
        /// </summary>
        Password = 0x06,
        /// <summary>
        /// Creation time.
        /// </summary>
        CreationTime = 0x07,
        /// <summary>
        /// Password modification time.
        /// </summary>
        PasswordModificationTime = 0x08,
        /// <summary>
        /// Last access time.
        /// </summary>
        LastAccessTime = 0x09,
        /// <summary>
        /// Password expiry time.
        /// </summary>
        PasswordExpiryTime = 0x0a,
        /// <summary>
        /// Last modification time.
        /// </summary>
        LastModificationTime = 0x0c,
        /// <summary>
        /// URL.
        /// </summary>
        Url = 0x0d,
        /// <summary>
        /// Autotype.
        /// </summary>
        Autotype = 0x0e,
        /// <summary>
        /// Password history.
        /// </summary>
        PasswordHistory = 0x0f,
        /// <summary>
        /// Password policy.
        /// </summary>
        PasswordPolicy = 0x10,
        /// <summary>
        /// Password expiry interval.
        /// </summary>
        PasswordExpiryInterval = 0x11,
        /// <summary>
        /// Run command.
        /// </summary>
        RunCommand = 0x12,
        /// <summary>
        /// Double-click action.
        /// </summary>
        DoubleClickAction = 0x13,
        /// <summary>
        /// E-mail address.
        /// </summary>
        EmailAddress = 0x14,
        /// <summary>
        /// Protected entry.
        /// </summary>
        ProtectedEntry = 0x15,
        /// <summary>
        /// Own symbols for password.
        /// </summary>
        OwnSymbolsForPassword = 0x16,
        /// <summary>
        /// Shift double-click action.
        /// </summary>
        ShiftDoubleClickAction = 0x17,
        /// <summary>
        /// Password policy name.
        /// </summary>
        PasswordPolicyName = 0x18,
        /// <summary>
        /// Entry keyboard shortcut.
        /// </summary>
        EntryKeyboardShortcut = 0x19,

        /// <summary>
        /// Two-factor authentication key.
        /// This is the shared secret for sites using Time-Based One-Time Password Algorithm (per RFC6238) such as Google Authenticator. At least 10 bytes.
        /// </summary>
        TwoFactorKey = 0x1b,
        /// <summary>
        /// Credit card number.
        /// Number should consist of digits and spaces.
        /// </summary>
        CreditCardNumber = 0x1c,
        /// <summary>
        /// Credit card expiration.
        /// Expiration should be MM/YY, where MM is 01-12, and YY 00-99.
        /// </summary>
        CreditCardExpiration = 0x1d,
        /// <summary>
        /// Credit card verification value.
        /// CVV (CVV2) is three or four digits.
        /// </summary>
        CreditCardVerificationValue = 0x1e,
        /// <summary>
        /// Credit card PIN.
        /// PIN is four to twelve digits long (ISO-9564).
        /// </summary>
        CreditCardPin = 0x1f,

        /// <summary>
        /// UTF-8 encoded text used for QR code generation.
        /// </summary>
        QRCode = 0x20,

        /// <summary>
        /// End of entries.
        /// </summary>
        EndOfEntry = 0xFF,
    }
}


text:
using System;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Text;
using ObjLoader.Loader.Loaders;

namespace ObjLoader.Test
{
    class Program
    {
        static void Main(string[] args)
        {
            var stopwatch = new Stopwatch();
            stopwatch.Start();

            var objLoaderFactory = new ObjLoaderFactory();
            var objLoader = objLoaderFactory.Create(new MaterialStreamProvider());

            var fileStream = new FileStream(args[0], FileMode.Open, FileAccess.Read);

            var result = objLoader.Load(fileStream);

            stopwatch.Stop();
            Console.WriteLine(stopwatch.Elapsed);

            PrintResult(result);
        }

        private static void PrintResult(LoadResult result)
        {
            var sb = new StringBuilder();

            sb.AppendLine("Load result:");
            sb.Append("Vertices: ");
            sb.AppendLine(result.Vertices.Count.ToString(CultureInfo.InvariantCulture));
            sb.Append("Textures: ");
            sb.AppendLine(result.Textures.Count.ToString(CultureInfo.InvariantCulture));
            sb.Append("Normals: ");
            sb.AppendLine(result.Normals.Count.ToString(CultureInfo.InvariantCulture));
            sb.AppendLine();
            sb.AppendLine("Groups: ");

            foreach (var loaderGroup in result.Groups)
            {
                sb.AppendLine(loaderGroup.Name);
                sb.Append("Faces: ");
                sb.AppendLine(loaderGroup.Faces.Count.ToString(CultureInfo.InvariantCulture));
            }

            Console.WriteLine(sb);
        }
    }
}


text:
import {parseJson} from '../src/json';
import {validateData, writeScript} from '../3p/3p';

/**
 * @param {!Window} global
 * @param {!Object} data
 */
export function torimochi(global, data) {
  validateData(data, ['area', 'adtype']);

  if (data.width < global.width) {
    global.width = data.width;
  }
  global.height = data.height;
  global.area = data['area'];
  global.adtype = data['adtype'];
  global.tcid = data['tcid'];
  global.wid = data['wid'];
  global.extra = parseJson(data['extra'] || '{}');
  global.context.renderStart({width: global.width, height: global.height});

  const url =
    'https://asset.torimochi-ad.net/js/torimochi_ad_amp.min.js?v=' + Date.now();

  writeScript(global, url);
}


text:
package com.webfirmframework.wffweb.tag.html.html5.identifier;

import com.webfirmframework.wffweb.tag.core.TagBase;

/**
 * Identifier interface for {@code Section} attributes
 *
 * @author WFF
 *
 */
public interface SectionAttributable extends TagBase {

}


text:
package de.fhg.iais.cortex.search.types;

import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

import java.util.Random;

import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

/**
 *
 *
 */
public class SortCriterionTest {

    private Random mock;

    @BeforeClass
    public static void first() throws Exception {
        SortCriterion relevance = SortCriterion.RELEVANCE;
    }

    @Before
    public void setUp() throws Exception {
        this.mock = mock(Random.class);
        SortCriterion.setRandomGenerator(this.mock);
        when(this.mock.nextLong()).thenReturn(5739109485L);
    }

    @Test
    public void testGetSeed() throws Exception {
        SortCriterion random = SortCriterion.random();
        assertThat(5739109485L, is(random.getSeed()));

        random.setSeed(123456789);
        assertThat(123456789L, is(random.getSeed()));
    }

    @Test
    public void testSortCriterion() throws Exception {
        SortCriterion criterion = SortCriterion.sortCriterion("RELEVANCE");
        assertThat(criterion, is(SortCriterion.RELEVANCE));

        criterion = SortCriterion.sortCriterion("ALPHA_ASC");
        assertThat(criterion, is(SortCriterion.ALPHA_ASC));

        criterion = SortCriterion.sortCriterion("ALPHA_DESC");
        assertThat(criterion, is(SortCriterion.ALPHA_DESC));

        criterion = SortCriterion.sortCriterion("apd_xml");
        assertThat(criterion, is(SortCriterion.APD_XML));

        criterion = SortCriterion.sortCriterion("RANDOM_123456789");
        assertTrue(criterion.isRandom());
        assertThat(123456789L, is(criterion.getSeed()));

        criterion = SortCriterion.sortCriterion("RANDOM");
        assertTrue(criterion.isRandom());
        assertThat(123456789L, not(is(criterion.getSeed())));
        assertThat(5739109485L, is(criterion.getSeed()));

        criterion = SortCriterion.sortCriterion("RANDOM_");
        assertTrue(criterion.isRandom());
        assertThat(123456789L, not(is(criterion.getSeed())));
        assertThat(5739109485L, is(criterion.getSeed()));
    }
}


text:
package fzf

import (
	"bufio"
	"io"
	"os"

	"github.com/junegunn/fzf/src/util"
)

// Reader reads from command or standard input
type Reader struct {
	pusher   func([]byte) bool
	eventBox *util.EventBox
	delimNil bool
}

// ReadSource reads data from the default command or from standard input
func (r *Reader) ReadSource() {
	if util.IsTty() {
		cmd := os.Getenv("FZF_DEFAULT_COMMAND")
		if len(cmd) == 0 {
			cmd = defaultCommand
		}
		r.readFromCommand(cmd)
	} else {
		r.readFromStdin()
	}
	r.eventBox.Set(EvtReadFin, nil)
}

func (r *Reader) feed(src io.Reader) {
	delim := byte('\n')
	if r.delimNil {
		delim = '\000'
	}
	reader := bufio.NewReaderSize(src, readerBufferSize)
	for {
		// ReadBytes returns err != nil if and only if the returned data does not
		// end in delim.
		bytea, err := reader.ReadBytes(delim)
		byteaLen := len(bytea)
		if len(bytea) > 0 {
			if err == nil {
				// get rid of carriage return if under Windows:
				if util.IsWindows() && byteaLen >= 2 && bytea[byteaLen-2] == byte('\r') {
					bytea = bytea[:byteaLen-2]
				} else {
					bytea = bytea[:byteaLen-1]
				}
			}
			if r.pusher(bytea) {
				r.eventBox.Set(EvtReadNew, nil)
			}
		}
		if err != nil {
			break
		}
	}
}

func (r *Reader) readFromStdin() {
	r.feed(os.Stdin)
}

func (r *Reader) readFromCommand(cmd string) {
	listCommand := util.ExecCommand(cmd)
	out, err := listCommand.StdoutPipe()
	if err != nil {
		return
	}
	err = listCommand.Start()
	if err != nil {
		return
	}
	defer listCommand.Wait()
	r.feed(out)
}


text:
package io.orchestrate.client.itest;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;

import io.orchestrate.client.Client;
import io.orchestrate.client.KvMetadata;
import io.orchestrate.client.KvObject;
import io.orchestrate.client.OrchestrateClient;

import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.rules.TestName;

import java.io.IOException;
import java.net.URI;
import java.util.HashSet;
import java.util.Random;
import java.util.Set;

/**
 * A base test class for testing the {@code OrchestrateClient}.
 */
public abstract class BaseClientTest {
    @Rule
    public TestName name = new TestName();

    protected static final ObjectMapper MAPPER = new ObjectMapper();

    protected static final Set<String> COLLECTIONS = new HashSet<String>();
    protected static final Random RAND = new Random();

    /** The client instance to use with requests to the Orchestrate service. */
    protected static Client client;

    @BeforeClass
    public static void setUpClass() {
        final String apiKey = System.getProperty("orchestrate.apiKey");
        if (apiKey == null || apiKey.length() < 1) {
            throw new IllegalStateException("Cannot run integration tests, 'apiKey' is blank.");
        }

        URI uri = URI.create(System.getProperty("orchestrate.host", OrchestrateClient.Builder.DEFAULT_HOST));

        String host = uri.getScheme()+"://" + uri.getHost();
        int port = uri.getPort();
        if(port == -1) {
            if( uri.getScheme().equals("https")) {
                port = 443;
            } else {
                port = 80;
            }
        }
        boolean ssl = uri.getScheme().equals("https");

        client = OrchestrateClient.builder(apiKey)
                .host(host)
                .port(port)
                .useSSL(ssl)
                .build();
    }

    @AfterClass
    public static void tearDownClass() throws IOException {
        for (final String collection : COLLECTIONS) {
            client.deleteCollection(collection).get();
        }
        client.close();
    }

    protected String collection() {
        COLLECTIONS.add(name.getMethodName());
        return name.getMethodName();
    }

    protected KvObject<ObjectNode> readItem(String key) {
        return client.kv(collection(), key)
                .get(ObjectNode.class)
                .get();
    }

    protected KvMetadata insertItem(String key, String json_ish, Object...args) {
        return client.kv(collection(), key)
                .put(String.format(json_ish.replace('`', '"'), args))
                .get();
    }
}


text:
using SharpDX.Direct3D;
using SharpDX.Direct3D11;
using System.Runtime.InteropServices;
using Valve.VR;
using Buffer = SharpDX.Direct3D11.Buffer;

class RenderModel {
	private readonly int VertexDataSize = Marshal.SizeOf<RenderModel_Vertex_t>();

	//Note that the RenderModel doesn't take ownership of its resources (they're owned by the RenderModelCache)
	private readonly VertexBufferBinding vertexBufferBinding;
	private readonly Buffer indexBuffer;
	private readonly int indexCount;
	private readonly IOpaqueMaterial material;

	public RenderModel(VertexBufferBinding vertexBufferBinding, Buffer indexBuffer, int indexCount, IOpaqueMaterial material) {
		this.vertexBufferBinding = vertexBufferBinding;
		this.indexBuffer = indexBuffer;
		this.indexCount = indexCount;
		this.material = material;
	}

	public void Render(DeviceContext context, bool depthOnly) {
		context.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleList;
		context.InputAssembler.SetVertexBuffers(0, vertexBufferBinding);
		context.InputAssembler.SetIndexBuffer(indexBuffer, SharpDX.DXGI.Format.R16_UInt, 0);
		if (depthOnly) {
			context.PixelShader.Set(null);
		} else {
			material.Apply(context);
		}
		context.DrawIndexed(indexCount, 0, 0);
	}
}