text:
   /*******************************************************/
   /*      "C" Language Integrated Production System      */
   /*                                                     */
   /*             CLIPS Version 6.24  06/05/06            */
   /*                                                     */
   /*         DEFFACTS BASIC COMMANDS HEADER FILE         */
   /*******************************************************/

/*************************************************************/
/* Purpose: Implements core commands for the deffacts        */
/*   construct such as clear, reset, save, undeffacts,       */
/*   ppdeffacts, list-deffacts, and get-deffacts-list.       */
/*                                                           */
/* Principal Programmer(s):                                  */
/*      Gary D. Riley                                        */
/*                                                           */
/* Contributing Programmer(s):                               */
/*      Brian L. Dantes                                      */
/*                                                           */
/* Revision History:                                         */
/*      6.23: Corrected compilation errors for files         */
/*            generated by constructs-to-c. DR0861           */
/*                                                           */
/*      6.24: Renamed BOOLEAN macro type to intBool.         */
/*                                                           */
/*************************************************************/

#define _DFFCTBSC_SOURCE_

#include "setup.h"

#if DEFFACTS_CONSTRUCT

#include <stdio.h>
#define _STDIO_INCLUDED_
#include <string.h>

#include "envrnmnt.h"
#include "argacces.h"
#include "memalloc.h"
#include "scanner.h"
#include "router.h"
#include "extnfunc.h"
#include "constrct.h"
#include "cstrccom.h"
#include "factrhs.h"
#include "tmpltdef.h"
#include "cstrcpsr.h"
#include "dffctpsr.h"
#include "dffctdef.h"
#if BLOAD || BLOAD_ONLY || BLOAD_AND_BSAVE
#include "dffctbin.h"
#endif
#if CONSTRUCT_COMPILER && (! RUN_TIME)
#include "dffctcmp.h"
#endif

#include "dffctbsc.h"

/***************************************/
/* LOCAL INTERNAL FUNCTION DEFINITIONS */
/***************************************/

   static void                    ResetDeffacts(void *);
   static void                    ClearDeffacts(void *);
   static void                    SaveDeffacts(void *,void *,char *);
   static void                    ResetDeffactsAction(void *,struct constructHeader *,void *);

/***************************************************************/
/* DeffactsBasicCommands: Initializes basic deffacts commands. */
/***************************************************************/
globle void DeffactsBasicCommands(
  void *theEnv)
  {
   EnvAddResetFunction(theEnv,(char*)"deffacts",ResetDeffacts,0);
   EnvAddClearFunction(theEnv,(char*)"deffacts",ClearDeffacts,0);
   AddSaveFunction(theEnv,(char*)"deffacts",SaveDeffacts,10);

#if ! RUN_TIME
   EnvDefineFunction2(theEnv,(char*)"get-deffacts-list",'m',PTIEF GetDeffactsListFunction,(char*)"GetDeffactsListFunction",(char*)"01w");
   EnvDefineFunction2(theEnv,(char*)"undeffacts",'v',PTIEF UndeffactsCommand,(char*)"UndeffactsCommand",(char*)"11w");
   EnvDefineFunction2(theEnv,(char*)"deffacts-module",'w',PTIEF DeffactsModuleFunction,(char*)"DeffactsModuleFunction",(char*)"11w");

#if DEBUGGING_FUNCTIONS
   EnvDefineFunction2(theEnv,(char*)"list-deffacts",'v', PTIEF ListDeffactsCommand,(char*)"ListDeffactsCommand",(char*)"01w");
   EnvDefineFunction2(theEnv,(char*)"ppdeffacts",'v',PTIEF PPDeffactsCommand,(char*)"PPDeffactsCommand",(char*)"11w");
#endif

#if (BLOAD || BLOAD_ONLY || BLOAD_AND_BSAVE)
   DeffactsBinarySetup(theEnv);
#endif

#if CONSTRUCT_COMPILER && (! RUN_TIME)
   DeffactsCompilerSetup(theEnv);
#endif

#endif
  }

/**********************************************************/
/* ResetDeffacts: Deffacts reset routine for use with the */
/*   reset command. Asserts all of the facts contained in */
/*   deffacts constructs.                                 */
/**********************************************************/
static void ResetDeffacts(
  void *theEnv)
  {
   DoForAllConstructs(theEnv,ResetDeffactsAction,DeffactsData(theEnv)->DeffactsModuleIndex,TRUE,NULL);
  }

/*****************************************************/
/* ResetDeffactsAction: Action to be applied to each */
/*   deffacts construct during a reset command.      */
/*****************************************************/
static void ResetDeffactsAction(
  void *theEnv,
  struct constructHeader *theConstruct,
  void *buffer)
  {
   DATA_OBJECT result;
   struct deffacts *theDeffacts = (struct deffacts *) theConstruct;

   if (theDeffacts->assertList == NULL) return;

   SetEvaluationError(theEnv,FALSE);

   EvaluateExpression(theEnv,theDeffacts->assertList,&result);
  }

/**********************************************************/
/* ClearDeffacts: Deffacts clear routine for use with the */
/*   clear command. Creates the initial-facts deffacts.   */
/**********************************************************/
static void ClearDeffacts(
  void *theEnv)
  {
#if (! RUN_TIME) && (! BLOAD_ONLY)
   struct expr *stub;
   struct deffacts *newDeffacts;

   /*=====================================*/
   /* Create the data structures for the  */
   /* expression (assert (initial-fact)). */
   /*=====================================*/

   stub = GenConstant(theEnv,FCALL,FindFunction(theEnv,(char*)"assert"));
   stub->argList = GenConstant(theEnv,DEFTEMPLATE_PTR,EnvFindDeftemplate(theEnv,(char*)"initial-fact"));
   ExpressionInstall(theEnv,stub);

   /*=============================================*/
   /* Create a deffacts data structure to contain */
   /* the expression and initialize it.           */
   /*=============================================*/

   newDeffacts = get_struct(theEnv,deffacts);
   newDeffacts->header.whichModule =
      (struct defmoduleItemHeader *) GetDeffactsModuleItem(theEnv,NULL);
   newDeffacts->header.name = (SYMBOL_HN *) EnvAddSymbol(theEnv,(char*)"initial-fact");
   IncrementSymbolCount(newDeffacts->header.name);
   newDeffacts->assertList = PackExpression(theEnv,stub);
   newDeffacts->header.next = NULL;
   newDeffacts->header.ppForm = NULL;
   newDeffacts->header.usrData = NULL;
   ReturnExpression(theEnv,stub);

   /*===========================================*/
   /* Store the deffacts in the current module. */
   /*===========================================*/

   AddConstructToModule(&newDeffacts->header);
#else
#endif
  }

/***************************************/
/* SaveDeffacts: Deffacts save routine */
/*   for use with the save command.    */
/***************************************/
static void SaveDeffacts(
  void *theEnv,
  void *theModule,
  char *logicalName)
  {
   SaveConstruct(theEnv,theModule,logicalName,DeffactsData(theEnv)->DeffactsConstruct);
  }

/*******************************************/
/* UndeffactsCommand: H/L access routine   */
/*   for the undeffacts command.           */
/*******************************************/
globle void UndeffactsCommand(
  void *theEnv)
  {
   UndefconstructCommand(theEnv,(char*)"undeffacts",DeffactsData(theEnv)->DeffactsConstruct);
  }

/***********************************/
/* EnvUndeffacts: C access routine */
/*   for the undeffacts command.   */
/***********************************/
globle intBool EnvUndeffacts(
  void *theEnv,
  void *theDeffacts)
  {
   return(Undefconstruct(theEnv,theDeffacts,DeffactsData(theEnv)->DeffactsConstruct));
  }

/*************************************************/
/* GetDeffactsListFunction: H/L access routine   */
/*   for the get-deffacts-list function.         */
/*************************************************/
globle void GetDeffactsListFunction(
  void *theEnv,
  DATA_OBJECT_PTR returnValue)
  {
   GetConstructListFunction(theEnv,(char*)"get-deffacts-list",returnValue,DeffactsData(theEnv)->DeffactsConstruct);
  }

/*****************************************/
/* EnvGetDeffactsList: C access routine  */
/*   for the get-deffacts-list function. */
/*****************************************/
globle void EnvGetDeffactsList(
  void *theEnv,
  DATA_OBJECT_PTR returnValue,
  void *theModule)
  {
   GetConstructList(theEnv,returnValue,DeffactsData(theEnv)->DeffactsConstruct,(struct defmodule *) theModule);
  }

/************************************************/
/* DeffactsModuleFunction: H/L access routine   */
/*   for the deffacts-module function.          */
/************************************************/
globle void *DeffactsModuleFunction(
  void *theEnv)
  {
   return(GetConstructModuleCommand(theEnv,(char*)"deffacts-module",DeffactsData(theEnv)->DeffactsConstruct));
  }

#if DEBUGGING_FUNCTIONS

/*******************************************/
/* PPDeffactsCommand: H/L access routine   */
/*   for the ppdeffacts command.           */
/*******************************************/
globle void PPDeffactsCommand(
  void *theEnv)
  {
   PPConstructCommand(theEnv,(char*)"ppdeffacts",DeffactsData(theEnv)->DeffactsConstruct);
  }

/************************************/
/* PPDeffacts: C access routine for */
/*   the ppdeffacts command.        */
/************************************/
globle int PPDeffacts(
  void *theEnv,
  char *deffactsName,
  char *logicalName)
  {
   return(PPConstruct(theEnv,deffactsName,logicalName,DeffactsData(theEnv)->DeffactsConstruct));
  }

/*********************************************/
/* ListDeffactsCommand: H/L access routine   */
/*   for the list-deffacts command.          */
/*********************************************/
globle void ListDeffactsCommand(
  void *theEnv)
  {
   ListConstructCommand(theEnv,(char*)"list-deffacts",DeffactsData(theEnv)->DeffactsConstruct);
  }

/*************************************/
/* EnvListDeffacts: C access routine */
/*   for the list-deffacts command.  */
/*************************************/
globle void EnvListDeffacts(
  void *theEnv,
  char *logicalName,
  void *theModule)
  {
   ListConstruct(theEnv,DeffactsData(theEnv)->DeffactsConstruct,logicalName,(struct defmodule *) theModule);
  }

#endif /* DEBUGGING_FUNCTIONS */

#endif /* DEFFACTS_CONSTRUCT */


text:
A base line "JAM stack" jetty hosted website with a jax-rs api backend with swagger documentation, and a js frontend webserver, packaged by webpack2. Focus is on producing content using markdown, supported by images and client side visualisations created with e.g. d3, backed by static or dynamic data from the baskend api. Purpose is getting something lightweight up and running as quick as possible, without dependencies on large framework e.g. spring. Developed as a server for data projects in mind particularly d3 visualisations and to enable rapid development rather than robust performance.

__backend:__

Standalone Jetty, Jersey & Swagger without dependency injection
https://danielflower.github.io/2016/04/01/Swagger-with-embedded-jetty-without-magic.html
https://github.com/SriramKeerthi/swagger-jersey2-jetty/tree/master/swagger-jersey2-jetty/src/main/resources/swaggerui

__frontend:__

Javascript with vanilla npm managing front end dependencies
Webpack2 based dependency packaging
Templating support for webpack with focus on markdown support, static data file support and minimal html

## Dependencies

- Java 8
- Maven
- npm (sudo apt get install node npm)
- webpack dependencies defined in package.json (npm install)

## Layout

It is assumed you will be forking this whole project and modifying to build custom behaviour in the file structure described here.

### Files

