text:
/* References:

   [1] "Branch Prediction for Free"
       Ball and Larus; PLDI '93.
   [2] "Static Branch Frequency and Program Profile Analysis"
       Wu and Larus; MICRO-27.
   [3] "Corpus-based Static Branch Prediction"
       Calder, Grunwald, Lindsay, Martin, Mozer, and Zorn; PLDI '95.  */

#include "config.h"
#include "system.h"
#include "tree.h"
#include "rtl.h"
#include "tm_p.h"
#include "hard-reg-set.h"
#include "basic-block.h"
#include "insn-config.h"
#include "regs.h"
#include "flags.h"
#include "output.h"
#include "function.h"
#include "except.h"
#include "toplev.h"
#include "recog.h"
#include "expr.h"
#include "predict.h"

/* Random guesstimation given names.  */
#define PROB_NEVER		(0)
#define PROB_VERY_UNLIKELY	(REG_BR_PROB_BASE / 10 - 1)
#define PROB_UNLIKELY		(REG_BR_PROB_BASE * 4 / 10 - 1)
#define PROB_EVEN		(REG_BR_PROB_BASE / 2)
#define PROB_LIKELY		(REG_BR_PROB_BASE - PROB_UNLIKELY)
#define PROB_VERY_LIKELY	(REG_BR_PROB_BASE - PROB_VERY_UNLIKELY)
#define PROB_ALWAYS		(REG_BR_PROB_BASE)

static void combine_predictions_for_insn PARAMS ((rtx, basic_block));
static void dump_prediction		 PARAMS ((enum br_predictor, int,
						  basic_block, int));
static void estimate_loops_at_level	 PARAMS ((struct loop *loop));
static void propagate_freq		 PARAMS ((basic_block));
static void estimate_bb_frequencies	 PARAMS ((struct loops *));
static void counts_to_freqs		 PARAMS ((void));

/* Information we hold about each branch predictor.
   Filled using information from predict.def.  */

struct predictor_info
{
  const char *const name;	/* Name used in the debugging dumps.  */
  const int hitrate;		/* Expected hitrate used by
				   predict_insn_def call.  */
  const int flags;
};

/* Use given predictor without Dempster-Shaffer theory if it matches
   using first_match heuristics.  */
#define PRED_FLAG_FIRST_MATCH 1

/* Recompute hitrate in percent to our representation.  */

#define HITRATE(VAL) ((int) ((VAL) * REG_BR_PROB_BASE + 50) / 100)

#define DEF_PREDICTOR(ENUM, NAME, HITRATE, FLAGS) {NAME, HITRATE, FLAGS},
static const struct predictor_info predictor_info[]= {
#include "predict.def"

  /* Upper bound on predictors.  */
  {NULL, 0, 0}
};
#undef DEF_PREDICTOR

void
predict_insn (insn, predictor, probability)
     rtx insn;
     int probability;
     enum br_predictor predictor;
{
  if (!any_condjump_p (insn))
    abort ();

  REG_NOTES (insn)
    = gen_rtx_EXPR_LIST (REG_BR_PRED,
			 gen_rtx_CONCAT (VOIDmode,
					 GEN_INT ((int) predictor),
					 GEN_INT ((int) probability)),
			 REG_NOTES (insn));
}

/* Predict insn by given predictor.  */

void
predict_insn_def (insn, predictor, taken)
     rtx insn;
     enum br_predictor predictor;
     enum prediction taken;
{
   int probability = predictor_info[(int) predictor].hitrate;

   if (taken != TAKEN)
     probability = REG_BR_PROB_BASE - probability;

   predict_insn (insn, predictor, probability);
}

/* Predict edge E with given probability if possible.  */

void
predict_edge (e, predictor, probability)
     edge e;
     int probability;
     enum br_predictor predictor;
{
  rtx last_insn;
  last_insn = e->src->end;

  /* We can store the branch prediction information only about
     conditional jumps.  */
  if (!any_condjump_p (last_insn))
    return;

  /* We always store probability of branching.  */
  if (e->flags & EDGE_FALLTHRU)
    probability = REG_BR_PROB_BASE - probability;

  predict_insn (last_insn, predictor, probability);
}

/* Predict edge E by given predictor if possible.  */

void
predict_edge_def (e, predictor, taken)
     edge e;
     enum br_predictor predictor;
     enum prediction taken;
{
   int probability = predictor_info[(int) predictor].hitrate;

   if (taken != TAKEN)
     probability = REG_BR_PROB_BASE - probability;

   predict_edge (e, predictor, probability);
}

/* Invert all branch predictions or probability notes in the INSN.  This needs
   to be done each time we invert the condition used by the jump.  */

void
invert_br_probabilities (insn)
     rtx insn;
{
  rtx note;

  for (note = REG_NOTES (insn); note; note = XEXP (note, 1))
    if (REG_NOTE_KIND (note) == REG_BR_PROB)
      XEXP (note, 0) = GEN_INT (REG_BR_PROB_BASE - INTVAL (XEXP (note, 0)));
    else if (REG_NOTE_KIND (note) == REG_BR_PRED)
      XEXP (XEXP (note, 0), 1)
	= GEN_INT (REG_BR_PROB_BASE - INTVAL (XEXP (XEXP (note, 0), 1)));
}

/* Dump information about the branch prediction to the output file.  */

static void
dump_prediction (predictor, probability, bb, used)
     enum br_predictor predictor;
     int probability;
     basic_block bb;
     int used;
{
  edge e = bb->succ;

  if (!rtl_dump_file)
    return;

  while (e->flags & EDGE_FALLTHRU)
    e = e->succ_next;

  fprintf (rtl_dump_file, "  %s heuristics%s: %.1f%%",
	   predictor_info[predictor].name,
	   used ? "" : " (ignored)", probability * 100.0 / REG_BR_PROB_BASE);

  if (bb->count)
    {
      fprintf (rtl_dump_file, "  exec ");
      fprintf (rtl_dump_file, HOST_WIDEST_INT_PRINT_DEC, bb->count);
      fprintf (rtl_dump_file, " hit ");
      fprintf (rtl_dump_file, HOST_WIDEST_INT_PRINT_DEC, e->count);
      fprintf (rtl_dump_file, " (%.1f%%)", e->count * 100.0 / bb->count);
    }

  fprintf (rtl_dump_file, "\n");
}

/* Combine all REG_BR_PRED notes into single probability and attach REG_BR_PROB
   note if not already present.  Remove now useless REG_BR_PRED notes.  */

static void
combine_predictions_for_insn (insn, bb)
     rtx insn;
     basic_block bb;
{
  rtx prob_note = find_reg_note (insn, REG_BR_PROB, 0);
  rtx *pnote = &REG_NOTES (insn);
  rtx note;
  int best_probability = PROB_EVEN;
  int best_predictor = END_PREDICTORS;
  int combined_probability = REG_BR_PROB_BASE / 2;
  int d;
  bool first_match = false;
  bool found = false;

  if (rtl_dump_file)
    fprintf (rtl_dump_file, "Predictions for insn %i bb %i\n", INSN_UID (insn),
	     bb->index);

  /* We implement "first match" heuristics and use probability guessed
     by predictor with smallest index.  In the future we will use better
     probability combination techniques.  */
  for (note = REG_NOTES (insn); note; note = XEXP (note, 1))
    if (REG_NOTE_KIND (note) == REG_BR_PRED)
      {
	int predictor = INTVAL (XEXP (XEXP (note, 0), 0));
	int probability = INTVAL (XEXP (XEXP (note, 0), 1));

	found = true;
	if (best_predictor > predictor)
	  best_probability = probability, best_predictor = predictor;

	d = (combined_probability * probability
	     + (REG_BR_PROB_BASE - combined_probability)
	     * (REG_BR_PROB_BASE - probability));

	/* Use FP math to avoid overflows of 32bit integers.  */
	if (d == 0)
	  /* If one probability is 0% and one 100%, avoid division by zero.  */
	  combined_probability = REG_BR_PROB_BASE / 2;
	else
	  combined_probability = (((double) combined_probability) * probability
				  * REG_BR_PROB_BASE / d + 0.5);
      }

  /* Decide which heuristic to use.  In case we didn't match anything,
     use no_prediction heuristic, in case we did match, use either
     first match or Dempster-Shaffer theory depending on the flags.  */

  if (predictor_info [best_predictor].flags & PRED_FLAG_FIRST_MATCH)
    first_match = true;

  if (!found)
    dump_prediction (PRED_NO_PREDICTION, combined_probability, bb, true);
  else
    {
      dump_prediction (PRED_DS_THEORY, combined_probability, bb, !first_match);
      dump_prediction (PRED_FIRST_MATCH, best_probability, bb, first_match);
    }

  if (first_match)
    combined_probability = best_probability;
  dump_prediction (PRED_COMBINED, combined_probability, bb, true);

  while (*pnote)
    {
      if (REG_NOTE_KIND (*pnote) == REG_BR_PRED)
	{
	  int predictor = INTVAL (XEXP (XEXP (*pnote, 0), 0));
	  int probability = INTVAL (XEXP (XEXP (*pnote, 0), 1));

	  dump_prediction (predictor, probability, bb,
			   !first_match || best_predictor == predictor);
          *pnote = XEXP (*pnote, 1);
	}
      else
        pnote = &XEXP (*pnote, 1);
    }

  if (!prob_note)
    {
      REG_NOTES (insn)
	= gen_rtx_EXPR_LIST (REG_BR_PROB,
			     GEN_INT (combined_probability), REG_NOTES (insn));

      /* Save the prediction into CFG in case we are seeing non-degenerated
	 conditional jump.  */
      if (bb->succ->succ_next)
	{
	  BRANCH_EDGE (bb)->probability = combined_probability;
	  FALLTHRU_EDGE (bb)->probability
	    = REG_BR_PROB_BASE - combined_probability;
	}
    }
}

/* Statically estimate the probability that a branch will be taken.
   ??? In the next revision there will be a number of other predictors added
   from the above references. Further, each heuristic will be factored out
   into its own function for clarity (and to facilitate the combination of
   predictions).  */

