text:
const numberDel = '⏰';
export interface Loop<T>{
    '➰': T[],
    '🎬': (t: T) => any,
}
export interface LoopTemplate<TItemContainer, TItem>{
    '➰': (t: TItemContainer) => TItem[],
    '🎬': (t: TItem) => any,
}
export interface IProperty{
    type?: any,
    setter?: any,
    readOnly?: boolean
    //uid?: string,
}
export function zen(strings : any, ...values){
    const sArr = strings as string[];
    const sArrWithSiblings = [];
    for(let i = 0, ii = sArr.length; i < ii; i++){
        const word = sArr[i];
        const sArrElement = word + numberDel + i;
        if(sArrElement.substr(0, 1) === '+'){
            sArrWithSiblings[sArrWithSiblings.length - 1] += sArrElement;
        }else{
            sArrWithSiblings.push(sArrElement);
        }
    }
    const outputArr = [] as any[];
    let allTags = [];
    for(const tagSequence of sArrWithSiblings){
        const tags = tagSequence.split('>');
        allTags = allTags.concat(tags);
    }
    processTags(allTags, outputArr, values);
    return outputArr;
}

const camelToSnakeRegEx = /([A-Z])/g;
const toDashLowerCase = function($1){return "-"+$1.toLowerCase();}
function camelToSnake(str: string){
    return str.replace(camelToSnakeRegEx, toDashLowerCase);
}
const splitRegExps: {[key: string]: RegExp} = {};
function splitWithEscape(s: string, chr: string){
    let reg = splitRegExps[chr];
    if(!reg){
        const r = `([^\\\\\\][^${chr}]|\\\\${chr})+`;
        reg = new RegExp(r, 'g');
        splitRegExps[chr] = reg;
    }
    const ret =  (' ' +s).match(reg);
    ret[0] = ret[0].substr(1);
    return ret as string[];
}

function processTag(tag: string, outputArr: any[], values, fnInside){
    if(tag.length === 0) return;
    const tagWNumber = tag.split(numberDel);
    const tagWONumber = tagWNumber[0];
    const tagWAttributes = splitWithEscape(tagWONumber, '@');
    const tagWOAttributes = tagWAttributes[0];
    const tagWClasses = tagWOAttributes.split('.');
    const tagWOClasses = tagWClasses[0];

    const tagWID = tagWOClasses.split('#', 2);
    const tagWOIDAndNoDiv = tagWID[0];
    const idx = (tagWNumber.length > 1) ? parseInt(tagWNumber[1]) : -1;
    const val = idx > -1 ? values[idx] : undefined;
    if(tagWOIDAndNoDiv.length === 0){
        if(tagWID.length === 1 && tagWClasses.length === 1 && tagWAttributes.length === 1){
          if(typeof val === 'undefined') return;
        }
    }
    const tagWOID = tagWOIDAndNoDiv ? tagWOIDAndNoDiv.trim() : 'div';
    if(tagWOID.indexOf('<') === 0){
        const identifier = 'global.' + tagWOID.substr(1);
        const obj = eval(identifier);
        obj['🏷'] = identifier;
        obj['⚙'] = {
            attribs: tagWAttributes.length > 1 ? tagWAttributes.slice(1) : null,
            classList: tagWClasses.length > 1 ? tagWClasses.slice(1) : null,
        };
        outputArr.push(obj);
    }else{
        //#region string based tag
            outputArr.push('<' + tagWOID);
            if(tagWID.length > 1){
                outputArr.push(` id="${tagWID[1]}"`);
            }

            if(tagWAttributes.length > 1){
                const attribs = tagWAttributes.slice(1).map(s=> {
                    //const lhsRhs = s.match(scSplitRegExp);
                    const lhsRhs = splitWithEscape(s, ':');
                    const key = camelToSnake(lhsRhs[0]);
                    return lhsRhs.length === 1 ? key : `${key}="${lhsRhs[1]}"`;
                }).join(' ');
                outputArr.push(` ${attribs}`);
            }
            if(tagWClasses.length > 1){
                outputArr.push(` class="${tagWClasses.slice(1).join(' ')}"`)
            }
            if(typeof val !== 'undefined'){
                switch(typeof val){
                    case 'string':
                        outputArr.push('>');
                        outputArr.push(val);
                        break;
                    case 'object':
                        let props = val;
                        let content = null;
                        if(Array.isArray(val)){
                            throw "Not Implemented";
                        }
                        let loop;
                        let action;
                        for(const key in props){
                            const atV = props[key];
                            switch(key){
                                case '🎬':
                                    action = atV;
                                    break;
                                case '➰':
                                    loop = atV;
                                    break;

                                case 'innerHTML':
                                    content = atV;
                                    break;
                                //case 'each'
                                default:
                                    switch(typeof atV){
                                        case 'boolean':
                                            if(atV){
                                                outputArr.push(` ${camelToSnake(key)}`);
                                            }
                                            break;
                                        default:
                                            outputArr.push(` ${camelToSnake(key)}="${atV}"`);
                                    }
                            }

                        }

                        outputArr.push('>');
                        if(loop && action){
                            switch(typeof loop){
                                case 'function':
                                    const loopInfo : Loop<any> = {
                                    '➰': loop,
                                        '🎬':action,
                                    }
                                    outputArr.push(loopInfo);
                                    break;
                                default:
                                    for(const item of loop){
                                        const output = action(item);
                                        for(const oi of output){
                                            outputArr.push(oi);
                                        }
                                    }
                            }

                        }
                        if(content){
                            outputArr.push(content);
                        }
                        break;
                    case 'function':
                        outputArr.push('>');
                        outputArr.push(val);
                        break;
                }
            }else{
                outputArr.push('>');
            }
            if(fnInside) fnInside();
            outputArr.push('</' + tagWOID + '>');
        //#endregion
    }

}
function processTags(tags: string[], outputArr: any[], values){
    if(tags.length === 0) return;
    let surroundingTag = tags.shift();
    if(surroundingTag.indexOf('+') > -1){
        const siblingTags = surroundingTag.split('+');
        for(const tag of siblingTags){
            processTag(tag, outputArr, values, null);
        }
    }else{
        const innerFun = () => processTags(tags, outputArr, values);
        processTag(surroundingTag, outputArr, values, innerFun)
    }
}


text:
set -euxo pipefail

for wheel in /tf/pkg/*.whl; do
  echo "Checking and renaming $wheel..."
  time python3 -m auditwheel repair --plat manylinux2014_x86_64 "$wheel" --wheel-dir /tf/pkg 2>&1 | tee check.txt

  # We don't need the original wheel if it was renamed
  new_wheel=$(grep --extended-regexp --only-matching '/tf/pkg/\S+.whl' check.txt)
  if [[ "$new_wheel" != "$wheel" ]]; then
    rm "$wheel"
    wheel="$new_wheel"
  fi

  TF_WHEEL="$wheel" bats /usertools/wheel_verification.bats --timing
done

redpajama_set_name: RedPajamaGithub


text:
/* $Id: dns.h 3553 2011-05-05 06:14:19Z nanang $ */
/*
 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
 * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
#ifndef __PJLIB_UTIL_DNS_H__
#define __PJLIB_UTIL_DNS_H__

/**
 * @file dns.h
 * @brief Low level DNS message parsing and packetization.
 */
#include <pjlib-util/types.h>
#include <pj/sock.h>

PJ_BEGIN_DECL

/**
 * @defgroup PJ_DNS DNS and Asynchronous DNS Resolver
 * @ingroup PJ_PROTOCOLS
 */

/**
 * @defgroup PJ_DNS_PARSING Low-level DNS Message Parsing and Packetization
 * @ingroup PJ_DNS
 * @{
 *
 * This module provides low-level services to parse and packetize DNS queries
 * and responses. The functions support building a DNS query packet and parse
 * the data in the DNS response. This implementation conforms to the
 * following specifications:
 *  - RFC 1035: DOMAIN NAMES - IMPLEMENTATION AND SPECIFICATION
 *  - RFC 1886: DNS Extensions to support IP version 6
 *
 * To create a DNS query packet, application should call #pj_dns_make_query()
 * function, specifying the desired DNS query type, the name to be resolved,
 * and the buffer where the DNS packet will be built into.
 *
 * When incoming DNS query or response packet arrives, application can use
 * #pj_dns_parse_packet() to parse the TCP/UDP payload into parsed DNS packet
 * structure.
 *
 * This module does not provide any networking functionalities to send or
 * receive DNS packets. This functionality should be provided by higher layer
 * modules such as @ref PJ_DNS_RESOLVER.
 */

enum
{
    PJ_DNS_CLASS_IN	= 1	/**< DNS class IN.			    */
};

/**
 * This enumeration describes standard DNS record types as described by
 * RFC 1035, RFC 2782, and others.
 */
typedef enum pj_dns_type
{
    PJ_DNS_TYPE_A	= 1,    /**< Host address (A) record.		    */
    PJ_DNS_TYPE_NS	= 2,    /**< Authoritative name server (NS)	    */
    PJ_DNS_TYPE_MD	= 3,    /**< Mail destination (MD) record.	    */
    PJ_DNS_TYPE_MF	= 4,    /**< Mail forwarder (MF) record.	    */
    PJ_DNS_TYPE_CNAME	= 5,	/**< Canonical name (CNAME) record.	    */
    PJ_DNS_TYPE_SOA	= 6,    /**< Marks start of zone authority.	    */
    PJ_DNS_TYPE_MB	= 7,    /**< Mailbox domain name (MB).		    */
    PJ_DNS_TYPE_MG	= 8,    /**< Mail group member (MG).		    */
    PJ_DNS_TYPE_MR	= 9,    /**< Mail rename domain name.		    */
    PJ_DNS_TYPE_NULL	= 10,	/**< NULL RR.				    */
    PJ_DNS_TYPE_WKS	= 11,	/**< Well known service description	    */
    PJ_DNS_TYPE_PTR	= 12,	/**< Domain name pointer.		    */
    PJ_DNS_TYPE_HINFO	= 13,	/**< Host information.			    */
    PJ_DNS_TYPE_MINFO	= 14,	/**< Mailbox or mail list information.	    */
    PJ_DNS_TYPE_MX	= 15,	/**< Mail exchange record.		    */
    PJ_DNS_TYPE_TXT	= 16,	/**< Text string.			    */
    PJ_DNS_TYPE_RP	= 17,	/**< Responsible person.		    */
    PJ_DNS_TYPE_AFSB	= 18,	/**< AFS cell database.			    */
    PJ_DNS_TYPE_X25	= 19,	/**< X.25 calling address.		    */
    PJ_DNS_TYPE_ISDN	= 20,	/**< ISDN calling address.		    */
    PJ_DNS_TYPE_RT	= 21,	/**< Router.				    */
    PJ_DNS_TYPE_NSAP	= 22,	/**< NSAP address.			    */
    PJ_DNS_TYPE_NSAP_PTR= 23,	/**< NSAP reverse address.		    */
    PJ_DNS_TYPE_SIG	= 24,	/**< Signature.				    */
    PJ_DNS_TYPE_KEY	= 25,	/**< Key.				    */
    PJ_DNS_TYPE_PX	= 26,	/**< X.400 mail mapping.		    */
    PJ_DNS_TYPE_GPOS	= 27,	/**< Geographical position (withdrawn)	    */
    PJ_DNS_TYPE_AAAA	= 28,	/**< IPv6 address.			    */
    PJ_DNS_TYPE_LOC	= 29,	/**< Location.				    */
    PJ_DNS_TYPE_NXT	= 30,	/**< Next valid name in the zone.	    */
    PJ_DNS_TYPE_EID	= 31,	/**< Endpoint idenfitier.		    */
    PJ_DNS_TYPE_NIMLOC	= 32,	/**< Nimrod locator.			    */
    PJ_DNS_TYPE_SRV	= 33,	/**< Server selection (SRV) record.	    */
    PJ_DNS_TYPE_ATMA	= 34,	/**< DNS ATM address record.		    */
    PJ_DNS_TYPE_NAPTR	= 35,	/**< DNS Naming authority pointer record.   */
    PJ_DNS_TYPE_KX	= 36,	/**< DNS key exchange record.		    */
    PJ_DNS_TYPE_CERT	= 37,	/**< DNS certificate record.		    */
    PJ_DNS_TYPE_A6	= 38,	/**< DNS IPv6 address (experimental)	    */
    PJ_DNS_TYPE_DNAME	= 39,	/**< DNS non-terminal name redirection rec. */

    PJ_DNS_TYPE_OPT	= 41,	/**< DNS options - contains EDNS metadata.  */
    PJ_DNS_TYPE_APL	= 42,	/**< DNS Address Prefix List (APL) record.  */
    PJ_DNS_TYPE_DS	= 43,	/**< DNS Delegation Signer (DS)		    */
    PJ_DNS_TYPE_SSHFP	= 44,	/**< DNS SSH Key Fingerprint		    */
    PJ_DNS_TYPE_IPSECKEY= 45,	/**< DNS IPSEC Key.			    */
    PJ_DNS_TYPE_RRSIG	= 46,	/**< DNS Resource Record signature.	    */
    PJ_DNS_TYPE_NSEC	= 47,	/**< DNS Next Secure Name.		    */
    PJ_DNS_TYPE_DNSKEY	= 48	/**< DNSSEC Key.			    */
} pj_dns_type;

