text:
/**
 *
 */
package org.ebayopensource.turmeric.runtime.common.impl.binding.jaxb.validation.util;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import javax.xml.namespace.QName;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;

import org.ebayopensource.turmeric.runtime.common.exceptions.SchemaExtractionException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;

import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;

import com.ebay.kernel.logger.LogLevel;
import com.ebay.kernel.logger.Logger;

/**
 * @author arajmony
 *
 */
public class SchemaExtractorUtil {

	private static final Logger s_logger = Logger.getInstance(SchemaExtractorUtil.class.getName());

	/**
	 * Given the WSDL's relative path, this method returns a list of QNames of those types
	 * which have a xs:any element inside it.
	 * @param inputSource
	 * @return
	 * @throws Exception
	 */
	public static List<QName> getListOFTypesHavingXSAny(String wsdlRelativePath)
	throws Exception{

		List<QName> listOfQNames = new ArrayList<QName>();

		class MyHandler extends DefaultHandler{

			private List<QName> refListOfQNames;
			private String currTNS;
			private String currTypeName;
			private String lastElementName;

			public MyHandler(List<QName> list) {
				refListOfQNames = list;

			}

			 @Override
	            public void startElement(String uri, String localName,
	                    String qName, Attributes attributes) throws SAXException {
	                String elementName = ("".equals(localName)) ? qName : localName;

	                if (elementName.equals("schema")
	                        || elementName.contains(":schema")) {
	                	currTNS = attributes.getValue("targetNamespace");

	                }

	                //search for element's name also. This will come in handy for anonymous complex types.
	                if (elementName.equals("element")
	                        || elementName.contains(":element")) {
	                	lastElementName = attributes.getValue("name");
	                }

	                if (elementName.equals("complexType")
	                        || elementName.contains(":complexType")) {
	                	currTypeName = attributes.getValue("name");

	                	//support for anonymous types
	                	if(currTypeName == null)
	                		currTypeName = lastElementName;
	                }

	                if (elementName.equals("any")
	                        || elementName.contains(":any")) {
	                	QName currTypesQName = new QName(currTNS,currTypeName);
	                	refListOfQNames.add(currTypesQName);
	                }

	            }

		}

		try {
			SAXParser parser = SAXParserFactory.newInstance().newSAXParser();

			InputStream inputStream=null;
			inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(wsdlRelativePath);
			if(inputStream == null){
				String msg = "InputStream could not be created for WSDL @ " + wsdlRelativePath;
				s_logger.log(LogLevel.ERROR, msg);
				throw new SchemaExtractionException(msg);
			}

			parser.parse(inputStream, new MyHandler(listOfQNames));

		} catch (ParserConfigurationException e) {
			String msg = "ParserConfigurationException at getListOFTypesHavingXSAny : " + e;
			s_logger.log(LogLevel.ERROR, msg);
			throw new SchemaExtractionException(msg,e);
		} catch (SAXException e) {
			String msg = "SAXException at getListOFTypesHavingXSAny : " + e;
			s_logger.log(LogLevel.ERROR, msg);
			throw new SchemaExtractionException(msg,e);
		}

		if(s_logger.isLogEnabled(LogLevel.INFO))
			s_logger.log(LogLevel.INFO, "list of types having xs:any for WSDL : " + wsdlRelativePath +
				"  is " + listOfQNames);

		return listOfQNames;
	}

	/**
	 * Given the WSDLs relative path and the list of QNames of the types which has xs:any this method would return
	 * a set of QNames of those types which cause UPA issue bcos of xs:any.This is identified by the logic
	 *   1. If a type using xs:any is being extended by some other type or being referred as a composite element, then
	 *   	UPA is true for this case.
	 * @param listOFTypesHavingXSAny
	 * @param wsdlRelativePath
	 * @return
	 */
	public static Set<QName> getListOfTypesReferringTheXSAnyTypes(List<QName> listOFTypesHavingXSAny,String wsdlRelativePath)
		throws Exception{
		Set<QName> setOfQNames = new HashSet<QName>();
		Map<String, QName> mapOfNamesAndQNames = new HashMap<String, QName>();

		/*
		 * get the local name only from the list of QNames as
		 *  1. it is easier while parsing the xml doc to identify such elements
		 *  2. it is also legal, since as of today (SOA 2.7) the fwk does not support two types of the same name
		 *  	even if they belong to a different namespace //TODO correct this once this stmt # 2 becomes invalid.
		 */
		List<String> onlyTypeNamesOfTypesHavingXSAny = new ArrayList<String>(listOFTypesHavingXSAny.size());
		for(QName currQName : listOFTypesHavingXSAny){
			onlyTypeNamesOfTypesHavingXSAny.add(currQName.getLocalPart());
			mapOfNamesAndQNames.put(currQName.getLocalPart(), currQName);
		}

		class MyHandler extends DefaultHandler{
			Set<QName> refQNameSet;
			Map<String, QName> refMap;
			private String currTypeName;
			private String lastElementName;

			MyHandler(Set<QName> arg1,Map<String, QName> arg2){
				refQNameSet = arg1;
				refMap = arg2;

			}

			 @Override
	            public void startElement(String uri, String localName,
	                    String qName, Attributes attributes) throws SAXException {
	                String elementName = ("".equals(localName)) ? qName : localName;

	                //search for element's name also. This will come in handy for anonymous complex types.
	                if (elementName.equals("element")
	                        || elementName.contains(":element")) {
	                	lastElementName = attributes.getValue("name");//this is recorded for supporting anonymous types

	                	String referredTypeName = attributes.getValue("type");
	                	if(referredTypeName == null)
	                		return;

	                	int index = referredTypeName.indexOf(":");
	                	if(index > 0){
	                		referredTypeName = referredTypeName.substring(index+1);
	                	}

	                	if(refMap.get(referredTypeName) != null){
	                		refQNameSet.add(refMap.get(referredTypeName));
	                	}
	                }

	                if (elementName.equals("complexType")
	                        || elementName.contains(":complexType")) {
	                	if(attributes != null)
	                		currTypeName = attributes.getValue("name");

	                	//support for anonymous types
	                	if(currTypeName == null)
	                		currTypeName = lastElementName;
	                }

	                //<xs:extension base="tns:BaseServiceRequest">

	                if (elementName.equals("extension")
	                        || elementName.contains(":extension")) {

	                	String base = attributes.getValue("base");
	                	int index = base.indexOf(":");
	                	if(index > 0){
	                		base = base.substring(index+1);
	                	}

	                	if(refMap.get(base) != null){
	                		refQNameSet.add(refMap.get(base));
	                	}
	                }

	            }

		}

		try {
			SAXParser parser = SAXParserFactory.newInstance().newSAXParser();

			InputStream inputStream=null;
			inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(wsdlRelativePath);
			if(inputStream == null){
				String msg = "InputStream could not be created for WSDL @ " + wsdlRelativePath;
				s_logger.log(LogLevel.ERROR, msg);
				throw new SchemaExtractionException(msg);
			}

			parser.parse(inputStream, new MyHandler(setOfQNames,mapOfNamesAndQNames));

		} catch (ParserConfigurationException e) {
			String msg = "ParserConfigurationException at getListOFTypesHavingXSAny : " + e;
			s_logger.log(LogLevel.ERROR, msg);
			throw new SchemaExtractionException(msg,e);
		} catch (SAXException e) {
			String msg = "SAXException at getListOFTypesHavingXSAny : " + e;
			s_logger.log(LogLevel.ERROR, msg);
			throw new SchemaExtractionException(msg,e);
		}

		if(s_logger.isLogEnabled(LogLevel.INFO))
			s_logger.log(LogLevel.INFO, "list of types referring to types having xs:any for WSDL : " + wsdlRelativePath +
				"  is " + setOfQNames);

		return setOfQNames;

	}

	public static void removeTheTypesFromTheFile(List<String> value,
			String xsdFileRelativePath) throws Exception {

		/*
		 * creating a new schema file
		 */
		DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
		// get an instance of builder
		DocumentBuilder db=null;
		try {
			db = dbf.newDocumentBuilder();
		} catch (ParserConfigurationException e) {
			String msg = "Parser configuration exception : " + e;
			s_logger.log(LogLevel.ERROR, msg);
			throw new SchemaExtractionException(msg,e);
		}
		// create an instance of DOM from the schema file
		Document document = db.parse(xsdFileRelativePath);

		NodeList nodeList = document.getChildNodes();
		Element schemaElement = null;

		for(int i=0; i < nodeList.getLength(); i++){
			Element currElement = (Element)nodeList.item(i);
			String nodeName = currElement.getNodeName();
			if(nodeName.equals("schema") || nodeName.endsWith(":schema")){
				schemaElement = currElement;
				break;
			}
		}

		boolean nodeDeleted = false;

		if(schemaElement != null){
			NodeList childNodesOfSchemaElement = schemaElement.getChildNodes();

			for(int i=0; i < childNodesOfSchemaElement.getLength() ; i++){
				Node currNode = childNodesOfSchemaElement.item(i);

				if( ! (nodeNameEquals("complexType",currNode) || nodeNameEquals("element",currNode))){
					continue;
				}

				//find the name of the complex type or element, iff the name matches with one of those in the input param value
				//the code should try and remove the xs:any from such types/elements(anonymous types) only.
				NamedNodeMap attributes = currNode.getAttributes();
				if(attributes == null)
					continue;

				String typeOrAnyonymousElementName = attributes.getNamedItem("name").getNodeValue();
				if(value.contains(typeOrAnyonymousElementName)){
					removeXSAnyNodeFromThisNode(currNode);
					nodeDeleted = true;
				}
			}
		}

		/*
		 * re-write the file, since xs:any if present would have been removed
		 * but do it only if file has been modified
		 */
		if(nodeDeleted){
			if(s_logger.isLogEnabled(LogLevel.INFO))
				s_logger.log(LogLevel.INFO, "deletable xs:any was found and removed from " + xsdFileRelativePath);

			File outputFile = new File(xsdFileRelativePath);
			writeSchemaDocumentToFile(document,outputFile);
		}

	}

	public static boolean nodeNameEquals(String nameToMatch, Node currNode) {
		if(currNode == null)
			return false;

		String nodeName = currNode.getNodeName();
		if(nodeName == null)
			return false;

		if(nodeName.equals(nameToMatch) || nodeName.endsWith(":"+nameToMatch))
			return true;

		return false;
	}

	private static void removeXSAnyNodeFromThisNode(
			Node currNode) {

		Node parentNode = currNode.getParentNode();
		String nodeName = currNode.getNodeName();

		if(nodeName.equals("any") || nodeName.endsWith(":any")){
			parentNode.removeChild(currNode);
			s_logger.log(LogLevel.FINE, "removed xs:any from node "+ nodeName);

		}else{
			NodeList nodesChNodeList = currNode.getChildNodes();
			if(nodesChNodeList != null){
				for(int i =0; i<nodesChNodeList.getLength() ; i++){
					removeXSAnyNodeFromThisNode(nodesChNodeList.item(i));
				}
			}
		}

	}

	public static void writeSchemaDocumentToFile(Document document, File fileOutput) throws SchemaExtractionException{

		FileOutputStream output = null;
		try {
			 output = new FileOutputStream(fileOutput);
		} catch (FileNotFoundException e) {
			closeOutputStreamSilently(output);
			String msg = "Error while trying to write to schema file : " + fileOutput.getAbsolutePath();
			s_logger.log(LogLevel.ERROR,msg );
			throw new SchemaExtractionException(msg,e);
		}

		 // Use a Transformer for output
		TransformerFactory tFactory =  TransformerFactory.newInstance();
		Transformer transformer = null;

		try {
			transformer = tFactory.newTransformer();
		} catch (TransformerConfigurationException e) {
			closeOutputStreamSilently(output);
			String msg = "Error while trying to create a transformer : "+ e;
			s_logger.log(LogLevel.ERROR,msg );
			throw new SchemaExtractionException(msg,e);
		}

		DOMSource source = new DOMSource(document);
		StreamResult result = new StreamResult(output);
		try {
			transformer.setOutputProperty(OutputKeys.INDENT, "yes");
			transformer.transform(source, result);
		} catch (TransformerException e) {
			String msg = "Error while trying to transform the schema to a file  : " + e;
			s_logger.log(LogLevel.ERROR,msg );
			throw new SchemaExtractionException(msg,e);
		}finally{
			closeOutputStreamSilently(output);
		}

		if(s_logger.isLogEnabled(LogLevel.INFO))
			s_logger.log(LogLevel.INFO, "file " + fileOutput.getAbsolutePath() + "  successfully written ");

	}

