text:
package io.crate.executor.transport;

import com.carrotsearch.hppc.IntArrayList;
import com.google.common.collect.Iterators;
import io.crate.Constants;
import io.crate.Streamer;
import io.crate.planner.symbol.Reference;
import io.crate.planner.symbol.Symbol;
import org.elasticsearch.action.bulk.BulkProcessorRequest;
import org.elasticsearch.action.bulk.SymbolBasedBulkShardProcessor;
import org.elasticsearch.action.support.replication.ShardReplicationOperationRequest;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Streamable;
import org.elasticsearch.common.lucene.uid.Versions;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.index.shard.ShardId;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class SymbolBasedShardUpsertRequest extends ShardReplicationOperationRequest<SymbolBasedShardUpsertRequest> implements Iterable<SymbolBasedShardUpsertRequest.Item>, BulkProcessorRequest {

    /**
     * A single update item.
     */
    static class Item implements Streamable {

        private String id;
        private String routing;
        private long version = Versions.MATCH_ANY;

        /**
         * List of symbols used on update if document exist
         */
        @Nullable
        private Symbol[] updateAssignments;

        /**
         * List of objects used on insert
         */
        @Nullable
        private Object[] insertValues;

        /**
         * List of data type streamer needed for streaming insert values
         */
        @Nullable
        private Streamer[] insertValuesStreamer;

        Item(@Nullable Streamer[] insertValuesStreamer) {
            this.insertValuesStreamer = insertValuesStreamer;
        }

        Item(String id,
             @Nullable Symbol[] updateAssignments,
             @Nullable Object[] insertValues,
             @Nullable Long version,
             @Nullable String routing,
             @Nullable Streamer[] insertValuesStreamer) {
            this(insertValuesStreamer);
            this.id = id;
            this.routing = routing;
            this.updateAssignments = updateAssignments;
            if (version != null) {
                this.version = version;
            }
            this.insertValues = insertValues;
        }

        public String id() {
            return id;
        }

        @Nullable
        public String routing() {
            return routing;
        }

        public long version() {
            return version;
        }

        public int retryOnConflict() {
            return version == Versions.MATCH_ANY ? Constants.UPDATE_RETRY_ON_CONFLICT : 0;
        }

        @Nullable
        public Symbol[] updateAssignments() {
            return updateAssignments;
        }

        @Nullable
        public Object[] insertValues() {
            return insertValues;
        }

        static Item readItem(StreamInput in, @Nullable Streamer[] streamers) throws IOException {
            Item item = new Item(streamers);
            item.readFrom(in);
            return item;
        }

        @Override
        public void readFrom(StreamInput in) throws IOException {
            id = in.readString();
            routing = in.readOptionalString();
            int assignmentsSize = in.readVInt();
            if (assignmentsSize > 0) {
                updateAssignments = new Symbol[assignmentsSize];
                for (int i = 0; i < assignmentsSize; i++) {
                    updateAssignments[i] = Symbol.fromStream(in);
                }
            }
            int missingAssignmentsSize = in.readVInt();
            if (missingAssignmentsSize > 0) {
                this.insertValues = new Object[missingAssignmentsSize];
                for (int i = 0; i < missingAssignmentsSize; i++) {
                    insertValues[i] = insertValuesStreamer[i].readValueFrom(in);
                }
            }

            version = Versions.readVersion(in);
        }

        @Override
        public void writeTo(StreamOutput out) throws IOException {
            out.writeString(id);
            out.writeOptionalString(routing);
            if (updateAssignments != null) {
                out.writeVInt(updateAssignments.length);
                for (Symbol updateAssignment : updateAssignments) {
                    Symbol.toStream(updateAssignment, out);
                }
            } else {
                out.writeVInt(0);
            }
            // Stream References
            if (insertValues != null) {
                out.writeVInt(insertValues.length);
                for (int i = 0; i < insertValues.length; i++) {
                    insertValuesStreamer[i].writeValueTo(out, insertValues[i]);
                }
            } else {
                out.writeVInt(0);
            }

            Versions.writeVersion(version, out);
        }
    }

    private int shardId;
    private List<Item> items;
    private IntArrayList locations;
    private boolean continueOnError = false;
    private boolean overwriteDuplicates = false;

    /**
     * List of column names used on update
     */
    @Nullable
    private String[] updateColumns;

    /**
     * List of references used on insert
     */
    @Nullable
    private Reference[] insertColumns;

    /**
     * List of data type streamer resolved through insertColumns
     */
    @Nullable
    private Streamer[] insertValuesStreamer;

    public SymbolBasedShardUpsertRequest() {
    }

    public SymbolBasedShardUpsertRequest(ShardId shardId,
                                         @Nullable
                                         String[] updateColumns,
                                         @Nullable Reference[] insertColumns) {
        assert updateColumns != null || insertColumns != null
                : "Missing updateAssignments, whether for update nor for insert";
        this.index = shardId.getIndex();
        this.shardId = shardId.id();
        locations = new IntArrayList();
        this.updateColumns = updateColumns;
        this.insertColumns = insertColumns;
        items = new ArrayList<>();
        if (insertColumns != null) {
            insertValuesStreamer = new Streamer[insertColumns.length];
            for (int i = 0; i < insertColumns.length; i++) {
                insertValuesStreamer[i] = insertColumns[i].valueType().streamer();
            }
        }
    }

    public List<Item> items() {
        return items;
    }

    public IntArrayList itemIndices() {
        return locations;
    }

    public SymbolBasedShardUpsertRequest add(int location,
                                  String id,
                                  @Nullable Symbol[] assignments,
                                  @Nullable Object[] missingAssignments,
                                  @Nullable Long version,
                                  @Nullable String routing) {
        locations.add(location);
        items.add(new Item(id, assignments, missingAssignments, version, routing, insertValuesStreamer));
        return this;
    }

    public String type() {
        return Constants.DEFAULT_MAPPING_TYPE;
    }

    public int shardId() {
        return shardId;
    }

    public String[] updateColumns() {
        return updateColumns;
    }

    @Nullable
    public Reference[] insertColumns() {
        return insertColumns;
    }

    public boolean overwriteDuplicates() {
        return overwriteDuplicates;
    }

    public SymbolBasedShardUpsertRequest overwriteDuplicates(boolean overwriteDuplicates) {
        this.overwriteDuplicates = overwriteDuplicates;
        return this;
    }

    public boolean continueOnError() {
        return continueOnError;
    }

    public SymbolBasedShardUpsertRequest continueOnError(boolean continueOnError) {
        this.continueOnError = continueOnError;
        return this;
    }

    @Override
    public Iterator<Item> iterator() {
        return Iterators.unmodifiableIterator(items.iterator());
    }

    @Override
    public void readFrom(StreamInput in) throws IOException {
        super.readFrom(in);
        shardId = in.readInt();
        int assignmentsColumnsSize = in.readVInt();
        if (assignmentsColumnsSize > 0) {
            updateColumns = new String[assignmentsColumnsSize];
            for (int i = 0; i < assignmentsColumnsSize; i++) {
                updateColumns[i] = in.readString();
            }
        }
        int missingAssignmentsColumnsSize = in.readVInt();
        if (missingAssignmentsColumnsSize > 0) {
            insertColumns = new Reference[missingAssignmentsColumnsSize];
            insertValuesStreamer = new Streamer[missingAssignmentsColumnsSize];
            for (int i = 0; i < missingAssignmentsColumnsSize; i++) {
                insertColumns[i] = Reference.fromStream(in);
                insertValuesStreamer[i] = insertColumns[i].valueType().streamer();
            }
        }
        int size = in.readVInt();
        locations = new IntArrayList(size);
        items = new ArrayList<>(size);
        for (int i = 0; i < size; i++) {
            locations.add(in.readVInt());
            items.add(Item.readItem(in, insertValuesStreamer));
        }
        continueOnError = in.readBoolean();
        overwriteDuplicates = in.readBoolean();
    }

    @Override
    public void writeTo(StreamOutput out) throws IOException {
        super.writeTo(out);
        out.writeInt(shardId);
        // Stream References
        if (updateColumns != null) {
            out.writeVInt(updateColumns.length);
            for(String column : updateColumns) {
                out.writeString(column);
            }
        } else {
            out.writeVInt(0);
        }
        if (insertColumns != null) {
            out.writeVInt(insertColumns.length);
            for(Reference reference : insertColumns) {
                Reference.toStream(reference, out);
            }
        } else {
            out.writeVInt(0);
        }
        out.writeVInt(locations.size());
        for (int i = 0; i < locations.size(); i++) {
            out.writeVInt(locations.get(i));
            items.get(i).writeTo(out);
        }
        out.writeBoolean(continueOnError);
        out.writeBoolean(overwriteDuplicates);
    }

    public static class Builder implements SymbolBasedBulkShardProcessor.BulkRequestBuilder<SymbolBasedShardUpsertRequest> {
        private final TimeValue timeout;
        private final boolean overwriteDuplicates;
        private final boolean continueOnError;
        @Nullable
        private final String[] assignmentsColumns;
        @Nullable
        private final Reference[] missingAssignmentsColumns;

        public Builder(TimeValue timeout,
                       boolean overwriteDuplicates,
                       boolean continueOnError,
                       @Nullable String[] assignmentsColumns,
                       @Nullable Reference[] missingAssignmentsColumns) {
            this.timeout = timeout;
            this.overwriteDuplicates = overwriteDuplicates;
            this.continueOnError = continueOnError;
            this.assignmentsColumns = assignmentsColumns;
            this.missingAssignmentsColumns = missingAssignmentsColumns;
        }

        @Override
        public SymbolBasedShardUpsertRequest newRequest(ShardId shardId) {
            return new SymbolBasedShardUpsertRequest(shardId, assignmentsColumns, missingAssignmentsColumns)
                    .timeout(timeout).continueOnError(continueOnError).overwriteDuplicates(overwriteDuplicates);
        }

        @Override
        public void addItem(SymbolBasedShardUpsertRequest existingRequest,
                            ShardId shardId,
                            int location,
                            String id,
                            @Nullable Symbol[] assignments,
                            @Nullable Object[] missingAssignments,
                            @Nullable String routing,
                            @Nullable Long version) {
            existingRequest.add(location, id, assignments, missingAssignments, version, routing);
        }
    }
}


text:
<?xml version="1.0" encoding="iso-8859-1"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Grid Component - Parameters </title>
<link rel="stylesheet" href="../assets/ui/css/style.css" type="text/css" />

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

    Grid Component - Parameters

FusionCharts XT Grid accepts a lot of parameters as FlashVars. These parameters can be passed using configure function (or addVariable function which is deprecated).