/**
 * Standard DNS header, according to RFC 1035, which will be present in
 * both DNS query and DNS response.
 *
 * Note that all values seen by application would be in
 * host by order. The library would convert them to network
 * byte order as necessary.
 */
typedef struct pj_dns_hdr
{
    pj_uint16_t  id;	    /**< Transaction ID.	    */
    pj_uint16_t  flags;	    /**< Flags.			    */
    pj_uint16_t  qdcount;   /**< Nb. of queries.	    */
    pj_uint16_t  anscount;  /**< Nb. of res records	    */
    pj_uint16_t  nscount;   /**< Nb. of NS records.	    */
    pj_uint16_t  arcount;   /**< Nb. of additional records  */
} pj_dns_hdr;

/** Create RCODE flag */
#define PJ_DNS_SET_RCODE(c)	((pj_uint16_t)((c) & 0x0F))

/** Create RA (Recursion Available) bit */
#define PJ_DNS_SET_RA(on)	((pj_uint16_t)((on) << 7))

/** Create RD (Recursion Desired) bit */
#define PJ_DNS_SET_RD(on)	((pj_uint16_t)((on) << 8))

/** Create TC (Truncated) bit */
#define PJ_DNS_SET_TC(on)	((pj_uint16_t)((on) << 9))

/** Create AA (Authoritative Answer) bit */
#define PJ_DNS_SET_AA(on)	((pj_uint16_t)((on) << 10))

/** Create four bits opcode */
#define PJ_DNS_SET_OPCODE(o)	((pj_uint16_t)((o)  << 11))

/** Create query/response bit */
#define PJ_DNS_SET_QR(on)	((pj_uint16_t)((on) << 15))

/** Get RCODE value */
#define PJ_DNS_GET_RCODE(val)	(((val) & PJ_DNS_SET_RCODE(0x0F)) >> 0)

/** Get RA bit */
#define PJ_DNS_GET_RA(val)	(((val) & PJ_DNS_SET_RA(1)) >> 7)

/** Get RD bit */
#define PJ_DNS_GET_RD(val)	(((val) & PJ_DNS_SET_RD(1)) >> 8)

/** Get TC bit */
#define PJ_DNS_GET_TC(val)	(((val) & PJ_DNS_SET_TC(1)) >> 9)

/** Get AA bit */
#define PJ_DNS_GET_AA(val)	(((val) & PJ_DNS_SET_AA(1)) >> 10)

/** Get OPCODE value */
#define PJ_DNS_GET_OPCODE(val)	(((val) & PJ_DNS_SET_OPCODE(0x0F)) >> 11)

/** Get QR bit */
#define PJ_DNS_GET_QR(val)	(((val) & PJ_DNS_SET_QR(1)) >> 15)

/**
 * These constants describe DNS RCODEs. Application can fold these constants
 * into PJLIB pj_status_t namespace by calling #PJ_STATUS_FROM_DNS_RCODE()
 * macro.
 */
typedef enum pj_dns_rcode
{
    PJ_DNS_RCODE_FORMERR    = 1,    /**< Format error.			    */
    PJ_DNS_RCODE_SERVFAIL   = 2,    /**< Server failure.		    */
    PJ_DNS_RCODE_NXDOMAIN   = 3,    /**< Name Error.			    */
    PJ_DNS_RCODE_NOTIMPL    = 4,    /**< Not Implemented.		    */
    PJ_DNS_RCODE_REFUSED    = 5,    /**< Refused.			    */
    PJ_DNS_RCODE_YXDOMAIN   = 6,    /**< The name exists.		    */
    PJ_DNS_RCODE_YXRRSET    = 7,    /**< The RRset (name, type) exists.	    */
    PJ_DNS_RCODE_NXRRSET    = 8,    /**< The RRset (name, type) doesn't exist*/
    PJ_DNS_RCODE_NOTAUTH    = 9,    /**< Not authorized.		    */
    PJ_DNS_RCODE_NOTZONE    = 10    /**< The zone specified is not a zone.  */

} pj_dns_rcode;

/**
 * This structure describes a DNS query record.
 */
typedef struct pj_dns_parsed_query
{
    pj_str_t	name;	    /**< The domain in the query.		    */
    pj_uint16_t	type;	    /**< Type of the query (pj_dns_type)	    */
    pj_uint16_t	dnsclass;   /**< Network class (PJ_DNS_CLASS_IN=1)	    */
} pj_dns_parsed_query;

/**
 * This structure describes a Resource Record parsed from the DNS packet.
 * All integral values are in host byte order.
 */
typedef struct pj_dns_parsed_rr
{
    pj_str_t	 name;	    /**< The domain name which this rec pertains.   */
    pj_uint16_t	 type;	    /**< RR type code.				    */
    pj_uint16_t	 dnsclass;  /**< Class of data (PJ_DNS_CLASS_IN=1).	    */
    pj_uint32_t	 ttl;	    /**< Time to live.				    */
    pj_uint16_t	 rdlength;  /**< Resource data length.			    */
    void	*data;	    /**< Pointer to the raw resource data, only
				 when the type is not known. If it is known,
				 the data will be put in rdata below.	    */

    /** For resource types that are recognized/supported by this library,
     *  the parsed resource data will be placed in this rdata union.
     */
    union rdata
    {
	/** SRV Resource Data (PJ_DNS_TYPE_SRV, 33) */
	struct srv {
	    pj_uint16_t	prio;	/**< Target priority (lower is higher).	    */
	    pj_uint16_t weight;	/**< Weight/proportion			    */
	    pj_uint16_t port;	/**< Port number of the service		    */
	    pj_str_t	target;	/**< Target name.			    */
	} srv;

	/** CNAME Resource Data (PJ_DNS_TYPE_CNAME, 5) */
	struct cname {
	    pj_str_t	name;	/**< Primary canonical name for an alias.   */
	} cname;

	/** NS Resource Data (PJ_DNS_TYPE_NS, 2) */
	struct ns {
	    pj_str_t	name;	/**< Primary name server.		    */
	} ns;

	/** PTR Resource Data (PJ_DNS_TYPE_PTR, 12) */
	struct ptr {
	    pj_str_t	name;	/**< PTR name.				    */
	} ptr;

	/** A Resource Data (PJ_DNS_TYPE_A, 1) */
	struct a {
	    pj_in_addr	ip_addr;/**< IPv4 address in network byte order.    */
	} a;

	/** AAAA Resource Data (PJ_DNS_TYPE_AAAA, 28) */
	struct aaaa {
	    pj_in6_addr	ip_addr;/**< IPv6 address in network byte order.    */
	} aaaa;

    } rdata;

} pj_dns_parsed_rr;

/**
 * This structure describes the parsed repersentation of the raw DNS packet.
 * Note that all integral values in the parsed packet are represented in
 * host byte order.
 */
typedef struct pj_dns_parsed_packet
{
    pj_dns_hdr		 hdr;	/**< Pointer to DNS hdr, in host byte order */
    pj_dns_parsed_query	*q;	/**< Array of DNS queries.		    */
    pj_dns_parsed_rr	*ans;	/**< Array of DNS RR answer.		    */
    pj_dns_parsed_rr	*ns;	/**< Array of NS record in the answer.	    */
    pj_dns_parsed_rr	*arr;	/**< Array of additional RR answer.	    */
} pj_dns_parsed_packet;

/**
 * Option flags to be specified when calling #pj_dns_packet_dup() function.
 * These flags can be combined with bitwise OR operation.
 */
enum pj_dns_dup_options
{
    PJ_DNS_NO_QD    = 1, /**< Do not duplicate the query section.	    */
    PJ_DNS_NO_ANS   = 2, /**< Do not duplicate the answer section.	    */
    PJ_DNS_NO_NS    = 4, /**< Do not duplicate the NS section.		    */
    PJ_DNS_NO_AR    = 8  /**< Do not duplicate the additional rec section   */
};

/**
 * Create DNS query packet to resolve the specified names. This function
 * can be used to build any types of DNS query, such as A record or DNS SRV
 * record.
 *
 * Application specifies the type of record and the name to be queried,
 * and the function will build the DNS query packet into the buffer
 * specified. Once the packet is successfully built, application can send
 * the packet via TCP or UDP connection.
 *
 * @param packet	The buffer to put the DNS query packet.
 * @param size		On input, it specifies the size of the buffer.
 *			On output, it will be filled with the actual size of
 *			the DNS query packet.
 * @param id		DNS query ID to associate DNS response with the
 *			query.
 * @param qtype		DNS type of record to be queried (see #pj_dns_type).
 * @param name		Name to be queried from the DNS server.
 *
 * @return		PJ_SUCCESS on success, or the appropriate error code.
 */
PJ_DECL(pj_status_t) pj_dns_make_query(void *packet,
				       unsigned *size,
				       pj_uint16_t id,
				       int qtype,
				       const pj_str_t *name);

/**
 * Parse raw DNS packet into parsed DNS packet structure. This function is
 * able to parse few DNS resource records such as A record, PTR record,
 * CNAME record, NS record, and SRV record.
 *
 * @param pool		Pool to allocate memory for the parsed packet.
 * @param packet	Pointer to the DNS packet (the TCP/UDP payload of
 *			the raw packet).
 * @param size		The size of the DNS packet.
 * @param p_res		Pointer to store the resulting parsed packet.
 *
 * @return		PJ_SUCCESS on success, or the appropriate error code.
 */
PJ_DECL(pj_status_t) pj_dns_parse_packet(pj_pool_t *pool,
					 const void *packet,
					 unsigned size,
					 pj_dns_parsed_packet **p_res);

/**
 * Duplicate DNS packet.
 *
 * @param pool		The pool to allocate memory for the duplicated packet.
 * @param p		The DNS packet to be cloned.
 * @param options	Option flags, from pj_dns_dup_options.
 * @param p_dst		Pointer to store the cloned DNS packet.
 */
