text:
Elm.Native.PointerLock = {}
Elm.Native.PointerLock.make = function(elm) {

  elm.Native = elm.Native || {};
  elm.Native.PointerLock = elm.Native.PointerLock || {};
  if (elm.Native.PointerLock.values) return elm.Native.PointerLock.values;

  var Signal = Elm.Signal.make(elm);
  var Utils = Elm.Native.Utils.make(elm);

  var movement = Signal.constant(Utils.Tuple2(0,0));
  movement.defaultNumberOfKids = 2;

  // do not move dx and dy into Elm. By setting their default number
  // of kids, it is possible to detach the mouse listeners if
  // they are not needed.
  var dx = A2( Signal.lift, function(p){return p._0}, movement);
  dx.defaultNumberOfKids = 0;
  var dy = A2( Signal.lift, function(p){return p._1}, movement);
  dy.defaultNumberOfKids = 0;

  var isLocked = Signal.constant(false);

  var node = elm.display === ElmRuntime.Display.FULLSCREEN ? document : elm.node;

  var requestPointerLock = node.requestPointerLock || node.mozRequestPointerLock || node.webkitRequestPointerLock;
  var exitPointerLock = node.exitPointerLock || node.mozExitPointerLock || node.webkitExitPointerLock;

  function move(e) {
    var movementX = e.movementX || e.mozMovementX || e.webkitMovementX || 0,
        movementY = e.movementY || e.mozMovementY || e.webkitMovementY || 0;
    elm.notify(movement.id, (movementX, movementY));
  }

  function change() {
    if (document.pointerLockElement == node ||
        document.mozPointerLockElement == node ||
        document.webkitPointerLockElement == node) {
      // Pointer was just locked
      // Enable the mousemove listener
      node.addListener('mousemove', move);
      elm.notify(isLocked, true);
    } else {
      node.removeListener('mousemove', move);
      elm.notify(isLocked, false);
    }
  }

  elm.addListener([isLocked.id], node, 'pointerlockchange', change);
  elm.addListener([isLocked.id], node, 'mozpointerlockchange', change);
  elm.addListener([isLocked.id], node, 'webkitpointerlockchange', change);

  elm.addListener([movement.id], node, 'mousemove', function move(e) {
    elm.notify(movement.id, Utils.getXY(e));
  });

  return elm.Native.PointerLock.values = {
    requestPointerLock: requestPointerLock,
    exitPointerLock: exitPointerLock,

    movement:movement,
    dx:dx,
    dy:dy,
    isLocked: isLocked
  };
};


text:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >

    <PreferenceCategory android:title="@string/user_interface_label">
        <CheckBoxPreference android:title="@string/pref_display_only_episodes_title" android:summary="@string/pref_display_only_episodes_sum" android:key="prefDisplayOnlyEpisodes"/>
        <ListPreference android:entryValues="@array/theme_values" android:entries="@array/theme_options" android:title="@string/pref_set_theme_title" android:key="prefTheme" android:summary="@string/pref_set_theme_sum" android:defaultValue="0"/>
    </PreferenceCategory><PreferenceCategory android:title="@string/playback_pref" >
        <CheckBoxPreference
            android:defaultValue="true"
            android:enabled="true"
            android:key="prefPauseOnHeadsetDisconnect"
            android:summary="@string/pref_pauseOnHeadsetDisconnect_sum"
            android:title="@string/pref_pauseOnHeadsetDisconnect_title" />
        <CheckBoxPreference
            android:defaultValue="false"
            android:enabled="true"
            android:key="prefFollowQueue"
            android:summary="@string/pref_followQueue_sum"
            android:title="@string/pref_followQueue_title" />

    </PreferenceCategory>
    <PreferenceCategory android:title="@string/network_pref" >
        <ListPreference
            android:defaultValue="0"
            android:entries="@array/update_intervall_values"
            android:entryValues="@array/update_intervall_values"
            android:key="prefAutoUpdateIntervall"
            android:summary="@string/pref_autoUpdateIntervall_sum"
            android:title="@string/pref_autoUpdateIntervall_title" />

        <CheckBoxPreference
            android:defaultValue="false"
            android:enabled="true"
            android:key="prefMobileUpdate"
            android:summary="@string/pref_mobileUpdate_sum"
            android:title="@string/pref_mobileUpdate_title" />
        <ListPreference android:defaultValue="20" android:entries="@array/episode_cache_size_entries" android:key="prefEpisodeCacheSize" android:title="@string/pref_episode_cache_title" android:entryValues="@array/episode_cache_size_values"/><PreferenceScreen android:summary="@string/pref_automatic_download_sum" android:key="prefAutoDownloadSettings" android:title="@string/pref_automatic_download_title">
            <CheckBoxPreference android:key="prefEnableAutoDl" android:title="@string/pref_automatic_download_title" android:defaultValue="false"/><CheckBoxPreference android:key="prefEnableAutoDownloadWifiFilter" android:title="@string/pref_autodl_wifi_filter_title" android:summary="@string/pref_autodl_wifi_filter_sum"/>

        </PreferenceScreen>

    </PreferenceCategory>
    <PreferenceCategory android:title="@string/flattr_settings_label" >
        <PreferenceScreen
            android:key="pref_flattr_authenticate"
            android:summary="@string/pref_flattr_auth_sum"
            android:title="@string/pref_flattr_auth_title" >
            <intent android:action=".activities.FlattrAuthActivity" />
        </PreferenceScreen>

        <Preference
            android:key="prefRevokeAccess"
            android:summary="@string/pref_revokeAccess_sum"
            android:title="@string/pref_revokeAccess_title" />
    </PreferenceCategory>
    <PreferenceCategory android:title="@string/other_pref" >
        <Preference android:title="@string/choose_data_directory" android:key="prefChooseDataDir"/><Preference
            android:key="prefFlattrThisApp"
            android:summary="@string/pref_flattr_this_app_sum"
            android:title="@string/pref_flattr_this_app_title" >
        </Preference>
        <Preference android:key="prefOpmlExport" android:title="@string/opml_export_label"/><Preference
            android:key="prefAbout"
            android:title="@string/about_pref" />

    </PreferenceCategory>

</PreferenceScreen>

redpajama_set_name: RedPajamaGithub


text:
package org.apereo.portal.portlet.rendering;

import java.util.Locale;

import javax.portlet.CacheControl;
import javax.servlet.http.HttpServletResponse;

import org.apereo.portal.portlet.om.IPortletWindow;
import org.apereo.portal.utils.web.PortletMimeHttpServletResponseWrapper;

/**
 * Wrapper for the portal response when a portlet is handling a resource request. As much is
 * delegated to the {@link PortletResourceOutputHandler} as possible
 *
 * @author Eric Dalquist
 */
public class PortletResourceHttpServletResponseWrapper extends PortletMimeHttpServletResponseWrapper {
    private final PortletResourceOutputHandler portletResourceOutputHandler;

    public PortletResourceHttpServletResponseWrapper(HttpServletResponse httpServletResponse, IPortletWindow portletWindow,
            PortletResourceOutputHandler portletResourceOutputHandler, CacheControl cacheControl) {
        super(httpServletResponse, portletWindow, portletResourceOutputHandler, cacheControl);
        this.portletResourceOutputHandler = portletResourceOutputHandler;
    }

    @Override
    public void setCharacterEncoding(String charset) {
        this.portletResourceOutputHandler.setCharacterEncoding(charset);
    }

    @Override
    public void setContentLength(int len) {
        this.portletResourceOutputHandler.setContentLength(len);
    }

    @Override
    public void setLocale(Locale locale) {
        this.portletResourceOutputHandler.setLocale(locale);
    }

    @Override
    public void setStatus(int status) {
        this.portletResourceOutputHandler.setStatus(status);
    }

    @Override
    public void setStatus(int sc, String sm) {
        this.portletResourceOutputHandler.setStatus(sc);
    }

    @Override
    public void setDateHeader(String name, long date) {
        this.portletResourceOutputHandler.setDateHeader(name, date);
    }

    @Override
    public void addDateHeader(String name, long date) {
        this.portletResourceOutputHandler.addDateHeader(name, date);
    }

    @Override
    public void setHeader(String name, String value) {
        this.portletResourceOutputHandler.setHeader(name, value);
    }

    @Override
    public void addHeader(String name, String value) {
        this.portletResourceOutputHandler.addHeader(name, value);
    }

    @Override
    public void setIntHeader(String name, int value) {
        this.portletResourceOutputHandler.setIntHeader(name, value);
    }

    @Override
    public void addIntHeader(String name, int value) {
        this.portletResourceOutputHandler.addIntHeader(name, value);
    }

    @Override
    public boolean containsHeader(String name) {
        return this.portletResourceOutputHandler.containsHeader(name);
    }

    @Override
    public String getCharacterEncoding() {
        return this.portletResourceOutputHandler.getCharacterEncoding();
    }

    @Override
    public Locale getLocale() {
        return this.portletResourceOutputHandler.getLocale();
    }
}


text:
using Microsoft.SharePoint.Client;
using System;

namespace OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.TokenDefinitions
{
    internal class TermStoreIdToken : TokenDefinition
    {
        private readonly string _value = null;
        public TermStoreIdToken(Web web, string storeName, Guid id)
            : base(web, string.Format("{{termstoreid:{0}}}", storeName))
        {
            _value = id.ToString();
        }

        public override string GetReplaceValue()
        {
            if (string.IsNullOrEmpty(CacheValue))
            {
                CacheValue = _value;
            }
            return CacheValue;
        }
    }
}


text:
#include <stdio.h>
#include <errno.h>
#include "libltfs/kmi_ops.h"
#include "libltfs/ltfs_fuse_version.h"
#include <fuse.h>
#include "key_format_ltfs.h"

#ifdef mingw_PLATFORM
#include "libltfs/arch/win/win_util.h"
#endif

struct kmi_flatfile_options_data {
	unsigned char *dk_list;        /**< DK and DKi pairs' list */
	unsigned char *dki_for_format; /**< DKi to get DK for formatting a volume */
};

static struct kmi_flatfile_options_data priv;

#define KMI_FLATFILE_OPT(templ,offset,value) { templ, offsetof(struct kmi_flatfile_options_data, offset), value }

static struct fuse_opt kmi_flatfile_options[] = {
	KMI_FLATFILE_OPT("kmi_dk_list=%s",        dk_list,       0),
	KMI_FLATFILE_OPT("kmi_dki_for_format=%s", dki_for_format, 0),
	FUSE_OPT_END
};

/**
 * Convert original dk_list to dk_list on simple plug-in format
 * @path original dk_list i.e. path to the key list file on flat file format
 * @dk_list dk_list on simple plug-in format
 * @return 0 on success or a negative value on error.
 */
