text:
package gov.nih.nci.evs.restapi.appl;

import gov.nih.nci.evs.restapi.util.*;
import gov.nih.nci.evs.restapi.bean.*;
import gov.nih.nci.evs.restapi.common.*;

import java.io.*;
//import java.math.*;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.*;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.util.*;
import java.util.regex.*;
import org.json.*;

/**
 * @author EVS Team
 * @version 1.0
 *
 * Modification history:
 *     Initial implementation kim.ong@nih.gov
 *
 */

public class CTRPProcessor {
	static String CTRP_TERMINOLOGY_CODE = "C116977";
	static String CTRP_TERMINOLOGY_LABEL = "CTRP terminology";

    JSONUtils jsonUtils = null;
    HTTPUtils httpUtils = null;
    String named_graph = null;
    String prefixes = null;
    String sparql_endpoint = null;
    String serviceUrl = null;
    String named_graph_id = ":NHC0";
    String base_uri = "http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl";

    OWLSPARQLUtils owlSPARQLUtils = null;

	private static String NCI_THESAURUS = "NCI_Thesaurus";
	private String namedGraph = null;

	public Vector concepts_in_subset = null;

	private TermSearchUtils termSearchUtils = null;
	private HashSet ncit_code_hset = null;

	private List synonyms = null;
    private HashMap code2SynonymMap = null;
    private HashMap ncitcode2labelMap = null;

    private UNIIDataRetriever uniiDataRetriever = null;

	public CTRPProcessor(String serviceUrl, String namedGraph) {
		this.serviceUrl = serviceUrl;
		this.namedGraph = namedGraph;
		System.out.println("serviceUrl: " + this.serviceUrl);
		System.out.println("namedGraph: " + this.namedGraph);

		owlSPARQLUtils = new OWLSPARQLUtils(serviceUrl, null, null);
		new MetadataUtils(serviceUrl).dumpNameVersion2NamedGraphMap();
		uniiDataRetriever = new UNIIDataRetriever(this.serviceUrl, this.namedGraph);
/*
		if (!fileExists(FDA_UNII_Subset_Code + ".txt")) {
			System.out.println("Retrieving supporting data from triple store server ...");
			uniiDataRetriever = new UNIIDataRetriever(this.serviceUrl, this.namedGraph);
			uniiDataRetriever.retrieveUNIISupportingData();
			System.out.println("Completed retrieving supporting data.");
		}

		System.out.println("Initialized TermSearchUtils ...");
*/
		//termSearchUtils = new TermSearchUtils(serviceUrl, this.namedGraph);
		synonyms = loadSynonyms();
		System.out.println("createCode2SynonymMap ...");
		code2SynonymMap = createCode2SynonymMap(synonyms);
		System.out.println("createCode2SynonymMap done. " + code2SynonymMap.keySet().size());
	}

	public void dumpSynonymData() {
		for (int i=0; i<synonyms.size(); i++) {
			Synonym syn = (Synonym) synonyms.get(i);
			System.out.println(syn.toJson());
		}
	}

    public boolean fileExists(String filename) {
		File file = new File(filename);
		return file.exists();
	}

/*
Name	TYPE	UNII	Display Name
(R)-2-(5-CYANO-2-(6-(METHOXYCARBONYL)-7-METHYL-3-OXO-8-(3-(TRIFLUOROMETHYL)PHENYL)-2,3,5,8-TETRAHYDRO-(1,2,4)TRIAZOLO(4,3-A)PYRIMIDIN-5-YL)PHENYL)-N,N,N-TRIMETHYLETHANAMINIUM	sys	00174624E2	CHF-6333 CATION
(R)-2-(5-CYANO-2-(6-(METHOXYCARBONYL)-7-METHYL-3-OXO-8-(3-(TRIFLUOROMETHYL)PHENYL)-2,3,5,8-TETRAHYDRO-(1,2,4)TRIAZOLO(4,3-A)PYRIMIDIN-5-YL)PHENYL)-N,N,N-TRIMETHYLETHANAMINIUM ION	cn	00174624E2	CHF-6333 CATION
*/

	public Vector getOWLClasses() {
		return owlSPARQLUtils.getOWLClasses(this.namedGraph);
	}

	public Vector getConceptsInSubset(String code) {
        boolean codeOnly = false;
        Vector v = owlSPARQLUtils.getConceptsInSubset(this.namedGraph, code, codeOnly);
 	    v = new ParserUtils().getResponseValues(v);
	    v = new SortUtils().quickSort(v);
	    return v;
	}

    public Vector getTerminologyVersion(String terminology) {
		HashMap hmap = new MetadataUtils(serviceUrl).getNameVersion2NamedGraphMap();
		Vector w = new Vector();
		Iterator it = hmap.keySet().iterator();
		while (it.hasNext()) {
			String key = (String) it.next();
			Vector u = StringUtils.parseData(key, '|');
			String codingSchemeName = (String) u.elementAt(0);
			String codingSchemeVersion = (String) u.elementAt(1);
			if (codingSchemeName.compareTo(terminology) == 0) {
				if (!w.contains(codingSchemeVersion)) {
					w.add(codingSchemeVersion);
				}
			}
		}
		return w;
	}

	public Vector getPropertyQualifierValuesByCode(String code, String prop_label, String qualifier_label) {
		return owlSPARQLUtils.getPropertyQualifierValuesByCode(this.namedGraph, code, prop_label, qualifier_label);
	}

	public Vector getAxioms(String code, String propertyName) {
		Vector v = owlSPARQLUtils.getAxioms(this.namedGraph, code, propertyName);
		//v = new ParserUtils().getResponseValues(v);
		return v;
	}

    public Vector getAxiomsWithQualifierMatching(String code, String prop_label, String qualifier_label, String qualifier_value) {
        return owlSPARQLUtils.getAxiomsWithQualifierMatching(this.namedGraph, code, prop_label, qualifier_label, qualifier_value);
    }

	public HashMap createSubsourceNameHashMap(Vector subsource_name_data) {
		HashMap hmap = new HashMap();
		for (int i=0; i<subsource_name_data.size(); i++) {
			String line = (String) subsource_name_data.elementAt(i);
			Vector u = parseData(line, '|');
			String code = (String) u.elementAt(2);
			String sourcename = (String) u.elementAt(8);
			Vector v = new Vector();
			if (hmap.containsKey(code)) {
				v = (Vector) hmap.get(code);
			}
			v.add(sourcename);
			hmap.put(code, v);
		}
		return hmap;
	}

		/*
		bnode_301c03a7_663e_49c8_be4e_8726b4fc92ea_826645|Cyclophosphamide|C405|FULL_SYN|P90|CYCLOPHOSPHAMIDE|Term Source|P384|FDA
		bnode_301c03a7_663e_49c8_be4e_8726b4fc92ea_914386|Fluoxymesterone|C507|FULL_SYN|P90|FLUOXYMESTERONE|Term Source|P384|FDA
        */
	public HashMap createTermSourceHashMap(Vector term_source_data) {
		HashMap hmap = new HashMap();
		for (int i=0; i<term_source_data.size(); i++) {
			String line = (String) term_source_data.elementAt(i);
			Vector u = parseData(line, '|');
			String code = (String) u.elementAt(2);
			String sourcename = (String) u.elementAt(8);
			Vector v = new Vector();
			if (hmap.containsKey(code)) {
				v = (Vector) hmap.get(code);
			}
			v.add(sourcename);
			hmap.put(code, v);
		}
		return hmap;
	}

	public HashMap createSourceCodeHashMap(Vector source_code_data) {
		HashMap hmap = new HashMap();
		for (int i=0; i<source_code_data.size(); i++) {
			String line = (String) source_code_data.elementAt(i);
			Vector u = parseData(line, '|');
			String code = (String) u.elementAt(2);
			String sourcename = (String) u.elementAt(8);
			Vector v = new Vector();
			if (hmap.containsKey(code)) {
				v = (Vector) hmap.get(code);
			}
			v.add(sourcename);
			hmap.put(code, v);
		}
		return hmap;
	}

	public HashMap createSynonymHashMap() {
		Vector v = new Vector();
		Vector subsource_name_data = Utils.readFile("subsource-name.txt");
		v.addAll(subsource_name_data);
		Vector term_source_data = Utils.readFile("term-source-fda.txt");
		v.addAll(term_source_data);
		Vector source_code_data = Utils.readFile("source-code.txt");
		v.addAll(source_code_data);
		v = new SortUtils().quickSort(v);

		List list = new ParserUtils().getSynonyms(v);
        HashMap hmap = new HashMap();
        ncit_code_hset = new HashSet();
		for (int i=0; i<list.size(); i++) {
			int j = i+1;
			Synonym syn = (Synonym) list.get(i);
			String code = syn.getCode();
			ncit_code_hset.add(code);
			Vector w = new Vector();
			if (hmap.containsKey(code)) {
				w = (Vector) hmap.get(code);
			}
			w.add(syn);
			hmap.put(code, w);
		}
		return hmap;
	}

	public Vector retrievePropertyData(String propertyName) {
		String prop_label = "FULL_SYN";
		Vector v = owlSPARQLUtils.get_property_query(this.namedGraph, propertyName);
        return v;
	}

	public Vector retrieveTermSourceData(String qualifier_value) {
		String prop_label = "FULL_SYN";
		String qualifier_label = "Term Source";
		//String qualifier_value = "FDA";
		Vector v = owlSPARQLUtils.getAxiomsWithQualifierMatching(this.namedGraph, null, prop_label, qualifier_label, qualifier_value);
        return v;
	}

	public Vector retrieveTermTypeData(String qualifier_value) {
		String prop_label = "FULL_SYN";
		String qualifier_label = "Term Type";
		Vector v = owlSPARQLUtils.getAxiomsWithQualifierMatching(this.namedGraph, null, prop_label, qualifier_label, qualifier_value);
        return v;
	}

    public HashMap findCTRPConcepts() {
		HashMap hmap = new HashMap();
		Vector v = new Vector();
		for (int i=0; i<synonyms.size(); i++) {
			int j = i+1;
			Synonym syn = (Synonym) synonyms.get(i);
			if (syn.getTermSource() != null && syn.getTermSource().compareTo("CTRP") == 0) {
				hmap.put(syn.getCode(), syn.getLabel());
			}
		}
		return hmap;
	}

    public Vector searchFullSynWithCTRP() {
		Vector w = new Vector();
		for (int i=0; i<synonyms.size(); i++) {
			int j = i+1;
			Synonym syn = (Synonym) synonyms.get(i);
			if ((syn.getTermSource() != null && syn.getTermSource().compareTo("CTRP") == 0)) {
				w.add(syn.getCode());
			}
		}
		return w;
	}

    public Vector searchFullSynWithCTRPND() {
		Vector w = new Vector();
		for (int i=0; i<synonyms.size(); i++) {
			int j = i+1;
			Synonym syn = (Synonym) synonyms.get(i);
			if ((syn.getTermSource() != null && syn.getTermSource().compareTo("CTRP") == 0) &&
				(syn.getTermGroup() != null && syn.getTermGroup().compareTo("DN") == 0)) {
				w.add(syn.getCode());
			}
		}
		return w;
	}

    public boolean searchFullSyn(String code, String source, String type) {
		for (int i=0; i<synonyms.size(); i++) {
			int j = i+1;
			Synonym syn = (Synonym) synonyms.get(i);
			if (syn.getCode().compareTo(code) == 0) {
				if ((syn.getTermSource() != null && syn.getTermSource().compareTo("CTRP") == 0) &&
				    (syn.getTermGroup() != null && syn.getTermGroup().compareTo("DN") == 0)) {
				    return true;
				}
			}
		}
		return false;
	}

	public Vector searchSynonyms(String code) {
		return (Vector) code2SynonymMap.get(code);
	}

