text:
""" The "parser" for compound descriptors.

I almost hesitate to document this, because it's not the prettiest
thing the world has ever seen... but it does work (for at least some
definitions of the word).

Rather than getting into the whole mess of writing a parser for the
compound descriptor expressions, I'm just using string substitutions
and python's wonderful ability to *eval* code.

It would probably be a good idea at some point to replace this with a
real parser, if only for the flexibility and intelligent error
messages that would become possible.

The general idea is that we're going to deal with expressions where
atomic descriptors have some kind of method applied to them which
reduces them to a single number for the entire composition.  Compound
descriptors (those applicable to the compound as a whole) are not
operated on by anything in particular (except for standard math stuff).

Here's the general flow of things:

  1) Composition descriptor references ($a, $b, etc.) are replaced with the
     corresponding descriptor names using string substitution.
     (*_SubForCompoundDescriptors*)

  2) Atomic descriptor references ($1, $2, etc) are replaced with lookups
     into the atomic dict with "DEADBEEF" in place of the atom name.
     (*_SubForAtomicVars*)

  3) Calls to Calculator Functions are augmented with a reference to
     the composition and atomic dictionary
     (*_SubMethodArgs*)

**NOTE:**

  anytime we don't know the answer for a descriptor, rather than
  throwing a (completely incomprehensible) exception, we just return
  -666.  So bad descriptor values should stand out like sore thumbs.

"""

# The wildcard import is required to make functions available for the eval statement
from math import *

from rdkit import RDConfig

__DEBUG = False

# we do this to allow the use of stuff in the math module

# ----------------------
# atomic descriptor section
# ----------------------
# these are the methods which can be applied to ATOMIC descriptors.
knownMethods = ['SUM', 'MIN', 'MAX', 'MEAN', 'AVG', 'DEV', 'HAS']

def HAS(strArg, composList, atomDict):
  """ *Calculator Method*

    does a string search

    **Arguments**

      - strArg: the arguments in string form

      - composList: the composition vector

      - atomDict: the atomic dictionary

    **Returns**

      1 or 0

  """
  splitArgs = strArg.split(',')
  if len(splitArgs) > 1:
    for atom, _ in composList:
      tStr = splitArgs[0].replace('DEADBEEF', atom)
      where = eval(tStr)
      what = eval(splitArgs[1])
      if what in where:
        return 1
    return 0
  else:
    return -666

def SUM(strArg, composList, atomDict):
  """ *Calculator Method*

    calculates the sum of a descriptor across a composition

    **Arguments**

      - strArg: the arguments in string form

      - compos: the composition vector

      - atomDict: the atomic dictionary

    **Returns**

      a float

  """
  accum = 0.0
  for atom, num in composList:
    tStr = strArg.replace('DEADBEEF', atom)
    accum = accum + eval(tStr) * num
  return accum

def MEAN(strArg, composList, atomDict):
  """ *Calculator Method*

    calculates the average of a descriptor across a composition

    **Arguments**

      - strArg: the arguments in string form

      - compos: the composition vector

      - atomDict: the atomic dictionary

    **Returns**

      a float

  """
  accum = 0.0
  nSoFar = 0
  for atom, num in composList:
    tStr = strArg.replace('DEADBEEF', atom)
    accum = accum + eval(tStr) * num
    nSoFar = nSoFar + num
  return accum / nSoFar

AVG = MEAN

def DEV(strArg, composList, atomDict):
  """ *Calculator Method*

    calculates the average deviation of a descriptor across a composition

    **Arguments**

      - strArg: the arguments in string form

      - compos: the composition vector

      - atomDict: the atomic dictionary

    **Returns**

      a float

  """
  avg = MEAN(strArg, composList, atomDict)
  accum = 0.0
  nSoFar = 0.0
  for atom, num in composList:
    tStr = strArg.replace('DEADBEEF', atom)
    accum = accum + abs(eval(tStr) - avg) * num
    nSoFar = nSoFar + num
  return accum / nSoFar

def MIN(strArg, composList, atomDict):
  """ *Calculator Method*

    calculates the minimum value of a descriptor across a composition

    **Arguments**

      - strArg: the arguments in string form

      - compos: the composition vector

      - atomDict: the atomic dictionary

    **Returns**

      a float

  """
  accum = []
  for atom, _ in composList:
    tStr = strArg.replace('DEADBEEF', atom)
    accum.append(eval(tStr))
  return min(accum)

def MAX(strArg, composList, atomDict):
  """ *Calculator Method*

    calculates the maximum value of a descriptor across a composition

    **Arguments**

      - strArg: the arguments in string form

      - compos: the composition vector

      - atomDict: the atomic dictionary

    **Returns**

      a float

  """
  accum = []
  for atom, _ in composList:
    tStr = strArg.replace('DEADBEEF', atom)
    accum.append(eval(tStr))
  return max(accum)

# ------------------
#  string replacement routines
#    these are not intended to be called by clients
# ------------------

def _SubForAtomicVars(cExpr, varList, dictName):
  """ replace atomic variables with the appropriate dictionary lookup

   *Not intended for client use*

  """
  for i in range(len(varList)):
    cExpr = cExpr.replace('$%d' % (i + 1), '%s["DEADBEEF"]["%s"]' % (dictName, varList[i]))
  return cExpr

def _SubForCompoundDescriptors(cExpr, varList, dictName):
  """ replace compound variables with the appropriate list index

   *Not intended for client use*

  """
  for i in range(len(varList)):
    cExpr = cExpr.replace('$%s' % chr(ord('a') + i), '%s["%s"]' % (dictName, varList[i]))
  return cExpr

def _SubMethodArgs(cExpr, knownMethods):
  """ alters the arguments of calls to calculator methods

  *Not intended for client use*

  This is kind of putrid (and the code ain't so pretty either)
  The general idea is that the various special methods for atomic
  descriptors need two extra arguments (the composition and the atomic
  dict).  Rather than make the user type those in, we just find
  invocations of these methods and fill out the function calls using
  string replacements.
  """
  res = cExpr
  for method in knownMethods:
    p = 0
    while p != -1 and p < len(res):
      p = res.find(method, p)
      if p != -1:
        p = p + len(method) + 1
        start = p
        parenCount = 1
        while parenCount and p < len(res):
          if res[p] == ')':
            parenCount = parenCount - 1
          elif res[p] == '(':
            parenCount = parenCount + 1
          p = p + 1
        if p <= len(res):
          res = res[0:start] + "'%s',compos,atomDict" % (res[start:p - 1]) + res[p - 1:]
  return res

def CalcSingleCompoundDescriptor(compos, argVect, atomDict, propDict):
  """ calculates the value of the descriptor for a single compound

    **ARGUMENTS:**

      - compos: a vector/tuple containing the composition
         information... in the form:
         '[("Fe",1.),("Pt",2.),("Rh",0.02)]'

      - argVect: a vector/tuple with three elements:

           1) AtomicDescriptorNames:  a list/tuple of the names of the
             atomic descriptors being used. These determine the
             meaning of $1, $2, etc. in the expression

           2) CompoundDescriptorNames:  a list/tuple of the names of the
             compound descriptors being used. These determine the
             meaning of $a, $b, etc. in the expression

           3) Expr: a string containing the expression to be used to
             evaluate the final result.

      - atomDict:
           a dictionary of atomic descriptors.  Each atomic entry is
           another dictionary containing the individual descriptors
           and their values

      - propVect:
           a list of descriptors for the composition.

    **RETURNS:**

      the value of the descriptor, -666 if a problem was encountered

    **NOTE:**

      - because it takes rather a lot of work to get everything set
          up to calculate a descriptor, if you are calculating the
          same descriptor for multiple compounds, you probably want to
          be calling _CalcMultipleCompoundsDescriptor()_.

  """
  try:
    atomVarNames = argVect[0]
    compositionVarNames = argVect[1]
    formula = argVect[2]
    formula = _SubForCompoundDescriptors(formula, compositionVarNames, 'propDict')
    formula = _SubForAtomicVars(formula, atomVarNames, 'atomDict')
    evalTarget = _SubMethodArgs(formula, knownMethods)
  except Exception:
    if __DEBUG:
      import traceback
      print('Sub Failure!')
      traceback.print_exc()
      print(evalTarget)
      print(propDict)
      raise RuntimeError('Failure 1')
    else:
      return -666

  try:
    v = eval(evalTarget)
  except Exception:
    if __DEBUG:
      import traceback
      outF = open(RDConfig.RDCodeDir + '/ml/descriptors/log.txt', 'a+')
      outF.write('#------------------------------\n')
      outF.write('formula: %s\n' % repr(formula))
      outF.write('target: %s\n' % repr(evalTarget))
      outF.write('propDict: %s\n' % (repr(propDict)))

      outF.write('keys: %s\n' % (repr(sorted(atomDict))))
      outF.close()
      print('ick!')
      print('formula:', formula)
      print('target:', evalTarget)
      print('propDict:', propDict)
      print('keys:', atomDict.keys())
      traceback.print_exc()
      raise RuntimeError('Failure 2')
    else:
      v = -666
  return v