static int convert_option(const unsigned char * const path, unsigned char **dk_list)
{
	CHECK_ARG_NULL(dk_list, -LTFS_NULL_ARG);

	struct {
		const char * const name;
		const unsigned char separetor;
	} tag[2] = { { "DK=", '/' }, { "DKi=", ':' } };
	int ret = 0;
	int dk_list_length = 1; /* for '\0' at the end of string */
	int dk_list_offset = 0;
	*dk_list = calloc(dk_list_length, sizeof(unsigned char));
	if (! *dk_list) {
		ltfsmsg(LTFS_ERR, 10001E, __FUNCTION__);
		return -LTFS_NO_MEMORY;
	}

	FILE *fp = fopen((const char *) path, "r");
	if (! fp) {
		ret = -errno;
		ltfsmsg(LTFS_ERR, 15553E, path, ret);
		return ret;
	}

	char buf[1024];
	unsigned int num_of_lines = 0; /* number of lines which has a valid info */
	for (num_of_lines = 0; fgets(buf, sizeof(buf), fp); ++num_of_lines) {
		const int i = num_of_lines % 2;
		if (! strncmp(buf, tag[i].name, strlen(tag[i].name))) {
			if (buf[strlen(buf) - 1] == '\n')
				buf[strlen(buf) - 1] = '\0';

			if (num_of_lines == 0)
				dk_list_length += strlen(buf) - strlen(tag[i].name);
			else
				dk_list_length += SEPARATOR_LENGTH + strlen(buf) - strlen(tag[i].name);

			void *new_dk_list = realloc(*dk_list, dk_list_length);
			if (! new_dk_list) {
				ltfsmsg(LTFS_ERR, 10001E, __FUNCTION__);
				fclose(fp);
				return -LTFS_NO_MEMORY;
			}
			*dk_list = new_dk_list;

			if (num_of_lines != 0) {
				*(*dk_list + dk_list_offset) = tag[i].separetor;
				dk_list_offset += SEPARATOR_LENGTH;
			}

			const size_t value_length = strlen(buf) - strlen(tag[i].name);
			memcpy(*dk_list + dk_list_offset, buf + strlen(tag[i].name), value_length);
			dk_list_offset += value_length;
			*(*dk_list + dk_list_offset) = '\0';
		} else if (buf[0] == '\n') {
			/* skip a blank line */
			--num_of_lines;
			continue;
		} else {
			ret = -1;
			ltfsmsg(LTFS_ERR, 15554E);
			break;
		}
	}
	fclose(fp);
	if (ret < 0) {
		return ret;
	}

	return 0;
}

/**
 * Initialize the flat file key manager interface plugin.
 * @param vol LTFS volume
 * @return a pointer to the private data on success or NULL on error.
 */
void *flatfile_init(struct ltfs_volume *vol)
{
	void* km;

	km = key_format_ltfs_init(vol);
	if (km)
		ltfsmsg(LTFS_DEBUG, 15550D);

	return km;
}

/**
 * Destroy the flat file key manager interface plugin.
 * @param kmi_handle the key manager interface handle
 * @return 0 on success or a negative value on error.
 */
int flatfile_destroy(void * const kmi_handle)
{
	int ret;

	ret = key_format_ltfs_destroy(kmi_handle);
	ltfsmsg(LTFS_DEBUG, 15551D);

	return ret;
}

/**
 * Get Key
 * @param keyalias Get key of the key-alias. If *keyalias is NULL, get key of default key-alias
 * @param key Memory is allocated and key is stored at the address.
 * @param kmi_handle the key manager interface handle
 * @return 0 on success or a negative value on error.
 */
int flatfile_get_key(unsigned char **keyalias, unsigned char **key, void * const kmi_handle)
{
	static unsigned char *dk_list = NULL; /* dk_list on simple plug-in format */

	if (priv.dk_list && dk_list == NULL) {
		int ret = convert_option(priv.dk_list, &dk_list);
		if (ret < 0) {
			ltfsmsg(LTFS_ERR, 15552E);
			if (dk_list) {
				free(dk_list);
			}
			return ret;
		}
	}

	const int ret = key_format_ltfs_get_key(keyalias, key, kmi_handle, dk_list, priv.dki_for_format);

/*
 *  Cache DK and DKi for revalidation at tape drive POR
 *	if (dk_list) {
 *		free(dk_list);
 *		dk_list = NULL;
 *	}
 */
	return ret;
}

/**
 * Print a help message for the flatfile plugin.
 */
int flatfile_help_message(void)
{
	ltfsresult(15568I);

	return 0;
}

static int null_parser(void *priv, const char *arg, int key, struct fuse_args *outargs)
{
	return 1;
}

/**
 * Parse flatfile plugin specific options.
 * @param opt_args Pointer to a FUSE argument structure, suitable for passing to
 *                 fuse_opt_parse(). See the file backend for an example of argument parsing.
 * @return 0 on success or a negative value on error.
 */
int flatfile_parse_opts(void *opt_args)
{
	struct fuse_args *args = (struct fuse_args *) opt_args;
	int ret;

#ifdef mingw_PLATFORM
	/* Initialized kmi_flatfile_options_data because it is reused by multi mounts on Windows. */
	free(priv.dki_for_format);
	priv.dki_for_format = NULL;
	free(priv.dk_list);
	priv.dk_list = NULL;
#endif

	/* fuse_opt_parse can handle a NULL device parameter just fine */
	ret = fuse_opt_parse(args, &priv, kmi_flatfile_options, null_parser);
	if (ret < 0) {
		ltfsmsg(LTFS_ERR, 15564E, ret);
		return ret;
	}

	return 0;
}

struct kmi_ops flatfile_ops = {
	.init         = flatfile_init,
	.destroy      = flatfile_destroy,
	.get_key      = flatfile_get_key,
	.help_message = flatfile_help_message,
	.parse_opts   = flatfile_parse_opts,
};

struct kmi_ops *kmi_get_ops(void)
{
	return &flatfile_ops;
}

#ifndef mingw_PLATFORM
extern char kmi_flatfile_dat[];
#endif

