text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>R.color</title>
<meta name="date" content="2014-10-25">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

com.pvsagar.smartlockscreen

Class R.color

java.lang.Object

com.pvsagar.smartlockscreen.R.color

Enclosing class:

R

public static final class R.color
extends java.lang.Object

Field Summary

Fields

Modifier and Type
Field and Description

static int
abc_background_cache_hint_selector_material_dark

static int
abc_background_cache_hint_selector_material_light

static int
abc_input_method_navigation_guard

static int
abc_primary_text_disable_only_material_dark

static int
abc_primary_text_disable_only_material_light

static int
abc_primary_text_material_dark

static int
abc_primary_text_material_light

static int
abc_search_url_text

static int
abc_search_url_text_normal

static int
abc_search_url_text_pressed

static int
abc_search_url_text_selected

static int
abc_secondary_text_material_dark

static int
abc_secondary_text_material_light

static int
accent_material_dark

static int
accent_material_light

static int
action_bar_add_environment

static int
action_bar_edit_environment

static int
action_bar_location

static int
action_bar_location_search

static int
action_bar_settings

static int
action_bar_setup

static int
action_bar_unused1

static int
action_bar_unused2

static int
action_bar_unused3

static int
action_bar_unused4

static int
action_mode

static int
background_floating_material_dark

static int
background_floating_material_light

static int
background_material_dark

static int
background_material_light

static int
bright_foreground_disabled_material_dark

static int
bright_foreground_disabled_material_light

static int
bright_foreground_inverse_material_dark

static int
bright_foreground_inverse_material_light

static int
bright_foreground_material_dark

static int
bright_foreground_material_light

static int
button_material_dark

static int
button_material_light

static int
card_activated

static int
card_activated_kitkat

static int
card_background

static int
card_background_grey

static int
card_background_header

static int
card_background_with_alpha

static int
card_backgroundExpand

static int
card_base_cardwithlist_background_list_color

static int
card_base_cardwithlist_divider_color

static int
card_expand_title_color

static int
card_foreground_activated

static int
card_foreground_activated_kitkat

static int
card_pressed

static int
card_pressed_kitkat

static int
card_section_container_color

static int
card_section_title_color

static int
card_text_color_header

static int
cardview_dark_background

static int
cardview_light_background

static int
cardview_shadow_end_color

static int
cardview_shadow_start_color

static int
common_action_bar_splitter

static int
common_signin_btn_dark_text_default

static int
common_signin_btn_dark_text_disabled

static int
common_signin_btn_dark_text_focused

static int
common_signin_btn_dark_text_pressed

static int
common_signin_btn_default_background

static int
common_signin_btn_light_text_default

static int
common_signin_btn_light_text_disabled

static int
common_signin_btn_light_text_focused

static int
common_signin_btn_light_text_pressed

static int
common_signin_btn_text_dark

static int
common_signin_btn_text_light

static int
dim_foreground_disabled_material_dark

static int
dim_foreground_disabled_material_light

static int
dim_foreground_material_dark

static int
dim_foreground_material_light

static int
highlighted_text_material_dark

static int
highlighted_text_material_light

static int
hint_foreground_material_dark

static int
hint_foreground_material_light

static int
link_text_material_dark

static int
link_text_material_light

static int
list_item_touched

static int
material_blue_grey_800

static int
material_blue_grey_900

static int
material_blue_grey_950

static int
material_deep_teal_200

static int
material_deep_teal_500

static int
nav_bar_add_new_profile_background

static int
nav_bar_list_background

static int
nav_bar_main_item_background

static int
primary_dark_material_dark

static int
primary_dark_material_light

static int
primary_material_dark

static int
primary_material_light

static int
primary_text_default_material_dark

static int
primary_text_default_material_light

static int
primary_text_disabled_material_dark

static int
primary_text_disabled_material_light

static int
ripple_material_dark

static int
ripple_material_light

static int
secondary_text_default_material_dark

static int
secondary_text_default_material_light

static int
secondary_text_disabled_material_dark

static int
secondary_text_disabled_material_light

static int
switch_color

static int
switch_thumb_normal_material_dark

static int
switch_thumb_normal_material_light

static int
text_view_touched

static int
text_view_touched_darker

static int
user_pic_background1

static int
user_pic_background2

static int
user_pic_background3

static int
user_pic_background4

static int
user_pic_background5

static int
user_pic_background6

static int
user_pic_background7

static int
user_pic_background8

static int
user_profiles_background

static int
wallet_bright_foreground_disabled_holo_light

static int
wallet_bright_foreground_holo_dark

static int
wallet_bright_foreground_holo_light

static int
wallet_dim_foreground_disabled_holo_dark

static int
wallet_dim_foreground_holo_dark

static int
wallet_dim_foreground_inverse_disabled_holo_dark

static int
wallet_dim_foreground_inverse_holo_dark

static int
wallet_highlighted_text_holo_dark

static int
wallet_highlighted_text_holo_light

static int
wallet_hint_foreground_holo_dark

static int
wallet_hint_foreground_holo_light

static int
wallet_holo_blue_light

static int
wallet_link_text_light

static int
wallet_primary_text_holo_light

static int
wallet_secondary_text_holo_dark

Constructor Summary

Constructors

Constructor and Description

R.color()

Method Summary

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail

abc_background_cache_hint_selector_material_dark

public static final int abc_background_cache_hint_selector_material_dark

See Also:

Constant Field Values

abc_background_cache_hint_selector_material_light

public static final int abc_background_cache_hint_selector_material_light

See Also:

Constant Field Values

abc_input_method_navigation_guard

public static final int abc_input_method_navigation_guard

See Also:

Constant Field Values

abc_primary_text_disable_only_material_dark

public static final int abc_primary_text_disable_only_material_dark

See Also:

Constant Field Values

abc_primary_text_disable_only_material_light

public static final int abc_primary_text_disable_only_material_light

See Also:

Constant Field Values

abc_primary_text_material_dark

public static final int abc_primary_text_material_dark

See Also:

Constant Field Values

abc_primary_text_material_light

public static final int abc_primary_text_material_light

See Also:

Constant Field Values

abc_search_url_text

public static final int abc_search_url_text

See Also:

Constant Field Values

abc_search_url_text_normal

public static final int abc_search_url_text_normal

See Also:

Constant Field Values

abc_search_url_text_pressed

public static final int abc_search_url_text_pressed

See Also:

Constant Field Values

abc_search_url_text_selected

public static final int abc_search_url_text_selected

See Also:

Constant Field Values

abc_secondary_text_material_dark

public static final int abc_secondary_text_material_dark

See Also:

Constant Field Values

abc_secondary_text_material_light

public static final int abc_secondary_text_material_light

See Also:

Constant Field Values

accent_material_dark

public static final int accent_material_dark

See Also:

Constant Field Values

accent_material_light

public static final int accent_material_light

See Also:

Constant Field Values

action_bar_add_environment

public static final int action_bar_add_environment

See Also:

Constant Field Values

action_bar_edit_environment

public static final int action_bar_edit_environment

See Also:

Constant Field Values

action_bar_location

public static final int action_bar_location

See Also:

Constant Field Values

action_bar_location_search

public static final int action_bar_location_search

See Also:

Constant Field Values

action_bar_settings

public static final int action_bar_settings

See Also:

Constant Field Values

action_bar_setup

public static final int action_bar_setup

See Also:

Constant Field Values

action_bar_unused1

public static final int action_bar_unused1

See Also:

Constant Field Values

action_bar_unused2

public static final int action_bar_unused2

See Also:

Constant Field Values

action_bar_unused3

public static final int action_bar_unused3

See Also:

Constant Field Values

action_bar_unused4

public static final int action_bar_unused4

See Also:

Constant Field Values

action_mode

public static final int action_mode

See Also:

Constant Field Values

background_floating_material_dark

public static final int background_floating_material_dark

See Also:

Constant Field Values

background_floating_material_light

public static final int background_floating_material_light

See Also:

Constant Field Values

background_material_dark

public static final int background_material_dark

See Also:

Constant Field Values

background_material_light

public static final int background_material_light

See Also:

Constant Field Values

bright_foreground_disabled_material_dark

public static final int bright_foreground_disabled_material_dark

See Also:

Constant Field Values

bright_foreground_disabled_material_light

public static final int bright_foreground_disabled_material_light

See Also:

Constant Field Values

bright_foreground_inverse_material_dark

public static final int bright_foreground_inverse_material_dark

See Also:

Constant Field Values

bright_foreground_inverse_material_light

public static final int bright_foreground_inverse_material_light

See Also:

Constant Field Values

bright_foreground_material_dark

public static final int bright_foreground_material_dark

See Also:

Constant Field Values

bright_foreground_material_light

public static final int bright_foreground_material_light

See Also:

Constant Field Values

button_material_dark

public static final int button_material_dark

See Also:

Constant Field Values

button_material_light

public static final int button_material_light

See Also:

Constant Field Values

card_activated

public static final int card_activated

See Also:

Constant Field Values

card_activated_kitkat

public static final int card_activated_kitkat

See Also:

Constant Field Values

card_background

public static final int card_background

See Also:

Constant Field Values

card_backgroundExpand

public static final int card_backgroundExpand

See Also:

Constant Field Values

card_background_grey

public static final int card_background_grey

See Also:

Constant Field Values

card_background_header

public static final int card_background_header

See Also:

Constant Field Values

card_background_with_alpha

public static final int card_background_with_alpha

See Also:

Constant Field Values

card_base_cardwithlist_background_list_color

public static final int card_base_cardwithlist_background_list_color

See Also:

Constant Field Values

card_base_cardwithlist_divider_color

public static final int card_base_cardwithlist_divider_color

See Also:

Constant Field Values

card_expand_title_color

public static final int card_expand_title_color

See Also:

Constant Field Values

card_foreground_activated

public static final int card_foreground_activated

See Also:

Constant Field Values

card_foreground_activated_kitkat

public static final int card_foreground_activated_kitkat

See Also:

Constant Field Values

card_pressed

public static final int card_pressed

See Also:

Constant Field Values

card_pressed_kitkat

public static final int card_pressed_kitkat

See Also:

Constant Field Values

card_section_container_color

public static final int card_section_container_color

See Also:

Constant Field Values

card_section_title_color

public static final int card_section_title_color

See Also:

Constant Field Values

card_text_color_header

public static final int card_text_color_header

See Also:

Constant Field Values

cardview_dark_background

public static final int cardview_dark_background

See Also:

Constant Field Values

cardview_light_background

public static final int cardview_light_background

See Also:

Constant Field Values

cardview_shadow_end_color

public static final int cardview_shadow_end_color

See Also:

Constant Field Values

cardview_shadow_start_color

public static final int cardview_shadow_start_color

See Also:

Constant Field Values

common_action_bar_splitter

public static final int common_action_bar_splitter

See Also:

Constant Field Values

common_signin_btn_dark_text_default

public static final int common_signin_btn_dark_text_default