def CalcMultipleCompoundsDescriptor(composVect, argVect, atomDict, propDictList):
  """ calculates the value of the descriptor for a list of compounds

    **ARGUMENTS:**

      - composVect: a vector of vector/tuple containing the composition
         information.
         See _CalcSingleCompoundDescriptor()_ for an explanation of the elements.

      - argVect: a vector/tuple with three elements:

           1) AtomicDescriptorNames:  a list/tuple of the names of the
             atomic descriptors being used. These determine the
             meaning of $1, $2, etc. in the expression

           2) CompoundDsscriptorNames:  a list/tuple of the names of the
             compound descriptors being used. These determine the
             meaning of $a, $b, etc. in the expression

           3) Expr: a string containing the expression to be used to
             evaluate the final result.

      - atomDict:
           a dictionary of atomic descriptors.  Each atomic entry is
           another dictionary containing the individual descriptors
           and their values

      - propVectList:
         a vector of vectors of descriptors for the composition.

    **RETURNS:**

      a vector containing the values of the descriptor for each
      compound.  Any given entry will be -666 if problems were
      encountered

  """
  res = [-666] * len(composVect)
  try:
    atomVarNames = argVect[0]
    compositionVarNames = argVect[1]
    formula = argVect[2]
    formula = _SubForCompoundDescriptors(formula, compositionVarNames, 'propDict')
    formula = _SubForAtomicVars(formula, atomVarNames, 'atomDict')
    evalTarget = _SubMethodArgs(formula, knownMethods)
  except Exception:
    return res
  for i in range(len(composVect)):
    propDict = propDictList[i]
    compos = composVect[i]
    try:
      v = eval(evalTarget)
    except Exception:
      v = -666
    res[i] = v
  return res

# ------------
#  Demo/testing code
# ------------
def _exampleCode():  # pragma: nocover
  piece1 = [['d1', 'd2', 's1'], ['d1', 'd2', 's1']]
  aDict = {'Fe': {'d1': 1., 'd2': 2., 's1': 'abc'}, 'Pt': {'d1': 10., 'd2': 20., 's1': 'def'}}
  pDict = {'d1': 100., 'd2': 200.}
  compos = [('Fe', 1), ('Pt', 1)]

  cExprs = ["SUM($1)", "SUM($1)+SUM($2)", "SUM($1)+SUM($1)", "MEAN($1)", "DEV($2)", "MAX($1)",
            "MIN($1)/MAX($1)", "MIN($2)", "SUM($1)/$a", "sqrt($a+$b)", "SUM((3.*$1)/($2))",
            'HAS($3,"def")', 'HAS($3,"xyz")', "foo"]

  for cExpr in cExprs:
    argVect = piece1 + [cExpr]
    print(cExpr)
    print(CalcSingleCompoundDescriptor(compos, argVect, aDict, pDict))
    print(CalcMultipleCompoundsDescriptor([compos, compos], argVect, aDict, [pDict, pDict]))

if __name__ == '__main__':  # pragma: nocover
  _exampleCode()


text:
package it.unibz.inf.ontop.spec.mapping.transformer.impl;

import com.google.inject.Inject;
import it.unibz.inf.ontop.exception.MinorOntopInternalBugException;
import it.unibz.inf.ontop.injection.CoreSingletons;
import it.unibz.inf.ontop.injection.IntermediateQueryFactory;

import it.unibz.inf.ontop.iq.IQTree;
import it.unibz.inf.ontop.iq.node.ConstructionNode;
import it.unibz.inf.ontop.iq.type.SingleTermTypeExtractor;
import it.unibz.inf.ontop.model.term.*;
import it.unibz.inf.ontop.model.term.functionsymbol.db.DBTypeConversionFunctionSymbol;
import it.unibz.inf.ontop.model.term.functionsymbol.FunctionSymbol;
import it.unibz.inf.ontop.model.term.functionsymbol.FunctionSymbolFactory;
import it.unibz.inf.ontop.model.term.functionsymbol.RDFTermFunctionSymbol;
import it.unibz.inf.ontop.model.type.*;
import it.unibz.inf.ontop.spec.mapping.MappingAssertion;
import it.unibz.inf.ontop.spec.mapping.transformer.MappingCaster;
import it.unibz.inf.ontop.substitution.ImmutableSubstitution;
import it.unibz.inf.ontop.utils.ImmutableCollectors;

import java.util.Optional;

/**
 * Implementation making use of the SingleTermTypeExtractor
 *   (and thus sharing its assumptions on how the source query of the mapping assertion is typed)
 */
@SuppressWarnings("OptionalUsedAsFieldOrParameterType")
public class TermTypeMappingCaster implements MappingCaster {

    private final FunctionSymbolFactory functionSymbolFactory;
    private final IntermediateQueryFactory iqFactory;
    private final SingleTermTypeExtractor typeExtractor;
    private final TermFactory termFactory;
    private final DBTermType dBStringType;

    @Inject
    private TermTypeMappingCaster(FunctionSymbolFactory functionSymbolFactory,
                                  CoreSingletons coreSingletons,
                                  SingleTermTypeExtractor typeExtractor) {
        this.functionSymbolFactory = functionSymbolFactory;
        this.iqFactory = coreSingletons.getIQFactory();
        this.typeExtractor = typeExtractor;
        this.termFactory = coreSingletons.getTermFactory();
        this.dBStringType = coreSingletons.getTypeFactory().getDBTypeFactory().getDBStringType();
    }

    @Override
    public MappingAssertion transform(MappingAssertion assertion) {
        RDFTermFunctionSymbol rdfTermFunctionSymbol = functionSymbolFactory.getRDFTermFunctionSymbol();

        if (!assertion.getTerms().stream()
                .allMatch(t -> ((t instanceof ImmutableFunctionalTerm) &&
                        ((ImmutableFunctionalTerm) t).getFunctionSymbol().equals(rdfTermFunctionSymbol))
                        || (t instanceof RDFConstant))) {
            throw new MinorOntopInternalBugException(
                    "The root construction node is not defining all the variables with a RDF functional or constant term\n"
                            + assertion);
        }
        IQTree childTree = assertion.getTopChild();

        ImmutableSubstitution<ImmutableTerm> newSubstitution = assertion.getTopSubstitution().transform(v -> transformDefinition(v, childTree));

        ConstructionNode newRootNode = iqFactory.createConstructionNode(assertion.getProjectedVariables(), newSubstitution);

        return assertion.copyOf(iqFactory.createUnaryIQTree(newRootNode, childTree), iqFactory);
    }

    private ImmutableTerm transformDefinition(ImmutableTerm rdfTerm, IQTree childTree) {
        if (rdfTerm instanceof ImmutableFunctionalTerm) {
            ImmutableFunctionalTerm rdfTermDefinition = (ImmutableFunctionalTerm) rdfTerm;
            ImmutableTerm uncastLexicalTerm = DBTypeConversionFunctionSymbol.uncast(rdfTermDefinition.getTerm(0));
            ImmutableTerm rdfTypeTerm = rdfTermDefinition.getTerm(1);

            Optional<DBTermType> dbType = extractInputDBType(uncastLexicalTerm, childTree);
            RDFTermType rdfType = extractRDFTermType(rdfTypeTerm);

            ImmutableTerm newLexicalTerm = transformNestedTemporaryToStringConversions(
                    transformTopOfLexicalTerm(uncastLexicalTerm, dbType, rdfType), childTree);

            return termFactory.getRDFFunctionalTerm(newLexicalTerm, rdfTypeTerm).simplify();
        }
        else if (rdfTerm instanceof RDFConstant) {
            return rdfTerm;
        }
        else
            throw new IllegalArgumentException("Was expecting an ImmutableFunctionalTerm or a Constant");
    }

