text:
<!DOCTYPE html>

  <meta charset="utf-8">

  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="Description" content="scikit-optimize: machine learning in Python">

  <title>skopt.benchmarks — scikit-optimize 0.8.1 documentation</title>

  <link rel="canonical" href="https://scikit-optimize.github.io/_modules/skopt/benchmarks.html" />

  <link rel="shortcut icon" href="../../_static/favicon.ico"/>

  <link rel="stylesheet" href="../../_static/css/vendor/bootstrap.min.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/gallery.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/gallery-binder.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/gallery-dataframe.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />

    <button
      id="sk-navbar-toggler"
      class="navbar-toggler"
      type="button"
      data-toggle="collapse"
      data-target="#navbarSupportedContent"
      aria-controls="navbarSupportedContent"
      aria-expanded="false"
      aria-label="Toggle navigation"
    >

    </button>

          Install

          User Guide

          API

          Examples

          Getting Started

          Development

          GitHub

          Other Versions

          More

              Getting Started
              Development
              GitHub
              Other Versions

          <form class="search" action="../../search.html" method="get">
            <input class="sk-search-text-input" type="text" name="q" aria-labelledby="searchlabel" />
            <input class="sk-search-text-btn" type="submit" value="Go" />
          </form>

    <input type="checkbox" name="sk-toggle-checkbox" id="sk-toggle-checkbox">
    Toggle Menu

            PrevUp
            Next

          scikit-optimize 0.8.1

            Other versions

Source code for skopt.benchmarks

# -*- coding: utf-8 -*-
"""A collection of benchmark problems."""

import numpy as np

[docs]def bench1(x):
    """A benchmark function for test purposes.

        f(x) = x ** 2

    It has a single minima with f(x*) = 0 at x* = 0.
    """
    return x[0] ** 2

[docs]def bench1_with_time(x):
    """Same as bench1 but returns the computation time (constant)."""
    return x[0] ** 2, 2.22

[docs]def bench2(x):
    """A benchmark function for test purposes.

        f(x) = x ** 2           if x < 0
               (x-5) ** 2 - 5   otherwise.

    It has a global minima with f(x*) = -5 at x* = 5.
    """
    if x[0] < 0:
        return x[0] ** 2
    else:
        return (x[0] - 5) ** 2 - 5

[docs]def bench3(x):
    """A benchmark function for test purposes.

        f(x) = sin(5*x) * (1 - tanh(x ** 2))

    It has a global minima with f(x*) ~= -0.9 at x* ~= -0.3.
    """
    return np.sin(5 * x[0]) * (1 - np.tanh(x[0] ** 2))

[docs]def bench4(x):
    """A benchmark function for test purposes.

        f(x) = float(x) ** 2

    where x is a string. It has a single minima with f(x*) = 0 at x* = "0".
    This benchmark is used for checking support of categorical variables.
    """
    return float(x[0]) ** 2

[docs]def bench5(x):
    """A benchmark function for test purposes.

        f(x) = float(x[0]) ** 2 + x[1] ** 2

    where x is a string. It has a single minima with f(x) = 0 at x[0] = "0"
    and x[1] = "0"
    This benchmark is used for checking support of mixed spaces.
    """
    return float(x[0]) ** 2 + x[1] ** 2

[docs]def branin(x, a=1, b=5.1 / (4 * np.pi ** 2), c=5. / np.pi,
           r=6, s=10, t=1. / (8 * np.pi)):
    """Branin-Hoo function is defined on the square
    :math:`x1 \\in [-5, 10], x2 \\in [0, 15]`.

    It has three minima with f(x*) = 0.397887 at x* = (-pi, 12.275),
    (+pi, 2.275), and (9.42478, 2.475).

    More details: <http://www.sfu.ca/~ssurjano/branin.html>
    """
    return (a * (x[1] - b * x[0] ** 2 + c * x[0] - r) ** 2 +
            s * (1 - t) * np.cos(x[0]) + s)

[docs]def hart6(x,
          alpha=np.asarray([1.0, 1.2, 3.0, 3.2]),
          P=10 ** -4 * np.asarray([[1312, 1696, 5569, 124, 8283, 5886],
                                   [2329, 4135, 8307, 3736, 1004, 9991],
                                   [2348, 1451, 3522, 2883, 3047, 6650],
                                   [4047, 8828, 8732, 5743, 1091, 381]]),
          A=np.asarray([[10, 3, 17, 3.50, 1.7, 8],
                        [0.05, 10, 17, 0.1, 8, 14],
                        [3, 3.5, 1.7, 10, 17, 8],
                        [17, 8, 0.05, 10, 0.1, 14]])):
    """The six dimensional Hartmann function is defined on the unit hypercube.

    It has six local minima and one global minimum f(x*) = -3.32237 at
    x* = (0.20169, 0.15001, 0.476874, 0.275332, 0.311652, 0.6573).

    More details: <http://www.sfu.ca/~ssurjano/hart6.html>
    """
    return -np.sum(alpha * np.exp(-np.sum(A * (np.array(x) - P) ** 2, axis=1)))

            © 2017 - 2020, scikit-optimize contributors (BSD License).


text:
import java.awt.*;
import java.awt.image.*;
import java.io.*;
import java.util.*;
import javax.imageio.*;
import javax.swing.*;

public class Scc {
  static class Pos {
    int x, y;
    public Pos(int x, int y) {
      this.x = x; this.y = y;
    }
  }

  // Prop0 will contain the merge of the two.
  public static void mergeScc(SccProperty prop0, SccProperty prop1) {
    System.out.println(
        "Merging " + prop1.x + "," + prop1.y + " into " + prop0.x + "," + prop0.y);
    prop0.x = (int)((((long)prop0.x) * prop0.size + ((long)prop1.x) * prop1.size) /
        (prop0.size + prop1.size));
    prop0.y = (int)((((long)prop0.y) * prop0.size + ((long)prop1.y) * prop1.size) /
        (prop0.size + prop1.size));
    prop0.r = (int)((((long)prop0.r) * prop0.size + ((long)prop1.r) * prop1.size) /
        (prop0.size + prop1.size));
    prop0.g = (int)((((long)prop0.g) * prop0.size + ((long)prop1.g) * prop1.size) /
        (prop0.size + prop1.size));
    prop0.b = (int)((((long)prop0.b) * prop0.size + ((long)prop1.b) * prop1.size) /
        (prop0.size + prop1.size));
    if (prop1.xmin < prop0.xmin) {
      prop0.xmin = prop1.xmin;
      prop0.xminy = prop1.xminy;
    }
    if (prop1.xmax > prop0.xmax) {
      prop0.xmax = prop1.xmax;
      prop0.xmaxy = prop1.xmaxy;
    }
    if (prop1.ymin < prop0.ymin) {
      prop0.ymin = prop1.ymin;
      prop0.yminx = prop1.yminx;
    }
    if (prop1.ymax > prop0.ymax) {
      prop0.ymax = prop1.ymax;
      prop0.ymaxx = prop1.ymaxx;
    }
    prop0.isGreenLed = prop0.isGreenLed || prop1.isGreenLed;
    prop0.isBlueLed = prop0.isBlueLed || prop1.isBlueLed;
    prop0.isRockerSwitch = prop0.isRockerSwitch || prop1.isRockerSwitch;
    prop0.containsCenter = prop0.containsCenter || prop1.containsCenter;
    prop0.isFirstFromLeft = prop0.isFirstFromLeft || prop1.isFirstFromLeft;

    prop0.size += prop1.size;
  }

