text:
struct hsva { double h,s,v,a; };
struct rgba { double r,g,b,a; };
struct rgba_pair { struct rgba bg,fg; };
struct rgba_values { unsigned long long int r,g,b,a; };

typedef char rgba_hex[10];

enum {
  RGBA_8,
  RGBA_16,
  RGBA_32,
  RGBA_64
};

void     align_channels     (double* dest, double* src1, double* src2, double v1, double v2);
int      convert_hex        (double* cvals, char* str);
void     extract_components (double* cvals, char* str);

inline static
void rgba_set (struct rgba *c, double r, double g, double b, double a) {
  c->r = r;
  c->g = g;
  c->b = b;
  c->a = a;
}

int      rgba_from_str      (struct rgba* c, char* str);
void     rgba_desaturate    (struct rgba* dest, struct rgba* src);
void     rgba_fade          (struct rgba* dest, struct rgba* src1, struct rgba* src2, double v1, double v2);
void     rgba_shade         (struct rgba* c, double v);
void     rgba_to_hsva       (struct rgba* in, struct hsva* out);
void     rgba_to_hex        (struct rgba* c, char* dest, bool alpha);
uint32_t rgba_to_uint32     (struct rgba* c);
void     rgba_values        (struct rgba* c, struct rgba_values* v, int prec);

inline static
void hsva_set (struct hsva *c, double h, double s, double v, double a) {
  c->h = h;
  c->s = s;
  c->v = v;
  c->a = a;
}

int      hsva_from_str      (struct hsva* c, char* str);
void     hsva_fade          (struct hsva* dest, struct hsva* src1, struct hsva* src2, double v1, double v2);
void     hsva_shade         (struct hsva* c, double v);
void     hsva_to_rgba       (struct hsva* in, struct rgba* out);

#endif


text:
package ch.difty.scipamato.core.pubmed.api;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

/**
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "pmid",
    "articleIdList",
    "book",
    "locationLabel",
    "articleTitle",
    "vernacularTitle",
    "pagination",
    "language",
    "authorList",
    "investigatorList",
    "publicationType",
    "_abstract",
    "sections",
    "keywordList",
    "contributionDate",
    "dateRevised",
    "citationString",
    "grantList",
    "itemList"
})
@XmlRootElement(name = "BookDocument")
public class BookDocument {

    @XmlElement(name = "PMID", required = true)
    protected PMID pmid;
    @XmlElement(name = "ArticleIdList", required = true)
    protected ArticleIdList articleIdList;
    @XmlElement(name = "Book", required = true)
    protected Book book;
    @XmlElement(name = "LocationLabel")
    protected List<LocationLabel> locationLabel;
    @XmlElement(name = "ArticleTitle")
    protected ArticleTitle articleTitle;
    @XmlElement(name = "VernacularTitle")
    protected String vernacularTitle;
    @XmlElement(name = "Pagination")
    protected Pagination pagination;
    @XmlElement(name = "Language")
    protected List<Language> language;
    @XmlElement(name = "AuthorList")
    protected List<AuthorList> authorList;
    @XmlElement(name = "InvestigatorList")
    protected InvestigatorList investigatorList;
    @XmlElement(name = "PublicationType")
    protected List<PublicationType> publicationType;
    @XmlElement(name = "Abstract")
    protected Abstract _abstract;
    @XmlElement(name = "Sections")
    protected Sections sections;
    @XmlElement(name = "KeywordList")
    protected List<KeywordList> keywordList;
    @XmlElement(name = "ContributionDate")
    protected ContributionDate contributionDate;
    @XmlElement(name = "DateRevised")
    protected DateRevised dateRevised;
    @XmlElement(name = "CitationString")
    protected String citationString;
    @XmlElement(name = "GrantList")
    protected GrantList grantList;
    @XmlElement(name = "ItemList")
    protected List<ItemList> itemList;

    /**
     * Ruft den Wert der pmid-Eigenschaft ab.
     *
     * @return
     *     possible object is
     *     {@link PMID }
     *
     */
    public PMID getPMID() {
        return pmid;
    }

    /**
     * Legt den Wert der pmid-Eigenschaft fest.
     *
     * @param value
     *     allowed object is
     *     {@link PMID }
     *
     */
    public void setPMID(PMID value) {
        this.pmid = value;
    }

    /**
     * Ruft den Wert der articleIdList-Eigenschaft ab.
     *
     * @return
     *     possible object is
     *     {@link ArticleIdList }
     *
     */
    public ArticleIdList getArticleIdList() {
        return articleIdList;
    }

    /**
     * Legt den Wert der articleIdList-Eigenschaft fest.
     *
     * @param value
     *     allowed object is
     *     {@link ArticleIdList }
     *
     */
    public void setArticleIdList(ArticleIdList value) {
        this.articleIdList = value;
    }

    /**
     * Ruft den Wert der book-Eigenschaft ab.
     *
     * @return
     *     possible object is
     *     {@link Book }
     *
     */
    public Book getBook() {
        return book;
    }

    /**
     * Legt den Wert der book-Eigenschaft fest.
     *
     * @param value
     *     allowed object is
     *     {@link Book }
     *
     */
    public void setBook(Book value) {
        this.book = value;
    }

    /**
     * Gets the value of the locationLabel property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the locationLabel property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getLocationLabel().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link LocationLabel }
     *
     *
     */
    public List<LocationLabel> getLocationLabel() {
        if (locationLabel == null) {
            locationLabel = new ArrayList<LocationLabel>();
        }
        return this.locationLabel;
    }

    /**
     * Ruft den Wert der articleTitle-Eigenschaft ab.
     *
     * @return
     *     possible object is
     *     {@link ArticleTitle }
     *
     */
    public ArticleTitle getArticleTitle() {
        return articleTitle;
    }

    /**
     * Legt den Wert der articleTitle-Eigenschaft fest.
     *
     * @param value
     *     allowed object is
     *     {@link ArticleTitle }
     *
     */
    public void setArticleTitle(ArticleTitle value) {
        this.articleTitle = value;
    }

    /**
     * Ruft den Wert der vernacularTitle-Eigenschaft ab.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getVernacularTitle() {
        return vernacularTitle;
    }

    /**
     * Legt den Wert der vernacularTitle-Eigenschaft fest.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setVernacularTitle(String value) {
        this.vernacularTitle = value;
    }

    /**
     * Ruft den Wert der pagination-Eigenschaft ab.
     *
     * @return
     *     possible object is
     *     {@link Pagination }
     *
     */
    public Pagination getPagination() {
        return pagination;
    }

    /**
     * Legt den Wert der pagination-Eigenschaft fest.
     *
     * @param value
     *     allowed object is
     *     {@link Pagination }
     *
     */
    public void setPagination(Pagination value) {
        this.pagination = value;
    }

    /**
     * Gets the value of the language property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the language property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getLanguage().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link Language }
     *
     *
     */
    public List<Language> getLanguage() {
        if (language == null) {
            language = new ArrayList<Language>();
        }
        return this.language;
    }

    /**
     * Gets the value of the authorList property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the authorList property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getAuthorList().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link AuthorList }
     *
     *
     */
    public List<AuthorList> getAuthorList() {
        if (authorList == null) {
            authorList = new ArrayList<AuthorList>();
        }
        return this.authorList;
    }

    /**
     * Ruft den Wert der investigatorList-Eigenschaft ab.
     *
     * @return
     *     possible object is
     *     {@link InvestigatorList }
     *
     */
    public InvestigatorList getInvestigatorList() {
        return investigatorList;
    }

    /**
     * Legt den Wert der investigatorList-Eigenschaft fest.
     *
     * @param value
     *     allowed object is
     *     {@link InvestigatorList }
     *
     */
    public void setInvestigatorList(InvestigatorList value) {
        this.investigatorList = value;
    }

    /**
     * Gets the value of the publicationType property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the publicationType property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getPublicationType().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link PublicationType }
     *
     *
     */
    public List<PublicationType> getPublicationType() {
        if (publicationType == null) {
            publicationType = new ArrayList<PublicationType>();
        }
        return this.publicationType;
    }

    /**
     * Ruft den Wert der abstract-Eigenschaft ab.
     *
     * @return
     *     possible object is
     *     {@link Abstract }
     *
     */
    public Abstract getAbstract() {
        return _abstract;
    }

    /**
     * Legt den Wert der abstract-Eigenschaft fest.
     *
     * @param value
     *     allowed object is
     *     {@link Abstract }
     *
     */
    public void setAbstract(Abstract value) {
        this._abstract = value;
    }

    /**
     * Ruft den Wert der sections-Eigenschaft ab.
     *
     * @return
     *     possible object is
     *     {@link Sections }
     *
     */
    public Sections getSections() {
        return sections;
    }

    /**
     * Legt den Wert der sections-Eigenschaft fest.
     *
     * @param value
     *     allowed object is
     *     {@link Sections }
     *
     */
    public void setSections(Sections value) {
        this.sections = value;
    }

    /**
     * Gets the value of the keywordList property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the keywordList property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getKeywordList().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link KeywordList }
     *
     *
     */
    public List<KeywordList> getKeywordList() {
        if (keywordList == null) {
            keywordList = new ArrayList<KeywordList>();
        }
        return this.keywordList;
    }

    /**
     * Ruft den Wert der contributionDate-Eigenschaft ab.
     *
     * @return
     *     possible object is
     *     {@link ContributionDate }
     *
     */
    public ContributionDate getContributionDate() {
        return contributionDate;
    }

    /**
     * Legt den Wert der contributionDate-Eigenschaft fest.
     *
     * @param value
     *     allowed object is
     *     {@link ContributionDate }
     *
     */
    public void setContributionDate(ContributionDate value) {
        this.contributionDate = value;
    }

    /**
     * Ruft den Wert der dateRevised-Eigenschaft ab.
     *
     * @return
     *     possible object is
     *     {@link DateRevised }
     *
     */
    public DateRevised getDateRevised() {
        return dateRevised;
    }

    /**
     * Legt den Wert der dateRevised-Eigenschaft fest.
     *
     * @param value
     *     allowed object is
     *     {@link DateRevised }
     *
     */
    public void setDateRevised(DateRevised value) {
        this.dateRevised = value;
    }

    /**
     * Ruft den Wert der citationString-Eigenschaft ab.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getCitationString() {
        return citationString;
    }

    /**
     * Legt den Wert der citationString-Eigenschaft fest.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setCitationString(String value) {
        this.citationString = value;
    }

    /**
     * Ruft den Wert der grantList-Eigenschaft ab.
     *
     * @return
     *     possible object is
     *     {@link GrantList }
     *
     */
    public GrantList getGrantList() {
        return grantList;
    }

    /**
     * Legt den Wert der grantList-Eigenschaft fest.
     *
     * @param value
     *     allowed object is
     *     {@link GrantList }
     *
     */
    public void setGrantList(GrantList value) {
        this.grantList = value;
    }

    /**
     * Gets the value of the itemList property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the itemList property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getItemList().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link ItemList }
     *
     *
     */
    public List<ItemList> getItemList() {
        if (itemList == null) {
            itemList = new ArrayList<ItemList>();
        }
        return this.itemList;
    }

}

redpajama_set_name: RedPajamaGithub


text:
#app-container{
    overflow-x: hidden;
}

#empty-message{
    display: inline-block;
    font-size: 28px;
    width: 200px;
    margin-right: 60px;
    margin-top: 30px;
    font-family: "Source Sans Pro";
}

#empty-message-arrow{
    position: absolute;
    right: 42px;
    top: 40px;
}

.library-items{
    margin: 20px 10px;
}
.library-item{
    position: relative;

    padding-bottom: 20px;
}

.offscreenText{
    display:none;
}

.details{
    display: none;
}

.details-body .buttons{
    position: absolute;
    bottom: 0px;
    width: 100%;
    min-width: 150%;
    text-align: left;
}

.no-cover{

    cursor: pointer;

    height: 190px;

    width: 142px;
    font-size: 19px;

    display: table;

    table-layout: fixed;

    padding: 0;
    color: white;
    font-family: serif;
}

.no-cover p{
    display: table-cell;

    word-wrap: break-word;
    overflow-wrap: break-word;

    vertical-align: middle;
    text-align: center;

    padding-left: 10px;
    padding-right: 10px;
}

.details-body .no-cover{
    width: 150px;
    height: 200px;
    font-size: 20px;
}

.modal-cover-wrap img{
    max-width: 150px;
    max-height: 200px;
}

