text:
using System;

namespace System.Runtime.CompilerServices
{
    [Serializable]
    [AttributeUsage(AttributeTargets.Struct)]
    sealed public class UnsafeValueTypeAttribute : Attribute
    {
    }
}

redpajama_set_name: RedPajamaGithub


text:
package com.swfarm.biz.product.dao.impl;

import com.swfarm.biz.product.bo.SaleSuite;
import com.swfarm.biz.product.dao.SaleSuiteDao;
import com.swfarm.pub.framework.dao.GenericDaoHibernateImpl;

public class SaleSuiteDaoImpl extends GenericDaoHibernateImpl<SaleSuite, Long>
		implements SaleSuiteDao {

	public SaleSuiteDaoImpl(Class<SaleSuite> type) {
		super(type);
	}

}


text:
Originally published: 2013-02-09 10:21:38
Last updated: 2013-02-09 10:21:39
Author: Barry Walker

This code is a DEMO RF Attenuator for SW listeners.

(The code is to show how to generate the same waveform in each channel but in antiphase, as bridge output. The RF Attenuator is just a byproduct...)

The circuit has an insertion loss of about 10dB at full gain but that doesn't matter as it IS an attenuator after all.

It is another learning tool for kids to build and code for themselves.

The only common user I/O on desktops, netbooks, laptops and current MacBooks is/are the Audio Mic and Ear sockets...

This goes for "mobiles" too...

The circuit inside the code is so easy a 10 year old could have a working unit inisde 2 hours to experiment with...

PyAudio IS needed for this to work and although originally designed around a MacBook Pro 13 inch OSX 10.7.5 and Python 2.6.7 has shown itself to be near platform independent...

Read the code for much more information...

Enjoy finding simple solutions to often very difficult problems... ;o)

Bazza, G0LCU...


text:
// *************************************************************************************
// SCICHART® Copyright SciChart Ltd. 2011-2017. All rights reserved.
//
// Web: http://www.scichart.com
//   Support: support@scichart.com
//   Sales:   sales@scichart.com
//
// NullableBooleanConverter.cs is part of SCICHART®, High Performance Scientific Charts
// For full terms and conditions of the license, see http://www.scichart.com/scichart-eula/
//
// This source code is protected by international copyright law. Unauthorized
// reproduction, reverse-engineering, or distribution of all or any portion of
// this source code is strictly prohibited.
//
// This source code contains confidential and proprietary trade secrets of
// SciChart Ltd., and should at no time be copied, transferred, sold,
// distributed or made available without express written permission.
// *************************************************************************************
using System;
using System.Globalization;
using System.Windows.Data;

namespace SciChart.Sandbox.Converters
{
    public class NullableBooleanConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return value.Equals(true);
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return value.Equals(true);
        }
    }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">

    <title>{{ site.name }}{% if page.number and page.number != 8 %} | Lesson {{page.number}}{% endif %}</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
    <link href="//netdna.bootstrapcdn.com/font-awesome/3.1.1/css/font-awesome.css" rel="stylesheet">
    <link rel="shortcut icon" href="{{ site.baseurl}}/favicon.ico" type="image/x-icon">

    <link href="{{ site.baseurl}}/css/ace.css" rel="stylesheet" media="screen">
    <link href="{{ site.baseurl}}/css/lessons.css" rel="stylesheet" media="screen">
    <link href="{{ site.baseurl}}/css/site.css" rel="stylesheet" media="screen">

        Don't use this ugly Heroku app URL! Check out www.markdowntutorial.com instead.

        {{ content }}


text:
with bg as
(
  -- join blood gas to ventilation durations to determine if patient was vent
  select bg.icustay_id
  , min(pco2) as paco2_min
  from `physionet-data.mimiciii_derived.blood_gas_first_day_arterial` bg
  where specimen_pred = 'ART'
  group by bg.icustay_id
)
-- Aggregate the components for the score
, scorecomp as
(
select ie.icustay_id
  , v.tempc_min
  , v.tempc_max
  , v.heartrate_max
  , v.resprate_max
  , bg.paco2_min
  , l.wbc_min
  , l.wbc_max
  , l.bands_max
FROM `physionet-data.mimiciii_clinical.icustays` ie
left join bg
 on ie.icustay_id = bg.icustay_id
left join `physionet-data.mimiciii_derived.vitals_first_day` v
  on ie.icustay_id = v.icustay_id
left join `physionet-data.mimiciii_derived.labs_first_day` l
  on ie.icustay_id = l.icustay_id
)
, scorecalc as
(
  -- Calculate the final score
  -- note that if the underlying data is missing, the component is null
  -- eventually these are treated as 0 (normal), but knowing when data is missing is useful for debugging
  select icustay_id

  , case
      when tempc_min < 36.0 then 1
      when tempc_max > 38.0 then 1
      when tempc_min is null then null
      else 0
    end as temp_score

  , case
      when heartrate_max > 90.0  then 1
      when heartrate_max is null then null
      else 0
    end as heartrate_score

  , case
      when resprate_max > 20.0  then 1
      when paco2_min < 32.0  then 1
      when coalesce(resprate_max, paco2_min) is null then null
      else 0
    end as resp_score

  , case
      when wbc_min <  4.0  then 1
      when wbc_max > 12.0  then 1
      when bands_max > 10 then 1-- > 10% immature neurophils (band forms)
      when coalesce(wbc_min, bands_max) is null then null
      else 0
    end as wbc_score

  from scorecomp
)
select
  ie.subject_id, ie.hadm_id, ie.icustay_id
  -- Combine all the scores to get SOFA
  -- Impute 0 if the score is missing
  , coalesce(temp_score,0)
  + coalesce(heartrate_score,0)
  + coalesce(resp_score,0)
  + coalesce(wbc_score,0)
    as sirs
  , temp_score, heartrate_score, resp_score, wbc_score
FROM `physionet-data.mimiciii_clinical.icustays` ie
left join scorecalc s
  on ie.icustay_id = s.icustay_id
order by ie.icustay_id;


text:
import pytest
import responses
from flask import Flask
from urlobject import URLObject

from flask_dance.consumer import OAuth2ConsumerBlueprint
from flask_dance.consumer.storage import MemoryStorage
from flask_dance.contrib.discord import discord, make_discord_blueprint

@pytest.fixture
def make_app():
    "A callable to create a Flask app with the Discord provider"

    def _make_app(*args, **kwargs):
        app = Flask(__name__)
        app.secret_key = "whatever"
        blueprint = make_discord_blueprint(*args, **kwargs)
        app.register_blueprint(blueprint)
        return app

    return _make_app

def test_blueprint_factory():
    discord_bp = make_discord_blueprint(
        client_id="foo",
        client_secret="bar",
        scope=["identify", "email"],
        redirect_to="index",
    )
    assert isinstance(discord_bp, OAuth2ConsumerBlueprint)
    assert discord_bp.session.scope == ["identify", "email"]
    assert discord_bp.session.base_url == "https://discord.com/"
    assert discord_bp.session.client_id == "foo"
    assert discord_bp.client_secret == "bar"
    assert discord_bp.authorization_url == "https://discord.com/api/oauth2/authorize"
    assert discord_bp.token_url == "https://discord.com/api/oauth2/token"
    assert discord_bp.authorization_url_params["prompt"] == "consent"

def test_blueprint_factory_with_prompt():
    discord_bp = make_discord_blueprint(
        client_id="foo",
        client_secret="bar",
        scope=["identify", "email"],
        redirect_to="index",
        prompt=None,
    )
    assert isinstance(discord_bp, OAuth2ConsumerBlueprint)
    assert discord_bp.session.scope == ["identify", "email"]
    assert discord_bp.session.base_url == "https://discord.com/"
    assert discord_bp.session.client_id == "foo"
    assert discord_bp.client_secret == "bar"
    assert discord_bp.authorization_url == "https://discord.com/api/oauth2/authorize"
    assert discord_bp.token_url == "https://discord.com/api/oauth2/token"
    assert discord_bp.authorization_url_params["prompt"] == None

def test_load_from_config(make_app):
    app = make_app(redirect_to="index")
    app.config["DISCORD_OAUTH_CLIENT_ID"] = "foo"
    app.config["DISCORD_OAUTH_CLIENT_SECRET"] = "bar"

    resp = app.test_client().get("/discord")
    url = resp.headers["Location"]
    client_id = URLObject(url).query.dict.get("client_id")
    assert client_id == "foo"

@responses.activate
def test_context_local(make_app):
    responses.add(responses.GET, "https://google.com")

    # set up two apps with two different set of auth tokens
    app1 = make_app(
        "foo1",
        "bar1",
        redirect_to="url1",
        storage=MemoryStorage({"access_token": "app1"}),
    )
    app2 = make_app(
        "foo2",
        "bar2",
        redirect_to="url2",
        storage=MemoryStorage({"access_token": "app2"}),
        prompt=None,
    )

    # outside of a request context, referencing functions on the `discord` object
    # will raise an exception
    with pytest.raises(RuntimeError):
        discord.get("https://google.com")

    # inside of a request context, `discord` should be a proxy to the correct
    # blueprint session
    with app1.test_request_context("/"):
        app1.preprocess_request()
        discord.get("https://google.com")
        request = responses.calls[0].request
        assert request.headers["Authorization"] == "Bearer app1"

    with app2.test_request_context("/"):
        app2.preprocess_request()
        discord.get("https://google.com")
        request = responses.calls[1].request
        assert request.headers["Authorization"] == "Bearer app2"


text:
module Authentasaurus::Models::Validation
  def self.included(base) # :nodoc:
    base.send :extend, ClassMethods
    base.send :include, InstanceMethods

    base.send :belongs_to, :user, :polymorphic => true

    # Check that everything is there
    base.send :validates_presence_of, :user_id, :validation_code, :user_type, :email
    # Check foreign keys
    base.send :validates_associated, :user
    # Check unique user
    base.send :validates_uniqueness_of, :user_id, :scope => [:user_type, :email]
    base.send :validates_uniqueness_of, :validation_code

    #send email
    base.send :after_create, :send_validation
  end

  module ClassMethods
  end

  module InstanceMethods
    def send_validation
      AuthentasaurusEmailer.deliver_validation_mail(self.user.name, self.email, self.validation_code) if AUTHENTASAURUS[:modules][:validatable][:send_email]
    end
  end
end


text:
import {
  declarationValueIndex,
  isStandardSyntaxFunction,
  matchesStringOrRegExp,
  report,
  ruleMessages,
  validateOptions,
} from "../../utils"
import { isString } from "lodash"
import valueParser from "postcss-value-parser"
import { vendor } from "postcss"

export const ruleName = "function-whitelist"

export const messages = ruleMessages(ruleName, {
  rejected: (name) => `Unexpected function "${name}"`,
})

function rule(whitelistInput) {
  const whitelist = [].concat(whitelistInput)
  return (root, result) => {
    const validOptions = validateOptions(result, ruleName, {
      actual: whitelist,
      possible: [isString],
    })
    if (!validOptions) { return }
    root.walkDecls(decl => {
      const { value } = decl
      valueParser(value).walk(function (node) {
        if (node.type !== "function") { return }
        if (!isStandardSyntaxFunction(node)) { return }
        if (matchesStringOrRegExp(vendor.unprefixed(node.value).toLowerCase(), whitelist)) { return }
        report({
          message: messages.rejected(node.value),
          node: decl,
          index: declarationValueIndex(decl) + node.sourceIndex,
          result,
          ruleName,
        })
      })
    })
  }
}

rule.primaryOptionArray = true

export default rule


text:
#include "util_hack.h"
#include "cuddInt.h"

/*---------------------------------------------------------------------------*/
/* Constant declarations                                                     */
/*---------------------------------------------------------------------------*/

#define DD_MAX_SUBTABLE_SPARSITY 8
#define DD_SHRINK_FACTOR 2

/*---------------------------------------------------------------------------*/
/* Stucture declarations                                                     */
/*---------------------------------------------------------------------------*/

/*---------------------------------------------------------------------------*/
/* Type declarations                                                         */
/*---------------------------------------------------------------------------*/

/*---------------------------------------------------------------------------*/
/* Variable declarations                                                     */
/*---------------------------------------------------------------------------*/