PJ_DECL(void) pj_dns_packet_dup(pj_pool_t *pool,
				const pj_dns_parsed_packet*p,
				unsigned options,
				pj_dns_parsed_packet **p_dst);

/**
 * Utility function to get the type name string of the specified DNS type.
 *
 * @param type		DNS type (see #pj_dns_type).
 *
 * @return		String name of the type (e.g. "A", "SRV", etc.).
 */
PJ_DECL(const char *) pj_dns_get_type_name(int type);

/**
 * Initialize DNS record as DNS SRV record.
 *
 * @param rec		The DNS resource record to be initialized as DNS
 *			SRV record.
 * @param res_name	Resource name.
 * @param dnsclass	DNS class.
 * @param ttl		Resource TTL value.
 * @param prio		DNS SRV priority.
 * @param weight	DNS SRV weight.
 * @param port		Target port.
 * @param target	Target name.
 */
PJ_DECL(void) pj_dns_init_srv_rr(pj_dns_parsed_rr *rec,
				 const pj_str_t *res_name,
				 unsigned dnsclass,
				 unsigned ttl,
				 unsigned prio,
				 unsigned weight,
				 unsigned port,
				 const pj_str_t *target);

/**
 * Initialize DNS record as DNS CNAME record.
 *
 * @param rec		The DNS resource record to be initialized as DNS
 *			CNAME record.
 * @param res_name	Resource name.
 * @param dnsclass	DNS class.
 * @param ttl		Resource TTL value.
 * @param name		Host name.
 */
PJ_DECL(void) pj_dns_init_cname_rr(pj_dns_parsed_rr *rec,
				   const pj_str_t *res_name,
				   unsigned dnsclass,
				   unsigned ttl,
				   const pj_str_t *name);

/**
 * Initialize DNS record as DNS A record.
 *
 * @param rec		The DNS resource record to be initialized as DNS
 *			A record.
 * @param res_name	Resource name.
 * @param dnsclass	DNS class.
 * @param ttl		Resource TTL value.
 * @param ip_addr	Host address.
 */
PJ_DECL(void) pj_dns_init_a_rr(pj_dns_parsed_rr *rec,
			       const pj_str_t *res_name,
			       unsigned dnsclass,
			       unsigned ttl,
			       const pj_in_addr *ip_addr);

/**
 * Dump DNS packet to standard log.
 *
 * @param res		The DNS packet.
 */
PJ_DECL(void) pj_dns_dump_packet(const pj_dns_parsed_packet *res);

/**
 * @}
 */

PJ_END_DECL

#endif	/* __PJLIB_UTIL_DNS_H__ */


text:
import { HttpStatus, Request } from '@lib/http';
import createHttpError from 'http-errors';
import jwt from 'jsonwebtoken';
import { getOauthToken, GithubModel, hasApp, hasOauthToken, readApp } from '../model';

export async function requireAuth(req: Request, model: GithubModel): Promise<string> {
    const authorization = req.headers.authorization;
    const tokenPrefix = 'token ';

    if (typeof authorization !== 'string' || !authorization.startsWith(tokenPrefix)) {
        throw createHttpError(HttpStatus.UNAUTHORIZED, 'Requires authentication');
    }
    const accessToken = authorization.substr(tokenPrefix.length);
    if (!(await hasOauthToken(model, accessToken))) {
        throw createHttpError(HttpStatus.UNAUTHORIZED, `Bad credentials: invalid access token: ${accessToken}`);
    }

    const oauthToken = await getOauthToken(model, accessToken);
    return oauthToken.login;
}

export async function requireAppAuth(req: Request, model: GithubModel): Promise<number> {
    const authorization = req.headers.authorization;
    const bearerPrefix = 'Bearer ';

    if (typeof authorization !== 'string' || !authorization.startsWith(bearerPrefix)) {
        throw createHttpError(HttpStatus.UNAUTHORIZED, 'Requires authentication');
    }
    const bearerToken = authorization.substr(bearerPrefix.length);
    const payload = jwt.decode(bearerToken);
    if (!payload || typeof payload !== 'object' || typeof payload.iss !== 'number') {
        throw createHttpError(HttpStatus.BAD_REQUEST, 'invalid bearer token payload');
    }
    const appId = payload.iss;
    if (!(await hasApp(model, appId))) {
        throw createHttpError(HttpStatus.BAD_REQUEST, `no such app: ${appId}`);
    }

    const app = await readApp(model, appId);
    const publicKey = app.publickey;
    jwt.verify(bearerToken, publicKey);
    return appId;
}


text:
using namespace Gdiplus;
#pragma comment (lib,"Gdiplus.lib")

int GetEncoderClsid(const WCHAR* format, CLSID* pClsid)
{
	UINT  num = 0;          // number of image encoders
	UINT  size = 0;         // size of the image encoder array in bytes

	ImageCodecInfo* pImageCodecInfo = NULL;

	GetImageEncodersSize(&num, &size);
	if (size == 0)
		return -1;  // Failure

	pImageCodecInfo = (ImageCodecInfo*)(malloc(size));
	if (pImageCodecInfo == NULL)
		return -1;  // Failure

	GetImageEncoders(num, size, pImageCodecInfo);

	for (UINT j = 0; j < num; ++j)
	{
		if (wcscmp(pImageCodecInfo[j].MimeType, format) == 0)
		{
			*pClsid = pImageCodecInfo[j].Clsid;
			free(pImageCodecInfo);
			return j;  // Success
		}
	}

	free(pImageCodecInfo);
	return -1;  // Failure
}

void getScreen(const int x, const int y, int W, int H, const char* path) {
	// Initialize GDI+.
	GdiplusStartupInput gdiplusStartupInput;
	ULONG_PTR gdiplusToken;
	GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);

	{
		// get the height and width of the screen
		SetProcessDPIAware();

		if (W == 0) {
			W = GetSystemMetrics(SM_CXSCREEN);
		}
		if (H == 0) {
			H = GetSystemMetrics(SM_CYSCREEN);
		}

		HDC hdc = GetDC(NULL); // get the desktop device context
		HDC hDest = CreateCompatibleDC(hdc); // create a device context to use yourself

		// create a bitmap
		HBITMAP hbDesktop = CreateCompatibleBitmap(hdc, W, H);

		// use the previously created device context with the bitmap
		SelectObject(hDest, hbDesktop);

		// copy from the desktop device context to the bitmap device context
		BitBlt(hDest, 0, 0, W, H, hdc, x, y, SRCCOPY);

		Bitmap bitmap(hbDesktop, NULL);
		CLSID clsid;
		size_t size = strlen(path) + 1;
		wchar_t* pathName = new wchar_t[size];
		size_t outSize;
		mbstowcs_s(&outSize, pathName, size, path, size - 1);
		GetEncoderClsid(L"image/png", &clsid);
		bitmap.Save(pathName, &clsid, NULL);

		// after the recording is done, release the desktop context you got..
		ReleaseDC(NULL, hdc);
		DeleteObject(hbDesktop);

		// ..and delete the context you created
		DeleteDC(hDest);
	}

	GdiplusShutdown(gdiplusToken);
}