	public static void closeOutputStreamSilently(FileOutputStream output) {

		try {
			if(output != null)
				output.close();
		} catch (IOException e) {
			s_logger.log(LogLevel.WARN, "could not close output stream " + output);
		}

	}

}


text:
import React from 'react'
import { mount } from 'enzyme'
import App, { setupStore, dispatchSpy } from '../../appContainer'
import { userLoggedIn } from 'frontend/actions'
import Header from 'frontend/containers/Header'

describe('Header container', () => {
  const store = setupStore()
  // Mimic user login and basic details
  store.dispatch(userLoggedIn('testUserId', 'test@example.com'))

  const wrapper = mount(
    <App store={store}>
      <Header />
    </App>
  )

  // FIXME: waiting on update
  it('should show the users display name', () => {
    // expect(wrapper.text()).toContain('anonymous')
    expect(true).toBe(true)
  })
})

redpajama_set_name: RedPajamaGithub


text:
require 'nokogiri'

module WikiDb
  class Database
    def get_page title, ignore_case = false
      title = title.gsub('_', ' ')
      puts "Retrieving #{title}..."

      cache_result = WikiDb.cache_get(title, ignore_case)
      puts "Returning cached results for #{title}." unless cache_result.nil?
      return cache_result.dup unless cache_result.nil?

      results = query_for_offsets(title) || []
      puts "Found #{results.count} results."
      match = results.grep(Regexp.new("^#{Regexp.escape title} \\d+$", ignore_case)).first
      if match && match.match(/^(.*) (\d+)$/)
        page_content = get_page_at_offset($2.to_i)
        WikiDb.cache_set($1, page_content)
        return page_content
      else
        return nil
      end
    end

    def search query
      query_for_offsets(query).map { |r| r.match(/^(.*) \d+$/).captures.first }
    end

    private

    def query_for_offsets query
      return nil if WikiDb.index_file.nil?
      File.open(WikiDb.index_file, :external_encoding => "UTF-8") do |index|
        q = title_hash query
        toc_entry = WikiDb.index_toc[q]
        index.seek(toc_entry[:pos], IO::SEEK_SET)
        results = []
        query_downcase = query.downcase
        for i in (0...toc_entry[:length])
          line = index.readline # rescue break
        # while q == title_hash(line = index.readline)
          if line.downcase.start_with? query_downcase
            results << line.chomp
          else
            break if results.count > 0
          end
        end
        return results
      end
    end

    def title_hash s
      b = s[0,3].downcase.bytes.to_a
      ((b[0] || 0) << 16) + ((b[1] || 0) << 8) + (b[2] || 0)
    end

    def find_block_num offset
      low = 0
      high = WikiDb.bzip_table.count
      result = nil
      while result.nil?
        c = low + (high - low) / 2
        b = WikiDb.bzip_table[c]
        if offset < b[:offset]
          high = c
        elsif offset > (b[:offset]+b[:length])
          low = c
        else
          result = c
        end
      end
      c
    end

    def get_block_data block_num, offset=0
      block = WikiDb.bzip_table[block_num]
      block_data = `#{WikiDb.seek_bunzip_cmd} #{block[:block_offset]} < #{WikiDb.wiki_xml_dump}`
      block_data.force_encoding("BINARY")
      if offset > 0
        offset_within_block = (offset - block[:offset])
        return block_data[offset_within_block..-1]
      else
        return block_data
      end
    end

    def get_page_at_offset offset
      block_num = find_block_num(offset)
      page_data = get_block_data(block_num, offset)

      page = nil
      parser = Nokogiri::XML::SAX::PushParser.new(Class.new(Nokogiri::XML::SAX::Document) {
          attr_reader :text
          attr_reader :title

          def done?
            @done || false
          end

          def initialize
            @texty_tags = ['text', 'title']
          end

          def start_element name, attrs = []
            @current_tag = name
            @text_buffer = '' if @texty_tags.include? name
          end

          def characters s
            @text_buffer << s if @texty_tags.include? @current_tag
          end

          def end_element name
            self.instance_variable_set("@#{name}", @text_buffer) if @texty_tags.include? name
            @done = true if name == 'page'
          end
        }.new, 'UTF-8')

      lines = page_data.force_encoding("UTF-8").lines
      until parser.document.done?
        begin
          parser << lines.next
        rescue StopIteration
          page_data = get_block_data(block_num += 1)
          lines = page_data.lines
        end
      end
      parser.finish

      return parser.document.text
    end
  end
end

# puts WikiDB::Database.new.search("Haruhi")


text:
usage() {
    cat <<EOF
The Trogdor fault injector.

Usage:
  $0 [action] [options]

Actions:
  agent: Run the trogdor agent.
  coordinator: Run the trogdor coordinator.
  client: Run the client which communicates with the trogdor coordinator.
  agent-client: Run the client which communicates with the trogdor agent.
  help: This help message.
EOF
}

if [[ $# -lt 1 ]]; then
    usage
    exit 0
fi
action="${1}"
shift
CLASS=""
case ${action} in
    agent) CLASS="org.apache.kafka.trogdor.agent.Agent";;
    coordinator) CLASS="org.apache.kafka.trogdor.coordinator.Coordinator";;
    client) CLASS="org.apache.kafka.trogdor.coordinator.CoordinatorClient";;
    agent-client) CLASS="org.apache.kafka.trogdor.agent.AgentClient";;
    help) usage; exit 0;;
    *)  echo "Unknown action '${action}'.  Type '$0 help' for help."; exit 1;;
esac

export INCLUDE_TEST_JARS=1
exec $(dirname $0)/kafka-run-class.sh "${CLASS}" "$@"


text:
using namespace std;
using namespace various;
using namespace webss;

extern void putTemplateBodyBin(StringBuilder& out, const TheadBin::Params& params, const Tuple& tuple);
static void putBin(StringBuilder& out, const ParamBin& param, const Webss& data);
static void putBin(StringBuilder& out, const ParamBin& param, const Webss& data, function<void(const Webss& webss)> func);
static void putBinElement(StringBuilder& out, const ParamBin::SizeHead& bhead, const Webss& webss);

void putTemplateBodyBin(StringBuilder& out, const TheadBin::Params& params, const Tuple& tuple)
{
	assert(tuple.size() == params.size() && "size of binary tuple must match params");
	decltype(params.size()) i = 0;
	for (const auto& webss : tuple)
	{
		const auto& binary = params[i++];
		if (!binary.getSizeHead().hasDefaultValue())
		{
			assert(!binary.getSizeHead().isTheadSelf());
			putBin(out, binary, webss);
		}
		else if (webss.getTypeRaw() == WebssType::DEFAULT || webss.getTypeRaw() == WebssType::NONE)
			out += CHAR_BIN_DEFAULT_TRUE;
		else
		{
			out += CHAR_BIN_DEFAULT_FALSE;
			if (binary.getSizeHead().isTheadSelf())
				putTemplateBodyBin(out, params, webss.getTuple());
			else
				putBin(out, binary, webss);
		}
	}
}

//returns a string containing a number encoded in UTF-7 encoding thing
static void writeBinSize(StringBuilder& out, WebssBinSize num)
{
	if (num < power2<7>::value)
	{
		out += (char)num;
		return;
	}

#define POWER 7
	int bitShift;
	if (num < power2<POWER * 2>::value)
		bitShift = POWER;
	else if (num < power2<POWER * 3>::value)
		bitShift = POWER * 2;
	else if (num < power2<POWER * 4>::value)
		bitShift = POWER * 3;
	else if (num < power2<POWER * 5>::value)
		bitShift = POWER * 4;
	else if (num < power2<POWER * 6>::value)
		bitShift = POWER * 5;
	else if (num < power2<POWER * 7>::value)
		bitShift = POWER * 6;
	else if (num < power2<POWER * 8>::value)
		bitShift = POWER * 7;
	else if (num < power2<POWER * 9>::value)
		bitShift = POWER * 8;
	else //assumed max 64 bits
		bitShift = POWER * 9;

	do
		out += (char)(0x80 | (num >> bitShift));
	while ((bitShift -= POWER) > 0);

	out += (char)(0x7F & num);
#undef POWER
}

static void writeBytes(StringBuilder& out, WebssBinSize num, char* value)
{
#ifdef WEBSSON_REVERSE_ENDIANNESS
	value += num;
	while (num-- > 0)
		out += *--value;
#else
	while (num-- > 0)
		out += *value++;
#endif
}

static void putBin(StringBuilder& out, const ParamBin& param, const Webss& data)
{
	const auto& sizeHead = param.getSizeHead();
	if (!sizeHead.isTheadBin())
		putBin(out, param, data, [&](const Webss& webss) { putBinElement(out, sizeHead, webss); });
	else
	{
		const auto& params = sizeHead.getThead().getParams();
		putBin(out, param, data, [&](const Webss& webss) { putTemplateBodyBin(out, params, webss.getTuple()); });
	}
}

static void serializeBitList(StringBuilder& out, const List& list)
{
	char c = 0;
	int shift = 0;
	for (const auto& webss : list)
	{
		if (shift == 8)
		{
			out += c;
			shift = c = 0;
		}
		if (webss.getBool())
			c |= 1 << shift;
		++shift;
	}
	out += c;
}

static void putBin(StringBuilder& out, const ParamBin& param, const Webss& data, function<void(const Webss& webss)> func)
{
	if (param.getSizeList().isOne())
	{
		func(data);
		return;
	}

	const auto& list = data.getList();
	if (param.getSizeList().isEmpty())
		writeBinSize(out, list.size());

	if (param.getSizeHead().isBool())
		serializeBitList(out, list);
	else
		for (const auto& webss : list)
			func(webss);
}

static void putBinElement(StringBuilder& out, const ParamBin::SizeHead& bhead, const Webss& webss)
{
	if (bhead.isKeyword())
	{
		union
		{
			WebssInt tInt;
			float tFloat;
			double tDouble;
		};

		switch (bhead.getKeyword())
		{
		case Keyword::BOOL:
			assert(webss.getTypeRaw() == WebssType::PRIMITIVE_BOOL);
			out += webss.getBoolRaw() ? 1 : 0;
			break;
		case Keyword::INT8:
			assert(webss.getTypeRaw() == WebssType::PRIMITIVE_INT);
			out += (char)webss.getIntRaw();
			break;
		case Keyword::INT16:
			assert(webss.getTypeRaw() == WebssType::PRIMITIVE_INT);
			tInt = webss.getIntRaw();
			writeBytes(out, 2, reinterpret_cast<char*>(&tInt));
			break;
		case Keyword::INT32:
			assert(webss.getTypeRaw() == WebssType::PRIMITIVE_INT);
			tInt = webss.getIntRaw();
			writeBytes(out, 4, reinterpret_cast<char*>(&tInt));
			break;
		case Keyword::INT64:
			assert(webss.getTypeRaw() == WebssType::PRIMITIVE_INT);
			tInt = webss.getIntRaw();
			writeBytes(out, 8, reinterpret_cast<char*>(&tInt));
			break;
		case Keyword::FLOAT:
			assert(webss.getTypeRaw() == WebssType::PRIMITIVE_DOUBLE);
			tFloat = static_cast<float>(webss.getDoubleRaw());
			writeBytes(out, 4, reinterpret_cast<char*>(&tFloat));
			break;
		case Keyword::DOUBLE:
			assert(webss.getTypeRaw() == WebssType::PRIMITIVE_DOUBLE);
			tDouble = webss.getDoubleRaw();
			writeBytes(out, 8, reinterpret_cast<char*>(&tDouble));
			break;
		default:
			assert(false);
		}
	}
	else
	{
		assert(webss.getTypeRaw() == WebssType::PRIMITIVE_STRING);
		const auto& s = webss.getStringRaw();
		if (bhead.isEmpty())
			writeBinSize(out, s.length());
#ifndef NDEBUG
		else
			assert(bhead.size() == s.length());
#endif
		out += s;
	}
}