.modal-cover-wrap{
    position: relative;
    margin-right: 20px;
    height: 240px;
    display: inline-block;
    max-width: 185px;
    vertical-align: top;
}
.modal-book-info{
    display: inline-block;
    vertical-align: top;
    max-width: 370px;
}
.details-body{
    height: 100%;
}

.title, .author{
    /*text-align: center;*/
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-left:5px;
    font-family: "Source Sans Pro"
}

.title{
    margin-top: 5px;
    margin-bottom: 5px;
    font-weight: bold;
    font-size: 16px;
}

.author{
    color: #555;
}

nav #remotestorage-widget, nav #remotestorage-widget .rs-cube {
    position: static;
}

/* list view styles */
body.list-view #app-container{
    position: relative;
}
body.list-view #app-container .library-item{
    width: 100%;
    height: 250px;
    position: static;
    display: table-row;
}

body:not(.list-view) #app-container .library-item .info-wrap .no-cover {
    border: 1px solid #efefef;
    border-radius: 3px;
}

body:not(.list-view) #app-container .library-item .info-wrap button {
    width: 110%;
}

body.list-view #app-container .library-item .book-info,
body.list-view #app-container .library-item .info-wrap{
    display: table-cell;
    vertical-align: middle;
}

body.list-view #app-container .library-item .book-info{
    padding-left: 20px;
}

body.list-view #app-container .library-item .book-info .title{
    font-size: 24px;
    font-weight: normal;
    text-align: left;
    white-space: normal;
}
body.list-view #app-container .library-item .book-info .author{
    text-align: left;
}

/*
body.list-view #app-container .library-item img{
    height: 190px;
    width: 142px;
    max-width: 142px;
}
*/

.has-cover{
    background-repeat:no-repeat;
    background-position:center;
    background-attachment:scroll;

    background-size:contain;

    -webkit-background-clip:content-box;
    -webkit-background-origin:content-box;
}

body.list-view .buttons{
    margin-top: 10px;
}
body.list-view .details{
    display: inline;
}

@media (max-width:768px){

    .library-item .book-info{
        display: none;
    }

    body.list-view #app-container .library-item .info-wrap{
        padding-bottom: 0px;
        padding-left: 0px;
    }
}

/*.icon-library, .icon-library:active{
  background-image: url('../images/glyphicons_319_sort.png');
}

.icon-add-epub, .icon-add-epub:active{
  background-image: url('../images/glyphicons_432_plus.png');
}

.icon-thumbnails, .icon-thumbnails:active{
  background-image: url('../images/glyphicons_156_show_thumbnails.png');
}

.icon-list-view, .icon-list-view:active{
  background-image: url('../images/glyphicons_158_show_lines.png');
}*/

.icon-thumbnails{
    display:none;
}

.list-view .icon-thumbnails{
    display:block;
}

.list-view .icon-list-view{
    display:none;
}

.library-item button[data-link] div p {
    margin: 0;
    padding: 0;
}
.library-item button[data-link] div p:before {

    content: ">>>>";

    font-family: sans-serif;
    font-weight: bold;

    font-size: 0.5em;
    padding: 0.3em;
    margin: 0;

    background-color: black;
    color: white;

    border: 0.12em solid white;

    opacity: 0.8;

    width: 100%;

    display: inline-block;
    vertical-align: middle;
    line-height: normal;
}

/* biblemesh_ items follow */

#empty-message {
	display: block;
	width: auto;
	text-align: center;
	margin: 80px 0 0;
	font-size: 19px;
	font-family: inherit;
}

.title, .author, .modal-book-info {
    font-family: 'Montserrat', sans-serif;
}

.list-view .icon-thumbnails {
    display: inline-block;
}

#app-container {
  -webkit-overflow-scrolling: touch;
}


text:
class eavlTesselate2DFilter : public eavlFilter
{
  protected:
    string cellsetname;
  public:
    eavlTesselate2DFilter();
    void SetCellSet(const string &name)
    {
        cellsetname = name;
    }

    virtual void Execute();
};

#endif


text:
package com.angkorteam.fintech.pages.charge;

import java.util.List;
import java.util.Map;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.authroles.authorization.strategies.role.annotations.AuthorizeInstantiation;
import org.apache.wicket.markup.html.form.CheckBox;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.request.mapper.parameter.PageParameters;

import com.angkorteam.fintech.Page;
import com.angkorteam.fintech.Session;
import com.angkorteam.fintech.ddl.MCharge;
import com.angkorteam.fintech.ddl.MOrganisationCurrency;
import com.angkorteam.fintech.ddl.MTaxGroup;
import com.angkorteam.fintech.dto.Function;
import com.angkorteam.fintech.dto.builder.ChargeBuilder;
import com.angkorteam.fintech.dto.enums.ChargeCalculation;
import com.angkorteam.fintech.dto.enums.ChargeFrequency;
import com.angkorteam.fintech.dto.enums.ChargePayment;
import com.angkorteam.fintech.dto.enums.ChargeTime;
import com.angkorteam.fintech.helper.ChargeHelper;
import com.angkorteam.fintech.layout.Size;
import com.angkorteam.fintech.layout.UIBlock;
import com.angkorteam.fintech.layout.UIContainer;
import com.angkorteam.fintech.layout.UIRow;
import com.angkorteam.fintech.pages.ProductDashboardPage;
import com.angkorteam.fintech.provider.ChargeCalculationProvider;
import com.angkorteam.fintech.provider.ChargeFrequencyProvider;
import com.angkorteam.fintech.provider.ChargePaymentProvider;
import com.angkorteam.fintech.provider.ChargeTimeProvider;
import com.angkorteam.fintech.provider.CurrencyProvider;
import com.angkorteam.fintech.provider.SingleChoiceProvider;
import com.angkorteam.framework.SpringBean;
import com.angkorteam.framework.jdbc.SelectQuery;
import com.angkorteam.framework.models.PageBreadcrumb;
import com.angkorteam.framework.spring.JdbcNamed;
import com.angkorteam.framework.wicket.ajax.form.OnChangeAjaxBehavior;
import com.angkorteam.framework.wicket.markup.html.form.Button;
import com.angkorteam.framework.wicket.markup.html.form.Form;
import com.angkorteam.framework.wicket.markup.html.form.select2.Option;
import com.angkorteam.framework.wicket.markup.html.form.select2.Select2SingleChoice;
import com.google.common.collect.Lists;

import io.github.openunirest.http.JsonNode;

@AuthorizeInstantiation(Function.ALL_FUNCTION)
public class LoanChargeModifyPage extends Page {

    protected String chargeId;

    protected Form<Void> form;
    protected Button saveButton;
    protected BookmarkablePageLink<Void> closeLink;

    protected UIRow row1;

    protected UIBlock nameBlock;
    protected UIContainer nameIContainer;
    protected String nameValue;
    protected TextField<String> nameField;

    protected UIBlock row1Block1;

    protected UIRow row2;

    protected UIBlock currencyBlock;
    protected UIContainer currencyIContainer;
    protected CurrencyProvider currencyProvider;
    protected Option currencyValue;
    protected Select2SingleChoice<Option> currencyField;

    protected UIBlock row2Block1;

    protected UIRow row3;

    protected UIBlock chargeTimeBlock;
    protected UIContainer chargeTimeIContainer;
    protected ChargeTimeProvider chargeTimeProvider;
    protected Option chargeTimeValue;
    protected Select2SingleChoice<Option> chargeTimeField;

    protected UIBlock row3Block1;

    protected UIRow row4;

    protected UIBlock chargeCalculationBlock;
    protected UIContainer chargeCalculationIContainer;
    protected ChargeCalculationProvider chargeCalculationProvider;
    protected Option chargeCalculationValue;
    protected Select2SingleChoice<Option> chargeCalculationField;

    protected UIBlock row4Block1;

    protected UIRow row5;

    protected UIBlock chargePaymentBlock;
    protected UIContainer chargePaymentIContainer;
    protected ChargePaymentProvider chargePaymentProvider;
    protected Option chargePaymentValue;
    protected Select2SingleChoice<Option> chargePaymentField;

    protected UIBlock row5Block1;

    protected UIRow row6;

    protected UIBlock feeFrequencyBlock;
    protected UIContainer feeFrequencyIContainer;
    protected Boolean feeFrequencyValue;
    protected CheckBox feeFrequencyField;

    protected UIBlock row6Block1;

    protected UIRow row7;

    protected UIBlock chargeFrequencyBlock;
    protected UIContainer chargeFrequencyIContainer;
    protected ChargeFrequencyProvider chargeFrequencyProvider;
    protected Option chargeFrequencyValue;
    protected Select2SingleChoice<Option> chargeFrequencyField;

    protected UIBlock frequencyIntervalBlock;
    protected UIContainer frequencyIntervalIContainer;
    protected Long frequencyIntervalValue;
    protected TextField<Long> frequencyIntervalField;

    protected UIRow row8;

    protected UIBlock amountBlock;
    protected UIContainer amountIContainer;
    protected Double amountValue;
    protected TextField<Double> amountField;

    protected UIBlock row8Block1;

    protected UIRow row9;

    protected UIBlock activeBlock;
    protected UIContainer activeIContainer;
    protected Boolean activeValue;
    protected CheckBox activeField;

    protected UIBlock penaltyBlock;
    protected UIContainer penaltyIContainer;
    protected Boolean penaltyValue;
    protected CheckBox penaltyField;

    protected UIBlock row9Block1;

    protected UIRow row10;

    protected UIBlock taxGroupBlock;
    protected UIContainer taxGroupIContainer;
    protected SingleChoiceProvider taxGroupProvider;
    protected Option taxGroupValue;
    protected Select2SingleChoice<Option> taxGroupField;

    protected UIBlock row10Block1;

    @Override
    public IModel<List<PageBreadcrumb>> buildPageBreadcrumb() {
        List<PageBreadcrumb> BREADCRUMB = Lists.newArrayList();
        {
            PageBreadcrumb breadcrumb = new PageBreadcrumb();
            breadcrumb.setLabel("Admin");
            BREADCRUMB.add(breadcrumb);
        }
        {
            PageBreadcrumb breadcrumb = new PageBreadcrumb();
            breadcrumb.setLabel("Product");
            breadcrumb.setPage(ProductDashboardPage.class);
            BREADCRUMB.add(breadcrumb);
        }
        {
            PageBreadcrumb breadcrumb = new PageBreadcrumb();
            breadcrumb.setLabel("Charge");
            breadcrumb.setPage(ChargeBrowsePage.class);
            BREADCRUMB.add(breadcrumb);
        }
        {
            PageBreadcrumb breadcrumb = new PageBreadcrumb();
            breadcrumb.setLabel("Loan Charge Modify");
            BREADCRUMB.add(breadcrumb);
        }
        return Model.ofList(BREADCRUMB);
    }