  /**
   * Find the strongly connected components.
   */
  public static void findScc(int[] arr, BufferedImage img, int[][] scc,
      Map<Integer, SccProperty> sccProp, Map<Integer, SccProperty> sccPropLarge,
      SumImage sumImage) {
    int width = arr[1];
    int height = arr[0];
    int maxComponentSize = width * height / 50;
    int minComponentSize = width * height / 45000;
    System.out.println("Min component szie: " + minComponentSize);

    int[][] sccRgb = new int[width][height];
    int curComponent = 1;
    int numInterestingComponents = 0;
    Random rand = new Random();
    ArrayList<Integer> greenLedKeys = new ArrayList<Integer>();
    ArrayList<SccProperty> greenLedValues = new ArrayList<SccProperty>();
    ArrayList<Integer> blueLedKeys = new ArrayList<Integer>();
    ArrayList<SccProperty> blueLedValues = new ArrayList<SccProperty>();
    for (int y = 0; y < height; ++y) {
      for (int x = 0; x < width; ++x) {
        if (scc[x][y] != 0) {
          continue;
        }
        if (!sumImage.isForeground[x][y] && !sumImage.isBackground[x][y]) continue;
        boolean localIsForeground = sumImage.isForeground[x][y];
        // Start a new fill.
        LinkedList<Pos> q = new LinkedList<Pos>();
        scc[x][y] = curComponent;
        int sharedRgb = (int) (rand.nextInt() | 0xff000000);
        q.add(new Pos(x, y));
        int idx = 2 + y * width + x;
        int r = (arr[idx] >> 16) & 0x00ff;
        int g = (arr[idx] >> 8) & 0x00ff;
        int b = (arr[idx]) & 0x00ff;
        int localHue = ImageProcessor.getHue(r, g, b);
        long localLum = r * r + g * g + b * b;
        int componentSize = 1;
        int compXmin = Integer.MAX_VALUE;
        int compXmax = 0;
        int compYmin = Integer.MAX_VALUE;
        int compYmax = 0;
        int compXminY = 0;
        int compXmaxY = 0;
        int compYminX = 0;
        int compYmaxX = 0;
        long sumSquaredR = r * r;
        long sumSquaredG = g * g;
        long sumSquaredB = b * b;
        long compR = r;
        long compG = g;
        long compB = b;
        long compX = x;
        long compY = y;
        while (!q.isEmpty()) {
          Pos cur = q.poll();
          if (cur.x > compXmax) {
            compXmax = cur.x;
            compXmaxY = cur.y;
          }
          if (cur.x < compXmin) {
            compXmin = cur.x;
            compXminY = cur.y;
          }
          if (cur.y > compYmax) {
            compYmax = cur.y;
            compYmaxX = cur.x;
          }
          if (cur.y < compYmin) {
            compYmin = cur.y;
            compYminX = cur.x;
          }
          /*int tmpidx = 2 + cur.y * width + cur.x;
          int tmpr = (arr[tmpidx] >> 16) & 0x00ff;
          int tmpg = (arr[tmpidx] >> 8) & 0x00ff;
          int tmpb = (arr[tmpidx]) & 0x00ff;
          int neighHue = ImageProcessor.getHue(tmpr, tmpg, tmpb);*/
          for (int dy = Math.max(cur.y - 1, 0); dy < Math.min(height, cur.y + 2); ++dy) {
            for (int dx = Math.max(cur.x - 1, 0); dx < Math.min(width, cur.x + 2); ++dx) {
              if (scc[dx][dy] != 0) {
                continue;
              }
              if (!sumImage.isForeground[dx][dy] && !sumImage.isBackground[dx][dy]) continue;
              if (localIsForeground != sumImage.isForeground[dx][dy]) continue;

              // Unvisited neighbor.
              int didx = 2 + dy * width + dx;
              long dr = (arr[didx] >> 16) & 0x00ff;
              long dg = (arr[didx] >> 8) & 0x00ff;
              long db = (arr[didx]) & 0x00ff;
              int curHue = ImageProcessor.getHue((int)dr, (int)dg, (int)db);
              long dr0 = dr;
              long dg0 = dg;
              long db0 = db;

              dr -= r;
              dg -= g;
              db -= b;
              dr *= dr;
              dg *= dg;
              db *= db;
              long diff = dr + dg + db;
              //int hueDiff = Math.abs(curHue - neighHue);
              //if (hueDiff > 180) {
              //  hueDiff = 360 - hueDiff;
              //}
              //if (hueDiff < 120) {
              //if (Math.abs(curHue - localHue) < 60) {
              //if (diff < Math.max(localLum, 10000)) {
              //{
                sumSquaredR += dr0 * dr0;
                sumSquaredG += dg0 * dg0;
                sumSquaredB += db0 * db0;
                compR += dr0;
                compG += dg0;
                compB += db0;
                compX += dx;
                compY += dy;
                sccRgb[dx][dy] = sharedRgb;
                //img.setRGB(dx, dy, sharedRgb);
                scc[dx][dy] = curComponent;
                ++componentSize;
                q.add(new Pos(dx, dy));
              //}
            }
          }
        }  // while
        if (componentSize < maxComponentSize) {
          sumSquaredR /= componentSize;
          sumSquaredG /= componentSize;
          sumSquaredB /= componentSize;
          boolean isGreenLed = componentSize > 20 &&
              (sumSquaredG - Math.min(sumSquaredR, sumSquaredB) > 14500) &&
              sumSquaredG - Math.max(sumSquaredR, sumSquaredB) > 2500 && localIsForeground;
          boolean isBlueLed = componentSize > 30 && componentSize < height * 3 / 2 &&
              (sumSquaredR < 11000 || sumSquaredB - sumSquaredR > 43000) &&
              sumSquaredB > 40000 &&
              sumSquaredB - Math.max(sumSquaredR, sumSquaredG) > 5000 && localIsForeground;
          /* &&
              Math.abs((compXmax - compXmin) - (compYmax - compYmin)) <
              Math.max(compXmax - compXmin, compYmax - compYmin);*/
          if (isGreenLed || isBlueLed || componentSize > minComponentSize) {
            SccProperty prop = new SccProperty();
            prop.xmin = compXmin;
            prop.xmax = compXmax;
            prop.ymin = compYmin;
            prop.ymax = compYmax;
            prop.xminy = compXminY;
            prop.xmaxy = compXmaxY;
            prop.yminx = compYminX;
            prop.ymaxx = compYmaxX;
            prop.size = componentSize;
            prop.r = (int) (compR / componentSize);
            prop.g = (int) (compG / componentSize);
            prop.b = (int) (compB / componentSize);
            prop.x = (int) (compX / componentSize);
            prop.y = (int) (compY / componentSize);
            prop.containsCenter = true;
            prop.isFirstFromLeft = false;
            prop.propNum = curComponent;
            if (isGreenLed) {
              prop.isGreenLed = true;
              prop.isBlueLed = false;
              greenLedKeys.add(curComponent);
              greenLedValues.add(prop);
              System.out.println(prop.x + "," + prop.y + " (g): " + componentSize + " " +
                  sumSquaredR + "/" + sumSquaredG + "/" + sumSquaredB);
            } else if (isBlueLed) {
              prop.isGreenLed = false;
              prop.isBlueLed = true;
              blueLedKeys.add(curComponent);
              blueLedValues.add(prop);
              System.out.println(prop.x + "," + prop.y + " (b): " + componentSize + " " +
                  sumSquaredR + "/" + sumSquaredG + "/" + sumSquaredB);
            } else {
              prop.isGreenLed = false;
              prop.isBlueLed = false;
              sccProp.put(curComponent, prop);
            }

            ++numInterestingComponents;
          }
        } else {
          // Large component
          SccProperty prop = new SccProperty();
          prop.xmin = compXmin;
          prop.xmax = compXmax;
          prop.ymin = compYmin;
          prop.ymax = compYmax;
          prop.xminy = compXminY;
          prop.xmaxy = compXmaxY;
          prop.yminx = compYminX;
          prop.ymaxx = compYmaxX;
          prop.size = componentSize;
          prop.r = (int) (compR / componentSize);
          prop.g = (int) (compG / componentSize);
          prop.b = (int) (compB / componentSize);
          prop.x = (int) (compX / componentSize);
          prop.y = (int) (compY / componentSize);
          prop.isGreenLed = false;
          prop.isBlueLed = false;
          prop.containsCenter = true;
          prop.isFirstFromLeft = false;
          sccPropLarge.put(curComponent, prop);
        }
        ++curComponent;
      }
    }

    // Merge components which are less than 2.5% of the average linear dimension away from each
    // other.
    // TODO: Bail if there are a crazy number of found leds.
    long maxDist = (width + height) / 2 * 25L / 1000L;
    maxDist *= maxDist;  // Compare in the squared space to avoid sqrt.
    for (int i = 0; i < greenLedKeys.size(); ++i) {
      if (sccProp.containsKey(greenLedKeys.get(i))) continue;
      SccProperty prop0 = greenLedValues.get(i);
      ArrayList<Integer> mergedComponents = new ArrayList<Integer>();
      mergedComponents.add(greenLedKeys.get(i));
      for (int j = i + 1; j < greenLedKeys.size(); ++j) {
        if (sccProp.containsKey(greenLedKeys.get(j))) continue;
        SccProperty prop1 = greenLedValues.get(j);
        int dx = prop0.x - prop1.x;
        int dy = prop0.y - prop1.y;
        if (dx * dx + dy * dy < maxDist) {
          mergeScc(prop0, prop1);
          mergedComponents.add(greenLedKeys.get(j));
        }
      }
      for (int k = 0; k < mergedComponents.size(); ++k) {
        sccProp.put(mergedComponents.get(k), prop0);
      }
    }
    for (int i = 0; i < blueLedKeys.size(); ++i) {
      if (sccProp.containsKey(blueLedKeys.get(i))) continue;
      SccProperty prop0 = blueLedValues.get(i);
      ArrayList<Integer> mergedComponents = new ArrayList<Integer>();
      mergedComponents.add(blueLedKeys.get(i));
      for (int j = i + 1; j < blueLedKeys.size(); ++j) {
        if (sccProp.containsKey(blueLedKeys.get(j))) continue;
        SccProperty prop1 = blueLedValues.get(j);
        int dx = prop0.x - prop1.x;
        int dy = prop0.y - prop1.y;
        if (dx * dx + dy * dy < maxDist) {
          mergeScc(prop0, prop1);
          mergedComponents.add(blueLedKeys.get(j));
        }
      }
      for (int k = 0; k < mergedComponents.size(); ++k) {
        sccProp.put(mergedComponents.get(k), prop0);
      }
    }

    /*long maxDistForMerge = (width + height) / 2 * 25L / 1000L;
    maxDistForMerge *= maxDistForMerge;
    ArrayList<SccProperty> allGridScc = new ArrayList<SccProperty>(sccProp.values());
    ArrayList<SccProperty> mergedGrid = new ArrayList<SccProperty>();
    boolean hadMerge = true;
    while (hadMerge) {
      HashSet<Integer> alreadyMergedGrid = new HashSet<Integer>();
      hadMerge = false;
      for (int i = 0; i < allGridScc.size(); ++i) {
        SccProperty prop0 = allGridScc.get(i);
        if (alreadyMergedGrid.contains(prop0.propNum)) continue;
        ArrayList<Integer> mergedComponents = new ArrayList<Integer>();
        alreadyMergedGrid.add(prop0.propNum);
        mergedComponents.add(prop0.propNum);
        for (int j = i + 1; j < allGridScc.size(); ++j) {
          SccProperty prop1 = allGridScc.get(j);
          if (alreadyMergedGrid.contains(prop1.propNum)) continue;
          int dx = prop0.x - prop1.x;
          int dy = prop0.y - prop1.y;
          if (dx * dx + dy * dy < maxDistForMerge) {
            Scc.mergeScc(prop0, prop1);
            alreadyMergedGrid.add(prop1.propNum);
            mergedComponents.add(prop1.propNum);
            hadMerge = true;
          }
        }
        for (int k = 0; k < mergedComponents.size(); ++k) {
          sccProp.put(mergedComponents.get(k), prop0);
        }
        mergedGrid.add(prop0);
      }
      if (hadMerge) {
        allGridScc = mergedGrid;
        mergedGrid = new ArrayList<SccProperty>();
      }
    }*/

    boolean drawInteresting = true;
    for (int y = 0; y < height; ++y) {
      for (int x = 0; x < width; ++x) {
        if (drawInteresting) {
          // Draw the "interesting" components.
          if (sccProp.containsKey(scc[x][y])) {
            //img.setRGB(x, y, sccRgb[x][y]);
            SccProperty prop = sccProp.get(scc[x][y]);
            int rgb = 0xff000000 | (prop.r << 16) | (prop.g << 8) | prop.b;
            img.setRGB(x, y, rgb);
          } else {
            img.setRGB(x, y, Color.white.getRGB());
          }
        } else {
          // Draw the "large" components.
          if (sccPropLarge.containsKey(scc[x][y]) && sumImage.isBackground[x][y]) {
            SccProperty prop = sccPropLarge.get(scc[x][y]);
            int rgb = 0xff000000 | (prop.r << 16) | (prop.g << 8) | prop.b;
            img.setRGB(x, y, rgb);
          } else {
            img.setRGB(x, y, Color.white.getRGB());
          }
        }
      }
    }
    /*IdeaTester.allowMarkPos = true;
    for (SccProperty prop : sccProp.values()) {
      IdeaTester.markPos(img, prop.x, prop.y, "");
    }
    IdeaTester.allowMarkPos = false;*/

    /*ArrayList<SccProperty> blackestOnes = new ArrayList<SccProperty>(sccProp.values());
    Collections.sort(blackestOnes, new Comparator<SccProperty>() {
      @Override
      public int compare(SccProperty prop0, SccProperty prop1) {
        int lum0 = prop0.r * prop0.r + prop0.g * prop0.g + prop0.b * prop0.b;
        int lum1 = prop1.r * prop1.r + prop1.g * prop1.g + prop1.b * prop1.b;
        return Integer.valueOf(lum0).compareTo(Integer.valueOf(lum1));
      }
    });
    for (int i = 0; i < blackestOnes.size() / 10; ++i) {
      IdeaTester.markPos(img, blackestOnes.get(i).x, blackestOnes.get(i).y, "Candidate Rocker");
    }*/

    for (SccProperty prop : sccProp.values()) {
      if (IdeaTester.mightBeRocker(img, width, height, scc, 0, prop)) {
        // Might be a rocker, we'll say it is if it can reach all LEDs.
        boolean reachAll = true;
        for (SccProperty prop2 : sccProp.values()) {
          if (prop2.isGreenLed || prop2.isBlueLed) {
            if (!IdeaTester.canReach(img, width, height, prop, prop2, scc, sccPropLarge)) {
              reachAll = false;
              break;
            }
          }
        }
        if (reachAll) {
          //IdeaTester.markPos(img, prop.x, prop.y, "Candidate Rocker");
          //IdeaTester.markPosRed(img, prop.x, prop.y, "Candidate Rocker");
          System.out.println("Candidate rocker post-reachability: " + prop.x + "," + prop.y);
          prop.isRockerSwitch = true;
        }
      }
      /*if (prop.isGreenLed || prop.isBlueLed) {
        // Look to the left.
        boolean isFirstFromLeft = true;
        for (int x = prop.xmin - 1; x >= 0; --x) {
          if (sccPropLarge.containsKey(scc[x][prop.xminy])) {
            break;
          }
          if (sccProp.containsKey(scc[x][prop.xminy]) &&
              sccProp.get(scc[x][prop.xminy]).x < prop.xmin) {
            isFirstFromLeft = false;
            break;
          }
        }
        if (isFirstFromLeft) {
          prop.isFirstFromLeft = true;
          IdeaTester.markPos(img, prop.x, prop.y, "IS FIRST FROM LEFT");
        }
      }*/
      if (prop.isGreenLed) {
        IdeaTester.markPos(img, prop.x, prop.y, "___");
      } else if (prop.isBlueLed) {
        IdeaTester.markPosBlue(img, prop.x, prop.y, "_ _");
      }
    }
    System.out.println("Num compoennts: " + (curComponent - 1));
    System.out.println("Num interesting components: " + numInterestingComponents);
    System.out.println("Num large components: " + sccPropLarge.size());

  }
}

redpajama_set_name: RedPajamaGithub


text:
"""
Integration test: test FAT mode with the fatoptimizer configured in this file.
"""
import fatoptimizer
import dis
import fat
import io
import sys
import textwrap
import unittest

# Disable the AST optimizer on this module
__fatoptimizer__ = {'enabled': False}

def create_optimizer():
    config = fatoptimizer.Config()
    config.strict = False
    config.copy_builtin_to_constant = {'chr'}

    return fatoptimizer.FATOptimizer(config)

# Replace existing AST transformers with our optimizer
sys.set_code_transformers([create_optimizer()])

def disassemble(obj):
    output = io.StringIO()
    dis.dis(obj, file=output)
    return output.getvalue()