text:
FROM phusion/baseimage
MAINTAINER Federico Carrone <federico.carrone@gmail.com>

# Important!  Update this no-op ENV variable when this Dockerfile
# is updated with the current date. It will force refresh of all
# of the base images and things like `apt-get update` won't be using
# old cached versions when the Dockerfile is built.
ENV REFRESHED_AT 2015-02-12

ENV ERLANG_VERSION R16B03-1
ENV REBAR_VERSION 2.5.1
ENV RELX_VERSION 1.1.0

ENV DEBIAN_FRONTEND noninteractive
ENV HOME /root

RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8

RUN apt-get update

ADD . /build
RUN /build/install.sh

# Leverage the baseimage-docker init system
CMD ["/sbin/my_init"]


text:
CUSequenceAnimation
===================

序列图部分的动画封装,从plist中读取配置

#install

将podspec文件手动copy到cocoapod目录

	pod 'CUSequenceAnimation', '~>1.0'

或是

	pod 'CUSequenceAnimation', :git => 'https://github.com/studentdeng/CUSequenceAnimation'

#use

将每一个动画逻辑封装在一个子类中

	#import "CUAnimationManager.h"

	@interface MainBGCUAnimationManager : CUAnimationManager

	+ (CUAnimationManager *)managerWithImageView:(UIImageView *)imageView;

	@end

	@implementation MainBGCUAnimationManager

	+ (CUAnimationManager *)managerWithImageView:(UIImageView *)imageView
	{
    	CUAnimationManager *manager =
    	[CUAnimationManager animationSequenceWithBasename:@"main_bg"
                                        UIImageView:imageView
                                           andBegin:0
                                             andEnd:44
                                            andRate:24];
    	return manager;
	}

	@end


text:
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Threading.Tasks;
using Newtonsoft.Json;

namespace CloudStack.Net
{
    public class CreateConditionRequest : APIRequest
    {
        public CreateConditionRequest() : base("createCondition") {}

        /// <summary>
        /// ID of the Counter.
        /// </summary>
        public Guid CounterId {
            get { return GetParameterValue<Guid>(nameof(CounterId).ToLower()); }
            set { SetParameterValue(nameof(CounterId).ToLower(), value); }
        }

        /// <summary>
        /// Relational Operator to be used with threshold.
        /// </summary>
        public string RelationalOperator {
            get { return GetParameterValue<string>(nameof(RelationalOperator).ToLower()); }
            set { SetParameterValue(nameof(RelationalOperator).ToLower(), value); }
        }

        /// <summary>
        /// Threshold value.
        /// </summary>
        public long Threshold {
            get { return GetParameterValue<long>(nameof(Threshold).ToLower()); }
            set { SetParameterValue(nameof(Threshold).ToLower(), value); }
        }

        /// <summary>
        /// the account of the condition. Must be used with the domainId parameter.
        /// </summary>
        public string Account {
            get { return GetParameterValue<string>(nameof(Account).ToLower()); }
            set { SetParameterValue(nameof(Account).ToLower(), value); }
        }

        /// <summary>
        /// the domain ID of the account.
        /// </summary>
        public Guid? DomainId {
            get { return GetParameterValue<Guid?>(nameof(DomainId).ToLower()); }
            set { SetParameterValue(nameof(DomainId).ToLower(), value); }
        }

    }
    /// <summary>
    /// Creates a condition
    /// </summary>
    public partial interface ICloudStackAPIClient
    {
        AsyncJobResponse CreateCondition(CreateConditionRequest request);
        Task<AsyncJobResponse> CreateConditionAsync(CreateConditionRequest request);
    }
    public partial class CloudStackAPIClient : ICloudStackAPIClient
    {
        public AsyncJobResponse CreateCondition(CreateConditionRequest request) => Proxy.Request<AsyncJobResponse>(request);
        public Task<AsyncJobResponse> CreateConditionAsync(CreateConditionRequest request) => Proxy.RequestAsync<AsyncJobResponse>(request);
    }
}


text:
function Get-DbaClusterNode {
    <#
        .SYNOPSIS
            Returns the node(s) of a SQL Cluster.

        .DESCRIPTION
            Returns the name of the current node(s) in the SQL Server cluster.

            If the -ActiveNode Parameter is passed it only returns the name of the Server currently hosting the clustered instance.

        .PARAMETER SqlInstance
            Specifies the SQL Server clustered instance to check.

        .PARAMETER SqlCredential
            Login to the target instance using alternative credentials. Windows and SQL Authentication supported. Accepts credential objects (Get-Credential)

        .PARAMETER ActiveNode
            If this parameter is selected the cmdlet will only return the Active Node in the cluster.

        .PARAMETER Detailed
            Output all properties, will be deprecated in 1.0.0 release.

        .PARAMETER EnableException
            By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
            This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
            Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.

        .NOTES
            Tags: Cluster, WSFC, FCI
            Website: https://dbatools.io
            Copyright: (C) Chrissy LeMaire, clemaire@gmail.com
            License: MIT https://opensource.org/licenses/MIT

        .LINK
            https://dbatools.io/Get-DbaClusterNode

        .EXAMPLE
            Get-DbaClusterNode -SqlInstance sqlcluster

            Returns all nodes in the cluster and details about each node.

        .EXAMPLE
            Get-DbaClusterNode -SqlInstance sqlcluster -ActiveNode

            Returns the name of the active node in the cluster

    #>
    param (
        [parameter(Mandatory = $true, ValueFromPipeline = $true)]
        [Alias("ServerInstance", "SqlServer")]
        [DbaInstanceParameter]$SqlInstance,
        [PSCredential]$SqlCredential,
        [switch]$ActiveNode,
        [switch]$Detailed,
        [alias('Silent')]
        [switch]$EnableException
    )

    begin {
        Test-DbaDeprecation -DeprecatedOn 1.0.0 -Parameter Detailed
        Test-DbaDeprecation -DeprecatedOn 1.0.0 -Alias Get-DbaClusterActiveNode
        $server = Connect-SqlInstance -SqlInstance $SqlInstance -SqlCredential $SqlCredential -MinimumVersion 10
    }

    process {
        if ($server.IsClustered -eq $false) {
            Stop-Function -Message "Not a clusterd instance." -Category ConnectionError -ErrorRecord $_ -Target $SqlInstance -Continue
        }

        # If the -ActiveNode switch is selected only the primary node is returned.
        if ($ActiveNode) {
            try {
                $sql = "SELECT * FROM sys.dm_os_cluster_nodes where is_current_owner = 1"
                $datatable = $server.query($sql)

                [PSCustomObject]@{
                    ComputerName      = $datatable.nodename
                    InstanceName      = $server.ServiceName
                    SqlInstance       = $server.DomainInstanceName
                    Status            = $datatable.Status
                    StatusDescription = $datatable.StatusDescription
                    CurrentOwner      = $datatable.is_current_owner
                } | Select-DefaultView -Property ComputerName
            }
            catch {
                Stop-Function -Message "Unable to query sys.dm_os_cluster_nodes on $server." -ErrorRecord $_ -Target $SqlInstance -Continue
            }
        }
        #Default Execution of this function
        else {
            try {
                $sql = "SELECT * FROM sys.dm_os_cluster_nodes"
                $datatable = $server.query($sql)

                foreach ($data in $datatable) {
                    [PSCustomObject]@{
                        ComputerName      = $data.nodename
                        InstanceName      = $server.ServiceName
                        SqlInstance       = $server.DomainInstanceName
                        Status            = $data.Status
                        StatusDescription = $data.StatusDescription
                        CurrentOwner      = $data.is_current_owner
                    } | Select-DefaultView -Property ComputerName, InstanceName, SqlInstance, StatusDescription, CurrentOwner
                }
            }
            catch {
                Stop-Function -Message "Unable to query sys.dm_os_cluster_nodes on $server." -ErrorRecord $_ -Target $SqlInstance -Continue
            }
        }
    }
}


text:
#include "pegr/gensys/Events.hpp"

#include "pegr/engine/Engine.hpp"

namespace pegr {
namespace Gensys {
namespace Event {

Entity_Spawned_Event* n_spawned;
Entity_Tick_Event* n_tick;
Entity_Killed_Event* n_killed;

Entity_Spawned_Event* get_entity_spawned_event() {
    return n_spawned;
}
Entity_Tick_Event* get_entity_tick_event() {
    return n_tick;
}
Entity_Killed_Event* get_entity_killed_event() {
    return n_killed;
}

template<typename Event_T>
Event_T* reg_event(const char* name) {
    return static_cast<Event_T*>(Schedu::add_event(name,
                std::make_unique<Event_T>()));
}

void initialize() {
    n_spawned = reg_event<Entity_Spawned_Event>("entity_spawned.ev");
    n_tick = reg_event<Entity_Tick_Event>("entity_tick.ev");
    n_killed = reg_event<Entity_Killed_Event>("entity_killed.ev");
}

void cleanup() {
    Entity_Spawned_Event* n_spawned = nullptr;
    Entity_Tick_Event* n_tick = nullptr;
    Entity_Killed_Event* n_killed = nullptr;
}

} // namespace Events
} // namespace Gensys
} // namespace pegr


text:
void
Gogo::function_backend_name(const std::string& go_name,
			    const Package* package, const Type* rtype,
			    Backend_name* bname)
{
  if (rtype != NULL)
    rtype->deref()->backend_name(this, bname);
  else if (package == NULL)
    bname->add(this->pkgpath());
  else
    bname->add(package->pkgpath());

  size_t pos = Gogo::special_name_pos(go_name);
  if (pos == std::string::npos)
    bname->add(Gogo::unpack_hidden_name(go_name));
  else
    {
      if (pos > 0)
	bname->add(go_name.substr(0, pos));
      bname->set_suffix(go_name.substr(pos));
    }
}

// Set BNAME to the name to use for a function descriptor.  These
// symbols are globally visible.

void
Gogo::function_descriptor_backend_name(Named_object* no,
				       Backend_name* bname)
{
  if (no->is_function())
    no->func_value()->backend_name(this, no, bname);
  else if (no->is_function_declaration())
    no->func_declaration_value()->backend_name(this, no, bname);
  else
    go_unreachable();
  bname->append_suffix("..f");
}

// Return the name to use for a generated stub method.  A stub method
// is used as the method table entry for a promoted method of an
// embedded type.  MNAME is the method name.  PACKAGE is the package
// where the type that needs this stub method is defined.  These
// functions are globally visible.
//
// This returns a name that acts like a Go identifier, as though the
// stub method were written in Go as an explicitly defined method that
// simply calls the promoted method.  The name we return here will
// eventually be passed to function_backend_name, which will return a
// name that includes the receiver type.
//
// We construct a unique method name and append "..stub".
// function_backend_name will look for the "..stub" and turn that into
// an unencoded suffix.  The rest of the name will be encoded as
// usual.

std::string
Gogo::stub_method_name(const Package* package, const std::string& mname)
{
  if (!Gogo::is_hidden_name(mname))
    return mname + "..stub";

  const std::string& ppkgpath(package == NULL
			      ? this->pkgpath()
			      : package->pkgpath());
  std::string mpkgpath = Gogo::hidden_name_pkgpath(mname);
  if (mpkgpath == ppkgpath)
    return Gogo::unpack_hidden_name(mname) + "..stub";

  // We are creating a stub method for an unexported method of an
  // imported embedded type.  A single type can have multiple promoted
  // methods with the same unexported name, if it embeds types from
  // different packages.  We need to disambiguate the method name.
  // This produces an unambiguous name because even though MPKGPATH
  // can be anything, we know that MNAME does not contain a dot.  The
  // dot we return here, between MPKGPATH and MNAME, will wind up
  // being underscore encoded.
  std::string ret(mpkgpath);
  ret.push_back('.');
  ret.append(Gogo::unpack_hidden_name(mname));
  ret.append("..stub");
  return ret;
}

// Set BNAME to the name of the hash function for TYPE.

void
Gogo::hash_function_name(const Type* type, Backend_name* bname)
{
  if (type->named_type() != NULL)
    type->backend_name(this, bname);
  else
    {
      bname->add(this->pkgpath());
      type->backend_name(this, bname);
    }
  bname->set_suffix("..hash");
}

// Set BNAME to the name of the equal function for TYPE.  If NAME is
// not NULL it is the name of the type.