#ifndef lint
static char rcsid[] DD_UNUSED = "$Id: cuddReorder.c,v 1.1.1.1 2003/02/24 22:23:53 wjiang Exp $";
#endif

static	int	*entry;

int	ddTotalNumberSwapping;
#ifdef DD_STATS
int	ddTotalNISwaps;
#endif

/*---------------------------------------------------------------------------*/
/* Macro declarations                                                        */
/*---------------------------------------------------------------------------*/

/**AutomaticStart*************************************************************/

/*---------------------------------------------------------------------------*/
/* Static function prototypes                                                */
/*---------------------------------------------------------------------------*/

static int ddUniqueCompare ARGS((int *ptrX, int *ptrY));
static Move * ddSwapAny ARGS((DdManager *table, int x, int y));
static int ddSiftingAux ARGS((DdManager *table, int x, int xLow, int xHigh));
static Move * ddSiftingUp ARGS((DdManager *table, int y, int xLow));
static Move * ddSiftingDown ARGS((DdManager *table, int x, int xHigh));
static int ddSiftingBackward ARGS((DdManager *table, int size, Move *moves));
static int ddReorderPreprocess ARGS((DdManager *table));
static int ddReorderPostprocess ARGS((DdManager *table));
static int ddShuffle ARGS((DdManager *table, int *permutation));
static int ddSiftUp ARGS((DdManager *table, int x, int xLow));
static void bddFixTree ARGS((DdManager *table, MtrNode *treenode));
static int ddUpdateMtrTree ARGS((DdManager *table, MtrNode *treenode, int *perm, int *invperm));
static int ddCheckPermuation ARGS((DdManager *table, MtrNode *treenode, int *perm, int *invperm));

/**AutomaticEnd***************************************************************/

/*---------------------------------------------------------------------------*/
/* Definition of exported functions                                          */
/*---------------------------------------------------------------------------*/

/**Function********************************************************************

  Synopsis    [Main dynamic reordering routine.]

  Description [Main dynamic reordering routine.
  Calls one of the possible reordering procedures:

Swapping

Sifting

Symmetric Sifting

Group Sifting

Window Permutation

Simulated Annealing

Genetic Algorithm

Dynamic Programming (exact)

  For sifting, symmetric sifting, group sifting, and window
  permutation it is possible to request reordering to convergence.

  The core of all methods is the reordering procedure
  cuddSwapInPlace() which swaps two adjacent variables and is based
  on Rudell's paper.
  Returns 1 in case of success; 0 otherwise. In the case of symmetric
  sifting (with and without convergence) returns 1 plus the number of
  symmetric variables, in case of success.]

  SideEffects [Changes the variable order for all diagrams and clears
  the cache.]

******************************************************************************/
int
Cudd_ReduceHeap(
  DdManager * table /* DD manager */,
  Cudd_ReorderingType heuristic /* method used for reordering */,
  int  minsize /* bound below which no reordering occurs */)
{
    DdHook *hook;
    int	result;
    unsigned int nextDyn;
#ifdef DD_STATS
    unsigned int initialSize;
    unsigned int finalSize;
#endif
    long localTime;

    /* Don't reorder if there are too many dead nodes. */
    if (table->keys - table->dead < (unsigned) minsize)
	return(1);

    if (heuristic == CUDD_REORDER_SAME) {
	heuristic = table->autoMethod;
    }
    if (heuristic == CUDD_REORDER_NONE) {
	return(1);
    }

    /* This call to Cudd_ReduceHeap does initiate reordering. Therefore
    ** we count it.
    */
    table->reorderings++;

    localTime = util_cpu_time();

    /* Run the hook functions. */
    hook = table->preReorderingHook;
    while (hook != NULL) {
	int res = (hook->f)(table, "BDD", (void *)heuristic);
	if (res == 0) return(0);
	hook = hook->next;
    }

    if (!ddReorderPreprocess(table)) return(0);
    ddTotalNumberSwapping = 0;

    if (table->keys > table->peakLiveNodes) {
	table->peakLiveNodes = table->keys;
    }
#ifdef DD_STATS
    initialSize = table->keys - table->isolated;
    ddTotalNISwaps = 0;

    switch(heuristic) {
    case CUDD_REORDER_RANDOM:
    case CUDD_REORDER_RANDOM_PIVOT:
	(void) fprintf(table->out,"#:I_RANDOM  ");
	break;
    case CUDD_REORDER_SIFT:
    case CUDD_REORDER_SIFT_CONVERGE:
    case CUDD_REORDER_SYMM_SIFT:
    case CUDD_REORDER_SYMM_SIFT_CONV:
    case CUDD_REORDER_GROUP_SIFT:
    case CUDD_REORDER_GROUP_SIFT_CONV:
	(void) fprintf(table->out,"#:I_SIFTING ");
	break;
    case CUDD_REORDER_WINDOW2:
    case CUDD_REORDER_WINDOW3:
    case CUDD_REORDER_WINDOW4:
    case CUDD_REORDER_WINDOW2_CONV:
    case CUDD_REORDER_WINDOW3_CONV:
    case CUDD_REORDER_WINDOW4_CONV:
	(void) fprintf(table->out,"#:I_WINDOW  ");
	break;
    case CUDD_REORDER_ANNEALING:
	(void) fprintf(table->out,"#:I_ANNEAL  ");
	break;
    case CUDD_REORDER_GENETIC:
	(void) fprintf(table->out,"#:I_GENETIC ");
	break;
    case CUDD_REORDER_LINEAR:
    case CUDD_REORDER_LINEAR_CONVERGE:
	(void) fprintf(table->out,"#:I_LINSIFT ");
	break;
    case CUDD_REORDER_EXACT:
	(void) fprintf(table->out,"#:I_EXACT   ");
	break;
    default:
	return(0);
    }
    (void) fprintf(table->out,"%8d: initial size",initialSize);
#endif

    /* See if we should use alternate threshold for maximum growth. */
    if (table->reordCycle && table->reorderings % table->reordCycle == 0) {
	double saveGrowth = table->maxGrowth;
	table->maxGrowth = table->maxGrowthAlt;
	result = cuddTreeSifting(table,heuristic);
	table->maxGrowth = saveGrowth;
    } else {
	result = cuddTreeSifting(table,heuristic);
    }

#ifdef DD_STATS
    (void) fprintf(table->out,"\n");
    finalSize = table->keys - table->isolated;
    (void) fprintf(table->out,"#:F_REORDER %8d: final size\n",finalSize);
    (void) fprintf(table->out,"#:T_REORDER %8g: total time (sec)\n",
		   ((double)(util_cpu_time() - localTime)/1000.0));
    (void) fprintf(table->out,"#:N_REORDER %8d: total swaps\n",
		   ddTotalNumberSwapping);
    (void) fprintf(table->out,"#:M_REORDER %8d: NI swaps\n",ddTotalNISwaps);
#endif

    if (result == 0)
	return(0);

    if (!ddReorderPostprocess(table))
	return(0);

    if (table->realign) {
	if (!cuddZddAlignToBdd(table))
	    return(0);
    }

    nextDyn = (table->keys - table->constants.keys + 1) *
	      DD_DYN_RATIO + table->constants.keys;
    if (table->reorderings < 20 || nextDyn > table->nextDyn)
	table->nextDyn = nextDyn;
    else
	table->nextDyn += 20;
    table->reordered = 1;

    /* Run hook functions. */
    hook = table->postReorderingHook;
    while (hook != NULL) {
	int res = (hook->f)(table, "BDD", (void *)localTime);
	if (res == 0) return(0);
	hook = hook->next;
    }
    /* Update cumulative reordering time. */
    table->reordTime += util_cpu_time() - localTime;

    return(result);

} /* end of Cudd_ReduceHeap */

/**Function********************************************************************

  Synopsis    [Reorders variables according to given permutation.]

  Description [Reorders variables according to given permutation.
  The i-th entry of the permutation array contains the index of the variable
  that should be brought to the i-th level.  The size of the array should be
  equal or greater to the number of variables currently in use.
  Returns 1 in case of success; 0 otherwise.]

  SideEffects [Changes the variable order for all diagrams and clears
  the cache.]

  SeeAlso [Cudd_ReduceHeap]

******************************************************************************/
int
Cudd_ShuffleHeap(
  DdManager * table /* DD manager */,
  int * permutation /* required variable permutation */)
{

    int	result;
    int i;
    int identity = 1;
    int *perm;

    /* Don't waste time in case of identity permutation. */
    for (i = 0; i
size; i++) {
	if (permutation[i] != table->invperm[i]) {
	    identity = 0;
	    break;
	}
    }
    if (identity == 1) {
	return(1);
    }
    if (!ddReorderPreprocess(table)) return(0);
    if (table->keys > table->peakLiveNodes) {
	table->peakLiveNodes = table->keys;
    }

    perm = ALLOC(int, table->size);
    for (i = 0; i
size; i++)
	perm[permutation[i]] = i;
    if (!ddCheckPermuation(table,table->tree,perm,permutation)) {
	FREE(perm);
	return(0);
    }
    if (!ddUpdateMtrTree(table,table->tree,perm,permutation)) {
	FREE(perm);
	return(0);
    }
    FREE(perm);

    result = ddShuffle(table,permutation);

    if (!ddReorderPostprocess(table)) return(0);

    return(result);

} /* end of Cudd_ShuffleHeap */

/*---------------------------------------------------------------------------*/
/* Definition of internal functions                                          */
/*---------------------------------------------------------------------------*/

/**Function********************************************************************

  Synopsis    [Dynamically allocates a Node.]

  Description [Dynamically allocates a Node. This procedure is similar
  to cuddAllocNode in Cudd_Table.c, but it does not attempt garbage
  collection, because during reordering there are no dead nodes.
  Returns a pointer to a new node if successful; NULL is memory is
  full.]

  SideEffects [None]

  SeeAlso     [cuddAllocNode]

******************************************************************************/
DdNode *
cuddDynamicAllocNode(
  DdManager * table)
{
    int     i;
    DdNodePtr *mem;
    DdNode *list, *node;
    extern void (*MMoutOfMemory)(long);
    void (*saveHandler)(long);

    if (table->nextFree == NULL) {        /* free list is empty */
	/* Try to allocate a new block. */
	saveHandler = MMoutOfMemory;
	MMoutOfMemory = Cudd_OutOfMem;
	mem = (DdNodePtr *) ALLOC(DdNode, DD_MEM_CHUNK + 1);
	MMoutOfMemory = saveHandler;
	if (mem == NULL && table->stash != NULL) {
	    FREE(table->stash);
	    table->stash = NULL;
	    /* Inhibit resizing of tables. */
	    table->maxCacheHard = table->cacheSlots - 1;
	    table->cacheSlack = -(table->cacheSlots + 1);
	    for (i = 0; i
size; i++) {
		table->subtables[i].maxKeys <<= 2;
	    }
	    mem = (DdNodePtr *) ALLOC(DdNode,DD_MEM_CHUNK + 1);
	}
	if (mem == NULL) {
	    /* Out of luck. Call the default handler to do
	    ** whatever it specifies for a failed malloc.  If this
	    ** handler returns, then set error code, print
	    ** warning, and return. */
	    (*MMoutOfMemory)(sizeof(DdNode)*(DD_MEM_CHUNK + 1));
	    table->errorCode = CUDD_MEMORY_OUT;
#ifdef DD_VERBOSE
	    (void) fprintf(table->err,
			   "cuddDynamicAllocNode: out of memory");
	    (void) fprintf(table->err,"Memory in use = %ld\n",
			   table->memused);
#endif
	    return(NULL);
	} else {	/* successful allocation; slice memory */
	    unsigned long offset;
	    table->memused += (DD_MEM_CHUNK + 1) * sizeof(DdNode);
	    mem[0] = (DdNode *) table->memoryList;
	    table->memoryList = mem;

	    /* Here we rely on the fact that the size of a DdNode is a
	    ** power of 2 and a multiple of the size of a pointer.
	    ** If we align one node, all the others will be aligned
	    ** as well. */
	    offset = (unsigned long) mem & (sizeof(DdNode) - 1);
	    mem += (sizeof(DdNode) - offset) / sizeof(DdNodePtr);
#ifdef DD_DEBUG
	    assert(((unsigned long) mem & (sizeof(DdNode) - 1)) == 0);
#endif
	    list = (DdNode *) mem;

	    i = 1;
	    do {
		list[i - 1].next = &list[i];
	    } while (++i < DD_MEM_CHUNK);

	    list[DD_MEM_CHUNK - 1].next = NULL;

	    table->nextFree = &list[0];
	}
    } /* if free list empty */

    node = table->nextFree;
    table->nextFree = node->next;
    return (node);

} /* end of cuddDynamicAllocNode */