    @Override
    protected void initData() {
        JdbcNamed named = SpringBean.getBean(JdbcNamed.class);
        PageParameters parameters = getPageParameters();
        this.chargeId = parameters.get("chargeId").toString("");

        SelectQuery selectQuery = null;

        selectQuery = new SelectQuery(MCharge.NAME);
        selectQuery.addWhere(MCharge.Field.ID + " = :" + MCharge.Field.ID, this.chargeId);
        selectQuery.addField(MCharge.Field.NAME);
        selectQuery.addField(MCharge.Field.CURRENCY_CODE);
        selectQuery.addField(MCharge.Field.CHARGE_TIME_ENUM);
        selectQuery.addField(MCharge.Field.CHARGE_CALCULATION_ENUM);
        selectQuery.addField(MCharge.Field.CHARGE_PAYMENT_MODE_ENUM);
        selectQuery.addField(MCharge.Field.AMOUNT);
        selectQuery.addField(MCharge.Field.IS_ACTIVE);
        selectQuery.addField(MCharge.Field.IS_PENALTY);
        selectQuery.addField(MCharge.Field.TAX_GROUP_ID);
        selectQuery.addField(MCharge.Field.FEE_FREQUENCY);
        selectQuery.addField(MCharge.Field.FEE_INTERVAL);

        Map<String, Object> chargeObject = named.queryForMap(selectQuery.toSQL(), selectQuery.getParam());

        this.nameValue = (String) chargeObject.get(MCharge.Field.NAME);

        selectQuery = new SelectQuery(MOrganisationCurrency.NAME);
        selectQuery.addField(MOrganisationCurrency.Field.CODE + " as id");
        selectQuery.addField("concat(" + MOrganisationCurrency.Field.NAME + ",' [', " + MOrganisationCurrency.Field.CODE + ",']') text");
        selectQuery.addWhere(MOrganisationCurrency.Field.CODE + " = :" + MOrganisationCurrency.Field.CODE, chargeObject.get(MCharge.Field.CURRENCY_CODE));
        this.currencyValue = named.queryForObject(selectQuery.toSQL(), selectQuery.getParam(), Option.MAPPER);

        String charge_time_enum = String.valueOf(chargeObject.get(MCharge.Field.CHARGE_TIME_ENUM));
        this.chargeTimeValue = ChargeTime.optionLiteral(charge_time_enum);

        String charge_calculation_enum = String.valueOf(chargeObject.get(MCharge.Field.CHARGE_CALCULATION_ENUM));
        this.chargeCalculationValue = ChargeCalculation.optionLiteral(charge_calculation_enum);

        String charge_payment_mode_enum = String.valueOf(chargeObject.get(MCharge.Field.CHARGE_PAYMENT_MODE_ENUM));
        this.chargePaymentValue = ChargePayment.optionLiteral(charge_payment_mode_enum);

        this.amountValue = (Double) chargeObject.get(MCharge.Field.AMOUNT);

        this.activeValue = (Boolean) chargeObject.get(MCharge.Field.IS_ACTIVE);

        this.penaltyValue = (Boolean) chargeObject.get(MCharge.Field.IS_PENALTY);

        selectQuery = new SelectQuery(MTaxGroup.NAME);
        selectQuery.addField(MTaxGroup.Field.ID);
        selectQuery.addField(MTaxGroup.Field.NAME + " as text");
        selectQuery.addWhere(MTaxGroup.Field.ID + " = :" + MTaxGroup.Field.ID, chargeObject.get(MCharge.Field.TAX_GROUP_ID));
        this.taxGroupValue = named.queryForObject(selectQuery.toSQL(), selectQuery.getParam(), Option.MAPPER);

        String fee_frequency = String.valueOf(chargeObject.get(MCharge.Field.FEE_FREQUENCY));
        this.chargeFrequencyValue = ChargeFrequency.optionLiteral(fee_frequency);

        this.frequencyIntervalValue = (Long) chargeObject.get(MCharge.Field.FEE_INTERVAL);

        this.feeFrequencyValue = this.chargeFrequencyValue != null || this.frequencyIntervalValue != null;

        this.taxGroupProvider = new SingleChoiceProvider(MTaxGroup.NAME, MTaxGroup.Field.ID, MTaxGroup.Field.NAME);

        this.chargeFrequencyProvider = new ChargeFrequencyProvider();

        this.chargePaymentProvider = new ChargePaymentProvider();

        this.chargeCalculationProvider = new ChargeCalculationProvider();

        this.chargeTimeProvider = new ChargeTimeProvider();
        this.chargeTimeProvider.setValues(ChargeTime.Disbursement, ChargeTime.SpecifiedDueDate, ChargeTime.InstallmentFee, ChargeTime.OverdueFees, ChargeTime.TrancheDisbursement);

        this.currencyProvider = new CurrencyProvider();
    }

    @Override
    protected void initComponent() {
        this.form = new Form<>("form");
        this.add(this.form);

        this.saveButton = new Button("saveButton");
        this.saveButton.setOnSubmit(this::saveButtonSubmit);
        this.form.add(this.saveButton);

        this.closeLink = new BookmarkablePageLink<>("closeLink", ChargeBrowsePage.class);
        this.form.add(this.closeLink);

        this.row1 = UIRow.newUIRow("row1", this.form);

        this.nameBlock = this.row1.newUIBlock("nameBlock", Size.Six_6);
        this.nameIContainer = this.nameBlock.newUIContainer("nameIContainer");
        this.nameField = new TextField<>("nameField", new PropertyModel<>(this, "nameValue"));
        this.nameIContainer.add(this.nameField);
        this.nameIContainer.newFeedback("nameFeedback", this.nameField);

        this.row1Block1 = this.row1.newUIBlock("row1Block1", Size.Six_6);

        this.row2 = UIRow.newUIRow("row2", this.form);

        this.currencyBlock = this.row2.newUIBlock("currencyBlock", Size.Six_6);
        this.currencyIContainer = this.currencyBlock.newUIContainer("currencyIContainer");
        this.currencyField = new Select2SingleChoice<>("currencyField", new PropertyModel<>(this, "currencyValue"), this.currencyProvider);
        this.currencyIContainer.add(this.currencyField);
        this.currencyIContainer.newFeedback("currencyFeedback", this.currencyField);

        this.row2Block1 = this.row2.newUIBlock("row2Block1", Size.Six_6);

        this.row3 = UIRow.newUIRow("row3", this.form);

        this.chargeTimeBlock = this.row3.newUIBlock("chargeTimeBlock", Size.Six_6);
        this.chargeTimeIContainer = this.chargeTimeBlock.newUIContainer("chargeTimeIContainer");
        this.chargeTimeField = new Select2SingleChoice<>("chargeTimeField", new PropertyModel<>(this, "chargeTimeValue"), this.chargeTimeProvider);
        this.chargeTimeIContainer.add(this.chargeTimeField);
        this.chargeTimeIContainer.newFeedback("chargeTimeFeedback", this.chargeTimeField);

        this.row3Block1 = this.row3.newUIBlock("row3Block1", Size.Six_6);

        this.row4 = UIRow.newUIRow("row4", this.form);

        this.chargeCalculationBlock = this.row4.newUIBlock("chargeCalculationBlock", Size.Six_6);
        this.chargeCalculationIContainer = this.chargeCalculationBlock.newUIContainer("chargeCalculationIContainer");
        this.chargeCalculationField = new Select2SingleChoice<>("chargeCalculationField", new PropertyModel<>(this, "chargeCalculationValue"), this.chargeCalculationProvider);
        this.chargeCalculationIContainer.add(this.chargeCalculationField);
        this.chargeCalculationIContainer.newFeedback("chargeCalculationFeedback", this.chargeCalculationField);

        this.row4Block1 = this.row4.newUIBlock("row4Block1", Size.Six_6);

        this.row5 = UIRow.newUIRow("row5", this.form);

        this.chargePaymentBlock = this.row5.newUIBlock("chargePaymentBlock", Size.Six_6);
        this.chargePaymentIContainer = this.chargePaymentBlock.newUIContainer("chargePaymentIContainer");
        this.chargePaymentField = new Select2SingleChoice<>("chargePaymentField", new PropertyModel<>(this, "chargePaymentValue"), this.chargePaymentProvider);
        this.chargePaymentIContainer.add(this.chargePaymentField);
        this.chargePaymentIContainer.newFeedback("chargePaymentFeedback", this.chargePaymentField);

        this.row5Block1 = this.row5.newUIBlock("row5Block1", Size.Six_6);

        this.row6 = UIRow.newUIRow("row6", this.form);

        this.feeFrequencyBlock = this.row6.newUIBlock("feeFrequencyBlock", Size.Six_6);
        this.feeFrequencyIContainer = this.feeFrequencyBlock.newUIContainer("feeFrequencyIContainer");
        this.feeFrequencyField = new CheckBox("feeFrequencyField", new PropertyModel<>(this, "feeFrequencyValue"));
        this.feeFrequencyIContainer.add(this.feeFrequencyField);
        this.feeFrequencyIContainer.newFeedback("feeFrequencyFeedback", this.feeFrequencyField);

        this.row6Block1 = this.row6.newUIBlock("row6Block1", Size.Six_6);

        this.row7 = UIRow.newUIRow("row7", this.form);

        this.chargeFrequencyBlock = this.row7.newUIBlock("chargeFrequencyBlock", Size.Six_6);
        this.chargeFrequencyIContainer = this.chargeFrequencyBlock.newUIContainer("chargeFrequencyIContainer");
        this.chargeFrequencyField = new Select2SingleChoice<>("chargeFrequencyField", new PropertyModel<>(this, "chargeFrequencyValue"), this.chargeFrequencyProvider);
        this.chargeFrequencyIContainer.add(this.chargeFrequencyField);
        this.chargeFrequencyIContainer.newFeedback("chargeFrequencyFeedback", this.chargeFrequencyField);

        this.frequencyIntervalBlock = this.row7.newUIBlock("frequencyIntervalBlock", Size.Six_6);
        this.frequencyIntervalIContainer = this.frequencyIntervalBlock.newUIContainer("frequencyIntervalIContainer");
        this.frequencyIntervalField = new TextField<>("frequencyIntervalField", new PropertyModel<>(this, "frequencyIntervalValue"));
        this.frequencyIntervalIContainer.add(this.frequencyIntervalField);
        this.frequencyIntervalIContainer.newFeedback("frequencyIntervalFeedback", this.frequencyIntervalField);

        this.row8 = UIRow.newUIRow("row8", this.form);

        this.amountBlock = this.row8.newUIBlock("amountBlock", Size.Six_6);
        this.amountIContainer = this.amountBlock.newUIContainer("amountIContainer");
        this.amountField = new TextField<>("amountField", new PropertyModel<>(this, "amountValue"));
        this.amountIContainer.add(this.amountField);
        this.amountIContainer.newFeedback("amountFeedback", this.amountField);

        this.row8Block1 = this.row8.newUIBlock("row8Block1", Size.Six_6);

        this.row9 = UIRow.newUIRow("row9", this.form);

        this.activeBlock = this.row9.newUIBlock("activeBlock", Size.Three_3);
        this.activeIContainer = this.activeBlock.newUIContainer("activeIContainer");
        this.activeField = new CheckBox("activeField", new PropertyModel<>(this, "activeValue"));
        this.activeIContainer.add(this.activeField);
        this.activeIContainer.newFeedback("activeFeedback", this.activeField);

        this.penaltyBlock = this.row9.newUIBlock("penaltyBlock", Size.Three_3);
        this.penaltyIContainer = this.penaltyBlock.newUIContainer("penaltyIContainer");
        this.penaltyField = new CheckBox("penaltyField", new PropertyModel<>(this, "penaltyValue"));
        this.penaltyIContainer.add(this.penaltyField);
        this.penaltyIContainer.newFeedback("penaltyFeedback", this.penaltyField);

        this.row9Block1 = this.row9.newUIBlock("row9Block1", Size.Six_6);

        this.row10 = UIRow.newUIRow("row10", this.form);

        this.taxGroupBlock = this.row10.newUIBlock("taxGroupBlock", Size.Six_6);
        this.taxGroupIContainer = this.taxGroupBlock.newUIContainer("taxGroupIContainer");
        this.taxGroupField = new Select2SingleChoice<>("taxGroupField", new PropertyModel<>(this, "taxGroupValue"), this.taxGroupProvider);
        this.taxGroupIContainer.add(this.taxGroupField);
        this.taxGroupIContainer.newFeedback("taxGroupFeedback", this.taxGroupField);

        this.row10Block1 = this.row10.newUIBlock("row10Block1", Size.Six_6);
    }

    @Override
    protected void configureMetaData() {
        this.taxGroupField.setLabel(Model.of("Tax Group"));
        this.taxGroupField.add(new OnChangeAjaxBehavior());

        this.penaltyField.setRequired(true);
        this.penaltyField.add(new OnChangeAjaxBehavior());

        this.activeField.setRequired(true);
        this.activeField.add(new OnChangeAjaxBehavior());

        this.amountField.setLabel(Model.of("Amount"));
        this.amountField.setRequired(true);
        this.amountField.add(new OnChangeAjaxBehavior());

        this.frequencyIntervalField.setLabel(Model.of("Frequency Interval"));
        this.frequencyIntervalField.add(new OnChangeAjaxBehavior());

        this.chargeFrequencyField.setLabel(Model.of("Charge Frequency"));
        this.chargeFrequencyField.add(new OnChangeAjaxBehavior());

        this.feeFrequencyField.add(new OnChangeAjaxBehavior(this::feeFrequencyUpdate));

        this.chargePaymentField.setLabel(Model.of("Charge payment by"));
        this.chargePaymentField.add(new OnChangeAjaxBehavior());
        this.chargePaymentField.setRequired(true);

        this.chargeCalculationField.setLabel(Model.of("Charge calculation"));
        this.chargeCalculationField.setRequired(true);
        this.chargeCalculationField.add(new OnChangeAjaxBehavior());

        this.chargeTimeField.setLabel(Model.of("Charge time type"));
        this.chargeTimeField.setRequired(true);
        this.chargeTimeField.add(new OnChangeAjaxBehavior(this::chargeTimeFieldUpdate));

        this.currencyField.setLabel(Model.of("Currency"));
        this.currencyField.add(new OnChangeAjaxBehavior());
        this.currencyField.setRequired(true);

        this.nameField.setLabel(Model.of("Name"));
        this.nameField.setRequired(true);
        this.nameField.add(new OnChangeAjaxBehavior());

        chargeTimeFieldUpdate(null);
        feeFrequencyUpdate(null);
    }

