text:
struct lts_file_s{
    archive_t archive;
    stream_t init;
    struct_stream_t *state_vec;
    struct_stream_t *state_lbl;
    stream_t *edge_src_seg;
    struct_stream_t *edge_src_state;
    stream_t *edge_dst_seg;
    struct_stream_t *edge_dst_state;
    struct_stream_t *edge_lbl;
};

static void read_begin(lts_file_t file){
    lts_type_t ltstype=lts_file_get_type(file);
    char base[128];
    int segments=lts_file_get_segments(file);
    int SV=lts_type_get_state_length(ltstype);
    int SL=lts_type_get_state_label_count(ltstype);
    int K=lts_type_get_edge_label_count(ltstype);
    if (SV) file->state_vec=(struct_stream_t*)RTmallocZero(segments*sizeof(struct_stream_t));
    if (SL) file->state_lbl=(struct_stream_t*)RTmallocZero(segments*sizeof(struct_stream_t));
    if (K) file->edge_lbl=(struct_stream_t*)RTmallocZero(segments*sizeof(struct_stream_t));
    file->edge_src_state=(struct_stream_t*)RTmallocZero(segments*sizeof(struct_stream_t));
    file->edge_dst_state=(struct_stream_t*)RTmallocZero(segments*sizeof(struct_stream_t));
    if (segments > 1) switch(lts_file_get_edge_owner(file)){
    case SourceOwned:
        file->edge_dst_seg=(stream_t*)RTmallocZero(segments*sizeof(stream_t));
        break;
    case DestOwned:
        file->edge_src_seg=(stream_t*)RTmallocZero(segments*sizeof(stream_t));
        break;
    default:
        Abort("missing case in vector read begin");
    }
    for(int i=0;i<lts_file_owned_count(file);i++){
        int seg=lts_file_owned(file,i);
        if (file->state_vec) {
            sprintf(base,"SV-%d-%%d",seg);
            file->state_vec[seg]=arch_read_vec_U32(file->archive,base,SV);
        }
        if (file->state_lbl) {
            sprintf(base,"SL-%d-%%d",seg);
            file->state_lbl[seg]=arch_read_vec_U32(file->archive,base,SL);
        }
        if (file->edge_src_seg) {
            sprintf(base,"ES-%d-seg",seg);
            file->edge_src_seg[seg]=arch_read(file->archive,base);
        }
        if (file->edge_dst_seg) {
            sprintf(base,"ED-%d-seg",seg);
            file->edge_dst_seg[seg]=arch_read(file->archive,base);
        }
        char* offset[1]={"ofs"};
        switch(lts_file_source_mode(file)){
        case Index:
            sprintf(base,"ES-%d-%%s",seg);
            file->edge_src_state[seg]=arch_read_vec_U32_named(file->archive,base,1,offset);
            break;
        case SegVector:
        case Vector:
            sprintf(base,"ES-%d-%%d",seg);
            file->edge_src_state[seg]=arch_read_vec_U32(file->archive,base,SV);
            break;
        }
        switch(lts_file_dest_mode(file)){
        case Index:
            sprintf(base,"ED-%d-%%s",seg);
            file->edge_dst_state[seg]=arch_read_vec_U32_named(file->archive,base,1,offset);
            break;
        case SegVector:
        case Vector:
            sprintf(base,"ED-%d-%%d",seg);
            file->edge_dst_state[seg]=arch_read_vec_U32(file->archive,base,SV);
            break;
        }
        if (file->edge_lbl){
            sprintf(base,"EL-%d-%%d",seg);
            file->edge_lbl[seg]=arch_read_vec_U32(file->archive,base,K);
        }
    }
}

static int read_init(lts_file_t file,int *seg,void* state){
    if (file->init==NULL || DSempty(file->init)) return 0;
    switch(lts_file_init_mode(file)){
    case Index:
        if (lts_file_get_segments(file)>1) {
            *seg=DSreadS32(file->init);
        } else {
            *seg=0;
        }
        *((uint32_t*)state)=DSreadS32(file->init);
        break;
    case SegVector:
        *seg=DSreadS32(file->init); // fall through
    case Vector:
        {
            lts_type_t ltstype=lts_file_get_type(file);
            int NV=lts_type_get_state_length(ltstype);
            for(int i=0;i<NV;i++){
                ((uint32_t*)state)[i]=DSreadS32(file->init);
            }
        }
        break;
    }
    return 1;
}

static int read_state(lts_file_t file,int *seg,void* state,void*labels){
    if (file->state_vec){
        if (DSreadStruct(file->state_vec[*seg],state)){
            if(file->state_lbl && !DSreadStruct(file->state_lbl[*seg],labels)) {
                Abort("label file is shorter than vector file");
            }
            return 1;
        }
        if (file->state_lbl && DSreadStruct(file->state_lbl[*seg],labels)) {
            Abort("label file is longer than vector file");
        }
    } else {
        if (DSreadStruct(file->state_lbl[*seg],labels)) return 1;
    }
    return 0;
}

static int read_edge(lts_file_t file,int *src_seg,void* src_state,
                         int *dst_seg,void*dst_state,void* labels
){
    int seg=0;
    switch(lts_file_get_edge_owner(file)){
    case SourceOwned:
        seg=*src_seg;
        if (!DSreadStruct(file->edge_src_state[seg],src_state)) return 0;
        if (file->edge_dst_seg) {
            *dst_seg=DSreadU32(file->edge_dst_seg[seg]);
        } else {
            *dst_seg=0;
        }
        break;
    case DestOwned:
        seg=*dst_seg;
        if (!DSreadStruct(file->edge_src_state[seg],src_state)) return 0;
        if (file->edge_src_seg) {
            *src_seg=DSreadU32(file->edge_src_seg[seg]);
        } else {
            *src_seg=0;
        }
        break;
    }
    DSreadStruct(file->edge_dst_state[seg],dst_state);
    if (file->edge_lbl) DSreadStruct(file->edge_lbl[seg],labels);
    return 1;
}

static void read_close(lts_file_t file){
    (void)file;
    // TO DO.
}

static value_table_t set_table(lts_file_t file,int type_no,value_table_t table){
    lts_type_t ltstype=lts_file_get_type(file);
    switch(lts_type_get_format(ltstype,type_no)){
    case LTStypeDirect:
    case LTStypeRange:
    case LTStypeBool:
    case LTStypeTrilean:
    case LTStypeSInt32:
        Abort("attempt to set table for an integer type");
        break;
    case LTStypeChunk:
    case LTStypeEnum:
        break;
    }
    stream_t ds;
    Debug("reading values of type %s",lts_type_get_type(ltstype,type_no));
    char stream_name[1024];
    sprintf(stream_name,"CT-%d",type_no);
    ds=arch_read(file->archive,stream_name);
    unsigned int L;
    for(L=0;;L++){
        if (DSempty(ds)) break;
        int len=DSreadVL(ds);
        char data[len];
        DSread(ds,data,len);
        VTputAtChunk (table, chunk_ld(len,data), L);
        Debug("element %u length %d",L,len);
    }
    if (L == 0) {
        lts_type_set_format(ltstype, type_no, LTStypeDirect);
    }
    Debug("%u elements in table %p",L,table);
    DSclose(&ds);
    return table;
}

static lts_file_t vector_open_old(stream_t ds,char* description,archive_t archive){
    int N;
    stream_t fifo=FIFOcreate(4096);
    if (description[3]!=' '){
        Abort("unknown format: %s",description);
    }
    description[3]=0;// extract mode and check
    if (strcmp(description,"-si") && strcmp(description,"vsi") &&
        strcmp(description,"-is") && strcmp(description,"vis") &&
        strcmp(description,"-ii")){
        Abort("unknown mode: %s",description);
    }
    if (strcmp(description+4,"1.0")){ // check version
        Abort("unknown version %s",description+4);
    }
    char *comment=DSreadSA(ds);
    Print(infoLong,"comment is %s",comment);
    N=DSreadU32(ds);
    Print(infoLong,"segment count is %d",N);
    int segment_count=N;
    N=DSreadVL(ds);
    uint32_t root_seg;
    uint32_t root_ofs;
    {
        char data[N];
        DSread(ds,data,N);
        DSwrite(fifo,data,N);
        root_seg=DSreadU32(fifo);
        root_ofs=DSreadU32(fifo);
        N=DSreadU32(fifo);
        if (N) {
            Print(infoLong,"state length is %d",N);
            for(int i=0;i<N;i++){
                DSreadU32(fifo);
            }
        }
        if (FIFOsize(fifo)) Abort("Too much data in initial state (%zu bytes)",FIFOsize(fifo));
    }
    N=DSreadVL(ds);
    lts_type_t ltstype;
    {
        char data[N];
        DSread(ds,data,N);
        DSwrite(fifo,data,N);
        ltstype=lts_type_deserialize(fifo);
        if (FIFOsize(fifo)) Abort("Too much data in lts type (%zu bytes)",FIFOsize(fifo));
        if (description[0]=='-') lts_type_set_state_length(ltstype,0);
    }
    lts_file_t file=lts_file_bare(arch_name(archive),ltstype,segment_count,NULL,sizeof(struct lts_file_s));
    Debug("getting counts");
    N=DSreadVL(ds);
    {
        char data[N];
        Debug("getting %d bytes",N);
        DSread(ds,data,N);
        DSwrite(fifo,data,N);
        N=segment_count;
        Debug("fifo now %zu bytes for %d segments",FIFOsize(fifo),N);
        for(int i=0;i<N;i++){
            uint32_t tmp=DSreadU32(fifo);
            Debug("segment %d has %u states",i,tmp);
            lts_set_state_count(file,i,tmp);
        }
        for(int i=0;i<N;i++){
            uint32_t tmp=DSreadU32(fifo);
            Debug("segment %d has %u edges",i,tmp);
            lts_set_edge_count(file,i,tmp);
        }
        if (FIFOsize(fifo)) Abort("Too much data in state and transition counts (%zu bytes)",FIFOsize(fifo));
    }
    Debug("getting compression tree");
    N=DSreadVL(ds);
    if (N) {
        Abort("Tree compression is unsupported in this version");
    }
    DSclose(&ds);
    switch(description[0]){
    case 'v':
        //lts_file_set_state_mode(file,Vector);
        break;
    case '-':
        //lts_file_set_state_mode(file,Implicit);
        break;
    default:
        Abort("unsupported mode: %s",description);
    }
    switch(description[1]){
    case 'i':
        lts_file_set_source_mode(file,Index);
        if (description[2]=='i'){
            lts_file_set_edge_owner(file,DestOwned);
        } else {
            lts_file_set_edge_owner(file,SourceOwned);
        }
        break;
    case 's':
        lts_file_set_source_mode(file,Index);
        lts_file_set_edge_owner(file,DestOwned);
        break;
    default:
        Abort("unsupported mode: %s",description);
    }
    switch(description[2]){
    case 'i':
        lts_file_set_dest_mode(file,Index);
        if (lts_file_get_edge_owner(file)!=DestOwned) Abort("inconsistent mode");
        break;
    case 's':
        lts_file_set_dest_mode(file,Index);
        if (lts_file_get_edge_owner(file)!=SourceOwned) Abort("inconsistent mode");
        break;
    default:
        Abort("unsupported mode: %s",description);
    }
    file->archive=archive;
    lts_file_set_init_mode(file,Index);
    lts_set_init_count(file,1);
    if (HREme(lts_file_context(file))==0) {
        file->init=FIFOcreate(32);
        if (lts_file_get_segments(file)>1) DSwriteU32(file->init,root_seg);
        DSwriteU32(file->init,root_ofs);
    }
    lts_file_set_read_init(file,read_init);
    lts_file_set_read_state(file,read_state);
    lts_file_set_read_edge(file,read_edge);
    lts_file_set_close(file,read_close);
    lts_file_set_table_callback(file,set_table);
    lts_file_complete(file);
    read_begin(file);
    return file;
}

