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

<title>类 org.kymjs.kjframe.bitmap.BitmapConfig的使用</title>
<meta name="date" content="2014-12-17">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

您的浏览器已禁用 JavaScript。

跳过导航链接

概览

程序包

类

使用

树

已过时

索引

帮助

上一个

下一个

框架

无框架

所有类

类的使用
org.kymjs.kjframe.bitmap.BitmapConfig

使用BitmapConfig的程序包

程序包
说明

org.kymjs.kjframe

org.kymjs.kjframe.bitmap

org.kymjs.kjframe中BitmapConfig的使用

参数类型为BitmapConfig的org.kymjs.kjframe中的方法

限定符和类型
方法和说明

static KJBitmap
KJBitmap.create(BitmapConfig bitmapConfig)

使用配置器创建KJBitmap

org.kymjs.kjframe.bitmap中BitmapConfig的使用

参数类型为BitmapConfig的org.kymjs.kjframe.bitmap中的构造器

构造器和说明

BitmapDownloader(BitmapConfig config,
                int reqW,
                int reqH)

跳过导航链接

概览

程序包

类

使用

树

已过时

索引

帮助

上一个

下一个

框架

无框架

所有类


text:
#import <UIKit/UIKit.h>

@class PacoExperimentDefinition;

@interface PacoExperimentDetailsViewController : UIViewController

+(PacoExperimentDetailsViewController*)controllerWithExperiment:(PacoExperimentDefinition *)experiment;

@end

redpajama_set_name: RedPajamaGithub


text:
const React = require('react');

const CompLibrary = require('../../core/CompLibrary');

const Container = CompLibrary.Container;

const CWD = process.cwd();

const siteConfig = require(process.cwd() + '/siteConfig.js');
try {
  var versions = require(`${CWD}/versions.json`);
} catch (e) {
  var versions = [];
}

function Versions() {
  const latestVersion = versions[0] || '';
  const language = '';
  const repoUrl = `https://github.com/${siteConfig.organizationName}/${
    siteConfig.projectName
  }`;
  return (

      <Container className="mainContainer versionsContainer">

{siteConfig.title} Versions

Current version

                {latestVersion}

                  <a
                    href={`${siteConfig.baseUrl}docs/intro`}>
                    Documentation

                  <a href={`${repoUrl}/releases/tag/v${latestVersion}`}>
                    Release Notes

Latest Version

          Here you can find the latest documentation and unreleased code.

                master

                  <a
                    href={`${siteConfig.baseUrl}docs/next/intro`}>
                    Documentation

                  Source Code

Past Versions

            Here you can find documentation for previous versions.

              {versions.map(
                version =>
                  version !== latestVersion && (

                      {version}

                        <a
                          href={`${siteConfig.baseUrl}docs/${version}/intro`}>
                          Documentation

                        <a href={`${repoUrl}/releases/tag/v${version}`}>
                          Release Notes

                  ),
              )}

            You can find past versions of this project on{' '}
            <a href={`${repoUrl}/releases`}>GitHub.

      </Container>

  );
}

Versions.title = 'Versions';

module.exports = Versions;


text:
using Newtonsoft.Json;
using System;
using System.Collections.Generic;

namespace VkApi.Wrapper.Objects
{
    public class LeadsComplete
    {
        ///
        /// Offer cost
        ///
        [JsonProperty("cost")]
        public int Cost { get; set; }

        ///
        /// Offer limit
        ///
        [JsonProperty("limit")]
        public int Limit { get; set; }

        ///
        /// Amount of spent votes
        ///
        [JsonProperty("spent")]
        public int Spent { get; set; }
        [JsonProperty("success")]
        public BaseOkResponse Success { get; set; }

        ///
        /// Information whether test mode is enabled
        ///
        [JsonProperty("test_mode")]
        public int TestMode { get; set; }
    }
}


text:
<?php
namespace php_active_record;

class test_archive_ingest_reharvest extends SimpletestUnitBase
{
    function setUp()
    {
        parent::setUp();
        recursive_rmdir_contents(DOC_ROOT . "vendor/eol_content_schema_v2/extension_cache/");
        $this->archive_directory = CONTENT_RESOURCE_LOCAL_PATH . "/1/";
        if(!file_exists($this->archive_directory)) mkdir($this->archive_directory);
        $this->resource = self::create_resource();
        $this->prepare_data();
    }

    function tearDown()
    {
        // delete the contents of the created archive
        $files_in_archive = read_dir($this->archive_directory);
        foreach($files_in_archive as $file)
        {
            if(substr($file, 0, 1) == '.') continue;
            unlink($this->archive_directory . $file);
        }
        rmdir($this->archive_directory);
        unset($this->archive_builder);
        parent::tearDown();
    }

    function testReharvestTaxonReferences()
    {
        // no need to have media for this test
        $this->media = array();
        $this->taxa[0]->referenceID = "11";
        $this->taxa[1]->referenceID = "11";
        $this->build_resource();
        self::harvest($this->resource);
        $entry = HierarchyEntry::find_by_identifier($this->taxa[0]->taxonID);
        $refs = $entry->published_references();
        $this->assertEqual(count($refs), 1);
        $this->assertEqual($refs[0]->provider_mangaed_id, 11);
        $original_entry_id = $entry->id;

        $this->taxa[0]->referenceID = "11;22";
        $this->taxa[1]->referenceID = "";
        $this->build_resource();
        self::harvest($this->resource);
        $entry = HierarchyEntry::find_by_identifier($this->taxa[0]->taxonID);
        $refs = $entry->published_references();
        $this->assertEqual(count($refs), 2);
        $this->assertEqual($refs[0]->provider_mangaed_id, 11);
        $this->assertEqual($refs[1]->provider_mangaed_id, 22);
        $this->assertEqual($entry->id, $original_entry_id);

        $this->taxa[0]->referenceID = "33";
        $this->build_resource();
        self::harvest($this->resource);
        $entry = HierarchyEntry::find_by_identifier($this->taxa[0]->taxonID);
        $refs = $entry->published_references();
        $this->assertEqual(count($refs), 1);
        $this->assertEqual($refs[0]->provider_mangaed_id, 33);
        $this->assertEqual($entry->id, $original_entry_id);
    }

    function testReharvestTaxonVernacularNames()
    {
        // no need to have media for this test
        $this->media = array();
        $this->build_resource();
        self::harvest($this->resource);
        $entry = HierarchyEntry::find_by_identifier($this->taxa[0]->taxonID);
        $this->assertEqual(count($entry->synonyms), 2);
        $this->assertEqual($entry->synonyms[0]->name->string, $this->vernacular_names[0]->vernacularName);
        $this->assertEqual($entry->synonyms[1]->name->string, $this->vernacular_names[1]->vernacularName);
        $original_entry_id = $entry->id;

        $vernacular = new \eol_schema\VernacularName();
        $vernacular->taxonID = $this->taxa[0]->taxonID;
        $vernacular->vernacularName = "New Common Name";
        $vernacular->language = "en";
        $this->vernacular_names[] = $vernacular;
        $this->build_resource();
        self::harvest($this->resource);
        $entry = HierarchyEntry::find_by_identifier($this->taxa[0]->taxonID);
        $this->assertEqual(count($entry->synonyms), 3);
        $this->assertEqual($entry->synonyms[0]->name->string, $this->vernacular_names[0]->vernacularName);
        $this->assertEqual($entry->synonyms[1]->name->string, $this->vernacular_names[1]->vernacularName);
        $this->assertEqual($entry->synonyms[2]->name->string, $vernacular->vernacularName);
        $this->assertEqual($entry->id, $original_entry_id);

        unset($this->vernacular_names[0]);
        unset($this->vernacular_names[1]);
        $this->build_resource();
        self::harvest($this->resource);
        $entry = HierarchyEntry::find_by_identifier($this->taxa[0]->taxonID);
        $this->assertEqual(count($entry->synonyms), 1);
        $this->assertEqual($entry->synonyms[0]->name->string, $vernacular->vernacularName);
        $this->assertEqual($entry->id, $original_entry_id);

        $this->vernacular_names = array();
        $this->build_resource();
        self::harvest($this->resource);
        $entry = HierarchyEntry::find_by_identifier($this->taxa[0]->taxonID);
        $this->assertEqual(count($entry->synonyms), 0);
    }

    function testReharvestDataObjectReferences()
    {
        // no need to have anything more than the first text object for this test
        $this->media = array($this->media[0]);
        $this->media[0]->referenceID = "11";
        $this->build_resource();
        self::harvest($this->resource);
        $object = DataObject::find_by_identifier($this->media[0]->identifier);
        $refs = $object->published_references();
        $this->assertEqual(count($refs), 1);
        $this->assertEqual($refs[0]->provider_mangaed_id, 11);
        $original_object_id = $object->id;

        $this->media[0]->referenceID = "11;22";
        $this->build_resource();
        self::harvest($this->resource);
        $object = DataObject::find_by_identifier($this->media[0]->identifier);
        $refs = $object->published_references();
        $this->assertEqual(count($refs), 2);
        $this->assertEqual($refs[0]->provider_mangaed_id, 11);
        $this->assertEqual($refs[1]->provider_mangaed_id, 22);
        $this->assertEqual($object->id, $original_object_id);

        $this->media[0]->referenceID = "33";
        $this->build_resource();
        self::harvest($this->resource);
        $object = DataObject::find_by_identifier($this->media[0]->identifier);
        $refs = $object->published_references();
        $this->assertEqual(count($refs), 1);
        $this->assertEqual($refs[0]->provider_mangaed_id, 33);
        $this->assertEqual($object->id, $original_object_id);
    }

    function testReharvestDataObjectAgents()
    {
        // no need to have anything more than the first text object for this test
        $this->media = array($this->media[0]);
        $this->media[0]->agentID = "";
        $this->media[0]->creator = "first creator; second creator";
        $this->media[0]->contributor = "";
        $this->media[0]->publisher = "";
        $this->build_resource();
        self::harvest($this->resource);
        $object = DataObject::find_by_identifier($this->media[0]->identifier);
        $ado = $object->agents_data_objects;
        $this->assertEqual(count($ado), 2);
        $this->assertEqual($ado[0]->agent->full_name, 'first creator');
        $this->assertEqual($ado[1]->agent->full_name, 'second creator');
        $original_object_id = $object->id;

        $this->media[0]->creator = "third creator; first creator; second creator";
        $this->build_resource();
        self::harvest($this->resource);
        $object = DataObject::find_by_identifier($this->media[0]->identifier);
        $ado = $object->agents_data_objects;
        $this->assertEqual(count($ado), 3);
        $this->assertEqual($ado[0]->agent->full_name, 'first creator');
        $this->assertEqual($ado[1]->agent->full_name, 'second creator');
        $this->assertEqual($ado[2]->agent->full_name, 'third creator');
        $this->assertEqual($object->id, $original_object_id);

        $this->media[0]->creator = "new creator";
        $this->build_resource();
        self::harvest($this->resource);
        $object = DataObject::find_by_identifier($this->media[0]->identifier);
        $ado = $object->agents_data_objects;
        $this->assertEqual(count($ado), 1);
        $this->assertEqual($ado[0]->agent->full_name, 'new creator');
        $this->assertEqual($object->id, $original_object_id);
    }

    function testReharvestDataObjectAgentIDs()
    {
        // no need to have anything more than the first text object for this test
        $this->media = array($this->media[0]);
        $this->media[0]->agentID = "11;22";
        $this->media[0]->creator = "";
        $this->media[0]->contributor = "";
        $this->media[0]->publisher = "";
        $this->build_resource();
        self::harvest($this->resource);
        $object = DataObject::find_by_identifier($this->media[0]->identifier);
        $ado = $object->agents_data_objects;
        $this->assertEqual(count($ado), 2);
        $this->assertEqual($ado[0]->agent->full_name, $this->agents[0]->term_name);
        $this->assertEqual($ado[1]->agent->full_name, $this->agents[1]->term_name);
        $original_object_id = $object->id;

        $this->media[0]->agentID = "33;11;22";
        $this->build_resource();
        self::harvest($this->resource);
        $object = DataObject::find_by_identifier($this->media[0]->identifier);
        $ado = $object->agents_data_objects;
        $this->assertEqual(count($ado), 3);
        $this->assertEqual($ado[0]->agent->full_name, $this->agents[0]->term_name);
        $this->assertEqual($ado[1]->agent->full_name, $this->agents[1]->term_name);
        $this->assertEqual($ado[2]->agent->full_name, $this->agents[2]->term_name);
        $this->assertEqual($object->id, $original_object_id);

        $this->media[0]->agentID = "22";
        $this->build_resource();
        self::harvest($this->resource);
        $object = DataObject::find_by_identifier($this->media[0]->identifier);
        $ado = $object->agents_data_objects;
        $this->assertEqual(count($ado), 1);
        $this->assertEqual($ado[0]->agent->full_name, $this->agents[1]->term_name);
        $this->assertEqual($object->id, $original_object_id);
    }