See Also:

Constant Field Values

common_signin_btn_dark_text_disabled

public static final int common_signin_btn_dark_text_disabled

See Also:

Constant Field Values

common_signin_btn_dark_text_focused

public static final int common_signin_btn_dark_text_focused

See Also:

Constant Field Values

common_signin_btn_dark_text_pressed

public static final int common_signin_btn_dark_text_pressed

See Also:

Constant Field Values

common_signin_btn_default_background

public static final int common_signin_btn_default_background

See Also:

Constant Field Values

common_signin_btn_light_text_default

public static final int common_signin_btn_light_text_default

See Also:

Constant Field Values

common_signin_btn_light_text_disabled

public static final int common_signin_btn_light_text_disabled

See Also:

Constant Field Values

common_signin_btn_light_text_focused

public static final int common_signin_btn_light_text_focused

See Also:

Constant Field Values

common_signin_btn_light_text_pressed

public static final int common_signin_btn_light_text_pressed

See Also:

Constant Field Values

common_signin_btn_text_dark

public static final int common_signin_btn_text_dark

See Also:

Constant Field Values

common_signin_btn_text_light

public static final int common_signin_btn_text_light

See Also:

Constant Field Values

dim_foreground_disabled_material_dark

public static final int dim_foreground_disabled_material_dark

See Also:

Constant Field Values

dim_foreground_disabled_material_light

public static final int dim_foreground_disabled_material_light

See Also:

Constant Field Values

dim_foreground_material_dark

public static final int dim_foreground_material_dark

See Also:

Constant Field Values

dim_foreground_material_light

public static final int dim_foreground_material_light

See Also:

Constant Field Values

highlighted_text_material_dark

public static final int highlighted_text_material_dark

See Also:

Constant Field Values

highlighted_text_material_light

public static final int highlighted_text_material_light

See Also:

Constant Field Values

hint_foreground_material_dark

public static final int hint_foreground_material_dark

See Also:

Constant Field Values

hint_foreground_material_light

public static final int hint_foreground_material_light

See Also:

Constant Field Values

link_text_material_dark

public static final int link_text_material_dark

See Also:

Constant Field Values

link_text_material_light

public static final int link_text_material_light

See Also:

Constant Field Values

list_item_touched

public static final int list_item_touched

See Also:

Constant Field Values

material_blue_grey_800

public static final int material_blue_grey_800

See Also:

Constant Field Values

material_blue_grey_900

public static final int material_blue_grey_900

See Also:

Constant Field Values

material_blue_grey_950

public static final int material_blue_grey_950

See Also:

Constant Field Values

material_deep_teal_200

public static final int material_deep_teal_200

See Also:

Constant Field Values

material_deep_teal_500

public static final int material_deep_teal_500

See Also:

Constant Field Values

nav_bar_add_new_profile_background

public static final int nav_bar_add_new_profile_background

See Also:

Constant Field Values

nav_bar_list_background

public static final int nav_bar_list_background

See Also:

Constant Field Values

nav_bar_main_item_background

public static final int nav_bar_main_item_background

See Also:

Constant Field Values

primary_dark_material_dark

public static final int primary_dark_material_dark

See Also:

Constant Field Values

primary_dark_material_light

public static final int primary_dark_material_light

See Also:

Constant Field Values

primary_material_dark

public static final int primary_material_dark

See Also:

Constant Field Values

primary_material_light

public static final int primary_material_light

See Also:

Constant Field Values

primary_text_default_material_dark

public static final int primary_text_default_material_dark

See Also:

Constant Field Values

primary_text_default_material_light

public static final int primary_text_default_material_light

See Also:

Constant Field Values

primary_text_disabled_material_dark

public static final int primary_text_disabled_material_dark

See Also:

Constant Field Values

primary_text_disabled_material_light

public static final int primary_text_disabled_material_light

See Also:

Constant Field Values

ripple_material_dark

public static final int ripple_material_dark

See Also:

Constant Field Values

ripple_material_light

public static final int ripple_material_light

See Also:

Constant Field Values

secondary_text_default_material_dark

public static final int secondary_text_default_material_dark

See Also:

Constant Field Values

secondary_text_default_material_light

public static final int secondary_text_default_material_light

See Also:

Constant Field Values

secondary_text_disabled_material_dark

public static final int secondary_text_disabled_material_dark

See Also:

Constant Field Values

secondary_text_disabled_material_light

public static final int secondary_text_disabled_material_light

See Also:

Constant Field Values

switch_color

public static final int switch_color

See Also:

Constant Field Values

switch_thumb_normal_material_dark

public static final int switch_thumb_normal_material_dark

See Also:

Constant Field Values

switch_thumb_normal_material_light

public static final int switch_thumb_normal_material_light

See Also:

Constant Field Values

text_view_touched

public static final int text_view_touched

See Also:

Constant Field Values

text_view_touched_darker

public static final int text_view_touched_darker

See Also:

Constant Field Values

user_pic_background1

public static final int user_pic_background1

See Also:

Constant Field Values

user_pic_background2

public static final int user_pic_background2

See Also:

Constant Field Values

user_pic_background3

public static final int user_pic_background3

See Also:

Constant Field Values

user_pic_background4

public static final int user_pic_background4

See Also:

Constant Field Values

user_pic_background5

public static final int user_pic_background5

See Also:

Constant Field Values

user_pic_background6

public static final int user_pic_background6

See Also:

Constant Field Values

user_pic_background7

public static final int user_pic_background7

See Also:

Constant Field Values

user_pic_background8

public static final int user_pic_background8

See Also:

Constant Field Values

user_profiles_background

public static final int user_profiles_background

See Also:

Constant Field Values

wallet_bright_foreground_disabled_holo_light

public static final int wallet_bright_foreground_disabled_holo_light

See Also:

Constant Field Values

wallet_bright_foreground_holo_dark

public static final int wallet_bright_foreground_holo_dark

See Also:

Constant Field Values

wallet_bright_foreground_holo_light

public static final int wallet_bright_foreground_holo_light

See Also:

Constant Field Values

wallet_dim_foreground_disabled_holo_dark

public static final int wallet_dim_foreground_disabled_holo_dark

See Also:

Constant Field Values

wallet_dim_foreground_holo_dark

public static final int wallet_dim_foreground_holo_dark

See Also:

Constant Field Values

wallet_dim_foreground_inverse_disabled_holo_dark

public static final int wallet_dim_foreground_inverse_disabled_holo_dark

See Also:

Constant Field Values

wallet_dim_foreground_inverse_holo_dark

public static final int wallet_dim_foreground_inverse_holo_dark

See Also:

Constant Field Values

wallet_highlighted_text_holo_dark

public static final int wallet_highlighted_text_holo_dark

See Also:

Constant Field Values

wallet_highlighted_text_holo_light

public static final int wallet_highlighted_text_holo_light

See Also:

Constant Field Values

wallet_hint_foreground_holo_dark

public static final int wallet_hint_foreground_holo_dark

See Also:

Constant Field Values

wallet_hint_foreground_holo_light

public static final int wallet_hint_foreground_holo_light

See Also:

Constant Field Values

wallet_holo_blue_light

public static final int wallet_holo_blue_light

See Also:

Constant Field Values

wallet_link_text_light

public static final int wallet_link_text_light

See Also:

Constant Field Values

wallet_primary_text_holo_light

public static final int wallet_primary_text_holo_light

See Also:

Constant Field Values

wallet_secondary_text_holo_dark

public static final int wallet_secondary_text_holo_dark

See Also:

Constant Field Values

Constructor Detail

R.color

public R.color()

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
package org.bouncycastle.openpgp;

import java.util.Date;

import org.bouncycastle.bcpg.BCPGKey;
import org.bouncycastle.bcpg.DSASecretBCPGKey;
import org.bouncycastle.bcpg.ElGamalSecretBCPGKey;
import org.bouncycastle.bcpg.RSASecretBCPGKey;

/**
 * General class to handle JCA key pairs and convert them into OpenPGP ones.
 * <p>
 * A word for the unwary, the KeyID for a OpenPGP public key is calculated from
 * a hash that includes the time of creation, if you pass a different date to the
 * constructor below with the same public private key pair the KeyID will not be the
 * same as for previous generations of the key, so ideally you only want to do
 * this once.
 */
public class PGPKeyPair
{
    protected PGPPublicKey        pub;
    protected PGPPrivateKey       priv;

    protected PGPKeyPair()
    {
    }

    /**
     * Create a key pair from a PGPPrivateKey and a PGPPublicKey.
     *
     * @param pub the public key
     * @param priv the private key
     */
    public PGPKeyPair(
        PGPPublicKey    pub,
        PGPPrivateKey   priv)
    {
        this.pub = pub;
        this.priv = priv;
    }

    /**
     * Return the keyID associated with this key pair.
     *
     * @return keyID
     */
    public long getKeyID()
    {
        return pub.getKeyID();
    }

    public PGPPublicKey getPublicKey()
    {
        return pub;
    }

    public PGPPrivateKey getPrivateKey()
    {
        return priv;
    }
}

redpajama_set_name: RedPajamaGithub


text:
The NATS client libraries try as much as possible to be fire and forget. One of the features that may be included in the library you are using is the ability to buffer outgoing messages when the connection is down.

During a short reconnect, these client can allow applications to publish messages that, because the server is offline, will be cached in the client. The library will then send those messages on reconnect. When the maximum reconnect buffer is reached, messages will no longer be publishable by the client.

Be aware, while the message appears to be sent to the application it is possible that it is never sent because the connection is never remade. Your applications should use patterns like acknowledgements to ensure delivery.

For clients that support this feature, you are able to configure the size of this buffer with bytes, messages or both.

!INCLUDE "../../_examples/reconnect_5mb.html"

> *As mentioned throughout this document, each client library may behave slightly differently. Please check the documentation for the library you are using.*


text:
%status
%
%git_status_byindex
%git_status_file
%git_status_foreach
%git_status_foreach_ext
%git_status_init_options
%git_status_list_entrycount
%git_status_list_free
%git_status_list_get_perfdata
%git_status_list_new
%git_status_should_ignore


text:
<?php

use DTS\eBaySDK\Trading\Types\SellerPaymentType;

class SellerPaymentTypeTest extends \PHPUnit_Framework_TestCase
{
    private $obj;

    protected function setUp()
    {
        $this->obj = new SellerPaymentType();
    }

    public function testCanBeCreated()
    {
        $this->assertInstanceOf('\DTS\eBaySDK\Trading\Types\SellerPaymentType', $this->obj);
    }

    public function testExtendsBaseType()
    {
        $this->assertInstanceOf('\DTS\eBaySDK\Types\BaseType', $this->obj);
    }
}


text:
class DropAccessoriesTable < ActiveRecord::Migration
  def up
    drop_table :accessories_equipment_models
  end

  def down
    create_table :accessories_equipment_models do |t|
      t.references :accessory
      t.references :equipment_model
      t.timestamps
    end
  end