/**Function********************************************************************

  Synopsis    [Implementation of Rudell's sifting algorithm.]

  Description [Implementation of Rudell's sifting algorithm.
  Assumes that no dead nodes are present.

 Order all the variables according to the number of entries
    in each unique table.

 Sift the variable up and down, remembering each time the
    total size of the DD heap.

 Select the best permutation.

 Repeat 3 and 4 for all variables.

  Returns 1 if successful; 0 otherwise.]

  SideEffects [None]

******************************************************************************/
int
cuddSifting(
  DdManager * table,
  int  lower,
  int  upper)
{
    int	i;
    int	*var;
    int	size;
    int	x;
    int	result;
#ifdef DD_STATS
    int	previousSize;
#endif

    size = table->size;

    /* Find order in which to sift variables. */
    var = NULL;
    entry = ALLOC(int,size);
    if (entry == NULL) {
	table->errorCode = CUDD_MEMORY_OUT;
	goto cuddSiftingOutOfMem;
    }
    var = ALLOC(int,size);
    if (var == NULL) {
	table->errorCode = CUDD_MEMORY_OUT;
	goto cuddSiftingOutOfMem;
    }

    for (i = 0; i < size; i++) {
	x = table->perm[i];
	entry[i] = table->subtables[x].keys;
	var[i] = i;
    }

    qsort((void *)var,size,sizeof(int),(int (*)(const void *, const void *))ddUniqueCompare);

    /* Now sift. */
    for (i = 0; i < ddMin(table->siftMaxVar,size); i++) {
	if (ddTotalNumberSwapping >= table->siftMaxSwap)
	    break;
	x = table->perm[var[i]];

	if (x < lower || x > upper || table->subtables[x].bindVar == 1)
	    continue;
#ifdef DD_STATS
	previousSize = table->keys - table->isolated;
#endif
	result = ddSiftingAux(table, x, lower, upper);
	if (!result) goto cuddSiftingOutOfMem;
#ifdef DD_STATS
	if (table->keys < (unsigned) previousSize + table->isolated) {
	    (void) fprintf(table->out,"-");
	} else if (table->keys > (unsigned) previousSize + table->isolated) {
	    (void) fprintf(table->out,"+");	/* should never happen */
	    (void) fprintf(table->err,"\nSize increased from %d to %d while sifting variable %d\n", previousSize, table->keys - table->isolated, var[i]);
	} else {
	    (void) fprintf(table->out,"=");
	}
	fflush(table->out);
#endif
    }

    FREE(var);
    FREE(entry);

    return(1);

cuddSiftingOutOfMem:

    if (entry != NULL) FREE(entry);
    if (var != NULL) FREE(var);

    return(0);

} /* end of cuddSifting */

/**Function********************************************************************

  Synopsis    [Reorders variables by a sequence of (non-adjacent) swaps.]

  Description [Implementation of Plessier's algorithm that reorders
  variables by a sequence of (non-adjacent) swaps.

 Select two variables (RANDOM or HEURISTIC).

 Permute these variables.

 If the nodes have decreased accept the permutation.

 Otherwise reconstruct the original heap.

 Loop.

  Returns 1 in case of success; 0 otherwise.]

  SideEffects [None]

******************************************************************************/
int
cuddSwapping(
  DdManager * table,
  int lower,
  int upper,
  Cudd_ReorderingType heuristic)
{
    int	i, j;
    int	max, keys;
    int	nvars;
    int	x, y;
    int	iterate;
    int previousSize;
    Move *moves, *move;
    int	pivot;
    int	modulo;
    int result;

#ifdef DD_DEBUG
    /* Sanity check */
    assert(lower >= 0 && upper
size && lower <= upper);
#endif

    nvars = upper - lower + 1;
    iterate = nvars;

    for (i = 0; i < iterate; i++) {
	if (ddTotalNumberSwapping >= table->siftMaxSwap)
	    break;
	if (heuristic == CUDD_REORDER_RANDOM_PIVOT) {
	    max = -1;
	    for (j = lower; j <= upper; j++) {
		if ((keys = table->subtables[j].keys) > max) {
		    max = keys;
		    pivot = j;
		}
	    }

	    modulo = upper - pivot;
	    if (modulo == 0) {
		y = pivot;
	    } else{
		y = pivot + 1 + ((int) Cudd_Random() % modulo);
	    }

	    modulo = pivot - lower - 1;
	    if (modulo < 1) {
		x = lower;
	    } else{
		do {
		    x = (int) Cudd_Random() % modulo;
		} while (x == y);
	    }
	} else {
	    x = ((int) Cudd_Random() % nvars) + lower;
	    do {
		y = ((int) Cudd_Random() % nvars) + lower;
	    } while (x == y);
	}
	previousSize = table->keys - table->isolated;
	moves = ddSwapAny(table,x,y);
	if (moves == NULL) goto cuddSwappingOutOfMem;
	result = ddSiftingBackward(table,previousSize,moves);
	if (!result) goto cuddSwappingOutOfMem;
	while (moves != NULL) {
	    move = moves->next;
	    cuddDeallocNode(table, (DdNode *) moves);
	    moves = move;
	}
#ifdef DD_STATS
	if (table->keys < (unsigned) previousSize + table->isolated) {
	    (void) fprintf(table->out,"-");
	} else if (table->keys > (unsigned) previousSize + table->isolated) {
	    (void) fprintf(table->out,"+");	/* should never happen */
	} else {
	    (void) fprintf(table->out,"=");
	}
	fflush(table->out);
#endif
#if 0
	(void) fprintf(table->out,"#:t_SWAPPING %8d: tmp size\n",
		       table->keys - table->isolated);
#endif
    }

    return(1);

cuddSwappingOutOfMem:
    while (moves != NULL) {
	move = moves->next;
	cuddDeallocNode(table, (DdNode *) moves);
	moves = move;
    }

    return(0);

} /* end of cuddSwapping */

/**Function********************************************************************

  Synopsis    [Finds the next subtable with a larger index.]

  Description [Finds the next subtable with a larger index. Returns the
  index.]

  SideEffects [None]

  SeeAlso     [cuddNextLow]

******************************************************************************/
int
cuddNextHigh(
  DdManager * table,
  int  x)
{
    return(x+1);

} /* end of cuddNextHigh */

/**Function********************************************************************

  Synopsis    [Finds the next subtable with a smaller index.]

  Description [Finds the next subtable with a smaller index. Returns the
  index.]

  SideEffects [None]

  SeeAlso     [cuddNextHigh]

******************************************************************************/
int
cuddNextLow(
  DdManager * table,
  int  x)
{
    return(x-1);

} /* end of cuddNextLow */