void
Gogo::equal_function_name(const Type* type, const Named_type* name,
			  Backend_name* bname)
{
  if (name != NULL)
    name->backend_name(this, bname);
  else
    {
      bname->add(this->pkgpath());
      type->backend_name(this, bname);
    }
  bname->set_suffix("..eq");
}

// Set BNAME to the name to use for a global variable.  GO_NAME is the
// name that appears in the Go code.  PACKAGE is the package where the
// variable is defined, and is NULL for the package being compiled.

void
Gogo::global_var_backend_name(const std::string& go_name,
			      const Package* package,
			      Backend_name* bname)
{
  if (package == NULL)
    bname->add(this->pkgpath());
  else
    bname->add(package->pkgpath());
  bname->add(Gogo::unpack_hidden_name(go_name));
}

// Return an erroneous name that indicates that an error has already
// been reported.  This name will act like a Go identifier.

std::string
Gogo::erroneous_name()
{
  go_assert(saw_errors());
  static int erroneous_count;
  char name[50];
  snprintf(name, sizeof name, ".erroneous%d", erroneous_count);
  ++erroneous_count;
  return name;
}

// Return whether a name is an erroneous name.

bool
Gogo::is_erroneous_name(const std::string& name)
{
  return name.compare(0, 10, ".erroneous") == 0;
}

// Return a name for a thunk object.  This name will act like a Go
// identifier.  The name returned here will eventually be passed to
// function_backend_name, which will pull off the ..thunk as an
// unencoded suffix.

std::string
Gogo::thunk_name()
{
  static int thunk_count;
  char thunk_name[50];
  snprintf(thunk_name, sizeof thunk_name, "..thunk%d", thunk_count);
  ++thunk_count;
  // We don't want to return a name that starts with a dot, as that
  // will confuse Gogo::is_hidden_name.  And we don't want to change
  // ..thunk, which fits our general theme and is used by code like
  // runtime.Callers.  But the prefix doesn't matter, as the actual
  // name will include the package path.
  std::string ret = "go";
  return ret + thunk_name;
}

// Return whether a function is a thunk.

bool
Gogo::is_thunk(const Named_object* no)
{
  const std::string& name(no->name());
  size_t i = name.rfind("..thunk");
  if (i == std::string::npos)
    return false;
  return Gogo::is_digits(name.substr(i + 7));
}

// Return the name to use for an init function.  There can be multiple
// functions named "init" so each one needs a different name.

std::string
Gogo::init_function_name()
{
  static int init_count;
  char buf[30];
  snprintf(buf, sizeof buf, "..init%d", init_count);
  ++init_count;
  return this->pkgpath() + buf;
}

// Return the name to use for a nested function.  This name acts like
// a Go identifier.  This name will be rewritten by
// Function::backend_name.

std::string
Gogo::nested_function_name(Named_object* enclosing)
{
  std::string prefix;
  unsigned int index;
  if (enclosing == NULL)
    {
      // A function literal at top level, as in
      // var f = func() {}
      static unsigned int toplevel_index;
      ++toplevel_index;
      index = toplevel_index;
      prefix = ".go";
    }
  else
    {
      while (true)
	{
	  Named_object* parent = enclosing->func_value()->enclosing();
	  if (parent == NULL)
	    break;
	  enclosing = parent;
	}
      const Typed_identifier* rcvr =
	enclosing->func_value()->type()->receiver();
      if (rcvr != NULL)
	{
	  Backend_name bname;
	  rcvr->type()->backend_name(this, &bname);
	  prefix = bname.name();
	  prefix.push_back('.');
	}
      prefix.append(Gogo::unpack_hidden_name(enclosing->name()));
      index = enclosing->func_value()->next_nested_function_index();
    }
  char buf[30];
  snprintf(buf, sizeof buf, "..func%u", index);
  return prefix + buf;
}

// Return the name to use for a sink function, a function whose name
// is simply underscore.  We don't really need these functions but we
// do have to generate them for error checking.

std::string
Gogo::sink_function_name()
{
  static int sink_count;
  char buf[30];
  snprintf(buf, sizeof buf, ".sink%d", sink_count);
  ++sink_count;
  return buf;
}

// Return the name to use for a redefined function.  These functions
// are erroneous but we still generate them for further error
// checking.

std::string
Gogo::redefined_function_name()
{
  static int redefinition_count;
  char buf[30];
  snprintf(buf, sizeof buf, ".redefined%d", redefinition_count);
  ++redefinition_count;
  return buf;
}

// Return the name to use for a recover thunk for the function NAME.
// If the function is a method, RTYPE is the receiver type.  This is a
// name that acts like a Go identifier.

std::string
Gogo::recover_thunk_name(const std::string& name, const Type* rtype)
{
  std::string ret;
  if (rtype != NULL)
    {
      Backend_name bname;
      rtype->deref()->backend_name(this, &bname);
      ret = bname.name();
      ret.append(1, '.');
    }
  if (Gogo::special_name_pos(name) != std::string::npos)
    ret.append(name);
  else
    ret.append(Gogo::unpack_hidden_name(name));
  ret.append("..r");
  return ret;
}

// Return the name to use for a GC root variable.  The GC root
// variable is a composite literal that is passed to
// runtime.registerGCRoots.  There is at most one of these variables
// per compilation.

std::string
Gogo::gc_root_name()
{
  return "go..C0";
}

// Return the name to use for a composite literal or string
// initializer.  This is a local name never referenced outside of this
// file.

std::string
Gogo::initializer_name()
{
  static unsigned int counter;
  char buf[30];
  ++counter;
  snprintf(buf, sizeof buf, "go..C%u", counter);
  return buf;
}

// Return the assembler name of the variable used to represent the
// zero value of a map.  This is a globally visible common symbol.

std::string
Gogo::map_zero_value_name()
{
  return "go..zerovalue";
}

// Return the name to use for the import control function.  This name
// is handled specially by Function::backend_name.  It is not encoded
// further.

const std::string&
Gogo::get_init_fn_name()
{
  if (this->init_fn_name_.empty())
    {
      go_assert(this->package_ != NULL);
      if (this->is_main_package())
	{
	  // Use a name that the runtime knows.
	  this->init_fn_name_ = "__go_init_main";
	}
      else
	{
	  std::string s = this->pkgpath_symbol();
	  s.append("..import");
	  this->init_fn_name_ = s;
	}
    }

  return this->init_fn_name_;
}

// Return the name for a dummy init function, which is not a real
// function but only for tracking transitive import.

std::string
Gogo::dummy_init_fn_name()
{
  return "~" + this->pkgpath_symbol();
}

// Return the package path symbol from an init function name, which
// can be a real init function or a dummy one.

std::string
Gogo::pkgpath_symbol_from_init_fn_name(std::string name)
{
  go_assert(!name.empty());
  if (name[0] == '~')
    return name.substr(1);
  size_t pos = name.find("..import");
  if (pos != std::string::npos)
    return name.substr(0, pos);
  go_unreachable();
}

// Set BNAME to a name for a type to use in a symbol.  Return a name
// for a type to use in a symbol.  These names appear in symbol names
// in the assembler file for things like type descriptors and methods.

void
Type::backend_name(Gogo* gogo, Backend_name* bname) const
{
  // Special case top level named types to get nicer name encodings
  // for this common case.
  const Named_type* nt = this->unalias()->named_type();
  if (nt != NULL && !nt->is_builtin())
    {
      unsigned int index;
      if (nt->in_function(&index) == NULL)
	{
	  const Named_object* no = nt->named_object();
	  if (no->package() == NULL)
	    bname->add(gogo->pkgpath());
	  else
	    bname->add(no->package()->pkgpath());
	  bname->add(Gogo::unpack_hidden_name(no->name()));
	  return;
	}
    }

  std::string name;
  bool is_non_identifier = false;

  // The do_symbol_name virtual function will set RET to the mangled
  // name before encoding.
  this->do_mangled_name(gogo, &name, &is_non_identifier);

  bname->add(name);
  if (is_non_identifier)
    bname->set_is_non_identifier();
}

// The mangled name is implemented as a method on each instance of
// Type.

void
Error_type::do_mangled_name(Gogo*, std::string* ret,
			    bool* is_non_identifier) const
{
  ret->append("{error}");
  *is_non_identifier = true;
}

void
Void_type::do_mangled_name(Gogo*, std::string* ret,
			   bool* is_non_identifier) const
{
  ret->append("{void}");
  *is_non_identifier = true;
}

void
Boolean_type::do_mangled_name(Gogo*, std::string* ret, bool*) const
{
  ret->append("bool");
}

void
Integer_type::do_mangled_name(Gogo*, std::string* ret,
			      bool* is_non_identifier) const
{
  char buf[100];
  snprintf(buf, sizeof buf, "%s%si%d",
	   this->is_abstract_ ? "{abstract}" : "",
	   this->is_unsigned_ ? "u" : "",
	   this->bits_);
  ret->append(buf);
  if (this->is_abstract_)
    *is_non_identifier = true;
}

void
Float_type::do_mangled_name(Gogo*, std::string* ret,
			    bool* is_non_identifier) const
{
  char buf[100];
  snprintf(buf, sizeof buf, "%sfloat%d",
	   this->is_abstract_ ? "{abstract}" : "",
	   this->bits_);
  ret->append(buf);
  if (this->is_abstract_)
    *is_non_identifier = true;
}

void
Complex_type::do_mangled_name(Gogo*, std::string* ret,
			      bool* is_non_identifier) const
{
  char buf[100];
  snprintf(buf, sizeof buf, "%sc%d",
	   this->is_abstract_ ? "{abstract}" : "",
	   this->bits_);
  ret->append(buf);
  if (this->is_abstract_)
    *is_non_identifier = true;
}

void
String_type::do_mangled_name(Gogo*, std::string* ret, bool*) const
{
  ret->append("string");
}

void
Function_type::do_mangled_name(Gogo* gogo, std::string* ret,
			       bool* is_non_identifier) const
{
  ret->append("func");

  if (this->receiver_ != NULL)
    {
      ret->push_back('(');
      this->append_mangled_name(this->receiver_->type(), gogo, ret,
				is_non_identifier);
      ret->append(")");
    }

  ret->push_back('(');
  const Typed_identifier_list* params = this->parameters();
  if (params != NULL)
    {
      bool first = true;
      for (Typed_identifier_list::const_iterator p = params->begin();
	   p != params->end();
	   ++p)
	{
	  if (first)
	    first = false;
	  else
	    ret->push_back(',');
	  if (this->is_varargs_ && p + 1 == params->end())
	    ret->append("...");
	  this->append_mangled_name(p->type(), gogo, ret,
				    is_non_identifier);
	}
    }
  ret->push_back(')');

  ret->push_back('(');
  const Typed_identifier_list* results = this->results();
  if (results != NULL)
    {
      bool first = true;
      for (Typed_identifier_list::const_iterator p = results->begin();
	   p != results->end();
	   ++p)
	{
	  if (first)
	    first = false;
	  else
	    ret->append(",");
	  this->append_mangled_name(p->type(), gogo, ret, is_non_identifier);
	}
    }
  ret->push_back(')');

  *is_non_identifier = true;
}

void
Pointer_type::do_mangled_name(Gogo* gogo, std::string* ret,
			      bool* is_non_identifier) const
{
  ret->push_back('*');
  this->append_mangled_name(this->to_type_, gogo, ret, is_non_identifier);
  *is_non_identifier = true;
}

void
Nil_type::do_mangled_name(Gogo*, std::string* ret,
			  bool* is_non_identifier) const
{
  ret->append("{nil}");
  *is_non_identifier = true;
}