    function testReharvestTextDescription()
    {
        // no need to have anything more than the first text object for this test
        $this->media = array($this->media[0]);
        $this->media[0]->description = "the original description";
        $this->build_resource();
        self::harvest($this->resource);
        $object = array_pop(DataObject::find_all_by_identifier($this->media[0]->identifier));
        $this->assertEqual($object->description, $this->media[0]->description);
        $original_object_id = $object->id;

        $this->media[0]->description = "the first changed description";
        $this->build_resource();
        self::harvest($this->resource);
        $object = array_pop(DataObject::find_all_by_identifier($this->media[0]->identifier));
        $this->assertEqual($object->description, $this->media[0]->description);
        $this->assertNotEqual($object->id, $original_object_id);
        $second_object_id = $object->id;

        $this->build_resource();
        self::harvest($this->resource);
        $object = array_pop(DataObject::find_all_by_identifier($this->media[0]->identifier));
        $this->assertEqual($object->description, $this->media[0]->description);
        $this->assertEqual($object->id, $second_object_id);
    }

    function testReharvestImageURL()
    {
        // no need to have anything more than the first image object for this test
        $this->media = array($this->media[1]);
        $this->media[0]->accessURI = "http://farm9.staticflickr.com/8156/6966019350_37b495aafd.jpg";
        $this->build_resource();
        self::harvest($this->resource);
        $object = array_pop(DataObject::find_all_by_identifier($this->media[0]->identifier));
        $this->assertEqual($object->object_url, $this->media[0]->accessURI);
        $original_object = $object;

        $this->media[0]->accessURI = "http://upload.wikimedia.org/wikipedia/commons/thumb/6/69/Pandanus_utilis_fruit.JPG/220px-Pandanus_utilis_fruit.JPG";
        $this->build_resource();
        self::harvest($this->resource);
        $object = array_pop(DataObject::find_all_by_identifier($this->media[0]->identifier));
        $this->assertEqual($object->object_url, $this->media[0]->accessURI);
        $this->assertNotEqual($object->id, $original_object->id);
        $this->assertNotEqual($object->object_cache_url, $original_object->object_cache_url);
        $second_object = $object;

        $this->build_resource();
        self::harvest($this->resource);
        $object = array_pop(DataObject::find_all_by_identifier($this->media[0]->identifier));
        $this->assertEqual($object->object_url, $this->media[0]->accessURI);
        $this->assertEqual($object->id, $second_object->id);
        $this->assertEqual($object->object_cache_url, $second_object->object_cache_url);
    }

    function testDefaultLanguage()
    {
        $this->media = array($this->media[1]);
        $this->media[0]->UsageTerms = "http://creativecommons.org/licenses/by-nc-sa/3.0/";
        $this->build_resource();
        self::harvest($this->resource);
        $first_version = array_pop(DataObject::find_all_by_identifier($this->media[0]->identifier));
        $this->assertEqual($first_version->license->source_url, "http://creativecommons.org/licenses/by-nc-sa/3.0/");

        $this->media[0]->UsageTerms = NULL;
        $this->build_resource();
        self::harvest($this->resource);
        # essentially this version does not get inserted because there is no license, nor a default license on the resource
        $second_version = array_pop(DataObject::find_all_by_identifier($this->media[0]->identifier));
        $this->assertEqual($second_version->id, $first_version->id);

        $this->media[0]->UsageTerms = NULL;
        $this->resource->license_id = License::find_or_create_for_parser("http://creativecommons.org/licenses/by/3.0/")->id;
        $this->resource->save();
        $this->resource->refresh();
        $this->build_resource();
        self::harvest($this->resource);
        # essentially this version does not get inserted because there is no license, nor a default license on the resource
        $third_version = array_pop(DataObject::find_all_by_identifier($this->media[0]->identifier));
        $this->assertNotEqual($third_version->id, $first_version->id);
        $this->assertNotEqual($third_version->id, $second_version->id);
        $this->assertEqual($third_version->license->source_url, $this->resource->license->source_url);
    }

    function prepare_data()
    {
        $this->taxa = array();
        $this->references = array();
        $this->vernacular_names = array();
        $this->media = array();
        $this->agents = array();

        /*
            Taxon
        */
        $taxon = new \eol_schema\Taxon();
        $taxon->taxonID = "123456";
        $taxon->kingdom = "Animalia";
        $taxon->phylum = "Chordata";
        $taxon->class = "Mammalia";
        $taxon->order = "Carnivora";
        $taxon->family = "Ursidae";
        $taxon->genus = "Ursus";
        $taxon->scientificName = "Ursus maritimus Phipps, 1774";
        $taxon->taxonRank = "species";
        $taxon->furtherInformationURL = "http://some.url/polar_bear";
        $taxon->referenceID = "11;33";
        $this->taxa[] = $taxon;

        $vernacular = new \eol_schema\VernacularName();
        $vernacular->taxonID = $this->taxa[0]->taxonID;
        $vernacular->vernacularName = "Polar bear";
        $vernacular->language = "en";
        $this->vernacular_names[] = $vernacular;

        $vernacular = new \eol_schema\VernacularName();
        $vernacular->taxonID = $this->taxa[0]->taxonID;
        $vernacular->vernacularName = "Ours polaire";
        $vernacular->language = "fr";
        $this->vernacular_names[] = $vernacular;

        /*
            Taxon
        */
        $taxon = new \eol_schema\Taxon();
        $taxon->taxonID = "987654";
        $taxon->kingdom = "Animalia";
        $taxon->phylum = "Chordata";
        $taxon->class = "Actinopterygii";
        $taxon->order = "Salmoniformes";
        $taxon->family = "Salmonidae";
        $taxon->genus = "Salmo";
        $taxon->scientificName = "Salmo salar Linnaeus, 1758";
        $taxon->taxonRank = "species";
        $taxon->furtherInformationURL = "http://some.url/salmon";
        $taxon->referenceID = "22;33";
        $this->taxa[] = $taxon;

        $vernacular = new \eol_schema\VernacularName();
        $vernacular->taxonID = $this->taxa[1]->taxonID;
        $vernacular->vernacularName = "Atlantic salmon";
        $vernacular->language = "en";
        $this->vernacular_names[] = $vernacular;

        $vernacular = new \eol_schema\VernacularName();
        $vernacular->taxonID = $this->taxa[1]->taxonID;
        $vernacular->vernacularName = "Salmón del Atlántico";
        $vernacular->language = "es";
        $this->vernacular_names[] = $vernacular;

        /*
            References
        */
        $reference = new \eol_schema\Reference();
        $reference->identifier = "11";
        $reference->full_reference = "This is another sample reference";
        $this->references[] = $reference;

        $reference = new \eol_schema\Reference();
        $reference->identifier = "22";
        $reference->title = "Some title";
        $reference->pages = "101-150";
        $reference->pageStart = "101";
        $reference->pageEnd = "150";
        $reference->volume = "v1";
        $reference->edition = "September";
        $reference->publisher = "Some publisher";
        $reference->authorList = "Helm, Danko";
        $reference->editorList = "Robertson, Manuel";
        $reference->language = "fr";
        $reference->uri = "http://some.uri";
        $reference->doi = "10.1000/182";
        $this->references[] = $reference;

        $reference = new \eol_schema\Reference();
        $reference->identifier = "33";
        $reference->full_reference = "Third reference";
        $this->references[] = $reference;

        /*
            Text
        */
        $text = new \eol_schema\MediaResource();
        $text->taxonID = $this->taxa[0]->taxonID;
        $text->identifier = "text1";
        $text->type = "http://purl.org/dc/dcmitype/Text";
        $text->format = "text/html";
        $text->CVterm = "http://rs.tdwg.org/ontology/voc/SPMInfoItems#Biology";
        $text->title = "Text Title";
        $text->description = "Text Description";
        $text->furtherInformationURL = "http://example.com/text1";
        $text->derivedFrom = "derived from something";
        $text->CreateDate = "2012-04-24 00:00:00";
        $text->modified = "2012-04-25 00:00:00";
        $text->language = "en";
        $text->Rating = "1.2";
        $text->audience = "Children";
        $text->UsageTerms = "http://creativecommons.org/licenses/by-nc-sa/3.0/";
        $text->rights = "these are the rights";
        $text->Owner = "Someone";
        $text->bibliographicCitation = "a citation";
        $text->creator = "a creator";
        $text->publisher = "a publisher";
        $text->contributor = "a contributor";
        $text->LocationCreated = "created someplace";
        $text->spatial = "collected someplace";
        $text->lat = "10";
        $text->long = "20";
        $text->alt = "30";
        $this->media[] = $text;

        /*
            Image
        */
        $image = new \eol_schema\MediaResource();
        $image->taxonID = $this->taxa[1]->taxonID;
        $image->identifier = "image1";
        $image->type = "http://purl.org/dc/dcmitype/StillImage";
        $image->subtype = "Map";
        $image->format = "image/jpeg";
        $image->title = "Ada aurantiaca x Odontoglossum constrictum";
        $image->description = "Monteporzio Catone 2012 - Nardotto e Capello";
        $image->accessURI = "http://farm9.staticflickr.com/8156/6966019350_37b495aafd.jpg";
        $image->thumbnailURL = "http://farm9.staticflickr.com/8156/6966019350_37b495aafd_s.jpg";
        $image->furtherInformationURL = "http://www.flickr.com/photos/81918877@N00/6966019350/in/pool-806927@N20/";
        $image->derivedFrom = "derived from something";
        $image->CreateDate = "2012-04-24 00:00:00";
        $image->modified = "2012-04-25 00:00:00";
        $image->language = "en";
        $image->Rating = "1.2";
        $image->audience = "Children";
        $image->UsageTerms = "http://creativecommons.org/licenses/by-nc-sa/3.0/";
        $image->rights = "these are the rights";
        $image->Owner = "Someone";
        $image->bibliographicCitation = "a citation";
        $image->creator = "a creator";
        $image->publisher = "a publisher";
        $image->contributor = "a contributor";
        $image->LocationCreated = "created someplace";
        $image->spatial = "collected someplace";
        $image->lat = "10";
        $image->long = "20";
        $image->alt = "30";
        $this->media[] = $image;

        /*
            Agents
        */
        $agent = new \eol_schema\Agent();
        $agent->identifier = "11";
        $agent->term_name = "Full name";
        $agent->term_firstName = "First";
        $agent->term_familyName = "Last";
        $agent->agentRole = "Some new agent role";
        $agent->term_mbox = "someone@example.com";
        $agent->term_homepage = "http://example.com";
        $agent->term_currentProject = "MyProject";
        $agent->organization = "MyOrganization";
        $agent->term_accountName = "MyAccountName";
        $agent->term_openid = "something";
        $this->agents[] = $agent;

        $agent = new \eol_schema\Agent();
        $agent->identifier = "22";
        $agent->term_name = "Full name 2";
        $agent->term_firstName = "First 2";
        $agent->term_familyName = "Last 2";
        $agent->term_mbox = "someone2@example.com";
        $agent->term_homepage = "http://example2.com";
        $agent->term_currentProject = "MyProject 2";
        $agent->organization = "MyOrganization 2";
        $agent->term_accountName = "MyAccountName 2";
        $agent->term_openid = "something 2";
        $this->agents[] = $agent;

        $agent = new \eol_schema\Agent();
        $agent->identifier = "33";
        $agent->term_name = "Full name 3";
        $agent->term_firstName = "First 3";
        $agent->term_familyName = "Last 3";
        $agent->term_mbox = "someone3@example.com";
        $agent->term_homepage = "http://example3.com";
        $agent->term_currentProject = "MyProject 3";
        $agent->organization = "MyOrganization 3";
        $agent->term_accountName = "MyAccountName 3";
        $agent->term_openid = "something 3";
        $this->agents[] = $agent;
    }