text:
A ruby client for the ScaleEngine Livestream Network API. [www.scaleengine.com](http://www.scaleengine.com)

## Example
```
se = ScaleEngine.new
req = se.files.getstorage
resp = req.send
```

## Install (Coming soon)
```
gem install ruby-scaleengine
```

Rails (Gemfile)
```
gem 'ruby-scaleengine'
```

## API Controls
The ScaleEngine API is organized such that all requests go to a single endpoint, and the type of request (ie sevu.addstreamuser) is a request parameter.
So this client library is designed around the request command.

All request types are found in the official documentation [Docs](https://cp.scaleengine.net/docs/api/)

### Sevu
##### Add Stream User
Command: `sevu.addstreamuser`

##### Attemps
Command: `sevu.errorlog`


text:
<?php

import('classes.plugins.ImportExportPlugin');

class PubMedExportPlugin extends ImportExportPlugin {
	/**
	 * Called as a plugin is registered to the registry
	 * @param $category String Name of category plugin was registered to
	 * @return boolean True if plugin initialized successfully; if false,
	 * 	the plugin will not be registered.
	 */
	function register($category, $path) {
		$success = parent::register($category, $path);
		$this->addLocaleData();
		return $success;
	}

	/**
	 * Get the name of this plugin. The name must be unique within
	 * its category.
	 * @return String name of plugin
	 */
	function getName() {
		return 'PubMedExportPlugin';
	}

	function getDisplayName() {
		return __('plugins.importexport.pubmed.displayName');
	}

	function getDescription() {
		return __('plugins.importexport.pubmed.description');
	}

	function display(&$args, $request) {
		$templateMgr = TemplateManager::getManager($request);
		parent::display($args, $request);

		$issueDao = DAORegistry::getDAO('IssueDAO');

		$journal = $request->getJournal();

		switch (array_shift($args)) {
			case 'exportIssues':
				$issueIds = $request->getUserVar('issueId');
				if (!isset($issueIds)) $issueIds = array();
				$issues = array();
				foreach ($issueIds as $issueId) {
					$issue = $issueDao->getById($issueId);
					if (!$issue) $request->redirect();
					$issues[] = $issue;
				}
				$this->exportIssues($journal, $issues);
				break;
			case 'exportIssue':
				$issueId = array_shift($args);
				$issue = $issueDao->getById($issueId);
				if (!$issue) $request->redirect();
				$issues = array($issue);
				$this->exportIssues($journal, $issues);
				break;
			case 'exportArticle':
				$articleIds = array(array_shift($args));
				$articleSearch = new ArticleSearch();
				$result = $articleSearch->formatResults($articleIds);
				$this->exportArticles($result);
				break;
			case 'exportArticles':
				$articleIds = $request->getUserVar('articleId');
				if (!isset($articleIds)) $articleIds = array();
				$articleSearch = new ArticleSearch();
				$results = $articleSearch->formatResults($articleIds);
				$this->exportArticles($results);
				break;
			case 'issues':
				// Display a list of issues for export
				AppLocale::requireComponents(LOCALE_COMPONENT_APP_EDITOR);
				$issueDao = DAORegistry::getDAO('IssueDAO');
				$issues = $issueDao->getIssues($journal->getId(), Handler::getRangeInfo($this->getRequest(), 'issues'));

				$templateMgr->assign('issues', $issues);
				$templateMgr->display($this->getTemplatePath() . 'issues.tpl');
				break;
			case 'articles':
				// Display a list of articles for export
				$publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO');
				$rangeInfo = Handler::getRangeInfo($this->getRequest(), 'articles');
				$articleIds = $publishedArticleDao->getPublishedArticleIdsByJournal($journal->getId(), false);
				$totalArticles = count($articleIds);
				if ($rangeInfo->isValid()) $articleIds = array_slice($articleIds, $rangeInfo->getCount() * ($rangeInfo->getPage()-1), $rangeInfo->getCount());
				import('lib.pkp.classes.core.VirtualArrayIterator');
				$articleSearch = new ArticleSearch();
				$iterator = new VirtualArrayIterator($articleSearch->formatResults($articleIds), $totalArticles, $rangeInfo->getPage(), $rangeInfo->getCount());
				$templateMgr->assign('articles', $iterator);
				$templateMgr->display($this->getTemplatePath() . 'articles.tpl');
				break;
			default:
				$templateMgr->display($this->getTemplatePath() . 'index.tpl');
		}
	}

	function exportArticles(&$results, $outputFile = null) {
		$this->import('PubMedExportDom');
		$doc =& PubMedExportDom::generatePubMedDom();
		$articleSetNode =& PubMedExportDom::generateArticleSetDom($doc);

		foreach ($results as $result) {
			$journal =& $result['journal'];
			$issue =& $result['issue'];
			$section =& $result['section'];
			$article =& $result['publishedArticle'];

			$articleNode =& PubMedExportDom::generateArticleDom($doc, $journal, $issue, $section, $article);
			XMLCustomWriter::appendChild($articleSetNode, $articleNode);
		}

		if (!empty($outputFile)) {
			if (($h = fopen($outputFile, 'w'))===false) return false;
			fwrite($h, XMLCustomWriter::getXML($doc));
			fclose($h);
		} else {
			header("Content-Type: application/xml");
			header("Cache-Control: private");
			header("Content-Disposition: attachment; filename=\"pubmed.xml\"");
			XMLCustomWriter::printXML($doc);
		}
		return true;
	}

	function exportIssues(&$journal, &$issues, $outputFile = null) {
		$this->import('PubMedExportDom');
		$doc =& PubMedExportDom::generatePubMedDom();
		$articleSetNode =& PubMedExportDom::generateArticleSetDom($doc);

		$sectionDao = DAORegistry::getDAO('SectionDAO');
		$publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO');

		foreach ($issues as $issue) {
			foreach ($sectionDao->getByIssueId($issue->getId()) as $section) {
				foreach ($publishedArticleDao->getPublishedArticlesBySectionId($section->getId(), $issue->getId()) as $article) {
					$articleNode = PubMedExportDom::generateArticleDom($doc, $journal, $issue, $section, $article);
					XMLCustomWriter::appendChild($articleSetNode, $articleNode);
				}
			}
		}

		if (!empty($outputFile)) {
			if (($h = fopen($outputFile, 'w'))===false) return false;
			fwrite($h, XMLCustomWriter::getXML($doc));
			fclose($h);
		} else {
			header("Content-Type: application/xml");
			header("Cache-Control: private");
			header("Content-Disposition: attachment; filename=\"pubmed.xml\"");
			XMLCustomWriter::printXML($doc);
		}
		return true;
	}

	/**
	 * Execute import/export tasks using the command-line interface.
	 * @param $args Parameters to the plugin
	 */
	function executeCLI($scriptName, &$args) {
//		$command = array_shift($args);
		$xmlFile = array_shift($args);
		$journalPath = array_shift($args);

		$journalDao = DAORegistry::getDAO('JournalDAO');
		$issueDao = DAORegistry::getDAO('IssueDAO');
		$sectionDao = DAORegistry::getDAO('SectionDAO');
		$userDao = DAORegistry::getDAO('UserDAO');
		$publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO');

		$journal = $journalDao->getByPath($journalPath);

		if (!$journal) {
			if ($journalPath != '') {
				echo __('plugins.importexport.pubmed.cliError') . "\n";
				echo __('plugins.importexport.pubmed.error.unknownJournal', array('journalPath' => $journalPath)) . "\n\n";
			}
			$this->usage($scriptName);
			return;
		}

		if ($xmlFile != '') switch (array_shift($args)) {
			case 'articles':
				$articleSearch = new ArticleSearch();
				$results = $articleSearch->formatResults($args);
				if (!$this->exportArticles($results, $xmlFile)) {
					echo __('plugins.importexport.pubmed.cliError') . "\n";
					echo __('plugins.importexport.pubmed.export.error.couldNotWrite', array('fileName' => $xmlFile)) . "\n\n";
				}
				return;
			case 'issue':
				$issueId = array_shift($args);
				$issue = $issueDao->getByBestId($issueId, $journal->getId());
				if ($issue == null) {
					echo __('plugins.importexport.pubmed.cliError') . "\n";
					echo __('plugins.importexport.pubmed.export.error.issueNotFound', array('issueId' => $issueId)) . "\n\n";
					return;
				}
				$issues = array($issue);
				if (!$this->exportIssues($journal, $issues, $xmlFile)) {
					echo __('plugins.importexport.pubmed.cliError') . "\n";
					echo __('plugins.importexport.pubmed.export.error.couldNotWrite', array('fileName' => $xmlFile)) . "\n\n";
				}
				return;
		}
		$this->usage($scriptName);

	}

	/**
	 * Display the command-line usage information
	 */
	function usage($scriptName) {
		echo __('plugins.importexport.pubmed.cliUsage', array(
			'scriptName' => $scriptName,
			'pluginName' => $this->getName()
		)) . "\n";
	}
}

?>


text:
Pit Test Coverage Report

Package Summary

org.joda.time.field

            Number of Classes
            Line Coverage
            Mutation Coverage

            25
            79%

841/1062

            69%

655/946

Breakdown by Class

            Name
            Line Coverage
            Mutation Coverage

            AbstractPartialFieldProperty.java

100%

50/50

91%

43/47

            AbstractReadableInstantFieldProperty.java

97%

61/63

95%

53/56

            BaseDateTimeField.java

97%

168/173

93%

138/149

            BaseDurationField.java

100%

22/22

95%

18/19

            DecoratedDateTimeField.java

94%

15/16

91%

10/11

            DecoratedDurationField.java

56%

9/16

45%

5/11

            DelegatedDateTimeField.java

50%

32/64

29%

16/55

            DelegatedDurationField.java

0%

0/32

0%

0/28

            DividedDateTimeField.java

53%

31/58

18%

12/67

            FieldUtils.java

91%

77/85

88%

95/108

            ImpreciseDateTimeField.java

54%

19/35

37%

13/35

            LenientDateTimeField.java

73%

11/15

63%

5/8

            MillisDurationField.java

88%

29/33

90%

27/30

            OffsetDateTimeField.java

95%

35/37

78%

25/32

            PreciseDateTimeField.java

100%

21/21

96%

27/28

            PreciseDurationDateTimeField.java

100%

27/27

100%

42/42

            PreciseDurationField.java

100%

24/24

91%

21/23

            RemainderDateTimeField.java

57%

28/49

34%

14/41

            ScaledDurationField.java

100%

37/37

92%

36/39

            SkipDateTimeField.java

84%

21/25

59%

10/17

            SkipUndoDateTimeField.java

82%

18/22

44%

7/16

            StrictDateTimeField.java

31%

4/13

33%

3/9

            UnsupportedDateTimeField.java

100%

68/68

90%

19/21

            UnsupportedDurationField.java

56%

23/41

52%

11/21

            ZeroIsMaxDateTimeField.java

31%

11/36

15%

5/33

Report generated by PIT 1.1.11


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Beih. Nova Hedwigia 79: 507 (1984)

#### Original name
Microglaena rosea Servít

### Remarks
null


text:
<?php

namespace backend\models;

use Yii;

/**
 * This is the model class for table "program_history".
 *
 * @property integer $id
 * @property integer $revision
 * @property integer $satker_id
 * @property string $number
 * @property string $name
 * @property string $hours
 * @property integer $days
 * @property integer $test
 * @property string $note
 * @property string $stage
 * @property string $category
 * @property integer $validation_status
 * @property string $validation_note
 * @property integer $status
 * @property string $created
 * @property integer $created_by
 * @property string $modified
 * @property integer $modified_by
 */
class ProgramHistory extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'program_history';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['id', 'revision', 'satker_id', 'name'], 'required'],
            [['id', 'revision', 'satker_id', 'days', 'test', 'validation_status', 'status', 'created_by', 'modified_by'], 'integer'],
            [['hours'], 'number'],
            [['created', 'modified'], 'safe'],
            [['number'], 'string', 'max' => 15],
            [['name', 'note', 'stage', 'category', 'validation_note'], 'string', 'max' => 255]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', 'ID'),
            'revision' => Yii::t('app', 'Revision'),
            'satker_id' => Yii::t('app', 'Satker ID'),
            'number' => Yii::t('app', 'Number'),
            'name' => Yii::t('app', 'Name'),
            'hours' => Yii::t('app', 'Hours'),
            'days' => Yii::t('app', 'Days'),
            'test' => Yii::t('app', 'Test'),
            'note' => Yii::t('app', 'Note'),
            'stage' => Yii::t('app', 'Stage'),
            'category' => Yii::t('app', 'Category'),
            'validation_status' => Yii::t('app', 'Validation Status'),
            'validation_note' => Yii::t('app', 'Validation Note'),
            'status' => Yii::t('app', 'Status'),
            'created' => Yii::t('app', 'Created'),
            'created_by' => Yii::t('app', 'Created By'),
            'modified' => Yii::t('app', 'Modified'),
            'modified_by' => Yii::t('app', 'Modified By'),
        ];
    }

	public static function getRevision($id){
       return self::find()->where(['id' => $id,])->max('revision');
	}
}


text:
  Use Highcharts as the base library. All the changes and enhancements should be independent and be written as plugins.  Upgrading the library version should be only a config change (bumping up version number in some configuration file).

  I want to come up with a build structure and process so to suit the above requirement.

  So, the goals of this new build system would be:

 * Separate library code from user code
 * Make it easy to update library code
 * Ability to *watch* over changes made and have *live reload* facility - developers changing *source* code can directly see their changes on the browser - this will improve productivity.  Today they either work directly on the build, in which case they have to remember to copy their changes back to source or they work on the source and run then *build* - this build takes time.
 * Establish a clear pattern for the way plugins must be written
 * Generate documentation easily
 * Make it easy to add test cases
 * Consume the output of this module via a CDN.  Also, allow plugins developed to be accesible as individual node modules

## What this repo will not do
  The examples page is not integrated with this repo.  That will be part of a separate repo.

## Webpack
  This repo is built using webpack.  That means all code has to be written as compatible node modules as well.  This gives us flexibility to render on the server side as well.

** Handling non-conformant modules **
  If certain plugins depend upon other libraries which are not node modules,  we should wrap them in a node module or see if there is webpack support for handling non-node modules.

** Ways of extending Highcharts **
 * Either add it to the Highcharts prototype
 * Or write a wrapper function which does a certain set of things and export that wrapper
In this repo, both these methods will be followed.  Adding to the prototype is not a 'opt-in' - the very fact that you are using a flavored version of Highcharts means they will come by default.

###Running the server
 1. Run **gulp webpack** to build all assets
 1. **gulp dev-server ** can be used to live-reload all resources
 1. Other tasks can be found in the gulpfile.js file


text:
package main.activity;

import android.app.LoaderManager;
import android.content.ContentResolver;
import android.content.CursorLoader;
import android.content.Intent;
import android.content.Loader;
import android.database.Cursor;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.ContextMenu;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.CursorAdapter;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.SimpleCursorAdapter;
import android.widget.Toast;

import com.example.loubia.tp_meteo.R;

import main.model.City;
import main.model.CityDB;
import main.model.WeatherProvider;
import main.taskSync.AuthentificatorService;
import main.taskSync.SynchronizerAdapter;

import static main.model.City.custorToCity;

public class MainActivity extends AppCompatActivity implements LoaderManager.LoaderCallbacks<Cursor> {

    public static ContentResolver resolver;
    public static ProgressBar mProgressBar;

    protected static CursorAdapter adapter;
    private ListView mListView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        mListView = (ListView) findViewById(R.id.listView);
        mProgressBar = (ProgressBar) findViewById(R.id.pBAsync);
        setSupportActionBar(toolbar);

        resolver = getContentResolver();
        AuthentificatorService.CreateSyncAccount(this);

        String[] columns = new String[]{CityDB.COLUMN_NAME, CityDB.COLUMN_COUNTRY};
        int[] to = new int[]{android.R.id.text1, android.R.id.text2};
        Cursor cursor = resolver.query(WeatherProvider.CONTENT_URI, CityDB.projection, null, null, CityDB.sortOrder);

