text:
<dc.Html Title="Media Properties" AuthTags="Admin,Editor">
	<dc.Body>
		<dc.PagePanel>
			<dcf.Form>
				<dcf.FormButtons>
					<dcf.SubmitButton Label="Save" />
				</dcf.FormButtons>

				<dcf.Text Name="Title" Label="Title" />
				<dcf.Text Name="Max" Label="Max" placeholder="if set, will show only the top N images (N = Max)" />
				<dcf.Text Name="ListId" Label="List Id" />
				<dcf.Text Name="Class" Label="CSS Classes" placeholder="custom styling for this section" />
				<dcf.Text Name="Lang" Label="Language" placeholder="blank for default - es = Spanish, en = English, etc" />
				<dcf.YesNo Name="Hidden" Label="Hidden" />
			</dcf.Form>
		</dc.PagePanel>
	</dc.Body>
	<dc.Function Name="Load"><![CDATA[
			var entry = this;
    ]]></dc.Function>
	<dc.Function Name="LoadRecord" Params="e"><![CDATA[
			var entry = this;

		    var ctxparams = dc.pui.App.Context.Params;

			var params = $.extend(true, { }, ctxparams.Part);

			params.Section = ctxparams.Section.Id;

			if (dc.pui.App.Context.IsNew) {
				e.Data = $.extend(true, { }, ctxparams.Section);
			}
			else {
				e.Message = {
					Service: 'dcmCore',
					Feature: 'Feeds',
					Op: 'LoadFeedSection',
					Body: params
				};
			}
    ]]></dc.Function>
	<dc.Function Name="AfterLoadRecord" Params="e"><![CDATA[
			var entry = this;

			entry.Store.Data = e.Data;

			e.Data = e.Data.Params;
	]]></dc.Function>
	<dc.Function Name="SaveRecord" Params="e"><![CDATA[
			var entry = this;

			// copy the section context
			var params = $.extend(true, { }, dc.pui.App.Context.Params);

			// store the copy of the section we loaded
			$.extend(params.Section, entry.Store.Data);

			// but include in Params any additions we have from Saving
			params.Section.Params = $.extend({ }, params.Section.Params, e.Data);

			Object.getOwnPropertyNames(params).forEach(function(name) {
				if (name != 'Action' && name != 'Part' && name != 'Section')
					delete params[name];
			});

			params.Action.Publish = true;

			e.Message = {
				Service: 'dcmCore',
				Feature: 'Feeds',
				Op: 'AlterFeedSection',
				Body: params
			};
    ]]></dc.Function>
	<dc.Function Name="AfterSaveRecord" Params="e"><![CDATA[
			var entry = this;

			dc.pui.App.Context.IsNew = false;

			// switch insert actions into edits
		    dc.pui.App.Context.Params.Action = {
		    	Op: 'Edit'
		    };
	]]></dc.Function>
	<dc.Function Name="AfterSave"><![CDATA[
			dc.pui.Popup.alert('Saved');
	]]></dc.Function>
	<dc.Function Name="DoSelectShow"><![CDATA[
			var entry = this;

		    dc.pui.Dialog.loadPage('/dcm/cms/galleries/ShowChooser', {
				Callback: function(res) {
					if (res.Shows && res.Shows.length) {
						var fh = res.Shows[0];

						entry.form().setValue('Path', fh.Path);
						entry.form().setValue('Show', fh.Show);
					}
				}
			});
    ]]></dc.Function>
</dc.Html>


text:
const postcssImport = require('postcss-import');
const nesting = require('postcss-nesting');
const autoprefixer = require('autoprefixer');
const csswring = require('csswring');

module.exports = {
  plugins: [
    postcssImport(),
    nesting(),
    autoprefixer({
      browsers: [
        'last 1 version',
        'not ie <= 11',
        'not ie_mob <= 11',
      ],
    }),
    csswring(),
  ],
};

redpajama_set_name: RedPajamaGithub


text:
import {Component, OnInit, ViewChild} from "@angular/core";
import {MonthYearPicker} from "../../../shared/components/month_year_picker/month_year_picker.component";
import {CrudService} from "../../../services/crud.service";
import {RasvetaPotrosnjaTrafo} from "./potrosnja_trafo.data";

@Component({
  selector: 'izvestaj_rasveta_godisnja_potrosnja',
  templateUrl: 'potrosnja_trafo.component.html'
})
export class IzvRasPotTrafoComponent implements OnInit {
  @ViewChild(MonthYearPicker)
  private m: MonthYearPicker;

  trafoiId: any[];

  podaci: RasvetaPotrosnjaTrafo[];

  constructor(private crudService: CrudService) {

  }

  ngOnInit(){

  }

  upisiTrafoe(trafoiId: any[]) {
    this.trafoiId = trafoiId;
  }

  formirajIzvestaj(){

      this.crudService.getData("izvestaj/ras_pot_po_traf?trafo_id="+this.trafoiId+"&datum_od="+'15'+'.'+this.m.mesOd+'.'+this.m.godOd+"&datum_do="+'15'+'.'+this.m.mesDo+'.'+this.m.godDo).subscribe(
        data => {this.podaci = data; console.log(data);},
        error => {console.log(error);}
      );
  }

}


text:
#include <linux/termios.h>
#include <linux/slab.h>
#include <linux/diagchar.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <mach/usbdiag.h>
#include "diagchar.h"
#include "diagfwd.h"
#include "diagfwd_smux.h"
#include "diagfwd_hsic.h"
#include "diagfwd_bridge.h"

void diag_smux_event(void *priv, int event_type, const void *metadata)
{
	unsigned char *rx_buf;
	int len;

	switch (event_type) {
	case SMUX_CONNECTED:
		pr_info("diag: SMUX_CONNECTED received\n");
		driver->smux_connected = 1;
		driver->in_busy_smux = 0;
		/* read data from USB MDM channel & Initiate first write */
		queue_work(diag_bridge[SMUX].wq,
			   &diag_bridge[SMUX].diag_read_work);
		break;
	case SMUX_DISCONNECTED:
		driver->smux_connected = 0;
		driver->lcid = LCID_INVALID;
		msm_smux_close(LCID_VALID);
		pr_info("diag: SMUX_DISCONNECTED received\n");
		break;
	case SMUX_WRITE_DONE:
		pr_debug("diag: SMUX Write done\n");
		break;
	case SMUX_WRITE_FAIL:
		pr_info("diag: SMUX Write Failed\n");
		break;
	case SMUX_READ_FAIL:
		pr_info("diag: SMUX Read Failed\n");
		break;
	case SMUX_READ_DONE:
		len = ((struct smux_meta_read *)metadata)->len;
		rx_buf = ((struct smux_meta_read *)metadata)->buffer;
		driver->write_ptr_mdm->length = len;
		diag_device_write(driver->buf_in_smux, SMUX_DATA,
						 driver->write_ptr_mdm);
		break;
	};
}

int diagfwd_write_complete_smux(void)
{
	pr_debug("diag: clear in_busy_smux\n");
	driver->in_busy_smux = 0;
	return 0;
}

int diagfwd_read_complete_smux(void)
{
	queue_work(diag_bridge[SMUX].wq, &diag_bridge[SMUX].diag_read_work);
	return 0;
}

int diag_get_rx_buffer(void *priv, void **pkt_priv, void **buffer, int size)
{
	if (!driver->in_busy_smux) {
		*pkt_priv = (void *)0x1234;
		*buffer = driver->buf_in_smux;
		pr_debug("diag: set in_busy_smux as 1\n");
		driver->in_busy_smux = 1;
	} else {
		pr_debug("diag: read buffer for SMUX is BUSY\n");
		return -EAGAIN;
	}
	return 0;
}

void diag_usb_read_complete_smux_fn(struct work_struct *w)
{
	diagfwd_read_complete_bridge(diag_bridge[SMUX].usb_read_ptr);
}

void diag_read_usb_smux_work_fn(struct work_struct *work)
{
	int ret;

	if (driver->diag_smux_enabled) {
		if (driver->lcid && diag_bridge[SMUX].usb_buf_out &&
			(diag_bridge[SMUX].read_len > 0) &&
				driver->smux_connected) {
			ret = msm_smux_write(driver->lcid, NULL,
			      diag_bridge[SMUX].usb_buf_out,
				 diag_bridge[SMUX].read_len);
			if (ret)
				pr_err("diag: writing to SMUX ch, r = %d, lcid = %d\n",
						 ret, driver->lcid);
		}
		diag_bridge[SMUX].usb_read_ptr->buf =
					 diag_bridge[SMUX].usb_buf_out;
		diag_bridge[SMUX].usb_read_ptr->length = USB_MAX_OUT_BUF;
		diag_bridge[SMUX].usb_read_ptr->context = (void *)SMUX;
		usb_diag_read(diag_bridge[SMUX].ch,
					 diag_bridge[SMUX].usb_read_ptr);
		return;
	}
}

static int diagfwd_smux_runtime_suspend(struct device *dev)
{
	dev_dbg(dev, "pm_runtime: suspending...\n");
	return 0;
}

static int diagfwd_smux_runtime_resume(struct device *dev)
{
	dev_dbg(dev, "pm_runtime: resuming...\n");
	return 0;
}

static const struct dev_pm_ops diagfwd_smux_dev_pm_ops = {
	.runtime_suspend = diagfwd_smux_runtime_suspend,
	.runtime_resume = diagfwd_smux_runtime_resume,
};

int diagfwd_connect_smux(void)
{
	void *priv = NULL;
	int ret = 0;

	if (driver->lcid == LCID_INVALID) {
		ret = msm_smux_open(LCID_VALID, priv, diag_smux_event,
						 diag_get_rx_buffer);
		if (!ret) {
			driver->lcid = LCID_VALID;
			msm_smux_tiocm_set(driver->lcid, TIOCM_DTR, 0);
			pr_info("diag: open SMUX ch, r = %d\n", ret);
		} else {
			pr_err("diag: failed to open SMUX ch, r = %d\n", ret);
			return ret;
		}
	}
	/* Poll USB channel to check for data*/
	queue_work(diag_bridge[SMUX].wq, &(diag_bridge[SMUX].diag_read_work));
	return ret;
}

static int diagfwd_smux_probe(struct platform_device *pdev)
{
	int ret = 0;

	pr_info("diag: SMUX probe called\n");
	driver->lcid = LCID_INVALID;
	driver->diag_smux_enabled = 1;
	if (driver->buf_in_smux == NULL) {
		driver->buf_in_smux = kzalloc(IN_BUF_SIZE, GFP_KERNEL);
		if (driver->buf_in_smux == NULL)
			goto err;
	}
	/* Only required for Local loopback test
	 * ret = msm_smux_set_ch_option(LCID_VALID,
				 SMUX_CH_OPTION_LOCAL_LOOPBACK, 0);
	 * if (ret)
	 *	pr_err("diag: error setting SMUX ch option, r = %d\n", ret);
	 */
	if (driver->write_ptr_mdm == NULL)
		driver->write_ptr_mdm = kzalloc(sizeof(struct diag_request),
								 GFP_KERNEL);
	if (driver->write_ptr_mdm == NULL)
		goto err;
	ret = diagfwd_connect_smux();
	return ret;

err:
	pr_err("diag: Could not initialize SMUX buffer\n");
	kfree(driver->buf_in_smux);
	return ret;
}