    function build_resource()
    {
        $this->archive_builder = new \eol_schema\ContentArchiveBuilder(array('directory_path' => $this->archive_directory));
        $content_to_add = array(
            $this->taxa,
            $this->references,
            $this->vernacular_names,
            $this->media,
            $this->agents);
        foreach($content_to_add as $records)
        {
            foreach($records as $r) $this->archive_builder->write_object_to_file($r);
        }
        $this->archive_builder->finalize();
    }

    private static function harvest($resource)
    {
        // set to Harvest Requested - this will only change the status id
        passthru(PHP_BIN_PATH . DOC_ROOT ."rake_tasks/harvest_requested.php -id $resource->id ENV_NAME=test");
        passthru(PHP_BIN_PATH . DOC_ROOT ."rake_tasks/harvest_resources_cron_task.php $resource->id --fast ENV_NAME=test");
        Cache::flush();
    }

    private static function create_resource($args = array())
    {
        if(!isset($args['auto_publish'])) $args['auto_publish'] = 1;
        if(!isset($args['vetted'])) $args['vetted'] = 1;
        if(!isset($args['title'])) $args['title'] = 'Test Resource';
        if(!isset($args['dwc_archive_url'])) $args['dwc_archive_url'] = '';

        // create the test resource
        $agent = Agent::find_or_create(array('full_name' => 'Test Content Partner'));
        $user = User::find_or_create(array('display_name' => 'Test Content Partner', 'agent_id' => $agent->id));

        // create the content partner
        $content_partner = ContentPartner::find_or_create(array('user_id' => $user->id));
        $hierarchy = Hierarchy::find_or_create(array('agent_id' => $agent->id, 'label' => 'Test Content Partner Hierarchy'));

        // create the resource
        $attr = array(  'content_partner_id'    => $content_partner->id,
                        'service_type'          => ServiceType::find_or_create_by_translated_label('EOL Transfer Schema'),
                        'refresh_period_hours'  => 1,
                        'auto_publish'          => $args['auto_publish'],
                        'vetted'                => $args['vetted'],
                        'title'                 => $args['title'],
                        'dwc_archive_url'       => $args['dwc_archive_url'],
                        'hierarchy_id'          => $hierarchy->id,
                        'resource_status'       => ResourceStatus::validated());
        $resource = Resource::find_or_create($attr);
        return $resource;
    }
}

?>


text:
package com.gmail.kamiloleksik.jfxkonwerter.model.entity;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

@DatabaseTable(tableName = "UnitType")
public class UnitType implements Comparable<UnitType>
{
	@DatabaseField(generatedId = true)
	private int unitTypeId;
	@DatabaseField(canBeNull = false)
	private String unitTypeName;
	@DatabaseField(canBeNull = false)
	private String classifier;

	public UnitType()
	{
		// ORMLite needs a no-arg constructor
	}

	public UnitType(int unitTypeId, String unitTypeName, String classifier)
	{
		this.unitTypeId = unitTypeId;
		this.unitTypeName = unitTypeName;
		this.classifier = classifier;
	}

	public UnitType(UnitType another)
	{
		this.unitTypeId = another.unitTypeId;
		this.unitTypeName = another.unitTypeName;
		this.classifier = another.classifier;
	}

	public int getUnitTypeId()
	{
		return unitTypeId;
	}

	public String getUnitTypeName()
	{
		return unitTypeName;
	}

	public String getUnitTypeClassifier()
	{
		return classifier;
	}

	@Override
	public int compareTo(UnitType o)
	{
		return unitTypeName.compareToIgnoreCase(o.unitTypeName);
	}

	public void setUnitTypeName(String unitTypeName)
	{
		this.unitTypeName = unitTypeName;
	}
}


text:
/*  linux/include/linux/clocksource.h
 *
 *  This file contains the structure definitions for clocksources.
 *
 *  If you are not a clocksource, or timekeeping code, you should
 *  not be including this file!
 */
#ifndef _LINUX_CLOCKSOURCE_H
#define _LINUX_CLOCKSOURCE_H

#include <linux/types.h>
#include <linux/timex.h>
#include <linux/time.h>
#include <linux/list.h>
#include <linux/cache.h>
#include <linux/timer.h>
#include <linux/init.h>
#include <asm/div64.h>
#include <asm/io.h>

struct clocksource;
struct module;

#ifdef CONFIG_ARCH_CLOCKSOURCE_DATA
#include <asm/clocksource.h>
#endif

/**
 * struct clocksource - hardware abstraction for a free running counter
 *	Provides mostly state-free accessors to the underlying hardware.
 *	This is the structure used for system time.
 *
 * @name:		ptr to clocksource name
 * @list:		list head for registration
 * @rating:		rating value for selection (higher is better)
 *			To avoid rating inflation the following
 *			list should give you a guide as to how
 *			to assign your clocksource a rating
 *			1-99: Unfit for real use
 *				Only available for bootup and testing purposes.
 *			100-199: Base level usability.
 *				Functional for real use, but not desired.
 *			200-299: Good.
 *				A correct and usable clocksource.
 *			300-399: Desired.
 *				A reasonably fast and accurate clocksource.
 *			400-499: Perfect
 *				The ideal clocksource. A must-use where
 *				available.
 * @read:		returns a cycle value, passes clocksource as argument
 * @enable:		optional function to enable the clocksource
 * @disable:		optional function to disable the clocksource
 * @mask:		bitmask for two's complement
 *			subtraction of non 64 bit counters
 * @mult:		cycle to nanosecond multiplier
 * @shift:		cycle to nanosecond divisor (power of two)
 * @max_idle_ns:	max idle time permitted by the clocksource (nsecs)
 * @maxadj:		maximum adjustment value to mult (~11%)
 * @max_cycles:		maximum safe cycle value which won't overflow on multiplication
 * @flags:		flags describing special properties
 * @archdata:		arch-specific data
 * @suspend:		suspend function for the clocksource, if necessary
 * @resume:		resume function for the clocksource, if necessary
 * @owner:		module reference, must be set by clocksource in modules
 */
struct clocksource {
	/*
	 * Hotpath data, fits in a single cache line when the
	 * clocksource itself is cacheline aligned.
	 */
	cycle_t (*read)(struct clocksource *cs);
	cycle_t mask;
	u32 mult;
	u32 shift;
	u64 max_idle_ns;
	u32 maxadj;
#ifdef CONFIG_ARCH_CLOCKSOURCE_DATA
	struct arch_clocksource_data archdata;
#endif
	u64 max_cycles;
	const char *name;
	struct list_head list;
	int rating;
	int (*enable)(struct clocksource *cs);
	void (*disable)(struct clocksource *cs);
	unsigned long flags;
	void (*suspend)(struct clocksource *cs);
	void (*resume)(struct clocksource *cs);

	/* private: */
#ifdef CONFIG_CLOCKSOURCE_WATCHDOG
	/* Watchdog related data, used by the framework */
	struct list_head wd_list;
	cycle_t cs_last;
	cycle_t wd_last;
#endif
	struct module *owner;
} ____cacheline_aligned;

/*
 * Clock source flags bits::
 */
#define CLOCK_SOURCE_IS_CONTINUOUS		0x01
#define CLOCK_SOURCE_MUST_VERIFY		0x02

#define CLOCK_SOURCE_WATCHDOG			0x10
#define CLOCK_SOURCE_VALID_FOR_HRES		0x20
#define CLOCK_SOURCE_UNSTABLE			0x40
#define CLOCK_SOURCE_SUSPEND_NONSTOP		0x80
#define CLOCK_SOURCE_RESELECT			0x100

/* simplify initialization of mask field */
#define CLOCKSOURCE_MASK(bits) (cycle_t)((bits) < 64 ? ((1ULL<<(bits))-1) : -1)

/**
 * clocksource_khz2mult - calculates mult from khz and shift
 * @khz:		Clocksource frequency in KHz
 * @shift_constant:	Clocksource shift factor
 *
 * Helper functions that converts a khz counter frequency to a timsource
 * multiplier, given the clocksource shift value
 */
static inline u32 clocksource_khz2mult(u32 khz, u32 shift_constant)
{
	/*  khz = cyc/(Million ns)
	 *  mult/2^shift  = ns/cyc
	 *  mult = ns/cyc * 2^shift
	 *  mult = 1Million/khz * 2^shift
	 *  mult = 1000000 * 2^shift / khz
	 *  mult = (1000000<<shift) / khz
	 */
	u64 tmp = ((u64)1000000) << shift_constant;

	tmp += khz/2; /* round for do_div */
	do_div(tmp, khz);

	return (u32)tmp;
}

/**
 * clocksource_hz2mult - calculates mult from hz and shift
 * @hz:			Clocksource frequency in Hz
 * @shift_constant:	Clocksource shift factor
 *
 * Helper functions that converts a hz counter
 * frequency to a timsource multiplier, given the
 * clocksource shift value
 */
static inline u32 clocksource_hz2mult(u32 hz, u32 shift_constant)
{
	/*  hz = cyc/(Billion ns)
	 *  mult/2^shift  = ns/cyc
	 *  mult = ns/cyc * 2^shift
	 *  mult = 1Billion/hz * 2^shift
	 *  mult = 1000000000 * 2^shift / hz
	 *  mult = (1000000000<<shift) / hz
	 */
	u64 tmp = ((u64)1000000000) << shift_constant;

	tmp += hz/2; /* round for do_div */
	do_div(tmp, hz);

	return (u32)tmp;
}

/**
 * clocksource_cyc2ns - converts clocksource cycles to nanoseconds
 * @cycles:	cycles
 * @mult:	cycle to nanosecond multiplier
 * @shift:	cycle to nanosecond divisor (power of two)
 *
 * Converts cycles to nanoseconds, using the given mult and shift.
 *
 * XXX - This could use some mult_lxl_ll() asm optimization
 */
static inline s64 clocksource_cyc2ns(cycle_t cycles, u32 mult, u32 shift)
{
	return ((u64) cycles * mult) >> shift;
}

extern int clocksource_unregister(struct clocksource*);
extern void clocksource_touch_watchdog(void);
extern void clocksource_change_rating(struct clocksource *cs, int rating);
extern void clocksource_suspend(void);
extern void clocksource_resume(void);
extern struct clocksource * __init clocksource_default_clock(void);
extern void clocksource_mark_unstable(struct clocksource *cs);

extern u64
clocks_calc_max_nsecs(u32 mult, u32 shift, u32 maxadj, u64 mask, u64 *max_cycles);
extern void
clocks_calc_mult_shift(u32 *mult, u32 *shift, u32 from, u32 to, u32 minsec);

/*
 * Don't call __clocksource_register_scale directly, use
 * clocksource_register_hz/khz
 */
extern int
__clocksource_register_scale(struct clocksource *cs, u32 scale, u32 freq);
extern void
__clocksource_update_freq_scale(struct clocksource *cs, u32 scale, u32 freq);

/*
 * Don't call this unless you are a default clocksource
 * (AKA: jiffies) and absolutely have to.
 */
static inline int __clocksource_register(struct clocksource *cs)
{
	return __clocksource_register_scale(cs, 1, 0);
}

static inline int clocksource_register_hz(struct clocksource *cs, u32 hz)
{
	return __clocksource_register_scale(cs, 1, hz);
}

static inline int clocksource_register_khz(struct clocksource *cs, u32 khz)
{
	return __clocksource_register_scale(cs, 1000, khz);
}

static inline void __clocksource_update_freq_hz(struct clocksource *cs, u32 hz)
{
	__clocksource_update_freq_scale(cs, 1, hz);
}

static inline void __clocksource_update_freq_khz(struct clocksource *cs, u32 khz)
{
	__clocksource_update_freq_scale(cs, 1000, khz);
}

extern int timekeeping_notify(struct clocksource *clock);

extern cycle_t clocksource_mmio_readl_up(struct clocksource *);
extern cycle_t clocksource_mmio_readl_down(struct clocksource *);
extern cycle_t clocksource_mmio_readw_up(struct clocksource *);
extern cycle_t clocksource_mmio_readw_down(struct clocksource *);