const char *kmi_get_message_bundle_name(void ** const message_data)
{
#ifndef mingw_PLATFORM
	*message_data = kmi_flatfile_dat;
#else
	*message_data = NULL;
#endif
	return "kmi_flatfile";
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
    <display-name>GeoServer</display-name>

      <context-param>
    <param-name>serviceStrategy</param-name>
    <!-- Meaning of the different values :

         PARTIAL-BUFFER2
         - Partially buffers the first xKb to disk. Once that has buffered, the the
           result is streamed to the user. This will allow for most errors to be caught
           early.

         BUFFER
         - stores the entire response in memory first, before sending it off to
           the user (may run out of memory)

         SPEED
         - outputs directly to the response (and cannot recover in the case of an
           error)

         FILE
         - outputs to the local filesystem first, before sending it off to the user
      -->
    <param-value>PARTIAL-BUFFER2</param-value>
  </context-param>

  <!-- If true, enable versioning datastore as well -->
  <context-param>
    <param-name>enableVersioning</param-name>
    <param-value>true</param-value>
  </context-param>

  <context-param>
    <!-- see comments on the PARTIAL-BUFFER strategy -->
    <!-- this sets the size of the buffer.  default is "50" = 50kb -->

    <param-name>PARTIAL_BUFFER_STRATEGY_SIZE</param-name>
    <param-value>50</param-value>
  </context-param>

    <!--
    <context-param>
      <param-name>PROXY_BASE_URL</param-name>
      <param-value>http://82.58.146.45/geoserver</param-value>
    </context-param>
     -->

     <!--
    <context-param>
       <param-name>GEOSERVER_DATA_DIR</param-name>
        <param-value>C:\eclipse\workspace\geoserver_trunk\cite\confCiteWFSPostGIS</param-value>
    </context-param>
   -->

    <!-- pick up all spring application contexts -->
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath*:/applicationContext.xml classpath*:/applicationSecurityContext.xml</param-value>
    </context-param>

    <filter>
     <filter-name>FlushSafeFilter</filter-name>
     <filter-class>org.geoserver.filters.FlushSafeFilter</filter-class>
    </filter>

    <filter>
      <filter-name>Set Character Encoding</filter-name>
      <filter-class>org.vfny.geoserver.filters.SetCharacterEncodingFilter</filter-class>
      <init-param>
        <param-name>encoding</param-name>
        <param-value>UTF-8</param-value>
      </init-param>
    </filter>

    <filter>
     <filter-name>SessionDebugger</filter-name>
     <filter-class>org.geoserver.filters.SessionDebugFilter</filter-class>
    </filter>

    <filter>
    <filter-name>filterChainProxy</filter-name>
     <filter-class> org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    </filter>

   <filter>
     <filter-name>GZIP Compression Filter</filter-name>
     <filter-class>org.geoserver.filters.GZIPFilter</filter-class>
     <init-param>
         <!-- The compressed-types parameter is a comma-separated list of regular expressions.
              If a mime type matches any of the regular expressions then it will be compressed.
              -->
         <param-name>compressed-types</param-name>
         <param-value>text/.*,.*xml.*,application/json,application/x-javascript</param-value>
     </init-param>
   </filter>

   <filter>
     <filter-name>Request Logging Filter</filter-name>
     <filter-class>org.geoserver.filters.LoggingFilter</filter-class>
     <init-param>
         <!-- The 'enabled' parameter is a boolean value, "true" (case-insensitive) for true or
              any other value for false.  If enabled, then the logging will be performed;
              otherwise the logging filter will have no effect.  If not specified, this
              parameter defaults to false.
              -->
         <param-name>enabled</param-name>
         <param-value>false</param-value>
     </init-param>
     <init-param>
     <!-- The 'log-request-bodies' parameter is a boolean value, "true" (case-insensitive) for
          true or any other value for false.  If enabled, then the logging will include the body
          of POST and PUT requests.  If not specified, this parameter defaults to false.
          Note that this may noticeably degrade responsiveness of your geoserver since it will
          not begin to process requests until the entire request body has been received by the
          server.
          -->
     <param-name>log-request-bodies</param-name>
     <param-value>false</param-value>
     </init-param>
   </filter>

   <filter>
     <filter-name>Advanced Dispatch Filter</filter-name>
     <filter-class>org.geoserver.platform.AdvancedDispatchFilter</filter-class>
     <!--
     This filter allows for a single mapping to the spring dispatcher. However using /* as a mapping
     in a servlet mapping causes the servlet path to be "/" of the request. This causes problems with
     library like wicket and restlet. So this filter fakes the servlet path by assuming the first
     component of the path is the mapped path.
     -->
   </filter>

   <filter>
    <filter-name>Spring Delegating Filter</filter-name>
    <filter-class>org.geoserver.filters.SpringDelegatingFilter</filter-class>
    <!--
    This filter allows for filters to be loaded via spring rather than
    registered here in web.xml.  One thing to note is that for such filters
    init() is not called. INstead any initialization is performed via spring
    ioc.
    -->
   </filter>

   <filter>
     <filter-name>Thread locals cleanup filter</filter-name>
     <filter-class>org.geoserver.filters.ThreadLocalsCleanupFilter</filter-class>
     <!--
     This filter cleans up thread locals Geotools is setting up for concurrency and performance
     reasons
     -->
   </filter>

    <!--
      THIS FILTER MUST BE THE FIRST ONE, otherwise we end up with ruined chars in the input from the GUI
      See the "Note" in the Tomcat character encoding guide:
      http://wiki.apache.org/tomcat/FAQ/CharacterEncoding
    -->
    <filter-mapping>
      <filter-name>Set Character Encoding</filter-name>
      <url-pattern>/*</url-pattern>
    </filter-mapping>

    <filter-mapping>
      <filter-name>FlushSafeFilter</filter-name>
      <url-pattern>/*</url-pattern>
    </filter-mapping>

    <filter-mapping>
      <filter-name>SessionDebugger</filter-name>
      <url-pattern>/*</url-pattern>
    </filter-mapping>

    <filter-mapping>
      <filter-name>GZIP Compression Filter</filter-name>
      <url-pattern>/*</url-pattern>
    </filter-mapping>

    <filter-mapping>
      <filter-name>Request Logging Filter</filter-name>
      <url-pattern>/*</url-pattern>
    </filter-mapping>

    <!--
      If you want to use your security system comment out this one too
    -->
    <filter-mapping>
      <filter-name>filterChainProxy</filter-name>
      <url-pattern>/*</url-pattern>
    </filter-mapping>

    <filter-mapping>
      <filter-name>Advanced Dispatch Filter</filter-name>
      <url-pattern>/*</url-pattern>
    </filter-mapping>

    <filter-mapping>
      <filter-name>Spring Delegating Filter</filter-name>
      <url-pattern>/*</url-pattern>
    </filter-mapping>

    <filter-mapping>
      <filter-name>Thread locals cleanup filter</filter-name>
      <url-pattern>/*</url-pattern>
    </filter-mapping>

    <!-- general initializer, should be first thing to execute -->
    <listener>
      <listener-class>org.geoserver.GeoserverInitStartupListener</listener-class>
    </listener>

    <!-- logging initializer, should execute before spring context startup -->
    <listener>
      <listener-class>org.geoserver.logging.LoggingStartupContextListener</listener-class>
    </listener>

    <!--  spring context loader -->
    <listener>
      <listener-class>org.geoserver.platform.GeoServerContextLoaderListener</listener-class>
    </listener>

    <!--  http session listener proxy -->
    <listener>
      <listener-class>org.geoserver.platform.GeoServerHttpSessionListenerProxy</listener-class>
    </listener>

    <!-- spring dispatcher servlet, dispatches all incoming requests -->
    <servlet>
      <servlet-name>dispatcher</servlet-name>
      <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    </servlet>

    <!-- single mapping to spring, this only works properly if the advanced dispatch filter is
         active -->
    <servlet-mapping>
        <servlet-name>dispatcher</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>

    <mime-mapping>
      <extension>xsl</extension>
      <mime-type>text/xml</mime-type>
    </mime-mapping>
    <mime-mapping>
      <extension>sld</extension>
      <mime-type>text/xml</mime-type>
    </mime-mapping>

    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
    </welcome-file-list>

</web-app>


text:
<?php

// Disallow direct access to this file
defined('_JEXEC') or die('Restricted access');

if( $this->requestType == 'component' )
{
	$url	= 'index.php?option=com_community&view=memberlist&tmpl=component&object=' . $this->object;
}
else
{
	$url	= 'index.php?option=com_community&view=memberlist&task=memberlist';
}
?>

<form action="<?php echo $url;?>" method="post" name="adminForm" id="adminForm">

			<?php echo JText::_( 'COM_COMMUNITY_FILTER' ); ?>:
			<input type="text" name="search" id="search" value="" class="text_area" onchange="document.adminForm.submit();" />
			<button onclick="this.form.submit();"><?php echo JText::_( 'COM_COMMUNITY_GO_BUTTON' ); ?></button>
			<button onclick="document.getElementById('search').value='';this.form.submit();"><?php echo JText::_( 'COM_COMMUNITY_RESET' ); ?></button>

			<?php echo JText::_( 'COM_COMMUNITY_NUM' ); ?>

			<?php if( $this->requestType == 'component' ){ ?>
			<?php echo JHTML::_('grid.sort','ID', 'a.id', $this->orderDirection , $this->ordering ); ?>
			<?php }else{ ?>
				<input type="checkbox" name="toggle" value="" onclick="Joomla.checkAll(this)" />
			<?php } ?>

			<?php echo JHTML::_('grid.sort','Title', 'a.title', $this->orderDirection , $this->ordering ); ?>

			<?php echo JHTML::_('grid.sort', 'Description', 'description', $this->orderDirection , $this->ordering ); ?>

			<?php echo JHTML::_('grid.sort', 'Date', 'a.created', $this->orderDirection, $this->ordering ); ?>

			<?php echo JHTML::_('grid.sort', 'ID', 'a.id', $this->orderDirection, $this->ordering ); ?>

<?php
$k = 0;
$i = 0;
foreach( $this->memberlist as $row )
{
	$link 	= '';
	$date	= JHTML::_('date',  $row->created, JText::_('DATE_FORMAT_LC4') );
?>
	<tr class="<?php echo "row$k"; ?>">

			<?php echo ($i + 1); ?>

			<?php if( $this->requestType == 'component' ){ ?>
				<?php echo $row->id; ?>
			<?php }else{ ?>
				<?php echo JHTML::_('grid.id', $i++, $row->id); ?>
			<?php } ?>

			<?php if( $this->requestType == 'component' ){ ?>
				<a style="cursor: pointer;" onclick="window.parent.jSelectMemberList('<?php echo $row->id;?>','<?php echo str_replace(array("'", "\""), array("\\'", ""),$row->title); ?>','<?php echo $this->object;?>');"><?php echo htmlspecialchars($row->title, ENT_QUOTES, 'UTF-8'); ?>
			<?php }else{ ?>
				<?php echo htmlspecialchars($row->title, ENT_QUOTES, 'UTF-8'); ?>
			<?php } ?>

			<?php echo $row->description;?>

			<?php echo $date; ?>

			<?php echo $row->id; ?>

<?php
	$k = 1 - $k;
}
?>

		<?php echo $this->pagination->getListFooter(); ?>

<?php if( $this->requestType != 'component' ){ ?>
<input type="hidden" name="view" value="memberlist" />
<input type="hidden" name="option" value="com_community" />
<input type="hidden" name="task" value="memberlist" />
<?php } ?>

<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="filter_order" value="<?php echo $this->ordering;?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $this->orderDirection; ?>" />
</form>


text:
using extensions::FeatureSwitch;
using extensions::ExtensionRegistry;

// This file contains high-level startup tests for the extensions system. We've
// had many silly bugs where command line flags did not get propagated correctly
// into the services, so we didn't start correctly.

// A waiter for manifest content script loads. The waiter finishes when all of
// its observed extensions have finished loading their manifest scripts.
class ManifestContentScriptWaiter
    : public extensions::UserScriptLoader::Observer {
 public:
  ManifestContentScriptWaiter() = default;
  ~ManifestContentScriptWaiter() = default;
  ManifestContentScriptWaiter(const ManifestContentScriptWaiter& other) =
      delete;
  ManifestContentScriptWaiter& operator=(
      const ManifestContentScriptWaiter& other) = delete;

  // Adds an extension for this waiter to wait on their next script load.
  void Observe(extensions::UserScriptLoader* loader) {
    scoped_observation_.AddObservation(loader);
  }

  // Start waiting for manifest scripts to be loaded.
  void Wait() {
    if (scoped_observation_.IsObservingAnySource())
      run_loop_.Run();
  }

 private:
  // UserScriptLoader::Observer:
  void OnScriptsLoaded(extensions::UserScriptLoader* loader,
                       content::BrowserContext* browser_context) override {
    ASSERT_TRUE(loader->initial_load_complete());
    scoped_observation_.RemoveObservation(loader);
    if (!scoped_observation_.IsObservingAnySource())
      run_loop_.Quit();
  }

  void OnUserScriptLoaderDestroyed(
      extensions::UserScriptLoader* loader) override {
    scoped_observation_.RemoveObservation(loader);
  }

  base::RunLoop run_loop_;

  base::ScopedMultiSourceObservation<extensions::UserScriptLoader,
                                     extensions::UserScriptLoader::Observer>
      scoped_observation_{this};
};

class ExtensionStartupTestBase : public InProcessBrowserTest {
 public:
  ExtensionStartupTestBase() : unauthenticated_load_allowed_(true) {
    num_expected_extensions_ = 3;
  }

 protected:
  // InProcessBrowserTest
  void SetUpCommandLine(base::CommandLine* command_line) override {
    if (load_extensions_.empty()) {
      // If no |load_extensions_| were specified, allow unauthenticated
      // extension settings to be loaded from Preferences as if they had been
      // authenticated correctly before they were handed to the ExtensionSystem.
      command_line->AppendSwitchASCII(
          switches::kForceFieldTrials,
          base::StringPrintf(
              "%s/%s/", chrome_prefs::internals::kSettingsEnforcementTrialName,
              chrome_prefs::internals::kSettingsEnforcementGroupNoEnforcement));
#if defined(OS_WIN) || defined(OS_MAC)
      // In Windows and MacOS builds, it is not possible to disable settings
      // enforcement.
      unauthenticated_load_allowed_ = false;
#endif
    } else {
      base::FilePath::StringType paths = base::JoinString(
          load_extensions_, base::FilePath::StringType(1, ','));
      command_line->AppendSwitchNative(extensions::switches::kLoadExtension,
                                       paths);
      command_line->AppendSwitch(switches::kDisableExtensionsFileAccessCheck);
    }
  }

  bool SetUpUserDataDirectory() override {
    base::FilePath profile_dir;
    base::PathService::Get(chrome::DIR_USER_DATA, &profile_dir);
    profile_dir = profile_dir.AppendASCII(TestingProfile::kTestUserProfileDir);
    base::CreateDirectory(profile_dir);

    preferences_file_ = profile_dir.Append(chrome::kPreferencesFilename);
    user_scripts_dir_ = profile_dir.AppendASCII("User Scripts");
    extensions_dir_ = profile_dir.AppendASCII("Extensions");

    if (load_extensions_.empty()) {
      base::FilePath src_dir;
      base::PathService::Get(chrome::DIR_TEST_DATA, &src_dir);
      src_dir = src_dir.AppendASCII("extensions").AppendASCII("good");

      base::CopyFile(src_dir.Append(chrome::kPreferencesFilename),
                     preferences_file_);
      base::CopyDirectory(src_dir.AppendASCII("Extensions"), profile_dir,
                          true);  // recursive
    }
    return true;
  }

  void SetUpInProcessBrowserTestFixture() override {
    // Bots are on a domain, turn off the domain check for settings hardening in
    // order to be able to test all SettingsEnforcement groups.
    chrome_prefs::DisableDomainCheckForTesting();
  }

  void TearDown() override {
    EXPECT_TRUE(base::DeleteFile(preferences_file_));

    // TODO(phajdan.jr): Check return values of the functions below, carefully.
    base::DeletePathRecursively(user_scripts_dir_);
    base::DeletePathRecursively(extensions_dir_);

    InProcessBrowserTest::TearDown();
  }

  static int GetNonComponentEnabledExtensionCount(Profile* profile) {
    extensions::ExtensionRegistry* registry =
        extensions::ExtensionRegistry::Get(profile);
    int found_extensions = 0;
    for (const auto& extension : registry->enabled_extensions()) {
      if (!extensions::Manifest::IsComponentLocation(extension->location()))
        ++found_extensions;
    }
    return found_extensions;
  }

  void WaitForServicesToStart(int num_expected_extensions,
                              bool expect_extensions_enabled) {
    extensions::ExtensionSystem* extension_system =
        extensions::ExtensionSystem::Get(browser()->profile());
    // Wait until the extension system is ready.
    base::RunLoop run_loop;
    extension_system->ready().Post(FROM_HERE, run_loop.QuitClosure());
    run_loop.Run();

    if (!unauthenticated_load_allowed_)
      num_expected_extensions = 0;
    ASSERT_EQ(num_expected_extensions,
              GetNonComponentEnabledExtensionCount(browser()->profile()));

    ASSERT_EQ(expect_extensions_enabled,
              extension_system->extension_service()->extensions_enabled());

    if (num_expected_extensions == 0)
      return;

    extensions::ExtensionRegistry* registry =
        extensions::ExtensionRegistry::Get(browser()->profile());

    ManifestContentScriptWaiter waiter;
    extensions::UserScriptManager* manager =
        extensions::ExtensionSystem::Get(browser()->profile())
            ->user_script_manager();

    for (const auto& extension : registry->enabled_extensions()) {
      extensions::ExtensionUserScriptLoader* loader =
          manager->GetUserScriptLoaderForExtension(extension->id());

      // Do not wait for extensions which have no manifest scripts or have
      // already finished a script load.
      if (!extensions::ContentScriptsInfo::GetContentScripts(extension.get())
               .empty() &&
          !loader->initial_load_complete()) {
        waiter.Observe(loader);
      }
    }

    waiter.Wait();
  }

  void TestInjection(bool expect_css, bool expect_script) {
    if (!unauthenticated_load_allowed_) {
      expect_css = false;
      expect_script = false;
    }

    // Load a page affected by the content script and test to see the effect.
    base::FilePath test_file;
    base::PathService::Get(chrome::DIR_TEST_DATA, &test_file);
    test_file =
        test_file.AppendASCII("extensions").AppendASCII("test_file.html");

    ASSERT_TRUE(ui_test_utils::NavigateToURL(
        browser(), net::FilePathToFileURL(test_file)));

    bool result = false;
    ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
        browser()->tab_strip_model()->GetActiveWebContents(),
        "window.domAutomationController.send("
        "    document.defaultView.getComputedStyle(document.body, null)."
        "    getPropertyValue('background-color') == 'rgb(245, 245, 220)')",
        &result));
    EXPECT_EQ(expect_css, result);

    result = false;
    ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
        browser()->tab_strip_model()->GetActiveWebContents(),
        "window.domAutomationController.send(document.title == 'Modified')",
        &result));
    EXPECT_EQ(expect_script, result);
  }

  base::FilePath preferences_file_;
  base::FilePath extensions_dir_;
  base::FilePath user_scripts_dir_;
  // True unless unauthenticated extension settings are not allowed to be
  // loaded in this configuration.
  bool unauthenticated_load_allowed_;
  // Extensions to load from the command line.
  std::vector<base::FilePath::StringType> load_extensions_;

  int num_expected_extensions_;
};

// ExtensionsStartupTest
// Ensures that we can startup the browser with --enable-extensions and some
// extensions installed and see them run and do basic things.
typedef ExtensionStartupTestBase ExtensionStartupTest;

IN_PROC_BROWSER_TEST_F(ExtensionStartupTest, Test) {
  WaitForServicesToStart(num_expected_extensions_, true);
  TestInjection(true, true);
}

// Tests that disallowing file access on an extension prevents it from injecting
// script into a page with a file URL.
IN_PROC_BROWSER_TEST_F(ExtensionStartupTest, NoFileAccess) {
  WaitForServicesToStart(num_expected_extensions_, true);

  // Keep a separate list of extensions for which to disable file access, since
  // doing so reloads them.
  std::vector<const extensions::Extension*> extension_list;

  extensions::ExtensionRegistry* registry =
      extensions::ExtensionRegistry::Get(browser()->profile());
  for (extensions::ExtensionSet::const_iterator it =
           registry->enabled_extensions().begin();
       it != registry->enabled_extensions().end(); ++it) {
    if ((*it)->location() == extensions::mojom::ManifestLocation::kComponent)
      continue;
    if (extensions::util::AllowFileAccess((*it)->id(), browser()->profile()))
      extension_list.push_back(it->get());
  }

  extensions::UserScriptManager* manager =
      extensions::ExtensionSystem::Get(browser()->profile())
          ->user_script_manager();

  for (size_t i = 0; i < extension_list.size(); ++i) {
    extensions::ExtensionId id = extension_list[i]->id();
    extensions::TestExtensionRegistryObserver registry_observer(registry, id);
    ManifestContentScriptWaiter waiter;

    extensions::util::SetAllowFileAccess(id, browser()->profile(), false);
    registry_observer.WaitForExtensionLoaded();
    extensions::ExtensionUserScriptLoader* loader =
        manager->GetUserScriptLoaderForExtension(id);
    if (!loader->initial_load_complete()) {
      waiter.Observe(loader);
      waiter.Wait();
    }
  }

  TestInjection(false, false);
}

// ExtensionsLoadTest
// Ensures that we can startup the browser with --load-extension and see them
// run.
class ExtensionsLoadTest : public ExtensionStartupTestBase {
 public:
  ExtensionsLoadTest() {
    base::FilePath one_extension_path;
    base::PathService::Get(chrome::DIR_TEST_DATA, &one_extension_path);
    one_extension_path = one_extension_path.AppendASCII("extensions")
                             .AppendASCII("good")
                             .AppendASCII("Extensions")
                             .AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj")
                             .AppendASCII("1.0.0.0");
    load_extensions_.push_back(one_extension_path.value());
  }
};

IN_PROC_BROWSER_TEST_F(ExtensionsLoadTest, Test) {
  WaitForServicesToStart(1, true);
  TestInjection(true, true);
}

#if BUILDFLAG(IS_CHROMEOS_ASH)

IN_PROC_BROWSER_TEST_F(ExtensionsLoadTest,
                       SigninProfileCommandLineExtensionsDontLoad) {
  // The --load-extension command line flag should not be applied to the sign-in
  // profile.
  EXPECT_EQ(0, GetNonComponentEnabledExtensionCount(
                   chromeos::ProfileHelper::GetSigninProfile()));
}

#endif  // BUILDFLAG(IS_CHROMEOS_ASH)

// ExtensionsLoadMultipleTest
// Ensures that we can startup the browser with multiple extensions
// via --load-extension=X1,X2,X3.
class ExtensionsLoadMultipleTest : public ExtensionStartupTestBase {
 public:
  ExtensionsLoadMultipleTest() {
    base::FilePath one_extension_path;
    base::PathService::Get(chrome::DIR_TEST_DATA, &one_extension_path);
    one_extension_path = one_extension_path.AppendASCII("extensions")
                             .AppendASCII("good")
                             .AppendASCII("Extensions")
                             .AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj")
                             .AppendASCII("1.0.0.0");
    load_extensions_.push_back(one_extension_path.value());

    base::FilePath second_extension_path;
    base::PathService::Get(chrome::DIR_TEST_DATA, &second_extension_path);
    second_extension_path =
        second_extension_path.AppendASCII("extensions").AppendASCII("app");
    load_extensions_.push_back(second_extension_path.value());

    base::FilePath third_extension_path;
    base::PathService::Get(chrome::DIR_TEST_DATA, &third_extension_path);
    third_extension_path =
        third_extension_path.AppendASCII("extensions").AppendASCII("app1");
    load_extensions_.push_back(third_extension_path.value());

    base::FilePath fourth_extension_path;
    base::PathService::Get(chrome::DIR_TEST_DATA, &fourth_extension_path);
    fourth_extension_path =
        fourth_extension_path.AppendASCII("extensions").AppendASCII("app2");
    load_extensions_.push_back(fourth_extension_path.value());
  }
};

IN_PROC_BROWSER_TEST_F(ExtensionsLoadMultipleTest, Test) {
  WaitForServicesToStart(4, true);
  TestInjection(true, true);
}

// TODO(catmullings): Remove test in future chrome release, perhaps M59.
class DeprecatedLoadComponentExtensionSwitchBrowserTest
    : public extensions::ExtensionBrowserTest {
 public:
  DeprecatedLoadComponentExtensionSwitchBrowserTest() {}

  void SetUpCommandLine(base::CommandLine* command_line) override;

  ExtensionRegistry* GetExtensionRegistry() {
    return ExtensionRegistry::Get(browser()->profile());
  }
};

void DeprecatedLoadComponentExtensionSwitchBrowserTest::SetUpCommandLine(
    base::CommandLine* command_line) {
  extensions::ExtensionBrowserTest::SetUpCommandLine(command_line);
  base::FilePath fp1(test_data_dir_.AppendASCII("app_dot_com_app/"));
  base::FilePath fp2(test_data_dir_.AppendASCII("app/"));

  command_line->AppendSwitchASCII(
      "load-component-extension",
      fp1.AsUTF8Unsafe() + "," + fp2.AsUTF8Unsafe());
}

// Tests that the --load-component-extension flag is not supported.
IN_PROC_BROWSER_TEST_F(DeprecatedLoadComponentExtensionSwitchBrowserTest,
                       DefunctLoadComponentExtensionFlag) {
  EXPECT_TRUE(extension_service()->extensions_enabled());

  // Checks that the extensions loaded with the --load-component-extension flag
  // are not installed.
  bool is_app_dot_com_extension_installed = false;
  bool is_app_test_extension_installed = false;
  for (const scoped_refptr<const extensions::Extension>& extension :
       GetExtensionRegistry()->enabled_extensions()) {
    if (extension->name() == "App Dot Com: The App") {
      is_app_dot_com_extension_installed = true;
    } else if (extension->name() == "App Test") {
      is_app_test_extension_installed = true;
    } else {
      EXPECT_TRUE(
          extensions::Manifest::IsComponentLocation(extension->location()));
    }
  }
  EXPECT_FALSE(is_app_dot_com_extension_installed);
  EXPECT_FALSE(is_app_test_extension_installed);
}

class DisableExtensionsExceptBrowserTest
    : public extensions::ExtensionBrowserTest {
 public:
  DisableExtensionsExceptBrowserTest() {}

  void SetUpCommandLine(base::CommandLine* command_line) override;

  ExtensionRegistry* GetExtensionRegistry() {
    return ExtensionRegistry::Get(browser()->profile());
  }
};

void DisableExtensionsExceptBrowserTest::SetUpCommandLine(
    base::CommandLine* command_line) {
  extensions::ExtensionBrowserTest::SetUpCommandLine(command_line);
  base::FilePath fp1(test_data_dir_.AppendASCII("app_dot_com_app/"));
  base::FilePath fp2(test_data_dir_.AppendASCII("app/"));

  command_line->AppendSwitchASCII(
      switches::kDisableExtensionsExcept,
      fp1.AsUTF8Unsafe() + "," + fp2.AsUTF8Unsafe());

  command_line->AppendSwitch(switches::kNoErrorDialogs);
}

// Tests disabling all extensions except those listed
// (--disable-extensions-except).
IN_PROC_BROWSER_TEST_F(DisableExtensionsExceptBrowserTest,
                       DisableExtensionsExceptFlag) {
  EXPECT_FALSE(extension_service()->extensions_enabled());

  // Checks that the extensions loaded with the --disable-extensions-except flag
  // are enabled.
  bool is_app_dot_com_extension_enabled = false;
  bool is_app_test_extension_enabled = false;
  for (const scoped_refptr<const extensions::Extension>& extension :
       GetExtensionRegistry()->enabled_extensions()) {
    if (extension->name() == "App Dot Com: The App") {
      is_app_dot_com_extension_enabled = true;
    } else if (extension->name() == "App Test") {
      is_app_test_extension_enabled = true;
    } else {
      EXPECT_TRUE(
          extensions::Manifest::IsComponentLocation(extension->location()));
    }
  }
  EXPECT_TRUE(is_app_dot_com_extension_enabled);
  EXPECT_TRUE(is_app_test_extension_enabled);
}


text:
    <title>ACE Software Development Guidelines</title>
    <link rev=made href="mailto:ace-users@cs.wustl.edu">

ACE Software Development Guidelines

General

Every text file must end with a newline.

Use spaces instead of tabs, except in Makefiles.  Emacs users
        can add this to their .emacs:

(setq-default indent-tabs-mode nil)

        Microsoft Visual C++ users should do the following:

        Choose:  Tools -- Options -- Tabs
        Then Set:  "Tab size" to 8 and "Indent size" to 2, and
        indent using spaces.

Do not end text lines with spaces.  Emacs users can add this to
        their .emacs:

(setq-default nuke-trailing-whitespace-p t)

        Newer versions of emacs will require the following instead:

(add-hook 'before-save-hook 'delete-trailing-whitespace)

        Note for Microsoft Visual Studio .NET Users:

There is a macro project (ace_guidelines.vsmacros)
        located in $ACE_ROOT/docs that replaces tabs with spaces
        and removes trailing spaces each time you save a file.

Try to limit the length of source code lines to less than 80
        characters.  Users with 14 inch monitors appreciate it when
        reading code.  And, it avoids mangling problems with email
        and net news.

Try to avoid creating files with excessively long names (45 characters).
        Moreover, ensure that the names of generated files e.g. MakeProjectCreator,
        tao_idl do not also go beyond that limit. Some operating
        systems cannot handle very long file names correctly.

If you add a comment to code that is directed to, or
        requires the attention of, a particular individual:
        SEND EMAIL TO THAT INDIVIDUAL!.

Every program should have a "usage" message.  It should be
        printed out if erroneous command line arguments, or a
        -? command line argument, are
        provided to the program.

An ACE-using program's entry point should use the portable form:

        int ACE_TMAIN (int argc, ACE_TCHAR *argv[])

        This form is portable to all ACE platforms whether using narrow
        or wide characters. The other two common forms:

        int main (int argc, char *argv[])
        int wmain (int argc, wchar_t *argv[])

        as well as any other main entrypoint form should only be used
        when there is some overarching reason to not use the portable form.
        One example would be a Windows GUI program that requires WinMain.

See $ACE_ROOT/docs/wchar.txt
        for more information on ACE support on wchar.

The program entry point function, in any form mentioned above, must
        always be declared with arguments, e.g.,

        int
        ACE_TMAIN (int argc, ACE_TCHAR *argv[])
        {
          [...]

          return 0;
        }

        If you don't use the argc and/or argv
        arguments, don't declare them, e.g.,

        int
        ACE_TMAIN (int, ACE_TCHAR *[])
        {
          [...]

          return 0;
        }

        Please declare the second argument as ACE_TCHAR *[]
        instead of ACE_TCHAR ** or char *[].
        Ancient versions of MSC++
        complained about ACE_TCHAR ** and char
        *[] is not Unicode-compliant.

        main must also return 0 on successful
        termination, and non-zero otherwise.

Avoid use of floating point types (float and
            double) and operations
        unless absolutely necessary.  Not all ACE platforms support them.
        Therefore, wherever they are used, ACE_LACKS_FLOATING_POINT
        conditional code must be also be used.

Avoid including the string "Error" in a source
            code filename. GNU Make's error messages start with
            "Error".  So, it's much easier to search for
            errors if filenames don't contain "Error".

Narrow interfaces are better than wide interfaces.  If there
        isn't a need for an interface, leave it out.  This eases maintenance,
        minimizes footprint, and reduces the likelihood of interference
        when other interfaces need to be added later.  (See the
        ACE_Time_Value example
        .

 Never use assert() macros or related constructs
         (such as abort()) calls in core ACE, TAO, and CIAO
         library/framework code.  These macros are a major problem for
         production software that uses this code since the
         error-handling strategy (i.e., abort the process) is
         excessive.  Instead, extract out the expressions from
         assert() macros and use them as
         precondition/postconditions/invariants in the
         software and return any violations of these
         conditions/invariants via exceptions or error return values.
         It's fine to use assert() macros et al. in test
         programs, but make sure these tests never find their way into
         the core ACE, TAO, and CIAO library/framework code base.

Coding Style

 When writing ACE, TAO, and CIAO class and method names make sure to use underscores ('_') to separate the parts of a name rather than intercaps.  For example, use

        class ACE_Monitor_Control
        {
        public:
          int read_monitor (void);
          // ...
        };

rather than

        class ACEMonitorControl
        {
        public:
          int readMonitor (void);
          // ...
        };

Code Documentation

Use comments and whitespace (:-) liberally.  Comments
        should consist of complete sentences, i.e., start
        with a capital letter and end with a period.

Insert a svn keyword string at the top of every source file,
        Makefile, config file, etc.  For C++ files, it is:

        // $Id$

        It is not necessary to fill in the fields of the keyword string,
        or modify them when you edit a file that already has one. SVN
        does that automatically when you checkout or update the file.

        To insert that string at the top of a file:

        perl -pi -e \
          'if (! $o) {printf "// \$Id\$\n\n";}; $o = 1;' file

Be sure to follow the guidelines and restrictions for use of the
        documentation tools for ACE
        header files, which must follow the
        Doxygen
        format requirements.
        The complete documentation for Doxygen is available in the

        Doxygen manual.
        For an example header file using Doxygen-style comments,
        please refer to ACE.h.

The header file comment should at least contain the following
        entries:

        /**
         * @file Foo.h
         * @author Authors Name <author@email.org>
         *
         *  A few words describing the file.
         */

A class should be commented this way:

        /**
         * @class Foo_Impl
         * @brief A brief description of the class
         *
         * A more detailed description.
         */

The preferred way to document methods is:

         /// This function foos the bars
         /// another line of documentation if necessary
         /// @param bar The bar you want to foo
         void foo (int bar);

All binary options for ACE and TAO should be specified in
        terms of the integral values 0 and 1, rather than "true" and
        "false" or "yes" and "no".  All TAO options should be
        documented in the online
        TAO options document.
.

Preprocessor

Never #include standard headers directly, except in a few
        specific ACE files, e.g., OS.h and stdcpp.h.  Let
        those files #include the correct headers.  If you do not do
        this, your code will not compile with the Standard C++ Library.

Always use #if defined (MACRONAME)
        to test if a macro is defined, rather than the simpler
        #if MACRONAME. Doxygen requires this.
        The one exception to this the macros used to prevent multiple
        inclusion of header files, as shown below.

Always follow a preprocessor #endif
        with a /*  */ C-style comment. Using
        C-style comments with preprocessor code is required for some old
        compilers. It should correspond to the condition in the matching
        #if directive.  For example,

        #if defined (ACE_HAS_THREADS)
        # if defined (ACE_HAS_STHREADS)
        #   include /**/ <synch.h>
        #   include /**/ <thread.h>
        #   define ACE_SCOPE_PROCESS P_PID
        #   define ACE_SCOPE_LWP P_LWPID
        #   define ACE_SCOPE_THREAD (ACE_SCOPE_LWP + 1)
        # else
        #   define ACE_SCOPE_PROCESS 0
        #   define ACE_SCOPE_LWP 1
        #   define ACE_SCOPE_THREAD 2
        # endif /* ACE_HAS_STHREADS */
        #endif /* ACE_HAS_THREADS */

Be sure to put spaces around comment delimiters, e.g.,
        char * /* foo */ instead of
        char */*foo*/.  MS VC++
        complains otherwise.

Always insert a /**/ between an
        #include and
        filename, for system headers and
        ace/pre.h and
        ace/post.h as
        shown in the above example.  This avoids dependency problems
        with Visual C++ and prevents Doxygen from including the
        headers in the file reference trees.

Be very careful with names of macros, enum values, and variables
        It's always best to prefix them with something like ACE_
        or TAO_.  There are too many system headers out
        there that #define OK, SUCCESS,
        ERROR, index, s_type,
        and so on.

When using macros in an arithmetic expression, be sure to test
      that the macro is defined, using defined(macro) before specifying
      the expression.  For example:

#if __FreeBSD__ < 3

will evaluate true on any platform where __FreeBSD__ is
not defined.  The correct way to write that guard is:

#if defined (__FreeBSD__)  &&  __FreeBSD__ < 3

If using g++, problems like this can be flagged as a warning by using the "-Wundef" command line option.

Try to centralize #ifdefs with typedefs
        and #defines.  For example, use this:

        #if defined(ACE_PSOS)
          typedef long ACE_NETIF_TYPE;
        # define ACE_DEFAULT_NETIF 0
        #else  /* ! ACE_PSOS */
          typedef const TCHAR* ACE_NETIF_TYPE;
        # define ACE_DEFAULT_NETIF ASYS_TEXT("le0")
        #endif /* ! ACE_PSOS */

        instead of:

        #if defined (ACE_PSOS)
          // pSOS supports numbers, not names for network interfaces
          long net_if,
        #else  /* ! ACE_PSOS */
          const TCHAR *net_if,
        #endif /* ! ACE_PSOS */

Protect header files against multiple inclusion with this
        construct:

        #ifndef FOO_H
        #define FOO_H

        [contents of header file]

        #endif /* FOO_H */

        This exact construct (note the #ifndef)
        is optimized by many compilers such they only open the
        file once per compilation unit.  Thanks to Eric C. Newton
        <ecn@smart.net> for pointing that out.

        If the header #includes an ACE library header,
        then it's a good idea to include the #pragma once
        directive:

        #ifndef FOO_H
        #define FOO_H

        #include "ace/ACE.h"
        #if !defined (ACE_LACKS_PRAGMA_ONCE)
        # pragma once
        #endif /* ACE_LACKS_PRAGMA_ONCE */

        [contents of header file]

        #endif /* FOO_H */

        #pragma once must be protected, because some
        compilers complain about it.  The protection depends on
        ACE_LACKS_PRAGMA_ONCE, which is defined in
        some ACE config headers.  Therefore, the protected
        #pragma once construct should only be used after
        an #include of an ACE library header.  Note that
        many compilers enable the optimization if the #ifndef
        protection construct is used, so for them, #pragma once
        is superfluous.

        No code can appear after the final
        #endif for the optimization to be effective and
        correct.

Files that contain parametric classes should follow this style:

      #ifndef FOO_T_H
      #define FOO_T_H

      #include "ace/ACE.h"
      #if !defined (ACE_LACKS_PRAGMA_ONCE)
      # pragma once
      #endif /* ACE_LACKS_PRAGMA_ONCE */

      // Put your template declarations here...

      #if defined (__ACE_INLINE__)
      #include "Foo_T.inl"
      #endif /* __ACE_INLINE__ */

      #if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
      #include "Foo_T.cpp"
      #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */

      #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
      #pragma implementation "Foo_T.cpp"
      #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */

      #endif /* FOO_T_H */

      Notice that some compilers need to see the code of the template,
      hence the .cpp file must be included from the
      header file.

      To avoid multiple inclusions of the .cpp file it
      should also be protected as in:

      #ifndef FOO_T_CPP
      #define FOO_T_CPP

      #include "Foo_T.h"
      #if !defined (ACE_LACKS_PRAGMA_ONCE)
      # pragma once
      #endif /* ACE_LACKS_PRAGMA_ONCE */

      #if !defined (__ACE_INLINE__)
      #include "ace/Foo_T.inl"
      #endif /* __ACE_INLINE__ */

      // put your template code here

      #endif /* FOO_T_H */

Finally, you may want to include the template header file from a
      non-template header file (check
      $ACE_ROOT/ace/Synch.h); in such a case the template
      header should be included after the inline
      function definitions, as in:

      #ifndef FOO_H
      #define FOO_H

      #include "ace/ACE.h"
      #if !defined (ACE_LACKS_PRAGMA_ONCE)
      # pragma once
      #endif /* ACE_LACKS_PRAGMA_ONCE */

      // Put your non-template declarations here...

      #if defined (__ACE_INLINE__)
      #include "Foo.inl"
      #endif /* __ACE_INLINE__ */

      #include "Foo_T.h"

      #endif /* FOO_H */

Avoid #include <math.h> if at all possible.
      The /usr/include/math.h on SunOS 5.5.1 through 5.7
      defines a struct name exception, which complicates
      use of exceptions.

On a .cpp file always include the corresponding
      header file first, like this:

        // This is Foo.cpp

        #include "Foo.h"
        #include "tao/Bar.h"
        #include "ace/Baz.h"

        // Here comes the Foo.cpp code....

      In this way we are sure that the header file is self-contained
      and can be safely included from some place else.

In the TAO library never include
      <corba.h&gt, this file should only be included
      by the user and introduces cyclic dependencies in the library
      that we must avoid.

Never include a header file when a forward reference will do,
      remember that templates can be forward referenced too.
      Consult your favorite C++ book to find out when you must include
      the full class definition.

C++ Syntax and Constructs

for loops should look like:

        for (unsigned int i = 0; i < count; ++i)
          ++total;

        Similarly, if statements should have
        a space after the "if", and no spaces just after
        the opening parenthesis and just before the closing parenthesis.

        If there's just one statement in the loop or if statement
        there's no need to use additional braces.

If a loop index is used after the body of the loop, it
        must be declared before the loop.  For example,

        size_t i = 0;
        for (size_t j = 0; file_name [j] != '\0'; ++i, ++j)
          {
            if (file_name [j] == '\\' && file_name [j + 1] == '\\')
              ++j;

            file_name [i] = file_name [j];
          }

        // Terminate this string.
        file_name [i] = '\0';

Prefix operators are generally more efficient than postfix
       operators.  Therefore, they are preferred over their postfix
       counterparts where the expression value is not used.

       Therefore, use this idiom for iterators, with prefix operator
       on the loop index:

       ACE_Ordered_MultiSet<int> set;
       ACE_Ordered_MultiSet_Iterator<int> iter(set);

       for (i = -10; i < 10; ++i)
         set.insert (2 * i + 1);

       rather than the postfix operator:

       for (i = -10; i < 10; i++)
         set.insert (2 * i + 1);

Prefer using   if (...) else ....
    instead of   ?:   operator. It is a lot
    less error prone, and will help you avoid bugs caused due to the
    precedence of   ?:  , compared with other
    operators in an expression.

When a class provides operator==, it must also provide
        operator!=.  Also, both these operators must be
        const and return bool.

Avoid unnecessary parenthesis.  We're not writing Lisp :-)

Put inline member functions in a .inl
        file.  That file is conditionally included by both the
        .h file, for example:

            class ACE_Export ACE_High_Res_Timer
            {
              [...]
            };

            #if defined (__ACE_INLINE__)
            #include "ace/High_Res_Timer.inl"
            #endif /* __ACE_INLINE__ */

        and .cpp file:

            #define ACE_BUILD_DLL
            #include "ace/High_Res_Timer.h"

            #if !defined (__ACE_INLINE__)
            #include "ace/High_Res_Timer.inl"
            #endif /* __ACE_INLINE__ */

            ACE_ALLOC_HOOK_DEFINE(ACE_High_Res_Timer)

        NOTE: It is very important to ensure than an
        inline function will not be used before its definition is seen.
        Therefore, the inline functions in the .inl file should be arranged
        properly.  Some compilers, such as g++ with the
        -Wall option, will issue warnings for violations.

Some inlining heuristics:

One liners should almost always be inline, as in:

ACE_INLINE
Foo::bar ()
{
  this->baz ();
}

The notable exception is virtual functions, which should
            generally not be inlined.

Big (more than 10 lines) and complex function (more than one if ()
          statement, or a switch, or a loop) should not be inlined.

Medium sized stuff depends on how performance critical it is.
          If you know that it's in the critical path, then make it
                inline.  When in doubt, profile the code.

ACE_Export must be inserted between the
        class keyword and class name for all classes that
        are exported from libraries, as shown in the example above.
        However, do not use
        ACE_Export for template classes or classes that
        are not used out of the ACE library, for example.!

Mutators and accessors should be of this form:

        /// Sets @c object_addr_ cache from @c host and @c port.
        void object_addr (const ACE_INET_Addr &);

        /// Returns the ACE_INET_Addr for this profile.
        const ACE_INET_Addr &object_addr const (void);

        instead of the "set_" and "get_" form.

Never use delete to deallocate
        memory that was allocated with malloc.
        Similarly, never associate free with
        new.
        ACE_NEW or
        ACE_NEW_RETURN should be used to
        allocate memory, and delete should
        be used to deallocate it.  And be careful to use the correct form,
        delete or
        delete [] to correspond to the
        allocation.

Don't check for a pointer being 0 before deleting it.  It's
        always safe to delete a 0 pointer.  If the pointer is visible
        outside the local scope, it's often a good idea to 0 it
        _after_ deleting it.  Note, the same argument applies to
        free().

Always use ACE_NEW or
        ACE_NEW_RETURN to allocate memory,
        because they check for successful allocation and set errno
        appropriately if it fails.

Never compare or assign a pointer value with NULL;
        use 0 instead.  The language allows any pointer to
        be compared or assigned with 0.  The definition
        of NULL is implementation dependent, so it is
        difficult to use portably without casting.

Never cast a pointer to or from an int
        or a long.  On all currently supported
        ACE platforms, it is safe to cast a pointer to or from
        intptr_t or
        uintptr_t (include ace/Basic_Types.h).

Be very careful when selecting an integer type that must be a
        certain size, e.g., 4 bytes.  long is
        not 4 bytes on all platforms; it is 8 bytes on many 64-bit
        machines.  ACE_UINT32 is always 4 bytes, and ACE_UINT64 is
        always 8 bytes.

If a class has any virtual functions, and its destructor is
        declared explicitly in the class, then the destructor should
        always be virtual as well.  And to support
        compiler activities such as generation of virtual tables and,
        in some cases, template instantiation, the virtual destructor
        should not be inline.  (Actually, any non-pure
        virtual function could be made non-inline for this purpose.  But,
        for convenience, if its performance is not critical, it is usually
        easiest just to make the virtual destructor non-inline.)

Avoid default arguments
        unless there's a good reason.  For an example of how they got
        us into a jam is:

        ACE_Time_Value (long sec, long usec = 0);

        So, ACE_Time_Value (2.5) has the unfortunate
        effect of coercing the 2.5 to a long with value 2.  That's
        probably not what the programmer intended, and many compilers
        don't warn about it.

        A nice fix would be to add an ACE_Time_Value (double)
        constructor.  But, that would cause ambiguous overloading
        due to the default value for the second argument of
        ACE_Time_Value (long sec, long usec = 0).
        We're stuck with ACE_Time_Value, but now we
        know that it's easy to avoid.

Constructor initializers must appear in the same order as
        the data members are declared in the class header.  This avoids
        subtle errors, because initialization takes place in the order
        of member declaration.

Initialization is usually cleaner than assignment, especially
        in a conditional.  So, instead of writing code like this:

        ssize_t n_bytes;

        // Send multicast of one byte, enough to wake up server.
        if ((n_bytes = multicast.send ((char *) &reply_port,
          sizeof reply_port)) == -1)

        Write it like this:

        ssize_t n_bytes = multicast.send ((char *) &reply_port,
          sizeof reply_port)

        // Send multicast of one byte, enough to wake up server.
        if (n_bytes == -1)

        But, beware if the initialization is of a static variable.
        A static variable is only initialized the first time its
        declaration is seen.  Of course, we should avoid using
        static (and non-constant) variables at all.

It is usually clearer to write conditionals that have
        both branches without a negated condition.  For example,

        if (test)
          {
            // true branch
          }
        else
          {
            // false branch
          }

        is preferred over:

        if (! test)
          {
            // false test branch
          }
        else
          {
            // true test branch
          }

If a cast is necessary, avoid use of C-style "sledgehammer"
            casts.  Use standard C++ casts
            (e.g. static_cast<int> (foo)) instead.

In general, if instances of a class should not be copied,
        then a private copy constructor and assignment operator should
        be declared for the class, but not implemented.  For example:

        // Disallow copying by not implementing the following . . .
        ACE_Object_Manager (const ACE_Object_Manager &);
        ACE_Object_Manager &operator= (const ACE_Object_Manager &);

        If the class is a template class, then the
        ACE_UNIMPLEMENTED_FUNC macro should be used:

        // = Disallow copying...
        ACE_UNIMPLEMENTED_FUNC (ACE_TSS (const ACE_TSS<TYPE> &))
        ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_TSS<TYPE> &))

        ACE_UNIMPLEMENTED_FUNC can be used with non-template
        classes as well.  Though for consistency and maximum safety, it
        should be avoided for non-template classes.