class CopyGlobalToLocal(unittest.TestCase):
    def test_builtin(self):
        ns = {}
        exec(textwrap.dedent("""
            def func(x):
                return chr(x)
        """), ns, ns)
        func = ns['func']

        self.assertIn('LOAD_GLOBAL', disassemble(func))
        self.assertEqual(func.__code__.co_consts, (None,))

        # the specialized bytecode must not use LOAD_GLOBAL, but have
        # chr in its constants
        self.assertEqual(len(fat.get_specialized(func)), 1)
        new_code = fat.get_specialized(func)[0][0]
        self.assertNotIn('LOAD_GLOBAL', disassemble(new_code))
        self.assertEqual(new_code.co_consts, (None, chr))

        # call the specialized function
        self.assertNotIn('chr', globals())
        self.assertEqual(func(65), 'A')

        # chr() is modified in globals(): call the original function
        # and remove the specialized bytecode
        ns['chr'] = str
        self.assertEqual(func(65), '65')
        self.assertEqual(len(fat.get_specialized(func)), 0)

if __name__ == "__main__":
    unittest.main()


text:
use gfx::{
    format::{Depth, Srgba8},
    Device,
};
use gfx_glyph::{ab_glyph::*, *};
use glutin::{
    event::{ElementState, Event, KeyboardInput, MouseScrollDelta, VirtualKeyCode, WindowEvent},
    event_loop::ControlFlow,
};
use old_school_gfx_glutin_ext::*;
use std::{env, error::Error};

const MAX_FONT_SIZE: f32 = 4000.0;

fn main() -> Result<(), Box<dyn Error>> {
    if env::var("RUST_LOG").is_err() {
        env::set_var("RUST_LOG", "gfx_glyph=warn");
    }

    env_logger::init();

    if cfg!(target_os = "linux") {
        // winit wayland is currently still wip
        if env::var("WINIT_UNIX_BACKEND").is_err() {
            env::set_var("WINIT_UNIX_BACKEND", "x11");
        }
        // disables vsync sometimes on x11
        if env::var("vblank_mode").is_err() {
            env::set_var("vblank_mode", "0");
        }
    }
    if cfg!(debug_assertions) && env::var("yes_i_really_want_debug_mode").is_err() {
        eprintln!(
            "You should probably run an example called 'performance' in release mode, \
            don't you think?\n    \
            e.g. use `cargo run --example performance --release`\n\n\
            If you really want to see debug performance set env var `yes_i_really_want_debug_mode`"
        );
        return Ok(());
    }

    let event_loop = glutin::event_loop::EventLoop::new();
    let title = "gfx_glyph rendering 30,000 glyphs - scroll to size, type to modify";
    let window_builder = glutin::window::WindowBuilder::new()
        .with_title(title)
        .with_inner_size(glutin::dpi::PhysicalSize::new(1024, 576));

    let (window_ctx, mut device, mut factory, mut main_color, mut main_depth) =
        glutin::ContextBuilder::new()
            .with_gfx_color_depth::<Srgba8, Depth>()
            .build_windowed(window_builder, &event_loop)?
            .init_gfx::<Srgba8, Depth>();

    let dejavu = FontRef::try_from_slice(include_bytes!("../../fonts/DejaVuSans.ttf"))?;
    let mut glyph_brush = GlyphBrushBuilder::using_font(dejavu)
        .initial_cache_size((2048, 2048))
        .draw_cache_position_tolerance(1.0)
        .build(factory.clone());

    let mut text: String = include_str!("loads-of-unicode.txt").into();
    let mut encoder: gfx::Encoder<_, _> = factory.create_command_buffer().into();

    let mut font_size: f32 = 25.0;
    let mut loop_helper = spin_sleep::LoopHelper::builder().build_without_target_rate();

    event_loop.run(move |event, _, control_flow| {
        *control_flow = ControlFlow::Poll;

        match event {
            Event::WindowEvent { event, .. } => match event {
                WindowEvent::KeyboardInput {
                    input:
                        KeyboardInput {
                            virtual_keycode: Some(VirtualKeyCode::Escape),
                            ..
                        },
                    ..
                }
                | WindowEvent::CloseRequested => *control_flow = ControlFlow::Exit,
                WindowEvent::Resized(size) => {
                    window_ctx.resize(size);
                    window_ctx.update_gfx(&mut main_color, &mut main_depth);
                }
                WindowEvent::KeyboardInput {
                    input:
                        KeyboardInput {
                            state: ElementState::Pressed,
                            virtual_keycode: Some(VirtualKeyCode::Back),
                            ..
                        },
                    ..
                } => {
                    text.pop();
                }
                WindowEvent::ReceivedCharacter(c) => {
                    if c != '\u{7f}' && c != '\u{8}' {
                        text.push(c);
                    }
                }
                WindowEvent::MouseWheel {
                    delta: MouseScrollDelta::LineDelta(_, y),
                    ..
                } => {
                    // increase/decrease font size with mouse wheel
                    if y > 0.0 {
                        font_size += (font_size / 4.0).max(2.0)
                    } else {
                        font_size *= 4.0 / 5.0
                    };
                    font_size = font_size.max(1.0).min(MAX_FONT_SIZE);
                }
                _ => (),
            },
            Event::MainEventsCleared => {
                encoder.clear(&main_color, [0.02, 0.02, 0.02, 1.0]);

                let (width, height, ..) = main_color.get_dimensions();
                let (width, height) = (f32::from(width), f32::from(height));
                let scale = PxScale::from(font_size * window_ctx.window().scale_factor() as f32);

                // The section is all the info needed for the glyph brush to render a 'section' of text.
                let section = Section::default()
                    .add_text(
                        Text::new(&text)
                            .with_scale(scale)
                            .with_color([0.8, 0.8, 0.8, 1.0]),
                    )
                    .with_bounds((width, height))
                    .with_layout(
                        Layout::default().line_breaker(BuiltInLineBreaker::AnyCharLineBreaker),
                    );

                // Adds a section & layout to the queue for the next call to `use_queue().draw(..)`,
                // this can be called multiple times for different sections that want to use the
                // same font and gpu cache.
                // This step computes the glyph positions, this is cached to avoid unnecessary
                // recalculation.
                glyph_brush.queue(&section);

                // Finally once per frame you want to actually draw all the sections you've
                // submitted with `queue` calls.
                //
                // Note: Drawing in the case the text is unchanged from the previous frame
                // (a common case) is essentially free as the vertices are reused &  gpu cache
                // updating interaction can be skipped.
                glyph_brush
                    .use_queue()
                    .draw(&mut encoder, &main_color)
                    .unwrap();

                encoder.flush(&mut device);
                window_ctx.swap_buffers().unwrap();
                device.cleanup();

                if let Some(rate) = loop_helper.report_rate() {
                    window_ctx
                        .window()
                        .set_title(&format!("{} - {:.0} FPS", title, rate));
                }

                loop_helper.loop_start();
            }
            _ => (),
        }
    });
}


text:
package nucleus.example.ui.main;

import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.widget.CheckBox;

import javax.inject.Inject;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;
import nucleus.example.R;
import nucleus.example.util.Injector;
import nucleus.view.NucleusAppCompatActivity;

public class MainActivity extends NucleusAppCompatActivity<MainPresenter> {

    @Inject SharedPreferences pref;

    @Bind(R.id.button_delay) CheckBox delay;

    @Override
    public void onCreate(Bundle savedInstanceState) {

        ((Injector) getApplication()).inject(this);

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ButterKnife.bind(this);

        delay.setChecked(pref.getInt("delay", 0) != 0);

        if (savedInstanceState == null)
            getSupportFragmentManager().beginTransaction()
                .replace(R.id.fragmentContainer, new MainFragment())
                .commit();
    }

    public void push(Fragment fragment) {
        getSupportFragmentManager().beginTransaction()
            .addToBackStack(null)
            .replace(R.id.fragmentContainer, fragment)
            .commit();
    }

    public void replace(Fragment fragment) {
        getSupportFragmentManager().popBackStackImmediate(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
        getSupportFragmentManager().beginTransaction()
            .replace(R.id.fragmentContainer, fragment)
            .commit();
    }

    @OnClick(R.id.button_delay)
    void onButtonDelay() {
        pref.edit()
            .putInt("delay", delay.isChecked() ? 5 : 0)
            .apply();
    }
}


text:
class Shader;

Pipeline::Pipeline():mPipeline(NULL)
{

}

bool Pipeline::createGraphicsPipeline(ID3D12Device* device, RootSignature& rootsig, ShaderSet & shaderset, RenderTargetFormat &format, DepthStencilState&& depthstenstate, BlendState &&blendstate, RasterizerState &&raster, VertexInputLayOutType layout, D3D12_PRIMITIVE_TOPOLOGY_TYPE topype)
{
	mType = Graphics;
	//psoDesc = {};

	std::vector<D3D12_INPUT_ELEMENT_DESC> elemts;
	D3D12_GRAPHICS_PIPELINE_STATE_DESC psoDesc = {};
	if (shaderset.shaders[VS].mShader)
	{

		psoDesc.VS = CD3DX12_SHADER_BYTECODE(shaderset.shaders[VS].mShader);
			elemts = shaderset.shaders[VS].getInputElements(layout);
			psoDesc.InputLayout = { elemts.data(),(unsigned int)elemts.size() };
	}
	if (shaderset.shaders[PS].mShader)
		psoDesc.PS = CD3DX12_SHADER_BYTECODE(shaderset.shaders[PS].mShader);
	if (shaderset.shaders[GS].mShader)
		psoDesc.GS = CD3DX12_SHADER_BYTECODE(shaderset.shaders[GS].mShader);
	if (shaderset.shaders[DS].mShader)
		psoDesc.DS = CD3DX12_SHADER_BYTECODE(shaderset.shaders[DS].mShader);
	if (shaderset.shaders[HS].mShader)
		psoDesc.HS = CD3DX12_SHADER_BYTECODE(shaderset.shaders[HS].mShader);
	psoDesc.pRootSignature = rootsig.mRootSignature;
	psoDesc.RasterizerState = raster.mRasterizerState;
 	psoDesc.BlendState = blendstate.mBlendState;
	psoDesc.SampleMask = UINT_MAX;
	psoDesc.PrimitiveTopologyType = topype;
	psoDesc.NumRenderTargets = format.mNumofRenderTargets;

	for(int i = 0 ; i < format.mNumofRenderTargets ; ++i)
		psoDesc.RTVFormats[i] = format.mRenderTargetFormat[i];

	psoDesc.DepthStencilState = depthstenstate.mDepthStencilState;
	psoDesc.DSVFormat = format.mDepthStencilFormat;
	if (psoDesc.DSVFormat == DXGI_FORMAT_R32_TYPELESS)
		psoDesc.DSVFormat = DXGI_FORMAT_D32_FLOAT;
	if (psoDesc.DSVFormat == DXGI_FORMAT_R16_TYPELESS)
		psoDesc.DSVFormat = DXGI_FORMAT_D16_UNORM;

//	psoDesc.DepthStencilState.DepthEnable = FALSE;
//	psoDesc.DepthStencilState.StencilEnable = FALSE;

	psoDesc.SampleDesc.Count = 1;

	device->CreateGraphicsPipelineState(&psoDesc, IID_PPV_ARGS(&mPipeline));
	return true;
}

bool Pipeline::createComputePipeline(ID3D12Device* device, RootSignature& rootsig, ShaderSet & shaderset)
{
	mType = Compute;
	D3D12_COMPUTE_PIPELINE_STATE_DESC psoDesc = {};

	std::vector<D3D12_INPUT_ELEMENT_DESC> elemts;
	//	D3D12_GRAPHICS_PIPELINE_STATE_DESC psoDesc = {};
	if (shaderset.shaders[CS].mShader)
	{
		psoDesc.CS = CD3DX12_SHADER_BYTECODE(shaderset.shaders[CS].mShader);

	}
	psoDesc.pRootSignature = rootsig.mRootSignature;
	ThrowIfFailed(device->CreateComputePipelineState(&psoDesc, IID_PPV_ARGS(&mPipeline)));
	return true;
}

void Pipeline::release()
{
	SAFE_RELEASE(mPipeline);
}


text:
<?php

namespace Shop\LileyaBundle\Entity\Repository;

use Doctrine\ORM\EntityRepository;

/**
 * SkladRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class SkladRepository extends EntityRepository
{
}


text:
// ****************************************************************************
// <copyright file="ShellTileWithCreateService.cs" company="Pedro Lamas">
// Copyright © Pedro Lamas 2013
// </copyright>
// ****************************************************************************
// <author>Pedro Lamas</author>
// <email>pedrolamas@gmail.com</email>
// <date>21-05-2013</date>
// <project>Cimbalino.Phone.Toolkit</project>
// <web>http://www.pedrolamas.com</web>
// <license>
// See license.txt in this solution or http://www.pedrolamas.com/license_MIT.txt
// </license>
// ****************************************************************************

using System;
using Microsoft.Phone.Shell;

namespace Cimbalino.Phone.Toolkit.Services
{
    /// <summary>
    /// Represents an implementation of the <see cref="IShellTileService"/>.
    /// </summary>
    public class ShellTileWithCreateService : ShellTileService
    {
        /// <summary>
        /// Creates a new secondary tile.
        /// </summary>
        /// <param name="navigationUri"><see cref="Uri"/> for the tile being created. The <see cref="Uri"/> can contain custom launch parameters.</param>
        /// <param name="initialTileData">Text and image information for the tile being created.</param>
        /// <param name="supportsWideTile">true if the wide tile size is supported; otherwise, false.</param>
        public override void Create(Uri navigationUri, IShellTileServiceTileData initialTileData, bool supportsWideTile)
        {
            var shellTileServiceTileDataBase = initialTileData as ShellTileServiceTileDataBase;

            if (shellTileServiceTileDataBase == null)
            {
                throw new ArgumentException("A ShellTileServiceTileDataBase instance is expected.", "initialTileData");
            }
#if WP8
            ShellTile.Create(navigationUri, shellTileServiceTileDataBase.ToShellTileData(), supportsWideTile);
#else
            if (LiveTilesSupported)
            {
                var shellTileType = Type.GetType("Microsoft.Phone.Shell.ShellTile, Microsoft.Phone");
                var createmethod = shellTileType.GetMethod("Create", new[] { typeof(Uri), typeof(ShellTileData), typeof(bool) });

                createmethod.Invoke(null, new object[] { navigationUri, shellTileServiceTileDataBase.ToShellTileData(), supportsWideTile });
            }
            else
            {
                ShellTile.Create(navigationUri, shellTileServiceTileDataBase.ToShellTileData());
            }
#endif
        }
    }
}


text:
/*
 * This class was automatically generated with
 * Castor 1.2, using an XML
 * Schema.
 * $Id: IsNotNullExprDescriptor.java,v 1.1 2010/07/09 08:17:18 back Exp $
 */

package org.ralasafe.db.sql.xml.descriptors;