/**Function********************************************************************

  Synopsis    [Swaps two adjacent variables.]

  Description [Swaps two adjacent variables. It assumes that no dead
  nodes are present on entry to this procedure.  The procedure then
  guarantees that no dead nodes will be present when it terminates.
  cuddSwapInPlace assumes that x < y.  Returns the number of keys in
  the table if successful; 0 otherwise.]

  SideEffects [None]

******************************************************************************/
int
cuddSwapInPlace(
  DdManager * table,
  int  x,
  int  y)
{
    DdNodePtr *xlist, *ylist;
    int    xindex, yindex;
    int    xslots, yslots;
    int    xshift, yshift;
    int    oldxkeys, oldykeys;
    int    newxkeys, newykeys;
    int    comple, newcomplement;
    int    i;
    Cudd_VariableType varType;
    Cudd_LazyGroupType groupType;
    int    posn;
    int    isolated;
    DdNode *f,*f0,*f1,*f01,*f00,*f11,*f10,*newf1,*newf0;
    DdNode *g,*next;
    DdNodePtr *previousP;
    DdNode *tmp;
    DdNode *sentinel = &(table->sentinel);
    extern void (*MMoutOfMemory)(long);
    void (*saveHandler)(long);

#if DD_DEBUG
    int    count,idcheck;
#endif

#ifdef DD_DEBUG
    assert(x < y);
    assert(cuddNextHigh(table,x) == y);
    assert(table->subtables[x].keys != 0);
    assert(table->subtables[y].keys != 0);
    assert(table->subtables[x].dead == 0);
    assert(table->subtables[y].dead == 0);
#endif

    ddTotalNumberSwapping++;

    /* Get parameters of x subtable. */
    xindex = table->invperm[x];
    xlist = table->subtables[x].nodelist;
    oldxkeys = table->subtables[x].keys;
    xslots = table->subtables[x].slots;
    xshift = table->subtables[x].shift;

    /* Get parameters of y subtable. */
    yindex = table->invperm[y];
    ylist = table->subtables[y].nodelist;
    oldykeys = table->subtables[y].keys;
    yslots = table->subtables[y].slots;
    yshift = table->subtables[y].shift;

    if (!cuddTestInteract(table,xindex,yindex)) {
#ifdef DD_STATS
	ddTotalNISwaps++;
#endif
	newxkeys = oldxkeys;
	newykeys = oldykeys;
    } else {
	newxkeys = 0;
	newykeys = oldykeys;

	/* Check whether the two projection functions involved in this
	** swap are isolated. At the end, we'll be able to tell how many
	** isolated projection functions are there by checking only these
	** two functions again. This is done to eliminate the isolated
	** projection functions from the node count.
	*/
	isolated = - ((table->vars[xindex]->ref == 1) +
		     (table->vars[yindex]->ref == 1));

	/* The nodes in the x layer that do not depend on
	** y will stay there; the others are put in a chain.
	** The chain is handled as a LIFO; g points to the beginning.
	*/
	g = NULL;
	if ((oldxkeys >= xslots || (unsigned) xslots == table->initSlots) &&
	    oldxkeys <= DD_MAX_SUBTABLE_DENSITY * xslots) {
	    for (i = 0; i < xslots; i++) {
		previousP = &(xlist[i]);
		f = *previousP;
		while (f != sentinel) {
		    next = f->next;
		    f1 = cuddT(f); f0 = cuddE(f);
		    if (f1->index != (DdHalfWord) yindex &&
			Cudd_Regular(f0)->index != (DdHalfWord) yindex) {
			/* stays */
			newxkeys++;
			*previousP = f;
			previousP = &(f->next);
		    } else {
			f->index = yindex;
			f->next = g;
			g = f;
		    }
		    f = next;
		} /* while there are elements in the collision chain */
		*previousP = sentinel;
	    } /* for each slot of the x subtable */
	} else {		/* resize xlist */
	    DdNode *h = NULL;
	    DdNodePtr *newxlist;
	    unsigned int newxslots;
	    int newxshift;
	    /* Empty current xlist. Nodes that stay go to list h;
	    ** nodes that move go to list g. */
	    for (i = 0; i < xslots; i++) {
		f = xlist[i];
		while (f != sentinel) {
		    next = f->next;
		    f1 = cuddT(f); f0 = cuddE(f);
		    if (f1->index != (DdHalfWord) yindex &&
			Cudd_Regular(f0)->index != (DdHalfWord) yindex) {
			/* stays */
			f->next = h;
			h = f;
			newxkeys++;
		    } else {
			f->index = yindex;
			f->next = g;
			g = f;
		    }
		    f = next;
		} /* while there are elements in the collision chain */
	    } /* for each slot of the x subtable */
	    /* Decide size of new subtable. */
	    if (oldxkeys > DD_MAX_SUBTABLE_DENSITY * xslots) {
		newxshift = xshift - 1;
		newxslots = xslots << 1;
	    } else {
		newxshift = xshift + 1;
		newxslots = xslots >> 1;
	    }
	    /* Try to allocate new table. Be ready to back off. */
	    saveHandler = MMoutOfMemory;
	    MMoutOfMemory = Cudd_OutOfMem;
	    newxlist = ALLOC(DdNodePtr, newxslots);
	    MMoutOfMemory = saveHandler;
	    if (newxlist == NULL) {
		(void) fprintf(table->err, "Unable to resize subtable %d for lack of memory\n", i);
		newxlist = xlist;
		newxslots = xslots;
		newxshift = xshift;
	    } else {
		table->slots += (newxslots - xslots);
		table->minDead = (unsigned)
		    (table->gcFrac * (double) table->slots);
		table->cacheSlack = (int)
		    ddMin(table->maxCacheHard, DD_MAX_CACHE_TO_SLOTS_RATIO
			  * table->slots) - 2 * (int) table->cacheSlots;
		table->memused += (newxslots - xslots) * sizeof(DdNodePtr);
		FREE(xlist);
		xslots =  newxslots;
		xshift = newxshift;
		xlist = newxlist;
	    }
	    /* Initialize new subtable. */
	    for (i = 0; i < xslots; i++) {
		xlist[i] = sentinel;
	    }
	    /* Move nodes that were parked in list h to their new home. */
	    f = h;
	    while (f != NULL) {
		next = f->next;
		f1 = cuddT(f);
		f0 = cuddE(f);
		/* Check xlist for pair (f11,f01). */
		posn = ddHash(f1, f0, xshift);
		/* For each element tmp in collision list xlist[posn]. */
		previousP = &(xlist[posn]);
		tmp = *previousP;
		while (f1 < cuddT(tmp)) {
		    previousP = &(tmp->next);
		    tmp = *previousP;
		}
		while (f1 == cuddT(tmp) && f0 < cuddE(tmp)) {
		    previousP = &(tmp->next);
		    tmp = *previousP;
		}
		f->next = *previousP;
		*previousP = f;
		f = next;
	    }
	}

#ifdef DD_COUNT
	table->swapSteps += oldxkeys - newxkeys;
#endif
	/* Take care of the x nodes that must be re-expressed.
	** They form a linked list pointed by g. Their index has been
	** already changed to yindex.
	*/
	f = g;
	while (f != NULL) {
	    next = f->next;
	    /* Find f1, f0, f11, f10, f01, f00. */
	    f1 = cuddT(f);
#ifdef DD_DEBUG
	    assert(!(Cudd_IsComplement(f1)));
#endif
	    if ((int) f1->index == yindex) {
		f11 = cuddT(f1); f10 = cuddE(f1);
	    } else {
		f11 = f10 = f1;
	    }
#ifdef DD_DEBUG
	    assert(!(Cudd_IsComplement(f11)));
#endif
	    f0 = cuddE(f);
	    comple = Cudd_IsComplement(f0);
	    f0 = Cudd_Regular(f0);
	    if ((int) f0->index == yindex) {
		f01 = cuddT(f0); f00 = cuddE(f0);
	    } else {
		f01 = f00 = f0;
	    }
	    if (comple) {
		f01 = Cudd_Not(f01);
		f00 = Cudd_Not(f00);
	    }
	    /* Decrease ref count of f1. */
	    cuddSatDec(f1->ref);
	    /* Create the new T child. */
	    if (f11 == f01) {
		newf1 = f11;
		cuddSatInc(newf1->ref);
	    } else {
		/* Check xlist for triple (xindex,f11,f01). */
		posn = ddHash(f11, f01, xshift);
		/* For each element newf1 in collision list xlist[posn]. */
		previousP = &(xlist[posn]);
		newf1 = *previousP;
		while (f11 < cuddT(newf1)) {
		    previousP = &(newf1->next);
		    newf1 = *previousP;
		}
		while (f11 == cuddT(newf1) && f01 < cuddE(newf1)) {
		    previousP = &(newf1->next);
		    newf1 = *previousP;
		}
		if (cuddT(newf1) == f11 && cuddE(newf1) == f01) {
		    cuddSatInc(newf1->ref);
		} else { /* no match */
		    newf1 = cuddDynamicAllocNode(table);
		    if (newf1 == NULL)
			goto cuddSwapOutOfMem;
		    newf1->index = xindex; newf1->ref = 1;
		    cuddT(newf1) = f11;
		    cuddE(newf1) = f01;
		    /* Insert newf1 in the collision list xlist[posn];
		    ** increase the ref counts of f11 and f01.
		    */
		    newxkeys++;
		    newf1->next = *previousP;
		    *previousP = newf1;
		    cuddSatInc(f11->ref);
		    tmp = Cudd_Regular(f01);
		    cuddSatInc(tmp->ref);
		}
	    }
	    cuddT(f) = newf1;
#ifdef DD_DEBUG
	    assert(!(Cudd_IsComplement(newf1)));
#endif

	    /* Do the same for f0, keeping complement dots into account. */
	    /* Decrease ref count of f0. */
	    tmp = Cudd_Regular(f0);
	    cuddSatDec(tmp->ref);
	    /* Create the new E child. */
	    if (f10 == f00) {
		newf0 = f00;
		tmp = Cudd_Regular(newf0);
		cuddSatInc(tmp->ref);
	    } else {
		/* make sure f10 is regular */
		newcomplement = Cudd_IsComplement(f10);
		if (newcomplement) {
		    f10 = Cudd_Not(f10);
		    f00 = Cudd_Not(f00);
		}
		/* Check xlist for triple (xindex,f10,f00). */
		posn = ddHash(f10, f00, xshift);
		/* For each element newf0 in collision list xlist[posn]. */
		previousP = &(xlist[posn]);
		newf0 = *previousP;
		while (f10 < cuddT(newf0)) {
		    previousP = &(newf0->next);
		    newf0 = *previousP;
		}
		while (f10 == cuddT(newf0) && f00 < cuddE(newf0)) {
		    previousP = &(newf0->next);
		    newf0 = *previousP;
		}
		if (cuddT(newf0) == f10 && cuddE(newf0) == f00) {
		    cuddSatInc(newf0->ref);
		} else { /* no match */
		    newf0 = cuddDynamicAllocNode(table);
		    if (newf0 == NULL)
			goto cuddSwapOutOfMem;
		    newf0->index = xindex; newf0->ref = 1;
		    cuddT(newf0) = f10;
		    cuddE(newf0) = f00;
		    /* Insert newf0 in the collision list xlist[posn];
		    ** increase the ref counts of f10 and f00.
		    */
		    newxkeys++;
		    newf0->next = *previousP;
		    *previousP = newf0;
		    cuddSatInc(f10->ref);
		    tmp = Cudd_Regular(f00);
		    cuddSatInc(tmp->ref);
		}
		if (newcomplement) {
		    newf0 = Cudd_Not(newf0);
		}
	    }
	    cuddE(f) = newf0;

	    /* Insert the modified f in ylist.
	    ** The modified f does not already exists in ylist.
	    ** (Because of the uniqueness of the cofactors.)
	    */
	    posn = ddHash(newf1, newf0, yshift);
	    newykeys++;
	    previousP = &(ylist[posn]);
	    tmp = *previousP;
	    while (newf1 < cuddT(tmp)) {
		previousP = &(tmp->next);
		tmp = *previousP;
	    }
	    while (newf1 == cuddT(tmp) && newf0 < cuddE(tmp)) {
		previousP = &(tmp->next);
		tmp = *previousP;
	    }
	    f->next = *previousP;
	    *previousP = f;
	    f = next;
	} /* while f != NULL */

	/* GC the y layer. */

	/* For each node f in ylist. */
	for (i = 0; i < yslots; i++) {
	    previousP = &(ylist[i]);
	    f = *previousP;
	    while (f != sentinel) {
		next = f->next;
		if (f->ref == 0) {
		    tmp = cuddT(f);
		    cuddSatDec(tmp->ref);
		    tmp = Cudd_Regular(cuddE(f));
		    cuddSatDec(tmp->ref);
		    cuddDeallocNode(table,f);
		    newykeys--;
		} else {
		    *previousP = f;
		    previousP = &(f->next);
		}
		f = next;
	    } /* while f */
	    *previousP = sentinel;
	} /* for i */

#if DD_DEBUG
#if 0
	(void) fprintf(table->out,"Swapping %d and %d\n",x,y);
#endif
	count = 0;
	idcheck = 0;
	for (i = 0; i < yslots; i++) {
	    f = ylist[i];
	    while (f != sentinel) {
		count++;
		if (f->index != (DdHalfWord) yindex)
		    idcheck++;
		f = f->next;
	    }
	}
	if (count != newykeys) {
	    (void) fprintf(table->out,
			   "Error in finding newykeys\toldykeys = %d\tnewykeys = %d\tactual = %d\n",
			   oldykeys,newykeys,count);
	}
	if (idcheck != 0)
	    (void) fprintf(table->out,
			   "Error in id's of ylist\twrong id's = %d\n",
			   idcheck);
	count = 0;
	idcheck = 0;
	for (i = 0; i < xslots; i++) {
	    f = xlist[i];
	    while (f != sentinel) {
		count++;
		if (f->index != (DdHalfWord) xindex)
		    idcheck++;
		f = f->next;
	    }
	}
	if (count != newxkeys) {
	    (void) fprintf(table->out,
			   "Error in finding newxkeys\toldxkeys = %d \tnewxkeys = %d \tactual = %d\n",
			   oldxkeys,newxkeys,count);
	}
	if (idcheck != 0)
	    (void) fprintf(table->out,
			   "Error in id's of xlist\twrong id's = %d\n",
			   idcheck);
#endif

	isolated += (table->vars[xindex]->ref == 1) +
		    (table->vars[yindex]->ref == 1);
	table->isolated += isolated;
    }

    /* Set the appropriate fields in table. */
    table->subtables[x].nodelist = ylist;
    table->subtables[x].slots = yslots;
    table->subtables[x].shift = yshift;
    table->subtables[x].keys = newykeys;
    table->subtables[x].maxKeys = yslots * DD_MAX_SUBTABLE_DENSITY;
    i = table->subtables[x].bindVar;
    table->subtables[x].bindVar = table->subtables[y].bindVar;
    table->subtables[y].bindVar = i;
    /* Adjust filds for lazy sifting. */
    varType = table->subtables[x].varType;
    table->subtables[x].varType = table->subtables[y].varType;
    table->subtables[y].varType = varType;
    i = table->subtables[x].pairIndex;
    table->subtables[x].pairIndex = table->subtables[y].pairIndex;
    table->subtables[y].pairIndex = i;
    i = table->subtables[x].varHandled;
    table->subtables[x].varHandled = table->subtables[y].varHandled;
    table->subtables[y].varHandled = i;
    groupType = table->subtables[x].varToBeGrouped;
    table->subtables[x].varToBeGrouped = table->subtables[y].varToBeGrouped;
    table->subtables[y].varToBeGrouped = groupType;

    table->subtables[y].nodelist = xlist;
    table->subtables[y].slots = xslots;
    table->subtables[y].shift = xshift;
    table->subtables[y].keys = newxkeys;
    table->subtables[y].maxKeys = xslots * DD_MAX_SUBTABLE_DENSITY;

    table->perm[xindex] = y; table->perm[yindex] = x;
    table->invperm[x] = yindex; table->invperm[y] = xindex;

    table->keys += newxkeys + newykeys - oldxkeys - oldykeys;

    return(table->keys - table->isolated);

cuddSwapOutOfMem:
    (void) fprintf(table->err,"Error: cuddSwapInPlace out of memory\n");

    return (0);

} /* end of cuddSwapInPlace */