lts_file_t vector_open(archive_t archive){
    Debug("opening info stream");
    stream_t ds=arch_read(archive,"info");
    char description[1024];
    Debug("getting description");
    DSreadS(ds,description,1024);
    Debug("file type is %s",description);
    if (strlen(description)==0) {
        if (31==DSreadS16(ds)) {
            Print(lerror,"this tool does not support legacy DIR");
            Abort("the file can be converted with ltstrans");
        }
    }
    if (strncmp(description,"vector",6)){
        return vector_open_old(ds,description,archive);
    }
    int N;
    int segment_count;
    stream_t fifo=FIFOcreate(4096);
    if (description[6]!=' '){
        Abort("unknown format: %s",description);
    }
    if (strcmp(description+7,"1.0")){ // check version
        Abort("unknown version %s",description+7);
    }
    char *comment=DSreadSA(ds);
    Print(infoLong,"comment is %s",comment);
    N=DSreadVL(ds);
    lts_type_t ltstype;
    {
        char data[N];
        DSread(ds,data,N);
        DSwrite(fifo,data,N);
        Debug("deserialize type pre");
        ltstype=lts_type_deserialize(fifo);
        Debug("deserialize type post");
        if (FIFOsize(fifo)) Abort("Too much data in lts type (%zu bytes)",FIFOsize(fifo));
    }
    lts_file_t file;
    Debug("getting state format info");
    N=DSreadVL(ds);
    {
        char data[N];
        DSread(ds,data,N);
        DSwrite(fifo,data,N);
        N=DSreadU32(fifo);
        Print(infoLong,"segment count is %d",N);
        segment_count=N;
        file=lts_file_bare(arch_name(archive),ltstype,segment_count,NULL,sizeof(struct lts_file_s));
        char*tmp=DSreadSA(fifo);
        Debug("initial state %s",tmp);
        if (strcmp(tmp,"i")==0) {
            lts_file_set_init_mode(file,Index);
        } else if (strcmp(tmp,"v")==0) {
            lts_file_set_init_mode(file,Vector);
        } else if (strcmp(tmp,"sv")==0) {
            lts_file_set_init_mode(file,SegVector);
        } else {
            Abort("unknown initial state representation %s",tmp);
        }
        RTfree(tmp);
        tmp=DSreadSA(fifo);
        Debug("edge owner %s",tmp);
        if (strcmp(tmp,"src")==0) {
            lts_file_set_edge_owner(file,SourceOwned);
        } else if (strcmp(tmp,"dst")==0) {
            lts_file_set_edge_owner(file,DestOwned);
        } else {
            Abort("illegal edge owner %s",tmp);
        }
        RTfree(tmp);
        tmp=DSreadSA(fifo);
        Debug("source mode %s",tmp);
        if (strcmp(tmp,"i")==0) {
            lts_file_set_source_mode(file,Index);
        } else if (strcmp(tmp,"v")==0) {
            lts_file_set_source_mode(file,Vector);
        } else if (strcmp(tmp,"sv")==0) {
            lts_file_set_source_mode(file,SegVector);
        } else {
            Abort("illegal source mode %s",tmp);
        }
        RTfree(tmp);
        tmp=DSreadSA(fifo);
        Debug("dest mode %s",tmp);
        if (strcmp(tmp,"i")==0) {
            lts_file_set_dest_mode(file,Index);
        } else if (strcmp(tmp,"v")==0) {
            lts_file_set_dest_mode(file,Vector);
        } else if (strcmp(tmp,"sv")==0) {
            lts_file_set_dest_mode(file,SegVector);
        } else {
            Abort("illegal dest mode %s",tmp);
        }
        RTfree(tmp);
        if (FIFOsize(fifo)) Abort("Too much data in lts layout description (%zu bytes)",FIFOsize(fifo));
    }
    Debug("getting counts");
    N=DSreadVL(ds);
    {
        char data[N];
        Debug("getting %d bytes",N);
        DSread(ds,data,N);
        DSwrite(fifo,data,N);
        N=segment_count;
        Debug("fifo now %zu bytes for %d segments",FIFOsize(fifo),N);
        {
            uint32_t tmp=DSreadU32(fifo);
            Debug("LTS has %u initial states",tmp);
            lts_set_init_count(file,tmp);
        }
        for(int i=0;i<N;i++){
            uint32_t tmp=DSreadU32(fifo);
            Debug("segment %d has %u states",i,tmp);
            lts_set_state_count(file,i,tmp);
        }
        for(int i=0;i<N;i++){
            uint32_t tmp=DSreadU32(fifo);
            Debug("segment %d has %u edges",i,tmp);
            lts_set_edge_count(file,i,tmp);
        }
        N=lts_type_get_type_count(ltstype);
        for(int i=0;i<N;i++){
            uint32_t tmp=DSreadU32(fifo);
            lts_set_expected_value_count(file,i,tmp);
        }
        if (FIFOsize(fifo)) Abort("Too much data in state and transition counts (%zu bytes)",FIFOsize(fifo));
    }
    Debug("getting compression tree");
    N=DSreadVL(ds);
    if (N) {
        Abort("Tree compression is unsupported in this version");
    }
    DSclose(&ds);
    file->init=arch_read(archive,"init");
    file->archive=archive;
    lts_file_set_read_init(file,read_init);
    lts_file_set_read_state(file,read_state);
    lts_file_set_read_edge(file,read_edge);
    lts_file_set_close(file,read_close);
    lts_file_set_table_callback(file,set_table);
    lts_file_complete(file);
    read_begin(file);
    return file;
}

lts_file_t gcf_file_open(const char* name){
    archive_t archive=arch_gcf_read(raf_unistd((char*)name));
    return vector_open(archive);
}

lts_file_t gcd_file_open(const char* name){
    Debug("attempting to open %s",name);
    archive_t archive=arch_dir_open((char*)name,lts_io_blocksize);
    Debug("directory was opened");
    arch_set_transparent_compression(archive);
    return vector_open(archive);
}

lts_file_t dir_file_open(const char* name){
    Debug("attempting to open %s",name);
    archive_t archive=arch_dir_open((char*)name,lts_io_blocksize);
    Debug("directory was opened");
    return vector_open(archive);
}


text:
package org.factcenter.fastgc.YaoGC;

import java.math.BigInteger;

public class XOR_2_1 extends SimpleCircuit_2_1 {
	public XOR_2_1(CircuitGlobals globals) {
		super(globals, "XOR_2_1");
	}

	protected void compute() {
		int left = inputWires[0].value;
		int right = inputWires[1].value;

		outputWires[0].value = left ^ right;
	}

	public void execute() {
		Wire inWireL = inputWires[0];
		Wire inWireR = inputWires[1];
		Wire outWire = outputWires[0];

		if (inWireL.value != Wire.UNKNOWN_SIG
				&& inWireR.value != Wire.UNKNOWN_SIG) {
            // Both inputs are known, we can compute the known output.
			compute();
		} else if (inWireL.value != Wire.UNKNOWN_SIG) {
            // Only the left input is known
			if (inWireL.value == 0)
				outWire.invd = inWireR.invd;
			else
				outWire.invd = !inWireR.invd;

			outWire.value = Wire.UNKNOWN_SIG;
			outWire.setLabel(inWireR.lbl);
		} else if (inWireR.value != Wire.UNKNOWN_SIG) {
            // Only the right input is known
			if (inWireR.value == 0)
				outWire.invd = inWireL.invd;
			else
				outWire.invd = !inWireL.invd;

			outWire.value = Wire.UNKNOWN_SIG;
			outWire.setLabel(inWireL.lbl);
		} else {
			if (collapse()) {

			} else {
				BigInteger l = inWireL.lbl;
				BigInteger r = inWireR.lbl;

				BigInteger out = l.xor(r);

				outWire.invd = inWireL.invd ^ inWireR.invd;
				outWire.value = Wire.UNKNOWN_SIG;
				outWire.setLabel(out);
			}
		}

		outWire.setReady(Math.min(inWireL.execSerial, inWireR.execSerial));
	}

	protected boolean collapse() {
		Wire inWireL = inputWires[0];
		Wire inWireR = inputWires[1];
		Wire outWire = outputWires[0];

		if (inWireL.lbl.equals(inWireR.lbl)) {
			if (inWireL.invd == inWireR.invd) {
				outWire.invd = false;
				outWire.value = 0;
			} else {
				outWire.invd = false;
				outWire.value = 1;
			}

			return true;
		}

		return false;
	}

	// Never used for XOR gate.
	protected boolean shortCut() {
		return false;
	}

	// Never used for XOR gate.
	protected void fillTruthTable() {
	}

	protected void execYao() {
	}
}

redpajama_set_name: RedPajamaGithub


text:
@media only screen and (max-width: 1025px) {

	.entry-header .issue-number,
	.wide-hero .issue-number,
	.tall-hero .issue-number,
	.issue-page .logo-holder + .issue-number {
		left: 0;
	}

	.entry-header .illustrator-credit,
	.wide-hero .illustrator-credit,
	.tall-hero .illustrator-credit,
	.issue-page .logo-holder + .illustrator-credit {
		right: 0;
	}
	input[type="text"],
	input[type="email"],
	input[type="password"],
	textarea {
		max-width: 525px;
	}
	.outer-ajax-container {
    	min-height: 264px;
    }
    @-moz-document url-prefix() {
		.outer-ajax-container {
	    	min-height: 269px;
	    }
    }
	.form-heading, legend.center {
		max-width: 525px;
		text-align: left;
	}

}

@media only screen and (max-width: 78em) {

	.content-minutiae {
		clear: right;
		margin-bottom: 2em;
		margin-left: 2em;
		margin-right: 0;
	}

	.content-minutiae h1, .content-minutiae li {
		padding: 0 1em;
	}

	.utility-side-bar {
		clear: right;
		float: right;
		margin-left: 2em;
		margin-right: 0;
		padding-top: 0;
	}

	.utility-side-bar + figure img,
	.utility-side-bar + * + figure img,
	.utility-side-bar + * + * + figure img {
		max-width: 79%;
	}

	.article-layout .main-content .sidebar.var1 {
		position: relative;
		left: auto;
		bottom: auto;
		width: auto;
		text-align: left;
		margin-right: 132px;
		margin-left: 132px;
		margin-bottom: 12px;
		display: -ms-flex;
		display: -webkit-flex;
		display: flex;
	}

	.article-layout .main-content .sidebar.var1 {
		margin-top: 84px;
	}

	.widget-branding {
		top: -60px;
	}

	.article-layout .main-content .sidebar.var1 section {
		position: relative;
		width: calc(50% - 12px);
		display: inline-block;
		vertical-align: top;
	}

	.article-layout .main-content .sidebar.var1 section:only-of-type {
		position: relative;
		width: calc(100% - 12px);
		display: inline-block;
		vertical-align: top;
	}

	.article-layout .main-content .sidebar.var1 section + section {
		margin-left: 12px;
		padding-left: 24px;
		border-left: 1px solid #dfdfdf;
	}

	.article-layout .main-content .sidebar.var1 section + section::before {
		display: none;
	}

	.sidebar-hero {
		float: left;
		margin-right: 18px;
	}

	.article-layout .main-content .sidebar.var1 .wideone {
		float: none;
	}

	.article-layout .main-content .sidebar.var1 .wideone img {
		display: block;
		margin-left: auto;
		margin-right: auto;
	}

	.article-layout .main-content .sidebar.var1 .related-articles article p, .article-layout .main-content .sidebar.var1 .related-articles article h1, .article-layout .main-content .sidebar.var1 .related-articles article h2 {
		font-size: 14px;
		line-height: 18px;
	}

	.article-layout .main-content .sidebar.var1 .related-articles article h2 {
		margin-bottom: 4px;
	}

	.main-content > ul.entry-list > li.featured-comment {
		margin-left: 0;
		margin-right: 12px;
		padding-top: 12px;
	}

	.main-content > ul.entry-list > li.featured-comment:before {
		position: static;
		float: left;
		line-height: 0;
		margin-top: 29px;
	}

}