static int diagfwd_smux_remove(struct platform_device *pdev)
{
	driver->lcid = LCID_INVALID;
	driver->smux_connected = 0;
	driver->diag_smux_enabled = 0;
	driver->in_busy_smux = 1;
	kfree(driver->buf_in_smux);
	driver->buf_in_smux = NULL;
	return 0;
}

struct platform_driver msm_diagfwd_smux_driver = {
	.probe = diagfwd_smux_probe,
	.remove = diagfwd_smux_remove,
	.driver = {
		   .name = "SMUX_DIAG",
		   .owner = THIS_MODULE,
		   .pm   = &diagfwd_smux_dev_pm_ops,
		   },
};


text:
//
//  DiscoverViewController.m
//  微博
//
//  Created by CLAY on 16/5/12.
//  Copyright © 2016年 CLAY. All rights reserved.
//

#import "DiscoverViewController.h"
#import "NearByViewController.h"

@interface DiscoverViewController ()

@end

@implementation DiscoverViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    //调用父类方法 设置导航两侧按钮
    [self setBothSidesNavItem];

    //设置两个CLAYLabel颜色
    [self _changeLabelColor];

}

- (void)_changeLabelColor{
    _weiboLabel.color = @"Timeline_Name_color";
    _peopleLabel.color = @"Timeline_Name_color";
}

- (IBAction)nearbyWeibo:(id)sender {
    NearByViewController *near = [[NearByViewController alloc] init];
    [self.navigationController pushViewController:near animated:YES];

}
- (IBAction)nearbyPeople:(id)sender {
    NearByViewController *near = [[NearByViewController alloc] init];
    [self.navigationController pushViewController:near animated:YES];

}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end


text:
package org.apache.commons.feedparser;

/**
 * Should be called prior to all use of a FeedParser.  We reserve the right to
 * change the underlying implementation of the FeedParser in the future for
 * performance reasons.
 *
 * @author Kevin A. Burton (burtonator)
 * @version $Id: FeedParserFactory.java 155416 2005-02-26 13:00:10Z dirkv $
 */
public class FeedParserFactory {

    public static FeedParser newFeedParser() throws FeedParserException {

        //NOTE: design.  This should be a factory method which maps interface
        //name to classname implementation.

        try {

            return (FeedParser)new FeedParserImpl();

        } catch ( Throwable t ) { throw new FeedParserException( t ); }
    }

}


text:
<?php

namespace Magento\Dhl\Model\Source\Method;

/**
 * Source model for DHL shipping methods for documentation
 */
class Freedoc extends \Magento\Dhl\Model\Source\Method\AbstractMethod
{
    /**
     * Carrier Product Type Indicator
     *
     * @var string $_contentType
     */
    protected $_contentType = \Magento\Dhl\Model\Carrier::DHL_CONTENT_TYPE_DOC;

    /**
     * Show 'none' in methods list or not;
     *
     * @var bool
     */
    protected $_noneMethod = true;
}


text:
if platform_family?("rhel")
    include_recipe "yum"

    package "epel-release" do
        action :purge
        only_if "rpm -q epel-release"
    end

    yum_repository "epel" do
        description "EPEL repo"
        mirrorlist "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-#{node["epel"]["version"]}&arch=$basearch"
        gpgkey "http://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{node["epel"]["version"]}"
        action :create
    end
end


text:
package stage

import (
	"github.com/watermint/toolbox/infra/control/app_control"
	"github.com/watermint/toolbox/infra/data/da_griddata"
	"github.com/watermint/toolbox/infra/recipe/rc_exec"
	"github.com/watermint/toolbox/infra/recipe/rc_recipe"
	"github.com/watermint/toolbox/quality/infra/qt_file"
	"os"
)

type Griddata struct {
	rc_recipe.RemarkSecret
	In  da_griddata.GridDataInput
	Out da_griddata.GridDataOutput
}

func (z *Griddata) Preset() {
}

func (z *Griddata) Exec(c app_control.Control) error {
	return z.In.EachRow(func(col []interface{}, rowIndex int) error {
		z.Out.Row(col)
		return nil
	})
}

func (z *Griddata) Test(c app_control.Control) error {
	f, err := qt_file.MakeTestFile("grid_data", "alex@example.com,Alex\ndavid@example.com,David\n")
	if err != nil {
		return err
	}
	defer func() {
		_ = os.Remove(f)
	}()

	return rc_exec.Exec(c, &Griddata{}, func(r rc_recipe.Recipe) {
		m := r.(*Griddata)
		m.In.SetFilePath(f)
	})
}