/**Function********************************************************************

  Synopsis    [Reorders BDD variables according to the order of the ZDD
  variables.]

  Description [Reorders BDD variables according to the order of the
  ZDD variables. This function can be called at the end of ZDD
  reordering to insure that the order of the BDD variables is
  consistent with the order of the ZDD variables. The number of ZDD
  variables must be a multiple of the number of BDD variables. Let
  M be the ratio of the two numbers. cuddBddAlignToZdd
  then considers the ZDD variables from M*i to
  (M+1)*i-1 as corresponding to BDD variable
  i.  This function should be normally called from
  Cudd_zddReduceHeap, which clears the cache.  Returns 1 in case of
  success; 0 otherwise.]

  SideEffects [Changes the BDD variable order for all diagrams and performs
  garbage collection of the BDD unique table.]

  SeeAlso [Cudd_ShuffleHeap Cudd_zddReduceHeap]

******************************************************************************/
int
cuddBddAlignToZdd(
  DdManager * table /* DD manager */)
{
    int *invperm;		/* permutation array */
    int M;			/* ratio of ZDD variables to BDD variables */
    int i;			/* loop index */
    int result;			/* return value */

    /* We assume that a ratio of 0 is OK. */
    if (table->size == 0)
	return(1);

    M = table->sizeZ / table->size;
    /* Check whether the number of ZDD variables is a multiple of the
    ** number of BDD variables.
    */
    if (M * table->size != table->sizeZ)
	return(0);
    /* Create and initialize the inverse permutation array. */
    invperm = ALLOC(int,table->size);
    if (invperm == NULL) {
	table->errorCode = CUDD_MEMORY_OUT;
	return(0);
    }
    for (i = 0; i
sizeZ; i += M) {
	int indexZ = table->invpermZ[i];
	int index  = indexZ / M;
	invperm[i / M] = index;
    }
    /* Eliminate dead nodes. Do not scan the cache again, because we
    ** assume that Cudd_zddReduceHeap has already cleared it.
    */
    cuddGarbageCollect(table,0);

    /* Initialize number of isolated projection functions. */
    table->isolated = 0;
    for (i = 0; i
size; i++) {
	if (table->vars[i]->ref == 1) table->isolated++;
    }

    /* Initialize the interaction matrix. */
    result = cuddInitInteract(table);
    if (result == 0) return(0);

    result = ddShuffle(table, invperm);
    FREE(invperm);
    /* Free interaction matrix. */
    FREE(table->interact);
    /* Fix the BDD variable group tree. */
    bddFixTree(table,table->tree);
    return(result);

} /* end of cuddBddAlignToZdd */

/*---------------------------------------------------------------------------*/
/* Definition of static functions                                            */
/*---------------------------------------------------------------------------*/

/**Function********************************************************************

  Synopsis    [Comparison function used by qsort.]

  Description [Comparison function used by qsort to order the
  variables according to the number of keys in the subtables.
  Returns the difference in number of keys between the two
  variables being compared.]

  SideEffects [None]

******************************************************************************/
static int
ddUniqueCompare(
  int * ptrX,
  int * ptrY)
{
#if 0
    if (entry[*ptrY] == entry[*ptrX]) {
	return((*ptrX) - (*ptrY));
    }
#endif
    return(entry[*ptrY] - entry[*ptrX]);

} /* end of ddUniqueCompare */

/**Function********************************************************************

  Synopsis    [Swaps any two variables.]

  Description [Swaps any two variables. Returns the set of moves.]

  SideEffects [None]

******************************************************************************/
static Move *
ddSwapAny(
  DdManager * table,
  int  x,
  int  y)
{
    Move	*move, *moves;
    int		xRef,yRef;
    int		xNext,yNext;
    int		size;
    int		limitSize;
    int		tmp;

    if (x >y) {
	tmp = x; x = y; y = tmp;
    }

    xRef = x; yRef = y;

    xNext = cuddNextHigh(table,x);
    yNext = cuddNextLow(table,y);
    moves = NULL;
    limitSize = table->keys - table->isolated;

    for (;;) {
	if ( xNext == yNext) {
	    size = cuddSwapInPlace(table,x,xNext);
	    if (size == 0) goto ddSwapAnyOutOfMem;
	    move = (Move *) cuddDynamicAllocNode(table);
	    if (move == NULL) goto ddSwapAnyOutOfMem;
	    move->x = x;
	    move->y = xNext;
	    move->size = size;
	    move->next = moves;
	    moves = move;

	    size = cuddSwapInPlace(table,yNext,y);
	    if (size == 0) goto ddSwapAnyOutOfMem;
	    move = (Move *) cuddDynamicAllocNode(table);
	    if (move == NULL) goto ddSwapAnyOutOfMem;
	    move->x = yNext;
	    move->y = y;
	    move->size = size;
	    move->next = moves;
	    moves = move;

	    size = cuddSwapInPlace(table,x,xNext);
	    if (size == 0) goto ddSwapAnyOutOfMem;
	    move = (Move *) cuddDynamicAllocNode(table);
	    if (move == NULL) goto ddSwapAnyOutOfMem;
	    move->x = x;
	    move->y = xNext;
	    move->size = size;
	    move->next = moves;
	    moves = move;

	    tmp = x; x = y; y = tmp;

	} else if (x == yNext) {

	    size = cuddSwapInPlace(table,x,xNext);
	    if (size == 0) goto ddSwapAnyOutOfMem;
	    move = (Move *) cuddDynamicAllocNode(table);
	    if (move == NULL) goto ddSwapAnyOutOfMem;
	    move->x = x;
	    move->y = xNext;
	    move->size = size;
	    move->next = moves;
	    moves = move;

	    tmp = x; x = y; y = tmp;

	} else {
	    size = cuddSwapInPlace(table,x,xNext);
	    if (size == 0) goto ddSwapAnyOutOfMem;
	    move = (Move *) cuddDynamicAllocNode(table);
	    if (move == NULL) goto ddSwapAnyOutOfMem;
	    move->x = x;
	    move->y = xNext;
	    move->size = size;
	    move->next = moves;
	    moves = move;

	    size = cuddSwapInPlace(table,yNext,y);
	    if (size == 0) goto ddSwapAnyOutOfMem;
	    move = (Move *) cuddDynamicAllocNode(table);
	    if (move == NULL) goto ddSwapAnyOutOfMem;
	    move->x = yNext;
	    move->y = y;
	    move->size = size;
	    move->next = moves;
	    moves = move;

	    x = xNext;
	    y = yNext;
	}

	xNext = cuddNextHigh(table,x);
	yNext = cuddNextLow(table,y);
	if (xNext > yRef) break;

	if ((double) size > table->maxGrowth * (double) limitSize) break;
	if (size < limitSize) limitSize = size;
    }
    if (yNext>=xRef) {
	size = cuddSwapInPlace(table,yNext,y);
	if (size == 0) goto ddSwapAnyOutOfMem;
	move = (Move *) cuddDynamicAllocNode(table);
	if (move == NULL) goto ddSwapAnyOutOfMem;
	move->x = yNext;
	move->y = y;
	move->size = size;
	move->next = moves;
	moves = move;
    }

    return(moves);

ddSwapAnyOutOfMem:
    while (moves != NULL) {
	move = moves->next;
	cuddDeallocNode(table, (DdNode *) moves);
	moves = move;
    }
    return(NULL);

} /* end of ddSwapAny */

/**Function********************************************************************

  Synopsis    [Given xLow <= x <= xHigh moves x up and down between the
  boundaries.]

  Description [Given xLow <= x <= xHigh moves x up and down between the
  boundaries. Finds the best position and does the required changes.
  Returns 1 if successful; 0 otherwise.]

  SideEffects [None]

******************************************************************************/
static int
ddSiftingAux(
  DdManager * table,
  int  x,
  int  xLow,
  int  xHigh)
{

    Move	*move;
    Move	*moveUp;		/* list of up moves */
    Move	*moveDown;		/* list of down moves */
    int		initialSize;
    int		result;

    initialSize = table->keys - table->isolated;

    moveDown = NULL;
    moveUp = NULL;

    if (x == xLow) {
	moveDown = ddSiftingDown(table,x,xHigh);
	/* At this point x --> xHigh unless bounding occurred. */
	if (moveDown == (Move *) CUDD_OUT_OF_MEM) goto ddSiftingAuxOutOfMem;
	/* Move backward and stop at best position. */
	result = ddSiftingBackward(table,initialSize,moveDown);
	if (!result) goto ddSiftingAuxOutOfMem;

    } else if (x == xHigh) {
	moveUp = ddSiftingUp(table,x,xLow);
	/* At this point x --> xLow unless bounding occurred. */
	if (moveUp == (Move *) CUDD_OUT_OF_MEM) goto ddSiftingAuxOutOfMem;
	/* Move backward and stop at best position. */
	result = ddSiftingBackward(table,initialSize,moveUp);
	if (!result) goto ddSiftingAuxOutOfMem;

    } else if ((x - xLow) > (xHigh - x)) { /* must go down first: shorter */
	moveDown = ddSiftingDown(table,x,xHigh);
	/* At this point x --> xHigh unless bounding occurred. */
	if (moveDown == (Move *) CUDD_OUT_OF_MEM) goto ddSiftingAuxOutOfMem;
	if (moveDown != NULL) {
	    x = moveDown->y;
	}
	moveUp = ddSiftingUp(table,x,xLow);
	if (moveUp == (Move *) CUDD_OUT_OF_MEM) goto ddSiftingAuxOutOfMem;
	/* Move backward and stop at best position */
	result = ddSiftingBackward(table,initialSize,moveUp);
	if (!result) goto ddSiftingAuxOutOfMem;

    } else { /* must go up first: shorter */
	moveUp = ddSiftingUp(table,x,xLow);
	/* At this point x --> xLow unless bounding occurred. */
	if (moveUp == (Move *) CUDD_OUT_OF_MEM) goto ddSiftingAuxOutOfMem;
	if (moveUp != NULL) {
	    x = moveUp->x;
	}
	moveDown = ddSiftingDown(table,x,xHigh);
	if (moveDown == (Move *) CUDD_OUT_OF_MEM) goto ddSiftingAuxOutOfMem;
	/* Move backward and stop at best position. */
	result = ddSiftingBackward(table,initialSize,moveDown);
	if (!result) goto ddSiftingAuxOutOfMem;
    }

    while (moveDown != NULL) {
	move = moveDown->next;
	cuddDeallocNode(table, (DdNode *) moveDown);
	moveDown = move;
    }
    while (moveUp != NULL) {
	move = moveUp->next;
	cuddDeallocNode(table, (DdNode *) moveUp);
	moveUp = move;
    }

    return(1);

ddSiftingAuxOutOfMem:
    if (moveDown != (Move *) CUDD_OUT_OF_MEM) {
	while (moveDown != NULL) {
	    move = moveDown->next;
	    cuddDeallocNode(table, (DdNode *) moveDown);
	    moveDown = move;
	}
    }
    if (moveUp != (Move *) CUDD_OUT_OF_MEM) {
	while (moveUp != NULL) {
	    move = moveUp->next;
	    cuddDeallocNode(table, (DdNode *) moveUp);
	    moveUp = move;
	}
    }

    return(0);

} /* end of ddSiftingAux */

/**Function********************************************************************

  Synopsis    [Sifts a variable up.]

  Description [Sifts a variable up. Moves y up until either it reaches
  the bound (xLow) or the size of the DD heap increases too much.
  Returns the set of moves in case of success; NULL if memory is full.]

  SideEffects [None]

******************************************************************************/
static Move *
ddSiftingUp(
  DdManager * table,
  int  y,
  int  xLow)
{
    Move	*moves;
    Move	*move;
    int		x;
    int		size;
    int		limitSize;
    int		xindex, yindex;
    int		isolated;
    int		L;	/* lower bound on DD size */
#ifdef DD_DEBUG
    int checkL;
    int z;
    int zindex;
#endif

    moves = NULL;
    yindex = table->invperm[y];

    /* Initialize the lower bound.
    ** The part of the DD below y will not change.
    ** The part of the DD above y that does not interact with y will not
    ** change. The rest may vanish in the best case, except for
    ** the nodes at level xLow, which will not vanish, regardless.
    */
    limitSize = L = table->keys - table->isolated;
    for (x = xLow + 1; x < y; x++) {
	xindex = table->invperm[x];
	if (cuddTestInteract(table,xindex,yindex)) {
	    isolated = table->vars[xindex]->ref == 1;
	    L -= table->subtables[x].keys - isolated;
	}
    }
    isolated = table->vars[yindex]->ref == 1;
    L -= table->subtables[y].keys - isolated;

    x = cuddNextLow(table,y);
    while (x >= xLow && L <= limitSize) {
	xindex = table->invperm[x];
#ifdef DD_DEBUG
	checkL = table->keys - table->isolated;
	for (z = xLow + 1; z < y; z++) {
	    zindex = table->invperm[z];
	    if (cuddTestInteract(table,zindex,yindex)) {
		isolated = table->vars[zindex]->ref == 1;
		checkL -= table->subtables[z].keys - isolated;
	    }
	}
	isolated = table->vars[yindex]->ref == 1;
	checkL -= table->subtables[y].keys - isolated;
	assert(L == checkL);
#endif
	size = cuddSwapInPlace(table,x,y);
	if (size == 0) goto ddSiftingUpOutOfMem;
	/* Update the lower bound. */
	if (cuddTestInteract(table,xindex,yindex)) {
	    isolated = table->vars[xindex]->ref == 1;
	    L += table->subtables[y].keys - isolated;
	}
	move = (Move *) cuddDynamicAllocNode(table);
	if (move == NULL) goto ddSiftingUpOutOfMem;
	move->x = x;
	move->y = y;
	move->size = size;
	move->next = moves;
	moves = move;
	if ((double) size > (double) limitSize * table->maxGrowth) break;
	if (size < limitSize) limitSize = size;
	y = x;
	x = cuddNextLow(table,y);
    }
    return(moves);

ddSiftingUpOutOfMem:
    while (moves != NULL) {
	move = moves->next;
	cuddDeallocNode(table, (DdNode *) moves);
	moves = move;
    }
    return((Move *) CUDD_OUT_OF_MEM);

} /* end of ddSiftingUp */