  //---------------------------------/
 //- Imported classes and packages -/
//---------------------------------/

import org.ralasafe.db.sql.xml.IsNotNullExpr;

/**
 * Class IsNotNullExprDescriptor.
 *
 * @version $Revision: 1.1 $ $Date: 2010/07/09 08:17:18 $
 */
public class IsNotNullExprDescriptor extends org.ralasafe.db.sql.xml.descriptors.IsNotNullExprTypeDescriptor {

      //--------------------------/
     //- Class/Member Variables -/
    //--------------------------/

    /**
     * Field _elementDefinition.
     */
    private boolean _elementDefinition;

    /**
     * Field _nsPrefix.
     */
    private java.lang.String _nsPrefix;

    /**
     * Field _nsURI.
     */
    private java.lang.String _nsURI;

    /**
     * Field _xmlName.
     */
    private java.lang.String _xmlName;

    /**
     * Field _identity.
     */
    private org.exolab.castor.xml.XMLFieldDescriptor _identity;

      //----------------/
     //- Constructors -/
    //----------------/

    public IsNotNullExprDescriptor() {
        super();
        setExtendsWithoutFlatten(new org.ralasafe.db.sql.xml.descriptors.IsNotNullExprTypeDescriptor());
        _xmlName = "isNotNullExpr";
        _elementDefinition = true;
    }

      //-----------/
     //- Methods -/
    //-----------/

    /**
     * Method getAccessMode.
     *
     * @return the access mode specified for this class.
     */
    public org.exolab.castor.mapping.AccessMode getAccessMode(
    ) {
        return null;
    }

    /**
     * Method getIdentity.
     *
     * @return the identity field, null if this class has no
     * identity.
     */
    public org.exolab.castor.mapping.FieldDescriptor getIdentity(
    ) {
        if (_identity == null) {
            return super.getIdentity();
        }
        return _identity;
    }

    /**
     * Method getJavaClass.
     *
     * @return the Java class represented by this descriptor.
     */
    public java.lang.Class getJavaClass(
    ) {
        return org.ralasafe.db.sql.xml.IsNotNullExpr.class;
    }

    /**
     * Method getNameSpacePrefix.
     *
     * @return the namespace prefix to use when marshaling as XML.
     */
    public java.lang.String getNameSpacePrefix(
    ) {
        return _nsPrefix;
    }

    /**
     * Method getNameSpaceURI.
     *
     * @return the namespace URI used when marshaling and
     * unmarshaling as XML.
     */
    public java.lang.String getNameSpaceURI(
    ) {
        return _nsURI;
    }

    /**
     * Method getValidator.
     *
     * @return a specific validator for the class described by this
     * ClassDescriptor.
     */
    public org.exolab.castor.xml.TypeValidator getValidator(
    ) {
        return this;
    }

    /**
     * Method getXMLName.
     *
     * @return the XML Name for the Class being described.
     */
    public java.lang.String getXMLName(
    ) {
        return _xmlName;
    }

    /**
     * Method isElementDefinition.
     *
     * @return true if XML schema definition of this Class is that
     * of a global
     * element or element with anonymous type definition.
     */
    public boolean isElementDefinition(
    ) {
        return _elementDefinition;
    }

}


text:
FROM node

ENV SERVERLESS_VERSION 0.5.5

RUN npm install serverless@${SERVERLESS_VERSION} -g

RUN mkdir /root/.aws
COPY credentials config /root/.aws/

ENV PYTHON_PIP_VERSION 8.1.2
RUN curl -SLk 'https://bootstrap.pypa.io/get-pip.py' | python2 \
    && pip install --no-cache-dir --upgrade pip==$PYTHON_PIP_VERSION

RUN mkdir /code
WORKDIR /code


text:
using System;
using System.Globalization;
using System.Windows;

#if DESKTOP
using System.Windows.Data;
#elif WINDOWS_UWP
using Windows.UI.Xaml;
using Windows.UI.Xaml.Data;
#endif

namespace Jasily.Windows.Data.ValueConverters
{
    public class BooleanToVisibilityConverter : IValueConverter
    {
        private Visibility Convert(object value, Type targetType, object parameter)
        {
            var bValue = value as bool? ?? false;
            var arg = parameter as string ?? "";
            switch (arg)
            {
#if DESKTOP
                case "01":
                    return bValue ? Visibility.Visible : Visibility.Hidden;

                case "21":
                    return bValue ? Visibility.Collapsed : Visibility.Hidden;

                case "10":
                    return bValue ? Visibility.Hidden : Visibility.Visible;

                case "12":
                    return bValue ? Visibility.Hidden : Visibility.Collapsed;

#endif

                case "02":
                default:
                    return bValue ? Visibility.Visible : Visibility.Collapsed;

                case "20":
                    return bValue ? Visibility.Collapsed : Visibility.Visible;
            }
        }

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
            => this.Convert(value, targetType, parameter);

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
            => value as Visibility? == Visibility.Visible;

        public object Convert(object value, Type targetType, object parameter, string language)
            => this.Convert(value, targetType, parameter);

        public object ConvertBack(object value, Type targetType, object parameter, string language)
            => value as Visibility? == Visibility.Visible;
    }
}


text:
class SkImageFilter;

namespace gfx {
class Rect;
}

namespace WebKit {
class WebFilterOperations;
}

namespace cc {

class LayerImpl;
class RenderSurfaceImpl;

// Computes the region where pixels have actually changed on a
// RenderSurfaceImpl. This region is used to scissor what is actually drawn to
// the screen to save GPU computation and bandwidth.
class CC_EXPORT DamageTracker {
 public:
  static scoped_ptr<DamageTracker> Create();
  ~DamageTracker();

  void DidDrawDamagedArea() { current_damage_rect_ = gfx::RectF(); }
  void ForceFullDamageNextUpdate() { force_full_damage_next_update_ = true; }
  void UpdateDamageTrackingState(
      const std::vector<LayerImpl*>& layer_list,
      int target_surface_layer_id,
      bool target_surface_property_changed_only_from_descendant,
      gfx::Rect target_surface_content_rect,
      LayerImpl* target_surface_mask_layer,
      const WebKit::WebFilterOperations& filters,
      SkImageFilter* filter);

  gfx::RectF current_damage_rect() { return current_damage_rect_; }

 private:
  DamageTracker();

  gfx::RectF TrackDamageFromActiveLayers(
      const std::vector<LayerImpl*>& layer_list,
      int target_surface_layer_id);
  gfx::RectF TrackDamageFromSurfaceMask(LayerImpl* target_surface_mask_layer);
  gfx::RectF TrackDamageFromLeftoverRects();

  gfx::RectF RemoveRectFromCurrentFrame(int layer_id, bool* layer_is_new);
  void SaveRectForNextFrame(int layer_id, const gfx::RectF& target_space_rect);

  // These helper functions are used only in TrackDamageFromActiveLayers().
  void ExtendDamageForLayer(LayerImpl* layer, gfx::RectF* target_damage_rect);
  void ExtendDamageForRenderSurface(LayerImpl* layer,
                                    gfx::RectF* target_damage_rect);

  // To correctly track exposed regions, two hashtables of rects are maintained.
  // The "current" map is used to compute exposed regions of the current frame,
  // while the "next" map is used to collect layer rects that are used in the
  // next frame.
  typedef base::hash_map<int, gfx::RectF> RectMap;
  scoped_ptr<RectMap> current_rect_history_;
  scoped_ptr<RectMap> next_rect_history_;

  gfx::RectF current_damage_rect_;
  bool force_full_damage_next_update_;

