text:
namespace llvm {
  class Function;
  class FunctionPass;
  class Instruction;
  class CallSite;
  class AliasAnalysis;
  class AssumptionCache;
  class DataLayout;
  class MemoryDependenceAnalysis;
  class PredIteratorCache;
  class DominatorTree;
  class PHITransAddr;

  /// MemDepResult - A memory dependence query can return one of three different
  /// answers, described below.
  class MemDepResult {
    enum DepType {
      /// Invalid - Clients of MemDep never see this.
      Invalid = 0,

      /// Clobber - This is a dependence on the specified instruction which
      /// clobbers the desired value.  The pointer member of the MemDepResult
      /// pair holds the instruction that clobbers the memory.  For example,
      /// this occurs when we see a may-aliased store to the memory location we
      /// care about.
      ///
      /// There are several cases that may be interesting here:
      ///   1. Loads are clobbered by may-alias stores.
      ///   2. Loads are considered clobbered by partially-aliased loads.  The
      ///      client may choose to analyze deeper into these cases.
      Clobber,

      /// Def - This is a dependence on the specified instruction which
      /// defines/produces the desired memory location.  The pointer member of
      /// the MemDepResult pair holds the instruction that defines the memory.
      /// Cases of interest:
      ///   1. This could be a load or store for dependence queries on
      ///      load/store.  The value loaded or stored is the produced value.
      ///      Note that the pointer operand may be different than that of the
      ///      queried pointer due to must aliases and phi translation.  Note
      ///      that the def may not be the same type as the query, the pointers
      ///      may just be must aliases.
      ///   2. For loads and stores, this could be an allocation instruction. In
      ///      this case, the load is loading an undef value or a store is the
      ///      first store to (that part of) the allocation.
      ///   3. Dependence queries on calls return Def only when they are
      ///      readonly calls or memory use intrinsics with identical callees
      ///      and no intervening clobbers.  No validation is done that the
      ///      operands to the calls are the same.
      Def,

      /// Other - This marker indicates that the query has no known dependency
      /// in the specified block.  More detailed state info is encoded in the
      /// upper part of the pair (i.e. the Instruction*)
      Other
    };
    /// If DepType is "Other", the upper part of the pair
    /// (i.e. the Instruction* part) is instead used to encode more detailed
    /// type information as follows
    enum OtherType {
      /// NonLocal - This marker indicates that the query has no dependency in
      /// the specified block.  To find out more, the client should query other
      /// predecessor blocks.
      NonLocal = 0x4,
      /// NonFuncLocal - This marker indicates that the query has no
      /// dependency in the specified function.
      NonFuncLocal = 0x8,
      /// Unknown - This marker indicates that the query dependency
      /// is unknown.
      Unknown = 0xc
    };

    typedef PointerIntPair<Instruction*, 2, DepType> PairTy;
    PairTy Value;
    explicit MemDepResult(PairTy V) : Value(V) {}
  public:
    MemDepResult() : Value(nullptr, Invalid) {}

    /// get methods: These are static ctor methods for creating various
    /// MemDepResult kinds.
    static MemDepResult getDef(Instruction *Inst) {
      assert(Inst && "Def requires inst");
      return MemDepResult(PairTy(Inst, Def));
    }
    static MemDepResult getClobber(Instruction *Inst) {
      assert(Inst && "Clobber requires inst");
      return MemDepResult(PairTy(Inst, Clobber));
    }
    static MemDepResult getNonLocal() {
      return MemDepResult(
        PairTy(reinterpret_cast<Instruction*>(NonLocal), Other));
    }
    static MemDepResult getNonFuncLocal() {
      return MemDepResult(
        PairTy(reinterpret_cast<Instruction*>(NonFuncLocal), Other));
    }
    static MemDepResult getUnknown() {
      return MemDepResult(
        PairTy(reinterpret_cast<Instruction*>(Unknown), Other));
    }

    /// isClobber - Return true if this MemDepResult represents a query that is
    /// an instruction clobber dependency.
    bool isClobber() const { return Value.getInt() == Clobber; }

    /// isDef - Return true if this MemDepResult represents a query that is
    /// an instruction definition dependency.
    bool isDef() const { return Value.getInt() == Def; }

    /// isNonLocal - Return true if this MemDepResult represents a query that
    /// is transparent to the start of the block, but where a non-local hasn't
    /// been done.
    bool isNonLocal() const {
      return Value.getInt() == Other
        && Value.getPointer() == reinterpret_cast<Instruction*>(NonLocal);
    }

    /// isNonFuncLocal - Return true if this MemDepResult represents a query
    /// that is transparent to the start of the function.
    bool isNonFuncLocal() const {
      return Value.getInt() == Other
        && Value.getPointer() == reinterpret_cast<Instruction*>(NonFuncLocal);
    }

    /// isUnknown - Return true if this MemDepResult represents a query which
    /// cannot and/or will not be computed.
    bool isUnknown() const {
      return Value.getInt() == Other
        && Value.getPointer() == reinterpret_cast<Instruction*>(Unknown);
    }

    /// getInst() - If this is a normal dependency, return the instruction that
    /// is depended on.  Otherwise, return null.
    Instruction *getInst() const {
      if (Value.getInt() == Other) return nullptr;
      return Value.getPointer();
    }

    bool operator==(const MemDepResult &M) const { return Value == M.Value; }
    bool operator!=(const MemDepResult &M) const { return Value != M.Value; }
    bool operator<(const MemDepResult &M) const { return Value < M.Value; }
    bool operator>(const MemDepResult &M) const { return Value > M.Value; }
  private:
    friend class MemoryDependenceAnalysis;
    /// Dirty - Entries with this marker occur in a LocalDeps map or
    /// NonLocalDeps map when the instruction they previously referenced was
    /// removed from MemDep.  In either case, the entry may include an
    /// instruction pointer.  If so, the pointer is an instruction in the
    /// block where scanning can start from, saving some work.
    ///
    /// In a default-constructed MemDepResult object, the type will be Dirty
    /// and the instruction pointer will be null.
    ///

    /// isDirty - Return true if this is a MemDepResult in its dirty/invalid.
    /// state.
    bool isDirty() const { return Value.getInt() == Invalid; }

    static MemDepResult getDirty(Instruction *Inst) {
      return MemDepResult(PairTy(Inst, Invalid));
    }
  };

  /// NonLocalDepEntry - This is an entry in the NonLocalDepInfo cache.  For
  /// each BasicBlock (the BB entry) it keeps a MemDepResult.
  class NonLocalDepEntry {
    BasicBlock *BB;
    MemDepResult Result;
  public:
    NonLocalDepEntry(BasicBlock *bb, MemDepResult result)
      : BB(bb), Result(result) {}

    // This is used for searches.
    NonLocalDepEntry(BasicBlock *bb) : BB(bb) {}

    // BB is the sort key, it can't be changed.
    BasicBlock *getBB() const { return BB; }

    void setResult(const MemDepResult &R) { Result = R; }

    const MemDepResult &getResult() const { return Result; }

    bool operator<(const NonLocalDepEntry &RHS) const {
      return BB < RHS.BB;
    }
  };

  /// NonLocalDepResult - This is a result from a NonLocal dependence query.
  /// For each BasicBlock (the BB entry) it keeps a MemDepResult and the
  /// (potentially phi translated) address that was live in the block.
  class NonLocalDepResult {
    NonLocalDepEntry Entry;
    Value *Address;
  public:
    NonLocalDepResult(BasicBlock *bb, MemDepResult result, Value *address)
      : Entry(bb, result), Address(address) {}

    // BB is the sort key, it can't be changed.
    BasicBlock *getBB() const { return Entry.getBB(); }

    void setResult(const MemDepResult &R, Value *Addr) {
      Entry.setResult(R);
      Address = Addr;
    }

    const MemDepResult &getResult() const { return Entry.getResult(); }

    /// getAddress - Return the address of this pointer in this block.  This can
    /// be different than the address queried for the non-local result because
    /// of phi translation.  This returns null if the address was not available
    /// in a block (i.e. because phi translation failed) or if this is a cached
    /// result and that address was deleted.
    ///
    /// The address is always null for a non-local 'call' dependence.
    Value *getAddress() const { return Address; }
  };

  /// MemoryDependenceAnalysis - This is an analysis that determines, for a
  /// given memory operation, what preceding memory operations it depends on.
  /// It builds on alias analysis information, and tries to provide a lazy,
  /// caching interface to a common kind of alias information query.
  ///
  /// The dependency information returned is somewhat unusual, but is pragmatic.
  /// If queried about a store or call that might modify memory, the analysis
  /// will return the instruction[s] that may either load from that memory or
  /// store to it.  If queried with a load or call that can never modify memory,
  /// the analysis will return calls and stores that might modify the pointer,
  /// but generally does not return loads unless a) they are volatile, or
  /// b) they load from *must-aliased* pointers.  Returning a dependence on
  /// must-alias'd pointers instead of all pointers interacts well with the
  /// internal caching mechanism.
  ///
  class MemoryDependenceAnalysis : public FunctionPass {
    // A map from instructions to their dependency.
    typedef DenseMap<Instruction*, MemDepResult> LocalDepMapType;
    LocalDepMapType LocalDeps;

  public:
    typedef std::vector<NonLocalDepEntry> NonLocalDepInfo;
  private:
    /// ValueIsLoadPair - This is a pair<Value*, bool> where the bool is true if
    /// the dependence is a read only dependence, false if read/write.
    typedef PointerIntPair<const Value*, 1, bool> ValueIsLoadPair;