@media only screen and (max-width: 71.875em) { /* 1150px */

	.sponsor-top {
		top: 48px;
		width: 156px;
		text-align: center;
	}

	.secondary-column .sponsor-top {
		text-align: left;
	}

	.sponsor-top .sponsor-logo {
		width: 132px;
		height: 60px;
	}

	.sponsor-top .sponsor-extended {
		display: none;
	}

	.secondary-column .sponsor-extended {
		display: inline;
	}

	.sponsor-top p {
		line-height: 16px;
	}

}

@media only screen and (max-width: 61.5em) { /* 984px */

	.global-nav {
		padding: 0 12px;
	}

	.global-nav .head-east-young-man {
		position: absolute;
		right: 6px;
		top: 0;

		-webkit-backface-visibility: hidden; /* prevents smearing */
		-moz-backface-visibility: hidden;
		-ms-backface-visibility: hidden;
	}

	.killer-logo > a {
		margin-left: -10%;
	}

	.main-wrapper {
		padding-bottom: 0;
	}

	.main-wrapper.stacker:last-of-type {
		padding-bottom: 0;
	}

	.issue-header {
		width: auto;
		margin: 0 36px 12px;
	}

	.entry-header {
		width: auto;
		margin-left: 36px;
		margin-right: 36px;
	}

	.wide-hero {
		width: auto;
		margin-left: 36px;
		margin-right: 36px;
	}

	.wide-hero[data-issue-number]:before,
	.wide-hero[data-issue-number]:after {
		left: 12px;
	}

	.entry-header > .issue-number:first-child, .issue-page .logo-holder + .issue-number {
		left: 12px;
		margin-left: 0;
	}

	.entry-header .wide-hero {
		margin-left: 0;
		margin-right: 0;
	}

	.entry-header p,
	.entry-header h2 {
		padding: 0;
	}

	.article-layout .main-content {
		width: auto;
		margin-left: 36px;
		margin-right: 36px;
	}

	.article-layout .main-content > h2,
	.article-layout .main-content > h3,
	.article-layout .main-content > h4,
	.article-layout .main-content > h5,
	.article-layout .main-content > h6,
	.promo-box {
		margin-left: 0;
		margin-right:0;
	}

	.article-layout .main-content > p,
	.article-layout .main-content > pre,
	.article-layout .main-content > ol,
	.article-layout .main-content > ul,
	.article-layout .main-content > blockquote,
	.article-layout .main-content > figure,
	.article-layout .main-content > div.illustration,
	.article-layout .main-content .entry-footnotes {
		margin-right: 0;
		margin-left: 0;
	}

	.article-layout .main-content:not(.wide-video) > iframe {
		margin-right: 0 !important;
		margin-left: 0 !important;
	}

	.article-layout .main-content > iframe {
		margin-right: 0 !important;
		margin-left: 0 !important;
	}

	.content-minutiae {
		float: right;
		margin: 0 0 24px 24px;
		font-size: 12px;
		line-height: 24px;
		clear: right;
	}

	.tall-hero + .content-minutiae {
		float: left;
		clear: left;
		margin: 0 24px 24px 0;
	}

	.article-layout .main-content .sidebar {
		width: 50%;
		margin-right: 0;
	}

	.article-layout .main-content .entry-footnotes li {
		margin-left: 24px;
	}

	.article-layout .main-content .sidebar.var1 {
		margin-left: 0;
		margin-right: 0;
	}

	.article-layout .entry-footer {
		width: auto;
	}

	.entry-footer {
		padding-bottom: 36px;
	}

	.entry-footer .byline {
		/* padding: 0 24px; */
		width: auto;
	}

	.item-summary {
		width: 33%;
		margin-right: 0;
	}

	.item-summary:nth-of-type(3n) {
		margin-right: 0;
	}

	.item-summary:nth-of-type(4n) {
		margin-right: 0;
	}

	.item-summary > figure,
	.item-summary > h1,
	.item-summary > h2,
	.item-summary > p,
	.item-summary > ul,
	.item-summary > .column-name {
		margin-right: 24px;
	}

	.item-summary:nth-of-type(3n) figure,
	.item-summary:nth-of-type(3n) h1,
	.item-summary:nth-of-type(3n) h2,
	.item-summary:nth-of-type(3n) p,
	.item-summary:nth-of-type(3n) ul, {
		margin-right: 0;
	}

	.multi-column-display .main-content {
		padding-right: 0;
	}

	.single-column-display .col-holder,
	.two-column-display .col-holder,
	.multi-column-display .col-holder {
		padding-left: 36px;
		padding-right: 36px;
	}

	.two-column-display .main-content,
	.two-column-display .secondary-column {
		display: inline-block;
		width: 66%;
		padding-left: 0;
		padding-right: 0;
		border-right: 0;
		border-left: 0;
	}

	.two-column-display .main-content {
		margin-right: 24px;
	}

	.two-column-display .secondary-column {
		width: 30%;
		margin-right: 0;
	}

	.entry-footer .byline img,
	.author-header img {
		/* max-width: 25%; */
	}

	.entry-footer h1,
	.entry-footer h2,
	.entry-footer h3,
	.entry-footer .byline .author-bio,
	.entry-footer .byline .author-more {
		/* margin-left: 25%; */
		padding-left: 12px;
	}

	.author-header {
		/* padding-left: 25%; */
		margin-left:36px;
		margin-right: 36px;
		width: auto;
	}

	.main-content .author-header {
		margin-left: 0;
		margin-right: 0;
	}

	.author-header h1,
	.fancy-links {
		/* padding-left: 12px; */
	}

	.author-header p.meta, .blog-header p.meta {
		line-height: 24px;
	}

	.author-header .column-name {
		margin-bottom: 0;
	}

	.col-holder .secondary-column .author-nav {
		/* position: fixed;
		display: block;
		width: 100%;
		height: 100%;
		left: 100%;
		top: 0;
		z-index: 1000;
		margin-top: 0;
		margin-left: 0;
		padding: 24px;
		border-left: 0;
		background: #fff;

		-webkit-transition: all 200ms ease-in;
		-moz-transition: all 200ms ease-in;
		-o-transition: all 200ms ease-in;
		-ms-transition: all 200ms ease-in;
		transition: all 200ms ease-in; */
	}

	.col-holder .secondary-column .author-nav.active {
		/* left: 0; */
	}

	.col-holder .secondary-column .author-nav:not(.active) h2 {
		/* position: absolute;
		top: 200px;
		right: 100%;
		background: pink;
		padding: 12px; */
	}

	.col-holder .secondary-column .author-nav h2 {
		/* margin-top: 0; */
	}

	.alphabits a.arrow.right {
		right: -6px;
	}

	.alpha-container {
		/* height: 85%; */
	}

	.column-holder {
		display: block;
		overflow: hidden;
		width: auto;
		margin-left:36px;
		margin-right: 36px;
	}

	.fixed-column {
		max-width: none;
	}

	.post-article.single-column {
		width: auto;
	}

	.post-article.single-column .column-holder {
		width: auto;
	}

	.comment-holder,
	.more-content {
		padding-top: 18px;
	}

	.comment-holder h1.classy,
	.more-content h1.classy {
		margin-bottom: 36px;
	}

	ol.article-comments {
		margin-top: 18px;
	}

	ol.article-comments > li {
		margin-top: 12px;
		margin-bottom: 12px;
		padding: 12px;
		overflow: hidden;
	}

	.edit-comment,
	.embed-comment {
		margin-left: 0;
		}

	.comment-body {
		clear: both;
		margin-left: 0;
		margin-top: 18px;
	}

	.commenter-name + time {
		display: block;
	}

	.column,
	.unequal-columns .column,
	.unequal-columns .column:not(:first-child) {
		display: block;
		width: auto;
		padding-bottom: 24px;
		/* padding-left: 24px;
		padding-right: 24px; */
		padding-left: 0;
		padding-right: 0;
	}

	.unequal-columns .column:not(:first-child) {
		padding-top: 0;
		border: 0;
	}

	.author-header h1, .blog-header h1 {
		font-size: 36px;
		line-height: 42px;
	}

	.article-layout .author-header,
	.article-layout .blog-header,
	.sponsored .article-layout .author-header,
	.sponsored .article-layout .blog-header {
		width: auto;
		margin-left: 36px;
		margin-right: 36px;
		padding-right: 0;
	}

	.sponsored .article-layout .blog-header,
	.article-layout .blog-header {
		padding-left: 0;
	}

	aside.job-board {
		display: block;
		vertical-align: top;
		width: auto;
		min-width: none;
		margin: 24px 0;
	}

	.global-footer {
		position: relative;
		bottom: auto;
		left: auto;
		padding-bottom: 30px;
	}

	.global-footer li {
		margin-right: 0;
		line-height: 18px;
	}

	.global-footer .copyright li {
		line-height: 24px;
	}

	.global-footer .inline-items {
		padding-top: 12px;
		padding-left: 36px;
		padding-right: 36px;
		line-height: 24px;
	}

	.global-footer .inline-items li {
		margin-right: 18px;
		margin-bottom:24px;
	}

	.global-footer .inline-items li.head-east-young-man {
		float: none;
		margin-right: 0;
	}

	.promo-holder {
		margin-bottom: 12px;
	}

	.global-footer li small {
		display: block;
		/* margin-bottom: 24px; */
	}

	.deadly-subtitle {
		background-position: -15px 0px;
	}

	.home-page .two-column-display .col-holder {
		padding-left: 24px;
	}

	.home-page .two-column-display .main-content {
		width: 100%;
		padding-bottom: 0;
	}

	.home-page .global-nav {
		padding-top: 0;
	}

	.home-page .entry-header,
	.issue-page .entry-header {
		/* margin-bottom: 24px; */
		margin-left: 36px;
		margin-right: 36px;
	}

	/*
	.home-page .variable-column .item-summary,
	.issue-page .variable-column .item-summary {
		width:230px;
	}
	*/

	.variable-column {
		width: 66%;
	}

	.variable-column > .item-summary {
		width: 49%;
		padding-left: 0;
	}

	.variable-column:first-child {
		width: 33%;
	}

	.variable-column:first-child > .item-summary {
		width: 100%;
	}

	#home-page .variable-column {
		width: auto;
	}

	#home-page .fixed-column {
		position:static;
	}

	.home-page .variable-column .item-summary:nth-of-type(2n) > figure,
	.home-page .variable-column .item-summary:nth-of-type(2n) > h1,
	.home-page .variable-column .item-summary:nth-of-type(2n) > h2,
	.home-page .variable-column .item-summary:nth-of-type(2n) > p {
		margin-right: 0;
	}

	.issue-page .variable-column .item-summary:nth-of-type(2n) > figure,
	.issue-page .variable-column .item-summary:nth-of-type(2n) > h1,
	.issue-page .variable-column .item-summary:nth-of-type(2n) > h2,
	.issue-page .variable-column .item-summary:nth-of-type(2n) > p {
		margin-right: 0;
	}

	.home-page .fixed-column,
	.issue-page .fixed-column {
		width: auto;
		display: block;
	}

	.ala-slug {
		display: none;
	}

	.promo-holder {
		/* background: transparent; */
		padding-left: 36px;
		padding-right: 36px;
	}

	.partner-promos {
		padding: 0;
	}

	.partner-promos li {
		display: inline-block;
		vertical-align: top;
		width: 50%;
		min-height: 90px;
		margin-right: 0;
		padding-right: 24px;
		padding-left: 0;
		font-size: 12px;
	}

	.partner-promos li a {
		display: block;
		width: 100%;
		margin: 0 auto;
		text-align: left;
	}

	.partner-promos img {
		/* float: none;
		display: block;
		margin-right: 0;
		margin-bottom: 6px; */
	}

	.sponsor-top {
		right: 0;
		border-top-right-radius: 0;
		border-bottom-right-radius: 0;
	}

	.secondary-column .sponsor-top {
		right: auto;
	}

}