void
Struct_type::do_mangled_name(Gogo* gogo, std::string* ret,
			     bool* is_non_identifier) const
{
  ret->append("struct{");

  if (this->is_struct_incomparable_)
    ret->append("{x}");

  const Struct_field_list* fields = this->fields_;
  if (fields != NULL)
    {
      bool first = true;
      for (Struct_field_list::const_iterator p = fields->begin();
	   p != fields->end();
	   ++p)
	{
	  if (first)
	    first = false;
	  else
	    ret->push_back(';');

	  if (!p->is_anonymous())
	    {
              Gogo::append_possibly_hidden_name(ret, p->field_name());
	      ret->push_back(' ');
	    }

	  const Type* ft = p->type();
	  const Named_type* nt = ft->named_type();

	  if (p->is_anonymous() && nt != NULL && nt->is_builtin())
	    {
	      // For an embedded field with a builtin type, we must
	      // include a package path.  Otherwise embedding builtin
	      // types in different packages will produce identical
	      // types, which shouldn't happen because the builtin
	      // types are not exported.
	      ret->append(gogo->pkgpath());
	      ret->push_back('.');
	      nt->append_symbol_type_name(gogo, true, ret, is_non_identifier);
	    }
	  else if (p->is_anonymous() && nt != NULL && nt->is_alias())
	    {
	      // For an anonymous field with an alias type, the field name
	      // is the alias name.
	      nt->append_symbol_type_name(gogo, true, ret, is_non_identifier);
	    }
	  else
	    this->append_mangled_name(ft, gogo, ret, is_non_identifier);

	  if (p->has_tag())
	    {
	      // Use curly braces around a struct tag, since they are
	      // unambiguous here and struct tags rarely contain curly
	      // braces.
	      ret->push_back('{');
	      ret->append(go_mangle_struct_tag(p->tag()));
	      ret->push_back('}');
	    }
	}
    }

  ret->push_back('}');

  *is_non_identifier = true;
}

void
Array_type::do_mangled_name(Gogo* gogo, std::string* ret,
			    bool* is_non_identifier) const
{
  ret->push_back('[');
  if (this->length_ != NULL)
    {
      Numeric_constant nc;
      if (!this->length_->numeric_constant_value(&nc))
	{
	  go_assert(saw_errors());
	  return;
	}
      mpz_t val;
      if (!nc.to_int(&val))
	{
	  go_assert(saw_errors());
	  return;
	}
      char *s = mpz_get_str(NULL, 10, val);
      ret->append(s);
      free(s);
      mpz_clear(val);
      if (this->is_array_incomparable_)
	ret->append("x");
    }
  ret->push_back(']');
  this->append_mangled_name(this->element_type_, gogo, ret, is_non_identifier);
  *is_non_identifier = true;
}

void
Map_type::do_mangled_name(Gogo* gogo, std::string* ret,
			  bool* is_non_identifier) const
{
  ret->append("map[");
  this->append_mangled_name(this->key_type_, gogo, ret, is_non_identifier);
  ret->push_back(']');
  this->append_mangled_name(this->val_type_, gogo, ret, is_non_identifier);
  *is_non_identifier = true;
}

void
Channel_type::do_mangled_name(Gogo* gogo, std::string* ret,
			      bool* is_non_identifier) const
{
  if (!this->may_send_)
    ret->append("<-");
  ret->append("chan");
  if (!this->may_receive_)
    ret->append("<-");
  ret->push_back(' ');
  this->append_mangled_name(this->element_type_, gogo, ret, is_non_identifier);
  *is_non_identifier = true;
}

void
Interface_type::do_mangled_name(Gogo* gogo, std::string* ret,
				bool* is_non_identifier) const
{
  go_assert(this->methods_are_finalized_);

  ret->append("interface{");

  const Typed_identifier_list* methods = this->all_methods_;
  if (methods != NULL && !this->seen_)
    {
      this->seen_ = true;
      bool first = true;
      for (Typed_identifier_list::const_iterator p = methods->begin();
	   p != methods->end();
	   ++p)
	{
	  if (first)
	    first = false;
	  else
	    ret->push_back(';');

	  if (!p->name().empty())
	    {
              Gogo::append_possibly_hidden_name(ret, p->name());
	      ret->push_back(' ');
	    }

	  this->append_mangled_name(p->type(), gogo, ret, is_non_identifier);
	}
      this->seen_ = false;
    }

  ret->push_back('}');

  *is_non_identifier = true;
}

void
Named_type::do_mangled_name(Gogo* gogo, std::string* ret,
			    bool* is_non_identifier) const
{
  this->append_symbol_type_name(gogo, false, ret, is_non_identifier);
}

void
Forward_declaration_type::do_mangled_name(Gogo* gogo, std::string* ret,
					  bool *is_non_identifier) const
{
  if (this->is_defined())
    this->append_mangled_name(this->real_type(), gogo, ret, is_non_identifier);
  else
    {
      const Named_object* no = this->named_object();
      if (no->package() == NULL)
	ret->append(gogo->pkgpath());
      else
	ret->append(no->package()->pkgpath());
      ret->push_back('.');
      ret->append(Gogo::unpack_hidden_name(no->name()));
    }
}

// Append the symbol name for a named type to RET.  For an alias we
// normally use the real name, but if USE_ALIAS is true we use the
// alias name itself.

void
Named_type::append_symbol_type_name(Gogo* gogo, bool use_alias,
				    std::string* ret,
				    bool* is_non_identifier) const
{
  if (this->is_error_)
    return;
  if (this->is_alias_ && !use_alias)
    {
      if (this->seen_alias_)
	return;
      this->seen_alias_ = true;
      this->append_mangled_name(this->type_, gogo, ret, is_non_identifier);
      this->seen_alias_ = false;
      return;
    }
  Named_object* no = this->named_object_;
  std::string name;
  if (this->is_builtin())
    go_assert(this->in_function_ == NULL);
  else
    {
      if (this->in_function_ != NULL)
	{
	  const Typed_identifier* rcvr =
	    this->in_function_->func_value()->type()->receiver();
	  if (rcvr != NULL)
	    {
	      Backend_name bname;
	      rcvr->type()->deref()->backend_name(gogo, &bname);
	      ret->append(bname.name());
	      if (bname.is_non_identifier())
		*is_non_identifier = true;
	    }
	  else if (this->in_function_->package() == NULL)
	    ret->append(gogo->pkgpath());
	  else
	    ret->append(this->in_function_->package()->pkgpath());
	  ret->push_back('.');
	  ret->append(Gogo::unpack_hidden_name(this->in_function_->name()));
	}
      else
	{
	  if (no->package() == NULL)
	    ret->append(gogo->pkgpath());
	  else
	    ret->append(no->package()->pkgpath());
	}
      ret->push_back('.');
    }

  ret->append(Gogo::unpack_hidden_name(no->name()));

  if (this->in_function_ != NULL && this->in_function_index_ > 0)
    {
      char buf[30];
      snprintf(buf, sizeof buf, ".i%u", this->in_function_index_);
      ret->append(buf);
    }
}

// Given a name which may or may not have been hidden, append the
// appropriate version of the name to the result string.

void
Gogo::append_possibly_hidden_name(std::string *result, const std::string& name)
{
  if (!Gogo::is_hidden_name(name))
    *result += name;
  else
    *result += name.substr(1);
}

// Set BNAME to the name for the type descriptor symbol for TYPE.
// This can be a global, common, or local symbol, depending.  NT is
// not NULL if it is the name to use.

void
Gogo::type_descriptor_backend_name(const Type* type, Named_type* nt,
				   Backend_name* bname)
{
  // The type descriptor symbol for the unsafe.Pointer type is defined
  // in libgo/runtime/go-unsafe-pointer.c, so just use a reference to
  // that symbol for all unsafe pointer types.
  if (type->is_unsafe_pointer_type())
    {
      bname->set_asm_name("unsafe.Pointer..d");
      return;
    }

  bool is_pointer = false;
  if (nt == NULL && type->points_to() != NULL)
    {
      nt = type->points_to()->unalias()->named_type();
      is_pointer = true;
    }

  if (nt == NULL)
    {
      // Sanity check: we should never generate a type descriptor for
      // an unnamed primitive type.  For those we should always be
      // using a named type, like "int".
      go_assert(!type->is_basic_type());

      type->backend_name(this, bname);
      bname->set_prefix("type..");
    }
  else
    {
      nt->backend_name(this, bname);
      bname->set_suffix(is_pointer ? "..p" : "..d");
    }
}

// Return the name of the type descriptor list symbol of a package.
// This is passed directly to the backend without further encoding.

std::string
Gogo::type_descriptor_list_symbol(const std::string& pkgpath_symbol)
{
  return pkgpath_symbol + "..types";
}

// Return the name of the list of all type descriptor lists.  This is
// only used in the main package.  This is passed directly to the
// backend without further encoding.

std::string
Gogo::typelists_symbol()
{
  return "go..typelists";
}

// Return the assembler name for the GC symbol for a type.  This is
// used to initialize the gcdata field of a type descriptor.  This is
// a local name never referenced outside of this assembly file.  (Note
// that some type descriptors will initialize the gcdata field with a
// name generated by ptrmask_symbol_name rather than this method.)
// This is passed directly to the backend without further encoding.

std::string
Gogo::gc_symbol_name(Type* type)
{
  Backend_name bname;
  this->type_descriptor_backend_name(type, type->named_type(), &bname);
  bname.append_suffix("..g");
  return bname.asm_name();
}

// Return the assembler name for a ptrmask variable.  PTRMASK_SYM_NAME
// is a base32 string encoding the ptrmask (as returned by
// Ptrmask::symname in types.cc).  This name is used to intialize the
// gcdata field of a type descriptor.  These names are globally
// visible.  (Note that some type descriptors will initialize the
// gcdata field with a name generated by gc_symbol_name rather than
// this method.)  This is passed directly to the backend without
// further encoding.

std::string
Gogo::ptrmask_symbol_name(const std::string& ptrmask_sym_name)
{
  return "gcbits.." + ptrmask_sym_name;
}

// Return the assembler name to use for an interface method table used
// for the ordinary type TYPE converted to the interface type ITYPE.
// IS_POINTER is true if this is for the method set for a pointer
// receiver.  This is passed directly to the backend without further
// encoding.

std::string
Gogo::interface_method_table_name(Interface_type* itype, Type* type,
				  bool is_pointer)
{
  Backend_name iname;
  itype->backend_name(this, &iname);
  Backend_name tname;
  type->backend_name(this, &tname);
  return ((is_pointer ? "pimt.." : "imt..")
	  + iname.asm_name()
	  + ".."
	  + tname.asm_name());
}

// If NAME is a special name with a ".." suffix, return the position
// of that suffix.  This is needed because various special names use
// "..SUFFIX", but unpack_hidden_name just looks for '.', and because
// we don't want to encode the suffix.

size_t
Gogo::special_name_pos(const std::string& name)
{
  size_t pos = name.rfind("..");
  if (pos == std::string::npos)
    return pos;
  std::string suffix(name.substr(pos));
  if (suffix == "..hash"
      || suffix == "..eq"
      || suffix == "..stub"
      || suffix == "..d"
      || suffix == "..f"
      || suffix == "..r"
      || suffix == "..import")
    return pos;
  if ((suffix.compare(2, 4, "func") == 0
       || suffix.compare(2, 4, "init") == 0)
      && Gogo::is_digits(suffix.substr(6)))
    return pos;
  if (suffix.compare(2, 5, "thunk") == 0
      && Gogo::is_digits(suffix.substr(7)))
    return pos;
  return std::string::npos;
}

// Return whether the string is non-empty and contains only digits.

bool
Gogo::is_digits(const std::string& s)
{
  if (s.empty())
    return false;
  for (size_t i = 0; i < s.size(); ++i)
    if (s[i] < '0' || s[i] > '9')
      return false;
  return true;
}

// Class Backend_name.

// Get the user visible name.

std::string
Backend_name::name() const
{
  if (this->is_asm_name_)
    return this->components_[0];

  // If there is some character in the name that can't appear in an
  // identifier, use the assembler name as the user name.  This avoids
  // possible problems in the assembler or debugger.  The usual
  // demangling scheme will still work.  We use a prefix of "g." to
  // tell the debugger about this.
  if (this->is_non_identifier_)
    return "g." + this->asm_name();

  std::string ret;
  if (this->prefix_ != NULL)
    ret.append(this->prefix_);
  for (int i = 0; i < this->count_; i++)
    {
      if (i > 0)
	ret.push_back('.');
      ret.append(this->components_[i]);
    }
  if (!this->suffix_.empty())
    ret.append(this->suffix_);
  return ret;
}

// Get the assembler name.

std::string
Backend_name::asm_name() const
{
  if (this->is_asm_name_)
    return this->components_[0];
  std::string ret;
  if (this->prefix_ != NULL)
    ret.append(this->prefix_);
  for (int i = 0; i < this->count_; i++)
    {
      if (i > 0)
	ret.push_back('.');
      ret.append(go_encode_id(this->components_[i]));
    }
  if (!this->suffix_.empty())
    ret.append(this->suffix_);
  return ret;
}