extern int clocksource_mmio_init(void __iomem *, const char *,
	unsigned long, int, unsigned, cycle_t (*)(struct clocksource *));

extern int clocksource_i8253_init(void);

#define CLOCKSOURCE_OF_DECLARE(name, compat, fn) \
	OF_DECLARE_1(clksrc, name, compat, fn)

#ifdef CONFIG_CLKSRC_OF
extern void clocksource_of_init(void);
#else
static inline void clocksource_of_init(void) {}
#endif

#ifdef CONFIG_ACPI
void acpi_generic_timer_init(void);
#else
static inline void acpi_generic_timer_init(void) { }
#endif

#endif /* _LINUX_CLOCKSOURCE_H */


text:
layout: default
title: Configuration Guide
---

[SSLSecurity]: /mcollective/reference/plugins/security_ssl.html
[AESSecurity]: /mcollective/reference/plugins/security_aes.html
[Registration]: /mcollective/reference/plugins/registration.html
[Auditing]: /mcollective/simplerpc/auditing.html
[Authorization]: /mcollective/simplerpc/authorization.html
[Subcollectives]: /mcollective/reference/basic/subcollectives.html
[server_config]: /mcollective/configure/server.html

> **Note:** There is a new [Server Configuration Reference][server_config] page with a more complete overview of MCollective's server daemon settings. A similar client configuration page is forthcoming.

This guide tells you about the major configuration options in the daemon and client config files.  There are options not mentioned
here typically ones specific to a certain plugin.

## Configuration Files
There are 2 configuration files, one for the client and one for the server, these default to */etc/mcollective/server.cfg* and */etc/mcollective/client.cfg*.

Configuration is a simple *key = val* style configuration file.

## Common Options

|Key|Sample|Description|
|---|------|-----------|
|collectives|mcollective,subcollective|A list of [Subcollectives] to join - 1.1.3 and newer only|
|main_collective|mcollective|The main collective to target - 1.1.3 and newer only|
|logfile|/var/log/mcollective.log|Where to log|
|loglevel|debug|Can be info, warn, debug, fatal, error|
|identity|dev1.your.com|Identifier for this node, does not need to be unique, defaults to hostname if unset and must match _/\w\.\-/_ if set|
|keeplogs|5|The amount of logs to keep|
|max_log_size|2097152|Max size in bytes for log files before rotation happens|
|libdir|/usr/libexec/mcollective:/site/mcollective|Where to look for plugins|
|connector|activemq|Which _connector_ plugin to use for communication|
|securityprovider|Psk|Which security model to use, see [SSL Security Plugin][SSLSecurity] and [AES Security Plugin][AESSecurity] for details on others|
|rpchelptemplate|/etc/mcollective/rpc-help.erb|The path to the erb template used for generating help|
|helptemplatedir|/etc/mcollective|The path that contains all the erb templates for generating help|
|logger_type|file|Valid logger types, currently file, syslog or console|
|ssl_cipher|aes-256-cbc|This sets the cipher in use by the SSL code, see _man enc_ for a list supported by OpenSSL|
|direct_addressing|n|Enable or disable directed requests|
|direct_addressing_threshold|10|When direct requests are enabled, send direct messages for less than or equal to this many hosts|
|ttl|60|Sets the default TTL for requests - 1.3.2 and newer only|
|logfacility|When using the syslog logger sets the facility, defaults to user|
|default_discovery_method|The default method to use for discovery - _mc_ by default|
|default_discovery_options|Options to pass to the discovery plugin, empty by default|

## Server Configuration
The server configuration file should be root only readable

|Key|Sample|Description|
|---|------|-----------|
|daemonize|1|Runs the server in the background|
|factsource|Facter|Which fact plugin to use|
|registration|Agentlist|[Registration] plugin to use|
|registerinterval|120|How many seconds to sleep between registration messages, setting this to zero disables registration|
|registration_collective|development|Which sub-collective to send registration messages to|
|classesfile|/var/lib/puppet/classes.txt|Where to find a list of classes configured by your configuration management system|
|rpcaudit|1|Enables [SimpleRPC Auditing][Auditing]|
|rpcauditprovider|Logfile|Enables auditing using _MCollective::Audit::Logfile_|
|rpcauthorization|1|Enables [SimpleRPC Authorization][Authorization] globally|
|rpcauthprovider|action_policy|Use the _MCollective::Util::ActionPolicy_ plugin to manage authorization|
|rpclimitmethod|The method used for --limit-results.  Can be either _first_ or _random_|
|fact_cache_time|300|How long to cache fact results for before refreshing from source|

## Client Configuration
The client configuration file should be readable by everyone, it's not advised to put PSK's or client SSL certs in a world readable file, see below how to do that per user.

|Key|Sample|Description|
|---|------|-----------|
|color|0|Disables the use of color in RPC results|

## Plugin Configuration
You can add free form config options for plugins, they take the general form like:

{% highlight ini %}
    plugin.pluginname.option = value
{% endhighlight %}

Each plugin's documentation should tell you what options are availble.

Common plugin options are:

|Key|Sample|Description|
|---|------|-----------|
|plugin.yaml|/etc/mcollective/facts.yaml:/other/facts.yaml|Where the yaml fact source finds facts from, multiples get merged|
|plugin.psk|123456789|The pre-shared key to use for the Psk security provider|
|plugin.psk.callertype|group|What to base the callerid on for the PSK plugin, uid, gid, user, group or identity|

## Client Setup
It's recommended that you do not set host, user, password and Psk in the client configuration file since these files are generally world readable unlike the server one that should be root readable only.  I just set mine to *unset* so it's clear to someone who looks at the config file that it's not going to work without the settings below.

You can also put client configuration in _~/.mcollective_ as an alternative to the method below, but you will need a full client.cfg then in that location.

You can set various Environment variables per user to supply these values:

{% highlight bash %}
export STOMP_USER=user
export STOMP_PASSWORD=password
export MCOLLECTIVE_PSK=123456789
{% endhighlight %}

You an set options that will always apply using the _MCOLLECTIVE_EXTRA_OPTS_ as below:

{% highlight bash %}
export MCOLLECTIVE_EXTRA_OPTS="--dt 5 --timeout 3 --config /home/you/mcollective.cfg"
{% endhighlight %}

The client library will use these and so you can give each user who use the admin utilities their own username and rights.


text:
using System.Collections.Generic;

namespace Efrpg.Generators
{
    public class MultipleModelReturnColumns
    {
        public int Model { get; }
        public List<string> ReturnColumns { get; }

        public MultipleModelReturnColumns(int model, List<string> returnColumns)
        {
            Model         = model;
            ReturnColumns = returnColumns;
        }
    }
}


text:
#include "ResourceManager.h"
#include "../Game.h"

#ifdef __APPLE__
#include <SDL2/SDL.h>
#elif _WIN32
#include <SDL.h>
#endif

#include <algorithm>
#include <tinydir.h>
#include "tinyxml2.h"
#include "../ScriptManager.h"
#include "../RenderManager.h"

ResourceManager* ResourceManager::manager;

ResourceManager::ResourceManager()
{
}

ResourceManager::~ResourceManager()
{
}

void ResourceManager::init() {

	manager = this;

	//Load Defaults
	#include "default_sprite.c"

	//stolen from https://caedesnotes.wordpress.com/2015/04/13/how-to-integrate-your-sdl2-window-icon-or-any-image-into-your-executable/
	// these masks are needed to tell SDL_CreateRGBSurface(From)
	// to assume the data it gets is byte-wise RGB(A) data
	Uint32 rmask, gmask, bmask, amask;
	#if SDL_BYTEORDER == SDL_BIG_ENDIAN
		int shift = (my_icon.bytes_per_pixel == 3) ? 8 : 0;
		rmask = 0xff000000 >> shift;
		gmask = 0x00ff0000 >> shift;
		bmask = 0x0000ff00 >> shift;
		amask = 0x000000ff >> shift;
	#else // little endian, like x86
		rmask = 0x000000ff;
		gmask = 0x0000ff00;
		bmask = 0x00ff0000;
		amask = (default_sprite.bytes_per_pixel == 3) ? 0 : 0xff000000;
	#endif

	spriteDefault = SDL_CreateRGBSurfaceFrom(
		(void*)default_sprite.pixel_data,
		default_sprite.width,
		default_sprite.height,
		default_sprite.bytes_per_pixel*8,
		default_sprite.bytes_per_pixel*default_sprite.width,
		rmask,
		gmask,
		bmask,
		amask
	);

}

void ResourceManager::loadSprite(std::string resId, std::string filePath, bool convertRGBtoIndexed) {

	if (SDL_Surface *surf = SDL_LoadBMP(filePath.c_str())) {

		if (convertRGBtoIndexed) {
			surf = RenderManager::manager->convertRGBtoIndexed(resId, surf);
		}
		spritesheets[resId] = surf;
		SDL_Log("Loaded %s", resId.c_str());

	}
	else
	{
		Game::game->showMsgBox(SDL_GetError());
	}

}

EntityData* ResourceManager::getEntityData(std::string id) {
	return entityDatas[id];
}

SDL_Surface* ResourceManager::getSprite(std::string id) {

	SDL_Surface* ret = spritesheets[id];

	if (ret == nullptr) {
		SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "Sprite %s not found", id.c_str());
		return spriteDefault;
	}

	return ret;
}
SDL_Surface* ResourceManager::getTile(std::string id) {

	SDL_Surface* ret = spritesheets[id];

	if (ret == nullptr) {
		SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "Tile %s not found", id.c_str());
		return spriteDefault;
	}

	return ret;
}
FontData* ResourceManager::getFont(std::string id) {

	FontData* ret = fontDatas[id];

	if (ret == nullptr) {
		SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "Font %s not found", id.c_str());
		return nullptr;
	}

	return ret;
}
SDL_Surface* ResourceManager::getBorder(std::string id) {

	SDL_Surface* ret = spritesheets[id];

	if (ret == nullptr) {
		SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "Border %s not found", id.c_str());
		return spriteDefault;
	}

	return ret;
}

HeroData* ResourceManager::getHeroData(std::string id) {

	return heroDatas[id];
}

EquipData* ResourceManager::getEquipData(std::string id) {

	return equipDatas[id];
}

SkillData* ResourceManager::getSkillData(std::string id) {

	return skillDatas[id];
}

EnemyData* ResourceManager::getEnemyData(std::string id) {

	return enemyDatas[id];
}

std::string ResourceManager::resIdFromPath(std::string path) {

	std::size_t found = path.find("data/");
	std::string sub0 = path.substr(found);
	std::string sub1 = sub0.substr(5, sub0.size());
	std::string sub2 = sub1.substr(0, sub1.size() - 4);
	std::string sub3 = sub2;

	std::replace(sub3.begin(), sub3.end(), '/', '.');
	return sub3;

}

std::string ResourceManager::removeFilenameFromPath(std::string filename, std::string path) {

	return path.substr(0, path.size() - filename.length());

}

void ResourceManager::loadBorders(std::string basePath) {

	const char *dataPath = basePath.append("borders/").c_str();
	tinydir_dir dir;
	int i;
	tinydir_open_sorted(&dir, dataPath);

	for (i = 0; i < dir.n_files; i++) {

		tinydir_file file;
		tinydir_readfile_n(&dir, &file, i);

		/*if (strcmp(file.name, ".") == 0 || strcmp(file.name, "..") == 0) {
		continue;
		}*/

		if (strcmp(file.extension, "xml") == 0) {

			tinyxml2::XMLDocument doc;
			doc.LoadFile(file.path);

			if (doc.FirstChildElement("border")) {

				const char* borderName = doc.FirstChildElement("border")->FirstChildElement("name")->GetText();
				const char* borderfile = doc.FirstChildElement("border")->FirstChildElement("file")->GetText();

				std::string resId = resIdFromPath(file.path);
				std::string filePath = removeFilenameFromPath(file.name, file.path);

				ResourceManager::manager->loadSprite(resId, filePath.append(borderfile), false);
			}
			else {
				Game::game->showMsgBox("unrecognized xml");
				Game::game->showMsgBox(file.path);

			}
		}
	}

}