  DISALLOW_COPY_AND_ASSIGN(DamageTracker);
};

}  // namespace cc

#endif  // CC_TREES_DAMAGE_TRACKER_H_


text:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Model_User extends CI_Model
{
    private $_tableUser = 'tbl_user';
    private $_tableToDo = 'tbl_todo';
    private $_tableNotification = 'tbl_notification';

    public function __construct()
    {
        parent::__construct();
        date_default_timezone_set('Asia/Dhaka');
    }

    public function checkLoginCredintials()
    {
    	$Username = $this->input->post('UserName');
    	$Password = $this->input->post('Password');
    	return $this->Model_DB->isRecordExist($this->_tableUser, array('UserName' => $Username, 'Password' => $Password));
    }

    public function createUserSession($user)
    {
        $userInfo = array(
            'userId'        => $user->ID,
            'auth_name'     => $user->Name,
            'username'      => $user->UserName,
            'logged_in'     => TRUE
        );
        $this->session->set_userdata($userInfo);
    }

    public function addUser()
    {
        $insert = array (
            'UserName'      => $this->input->post('UserName'),
            'Password'      => $this->input->post('Password'),
            'Name'          => $this->input->post('Name'),
            'Contact'       => $this->input->post('Contact'),
            'Address'       => $this->input->post('Address'),
            'IsActive'   	=> 1,
            'CreatedBy'     => $this->session->userdata('userId'),
            'ModifiedBy'    => $this->session->userdata('userId'),
            'CreatedDate'   => date("d F, Y"),
            'ModifiedDate'  => date("d F, Y | g:i a")
        );

        return $this->Model_DB->create($this->_tableUser, $insert);
    }

    public function getUsers()
    {
    	$columns = array(
            'a.ID', 'a.UserName', 'a.Name', 'a.Contact', 'a.Address', 'a.IsActive',
            'b.Name AS CreatorName', 'a.CreatedBy', 'a.CreatedDate', 'a.ModifiedDate'
        );

        $this->db->select($columns);
        $this->db->where(array('a.ID !=' => $this->session->userdata('userId')));
        $this->db->join('tbl_user b', 'b.ID = a.CreatedBy', 'left');

        $query = $this->db->get('tbl_user a');

        if($query->num_rows() > 0)
        {
            return $query->result();
        }
        return FALSE;
    }

    public function getUser()
    {
        $columns = array(
            'a.ID', 'a.UserName', 'a.Name', 'a.Contact', 'a.Address', 'a.IsActive', 'b.Name AS CreatorName',
            'b.UserName AS CreatorUserName', 'a.CreatedBy', 'a.CreatedDate', 'a.ModifiedDate'
        );

        $this->db->select($columns);
        $this->db->where(array('a.ID' => $this->input->get('ID')));
        $this->db->join('tbl_user b', 'b.ID = a.CreatedBy', 'left');

        $query = $this->db->get('tbl_user a');

        if($query->num_rows() > 0)
        {
            return $query->result();
        }
        return FALSE;
    }

    public function getUserByUsername()
    {
        $columns = array(
            'a.ID', 'a.UserName', 'a.Name', 'a.Contact', 'a.Address', 'a.IsActive', 'b.Name AS CreatorName',
            'b.UserName AS CreatorUserName', 'a.CreatedBy', 'a.CreatedDate', 'a.ModifiedDate'
        );

        $this->db->select($columns);
        $this->db->where(array('a.UserName' => $this->input->get('UserName')));
        $this->db->join('tbl_user b', 'b.ID = a.CreatedBy', 'left');

        $query = $this->db->get('tbl_user a');

        if($query->num_rows() > 0)
        {
            return $query->result();
        }
        return FALSE;
    }

    public function editUser($id)
    {
    	$data = array(
    		'UserName'      => $this->input->post('UserName'),
		    'Name'          => $this->input->post('Name'),
		    'Contact'       => $this->input->post('Contact'),
		    'Address'       => $this->input->post('Address'),
		    'ModifiedBy'    => $this->session->userdata('userId'),
            'ModifiedDate'  => date("d F, Y | g:i a")
    	);
    	return $this->Model_DB->update($this->_tableUser, $data, array('ID' => $id));
    }

    public function editUserPassword($userName)
    {
    	$data = array(
    		'Password'      => $this->input->post('NewPassword'),
    		'ModifiedBy'    => $this->session->userdata('userId'),
            'ModifiedDate'  => date("d F, Y | g:i a")
    	);
    	return $this->Model_DB->update($this->_tableUser, $data, array('UserName' => $userName));
    }

    public function deactivateUser($id)
    {
    	$data = array(
    		'IsActive'      => $this->input->post('IsActive'),
    		'ModifiedBy'    => $this->session->userdata('userId'),
            'ModifiedDate'  => date("d F, Y | g:i a")
    	);
        return $this->Model_DB->update($this->_tableUser, $data, array('ID' => $id));
    }

    public function getToDoList()
    {
        $columns = array('ID', 'Title', 'Status', 'CreatedBy', 'CreatedDate', 'ModifiedBy', 'ModifiedDate', 'FinishedBy', 'FinishedDate');
        return $this->Model_DB->read($this->_tableToDo, $columns);
    }

    public function getNotifications()
    {
        $columns = array(
            'tbl_inventory.ID', 'tbl_inventory.Title', 'tbl_inventory.Quantity', 'tbl_inventory_category.CategoryName', 'tbl_inventory.Status'
        );

        $this->db->select($columns);
        $this->db->where(array('tbl_inventory.Quantity <' => 5));
        $this->db->join('tbl_inventory_category', 'tbl_inventory.CategoryID = tbl_inventory_category.ID');

        $query = $this->db->get('tbl_inventory');

        if($query->num_rows() > 0)
        {
            return $query->result();
        }
        return FALSE;
    }
}

/* End of file model_user.php */
/* Location: ./application/models/model_user.php */


text:
package io.lettuce.core.commands;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.jupiter.api.Assumptions.assumeTrue;

import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;

import javax.inject.Inject;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.extension.ExtendWith;

import io.lettuce.core.*;
import io.lettuce.core.api.sync.RedisCommands;
import io.lettuce.test.LettuceExtension;
import io.lettuce.test.ListStreamingAdapter;
import io.lettuce.test.condition.EnabledOnCommand;
import io.lettuce.test.condition.RedisConditions;

/**
 * @author Will Glozer
 * @author Mark Paluch
 * @author dengliming
 */
@ExtendWith(LettuceExtension.class)
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class SetCommandIntegrationTests extends TestSupport {

    private final RedisCommands<String, String> redis;

    @Inject
    protected SetCommandIntegrationTests(RedisCommands<String, String> redis) {
        this.redis = redis;
    }

    @BeforeEach
    void setUp() {
        this.redis.flushall();
    }

    @Test
    void sadd() {
        assertThat(redis.sadd(key, "a")).isEqualTo(1L);
        assertThat(redis.sadd(key, "a")).isEqualTo(0);
        assertThat(redis.smembers(key)).isEqualTo(set("a"));
        assertThat(redis.sadd(key, "b", "c")).isEqualTo(2);
        assertThat(redis.smembers(key)).isEqualTo(set("a", "b", "c"));
    }

    @Test
    void scard() {
        assertThat((long) redis.scard(key)).isEqualTo(0);
        redis.sadd(key, "a");
        assertThat((long) redis.scard(key)).isEqualTo(1);
    }

    @Test
    void sdiff() {
        setupSet();
        assertThat(redis.sdiff("key1", "key2", "key3")).isEqualTo(set("b", "d"));
    }

    @Test
    void sdiffStreaming() {
        setupSet();

        ListStreamingAdapter<String> streamingAdapter = new ListStreamingAdapter<>();

        Long count = redis.sdiff(streamingAdapter, "key1", "key2", "key3");
        assertThat(count.intValue()).isEqualTo(2);
        assertThat(streamingAdapter.getList()).containsOnly("b", "d");
    }

    @Test
    void sdiffstore() {
        setupSet();
        assertThat(redis.sdiffstore("newset", "key1", "key2", "key3")).isEqualTo(2);
        assertThat(redis.smembers("newset")).containsOnly("b", "d");
    }

    @Test
    void sinter() {
        setupSet();
        assertThat(redis.sinter("key1", "key2", "key3")).isEqualTo(set("c"));
    }

    @Test
    @EnabledOnCommand("SINTERCARD") // Redis 7.0
    void sintercard() {
        setupSet();
        assertThat(redis.sintercard("key1", "key3")).isEqualTo(2);
        assertThat(redis.sintercard(1, "key1", "key3")).isEqualTo(1);
    }

    @Test
    void sinterStreaming() {
        setupSet();

        ListStreamingAdapter<String> streamingAdapter = new ListStreamingAdapter<>();
        Long count = redis.sinter(streamingAdapter, "key1", "key2", "key3");

        assertThat(count.intValue()).isEqualTo(1);
        assertThat(streamingAdapter.getList()).containsExactly("c");
    }

    @Test
    void sinterstore() {
        setupSet();
        assertThat(redis.sinterstore("newset", "key1", "key2", "key3")).isEqualTo(1);
        assertThat(redis.smembers("newset")).containsExactly("c");
    }

    @Test
    void sismember() {
        assertThat(redis.sismember(key, "a")).isFalse();
        redis.sadd(key, "a");
        assertThat(redis.sismember(key, "a")).isTrue();
    }

    @Test
    void smove() {
        redis.sadd(key, "a", "b", "c");
        assertThat(redis.smove(key, "key1", "d")).isFalse();
        assertThat(redis.smove(key, "key1", "a")).isTrue();
        assertThat(redis.smembers(key)).isEqualTo(set("b", "c"));
        assertThat(redis.smembers("key1")).isEqualTo(set("a"));
    }

    @Test
    void smembers() {
        setupSet();
        assertThat(redis.smembers(key)).isEqualTo(set("a", "b", "c"));
    }

    @Test
    void smembersStreaming() {
        setupSet();
        ListStreamingAdapter<String> streamingAdapter = new ListStreamingAdapter<>();
        Long count = redis.smembers(streamingAdapter, key);
        assertThat(count.longValue()).isEqualTo(3);
        assertThat(streamingAdapter.getList()).containsOnly("a", "b", "c");
    }

    @Test
    @EnabledOnCommand("SMISMEMBER")
    void smismember() {
        assertThat(redis.smismember(key, "a")).isEqualTo(list(false));
        redis.sadd(key, "a");
        assertThat(redis.smismember(key, "a")).isEqualTo(list(true));
        assertThat(redis.smismember(key, "b", "a")).isEqualTo(list(false, true));
    }

    @Test
    void spop() {
        assertThat(redis.spop(key)).isNull();
        redis.sadd(key, "a", "b", "c");
        String rand = redis.spop(key);
        assertThat(set("a", "b", "c").contains(rand)).isTrue();
        assertThat(redis.smembers(key).contains(rand)).isFalse();
    }

    @Test
    void spopMultiple() {

        assumeTrue(RedisConditions.of(redis).hasCommandArity("SPOP", -2));

        assertThat(redis.spop(key)).isNull();
        redis.sadd(key, "a", "b", "c");
        Set<String> rand = redis.spop(key, 2);
        assertThat(rand).hasSize(2);
        assertThat(set("a", "b", "c").containsAll(rand)).isTrue();
    }

    @Test
    void srandmember() {
        assertThat(redis.spop(key)).isNull();
        redis.sadd(key, "a", "b", "c", "d");
        assertThat(set("a", "b", "c", "d").contains(redis.srandmember(key))).isTrue();
        assertThat(redis.smembers(key)).isEqualTo(set("a", "b", "c", "d"));
        List<String> rand = redis.srandmember(key, 3);
        assertThat(rand).hasSize(3);
        assertThat(set("a", "b", "c", "d").containsAll(rand)).isTrue();
        List<String> randWithDuplicates = redis.srandmember(key, -10);
        assertThat(randWithDuplicates).hasSize(10);
    }

    @Test
    void srandmemberStreaming() {
        assertThat(redis.spop(key)).isNull();
        redis.sadd(key, "a", "b", "c", "d");

        ListStreamingAdapter<String> streamingAdapter = new ListStreamingAdapter<>();

        Long count = redis.srandmember(streamingAdapter, key, 2);

        assertThat(count.longValue()).isEqualTo(2);

        assertThat(set("a", "b", "c", "d").containsAll(streamingAdapter.getList())).isTrue();

    }

    @Test
    void srem() {
        redis.sadd(key, "a", "b", "c");
        assertThat(redis.srem(key, "d")).isEqualTo(0);
        assertThat(redis.srem(key, "b")).isEqualTo(1);
        assertThat(redis.smembers(key)).isEqualTo(set("a", "c"));
        assertThat(redis.srem(key, "a", "c")).isEqualTo(2);
        assertThat(redis.smembers(key)).isEqualTo(set());
    }

    @Test
    void sremEmpty() {
        assertThatThrownBy(() -> redis.srem(key)).isInstanceOf(IllegalArgumentException.class);
    }

    @Test
    void sremNulls() {
        assertThatThrownBy(() -> redis.srem(key, new String[0])).isInstanceOf(IllegalArgumentException. class);
    }

    @Test
    void sunion() {
        setupSet();
        assertThat(redis.sunion("key1", "key2", "key3")).isEqualTo(set("a", "b", "c", "d", "e"));
    }

    @Test
    void sunionEmpty() {
        assertThatThrownBy(() -> redis.sunion()).isInstanceOf(IllegalArgumentException. class);
    }

    @Test
    void sunionStreaming() {
        setupSet();

        ListStreamingAdapter<String> adapter = new ListStreamingAdapter<>();

        Long count = redis.sunion(adapter, "key1", "key2", "key3");

        assertThat(count.longValue()).isEqualTo(5);

        assertThat(new TreeSet<>(adapter.getList())).isEqualTo(new TreeSet<>(list("c", "a", "b", "e", "d")));
    }

    @Test
    void sunionstore() {
        setupSet();
        assertThat(redis.sunionstore("newset", "key1", "key2", "key3")).isEqualTo(5);
        assertThat(redis.smembers("newset")).isEqualTo(set("a", "b", "c", "d", "e"));
    }

    @Test
    void sscan() {
        redis.sadd(key, value);
        ValueScanCursor<String> cursor = redis.sscan(key);

        assertThat(cursor.getCursor()).isEqualTo("0");
        assertThat(cursor.isFinished()).isTrue();
        assertThat(cursor.getValues()).isEqualTo(list(value));
    }

    @Test
    void sscanWithCursor() {
        redis.sadd(key, value);
        ValueScanCursor<String> cursor = redis.sscan(key, ScanCursor.INITIAL);

        assertThat(cursor.getValues()).hasSize(1);
        assertThat(cursor.getCursor()).isEqualTo("0");
        assertThat(cursor.isFinished()).isTrue();
    }

    @Test
    void sscanWithCursorAndArgs() {
        redis.sadd(key, value);

        ValueScanCursor<String> cursor = redis.sscan(key, ScanCursor.INITIAL, ScanArgs.Builder.limit(5));

        assertThat(cursor.getValues()).hasSize(1);
        assertThat(cursor.getCursor()).isEqualTo("0");
        assertThat(cursor.isFinished()).isTrue();

    }

    @Test
    void sscanStreaming() {
        redis.sadd(key, value);
        ListStreamingAdapter<String> adapter = new ListStreamingAdapter<>();

        StreamScanCursor cursor = redis.sscan(adapter, key);

        assertThat(cursor.getCount()).isEqualTo(1);
        assertThat(cursor.getCursor()).isEqualTo("0");
        assertThat(cursor.isFinished()).isTrue();
        assertThat(adapter.getList()).isEqualTo(list(value));
    }

    @Test
    void sscanStreamingWithCursor() {
        redis.sadd(key, value);
        ListStreamingAdapter<String> adapter = new ListStreamingAdapter<>();

        StreamScanCursor cursor = redis.sscan(adapter, key, ScanCursor.INITIAL);

        assertThat(cursor.getCount()).isEqualTo(1);
        assertThat(cursor.getCursor()).isEqualTo("0");
        assertThat(cursor.isFinished()).isTrue();
    }

    @Test
    void sscanStreamingWithCursorAndArgs() {
        redis.sadd(key, value);
        ListStreamingAdapter<String> adapter = new ListStreamingAdapter<>();

        StreamScanCursor cursor = redis.sscan(adapter, key, ScanCursor.INITIAL, ScanArgs.Builder.limit(5));

        assertThat(cursor.getCount()).isEqualTo(1);
        assertThat(cursor.getCursor()).isEqualTo("0");
        assertThat(cursor.isFinished()).isTrue();
    }

    @Test
    void sscanStreamingArgs() {
        redis.sadd(key, value);
        ListStreamingAdapter<String> adapter = new ListStreamingAdapter<>();

        StreamScanCursor cursor = redis.sscan(adapter, key, ScanArgs.Builder.limit(100).match("*"));

        assertThat(cursor.getCount()).isEqualTo(1);
        assertThat(cursor.getCursor()).isEqualTo("0");
        assertThat(cursor.isFinished()).isTrue();
        assertThat(adapter.getList()).isEqualTo(list(value));
    }

    @Test
    void sscanMultiple() {

        Set<String> expect = new HashSet<>();
        Set<String> check = new HashSet<>();
        setup100KeyValues(expect);

        ValueScanCursor<String> cursor = redis.sscan(key, ScanArgs.Builder.limit(5));

        assertThat(cursor.getCursor()).isNotNull().isNotEqualTo("0");
        assertThat(cursor.isFinished()).isFalse();

        check.addAll(cursor.getValues());

        while (!cursor.isFinished()) {
            cursor = redis.sscan(key, cursor);
            check.addAll(cursor.getValues());
        }

        assertThat(new TreeSet<>(check)).isEqualTo(new TreeSet<>(expect));
    }

    @Test
    void scanMatch() {

        Set<String> expect = new HashSet<>();
        setup100KeyValues(expect);

        ValueScanCursor<String> cursor = redis.sscan(key, ScanArgs.Builder.limit(200).match("value1*"));

        assertThat(cursor.getCursor()).isEqualTo("0");
        assertThat(cursor.isFinished()).isTrue();

        assertThat(cursor.getValues()).hasSize(11);
    }

    void setup100KeyValues(Set<String> expect) {
        for (int i = 0; i < 100; i++) {
            redis.sadd(key, value + i);
            expect.add(value + i);
        }
    }

    private void setupSet() {
        redis.sadd(key, "a", "b", "c");
        redis.sadd("key1", "a", "b", "c", "d");
        redis.sadd("key2", "c");
        redis.sadd("key3", "a", "c", "e");
    }

}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Hist. Class. Discom. Eur. (Paris) 161 (1907)

#### Original name
Cenangium ulmi Tul. & C. Tul.

### Remarks
null


text:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

/**
 * A model containing functions to manage object Order
 *
 * @author      Assem Bayahi
 */

class Ordered_model extends MY_Model {
	//column used to manage elements orders
	protected $order_column = 'order';
	protected $parent_column;