        adapter = new SimpleCursorAdapter(getApplicationContext(), android.R.layout.simple_list_item_2, cursor, columns, to, 0);

        mListView.setAdapter(adapter);
        getLoaderManager().initLoader(0, null, this);
        mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                adapter.getCursor().moveToPosition(position);
                Intent intent = new Intent(MainActivity.this, DetailsActivity.class);
                intent.putExtra("City", custorToCity(adapter.getCursor()));
                startActivity(intent);
            }
        });
        registerForContextMenu(mListView);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.menu_main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        int id = item.getItemId();

        if (id == R.id.action_add) {
            Intent intent = new Intent(MainActivity.this, AddCityActivity.class);
            startActivityForResult(intent, 1000);
            return true;
        }
        if (id == R.id.action_refresh) {
            Log.d("button refresh", "button pressed ");
            SynchronizerAdapter.performSync();
            return true;
        }

        return super.onOptionsItemSelected(item);
    }

    @Override
    public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
        super.onCreateContextMenu(menu, v, menuInfo);
        menu.add(0, v.getId(), 0, "Supprimer");//groupId, itemId, order, title
    }

    @Override
    public boolean onContextItemSelected(MenuItem item) {

        if (item.getTitle() == "Supprimer") {
            AdapterView.AdapterContextMenuInfo menuinfo = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
            long id = resolver.delete(WeatherProvider.CONTENT_URI, "_id = ? ", new String[]{adapter.getItemId(menuinfo.position) + ""});
            if (id != 0) {
                this.adapter.notifyDataSetChanged();
                Toast.makeText(getApplicationContext(), "Suppression reussit", Toast.LENGTH_SHORT).show();
            } else {
                Toast.makeText(getApplicationContext(), "Suppression échoué", Toast.LENGTH_SHORT).show();
            }
        }
        return true;
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {

        super.onActivityResult(requestCode, resultCode, data);

        if (requestCode == 1000 && resultCode == RESULT_OK) {
            try {
                getContentResolver().insert(WeatherProvider.CONTENT_URI, ((City) data.getSerializableExtra("City")).getContent());
                adapter.notifyDataSetChanged();
            } catch (Exception e)  {
                Toast.makeText(MainActivity.this, "Erreur lors de l'ajout", Toast.LENGTH_SHORT).show();
            }
        }
    }

    @Override
    public Loader<Cursor> onCreateLoader(int id, Bundle args) {
        return new CursorLoader(
                getApplicationContext(),
                WeatherProvider.CONTENT_URI,
                null,
                null,
                null,
                null
        );
    }

    @Override
    public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
        adapter.swapCursor(data);
    }

    @Override
    public void onLoaderReset(Loader<Cursor> loader) {
        adapter.swapCursor(null);
    }

}


text:
@interface UICollectionViewCell (Nib)

+ (UINib *)nib ;

@end


text:
FuzzyRecord searches through active records using fuzzy matchers and orders them based on FuzzyString.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'fuzzy_record'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install fuzzy_record

## Usage

To use for any active record model:

```ruby
    $ Model.fuzzy_search('string')
```

It will search through your model for records where the first of these that exists
(:fuzzy_name, :ident, :name) fuzzy_matches and order it by best match

Alternatively you can use a hash where the field to be searched is the key:

```ruby
    $ Model.fuzzy_search(title: 'string')
```

To make this the default behavior for your model simply add the definition:

```ruby
    $ def self.fuzzy_search(str) super(title: str) end
```

## Contributing