	public Vector searchForMissingDNInCTRPTerms() { // = "ncit_unii.txt";) {
		HashMap hmap = findCTRPConcepts();
		Vector w = new Vector();
		Vector missing_dn_vec = new Vector();
		Iterator it = hmap.keySet().iterator();
		int i = 0;
		Vector error_vec = new Vector();
		while (it.hasNext()) {
			i++;
			String code = (String) it.next();
			String label = (String) hmap.get(code);
			boolean retval = searchFullSyn(code, "CTRP", "DN");
			if (!retval) {
				missing_dn_vec.add(code);
			}
		}

		for (i=0; i<missing_dn_vec.size(); i++) {
			String code = (String) missing_dn_vec.elementAt(i);
			String label = (String) hmap.get(code);
			Vector syns = searchSynonyms(code);
			w.add("(" + i + ") " + label + "(" + code + ")");
			for (int j=0; j<syns.size(); i++) {
				Synonym syn = (Synonym) syns.elementAt(j);
				w.add(syn.toJson());
			}
		}
		return w;
	}

	public void runCTRPQA() {
		Vector w = new Vector();
		Vector v1 = searchFullSynWithCTRPND();
		Vector v2 = searchFullSynWithCTRP();

		System.out.println("Number of FULL_SYN with CTRP source and DN type: " + v1.size());
		System.out.println("Number of FULL_SYN with CTRP source: " + v2.size());

        for (int i=0; i<v2.size(); i++) {
			String code = (String) v2.elementAt(i);
			if (!v1.contains(code)) {
				Vector u = (Vector) code2SynonymMap.get(code);
				Synonym syn0 = (Synonym) u.elementAt(0);
				String label = syn0.getLabel();
				w.add(label + " (" + code + ")");
				for (int j=0; j<u.size(); j++) {
					Synonym syn = (Synonym) u.elementAt(j);
					w.add(syn.toJson());
				}
				w.add("\n");
			}
		}

        String property_name = "Display_Name";
        String property_value = null;
		Vector display_name_vec = findConceptsWithPropertyMatching(property_name, property_value);
		HashMap display_name_hmap = new HashMap();
		for (int i=0; i<display_name_vec.size(); i++) {
			String line = (String) display_name_vec.elementAt(i);
			Vector u = StringUtils.parseData(line, '|');
			//Therapeutic Procedure|C49236|Display_Name|Therapeutic Procedure
			String code = (String) u.elementAt(1);
			String label = (String) u.elementAt(0);
			display_name_hmap.put(code, label);
		}

		for (int i=0; i<v1.size(); i++) {
			String code = (String) v1.elementAt(i);
			if (!display_name_hmap.containsKey(code)) {
				Vector u = (Vector) code2SynonymMap.get(code);
				Synonym syn0 = (Synonym) u.elementAt(0);
				String label = syn0.getLabel();
				w.add("WARNING: " + label + "(" + code + ") " + " does not have a Display_Name property.");
			}
		}
		w.add("\n");

        property_name = "Contributing_Source";
        property_value = "CTRP";
		Vector contributing_source_vec = findConceptsWithPropertyMatching(property_name, property_value);
		HashMap contributing_source_hmap = new HashMap();
		for (int i=0; i<contributing_source_vec.size(); i++) {
			String line = (String) contributing_source_vec.elementAt(i);
			Vector u = StringUtils.parseData(line, '|');
			String code = (String) u.elementAt(1);
			String label = (String) u.elementAt(0);
			contributing_source_hmap.put(code, label);
		}

		for (int i=0; i<v1.size(); i++) {
			String code = (String) v1.elementAt(i);
			if (!contributing_source_hmap.containsKey(code)) {
				Vector u = (Vector) code2SynonymMap.get(code);
				Synonym syn0 = (Synonym) u.elementAt(0);
				String label = syn0.getLabel();
				w.add("WARNING: " + label + "(" + code + ") " + " does not have a CTRP Contributing_Source.");
			}
		}

		w.add("\n");
		Vector concept_in_subset_vec = get_concepts_in_subset(CTRP_TERMINOLOGY_CODE);
		HashMap concept_in_subset_hmap = new HashMap();
		for (int i=0; i<concept_in_subset_vec.size(); i++) {
			String line = (String) concept_in_subset_vec.elementAt(i);
			Vector u = StringUtils.parseData(line, '|');
			String code = (String) u.elementAt(1);
			String label = (String) u.elementAt(0);
			concept_in_subset_hmap.put(code, label);
		}

		for (int i=0; i<v1.size(); i++) {
			String code = (String) v1.elementAt(i);
			if (!concept_in_subset_hmap.containsKey(code)) {
				Vector u = (Vector) code2SynonymMap.get(code);
				Synonym syn0 = (Synonym) u.elementAt(0);
				String label = syn0.getLabel();
				w.add("WARNING: " + label + "(" + code + ") " + " does not belong to " + CTRP_TERMINOLOGY_LABEL + " (" + CTRP_TERMINOLOGY_CODE + ")");
			}
		}
        String outputfile = "CTRP_QA_" + StringUtils.getToday() + ".txt";
		Utils.saveToFile(outputfile, w);
	}

    public static Vector parseData(String line, char delimiter) {
		if(line == null) return null;
		Vector w = new Vector();
		StringBuffer buf = new StringBuffer();
		for (int i=0; i<line.length(); i++) {
			char c = line.charAt(i);
			if (c == delimiter) {
				w.add(buf.toString());
				buf = new StringBuffer();
			} else {
				buf.append(c);
			}
		}
		w.add(buf.toString());
		return w;
	}

    public static Vector<String> parseData(String line) {
		if (line == null) return null;
        char tab = '|';
        return parseData(line, tab);
    }

	public void saveSynonyms() {
		saveSynonyms(synonyms);
	}

	public void saveSynonyms(List synonyms) {
	    Vector w = new Vector();
	    for (int i=0; i<synonyms.size(); i++) {
			Synonym syn = (Synonym) synonyms.get(i);
			int j = i+1;
			w.add("(" + j + ") " + syn.toJson());
		}
		Utils.saveToFile("synonyms.txt", w);
	}

    public List loadSynonyms() {
		Vector v = new Vector();
		Vector subsource_name_data = uniiDataRetriever.get_term_source_vec();
		v.addAll(subsource_name_data);
		Vector term_source_data = uniiDataRetriever.get_term_source_vec("CTRP");
		v.addAll(term_source_data);
		Vector source_code_data = uniiDataRetriever.get_term_source_code_vec();
		v.addAll(source_code_data);

		Vector term_type_data = uniiDataRetriever.get_term_type_data("DN");
		v.addAll(term_type_data);

		v = new SortUtils().quickSort(v);
		List list = new ParserUtils().getSynonyms(v);
		return list;
	}

    public HashMap createCode2SynonymMap(List synonyms) {
        HashMap hmap = new HashMap();
		for (int i=0; i<synonyms.size(); i++) {
			Synonym syn = (Synonym) synonyms.get(i);
			String code = syn.getCode();
			Vector w = new Vector();
			if (hmap.containsKey(code)) {
				w = (Vector) hmap.get(code);
			}
			w.add(syn);
			hmap.put(code, w);
		}
		return hmap;
	}

    public Synonym searchSynonym(String code) {
		if (code2SynonymMap == null) {
			System.out.println("code2SynonymMap == NULL???");
			return null;
		}

		if (!code2SynonymMap.containsKey(code)) {
			return null;
		}
		Vector w = (Vector) code2SynonymMap.get(code);
		for (int i=0; i<w.size(); i++) {
			Synonym syn = (Synonym) w.get(i);
			if (syn.getTermName() != null && syn.getTermSource() != null && syn.getSubSourceName() != null && syn.getSourceCode() != null) {
			    if (syn.getTermSource().compareTo("FDA") == 0 && syn.getSubSourceName().compareTo("UNII") == 0) {
					return syn;
				}
			}
		}
        return null;
	}

	public Vector findConceptsWithPropertyMatching(String property_name, String property_value) {
	    return owlSPARQLUtils.findConceptsWithPropertyMatching(this.namedGraph, property_name, property_value);
	}

    public Vector get_concepts_in_subset(String code) {
		return owlSPARQLUtils.get_concepts_in_subset(this.namedGraph, code);
	}

    public static void main(String[] args) {
		long ms = System.currentTimeMillis();
		String serviceUrl = args[0];
		String namedGraph = args[1];
		CTRPProcessor processor = new CTRPProcessor(serviceUrl, namedGraph);
		System.out.println("runCTRPQA -- please wait...");
	    processor.runCTRPQA();
        System.out.println("Total run time (ms): " + (System.currentTimeMillis() - ms));
	}
}


text:
NS_ASSUME_NONNULL_BEGIN

NS_CLASS_AVAILABLE_IOS(2_0) @interface UITableViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>

- (instancetype)initWithStyle:(UITableViewStyle)style NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithNibName:(nullable NSString *)nibNameOrNil bundle:(nullable NSBundle *)nibBundleOrNil NS_DESIGNATED_INITIALIZER;
- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder NS_DESIGNATED_INITIALIZER;

@property (nonatomic, strong, null_resettable) UITableView *tableView;
@property (nonatomic) BOOL clearsSelectionOnViewWillAppear NS_AVAILABLE_IOS(3_2); // defaults to YES. If YES, any selection is cleared in viewWillAppear:

@property (nonatomic, strong, nullable) UIRefreshControl *refreshControl NS_AVAILABLE_IOS(6_0) __TVOS_PROHIBITED;

@end

NS_ASSUME_NONNULL_END

redpajama_set_name: RedPajamaGithub


text:
/*jslint nomen: true, vars: true*/
/*global define, requirejs*/

define(['jquery', 'underscore', 'backbone', '../constants',
    'text!./templates/widget-min-template.html',
    'text!./templates/widget-max-template.html'
    ], function ($, _, Backbone, constants, widgetMinTemplate, widgetMaxTemplate) {
    'use strict';

    /**
     * @export  orosidebar/js/widget-container/view
     * @class   orosidebar.widgetContainer.View
     * @extends Backbone.View
     */
    return Backbone.View.extend({
        templateMin: _.template(widgetMinTemplate),
        templateMax: _.template(widgetMaxTemplate),

        events: {
            'click .sidebar-widget-header-toggle': 'onClickToggle',
            'click .sidebar-widget-refresh': 'onClickRefresh',
            'click .sidebar-widget-settings': 'onClickSettings',
            'click .sidebar-widget-remove': 'onClickRemove',
            'click .sidebar-widget-close': 'onClickClose'
        },

        initialize: function () {
            var view = this;
            view.stopListening(view.model, 'change');
            view.listenTo(view.model, 'change', view.render);
        },

        render: function () {
            var view     = this,
                model    = view.model,
                template = null;

            if (model.get('state') === constants.WIDGET_MINIMIZED) {
                template = view.templateMin;
            } else {
                template = view.templateMax;
            }

            view.$el.html(template(model.toJSON()));
            view.$el.attr('data-cid', model.cid);

            if (view.model.get('cssClass')) {
                view.$el.attr('class', view.model.get('cssClass'));
            }

            if (model.get('state') !== constants.WIDGET_MINIMIZED && model.get('module')) {
                requirejs([model.get('module')], function (Widget) {
                    var $widgetContent = view.$el.find('.sidebar-widget-content');
                    if (!view.contentView) {
                        view.contentView = new Widget.ContentView({
                            model: model
                        });
                    }
                    view.contentView.setElement($widgetContent);
                    view.contentView.render();
                });
            }

            if (model.get('state') === constants.WIDGET_MAXIMIZED_HOVER) {
                view.$el.addClass('sidebar-widget-popup');
            } else {
                view.$el.removeClass('sidebar-widget-popup');
            }

            return view;
        },

        setOffset: function (cord) {
            var view = this;
            view.$el.offset(cord);
        },

        onClickToggle: function (e) {
            e.stopPropagation();
            e.preventDefault();

            this.model.toggleState();
            this.model.save();
        },

        onClickRefresh: function (e) {
            e.stopPropagation();
            e.preventDefault();

            Backbone.trigger('refreshWidget', this.model.cid);
        },

        onClickSettings: function (e) {
            e.stopPropagation();
            e.preventDefault();

            Backbone.trigger('setupWidget', this.model.cid);
        },

        onClickRemove: function (e) {
            e.stopPropagation();
            e.preventDefault();
            Backbone.trigger('removeWidget', this.model.cid);
        },

        onClickClose: function (e) {
            e.stopPropagation();
            e.preventDefault();
            Backbone.trigger('closeWidget', this.model.cid);
        }
    });
});