/**Function********************************************************************

  Synopsis    [Sifts a variable down.]

  Description [Sifts a variable down. Moves x down until either it
  reaches the bound (xHigh) or the size of the DD heap increases too
  much. Returns the set of moves in case of success; NULL if memory is
  full.]

  SideEffects [None]

******************************************************************************/
static Move *
ddSiftingDown(
  DdManager * table,
  int  x,
  int  xHigh)
{
    Move	*moves;
    Move	*move;
    int		y;
    int		size;
    int		R;	/* upper bound on node decrease */
    int		limitSize;
    int		xindex, yindex;
    int		isolated;
#ifdef DD_DEBUG
    int		checkR;
    int		z;
    int		zindex;
#endif

    moves = NULL;
    /* Initialize R */
    xindex = table->invperm[x];
    limitSize = size = table->keys - table->isolated;
    R = 0;
    for (y = xHigh; y > x; y--) {
	yindex = table->invperm[y];
	if (cuddTestInteract(table,xindex,yindex)) {
	    isolated = table->vars[yindex]->ref == 1;
	    R += table->subtables[y].keys - isolated;
	}
    }

    y = cuddNextHigh(table,x);
    while (y <= xHigh && size - R < limitSize) {
#ifdef DD_DEBUG
	checkR = 0;
	for (z = xHigh; z > x; z--) {
	    zindex = table->invperm[z];
	    if (cuddTestInteract(table,xindex,zindex)) {
		isolated = table->vars[zindex]->ref == 1;
		checkR += table->subtables[z].keys - isolated;
	    }
	}
	assert(R == checkR);
#endif
	/* Update upper bound on node decrease. */
	yindex = table->invperm[y];
	if (cuddTestInteract(table,xindex,yindex)) {
	    isolated = table->vars[yindex]->ref == 1;
	    R -= table->subtables[y].keys - isolated;
	}
	size = cuddSwapInPlace(table,x,y);
	if (size == 0) goto ddSiftingDownOutOfMem;
	move = (Move *) cuddDynamicAllocNode(table);
	if (move == NULL) goto ddSiftingDownOutOfMem;
	move->x = x;
	move->y = y;
	move->size = size;
	move->next = moves;
	moves = move;
	if ((double) size > (double) limitSize * table->maxGrowth) break;
	if (size < limitSize) limitSize = size;
	x = y;
	y = cuddNextHigh(table,x);
    }
    return(moves);

ddSiftingDownOutOfMem:
    while (moves != NULL) {
	move = moves->next;
	cuddDeallocNode(table, (DdNode *) moves);
	moves = move;
    }
    return((Move *) CUDD_OUT_OF_MEM);

} /* end of ddSiftingDown */

/**Function********************************************************************

  Synopsis    [Given a set of moves, returns the DD heap to the position
  giving the minimum size.]

  Description [Given a set of moves, returns the DD heap to the
  position giving the minimum size. In case of ties, returns to the
  closest position giving the minimum size. Returns 1 in case of
  success; 0 otherwise.]

  SideEffects [None]

******************************************************************************/
static int
ddSiftingBackward(
  DdManager * table,
  int  size,
  Move * moves)
{
    Move *move;
    int	res;

    for (move = moves; move != NULL; move = move->next) {
	if (move->size < size) {
	    size = move->size;
	}
    }

    for (move = moves; move != NULL; move = move->next) {
	if (move->size == size) return(1);
	res = cuddSwapInPlace(table,(int)move->x,(int)move->y);
	if (!res) return(0);
    }

    return(1);

} /* end of ddSiftingBackward */

/**Function********************************************************************

  Synopsis    [Prepares the DD heap for dynamic reordering.]

  Description [Prepares the DD heap for dynamic reordering. Does
  garbage collection, to guarantee that there are no dead nodes;
  clears the cache, which is invalidated by dynamic reordering; initializes
  the number of isolated projection functions; and initializes the
  interaction matrix.  Returns 1 in case of success; 0 otherwise.]

  SideEffects [None]

******************************************************************************/
static int
ddReorderPreprocess(
  DdManager * table)
{
    int i;
    int res;

    /* Clear the cache. */
    cuddCacheFlush(table);
    cuddLocalCacheClearAll(table);

    /* Eliminate dead nodes. Do not scan the cache again. */
    cuddGarbageCollect(table,0);

    /* Initialize number of isolated projection functions. */
    table->isolated = 0;
    for (i = 0; i
size; i++) {
	if (table->vars[i]->ref == 1) table->isolated++;
    }

    /* Initialize the interaction matrix. */
    res = cuddInitInteract(table);
    if (res == 0) return(0);

    return(1);

} /* end of ddReorderPreprocess */

/**Function********************************************************************

  Synopsis    [Cleans up at the end of reordering.]

  Description []

  SideEffects [None]

******************************************************************************/
static int
ddReorderPostprocess(
  DdManager * table)
{

#ifdef DD_VERBOSE
    (void) fflush(table->out);
#endif

    /* Free interaction matrix. */
    FREE(table->interact);

    return(1);

} /* end of ddReorderPostprocess */

/**Function********************************************************************

  Synopsis    [Reorders variables according to a given permutation.]

  Description [Reorders variables according to a given permutation.
  The i-th permutation array contains the index of the variable that
  should be brought to the i-th level. ddShuffle assumes that no
  dead nodes are present and that the interaction matrix is properly
  initialized.  The reordering is achieved by a series of upward sifts.
  Returns 1 if successful; 0 otherwise.]

  SideEffects [None]

  SeeAlso []

******************************************************************************/
static int
ddShuffle(
  DdManager * table,
  int * permutation)
{
    int		index;
    int		level;
    int		position;
    int		numvars;
    int		result;
#ifdef DD_STATS
    long	localTime;
    int		initialSize;
    int		finalSize;
    int		previousSize;
#endif

    ddTotalNumberSwapping = 0;
#ifdef DD_STATS
    localTime = util_cpu_time();
    initialSize = table->keys - table->isolated;
    (void) fprintf(table->out,"#:I_SHUFFLE %8d: initial size\n",
		   initialSize);
    ddTotalNISwaps = 0;
#endif

    numvars = table->size;

    for (level = 0; level < numvars; level++) {
	index = permutation[level];
	position = table->perm[index];
#ifdef DD_STATS
	previousSize = table->keys - table->isolated;
#endif
	result = ddSiftUp(table,position,level);
	if (!result) return(0);
#ifdef DD_STATS
	if (table->keys < (unsigned) previousSize + table->isolated) {
	    (void) fprintf(table->out,"-");
	} else if (table->keys > (unsigned) previousSize + table->isolated) {
	    (void) fprintf(table->out,"+");	/* should never happen */
	} else {
	    (void) fprintf(table->out,"=");
	}
	fflush(table->out);
#endif
    }

#ifdef DD_STATS
    (void) fprintf(table->out,"\n");
    finalSize = table->keys - table->isolated;
    (void) fprintf(table->out,"#:F_SHUFFLE %8d: final size\n",finalSize);
    (void) fprintf(table->out,"#:T_SHUFFLE %8g: total time (sec)\n",
	((double)(util_cpu_time() - localTime)/1000.0));
    (void) fprintf(table->out,"#:N_SHUFFLE %8d: total swaps\n",
		   ddTotalNumberSwapping);
    (void) fprintf(table->out,"#:M_SHUFFLE %8d: NI swaps\n",ddTotalNISwaps);
#endif

    return(1);

} /* end of ddShuffle */

/**Function********************************************************************

  Synopsis    [Moves one variable up.]

  Description [Takes a variable from position x and sifts it up to
  position xLow;  xLow should be less than or equal to x.
  Returns 1 if successful; 0 otherwise]

  SideEffects [None]

  SeeAlso     []

******************************************************************************/
static int
ddSiftUp(
  DdManager * table,
  int  x,
  int  xLow)
{
    int        y;
    int        size;

    y = cuddNextLow(table,x);
    while (y >= xLow) {
	size = cuddSwapInPlace(table,y,x);
	if (size == 0) {
	    return(0);
	}
	x = y;
	y = cuddNextLow(table,x);
    }
    return(1);

} /* end of ddSiftUp */

/**Function********************************************************************

  Synopsis    [Fixes the BDD variable group tree after a shuffle.]

  Description [Fixes the BDD variable group tree after a
  shuffle. Assumes that the order of the variables in a terminal node
  has not been changed.]

  SideEffects [Changes the BDD variable group tree.]

  SeeAlso     []

******************************************************************************/
static void
bddFixTree(
  DdManager * table,
  MtrNode * treenode)
{
    if (treenode == NULL) return;
    treenode->low = ((int) treenode->index
size) ?
	table->perm[treenode->index] : treenode->index;
    if (treenode->child != NULL) {
	bddFixTree(table, treenode->child);
    }
    if (treenode->younger != NULL)
	bddFixTree(table, treenode->younger);
    if (treenode->parent != NULL && treenode->low < treenode->parent->low) {
	treenode->parent->low = treenode->low;
	treenode->parent->index = treenode->index;
    }
    return;

} /* end of bddFixTree */

/**Function********************************************************************

  Synopsis    [Updates the BDD variable group tree before a shuffle.]

  Description [Updates the BDD variable group tree before a shuffle.
  Returns 1 if successful; 0 otherwise.]

  SideEffects [Changes the BDD variable group tree.]

  SeeAlso     []

******************************************************************************/
static int
ddUpdateMtrTree(
  DdManager * table,
  MtrNode * treenode,
  int * perm,
  int * invperm)
{
    int	i, size, index, level;
    int	minLevel, maxLevel, minIndex;

    if (treenode == NULL) return(1);

    /* i : level */
    for (i = treenode->low; i < treenode->low + treenode->size; i++) {
	index = table->invperm[i];
	level = perm[index];
	if (level < minLevel) {
	    minLevel = level;
	    minIndex = index;
	}
	if (level > maxLevel)
	    maxLevel = level;
    }
    size = maxLevel - minLevel + 1;
    if (size == treenode->size) {
	treenode->low = minLevel;
	treenode->index = minIndex;
    } else
	return(0);

    if (treenode->child != NULL) {
	if (!ddUpdateMtrTree(table, treenode->child, perm, invperm))
	    return(0);
    }
    if (treenode->younger != NULL) {
	if (!ddUpdateMtrTree(table, treenode->younger, perm, invperm))
	    return(0);
    }
    return(1);
}

/**Function********************************************************************

  Synopsis    [Checks the BDD variable group tree before a shuffle.]

  Description [Checks the BDD variable group tree before a shuffle.
  Returns 1 if successful; 0 otherwise.]

  SideEffects [Changes the BDD variable group tree.]

  SeeAlso     []

******************************************************************************/
static int
ddCheckPermuation(
  DdManager * table,
  MtrNode * treenode,
  int * perm,
  int * invperm)
{
    int	i, size, index, level;
    int	minLevel, maxLevel;

    if (treenode == NULL) return(1);

    minLevel = table->size;
    maxLevel = 0;
    /* i : level */
    for (i = treenode->low; i < treenode->low + treenode->size; i++) {
	index = table->invperm[i];
	level = perm[index];
	if (level < minLevel)
	    minLevel = level;
	if (level > maxLevel)
	    maxLevel = level;
    }
    size = maxLevel - minLevel + 1;
    if (size != treenode->size)
	return(0);

    if (treenode->child != NULL) {
	if (!ddCheckPermuation(table, treenode->child, perm, invperm))
	    return(0);
    }
    if (treenode->younger != NULL) {
	if (!ddCheckPermuation(table, treenode->younger, perm, invperm))
	    return(0);
    }
    return(1);
}


