text:
package org.apache.jackrabbit.oak.index.indexer.document.flatfile;

import org.apache.jackrabbit.oak.index.indexer.document.NodeStateEntry;
import org.apache.jackrabbit.oak.json.BlobDeserializer;
import org.apache.jackrabbit.oak.json.JsonDeserializer;
import org.apache.jackrabbit.oak.plugins.blob.serializer.BlobIdSerializer;
import org.apache.jackrabbit.oak.spi.blob.BlobStore;
import org.apache.jackrabbit.oak.spi.state.NodeState;

public class NodeStateEntryReader {
    private final BlobDeserializer blobDeserializer;

    public NodeStateEntryReader(BlobStore blobStore){
        this.blobDeserializer = new BlobIdSerializer(blobStore);
    }

    public NodeStateEntry read(String line){
        String[] parts = NodeStateEntryWriter.getParts(line);
        return new NodeStateEntry(parseState(parts[1]), parts[0]);
    }

    private NodeState parseState(String part) {
        JsonDeserializer des = new JsonDeserializer(blobDeserializer);
        return des.deserialize(part);
    }
}


text:
from aquilon.aqdb.model import Filesystem
from aquilon.worker.broker import BrokerCommand, validate_basic
from aquilon.worker.dbwrappers.resources import (del_resource,
                                                 get_resource_holder)

class CommandDelFilesystem(BrokerCommand):

    required_parameters = ["filesystem"]

    def render(self, session, logger, filesystem,
               hostname, cluster, resourcegroup, **arguments):

        validate_basic("filesystem", filesystem)
        holder = get_resource_holder(session, hostname, cluster, resourcegroup)
        dbfs = Filesystem.get_unique(session, name=filesystem, holder=holder,
                                     compel=True)
        del_resource(session, logger, dbfs)
        return

redpajama_set_name: RedPajamaGithub


text:
/**
 * Created by Administrator on 2017/7/4.
 */

var BaseStrategy=require("./baseStrategy");

/////////////////////// Private Method ///////////////////////////////////////////////

class Open_CloseStrategy extends BaseStrategy{

    //初始化
    constructor(strategyConfig)
    {
        //一定要使用super()初始化基类,这样无论基类还是子类的this都是指向子类实例
        super(strategyConfig);

        this.OpenTime=strategyConfig.OpenTime;
        this.isOpen=false;
        this.CloseTime=strategyConfig.CloseTime;
    }

    /////////////////////////////// Public Method /////////////////////////////////////
    OnClosedBar(closedBar)
    {

    }

    OnNewBar(newBar)
    {

    }

    OnTick(tick)
    {
        super.OnTick(tick);

        let currentTime=new Date().toTimeString();

        if(currentTime>this.OpenTime)
        {
            //开仓
            //是否有未完成的Order
            let unFinishOrderList=this.GetUnFinishOrderList();
            if(unFinishOrderList.length===0)
            {
                //多仓是否存在
                let position = this.GetPosition(tick.symbol);
                if(position===undefined || position.longPosition===0)
                {
                    if(this.isOpen===false)
                    {
                        this.isOpen=true;
                        let price=this.PriceUp(tick.symbol,tick.lastPrice,Direction.Buy,2);
                        this.SendOrder(tick.clientName,tick.symbol,price,1,Direction.Buy,OpenCloseFlagType.Open);
                    }
                }
            }else
            {
                for(let index in unFinishOrderList)
                {
                    let unFinishOrder=unFinishOrderList[index];
                    global.NodeQuant.StrategyEngine.CancelOrder(unFinishOrder);
                    //再次开仓
                    this.isOpen=false;
                }
            }
        }

        if(currentTime>this.CloseTime)
        {
            //平仓
            //是否有未完成的Order
            let unFinishOrderList=this.GetUnFinishOrderList();
            if(unFinishOrderList.length===0)
            {
                let unlockPosition = this.GetTodayUnLockLongPosition(tick.symbol);
                if (unlockPosition > 0)
                {
                    let price = this.PriceUp(tick.symbol, tick.lastPrice, Direction.Sell, 2);
                    this.SendOrder(tick.clientName,tick.symbol, tick.lastPrice, unlockPosition, Direction.Sell, OpenCloseFlagType.CloseToday);
                }
            }
        }
    }

    Stop(){
        //调用基类方法
        super.Stop();
    }
}

module.exports=Open_CloseStrategy;


text:
/**
 * Returns a new flat array
 */
const flatten = (arr: any[]) =>
  arr.reduce((a, b) => a.concat(Array.isArray(b) ? flatten(b) : b), []);

export default flatten;


text:
/* === Blue Circle Arrow Buttons ==*/
.mblDomButtonBlueCircleArrow {
	background-image: url(compat/mblDomButtonBlueCircleArrow.png);
	background-repeat: no-repeat;
}

.mblDomButtonBlueCircleArrow > div {
	display: none;
}


text:
require_relative "../resource"
require_relative "../dist"