text:
package com.emc.vipr.model.catalog;

import java.net.URI;
import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.annotation.XmlElement;

import com.emc.storageos.model.valid.Length;

public class CatalogServiceCommonParam {

    private String name;
    private String title;
    private String description;
    private String image;
    private Boolean approvalRequired;
    private Boolean executionWindowRequired;
    private URI defaultExecutionWindow;
    private String baseService;
    private Integer maxSize;
    private URI catalogCategory;
    private List<CatalogServiceFieldParam> catalogServiceFields;
    private Boolean recurringAllowed;

    @XmlElement(name = "catalog_category")
    public URI getCatalogCategory() {
        return catalogCategory;
    }

    public void setCatalogCategory(URI catalogCategory) {
        this.catalogCategory = catalogCategory;
    }

    @XmlElement(required = true, name = "title")
    @Length(min = 2, max = 128)
    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    @XmlElement(required = true, name = "description")
    @Length(max = 255)
    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @XmlElement(required = true, name = "image")
    @Length(max = 255)
    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    @XmlElement(name = "approval_required")
    public Boolean getApprovalRequired() {
        return approvalRequired;
    }

    public void setApprovalRequired(Boolean approvalRequired) {
        this.approvalRequired = approvalRequired;
    }

    @XmlElement(name = "execution_window_required")
    public Boolean getExecutionWindowRequired() {
        return executionWindowRequired;
    }

    public void setExecutionWindowRequired(Boolean executionWindowRequired) {
        this.executionWindowRequired = executionWindowRequired;
    }

    @XmlElement(name = "default_execution_window")
    public URI getDefaultExecutionWindow() {
        return defaultExecutionWindow;
    }

    public void setDefaultExecutionWindow(URI defaultExecutionWindow) {
        this.defaultExecutionWindow = defaultExecutionWindow;
    }

    @XmlElement(required = true, name = "base_service")
    @Length(max = 255)
    public String getBaseService() {
        return baseService;
    }

    public void setBaseService(String baseService) {
        this.baseService = baseService;
    }

    @XmlElement(name = "max_size")
    public Integer getMaxSize() {
        return maxSize;
    }

    public void setMaxSize(Integer maxSize) {
        this.maxSize = maxSize;
    }

    @XmlElement(required = true, name = "name")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @XmlElement(name = "catalog_service_fields")
    public List<CatalogServiceFieldParam> getCatalogServiceFields() {
        if (this.catalogServiceFields == null) {
            this.catalogServiceFields = new ArrayList<>();
        }
        return catalogServiceFields;
    }

    public void setCatalogServiceFields(List<CatalogServiceFieldParam> catalogServiceFields) {
        this.catalogServiceFields = catalogServiceFields;
    }

    @XmlElement(name = "recurring_allowed")
    public Boolean getRecurringAllowed() {
        return recurringAllowed;
    }

    public void setRecurringAllowed(Boolean recurringAllowed) {
        this.recurringAllowed = recurringAllowed;
    }
}


text:
//
// This code was auto-generated by AFNOR StoredProcedureSystem, version 1.0
//

using System;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;

namespace AnnuaireCertifies.Domaine
{
    public partial class Lien_GroupeVue_Vue
    {

        [DataMember]
        public long ID { get; set; }

        [DataMember]
        public virtual GroupeVue GroupeVue { get; set; }

        [DataMember]
        public long GroupeVueID { get; set; }

        [DataMember]
        public virtual Vue Vue { get; set; }

        [DataMember]
        public long VueID { get; set; }

        [DataMember]
        public bool IsDefaultVue { get; set; }

        [DataMember]
        public bool IsPrincipal { get; set; }

        [DataMember]
        public bool LoadOnce { get; set; }
    }
}


text:
'use strict';

var d3 = require('d3');
var Plotly = require('../plotly');
var Registry = require('../registry');
var Plots = require('../plots/plots');
var Lib = require('../lib');

var Color = require('../components/color');
var Drawing = require('../components/drawing');
var Titles = require('../components/titles');
var ModeBar = require('../components/modebar');
var initInteractions = require('../plots/cartesian/graph_interact');
var cartesianConstants = require('../plots/cartesian/constants');
var alignmentConstants = require('../constants/alignment');

exports.layoutStyles = function(gd) {
    return Lib.syncOrAsync([Plots.doAutoMargin, exports.lsInner], gd);
};

function overlappingDomain(xDomain, yDomain, domains) {
    for(var i = 0; i < domains.length; i++) {
        var existingX = domains[i][0],
            existingY = domains[i][1];

        if(existingX[0] >= xDomain[1] || existingX[1] <= xDomain[0]) {
            continue;
        }
        if(existingY[0] < yDomain[1] && existingY[1] > yDomain[0]) {
            return true;
        }
    }
    return false;
}

exports.lsInner = function(gd) {
    var fullLayout = gd._fullLayout;
    var gs = fullLayout._size;
    var pad = gs.p;
    var axList = Plotly.Axes.list(gd);

    // _has('cartesian') means SVG specifically, not GL2D - but GL2D
    // can still get here because it makes some of the SVG structure
    // for shared features like selections.
    var hasSVGCartesian = fullLayout._has('cartesian');
    var i;

    function getLinePosition(ax, counterAx, side) {
        var lwHalf = ax._lw / 2;

        if(ax._id.charAt(0) === 'x') {
            if(!counterAx) return gs.t + gs.h * (1 - (ax.position || 0)) + (lwHalf % 1);
            else if(side === 'top') return counterAx._offset - pad - lwHalf;
            return counterAx._offset + counterAx._length + pad + lwHalf;
        }

        if(!counterAx) return gs.l + gs.w * (ax.position || 0) + (lwHalf % 1);
        else if(side === 'right') return counterAx._offset + counterAx._length + pad + lwHalf;
        return counterAx._offset - pad - lwHalf;
    }

    // some preparation of axis position info
    for(i = 0; i < axList.length; i++) {
        var ax = axList[i];

        // reset scale in case the margins have changed
        ax.setScale();

        var counterAx = ax._anchorAxis;

        // clear axis line positions, to be set in the subplot loop below
        ax._linepositions = {};

        // stash crispRounded linewidth so we don't need to pass gd all over the place
        ax._lw = Drawing.crispRound(gd, ax.linewidth, 1);

        // figure out the main axis line and main mirror line position.
        // it's easier to follow the logic if we handle these separately from
        // ax._linepositions, which are really only used by mirror=allticks
        // for the non-main-subplot ticks.
        ax._mainLinePosition = getLinePosition(ax, counterAx, ax.side);
        ax._mainMirrorPosition = (ax.mirror && counterAx) ?
            getLinePosition(ax, counterAx,
                alignmentConstants.OPPOSITE_SIDE[ax.side]) : null;
    }

    fullLayout._paperdiv
        .style({
            width: fullLayout.width + 'px',
            height: fullLayout.height + 'px'
        })
        .selectAll('.main-svg')
            .call(Drawing.setSize, fullLayout.width, fullLayout.height);

    gd._context.setBackground(gd, fullLayout.paper_bgcolor);

    var subplotSelection = fullLayout._paper.selectAll('g.subplot');

    // figure out which backgrounds we need to draw, and in which layers
    // to put them
    var lowerBackgroundIDs = [];
    var lowerDomains = [];
    subplotSelection.each(function(subplot) {
        var plotinfo = fullLayout._plots[subplot];

        if(plotinfo.mainplot) {
            // mainplot is a reference to the main plot this one is overlaid on
            // so if it exists, this is an overlaid plot and we don't need to
            // give it its own background
            if(plotinfo.bg) {
                plotinfo.bg.remove();
            }
            plotinfo.bg = undefined;
            return;
        }

        var xDomain = plotinfo.xaxis.domain;
        var yDomain = plotinfo.yaxis.domain;
        var plotgroupBgData = [];

        if(overlappingDomain(xDomain, yDomain, lowerDomains)) {
            plotgroupBgData = [0];
        }
        else {
            lowerBackgroundIDs.push(subplot);
            lowerDomains.push([xDomain, yDomain]);
        }

        // create the plot group backgrounds now, since
        // they're all independent selections
        var plotgroupBg = plotinfo.plotgroup.selectAll('.bg')
            .data(plotgroupBgData);

        plotgroupBg.enter().append('rect')
            .classed('bg', true);

        plotgroupBg.exit().remove();

        plotgroupBg.each(function() {
            plotinfo.bg = plotgroupBg;
            var pgNode = plotinfo.plotgroup.node();
            pgNode.insertBefore(this, pgNode.childNodes[0]);
        });
    });

    // now create all the lower-layer backgrounds at once now that
    // we have the list of subplots that need them
    var lowerBackgrounds = fullLayout._bgLayer.selectAll('.bg')
        .data(lowerBackgroundIDs);

    lowerBackgrounds.enter().append('rect')
        .classed('bg', true);

    lowerBackgrounds.exit().remove();

    lowerBackgrounds.each(function(subplot) {
        fullLayout._plots[subplot].bg = d3.select(this);
    });

    subplotSelection.each(function(subplot) {
        var plotinfo = fullLayout._plots[subplot];
        var xa = plotinfo.xaxis;
        var ya = plotinfo.yaxis;

        if(plotinfo.bg && hasSVGCartesian) {
            plotinfo.bg
                .call(Drawing.setRect,
                    xa._offset - pad, ya._offset - pad,
                    xa._length + 2 * pad, ya._length + 2 * pad)
                .call(Color.fill, fullLayout.plot_bgcolor)
                .style('stroke-width', 0);
        }

        // Clip so that data only shows up on the plot area.
        plotinfo.clipId = 'clip' + fullLayout._uid + subplot + 'plot';

        var plotClip = fullLayout._clips.selectAll('#' + plotinfo.clipId)
            .data([0]);

        plotClip.enter().append('clipPath')
            .attr({
                'class': 'plotclip',
                'id': plotinfo.clipId
            })
            .append('rect');

        plotClip.selectAll('rect')
            .attr({
                'width': xa._length,
                'height': ya._length
            });

        Drawing.setTranslate(plotinfo.plot, xa._offset, ya._offset);

        var plotClipId;
        var layerClipId;

        if(plotinfo._hasClipOnAxisFalse) {
            plotClipId = null;
            layerClipId = plotinfo.clipId;
        } else {
            plotClipId = plotinfo.clipId;
            layerClipId = null;
        }

        Drawing.setClipUrl(plotinfo.plot, plotClipId);

        for(i = 0; i < cartesianConstants.traceLayerClasses.length; i++) {
            var layer = cartesianConstants.traceLayerClasses[i];
            if(layer !== 'scatterlayer') {
                plotinfo.plot.selectAll('g.' + layer).call(Drawing.setClipUrl, layerClipId);
            }
        }

        // stash layer clipId value (null or same as clipId)
        // to DRY up Drawing.setClipUrl calls downstream
        plotinfo.layerClipId = layerClipId;

        // figure out extra axis line and tick positions as needed
        if(!hasSVGCartesian) return;

        var xLinesXLeft, xLinesXRight, xLinesYBottom, xLinesYTop,
            leftYLineWidth, rightYLineWidth;
        var yLinesYBottom, yLinesYTop, yLinesXLeft, yLinesXRight,
            connectYBottom, connectYTop;
        var extraSubplot;

        function xLinePath(y) {
            return 'M' + xLinesXLeft + ',' + y + 'H' + xLinesXRight;
        }

        function xLinePathFree(y) {
            return 'M' + xa._offset + ',' + y + 'h' + xa._length;
        }

        function yLinePath(x) {
            return 'M' + x + ',' + yLinesYTop + 'V' + yLinesYBottom;
        }

        function yLinePathFree(x) {
            return 'M' + x + ',' + ya._offset + 'v' + ya._length;
        }

        function mainPath(ax, pathFn, pathFnFree) {
            if(!ax.showline || subplot !== ax._mainSubplot) return '';
            if(!ax._anchorAxis) return pathFnFree(ax._mainLinePosition);
            var out = pathFn(ax._mainLinePosition);
            if(ax.mirror) out += pathFn(ax._mainMirrorPosition);
            return out;
        }

        /*
         * x lines get longer where they meet y lines, to make a crisp corner.
         * The x lines get the padding (margin.pad) plus the y line width to
         * fill up the corner nicely. Free x lines are excluded - they always
         * span exactly the data area of the plot
         *
         *  | XXXXX
         *  | XXXXX
         *  |
         *  +------
         *     x1
         *    -----
         *     x2
         */
        if(shouldShowLinesOrTicks(xa, subplot)) {
            leftYLineWidth = findCounterAxisLineWidth(xa, 'left', ya, axList);
            xLinesXLeft = xa._offset - (leftYLineWidth ? (pad + leftYLineWidth) : 0);
            rightYLineWidth = findCounterAxisLineWidth(xa, 'right', ya, axList);
            xLinesXRight = xa._offset + xa._length + (rightYLineWidth ? (pad + rightYLineWidth) : 0);
            xLinesYBottom = getLinePosition(xa, ya, 'bottom');
            xLinesYTop = getLinePosition(xa, ya, 'top');

            // save axis line positions for extra ticks to reference
            // each subplot that gets ticks from "allticks" gets an entry:
            //    [left or bottom, right or top]
            extraSubplot = (!xa._anchorAxis || subplot !== xa._mainSubplot);
            if(extraSubplot && xa.ticks && xa.mirror === 'allticks') {
                xa._linepositions[subplot] = [xLinesYBottom, xLinesYTop];
            }

            var xPath = mainPath(xa, xLinePath, xLinePathFree);
            if(extraSubplot && xa.showline && (xa.mirror === 'all' || xa.mirror === 'allticks')) {
                xPath += xLinePath(xLinesYBottom) + xLinePath(xLinesYTop);
            }

            plotinfo.xlines
                .attr('d', xPath || 'M0,0')
                .style('stroke-width', xa._lw + 'px')
                .call(Color.stroke, xa.showline ?
                    xa.linecolor : 'rgba(0,0,0,0)');
        }

        /*
         * y lines that meet x axes get longer only by margin.pad, because
         * the x axes fill in the corner space. Free y axes, like free x axes,
         * always span exactly the data area of the plot
         *
         *   |   | XXXX
         * y2| y1| XXXX
         *   |   | XXXX
         *       |
         *       +-----
         */
        if(shouldShowLinesOrTicks(ya, subplot)) {
            connectYBottom = findCounterAxisLineWidth(ya, 'bottom', xa, axList);
            yLinesYBottom = ya._offset + ya._length + (connectYBottom ? pad : 0);
            connectYTop = findCounterAxisLineWidth(ya, 'top', xa, axList);
            yLinesYTop = ya._offset - (connectYTop ? pad : 0);
            yLinesXLeft = getLinePosition(ya, xa, 'left');
            yLinesXRight = getLinePosition(ya, xa, 'right');

            extraSubplot = (!ya._anchorAxis || subplot !== xa._mainSubplot);
            if(extraSubplot && ya.ticks && ya.mirror === 'allticks') {
                ya._linepositions[subplot] = [yLinesXLeft, yLinesXRight];
            }

            var yPath = mainPath(ya, yLinePath, yLinePathFree);
            if(extraSubplot && ya.showline && (ya.mirror === 'all' || ya.mirror === 'allticks')) {
                yPath += yLinePath(yLinesXLeft) + yLinePath(yLinesXRight);
            }

            plotinfo.ylines
                .attr('d', yPath || 'M0,0')
                .style('stroke-width', ya._lw + 'px')
                .call(Color.stroke, ya.showline ?
                    ya.linecolor : 'rgba(0,0,0,0)');
        }
    });

    Plotly.Axes.makeClipPaths(gd);
    exports.drawMainTitle(gd);
    ModeBar.manage(gd);

    return gd._promises.length && Promise.all(gd._promises);
};