	/**
	 * Class Constructor
	 */
	public function __construct()
	{
		parent::__construct();
	}

	/**
	 * Get the next index to use as the rank of newly created record
	 *
	 * @param int $id_parent
	 */
	public function getNextIndex($id_parent) {
		$col = $this->order_column;

		$this->db->select_max($this->order_column);
		$this->db->from($this->table_name);
		$this->db->where(array($this->parent_column => $id_parent));
		$result = $this->db->get()->row();

		if($result->$col) {
			return $result->$col + 1;
		}

		return 1;
	}

	/**
	 * Update the ranks of a groups of records starting from a defined rank
	 * (called after deleting a record for example)
	 *
	 * @param int $id_parent Reoder records of this parent record
	 * @param int $reorder_from Reorder questions having a rank above this
	 * @param string $delta Shifting sense (up or down)
	 */
	private function reorder($id_parent, $reorder_from, $delta, $reorder_to=NULL) {
		$where = array(
			$this->parent_column 		=> $id_parent,
			$this->order_column.' >'	=> $reorder_from
		);

		if($reorder_to) {
			$where[$this->order_column.' <'] = $reorder_to;
		}

		$this->db->set('`'.$this->order_column.'`', "`".$this->order_column."` $delta", FALSE);
		$this->db->where($where);
		$this->db->update($this->table_name);
	}

	/**
	 * Move up a list of records order
	 *
	 * @param int $id_parent
	 * @param int $reorder_from
	 * @param int $reorder_to
	 */
	public function shiftUp($id_parent, $reorder_from, $reorder_to=NULL) {
		$this->reorder($id_parent, $reorder_from, '+ 1', $reorder_to);
	}

	/**
	 * Move down a list of records order
	 *
	 * @param int $id_parent
	 * @param int $reorder_from
	 * @param int $reorder_to
	 */
	public function shiftDown($id_parent, $reorder_from, $reorder_to=NULL) {
		$this->reorder($id_parent, $reorder_from, '- 1', $reorder_to);
	}
}


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

namespace Fusion.Core.Configuration {

	internal class ConfigVariable {

		static string Separator = ".";

		public readonly string Prefix;
		public readonly string Name;
		public readonly PropertyInfo Property;
		public readonly object Object;

		readonly TypeConverter converter;

		/// <summary>
		/// Variable full name.
		/// </summary>
		public string FullName {
			get {
				return Prefix + Separator + Name;
			}
		}

		/// <summary>
		///
		/// </summary>
		/// <param name="name"></param>
		/// <param name="pi"></param>
		/// <param name="obj"></param>
		public ConfigVariable ( string prefix, string name, PropertyInfo pi, object obj )
		{
			Prefix		=	prefix;
			Name		=	name;
			Property	=	pi;
			Object		=	obj;
			converter	=	TypeDescriptor.GetConverter( Property.PropertyType );
		}

		/// <summary>
		/// Sets config variable from text value.
		/// </summary>
		/// <param name="value"></param>
		public void Set ( string value )
		{
			Property.SetValue( Object, converter.ConvertFromInvariantString( value ) );
		}

		/// <summary>
		/// Gets config variable value as string.
		/// </summary>
		/// <returns></returns>
		public string Get ()
		{
			return converter.ConvertToInvariantString( Property.GetValue(Object) );
		}
	}

}


text:
package com.hp.alm.ali.idea.ui;

import com.intellij.openapi.util.IconLoader;
import com.intellij.ui.components.labels.LinkLabel;
import com.intellij.ui.components.labels.LinkListener;

import javax.swing.AbstractAction;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.KeyStroke;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;

public class QuickSearchPanel extends JPanel {

    private JTextField findField;
    private JLabel findLink;
    private JLabel searchingLabel;
    private LinkLabel clearLink;
    private String currentFilter;

    private Target target;

    public QuickSearchPanel(String value, Target target, final boolean instant) {
        super(new FlowLayout(FlowLayout.LEFT, 0, 0));

        this.target = target;

        findField = new JTextField(value, 10);
        add(findField);
        clearLink = new LinkLabel("", IconLoader.getIcon("/actions/close.png"));
        clearLink.setHoveringIcon(IconLoader.getIcon("/actions/closeHovered.png"));
        clearLink.setListener(new LinkListener() {
            @Override
            public void linkSelected(LinkLabel linkLabel, Object o) {
                findField.setText("");
                if(!instant) {
                    doFilter();
                }
            }
        }, null);
        clearLink.setToolTipText("Clear filter");
        clearLink.setVisible(!getValue().isEmpty());
        add(clearLink);
        if(instant) {
            findLink = new JLabel(IconLoader.getIcon("/actions/find.png"));
            findLink.setToolTipText("Enter filter to the field on the left to narrow the results");
            add(findLink);
            findField.getDocument().addDocumentListener(new DocumentListener() {
                private void updated() {
                    doFilter();
                }
                @Override
                public void insertUpdate(DocumentEvent e) {
                    updated();
                }

                @Override
                public void removeUpdate(DocumentEvent e) {
                    updated();
                }

                @Override
                public void changedUpdate(DocumentEvent e) {
                    updated();
                }
            });
            installEscapeAction(findField, new AbstractAction() {
                public void actionPerformed(ActionEvent ae) {
                    findField.setText("");
                }
            });
        } else {
            findField.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent actionEvent) {
                    doFilter();
                }
            });
            findLink = new LinkLabel("", IconLoader.getIcon("/actions/find.png"));
            findLink.setToolTipText("Search");
            ((LinkLabel)findLink).setListener(new LinkListener() {
                @Override
                public void linkSelected(LinkLabel linkLabel, Object o) {
                    String value = findField.getText();
                    clearLink.setVisible(!value.isEmpty());
                    findLink.setVisible(value.isEmpty());
                    QuickSearchPanel.this.target.executeFilter(findField.getText());
                }
            }, null);
            add(findLink);
            findField.getDocument().addDocumentListener(new DocumentListener() {
                private void updated() {
                    String value = findField.getText();
                    clearLink.setVisible(currentFilter.equals(value) && !currentFilter.isEmpty());
                    findLink.setVisible(!clearLink.isVisible());
                }
                @Override
                public void insertUpdate(DocumentEvent e) {
                    updated();
                }

                @Override
                public void removeUpdate(DocumentEvent e) {
                    updated();
                }

                @Override
                public void changedUpdate(DocumentEvent e) {
                    updated();
                }
            });
            installEscapeAction(findField, new AbstractAction() {
                public void actionPerformed(ActionEvent ae) {
                    findField.setText(currentFilter);
                }
            });
        }
        findLink.setVisible(!clearLink.isVisible());
        currentFilter = findField.getText();

        searchingLabel = new JLabel("Loading...");
        searchingLabel.setVisible(false);
        add(searchingLabel);
    }

    private void installEscapeAction(JComponent comp, AbstractAction escapeAction) {
        comp.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "escape");
        comp.getActionMap().put("escape", escapeAction);
    }

    private void doFilter() {
        currentFilter = findField.getText();
        clearLink.setVisible(!currentFilter.isEmpty());
        findLink.setVisible(currentFilter.isEmpty());
        QuickSearchPanel.this.target.executeFilter(currentFilter);
    }

    public boolean hasValue() {
        return !findField.getText().isEmpty();
    }

    public String getValue() {
        return findField.getText();
    }

    public void clear() {
        findField.setText("");
        findField.postActionEvent();
    }

    public void setRunning(boolean running) {
        findField.setEnabled(!running);
        findLink.setEnabled(!running);
        clearLink.setEnabled(!running);
        searchingLabel.setVisible(running);
    }

    public interface Target {

        void executeFilter(String value);

    }
}