text:
<domain log-root="${com.sun.aas.instanceRoot}/logs" application-root="${com.sun.aas.instanceRoot}/applications" version="89">
    <security-configurations>
        <authentication-service default="true" name="adminAuth" use-password-credential="true">
            <security-provider name="spcrealm" type="LoginModule" provider-name="adminSpc">
                <login-module-config name="adminSpecialLM" control-flag="sufficient" module-class="com.sun.enterprise.admin.util.AdminLoginModule">
                    <property name="config" value="server-config"></property>
                    <property name="auth-realm" value="admin-realm"></property>
                </login-module-config>
            </security-provider>
            <security-provider name="filerealm" type="LoginModule" provider-name="adminFile">
                <login-module-config name="adminFileLM" control-flag="sufficient" module-class="com.sun.enterprise.security.auth.login.FileLoginModule">
                    <property name="config" value="server-config"></property>
                    <property name="auth-realm" value="admin-realm"></property>
                </login-module-config>
            </security-provider>
        </authentication-service>
        <authorization-service default="true" name="authorizationService">
            <security-provider name="simpleAuthorization" type="Simple" provider-name="simpleAuthorizationProvider">
                <authorization-provider-config support-policy-deploy="false" name="simpleAuthorizationProviderConfig"></authorization-provider-config>
            </security-provider>
        </authorization-service>
    </security-configurations>
    <managed-job-config></managed-job-config>
    <system-applications>
    </system-applications>
    <resources>
        <jdbc-resource pool-name="__TimerPool" jndi-name="jdbc/__TimerPool" object-type="system-admin"></jdbc-resource>
        <jdbc-connection-pool datasource-classname="org.apache.derby.jdbc.EmbeddedXADataSource" res-type="javax.sql.XADataSource" name="__TimerPool">
            <property name="databaseName" value="${glassfish_work_dir}/glassfish-ejbtimer-database"></property>
            <property name="connectionAttributes" value=";create=true"></property>
        </jdbc-connection-pool>
    </resources>
    <servers>
        <server name="server" config-ref="server-config">
            <resource-ref ref="jdbc/__TimerPool"></resource-ref>
        </server>
    </servers>
    <nodes>
        <node node-host="localhost" name="localhost-domain1" type="CONFIG" install-dir="${com.sun.aas.productRoot}"></node>
    </nodes>
    <configs>
        <config name="server-config">
            <http-service>
                <access-log></access-log>
                <virtual-server id="server" network-listeners="http-listener-1"></virtual-server>
            </http-service>
            <iiop-service>
            </iiop-service>
            <admin-service system-jmx-connector-name="system" type="das-and-server">
                <!-- TODO DISABLE ADMIN GUI -->
                <property name="adminConsoleContextRoot" value="/__cb__admin"></property>
                <property name="adminConsoleDownloadLocation" value="${com.sun.aas.installRoot}/lib/install/applications/admingui.war"></property>
                <property name="ipsRoot" value="${com.sun.aas.installRoot}/.."></property>
                <das-config></das-config>
            </admin-service>
            <connector-service></connector-service>
            <transaction-service tx-log-dir="${com.sun.aas.instanceRoot}/logs"></transaction-service>
            <diagnostic-service></diagnostic-service>
            <security-service>
                <auth-realm classname="com.sun.enterprise.security.auth.realm.file.FileRealm" name="admin-realm">
                    <property name="file" value="${com.sun.aas.instanceRoot}/config/admin-keyfile"></property>
                    <property name="jaas-context" value="fileRealm"></property>
                </auth-realm>
                <auth-realm classname="com.sun.enterprise.security.auth.realm.file.FileRealm" name="file">
                    <property name="file" value="${com.sun.aas.instanceRoot}/config/keyfile"></property>
                    <property name="jaas-context" value="fileRealm"></property>
                </auth-realm>
                <auth-realm classname="com.sun.enterprise.security.auth.realm.certificate.CertificateRealm" name="certificate"></auth-realm>
                <jacc-provider policy-provider="com.sun.enterprise.security.provider.PolicyWrapper" name="default" policy-configuration-factory-provider="com.sun.enterprise.security.provider.PolicyConfigurationFactoryImpl">
                    <property name="repository" value="${com.sun.aas.instanceRoot}/generated/policy"></property>
                </jacc-provider>
                <jacc-provider policy-provider="com.sun.enterprise.security.jacc.provider.SimplePolicyProvider" name="simple" policy-configuration-factory-provider="com.sun.enterprise.security.jacc.provider.SimplePolicyConfigurationFactory"></jacc-provider>
                <audit-module classname="com.sun.enterprise.security.ee.Audit" name="default">
                    <property name="auditOn" value="false"></property>
                </audit-module>
                <message-security-config auth-layer="SOAP">
                    <provider-config provider-type="client" provider-id="XWS_ClientProvider" class-name="com.sun.xml.wss.provider.ClientSecurityAuthModule">
                        <request-policy auth-source="content"></request-policy>
                        <response-policy auth-source="content"></response-policy>
                        <property name="encryption.key.alias" value="s1as"></property>
                        <property name="signature.key.alias" value="s1as"></property>
                        <property name="dynamic.username.password" value="false"></property>
                        <property name="debug" value="false"></property>
                    </provider-config>
                    <provider-config provider-type="client" provider-id="ClientProvider" class-name="com.sun.xml.wss.provider.ClientSecurityAuthModule">
                        <request-policy auth-source="content"></request-policy>
                        <response-policy auth-source="content"></response-policy>
                        <property name="encryption.key.alias" value="s1as"></property>
                        <property name="signature.key.alias" value="s1as"></property>
                        <property name="dynamic.username.password" value="false"></property>
                        <property name="debug" value="false"></property>
                        <property name="security.config" value="${com.sun.aas.instanceRoot}/config/wss-server-config-1.0.xml"></property>
                    </provider-config>
                    <provider-config provider-type="server" provider-id="XWS_ServerProvider" class-name="com.sun.xml.wss.provider.ServerSecurityAuthModule">
                        <request-policy auth-source="content"></request-policy>
                        <response-policy auth-source="content"></response-policy>
                        <property name="encryption.key.alias" value="s1as"></property>
                        <property name="signature.key.alias" value="s1as"></property>
                        <property name="debug" value="false"></property>
                    </provider-config>
                    <provider-config provider-type="server" provider-id="ServerProvider" class-name="com.sun.xml.wss.provider.ServerSecurityAuthModule">
                        <request-policy auth-source="content"></request-policy>
                        <response-policy auth-source="content"></response-policy>
                        <property name="encryption.key.alias" value="s1as"></property>
                        <property name="signature.key.alias" value="s1as"></property>
                        <property name="debug" value="false"></property>
                        <property name="security.config" value="${com.sun.aas.instanceRoot}/config/wss-server-config-1.0.xml"></property>
                    </provider-config>
                </message-security-config>
                <message-security-config auth-layer="HttpServlet">
                    <provider-config provider-type="server" provider-id="GFConsoleAuthModule" class-name="org.glassfish.admingui.common.security.AdminConsoleAuthModule">
                        <request-policy auth-source="sender"></request-policy>
                        <response-policy></response-policy>
                        <property name="loginPage" value="/login.jsf"></property>
                        <property name="loginErrorPage" value="/loginError.jsf"></property>
                    </provider-config>
                </message-security-config>
                <property name="default-digest-algorithm" value="SHA-256"></property>
            </security-service>
            <java-config debug-options="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=9009" system-classpath="" classpath-suffix="">
                <jvm-options>-XX:MaxPermSize=192m</jvm-options>
                <jvm-options>-client</jvm-options>
                <jvm-options>-Djava.awt.headless=true</jvm-options>
                <jvm-options>-Djavax.management.builder.initial=com.sun.enterprise.v3.admin.AppServerMBeanServerBuilder</jvm-options>
                <jvm-options>-XX:+UnlockDiagnosticVMOptions</jvm-options>
                <jvm-options>-Djava.endorsed.dirs=${com.sun.aas.installRoot}/modules/endorsed${path.separator}${com.sun.aas.installRoot}/lib/endorsed</jvm-options>
                <jvm-options>-Djava.security.policy=${com.sun.aas.instanceRoot}/config/server.policy</jvm-options>
                <jvm-options>-Djava.security.auth.login.config=${com.sun.aas.instanceRoot}/config/login.conf</jvm-options>
                <jvm-options>-Dcom.sun.enterprise.security.httpsOutboundKeyAlias=s1as</jvm-options>
                <jvm-options>-Xmx512m</jvm-options>
                <jvm-options>-Djavax.net.ssl.keyStore=${com.sun.aas.instanceRoot}/config/keystore.jks</jvm-options>
                <jvm-options>-Djavax.net.ssl.trustStore=${com.sun.aas.instanceRoot}/config/cacerts.jks</jvm-options>
                <jvm-options>-Djava.ext.dirs=${com.sun.aas.javaRoot}/lib/ext${path.separator}${com.sun.aas.javaRoot}/jre/lib/ext${path.separator}${com.sun.aas.instanceRoot}/lib/ext</jvm-options>
                <jvm-options>-Djdbc.drivers=org.apache.derby.jdbc.ClientDriver</jvm-options>
                <jvm-options>-DANTLR_USE_DIRECT_CLASS_LOADING=true</jvm-options>
                <jvm-options>-Dcom.sun.enterprise.config.config_environment_factory_class=com.sun.enterprise.config.serverbeans.AppserverConfigEnvironmentFactory</jvm-options>
                <jvm-options>-Dorg.glassfish.additionalOSGiBundlesToStart=org.apache.felix.shell,org.apache.felix.gogo.runtime,org.apache.felix.gogo.shell,org.apache.felix.gogo.command,org.apache.felix.shell.remote,org.apache.felix.fileinstall</jvm-options>
                <jvm-options>-Dosgi.shell.telnet.port=6666</jvm-options>
                <jvm-options>-Dosgi.shell.telnet.maxconn=1</jvm-options>
                <jvm-options>-Dosgi.shell.telnet.ip=127.0.0.1</jvm-options>
                <jvm-options>-Dgosh.args=--nointeractive</jvm-options>
                <jvm-options>-Dfelix.fileinstall.dir=${com.sun.aas.installRoot}/modules/autostart/</jvm-options>
                <jvm-options>-Dfelix.fileinstall.poll=5000</jvm-options>
                <jvm-options>-Dfelix.fileinstall.log.level=2</jvm-options>
                <jvm-options>-Dfelix.fileinstall.bundles.new.start=true</jvm-options>
                <jvm-options>-Dfelix.fileinstall.bundles.startTransient=true</jvm-options>
                <jvm-options>-Dfelix.fileinstall.disableConfigSave=false</jvm-options>
                <jvm-options>-XX:NewRatio=2</jvm-options>
            </java-config>
            <network-config>
                <protocols>
                    <protocol name="http-listener-1">
                        <http default-virtual-server="server" max-connections="250">
                            <file-cache></file-cache>
                        </http>
                    </protocol>
                    <!--
                    <protocol security-enabled="true" name="http-listener-2">
                        <http default-virtual-server="server" max-connections="250">
                            <file-cache></file-cache>
                        </http>
                        <ssl classname="com.sun.enterprise.security.ssl.GlassfishSSLImpl" ssl3-enabled="false" cert-nickname="s1as"></ssl>
                    </protocol>
                    <protocol name="admin-listener">
                        <http default-virtual-server="__asadmin" max-connections="250" encoded-slash-enabled="true">
                            <file-cache></file-cache>
                        </http>
                    </protocol>
                    -->
                </protocols>
                <network-listeners>
                    <network-listener port="${app_port}" protocol="http-listener-1" transport="tcp" name="http-listener-1" thread-pool="http-thread-pool"></network-listener>
                    <!--
                    <network-listener port="8080" protocol="http-listener-1" transport="tcp" name="http-listener-1" thread-pool="http-thread-pool"></network-listener>
                    <network-listener port="8181" protocol="http-listener-2" transport="tcp" name="http-listener-2" thread-pool="http-thread-pool"></network-listener>
                    <network-listener port="4848" protocol="admin-listener" transport="tcp" name="admin-listener" thread-pool="admin-thread-pool"></network-listener>
                    -->
                </network-listeners>
                <transports>
                    <transport name="tcp"></transport>
                </transports>
            </network-config>
            <thread-pools>
                <thread-pool name="admin-thread-pool" max-thread-pool-size="50" max-queue-size="256"></thread-pool>
                <thread-pool name="http-thread-pool"></thread-pool>
                <thread-pool name="thread-pool-1" max-thread-pool-size="200"></thread-pool>
            </thread-pools>
            <monitoring-service>
                <!--
                LOAD GLASSFISH MONITORING, BEWARE OF MEMORY CONSUMPTION
                -->
                <module-monitoring-levels web-container="HIGH"></module-monitoring-levels>
            </monitoring-service>
            <group-management-service>
                <failure-detection></failure-detection>
            </group-management-service>
            <availability-service></availability-service>
        </config>
        <config name="default-config">
            <http-service>
                <access-log></access-log>
                <virtual-server id="server" network-listeners="http-listener-1, http-listener-2">
                    <property name="default-web-xml" value="${com.sun.aas.instanceRoot}/config/default-web.xml"></property>
                </virtual-server>
                <virtual-server id="__asadmin" network-listeners="admin-listener"></virtual-server>
            </http-service>
            <iiop-service>
                <orb use-thread-pool-ids="thread-pool-1"></orb>
                <iiop-listener port="${IIOP_LISTENER_PORT}" id="orb-listener-1" address="0.0.0.0"></iiop-listener>
                <iiop-listener port="${IIOP_SSL_LISTENER_PORT}" id="SSL" address="0.0.0.0" security-enabled="true">
                    <ssl classname="com.sun.enterprise.security.ssl.GlassfishSSLImpl" cert-nickname="s1as"></ssl>
                </iiop-listener>
                <iiop-listener port="${IIOP_SSL_MUTUALAUTH_PORT}" id="SSL_MUTUALAUTH" address="0.0.0.0" security-enabled="true">
                    <ssl classname="com.sun.enterprise.security.ssl.GlassfishSSLImpl" cert-nickname="s1as" client-auth-enabled="true"></ssl>
                </iiop-listener>
            </iiop-service>
            <admin-service system-jmx-connector-name="system">
                <jmx-connector port="${JMX_SYSTEM_CONNECTOR_PORT}" address="0.0.0.0" security-enabled="false" auth-realm-name="admin-realm" name="system"></jmx-connector>
                <property name="adminConsoleDownloadLocation" value="${com.sun.aas.installRoot}/lib/install/applications/admingui.war"></property>
                <das-config></das-config>
            </admin-service>
            <web-container>
                <session-config>
                    <session-manager>
                        <manager-properties></manager-properties>
                        <store-properties></store-properties>
                    </session-manager>
                    <session-properties></session-properties>
                </session-config>
            </web-container>
            <ejb-container>
                <ejb-timer-service></ejb-timer-service>
            </ejb-container>
            <mdb-container></mdb-container>
            <log-service log-rotation-limit-in-bytes="2000000" file="${com.sun.aas.instanceRoot}/logs/server.log">
                <module-log-levels></module-log-levels>
            </log-service>
            <security-service>
                <auth-realm classname="com.sun.enterprise.security.auth.realm.file.FileRealm" name="admin-realm">
                    <property name="file" value="${com.sun.aas.instanceRoot}/config/admin-keyfile"></property>
                    <property name="jaas-context" value="fileRealm"></property>
                </auth-realm>
                <auth-realm classname="com.sun.enterprise.security.auth.realm.file.FileRealm" name="file">
                    <property name="file" value="${com.sun.aas.instanceRoot}/config/keyfile"></property>
                    <property name="jaas-context" value="fileRealm"></property>
                </auth-realm>
                <auth-realm classname="com.sun.enterprise.security.auth.realm.certificate.CertificateRealm" name="certificate"></auth-realm>
                <jacc-provider policy-provider="com.sun.enterprise.security.provider.PolicyWrapper" name="default" policy-configuration-factory-provider="com.sun.enterprise.security.provider.PolicyConfigurationFactoryImpl">
                    <property name="repository" value="${com.sun.aas.instanceRoot}/generated/policy"></property>
                </jacc-provider>
                <jacc-provider policy-provider="com.sun.enterprise.security.jacc.provider.SimplePolicyProvider" name="simple" policy-configuration-factory-provider="com.sun.enterprise.security.jacc.provider.SimplePolicyConfigurationFactory"></jacc-provider>
                <audit-module classname="com.sun.enterprise.security.ee.Audit" name="default">
                    <property name="auditOn" value="false"></property>
                </audit-module>
                <message-security-config auth-layer="SOAP">
                    <provider-config provider-type="client" provider-id="XWS_ClientProvider" class-name="com.sun.xml.wss.provider.ClientSecurityAuthModule">
                        <request-policy auth-source="content"></request-policy>
                        <response-policy auth-source="content"></response-policy>
                        <property name="encryption.key.alias" value="s1as"></property>
                        <property name="signature.key.alias" value="s1as"></property>
                        <property name="dynamic.username.password" value="false"></property>
                        <property name="debug" value="false"></property>
                    </provider-config>
                    <provider-config provider-type="client" provider-id="ClientProvider" class-name="com.sun.xml.wss.provider.ClientSecurityAuthModule">
                        <request-policy auth-source="content"></request-policy>
                        <response-policy auth-source="content"></response-policy>
                        <property name="encryption.key.alias" value="s1as"></property>
                        <property name="signature.key.alias" value="s1as"></property>
                        <property name="dynamic.username.password" value="false"></property>
                        <property name="debug" value="false"></property>
                        <property name="security.config" value="${com.sun.aas.instanceRoot}/config/wss-server-config-1.0.xml"></property>
                    </provider-config>
                    <provider-config provider-type="server" provider-id="XWS_ServerProvider" class-name="com.sun.xml.wss.provider.ServerSecurityAuthModule">
                        <request-policy auth-source="content"></request-policy>
                        <response-policy auth-source="content"></response-policy>
                        <property name="encryption.key.alias" value="s1as"></property>
                        <property name="signature.key.alias" value="s1as"></property>
                        <property name="debug" value="false"></property>
                    </provider-config>
                    <provider-config provider-type="server" provider-id="ServerProvider" class-name="com.sun.xml.wss.provider.ServerSecurityAuthModule">
                        <request-policy auth-source="content"></request-policy>
                        <response-policy auth-source="content"></response-policy>
                        <property name="encryption.key.alias" value="s1as"></property>
                        <property name="signature.key.alias" value="s1as"></property>
                        <property name="debug" value="false"></property>
                        <property name="security.config" value="${com.sun.aas.instanceRoot}/config/wss-server-config-1.0.xml"></property>
                    </provider-config>
                </message-security-config>
            </security-service>
            <transaction-service tx-log-dir="${com.sun.aas.instanceRoot}/logs" automatic-recovery="true"></transaction-service>
            <diagnostic-service></diagnostic-service>
            <java-config debug-options="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=${JAVA_DEBUGGER_PORT}" system-classpath="" classpath-suffix="">
                <jvm-options>-XX:MaxPermSize=192m</jvm-options>
                <jvm-options>-server</jvm-options>
                <jvm-options>-Djava.awt.headless=true</jvm-options>
                <jvm-options>-XX:+UnlockDiagnosticVMOptions</jvm-options>
                <jvm-options>-Djava.endorsed.dirs=${com.sun.aas.installRoot}/modules/endorsed${path.separator}${com.sun.aas.installRoot}/lib/endorsed</jvm-options>
                <jvm-options>-Djava.security.policy=${com.sun.aas.instanceRoot}/config/server.policy</jvm-options>
                <jvm-options>-Djava.security.auth.login.config=${com.sun.aas.instanceRoot}/config/login.conf</jvm-options>
                <jvm-options>-Dcom.sun.enterprise.security.httpsOutboundKeyAlias=s1as</jvm-options>
                <jvm-options>-Djavax.net.ssl.keyStore=${com.sun.aas.instanceRoot}/config/keystore.jks</jvm-options>
                <jvm-options>-Djavax.net.ssl.trustStore=${com.sun.aas.instanceRoot}/config/cacerts.jks</jvm-options>
                <jvm-options>-Djava.ext.dirs=${com.sun.aas.javaRoot}/lib/ext${path.separator}${com.sun.aas.javaRoot}/jre/lib/ext${path.separator}${com.sun.aas.instanceRoot}/lib/ext</jvm-options>
                <jvm-options>-Djdbc.drivers=org.apache.derby.jdbc.ClientDriver</jvm-options>
                <jvm-options>-DANTLR_USE_DIRECT_CLASS_LOADING=true</jvm-options>
                <jvm-options>-Dcom.sun.enterprise.config.config_environment_factory_class=com.sun.enterprise.config.serverbeans.AppserverConfigEnvironmentFactory</jvm-options>
                <jvm-options>-XX:NewRatio=2</jvm-options>
                <jvm-options>-Xmx512m</jvm-options>
                <jvm-options>-Dorg.glassfish.additionalOSGiBundlesToStart=org.apache.felix.shell,org.apache.felix.gogo.runtime,org.apache.felix.gogo.shell,org.apache.felix.gogo.command,org.apache.felix.fileinstall</jvm-options>
                <jvm-options>-Dosgi.shell.telnet.port=${OSGI_SHELL_TELNET_PORT}</jvm-options>
                <jvm-options>-Dosgi.shell.telnet.maxconn=1</jvm-options>
                <jvm-options>-Dosgi.shell.telnet.ip=127.0.0.1</jvm-options>
                <jvm-options>-Dgosh.args=--noshutdown -c noop=true</jvm-options>
                <jvm-options>-Dfelix.fileinstall.dir=${com.sun.aas.installRoot}/modules/autostart/</jvm-options>
                <jvm-options>-Dfelix.fileinstall.poll=5000</jvm-options>
                <jvm-options>-Dfelix.fileinstall.log.level=3</jvm-options>
                <jvm-options>-Dfelix.fileinstall.bundles.new.start=true</jvm-options>
                <jvm-options>-Dfelix.fileinstall.bundles.startTransient=true</jvm-options>
                <jvm-options>-Dfelix.fileinstall.disableConfigSave=false</jvm-options>
            </java-config>
            <availability-service>
                <web-container-availability></web-container-availability>
                <ejb-container-availability sfsb-store-pool-name="jdbc/hastore"></ejb-container-availability>
            </availability-service>
            <network-config>
                <protocols>
                    <protocol name="http-listener-1">
                        <http default-virtual-server="server">
                            <file-cache></file-cache>
                        </http>
                    </protocol>
                    <protocol security-enabled="true" name="http-listener-2">
                        <http default-virtual-server="server">
                            <file-cache></file-cache>
                        </http>
                        <ssl classname="com.sun.enterprise.security.ssl.GlassfishSSLImpl" ssl3-enabled="false" cert-nickname="s1as"></ssl>
                    </protocol>
                    <protocol name="admin-listener">
                        <http default-virtual-server="__asadmin" max-connections="250">
                            <file-cache></file-cache>
                        </http>
                    </protocol>
                    <protocol security-enabled="true" name="sec-admin-listener">
                        <http default-virtual-server="__asadmin" encoded-slash-enabled="true">
                            <file-cache></file-cache>
                        </http>
                        <ssl client-auth="want" ssl3-enabled="false" classname="com.sun.enterprise.security.ssl.GlassfishSSLImpl" cert-nickname="glassfish-instance" renegotiate-on-client-auth-want="false"></ssl>
                    </protocol>
                    <protocol name="admin-http-redirect">
                        <http-redirect secure="true"></http-redirect>
                    </protocol>
                    <protocol name="pu-protocol">
                        <port-unification>
                            <protocol-finder protocol="sec-admin-listener" name="http-finder" classname="org.glassfish.grizzly.config.portunif.HttpProtocolFinder"></protocol-finder>
                            <protocol-finder protocol="admin-http-redirect" name="admin-http-redirect" classname="org.glassfish.grizzly.config.portunif.HttpProtocolFinder"></protocol-finder>
                        </port-unification>
                    </protocol>
                </protocols>
                <network-listeners>
                    <network-listener port="${HTTP_LISTENER_PORT}" protocol="http-listener-1" transport="tcp" name="http-listener-1" thread-pool="http-thread-pool"></network-listener>
                    <network-listener port="${HTTP_SSL_LISTENER_PORT}" protocol="http-listener-2" transport="tcp" name="http-listener-2" thread-pool="http-thread-pool"></network-listener>
                    <network-listener port="${ASADMIN_LISTENER_PORT}" protocol="pu-protocol" transport="tcp" name="admin-listener" thread-pool="http-thread-pool"></network-listener>
                </network-listeners>
                <transports>
                    <transport name="tcp"></transport>
                </transports>
            </network-config>
            <thread-pools>
                <thread-pool name="http-thread-pool"></thread-pool>
                <thread-pool max-thread-pool-size="200" name="thread-pool-1"></thread-pool>
                <thread-pool name="admin-thread-pool" max-thread-pool-size="50" max-queue-size="256"></thread-pool>
            </thread-pools>
            <group-management-service>
                <failure-detection></failure-detection>
            </group-management-service>
            <system-property name="ASADMIN_LISTENER_PORT" value="24848"></system-property>
            <system-property name="HTTP_LISTENER_PORT" value="28080"></system-property>
            <system-property name="HTTP_SSL_LISTENER_PORT" value="28181"></system-property>
            <system-property name="IIOP_LISTENER_PORT" value="23700"></system-property>
            <system-property name="IIOP_SSL_LISTENER_PORT" value="23820"></system-property>
            <system-property name="IIOP_SSL_MUTUALAUTH_PORT" value="23920"></system-property>
            <system-property name="JMX_SYSTEM_CONNECTOR_PORT" value="28686"></system-property>
            <system-property name="OSGI_SHELL_TELNET_PORT" value="26666"></system-property>
            <system-property name="JAVA_DEBUGGER_PORT" value="29009"></system-property>
            <monitoring-service>
                <module-monitoring-levels></module-monitoring-levels>
            </monitoring-service>
        </config>
    </configs>
    <property name="administrative.domain.name" value="domain1"></property>
    <secure-admin special-admin-indicator="0994f38c-22eb-4d66-a6d4-353067c03b54">
        <secure-admin-principal dn="CN=cleclerc-cb-mbp-2.local,OU=GlassFish,O=Oracle Corporation,L=Santa Clara,ST=California,C=US"></secure-admin-principal>
        <secure-admin-principal dn="CN=cleclerc-cb-mbp-2.local-instance,OU=GlassFish,O=Oracle Corporation,L=Santa Clara,ST=California,C=US"></secure-admin-principal>
    </secure-admin>
    <clusters></clusters>
    <applications></applications>