void
estimate_probability (loops_info)
     struct loops *loops_info;
{
  sbitmap *dominators, *post_dominators;
  int i;
  int found_noreturn = 0;

  dominators = sbitmap_vector_alloc (n_basic_blocks, n_basic_blocks);
  post_dominators = sbitmap_vector_alloc (n_basic_blocks, n_basic_blocks);
  calculate_dominance_info (NULL, dominators, CDI_DOMINATORS);
  calculate_dominance_info (NULL, post_dominators, CDI_POST_DOMINATORS);

  /* Try to predict out blocks in a loop that are not part of a
     natural loop.  */
  for (i = 0; i < loops_info->num; i++)
    {
      int j;
      int exits;
      struct loop *loop = &loops_info->array[i];

      flow_loop_scan (loops_info, loop, LOOP_EXIT_EDGES);
      exits = loop->num_exits;

      for (j = loop->first->index; j <= loop->last->index; ++j)
	if (TEST_BIT (loop->nodes, j))
	  {
	    int header_found = 0;
	    edge e;

	    /* Loop branch heuristics - predict an edge back to a
	       loop's head as taken.  */
	    for (e = BASIC_BLOCK(j)->succ; e; e = e->succ_next)
	      if (e->dest == loop->header
		  && e->src == loop->latch)
		{
		  header_found = 1;
		  predict_edge_def (e, PRED_LOOP_BRANCH, TAKEN);
		}

	    /* Loop exit heuristics - predict an edge exiting the loop if the
	       conditinal has no loop header successors as not taken.  */
	    if (!header_found)
	      for (e = BASIC_BLOCK(j)->succ; e; e = e->succ_next)
		if (e->dest->index < 0
		    || !TEST_BIT (loop->nodes, e->dest->index))
		  predict_edge
		    (e, PRED_LOOP_EXIT,
		     (REG_BR_PROB_BASE
		      - predictor_info [(int) PRED_LOOP_EXIT].hitrate)
		     / exits);
	  }
    }

  /* Attempt to predict conditional jumps using a number of heuristics.  */
  for (i = 0; i < n_basic_blocks; i++)
    {
      basic_block bb = BASIC_BLOCK (i);
      rtx last_insn = bb->end;
      rtx cond, earliest;
      edge e;

      /* If block has no successor, predict all possible paths to it as
         improbable, as the block contains a call to a noreturn function and
         thus can be executed only once.  */
      if (bb->succ == NULL && !found_noreturn)
	{
	  int y;

	  /* ??? Postdominator claims each noreturn block to be postdominated
	     by each, so we need to run only once.  This needs to be changed
	     once postdominace algorithm is updated to say something more
	     sane.  */
	  found_noreturn = 1;
	  for (y = 0; y < n_basic_blocks; y++)
	    if (!TEST_BIT (post_dominators[y], i))
	      for (e = BASIC_BLOCK (y)->succ; e; e = e->succ_next)
		if (e->dest->index >= 0
		    && TEST_BIT (post_dominators[e->dest->index], i))
		  predict_edge_def (e, PRED_NORETURN, NOT_TAKEN);
	}

      if (GET_CODE (last_insn) != JUMP_INSN || ! any_condjump_p (last_insn))
	continue;

      for (e = bb->succ; e; e = e->succ_next)
	{
	  /* Predict edges to blocks that return immediately to be
	     improbable.  These are usually used to signal error states.  */
	  if (e->dest == EXIT_BLOCK_PTR
	      || (e->dest->succ && !e->dest->succ->succ_next
		  && e->dest->succ->dest == EXIT_BLOCK_PTR))
	    predict_edge_def (e, PRED_ERROR_RETURN, NOT_TAKEN);

	  /* Look for block we are guarding (ie we dominate it,
	     but it doesn't postdominate us).  */
	  if (e->dest != EXIT_BLOCK_PTR && e->dest != bb
	      && TEST_BIT (dominators[e->dest->index], e->src->index)
	      && !TEST_BIT (post_dominators[e->src->index], e->dest->index))
	    {
	      rtx insn;

	      /* The call heuristic claims that a guarded function call
		 is improbable.  This is because such calls are often used
		 to signal exceptional situations such as printing error
		 messages.  */
	      for (insn = e->dest->head; insn != NEXT_INSN (e->dest->end);
		   insn = NEXT_INSN (insn))
		if (GET_CODE (insn) == CALL_INSN
		    /* Constant and pure calls are hardly used to signalize
		       something exceptional.  */
		    && ! CONST_OR_PURE_CALL_P (insn))
		  {
		    predict_edge_def (e, PRED_CALL, NOT_TAKEN);
		    break;
		  }
	    }
	}

      cond = get_condition (last_insn, &earliest);
      if (! cond)
	continue;

      /* Try "pointer heuristic."
	 A comparison ptr == 0 is predicted as false.
	 Similarly, a comparison ptr1 == ptr2 is predicted as false.  */
      if (GET_RTX_CLASS (GET_CODE (cond)) == '<'
	  && ((REG_P (XEXP (cond, 0)) && REG_POINTER (XEXP (cond, 0)))
	      || (REG_P (XEXP (cond, 1)) && REG_POINTER (XEXP (cond, 1)))))
	{
	  if (GET_CODE (cond) == EQ)
	    predict_insn_def (last_insn, PRED_POINTER, NOT_TAKEN);
	  else if (GET_CODE (cond) == NE)
	    predict_insn_def (last_insn, PRED_POINTER, TAKEN);
	}
      else

      /* Try "opcode heuristic."
	 EQ tests are usually false and NE tests are usually true. Also,
	 most quantities are positive, so we can make the appropriate guesses
	 about signed comparisons against zero.  */
	switch (GET_CODE (cond))
	  {
	  case CONST_INT:
	    /* Unconditional branch.  */
	    predict_insn_def (last_insn, PRED_UNCONDITIONAL,
			      cond == const0_rtx ? NOT_TAKEN : TAKEN);
	    break;

	  case EQ:
	  case UNEQ:
	    /* Floating point comparisons appears to behave in a very
	       inpredictable way because of special role of = tests in
	       FP code.  */
	    if (FLOAT_MODE_P (GET_MODE (XEXP (cond, 0))))
	      ;
	    /* Comparisons with 0 are often used for booleans and there is
	       nothing usefull to predict about them.  */
	    else if (XEXP (cond, 1) == const0_rtx
		     || XEXP (cond, 0) == const0_rtx)
	      ;
	    else
	      predict_insn_def (last_insn, PRED_OPCODE_NONEQUAL, NOT_TAKEN);
	    break;

	  case NE:
	  case LTGT:
	    /* Floating point comparisons appears to behave in a very
	       inpredictable way because of special role of = tests in
	       FP code.  */
	    if (FLOAT_MODE_P (GET_MODE (XEXP (cond, 0))))
	      ;
	    /* Comparisons with 0 are often used for booleans and there is
	       nothing usefull to predict about them.  */
	    else if (XEXP (cond, 1) == const0_rtx
		     || XEXP (cond, 0) == const0_rtx)
	      ;
	    else
	      predict_insn_def (last_insn, PRED_OPCODE_NONEQUAL, TAKEN);
	    break;

	  case ORDERED:
	    predict_insn_def (last_insn, PRED_FPOPCODE, TAKEN);
	    break;

	  case UNORDERED:
	    predict_insn_def (last_insn, PRED_FPOPCODE, NOT_TAKEN);
	    break;

	  case LE:
	  case LT:
	    if (XEXP (cond, 1) == const0_rtx || XEXP (cond, 1) == const1_rtx
		|| XEXP (cond, 1) == constm1_rtx)
	      predict_insn_def (last_insn, PRED_OPCODE_POSITIVE, NOT_TAKEN);
	    break;

	  case GE:
	  case GT:
	    if (XEXP (cond, 1) == const0_rtx || XEXP (cond, 1) == const1_rtx
		|| XEXP (cond, 1) == constm1_rtx)
	      predict_insn_def (last_insn, PRED_OPCODE_POSITIVE, TAKEN);
	    break;

	  default:
	    break;
	  }
    }

  /* Attach the combined probability to each conditional jump.  */
  for (i = 0; i < n_basic_blocks; i++)
    if (GET_CODE (BLOCK_END (i)) == JUMP_INSN
	&& any_condjump_p (BLOCK_END (i)))
      combine_predictions_for_insn (BLOCK_END (i), BASIC_BLOCK (i));

  sbitmap_vector_free (post_dominators);
  sbitmap_vector_free (dominators);

  estimate_bb_frequencies (loops_info);
}

/* __builtin_expect dropped tokens into the insn stream describing expected
   values of registers.  Generate branch probabilities based off these
   values.  */

void
expected_value_to_br_prob ()
{
  rtx insn, cond, ev = NULL_RTX, ev_reg = NULL_RTX;

  for (insn = get_insns (); insn ; insn = NEXT_INSN (insn))
    {
      switch (GET_CODE (insn))
	{
	case NOTE:
	  /* Look for expected value notes.  */
	  if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_EXPECTED_VALUE)
	    {
	      ev = NOTE_EXPECTED_VALUE (insn);
	      ev_reg = XEXP (ev, 0);
	      delete_insn (insn);
	    }
	  continue;

	case CODE_LABEL:
	  /* Never propagate across labels.  */
	  ev = NULL_RTX;
	  continue;

	case JUMP_INSN:
	  /* Look for simple conditional branches.  If we haven't got an
	     expected value yet, no point going further.  */
	  if (GET_CODE (insn) != JUMP_INSN || ev == NULL_RTX
	      || ! any_condjump_p (insn))
	    continue;
	  break;

	default:
	  /* Look for insns that clobber the EV register.  */
	  if (ev && reg_set_p (ev_reg, insn))
	    ev = NULL_RTX;
	  continue;
	}

      /* Collect the branch condition, hopefully relative to EV_REG.  */
      /* ???  At present we'll miss things like
		(expected_value (eq r70 0))
		(set r71 -1)
		(set r80 (lt r70 r71))
		(set pc (if_then_else (ne r80 0) ...))
	 as canonicalize_condition will render this to us as
		(lt r70, r71)
	 Could use cselib to try and reduce this further.  */
      cond = XEXP (SET_SRC (pc_set (insn)), 0);
      cond = canonicalize_condition (insn, cond, 0, NULL, ev_reg);
      if (! cond || XEXP (cond, 0) != ev_reg
	  || GET_CODE (XEXP (cond, 1)) != CONST_INT)
	continue;

      /* Substitute and simplify.  Given that the expression we're
	 building involves two constants, we should wind up with either
	 true or false.  */
      cond = gen_rtx_fmt_ee (GET_CODE (cond), VOIDmode,
			     XEXP (ev, 1), XEXP (cond, 1));
      cond = simplify_rtx (cond);

      /* Turn the condition into a scaled branch probability.  */
      if (cond != const_true_rtx && cond != const0_rtx)
	abort ();
      predict_insn_def (insn, PRED_BUILTIN_EXPECT,
		        cond == const_true_rtx ? TAKEN : NOT_TAKEN);
    }
}