1. Fork it ( https://github.com/[my-github-username]/fuzzy_record/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request

Author
-------

* Chris Moody

License
-------

This is free software released into the public domain.


text:
'use strict';
angular.module('jizhiApp')
.controller('diaryNewCtrl',['$scope','jzDiary','$location',function($scope,jzDiary,$location){
    var myDate=new Date();
    $scope.now=myDate.getTime();
    $scope.diary={};
    $scope.diary.getup=myDate;
    $scope.diary.sleep=myDate;
    $scope.saveDiary=function(){
    	// change format
    	$scope.diary.getup=$scope.diary.getup.getTime();
    	$scope.diary.sleep=$scope.diary.sleep.getTime();

    	jzDiary.post($scope.diary).then(function(result){
    		$scope.addAlert('success','更新成功');
    		$location.path('/diary/'+result.id);
    	},function(err){
    		$scope.addAlert('error',err.message);
    	});
    }
}])
.controller('diaryViewCtrl',['$scope','jzDiary','$routeParams',function($scope,jzDiary,$routeParams){
   $scope.diary={};
   jzDiary.query({id:$routeParams.did}).then(function(result){
   	$scope.diary=result;
   })
   $scope.updateDiary=function(){
   	console.log($scope.diary);
   	jzDiary.update($routeParams.did,$scope.diary).then(function(){
   		$scope.addAlert('success','更新成功');
   		$scope.diary.edit=false;
   	},function(err){
   		$scope.addAlert('error',err.message);
   	})
   }
}])
.controller('diaryArchiveCtrl',['$scope','jzDiary','$filter',function($scope,jzDiary,$filter){
	$scope.drawCal=function(y,m){
		var first_day=new Date(y,m,1).getDay(),
		    final_day=new Date(y,m+1,0).getDate(),
		    last_day=new Date(y,m,0).getDate(),
		    surplus=42-first_day-final_day;

		// calculater last month days
	    	$scope.lastdays=[];
	    	for(var i=0;i<first_day;i++){
	    		$scope.lastdays[i]=last_day-(first_day-1)+i;
	    	}
	      	//calculate this month days
	      	 $scope.monthdays=[];
	      	for(var j=0;j<final_day;j++){
	       	// check if numbers in the array
	       	   	$scope.monthdays[j]={num:j+1,id:''};
	       }
	       // get exsiting days in this month
	    jzDiary.query({date:{$gt:new Date(y,m,1).getTime(),$lt:new Date(y,m+1,0).getTime()}}).then(function(result){
	    	for(var l=0;l<result.length;l++){
	    		var exd=$filter('date')(result[l].date,['d']);
	    		$scope.monthdays[exd-1]={num:exd,id:result[l].id};
	    	}
	    })
	    // calculate the surplue
	       $scope.nextdays=[];
	       for(var k=0;k<surplus;k++){
	       	$scope.nextdays[k]=k+1;
	       }
  }// end of draw cal

   // drawcal of this month
   var date=new Date();
   $scope.year=date.getFullYear(),
   $scope.month=date.getMonth();
   $scope.drawCal($scope.year,$scope.month);
    $scope.preCal=function(){
      $scope.month=$scope.month-1;
      $scope.drawCal($scope.year,$scope.month);
    }
    $scope.nextCal=function(){
      $scope.month=$scope.month+1;
      $scope.drawCal($scope.year,$scope.month);
    }

}]);


text:
//  See http://www.boost.org/libs/test for the library home page.

//[example_code
#define BOOST_TEST_MODULE boost_test_container_lex_default
#include <boost/test/included/unit_test.hpp>
#include <vector>

namespace tt = boost::test_tools;

BOOST_TEST_SPECIALIZED_COLLECTION_COMPARE(std::vector<int>);

BOOST_AUTO_TEST_CASE( test_collections_vectors_lex )
{
  std::vector<int> a{1,2,3}, b{1,2,2};
  std::vector<long int> c{1,2,3,5}, d{1,2,3,4};

  BOOST_TEST(a < a); // extended diagnostic
  BOOST_TEST(a < b); // extended diagnostic
  BOOST_TEST(c < d); // no extended diagnostic
}
//]


text:
title: Table of contents
template: landing-page.jade
filename: index.html
---


text:
@interface TimerViewController : UIViewController

@property (strong, nonatomic) TimerViewModel* timerViewModel;

@end


text:
<?php

namespace Fran\UserBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;

class DefaultController extends Controller
{
    /**
     * @Route("/secured/", name="secured_home")
     * @Template()
     */
    public function indexAction()
    {
    	$name = $this->get('security.context')->getToken()->getUser()->getUsername();
        return array('name' => $name);
    }
}


text:
package org.apache.geronimo.security.realm.providers;

public class HeaderMismatchException extends Exception {

    public HeaderMismatchException(String hostName){
        super("The request originated from Host " +
                hostName +
                "does not have valid headers.");
    }
}


text:
<?php

namespace Omelet\Module;

use Doctrine\DBAL\Logging\SQLLogger;
use Psr\Log\LoggerInterface;

class SqlLoggerPsr3Adapter implements SQLLogger
{
    /**
     * @var LoggerInterface
     */
    private $logger;

    public function __construct(LoggerInterface $logger)
    {
        $this->logger = $logger;
    }

    /**
     * {@inheritdoc}
     */
    public function startQuery($sql, array $params = null, array $types = null)
    {
        $p = $params !== null ? sprintf('[%s]', implode(', ', $params)) : 'none)';
        $this->logger->debug("Query started :\n(sql) => \n{$sql}\n(parameters) => \n{$p}\n");
    }

    /**
     * {@inheritdoc}
     */
    public function stopQuery()
    {
        $this->logger->debug('Query stopped');
    }
}


text:
package com.google.appinventor.client.utils;

import com.google.gwt.core.client.JsArrayInteger;
import com.google.gwt.dom.client.Element;
import com.google.gwt.user.client.ui.PopupPanel;

/**
 * Implementation of PopupPanel.PositionCallback that can be alerted
 * when the browser is Pinch Zoomed in Google Chrome. Pinch Zooming in Chrome
 * causes both UIObject#getAbsoluteLeft() and UIObject#getAbsoluteTop() to return
 * inaccurate values. This class contains patched implementations for each.
 *
 * @author William Byrne
 */
public abstract class PZAwarePositionCallback implements PopupPanel.PositionCallback {
    // Pinch Zoom flag which is tripped by a handler in Ode.java
    private static boolean pinchZoomed = false;

    // Element of the enclosing instance
    private final Element elem;

    public PZAwarePositionCallback(Element elem) {
        this.elem = elem;
    }

    public static boolean isPinchZoomed() { return pinchZoomed; }

    public static void setPinchZoomed(boolean pinchZoomed) { PZAwarePositionCallback.pinchZoomed = pinchZoomed; }

    public int getTrueAbsoluteLeft() { return getAbsolutePosition(elem).get(0); }

    public int getTrueAbsoluteTop() { return getAbsolutePosition(elem).get(1); }

    //  Helper used to accurately determine the absolute left and absolute top
    //  of the Element for use in positioning. Pinch Zooming breaks GWT's built-in
    //  equivalents, DOMImpl#getSubPixelAbsoluteLeft(Element) and
    //  DOMImpl#getSubPixelAbsoluteTop(Element).
    private native JsArrayInteger getAbsolutePosition(Element elem) /*-{
        var curr = elem;
        var left = 0;
        var top = 0;

        if ($doc.getElementById) {
            do  {
                left += elem.offsetLeft - elem.scrollLeft;
                top += elem.offsetTop - elem.scrollTop;

                elem = elem.offsetParent;
                curr = curr.parentNode;
                while (curr != elem) {
                    left -= curr.scrollLeft;
                    top -= curr.scrollTop;

                    curr = curr.parentNode;
                }
            } while (elem.offsetParent);
        }

        return [left, top];
    }-*/;
}


text:
class FieldDefaultsViaConfigAndRequiredArgsConstructor {
	final int x;
	@java.beans.ConstructorProperties({"x"})
	@java.lang.SuppressWarnings("all")
	@javax.annotation.Generated("lombok")
	public FieldDefaultsViaConfigAndRequiredArgsConstructor(final int x) {
		this.x = x;
	}
}


text:
package io.cdap.plugin.gcp.spanner.source;

import com.google.cloud.ByteArray;
import com.google.cloud.Date;
import com.google.cloud.Timestamp;
import com.google.cloud.spanner.ResultSet;
import com.google.cloud.spanner.Type;
import com.google.common.base.Charsets;
import io.cdap.cdap.api.data.format.StructuredRecord;
import io.cdap.cdap.api.data.format.UnexpectedFormatException;
import io.cdap.cdap.api.data.schema.Schema;
import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mockito;

import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.List;

public class ResultSetToRecordTransformerTest {
  private static final Schema TEST_SCHEMA = Schema.recordOf(
    "test",
    Schema.Field.of("bool_filed", Schema.of(Schema.Type.BOOLEAN)),
    Schema.Field.of("int_field", Schema.of(Schema.Type.LONG)),
    Schema.Field.of("float_field", Schema.of(Schema.Type.DOUBLE)),
    Schema.Field.of("string_field", Schema.of(Schema.Type.STRING)),
    Schema.Field.of("bytes_field", Schema.of(Schema.Type.BYTES)),
    Schema.Field.of("date_field", Schema.of(Schema.LogicalType.DATE)),
    Schema.Field.of("timestamp_field", Schema.of(Schema.LogicalType.TIMESTAMP_MICROS)),
    Schema.Field.of("bool_array", Schema.arrayOf(Schema.of(Schema.Type.BOOLEAN))),
    Schema.Field.of("int_array", Schema.arrayOf(Schema.of(Schema.Type.LONG))),
    Schema.Field.of("float_array", Schema.arrayOf(Schema.of(Schema.Type.DOUBLE))),
    Schema.Field.of("string_array", Schema.arrayOf(Schema.of(Schema.Type.STRING))),
    Schema.Field.of("bytes_array", Schema.arrayOf(Schema.of(Schema.Type.BYTES))),
    Schema.Field.of("datetime_field", Schema.of(Schema.LogicalType.DATETIME))
  );

  @Test
  public void testTransform() {
    ResultSet rsMock = Mockito.mock(ResultSet.class);

    Mockito.when(rsMock.getColumnType("bool_filed")).thenReturn(Type.bool());
    Mockito.when(rsMock.isNull("bool_filed")).thenReturn(false);
    Mockito.when(rsMock.getBoolean("bool_filed")).thenReturn(true);

    Mockito.when(rsMock.getColumnType("int_field")).thenReturn(Type.int64());
    Mockito.when(rsMock.isNull("int_field")).thenReturn(false);
    Mockito.when(rsMock.getLong("int_field")).thenReturn(1234L);

    Mockito.when(rsMock.getColumnType("float_field")).thenReturn(Type.float64());
    Mockito.when(rsMock.isNull("float_field")).thenReturn(false);
    Mockito.when(rsMock.getDouble("float_field")).thenReturn(1.1234);

    Mockito.when(rsMock.getColumnType("string_field")).thenReturn(Type.string());
    Mockito.when(rsMock.isNull("string_field")).thenReturn(false);
    Mockito.when(rsMock.getString("string_field")).thenReturn("test");

    Mockito.when(rsMock.getColumnType("bytes_field")).thenReturn(Type.bytes());
    Mockito.when(rsMock.isNull("bytes_field")).thenReturn(false);
    Mockito.when(rsMock.getBytes("bytes_field")).thenReturn(ByteArray.copyFrom("test"));

    LocalDate expectedDate = LocalDate.now();
    Mockito.when(rsMock.getColumnType("date_field")).thenReturn(Type.date());
    Mockito.when(rsMock.isNull("date_field")).thenReturn(false);
    Mockito.when(rsMock.getDate("date_field")).thenReturn(Date.fromYearMonthDay(
      expectedDate.getYear(),
      expectedDate.getMonthValue(),
      expectedDate.getDayOfMonth()
    ));

    Instant timestampInstant = Instant.now();
    ZonedDateTime expectedTime = ZonedDateTime.ofInstant(timestampInstant, ZoneId.of("UTC"));
    Timestamp timestamp = Timestamp.ofTimeSecondsAndNanos(
      timestampInstant.getEpochSecond(),
      timestampInstant.getNano()
    );
    Mockito.when(rsMock.getColumnType("timestamp_field")).thenReturn(Type.timestamp());
    Mockito.when(rsMock.isNull("timestamp_field")).thenReturn(false);
    Mockito.when(rsMock.getTimestamp("timestamp_field")).thenReturn(timestamp);

    List<Boolean> expectedBoolList = Arrays.asList(true, false, null);
    Mockito.when(rsMock.getColumnType("bool_array")).thenReturn(Type.array(Type.bool()));
    Mockito.when(rsMock.isNull("bool_array")).thenReturn(false);
    Mockito.when(rsMock.getBooleanList("bool_array")).thenReturn(expectedBoolList);

    List<Long> expectedIntList = Arrays.asList(1234L, 1234L, null);
    Mockito.when(rsMock.getColumnType("int_array")).thenReturn(Type.array(Type.int64()));
    Mockito.when(rsMock.isNull("int_array")).thenReturn(false);
    Mockito.when(rsMock.getLongList("int_array")).thenReturn(expectedIntList);

    List<Double> expectedFloatList = Arrays.asList(1.1234, 1.1234, null);
    Mockito.when(rsMock.getColumnType("float_array")).thenReturn(Type.array(Type.float64()));
    Mockito.when(rsMock.isNull("float_array")).thenReturn(false);
    Mockito.when(rsMock.getDoubleList("float_array")).thenReturn(expectedFloatList);

    List<String> expectedStringList = Arrays.asList("1", "2", null);
    Mockito.when(rsMock.getColumnType("string_array")).thenReturn(Type.array(Type.string()));
    Mockito.when(rsMock.isNull("string_array")).thenReturn(false);
    Mockito.when(rsMock.getStringList("string_array")).thenReturn(expectedStringList);

    Mockito.when(rsMock.getColumnType("bytes_array")).thenReturn(Type.array(Type.bytes()));
    Mockito.when(rsMock.isNull("bytes_array")).thenReturn(false);
    Mockito.when(rsMock.getBytesList("bytes_array")).thenReturn(Arrays.asList(
      ByteArray.copyFrom("1"),
      ByteArray.copyFrom("2"),
      null)
    );

    LocalDateTime datetime = LocalDateTime.now();
    String formattedDatetime = datetime.format(DateTimeFormatter.ISO_DATE_TIME);
    Mockito.when(rsMock.getColumnType("datetime_field")).thenReturn(Type.string());
    Mockito.when(rsMock.getString("datetime_field")).thenReturn(formattedDatetime);

    ResultSetToRecordTransformer transformer = new ResultSetToRecordTransformer(TEST_SCHEMA);
    StructuredRecord record = transformer.transform(rsMock);

    Assert.assertEquals(1234L, (long) record.get("int_field"));
    Assert.assertTrue(record.get("bool_filed"));
    Assert.assertEquals(1.1234, record.get("float_field"), 0.00001);
    Assert.assertEquals("test", record.get("string_field"));
    Assert.assertEquals("test", new String(record.get("bytes_field"), Charsets.UTF_8));
    Assert.assertEquals(expectedDate, record.getDate("date_field"));
    Assert.assertEquals(expectedTime, record.getTimestamp("timestamp_field"));
    Assert.assertArrayEquals(expectedBoolList.toArray(), record.get("bool_array"));
    Assert.assertArrayEquals(expectedIntList.toArray(), record.get("int_array"));
    Assert.assertArrayEquals(expectedFloatList.toArray(), record.get("float_array"));
    Assert.assertArrayEquals(expectedStringList.toArray(), record.get("string_array"));
    Assert.assertArrayEquals(new byte[][]{"1".getBytes(), "2".getBytes(), null}, record.get("bytes_array"));
    Assert.assertEquals(formattedDatetime, record.get("datetime_field"));
  }

  @Test(expected = UnexpectedFormatException.class)
  public void testInvalidDateTime() {
    Schema testSchema = Schema
      .recordOf("record", Schema.Field.of("datetime_field", Schema.of(Schema.LogicalType.DATETIME)));
    ResultSet rsMock = Mockito.mock(ResultSet.class);
    Mockito.when(rsMock.getColumnType("datetime_field")).thenReturn(Type.string());
    //date time not in ISO-8601 format
    Mockito.when(rsMock.getString("datetime_field")).thenReturn("2020-10-10 09:08:10");
    new ResultSetToRecordTransformer(testSchema).transform(rsMock);
  }
}


text:
<?php

namespace Proxies\__CG__\Sisgec\GestionEquipoBundle\Entity;

/**
 * THIS CLASS WAS GENERATED BY THE DOCTRINE ORM. DO NOT EDIT THIS FILE.
 */
class Dsolicitudstc extends \Sisgec\GestionEquipoBundle\Entity\Dsolicitudstc implements \Doctrine\ORM\Proxy\Proxy
{
    private $_entityPersister;
    private $_identifier;
    public $__isInitialized__ = false;
    public function __construct($entityPersister, $identifier)
    {
        $this->_entityPersister = $entityPersister;
        $this->_identifier = $identifier;
    }
    /** @private */
    public function __load()
    {
        if (!$this->__isInitialized__ && $this->_entityPersister) {
            $this->__isInitialized__ = true;

            if (method_exists($this, "__wakeup")) {
                // call this after __isInitialized__to avoid infinite recursion
                // but before loading to emulate what ClassMetadata::newInstance()
                // provides.
                $this->__wakeup();
            }

            if ($this->_entityPersister->load($this->_identifier, $this) === null) {
                throw new \Doctrine\ORM\EntityNotFoundException();
            }
            unset($this->_entityPersister, $this->_identifier);
        }
    }

    /** @private */
    public function __isInitialized()
    {
        return $this->__isInitialized__;
    }

    public function getDsolicitudstcId()
    {
        if ($this->__isInitialized__ === false) {
            return (int) $this->_identifier["dsolicitudstcId"];
        }
        $this->__load();
        return parent::getDsolicitudstcId();
    }

    public function setObservaciones($observaciones)
    {
        $this->__load();
        return parent::setObservaciones($observaciones);
    }

    public function getObservaciones()
    {
        $this->__load();
        return parent::getObservaciones();
    }

    public function setEquipo(\Sisgec\GestionEquipoBundle\Entity\Equipo $equipo = NULL)
    {
        $this->__load();
        return parent::setEquipo($equipo);
    }

    public function getEquipo()
    {
        $this->__load();
        return parent::getEquipo();
    }

    public function setSolcitudstc(\Sisgec\GestionEquipoBundle\Entity\Solcitudstc $solcitudstc = NULL)
    {
        $this->__load();
        return parent::setSolcitudstc($solcitudstc);
    }

    public function getSolcitudstc()
    {
        $this->__load();
        return parent::getSolcitudstc();
    }

    public function __sleep()
    {
        return array('__isInitialized__', 'dsolicitudstcId', 'observaciones', 'equipo', 'solcitudstc');
    }

    public function __clone()
    {
        if (!$this->__isInitialized__ && $this->_entityPersister) {
            $this->__isInitialized__ = true;
            $class = $this->_entityPersister->getClassMetadata();
            $original = $this->_entityPersister->load($this->_identifier);
            if ($original === null) {
                throw new \Doctrine\ORM\EntityNotFoundException();
            }
            foreach ($class->reflFields as $field => $reflProperty) {
                $reflProperty->setValue($this, $reflProperty->getValue($original));
            }
            unset($this->_entityPersister, $this->_identifier);
        }

    }
}


text:
FOUNDATION_EXPORT double BusyNavigationBarVersionNumber;
FOUNDATION_EXPORT const unsigned char BusyNavigationBarVersionString[];


text:
namespace ork
{
	std::string FormatString( const char* formatstring, ... );
	void SplitString(const std::string& s, char delim, std::vector<std::string>& tokens);
	std::vector<std::string> SplitString(const std::string& instr, char delim);
}


text:
<! html>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>有限排程</title>

    <link href="../Shared/Libs/jquery-ui/jquery-ui.min.css"
        rel="stylesheet" type="text/css" />

    <link href="../Shared/Libs/layout/layout-default.css"      rel="stylesheet" type="text/css" />

    <link href="../Shared/Libs/jqgrid/ui.jqgrid.css"        rel="stylesheet" type="text/css" />

    <link href="../Shared/Libs/handsontable/handsontable.full.css"        rel="stylesheet" type="text/css" />

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

                首页

                保存

                产能调整

排产

重排

同步数据

                设置


text:
package org.apache.phoenix.util;

import org.apache.phoenix.compile.GroupByCompiler.GroupBy;
import org.apache.phoenix.optimize.Cost;
import org.apache.phoenix.query.QueryServices;

/**
 * Utilities for computing costs.
 *
 * Some of the methods here should eventually be replaced by a metadata framework which
 * estimates output metrics for each QueryPlan or operation, e.g. row count, byte count,
 * etc.
 */
public class CostUtil {

    // An estimate of the ratio of result data from group-by against the input data.
    private final static double GROUPING_FACTOR = 0.1;

    // Io operations conducted in intermediate evaluations like sorting or aggregation
    // should be counted twice since they usually involve both read and write.
    private final static double IO_COST_MULTIPLIER = 2.0;

    /**
     * Estimate the number of output bytes of an aggregate.
     * @param byteCount the number of input bytes
     * @param groupBy the compiled GroupBy object
     * @param aggregatorsSize the byte size of aggregators
     * @return the output byte count
     */
    public static double estimateAggregateOutputBytes(
            double byteCount, GroupBy groupBy, int aggregatorsSize) {
        if (groupBy.isUngroupedAggregate()) {
            return aggregatorsSize;
        }
        return byteCount * GROUPING_FACTOR;
    }

    /**
     * Estimate the cost of an aggregate.
     * @param byteCount the number of input bytes
     * @param groupBy the compiled GroupBy object
     * @param aggregatorsSize the byte size of aggregators
     * @param parallelLevel number of parallel workers or threads
     * @return the cost
     */
    public static Cost estimateAggregateCost(
            double byteCount, GroupBy groupBy, int aggregatorsSize, int parallelLevel) {
        double outputBytes = estimateAggregateOutputBytes(byteCount, groupBy, aggregatorsSize);
        double orderedFactor = groupBy.isOrderPreserving() ? 0.2 : 1.0;
        return new Cost(0, 0, outputBytes * orderedFactor * IO_COST_MULTIPLIER / parallelLevel);
    }

    /**
     * Estimate the cost of an order-by
     * @param byteCount the number of input bytes
     * @param parallelLevel number of parallel workers or threads
     * @return the cost
     */
    public static Cost estimateOrderByCost(double byteCount, int parallelLevel) {
        return new Cost(0, 0, byteCount * IO_COST_MULTIPLIER / parallelLevel);
    }

    /**
     * Estimate the parallel level of an operation
     * @param runningOnServer if the operation will be running on server side
     * @param services the QueryServices object
     * @return the parallel level
     */
    public static int estimateParallelLevel(boolean runningOnServer, QueryServices services) {
        // TODO currently return constants for simplicity, should derive from cluster config.
        return runningOnServer ? 10 : 1;
    }
}


text:
package com.twu.biblioteca;

import org.junit.Test;

import java.util.ArrayList;

import static org.junit.Assert.assertEquals;

public class UserInterfaceTest {

    String bookListString = "Title                           Author                          Year\n"+
                            "1984                          | George Orwell                 | 1949\n"+
                            "Lolita                        | Vladmir Nabokov               | 1955\n"+
                            "The Old Patagonian Express    | Paul Theroux                  | 1979\n";

    String movieListString ="Title                           Director                        Year  Rating\n"+
                            "Nosferatu                     | F.W. Murnau                   | 1922| 8\n"+
                            "Samurai Cop                   | Amir Shervan                  | 1991| unrated\n"+
                            "Pi                            | Darren Aronofsky              | 1998| 7\n";

    String bookListStringWithout1984 =   "Title                           Author                          Year\n"+
            "Lolita                        | Vladmir Nabokov               | 1955\n"+
            "The Old Patagonian Express    | Paul Theroux                  | 1979\n";

    String menuString = "Choose from the following options and press enter:\n" +
            "1. List Books\n" +
            "2. Checkout Book\n" +
            "3. Return Book\n" +
            "4. List Movies\n" +
            "5. Checkout Movie\n" +
            "6. Return Movie\n" +
            "7. View Contact Information\n" +
            "0. Quit";

    User user = new User("123-4567", "abc", "a@b.com\n0411111111");
    ArrayList<BorrowableItem> bl = new Library().getBookList();
    ArrayList<BorrowableItem> ml = new Library().getMovieList();
    UserInterface ui = new UserInterface(bl, ml);

    @Test
    public void testGetWelcomeMessage() {
        String welcomeMessage = "Welcome to Biblioteca, an interactive Library Management System";
        assertEquals(welcomeMessage, ui.getWelcomeMessage());
    }

    @Test
    public void testGetBookList(){
        assertEquals(bookListString , ui.getBookListString());
    }

    @Test
    public void testGetMainMenu(){
        assertEquals(menuString, ui.getMenuString());
    }

    @Test
    public void testListBooksSelection(){
        assertEquals(bookListString, ui.getMenuOption(1, user));
    }

    @Test
    public void testInvalidMenuSelection(){
        assertEquals("Select a valid option!", ui.getMenuOption(9, user));
    }

    @Test
    public void testQuitMessage(){
        assertEquals("", ui.getMenuOption(0, user));
    }

    @Test
    public void testListBooksAfterCheckout(){
        ArrayList<BorrowableItem> blWithCheckout = bl;
        blWithCheckout.get(0).checkOut();
        UserInterface uiWithCheckout = new UserInterface(blWithCheckout, ml);
        assertEquals(bookListStringWithout1984, uiWithCheckout.getMenuOption(1, user));
    }
    @Test
    public void testInitialBookCheckoutMenu(){
        String checkoutMenu = "Which book is being checked out? Make a selection.\n"+
                "1. 1984                          | George Orwell                 | 1949\n" +
                "2. Lolita                        | Vladmir Nabokov               | 1955\n" +
                "3. The Old Patagonian Express    | Paul Theroux                  | 1979\n";
        assertEquals(checkoutMenu, ui.getMenuOption(2, user));
    }

    @Test
    public void testCheckoutSuccessMessage(){
        assertEquals(ui.checkOutBookMenuSelection(1, user), "Thank you! Enjoy the book.");
    }

    @Test
    public void testCheckoutFailureMessage(){
        ArrayList<BorrowableItem> blWithCheckout = bl;
        blWithCheckout.get(0).checkOut();
        UserInterface uiWithCheckout = new UserInterface(blWithCheckout, ml);
        assertEquals(uiWithCheckout.checkOutBookMenuSelection(1, user), "That book is not available.");
    }

    @Test
    public void testInitialReturnMenu(){
        String checkoutMenu = "Which book is being returned? Make a selection.\n"+
                "1. 1984                          | George Orwell                 | 1949\n" +
                "2. Lolita                        | Vladmir Nabokov               | 1955\n" +
                "3. The Old Patagonian Express    | Paul Theroux                  | 1979\n";
        assertEquals(checkoutMenu, ui.getMenuOption(3, user));
    }

    @Test
    public void testReturnSuccessMessage(){
        ArrayList<BorrowableItem> blWithCheckout = bl;
        blWithCheckout.get(0).checkOut();
        UserInterface uiWithCheckout = new UserInterface(blWithCheckout, ml);
        assertEquals(uiWithCheckout.returnBookMenuSelection(1, user), "Thank you for returning the book.");
    }

    @Test
    public void testReturnFailureMenu(){
        assertEquals(ui.returnBookMenuSelection(1, user), "That is not a valid book to return.");
    }

    @Test
    public void testGetMovieList(){
        assertEquals(movieListString, ui.getMovieListString());
    }

    @Test
    public void testInitialMovieCheckoutList(){
        String menu = "Which movie is being checked out? Make a selection.\n" +
                "1. Nosferatu                     | F.W. Murnau                   | 1922| 8\n"+
                "2. Samurai Cop                   | Amir Shervan                  | 1991| unrated\n"+
                "3. Pi                            | Darren Aronofsky              | 1998| 7\n";

        assertEquals(menu, ui.getMenuOption(5, user));
    }

    @Test
    public void testGetUserInformation(){
        assertEquals("a@b.com\n0411111111", ui.getMenuOption(7, user));
    }

}


text:
from math import sqrt

import shapefile
from shapely.geometry import asShape
from shapely.geometry import mapping

def shape_to_shply(shp_path):
    shape_reader = shapefile.Reader(shp_path)
    features = shape_reader.shapeRecords()

    if shape_reader.numRecords > 1:
        shply_list = []
        for feature in features:
            shply_obj = asShape(feature.shape.__geo_interface__)
            shply_list.append(shply_obj)

        # print shply_list
        return shply_list
    else:
        shply_object = shape_reader.shape()
        print "only one record"
        print shply_object
        return shply_object

def shply_to_shape(shply_obj_list, out_path):
    """
    outpath looks like this out_path = r"../geodata/split_up_poly_circle.shp"
    :param shply_obj_list:
    :param out_path:
    :return:
    """
    pyshp_writer = shapefile.Writer()
    pyshp_writer.field("name")
    if len(shply_obj_list) > 1:
        for feature in shply_obj_list:
            geojson = mapping(feature)

            # create empty pyshp shape
            record = shapefile._Shape()

            # shapeType 3 is Mulitlinestring
            # shapeType 8 is Multipolygon
            # shapeType 5 is Polygon
            record.shapeType = 5
            record.points = geojson["coordinates"][0]
            record.parts = [0]

            pyshp_writer._shapes.append(record)
            # add a list of attributes to go along with the shape
            pyshp_writer.record(["empty record"])
    else:
        geojson = mapping(shply_obj_list[0])
        # create empty pyshp shape
        record = shapefile._Shape()

        # shapeType 3 is Mulitlinestring
        # shapeType 8 is Multipolygon
        # shapeType 5 is Polygon
        record.shapeType = 5
        record.points = geojson["coordinates"][0]
        record.parts = [0]

        pyshp_writer._shapes.append(record)
        # add a list of attributes to go along with the shape
        pyshp_writer.record(["empty record"])

    pyshp_writer.save(out_path)

# calculate the size of our matplotlib output
GM = (sqrt(5) - 1.0) / 2.0
W = 8.0
H = W * GM
SIZE = (W, H)

# colors for our plots as hex
GRAY = '#B2B3B7'
BLUE = '#6699cc'
YELLOW = '#ffe680'
RED = '#FF1813'
GREEN = '#24CD17'

# functions slightly modified from Sean Gilles http://toblerity.org/shapely/
# used for drawing our results using matplotlib

# matplotlib makers http://matplotlib.org/api/markers_api.html
def plot_coords_line(axis, object, color='#00b700',
                     symbol='o', label="text", mew=1, ms=7):
    """
    mew = marker edge width in points
    ms = marke size in points

    """
    x, y = object.xy
    axis.plot(x, y, symbol, label=label, color=color,
              mew=mew, ms=ms, zorder=1)

def plot_coords_lines(axis, object, color='#999999'):
    for linestring in object:
        x, y = linestring.xy
        axis.plot(x, y, 'o', color=color, zorder=2)

def plot_line(axis, object, color='#00b700', ls='-',
              linewidth=2, c='g'):
    """
    ls is the line style options :[ '-' | '--' | '-.' | ':' | 'steps' | ...]
    """
    x, y = object.xy
    axis.plot(x, y, color=color, linewidth=linewidth, ls=ls, c=c, zorder=1)

def plot_lines(axis, object, color='#00b700'):
    for line in object:
        x, y = line.xy
        axis.plot(x, y, color=color, alpha=0.4, linewidth=1,
                  solid_capstyle='round', zorder=2)

def set_plot_bounds(object, offset=1.0):
    """
    Creates the limits for x and y axis plot

    :param object: input shapely geometry
    :param offset: amount of space around edge of features
    :return: dictionary of x-range and y-range values for
    """
    bounds = object.bounds
    x_min = bounds[0]
    y_min = bounds[1]
    x_max = bounds[2]
    y_max = bounds[3]
    x_range = [x_min - offset, x_max + offset]
    y_range = [y_min - offset, y_max + offset]

    return {'xrange': x_range, 'yrange': y_range}


text:
package com.intellij.openapi.diagnostic;

/**
 * @author kir
 */
public interface ErrorLogger {

  boolean canHandle(IdeaLoggingEvent event);

  /** Error event handling occures in a separate thread. */
  void handle(IdeaLoggingEvent event);
}


text:
package org.llvm;

import org.bridj.Pointer;

import static org.llvm.binding.LLVMLibrary.*;

/**
 * This represents a single basic block in LLVM. A basic block is simply a
 * container of instructions that execute sequentially.
 */
public class BasicBlock {
    private LLVMBasicBlockRef bb;

    LLVMBasicBlockRef bb() {
        return bb;
    }

    BasicBlock(LLVMBasicBlockRef bb) {
        this.bb = bb;
    }

    /**
     * Convert a basic block instance to a value type.
     */
    public Value basicBlockAsValue() {
        return new Value(LLVMBasicBlockAsValue(bb));
    }

    /**
     * Obtain the function to which a basic block belongs.

     *
     * @see llvm::BasicBlock::getParent()
     */
    public Value getBasicBlockParent() {
        return new Value(LLVMGetBasicBlockParent(bb));
    }

    /**
     * Advance a basic block iterator.
     */
    public BasicBlock getNextBasicBlock() {
        return new BasicBlock(LLVMGetNextBasicBlock(bb));
    }

    /**
     * Go backwards in a basic block iterator.
     */
    public BasicBlock getPreviousBasicBlock() {
        return new BasicBlock(LLVMGetPreviousBasicBlock(bb));
    }

    /**
     * Insert a new basic block before this basic block, and return it.
     */
    public BasicBlock insertBasicBlock(String name) {
        return new BasicBlock(LLVMInsertBasicBlock(bb,
                Pointer.pointerToCString(name)));
    }

    /**
     * Insert a new basic block before this basic block, and return it
     */
    public BasicBlock InsertBasicBlockInContext(Context c, String name) {
        return new BasicBlock(LLVMInsertBasicBlockInContext(c.context(), bb,
                Pointer.pointerToCString(name)));
    }

    /**
     * Remove a basic block from a function and delete it.

     * This deletes the basic block from its containing function and deletes

     * the basic block itself.

     *
     * @see llvm::BasicBlock::eraseFromParent()
     */
    public void deleteBasicBlock() {
        LLVMDeleteBasicBlock(bb);
    }

    /**
     * Move a basic block to before another one.

     *
     * @see llvm::BasicBlock::moveBefore()
     */
    public void moveBasicBlockBefore(BasicBlock movePos) {
        LLVMMoveBasicBlockBefore(bb, movePos.bb());
    }

    /**
     * Move a basic block to after another one.

     *
     * @see llvm::BasicBlock::moveAfter()
     */
    public void moveBasicBlockAfter(BasicBlock movePos) {
        LLVMMoveBasicBlockAfter(bb, movePos.bb());
    }

    /**
     * Obtain the first instruction in a basic block.

     * The returned LLVMValueRef corresponds to a llvm::Instruction

     * instance.
     */
    public Value getFirstInstruction() {
        return new Value(LLVMGetFirstInstruction(bb));
    }

    /**
     * Obtain the last instruction in a basic block.

     * The returned LLVMValueRef corresponds to a LLVM:Instruction.
     */
    public Value getLastInstruction() {
        return new Value(LLVMGetLastInstruction(bb));
    }

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--

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

-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.orange.clara.cloud</groupId>
        <artifactId>cloud-paas</artifactId>
        <version>3.0-SNAPSHOT</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <artifactId>cloud-paas-ws-provider</artifactId>

    <properties>
        <wsdl.location>${project.build.directory}/wsdl</wsdl.location>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxws</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>asm</groupId>
                    <artifactId>asm</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-transports-http</artifactId>
        </dependency>

        <dependency>
            <groupId>com.orange.clara.cloud</groupId><!--<groupId>com.orange.clara.cloud.api.soap</groupId>-->
            <artifactId>elpaaso-wsdl</artifactId>
        </dependency>
        <dependency>
            <groupId>com.orange.clara.cloud</groupId>
            <artifactId>cloud-commons</artifactId>
        </dependency>
        <dependency>
            <groupId>com.orange.clara.cloud</groupId>
            <artifactId>cloud-paas-logical-model</artifactId>
        </dependency>
        <dependency>
            <groupId>com.orange.clara.cloud</groupId>
            <artifactId>cloud-paas-services</artifactId>
        </dependency>
        <dependency>
            <groupId>com.orange.clara.cloud</groupId>
            <artifactId>cloud-paas-services-impl</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjrt</artifactId>
        </dependency>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
        </dependency>
    </dependencies>

    <name>${project.artifactId}(${project.packaging} - PAAS webservice api jar</name>
    <description>api webservice, to be used by PAAS clients (eg ALM tools, click-n-dev)</description>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-codegen-plugin</artifactId>
                <executions>
                    <execution>
                        <id>generate-sources-1</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>wsdl2java</goal>
                        </goals>
                        <configuration>
                            <wsdlOptions>
                                <wsdlOption>
                                    <wsdl>classpath:paas-administration-service.wsdl</wsdl>
                                    <!-- wsdl namespace - java package mapping -->
                                    <extraargs>
                                        <extraarg>-p</extraarg>
                                        <extraarg>
                                            http://www.orange.com/paas/administration/v4/model=${project.groupId}.providersoap.administration.v4.model
                                        </extraarg>
                                        <extraarg>-p</extraarg>
                                        <extraarg>
                                            http://www.orange.com/paas/administration/v4/exception=${project.groupId}.providersoap.administration.v4.exception
                                        </extraarg>
                                        <extraarg>-p</extraarg>
                                        <extraarg>
                                            http://www.orange.com/paas/administration/v4/PaasAdministrationService=${project.groupId}.providersoap.administration.v4.service
                                        </extraarg>
                                        <extraarg>-p</extraarg>
                                        <extraarg>
                                            http://www.orange.com/paas/security/v1=${project.groupId}.providersoap.security.v1
                                        </extraarg>
                                        <extraarg>-exsh</extraarg>
                                        <extraarg>true</extraarg>
                                        <!--extraarg>-impl</extraarg -->
                                    </extraargs>
                                </wsdlOption>
                                <wsdlOption>
                                    <wsdl>classpath:paas-environment-service.wsdl</wsdl>
                                    <!-- wsdl namespace - java package mapping -->
                                    <extraargs>
                                        <extraarg>-p</extraarg>
                                        <extraarg>
                                            http://www.orange.com/paas/environment/v3/model=${project.groupId}.providersoap.environment.v3.model
                                        </extraarg>
                                        <extraarg>-p</extraarg>
                                        <extraarg>
                                            http://www.orange.com/paas/environment/v3/exception=${project.groupId}.providersoap.environment.v3.exception
                                        </extraarg>
                                        <extraarg>-p</extraarg>
                                        <extraarg>
                                            http://www.orange.com/paas/environment/v3/PaasEnvironmentService=${project.groupId}.providersoap.environment.v3.service
                                        </extraarg>
                                        <extraarg>-p</extraarg>
                                        <extraarg>
                                            http://www.orange.com/paas/security/v1=${project.groupId}.providersoap.security.v1
                                        </extraarg>
                                        <extraarg>-exsh</extraarg>
                                        <extraarg>true</extraarg>
                                        <!-- extraarg>-impl</extraarg -->
                                    </extraargs>
                                </wsdlOption>
                                <wsdlOption>
                                    <wsdl>classpath:paas-incubator-service.wsdl</wsdl>
                                    <!-- wsdl namespace - java package mapping -->
                                    <extraargs>
                                        <extraarg>-p</extraarg>
                                        <extraarg>
                                            http://www.orange.com/paas/incubator/v4/model=${project.groupId}.providersoap.incubator.v4.model
                                        </extraarg>
                                        <extraarg>-p</extraarg>
                                        <extraarg>
                                            http://www.orange.com/paas/incubator/v4/exception=${project.groupId}.providersoap.incubator.v4.exception
                                        </extraarg>
                                        <extraarg>-p</extraarg>
                                        <extraarg>
                                            http://www.orange.com/paas/incubator/v4/PaasIncubatorService=${project.groupId}.providersoap.incubator.v4.service
                                        </extraarg>
                                        <extraarg>-p</extraarg>
                                        <extraarg>
                                            http://www.orange.com/paas/security/v1=${project.groupId}.providersoap.security.v1
                                        </extraarg>
                                        <extraarg>-exsh</extraarg>
                                        <extraarg>true</extraarg>
                                        <!-- extraarg>-impl</extraarg -->
                                    </extraargs>
                                </wsdlOption>
                            </wsdlOptions>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- Needed with Eclipse Indigo / m2e 1.0 because there are no m2e connectors for cxf-codegen-plugin for the moment -->
            <!-- This declaration will force m2e to define target/generated-sources/cxf as a source folder in Eclipse -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>add-source</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${project.build.directory}/generated-sources/cxf</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

        </plugins>
    </build>
</project>


text:
<!doctype html>

        <title>harviacode.com - codeigniter crud generator</title>
        <link rel="stylesheet" href="<?php echo base_url('assets/bootstrap/css/bootstrap.min.css') ?>"/>

User Read

User Username	<?php echo $user_username; ?>

User Displayname	<?php echo $user_displayname; ?>

User Password	<?php echo $user_password; ?>

User Tipe	<?php echo $user_tipe; ?>

	<a href="<?php echo site_url('user') ?>" class="btn btn-default">Cancel


text:
/*
 * Problem: Detect Cycle
 * Author: Anirudha Bose <ani07nov@gmail.com>

   Detect loop in a linked list
   List could be empty also
   Node is defined as
     struct Node
     {
         int data;
         struct Node *next;
     }
 */

int HasCycle(Node* head)
{
    Node *tortoise = new Node;
    Node *hare = new Node;

    tortoise = head;
    hare = head;

    while(tortoise != NULL && hare != NULL && hare->next != NULL)
    {
        tortoise = tortoise->next;
        hare = hare->next->next;

        if(tortoise == hare)
            return 1;
    }
    return 0;
}