</domain>


text:
package org.apache.velocity.tools.generic;

import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Locale;

/**
 *
Utility class for easy parsing of String values held in a Map.

 *

 * Template example(s):
 *   $parser.foo                ->  bar
 *   $parser.getNumber('baz')   ->  12.6
 *   $parser.getInt('baz')      ->  12
 *   $parser.getNumbers('baz')  ->  [12.6]
 *
 * Toolbox configuration:
 * <tool>
 *   <key>parser</key>
 *   <class>org.apache.velocity.generic.ValueParser</class>
 * </tool>
 *

 *
 *
This comes in very handy when parsing parameters.

 *
 * @author Nathan Bubna
 * @version $Revision$ $Date$
 * @since VelocityTools 1.2
 */
public class ValueParser
{
    private Map source = null;
    private String delimiter = ",";

    public ValueParser() {}

    public ValueParser(Map source)
    {
        setSource(source);
    }

    protected void setSource(Map source)
    {
        this.source = source;
    }

    protected Map getSource()
    {
        if (source == null)
        {
            throw new NullPointerException("You must set a Map source for values to be parsed.");
        }
        return this.source;
    }

    /**
     * Sets the delimiter used for separating values in a single String value.
     * The default delimiter is a comma.
     *
     * @since VelocityTools 1.3
     * @see #parseStringList
     */
    protected final void setStringsDelimiter(String delimiter)
    {
        this.delimiter = delimiter;
    }

    /**
     * Returns the delimiter used for separating values in a single String value.
     * The default delimiter is a comma.
     *
     * @since VelocityTools 1.3
     * @see #parseStringList
     */
    protected final String getStringsDelimiter()
    {
        return this.delimiter;
    }

    // ----------------- public parsing methods --------------------------

    /**
     * Convenience method for checking whether a certain parameter exists.
     *
     * @param key the parameter's key
     * @return true if a parameter exists for the specified
     *         key; otherwise, returns false.
     */
    public boolean exists(String key)
    {
        return (getString(key) != null);
    }

    /**
     * Convenience method for use in Velocity templates.
     * This allows for easy "dot" access to parameters.
     *
     * e.g. $params.foo instead of $params.getString('foo')
     *
     * @param key the parameter's key
     * @return parameter matching the specified key or
     *         null if there is no matching
     *         parameter
     */
    public Object get(String key)
    {
        return getString(key);
    }

    /**
     * @param key the parameter's key
     * @return parameter matching the specified key or
     *         null if there is no matching
     *         parameter
     */
    public String getString(String key)
    {
        Object value = getSource().get(key);
        if (value == null)
        {
            return null;
        }

        if (value instanceof Collection)
        {
            Collection values = (Collection)value;
            if (!values.isEmpty())
            {
                // take the next available value
                value = values.iterator().next();
            }
        }
        else if (value.getClass().isArray())
        {
            if (Array.getLength(value) > 0)
            {
                // take the first value
                value = Array.get(value, 0);
            }
        }
        return String.valueOf(value);
    }