    private Optional<DBTermType> extractInputDBType(ImmutableTerm uncastLexicalTerm, IQTree childTree) {
        Optional<TermType> type = typeExtractor.extractSingleTermType(uncastLexicalTerm, childTree);
        if (type
                .filter(t -> !(t instanceof DBTermType))
                .isPresent()) {
            throw new MinorOntopInternalBugException("Was expecting to get a DBTermType, not a "
                    + type.get().getClass() + " (" + type.get() + ")");
        }
        return type
                .map(t -> (DBTermType)t);
    }

    private RDFTermType extractRDFTermType(ImmutableTerm rdfTypeTerm) {
        if (rdfTypeTerm instanceof RDFTermTypeConstant) {
            return ((RDFTermTypeConstant) rdfTypeTerm).getRDFTermType();
        }
        throw new MinorOntopInternalBugException("Was expecting a RDFTermTypeConstant in the RDF term function, " +
                    "not " + rdfTypeTerm);
    }

    private ImmutableTerm transformTopOfLexicalTerm(ImmutableTerm uncastLexicalTerm, Optional<DBTermType> dbType,
                                                  RDFTermType rdfType) {

        return dbType
                .map(i ->
                        i.equals(dBStringType)
                                ? uncastLexicalTerm
                                : termFactory.getConversion2RDFLexical(i, uncastLexicalTerm, rdfType))
                .orElseGet(() -> termFactory.getDBCastFunctionalTerm(dBStringType, uncastLexicalTerm));
    }

    /**
     * For dealing with arguments of templates (which are always cast as strings)
     *
     * Either remove the conversion function (if not needed), replace it by a conversion function
     * knowing its input type or, in the "worst" case, by a replace it by a casting function
     * NOT knowing the input type.
     *
     */
    private ImmutableTerm transformNestedTemporaryToStringConversions(ImmutableTerm term, IQTree childTree) {
        if (term instanceof ImmutableFunctionalTerm) {
            ImmutableFunctionalTerm functionalTerm = (ImmutableFunctionalTerm) term;
            FunctionSymbol functionSymbol = functionalTerm.getFunctionSymbol();

            if (DBTypeConversionFunctionSymbol.isTemporary(functionSymbol)) {
                DBTypeConversionFunctionSymbol conversionFunctionSymbol = (DBTypeConversionFunctionSymbol) functionSymbol;
                if (functionSymbol.getArity() != 1)
                    throw new MinorOntopInternalBugException("The casting function was expected to be unary");

                // Optimization: recursion does not seem to be needed
                ImmutableTerm childTerm = functionalTerm.getTerm(0);

                Optional<DBTermType> inputType = extractInputDBType(childTerm, childTree);

                return Optional.of(conversionFunctionSymbol.getTargetType())
                        .filter(targetType -> !inputType.filter(targetType::equals).isPresent())
                        .map(targetType -> inputType
                                .map(i -> targetType.getCategory().equals(DBTermType.Category.STRING)
                                        ? termFactory.getConversion2RDFLexical(i, childTerm, termFactory.getTypeFactory().getXsdStringDatatype())
                                        // Should not happen. TODO: simplify
                                        : termFactory.getDBCastFunctionalTerm(i, targetType, childTerm))
                                .orElseGet(() -> termFactory.getDBCastFunctionalTerm(targetType, childTerm)))
                        .map(t -> (ImmutableTerm) t)
                        .orElse(childTerm);
            }
            else {
                // Recursive
                return termFactory.getImmutableFunctionalTerm(functionSymbol,
                        functionalTerm.getTerms().stream()
                                .map(t -> transformNestedTemporaryToStringConversions(t, childTree))
                                .collect(ImmutableCollectors.toList()));
            }
        }
        else
            return term;
    }
}

redpajama_set_name: RedPajamaGithub


text:
using System.Workflow.ComponentModel.Serialization;

namespace System.Workflow.ComponentModel.Design
{
    internal sealed class ColorMarkupSerializer : WorkflowMarkupSerializer
    {
        protected internal override bool CanSerializeToString(WorkflowMarkupSerializationManager serializationManager, object value)
        {
            return (value is System.Drawing.Color);
        }

        protected internal override string SerializeToString(WorkflowMarkupSerializationManager serializationManager, object value)
        {
            if (serializationManager == null)
                throw new ArgumentNullException("serializationManager");
            if (value == null)
                throw new ArgumentNullException("value");

            string stringValue = String.Empty;
            if (value is System.Drawing.Color color)
            {
                long colorValue = (long)((uint)(color.A << 24 | color.R << 16 | color.G << 8 | color.B)) & 0xFFFFFFFF;
                stringValue = "0X" + colorValue.ToString("X08", System.Globalization.CultureInfo.InvariantCulture);
            }
            return stringValue;
        }

        protected internal override object DeserializeFromString(WorkflowMarkupSerializationManager serializationManager, Type propertyType, string value)
        {
            if (propertyType.IsAssignableFrom(typeof(System.Drawing.Color)))
            {
                string colorValue = value as string;
                if (!String.IsNullOrEmpty(colorValue))
                {
                    if (colorValue.StartsWith("0X", StringComparison.OrdinalIgnoreCase))
                    {
                        long propertyValue = Convert.ToInt64((string)value, 16) & 0xFFFFFFFF;
                        return System.Drawing.Color.FromArgb((Byte)(propertyValue >> 24), (Byte)(propertyValue >> 16), (Byte)(propertyValue >> 8), (Byte)(propertyValue));
                    }
                    else
                    {
                        return base.DeserializeFromString(serializationManager, propertyType, value);
                    }
                }
            }

            return null;
        }
    }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>Toggle</title>

    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
    <link rel="stylesheet" href="../../../../dist/css/ionic.css">

Toggle

    <ion-content class="has-header reveal-animation">

          <ion-checkbox ng-model="checkModel" ng-change="myChange = checkModel">
            Main Check
          </ion-checkbox>
          <ion-checkbox ng-checked="myChange">
            Follows ng-change of Main Check
          </ion-checkbox>
          <ion-toggle ng-model="myModel" ng-disabled="isDisabled">myModel ({{!!myModel}})</ion-toggle>
          <ion-toggle ng-model="catModel" ng-disabled="isDisabled" ng-true-value="cats" ng-false-value="dogs">Cats or dogs? ({{catModel}})</ion-toggle>
          <ion-toggle ng-model="isDisabled">Disable myModel ({{!!isDisabled}})</ion-toggle>
          <ion-toggle toggle-class="toggle-assertive" ng-checked="true">Set toggle class to toggle-assertive</ion-toggle>

    </ion-content>


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
  <link rel="stylesheet" href="https://code.getmdl.io/1.1.3/material.indigo-deep_purple.min.css" />
  <link rel="stylesheet" href="css/styles.css" />

  <link rel="manifest" href="manifest.json">
  <title>Redder</title>

        Redder

            share

            code