class Chef
  class Resource
    class SshKnownHostsEntry < Chef::Resource
      unified_mode true

      provides :ssh_known_hosts_entry

      description "Use the **ssh_known_hosts_entry** resource to add an entry for the specified host in /etc/ssh/ssh_known_hosts or a user's known hosts file if specified."
      introduced "14.3"

      property :host, String,
        description: "The host to add to the known hosts file.",
        name_property: true

      property :key, String,
        description: "An optional key for the host. If not provided this will be automatically determined."

      property :key_type, String,
        description: "The type of key to store.",
        default: "rsa"

      property :port, Integer,
        description: "The server port that the ssh-keyscan command will use to gather the public key.",
        default: 22

      property :timeout, Integer,
        description: "The timeout in seconds for ssh-keyscan.",
        default: 30,
        desired_state: false

      property :mode, String,
        description: "The file mode for the ssh_known_hosts file.",
        default: "0644"

      property :owner, [String, Integer],
        description: "The file owner for the ssh_known_hosts file.",
        default: "root"

      property :group, [String, Integer],
        description: "The file group for the ssh_known_hosts file.",
        default: lazy { node["root_group"] }

      property :hash_entries, [TrueClass, FalseClass],
        description: "Hash the hostname and addresses in the ssh_known_hosts file for privacy.",
        default: false

      property :file_location, String,
        description: "The location of the ssh known hosts file. Change this to set a known host file for a particular user.",
        default: "/etc/ssh/ssh_known_hosts"

      action :create do
        description "Create an entry in the ssh_known_hosts file."

        key =
          if new_resource.key
            hoststr = (new_resource.port != 22) ? "[#{new_resource.host}]:#{new_resource.port}" : new_resource.host
            "#{hoststr} #{type_string(new_resource.key_type)} #{new_resource.key}"
          else
            keyscan_cmd = ["ssh-keyscan", "-t#{new_resource.key_type}", "-p #{new_resource.port}"]
            keyscan_cmd << "-H" if new_resource.hash_entries
            keyscan_cmd << new_resource.host
            keyscan = shell_out!(keyscan_cmd.join(" "), timeout: new_resource.timeout)
            keyscan.stdout
          end

        key.sub!(/^#{new_resource.host}/, "[#{new_resource.host}]:#{new_resource.port}") if new_resource.port != 22

        comment = key.split("\n").first || ""

        r = with_run_context :root do
          find_resource(:template, "update ssh known hosts file #{new_resource.file_location}") do
            source ::File.expand_path("../support/ssh_known_hosts.erb", __FILE__)
            local true
            path new_resource.file_location
            owner new_resource.owner
            group new_resource.group
            mode new_resource.mode
            action :nothing
            delayed_action :create
            backup false
            variables(entries: [])
          end
        end

        keys = r.variables[:entries].reject(&:empty?)

        if key_exists?(keys, key, comment)
          Chef::Log.debug "Known hosts key for #{new_resource.host} already exists - skipping"
        else
          r.variables[:entries].push(key)
        end
      end

      # all this does is send an immediate run_action(:create) to the template resource
      action :flush do
        description "Immediately flush the entries to the config file. Without this the actual writing of the file is delayed in the #{Chef::Dist::PRODUCT} run so all entries can be accumulated before writing the file out."

        with_run_context :root do
          # if you haven't ever called ssh_known_hosts_entry before you're definitely doing it wrong so we blow up hard.
          find_resource!(:template, "update ssh known hosts file #{new_resource.file_location}").run_action(:create)
          # it is the user's responsibility to only call this *after* all the ssh_known_hosts_entry resources have been called.
          # if you call this too early in your run_list you will get a partial known_host file written to disk, and the resource
          # behavior will not be idempotent (template resources will flap and never show 0 resources updated on converged boxes).
          Chef::Log.warn "flushed ssh_known_hosts entries to file, later ssh_known_hosts_entry resources will not have been written"
        end
      end

      action_class do
        def key_exists?(keys, key, comment)
          keys.any? do |line|
            line.match(/#{Regexp.escape(comment)}|#{Regexp.escape(key)}/)
          end
        end

        def type_string(key_type)
          type_map = {
            "rsa" => "ssh-rsa",
            "dsa" => "ssh-dss",
            "ecdsa" => "ecdsa-sha2-nistp256",
            "ed25519" => "ssh-ed25519",
          }
          type_map[key_type] || key_type
        end
      end
    end
  end
end


text: export { default } from 'ilios-common/components/toggle-yesno';


text:
ITTDMMAWHTTTF
=============

[![Build Status](https://travis-ci.org/ElDeveloper/ITTDMMAWHTTTF.svg?branch=master)](https://travis-ci.org/ElDeveloper/ITTDMMAWHTTTF)

Is today the Day Marty McFly arrives when he travels to the future?

Inspired by:

- Richard Haderer's [website](http://istodaythedaymartymcflyarriveswhenhetravelstothefuture.com)

Screenshot
==========

*taken on May 12, 2014*
![Imgur](http://i.imgur.com/Qi9c72g.png)


text:
use libc::c_int;
use std::io::signal::Signum;
use std::rt::rtio::RtioSignal;

use homing::{HomingIO, HomeHandle};
use super::{UvError, UvHandle};
use uvll;
use uvio::UvIoFactory;

pub struct SignalWatcher {
    handle: *uvll::uv_signal_t,
    home: HomeHandle,

    channel: Sender<Signum>,
    signal: Signum,
}

impl SignalWatcher {
    pub fn new(io: &mut UvIoFactory, signum: Signum,
               channel: Sender<Signum>) -> Result<~SignalWatcher, UvError> {
        let s = ~SignalWatcher {
            handle: UvHandle::alloc(None::<SignalWatcher>, uvll::UV_SIGNAL),
            home: io.make_handle(),
            channel: channel,
            signal: signum,
        };
        assert_eq!(unsafe {
            uvll::uv_signal_init(io.uv_loop(), s.handle)
        }, 0);

        match unsafe {
            uvll::uv_signal_start(s.handle, signal_cb, signum as c_int)
        } {
            0 => Ok(s.install()),
            n => Err(UvError(n)),
        }

    }
}

extern fn signal_cb(handle: *uvll::uv_signal_t, signum: c_int) {
    let s: &mut SignalWatcher = unsafe { UvHandle::from_uv_handle(&handle) };
    assert_eq!(signum as int, s.signal as int);
    s.channel.try_send(s.signal);
}

impl HomingIO for SignalWatcher {
    fn home<'r>(&'r mut self) -> &'r mut HomeHandle { &mut self.home }
}

impl UvHandle<uvll::uv_signal_t> for SignalWatcher {
    fn uv_handle(&self) -> *uvll::uv_signal_t { self.handle }
}

impl RtioSignal for SignalWatcher {}

impl Drop for SignalWatcher {
    fn drop(&mut self) {
        let _m = self.fire_homing_missile();
        self.close();
    }
}

#[cfg(test)]
mod test {
    use super::super::local_loop;
    use std::io::signal;
    use super::SignalWatcher;

    #[test]
    fn closing_channel_during_drop_doesnt_kill_everything() {
        // see issue #10375, relates to timers as well.
        let (tx, rx) = channel();
        let _signal = SignalWatcher::new(local_loop(), signal::Interrupt,
                                         tx);

        spawn(proc() {
            let _ = rx.recv_opt();
        });

        // when we drop the SignalWatcher we're going to destroy the channel,
        // which must wake up the task on the other end
    }
}


text:
node.js, gulp, karma, bower

- Installing node.js, head over [here](https://nodejs.org/en/download/) to download the latest release for your machine
- Installing gulp
```
npm install gulp -g [use the sudo command if any errors occur o a unix based machine ]
```
- Installing bower
```
npm install bower -g [use the sudo command if any errors occur o a unix based machine ]
```
- Installing karma
```
npm install karma -g [use the sudo command if any errors occur] o a unix based machine ]
```

# modular functions

To test the modular functions run
```
node index.js
```

# Angular-pouchdb project

These instructions will get you a copy of the angular-pouchdb project up and running on your local machine for development and testing purposes.

### Installing
To get project up and running, run the following commands

```
npm install && bower install
```
And

```
gulp
```
to fire up the project in a new browser window

## Running the tests

to run tests on the projects, simply

```
npm test
```
## Built With

* Skeleton - Served as base for css styles
* Angular1 - JavaScript framework

## Author
* **Eyo Okon Eyo**


text:
namespace SnakeBattleNet.Core.Contract
{
    public enum Direction
    {
        North,
        West,
        East,
        South,
    }
}


text:
class TreeStack
  class NotLeafError < Exception; end

  module Mergeable; end

# a class that includes NodeType is expected to have #push method to include child nodes,
# and a class that includes LeafType module is expected to have #concat method.

  module TreeElement
    attr_accessor :depth

    def accept(visitor, memo=nil)
      visitor.visit(self, memo)
    end
  end

  module NodeType
    def push_self(stack)
      @depth = stack.current_node.depth + 1
      stack.push_as_child_node self
      nil
    end
  end

  module LeafType
    def push_self(stack)
      @depth = stack.current_node.depth + 1
      stack.push_as_leaf self
      self
    end

    def merge(leaf)
      raise NotLeafError unless leaf.kind_of? Leaf
      return nil unless leaf.kind_of? Mergeable
      concat(leaf)
    end
  end

  class Node < Array
    include TreeElement
    include NodeType
  end

  class Leaf < Array
    include TreeElement
    include LeafType

    def self.create(content=nil)
      new.tap {|leaf| leaf.push content if content }
    end
  end

  class NodeEnd
    def push_self(stack)
      stack.pop
      nil
    end
  end

  attr_reader :node_end, :last_leaf, :current_node

  def initialize(root_node=Node.new)
    @stack = [root_node]
    @current_node = root_node # @stack[-1]
    @node_end = NodeEnd.new
    root_node.depth = 0
  end

  def tree
    @stack[0]
  end

  def push(node=Node.new)
    @last_leaf = node.push_self(self)
    node
  end

  def pop
    return unless @stack.length > 1
    @current_node = @stack[-2]
    @stack.pop
  end
  alias return_to_previous_node pop

  def push_as_child_node(node)
    @current_node.push node
    @current_node = node
    @stack.push node
  end

  def push_as_leaf(node)
    @current_node.push node
  end

  def push_as_sibling(sibling_node=nil)
    sibling_node ||= @current_node.class.new
    pop if sibling_node.kind_of? NodeType
    push(sibling_node)
    sibling_node
  end

  def remove_current_node
    removed_node = pop
    @current_node.pop
    removed_node
  end

  def accept(visitor, memo=nil)
    visitor.visit(tree, memo)
  end
end


text:
package com.szadowsz.spark.ml.feature

import com.szadowsz.common.io.write.CsvWriter
import org.apache.spark.ml.Transformer
import org.apache.spark.ml.param.{Param, ParamMap}
import org.apache.spark.ml.util.Identifiable
import org.apache.spark.sql.types.StructType
import org.apache.spark.sql.{Dataset, Row, _}

/**
  * Created on 01/12/2016.
  */
class CrossTabTransformer(override val uid: String) extends Transformer {

  protected val isDebug: Param[Boolean] = new Param[Boolean](this, "isDebug", "flag for outputting debugging info")

  protected val debugPath: Param[String] = new Param[String](this, "debugPath", "filepath for debug info")

  protected val inputCols: Param[Array[String]] = new Param[Array[String]](this, "inputCols", "input Columns", (v: Array[String]) => v.length == 2)

  def setInputCols(inputs: String*): this.type = set("inputCols", inputs.toArray)

  def setDebugMode(enableDebug: Boolean): this.type = set("isDebug", enableDebug)

  def setDebugPath(path: String): this.type = set("debugPath", path)

  def this() = this(Identifiable.randomUID("tabStats"))

  protected final def genFileName(c1: String, c2: String) = s"$uid-$c1-tab-$c2.csv"

  protected def writeDistinctCounts(folder: String, column: String, list: List[(Any, Long)]): Unit = {
    val writer = new CsvWriter(folder + column + ".csv", "UTF-8", false)

    list.sortBy { case (key, value) => (-value, key.toString) }.foreach { case (key, value) =>
      writer.write(List(key.toString, value.toString))
    }

    writer.close()
  }

  protected def write(folder: String, c1: String, c2: String, schema: StructType, rows: Seq[Row]): Unit = {
    val writer = new CsvWriter(folder + genFileName(c1, c2), "UTF-8", false)
    writer.write(schema.fieldNames.toSeq)
    writer.writeAll(rows.sortBy(r => r.getString(0)).map(r => r.toSeq.map(Option(_).map(_.toString).getOrElse(""))))
    writer.close()
  }

  override def transformSchema(schema: StructType): StructType = schema

  override def transform(dataset: Dataset[_]): DataFrame = {

    val Array(c1, c2) = $(inputCols)

    val result = dataset.stat.crosstab(c1, c2)

    if (isDefined(debugPath)) {
      val folder = $(debugPath) + uid + "/"
      write(folder, c1, c2, result.schema, result.collect())
    }
    result
  }

  override def copy(extra: ParamMap): Transformer = defaultCopy(extra)
}


text:
$(document).ready(function () {
//  The function to change the class
			var changeClass = function (r,className1,className2) {
				var regex = new RegExp("(?:^|\\s+)" + className1 + "(?:\\s+|$)");
				if( regex.test(r.className) ) {
					r.className = r.className.replace(regex,' '+className2+' ');
			    }
			    else{
					r.className = r.className.replace(new RegExp("(?:^|\\s+)" + className2 + "(?:\\s+|$)"),' '+className1+' ');
			    }
			    return r.className;
			};

			//  Creating our button in JS for smaller screens
			var menuElements = document.getElementById('menu');
			menuElements.insertAdjacentHTML('afterBegin','<button type="button" id="menutoggle" class="navtoogle" aria-hidden="true"><i type="button" aria-hidden="true" id="icon" class="icon-menu"> </i> Menu</button>');

			//  Toggle the class on click to show / hide the menu
			document.getElementById('menutoggle').onclick = function() {
				changeClass(this, 'navtoogle active', 'navtoogle');
			}
			document.getElementById('icon').onclick = function() {
				changeClass(this, 'navtoogle active', 'navtoogle');
			}

			// http://tympanus.net/codrops/2013/05/08/responsive-retina-ready-menu/comment-page-2/#comment-438918
			document.onclick = function(e) {
				var mobileButton = document.getElementById('menutoggle'),
					buttonStyle =  mobileButton.currentStyle ? mobileButton.currentStyle.display : getComputedStyle(mobileButton, null).display;

				if(buttonStyle === 'block' && e.target !== mobileButton && new RegExp(' ' + 'active' + ' ').test(' ' + mobileButton.className + ' ')) {
					changeClass(mobileButton, 'navtoogle active', 'navtoogle');
				}
			}
			document.onclick = function(e) {
				var mobileButton = document.getElementById('icon'),
					buttonStyle =  mobileButton.currentStyle ? mobileButton.currentStyle.display : getComputedStyle(mobileButton, null).display;

				if(buttonStyle === 'block' && e.target !== mobileButton && new RegExp(' ' + 'active' + ' ').test(' ' + mobileButton.className + ' ')) {
					changeClass(mobileButton, 'navtoogle active', 'navtoogle');
				}
			}
});


text:
/* config.h.  Generated by configure.  */
/* config.h.in.  Generated from configure.ac by autoheader.  */

/* Define to 1 if dietlibc supports C99 */
/* #undef ENSC_DIETLIBC_C99 */

/* define when <ext2fs/ext2_fs.h> is usable */
#define ENSC_HAVE_EXT2FS_EXT2_FS_H 1

/* define when <linux/ext2_fs.h> is usable */
/* #undef ENSC_HAVE_LINUX_EXT2_FS_H */

/* Define to 1 when the fast syscall(2) invocation does not work */
#define ENSC_SYSCALL_TRADITIONAL 1

/* The number of the vserver syscall */
#define ENSC_SYSCALL__NR_vserver 273

/* Define to 1 if you have the declaration of `MS_MOVE', and to 0 if you
   don't. */
#define HAVE_DECL_MS_MOVE 0

/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1

/* Define to 1 if the stack is on growing addresses */
/* #undef HAVE_GROWING_STACK */

/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1

/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1

/* Define to 1 if the system has the type `nid_t'. */
/* #undef HAVE_NID_T */

/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1

/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1

/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1

/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1

/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1

/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1

/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1

/* Define to 1 if you have the `vserver' function. */
/* #undef HAVE_VSERVER */

/* Define to 1 if the system has the type `xid_t'. */
/* #undef HAVE_XID_T */

/* Define to 1 if your C compiler doesn't accept -c and -o together. */
/* #undef NO_MINUS_C_MINUS_O */

/* Name of package */
#define PACKAGE "util-vserver"

/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "enrico.scholz@informatik.tu-chemnitz.de"

/* Define to the full name of this package. */
#define PACKAGE_NAME "util-vserver"

/* Define to the full name and version of this package. */
#define PACKAGE_STRING "util-vserver 0.30.196"

/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "util-vserver"

/* Define to the version of this package. */
#define PACKAGE_VERSION "0.30.196"

/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1

/* The utmp gid-number */
#define UTMP_GID 22

/* Enable support for compatibility syscall API */
#define VC_ENABLE_API_COMPAT 1

/* Enable support for filesystem compatibility API */
#define VC_ENABLE_API_FSCOMPAT 1

/* Enable support for old, /proc parsing API */
/* #undef VC_ENABLE_API_LEGACY */

/* Enable support for network context API */
#define VC_ENABLE_API_NET 1

/* Enable API for a backward compatible /proc parsing */
#define VC_ENABLE_API_OLDPROC 1

/* Enable API for a backward compatible uts handling */
#define VC_ENABLE_API_OLDUTS 1

/* Enable support for API of vserver 1.1.x */
#define VC_ENABLE_API_V11 1

/* Enable support for API of vserver 1.3.x */
#define VC_ENABLE_API_V13 1

/* Version number of package */
#define VERSION "0.30.196"

#if defined(__pic__) && defined(__i386) && !defined(ENSC_SYSCALL_TRADITIONAL)
#  define ENSC_SYSCALL_TRADITIONAL 1
#endif

#include "compat.h"


text:
package org.nlp4l.repl

import java.io.BufferedReader
import java.nio.file.FileSystems

import scala.tools.nsc.interpreter._

class NLP4LILoop(in0: Option[BufferedReader], override protected val out: JPrintWriter) extends ILoop{
  def this(in0: BufferedReader, out: JPrintWriter) = this(Some(in0), out)
  def this() = this(None, new JPrintWriter(Console.out, true))

  import LoopCommand.cmd

  lazy val nlp4lCommands = List(
    cmd("?", "[method]", "show help for NLP4L shell", help)
  )

  override def commands = super.commands ++ nlp4lCommands

  override def printWelcome(): Unit = {
    echo(
      s"""
         |Welcome to NLP4L!
         |Type in expressions to have them evaluated.
         |Type :help for more information
         |Type :? for information about NLP4L utilities
       """.trim.stripMargin)
  }

  override def prompt = "\nnlp4l> "

  def help(arg: String): Unit = {
    if (arg.isEmpty) {
      println("All utility methods for NLP4L shell. Type \":? <method>\" for more details.")
      println("-----------------------------------------------------------------------------")
      println("%-35s\t%s" format ("Method", "Brief Description"))
      println("-----------------------------------------------------------------------------")
      println("%-35s\t%s" format ("open(indexDir)", "open index"))
      println("%-35s\t%s" format ("close", "close index"))
      println("%-35s\t%s" format ("status", "display status / overview for current opened index"))
      println("%-35s\t%s" format ("browseTerms(field, [pageSize])", "start browsing terms(words) for the field"))
      println("%-35s\t%s" format ("topTerms([n])", "display top N (default is 10) frequent terms for the field [*1]"))
      println("%-35s\t%s" format ("nextTerms([skip])", "show next terms [*1]"))
      println("%-35s\t%s" format ("nt", "alias for \"nextTerms(1)\""))
      println("%-35s\t%s" format ("prevTerms([skip])", "show previous terms [*1]"))
      println("%-35s\t%s" format ("pt", "alias for \"prevTerms(1)\""))
      println("%-35s\t%s" format ("browseTermDocs(field, term, [pageSize])", "start browsing docs for the term in the specified field"))
      println("%-35s\t%s" format ("nextDocs([skip])", "show next docs [*2]"))
      println("%-35s\t%s" format ("nd", "alias for \"nextDocs(1)\""))
      println("%-35s\t%s" format ("prevDocs([skip])", "show previous docs (required to call this after \"browseTermDocs\" [*2]"))
      println("%-35s\t%s" format ("pd", "alias for \"prevDocs(1)\""))
      println("%-35s\t%s" format ("showDoc(docId, [fields])", "display (stored) field values for the document"))
      println("%-35s\t%s" format ("downloadLdcc", "download and extract Livedoor news corpus"))
      println("%-35s\t%s" format ("downloadBrown", "download and extract Brown corpus"))
      println("%-35s\t%s" format ("downloadReuters", "download and extract Reuters corpus"))
      println("[*1] required to call this after \"browseTerms\"")
      println("[*2] required to call this after \"browseTermDocs\"")
    } else {
      arg match {
        case "open" => {
          println("-- method signature --")
          println("def open(idxDir: String): RawReader")
          println("\n-- description --")
          println("Open Lucene index in the directory. If an index already opened, that is closed before the new index will be opened.")
          println("\n-- arguments --")
          println("%-10s\t%s" format ("idxDir", "Lucene index directory"))
          println("\n-- return value --")
          println("Return : index reader")
          println("\n-- usage --")
          println("nlp4l> open(\"/tmp/myindex\")")
        }
        case "close" => {
          println("-- method signature --")
          println("def close: Unit")
          println("\n-- description --")
          println("Close current opened directory.")
          println("\n-- usage --")
          println("nlp4l> close")
        }
        case "status" => {
          println("-- method signature --")
          println("def status: Unit")
          println("\n-- description --")
          println("Display status and overview information for current opened index.")
          println("\n-- requirements --")
          println("\"open\" must be called before calling this.")
          println("\n-- usage --")
          println("nlp4l> status")
        }
        case "browseTerms" => {
          println("-- method signature --")
          println("def browseTerms(fName: String, pageSize: Int = 20)")
          println("\n-- description --")
          println("Start browsing terms for the specified field. New terms pager is initialized.")
          println("\n-- requirements --")
          println("\"open\" must be called before calling this.")
          println("\n-- arguments --")
          println("%-10s\t%s" format ("fName", "field name"))
          println("%-10s\t%s" format ("pageSize", "max number of showing terms by \"nextTerms\" and \"prevTerms\" (page size)"))
          println("\n-- usage --")
          println("nlp4l> browseTerms(\"title\", 100)")
        }
        case "topTerms" => {
          println("-- method signature --")
          println("def topTerms(n: Int = 10)")
          println("\n-- description --")
          println("Display top N frequent terms for the field. Terms are ranked by Document Frequency (DF)")
          println("\n-- requirements --")
          println("\"browseTerms\" must be called before calling this.")
          println("\n-- arguments --")
          println("%-10s\t%s" format ("n", "max number of terms"))
          println("\n-- usage --")
          println("nlp4l> topTerms(50)")
        }
        case "nextTerms" => {
          println("-- method signature --")
          println("def nextTerms(skip: Int = 1)")
          println("\n-- description --")
          println("Show next terms. If skip is specified, these pages are skipped.")
          println("\n-- requirements --")
          println("\"browseTerms\" must be called before calling this.")
          println("\n-- arguments --")
          println("%-10s\t%s" format ("skip", "pages to be skipped"))
          println("\n-- usage --")
          println("nlp4l> nextTerms(10)")
        }
        case "nt" => {
          println("-- method signature --")
          println("def nt")
          println("\n-- description --")
          println("Alias for \"nextTerms(1)\". Type \":? nextTerms\" for more info.")
          println("\n-- usage --")
          println("nlp4l> nt")
        }
        case "prevTerms" => {
          println("-- method signature --")
          println("def prevTerms(skip: Int = 1)")
          println("\n-- description --")
          println("Show previous terms. If skip is specified, these pages are skipped.")
          println("\n-- requirements --")
          println("\"browseTerms\" must be called before calling this.")
          println("\n-- arguments --")
          println("%-10s\t%s" format ("skip", "pages to be skipped"))
          println("\n-- usage --")
          println("nlp4l> prevTerms(10)")
        }
        case "pt" => {
          println("-- method signature --")
          println("def pt")
          println("\n-- description --")
          println("Alias for \"prevTerms(1)\". Type \":? prevTerms\" for more info.")
          println("\n-- usage --")
          println("nlp4l> pt")
        }
        case "browseTermDocs" => {
          println("-- method signature --")
          println("def browseTermDocs(fName: String, text: String, pageSize: Int = 20)")
          println("\n-- description --")
          println("Start browsing docs for the term in the specified field. New term docs pager is initialized.")
          println("\n-- requirements --")
          println("\"open\" must be called before calling this.")
          println("\n-- arguments --")
          println("%-10s\t%s" format ("fName", "field name"))
          println("%-10s\t%s" format ("text", "term string"))
          println("%-10s\t%s" format ("pageSize", "max number of showing docs by \"nextDocs\" and \"prevDocs\" (page size)"))
          println("\n-- usage --")
          println("nlp4l> browseTermDocs(\"title\", \"lucene\", 100)")
        }
        case "nextDocs" => {
          println("-- method signature --")
          println("def nextDocs(skip: Int = 1)")
          println("\n-- description --")
          println("Show next docs. If skip is specified, these pages are skipped.")
          println("\n-- requirements --")
          println("\"browseTermDocs\" must be called before calling this.")
          println("\n-- arguments --")
          println("%-10s\t%s" format ("skip", "pages to be skipped"))
          println("\n-- usage --")
          println("nlp4l> nextDocs(10)")
        }
        case "nd" => {
          println("-- method signature --")
          println("def nd")
          println("\n-- description --")
          println("Alias for \"nextDocs(1)\". Type \":? nextDocs\" for more info.")
          println("\n-- usage --")
          println("nlp4l> nd")
        }
        case "prevDocs" => {
          println("-- method signature --")
          println("def prevDocs(skip: Int = 1)")
          println("\n-- description --")
          println("Show previous docs. If skip is specified, these pages are skipped.")
          println("\n-- requirements --")
          println("\"browseTermDocs\" must be called before calling this.")
          println("\n-- arguments --")
          println("%-10s\t%s" format ("skip", "pages to be skipped"))
          println("\n-- usage --")
          println("nlp4l> prevDocs(10)")
        }
        case "pd" => {
          println("-- method signature --")
          println("def pd")
          println("\n-- description --")
          println("Alias for \"prevDocs(1)\". Type \":? prevDocs\" for more info.")
          println("\n-- usage --")
          println("nlp4l> pd")
        }
        case "showDoc" => {
          println("-- method signature --")
          println("def showDoc(docId: Int, fields: List[String] = List.empty)")
          println("\n-- description --")
          println("Show the stored field values for the document specified by docId. If fields parameter is not specified, all field values are showed.")
          println("\n-- requirements --")
          println("\"open\" must be called before calling this.")
          println("\n-- arguments --")
          println("%-10s\t%s" format ("docId", "Lucene's internal document id"))
          println("%-10s\t%s" format ("fields", "List of fields to be showed."))
          println("\n-- usage --")
          println("nlp4l> showDoc(150)")
        }
        case "downloadLdcc" => {
          println("-- method signature --")
          println("def downloadLdcc()")
          println("\n-- description --")
          println("Download and extract Livedoor news corpus from: http://www.rondhuit.com/download/ldcc-20140209.tar.gz\"")
          println("Downloaded archive and extracted corpus is placed to corpora/ldcc.")
          println("\n-- requirements --")
          println("\n-- usage --")
          println("nlp4l> downloadLdcc")
        }
        case "downloadBrown" => {
          println("-- method signature --")
          println("def downloadBrown()")
          println("\n-- description --")
          println("Download and extract Brown corpus from: https://ia600503.us.archive.org/21/items/BrownCorpus/brown.zip")
          println("Downloaded archive and extracted corpus is placed to corpora/brown.")
          println("\n-- requirements --")
          println("\n-- usage --")
          println("nlp4l> downloadBrown")
        }
        case "downloadReuters" => {
          println("-- method signature --")
          println("def downloadReuters()")
          println("\n-- description --")
          println("Download and extract Reuters corpus from: http://www.daviddlewis.com/resources/testcollections/reuters21578/reuters21578.tar.gz")
          println("Downloaded archive and extracted corpus is placed to corpora/reuters.")
          println("\n-- requirements --")
          println("\n-- usage --")
          println("nlp4l> downloadReuters")
        }
        case unknown => {
          println("Unknown method %s." format unknown)
          println("Please check methods overview. Type \":?\"")
        }
      }
    }
  }
}


text:
<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="test-to-html.xsl" type="text/xml"?>

<!--

Copyright (c) 2001-2004 World Wide Web Consortium,
(Massachusetts Institute of Technology, Institut National de
Recherche en Informatique et en Automatique, Keio University).  All
Rights Reserved.  This program is distributed under the W3C's Software
Intellectual Property License.  This program 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 W3C License http://www.w3.org/Consortium/Legal/ for more details.

-->

<!DOCTYPE test SYSTEM "dom3.dtd">
<test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-3" name="nodegettextcontent07">
<metadata>
<title>nodegettextcontent07</title>
<creator>IBM</creator>
<description>
	Invoke the method getTextContent on a new Attr node and check if the value returned
	is the attributes Value.
</description>
<contributor>Neil Delima</contributor>
<date qualifier="created">2002-06-10</date>
<subject resource="http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-textContent"/>
</metadata>
<var name="doc" type="Document"/>
<var name="elemList" type="NodeList"/>
<var name="elem" type="Element"/>
<var name="attr" type="Attr"/>
<var name="textContent" type="DOMString"/>
<load var="doc" href="hc_staff" willBeModified="true"/>
<getElementsByTagName var="elemList" obj="doc" tagname='"p"' interface="Document"/>
<item var="elem" obj="elemList" index="3" interface="NodeList"/>
<setAttributeNS obj="elem" namespaceURI='"http://www.w3.org/XML/1998/namespace"' qualifiedName='"xml:lang"' value='"en-US"'/>
<getAttributeNodeNS var="attr" obj="elem" namespaceURI='"http://www.w3.org/XML/1998/namespace"' localName='"lang"'/>
<textContent var="textContent" obj="attr"/>
<assertEquals  actual="textContent" expected='"en-US"' id="nodegettextcontent07" ignoreCase="false"/>
</test>


text:
require "tuvi/inventory/version"
require "tuvi/inventory/step"

module Tuvi
  module Inventory

    def determine_next_step(current_step, input)
      if current_step.answer_paths[input]
        next_step_position = current_step.answer_paths[input]
      else
        puts "Sorry, I don't understand that answer. Please try again:"
        next_step_position = current_step.position
      end
      if current_step.test == "hi"
        next_step_position = 3
      end
      next_step_position
    end

  end
end


text:
<?php

require_once 'phing/Task.php';

/**
 * PhpDocumentor2 Task (http://www.phpdoc.org)
 * Based on the DocBlox Task
 *
 * @author    Michiel Rook <mrook@php.net>
 * @version   $Id$
 * @since     2.4.10
 * @package   phing.tasks.ext.phpdoc
 */
class PhpDocumentor2Task extends Task
{
    /**
     * List of filesets
     * @var FileSet[]
     */
    private $filesets = array();

    /**
     * Destination/target directory
     * @var PhingFile
     */
    private $destDir = null;

    /**
     * name of the template to use
     * @var string
     */
    private $template = "responsive";

    /**
     * Title of the project
     * @var string
     */
    private $title = "";

    /**
     * Force phpDocumentor to be quiet
     * @var boolean
     */
    private $quiet = true;

    /**
     * Nested creator, adds a set of files (nested fileset attribute).
     *
     * @return FileSet
     */
    public function createFileSet()
    {
        $num = array_push($this->filesets, new FileSet());
        return $this->filesets[$num-1];
    }

    /**
     * Sets destination/target directory
     * @param PhingFile $destDir
     */
    public function setDestDir(PhingFile $destDir)
    {
        $this->destDir = $destDir;
    }

    /**
     * Convenience setter (@see setDestDir)
     * @param PhingFile $output
     */
    public function setOutput(PhingFile $output)
    {
        $this->destDir = $output;
    }

    /**
     * Sets the template to use
     * @param strings $template
     */
    public function setTemplate($template)
    {
        $this->template = (string) $template;
    }

    /**
     * Sets the title of the project
     * @param strings $title
     */
    public function setTitle($title)
    {
        $this->title = (string) $title;
    }

    /**
     * Forces phpDocumentor to be quiet
     * @param boolean $quiet
     */
    public function setQuiet($quiet)
    {
        $this->quiet = (boolean) $quiet;
    }

    /**
     * Task entry point
     * @see Task::main()
     */
    public function main()
    {
        if (empty($this->destDir)) {
            throw new BuildException("You must supply the 'destdir' attribute", $this->getLocation());
        }

        if (empty($this->filesets)) {
            throw new BuildException("You have not specified any files to include (<fileset>)", $this->getLocation());
        }

        if (version_compare(PHP_VERSION, '5.3.0') < 0) {
            throw new BuildException("The phpdocumentor2 task requires PHP 5.3+");
        }

        require_once 'phing/tasks/ext/phpdoc/PhpDocumentor2Wrapper.php';

        $wrapper = new PhpDocumentor2Wrapper();
        $wrapper->setProject($this->project);
        $wrapper->setFilesets($this->filesets);
        $wrapper->setDestDir($this->destDir);
        $wrapper->setTemplate($this->template);
        $wrapper->setTitle($this->title);
        $wrapper->run();
    }
}


text:
<?php

namespace DingTalk\Api;

use DingTalk\Util\Http;

class User {

    public static function getUserInfo($accessToken, $code) {
        $response = Http::get("/user/getuserinfo", array("access_token" => $accessToken, "code" => $code));
        return json_encode($response);
    }

    public static function simplelist($accessToken, $deptId, $offset = 0, $size = 100) {
        $response = Http::get("/user/simplelist", array("access_token" => $accessToken, "department_id" => $deptId, 'offset' => $offset, 'size' => $size));
        return $response->userlist;
    }

    public static function getList($accessToken, $deptId, $offset = 0, $size = 100) {
        $response = Http::get("/user/list", array("access_token" => $accessToken, "department_id" => $deptId, 'offset' => $offset, 'size' => $size));
        return $response->userlist;
    }

}


text:
package com.speedment.common.codegen.internal.model;

import com.speedment.common.codegen.internal.util.Copier;
import com.speedment.common.codegen.model.AnnotationUsage;
import com.speedment.common.codegen.model.Field;
import com.speedment.common.codegen.model.Javadoc;
import com.speedment.common.codegen.model.Value;
import com.speedment.common.codegen.model.modifier.Modifier;

import java.lang.reflect.Type;
import java.util.*;

import static java.util.Objects.requireNonNull;

/**
 * This is the default implementation of the {@link Field} interface.
 * This class should not be instantiated directly. Instead you should call the
 * {@link Field#of(String, Type)} method to get an instance. In that way, you
 * can layer change the implementing class without modifying the using code.
 *
 * @author Emil Forslund
 * @see    Field
 */
public final class FieldImpl implements Field {

	private String name;
	private Type type;
	private Value<?> value;
	private Javadoc javadoc;
	private final List<AnnotationUsage> annotations;
	private final Set<Modifier> modifiers;

    /**
     * Initializes this field using a name and a type.
     *

     * Warning! This class should not be instantiated directly but using
     * the {@link Field#of(String, Type)} method!
     *
     * @param name  the name
     * @param type  the type
     */
	public FieldImpl(String name, Type type) {
		this.name			= requireNonNull(name);
		this.type			= requireNonNull(type);
		this.value			= null;
		this.javadoc		= null;
		this.annotations	= new ArrayList<>();
		this.modifiers		= EnumSet.noneOf(Modifier.class);
	}

    /**
     * Copy constructor.
     *
     * @param prototype  the prototype
     */
	protected FieldImpl(Field prototype) {
		name		= requireNonNull(prototype).getName();
		type		= prototype.getType();
		value		= prototype.getValue().map(Copier::copy).orElse(null);
		javadoc		= prototype.getJavadoc().map(Copier::copy).orElse(null);
		annotations	= Copier.copy(prototype.getAnnotations());
		modifiers	= Copier.copy(prototype.getModifiers(), c -> c.copy(), EnumSet.noneOf(Modifier.class));
	}

	@Override
	public String getName() {
		return name;
	}

	@Override
	public Field setName(String name) {
		this.name = requireNonNull(name);
		return this;
	}

	@Override
	public Type getType() {
		return type;
	}

	@Override
	public Field set(Type type) {
		this.type = requireNonNull(type);
		return this;
	}

	@Override
	public Set<Modifier> getModifiers() {
		return modifiers;
	}

	@Override
	public Field set(Javadoc doc) {
		javadoc = doc;
		return this;
	}

	@Override
	public Optional<Javadoc> getJavadoc() {
		return Optional.ofNullable(javadoc);
	}

	@Override
	public Field set(Value<?> val) {
		this.value = val;
		return this;
	}

	@Override
	public Optional<Value<?>> getValue() {
		return Optional.ofNullable(value);
	}

	@Override
	public List<AnnotationUsage> getAnnotations() {
		return annotations;
	}

    @Override
	public FieldImpl copy() {
		return new FieldImpl(this);
	}

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 29 * hash + Objects.hashCode(this.name);
        hash = 29 * hash + Objects.hashCode(this.type);
        hash = 29 * hash + Objects.hashCode(this.value);
        hash = 29 * hash + Objects.hashCode(this.javadoc);
        hash = 29 * hash + Objects.hashCode(this.annotations);
        hash = 29 * hash + Objects.hashCode(this.modifiers);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final FieldImpl other = (FieldImpl) obj;
        if (!Objects.equals(this.name, other.name)) {
            return false;
        }
        if (!Objects.equals(this.type, other.type)) {
            return false;
        }
        if (!Objects.equals(this.value, other.value)) {
            return false;
        }
        if (!Objects.equals(this.javadoc, other.javadoc)) {
            return false;
        }
        if (!Objects.equals(this.annotations, other.annotations)) {
            return false;
        }
        return Objects.equals(this.modifiers, other.modifiers);
    }

}


text:
Stouts.grafana
==============

[![Build Status](http://img.shields.io/travis/Stouts/Stouts.grafana.svg?style=flat-square)](https://travis-ci.org/Stouts/Stouts.grafana)
[![Galaxy](http://img.shields.io/badge/galaxy-Stouts.grafana-blue.svg?style=flat-square)](https://galaxy.ansible.com/list#/roles/1907)

Ansible role which manage [Grafana](http://http://grafana.org/)

* Install and configure Grafana

#### Variables

Here is the list of all variables and their default values:

```yaml
grafana_enabled: yes                        # The role is enabled
grafana_apt_repository: deb https://packagecloud.io/grafana/stable/debian/ wheezy main
grafana_apt_key: https://packagecloud.io/gpg.key

grafana_version: 2.0.1                      # Set version

grafana_app_mode: production

# Paths
grafana_data: /var/lib/grafana
grafana_logs: /var/log/grafana

# Server
grafana_protocol: http
grafana_http_addr: 0.0.0.0                  # The ip address to bind to
grafana_http_port: 3000                     # The http port  to use
grafana_domain: localhost                   # The public facing domain name used to access grafana from a browser
grafana_root_url: "%(protocol)s://%(domain)s:%(http_port)s/"
grafana_router_logging: no                  # Log web requests
grafana_static_root_path: public            # the path relative working path
grafana_enable_gzip: no                     # enable gzip
grafana_cert_file:                          # https certs & key file
grafana_cert_key:

# Database
grafana_type: sqlite3                       # Either "mysql", "postgres" or "sqlite3"
grafana_host: 127.0.0.1:3306
grafana_name: grafana
grafana_user: root
grafana_password:
grafana_ssl_mode: disable                   # For "postgres" only, either "disable", "require" or "verify-full"
grafana_path: grafana.db                    # For "sqlite3" only, path relative to data_path setting

# Session
grafana_provider: file                      # Either "memory", "file", "redis", "mysql", default is "memory"
grafana_provider_config: sessions
grafana_cookie_name: grafana_sess           # Session cookie name
grafana_cookie_secure: no                   # If you use session in https only
grafana_session_life_time: 86400            # Session life time, default is 86400

# Analytics
grafana_reporting_enabled: yes              # Server reporting, sends usage counters to stats.grafana.org every 24 hours.
grafana_google_analytics_ua_id:             # Google Analytics universal tracking code, only enabled if you specify an id here

# Security
grafana_admin_user: admin                   # Default admin username
grafana_admin_password: admin               # Default admin password
grafana_secret_key: ECaamBjja2CChzAp        # Used for signing
grafana_login_remember_days: 7
grafana_cookie_username: grafana_user
grafana_cookie_remember_name: grafana_remember

# Users
grafana_allow_sign_up: yes                  # Disable user signup/registration
grafana_allow_org_create: yes               # Allow non admin users to create organizations
grafana_auto_assign_org: yes                # Set to true to automatically assign new users to the default organization (id 1)
grafana_auto_assign_org_role: Viewer        # Default role new users will be automatically assigned

# Anonymous Auth
grafana_anonymous_enabled: no               # Enable Anonymous access
grafana_anonymous_org_name: Main Org.       # Specify organization name that should be used for unauthenticated users
grafana_anonymous_org_role: Viewer          # Specify role for unauthenticated users

# Github Auth
grafana_github_enabled: no                  # Enable Github Auth
grafana_github_client_id: some_id
grafana_github_client_secret: some_secret
grafana_github_scopes: user:email
grafana_github_auth_url: https://github.com/login/oauth/authorize
grafana_github_token_url: https://github.com/login/oauth/access_token
grafana_github_api_url: https://api.github.com/user
grafana_github_allowed_domains: mycompany.com othercompany.com

# Logging
grafana_log_mode: console, file
grafana_log_buffer_len: 10000
grafana_log_level: Info
```

#### Usage

Add `Stouts.grafana` to your roles and setup the variables in your playbook file.
Example:

```yaml

- hosts: all

  roles:
    - Stouts.grafana

  vars:
```

#### License

Licensed under the MIT License. See the LICENSE file for details.

#### Feedback, bug-reports, requests, ...

Are [welcome](https://github.com/Stouts/Stouts.grafana/issues)!


text:
#ifndef TOY_REG_H
#define TOY_REG_H

#include "pipe/p_compiler.h"
#include "util/u_debug.h" /* for assert() */
#include "util/u_math.h" /* for union fi */

/* a toy reg is 256-bit wide */
#define TOY_REG_WIDTH        32

/**
 * Register files.
 */
enum toy_file {
   /* virtual register file */
   TOY_FILE_VRF,

   TOY_FILE_ARF,
   TOY_FILE_GRF,
   TOY_FILE_MRF,
   TOY_FILE_IMM,

   TOY_FILE_COUNT,
};

/**
 * Register types.
 */
enum toy_type {
   TOY_TYPE_F,
   TOY_TYPE_D,
   TOY_TYPE_UD,
   TOY_TYPE_W,
   TOY_TYPE_UW,
   TOY_TYPE_V, /* only valid for immediates */

   TOY_TYPE_COUNT,
};

/**
 * Register rectangles.  The three numbers stand for vertical stride, width,
 * and horizontal stride respectively.
 */
enum toy_rect {
   TOY_RECT_LINEAR,
   TOY_RECT_041,
   TOY_RECT_010,
   TOY_RECT_220,
   TOY_RECT_440,
   TOY_RECT_240,

   TOY_RECT_COUNT,
};

/**
 * Source swizzles.  They are compatible with TGSI_SWIZZLE_x and hardware
 * values.
 */
enum toy_swizzle {
   TOY_SWIZZLE_X = 0,
   TOY_SWIZZLE_Y = 1,
   TOY_SWIZZLE_Z = 2,
   TOY_SWIZZLE_W = 3,
};

/**
 * Destination writemasks.  They are compatible with TGSI_WRITEMASK_x and
 * hardware values.
 */
enum toy_writemask {
   TOY_WRITEMASK_X    = (1 << TOY_SWIZZLE_X),
   TOY_WRITEMASK_Y    = (1 << TOY_SWIZZLE_Y),
   TOY_WRITEMASK_Z    = (1 << TOY_SWIZZLE_Z),
   TOY_WRITEMASK_W    = (1 << TOY_SWIZZLE_W),
   TOY_WRITEMASK_XY   = (TOY_WRITEMASK_X | TOY_WRITEMASK_Y),
   TOY_WRITEMASK_XZ   = (TOY_WRITEMASK_X | TOY_WRITEMASK_Z),
   TOY_WRITEMASK_XW   = (TOY_WRITEMASK_X | TOY_WRITEMASK_W),
   TOY_WRITEMASK_YZ   = (TOY_WRITEMASK_Y | TOY_WRITEMASK_Z),
   TOY_WRITEMASK_YW   = (TOY_WRITEMASK_Y | TOY_WRITEMASK_W),
   TOY_WRITEMASK_ZW   = (TOY_WRITEMASK_Z | TOY_WRITEMASK_W),
   TOY_WRITEMASK_XYZ  = (TOY_WRITEMASK_X | TOY_WRITEMASK_Y | TOY_WRITEMASK_Z),
   TOY_WRITEMASK_XYW  = (TOY_WRITEMASK_X | TOY_WRITEMASK_Y | TOY_WRITEMASK_W),
   TOY_WRITEMASK_XZW  = (TOY_WRITEMASK_X | TOY_WRITEMASK_Z | TOY_WRITEMASK_W),
   TOY_WRITEMASK_YZW  = (TOY_WRITEMASK_Y | TOY_WRITEMASK_Z | TOY_WRITEMASK_W),
   TOY_WRITEMASK_XYZW = (TOY_WRITEMASK_X | TOY_WRITEMASK_Y |
                         TOY_WRITEMASK_Z | TOY_WRITEMASK_W),
};

/**
 * Destination operand.
 */
struct toy_dst {
   unsigned file:3;              /* TOY_FILE_x */
   unsigned type:3;              /* TOY_TYPE_x */
   unsigned rect:3;              /* TOY_RECT_x */
   unsigned indirect:1;          /* true or false */
   unsigned indirect_subreg:6;   /* which subreg of a0? */

   unsigned writemask:4;         /* TOY_WRITEMASK_x */
   unsigned pad:12;

   uint32_t val32;
};

/**
 * Source operand.
 */
struct toy_src {
   unsigned file:3;              /* TOY_FILE_x */
   unsigned type:3;              /* TOY_TYPE_x */
   unsigned rect:3;              /* TOY_RECT_x */
   unsigned indirect:1;          /* true or false */
   unsigned indirect_subreg:6;   /* which subreg of a0? */

   unsigned swizzle_x:2;         /* TOY_SWIZZLE_x */
   unsigned swizzle_y:2;         /* TOY_SWIZZLE_x */
   unsigned swizzle_z:2;         /* TOY_SWIZZLE_x */
   unsigned swizzle_w:2;         /* TOY_SWIZZLE_x */
   unsigned absolute:1;          /* true or false */
   unsigned negate:1;            /* true or false */
   unsigned pad:6;

   uint32_t val32;
};

/**
 * Return true if the file is virtual.
 */
static inline bool
toy_file_is_virtual(enum toy_file file)
{
   return (file == TOY_FILE_VRF);
}

/**
 * Return true if the file is a hardware one.
 */
static inline bool
toy_file_is_hw(enum toy_file file)
{
   return !toy_file_is_virtual(file);
}

/**
 * Return the size of the file.
 */
static inline uint32_t
toy_file_size(enum toy_file file)
{
   switch (file) {
   case TOY_FILE_GRF:
      return 256 * TOY_REG_WIDTH;
   case TOY_FILE_MRF:
      /* there is no MRF on GEN7+ */
      return 256 * TOY_REG_WIDTH;
   default:
      assert(!"invalid toy file");
      return 0;
   }
}

/**
 * Return the size of the type.
 */
static inline int
toy_type_size(enum toy_type type)
{
   switch (type) {
   case TOY_TYPE_F:
   case TOY_TYPE_D:
   case TOY_TYPE_UD:
      return 4;
   case TOY_TYPE_W:
   case TOY_TYPE_UW:
      return 2;
   case TOY_TYPE_V:
   default:
      assert(!"invalid toy type");
      return 0;
   }
}

/**
 * Return true if the destination operand is null.
 */
static inline bool
tdst_is_null(struct toy_dst dst)
{
   /* BRW_ARF_NULL happens to be 0 */
   return (dst.file == TOY_FILE_ARF && dst.val32 == 0);
}

/**
 * Validate the destination operand.
 */
static inline struct toy_dst
tdst_validate(struct toy_dst dst)
{
   switch (dst.file) {
   case TOY_FILE_VRF:
   case TOY_FILE_ARF:
   case TOY_FILE_MRF:
      assert(!dst.indirect);
      if (dst.file == TOY_FILE_MRF)
         assert(dst.val32 < toy_file_size(dst.file));
      break;
   case TOY_FILE_GRF:
      if (!dst.indirect)
         assert(dst.val32 < toy_file_size(dst.file));
      break;
   case TOY_FILE_IMM:
      /* yes, dst can be IMM of type W (for IF/ELSE/ENDIF/WHILE) */
      assert(!dst.indirect);
      assert(dst.type == TOY_TYPE_W);
      break;
   default:
      assert(!"invalid dst file");
      break;
   }

   switch (dst.type) {
   case TOY_TYPE_V:
      assert(!"invalid dst type");
      break;
   default:
      break;
   }

   assert(dst.rect == TOY_RECT_LINEAR);
   if (dst.file != TOY_FILE_IMM)
      assert(dst.val32 % toy_type_size(dst.type) == 0);

   assert(dst.writemask <= TOY_WRITEMASK_XYZW);

   return dst;
}

/**
 * Change the type of the destination operand.
 */
static inline struct toy_dst
tdst_type(struct toy_dst dst, enum toy_type type)
{
   dst.type = type;
   return tdst_validate(dst);
}

/**
 * Change the type of the destination operand to TOY_TYPE_D.
 */
static inline struct toy_dst
tdst_d(struct toy_dst dst)
{
   return tdst_type(dst, TOY_TYPE_D);
}

/**
 * Change the type of the destination operand to TOY_TYPE_UD.
 */
static inline struct toy_dst
tdst_ud(struct toy_dst dst)
{
   return tdst_type(dst, TOY_TYPE_UD);
}

/**
 * Change the type of the destination operand to TOY_TYPE_W.
 */
static inline struct toy_dst
tdst_w(struct toy_dst dst)
{
   return tdst_type(dst, TOY_TYPE_W);
}

/**
 * Change the type of the destination operand to TOY_TYPE_UW.
 */
static inline struct toy_dst
tdst_uw(struct toy_dst dst)
{
   return tdst_type(dst, TOY_TYPE_UW);
}

/**
 * Change the rectangle of the destination operand.
 */
static inline struct toy_dst
tdst_rect(struct toy_dst dst, enum toy_rect rect)
{
   dst.rect = rect;
   return tdst_validate(dst);
}

/**
 * Apply writemask to the destination operand.  Note that the current
 * writemask is honored.
 */
static inline struct toy_dst
tdst_writemask(struct toy_dst dst, enum toy_writemask writemask)
{
   dst.writemask &= writemask;
   return tdst_validate(dst);
}

/**
 * Offset the destination operand.
 */
static inline struct toy_dst
tdst_offset(struct toy_dst dst, int reg, int subreg)
{
   dst.val32 += reg * TOY_REG_WIDTH + subreg * toy_type_size(dst.type);
   return tdst_validate(dst);
}

/**
 * Construct a destination operand.
 */
static inline struct toy_dst
tdst_full(enum toy_file file, enum toy_type type, enum toy_rect rect,
          bool indirect, unsigned indirect_subreg,
          enum toy_writemask writemask, uint32_t val32)
{
   struct toy_dst dst;

   dst.file = file;
   dst.type = type;
   dst.rect = rect;
   dst.indirect = indirect;
   dst.indirect_subreg = indirect_subreg;
   dst.writemask = writemask;
   dst.pad = 0;

   dst.val32 = val32;

   return tdst_validate(dst);
}

/**
 * Construct a null destination operand.
 */
static inline struct toy_dst
tdst_null(void)
{
   static const struct toy_dst null_dst = {
      .file = TOY_FILE_ARF,
      .type = TOY_TYPE_F,
      .rect = TOY_RECT_LINEAR,
      .indirect = false,
      .indirect_subreg = 0,
      .writemask = TOY_WRITEMASK_XYZW,
      .pad = 0,
      .val32 = 0,
   };

   return null_dst;
}

/**
 * Construct a destination operand from a source operand.
 */
static inline struct toy_dst
tdst_from(struct toy_src src)
{
   const enum toy_writemask writemask =
      (1 << src.swizzle_x) |
      (1 << src.swizzle_y) |
      (1 << src.swizzle_z) |
      (1 << src.swizzle_w);

   return tdst_full(src.file, src.type, src.rect,
         src.indirect, src.indirect_subreg, writemask, src.val32);
}

/**
 * Construct a destination operand, assuming the type is TOY_TYPE_F, the
 * rectangle is TOY_RECT_LINEAR, and the writemask is TOY_WRITEMASK_XYZW.
 */
static inline struct toy_dst
tdst(enum toy_file file, unsigned reg, unsigned subreg_in_bytes)
{
   const enum toy_type type = TOY_TYPE_F;
   const enum toy_rect rect = TOY_RECT_LINEAR;
   const uint32_t val32 = reg * TOY_REG_WIDTH + subreg_in_bytes;

   return tdst_full(file, type, rect,
         false, 0, TOY_WRITEMASK_XYZW, val32);
}

/**
 * Construct an immediate destination operand of type TOY_TYPE_W.
 */
static inline struct toy_dst
tdst_imm_w(int16_t w)
{
   const union fi fi = { .i = w };

   return tdst_full(TOY_FILE_IMM, TOY_TYPE_W, TOY_RECT_LINEAR,
         false, 0, TOY_WRITEMASK_XYZW, fi.ui);
}

/**
 * Return true if the source operand is null.
 */
static inline bool
tsrc_is_null(struct toy_src src)
{
   /* BRW_ARF_NULL happens to be 0 */
   return (src.file == TOY_FILE_ARF && src.val32 == 0);
}

/**
 * Return true if the source operand is swizzled.
 */
static inline bool
tsrc_is_swizzled(struct toy_src src)
{
   return (src.swizzle_x != TOY_SWIZZLE_X ||
           src.swizzle_y != TOY_SWIZZLE_Y ||
           src.swizzle_z != TOY_SWIZZLE_Z ||
           src.swizzle_w != TOY_SWIZZLE_W);
}

/**
 * Return true if the source operand is swizzled to the same channel.
 */
static inline bool
tsrc_is_swizzle1(struct toy_src src)
{
   return (src.swizzle_x == src.swizzle_y &&
           src.swizzle_x == src.swizzle_z &&
           src.swizzle_x == src.swizzle_w);
}

/**
 * Validate the source operand.
 */
static inline struct toy_src
tsrc_validate(struct toy_src src)
{
   switch (src.file) {
   case TOY_FILE_VRF:
   case TOY_FILE_ARF:
   case TOY_FILE_MRF:
      assert(!src.indirect);
      if (src.file == TOY_FILE_MRF)
         assert(src.val32 < toy_file_size(src.file));
      break;
   case TOY_FILE_GRF:
      if (!src.indirect)
         assert(src.val32 < toy_file_size(src.file));
      break;
   case TOY_FILE_IMM:
      assert(!src.indirect);
      break;
   default:
      assert(!"invalid src file");
      break;
   }

   switch (src.type) {
   case TOY_TYPE_V:
      assert(src.file == TOY_FILE_IMM);
      break;
   default:
      break;
   }

   if (src.file != TOY_FILE_IMM)
      assert(src.val32 % toy_type_size(src.type) == 0);

   assert(src.swizzle_x < 4 && src.swizzle_y < 4 &&
          src.swizzle_z < 4 && src.swizzle_w < 4);

   return src;
}

/**
 * Change the type of the source operand.
 */
static inline struct toy_src
tsrc_type(struct toy_src src, enum toy_type type)
{
   src.type = type;
   return tsrc_validate(src);
}

/**
 * Change the type of the source operand to TOY_TYPE_D.
 */
static inline struct toy_src
tsrc_d(struct toy_src src)
{
   return tsrc_type(src, TOY_TYPE_D);
}

/**
 * Change the type of the source operand to TOY_TYPE_UD.
 */
static inline struct toy_src
tsrc_ud(struct toy_src src)
{
   return tsrc_type(src, TOY_TYPE_UD);
}

/**
 * Change the type of the source operand to TOY_TYPE_W.
 */
static inline struct toy_src
tsrc_w(struct toy_src src)
{
   return tsrc_type(src, TOY_TYPE_W);
}

/**
 * Change the type of the source operand to TOY_TYPE_UW.
 */
static inline struct toy_src
tsrc_uw(struct toy_src src)
{
   return tsrc_type(src, TOY_TYPE_UW);
}

/**
 * Change the rectangle of the source operand.
 */
static inline struct toy_src
tsrc_rect(struct toy_src src, enum toy_rect rect)
{
   src.rect = rect;
   return tsrc_validate(src);
}

/**
 * Swizzle the source operand.  Note that the current swizzles are honored.
 */
static inline struct toy_src
tsrc_swizzle(struct toy_src src,
             enum toy_swizzle swizzle_x, enum toy_swizzle swizzle_y,
             enum toy_swizzle swizzle_z, enum toy_swizzle swizzle_w)
{
   const enum toy_swizzle current[4] = {
      src.swizzle_x, src.swizzle_y,
      src.swizzle_z, src.swizzle_w,
   };

   src.swizzle_x = current[swizzle_x];
   src.swizzle_y = current[swizzle_y];
   src.swizzle_z = current[swizzle_z];
   src.swizzle_w = current[swizzle_w];

   return tsrc_validate(src);
}

/**
 * Swizzle the source operand to the same channel.  Note that the current
 * swizzles are honored.
 */
static inline struct toy_src
tsrc_swizzle1(struct toy_src src, enum toy_swizzle swizzle)
{
   return tsrc_swizzle(src, swizzle, swizzle, swizzle, swizzle);
}

/**
 * Set absolute and unset negate of the source operand.
 */
static inline struct toy_src
tsrc_absolute(struct toy_src src)
{
   src.absolute = true;
   src.negate = false;
   return tsrc_validate(src);
}

/**
 * Negate the source operand.
 */
static inline struct toy_src
tsrc_negate(struct toy_src src)
{
   src.negate = !src.negate;
   return tsrc_validate(src);
}

/**
 * Offset the source operand.
 */
static inline struct toy_src
tsrc_offset(struct toy_src src, int reg, int subreg)
{
   src.val32 += reg * TOY_REG_WIDTH + subreg * toy_type_size(src.type);
   return tsrc_validate(src);
}

/**
 * Construct a source operand.
 */
static inline struct toy_src
tsrc_full(enum toy_file file, enum toy_type type,
          enum toy_rect rect, bool indirect, unsigned indirect_subreg,
          enum toy_swizzle swizzle_x, enum toy_swizzle swizzle_y,
          enum toy_swizzle swizzle_z, enum toy_swizzle swizzle_w,
          bool absolute, bool negate,
          uint32_t val32)
{
   struct toy_src src;

   src.file = file;
   src.type = type;
   src.rect = rect;
   src.indirect = indirect;
   src.indirect_subreg = indirect_subreg;
   src.swizzle_x = swizzle_x;
   src.swizzle_y = swizzle_y;
   src.swizzle_z = swizzle_z;
   src.swizzle_w = swizzle_w;
   src.absolute = absolute;
   src.negate = negate;
   src.pad = 0;

   src.val32 = val32;

   return tsrc_validate(src);
}

/**
 * Construct a null source operand.
 */
static inline struct toy_src
tsrc_null(void)
{
   static const struct toy_src null_src = {
      .file = TOY_FILE_ARF,
      .type = TOY_TYPE_F,
      .rect = TOY_RECT_LINEAR,
      .indirect = false,
      .indirect_subreg = 0,
      .swizzle_x = TOY_SWIZZLE_X,
      .swizzle_y = TOY_SWIZZLE_Y,
      .swizzle_z = TOY_SWIZZLE_Z,
      .swizzle_w = TOY_SWIZZLE_W,
      .absolute = false,
      .negate = false,
      .pad = 0,
      .val32 = 0,
   };

   return null_src;
}

/**
 * Construct a source operand from a destination operand.
 */
static inline struct toy_src
tsrc_from(struct toy_dst dst)
{
   enum toy_swizzle swizzle[4];

   if (dst.writemask == TOY_WRITEMASK_XYZW) {
      swizzle[0] = TOY_SWIZZLE_X;
      swizzle[1] = TOY_SWIZZLE_Y;
      swizzle[2] = TOY_SWIZZLE_Z;
      swizzle[3] = TOY_SWIZZLE_W;
   }
   else {
      const enum toy_swizzle first =
         (dst.writemask & TOY_WRITEMASK_X) ? TOY_SWIZZLE_X :
         (dst.writemask & TOY_WRITEMASK_Y) ? TOY_SWIZZLE_Y :
         (dst.writemask & TOY_WRITEMASK_Z) ? TOY_SWIZZLE_Z :
         (dst.writemask & TOY_WRITEMASK_W) ? TOY_SWIZZLE_W :
         TOY_SWIZZLE_X;

      swizzle[0] = (dst.writemask & TOY_WRITEMASK_X) ? TOY_SWIZZLE_X : first;
      swizzle[1] = (dst.writemask & TOY_WRITEMASK_Y) ? TOY_SWIZZLE_Y : first;
      swizzle[2] = (dst.writemask & TOY_WRITEMASK_Z) ? TOY_SWIZZLE_Z : first;
      swizzle[3] = (dst.writemask & TOY_WRITEMASK_W) ? TOY_SWIZZLE_W : first;
   }

   return tsrc_full(dst.file, dst.type, dst.rect,
                    dst.indirect, dst.indirect_subreg,
                    swizzle[0], swizzle[1], swizzle[2], swizzle[3],
                    false, false, dst.val32);
}

/**
 * Construct a source operand, assuming the type is TOY_TYPE_F, the
 * rectangle is TOY_RECT_LINEAR, and no swizzles/absolute/negate.
 */
static inline struct toy_src
tsrc(enum toy_file file, unsigned reg, unsigned subreg_in_bytes)
{
   const enum toy_type type = TOY_TYPE_F;
   const enum toy_rect rect = TOY_RECT_LINEAR;
   const uint32_t val32 = reg * TOY_REG_WIDTH + subreg_in_bytes;

   return tsrc_full(file, type, rect, false, 0,
                    TOY_SWIZZLE_X, TOY_SWIZZLE_Y,
                    TOY_SWIZZLE_Z, TOY_SWIZZLE_W,
                    false, false, val32);
}

/**
 * Construct an immediate source operand.
 */
static inline struct toy_src
tsrc_imm(enum toy_type type, uint32_t val32)
{
   return tsrc_full(TOY_FILE_IMM, type, TOY_RECT_LINEAR, false, 0,
                    TOY_SWIZZLE_X, TOY_SWIZZLE_Y,
                    TOY_SWIZZLE_Z, TOY_SWIZZLE_W,
                    false, false, val32);
}

/**
 * Construct an immediate source operand of type TOY_TYPE_F.
 */
static inline struct toy_src
tsrc_imm_f(float f)
{
   const union fi fi = { .f = f };
   return tsrc_imm(TOY_TYPE_F, fi.ui);
}

/**
 * Construct an immediate source operand of type TOY_TYPE_D.
 */
static inline struct toy_src
tsrc_imm_d(int32_t d)
{
   const union fi fi = { .i = d };
   return tsrc_imm(TOY_TYPE_D, fi.ui);
}

/**
 * Construct an immediate source operand of type TOY_TYPE_UD.
 */
static inline struct toy_src
tsrc_imm_ud(uint32_t ud)
{
   const union fi fi = { .ui = ud };
   return tsrc_imm(TOY_TYPE_UD, fi.ui);
}

/**
 * Construct an immediate source operand of type TOY_TYPE_W.
 */
static inline struct toy_src
tsrc_imm_w(int16_t w)
{
   const union fi fi = { .i = w };
   return tsrc_imm(TOY_TYPE_W, fi.ui);
}

/**
 * Construct an immediate source operand of type TOY_TYPE_UW.
 */
static inline struct toy_src
tsrc_imm_uw(uint16_t uw)
{
   const union fi fi = { .ui = uw };
   return tsrc_imm(TOY_TYPE_UW, fi.ui);
}

/**
 * Construct an immediate source operand of type TOY_TYPE_V.
 */
static inline struct toy_src
tsrc_imm_v(uint32_t v)
{
   return tsrc_imm(TOY_TYPE_V, v);
}

#endif /* TOY_REG_H */


text:
#include <aws/kendra/model/UserContext.h>
#include <aws/core/utils/json/JsonSerializer.h>

#include <utility>

using namespace Aws::Utils::Json;
using namespace Aws::Utils;

namespace Aws
{
namespace kendra
{
namespace Model
{

UserContext::UserContext() :
    m_tokenHasBeenSet(false)
{
}

UserContext::UserContext(JsonView jsonValue) :
    m_tokenHasBeenSet(false)
{
  *this = jsonValue;
}

UserContext& UserContext::operator =(JsonView jsonValue)
{
  if(jsonValue.ValueExists("Token"))
  {
    m_token = jsonValue.GetString("Token");

    m_tokenHasBeenSet = true;
  }

  return *this;
}

JsonValue UserContext::Jsonize() const
{
  JsonValue payload;

  if(m_tokenHasBeenSet)
  {
   payload.WithString("Token", m_token);

  }

  return payload;
}

} // namespace Model
} // namespace kendra
} // namespace Aws


text:
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE chapter SYSTEM "chapter.dtd">

<chapter>

    <copyright>
      <year>1997</year><year>2016</year>
      <holder>Ericsson AB. All Rights Reserved.</holder>
    </copyright>
    <legalnotice>
      Licensed under the Apache License, Version 2.0 (the "License");
      you may not use this file except in compliance with the License.
      You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      See the License for the specific language governing permissions and
      limitations under the License.

    </legalnotice>

    <title>Introduction</title>
    <prepared>Claes Wikström, Hans Nilsson and Håkan Mattsson</prepared>
    <responsible>Bjarne Däcker</responsible>
    <docno></docno>
    <approved>Bjarne Däcker</approved>
    <checked>Bjarne Däcker</checked>
    <date></date>
    <rev>C</rev>
    <file>Mnesia_chap1.xml</file>

The <c>Mnesia</c> application provides a heavy duty real-time
    distributed database.

      <title>Scope</title>

This User's Guide describes how to
        build <c>Mnesia</c> database applications, and how to integrate
        and use the <c>Mnesia</c> database management system with
        OTP. Programming constructs are described, and numerous
        programming examples are included to illustrate the use of
        <c>Mnesia</c>.

This User's Guide is organized as follows:

      <list type="bulleted">
        <item><seealso marker="Mnesia_overview">Mnesia</seealso>
	provides an introduction to
	<c>Mnesia</c>.
        </item>
        <item><seealso marker="Mnesia_chap2">Getting Started</seealso>
        introduces <c>Mnesia</c> with an example database. Examples
        are included how to start an Erlang session, specify a
        <c>Mnesia</c> database directory, initialize a database
        schema, start <c>Mnesia</c>, and create tables. Initial
        prototyping of record definitions is also discussed.
        </item>
        <item><seealso marker="Mnesia_chap3">Build a Mnesia
        Database</seealso> more formally describes the steps
        introduced in the previous section, namely the <c>Mnesia</c>
        functions that define a database schema, start <c>Mnesia</c>,
        and create the required tables.
        </item>
        <item><seealso marker="Mnesia_chap4">Transactions and Other Access Contexts</seealso>
         describes the transactions properties that make <c>Mnesia</c> into
         a fault tolerant, real-time distributed database management
         system. This section also describes the concept of locking
         to ensure consistency in tables, and "dirty
         operations", or short cuts, which bypass the transaction system
         to improve speed and reduce overheads.
        </item>
        <item><seealso marker="Mnesia_chap5">Miscellaneous Mnesia
        Features</seealso> describes features that enable the
        construction of more complex database applications. These
        features include indexing, checkpoints, distribution and fault
        tolerance, disc-less nodes, replication manipulation, local
        content tables, concurrency, and object-based programming in
        <c>Mnesia</c>.
        </item>
        <item><seealso marker="Mnesia_chap7">Mnesia System
        Information</seealso> describes the files contained in the
        <c>Mnesia</c> database directory, database configuration data,
        core and table dumps, as well as the important subject of
        backup, fall-back, and disaster recovery principles.
        </item>
        <item><seealso marker="Mnesia_chap8">Combine Mnesia with
        SNMP</seealso> is a short section that outlines <c>Mnesia</c>
        integrated with SNMP.
        </item>
        <item><seealso marker="Mnesia_App_A">Appendix A: Backup
        Callback Interface</seealso> is a program listing of the
        default implementation of this facility.
        </item>
        <item><seealso marker="Mnesia_App_B">Appendix B: Activity
        Access Callback Interface</seealso> is a program outlining
        one possible implementation of this facility.
        </item>
        <item><seealso marker="Mnesia_App_C">Appendix C: Fragmented
        Table Hashing Callback Interface</seealso> is a program
        outlining one possible implementation of this facility.
        </item>
      </list>

      <title>Prerequisites</title>

It is assumed that the reader is familiar with the Erlang
        programming language, system development principles, and
        database management systems.

</chapter>