// Get the assembler name, or the empty string if it is the same as
// the user visible name.

std::string
Backend_name::optional_asm_name() const
{
  if (this->is_asm_name_)
    return "";
  if (this->is_non_identifier_)
    return this->asm_name();
  for (int i = 0; i < this->count_; i++)
    if (go_id_needs_encoding(this->components_[i]))
      return this->asm_name();
  return "";
}


text:
from oriskami.test.helper import (
    OriskamiApiTestCase, MyDeletable
)

class DeletableAPIResourceTests(OriskamiApiTestCase):

    def test_delete(self):
        self.mock_response({'id': 'mid', 'deleted': True})

        obj = MyDeletable.construct_from({'resource_id': 'mid'}, 'mykey')
        obj = obj.delete(resource_id='mid')

        self.assertEqual(True, obj.deleted)
        self.assertEqual('mid', obj.id)


text:
from django.contrib.auth.models import User
from django.db import models
from django.db.models import permalink
from django.utils.translation import ugettext_lazy as _

class Blog(models.Model):
    class Meta:
        verbose_name = _('博客')
        verbose_name_plural = _('博客')

    title = models.CharField(max_length=30, unique=True, verbose_name=_('标题'), help_text='博客的标题')
    author = models.ForeignKey(User, verbose_name=_('作者'))
    slug = models.SlugField(max_length=50, unique=True, verbose_name=_('URL'))
    body = models.TextField(verbose_name=_('正文'))
    posted = models.DateField(db_index=True, auto_now_add=True)

    def __str__(self):
        return '%s' % (self.title)

    @permalink
    def get_absolute_url(self):
        return 'blog_view', None, {'slug': self.slug}


text:
Router.configure({
  layoutTemplate: 'layout'
});

Meteor.startup(function () {
  if (Meteor.isClient) {
    var location = Iron.Location.get();
    if (location.queryObject.platformOverride) {
      Session.set('platformOverride', location.queryObject.platformOverride);
    }
  }
});

Router.map(function() {
  // todo: prepend all templates with 'demo'.
  this.route('index', {path: '/'});
  this.route('actionSheet');
  this.route('backdrop');

  this.route('buttons');
  this.route('buttons.default', { path: 'buttons/default' });
  this.route('buttons.block', { path: 'buttons/block' });
  this.route('buttons.full', { path: 'buttons/full' });
  this.route('buttons.differentSizes', { path: 'buttons/different-sizes' });
  this.route('buttons.outlined', { path: 'buttons/outlined' });
  this.route('buttons.clear', { path: 'buttons/clear' });
  this.route('buttons.icons', { path: 'buttons/icons' });
  this.route('buttons.headersFooters', { path: 'buttons/headers-footers' });
  this.route('buttons.headersFootersClear', { path: 'buttons/headers-footers/clear' });
  this.route('buttons.bar', { path: 'buttons/bar' });

  this.route('content');
  this.route('forms', {
    data: function () {
      return {
        post: Posts.find().fetch()[0]
      };
    }
  });
  this.route('headersFooters');
  this.route('headersFooters.header', { path: 'headersFooters/header' ,layoutTemplate: "simpleLayout"});
  this.route('headersFooters.footer', { path: 'headersFooters/footer' ,layoutTemplate: "simpleLayout"});
  this.route('headersFooters.defaultCenterAlign', { path: 'headersFooters/defaultCenterAlign' ,layoutTemplate: "simpleLayout"});
  this.route('headersFooters.rightAlign', { path: 'headersFooters/rightAlign' ,layoutTemplate: "simpleLayout"});
  this.route('headersFooters.leftAlign', { path: 'headersFooters/leftAlign' ,layoutTemplate: "simpleLayout"});

  this.route('lists');
  this.route('demoListsDividers', { path: 'lists/dividers' });
  this.route('demoListsIcons', { path: 'lists/icons' });
  this.route('demoListsButtons', { path: 'lists/buttons' });
  this.route('demoListsAvatars', { path: 'lists/avatars' });
  this.route('demoListsThumbnails', { path: 'lists/thumbnails' });
  this.route('demoListsInsetLists', { path: 'lists/inset-lists' });
  this.route('listsComplex', { path: 'lists/complex' });

  this.route('demoionScroll', { path: '/scroll' });
  this.route('demoListsionInfiniteScroll', { path: 'lists/ionInfiniteScroll' });

  this.route('loading');
  this.route('modal');
  this.route('navigation');
  this.route('navigation.one', {path: '/navigation/one'});
  this.route('navigation.two', {path: '/navigation/two'});
  this.route('navigation.three', {path: '/navigation/three'});
  this.route('popover');
  this.route('popup');
  this.route('sideMenu');
  this.route('slideBox');
  this.route('spinner');
  this.route('tabs.one', {path: '/tabs/one', layoutTemplate: 'tabsLayout'});
  this.route('tabs.two', {path: '/tabs/two', layoutTemplate: 'tabsLayout'});
  this.route('tabs.three', {path: '/tabs/three', layoutTemplate: 'tabsLayout'});
  this.route('tabs.four', {path: '/tabs/four', layoutTemplate: 'tabsLayout'});
  this.route('userAccounts');
  this.route('radio');
});


text:
<histogram-configuration>

<histograms>

<variants name="CameraRollMediaType">
  <variant name=".Photo" summary="image media types"/>
  <variant name=".Video" summary="video media types"/>
</variants>

<histogram name="PhoneHub.Adoption.FeatureStatusChangesSinceLogin"
    enum="PhoneHubFeatureStatus" expires_after="2023-02-01">
  <owner>jonmann@chromium.org</owner>
  <owner>chromeos-cross-device-eng@google.com</owner>

    The feature status changes to PhoneHub after login. Note that this does not
    include the steady state feature status on user login or the status changes
    to the feature status prior to that.

</histogram>

<histogram name="PhoneHub.Adoption.LoginFeatureStatus"
    enum="PhoneHubFeatureStatus" expires_after="2023-02-01">
  <obsolete>
    There was a bug associated with the recording on this metric. During
    investigation, we decided that this metric is of no value and so it was
    removed. Deprecated 07/2022
  </obsolete>
  <owner>jonmann@chromium.org</owner>
  <owner>chromeos-cross-device-eng@google.com</owner>
  The steady state feature status of PhoneHub on user login.
</histogram>

<histogram name="PhoneHub.BubbleOpened.Connectable.Failed.HostLastSeen"
    units="ms" expires_after="2023-02-01">
  <owner>jonmann@chromium.org</owner>
  <owner>chromeos-cross-device-eng@google.com</owner>

    The time since the last successful discovery of the phone. Emitted when the
    PhoneHub tray bubble is opened prior to connected to the phone.

</histogram>

<histogram name="PhoneHub.BubbleOpened.Connectable.Page" enum="PhoneHubScreen"
    expires_after="2023-02-01">
  <owner>jonmann@chromium.org</owner>
  <owner>chromeos-cross-device-eng@google.com</owner>

    The page which is shown in the Phone Hub tray bubble when it is first
    opened. This is only emitted when we know the phone is connectable because
    it has been discovered nearby in the past 2 minutes.

</histogram>

<histogram name="PhoneHub.CameraRoll.AndroidHasStoragePermission"
    enum="PhoneHubCameraRollBooleanStorageAccessPermission"
    expires_after="2023-02-01">
  <owner>jonmann@chromium.org</owner>
  <owner>chromeos-cross-device-eng@google.com</owner>

    Records if the Android component has storage access permission. If not,
    Camera Roll is hidden and the settings toggle is grayed out. Emitted when a
    change of access state is reported by the Android device.

</histogram>

<histogram name="PhoneHub.CameraRoll.Content.Clicked{MediaType}"
    enum="PhoneHubCameraRollContentClicked" expires_after="2023-02-01">
  <owner>jonmann@chromium.org</owner>
  <owner>chromeos-cross-device-eng@google.com</owner>

    Records user clicks on Camera Roll items. Emmited when opening the context
    menu associated with the item.

  <token key="MediaType" variants="CameraRollMediaType"/>
</histogram>

<histogram name="PhoneHub.CameraRoll.Content.Present" enum="BooleanPresent"
    expires_after="2023-02-01">
  <owner>jasonsun@chromium.org</owner>
  <owner>chromeos-cross-device-eng@google.com</owner>

    Emits to one and only one bucket. Used to help track engagement with Camera
    Roll. Emitted once per opening of the PhoneHub bubble when Camera Roll items
    are first shown.

</histogram>

<histogram name="PhoneHub.CameraRoll.Content.Shown{MediaType}"
    enum="PhoneHubCameraRollContentShown" expires_after="2023-02-01">
  <owner>jonmann@chromium.org</owner>
  <owner>chromeos-cross-device-eng@google.com</owner>

    Records Camera Roll items shown in PhoneHub. Emmited when displaying or
    updating thumbnails.

  <token key="MediaType" variants="CameraRollMediaType"/>
</histogram>

<histogram name="PhoneHub.CameraRoll.ContextMenu.Download{MediaType}"
    enum="PhoneHubCameraRollContextMenuDownload" expires_after="2023-02-01">
  <owner>jonmann@chromium.org</owner>
  <owner>chromeos-cross-device-eng@google.com</owner>

    Records download events in the Camera Roll context menu. Emitted when user
    clicks on download for a Camera Roll item.

  <token key="MediaType" variants="CameraRollMediaType"/>
</histogram>

<histogram name="PhoneHub.CameraRoll.DownloadItem.Result"
    enum="PhoneHubCameraRollDownloadResult" expires_after="2023-08-12">
  <owner>jonmann@chromium.org</owner>
  <owner>chromeos-cross-device-eng@google.com</owner>

    Logs the result of attempting to download a file from Phone Hub's Camera
    Roll.

</histogram>

<histogram name="PhoneHub.CameraRoll.DownloadItem.TransferRate" units="KB/s"
    expires_after="2023-02-01">
  <owner>jasonsun@chromium.org</owner>
  <owner>chromeos-cross-device-eng@google.com</owner>

    Measures the data transfer rate of downloading a recent photo or video taken
    on a connected phone via Phone Hub. Emitted when an item is downloaded
    successfully.

</histogram>

<histogram name="PhoneHub.CameraRoll.Latency.RefreshItems" units="ms"
    expires_after="2023-02-01">
  <owner>jasonsun@chromium.org</owner>
  <owner>chromeos-cross-device-eng@google.com</owner>

    Measures the amount of time it takes for the Chromebook to receive the
    up-to-date set of recent photos and videos taken on a connected phone and
    display their thumbnails on the Phone Hub tray.

</histogram>

<histogram name="PhoneHub.CameraRoll.OptInEntryPoint"
    enum="PhoneHubCameraRollOptInEntryPoint" expires_after="2023-02-01">
  <owner>jianbing@google.com</owner>
  <owner>chromeos-cross-device-eng@google.com</owner>

    Emitted when a new multidevice suite user goes through the multidevice
    onboarding flow, when the user enables the Camera Roll toggle in Settings,
    and when user chose to turn on the feature in camera roll onboarding dialog
    inside phone hub panel.

</histogram>

<histogram name="PhoneHub.CameraRoll.OptInEvents"
    enum="PhoneHubInterstitialScreenEvent" expires_after="2023-02-01">
  <obsolete>
    No longer valid as combined feature onboarding flow replaced existing camera
    roll op-in flow. Deprecated 04/2022.
  </obsolete>
  <owner>jianbing@google.com</owner>
  <owner>chromeos-cross-device-eng@google.com</owner>

    Records events from the Camera Roll opt-in view within the Phone Hub tray
    bubble. Emitted when the opt-in view is shown and when the user clicks the
    confirm/dismiss buttons.

</histogram>

<histogram name="PhoneHub.CompletedUserAction" enum="PhoneHubUserAction"
    expires_after="2023-02-01">
  <owner>jonmann@chromium.org</owner>
  <owner>chromeos-cross-device-eng@google.com</owner>

    Measures actions taken by the user as part of the Phone Hub feature; emitted
    when the user attempts the actions described in the PhoneHubUserAction enum.

    Used to measure engagement and track 28DA user counts.