    protected boolean feeFrequencyUpdate(AjaxRequestTarget target) {
        boolean visible = this.feeFrequencyValue == null ? false : this.feeFrequencyValue;
        this.chargeFrequencyIContainer.setVisible(visible);
        this.frequencyIntervalIContainer.setVisible(visible);

        ChargeTime chargeTime = this.chargeTimeValue == null ? null : ChargeTime.valueOf(this.chargeTimeValue.getId());

        boolean required = visible && chargeTime == ChargeTime.OverdueFees;

        this.chargeFrequencyField.setRequired(required);
        this.frequencyIntervalField.setRequired(required);

        if (target != null) {
            target.add(this.chargeFrequencyBlock);
            target.add(this.frequencyIntervalBlock);
        }
        return false;
    }

    protected boolean chargeTimeFieldUpdate(AjaxRequestTarget target) {

        if (target != null) {
            this.chargeFrequencyValue = null;
            this.frequencyIntervalValue = null;
            this.chargeCalculationValue = null;
        }

        ChargeTime chargeTime = this.chargeTimeValue == null ? null : ChargeTime.valueOf(this.chargeTimeValue.getId());
        if (chargeTime == ChargeTime.Disbursement) {
            this.chargeCalculationProvider.setValues(ChargeCalculation.Flat, ChargeCalculation.ApprovedAmount, ChargeCalculation.LoanAmountInterest, ChargeCalculation.Interest);
        } else if (chargeTime == ChargeTime.SpecifiedDueDate) {
            this.chargeCalculationProvider.setValues(ChargeCalculation.Flat, ChargeCalculation.ApprovedAmount, ChargeCalculation.LoanAmountInterest, ChargeCalculation.Interest);
        } else if (chargeTime == ChargeTime.InstallmentFee) {
            this.chargeCalculationProvider.setValues(ChargeCalculation.Flat, ChargeCalculation.ApprovedAmount, ChargeCalculation.LoanAmountInterest, ChargeCalculation.Interest);
        } else if (chargeTime == ChargeTime.OverdueFees) {
            this.chargeCalculationProvider.setValues(ChargeCalculation.Flat, ChargeCalculation.ApprovedAmount, ChargeCalculation.LoanAmountInterest, ChargeCalculation.Interest);
        } else if (chargeTime == ChargeTime.TrancheDisbursement) {
            this.chargeCalculationProvider.setValues(ChargeCalculation.Flat, ChargeCalculation.ApprovedAmount, ChargeCalculation.DisbursementAmount);
        } else {
            this.chargeCalculationProvider.setValues();
        }

        this.chargeCalculationIContainer.setVisible(chargeTime != null);
        this.chargeCalculationField.setRequired(chargeTime != null);

        boolean visible = chargeTime == ChargeTime.OverdueFees;
        this.feeFrequencyIContainer.setVisible(visible);

        if (target != null) {
            target.add(this.chargeCalculationBlock);
            target.add(this.feeFrequencyBlock);
        }

        feeFrequencyUpdate(target);

        return false;
    }

    protected void saveButtonSubmit(Button button) {
        ChargeTime chargeTime = null;
        if (this.chargeTimeValue != null) {
            chargeTime = ChargeTime.valueOf(this.chargeTimeValue.getId());
        }

        ChargeBuilder builder = new ChargeBuilder();
        builder.withId(this.chargeId);
        builder.withName(this.nameValue);
        if (this.currencyValue != null) {
            builder.withCurrencyCode(this.currencyValue.getId());
        } else {
            builder.withCurrencyCode(null);
        }
        builder.withChargeTimeType(chargeTime);
        if (this.chargeCalculationValue != null) {
            builder.withChargeCalculationType(ChargeCalculation.valueOf(this.chargeCalculationValue.getId()));
        } else {
            builder.withChargeCalculationType(null);
        }
        if (this.chargePaymentValue != null) {
            builder.withChargePaymentMode(ChargePayment.valueOf(this.chargePaymentValue.getId()));
        } else {
            builder.withChargePaymentMode(null);
        }
        if (chargeTime == ChargeTime.OverdueFees && this.feeFrequencyValue != null && this.feeFrequencyValue) {
            if (this.chargeFrequencyValue != null) {
                builder.withFeeFrequency(ChargeFrequency.valueOf(this.chargeFrequencyValue.getId()));
            } else {
                builder.withFeeFrequency(null);
            }
            builder.withFeeInterval(this.frequencyIntervalValue);
        } else {
            builder.withFeeFrequency(null);
            builder.withFeeInterval(null);
        }
        builder.withAmount(this.amountValue);
        builder.withActive(this.activeValue);
        builder.withPenalty(this.penaltyValue);
        if (this.taxGroupValue != null) {
            builder.withTaxGroupId(this.taxGroupValue.getId());
        } else {
            builder.withTaxGroupId(null);
        }

        JsonNode node = ChargeHelper.update((Session) getSession(), builder.build());

        if (reportError(node)) {
            return;
        }
        setResponsePage(ChargeBrowsePage.class);
    }

}


text:
.. _global_options:

Global options
==============

Global options are command-line flags that are valid for any command and enable you to customize various aspects of the ``rack`` CLI tool at runtime. These options might override configuration file or environment variables that you have set previously, or change the output format or other aspects of the tool.

For example, you can get JSON_ formatted output from any series of commands by appending the ``--output json`` flag::

    rack <command> <subcommand> <action> --output json

You can display any available command-line flags by appending ``--help`` to the command::

    rack <command> <subcommand> <action> --help

Options
-------

This section describes the global options available in the ``rack`` CLI.

``--output``
~~~~~~~~~~~~

String. The format in which to return the output. Options are ``json``, ``table``, and ``csv``. Default is ``table``.

``json``
^^^^^^^^

Returns output in JSON.

::

    rack servers instance list --output json
    [
      {
        "Flavor": "io1-30",
        "ID": "GUID",
        "Image": "GUID",
        "Name": "my_server",
        "Private IPv4": "10.208.128.233",
        "Public IPv4": "101.130.19.31",
        "Status": "ACTIVE"
      }
    ]

.. note::
    When the output pipe is *not* a terminal, the JSON is not "pretty printed" and can be used when passing straight into other commands that require a JSON_ payload.

``table``
^^^^^^^^^

Returns output in a well-formatted table with headers. This is the default output format for ``rack``.

::

    rack servers instance list
    ID	        Name		Status	Public IPv4	Private IPv4	Image	Flavor
    GUID	my_server	ACTIVE	101.130.19.31	10.208.128.233	GUID	io1-30

You can add the ``--output table`` option if you have set defaults to ``json`` or ``csv`` elsewhere. You can use the ``--no-header`` option to return a table without headers.

``csv``
^^^^^^^

Returns output in comma-separated value (CSV) format. The format is compact with appropriate CSV headers.

The CSV format is useful for passing data to other operating system tools and importing data into Excel, Google Sheets, or another data tool.

::

  rack servers instance list --output csv
  ID,Name,Status,Public IPv4,Private IPv4,Image,Flavor
  GUID,my_server,ACTIVE,101.130.19.31,10.208.128.233,GUID,io1-30

``--log``
~~~~~~~~~

String. Displays log information at the info or debug level for the command. Options are ``info`` and ``debug``.

::

    rack servers keypair list --log info

``--username``
~~~~~~~~~~~~~~

String. The Rackspace username to use for authentication.

``--api-key``
~~~~~~~~~~~~~

String. The Rackspace API key to use for authentication.

``--auth-tenant-id``
~~~~~~~~~~~~~~~~~~~~

String. The tenant ID to use for authentication. This option can be provided only as a command-line flag. It is prefixed with ``auth-`` so that it does not collide with the ``tenant-id`` command flags.

``--auth-token``
~~~~~~~~~~~~~~~~

String. The token to use for authentication. This option can be provided only as a command-line flag. It must be used with the ``auth-tenant-id`` flag.

``--region``
~~~~~~~~~~~~

String. The Rackspace region to use for authentication.

``--auth-url``
~~~~~~~~~~~~~~

String. The Rackspace URL to use for authentication. If this option is not provided, the URL defaults to the public U.S. Rackspace endpoint.

``--profile``
~~~~~~~~~~~~~

String. The name of the profile (in the configuration file) to use to look for authentication credentials.

``--no-cache``
~~~~~~~~~~~~~~

Boolean. Indicates not to get or set authentication credentials in the ``rack`` cache.

``--no-header``
~~~~~~~~~~~~~~~

Boolean. Indicates not to set the header for CSV or tabular output. This option is helpful when you are piping output from a ``list`` command.

``--use-service-net``
~~~~~~~~~~~~~~~~~~~~~

Boolean. Indicates to use the Rackspace internal URL to execute the request. This option is useful only when you are running a ``rack`` command from a Rackspace server.

``--help, -h``
~~~~~~~~~~~~~~

Boolean. Shows help in a given context.

Example of help at the base level::

    rack --help
    NAME:
       rack - An opinionated CLI for the Rackspace cloud

    USAGE:
       rack <service> <subservice> <action> [flags]

    VERSION:
       0.0.0

    COMMANDS:
       servers	Used for the Servers service
       help, h	Shows a list of commands or help for one command

    GLOBAL OPTIONS:
       --json			Return output in JSON format.
       --table			Return output in tabular format. This is the default output format.
       --csv			Return output in csv format.
       --help, -h			show help

Example of help at the command (service) level::

    rack servers --help
    NAME:
       rack servers - Used for the Servers service

    USAGE:
       rack servers <subservice> <action> [flags]

    VERSION:
       0.0.0

    COMMANDS:
       instance	Used for Server Instance operations
       image	Used for Server Image operations
       flavor	Used for Server Flavor operations
       keypair	Used for Server Keypair operations
       help, h	Shows a list of commands or help for one command

Example of help at the subcommand (subservice) level::

    rack servers keypair --help
    NAME:
       rack servers keypair - Used for Server Keypair operations

    USAGE:
       rack servers keypair <action> [flags]

    VERSION:
       0.0.0

    COMMANDS:
       list		rack servers keypair list [flags]
       create	rack servers keypair create <keypairName> [flags]
       get		rack [globals] servers keypair get [--name <keypairName>] [flags]
       delete	rack servers keypair delete [--name <keypairName>] [flags]
       help, h	Shows a list of commands or help for one command

Example of help at the action level::

    rack servers instance list --help
    NAME: list - rack servers instance list  [flags]

    DESCRIPTION: Lists existing servers

    COMMAND FLAGS:
    --all-pages     [optional] Return all servers. Default is to paginate.
    --name          [optional] Only list servers with this name.
    --changes-since [optional] Only list servers that have been changed since this time/date stamp.
    --image         [optional] Only list servers that have this image ID.
    --flavor        [optional] Only list servers that have this flavor ID.
    --status        [optional] Only list servers that have this status.
    --marker        [optional] Start listing servers at this server ID.
    --limit         [optional] Only return this many servers at most.
    --fields        [optional] Only return these comma-separated case-insensitive fields.
                    Choices: id, name, status, publicipv4, privateipv4, image, flavor

    GLOBAL FLAGS:
    --username              The username with which to authenticate.
    --api-key               The API key with which to authenticate.
    --auth-tenant-id        The tenant ID of the user to authenticate as. May only be provided as a command-line flag.
    --auth-token            The authentication token of the user to authenticate as. This must be used with the `auth-tenant-id` flag.
    --auth-url              The endpoint to which authenticate.
    --region                The region to which authenticate.
    --use-service-net       Whether or not to use the internal Rackspace network
    --profile               The config file profile to use for authentication.
    --output                Format in which to return output. Options: json, csv, table. Default is 'table'.
    --no-cache              Don't get or set authentication credentials in the rack cache.
    --log                   Print debug information from the command. Options are: debug, info
    --no-header             Don't return a header for CSV nor tabular output.

.. JSON: http://json.org/