Never use BOOL, or similar types.
            (ACE_CDR::Boolean and
            CORBA::Boolean are acceptable).  Use the
            standard C++ bool for boolean variables, instead.

Functions should always return -1 to indicate failure, and
        0 or greater to indicate success.

Separate the code of your templates from the code for
        non-parametric classes: some compilers get confused when
        template and non-template code is mixed in the same file.

It's a good idea to specify the include path (with -I)
        to include any directory which contains files with template
        definitions.  The Compaq Tru64 cxx -ptv compiler option
        may help diagnose missing template instantiation problems.

When referring to member variables and functions, use
        this->member. This makes it clear to the
        reader that a class member is being used. It also makes it crystal
        clear to the compiler which variable/function you mean in cases
        where it might make a difference.

Don't use template template arguments, this C++ construct is not
        supported by the HP aCC 3.70 compiler at this moment. For example the
	following template decleration is one that just doesn't work.

        template<typename S_var, size_t BOUND, template <typename> class Insert_Policy> class A {};

I/O

Use ACE_DEBUG for printouts,
         and ACE_OS::fprintf () for
         file I/O.  Avoid using iostreams because of implementation
         differences across platforms.

After attempting to open an existing file, always check for success.
         Take appropriate action if the open failed.

Notice that ACE_DEBUG and
         ACE_ERROR don't support
         %ld of any other multicharacter format.