@media only screen and (max-width: 61.5em) and (min-width: 26.250em) { /* 964px / 420px */

	/**
	 * BuySellAds on home page
	 */
	.variable-column .bsa-apiads a {
		display: flex;
		flex-flow: row nowrap;
	  align-items: flex-start;
	  text-align: left;
	}

	.variable-column .bsa-apiads-logo__container {
		margin: 0 12px 0 0;
	}

	.variable-column .bsa-apiads p {
		margin-top: -6px;
	}

	/**
	 * BSA Ads Preload
	 */
	.variable-column .bsa-apiads.bsa-apiads--preload {
		min-width: 320px;
		min-height: 107px;
		background-image: url('/components/assets/img/bsa_ad-placeholder--wide.svg');
		background-position: left center;
	}

}

@media only screen and (max-width: 61.5em) and (min-width: 768px) { /* 964px / 768px */

	/**
	* BuySellAds on pages with sidebar
	*/
	.secondary-column .bsa-apiads a {
		display: block;
		text-align: center;
	}

	.secondary-column .bsa-apiads-logo__container {
	  margin: 5px 0 12px;
	}

	.secondary-column .bsa-apiads p {
		margin-top: 0;
	}

	.secondary-column .bsa-apiads.bsa-apiads--preload {
		min-width: 216px;
		min-height: 209px;
		background-image: url('/components/assets/img/bsa_ad-placeholder.svg');
		background-position: center center;
	}

}

@media only screen and (max-width: 50em) { /* 800px */

	a {
		/* Horrors! A device-specific style! */
		/* (for the HTC Desire, and probably other unidentified android devices) */
		text-rendering: auto;
	}

}


text:
#ifndef CELIX_IMPORT_REGISTRATION_DFI_H
#define CELIX_IMPORT_REGISTRATION_DFI_H

#include "import_registration.h"

#include <celix_errno.h>

typedef void (*send_func_type)(void *handle, endpoint_description_pt endpointDescription, char *request, char **reply, int* replyStatus);

celix_status_t importRegistration_create(bundle_context_pt context, endpoint_description_pt description, const char *classObject,
                                         import_registration_pt *import);
celix_status_t importRegistration_close(import_registration_pt import);
void importRegistration_destroy(import_registration_pt import);

celix_status_t importRegistration_setSendFn(import_registration_pt reg,
                                            send_func_type,
                                            void *handle);
celix_status_t importRegistration_start(import_registration_pt import);
celix_status_t importRegistration_stop(import_registration_pt import);

celix_status_t importRegistration_getService(import_registration_pt import, bundle_pt bundle, service_registration_pt registration, void **service);
celix_status_t importRegistration_ungetService(import_registration_pt import, bundle_pt bundle, service_registration_pt registration, void **service);

#endif //CELIX_IMPORT_REGISTRATION_DFI_H


text:
namespace Plottable.Utils.Stacking {

  export type StackedDatum = {
    value: number;
    offset: number;
  };

  export type StackingResult = Utils.Map<Dataset, Utils.Map<string, StackedDatum>>;

  let nativeMath: Math = (<any>window).Math;

  /**
   * Computes the StackingResult (value and offset) for each data point in each Dataset.
   *
   * @param {Dataset[]} datasets The Datasets to be stacked on top of each other in the order of stacking
   * @param {Accessor<any>} keyAccessor Accessor for the key of the data
   * @param {Accessor<number>} valueAccessor Accessor for the value of the data
   * @return {StackingResult} value and offset for each datapoint in each Dataset
   */
  export function stack(datasets: Dataset[], keyAccessor: Accessor<any>, valueAccessor: Accessor<number>): StackingResult {
    let positiveOffsets = d3.map<number>();
    let negativeOffsets = d3.map<number>();
    let datasetToKeyToStackedDatum = new Utils.Map<Dataset, Utils.Map<string, StackedDatum>>();

    datasets.forEach((dataset) => {
      let keyToStackedDatum = new Utils.Map<string, StackedDatum>();
      dataset.data().forEach((datum, index) => {
        let key = normalizeKey(keyAccessor(datum, index, dataset));
        let value = +valueAccessor(datum, index, dataset);
        let offset: number;
        let offsetMap = (value >= 0) ? positiveOffsets : negativeOffsets;
        if (offsetMap.has(key)) {
          offset = offsetMap.get(key);
          offsetMap.set(key, offset + value);
        } else {
          offset = 0;
          offsetMap.set(key, value);
        }
        keyToStackedDatum.set(key, {
          value: value,
          offset: offset,
        });
      });
      datasetToKeyToStackedDatum.set(dataset, keyToStackedDatum);
    });
    return datasetToKeyToStackedDatum;
  }

  /**
   * Computes the total extent over all data points in all Datasets, taking stacking into consideration.
   *
   * @param {StackingResult} stackingResult The value and offset information for each datapoint in each dataset
   * @oaram {Accessor<any>} keyAccessor Accessor for the key of the data existent in the stackingResult
   * @param {Accessor<boolean>} filter A filter for data to be considered when computing the total extent
   * @return {[number, number]} The total extent
   */
  export function stackedExtent(stackingResult: StackingResult, keyAccessor: Accessor<any>, filter: Accessor<boolean>) {
    let extents: number[] = [];
    stackingResult.forEach((stackedDatumMap: Utils.Map<string, StackedDatum>, dataset: Dataset) => {
      dataset.data().forEach((datum, index) => {
        if (filter != null && !filter(datum, index, dataset)) {
          return;
        }
        let stackedDatum = stackedDatumMap.get(normalizeKey(keyAccessor(datum, index, dataset)));
        extents.push(stackedDatum.value + stackedDatum.offset);
      });
    });
    let maxStackExtent = Utils.Math.max(extents, 0);
    let minStackExtent = Utils.Math.min(extents, 0);

    return [nativeMath.min(minStackExtent, 0), nativeMath.max(0, maxStackExtent)];
  }

  /**
   * Normalizes a key used for stacking
   *
   * @param {any} key The key to be normalized
   * @return {string} The stringified key
   */
  export function normalizeKey(key: any) {
    return String(key);
  }

}


text:
module HTIG.Database
    ( openDatabase
    , getTLLastStatusId
    , getMentionLastStatusId
    , addToTimeline
    , addToMention
    , getStatusFromId

    , Connection

    -- re-export
    , commit
    ) where