void ResourceManager::loadDungeons(std::string basePath) {

	const char *dataPath = basePath.append("dungeons/").c_str();
	tinydir_dir dir;
	int i;
	tinydir_open_sorted(&dir, dataPath);

	for (i = 0; i < dir.n_files; i++) {

		tinydir_file file;
		tinydir_readfile_n(&dir, &file, i);

		/*if (strcmp(file.name, ".") == 0 || strcmp(file.name, "..") == 0) {
		continue;
		}*/

		if (strcmp(file.extension, "xml") == 0) {

			tinyxml2::XMLDocument doc;
			doc.LoadFile(file.path);

			if (doc.FirstChildElement("dungeon")) {

				const char* dungeonName = doc.FirstChildElement("dungeon")->FirstChildElement("name")->GetText();
				const char* dungeonFile = doc.FirstChildElement("dungeon")->FirstChildElement("file")->GetText();

				std::string resId = resIdFromPath(file.path);
				std::string filePath = removeFilenameFromPath(file.name, file.path);

				ScriptManager::manager->injectResourceIdGlobal(resId);
				ScriptManager::manager->doFile(filePath.append(dungeonFile).c_str());
				ScriptManager::manager->removeResourceIdGlobal();

			}
			else {
				Game::game->showMsgBox("unrecognized xml");
				Game::game->showMsgBox(file.path);

			}
		}
	}

}
void ResourceManager::loadEntities(std::string basePath) {

	const char *dataPath = basePath.append("entities/").c_str();
	tinydir_dir dir;
	int i;
	tinydir_open_sorted(&dir, dataPath);

	for (i = 0; i < dir.n_files; i++) {

		tinydir_file file;
		tinydir_readfile_n(&dir, &file, i);

		if (strcmp(file.extension, "xml") == 0) {

			tinyxml2::XMLDocument doc;
			doc.LoadFile(file.path);

			if (doc.FirstChildElement("entity")) {

				std::string resId = resIdFromPath(file.path);
				std::string filePath = removeFilenameFromPath(file.name, file.path);

				const char* entityName = doc.FirstChildElement("entity")->FirstChildElement("name")->GetText();
				const char* entityType = doc.FirstChildElement("entity")->FirstChildElement("type")->GetText();
				const char* entitySprite = doc.FirstChildElement("entity")->FirstChildElement("sprite")->GetText();
				const char* entityFile = doc.FirstChildElement("entity")->FirstChildElement("file")->GetText();

				EntityData *newEntityData = new EntityData{
					resId,
					file.name,
					entityName,
					new FieldEntityData{ entitySprite }
				};

				ResourceManager::manager->entityDatas[resId] = newEntityData;

				ScriptManager::manager->injectResourceIdGlobal(resId);
				ScriptManager::manager->doFile(filePath.append(entityFile).c_str());
				ScriptManager::manager->removeResourceIdGlobal();

			}
			else {
				Game::game->showMsgBox("unrecognized xml");
				Game::game->showMsgBox(file.path);

			}
		}
	}

}
void ResourceManager::loadFonts(std::string basePath) {

	const char *dataPath = basePath.append("fonts/").c_str();
	tinydir_dir dir;
	int i;
	tinydir_open_sorted(&dir, dataPath);

	for (i = 0; i < dir.n_files; i++) {

		tinydir_file file;
		tinydir_readfile_n(&dir, &file, i);

		if (strcmp(file.extension, "xml") == 0) {

			tinyxml2::XMLDocument doc;
			doc.LoadFile(file.path);

			if (doc.FirstChildElement("font")) {

				FontData *newFontData = new FontData();

				std::string resId = resIdFromPath(file.path);
				std::string filePath = removeFilenameFromPath(file.name, file.path);

				const char* name = doc.FirstChildElement("font")->FirstChildElement("name")->GetText();
				int height;
				doc.FirstChildElement("font")->FirstChildElement("height")->QueryIntText(&height);

				tinyxml2::XMLElement *charElement = doc.FirstChildElement("font")->FirstChildElement("chars");
				for (tinyxml2::XMLElement* child = charElement->FirstChildElement(); child != NULL; child = child->NextSiblingElement())
				{

					const char* charz = child->FirstChildElement("char")->GetText();
					if (strcmp(charz, "&#032") == 0) {
						charz = " ";
					}

					const char* file = child->FirstChildElement("file")->GetText();
					int width;
					child->FirstChildElement("width")->QueryIntText(&width);

					std::string filePath2 = std::string(filePath).append(file);

					SDL_Surface *surf = SDL_LoadBMP(filePath2.c_str());

					if (surf) {

						SDL_Log("Loaded %s", resId.c_str());
						CharData *newCharData = new CharData();
						newCharData->charz = charz;
						newCharData->fileName = file;
						newCharData->width = width;
						newCharData->surfNormal = RenderManager::manager->convertRGBtoIndexed(resId + " - " + charz, surf);
						newCharData->surfInverted = RenderManager::manager->convertRGBtoIndexed(resId + " - " + charz, RenderManager::manager->invertPixels(resId + " - " + charz, surf));

						newFontData->chars[newCharData->charz] = newCharData;

						SDL_FreeSurface(surf);

					}
					else
					{
						Game::game->showMsgBox(SDL_GetError());
					}
				}

				newFontData->id = resId;
				newFontData->name = name;
				newFontData->height = height;
				newFontData->hSpacing = 1;
				newFontData->vSpacing = 1;

				fontDatas[resId] = newFontData;

			}
			else {
				Game::game->showMsgBox("unrecognized xml");
				Game::game->showMsgBox(file.path);

			}
		}
	}

}

void ResourceManager::loadHeroes(std::string basePath) {

	const char *dataPath = basePath.append("heroes/").c_str();
	tinydir_dir dir;
	int i;
	tinydir_open_sorted(&dir, dataPath);

	for (i = 0; i < dir.n_files; i++) {

		tinydir_file file;
		tinydir_readfile_n(&dir, &file, i);

		if (strcmp(file.extension, "xml") == 0) {

			tinyxml2::XMLDocument doc;
			doc.LoadFile(file.path);

			if (doc.FirstChildElement("hero")) {

				std::string resId = resIdFromPath(file.path);
				std::string filePath = removeFilenameFromPath(file.name, file.path);

				const char* heroName = doc.FirstChildElement("hero")->FirstChildElement("name")->GetText();

				HeroData *newHeroData = new HeroData{
					resId,
					file.name,
					filePath,
					heroName
				};

				//SKILLS
				tinyxml2::XMLElement *charElement0 = doc.FirstChildElement("hero")->FirstChildElement("skills");
				for (tinyxml2::XMLElement* child = charElement0->FirstChildElement(); child != NULL; child = child->NextSiblingElement())
				{
					const char* skillId = child->/*FirstChildElement("skill")->*/GetText();
					newHeroData->skillsIds.push_back(skillId);

				}

				//STATS
				tinyxml2::XMLElement *charElement = doc.FirstChildElement("hero")->FirstChildElement("stats");
				for (tinyxml2::XMLElement* child = charElement->FirstChildElement(); child != NULL; child = child->NextSiblingElement())
				{
					Stats newStats = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};

					child->QueryIntAttribute("no",		&newStats.levelNo);
					child->QueryIntAttribute("hp",		&newStats.hp);
					child->QueryIntAttribute("mp",		&newStats.mp);
					child->QueryIntAttribute("atk",		&newStats.atk);
					child->QueryIntAttribute("def",		&newStats.def);
					child->QueryIntAttribute("matk",	&newStats.matk);
					child->QueryIntAttribute("mdef",	&newStats.mdef);
					child->QueryIntAttribute("mnd",		&newStats.mnd);
					child->QueryIntAttribute("spd",		&newStats.spd);
					child->QueryIntAttribute("lck",		&newStats.lck);

					newHeroData->stats.push_back(newStats);

				}

				ResourceManager::manager->heroDatas[resId] = newHeroData;

			}
			else {
				Game::game->showMsgBox("unrecognized xml");
				Game::game->showMsgBox(file.path);

			}
		}
	}

}

void ResourceManager::loadEquips(std::string basePath) {

	const char *dataPath = basePath.append("equips/").c_str();
	tinydir_dir dir;
	int i;
	tinydir_open_sorted(&dir, dataPath);

	for (i = 0; i < dir.n_files; i++) {

		tinydir_file file;
		tinydir_readfile_n(&dir, &file, i);

		if (strcmp(file.extension, "xml") == 0) {

			tinyxml2::XMLDocument doc;
			doc.LoadFile(file.path);

			if (doc.FirstChildElement("equip")) {

				std::string resId = resIdFromPath(file.path);
				std::string filePath = removeFilenameFromPath(file.name, file.path);

				const char* equipName = doc.FirstChildElement("equip")->FirstChildElement("name")->GetText();
				int equipType;
				doc.FirstChildElement("equip")->FirstChildElement("type")->QueryIntText(&equipType);

				EquipData *newEquipData = new EquipData{
					resId,
					file.name,
					filePath,
					equipName,
					(EquipType) equipType
				};

				tinyxml2::XMLElement *charElement = doc.FirstChildElement("equip")->FirstChildElement("skills");
				for (tinyxml2::XMLElement* child = charElement->FirstChildElement(); child != NULL; child = child->NextSiblingElement())
				{
					const char* skillId = child->/*FirstChildElement("skill")->*/GetText();
					newEquipData->skillsIds.push_back(skillId);

				}

				ResourceManager::manager->equipDatas[resId] = newEquipData;

			}
			else {
				Game::game->showMsgBox("unrecognized xml");
				Game::game->showMsgBox(file.path);

			}
		}
	}

}

void ResourceManager::loadItems(std::string basePath) {}
void ResourceManager::loadMenu(std::string basePath) {

	const char *dataPath = basePath.append("menus/").c_str();
	tinydir_dir dir;
	int i;
	tinydir_open_sorted(&dir, dataPath);

	for (i = 0; i < dir.n_files; i++) {

		tinydir_file file;
		tinydir_readfile_n(&dir, &file, i);

		if (strcmp(file.extension, "xml") == 0) {

			tinyxml2::XMLDocument doc;
			doc.LoadFile(file.path);

			if (doc.FirstChildElement("menu")) {

				std::string resId = resIdFromPath(file.path);
				std::string filePath = removeFilenameFromPath(file.name, file.path);

				const char* name = doc.FirstChildElement("menu")->FirstChildElement("name")->GetText();
				const char* file = doc.FirstChildElement("menu")->FirstChildElement("file")->GetText();

				ResourceManager::manager->loadSprite(resId, filePath.append(file), true);

			}
			else {
				Game::game->showMsgBox("unrecognized xml");
				Game::game->showMsgBox(file.path);

			}
		}
	}

}
void ResourceManager::loadScripts(std::string basePath) {}

void ResourceManager::loadSkills(std::string basePath) {

	const char *dataPath = basePath.append("skills/").c_str();
	tinydir_dir dir;
	int i;
	tinydir_open_sorted(&dir, dataPath);

	for (i = 0; i < dir.n_files; i++) {

		tinydir_file file;
		tinydir_readfile_n(&dir, &file, i);

		if (strcmp(file.extension, "xml") == 0) {

			tinyxml2::XMLDocument doc;
			doc.LoadFile(file.path);

			if (doc.FirstChildElement("skill")) {

				std::string resId = resIdFromPath(file.path);
				std::string filePath = removeFilenameFromPath(file.name, file.path);

				const char* skillName = doc.FirstChildElement("skill")->FirstChildElement("name")->GetText();
				const char* skillScript = doc.FirstChildElement("skill")->FirstChildElement("script")->GetText();

				SkillData *newSkillData = new SkillData{
					resId,
					file.name,
					filePath,
					skillName,
					skillScript
				};

				ResourceManager::manager->skillDatas[resId] = newSkillData;
				ScriptManager::manager->injectResourceIdGlobal(resId);
				ScriptManager::manager->doFile(filePath.append(skillScript).c_str());
				ScriptManager::manager->removeResourceIdGlobal();

			}
			else {
				Game::game->showMsgBox("unrecognized xml");
				Game::game->showMsgBox(file.path);

			}
		}
	}

}