WCHAR conformity

For ACE, use ACE_TCHAR instead of char for strings and ACE_TEXT()
         around string literals.  Exceptions are char
            arrays used for data  and strings that need to remain as 1
            byte characters.

If you have a char string that needs to be converted to ACE_TCHAR,
         use the ACE_TEXT_CHAR_TO_TCHAR() macro.  If you have a ACE_TCHAR
         string that needs to be converted to a char string, use the
         ACE_TEXT_ALWAYS_CHAR() macro

Do not use the Win32 TCHAR macros.  The wide character-ness of ACE
         is separate from UNICODE and _UNICODE.

For TAO, don't use ACE_TCHAR or ACE_TEXT.  The CORBA specification
         defines APIs as using char.  So most of the time there is no need
         to use wide characters.

Exceptions

There are many ways of throwing and catching exceptions. The
        code below gives several examples.  Note that each method has
        different semantics and costs. Whenever possible, use the
        first approach.

        #include "iostream.h"

        class exe_foo
        {
        public:
          exe_foo (int data) : data_ (data)
            { cerr << "constructor of exception called" << endl; }
          ~exe_foo ()
            { cerr << "destructor of exception called" << endl; }
          exe_foo (const exe_foo& foo) : data_ (foo.data_)
            { cerr << "copy constructor of exception called"
                   << endl; }
          int data_;
        };

        void
        good (int a)
        {
          throw exe_foo (a);
        };

        void
        bad (int a)
        {
          exe_foo foo (a);
          throw foo;
        };

        int main ()
        {
          cout << endl << "First exception" << endl
               << endl;
          try
            {
              good (0);
            }
          catch (exe_foo &foo)
            {
              cerr << "exception caught: " << foo.data_
                   << endl;
            }

          cout << endl << "Second exception" << endl
               << endl;
          try
            {
              good (0);
            }
          catch (exe_foo foo)
            {
              cerr << "exception caught: " << foo.data_
                   << endl;
            }

          cout << endl << "Third exception" << endl
               << endl;
          try
            {
              bad (1);
            }
          catch (exe_foo &foo)
            {
              cerr << "exception caught: " << foo.data_
                   << endl;
            }

          cout << endl << "Fourth exception" << endl
               << endl;
          try
            {
              bad (1);
            }
          catch (exe_foo foo)
            {
              cerr << "exception caught: " << foo.data_
                   << endl;
            }

          return 0;
        }

     Output is:

        First exception

        constructor of exception called
        exception caught: 0
        destructor of exception called

        Second exception

        constructor of exception called
        copy constructor of exception called
        exception caught: 0
        destructor of exception called
        destructor of exception called

        Third exception

        constructor of exception called
        copy constructor of exception called
        destructor of exception called
        exception caught: 1
        destructor of exception called

        Fourth exception

        constructor of exception called
        copy constructor of exception called
        destructor of exception called
        copy constructor of exception called
        exception caught: 1
        destructor of exception called
        destructor of exception called