    /// BBSkipFirstBlockPair - This pair is used when caching information for a
    /// block.  If the pointer is null, the cache value is not a full query that
    /// starts at the specified block.  If non-null, the bool indicates whether
    /// or not the contents of the block was skipped.
    typedef PointerIntPair<BasicBlock*, 1, bool> BBSkipFirstBlockPair;

    /// NonLocalPointerInfo - This record is the information kept for each
    /// (value, is load) pair.
    struct NonLocalPointerInfo {
      /// Pair - The pair of the block and the skip-first-block flag.
      BBSkipFirstBlockPair Pair;
      /// NonLocalDeps - The results of the query for each relevant block.
      NonLocalDepInfo NonLocalDeps;
      /// Size - The maximum size of the dereferences of the
      /// pointer. May be UnknownSize if the sizes are unknown.
      uint64_t Size;
      /// AATags - The AA tags associated with dereferences of the
      /// pointer. The members may be null if there are no tags or
      /// conflicting tags.
      AAMDNodes AATags;

      NonLocalPointerInfo() : Size(AliasAnalysis::UnknownSize) {}
    };

    /// CachedNonLocalPointerInfo - This map stores the cached results of doing
    /// a pointer lookup at the bottom of a block.  The key of this map is the
    /// pointer+isload bit, the value is a list of <bb->result> mappings.
    typedef DenseMap<ValueIsLoadPair,
                     NonLocalPointerInfo> CachedNonLocalPointerInfo;
    CachedNonLocalPointerInfo NonLocalPointerDeps;

    // A map from instructions to their non-local pointer dependencies.
    typedef DenseMap<Instruction*,
                     SmallPtrSet<ValueIsLoadPair, 4> > ReverseNonLocalPtrDepTy;
    ReverseNonLocalPtrDepTy ReverseNonLocalPtrDeps;

    /// PerInstNLInfo - This is the instruction we keep for each cached access
    /// that we have for an instruction.  The pointer is an owning pointer and
    /// the bool indicates whether we have any dirty bits in the set.
    typedef std::pair<NonLocalDepInfo, bool> PerInstNLInfo;

    // A map from instructions to their non-local dependencies.
    typedef DenseMap<Instruction*, PerInstNLInfo> NonLocalDepMapType;

    NonLocalDepMapType NonLocalDeps;

    // A reverse mapping from dependencies to the dependees.  This is
    // used when removing instructions to keep the cache coherent.
    typedef DenseMap<Instruction*,
                     SmallPtrSet<Instruction*, 4> > ReverseDepMapType;
    ReverseDepMapType ReverseLocalDeps;

    // A reverse mapping from dependencies to the non-local dependees.
    ReverseDepMapType ReverseNonLocalDeps;

    /// Current AA implementation, just a cache.
    AliasAnalysis *AA;
    const DataLayout *DL;
    DominatorTree *DT;
    AssumptionCache *AC;
    std::unique_ptr<PredIteratorCache> PredCache;

  public:
    MemoryDependenceAnalysis();
    ~MemoryDependenceAnalysis();
    static char ID;

    /// Pass Implementation stuff.  This doesn't do any analysis eagerly.
    bool runOnFunction(Function &) override;

    /// Clean up memory in between runs
    void releaseMemory() override;

    /// getAnalysisUsage - Does not modify anything.  It uses Value Numbering
    /// and Alias Analysis.
    ///
    void getAnalysisUsage(AnalysisUsage &AU) const override;

    /// getDependency - Return the instruction on which a memory operation
    /// depends.  See the class comment for more details.  It is illegal to call
    /// this on non-memory instructions.
    MemDepResult getDependency(Instruction *QueryInst);

    /// getNonLocalCallDependency - Perform a full dependency query for the
    /// specified call, returning the set of blocks that the value is
    /// potentially live across.  The returned set of results will include a
    /// "NonLocal" result for all blocks where the value is live across.
    ///
    /// This method assumes the instruction returns a "NonLocal" dependency
    /// within its own block.
    ///
    /// This returns a reference to an internal data structure that may be
    /// invalidated on the next non-local query or when an instruction is
    /// removed.  Clients must copy this data if they want it around longer than
    /// that.
    const NonLocalDepInfo &getNonLocalCallDependency(CallSite QueryCS);

    /// getNonLocalPointerDependency - Perform a full dependency query for an
    /// access to the QueryInst's specified memory location, returning the set
    /// of instructions that either define or clobber the value.
    ///
    /// Warning: For a volatile query instruction, the dependencies will be
    /// accurate, and thus usable for reordering, but it is never legal to
    /// remove the query instruction.
    ///
    /// This method assumes the pointer has a "NonLocal" dependency within
    /// QueryInst's parent basic block.
    void getNonLocalPointerDependency(Instruction *QueryInst,
                                    SmallVectorImpl<NonLocalDepResult> &Result);

    /// removeInstruction - Remove an instruction from the dependence analysis,
    /// updating the dependence of instructions that previously depended on it.
    void removeInstruction(Instruction *InstToRemove);

    /// invalidateCachedPointerInfo - This method is used to invalidate cached
    /// information about the specified pointer, because it may be too
    /// conservative in memdep.  This is an optional call that can be used when
    /// the client detects an equivalence between the pointer and some other
    /// value and replaces the other value with ptr. This can make Ptr available
    /// in more places that cached info does not necessarily keep.
    void invalidateCachedPointerInfo(Value *Ptr);

    /// invalidateCachedPredecessors - Clear the PredIteratorCache info.
    /// This needs to be done when the CFG changes, e.g., due to splitting
    /// critical edges.
    void invalidateCachedPredecessors();

    /// getPointerDependencyFrom - Return the instruction on which a memory
    /// location depends.  If isLoad is true, this routine ignores may-aliases
    /// with read-only operations.  If isLoad is false, this routine ignores
    /// may-aliases with reads from read-only locations. If possible, pass
    /// the query instruction as well; this function may take advantage of
    /// the metadata annotated to the query instruction to refine the result.
    ///
    /// Note that this is an uncached query, and thus may be inefficient.
    ///
    MemDepResult getPointerDependencyFrom(const AliasAnalysis::Location &Loc,
                                          bool isLoad,
                                          BasicBlock::iterator ScanIt,
                                          BasicBlock *BB,
                                          Instruction *QueryInst = nullptr);

    /// getLoadLoadClobberFullWidthSize - This is a little bit of analysis that
    /// looks at a memory location for a load (specified by MemLocBase, Offs,
    /// and Size) and compares it against a load.  If the specified load could
    /// be safely widened to a larger integer load that is 1) still efficient,
    /// 2) safe for the target, and 3) would provide the specified memory
    /// location value, then this function returns the size in bytes of the
    /// load width to use.  If not, this returns zero.
    static unsigned getLoadLoadClobberFullWidthSize(const Value *MemLocBase,
                                                    int64_t MemLocOffs,
                                                    unsigned MemLocSize,
                                                    const LoadInst *LI,
                                                    const DataLayout &DL);

  private:
    MemDepResult getCallSiteDependencyFrom(CallSite C, bool isReadOnlyCall,
                                           BasicBlock::iterator ScanIt,
                                           BasicBlock *BB);
    bool getNonLocalPointerDepFromBB(const PHITransAddr &Pointer,
                                     const AliasAnalysis::Location &Loc,
                                     bool isLoad, BasicBlock *BB,
                                     SmallVectorImpl<NonLocalDepResult> &Result,
                                     DenseMap<BasicBlock*, Value*> &Visited,
                                     bool SkipFirstBlock = false);
    MemDepResult GetNonLocalInfoForBlock(const AliasAnalysis::Location &Loc,
                                         bool isLoad, BasicBlock *BB,
                                         NonLocalDepInfo *Cache,
                                         unsigned NumSortedEntries);

    void RemoveCachedNonLocalPointerDependencies(ValueIsLoadPair P);

    /// verifyRemoved - Verify that the specified instruction does not occur
    /// in our internal data structures.
    void verifyRemoved(Instruction *Inst) const;

  };

} // End llvm namespace

#endif


text:
{% extends "splunkdj:base_with_app_bar.html" %}

{% load splunkmvc %}

{% block title %}Table Views - Web Framework Toolkit{% endblock title %}

{% block css %}
<link rel="stylesheet" href="{{STATIC_URL}}splunk_wftoolkit/contrib/prettify.css"/>
<link rel="stylesheet" type="text/css" href="{{STATIC_URL}}splunkjs/css/dashboard.css">
<link rel="stylesheet" href="{{STATIC_URL}}splunk_wftoolkit/custom.css"/>
{% endblock css %}

{% block content %}

Tables

The table-style views include the Table view and the EventsViewer view.

Table view

The Table view is a fully-featured Splunk-style results table that supports pagination. The Table view is bound to a search manager and displays the processed results from that search.

When using Django Bindings, use the {% table %} tag with the managerid property to specify the search manager.

        {% table id="example-table" managerid="example-search" pageSize="5" %}

                    JavaScript

                    Django

{% table id="example-table" managerid="example-search" pageSize="5" %}

var TableView = require("splunkjs/mvc/tableview");
new TableView({
    id: "example-table",
    managerid: "example-search",
    el: $("#divToHangOn")
}).render();

Options

You can set the following properties using templates tags or JavaScript:

managerid: The search manager for the table.

data: The name of the results model to use.

pageSize: The number of results per page.

fields: The fields to include in the table. In JavaScript, provide a list of strings. In Django, provide a space-separated list.

drilldownRedirect: Indicates whether to redirect when clicked.

                    JavaScript

                    Django

{% table id="example-table" managerid="example-search" fields="_time splunkd" %}

var table= splunkjs.mvc.Components.getInstance("example-table");
table.settings.set("fields", ["_time", "splunkd"]);

Events

The Table view fires the following events:

click:cell: Fired when a cell is clicked.

click:row: Fired when a row is clicked.