function shouldShowLinesOrTicks(ax, subplot) {
    return (ax.ticks || ax.showline) &&
        (subplot === ax._mainSubplot || ax.mirror === 'all' || ax.mirror === 'allticks');
}

/*
 * should we draw a line on counterAx at this side of ax?
 * It's assumed that counterAx is known to overlay the subplot we're working on
 * but it may not be its main axis.
 */
function shouldShowLineThisSide(ax, side, counterAx) {
    // does counterAx get a line at all?
    if(!counterAx.showline || !counterAx._lw) return false;

    // are we drawing *all* lines for counterAx?
    if(counterAx.mirror === 'all' || counterAx.mirror === 'allticks') return true;

    var anchorAx = counterAx._anchorAxis;

    // is this a free axis? free axes can only have a subplot side-line with all(ticks)? mirroring
    if(!anchorAx) return false;

    // in order to handle cases where the user forgot to anchor this axis correctly
    // (because its default anchor has the same domain on the relevant end)
    // check whether the relevant position is the same.
    var sideIndex = alignmentConstants.FROM_BL[side];
    if(counterAx.side === side) {
        return anchorAx.domain[sideIndex] === ax.domain[sideIndex];
    }
    return counterAx.mirror && anchorAx.domain[1 - sideIndex] === ax.domain[1 - sideIndex];
}

/*
 * Is there another axis intersecting `side` end of `ax`?
 * First look at `counterAx` (the axis for this subplot),
 * then at all other potential counteraxes on or overlaying this subplot.
 * Take the line width from the first one that has a line.
 */
function findCounterAxisLineWidth(ax, side, counterAx, axList) {
    if(shouldShowLineThisSide(ax, side, counterAx)) {
        return counterAx._lw;
    }
    for(var i = 0; i < axList.length; i++) {
        var axi = axList[i];
        if(axi._mainAxis === counterAx._mainAxis && shouldShowLineThisSide(ax, side, axi)) {
            return axi._lw;
        }
    }
    return 0;
}

exports.drawMainTitle = function(gd) {
    var fullLayout = gd._fullLayout;

    // ion: main title-specific edit settings
    var isEditable = gd._context.editable && gd._context.editableMainTitle;
    var txt = fullLayout.title;
    var titleWillShow = true;
    if(txt === '' || txt.match(/Click to enter .+ title/)) {
        titleWillShow = isEditable;
    }

    if (!titleWillShow) {
        return;
    }

    Titles.draw(gd, 'gtitle', {
        propContainer: fullLayout,
        propName: 'title',
        placeholder: fullLayout._dfltTitle.plot,
        attributes: {
            x: fullLayout.width / 2,
            y: fullLayout._size.t / 2,
            'text-anchor': 'middle'
        }
    });

    // ion: editable title auto spacing
    if (fullLayout._titleElement) {
        var titleBB = fullLayout._titleElement.node().getBoundingClientRect();
        var shiftMargins = {
            x: 0,
            y: 1,
            l: 0,
            r: 0,
            b: 0,
            t: titleBB.height + 2
        };
        Plots.autoMargin(gd, "chart_title", shiftMargins);
    }
};

// First, see if we need to do arraysToCalcdata
// call it regardless of what change we made, in case
// supplyDefaults brought in an array that was already
// in gd.data but not in gd._fullData previously
exports.doTraceStyle = function(gd) {
    for(var i = 0; i < gd.calcdata.length; i++) {
        var cdi = gd.calcdata[i],
            _module = ((cdi[0] || {}).trace || {})._module || {},
            arraysToCalcdata = _module.arraysToCalcdata;

        if(arraysToCalcdata) arraysToCalcdata(cdi, cdi[0].trace);
    }

    Plots.style(gd);
    Registry.getComponentMethod('legend', 'draw')(gd);

    return Plots.previousPromises(gd);
};

exports.doColorBars = function(gd) {
    for(var i = 0; i < gd.calcdata.length; i++) {
        var cdi0 = gd.calcdata[i][0];

        if((cdi0.t || {}).cb) {
            var trace = cdi0.trace,
                cb = cdi0.t.cb;

            if(Registry.traceIs(trace, 'contour')) {
                cb.line({
                    width: trace.contours.showlines !== false ?
                        trace.line.width : 0,
                    dash: trace.line.dash,
                    color: trace.contours.coloring === 'line' ?
                        cb._opts.line.color : trace.line.color
                });
            }
            if(Registry.traceIs(trace, 'markerColorscale')) {
                cb.options(trace.marker.colorbar)();
            }
            else cb.options(trace.colorbar)();
        }
    }

    return Plots.previousPromises(gd);
};

// force plot() to redo the layout and replot with the modified layout
exports.layoutReplot = function(gd) {
    var layout = gd.layout;
    gd.layout = undefined;
    return Plotly.plot(gd, '', layout);
};

exports.doLegend = function(gd) {
    Registry.getComponentMethod('legend', 'draw')(gd);
    return Plots.previousPromises(gd);
};

exports.doTicksRelayout = function(gd) {
    Plotly.Axes.doTicks(gd, 'redraw');
    exports.drawMainTitle(gd);
    return Plots.previousPromises(gd);
};

exports.doModeBar = function(gd) {
    var fullLayout = gd._fullLayout;

    ModeBar.manage(gd);
    initInteractions(gd);

    for(var i = 0; i < fullLayout._basePlotModules.length; i++) {
        var updateFx = fullLayout._basePlotModules[i].updateFx;
        if(updateFx) updateFx(fullLayout);
    }

    return Plots.previousPromises(gd);
};

exports.doCamera = function(gd) {
    var fullLayout = gd._fullLayout;
    var sceneIds = fullLayout._subplots.gl3d;

    for(var i = 0; i < sceneIds.length; i++) {
        var sceneLayout = fullLayout[sceneIds[i]];
        var scene = sceneLayout._scene;

        scene.setCamera(sceneLayout.camera);
    }
};


text:
/*
 *	Originally written by Rich $alz, mirror!rs, Wed Nov 26 19:03:17 EST 1986.
 *	Rich $alz is now <rsalz@bbn.com>.
 *	Special thanks to Lars Mathiesen <thorinn@diku.dk> for the LABORT code.
 *
 *	This code was shamelessly stolen from the "pql" code by myself and
 *	slightly modified :)
 *
 *	All references to the word "star" were replaced by "percent"
 *	All references to the word "wild" were replaced by "like"
 *
 *	All the nice shell RE matching stuff was replaced by just "_" and "%"
 *
 *	As I don't have a copy of the SQL standard handy I wasn't sure whether
 *	to leave in the '\' escape character handling.
 *
 *	Keith Parks. <keith@mtcc.demon.co.uk>
 *
 *	SQL92 lets you specify the escape character by saying
 *	LIKE <pattern> ESCAPE <escape character>. We are a small operation
 *	so we force you to use '\'. - ay 7/95
 *
 *	Now we have the like_escape() function that converts patterns with
 *	any specified escape character (or none at all) to the internal
 *	default escape character, which is still '\'. - tgl 9/2000
 *
 * The code is rewritten to avoid requiring null-terminated strings,
 * which in turn allows us to leave out some memcpy() operations.
 * This code should be faster and take less memory, but no promises...
 * - thomas 2000-08-06
 */