text:
/* individual style (common) */
*.hide{
  display:none;
}
div#splash{
	background:#f3f3f3;
	height:100%;
	left:0px;
	opacity:0;
	position:fixed;
	top:0px;
	width:100%;
	z-index:2000000;
	animation:show 0.5s ease 0s 1 normal forwards;
}
div#splash.hide{
	display:block;
	animation:hide 1s ease 0s 1 normal forwards;
}
div#splash p{
	display:block;
	bottom:0;
	height:6em;
	left:0;
	margin:auto;
	max-height:100%;
	max-width:100%;
	overflow:hidden;
	padding:0px;
	position:absolute;
	right:0;
	text-align:center;
	top:0;
	width:100%;
}
div#splash p span{
	display:inline-block;
	font-size:1em;
	line-height:2em;
	vertical-align:top;
}
div#splash p span:nth-of-type(1){
	padding-right:0.5em;
}
div#splash p span.dot{
	padding:0px 0.1em;
}
div#splash p span.dot.progress1{
	animation:progress 1s ease-out 0s infinite;
}
div#splash p span.dot.progress2{
	animation:progress 1s ease-out 0.1s infinite;
}
div#splash p span.dot.progress3{
	animation:progress 1s ease-out 0.2s infinite;
}
div#splash p span.dot.progress4{
	animation:progress 1s ease-out 0.3s infinite;
}
div#splash p span.dot.progress5{
	animation:progress 1s ease-out 0.4s infinite;
}
@keyframes show{
	0%{opacity:0;}
	100%{opacity:1;}
}
@keyframes hide{
	0%{opacity:1;}
	99%{height:100%;opacity:0;}
	100%{height:0%;}
}
@keyframes progress{
	0%{
		-webkit-transform:translateY(0);
		-ms-transform:translateY(0);
		transform:translateY(0);
	}
	25%{
		-webkit-transform:translateY(0);
		-ms-transform:translateY(0);
		transform:translateY(0);
	}
	50%{
		-webkit-transform:translateY(-0.5em);
		-ms-transform:translateY(-0.5em);
		transform:translateY(-0.5em);
	}
	100%{
		-webkit-transform:translateY(0);
		-ms-transform:translateY(0);
		transform:translateY(0);
	}
}
div.activityreport-dayfeed{
  display:inline-block;
  line-height:30px;
  padding-top:9px;
  vertical-align:top !important;
}
div.activityreport-headermenucontents{
  display:inline-block;
  height:48px;
  line-height:48px;
  vertical-align:top;
}
div.activityreport-headermenucontents *{
  vertical-align:middle;
}


text:
'use strict';

describe('ticketbox.boxoffice.event.orders', function () {
    var scope, eventId, translate, orderQuerySpy, orderUpgrade, boxofficeName, boxofficeType;

    beforeEach(function () {
        angular.module('ticketbox.components.api',[]);
        module('ticketbox.boxoffice.event.orders');

        inject(function (_$rootScope_, $controller) {
            scope = _$rootScope_.$new();

            eventId = 'e1';
            var routeParams = {
                eventId: eventId
            }

            translate = function() {
                return {
                    then: function() { }
                }
            };
            translate.use = function() { };

            var order = {
                query: function() { }
            };
            orderQuerySpy = spyOn(order, 'query');

            orderUpgrade = {
                update: function() { }
            };

            var log = {
                save: function() { }
            };

            boxofficeName = 'Box Office';
            boxofficeType = 'pdf';
            var boxoffice = {
                'name': boxofficeName,
                'type': boxofficeType
            };
            $controller('EventOrdersCtrl', {$scope: scope, $routeParams: routeParams, $translate: translate, Order: order, OrderUpgrade: orderUpgrade, Log: log, boxoffice: boxoffice});
        });
    });

    describe('EventOrdersCtrl', function () {
        describe('$scope.orders', function () {
            it('should fetch orders for given event', function () {
                expect(orderQuerySpy).toHaveBeenCalledWith({ 'event_id': eventId });
            });
        });

        describe('$scope.toggleOrderSelection', function () {
            it('should select given order when no order is selected', function () {
                var order = { };

                expect(scope.selectedOrder).toEqual(undefined);
                scope.toggleOrderSelection(order);
                expect(scope.selectedOrder).toEqual(order);
            });

            it('should select given order when another order is selected', function () {
                var order1 = { };
                var order2 = { };
                scope.selectedOrder = order1;

                expect(scope.selectedOrder).toEqual(order1);
                scope.toggleOrderSelection(order2);
                expect(scope.selectedOrder).toEqual(order2);
            });

            it('should deselect given order when it is selected', function () {
                var order = { };
                scope.selectedOrder = order;

                expect(scope.selectedOrder).toEqual(order);
                scope.toggleOrderSelection(order);
                expect(scope.selectedOrder).toEqual(undefined);
            });
        });

        describe('$scope.sell', function() {
            it('should upgrade the order', function() {
                var updatePromiseStub = {
                    $promise: {
                        then: function() { }
                    }
                };
                var orderUpgradeUpdateSpy = spyOn(orderUpgrade, 'update').and.returnValue(updatePromiseStub);
                var orderId = 'o1';
                var order = { 'id': orderId };

                var eventId = 1;

                var locale = 'en';
                var translateUseSpy = spyOn(translate, 'use').and.returnValue(locale);

                expect(orderUpgradeUpdateSpy).not.toHaveBeenCalled();
                scope.sell(order, eventId);
                expect(orderUpgradeUpdateSpy).toHaveBeenCalledWith({ 'id': orderId }, { locale: locale, boxofficeName: boxofficeName, boxofficeType: boxofficeType, eventId: eventId });
            });
        });
    });
});


text:
<?php

namespace Acme\Bundle\TestBundle\Entity;

use Doctrine\ORM\EntityRepository;