import Control.Applicative ((<$>))
import Control.Monad (when)
import Data.Maybe (isJust, fromJust)
import Database.HDBC (run, runRaw, commit, quickQuery', fromSql, toSql)
import Database.HDBC.Sqlite3 (Connection, connectSqlite3)

import HTIG.TwitterAPI (Status(..), TwitterUser(..))

databaseSchema :: String
databaseSchema = unlines
    -- TODO: CREATE INDEX
    [ "CREATE TABLE IF NOT EXISTS user ("
    , "  id INTEGER NOT NULL PRIMARY KEY,"
    , "  name VARCHAR(255) NOT NULL,"
    --, "  screen_name VARCHAR(255) NOT NULL UNIQUE"
    , "  screen_name VARCHAR(255) NOT NULL"
    , ");"
    , "CREATE TABLE IF NOT EXISTS status ("
    , "  id INTEGER NOT NULL UNIQUE,"
    , "  created_at INTEGER NOT NULL,"
    , "  text VARCHAR(140) NOT NULL,"
    , "  source TEXT NOT NULL,"
    , "  truncated BOOL NOT NULL,"
    , "  in_reply_to_status_id INTEGER,"
    , "  in_reply_to_user_id INTEGER,"
    , "  favorited BOOL NOT NULL,"
    , "  in_reply_to_screen_name,"
    , "  user_id INTEGER NOT NULL,"
    , "  retweeted_status_id INTEGER REFERENCES status (id)"
    , ");"
    , "CREATE TABLE IF NOT EXISTS timeline ("
    , "  status_id INTEGER NOT NULL UNIQUE REFERENCES status (id)"
    , ");"
    , "CREATE TABLE IF NOT EXISTS mention ("
    , "  status_id INTEGER NOT NULL UNIQUE REFERENCES status (id)"
    , ");"
    ]

openDatabase :: FilePath -> IO Connection
openDatabase fpath = do
    conn <- connectSqlite3 fpath
    runRaw conn databaseSchema
    commit conn
    return conn

getTLLastStatusId :: String -> Connection -> IO (Maybe Integer)
getTLLastStatusId = getLastStatusId "timeline"

getMentionLastStatusId :: String -> Connection -> IO (Maybe Integer)
getMentionLastStatusId = getLastStatusId "mention"

getLastStatusId :: String -> String -> Connection -> IO (Maybe Integer)
getLastStatusId tbl sname conn = do
    result <- quickQuery' conn ("SELECT status_id FROM " ++ tbl ++ " \
                                \ ORDER BY status_id DESC LIMIT 1")
                                []
    case result of
        [val]:_ -> return $ Just $ fromSql val
        []      -> return Nothing
        x       -> fail $ "unexpexted result: " ++ show x

-- TODO: addToTimeline, addToMention をうまいことまとめる
addToTimeline :: String -> Status -> Connection -> IO ()
addToTimeline sname st conn = do
    addStatusIfNotExists st conn
    run conn "INSERT INTO timeline (status_id) VALUES (?)" [toSql $ stId st]
    return ()

addToMention :: String -> Status -> Connection -> IO ()
addToMention sname st conn = do
    addStatusIfNotExists st conn
    run conn "INSERT INTO mention (status_id) VALUES (?)" [toSql $ stId st]
    return ()

addStatusIfNotExists :: Status -> Connection -> IO ()
addStatusIfNotExists st conn = do
    [val]:_ <- quickQuery' conn "SELECT COUNT(*) FROM user where id = ?" [toSql $ usId . stUser $ st]
    when ((fromSql val :: Int) == 0) $ do
        run conn "INSERT INTO user (id, name, screen_name) VALUES (?, ?, ?)"
                 [ toSql $ usId . stUser $ st
                 , toSql $ usName . stUser $ st
                 , toSql $ usScreenName . stUser $ st
                 ]
        return ()

    when (isJust $ stRetweetedStatus st) $
        addStatusIfNotExists (fromJust $ stRetweetedStatus st) conn

    [val']:_ <- quickQuery' conn "SELECT COUNT(*) FROM status WHERE id = ?" [toSql $ stId st]
    when ((fromSql val' :: Int) == 0) $ do
        run conn "INSERT INTO status (id, created_at, text, source, truncated, in_reply_to_status_id, \
                                    \ in_reply_to_user_id, favorited, in_reply_to_screen_name, user_id, retweeted_status_id) \
                 \ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
                 [ toSql $ stId st
                 , toSql $ stCreatedAt st
                 , toSql $ stText st
                 , toSql $ stSource st
                 , toSql $ stTruncated st
                 , toSql $ stInReplyToStatusId st
                 , toSql $ stInReplyToUserId st
                 , toSql $ stFavorited st
                 , toSql $ stInReplyToScreenName st
                 , toSql $ (usId . stUser) st
                 , toSql $ stId <$> stRetweetedStatus st
                 ]
        return ()

getStatusFromId :: Integer -> Connection -> IO (Maybe Status)
getStatusFromId stid conn = do
    result <- quickQuery' conn "SELECT status.id, created_at, text, source, truncated, in_reply_to_status_id, in_reply_to_user_id, \
                                     \ favorited, in_reply_to_screen_name, user.id, user.name, user.screen_name, retweeted_status_id \
                                \ FROM status LEFT JOIN user ON (status.user_id = user.id) \
                                \ WHERE status.id = ? LIMIT 1" [toSql stid]
    case result of
        [] -> return Nothing
        [vId, vCreatedAt, vText, vSource, vTruncated, vInReplyToStatusId, vInReplyToUserId,
         vFavorited, vInReplyToScreenName, vUserId, vUserName, vUserScreenName, vRetweetedStatusId]:_ -> do
            retweetedStatus <-
                case fromSql vRetweetedStatusId of
                    Just rsid -> getStatusFromId rsid conn
                    Nothing   -> return Nothing
            return $ Just $ Status (fromSql vCreatedAt)
                                   (fromSql vId)
                                   (fromSql vText)
                                   (fromSql vSource)
                                   (fromSql vTruncated)
                                   (fromSql vInReplyToStatusId)
                                   (fromSql vInReplyToUserId)
                                   (fromSql vFavorited)
                                   (fromSql vInReplyToScreenName)
                                   (TwitterUser (fromSql vUserId) (fromSql vUserName) (fromSql vUserScreenName))
                                   retweetedStatus
        x -> fail $ "unexpexted result: " ++ show x

-- TODO: export these functions
garbageCollect :: Connection -> IO ()
garbageCollect conn = do
    clearOldTimeline conn
    clearOldMentions conn
    clearUnreferencedStatuses conn

clearOldTimeline :: Connection -> IO ()
clearOldTimeline conn = do
    c <- run conn "DELETE FROM timeline WHERE status_id <= (SELECT status_id FROM timeline ORDER BY status_id LIMIT 1 OFFSET 100)" []
    print ("delete", c, "old timeline") -- debug print

clearOldMentions :: Connection -> IO ()
clearOldMentions conn = do
    c <- run conn "DELETE FROM mention WHERE status_id <= (SELECT status_id FROM mention ORDER BY status_id LIMIT 1 OFFSET 100)" []
    print ("delete", c, "old mentions") -- debug print

clearUnreferencedStatuses :: Connection -> IO ()
clearUnreferencedStatuses conn = do
    c <- run conn "DELETE FROM status \
                  \ WHERE (SELECT COUNT(*) FROM timeline WHERE status_id = id) = 0 \
                  \   AND (SELECT COUNT(*) FROM mention WHERE status_id = id) = 0 \
                  \   AND (SELECT COUNT(*) FROM status as s WHERE s.retweeted_status_id = status.id) = 0" []
    print ("delete", c, "unreferenced statuses") -- debug print


text:
> Provide an interface for creating families of related or dependent objects without specifying their concrete classes.
>
>**Source:** [wikipedia.org](https://en.wikipedia.org/wiki/Abstract_factory_pattern)

### Swift Example

```swift
protocol Button {}

class OSXButton: Button {}

class WinButton: Button {}

protocol ButtonFactory {
    func makeButton() -> Button
}

class OSXFactory: ButtonFactory {
    func makeButton() -> Button {
        return OSXButton()
    }
}

class WinFactory: ButtonFactory {
    func makeButton() -> Button {
        return WinButton()
    }
}

enum Type {
    case OSX, Win
}

enum FactoryHelper {
    static func factory(for type: Type) -> ButtonFactory {
        switch type {
        case .OSX:
            return OSXFactory()
        case .Win:
            return WinFactory()
        }
    }
}
````

### Swift Usage

```swift
let buttonFactory = FactoryHelper.factory(for: .OSX)
let button = buttonFactory.makeButton()
````

### Kotlin Example

```kotlin
interface Button

class OSXButton: Button

class WinButton: Button

abstract class ButtonFactory {
    abstract fun makeButton(): Button

    companion object {
        inline fun <reified T: Button> createFactory(): ButtonFactory = when (T::class) {
            OSXButton::class -> OSXFactory()
            WinButton::class  -> WinFactory()
            else               -> throw IllegalArgumentException()
        }
    }
}

class OSXFactory: ButtonFactory() {
    override fun makeButton(): Button = OSXButton()
}

class WinFactory: ButtonFactory() {
    override fun makeButton(): Button = WinButton()
}
````

### Kotlin Usage

```kotlin
fun main(args: Array<String>) {
    val buttonFactory = ButtonFactory.createFactory<OSXButton>()
    val button = buttonFactory.makeButton()
    println("Created button: $button")
}

````


text:
title: Bemba et al. charges - Fidèle Babala Wandu
published: true
charges_status: 'Trial: Ongoing'
case: the-prosecutor-v-bemba-et-al
accused: fid-le-babala-wandu
youtube_id:
slug: bemba-et-al-charges-fidèle-babala-wandu
---

### Factual Allegations

*This case arises from the Accused's actions in connection with the case of [<u>The Prosecutor v. Jean-Pierre Bemba Gombo</u>](https://www.aba-icc.org/cases/case/the-prosecutor-v-bemba/), in which Jean-Pierre Bemba Gombo was charged, tried, and ultimately acquitted of crimes against humanity (murder, rape) and war crimes (murder, rape, and pillaging) at the ICC. *

The ICC Office of the Prosecutor (OTP) alleges that Jean-Pierre Bemba Gombo's former primary political advisor Fidèle Babala Wandu participated in a scheme, devised by Mr. Bemba, to transfer financial compensation to defense witnesses in exchange for false evidence (false testimony and false or forged documents\*) favorable to the defense of Mr. Bemba in the case of [*The Prosecutor v. Jean-Pierre Bemba Gombo*](https://www.aba-icc.org/cases/case/the-prosecutor-v-bemba/). (\*Pre-Trial Chamber II declined to confirm the charge of false or forged documents.)

From 2012 to November 14, 2013, Mr. Babala, as alleged by the OTP, following conversations with Mr. Bemba, made transfers of money to defense witnesses. Mr. Babala personally and through his chauffeur also made transfers of money to lead defense counsel [Aimé Kilolo Musamba](https://www.aba-icc.org/accused/aime-kilolo-musamba/) and defense case manager [Jean-Jacques Mangenda Kabongo](https://www.aba-icc.org/accused/jean-jacques-magenda-kabongo/).

Please visit the Court's website for more information on [*The Prosecutor v. Bemba et al*](https://www.icc-cpi.int/car/Bemba-et-al).

### Charges

The Accused is alleged to have aided and abetted, or otherwise assisted in, the commission of the crimes listed below under [Article 25(3)(c)](http://www.casematrixnetwork.org/case-m/klamberg-commentary/rome-statute/#c1198) of the Rome Statute.

Under this mode of criminal liability, the Accused is charged with the following crimes:

> Giving False Testimony in Court (Offense against the Administration of Justice): [Article 70(1)(a)](http://www.casematrixnetwork.org/case-m/klamberg-commentary/rome-statute/#c1243)
>
>
> Presenting False Evidence (Offense against the Administration of Justice): [Article 70(1)(b)](http://www.casematrixnetwork.org/case-m/klamberg-commentary/rome-statute/#c1243)
>
>
> Corruptly Influencing Witnesses (Offense against the Administration of Justice): [Article 70(1)(c)](http://www.casematrixnetwork.org/case-m/klamberg-commentary/rome-statute/#c1243)


text:
import pyb

class AtomicTest:

    def start(self):
        self.counter = 0
        self.irq_count = 0
        self.main_count = 0
        self.done = False
        tim = pyb.Timer(4)
        tim.init(freq=1000)
        tim.callback(self.callback)

    def report(self):
        print("main_count = %d irq_count = %d counter = %d sum = %d" % (self.main_count, self.irq_count, self.counter, self.main_count + self.irq_count))

    def callback(self, tim):
        self.counter += 1
        self.irq_count += 1
        if self.irq_count >= 10000:
            tim.callback(None)
            self.done = True

t = AtomicTest()

t.start()
while not t.done:
    t.main_count += 1
    t.counter += 1
t.report()

t.start()
while not t.done:
    t.main_count += 1
    pyb.disable_irq()
    t.counter += 1
    pyb.enable_irq()
t.report()


text:
package com.commonsware.android.files;

import android.app.Activity;
import android.os.Bundle;
import android.app.ListActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import java.io.InputStream;
import java.util.ArrayList;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

public class StaticFileDemo extends ListActivity {
  TextView selection;
  ArrayList<String> items=new ArrayList<String>();

  @Override
  public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.main);
    selection=(TextView)findViewById(R.id.selection);

    try {
      InputStream in=getResources().openRawResource(R.raw.words);
      DocumentBuilder builder=DocumentBuilderFactory
                                .newInstance()
                                .newDocumentBuilder();
      Document doc=builder.parse(in, null);
      NodeList words=doc.getElementsByTagName("word");

      for (int i=0;i<words.getLength();i++) {
        items.add(((Element)words.item(i)).getAttribute("value"));
      }

      in.close();
    }
    catch (Throwable t) {
      Toast
        .makeText(this, "Exception: "+t.toString(), Toast.LENGTH_LONG)
        .show();
    }

    setListAdapter(new ArrayAdapter<String>(this,
                                  android.R.layout.simple_list_item_1,
                                  items));
  }

  public void onListItemClick(ListView parent, View v, int position,
                  long id) {
    selection.setText(items.get(position).toString());
  }
}


text:
namespace {

// Predefined padding for the icon used in this tray. These are to be set to the
// border of the icon, depending on the current shelf_alignment()
const int kHorizontalShelfHorizontalPadding = 8;
const int kHorizontalShelfVerticalPadding = 4;
const int kVerticalShelfHorizontalPadding = 2;
const int kVerticalShelfVerticalPadding = 5;

}  // namespace

namespace ash {

OverviewButtonTray::OverviewButtonTray(StatusAreaWidget* status_area_widget)
    : TrayBackgroundView(status_area_widget), icon_(NULL) {
  SetContentsBackground();

  ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
  icon_ = new views::ImageView();
  icon_->SetImage(
      bundle.GetImageNamed(IDR_AURA_UBER_TRAY_OVERVIEW_MODE).ToImageSkia());
  SetIconBorderForShelfAlignment();
  tray_container()->AddChildView(icon_);

  Shell::GetInstance()->AddShellObserver(this);
}

OverviewButtonTray::~OverviewButtonTray() {
  Shell::GetInstance()->RemoveShellObserver(this);
}

void OverviewButtonTray::UpdateAfterLoginStatusChange(
    user::LoginStatus status) {
  UpdateIconVisibility();
}

bool OverviewButtonTray::PerformAction(const ui::Event& event) {
  WindowSelectorController* controller =
      Shell::GetInstance()->window_selector_controller();
  controller->ToggleOverview();
  SetDrawBackgroundAsActive(controller->IsSelecting());
  return true;
}

void OverviewButtonTray::OnMaximizeModeStarted() {
  UpdateIconVisibility();
}

void OverviewButtonTray::OnMaximizeModeEnded() {
  UpdateIconVisibility();
}

bool OverviewButtonTray::ClickedOutsideBubble() {
  // This class has no bubbles dismiss, but acknowledge that the message was
  // handled.
  return true;
}

base::string16 OverviewButtonTray::GetAccessibleNameForTray() {
  return l10n_util::GetStringUTF16(IDS_ASH_OVERVIEW_BUTTON_ACCESSIBLE_NAME);
}

void OverviewButtonTray::HideBubbleWithView(
    const views::TrayBubbleView* bubble_view) {
  // This class has no bubbles to hide.
}

void OverviewButtonTray::SetShelfAlignment(ShelfAlignment alignment) {
  if (alignment == shelf_alignment())
    return;

  TrayBackgroundView::SetShelfAlignment(alignment);
  SetIconBorderForShelfAlignment();
}

void OverviewButtonTray::SetIconBorderForShelfAlignment() {
  if (shelf_alignment() == SHELF_ALIGNMENT_BOTTOM ||
      shelf_alignment() == SHELF_ALIGNMENT_TOP) {
    icon_->SetBorder(views::Border::CreateEmptyBorder(
        kHorizontalShelfVerticalPadding,
        kHorizontalShelfHorizontalPadding,
        kHorizontalShelfVerticalPadding,
        kHorizontalShelfHorizontalPadding));
  } else {
    icon_->SetBorder(views::Border::CreateEmptyBorder(
        kVerticalShelfVerticalPadding,
        kVerticalShelfHorizontalPadding,
        kVerticalShelfVerticalPadding,
        kVerticalShelfHorizontalPadding));
  }
}

void OverviewButtonTray::UpdateIconVisibility() {
  SetVisible(Shell::GetInstance()->maximize_mode_controller()->
                 IsMaximizeModeWindowManagerEnabled() &&
             Shell::GetInstance()->window_selector_controller()->CanSelect());
}

}  // namespace ash


text:
Auto generate stub classes, based off of existing Objective-C classes, for testing.

The idea is to create a system that can create classes that can be a drop-in replacement for framework classes such as UIKit. By creating empty implementations of these classes you eliminate the time it takes to create and display views, draw calls, etc. that can impact the length of time it takes your tests to run.

Each of the auto-generated classes would have only the necessary functions that iniatilize their respective classes; such that UIViewController stub class could be made which still makes calls to loadView, viewWillAppear and viewDidAppear in the same order as its non-stubbed class.

You can configure the stub generator to emit only changes between an existing stubbed class and a source class. That way, as changes are made to the stubbed classes, you have the ability to quickly add/remove methods which are associated to the source class.

# API

As an example, the following will take a source class, UIView, and use an existing stubbed UIView class to add only what has changed between the two APIs. Changes that are _removed_ from the source class will not be removed from the target stub class unless specifically told to do so.

@todo


text:
package org.apache.jena.tdbloader4;

import static com.hp.hpl.jena.tdb.lib.NodeLib.setHash;
import static com.hp.hpl.jena.tdb.sys.SystemTDB.LenNodeHash;
import static com.hp.hpl.jena.tdb.sys.SystemTDB.SizeOfNodeId;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.util.Comparator;
import java.util.Iterator;

import org.openjena.atlas.AtlasException;
import org.openjena.atlas.data.SerializationFactory;
import org.openjena.atlas.data.SortedDataBag;
import org.openjena.atlas.data.ThresholdPolicyCount;
import org.openjena.atlas.iterator.Iter;
import org.openjena.atlas.iterator.Transform;
import org.openjena.atlas.lib.Bytes;
import org.openjena.atlas.lib.Closeable;
import org.openjena.atlas.lib.Pair;
import org.openjena.atlas.lib.Sink;
import org.slf4j.Logger;

import com.hp.hpl.jena.graph.Node;
import com.hp.hpl.jena.tdb.base.block.BlockMgr;
import com.hp.hpl.jena.tdb.base.block.BlockMgrFactory;
import com.hp.hpl.jena.tdb.base.file.FileFactory;
import com.hp.hpl.jena.tdb.base.file.FileSet;
import com.hp.hpl.jena.tdb.base.file.Location;
import com.hp.hpl.jena.tdb.base.objectfile.ObjectFile;
import com.hp.hpl.jena.tdb.base.record.Record;
import com.hp.hpl.jena.tdb.base.record.RecordFactory;
import com.hp.hpl.jena.tdb.index.Index;
import com.hp.hpl.jena.tdb.index.bplustree.BPlusTree;
import com.hp.hpl.jena.tdb.index.bplustree.BPlusTreeParams;
import com.hp.hpl.jena.tdb.index.bplustree.BPlusTreeRewriter;
import com.hp.hpl.jena.tdb.lib.NodeLib;
import com.hp.hpl.jena.tdb.store.Hash;
import com.hp.hpl.jena.tdb.store.bulkloader.BulkLoader;
import com.hp.hpl.jena.tdb.store.bulkloader2.ProgressLogger;
import com.hp.hpl.jena.tdb.sys.Names;
import com.hp.hpl.jena.tdb.sys.SetupTDB;
import com.hp.hpl.jena.tdb.sys.SystemTDB;

public class NodeTableRewriter {

	public static void fixNodeTable(Location location) {
		fixNodeTable(location, null);
	}

	public static void fixNodeTable(Location location, ProgressLogger monitor) {
		String path = location.getDirectoryPath() ;
		new File(path, "node2id.dat").delete() ;
		new File(path, "node2id.idn").delete() ;

		ObjectFile objects = FileFactory.createObjectFileDisk(path + File.separator + "nodes.dat");
		Index nodeToId = SetupTDB.makeIndex(location, Names.indexNode2Id, LenNodeHash, SizeOfNodeId, -1 ,-1) ;
		RecordFactory recordFactory = nodeToId.getRecordFactory();

		Iterator<Pair<Long,ByteBuffer>> iter = objects.all();
		while ( iter.hasNext() ) {
			Pair<Long, ByteBuffer> pair = iter.next();
			long id = pair.getLeft() ;
			Node node = NodeLib.fetchDecode(id, objects) ;
	        Hash hash = new Hash(recordFactory.keyLength()) ;
	        setHash(hash, node) ;
	        byte k[] = hash.getBytes() ;
	        Record record = recordFactory.create(k) ;
	        Bytes.setLong(id, record.getValue(), 0) ;
			nodeToId.add(record);
			if ( monitor != null ) monitor.tick();
		}

		nodeToId.sync();
		nodeToId.close();
		objects.sync();
		objects.close();
	}

	public static void fixNodeTable2(Location location, Logger log, ProgressLogger monitor) throws IOException {
		String path = location.getDirectoryPath() ;
		new File(path, "node2id.dat").delete() ;
		new File(path, "node2id.idn").delete() ;

		// input
		ObjectFile objects = FileFactory.createObjectFileDisk(path + File.separator + "nodes.dat");
		// sorted bag
	    ThresholdPolicyCount<Pair<byte[],Long>> policy = new ThresholdPolicyCount<Pair<byte[],Long>>(10000000);
	    Comparator<Pair<byte[],Long>> comparator = new PairComparator();
		SortedDataBag<Pair<byte[],Long>> sortedDataBag = new SortedDataBag<Pair<byte[],Long>>(policy, new PairSerializationFactory(), comparator);

		Iterator<Pair<Long,ByteBuffer>> iter = objects.all();
		while ( iter.hasNext() ) {
			Pair<Long, ByteBuffer> pair = iter.next();
			long id = pair.getLeft();
			Node node = NodeLib.fetchDecode(id, objects);
	        Hash hash = new Hash(SystemTDB.LenNodeHash);
	        setHash(hash, node);
	        byte k[] = hash.getBytes();
	        sortedDataBag.send(new Pair<byte[],Long>(k, id));
			if ( monitor != null ) monitor.tick();
		}
		objects.sync();
		objects.close();

        // output
		final ProgressLogger monitor2 = new ProgressLogger(log, "Data (2/2)", BulkLoader.DataTickPoint,BulkLoader.superTick);
		log.info("Data (2/2)...");
		monitor2.start();

		final RecordFactory recordFactory = new RecordFactory(LenNodeHash, SizeOfNodeId) ;
		Transform<Pair<byte[],Long>, Record> transformPair2Record = new Transform<Pair<byte[],Long>, Record>() {
		    @Override public Record convert(Pair<byte[],Long> pair) {
		        monitor2.tick();
		        return recordFactory.create(pair.getLeft(), Bytes.packLong(pair.getRight()));
		    }
		};

		int order = BPlusTreeParams.calcOrder(SystemTDB.BlockSize, recordFactory) ;
		BPlusTreeParams bptParams = new BPlusTreeParams(order, recordFactory) ;
		int readCacheSize = 10 ;
		int writeCacheSize = 100 ;
		FileSet destination = new FileSet(location, Names.indexNode2Id) ;
		BlockMgr blkMgrNodes = BlockMgrFactory.create(destination, Names.bptExtTree, SystemTDB.BlockSize, readCacheSize, writeCacheSize) ;
		BlockMgr blkMgrRecords = BlockMgrFactory.create(destination, Names.bptExtRecords, SystemTDB.BlockSize, readCacheSize, writeCacheSize) ;
		Iterator<Record> iter2 = Iter.iter(sortedDataBag.iterator()).map(transformPair2Record) ;
	    BPlusTree bpt2 = BPlusTreeRewriter.packIntoBPlusTree(iter2, bptParams, recordFactory, blkMgrNodes, blkMgrRecords) ;
	    bpt2.sync() ;
	    bpt2.close() ;

		sortedDataBag.close();
	}

    static class PairSerializationFactory implements SerializationFactory<Pair<byte[],Long>> {
        @Override public Iterator<Pair<byte[],Long>> createDeserializer(InputStream in) { return new PairInputStream(in); }
        @Override public Sink<Pair<byte[],Long>> createSerializer(OutputStream out) { return new PairOutputStream(out); }
        @Override public long getEstimatedMemorySize(Pair<byte[],Long> item) { throw new AtlasException("Method not implemented.") ; }
    }

    static class PairComparator implements Comparator<Pair<byte[],Long>> {
        @Override
        public int compare(Pair<byte[],Long> p1, Pair<byte[],Long> p2) {
            int size = p1.getLeft().length;
            if ( size != p2.getLeft().length ) throw new AtlasException("Cannot compare pairs with hash values of different sizes.") ;
            return Bytes.compare(p1.getLeft(), p2.getLeft()) ;
        }
    }

    static class PairInputStream implements Iterator<Pair<byte[],Long>>, Closeable {

        private DataInputStream in ;
        private Pair<byte[],Long> slot = null ;

        public PairInputStream(InputStream in) {
            this.in = new DataInputStream(new BufferedInputStream(in)) ;
            slot = readNext() ;
        }

        @Override
        public boolean hasNext() {
            return slot != null ;
        }

        @Override
        public Pair<byte[],Long> next() {
        	Pair<byte[],Long> result = slot ;
            slot = readNext() ;
            return result ;
        }

        private Pair<byte[],Long> readNext() {
            try {
            	int len = in.readInt() ;
            	byte hash[] = new byte[len] ;
            	in.readFully(hash) ;
            	long id = in.readLong() ;
            	return new Pair<byte[],Long>(hash, id) ;
            } catch (IOException e) {
                return null ;
            }
        }

        @Override
        public void remove() {
            throw new AtlasException("Method not implemented.") ;
        }

        @Override
        public void close() {
            try {
                in.close() ;
            } catch (IOException e) {
                new AtlasException(e) ;
            }
        }

    }

    static class PairOutputStream implements Sink<Pair<byte[],Long>> {

        private DataOutputStream out ;

        public PairOutputStream(OutputStream out) {
            this.out = new DataOutputStream(new BufferedOutputStream(out)) ;
        }

        @Override
        public void send(Pair<byte[],Long> pair) {
        	try {
            	byte hash[] = pair.getLeft() ;
            	long id = pair.getRight() ;
            	out.writeInt(hash.length) ;
				out.write(hash) ;
	        	out.writeLong(id) ;
			} catch (IOException e) {
				new AtlasException(e) ;
			}
        }

        @Override
        public void flush() {
            try {
                out.flush() ;
            } catch (IOException e) {
                new AtlasException(e) ;
            }
        }

        @Override
        public void close() {
            try {
                out.close() ;
            } catch (IOException e) {
                new AtlasException(e) ;
            }
        }

    }

}


text:
require 'spec_helper'

class BancoBrasil < BoletoBancario::BancoBrasil
  def self.valor_documento_tamanho_maximo
    100 # Default 99999999.99
  end

  def self.carteiras_suportadas
    %w[12 17] # Default %w[12 16 17 18]
  end
end

describe BancoBrasil do
  describe "on validations" do
    it { should have_valid(:valor_documento).when(99, 99.99, 25) }
    it { should_not have_valid(:valor_documento).when(100.01, 150) }

    it { should have_valid(:carteira).when(12, 17) }
    it { should_not have_valid(:carteira).when(16, 18, 20) }
  end
end


text:
package org.apache.poi.hwpf.model;

import org.apache.poi.hwpf.model.types.FibRgW97AbstractType;
import org.apache.poi.util.Internal;

/**
 * The FibRgW97 structure is a variable-length portion of the Fib.
 * <p>
 * Class and fields descriptions are quoted from Microsoft Office Word 97-2007
 * Binary File Format and [MS-DOC] - v20110608 Word (.doc) Binary File Format.
 *
 * @author Sergey Vladimirov; according to Microsoft Office Word 97-2007 Binary
 *         File Format Specification [*.doc] and [MS-DOC] - v20110608 Word
 *         (.doc) Binary File Format
 */
@Internal
public class FibRgW97 extends FibRgW97AbstractType
{

    public FibRgW97()
    {
    }

    public FibRgW97( byte[] std, int offset )
    {
        fillFields( std, offset );
    }

    @Override
    @SuppressWarnings( "deprecation" )
    public boolean equals( Object obj )
    {
        if ( this == obj )
            return true;
        if ( obj == null )
            return false;
        if ( getClass() != obj.getClass() )
            return false;
        FibRgW97 other = (FibRgW97) obj;
        if ( field_10_reserved10 != other.field_10_reserved10 )
            return false;
        if ( field_11_reserved11 != other.field_11_reserved11 )
            return false;
        if ( field_12_reserved12 != other.field_12_reserved12 )
            return false;
        if ( field_13_reserved13 != other.field_13_reserved13 )
            return false;
        if ( field_14_lidFE != other.field_14_lidFE )
            return false;
        if ( field_1_reserved1 != other.field_1_reserved1 )
            return false;
        if ( field_2_reserved2 != other.field_2_reserved2 )
            return false;
        if ( field_3_reserved3 != other.field_3_reserved3 )
            return false;
        if ( field_4_reserved4 != other.field_4_reserved4 )
            return false;
        if ( field_5_reserved5 != other.field_5_reserved5 )
            return false;
        if ( field_6_reserved6 != other.field_6_reserved6 )
            return false;
        if ( field_7_reserved7 != other.field_7_reserved7 )
            return false;
        if ( field_8_reserved8 != other.field_8_reserved8 )
            return false;
        if ( field_9_reserved9 != other.field_9_reserved9 )
            return false;
        return true;
    }

    @Override
    @SuppressWarnings( "deprecation" )
    public int hashCode()
    {
        final int prime = 31;
        int result = 1;
        result = prime * result + field_10_reserved10;
        result = prime * result + field_11_reserved11;
        result = prime * result + field_12_reserved12;
        result = prime * result + field_13_reserved13;
        result = prime * result + field_14_lidFE;
        result = prime * result + field_1_reserved1;
        result = prime * result + field_2_reserved2;
        result = prime * result + field_3_reserved3;
        result = prime * result + field_4_reserved4;
        result = prime * result + field_5_reserved5;
        result = prime * result + field_6_reserved6;
        result = prime * result + field_7_reserved7;
        result = prime * result + field_8_reserved8;
        result = prime * result + field_9_reserved9;
        return result;
    }

}


text:
#include "ansidecl.h"
#include <ctype.h>
#include <limits.h>
#include <stddef.h>
#include <stdlib.h>
/* errno.h is needed on SunOS 4.1.2 */
#include <errno.h>

#ifndef	UNSIGNED
#define	UNSIGNED	0
#endif

/* Convert NPTR to an `unsigned long int' or `long int' in base BASE.
   If BASE is 0 the base is determined by the presence of a leading
   zero, indicating octal or a leading "0x" or "0X", indicating hexadecimal.
   If BASE is < 2 or > 36, it is reset to 10.
   If ENDPTR is not NULL, a pointer to the character after the last
   one converted is stored in *ENDPTR.  */
#if	UNSIGNED
unsigned long int
#define	strtol	strtoul
#else
long int
#endif
DEFUN(strtol, (nptr, endptr, base),
      CONST char *nptr AND char **endptr AND int base)
{
  int negative;
  register unsigned long int cutoff;
  register unsigned int cutlim;
  register unsigned long int i;
  register CONST char *s;
  register unsigned char c;
  CONST char *save;
  int overflow;

  if (base < 0 || base == 1 || base > 36)
    base = 10;

  s = nptr;

  /* Skip white space.  */
  while (isspace(*s))
    ++s;
  if (*s == '\0')
    goto noconv;

  /* Check for a sign.  */
  if (*s == '-')
    {
      negative = 1;
      ++s;
    }
  else if (*s == '+')
    {
      negative = 0;
      ++s;
    }
  else
    negative = 0;

  if (base == 16 && s[0] == '0' && toupper(s[1]) == 'X')
    s += 2;

  /* If BASE is zero, figure it out ourselves.  */
  if (base == 0)
    if (*s == '0')
      {
	if (toupper(s[1]) == 'X')
	  {
	    s += 2;
	    base = 16;
	  }
	else
	  base = 8;
      }
    else
      base = 10;

  /* Save the pointer so we can check later if anything happened.  */
  save = s;

  cutoff = ULONG_MAX / (unsigned long int) base;
  cutlim = ULONG_MAX % (unsigned long int) base;

  overflow = 0;
  i = 0;
  for (c = *s; c != '\0'; c = *++s)
    {
      if (isdigit(c))
	c -= '0';
      else if (isalpha(c))
	c = toupper(c) - 'A' + 10;
      else
	break;
      if (c >= base)
	break;
      /* Check for overflow.  */
      if (i > cutoff || (i == cutoff && c > cutlim))
	overflow = 1;
      else
	{
	  i *= (unsigned long int) base;
	  i += c;
	}
    }

  /* Check if anything actually happened.  */
  if (s == save)
    goto noconv;

  /* Store in ENDPTR the address of one character
     past the last character we converted.  */
  if (endptr != NULL)
    *endptr = (char *) s;

#if	!UNSIGNED
  /* Check for a value that is within the range of
     `unsigned long int', but outside the range of `long int'.  */
  if (i > (negative ?
	   - (unsigned long int) LONG_MIN : (unsigned long int) LONG_MAX))
    overflow = 1;
#endif

  if (overflow)
    {
      errno = ERANGE;
#if	UNSIGNED
      return ULONG_MAX;
#else
      return negative ? LONG_MIN : LONG_MAX;
#endif
    }

  /* Return the result of the appropriate sign.  */
  return (negative ? - i : i);

 noconv:
  /* There was no number to convert.  */
  if (endptr != NULL)
    *endptr = (char *) nptr;
  return 0L;
}


text:
<?xml version="1.0" encoding="utf-8"?>
<net.coding.program.common.widget.LoginAutoCompleteEdit xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/editGlobal"
    android:layout_width="match_parent"
    android:layout_height="@dimen/edit_height"
    android:layout_marginLeft="@dimen/padding_15"
    android:layout_marginRight="@dimen/padding_15"
    android:background="@null"
    android:hint="用户名(个性后缀)"
    android:inputType="textEmailAddress"
    android:maxLines="1"
    android:lines="1"
    android:textCursorDrawable="@null"
    android:textSize="18sp" />


text:
package ro.dutylabs.mpp.web.controller;

import org.springframework.web.bind.annotation.RestController;

/**
 * Created by cosmin on 12/06/2017.
 */
@RestController
public class BookController {
}


text:
namespace Device
{
	class DirectX;
}

namespace Core
{
	class Engine final
	{
	public:
		friend class EngineUtility;

		Engine(Device::DirectX& dx);

		DISALLOW_ASSIGN(Engine);
		DISALLOW_COPY_CONSTRUCTOR(Engine);

		// Scene
		void RunScene();
		void ChangeScene(IScene* scene);

		// System
		void Initialize(IScene* scene);
		void Destroy();

		// Root
		void AddRootObject(const Core::Object& object);
		void UpdateWorldMatrix();

		void StartLoop() { _prevTime = clock(); }

		GET_ALL_ACCESSOR_REF(DirectX,			_dx);
		GET_ALL_ACCESSOR_REF(ComponentSystem,	_componentSystem);
		GET_ALL_ACCESSOR_REF(TransformPool,		_transformPool);
		GET_ALL_ACCESSOR_REF(RootObjectIDs,		_rootObjectIDs);
		GET_ALL_ACCESSOR_REF(RenderingSystem,	_rendering);
		GET_ALL_ACCESSOR_REF(ObjectManager,		_objectManager);
		GET_ALL_ACCESSOR_REF(Importer,			_importer);

		GET_CONST_ACCESSOR(Exit,	bool,	_exit);

		Rendering::Renderer::CullingParam GetCullingParam() const
		{
			return Rendering::Renderer::CullingParam{
				_componentSystem.GetManager_Direct<Rendering::Manager::MeshManager>(),
				_objectManager,
				_transformPool
			};
		}

		SET_ACCESSOR(UpdateTime,			clock_t,	_perUpdate);
		GET_CONST_ACCESSOR(UpdateTime,		clock_t,	_perUpdate);
		GET_CONST_ACCESSOR(FPS,				float,		_fps);

	private:
		NullScene									_nullScene;
		IScene*										_scene;

		clock_t										_prevTime				= 0;
		clock_t										_perUpdate				= 100;
		clock_t										_elapsedTimeForUpdate	= 0;
		uint										_frameCount				= 0;
		float										_fps					= 0.0f;
		float										_elapsedTimePerFrame	= 0.0f;

		Core::RootObjectIDs							_rootObjectIDs;

		Core::ObjectManager							_objectManager;
		Core::ComponentSystem						_componentSystem;

		Core::TransformPool							_transformPool;
		Core::TransformPool							_dontUseTransformPool;

		Rendering::RenderingSystem					_rendering;

		Importer::MeshImporter						_importer;
		Device::DirectX&							_dx;

	private:
		std::vector<Core::Transform*>				_dirtyTransforms;
		bool										_exit = false;

		EngineUtility								_util;
	};
}


text:
package com.github.signaflo.timeseries.model.regression;

import com.google.common.testing.EqualsTester;
import org.junit.Test;
import com.github.signaflo.timeseries.TestData;
import com.github.signaflo.timeseries.TimeSeries;

import static org.junit.Assert.assertArrayEquals;

import static org.hamcrest.MatcherAssert.*;
import static org.hamcrest.Matchers.*;

public class TimeSeriesLinearRegressionSpec {

    private TimeSeries livestock = TestData.livestock;
    private TimeSeriesLinearRegression model =
            TimeSeriesLinearRegression.builder()
                                      .response(livestock)
                                      .build();

    @Test
    public void whenTSLRFitThenBetaCorrect() {
        TimeSeries debitcards = TestData.debitcards.timeSlice(1, 156);
        TimeSeriesLinearRegressionBuilder tslmBuilder =
                TimeSeriesLinearRegression.builder()
                                          .response(debitcards)
                                          .seasonal(TimeSeriesLinearRegressionModel.Seasonal.INCLUDE);
        TimeSeriesLinearRegression regression = tslmBuilder.build();
        double[] expected = {6568.304945, 92.552198, -344.706044, 590.510989, 367.035714, 2166.637363, 2343.239011,
                2621.840659, 3399.442308, 1197.505495, 1310.491758, 868.631868, 5646.618132};
        assertArrayEquals(expected, regression.beta(), 1E-6);
    }

    @Test
    public void whenNotSpecifiedThenModelHasInterceptByDefault() {
        assertThat(model.hasIntercept(), is(true));
    }

    @Test
    public void whenModelFitThenSigma2Correct() {
        assertThat(model.sigma2(), is(closeTo(264.01, 1E-2)));
    }

    @Test
    public void whenModelFitThenFittedValuesCorrect() {
        assertArrayEquals(getFittedValues(), model.fitted(), 1E-6);
    }

    @Test
    public void whenModelFitThenResidualsCorrect() {
        double[] expectedResiduals = livestock.minus(getFittedValues()).asArray();
        assertArrayEquals(expectedResiduals, model.residuals(), 1E-6);
    }

    @Test
    public void whenModelFitThenCorrectPredictorsReturned() {
        double[][] expectedPredictors = new double[][] {};
        assertThat(model.predictors(), is(expectedPredictors));
    }
//
//    @Test
//    public void whenModelFitThenCorrectDesignMatrix() {
//        double[] ones = DoubleFunctions.fill(47, 1.0);
//        double[] time = Range.inclusiveRange(1, 47).asArray();
//        double[][] expectedDesignMatrix = new double[][] {ones, time};
//        assertThat(model.designMatrix(), is(expectedDesignMatrix));
//    }

    @Test
    public void equalsContract() {
        TimeSeriesLinearRegression otherModel = TimeSeriesLinearRegression.builder().from(model).build();
        TimeSeriesLinearRegression modelA =
                TimeSeriesLinearRegression.builder()
                                          .response(livestock)
                                          .hasIntercept(TimeSeriesLinearRegressionModel.Intercept.EXCLUDE)
                                          .build();
        TimeSeriesLinearRegression modelB = TimeSeriesLinearRegression.builder().from(modelA).build();
        TimeSeriesLinearRegression model2A =
                TimeSeriesLinearRegression.builder()
                                          .response(livestock)
                                          .timeTrend(TimeSeriesLinearRegressionModel.TimeTrend.EXCLUDE)
                                          .build();
        TimeSeriesLinearRegression model2B = TimeSeriesLinearRegression.builder().from(model2A).build();
        TimeSeriesLinearRegression model3A =
                TimeSeriesLinearRegression.builder()
                                          .response(livestock.demean())
                                          .build();
        TimeSeriesLinearRegression model3B = TimeSeriesLinearRegression.builder().from(model3A).build();
        new EqualsTester()
                .addEqualityGroup(model, otherModel)
                .addEqualityGroup(modelA, modelB)
                .addEqualityGroup(model2A, model2B)
                .addEqualityGroup(model3A, model3B)
                .testEquals();
    }

    private double[] getFittedValues() {
        return new double[]{222.702218, 227.58561, 232.469001, 237.352393, 242.235784, 247.119176, 252.002567,
                256.885959, 261.76935, 266.652742, 271.536133, 276.419525, 281.302916, 286.186308, 291.069699,
                295.953091, 300.836482, 305.719874, 310.603265, 315.486657, 320.370048, 325.25344, 330.136831,
                335.020223, 339.903614, 344.787006, 349.670397, 354.553788, 359.43718, 364.320571, 369.203963,
                374.087354, 378.970746, 383.854137, 388.737529, 393.62092, 398.504312, 403.387703, 408.271095,
                413.154486, 418.037878, 422.921269, 427.804661, 432.688052, 437.571444, 442.454835, 447.338227};
    }
}


text:
module.exports = (sequelize, DataTypes) => {
  const section = sequelize.define(
    'section',
    {
      name: DataTypes.STRING
    },
    {
      timestamps: false,
      classMethods: {
        associate: function associate(models) {
          this.hasMany(models.qari, { foreignKey: 'section_id' });
        }
      }
    }
  );
  return section;
};


text:
using System;
using System.IO;
using System.Threading.Tasks;

namespace YetiCommon
{
    public interface IModuleParser
    {
        /// <summary>
        /// Parse a <see cref="DebugLinkLocationInfo"/> instance from the file and populate its
        /// Error property with all warnings that occurred during the processing. This method
        /// doesn't throw, all errors will be returned in the Error property.
        /// </summary>
        /// <param name="filepath">Full path to the file to parse.</param>
        /// <returns>Debug link information, optionally containing Filename, Directory, and
        /// Error.</returns>
        DebugLinkLocationInfo ParseDebugLinkInfo(string filepath);
        /// <summary>
        /// Parse a <see cref="BuildIdInfo"/> instance from the  file and populate its Error
        /// property with all warnings that  occurred during the processing. This method doesn't
        /// throw, all errors will be returned in the Error property.
        /// </summary>
        /// <param name="filepath">Full path to the file to parse.</param>
        /// <param name="format">Expected format of the file to parse.</param>
        /// <returns>Build ID info instance, optionally containing BuildId, and Error.</returns>
        BuildIdInfo ParseBuildIdInfo(string filepath, ModuleFormat format);

        /// <summary>
        /// Parses a binary or symbol file on a gamelet and returns the build ID encoded in the
        /// .note.gnu.build-id section of the file.
        /// </summary>
        /// <param name="filepath">The remote absolute file path.</param>
        /// <param name="target">The remote gamelet.</param>
        /// <returns>A non-empty build id.</returns>
        /// <exception cref="BinaryFileUtilException">
        /// Thrown when an error is encountered reading or parsing the build id.
        /// InnerException contains more details.
        /// </exception>
        /// <exception cref="InvalidBuildIdException">
        /// Thrown when the build id has an unexpected format.
        /// </exception>
        Task<BuildId> ParseRemoteBuildIdInfoAsync(string filepath, SSH.SshTarget target);

        /// <summary>
        /// Checks whether file is a valid ELF file.
        /// </summary>
        /// <param name="filepath">Full path to the file to validate.</param>
        /// <param name="isDebugInfoFile">In addition to parsing the file, also check if BuildId
        /// is populated.</param>
        /// <param name="errorMessage">Generated error message.</param>
        bool IsValidElf(string filepath, bool isDebugInfoFile, out string errorMessage);
    }

    public class DebugLinkLocationInfo
    {
        public SymbolFileLocation Data { get; set; } = new SymbolFileLocation("", "");

        public void SetFilename(string filename)
        {
            Data.Filename = filename;
        }

        public void SetDirectory(string directory)
        {
            Data.Directory = directory;
        }

        string _error = "";
        public string Error
        {
            get => _error.Trim();
            private set => _error = value;
        }

        public void AddError(string message)
        {
            Error += $"{message}{Environment.NewLine}";
        }

        public bool HasError => !string.IsNullOrWhiteSpace(Error);
    }

    public class SymbolFileLocation
    {
        public SymbolFileLocation(string directory, string filename)
        {
            Directory = directory;
            Filename = filename;
        }

        public string Filename { get; set; }
        public string Directory { get; set; }

        public bool TryGetFullPath(out string fullPath)
        {
            if (!string.IsNullOrWhiteSpace(Filename) && !string.IsNullOrWhiteSpace(Directory))
            {
                fullPath = Path.Combine(Directory, Filename);
                return true;
            }

            fullPath = "";
            return false;
        }

        public static readonly SymbolFileLocation Empty = new SymbolFileLocation("", "");

        /// <summary>
        /// If Filename is not set we can't search for a symbol file.
        /// </summary>
        public bool IsInvalid => string.IsNullOrWhiteSpace(Filename);
    }

    public class BuildIdInfo
    {
        public BuildId Data { get; set; }
        string _error = "";
        public string Error
        {
            get => _error.Trim();
            private set => _error = value;
        }

        public void AddError(string message)
        {
            Error += $"{message}{Environment.NewLine}";
        }

        public bool HasError => !string.IsNullOrWhiteSpace(Error);
    }
}


text:
"use strict";

require([__dirname + "/../low.js", __dirname + "/tools.js"], function (low, tools)
{

    exports.GridItem = function GridItem()
    {
        tools.defineProperties(this, {
            action: { set: setAction, get: action },
            fillMode: { set: setFillMode, get: fillMode },
            icon: { set: setIcon, get: icon },
            title: { set: setTitle, get: title },
            selected: { set: setSelected, get: selected },
            onClicked: { set: setOnClicked, get: onClicked }
        });

        var m_action = ["", null];
        var m_icon = "";
        var m_fillMode = "cover";
        var m_title = "";
        var m_isSelected = false;
        var m_onClicked = null;

        var m_gridItem = $(
            low.tag("div")
            .style("position", "relative")
            .style("width", "160px")
            .style("height", "160px")
            .style("padding", "0").style("margin", "0")
            .style("margin-top", "2px")
            .style("margin-left", "2px")
            .style("background-repeat", "no-repeat")
            .style("background-position", "50% 50%")
            .content(
                low.tag("h1")
                .style("position", "absolute")
                .style("background-color", "var(--color-primary-background-translucent)")
                .style("padding", "0")
                .style("left", "0")
                .style("right", "0")
                .style("bottom", "0")
                .style("font-size", "80%")
                .style("text-align", "center")
                .content("")
            )
            .html()
        );

        var m_iconBox = m_gridItem;
        var m_buttonBox = m_gridItem.find("> div").eq(2);

        this.get = function ()
        {
            return m_gridItem;
        };

        function setIcon(url)
        {
            m_iconBox.css("background-image", "url(" + url + ")");
            m_icon = url;
        }

        function icon()
        {
            return m_icon;
        }

        function setFillMode(fillMode)
        {
            m_iconBox.css("background-size", fillMode || "auto");
            m_fillMode = fillMode;
        }

        function fillMode()
        {
            return m_fillMode;
        }

        function setTitle(title)
        {
            m_gridItem.find("h1").html(low.resolveIcons(low.escapeHtml(title)));
            m_title = title;
        }

        function title()
        {
            return m_title;
        }

        function setSelected(value)
        {
            if (value)
            {
                m_gridItem.find("> div").last().addClass("sh-inverted");
            }
            else
            {
                m_gridItem.find("> div").last().removeClass("sh-inverted");
            }
            m_isSelected = value;
        }

        function selected()
        {
            return m_isSelected;
        }

        function setAction(action)
        {
            var icon = action[0];
            var callback = action[1];

            var box = $(
                low.tag("div")
                .style("position", "absolute")
                .style("top", "0")
                .style("right", "0")
                .style("width", "42px")
                .style("height", "42px")
                .style("text-align", "center")
                .style("border-radius", "3px")
                .content(
                    low.tag("span").class("sh-fw-icon " + icon)
                    .style("line-height", "42px")
                )
                .html()
            );
            box.on("click", function (event)
            {
                event.stopPropagation();
                callback();
            });

            m_gridItem.append(box);
            m_action = action;
        }

        function action()
        {
            return m_action;
        }

        function setOnClicked(callback)
        {
            m_gridItem.off("click").on("click", callback);
            m_onClicked = callback;
        }

        function onClicked()
        {
            return m_onClicked;
        }
    };

});