/* This is used to carry information about basic blocks.  It is
   attached to the AUX field of the standard CFG block.  */

typedef struct block_info_def
{
  /* Estimated frequency of execution of basic_block.  */
  volatile double frequency;

  /* To keep queue of basic blocks to process.  */
  basic_block next;

  /* True if block needs to be visited in prop_freqency.  */
  int tovisit:1;

  /* Number of predecessors we need to visit first.  */
  int npredecessors;
} *block_info;

/* Similar information for edges.  */
typedef struct edge_info_def
{
  /* In case edge is an loopback edge, the probability edge will be reached
     in case header is.  Estimated number of iterations of the loop can be
     then computed as 1 / (1 - back_edge_prob).

     Volatile is needed to avoid differences in the optimized and unoptimized
     builds on machines where FP registers are wider than double.  */
  volatile double back_edge_prob;
  /* True if the edge is an loopback edge in the natural loop.  */
  int back_edge:1;
} *edge_info;

#define BLOCK_INFO(B)	((block_info) (B)->aux)
#define EDGE_INFO(E)	((edge_info) (E)->aux)

/* Helper function for estimate_bb_frequencies.
   Propagate the frequencies for loops headed by HEAD.  */

static void
propagate_freq (head)
     basic_block head;
{
  basic_block bb = head;
  basic_block last = bb;
  edge e;
  basic_block nextbb;
  int n;

  /* For each basic block we need to visit count number of his predecessors
     we need to visit first.  */
  for (n = 0; n < n_basic_blocks; n++)
    {
      basic_block bb = BASIC_BLOCK (n);
      if (BLOCK_INFO (bb)->tovisit)
	{
	  int count = 0;

	  for (e = bb->pred; e; e = e->pred_next)
	    if (BLOCK_INFO (e->src)->tovisit && !(e->flags & EDGE_DFS_BACK))
	      count++;
	    else if (BLOCK_INFO (e->src)->tovisit
		     && rtl_dump_file && !EDGE_INFO (e)->back_edge)
	      fprintf (rtl_dump_file,
		       "Irreducible region hit, ignoring edge to %i->%i\n",
		       e->src->index, bb->index);
	  BLOCK_INFO (bb)->npredecessors = count;
	}
    }

  BLOCK_INFO (head)->frequency = 1;
  for (; bb; bb = nextbb)
    {
      double cyclic_probability = 0, frequency = 0;

      nextbb = BLOCK_INFO (bb)->next;
      BLOCK_INFO (bb)->next = NULL;

      /* Compute frequency of basic block.  */
      if (bb != head)
	{
#ifdef ENABLE_CHECKING
	  for (e = bb->pred; e; e = e->pred_next)
	    if (BLOCK_INFO (e->src)->tovisit && !(e->flags & EDGE_DFS_BACK))
	      abort ();
#endif

	  for (e = bb->pred; e; e = e->pred_next)
	    if (EDGE_INFO (e)->back_edge)
	      cyclic_probability += EDGE_INFO (e)->back_edge_prob;
	    else if (!(e->flags & EDGE_DFS_BACK))
	      frequency += (e->probability
			    * BLOCK_INFO (e->src)->frequency /
			    REG_BR_PROB_BASE);

	  if (cyclic_probability > 1.0 - 1.0 / REG_BR_PROB_BASE)
	    cyclic_probability = 1.0 - 1.0 / REG_BR_PROB_BASE;

	  BLOCK_INFO (bb)->frequency = frequency / (1 - cyclic_probability);
	}

      BLOCK_INFO (bb)->tovisit = 0;

      /* Compute back edge frequencies.  */
      for (e = bb->succ; e; e = e->succ_next)
	if (e->dest == head)
	  EDGE_INFO (e)->back_edge_prob
	    = ((e->probability * BLOCK_INFO (bb)->frequency)
	       / REG_BR_PROB_BASE);

      /* Propagate to successor blocks.  */
      for (e = bb->succ; e; e = e->succ_next)
	if (!(e->flags & EDGE_DFS_BACK)
	    && BLOCK_INFO (e->dest)->npredecessors)
	  {
	    BLOCK_INFO (e->dest)->npredecessors--;
	    if (!BLOCK_INFO (e->dest)->npredecessors)
	      {
		if (!nextbb)
		  nextbb = e->dest;
		else
		  BLOCK_INFO (last)->next = e->dest;

		last = e->dest;
	      }
	   }
    }
}

/* Estimate probabilities of loopback edges in loops at same nest level.  */

static void
estimate_loops_at_level (first_loop)
     struct loop *first_loop;
{
  struct loop *l, *loop = first_loop;

  for (loop = first_loop; loop; loop = loop->next)
    {
      int n;
      edge e;

      estimate_loops_at_level (loop->inner);

      /* Find current loop back edge and mark it.  */
      for (e = loop->latch->succ; e->dest != loop->header; e = e->succ_next)
	;

      EDGE_INFO (e)->back_edge = 1;

      /* In case the loop header is shared, ensure that it is the last
	 one sharing the same header, so we avoid redundant work.  */
      if (loop->shared)
	{
	  for (l = loop->next; l; l = l->next)
	    if (l->header == loop->header)
	      break;

	  if (l)
	    continue;
	}

      /* Now merge all nodes of all loops with given header as not visited.  */
      for (l = loop->shared ? first_loop : loop; l != loop->next; l = l->next)
	if (loop->header == l->header)
	  EXECUTE_IF_SET_IN_SBITMAP (l->nodes, 0, n,
				     BLOCK_INFO (BASIC_BLOCK (n))->tovisit = 1
				     );

      propagate_freq (loop->header);
    }
}

/* Convert counts measured by profile driven feedback to frequencies.  */

static void
counts_to_freqs ()
{
  HOST_WIDEST_INT count_max = 1;
  int i;

  for (i = 0; i < n_basic_blocks; i++)
    count_max = MAX (BASIC_BLOCK (i)->count, count_max);

  for (i = -2; i < n_basic_blocks; i++)
    {
      basic_block bb;

      if (i == -2)
	bb = ENTRY_BLOCK_PTR;
      else if (i == -1)
	bb = EXIT_BLOCK_PTR;
      else
	bb = BASIC_BLOCK (i);

      bb->frequency = (bb->count * BB_FREQ_MAX + count_max / 2) / count_max;
    }
}

/* Return true if function is likely to be expensive, so there is no point to
   optimize performance of prologue, epilogue or do inlining at the expense
   of code size growth.  THRESHOLD is the limit of number of isntructions
   function can execute at average to be still considered not expensive.  */

bool
expensive_function_p (threshold)
	int threshold;
{
  unsigned int sum = 0;
  int i;
  unsigned int limit;

  /* We can not compute accurately for large thresholds due to scaled
     frequencies.  */
  if (threshold > BB_FREQ_MAX)
    abort ();

  /* Frequencies are out of range.  This either means that function contains
     internal loop executing more than BB_FREQ_MAX times or profile feedback
     is available and function has not been executed at all.  */
  if (ENTRY_BLOCK_PTR->frequency == 0)
    return true;

  /* Maximally BB_FREQ_MAX^2 so overflow won't happen.  */
  limit = ENTRY_BLOCK_PTR->frequency * threshold;
  for (i = 0; i < n_basic_blocks; i++)
    {
      basic_block bb = BASIC_BLOCK (i);
      rtx insn;

      for (insn = bb->head; insn != NEXT_INSN (bb->end);
	   insn = NEXT_INSN (insn))
	if (active_insn_p (insn))
	  {
	    sum += bb->frequency;
	    if (sum > limit)
	      return true;
	}
    }

  return false;
}

/* Estimate basic blocks frequency by given branch probabilities.  */

static void
estimate_bb_frequencies (loops)
     struct loops *loops;
{
  int i;
  double freq_max = 0;

  mark_dfs_back_edges ();
  if (flag_branch_probabilities)
    {
      counts_to_freqs ();
      return;
    }

  /* Fill in the probability values in flowgraph based on the REG_BR_PROB
     notes.  */
  for (i = 0; i < n_basic_blocks; i++)
    {
      rtx last_insn = BLOCK_END (i);
      int probability;
      edge fallthru, branch;

      if (GET_CODE (last_insn) != JUMP_INSN || !any_condjump_p (last_insn)
	  /* Avoid handling of conditional jumps jumping to fallthru edge.  */
	  || BASIC_BLOCK (i)->succ->succ_next == NULL)
	{
	  /* We can predict only conditional jumps at the moment.
	     Expect each edge to be equally probable.
	     ?? In the future we want to make abnormal edges improbable.  */
	  int nedges = 0;
	  edge e;

	  for (e = BASIC_BLOCK (i)->succ; e; e = e->succ_next)
	    {
	      nedges++;
	      if (e->probability != 0)
		break;
	    }
	  if (!e)
	    for (e = BASIC_BLOCK (i)->succ; e; e = e->succ_next)
	      e->probability = (REG_BR_PROB_BASE + nedges / 2) / nedges;
	}
      else
	{
	  probability = INTVAL (XEXP (find_reg_note (last_insn,
						     REG_BR_PROB, 0), 0));
	  fallthru = BASIC_BLOCK (i)->succ;
	  if (!fallthru->flags & EDGE_FALLTHRU)
	    fallthru = fallthru->succ_next;
	  branch = BASIC_BLOCK (i)->succ;
	  if (branch->flags & EDGE_FALLTHRU)
	    branch = branch->succ_next;

	  branch->probability = probability;
	  fallthru->probability = REG_BR_PROB_BASE - probability;
	}
    }