- ./pom.xml for backend java dependencies
- ./package.json for frontend javascript dependencies
- ./src/test/java for example JAX-RS API layout & example uk.co.terminological.webserver.RunServer for main entry class.
- ./src/main/resources/webpack.config.js webpack config file and list of served pages
- ./src/main/resources/src/common for common css files
- ./src/main/resources/src/<page_name> for different pages. This is just suggested layout - defined by webpack.config.js
- ./src/main/resources/dist for webpack generated assets and other static generated files.

### URLs

- by default site will be served on port 8080 - see uk.co.terminological.webserver.ApiConfig
- / static files from ./src/main/resources/dist as compiled by webpack - urls available as defined by webpack.config.js
- /api/<jax-rs-endpoint>/<options> default location of api files - can be changed by ApiConfig
- /api/swagger.json or /api/swagger.yaml default swagger api description
- /docs/?url=../api/swagger.json swagger documentation

## What works

- Serve static files for api client from webserver root
- CORS and JSON pretty print API output based on JAX-RS classes from configurable api path
- Swagger self documenting API
- npm install executed on: mvn generate-sources
- front end dependencies via webpack on mvn generate-sources
- compiling css / html templates / markdown using webpack
- support for compile time loading of csv and xml resources
- markdown plugins supported (markdown-it-decorate, markdown-it-sub, markdown-it-sup)
- preprocessing phase using webpack to compile static web content
- webpack-dev-server via npm test for iterative development

## What doesn't (yet)