/*--------------------
 *	Match text and pattern, return LIKE_TRUE, LIKE_FALSE, or LIKE_ABORT.
 *
 *	LIKE_TRUE: they match
 *	LIKE_FALSE: they don't match
 *	LIKE_ABORT: not only don't they match, but the text is too short.
 *
 * If LIKE_ABORT is returned, then no suffix of the text can match the
 * pattern either, so an upper-level % scan can stop scanning now.
 *--------------------
 */

#ifdef MATCH_LOWER
#define GETCHAR(t) ((char) tolower((unsigned char) (t)))
#else
#define GETCHAR(t) (t)
#endif

static int
MatchText(char *t, int tlen, char *p, int plen)
{
	/* Fast path for match-everything pattern */
	if (plen == 1 && *p == '%')
		return LIKE_TRUE;

	/*
	 * In this loop, we advance by char when matching wildcards (and thus on
	 * recursive entry to this function we are properly char-synced). On other
	 * occasions it is safe to advance by byte, as the text and pattern will
	 * be in lockstep. This allows us to perform all comparisons between the
	 * text and pattern on a byte by byte basis, even for multi-byte
	 * encodings.
	 */
	while (tlen > 0 && plen > 0)
	{
		if (*p == '\\')
		{
			/* Next pattern byte must match literally, whatever it is */
			NextByte(p, plen);
			if (plen <= 0 || GETCHAR(*p) != GETCHAR(*t))
				return LIKE_FALSE;
		}
		else if (*p == '%')
		{
			char		firstpat;

			/*
			 * % processing is essentially a search for a text position at
			 * which the remainder of the text matches the remainder of the
			 * pattern, using a recursive call to check each potential match.
			 *
			 * If there are wildcards immediately following the %, we can skip
			 * over them first, using the idea that any sequence of N _'s and
			 * one or more %'s is equivalent to N _'s and one % (ie, it will
			 * match any sequence of at least N text characters).  In this
			 * way we will always run the recursive search loop using a
			 * pattern fragment that begins with a literal character-to-match,
			 * thereby not recursing more than we have to.
			 */
			NextByte(p, plen);

			while (plen > 0)
			{
				if (*p == '%')
					NextByte(p, plen);
				else if (*p == '_')
				{
					/* If not enough text left to match the pattern, ABORT */
					if (tlen <= 0)
						return LIKE_ABORT;
					NextChar(t, tlen);
					NextByte(p, plen);
				}
				else
					break;		/* Reached a non-wildcard pattern char */
			}

			/*
			 * If we're at end of pattern, match: we have a trailing % which
			 * matches any remaining text string.
			 */
			if (plen <= 0)
				return LIKE_TRUE;

			/*
			 * Otherwise, scan for a text position at which we can match the
			 * rest of the pattern.  The first remaining pattern char is known
			 * to be a regular or escaped literal character, so we can compare
			 * the first pattern byte to each text byte to avoid recursing
			 * more than we have to.  This fact also guarantees that we don't
			 * have to consider a match to the zero-length substring at the
			 * end of the text.
			 */
			if (*p == '\\')
			{
				if (plen < 2)
					return LIKE_FALSE; /* XXX should throw error */
				firstpat = GETCHAR(p[1]);
			}
			else
				firstpat = GETCHAR(*p);

			while (tlen > 0)
			{
				if (GETCHAR(*t) == firstpat)
				{
					int			matched = MatchText(t, tlen, p, plen);

					if (matched != LIKE_FALSE)
						return matched;		/* TRUE or ABORT */
				}

				NextChar(t, tlen);
			}

			/*
			 * End of text with no match, so no point in trying later places
			 * to start matching this pattern.
			 */
			return LIKE_ABORT;
		}
		else if (*p == '_')
		{
			/* _ matches any single character, and we know there is one */
			NextChar(t, tlen);
			NextByte(p, plen);
			continue;
		}
		else if (GETCHAR(*p) != GETCHAR(*t))
		{
			/* non-wildcard pattern char fails to match text char */
			return LIKE_FALSE;
		}

		/*
		 * Pattern and text match, so advance.
		 *
		 * It is safe to use NextByte instead of NextChar here, even for
		 * multi-byte character sets, because we are not following immediately
		 * after a wildcard character. If we are in the middle of a multibyte
		 * character, we must already have matched at least one byte of the
		 * character from both text and pattern; so we cannot get out-of-sync
		 * on character boundaries.  And we know that no backend-legal
		 * encoding allows ASCII characters such as '%' to appear as non-first
		 * bytes of characters, so we won't mistakenly detect a new wildcard.
		 */
		NextByte(t, tlen);
		NextByte(p, plen);
	}

	if (tlen > 0)
		return LIKE_FALSE;		/* end of pattern, but not of text */

	/*
	 * End of text, but perhaps not of pattern.  Match iff the remaining
	 * pattern can match a zero-length string, ie, it's zero or more %'s.
	 */
	while (plen > 0 && *p == '%')
		NextByte(p, plen);
	if (plen <= 0)
		return LIKE_TRUE;

	/*
	 * End of text with no match, so no point in trying later places to start
	 * matching this pattern.
	 */
	return LIKE_ABORT;
}	/* MatchText() */

/*
 * like_escape() --- given a pattern and an ESCAPE string,
 * convert the pattern to use Postgres' standard backslash escape convention.
 */
#ifdef do_like_escape

static text *
do_like_escape(text *pat, text *esc)
{
	text	   *result;
	char	   *p,
			   *e,
			   *r;
	int			plen,
				elen;
	bool		afterescape;

	p = VARDATA_ANY(pat);
	plen = VARSIZE_ANY_EXHDR(pat);
	e = VARDATA_ANY(esc);
	elen = VARSIZE_ANY_EXHDR(esc);

	/*
	 * Worst-case pattern growth is 2x --- unlikely, but it's hardly worth
	 * trying to calculate the size more accurately than that.
	 */
	result = (text *) palloc(plen * 2 + VARHDRSZ);
	r = VARDATA(result);

	if (elen == 0)
	{
		/*
		 * No escape character is wanted.  Double any backslashes in the
		 * pattern to make them act like ordinary characters.
		 */
		while (plen > 0)
		{
			if (*p == '\\')
				*r++ = '\\';
			CopyAdvChar(r, p, plen);
		}
	}
	else
	{
		/*
		 * The specified escape must be only a single character.
		 */
		NextChar(e, elen);
		if (elen != 0)
			ereport(ERROR,
					(errcode(ERRCODE_INVALID_ESCAPE_SEQUENCE),
					 errmsg("invalid escape string"),
				  errhint("Escape string must be empty or one character.")));

		e = VARDATA_ANY(esc);

		/*
		 * If specified escape is '\', just copy the pattern as-is.
		 */
		if (*e == '\\')
		{
			memcpy(result, pat, VARSIZE_ANY(pat));
			return result;
		}

		/*
		 * Otherwise, convert occurrences of the specified escape character to
		 * '\', and double occurrences of '\' --- unless they immediately
		 * follow an escape character!
		 */
		afterescape = false;
		while (plen > 0)
		{
			if (CHAREQ(p, e) && !afterescape)
			{
				*r++ = '\\';
				NextChar(p, plen);
				afterescape = true;
			}
			else if (*p == '\\')
			{
				*r++ = '\\';
				if (!afterescape)
					*r++ = '\\';
				NextChar(p, plen);
				afterescape = false;
			}
			else
			{
				CopyAdvChar(r, p, plen);
				afterescape = false;
			}
		}
	}

	SET_VARSIZE(result, r - ((char *) result));

	return result;
}
#endif   /* do_like_escape */

#ifdef CHAREQ
#undef CHAREQ
#endif

#undef NextChar
#undef CopyAdvChar
#undef MatchText

#ifdef do_like_escape
#undef do_like_escape
#endif

#undef GETCHAR

#ifdef MATCH_LOWER
#undef MATCH_LOWER

#endif


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

  <title>VisibleRemoteObject.MouseCursorImage</title>
  <link href="css/style.css" rel="stylesheet" type="text/css">
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >

    Concept Framework 2.2 documentation
  	Contents | Index

VisibleRemoteObject.MouseCursorImage

     Name
     Type
     Access
     Version
     Deprecated

     MouseCursorImage
     property
     public
     version 1.0
     no

Prototype:

Read/Write property MouseCursorImage[=RImage]

Description:

This property sets the image used by the mouse cursor from a RImage object.

Returns:

This property returns the RImage used by the mouse cursor, or null if not set.

Documented by Eduard Suica, generation time: Sun Jan 27 18:15:02 2013
 GMT	(c)2013 Devronium Applications


text: 8 queen problem


text:
//
//   Copyright (c) 2000, 2001 Trifork Technologies
//   All Rights Reserved
//   No part of this program may be copied, used or delivered to
//   anyone without the express written consent of Trifork Technologies
//

package com.trifork.util.collection;

import java.lang.ref.ReferenceQueue;
import java.lang.ref.WeakReference;
import java.util.NoSuchElementException;

/**
 * @author Kresten Krab Thorup (krab@trifork.com)
 */

public class WeakIdentityToLongMap implements ObjectToLongMap {

    public static final int NO_VALUE = Integer.MIN_VALUE;

    protected int size;

    public int size() {
        return size;
    }

    public boolean isEmpty() {
        return size() == 0;
    }

    protected static int keyHash(Object key) {
        if (key == null)
            return 0;
        else
            return System.identityHashCode(key);
    }

    protected static boolean keyEquals(Object key1, Object key2) {
        return key1 == key2;
    }

    static int valueHash(long value) {
        return (int) value;
    }

    static boolean valueEquals(long value1, long value2) {
        return value1 == value2;
    }

    static class Entry extends WeakReference implements ObjectToLongMap.Entry {
        public int hashCode() {
            return keyHash(getKey()) ^ valueHash(getValue());
        }

        public boolean equals(Object other) {
            if (other instanceof Entry) {
                Entry ent = (Entry) other;
                return keyEquals(getKey(), ent.getKey())
                        && valueEquals(getValue(), ent.getValue());
            } else {
                return false;
            }
        }

        Entry next;

        long value;

        private int hash;

        Entry(int hash, Object key, long value, Entry next, ReferenceQueue queue) {
            super(key, queue);
            this.value = value;
            this.next = next;
            this.hash = hash;
        }

        public Object getKey() {
            return super.get();
        }

        public long getValue() {
            return value;
        }

        public long setValue(long value2) {
            long result = this.value;
            this.value = value2;
            return result;
        }

        boolean sameKey(int hash, Object key) {
            return keyEquals(getKey(), key);
        }

        /**
         * @return
         */
        public int getHash() {
            return hash;
        }
    }

    /** the hash index */
    private Entry[] table;

    /** the current range for table. */
    private int range;

    private float ratio;

    private ReferenceQueue queue = new ReferenceQueue();

    /** translate hash code bucket to index */
    private int index(int hash) {
        return (hash & 0x7ffffff) % range;
    }

    /** the default and only constructor */
    public WeakIdentityToLongMap() {
        clear();
    }

    public void clear() {
        range = 17;
        size = 0;
        ratio = 0.75F;
        table = new Entry[range];
    }

    /** return the element with the given key */
    public long get(Object key) {
        if (key == null) { throw new NullPointerException(); }
        int hash = keyHash(key);
        return get(hash, key);
    }