Given below is a list and description of all the parameters:

        Parameter Name
        Type
        Description

        showPercentValues
        Boolean
        Whether to show the numbers on grid as percentage or actual values

        numberItemsPerPage
        Number
        Number of data items that you want to display in one particular page. Use this attribute if you want to force your own value. Else, FusionCharts XT calculates the best fit value.

        showShadow
        Boolean
        Whether to show shadow for color boxes and navigation buttons.

        Background Properties

        bgColor
        Color
        If you want the grid to have a different background color from chart, use this attribute to specify the same.

        bgAlpha
        Number
        If you want the grid to have a different background alpha from chart, use this attribute to specify the same.

        bgRatio
        Number
        If you want the grid to have a different background ratio from chart, use this attribute to specify the same.

        bgAngle
        Number
        If you want the grid to have a different background angle from chart, use this attribute to specify the same.

        Border Properties

        showBorder
        Boolean
        Whether to show border for the grid.

        borderColor
        Color
        If you want the grid to have a different border color from chart, use this attribute to specify the same.

        borderThickness
        Number
        If you want the grid to have a different border thickness from chart, use this attribute to specify the same.

        borderAlpha
        Number
        If you want the grid to have a different border alpha from chart, use this attribute to specify the same.

        Font Properties

        baseFont
        Font
        If you want the grid to have a different font face from chart, use this attribute to specify the same.

        baseFontSize
        Number
        If you want the grid to have a different font size from chart, use this attribute to specify the same.

        baseFontColor
        Color
        If you want the grid to have a different font color from chart, use this attribute to specify the same.

        Alternate data rows and divider properties

        alternateRowBgColor
        Color
        Background color of alternate data rows

        alternateRowBgAlpha
        Number
        Transparency of alternate data rows

        listRowDividerThickness
        Number
        Thickness of the line separating two data rows

        listRowDividerColor
        Color
        Color of the line separating two data rows

        listRowDividerAlpha
        Number
        Alpha of the line separating two data rows.

        colorBoxWidth
        Number
        Width of the rectangular color box indicating each data item.

        colorBoxHeight
        Number
        Height of the rectangular color box indicating each data item.

        Navigation button properties

        navButtonRadius
        Number
        Radius (in pixels) of the navigation button(s), which appears when paging is   required.

        navButtonColor
        Color
        Color of the navigation button(s), which appears when paging is required.

        navButtonHoverColor
        Color
        Hover color of the navigation button(s), which appears when paging is required.

        Paddings

        textVerticalPadding
        Number
        Vertical padding (space in pixels) between the list row divider line and the   text between the lines.

        navButtonPadding
        Number
        Vertical padding (space in pixels) between the last data item and the navigation   buttons. The navigation buttons appear only when paging is required.

        colorBoxPadding
        Number
        Horizontal distance between the left edge of the grid and the color box   (indicating data color).

        valueColumnPadding
        Number
        Horizontal distance between the data value and the right edge.

        nameColumnPadding
        Number
        Horizontal distance between the data name and the right edge of color box.

redpajama_set_name: RedPajamaGithub


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

namespace CSharpGL
{
    public class AiBone
    {
    }
}


text:
package org.apache.hadoop.hbase.client;

import org.apache.yetus.audience.InterfaceAudience;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.util.ReflectionUtils;

/**
 * Factory to create an {@link RpcRetryingCaller}
 */
@InterfaceAudience.Private
public class RpcRetryingCallerFactory {

  /** Configuration key for a custom {@link RpcRetryingCaller} */
  public static final String CUSTOM_CALLER_CONF_KEY = "hbase.rpc.callerfactory.class";
  private static final Log LOG = LogFactory.getLog(RpcRetryingCallerFactory.class);
  protected final Configuration conf;
  private final long pause;
  private final long pauseForCQTBE;// pause for CallQueueTooBigException, if specified
  private final int retries;
  private final int rpcTimeout;
  private final RetryingCallerInterceptor interceptor;
  private final int startLogErrorsCnt;
  /* These below data members are UNUSED!!!*/
  private final boolean enableBackPressure;
  private ServerStatisticTracker stats;

  public RpcRetryingCallerFactory(Configuration conf) {
    this(conf, RetryingCallerInterceptorFactory.NO_OP_INTERCEPTOR);
  }

  public RpcRetryingCallerFactory(Configuration conf, RetryingCallerInterceptor interceptor) {
    this.conf = conf;
    pause = conf.getLong(HConstants.HBASE_CLIENT_PAUSE,
        HConstants.DEFAULT_HBASE_CLIENT_PAUSE);
    long configuredPauseForCQTBE = conf.getLong(HConstants.HBASE_CLIENT_PAUSE_FOR_CQTBE, pause);
    if (configuredPauseForCQTBE < pause) {
      LOG.warn("The " + HConstants.HBASE_CLIENT_PAUSE_FOR_CQTBE + " setting: "
          + configuredPauseForCQTBE + " is smaller than " + HConstants.HBASE_CLIENT_PAUSE
          + ", will use " + pause + " instead.");
      this.pauseForCQTBE = pause;
    } else {
      this.pauseForCQTBE = configuredPauseForCQTBE;
    }
    retries = conf.getInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER,
        HConstants.DEFAULT_HBASE_CLIENT_RETRIES_NUMBER);
    startLogErrorsCnt = conf.getInt(AsyncProcess.START_LOG_ERRORS_AFTER_COUNT_KEY,
        AsyncProcess.DEFAULT_START_LOG_ERRORS_AFTER_COUNT);
    this.interceptor = interceptor;
    enableBackPressure = conf.getBoolean(HConstants.ENABLE_CLIENT_BACKPRESSURE,
        HConstants.DEFAULT_ENABLE_CLIENT_BACKPRESSURE);
    rpcTimeout = conf.getInt(HConstants.HBASE_RPC_TIMEOUT_KEY,HConstants.DEFAULT_HBASE_RPC_TIMEOUT);
  }

  /**
   * Set the tracker that should be used for tracking statistics about the server
   */
  public void setStatisticTracker(ServerStatisticTracker statisticTracker) {
    this.stats = statisticTracker;
  }

  /**
   * Create a new RetryingCaller with specific rpc timeout.
   */
  public <T> RpcRetryingCaller<T> newCaller(int rpcTimeout) {
    // We store the values in the factory instance. This way, constructing new objects
    //  is cheap as it does not require parsing a complex structure.
    RpcRetryingCaller<T> caller = new RpcRetryingCallerImpl<>(pause, pauseForCQTBE, retries,
        interceptor, startLogErrorsCnt, rpcTimeout);
    return caller;
  }

  /**
   * Create a new RetryingCaller with configured rpc timeout.
   */
  public <T> RpcRetryingCaller<T> newCaller() {
    // We store the values in the factory instance. This way, constructing new objects
    //  is cheap as it does not require parsing a complex structure.
    RpcRetryingCaller<T> caller = new RpcRetryingCallerImpl<>(pause, pauseForCQTBE, retries,
        interceptor, startLogErrorsCnt, rpcTimeout);
    return caller;
  }

  public static RpcRetryingCallerFactory instantiate(Configuration configuration) {
    return instantiate(configuration, RetryingCallerInterceptorFactory.NO_OP_INTERCEPTOR, null);
  }

  public static RpcRetryingCallerFactory instantiate(Configuration configuration,
      ServerStatisticTracker stats) {
    return instantiate(configuration, RetryingCallerInterceptorFactory.NO_OP_INTERCEPTOR, stats);
  }

  public static RpcRetryingCallerFactory instantiate(Configuration configuration,
      RetryingCallerInterceptor interceptor, ServerStatisticTracker stats) {
    String clazzName = RpcRetryingCallerFactory.class.getName();
    String rpcCallerFactoryClazz =
        configuration.get(RpcRetryingCallerFactory.CUSTOM_CALLER_CONF_KEY, clazzName);
    RpcRetryingCallerFactory factory;
    if (rpcCallerFactoryClazz.equals(clazzName)) {
      factory = new RpcRetryingCallerFactory(configuration, interceptor);
    } else {
      factory = ReflectionUtils.instantiateWithCustomCtor(
          rpcCallerFactoryClazz, new Class[] { Configuration.class },
          new Object[] { configuration });
    }

    // setting for backwards compat with existing caller factories, rather than in the ctor
    factory.setStatisticTracker(stats);
    return factory;
  }
}