text:
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MAIN_H
#define __MAIN_H

/* Includes ------------------------------------------------------------------*/
#if defined (USE_STM324xG_EVAL)
  #include "stm324xg_eval_lcd.h"
  #include "stm324xg_eval_i2c_ee.h"

#elif defined (USE_STM324x7I_EVAL)
  #include "stm324x7i_eval_lcd.h"
  #include "stm324x7i_eval_i2c_ee.h"

#else
 #error "Please select first the Evaluation board used in your application (in Project Options)"
#endif

/* Private define ------------------------------------------------------------*/
/* Used to display the transfer status on LCD */
#define USE_LCD

/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */

#endif /* __MAIN_H */

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/


text:
using System;
using System.Threading.Tasks;

namespace Citicon.Forms
{
    internal sealed class TimeLogCalculatorFormController : FormControllerBase<TimeLogCalculatorForm>
    {
        public TimeLogCalculatorFormController(TimeLogCalculatorForm form) : base(form)
        {
        }

        public Task SearchAsync()
        {
            throw new NotImplementedException();
        }
    }
}


text:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Common;
using VDS.RDF;
using VDS.RDF.Parsing;
using static Serilog.Log;

namespace Libraries.QualityChecks.VocabularyCheck
{
    /// <summary>
    /// Checks if predicates used in triples are defined in vocabularies.
    /// Parameters for this class are vocabulary URIs that can point either to file on a disk or web resource
    /// </summary>
    public class VocabularyCheck : QualityCheck
    {
        public override QualityCheckReport CheckGraphs(IEnumerable<IGraph> graphs, IEnumerable<object> parameters)
        {
            IsCheckInProgress = true;

            var parameterList = ProcessParameters(parameters);
            if (!AreParametersValid(parameterList))
            {
                return null;
            }

            var vocabularyUris = ParseParameters<Uri>(parameterList);
            if (vocabularyUris == null) return null;

            var predicateList = GetPredicates(vocabularyUris);
            var wrongTriples = new List<(Uri GraphUri, string Triple)>();
            try
            {
                Parallel.ForEach(graphs, ParallelOptions, graph =>
                {
                    lock (wrongTriples)
                    {
                        var wrongTriplesInGraph = CheckTriples(graph.Triples.Select(t => t.ToString()).ToList(), predicateList);
                        wrongTriples.AddRange(wrongTriplesInGraph.Select(triple => (graph.BaseUri, triple)));
                    }
                });
            }
            catch (OperationCanceledException)
            {
                IsCheckInProgress = false;
                return null;
            }

            return GenerateQualityCheckReport(wrongTriples);
        }

        public override QualityCheckReport CheckData(IEnumerable<string> triples, IEnumerable<object> parameters)
        {
            IsCheckInProgress = true;

            var parameterList = ProcessParameters(parameters);
            if (!AreParametersValid(parameterList))
            {
                return null;
            }

            var vocabularyUris = ParseParameters<Uri>(parameterList);
            var predicateList = GetPredicates(vocabularyUris);

            var wrongTriples = CheckTriples(triples, predicateList);
            return GenerateQualityCheckReport(wrongTriples.Select(t => new ValueTuple<Uri, string>(null, t)).ToList());
        }

        private static List<string> ProcessParameters(IEnumerable<object> parameters)
        {
            var baseDir = AppDomain.CurrentDomain.BaseDirectory;

            return parameters.Select(
                            p => Path.Combine(baseDir, $"..\\..\\..\\..\\Common\\Data\\Schemas\\{p.ToString()}")) //TODO tmp solution
                            .ToList();
        }

        private IEnumerable<string> CheckTriples(IEnumerable<string> triples, IEnumerable<string> predicateList)
        {
            var wrongTriples = new List<string>();
            try
            {
                Parallel.ForEach(triples, ParallelOptions, triple =>
                {
                    var predicate = triple.Predicate();
                    if (predicateList.Contains(predicate)) return;

                    lock (wrongTriples)
                    {
                        if (wrongTriples.Contains(triple)) return;
                        Verbose($"Predicate not found in any dictionary: {triple.Predicate()}");
                        wrongTriples.Add(triple);
                    }
                });
            }
            catch (OperationCanceledException)
            {
                IsCheckInProgress = false;
                return null;
            }

            return wrongTriples;
        }

        private IEnumerable<string> GetPredicates(IEnumerable<Uri> vocabularyUris)
        {
            var vocabularySubjectsByUri = new Dictionary<Uri, IEnumerable<string>>();
            foreach (var vocabularyUri in vocabularyUris)
            {
                vocabularySubjectsByUri[vocabularyUri] = LoadVocabulary(vocabularyUri);
            }

            return vocabularySubjectsByUri.SelectMany(predicate => predicate.Value).Distinct().ToList();
        }

        private QualityCheckReport GenerateQualityCheckReport(IReadOnlyCollection<(Uri GraphUri, string Triple)> wrongTriples)
        {
            var report = new QualityCheckReport();

            if (!wrongTriples.Any())
            {
                report.QualityCheckPassed = true;
                return report;
            }

            var errorId = 1;
            foreach (var graphTriple in wrongTriples)
            {
                var graphUri = graphTriple.GraphUri != null
                    ? graphTriple.GraphUri.ToString()
                    : "Default graph or triple not bound to graph";

                report.ErrorsById[errorId] = (graphUri, graphTriple.Triple, $"Predicate not found in any dictionary: {graphTriple.Triple.Predicate()}");
                errorId++;
            }

            IsCheckInProgress = false;
            return report;
        }

        private IEnumerable<string> LoadVocabulary(Uri vocabularyUri)
        {
            var vocabularyFilePath = !vocabularyUri.IsFile
                ? DownloadVocabulary(vocabularyUri)
                : vocabularyUri.LocalPath;

            var schemaGraph = new Graph();
            FileLoader.Load(schemaGraph, vocabularyFilePath);
            return schemaGraph.Triples.Select(triple => triple.Subject.ToString()).Distinct().ToList();
        }

        private string DownloadVocabulary(Uri vocabularyUri)
        {
            //TODO
            throw new NotImplementedException();
        }
    }
}


text:
import frame = require("ui/frame");

export function buttonTap(args) {
    frame.topmost().goBack();
}


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

using ss_course_project.services.Model;

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

namespace ss_course_project.services.Repositories
{
    public class SensorsRepository : IDisposable
    {
        /*-------------------------------------------------------------------*/

        public HashSet<MqttDoubleSensor> Sensors { get; private set; }

        /*-------------------------------------------------------------------*/

        public SensorsRepository()
        {
            Sensors = new HashSet<MqttDoubleSensor>();
        }

        /*-------------------------------------------------------------------*/

        public void Dispose()
        {
            Sensors.Clear();
        }

        /*-------------------------------------------------------------------*/
    }
}

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


text:
/*
Name: 			Shop9
Written by: 	Okler Themes - (http://www.okler.net)
Theme Version:	5.3.0
*/

(function( $ ) {

	// Home page slider
	if ($.fn.revolution) {
		$('#revolutionSlider').revolution({
			sliderType: 'standard',
			sliderLayout: 'auto',
			delay: 9000,
			gridwidth: 1140,
			gridheight: 500,
			disableProgressBar: 'on',
			spinner: 'spinner3',
			parallax:{
				type:"mouse",
				origo:"slidercenter",
				speed:2000,
				levels:[2,3,4,5,6,7,12,16,10,50],
			},
			navigation: {
				touch: {
                    touchenabled: "on",
                    swipe_threshold: 75,
                    swipe_min_touches: 1,
                    swipe_direction: "horizontal",
                    drag_block_vertical: false
                },
				arrows: {
					style: "custom",
					enable: true,
					hide_onmobile: false,
					hide_onleave: true,
					hide_under:768,
					tmp: '',
					left: {
						h_align: "left",
						v_align: "center",
						h_offset: 20,
						v_offset: 0
					},
					right: {
						h_align: "right",
						v_align: "center",
						h_offset: 20,
						v_offset: 0
					}
				}
			}
		});
	}

	// Newsletter popup
	if ( document.getElementById('newsletter-popup-form') ) {
		$.magnificPopup.open({
			items: {
				src: '#newsletter-popup-form'
			},
			type: 'inline'
		}, 0);
	}

	// Featured Products Carousel
	$('.featured-products-carousel').owlCarousel({
		loop: false,
		responsive: {
			0: {
				items: 1
			},
			480: {
				items: 2
			},
			768: {
				items: 3
			},
			992: {
				items: 4
			},
			1200: {
				items: 5
			}
		},
		margin: 20,
		nav:true,
		navText: [],
		dots: false,
		autoWidth: false
	});

	// New Products Carousel
	$('.latest-products-carousel').owlCarousel({
		loop: false,
		responsive: {
			0: {
				items: 1
			},
			480: {
				items: 2
			},
			768: {
				items: 3
			},
			992: {
				items: 4
			},
			1200: {
				items: 5
			}
		},
		margin: 20,
		nav:true,
		navText: [],
		dots: false,
		autoWidth: false
	});

	// Clients Carousel
	$('.clients-carousel').owlCarousel({
		loop: false,
		responsive: {
			0: {
				items: 1
			},
			320: {
				items: 2
			},
			480: {
				items: 3
			},
			768: {
				items: 4
			},
			992: {
				items: 5
			},
			1200: {
				items: 6
			}
		},
		margin: 10,
		nav:true,
		navText: [],
		dots: false,
		autoplay: true,
		autoplayTimeout: 6000
	});

	// Mobile menu accordion
	$('.mobile-side-menu').find('.mmenu-toggle').on('click', function (e) {
		var closestLi = $(this).closest('li');

		if (closestLi.find('ul').length) {
			closestLi.children('ul').slideToggle(300, function () {
				closestLi.toggleClass('open');
			});
			e.preventDefault();
		}
	});

	// Mobile menu show/hide
	$('.mmenu-toggle-btn, #mobile-menu-overlay').on('click', function (e) {
		$('.body').toggleClass('mmenu-open');
		e.preventDefault();
	});

	// Search Dropdown Toggle
	$('.search-toggle').on('click', function (e) {
		$('.header-search-wrapper').toggleClass('open');
		e.preventDefault();
	});

	// Add logo and cart-dropdown to fixed menu
	// if stick menu is enabled and haven't included yet
	if ( $('#header').data('plugin-options')['stickyEnabled'] &&
		!$('.header-nav').find('.header-logo').length &&
 		!$('.header-nav'). find('.cart-dropdown').length ) {

		var targetArea = $('.header-nav').find('.container');

		// Clone and
		$('.header-logo, .cart-dropdown')
			.clone(true)
			.prependTo(targetArea);
	}

	// Toggle new/change password section via checkbox
	$('#change-pass-checkbox').on('change', function () {
		$('#account-chage-pass').toggleClass('show');
	});

	// Toggle creditcard section -- see checkout page
	$('.payment-card-check').on('change', function () {
		var cardArea = $('#payment-credit-card-area');
		switch($(this).val()) {
	        case 'checkcard':
	            cardArea.addClass('show');
	            break;
            case 'checkmo':
	            cardArea.removeClass('show');
	            break;
	    }
	});

	// Vertical Spinner - Touchspin - Product Details Quantity input
	if ( $.fn.TouchSpin ) {
		$('#product-vqty').TouchSpin({
			verticalbuttons: true
	    });
	}

	// Filter Price Slider
	if (typeof noUiSlider === 'object') {
		var priceSlider = document.getElementById('price-slider'),
			priceLow 	= document.getElementById('price-range-low'),
			priceHigh 	= document.getElementById('price-range-high');

		// Create Slider
		noUiSlider.create(priceSlider, {
			start: [ 50, 250 ],
			connect: true,
			step: 1,
			range: {
				'min': 0,
				'max': 300
			}
		});

		// Update Input values
		priceSlider.noUiSlider.on('update', function( values, handle ) {
			var value = values[handle];

			if ( handle ) {
				priceHigh.value = Math.round(value);
			} else {
				priceLow.value = Math.round(value);
			}
		});

		// when inpout values changei update slider
		priceLow.addEventListener('change', function(){
			priceSlider.noUiSlider.set([this.value, null]);
		});

		priceHigh.addEventListener('change', function(){
			priceSlider.noUiSlider.set([null, this.value]);
		});
	}

	// Product Details Gallery
	if ($.fn.elevateZoom) {
		$('#product-zoom').elevateZoom({
			responsive: true,
			zoomType: "inner",
			cursor: "default"
		});
	}

	$('#productGalleryThumbs')
		.owlCarousel({
			margin: 10,
			items: 4,
			nav: false,
			center: false,
			dots: false,
			autoplay: false
		})
		.on('click', '.owl-item', function(e) {
			var ez = $('#product-zoom').data('elevateZoom'),
				targetLink= $(this).find('a'),
				smallImg = targetLink.data('image'),
				bigImg = targetLink.data('zoom-image');

			ez.swaptheimage(smallImg, bigImg);
		});

	// No def events for links
	$('#productGalleryThumbs').find('a').on('click', function (e) {
		e.preventDefault();
	});

	// Newsletter Checkbox Cookie - Check if has newsCheck cookie
	if( getCookie('newsCheck') != '' ) {
		$.magnificPopup.close();
	}

	// Create cookie or delete depending the checkbox
	$('.newsletter-subscribe input[type="checkbox"]').on('change', function(){
		if( $(this).prop('checked') ) {
			setCookie('newsCheck', 'true', 30); // Expires in 30 days
		} else {
			setCookie('newsCheck', 'true', 0);
		}
	});

	// Set cookie
	function setCookie(cname, cvalue, exdays) {
	    var d = new Date();
	    d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
	    var expires = "expires="+d.toUTCString();
	    document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
	}

	// Get cookie
	function getCookie(cname) {
	    var name = cname + "=";
	    var ca = document.cookie.split(';');
	    for(var i = 0; i < ca.length; i++) {
	        var c = ca[i];
	        while (c.charAt(0) == ' ') {
	            c = c.substring(1);
	        }
	        if (c.indexOf(name) == 0) {
	            return c.substring(name.length, c.length);
	        }
	    }
	    return "";
	}

}).apply( this, [ jQuery ]);