      Subreddits


text:
<?xml version="1.0" encoding="utf-8" ?>
<CodeDoc>
	<Class name="DockWindow">
		<ClassDef>
			Represents the docking zone of the <see cref="WeifenLuo.WinFormsUI.DockPanel" />.
			<remarks>
				<para>The <see cref="WeifenLuo.WinFormsUI.DockPanel" /> is divided into 5
				<see cref="WeifenLuo.WinFormsUI.DockWindow" />s: Top, Bottom, Left, Right and Document.
				The document <see cref="WeifenLuo.WinFormsUI.DockWindow" /> is always positioned in the central of the
				<see cref="WeifenLuo.WinFormsUI.DockPanel" />. Other 4 <see cref="WeifenLuo.WinFormsUI.DockWindow" />s' positions
				are determined by the Z-order. The last displayed <see cref="WeifenLuo.WinFormsUI.DockWindow" /> will be sent to the back of the
				Z-order.</para>
				<para>The <see cref="WeifenLuo.WinFormsUI.DockWindow" /> implements <see cref="WeifenLuo.WinFormsUI.IDockListContainer" />,
				it can contain a list of nested <see cref="WeifenLuo.WinFormsUI.DockPane" /> objects.</para>
			</remarks>
		</ClassDef>
		<Property name="DisplayingList">
			Gets the <see cref="WeifenLuo.WinFormsUI.DisplayingDockList" /> which contains
			a list of visible nested docking <see cref="WeifenLuo.WinFormsUI.DockPane" /> objects.
			<value>The <see cref="WeifenLuo.WinFormsUI.DisplayingDockList" /> which contains
			a list of visible nested docking <see cref="WeifenLuo.WinFormsUI.DockPane" /> objects.</value>
		</Property>
		<Property name="DisplayingRectangle">
			Gets the rectangle represents the displaying area for nested docking DockPane objects.
			<value>A <see cref="System.Drawing.Rectangle" /> represents the displaying area for nested docking DockPane objects.</value>
		</Property>
		<Property name="DockList">
			Gets the <see cref="WeifenLuo.WinFormsUI.DockList" /> which contains
			a list of nested docking <see cref="WeifenLuo.WinFormsUI.DockPane" /> objects.
			<value>The <see cref="WeifenLuo.WinFormsUI.DockList" /> which contains
			a list of nested docking <see cref="WeifenLuo.WinFormsUI.DockPane" /> objects.</value>
		</Property>
		<Property name="DockPanel">
			Gets the <see cref="WeifenLuo.WinFormsUI.DockPanel"/> which contains this
			<see cref="WeifenLuo.WinFormsUI.DockWindow"/>.
			<value>The <see cref="WeifenLuo.WinFormsUI.DockPanel"/> which contains this
			<see cref="WeifenLuo.WinFormsUI.DockWindow"/>.</value>
		</Property>
		<Property name="DockState">
			Gets the docking state of this <see cref="WeifenLuo.WinFormsUI.DockWindow"/>.
			<value>The docking state of this <see cref="WeifenLuo.WinFormsUI.DockWindow"/>.</value>
		</Property>
		<Property name="IsFloat">
			Gets to determine if this <see cref="WeifenLuo.WinFormsUI.DockWindow"/> is floating.
			<value>The value of this property is always false.</value>
		</Property>
	</Class>
</CodeDoc>


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

    <item android:state_pressed="false"
    android:drawable="@drawable/prev" />

<item android:state_pressed="true"
    android:drawable="@drawable/prevpress" />

</selector>
<!-- From: file:/home/torch2424/Dropbox/Android%20Source/NewFeather1/app/src/main/res/drawable-xxhdpi/prevs.xml -->


text:
package pl.kodujdlapolski.na4lapy.ui.payment;

import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import butterknife.BindView;
import butterknife.ButterKnife;
import pl.kodujdlapolski.na4lapy.R;
import pl.kodujdlapolski.na4lapy.presenter.payment.PaymentContract;
import pl.kodujdlapolski.na4lapy.service.payments.model.type.PaymentType;

public class BankListAdapter extends RecyclerView.Adapter<BankListAdapter.ViewHolder> {

    private static PaymentContract.UserActionListener mListener;
    private PaymentType[] paymentTypes;

    public BankListAdapter(PaymentContract.UserActionListener listener) {
        mListener = listener;
        paymentTypes = PaymentType.values();
    }

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_payment_type, parent, false);
        return new ViewHolder(v);
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
        holder.setData(paymentTypes[position]);
    }

    @Override
    public int getItemCount() {
        return paymentTypes.length;
    }

    public static class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {

        @BindView(R.id.icon)
        ImageView iconView;

        @BindView(R.id.name)
        TextView nameView;

        private PaymentType mPaymentType;

        public ViewHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
            itemView.setOnClickListener(this);
        }

        public void setData(PaymentType paymentType) {
            mPaymentType = paymentType;
            iconView.setImageResource(paymentType.getDrawableResId());
            nameView.setText(paymentType.getNameResourceId());
        }

        @Override
        public void onClick(View v) {
            mListener.setPaymentType(mPaymentType);
        }
    }
}


text:
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace ZobShop.Models
{
    public class ProductOrder
    {
        public ProductOrder(Product product, int quantity)
        {
            this.Product = product;
            this.Quantity = quantity;
        }

        [Key]
        public int ProductOrderId { get; set; }

        public int ProductId { get; set; }

        [ForeignKey("ProductId")]
        public virtual Product Product { get; set; }

        public int Quantity { get; set; }
    }
}


text:
package com.levelup.java.io;

import static org.junit.Assert.assertEquals;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

import org.apache.commons.io.FileUtils;
import org.junit.Before;
import org.junit.Test;

import com.google.common.base.Charsets;
import com.google.common.io.Files;

/**
 * This java example will demonstrate reading a file into a String.
 *
 * @author Justin Musgrove
 * @see Read
 *      file into string
 *
 */
public class FileToString {

	private static final String FILE_PATH = "com/levelup/java/io/file-to-string.txt";
	private URI fileLocation;

	@Before
	public void setUp() throws URISyntaxException {
		fileLocation = this.getClass().getClassLoader().getResource(FILE_PATH)
				.toURI();
	}

	@Test
	public void convert_file_to_string_java_bufferedreader() throws IOException {

		File file = new File(fileLocation);

		BufferedReader br = new BufferedReader(new FileReader(file));
		StringBuffer fileContents = new StringBuffer();
		String line = br.readLine();
		while (line != null) {
			fileContents.append(line);
			line = br.readLine();
		}

		br.close();

		assertEquals("File to string example", fileContents.toString());
	}

	@Test
	public void convert_file_to_string_java_scanner()
			throws FileNotFoundException {

		File file = new File(fileLocation);

		Scanner scanner = new Scanner(file);

		String fileContents = scanner.nextLine(); // only reads line

		scanner.close();

		assertEquals("File to string example", fileContents);
	}

	@Test
	public void convert_file_to_string_java_nio() throws IOException {

		Path path = Paths.get(fileLocation);

		List<String> file = java.nio.file.Files.readAllLines(path,
				Charsets.UTF_8);

		String fileContents = file.get(0);

		assertEquals("File to string example", fileContents);
	}

	@Test
	public void convert_file_to_string_java_nio_readbytes() throws IOException {

		Path path = Paths.get(fileLocation);

		String stringFromFile = new String(
				java.nio.file.Files.readAllBytes(path));

		assertEquals("File to string example", stringFromFile);
	}

	@Test
	public void convert_file_to_string_java8() throws IOException {

		Path path = Paths.get(fileLocation);

		String stringFromFile = java.nio.file.Files.lines(path).collect(
				Collectors.joining());

		assertEquals("File to string example", stringFromFile);
	}

	@Test
	public void convert_file_to_string_guava() throws IOException {

		File file = new File(fileLocation);

		String fileContents = Files.toString(file, Charsets.UTF_8);

		assertEquals("File to string example", fileContents);
	}

	@Test
	public void convert_file_to_string_apache_commons() throws IOException {

		File file = new File(fileLocation);

		String fileContents = FileUtils.readFileToString(file);

		assertEquals("File to string example", fileContents);
	}

}


text:
var helper = require("../../../helper");
var Manager = require("../../../../src/etl/inventory/fact-shipment-document-etl-manager");
var instanceManager = null;
var should = require("should");
var sqlHelper = require("../../../sql-helper");

before("#00. connect db", function (done) {
    Promise.all([helper, sqlHelper])
        .then((result) => {
            var db = result[0];
            var sql = result[1];
            db.getDb().then((db) => {
                instanceManager = new Manager(db, {
                    username: "unit-test"
                }, sql);
                done();
            })
                .catch((e) => {
                    done(e);
                })
        });
});

it("#01. should success when create etl fact-fp-shipment-document", function (done) {
    instanceManager.run()
        .then((a) => {
            done();
        })
        .catch((e) => {
            done(e);
        });
});


text:
from training import *
from findLeaf import *
import re
from lxml.html import fromstring
from lxml.html import tostring