    /**
     * @param key the desired parameter's key
     * @param alternate The alternate value
     * @return parameter matching the specified key or the
     *         specified alternate String if there is no matching
     *         parameter
     */
    public String getString(String key, String alternate)
    {
        String s = getString(key);
        return (s != null) ? s : alternate;
    }

    /**
     * @param key the desired parameter's key
     * @return a {@link Boolean} object for the specified key or
     *         null if no matching parameter is found
     */
    public Boolean getBoolean(String key)
    {
        String s = getString(key);
        return (s != null) ? parseBoolean(s) : null;
    }

    /**
     * @param key the desired parameter's key
     * @param alternate The alternate boolean value
     * @return boolean value for the specified key or the
     *         alternate boolean is no value is found
     */
    public boolean getBoolean(String key, boolean alternate)
    {
        Boolean bool = getBoolean(key);
        return (bool != null) ? bool.booleanValue() : alternate;
    }

    /**
     * @param key the desired parameter's key
     * @param alternate the alternate {@link Boolean}
     * @return a {@link Boolean} for the specified key or the specified
     *         alternate if no matching parameter is found
     */
    public Boolean getBoolean(String key, Boolean alternate)
    {
        Boolean bool = getBoolean(key);
        return (bool != null) ? bool : alternate;
    }

    /**
     * @param key the desired parameter's key
     * @return a {@link Integer} for the specified key or
     *         null if no matching parameter is found
     */
    public Integer getInteger(String key)
    {
        Number num = getNumber(key);
        if (num == null || num instanceof Integer)
        {
            return (Integer)num;
        }
        return new Integer(num.intValue());
    }

    /**
     * @param key the desired parameter's key
     * @param alternate The alternate Integer
     * @return an Integer for the specified key or the specified
     *         alternate if no matching parameter is found
     */
    public Integer getInteger(String key, Integer alternate)
    {
        Integer num = getInteger(key);
        if (num == null)
        {
            return alternate;
        }
        return num;
    }

    /**
     * @param key the desired parameter's key
     * @return a {@link Double} for the specified key or
     *         null if no matching parameter is found
     */
    public Double getDouble(String key)
    {
        Number num = getNumber(key);
        if (num == null || num instanceof Double)
        {
            return (Double)num;
        }
        return new Double(num.intValue());
    }

    /**
     * @param key the desired parameter's key
     * @param alternate The alternate Double
     * @return an Double for the specified key or the specified
     *         alternate if no matching parameter is found
     */
    public Double getDouble(String key, Double alternate)
    {
        Double num = getDouble(key);
        if (num == null)
        {
            return alternate;
        }
        return num;
    }

    /**
     * @param key the desired parameter's key
     * @return a {@link Number} for the specified key or
     *         null if no matching parameter is found
     */
    public Number getNumber(String key)
    {
        String s = getString(key);
        if (s == null || s.length() == 0)
        {
            return null;
        }
        try
        {
            return parseNumber(s);
        }
        catch (Exception e)
        {
            //there is no Number with that key
            return null;
        }
    }

    /**
     * @param key the desired parameter's key
     * @return a {@link Locale} for the specified key or
     *         null if no matching parameter is found
     */
    public Locale getLocale(String key)
    {
        String s = getString(key);
        if (s == null || s.length() == 0)
        {
            return null;
        }
        return parseLocale(s);
    }

    /**
     * @param key the desired parameter's key
     * @param alternate The alternate Number
     * @return a Number for the specified key or the specified
     *         alternate if no matching parameter is found
     */
    public Number getNumber(String key, Number alternate)
    {
        Number n = getNumber(key);
        return (n != null) ? n : alternate;
    }

    /**
     * @param key the desired parameter's key
     * @param alternate The alternate int value
     * @return the int value for the specified key or the specified
     *         alternate value if no matching parameter is found
     */
    public int getInt(String key, int alternate)
    {
        Number n = getNumber(key);
        return (n != null) ? n.intValue() : alternate;
    }

    /**
     * @param key the desired parameter's key
     * @param alternate The alternate double value
     * @return the double value for the specified key or the specified
     *         alternate value if no matching parameter is found
     */
    public double getDouble(String key, double alternate)
    {
        Number n = getNumber(key);
        return (n != null) ? n.doubleValue() : alternate;
    }

    /**
     * @param key the desired parameter's key
     * @param alternate The alternate Locale
     * @return a Locale for the specified key or the specified
     *         alternate if no matching parameter is found
     */
    public Locale getLocale(String key, Locale alternate)
    {
        Locale l = getLocale(key);
        return (l != null) ? l : alternate;
    }

    /**
     * @param key the key for the desired parameter
     * @return an array of String objects containing all of the values
     *         associated with the given key, or null
     *         if the no values are associated with the given key
     */
    public String[] getStrings(String key)
    {
        Object value = getSource().get(key);
        if (value == null)
        {
            return null;
        }

        String[] strings = null;
        if (value instanceof Collection)
        {
            Collection values = (Collection)value;
            if (!values.isEmpty())
            {
                strings = new String[values.size()];
                int index = 0;
                for (Iterator i = values.iterator(); i.hasNext(); )
                {
                    strings[index++] = String.valueOf(i.next());
                }
            }
        }
        else if (value.getClass().isArray())
        {
            strings = new String[Array.getLength(value)];
            for (int i=0; i < strings.length; i++)
            {
                strings[i] = String.valueOf(Array.get(value, i));
            }
        }
        else
        {
            strings = parseStringList(String.valueOf(value));
        }
        return strings;
    }

    /**
     * @param key the key for the desired parameter
     * @return an array of Boolean objects associated with the given key.
     */
    public Boolean[] getBooleans(String key)
    {
        String[] strings = getStrings(key);
        if (strings == null)
        {
            return null;
        }

        Boolean[] bools = new Boolean[strings.length];
        for (int i=0; i<strings.length; i++)
        {
            if (strings[i] != null && strings[i].length() > 0)
            {
                bools[i] = parseBoolean(strings[i]);
            }
        }
        return bools;
    }

    /**
     * @param key the key for the desired parameter
     * @return an array of Number objects associated with the given key,
     *         or null if Numbers are not associated with it.
     */
    public Number[] getNumbers(String key)
    {
        String[] strings = getStrings(key);
        if (strings == null)
        {
            return null;
        }

        Number[] nums = new Number[strings.length];
        try
        {
            for (int i=0; i<nums.length; i++)
            {
                if (strings[i] != null && strings[i].length() > 0)
                {
                    nums[i] = parseNumber(strings[i]);
                }
            }
        }
        catch (NumberFormatException nfe)
        {
            return null;
        }
        return nums;
    }

    /**
     * @param key the key for the desired parameter
     * @return an array of int values associated with the given key,
     *         or null if numbers are not associated with it.
     */
    public int[] getInts(String key)
    {
        String[] strings = getStrings(key);
        if (strings == null)
        {
            return null;
        }

        int[] ints = new int[strings.length];
        try
        {
            for (int i=0; i<ints.length; i++)
            {
                if (strings[i] != null && strings[i].length() > 0)
                {
                    ints[i] = parseNumber(strings[i]).intValue();
                }
            }
        }
        catch (NumberFormatException nfe)
        {
            return null;
        }
        return ints;
    }

    /**
     * @param key the key for the desired parameter
     * @return an array of double values associated with the given key,
     *         or null if numbers are not associated with it.
     */
    public double[] getDoubles(String key)
    {
        String[] strings = getStrings(key);
        if (strings == null)
        {
            return null;
        }

        double[] doubles = new double[strings.length];
        try
        {
            for (int i=0; i<doubles.length; i++)
            {
                if (strings[i] != null && strings[i].length() > 0)
                {
                    doubles[i] = parseNumber(strings[i]).doubleValue();
                }
            }
        }
        catch (NumberFormatException nfe)
        {
            return null;
        }
        return doubles;
    }

    /**
     * @param key the key for the desired parameter
     * @return an array of Locale objects associated with the given key,
     *         or null if Locales are not associated with it.
     */
    public Locale[] getLocales(String key)
    {
        String[] strings = getStrings(key);
        if (strings == null)
        {
            return null;
        }

        Locale[] locs = new Locale[strings.length];
        for (int i=0; i<locs.length; i++)
        {
            if (strings[i] != null && strings[i].length() > 0)
            {
                locs[i] = parseLocale(strings[i]);
            }
        }
        return locs;
    }

    // --------------------------- protected methods ------------------

    /**
     * Converts a parameter value into a {@link Number}
     * This is used as the base for all numeric parsing methods. So,
     * sub-classes can override to allow for customized number parsing.
     * (e.g. to handle fractions, compound numbers, etc.)
     *
     * @param value the string to be parsed
     * @return the value as a {@link Number}
     */
    protected Number parseNumber(String value) throws NumberFormatException
    {
        if (value.indexOf('.') >= 0)
        {
            return new Double(value);
        }
        return new Long(value);
    }

    /**
     * Converts a parameter value into a {@link Boolean}
     * Sub-classes can override to allow for customized boolean parsing.
     * (e.g. to handle "Yes/No" or "T/F")
     *
     * @param value the string to be parsed
     * @return the value as a {@link Boolean}
     */
    protected Boolean parseBoolean(String value)
    {
        return Boolean.valueOf(value);
    }

    /**
     * Converts a single String value into an array of Strings by splitting
     * it on the tool's set delimiter.  The default delimiter is a comma.
     *
     * @since VelocityTools 1.3
     */
    protected String[] parseStringList(String value)
    {
        if (value.indexOf(this.delimiter) < 0)
        {
            return new String[] { value };
        }
        return value.split(this.delimiter);
    }

    /**
     * Converts a String value into a Locale.
     *
     * @since VelocityTools 1.3
     */
    protected Locale parseLocale(String value)
    {
        if (value.indexOf("_") < 0)
        {
            return new Locale(value);
        }

        String[] params = value.split("_");
        if (params.length == 2)
        {
            return new Locale(params[0], params[1]);
        }
        else if (params.length == 3)
        {
            return new Locale(params[0], params[1], params[2]);
        }
        else
        {
            // there's only 3 possible params, so this must be invalid
            return null;
        }
    }

}


text:
'use strict';
const { expect } = require('chai');

const model = require('../../lib/common/dataController');

module.exports = function () {
  describe('Export suite', function () {
    it('Should export', function() {
      expect(model).to.be.an('object');

      expect(model).to.have.all.keys(['DataController', 'symbols']);
    });

    it('Should export DataController Class', function () {
      expect(model.DataController).to.exist;
      expect(model.DataController).to.be.an('function');

      const unit = new model.DataController();

      expect(unit).to.exist;
      expect(unit).to.be.an('object');
    });

    it('Should export symbols', function () {
      expect(model.symbols).to.exist;
      expect(model.symbols).to.be.an.instanceof(Map);
    });
  });
};


text:
package com.ravi.restclient;

import android.os.Handler;
import android.os.Looper;
import android.support.annotation.NonNull;
import android.support.v4.util.ArrayMap;

import com.google.gson.Gson;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.File;
import java.io.IOException;
import java.lang.reflect.Type;
import java.util.concurrent.Executor;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import okio.Buffer;
import okio.BufferedSink;
import okio.ForwardingSink;
import okio.Okio;
import okio.Sink;