  ENTRY_BLOCK_PTR->succ->probability = REG_BR_PROB_BASE;

  /* Set up block info for each basic block.  */
  alloc_aux_for_blocks (sizeof (struct block_info_def));
  alloc_aux_for_edges (sizeof (struct edge_info_def));
  for (i = -2; i < n_basic_blocks; i++)
    {
      edge e;
      basic_block bb;

      if (i == -2)
	bb = ENTRY_BLOCK_PTR;
      else if (i == -1)
	bb = EXIT_BLOCK_PTR;
      else
	bb = BASIC_BLOCK (i);

      BLOCK_INFO (bb)->tovisit = 0;
      for (e = bb->succ; e; e = e->succ_next)
	EDGE_INFO (e)->back_edge_prob = ((double) e->probability
					 / REG_BR_PROB_BASE);
    }

  /* First compute probabilities locally for each loop from innermost
     to outermost to examine probabilities for back edges.  */
  estimate_loops_at_level (loops->tree_root);

  /* Now fake loop around whole function to finalize probabilities.  */
  for (i = 0; i < n_basic_blocks; i++)
    BLOCK_INFO (BASIC_BLOCK (i))->tovisit = 1;

  BLOCK_INFO (ENTRY_BLOCK_PTR)->tovisit = 1;
  BLOCK_INFO (EXIT_BLOCK_PTR)->tovisit = 1;
  propagate_freq (ENTRY_BLOCK_PTR);

  for (i = 0; i < n_basic_blocks; i++)
    if (BLOCK_INFO (BASIC_BLOCK (i))->frequency > freq_max)
      freq_max = BLOCK_INFO (BASIC_BLOCK (i))->frequency;

  for (i = -2; i < n_basic_blocks; i++)
    {
      basic_block bb;
      volatile double tmp;

      if (i == -2)
	bb = ENTRY_BLOCK_PTR;
      else if (i == -1)
	bb = EXIT_BLOCK_PTR;
      else
	bb = BASIC_BLOCK (i);

      /* ??? Prevent rounding differences due to optimization on x86.  */
      tmp = BLOCK_INFO (bb)->frequency * BB_FREQ_MAX;
      tmp /= freq_max;
      tmp += 0.5;
      bb->frequency = tmp;
    }

  free_aux_for_blocks ();
  free_aux_for_edges ();
}

redpajama_set_name: RedPajamaGithub


Since 1987, Carolina Construction, Inc. has assembled a wide portfolio of completed projects in the Pee Dee, Grand Strand, and southeastern North Carolina.. From new home construction, commercial and residential additions and remodeling, large-scale governmental projects, metal buildings,...the list goes on and on.
Each project is given the personal attention of one of our fully qualified Licensed General Contractors. Following (in no particular order) is a list of some of the projects we have completed over the last sixteen years. As you will see, many of our clients have employed us several times for different projects.
Interior demolition. New interior finishes, new plumbing, electrical systems, and mechanical systems.
Remove & replace finishes, hardware, and doors.
Complete exterior upgrade of an existing, occupied residential care facility. Remove and replace all exterior windows, doors, and soffits. Interior finishes as required. Care was given to preserve the comfort of the residents.
Expansion of Records Storage Facility. 5,100 sq.ft. addition. Foundations. Tie-in to existing structure.
(Hurricane, Dade County Protocols) Glass at City of Myrtle Beach Services Center. Two projects. A complete "walk-away" system of windows, doors and store fronts which meet all FEMA and insurance requirements for the Miami and Dade Counties Protocols. Opening protection is now required by IBC 2000.
Complete interior remodeling along with a new low-slope metal roof. Interior features all new electrical, mechanical, and plumbing. New construction also includes fire alarm and sprinkler system.
New addition to existing office building. Features heavy mouldings, stucco, EPDM roof, and a seamless tie into the existing building.
Complete remodeling of an existing historic building in downtown Southern Pines. Construction includes new canopy and concrete concourse. Interior will house retail space as well as train offices.
Interior renovation and build out. Exterior masonry stabalization. New plumbing, HVAC, and electrical systems.
New bank with three drive thru lanes. Wood framed with brick exterior.
Metal building assembly, Masonry structure, site work.
New Medical Facility, Site work, structural, architectural, P,M,E,interior finishes and casework.
Single family residence. Design Build. Turnkey. Complete ADA Compliant for Handicap Accessability.
Design/Build, structural, concrete flat work, carpentry.


text:
Q: rails device not keeping GET params I have one running rails app with device gem. I want pass some urls with params (in url) in email. when user click on it and if user is logged in everything works (ULR is like myhost.com/myaction?my_var=xx)
but if user is not logged in it redirects to sign in path. after giving credentials it lost my_var value and app breaks. (yes it goes to my action)
for now I am redirecting user to his dashboard with error msg but anyone have good solution?

A: You are able to overwrite the default Devise behavior after a successful authentication by defining the after_sign_in_path_for method in your ApplicationController:
  def after_sign_in_path_for(resource)
    session[:stored_path] || stored_location_for(resource) || root_path
  end

In this example Devise will check whether the session[:stored_path] is set, if not it will try to load the stored_location_for(resource) path and as a fail save it will eventually redirect_to the root_path.
In this case you'll need to set the session[:stored_path] upon redirect when the current_user isn't logged in.

redpajama_set_name: RedPajamaStackExchange


Comparison of Kinematics and Tibiofemoral Contact Pressures for Native and Transplanted Lateral Menisci.
Does High Knee Flexion Cause Separation of Meniscal Repairs?
Does Gender Explain the Variability of Patello-Femoral Morphology Observed in TKR?
Partial Tears of the Anterior Cruciate Ligament. Are They Clinically Detectable?


text:
The Surprising Health Effects of Daylight Saving Time
Staying up late or waking up early might seem like no big deal for most of us. But for some, losing just one hour of sleep due to daylight saving time could have a lasting effect on health and well-being.
When daylight saving time starts in March, clocks "spring forward" by 60 minutes. But when DST ends the first Sunday in November, clocks are turned back, meaning less daylight during waking hours.
Jennifer Wolkin, a clinical neuropsychologist who specializes in stress reduction and mental health, says both adjustments can throw off sleep.
"The loss of just a single hour of sleep takes a physical toll on our bodies," says Wolkin. "Our internal clocks, often called our circadian rhythms, are scrambling to adjust to changes in our principal time cue: light."
In other words, when the time changes in the spring and fall, our circadian rhythms are thrown off, resulting in increased stress and poor quality sleep. This, in turn, leads to things like poor work performance, increased hunger, and general unhappiness, according to a 2012 study from the Journal of Applied Psychology. According to another 2014 study from Economics Letters, researchers found that the time change left employees tired and stressed, which negatively impacted workplace performance and overall life satisfaction.
This disruption can be particularly dangerous in the fall, says Wolkin.
"[The start of] daylight saving time at least offers the advent of spring and summer, with its warm temps and light evenings," she says. "It's a time when people become more active and more social, both of which are key for fostering overall wellness."
But in fall months, even though falling back means we gain an extra hour of sleep, "we are on the cusp of cold and dark winter days, which don't offer the same kind of accessibility and willingness for exercise and socializing." Rates of seasonal affective disorder, anxiety, and depression also climb during the fall, says Wolkin. Falling back due to DST means waking when it's darker out, and could trigger or worsen some of these seasonal issues.
But spring isn't much safer, science shows. Researchers have found an uptick in car crashes, workplace accidents, and cardiovascular incidents such as heart attacks and strokes, directly after the start of DST in the spring. Apparently, people with underlying health problems are more susceptible to the stress that is kicked off by the time change. In a 2012 study from the University of Alabama at Birmingham, researchers found that heart attacks actually increased by about 10 percent in the week after DST started in the spring.
After a "period of adjustment" of about a week, the health issues—sleep disruption, moodiness, poor work performance, cardiovascular problems—returned to normal, says Wolkin. In the meantime, she encourages patients to take extra care of themselves, particularly in the fall. Regular exercise, talk therapy, and mood lamps can all help patients who struggle to adjust to the time change.
Like diet and exercise, quality sleep is essential for optimal health and performance. Because everyone's sleep needs are different, Sleep Number® beds with SleepIQ® technology inside adjust to your ideal level of firmness, comfort and support. SleepIQ technology tracks how well you sleep each night, giving you personal insights into your sleep so you'll learn how life affects your sleep and how sleep affects your life. Find your Sleep Number® setting for your best possible night's sleep.
Daylight Saving Time: Help Pets Adjust
Feeling the Drag of Daylight Saving Time?
It's Time You Knew: Daylight Saving Time Myths Revealed

redpajama_set_name: RedPajamaCommonCrawl