end


text:
using System;

namespace JRodrigoAV.Models.Cards
{
    public class BaseCard {
        public int Id { get; set; }

        public string Text { get; set; }

        public DateTime CreatedOn { get; set; }

        public DateTime? LastModified { get; set; }

        //public virtual ICollection<TranslationCard> Translations { get; set; }
        public BaseCard () {

        }
        public BaseCard (int id, string text) {
            Id = id;
            Text = text;
        }
    }

}


text:
<?php

class Genmato_Core_System_Genmato_LoggingController extends Mage_Adminhtml_Controller_Action
{
    public function indexAction()
    {
        $this->loadLayout()
            ->_addContent($this->getLayout()->createBlock('genmato_core/system_genmato_logging'))
            ->renderLayout();
    }

    public function gridAction()
    {
        $this->loadLayout();
        $this->getResponse()->setBody(
            $this->getLayout()->createBlock('genmato_core/system_genmato_logging_grid')->toHtml()
        );
    }
}


text:
package com.google.code.externalsorting;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.EOFException;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.nio.charset.Charset;
import java.util.ArrayList;
//import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.PriorityQueue;
//import java.util.stream.Collectors;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.zip.Deflater;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;

/**
 * Goal: offer a generic external-memory sorting program in Java
 * by using the executor service for using possibly all cores in your system.
 * We have also included parallel stream sort provided by Java 8.
 *
 * It must be : - hackable (easy to adapt) - scalable to large files - sensibly
 * efficient.
 *
 * This software is in the public domain.
 *
 * Usage: java com/google/code/externalsorting/ExternalSortCallable somefile.txt out.txt
 *
 * You can change the default maximal number of temporary files with the -t
 * flag: java com/google/code/externalsorting/ExternalSortCallable somefile.txt out.txt
 * -t 3
 *
 * For very large files, you might want to use an appropriate flag to allocate
 * more memory to the Java VM: java -Xms2G
 * com/google/code/externalsorting/ExternalSortCallable somefile.txt out.txt
 *
 * By Kapil Wadodkar, Aniket Kokate, First published: October 2014 originally posted at
 * https://github.com/wkapil/distributedexternalsort
 * We have used the External sorting mechanism provided by following team:
 *
 * By (in alphabetical order) Philippe Beaudoin, Eleftherios Chetzakis, Jon
 * Elsas, Christan Grant, Daniel Haran, Daniel Lemire, Sugumaran Harikrishnan,
 * Thomas, Mueller, Jerry Yang, First published: April 2010 originally posted at
 * http://lemire.me/blog/archives/2010/04/01/external-memory-sorting-in-java/
 */
public class ExternalSortCallable {

	/**
	 *
	 */
	public static void displayUsage() {
		System.out
		.println("java com.google.externalsorting.ExternalSort inputfile outputfile");
		System.out.println("Flags are:");
		System.out.println("-v or --verbose: verbose output");
		System.out.println("-d or --distinct: prune duplicate lines");
		System.out
		.println("-t or --maxtmpfiles (followed by an integer): specify an upper bound on the number of temporary files");
		System.out
		.println("-c or --charset (followed by a charset code): specify the character set to use (for sorting)");
		System.out
		.println("-z or --gzip: use compression for the temporary files");
		System.out
		.println("-H or --header (followed by an integer): ignore the first few lines");
		System.out
		.println("-s or --store (following by a path): where to store the temporary files");
		System.out.println("-h or --help: display this message");
	}

	/**
	 * This method calls the garbage collector and then returns the free
	 * memory. This avoids problems with applications where the GC hasn't
	 * reclaimed memory and reports no available memory.
	 *
	 * @return available memory
	 */
	public static long estimateAvailableMemory() {
		System.gc();
		System.out.println("freeMemory: " +Runtime.getRuntime().freeMemory());
		return Runtime.getRuntime().freeMemory();
	}

	/**
	 * we divide the file into small blocks. If the blocks are too small, we
	 * shall create too many temporary files. If they are too big, we shall
	 * be using too much memory.
	 *
	 * @param sizeoffile
	 *                how much data (in bytes) can we expect
	 * @param maxtmpfiles
	 *                how many temporary files can we create (e.g., 1024)
	 * @param maxMemory
	 *                Maximum memory to use (in bytes)
	 * @return the estimate
	 */
	public static long estimateBestSizeOfBlocks(final long sizeoffile,
			final int maxtmpfiles, final long maxMemory) {
		// we don't want to open up much more than maxtmpfiles temporary
		// files, better run
		// out of memory first.
		long blocksize = sizeoffile / maxtmpfiles
				+ (sizeoffile % maxtmpfiles == 0 ? 0 : 1);

		// on the other hand, we don't want to create many temporary
		// files
		// for naught. If blocksize is smaller than half the free
		// memory, grow it.
		if (blocksize < maxMemory / 2) {
			blocksize = maxMemory / 2;
		}
		System.out.println("blocksize: "+blocksize);
		return blocksize;
	}

	/**
	 * @param args
	 * @throws IOException
	 */
	public static void main(final String[] args) throws IOException {
		long startTime = System.currentTimeMillis();
		boolean verbose = false;
		boolean distinct = false;
		int maxtmpfiles = DEFAULTMAXTEMPFILES;
		Charset cs = Charset.defaultCharset();
		String inputfile = null, outputfile = null;
		File tempFileStore = null;
		boolean usegzip = false;
		int headersize = 0;
		for (int param = 0; param < args.length; ++param) {
			if (args[param].equals("-v")
					|| args[param].equals("--verbose")) {
				verbose = true;
			} else if ((args[param].equals("-h") || args[param]
					.equals("--help"))) {
				displayUsage();
				return;
			} else if ((args[param].equals("-d") || args[param]
					.equals("--distinct"))) {
				distinct = true;
			} else if ((args[param].equals("-t") || args[param]
					.equals("--maxtmpfiles"))
					&& args.length > param + 1) {
				param++;
				maxtmpfiles = Integer.parseInt(args[param]);
				if (headersize < 0) {
					System.err
					.println("maxtmpfiles should be positive");
				}
			} else if ((args[param].equals("-c") || args[param]
					.equals("--charset"))
					&& args.length > param + 1) {
				param++;
				cs = Charset.forName(args[param]);
			} else if ((args[param].equals("-z") || args[param]
					.equals("--gzip"))) {
				usegzip = true;
			} else if ((args[param].equals("-H") || args[param]
					.equals("--header")) && args.length > param + 1) {
				param++;
				headersize = Integer.parseInt(args[param]);
				if (headersize < 0) {
					System.err
					.println("headersize should be positive");
				}
			} else if ((args[param].equals("-s") || args[param]
					.equals("--store")) && args.length > param + 1) {
				param++;
				tempFileStore = new File(args[param]);
			} else {
				if (inputfile == null)
					inputfile = args[param];
				else if (outputfile == null)
					outputfile = args[param];
				else
					System.out.println("Unparsed: "
							+ args[param]);
			}
		}
		if (outputfile == null) {
			System.out
			.println("please provide input and output file names");
			displayUsage();
			return;
		}
		Comparator<String> comparator = defaultcomparator;
		List<File> l = sortInBatch(new File(inputfile), comparator,
				maxtmpfiles, cs, tempFileStore, distinct, headersize,
				usegzip);
		if (verbose)
			System.out
			.println("created " + l.size() + " tmp files");
		mergeSortedFiles(l, new File(outputfile), comparator, cs,
				distinct, false, usegzip);
		System.out.println("ExternalSortCallable: Total time (ms): "+ (System.currentTimeMillis() - startTime));
	}

	/**
	 * This merges several BinaryFileBuffer to an output writer.
	 *
	 * @param fbw
	 *                A buffer where we write the data.
	 * @param cmp
	 *                A comparator object that tells us how to sort the
	 *                lines.
	 * @param distinct
	 *                Pass true if duplicate lines should be
	 *                discarded. (elchetz@gmail.com)
	 * @param buffers
	 *                Where the data should be read.
	 * @return The number of lines sorted. (P. Beaudoin)
	 * @throws IOException
	 *
	 */
	public static int mergeSortedFiles(BufferedWriter fbw,
			final Comparator<String> cmp, boolean distinct,
			List<BinaryFileBuffer> buffers) throws IOException {
		PriorityQueue<BinaryFileBuffer> pq = new PriorityQueue<BinaryFileBuffer>(
				11, new Comparator<BinaryFileBuffer>() {
					//@Override
					public int compare(BinaryFileBuffer i,
							BinaryFileBuffer j) {
						return cmp.compare(i.peek(), j.peek());
					}
				});
		//System.out.println("buffers.size()="+buffers.size());
		for (BinaryFileBuffer bfb : buffers) {
			if (!bfb.empty()) {
				//System.out.println("peek-"+bfb.peek());
				pq.add(bfb);
			}
		}
		int rowcounter = 0;
		String lastLine = null;
		try {
			//System.out.println("while started");
			//System.out.println("pq.size()="+pq.size());
			while (pq.size() > 0) {
				BinaryFileBuffer bfb = pq.poll();
				//System.out.println("peek-"+bfb.peek());
				String r = bfb.pop();
				// Skip duplicate lines
				if (!distinct || !r.equals(lastLine)) {
					fbw.write(r);
					fbw.newLine();
					lastLine = r;
				}
				++rowcounter;
				if (bfb.empty()) {
					bfb.fbr.close();
				} else {
					pq.add(bfb); // add it back
				}
			}
		} finally {
			fbw.close();
			for (BinaryFileBuffer bfb : pq)
				bfb.close();
		}
		return rowcounter;

	}

	/**
	 * This merges a bunch of temporary flat files
	 *
	 * @param files
	 *                files to be merged
	 * @param outputfile
	 *                output file
	 * @return The number of lines sorted. (P. Beaudoin)
	 * @throws IOException
	 */
	public static int mergeSortedFiles(List<File> files, File outputfile)
			throws IOException {
		return mergeSortedFiles(files, outputfile, defaultcomparator,
				Charset.defaultCharset());
	}

	/**
	 * This merges a bunch of temporary flat files
	 *
	 * @param files
	 * @param outputfile
	 * @param cmp
	 * @return The number of lines sorted. (P. Beaudoin)
	 * @throws IOException
	 */
	public static int mergeSortedFiles(List<File> files, File outputfile,
			final Comparator<String> cmp) throws IOException {
		return mergeSortedFiles(files, outputfile, cmp,
				Charset.defaultCharset());
	}

	/**
	 * This merges a bunch of temporary flat files
	 *
	 * @param files
	 * @param outputfile
	 * @param cmp
	 * @param distinct
	 * @return The number of lines sorted. (P. Beaudoin)
	 * @throws IOException
	 */
	public static int mergeSortedFiles(List<File> files, File outputfile,
			final Comparator<String> cmp, boolean distinct)
					throws IOException {
		return mergeSortedFiles(files, outputfile, cmp,
				Charset.defaultCharset(), distinct);
	}