By default, the table automatically drills down to the clicked data. You can prevent
        this action by setting drilldownRedirect to false, or running
        e.preventDefault() in the click handler.

EventsViewer view

The EventsViewer view is a fully-featured Splunk-style events viewer that supports pagination and variable formatting. The EventsViewer view is bound to a search manager and displays the events from that search.

When using Django Bindings, use the {% eventsviewer %} tag with the managerid property to specify the search manager.

        {% eventsviewer id="example-eventsviewer" managerid="example-event-search"%}

                    JavaScript

                    Django

{% block content %}
    {% eventsviewer id="example-eventsviewer" managerid="example-event-search"%}
{% endblock content %}
{% block managers %}
    {% searchmanager id="example-event-search" search="index=_internal | head 3"%}
{% endblock managers %}

var EventsViewerView = require("splunkjs/mvc/eventsviewerview");
new EventsViewerView({
    id: "example-eventsviewer",
    managerid: "example-search",
    el: $("#divToHangOn")
}).render();

var SearchManager = require("splunkjs/mvc/searchmanager");
new SearchManager({
    id: "example-search",
    search: "index=_internal | head 3"
});

{% endblock content%}

{% block managers %}

    {% searchmanager id="example-search" search="index=_internal | head 100 | timechart count by sourcetype span=100s" preview=False cache=True %}

    {% searchmanager id="example-event-search" search="index=_internal | head 3" %}

{% endblock managers %}

{% block js %}

{{block.super}}

{% endblock js %}

redpajama_set_name: RedPajamaGithub


text:
package br.com.digitaldreams.popularmovies2.networking;

import android.content.Context;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.preference.PreferenceManager;
import android.util.Log;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

import br.com.digitaldreams.popularmovies2.R;
import br.com.digitaldreams.popularmovies2.models.Movie;
import br.com.digitaldreams.popularmovies2.models.Reviews;
import br.com.digitaldreams.popularmovies2.models.Trailer;

/**
 * Created by josecostamartins on 7/25/16.
 */
public class FetchMovieRequest extends AsyncTask<Void, Void, String> {

    private final static String LOG_TAG = FetchMovieRequest.class.getSimpleName();
    private String baseURL;
    private boolean shouldSort = false;
    private String sortOrder;
    private String APIKey;
    private Context context;
    private NetworkingTask listener;
    private String type;

    public FetchMovieRequest(Context context, NetworkingTask listener, String tag, Movie movie){
        if (context == null){
            throw new NullPointerException("Context can't be null");
        }
        if (listener == null) {
            throw new NullPointerException("Listener can't be null");
        }
        if (tag == null) {
            throw new NullPointerException("Type can't be null");
        }

        if (tag.equalsIgnoreCase("t")){
            if (movie == null) {
                throw new NullPointerException("Class can't be null");
            }
            this.baseURL = Trailer.getURL(movie.getId());
        }
        else if (tag.equalsIgnoreCase("r")){
            if (movie == null) {
                throw new NullPointerException("Class can't be null");
            }
            this.baseURL = Reviews.getURL(movie.getId());
        }
        else { //defaults to movie
            this.baseURL = Movie.getURL();
            shouldSort = true;
        }

        this.APIKey = Movie.getKey();
        this.context = context;
        this.listener = listener;
        this.type = tag;

        SharedPreferences sharedPrefs =
                PreferenceManager.getDefaultSharedPreferences(this.context);
        sortOrder = sharedPrefs.getString(context.getString(R.string.sort_order_key), "popular");
    }

    @Override
    protected void onPreExecute() {
        super.onPreExecute();
    }

    @Override
    protected void onPostExecute(String s) {
        super.onPostExecute(s);
        if (sortOrder.equalsIgnoreCase("favorite")){

            listener.onFinished("", "favorite");
        }
        listener.onFinished(s, type);

    }

    @Override
    protected void onProgressUpdate(Void... values) {
        super.onProgressUpdate(values);
    }

    @Override
    protected String doInBackground(Void... params) {
        if (this.baseURL == null){
            throw new NullPointerException("BaseURL can't be null");
        }
        if (this.APIKey == null){
            throw new NullPointerException("APIKey can't be null");
        }

        // These two need to be declared outside the try/catch
        // so that they can be closed in the finally block.
        HttpURLConnection urlConnection = null;
        BufferedReader reader = null;

        // Will contain the raw JSON response as a string.
        String movieJsonStr = null;

        try {
            // Construct the URL for the OpenWeatherMap query
            // Possible parameters are avaiable at OWM's forecast API page, at
            // http://openweathermap.org/API#forecast

            if (sortOrder.equalsIgnoreCase("favorite")){
                return "";
            }

            String MOVIE_URL = this.baseURL + "?api_key=" + this.APIKey;
            if (shouldSort) {
                MOVIE_URL = this.baseURL + "/" + this.sortOrder + "?api_key=" + this.APIKey;
            }

            URL url = new URL(MOVIE_URL);

            // Create the request to OpenWeatherMap, and open the connection
            urlConnection = (HttpURLConnection) url.openConnection();
            urlConnection.setRequestMethod("GET");
            urlConnection.connect();

            // Read the input stream into a String
            InputStream inputStream = urlConnection.getInputStream();
            StringBuffer buffer = new StringBuffer();
            if (inputStream == null) {
                // Nothing to do.
                return null;
            }
            reader = new BufferedReader(new InputStreamReader(inputStream));

            String line;
            while ((line = reader.readLine()) != null) {
                // Since it's JSON, adding a newline isn't necessary (it won't affect parsing)
                // But it does make debugging a *lot* easier if you print out the completed
                // buffer for debugging.
                buffer.append(line + "\n");
            }

            if (buffer.length() == 0) {
                // Stream was empty.  No point in parsing.
                return null;
            }
            movieJsonStr = buffer.toString();
        } catch (IOException e) {
            Log.e(LOG_TAG, "Error ", e);
            // If the code didn't successfully get the weather data, there's no point in attemping
            // to parse it.
            return null;
        } finally {
            if (urlConnection != null) {
                urlConnection.disconnect();
            }
            if (reader != null) {
                try {
                    reader.close();
                } catch (final IOException e) {
                    Log.e(LOG_TAG, "Error closing stream", e);
                }
            }
        }

        return movieJsonStr;

    }
}


text:
layout: post
title: Hyku Beta Available -- How to Get Involved
author: Mike Giarlo, Hannah Frost
---