text:
/* $NoKeywords: $ */
/*
//
// Copyright (c) 1993-2011 Robert McNeel & Associates. All rights reserved.
// OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert
// McNeel & Associates.
//
// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
// MERCHANTABILITY ARE HEREBY DISCLAIMED.
//
// For complete openNURBS copyright information see <http://www.opennurbs.org>.
//
////////////////////////////////////////////////////////////////
*/

#include <pcl/surface/openNURBS/opennurbs.h>

ON_VIRTUAL_OBJECT_IMPLEMENT( ON_Bitmap, ON_Object, "390465E9-3721-11d4-800B-0010830122F0");

ON_OBJECT_IMPLEMENT( ON_WindowsBitmap, ON_Bitmap,  "390465EB-3721-11d4-800B-0010830122F0");

ON_OBJECT_IMPLEMENT( ON_EmbeddedBitmap, ON_Bitmap, "772E6FC1-B17B-4fc4-8F54-5FDA511D76D2");

ON_OBJECT_IMPLEMENT( ON_WindowsBitmapEx, ON_WindowsBitmap,  "203AFC17-BCC9-44fb-A07B-7F5C31BD5ED9");

void ON_Bitmap::EmergencyDestroy()
{
  memset(&m_bitmap_id,0,sizeof(m_bitmap_id));
  m_bitmap_index = -1;
  m_bitmap_name.EmergencyDestroy();
  m_bitmap_filename.EmergencyDestroy();
}

void ON_Bitmap::Destroy()
{
  m_bitmap_name.Destroy();
  m_bitmap_filename.Destroy();
  ON_Bitmap::EmergencyDestroy();
}

void ON_Bitmap::Defaults()
{
  memset(&m_bitmap_id,0,sizeof(m_bitmap_id));
  m_bitmap_index = -1;
  m_bitmap_name.Destroy();
  m_bitmap_filename.Destroy();
}

ON_Bitmap::ON_Bitmap()
{
  memset(&m_bitmap_id,0,sizeof(m_bitmap_id));
  m_bitmap_index = -1;
}

ON_Bitmap::~ON_Bitmap()
{}

void ON_Bitmap::Dump( ON_TextLog& dump ) const
{
  dump.Print("width = %d pixels\n",Width());
  dump.Print("height = %d pixels\n",Height());
  dump.Print("bits per pixel = %d\n",BitsPerPixel());
  dump.Print("size of image = %d bytes\n",SizeofImage());
}

static
int ON_WindowsBitmapHelper_PaletteColorCount( int bmiHeader_biClrUsed, int bmiHeader_biBitCount )
{
  int color_count = 0;

  if ( bmiHeader_biClrUsed )
  {
    color_count = bmiHeader_biClrUsed;
  }
  else
  {
    switch( bmiHeader_biBitCount )
    {
    case 1:
      color_count = 2;
      break;
    case 4:
      color_count = 16;
      break;
    case 8:
      color_count = 256;
      break;
    default:
      color_count = 0;
      break;
    }
  }
  return color_count;
}

static
size_t ON_WindowsBitmapHelper_SizeofPalette( int bmiHeader_biClrUsed, int bmiHeader_biBitCount )
{
#if defined(ON_OS_WINDOWS_GDI)
  return ( ON_WindowsBitmapHelper_PaletteColorCount(bmiHeader_biClrUsed,bmiHeader_biBitCount) * sizeof(RGBQUAD) );
#else
  return ( ON_WindowsBitmapHelper_PaletteColorCount(bmiHeader_biClrUsed,bmiHeader_biBitCount) * sizeof(ON_WindowsRGBQUAD) );
#endif
}

ON_WindowsBitmap::ON_WindowsBitmap() : m_bmi(0), m_bits(0), m_bFreeBMI(0)
{}

ON_WindowsBitmap::ON_WindowsBitmap( const ON_WindowsBitmap& src )
                : m_bmi(0), m_bits(0), m_bFreeBMI(0)
{
  *this = src;
}

void ON_WindowsBitmap::EmergencyDestroy()
{
  m_bmi = 0;
  m_bits = 0;
  m_bFreeBMI = 0;
  ON_Bitmap::EmergencyDestroy();
}

void ON_WindowsBitmap::Destroy()
{
  if (m_bmi)
  {
    if ( 1 == m_bFreeBMI || 3 == m_bFreeBMI )
      onfree(m_bmi);
    m_bmi=0;
  }
  if ( m_bits )
  {
    if ( 2 == m_bFreeBMI || 3 == m_bFreeBMI )
      onfree(m_bits);
    m_bits = 0;
  }
  m_bFreeBMI = 0;
  ON_Bitmap::Destroy();
}

ON_BOOL32 ON_WindowsBitmap::IsValid( ON_TextLog* text_log ) const
{
  bool rc = ( m_bmi != NULL && m_bits != NULL && Width() > 0 && Height() > 0)
          ? true : false;

  if ( !rc && 0 != text_log )
  {
    // TODO:  add a detailed diagnostic message
    text_log->Print("ON_WindowsBitmap is not valid\n");
  }
  return rc;
}

#if defined(ON_OS_WINDOWS_GDI)

static BITMAPINFO*
ON_WindowsBitmapHelper_AllocBMI(size_t sizeof_palette, size_t sizeof_image)
{
  // In theory,
  //    sz = sizeof(BITMAPINFOHEADER) + sizeof_palette + sizeof_image;
  // should work, but BITMAPINFO is only 4 bytes bigger than BITMAPINFOHEADER
  // and the allocation below will certainly work.
  size_t sz = sizeof(BITMAPINFO) + sizeof_palette + sizeof_image;
  BITMAPINFO* bmi = (BITMAPINFO*)onmalloc(sz);
  if ( bmi )
  {
    memset(bmi,0,sizeof(*bmi));
    bmi->bmiHeader.biSize = sizeof(bmi->bmiHeader);
  }
  return bmi;
}

#else

static
ON_WindowsBITMAPINFO* ON_WindowsBitmapHelper_AllocBMI(size_t sizeof_palette, size_t sizeof_image)
{
  size_t sz = sizeof(ON_WindowsBITMAPINFO) + sizeof_palette + sizeof_image;
  ON_WindowsBITMAPINFO* bmi = (ON_WindowsBITMAPINFO*)onmalloc(sz);
  if ( bmi )
  {
    memset(bmi,0,sizeof(*bmi));
    bmi->bmiHeader.biSize = sizeof(bmi->bmiHeader);
  }
  return bmi;
}

#endif

bool ON_WindowsBitmap::Create(
       int width,
       int height,
       int bits_per_pixel // 1, 2, 4, 8, 16, 24, or 32
       )
{
  Destroy();

  if ( width < 1 || height < 1 )
  {
    return false;
  }
  if (   bits_per_pixel != 1 && bits_per_pixel !=  2 && bits_per_pixel !=  4
      && bits_per_pixel != 8 && bits_per_pixel != 16 && bits_per_pixel != 24
      && bits_per_pixel != 32 )
  {
    return false;
  }

#if defined(ON_OS_WINDOWS_GDI)
  BITMAPINFOHEADER bh;
  const DWORD sizeof_RGBQUAD    = sizeof(RGBQUAD);
#else
  ON_WindowsBITMAPINFOHEADER bh;
  const unsigned int sizeof_RGBQUAD    = sizeof(ON_WindowsRGBQUAD);
#endif
  memset( &bh, 0, sizeof(bh) );
  bh.biSize = sizeof(bh);
  bh.biWidth = width;
  bh.biHeight = height;
  bh.biPlanes = 1;
  bh.biBitCount = (unsigned short)bits_per_pixel; // cast is safe
  bh.biCompression = 0; // BI_RGB
  const int sizeof_scan = (((bits_per_pixel*width) + 31) / 32) * 4;
  bh.biSizeImage = height*sizeof_scan;
  bh.biXPelsPerMeter = 0;
  bh.biYPelsPerMeter = 0;
  bh.biClrUsed = 0;
  bh.biClrImportant = 0;

  int palette_color_count = 0;
  switch ( bits_per_pixel ) {
  case 1:
    palette_color_count = 2;
    break;
  case 4:
    palette_color_count = 16;
    break;
  case 8:
    palette_color_count = 256;
    break;
  }
  const int sizeof_palette = palette_color_count*sizeof_RGBQUAD;

  m_bmi = ON_WindowsBitmapHelper_AllocBMI( sizeof_palette, bh.biSizeImage );

  bool rc = false;

  if ( m_bmi && palette_color_count > 0)
  {
    m_bmi->bmiHeader = bh;
    m_bits = (unsigned char*)&m_bmi->bmiColors[palette_color_count];

    // default palette is gray scale
    const int rgb_delta = 256/palette_color_count;
    int i, rgb;
    for ( i = 0, rgb = 0; i < palette_color_count; i++, rgb += rgb_delta )
    {
      if ( rgb >= 256 ) rgb = 255;
      m_bmi->bmiColors[i].rgbBlue  = (unsigned char)rgb;
      m_bmi->bmiColors[i].rgbGreen = (unsigned char)rgb;
      m_bmi->bmiColors[i].rgbRed   = (unsigned char)rgb;
      m_bmi->bmiColors[i].rgbReserved = 0;
    }
    rc = true;
  }

  return rc;
}

ON_WindowsBitmap::~ON_WindowsBitmap()
{
  Destroy();
}

ON_WindowsBitmap& ON_WindowsBitmap::operator=( const ON_WindowsBitmap& src )
{
  if ( this != &src )
  {
    Destroy();
    ON_Bitmap::operator=(src);
    if ( src.m_bmi )
    {
      const int sizeof_palette = src.SizeofPalette();
      const int sizeof_image   = src.SizeofImage();
      m_bmi = ON_WindowsBitmapHelper_AllocBMI( sizeof_palette, sizeof_image );
      if ( m_bmi )
      {
        m_bFreeBMI = 1;
        m_bmi->bmiHeader = src.m_bmi->bmiHeader;
        if( sizeof_palette > 0 )
        {
          memcpy(&m_bmi->bmiColors[0],&src.m_bmi->bmiColors[0],sizeof_palette);
        }
        if ( sizeof_image > 0 )
        {
          m_bits = (unsigned char*)&m_bmi->bmiColors[PaletteColorCount()];
          if ( src.m_bits )
            memcpy( m_bits, src.m_bits, sizeof_image );
          else
            memset( m_bits, 0, sizeof_image );
        }
        else
          m_bits = 0;
      }
    }
  }
  return *this;
}

int ON_WindowsBitmap::Width() const
{
  return (m_bmi) ? m_bmi->bmiHeader.biWidth : 0;
}

int ON_WindowsBitmap::Height() const
{
  return (m_bmi) ? m_bmi->bmiHeader.biHeight : 0;
}

int ON_WindowsBitmap::PaletteColorCount() const
{
  return m_bmi ? ON_WindowsBitmapHelper_PaletteColorCount(m_bmi->bmiHeader.biClrUsed, m_bmi->bmiHeader.biBitCount ) : 0;
}

int ON_WindowsBitmap::SizeofPalette() const
{
  return m_bmi ? ((int)ON_WindowsBitmapHelper_SizeofPalette(m_bmi->bmiHeader.biClrUsed, m_bmi->bmiHeader.biBitCount) ) : 0;
}

int ON_WindowsBitmap::SizeofScan() const
{
  int scan_width = 0;
  if ( m_bmi ) {
    int bitcount = m_bmi->bmiHeader.biBitCount;
    int width = Width();
    scan_width = (((bitcount*width) + 31) / 32) * 4;
  }
  return scan_width;
}

int ON_WindowsBitmap::BitsPerPixel() const
{
  return m_bmi ? m_bmi->bmiHeader.biBitCount : 0;
}

int ON_WindowsBitmap::SizeofImage() const
{
  return m_bmi ? m_bmi->bmiHeader.biSizeImage : 0;
}

unsigned char* ON_WindowsBitmap::Bits( int scan_index )
{
  const int sizeof_scan = SizeofScan();
  unsigned char* bits = m_bmi ? (unsigned char*)&m_bmi->bmiColors[PaletteColorCount()] : 0;
  if ( bits && sizeof_scan && scan_index >= 0 && scan_index < Height() ) {
    bits += (sizeof_scan*scan_index);
  }
  else {
    bits = 0;
  }
  return bits;
}

const unsigned char* ON_WindowsBitmap::Bits(int scan_index) const
{
  const int sizeof_scan = SizeofScan();
  const unsigned char* bits = m_bmi ? (const unsigned char*)&m_bmi->bmiColors[PaletteColorCount()] : 0;
  if ( bits && sizeof_scan && scan_index >= 0 && scan_index < Height() ) {
    bits += (sizeof_scan*scan_index);
  }
  else {
    bits = 0;
  }
  return bits;
}