text:
Great outdoors inspires summer course line-up
April 2, 2018 | by KAI BRITO
As UW-Madison students anxiously await registration for their summer courses, the Nelson Institute has announced their lineup for anyone interested in courses that are a little different. These courses focus not only on international geography and policy, but also make use of the outdoors as a non-traditional classroom setting to encourage students to explore and engage with the natural world.
While the course "Outdoors for All" doesn't have an official field component, it does encourage students to make use of the public land system and think broadly about access to the outdoors. James Edward Mills is a prominent outdoors author, filmmaker and manager of his own media site The Joy Trip Project. His course seeks to explore the racial inequities of the environmental conservation movement and the efforts that aim to correct them.
In his reporting, Mills has encountered numerous non-white adventurers and explorers who've had previously neglected outdoors recreation because they felt like those spaces weren't meant for them. As he further explored this issue, he found this was part of a larger historical inequity. He hopes to promote an understanding of why minority groups feel unwelcome and encourage individuals to share their story of why nature matters to them.
"For many years now, I've put a great deal of thought into understanding why there is an apparent disparity between those who spend time in nature and those who don't," Mills said. "I want to explore this phenomenon in an academic setting with students so that we can perhaps come to a better understanding of what I describe as 'the adventure gap.' "
These courses also have focus on the natural world beyond the United States, with a particular focus on a new international partnership the Nelson Institute has been cultivating with Botswana. "Botswana: Ecology and Environment" is a new course that will focus on an African country seen as a leader in conservation policies. This seminar-type course will explore the ecology of this unique region and consider its past and present policies for preserving its valuable natural heritage. It will be taught by Dr. Cooper Rosin, postdoctoral researcher at the Nelson Institute with experience in Central Africa and the challenges of human populations coexisting with diverse natural ecosystems.
"Conservation work in tropical countries like Botswana is particularly important given that much of Earth's biodiversity is found there," Rosin said. "Botswana as a nation offers so much potential for us to better understand our natural world and contribute to its preservation, while promoting sustainable development."
This course also comes at a very opportune time when joint UW-Botswanan projects are currently taking place, as the keynote for the Nelson 2018 Earth Day Conference in April will be presented by the Honorable Tshekdi Khama II, the Minister for Environment, Wildlife and Tourism and Member of Parliament for Botswana.
In addition, several new courses have been introduced to the summer roster, including "Preserving Nature," "Cultures of Disaster" and "Science and Practice of Prescribed Fire." These courses range from 1-3 credits of both elementary and intermediate/advanced designations across humanities, literature and biological sciences.
The courses include online options for off-campus students that may be completing an internship or travelling over the summer. Alternatively, there are also opportunities for field exploration of the local outdoors in both the prairie fire course and field ecology laboratory.


This book explores the utopian imagination in contemporary American poetry and the ways in which experimental poets formulate a utopian poetics by adopting the rhetorical principles of negative theology, which proposes using negative statements as a means of attesting to the superior, unrepresentable being of God. With individual chapters on works by such poets as Susan Howe, Nathaniel Mackey, Charles Bernstein, and Alice Notley, this book illustrates how a strategy of negation similarly proves optimal for depicting the subject of utopia in literary works.
Negative Theology and Utopian Thought in Contemporary American Poetry: Determined Negations contends that negative statements in experimental poetry illustrate the potential for utopian social change, not by portraying an ideal world itself but by revealing the very challenge of representing utopia directly.


text:
NGC 6827 is een open sterrenhoop in het sterrenbeeld Vosje. Het hemelobject werd op 16 oktober 1878 ontdekt door de Franse astronoom Édouard Jean-Marie Stephan.

Synoniemen
 OCL 120

Zie ook
 Lijst van NGC-objecten

Externe links
  NASA/IPAC Extragalactic Database
  SIMBAD Astronomical Database
  SEDS

NGC-object in Vosje
Open sterrenhoop

redpajama_set_name: RedPajamaWikipedia


Perler beads—the small plastic beads that fuse together when ironed—were a favorite craft project material with Em and Dan for years, especially when they were younger. For a while we had stacks of the melted bead designs the size of coasters lying around, but attempts at more elaborate constructions proved difficult to execute without breakage. That's why French designer Sabine Ducasse's Melting Pot fashions are that much more impressive to us.
Ducasse used the beads to create East-meets-West armor style fashion; a melting pot of cultures with a literal take on "melting". These amazingly well-crafted pixelated design pieces won the designer a scholarship at the International Fashion Academy. Nice!
This entry was posted in Art, Fashion, Just Plain Cool, Pop Culture, Stuff We Like. Bookmark the permalink.


text:
CubeSmart Recognized as Champion of Board Diversity by Forum of Executive Women
PRESS RELEASE GlobeNewswire
Oct. 21, 2020, 04:05 PM
MALVERN, Pa., Oct. 21, 2020 (GLOBE NEWSWIRE) -- Today, CubeSmart (NYSE: CUBE), the third-largest owner and operator of self-storage properties in the United States, was named as a Champion of Board Diversity by the Forum of Executive Women. The award recognizes companies in the greater Philadelphia region whose corporate boards are composed of at least 30% women. This is the fifth time CubeSmart has been recognized for this honor.
"We believe our business is better because of the diversity of participation, thought, and action that comes from the unique individuals who work with us, starting with our board and carrying through to every CubeSmart teammate," said Christopher P. Marr, President and Chief Executive Officer of CubeSmart. "It's an honor to be recognized for the gender diversity at our board level. We take great pride in embracing both what makes us different, as well as the qualities that we collectively share as a CubeSmart team."
CubeSmart and other Philadelphia-area companies were featured in the Forum's annual report, Women in Leadership, which measures progress of women leaders in the region. This year's report noted that, for the first time ever, women are holding more than 20% of total board seats. 17 companies were recognized as Champions of Board Diversity.
The Forum of Executive Women is a membership organization of more than 450 women executive leaders across the Greater Philadelphia region.
About CubeSmart
CubeSmart is a self-administered and self-managed real estate investment trust. CubeSmart owns or manages 1,257 self-storage properties across the United States. According to the 2020 Self Storage Almanac, CubeSmart is one of the top three owners and operators of self-storage properties in the U.S.
The Company's mission is to simplify the organizational and logistical challenges created by the many life events and business needs of its customers – through innovative solutions, unparalleled service, and genuine care. The Company's self-storage properties are designed to offer affordable, easily accessible, and, in most locations, climate-controlled storage space for residential and commercial customers.
For more information about business and personal storage or to learn more about the Company and find a nearby storage property, visit www.cubesmart.com or call CubeSmart toll free at 800-800-1717.
Josh Schutzer
Senior Director, Finance
Markets Insider and Business Insider Editorial Teams were not involved in the creation of this post.
SEE ALSO: Goldman Sachs says stocks face a growing risk of correction - but recommends investors buy any dip amid low bear-market odds »
READ NOW: The Biden rescue plan could boost 2021 GDP growth to 11.4%, JPMorgan global chief strategist says »
CubeSmart NewsMORE
Life Storage, National Storage get upgrades as BMO sees sector growth in '21
Seeking Alpha 11d
CubeSmart Announces 3.0% Increase in Quarterly Common Dividend
GlobeNewswire 42d
CubeSmart increases dividend by 3% to $0.34
Stifel goes bullish on CubeSmart stock, citing positive momentum
CubeSmart (CUBE) Q3 2020 Earnings Call Transcript
MotleyFool 74d
CubeSmart Reports Third Quarter 2020 Results
CubeSmart hosts conference call for investors
Notable earnings after Thursday's close
Get real-time CUBE charts here >>


Social media can be a powerful and inexpensive tool for pushing your brand on social media, whether you're promoting a coffee shop, a charity, a cryptocurrency, or yourself and your own inimitable wardrobe. Fast and cheap broadband has allowed your brand to enter the screens and consciousnesses of nearly every potential customer in the UK, without the expense of creating a TV spot or paying for a newspaper ad.
But it's easy to stumble: to target the wrong audience; choose the wrong influencers; even use the wrong platform, one that doesn't gel with the brand image you want to create.
At best you might create content that generates little attention, that simply vanishes into the never-ending scroll of a newsfeed, registering no likes, no hits, and no sales. At worse, you could attract the ire of commentators and trigger a backlash that can permanently tarnish you brand.
In traditional media all publicity might be good publicity, and even if it's not, your TV spot, once pulled, will never air again and yesterday's newspaper advert is lining today's rabbit cage. But on the internet, infamy is forever. Go viral for the wrong reasons, or stumble publicly while trying to do so, and you may never outrun the shame. Time to delete your accounts, rebrand, and maybe change your name.
Before you throw tons of cash into video or agonise for hours over an Instagram filter—you know, the fun stuff on social media—it helps to get the basics of social media marketing down.
Facebook: 44% of the UK population uses Facebook once a day. In fact, it's reach is so great, transcending nearly all barriers of age, that only 21% of UK internet users don't use the site. That means Facebook is perfect for reaching a huge swath of the population and creating brand recognition.
Instagram plays host to a bevvy of fashion-conscious influencers and aspirants. Its focus on images mean it's a natural for promoting clothing and lifestyle brands, or other products that look great in photographs.
Twitter: If your brand traffics in irreverence, you can gain some traction with quick comebacks and memes on Twitter. Be sure snappy repartee suits the image you wish to create, however. What would be a good look for a hip new restaurant wouldn't suit a charity or NGO.
LinkedIn is a B2B network that allows you to connect with business owners and employees while they're in a work headspace—and not scrolling for recipes.
On these platforms, you're competing for eyes and engagement with four newborns, six colourful breakfasts with avocado, and 17 influencers styling the same Topshop skirt. Your content, whether images, videos, texts, or memes, needs to pop, prompting likes and shares and making people remember: you and your product and not their four friends who got engaged over the weekend.
Increasingly, text is buried on social networks; great images draw clicks. Don't slough off text all together, but don't be afraid to complement your stunning, well-crafted copy with a photo. On Twitter, just 10% of all content has a photo but it prompts nearly half of all engagement on the site.
Realistically, your brand will operate across multiple social network. Develop a consistent visual identity, using the same colour palette, fonts, logo, and image across Facebook, Instagram, Twitter and the rest. What do you think of when you think of Coca Cola? Red and white and a swirly cursive font—and maybe some Christmas polar bears. You want your brand to conjure up the same consistent image in your customer's minds, so when they see a flash of your chosen green on Twitter, they know you're their favourite purveyor of soap/terrariums/insurance from Facebook. Furthermore, it's a shortcut to looking professional, without shelling out thousands to an advertising company.
You don't have to be churning out John Lewis Christmas ads every other day, but you should commit to a regular posting schedule of content. Keep yourself on the top of your audience's newsfeeds and you'll stick in their memory when it's time to make a purchase.


text:
MIPS pode se referir a:

 MIPS (medida) (Milhões de Instruções Por Segundo), uma medida de desempenho obsoleta em Informática
 Arquitetura MIPS, uma arquitetura RISC de microprocessadores
 MIPS Technologies, empresa que desenvolveu a arquitetura MIPS.
 Medicamento de venda livre - Medicamentos isentos de prescrição.

Desambiguação


text:
Quitte ou double est un film français réalisé par Robert Vernay, sorti en 1953.