    private long get(int hash, Object key) {
        int idx = index(hash);

        for (Entry ent = table[idx]; ent != null; ent = ent.next) {
            if (ent.sameKey(hash, key))
                return ent.value;
        }

        return NO_VALUE;
    }

    /** return the element with the given key */
    public boolean containsKey(Object key) {
        int hash = keyHash(key);
        return containsKey(hash, key);
    }

    private boolean containsKey(int hash, Object key) {
        int idx = index(hash);

        for (Entry ent = table[idx]; ent != null; ent = ent.next) {
            if (ent.sameKey(hash, key))
                return true;
        }

        return false;
    }

    public long put(Object key, long value) {
        if (key == null) {
            throw new NullPointerException();
        }

        int hash = keyHash(key);
        return put(hash, key, value);
    }

    private long put(int hash, Object key, long value) {
        int idx = index(hash);

        for (Entry ent = table[idx]; ent != null; ent = ent.next) {
            if (ent.sameKey(hash, key)) {
                return ent.setValue(value);
            }
        }

        expunge();

        if (1.0F * size / range > ratio) {
            grow();
            idx = index(hash);
        }

        table[idx] = new Entry(hash, key, value, table[idx], queue);

        size += 1;

        return NO_VALUE;
    }

    /**
     *
     */
    public void expunge() {
        Entry ent;

        while ((ent = (Entry) queue.poll()) != null) {
            removeEntry(ent);
        }
    }

    public long remove(Object key) {
        if (key == null) throw new NullPointerException();
        int hash = keyHash(key);
        return remove(hash, key);
    }

    private long remove(int hash, Object key) {
        int idx = index(hash);

        Entry entry = table[idx];
        if (entry != null) {

            if (entry.sameKey(hash, key)) {
                table[idx] = entry.next;
                size -= 1;
                return entry.getValue();

            } else {
                Entry ahead = entry.next;

                while (ahead != null) {
                    if (ahead.sameKey(hash, key)) {
                        entry.next = ahead.next;
                        size -= 1;
                        return ahead.getValue();
                    }

                    entry = ahead;
                    ahead = ahead.next;
                }
            }
        }

        // it was not found at all!
        return NO_VALUE;
    }

    public long removeEntry(Entry ent) {
        int hash = ent.getHash();
        int idx = index(hash);

        Entry entry = table[idx];
        if (entry != null) {

            if (entry == ent) {
                table[idx] = entry.next;
                size -= 1;
                return entry.getValue();

            } else {
                Entry ahead = entry.next;

                while (ahead != null) {
                    if (ahead == ent) {
                        entry.next = ahead.next;
                        size -= 1;
                        return ahead.getValue();
                    }

                    entry = ahead;
                    ahead = ahead.next;
                }
            }
        }

        // it was not found at all!
        return NO_VALUE;
    }

    private void grow() {
        int old_range = range;
        Entry[] old_table = table;

        range = old_range * 2 + 1;
        table = new Entry[range];

        for (int i = 0; i < old_range; i++) {
            Entry entry = old_table[i];

            while (entry != null) {
                Entry ahead = entry.next;
                int idx = index(keyHash(entry.getKey()));
                entry.next = table[idx];
                table[idx] = entry;
                entry = ahead;
            }
        }
    }

    final class EntryIterator implements ObjectToLongMap.EntryIterator {
        int idx;

        Entry entry;

        EntryIterator() {
            idx = 0;
            entry = table[0];
            locateNext();
        }

        private void locateNext() {
            // we reached the end of a list
            while (entry == null) {
                // goto next bucket
                idx += 1;
                if (idx == range) {
                    // we reached the end
                    return;
                }

                // entry is the first element of this bucket
                entry = table[idx];
            }
        }

        public boolean hasNext() {
            return (entry != null);
        }

        public ObjectToLongMap.Entry next() {
            Entry result = entry;

            if (result == null) {
                throw new NoSuchElementException();
            } else {
                entry = entry.next;
                locateNext();
                return result;
            }
        }

        public void remove() {
            Entry remove = entry;

            entry = entry.next;
            locateNext();

            WeakIdentityToLongMap.this.removeEntry(remove);
        }
    }

    public ObjectToLongMap.EntryIterator entryIterator() {
        return new EntryIterator();
    }

    /**
     * @param map
     */
    public void putAll(ObjectToLongMap map) {
        ObjectToLongMap.EntryIterator it = map.entryIterator();
        while (it.hasNext()) {
            ObjectToLongMap.Entry ent = it.next();
            Object o = ent.getKey();
            if (o != null) {
                put(o, ent.getValue());
            }
        }
    }

    public void forEach(EntryIter iter) {

        for (int tableIdx = 0; tableIdx < table.length; tableIdx++) {
            Entry entry = table[tableIdx];

            while (entry != null) {
            	iter.each(entry.getKey(), entry.getValue());
                entry = entry.next;
            }
        }

    }

    public void toEntriesArray(ObjectToLongMap.Entry[] entries) {
        int entriesIdx = 0;

        for (int tableIdx = 0; tableIdx < table.length; tableIdx++) {
            Entry entry = table[tableIdx];

            while (entry != null) {
                entries[entriesIdx++] = entry;
                entry = entry.next;
            }
        }
    }

}


text:
<?xml version="1.0" encoding="utf-8"?>
<shape
    android:shape="rectangle"
    xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="@android:color/holo_red_light"></solid>
</shape>


text:
'use strict';

define(function () {
	function Scene(mode) {
		if (!mode) { throw "Must pass a Mode!"; }

		this.mode = mode;
		this.editor = mode.editor;
		this.root = new THREE.Scene();
		this.world = new THREE.Object3D();
		this.ui = new THREE.Object3D();

		this.ambientLight = new THREE.AmbientLight( 0xaaaaaa);
		this.root.add( this.ambientLight );

		this.directionalLight = new THREE.DirectionalLight( 0xcccccc, 0.6667);
		this.directionalLight.position.set(1, 1, 1);
		this.root.add( this.directionalLight );
	}

	Scene.prototype = {
		add: function (e) {
			if (!e) { return; }
			this.root.add(e);
		},

		walk: function (f) {
			function visit(list) {
				if (!list) { return; }
				var i, len = list.length, item;

				for (i=0; i < len; i++) {
					f(item = list[i]);
					visit(item.children);
				}
			}

			visit(this.world.children);
		}
	};

	return Scene;
});


text:
layout: post
title: "스위프트 Property"
author: "Amy"
---

# Swift Terminology - Property(속성)
##### Sources from [The Swift Programming Language (Swift 4)](https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/Properties.html)

> *Properties associate values with a particular class, structure, or enumeration. Stored properties store constant and variable values as part of an instance, whereas computed properties calculate (rather than store) a value. Computed properties are provided by classes, structures, and enumerations. Stored properties are provided only by classes and structures.*

# Stored Properties
- 클래스, 구조체에서만 사용 가능
- 인스턴스와 연관된 값을 **저장**

**👋🏻 Lazy property**

- **lazy stored property**: 지연 저장 속성, 초기화 하는데 오래걸리거나 복잡한 초기화 과정이 있는 변수의 경우 지연저장을 사용하면 좋다.
- A lazy property does not get initialized until someone accesses it
You can allocate an object, execute a closure, or call a method if you want

# Computed Properties
- 클래스, 구조체, 열거형에서 모두 사용 가능
- **실제로 값을 저장하지 않지만,** get, set키워드를 통해서 값을 간접적으로 설정하거나 받을 수 있다.
- **setter**를 선언할 때 값을 넣지 않았다면 디폴트 네임은 **newValue**로 사용한다.

### Sample Code
{% highlight swift %}
struct Point {
     var x = 0.0, y = 0.0
 }
struct Size {
     var width = 0.0, height = 0.0
 }
struct Rect {
var origin = Point() var size = Size() var center: Point {
         get {
             let centerX = origin.x + (size.width / 2)
             let centerY = origin.y + (size.height / 2)
             return Point(x: centerX, y: centerY)
         }
         set(newCenter) {
             origin.x = newCenter.x - (size.width / 2)
             origin.y = newCenter.y - (size.height / 2)
         }
}
 }
{% endhighlight %}

# Read-Only Computed Properties
- A computed property with a getter but no setter is known as a read-only computed property. A read-only computed property always returns a value, and can be accessed through dot syntax, but cannot be set to a different value.

{% highlight swift %}
struct Cuboid {
    var width = 0.0, height = 0.0, depth = 0.0
    var volume: Double {
        return width * height * depth
    }
}

let fourByFiveByTwo = Cuboid(width: 4.0, height: 5.0, depth: 2.0)
print("the volume of fourByFiveByTwo is \(fourByFiveByTwo.volume)")
{% endhighlight %}

# Property Oberver
- **willSet** is called just before the value is stored.
- **didSet** is called immediately after the new value is stored.
- **Default value**: newValue VS. oldValue

### Sample Code
{% highlight swift %}
class StepCounter {
    var totalSteps: Int = 0 {
        willSet(newTotalSteps) {
            print("About to set totalSteps to \(newTotalSteps)")
        }
        didSet {
            if totalSteps > oldValue  {
                print("Added \(totalSteps - oldValue) steps")
            }
        }
    }
}
let stepCounter = StepCounter()
stepCounter.totalSteps = 200
// About to set totalSteps to 200
// Added 200 steps
stepCounter.totalSteps = 360
// About to set totalSteps to 360
// Added 160 steps
stepCounter.totalSteps = 896
// About to set totalSteps to 896
// Added 536 steps
{% endhighlight %}

# Type Property
- 타입 자체에 대한 속성
- 값을 가져올때는 **클래스의 이름**을 통해서 가져올 수 있다.
- `let color: UIColor = UIColor.red`

### 👍🏻 Both types and instances can have methods & properties
- Instance properties are properties that belong to an instance of a particular type. Every time you create a new instance of that type, it has its own set of property values, separate from any other instance.
- You can also define **properties that belong to the type itself,** not to any one instance of that type. There will only ever be one copy of these properties, no matter how many instances of that type you create. These kinds of properties are called **type properties.**
- Type methods and properties are denoted with the keyword **static.**
- For example, the struct Double has a number of vars and funcs on its type. These are not methods or vars you access on an instance of a Double (e.g. on 53.2). Instead, **you access them by referencing the Double type itself.**

### 👍🏻 Sample Code - 01

{% highlight swift %}
static func abs(d:Double) -> Double {
	if d < 0 {
		return -d
	}else{
		return d
	}
}
{% endhighlight %}

- `static var pi: Double`
- `let d = Double.pi`
- `let d = Double.abs(-324.44)`
- `let x: Double = 23.85`
- `let e = x.pi` // no! pi is not an instance var
- `let e = x.abs(-22.5)` // no! abs is not an instance method

### 👍🏻 Sample Code - 02

{% highlight swift %}

struct AudioChannel {
    static let thresholdLevel = 10
    static var maxInputLevelForAllChannels = 0
    var currentLevel: Int = 0 {
        didSet {
            if currentLevel > AudioChannel.thresholdLevel {
                // cap the new audio level to the threshold level
                currentLevel = AudioChannel.thresholdLevel
            }
            if currentLevel > AudioChannel.maxInputLevelForAllChannels {
                // store this as the new overall maximum input level
                AudioChannel.maxInputLevelForAllChannels = currentLevel
            }
        }
    }
}

{% endhighlight %}

# Memory
- **Code, Data, Heap, Stack**
- Class는 Code 영역에 저장
- Static Type Property는 Data 영역에 저장
- Instance의 속성들은 Heap 영역에 저장

# Value VS. Reference
#### - Value type (struct, enum) vs. Reference type (class)
### Value (struct and enum)
- Copied when passed as an argument to a function
- Copied when assigned to a different variable
- Immutable if assigned to a variable with let (function parameters are let)
- You must note any func that can mutate a struct/enum with the keyword mutating

