text:
from .. import Availability, Class, Constant, Define, Method, Parameter, Type

gx_class = Class('DOCU',
                 doc="Class to work with documents")

gx_defines = [
    Define('DOCU_OPEN',
           doc="How to open document",
           constants=[
               Constant('DOCU_OPEN_VIEW', value='0', type=Type.INT32_T),
               Constant('DOCU_OPEN_EDIT', value='1', type=Type.INT32_T)
           ])]

gx_methods = {
    'Miscellaneous': [

        Method('Copy_DOCU', module='geogxx', version='5.1.1',
               availability=Availability.PUBLIC,
               doc="Copy :class:`DOCU`",
               return_type=Type.VOID,
               parameters = [
                   Parameter('doc_ud', type="DOCU",
                             doc="Destination :class:`DOCU`"),
                   Parameter('doc_us', type="DOCU",
                             doc="Source :class:`DOCU`")
               ]),

        Method('Create_DOCU', module='geogxx', version='5.1.1',
               availability=Availability.PUBLIC,
               doc="Create a document onject",
               return_type="DOCU",
               return_doc=":class:`DOCU` Object"),

        Method('CreateS_DOCU', module='geogxx', version='5.1.1',
               availability=Availability.PUBLIC,
               doc="Create from a serialized source",
               return_type="DOCU",
               return_doc=":class:`DOCU` Object",
               parameters = [
                   Parameter('bf', type="BF",
                             doc=":class:`BF` from which to read :class:`DOCU`")
               ]),

        Method('Destroy_DOCU', module='geogxx', version='5.1.1',
               availability=Availability.PUBLIC,
               doc="Destroy",
               return_type=Type.VOID,
               parameters = [
                   Parameter('docu', type="DOCU",
                             doc=":class:`DOCU` Handle")
               ]),

        Method('GetFile_DOCU', module='geogxx', version='5.1.1',
               availability=Availability.PUBLIC,
               doc="Get the document and place in a file.",
               return_type=Type.VOID,
               parameters = [
                   Parameter('docu', type="DOCU"),
                   Parameter('file', type=Type.STRING,
                             doc="File to which to write document")
               ]),

        Method('GetFileMeta_DOCU', module='geogxx', version='5.1.8',
               availability=Availability.PUBLIC,
               doc="Get the document and place in a file with metadata.",
               notes="""
               If this document is only a URL link, the URL link will
               be resolved and the document downloaded from the appropriate
               server using the protocol specified.

               The document has metadata, and the native document does not
               support metadata, the metadata will be placed in an associated
               file "filename.extension.GeosoftMeta"
               """,
               return_type=Type.VOID,
               parameters = [
                   Parameter('docu', type="DOCU"),
                   Parameter('file', type=Type.STRING,
                             doc="File to which to write document")
               ]),

        Method('GetMETA_DOCU', module='geogxx', version='5.1.1',
               availability=Availability.PUBLIC,
               doc="Get the document's meta",
               return_type=Type.VOID,
               parameters = [
                   Parameter('docu', type="DOCU"),
                   Parameter('meta', type="META",
                             doc=":class:`META` object to fill in with the document's meta")
               ]),

        Method('IDocName_DOCU', module='geogxx', version='5.1.1',
               availability=Availability.PUBLIC,
               doc="The document name.",
               return_type=Type.VOID,
               parameters = [
                   Parameter('docu', type="DOCU"),
                   Parameter('name', type=Type.STRING, is_ref=True, size_of_param='length',
                             doc="Buffer to fill with document name"),
                   Parameter('length', type=Type.INT32_T, default_length='STR_FILE',
                             doc="Size of buffer")
               ]),

        Method('IFileName_DOCU', module='geogxx', version='5.1.1',
               availability=Availability.PUBLIC,
               doc="The original document file name.",
               return_type=Type.VOID,
               parameters = [
                   Parameter('docu', type="DOCU"),
                   Parameter('name', type=Type.STRING, is_ref=True, size_of_param='length',
                             doc="Buffer to fill with document file name"),
                   Parameter('length', type=Type.INT32_T, default_length='STR_FILE',
                             doc="Size of buffer")
               ]),

        Method('iHaveMETA_DOCU', module='geogxx', version='5.1.1',
               availability=Availability.PUBLIC,
               doc="Checks if a document has metadata.",
               return_type=Type.BOOL,
               parameters = [
                   Parameter('docu', type="DOCU")
               ]),

        Method('iIsReference_DOCU', module='geogxx', version='5.1.6',
               availability=Availability.PUBLIC,
               doc="Is the document only a reference (a URL) ?",
               return_type=Type.INT32_T,
               return_doc="1 - Yes, 0 - No",
               parameters = [
                   Parameter('docu', type="DOCU",
                             doc="Document")
               ]),

        Method('Open_DOCU', module='geogxx', version='5.1.1',
               availability=Availability.PUBLIC,
               doc="Open a document in the document viewer",
               notes="""
               On Windows, the default application for the file extension is
               used to open the file.
               """,
               return_type=Type.VOID,
               parameters = [
                   Parameter('docu', type="DOCU"),
                   Parameter('mode', type=Type.INT32_T,
                             doc=":def:`DOCU_OPEN`")
               ]),

        Method('Serial_DOCU', module='geogxx', version='5.1.1',
               availability=Availability.PUBLIC,
               doc="Serialize :class:`DOCU`",
               return_type=Type.VOID,
               parameters = [
                   Parameter('docu', type="DOCU"),
                   Parameter('bf', type="BF",
                             doc=":class:`BF` in which to write object")
               ]),

        Method('SetFile_DOCU', module='geogxx', version='5.1.1',
               availability=Availability.PUBLIC,
               doc="Set the document from a file source.",
               notes="""
               Document types are normally identified by their extension.  If you
               leave the document type blank, the extension of the document file
               will be used as the document type.

               To resolve conflicting types, you can define your own unique type
               by entering your own type "extension" string.

               The following types are pre-defined (as are any normal Geosoft
               file types):

                  "htm"       HTML
                  "html"      HTML
                  "txt"       ASCII text file
                  "doc"       Word for Windows document
                  "pdf"       Adobe PDF
                  "map"       Geosoft map file
                  "mmap"      Mapinfo map file (real extension "map")
                  "grd"       Geosoft grid file
                  "gdb"       Geosoft database

               URL Document Links

               The document name can be a URL link to the document using one of
               the supported protocols. The following protocols are supported:

                  http://www.mywebserver.com/MyFile.doc                 - :class:`HTTP`
                  dap://my.dap.server.com/dcs?DatasetName?MyFile.doc    - DAP (DAP Document Access)
                  ftp://my.ftp.server.com/Dir1/MyFile.doc               - FTP protocol

               The full file name will be stored but no data will be stored with
               the :class:`DOCU` class and the document can be retrieved using the sGetFile_DOCU
               method.
               """,
               return_type=Type.VOID,
               parameters = [
                   Parameter('docu', type="DOCU"),
                   Parameter('type', type=Type.STRING,
                             doc="Document type"),
                   Parameter('name', type=Type.STRING,
                             doc='Document name, if "" file name will be used'),
                   Parameter('file', type=Type.STRING,
                             doc="Document file, must exist")
               ]),

        Method('SetFileMeta_DOCU', module='geogxx', version='5.1.8',
               availability=Availability.PUBLIC,
               doc="Set the document from a file source with metadata.",
               notes="""
               See :func:`SetFile_DOCU`.
               This function is the same as sSetFile_DOCU, plus insures that a
               :class:`META` exists that includes the "Data" class.  If the file has
               associated metadata, either supported natively in the file, or
               through an associated file "filename.extension.GeosoftMeta",
               that metadata will be loaded into the :class:`DOCU` meta, and a Data
               class will be constructed if one does not exist.

               Also, the Document type Extension is very important in that it
               specifies the document types that natively have metadata. The
               ones currently supported are:

                  "map"       Geosoft map file
                  "gdb"       Geosoft database
                  "grd"       Geosoft grid file
               """,
               return_type=Type.VOID,
               parameters = [
                   Parameter('docu', type="DOCU"),
                   Parameter('type', type=Type.STRING,
                             doc="Document type extension"),
                   Parameter('name', type=Type.STRING,
                             doc="Document name, if NULL use file name"),
                   Parameter('file', type=Type.STRING,
                             doc="Document file or URL")
               ]),

        Method('SetMETA_DOCU', module='geogxx', version='5.1.1',
               availability=Availability.PUBLIC,
               doc="Set the document's meta",
               return_type=Type.VOID,
               parameters = [
                   Parameter('docu', type="DOCU"),
                   Parameter('meta', type="META",
                             doc=":class:`META` to add to the document's meta")
               ])
    ]
}


text:
<?php
namespace DartVadius\YmlGenerator\offer;

use DartVadius\YmlGenerator\offer\AbstractYmlOffer;

/**
 * offerEventYml
 *
 * @author DartVadius
 */
class EventYmlOffer extends AbstractYmlOffer {

    /**
     *
     * @var string
     */
    private $place = '';

    /**
     *
     * @var string
     */
    private $hall = '';

    /**
     *
     * @var string
     */
    private $hallPart = '';

    /**
     *
     * @var date
     */
    private $date = '';

    /**
     *
     * @var string
     */
    private $isPremiere = '';

    /**
     *
     * @var stirng
     */
    private $isKids = '';

    public function __construct() {
        $this->type = 'event-ticket';
    }

    /**
     *
     * @param string $place
     */
    public function setPlace($place) {
        $this->place = $place;
        return $this;
    }

    /**
     *
     * @param string $hall
     */
    public function setHall($hall) {
        $this->hall = $hall;
        return $this;
    }

    /**
     *
     * @param string $part
     */
    public function setHallPart($part) {
        $this->hallPart = $part;
        return $this;
    }

    /**
     *
     * @param DateTime $date
     */
    public function setDate($date) {
        $date = new DateTime($date);
        $this->date = $date->format('Y-m-d h:m:s');
    }

    /**
     *
     * @param string $val
     */
    public function setIsPremiere($val) {
        if ($val === 0 || $val === 1) {
            $this->isPremiere = $val;
        }
        return $this;
    }

    /**
     *
     * @param int $val
     */
    public function setIsKids($val) {
        if ($val === 0 || $val === 1) {
            $this->isKids = $val;
        }
        return $this;
    }

    public function getOffer() {
        $offer = parent::getOffer();
        $offer['requared']['place'] = $this->place;
        $offer['requared']['date'] = $this->date;
        $offer['optional']['hall'] = $this->hall;
        $offer['optional']['hall_part'] = $this->hallPart;
        $offer['optional']['is_premiere'] = $this->isPremiere;
        $offer['optional']['is_kids'] = $this->isKids;
        unset($offer['optional']['model']);
        unset($offer['optional']['vendor']);
        unset($offer['optional']['vendorCode']);
        unset($offer['optional']['rec']);
        return $offer;
    }

    /**
     * Set property values that are not arrays
     * NOTE! for setting array properties, such as $picture, $deliveryOptions,
     * $outlets, $barcode, $param, $rec your must use their own methods
     *
     * @param array $values
     */
    public function setAllValues($values) {
        foreach ($values as $key => $value) {
            if (isset($this->$key) && !is_array($value)) {
                $this->$key = $value;
            }
        }
        return $this;
    }

}

redpajama_set_name: RedPajamaGithub


text:
SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;

--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
--

CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;

--
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
--

COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';

SET search_path = public, pg_catalog;

SET default_tablespace = '';

SET default_with_oids = false;

--
-- Name: checksums; Type: TABLE; Schema: public; Owner: -; Tablespace:
--

CREATE TABLE checksums (
    org_id character(32) NOT NULL,
    checksum character(32) NOT NULL
);

--
-- Name: clients; Type: TABLE; Schema: public; Owner: -; Tablespace:
--