Synopsis
A Bourganeuf, dans la Creuse, Charlotte Bourdier, une vieille bibliothécaire célibataire, a noué par correspondance une intrigue sentimentale avec Zappy Max, l'animateur de Radio circus. Mais elle l'a fait en envoyant à ce dernier la photo de Marie Chassagne, une jeune femme charmante. Zappy Max devant arriver bientôt dans la ville, elle va avouer la supercherie à Marie Chassagne en lui demandant de recevoir Zappy Max à sa place.
La rencontre a lieu et Zappy Max tombe amoureux de la jeune femme. Afin de venir en aide au père de Marie, Charlotte participe au jeu du Quitte ou double afin de gagner l'argent dont il a besoin. Et naturellement tout finit bien.

Fiche technique
 Titre : Quitte ou double
 Réalisation : Robert Vernay
 Scénario : René Wheeler
 Photographie : Victor Arménise
 Décors : Claude Bouxin
 Son : Émile Lagarde
 Musique : Norbert Glanzberg
 Montage : Hélène Basté
 Production : Michel Lézé
 Société de production : Olympic Films
 Pays d'origine :
 Format : Noir et blanc - 1,37:1 - 35 mm - Son mono
 Genre : comédie
 Durée : 83 minutes
 Date de sortie : France,

Distribution

Autour du film
 Dans le film, Zappy se rend de Bourganeuf à Bordeaux en voiture lors de la première partie du Radio Circus pour revenir juste à temps pour animer la seconde partie. Or, de nos jours, il faudrait pas moins de 7h pour faire l'aller-retour en voiture.

Liens externes

Film français sorti en 1953
Film français en noir et blanc
Comédie française
Film sur la radio
Film sur le cirque


text:
Tuesday, Dec 08 2009 • 11 a.m. (ET)
Roger G. Kennedy: "When Art Worked"
"Northern Minnesota Mine" by artist E. Dewey Albinson, born in Minneapolis, Minnesota in 1898; died in Mexico in 1971. Oil on canvas. Dewey produced this work under President Franklin D. Roosevelt's "Public Works of Art Project" (PWAP) designed to help foster artists' works for public buildings during the Great Depression. Courtesy of the Smithsonian American Art Museum/Flickr user americanartmuseum
How government programs to employ artists served the nation during the Great Depression and could offer a model for creating jobs today. Art and the New Deal.
Roger Kennedy Author and director emeritus of the National Museum of American History; former director of the National Park Service.


Michael Rasmussen & Associates has designed a CSR profile consisting of efficient techniques for recycling and minimization of energy consumption as evidenced by our label. As our client, you will benefit from our vast experience in recycling and editing of previously developed modules, which can save substantial production time and up to 50% of overall development costs. This also results in significant CO2 savings; a win-win situation for you, for us and for the nature.
As your trusted partner in social accountability, we are committed to ethical values, communities and protection of the natural environment. Michael & Associates including the word trademark Verio® and the recruiting section Talent Finder A/S ® meets the CSR adopted as law in 2008 and the UN GLOBAL COMPACT recommendations addressing social responsibility.
Michael Rasmussen & Associated Partners and related trademarks ® has a social responsibility covering human rights, social conditions, labour, the environment and climate. As your partner, our CSR approach integrates seamlessly with all your business goals and operations. We offers a suite of CSR solutions to ensure good social responsibility in both security and workplace conditions, ensuring that your organization and suppliers meet the requirements of tomorrow's employees, communities, investors and customers.
Contact Director Michael Rasmussen on +45 32177777 ext. 240 for more information about our Social Responsibility initiatives.
We can make web design and delivery of CSR for any industry or company type. The price is only 1.995,- including 1 hour talk about what to have on, who to support and so on.
Including in the price is the ability to select of 28 different CSR models in your country.


The typical American Tower Attorney salary is $64,809. Attorney salaries at American Tower can range from $58,095 - $96,356. This estimate is based upon 13 American Tower Attorney salary report(s) provided by employees or estimated based upon statistical methods. When factoring in bonuses and additional compensation, a Attorney at American Tower can expect to make an average total pay of $70,851 . See all Attorney salaries to learn how this stacks up in the market.


text:
if (( $+commands[kubectl] )); then
    __KUBECTL_COMPLETION_FILE="${ZSH_CACHE_DIR}/kubectl_completion"

    if [[ ! -f $__KUBECTL_COMPLETION_FILE ]]; then
        kubectl completion zsh >! $__KUBECTL_COMPLETION_FILE
    fi

    [[ -f $__KUBECTL_COMPLETION_FILE ]] && source $__KUBECTL_COMPLETION_FILE

    unset __KUBECTL_COMPLETION_FILE
fi

# This command is used a LOT both below and in daily life
alias k=kubectl

# Apply a YML file
alias kaf='kubectl apply -f'

# Drop into an interactive terminal on a container
alias keti='kubectl exec -ti'

# Manage configuration quickly to switch contexts between local, dev ad staging.
alias kcuc='kubectl config use-context'
alias kcsc='kubectl config set-context'
alias kcdc='kubectl config delete-context'
alias kccc='kubectl config current-context'

# Pod management.
alias kgp='kubectl get pods'
alias kep='kubectl edit pods'
alias kdp='kubectl describe pods'
alias kdelp='kubectl delete pods'

# Service management.
alias kgs='kubectl get svc'
alias kes='kubectl edit svc'
alias kds='kubectl describe svc'
alias kdels='kubectl delete svc'

# Ingress management
alias kgi='kubectl get ingress'
alias kei='kubectl edit ingress'
alias kdi='kubectl describe ingress'
alias kdeli='kubectl delete ingress'

# Secret management
alias kgsec='kubectl get secret'
alias kdsec='kubectl describe secret'
alias kdelsec='kubectl delete secret'

# Deployment management.
alias kgd='kubectl get deployment'
alias ked='kubectl edit deployment'
alias kdd='kubectl describe deployment'
alias kdeld='kubectl delete deployment'
alias ksd='kubectl scale deployment'
alias krsd='kubectl rollout status deployment'

# Rollout management.
alias kgrs='kubectl get rs'
alias krh='kubectl rollout history'
alias kru='kubectl rollout undo'

# Logs
alias kl='kubectl logs'
alias klf='kubectl logs -f'


What makes Q-Safe different from other quick couplers?
The requirement for the bucket to have ground contact is a unique function. Furthermore, either the slew or boom lift function is blocked if the bucket is not correctly connected.
Q-Safe is factory-fitted for EC-Oil – engcon's solution for connecting hydraulic tools automatically from the operator's position.
The standard Q-Safe quick hitch is delivered with a warning system that alerts the operator if the bucket or tool is not in full contact with the quick hitch. For further safety, there is an optional ground pressure function. QSC – Q-Safe Control – is also available to enable safe control of the excavator's and tiltrotator's quick hitch through a single control panel.


The American Civil War (1861–1865), also known as the War Between the States and several other names, was a civil war in the United States of America. Eleven Southern slave states declared their secession from the U.S. and formed the Confederate States of America (the Confederacy). Led by Jefferson Davis, they fought against the U.S. federal government (the Union), which was supported by all the free states and the five border slave states in the north.


Hi I'm Matt. I'm a man on a mission to help people.
To educate, train, and help you look, feel and perform better.
I'm a qualified Advanced Personal Trainer, Certified Bootcamp Instructor and a competitive top-level bodybuilder, competing and successfully winning shows on both a national and international level.
With over 20 years' experience inside the Health & Fitness industry I have gained a considerable amount of knowledge and expertise, supported by recognised qualifications, continuous personal development and self-study on health, nutrition and exercise science.
MaffaMuscleEvolution has evolved as the platform for me to showcase my services.
I have my own WABBA fitness qualifications training company for individuals wanting to gain world recognized qualifications in the fitness industry.
I run my own nutrition and exercise consultancy service .
I help clients to make life-changing transformations with their health and bodies.
I successfully coach numerous clients wishing to compete in bodybuilding and physique competitions.
I conduct personal training sessions in gyms around the Northamptonshire & Buckinghamshire areas.
If you can't come to me, then I can come to you and offer personal training sessions at home within a 20 mile radius.
I also run Bootcamp style training classes.
If you're are looking to increase your exposure across all social platforms. Then my videography company can do it all.
We work with all individuals, and companies looking to reach potential clients. Including singers, restaurants, tattoo shops, athletes, bodybuilders, models, gym owners, fitness event managers, supplement / apparel companies, coaches, educators or trainers.
Working alongside my close friend whom is also well respected in the industry Luke Nichols. Together we educate personal trainers each year through public seminars and workshops in advanced training techniques.
It is my mission to create opportunities and inspire and build healthier more meaningful lives.
Get in shape with our Tailored Fitness Programs.
A full service multi-media video production company.
© Copyright 2016 - MM EVOLUTION Ltd. All Rights Reserved.