ON_Color ON_WindowsBitmap::Pixel( int column_index, int row_index ) const
{
  return Pixel( column_index, Bits(row_index) );
}

ON_Color ON_WindowsBitmap::Pixel( int column_index, const unsigned char* scanbits ) const
{
  int r=0,g=0,b=0,a=0;

  unsigned int palindex;

  if ( m_bmi && column_index >= 0 && column_index <= Width() && scanbits && !m_bmi->bmiHeader.biCompression ) {
    switch( m_bmi->bmiHeader.biBitCount ) {
    case 32:
      scanbits += (column_index*4);
      b = *scanbits++;
      g = *scanbits++;
      r = *scanbits++;
      a = *scanbits;
      break;

    case 24:
      scanbits += (column_index*3);
      b = *scanbits++;
      g = *scanbits++;
      r = *scanbits;
      break;

    case 8:
      // 256 color bitmap uses palette
      palindex = scanbits[column_index];
      b = m_bmi->bmiColors[palindex].rgbBlue;
      g = m_bmi->bmiColors[palindex].rgbGreen;
      r = m_bmi->bmiColors[palindex].rgbRed;
      a = m_bmi->bmiColors[palindex].rgbReserved;
      break;

    case 4:
      {
        // 16 color bitmap uses palette
        palindex = scanbits[column_index/2];
        if ( !(column_index%2) )
          palindex >>= 4;
        palindex &= 0x0F;
        b = m_bmi->bmiColors[palindex].rgbBlue;
        g = m_bmi->bmiColors[palindex].rgbGreen;
        r = m_bmi->bmiColors[palindex].rgbRed;
        a = m_bmi->bmiColors[palindex].rgbReserved;
      }
      break;

    case 1:
      // monochrome bitmap has 2 color palette
      palindex = ( scanbits[column_index/8] >> (7-(column_index%8)) ) & 0x01;
      b = m_bmi->bmiColors[palindex].rgbBlue;
      g = m_bmi->bmiColors[palindex].rgbGreen;
      r = m_bmi->bmiColors[palindex].rgbRed;
      a = m_bmi->bmiColors[palindex].rgbReserved;
      break;
    }
  }

  return ON_Color(r,g,b,a);
}

bool ON_WindowsBitmap::WriteUncompressed( ON_BinaryArchive& file ) const
{
#if defined(ON_OS_WINDOWS_GDI)
  BITMAPINFOHEADER bmiHeader;
#else
  ON_WindowsBITMAPINFOHEADER bmiHeader;
#endif

  if ( m_bmi )
  {
    bmiHeader = m_bmi->bmiHeader;
    bmiHeader.biSize = sizeof(bmiHeader);
  }
  else
  {
    memset(&bmiHeader,0,sizeof(bmiHeader));
  }
  int i;
  short s;
  i = bmiHeader.biSize;
  bool    rc = file.WriteInt(i);
  i = bmiHeader.biWidth;
  if (rc) rc = file.WriteInt(i);
  i = bmiHeader.biHeight;
  if (rc) rc = file.WriteInt(i);
  s = bmiHeader.biPlanes;
  if (rc) rc = file.WriteShort(s);
  s = bmiHeader.biBitCount;
  if (rc) rc = file.WriteShort(s);
  i = bmiHeader.biCompression;
  if (rc) rc = file.WriteInt(i);
  i = bmiHeader.biSizeImage;
  if (rc) rc = file.WriteInt(i);
  i = bmiHeader.biXPelsPerMeter;
  if (rc) rc = file.WriteInt(i);
  i = bmiHeader.biYPelsPerMeter;
  if (rc) rc = file.WriteInt(i);
  i = bmiHeader.biClrUsed;
  if (rc) rc = file.WriteInt(i);
  i = bmiHeader.biClrImportant;
  if (rc) rc = file.WriteInt(i);

  if ( rc )
  {
    const int color_count = PaletteColorCount();
    for (i = 0; i < color_count && rc; i++ )
    {
      if (rc) rc = file.WriteChar( m_bmi->bmiColors[i].rgbBlue );
      if (rc) rc = file.WriteChar( m_bmi->bmiColors[i].rgbGreen );
      if (rc) rc = file.WriteChar( m_bmi->bmiColors[i].rgbRed );
      if (rc) rc = file.WriteChar( m_bmi->bmiColors[i].rgbReserved );
    }
    const int sizeof_image = SizeofImage();
    if ( sizeof_image > 0 && rc )
    {
      if (rc) rc = file.WriteByte( sizeof_image, &m_bmi->bmiColors[color_count] );
    }
  }

  return rc;
}

bool ON_WindowsBitmap::ReadUncompressed( ON_BinaryArchive& file )
{
#if defined(ON_OS_WINDOWS_GDI)
  BITMAPINFOHEADER bmiHeader;
#else
  ON_WindowsBITMAPINFOHEADER bmiHeader;
#endif
  memset(&bmiHeader,0,sizeof(bmiHeader));

  Destroy();

  int i;
  short s;
  bool rc;

  for(;;)
  {
    i = 0;
    s = 0;
    rc = file.ReadInt(&i);   if (!rc) break; bmiHeader.biSize = i;
    rc = file.ReadInt(&i);   if (!rc) break; bmiHeader.biWidth = i;
    rc = file.ReadInt(&i);   if (!rc) break; bmiHeader.biHeight = i;
    rc = file.ReadShort(&s); if (!rc) break; bmiHeader.biPlanes = s;
    rc = file.ReadShort(&s); if (!rc) break; bmiHeader.biBitCount = s;
    rc = file.ReadInt(&i);   if (!rc) break; bmiHeader.biCompression = i;
    rc = file.ReadInt(&i);   if (!rc) break; bmiHeader.biSizeImage = i;
    rc = file.ReadInt(&i);   if (!rc) break; bmiHeader.biXPelsPerMeter = i;
    rc = file.ReadInt(&i);   if (!rc) break; bmiHeader.biYPelsPerMeter = i;
    rc = file.ReadInt(&i);   if (!rc) break; bmiHeader.biClrUsed = i;
    rc = file.ReadInt(&i);   if (!rc) break; bmiHeader.biClrImportant = i;
    break;
  }

  if ( rc )
  {
    bmiHeader.biSize = sizeof(bmiHeader);
    const size_t sizeof_palette = ON_WindowsBitmapHelper_SizeofPalette(bmiHeader.biClrUsed, bmiHeader.biBitCount );
    const size_t sizeof_image   = bmiHeader.biSizeImage;

    m_bmi = ON_WindowsBitmapHelper_AllocBMI( sizeof_palette, sizeof_image );

    if ( !m_bmi )
    {
      rc = false;
    }
    else
    {
      m_bFreeBMI = 1;
      m_bmi->bmiHeader = bmiHeader;
      const int color_count = ON_WindowsBitmapHelper_PaletteColorCount(bmiHeader.biClrUsed, bmiHeader.biBitCount );
      int i;
      for (i = 0; i < color_count && rc; i++ )
      {
        if (rc) rc = file.ReadChar( &m_bmi->bmiColors[i].rgbBlue );
        if (rc) rc = file.ReadChar( &m_bmi->bmiColors[i].rgbGreen );
        if (rc) rc = file.ReadChar( &m_bmi->bmiColors[i].rgbRed );
        if (rc) rc = file.ReadChar( &m_bmi->bmiColors[i].rgbReserved );
      }
      if ( sizeof_image > 0 && rc )
      {
        m_bits = (unsigned char*)&m_bmi->bmiColors[color_count];
        if (rc) rc = file.ReadByte( sizeof_image, m_bits );
      }
    }
  }
  return rc;
}

ON_BOOL32 ON_WindowsBitmap::Write( ON_BinaryArchive& file ) const
{
  return WriteCompressed(file);
}

ON_BOOL32 ON_WindowsBitmap::Read( ON_BinaryArchive& file )
{
  bool rc = false;
  if ( file.Archive3dmVersion() == 1 )
    rc = ReadUncompressed(file);
  else
    rc = ReadCompressed(file);
  return rc;
}

ON_WindowsBitmapEx::ON_WindowsBitmapEx()
{
}

ON_WindowsBitmapEx::~ON_WindowsBitmapEx()
{
}

ON_BOOL32 ON_WindowsBitmapEx::Write( ON_BinaryArchive& file ) const
{
  ON_BOOL32 rc = file.Write3dmChunkVersion(1,0);
  if (rc)
    rc = file.WriteString(m_bitmap_filename);
  if (rc)
    rc = ON_WindowsBitmap::WriteCompressed(file);
  return rc;
}

ON_BOOL32 ON_WindowsBitmapEx::Read( ON_BinaryArchive& file )
{
  int major_version = 0;
  int minor_version = 0;
  ON_BOOL32 rc = file.Read3dmChunkVersion(&major_version,&minor_version);
  if (rc && 1 == major_version )
  {
    // Calling ON_WindowsBitmap::ReadCompressed() destroys
    // m_bitmap_filename, so we have to read it into a local
    // string and make the assigment after calling
    // ON_WindowsBitmap::ReadCompressed().
    ON_wString bitmap_filename;
    if (rc)
      rc = file.ReadString(bitmap_filename);
    if ( !rc)
      bitmap_filename.Destroy();

    if (rc)
      rc = ON_WindowsBitmap::ReadCompressed(file);

    m_bitmap_filename = bitmap_filename;
  }
  else
    rc = false;
  return rc;
}

bool ON_WindowsBitmap::WriteCompressed( ON_BinaryArchive& file ) const
{
  int color_count = 0;
  int sizeof_palette = 0;
  int sizeof_image = 0;
  bool bContiguousBitmap = IsContiguous();
#if defined(ON_OS_WINDOWS_GDI)
  BITMAPINFOHEADER bmiHeader;
#else
  ON_WindowsBITMAPINFOHEADER bmiHeader;
#endif
  if ( m_bmi )
  {
    bmiHeader = m_bmi->bmiHeader;
    color_count = PaletteColorCount();
    sizeof_palette = color_count*sizeof(*m_bmi->bmiColors);
    sizeof_image = SizeofImage();
    if ( 0 == sizeof_image )
      bContiguousBitmap = true;
  }
  else
  {
    bContiguousBitmap = true;
    color_count = 0;
    sizeof_palette = 0;
    sizeof_image = 0;
    memset(&bmiHeader,0,sizeof(bmiHeader));
  }
  int i;
  short s;
  i = bmiHeader.biSize;
  bool    rc = file.WriteInt(i);
  i = bmiHeader.biWidth;
  if (rc) rc = file.WriteInt(i);
  i = bmiHeader.biHeight;
  if (rc) rc = file.WriteInt(i);
  s = bmiHeader.biPlanes;
  if (rc) rc = file.WriteShort(s);
  s = bmiHeader.biBitCount;
  if (rc) rc = file.WriteShort(s);
  i = bmiHeader.biCompression;
  if (rc) rc = file.WriteInt(i);
  i = bmiHeader.biSizeImage;
  if (rc) rc = file.WriteInt(i);
  i = bmiHeader.biXPelsPerMeter;
  if (rc) rc = file.WriteInt(i);
  i = bmiHeader.biYPelsPerMeter;
  if (rc) rc = file.WriteInt(i);
  i = bmiHeader.biClrUsed;
  if (rc) rc = file.WriteInt(i);
  i = bmiHeader.biClrImportant;
  if (rc) rc = file.WriteInt(i);

  if ( rc )
  {
    if ( bContiguousBitmap )
    {
      const int sizeof_buffer = sizeof_palette + sizeof_image;
      // palette and bits are compressed in a single chunk
      rc = file.WriteCompressedBuffer( sizeof_buffer, (0 != m_bmi) ? m_bmi->bmiColors : 0);
    }
    else
    {
      // 28 July 2003
      //     Added support for writing non-contiguous bitmaps
      // palette
      rc = file.WriteCompressedBuffer( sizeof_palette, m_bmi->bmiColors );
      if (rc)
      {
        // image bits
        rc = file.WriteCompressedBuffer( sizeof_image, m_bits );
      }
    }
  }

  return rc;
}