void ResourceManager::loadEnemies(std::string basePath) {

	const char *dataPath = basePath.append("enemies/").c_str();
	tinydir_dir dir;
	int i;
	tinydir_open_sorted(&dir, dataPath);

	for (i = 0; i < dir.n_files; i++) {

		tinydir_file file;
		tinydir_readfile_n(&dir, &file, i);

		if (strcmp(file.extension, "xml") == 0) {

			tinyxml2::XMLDocument doc;
			doc.LoadFile(file.path);

			if (doc.FirstChildElement("enemy")) {

				std::string resId = resIdFromPath(file.path);
				std::string filePath = removeFilenameFromPath(file.name, file.path);

				const char* enemyName = doc.FirstChildElement("enemy")->FirstChildElement("name")->GetText();
				const char* enemyScript = doc.FirstChildElement("enemy")->FirstChildElement("script")->GetText();

				int level;
				doc.FirstChildElement("enemy")->FirstChildElement("level")->QueryIntText(&level);

				int hp;
				doc.FirstChildElement("enemy")->FirstChildElement("hp")->QueryIntText(&hp);

				int atk;
				doc.FirstChildElement("enemy")->FirstChildElement("atk")->QueryIntText(&atk);

				int def;
				doc.FirstChildElement("enemy")->FirstChildElement("def")->QueryIntText(&def);

				int matk;
				doc.FirstChildElement("enemy")->FirstChildElement("matk")->QueryIntText(&matk);

				int mdef;
				doc.FirstChildElement("enemy")->FirstChildElement("mdef")->QueryIntText(&mdef);

				int mnd;
				doc.FirstChildElement("enemy")->FirstChildElement("mnd")->QueryIntText(&mnd);

				int spd;
				doc.FirstChildElement("enemy")->FirstChildElement("spd")->QueryIntText(&spd);

				int lck;
				doc.FirstChildElement("enemy")->FirstChildElement("lck")->QueryIntText(&lck);

				EnemyData *newEnemyData = new EnemyData{
					resId,
					file.name,
					filePath,
					enemyName,
					enemyScript,
					level,
					hp,
					atk,
					def,
					matk,
					mdef,
					mnd,
					spd,
					lck

				};

				ResourceManager::manager->enemyDatas[resId] = newEnemyData;
				ScriptManager::manager->injectResourceIdGlobal(resId);
				ScriptManager::manager->doFile(filePath.append(enemyScript).c_str());
				ScriptManager::manager->removeResourceIdGlobal();

			}
			else {
				Game::game->showMsgBox("unrecognized xml");
				Game::game->showMsgBox(file.path);

			}
		}
	}

}

void ResourceManager::loadSpritesheets(std::string basePath) {

	const char *dataPath = basePath.append("spritesheets/").c_str();
	tinydir_dir dir;
	int i;
	tinydir_open_sorted(&dir, dataPath);

	for (i = 0; i < dir.n_files; i++) {

		tinydir_file file;
		tinydir_readfile_n(&dir, &file, i);

		if (strcmp(file.extension, "xml") == 0) {

			tinyxml2::XMLDocument doc;
			doc.LoadFile(file.path);

			if (doc.FirstChildElement("spritesheet")) {

				std::string resId = resIdFromPath(file.path);
				std::string filePath = removeFilenameFromPath(file.name, file.path);

				const char* name = doc.FirstChildElement("spritesheet")->FirstChildElement("name")->GetText();
				const char* file = doc.FirstChildElement("spritesheet")->FirstChildElement("file")->GetText();

				ResourceManager::manager->loadSprite(resId, filePath.append(file), true);

			}
			else {
				Game::game->showMsgBox("unrecognized xml");
				Game::game->showMsgBox(file.path);

			}
		}
	}

}
void ResourceManager::loadTiles(std::string basePath) {

	const char *dataPath = basePath.append("tiles/").c_str();
	tinydir_dir dir;
	int i;
	tinydir_open_sorted(&dir, dataPath);

	for (i = 0; i < dir.n_files; i++) {

		tinydir_file file;
		tinydir_readfile_n(&dir, &file, i);

		if (strcmp(file.extension, "xml") == 0) {

			tinyxml2::XMLDocument doc;
			doc.LoadFile(file.path);

			if (doc.FirstChildElement("tile")) {

				std::string resId = resIdFromPath(file.path);
				std::string filePath = removeFilenameFromPath(file.name, file.path);

				const char* name = doc.FirstChildElement("tile")->FirstChildElement("name")->GetText();
				const char* file = doc.FirstChildElement("tile")->FirstChildElement("file")->GetText();

				ResourceManager::manager->loadSprite(resId, filePath.append(file), true);

			}
			else {
				Game::game->showMsgBox("unrecognized xml");
				Game::game->showMsgBox(file.path);

			}
		}
	}

}

void ResourceManager::loadEncounters(std::string basePath) {

	const char *dataPath = basePath.append("encounters/").c_str();
	tinydir_dir dir;
	int i;
	tinydir_open_sorted(&dir, dataPath);

	for (i = 0; i < dir.n_files; i++) {

		tinydir_file file;
		tinydir_readfile_n(&dir, &file, i);

		if (strcmp(file.extension, "xml") == 0) {

			tinyxml2::XMLDocument doc;
			doc.LoadFile(file.path);

			if (doc.FirstChildElement("encounter")) {

				std::string resId = resIdFromPath(file.path);
				std::string filePath = removeFilenameFromPath(file.name, file.path);

				const char* name = doc.FirstChildElement("encounter")->FirstChildElement("name")->GetText();
				const char* file = doc.FirstChildElement("encounter")->FirstChildElement("file")->GetText();

				ScriptManager::manager->injectResourceIdGlobal(resId);
				ScriptManager::manager->doFile(filePath.append(file).c_str());
				ScriptManager::manager->removeResourceIdGlobal();
			}
			else {
				Game::game->showMsgBox("unrecognized xml");
				Game::game->showMsgBox(file.path);

			}
		}
	}

}

void ResourceManager::loadDataFolder() {

	std::string basePath(SDL_GetBasePath());
	basePath.append("data/");
	basePath.append("base/");
	//walk(basePath);

	//borders folder
	loadBorders(basePath);
	loadDungeons(basePath);
	loadEntities(basePath);
	loadFonts(basePath);
	loadHeroes(basePath);
	loadEquips(basePath);
	loadItems(basePath);
	loadMenu(basePath);
	loadScripts(basePath);
	loadSkills(basePath);
	loadEnemies(basePath);
	loadSpritesheets(basePath);
	loadTiles(basePath);
	loadEncounters(basePath);

}

int Resource_getEntitySpriteId(lua_State *L) {

	std::string entityID = lua_tostring(L, 1);

	std::string spriteID = ResourceManager::manager->getEntityData(entityID)->data->spritesheet;

	lua_pushstring(L, spriteID.c_str());

	return 1;
}


text:
title: React Static Boilerplate
---

## Welcome!

This is a single-page application powered by React and Material Design Lite (MDL).

This is me.

```js
print()
```

https://github.com/kriasoft/react-static-boilerplate


text:
import { FC } from "react"
import { OnboardingFollows } from "../Components/OnboardingFollows"

export const OnboardingFollowGalleries: FC = () => {
  return <OnboardingFollows kind="galleries" />
}


text:
package org.kie.workbench.common.dmn.client.editors.types.listview;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;

import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.event.Event;
import javax.inject.Inject;

import com.google.gwt.event.dom.client.ClickEvent;
import elemental2.dom.Element;
import elemental2.dom.HTMLAnchorElement;
import elemental2.dom.HTMLButtonElement;
import elemental2.dom.HTMLDivElement;
import elemental2.dom.HTMLElement;
import elemental2.dom.NodeList;
import org.jboss.errai.ui.client.local.spi.TranslationService;
import org.jboss.errai.ui.shared.api.annotations.DataField;
import org.jboss.errai.ui.shared.api.annotations.EventHandler;
import org.jboss.errai.ui.shared.api.annotations.Templated;
import org.kie.workbench.common.dmn.api.editors.types.DataObject;
import org.kie.workbench.common.dmn.client.editors.common.messages.FlashMessage;
import org.kie.workbench.common.dmn.client.editors.types.common.DataType;
import org.kie.workbench.common.dmn.client.editors.types.common.ScrollHelper;
import org.kie.workbench.common.dmn.client.editors.types.imported.ImportDataObjectModal;
import org.kie.workbench.common.dmn.client.editors.types.listview.draganddrop.DNDListComponent;
import org.kie.workbench.common.stunner.core.client.ReadOnlyProvider;
import org.uberfire.client.views.pfly.selectpicker.ElementHelper;

import static org.kie.workbench.common.dmn.client.editors.common.messages.FlashMessage.Type.SUCCESS;
import static org.kie.workbench.common.dmn.client.editors.types.common.HiddenHelper.hide;
import static org.kie.workbench.common.dmn.client.editors.types.common.HiddenHelper.isHidden;
import static org.kie.workbench.common.dmn.client.editors.types.common.HiddenHelper.show;
import static org.kie.workbench.common.dmn.client.editors.types.listview.DataTypeListItemView.ARROW_BUTTON_SELECTOR;
import static org.kie.workbench.common.dmn.client.editors.types.listview.DataTypeListItemView.PARENT_UUID_ATTR;
import static org.kie.workbench.common.dmn.client.editors.types.listview.DataTypeListItemView.UUID_ATTR;
import static org.kie.workbench.common.dmn.client.editors.types.listview.common.ListItemViewCssHelper.isRightArrow;
import static org.kie.workbench.common.dmn.client.resources.i18n.DMNEditorConstants.DataTypeSuccessfullyImportedMessage_StrongMessage;
import static org.uberfire.client.views.pfly.selectpicker.ElementHelper.remove;

@Templated
@ApplicationScoped
public class DataTypeListView implements DataTypeList.View {

    @DataField("list-items")
    private final HTMLDivElement listItems;

    @DataField("placeholder")
    private final HTMLDivElement placeholder;

    @DataField("add-button")
    private final HTMLButtonElement addButton;

    @DataField("add-button-placeholder")
    private final HTMLButtonElement addButtonPlaceholder;

    @DataField("data-type-button")
    private final HTMLDivElement dataTypeButton;

    @DataField("search-bar-container")
    private final HTMLDivElement searchBarContainer;

    @DataField("expand-all")
    private final HTMLAnchorElement expandAll;

    @DataField("collapse-all")
    private final HTMLAnchorElement collapseAll;

    @DataField("no-data-types-found")
    private final HTMLDivElement noDataTypesFound;

    @DataField("read-only-message")
    private final HTMLDivElement readOnlyMessage;

    @DataField("read-only-message-close-button")
    private final HTMLButtonElement readOnlyMessageCloseButton;

    @DataField("import-data-object-button")
    private final HTMLButtonElement importDataObjectButton;

    private final ScrollHelper scrollHelper;

    private final ImportDataObjectModal importDataObjectModal;

    private final Event<FlashMessage> flashMessageEvent;

    private final TranslationService translationService;

    private final ReadOnlyProvider readOnlyProvider;

    private DataTypeList presenter;

    @Inject
    public DataTypeListView(final HTMLDivElement listItems,
                            final HTMLButtonElement addButton,
                            final HTMLButtonElement addButtonPlaceholder,
                            final HTMLDivElement dataTypeButton,
                            final HTMLDivElement placeholder,
                            final HTMLDivElement searchBarContainer,
                            final HTMLAnchorElement expandAll,
                            final HTMLAnchorElement collapseAll,
                            final HTMLDivElement noDataTypesFound,
                            final HTMLDivElement readOnlyMessage,
                            final HTMLButtonElement readOnlyMessageCloseButton,
                            final ScrollHelper scrollHelper,
                            final HTMLButtonElement importDataObjectButton,
                            final ImportDataObjectModal importDataObjectModal,
                            final Event<FlashMessage> flashMessageEvent,
                            final TranslationService translationService,
                            final ReadOnlyProvider readOnlyProvider) {
        this.listItems = listItems;
        this.addButton = addButton;
        this.addButtonPlaceholder = addButtonPlaceholder;
        this.dataTypeButton = dataTypeButton;
        this.placeholder = placeholder;
        this.searchBarContainer = searchBarContainer;
        this.expandAll = expandAll;
        this.collapseAll = collapseAll;
        this.noDataTypesFound = noDataTypesFound;
        this.readOnlyMessage = readOnlyMessage;
        this.readOnlyMessageCloseButton = readOnlyMessageCloseButton;
        this.scrollHelper = scrollHelper;
        this.importDataObjectButton = importDataObjectButton;
        this.importDataObjectModal = importDataObjectModal;
        this.flashMessageEvent = flashMessageEvent;
        this.translationService = translationService;
        this.readOnlyProvider = readOnlyProvider;
    }