text:
Offensive Woes Plague UH-Hilo Against #17 APU
February 28, 2016, 9:11 AM HST
Freshman Kim Schmelz drives against two Azusa Pacific defenders. UH-Hilo photo.
A streaky offense has been a make or break characteristic for the University of Hawai'i at Hilo all season long, and it showed up again on Saturday night against nationally-ranked Azusa Pacific University.
In its biggest game of the season, UH-Hilo was held to just 37.8 percent shooting, and its defense couldn't hold up enough to fend off Azusa Pacific. The Vulcans fell 64-47 to the Cougars, the 17th ranked team in the USA Today Division II Women's Basketball Coaches Poll.
Regardless of the result, UH-Hilo would have been eliminated from postseason contention. The Vulcans needed to win and get a victory from Chaminade over Point Loma Nazarene in a game that was happening simultaneously with the Vulcans' matchup. Point Loma, trailing for much of the game, surged ahead with less than two minutes remaining to push away the Silverswords to claim the sixth seed in next week's PacWest Conference tournament.
Azusa Pacific (25-3, 19-1 PacWest) claimed a share of the conference championship with California Baptist. A lengthy tiebreak scenario leaves the top seed for next week's conference tournament up in the air until the regional rankings are released on Wednesday. The team with the highest regional placement will get the top seed in the tourney, held on the campus of Concordia University in Irvine, Calif.
"I thought all game long, we played hard," said sixth-year UH-Hilo coach David Kaneshiro. "We didn't do a good job, especially at certain times, keeping them off the offensive glass, but we knew that would be a big part of the game."
In the first quarter, UH-Hilo's offense looked like the one that opened up Tuesday's game with Point Loma Nazarene on a 17-0 run. Guards were confidently shooting from the perimeter, and both teams were trading baskets and keeping the game close.
The flourishing offense didn't last much longer. Leading by two with just over seven minutes remaining in the half, UH-Hilo (10-15, 10-10) struggled to make shots. The Vulcans closed out the half shooting 0-for-7 from the floor with just one free throw made in that stretch. Add five turnovers to that mix, and that allowed Azusa Pacific to close out the first half on a 9-1 run, taking a 28-22 lead into the locker room.
"When we were down six at half, I thought we didn't attack their press very well, and that if we had done a better job, it would be a little bit different," Kaneshiro explained. "We didn't score well in the second quarter."
With the game too close for comfort going into the final two quarters, Azusa Pacific senior Kelly Hardemann took the game over. Foul trouble plagued her in the first half, holding her to just seven points. She broke the game open in the second half with 18 points in the final 20 minutes.
The other adjustment Azusa Pacific made was an emphasis on interior play, forcing its size and length on the UH-Hilo defense. The Cougars scored a total of 38 points in the paint to the Vulcans' 18, making up for a rough shooting performance from beyond the arc and from the free throw line. APU shot 3-for-17 from three-point range and 5-for-14 from the charity stripe, two places where the Cougars ranked near the top in the conference entering Saturday's game.
Three seniors made their final appearance in a UH-Hilo uniform. Felicia Kolb, arguably the team's most improved player, fouled out in a five-point, four-rebound performance. Guard Alia Alvarez scored two points in nine minutes, and Ashley Duyao, a sparsely-used guard from Gardena, Calif., played just two minutes.
Junior Vanessa Mancera led UH-Hilo with 15 points, but committed eight of the Vulcans' 23 turnovers.
Azusa Pacific 15 13 19 17 – 64
Hawai'i-Hilo 15 7 10 15 – 47


text:
'use strict';

var _ = require('underscore');
var config = require('../../config.json');

module.exports = _.extend({
  semTimetableFragment: function (semester) {
    return 'timetable/' + config.academicYear.replace('/', '-') +
      '/sem' + (semester || config.semester);
  }
}, config);


text:
'''
Created on Dec 14, 2010

Use this module to start Arelle in command line non-interactive mode

(This module can be a pattern for custom use of Arelle in an application.)

In this example a versioning report production file is read and used to generate
versioning reports, per Roland Hommes 2010-12-10

@author: Mark V Systems Limited
(c) Copyright 2010 Mark V Systems Limited, All rights reserved.

'''
from arelle import PythonUtil # define 2.x or 3.x string types
import time, datetime, os, gettext, io, sys, traceback
from lxml import etree
from optparse import OptionParser
from arelle import (Cntlr, ModelXbrl, ModelDocument, ModelVersReport, FileSource,
                    XmlUtil, XbrlConst, Version)
from arelle import xlrd
import logging

conformanceNS = "http://xbrl.org/2008/conformance"

def main():
    gettext.install("arelle") # needed for options messages
    usage = "usage: %prog [options]"
    parser = OptionParser(usage, version="Arelle(r) {0}".format(Version.version))
    parser.add_option("--excelfile", dest="excelfilename",
                      help=_("FILENAME is an excel 95-2003 index file containing columns: \n"
                             "Dir is a test directory, \n"
                             "fromURI is the fromDTS URI relative to test director, \n"
                             "toURI is the toDTS URI relative to test director, \n"
                             "Description is the goal of the test for testcase description, \n"
                             "Assignment is the business, technical, or errata classification, \n"
                             "Expected event is an event localName that is expected \n\n"
                             "Output files and testcases are located in filename's directory, \n"
                             "report files are generated in '/report' under fromURI's directory."))
    parser.add_option("--testfiledate", dest="testfiledate",
                      help=_("Date if desired to use (instead of today) in generated testcase elements."))
    (options, args) = parser.parse_args()
    try:
        CntlrGenVersReports().runFromExcel(options)
    except Exception as ex:
        print (ex, traceback.format_tb(sys.exc_info()[2]))