def stripReasonableWhite(x):
    return re.sub(r"\s+", " ", x).strip()

def splitN(txt, outcome):
    # consider splitting to get result
    txt = stripReasonableWhite(txt)
    outcome = stripReasonableWhite(outcome)
    splitables = set(txt.replace(outcome, '', 1)) - set(' ')
    options = set()
    for s in splitables:
        for i, x in enumerate(txt.split(s)):
            if stripReasonableWhite(x) == stripReasonableWhite(outcome):
                options.add((s, i))
    return options

def splitSolution(how):
    def solution(txt):
        return txt.split(how[0])[how[1]]
    return solution

def asNumeric(x):
    return re.sub("[^0-9]", "", x)

def applySolutionChain(solution, x):
    for sol in solution:
        if isinstance(sol, dict):
            x = x.find(**sol)
        else:
            x = sol(x)
    return x

def buildSolution(training):
    res = findLeaf(training)
    print("len(res)", len(res))
    x = findSharedKeyValues(training, res)
    print("len(shared)", len(x))
    solutions = secondLevelDown(training.soups[0], training.targets[0], x)
    print("len(solutions)", len(solutions))
    return solutions

def tryUniqueID(c, sp):
    return len(sp.findAll(c.name, attrs=c.attrs)) == 1

def buildNewSolution(tr):
    childs = []
    num = 0
    options = []
    for soup, target in zip(tr.soups, tr.targets):
        print('num',num)
        num+=1
        for c in soup.findChildren():
            try:
                if c.name not in ['body', 'html']:
                    if target in c.text:
                        childs.append([c,  len(c.text)])
            except:
                pass

        tmp = []
        for i,x in enumerate(childs[::-1]):
            if tryUniqueID(x[0], soup):
                attrs = x[0].attrs
                attrs['name'] = x[0].name
                attrs = {'attrs' : attrs}
                if x[0].text == target:
                    tmp.append((attrs, BeautifulSoup.get_text))
                elif stripReasonableWhite(x[0].text) == stripReasonableWhite(target):
                    tmp.append((attrs, BeautifulSoup.get_text, stripReasonableWhite))
                elif splitN(x[0].text, target):
                    for splitable in splitN(x[0].text, target):
                        tmp.append((attrs, BeautifulSoup.get_text, splitSolution(splitable)))
                else:
                    print(len([y for y in x[0].children]))
            else:
                print('not unique', len([y for y in x[0].children]))
        options.append(tmp)
    good_options = []
    if options:
        for x in options[0]:
            if all(x in y for y in options[1:]):
                good_options.append(x)
    return good_options

#testAutoScraperSolutions(buildSolution(tr), tr, False)

tr1 = Training("marktplaats-testcase1", "/Users/pascal/GDrive/sky_package/sky/tests/").load()
# tr2 = Training("nieuwsdumper-testcase1", "/Users/pascal/GDrive/sky_package/sky/tests/").load()
tr3 = Training("nieuwsdumper-testcase2", "/Users/pascal/GDrive/sky_package/sky/tests/").load()
# tr4 = Training("bouwmaterieel-testcase1", "/Users/pascal/GDrive/sky_package/sky/tests/").load()
# tr5 = Training('betterdoctor-doctor-referalls', '/Users/pascal/GDrive/sky_package/sky/tests/').load()
tr6 = Training("pypi-author", "/Users/pascal/GDrive/sky_package/sky/tests/").load()

# Moet wel text_content zijn, anders ga je dingen mislopen!!!!!!!!!!!!!
# plottwist misschien gewoon 2 methoden

def getMatchedNodes(tr):
    matchedLeafs = []
    for tree, outcome in zip(tr.trees, tr.targets):
        matchedLeaf = {'text' : [], 'tail' : [], 'attrib' : [], 'content' : []}
        for x in tree.iter():
            if x.text and outcome in x.text:
                matchedLeaf['text'].append(x)
            if x.tail and outcome in x.tail:
                matchedLeaf['tail'].append(x)
            if x.attrib and any([outcome in y for y in x.attrib.values()]):
                matchedLeaf['attrib'].append(x)
        matchedLeafs.append(matchedLeaf)
    return matchedLeafs

def getMatchedTextContentNodes(tree, outcome, container):
    children = tree.getchildren()
    if children:
        for c in children:
            if outcome in c.text_content():
                container.append(c)
                getMatchedTextContentNodes(c, outcome, container)
    return container

for i in range(1000):
    res = getMatchedNodes(tr3)
    for tree, outcome, r in zip(tr3.trees, tr3.targets, res):
        r['content'] = getMatchedTextContentNodes(tree, outcome, [])

div = fromstring('
I have 5 friends
')


text:
package com.henu.smp.activity;

import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;
import android.widget.EditText;

import com.henu.smp.Constants;
import com.henu.smp.R;
import com.henu.smp.base.BaseButton;
import com.henu.smp.base.BaseDialog;
import com.henu.smp.base.BaseMenu;
import com.henu.smp.listener.SimpleAnimationListener;
import com.henu.smp.util.IntentUtil;
import com.henu.smp.util.StringUtil;

import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.ViewInject;

/**
 * Created by liyngu on 12/23/15.
 */
@ContentView(R.layout.activity_create_list)
public class CreateListActivity extends BaseDialog {

    @ViewInject(R.id.content_input)
    private EditText mContentInput;

    @ViewInject(R.id.create_operation_menu)
    private BaseMenu mCreateOperationMenu;

    @ViewInject(R.id.create_menu_list_btn)
    private BaseButton mCreateMenuListBtn;

    @ViewInject(R.id.create_music_list_btn)
    private BaseButton mCreateMusicListBtn;

    @Override
    protected void okBtnOnclickListener(View v) {
        String text = mContentInput.getText().toString();
        if (StringUtil.isEmpty(text)) {
            return;
        }
        final int offsetX = mCreateOperationMenu.getWidth();
        Animation animation = new TranslateAnimation(0, -offsetX, 0, 0);
        animation.setDuration(100);
        animation.setFillAfter(true);
        animation.setAnimationListener(new SimpleAnimationListener() {
            @Override
            public void onAnimationEnd(Animation animation) {
                mCreateOperationMenu.setLocationByView(getDialog());
                mCreateOperationMenu.setX(mCreateOperationMenu.getX() - offsetX);
                mCreateOperationMenu.show();
            }
        });
        getDialog().startAnimation(animation);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mCreateMenuListBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                createList(Constants.CREATE_TYPE_MENU_LIST);
            }
        });
        mCreateMusicListBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                createList(Constants.CREATE_TYPE_MUSIC_LIST);
            }
        });

    }

    private void createList(int type) {
        Bundle bundle = new Bundle();
        bundle.putInt(Constants.ACTION_OPERATION, Constants.ACTION_CREATE_LIST);
        bundle.putInt(Constants.CREATE_LIST_TYPE, type);
        bundle.putString(Constants.CREATE_LIST_NAME, mContentInput.getText().toString());
        IntentUtil.sendBroadcast(CreateListActivity.this, bundle);
        finishActivity();
    }
}


text:
package org.winterblade.minecraft.harmony.integration.botania.operations;

import net.minecraft.item.ItemStack;
import org.winterblade.minecraft.harmony.api.BasicOperation;
import org.winterblade.minecraft.harmony.api.Operation;
import org.winterblade.minecraft.harmony.api.OperationException;
import org.winterblade.minecraft.harmony.api.crafting.RecipeInput;
import org.winterblade.minecraft.harmony.common.ItemUtility;
import org.winterblade.minecraft.harmony.common.utility.LogHelper;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.recipe.RecipePetals;

/**
 * Created by Matt on 6/4/2016.
 */
@Operation(name = "Botania.addPetalRecipe", dependsOn = "Botania")
public class AddPetalRecipeOperation extends BasicOperation {
    /*
     * Serialized properties
     */
    private ItemStack output;
    private RecipeInput[] with;

    /*
     * Computed properties
     */
    private transient RecipePetals recipe;