CREATE TABLE clients (
    id character(32) NOT NULL,
    org_id character(32) NOT NULL,
    authz_id character(32) NOT NULL,
    name text NOT NULL,
    public_key text,
    validator boolean NOT NULL,
    last_updated_by character(32) NOT NULL,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    pubkey_version smallint NOT NULL,
    admin boolean DEFAULT false NOT NULL
);

--
-- Name: cookbook_version_checksums; Type: TABLE; Schema: public; Owner: -; Tablespace:
--

CREATE TABLE cookbook_version_checksums (
    cookbook_version_id character(32) NOT NULL,
    org_id character(32) NOT NULL,
    checksum character(32) NOT NULL
);

--
-- Name: cookbook_versions; Type: TABLE; Schema: public; Owner: -; Tablespace:
--

CREATE TABLE cookbook_versions (
    id character(32) NOT NULL,
    major bigint NOT NULL,
    minor bigint NOT NULL,
    patch bigint NOT NULL,
    frozen boolean NOT NULL,
    meta_attributes bytea NOT NULL,
    meta_deps text NOT NULL,
    meta_long_desc bytea NOT NULL,
    metadata bytea NOT NULL,
    serialized_object bytea NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    created_at timestamp without time zone NOT NULL,
    last_updated_by character(32) NOT NULL,
    cookbook_id integer NOT NULL
);
ALTER TABLE ONLY cookbook_versions ALTER COLUMN meta_attributes SET STORAGE EXTERNAL;
ALTER TABLE ONLY cookbook_versions ALTER COLUMN meta_long_desc SET STORAGE EXTERNAL;
ALTER TABLE ONLY cookbook_versions ALTER COLUMN metadata SET STORAGE EXTERNAL;
ALTER TABLE ONLY cookbook_versions ALTER COLUMN serialized_object SET STORAGE EXTERNAL;

CREATE INDEX cookbook_version_checksums_by_id ON cookbook_version_checksums(cookbook_version_id);

--
-- Name: cookbooks; Type: TABLE; Schema: public; Owner: -; Tablespace:
--

CREATE TABLE cookbooks (
    id integer NOT NULL,
    org_id character(32) NOT NULL,
    name text NOT NULL,
    authz_id character(32) NOT NULL
);

--
-- Name: cookbook_version_dependencies; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW cookbook_version_dependencies AS
    SELECT c.org_id, c.name, v.major, v.minor, v.patch, v.meta_deps AS dependencies FROM (cookbooks c JOIN cookbook_versions v ON ((c.id = v.cookbook_id)));

--
-- Name: cookbook_versions_by_rank; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW cookbook_versions_by_rank AS
    SELECT v.major, v.minor, v.patch, ((((v.major || '.'::text) || v.minor) || '.'::text) || v.patch) AS version, v.serialized_object, c.org_id, c.name, rank() OVER (PARTITION BY v.cookbook_id ORDER BY v.major DESC, v.minor DESC, v.patch DESC) AS rank FROM (cookbooks c JOIN cookbook_versions v ON ((c.id = v.cookbook_id)));

--
-- Name: cookbooks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE cookbooks_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

--
-- Name: cookbooks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE cookbooks_id_seq OWNED BY cookbooks.id;

--
-- Name: data_bag_items; Type: TABLE; Schema: public; Owner: -; Tablespace:
--

CREATE TABLE data_bag_items (
    id character(32) NOT NULL,
    org_id character(32) NOT NULL,
    data_bag_name text NOT NULL,
    item_name text NOT NULL,
    last_updated_by character(32) NOT NULL,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    serialized_object bytea
);
ALTER TABLE ONLY data_bag_items ALTER COLUMN serialized_object SET STORAGE EXTERNAL;

--
-- Name: data_bags; Type: TABLE; Schema: public; Owner: -; Tablespace:
--

CREATE TABLE data_bags (
    id character(32) NOT NULL,
    authz_id character(32) NOT NULL,
    org_id character(32) NOT NULL,
    name text NOT NULL,
    last_updated_by character(32) NOT NULL,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL
);

--
-- Name: environments; Type: TABLE; Schema: public; Owner: -; Tablespace:
--

CREATE TABLE environments (
    id character(32) NOT NULL,
    authz_id character(32) NOT NULL,
    org_id character(32) NOT NULL,
    name text NOT NULL,
    last_updated_by character(32) NOT NULL,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    serialized_object bytea
);
ALTER TABLE ONLY environments ALTER COLUMN serialized_object SET STORAGE EXTERNAL;

--
-- Name: joined_cookbook_version; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW joined_cookbook_version AS
    SELECT v.major, v.minor, v.patch, ((((v.major || '.'::text) || v.minor) || '.'::text) || v.patch) AS version, v.serialized_object, v.id, c.org_id, c.name FROM (cookbooks c JOIN cookbook_versions v ON ((c.id = v.cookbook_id)));

--
-- Name: nodes; Type: TABLE; Schema: public; Owner: -; Tablespace:
--

CREATE TABLE nodes (
    id character(32) NOT NULL,
    authz_id character(32) NOT NULL,
    org_id character(32) NOT NULL,
    name text NOT NULL,
    environment text NOT NULL,
    last_updated_by character(32) NOT NULL,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    serialized_object bytea
);
ALTER TABLE ONLY nodes ALTER COLUMN serialized_object SET STORAGE EXTERNAL;

--
-- Name: roles; Type: TABLE; Schema: public; Owner: -; Tablespace:
--

CREATE TABLE roles (
    id character(32) NOT NULL,
    authz_id character(32) NOT NULL,
    org_id character(32) NOT NULL,
    name text NOT NULL,
    last_updated_by character(32) NOT NULL,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    serialized_object bytea
);
ALTER TABLE ONLY roles ALTER COLUMN serialized_object SET STORAGE EXTERNAL;

--
-- Name: sandboxed_checksums; Type: TABLE; Schema: public; Owner: -; Tablespace:
--

CREATE TABLE sandboxed_checksums (
    org_id character(32) NOT NULL,
    sandbox_id character(32) NOT NULL,
    checksum character(32) NOT NULL,
    created_at timestamp without time zone NOT NULL
);

--
-- Name: schema_info; Type: TABLE; Schema: public; Owner: -; Tablespace:
--

CREATE TABLE schema_info (
    version integer DEFAULT 0 NOT NULL
);

--
-- Name: osc_users; Type: TABLE; Schema: public; Owner: -; Tablespace:
--

CREATE TABLE osc_users (
    id character(32) NOT NULL,
    authz_id character(32) NOT NULL,
    username text NOT NULL,
    email text,
    public_key text,
    hashed_password text NOT NULL,
    salt text NOT NULL,
    hash_type text NOT NULL,
    last_updated_by character(32) NOT NULL,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    external_authentication_uid text,
    recovery_authentication_enabled boolean,
    admin boolean DEFAULT false NOT NULL
);

--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE cookbooks ALTER COLUMN id SET DEFAULT nextval('cookbooks_id_seq'::regclass);

--
-- Name: checksums_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY checksums
    ADD CONSTRAINT checksums_pkey PRIMARY KEY (org_id, checksum);

--
-- Name: clients_authz_id_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY clients
    ADD CONSTRAINT clients_authz_id_key UNIQUE (authz_id);

--
-- Name: clients_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY clients
    ADD CONSTRAINT clients_pkey PRIMARY KEY (id);

--
-- Name: cookbook_versions_cookbook_id_major_minor_patch_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY cookbook_versions
    ADD CONSTRAINT cookbook_versions_cookbook_id_major_minor_patch_key UNIQUE (cookbook_id, major, minor, patch);

--
-- Name: cookbook_versions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY cookbook_versions
    ADD CONSTRAINT cookbook_versions_pkey PRIMARY KEY (id);

--
-- Name: cookbooks_authz_id_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY cookbooks
    ADD CONSTRAINT cookbooks_authz_id_key UNIQUE (authz_id);

--
-- Name: cookbooks_org_id_name_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY cookbooks
    ADD CONSTRAINT cookbooks_org_id_name_key UNIQUE (org_id, name);

--
-- Name: cookbooks_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY cookbooks
    ADD CONSTRAINT cookbooks_pkey PRIMARY KEY (id);

--
-- Name: data_bag_items_org_id_data_bag_name_item_name_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY data_bag_items
    ADD CONSTRAINT data_bag_items_org_id_data_bag_name_item_name_key UNIQUE (org_id, data_bag_name, item_name);

--
-- Name: data_bag_items_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY data_bag_items
    ADD CONSTRAINT data_bag_items_pkey PRIMARY KEY (id);

--
-- Name: data_bags_authz_id_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY data_bags
    ADD CONSTRAINT data_bags_authz_id_key UNIQUE (authz_id);

--
-- Name: data_bags_org_id_name_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY data_bags
    ADD CONSTRAINT data_bags_org_id_name_key UNIQUE (org_id, name);

--
-- Name: data_bags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY data_bags
    ADD CONSTRAINT data_bags_pkey PRIMARY KEY (id);

--
-- Name: environments_authz_id_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY environments
    ADD CONSTRAINT environments_authz_id_key UNIQUE (authz_id);

--
-- Name: environments_org_id_name_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY environments
    ADD CONSTRAINT environments_org_id_name_key UNIQUE (org_id, name);

--
-- Name: environments_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY environments
    ADD CONSTRAINT environments_pkey PRIMARY KEY (id);

--
-- Name: nodes_authz_id_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY nodes
    ADD CONSTRAINT nodes_authz_id_key UNIQUE (authz_id);

--
-- Name: nodes_org_id_name_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY nodes
    ADD CONSTRAINT nodes_org_id_name_key UNIQUE (org_id, name);

--
-- Name: nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY nodes
    ADD CONSTRAINT nodes_pkey PRIMARY KEY (id);

--
-- Name: org_id_name_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY clients
    ADD CONSTRAINT org_id_name_unique UNIQUE (org_id, name);

--
-- Name: roles_authz_id_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY roles
    ADD CONSTRAINT roles_authz_id_key UNIQUE (authz_id);

--
-- Name: roles_org_id_name_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY roles
    ADD CONSTRAINT roles_org_id_name_key UNIQUE (org_id, name);

--
-- Name: roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY roles
    ADD CONSTRAINT roles_pkey PRIMARY KEY (id);

--
-- Name: sandboxed_checksums_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY sandboxed_checksums
    ADD CONSTRAINT sandboxed_checksums_pkey PRIMARY KEY (sandbox_id, org_id, checksum);

--
-- Name: osc_users_authz_id_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY osc_users
    ADD CONSTRAINT osc_users_authz_id_key UNIQUE (authz_id);

--
-- Name: osc_users_email_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY osc_users
    ADD CONSTRAINT osc_users_email_key UNIQUE (email);

--
-- Name: osc_users_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY osc_users
    ADD CONSTRAINT osc_users_pkey PRIMARY KEY (id);

--
-- Name: osc_users_username_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--

ALTER TABLE ONLY osc_users
    ADD CONSTRAINT osc_users_username_key UNIQUE (username);

--
-- Name: cookbooks_org_id_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
--

CREATE INDEX cookbooks_org_id_index ON cookbooks USING btree (org_id);

--
-- Name: nodes_org_id_environment_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
--

CREATE INDEX nodes_org_id_environment_index ON nodes USING btree (org_id, environment);

--
-- Name: cookbook_version_checksums_cookbook_version_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY cookbook_version_checksums
    ADD CONSTRAINT cookbook_version_checksums_cookbook_version_id_fkey FOREIGN KEY (cookbook_version_id) REFERENCES cookbook_versions(id);

--
-- Name: cookbook_version_checksums_org_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY cookbook_version_checksums
    ADD CONSTRAINT cookbook_version_checksums_org_id_fkey FOREIGN KEY (org_id, checksum) REFERENCES checksums(org_id, checksum) ON UPDATE CASCADE ON DELETE RESTRICT;