</histogram>

<histogram name="PhoneHub.Connection.Duration" units="ms"
    expires_after="2023-02-01">
  <owner>jonmann@chromium.org</owner>
  <owner>chromeos-cross-device-eng@google.com</owner>

    The duration of time the phone is in the connected state, and becomes
    disconnected.

</histogram>

<histogram name="PhoneHub.Connection.Result" enum="BooleanSuccess"
    expires_after="2023-02-01">
  <owner>jonmann@chromium.org</owner>
  <owner>chromeos-cross-device-eng@google.com</owner>

    Measures PhoneHub connection success rate, considering attempts where the
    phone is not nearby as failures. This is recorded at the end of each
    connection attempt, whether it fails or succeeds and the failures are broken
    down into more specific categories in
    PhoneHub.Connection.Result.FailureReason

</histogram>

<histogram name="PhoneHub.Connection.Result.FailureReason"
    enum="SecureChannelConnectionAttemptFailureReason"
    expires_after="2023-02-01">
  <owner>jonmann@chromium.org</owner>
  <owner>chromeos-cross-device-eng@google.com</owner>

    The reason for which a connection attempt to the phone has failed. This is a
    breakdown of the failure bucket of PhoneHub.Connection.Result and is
    recorded on each connection failure.

</histogram>

<histogram name="PhoneHub.Connectivity.Latency" units="ms"
    expires_after="2023-02-01">
  <owner>jonmann@chromium.org</owner>
  <owner>chromeos-cross-device-eng@google.com</owner>

    The duration of time the phone is in the connecting state, and becomes
    connected.

</histogram>

<histogram name="PhoneHub.InterstitialScreenEvent.{Screen}"
    enum="PhoneHubInterstitialScreenEvent" expires_after="2023-02-01">
  <owner>jonmann@chromium.org</owner>
  <owner>chromeos-cross-device-eng@google.com</owner>
  Events for the given PhoneHub interstitial screen. {Screen}

  <token key="Screen">
    <variant name="BluetoothOrWifiDisabled" summary=""/>
    <variant name="Onboarding.ExistingMultideviceUser"
        summary="NOTE(https://crbug.com/1187255): This metric is actually
                 logging new multi-device users. For continuity, we continue
                 to log this metric in reverse. See ExistingMultideviceUser2
                 for the correct logging."/>
    <variant name="Onboarding.ExistingMultideviceUser2" summary=""/>
    <variant name="Onboarding.NewMultideviceUser"
        summary="NOTE(https://crbug.com/1187255): This metric is actually
                 logging existing multi-device users. For continuity, we
                 continue to log this metric in reverse. See
                 NewMultideviceUser2 for the correct logging."/>
    <variant name="Onboarding.NewMultideviceUser2" summary=""/>
    <variant name="OnboardingDismissPrompt" summary=""/>
    <variant name="PhoneConnecting" summary=""/>
    <variant name="PhoneDisconnected" summary=""/>
  </token>
</histogram>

<histogram name="PhoneHub.MultiDeviceFeatureState{PhoneHubFeature}"
    enum="MultiDevice_FeatureState" expires_after="2023-02-01">
  <owner>jonmann@chromium.org</owner>
  <owner>chromeos-cross-device-eng@google.com</owner>

    Indicates the feature state of Phone Hub features. This metric is emitted to
    at the creation of the user session (when the user logs in), when any
    multi-device feature state changes, and every 30 minutes. {PhoneHubFeature}

  <token key="PhoneHubFeature">
    <variant name=".CameraRoll" summary="Camera roll sub-feature."/>
    <variant name=".Notifications" summary="Notifications sub-feature."/>
    <variant name=".TaskContinuation" summary="Task continuation sub-feature."/>
    <variant name=".TopLevelFeature" summary="Top level Phone Hub feature."/>
  </token>
</histogram>

<histogram name="PhoneHub.NotificationAccessSetup.SuccessfulSetupDuration"
    units="ms" expires_after="2023-02-01">
  <owner>jonmann@chromium.org</owner>
  <owner>chromeos-cross-device-eng@google.com</owner>

    Records the time it takes for the user to successfully go through the
    Chromebook UI that guides them through granting Phone Hub notifications
    access on their phone. Emitted once at the end of a successful setup flow.
    The user should only need to go through the flow once successfully for each
    phone they pair to.

</histogram>

<histogram name="PhoneHub.NotificationAccessSetup.{AllStatusesOrLastStatus}"
    enum="PhoneHubNotificationAccessSetupStatus" expires_after="2023-02-01">
  <owner>jonmann@chromium.org</owner>
  <owner>chromeos-cross-device-eng@google.com</owner>

    Records {AllStatusesOrLastStatus} the Chromebook UI that guides them through
    granting Phone Hub notifications access on their phone. Emitted each time
    the user goes through the notification access setup flow. The user should
    only need to go through the flow once successfully for each phone they pair
    to.

  <token key="AllStatusesOrLastStatus">
    <variant name="AllStatuses" summary="each step the user sees in"/>
    <variant name="LastStatus"
        summary="the last state the user experiences in"/>
  </token>
</histogram>

<histogram name="PhoneHub.NotificationCount" units="notifications"
    expires_after="2023-02-01">
  <owner>jonmann@chromium.org</owner>
  <owner>chromeos-cross-device-eng@google.com</owner>

    The number of PhoneHub notifications, logged each time a notification is
    added or removed.

</histogram>

<histogram name="PhoneHub.NotificationInteraction"
    enum="PhoneHubNotificationInteraction" expires_after="2023-02-01">
  <owner>jonmann@chromium.org</owner>
  <owner>chromeos-cross-device-eng@google.com</owner>

    Events logged after the user interacts with a PhoneHub notification by
    sending an inline reply or dismissing it.

</histogram>

<histogram name="PhoneHub.NotificationMessageLength" units="characters"
    expires_after="2023-02-01">
  <owner>jonmann@chromium.org</owner>
  <owner>chromeos-cross-device-eng@google.com</owner>

    The message length of a mirrored PhoneHub notification, not including the
    title, logged each time a notification is added or updated.

</histogram>

<histogram name="PhoneHub.NotificationOptInEvents"
    enum="PhoneHubInterstitialScreenEvent" expires_after="2023-02-01">
  <obsolete>
    No longer valid as combined feature onboarding flow replaced existing
    notification op-in flow. Deprecated 04/2022.
  </obsolete>
  <owner>jonmann@chromium.org</owner>
  <owner>chromeos-cross-device-eng@google.com</owner>
  Events for the given notification opt-in prompt.
</histogram>

<histogram name="PhoneHub.OptInEntryPoint" enum="PhoneHubOptInEntryPoint"
    expires_after="2023-02-01">
  <owner>jonmann@chromium.org</owner>
  <owner>chromeos-cross-device-eng@google.com</owner>
  Tracks the UI surface with which users enable Phone Hub.
</histogram>

<histogram
    name="PhoneHub.PermissionsOnboarding.DialogScreenEvents.{SetupScreen}Screen"
    enum="PhoneHubPermissionsOnboardingScreenEvent" expires_after="2023-02-01">
  <owner>jianbing@google.com</owner>
  <owner>chromeos-cross-device-eng@google.com</owner>

    Actions user performed in combined multidevice feature set up {SetupScreen}.
    Event would be emitted when user click on buttons on {SetupScreen} and setup
    finished screen is shown.

  <token key="SetupScreen">
    <variant name="ConnectingToPhone" summary="connecting screen"/>
    <variant name="ConnectionLost" summary="connection lost screen"/>
    <variant name="CouldNotEstablishConnection"
        summary="could not establish connection screen"/>
    <variant name="FinishSetupOnYourPhone"
        summary="finish setup on your phone screen"/>
    <variant name="Intro" summary="introduction screen"/>
    <variant name="Promo" summary="promotion in Phonehub tray"/>
    <variant name="SetAPinOrPassword" summary="set a PIN or password screen"/>
    <variant name="SetUpFinished" summary="setup finished screen"/>
  </token>
</histogram>

<histogram name="PhoneHub.PermissionsOnboarding.SetUpMode.IntroScreenShown"
    enum="PhoneHubPermissionsOnboardingSetUpMode" expires_after="2023-02-01">
  <owner>mavishsu@google.com</owner>
  <owner>jonmann@chromium.org</owner>
  <owner>chromeos-cross-device-eng@google.com</owner>

    Tracks the multidevice permissions onboarding setup mode. Logged when intro
    screen is displayed.

</histogram>

<histogram
    name="PhoneHub.PermissionsOnboarding.SetUpMode.SetUpFinishedScreenShown"
    enum="PhoneHubPermissionsOnboardingSetUpResult" expires_after="2023-02-01">
  <owner>mavishsu@google.com</owner>
  <owner>jonmann@chromium.org</owner>
  <owner>chromeos-cross-device-eng@google.com</owner>

    Tracks the multidevice permissions onboarding setup mode. Logged when set up
    finished screen is displayed.

</histogram>

<histogram name="PhoneHub.PermissionsOnboarding.SetUpMode.{ModeRecordingEvent}"
    enum="PhoneHubPermissionsOnboardingSetUpMode" expires_after="2023-02-01">
  <owner>jianbing@google.com</owner>
  <owner>chromeos-cross-device-eng@google.com</owner>

    Tracks which feature combination user is setting up. Event would be emitted
    when {ModeRecordingEvent}.

  <token key="ModeRecordingEvent">
    <variant name="OnPromoShown" summary="setup promo shown in Phonehub tray"/>
    <variant name="OnSettingsClicked"
        summary="setup button clicked in multidevice setting\'s page"/>
  </token>
</histogram>

<histogram name="PhoneHub.QuickActionClicked" enum="PhoneHubQuickAction"
    expires_after="2023-02-01">
  <owner>jonmann@chromium.org</owner>
  <owner>chromeos-cross-device-eng@google.com</owner>
  Event logged after the user clicks on a quick action.
</histogram>

<histogram name="PhoneHub.ScreenOnSettingsButtonClicked" enum="PhoneHubScreen"
    expires_after="2023-02-01">
  <owner>jonmann@chromium.org</owner>
  <owner>chromeos-cross-device-eng@google.com</owner>

    Logs the current screen when the settings button is clicked in the tray
    bubble.

</histogram>

<histogram name="PhoneHub.ScreenOn{BubbleEvent}" enum="PhoneHubScreen"
    expires_after="2023-02-01">
  <owner>jonmann@chromium.org</owner>
  <owner>chromeos-cross-device-eng@google.com</owner>

    Logs the current screen for the PhoneHub tray given bubble event (i.e. on
    bubble open or close).

  <token key="BubbleEvent">
    <variant name="BubbleClose"/>
    <variant name="BubbleOpen"/>
  </token>
</histogram>

<histogram name="PhoneHub.TabContinuationChipClicked" units="tab index"
    expires_after="2023-02-01">
  <owner>jonmann@chromium.org</owner>
  <owner>chromeos-cross-device-eng@google.com</owner>

    After a tab continuation chip is clicked, the index of the tab is logged.
    Tab indices are ordered left-to-right, top-to-bottom in a standard LTR
    locale.

</histogram>

<histogram name="PhoneHub.TaskCompletion.TetherConnection.Result"
    enum="PhoneHubTetherConnectionResult" expires_after="2023-02-01">
  <owner>jonmann@chromium.org</owner>
  <owner>chromeos-cross-device-eng@google.com</owner>

    Logs the result of attempting a tether connection to measure the connection
    success rate.

</histogram>

<histogram name="PhoneHub.TaskCompletion.{MessageType}.Result"
    enum="PhoneHubMessageResult" expires_after="2023-02-01">
  <owner>jonmann@chromium.org</owner>
  <owner>chromeos-cross-device-eng@google.com</owner>

    Tracks the result of each type of message request. Logged each time a
    request message was sent and a response was received.

  <token key="MessageType">
    <variant name="FeatureSetup"/>
    <variant name="FetchCameraRollItemData"/>
    <variant name="FetchCameraRollItems"/>
    <variant name="InitiateCameraRollItemTransfer"/>
    <variant name="LocatePhone"/>
    <variant name="NotificationDismissal"/>
    <variant name="NotificationInlineReply"/>
    <variant name="ShowNotificationAccessSetup"/>
    <variant name="SilencePhone"/>
    <variant name="UpdateBatteryMode"/>
  </token>