    /**
     * Called to initialize the set
     *
     * @throws OperationException If something went wrong
     */
    @Override
    public void init() throws OperationException {
        if(output == null) throw new OperationException("Botania.addPetalRecipe must have a valid 'output'.");
        if(with == null || with.length <= 0) throw new OperationException("Botania.addPetalRecipe must have at least one valid intput ('with').");
        recipe = new RecipePetals(output, RecipeInput.getFacsimileItems(with));
    }

    /**
     * Called to apply the set (if not player-specific)
     */
    @Override
    public void apply() {
        LogHelper.info("Adding recipe for {} to the Botania petal apothecary.", ItemUtility.outputItemName(output));
        BotaniaAPI.petalRecipes.add(recipe);
    }

    /**
     * Called to remove the set (if not player-specific)
     */
    @Override
    public void undo() {
        BotaniaAPI.petalRecipes.remove(recipe);
    }
}


text:
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die mit einer Assembly verknüpft sind.
[assembly: AssemblyTitle("ObjectTree (Twee2Z)")]
[assembly: AssemblyDescription("A data structure for saving parsed twee source code")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ObjectTree (Twee2Z)")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
// für COM-Komponenten.  Wenn Sie auf einen Typ in dieser Assembly von
// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
[assembly: ComVisible(false)]

// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("3424926c-f0db-4754-a3dc-a3fd76164b36")]

// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
//      Hauptversion
//      Nebenversion
//      Buildnummer
//      Revision
//
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
 * Copyright 2002-2013 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:batch="http://www.springframework.org/schema/batch"
	xmlns:jdbc="http://www.springframework.org/schema/jdbc"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:context="http://www.springframework.org/schema/context"
	xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
		http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

	<batch:job id="importPayments">
		<batch:step id="loadPayments">
			<batch:tasklet>
				<batch:chunk reader="itemReader" writer="itemWriter" commit-interval="1">
<!--  					<batch:skippable-exception-classes>
						<batch:include class="org.springframework.batch.item.file.FlatFileParseException"/>
					</batch:skippable-exception-classes> -->
					<batch:listeners>
						<batch:listener>
							<bean class="org.springframework.batch.integration.samples.payments.PaymentChunkListener"/>
						</batch:listener>
					</batch:listeners>
				</batch:chunk>
			</batch:tasklet>
		</batch:step>
		<batch:listeners>
			<batch:listener ref="notificationExecutionsListener"/>
		</batch:listeners>
	</batch:job>

	<bean id="itemWriter" class="org.springframework.batch.integration.samples.payments.PaymentWriter">
		<constructor-arg name="dataSource" ref="dataSource"/>
	</bean>

	<bean id="itemReader" class="org.springframework.batch.item.file.FlatFileItemReader" scope="step">
		<property name="resource" value="file:///#{jobParameters['input.file.name']}" />
		<property name="linesToSkip" value="1"/>
		<property name="lineMapper">
			<bean class="org.springframework.batch.item.file.mapping.DefaultLineMapper">
				<property name="lineTokenizer">
					<bean class="org.springframework.batch.item.file.transform.DelimitedLineTokenizer">
						<property name="names" value="source,destination,amount,date" />
					</bean>
				</property>
				<property name="fieldSetMapper">
					<bean class="org.springframework.batch.integration.samples.payments.PaymentFieldSetMapper" />
				</property>
			</bean>
		</property>
	</bean>

</beans>


text:
title: Ssh Abilities
category: feature
authors: ybronhei
wiki_category: Feature
wiki_title: Features/Ssh Abilities
wiki_revision_count: 2
wiki_last_updated: 2013-07-18
---

# Ssh Abilities

## Adding SSH fingerprint validation and Public-Key authentication

### Summary

### Owner

*   Name: [ Yaniv Bronhaim](User:ybronhei)

<!-- -->

*   Email: ybronhei@redhat.com

### Current status

*   oVirt-3.3
*   Last updated: ,

### Current status - Authentication by root password only

Currently we use user/password authentication for host-deploy and node upgrade. The feature adds the ability to use public key authentication for node approval, or password authentication by any privileged user.
**Design Changes**
1. Database
Modifying VdsDynamic

*   Adding sshUserName, sshPortField - That's allow flexible authentication with each privileged user, and with each port that used for SSH protocol on host. This data is saved to allow reinstall the host with same values.

2. Rest API
Modifying Host and Action objects
\* Adding SSH field for both Host and Action to allow flexibility in the authentication protocol, this includes port, authentication method, and fingerprint - When authentication method's default value is Password. Under ssh field we add 'User' reference that includes username and password fields. keeping rootPassword field deprecated for backward compatibility.

<host>
        `<rootPassword>`123`</rootPassword>` -> Still in use for backward compatibility
`  `<ssh>
`    `<port>`22`</port>
`    `<fingerprint>`11:22:33:44:55:66:77:88`</fingerprint>
`    `<authentication_method>`publickey`</authentication_method>
`    `<user>
`       `<user_name>`ybronhei`</user_name>
             `<password>`123`</password>` - When this set we ignore the rootPassword
             ... - There are more fields under user, we don't use the other fields during install, update and approve host
`    `</user>
` `</ssh>
</host>

4. UI
Adding Authentication area in Add/Edit host that allows the user the option to choose between authenticate with the engine's public key or privileged username and password. After first installation we use public key as default. The public key is stored on host as part of the deploy process. 3. Backend
\* GetServerSSHPublicKeyQuery - new query to retrieve the engine's public key, this used by UI to display the public key for the user

*   Enforcing the ability to connect by public key using EngineSSHClient and EngineSSHDialog utils.

### Current status - Fingerprint validation

Currently we don't enforce fingerprint validation. This leads to credential leak.The benefits from enforcing fingerprint validation are that when using password authentication, the password is sent to destination host, if host fingerprint is not validated, password may be sent to compromised host. Furthermore, when installing a host, further communication with vdsm exposes sensitive data (storage, network), if host fingerprint is not validated, vdsm may be installed on compromised host and receive the sensitive data. Without validating host SSH fingerprint, a man-in-the-middle attach is simple, as credentials are exposed.
**Design Changes**
When SSH session is established, engine extracts destination host fingerprint before authentication, validate this fingerprint against the expected host fingerprint, if unmatched disconnect and fail operation. This should make the engine behaves more like traditional ssh regarding the use of ~/.ssh/known_hosts.
1. Database
Modifying VdsDynamic

*   Using sshFingerprint field (Nullable) - (was already added by gluster, using the same field)

2. Rest API
Modifying Host and Action

*   Adding SSH field to allow flexibility in the authentication protocol, this includes port, authentication method, and fingerprint. The API allows missing fingerprint value for backward comparability. When missing using the fetched fingerprint (The scheme is described above).

3. UI
Add\\Edit Host

*   Adding Authentication sub view that shows the host's ssh fingerprint and allowing fetching fingerprint before adding the host.

Reinstall

*   Adding Authentication sub view that shows the host's ssh fingerprint.

4. Backend

*   At the first time engine connects to an host it will store its fingerprint within the database. Then it will enforce this fingerprint in future ssh communications. User will also be able to specify the fingerprint when he adds the host, or fetch it within the "Add Host" dialog using a 'fetch' button. When adding the host, if custom fingerprint was entered, the engine will verify the fingerprint and store it in DB. If not entered, and the host not in DB, the engine stores the fetched fingerprint by default.
*   GetServerSSHKeyFingerprintQuery is a query that retrieves host fingerprint by host name.
*   Enforce validation by using EngineSSHClient::Connect function.

### Dependencies / Related Features

### Documentation / External references

[All Patches Related To Feature](http://gerrit.ovirt.org/#/q/status:merged+project:ovirt-engine+branch:master+topic:auth_ssh,n,z)
[RFE Support ssh public key authentication](https://bugzilla.redhat.com/show_bug.cgi?id=962162)
[RFE When communicate with host enforce host key fingerprint](https://bugzilla.redhat.com/show_bug.cgi?id=848072)

## Testing

### Fingerprint Part

1. If no fingerprint is available in database - after first connection there will be (field: vds_static.sshKeyFingerprint).
2. If there is fingerprint within database, connection will not succeed if fingerprint mismatch. This can be easily tested if you switch IP addresses of two separate hosts.
===Public-Key Part === 1. Adding host by using public key - copy the right public key to host's ~/.ssh/authorized_keys
2. Adding host by using public key with wrong public key on host.
3. Reinstall and Edit host, using public key by default.
4. Approve and upgrade new node - Using public key by default.

<Category:Feature> <Category:Template>


text:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="#ffffffff"/>
    <stroke
        android:color="#000000"
    	android:width="0dp"
    	/>
    <corners
    	android:topLeftRadius="5dp"
        android:topRightRadius="5dp"
        android:bottomRightRadius="5dp"
        android:bottomLeftRadius="5dp"/>
</shape>


text:
package io.fundrequest.core.message.infrastructure;

import io.fundrequest.core.infrastructure.repository.JpaRepository;
import io.fundrequest.core.message.domain.Message;
import io.fundrequest.core.message.domain.MessageType;
import org.springframework.data.domain.Sort;

import java.util.List;
import java.util.Optional;

public interface MessageRepository extends JpaRepository<Message, Long> {
    List<Message> findByType(MessageType type);

    List<Message> findByType(MessageType type, Sort sort);

    Optional<Message> findByTypeAndName(MessageType type, String name);

    void deleteByTypeAndName(MessageType type, String name);

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ChangeListManager">
    <list default="true" id="1f45de3f-aed3-4859-aa36-d0723d850b5e" name="Default" comment="" />
    <ignored path="22.iws" />
    <ignored path=".idea/workspace.xml" />
    <ignored path=".idea/dataSources.local.xml" />
    <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
    <option name="TRACKING_ENABLED" value="true" />
    <option name="SHOW_DIALOG" value="false" />
    <option name="HIGHLIGHT_CONFLICTS" value="true" />
    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
    <option name="LAST_RESOLUTION" value="IGNORE" />
  </component>
  <component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
  <component name="CreatePatchCommitExecutor">
    <option name="PATCH_PATH" value="" />
  </component>
  <component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
  <component name="FavoritesManager">
    <favorites_list name="22" />
  </component>
  <component name="FileEditorManager">
    <leaf>
      <file leaf-file-name="22_canvas_timecountdown.html" pinned="false" current-in-tab="true">
        <entry file="file://$PROJECT_DIR$/22_canvas_timecountdown.html">
          <provider selected="true" editor-type-id="text-editor">
            <state vertical-scroll-proportion="0.69739133">
              <caret line="40" column="0" selection-start-line="40" selection-start-column="0" selection-end-line="40" selection-end-column="0" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
    </leaf>
  </component>
  <component name="GradleLocalSettings">
    <option name="externalProjectsViewState">
      <projects_view />
    </option>
  </component>
  <component name="JsBuildToolGruntFileManager" detection-done="true" />
  <component name="JsGulpfileManager">
    <detection-done>true</detection-done>
  </component>
  <component name="LogFilters">
    <option name="FILTER_ERRORS" value="false" />
    <option name="FILTER_WARNINGS" value="false" />
    <option name="FILTER_INFO" value="true" />
    <option name="FILTER_DEBUG" value="true" />
    <option name="CUSTOM_FILTER" />
  </component>
  <component name="NamedScopeManager">
    <order />
  </component>
  <component name="ProjectFrameBounds">
    <option name="x" value="-8" />
    <option name="y" value="-8" />
    <option name="width" value="1936" />
    <option name="height" value="1056" />
  </component>
  <component name="ProjectLevelVcsManager" settingsEditedManually="false">
    <OptionsSetting value="true" id="Add" />
    <OptionsSetting value="true" id="Remove" />
    <OptionsSetting value="true" id="Checkout" />
    <OptionsSetting value="true" id="Update" />
    <OptionsSetting value="true" id="Status" />
    <OptionsSetting value="true" id="Edit" />
    <ConfirmationsSetting value="0" id="Add" />
    <ConfirmationsSetting value="0" id="Remove" />
  </component>
  <component name="ProjectView">
    <navigator currentView="ProjectPane" proportions="" version="1">
      <flattenPackages />
      <showMembers />
      <showModules />
      <showLibraryContents />
      <hideEmptyPackages />
      <abbreviatePackageNames />
      <autoscrollToSource />
      <autoscrollFromSource />
      <sortByType />
    </navigator>
    <panes>
      <pane id="ProjectPane">
        <subPane>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="22" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
          </PATH>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="22" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="22" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
          </PATH>
        </subPane>
      </pane>
      <pane id="PackagesPane" />
      <pane id="Scratches" />
      <pane id="Scope" />
    </panes>
  </component>
  <component name="PropertiesComponent">
    <property name="aspect.path.notification.shown" value="true" />
    <property name="WebServerToolWindowFactoryState" value="false" />
    <property name="last_opened_file_path" value="$PROJECT_DIR$" />
    <property name="recentsLimit" value="5" />
    <property name="restartRequiresConfirmation" value="true" />
  </component>
  <component name="RunManager" selected="Tomcat Server.Unnamed">
    <configuration default="true" type="#com.intellij.j2ee.web.tomcat.TomcatRunConfigurationFactory" factoryName="Local" ALTERNATIVE_JRE_ENABLED="false">
      <deployment />
      <server-settings />
      <predefined_log_file id="Tomcat" enabled="true" />
      <predefined_log_file id="Tomcat Catalina" enabled="true" />
      <predefined_log_file id="Tomcat Manager" enabled="false" />
      <predefined_log_file id="Tomcat Host Manager" enabled="false" />
      <predefined_log_file id="Tomcat Localhost Access" enabled="false" />
      <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
      <method />
    </configuration>
    <configuration default="true" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" factoryName="Plugin">
      <module name="" />
      <option name="VM_PARAMETERS" value="-Xmx512m -Xms256m -XX:MaxPermSize=250m -ea" />
      <option name="PROGRAM_PARAMETERS" />
      <method />
    </configuration>
    <configuration default="true" type="Applet" factoryName="Applet">
      <option name="WIDTH" value="400" />
      <option name="HEIGHT" value="300" />
      <option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
      <module />
      <method />
    </configuration>
    <configuration default="true" type="Application" factoryName="Application">
      <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
      <option name="MAIN_CLASS_NAME" />
      <option name="VM_PARAMETERS" />
      <option name="PROGRAM_PARAMETERS" />
      <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
      <option name="ALTERNATIVE_JRE_PATH" />
      <option name="ENABLE_SWING_INSPECTOR" value="false" />
      <option name="ENV_VARIABLES" />
      <option name="PASS_PARENT_ENVS" value="true" />
      <module name="" />
      <envs />
      <method />
    </configuration>
    <configuration default="true" type="JUnit" factoryName="JUnit">
      <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
      <module name="" />
      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
      <option name="ALTERNATIVE_JRE_PATH" />
      <option name="PACKAGE_NAME" />
      <option name="MAIN_CLASS_NAME" />
      <option name="METHOD_NAME" />
      <option name="TEST_OBJECT" value="class" />
      <option name="VM_PARAMETERS" value="-ea" />
      <option name="PARAMETERS" />
      <option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
      <option name="ENV_VARIABLES" />
      <option name="PASS_PARENT_ENVS" value="true" />
      <option name="TEST_SEARCH_SCOPE">
        <value defaultName="singleModule" />
      </option>
      <envs />
      <patterns />
      <method />
    </configuration>
    <configuration default="true" type="Remote" factoryName="Remote">
      <option name="USE_SOCKET_TRANSPORT" value="true" />
      <option name="SERVER_MODE" value="false" />
      <option name="SHMEM_ADDRESS" value="javadebug" />
      <option name="HOST" value="localhost" />
      <option name="PORT" value="5005" />
      <method />
    </configuration>
    <configuration default="true" type="TestNG" factoryName="TestNG">
      <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
      <module name="" />
      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
      <option name="ALTERNATIVE_JRE_PATH" />
      <option name="SUITE_NAME" />
      <option name="PACKAGE_NAME" />
      <option name="MAIN_CLASS_NAME" />
      <option name="METHOD_NAME" />
      <option name="GROUP_NAME" />
      <option name="TEST_OBJECT" value="CLASS" />
      <option name="VM_PARAMETERS" value="-ea" />
      <option name="PARAMETERS" />
      <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
      <option name="OUTPUT_DIRECTORY" />
      <option name="ANNOTATION_TYPE" />
      <option name="ENV_VARIABLES" />
      <option name="PASS_PARENT_ENVS" value="true" />
      <option name="TEST_SEARCH_SCOPE">
        <value defaultName="singleModule" />
      </option>
      <option name="USE_DEFAULT_REPORTERS" value="false" />
      <option name="PROPERTIES_FILE" />
      <envs />
      <properties />
      <listeners />
      <method />
    </configuration>
    <configuration default="false" name="Unnamed" type="#com.intellij.j2ee.web.tomcat.TomcatRunConfigurationFactory" factoryName="Local" APPLICATION_SERVER_NAME="Tomcat 7.0.59" ALTERNATIVE_JRE_ENABLED="false" ALTERNATIVE_JRE_PATH="">
      <option name="BROWSER_ID" value="98ca6316-2f89-46d9-a9e5-fa9e2b0625b3" />
      <option name="UPDATING_POLICY" value="restart-server" />
      <deployment />
      <server-settings>
        <option name="BASE_DIRECTORY_NAME" value="Unnamed_22" />
      </server-settings>
      <predefined_log_file id="Tomcat" enabled="true" />
      <predefined_log_file id="Tomcat Catalina" enabled="true" />
      <predefined_log_file id="Tomcat Manager" enabled="false" />
      <predefined_log_file id="Tomcat Host Manager" enabled="false" />
      <predefined_log_file id="Tomcat Localhost Access" enabled="false" />
      <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
      <RunnerSettings RunnerId="Debug">
        <option name="DEBUG_PORT" value="55765" />
      </RunnerSettings>
      <ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Cover">
        <option name="USE_ENV_VARIABLES" value="true" />
        <STARTUP>
          <option name="USE_DEFAULT" value="true" />
          <option name="SCRIPT" value="" />
          <option name="VM_PARAMETERS" value="" />
          <option name="PROGRAM_PARAMETERS" value="" />
        </STARTUP>
        <SHUTDOWN>
          <option name="USE_DEFAULT" value="true" />
          <option name="SCRIPT" value="" />
          <option name="VM_PARAMETERS" value="" />
          <option name="PROGRAM_PARAMETERS" value="" />
        </SHUTDOWN>
      </ConfigurationWrapper>
      <ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Debug">
        <option name="USE_ENV_VARIABLES" value="true" />
        <STARTUP>
          <option name="USE_DEFAULT" value="true" />
          <option name="SCRIPT" value="" />
          <option name="VM_PARAMETERS" value="" />
          <option name="PROGRAM_PARAMETERS" value="" />
        </STARTUP>
        <SHUTDOWN>
          <option name="USE_DEFAULT" value="true" />
          <option name="SCRIPT" value="" />
          <option name="VM_PARAMETERS" value="" />
          <option name="PROGRAM_PARAMETERS" value="" />
        </SHUTDOWN>
      </ConfigurationWrapper>
      <ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Run">
        <option name="USE_ENV_VARIABLES" value="true" />
        <STARTUP>
          <option name="USE_DEFAULT" value="true" />
          <option name="SCRIPT" value="" />
          <option name="VM_PARAMETERS" value="" />
          <option name="PROGRAM_PARAMETERS" value="" />
        </STARTUP>
        <SHUTDOWN>
          <option name="USE_DEFAULT" value="true" />
          <option name="SCRIPT" value="" />
          <option name="VM_PARAMETERS" value="" />
          <option name="PROGRAM_PARAMETERS" value="" />
        </SHUTDOWN>
      </ConfigurationWrapper>
      <method />
    </configuration>
    <list size="1">
      <item index="0" class="java.lang.String" itemvalue="Tomcat Server.Unnamed" />
    </list>
  </component>
  <component name="ShelveChangesManager" show_recycled="false" />
  <component name="TaskManager">
    <task active="true" id="Default" summary="Default task">
      <changelist id="1f45de3f-aed3-4859-aa36-d0723d850b5e" name="Default" comment="" />
      <created>1484317034887</created>
      <option name="number" value="Default" />
      <updated>1484317034887</updated>
      <workItem from="1484317036230" duration="175000" />
    </task>
    <servers />
  </component>
  <component name="TimeTrackingManager">
    <option name="totallyTimeSpent" value="175000" />
  </component>
  <component name="ToolWindowManager">
    <frame x="-8" y="-8" width="1936" height="1056" extended-state="7" />
    <editor active="true" />
    <layout>
      <window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
      <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
      <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
      <window_info id="Palette	" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
      <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
      <window_info id="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32946146" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
      <window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
      <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.32946146" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
      <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
      <window_info id="Designer" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
      <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.25" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
      <window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
      <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
      <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
      <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
      <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
      <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
      <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
      <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
      <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
    </layout>
  </component>
  <component name="VcsContentAnnotationSettings">
    <option name="myLimit" value="2678400000" />
  </component>
  <component name="XDebuggerManager">
    <breakpoint-manager />
    <watches-manager />
  </component>
  <component name="antWorkspaceConfiguration">
    <option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
    <option name="FILTER_TARGETS" value="false" />
  </component>
  <component name="editorHistoryManager">
    <entry file="file://$PROJECT_DIR$/22_canvas_timecountdown.html">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.69739133">
          <caret line="40" column="0" selection-start-line="40" selection-start-column="0" selection-end-line="40" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
  </component>
</project>


text:
package ameba.captcha.backgrounds;

import java.awt.*;
import java.awt.geom.Arc2D;
import java.awt.image.BufferedImage;

/**
 *
SquigglesBackgroundProducer class.

 *
 * @author icode
 * request
 */
public class SquigglesBackgroundProducer implements BackgroundProducer {

    /**
     * {@inheritDoc}
     */
    @Override
    public BufferedImage addBackground(BufferedImage image) {
        int width = image.getWidth();
        int height = image.getHeight();
        return getBackground(width, height);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public BufferedImage getBackground(int width, int height) {
        BufferedImage result = new BufferedImage(width, height,
                BufferedImage.TYPE_INT_RGB);
        Graphics2D graphics = result.createGraphics();

        BasicStroke bs = new BasicStroke(2.0f, BasicStroke.CAP_BUTT,
                BasicStroke.JOIN_MITER, 2.0f, new float[]{2.0f, 2.0f}, 0.0f);
        graphics.setStroke(bs);
        AlphaComposite ac = AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
                0.75f);
        graphics.setComposite(ac);

        graphics.translate(width * -1.0, 0.0);
        double delta = 5.0;
        double xt;
        double ts = 0.0;
        for (xt = 0.0; xt < (2.0 * width); xt += delta) {
            Arc2D arc = new Arc2D.Double(0, 0, width, height, 0.0, 360.0,
                    Arc2D.OPEN);
            graphics.draw(arc);
            graphics.translate(delta, 0.0);
            ts += delta;
        }
        graphics.dispose();
        return result;
    }
}


text:
<?php

namespace DBCast\generator\lineGenerator;

/**
 * Interface LineGeneratorInterface
 */
interface LineGeneratorInterface
{

    /**
     * LineGeneratorInterface constructor.
     * @param array $castDiffData
     */
    public function __construct(array $castDiffData);

    /**
     * Get lines for template
     * @return array
     */
    public function getLines();

}


text:
from django.shortcuts import render

# Create your views here.
def home_view(request):
    return render(request, 'home.html')


text:
$installExePath = Join-Path -Path $Env:SystemRoot 'Microsoft.NET\Framework\v2.0.50727\Microsoft Visual J# 2.0 Redistributable Package\install.exe'
if (Test-Path -Path $installExePath)
{
    Write-Verbose "Uninstaller file exists ($installExePath)"
    Start-ChocolateyProcessAsAdmin `
        -ExeToRun $installExePath `
        -Statements '/qu' `
        -ValidExitCodes @(0, 3010) `
        -WorkingDirectory "${Env:SystemDrive}\" `
        | Out-Null
}
else
{
    Write-Verbose "Uninstaller file does not exist, software has probably been uninstalled already ($installExePath)"
}


text:
char *strdup(const char *s);
char *strndup(const char *s, size_t len);
char *strupr(char *s);
int16_t clamp_999(int16_t value);

#endif