Compilation

Whenever you add a new test or example to ACE or TAO, make
        sure that you modify the MPC file in the parent directory.
      This will make sure that your code gets compiled on a
      regular basis.

ACE
  Shared Libary Guidelines

          Create a separate export macro for each dynamic library.  A
          header file containing the export macro and additional
          support macros should be generated by using the ACE_wrappers/bin/generate_export_file.pl Perl script.

          Make sure that your classes, structures and free functions
          are annotated with this export macro.  The only exceptions
          are pure template classes, structures and free functions.

          Only classes (and structures, free functions, etc) that are
          part of the library public interface must be exported
          (e.g. declared with an export macro).  Those that are only
          meant to be used internally need not be exported,
          particularly for g++ >=4.0  since doing so
          defeats some neat optimizations.  Here's a common case in
          where an export macro is generally used unnecessarily:

class FooExport Foo
{
public:
  virtual void kung_fu () = 0;
};

class FooExport Bar : public Foo
{
public:
  virtual void kung_fu ()  { ... }
};

class FooExport FooFactory
{
public:
  Foo * make_foo ()
    {
      // Assume that this implementation is hidden from
      // the application and is consequently out of line.
      return new Bar();
    }
};

          Here the application is only meant to invoke operations
          through a pointer or reference to the abstract base class
          "Foo" created by the "FooFactory",
          not the "Bar" subclass.  In this case,
          exporting "Bar" is unnecessary.  If your
          concrete class is meant to be used outside of the shared
          library (e.g. as a template parameter, within a
          dynamic_cast<>, etc) you must then export
          it.  Otherwise, avoid doing so if you can.

          Make sure that you specify that you are creating a dynamic
          library in your MPC file by adding
          a sharedname tag.

          Make sure that you add the FOO_BUILD_DLL
          preprocessor symbol to the dynamicflags of the
          MPC project that is used to build a library.  Note that the
          export files are setup such that when this macro is defined,
          the symbols are exported, otherwise they are imported.  The
          default behaviour is to set up for import so that clients of
          your library don't need to worry about arcane build flags
          like FOO_BUILD_DLL in their build setup.  This
          ties back to the first item.

          When you specify the order of libraries to link to, make
          sure that the dependent libraries come after the libraries
          which depend on them, i.e., your link line should always
          contain -lDependsOnFoo -lFoo.  Note that this
          is not a requirement on GNU/Linux but linkers on other
          platforms are not as forgiving.

          Use the ACE_SINGLETON_DECLARE macro to declare
          a class as a singleton.  Declare exported (i.e. default
          visibility)  singleton templates prior to typedefs that
          reference them.  This prevents g++ 4.0 from silently making
          their visibility hidden (see Bug 2260 for details).

          Avoid inlining virtual functions in classes that must be
          exported since doing so can cause RTTI related problems
          (e.g. dynamic_cast<> failures) when using
          g++ >= 4.0 due to our use of that compiler's "visibility
          attribute" support that is tied in to the export macros.
          This includes virtual destructors automatically created by
          the compiler when you don't declare one.  Make sure you
          define a no-op out-of-line virtual destructor if your base
          class has a virtual destructor since you may otherwise run
          into the mentioned RTTI problems.