</histogram>

<histogram name="PhoneHub.Usage.SentMessageTypeCount"
    enum="PhoneHubMessageType" expires_after="2023-02-01">
  <owner>jonmann@chromium.org</owner>
  <owner>chromeos-cross-device-eng@google.com</owner>

    Counts for each command sent. Note that PhoneHubMessageType also includes
    message types that are recieved by CrOS. Those will always have a zero value
    in this histogram.

</histogram>

</histograms>

</histogram-configuration>


text:
<!DOCTYPE HTML>

        <title>Marketability</title>

        <meta name="viewport" content="width=device-width, initial-scale=1">

        <link rel="stylesheet" type="text/css" href= "<?php echo base_url(). 'assets/flat-ui/bootstrap/css/bootstrap.css'?>"/>
    <link rel="stylesheet" type="text/css" href="<?php echo base_url(). 'assets/flat-ui/css/flat-ui.css'?>" />
        <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700,800' rel='stylesheet' type='text/css'>
        <link href='http://fonts.googleapis.com/css?family=Lato:100,300,400,700,900' rel='stylesheet' type='text/css'>
        <link href="<?php echo base_url(). 'assets/css/animate.css'?>" rel="stylesheet" type="text/css" />
        <link rel="stylesheet" href="<?php echo base_url(). 'assets/css/slippry.css'?>">
        <link type="text/css" rel="stylesheet" href="<?php echo base_url(). 'assets/css/jquery.mmenu.all.css'?>" />
        <link type="text/css" rel="stylesheet" href="<?php echo base_url(). 'assets/css/style.css'?>" />
        <link href="<?php echo base_url(). 'assets/css/style3.css'?>" rel='stylesheet' type='text/css' />

<a href="<?php echo base_url() . 'home/index'?>">Home

<a href="<?php echo base_url() . 'home/about'?>">Preamble

<a href="<?php echo base_url() . 'home/services'?>">About Us

<a href="<?php echo base_url() . 'home/contacts'?>">Contact

                             Southern Cross : Marketability

<a href="<?php echo base_url() . 'home/index'?>">Home

<a href="<?php echo base_url() . 'home/about'?>">Preamble

<a href="<?php echo base_url() . 'home/services'?>">About Us

<a href="<?php echo base_url() . 'home/contacts'?>">Contact

                                    The health workforce is a vital component of any health system.
Moving from a disease-specific approach to healthcare promotion,
policy makers are now shifting towards a health systems approach,
 which includes strengthening the health workforce.
The impetus for this new focus on
                                     health systems strengthening and
 human resources for health (HRH) came, in part,

                                    as a result of research from the 2004 Joint
 Learning Initiative and The World Health Report in 2006,
which demonstrated a clear
                                   link between
 health workforce density and a number of health indicators (2004; 2006b).

                                    Numerous studies have explored the link between an adequate
 supply and deployment of HRH and health services delivery.
The Joint Learning Initiative, comprised of global health experts,
                                       found that
a density of 2.3 health care workers per
 1,000 population was associated with 80% coverage
in skilled birth attendance and measles vaccination (2004),
and a distinct
                                    relationship between the density of the health workforce and
 mortality rates for mothers, infants and children under five.
However, thirty-six sub-Saharan African countries, including
                                      Kenya,
 are facing a critical shortage of heath care workers.

                                    The Government of Kenya (GoK), in partnership with the
 President's Emergency Plan for AIDS Relief (PEPFAR), is
 considering interventions to scale-up Kenya's health workforce,
 increasing the number of doctors, nurses, midwives,
 clinical
                                    officers and community workers, among other cadres.
It should be noted that registration as a professional health worker requires
enrolling in and completing an approved training

                                    institution (i.e. intake and graduation), taking a licensure exam,
 and applying for registration.
Kenya's Health Workforce Information on workforce registration and
licensure renewals can be used to calculate Kenya's
 workforce-to-population density and
                                    compare it to the
 WHO recommendation of 2.3 health workers per 1,000 populations.

                                         Table 1: Kenya's Health WorkForce

    Doctors
    Dentists
    Nurses/Mid-Wives
    Clinical Officers
    Laboratory Techs
    Total

    Registered
    6,306
    780
    43,970
    8,300
    4,699
    64,055

    Licensure Renewals
    4,756
    590
    28,214
    6,300
    2,092
    41,952

                                    Calculating workforce-to-population ratios based on both
the number of "registered" and "retained" health care workers
 provides a range for workforce density estimates.
According to
   the number of registered health personnel,
 Kenya has 1.54 health workers (doctors, nurses, midwives,
 and clinical officers) per
  1,000 people.
Based on the number of retained health personnel,
 Kenya has 1.03 health workers (doctors, nurses, midwives,
and
    clinical officers) per 1,000 people
based on the 2009 Census data for an estimated national
population of 38.6M in 2010.
Using
  either estimate, the density of health workers
in Kenya is below the recommended 2.30 per 1,000 people.

<a href="<?php echo base_url(). 'home/index'?>">Back Home

<a href="<?php echo base_url() . 'home/about'?>">Preamble

<a href="<?php echo base_url() . 'home/services'?>">About Us

<a href="<?php echo base_url() . 'home/contacts'?>">Contact

Website by Continuum Developers


text:
<?php

abstract class EMBBaseWidget extends CWidget
{
    /**
     * Set to false to exlude this output from caching
     * @var bool
     */
    public $cached = true;

    /**
     * The template for a label output
     * @var string
     */
    public $labelDetailTemplate = '{label}';

    /**
     * Text if no valid items are found
     *
     * @var string
     */
    public $emptyText='';

    /**
     * The scenarios
     *
     * @var mixed string|array
     */
    public $scenarios;

    /**
     * Global ajax settings for every item
     * @var array
     */
    public $ajaxOptions = array();

    /**
     * Wether to assign ajax as onclick of the item or bind in document-ready
     *
     * @var bool
     */
    public $useAjaxOnClick = false;

    /**
     * Don't use this attributes
     * They are only for simulating userroles and languages
     * @see the views in the directory admin/menupreviews
     */
    public $userRoles;
    public $language;
    public $nestedConfig;
    public $adminMode=false;

    /**
     * The menuids for which the items will be rendered
     * If not set, all menuIds with the specified scenarios will be collected
     * @var string or array
     */
    public $menuIds;

    /**
     * evaluateExpression callbacks
     * @see readme.md
     * @var mixed string or array
     */
    public $onVisible;
    public $onActive;
    public $onLabel;
    public $onUrl;

    /**
     * Internal used
     */
    protected $_menuBuilder;
    protected $_itemProviderOptions;

    /**
     * @see EMBMenuItem, EMBList
     * @return mixed
     */
    abstract public function renderOutput();
    abstract public function getItems();

    /**
     * Get the menubuilder module instance
     *
     * @return CModule
     */
    public function getMenuBuilder()
    {
        if(!isset($this->_menuBuilder))
            $this->_menuBuilder = Yii::app()->getModule('menubuilder');

        return $this->_menuBuilder;
    }

    /**
     * Get the options for the itemProvider
     *
     * @return array
     */
    public function getItemProviderOptions()
    {
        if (!isset($this->_itemProviderOptions))
        {
            $this->_itemProviderOptions = array();
            $this->_itemProviderOptions['scenarios'] = $this->scenarios;
            $this->_itemProviderOptions['userRoles'] = $this->userRoles;
            $this->_itemProviderOptions['language'] = $this->language;
            $this->_itemProviderOptions['ajaxOptions'] = $this->ajaxOptions;
            $this->_itemProviderOptions['useAjaxOnClick'] = $this->useAjaxOnClick;
            $this->_itemProviderOptions['adminMode'] = $this->adminMode;

            if (isset($this->nestedConfig))
                $this->_itemProviderOptions['nestedConfig'] = $this->nestedConfig;
            if (isset($this->onVisible))
                $this->_itemProviderOptions['onVisible'] = $this->onVisible;
            if (isset($this->onActive))
                $this->_itemProviderOptions['onActive'] = $this->onActive;
            if (isset($this->onLabel))
                $this->_itemProviderOptions['onLabel'] = $this->onLabel;
            if (isset($this->onUrl))
                $this->_itemProviderOptions['onUrl'] = $this->onUrl;
        }

        return $this->_itemProviderOptions;
    }

    /**
     * Check to load items from the cache
     *
     * @param null $cachedId
     * @return bool
     */
    protected function itemsFromCache(&$cachedId = null)
    {
        if ($this->cached && $this->getMenuBuilder()->getCacheEnabled())
        {
            $cachePrefix = 'items'.md5(serialize($this));
            $cachedId = $this->getMenuBuilder()->getCacheId($cachePrefix, $this->menuIds, $this->getItemProviderOptions());
            return Yii::app()->embCache->get($cachedId);
        }

        return false;
    }

    /**
     * Save the items to the cache
     *
     * @param $cacheId
     * @param $items
     */
    protected  function itemsToCache($cacheId,$items)
    {
        if ($cacheId !== null)
        {
            Yii::app()->embCache->set($cacheId, $items, MenubuilderModule::getInstance()->cacheDuration);
        }
    }

    /**
     * Run the widget
     *
     * @throws CException
     */
    public function run()
    {
        if(!isset($this->menuIds) && !isset($this->scenarios))
            throw new CException('Attribute menuIds and/or scenarios must be set');

        ob_start();
        $this->renderOutput();
        $output = ob_get_clean();

        if(!empty($output))
            echo !empty($output) ? $output : $this->emptyText;
    }

}


text:
/**
 * Class Navigation
 */
var NavigationActionSet = function(navigationId, keyActions) {

	if(!navigationId || navigationId == null || typeof navigationId != 'string') {
		var message = 'Please, inform the id for this navigation.';
		alert(message);
		throw new Error(message);
		return false;
	}

	//private members
	this.id = navigationId;
	var actions = [];

	//public members
	this.acceptedKeys = [];

	/**
	 * execute delegate
	 */
	this.delegateAction = function(key) {
		var action = [];
		for(var i=0; i<actions.length; i++) {
			action = actions[i];
			if(action.key == key) {
				if (action.before) {
					action.before(key);
				}
				if (action.execute) {
					action.execute(key);
				}
				if (action.after) {
					action.after(key);
				}
			}
		}
	};

	/**
	 * Add KeyAction
	 */
	this.addAction = function(action) {
		if(action instanceof KeyAction) {
			actions.push(action);
			this.acceptedKeys.push(action.key);
		}
	};

	/**
	 * Instructions for constructor
	 */
	if(keyActions && keyActions.length) {
		for(var i=0; i<keyActions.length; i++) {
			this.addAction(keyActions[i]);
		}
	};

};


text:
import sys
import sqlite3

try:
    conn = sqlite3.connect('./webvirtmgr.sqlite3')
    cur = conn.cursor()
    allservers = cur.execute("select id,name,hostname,login,password,type from servers_compute").fetchall()
    for i in allservers:
        print i
finally:
        cur.close()
	conn.close()


text:
from unittest import TestCase
from chatterbot import response_selection
from chatterbot.conversation import Statement, Response

class ResponseSelectionTests(TestCase):

    def test_get_most_frequent_response(self):
        statement_list = [
            Statement('What... is your quest?', in_response_to=[Response('Hello', occurrence=2)]),
            Statement('This is a phone.', in_response_to=[Response('Hello', occurrence=4)]),
            Statement('A what?', in_response_to=[Response('Hello', occurrence=2)]),
            Statement('A phone.', in_response_to=[Response('Hello', occurrence=1)])
        ]

        output = response_selection.get_most_frequent_response(
            Statement('Hello'),
            statement_list
        )

        self.assertEqual('This is a phone.', output)

    def test_get_first_response(self):
        statement_list = [
            Statement('What... is your quest?'),
            Statement('A what?'),
            Statement('A quest.')
        ]

        output = response_selection.get_first_response(Statement('Hello'), statement_list)

        self.assertEqual('What... is your quest?', output)

    def test_get_random_response(self):
        statement_list = [
            Statement('This is a phone.'),
            Statement('A what?'),
            Statement('A phone.')
        ]

        output = response_selection.get_random_response(Statement('Hello'), statement_list)

        self.assertTrue(output)