/**
 * Created by ravishankeryadav on 8/27/2016.
 */
public class RestClientHelper {
    private static final String LOG_TAG = "RestClientHelper";
    public static String defaultBaseUrl = "";
    private static final Object lockObject = new Object();
    private static RestClientHelper restClientHelper;
    private final Handler handler = new Handler(Looper.getMainLooper());

    private RestClientHelper() {
    }

    public static RestClientHelper getInstance() {
        if (restClientHelper == null)
            synchronized (lockObject) {
                if (restClientHelper == null)
                    restClientHelper = new RestClientHelper();
            }
        return restClientHelper;
    }

    private final Executor executor;
    {
        ThreadPoolExecutor executor = new ThreadPoolExecutor(5, 5,
                5L, TimeUnit.SECONDS,
                new LinkedBlockingQueue<Runnable>(),
                new ThreadFactory() {
                    @Override
                    public Thread newThread(@NonNull final Runnable r) {
                        return new Thread(r, LOG_TAG + "Thread");
                    }
                });
        executor.allowCoreThreadTimeOut(true);
        this.executor = executor;
    }

    private void addHeaders(Request.Builder builder, @NonNull ArrayMap<String, String> headers) {
        for (String key : headers.keySet()) {
            builder.addHeader(key, headers.get(key));
        }
    }

    public void get(@NonNull String serviceUrl, @NonNull RestClientListener restClientListener) {
        get(serviceUrl, null, null, restClientListener);
    }

    public void get(@NonNull String serviceUrl, ArrayMap<String, Object> params, @NonNull RestClientListener restClientListener) {
        get(serviceUrl, null, params, restClientListener);
    }

    public void get(@NonNull String serviceUrl, ArrayMap<String, String> headers, ArrayMap<String, Object> params, RestClientListener restClientListener) {
        final Request.Builder builder = new Request.Builder();
        if (headers != null)
            addHeaders(builder, headers);
        builder.url(generateUrlParams(serviceUrl, params));
        execute(builder, restClientListener);
    }

    public void post(@NonNull String serviceUrl, @NonNull ArrayMap<String, Object> params, @NonNull RestClientListener restClientListener) {
        post(serviceUrl, null, params, restClientListener);
    }

    public void post(@NonNull String serviceUrl, ArrayMap<String, String> headers, @NonNull ArrayMap<String, Object> params, @NonNull RestClientListener restClientListener) {
        final Request.Builder builder = new Request.Builder();
        if (headers != null)
            addHeaders(builder, headers);
        StringBuffer urls = new StringBuffer();
        if (defaultBaseUrl.length() > 0)
            urls.append(defaultBaseUrl);
        urls.append(serviceUrl);
        builder.url(urls.toString());
        builder.post(generateRequestBody(params));
        execute(builder, restClientListener);
    }

    public void put(@NonNull String serviceUrl, @NonNull ArrayMap<String, Object> params, @NonNull RestClientListener restClientListener) {
        put(serviceUrl, null, params, restClientListener);
    }

    public void put(@NonNull String serviceUrl, ArrayMap<String, String> headers, @NonNull ArrayMap<String, Object> params, @NonNull RestClientListener restClientListener) {
        final Request.Builder builder = new Request.Builder();
        if (headers != null)
            addHeaders(builder, headers);
        StringBuffer urls = new StringBuffer();
        if (defaultBaseUrl.length() > 0)
            urls.append(defaultBaseUrl);
        urls.append(serviceUrl);
        builder.url(urls.toString());
        builder.put(generateRequestBody(params));
        execute(builder, restClientListener);
    }

    public void delete(@NonNull String serviceUrl, @NonNull ArrayMap<String, Object> params, @NonNull RestClientListener restClientListener) {
        delete(serviceUrl, null, params, restClientListener);
    }

    public void delete(@NonNull String serviceUrl, ArrayMap<String, String> headers, @NonNull ArrayMap<String, Object> params, @NonNull RestClientListener restClientListener) {
        final Request.Builder builder = new Request.Builder();
        if (headers != null)
            addHeaders(builder, headers);
        StringBuffer urls = new StringBuffer();
        if (defaultBaseUrl.length() > 0)
            urls.append(defaultBaseUrl);
        urls.append(serviceUrl);
        builder.url(urls.toString());
        builder.delete(generateRequestBody(params));
        execute(builder, restClientListener);
    }

    public void postMultipart(@NonNull String serviceUrl, @NonNull ArrayMap<String, File> files, @NonNull RestClientListener restClientListener) {
        postMultipart(serviceUrl, null, null, files, restClientListener);
    }

    public void postMultipart(@NonNull String serviceUrl, ArrayMap<String, Object> params, @NonNull ArrayMap<String, File> files, @NonNull RestClientListener restClientListener) {
        postMultipart(serviceUrl, null, params, files, restClientListener);
    }

    public void postMultipart(@NonNull String serviceUrl, @NonNull ArrayMap<String, File> files, @NonNull ProgressListener progressListener) {
        postMultipart(serviceUrl, null, null, files, progressListener);
    }
    public void postMultipart(@NonNull String serviceUrl, ArrayMap<String, Object> params, @NonNull ArrayMap<String, File> files, @NonNull ProgressListener progressListener) {
        postMultipart(serviceUrl, null, params, files, progressListener);
    }

    public void postMultipart(@NonNull String serviceUrl, ArrayMap<String, String> headers, ArrayMap<String, Object> params, @NonNull ArrayMap<String, File> files, @NonNull RestClientListener restClientListener) {
        final Request.Builder builder = new Request.Builder();
        if (headers != null)
            addHeaders(builder, headers);
        StringBuffer urls = new StringBuffer();
        if (defaultBaseUrl.length() > 0)
            urls.append(defaultBaseUrl);
        urls.append(serviceUrl);
        builder.url(urls.toString());
        builder.post(generateMultipartBody(params, files));
        execute(builder, restClientListener);
    }

    public void postMultipart(@NonNull String serviceUrl, ArrayMap<String, String> headers, ArrayMap<String, Object> params, @NonNull ArrayMap<String, File> files, @NonNull ProgressListener progressListener) {
        final Request.Builder builder = new Request.Builder();
        if (headers != null)
            addHeaders(builder, headers);
        StringBuffer urls = new StringBuffer();
        if (defaultBaseUrl.length() > 0)
            urls.append(defaultBaseUrl);
        urls.append(serviceUrl);
        builder.url(urls.toString());
        builder.post(new ProgressRequestBody(generateMultipartBody(params, files), progressListener));
        execute(builder, progressListener);
    }

    private void execute(final Request.Builder builder, final RestClientListener restClientListener) {
        executor.execute(new Runnable() {
            @Override
            public void run() {
                final OkHttpClient client = new OkHttpClient.Builder().connectTimeout(2, TimeUnit.MINUTES).writeTimeout(2, TimeUnit.MINUTES).readTimeout(2, TimeUnit.MINUTES).build();
                try {
                    System.setProperty("http.keepAlive", "false");
                    final Response response = client.newCall(builder.build()).execute();
                    final String responseData = response.body().string();
                    handler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (response.code() == 200) {
                                Type responseType=ReflectionHelper.getTypeArgument(restClientListener, 0);
                                callRequestCallbackOnSuccess(restClientListener, responseType != null ? new Gson().fromJson(responseData, responseType) : null);
                            } else {
                                Type errorType=ReflectionHelper.getTypeArgument(restClientListener, 1);
                                callRequestCallbackOnError(restClientListener, errorType != null ? new Gson().fromJson(responseData, errorType) : null);
                            }
                        }
                    });
                } catch (IOException e) {
                    e.printStackTrace();
                    handler.post(new Runnable() {
                        @Override
                        public void run() {
                            Type errorType=((RestClientCallbackTypes) restClientListener).getErrorType();
                            restClientListener.onError("APIs not working...");
                        }
                    });
                }
            }
        });
    }

    private void execute(final Request.Builder builder, final ProgressListener progressListener) {
        executor.execute(new Runnable() {
            @Override
            public void run() {
                final OkHttpClient client = new OkHttpClient.Builder().connectTimeout(2, TimeUnit.MINUTES).writeTimeout(2, TimeUnit.MINUTES).readTimeout(2, TimeUnit.MINUTES).build();
                try {
                    System.setProperty("http.keepAlive", "false");
                    final Response response = client.newCall(builder.build()).execute();
                    final String responseData = response.body().string();
                    handler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (response.code() == 200) {
                                Type responseType=ReflectionHelper.getTypeArgument(progressListener, 0);
                                callRequestCallbackOnSuccess(progressListener, responseType != null ? new Gson().fromJson(responseData, responseType) : null);
                            } else {
                                Type errorType=ReflectionHelper.getTypeArgument(progressListener, 1);
                                callRequestCallbackOnError(progressListener, errorType != null ? new Gson().fromJson(responseData, errorType) : null);
                            }
                        }
                    });
                } catch (IOException e) {
                    e.printStackTrace();
                    handler.post(new Runnable() {
                        @Override
                        public void run() {
                            Type errorType=((RestClientCallbackTypes) progressListener).getErrorType();
                            progressListener.onError("APIs not working...");
                        }
                    });
                }
            }
        });
    }

    private <E> void callRequestCallbackOnSuccess(final RestClientListener restClientListener, E responseParsedData)
    {
        if (restClientListener != null)
        {
            restClientListener.onSuccess(responseParsedData);
        }
    }

    private <E> void callRequestCallbackOnError(final RestClientListener restClientListener,E errorObject)
    {
        if (restClientListener != null)
        {
            restClientListener.onError(errorObject);
        }
    }

    private <E> void callRequestCallbackOnSuccess(final ProgressListener progressListener, E responseParsedData)
    {
        if (progressListener != null)
        {
            progressListener.onSuccess(responseParsedData);
        }
    }

    private <E> void callRequestCallbackOnError(final ProgressListener progressListener,E errorObject)
    {
        if (progressListener != null)
        {
            progressListener.onError(errorObject);
        }
    }

    private String generateUrlParams(String serviceUrl, ArrayMap<String, Object> params) {
        final StringBuffer urls = new StringBuffer();
        if (defaultBaseUrl.length() > 0)
            urls.append(defaultBaseUrl);
        urls.append(serviceUrl);
        if (params != null) {
            int i = 0;
            for (String key : params.keySet()) {
                if (i == 0) {
                    urls.append("?" + key + "=" + params.get(key));
                } else {
                    urls.append("&" + key + "=" + params.get(key));
                }
                i++;
            }
        }
        return urls.toString();
    }

    private RequestBody generateRequestBody(ArrayMap<String, Object> params) {
        final JSONObject jsonObj = new JSONObject();
        if (params != null) {
            for (String key : params.keySet()) {
                try {
                    jsonObj.put(key, params.get(key));
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }
        }
        RequestBody requestBody = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), String.valueOf(jsonObj));
        return requestBody;
    }

    private RequestBody generateMultipartBody(ArrayMap<String, Object> params, ArrayMap<String, File> files) {
        final MultipartBody.Builder builder = new MultipartBody.Builder();
        builder.setType(MultipartBody.FORM);
        if (params != null) {
            for (String key : params.keySet()) {
                builder.addFormDataPart(key, String.valueOf(params.get(key)));
            }
        }
        if (files != null) {
            for (String key : files.keySet()) {
                builder.addFormDataPart(key, key, RequestBody.create(MediaType.parse("image/png"), files.get(key)));
            }
        }
        return builder.build();
    }

    private class ProgressRequestBody extends RequestBody {
        protected RequestBody delegate;
        protected ProgressListener listener;

        protected CountingSink countingSink;

        public ProgressRequestBody(RequestBody delegate, ProgressListener listener) {
            this.delegate = delegate;
            this.listener = listener;
        }

        @Override
        public MediaType contentType() {
            return delegate.contentType();
        }

        @Override
        public long contentLength() {
            long contentLength=-1l;
            try {
                contentLength = delegate.contentLength();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return contentLength;
        }

        @Override
        public void writeTo(BufferedSink sink) throws IOException {
            BufferedSink bufferedSink;

            countingSink = new CountingSink(sink);
            bufferedSink = Okio.buffer(countingSink);

            delegate.writeTo(bufferedSink);

            bufferedSink.flush();
        }

        private final class CountingSink extends ForwardingSink {

            private long bytesWritten = 0;

            public CountingSink(Sink delegate) {
                super(delegate);
            }

            @Override
            public void write(Buffer source, long byteCount) throws IOException {
                super.write(source, byteCount);

                bytesWritten += byteCount;
                handler.post(new Runnable() {
                    @Override
                    public void run() {
                        listener.onProgressUpdate((int) (100F * bytesWritten / contentLength()));
                    }
                });
            }
        }
    }
}