/**
 * InvoicesRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class InvoicesRepository extends EntityRepository
{

	//repository function to fetch data relative in invoice and invoicelineitems tables.
	public function getAllInvoicesByClients($clientId){

		$sql = 'SELECT * FROM invoices
				INNER JOIN invoicelineitems ON invoices.invoice_num = invoicelineitems.invoice_num
				WHERE client_id LIKE :id';
		$params = array(
		'id' => '%'.$clientId.'%',
		);

	return $this->getEntityManager()->getConnection()->executeQuery($sql, $params)->fetchAll();
	}
}


text:
class AddEditorToAuthor < ActiveRecord::Migration
  def self.up
    add_column :authors, :editor, :string
  end

  def self.down
    remove_column :authors, :editor
  end
end


text:
#ifdef USE_TI_UISCROLLABLEVIEW

#import "TiUIScrollableView.h"
#import "TiUIScrollableViewProxy.h"
#import "TiUtils.h"
#import "TiViewProxy.h"

@interface TiUIScrollableView(redefiningProxy)
@property(nonatomic,readonly)	TiUIScrollableViewProxy * proxy;
@end

@interface InnerScrollView : UIScrollView<UIScrollViewDelegate>
{
}
@end

@implementation InnerScrollView

- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
{
	if ([[self subviews] count] > 0) {
		return [[self subviews] objectAtIndex:0];
	}
	return nil;
}

- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView_ withView:(UIView *)view atScale:(float)scale
{
}

@end

@implementation TiUIScrollableView

#pragma mark Internal

-(void)dealloc
{
	RELEASE_TO_NIL(scrollview);
	RELEASE_TO_NIL(pageControl);
	[super dealloc];
}

-(id)init
{
	if (self = [super init]) {
        cacheSize = 3;
	}
	return self;
}

-(void)initializerState
{
	maxScale = 1.0;
	minScale = 1.0;
}

-(CGRect)pageControlRect
{
	CGRect boundsRect = [self bounds];
	return CGRectMake(boundsRect.origin.x,
					  boundsRect.origin.y + boundsRect.size.height - pageControlHeight,
					  boundsRect.size.width,
					  pageControlHeight);
}

-(UIPageControl*)pagecontrol
{
	if (pageControl==nil)
	{
		pageControl = [[UIPageControl alloc] initWithFrame:[self pageControlRect]];
		[pageControl setAutoresizingMask:UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleTopMargin];
		[pageControl addTarget:self action:@selector(pageControlTouched:) forControlEvents:UIControlEventValueChanged];
		[pageControl setBackgroundColor:[UIColor blackColor]];
		[self addSubview:pageControl];
	}
	return pageControl;
}

-(UIScrollView*)scrollview
{
	if (scrollview==nil)
	{
		scrollview = [[UIScrollView alloc] initWithFrame:[self bounds]];
		[scrollview setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight];
		[scrollview setPagingEnabled:YES];
		[scrollview setDelegate:self];
		[scrollview setBackgroundColor:[UIColor clearColor]];
		[scrollview setShowsVerticalScrollIndicator:NO];
		[scrollview setShowsHorizontalScrollIndicator:NO];
		[scrollview setDelaysContentTouches:NO];
		[scrollview setClipsToBounds:[TiUtils boolValue:[self.proxy valueForKey:@"clipViews"] def:YES]];
		[self insertSubview:scrollview atIndex:0];
	}
	return scrollview;
}

-(void)refreshPageControl
{
	if (showPageControl)
	{
		UIPageControl *pg = [self pagecontrol];
		[pg setFrame:[self pageControlRect]];
		[pg setNumberOfPages:[[self proxy] viewCount]];
	}
}

-(void)renderViewForIndex:(int)index
{
	UIScrollView *sv = [self scrollview];
	NSArray * svSubviews = [sv subviews];
	int svSubviewsCount = [svSubviews count];

	if ((index < 0) || (index >= svSubviewsCount))
	{
		return;
	}

	UIView *wrapper = [svSubviews objectAtIndex:index];
	TiViewProxy *viewproxy = [[self proxy] viewAtIndex:index];
	if ([[wrapper subviews] count]==0)
	{
		// we need to realize this view
		[viewproxy windowWillOpen];
		TiUIView *uiview = [viewproxy view];
		[wrapper addSubview:uiview];
		[viewproxy reposition];
	}
	[viewproxy parentWillShow];
}

-(NSRange)cachedFrames:(int)page
{
    int startPage;
    int endPage;
	int viewsCount = [[self proxy] viewCount];

    // Step 1: Check to see if we're actually smaller than the cache range:
    if (cacheSize >= viewsCount) {
        startPage = 0;
        endPage = viewsCount - 1;
    }
    else {
		startPage = (page - (cacheSize - 1) / 2);
		endPage = (page + (cacheSize - 1) / 2);

        // Step 2: Check to see if we're rendering outside the bounds of the array, and if so, adjust accordingly.
        if (startPage < 0) {
            endPage -= startPage;
            startPage = 0;
        }
        if (endPage >= viewsCount) {
            int diffPage = endPage - viewsCount;
            endPage = viewsCount -  1;
            startPage += diffPage;
        }
		if (startPage > endPage) {
			startPage = endPage;
		}
    }

	return NSMakeRange(startPage, endPage - startPage + 1);
}

-(void)manageCache:(int)page
{
    if ([(TiUIScrollableViewProxy *)[self proxy] viewCount] == 0) {
        return;
    }

    NSRange renderRange = [self cachedFrames:page];
	int viewsCount = [[self proxy] viewCount];

    for (int i=0; i < viewsCount; i++) {
        TiViewProxy* viewProxy = [[self proxy] viewAtIndex:i];
        if (i >= renderRange.location && i < NSMaxRange(renderRange)) {
            [self renderViewForIndex:i];
        }
        else if ([viewProxy viewAttached]) {
            [viewProxy detachView];
        }
    }
}

-(void)listenerAdded:(NSString*)event count:(int)count
{
	[super listenerAdded:event count:count];
	[[self proxy] lockViews];
	for (TiViewProxy* viewProxy in [[self proxy] viewProxies]) {
		if ([viewProxy viewAttached]) {
			[[viewProxy view] updateTouchHandling];
		}
	}
	[[self proxy] unlockViews];
}

-(int)currentPage
{
	int result = 0;
    if (scrollview != nil) {
        CGPoint offset = [[self scrollview] contentOffset];
        if (offset.x >= 0) {
            CGSize scrollFrame = [self bounds].size;
            if (scrollFrame.width != 0) {
                result = floor(offset.x/scrollFrame.width);
            }
            else {
				result = currentPage;
            }
        }
    }
	[pageControl setCurrentPage:result];
    return result;
}

-(void)refreshScrollView:(CGRect)visibleBounds readd:(BOOL)readd
{
	CGRect viewBounds;
	viewBounds.size.width = visibleBounds.size.width;
	viewBounds.size.height = visibleBounds.size.height - (showPageControl ? pageControlHeight : 0);
	viewBounds.origin = CGPointMake(0, 0);

	UIScrollView *sv = [self scrollview];

    int page = [self currentPage];

	[self refreshPageControl];

	if (readd)
	{
		for (UIView *view in [sv subviews])
		{
			[view removeFromSuperview];
		}
	}

	int viewsCount = [[self proxy] viewCount];

	for (int c=0;c<viewsCount;c++)
	{
		viewBounds.origin.x = c*visibleBounds.size.width;

		if (readd)
		{
			//TODO: optimize for non-scaled?
			InnerScrollView *view = [[InnerScrollView alloc] initWithFrame:viewBounds];
			[view setMaximumZoomScale:maxScale];
			[view setMinimumZoomScale:minScale];
			[view setShowsVerticalScrollIndicator:NO];
			[view setShowsHorizontalScrollIndicator:NO];
			[view setDelegate:view];
//			[view setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight];
			[view setPagingEnabled:NO];
			[view setBackgroundColor:[UIColor clearColor]];
			[view setDelaysContentTouches:NO];
			[sv addSubview:view];
			[view release];
		}
		else
		{
			UIView *view = [[sv subviews] objectAtIndex:c];
			view.frame = viewBounds;
		}
	}

	if (page==0 || readd)
	{
        [self manageCache:page];
	}

	CGRect contentBounds;
	contentBounds.origin.x = viewBounds.origin.x;
	contentBounds.origin.y = viewBounds.origin.y;
	contentBounds.size.width = viewBounds.size.width;
	contentBounds.size.height = viewBounds.size.height-(showPageControl ? pageControlHeight : 0);
	contentBounds.size.width *= viewsCount;

	[sv setContentSize:contentBounds.size];
	[sv setFrame:CGRectMake(0, 0, visibleBounds.size.width, visibleBounds.size.height)];
}

// We have to cache the current page because we need to scroll to the new (logical) position of the view
// within the scrollable view.  Doing so, if we're resizing to a SMALLER frame, causes a content offset
// reset internally, which screws with the currentPage number (since -[self scrollViewDidScroll:] is called).
// Looks a little ugly, though...
-(void)setFrame:(CGRect)frame_
{
    lastPage = [self currentPage];
    [super setFrame:frame_];
}

-(void)setBounds:(CGRect)bounds_
{
    lastPage = [self currentPage];
    [super setBounds:bounds_];
}

-(void)frameSizeChanged:(CGRect)frame bounds:(CGRect)visibleBounds
{
	if (!CGRectIsEmpty(visibleBounds))
	{
		[self refreshScrollView:visibleBounds readd:YES];
		[scrollview setContentOffset:CGPointMake(lastPage*visibleBounds.size.width,0)];
        [self manageCache:[self currentPage]];
	}
}

#pragma mark Public APIs

-(void)setCacheSize_:(id)args
{
    ENSURE_SINGLE_ARG(args, NSNumber);
    int newCacheSize = [args intValue];
    if (newCacheSize < 3) {
        // WHAT.  Let's make it something sensible.
        newCacheSize = 3;
    }
    if (newCacheSize % 2 == 0) {
        NSLog(@"[WARN] Even scrollable cache size %d; setting to %d", newCacheSize, newCacheSize-1);
        newCacheSize -= 1;
    }
    cacheSize = newCacheSize;
    [self manageCache:[self currentPage]];
}

-(void)setViews_:(id)args
{
	if ((scrollview!=nil) && ([scrollview subviews]>0))
	{
		[self refreshScrollView:[self bounds] readd:YES];
	}
}

-(void)setShowPagingControl_:(id)args
{
	showPageControl = [TiUtils boolValue:args];
	if (pageControl!=nil)
	{
		if (showPageControl==NO)
		{
			[pageControl removeFromSuperview];
			RELEASE_TO_NIL(pageControl);
		}
	}
	else if (showPageControl)
	{
		[self pagecontrol];
	}
}

-(void)setPagingControlHeight_:(id)args
{
	showPageControl=YES;
	pageControlHeight = [TiUtils floatValue:args def:20.0];
	if (pageControlHeight < 5.0)
	{
		pageControlHeight = 20.0;
	}
	[[self pagecontrol] setFrame:[self pageControlRect]];
}

-(void)setPageControlHeight_:(id)arg
{
	// for 0.8 backwards compat, renamed all for consistency
	[self setPagingControlHeight_:arg];
}

-(void)setPagingControlColor_:(id)args
{
	[[self pagecontrol] setBackgroundColor:[[TiUtils colorValue:args] _color]];
}

-(int)pageNumFromArg:(id)args
{
	int pageNum = 0;
	if ([args isKindOfClass:[TiViewProxy class]])
	{
		[[self proxy] lockViews];
		pageNum = [[[self proxy] viewProxies] indexOfObject:args];
		[[self proxy] unlockViews];
	}
	else
	{
		pageNum = [TiUtils intValue:args];
	}

	return pageNum;
}

-(void)scrollToView:(id)args
{
	int pageNum = [self pageNumFromArg:args];
	[[self scrollview] setContentOffset:CGPointMake([self bounds].size.width * pageNum, 0) animated:YES];
    [pageControl setCurrentPage:pageNum];
	currentPage = pageNum;

    [self manageCache:pageNum];

	[self.proxy replaceValue:NUMINT(pageNum) forKey:@"currentPage" notification:NO];
}

-(void)addView:(id)viewproxy
{
	[self refreshScrollView:[self bounds] readd:YES];
}

-(void)removeView:(id)args
{
	int page = [self currentPage];
	int pageCount = [[self proxy] viewCount];
	if (page==pageCount)
	{
		currentPage = pageCount-1;
		[pageControl setCurrentPage:currentPage];
		[self.proxy replaceValue:NUMINT(currentPage) forKey:@"currentPage" notification:NO];
	}
	[self refreshScrollView:[self bounds] readd:YES];
}

-(void)setCurrentPage_:(id)page
{

	int newPage = [TiUtils intValue:page];
	int viewsCount = [[self proxy] viewCount];

	if (newPage >=0 && newPage < viewsCount)
	{
		[scrollview setContentOffset:CGPointMake([self bounds].size.width * newPage, 0) animated:NO];
		currentPage = newPage;
		pageControl.currentPage = newPage;

        [self manageCache:newPage];

		[self.proxy replaceValue:NUMINT(newPage) forKey:@"currentPage" notification:NO];
	}
}

-(void)setMaxZoomScale_:(id)scale
{
	maxScale = [TiUtils floatValue:scale];
}

-(void)setMinZoomScale_:(id)scale
{
	minScale = [TiUtils floatValue:scale];
}

#pragma mark Rotation

-(void)manageRotation
{
    if ([scrollview isDecelerating]) {
        rotatedWhileScrolling = YES;
    }
}

#pragma mark Delegate calls

-(void)pageControlTouched:(id)sender
{
	int pageNum = [(UIPageControl *)sender currentPage];
	[scrollview setContentOffset:CGPointMake([self bounds].size.width * pageNum, 0) animated:YES];
	handlingPageControlEvent = YES;

	currentPage = pageNum;
	[self manageCache:currentPage];

	[self.proxy replaceValue:NUMINT(pageNum) forKey:@"currentPage" notification:NO];

	if ([self.proxy _hasListeners:@"click"])
	{
		[self.proxy fireEvent:@"click" withObject:[NSDictionary dictionaryWithObjectsAndKeys:
													NUMINT(pageNum),@"currentPage",
													[[self proxy] viewAtIndex:pageNum],@"view",nil]];
	}

}

-(void)scrollViewDidScroll:(UIScrollView *)sender
{
	//switch page control at 50% across the center - this visually looks better
    CGFloat pageWidth = scrollview.frame.size.width;
    int page = [self currentPage];
    int nextPage = floor((scrollview.contentOffset.x - pageWidth / 2) / pageWidth) + 1;
	if (page != nextPage) {
		[pageControl setCurrentPage:nextPage];
		currentPage = nextPage;
        [self manageCache:currentPage];
	}
}

-(void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView
{
	// called when setContentOffset/scrollRectVisible:animated: finishes. not called if not animating
	[self scrollViewDidEndDecelerating:scrollView];
}

-(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
    if (rotatedWhileScrolling) {
        CGFloat pageWidth = [self bounds].size.width;
        [[self scrollview] setContentOffset:CGPointMake(pageWidth * [self currentPage], 0) animated:YES];
        rotatedWhileScrolling = NO;
    }

	// At the end of scroll animation, reset the boolean used when scrolls originate from the UIPageControl
	int pageNum = [self currentPage];
	handlingPageControlEvent = NO;

	[self.proxy replaceValue:NUMINT(pageNum) forKey:@"currentPage" notification:NO];

	if ([self.proxy _hasListeners:@"scroll"])
	{
		[self.proxy fireEvent:@"scroll" withObject:[NSDictionary dictionaryWithObjectsAndKeys:
											  NUMINT(pageNum),@"currentPage",
											  [[self proxy] viewAtIndex:pageNum],@"view",nil]];
	}
	currentPage=pageNum;
	[pageControl setCurrentPage:pageNum];
}

@end

#endif


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Placodium callopismum f. callopismum

### Remarks
null


text:
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/**
 * Test for bug 508030 <https://bugzilla.mozilla.org/show_bug.cgi?id=508030>:
 * nsIMIMEService.getTypeFromExtension fails to find a match in the
 * "ext-to-type-mapping" category if the provided extension is not lowercase.
 */
function run_test() {
  // --- Common services ---

  const mimeService = Cc["@mozilla.org/mime;1"].
                      getService(Ci.nsIMIMEService);

  const categoryManager = Cc["@mozilla.org/categorymanager;1"].
                          getService(Ci.nsICategoryManager);

  // --- Test procedure ---

  const kTestExtension          = "testextension";
  const kTestExtensionMixedCase = "testExtensIon";
  const kTestMimeType           = "application/x-testextension";

  // Ensure that the test extension is not initially recognized by the operating
  // system or the "ext-to-type-mapping" category.
  try {
    // Try and get the MIME type associated with the extension.
    mimeService.getTypeFromExtension(kTestExtension);
    // The line above should have thrown an exception.
    do_throw("nsIMIMEService.getTypeFromExtension succeeded unexpectedly");
  } catch (e if (e instanceof Ci.nsIException &&
                 e.result == Cr.NS_ERROR_NOT_AVAILABLE)) {
    // This is an expected exception, thrown if the type can't be determined.
    // Any other exception would cause the test to fail.
  }

  // Add a temporary category entry mapping the extension to the MIME type.
  categoryManager.addCategoryEntry("ext-to-type-mapping", kTestExtension,
                                   kTestMimeType, false, true);

  // Check that the mapping is recognized in the simple case.
  var type = mimeService.getTypeFromExtension(kTestExtension);
  do_check_eq(type, kTestMimeType);

  // Check that the mapping is recognized even if the extension has mixed case.
  type = mimeService.getTypeFromExtension(kTestExtensionMixedCase);
  do_check_eq(type, kTestMimeType);

  // Clean up after ourselves.
  categoryManager.deleteCategoryEntry("ext-to-type-mapping", kTestExtension, false);
}


text:
package com.gdxjam.systems;

import com.badlogic.ashley.core.Engine;
import com.badlogic.ashley.core.EntitySystem;
import com.badlogic.gdx.InputMultiplexer;
import com.badlogic.gdx.InputProcessor;
import com.gdxjam.utils.Updateable;

/**
 * Super simple input manager
 *
 * @author alex-place
 * */
public class InputSystem extends EntitySystem {

	private InputMultiplexer input;

	public InputSystem() {
		init();
	}

	@Override
	public void addedToEngine(Engine engine) {
		// TODO Auto-generated method stub
		super.addedToEngine(engine);
		init();
	}

	public void init() {
		input = new InputMultiplexer();
	}

	public void addProcessor(InputProcessor processor) {
		input.addProcessor(processor);
	}

	public InputMultiplexer getInput() {
		return input;
	}

	public void update(float delta) {
		for (InputProcessor inputs : input.getProcessors()) {
			if (inputs instanceof Updateable) {
				((Updateable) inputs).update();
			}
		}
	}

}