	/**
	 * This merges a bunch of temporary flat files
	 *
	 * @param files
	 * @param outputfile
	 * @param cmp
	 * @param cs
	 *                character set to use to load the strings
	 * @return The number of lines sorted. (P. Beaudoin)
	 * @throws IOException
	 */
	public static int mergeSortedFiles(List<File> files, File outputfile,
			final Comparator<String> cmp, Charset cs) throws IOException {
		return mergeSortedFiles(files, outputfile, cmp, cs, false);
	}

	/**
	 * This merges a bunch of temporary flat files
	 *
	 * @param files
	 *                The {@link List} of sorted {@link File}s to be merged.
	 * @param distinct
	 *                Pass true if duplicate lines should be
	 *                discarded. (elchetz@gmail.com)
	 * @param outputfile
	 *                The output {@link File} to merge the results to.
	 * @param cmp
	 *                The {@link Comparator} to use to compare
	 *                {@link String}s.
	 * @param cs
	 *                The {@link Charset} to be used for the byte to
	 *                character conversion.
	 * @return The number of lines sorted. (P. Beaudoin)
	 * @throws IOException
	 * @since v0.1.2
	 */
	public static int mergeSortedFiles(List<File> files, File outputfile,
			final Comparator<String> cmp, Charset cs, boolean distinct)
					throws IOException {
		return mergeSortedFiles(files, outputfile, cmp, cs, distinct,
				false, false);
	}

	/**
	 * This merges a bunch of temporary flat files
	 *
	 * @param files
	 *                The {@link List} of sorted {@link File}s to be merged.
	 * @param distinct
	 *                Pass true if duplicate lines should be
	 *                discarded. (elchetz@gmail.com)
	 * @param outputfile
	 *                The output {@link File} to merge the results to.
	 * @param cmp
	 *                The {@link Comparator} to use to compare
	 *                {@link String}s.
	 * @param cs
	 *                The {@link Charset} to be used for the byte to
	 *                character conversion.
	 * @param append
	 *                Pass true if result should append to
	 *                {@link File} instead of overwrite. Default to be false
	 *                for overloading methods.
	 * @param usegzip
	 *                assumes we used gzip compression for temporary files
	 * @return The number of lines sorted. (P. Beaudoin)
	 * @throws IOException
	 * @since v0.1.4
	 */
	public static int mergeSortedFiles(List<File> files, File outputfile,
			final Comparator<String> cmp, Charset cs, boolean distinct,
			boolean append, boolean usegzip) throws IOException {
		ArrayList<BinaryFileBuffer> bfbs = new ArrayList<BinaryFileBuffer>();
		//System.out.println("merge started, files.size="+files.size());
		for (File f : files) {
			final int BUFFERSIZE = 2048;
			InputStream in = new FileInputStream(f);
			BufferedReader br;
			if (usegzip) {
				br = new BufferedReader(
						new InputStreamReader(
								new GZIPInputStream(in,
										BUFFERSIZE), cs));
			} else {
				br = new BufferedReader(new InputStreamReader(
						in, cs));
			}

			BinaryFileBuffer bfb = new BinaryFileBuffer(br);
			bfbs.add(bfb);
		}
		//System.out.println("merge-bfbs.size="+bfbs.size());
		BufferedWriter fbw = new BufferedWriter(new OutputStreamWriter(
				new FileOutputStream(outputfile, append), cs));
		int rowcounter = mergeSortedFiles(fbw, cmp, distinct, bfbs);
		//System.out.println("merge-rowcounter="+rowcounter);
		for (File f : files)
			f.delete();
		return rowcounter;
	}

	/**
	 * This sorts a file (input) to an output file (output) using default
	 * parameters
	 *
	 * @param input
	 *                source file
	 *
	 * @param output
	 *                output file
	 * @throws IOException
	 */
	public static void sort(final File input, final File output)
			throws IOException {
		ExternalSortCallable.mergeSortedFiles(ExternalSortCallable.sortInBatch(input),
				output);
	}

	/**
	 * Sort a list and save it to a temporary file
	 *
	 * @return the file containing the sorted data
	 * @param tmplist
	 *                data to be sorted
	 * @param cmp
	 *                string comparator
	 * @param cs
	 *                charset to use for output (can use
	 *                Charset.defaultCharset())
	 * @param tmpdirectory
	 *                location of the temporary files (set to null for
	 *                default location)
	 * @throws IOException
	 */
	public static File sortAndSave(List<String> tmplist,
			Comparator<String> cmp, Charset cs, File tmpdirectory)
					throws IOException {
		return sortAndSave(tmplist, cmp, cs, tmpdirectory, false, false);
	}

	/**
	 * Sort a list and save it to a temporary file
	 *
	 * @return the file containing the sorted data
	 * @param tmplist
	 *                data to be sorted
	 * @param cmp
	 *                string comparator
	 * @param cs
	 *                charset to use for output (can use
	 *                Charset.defaultCharset())
	 * @param tmpdirectory
	 *                location of the temporary files (set to null for
	 *                default location)
	 * @param distinct
	 *                Pass true if duplicate lines should be
	 *                discarded.
	 * @param usegzip
	 *                set to true if you are using gzip compression for the
	 *                temporary files
	 * @throws IOException
	 */
	public static File sortAndSave(List<String> tmplist,
			Comparator<String> cmp, Charset cs, File tmpdirectory,
			boolean distinct, boolean usegzip) throws IOException {
		// Use following code upto Java 7
		Collections.sort(tmplist, cmp);
		// Use following code for Java 8
		//String[] tmplistArray = tmplist.toArray(new String[0]);
		//Arrays.parallelSort(tmplistArray, cmp);
		/*tmplist = tmplist.parallelStream().sorted(cmp)
				.collect(Collectors.toCollection(ArrayList<String>::new));*/
		File newtmpfile = File.createTempFile("sortInBatch",
				"flatfile", tmpdirectory);
		newtmpfile.deleteOnExit();
		OutputStream out = new FileOutputStream(newtmpfile);
		int ZIPBUFFERSIZE = 2048;
		if (usegzip)
			out = new GZIPOutputStream(out, ZIPBUFFERSIZE) {
			{
				this.def.setLevel(Deflater.BEST_SPEED);
			}
		};
		BufferedWriter fbw = new BufferedWriter(new OutputStreamWriter(
				out, cs));
		String lastLine = null;
		try {
			for (String r : tmplist) {
				// Skip duplicate lines
				if (!distinct || !r.equals(lastLine)) {
					fbw.write(r);
					fbw.newLine();
					lastLine = r;
				}
			}
		} finally {
			fbw.close();
		}
		return newtmpfile;
	}

	/**
	 * This will simply load the file by blocks of lines, then sort them
	 * in-memory, and write the result to temporary files that have to be
	 * merged later.
	 *
	 * @param fbr
	 *                data source
	 * @param datalength
	 *                estimated data volume (in bytes)
	 * @return a list of temporary flat files
	 * @throws IOException
	 */
	public static List<File> sortInBatch(final BufferedReader fbr,
			final long datalength) throws IOException {
		return sortInBatch(fbr, datalength, defaultcomparator,
				DEFAULTMAXTEMPFILES, estimateAvailableMemory(),
				Charset.defaultCharset(), null, false, 0, false);
	}

	/**
	 * This will simply load the file by blocks of lines, then sort them
	 * in-memory, and write the result to temporary files that have to be
	 * merged later.
	 *
	 * @param fbr
	 *                data source
	 * @param datalength
	 *                estimated data volume (in bytes)
	 * @param cmp
	 *                string comparator
	 * @param distinct
	 *                Pass true if duplicate lines should be
	 *                discarded.
	 * @return a list of temporary flat files
	 * @throws IOException
	 */
	public static List<File> sortInBatch(final BufferedReader fbr,
			final long datalength, final Comparator<String> cmp,
			final boolean distinct) throws IOException {
		return sortInBatch(fbr, datalength, cmp, DEFAULTMAXTEMPFILES,
				estimateAvailableMemory(), Charset.defaultCharset(),
				null, distinct, 0, false);
	}