The Hydra-in-a-Box team is happy to announce the imminent availability of the Beta release of Hyku 1.0.0, the minimum viable product towards which we have been working for the past year. Hyku is a [Hyrax](http://hyr.ax/)-based application that adds:

 * Multi-tenancy, or the ability to host multiple repository "slices" within the same application, each with its own users, objects, and look & feel
 * Support for the [IIIF](http://iiif.io/) Image and Presentation APIs
 * Rich object viewing via the [Universal Viewer](http://universalviewer.io/)
 * Two bundled work types: Image and Generic Work
 * and more!

Now that the Beta is available, we'd like to solicit the Samvera community's assistance with testing the software to improve Hyku and to help define and prioritize our work for the remainder of the year. The Beta test is an opportunity to deploy the Hyku repository locally or in the cloud (Amazon Web Services), to "kick the tires," and to give the Hydra-in-a-Box team critical feedback on Hyku & its deployment options. We sought to develop a Samvera-based repository that is easy to install, easy to maintain, and easy to configure, and your feedback is crucial for helping us gauge how much progress we've made on these goals.

The Beta test is slated to run from Monday, May 15th through Friday, June 23rd.

Here's what is required of participants:

 1. [Register your interest](https://wiki.duraspace.org/display/hyku/Hyku+Beta+Test+Participant+Registration) in participating in the Beta test
 2. [Install Hyku](https://wiki.duraspace.org/display/hyku/Hyku+Product+Beta+Test) via one of three methods
 3. Use the Hyku application — you may find this [list of workflows](https://docs.google.com/document/d/1WUyYdbU4rCs6ZHRmhe2_SXvHSbv1fJ2M6Un32yck3s4/edit#heading=h.cn6rmmuv4enu) handy
 4. [Submit bugs and overall feedback](https://wiki.duraspace.org/display/hyku/Hyku+Beta+Test+-+Communications+and+Support)

We will be holding weekly office hours to support and interact with folks who participate in the Beta test. Details of our weekly calls are available on [our documentation wiki](https://wiki.duraspace.org/display/hyku/Hyku+Beta+Test+-+Communications+and+Support). To discuss Beta test results and engage throughout the Beta period, we have set up the #hyku-beta channel in the [Samvera Slack team](https://wiki.duraspace.org/pages/viewpage.action?pageId=43910187#Getintouch!-Slack).

For more information, please see our developing [Hyku documentation wiki](https://wiki.duraspace.org/display/hyku).


text:
layout: doc_page
title: "Apache Druid (incubating) Plumbers"
---

<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one
  ~ or more contributor license agreements.  See the NOTICE file
  ~ distributed with this work for additional information
  ~ regarding copyright ownership.  The ASF licenses this file
  ~ to you under the Apache License, Version 2.0 (the
  ~ "License"); you may not use this file except in compliance
  ~ with the License.  You may obtain a copy of the License at
  ~
  ~   http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing,
  ~ software distributed under the License is distributed on an
  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  ~ KIND, either express or implied.  See the License for the
  ~ specific language governing permissions and limitations
  ~ under the License.
  -->

# Apache Druid (incubating) Plumbers

The plumber handles generated segments both while they are being generated and when they are "done". This is also technically a pluggable interface and there are multiple implementations. However, plumbers handle numerous complex details, and therefore an advanced understanding of Druid is recommended before implementing your own.

Available Plumbers
------------------

#### YeOldePlumber

This plumber creates single historical segments.

#### RealtimePlumber

This plumber creates real-time/mutable segments.


text:
<dom-module id="tickets-block">
    <template>

Tickets

                    Codelabs (5/11)
                    5
                    €
                    *75 tickets, available until November 4

                    Conference (6/11)
                    5
                    €
                    *200 tickets, available until November 4

                    <paper-button class="white border-button open-dialog-button">Register</paper-button>

    </template>
</dom-module>


text:
package org.apache.camel.tests.typeconverterscan;

import org.apache.camel.CamelContext;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;

public class RouteTest extends CamelTestSupport {

    @Override
    protected CamelContext createCamelContext() throws Exception {
        CamelContext context = super.createCamelContext();
        // we use Camel 2.x style type converters
        context.setLoadTypeConverters(true);
        return context;
    }

    @Test
    public void testRoute() throws Exception {
        MockEndpoint resultEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class);
        resultEndpoint.expectedBodiesReceived(new MyBean("foo", "bar"));

        template.sendBody("direct:start", "foo:bar");

        resultEndpoint.assertIsSatisfied();
    }

    @Override
    protected RouteBuilder createRouteBuilder() {
        return new RouteBuilder() {
            public void configure() {
                from("direct:start").convertBodyTo(MyBean.class).to("mock:result");
            }
        };
    }

}


text:
<?php

namespace Flowr\AmulenSyncBundle\Event;

use Flowcode\DashboardBundle\Event\CollectSettingOptionsEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Translation\TranslatorInterface;

/**
 * CollectSettingOptionsSubscriber
 */
class CollectSettingOptionsSubscriber implements EventSubscriberInterface
{
    protected $translator;

    public function __construct(TranslatorInterface $translator)
    {
        $this->translator = $translator;
    }

    /**
     * Returns an array of event names this subscriber wants to listen to.
     *
     * @return array The event names to listen to
     */
    public static function getSubscribedEvents()
    {
        return array(
            CollectSettingOptionsEvent::NAME => array('handler', 1000),
        );
    }

    public function handler(CollectSettingOptionsEvent $event)
    {
        $event->addSettingOption([
            "key" => \Flowr\AmulenSyncBundle\Model\Setting::FLOWR_URL,
            "label" => $this->translator->trans('Flowr Url', [], 'FlowrAmulenSync'),
        ]);

        $event->addSettingOption([
            "key" => \Flowr\AmulenSyncBundle\Model\Setting::FLOWR_USERNAME,
            "label" => $this->translator->trans('Flowr Username', [], 'FlowrAmulenSync'),
        ]);

        $event->addSettingOption([
            "key" => \Flowr\AmulenSyncBundle\Model\Setting::FLOWR_PASSWORD,
            "label" => $this->translator->trans('Flowr Password', [], 'FlowrAmulenSync'),
        ]);

        $event->addSettingOption([
            "key" => \Flowr\AmulenSyncBundle\Model\Setting::FLOWR_CONTACT_SOURCE,
            "label" => $this->translator->trans('Contact Source', [], 'FlowrAmulenSync'),
        ]);

        $event->addSettingOption([
            "key" => \Flowr\AmulenSyncBundle\Model\Setting::FLOWR_SALES_SALE_CATEGORY,
            "label" => $this->translator->trans('Sale category', [], 'FlowrAmulenSync'),
        ]);

        $event->addSettingOption([
            "key" => \Flowr\AmulenSyncBundle\Model\Setting::FLOWR_SALES_SALE_POINT,
            "label" => $this->translator->trans('Sale point', [], 'FlowrAmulenSync'),
        ]);

        $event->addSettingOption([
            "key" => \Flowr\AmulenSyncBundle\Model\Setting::FLOWR_PRODUCTS_PRICE_LIST,
            "label" => $this->translator->trans('Product price list', [], 'FlowrAmulenSync'),
        ]);

        $event->addSettingOption([
            "key" => \Flowr\AmulenSyncBundle\Model\Setting::FLOWR_SERVICES_PRICE_LIST,
            "label" => $this->translator->trans('Service price list', [], 'FlowrAmulenSync'),
        ]);

    }
}


text:
<?php
/**
 * Created by PhpStorm.
 * User: bfday
 * Date: 21.12.2015
 * Time: 11:54
 */

namespace bfday\modules\payture\controllers;

use api\models\tech\Debug;
use Yii;
use bfday\modules\payture\Module;
use yii\web\Controller;

class NotificationsController extends Controller
{
    public $enableCsrfValidation = false;
    /**
     * Action that process notifications.
     */
    public function actionIndex()
    {
        /** process port notifications */
        if (Yii::$app->request->isPost) {
            $notification = Yii::$app->request->post();
            Module::getInstance()->processNotification($notification);
        }
        /** @var Module $payture */
        return 'ok';
    }
}


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

    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License.  You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.apache.camel</groupId>
        <artifactId>core</artifactId>
        <version>3.17.0-SNAPSHOT</version>
    </parent>

    <artifactId>camel-management-api</artifactId>
    <packaging>jar</packaging>

    <name>Camel :: Management API</name>
    <description>The Camel Management API</description>

    <properties>
        <firstVersion>3.0.0</firstVersion>
    </properties>

    <dependencies>

        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-util</artifactId>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>

        <!-- xmltokenizer using woodstox -->
        <dependency>
            <groupId>org.codehaus.woodstox</groupId>
            <artifactId>woodstox-core-asl</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <links>
                        <link>http://download.oracle.com/javase/7/docs/api/</link>
                        <link>http://download.oracle.com/javaee/7/api/</link>
                    </links>
                    <linksource>true</linksource>
                    <isOffline>${camel.javadoc.offline}</isOffline>
                    <maxmemory>256m</maxmemory>
                    <groups>
                        <group>
                            <title>Camel API</title>
                            <packages>org.apache.camel</packages>
                        </group>
                        <group>
                            <title>Fluent API (DSL) for building EIP rules</title>
                            <packages>org.apache.camel.builder:org.apache.camel.builder.*</packages>
                        </group>
                        <group>
                            <title>EIP model</title>
                            <packages>org.apache.camel.model:org.apache.camel.model.*</packages>
                        </group>
                        <group>
                            <title>Camel Components</title>
                            <packages>org.apache.camel.component:org.apache.camel.component.*</packages>
                        </group>
                        <group>
                            <title>Language APIs and plugins for Expressions and Predicates</title>
                            <packages>org.apache.camel.language:org.apache.camel.language.*</packages>
                        </group>
                        <group>
                            <title>Processors to implement the Enterprise Integration Patterns</title>
                            <packages>org.apache.camel.processor:org.apache.camel.processor.*</packages>
                        </group>
                        <group>
                            <title>Strategy APIs for implementors extending Camel</title>
                            <packages>org.apache.camel.spi</packages>
                        </group>
                        <group>
                            <title>Support APIs for implementors</title>
                            <packages>org.apache.camel.support:org.apache.camel.support.*</packages>
                        </group>
                        <group>
                            <title>Management (JMX) API</title>
                            <packages>
                                org.apache.camel.management:org.apache.camel.management.*:org.apache.camel.api.management.mbean
                            </packages>
                        </group>
                        <group>
                            <title>Camel Runtime</title>
                            <packages>org.apache.camel.impl:org.apache.camel.impl.*</packages>
                        </group>
                        <group>
                            <title>Camel Main to run Camel standalone</title>
                            <packages>org.apache.camel.main</packages>
                        </group>
                        <group>
                            <title>Type conversion helper classes</title>
                            <packages>org.apache.camel.converter:org.apache.camel.converter.*</packages>
                        </group>
                        <group>
                            <title>Utility classes</title>
                            <packages>org.apache.camel.util:org.apache.camel.util.*</packages>
                        </group>
                    </groups>
                </configuration>
            </plugin>
        </plugins>
    </reporting>

    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>package</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <links>
                                <link>http://download.oracle.com/javase/7/docs/api/</link>
                                <link>http://download.oracle.com/javaee/7/api/</link>
                            </links>
                            <linksource>true</linksource>
                            <maxmemory>256m</maxmemory>
                            <isOffline>${camel.javadoc.offline}</isOffline>
                            <groups>
                                <group>
                                    <title>Camel API</title>
                                    <packages>org.apache.camel</packages>
                                </group>
                                <group>
                                    <title>Fluent API (DSL) for building EIP rules</title>
                                    <packages>org.apache.camel.builder:org.apache.camel.builder.*</packages>
                                </group>
                                <group>
                                    <title>EIP model</title>
                                    <packages>org.apache.camel.model:org.apache.camel.model.*</packages>
                                </group>
                                <group>
                                    <title>Camel Components</title>
                                    <packages>org.apache.camel.component:org.apache.camel.component.*</packages>
                                </group>
                                <group>
                                    <title>Language APIs and plugins for Expressions and Predicates</title>
                                    <packages>org.apache.camel.language:org.apache.camel.language.*</packages>
                                </group>
                                <group>
                                    <title>Processors to implement the Enterprise Integration Patterns</title>
                                    <packages>org.apache.camel.processor:org.apache.camel.processor.*</packages>
                                </group>
                                <group>
                                    <title>Strategy APIs for implementors extending Camel</title>
                                    <packages>org.apache.camel.spi</packages>
                                </group>
                                <group>
                                    <title>Support APIs for implementors</title>
                                    <packages>org.apache.camel.support:org.apache.camel.support.*</packages>
                                </group>
                                <group>
                                    <title>Management (JMX) API</title>
                                    <packages>
                                        org.apache.camel.management:org.apache.camel.management.*:org.apache.camel.api.management.mbean
                                    </packages>
                                </group>
                                <group>
                                    <title>Camel Runtime</title>
                                    <packages>org.apache.camel.impl:org.apache.camel.impl.*</packages>
                                </group>
                                <group>
                                    <title>Camel Main to run Camel standalone</title>
                                    <packages>org.apache.camel.main</packages>
                                </group>
                                <group>
                                    <title>Type conversion helper classes</title>
                                    <packages>org.apache.camel.converter:org.apache.camel.converter.*</packages>
                                </group>
                                <group>
                                    <title>Utility classes</title>
                                    <packages>org.apache.camel.util:org.apache.camel.util.*</packages>
                                </group>
                            </groups>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>xalan</id>
            <dependencies>
                <!-- enable the Xalan processor -->
                <dependency>
                    <groupId>xalan</groupId>
                    <artifactId>xalan</artifactId>
                    <version>${xalan-version}</version>
                </dependency>
            </dependencies>
        </profile>
        <profile>
            <id>xerces</id>
            <dependencies>
                <!-- enable the xerces processor -->
                <dependency>
                    <groupId>xerces</groupId>
                    <artifactId>xercesImpl</artifactId>
                    <version>${xerces-version}</version>
                </dependency>
            </dependencies>
        </profile>
        <profile>
            <id>woodstox</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <dependencies>
                <!-- xmltokenizer using woodstox -->
                <dependency>
                    <groupId>org.codehaus.woodstox</groupId>
                    <artifactId>woodstox-core-asl</artifactId>
                    <scope>test</scope>
                </dependency>
            </dependencies>
        </profile>
    </profiles>
</project>


text:
layout: docs
title: Spinners
description: Indicate the loading state of a component or page with Bootstrap spinners, built entirely with HTML, CSS, and no JavaScript.
group: components
toc: true
---

## About

Bootstrap "spinners" can be used to show the loading state in your projects. They're built only with HTML and CSS, meaning you don't need any JavaScript to create them. You will, however, need some custom JavaScript to toggle their visibility. Their appearance, alignment, and sizing can be easily customized with our amazing utility classes.

For accessibility purposes, each loader here includes `role="status"` and `Loading...` text within. We account for this in our CSS, using a text hiding technique to prevent it from rendering on screen.

## Border spinner

Use the border spinners for a lightweight loading indicator.

{% capture example %}

Loading...

{% endcapture %}
{% include example.html content=example %}

### Colors

The border spinner uses `currentColor` for its `border-color`, meaning you can customize the color with [text color utilities][color]. You can use any of our text color utilities on the standard spinner.

{% capture example %}
{% for color in site.data.theme-colors %}

Loading...
{% endfor %}
{% endcapture %}
{% include example.html content=example %}

{% capture callout %}
**Why not use `border-color` utilities?** Each border spinner specifies a `transparent` border for at least one side, so `.border-{color}` utilities would override that.
{% endcapture %}
{% include callout.html content=callout type="info" %}

## Growing spinner

If you don't fancy a border spinner, switch to the grow spinner. While it doesn't technically spin, it does repeatedly grow!

{% capture example %}

Loading...

{% endcapture %}
{% include example.html content=example %}

Once again, this spinner is built with `currentColor`, so you can easily change its appearance with [text color utilities][color]. Here it is in blue, along with the supported variants.

{% capture example %}
{% for color in site.data.theme-colors %}

Loading...
{% endfor %}
{% endcapture %}
{% include example.html content=example %}

## Alignment

Spinners in Bootstrap are built with `rem`s, `currentColor`, and `display: inline-flex`. This means they can easily be resized, recolored, and quickly aligned.

### Margin

Use [margin utilities][margin] like `.m-5` for easy spacing.

{% capture example %}

Loading...

{% endcapture %}
{% include example.html content=example %}

### Placement

Use [flexbox utilities][flex], [float utilities][float], or [text alignment][text] utilities to place spinners exactly where you need them in any situation.

#### Flex

{% capture example %}

Loading...

{% endcapture %}
{% include example.html content=example %}

{% capture example %}

  Loading...

{% endcapture %}
{% include example.html content=example %}

#### Floats

{% capture example %}

Loading...

{% endcapture %}
{% include example.html content=example %}

#### Text align

{% capture example %}

Loading...

{% endcapture %}
{% include example.html content=example %}

## Size

Add `.spinner-border-sm` and `.spinner-grow-sm` to make a smaller spinner that can quickly be used within other components.

{% capture example %}

Loading...

Loading...

{% endcapture %}
{% include example.html content=example %}

Or, use custom CSS or inline styles to change the dimensions as needed.

{% capture example %}

Loading...

Loading...

{% endcapture %}
{% include example.html content=example %}

## Buttons

Use spinners within buttons to indicate an action is currently processing or taking place. You may also swap the text out of the spinner element and utilize button text as needed.

{% capture example %}
<button class="btn btn-primary" type="button" disabled>
  Loading...
</button>
<button class="btn btn-primary" type="button" disabled>

  Loading...
</button>
{% endcapture %}
{% include example.html content=example %}

{% capture example %}
<button class="btn btn-primary" type="button" disabled>
  Loading...
</button>
<button class="btn btn-primary" type="button" disabled>

  Loading...
</button>
{% endcapture %}
{% include example.html content=example %}

[color]:   {{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/colors/
[display]: {{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/display/
[flex]:    {{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/flex/
[float]:   {{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/float/
[margin]:  {{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/spacing/
[sizing]:  {{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/sizing/
[text]:    {{ site.baseurl }}/docs/{{ site.docs_version }}/content/typography/


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<artifactId>hystrixdemo</artifactId>
	<name>Hystrix Demo</name>
	<description>This is the practice tutorials for Hystrix.</description>
	<packaging>jar</packaging>
	<parent>
		<groupId>in.pabreja</groupId>
		<artifactId>tutorial</artifactId>
		<version>0.0.1-SNAPSHOT</version>
	</parent>
	<dependencies>
		<dependency>
			<groupId>com.netflix.hystrix</groupId>
			<artifactId>hystrix-core</artifactId>
		</dependency>
	</dependencies>
	<build>
		<plugins>
			<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.3</version>
				<configuration>
					<source>1.8</source>
					<target>1.8</target>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>


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

namespace RomanNumbersConverter.ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            string num = "MCMLXXXIX";

            int res = num.RomanToArabic();
            Console.WriteLine(res);

            int number = 1914;

            string roman = number.ToClassicRoman();

            Console.WriteLine(roman);

            Console.Read();
        }
    }
}


text:
package org.springframework.beans.propertyeditors;

import java.beans.PropertyEditorSupport;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;

/**
 * Property editor for Maps, converting any source Map
 * to a given target Map type.
 *
 * @author Juergen Hoeller
 * @since 2.0.1
 * @see java.util.Map
 * @see java.util.SortedMap
 */
public class CustomMapEditor extends PropertyEditorSupport {

	@SuppressWarnings("rawtypes")
	private final Class<? extends Map> mapType;

	private final boolean nullAsEmptyMap;

	/**
	 * Create a new CustomMapEditor for the given target type,
	 * keeping an incoming {@code null} as-is.
	 * @param mapType the target type, which needs to be a
	 * sub-interface of Map or a concrete Map class
	 * @see java.util.Map
	 * @see java.util.HashMap
	 * @see java.util.TreeMap
	 * @see java.util.LinkedHashMap
	 */
	@SuppressWarnings("rawtypes")
	public CustomMapEditor(Class<? extends Map> mapType) {
		this(mapType, false);
	}

	/**
	 * Create a new CustomMapEditor for the given target type.
	 *
If the incoming value is of the given type, it will be used as-is.
	 * If it is a different Map type or an array, it will be converted
	 * to a default implementation of the given Map type.
	 * If the value is anything else, a target Map with that single
	 * value will be created.
	 *
The default Map implementations are: TreeMap for SortedMap,
	 * and LinkedHashMap for Map.
	 * @param mapType the target type, which needs to be a
	 * sub-interface of Map or a concrete Map class
	 * @param nullAsEmptyMap ap whether to convert an incoming {@code null}
	 * value to an empty Map (of the appropriate type)
	 * @see java.util.Map
	 * @see java.util.TreeMap
	 * @see java.util.LinkedHashMap
	 */
	@SuppressWarnings("rawtypes")
	public CustomMapEditor(Class<? extends Map> mapType, boolean nullAsEmptyMap) {
		if (mapType == null) {
			throw new IllegalArgumentException("Map type is required");
		}
		if (!Map.class.isAssignableFrom(mapType)) {
			throw new IllegalArgumentException(
					"Map type [" + mapType.getName() + "] does not implement [java.util.Map]");
		}
		this.mapType = mapType;
		this.nullAsEmptyMap = nullAsEmptyMap;
	}

	/**
	 * Convert the given text value to a Map with a single element.
	 */
	@Override
	public void setAsText(String text) throws IllegalArgumentException {
		setValue(text);
	}

	/**
	 * Convert the given value to a Map of the target type.
	 */
	@Override
	public void setValue(Object value) {
		if (value == null && this.nullAsEmptyMap) {
			super.setValue(createMap(this.mapType, 0));
		}
		else if (value == null || (this.mapType.isInstance(value) && !alwaysCreateNewMap())) {
			// Use the source value as-is, as it matches the target type.
			super.setValue(value);
		}
		else if (value instanceof Map) {
			// Convert Map elements.
			Map<?, ?> source = (Map<?, ?>) value;
			Map<Object, Object> target = createMap(this.mapType, source.size());
			for (Map.Entry<?, ?> entry : source.entrySet()) {
				target.put(convertKey(entry.getKey()), convertValue(entry.getValue()));
			}
			super.setValue(target);
		}
		else {
			throw new IllegalArgumentException("Value cannot be converted to Map: " + value);
		}
	}

	/**
	 * Create a Map of the given type, with the given
	 * initial capacity (if supported by the Map type).
	 * @param mapType a sub-interface of Map
	 * @param initialCapacity the initial capacity
	 * @return the new Map instance
	 */
	@SuppressWarnings({ "rawtypes", "unchecked" })
	protected Map<Object, Object> createMap(Class<? extends Map> mapType, int initialCapacity) {
		if (!mapType.isInterface()) {
			try {
				return mapType.newInstance();
			}
			catch (Exception ex) {
				throw new IllegalArgumentException(
						"Could not instantiate map class [" + mapType.getName() + "]: " + ex.getMessage());
			}
		}
		else if (SortedMap.class == mapType) {
			return new TreeMap<Object, Object>();
		}
		else {
			return new LinkedHashMap<Object, Object>(initialCapacity);
		}
	}

	/**
	 * Return whether to always create a new Map,
	 * even if the type of the passed-in Map already matches.
	 *
Default is "false"; can be overridden to enforce creation of a
	 * new Map, for example to convert elements in any case.
	 * @see #convertKey
	 * @see #convertValue
	 */
	protected boolean alwaysCreateNewMap() {
		return false;
	}

	/**
	 * Hook to convert each encountered Map key.
	 * The default implementation simply returns the passed-in key as-is.
	 *
Can be overridden to perform conversion of certain keys,
	 * for example from String to Integer.
	 *
Only called if actually creating a new Map!
	 * This is by default not the case if the type of the passed-in Map
	 * already matches. Override {@link #alwaysCreateNewMap()} to
	 * enforce creating a new Map in every case.
	 * @param key the source key
	 * @return the key to be used in the target Map
	 * @see #alwaysCreateNewMap
	 */
	protected Object convertKey(Object key) {
		return key;
	}

	/**
	 * Hook to convert each encountered Map value.
	 * The default implementation simply returns the passed-in value as-is.
	 *
Can be overridden to perform conversion of certain values,
	 * for example from String to Integer.
	 *
Only called if actually creating a new Map!
	 * This is by default not the case if the type of the passed-in Map
	 * already matches. Override {@link #alwaysCreateNewMap()} to
	 * enforce creating a new Map in every case.
	 * @param value the source value
	 * @return the value to be used in the target Map
	 * @see #alwaysCreateNewMap
	 */
	protected Object convertValue(Object value) {
		return value;
	}

	/**
	 * This implementation returns {@code null} to indicate that
	 * there is no appropriate text representation.
	 */
	@Override
	public String getAsText() {
		return null;
	}

}


text:
import {IDbSchema} from "./dbschema";
import {DiscordStore} from "../../store";

export class Schema implements IDbSchema {
    public description = "create guild emoji table";
    public async run(store: DiscordStore): Promise<void> {
        await store.createTable(`
            CREATE TABLE guild_emoji (
                emoji_id TEXT NOT NULL,
                guild_id TEXT NOT NULL,
                name TEXT NOT NULL,
                mxc_url TEXT NOT NULL,
                created_at INTEGER NOT NULL,
                updated_at INTEGER NOT NULL,
                PRIMARY KEY(emoji_id, guild_id)
        );`, "guild_emoji");
    }

    public async rollBack(store: DiscordStore): Promise <void> {
        await store.db.Run(
            `DROP TABLE IF EXISTS guild_emoji;`,
        );
    }
}


text:
package owltools.gaf.parser;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;

import owltools.gaf.Bioentity;
import owltools.gaf.ExtensionExpression;
import owltools.gaf.GeneAnnotation;
import owltools.gaf.TaxonTools;

import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class BuilderTools {

	static String handleTaxonPrefix(String s) {
		if (s != null && !s.isEmpty()) {
			int colPos = s.indexOf(':');
			StringBuilder sb = new StringBuilder(TaxonTools.NCBI);
			if (colPos > 0) {
				sb.append(s.substring(colPos+1));
			}
			else {
				sb.append(s);
			}
			return sb.toString();
		}
		return s;
	}

	public static String removePrefix(String s, char marker) {
		int pos = s.indexOf(marker);
		if (pos > 0) {
			if ((pos + 1) < s.length()) {
				pos += 1;
			}
			return s.substring(pos);
		}
		return s;
	}

	static void addProperties(String s, Bioentity entity) {
		s = StringUtils.trimToNull(s);
		if (s != null) {
			String[] pairs = StringUtils.split(s, '|');
			for (String pairString : pairs) {
				String[] pair = StringUtils.split(pairString, "=", 2);
				if (pair.length == 2) {
					entity.addProperty(pair[0], pair[1]);
				}
			}
		}
	}

	static void addProperties(String s, GeneAnnotation ga) {
		s = StringUtils.trimToNull(s);
		if (s != null) {
			String[] pairs = StringUtils.split(s, '|');
			for (String pairString : pairs) {
				String[] pair = StringUtils.split(pairString, "=", 2);
				if (pair.length == 2) {
					ga.addProperty(pair[0], pair[1]);
				}
			}
		}
	}

	static void addXrefs(String s, Bioentity entity) {
		s = StringUtils.trimToNull(s);
		if (s != null) {
			String[] refs = StringUtils.split(s, '|');
			for (String ref : refs) {
				ref = StringUtils.trimToNull(ref);
				if (ref != null) {
					entity.addDbXref(ref);
				}
			}
		}
	}

	static void addXrefs(String s, GeneAnnotation ga) {
		s = StringUtils.trimToNull(s);
		if (s != null) {
			String[] refs = StringUtils.split(s, '|');
			for (String ref : refs) {
				ref = StringUtils.trimToNull(ref);
				if (ref != null) {
					ga.addReferenceId(ref);
				}
			}
		}
	}

	static void addSynonyms(String s, Bioentity entity) {
		s = StringUtils.trimToNull(s);
		if (s != null) {
			String[] synonyms = StringUtils.split(s, '|');
			for (String syn : synonyms) {
				syn = StringUtils.trimToNull(syn);
				if (syn != null) {
					entity.addSynonym(syn);
				}
			}
		}
	}

	/**
	 * Parse the string into a collection of with strings
	 *
	 * @param withInfoString
	 * @return collection, never null
	 */
	public static Collection<String> parseWithInfo(final String withInfoString){
		Collection<String> infos = Collections.emptySet();
		if(withInfoString.length()>0){
			infos = new ArrayList<String>();
			String tokens[] = withInfoString.split("[\\||,]");
			for(String token: tokens){
				infos.add(token);
			}
		}
		return infos;
	}

	/**
	 * Parse the string into a list of qualifier strings
	 *
	 * @param qualifierString
	 * @return collection, never null
	 */
	private static List<String> parseCompositeQualifier(String qualifierString){
		List<String> qualifiers = Collections.emptyList();
		if(qualifierString.length()>0){
			qualifiers = new ArrayList<String>();
			String tokens[] = qualifierString.split("[\\||,]");
			for(String token: tokens){
				qualifiers.add(StringUtils.trim(token));
			}
		}
		return qualifiers;
	}

	private static enum WithColumnData {

		contributesTo("contributes_to", "(contributes[_ ]to)"),
		colocalizesWith("colocalizes_with", "colocali[zs]es[_ ]with"),
		integralTo("integral_to", "integral[_ ]to"),
		not("NOT", "not"),
		cut("CUT", "cut");

		final String directMatch;
		final Pattern relaxedPattern;

		WithColumnData(String directMatch, String relaxedPattern) {
			this.directMatch = directMatch;
			this.relaxedPattern = Pattern.compile(relaxedPattern, Pattern.CASE_INSENSITIVE);
		}

		boolean matches(String qualifier, AnnotationParserMessages reporter) {
			if (qualifier.equals(directMatch)) {
				return true;
			}
			Matcher matcher = relaxedPattern.matcher(qualifier);
			if (matcher.find()) {
				String group = matcher.group();
				reporter.fireParsingWarning("Repairing qualifier '"+directMatch+"' from: "+group);
				return true;
			}
			return false;
		}
	}

	public static void parseQualifiers(GeneAnnotation ga, String qualifierString, AnnotationParserMessages reporter) {
		List<String> qualifiers = parseCompositeQualifier(qualifierString);
		List<String> unusedQualifiers = new ArrayList<String>();
		for (String qualifier : qualifiers) {
			boolean used = false;
			if (WithColumnData.contributesTo.matches(qualifier, reporter)) {
				if (ga.isContributesTo()) {
					reporter.fireParsingWarning("Duplicate qualifier: "+qualifier);
				}
				ga.setIsContributesTo(true);
				used = true;
			}
			else if (WithColumnData.colocalizesWith.matches(qualifier, reporter)) {
				if (ga.isColocatesWith()) {
					reporter.fireParsingWarning("Duplicate qualifier: "+qualifier);
				}
				ga.setIsColocatesWith(true);
				used = true;
			}
			else if (WithColumnData.integralTo.matches(qualifier, reporter)) {
				if (ga.isIntegralTo()) {
					reporter.fireParsingWarning("Duplicate qualifier: "+qualifier);
				}
				ga.setIsIntegralTo(true);
				used = true;
			}
			else if (WithColumnData.not.matches(qualifier, reporter)) {
				if (ga.isNegated()) {
					reporter.fireParsingWarning("Duplicate qualifier: "+qualifier);
				}
				ga.setIsNegated(true);
				used = true;
			}
			else if (WithColumnData.cut.matches(qualifier, reporter)) {
				if (ga.isCut()) {
					reporter.fireParsingWarning("Duplicate qualifier: "+qualifier);
				}
				ga.setIsCut(true);
				used = true;
			}
			if (used == false) {
				unusedQualifiers.add(qualifier);
			}
		}
		for (String unused : unusedQualifiers) {
			reporter.fireParsingError("Unknown qualifier: "+unused);
		}
	}

	public static Pair<String, String> parseTaxonRelationshipPair(String source) {
		source = StringUtils.trimToNull(source);
		if (source != null) {
			int open = source.indexOf('(');
			if (open > 0) {
				int close = source .indexOf(')', open);
				if (close > 0) {
					String rel = StringUtils.trimToNull(source.substring(0, open));
					String tax = StringUtils.trimToNull(source.substring(open+1, close));
					if (tax != null && rel != null) {
						return Pair.of(tax, rel);
					}
				}
			}
			else {
				return Pair.<String, String>of(source, null);
			}

		}
		return null;
	}

	/**
	 * @param extensionExpressionString
	 * @return list, never null
	 */
	public static List<List<ExtensionExpression>> parseExtensionExpression(String extensionExpressionString){
		List<List<ExtensionExpression>> groupedExpressions = Collections.emptyList();
		if(extensionExpressionString != null && extensionExpressionString.length() > 0){
			// first split by '|' to get groups
			String[] groups = StringUtils.split(extensionExpressionString, '|');
			groupedExpressions = new ArrayList<List<ExtensionExpression>>(groups.length);
			for (int i = 0; i < groups.length; i++) {
				// split by ',' to get individual entries
				String[] expressionStrings = StringUtils.split(groups[i], ',');
				List<ExtensionExpression> expressions = new ArrayList<ExtensionExpression>(expressionStrings.length);
				for (int j = 0; j < expressionStrings.length; j++) {
					String token = expressionStrings[j];
					int index = token.indexOf("(");
					if(index > 0){
						String relation = token.substring(0, index);
						String cls = token.substring(index+1, token.length()-1);
						expressions.add(new ExtensionExpression(relation, cls));
					}
				}
				if (expressions.isEmpty() == false) {
					groupedExpressions.add(expressions);
				}
			}
			if (groupedExpressions.isEmpty()) {
				groupedExpressions = Collections.emptyList();
			}
		}
		return groupedExpressions;
	}

	public static String buildExtensionExpression(List<List<ExtensionExpression>> groupedExpressions) {
		StringBuilder sb = new StringBuilder();
		if (groupedExpressions != null && !groupedExpressions.isEmpty()) {
			for (List<ExtensionExpression> group : groupedExpressions) {
				if (sb.length() > 0) {
					sb.append('|');
				}
				for (int i = 0; i < group.size(); i++) {
					ExtensionExpression expression = group.get(i);
					if (i > 0) {
						sb.append(',');
					}
					sb.append(expression.getRelation()).append('(').append(expression.getCls()).append(')');
				}
			}
		}
		return sb.toString();
	}

	public static String buildPropertyExpression(List<Pair<String, String>> properties) {
		if (properties != null) {
			StringBuilder sb = new StringBuilder();
			for (Pair<String, String> pair : properties) {
				if (sb.length() > 0) {
					sb.append('|');
				}
				sb.append(pair.getLeft()).append('=').append(pair.getRight());
			}
			return sb.toString();
		}
		return null;
	}

	public static String buildTaxonString(String bioEntityTaxon, Pair<String, String> actsOnTaxonRelPair) {
		StringBuilder sb = new StringBuilder();
		if (bioEntityTaxon != null) {
			sb.append("taxon:").append(removePrefix(bioEntityTaxon, ':'));
		}
		if (actsOnTaxonRelPair != null) {
			if (sb.length() > 0) {
				sb.append('|');
			}
			String taxId = "taxon:"+removePrefix(actsOnTaxonRelPair.getLeft(), ':');
			String rel = actsOnTaxonRelPair.getRight();
			sb.append(rel).append("(").append(taxId).append(")");
		}
		if (sb.length() > 0) {
			return sb.toString();
		}
		return null;
	}

	public static String buildTaxonString(Pair<String, String> taxonRelPair) {
		if (taxonRelPair != null) {
			String taxId = "taxon:"+removePrefix(taxonRelPair.getLeft(), ':');
			String rel = taxonRelPair.getRight();
			if (rel != null) {
				return rel+"("+taxId+")";
			}
			return taxId;
		}
		return null;
	}

	public static String buildWithString(Collection<String> withInfos) {
		return buildWithString(withInfos, null);
	}

	public static String buildWithString(Collection<String> withInfos, String defaultString) {
		if (withInfos != null && !withInfos.isEmpty()) {
			return StringUtils.join(withInfos, '|');
		}
		return defaultString;
	}

//	public static String buildQualifierString(List<String> qualifierList) {
//		if (qualifierList != null && !qualifierList.isEmpty()) {
//			return StringUtils.join(qualifierList, '|');
//		}
//		return null;
//	}

	public static String buildGafQualifierString(GeneAnnotation ann) {
		StringBuilder sb = new StringBuilder();
		if (ann.isNegated()) {
			sb.append("NOT");
		}
		if (ann.isContributesTo()) {
			if (sb.length() > 0) {
				sb.append('|');
			}
			sb.append("contributes_to");
		}
		if (ann.isColocatesWith()) {
			if (sb.length() > 0) {
				sb.append('|');
			}
			sb.append("colocates_with");
		}
		if (ann.isIntegralTo()) {
			if (sb.length() > 0) {
				sb.append('|');
			}
			sb.append("integral_to");
		}
		if (ann.isCut()) {
			if (sb.length() > 0) {
				sb.append('|');
			}
			sb.append("CUT");
		}
		return sb.toString();
	}

	public static String buildGpadQualifierString(GeneAnnotation ann) {
		LinkedHashSet<String> qualifiers = new LinkedHashSet<String>();
		if (ann.isNegated()) {
			qualifiers.add("NOT");
		}
		String rel = ann.getRelation();
		if (ann.getRelation() != null) {
			qualifiers.add(rel);
		}
		if (ann.isContributesTo()) {
			qualifiers.add("contributes_to");
		}
		if (ann.isColocatesWith()) {
			qualifiers.add("colocates_with");
		}
		if (ann.isIntegralTo()) {
			qualifiers.add("integral_to");
		}
		if (ann.isCut()) {
			qualifiers.add("CUT");
		}
		if (qualifiers.isEmpty()) {
			return null;
		}
	return StringUtils.join(qualifiers, '|');
	}

	public static String buildReferenceIdsString(List<String> referenceIds) {
		if (referenceIds != null && !referenceIds.isEmpty()) {
			return StringUtils.join(referenceIds, '|');
		}
		return null;
	}
}


text:
title: "RBAC"
product: "Sensu Enterprise Dashboard"
version: "2.16"
weight: 1
layout: "base-for-directory-listing"
menu:
  sensu-enterprise-dashboard-2.16:
    identifier: rbac
---

{{< directoryListing >}}


text:
static CGFloat degreesToRadians(CGFloat degrees) { return (degrees) / 180.0 * M_PI; };

@implementation DGActivityIndicatorRotatingSquaresAnimation

#pragma mark -
#pragma mark DGActivityIndicatorAnimation Protocol

- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
    NSTimeInterval beginTime = CACurrentMediaTime();

    CGFloat squareSize = floor(size.width / 4.0f);

    CGFloat oX = (layer.bounds.size.width - size.width) / 2.0f;
    CGFloat oY = (layer.bounds.size.height - size.height) / 2.0f;
    for (int i = 0; i < 2; i++) {
        CALayer *square = [CALayer layer];
        square.frame = CGRectMake(oX, oY, squareSize, squareSize);
        square.anchorPoint = CGPointMake(0.5f, 0.5f);
        square.backgroundColor = tintColor.CGColor;
        square.shouldRasterize = YES;
        square.rasterizationScale = [[UIScreen mainScreen] scale];

        CAKeyframeAnimation *transformAnimation = [self createKeyframeAnimationWithKeyPath:@"transform"];
        transformAnimation.duration = 1.6f;
        transformAnimation.beginTime = beginTime - (i * transformAnimation.duration / 2.0f);
        transformAnimation.repeatCount = HUGE_VALF;

        transformAnimation.keyTimes = @[@(0.0f), @(0.25f), @(0.50f), @(0.75f), @(1.0f)];
        transformAnimation.timingFunctions = @[[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut],
                                               [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut],
                                               [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut],
                                               [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut],
                                               [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];

        CATransform3D t1 = CATransform3DMakeTranslation(size.width - squareSize, 0.0f, 0.0f);
        t1 = CATransform3DRotate(t1, degreesToRadians(-90.0f), 0.0f, 0.0f, 1.0f);
        t1 = CATransform3DScale(t1, 0.5f, 0.5f, 1.0f);

        CATransform3D t2 = CATransform3DMakeTranslation(size.width - squareSize, size.height - squareSize, 0.0f);
        t2 = CATransform3DRotate(t2, degreesToRadians(-180.0f), 0.0f, 0.0f, 1.0f);
        t2 = CATransform3DScale(t2, 1.0, 1.0, 1.0f);

        CATransform3D t3 = CATransform3DMakeTranslation(0.0f, size.height - squareSize, 0.0f);
        t3 = CATransform3DRotate(t3, degreesToRadians(-270.0f), 0.0f, 0.0f, 1.0f);
        t3 = CATransform3DScale(t3, 0.5f, 0.5f, 1.0f);

        CATransform3D t4 = CATransform3DMakeTranslation(0.0f, 0.0f, 0.0f);
        t4 = CATransform3DRotate(t4, degreesToRadians(-360.0f), 0.0f, 0.0f, 1.0f);
        t4 = CATransform3DScale(t4, 1.0, 1.0, 1.0f);

        transformAnimation.values = @[[NSValue valueWithCATransform3D:CATransform3DIdentity],
                                      [NSValue valueWithCATransform3D:t1],
                                      [NSValue valueWithCATransform3D:t2],
                                      [NSValue valueWithCATransform3D:t3],
                                      [NSValue valueWithCATransform3D:t4]];

        [layer addSublayer:square];
        [square addAnimation:transformAnimation forKey:@"animation"];
    }
}

@end


text:
using base::android::ScopedJavaLocalRef;

namespace content {

// static
bool ContentViewRenderView::RegisterContentViewRenderView(JNIEnv* env) {
  return RegisterNativesImpl(env);
}

ContentViewRenderView::ContentViewRenderView(JNIEnv* env,
                                             jobject obj,
                                             gfx::NativeWindow root_window)
    : buffers_swapped_during_composite_(false),
      root_window_(root_window) {
  java_obj_.Reset(env, obj);
}

ContentViewRenderView::~ContentViewRenderView() {
}

// static
static jlong Init(JNIEnv* env, jobject obj, jlong native_root_window) {
  gfx::NativeWindow root_window =
      reinterpret_cast<gfx::NativeWindow>(native_root_window);
  ContentViewRenderView* content_view_render_view =
      new ContentViewRenderView(env, obj, root_window);
  return reinterpret_cast<intptr_t>(content_view_render_view);
}

void ContentViewRenderView::Destroy(JNIEnv* env, jobject obj) {
  delete this;
}

void ContentViewRenderView::SetCurrentContentView(
    JNIEnv* env, jobject obj, int native_content_view) {
  InitCompositor();
  ContentViewCoreImpl* content_view =
      reinterpret_cast<ContentViewCoreImpl*>(native_content_view);
  if (content_view)
    compositor_->SetRootLayer(content_view->GetLayer());
  else
    compositor_->SetRootLayer(cc::Layer::Create());
}

void ContentViewRenderView::SurfaceCreated(
    JNIEnv* env, jobject obj, jobject jsurface) {
  InitCompositor();
  compositor_->SetSurface(jsurface);
}

void ContentViewRenderView::SurfaceDestroyed(JNIEnv* env, jobject obj) {
  compositor_->SetSurface(NULL);
}

void ContentViewRenderView::SurfaceSetSize(
    JNIEnv* env, jobject obj, jint width, jint height) {
  compositor_->SetWindowBounds(gfx::Size(width, height));
}

jboolean ContentViewRenderView::Composite(JNIEnv* env, jobject obj) {
  if (!compositor_)
    return false;

  buffers_swapped_during_composite_ = false;
  compositor_->Composite();
  return buffers_swapped_during_composite_;
}

jboolean ContentViewRenderView::CompositeToBitmap(JNIEnv* env, jobject obj,
                                                  jobject java_bitmap) {
  gfx::JavaBitmap bitmap(java_bitmap);
  if (!compositor_ || bitmap.format() != ANDROID_BITMAP_FORMAT_RGBA_8888)
    return false;
  return compositor_->CompositeAndReadback(bitmap.pixels(),
                                           gfx::Rect(bitmap.size()));
}

void ContentViewRenderView::ScheduleComposite() {
  JNIEnv* env = base::android::AttachCurrentThread();
  Java_ContentViewRenderView_requestRender(env, java_obj_.obj());
}

void ContentViewRenderView::OnSwapBuffersPosted() {
  buffers_swapped_during_composite_ = true;
}

void ContentViewRenderView::OnSwapBuffersCompleted() {
  JNIEnv* env = base::android::AttachCurrentThread();
  Java_ContentViewRenderView_onSwapBuffersCompleted(env, java_obj_.obj());
}

void ContentViewRenderView::InitCompositor() {
  if (!compositor_)
    compositor_.reset(Compositor::Create(this, root_window_));
}

}  // namespace content


text:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    xmlns:dpv="http://schemas.android.com/apk/res-auto"
    android:id="@+id/item_back"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center_vertical"
    android:layout_marginBottom="50dp"
    android:layout_marginTop="70dp"
    android:gravity="center"
    android:orientation="vertical"
    android:transitionName="back"
    card_view:cardCornerRadius="4dp"
    card_view:cardElevation="6sp"

    card_view:cardUseCompatPadding="true">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:paddingBottom="0dp"
        android:paddingTop="40dp"
        android:weightSum="10">

        <TextView
            android:id="@+id/text"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="3"
            android:paddingEnd="16dp"
            android:paddingStart="16dp"
            android:text="Version XXX"
            android:textSize="32sp"
            android:textStyle="bold" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:paddingEnd="16dp"
            android:paddingStart="16dp"
            android:paddingTop="7dp"
            android:text="@string/whats_new"
            android:textColor="@color/accent"
            android:textSize="20sp"
            android:textStyle="bold" />

        <TextView
            android:id="@+id/changelog"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:paddingBottom="15dp"
            android:paddingEnd="16dp"
            android:paddingStart="16dp"
            android:text="Changelog goes here take a few lines \n second feature goes here wow bitch\n New ui an stsuff like this \n some more... goes here \n hey let's get this party started \n just writing a few more lines"
            android:textSize="15sp" />

        <com.panwrona.downloadprogressbar.library.DownloadProgressBar
            android:id="@+id/download"
            android:layout_width="70dp"
            android:layout_height="56dp"
            android:layout_gravity="center_horizontal"
            android:layout_weight="8"
            dpv:circleBackgroundColor="@color/colorPrimary"
            dpv:circleRadius="24dp"
            dpv:drawingColor="@color/colorPrimary"
            dpv:lineWidth="3dp"
            dpv:overshootValue="2.5"
            dpv:progressBackgroundColor="@android:color/darker_gray"
            dpv:progressColor="@color/colorPrimary"
            dpv:progressDuration="2000"
            dpv:resultDuration="5000"
            dpv:strokeWidth="3dp" />
    </LinearLayout>
</android.support.v7.widget.CardView>


text:
{% extends 'is_core/base.html' %}
{% load forms static i18n %}

{% block title %}{% trans 'Login' %}{% endblock %}

{% block body %}
{% block sticky-flash %}{{ block.super }}{% endblock %}

{% trans 'Please Sign In' %}

{% trans 'Fill your credentials' %}

            {% form_renderer form template="is_core/forms/login_form.html" class_attr='login-form' id_attr='login-form' %}
              {% block below-login-form %}{% endblock %}

{% endblock %}


text:
package org.multibit.commons.concurrent;

import java.util.concurrent.*;

/**
 *
Wrapper to provide standard exception handling

 *
 * @since 0.0.1
 *
 */
public class SafeThreadPoolExecutor extends ThreadPoolExecutor {

  public SafeThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue) {
    super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue);
  }

  public SafeThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, RejectedExecutionHandler handler) {
    super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, handler);
  }

  public SafeThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory) {
    super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory);
  }

  public SafeThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory, RejectedExecutionHandler handler) {
    super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory, handler);
  }

  @Override
  protected void afterExecute(Runnable r, Throwable t) {
    super.afterExecute(r, t);
    if (t == null && r instanceof Future<?>) {
      try {
        Future<?> future = (Future<?>) r;
        if (future.isDone()) {
          future.get();
        }
      } catch (CancellationException | ExecutionException ce) {
        // Do nothing - the ListenableFuture will take care of it
      } catch (InterruptedException ie) {
        // Shutdown occurring
        Thread.currentThread().interrupt();
      }
    }

    // We rely on ListenableFuture to handle exceptions from executors

  }

}


text:
layout: null
title: "Clock"
---

  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <title>{{ page.title }}</title>

  <meta name="author" content="{{ site.author.name }}" />
  <meta name="description" content="{{ site.description }}" />
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

  <link href='//fonts.googleapis.com/css?family=Open+Sans:400,300' rel='stylesheet' type='text/css'>

  <link rel="apple-touch-icon" href="/apple-touch-icon.jpg" />


text:
#nullable disable
using PasPasPas.Globals.Parsing;

namespace PasPasPas.Parsing.SyntaxTree.Standard {

    /// <summary>
    ///     label declaration
    /// </summary>
    public class LabelSymbol : StandardSyntaxTreeBase {

        /// <summary>
        ///     create a new label
        /// </summary>
        /// <param name="name"></param>
        /// <param name="comma"></param>
        public LabelSymbol(SyntaxPartBase name, Terminal comma) {
            LabelName = name;
            Comma = comma;
        }

        /// <summary>
        ///     label name
        /// </summary>
        public SyntaxPartBase LabelName { get; }

        /// <summary>
        ///     comma
        /// </summary>
        public Terminal Comma { get; }

        /// <summary>
        ///     accept visitor
        /// </summary>
        /// <param name="visitor">visitor</param>
        public override void Accept(IStartEndVisitor visitor) {
            visitor.StartVisit(this);
            AcceptPart(this, LabelName, visitor);
            AcceptPart(this, Comma, visitor);
            visitor.EndVisit(this);
        }

        /// <summary>
        ///     symbol length
        /// </summary>
        public override int Length
            => LabelName.GetSymbolLength() + Comma.GetSymbolLength();

    }
}


text:
from dask.async import get_sync
from dask.callbacks import Callback

def test_start_callback():
    flag = [False]

    class MyCallback(Callback):
        def _start(self, dsk):
            flag[0] = True

    with MyCallback():
        get_sync({'x': 1}, 'x')

    assert flag[0] is True

def test_start_state_callback():
    flag = [False]

    class MyCallback(Callback):
        def _start_state(self, dsk, state):
            flag[0] = True
            assert dsk['x'] == 1
            assert len(state['cache']) == 1

    with MyCallback():
        get_sync({'x': 1}, 'x')

    assert flag[0] is True