--
-- Name: cookbook_versions_cookbook_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY cookbook_versions
    ADD CONSTRAINT cookbook_versions_cookbook_id_fkey FOREIGN KEY (cookbook_id) REFERENCES cookbooks(id) ON DELETE RESTRICT;

--
-- Name: data_bag_items_org_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY data_bag_items
    ADD CONSTRAINT data_bag_items_org_id_fkey FOREIGN KEY (org_id, data_bag_name) REFERENCES data_bags(org_id, name) ON UPDATE CASCADE ON DELETE CASCADE;

--
-- PostgreSQL database dump complete
--


text:
package org.apache.shiro.mgt;

import org.apache.shiro.cache.CacheManager;
import org.apache.shiro.cache.CacheManagerAware;
import org.apache.shiro.event.EventBus;
import org.apache.shiro.event.EventBusAware;
import org.apache.shiro.realm.Realm;
import org.apache.shiro.util.LifecycleUtils;

import java.util.ArrayList;
import java.util.Collection;

/**
 * Shiro support of a {@link SecurityManager} class hierarchy based around a collection of
 * {@link org.apache.shiro.realm.Realm}s.  All actual {@code SecurityManager} method implementations are left to
 * subclasses.
 *
 * @since 0.9
 */
public abstract class RealmSecurityManager extends CachingSecurityManager {

    /**
     * Internal collection of Realms used for all authentication and authorization operations.
     */
    private Collection<Realm> realms;

    /**
     * Default no-arg constructor.
     */
    public RealmSecurityManager() {
        super();
    }

    /**
     * Convenience method for applications using a single realm that merely wraps the realm in a list and then invokes
     * the {@link #setRealms} method.
     *
     * @param realm the realm to set for a single-realm application.
     * @since 0.2
     */
    public void setRealm(Realm realm) {
        if (realm == null) {
            throw new IllegalArgumentException("Realm argument cannot be null");
        }
        Collection<Realm> realms = new ArrayList<Realm>(1);
        realms.add(realm);
        setRealms(realms);
    }

    /**
     * Sets the realms managed by this <tt>SecurityManager</tt> instance.
     *
     * @param realms the realms managed by this <tt>SecurityManager</tt> instance.
     * @throws IllegalArgumentException if the realms collection is null or empty.
     */
    public void setRealms(Collection<Realm> realms) {
        if (realms == null) {
            throw new IllegalArgumentException("Realms collection argument cannot be null.");
        }
        if (realms.isEmpty()) {
            throw new IllegalArgumentException("Realms collection argument cannot be empty.");
        }
        this.realms = realms;
        afterRealmsSet();
    }

    protected void afterRealmsSet() {
        applyCacheManagerToRealms();
        applyEventBusToRealms();
    }

    /**
     * Returns the {@link Realm Realm}s managed by this SecurityManager instance.
     *
     * @return the {@link Realm Realm}s managed by this SecurityManager instance.
     */
    public Collection<Realm> getRealms() {
        return realms;
    }

    /**
     * Sets the internal {@link #getCacheManager CacheManager} on any internal configured
     * {@link #getRealms Realms} that implement the {@link org.apache.shiro.cache.CacheManagerAware CacheManagerAware} interface.
     *

     * This method is called after setting a cacheManager on this securityManager via the
     * {@link #setCacheManager(org.apache.shiro.cache.CacheManager) setCacheManager} method to allow it to be propagated
     * down to all the internal Realms that would need to use it.
     *

     * It is also called after setting one or more realms via the {@link #setRealm setRealm} or
     * {@link #setRealms setRealms} methods to allow these newly available realms to be given the cache manager
     * already in use.
     */
    protected void applyCacheManagerToRealms() {
        CacheManager cacheManager = getCacheManager();
        Collection<Realm> realms = getRealms();
        if (cacheManager != null && realms != null && !realms.isEmpty()) {
            for (Realm realm : realms) {
                if (realm instanceof CacheManagerAware) {
                    ((CacheManagerAware) realm).setCacheManager(cacheManager);
                }
            }
        }
    }

    /**
     * Sets the internal {@link #getEventBus  EventBus} on any internal configured
     * {@link #getRealms Realms} that implement the {@link EventBusAware} interface.
     *

     * This method is called after setting an eventBus on this securityManager via the
     * {@link #setEventBus(org.apache.shiro.event.EventBus) setEventBus} method to allow it to be propagated
     * down to all the internal Realms that would need to use it.
     *

     * It is also called after setting one or more realms via the {@link #setRealm setRealm} or
     * {@link #setRealms setRealms} methods to allow these newly available realms to be given the EventBus
     * already in use.
     *
     * @since 1.3
     */
    protected void applyEventBusToRealms() {
        EventBus eventBus = getEventBus();
        Collection<Realm> realms = getRealms();
        if (eventBus != null && realms != null && !realms.isEmpty()) {
            for(Realm realm : realms) {
                if (realm instanceof EventBusAware) {
                    ((EventBusAware)realm).setEventBus(eventBus);
                }
            }
        }
    }

    /**
     * Simply calls {@link #applyCacheManagerToRealms() applyCacheManagerToRealms()} to allow the
     * newly set {@link org.apache.shiro.cache.CacheManager CacheManager} to be propagated to the internal collection of Realm
     * that would need to use it.
     */
    protected void afterCacheManagerSet() {
        super.afterCacheManagerSet();
        applyCacheManagerToRealms();
    }

    @Override
    protected void afterEventBusSet() {
        super.afterEventBusSet();
        applyEventBusToRealms();
    }

    public void destroy() {
        LifecycleUtils.destroy(getRealms());
        this.realms = null;
        super.destroy();
    }

}


text:
/* Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.activiti.engine.impl.context;

import java.util.Stack;

import org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.activiti.engine.impl.interceptor.CommandContext;
import org.activiti.engine.impl.pvm.runtime.InterpretableExecution;

/**
 * @author Tom Baeyens
 */
public class Context {

  protected static ThreadLocal<Stack<CommandContext>> commandContextThreadLocal = new ThreadLocal<Stack<CommandContext>>();
  protected static ThreadLocal<Stack<ProcessEngineConfigurationImpl>> processEngineConfigurationStackThreadLocal = new ThreadLocal<Stack<ProcessEngineConfigurationImpl>>();
  protected static ThreadLocal<Stack<ExecutionContext>> executionContextStackThreadLocal = new ThreadLocal<Stack<ExecutionContext>>();

  public static CommandContext getCommandContext() {
    Stack<CommandContext> stack = getStack(commandContextThreadLocal);
    if (stack.isEmpty()) {
      return null;
    }
    return stack.peek();
  }

  public static void setCommandContext(CommandContext commandContext) {
    getStack(commandContextThreadLocal).push(commandContext);
  }

  public static void removeCommandContext() {
    getStack(commandContextThreadLocal).pop();
  }

  public static ProcessEngineConfigurationImpl getProcessEngineConfiguration() {
    Stack<ProcessEngineConfigurationImpl> stack = getStack(processEngineConfigurationStackThreadLocal);
    if (stack.isEmpty()) {
      return null;
    }
    return stack.peek();
  }

  public static void setProcessEngineConfiguration(ProcessEngineConfigurationImpl processEngineConfiguration) {
    getStack(processEngineConfigurationStackThreadLocal).push(processEngineConfiguration);
  }

  public static void removeProcessEngineConfiguration() {
    getStack(processEngineConfigurationStackThreadLocal).pop();
  }

  public static ExecutionContext getExecutionContext() {
    return getStack(executionContextStackThreadLocal).peek();
  }

  public static void setExecutionContext(InterpretableExecution execution) {
    getStack(executionContextStackThreadLocal).push(new ExecutionContext(execution));
  }

  public static void removeExecutionContext() {
    getStack(executionContextStackThreadLocal).pop();
  }

  protected static <T> Stack<T> getStack(ThreadLocal<Stack<T>> threadLocal) {
    Stack<T> stack = threadLocal.get();
    if (stack==null) {
      stack = new Stack<T>();
      threadLocal.set(stack);
    }
    return stack;
  }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="match_parent"
              android:layout_height="170dp"
              android:orientation="vertical"
              android:paddingLeft="10dp"
              android:paddingRight="10dp"
              android:paddingBottom="10dp"
              android:paddingTop="10dp"
    >

    <ImageView
        android:id="@+id/iv"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_centerVertical="true"
        android:layout_marginLeft="10dp"
        android:scaleType="fitXY"
        android:src="@mipmap/tangyang7"/>

</LinearLayout>


text:
import {
    isNumber,
    process,
    getMethod,
    json2formdata,
    formdata2json,
    appendUrl,
    extractUrl,
    extractParams,
    transformParams,
    filterParams,
    pickParams,
    createSerializer
 } from './lang'
 import qs from 'query-string'

export const core = {

    processFetch(options, previous) {
        options = previous(options)
        this.options = options
        return window.fetch(options.url, options)
    },

    processRequest(options, previous) {
        return process(options, previous,options => {
            if (isNumber(options.timeout)) {
                const {timeout} = options
                delete options['timeout']

                let abort

                let abort_promise = new Promise((resolve,reject)=>{
                    abort = (err)=>{
                        reject(err)
                    }
                })

                setTimeout(function () {
                    let err = new Error(`[MFETCH Error] request "${options.url}" is timeout!`)
                    err.isTimeout = true
                    abort(err)
                }, timeout)

                let promise = Promise.race([
                    this.post('fetch', options),
                    abort_promise
                ])

                promise.abort = abort

                return this.post('response',promise)
            }
            return this.post('response', this.post('fetch', options))
        })

    },

    processSerializer(options) {
        return {
            query_string: {
                parse: qs.parse,
                stringify: qs.stringify,
                extract: qs.extract
            },
            form_data: {
                parse: formdata2json,
                formify: json2formdata
            }
        }
    },

    processAfterOption(options, previous) {
        options = previous(options)

        const varNames = options.uri ? options.uri.varNames : []

        const serialize = createSerializer(this, options)

        options.params = serialize(extractParams, options, options.params)

        options.url = options.uri ? options.uri.fill(pickParams(options.params, varNames)) : options.url

        delete options.uri

        switch (getMethod(options)) {
            case 'get':

            case 'jsonp':

            case 'head':

                const url_params = Object.assign(
                    serialize(extractUrl, options, options.url),
                    filterParams(options.params, varNames)
                )

                options.url = serialize(appendUrl, options, options.url, url_params)
                return options

            default:

                options.body = serialize(transformParams, options,
                    Object.assign(
                        serialize(extractParams, options, options.body),
                        filterParams(options.params, varNames)
                    )
                )

                return options

        }

    }
}


text:
require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../fixtures/classes', __FILE__)

describe "Array#hash" do
  it "returns the same fixnum for arrays with the same content" do
    [].respond_to?(:hash).should == true

    [[], [1, 2, 3]].each do |ary|
      ary.hash.should == ary.dup.hash
      ary.hash.should be_an_instance_of(Fixnum)
    end
  end

  it "properly handles recursive arrays" do
    empty = ArraySpecs.empty_recursive_array
    lambda { empty.hash }.should_not raise_error

    array = ArraySpecs.recursive_array
    lambda { empty.hash }.should_not raise_error
  end

  it "returns the same hash for equal recursive arrays" do
    rec = []; rec << rec
    rec.hash.should == [rec].hash
    rec.hash.should == [[rec]].hash
    # This is because rec.eql?([[rec]])
    # Remember that if two objects are eql?
    # then the need to have the same hash
    # Check the Array#eql? specs!
  end

  it "returns the same hash for equal recursive arrays through hashes" do
    h = {} ; rec = [h] ; h[:x] = rec
    rec.hash.should == [h].hash
    rec.hash.should == [{:x => rec}].hash
    # Like above, this is because rec.eql?([{:x => rec}])
  end