text:
require 'redsnow/version'
require 'redsnow/binding'
require 'redsnow/blueprint'
require 'redsnow/sourcemap'
require 'redsnow/parseresult'
require 'ffi'

# RedSnow
module RedSnow
  include Binding

  # Options
  EXPORT_SOURCEMAP_OPTION_KEY = :exportSourcemap
  REQUIRE_BLUEPRINT_NAME_OPTION_KEY = :requireBlueprintName

  # Parse options
  attr_accessor :options
  def self.parse_options(options)
    # Parse Options
    if options.is_a?(Numeric)
      return options
    else
      opt = 0
      opt |= (1 << 1) if options[REQUIRE_BLUEPRINT_NAME_OPTION_KEY]
      opt |= (1 << 2) if options[EXPORT_SOURCEMAP_OPTION_KEY]
      return opt
    end
  end

  # parse
  #   parsing API Blueprint into Ruby objects
  # @param raw_blueprint [String] API Blueprint
  # @param options [Number] Parsing Options
  #
  # @return [ParseResult]
  def self.parse(raw_blueprint, options = 0)
    fail ArgumentError, 'Expected string value' unless raw_blueprint.is_a?(String)

    blueprint_options = parse_options(options)

    parse_result = FFI::MemoryPointer.new :pointer

    RedSnow::Binding.drafter_c_parse(raw_blueprint, blueprint_options, parse_result)

    parse_result = parse_result.get_pointer(0)

    ParseResult.new(parse_result.null? ? nil : parse_result.read_string)
  ensure

    RedSnow::Memory.free(parse_result)
  end
end


text:
using System.Windows;

namespace SimpleBusyIndicator
{
    public partial class MainWindow
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void ToggleBusy_Click(object sender, RoutedEventArgs e)
        {
            var isBusy = !BusyIndicator.IsBusy;
            BusyIndicator.IsBusy = myBusyIndicator.IsBusy = isBusy;

            var visibility = isBusy ? Visibility.Visible : Visibility.Collapsed;
            BusyRectangle.Visibility = BusyPresenter.Visibility = visibility;
        }
    }
}


text:
Terraform AWS Base Networking
=============================