	/**
	 * @param fbr
	 *                data source
	 * @param datalength
	 *                estimated data volume (in bytes)
	 * @param cmp
	 *                string comparator
	 * @param maxtmpfiles
	 *                maximal number of temporary files
	 * @param maxMemory
	 *                maximum amount of memory to use (in bytes)
	 * @param cs
	 *                character set to use (can use
	 *                Charset.defaultCharset())
	 * @param tmpdirectory
	 *                location of the temporary files (set to null for
	 *                default location)
	 * @param distinct
	 *                Pass true if duplicate lines should be
	 *                discarded.
	 * @param numHeader
	 *                number of lines to preclude before sorting starts
	 * @param usegzip
	 *                use gzip compression for the temporary files
	 * @return a list of temporary flat files
	 * @throws IOException
	 */
	public static List<File> sortInBatch(final BufferedReader fbr,
			final long datalength, final Comparator<String> cmp,
			final int maxtmpfiles, long maxMemory, final Charset cs,
			final File tmpdirectory, final boolean distinct,
			final int numHeader, final boolean usegzip) throws IOException {
		List<File> files = new ArrayList<File>();
		long blocksize = estimateBestSizeOfBlocks(datalength,
				maxtmpfiles, maxMemory);// in
				// bytes

		try {
			//Get ExecutorService from Executors utility class, thread pool size is 10
			ExecutorService executor = Executors.newFixedThreadPool(4);
			//create a list to hold the Future object associated with Callable
			List<Future<File>> futureFileList = new ArrayList<Future<File>>();
			List<String> tmplist = null;
			String line = "";
			try {
				int counter = 0;
				while (line != null) {
					tmplist = new ArrayList<String>();
					long currentblocksize = 0;// in bytes
					while ((currentblocksize < blocksize)
							&& ((line = fbr.readLine()) != null)) {
						// as long as you have enough
						// memory
						if (counter < numHeader) {
							counter++;
							continue;
						}
						tmplist.add(line);
						currentblocksize += StringSizeEstimator
								.estimatedSizeOf(line);
					}

					//System.out.println("tmplist size="+tmplist.size());

					SortAndSaveCallable sortCallable = new SortAndSaveCallable(tmplist, cmp,
							cs, tmpdirectory, distinct, usegzip);
					//System.out.println("submit callable");
					//submit Callable tasks to be executed by thread pool
					Future<File> future = executor.submit(sortCallable);
					//System.out.println("add future to list");
					//add Future to the list, we can get return value using Future
					futureFileList.add(future);

					/*files.add(sortAndSave(tmplist, cmp, cs,
                                                tmpdirectory, distinct, usegzip));*/

					//tmplist.clear();
				}
			} catch (EOFException oef) {
				if (tmplist.size() > 0) {
					/*files.add(sortAndSave(tmplist, cmp, cs,
                                                tmpdirectory, distinct, usegzip));*/
					// tmplist.clear();
					//System.out.println("EOF tmplist size="+tmplist.size());

					SortAndSaveCallable sortCallable = new SortAndSaveCallable(tmplist, cmp,
							cs, tmpdirectory, distinct, usegzip);
					//submit Callable tasks to be executed by thread pool
					Future<File> future = executor.submit(sortCallable);
					//add Future to the list, we can get return value using Future
					futureFileList.add(future);
				}
			}

			//System.out.println("##### processing future list");
			for(Future<File> future : futureFileList){
				try {
					//print the return value of Future, notice the output delay in console
					// because Future.get() waits for task to get completed
					//System.out.println(new Date()+ "::"+fut.get());
					files.add(future.get());
					//System.out.println("in for loop future list");
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
			//System.out.println("executor shutdown");
			//shut down the executor service now
			executor.shutdown();

			//tmplist.clear();
		} finally {
			fbr.close();
		}
		return files;
	}

	/**
	 * This will simply load the file by blocks of lines, then sort them
	 * in-memory, and write the result to temporary files that have to be
	 * merged later.
	 *
	 * @param file
	 *                some flat file
	 * @return a list of temporary flat files
	 * @throws IOException
	 */
	public static List<File> sortInBatch(File file) throws IOException {
		return sortInBatch(file, defaultcomparator,
				DEFAULTMAXTEMPFILES, Charset.defaultCharset(), null,
				false);
	}

	/**
	 * This will simply load the file by blocks of lines, then sort them
	 * in-memory, and write the result to temporary files that have to be
	 * merged later.
	 *
	 * @param file
	 *                some flat file
	 * @param cmp
	 *                string comparator
	 * @return a list of temporary flat files
	 * @throws IOException
	 */
	public static List<File> sortInBatch(File file, Comparator<String> cmp)
			throws IOException {
		return sortInBatch(file, cmp, DEFAULTMAXTEMPFILES,
				Charset.defaultCharset(), null, false);
	}

	/**
	 * This will simply load the file by blocks of lines, then sort them
	 * in-memory, and write the result to temporary files that have to be
	 * merged later.
	 *
	 * @param file
	 *                some flat file
	 * @param cmp
	 *                string comparator
	 * @param distinct
	 *                Pass true if duplicate lines should be
	 *                discarded.
	 * @return a list of temporary flat files
	 * @throws IOException
	 */
	public static List<File> sortInBatch(File file, Comparator<String> cmp,
			boolean distinct) throws IOException {
		return sortInBatch(file, cmp, DEFAULTMAXTEMPFILES,
				Charset.defaultCharset(), null, distinct);
	}

	/**
	 * This will simply load the file by blocks of lines, then sort them
	 * in-memory, and write the result to temporary files that have to be
	 * merged later. You can specify a bound on the number of temporary
	 * files that will be created.
	 *
	 * @param file
	 *                some flat file
	 * @param cmp
	 *                string comparator
	 * @param maxtmpfiles
	 *                maximal number of temporary files
	 * @param cs
	 *                character set to use (can use
	 *                Charset.defaultCharset())
	 * @param tmpdirectory
	 *                location of the temporary files (set to null for
	 *                default location)
	 * @param distinct
	 *                Pass true if duplicate lines should be
	 *                discarded.
	 * @return a list of temporary flat files
	 * @throws IOException
	 */
	public static List<File> sortInBatch(File file, Comparator<String> cmp,
			int maxtmpfiles, Charset cs, File tmpdirectory, boolean distinct)
					throws IOException {
		return sortInBatch(file, cmp, maxtmpfiles, cs, tmpdirectory,
				distinct, 0, false);
	}

	/**
	 * This will simply load the file by blocks of lines, then sort them
	 * in-memory, and write the result to temporary files that have to be
	 * merged later. You can specify a bound on the number of temporary
	 * files that will be created.
	 *
	 * @param file
	 *                some flat file
	 * @param cmp
	 *                string comparator
	 * @param maxtmpfiles
	 *                maximal number of temporary files
	 * @param cs
	 *                character set to use (can use
	 *                Charset.defaultCharset())
	 * @param tmpdirectory
	 *                location of the temporary files (set to null for
	 *                default location)
	 * @param distinct
	 *                Pass true if duplicate lines should be
	 *                discarded.
	 * @param numHeader
	 *                number of lines to preclude before sorting starts
	 * @param usegzip
	 *                use gzip compression for the temporary files
	 * @return a list of temporary flat files
	 * @throws IOException
	 */
	public static List<File> sortInBatch(File file, Comparator<String> cmp,
			int maxtmpfiles, Charset cs, File tmpdirectory,
			boolean distinct, int numHeader, boolean usegzip)
					throws IOException {
		BufferedReader fbr = new BufferedReader(new InputStreamReader(
				new FileInputStream(file), cs));
		return sortInBatch(fbr, file.length(), cmp, maxtmpfiles,
				estimateAvailableMemory(), cs, tmpdirectory, distinct,
				numHeader, usegzip);
	}

	/**
	 * default comparator between strings.
	 */
	public static Comparator<String> defaultcomparator = new Comparator<String>() {
		//@Override
		public int compare(String r1, String r2) {
			return r1.compareTo(r2);
		}
	};

	/**
	 * Default maximal number of temporary files allowed.
	 */
	public static final int DEFAULTMAXTEMPFILES = 1024;

}


text:
SYNONYM

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

#### Published in
Syll. fung. (Abellini), Addit. 239 (1886)

#### Original name
Phyllachora salvadorae Cooke, 1885

### Remarks
null


text:
package org.ovirt.engine.api.restapi.rsdl;

import java.util.HashMap;
import java.util.Map;

public class Signature {
    private Map<Object, Object> mandatoryArguments = new HashMap<Object, Object>();
    private Map<Object, Object> optionalArguments = new HashMap<Object, Object>();

    public Map<Object, Object> getMandatoryArguments() {
        return mandatoryArguments;
    }
    public void setMandatoryArguments(Map<Object, Object> mandatoryArguments) {
        this.mandatoryArguments = mandatoryArguments;
    }
    public Map<Object, Object> getOptionalArguments() {
        return optionalArguments;
    }
    public void setOptionalArguments(Map<Object, Object> optionalArguments) {
        this.optionalArguments = optionalArguments;
    }
    public boolean isEmpty() {
        return mandatoryArguments.isEmpty() && optionalArguments.isEmpty();
    }
    public void addMandatoryArgument(Object name, Object type) {
        mandatoryArguments.put(name,type);
    }
    public void addOptionalArgument(Object name, Object type) {
        optionalArguments.put(name,type);
    }
    public Signature clone() {
        Signature clonedSignature = new Signature();
        Map<Object, Object> mandatoryArguments = new HashMap<Object, Object>();
        mandatoryArguments.putAll(getMandatoryArguments());
        Map<Object, Object> optionalArguments = new HashMap<Object, Object>();
        optionalArguments.putAll(getOptionalArguments());
        clonedSignature.setMandatoryArguments(mandatoryArguments);
        clonedSignature.setOptionalArguments(optionalArguments);
        return clonedSignature;
    }
}


text:
package gobblin.source.extractor.extract.kafka;

import org.apache.avro.Schema;
import org.apache.avro.io.Decoder;
import org.apache.avro.io.DecoderFactory;

import com.google.common.base.Preconditions;

import gobblin.annotation.Alias;
import gobblin.configuration.WorkUnitState;

/**
 * Extract avro records from a Kafka topic using a fixed schema provided by {@link #STATIC_SCHEMA_ROOT_KEY}.
 */
@Alias(value = "AVRO_FIXED_SCHEMA")
public class FixedSchemaKafkaAvroExtractor extends KafkaAvroExtractor<Void> {

  public static final String STATIC_SCHEMA_ROOT_KEY = "gobblin.source.kafka.fixedSchema";

  public FixedSchemaKafkaAvroExtractor(WorkUnitState state) {
    super(state);
  }

  @Override
  protected Schema getLatestSchemaByTopic(String topic) {
    String key = STATIC_SCHEMA_ROOT_KEY + "." + topic;
    Preconditions.checkArgument(this.workUnitState.contains(key),
        String.format("Could not find schema for topic %s. Looking for key %s.", topic, key));
    return new Schema.Parser().parse(this.workUnitState.getProp(key));
  }

  @Override
  protected Schema getRecordSchema(byte[] payload) {
    if (!this.schema.isPresent()) {
      throw new RuntimeException("Schema is not preset. This is an error in the code.");
    }
    return this.schema.get();
  }

  @Override
  protected Decoder getDecoder(byte[] payload) {
    return DecoderFactory.get().binaryDecoder(payload, null);
  }
}


text:
/*
* TestURLNodesProviderFactory.java
*
* User: Greg Schueler greg@dtosolutions.com
* Created: 7/22/11 2:17 PM
*
*/
package com.dtolabs.rundeck.core.resources;

import junit.framework.TestCase;

/**
 * TestURLNodesProviderFactory is ...
 *
 * @author Greg Schueler greg@dtosolutions.com
 */
public class TestURLResourceModelSourceFactory extends TestCase {
    public void testblah(){

    }
}


text:
require File.expand_path('../boot', __FILE__)

require 'rails/all'

if defined?(Bundler)
  # If you precompile assets before deploying to production, use this line
  Bundler.require(*Rails.groups(:assets => %w(development test)))
  # If you want your assets lazily compiled in production, use this line
  # Bundler.require(:default, :assets, Rails.env)
end

module Flareteam
  class Application < Rails::Application
    config.assets.initialize_on_precompile = false
    config.encoding = "utf-8"
    config.filter_parameters += [:password]
    config.active_support.escape_html_entities_in_json = true
    config.active_record.whitelist_attributes = true
    config.action_mailer.delivery_method = :smtp
    config.action_mailer.default_url_options = { :host => 'localhost:3000' }

    config.autoload_paths += %W(#{config.root}/lib/devise)
    config.assets.enabled = true
    config.assets.version = '1.0'
  end
end

Rails.configuration.time_zone = 'Eastern Time (US & Canada)'


text:
'''
Calibration utility made by Nic.  Modified from plane_tracker.py sample cv2 program.
Drage a rectangle around anything and it returns the biggest/smallest h s and v.
Sometimes you have to run it multiple times bc of random glitches.

#@TODO mak i more like this: http://stackoverflow.com/questions/16195190/python-cv2-how-do-i-draw-a-line-on-an-image-with-mouse-then-return-line-coord

'''

import numpy as np
import cv2
from collections import namedtuple
import video
import common
import ConfigParser
import sys

FLANN_INDEX_KDTREE = 1
FLANN_INDEX_LSH    = 6
flann_params= dict(algorithm = FLANN_INDEX_LSH,
                   table_number = 6, # 12
                   key_size = 12,     # 20
                   multi_probe_level = 1) #2

MIN_MATCH_COUNT = 10

'''
  image     - image to track
  rect      - tracked rectangle (x1, y1, x2, y2)
  keypoints - keypoints detected inside rect
  descrs    - their descriptors
  data      - some user-provided data
'''
PlanarTarget = namedtuple('PlaneTarget', 'image, rect, keypoints, descrs, data')

'''
  target - reference to PlanarTarget
  p0     - matched points coords in target image
  p1     - matched points coords in input frame
  H      - homography matrix from p0 to p1
  quad   - target bounary quad in input frame
'''
TrackedTarget = namedtuple('TrackedTarget', 'target, p0, p1, H, quad')

class PlaneTracker:
    def __init__(self):
        self.detector = cv2.ORB( nfeatures = 1000 )
        self.matcher = cv2.FlannBasedMatcher(flann_params, {})  # bug : need to pass empty dict (#1329)
        self.targets = []

    def add_target(self, image, rect, data=None):
        '''Add a new tracking target.'''
        x0, y0, x1, y1 = rect
        raw_points, raw_descrs = self.detect_features(image)
        points, descs = [], []
        for kp, desc in zip(raw_points, raw_descrs):
            x, y = kp.pt
            if x0 <= x <= x1 and y0 <= y <= y1:
                points.append(kp)
                descs.append(desc)
        descs = np.uint8(descs)
        self.matcher.add([descs])
        target = PlanarTarget(image = image, rect=rect, keypoints = points, descrs=descs, data=None)
        self.targets.append(target)

    def clear(self):
        '''Remove all targets'''
        self.targets = []
        self.matcher.clear()

    def track(self, frame):
        '''Returns a list of detected TrackedTarget objects'''
        self.frame_points, self.frame_descrs = self.detect_features(frame)
        if len(self.frame_points) < MIN_MATCH_COUNT:
            return []
        #matches = self.matcher.knnMatch(self.frame_descrs, k = 2)
        matches=[]
        matches = [m[0] for m in matches if len(m) == 2 and m[0].distance < m[1].distance * 0.75]
        if len(matches) < MIN_MATCH_COUNT:
            return []
        matches_by_id = [[] for _ in xrange(len(self.targets))]
        for m in matches:
            matches_by_id[m.imgIdx].append(m)
        tracked = []
        for imgIdx, matches in enumerate(matches_by_id):
            if len(matches) < MIN_MATCH_COUNT:
                continue
            target = self.targets[imgIdx]
            p0 = [target.keypoints[m.trainIdx].pt for m in matches]
            p1 = [self.frame_points[m.queryIdx].pt for m in matches]
            p0, p1 = np.float32((p0, p1))
            H, status = cv2.findHomography(p0, p1, cv2.RANSAC, 3.0)
            status = status.ravel() != 0
            if status.sum() < MIN_MATCH_COUNT:
                continue
            p0, p1 = p0[status], p1[status]

            x0, y0, x1, y1 = target.rect
            quad = np.float32([[x0, y0], [x1, y0], [x1, y1], [x0, y1]])
            quad = cv2.perspectiveTransform(quad.reshape(1, -1, 2), H).reshape(-1, 2)

            track = TrackedTarget(target=target, p0=p0, p1=p1, H=H, quad=quad)
            tracked.append(track)
        tracked.sort(key = lambda t: len(t.p0), reverse=True)
        return tracked

    def detect_features(self, frame):
        '''detect_features(self, frame) -> keypoints, descrs'''
        keypoints, descrs = self.detector.detectAndCompute(frame, None)
        if descrs is None:  # detectAndCompute returns descs=None if not keypoints found
            descrs = []
        return keypoints, descrs

class App:
    def __init__(self, src):
        self.cap = video.create_capture(src)
        self.frame = None
        self.paused = False
        self.tracker = PlaneTracker()

        cv2.namedWindow('plane')
        self.rect_sel = common.RectSelector('plane', self.on_rect)

    def on_rect(self, rect):
        self.tracker.add_target(self.frame, rect)

    def run(self):
        while True:
            playing = not self.paused and not self.rect_sel.dragging
            if playing or self.frame is None:
                ret, frame = self.cap.read()
                if not ret:
                    break
                self.frame = frame.copy()

            vis = self.frame.copy()
            if playing:
                tracked = self.tracker.track(self.frame)
                for tr in tracked:
                    cv2.polylines(vis, [np.int32(tr.quad)], True, (255, 255, 255), 2)
                    hsvcapture = cv2.cvtColor(vis,cv2.COLOR_BGR2HSV)

                    hsvroi = hsvcapture[abs(tr.quad[0][1]+5):abs(tr.quad[2][1]-5),abs(tr.quad[0][0]+5):abs(tr.quad[2][0]-5)]
                    cv2.imshow("hsvroi",hsvroi)

                    minh = 300
                    maxh = 0

                    mins = 300
                    maxs = 0

                    minv = 300
                    maxv = 0

                    for x in hsvroi:
                        for y in x:

                            if minh > y[0]:
                                minh = y[0]

                            if mins > y[1]:
                                mins = y[1]

                            if minv > y[2]:
                                minv = y[2]

                            if maxh < y[0]:
                                maxh = y[0]

                            if maxs < y[1]:
                                maxs = y[1]

                            if maxv < y[2]:
                                maxv = y[2]

                    print "Min H: " + str(minh) + "\n"
                    print "Max H: " + str(maxh) + "\n\n"
                    print "Min S: " + str(mins) + "\n"
                    print "Max S: " + str(maxs) + "\n\n"
                    print "Min V: " + str(minv) + "\n"
                    print "Max V: " + str(maxv) + "\n\n"

                    cv2.waitKey(500)
                    sys.exit(0)

            self.rect_sel.draw(vis)
            cv2.imshow('plane', vis)
            ch = cv2.waitKey(1)
            if ch == ord(' '):
                self.paused = not self.paused
            if ch == ord('c'):
                self.tracker.clear()
            if ch == 27:
                break

if __name__ == '__main__':
    print __doc__

    try: video_src = sys.argv[1]
    except: video_src = 0
    App(video_src).run()


text:
package org.apache.shiro.cache.ehcache;

import org.apache.shiro.cache.Cache;
import org.apache.shiro.util.LifecycleUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.*;

/**
 * TODO - Class JavaDoc
 *
 * @since May 11, 2010 12:41:38 PM
 */
public class EhCacheManagerTest {

    private EhCacheManager cacheManager;

    @Before
    public void setUp() {
        cacheManager = new EhCacheManager();
    }

    @After
    public void tearDown() {
        LifecycleUtils.destroy(cacheManager);
    }

    @Test
    public void testCacheManagerCreationDuringInit() {
        net.sf.ehcache.CacheManager ehCacheManager = cacheManager.getCacheManager();
        assertNull(ehCacheManager);
        cacheManager.init();
        //now assert that an internal CacheManager has been created:
        ehCacheManager = cacheManager.getCacheManager();
        assertNotNull(ehCacheManager);
    }

    @Test
    public void testLazyCacheManagerCreationWithoutCallingInit() {
        net.sf.ehcache.CacheManager ehCacheManager = cacheManager.getCacheManager();
        assertNull(ehCacheManager);

        //don't call init here - the ehcache CacheManager should be lazily created
        //because of the default Shiro ehcache.xml file in the classpath.  Just acquire a cache:
        Cache<String, String> cache = cacheManager.getCache("test");

        //now assert that an internal CacheManager has been created:
        ehCacheManager = cacheManager.getCacheManager();
        assertNotNull(ehCacheManager);

        assertNotNull(cache);
        cache.put("hello", "world");
        String value = cache.get("hello");
        assertNotNull(value);
        assertEquals(value, "world");
    }

}


text:
[Back to Install Table of Contents](README_API_INSTALL.md)

[PREVIOUS: 2. Get WeVoteServer Code from Github](README_API_INSTALL_CODE_FROM_GITHUB.md)

## Preparing a virtual environment on Mac

Mac instructions (Based on [this](http://joebergantine.com/blog/2015/apr/30/installing-python-2-and-python-3-alongside-each-ot/))

Install the latest Python 3.x from package: https://www.python.org/downloads/
(Install 3.6.1 or higher, since Python 3.6 has a known issue)

This allows you to run python3 and pip3.
(Software gets installed into /Library/Frameworks/Python.framework/Versions/3.6/bin/.)

    $ pip3 install --user virtualenv
    $ vim ~/.bash_profile

Add the following to .bash_profile, save and quit:

    alias virtualenv3='~/Library/Python/3.6/bin/virtualenv'

Update the current Terminal window to use the alias you just saved:

    $ source ~/.bash_profile

Create a place for the virtual environment to live on your hard drive. We recommend installing it
outside of "PythonProjects" folder:

    $ mkdir /Users/<YOUR NAME HERE>/PythonEnvironments/
    $ cd /Users/<YOUR NAME HERE>/PythonEnvironments/
    $ virtualenv3 WeVoteServer3.6

Now activate this new virtual environment for WeVoteServer:

    $ cd /Users/<YOUR NAME HERE>/PythonProjects/WeVoteServer/
    $ source /Users/<YOUR NAME HERE>/PythonEnvironments/WeVoteServer3.6/bin/activate
    (WeVoteServer) $ export PATH="/Applications/Postgres.app/Contents/Versions/latest/bin:$PATH"

If you need to upgrade your Python version later (Macintosh), this command does it:

    $ virtualenv3 -p /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 WeVoteServer3.6.1

Note: If you upgrade to Python 3.7.0+, tweepy package will stop working. 'streaming.py' utility has a reserved word problem, which you may fix locally.

## Continue with openssl update

After Python3 is installed, install pyopenssl and https clients:

    (WeVoteServer) $ python3 -m pip install pyopenssl pyasn1 ndg-httpsclient

## You will also need libmagic

For mac:

    (WeVoteServer) $ brew install libmagic

## Installing Python 3 on Mac

    (WeVoteServer) $ pip install django-toolbelt
    (WeVoteServer) $ pip install --upgrade pip
    (WeVoteServer) $ pip install -r requirements.txt
    (WeVoteServer) $ python3 -m pip install pyopenssl pyasn1 ndg-httpsclient

Note: If you are having trouble with some of the packages in requirements.txt ('psycopg2') make sure that the
libraries that pip is looking for under /usr/local/lib exists in that folder, or are linked from another location.
For example, for -lssl and -lcrypto to work, you may wany to do the following:

    $ ln -s /usr/local/opt/openssl/lib/libcrypto.dylib /usr/local/lib/libcrypto.dylib
    $ ln -s /usr/local/opt/openssl/lib/libssl.dylib /usr/local/lib/libssl.dylib

Initialize your environment_variables.json file (otherwise makemigrations will fail with an
'Unable to set the SECRET_KEY variable from os.environ or JSON file' error)

    (WeVoteServer) $ cp ./config/environment_variables-template.json ./config/environment_variables.json

Test with these commands:

    (WeVoteServer) $ python manage.py makemigrations
    (WeVoteServer) $ python manage.py migrate
    (WeVoteServer) $ python manage.py runserver

Note if you get a **Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5433"?**
error, make sure that the server port shown in pgAdmin4 (default install is port 5432), matches the port in
`environment_variables.json`

[NEXT: 4. Set up Environment](README_API_INSTALL_SETUP_ENVIRONMENT.md)

[Working with WeVoteServer day-to-day](README_WORKING_WITH_WE_VOTE_SERVER.md)

[Back to Install Table of Contents](README_API_INSTALL.md)


text:
=====================
django-setman Changes
=====================

0.2 (current)
-------------

+ Return default value for setting even it not stored to database.
+ Lazy process ``validators`` and ``choices`` setting attributes, don't care
  about import ordering.
+ Added labels support for ``choices`` value in ``ChoiceSetting``.
+ Use "Revert" mode in Django admin panel without including ``setman.urls``
  urlpatternsin root URLConf module.
+ Added ``get_config`` helper function.

0.1-beta
--------

- Initial release


text:
import collections

from glanceclient import exc as glance_exc
import yaml

from muranoclient.common import exceptions as exc
from muranoclient.common import utils
from muranoclient.i18n import _

def rewrap_http_exceptions(func):
    def inner(*args, **kwargs):
        try:
            return func(*args, **kwargs)
        except glance_exc.HTTPException as e:
            raise exc.from_code(e.code)
    return inner

class ArtifactRepo(object):
    def __init__(self, client, tenant=None):
        self.tenant = tenant
        self.client = client

    def create(self, fqn, data, **kwargs):

        package = utils.Package.from_file(data)
        manifest = package.manifest
        package_draft = {
            'name': manifest.get('FullName', fqn),
            'version': manifest.get('Version', '0.0.0'),
            'description': manifest.get('Description'),
            'display_name': manifest.get('Name', fqn),
            'type': manifest.get('Type', 'Application'),
            'author': manifest.get('Author'),
            'tags': manifest.get('Tags', []),
            'class_definitions': package.classes.keys()
        }
        for k, v in kwargs.items():
            package_draft[k] = v

        inherits = self._get_local_inheritance(package.classes,
                                               package.resolvers)

        # check for global inheritance
        ancestor_queue = collections.deque(inherits.keys())
        while ancestor_queue:
            ancestor_name = ancestor_queue.popleft()
            child_classes = inherits[ancestor_name]

            ancestors = self.list(class_definitions=ancestor_name)
            for ancestor in ancestors:
                # check if ancestor inherits anything
                ancestor_inherits = \
                    ancestor.type_specific_properties.get('inherits', {})
                for name, value in ancestor_inherits.items():
                    # check if this is the class we actually inherit
                    if ancestor_name in value:
                        ancestor_queue.append(name)
                        inherits[name] = child_classes

        package_draft['inherits'] = inherits

        keywords = self._keywords_from_display_name(
            package_draft['display_name'])
        keywords.extend(package_draft['tags'])
        package_draft['keywords'] = keywords

        # NOTE(ativelkov): this is very racy, but until we have a chance to
        # enforce uniqueness right in glance this is the only way to do it
        visibility = package_draft.get('visibility', 'private')
        if visibility == 'public':
            filters = {}
        else:
            filters = {'owner': self.tenant}
        existing = self.list(name=package_draft['name'],
                             version=package_draft['version'], **filters)
        try:
            next(existing)
            raise exc.HTTPConflict("Package already exists")
        except StopIteration:
            pass

        res = self.client.artifacts.create(**package_draft)
        app_id = res.id
        self.client.artifacts.upload_blob(app_id, 'archive', package.file())
        if package.logo is not None:
            self.client.artifacts.upload_blob(app_id, 'logo', package.logo)
        if package.ui is not None:
            self.client.artifacts.upload_blob(app_id, 'ui_definition',
                                              package.ui)
        package.file().close()
        self.client.artifacts.active(app_id)

        return self.client.artifacts.get(app_id)

    @staticmethod
    def _get_local_inheritance(classes, resolvers):
        result = {}
        for class_name, klass in classes.items():
            if 'Extends' not in klass:
                continue
            ns = klass.get('Namespaces')
            if ns:
                resolver = utils.NamespaceResolver(ns)
            else:
                resolver = resolvers.get(class_name)

            if isinstance(klass['Extends'], list):
                bases = klass['Extends']
            else:
                bases = [klass['Extends']]
            for base_class in bases:
                if resolver:
                    base_fqn = resolver.resolve_name(base_class)
                else:
                    base_fqn = base_class
                result.setdefault(base_fqn, []).append(class_name)
        return result

    @staticmethod
    def _keywords_from_display_name(display_name):
        return display_name.split()[:10]

    def list(self,
             sort_field='name',
             sort_dir='asc',
             type=None,
             tags=None,
             limit=None,
             page_size=None,
             **filters):
        sort = "%s:%s" % (sort_field, sort_dir)
        if type is not None:
            filters['type'] = type
        if tags is not None:
            filters['tag'] = tags
        return self.client.artifacts.list(sort=sort,
                                          limit=limit,
                                          page_size=page_size,
                                          filters=filters)

    def get(self, app_id):
        return self.client.artifacts.get(app_id)

    def delete(self, app_id):
        return self.client.artifacts.delete(app_id)

    def update(self, app_id, props_to_remove=None, **new_props):
        new_keywords = []
        new_name = new_props.get('display_name')
        new_tags = new_props.get('tags')
        if new_name:
            new_keywords.extend(self._keywords_from_display_name(new_name))
        if new_tags:
            new_keywords.extend(new_tags)
        if new_keywords:
            new_props['keywords'] = new_keywords
        visibility = new_props.get('visibility')
        if visibility == 'public':
            package = self.client.artifacts.get(app_id)
            # NOTE(ativelkov): this is very racy, but until we have a chance to
            # enforce uniqueness right in glance this is the only way to do it
            existing = self.list(name=package.name,
                                 version=package.version,
                                 visibility='public')
            try:
                while True:
                    package = next(existing)
                    if package.id == app_id:
                        continue
                    else:
                        raise exc.HTTPConflict("Package already exists")
            except StopIteration:
                pass
        return self.client.artifacts.update(app_id,
                                            remove_props=props_to_remove,
                                            **new_props)

    def toggle_active(self, app_id):
        old_val = self.get(app_id).type_specific_properties['enabled']
        return self.update(app_id, enabled=(not old_val))

    def toggle_public(self, app_id):
        visibility = self.get(app_id).visibility
        if visibility == 'public':
            return self.update(app_id, visibility='private')
        else:
            return self.update(app_id, visibility='public')

    def download(self, app_id):
        return self.client.artifacts.download_blob(app_id, 'archive')

    def get_ui(self, app_id, loader_cls=None):
        ui_stream = "".join(
            self.client.artifacts.download_blob(app_id, 'ui_definition'))
        if loader_cls is None:
            loader_cls = yaml.SafeLoader
        return yaml.load(ui_stream, loader_cls)

    def get_logo(self, app_id):
        return self.client.artifacts.download_blob(app_id, 'logo')

class PackageManagerAdapter(object):
    def __init__(self, legacy, glare):
        self.legacy = legacy
        self.glare = glare

    def categories(self):
        return self.legacy.categories()

    @rewrap_http_exceptions
    def create(self, data, files):
        is_public = data.pop('is_public', None)
        if is_public is not None:
            data['visibility'] = 'public' if is_public else 'private'
        fqn = list(files.keys())[0]
        pkg = self.glare.create(fqn, files[fqn], **data)
        return PackageWrapper(pkg)

    @rewrap_http_exceptions
    def filter(self, **kwargs):
        kwargs.pop('catalog', None)  # NOTE(ativelkov): Glare ignores 'catalog'
        include_disabled = kwargs.pop('include_disabled', False)
        order_by = kwargs.pop('order_by', None)
        search = kwargs.pop('search', None)
        category = kwargs.pop('category', None)
        fqn = kwargs.pop('fqn', None)
        class_name = kwargs.pop('class_name', None)
        name = kwargs.pop('name', None)
        if category:
            kwargs['categories'] = category
        if search:
            kwargs['keywords'] = search
        if order_by:
            kwargs['sort_field'] = order_by
        if not include_disabled:
            kwargs['enabled'] = True
        if fqn:
            kwargs['name'] = fqn
        if class_name:
            kwargs['class_definitions'] = class_name
        if name:
            kwargs['display_name'] = name
        # if 'owned' is used there should be a filter with 'owner' parameter
        if kwargs.pop('owned', None):
            kwargs['owner'] = self.glare.tenant

        for pkg in self.glare.list(**kwargs):
            yield PackageWrapper(pkg)

    @rewrap_http_exceptions
    def list(self, include_disabled=False):
        return self.filter(include_disabled=include_disabled)

    @rewrap_http_exceptions
    def delete(self, app_id):
        return self.glare.delete(app_id)

    @rewrap_http_exceptions
    def get(self, app_id):
        return PackageWrapper(self.glare.get(app_id))

    @rewrap_http_exceptions
    def update(self, app_id, body, operation='replace'):
        is_public = body.pop('is_public', None)
        name = body.pop('name', None)
        if is_public is not None:
            body['visibility'] = 'public' if is_public else 'private'
        if name is not None:
            body['display_name'] = name

        if operation == 'replace':
            return PackageWrapper(self.glare.update(app_id, None, **body))

    @rewrap_http_exceptions
    def toggle_active(self, app_id):
        return self.glare.toggle_active(app_id)

    @rewrap_http_exceptions
    def toggle_public(self, app_id):
        return self.glare.toggle_public(app_id)

    @rewrap_http_exceptions
    def download(self, app_id):
        return "".join(self.glare.download(app_id))

    @rewrap_http_exceptions
    def get_logo(self, app_id):
        return "".join(self.glare.get_logo(app_id))

    @rewrap_http_exceptions
    def get_ui(self, app_id, loader_cls=None):
        return self.legacy.get_ui(app_id, loader_cls)

class PackageWrapper(object):
    def __init__(self, item):
        self._item = item

    @property
    def updated(self):
        return self._item.updated_at

    @property
    def created(self):
        return self._item.created_at

    @property
    def is_public(self):
        return self._item.visibility == 'public'

    @property
    def name(self):
        return self._item.type_specific_properties['display_name']

    @property
    def fully_qualified_name(self):
        return self._item.name

    @property
    def owner_id(self):
        return self._item.owner

    def __getstate__(self):
        return {"item": self._item}

    def __setstate__(self, state):
        self._item = state['item']

    def __getattr__(self, name):
        if name in self._item.type_specific_properties:
            return self._item.type_specific_properties.get(name)
        else:
            return getattr(self._item, name)

    def to_dict(self):
        keys = ('author', 'categories', 'class_definitions', 'created',
                'description', 'enabled', 'fully_qualified_name', 'id',
                'is_public', 'name', 'owner_id', 'tags', 'type',
                'updated')
        missing_keys = [key for key in keys if not hasattr(self, key)]
        if missing_keys:
            raise KeyError(_("Some attributes are missing in "
                             "%(pkg_name)s: %(attrs)s.") %
                           {'pkg_name': self.name,
                            'attrs': ", ".join(missing_keys)})
        return {key: getattr(self, key) for key in keys}


text:
.tundra .dijitCalendarRtl .dijitCalendarDecrease {
	background-position: -30px top;
}
.tundra .dijitCalendarRtl .dijitCalendarIncrease {
	background-position: 0 top;
}


text:
package <%= base_package %>;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
<% if options[:gin] -%>
import com.google.gwt.inject.client.GinModules;
import com.google.gwt.inject.client.Ginjector;
<% end -%>
<% if options[:place] -%>
import com.google.gwt.place.shared.PlaceHistoryHandler;
<% end -%>

import <%= gwt_rails_package %>.Application;
import <%= gwt_rails_package %>.dispatchers.DefaultDispatcherSingleton;

import org.fusesource.restygwt.client.Defaults;

/**
 * Entry point classes define onModuleLoad().
 */
public class <%= application_class_name %>EntryPoint implements EntryPoint {
<% if options[:gin] -%>

    @GinModules(<%= application_class_name %>GinModule.class)
    static public interface <%= application_class_name %>Ginjector extends Ginjector {
<% if options[:place] -%>
        PlaceHistoryHandler getPlaceHistoryHandler();
<% end -%>
        Application getApplication();
    }
<% end -%>

    /**
     * This is the entry point method.
     */
    public void onModuleLoad() {
        Defaults.setServiceRoot(GWT.getModuleBaseURL().replaceFirst("[a-zA-Z0-9_]+/$", ""));
        Defaults.setDispatcher(DefaultDispatcherSingleton.INSTANCE);
        GWT.log("base url for restservices: " + Defaults.getServiceRoot());
<% if options[:gin] -%>

        final <%= application_class_name %>Ginjector injector = GWT.create(<%= application_class_name %>Ginjector.class);

        // setup display
        injector.getApplication().run();
<% if options[:place] -%>

        // Goes to the place represented on URL else default place
        injector.getPlaceHistoryHandler().handleCurrentHistory();
<% end -%>
<% else -%>
        new <%= application_class_name %>Application().run();
<% end -%>
    }
}


text:
package de.flapdoodle.guava.functions;

import com.google.common.base.Function;

public final class NoTransformation<T> implements Function<T, T> {

    @Override
    public final T apply(T input) {
        return input;
    }
}


text:
title: "Gua Sha Tool"
product-category: topicals
name: "Gua Sha Tool"
description: "Rose Quartz"
size: "4.0in"
strength: blank
image-url: "/assets/img/products/gua-sha-rose-quartz.jpg"
image-large-url: "/assets/img/products/large/gua-sha-rose-quartz.jpg"
price: 20
price_wholesale: 10
price_case: 60
weight: 50
weight_case: 300
case-count: 6

display_order: 9999
cell_layout:
new: false
is_crystal: false
stackable: true

sitemap: true
orderable: true
hidden: false

out_of_stock_message:

long_description: Not only essential for beauty, this genuine Rose Quartz tool is amazing for anyone on the self-care journey. Gua Sha relies on tender, undivided attention and affection to parts of the body that many of us have overlooked or neglected for so long. Rose Quartz is the stone of unconditional love, so it's only fitting that this self love tool is carved from it.

ingredients: blank

directions: Oil your skin with your favorite Life Flower product. On your skin use repeated, firm strokes that move away from the face and/or down towards the heart.

product-notes: blank

history: blank

healing-properties: >-
  Intended by Traditional Chinese Medicine to address stagnant energy (chi) in the body, Gua Sha is an essential 2000+ year old healing, self-care technique that can be used both on body and face.

  It consists of repeated, firm strokes away from the face/down towards the heart over oiled skin with a smooth edged tool like the one pictured. This motion breaks up stagnation in our lymphatic system (LS) - responsible for aiding the body in the removal of toxins and waste. Our LS is twice the size of our circulatory system, yet it has no pump to cleanse it like the heart does for the circulatory system. The movement of lymph relies solely on diet, lifestyle and massage which is why it easily gets stagnant, leading to inflammation and other dis-ease in the body.

  Facial Gua Sha treatment is dubbed 'Eastern Botox' because it actually smoothes out lines/wrinkles, tones muscles, and increases collagen and elasticity in the skin. Since it moves stagnant lymphatic fluid that gets built up, it also carries away toxins and debris that can contribute to acne-prone skin.
---


text:
/**********************************************************\

  This file is distributed under the MIT License.
  See https://github.com/morzhovets/momo/blob/master/LICENSE
  for details.

  tests/LibcxxHashMapTesterLimP.cpp

\**********************************************************/

#include "pch.h"

#ifdef TEST_LIBCXX_HASH_MAP
#ifdef TEST_OLD_HASH_BUCKETS

#include "../../momo/details/HashBucketLimP.h"

#define LIBCXX_TEST_BUCKET momo::HashBucketLimP<>
#define LIBCXX_TEST_BUCKET_NAME "limp"

#include "LibcxxHashMapTester.h"

#endif // TEST_OLD_HASH_BUCKETS
#endif // TEST_LIBCXX_HASH_MAP


text:
[JS Beautifier HTML](https://github.com/beautify-web/js-beautify) support for [JSTransformers](http://github.com/jstransformers).

[![Build Status](https://img.shields.io/travis/jstransformers/jstransformer-html-beautify/master.svg)](https://travis-ci.org/jstransformers/jstransformer-html-beautify)
[![Coverage Status](https://img.shields.io/codecov/c/github/jstransformers/jstransformer-html-beautify/master.svg)](https://codecov.io/gh/jstransformers/jstransformer-html-beautify)
[![Dependency Status](https://img.shields.io/david/jstransformers/jstransformer-html-beautify/master.svg)](http://david-dm.org/jstransformers/jstransformer-html-beautify)
[![NPM version](https://img.shields.io/npm/v/jstransformer-html-beautify.svg)](https://www.npmjs.org/package/jstransformer-html-beautify)

## Installation

    npm install jstransformer-html-beautify

## API

```js
var beautify = require('jstransformer')(require('jstransformer-html-beautify'))

beautify.render('<strong > Hello World! </strong  >').body
//=> '<strong>Hello World!</strong>'
```

## License

MIT


text:
package org.pitest.mutationtest.engine.gregor.mutators;

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

import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.pitest.mutationtest.engine.MutationIdentifier;
import org.pitest.mutationtest.engine.gregor.MethodInfo;
import org.pitest.mutationtest.engine.gregor.MethodMutatorFactory;
import org.pitest.mutationtest.engine.gregor.MutationContext;

public class RemoveConditionalMutator implements MethodMutatorFactory {

  // REMOVE_CONDITIONALS_MUTATOR;

  // EQUAL : Mutate only equality operators
  // ORDER : Mutate only Ordering operators
  public enum Choice {
    EQUAL("equality"), ORDER("comparison");
    private String desc;

    Choice(String desc) {
      this.desc = desc;
    }

    String description() {
      return this.desc;
    }
  }

  private final Choice  kind;
  private final boolean replaceWith; // Default is true

  public RemoveConditionalMutator(final Choice c, final boolean rc) {
    this.kind = c;
    this.replaceWith = rc;
  }

  public static Iterable<MethodMutatorFactory> makeMutators() {
    final List<MethodMutatorFactory> variations = new ArrayList<MethodMutatorFactory>();
    final Choice[] allChoices = { Choice.EQUAL, Choice.ORDER };
    final boolean[] arrWith = { true, false };
    for (final Choice c : allChoices) {
      for (final boolean b : arrWith) {
        variations.add(new RemoveConditionalMutator(c, b));
      }
    }
    return variations;
  }

  @Override
  public MethodVisitor create(final MutationContext context,
      final MethodInfo methodInfo, final MethodVisitor methodVisitor) {
    return new RemoveConditionalMethodVisitor(this, context, methodVisitor,
        "removed conditional - replaced " + this.kind.description()
            + " check with " + this.replaceWith);
  }

  @Override
  public String getGloballyUniqueId() {
    return this.getClass().getName() + "_" + this.kind + "_"
        + (this.replaceWith ? "IF" : "ELSE");
  }

  @Override
  public String getName() {
    return "REMOVE_CONDITIONALS_" + this.kind + "_"
        + (this.replaceWith ? "IF" : "ELSE") + "_MUTATOR";
  }

  private final class RemoveConditionalMethodVisitor extends MethodVisitor {

    private final String               description;
    private final MutationContext      context;
    private final MethodMutatorFactory factory;

    RemoveConditionalMethodVisitor(final MethodMutatorFactory factory,
        final MutationContext context,
        final MethodVisitor delegateMethodVisitor, String description) {
      super(Opcodes.ASM5, delegateMethodVisitor);
      this.context = context;
      this.factory = factory;
      this.description = description;
    }

    @Override
    public void visitJumpInsn(final int opcode, final Label label) {

      if (canMutate(opcode)) {
        final MutationIdentifier newId = this.context.registerMutation(
            this.factory, this.description);

        if (this.context.shouldMutate(newId)) {
          emptyStack(opcode);
          if (!RemoveConditionalMutator.this.replaceWith) {
            super.visitJumpInsn(Opcodes.GOTO, label);
          }
        } else {
          this.mv.visitJumpInsn(opcode, label);
        }
      } else {
        this.mv.visitJumpInsn(opcode, label);
      }

    }

    private void emptyStack(final int opcode) {
      switch (opcode) {
      // EQUAL
      case Opcodes.IF_ICMPNE:
      case Opcodes.IF_ICMPEQ:
      case Opcodes.IF_ACMPEQ:
      case Opcodes.IF_ACMPNE:
        // ORDER
      case Opcodes.IF_ICMPGE:
      case Opcodes.IF_ICMPGT:
      case Opcodes.IF_ICMPLE:
      case Opcodes.IF_ICMPLT:
        super.visitInsn(Opcodes.POP2);
        break;
      default:
        super.visitInsn(Opcodes.POP);
      }

    }

    private boolean canMutate(final int opcode) {
      switch (opcode) {
      case Opcodes.IFLE:
      case Opcodes.IFGE:
      case Opcodes.IFGT:
      case Opcodes.IFLT:
      case Opcodes.IF_ICMPGE:
      case Opcodes.IF_ICMPGT:
      case Opcodes.IF_ICMPLE:
      case Opcodes.IF_ICMPLT:
        return (RemoveConditionalMutator.this.kind == Choice.ORDER);
      case Opcodes.IFEQ:
      case Opcodes.IFNE:
      case Opcodes.IFNONNULL:
      case Opcodes.IFNULL:
      case Opcodes.IF_ICMPNE:
      case Opcodes.IF_ICMPEQ:
      case Opcodes.IF_ACMPEQ:
      case Opcodes.IF_ACMPNE:
        return (RemoveConditionalMutator.this.kind == Choice.EQUAL);
      default:
        return false;
      }
    }

  }
}