  #  Too much of an implementation detail? -rue
  not_supported_on :rubinius, :opal do
    it "calls to_int on result of calling hash on each element" do
      ary = Array.new(5) do
        obj = mock('0')
        obj.should_receive(:hash).and_return(obj)
        obj.should_receive(:to_int).and_return(0)
        obj
      end

      ary.hash

      hash = mock('1')
      hash.should_receive(:to_int).and_return(1.hash)

      obj = mock('@hash')
      obj.instance_variable_set(:@hash, hash)
      def obj.hash() @hash end

      [obj].hash.should == [1].hash
    end
  end

  it "ignores array class differences" do
    ArraySpecs::MyArray[].hash.should == [].hash
    ArraySpecs::MyArray[1, 2].hash.should == [1, 2].hash
  end

  it "returns same hash code for arrays with the same content" do
    a = [1, 2, 3, 4]
    a.fill 'a', 0..3
    b = %w|a a a a|
    a.hash.should == b.hash
  end

  it "returns the same value if arrays are #eql?" do
    a = [1, 2, 3, 4]
    a.fill 'a', 0..3
    b = %w|a a a a|
    a.hash.should == b.hash
    a.should eql(b)
  end
end


text:
UTSCRooms
=========

[Demo](https://utscrooms.js.org/)

A web application that simplifies the method for students to find empty classrooms at University of Toronto Scarborough.

Technology
===
Initially, naive me wrote a crawler in python, and hosted a HTML page using Django. This was very inefficient solution, and had to be hosted somewhere.
To make things interested, I've decided to do all tasks on Javascript, which allows no infrastructure required on my end.
Currently, it's using React + ES6 syntax for the interface, and Yahoo! Query Language(YQL) is used to overcome cross-origin issues when crawling the data.

Background
====

At UTSC, ["Students are welcome to use empty classrooms as study spaces – as long as there are NO scheduled lectures, tutorials or standing bookings. Classrooms are open from 7 AM until 10 PM each day."](http://www.utsc.utoronto.ca/studentaffairs/study-space)
That said, it is very tedious task to go to [UTSC Room Schedule](https://www.utsc.utoronto.ca/~registrar/scheduling/room_schd), choose classrooms and date, and check whether there are any schedule for the given time.
This webpage will allow the student to find classroom that is exactly available at given time.

Todo
===

- [x] Implement data crawling
- [x] Show list
- [x] Time picker
- [ ] Memoize crawled data, automatic/manual data refresh
- [ ] Map view with pins
- [ ] Per room detail page


text:
<!DOCTYPE html>
<html>
  <head>
    <title>react-confirm with material-ui example</title>
  </head>
  <body>
    <div id="root" />
    <script src="/bundle.js"></script>
  </body>
</html>


text:
package net.zerobuilder.api.test;

import com.squareup.javapoet.ClassName;
import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.ParameterizedTypeName;
import com.squareup.javapoet.TypeName;
import com.squareup.javapoet.TypeSpec;
import com.squareup.javapoet.TypeVariableName;
import net.zerobuilder.compiler.generate.DtoContext;
import net.zerobuilder.compiler.generate.DtoGeneratorInput.RegularSimpleGoalInput;
import net.zerobuilder.compiler.generate.DtoGeneratorOutput.GeneratorOutput;
import net.zerobuilder.compiler.generate.DtoGoalDetails.StaticMethodGoalDetails;
import net.zerobuilder.compiler.generate.DtoRegularGoalDescription.SimpleRegularGoalDescription;
import net.zerobuilder.compiler.generate.DtoRegularParameter;
import net.zerobuilder.compiler.generate.DtoRegularParameter.SimpleParameter;
import net.zerobuilder.compiler.generate.Generator;
import net.zerobuilder.modules.generics.GenericsBuilder;
import org.hamcrest.CoreMatchers;
import org.junit.Test;

import javax.lang.model.element.Modifier;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static java.util.Arrays.asList;
import static java.util.Collections.singletonList;
import static java.util.stream.Collectors.groupingBy;
import static net.zerobuilder.compiler.generate.Access.PRIVATE;
import static net.zerobuilder.compiler.generate.DtoContext.ContextLifecycle.NEW_INSTANCE;
import static net.zerobuilder.compiler.generate.DtoContext.createContext;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;

public class GenericsBuilderTest {

  private static final ClassName TYPE = ClassName.get(GenericsBuilderTest.class)
      .peerClass("MyType");

  // the type we wish to generate; in this case, a nested type
  private static final ClassName GENERATED_TYPE = ClassName.get(GenericsBuilderTest.class)
      .nestedClass("MyTypeBuilders");

  private static final TypeVariableName K = TypeVariableName.get("K");
  private static final TypeVariableName V = TypeVariableName.get("V");

  private static final ParameterizedTypeName LIST_OF_K =
      ParameterizedTypeName.get(ClassName.get(List.class), K);
  private static final ParameterizedTypeName MAP_K_V =
      ParameterizedTypeName.get(ClassName.get(Map.class), K, V);

  /**
   *
We want to generate a generics for {@code MyType#create(String, Integer)}
   *

   *

   *   class MyType {
   *     // our goal method
   *     static <K, V> Map<K, V> multiKey(List<K> keys, V value) {
   *       return null;
   *     }
   *   }
   *

   */
  @Test
  public void staticMethodGoal() {

    // create goal context
    DtoContext.GoalContext goalContext = createContext(
        TYPE, // type that contains the goal method; in this case, this is the same as the goal type
        GENERATED_TYPE // the type we wish to generate; it will contain all the generated code
    );

    // create goal details
    String goalName = "multiKey"; // free choice, but should be a valid java identifier
    StaticMethodGoalDetails details = StaticMethodGoalDetails.create(
        MAP_K_V, // return type of the goal method
        goalName,
        asList("keys", "value"),
        "multiKey",
        PRIVATE,
        asList(K, V),
        NEW_INSTANCE);

    // use SimpleParameter because the generics module doesn't need projections
    SimpleParameter fooParameter = DtoRegularParameter.create("keys", LIST_OF_K);
    SimpleParameter barParameter = DtoRegularParameter.create("value", V);
    SimpleRegularGoalDescription description = SimpleRegularGoalDescription.create(
        details,
        Collections.emptyList(), // the goal method declares no exceptions
        // step order; not necessarily the order of the goal parameters
        asList(fooParameter, barParameter),
        goalContext);

    // Invoke the generator
    GeneratorOutput generatorOutput = Generator.generate(singletonList(new RegularSimpleGoalInput(
        new GenericsBuilder(),
        description)));

    assertThat(generatorOutput.methods().size(), is(1));
    assertThat(generatorOutput.methods().get(0).name(), is(goalName));
    assertThat(generatorOutput.methods().get(0).method().name, is("multiKeyBuilder"));
    assertThat(generatorOutput.methods().get(0).method().parameters.size(), is(0));
    assertThat(generatorOutput.methods().get(0).method().modifiers.contains(Modifier.STATIC), is(true));
    assertThat(generatorOutput.methods().get(0).method().modifiers.contains(Modifier.PRIVATE), is(true));
    Map<String, TypeSpec> nested = unique(generatorOutput.nestedTypes().stream().collect(groupingBy(type -> type.name)));
    TypeSpec contract = nested.get("MultiKeyBuilder");
    Map<String, TypeSpec> steps = unique(contract.typeSpecs.stream().collect(groupingBy(type -> type.name)));
    checkKeysContract(steps.get("Keys"));
    checkValueContract(steps.get("Value"));
  }

  private void checkKeysContract(TypeSpec keys) {
    assertThat(keys.methodSpecs.size(), is(2));
    assertThat(keys.typeVariables.size(), is(0));
    MethodSpec stepMethod = keys.methodSpecs.get(1);
    assertThat(stepMethod.typeVariables, is(singletonList(K)));
    TypeName returnType = stepMethod.returnType;
    assertThat(returnType, is(CoreMatchers.instanceOf(ParameterizedTypeName.class)));
    assertThat(((ParameterizedTypeName) returnType).rawType.simpleName(), is("Value"));
    assertThat(((ParameterizedTypeName) returnType).typeArguments, is(singletonList(TypeVariableName.get("K"))));
  }

  private void checkValueContract(TypeSpec value) {
    assertThat(value.methodSpecs.size(), is(2));
    assertThat(value.typeVariables, is(singletonList(K)));
    MethodSpec method = value.methodSpecs.get(1);
    assertThat(method.typeVariables, is(singletonList(V)));
    assertThat(method.returnType, is(MAP_K_V));
  }

  private static <K, V> Map<K, V> unique(Map<K, List<V>> map) {
    HashMap<K, V> m = new HashMap<>();
    for (Map.Entry<K, List<V>> entry : map.entrySet()) {
      assertThat(entry.getValue().size(), is(1));
      m.put(entry.getKey(), entry.getValue().get(0));
    }
    return m;
  }
}


text:
#include "fontcreator_widget.h"
#include "ui_main_form.h"
#include "fontloader.h"
#include <QGraphicsPixmapItem>
#include <QTransform>
#include <QColorDialog>
#include <assert.h>

namespace
{
const int CHARACTOR_MARGIN(2);
const int TEXTURE_MARGIN(25);
const int MAX_RENDER_ONE_TIME(50);
struct TextureSizeInfo
{
    const char* const text;
    int width;
    int height;
};
TextureSizeInfo TEXTURE_SIZE_LIST[] =
{
    {"256x256", 256, 256},
    {"512x256", 512, 256},
    {"512x512", 512, 512},
    {"1024x512", 1024, 512},
    {"1024x1024", 1024, 1024},
    {"2048x1024", 2048, 1024},
    {"2048x2048", 2048, 2048},
    {"4096x2048", 4096, 2048},
    {"4096x4096", 4096, 4096}
};

/**
 *  @brief	QImageへフォントの描画.
 *  @param  render_target 描画先.
 *  @param  draw_bitmap 描画するビットマップ情報.
 *  @param  draw_point_x x座標.
 *  @param  draw_point_y y座標.
 *  @param  color 色.
 */
void DrawFontToQImage(QImage *render_target,
        const font_creator::FontLoader::FontBitmap *draw_bitmap,
        float draw_point_x, float draw_point_y,
        QColor &color)
{
    unsigned char *temp = new unsigned char[draw_bitmap->width *
            draw_bitmap->height * 4];
    memset(temp, 0, draw_bitmap->width *
                   draw_bitmap->height * 4);
    for (int i = 0; i < draw_bitmap->height; ++i)
    {
        for (int j = 0; j < draw_bitmap->width; ++j)
        {
            unsigned char alpha =
                    reinterpret_cast<unsigned char*>(draw_bitmap->bitmap)[i * (int)draw_bitmap->width + j];
            temp[(i * (int)draw_bitmap->width + j) * 4] = color.blue();
            temp[(i * (int)draw_bitmap->width + j) * 4 + 1] = color.green();
            temp[(i * (int)draw_bitmap->width + j) * 4 + 2] = color.red();
            temp[(i * (int)draw_bitmap->width + j) * 4 + 3] = alpha;
        }
    }
    QTransform matrix;
    matrix.translate(draw_point_x, draw_point_y);
    matrix.rotate(0.0);
    matrix.scale(1.0, 1.0);
    QPainter painter(render_target);
    painter.setTransform(matrix);
    painter.setRenderHint(QPainter::Antialiasing, true);
    painter.setRenderHint(QPainter::SmoothPixmapTransform, false);
    painter.setRenderHint(QPainter::HighQualityAntialiasing, true);
    QImage font(
        temp,
        draw_bitmap->width,
        draw_bitmap->height,
        QImage::Format_ARGB32
    );
    QPointF position(0.0f, 0.0f);
    painter.drawImage(position, font);
    painter.end();
    delete temp;
}

}

/**
 *  @brief		コンストラクタ.
 */
FontCreatorWidget::FontCreatorWidget() :
    QWidget()
  , m_ui(new Ui::MainForm())
  , m_view_area(new QWidget())
  , m_timer(nullptr)
  , m_font_loader(new font_creator::FontLoader())
  , m_texture_width(512)
  , m_texture_height(512)
  , m_font_color(0xaa, 0xFF, 0xFF)
  , m_outline_color(0x00, 0x00, 0xFF)
  , m_bg_color(0x50, 0x50, 0x50)
{
    m_ui->setupUi(this);
    setAcceptDrops(true);

    m_view_area->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    m_view_area->installEventFilter(this);
    m_view_area->setParent(m_ui->scroll_area);
    m_ui->scroll_area->setWidget(m_view_area);

    // font combo box.
    connect(m_ui->font_combo_box, SIGNAL(currentFontChanged(const QFont&)), this, SLOT(OnFontComboBoxChanged(const QFont&)));

    // texture size combo box.
    for (int i = 0; i < sizeof(TEXTURE_SIZE_LIST) / sizeof(TextureSizeInfo); ++i)
    {
        m_ui->texture_size_list->addItem(TEXTURE_SIZE_LIST[i].text, QVariant(i));
    }
    connect(m_ui->texture_size_list, SIGNAL(currentIndexChanged(int)),
            this, SLOT(OnTextureSizeChenged(int)));
    m_ui->texture_size_list->setCurrentIndex(2);
    // font size box.
    connect(m_ui->font_size, SIGNAL(valueChanged(int)),
            this, SLOT(OnFontSizeChanged(int)));
    // outline.
    connect(m_ui->outline_enable, SIGNAL(toggled(bool)),
            this, SLOT(OnChangeOutlineEnable(bool)));
    connect(m_ui->outline_width, SIGNAL(valueChanged(double)),
            this, SLOT(OnChangeOutlineWidth(double)));
    // text box.
    connect(m_ui->create_text, SIGNAL(textChanged()),
            this, SLOT(OnTextChanged()));
    // ASCIIかな漢字ボタン.
    connect(m_ui->use_all_ascii, SIGNAL(clicked()),
            this, SLOT(OnClickASCII()));
    connect(m_ui->use_all_kana, SIGNAL(clicked()),
            this, SLOT(OnClickKana()));
    connect(m_ui->use_all_kanji, SIGNAL(clicked()),
            this, SLOT(OnClickKanji()));
    // スケールスライダー.
    connect(m_ui->scale_slider, SIGNAL(valueChanged(int)),
            this, SLOT(OnScaleChenged(int)));
    // bound.
    connect(m_ui->bound, SIGNAL(toggled(bool)),
            this, SLOT(OnChangeBoundEnable(bool)));

    // default color.
    QString style = "QWidget {background-color: " + m_font_color.name() + ";}";
    m_ui->font_color->setStyleSheet(style);
    style = "QWidget {background-color: " + m_outline_color.name() + ";}";
    m_ui->outline_color->setStyleSheet(style);
    style = "QWidget {background-color: " + m_bg_color.name() + ";}";
    m_ui->bg_color->setStyleSheet(style);
    m_ui->font_color->installEventFilter(this);
    m_ui->outline_color->installEventFilter(this);
    m_ui->bg_color->installEventFilter(this);
}

/**
 *  @brief		デストラクタ.
 */
FontCreatorWidget::~FontCreatorWidget()
{
    ClearImage(false);

    if (m_view_area)
    {
        m_view_area->setParent(nullptr);
        m_ui->scroll_area->setWidget(nullptr);
        delete m_view_area;
        m_view_area = nullptr;
    }

    if (m_ui)
    {
        delete m_ui;
        m_ui = nullptr;
    }

    if (m_font_loader)
    {
        delete m_font_loader;
        m_font_loader = nullptr;
    }
}

/**
 *  @breif      スタート時処理.
 */
void FontCreatorWidget::OnStart()
{
}

/**
 *  @breif      終了時処理.
 */
void  FontCreatorWidget::OnClose()
{
}

/**
 *  @breif      描画処理.
 */
void FontCreatorWidget::paintEvent(QPaintEvent * /*event*/)
{
}

/**
 *  @breif      テクスチャ描画処理.
 */
void FontCreatorWidget::viewPaintEvent()
{
    float scale = m_ui->scale_slider->value() / 100.0f;
    QPainter painter(m_view_area);
    painter.scale(scale, scale);
    for (size_t i = 0; i < m_texture_list.size(); ++i)
    {
        painter.drawImage(TEXTURE_MARGIN,
                          TEXTURE_MARGIN + (m_texture_height + TEXTURE_MARGIN) * static_cast<int>(i),
                          *m_texture_list[i]);
        if (m_ui->bound->isChecked())
        {
            painter.drawImage(TEXTURE_MARGIN,
                              TEXTURE_MARGIN + (m_texture_height + TEXTURE_MARGIN) * static_cast<int>(i),
                              *m_bound_list[i]);
        }
    }
    painter.end();
}

/**
 *  @breif      ドラッグイベント.
 *  @param      event イベント.
 */
void FontCreatorWidget::dragEnterEvent(QDragEnterEvent *event)
{
    if (event->mimeData()->hasUrls())
    {
        foreach (QUrl url, event->mimeData()->urls())
        {
            if (QFileInfo(url.toLocalFile()).suffix().toLower() == "ttc" ||
                QFileInfo(url.toLocalFile()).suffix().toLower() == "ttf" ||
                QFileInfo(url.toLocalFile()).suffix().toLower() == "otf" ||
                QFileInfo(url.toLocalFile()).suffix().toLower() == "fon")
            {
                event->accept();
                break;
            }
        }
    }
}

/**
 *  @breif      ドロップイベント.
 *  @param      event イベント.
 */
void FontCreatorWidget::dropEvent(QDropEvent *event)
{
    if (event->mimeData()->hasUrls())
    {
        foreach (QUrl url, event->mimeData()->urls())
        {
            if (QFileInfo(url.toLocalFile()).suffix().toLower() == "ttc" ||
                QFileInfo(url.toLocalFile()).suffix().toLower() == "ttf" ||
                QFileInfo(url.toLocalFile()).suffix().toLower() == "otf" ||
                QFileInfo(url.toLocalFile()).suffix().toLower() == "fon")
            {
                QString file_name = QFileInfo(url.toLocalFile()).filePath();
                m_ui->font_path->setText(QFileInfo(url.toLocalFile()).fileName());
                if (m_font_loader->Load(file_name.toStdString().c_str()))
                {
                    m_ui->create_text->setPlainText("");
                    CreateFontCache();
                    ClearImage();
                }
                break;
            }
        }
    }
}

/**
 *  @breif      フォントキャッシュの作成.
 */
void FontCreatorWidget::CreateFontCache()
{
    if (!m_font_loader->HasFace())
    {
        return;
    }

    QString create_text = m_ui->create_text->toPlainText();
    char16_t *create_text16 = new char16_t[create_text.length() + 1];
    create_text.toWCharArray(reinterpret_cast<wchar_t*>(create_text16));
    create_text16[create_text.length()] = 0;
    font_creator::FontLoader::CreateParam create_param;
    create_param.font_size = m_ui->font_size->value();
    create_param.out_line_width = static_cast<float>(m_ui->outline_width->value());
    create_param.out_line = m_ui->outline_enable->isChecked();
    m_font_loader->CreateFontInfo(create_text16, create_param);
    delete[] create_text16;
}

void FontCreatorWidget::UpdateImageEvent()
{
    if (m_timer)
    {
        m_timer->stop();
    }
    UpdateImage(m_texture_width, m_texture_height);
}

/**
 *  @breif      update image.
 *  @param  in  tex_width テクスチャ幅.
 *  @param  in  tex_height テクスチャ高さ.
 */
void FontCreatorWidget::UpdateImage(int tex_width, int tex_height)
{
    if (!m_font_loader->HasFace())
    {
        return;
    }
    bool resize = m_texture_list.size() == 0;

    float outline_width = m_ui->outline_enable->isChecked() ? m_ui->outline_width->value() : 0.0f;
    float font_height = m_font_loader->GetMaxFontHeight() + outline_width * 2.0f;

    int render_times = 0;
    for (;
         m_render_info.render_count < m_font_loader->GetFontInfoCount() && render_times < MAX_RENDER_ONE_TIME
         ; ++m_render_info.render_count, ++render_times)
    {
        const font_creator::FontLoader::FontInfo &info = m_font_loader->GetFontInfo(m_render_info.render_count);
        float font_width = info.width + outline_width * 2.0f;
        bool next_line = (m_render_info.offset.x() + font_width + CHARACTOR_MARGIN) >
                tex_width;
        if (next_line)
        {
            m_render_info.offset.setX(CHARACTOR_MARGIN);
            m_render_info.offset.setY(std::floorf(m_render_info.offset.y() + font_height + CHARACTOR_MARGIN));
            if (m_render_info.offset.y() + font_height + CHARACTOR_MARGIN > tex_height)
            {
                if (m_render_info.current_texture)
                {
                    m_render_info.current_texture = nullptr;
                }
            }
        }
        if (m_render_info.current_texture == nullptr)
        {
            m_render_info.offset = QPoint(CHARACTOR_MARGIN, CHARACTOR_MARGIN);
            QImage *new_image = new QImage();
            *new_image = m_render_info.invalid_image.copy();
            m_render_info.current_texture = new_image;
            m_texture_list.push_back(new_image);
            new_image = new QImage();
            *new_image = m_render_info.bound_invalid_image.copy();
            m_render_info.bound_texture = new_image;
            m_bound_list.push_back(new_image);
            resize = true;
        }

        // 文字描画.
        // ペンとブラシ.
        QPen out_line_pen(m_outline_color);
        out_line_pen.setWidthF(outline_width * 2.0f);
        out_line_pen.setCapStyle(Qt::FlatCap);
        out_line_pen.setJoinStyle(Qt::SvgMiterJoin);
        // out_line_pen.setMiterLimit(0);
        QBrush transparent_brush(QColor(0, 0, 0, 0));
        QBrush fill_brush(m_font_color);

        if (info.has_outline)
        {
            // パス描画.
            QPainter painter(m_render_info.current_texture);
            painter.setRenderHint(QPainter::Antialiasing, true);
            painter.setRenderHint(QPainter::SmoothPixmapTransform, false);
            painter.setRenderHint(QPainter::HighQualityAntialiasing, true);
            QTransform matrix;
            matrix.translate(m_render_info.offset.x() + outline_width - info.bearing_x,
                             m_render_info.offset.y() + m_font_loader->GetMaxAscend() + outline_width);
            matrix.rotate(0.0f);
            matrix.scale(1.0f, 1.0f);
            painter.setTransform(matrix);

            if (m_ui->outline_enable->isChecked())
            {
                // painter.setPen(out_line_pen);
                painter.strokePath(info.path, out_line_pen);
            }
            // 塗描画.
            // painter.setPen(transparent_pen);
            // painter.setBrush(fill_brush);
            painter.fillPath(info.path, fill_brush);

            painter.end();
        }
        else
        {
            // ビットマップ描画.
            DrawFontToQImage(m_render_info.current_texture, &info.fill,
                             m_render_info.offset.x(),
                             m_render_info.offset.y() + info.fill.offset_y, m_font_color);
        }

        // 境界表示.
        QPainter bound_painter(m_render_info.bound_texture);
        bound_painter.setRenderHint(QPainter::Antialiasing, false);
        bound_painter.setRenderHint(QPainter::HighQualityAntialiasing, false);
        if (m_bg_color.red() * 0.3f + m_bg_color.green() * 0.59f + m_bg_color.blue() * 0.11f >=
            0x80)
        {
            bound_painter.setPen(QPen(QBrush(Qt::black), 1.0f));
        }
        else
        {
            bound_painter.setPen(QPen(QBrush(Qt::white), 1.0f));
        }
        bound_painter.setBrush(transparent_brush);
        bound_painter.drawRect(m_render_info.offset.x(), m_render_info.offset.y(), font_width, font_height);
        bound_painter.end();
        m_render_info.offset.setX(m_render_info.offset.x() + font_width + CHARACTOR_MARGIN);
    }
    if (resize)
    {
        UpdateScale();
    }

    // UpdateInfomation.
    // texture count.
    QString text = "TEXTURE COUNT ";
    QString temp;
    temp.setNum((int)m_texture_list.size());
    text += temp;
    // chara count.
    if (m_render_info.render_count < m_font_loader->GetFontInfoCount())
    {
        text += " RENDERING ";
        temp.setNum(m_render_info.render_count);
        text += temp;
        text += "/";
        temp.setNum(m_font_loader->GetFontInfoCount());
        text += temp;
    }
    else
    {
        text += " CHARACTOR COUNT ";
        temp.setNum(m_render_info.render_count);
        text += temp;
    }
    // data size.
    text += " DATA SIZE ";
    float data_size = m_texture_width * m_texture_height * static_cast<int>(m_texture_list.size());
    if (m_ui->outline_enable->isChecked())
    {
        data_size *= 2.0f;
    }
    data_size /= 1024.0f * 1024.0f;
    temp.setNum(data_size);
    text += temp;
    text += "MB";

    m_ui->infomation->setText(text);

    update();

    // タイマー再設定.
    if (m_render_info.render_count < m_font_loader->GetFontInfoCount())
    {
        if (m_timer && !m_timer->isActive())
        {
            m_timer->start(1);
        }
    }
    else if (m_timer != nullptr)
    {
        delete m_timer;
        m_timer = nullptr;
    }
}

/**
 *  @breif      clear image.
 */
void FontCreatorWidget::ClearImage(bool with_update)
{
    for (size_t i = 0; i < m_texture_list.size(); ++i)
    {
        delete m_texture_list[i];
        delete m_bound_list[i];
    }
    m_texture_list.clear();
    m_bound_list.clear();
    m_render_info.offset = QPointF(CHARACTOR_MARGIN, CHARACTOR_MARGIN);
    m_render_info.render_count = 0;
    m_render_info.current_texture = nullptr;
    m_render_info.invalid_image = QImage(m_texture_width,
                             m_texture_height,
                             QImage::Format_RGB888);
    m_render_info.bound_invalid_image = QImage(m_texture_width,
                                               m_texture_height,
                                               QImage::Format_ARGB32);
    m_render_info.invalid_image.fill(m_bg_color);
    m_render_info.bound_invalid_image.fill(Qt::transparent);

    if (with_update)
    {
        m_render_info.offset = QPoint(CHARACTOR_MARGIN, CHARACTOR_MARGIN);
        QImage *new_image = new QImage();
        *new_image = m_render_info.invalid_image.copy();
        m_render_info.current_texture = new_image;
        m_texture_list.push_back(new_image);
        new_image = new QImage();
        *new_image = m_render_info.bound_invalid_image.copy();
        m_render_info.bound_texture = new_image;
        m_bound_list.push_back(new_image);
        UpdateScale();
        update();

        if (m_timer == nullptr)
        {
            m_timer = new QTimer(this);
            connect(m_timer, SIGNAL(timeout()), this, SLOT(UpdateImageEvent()));
        }
        m_timer->start(0);
    }
}

/**
 *  @breif      フォントコンボボックス変更.
 *  @param  in  font 選択されたフォント.
 */
void FontCreatorWidget::OnFontComboBoxChanged(const QFont &font)
{
    QString font_path = QStandardPaths::standardLocations(QStandardPaths::FontsLocation)[0];
    QDir font_dir(font_path);
    if (font_dir.exists())
    {
        QStringList file_list = font_dir.entryList();
        for (int i = 0; i < file_list.size(); ++i)
        {
            QString file_name = font_path + "/" + file_list[i];
            QString family_name = font.family();
            int face_index = m_font_loader->HasFamily(file_name.toStdString().c_str(),
                family_name);
            if (face_index != -1)
            {
                m_ui->font_path->setText(QFileInfo(file_name).fileName());
                if (m_font_loader->Load(file_name.toStdString().c_str(), face_index))
                {
                    m_ui->create_text->setPlainText("");
                    CreateFontCache();
                    ClearImage();
                }
                return;
            }
        }
        m_font_loader->Unload();
        m_ui->create_text->setPlainText("");
        m_ui->font_path->setText("");
        m_ui->infomation->setText("Unsupported Font");
    }
}

/**
 *  @breif      テクスチャサイズ変更イベント.
 *  @param  in  selected_index 選択されたインデックス.
 */
void FontCreatorWidget::OnTextureSizeChenged(int index)
{
    int table_index = m_ui->texture_size_list->itemData(index).toInt();
    m_texture_width = TEXTURE_SIZE_LIST[table_index].width;
    m_texture_height = TEXTURE_SIZE_LIST[table_index].height;
    ClearImage();
}

/**
 *  @breif      フォントサイズ変更イベント.
 *  @param  in  font_size フォントサイズ.
 */
void FontCreatorWidget::OnFontSizeChanged(int /*font_size*/)
{
    CreateFontCache();
    ClearImage();
}

/**
 *  @breif      アウトライン有効/無効変更.
 *  @param  in  checked check状態.
 */
void FontCreatorWidget::OnChangeOutlineEnable(bool /*checked*/)
{
    if (m_ui->outline_enable->isChecked())
    {
        m_ui->outline_width->setEnabled(true);
    }
    else
    {
        m_ui->outline_width->setEnabled(false);
    }
    ClearImage();
}

/**
 *  @breif      アウトライン太さ変更.
 *  @param  in  outline_width アウトライン太さ.
 */
void FontCreatorWidget::OnChangeOutlineWidth(double /*outline_width*/)
{
    ClearImage();
}

/**
 *  @breif      テキスト変更.
 */
void FontCreatorWidget::OnTextChanged()
{
    CreateFontCache();
    ClearImage();
}

/**
 *  @breif      ASCIIボタンクリック.
 */
void FontCreatorWidget::OnClickASCII()
{
    QString add = "";
    for (char16_t i = 0x00; i < 0x7f; ++i)
    {
        if (m_font_loader->CanRenderCharactor(i))
        {
            add.append(i);
        }
    }
    m_ui->create_text->appendPlainText(add);
}

/**
 *  @breif      かなボタンクリック.
 */
void FontCreatorWidget::OnClickKana()
{
    QString add = "";
    // かな
    for (char16_t i = 0x3040; i < 0x30ff; ++i)
    {
        if (m_font_loader->CanRenderCharactor(i))
        {
            add.append(i);
        }
    }
    // 全角英数 半角カナ.
    for (char16_t i = 0xff10; i < 0xff9f; ++i)
    {
        if (m_font_loader->CanRenderCharactor(i))
        {
            add.append(i);
        }
    }
    m_ui->create_text->appendPlainText(add);
}

/**
 *  @breif      漢字ボタンクリック.
 */
void FontCreatorWidget::OnClickKanji()
{
    QString add = "";
    for (char16_t i = 0x4e00; i < 0x9fcc; ++i)
    {
        if (m_font_loader->CanRenderCharactor(i))
        {
            add.append(i);
        }
    }
    m_ui->create_text->appendPlainText(add);
}

/**
 *  @breif      スケール変更.
 *  @param  in  value 値.
 */
void FontCreatorWidget::OnScaleChenged(int value)
{
    QString text;
    text.setNum(value);
    text += "%";
    m_ui->scale_label->setText(text);

    UpdateScale();
    update();
}

/**
 *  @breif      境界チェック変更.
 *  @param  in  checkd チェック値.
 */
void FontCreatorWidget::OnChangeBoundEnable(bool /*checkd*/)
{
    update();
}

/**
 *  @breif      スケール更新.
 */
void FontCreatorWidget::UpdateScale()
{
    float scale = m_ui->scale_slider->value() / 100.0f;
    int width = TEXTURE_MARGIN + TEXTURE_MARGIN + m_texture_width;
    int height = TEXTURE_MARGIN + (m_texture_height + TEXTURE_MARGIN) * static_cast<int>(m_texture_list.size());

    m_view_area->setFixedSize(QSize(width * scale, height * scale));
}

/**
 *  @breif      イベントフィルタ.
 *  @param  in  object オブジェクト.
 *  @param  in  event イベント.
 *  @return trueで処理した falseで何もしなかった.
 */
bool FontCreatorWidget::eventFilter(QObject *object, QEvent *event)
{
    if (event->type() == QEvent::MouseButtonRelease)
    {
        if (object == m_ui->font_color)
        {
            OnClickFontColor();
            return true;
        }
        else if (object == m_ui->outline_color)
        {
            OnClickOutlineColor();
            return true;
        }
        else if (object == m_ui->bg_color)
        {
            OnClickBGColor();
            return true;
        }
    }

    if(object == m_view_area && event->type() == QEvent::Paint )
    {
        viewPaintEvent();
        return true;
    }

    return false;
}

/**
 *  @breif      フォントカラー変更.
 */
void FontCreatorWidget::OnClickFontColor()
{
    QColor temp = m_font_color;
    temp = QColorDialog::getColor(temp,
                                  this,
                                  "select Font Color",
                                  QColorDialog::DontUseNativeDialog);
    if (temp.isValid())
    {
        m_font_color = temp;
        QString style = "QWidget {background-color: " + m_font_color.name() + ";}";
        m_ui->font_color->setStyleSheet(style);

        ClearImage();
    }
}

/**
 *  @breif      輪郭線カラー変更.
 */
void FontCreatorWidget::OnClickOutlineColor()
{
    QColor temp = m_outline_color;
    temp = QColorDialog::getColor(temp,
                                  this,
                                  "select Outline Color",
                                  QColorDialog::DontUseNativeDialog);
    if (temp.isValid())
    {
        m_outline_color = temp;
        QString style = "QWidget {background-color: " + m_outline_color.name() + ";}";
        m_ui->outline_color->setStyleSheet(style);

        ClearImage();
    }
}

/**
 *  @breif      BGカラー変更.
 */
void FontCreatorWidget::OnClickBGColor()
{
    QColor temp = m_bg_color;
    temp = QColorDialog::getColor(temp,
                                  this,
                                  "select BG Color",
                                  QColorDialog::DontUseNativeDialog);
    if (temp.isValid())
    {
        m_bg_color = temp;
        QString style = "QWidget {background-color: " + m_bg_color.name() + ";}";
        m_ui->bg_color->setStyleSheet(style);

        ClearImage();
    }
}


text:
name: Question
about: I have a question
title: "(Put question subject here)"
labels: question
assignees: ''

---

If you have a specific question, for example on installation guidance or Plugin development, you can pose this below. It is probably easier/quicker to pose your question on the GeoHealthCheck Gitter Channel: https://gitter.im/geopython/GeoHealthCheck, an interactive chat-channel where GHC developers and users gather.


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package medrun;

import java.awt.Font;
import java.awt.FontFormatException;
import java.io.File;
import java.io.IOException;
import java.util.LinkedList;
import org.newdawn.slick.Color;
import org.newdawn.slick.Image;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.TrueTypeFont;

/**
 * The GUI object renders text showing the user how far he/she has reached in
 * the game. It also shows a number representing how many points the user has
 * achieved in the current run.
 *
 * @author Tom Axblad
 */
public class Gui implements Renderable {

    final int xMargin = 50;
    final int yMargin = 20;
    final int fontSize = 40;
    final int scoreWidth = 500;

    float x;
    float y;
    float score;
    float length;
    boolean gameOver;
    int width;
    int height;
    Font font;
    TrueTypeFont trueType;
    Image gameOverImg;

    public Gui() throws SlickException {
        gameOverImg = new Image("data/sprites/gameOver.png");
        gameOverImg.setFilter(Image.FILTER_NEAREST);
        width = Medrun.width;
        height = Medrun.height;
        score = 0;
        length = 0;
        gameOver = false;
        try {
            font = java.awt.Font.createFont(java.awt.Font.TRUETYPE_FONT, new File("data/fonts/retro.ttf"));
            font = font.deriveFont((float) fontSize);
            trueType = new TrueTypeFont(font, false);
        } catch (FontFormatException | IOException e) {
            System.out.println("Error in GUI.java on line 40");
        }
    }

    public Gui(boolean test){
        width = Medrun.width;
        height = Medrun.height;
        score = 0;
        length = 0;
        gameOver = false;
    }

    /**
     * The update function for the GUI object. this function sets the run
     * distance and the score achieved accordingly to the players position and
     * actions.
     *
     * @param distance a float variable representing the distance the player has
     * reached in the x-axis.
     */
    public void update(float distance) {
        x = GameState.translatedX;
        y = GameState.translatedY;
        score += (distance / 10)*Medrun.difficulty;
        length += distance / (Block.TILEWIDTH * 2);
        if(!gameOver && GameState.player.dead && GameState.dTranslatedX == 0 && GameState.dTranslatedY == 0){
            gameOver = true;
        }
    }

    /**
     * The render function for the GUI object. Renders the GUI object on the
     * screen depending on the current screen transformation and the x and y
     * margin.
     */
    @Override
    public void render() {
        if(!gameOver){
            trueType.drawString(x + width - scoreWidth - xMargin, y + yMargin, "Score   " + scoreNumber(), Color.white);
            trueType.drawString(x + xMargin, y + yMargin, "Distance   " + length(), Color.white);
        } else{
            Medrun.renderScaledCenter(gameOverImg, (int)x + Medrun.width / 2 , (int)y + Medrun.height/2 - 200, 3);
            Medrun.renderCenterdText(trueType, "Score   " + scoreNumber(), (int)x + Medrun.width/3, (int)y + (Medrun.height/2) + 100, Color.white);
            Medrun.renderCenterdText(trueType, "Distance   " + length(), (int)x + 2 * Medrun.width/3, (int)y + (Medrun.height/2) + 100, Color.white);
            Medrun.renderCenterdText(trueType, "ESC - Main Menu", (int)x + Medrun.width/3, (int)y + (Medrun.height/2) + 300, Color.white);
            Medrun.renderCenterdText(trueType, "R - Restart", (int)x + 2 * Medrun.width/3, (int)y + (Medrun.height/2) + 300, Color.white);
        }
    }

    /**
     * Returns the current score for the player.
     * @return a string representing the current score.
     */
    public String scoreNumber() {
        int rounded = (int) (score + 0.5);
        int zeroes = 8 - String.valueOf(rounded).length();
        LinkedList list = new LinkedList();
        for (int i = 0; i < zeroes; i++) {
            list.add("0");
        }
        list.add(String.valueOf(rounded));
        return String.join("", list);
    }

    /**
     * Returns the current length in meters (roughly measured) achieved in the current run by the player.
     * @return a string representing the distance in meters.
     */
    public String length() {
        return String.valueOf((int) length) + " m";
    }
}


text:
exports.iframeResizer = require('./iframeResizer');
exports.iframeResizerContentWindow = require('./iframeResizer.contentWindow');


text:
package org.conqat.engine.dotnet.resource.parser;

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

import org.conqat.engine.core.core.ConQATException;
import org.conqat.engine.core.logging.IConQATLogger;
import org.conqat.engine.resource.text.ITextElement;
import org.conqat.engine.resource.text.TextElementUtils;
import org.conqat.lib.commons.assertion.CCSMAssert;
import org.conqat.lib.commons.string.StringUtils;

/**
 * Version of solution and project file formats
 *
 * @author $Author: heinemann $
 * @version $Rev: 45826 $
 * @ConQAT.Rating GREEN Hash: F16E58511C49467EE680ADA5D03509C5
 */
public enum ESolutionFormatVersion {

	/** VS.NET 2003 format */
	VERSION_8,

	/** VS.NET 2005, 2008, 2010, 2012 format */
	VERSION_9;

	/** String that identifies VS.NET 2012 solution */
	private static final String SOLUTION_HEADER_12 = defaultSolutionHeader("12.00");

	/** String that identifies VS.NET 2010 solution */
	private static final String SOLUTION_HEADER_11 = defaultSolutionHeader("11.00");

	/** String that identifies VS.NET 2008 solution */
	private static final String SOLUTION_HEADER_10 = defaultSolutionHeader("10.00");

	/** String that identifies VS.NET 2005 solution */
	private static final String SOLUTION_HEADER_9 = defaultSolutionHeader("9.00");

	/** String that identifies VS.NET 2003 solution */
	private static final String SOLUTION_HEADER_8 = defaultSolutionHeader("8.00");

	/**
	 * Returns the default header of solution files for the specified version
	 * string, e.g. '12.00'.
	 */
	private static String defaultSolutionHeader(String version) {
		return "Microsoft Visual Studio Solution File, Format Version "
				+ version;
	}

	/**
	 * Regular expression used to extract format version number from projects.
	 * Product version is either in the form 'ProductVersion = "7.10.3077"' or
	 * in form '<ProductVersion>8.0.5027</ProductVersion>' (with varying
	 * numbers). This pattern matches both forms. The numbers are matched by
	 * capturing group with index 1.
	 */
	private static final Pattern PRODUCT_VERSION_PATTERN = Pattern
			.compile("<?ProductVersion>?\\s*=?\\s*\"?(\\d+)\\.\\d+\\.\\d+\"?");

	/**
	 * VS.NET 2010 and up files appear to not always have the above patterns.
	 * Instead, we search for the tool version.
	 */
	private static final Pattern TOOLS_VERSION_PATTERN = Pattern
			.compile("<Project[^>]*ToolsVersion=\"(\\d+).\\d+\"");

	/** Determine format for a project element. */
	public static ESolutionFormatVersion determineProjectFormat(
			ITextElement projectElement) throws ConQATException {
		String projectContent = projectElement.getTextContent();
		Matcher productVersionMatcher = PRODUCT_VERSION_PATTERN
				.matcher(projectContent);
		Matcher toolsVersionMatcher = TOOLS_VERSION_PATTERN
				.matcher(projectContent);

		if (productVersionMatcher.find()) {
			String majorVersionString = productVersionMatcher.group(1);
			int major = Integer.parseInt(majorVersionString);

			// unfortunately, the project file format numbers and the VS version
			// numbers are not the same. Thus we need to map individually.
			switch (major) {
			case 7:
				return ESolutionFormatVersion.VERSION_8;
			case 8:
				// fall through to case 9
			case 9:
				return ESolutionFormatVersion.VERSION_9;
			default:
				throwUnknownFormatException(projectElement);
			}
		}

		if (toolsVersionMatcher.find()) {
			String toolVersionString = toolsVersionMatcher.group(1);
			int major = Integer.parseInt(toolVersionString);
			if (major == 4 || major == 3) {
				return ESolutionFormatVersion.VERSION_9;
			}

			throwUnknownFormatException(projectElement);
		}

		// our format assumption is violated since both matchers fail
		throw new ConQATException(
				"Unable to determine format version for project file: "
						+ projectElement.getLocation());
	}

	/** Creates and throws an exception that shows that format is unknown. */
	private static ConQATException throwUnknownFormatException(
			ITextElement projectElement) throws ConQATException {
		throw new ConQATException("Project Element "
				+ projectElement.getLocation() + " has unknown format");
	}

	/**
	 * Asserts that the solution format is known.
	 *
	 * @throws ConQATException
	 *             If the solution format is not known.
	 */
	public static void checkValidSolutionFormat(ITextElement solutionElement)
			throws ConQATException {

		String[] lines = TextElementUtils.getLines(solutionElement);

		CCSMAssert.isTrue(lines.length >= 2,
				"Solution file shorter than expected");

		if (!ESolutionFormatVersion.startsWithAnyOf(lines, SOLUTION_HEADER_8,
				SOLUTION_HEADER_9, SOLUTION_HEADER_10, SOLUTION_HEADER_11,
				SOLUTION_HEADER_12)) {
			throw new ConQATException("Format of solution "
					+ solutionElement.getLocation() + " unknown");
		}
	}

	/**
	 * Returns true, if the first or the second line in an array starts with any
	 * of the given strings
	 */
	private static boolean startsWithAnyOf(String[] lines, String... prefixes) {
		return StringUtils.startsWithOneOf(lines[0], prefixes)
				|| StringUtils.startsWithOneOf(lines[1], prefixes);
	}

	/**
	 * Factory method that creates a {@link ProjectParser} according to the
	 * solution version.
	 */
	public ProjectParser createProjectParser(IConQATLogger logger) {
		switch (this) {
		case VERSION_9:
			return new ProjectParser9(logger);
		case VERSION_8:
			return new ProjectParser8(logger);
		default:
			CCSMAssert.fail("No reader for this project format implemented!");
			return null;
		}
	}

}


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

namespace Hue.API.Hue
{
    public partial class HueAPI
    {
        public EventHandler GetBridgeConfigurationsFailed;
        public EventHandler GetBridgeConfigurationsComplete;
    }
}


text:
class UielementsController < ApplicationController
  def typography
  end

  def icons
  end

  def draggable_panels
  end

  def resizeable_panels
  end

  def buttons
  end

  def tables_panels
  end

  def tabs
  end

  def helper_classes
  end

  def notifications_tooltips
  end

  def badges_labels_progress
  end

  def video
  end

end


text:
<title>MN10300 Options - Using the GNU Compiler Collection (GCC)</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Using the GNU Compiler Collection (GCC)">
<meta name="generator" content="makeinfo 4.8">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Submodel-Options.html#Submodel-Options" title="Submodel Options">
<link rel="prev" href="MMIX-Options.html#MMIX-Options" title="MMIX Options">
<link rel="next" href="Moxie-Options.html#Moxie-Options" title="Moxie Options">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">

<meta http-equiv="Content-Style-Type" content="text/css">

Next: Moxie Options,
Previous: MMIX Options,
Up: Submodel Options

3.17.29 MN10300 Options

These <samp>-m</samp> options are defined for Matsushita MN10300 architectures:

-mmult-bug
Generate code to avoid bugs in the multiply instructions for the MN10300
processors.  This is the default.

-mno-mult-bug
Do not generate code to avoid bugs in the multiply instructions for the
MN10300 processors.

-mam33
Generate code using features specific to the AM33 processor.

-mno-am33
Do not generate code using features specific to the AM33 processor.  This
is the default.

-mam33-2
Generate code using features specific to the AM33/2.0 processor.

-mam34
Generate code using features specific to the AM34 processor.

-mtune=<var>cpu-type</var>
Use the timing characteristics of the indicated CPU type when
scheduling instructions.  This does not change the targeted processor
type.  The CPU type must be one of `<samp><span class="samp">mn10300</span></samp>', `<samp>am33</samp>',
`<samp><span class="samp">am33-2</span></samp>' or `<samp>am34</samp>'.

-mreturn-pointer-on-d0
When generating a function that returns a pointer, return the pointer
in both a0 and d0.  Otherwise, the pointer is returned
only in a0, and attempts to call such functions without a prototype
result in errors.  Note that this option is on by default; use
<samp>-mno-return-pointer-on-d0</samp> to disable it.

-mno-crt0
Do not link in the C run-time initialization object file.

-mrelax
Indicate to the linker that it should perform a relaxation optimization pass
to shorten branches, calls and absolute memory addresses.  This option only
has an effect when used on the command line for the final link step.

This option makes symbolic debugging impossible.

-mliw
Allow the compiler to generate Long Instruction Word
instructions if the target is the `<samp>AM33</samp>' or later.  This is the
default.  This option defines the preprocessor macro `<samp>__LIW__</samp>'.

-mnoliw
Do not allow the compiler to generate Long Instruction Word
instructions.  This option defines the preprocessor macro
`<samp>__NO_LIW__</samp>'.

-msetlb
Allow the compiler to generate the SETLB and Lcc
instructions if the target is the `<samp>AM33</samp>' or later.  This is the
default.  This option defines the preprocessor macro `<samp>__SETLB__</samp>'.

-mnosetlb
Do not allow the compiler to generate SETLB or Lcc
instructions.  This option defines the preprocessor macro
`<samp>__NO_SETLB__</samp>'.


text:
'use strict';

const countries = require('homeoffice-countries').allCountries;

const pick = set => set[Math.floor(Math.random() * set.length)];

const Data = {};

[
  'firstname',
  'lastname',
  'streetname',
  'streetsuffix',
  'town',
  'postcode',
  'domain'
].forEach(key => {
  const values = require(`./data/${key}`);
  Object.defineProperty(Data, key, {
    get: () => pick(values)
  });
});

Object.defineProperty(Data, 'name', {
  get: function () {
    return `${Data.firstname} ${Data.lastname}`;
  }
});

Object.defineProperty(Data, 'address', {
  get: function () {
    return `${Data.number(1, 100)} ${Data.streetname} ${Data.streetsuffix}, ${Data.town}, ${Data.postcode}`;
  }
});

Object.defineProperty(Data, 'email', {
  get: function () {
    return `${Data.firstname.toLowerCase()}.${Data.lastname.toLowerCase()}@${Data.domain}`;
  }
});

Object.defineProperty(Data, 'phone', {
  get: function () {
    const prefix = pick(['01', '07', '+44(0)7', '+44(0)1']);
    return `${prefix}${Data.number(100, 999)} ${Data.number(100, 999)} ${Data.number(100, 999)}`;
  }
});

Object.defineProperty(Data, 'country', {
  get: () => pick(countries)
});

Data.number = (mn, mx) => {
  let min = mn;
  let max = mx;

  if (min && max === undefined) {
    max = min;
    min = 0;
  }
  if (max === undefined) {
    max = 100;
  }
  return min + Math.floor(Math.random() * (max - min));
};

module.exports = Data;


text:
#include <winsock2.h>

#include "qhostinfo_p.h"
#include "private/qnativesocketengine_p.h"
#include <ws2tcpip.h>
#include <private/qsystemlibrary_p.h>
#include <qmutex.h>
#include <qbasicatomic.h>
#include <qurl.h>
#include <private/qmutexpool_p.h>

QT_BEGIN_NAMESPACE

//#define QHOSTINFO_DEBUG

// Older SDKs do not include the addrinfo struct declaration, so we
// include a copy of it here.
struct qt_addrinfo
{
    int ai_flags;
    int ai_family;
    int ai_socktype;
    int ai_protocol;
    size_t ai_addrlen;
    char *ai_canonname;
    sockaddr *ai_addr;
    qt_addrinfo *ai_next;
};

//###
#define QT_SOCKLEN_T int
#ifndef NI_MAXHOST // already defined to 1025 in ws2tcpip.h?
#define NI_MAXHOST 1024
#endif

typedef int (__stdcall *getnameinfoProto)(const sockaddr *, QT_SOCKLEN_T, const char *, DWORD, const char *, DWORD, int);
typedef int (__stdcall *getaddrinfoProto)(const char *, const char *, const qt_addrinfo *, qt_addrinfo **);
typedef int (__stdcall *freeaddrinfoProto)(qt_addrinfo *);
static getnameinfoProto local_getnameinfo = 0;
static getaddrinfoProto local_getaddrinfo = 0;
static freeaddrinfoProto local_freeaddrinfo = 0;

static void resolveLibrary()
{
    // Attempt to resolve getaddrinfo(); without it we'll have to fall
    // back to gethostbyname(), which has no IPv6 support.
#if !defined(Q_OS_WINCE)
    local_getaddrinfo = (getaddrinfoProto) QSystemLibrary::resolve(QLatin1String("ws2_32"), "getaddrinfo");
    local_freeaddrinfo = (freeaddrinfoProto) QSystemLibrary::resolve(QLatin1String("ws2_32"), "freeaddrinfo");
    local_getnameinfo = (getnameinfoProto) QSystemLibrary::resolve(QLatin1String("ws2_32"), "getnameinfo");
#else
    local_getaddrinfo = (getaddrinfoProto) QSystemLibrary::resolve(QLatin1String("ws2"), "getaddrinfo");
    local_freeaddrinfo = (freeaddrinfoProto) QSystemLibrary::resolve(QLatin1String("ws2"), "freeaddrinfo");
    local_getnameinfo = (getnameinfoProto) QSystemLibrary::resolve(QLatin1String("ws2"), "getnameinfo");
#endif
}

static void translateWSAError(int error, QHostInfo *results)
{
    switch (error) {
    case WSAHOST_NOT_FOUND: //authoritative not found
    case WSATRY_AGAIN: //non authoritative not found
    case WSANO_DATA: //valid name, no associated address
        results->setError(QHostInfo::HostNotFound);
        results->setErrorString(QHostInfoAgent::tr("Host not found"));
        return;
    default:
        results->setError(QHostInfo::UnknownError);
        results->setErrorString(QHostInfoAgent::tr("Unknown error (%1)").arg(error));
        return;
    }
}

QHostInfo QHostInfoAgent::fromName(const QString &hostName)
{
#if defined(Q_OS_WINCE)
    static QBasicMutex qPrivCEMutex;
    QMutexLocker locker(&qPrivCEMutex);
#endif

    QWindowsSockInit winSock;

    // Load res_init on demand.
    static QBasicAtomicInt triedResolve = Q_BASIC_ATOMIC_INITIALIZER(false);
    if (!triedResolve.loadAcquire()) {
        QMutexLocker locker(QMutexPool::globalInstanceGet(&local_getaddrinfo));
        if (!triedResolve.load()) {
            resolveLibrary();
            triedResolve.storeRelease(true);
        }
    }

    QHostInfo results;

#if defined(QHOSTINFO_DEBUG)
    qDebug("QHostInfoAgent::fromName(): looking up \"%s\" (IPv6 support is %s)",
           hostName.toLatin1().constData(),
           (local_getaddrinfo && local_freeaddrinfo) ? "enabled" : "disabled");
#endif

    QHostAddress address;
    if (address.setAddress(hostName)) {
        // Reverse lookup
        if (local_getnameinfo) {
            sockaddr_in sa4;
            qt_sockaddr_in6 sa6;
            sockaddr *sa;
            QT_SOCKLEN_T saSize;
            if (address.protocol() == QAbstractSocket::IPv4Protocol) {
                sa = (sockaddr *)&sa4;
                saSize = sizeof(sa4);
                memset(&sa4, 0, sizeof(sa4));
                sa4.sin_family = AF_INET;
                sa4.sin_addr.s_addr = htonl(address.toIPv4Address());
            } else {
                sa = (sockaddr *)&sa6;
                saSize = sizeof(sa6);
                memset(&sa6, 0, sizeof(sa6));
                sa6.sin6_family = AF_INET6;
                memcpy(sa6.sin6_addr.qt_s6_addr, address.toIPv6Address().c, sizeof(sa6.sin6_addr.qt_s6_addr));
            }

            char hbuf[NI_MAXHOST];
            if (local_getnameinfo(sa, saSize, hbuf, sizeof(hbuf), 0, 0, 0) == 0)
                results.setHostName(QString::fromLatin1(hbuf));
        } else {
            unsigned long addr = inet_addr(hostName.toLatin1().constData());
            struct hostent *ent = gethostbyaddr((const char*)&addr, sizeof(addr), AF_INET);
            if (ent)
                results.setHostName(QString::fromLatin1(ent->h_name));
        }

        if (results.hostName().isEmpty())
            results.setHostName(address.toString());
        results.setAddresses(QList<QHostAddress>() << address);
        return results;
    }

    // IDN support
    QByteArray aceHostname = QUrl::toAce(hostName);
    results.setHostName(hostName);
    if (aceHostname.isEmpty()) {
        results.setError(QHostInfo::HostNotFound);
        results.setErrorString(hostName.isEmpty() ? tr("No host name given") : tr("Invalid hostname"));
        return results;
    }

    if (local_getaddrinfo && local_freeaddrinfo) {
        // Call getaddrinfo, and place all IPv4 addresses at the start
        // and the IPv6 addresses at the end of the address list in
        // results.
        qt_addrinfo *res;
        int err = local_getaddrinfo(aceHostname.constData(), 0, 0, &res);
        if (err == 0) {
            QList<QHostAddress> addresses;
            for (qt_addrinfo *p = res; p != 0; p = p->ai_next) {
                switch (p->ai_family) {
                case AF_INET: {
                    QHostAddress addr;
                    addr.setAddress(ntohl(((sockaddr_in *) p->ai_addr)->sin_addr.s_addr));
                    if (!addresses.contains(addr))
                        addresses.append(addr);
                }
                    break;
                case AF_INET6: {
                    QHostAddress addr;
                    addr.setAddress(((qt_sockaddr_in6 *) p->ai_addr)->sin6_addr.qt_s6_addr);
                    if (!addresses.contains(addr))
                        addresses.append(addr);
                }
                    break;
                default:
                    results.setError(QHostInfo::UnknownError);
                    results.setErrorString(tr("Unknown address type"));
                }
            }
            results.setAddresses(addresses);
            local_freeaddrinfo(res);
        } else {
            translateWSAError(WSAGetLastError(), &results);
        }
    } else {
        // Fall back to gethostbyname, which only supports IPv4.
        hostent *ent = gethostbyname(aceHostname.constData());
        if (ent) {
            char **p;
            QList<QHostAddress> addresses;
            switch (ent->h_addrtype) {
            case AF_INET:
                for (p = ent->h_addr_list; *p != 0; p++) {
                    long *ip4Addr = (long *) *p;
                    QHostAddress temp;
                    temp.setAddress(ntohl(*ip4Addr));
                    addresses << temp;
                }
                break;
            default:
                results.setError(QHostInfo::UnknownError);
                results.setErrorString(tr("Unknown address type"));
                break;
            }
            results.setAddresses(addresses);
        } else {
            translateWSAError(WSAGetLastError(), &results);
        }
    }

#if defined(QHOSTINFO_DEBUG)
    if (results.error() != QHostInfo::NoError) {
        qDebug("QHostInfoAgent::run(): error (%s)",
               results.errorString().toLatin1().constData());
    } else {
        QString tmp;
        QList<QHostAddress> addresses = results.addresses();
        for (int i = 0; i < addresses.count(); ++i) {
            if (i != 0) tmp += ", ";
            tmp += addresses.at(i).toString();
        }
        qDebug("QHostInfoAgent::run(): found %i entries: {%s}",
               addresses.count(), tmp.toLatin1().constData());
    }
#endif
    return results;
}

QString QHostInfo::localHostName()
{
    QWindowsSockInit winSock;

    char hostName[512];
    if (gethostname(hostName, sizeof(hostName)) == -1)
        return QString();
    hostName[sizeof(hostName) - 1] = '\0';
    return QString::fromLocal8Bit(hostName);
}

// QString QHostInfo::localDomainName() defined in qnetworkinterface_win.cpp

QT_END_NAMESPACE


text:
The circle of life
Begins in waters
Raining down
Spilling out
We splash alive
Finding our step
Begin our walk on Her

Her waters run in our veins
Her rivers and lakes
Flow to the seas
She fills our cavities
Cushions our babies
And comes back again
Into the skies
Connecting to Great Mystery
Filters into clouds
Collecting in billows
She rains down
Gathering in puddles
Filling creeks
Spilling down deep
Seeping through to feathered longs
That pull up high
Against gravity
To tops of trees
And branching out

She fills our eyes
In tears
That grow our hearts
In moments of cries
And as we birth
She flows
And we grow

And on the other side
The spirit of Crow knows
The relations of the sky
The spirit world
Where the ones
Ready to be born
Wait to be part of the storm
Grown in pain
And the tears that rain
Parts of water that hasten a day
And after our time is spent
Here
On our Mother
Our waters are the first to return
Before our bones can reply
And our spirits return to the sky

LauraLee K. Harris