### Reference (class)
- Stored in the heap and reference counted (automatically)
- Constant pointers to a class (let) still can mutate by calling methods and changing properties When passed as an argument, does not make a copy (just passing a pointer to same instance)


text:
<?xml version="1.0" encoding="UTF-8"?>
<globalConfig xmlns="http://zstack.org/schema/zstack">
    <config>
        <name>vxlan.num</name>
        <description>default quota for vxlan.num</description>
        <defaultValue>8</defaultValue>
        <category>quota</category>
        <type>java.lang.Long</type>
    </config>
    <config>
        <name>cluster.lazyAttach</name>
        <description>don't attach vxlan environment to hosts until be used</description>
        <defaultValue>false</defaultValue>
        <category>vxlan</category>
        <type>java.lang.Boolean</type>
    </config>
</globalConfig>


text:
<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimary</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="toolbarStyle">@style/toolbarStyle</item>
    </style>

    <style name="toolbarStyle" parent="@style/Widget.AppCompat.Toolbar">
        <item name="android:background">?colorPrimary</item>
        <item name="android:elevation">8dp</item>
        <item name="popupTheme">@style/ThemeOverlay.AppCompat.Light</item>
        <item name="contentInsetStartWithNavigation">0dp</item>
        <item name="android:theme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item>
    </style>

    <style name="tabLayoutStyle" parent="Widget.Design.TabLayout">
        <item name="tabTextAppearance">@style/tabTextAppearance</item>
        <item name="tabSelectedTextColor">@android:color/primary_text_dark</item>
        <item name="android:background">?colorPrimary</item>
    </style>

    <style name="tabTextAppearance" parent="@style/TextAppearance.Design.Tab">
        <item name="android:textColor">@android:color/secondary_text_dark</item>
    </style>
</resources>


text:
Rails.application.config.assets.version = '1.0'

# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.

#additional css
Rails.application.config.assets.precompile += %w( main.css )
Rails.application.config.assets.precompile += %w( bootstrap.min.css )
Rails.application.config.assets.precompile += %w( chosen.css )
Rails.application.config.assets.precompile += %w( demo.css )
Rails.application.config.assets.precompile += %w( font-awesome.min.css )
Rails.application.config.assets.precompile += %w( jquery-ui.css )
Rails.application.config.assets.precompile += %w( style.css )
Rails.application.config.assets.precompile += %w( style1.css )
Rails.application.config.assets.precompile += %w( jquery-ui.structure.css )
Rails.application.config.assets.precompile += %w( nova.css )

#additional javascript
Rails.application.config.assets.precompile += %w( bootstrap.min.js )
Rails.application.config.assets.precompile += %w( chosen.jquery.js )
Rails.application.config.assets.precompile += %w( jquery-1.11.2.js )
Rails.application.config.assets.precompile += %w( jquery-ui.js )
Rails.application.config.assets.precompile += %w( main.js )
Rails.application.config.assets.precompile += %w( modernizr-2.6.2-respond-1.1.0.min.js )


text:
import { Ajax } from "ajax.js";

export class Controller {
    constructor(base) {
	this.SWAPI_BASE = base;

    	this.ajax = new Ajax(this.SWAPI_BASE);
    }
}


text:
ActiveRecord::Schema.define(version: 20140415173841) do

  create_table "route_hawk_role_routes", force: true do |t|
    t.integer  "role_id"
    t.text     "path_info"
    t.string   "request_method", limit: 32
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "route_hawk_roles", force: true do |t|
    t.string   "name"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "route_hawk_roles", ["name"], name: "index_route_hawk_roles_on_name"

  create_table "users", force: true do |t|
    t.datetime "created_at"
    t.datetime "updated_at"
  end

end


text:
using System;
using System.Diagnostics;
using System.Linq;
using Frapid.ApplicationState.Models;
using Frapid.Config.Api.Fakes;
using Xunit;

namespace Frapid.Config.Api.Tests
{
    public class CreateMenuTests
    {
        public static CreateMenuController Fixture()
        {
            CreateMenuController controller = new CreateMenuController(new CreateMenuRepository(), "", new LoginView());
            return controller;
        }

        [Fact]
        [Conditional("Debug")]
        public void Execute()
        {
            var actual = Fixture().Execute(new CreateMenuController.Annotation());
            Assert.Equal(1, actual);
        }
    }
}


text:
//
//  WWZActionSheetView.m
//  wwz
//
//  Created by wwz on 16/11/15.
//  Copyright © 2016年 cn.szwwz. All rights reserved.
//

#import "WWZActionSheetView.h"

#define kLineColor [UIColor colorWithRed:204/255.0 green:204/255.0 blue:204/255.0 alpha:1.0]

@interface WWZActionSheetView ()

@property (nonatomic, weak) UILabel *titleLabel;
@property (nonatomic, weak) UIButton *cancelButton;
@property (nonatomic, weak) UIView *selectView;
@property (nonatomic, copy) void(^block)(int);

@end

@implementation WWZActionSheetView

static int const BUTTON_TAG = 99;

+ (void)showActionSheetViewWithTitle:(NSString *)title
                   cancelButtonTitle:(NSString *)cancelButtonTitle
                   otherButtonTitles:(NSArray *)otherButtonTitles
                    clickButtonBlock:(void(^)(int index))clickButtonBlock
{
    WWZActionSheetView *sheetView = [[self alloc] initWithTitle:title cancelButtonTitle:cancelButtonTitle otherButtonTitles:otherButtonTitles clickButtonBlock:clickButtonBlock];
    [sheetView show];
}

- (instancetype)initWithTitle:(NSString *)title
            cancelButtonTitle:(NSString *)cancelButtonTitle
            otherButtonTitles:(NSArray *)otherButtonTitles
             clickButtonBlock:(void(^)(int index))clickButtonBlock
{
    CGFloat leftX = 10;
    CGFloat spaceY = 10;
    CGFloat buttonH = 50;
    CGFloat titleLH = 60;
    self = [super initWithFrame:CGRectMake(leftX, 0, [UIScreen mainScreen].bounds.size.width-2*leftX, spaceY*3+titleLH+buttonH*(otherButtonTitles.count+1))];
    if (self) {

        _block = clickButtonBlock;

        // select view
        UIView *selectView = [[UIView alloc] initWithFrame:CGRectMake(0, spaceY, self.frame.size.width, titleLH+buttonH*otherButtonTitles.count)];
        selectView.layer.masksToBounds = YES;
        selectView.layer.cornerRadius = 15;
        selectView.backgroundColor = [UIColor whiteColor];
        [self addSubview:selectView];
        _selectView = selectView;

        // title label
        UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(leftX, 0, selectView.frame.size.width-2*leftX, titleLH)];
        titleLabel.text = title;
        titleLabel.textAlignment = NSTextAlignmentCenter;
        titleLabel.textColor = [UIColor blackColor];
        titleLabel.font = [UIFont boldSystemFontOfSize:17];
        [selectView addSubview:titleLabel];
        _titleLabel = titleLabel;

        // select button
        for (int i = 0; i < otherButtonTitles.count; i++) {

            UIButton *button = [self buttonWithFrame:CGRectMake(0, titleLH+buttonH*i, selectView.frame.size.width, buttonH) title:otherButtonTitles[i] tag:i];
            [selectView addSubview:button];
        }

        // cancel button
        UIButton *cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        cancelBtn.frame = CGRectMake(0, self.frame.size.height-spaceY-buttonH, self.frame.size.width, buttonH);
        [cancelBtn setTitle:cancelButtonTitle forState:UIControlStateNormal];
        [cancelBtn setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
        [cancelBtn setBackgroundImage:[self imageWithColor:kLineColor size:cancelBtn.frame.size alpha:0.8] forState:UIControlStateHighlighted];
        cancelBtn.titleLabel.font = [UIFont boldSystemFontOfSize:16];
        cancelBtn.tag = BUTTON_TAG+otherButtonTitles.count;
        cancelBtn.layer.masksToBounds = YES;
        cancelBtn.layer.cornerRadius = 15;
        cancelBtn.backgroundColor = [UIColor whiteColor];
        [cancelBtn addTarget:self action:@selector(clickButtonAtIndex:) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:cancelBtn];
        _cancelButton = cancelBtn;

    }
    return self;
}

- (UIButton *)buttonWithFrame:(CGRect)frame title:(NSString *)title tag:(int)tag{

    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];

    btn.frame = frame;
    [btn setTitle:title forState:UIControlStateNormal];
    [btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [btn setBackgroundImage:[self imageWithColor:kLineColor size:frame.size alpha:0.5] forState:UIControlStateHighlighted];
    btn.titleLabel.font = [UIFont systemFontOfSize:16];

    btn.tag = BUTTON_TAG+tag;

    [btn addTarget:self action:@selector(clickButtonAtIndex:) forControlEvents:UIControlEventTouchUpInside];

    UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, 0.5)];
    lineView.backgroundColor = kLineColor;
    [btn addSubview:lineView];

    return btn;
}
/**
 *  点击btn
 */
- (void)clickButtonAtIndex:(UIButton *)sender{

    if (_block) {
        _block((int)sender.tag-BUTTON_TAG);
    }
    [self dismiss];
}

#pragma mark - setter

/**
 *  title color
 */
- (void)setTitleColor:(UIColor *)titleColor{

    if (!titleColor) {
        return;
    }
    self.titleLabel.textColor = titleColor;
}

/**
 *  title font
 */
- (void)setTitleFont:(UIFont *)titleFont{

    if (!titleFont) {
        return;
    }
    self.titleLabel.font = titleFont;
}

/**
 *  button color
 */
- (void)setOtherButtonTitleColor:(UIColor *)buttonTitleColor{

    if (!buttonTitleColor) {
        return;
    }
    for (UIView *subView in self.selectView.subviews) {
        if ([subView isKindOfClass:[UIButton class]]) {

            UIButton *btn = (UIButton *)subView;
            [btn setTitleColor:buttonTitleColor forState:UIControlStateNormal];
        }
    }
}

/**
 *  cancel button color
 */
- (void)setCancelButtonTitleColor:(UIColor *)buttonTitleColor{

    if (!buttonTitleColor) {
        return;
    }
    [_cancelButton setTitleColor:buttonTitleColor forState:UIControlStateNormal];
}

/**
 *  button font
 */
- (void)setOtherButtonTitleFont:(UIFont *)buttonTitleFont{

    if (!buttonTitleFont) {
        return;
    }
    for (UIView *subView in self.selectView.subviews) {
        if ([subView isKindOfClass:[UIButton class]]) {

            UIButton *btn = (UIButton *)subView;
            btn.titleLabel.font = buttonTitleFont;
        }
    }

}

- (void)setCancelButtonTitleFont:(UIFont *)buttonTitleFont{

    if (!buttonTitleFont) {
        return;
    }
    _cancelButton.titleLabel.font = buttonTitleFont;
}
/**
 *  button back color
 */
- (void)setButtonNBColor:(UIColor *)nBColor hBColor:(UIColor *)hBColor{

    for (UIView *subView in self.selectView.subviews) {

        if ([subView isKindOfClass:[UIButton class]]) {

            UIButton *btn = (UIButton *)subView;
            if (nBColor) {
                [btn setBackgroundImage:[self imageWithColor:hBColor size:btn.frame.size alpha:1] forState:UIControlStateNormal];
            }
            if (hBColor) {
                [btn setBackgroundImage:[self imageWithColor:hBColor size:btn.frame.size alpha:1] forState:UIControlStateHighlighted];
            }
        }
    }
    if (nBColor) {
        [_cancelButton setBackgroundImage:[self imageWithColor:hBColor size:_cancelButton.frame.size alpha:1] forState:UIControlStateNormal];
    }
    if (hBColor) {
        [_cancelButton setBackgroundImage:[self imageWithColor:hBColor size:_cancelButton.frame.size alpha:1] forState:UIControlStateHighlighted];
    }
}