bool ON_WindowsBitmap::ReadCompressed( ON_BinaryArchive& file )
{
  ON_BOOL32 bFailedCRC = false;
  Destroy();
#if defined(ON_OS_WINDOWS_GDI)
  BITMAPINFOHEADER bmiHeader;
#else
  ON_WindowsBITMAPINFOHEADER bmiHeader;
#endif
  memset(&bmiHeader,0,sizeof(bmiHeader));
  int i;
  short s;
  bool rc;

  for(;;)
  {
    i = 0;
    s = 0;
    rc = file.ReadInt(&i);   if (!rc) break; bmiHeader.biSize = i;
    rc = file.ReadInt(&i);   if (!rc) break; bmiHeader.biWidth = i;
    rc = file.ReadInt(&i);   if (!rc) break; bmiHeader.biHeight = i;
    rc = file.ReadShort(&s); if (!rc) break; bmiHeader.biPlanes = s;
    rc = file.ReadShort(&s); if (!rc) break; bmiHeader.biBitCount = s;
    rc = file.ReadInt(&i);   if (!rc) break; bmiHeader.biCompression = i;
    rc = file.ReadInt(&i);   if (!rc) break; bmiHeader.biSizeImage = i;
    rc = file.ReadInt(&i);   if (!rc) break; bmiHeader.biXPelsPerMeter = i;
    rc = file.ReadInt(&i);   if (!rc) break; bmiHeader.biYPelsPerMeter = i;
    rc = file.ReadInt(&i);   if (!rc) break; bmiHeader.biClrUsed = i;
    rc = file.ReadInt(&i);   if (!rc) break; bmiHeader.biClrImportant = i;
    break;
  }

  if ( rc )
  {
    bmiHeader.biSize = sizeof(bmiHeader);
    const size_t sizeof_palette = ON_WindowsBitmapHelper_SizeofPalette(bmiHeader.biClrUsed, bmiHeader.biBitCount );
    const size_t sizeof_image   = bmiHeader.biSizeImage;
    m_bmi = ON_WindowsBitmapHelper_AllocBMI(sizeof_palette,sizeof_image);
    if ( !m_bmi )
    {
      rc = false;
    }
    else
    {
      m_bFreeBMI = 1;
      m_bmi->bmiHeader = bmiHeader;
      m_bmi->bmiHeader.biSize = sizeof(m_bmi->bmiHeader);
      const int color_count = ON_WindowsBitmapHelper_PaletteColorCount(bmiHeader.biClrUsed, bmiHeader.biBitCount );
      if ( sizeof_image > 0 )
        m_bits = (unsigned char*)&m_bmi->bmiColors[color_count];
      size_t sizeof_buffer = 0;
      rc = file.ReadCompressedBufferSize( &sizeof_buffer );
      if (rc)
      {
        const size_t sizeof_colors = color_count*sizeof(*m_bmi->bmiColors);
        if (    sizeof_buffer == sizeof_colors
             || sizeof_buffer == sizeof_colors + sizeof_image
           )
        {
          // palette and image bits are compressed into one or two chunks
          rc = file.ReadCompressedBuffer( sizeof_buffer, m_bmi->bmiColors, &bFailedCRC );
          if ( rc && sizeof_image > 0 && sizeof_buffer == sizeof_colors )
          {
            // 28 July 2003
            //     Added support for reading non-contiguous bitmaps
            sizeof_buffer = 0;
            rc = file.ReadCompressedBufferSize( &sizeof_buffer );
            if (rc)
            {
              if ( sizeof_buffer == sizeof_image )
              {
                // image bits are compressed into a separatechunk
                rc = file.ReadCompressedBuffer( sizeof_buffer, &m_bmi->bmiColors[color_count], &bFailedCRC );
              }
              else
              {
                ON_ERROR("ON_WindowsBitmap::ReadCompressed() image bits buffer size mismatch\n");
                rc = false;
              }
            }
          }
        }
        else
        {
          ON_ERROR("ON_WindowsBitmap::ReadCompressed() buffer size mismatch\n");
          rc = false;
        }
      }
    }
  }
  return rc;
}

bool ON_WindowsBitmap::IsContiguous() const
{
  bool rc = false;
  if ( 0 != m_bmi && 0 != m_bits && m_bmi->bmiHeader.biSizeImage > 0 )
  {
    // p1 points to the first byte after the color palette.
    unsigned char* p1 = (unsigned char*)&m_bmi->bmiColors[PaletteColorCount()];
    rc = ( m_bits == p1 );
  }
  return rc;
}

#if defined(ON_OS_WINDOWS_GDI)

#pragma message( " --- OpenNURBS including Windows BITMAPINFO support in ON_WindowsBitmap" )

ON_WindowsBitmap::ON_WindowsBitmap( const BITMAPINFO& src )
                 : m_bmi(0), m_bits(0), m_bFreeBMI(0)
{
  *this = src;
}

ON_WindowsBitmap& ON_WindowsBitmap::operator=( const BITMAPINFO& src )
{
  Destroy();
  int color_count = ON_WindowsBitmapHelper_PaletteColorCount(src.bmiHeader.biClrUsed, src.bmiHeader.biBitCount );
  Create(&src,(const unsigned char*)(&src.bmiColors[color_count]),true);
  return *this;
}

bool ON_WindowsBitmap::Create( const BITMAPINFO* bmi, const unsigned char* bits, bool bCopy )
{
  bool rc = false;
  Destroy();
  m_bFreeBMI = 0;
  m_bmi = 0;
  m_bits = 0;

  if ( 0 != bmi )
  {
    if ( bCopy )
    {
      // allocate a contiguous Windows device independent bitmap
      const size_t sizeof_palette = ON_WindowsBitmapHelper_SizeofPalette(bmi->bmiHeader.biClrUsed, bmi->bmiHeader.biBitCount );
      const int sizeof_image   = bmi->bmiHeader.biSizeImage;
      m_bmi = ON_WindowsBitmapHelper_AllocBMI( sizeof_palette, (bCopy?sizeof_image:0) );
      if ( 0 != m_bmi )
      {
        rc = true;
        m_bFreeBMI = 1; // ~ON_WindowsBitmap will free the m_bmi pointer
        m_bmi->bmiHeader = bmi->bmiHeader;
        m_bmi->bmiHeader.biSize = sizeof(m_bmi->bmiHeader);
        int color_count = ON_WindowsBitmapHelper_PaletteColorCount(bmi->bmiHeader.biClrUsed, bmi->bmiHeader.biBitCount );
        if ( color_count > 0 )
        {
          memcpy( &m_bmi->bmiColors[0], &bmi->bmiColors[0], color_count*sizeof(m_bmi->bmiColors[0]) );
        }
        if ( bCopy && sizeof_image > 0 )
        {
          m_bits = (unsigned char*)(&m_bmi->bmiColors[color_count]);
          if ( 0 != bits )
            memcpy( m_bits, bits, sizeof_image );
          else
            memset( m_bits, 0, sizeof_image );
        }
      }
    }
    else
    {
      // share BITMAPINFO memory
      rc = true;
      m_bmi = const_cast<BITMAPINFO*>(bmi);
      m_bits = const_cast<unsigned char*>(bits);
    }
  }

  return rc;
}

ON_WindowsBitmap::ON_WindowsBitmap( const BITMAPINFO* src )
                 : m_bmi(0), m_bits(0), m_bFreeBMI(0)
{
  if ( 0 != src )
  {
    int color_count = ON_WindowsBitmapHelper_PaletteColorCount(src->bmiHeader.biClrUsed, src->bmiHeader.biBitCount );
    Create(src,(const unsigned char*)(&src->bmiColors[color_count]),false);
  }
}

//BITMAPINFO* ON_WindowsBitmap::Convert()
//{
//  return m_bmi;
//}

#endif

////////////////////////////////////////////////////////////////////////////////
//
// ON_EmbeddedBitmap - used to embed bitmaps in 3dm archives
//

ON_EmbeddedBitmap::ON_EmbeddedBitmap()
{
  m_buffer = 0;
  m_sizeof_buffer = 0;
  m_free_buffer = 0;
  m_biffer_crc32 = 0;
}

ON_EmbeddedBitmap::~ON_EmbeddedBitmap()
{
  Destroy();
}

void ON_EmbeddedBitmap::EmergencyDestroy()
{
  m_buffer = 0;
  m_sizeof_buffer = 0;
  m_free_buffer = 0;
  m_biffer_crc32 = 0;
  ON_Bitmap::EmergencyDestroy();
}

void ON_EmbeddedBitmap::Destroy()
{
  if ( 0 != m_buffer && 1 == m_free_buffer )
  {
    onfree(m_buffer);
    m_buffer = 0;
  }
  m_sizeof_buffer = 0;
  m_free_buffer = 0;
  m_biffer_crc32 = 0;
  ON_Bitmap::Destroy();
}

void ON_EmbeddedBitmap::Create( int sizeof_buffer )
{
  Destroy();
  if ( sizeof_buffer > 0 )
  {
    m_buffer = onmalloc(sizeof_buffer);
    if ( 0 != m_buffer )
    {
      m_sizeof_buffer = sizeof_buffer;
      m_free_buffer = 1;
    }
  }
}

ON_BOOL32 ON_EmbeddedBitmap::IsValid( ON_TextLog* text_log ) const
{
  if ( 0 == m_buffer )
  {
    if ( 0 != text_log )
      text_log->Print("ON_EmbeddedBitmap m_buffer = 0\n");
    return false;
  }
  return true;
}

ON_BOOL32 ON_EmbeddedBitmap::Write( ON_BinaryArchive& file ) const
{
  ON_BOOL32 rc = file.Write3dmChunkVersion(1,0);
  if (rc)
    rc = file.WriteString(m_bitmap_filename);
  if (rc)
    rc = file.WriteInt(m_biffer_crc32);
  int i = 1; // 0 = uncompressed, 1 = compressed
  if (rc)
    rc = file.WriteInt(i); // 1 = compressed
  switch(i)
  {
  case 0:
    if (rc)
      rc = file.WriteSize(m_sizeof_buffer);
    if (rc)
      rc = file.WriteByte(m_sizeof_buffer,m_buffer);
    break;
  case 1:
    if (rc)
      rc = file.WriteCompressedBuffer( m_sizeof_buffer, m_buffer );
    break;
  }
  return rc;
}

ON_BOOL32 ON_EmbeddedBitmap::Read( ON_BinaryArchive& file )
{
  ON_BOOL32 bFailedCRC = false;
  Destroy();

  int major_version = 0;
  int minor_version = 0;
  ON_BOOL32 rc = file.Read3dmChunkVersion(&major_version,&minor_version);
  if ( rc && 1 == major_version  )
  {
    int i = -1;
    if (rc)
      rc = file.ReadString(m_bitmap_filename);
    if (rc)
      rc = file.ReadInt(&m_biffer_crc32);
    rc = file.ReadInt(&i);
    if (rc)
    {
      switch(i)
      {
      case 0:
        if (rc)
        {
          if (rc)
            rc = file.ReadSize(&m_sizeof_buffer);
          if ( rc && m_sizeof_buffer > 0 )
          {
            m_buffer = onmalloc(m_sizeof_buffer);
            m_free_buffer = 1;
          }
          if (rc)
            rc = file.ReadByte(m_sizeof_buffer,m_buffer);
        }
        break;
      case 1:
        if (rc)
        {
          if (rc)
            rc = file.ReadCompressedBufferSize(&m_sizeof_buffer);
          if ( rc && m_sizeof_buffer > 0 )
          {
            m_buffer = onmalloc(m_sizeof_buffer);
            m_free_buffer = 1;
          }
          if (rc)
            rc = file.ReadCompressedBuffer(m_sizeof_buffer,m_buffer,&bFailedCRC);
        }
        break;
      }
    }
  }
  else
    rc = false;

  return rc;
}

int ON_EmbeddedBitmap::Width() const {return 0;}
int ON_EmbeddedBitmap::Height() const {return 0;}
int ON_EmbeddedBitmap::BitsPerPixel() const {return 0;}
int ON_EmbeddedBitmap::SizeofScan() const {return 0;}
int ON_EmbeddedBitmap::SizeofImage() const {return 0;}
unsigned char* ON_EmbeddedBitmap::Bits(int) {return 0;}
const unsigned char* ON_EmbeddedBitmap::Bits(int) const {return 0;}