text:
import urllib.request
import urllib.parse

from bs4 import BeautifulSoup as bs

class HtmlAnalysis(object):
    """
    Defines routines to analyze a URL and extract various resources to support a skeptical analysis of it.
    """

    def __init__(self, url, html=None):
        """
        :param url: string
        :param html: html content (string) for testing, or None, which means connect to the URL for content
        :return:
        """
        self.url = url
        # set the soup
        if not html:
            # pass user_agent because some sites require spoofing
            user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36'
            req = urllib.request.Request(url, headers={'User-Agent': user_agent})
            httpResponse = urllib.request.urlopen(req)
            self.soup = bs(httpResponse.read(), "lxml")  # todo encoding?
        else:
            self.soup = bs(html, "lxml")
        self.title = self.soup.title.string

    def is_offsite_link(self, a):
        """
        :param a: the tag to examine
        :return: True if a's href is non-null and links to a domain that is not mine in self.url, False o/w
        """
        site_netloc = urllib.parse.urlparse(self.url).netloc
        link_netloc = urllib.parse.urlparse(a.get('href')).netloc
        return link_netloc and (link_netloc != site_netloc)     # NB: link_netloc is None for roots, e.g., Home

    def outgoing_links(self, only_offsite):
        """
        :param only_offsite: controls whether only offsite links are included (if True) or all links (False)
        :return: list of  tags, excluding ones that have no text, and optionally excluding onsite ones if only_offsite
        """
        all_links = [a for a in self.soup.find_all('a') if a.string and a.string.strip()]
        return [a for a in all_links if self.is_offsite_link(a)] if only_offsite else all_links

    def outgoing_link_to_para_ratio(self):
        return len(self.outgoing_links(True)) / len(self.soup.find_all('p'))


text:
**NOTICE: This repository has been archived, and will no longer be maintained or accept pull requests.**

## Stimulus Profile Control ##

**Stimulus Profile Control** is a custom control which will allow you to run legacy NI VeriStand Stimulus Profiles (*.nivstest) directly from the Workspace.

### LabVIEW Version ###

LabVIEW 2010

### Built Availability ###

This IP is built and available for NI VeriStand 2010 and 2011 [here](http://www.ni.com/example/31335/en/) but will be taken down soon.

### Quality, Limitations ###

This IP was made in 2010 and has not been tested since. There are no known users of the IP and it was designed for use with legacy stimulus profiles (*.nivstest). Proceed with caution.

### License ###

*This repository and any materials provided by NI therein are provided AS IS. NI DISCLAIMS ANY AND ALL LIABILITIES FOR AND MAKES NO WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR  PARTICULAR PURPOSE, OR NON-INFRINGEMENT OF INTELLECTUAL PROPERTY. NI shall have no liability for any direct, indirect, incidental, punitive, special, or consequential damages for your use of the repository or any materials contained therein.*


text:
title: Triptych of John the Baptist and John the Evangelist by Hans Memling
slug: "page:8"
created: 20-06-2018, 15:08
date: 06-10-2018, 12:55
modified: 03-11-2018, 20:16
visible: false
routable: false
taxonomy:
    category: [saint-jean, en]
shortcode-core:
    active: true
---
The action continues on the left inner panel.

<picture>
<source
sizes="(max-width: 767px) 98vw, (min-width: 959px) 50vw, 86vw"
srcset="
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/saint-jean_sans-cadre-280.webp 280w,
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/saint-jean_sans-cadre-380.webp 380w,
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/saint-jean_sans-cadre-480.webp 480w,
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/saint-jean_sans-cadre-640.webp 640w,
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/saint-jean_sans-cadre-840.webp 840w,
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/saint-jean_sans-cadre-1280.webp 1280w,
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/saint-jean_sans-cadre-1600.webp 1600w,
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/saint-jean_sans-cadre-1920.webp 1920w"
type="image/webp" />
<img
src="/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/saint-jean_sans-cadre-640.jpg" title="Hans MEMLING, "Triptych of John the Baptist and John the Evangelist", view of the left inner panel, Memling Museum, Hospital St. John, Bruges (Brugge)" alt="Hans MEMLING, "Triptych of John the Baptist and John the Evangelist", view of the left inner panel, Memling Museum, Hospital St. John, Bruges (Brugge)" class="class-40-img"
sizes="(max-width: 767px) 98vw, (min-width: 959px) 50vw, 86vw"
srcset="
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/saint-jean_sans-cadre-280.jpg 280w,
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/saint-jean_sans-cadre-380.jpg 380w,
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/saint-jean_sans-cadre-480.jpg 480w,
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/saint-jean_sans-cadre-640.jpg 640w,
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/saint-jean_sans-cadre-840.jpg 840w,
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/saint-jean_sans-cadre-1280.jpg 1280w,
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/saint-jean_sans-cadre-1600.jpg 1600w,
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/saint-jean_sans-cadre-1920.jpg 1920w">
</picture>
the left inner panel

To succeed in making John die without causing any troubles among his supporters, [color=#e6a64d]Herod imagined a staging[/color]:
«on his birthday», he organized «a dinner for his dignitaries, for the chiefs of the army and for the notables of Galilee.
Herodiade [Salome][9]{.orange #salome}'s daughter» makes «her entrance» and dances.

<picture>
<source
sizes="(max-width: 767px) 98vw, (min-width: 959px) 50vw, 86vw"
srcset="
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/salome-280.webp 280w,
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/salome-380.webp 380w,
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/salome-480.webp 480w,
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/salome-640.webp 640w,
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/salome-840.webp 840w,
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/salome-1280.webp 1280w,
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/salome-1600.webp 1600w,
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/salome-1920.webp 1920w"
type="image/webp" />
<img
src="/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/salome-640.jpg" title="Hans MEMLING, "Triptych of John the Baptist and John the Evangelist", detail of the left inner panel, "Salome's Dance", Memling Museum, Hospital St. John, Bruges (Brugge)" alt="Hans MEMLING, "Triptych of John the Baptist and John the Evangelist", detail of the left inner panel, "Salome's Dance", Memling Museum, Hospital St. John, Bruges (Brugge)" class="class-80-img"
sizes="(max-width: 767px) 98vw, (min-width: 959px) 50vw, 86vw"
srcset="
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/salome-280.jpg 280w,
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/salome-380.jpg 380w,
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/salome-480.jpg 480w,
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/salome-640.jpg 640w,
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/salome-840.jpg 840w,
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/salome-1280.jpg 1280w,
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/salome-1600.jpg 1600w,
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/salome-1920.jpg 1920w">
</picture>
detail of the left inner panel, "Salome's Dance"

The [color=#e6a64d]"Salome's Dance"[/color] takes place in a tower of the palace in the upper left corner of the left inner panel.
Above, statues set in niches represent a naked man between two naked women, pagan figures who allude to Herod's adulterous behaviour.

Herod looks as if he liked his dance and, [color=#e6a64d]to avoid responsibility for John's death, says[/color]:
«"[color=#e6a64d]Ask me what you want[/color], and I'll give it to you, even if it's half my kingdom" [color=#999]\(Mark, chap. 6:21-22\)[/color].
Salome goes out «to tell her mother, [color=#e6a64d]"What am I going to ask for?"[/color]» Herodias replied: «[color=#e6a64d]"The head of John, the one who baptises"[/color]. Immediately the girl» hastened «to return to the king, and» made him «this request: [color=#e6a64d]"I want you to give me immediately on a plate the head of John the Baptist"[/color]. [color=#999]\(Mark, chap. 6, 24-29\)[/color]
The proof that this whole story is indeed a smokescreen is that if Salome asks Herod [color=#e6a64d]«the death of his father [Philip][7]{.orange #herode-boethos-2} or her mother [Herodias][6]{.orange #herodiade-2}»[/color], Herod cannot consent to it [color=#999](Golden Legend chap. 121,I. [^1] )[/color].

A guard is going to «behead John in the prison» [color=#999]\(Mark, chap. 6,22-23)[/color].

<picture>
<source
sizes="(max-width: 767px) 98vw, (min-width: 959px) 50vw, 86vw"
srcset="
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/decollation-280.webp 280w,
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/decollation-380.webp 380w,
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/decollation-480.webp 480w,
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/decollation-640.webp 640w,
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/decollation-840.webp 840w,
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/decollation-1280.webp 1280w,
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/decollation-1600.webp 1600w,
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/decollation-1920.webp 1920w"
type="image/webp" />
<img
src="/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/decollation-640.jpg" title="Hans MEMLING, "Triptych of John the Baptist and John the Evangelist", detail of the left inner panel, "Decollation of John the Baptist", Memling Museum, Hospital St. John, Bruges (Brugge)" alt="Hans MEMLING, "Triptych of John the Baptist and John the Evangelist", detail of the left inner panel, "Decollation of John the Baptist", Memling Museum, Hospital St. John, Bruges (Brugge)" class="class-diane-img"
sizes="(max-width: 767px) 98vw, (min-width: 959px) 50vw, 86vw"
srcset="
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/decollation-280.jpg 280w,
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/decollation-380.jpg 380w,
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/decollation-480.jpg 480w,
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/decollation-640.jpg 640w,
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/decollation-840.jpg 840w,
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/decollation-1280.jpg 1280w,
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/decollation-1600.jpg 1600w,
/user/sites/docs/pages/01.home/06.bruges/01.hopital-saint-jean/01.saint-jean/08.saint-jean_8/decollation-1920.jpg 1920w">
</picture>
detail of the left inner panel, "Decollation of John the Baptist"

[^1]: words of [St. Jerome](https://en.wikipedia.org/wiki/Jerome "https://en.wikipedia.org/wiki/Jerome"){.orange #saint-jerome} reported by Jacobus da Varagine.

[6]: https://en.wikipedia.org/wiki/Herodias "https://en.wikipedia.org/wiki/Herodias"
[7]: https://en.wikipedia.org/wiki/Herod_II "https://en.wikipedia.org/wiki/Herod_II"
[9]: https://en.wikipedia.org/wiki/Salome "https://en.wikipedia.org/wiki/Salome"