#pragma mark - show/hide
- (void)show{

    // 背景view
    UIButton *containButton = [[UIButton alloc] initWithFrame:[UIScreen mainScreen].bounds];
    containButton.backgroundColor = [UIColor colorWithWhite:0 alpha:0.3];
    [containButton addTarget:self action:@selector(dismiss) forControlEvents:UIControlEventTouchUpInside];
    [containButton addSubview:self];

    // 添加到window上
    [[UIApplication sharedApplication].keyWindow addSubview:containButton];

    containButton.alpha = 0;

    __block CGRect selfFrame = self.frame;

    selfFrame.origin.y = CGRectGetMaxY(containButton.frame);
    self.frame = selfFrame;

    [UIView animateWithDuration:0.3
                     animations:^{

                         containButton.alpha = 1;

                         selfFrame.origin.y = CGRectGetMaxY(containButton.frame)-selfFrame.size.height;

                         self.frame = selfFrame;
                     }
                     completion:nil];

}

- (void)dismiss{

    [UIView animateWithDuration:0.3
                     animations:^{

                         CGRect selfFrame = self.frame;

                         selfFrame.origin.y = CGRectGetMaxY(self.superview.frame);

                         self.frame = selfFrame;

                         self.superview.alpha = 0;
                     }
                     completion:^(BOOL finished) {

                         [self.superview removeFromSuperview];
                         [self removeFromSuperview];

                     }];
}

#pragma mark - help

- (UIImage *)imageWithColor:(UIColor *)color size:(CGSize)size alpha:(float)alpha{

    CGRect rect = CGRectMake(0, 0, size.width, size.height);

    UIGraphicsBeginImageContext(rect.size);

    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetAlpha(context, alpha);
    CGContextSetFillColorWithColor(context,color.CGColor);
    CGContextFillRect(context, rect);

    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

    return image;
}

//- (void)dealloc{
//    NSLog(@"%s", __func__);
//}
@end


text:
Imports System.IO

Public Structure EQUIPMENT_PROFILE
    Public EquipmentName As String
    Public RegulationMode As REGULATIONMODE
    Public Probe0Assignment As PROBE_ASSIGNMENT
    Public Probe1Assignment As PROBE_ASSIGNMENT
    Public HeatMinTimeOn_seconds As UInt32
    Public HeatMinTimeOff_seconds As UInt32
    Public CoolMinTimeOn_seconds As UInt32
    Public CoolMinTimeOff_seconds As UInt32
    Public Process_Kp As Single
    Public Process_Ki As Single
    Public Process_Kd As Single
    Public Target_Kp As Single
    Public Target_Ki As Single
    Public Target_Kd As Single
    Public TargetOutput_Max_C As Single
    Public TargetOutput_Min_C As Single
    Public ThresholdDelta_C As Single
    Public Process_D_FilterGain As Single
    Public Process_D_FilterCoeff As Single
    Public Process_D_AdaptiveBand As Single
    Public Target_D_FilterGain As Single
    Public Target_D_FilterCoeff As Single
    Public Target_D_AdaptiveBand As Single
    Public coolDifferential As Single
    Public heatDifferential As Single
    Public coolTransition As Single
    Public heatTransition As Single

    Public Function Serialize() As Byte()
        Dim bb(63) As Byte
        For x = 0 To 63
            bb(x) = 0
        Next
        Dim nameBuff() As Byte = Text.ASCIIEncoding.ASCII.GetBytes(Me.EquipmentName)
        Array.Copy(nameBuff, 0, bb, 0, nameBuff.Length)

        Using ms As New MemoryStream()
            ms.Write(bb, 0, bb.Length)
            ms.WriteByte(CByte(RegulationMode))
            ms.WriteByte(CByte(Probe0Assignment))
            ms.WriteByte(CByte(Probe1Assignment))
            ms.WriteByte(0)
            ms.Write(BitConverter.GetBytes(HeatMinTimeOn_seconds), 0, 4)
            ms.Write(BitConverter.GetBytes(HeatMinTimeOff_seconds), 0, 4)
            ms.Write(BitConverter.GetBytes(CoolMinTimeOn_seconds), 0, 4)
            ms.Write(BitConverter.GetBytes(CoolMinTimeOff_seconds), 0, 4)
            ms.Write(BitConverter.GetBytes(Process_Kp), 0, 4)
            ms.Write(BitConverter.GetBytes(Process_Ki), 0, 4)
            ms.Write(BitConverter.GetBytes(Process_Kd), 0, 4)
            ms.Write(BitConverter.GetBytes(Target_Kp), 0, 4)
            ms.Write(BitConverter.GetBytes(Target_Ki), 0, 4)
            ms.Write(BitConverter.GetBytes(Target_Kd), 0, 4)
            ms.Write(BitConverter.GetBytes(TargetOutput_Max_C), 0, 4)
            ms.Write(BitConverter.GetBytes(TargetOutput_Min_C), 0, 4)
            ms.Write(BitConverter.GetBytes(Process_D_FilterGain), 0, 4)
            ms.Write(BitConverter.GetBytes(Process_D_FilterCoeff), 0, 4)
            ms.Write(BitConverter.GetBytes(Process_D_AdaptiveBand), 0, 4)
            ms.Write(BitConverter.GetBytes(Target_D_FilterGain), 0, 4)
            ms.Write(BitConverter.GetBytes(Target_D_FilterCoeff), 0, 4)
            ms.Write(BitConverter.GetBytes(Target_D_AdaptiveBand), 0, 4)
            ms.Write(BitConverter.GetBytes(coolDifferential), 0, 4)
            ms.Write(BitConverter.GetBytes(heatDifferential), 0, 4)
            ms.Write(BitConverter.GetBytes(coolTransition), 0, 4)
            ms.Write(BitConverter.GetBytes(heatTransition), 0, 4)
            Dim F16 = FletcherChecksum.Fletcher16(ms.ToArray, 0, ms.Length)
            ms.Position = ms.Length
            ms.Write(BitConverter.GetBytes(F16), 0, 2)
            Return ms.ToArray()
        End Using
    End Function

    Public Sub New(sourceData As Byte())
        Dim CalcF16 = FletcherChecksum.Fletcher16(sourceData, 0, sourceData.Length - 2)

        Dim offset As Integer = 0
        EquipmentName = GetString(sourceData, 0, 64)
        offset = 64
        RegulationMode = DirectCast(sourceData(offset), REGULATIONMODE)
        offset += 1
        Probe0Assignment = DirectCast(sourceData(offset), PROBE_ASSIGNMENT)
        offset += 1
        Probe1Assignment = DirectCast(sourceData(offset), PROBE_ASSIGNMENT)
        offset += 1
        offset += 1 'Dummy byte to account for padding on the dsPIC hardware
        HeatMinTimeOn_seconds = BitConverter.ToUInt32(sourceData, offset)
        offset += 4
        HeatMinTimeOff_seconds = BitConverter.ToUInt32(sourceData, offset)
        offset += 4
        CoolMinTimeOn_seconds = BitConverter.ToUInt32(sourceData, offset)
        offset += 4
        CoolMinTimeOff_seconds = BitConverter.ToUInt32(sourceData, offset)
        offset += 4
        Process_Kp = BitConverter.ToSingle(sourceData, offset)
        offset += 4
        Process_Ki = BitConverter.ToSingle(sourceData, offset)
        offset += 4
        Process_Kd = BitConverter.ToSingle(sourceData, offset)
        offset += 4
        Target_Kp = BitConverter.ToSingle(sourceData, offset)
        offset += 4
        Target_Ki = BitConverter.ToSingle(sourceData, offset)
        offset += 4
        Target_Kd = BitConverter.ToSingle(sourceData, offset)
        offset += 4
        TargetOutput_Max_C = BitConverter.ToSingle(sourceData, offset)
        offset += 4
        TargetOutput_Min_C = BitConverter.ToSingle(sourceData, offset)
        offset += 4
        Process_D_FilterGain = BitConverter.ToSingle(sourceData, offset)
        offset += 4
        Process_D_FilterCoeff = BitConverter.ToSingle(sourceData, offset)
        offset += 4
        Process_D_AdaptiveBand = BitConverter.ToSingle(sourceData, offset)
        offset += 4
        Target_D_FilterGain = BitConverter.ToSingle(sourceData, offset)
        offset += 4
        Target_D_FilterCoeff = BitConverter.ToSingle(sourceData, offset)
        offset += 4
        Target_D_AdaptiveBand = BitConverter.ToSingle(sourceData, offset)
        offset += 4
        coolDifferential = BitConverter.ToSingle(sourceData, offset)
        offset += 4
        heatDifferential = BitConverter.ToSingle(sourceData, offset)
        offset += 4
        coolTransition = BitConverter.ToSingle(sourceData, offset)
        offset += 4
        heatTransition = BitConverter.ToSingle(sourceData, offset)
        offset += 4
        Dim RecordF16 = BitConverter.ToUInt16(sourceData, offset)
        offset += 2

        If RecordF16 <> CalcF16 Then
            Throw New ArgumentException("Checksums to do not match Calculated=" & CalcF16 & " Record=" & RecordF16, "sourceData")
        End If

        Dim comp = Me.Serialize

        For idx = 0 To comp.Length - 1
            If comp(idx) <> sourceData(idx) Then
                Throw New ArgumentException("SelfSerialization does not match at byte #" & idx, "sourceData")
            End If
        Next

    End Sub

    Public Overrides Function ToString() As String
        Dim ret As String = ""
        ret = "Name:" & Me.EquipmentName & vbCrLf
        ret += "RegulationMode:" & Me.RegulationMode.ToString & vbCrLf
        ret += "Probe0Assignment:" & Me.Probe0Assignment.ToString & vbCrLf
        ret += "Probe1Assignment:" & Me.Probe1Assignment.ToString & vbCrLf
        ret += "HeatMinTimeOn_seconds:" & Me.HeatMinTimeOn_seconds.ToString & vbCrLf
        ret += "HeatMinTimeOff_seconds:" & Me.HeatMinTimeOff_seconds.ToString & vbCrLf
        ret += "CoolMinTimeOn_seconds:" & Me.CoolMinTimeOn_seconds.ToString & vbCrLf
        ret += "CoolMinTimeOff_seconds:" & Me.CoolMinTimeOff_seconds.ToString & vbCrLf
        ret += "Process_Kp:" & Me.Process_Kp.ToString & vbCrLf
        ret += "Process_Ki:" & Me.Process_Ki.ToString & vbCrLf
        ret += "Process_Kd:" & Me.Process_Kd.ToString & vbCrLf
        ret += "Target_Kp:" & Me.Target_Kp.ToString & vbCrLf
        ret += "Target_Ki:" & Me.Target_Ki.ToString & vbCrLf
        ret += "Target_Kd:" & Me.Target_Kd.ToString & vbCrLf
        ret += "TargetOutput_Max_C:" & Me.TargetOutput_Max_C.ToString & vbCrLf
        ret += "TargetOutput_Min_C:" & Me.TargetOutput_Min_C.ToString & vbCrLf
        ret += "ThresholdDelta_C:" & Me.ThresholdDelta_C.ToString & vbCrLf
        Return ret
    End Function

    Private Function GetString(dat() As Byte, offset As Integer, maxLen As Integer) As String
        Dim realLength As Integer = 0
        For idx = offset To offset + maxLen
            If dat(idx) = 0 Then
                Exit For
            Else
                realLength += 1
            End If
        Next
        Return System.Text.UTF8Encoding.UTF8.GetString(dat, offset, realLength)
    End Function

End Structure