ACE
  Usage Guidelines

Always use the ACE_OS
      namespace functions instead of bare OS system calls.

As a general rule, the only functions that should go into the
      ACE_OS namespace are ones that
        have direct equivalents on some OS platform.  Functions that
        are extensions should go in the
        ACE namespace.

Use the ACE_SYNCH_MUTEX macro,
      instead of using one of the specific mutexes, such as
      ACE_Thread_Mutex.  This provides
      portability between threaded and non-threaded platforms.

Avoid creating a static instance of user-defined (class) type.
      Instead, either create it as an
      ACE_Singleton,
      ACE_TSS_Singleton, or as an
      ACE_Cleanup object.  See the
      ACE
      Singleton.h,
      Object_Manager.h, and
      Managed_Object.h
      header files for more information.

      Static instances of built-in types, such as
      int or any pointer type, are fine.

      Construction of static instance of a user-defined type should
      never spawn threads.  Because order of construction of
      statics across files is not defined by the language, it is usually
      assumed that only one thread exists during static construction.
      This allows statics suchs as locks to be safely created.  We do not
      want to violate this assumption.

Do not use C++ exception handling directly.  Some platforms do
      not support it.  And, it can impose an execution speed penalty.
      Instead use the TAO/ACE try/catch macros.

Because ACE does not use exception handling, dealing with
      failures requires a bit of care.  This is especially true
      in constructors.  Consider the following approach:

      ACE_NEW_RETURN (this->name_space_, LOCAL_NAME_SPACE, -1);

      if (ACE_LOG_MSG->op_status () != 0)
      ....

      This snip of code is from
      ACE_Naming_Context.
      All failed constructors in ACE (should) call ACE_ERROR.  This sets
      the thread-specific op_status, which can be checked
      by the caller.  This mechanism allows the caller to check for a failed
      constructor without the requiring the constructor to throw
      exceptions.

Another consequence of ACE's avoidance of exception handling is
      that you should use open() methods on classes that
      perform initializations that can fail.  This is because open()
      returns an error code that's easily checked by the caller,
      rather than relying on constructor and thread-specific status
      values.

Avoid using the C++ Standard Template Library (STL) in our
      applications.  Some platforms do not support it yet. It is
      safe to use the STL generic algoritms. The following have been
      used already and don't seem to cause any portability issues:

	std::swap
	std::for_each
	std::fill
	std::generate
	std::transform
	std::copy

Be very careful with ACE_ASSERT.  It
      must only be used to check values; it may never be used to
      wrap a function call, or contain any other side effect.  That's
      because the statement will disappear when ACE_NDEBUG is enabled.
      For example, this code is BAD:

      ACE_ASSERT (this->next (retv) != 0);  // BAD CODE!

      Instead, the above should be coded this way:

      int const result = this->next (retv);
      ACE_ASSERT (result != 0);
      ACE_UNUSED_ARG (result);

Never put side effects in ACE_DEBUG code:

      ACE_DEBUG ((LM_DEBUG,
                 "handling signal: %d iterations left\n",
                 --this->iterations_));        // BAD CODE!

      Note that this won't work correctly if ACE_NDEBUG is
      defined, for the same reason that having side-effects in
      ACE_ASSERTs won't work either, i.e., because
      the code is removed.

Be very careful with the code that you put
      in a signal handler.  On Solaris, the man pages document systems
      calls as being Async-Signal-Safe if they can be called from signal
      handlers.  In general, it's best to just set a flag in a signal
      handler and take appropriate action elsewhere.  It's also best
      to avoid using signals, especially asynchronous signals.

Immediately after opening a temporary file, unlink it.  For
      example:

      ACE_HANDLE h = open the file (filename);

      ACE_OS::unlink (filename);

      This avoids leaving the temporary file even if the program crashes.

Be sure to specify the THR_BOUND thread creation
    flag for time-critical threads.  This ensures that the thread competes
    for resources globally on Solaris.  It is harmless on other platforms.

Other
  ACE and
  TAO
  Guidelines

When enhancing, updating, or fixing ACE or TAO, always:

Test your change on at least Windows and Linux before commiting.
      After commiting watch the scoreboard to catch errors your change
      may be related to on other platforms.

Add an entry to the appropriate ChangeLog.  TAO and some
      ACE subdirectories, such as ASNMP,
      JAWS, and
      gperf, have their
      own ChangeLogs.  If you don't use one of those, use the
      ChangeLog in the top-level
      ACE_wrappers directory. A ChangeLog entry should
      have the form:

<tab> * dir/file.ext [(methods)]: description...

      If you have a number of files, the names should be on separate lines.
      In this case, it's also ok to start the description on a new line
      indented to "dir."

Commit your change using a message of this form:

ChangeLogTag: Thu Jul 22 09:55:10 UTC 1999  David L. Levine
 <levine@cs.wustl.edu>

If the change is in response to a request by someone else:

Make sure that person is acknowledged in
        ACE_wrappers/THANKS, and

Respond to that person.

Never add copyrighted, confidential, or otherwise
      restricted code to the ACE or TAO distributions without reviewing
      the situation with DOC management (i.e. Doug Schmidt). You will also
      most likely need to get written permission from the owner. The
      particular language and form needed will be relayed to you after
      discussing it with DOC management.

SVN Usage Guidelines

Always make sure that a change builds and executes correctly
    on at least one platform before checking it into the SVN repository.
    All changes must be tested with g++ before commiting.
    That means you may need to test on at least two platforms.

Script Guidelines

In general, it's best to write scripts in Perl.  It's
    OK to use Bourne shell.  Never, never, never use csh, ksh,
    bash, or any other kind of shell.

Follow the Perl style guide guide as closely as
    possible.  man perlstyle to view it.

Don't specify a hard-coded path to Perl itself.  Use
    the following code at the top of the script to pick up
    perl from the users PATH:

eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
    & eval 'exec perl -S $0 $argv:q'
    if 0;

Never, never, never start the first line of a script
    with "#", unless the first line is "#! /bin/sh".
    With just "#", t/csh users will spawn a new shell.
    That will cause their .[t]cshrc to be
    processed, possibly clobbering a necessary part of
    their environment.

If your Perl script relies on features only available
    in newer versions of Perl, include the a statement similar
    to the following:

        require 5.003;

Don't depend on . being
    in the user's path.  If the script spawns another executable
    that is supposed to be in the current directory, be sure the
    prefix its filename with ..

Software Engineering Guidelines

Advise:  Keep other developers informed of problems
      and progress.

Authorize:  We have contractual obligations to not
      unilaterally change interfaces.  If you need to change or remove an
      interface, get an OK.

Minimize risk:  Test all changes.  Solicit review of
      changes.