class CntlrGenVersReports(Cntlr.Cntlr):

    def __init__(self):
        super(CntlrGenVersReports, self).__init__()

    def runFromExcel(self, options):
        #testGenFileName = options.excelfilename
        testGenFileName = r"C:\Users\Herm Fischer\Documents\mvsl\projects\XBRL.org\conformance-versioning\trunk\versioningReport\conf\creation-index.xls"
        testGenDir = os.path.dirname(testGenFileName)
        schemaDir = os.path.dirname(testGenDir) + os.sep + "schema"
        timeNow = XmlUtil.dateunionValue(datetime.datetime.now())
        if options.testfiledate:
            today = options.testfiledate
        else:
            today = XmlUtil.dateunionValue(datetime.date.today())
        startedAt = time.time()

        LogHandler(self) # start logger

        self.logMessages = []
        logMessagesFile = testGenDir + os.sep + 'log-generation-messages.txt'

        modelTestcases = ModelXbrl.create(self.modelManager, url=testGenFileName, isEntry=True)
        testcaseIndexBook = xlrd.open_workbook(testGenFileName)
        testcaseIndexSheet = testcaseIndexBook.sheet_by_index(0)
        self.addToLog(_("[info] xls loaded in {0:.2} secs at {1}").format(time.time() - startedAt, timeNow))

        # start index file
        indexFiles = [testGenDir + os.sep + 'creation-testcases-index.xml',
                      testGenDir + os.sep + 'consumption-testcases-index.xml']
        indexDocs = []
        testcasesElements = []
        for purpose in ("Creation","Consumption"):
            file = io.StringIO(
                #'<?xml version="1.0" encoding="UTF-8"?>'
                '<!-- XBRL Versioning 1.0 {0} Tests -->'
                '<!-- Copyright 2011 XBRL International.  All Rights Reserved. -->'
                '<?xml-stylesheet type="text/xsl" href="infrastructure/testcases-index.xsl"?>'
                '<testcases name="XBRL Versioning 1.0 {0} Tests" '
                ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'
                ' xsi:noNamespaceSchemaLocation="infrastructure/testcases-index.xsd">'
                '</testcases>'.format(purpose, today)
                )
            doc = etree.parse(file)
            file.close()
            indexDocs.append(doc)
            testcasesElements.append(doc.getroot())
        priorTestcasesDir = None
        testcaseFiles = None
        testcaseDocs = None
        for iRow in range(1, testcaseIndexSheet.nrows):
            try:
                row = testcaseIndexSheet.row(iRow)
                if (row[0].ctype == xlrd.XL_CELL_EMPTY or # must have directory
                    row[1].ctype == xlrd.XL_CELL_EMPTY or # from
                    row[2].ctype == xlrd.XL_CELL_EMPTY):  # to
                    continue
                testDir = row[0].value
                uriFrom = row[1].value
                uriTo = row[2].value
                overrideReport = row[3].value
                description = row[4].value
                if description is None or len(description) == 0:
                    continue # test not ready to run
                assignment = row[5].value
                expectedEvents = row[6].value # comma space separated if multiple
                note = row[7].value
                useCase = row[8].value
                base = os.path.join(os.path.dirname(testGenFileName),testDir) + os.sep
                self.addToLog(_("[info] testcase uriFrom {0}").format(uriFrom))
                if uriFrom and uriTo and assignment.lower() not in ("n.a.", "error") and expectedEvents != "N.A.":
                    modelDTSfrom = modelDTSto = None
                    for URIs, msg, isFrom in ((uriFrom, _("loading from DTS"), True), (uriTo, _("loading to DTS"), False)):
                        if ',' not in URIs:
                            modelDTS = ModelXbrl.load(self.modelManager, URIs, msg, base=base)
                        else:
                            modelDTS = ModelXbrl.create(self.modelManager,
                                         ModelDocument.Type.DTSENTRIES,
                                         self.webCache.normalizeUrl(URIs.replace(", ","_") + ".dts",
                                                                    base),
                                         isEntry=True)
                            DTSdoc = modelDTS.modelDocument
                            DTSdoc.inDTS = True
                            for uri in URIs.split(','):
                                doc = ModelDocument.load(modelDTS, uri.strip(), base=base)
                                if doc is not None:
                                    DTSdoc.referencesDocument[doc] = "import"  #fake import
                                    doc.inDTS = True
                        if isFrom: modelDTSfrom = modelDTS
                        else: modelDTSto = modelDTS
                    if modelDTSfrom is not None and modelDTSto is not None:
                        # generate differences report
                        reportUri = uriFrom.partition(',')[0]  # first file
                        reportDir = os.path.dirname(reportUri)
                        if reportDir: reportDir += os.sep
                        reportName = os.path.basename(reportUri).replace("from.xsd","report.xml")
                        reportFile = reportDir + "out" + os.sep + reportName
                        #reportFile = reportDir + "report" + os.sep + reportName
                        reportFullPath = self.webCache.normalizeUrl(
                                            reportFile,
                                            base)
                        testcasesDir = os.path.dirname(os.path.dirname(reportFullPath))
                        if testcasesDir != priorTestcasesDir:
                            # close prior report
                            if priorTestcasesDir:
                                for i,testcaseFile in enumerate(testcaseFiles):
                                    with open(testcaseFile, "w", encoding="utf-8") as fh:
                                        XmlUtil.writexml(fh, testcaseDocs[i], encoding="utf-8")
                            testcaseName = os.path.basename(testcasesDir)
                            testcaseFiles = [testcasesDir + os.sep + testcaseName + "-creation-testcase.xml",
                                             testcasesDir + os.sep + testcaseName + "-consumption-testcase.xml"]
                            for i,testcaseFile in enumerate(testcaseFiles):
                                etree.SubElement(testcasesElements[i], "testcase",
                                                 attrib={"uri":
                                                         testcaseFile[len(testGenDir)+1:].replace("\\","/")} )

                            # start testcase file
                            testcaseDocs = []
                            testcaseElements = []
                            testcaseNumber = testcaseName[0:4]
                            if testcaseNumber.isnumeric():
                                testcaseNumberElement = "<number>{0}</number>".format(testcaseNumber)
                                testcaseName = testcaseName[5:]
                            else:
                                testcaseNumberElement = ""
                            testDirSegments = testDir.split('/')
                            if len(testDirSegments) >= 2 and '-' in testDirSegments[1]:
                                testedModule = testDirSegments[1][testDirSegments[1].index('-') + 1:]
                            else:
                                testedModule = ''
                            for purpose in ("Creation","Consumption"):
                                file = io.StringIO(
                                    #'<?xml version="1.0" encoding="UTF-8"?>'
                                    '<!-- Copyright 2011 XBRL International.  All Rights Reserved. -->'
                                    '<?xml-stylesheet type="text/xsl" href="../../../infrastructure/test.xsl"?>'
                                    '<testcase '
                                    ' xmlns="http://xbrl.org/2008/conformance"'
                                    ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'
                                    ' xsi:schemaLocation="http://xbrl.org/2008/conformance ../../../infrastructure/test.xsd">'
                                    '<creator>'
                                    '<name>Roland Hommes</name>'
                                    '<email>roland@rhocon.nl</email>'
                                    '</creator>'
                                    '{0}'
                                    '<name>{1}</name>'
                                    # '<description>{0}</description>'
                                    '<reference>'
                                    '{2}'
                                    '{3}'
                                    '</reference>'
                                    '</testcase>'.format(testcaseNumberElement,
                                                         testcaseName,
                                                         '<name>{0}</name>'.format(testedModule) if testedModule else '',
                                                         '<id>{0}</id>'.format(useCase) if useCase else '')

                                    )
                                doc = etree.parse(file)
                                file.close()
                                testcaseDocs.append(doc)
                                testcaseElements.append(doc.getroot())
                            priorTestcasesDir = testcasesDir
                            variationSeq = 1
                        try:
                            os.makedirs(os.path.dirname(reportFullPath))
                        except WindowsError:
                            pass # dir already exists
                        modelVersReport = ModelVersReport.ModelVersReport(modelTestcases)
                        modelVersReport.diffDTSes(reportFullPath,modelDTSfrom, modelDTSto,
                                                  assignment=assignment,
                                                  schemaDir=schemaDir)

                        # check for expected elements
                        if expectedEvents:
                            for expectedEvent in expectedEvents.split(","):
                                if expectedEvent not in ("No change", "N.A."):
                                    prefix, sep, localName = expectedEvent.partition(':')
                                    if sep and len(modelVersReport.xmlDocument.findall(
                                                        '//{{{0}}}{1}'.format(
                                                            XbrlConst.verPrefixNS.get(prefix),
                                                            localName))) == 0:
                                        modelTestcases.warning("warning",
                                            "Generated test case %(reportName)s missing expected event %(event)s",
                                            reportName=reportName,
                                            event=expectedEvent)

                        modelVersReport.close()
                        uriFromParts = uriFrom.split('_')
                        if len(uriFromParts) >= 2:
                            variationId = uriFromParts[1]
                        else:
                            variationId = "_{0:02n}".format(variationSeq)
                        for i,testcaseElt in enumerate(testcaseElements):
                            variationElement = etree.SubElement(testcaseElt, "{http://xbrl.org/2008/conformance}variation",
                                                                attrib={"id": variationId})
                            nameElement = etree.SubElement(variationElement, "{http://xbrl.org/2008/conformance}description")
                            nameElement.text = description
                            ''' (removed per RH 2011/10/04
                            if note:
                                paramElement = etree.SubElement(variationElement, "{http://xbrl.org/2008/conformance}description")
                                paramElement.text = "Note: " + note
                            if useCase:
                                paramElement = etree.SubElement(variationElement, "{http://xbrl.org/2008/conformance}reference")
                                paramElement.set("specification", "versioning-requirements")
                                paramElement.set("useCase", useCase)
                            '''
                            dataElement = etree.SubElement(variationElement, "{http://xbrl.org/2008/conformance}data")
                            if i == 0:  # result is report
                                if expectedEvents:
                                    paramElement = etree.SubElement(dataElement, "{http://xbrl.org/2008/conformance}parameter",
                                                                    attrib={"name":"expectedEvent",
                                                                            "value":expectedEvents.replace(',',' ')},
                                                                    nsmap={"conf":"http://xbrl.org/2008/conformance",
                                                                           None:""})
                                if assignment:
                                    paramElement = etree.SubElement(dataElement, "{http://xbrl.org/2008/conformance}parameter",
                                                                    attrib={"name":"assignment",
                                                                            "value":assignment},
                                                                    nsmap={"conf":"http://xbrl.org/2008/conformance",
                                                                           None:""})
                            for schemaURIs, dtsAttr in ((uriFrom,"from"), (uriTo,"to")):
                                for schemaURI in schemaURIs.split(","):
                                    schemaElement = etree.SubElement(dataElement, "{http://xbrl.org/2008/conformance}schema")
                                    schemaElement.set("dts",dtsAttr)
                                    if i == 0:
                                        schemaElement.set("readMeFirst","true")
                                    schemaElement.text=os.path.basename(schemaURI.strip())
                            resultElement = etree.SubElement(variationElement, "{http://xbrl.org/2008/conformance}result")
                            reportElement = etree.SubElement(resultElement if i == 0 else dataElement,
                                             "{http://xbrl.org/2008/conformance}versioningReport")
                            if i == 1:
                                reportElement.set("readMeFirst","true")
                            reportElement.text = "report/" + reportName
                        variationSeq += 1
            except Exception as err:
                modelTestcases.error("exception",
                    _("Exception: %(error)s, Excel row: %(excelRow)s"),
                    error=err,
                    excelRow=iRow,
                    exc_info=True)

        # add tests-error-code index files to consumption
        for testcaseFile in self.testcaseFiles(testGenDir + os.sep + "tests-error-code"):
            etree.SubElement(testcasesElements[1], "testcase",
                             attrib={"uri":
                             testcaseFile[len(testGenDir)+1:].replace("\\","/")} )

        with open(logMessagesFile, "w") as fh:
            fh.writelines(self.logMessages)

        if priorTestcasesDir:
            for i,testcaseFile in enumerate(testcaseFiles):
                with open(testcaseFile, "w", encoding="utf-8") as fh:
                    XmlUtil.writexml(fh, testcaseDocs[i], encoding="utf-8")
        for i,indexFile in enumerate(indexFiles):
            with open(indexFile, "w", encoding="utf-8") as fh:
                XmlUtil.writexml(fh, indexDocs[i], encoding="utf-8")

    def testcaseFiles(self, dir, files=None):
        if files is None: files = []
        for file in os.listdir(dir):
            path = dir + os.sep + file
            if path.endswith(".svn"):
                continue
            if path.endswith("-testcase.xml"):
                files.append(path)
            elif os.path.isdir(path):
                self.testcaseFiles(path, files)
        return files

    def runFromXml(self):
        testGenFileName = r"C:\Users\Herm Fischer\Documents\mvsl\projects\Arelle\roland test cases\1000-Concepts\index.xml"
        filesource = FileSource.FileSource(testGenFileName)
        startedAt = time.time()
        LogHandler(self) # start logger
        modelTestcases = self.modelManager.load(filesource, _("views loading"))
        self.addToLog(_("[info] loaded in {0:.2} secs").format(time.time() - startedAt))
        if modelTestcases.modelDocument.type == ModelDocument.Type.TESTCASESINDEX:
            for testcasesElement in modelTestcases.modelDocument.iter(tag="testcases"):
                rootAttr = testcasesElement.get("root")
                title = testcasesElement.get("title")
                self.addToLog(_("[info] testcases {0}").format(title))
                if rootAttr is not None:
                    base = os.path.join(os.path.dirname(modelTestcases.modelDocument.filepath),rootAttr) + os.sep
                else:
                    base = self.filepath
                for testcaseElement in testcasesElement.iterchildren(tag="testcase"):
                    uriFrom = testcaseElement.get("uriFrom")
                    uriTo = testcaseElement.get("uriTo")
                    modelDTSfrom = modelDTSto = None
                    self.addToLog(_("[info] testcase uriFrom {0}").format(uriFrom))
                    if uriFrom is not None and uriTo is not None:
                        modelDTSfrom = ModelXbrl.load(modelTestcases.modelManager,
                                                   uriFrom,
                                                   _("loading from DTS"),
                                                   base=base)
                        modelDTSto = ModelXbrl.load(modelTestcases.modelManager,
                                                   uriTo,
                                                   _("loading to DTS"),
                                                   base=base)
                        if modelDTSfrom is not None and modelDTSto is not None:
                            # generate differences report
                            reportName = os.path.basename(uriFrom).replace("from.xsd","report.xml")
                            reportFile = os.path.dirname(uriFrom) + "\\report\\" + reportName
                            reportFullPath = self.webCache.normalizeUrl(
                                                reportFile,
                                                base)
                            try:
                                os.makedirs(os.path.dirname(reportFullPath))
                            except WindowsError:
                                pass # dir already exists
                            ModelVersReport.ModelVersReport(modelTestcases).diffDTSes(
                                          reportFullPath,
                                          modelDTSfrom, modelDTSto)

    def addToLog(self, message):
        self.logMessages.append(message + '\n')
        print(message)

    def showStatus(self, message, clearAfter=None):
        pass

class LogHandler(logging.Handler):
    def __init__(self, cntlr):
        super(LogHandler, self).__init__()
        self.cntlr = cntlr
        self.level = logging.DEBUG
        formatter = logging.Formatter("[%(messageCode)s] %(message)s - %(file)s %(sourceLine)s")
        self.setFormatter(formatter)
        logging.getLogger("arelle").addHandler(self)
    def flush(self):
        ''' Nothing to flush '''
    def emit(self, logRecord):
        self.cntlr.addToLog(self.format(logRecord))

if __name__ == "__main__":
    main()