- Pretty print XML or other API output formats.
- Any form of complex routing or authentication - if you need this you need to do it properly.
- [See this stackoverflow question](https://stackoverflow.com/questions/26777083/best-practice-for-rest-token-based-authentication-with-jax-rs-and-jersey)

## How to:

### Create an API and start server
Write a swagger annotated JAX-RS API endpoint class & any supporting data structures

e.g. src/test/java: uk.co.terminological.webserver package

see: https://github.com/swagger-api/swagger-core/wiki/Annotations-1.5.X

### Add java dependencies
add them in maven's pom.xml the usual way

### Add runtime javascript dependencies
use npm: npm install --save <scriptname>

*or*

add them direct to package.json and perform a mvn generate-sources.

### Add webpack modules
use npm install --save-dev <scriptname>

### trigger webpack build.
use *npm start* or *mvn generate-sources*

### interactive webpack development.

use *npm test* from root directory to start webpack-dev-server on port 9000 - however java API components will not be running.

Possible to run java backend concurrently (e.g. in debug mode) on a different port to interactively develop end to end using webpack-dev-server for front end. webpack-dev-server will forward the port for the api to the java backend server (this assumes backend is running with default port config and paths - see webpack.config.js

### adding new markdown-it-plugins
- see https://www.npmjs.com/browse/keyword/markdown-it-plugin for other plugins
- need to install with npm install --save-dev <plugin>
- and add require(<plugin>) to webpack.config.js

redpajama_set_name: RedPajamaGithub


text:
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeFamilies #-}
import Data.Reify
import Control.Applicative
import Data.Traversable

--Pointer-based graph representation
data PtrNode = PtrNode [PtrNode] deriving Show

--Label-based graph representation
data LblNode lbl = LblNode [lbl] deriving Show

--Convenience functions for our DSL
leaf      = PtrNode []
node1 a   = PtrNode [a]
node2 a b = PtrNode [a, b]

-- This looks scary but we're just telling data-reify where the pointers are
-- in our graph representation so they can be turned to labels
instance MuRef PtrNode where
    type DeRef PtrNode = LblNode
    mapDeRef f (PtrNode as) = LblNode <$> (traverse f as)

-- Graph we want to represent:
--    .----> a <----.
--   /               \
--  b <------------.  \
--   \              \ /
--    `----> c ----> d

-- Code for the graph:
a = leaf
b = node2 a c
c = node1 d
d = node2 a b
-- Yes, it's that simple!

-- If you want to convert the graph to a Node-Label format:
main = do
    g <- reifyGraph b   --can't use 'a' because not all nodes are reachable
    print g


text:
package org.wso2.carbon.appmgt.impl.internal;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.osgi.service.component.ComponentContext;
import org.wso2.carbon.appmgt.api.AppManagementException;
import org.wso2.carbon.appmgt.impl.AppManagerConfiguration;
import org.wso2.carbon.appmgt.impl.AppManagerConfigurationService;
import org.wso2.carbon.appmgt.impl.AppManagerConfigurationServiceImpl;
import org.wso2.carbon.appmgt.impl.AppMgtXACMLPolicyTemplateReader;
import org.wso2.carbon.appmgt.impl.service.ServiceReferenceHolder;
import org.wso2.carbon.utils.CarbonUtils;
import org.wso2.carbon.utils.ConfigurationContextService;
import java.io.File;

/**
 * @scr.component name="org.wso2.appmgt.impl.configuration.services" immediate="true"
 * @scr.reference name="config.context.service"
 * interface="org.wso2.carbon.utils.ConfigurationContextService"
 * cardinality="1..1" policy="dynamic"  bind="setConfigurationContextService"
 * unbind="unsetConfigurationContextService"
 */
public class APPManagerConfigurationServiceComponent {

    private static final Log log = LogFactory.getLog(APPManagerConfigurationServiceComponent.class);
    private static AppManagerConfigurationService amConfigService;

    protected void activate(ComponentContext componentContext) throws Exception {

        if (log.isDebugEnabled()) {
            log.debug("App Manager implementation configuration service component activation started");
        }
        String filePath = null;
        try {
            //Initialize AppManager Configuration
            AppManagerConfiguration configuration = new AppManagerConfiguration();
            filePath = CarbonUtils.getCarbonHome() + File.separator + "repository" +
                    File.separator + "conf" + File.separator + "app-manager.xml";
            configuration.load(filePath);
            amConfigService = new AppManagerConfigurationServiceImpl(configuration);
            ServiceReferenceHolder.getInstance().setAPIManagerConfigurationService(amConfigService);

            //Read xacml policy template
            AppMgtXACMLPolicyTemplateReader xacmlPolicy = new AppMgtXACMLPolicyTemplateReader();
            String xacmlTemplateFilePath = CarbonUtils.getCarbonHome() + File.separator + "repository" +
                    File.separator + "resources" + File.separator + "entitlement-templates" + File.separator +
                    "xacml-policy-partial-template.xml";
            xacmlPolicy.load(xacmlTemplateFilePath);

            ServiceReferenceHolder.getInstance().setAppMgtXACMLPolicyTemplateReader(xacmlPolicy);

            if(log.isDebugEnabled()) {
                log.debug("App Manager implementation configuration service component is activated from file path : "+
                filePath);
            }

        } catch (AppManagementException e) {
            log.error("Error occurred while initializing App Manager configuration Service Component from file path : " +
                    filePath, e);
        }
    }

    protected void deactivate(ComponentContext componentContext) {
        if (log.isDebugEnabled()) {
            log.debug("Deactivating App Manager configuration service component");
        }
        amConfigService = null;
        ServiceReferenceHolder.getInstance().setAPIManagerConfigurationService(null);
    }

    protected void setConfigurationContextService(ConfigurationContextService contextService) {
        ServiceReferenceHolder.setContextService(contextService);
    }

    protected void unsetConfigurationContextService(ConfigurationContextService contextService) {
        ServiceReferenceHolder.setContextService(null);
    }
}


text:
<?php

namespace Spatie\SchemaOrg;

/**
 * A specific question - e.g. from a user seeking answers online, or collected
 * in a Frequently Asked Questions (FAQ) document.
 *
 * @see http://schema.org/Question
 *
 * @mixin \Spatie\SchemaOrg\CreativeWork
 */
class Question extends BaseType
{
    /**
     * The answer(s) that has been accepted as best, typically on a
     * Question/Answer site. Sites vary in their selection mechanisms, e.g.
     * drawing on community opinion and/or the view of the Question author.
     *
     * @param Answer|Answer[]|ItemList|ItemList[] $acceptedAnswer
     *
     * @return static
     *
     * @see http://schema.org/acceptedAnswer
     */
    public function acceptedAnswer($acceptedAnswer)
    {
        return $this->setProperty('acceptedAnswer', $acceptedAnswer);
    }

    /**
     * The number of answers this question has received.
     *
     * @param int|int[] $answerCount
     *
     * @return static
     *
     * @see http://schema.org/answerCount
     */
    public function answerCount($answerCount)
    {
        return $this->setProperty('answerCount', $answerCount);
    }

    /**
     * The number of downvotes this question, answer or comment has received
     * from the community.
     *
     * @param int|int[] $downvoteCount
     *
     * @return static
     *
     * @see http://schema.org/downvoteCount
     */
    public function downvoteCount($downvoteCount)
    {
        return $this->setProperty('downvoteCount', $downvoteCount);
    }

    /**
     * An answer (possibly one of several, possibly incorrect) to a Question,
     * e.g. on a Question/Answer site.
     *
     * @param Answer|Answer[]|ItemList|ItemList[] $suggestedAnswer
     *
     * @return static
     *
     * @see http://schema.org/suggestedAnswer
     */
    public function suggestedAnswer($suggestedAnswer)
    {
        return $this->setProperty('suggestedAnswer', $suggestedAnswer);
    }

    /**
     * The number of upvotes this question, answer or comment has received from
     * the community.
     *
     * @param int|int[] $upvoteCount
     *
     * @return static
     *
     * @see http://schema.org/upvoteCount
     */
    public function upvoteCount($upvoteCount)
    {
        return $this->setProperty('upvoteCount', $upvoteCount);
    }

}


text:
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.

require_once("../config.php");
require_once($CFG->dirroot.'/user/profile/lib.php');
require_once($CFG->dirroot.'/tag/lib.php');
require_once($CFG->libdir . '/filelib.php');
require_once($CFG->libdir . '/badgeslib.php');

$id             = optional_param('id', 0, PARAM_INT); // User id.
$courseid       = optional_param('course', SITEID, PARAM_INT); // course id (defaults to Site).
$showallcourses = optional_param('showallcourses', 0, PARAM_INT);

// See your own profile by default.
if (empty($id)) {
    require_login();
    $id = $USER->id;
}

if ($courseid == SITEID) {   // Since Moodle 2.0 all site-level profiles are shown by profile.php.
    redirect($CFG->wwwroot.'/user/profile.php?id='.$id);  // Immediate redirect.
}

$PAGE->set_url('/user/view.php', array('id' => $id, 'course' => $courseid));

$user = $DB->get_record('user', array('id' => $id), '*', MUST_EXIST);
$course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
$currentuser = ($user->id == $USER->id);

$systemcontext = context_system::instance();
$coursecontext = context_course::instance($course->id);
$usercontext   = context_user::instance($user->id, IGNORE_MISSING);

// Check we are not trying to view guest's profile.
if (isguestuser($user)) {
    // Can not view profile of guest - thre is nothing to see there.
    print_error('invaliduserid');
}

$PAGE->set_context($coursecontext);

if (!empty($CFG->forceloginforprofiles)) {
    require_login(); // We can not log in to course due to the parent hack below.

    // Guests do not have permissions to view anyone's profile if forceloginforprofiles is set.
    if (isguestuser()) {
        echo $OUTPUT->header();
        echo $OUTPUT->confirm(get_string('guestcantaccessprofiles', 'error'),
                              get_login_url(),
                              $CFG->wwwroot);
        echo $OUTPUT->footer();
        die;
    }
}

$PAGE->set_course($course);
$PAGE->set_pagetype('course-view-' . $course->format);  // To get the blocks exactly like the course.
$PAGE->add_body_class('path-user');                     // So we can style it independently.
$PAGE->set_other_editing_capability('moodle/course:manageactivities');

// Set the Moodle docs path explicitly because the default behaviour
// of inhereting the pagetype will lead to an incorrect docs location.
$PAGE->set_docs_path('user/profile');

$isparent = false;

if (!$currentuser and !$user->deleted
  and $DB->record_exists('role_assignments', array('userid' => $USER->id, 'contextid' => $usercontext->id))
  and has_capability('moodle/user:viewdetails', $usercontext)) {
    // TODO: very ugly hack - do not force "parents" to enrol into course their child is enrolled in,
    //       this way they may access the profile where they get overview of grades and child activity in course,
    //       please note this is just a guess!
    require_login();
    $isparent = true;
    $PAGE->navigation->set_userid_for_parent_checks($id);
} else {
    // Normal course.
    require_login($course);
    // What to do with users temporary accessing this course? should they see the details?
}

$strpersonalprofile = get_string('personalprofile');
$strparticipants = get_string("participants");
$struser = get_string("user");

$fullname = fullname($user, has_capability('moodle/site:viewfullnames', $coursecontext));

// Now test the actual capabilities and enrolment in course.
if ($currentuser) {
    if (!is_viewing($coursecontext) && !is_enrolled($coursecontext)) {
        // Need to have full access to a course to see the rest of own info.
        echo $OUTPUT->header();
        echo $OUTPUT->heading(get_string('notenrolled', '', $fullname));
        $referer = get_local_referer(false);
        if (!empty($referer)) {
            echo $OUTPUT->continue_button($referer);
        }
        echo $OUTPUT->footer();
        die;
    }

} else {
    // Somebody else.
    $PAGE->set_title("$strpersonalprofile: ");
    $PAGE->set_heading("$strpersonalprofile: ");

    // Check course level capabilities.
    if (!has_capability('moodle/user:viewdetails', $coursecontext) && // Normal enrolled user or mnager.
        ($user->deleted or !has_capability('moodle/user:viewdetails', $usercontext))) {   // Usually parent.
        print_error('cannotviewprofile');
    }

    if (!is_enrolled($coursecontext, $user->id)) {
        // TODO: the only potential problem is that managers and inspectors might post in forum, but the link
        //       to profile would not work - maybe a new capability - moodle/user:freely_acessile_profile_for_anybody
        //       or test for course:inspect capability.
        if (has_capability('moodle/role:assign', $coursecontext)) {
            $PAGE->navbar->add($fullname);
            echo $OUTPUT->header();
            echo $OUTPUT->heading(get_string('notenrolled', '', $fullname));
        } else {
            echo $OUTPUT->header();
            $PAGE->navbar->add($struser);
            echo $OUTPUT->heading(get_string('notenrolledprofile'));
        }
        $referer = get_local_referer(false);
        if (!empty($referer)) {
            echo $OUTPUT->continue_button($referer);
        }
        echo $OUTPUT->footer();
        exit;
    }

    // If groups are in use and enforced throughout the course, then make sure we can meet in at least one course level group.
    // Except when we are a parent, in which case we would not be in any group.
    if (groups_get_course_groupmode($course) == SEPARATEGROUPS
            and $course->groupmodeforce
            and !has_capability('moodle/site:accessallgroups', $coursecontext)
            and !has_capability('moodle/site:accessallgroups', $coursecontext, $user->id)
            and !$isparent) {
        if (!isloggedin() or isguestuser()) {
            // Do not use require_login() here because we might have already used require_login($course).
            redirect(get_login_url());
        }
        $mygroups = array_keys(groups_get_all_groups($course->id, $USER->id, $course->defaultgroupingid, 'g.id, g.name'));
        $usergroups = array_keys(groups_get_all_groups($course->id, $user->id, $course->defaultgroupingid, 'g.id, g.name'));
        if (!array_intersect($mygroups, $usergroups)) {
            print_error("groupnotamember", '', "../course/view.php?id=$course->id");
        }
    }
}

$PAGE->set_title("$course->fullname: $strpersonalprofile: $fullname");
$PAGE->set_heading($course->fullname);
$PAGE->set_pagelayout('standard');

// Locate the users settings in the settings navigation and force it open.
// This MUST be done after we've set up the page as it is going to cause theme and output to initialise.
if (!$currentuser) {
    $PAGE->navigation->extend_for_user($user);
    if ($node = $PAGE->settingsnav->get('userviewingsettings'.$user->id)) {
        $node->forceopen = true;
    }
} else if ($node = $PAGE->settingsnav->get('usercurrentsettings', navigation_node::TYPE_CONTAINER)) {
    $node->forceopen = true;
}
if ($node = $PAGE->settingsnav->get('courseadmin')) {
    $node->forceopen = false;
}

echo $OUTPUT->header();

echo '
';
$headerinfo = array('heading' => fullname($user), 'user' => $user, 'usercontext' => $usercontext);
echo $OUTPUT->context_header($headerinfo, 2);

if ($user->deleted) {
    echo $OUTPUT->heading(get_string('userdeleted'));
    if (!has_capability('moodle/user:update', $coursecontext)) {
        echo $OUTPUT->footer();
        die;
    }
}

// OK, security out the way, now we are showing the user.
// Trigger a user profile viewed event.
profile_view($user, $coursecontext, $course);

if ($user->description && !isset($hiddenfields['description'])) {
    echo '
';
    if (!empty($CFG->profilesforenrolledusersonly) && !$DB->record_exists('role_assignments', array('userid' => $id))) {
        echo get_string('profilenotshown', 'moodle');
    } else {
        if ($courseid == SITEID) {
            $user->description = file_rewrite_pluginfile_urls($user->description, 'pluginfile.php', $usercontext->id, 'user', 'profile', null);
        } else {
            // We have to make a little detour thought the course context to verify the access control for course profile.
            $user->description = file_rewrite_pluginfile_urls($user->description, 'pluginfile.php', $coursecontext->id, 'user', 'profile', $user->id);
        }
        $options = array('overflowdiv' => true);
        echo format_text($user->description, $user->descriptionformat, $options);
    }
    echo '
'; // Description class.
}

// Render custom blocks.
$renderer = $PAGE->get_renderer('core_user', 'myprofile');
$tree = core_user\output\myprofile\manager::build_tree($user, $currentuser, $course);
echo $renderer->render($tree);

echo '
';  // Userprofile class.

echo $OUTPUT->footer();


text:
var defaults = {
    regex: true,
    dialog: true,
    feedback: true,
    tooltip: true
};

exports.init = options => {
    options = $.extend({}, defaults, options);
    for (let key of Object.keys(options)) {
        if (!options[key]) {
            continue;
        }
        switch(key) {
            case 'feedback':
                let feedback = require('feedback');
                !options.feedback.hide && feedback.button();
                break;
            case 'regex':
                let regex = require('regex');
                !options.regex.noGlobal && (window.regex = regex);
                break;
            case 'dialog':
                require('dialog');
                break;
            case 'tooltip':
                require('tooltip');
                break;
        }
    }
};


text:
require('dotenv').config();

// Modules
const express = require('express');
const cookieParser = require('cookie-parser');
const bodyParser = require('body-parser');
const passport = require('passport');
const mongoose = require('mongoose');
const session = require('cookie-session');
const requireHTTPS = require('./requireHTTPS');

// Controllers
const authSignup = require('./controllers/authSignup');
const authLogin = require('./controllers/authLogin');
const authLogout = require('./controllers/authLogout');
const authVerification = require('./controllers/authVerification');
const apiauthReSend = require('./controllers/authReSend');
const apiData = require('./controllers/apiData');
const apiNewForm = require('./controllers/apiNewForm');
const apiEditForm = require('./controllers/apiEditForm');
const apiDeleteForm = require('./controllers/apiDeleteForm');
const apiPublishForm = require('./controllers/apiPublishForm');
const apiOutsider = require('./controllers/apiOutsider');
const apiOutsiderSubmit = require('./controllers/apiOutsiderSubmit');
const apiViewResponses = require('./controllers/apiViewResponses');
const apiSendFormEmail = require('./controllers/apiSendFormEmail');
const apiPointedOutsider = require('./controllers/apiPointedOutsider');
const apiPointedSave = require('./controllers/apiPointedSave');
const apiPointedSubmit = require('./controllers/apiPointedSubmit');

// Express Port/App Declaration
const PORT = process.env.PORT || 8080;
const app = express();

// Middleware
// app.use(requireHTTPS);
app.use(express.static(__dirname + "/public"));
app.use('/.well-known/acme-challenge/', express.static(__dirname + "/cert"));
app.use('/minicss', express.static(__dirname + '/node_modules/mini.css/dist'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.text());
app.use(bodyParser.json({ type: "application/vnd.api+json" }));
app.use(cookieParser('striped-shirt'));
app.use(session({
    secret: 'striped-shirt',
    resave: false,
    saveUninitialized: true
}));
app.use(passport.initialize());
app.use(passport.session());

// Database configuration
if (process.env.MONGODB_URI) {
    mongoose.connect(process.env.MONGODB_URI);
} else {
    mongoose.connect("mongodb://localhost/formulate");
}
const db = mongoose.connection;

//=== Show any mongoose errors
db.on("error", function (error) {
    console.log("Mongoose Error: ", error);
});

//==== Once logged in to the db through mongoose, log a success message
db.once("open", function () {
    console.log("Mongoose connection successful.");
});

//==== Call controllers
authLogin(app);
authSignup(app);
authLogout(app);
authVerification(app);
apiauthReSend(app);
apiData(app);
apiNewForm(app);
apiEditForm(app);
apiDeleteForm(app);
apiPublishForm(app);
apiOutsider(app);
apiOutsiderSubmit(app);
apiViewResponses(app);
apiSendFormEmail(app);
apiPointedOutsider(app);
apiPointedSave(app);
apiPointedSubmit(app);

// Connection to PORT
app.listen(PORT, function () {
    console.log(`Listening On Port: ${PORT}`);
});


text:
#ifndef AudioProcessingEvent_h
#define AudioProcessingEvent_h

#include "AudioBuffer.h"
#include "Event.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>

namespace WebCore {

class AudioBuffer;

class AudioProcessingEvent : public Event {
public:
    static PassRefPtr<AudioProcessingEvent> create();
    static PassRefPtr<AudioProcessingEvent> create(PassRefPtr<AudioBuffer> inputBuffer, PassRefPtr<AudioBuffer> outputBuffer);

    virtual ~AudioProcessingEvent();

    virtual bool isAudioProcessingEvent() const;

    AudioBuffer* inputBuffer() { return m_inputBuffer.get(); }
    AudioBuffer* outputBuffer() { return m_outputBuffer.get(); }

private:
    AudioProcessingEvent();
    AudioProcessingEvent(PassRefPtr<AudioBuffer> inputBuffer, PassRefPtr<AudioBuffer> outputBuffer);

    RefPtr<AudioBuffer> m_inputBuffer;
    RefPtr<AudioBuffer> m_outputBuffer;
};

} // namespace WebCore

#endif // AudioProcessingEvent_h


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

<title>Order (Spring Framework 5.1.18.RELEASE API)</title>
<meta name="date" content="2020-09-15">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Spring Framework

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Field |

Required |

Optional

Detail:

Field |

Element

org.springframework.core.annotation

Annotation Type Order

@Retention(value=RUNTIME)
 @Target(value={TYPE,METHOD,FIELD})
 @Documented
public @interface Order

@Order defines the sort order for an annotated component.

The value() is optional and represents an order value as defined in the
 Ordered interface. Lower values have higher priority. The default value is
 Ordered.LOWEST_PRECEDENCE, indicating lowest priority (losing to any other
 specified order value).

NOTE: Since Spring 4.0, annotation-based ordering is supported for many
 kinds of components in Spring, even for collection injection where the order values
 of the target components are taken into account (either from their target class or
 from their @Bean method). While such order values may influence priorities
 at injection points, please be aware that they do not influence singleton startup
 order which is an orthogonal concern determined by dependency relationships and
 @DependsOn declarations (influencing a runtime-determined dependency graph).

Since Spring 4.1, the standard Priority annotation
 can be used as a drop-in replacement for this annotation in ordering scenarios.
 Note that @Priority may have additional semantics when a single element
 has to be picked (see AnnotationAwareOrderComparator.getPriority(java.lang.Object)).

Alternatively, order values may also be determined on a per-instance basis
 through the Ordered interface, allowing for configuration-determined
 instance values instead of hard-coded values attached to a particular class.

Consult the javadoc for OrderComparator for details on the sort semantics for non-ordered objects.

Since:

2.0

Author:

Rod Johnson, Juergen Hoeller

See Also:

Ordered,
AnnotationAwareOrderComparator,
OrderUtils,
Priority

Optional Element Summary

Optional Elements

Modifier and Type
Optional Element and Description

int
value

The order value.

Element Detail

value

public abstract int value

The order value.

Default is Ordered.LOWEST_PRECEDENCE.

See Also:

Ordered.getOrder()

Default:

2147483647

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Spring Framework

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Field |

Required |

Optional

Detail:

Field |

Element


text:
#ifndef _SR_H
#define _SR_H

#include "scsi.h"

typedef struct
	{
	unsigned 	capacity;		/* size in blocks 			*/
	unsigned 	sector_size;		/* size in bytes 			*/
	Scsi_Device  	*device;
	unsigned long   mpcd_sector;            /* for reading multisession-CD's        */
	char            xa_flags;               /* some flags for handling XA-CD's      */
	unsigned char	sector_bit_size;	/* sector size = 2^sector_bit_size	*/
	unsigned char	sector_bit_shift;	/* sectors/FS block = 2^sector_bit_shift*/
	unsigned 	needs_sector_size:1;   	/* needs to get sector size */
	unsigned 	ten:1;			/* support ten byte commands		*/
	unsigned 	remap:1;		/* support remapping			*/
	unsigned 	use:1;			/* is this device still supportable	*/
	unsigned	auto_eject:1;		/* auto-eject medium on last release.	*/
	} Scsi_CD;

extern Scsi_CD * scsi_CDs;

#endif


text:
require 'rails_helper'

describe 'List issue resource label events', :js do
  let(:user)     { create(:user) }
  let(:project)  { create(:project, :public) }
  let(:issue)    { create(:issue, project: project, author: user) }
  let!(:label) { create(:label, project: project, title: 'foo') }
  let!(:user_status) { create(:user_status, user: user) }

  context 'when user displays the issue' do
    let!(:note)     { create(:note_on_issue, author: user, project: project, noteable: issue, note: 'some note') }
    let!(:event)    { create(:resource_label_event, user: user, issue: issue, label: label) }

    before do
      visit project_issue_path(project, issue)
      wait_for_requests
    end

    it 'shows both notes and resource label events' do
      page.within('#notes') do
        expect(find("#note_#{note.id}")).to have_content 'some note'
        expect(find("#note_#{event.discussion_id}")).to have_content 'added foo label'
      end
    end

    it 'shows the user status on the system note for the label' do
      page.within("#note_#{event.discussion_id}") do
        expect(page).to show_user_status user_status
      end
    end
  end

  context 'when user adds label to the issue' do
    def toggle_labels(labels)
      page.within '.labels' do
        click_link 'Edit'
        wait_for_requests

        labels.each { |label| click_link label }

        click_link 'Edit'
        wait_for_requests
      end
    end

    before do
      create(:label, project: project, title: 'bar')
      project.add_developer(user)

      sign_in(user)
      visit project_issue_path(project, issue)
      wait_for_requests
    end

    it 'shows add note for newly added labels' do
      toggle_labels(%w(foo bar))
      visit project_issue_path(project, issue)
      wait_for_requests

      page.within('#notes') do
        expect(page).to have_content 'added bar foo labels'
      end
    end
  end
end


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_ble"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.fanyu.litelib.ble.BLEActivity">

    <Button
        android:id="@+id/btn_open_bt"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/ble_open_bt"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true" />

    <Button
        android:id="@+id/btn_scan_bt"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/ble_scan_bt"
        android:layout_alignParentTop="true"
        android:layout_toRightOf="@+id/btn_open_bt"
        android:layout_toEndOf="@+id/btn_open_bt" />

    <Button
        android:id="@+id/btn_scan_list_bt"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/btn_scan_list_bt"
        android:layout_alignParentTop="true"
        android:layout_toRightOf="@+id/btn_scan_bt"
        android:layout_toEndOf="@+id/btn_scan_bt" />

    <Button
        android:id="@+id/btn_disconnect_bt"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/ble_disconnect_bt"
        android:layout_marginLeft="12dp"
        android:layout_marginStart="12dp"
        android:layout_alignParentTop="true"
        android:layout_toRightOf="@+id/btn_scan_list_bt"
        android:layout_toEndOf="@+id/btn_scan_list_bt" />

</RelativeLayout>


text:
package com.powa.ui.swipeview;

import android.view.View;

public class ViewHolder {
private OnEventListener mOnEventListener = null;
private View mView = null;

public View getView() {
  return mView;
}

public void setView(View v) {
  mView = v;
}

public OnEventListener getEventListener() {
  return mOnEventListener;
}

public void setOnEventListener(OnEventListener listener) {
  mOnEventListener = listener;
}

public interface OnEventListener {
  void onLike(ViewHolder viewHolder);

  void onDislike(ViewHolder viewHolder);

  void OnClick(ViewHolder viewHolder);
}

}


text:
<?xml version="1.0"?>
<!DOCTYPE catalog PUBLIC
"-//OASIS//DTD Entity Resolution XML Catalog V3.0//EN"
"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">

<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"
         prefer="public">

<!-- ============================================================= -->
<!--  MODULE:    An OASIS XML Catalog (not a DTD Suite module)     -->
<!--  VERSION:   0.4                                               -->
<!--  DATE:      January 2011                                      -->
<!--                                                               -->
<!-- ============================================================= -->

<!-- ============================================================= -->
<!-- SYSTEM:     Archiving and Interchange DTD Suite               -->
<!--                                                               -->
<!-- PURPOSE:    To make the connection between PUBLIC identifiers -->
<!--             for DTD Suite modules and their URIs              -->
<!--                                                               -->
<!-- CONTAINS:   1) Scope of Catalog                               -->
<!--             2) Catalog organization comment                   -->
<!--             3) How to set up a catalog                        -->
<!--                  This catalog has been set up deliberately    -->
<!--                  so that ALL users will need to modify the    -->
<!--                  catalog before using it.                     -->
<!--             4) PUBLIC/SYSTEM identifier map                   -->
<!--                  a. NLM Journal Publishing DTD (Blue)         -->
<!--                  b. NLM Journal Archiving and Interchange     -->
<!--                        DTD (Green)                            -->
<!--                  c. NLM Journal Authoring DTD (Pumpkin)       -->
<!--                  d. NLM Book DTD (Purple: includes Book       -->
<!--                       Collection DTD and Historical Book DTD) -->
<!--                  e. Archiving and Interchange DTD Suite       -->
<!--                       common (shared) modules                 -->
<!--                  f. Suite common (shared) modules from        -->
<!--                       external sources (table models,         -->
<!--                       general entity sets, etc.)              -->
<!--                                                               -->
<!-- CREATED FOR:                                                  -->
<!--             Digital Archive of Journal Articles               -->
<!--             National Center for Biotechnology Information     -->
<!--                (NCBI)                                         -->
<!--             National Library of Medicine (NLM)                -->
<!--                                                               -->
<!-- ORIGINAL CREATION DATE:                                       -->
<!--             June 2002                                         -->
<!--                                                               -->
<!--             Suggestions for refinements and enhancements to   -->
<!--             this DTD should be sent in email to:              -->
<!--                 jats@ncbi.nlm.nih.gov                         -->
<!-- ============================================================= -->

<!-- ============================================================= -->
<!--                    DTD VERSION/CHANGE HISTORY                 -->
<!-- ============================================================= -->
<!--
     =============================================================

Version  Reason/Occasion                   (who) vx.x (yyyy-mm-dd)

     =============================================================
     Version 0.4                       (DAL/BTU) v0.4 (2011-01-31)

     This Tag Set is in the process of becoming a NISO standard.
     The version numbers are starting over from 0.4", as a Trial
     Use Draft, to be made into "Version 1.0" when the Tag Suite
     becomes a NISO standard. Thus, NLM "Version 3.1 Draft" has
     been changed to NISO "Version 0.4". No model, attribute, or
     parameter entity changes were made as part of this renaming.

     Details on NISO Trial Use Draft Version 0.4 are available at
           http://jats.nlm.nih.gov/JATS-0.4.

  3. Updated the public identifiers to "v0.4 20110131//EN",
     modified the formal public identifier to include "JATS (Z39.96)",
     and the filename as delivered to include "JATS" and the
     new version number "0".

     =============================================================
     Version 3.1                       (DAL/BTU) v3.1 (2010-04-30)

     Version 3.1 is fully compatible with Version 3.0.

     Details on version 3.1 are available at
           http://jats.nlm.nih.gov/3.1.

  2. Updated public identifiers to "v3.1 20100830//EN"

     =============================================================
     Version 3.0                       (DAL/BTU) v3.0 (2007-10-31)

     Version 3.0 is the first non-backward-compatible release.
     In addition to the usual incremental changes, some
     elements and attributes have been renamed and/or remodeled
     to better meet user needs and to increase tag set consistency.
     All module change histories are available through the Tag Suite
     web site at http://dtd.nlm.nih.gov.

     Details on version 3.0 are available at
           http://jats.nlm.nih.gov/3.0.

  1. Updated public identifiers to "v3.0 20080202//EN"
     fresh start.                                                   -->

<!-- ============================================================== -->
<!--                    SCOPE (Suite Version 2.3)                   -->
<!-- ============================================================== -->

<!-- This catalog is made up of several groups, each with its own
     xml:base attribute, for:

       - NLM Journal Publishing DTD (Blue)
       - NLM Journal Archiving and Interchange DTD (Green)
       - NLM Journal Authoring DTD (Pumpkin)
       - NLM Book DTD (Purple: includes Book Collection DTD and
                        Historical Book DTD)
       - Archiving and Interchange DTD Suite common (shared) modules
       - Suite common (shared) modules from external sources
            (table models, general entity sets, etc.)               -->

<!-- ============================================================== -->
<!--                    CATALOG ORGANIZATION                        -->
<!-- ============================================================== -->

<!--  GROUPS AND ENTRIES

     Entries are grouped into logical clusters, organized by the
     particular DTD variant.

     Each catalog entry associates a PUBLIC identifier with a SYSTEM
     identifier.

     The SYSTEM identifier is resolved with respect to the xml:base
     attribute which is set on the group element. Thus, for example:

        xml:base="file:///W:/Work/Tasks/DTDJournal/"
        +
        uri="journalpublishing.dtd"
        =
        file:///W:/Work/Tasks/DTDJournal/journalpublishing.dtd

     The XML looks like this:

     <group xml:base="file:///W:/Work/Tasks/DTDJournal/">

       <public publicId="-//NLM//DTD JATS (Z39.96) Journal Publishing DTD v0.4 20110131//EN"
               uri="journalpublishing.dtd"/>
       ...
     </group>
                                                                    -->

<!-- ============================================================== -->
<!--                    HOW TO SET UP                               -->
<!-- ============================================================== -->

<!-- The OASIS catalog and the NCBI Suite of Modules provide a wide
     range of flexibility for setting up. Here are two easy ways to
     do it:

     1. WITHOUT an OASIS catalog (DTD components on a local system):

        - unzip the DTD packages you want to use into a single
          directory:

            - the journal-publishing package
            - the archive article package
            - the journal-authoring package
            - the book package

        - create your own DTD customization, if you need to,
          anywhere, using local (relative or absolute) SYSTEM
          identifiers to reference DTD modules.

        - create a document instance anywhere, and point its
          SYSTEM identifier to your customized DTD or to the
          package DTD you have chosen to use, using a local
          (relative or absolute) SYSTEM identifier.

        The SYSTEM identifiers used in the DTD modules are relative
        to the directory in which you have placed the DTD package
        and your customized DTD, and so your editor/processor will
        find them when reading the DTD.

     2. Using this OASIS catalog (DTD components on a local system):

        - unzip the DTD packages you want to use into a single
          directory, or into separate directories.

        - in this file (the catalog), edit the xml:base attribute
          on the <group> elements.

          Here are instructions for three of the likely
          configurations:

             - If you are using tools that work well with relative
               path locations (e.g., oXygen):
                - delete all the xml:base attributes.

             - If you have unzipped only one of the DTD packages
               (journal, archive article, journal-authoring, or
               book):

                - set the xml:base attribute on the corresponding
                  <group> element in this catalog to the directory
                  where you put the unzipped components,

                - AND set the xml:base attribute on the last
                  two groups in this catalog (the modular library
                  and the public models) to that same directory.

             - If you have unzipped more than one DTD package into
               a single directory:

                 - set all xml:base attributes to that directory.

        - create your own DTD customization, if you need to,
          anywhere, using PUBLIC identifiers to reference the
          DTD modules.

        - tell your editor/processor about this OASIS catalog
          (NB: many apps must be closed and relaunched when
          a catalog file is first specified AND when it is changed)

        - create a document instance anywhere, and point its
          SYSTEM identifier to the DTD you want to use, giving
          an absolute or relative SYSTEM path.

        Your editor/processor will map the PUBLIC identifiers
        in the DTD to the SYSTEM identifiers specified in
        this catalog, using xml:base to locate their whereabouts.   -->

<!-- ============================================================== -->
<!--                    PUBLIC-SYSTEM IDENTIFIER MAP                -->
<!-- ============================================================== -->

<!-- file:///W:/Projects/NCBI/All-DTDs/Working-JATS-0.4/ -->

<!-- ============================================================== -->
<!--                    JOURNAL PUBLISHING DTD (BLUE)               -->
<!-- ============================================================== -->

<group xml:base="file:///W:/Projects/NCBI/All-DTDs/Working-JATS-0.4/"
         prefer="public">

  <public publicId="-//NLM//DTD JATS (Z39.96) Journal Publishing DTD v0.4 20110131//EN"
               uri="JATS-journalpublishing0.dtd"/>

  <public publicId="-//NLM//DTD JATS (Z39.96) Journal Publishing DTD-Specific Modules v0.4 20110131//EN"
               uri="JATS-journalpubcustom-modules0.ent"/>

  <public publicId="-//NLM//DTD JATS (Z39.96) Journal Publishing DTD Customize Classes Module v0.4 20110131//EN"
               uri="JATS-journalpubcustom-classes0.ent"/>

  <public publicId="-//NLM//DTD JATS (Z39.96) Journal Publishing DTD Customize Mixes Module v0.4 20110131//EN"
               uri="JATS-journalpubcustom-mixes0.ent"/>

  <public publicId="-//NLM//DTD JATS (Z39.96) Journal Publishing DTD Customize Content and Attributes Module v0.4 20110131//EN"
               uri="JATS-journalpubcustom-models0.ent"/>

  <public publicId="-//NLM//DTD JATS (Z39.96) NLM Citation v0.4 20110131//EN"
               uri="JATS-nlmcitation0.ent"/>

</group>

<!-- ============================================================== -->
<!--                    JOURNAL ARTICLE ARCHIVING DTD (GREEN)       -->
<!-- ============================================================== -->

<group xml:base="file:///W:/Projects/NCBI/All-DTDs/Working-JATS-0.4/"
         prefer="public">

  <public publicId="-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v0.4 20110131//EN"
               uri="JATS-archivearticle0.dtd"/>

  <public publicId="-//NLM//DTD JATS (Z39.96) Journal Archiving DTD-Specific Modules v0.4 20110131//EN"
               uri="JATS-archivecustom-modules0.ent"/>

  <public publicId="-//NLM//DTD JATS (Z39.96) Journal Archiving DTD Customize Classes Module v0.4 20110131//EN"
               uri="JATS-archivecustom-classes0.ent"/>

  <public publicId="-//NLM//DTD JATS (Z39.96) Journal Archiving DTD Customize Mixes Module v0.4 20110131//EN"
               uri="JATS-archivecustom-mixes0.ent"/>

  <public publicId="-//NLM//DTD JATS (Z39.96) Journal Archiving DTD Customize Content and Attributes Module v0.4 20110131//EN"
               uri="JATS-archivecustom-models0.ent"/>

</group>

<!-- ============================================================== -->
<!--                    JOURNAL ARTICLE AUTHORING DTD (PUMPKIN)     -->
<!-- ============================================================== -->

<group xml:base="file:///W:/Projects/NCBI/All-DTDs/Working-JATS-0.4/"
         prefer="public">

  <public publicId="-//NLM//DTD JATS (Z39.96) Article Authoring DTD v0.4 20110131//EN"
               uri="JATS-articleauthoring0.dtd"/>

  <public publicId= "-//NLM//DTD JATS (Z39.96) Article Authoring DTD-Specific Modules v0.4 20110131//EN"
               uri="JATS-articleauthcustom-modules0.ent"/>

  <public publicId= "-//NLM//DTD JATS (Z39.96) Article Authoring DTD Over-ride Classes Module v0.4 20110131//EN"
               uri="JATS-articleauthcustom-classes0.ent"/>

  <public publicId= "-//NLM//DTD JATS (Z39.96) Article Authoring DTD Over-ride Mixes Module v0.4 20110131//EN"
               uri="JATS-articleauthcustom-mixes0.ent"/>

  <public publicId= "-//NLM//DTD JATS (Z39.96) Article Authoring DTD Over-ride Content and Attribute Module v0.4 20110131//EN"
               uri="JATS-articleauthcustom-models0.ent"/>

</group>

<!-- ============================================================== -->
<!--                    NCBI BOOK DTDS (PURPLE)                     -->
<!-- ============================================================== -->

<group xml:base="file:///W:/Projects/NCBI/All-DTDs/Working-JATS-0.4/"
         prefer="public">

<!-- .............................................................. -->
<!--                    NCBI BOOK DTD                               -->
<!-- .............................................................. -->

  <public publicId="-//NLM//DTD Book DTD v3.1 20110131//EN"
               uri="book3.dtd"/>

  <public publicId="-//NLM//DTD Book DTD Module of Modules v3.1 20110131//EN"
               uri="bookcustom-modules3.ent"/>

  <public publicId="-//NLM//DTD NCBI Book DTD Over-ride Classes Module v3.1 20110131//EN"
               uri="bookcustom-classes3.ent"/>

  <public publicId="-//NLM//DTD NCBI Book DTD Over-ride Mixes Module v3.1 20110131//EN"
               uri="bookcustom-mixes3.ent"/>

  <public publicId="-//NLM//DTD NCBI Book DTD Content and Attribute Over-ride Module v3.1 20110131//EN"
               uri="bookcustom-models3.ent"/>

  <public publicId="-//NLM//DTD NCBI Book Image Map Elements v3.1 20110131//EN"
               uri="bookimagemap3.ent"/>

  <public publicId="-//NLM//DTD NCBI Book DTD Book Metadata Elements v3.1 20110131//EN"
               uri="bookmeta3.ent"/>

  <public publicId="-//NLM//DTD NCBI Book Multi-link Elements v3.1 20110131//EN"
               uri="bookmultilink3.ent"/>

  <public publicId="-//NLM//DTD NCBI Book DTD Book Component Metadata Elements v3.1 20110131//EN"
               uri="bookpart3.ent"/>

<!-- .............................................................. -->
<!--                    NCBI BOOK COLLECTION DTD                    -->
<!--                    Uses all the book-specific modules above    -->
<!-- .............................................................. -->

  <public publicId="-//NLM//DTD NCBI Book Collection DTD v3.1 20110131//EN"
               uri="bookcollection3.dtd"/>

</group>

<!-- ============================================================== -->
<!--                    JOURNAL ARTICLE ARCHIVING OASIS DTD         -->
<!-- ============================================================== -->

<group xml:base="file:///W:/Projects/NCBI/All-DTDs/Working-JATS-0.4/"
           prefer="public">

  <public publicId="-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD (OASIS Tables) v0.4 20110131//EN"
               uri="JATS-archive-oasis-article0.dtd"/>

  <public publicId="-//NLM//DTD JATS (Z39.96) Journal Archiving DTD-Specific Modules (OASIS Tables) v0.4 20110131//EN"
               uri="JATS-archive-oasis-custom-modules0.ent"/>

  <public publicId="-//NLM//DTD JATS (Z39.96) Journal Archiving DTD Customize Classes Module (OASIS Tables) v0.4 20110131//EN"
               uri="JATS-archive-oasis-custom-classes0.ent"/>

  <public publicId="-//NLM//DTD JATS (Z39.96) Journal Archiving DTD Customize Mixes Module (OASIS Tables) v0.4 20110131//EN"
               uri="JATS-archive-oasis-custom-mixes0.ent"/>

</group>

<!-- ============================================================== -->
<!--                    JOURNAL ARTICLE PUBLISHING OASIS DTD        -->
<!-- ============================================================== -->

<group xml:base="file:///W:/Projects/NCBI/All-DTDs/Working-JATS-0.4/"
         prefer="public">

  <public publicId="-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD (OASIS Tables) v0.4 20110131//EN"
               uri="JATS-journalpublishing-oasis0.dtd"/>

  <public publicId="-//NLM//DTD JATS (Z39.96) Journal Archiving DTD-Specific Modules (OASIS Tables) v0.4 20110131//EN"
               uri="JATS-journalpub-oasis-custom-modules0.ent"/>

  <public publicId="-//NLM//DTD JATS (Z39.96) Journal Archiving DTD Customize Classes Module (OASIS Tables) v0.4 20110131//EN"
               uri="JATS-journalpub-oasis-custom-classes0.ent"/>
</group>

<!-- ============================================================== -->
<!--                    ARCHIVING AND INTERCHANGE DTD SUITE         -->
<!--                    MODULAR LIBRARY                             -->
<!-- ============================================================== -->

<group xml:base="file:///W:/Projects/NCBI/All-DTDs/Working-JATS-0.4/"
         prefer="public">

<!--                    MODULE OF MODULES                           -->

  <public publicId="-//NLM//DTD JATS (Z39.96) Archiving and Interchange DTD Suite Module of Modules v0.4 20110131//EN"
               uri="JATS-modules0.ent"/>

<!--                    CLASSES AND MIXES                           -->

  <public publicId="-//NLM//DTD JATS (Z39.96) Default Element Classes Module v0.4 20110131//EN"
               uri="JATS-default-classes0.ent"/>

  <public publicId="-//NLM//DTD JATS (Z39.96) Default Element Mixes Module v0.4 20110131//EN"
               uri="JATS-default-mixes0.ent"/>

<!--                    ELEMENT COMMON (SHARED) ELEMENTS/CHARACTERS -->

  <public publicId="-//NLM//DTD JATS (Z39.96) Archiving and Interchange DTD Suite Common (Shared) Elements Module v0.4 20110131//EN"
               uri="JATS-common0.ent"/>

  <public publicId="-//NLM//DTD JATS (Z39.96) Archiving and Interchange DTD Suite Notation Declarations v0.4 20110131//EN"
               uri="JATS-notat0.ent"/>

  <public publicId="-//NLM//DTD JATS (Z39.96) Archiving and Interchange DTD Suite XML Special Characters Module v0.4 20110131//EN"
               uri="JATS-xmlspecchars0.ent"/>

  <public publicId="-//NLM//DTD JATS (Z39.96) Archiving and Interchange DTD Suite Custom Special Characters Module v0.4 20110131//EN"
               uri="JATS-chars0.ent"/>

<!--                    CLASS MODULES                               -->

  <public publicId="-//NLM//DTD JATS (Z39.96) Archiving and Interchange DTD Suite Journal Article Metadata Elements v0.4 20110131//EN"
               uri="JATS-articlemeta0.ent"/>

  <public publicId="-//NLM//DTD JATS (Z39.96) Archiving and Interchange DTD Suite Back Matter Elements v0.4 20110131//EN"
               uri="JATS-backmatter0.ent"/>

  <public publicId="-//NLM//DTD JATS (Z39.96) Archiving and Interchange DTD Suite Display Class Elements v0.4 20110131//EN"
               uri="JATS-display0.ent"/>

  <public publicId="-//NLM//DTD JATS (Z39.96) Archiving and Interchange DTD Suite Formatting Element Classes v0.4 20110131//EN"
               uri="JATS-format0.ent"/>

  <public publicId="-//NLM//DTD JATS (Z39.96) Archiving and Interchange DTD Suite Funding Elements v0.4 20110131//EN"
               uri="JATS-funding0.ent"/>

  <public publicId="-//NLM//DTD JATS (Z39.96) Archiving and Interchange DTD Suite Journal Metadata Elements v0.4 20110131//EN"
               uri="JATS-journalmeta0.ent"/>

  <public publicId="-//NLM//DTD JATS (Z39.96) Archiving and Interchange DTD Suite Link Class Elements v0.4 20110131//EN"
               uri="JATS-link0.ent"/>

  <public publicId="-//NLM//DTD JATS (Z39.96) Archiving and Interchange DTD Suite List Class Elements v0.4 20110131//EN"
               uri="JATS-list0.ent"/>

  <public publicId="-//NLM//DTD JATS (Z39.96) Archiving and Interchange DTD Suite Math Class Elements v0.4 20110131//EN"
               uri="JATS-math0.ent"/>

  <public publicId="-//NLM//DTD JATS (Z39.96) Archiving and Interchange DTD Suite Paragraph-Like Elements v0.4 20110131//EN"
               uri="JATS-para0.ent"/>

  <public publicId="-//NLM//DTD JATS (Z39.96) Archiving and Interchange DTD Suite Subject Phrase Class Elements v0.4 20110131//EN"
               uri="JATS-phrase0.ent"/>

  <public publicId="-//NLM//DTD JATS (Z39.96) Archiving and Interchange DTD Suite Bibliographic Reference (Citation) Class Elements v0.4 20110131//EN"
               uri="JATS-references0.ent"/>

  <public publicId="-//NLM//DTD JATS (Z39.96) Archiving and Interchange DTD Suite Related Object Element v0.4 20110131//EN"
               uri="JATS-related-object0.ent"/>

  <public publicId="-//NLM//DTD JATS (Z39.96) Archiving and Interchange DTD Suite Section Class Elements v0.4 20110131//EN"
               uri="JATS-section0.ent"/>

<!--                    SET UP TABLES                              -->

  <public publicId="-//NLM//DTD JATS (Z39.96) Archiving and Interchange DTD Suite XHTML Table Setup Module v0.4 20110131//EN"
               uri="JATS-XHTMLtablesetup0.ent"/>

  <public publicId="-//NLM//DTD JATS (Z39.96) Archiving and Interchange DTD Suite OASIS XML Table Setup Module v1.2 20040830//EN"
               uri="JATS-oasis-tablesetup0.ent"/>

<!--                    SET UP MATHML                              -->

  <public publicId="-//NLM//DTD JATS (Z39.96) Archiving and Interchange DTD Suite MathML Setup Module v0.4 20110131//EN"
               uri="JATS-mathmlsetup0.ent"/>

</group>

<!-- ============================================================= -->
<!--                    COMMONLY-USED PUBLIC MODELS AND PUBLIC     -->
<!--                    CHARACTER-ENTITY SETS USED IN THE SUITE    -->
<!-- ============================================================= -->

<group xml:base="file:///W:/Projects/NCBI/All-DTDs/Working-JATS-0.4/"
         prefer="public">

<!-- .............................................................. -->
<!--                    TABLES: XHTML TABLE MODULES                 -->
<!-- .............................................................. -->

  <public publicId="-//W3C//ELEMENTS XHTML Tables 1.0//EN"
               uri="xhtml-table-1.mod"/>

  <public publicId="-//W3C//ENTITIES XHTML Inline Style 1.0//EN"
               uri="xhtml-inlstyle-1.mod"/>

<!-- .............................................................. -->
<!--                    TABLES: OASIS EXCHANGE TABLE MODULES        -->
<!-- .............................................................. -->

  <public publicId="-//OASIS//DTD XML Exchange Table Model 19990315//EN"
               uri="oasis-exchange.ent"/>

<!-- .............................................................. -->
<!--                    MATHML MODULES                              -->
<!-- .............................................................. -->

  <public publicId="-//W3C//DTD MathML 2.0//EN"
               uri="mathml2.dtd"/>

  <public publicId="-//W3C//ENTITIES MathML 2.0 Qualified Names 1.0//EN"
               uri="mathml2-qname-1.mod"/>

  <public publicId="-//W3C//ENTITIES Extra for MathML 2.0//EN"
               uri="mathml/mmlextra.ent"/>

  <public publicId="-//W3C//ENTITIES Aliases for MathML 2.0//EN"
               uri="mathml/mmlalias.ent"/>

<!-- .............................................................. -->
<!--                    ISO 8879 ENTITIES                           -->
<!-- .............................................................. -->

  <public publicId="-//W3C//ENTITIES Box and Line Drawing for MathML 2.0//EN"
               uri="iso8879/isobox.ent"/>

  <public publicId="-//W3C//ENTITIES Russian Cyrillic for MathML 2.0//EN"
               uri="iso8879/isocyr1.ent"/>

  <public publicId="-//W3C//ENTITIES Non-Russian Cyrillic for MathML 2.0//EN"
               uri="iso8879/isocyr2.ent"/>

  <public publicId="-//W3C//ENTITIES Diacritical Marks for MathML 2.0//EN"
               uri="iso8879/isodia.ent"/>

  <public publicId="-//W3C//ENTITIES Added Latin 1 for MathML 2.0//EN"
               uri="iso8879/isolat1.ent"/>

  <public publicId="-//W3C//ENTITIES Added Latin 2 for MathML 2.0//EN"
               uri="iso8879/isolat2.ent"/>

  <public publicId="-//W3C//ENTITIES Numeric and Special Graphic for MathML 2.0//EN"
               uri="iso8879/isonum.ent"/>

  <public publicId="-//W3C//ENTITIES Publishing for MathML 2.0//EN"
               uri="iso8879/isopub.ent"/>

<!-- .............................................................. -->
<!--                    ISO 9573-10.entITIES                        -->
<!-- .............................................................. -->

  <public publicId="-//W3C//ENTITIES General Technical for MathML 2.0//EN"
               uri="iso9573-13/isotech.ent"/>

  <public publicId="-//W3C//ENTITIES Greek Symbols for MathML 2.0//EN"
               uri="iso9573-13/isogrk3.ent"/>

  <public publicId="-//W3C//ENTITIES Math Alphabets: Script for MathML 2.0//EN"
               uri="iso9573-13/isomscr.ent"/>

  <public publicId="-//W3C//ENTITIES Added Math Symbols: Arrow Relations for MathML 2.0//EN"
               uri="iso9573-13/isoamsa.ent"/>

  <public publicId="-//W3C//ENTITIES Added Math Symbols: Binary Operators for MathML 2.0//EN"
               uri="iso9573-13/isoamsb.ent"/>

  <public publicId="-//W3C//ENTITIES Added Math Symbols: Delimiters for MathML 2.0//EN"
               uri="iso9573-13/isoamsc.ent"/>

  <public publicId="-//W3C//ENTITIES Added Math Symbols: Negated Relations for MathML 2.0//EN"
               uri="iso9573-13/isoamsn.ent"/>

  <public publicId="-//W3C//ENTITIES Added Math Symbols: Ordinary for MathML 2.0//EN"
               uri="iso9573-13/isoamso.ent"/>

  <public publicId="-//W3C//ENTITIES Added Math Symbols: Relations for MathML 2.0//EN"
               uri="iso9573-13/isoamsr.ent"/>

  <public publicId="-//W3C//ENTITIES Math Alphabets: Fraktur for MathML 2.0//EN"
               uri="iso9573-13/isomfrk.ent"/>

  <public publicId="-//W3C//ENTITIES Math Alphabets: Open Face for MathML 2.0//EN"
               uri="iso9573-13/isomopf.ent"/>

<!-- .............................................................. -->
<!--                    NON-MATHML ENTITIES(backwards compatibility)-->
<!-- .............................................................. -->

  <public publicId="-//W3C//ENTITIES Greek Letters//EN"
               uri="xmlchars/isogrk1.ent"/>

  <public publicId="-//W3C//ENTITIES Monotoniko Greek//EN"
               uri="xmlchars/isogrk2.ent"/>

  <public publicId="-//W3C//ENTITIES Alternative Greek Symbols//EN"
               uri="xmlchars/isogrk4.ent"/>

</group>

<!-- ============================================================== -->

</catalog>


text:
select
coalesce(team_player,opponent_player) as player,
coalesce(team_event,opponent_event) as event
from ncaa_pbp.play_by_play
where coalesce(team_event,opponent_event) ilike '%dunk%';


text:
==================================
How to extend django-SHOP models
==================================

(Instead of the default ones)

Some people might feel like the django shop models are not suitable for their
project, or want to extend functionality for their specific needs.

This is a rather advanced use case, and most developers should hopefully be happy
with the default models. It is however relatively easy to do.

All models you can override have a corresponding setting, which should contain
the class path to the model you wish to use in its stead.

.. note:: While your models will be used, they will still be "called" by their
  default django-SHOP name.

Example
========

Extending the Product model in django-SHOP works like this::

    # In myproject.models
    from shop.models import Product
    class MyProduct(BaseProduct):
        def extra_method(self):
            return 'Yay'

        class Meta:
            pass

    # In your project's settings.py, add the following line:
    SHOP_PRODUCT_MODEL = 'myproject.models.MyProduct'

.. important:: Your model replacement must define a :class:`Meta` class.
   Otherwise, they will inherit their parent's :class:`Meta`, which will break
   things. The :class:`Meta` class does not need to do anything important - it
   just has to be there.

From a django interactive shell, you should now be able to do::

    >>> from shop.models import Product
    >>> p = Product.objects.all()[0] # I assume there is already at least one
    >>> p.extra_method()
    Yay
    >>> p.__class__
    <class object's class>

Settings
=========

All available settings to control models overrides are defined in :doc:`/settings`


text:
using System;
using System.Collections.Generic;
using System.Text;
using Csla;

namespace BlazorApp.Shared
{
  [Serializable]
  public class PersonEdit : BusinessBase<PersonEdit>
  {
    public static readonly PropertyInfo<int> IdProperty = RegisterProperty<int>(c => c.Id);
    public int Id
    {
      get { return GetProperty(IdProperty); }
      private set { LoadProperty(IdProperty, value); }
    }

    public static readonly PropertyInfo<string> FirstNameProperty = RegisterProperty<string>(c => c.FirstName);
    public string FirstName
    {
      get { return GetProperty(FirstNameProperty); }
      set { SetProperty(FirstNameProperty, value); }
    }

    public static readonly PropertyInfo<string> LastNameProperty = RegisterProperty<string>(c => c.LastName);
    public string LastName
    {
      get { return GetProperty(LastNameProperty); }
      set { SetProperty(LastNameProperty, value); }
    }

    public static readonly PropertyInfo<int> UpdateCounterProperty = RegisterProperty<int>(c => c.UpdateCounter);
    public int UpdateCounter
    {
      get { return GetProperty(UpdateCounterProperty); }
      private set { LoadProperty(UpdateCounterProperty, value); }
    }

    protected override void AddBusinessRules()
    {
      base.AddBusinessRules();
      BusinessRules.AddRule(new Csla.Rules.CommonRules.Required(FirstNameProperty, "First name required"));
      BusinessRules.AddRule(new Csla.Rules.CommonRules.Required(LastNameProperty, "Last name required"));
    }

    private void DataPortal_Fetch(int id)
    {
      using (BypassPropertyChecks)
      {
        Id = id;
        FirstName = "Luke";
        LastName = "Cage";
      }
    }

    protected override void DataPortal_Insert()
    {
      UpdateCounter = UpdateCounter + 1;
    }

    protected override void DataPortal_Update()
    {
      UpdateCounter = UpdateCounter + 1;
    }
  }
}


text:
package org.apache.velocity.test.misc;

import org.apache.velocity.context.InternalContextAdapter;
import org.apache.velocity.exception.MethodInvocationException;
import org.apache.velocity.exception.ParseErrorException;
import org.apache.velocity.exception.ResourceNotFoundException;
import org.apache.velocity.runtime.directive.Directive;
import org.apache.velocity.runtime.parser.node.Node;

import java.io.IOException;
import java.io.Writer;

/**
 * that always throws an exception.  Used to test
 * that RuntimeExceptions are passed through.
 *
 * @author Will Glass-Husain
 * @version $Id$
 */
public class ExceptionGeneratingDirective extends Directive
{
    @Override
    public String getName()
    {
        return "Exception";
    }

    @Override
    public int getType()
    {
        return Directive.BLOCK;
    }

    @Override
    public boolean render(InternalContextAdapter context, Writer writer, Node node)
            throws IOException, ResourceNotFoundException, ParseErrorException,
            MethodInvocationException
    {
        throw new RuntimeException("exception");
    }

}


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

namespace Kemel.Kuery
{
    public enum QueryType
    {
        Select,
        Insert,
        Delete,
        Update,
        Procedure,
        Function
    }
}


text:
/*****************************************************************************

  scheduler.hpp

   This file belongs to the KisTA library
   All rights reserved by the authors (until further License definition)

  Author: F. Herrera
  Institution: KTH
  Deparment:   Electronic Systems
  Date: 2013 January

 *****************************************************************************/

#ifndef SCHEDULER_HPP
#define SCHEDULER_HPP

#include <systemc.h>

#include "sched_types.hpp"
#include "defaults.hpp"

#include "task_info_t.hpp"
#include "taskset_by_name_t.hpp"

#include <map>

#include "static_sched_analysis.hpp"

// Relying on the STL library

namespace kista {

class processing_element;

// Declare a vector table for fast look up of tasks information for priority based scheduling
typedef std::vector<task_info_t*> tasks_by_priority_t;

class scheduler : public sc_module {
	friend void consume(sc_time comp_time);
	friend void yield();
	friend void wait_period();
	friend class task_info_t;
	friend class sketch_report_t;
	friend class processing_element; // has to access private element "tasks_assigned"
public:
	SC_HAS_PROCESS(scheduler);

	// constructors

	// raw constructor (allocation of taks set is separately done with the allocate method)
	scheduler(	sc_module_name sched_name = sc_module_name(sc_gen_unique_name("sched")),
				// properties
				sc_time ttimer_delay = sc_time(DEFAULT_TICK_TIMER_DELAY_NS,SC_NS),
				bool time_slicing_flag = false,
				scheduler_triggering_policy_t scheduler_triggering_policy_par = NON_PREEMPTIVE,
				scheduler_policy_t scheduler_policy_par = CYCLE_EXECUTIVE
				);

	// compact constructor (tak set can be provided in the same call)
	scheduler(
				// assigned task list structure
				taskset_by_name_t *tasks_assigned_p,
				sc_module_name sched_name = sc_module_name(sc_gen_unique_name("sched")),
				// properties
				sc_time ttimer_delay = sc_time(DEFAULT_TICK_TIMER_DELAY_NS,SC_NS),
				bool time_slicing_flag = false,
				scheduler_triggering_policy_t scheduler_triggering_policy_par = NON_PREEMPTIVE,
				scheduler_policy_t scheduler_policy_par = CYCLE_EXECUTIVE
				);

	void scheduler_proc();

	sc_process_handle &get_process_handle(); // to get global scheduler process handle

	// ************************************************************************************
	// SCHEDULER CONFIGURATION
	// ************************************************************************************
	// --------------------------------------------
	// TASK SCHEDULING
	// --------------------------------------------

	// setters 	(should only be used at elaboration time, before the simulation starts)
	void set_triggering_policy(scheduler_triggering_policy_t policy = NON_PREEMPTIVE);  // PREEMPTIVE , COOPERATIVE, NON_PREEMPTIVE (default)

    // alternative style for setting triggering policy
	void set_preemptive();       // A Task can be preempted at any time by a higher priority task
										// - scheduler triggered by yield, changes on task availability (wait) state, tick-timer (if enabled), and by task completion
	void set_cooperative();      // A Task can be preempted only at specific points designated by the task
										// - scheduler triggered by yield (and by task completion)

	void set_non_preemptive();   // once a scheduler grants a processor to a task, the tasks executes till completion (an infinite task never returns processor resource)

	void enable_time_slicing(); // enable time slice events, which can trigger the scheduler in preemptive and cooperative policies

	void set_tick_timer_delay(sc_time ttimer_delay);

	sc_event &get_tick_timer_event();

	void set_policy(scheduler_policy_t sp = CYCLE_EXECUTIVE); // static ones: STATIC_SCHEDULING, CYCLE_EXECUTIVE (default),
	                                                                 // dynamic ones: STATIC_PRIORITIES, DYNAMIC_PRIORITIES, RANDOM_SCHEDULING, PSEUDO_RANDOM_SCHEDULING,

	// ------------------------------------------------------
	// methods for configuring STATIC SCHEDULER policies.
	// ------------------------------------------------------
	void set_static_schedule(static_schedule_by_task_names_t schedule);  // To set the schedule through task names
	void set_static_schedule_by_task_ptrs(static_schedule_by_task_info_pointers_t schedule); // To set the schedule through task information pointers
		// Notes:
		//	- In case several calls to one of these configuration functions, the last one prevails
		//	- In case calls to both configuration functions are done, KisTA checks them, and in case they are not consistent, it reports an error

	// ------------------------------------------------------
	// methods for configuring DYNAMIC SCHEDULER policies.
	// ------------------------------------------------------
	//    set_dispatch_policy (STATIC_PRIORITIES)
	void set_static_priorities_policy(static_priorities_policy_t sdp = USER_PRIORITIES); // USER_PRIORITIES (default), RATE_MONOTONIC, DEADLINE_MONOTONIC, DENSITY_MONOTONIC
	void set_rate_monotonic();            // == set_static_dispatch_policy(RATE_MONOTONIC)
	void set_deadline_monotonic();        // == set_static_dispatch_policy(DEADLINE_MONOTONIC)
	void set_density_monotonic();         // == set_static_dispatch_policy(DENSITY_MONOTONIC)
								// These methods
								// * Reasign internal priorities to follow an order relying on the Period (set_rate_monotonic) or Deadline (set_deadline_monotonic)
								// - The reordering is APPLIED TO:
								//      - ALL TASKS ASSIGNED TO THE SCHEDULER
								//           - First all Tasks with a Period/Deadline are reordered as a function of their Period/Deadline
								//             The lesser the Period/Deadline, the highest the internal priority
								//           -  (**) Then, the other tasks not having a Period/Deadline, are scheduled under USER priority
								//              (the lesser the user priority, the higher (lower number) the internal priority, although
								//               always lower priority with a task with Period/Deadline)
								//					(**) To Be Implemented

	// methods for configuring dynamic policies
	void set_dynamic_priorities_policy(dynamic_priorities_policy_t dpp = EARLIEST_DEADLINE_FIRST); // EARLIES_DEADLINE_FIRST (default), USER
	void set_earliest_deadline_first();      // == set_dynamic_priority_policy(EARLIEST_DEADLINE_FIRST)

	void set_Round_Robin(); // set the scheduler as preemptive, with CYCLE_EXECUTIVE scheduler policy, preemptive and enables time slicing

	// TO GET SCHEDULER CONFIGURATION
	// --------------------------------------------
	scheduler_policy_t& get_policy(); // return STATIC, CYCLE_EXECUTIVE (default), RANDOM, PSEUDO_RANDOM, STATIC_PRIORITIES, DYNAMIC_PRIORITIES

	static_priorities_policy_t& get_static_priorities_policy();

	dynamic_priorities_policy_t& get_dynamic_priorities_policy();

		// get/test configured scheduling triggering policy
	scheduler_triggering_policy_t& get_triggering_policy();
	bool is_preemptive();
	bool is_cooperative();
	bool is_non_preemptive();

    bool    &time_slicing_enabled();
    sc_time  &get_tick_timer_delay();

	// --------------------------------------------
	// COMMUNICATION SCHEDULING
	// --------------------------------------------

	// Static communication scheduling
	void set_static_comm_scheduling(llink_set_t static_comm_schedule_par);
	void set_static_comm_scheduling(static_comm_schedule_by_link_names_t static_comm_schedule_by_name_par);

	//   ... or by means of a vector reflecting the logic destination addresses (tasks)
	//       from which the llink is extracted.
	//       This methods works under the assumption that there is only one communication
	//       synchronization edge for
	void set_static_comm_scheduling(name_pair_vector_t static_comm_schedule_by_task_names_par);

	// to be called at simulation time
	bool static_comm_scheduling_set();

	// TRACING AND REPORT METHODS and data
	// --------------------------------------------
	sc_signal<sched_state_t>  state_signal;		 // For the scheduler, the state signal will server to reflect waitng for the end of context switches (WAITING)
	//   for unfolded tracing
	sc_signal<bool>            consumption_signal;   // Scheduler computation (or busy) signal
	sc_signal<bool>		        waiting_signal;

	// Trace the utilization signal of the scheduler and the utilization signals of the tasks assigned to the scheduler
	// in VCD format
	void trace_utilizations(std::string &scheduler_trace_file_name_par);
    void trace_utilizations();  // uses default name (relying on scheduler name)

    // REPORTS of utilization and occupations
    //     They can be called at any time, before, during the simulation and the end of the simulation
    //     When called during the simulation they report the value up to that moment
    //     if called at the beginning of the simulation they will return 0.0
    double get_tasks_utilization();                   // occupation of all the tasks wrt time (the "useful")
    double get_platform_utilization();                // tasks occupation plus scheduler occupation (excludes waiting: synchronization and communication times)
                                       // currently, equivalent to PE utilization as this class model a local scheduler, i.e. 1 scheduler -> 1 PE
	double get_scheduler_utilization();               // resource time consumed by the scheduler
	double get_task_utilization(const char *name);   // resource time consumed by a task assiged to the scheduler

	unsigned long long get_number_of_schedulings();  		// nuber of schedulings
	unsigned long long get_number_of_context_switches();  // nuber of CONTEXT SWITCHES (schedulings which involve change of task)

		// other possible repors: numer of context switches (not the same as schedulings)

		// to be called only at the end of simulation
	bool	assess_starvation(const char *task_name);	// reports if the assigned tast has ever executed
	bool	assess_starvation();						// returns true if at least one task has never exected
														// (sumps into consola the starved tasks if any)

	bool	miss_deadlines();							// returns true if at least one task assigned to the scheduler lost one deadline (can be called at any time)
	void	report_miss_deadlines();					// provides a report of the tasks that have lost deadlines (can be called at the end of simulation)
						//NOTE: missed deadlines assesment functions are only applied over the task if this declares a deadline
						//       Periodical tasks declare by default a deadline (which is equal to its period by default)

	void	report_response_times();  // provides a report of the response times of the tasks assigned to the scheduler

	void	set_sufficient_global_simulation_time(unsigned int n = 1); // Ensures "sufficiently long" simulation time.
																		 // For it, it changes the global simulation time limit to make it longer
 																		 // A multiplicative factor, n,  can be provided as argument.
																		 // If global simulation time limit is longer it leaves as it is
																		 // This call takes effect only in the following cases:
																		 //   * policy == STATIC_SCHEDULING :
																		 //			-> then it settles the limit as n * the WCET of the static schedule cycle
																		 //   * dynamic policy and periodic task set:
																		 //			-> then it settles the limit as n * hyperperiod
																		 // Otherwise, the global simulation time limit is not touched (but a warning is provided)

	// Allocation of taskset to the scheduler
	// --------------------------------------------------------------------------------------
	void  allocate(	taskset_by_name_t *tasks_assigned_p); // static allocation
	taskset_by_name_t *get_allocated_taskset() { return tasks_assigned; }

	// Map to processing elements (this local scheduler supports mapping to a single PE)
	// --------------------------------------------------------------------------------------

	void  map_to(processing_element *PE_var); // static mapping, since scheduler class represents a local scheduler, it can be mapped to a single PE
	processing_element *get_PE() { return PE; }

    //
    // Interface for modelling the non-idealities of  a specific scheduler instance
   	// -------------------------------------------------------------------------------

	// attach a function for the calculation of the scheduling time specifically for a given
	// scheduler insance (this can be done also with the function set_scheduling_time_calculator
	// The prototype of such function has to fulfil the
	void  set_scheduling_time_calculator(SCHTIME_FPTR fun);

   	// to set a fixed scheduling time specific for a scheduler instance
   	// (Note: this is only applied when the neither a scheduling time calculator has been settled )
	void  set_scheduling_time(sc_time sched_time);

	// methods to facilitate external development of static analysis
	taskset_by_name_t *gets_tasks_assigned();  // to be called at the end of elaboration

	// returns the currently consumed (dynamic) energy by the scheduler task in Jules;
	const double &get_consumed_energy_J();

private:

    // getter for the total amount of tasks associated to the scheduler
    unsigned int &number_of_tasks();

    task_info_t* dispatch();
    // state variables for the dispatcher class
    //    note: This substitute an initial implementation based on static variables,
    //          which prevented the use of several instances of scheduler class
    //          due to the side effects, because the static variable is shared by all class instances.
    unsigned int        it_static_sched;  // used by static scheduling
    taskset_by_name_t::iterator  it_dyn_sched;     // used by some dynamic scheduling policies

    // internal data for scheduler attributes
	sc_time    			last_tick, next_tick;
	sc_time    			tick_timer_delay;
	bool       						t_slicing_flag;
	scheduler_triggering_policy_t	scheduler_triggering_policy;
	scheduler_policy_t  			scheduler_policy;
	static_priorities_policy_t  	static_priorities_policy;
	dynamic_priorities_policy_t  	dynamic_priorities_policy;
	scheduler_t						sched_t; // updated at the end of elaboration, given the user configuration

	// scheduler process handler
	sc_process_handle 	sched_phandler;

	// structure refereing to all tasks process handlers and their associated information
	taskset_by_name_t       *tasks_assigned;
	unsigned int   total_n_tasks; // autocalculated in constructor after static assignation

	tasks_by_priority_t tasks_by_priority; // unlike tasks assigned, this structure is internal and created by KisTA at the end of elaboration

	sc_time sched_comp_time; // computation time required or consumed by the scheduler task up to the current simuation time
	unsigned long long n_schedulings;		// number of schedulings up to the current simuation time
	unsigned long long n_context_changes;	// number of context changes up to the current simuation time

	sc_time last_simulation_time;

	sc_trace_file	*scheduler_trace_file;
	std::string		scheduler_trace_file_name;

	float platform_utilization; // utilization of the scheduler is given in terms
								 // of the ocupation of the scheduler

	void end_of_simulation(); // This call back is used to fill final_simulation_time variable
							  // (In the Acellera SC simulator, it is possible to use sc_time_stamp at the end of simulation
							  // but IEEE-1666-2011 standard says nothing about that
                              // It is also used to close trace files when they are reported

	void before_end_of_elaboration(); // used to automatically create a PE and bind it to the scheduler if the user does not it at building time
	void end_of_elaboration(); // used for the construction of task vector, for fast task selection at scheduling time
								// task spawning has been also moved here from the constructor, instead to construction time, in order to allow to
								// allow the separated allocation of tasksets to schedulers (not necessarily at construction time)

	void check_scheduling_time(sc_time t);
	void check_priorities();

	// Events which trigger can trigger the scheduler (depend on the configuration of the scheduler and time slicing enabling/disabling)
	sc_event yield_event;                      // - a task explicitly yields CPU (a cooperative scheduler use this for preempt the task)
	sc_event completion_event;                 // - a task explicitly yields and completes
	sc_event innactive_task_ends_wait_event;   // - an executing task passes to some waiting state (active or not)
	sc_event running_task_to_wait_state_event; // - an inactive task passes from some waiting state to ready
	sc_event tick_timer_event;                 // - the tick timer produced an event

	// process generating tick timer event
	void gen_tick_timer_event();

	// internal variables for static task scheduling
	static_schedule_by_task_names_t           static_schedule_by_task_names;
	static_schedule_by_task_info_pointers_t  static_schedule_by_task_info_pointers;

	// internal variables for static communication scheduling
	llink_set_t								static_comm_schedule; // by logic links
	static_comm_schedule_by_link_names_t 	static_comm_schedule_by_name;
	name_pair_vector_t 						static_comm_schedule_by_task_names;

    // functions related to static scheduling
	void check_and_prepare_static_schedule();
	sc_time get_WCET(static_schedule_by_task_info_pointers_t static_schedule); // accumulative WCET of static schedule taskset
	sc_time get_WCET();															// accumulative WCET of tasks assigned taskset

	// control of simulation time limit from schedulers
	unsigned int sufficient_global_sim_time_factor; // 0 means it has not been settled, 1 or more it has been settled and the multiplicative factor

	// Variables for non-idealities
	SCHTIME_FPTR  scheduling_time_calculator;
	sc_time 	    scheduling_time;
	bool 	   		scheduling_time_set_flag;

	// processing elements
	// for the moment mapping only to a single one (local scheduler)
	processing_element *PE;

	// hook for adding static analysis
	void static_analysis();

	// energy accounter
	double consumed_energy_J;

};

} // namespace KisTA

#endif


text:
package co.cask.hydrator.plugin;

import co.cask.cdap.etl.mock.common.MockPipelineConfigurer;
import org.junit.Assert;
import org.junit.Test;

/**
 * Unit Tests for DynamoDBConfig.
 */
public class DynamoDBBatchSinkConfigTest {

  @Test
  public void testInvalidTableNameLength() throws Exception {
    BatchDynamoDBSink.DynamoDBConfig config = new
      BatchDynamoDBSink.DynamoDBConfig("Referencename", "testKey", "testkey", "us-east-1", null, "tt", "Id:N",
                                       "Id:HASH", null, null);
    MockPipelineConfigurer configurer = new MockPipelineConfigurer(null);
    try {
      new BatchDynamoDBSink(config).configurePipeline(configurer);
      Assert.fail();
    } catch (IllegalArgumentException e) {
      Assert.assertEquals("Table name 'tt' does not follow the DynamoDB naming rules. Table name must be between 3 " +
                            "and 255 characters long.", e.getMessage());
    }
  }

  @Test
  public void testInvalidTableName() throws Exception {
    BatchDynamoDBSink.DynamoDBConfig config = new
      BatchDynamoDBSink.DynamoDBConfig("Referencename", "testKey", "testkey", "us-east-1", null, "table%^name", "Id:N",
                                       "Id:HASH", null, null);
    MockPipelineConfigurer configurer = new MockPipelineConfigurer(null);
    try {
      new BatchDynamoDBSink(config).configurePipeline(configurer);
      Assert.fail();
    } catch (IllegalArgumentException e) {
      Assert.assertEquals("Table name 'table%^name' does not follow the DynamoDB naming rules. Table names can " +
                            "contain only the following characters: 'a-z, A-Z, 0-9, underscore(_), dot(.) and dash(-)" +
                            "'.", e.getMessage());
    }
  }

  @Test
  public void testMoreThankTwoPrimaryKeys() {
    BatchDynamoDBSink.DynamoDBConfig config = new
      BatchDynamoDBSink.DynamoDBConfig("Referencename", "table%^name", "testKey", "us-east-1", null, "dynamoDBTest",
                                       "Id:N,Region:RANGE,State:RANGE", "Id:HASH,Region:RANGE,State:RANGE", null, null);
    MockPipelineConfigurer configurer = new MockPipelineConfigurer(null);
    try {
      new BatchDynamoDBSink(config).configurePipeline(configurer);
      Assert.fail();
    } catch (IllegalArgumentException e) {
      Assert.assertEquals("Primary key can have only 2 values HASH and RANGE.", e.getMessage());
    }
  }

  @Test
  public void testInvalidPrimaryKeys() {
    BatchDynamoDBSink.DynamoDBConfig config = new
      BatchDynamoDBSink.DynamoDBConfig("Referencename", "table%^name", "testKey", "us-east-1", null, "dynamoDBTest",
                                       "Id:N,Region:RANGE", "Region:RANGE,State:RANGE", null, null);
    MockPipelineConfigurer configurer = new MockPipelineConfigurer(null);
    try {
      new BatchDynamoDBSink(config).configurePipeline(configurer);
      Assert.fail();
    } catch (IllegalArgumentException e) {
      Assert.assertEquals("Please specify attribute value and key types for the same primary keys. Key type for [Id] " +
                            "is not specified.", e.getMessage());
    }
  }
}