text:
(function () {

    // Create all modules and define dependencies to make sure they exist
    // and are loaded in the correct order to satisfy dependency injection
    // before all nested files are concatenated by Grunt

    // Modules
    angular.module('angular-jwt',
        [
            'angular-jwt.interceptor',
            'angular-jwt.jwt'
        ]);

    angular.module('angular-jwt.interceptor', [])
     .provider('jwtInterceptor', function () {

         this.urlParam = null;
         this.authHeader = 'Authorization';
         this.authPrefix = 'Bearer ';
         this.tokenGetter = function () {
             return null;
         }

         var config = this;

         this.$get = ["$q", "$injector", "$rootScope", function ($q, $injector, $rootScope) {
             return {
                 request: function (request) {
                     if (request.skipAuthorization) {
                         return request;
                     }

                     if (config.urlParam) {
                         request.params = request.params || {};
                         // Already has the token in the url itself
                         if (request.params[config.urlParam]) {
                             return request;
                         }
                     } else {
                         request.headers = request.headers || {};
                         // Already has an Authorization header
                         if (request.headers[config.authHeader]) {
                             return request;
                         }
                     }

                     var tokenPromise = $q.when($injector.invoke(config.tokenGetter, this, {
                         config: request
                     }));

                     return tokenPromise.then(function (token) {
                         if (token) {
                             if (config.urlParam) {
                                 request.params[config.urlParam] = token;
                             } else {
                                 request.headers[config.authHeader] = config.authPrefix + token;
                             }
                         }
                         return request;
                     });
                 },
                 responseError: function (response) {
                     // handle the case where the user is not authenticated
                     if (response.status === 401) {
                         $rootScope.$broadcast('unauthenticated', response);
                     }
                     return $q.reject(response);
                 }
             };
         }];
     });

    angular.module('angular-jwt.jwt', [])
     .service('jwtHelper', function () {

         this.urlBase64Decode = function (str) {
             var output = str.replace(/-/g, '+').replace(/_/g, '/');
             switch (output.length % 4) {
                 case 0: { break; }
                 case 2: { output += '=='; break; }
                 case 3: { output += '='; break; }
                 default: {
                     throw 'Illegal base64url string!';
                 }
             }
             return decodeURIComponent(escape(window.atob(output))); //polifyll https://github.com/davidchambers/Base64.js
         }

         this.decodeToken = function (token) {
             if (token == null) {
                 throw new Error('JWT not must be null');
             }

             var parts = token.split('.');

             if (parts.length !== 3) {
                 throw new Error('JWT must have 3 parts');
             }

             var decoded = this.urlBase64Decode(parts[1]);
             if (!decoded) {
                 throw new Error('Cannot decode the token');
             }

             return JSON.parse(decoded);
         }

         this.getTokenExpirationDate = function (token) {
             try {
                 var decoded;
                 decoded = this.decodeToken(token);

                 if (typeof decoded.Exp === "undefined") {
                     return null;
                 }

                 var d = new Date(0); // The 0 here is the key, which sets the date to the epoch
                 d.setUTCSeconds(decoded.Exp);

                 return d;
             } catch(e) {
                 return null;
             }
         };

         this.isTokenExpired = function (token, offsetSeconds) {
             var d = this.getTokenExpirationDate(token);
             offsetSeconds = offsetSeconds || 0;
             if (d === null) {
                 return true;
             }

             // Token expired?
             return !(d.valueOf() > (new Date().valueOf() + (offsetSeconds * 1000)));
         };
     });

}());


text:
from __future__ import unicode_literals

from django.db import migrations, models
import django.utils.timezone

class Migration(migrations.Migration):

    dependencies = [
        ('projects', '0001_initial'),
    ]

    operations = [
        migrations.AlterField(
            model_name='membership',
            name='date_requested',
            field=models.DateTimeField(default=django.utils.timezone.now, null=True),
        ),
    ]


text:
CREATE TABLE IF NOT EXISTS `cards` (
  `card_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `card_type` varchar(16) NOT NULL,
  `card_type_arg` int(11) NOT NULL,
  `card_location` varchar(16) NOT NULL,
  `card_location_arg` int(11) NOT NULL,
  `card_status` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`card_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

CREATE TABLE IF NOT EXISTS `tokens` (
  `card_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `card_type` varchar(16) NOT NULL,
  `card_type_arg` int(11) NOT NULL,
  `card_location` varchar(100) NOT NULL,
  `card_location_arg` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`card_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

CREATE TABLE IF NOT EXISTS `treasures` (
  `card_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `card_type` varchar(16) NOT NULL,
  `card_type_arg` int(11) NOT NULL,
  `card_location` varchar(16) NOT NULL,
  `card_location_arg` int(11) NOT NULL,
  PRIMARY KEY (`card_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- Example 2: add a custom field to the standard "player" table

ALTER TABLE `player` ADD `player_gold` INT NOT NULL DEFAULT '0';
ALTER TABLE `player` ADD `player_xp` INT NOT NULL DEFAULT '0';


text:
package com.google.test.metric.asm;

import org.objectweb.asm.signature.SignatureVisitor;

public class NoopSignatureVisitor implements SignatureVisitor {

  public SignatureVisitor visitArrayType() {
    return new NoopSignatureVisitor();
  }

  public void visitBaseType(char descriptor) {
  }

  public SignatureVisitor visitClassBound() {
    return new NoopSignatureVisitor();
  }

  public void visitClassType(String name) {
  }

  public void visitEnd() {
  }

  public SignatureVisitor visitExceptionType() {
    return new NoopSignatureVisitor();
  }

  public void visitFormalTypeParameter(String name) {
  }

  public void visitInnerClassType(String name) {
  }

  public SignatureVisitor visitInterface() {
    return new NoopSignatureVisitor();
  }

  public SignatureVisitor visitInterfaceBound() {
    return new NoopSignatureVisitor();
  }

  public SignatureVisitor visitParameterType() {
    return new NoopSignatureVisitor();
  }

  public SignatureVisitor visitReturnType() {
    return new NoopSignatureVisitor();
  }

  public SignatureVisitor visitSuperclass() {
    return new NoopSignatureVisitor();
  }

  public void visitTypeArgument() {
  }

  public SignatureVisitor visitTypeArgument(char wildcard) {
    return new NoopSignatureVisitor();
  }

  public void visitTypeVariable(String name) {
  }

}


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

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<meta name="copyright" content="(C) Copyright 2014" />
<meta name="DC.rights.owner" content="(C) Copyright 2014" />
<meta name="generator" content="DITA-OT"/>
<meta name="DC.type" content="topic" />
<meta name="DC.title" content="XRef Target Topic" />
<meta name="DC.format" content="XHTML" />
<meta name="DC.identifier" content="topic-1" />
<link rel="stylesheet" type="text/css" href="../commonltr.css" />
<title>XRef Target Topic</title>

XRef Target Topic

This topic is a target of an xref from a conreffed element. It is in the same directory as the conreffing topic but a different directory from the conref source.


text:
package com.ragnarok.rxcamera.request;

import android.hardware.Camera;

import com.ragnarok.rxcamera.RxCamera;
import com.ragnarok.rxcamera.RxCameraData;

import rx.Observable;

/**
 * Created by ragnarok on 15/11/15.
 * CameraRequestBuilder can help you get the camera preview frame data in different way
 */
public class RxCameraRequestBuilder {

    private RxCamera rxCamera;

    public RxCameraRequestBuilder(RxCamera rxCamera) {
        this.rxCamera = rxCamera;
    }

    /**
     * successive camera preview frame data
     * @return Observable contained the camera data
     */
    public Observable<RxCameraData> successiveDataRequest() {
        return new SuccessiveDataRequest(rxCamera).get();
    }

    /**
     * periodic camera preview frame data
     * @param intervalMills the interval of the preview frame data will return, in millseconds
     * @returni Observable contained the camera data
     */
    public Observable<RxCameraData> periodicDataRequest(long intervalMills) {
        return new PeriodicDataRequest(rxCamera, intervalMills).get();
    }

    /**
     * only one shot camera data, encapsulated the setOneShotPreviewCallback
     * @return Observable contained the camera data
     */
    public Observable<RxCameraData> oneShotRequest() {
        return new TakeOneShotRequest(rxCamera).get();
    }

    /**
     * take picture request with default picture format and size, after call, will stop camera preview just like {@code Camera.takePicture}
     * @param isContinuePreview if continue preview after picture is captured
     * @param shutterAction call when the image is captured, it will be invoked before retrieve the actual image data
     * @return
     */
    public Observable<RxCameraData> takePictureRequest(boolean isContinuePreview, Func shutterAction) {
        return new TakePictureRequest(rxCamera, shutterAction, isContinuePreview).get();
    }

    /**
     * take picture request with specific size, after call, will stop camera preview just like {@code Camera.takePicture}
     * @param isContinuePreview if continue preview after picture is captured
     * @param shutterAction
     * @param width
     * @param height
     * @param openFlash will open the flash when taking picture if set to true
     * @return
     */
    public Observable<RxCameraData> takePictureRequest(boolean isContinuePreview, Func shutterAction, int width, int height, boolean openFlash) {
        return new TakePictureRequest(rxCamera, shutterAction, isContinuePreview, width, height, -1, openFlash).get();
    }

    /**
     * take picture request with specific size and picture format, after call, will stop camera preview just like {@code Camera.takePicture}
     * @param isContinuePreview if continue preview after picture is captured
     * @param shutterAction
     * @param width
     * @param height
     * @param format the final format of the picture, must be one of <var>ImageFormat.NV21</var>, <var>ImageFormat.RGB_565</var>, or <var>ImageFormat.JPEG</var>, the default is JPG
     * @param openFlash will open the flash when taking picture if set to true
     * @return
     */
    public Observable<RxCameraData> takePictureRequest(boolean isContinuePreview, Func shutterAction, int width, int height, int format, boolean openFlash) {
        return new TakePictureRequest(rxCamera, shutterAction, isContinuePreview, width, height, format, openFlash).get();
    }

    /**
     * the face detection request, after set this, the returned {@link RxCameraData#faceList} will contain the
     * faces position list
     * this request use {@link Camera#startFaceDetection()}, so after setting this, the focus area the metering
     * have no effect
     * @return
     */
    public Observable<RxCameraData> faceDetectionRequest() {
        return new FaceDetectionRequest(rxCamera).get();
    }
}


text:
"""Private constants for the package."""

from grpc.framework.interfaces.base import base
from grpc.framework.interfaces.links import links

TICKET_SUBSCRIPTION_FOR_BASE_SUBSCRIPTION_KIND = {
    base.Subscription.Kind.NONE: links.Ticket.Subscription.NONE,
    base.Subscription.Kind.TERMINATION_ONLY:
        links.Ticket.Subscription.TERMINATION,
    base.Subscription.Kind.FULL: links.Ticket.Subscription.FULL,
    }

# Mapping from abortive operation outcome to ticket termination to be
# sent to the other side of the operation, or None to indicate that no
# ticket should be sent to the other side in the event of such an
# outcome.
ABORTION_OUTCOME_TO_TICKET_TERMINATION = {
    base.Outcome.CANCELLED: links.Ticket.Termination.CANCELLATION,
    base.Outcome.EXPIRED: links.Ticket.Termination.EXPIRATION,
    base.Outcome.LOCAL_SHUTDOWN: links.Ticket.Termination.SHUTDOWN,
    base.Outcome.REMOTE_SHUTDOWN: None,
    base.Outcome.RECEPTION_FAILURE: links.Ticket.Termination.RECEPTION_FAILURE,
    base.Outcome.TRANSMISSION_FAILURE: None,
    base.Outcome.LOCAL_FAILURE: links.Ticket.Termination.LOCAL_FAILURE,
    base.Outcome.REMOTE_FAILURE: links.Ticket.Termination.REMOTE_FAILURE,
}

INTERNAL_ERROR_LOG_MESSAGE = ':-( RPC Framework (Core) internal error! )-:'
TERMINATION_CALLBACK_EXCEPTION_LOG_MESSAGE = (
    'Exception calling termination callback!')


text:
<Alloy>
	<Window class="container">

		<View id="indexView" class="centerView">
			<ImageView id="logo" image="tastemaker-logo.png" />

			Find your perfect decorator.

			<View id="loginView">

				<TextField class="input" id="loginEmail" hintText="Email"></TextField>
				<TextField class="input" id="loginPassword" passwordMask="true" hintText="Password"></TextField>

			</View>

			<Button id="login" onClick="login">LOG IN</Button>
			<Button id="signup" onClick="signup">SIGN UP</Button>
		</View>

	</Window>
</Alloy>


text:
ACCEPTED

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

#### Published in
Bull. natn. Sci. Mus. , Tokyo, N. S. 1(2 (no. 35)): 68 (1954)

#### Original name
Rhizoclosmatium marinum Kobayasi & M. Ôkubo, 1954

### Remarks
null