[![CircleCI](https://circleci.com/gh/infrablocks/terraform-aws-base-networking.svg?style=svg)](https://circleci.com/gh/infrablocks/terraform-aws-base-networking)

A Terraform module for building a base network in AWS.

The network consists of:
* Public and private subnets for each supplied availability zone
* A NAT gateway for each supplied availability zone for outbound Internet
  connectivity
* Routes from the public subnets to the Internet gateway
* Routes from the private subnets to the NAT
* Standard tags for all resources

![Diagram of infrastructure managed by this module](https://raw.githubusercontent.com/infrablocks/terraform-aws-base-networking/master/docs/architecture.png)

Usage
-----

To use the module, include something like the following in your terraform configuration:

```hcl-terraform
module "base-network" {
  source  = "infrablocks/base-networking/aws"
  version = "4.0.0"

  vpc_cidr = "10.0.0.0/16"
  region = "eu-west-2"
  availability_zones = ["eu-west-2a", "eu-west-2b"]

  component = "important-component"
  deployment_identifier = "production"

  private_zone_id = "Z3CVA9QD5NHSW3"
}
```

See the
[Terraform registry entry](https://registry.terraform.io/modules/infrablocks/base-networking/aws/latest)
for more details.

### Inputs

| Name                             | Description                                                                               | Default | Required                                     |
|----------------------------------|-------------------------------------------------------------------------------------------|:-------:|:--------------------------------------------:|
| vpc_cidr                         | The CIDR to use for the VPC                                                               | -       | yes                                          |
| region                           | The region into which to deploy the VPC                                                   | -       | yes                                          |
| availability_zones               | The availability zones for which to add subnets                                           | -       | yes                                          |
| public_subnets_offset            | The number of /24s to offset the public subnets in the VPC CIDR                           | 0       | yes                                          |
| private_subnets_offset           | The number of /24s to offset the private subnets in the VPC CIDR                          | 0       | yes                                          |
| component                        | The component this network will contain                                                   | -       | yes                                          |
| deployment_identifier            | An identifier for this instantiation                                                      | -       | yes                                          |
| dependencies                     | The components depended on by this component                                              | -       | no                                           |
| include_route53_zone_association | Whether or not to associate VPC with the private Route 53 zone ("yes" or "no")            | "yes"   | no                                           |
| private_zone_id                  | The ID of the private Route 53 zone                                                       | -       | if include_route53_zone_association is "yes" |
| include_nat_gateways             | Whether or not to deploy NAT gateways for outbound Internet connectivity ("yes" or "no")  | "yes"   | yes                                          |

### Outputs

| Name                         | Description                                          |
|------------------------------|------------------------------------------------------|
| vpc_id                       | The ID of the created VPC                            |
| vpc_cidr                     | The CIDR of the created VPC                          |
| availability_zones           | The availability zones in which subnets were created |
| number_of_availability_zones | The number of populated availability zones available |
| public_subnet_ids            | The IDs of the public subnets                        |
| public_subnet_cidrs          | The CIDRs of the public subnets                      |
| public_route_table_ids       | The IDs of the public route tables                   |
| private_subnet_ids           | The IDs of the private subnets                       |
| private_subnet_cidrs         | The CIDRs of the private subnets                     |
| private_route_table_ids      | The IDs of the private route tables                  |
| nat_public_ips               | The EIPs attached to the NAT gateways                |

### Compatibility

This module is compatible with Terraform versions greater than or equal to
Terraform 0.14.

### Required Permissions

* ec2:DescribeVpcs
* ec2:DescribeAddresses
* ec2:DescribeVpcAttribute
* ec2:DescribeVpcClassicLink
* ec2:DescribeVpcClassicLinkDnsSupport
* ec2:DescribeRouteTables
* ec2:DescribeSecurityGroups
* ec2:DescribeNetworkAcls
* ec2:DescribeSubnets
* ec2:DescribeInternetGateways
* ec2:DescribeNatGateways
* ec2:ModifyVpcAttribute
* ec2:AllocateAddress
* ec2:ReleaseAddress
* ec2:AssociateRouteTable
* ec2:DisassociateRouteTable
* ec2:AttachInternetGateway
* ec2:DetachInternetGateway
* ec2:DeleteInternetGateway
* ec2:CreateRoute
* ec2:CreateNatGateway
* ec2:CreateVpc
* ec2:CreateTags
* ec2:CreateSubnet
* ec2:CreateRouteTable
* ec2:CreateInternetGateway
* ec2:DeleteRoute
* ec2:DeleteRouteTable
* ec2:DeleteSubnet
* ec2:DeleteNatGateway
* ec2:DeleteVpc
* s3:ListBucket
* s3:GetObject
* s3:GetObjectTagging
* s3:DeleteObject
* route53:AssociateVPCWithHostedZone
* route53:DisassociateVPCFromHostedZone
* route53:GetChange
* route53:GetHostedZone

Development
-----------

### Machine Requirements

In order for the build to run correctly, a few tools will need to be installed on your
development machine:

* Ruby (2.3.1)
* Bundler
* git
* git-crypt
* gnupg
* direnv

#### Mac OS X Setup

Installing the required tools is best managed by [homebrew](http://brew.sh).

To install homebrew:

```
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
```

Then, to install the required tools:

```
# ruby
brew install rbenv
brew install ruby-build
echo 'eval "$(rbenv init - bash)"' >> ~/.bash_profile
echo 'eval "$(rbenv init - zsh)"' >> ~/.zshrc
eval "$(rbenv init -)"
rbenv install 2.3.1
rbenv rehash
rbenv local 2.3.1
gem install bundler

# git, git-crypt, gnupg
brew install git
brew install git-crypt
brew install gnupg

# direnv
brew install direnv
echo "$(direnv hook bash)" >> ~/.bash_profile
echo "$(direnv hook zsh)" >> ~/.zshrc
eval "$(direnv hook $SHELL)"

direnv allow <repository-directory>
```

### Running the build

To provision module infrastructure, run tests and then destroy that infrastructure,
execute:

```bash
./go
```

To provision the module prerequisites:

```bash
./go deployment:prerequisites:provision[<deployment_identifier>]
```

To provision the module contents:

```bash
./go deployment:harness:provision[<deployment_identifier>]
```

To destroy the module contents:

```bash
./go deployment:harness:destroy[<deployment_identifier>]
```

To destroy the module prerequisites:

```bash
./go deployment:prerequisites:destroy[<deployment_identifier>]
```

### Common Tasks

#### Generating an SSH key pair

To generate an SSH key pair:

```
ssh-keygen -t rsa -b 4096 -C integration-test@example.com -N '' -f config/secrets/keys/bastion/ssh
```

#### Managing CircleCI keys

To encrypt a GPG key for use by CircleCI:

```bash
openssl aes-256-cbc \
  -e \
  -md sha1 \
  -in ./config/secrets/ci/gpg.private \
  -out ./.circleci/gpg.private.enc \
  -k "<passphrase>"
```

To check decryption is working correctly:

```bash
openssl aes-256-cbc \
  -d \
  -md sha1 \
  -in ./.circleci/gpg.private.enc \
  -k "<passphrase>"
```

Contributing
------------

Bug reports and pull requests are welcome on GitHub at
https://github.com/infrablocks/terraform-aws-base-networking.
This project is intended to be a safe, welcoming space for collaboration, and
contributors are expected to adhere to the
[Contributor Covenant](http://contributor-covenant.org) code of conduct.

License
-------

The library is available as open source under the terms of the
[MIT License](http://opensource.org/licenses/MIT).


text:
* `user:admin`

## /organizations/{globalid}

### User is owner of the organization

* `organization:owner`

### User is member of the organization

* `organization:member`

# Scopes that can be requested by an oauth client

## `user:name`

First name and last name of the user

## `user:memberof:<globalid>`

A client can check if a user is member or owner of an organization with a specific globalid.
Itsyou.online checks if the user is indeed member or owner and the user needs to confirm
that the requesting client is allowed to know that he/she is part of the organization.

If the user is no member of the <globalid> organization, the oauth flow continues but the scope will not be available. This scope can be requested multiple times.

## `user:organizations:<globalid>`

A client can request a list of suborganizations a user is member of.

This affects the `/users/{username}/organizations` API only.

## `user:address[:<label>]`

## `user:email[:<label>]`

## `user:phone[:<label>][:write]`

The `:write` extension gives an application full access(read, update, delete) to a phone number

## `user:validated:phone[:<label>]`

## `user:validated:email[:<label>]`

## `user:github`

## `user:facebook`

## `user:bankaccount[:<label>]`

## `user:digitalwalletaddress:[<label>]:[<currency>]`

## `user:publickey[:<label>]`

## `user:avatar[:<label>]`

## `user:keystore`

The `user:keystore` scope gives an organization access to a hidden store where public
keys and additional data for these keys can be stored. They are not exposed to the user.
The keystore access is restricted to those keys written by the organization, all others are
hidden. Once a key is written, it can only be retrieved, not modified or deleted.

## `user:see`

The `user:see` scope gives an organization access to the see documents written by the organization.
See documents can't be modified or deleted after being uploaded, only a new version can be uploaded.

## `user:owneroff:email:<emailaddress>`

Users need to share this verified email address to complete the authorization flow.
If a user registers during an oauth flow where this scope is requested, the email address is automatically filled in the registration screen.


text:
MM.Command.Edit = Object.create(MM.Command, {
	label: {value: "Edit item"},
	keys: {value: [
		{keyCode: 32},
		{keyCode: 113}
	]}
});
MM.Command.Edit.execute = function() {
	MM.App.current.startEditing();
	MM.App.editing = true;
}

MM.Command.Finish = Object.create(MM.Command, {
	keys: {value: [{keyCode: 13, altKey:false, ctrlKey:false, shiftKey:false}]},
	editMode: {value: true}
});
MM.Command.Finish.execute = function() {
	MM.App.editing = false;
	var text = MM.App.current.stopEditing();
	if (text) {
		var action = new MM.Action.SetText(MM.App.current, text);
	} else {
		var action = new MM.Action.RemoveItem(MM.App.current);
	}
	MM.App.action(action);
}

MM.Command.Newline = Object.create(MM.Command, {
	label: {value: "Line break"},
	keys: {value: [
		{keyCode: 13, shiftKey:true},
		{keyCode: 13, ctrlKey:true}
	]},
	editMode: {value: true}
});
MM.Command.Newline.execute = function() {
	var range = getSelection().getRangeAt(0);
	var br = document.createElement("br");
	range.insertNode(br);
	range.setStartAfter(br);
	MM.App.current.updateSubtree();
}

MM.Command.Cancel = Object.create(MM.Command, {
	editMode: {value: true},
	keys: {value: [{keyCode: 27}]}
});
MM.Command.Cancel.execute = function() {
	MM.App.editing = false;
	MM.App.current.stopEditing();
	var oldText = MM.App.current.getText();
	if (!oldText) { /* newly added node */
		var action = new MM.Action.RemoveItem(MM.App.current);
		MM.App.action(action);
	}
}

MM.Command.Style = Object.create(MM.Command, {
	editMode: {value: null},
	command: {value: ""}
});

MM.Command.Style.execute = function() {
	if (MM.App.editing) {
		document.execCommand(this.command, null, null);
	} else {
		MM.Command.Edit.execute();
		var selection = getSelection();
		var range = selection.getRangeAt(0);
		range.selectNodeContents(MM.App.current.getDOM().text);
		selection.removeAllRanges();
		selection.addRange(range);
		this.execute();
		MM.Command.Finish.execute();
	}
}

MM.Command.Bold = Object.create(MM.Command.Style, {
	command: {value: "bold"},
	label: {value: "Bold"},
	keys: {value: [{keyCode: "B".charCodeAt(0), ctrlKey:true}]}
});

MM.Command.Underline = Object.create(MM.Command.Style, {
	command: {value: "underline"},
	label: {value: "Underline"},
	keys: {value: [{keyCode: "U".charCodeAt(0), ctrlKey:true}]}
});

MM.Command.Italic = Object.create(MM.Command.Style, {
	command: {value: "italic"},
	label: {value: "Italic"},
	keys: {value: [{keyCode: "I".charCodeAt(0), ctrlKey:true}]}
});

MM.Command.Strikethrough = Object.create(MM.Command.Style, {
	command: {value: "strikeThrough"},
	label: {value: "Strike-through"},
	keys: {value: [{keyCode: "S".charCodeAt(0), ctrlKey:true}]}
});

MM.Command.Value = Object.create(MM.Command, {
	label: {value: "Set value"},
	keys: {value: [{charCode: "v".charCodeAt(0), ctrlKey:false}]}
});
MM.Command.Value.execute = function() {
	var item = MM.App.current;
	var oldValue = item.getValue();
	var newValue = prompt("Set item value", oldValue);
	if (newValue == null) { return; }

	if (!newValue.length) { newValue = null; }

	var numValue = parseFloat(newValue);
	var action = new MM.Action.SetValue(item, isNaN(numValue) ? newValue : numValue);
	MM.App.action(action);
}

MM.Command.Yes = Object.create(MM.Command, {
	label: {value: "Yes"},
	keys: {value: [{charCode: "y".charCodeAt(0), ctrlKey:false}]}
});
MM.Command.Yes.execute = function() {
	var item = MM.App.current;
	var status = (item.getStatus() == "yes" ? null : "yes");
	var action = new MM.Action.SetStatus(item, status);
	MM.App.action(action);
}

MM.Command.No = Object.create(MM.Command, {
	label: {value: "No"},
	keys: {value: [{charCode: "n".charCodeAt(0), ctrlKey:false}]}
});
MM.Command.No.execute = function() {
	var item = MM.App.current;
	var status = (item.getStatus() == "no" ? null : "no");
	var action = new MM.Action.SetStatus(item, status);
	MM.App.action(action);
}

MM.Command.Maybe = Object.create(MM.Command, {
	label: {value: "Maybe"},
	keys: {value: [{charCode: "m".charCodeAt(0), ctrlKey:false}]}
});
MM.Command.Maybe.execute = function() {
	var item = MM.App.current;
	var status = (item.getStatus() == "maybe" ? null : "maybe");
	var action = new MM.Action.SetStatus(item, status);
	MM.App.action(action);
}


text:
package tests;

import static org.junit.Assert.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.*;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.Month;

import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.jupiter.api.Test;

import time.GameClock;

public class TestGameClock {

	@Test
	void testTimeConversion() {
		GameClock newClock = new GameClock();
		newClock.setStartTime(0);
		newClock.setEndTime(60000);
		long conversion = newClock.timeConversion();
		assertEquals(conversion, (newClock.getIncreasedTime() + (newClock.getIncreasedTime() * newClock.getIncreasePercent())));
		assertNotEquals(conversion, (newClock.getIncreasedTime() + ((newClock.getIncreasedTime() + 1) * newClock.getIncreasePercent())));
		assertNotEquals(conversion, (newClock.getIncreasedTime() + (345346 * newClock.getIncreasePercent())));
	}

	@Test
	void testUpdateGameTime() {
		LocalDateTime testTimeBase = LocalDateTime.of(LocalDate.of(2021, Month.DECEMBER, 2), LocalTime.of(5, 0, 0));
		String testTimeFast;
		GameClock newClock = new GameClock();
		newClock.setBaseTime(testTimeBase);
		newClock.setStartTime(0);
		newClock.setEndTime(6000000);
		newClock.updateGameTime();
		testTimeFast = newClock.getFastTime().format(newClock.getDateTimeFormat());
		assertFalse(testTimeFast.equals(newClock.getBaseTime().format(newClock.getDateTimeFormat())));

	}

	@BeforeClass
	void testValues() {
		GameClock newClock = new GameClock();
		assertEquals(newClock.getStartTime(), 0);
		assertEquals(newClock.getEndTime(), 0);
	}

	@Test
	void testDayRollOver() {
		LocalDateTime testTimeBase = LocalDateTime.of(LocalDate.of(2021, Month.OCTOBER, 23), LocalTime.of(23, 59, 59));
		GameClock newClock = new GameClock();
		newClock.setBaseTime(testTimeBase);
		newClock.splitDateTime(newClock.getBaseTime());
		String baseDate = newClock.getGameDate();
		newClock.setStartTime(0);
		newClock.setEndTime(6000000);
		newClock.updateGameTime();
		String fastDate = newClock.getGameDate();
		assertFalse(fastDate.equalsIgnoreCase(baseDate));
	}

}


text:
package org.marketcetera.core.instruments;

import org.marketcetera.util.misc.ClassVersion;
import org.marketcetera.util.log.SLF4JLoggerProxy;
import org.marketcetera.trade.Instrument;
import org.apache.commons.lang.Validate;

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

import com.google.common.collect.ImmutableMap;

/* $License$ */
/**
 * A selector that maintains a mapping of {@link InstrumentFunctionHandler}
 * instance for each instrument type. The handler for a instrument can be
 * obtained via {@link #forInstrument(Instrument)}.
 * <p>
 * Since creation of an instance of the selector is an expensive operation,
 * it's recommended that a singleton instance of this selector be created
 * for processing.
 *
 * @param <T> the type of handler selected by this instance.
 *
 * @author anshul@marketcetera.com
 * @version $Id: StaticInstrumentFunctionSelector.java 16688 2013-09-19 03:18:45Z colin $
 * @since 2.0.0
 */
@SuppressWarnings("rawtypes")
@ClassVersion("$Id: StaticInstrumentFunctionSelector.java 16688 2013-09-19 03:18:45Z colin $")
public final class StaticInstrumentFunctionSelector<T extends InstrumentFunctionHandler> {
    /**
     * Creates an instance.
     *
     * @param inClass the instrument function handler class. Cannot be null.
     */
    public StaticInstrumentFunctionSelector(Class<T> inClass) {
        Validate.notNull(inClass, "class");  //$NON-NLS-1$
        mClass = inClass;
        Map<Class<?>, T> handlers =
                new HashMap<Class<?>, T>();
        ServiceLoader<T> loader = ServiceLoader.load(inClass);
        for (T t : loader) {
            handlers.put(t.getInstrumentType(), t);
        }
        SLF4JLoggerProxy.debug(this, "Available handlers {}", handlers);  //$NON-NLS-1$
        mHandlers = ImmutableMap.copyOf(handlers);
    }

    /**
     * Returns the Instrument function handler for the supplied instrument.
     *
     * @param inInstrument the instrument, cannot be null.
     *
     * @return the function for the supplied instrument
     *
     * @throws IllegalArgumentException if the function for the supplied
     *                                       instrument is not available.
     */
    public T forInstrument(Instrument inInstrument) {
        Validate.notNull(inInstrument, "instrument");  //$NON-NLS-1$
        Class<? extends Instrument> cls = inInstrument.getClass();
        T t = mHandlers.get(cls);
        if (t == null) {
            throw new IllegalArgumentException(
                    Messages.NO_HANDLER_FOR_INSTRUMENT.getText(cls.getName(),
                            mClass.getName()));
        }
        return t;
    }

    protected Map<Class<?>, T> getHandlers() {
        return mHandlers;
    }

    private final Class<T> mClass;
    private final Map<Class<?>, T> mHandlers;
}