text:
[![Build Status](https://github.com/recharts/recharts-scale/workflows/ci/badge.svg)](https://github.com/recharts/recharts-scale/actions)

Scale of Cartesian Coordinates


text:
package me.owenlynch.brown_decaf;

class NonTerminal implements Symbol {
	public int type;
	public Symbol[] children;

	public NonTerminal(int type) {
		this.type = type;
		this.children = null;
	}

	public void setChildren(Symbol[] children) {
		this.children = children;
	}

	public NonTerminal clone() {
		return new NonTerminal(type);
	}

	public boolean isTerminal() {
		return false;
	}

	public int type() {
		return type;
	}
}


text:
var dbref = new Firebase("https://simpleblogger.firebaseio.com");

var level_posts = dbref.child("posts");
var snap_obj={};
var publishedposts={};
var firebaseidref={};
var getx = true;
var whereis = ($(location).attr('href')).indexOf('new_post.html');

if(localStorage.userdata!==undefined){
	$("#userrefname").text(localStorage.userdata);
	$("#customUser").html(localStorage.userdata + "'s Blog");
}

if($("#userrefname").text()==="Guest"){
	$('#linking').disabled = true;
}

function messcount(field){
	var count = 0;
			level_comments = dbref.child("comments").child(field);
			level_comments.on('child_added', function(snap){
	  count++;
	});
			$("#newcomments").text(count);

}

function getcomments(field){
	if(getx){
		level_comments = dbref.child("comments").child(field);
		level_comments.on('value', function(snapshot){
        var message = snapshot.val();
        for(var i in message){
        	displaycomment(message[i].username, message[i].comment);}
      	});
}}

$(document).ready(function(){

var userref = $("#userrefname").text();
//write first blog to page
	level_posts.orderByChild("post_date").once("child_added", function(snapshot){
	 	snap_obj = snapshot.val();
	 	if (snap_obj!==null){
	 		for(var i in snap_obj){
	 			if(snap_obj[i]["published"]===true){
	 				firebaseidref=i;
	 				publishedposts=snap_obj[i];
	 			}
	 		}
		}
	console.log(publishedposts);

	$("#loadtitle").html(publishedposts["posttitle"]);
	console.log(publishedposts["posttitle"]);
	$("#author_inc").html(publishedposts["author"]);
	$("#nblogcontent").append($("
"+publishedposts["post_content"]+"
"));
	if(whereis !== -1){
		$("#postkey").html('');
	}
	else{$("#postkey").html(firebaseidref);
	getcomments($("#postkey").text());
	messcount($("#postkey").text());}

	}, function (errorObject){console.log("Error encountered");});

//Add links on the right column
level_posts.once("value", function(snap) {
  console.log("initial data loaded!", Object.keys(snap.val()).length);
  var allposts = snap.val();
  var count = 0;
for(var t in allposts){
		for (var u in allposts[t]){
				for(var v in allposts[t][u]){
					if(v ==="posttitle" && count<=10 && allposts[t][u]["published"]===true){
			$("#Recentposts").append($("
"+allposts[t][u][v] +"
"));
			count++;}
		}
	}
}
//Add dropdowns
for(var t in allposts){
	if(t===userref){
		for (var u in allposts[t]){
				$("#postpulldown").append($("
"+allposts[t][u]["posttitle"]+"
"));}
		}
	}
//Add working groups
for(var t in allposts){
		for (var u in allposts[t]){
				for(var v in allposts[t][u]){
					if(v ==="posttitle" && allposts[t][u]["author"]===$("#userrefname").text() && allposts[t][u]["published"]===false){
					$("#working").append($("
"+allposts[t][u][v] +"
"));
					}
			}
		}
}
//add by group
for(var t in allposts){
	$("#authoredby").append($("

"+t+"

"));
		for (var u in allposts[t]){
				for(var v in allposts[t][u]){
					if(v ==="posttitle" && allposts[t][u]["published"]===true){
					$("#authoredby").append($("
 "+allposts[t][u][v] +"
"));
					}
			}
		}
}

//Links on the right
$('.postlink').click(function(){
	var keyvalue = $(this).attr("value");
	for(var t in allposts){
		for(var x in allposts[t]){
			if(x===keyvalue){
				if(whereis !== -1){
					if(allposts[t][x]["author"]===$("#userrefname").text()){
						 $("#blogcontent").html(allposts[t][x]["post_content"]);
						 $("#posttitle").val(allposts[t][x]["posttitle"]);
						 $("#tagged").val(allposts[t][x]["tag_list"]);
						 $("#postkey").html(x);
						 $("#commentarea").html("");
						 getcomments($("#postkey").text());
						 messcount($("#postkey").text());}}
				else{$("#nblogcontent").html(allposts[t][x]["post_content"]);
						 $("#loadtitle").html(allposts[t][x]["posttitle"]);
						 $("#author_inc").html(allposts[t][x]["author"]);
						$("#postkey").html(x);
					$("#commentarea").html("");
					getcomments($("#postkey").text());
					messcount($("#postkey").text());}
								}
		}}
	});
//
$('.pulldownlink').click(function(){
	var keyvalue = $(this).attr("value");
	for(var t in allposts){
		for(var x in allposts[t]){
			if(x===keyvalue){
				if(whereis !== -1){
					if(allposts[t][x]["author"]===$("#userrefname").text()){
						 $("#blogcontent").html(allposts[t][x]["post_content"]);
						 $("#posttitle").val(allposts[t][x]["posttitle"]);
						 $("#tagged").val(allposts[t][x]["tag_list"]);
						 $("#postkey").html(x);
						 $("#commentarea").html("");
						 getcomments($("#postkey").text());
						 messcount($("#postkey").text());}}
				else{$("#nblogcontent").html(allposts[t][x]["post_content"]);
						 $("#loadtitle").html(allposts[t][x]["posttitle"]);
						 $("#author_inc").html(allposts[t][x]["author"]);
						$("#postkey").html(x);
					$("#commentarea").html("");
					getcomments($("#postkey").text());
					messcount($("#postkey").text());}
			}
		}}
	});
/////
$('.worklink').click(function(){
	var keyvalue = $(this).attr("value");
	for(var t in allposts){
		for(var x in allposts[t]){
			if(x===keyvalue){
						 $("#blogcontent").html(allposts[t][x]["post_content"]);
						 $("#posttitle").val(allposts[t][x]["posttitle"]);
						 $("#tagged").val(allposts[t][x]["tag_list"]);
						 $("#postkey").html(x);
						 $("#commentarea").html("");
						 getcomments($("#postkey").text());
						 messcount($("#postkey").text());
			}
		}}
	});
////

$("#comms").click(function(){
	$("#commentarea").focus();
});

//.once(value)
});

});

window.onbeforeunload = function () {

 if (localStorage) {
    localStorage.clear();
 }
 };


text:
package blueprint.zulu.util;
import java.io.Serializable;
import java.text.ParseException;
import java.text.SimpleDateFormat;
/*
 * Project -
 * @author BluePrintLabs
 * @version 30.04.2016
 */
import java.util.ArrayList;
import java.util.Date;
import java.util.UUID;

import blueprint.zulu.database.Mongo;

public class Project implements Serializable
{
	// Properties
	private static final long serialVersionUID = -8232433606561571026L;
	private String id;
	private String name;
	private String desc;
	private String leaderID;
	private ArrayList<String> users;
	private String calendar;

	// Constructor
	public Project( String id, String name, String desc, String leaderID, ArrayList<String> users, String calendar)
	{
		this.id = id;
		this.name = name;
		this.desc = desc;
		this.leaderID = leaderID;
		this.users = users;
		this.calendar = calendar;
	}

	// Method to get project ID
	public String getID()
	{
		return this.id;
	}

	// Method to get project name
	public String getName()
	{
		return this.name;
	}

	// Method to get project description
	public String getDesc()
	{
		return this.desc;
	}

	// Method to get users
	public ArrayList<String> getUsers()
	{
		return this.users;
	}

	// Method to get leader ID
	public String getleaderID()
	{
		return this.leaderID;
	}

	// Method to set project name
	public void setName( String name)
	{
		Mongo.updateProject( id, "name", name);
	}

	// Method to set project description
	public void setDesc( String desc)
	{
		Mongo.updateProject( id, "desc", desc);
	}

	// Method to change project leader
	public void changeLeader( String leaderID)
	{
		Mongo.updateProject( id, "leaderID", leaderID);
	}

	// Method to add an user
	public void addUser( String userID)
	{
		this.users.add( userID);
		Mongo.updateProject( id, "users", users);
	}

	// Method to remove an user
	public void removeUser( String userID)
	{
		users.remove( userID);
		Mongo.updateProject( id, "users", users);
	}

	// Method to get project calendar
	public Calendar getCalendar()
	{
		return Calendar.getByID( calendar);
	}

	// Method to get user calendars
	public ArrayList<Calendar> getUserCalendars()
	{
		ArrayList<Calendar> userCalendars = new ArrayList<Calendar>();

		for (String userID : users)
		{
			User user = User.getByID( userID);

			userCalendars.add( user.getCalendar());
		}

		return userCalendars;
	}

	public ArrayList<Date> meetUp( Date date)
	{
		Date parsedDate = null;
		ArrayList<User> users = new ArrayList<User>();

		for ( String userID : getUsers() )
			users.add(User.getByID( userID));

			parsedDate = date;

		return MeetUp.perform(users, parsedDate);
	}

	// String representation of the Project class
	public String toString()
	{
		String result = "ID: " + id + "\n";
		result = result + "Name: " + name + "\n";
		result = result + "Desc: " + desc + "\n";
		result = result + "LeaderID: " + leaderID + "\n";
		result = result + "Users: " + users + "\n";
		result = result + "Calendar: " + getCalendar() + "\n";

		return result;
	}

	// Method to get project by it's ID
	public static Project getByID( String id)
	{
		return Mongo.getProject( id);
	}

	// Method to create a new project
	public static Project createNewProject( String name, String desc, String leaderID)
	{
		Calendar projectCalendar = Calendar.createNewCalendar();
		Project project = new Project( UUID.randomUUID().toString(), name, desc, leaderID, new ArrayList<String>(), projectCalendar.getID());
		Mongo.createProject(project);

		return project;
	}
}


text:
<!DOCTYPE HTML>

<title>Uses of Enum com.easypost.model.PaymentMethodObject.PaymentMethodType (com.easypost:easypost-api-client 5.10.0 API)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="dc.created" content="2022-11-03">
<meta name="description" content="use: package: com.easypost.model, class: PaymentMethodObject, enum: PaymentMethodType">
<meta name="generator" content="javadoc/ClassUseWriter">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../script-dir/jquery-ui.min.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../jquery-ui.overrides.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

SEARCH:
<input type="text" id="search" value="search" disabled="disabled">
<input type="reset" id="reset" value="reset" disabled="disabled">

Uses of Enum
com.easypost.model.PaymentMethodObject.PaymentMethodType

Packages that use PaymentMethodObject.PaymentMethodType

Package

Description

com.easypost.model

Classes for the EasyPost API.

Uses of PaymentMethodObject.PaymentMethodType in com.easypost.model

Methods in com.easypost.model that return PaymentMethodObject.PaymentMethodType

Modifier and Type

Method

Description

PaymentMethodObject.PaymentMethodType

PaymentMethodObject.getType()

Get the type of this PaymentMethodObject object.

static PaymentMethodObject.PaymentMethodType

PaymentMethodObject.PaymentMethodType.valueOf(String name)

Returns the enum constant of this type with the specified name.

static PaymentMethodObject.PaymentMethodType[]

PaymentMethodObject.PaymentMethodType.values()

Returns an array containing the constants of this enum type, in
the order they are declared.

Copyright © 2022 EasyPost. All rights reserved.


text:
__all__ = ["ApplicationLBDriver"]

from libcloud.utils.xml import findtext, findall
from libcloud.loadbalancer.types import State
from libcloud.loadbalancer.base import Driver, LoadBalancer, Member
from libcloud.common.aws import AWSGenericResponse, SignedAWSConnection

VERSION = "2015-12-01"
HOST = "elasticloadbalancing.%s.amazonaws.com"
ROOT = "/%s/" % (VERSION)
NS = "http://elasticloadbalancing.amazonaws.com/doc/%s/" % (VERSION,)

class ALBResponse(AWSGenericResponse):
    """
    Amazon ALB response class.
    """

    namespace = NS
    exceptions = {}
    xpath = "Error"

class ALBConnection(SignedAWSConnection):
    version = VERSION
    host = HOST
    responseCls = ALBResponse
    service_name = "elasticloadbalancing"

class ALBTargetGroup(object):
    """
    AWS ALB target group class
    http://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-target-groups.html
    """

    def __init__(
        self,
        target_group_id,
        name,
        protocol,
        port,
        vpc,
        driver,
        health_check_timeout=5,
        health_check_port="traffic-port",
        health_check_path="/",
        health_check_proto="HTTP",
        health_check_matcher="200",
        health_check_interval=30,
        healthy_threshold=5,
        unhealthy_threshold=2,
        balancers=[],
        members=[],
    ):

        self.id = target_group_id
        self.name = name
        self.protocol = protocol
        self.port = port
        self.vpc = vpc
        self.health_check_timeout = health_check_timeout
        self.health_check_port = health_check_port
        self.health_check_path = health_check_path
        self.health_check_proto = health_check_proto
        self.health_check_matcher = health_check_matcher
        self.health_check_interval = health_check_interval
        self.healthy_threshold = healthy_threshold
        self.unhealthy_threshold = unhealthy_threshold

        self._balancers = balancers
        self._balancers_arns = [lb.id for lb in balancers] if balancers else []
        self._members = members
        self._members_ids = [mb.id for mb in members] if members else []
        self._driver = driver

    @property
    def balancers(self):
        if not self._balancers and self._balancers_arns:
            self._balancers = []
            for balancer_arn in self._balancers_arns:
                self._balancers.append(self._driver.get_balancer(balancer_arn))
        return self._balancers

    @balancers.setter
    def balancers(self, val):
        self._balancers = val
        self._balancers_arns = [lb.id for lb in val] if val else []

    @property
    def members(self):
        if not self._members:
            mbrs = self._driver._ex_get_target_group_members(self)
            self._members = mbrs
            self._members_ids = [mb.id for mb in mbrs] if mbrs else []

        return self._members

    @members.setter
    def members(self, val):
        self._members = val
        self._members_ids = [mb.id for mb in val] if val else []

class ALBListener(object):
    """
    AWS ALB listener class
    http://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-listeners.html
    """

    def __init__(
        self,
        listener_id,
        protocol,
        port,
        balancer,
        driver,
        action="",
        ssl_policy="",
        ssl_certificate="",
        rules=[],
    ):

        self.id = listener_id
        self.protocol = protocol
        self.port = port
        self.action = action
        self.ssl_policy = ssl_policy
        self.ssl_certificate = ssl_certificate

        self._balancer = balancer
        self._balancer_arn = balancer.id if balancer else None
        self._rules = rules
        self._driver = driver

    @property
    def balancer(self):
        if not self._balancer and self._balancer_arn:
            self._balancer = self._driver.get_balancer(self._balancer_arn)
        return self._balancer

    @balancer.setter
    def balancer(self, val):
        self._balancer = val
        self._balancer_arn = val.id

    @property
    def rules(self):
        if not self._rules:
            self._rules = self._driver._ex_get_rules_for_listener(self)
        return self._rules

    @rules.setter
    def rules(self, val):
        self._rules = val

class ALBRule(object):
    """
    AWS ALB listener rule class
    http://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-listeners.html#listener-rules
    """

    def __init__(
        self,
        rule_id,
        is_default,
        priority,
        target_group,
        driver,
        conditions={},
        listener=None,
    ):

        self.id = rule_id
        self.is_default = is_default
        self.priority = priority
        self.conditions = conditions

        self._listener = listener
        self._listener_arn = listener.id if listener else None
        self._target_group = target_group
        self._target_group_arn = target_group.id if target_group else None
        self._driver = driver

    @property
    def target_group(self):
        if not self._target_group and self._target_group_arn:
            self._target_group = self._driver.ex_get_target_group(
                self._target_group_arn
            )
        return self._target_group

    @target_group.setter
    def target_group(self, val):
        self._target_group = val
        self._target_group_arn = val.id

    @property
    def listener(self):
        if not self._listener and self._listener_arn:
            self._listener = self.driver.ex_get_listener(self._listener_arn)
        return self._listener

    @listener.setter
    def listener(self, val):
        self._listener = val
        self._listener_arn = val.id

class ApplicationLBDriver(Driver):
    name = "Amazon Application Load Balancing"
    website = "http://aws.amazon.com/elasticloadbalancing/"
    connectionCls = ALBConnection
    signature_version = "4"

    def __init__(self, access_id, secret, region, token=None):
        self.token = token
        self.region = region
        self.region_name = region
        super(ApplicationLBDriver, self).__init__(
            access_id, secret, token=token, host=HOST % region, region=region
        )

    def list_protocols(self):
        """
        Return list of protocols supported by driver

        :rtype: ``list`` of ``strings``
        """
        return ["http", "https"]

    def list_balancers(self):
        """
        List all load balancers

        :rtype: ``list`` of :class:`LoadBalancer`
        """
        params = {"Action": "DescribeLoadBalancers"}
        data = self.connection.request(ROOT, params=params).object
        return self._to_balancers(data)

    def get_balancer(self, balancer_id):
        """
        Get a load balancer object by ARN

        :param  balancer_id: ARN of load balancer you wish to fetch.
        :type  balancer_id: ``str``

        :rtype: :class:`LoadBalancer`
        """
        params = {
            "Action": "DescribeLoadBalancers",
            "LoadBalancerArns.member.1": balancer_id,
        }
        data = self.connection.request(ROOT, params=params).object
        return self._to_balancers(data)[0]

    def create_balancer(
        self,
        name,
        port,
        protocol,
        algorithm,
        members,
        ex_scheme=None,
        ex_security_groups=None,
        ex_subnets=None,
        ex_tags=None,
        ex_ssl_cert_arn=None,
    ):
        """
        Create a new load balancer instance.

        AWS ALB balancer creation consists of 5 steps:
        http://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/Welcome.html

        create_balancer() is a standard API method so, it's made as a wrapper
        here to preserve compatibility with other drivers where LB creation
        is one-step process. It calls respective ALB methods to assemble
        ready-to-use load balancer.

        :param name: Name of the new load balancer
        :type name: ``str``

        :param port: Port number to setup load balancer listener
        :type port: ``int``

        :param protocol: Load balancer protocol, should be 'HTTP' or 'HTTPS'.
        :type protocol: ``str``

        :param algorithm: Load balancing algorithm. Ignored for AWS ALB.
        :type algorithm: :class:`Algorithm` or ``None``

        :param members: List of Members to attach to the balancer. If 'port'
                        attribute is set for the memeber - load balancer will
                        send traffic there. Otherwise - load balancer port is
                        used on the memeber's side. 'ip' attribute is ignored.
        :type members: ``list`` of :class:`Member`

        :param ex_scheme: Scheme of load balancer. Can be 'internet-facing' or
                          'internal'.
        :type ex_scheme: ``str``

        :param ex_security_groups: List of load balancer security group ids.
        :type ex_security_groups: ``list`` of ``str``

        :param ex_subnets: List of load balancer subnet ids.
        :type ex_subnets: ``list`` of ``str``

        :param ex_tags: Tags to assign to the load balancer.
        :type ex_tags: ``dict``

        :param ex_ssl_cert_arn: SSL certificate ARN to use when load balancer
                protocol is 'HTTPS'.
        :type ex_ssl_cert_arn: ``str``

        :return: LoadBalancer object
        :rtype: :class:`LoadBalancer`
        """

        ex_scheme = ex_scheme or ""
        ex_security_groups = ex_security_groups or []
        ex_subnets = ex_subnets or []
        ex_tags = ex_tags or {}
        ex_ssl_cert_arn = ex_ssl_cert_arn or ""

        balancer = self.ex_create_balancer(
            name,
            scheme=ex_scheme,
            security_groups=ex_security_groups,
            subnets=ex_subnets,
            tags=ex_tags,
        )

        target_group = self.ex_create_target_group(
            name + "-tg",
            port,
            protocol,
            balancer.extra.get("vpc"),
            health_check_proto=protocol,
        )
        self.ex_register_targets(target_group, members)
        listener = self.ex_create_listener(
            balancer, port, protocol, target_group, ssl_cert_arn=ex_ssl_cert_arn
        )

        balancer.extra["listener"] = listener

        return balancer

    def ex_create_balancer(
        self,
        name,
        addr_type="ipv4",
        scheme="internet-facing",
        security_groups=None,
        subnets=None,
        tags=None,
    ):
        """
        AWS-specific method to create a new load balancer. Since ALB is a
        composite object (load balancer, target group, listener etc) - extra
        methods must be called to assemble ready-to-use balancer.

        :param name: Name of the new load balancer
        :type name: ``str``

        :param addr_type: Load balancer address type. Can be 'ipv4' or 'ipv6'.
        :type addr_type: ``str``

        :param scheme: Scheme of load balancer. Can be 'internet-facing' or
                      'internal'.
        :type scheme: ``str``

        :param security_groups: List of load balancer security group ids.
        :type security_groups: ``list`` of ``str``

        :param subnets: List of load balancer subnet ids.
        :type subnets: ``list`` of ``str``

        :param tags: Tags to assign to the load balancer.
        :type tags: ``dict``

        :return: LoadBalancer object
        :rtype: :class:`LoadBalancer`
        """

        security_groups = security_groups or []
        subnets = subnets or []
        tags = tags or {}

        # mandatory params
        params = {"Action": "CreateLoadBalancer", "Name": name}

        idx = 0
        for subnet in subnets:
            idx += 1
            params["Subnets.member." + str(idx)] = subnet

        # optional params
        params.update(
            {
                "IpAddressType": addr_type,  # Valid Values: ipv4 | dualstack
                "Scheme": scheme,  # Valid Values: internet-facing | internal
            }
        )

        idx = 0
        for sg in security_groups:
            idx += 1
            params["SecurityGroups.member." + str(idx)] = sg

        idx = 0
        for k, v in tags.items():
            idx += 1
            params["Tags.member." + str(idx) + ".Key"] = k
            params["Tags.member." + str(idx) + ".Value"] = v

        data = self.connection.request(ROOT, params=params).object

        xpath = "CreateLoadBalancerResult/LoadBalancers/member"
        for el in findall(element=data, xpath=xpath, namespace=NS):
            balancer = self._to_balancer(el)

        return balancer

    def ex_create_target_group(
        self,
        name,
        port,
        proto,
        vpc,
        health_check_interval=30,
        health_check_path="/",
        health_check_port="traffic-port",
        health_check_proto="HTTP",
        health_check_timeout=5,
        health_check_matcher="200",
        healthy_threshold=5,
        unhealthy_threshold=2,
    ):
        """
        Create a target group for AWS ALB load balancer.

        :param name: Name of target group
        :type name: ``str``

        :param port: The port on which the targets receive traffic.
                    This port is used unless you specify a port override when
                    registering the target.
        :type port: ``int``

        :param proto: The protocol to use for routing traffic to the targets.
                    Can be 'HTTP' or 'HTTPS'.
        :type proto: ``str``

        :param vpc: The identifier of the virtual private cloud (VPC).
        :type vpc: ``str``

        :param health_check_interval: The approximate amount of time, in
                                    seconds, between health checks of an
                                    individual target. The default is
                                    30 seconds.
        :type health_check_interval: ``int``

        :param health_check_path: The ping path that is the destination on
                                the targets for health checks. The default is /
        :type health_check_path: ``str``

        :param health_check_port: The port the load balancer uses when
                                performing health checks on targets.
                                The default is traffic-port, which indicates
                                the port on which each target receives traffic
                                from the load balancer.
        :type health_check_port: ``str``

        :param health_check_proto: The protocol the load balancer uses when
                                performing health checks on targets.
                                Can be 'HTTP' (default) or 'HTTPS'.
        :type health_check_proto: ``str``

        :param health_check_timeout: The amount of time, in seconds, during
                                    which no response from a target means
                                    a failed health check. The default is 5s.
        :type health_check_timeout: ``int``

        :param health_check_matcher: The HTTP codes to use when checking for
                                    a successful response from a target.
                                    Valid values: "200", "200,202", "200-299".
        :type health_check_matcher: ``str``

        :param healthy_threshold: The number of consecutive health checks
                                  successes required before considering
                                  an unhealthy target healthy. The default is 5
        :type healthy_threshold: ``int``

        :param unhealthy_threshold: The number of consecutive health check
                                    failures required before considering
                                    a target unhealthy. The default is 2.
        :type unhealthy_threshold: ``int``

        :return: Target group object.
        :rtype: :class:`ALBTargetGroup`
        """

        # mandatory params
        params = {
            "Action": "CreateTargetGroup",
            "Name": name,
            "Protocol": proto,
            "Port": port,
            "VpcId": vpc,
        }

        # optional params
        params.update(
            {
                # Valid Values: Min value of 5. Max value of 300.
                "HealthCheckIntervalSeconds": health_check_interval,
                "HealthCheckPath": health_check_path,
                "HealthCheckPort": health_check_port,
                # Valid Values: HTTP | HTTPS
                "HealthCheckProtocol": health_check_proto,
                # Valid Range: Min value of 2. Max value of 60.
                "HealthCheckTimeoutSeconds": health_check_timeout,
                # Valid Range: Minimum value of 2. Maximum value of 10.
                "HealthyThresholdCount": healthy_threshold,
                # Valid Range: Minimum value of 2. Maximum value of 10.
                "UnhealthyThresholdCount": unhealthy_threshold,
                # Valid values: "200", "200,202", "200-299"
                "Matcher.HttpCode": health_check_matcher,
            }
        )

        data = self.connection.request(ROOT, params=params).object

        xpath = "CreateTargetGroupResult/TargetGroups/member"
        for el in findall(element=data, xpath=xpath, namespace=NS):
            target_group = self._to_target_group(el)

        return target_group

    def ex_register_targets(self, target_group, members=None):
        """
        Register members as targets at target group

        :param target_group: Target group dict where register members.
        :type target_group: ``dict``

        :param members: List of Members to attach to the balancer. If 'port'
                        attribute is set for the memeber - load balancer will
                        send traffic there. Otherwise - load balancer port is
                        used on the memeber's side. 'ip' attribute is ignored.
        :type members: ``list`` of :class:`Member`

        :return: True on success, False if no members provided.
        :rtype: ``bool``
        """

        members = members or []

        # mandatory params
        params = {"Action": "RegisterTargets", "TargetGroupArn": target_group.id}

        if not members:
            return False

        idx = 0
        for member in members:
            idx += 1
            params["Targets.member." + str(idx) + ".Id"] = member.id
            if member.port:
                params["Targets.member." + str(idx) + ".Port"] = member.port

        # RegisterTargets doesn't return any useful data
        self.connection.request(ROOT, params=params)

        target_group.members = members

        return True

    def ex_create_listener(
        self,
        balancer,
        port,
        proto,
        target_group,
        action="forward",
        ssl_cert_arn=None,
        ssl_policy=None,
    ):
        """
        Create a listener for application load balancer

        :param balancer: LoadBalancer to create listener for
        :type  balancer: :class:`LoadBalancer`

        :param port: Port number to setup load balancer listener
        :type port: ``int``

        :param proto: Load balancer protocol, should be 'HTTP' or 'HTTPS'.
        :type proto: ``str``

        :param target_group: Target group associated with the listener.
        :type target_group: :class:`ALBTargetGroup`

        :param action: Default action for the listener,
                        valid value is 'forward'
        :type action: ``str``

        :param ssl_cert_arn: SSL certificate ARN to use when listener protocol
                            is 'HTTPS'.
        :type ssl_cert_arn: ``str``

        :param ssl_policy: The security policy that defines which ciphers and
                        protocols are supported. The default is the current
                        predefined security policy.
                        Example: 'ELBSecurityPolicy-2016-08'
        :type ssl_policy: ``str``

        :return: Listener object
        :rtype: :class:`ALBListener`
        """

        ssl_cert_arn = ssl_cert_arn or ""
        ssl_policy = ssl_policy or ""

        # mandatory params
        params = {
            "Action": "CreateListener",
            "LoadBalancerArn": balancer.id,
            "Protocol": proto,  # Valid Values: HTTP | HTTPS
            "Port": port,  # Valid Range: Min value of 1. Max value of 65535.
            "DefaultActions.member.1.Type": action,
            "DefaultActions.member.1.TargetGroupArn": target_group.id,
        }

        # optional params
        if proto == "HTTPS":
            params["Certificates.member.1.CertificateArn"] = ssl_cert_arn
            if ssl_policy:
                params["SslPolicy"] = ssl_policy

        data = self.connection.request(ROOT, params=params).object

        xpath = "CreateListenerResult/Listeners/member"
        for el in findall(element=data, xpath=xpath, namespace=NS):
            listener = self._to_listener(el)
            listener.balancer = balancer

        return listener

    def ex_create_listener_rule(
        self,
        listener,
        priority,
        target_group,
        action="forward",
        condition_field=None,
        condition_value=None,
    ):
        """
        Create a rule for listener.

        :param listener: Listener object where to create rule
        :type listener: :class:`ALBListener`

        :param priority: The priority for the rule. A listener can't have
                        multiple rules with the same priority.
        :type priority: ``str``

        :param target_group: Target group object to associate with rule
        :type target_group: :class:`ALBTargetGroup`

        :param action: Action for the rule, valid value is 'forward'
        :type action: ``str``

        :param condition_field: Rule condition field name. The possible values
                                are 'host-header' and 'path-pattern'.
        :type condition_field: ``str``

        :param condition_value: Value to match. Wildcards are supported, for
                                example: '/img/*'

        :return: Rule object
        :rtype: :class:`ALBRule`
        """

        condition_field = condition_field or ""
        condition_value = condition_value or ""

        # mandatory params
        params = {
            "Action": "CreateRule",
            "ListenerArn": listener.id,
            "Priority": priority,  # Valid Range: Min value of 1. Max: 99999.
            "Actions.member.1.Type": action,
            "Actions.member.1.TargetGroupArn": target_group.id,
            # Valid values are host-header and path-pattern.
            "Conditions.member.1.Field": condition_field,
            "Conditions.member.1.Values.member.1": condition_value,
        }

        data = self.connection.request(ROOT, params=params).object

        xpath = "CreateRuleResult/Rules/member"
        for el in findall(element=data, xpath=xpath, namespace=NS):
            rule = self._to_rule(el)
            rule.listener = listener

        return rule

    def ex_get_target_group(self, target_group_id):
        """
        Get target group object by ARN

        :param target_group_id: ARN of target group
        :type target_group_id: ``str``

        :return: Target group object
        :rtype: :class:`ALBTargetGroup`
        """

        # mandatory params
        params = {
            "Action": "DescribeTargetGroups",
            "TargetGroupArns.member.1": target_group_id,
        }

        data = self.connection.request(ROOT, params=params).object

        return self._to_target_groups(data)[0]

    def ex_get_listener(self, listener_id):
        """
        Get listener object by ARN

        :param listener_id: ARN of listener object to get
        :type listener_id: ``str``

        :return: Listener object
        :rtype: :class:`ALBListener`
        """

        # mandatory params
        params = {"Action": "DescribeListeners", "ListenerArns.member.1": listener_id}

        data = self.connection.request(ROOT, params=params).object
        return self._to_listeners(data)[0]

    def ex_get_rule(self, rule_id):
        """
        Get rule by ARN.

        :param rule_id: ARN of rule
        :type rule_id: ``str``

        :return: Rule object
        :rtype: :class:`ALBRule`
        """

        params = {"Action": "DescribeRules", "RuleArns.member.1": rule_id}

        data = self.connection.request(ROOT, params=params).object
        return self._to_rules(data)[0]

    def _to_listeners(self, data):
        xpath = "DescribeListenersResult/Listeners/member"
        return [
            self._to_listener(el)
            for el in findall(element=data, xpath=xpath, namespace=NS)
        ]

    def _to_listener(self, el):
        listener = ALBListener(
            listener_id=findtext(element=el, xpath="ListenerArn", namespace=NS),
            protocol=findtext(element=el, xpath="Protocol", namespace=NS),
            port=int(findtext(element=el, xpath="Port", namespace=NS)),
            balancer=None,
            driver=self.connection.driver,
            action=findtext(
                element=el, xpath="DefaultActions/member/Type", namespace=NS
            ),
            ssl_policy=findtext(element=el, xpath="SslPolicy", namespace=NS),
            ssl_certificate=findtext(
                element=el, xpath="Certificates/member/CertificateArn", namespace=NS
            ),
        )

        listener._balancer_arn = findtext(
            element=el, xpath="LoadBalancerArn", namespace=NS
        )

        return listener

    def _to_balancer(self, el):
        balancer = LoadBalancer(
            id=findtext(element=el, xpath="LoadBalancerArn", namespace=NS),
            name=findtext(element=el, xpath="LoadBalancerName", namespace=NS),
            state=State.UNKNOWN,
            ip=findtext(el, xpath="DNSName", namespace=NS),
            port=None,
            driver=self.connection.driver,
        )

        balancer.extra = {
            "listeners": self._ex_get_balancer_listeners(balancer),
            "tags": self._ex_get_balancer_tags(balancer),
            "vpc": findtext(el, xpath="VpcId", namespace=NS),
        }

        if len(balancer.extra["listeners"]) > 0:
            balancer.port = balancer.extra["listeners"][0].port
        else:
            balancer.port = None

        return balancer

    def _to_balancers(self, data):
        xpath = "DescribeLoadBalancersResult/LoadBalancers/member"
        return [
            self._to_balancer(el)
            for el in findall(element=data, xpath=xpath, namespace=NS)
        ]

    def _to_tags(self, data):
        """
        return tags dict
        """
        tags = {}
        xpath = "DescribeTagsResult/TagDescriptions/member/Tags/member"

        for el in findall(element=data, xpath=xpath, namespace=NS):
            key = findtext(element=el, xpath="Key", namespace=NS)
            value = findtext(element=el, xpath="Value", namespace=NS)
            if key:
                tags[key] = value

        return tags

    def _to_rule(self, el):
        def __to_bool__(val):
            return val.lower() in ("yes", "true", "t", "1")

        conditions = {}
        cond_members = findall(element=el, xpath="Conditions/member", namespace=NS)
        for cond_member in cond_members:
            field = findtext(element=cond_member, xpath="Field", namespace=NS)
            conditions[field] = []
            value_members = findall(
                element=cond_member, xpath="Values/member", namespace=NS
            )
            for value_member in value_members:
                conditions[field].append(value_member.text)

        rule = ALBRule(
            rule_id=findtext(element=el, xpath="RuleArn", namespace=NS),
            is_default=__to_bool__(
                findtext(element=el, xpath="IsDefault", namespace=NS)
            ),
            # CreateRule API method accepts only int for priority, however
            # DescribeRules method returns 'default' string for default
            # listener rule. So leaving it as string.
            priority=findtext(element=el, xpath="Priority", namespace=NS),
            target_group=None,
            driver=self.connection.driver,
            conditions=conditions,
        )

        rule._target_group_arn = findtext(
            element=el, xpath="Actions/member/TargetGroupArn", namespace=NS
        )

        return rule

    def _to_rules(self, data):
        xpath = "DescribeRulesResult/Rules/member"
        return [
            self._to_rule(el) for el in findall(element=data, xpath=xpath, namespace=NS)
        ]

    def _to_target_groups(self, data):
        xpath = "DescribeTargetGroupsResult/TargetGroups/member"
        return [
            self._to_target_group(el)
            for el in findall(element=data, xpath=xpath, namespace=NS)
        ]

    def _to_target_group(self, el):

        target_group = ALBTargetGroup(
            target_group_id=findtext(element=el, xpath="TargetGroupArn", namespace=NS),
            name=findtext(element=el, xpath="TargetGroupName", namespace=NS),
            protocol=findtext(element=el, xpath="Protocol", namespace=NS),
            port=int(findtext(element=el, xpath="Port", namespace=NS)),
            vpc=findtext(element=el, xpath="VpcId", namespace=NS),
            driver=self.connection.driver,
            health_check_timeout=int(
                findtext(element=el, xpath="HealthCheckTimeoutSeconds", namespace=NS)
            ),
            health_check_port=findtext(
                element=el, xpath="HealthCheckPort", namespace=NS
            ),
            health_check_path=findtext(
                element=el, xpath="HealthCheckPath", namespace=NS
            ),
            health_check_proto=findtext(
                element=el, xpath="HealthCheckProtocol", namespace=NS
            ),
            health_check_interval=int(
                findtext(element=el, xpath="HealthCheckIntervalSeconds", namespace=NS)
            ),
            healthy_threshold=int(
                findtext(element=el, xpath="HealthyThresholdCount", namespace=NS)
            ),
            unhealthy_threshold=int(
                findtext(element=el, xpath="UnhealthyThresholdCount", namespace=NS)
            ),
            health_check_matcher=findtext(
                element=el, xpath="Matcher/HttpCode", namespace=NS
            ),
        )

        lbs = findall(element=el, xpath="LoadBalancerArns/member", namespace=NS)
        target_group._balancers_arns = [lb_arn.text for lb_arn in lbs]

        return target_group

    def _to_target_group_members(self, data):
        xpath = "DescribeTargetHealthResult/TargetHealthDescriptions/member"
        return [
            self._to_target_group_member(el)
            for el in findall(element=data, xpath=xpath, namespace=NS)
        ]

    def _to_target_group_member(self, el):
        member = Member(
            id=findtext(element=el, xpath="Target/Id", namespace=NS),
            ip=None,
            port=findtext(element=el, xpath="Target/Port", namespace=NS),
            balancer=None,
            extra={
                "health": findtext(element=el, xpath="TargetHealth/State", namespace=NS)
            },
        )
        return member

    def _ex_get_target_group_members(self, target_group):
        """
        Return a list of target group member dicts.

        :param target_group: target group to fetch members for
        :type target_group: :class:`ALBTargetGroup`

        :return: list of target group members
        :rtype: ``list`` of :class:`Member`
        """

        params = {"Action": "DescribeTargetHealth", "TargetGroupArn": target_group.id}

        data = self.connection.request(ROOT, params=params).object
        target_group_members = []
        for tg_member in self._to_target_group_members(data):
            tg_member.extra["target_group"] = target_group
            target_group_members.append(tg_member)

        return target_group_members

    def _ex_get_balancer_listeners(self, balancer):
        """
        Return a list of listeners associated with load balancer.

        :param balancer: Load balancer to fetch listeners for
        :type balancer: :class:`LoadBalancer`

        :return: list of listener objects
        :rtype: ``list`` of :class:`ALBListener`
        """
        params = {"Action": "DescribeListeners", "LoadBalancerArn": balancer.id}

        data = self.connection.request(ROOT, params=params).object

        return self._to_listeners(data)

    def _ex_get_rules_for_listener(self, listener):
        """
        Get list of rules associated with listener.

        :param listener: Listener object to fetch rules for
        :type listener: :class:`ALBListener`

        :return: List of rules
        :rtype: ``list`` of :class:`ALBListener`
        """

        params = {"Action": "DescribeRules", "ListenerArn": listener.id}

        data = self.connection.request(ROOT, params=params).object
        rules = self._to_rules(data)
        for rule in rules:
            rule.listener = listener

        return rules

    def _ex_get_balancer_tags(self, balancer):
        """
        Get a dict of load balancer tags.

        :param balancer: Load balancer to fetch tags for
        :type balancer: :class:`LoadBalancer`

        :return: Dictionary of tags (name/value) for load balancer
        :rtype: ``dict``
        """
        params = {"Action": "DescribeTags", "ResourceArns.member.1": balancer.id}
        data = self.connection.request(ROOT, params=params).object
        return self._to_tags(data)

    def _ex_connection_class_kwargs(self):
        pdriver = super(ApplicationLBDriver, self)
        kwargs = pdriver._ex_connection_class_kwargs()
        if hasattr(self, "token") and self.token is not None:
            kwargs["token"] = self.token
            kwargs["signature_version"] = "4"
        else:
            kwargs["signature_version"] = self.signature_version

        return kwargs

# Commented out to avoid confusion. In AWS ALB relation between load balancer
# and target group/members is indirect. So it's better to go through full chain
# to obtain required object(s).
# Chain is: balancer->listener->rule->target group->member
#
#    def balancer_list_members(self, balancer):
#         """
#         List memebers of load balancer
#
#         :param balancer: LoadBalancer to list members for
#         :type  balancer: :class:`LoadBalancer`
#
#         :rtype: ``list`` of :class:`Member`
#         """
#         return balancer.extra.get('members', [])
#
#    def _ex_get_balancer_members(self, balancer):
#        """
#        Fetch members across all listeners/rules/target groups
#
#         :param balancer: load balancer to fetch memebers for
#         :type balancer: :class:`LoadBalancer`
#
#         :return: list of load balancer members across all target groups
#         :rtype: ``list`` of :class:`Member`
#         """
#         balancer_members = []
#         for listener in balancer.extra.get('listeners', []):
#             for rule in listener.rules:
#                 for tg_member in rule.target_group.memebers:
#                     tg_member.balancer = balancer
#                     tg_member.extra['target_group'] = rule.target_group
#                     balancer_members.append(tg_member)
#
#         return balancer_members
#
#    def _ex_get_balancer_target_groups(self, balancer):
#        """
#        Return a list of load balancer target groups.
#
#        :param balancer: load balancer to fetch target groups for
#        :type balancer: :class:`LoadBalancer`
#
#        :rtype: ``list`` of :class:`ALBTargetGroup`
#        """
#         params = {
#             'Action': 'DescribeTargetGroups',
#             'LoadBalancerArn': balancer.id
#         }
#
#         data = self.connection.request(ROOT, params=params).object
#
#         return self._to_target_groups(data)


text:
return {
ink=[[
Hello?
TODO: this is a test todo-item

"What do you make of this?" she asked.

// Something unprintable...

"I couldn't possibly comment," I replied.

/*
    ... or an unlimited block of text
*/
we <> /* he
asdf
*/ hurr ied-> to_savile_row //  comm

]],
expected= {
    {"para", "Hello?"},
    {"todo", "this is a test todo-item"},
    {"para", '"What do you make of this?" she asked.'},
--    {"comment", "Something unprintable..."},
    {"para", "\"I couldn't possibly comment,\" I replied."},
--    {"comment", "... or an unlimited block of text\n"},
    {"para", "we "},
    {"glue"},
--    {"comment", "he\nasdf\n"},
    {"para", "hurr ied"},
    {"divert", "to_savile_row"},
--    {"comment", "comm"},
}}


text:
title: Puppet
---
## Puppet

This is a stub. Help our community expand it.

This quick style guide will help ensure your pull request gets accepted.

#### More Information:

Official Puppet documentation


text:
cask :v1 => 'odesk-team' do
  version :latest
  sha256 :no_check

  url 'https://www.odesk.com/downloads/mac/minor/oDeskTeam.dmg'
  homepage 'https://www.odesk.com/'
  license :unknown    # todo: improve this machine-generated value

  app 'oDesk Team.app'
end


text:
<!doctype html>

		<meta charset="utf-8">
		<title>Layui</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="format-detection" content="telephone=no">
		<link rel="stylesheet" href="<?php echo base_url('layui/css/layui.css') ?>" media="all" />
		<link rel="stylesheet" href="<?php echo base_url('my/admin/css/global.css') ?>" media="all">
		<link rel="stylesheet" type="text/css" href="http://www.jq22.com/jquery/font-awesome.4.6.0.css">

		<a href="<?php echo site_url('i/add_goods') ?>"><button class="layui-btn layui-btn-warm">添加新商品</button>

		<form class="layui-form" action="">

			      <select name="quiz1">
			        <option value="">所有分类</option>
			        <option value="浙江">浙江省</option>
			      </select>

			      <select name="quiz2">
			        <option value="">所有品牌</option>
			        <option value="杭州">杭州</option>
			      </select>

			      <select name="quiz3">
			        <option value="">全部</option>
			        <option value="精品">精品</option>
			        <option value="新品">新品</option>
			        <option value="热销">热销</option>
			        <option value="特价">特价</option>
			        <option value="全部推荐">全部推荐</option>
			      </select>

			      <select name="quiz4">
			        <option value="">全部</option>
			        <option value="上架">上架</option>
			        <option value="下架">下架</option>
			      </select>

			      商品关键字

			        <select name="modules" lay-verify="required" lay-search="">
			          <option value="">直接选择或搜索选择</option>
			          <option value="1">layer</option>
			          <option value="2">form</option>
			          <option value="3">layim</option>
			          <option value="4">element</option>
			          <option value="5">laytpl</option>
			          <option value="6">upload</option>
			          <option value="7">laydate</option>
			          <option value="8">laypage</option>
			          <option value="9">flow</option>
			          <option value="10">util</option>
			          <option value="11">code</option>
			          <option value="12">tree</option>
			          <option value="13">layedit</option>
			          <option value="14">nav</option>
			          <option value="15">tab</option>
			          <option value="16">table</option>
			          <option value="17">select</option>
			          <option value="18">checkbox</option>
			          <option value="19">switch</option>
			          <option value="20">radio</option>
			        </select>

			    	<button class="layui-btn">搜索</button>

			<?php $this->load->view('admin/libraries/goods_list_conter') ?>

		</form>


text:
import os
import sys
from threading import Thread

d = os.path.dirname(os.getcwd())
sys.path.append(d)

from pychron.core.ui import set_toolkit

set_toolkit('qt4')

from pychron.core.ui.dialogs import myConfirmationDialog

from traits.api import HasTraits, Button
from traitsui.api import View

class A(HasTraits):
    a = Button

    def _a_fired(self):
        #self._test()
        t = Thread(target=self._test)
        t.start()

    def _test(self):
        dlg = myConfirmationDialog(message='Timeout Confirm Test')
        ret = dlg.open(timeout=10)
        print 'ret', ret

    def traits_view(self):
        return View('a')

A().configure_traits()


text:
package admin

import (
	"github.com/astaxie/beego/validation"
	"myblog/models"
	"strings"
)

type UserController struct {
	baseController
}

//用户列表
func (this *UserController) List() {
	var page int64
	var pagesize int64 = 10
	var list []*models.User
	var user models.User

	if page, _ = this.GetInt("page"); page < 1 {
		page = 1
	}
	offset := (page - 1) * pagesize

	count, _ := user.Query().Count()
	if count > 0 {
		user.Query().OrderBy("-id").Limit(pagesize, offset).All(&list)
	}

	this.Data["count"] = count
	this.Data["list"] = list
	this.Data["pagebar"] = models.NewPager(page, count, pagesize, "/admin/user/list", true).ToString()
	this.display()
}

//添加用户
func (this *UserController) Add() {
	input := make(map[string]string)
	errmsg := make(map[string]string)
	if this.Ctx.Request.Method == "POST" {
		username := strings.TrimSpace(this.GetString("username"))
		password := strings.TrimSpace(this.GetString("password"))
		password2 := strings.TrimSpace(this.GetString("password2"))
		email := strings.TrimSpace(this.GetString("email"))
		active, _ := this.GetInt("active")

		input["username"] = username
		input["password"] = password
		input["password2"] = password2
		input["email"] = email

		valid := validation.Validation{}

		if v := valid.Required(username, "username"); !v.Ok {
			errmsg["username"] = "请输入用户名"
		} else if v := valid.MaxSize(username, 15, "username"); !v.Ok {
			errmsg["username"] = "用户名长度不能大于15个字符"
		}

		if v := valid.Required(password, "password"); !v.Ok {
			errmsg["password"] = "请输入密码"
		}

		if v := valid.Required(password2, "password2"); !v.Ok {
			errmsg["password2"] = "请再次输入密码"
		} else if password != password2 {
			errmsg["password2"] = "两次输入的密码不一致"
		}

		if v := valid.Required(email, "email"); !v.Ok {
			errmsg["email"] = "请输入email地址"
		} else if v := valid.Email(email, "email"); !v.Ok {
			errmsg["email"] = "Email无效"
		}

		if active > 0 {
			active = 1
		} else {
			active = 0
		}

		if len(errmsg) == 0 {
			var user models.User
			user.Username = username
			user.Password = models.Md5([]byte(password))
			user.Email = email
			user.Active = int8(active)
			if err := user.Insert(); err != nil {
				this.showmsg(err.Error())
			}
			this.Redirect("/admin/user/list", 302)
		}

	}

	this.Data["input"] = input
	this.Data["errmsg"] = errmsg
	this.display()
}

//编辑用户
func (this *UserController) Edit() {
	id, _ := this.GetInt("id")
	user := models.User{Id: id}
	if err := user.Read(); err != nil {
		this.showmsg("用户不存在")
	}

	errmsg := make(map[string]string)

	if this.Ctx.Request.Method == "POST" {
		password := strings.TrimSpace(this.GetString("password"))
		password2 := strings.TrimSpace(this.GetString("password2"))
		email := strings.TrimSpace(this.GetString("email"))
		active, _ := this.GetInt("active")
		valid := validation.Validation{}

		if password != "" {
			if v := valid.Required(password2, "password2"); !v.Ok {
				errmsg["password2"] = "请再次输入密码"
			} else if password != password2 {
				errmsg["password2"] = "两次输入的密码不一致"
			} else {
				user.Password = models.Md5([]byte(password))
			}
		}
		if v := valid.Required(email, "email"); !v.Ok {
			errmsg["email"] = "请输入email地址"
		} else if v := valid.Email(email, "email"); !v.Ok {
			errmsg["email"] = "Email无效"
		} else {
			user.Email = email
		}

		if active > 0 {
			user.Active = 1
		} else {
			user.Active = 0
		}

		if len(errmsg) == 0 {
			user.Update()
			this.Redirect("/admin/user/list", 302)
		}
	}
	this.Data["errmsg"] = errmsg
	this.Data["user"] = user
	this.display()
}

//删除用户
func (this *UserController) Delete() {
	id, _ := this.GetInt("id")
	if id == 1 {
		this.showmsg("不能删除ID为1的用户")
	}
	user := models.User{Id: id}
	if user.Read() == nil {
		user.Delete()
	}

	this.Redirect("/admin/user/list", 302)
}


text:
// +k8s:deepcopy-gen=package,register

// +groupName=kops
package kops // import "k8s.io/kops/pkg/apis/kops"


text:
<!DOCTYPE html>

    <title>Heartysoft Solutions Limited</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta charset="utf-8">
    <meta name="description" content="Twitter bootstrap theme">
    <meta name="author" content="prettystrap">

    <link id="the-story-css-file" href="/css/the-story.min.css" rel="stylesheet" media="screen">
    <link id="the-story-css-file" href="/css/hsft.css" rel="stylesheet" media="screen">

    <link rel="shortcut icon" href="/favicon.ico">

    <meta http-equiv=X-UA-Compatible content=IE=edge>

                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
                    Toggle navigation

                </button>
                Heartysoft Solutions Limited
                Heartysoft

HSFT

Services

Technology

            Community

                Blog

Latest Blog Entries

Martin Thompson's Writing Concurrent Code with Lock Free Algorithms Course

                        A summary of Martin Thompson's course on Concurrent Programming at Skillsmatter.

                        10-06-2013

Specifying Processor Affinity on Windows (Taskset for Windows)

                        Linux has taskset. What about Windows?

                        06-06-2013

Hey Kaspersky, Stop Slowing Down My VS

                        I'm finally starting off this blog about a month after Joe gave it to me...yay, awesome, yahoo (or s ...

                        14-07-2008

Archive

Martin Thompson's Writing Concurrent Code with Lock Free Algorithms Course

                                10-06-2013

                                        C#

                                        Community

                                        Performance Tips

                                        General Software Development

Specifying Processor Affinity on Windows (Taskset for Windows)

                                06-06-2013

                                        .NET

                                        General Software Development

                                        Performance Tips

Hey Kaspersky, Stop Slowing Down My VS

                                14-07-2008

                                        General Software Development

                                        Performance Tips

                © 2014 heartysoft.com | all rights reserved | To top

                    Heartysoft Solutions Limited is registered in England & Wales
                    Company Number 07420608 | VAT Number GB 103 3162 72


text:
<?php

namespace App\Console\Commands;

use App\Jobs\Top30;
use App\Jobs\Top30TillDate;
use Carbon\Carbon;
use Illuminate\Console\Command;

class Top30Chart extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'chart:top30 {date} {reset?}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Create new top 30 chart';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
    	if ($this->argument('reset')){
    		$job = new Top30TillDate();
    		dispatch($job);
		} else {
			$job = new Top30(Carbon::today());
			dispatch($job);
		}
    }
}


text:
#include <cucumber-cpp/internal/drivers/BoostDriver.hpp>

#include <sstream>

#include <boost/bind.hpp>
#include <boost/function.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/test/unit_test.hpp>
#include <boost/test/unit_test_log_formatter.hpp>
#include <boost/thread/once.hpp>
#include <boost/version.hpp>

using namespace ::boost::unit_test;
using ::boost::execution_exception;

namespace cucumber {
namespace internal {

namespace {

    test_case* testCase = 0;
    boost::function<void()> currentTestBody;

    void exec_test_body() {
        if (currentTestBody) {
            currentTestBody();
        }
    }

bool boost_test_init() {
    testCase = BOOST_TEST_CASE(&exec_test_body);
    framework::master_test_suite().add(testCase);

    return true;
}

// Freed by Boost's unit test framework on exit
static CukeBoostLogInterceptor *logInterceptor = 0;

}

class CukeBoostLogInterceptor : public ::boost::unit_test::unit_test_log_formatter {
public:
    const InvokeResult getResult() const;
    void reset();

    // Formatter
    void log_start( std::ostream&, counter_t /*test_cases_amount*/) {};
    void log_finish( std::ostream&) {};
#if BOOST_VERSION >= 107000
    void log_build_info(std::ostream&, bool /*log_build_info*/){};
#else
    void log_build_info( std::ostream&) {};
#endif

    void test_unit_start( std::ostream&, test_unit const& /*tu*/) {};
    void test_unit_finish( std::ostream&, test_unit const& /*tu*/, unsigned long /*elapsed*/) {};
    void test_unit_skipped( std::ostream&, test_unit const& /*tu*/) {};

    void log_exception_start( std::ostream&, log_checkpoint_data const&, execution_exception const&) {};
    void log_exception_finish( std::ostream& ) {};

    void log_entry_start( std::ostream&, log_entry_data const&, log_entry_types /*let*/) {};
    void log_entry_value( std::ostream&, const_string value);
    void log_entry_value( std::ostream&, lazy_ostream const& value);
    void log_entry_finish( std::ostream&) {};

    void entry_context_start( std::ostream&, log_level /*l*/) {}
#if BOOST_VERSION >= 106500
    void log_entry_context( std::ostream&, log_level /*l*/, const_string /*value*/) {}
    void entry_context_finish( std::ostream&, log_level /*l*/ ) {}
#else
    void log_entry_context( std::ostream&, const_string /*value*/) {}
    void entry_context_finish( std::ostream& ) {}
#endif

private:
    std::stringstream description;
};

void CukeBoostLogInterceptor::reset() {
    description.str("");
}

/*
 * Threshold level set to log_all_errors, so we should be fine logging everything
 */
void CukeBoostLogInterceptor::log_entry_value(std::ostream&, const_string value) {
    description << value;
}

void CukeBoostLogInterceptor::log_entry_value(std::ostream&, lazy_ostream const& value) {
    description << value;
}

const InvokeResult CukeBoostLogInterceptor::getResult() const {
    std::string d = description.str();
    if (d.empty()) {
        return InvokeResult::success();
    } else {
        return InvokeResult::failure(description.str());
    }
}

const InvokeResult BoostStep::invokeStepBody() {
    static boost::once_flag initialized;
    boost::call_once(initialized, BoostStep::initBoostTest);

    logInterceptor->reset();
    runWithMasterSuite();
    return logInterceptor->getResult();
}

void BoostStep::initBoostTest() {
    int argc = 1;
    char dummyArg[] = "dummy";
    char *argv[] = { dummyArg };
    framework::init(&boost_test_init, argc, argv);
#if BOOST_VERSION >= 105900
    framework::finalize_setup_phase();
#endif

    logInterceptor = new CukeBoostLogInterceptor;
    ::boost::unit_test::unit_test_log.set_formatter(logInterceptor);
    ::boost::unit_test::unit_test_log.set_threshold_level(log_all_errors);
}

void BoostStep::runWithMasterSuite() {
    currentTestBody = boost::bind(&BoostStep::body, this);

    ::boost::unit_test::framework::run(testCase, false);

    currentTestBody.clear();
}

}
}


text:
package com.leavjenn.hews.ui.adapter;

import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.preference.PreferenceManager;
import android.support.v7.widget.RecyclerView;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.leavjenn.hews.Constants;
import com.leavjenn.hews.R;
import com.leavjenn.hews.misc.Utils;
import com.leavjenn.hews.misc.SharedPrefsManager;
import com.leavjenn.hews.model.HNItem;
import com.leavjenn.hews.model.Post;

import java.util.ArrayList;
import java.util.List;

public class PostAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
    private static final int UNREAD_ITEM_LEFT_FOR_RELOADING = 10;
    private static final int VIEW_TYPE_POST = 0;
    private static final int VIEW_TYPE_FOOTER = 1;

    private int mMaxRead;
    private int mLoadingState;
    private int mResPrompt;
    private Typeface mFont;
    private float mTextSize, mLineHeight;
    private SharedPreferences prefs;
    private ArrayList<HNItem> mPostList;
    private Context mContext;
    private OnReachBottomListener mOnReachBottomListener;
    private OnItemClickListener mOnItemClickListener;

    public PostAdapter(Context context, OnReachBottomListener onReachBottomListener,
                       OnItemClickListener onItemClickListener) {
        mContext = context;
        mPostList = new ArrayList<>();
        mOnReachBottomListener = onReachBottomListener;
        mOnItemClickListener = onItemClickListener;
        prefs = PreferenceManager.getDefaultSharedPreferences(mContext);
        updatePostPrefs();
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
        View v;
        RecyclerView.ViewHolder viewHolder = null;
        if (viewType == VIEW_TYPE_FOOTER) {
            v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.list_item_footer,
                viewGroup, false);
            viewHolder = new FooterViewHolder(v);
        } else if (viewType == VIEW_TYPE_POST) {
            v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.list_item_post,
                viewGroup, false);
            PostViewHolder vh = new PostViewHolder(v);
            vh.tvTitle.setTypeface(mFont);
            vh.tvTitle.setTextSize(mTextSize);
            vh.tvTitle.setLineSpacing(0, mLineHeight);
            vh.tvTitle.setPaintFlags(vh.tvTitle.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG);
            vh.tvSummary.setTypeface(Typeface.createFromAsset(mContext.getAssets(), "Open Sans.ttf"));
            viewHolder = vh;
        }
        return viewHolder;
    }

    @Override
    public void onBindViewHolder(final RecyclerView.ViewHolder viewHolder, int position) {
        if (viewHolder instanceof PostViewHolder) {
            bindPostViewHolder(viewHolder, position);
        } else if (viewHolder instanceof FooterViewHolder) {
            bindFooterViewHolder(viewHolder);
        }
    }

    private void bindPostViewHolder(RecyclerView.ViewHolder viewHolder, int position) {
        if (mMaxRead < position) {
            mMaxRead = position;
            if (mMaxRead >= getItemCount() - UNREAD_ITEM_LEFT_FOR_RELOADING) {
                mOnReachBottomListener.OnReachBottom();
            }
        }
        final Post currentPost = (Post) mPostList.get(position);
        PostViewHolder postVH = (PostViewHolder) viewHolder;
        postVH.tvTitle.setText(currentPost.getTitle());
        // set title color based on has read or not
        TypedValue titleColor = new TypedValue();
        if (currentPost.isRead()) {
            mContext.getTheme().resolveAttribute(R.attr.text_title_color_inverse, titleColor, true);
        } else {
            mContext.getTheme().resolveAttribute(android.R.attr.textColor, titleColor, true);
        }
        postVH.tvTitle.setTextColor(titleColor.data);

        postVH.tvScore.setText("+ " + String.valueOf(currentPost.getScore()));
        postVH.tvScore.setTextColor(titleColor.data);
        postVH.tvDescendants.setText(String.valueOf(currentPost.getDescendants()));
        postVH.tvTime.setText(String.valueOf(Utils.formatTime(currentPost.getTime())));
        postVH.tvPrettyUrl.setText(currentPost.getPrettyUrl());
        if (currentPost.getSummary() != null) {
            postVH.tvSummary.setVisibility(View.VISIBLE);
            postVH.tvSummary.setText(currentPost.getSummary());
        } else {
            postVH.tvSummary.setVisibility(View.GONE);
        }
    }

    private void bindFooterViewHolder(RecyclerView.ViewHolder viewHolder) {
        FooterViewHolder footerViewHolder = (FooterViewHolder) viewHolder;
        if (mLoadingState == Constants.LOADING_IDLE
            || mLoadingState == Constants.LOADING_FINISH
            || mLoadingState == Constants.LOADING_ERROR) {
            footerViewHolder.progressBar.setVisibility(View.GONE);
            footerViewHolder.tvPrompt.setVisibility(View.GONE);
        } else if (mLoadingState == Constants.LOADING_PROMPT_NO_CONTENT) {
            footerViewHolder.progressBar.setVisibility(View.GONE);
            footerViewHolder.tvPrompt.setVisibility(View.VISIBLE);
            if (mResPrompt != 0) {
                footerViewHolder.tvPrompt.setText(mContext.getResources().getString(mResPrompt));
            }
        } else if (mLoadingState == Constants.LOADING_IN_PROGRESS) {
            footerViewHolder.progressBar.setVisibility(View.VISIBLE);
            footerViewHolder.tvPrompt.setVisibility(View.GONE);
        }
    }

    @Override
    public int getItemCount() {
        return mPostList.size();
    }

    @Override
    public int getItemViewType(int position) {
        if (mPostList.get(position) instanceof HNItem.Footer) {
            return VIEW_TYPE_FOOTER;
        } else {
            return VIEW_TYPE_POST;
        }
    }

    public void addPost(Post post) {
        mPostList.add(mPostList.size() - 1, post);
        notifyItemInserted(mPostList.size() - 1);
    }

    public void addFooter(HNItem.Footer footer) {
        mPostList.add(footer);
        notifyItemInserted(mPostList.size() - 1);
    }

    public void addAllPosts(List<? extends HNItem> hnItemList) {
        mPostList.addAll(mPostList.size() - 1, hnItemList);
        notifyDataSetChanged();
    }

    public void clear() {
        mPostList.clear();
        notifyDataSetChanged();
        mMaxRead = 0;
    }

    public void clearAndAddFooter() {
        mPostList.clear();
        mPostList.add(new HNItem.Footer());
        notifyDataSetChanged();
        mMaxRead = 0;
    }

    public void updateFooter(int loadingState) {
        mLoadingState = loadingState;
    }

    public void updatePrompt(int resPrompt) {
        mResPrompt = resPrompt;
    }

    public ArrayList<Post> getPostList() {
        ArrayList<Post> postList = new ArrayList<>();
        for (HNItem hnItem : mPostList) {
            if (hnItem instanceof Post) {
                postList.add((Post) hnItem);
            }
        }
        return postList;
    }

    public void updatePostPrefs() {
        mFont = Typeface.createFromAsset(mContext.getAssets(),
            SharedPrefsManager.getPostFont(prefs) + ".ttf");
        mTextSize = SharedPrefsManager.getPostFontSize(prefs);
        mLineHeight = SharedPrefsManager.getPostLineHeight(prefs);
    }

    public class PostViewHolder extends RecyclerView.ViewHolder {
        RelativeLayout layoutLink;
        LinearLayout layoutComment;
        TextView tvTitle;
        TextView tvScore;
        TextView tvDescendants;
        TextView tvTime;
        TextView tvPrettyUrl;
        TextView tvSummary;

        public PostViewHolder(View v) {
            super(v);
            layoutLink = (RelativeLayout) v.findViewById(R.id.layout_link);
            layoutComment = (LinearLayout) v.findViewById(R.id.layout_comment);
            tvTitle = (TextView) v.findViewById(R.id.tv_post_title);
            tvScore = (TextView) v.findViewById(R.id.tv_post_point);
            tvTime = (TextView) v.findViewById(R.id.tv_post_time);
            tvDescendants = (TextView) v.findViewById(R.id.tv_post_comments);
            tvPrettyUrl = (TextView) v.findViewById(R.id.tv_post_pretty_url);
            tvSummary = (TextView) v.findViewById(R.id.tv_post_summary);
            layoutComment.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    if (getAdapterPosition() == RecyclerView.NO_POSITION) {
                        return;
                    }
                    if (mPostList.get(getAdapterPosition()) instanceof Post) {
                        Post post = (Post) mPostList.get(getAdapterPosition());
                        post.setRead(true);
                        SharedPrefsManager.setPostRead(prefs, post.getId());
                        notifyItemChanged(getAdapterPosition());
                        mOnItemClickListener.onOpenComment(post);
                    }
                }
            });
            layoutLink.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    if (getAdapterPosition() == RecyclerView.NO_POSITION) {
                        return;
                    }
                    if (mPostList.get(getAdapterPosition()) instanceof Post) {
                        Post post = (Post) mPostList.get(getAdapterPosition());
                        post.setRead(true);
                        SharedPrefsManager.setPostRead(prefs, post.getId());
                        notifyItemChanged(getAdapterPosition());
                        mOnItemClickListener.onOpenLink(post);
                    }
                }
            });
        }
    }

    public interface OnReachBottomListener {
        void OnReachBottom();
    }

    public interface OnItemClickListener {
        void onOpenComment(Post post);

        void onOpenLink(Post post);
    }
}


text:
NSString *const kGTXErrorDomain = @"com.google.gtxchecker";
NSString *const kGTXErrorFailingElementKey = @"kGTXErrorFailingElementKey";
NSString *const kGTXErrorUnderlyingErrorsKey = @"kGTXErrorUnderlyingErrorsKey";
NSString *const kGTXErrorFailuresKey = @"kGTXErrorFailuresKey";
NSString *const kGTXErrorCheckNameKey = @"kGTXErrorCheckNameKey";
NSString *const kGTXErrorDescriptionKey = @"kGTXErrorDescriptionKey";

#pragma mark - Implementation

@implementation NSError (GTXAdditions)

+ (BOOL)gtx_logOrSetError:(GTXErrorRefType)errorOrNil
              description:(NSString *)description
                     code:(NSInteger)errorCode
                 userInfo:(NSDictionary *)userInfoOrNil {
  NSParameterAssert(description);
  NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:userInfoOrNil];
  userInfo[NSLocalizedDescriptionKey] = description;
  userInfo[kGTXErrorDescriptionKey] = description;
  NSError *error = [NSError errorWithDomain:kGTXErrorDomain code:errorCode userInfo:userInfo];
  if (errorOrNil) {
    *errorOrNil = error;
  } else {
    [[GTXLogger defaultLogger] logWithLevel:GTXLogLevelError format:@"%@", error];
  }
  return YES;
}

+ (BOOL)gtx_logOrSetGTXCheckFailedError:(GTXErrorRefType)errorOrNil
                                element:(id)element
                                   name:(NSString *)name
                            description:(NSString *)description {
  NSParameterAssert(name);
  NSParameterAssert(element);
  NSParameterAssert(description);
  NSString *fullDescription =
      [NSString stringWithFormat:@"Check \"%@\" failed, %@", name, description];
  NSDictionary *userInfo = @{
    kGTXErrorDescriptionKey : description,
    NSLocalizedDescriptionKey : fullDescription,
    kGTXErrorFailingElementKey : element,
    kGTXErrorCheckNameKey : name
  };
  NSError *error = [NSError errorWithDomain:kGTXErrorDomain
                                       code:GTXCheckErrorCodeAccessibilityCheckFailed
                                   userInfo:userInfo];
  if (errorOrNil) {
    *errorOrNil = error;
  } else {
    [[GTXLogger defaultLogger] logWithLevel:GTXLogLevelError format:@"%@", error];
  }
  return YES;
}

@end