Revise only when necessary:  Every change has risk,
      so avoid making any change unless there is a good reason for it.

Normalize:  Factor out commonality.  For example,
      maintain a data value in only one place.

Synthesize:  Build stubs and scaffolding early to
      simulate the complete system.  Maintain a checked-in version of the
      system that cleanly builds and tests at all times.

Be available:  Breaking compilation in one
      platform or another should be avoided (see above),
      but it is bound to happen when so many platforms are in use.
      Be available after making a change,
      if you won't be available for at least 48 hours after the change
      is made then don't make it!

ACE
  Design Rules

Last modified: Wed Nov 23 11:00:44 CST 2005

Back to ACE Documentation Home.


text:
template <typename T, typename S> extern T z;
//- @z defines/binding VarZPsAbsDecl
template <typename U> extern int z<int, U>;
//- @z completes/uniquely VarZPsAbsDecl
template <typename U> int z<int, U>;


text:
package chess
package variant

import chess.format.FEN

case object Horde
    extends Variant(
      id = 8,
      key = "horde",
      name = "Horde",
      shortName = "Horde",
      title = "Destroy the horde to win!",
      standardInitialPosition = false
    ) {

  /** In Horde chess white advances against black with a horde of pawns.
    */
  lazy val pieces: Map[Pos, Piece] = {

    val frontPawns = List(Pos.B5, Pos.C5, Pos.F5, Pos.G5).map { _ -> White.pawn }

    val whitePawnsHorde = frontPawns ++ (for {
      x <- File.all
      y <- Rank.all.take(4)
    } yield (Pos(x, y) -> White.pawn)) toMap

    val blackPieces = (for (y <- List(Rank.Seventh, Rank.Eighth); x <- File.all) yield {
      Pos(x, y) -> (y match {
        case Rank.Eighth  => Black - backRank(x.index)
        case Rank.Seventh => Black.pawn
      })
    }).toMap

    blackPieces ++ whitePawnsHorde
  }

  override val castles = Castles("kq")

  override val initialFen = FEN("rnbqkbnr/pppppppp/8/1PP2PP1/PPPPPPPP/PPPPPPPP/PPPPPPPP/PPPPPPPP w kq - 0 1")

  override def valid(board: Board, strict: Boolean) =
    board.kingPosOf(White).isEmpty && validSide(board, strict)(Black) && !pawnsOnPromotionRank(board, White)

  /** The game has a special end condition when black manages to capture all of white's pawns */
  override def specialEnd(situation: Situation) =
    situation.board.piecesOf(White).isEmpty

  /** Any vs K + any where horde is stalemated and only king can move is a fortress draw
    * This does not consider imminent fortresses such as 8/p7/P7/8/8/P7/8/k7 b - -
    * nor does it consider contrived fortresses such as b7/pk6/P7/P7/8/8/8/8 b - -
    */
  private def hordeClosedPosition(board: Board) = {
    lazy val notKingBoard = board.kingPos.get(Color.black).flatMap(board.take).getOrElse(board)
    val hordePos          = board.occupation(Color.white) // may include promoted pieces
    val mateInOne =
      hordePos.sizeIs == 1 && hordePos.forall(pos => pieceThreatened(board, Color.black, pos, (_ => true)))
    !mateInOne && notKingBoard.actors.values.forall(actor => actor.moves.isEmpty)
  }

  /** In horde chess, black can win unless a fortress stalemate is unavoidable.
    *  Auto-drawing the game should almost never happen, but it did in https://lichess.org/xQ2RsU8N#121
    */
  override def isInsufficientMaterial(board: Board) = hordeClosedPosition(board)

  /** In horde chess, the horde cannot win on * V K or [BN]{2} v K or just one piece
    * since they lack a king for checkmate support.
    * Technically there are some positions where stalemate is unavoidable which
    * this method does not detect; however, such are trivial to premove.
    */
  override def opponentHasInsufficientMaterial(situation: Situation): Boolean = {
    val board         = situation.board
    val opponentColor = !situation.color
    lazy val fortress = hordeClosedPosition(board) // costly function call
    if (opponentColor == Color.white) {
      lazy val notKingPieces           = InsufficientMatingMaterial.nonKingPieces(board) toList
      val horde                        = board.piecesOf(Color.white)
      lazy val hordeBishopSquareColors = horde.filter(_._2.is(Bishop)).toList.map(_._1.isLight).distinct
      lazy val hordeRoles              = horde.map(_._2.role)
      lazy val army                    = board.piecesOf(Color.black)
      lazy val armyPawnsOrRooks        = army.count(p => p._2.is(Pawn) || p._2.is(Rook))
      lazy val armyPawnsOrBishops      = army.filter(p => p._2.is(Pawn) || p._2.is(Bishop))
      lazy val armyPawnsOrKnights      = army.count(p => p._2.is(Pawn) || p._2.is(Knight))
      lazy val armyNonQueens           = army.count(_._2.isNot(Queen))
      lazy val armyNonQueensOrRooks    = army.count(p => p._2.isNot(Queen) && p._2.isNot(Rook))
      lazy val armyNonQueensOrBishops  = army.count(p => p._2.isNot(Queen) && p._2.isNot(Bishop))
      lazy val armyBishopSquareColors  = army.filter(_._2.is(Bishop)).toList.map(_._1.isLight).distinct
      if (horde.sizeIs == 1) {
        hordeRoles match {
          case List(Knight) =>
            army.sizeIs < 4 || armyNonQueensOrRooks == 0 || armyNonQueensOrBishops == 0 || (armyNonQueensOrBishops + armyBishopSquareColors.size) < 4
          case List(Bishop) =>
            notKingPieces.count(p =>
              p._2.is(Pawn) || (p._2.is(Bishop) && p._1.isLight != horde.head._1.isLight)
            ) < 2
          case List(Rook) => army.sizeIs < 3 || armyPawnsOrRooks == 0 || armyPawnsOrKnights == 0
          case _          => armyPawnsOrRooks == 0
        }
      } else if (
        (hordeRoles.forall(
          _ == Bishop
        ) && hordeBishopSquareColors.lengthCompare(1) == 0) && {
          armyPawnsOrKnights + armyPawnsOrBishops
            .count(p => p._1.isLight != horde.head._1.isLight) < 2
        }
      ) true
      else if (
        horde.sizeIs == 2 && hordeRoles
          .count(r => r == Queen || r == Rook || r == Pawn) < 2 && armyNonQueens <= 1
      )
        true
      else fortress
    } else fortress
  }

  override def isUnmovedPawn(color: Color, pos: Pos) =
    if (color.white) pos.rank <= Rank.Second
    else pos.rank == Rank.Seventh
}


text:
drop table if exists  nation2;

CREATE TABLE nation2 (
  code CHAR (3),
  name VARCHAR (50)
);

SELECT dt.class_of.partition, dt.class_of.class_name, dt.* FROM _db_partition dt
WHERE class_of.class_name LIKE 'nation2%' ORDER BY 2 ASC;
select * from db_partition where class_name = 'nation2' order by partition_name;

ALTER TABLE nation2 PARTITION BY HASH (code) PARTITIONS 4;

SELECT dt.class_of.partition, dt.class_of.class_name, dt.* FROM _db_partition dt
WHERE class_of.class_name LIKE 'nation2%' ORDER BY 2 ASC;
select * from db_partition where class_name = 'nation2' order by partition_name;

ALTER TABLE nation2 ADD PARTITION PARTITIONS 3;

SELECT dt.class_of.partition, dt.class_of.class_name, dt.* FROM _db_partition dt
WHERE class_of.class_name LIKE 'nation2%' ORDER BY 2 ASC;
select * from db_partition where class_name = 'nation2' order by partition_name;

ALTER TABLE nation2 COALESCE PARTITION 1;

SELECT dt.class_of.partition, dt.class_of.class_name, dt.* FROM _db_partition dt
WHERE class_of.class_name LIKE 'nation2%' ORDER BY 2 ASC;
select * from db_partition where class_name = 'nation2' order by partition_name;

ALTER TABLE nation2 REMOVE PARTITIONING;

SELECT dt.class_of.partition, dt.class_of.class_name, dt.* FROM _db_partition dt
WHERE class_of.class_name LIKE 'nation2%' ORDER BY 2 ASC;
select * from db_partition where class_name = 'nation2' order by partition_name;

DROP nation2;


text:
// lasterror.cpp

#include "pch.h"

#include "mongo/util/net/message.h"

#include "lasterror.h"
#include "jsobj.h"

namespace mongo {

    LastError LastError::noError;
    LastErrorHolder lastError;

    bool isShell = false;
    void setLastError(int code , const char *msg) {
        LastError *le = lastError.get();
        if ( le == 0 ) {
            /* might be intentional (non-user thread) */
            DEV {
                static unsigned n;
                if( ++n < 4 && !isShell ) log() << "dev: lastError==0 won't report:" << msg << endl;
            }
        }
        else if ( le->disabled ) {
            log() << "lastError disabled, can't report: " << code << ":" << msg << endl;
        }
        else {
            le->raiseError(code, msg);
        }
    }

    void LastError::appendSelfStatus( BSONObjBuilder &b ) {
        if ( writebackId.isSet() ) {
            b.append( "writeback" , writebackId );
            b.append( "instanceIdent" , prettyHostName() ); // this can be any unique string
        }
    }

    bool LastError::appendSelf( BSONObjBuilder &b , bool blankErr ) {

        appendSelfStatus( b );

        if ( !valid ) {
            if ( blankErr )
                b.appendNull( "err" );
            b.append( "n", 0 );
            return false;
        }

        if ( msg.empty() ) {
            if ( blankErr ) {
                b.appendNull( "err" );
            }
        }
        else {
            b.append( "err", msg );
        }

        if ( code )
            b.append( "code" , code );
        if ( updatedExisting != NotUpdate )
            b.appendBool( "updatedExisting", updatedExisting == True );
        if ( upsertedId.isSet() )
            b.append( "upserted" , upsertedId );

        b.appendNumber( "n", nObjects );

        return ! msg.empty();
    }

    LastErrorHolder::~LastErrorHolder() {
    }

    LastError * LastErrorHolder::disableForCommand() {
        LastError *le = _get();
        uassert(13649, "no operation yet", le);
        le->disabled = true;
        le->nPrev--; // caller is a command that shouldn't count as an operation
        return le;
    }

    LastError * LastErrorHolder::get( bool create ) {
        LastError *ret = _get( create );
        if ( ret && !ret->disabled )
            return ret;
        return 0;
    }

    LastError * LastErrorHolder::_get( bool create ) {
        LastError * le = _tl.get();
        if ( ! le && create ) {
            le = new LastError();
            _tl.reset( le );
        }
        return le;
    }

    void LastErrorHolder::release() {
        _tl.release();
    }

    /** ok to call more than once. */
    void LastErrorHolder::initThread() {
        if( ! _tl.get() )
            _tl.reset( new LastError() );
    }

    void LastErrorHolder::reset( LastError * le ) {
        _tl.reset( le );
    }

    void prepareErrForNewRequest( Message &m, LastError * err ) {
        // a killCursors message shouldn't affect last error
        verify( err );
        if ( m.operation() == dbKillCursors ) {
            err->disabled = true;
        }
        else {
            err->disabled = false;
            err->nPrev++;
        }
    }

    LastError * LastErrorHolder::startRequest( Message& m , LastError * le ) {
        verify( le );
        prepareErrForNewRequest( m, le );
        return le;
    }

} // namespace mongo