    @Override
    public void init(final DataTypeList presenter) {
        this.presenter = presenter;

        setupSearchBar();
        importDataObjectModal.setup(this::importDataObjects);
        setupListElement();

        setupAddButtonReadOnlyStatus();
    }

    void setupAddButtonReadOnlyStatus() {
        addButton.disabled = readOnlyProvider.isReadOnlyDiagram();
    }

    void importDataObjects(final List<DataObject> imported) {
        presenter.importDataObjects(imported);

        if (!imported.isEmpty()) {
            fireSuccessfullyImportedData();
        }
    }

    void fireSuccessfullyImportedData() {
        flashMessageEvent.fire(new FlashMessage(SUCCESS,
                                                translationService.getTranslation(DataTypeSuccessfullyImportedMessage_StrongMessage),
                                                ""));
    }

    private void setupSearchBar() {
        searchBarContainer.appendChild(presenter.getSearchBar().getElement());
    }

    private void setupListElement() {
        listItems.appendChild(getDndListComponent().getElement());
    }

    private DNDListComponent getDndListComponent() {
        return presenter.getDNDListComponent();
    }

    @Override
    public void showOrHideNoCustomItemsMessage() {
        if (!hasCustomDataType()) {
            showPlaceHolder();
        } else {
            showListItems();
        }
    }

    boolean hasCustomDataType() {
        final NodeList<Element> childNodes = listItems.querySelectorAll("[" + UUID_ATTR + "]");
        return !Objects.isNull(childNodes) && childNodes.length > 0;
    }

    @Override
    public void addSubItems(final DataType dataType,
                            final List<DataTypeListItem> listItems) {

        Element parent = getDataTypeRow(dataType);

        for (final DataTypeListItem item : listItems) {

            final HTMLElement itemElement = item.getDragAndDropElement();

            hideItemElementIfParentIsCollapsed(itemElement, parent);

            ElementHelper.insertAfter(itemElement, parent);
            parent = itemElement;
        }

        showArrowIconIfDataTypeHasChildren(dataType);
        showOrHideNoCustomItemsMessage();
    }

    @EventHandler("expand-all")
    public void expandAll(final ClickEvent e) {
        presenter.expandAll();
    }

    @EventHandler("collapse-all")
    public void collapseAll(final ClickEvent e) {
        presenter.collapseAll();
    }

    @EventHandler({"add-button", "add-button-placeholder"})
    public void onAddButtonClick(final ClickEvent e) {
        scrollHelper.animatedScrollToBottom(listItems);
        presenter.addDataType();
    }

    @SuppressWarnings("unused")
    @EventHandler("import-data-object-button")
    public void onImportDataObjectClick(final ClickEvent e) {
        importDataObjectModal.show(presenter.getExistingDataTypesNames());
    }

    @EventHandler("read-only-message-close-button")
    public void onReadOnlyMessageCloseButtonClick(final ClickEvent e) {
        hide(readOnlyMessage);
    }

    void hideItemElementIfParentIsCollapsed(final HTMLElement itemElement,
                                            final Element parent) {

        final boolean isCollapsedParent = isCollapsed(parent.querySelector(ARROW_BUTTON_SELECTOR));
        final boolean isHiddenParent = isHidden(parent);

        if (isCollapsedParent || isHiddenParent) {
            hide(itemElement);
            getDndListComponent().setInitialHiddenPositionY(itemElement);
        } else {
            show(itemElement);
        }
    }

    void showArrowIconIfDataTypeHasChildren(final DataType dataType) {
        if (hasChildren(dataType)) {
            show(getDataTypeRow(dataType).querySelector(ARROW_BUTTON_SELECTOR));
        } else {
            hide(getDataTypeRow(dataType).querySelector(ARROW_BUTTON_SELECTOR));
        }
    }

    private boolean hasChildren(final DataType dataType) {
        return listItems.querySelectorAll("[" + PARENT_UUID_ATTR + "=\"" + dataType.getUUID() + "\"]").length > 0;
    }

    @Override
    public void removeItem(final DataType dataType) {

        cleanSubTypes(dataType.getUUID());

        final Optional<Element> dataTypeRow = Optional.ofNullable(getDataTypeRow(dataType));

        dataTypeRow.ifPresent(this::removeDataTypeRow);

        showOrHideNoCustomItemsMessage();
    }

    @Override
    public void cleanSubTypes(final DataType dataType) {
        cleanSubTypes(dataType.getUUID());
    }

    void cleanSubTypes(final String uuid) {

        final String selector = "[" + PARENT_UUID_ATTR + "=\"" + uuid + "\"]";
        final NodeList<Element> subDataTypeRows = listItems.querySelectorAll(selector);

        for (int i = 0; i < subDataTypeRows.length; i++) {
            final Element item = subDataTypeRows.getAt(i);
            if (item != null && item.parentNode != null) {
                cleanSubTypes(item.getAttribute(UUID_ATTR));
                removeDataTypeRow(item);
            }
        }
    }

    private void removeDataTypeRow(final Element item) {
        presenter.removeItem(item.getAttribute(UUID_ATTR));
        remove(item);
    }

    @Override
    public void insertBelow(final DataTypeListItem listItem,
                            final DataType reference) {

        final Element elementReference = getLastSubDataTypeElement(reference);
        ElementHelper.insertAfter(listItem.getDragAndDropElement(), elementReference);
        setNewElementYPosition(elementReference, listItem.getDragAndDropElement());
    }

    @Override
    public void insertAbove(final DataTypeListItem listItem,
                            final DataType reference) {

        final Element elementReference = getDataTypeRow(reference);
        ElementHelper.insertBefore(listItem.getDragAndDropElement(), elementReference);
        setNewElementYPosition(elementReference, listItem.getDragAndDropElement());
    }

    void setNewElementYPosition(final Element elementReference,
                                final Element newElement) {
        final int referencePosition = getDndListComponent().getPositionY(elementReference);
        getDndListComponent().setPositionY(newElement, referencePosition);
    }

    private boolean isCollapsed(final Element arrow) {
        return isRightArrow(arrow);
    }

    Element getDataTypeRow(final DataType dataType) {
        return listItems.querySelector("[" + UUID_ATTR + "=\"" + dataType.getUUID() + "\"]");
    }

    Element getLastSubDataTypeElement(final DataType reference) {
        return getLastSubDataTypeElement(getDataTypeRow(reference));
    }

    Element getLastSubDataTypeElement(final Element element) {

        final String parentUUID = element.getAttribute(UUID_ATTR);
        final List<Element> nestedElements = getNestedElements(parentUUID);

        if (nestedElements.isEmpty()) {
            return element;
        } else {
            return getLastSubDataTypeElement(nestedElements.get(nestedElements.size() - 1));
        }
    }

    private List<Element> getNestedElements(final String parentUUID) {

        final String selector = "[" + PARENT_UUID_ATTR + "=\"" + parentUUID + "\"]";
        final NodeList<Element> nestedElements = listItems.querySelectorAll(selector);
        final List<Element> list = new ArrayList<>();

        for (int i = 0; i < nestedElements.length; i++) {
            final Element element = nestedElements.getAt(i);
            final boolean isVisible = getDndListComponent().getPositionY(element) > -1;
            if (isVisible) {
                list.add(element);
            }
        }

        return list;
    }

    @Override
    public void showNoDataTypesFound() {
        show(noDataTypesFound);
        hide(placeholder);
        hide(listItems);
    }

    void showListItems() {
        hide(noDataTypesFound);
        hide(placeholder);
        show(dataTypeButton);
        show(listItems);
    }

    void showPlaceHolder() {
        hide(noDataTypesFound);
        show(placeholder);
        hide(dataTypeButton);
        hide(listItems);
    }

    @Override
    public void showReadOnlyMessage(final boolean show) {
        if (show) {
            show(readOnlyMessage);
        } else {
            hide(readOnlyMessage);
        }
    }

    @Override
    public HTMLDivElement getListItems() {
        return listItems;
    }

    @Override
    public void showImportDataObjectButton() {
        show(importDataObjectButton);
    }

    @Override
    public void hideImportDataObjectButton() {
        hide(importDataObjectButton);
    }
}


text:
import scala.Stream.*

object consistencyError {
  /* this gives an error:
  Consistency problem compiling (virtual file)!
  Trying to call method body%1(List(scala.collection.immutable.Stream[A])) with arguments (List(tp2, temp6, temp5))
      case (l #:: ls, rs) => None
                              ^
  scala.tools.nsc.symtab.Types$TypeError: too many arguments for method body%1: (val rs: scala.collection.immutable.Stream[A])None.type

  two errors found
  vss(0) =
  args = List(tp2, temp6, temp5)
  vss(1) = value rs, value ls, value l
  args = List(tp2, temp6, temp5)
  targets(0) = FinalState(,scala.None)
  targets(1) = FinalState(,scala.None)
  labels(1) = method body%1
  labels(0) = method body%0
  bx = 1
  label.tpe = (val rs: scala.collection.immutable.Stream[A])None.type
  */
  def crash[A](lefts: Stream[A], rights: Stream[A]) = (lefts, rights) match {
    case (Stream.Empty, Stream.Empty) => None
    case (l #:: ls, rs) => None
  }

  // These work
  // def works1[A](lefts: Stream[A]) = lefts match {
  //   case Stream.Empty => None
  //   case l #:: ls => None
  // }
  //
  // def works2[A](lefts: Stream[A], rights: Stream[A]) = (lefts, rights) match {
  //   case (Stream.Empty, Stream.Empty) => None
  //   case (ls, rs) => None
  // }
}


text:
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model app\modules\user\models\LoginLogs */
/* @var $form yii\widgets\ActiveForm */
?>

    <?php $form = ActiveForm::begin(); ?>

    <?= $form->field($model, 'uid')->textInput() ?>

    <?= $form->field($model, 'status')->textInput() ?>

    <?= $form->field($model, 'login_time')->textInput() ?>

    <?= $form->field($model, 'login_ip')->textInput(['maxlength' => true]) ?>

        <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>

    <?php ActiveForm::end(); ?>


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>NationStates++ Blog</title>
    <link href="https://nationstatesplusplus.net/assets/css/bootstrap.css" rel="stylesheet">
	<link rel="icon" type="image/ico" href="https://nationstatesplusplus.net/favicon.ico?v=1"/>

    <link href="https://nationstatesplusplus.net/jumbotron.css?v=1" rel="stylesheet">
	<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">

          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">

          </button>
          NationStates++

Newspapers

World Assembly

Happenings

Blog

NSWiki Development: 1-31-2014

by Jenlom

Completed:

Efforts so far have focused on the installation and setting up of the MediaWiki software, getting a logical system set up to contain the
				nation articles, region articles, and articles related to other subjects of interest. Afforess has been hard at work writing a bot which takes
				data from the daily NS dumps, as well as shards, crunches the numbers and then writes the articles to NSWiki.

				As you will be aware, a first sweep of the regions has already been completed, and we have a number of ideas for further information we can add
				particularly around embassies, comments on trends within the region (for example comparing the number of nations in the region before and after
				updates to comment on the regional population growth (or shrinkage) and other such useful information.

Next steps:

				The next priority however is to work on nation pages, which will be more complicated but work under a broadly similar system as the region pages
				. Clearly there is more to be said on the subject of nations than of regions, and it is important that given the massive number of nations that
				there is enough variety in the articles to keep NSWiki interesting.

				We are also looking into a new theme for NSWiki, as opposed to the current basic MediaWiki theme. Using a Bootstrap 3-compatible theme means
				we can use nicer formatting on our pages that will work for any sized-browser, and also bring it into line with the theme used on NSWiki.

				Also, a priority of mine is to start writing the help pages that will ensure we have a constant style across NSWiki, and the inclusion of
				pages on linking between nation, region and article pages will hopefully ensure
				contributors are linking in an efficient and visually-pleasing way.

				We are also setting up a features suggestion system, located on our: UserVoice page.

Incident Report: 1/23/2014 - 2/23/2014

by Afforess

What Happened:

On January 23rd, [violet] added Dispatches, a more advanced type of factbook, to NationStates.
				As part of the usual round of bug fixing process I was poking around how exactly dispatches work. I was testing some changes to
				the code that involves how dispatches are upvoted and downvoted. When you upvote or downvote a particular dispatch, your browser is
				making a request to a location that may look like this:

http://www.nationstates.net/page=ajax2/a=setendo/id=210646/v=-1/localid=i3cf8XpWmiWEB

				I was writing some javascript to add upvote / downvote arrows on page's national happenings, where it shows a dispatch is published. In the process
				some test code that I had written for a dispatch was accidentally released and downloaded by about 30 players before it was reverted. As a result,
				each of these players that downloaded this code, all upvoted the dispatch I had written for testing.

After this incident occurred, I stopped what I was working on to ensure that the released patch was taken down and not downloaded by additional users.
					The code was only available for a fewer than 10 seconds.

Why This Happened:

Normally new development for NationStates++ updates occurs in a separate location than where the live, production codebase lives. Due to the rushed nature of the 2.2x series
				of releases (as a result of changes to the NationStates site), I never set up a new development environment for 2.3.x releases.

What Has Been Changed:

I have taken steps to ensure that future NationStates++ development does not interfere with the live codebase. If I had followed my normal procedures, this incident would not
				have been possible.

Previously, NationStates++ would load some code on demand from my server. This is where the contamination occurred. NationStates++ no longer loads code from any remote server, and
				the extension is completely self-contained. This prevents any future occurrence of this problem.

In addition, NationStates++ now uses https:// instead of http:// to make requests for additional content.

NationStates++, Licensed MIT, 2014

Install NS++

·

GitHub

·

About

·

Privacy

·

Terms Of Service

·

Blog

·


text:
const http = require('http');

class Rest {
  constructor(agent, options) {
    this.agent = agent;
    this.host = options.host;
    this.port = options.port;
  }

  get(key, options, callback) {
    let opt;
    let cb;

    if (typeof options === 'function') {
      opt = {};
      cb = options;
    } else {
      opt = options;
      cb = callback;
    }

    const requestOptions = {
      hostname: this.host,
      port: this.port,
      path: this._buildPath(key, opt.db),
      method: 'GET',
      agent: this.agent,
    };

    http.request(requestOptions, (res) => {
      const bufs = [];
      let bufLength = 0;
      let str = '';

      res.on('data', (chunk) => {
        if (!Buffer.isBuffer(chunk)) {
          str += chunk;
        } else if (chunk.length) {
          bufs.push(chunk);
          bufLength += chunk.length;
        }
      });

      res.on('end', () => {
        if (res.statusCode === 200) {
          let expire;
          let ret;

          if (res.headers.hasOwnProperty('x-kt-xt')) {
            expire = new Date(res.headers['x-kt-xt']);
          }

          if (bufLength) {
            const buf = Buffer.concat(bufs, bufLength);
            if (typeof opt.encoding === 'undefined' || opt.encoding === null) {
              ret = buf.toString();
            } else if (opt.encoding === 'binary') {
              ret = buf;
            } else {
              ret = buf.toString(opt.encoding);
            }
          } else {
            ret = str;
          }
          cb(undefined, ret, expire);
        } else if (res.statusCode === 404) {
          cb('No record was found');
        } else {
          cb('Connection error');
        }
      });
    }).on('error', () => {
      cb('Connection error');
    }).end();
  }

  set(key, value, options, callback) {
    this._put(key, value, 'set', options, callback);
  }

  add(key, value, options, callback) {
    this._put(key, value, 'add', options, callback);
  }

  replace(key, value, options, callback) {
    this._put(key, value, 'replace', options, callback);
  }

  remove(key, options, callback) {
    let opt;
    let cb;

    if (typeof options === 'function') {
      opt = {};
      cb = options;
    } else {
      opt = options;
      cb = callback;
    }

    const requestOptions = {
      hostname: this.host,
      port: this.port,
      path: this._buildPath(key, opt.db),
      method: 'DELETE',
      agent: this.agent,
    };

    http.request(requestOptions, (res) => {
      res.on('data', () => {});

      res.on('end', () => {
        if (res.statusCode === 204) {
          cb();
        } else if (res.statusCode === 404) {
          cb('No record was found');
        } else {
          cb('Connection error');
        }
      });
    }).on('error', () => {
      cb('Connection error');
    }).end();
  }

  _put(key, value, mode, options, callback) {
    let val;
    let opt;
    let cb;
    const header = {};
    let encoding = 'utf8';

    if (typeof options === 'function') {
      opt = {};
      cb = options;
    } else {
      opt = options;
      cb = callback;
    }

    if (typeof value === 'string') {
      val = value;
      if (typeof opt.encoding !== 'undefined') {
        ({ encoding } = opt);
      }
      header['Content-Length'] = Buffer.byteLength(val, encoding);
    } else if (typeof value === 'number') {
      val = value.toString();
      header['Content-Length'] = Buffer.byteLength(val);
    } else if (Buffer.isBuffer(value)) {
      val = value;
      header['Content-Length'] = val.length;
    } else {
      val = JSON.stringify(value);
      header['Content-Length'] = Buffer.byteLength(val);
    }

    header['X-Kt-Mode'] = mode;

    if (opt.hasOwnProperty('expire')) {
      const date = new Date();
      date.setSeconds(date.getSeconds() + opt.expire);
      header['X-Kt-Xt'] = date.toUTCString();
    }

    const requestOptions = {
      hostname: this.host,
      port: this.port,
      path: this._buildPath(key, opt.db),
      headers: header,
      method: 'PUT',
      agent: this.agent,
    };

    http.request(requestOptions, (res) => {
      res.on('data', () => {});

      res.on('end', () => {
        if (res.statusCode === 201) {
          cb();
        } else {
          cb('Connection error');
        }
      });
    }).on('error', () => {
      cb('Connection error');
    }).end(val, encoding);
  }

  _buildPath(key, db) {
    if (typeof db !== 'undefined' && db !== null) {
      return `/${encodeURIComponent(db)}/${encodeURIComponent(key)}`;
    }
    return `/${encodeURIComponent(key)}`;
  }
}

module.exports = Rest;


text:
package unittests;

import com.tjazi.security.core.service.core.SecurityProfilePersisterImpl;
import com.tjazi.security.core.service.dao.UserSecurityDAO;
import com.tjazi.security.core.service.dao.model.UserSecurityDAODataModel;
import com.tjazi.security.messages.RegisterNewUserCredentialsRequestCommand;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;

import java.util.Collections;
import java.util.UUID;

import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.*;

/**
 * Created by Krzysztof Wasiak on 11/11/2015.
 */

@RunWith(MockitoJUnitRunner.class)
public class SecurityProfilePersister_Tests {

    @Rule
    public ExpectedException thrown = ExpectedException.none();

    @InjectMocks
    public SecurityProfilePersisterImpl securityProfilePersister;

    @Mock
    public UserSecurityDAO securityDAO;

    @Test
    public void registerNewProfileCredentials_ExceptionOnNullInput_Test() throws Exception {

        thrown.expect(IllegalArgumentException.class);
        thrown.expectMessage("requestMessage is null");

        securityProfilePersister.registerNewProfileCredentials(null);
    }

    @Test
    public void registerNewProfileCredentials_ExceptionOnNullProfileUuid_Test() throws Exception {

        thrown.expect(IllegalArgumentException.class);
        thrown.expectMessage("requestMessage.ProfileUUID is null");

        RegisterNewUserCredentialsRequestCommand requestMessage = new RegisterNewUserCredentialsRequestCommand();
        requestMessage.setPasswordHash("password hash");
        requestMessage.setProfileUuid(null);

        securityProfilePersister.registerNewProfileCredentials(requestMessage);
    }

    @Test
    public void registerNewProfileCredentials_ExceptionOnNullOrEmptyPasswordHash_Test() throws Exception {

        thrown.expect(IllegalArgumentException.class);
        thrown.expectMessage("requestMessage.PasswordHash is null or empty");

        RegisterNewUserCredentialsRequestCommand requestMessage = new RegisterNewUserCredentialsRequestCommand();
        requestMessage.setPasswordHash(null);
        requestMessage.setProfileUuid(UUID.randomUUID());

        securityProfilePersister.registerNewProfileCredentials(requestMessage);
    }

    @Test
    public void registerNewProfileCredentials_ExceptionWhenCallingDatabase_Test() throws Exception {

        final UUID profileUuid = UUID.randomUUID();
        final String passwordHash = "password hash";

        when(securityDAO.findByProfileUuid(profileUuid))
                .thenThrow(Exception.class);

        RegisterNewUserCredentialsRequestCommand requestMessage = new RegisterNewUserCredentialsRequestCommand();
        requestMessage.setPasswordHash(passwordHash);
        requestMessage.setProfileUuid(profileUuid);

        thrown.expect(Exception.class);

        // main function call
        boolean responseStatus = securityProfilePersister.registerNewProfileCredentials(requestMessage);

        verify(securityDAO, times(1)).findByProfileUuid(profileUuid);
    }

    @Test
    public void registerNewProfileCredentials_DuplicateRecordFound_Test() throws Exception {

        final UUID profileUuid = UUID.randomUUID();
        final String passwordHash = "password hash";

        when(securityDAO.findByProfileUuid(profileUuid))
                .thenReturn(Collections.<UserSecurityDAODataModel>singletonList(new UserSecurityDAODataModel()));

        RegisterNewUserCredentialsRequestCommand requestMessage = new RegisterNewUserCredentialsRequestCommand();
        requestMessage.setPasswordHash(passwordHash);
        requestMessage.setProfileUuid(profileUuid);

        thrown.expect(IllegalArgumentException.class);

        // main function call
        securityProfilePersister.registerNewProfileCredentials(requestMessage);

        // assertion / validation
        ArgumentCaptor<UserSecurityDAODataModel> daoRecordCaptor = ArgumentCaptor.forClass(UserSecurityDAODataModel.class);

        verify(securityDAO, times(1)).findByProfileUuid(profileUuid);
        verify(securityDAO, times(0)).save(daoRecordCaptor.capture());
    }

    @Test
    public void registerNewProfileCredentials_RecordSavedSuccesfully_Test() throws Exception {
        final UUID profileUuid = UUID.randomUUID();
        final String passwordHash = "password hash";

        when(securityDAO.findByProfileUuid(profileUuid))
                .thenReturn(Collections.<UserSecurityDAODataModel>emptyList());

        RegisterNewUserCredentialsRequestCommand requestMessage = new RegisterNewUserCredentialsRequestCommand();
        requestMessage.setPasswordHash(passwordHash);
        requestMessage.setProfileUuid(profileUuid);

        // main function call
        boolean responseStatus = securityProfilePersister.registerNewProfileCredentials(requestMessage);

        // assertion / validation
        ArgumentCaptor<UserSecurityDAODataModel> daoRecordCaptor = ArgumentCaptor.forClass(UserSecurityDAODataModel.class);

        verify(securityDAO, times(1)).findByProfileUuid(profileUuid);
        verify(securityDAO, times(1)).save(daoRecordCaptor.capture());

        assertEquals(true, responseStatus);

        assertEquals(profileUuid, daoRecordCaptor.getValue().getProfileUuid());
        assertEquals(passwordHash, daoRecordCaptor.getValue().getPasswordHash());
    }
}


text:
package com.microsoft.azure.management.appplatform.v2020_07_01.implementation;

import com.microsoft.azure.management.appplatform.v2020_07_01.MonitoringSettingProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.microsoft.azure.ProxyResource;

/**
 * Monitoring Setting resource.
 */
public class MonitoringSettingResourceInner extends ProxyResource {
    /**
     * Properties of the Monitoring Setting resource.
     */
    @JsonProperty(value = "properties")
    private MonitoringSettingProperties properties;

    /**
     * Get properties of the Monitoring Setting resource.
     *
     * @return the properties value
     */
    public MonitoringSettingProperties properties() {
        return this.properties;
    }

    /**
     * Set properties of the Monitoring Setting resource.
     *
     * @param properties the properties value to set
     * @return the MonitoringSettingResourceInner object itself.
     */
    public MonitoringSettingResourceInner withProperties(MonitoringSettingProperties properties) {
        this.properties = properties;
        return this;
    }

}