text:
namespace internal {

extern const char kHistogramPrerenderNavigationToActivation[];
extern const char kHistogramPrerenderActivationToFirstPaint[];
extern const char kHistogramPrerenderActivationToFirstContentfulPaint[];
extern const char kHistogramPrerenderActivationToLargestContentfulPaint2[];
extern const char kHistogramPrerenderFirstInputDelay4[];
extern const char kHistogramPrerenderCumulativeShiftScore[];
extern const char kHistogramPrerenderCumulativeShiftScoreMainFrame[];
extern const char
    kHistogramPrerenderMaxCumulativeShiftScoreSessionWindowGap1000msMax5000ms2
        [];

// Responsiveness metrics.
extern const char
    kHistogramPrerenderAverageUserInteractionLatencyOverBudgetMaxEventDuration
        [];
extern const char kHistogramPrerenderNumInteractions[];
extern const char
    kHistogramPrerenderUserInteractionLatencyHighPercentile2MaxEventDuration[];
extern const char
    kHistogramPrerenderWorstUserInteractionLatencyMaxEventDuration[];

}  // namespace internal

// Prerender2 (content/browser/preloading/prerender/README.md):
// Records custom page load timing metrics for prerendered page loads.
class PrerenderPageLoadMetricsObserver
    : public page_load_metrics::PageLoadMetricsObserver {
 public:
  PrerenderPageLoadMetricsObserver();
  ~PrerenderPageLoadMetricsObserver() override;

  // page_load_metrics::PageLoadMetricsObserver implementation:
  ObservePolicy OnStart(content::NavigationHandle* navigation_handle,
                        const GURL& currently_committed_url,
                        bool started_in_foreground) override;
  ObservePolicy OnFencedFramesStart(
      content::NavigationHandle* navigation_handle,
      const GURL& currently_committed_url) override;
  ObservePolicy OnPrerenderStart(content::NavigationHandle* navigation_handle,
                                 const GURL& currently_committed_url) override;
  void DidActivatePrerenderedPage(
      content::NavigationHandle* navigation_handle) override;
  void OnFirstPaintInPage(
      const page_load_metrics::mojom::PageLoadTiming& timing) override;
  void OnFirstContentfulPaintInPage(
      const page_load_metrics::mojom::PageLoadTiming& timing) override;
  void OnFirstInputInPage(
      const page_load_metrics::mojom::PageLoadTiming& timing) override;
  void OnComplete(
      const page_load_metrics::mojom::PageLoadTiming& timing) override;
  ObservePolicy FlushMetricsOnAppEnterBackground(
      const page_load_metrics::mojom::PageLoadTiming& timing) override;

 private:
  void RecordSessionEndHistograms(
      const page_load_metrics::mojom::PageLoadTiming& main_frame_timing);
  // Records Cumulative Layout Shift Score (CLS) to UMA and UKM.
  void RecordLayoutShiftScoreMetrics(
      const page_load_metrics::mojom::PageLoadTiming& main_frame_timing);
  // Records Interaction to Next Paint (INP) to UMA and UKM.
  void RecordNormalizedResponsivenessMetrics();

  // Helper function to concatenate the histogram name, the trigger type and the
  // embedder histogram suffix when the trigger type is kEmbedder.
  std::string AppendSuffix(const std::string& histogram_name) const;

  // The type to trigger prerendering.
  absl::optional<content::PrerenderTriggerType> trigger_type_;
  // The suffix of a prerender embedder. This value is valid only when
  // PrerenderTriggerType is kEmbedder. Otherwise, it's an empty string.
  std::string embedder_histogram_suffix_;
};

#endif  // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_OBSERVERS_PRERENDER_PAGE_LOAD_METRICS_OBSERVER_H_


text:
package leetcode;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import java.util.ArrayList;
import java.util.List;

/**
 * @author ytjia created on 2017-09-10 17:30
 */
public class SmallestRangeTest {

  private SmallestRange.Solution solution;

  @Before
  public void setUp() throws Exception {
    SmallestRange smallestRange = new SmallestRange();
    solution = smallestRange.new Solution();
  }

  @Test
  public void testSmallestRange() throws Exception {
    List<List<Integer>> numsList = new ArrayList<List<Integer>>();
    List<Integer> nums1 = new ArrayList<Integer>();
    nums1.add(1);
    nums1.add(2);
    numsList.add(nums1);

    int[] smallestRange = new int[]{1, 1};
    Assert.assertArrayEquals(smallestRange, solution.smallestRange(numsList));
  }
}

redpajama_set_name: RedPajamaGithub


text:
$(document).ready(function() {
    var script = document.createElement('script');
  if (SwipeUtil.getParameterByName("file")) {
	  script.src = SwipeUtil.getParameterByName("file");
  } else {
	  script.src = './ehon.js';
  }
    document.body.appendChild(script);
});

function callback(data){
//  SwipeScreen.setSize(100);
  SwipeUtil.initSwipe(data, "#swipe", "#swipe_back");
}


text:
module Awestruct
  class Engine
    def development?
      site.profile == 'development'
    end

    def blogging?
      site.profile == 'blogging'
    end
  end
end


text:
package biz.orgin.minecraft.hothgenerator;

import java.util.Random;

import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.entity.EntityType;

import biz.orgin.minecraft.hothgenerator.schematic.BaseRoom1;
import biz.orgin.minecraft.hothgenerator.schematic.BaseRoom2;
import biz.orgin.minecraft.hothgenerator.schematic.BaseRoom3;
import biz.orgin.minecraft.hothgenerator.schematic.BaseRoom4;
import biz.orgin.minecraft.hothgenerator.schematic.BaseRoom5;
import biz.orgin.minecraft.hothgenerator.schematic.BaseRoom6;
import biz.orgin.minecraft.hothgenerator.schematic.BaseSection;
import biz.orgin.minecraft.hothgenerator.schematic.BaseTop;
import biz.orgin.minecraft.hothgenerator.schematic.Schematic;

public class BaseGenerator {

	private static Schematic[][] rooms = new Schematic[][]
			{

				// South				        West							North							East
				{ BaseRoom1.instance.rotate(0), BaseRoom1.instance.rotate(1), BaseRoom1.instance.rotate(2),  BaseRoom1.instance.rotate(3)},
				{ BaseRoom2.instance.rotate(0), BaseRoom2.instance.rotate(1), BaseRoom2.instance.rotate(2),  BaseRoom2.instance.rotate(3)},
				{ BaseRoom3.instance.rotate(0), BaseRoom3.instance.rotate(1), BaseRoom3.instance.rotate(2),  BaseRoom3.instance.rotate(3)},
				{ BaseRoom4.instance.rotate(0), BaseRoom4.instance.rotate(1), BaseRoom4.instance.rotate(2),  BaseRoom4.instance.rotate(3)},
				{ BaseRoom5.instance.rotate(0), BaseRoom5.instance.rotate(1), BaseRoom5.instance.rotate(2),  BaseRoom5.instance.rotate(3)},
				{ BaseRoom6.instance.rotate(0), BaseRoom6.instance.rotate(1), BaseRoom6.instance.rotate(2),  BaseRoom6.instance.rotate(3)}
			};

	private static int roomCnt = BaseGenerator.rooms.length;

	public static void generateBase(HothGeneratorPlugin plugin, World world, Random random, int chunkX, int chunkZ)
	{
		int rarity = ConfigManager.getStructureBasesRarity(plugin, world);

		if(rarity!=0)
		{
			int doit = random.nextInt(512*rarity);
			if(doit == 350)
			{
				plugin.addTask(new PlaceBase(world, random, chunkX, chunkZ));
			}
		}
	}

	static class PlaceBase extends HothRunnable
	{
		private static final long serialVersionUID = -4298666022386809250L;
		private Random random;
		private int chunkx;
		private int chunkz;

		private int room5s;

		public String getParameterString()
		{
			return "chunkx=" + this.chunkx + " chunkz=" + this.chunkz;
		}

		public PlaceBase(World world, Random random, int chunkx, int chunkz)
		{
			this.setName("PlaceBase");
			this.setPlugin(null);
			this.setWorld(world);
			this.random = random;
			this.chunkx = chunkx;
			this.chunkz = chunkz;

			this.room5s = 0;
		}

		public int getRandomRoom(HothGeneratorPlugin plugin, World world)
		{
			boolean done= false;
			int room = 0;

			while(!done)
			{
				room = random.nextInt(BaseGenerator.roomCnt);
				if(room==4)
				{
					if(this.room5s<2 && ConfigManager.isStructureBasesSpawner(plugin, world))
					{
						this.room5s++;
						done = true;
					}
				}
				else
				{
					done = true;
				}
			}

			return room;
		}

		@Override
		public void run()
		{
			HothGeneratorPlugin plugin = this.getPlugin();
			World world = this.getWorld();

			int sx = this.chunkx*16 + random.nextInt(16);
			int sz = this.chunkz*16 + random.nextInt(16);

			int sy = world.getHighestBlockYAt(sx, sz);

			boolean safePlace = true;

			// Check if there's stone around
			Block block = world.getBlockAt(sx,sy,sz); Material type = block.getType();
			if(safePlace && (type.equals(Material.STONE) || type.equals(Material.GLASS))) safePlace = false;
			block = world.getBlockAt(sx-5,sy+11,sz-5); type = block.getType();
			if(safePlace && !type.equals(Material.AIR)) safePlace = false;
			block = world.getBlockAt(sx+5,sy+11,sz-5); type = block.getType();
			if(safePlace && !type.equals(Material.AIR)) safePlace = false;
			block = world.getBlockAt(sx+5,sy+11,sz+5); type = block.getType();
			if(safePlace && !type.equals(Material.AIR)) safePlace = false;
			block = world.getBlockAt(sx-5,sy+11,sz+5); type = block.getType();
			if(safePlace && !type.equals(Material.AIR)) safePlace = false;
			block = world.getBlockAt(sx-5,sy-2,sz-5); type = block.getType();
			if(safePlace && (type.equals(Material.STONE) || type.equals(Material.GLASS) || type.equals(Material.AIR))) safePlace = false;
			block = world.getBlockAt(sx+5,sy-2,sz-5); type = block.getType();
			if(safePlace && (type.equals(Material.STONE) || type.equals(Material.GLASS) || type.equals(Material.AIR))) safePlace = false;
			block = world.getBlockAt(sx+5,sy-2,sz+5); type = block.getType();
			if(safePlace && (type.equals(Material.STONE) || type.equals(Material.GLASS) || type.equals(Material.AIR))) safePlace = false;
			block = world.getBlockAt(sx-5,sy-2,sz+5); type = block.getType();
			if(safePlace && (type.equals(Material.STONE) || type.equals(Material.GLASS) || type.equals(Material.AIR))) safePlace = false;

			if(safePlace)
			{
				plugin.logMessage("Placing base at " + world.getName() + "," + sx + "," + sy + "," + sz, true);

				HothUtils.placeSchematic(plugin, world, BaseTop.instance, sx-5, sy+11, sz-5, 2, 10);
				world.spawnEntity(new Location(world, sx+5, sy+5, sz+5), EntityType.VILLAGER);

				int sections = 3+random.nextInt(4);

				for(int i=0;i<sections;i++)
				{
					int px = sx-3;
					int py = sy-5-i*5;
					int pz = sz-3;

					HothUtils.placeSchematic(plugin, world, BaseSection.instance, px, py, pz, 2, 10);
					world.spawnEntity(new Location(world, px+3, py-2, pz+2), EntityType.VILLAGER);

					int rooms = random.nextInt(16);
					if((rooms&0x1)!=0) // North
					{
						Schematic roomN = BaseGenerator.rooms[this.getRandomRoom(plugin, world)][2];
						HothUtils.placeSchematic(plugin, world, roomN, px, py , pz-9, 2, 10);
					}
					else
					{
						Block door = world.getBlockAt(px+3, py-2, pz); door.setType(Material.COBBLESTONE);
						door = world.getBlockAt(px+3, py-3, pz); door.setType(Material.COBBLESTONE);
					}
					if((rooms&0x2)!=0) // South
					{
						Schematic roomS = BaseGenerator.rooms[this.getRandomRoom(plugin, world)][0];
						HothUtils.placeSchematic(plugin, world, roomS, px, py , pz+6, 2, 10);
					}
					else
					{
						Block door = world.getBlockAt(px+3, py-2, pz+6); door.setType(Material.COBBLESTONE);
						door = world.getBlockAt(px+3, py-3, pz+6); door.setType(Material.COBBLESTONE);
					}
					if((rooms&0x4)!=0) // West
					{
						Schematic roomW = BaseGenerator.rooms[this.getRandomRoom(plugin, world)][1];
						HothUtils.placeSchematic(plugin, world, roomW, px-9, py , pz, 2, 10);
					}
					else
					{
						Block door = world.getBlockAt(px, py-2, pz+3); door.setType(Material.COBBLESTONE);
						door = world.getBlockAt(px, py-3, pz+3); door.setType(Material.COBBLESTONE);
					}
					if((rooms&0x8)!=0) // East
					{
						Schematic roomE = BaseGenerator.rooms[this.getRandomRoom(plugin, world)][3];
						HothUtils.placeSchematic(plugin, world, roomE, px+6, py , pz, 2, 10);
					}
					else
					{
						Block door = world.getBlockAt(px+6, py-2, pz+3); door.setType(Material.COBBLESTONE);
						door = world.getBlockAt(px+6, py-3, pz+3); door.setType(Material.COBBLESTONE);
					}
				}

			}
			else
			{
				plugin.logMessage("Failed to place base at " + world.getName() + "," + sx + "," + sy + "," + sz, true);
			}

		}
	}
}


text:
title: Backend with jrebel
authors: lhornyak
wiki_title: Backend with jrebel
wiki_revision_count: 3
wiki_last_updated: 2012-02-06
---

# Backend with jrebel

## Running the backend with jrebel

The backend development sometimes needs a little more time than what you have, jrebel may be a solution for this.

### JRebel

[JRebel](http://zeroturnaround.com/jrebel/) is a **non-free** software that modifies the classloading behavior of the JVM and loads the classes from an alternate location. You can save the time spent on rebuilding and redeploying the whole source.

JRebel can be used for free on open source projects.

Steps:

*   request an opensource license
*   download the license and save as ~/.rebel

### modify the root pom.xml

Add this to the pom.xml

`   `<profile>
`     `<id>`jrebel`</id>
`     `<build>
`       `<plugins>
`         `<plugin>
`           `<groupId>`org.zeroturnaround`</groupId>
`           `<artifactId>`jrebel-maven-plugin`</artifactId>
`           `<executions>
`             `<execution>
`               `<id>`generate-rebel-xml`</id>
`               `<phase>`process-resources`</phase>
`               `<goals>
`                 `<goal>`generate`</goal>
`               `</goals>
`             `</execution>
`           `</executions>
`         `</plugin>
`       `</plugins>
`     `</build>
`   `</profile>

Either set it as active by default or use -Pjrebel at build time. When building, this will generate rebel.xml files to each of your jar files, they will be packaged into your jars and will be used to tell the jrebel runtime where to load classes from.

Since this modification is not welcome in the git repositories and it can easily get lost when doing the usual git magic, you can add this script to your build program. This will check if jrebel is in your pom and add it if not.

      ` JREBEL_INSTALLED=`grep jrebel pom.xml | wc -l` `
      if [ $JREBEL_INSTALLED -gt 0 ]; then
`       echo jrebel installed `\(should be ok!\)
      else
             echo jrebel not installed, installing
             cat pom.xml | sed -e "s/<\/profiles>/ `<profile>`\n`<build>`\n`<plugins>`\n`<plugin>`\n`<groupId>`org.zeroturnaround<\/groupId>\n`<artifactId>`jrebel-maven-plugin<\/artifactId>\n`<executions>`\n`<execution>`\n`<id>`generate-rebel-xml<\/id>\n`<phase>`process-resources<\/phase>\n`<goals>`\n`<goal>`generate<\/goal>\n<\/goals>\n<\/execution>\n<\/executions>\n<\/plugin>\n<\/plugins>\n<\/build>\n<\/profile>\n<\/profiles>/" > pom.hacked
             mv pom.hacked pom.xml
      fi

### JBoss

Add this to your jboss standalone.conf:

      export REBEL_HOME=/path/to/jrebel/
      JAVA_OPTS="$JAVA_OPTS -javaagent:$REBEL_HOME/jrebel.jar $JAVA_OPTS"

And start your jboss


text:
description: Represents a Dependency of one Variable on another (or itself).

<meta itemprop="name" content="recsim_ng.core.variable.Dependency" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="__eq__"/>
<meta itemprop="property" content="__init__"/>

# recsim_ng.core.variable.Dependency

View
source

Represents a Dependency of one `Variable` on another (or itself).

recsim_ng.core.variable.Dependency(
    variable_name: Text, on_current_value: bool
)

The current `Value` of a `Variable` has zero or more dependencies. There are two
kinds of dependencies: * The current `Value` of some other `Variable`. * The
previous `Value` of itself or some other `Variable`. The `on_current_value`
boolean attribute disambiguates between these.

The initial `Value` of a `Variable` can only have "current" dependencies. See
`Variable` for more details.

Note that if `var` is a `Variable` then `var.previous` is shorthand for
`Dependency(variable_name=var.name, on_current_value=False)`. Finally, see the
`value` function for another convenient way to form dependencies.

<colgroup><col width="214px"><col></colgroup>

Attributes

`variable_name`

Dataclass field

`on_current_value`

Dataclass field

## Methods

__eq__

__eq__(
    other
)


text:
using System.Collections.Generic;
using System.Diagnostics;

namespace Slp.Evi.Storage.Sparql.Algebra.Expressions
{
    /// <summary>
    /// Expression representing negation
    /// </summary>
    public class NegationExpression
        : ISparqlCondition
    {
        /// <summary>
        /// Gets the inner condition.
        /// </summary>
        /// <value>The inner condition.</value>
        public ISparqlCondition InnerCondition { get; }

        /// <summary>
        /// Initializes a new instance of the <see cref="NegationExpression"/> class.
        /// </summary>
        /// <param name="innerCondition">The inner condition.</param>
        public NegationExpression(ISparqlCondition innerCondition)
        {
            InnerCondition = innerCondition;
        }

        /// <summary>
        /// Accepts the specified visitor.
        /// </summary>
        /// <param name="visitor">The visitor.</param>
        /// <param name="data">The data.</param>
        /// <returns>The returned value from visitor.</returns>
        [DebuggerStepThrough]
        public object Accept(ISparqlExpressionVisitor visitor, object data)
        {
            return visitor.Visit(this, data);
        }

        /// <summary>
        /// Gets the needed variables to evaluate the expression.
        /// </summary>
        public IEnumerable<string> NeededVariables => InnerCondition.NeededVariables;
    }
}


text:
package com.dangdang.ddframe.rdb.transaction.soft.datasource;

import com.dangdang.ddframe.rdb.transaction.soft.constants.TransactionLogDataSourceType;
import javax.sql.DataSource;

/**
 * 事务数据源.
 *
 * @author caohao
 */
public interface TransactionLogDataSource {

    /**
     * 获取数据源类型.
     */
    TransactionLogDataSourceType getType();

    /**
     * 获取数据源.
     */
    DataSource getDataSource();
}


text:
\section{Auswertung}
Zur quantitativen Auswertung der aufgenommenen STM Bilder wird die Software \emph{gwyddion}\cite{gwyddion} %cite
verwendet. Hiermit wird vor allem eine ebene Subtraktion in den Aufnahmen durchgeführt und das Höhenprofil
der Goldprobe vermessen. Die Auswertungen der foreward und backward Scans erfolgen zunächst unabhängig, sodass
abschließend über die gewonnen Ergebnisse gemittelt werden kann.
Von einer quantitativen Analyse der im up Modus aufgenommen Bilder wird abgesehen. In Abbildung \ref{fig: up} ist eine
beispielhafte Aufnahme einzusehen. Hierauf ist klar zu erkennen, dass die Struktur stark verzerrt ist. Ein Vermessung
der Gittervektoren ist nicht möglich.  %das bedeutet?
\begin{figure}
  \centering
  \includegraphics[width = 0.5\textwidth]{../Messdaten/bilder/up.png}
  \caption{STM Aufnahme im up Modus.}
  \label{fig: up}
\end{figure}

\subsection{Untersuchung der HOPG-Probe}
Die aufgenommenen Bilder der HOPG-Probe im foreward und backward Modus sind in den Abbildungen~\ref{fig: foreward}
und~\ref{fig: backward} einzusehen.
\begin{figure}
  \centering
  \includegraphics[width = \textwidth]{../Messdaten/bilder/fit_01_foreward.pdf}
  \caption{Foreward Scan der HOPG-Probe mit eingezeichneten Messwerten und linearen Regressionen.}
  \label{fig: foreward}
\end{figure}
\begin{figure}
  \centering
  \includegraphics[width = \textwidth]{../Messdaten/bilder/fit_01_backward.pdf}
  \caption{Backward Scan der HOPG-Probe mit eingezeichneten Messwerten und linearen Regressionen.}
  \label{fig: backward}
\end{figure}
Entlang zweier Achsen $\vec{a}$ und $\vec{b}$ werden die Koordinaten der ersichtlichen Helligkeitsminima
abgelesen. Die Daten sind in Tabelle \ref{tab: data} eingetragen. Hiermit wird
mittels der Methode der kleinsten Fehlerquadrate eine Regression an eine %vlt. noch erwähnen womit du die Regressionsrechnung gemacht hast
lineare Funktion der Form
\begin{equation}
  y = m \cdot x + g
\end{equation}
durchgeführt.
\input{../Messdaten/vector_data.tex}

Die Fitparameter für foreward (f) und backward (b) Scan ergeben sich zu
\begin{align}
  m\ua{f, \vec{a}} &= \num{-0.652(7)} & g\ua{f, \vec{a}} &= \SI{2.44(1)}{\nano\meter} \\
  m\ua{f, \vec{b}} &= \num{1.85(3)} & g\ua{f, \vec{b}} &= \SI{-1.95(5)}{\nano\meter}
\end{align}
und
\begin{align}
  m\ua{b, \vec{a}} &= \num{-0.645(5)} & g\ua{b, \vec{a}} &= \SI{2.213(8)}{\nano\meter} \\
  m\ua{b, \vec{b}} &= \num{1.88(2)}   & g\ua{b, \vec{b}} &= \SI{-1.53(4)}{\nano\meter}
\end{align}
Die verwendeten Daten und Regressionsgeraden sind ebenfalls in den Abbildungen~\ref{fig: foreward}
und~\ref{fig: backward} eingezeichnet.
Die auftretenden Fehler der Regressionsrechnung liegen in einer Größenordnung, die außerhalb der Ablesegenauigkeit der
gefundenen Daten \ref{tab: data} liegt. Von einer Fortpflanzung der Fehler wird daher abgesehen. In der Diskussion
wird hierauf näher eingegangen.
Mit den Fitparamtern und den Koordinaten der ersten und letzten Punkte der abgelesenen Daten werden Gittervektoren $\vec{a}\ua{f, n_1}$, $\vec{b}\ua{f, n_2}$ und
$\vec{a}\ua{b, n_3}$, $\vec{b}\ua{b, n_4}$ bestimmt, die sich über $n\ua{i}$ Einheitszellen erstrecken
\begin{align}
  \vec{a}\ua{f, 14} &= \begin{pmatrix} \num{-2.18} \\  \num{1.42} \end{pmatrix}\si{\nano\meter} & \vec{b}\ua{f, 17}   &= \begin{pmatrix} \num{1.27} \\ \num{2.35} \end{pmatrix} \si{\nano\meter}\\
  \vec{a}\ua{b, 14} &= \begin{pmatrix}  \num{-2.21} \\ \num{1.43} \end{pmatrix}\si{\nano\meter} &  \vec{b}\ua{b, 16} &= \begin{pmatrix} \num{1.18} \\ \num{2.22} \end{pmatrix} \si{\nano\meter}.
\end{align}
Im Mittel ergeben sich folgende Gittervektoren $\vec{a}$ und $\vec{b}$ bezogen auf die Einheitszelle:
\begin{equation}
  \vec{a} = \begin{pmatrix} \num{-1.57(2)} \\  \num{1.017(2)} \end{pmatrix}\si{\angstrom} \qquad
  \vec{b} = \begin{pmatrix} \num{0.742(7)} \\  \num{1.384(5)} \end{pmatrix}\si{\angstrom}
\end{equation}
Mit den Beträgen
\begin{equation}
  \left|\vec{a}\right| = \SI{1.87(1)}{\angstrom} \quad \left|\vec{b}\right| = \SI{1.571(5)}{\angstrom}.
  \label{eq: mittlere_gittervektoren}
\end{equation}
und dem Innenwinkel:
\begin{equation}
  \theta = \SI{85.2(4)}{\degree}.
\end{equation}
Der Literaturwert für die Gitterkonstante $G$ beträgt gemäß \cite{hopg} $G = \SI{2.56}{\angstrom}$. Zur quantitativen Analyse
der durch den Aufbau verzerrten Darstellung der Struktur sollen die Elemente einer Skalierungsmatrix $S$ ermittelt werden, die
die gefundenen Vektoren in die theoretischen Gittervektoren überführen soll. $S$ wird als diagonal angesetzt
\begin{equation}
  \vec{a}\ua{lit} = \begin{pmatrix} s\ua{x} & 0 \\  0  &   s\ua{y} \end{pmatrix} \vec{a},
  \qquad \vec{b}\ua{lit} = \begin{pmatrix} s\ua{x} & 0 \\  0  &   s\ua{y} \end{pmatrix} \vec{b}.
  \label{eq: korrekturmatrix}
\end{equation}
Aus der der Forderung $G = \left|S \vec{a}\right| = \left|S \vec{b}\right|$ können die konstanten $s_x$ und $s_y$ ermittelt werden
\begin{align}
  s_y^2 &= \frac{G^2\left( a\ua{x}^2 - b\ua{x}^2\right)}{a\ua{x}^2 b\ua{y}^2 - a\ua{y}^2 b\ua{x}^2} \\
  s_x^2 &= \frac{G^2 - s\ua{y}^2 a\ua{y}^2}{a\ua{x}^2}.
\end{align}
Einsetzen der Werte der in \eqref{eq: mittlere_gittervektoren} aufgeführten Vektoren liefert
\begin{equation}
  s\ua{x} = \num{1.14(1)}  \qquad s\ua{y} = \num{1.670(8)}.
\end{equation}
Somit ergeben sich die skalierten Vektoren $\vec{a}\ua{skaliert}$ und $\vec{b}\ua{skaliert}$ zu
\begin{equation}
  \vec{a}\ua{skaliert} = \begin{pmatrix} \num{-1.780(8)} \\  \num{1.698(9)} \end{pmatrix}\si{\angstrom} \qquad
  \vec{b}\ua{skaliert} = \begin{pmatrix} \num{0.84(1)} \\  \num{2.311(5)} \end{pmatrix}\si{\angstrom}
\end{equation}
Der Winkel $\theta\ua{skaliert}$ zwischen den skalierten Vektoren beträgt.
\begin{equation}
  \theta\ua{skaliert} = \SI{66.4(6)}{\degree}.
\end{equation}

\subsection{Untersuchung der Goldprobe}
Das aufgenommene STM Bild zur Untersuchung der Goldoberfläche ist in Abbildung~\ref{fig: au} einzusehen.
In der Abbildung ist zudem eine Gerade eingezeichnet entlang derer das Höhenprofil vermessen werden soll.
Die mit \emph{gwyddion} entnommenen Daten sind in Abbildung~\ref{fig: höhenprofil}
graphisch dargestellt. Gemäß den eingezeichneten vertikalen Linien
in Abbildung~\ref{fig: höhenprofil} werden die Daten zwei verschiedenen %heißt es nicht zweier verschiedener Niveaus
Niveaus $h_1$ und $h_2$ zugeordnet, an denen eine Ausgleichsrechnung durchgeführt wird. Es ergeben sich für die
Niveaus
\begin{equation}
  h_1 = \SI{-58.180(7)}{\nano\meter} \qquad h_2 = \SI{-58.655(5)}{\nano\meter}
\end{equation}
Für die Höhendifferenz $\Delta h$ gilt damit
\begin{equation}
  \Delta h = \SI{4.75(9)}{\angstrom}.
\end{equation}
\begin{figure}
  \centering
  \includegraphics[width = 0.8\textwidth]{../Messdaten/bilder/goldoberfläche.pdf}
  \caption{Aufgenommenes STM Bild der Goldoberfläche. Eingezeichnet ist die Linie entlang derer
  das Höhenprofil quantitativ untersucht wird.}
  \label{fig: au}
\end{figure}
\begin{figure}
  \centering
  \includegraphics[width = 0.8\textwidth]{../Messdaten/bilder/au_plateau.pdf}
  \caption{Darstellung der Plateaus auf der Goldoberfläche. Eingezeichnet sind die Regressionen an
  konstante Werte der Höhe $z$. Bemerkung: Da sehr viele Datenpunkte entnommen wurden, ist die Höhnelinie durchgezogen gezeichnet.}
  \label{fig: höhenprofil}
\end{figure}


text:
namespace v8 {
namespace internal {
namespace compiler {

// static
int NodeProperties::PastValueIndex(Node* node) {
  return FirstValueIndex(node) + node->op()->ValueInputCount();
}

// static
int NodeProperties::PastContextIndex(Node* node) {
  return FirstContextIndex(node) +
         OperatorProperties::GetContextInputCount(node->op());
}

// static
int NodeProperties::PastFrameStateIndex(Node* node) {
  return FirstFrameStateIndex(node) +
         OperatorProperties::GetFrameStateInputCount(node->op());
}

// static
int NodeProperties::PastEffectIndex(Node* node) {
  return FirstEffectIndex(node) + node->op()->EffectInputCount();
}

// static
int NodeProperties::PastControlIndex(Node* node) {
  return FirstControlIndex(node) + node->op()->ControlInputCount();
}

// static
Node* NodeProperties::GetValueInput(Node* node, int index) {
  DCHECK(0 <= index && index < node->op()->ValueInputCount());
  return node->InputAt(FirstValueIndex(node) + index);
}

// static
Node* NodeProperties::GetContextInput(Node* node) {
  DCHECK(OperatorProperties::HasContextInput(node->op()));
  return node->InputAt(FirstContextIndex(node));
}

// static
Node* NodeProperties::GetFrameStateInput(Node* node) {
  DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node->op()));
  return node->InputAt(FirstFrameStateIndex(node));
}

// static
Node* NodeProperties::GetEffectInput(Node* node, int index) {
  DCHECK(0 <= index && index < node->op()->EffectInputCount());
  return node->InputAt(FirstEffectIndex(node) + index);
}

// static
Node* NodeProperties::GetControlInput(Node* node, int index) {
  DCHECK(0 <= index && index < node->op()->ControlInputCount());
  return node->InputAt(FirstControlIndex(node) + index);
}

// static
bool NodeProperties::IsValueEdge(Edge edge) {
  Node* const node = edge.from();
  return IsInputRange(edge, FirstValueIndex(node),
                      node->op()->ValueInputCount());
}

// static
bool NodeProperties::IsContextEdge(Edge edge) {
  Node* const node = edge.from();
  return IsInputRange(edge, FirstContextIndex(node),
                      OperatorProperties::GetContextInputCount(node->op()));
}

// static
bool NodeProperties::IsFrameStateEdge(Edge edge) {
  Node* const node = edge.from();
  return IsInputRange(edge, FirstFrameStateIndex(node),
                      OperatorProperties::GetFrameStateInputCount(node->op()));
}

// static
bool NodeProperties::IsEffectEdge(Edge edge) {
  Node* const node = edge.from();
  return IsInputRange(edge, FirstEffectIndex(node),
                      node->op()->EffectInputCount());
}

// static
bool NodeProperties::IsControlEdge(Edge edge) {
  Node* const node = edge.from();
  return IsInputRange(edge, FirstControlIndex(node),
                      node->op()->ControlInputCount());
}

// static
bool NodeProperties::IsExceptionalCall(Node* node, Node** out_exception) {
  if (node->op()->HasProperty(Operator::kNoThrow)) return false;
  for (Edge const edge : node->use_edges()) {
    if (!NodeProperties::IsControlEdge(edge)) continue;
    if (edge.from()->opcode() == IrOpcode::kIfException) {
      if (out_exception != nullptr) *out_exception = edge.from();
      return true;
    }
  }
  return false;
}

// static
Node* NodeProperties::FindSuccessfulControlProjection(Node* node) {
  DCHECK_GT(node->op()->ControlOutputCount(), 0);
  if (node->op()->HasProperty(Operator::kNoThrow)) return node;
  for (Edge const edge : node->use_edges()) {
    if (!NodeProperties::IsControlEdge(edge)) continue;
    if (edge.from()->opcode() == IrOpcode::kIfSuccess) {
      return edge.from();
    }
  }
  return node;
}

// static
void NodeProperties::ReplaceValueInput(Node* node, Node* value, int index) {
  DCHECK(index < node->op()->ValueInputCount());
  node->ReplaceInput(FirstValueIndex(node) + index, value);
}

// static
void NodeProperties::ReplaceValueInputs(Node* node, Node* value) {
  int value_input_count = node->op()->ValueInputCount();
  DCHECK_LE(1, value_input_count);
  node->ReplaceInput(0, value);
  while (--value_input_count > 0) {
    node->RemoveInput(value_input_count);
  }
}

// static
void NodeProperties::ReplaceContextInput(Node* node, Node* context) {
  node->ReplaceInput(FirstContextIndex(node), context);
}

// static
void NodeProperties::ReplaceControlInput(Node* node, Node* control, int index) {
  DCHECK(index < node->op()->ControlInputCount());
  node->ReplaceInput(FirstControlIndex(node) + index, control);
}

// static
void NodeProperties::ReplaceEffectInput(Node* node, Node* effect, int index) {
  DCHECK(index < node->op()->EffectInputCount());
  return node->ReplaceInput(FirstEffectIndex(node) + index, effect);
}

// static
void NodeProperties::ReplaceFrameStateInput(Node* node, Node* frame_state) {
  DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node->op()));
  node->ReplaceInput(FirstFrameStateIndex(node), frame_state);
}

// static
void NodeProperties::RemoveNonValueInputs(Node* node) {
  node->TrimInputCount(node->op()->ValueInputCount());
}

// static
void NodeProperties::RemoveValueInputs(Node* node) {
  int value_input_count = node->op()->ValueInputCount();
  while (--value_input_count >= 0) {
    node->RemoveInput(value_input_count);
  }
}

void NodeProperties::MergeControlToEnd(Graph* graph,
                                       CommonOperatorBuilder* common,
                                       Node* node) {
  graph->end()->AppendInput(graph->zone(), node);
  graph->end()->set_op(common->End(graph->end()->InputCount()));
}

// static
void NodeProperties::ReplaceUses(Node* node, Node* value, Node* effect,
                                 Node* success, Node* exception) {
  // Requires distinguishing between value, effect and control edges.
  for (Edge edge : node->use_edges()) {
    if (IsControlEdge(edge)) {
      if (edge.from()->opcode() == IrOpcode::kIfSuccess) {
        DCHECK_NOT_NULL(success);
        edge.UpdateTo(success);
      } else if (edge.from()->opcode() == IrOpcode::kIfException) {
        DCHECK_NOT_NULL(exception);
        edge.UpdateTo(exception);
      } else {
        DCHECK_NOT_NULL(success);
        edge.UpdateTo(success);
      }
    } else if (IsEffectEdge(edge)) {
      DCHECK_NOT_NULL(effect);
      edge.UpdateTo(effect);
    } else {
      DCHECK_NOT_NULL(value);
      edge.UpdateTo(value);
    }
  }
}

// static
void NodeProperties::ChangeOp(Node* node, const Operator* new_op) {
  node->set_op(new_op);
  Verifier::VerifyNode(node);
}

// static
Node* NodeProperties::FindFrameStateBefore(Node* node) {
  Node* effect = NodeProperties::GetEffectInput(node);
  while (effect->opcode() != IrOpcode::kCheckpoint) {
    if (effect->opcode() == IrOpcode::kDead) return effect;
    DCHECK_EQ(1, effect->op()->EffectInputCount());
    effect = NodeProperties::GetEffectInput(effect);
  }
  Node* frame_state = GetFrameStateInput(effect);
  return frame_state;
}

// static
Node* NodeProperties::FindProjection(Node* node, size_t projection_index) {
  for (auto use : node->uses()) {
    if (use->opcode() == IrOpcode::kProjection &&
        ProjectionIndexOf(use->op()) == projection_index) {
      return use;
    }
  }
  return nullptr;
}

// static
void NodeProperties::CollectValueProjections(Node* node, Node** projections,
                                             size_t projection_count) {
#ifdef DEBUG
  for (size_t index = 0; index < projection_count; ++index) {
    DCHECK_NULL(projections[index]);
  }
#endif
  for (Edge const edge : node->use_edges()) {
    if (!IsValueEdge(edge)) continue;
    Node* use = edge.from();
    DCHECK_EQ(IrOpcode::kProjection, use->opcode());
    projections[ProjectionIndexOf(use->op())] = use;
  }
}

// static
void NodeProperties::CollectControlProjections(Node* node, Node** projections,
                                               size_t projection_count) {
#ifdef DEBUG
  DCHECK_LE(static_cast<int>(projection_count), node->UseCount());
  std::memset(projections, 0, sizeof(*projections) * projection_count);
#endif
  size_t if_value_index = 0;
  for (Edge const edge : node->use_edges()) {
    if (!IsControlEdge(edge)) continue;
    Node* use = edge.from();
    size_t index;
    switch (use->opcode()) {
      case IrOpcode::kIfTrue:
        DCHECK_EQ(IrOpcode::kBranch, node->opcode());
        index = 0;
        break;
      case IrOpcode::kIfFalse:
        DCHECK_EQ(IrOpcode::kBranch, node->opcode());
        index = 1;
        break;
      case IrOpcode::kIfSuccess:
        DCHECK(!node->op()->HasProperty(Operator::kNoThrow));
        index = 0;
        break;
      case IrOpcode::kIfException:
        DCHECK(!node->op()->HasProperty(Operator::kNoThrow));
        index = 1;
        break;
      case IrOpcode::kIfValue:
        DCHECK_EQ(IrOpcode::kSwitch, node->opcode());
        index = if_value_index++;
        break;
      case IrOpcode::kIfDefault:
        DCHECK_EQ(IrOpcode::kSwitch, node->opcode());
        index = projection_count - 1;
        break;
      default:
        continue;
    }
    DCHECK_LT(if_value_index, projection_count);
    DCHECK_LT(index, projection_count);
    DCHECK_NULL(projections[index]);
    projections[index] = use;
  }
#ifdef DEBUG
  for (size_t index = 0; index < projection_count; ++index) {
    DCHECK_NOT_NULL(projections[index]);
  }
#endif
}

// static
bool NodeProperties::IsSame(Node* a, Node* b) {
  for (;;) {
    if (a->opcode() == IrOpcode::kCheckHeapObject) {
      a = GetValueInput(a, 0);
      continue;
    }
    if (b->opcode() == IrOpcode::kCheckHeapObject) {
      b = GetValueInput(b, 0);
      continue;
    }
    return a == b;
  }
}

// static
base::Optional<MapRef> NodeProperties::GetJSCreateMap(JSHeapBroker* broker,
                                                      Node* receiver) {
  DCHECK(receiver->opcode() == IrOpcode::kJSCreate ||
         receiver->opcode() == IrOpcode::kJSCreateArray);
  HeapObjectMatcher mtarget(GetValueInput(receiver, 0));
  HeapObjectMatcher mnewtarget(GetValueInput(receiver, 1));
  if (mtarget.HasValue() && mnewtarget.HasValue() &&
      mnewtarget.Ref(broker).IsJSFunction()) {
    ObjectRef target = mtarget.Ref(broker);
    JSFunctionRef newtarget = mnewtarget.Ref(broker).AsJSFunction();
    if (newtarget.map().has_prototype_slot() && newtarget.has_initial_map()) {
      if (broker->mode() == JSHeapBroker::kSerializing) newtarget.Serialize();
      MapRef initial_map = newtarget.initial_map();
      if (initial_map.GetConstructor().equals(target)) {
        DCHECK(target.AsJSFunction().map().is_constructor());
        DCHECK(newtarget.map().is_constructor());
        return initial_map;
      }
    }
  }
  return base::nullopt;
}

// static
NodeProperties::InferReceiverMapsResult NodeProperties::InferReceiverMaps(
    JSHeapBroker* broker, Node* receiver, Node* effect,
    ZoneHandleSet<Map>* maps_return) {
  HeapObjectMatcher m(receiver);
  if (m.HasValue()) {
    HeapObjectRef receiver = m.Ref(broker).AsHeapObject();
    // We don't use ICs for the Array.prototype and the Object.prototype
    // because the runtime has to be able to intercept them properly, so
    // we better make sure that TurboFan doesn't outsmart the system here
    // by storing to elements of either prototype directly.
    //
    // TODO(bmeurer): This can be removed once the Array.prototype and
    // Object.prototype have NO_ELEMENTS elements kind.
    if (!receiver.IsJSObject() ||
        !broker->IsArrayOrObjectPrototype(receiver.AsJSObject())) {
      if (receiver.map().is_stable()) {
        // The {receiver_map} is only reliable when we install a stability
        // code dependency.
        *maps_return = ZoneHandleSet<Map>(receiver.map().object());
        return kUnreliableReceiverMaps;
      }
    }
  }
  InferReceiverMapsResult result = kReliableReceiverMaps;
  while (true) {
    switch (effect->opcode()) {
      case IrOpcode::kMapGuard: {
        Node* const object = GetValueInput(effect, 0);
        if (IsSame(receiver, object)) {
          *maps_return = MapGuardMapsOf(effect->op());
          return result;
        }
        break;
      }
      case IrOpcode::kCheckMaps: {
        Node* const object = GetValueInput(effect, 0);
        if (IsSame(receiver, object)) {
          *maps_return = CheckMapsParametersOf(effect->op()).maps();
          return result;
        }
        break;
      }
      case IrOpcode::kJSCreate: {
        if (IsSame(receiver, effect)) {
          base::Optional<MapRef> initial_map = GetJSCreateMap(broker, receiver);
          if (initial_map.has_value()) {
            *maps_return = ZoneHandleSet<Map>(initial_map->object());
            return result;
          }
          // We reached the allocation of the {receiver}.
          return kNoReceiverMaps;
        }
        break;
      }
      case IrOpcode::kJSCreatePromise: {
        if (IsSame(receiver, effect)) {
          *maps_return = ZoneHandleSet<Map>(broker->native_context()
                                                .promise_function()
                                                .initial_map()
                                                .object());
          return result;
        }
        break;
      }
      case IrOpcode::kStoreField: {
        // We only care about StoreField of maps.
        Node* const object = GetValueInput(effect, 0);
        FieldAccess const& access = FieldAccessOf(effect->op());
        if (access.base_is_tagged == kTaggedBase &&
            access.offset == HeapObject::kMapOffset) {
          if (IsSame(receiver, object)) {
            Node* const value = GetValueInput(effect, 1);
            HeapObjectMatcher m(value);
            if (m.HasValue()) {
              *maps_return = ZoneHandleSet<Map>(m.Ref(broker).AsMap().object());
              return result;
            }
          }
          // Without alias analysis we cannot tell whether this
          // StoreField[map] affects {receiver} or not.
          result = kUnreliableReceiverMaps;
        }
        break;
      }
      case IrOpcode::kJSStoreMessage:
      case IrOpcode::kJSStoreModule:
      case IrOpcode::kStoreElement:
      case IrOpcode::kStoreTypedElement: {
        // These never change the map of objects.
        break;
      }
      case IrOpcode::kFinishRegion: {
        // FinishRegion renames the output of allocations, so we need
        // to update the {receiver} that we are looking for, if the
        // {receiver} matches the current {effect}.
        if (IsSame(receiver, effect)) receiver = GetValueInput(effect, 0);
        break;
      }
      case IrOpcode::kEffectPhi: {
        Node* control = GetControlInput(effect);
        if (control->opcode() != IrOpcode::kLoop) {
          DCHECK(control->opcode() == IrOpcode::kDead ||
                 control->opcode() == IrOpcode::kMerge);
          return kNoReceiverMaps;
        }

        // Continue search for receiver map outside the loop. Since operations
        // inside the loop may change the map, the result is unreliable.
        effect = GetEffectInput(effect, 0);
        result = kUnreliableReceiverMaps;
        continue;
      }
      default: {
        DCHECK_EQ(1, effect->op()->EffectOutputCount());
        if (effect->op()->EffectInputCount() != 1) {
          // Didn't find any appropriate CheckMaps node.
          return kNoReceiverMaps;
        }
        if (!effect->op()->HasProperty(Operator::kNoWrite)) {
          // Without alias/escape analysis we cannot tell whether this
          // {effect} affects {receiver} or not.
          result = kUnreliableReceiverMaps;
        }
        break;
      }
    }

    // Stop walking the effect chain once we hit the definition of
    // the {receiver} along the {effect}s.
    if (IsSame(receiver, effect)) return kNoReceiverMaps;

    // Continue with the next {effect}.
    DCHECK_EQ(1, effect->op()->EffectInputCount());
    effect = NodeProperties::GetEffectInput(effect);
  }
}

// static
bool NodeProperties::HasInstanceTypeWitness(JSHeapBroker* broker,
                                            Node* receiver, Node* effect,
                                            InstanceType instance_type) {
  ZoneHandleSet<Map> receiver_maps;
  NodeProperties::InferReceiverMapsResult result =
      NodeProperties::InferReceiverMaps(broker, receiver, effect,
                                        &receiver_maps);
  switch (result) {
    case NodeProperties::kUnreliableReceiverMaps:
    case NodeProperties::kReliableReceiverMaps:
      DCHECK_NE(0, receiver_maps.size());
      for (size_t i = 0; i < receiver_maps.size(); ++i) {
        MapRef map(broker, receiver_maps[i]);
        if (map.instance_type() != instance_type) return false;
      }
      return true;

    case NodeProperties::kNoReceiverMaps:
      return false;
  }
  UNREACHABLE();
}

// static
bool NodeProperties::NoObservableSideEffectBetween(Node* effect,
                                                   Node* dominator) {
  while (effect != dominator) {
    if (effect->op()->EffectInputCount() == 1 &&
        effect->op()->properties() & Operator::kNoWrite) {
      effect = NodeProperties::GetEffectInput(effect);
    } else {
      return false;
    }
  }
  return true;
}

// static
bool NodeProperties::CanBePrimitive(JSHeapBroker* broker, Node* receiver,
                                    Node* effect) {
  switch (receiver->opcode()) {
#define CASE(Opcode) case IrOpcode::k##Opcode:
    JS_CONSTRUCT_OP_LIST(CASE)
    JS_CREATE_OP_LIST(CASE)
#undef CASE
    case IrOpcode::kCheckReceiver:
    case IrOpcode::kConvertReceiver:
    case IrOpcode::kJSGetSuperConstructor:
    case IrOpcode::kJSToObject:
      return false;
    case IrOpcode::kHeapConstant: {
      HeapObjectRef value =
          HeapObjectMatcher(receiver).Ref(broker).AsHeapObject();
      return value.map().IsPrimitiveMap();
    }
    default: {
      // We don't really care about the exact maps here,
      // just the instance types, which don't change
      // across potential side-effecting operations.
      ZoneHandleSet<Map> maps;
      if (InferReceiverMaps(broker, receiver, effect, &maps) !=
          kNoReceiverMaps) {
        // Check if one of the {maps} is not a JSReceiver map.
        for (size_t i = 0; i < maps.size(); ++i) {
          MapRef map(broker, maps[i]);
          if (!map.IsJSReceiverMap()) return true;
        }
        return false;
      }
      return true;
    }
  }
}

// static
bool NodeProperties::CanBeNullOrUndefined(JSHeapBroker* broker, Node* receiver,
                                          Node* effect) {
  if (CanBePrimitive(broker, receiver, effect)) {
    switch (receiver->opcode()) {
      case IrOpcode::kCheckInternalizedString:
      case IrOpcode::kCheckNumber:
      case IrOpcode::kCheckSmi:
      case IrOpcode::kCheckString:
      case IrOpcode::kCheckSymbol:
      case IrOpcode::kJSToLength:
      case IrOpcode::kJSToName:
      case IrOpcode::kJSToNumber:
      case IrOpcode::kJSToNumberConvertBigInt:
      case IrOpcode::kJSToNumeric:
      case IrOpcode::kJSToString:
      case IrOpcode::kToBoolean:
        return false;
      case IrOpcode::kHeapConstant: {
        HeapObjectRef value =
            HeapObjectMatcher(receiver).Ref(broker).AsHeapObject();
        OddballType type = value.map().oddball_type();
        return type == OddballType::kNull || type == OddballType::kUndefined;
      }
      default:
        return true;
    }
  }
  return false;
}

// static
Node* NodeProperties::GetOuterContext(Node* node, size_t* depth) {
  Node* context = NodeProperties::GetContextInput(node);
  while (*depth > 0 &&
         IrOpcode::IsContextChainExtendingOpcode(context->opcode())) {
    context = NodeProperties::GetContextInput(context);
    (*depth)--;
  }
  return context;
}

// static
Type NodeProperties::GetTypeOrAny(Node* node) {
  return IsTyped(node) ? node->type() : Type::Any();
}

// static
bool NodeProperties::AllValueInputsAreTyped(Node* node) {
  int input_count = node->op()->ValueInputCount();
  for (int index = 0; index < input_count; ++index) {
    if (!IsTyped(GetValueInput(node, index))) return false;
  }
  return true;
}

// static
bool NodeProperties::IsInputRange(Edge edge, int first, int num) {
  if (num == 0) return false;
  int const index = edge.index();
  return first <= index && index < first + num;
}

// static
size_t NodeProperties::HashCode(Node* node) {
  size_t h = base::hash_combine(node->op()->HashCode(), node->InputCount());
  for (Node* input : node->inputs()) {
    h = base::hash_combine(h, input->id());
  }
  return h;
}

// static
bool NodeProperties::Equals(Node* a, Node* b) {
  DCHECK_NOT_NULL(a);
  DCHECK_NOT_NULL(b);
  DCHECK_NOT_NULL(a->op());
  DCHECK_NOT_NULL(b->op());
  if (!a->op()->Equals(b->op())) return false;
  if (a->InputCount() != b->InputCount()) return false;
  Node::Inputs aInputs = a->inputs();
  Node::Inputs bInputs = b->inputs();

  auto aIt = aInputs.begin();
  auto bIt = bInputs.begin();
  auto aEnd = aInputs.end();

  for (; aIt != aEnd; ++aIt, ++bIt) {
    DCHECK_NOT_NULL(*aIt);
    DCHECK_NOT_NULL(*bIt);
    if ((*aIt)->id() != (*bIt)->id()) return false;
  }
  return true;
}

}  // namespace compiler
}  // namespace internal
}  // namespace v8


text:
require 'rubygems'
require 'rails'
require 'json'
require 'active_support'
require 'action_pack'
require 'action_view'
require 'action_controller'
require 'action_view/template'

require 'spec_helper'

module ControllerTestHelpers

  def self.included(base)
    base.class_eval do

      include ActionView::Helpers,
              ActionView::Helpers::CaptureHelper,
              ActionView::Helpers::JavaScriptHelper,
              ActionView::Helpers::AssetTagHelper

      # allow tabs.create to run by stubbing an output_buffer
      attr_accessor :output_buffer
      @output_buffer = ""

      # stub content_for for testing
      def content_for(name, content = nil, &block)
        # this doesn't exist, and causes errors
        @_content_for = {} unless defined? @_content_for
        # we've got to initialize this, so we can concat to it
        @_content_for[name] = '' if @_content_for[name].nil?
        # now the rest is the same as in rails
        content = capture(&block) if block_given?
        @_content_for[name] << content if content
        @_content_for[name] unless content
      end
    end
  end

end


text:
lucid.html.factory=function(){
    this.hooks = {};
    this.defaults = {};
    this.hooks.javascript = function(jsToRun) {
        return eval(jsToRun);
    };
};

lucid.html.factory.prototype.addDefaults=function(instantiatorName, settings){
    if (typeof(this.defaults[instantiatorName]) == 'undefined') {
        this.defaults[instantiatorName] = {};
    }
    for (var key in settings) {
        this.defaults[instantiatorName][key] = settings[key];
    }
    return this;
};

lucid.html.factory.prototype.addHook=function(tags, action, callable){
    for (var i=0; i<tags.length; i++) {
        if (typeof(this.hooks[tags[i]+'__'+action]) != 'object') {
            this.hooks[tags[i]+'__'+action] = [];
        }
        this.hooks[tags[i]+'__'+action].push(callable);
    }
};

lucid.html.factory.prototype.setJavascriptHook=function(callable){
    this.hooks.javascript = callable;
};

lucid.html.factory.prototype.javascript=function(jsToRun) {
    return this.hooks.javascript(jsToRun);
};

lucid.html.factory.prototype.callHooks=function(tag, action)
{
    if (typeof(this.hooks[tag.instantiatorName+'__'+action]) == 'object') {
        for (var i=0; i<this.hooks[tag.instantiatorName+'__'+action].length; i++) {
            this.hooks[tag.instantiatorName+'__'+action][i](tag);
        }
    }
};

lucid.html.factory.prototype.build=function(tag){
    var obj;
    if (typeof(lucid.html.factory.tags[tag]) == 'function'){
        obj = new lucid.html.factory.tags[tag](this, tag);
    } else {
        obj = new lucid.html.tag(this, tag);
        obj.tag = tag;
    }

    if (typeof(this.defaults[tag]) == 'object') {
        for (var key in this.defaults[tag]) {
            obj.set(key, this.defaults[tag][key]);
        }
    }

    var newArgs = [];
    for (var i=1; i<arguments.length; i++) {
        newArgs.push(arguments[i]);
    }
    obj.setProperties(newArgs);

    this.callHooks(obj, 'create');
    return obj;
};

lucid.html.factory.tags = {};


text:
namespace remoting {

const char kOAuthMechanism[] = "X-OAUTH2";

buzz::StaticQName kXmppIqName = {"jabber:client", "iq"};

char kXmppBindNs[] = "urn:ietf:params:xml:ns:xmpp-bind";
buzz::StaticQName kXmppBindName = {kXmppBindNs, "bind"};
buzz::StaticQName kXmppJidName = {kXmppBindNs, "jid"};

buzz::StaticQName kJabberFeaturesName = {"http://etherx.jabber.org/streams",
                                         "features"};

char kXmppTlsNs[] = "urn:ietf:params:xml:ns:xmpp-tls";
buzz::StaticQName kStartTlsName = {kXmppTlsNs, "starttls"};
buzz::StaticQName kTlsProceedName = {kXmppTlsNs, "proceed"};

char kXmppSaslNs[] = "urn:ietf:params:xml:ns:xmpp-sasl";
buzz::StaticQName kSaslMechanismsName = {kXmppSaslNs, "mechanisms"};
buzz::StaticQName kSaslMechanismName = {kXmppSaslNs, "mechanism"};
buzz::StaticQName kSaslSuccessName = {kXmppSaslNs, "success"};

XmppLoginHandler::XmppLoginHandler(const std::string& server,
                                   const std::string& username,
                                   const std::string& auth_token,
                                   TlsMode tls_mode,
                                   Delegate* delegate)
    : server_(server),
      username_(username),
      auth_token_(auth_token),
      tls_mode_(tls_mode),
      delegate_(delegate),
      state_(State::INIT) {
}

XmppLoginHandler::~XmppLoginHandler() {
}

void XmppLoginHandler::Start() {
  switch (tls_mode_) {
    case TlsMode::NO_TLS:
      state_ = State::WAIT_STREAM_HEADER_AFTER_TLS;
      StartAuthHandshake();
      break;
    case TlsMode::WITH_HANDSHAKE:
      state_ = State::WAIT_STREAM_HEADER;
      StartStream("<starttls xmlns=\"urn:ietf:params:xml:ns:xmpp-tls\"/>");
      break;
    case TlsMode::WITHOUT_HANDSHAKE:
      // If <starttls> handshake is not required then start TLS right away.
      state_ = State::STARTING_TLS;
      delegate_->StartTls();
      break;
  }
}

void XmppLoginHandler::OnDataReceived(const std::string& data) {
  DCHECK(state_ != State::INIT && state_ != State::DONE &&
         state_ != State::ERROR);
  stream_parser_->AppendData(data);
}

void XmppLoginHandler::OnStanza(std::unique_ptr<buzz::XmlElement> stanza) {
  switch (state_) {
    case State::WAIT_STREAM_HEADER: {
      if (stanza->Name() == kJabberFeaturesName &&
          stanza->FirstNamed(kStartTlsName) != nullptr) {
        state_ = State::WAIT_STARTTLS_RESPONSE;
      } else {
        LOG(ERROR) << "Server doesn't support TLS.";
        OnError(SignalStrategy::PROTOCOL_ERROR);
      }
      break;
    }

    case State::WAIT_STARTTLS_RESPONSE: {
      if (stanza->Name() == kTlsProceedName) {
        state_ = State::STARTING_TLS;
        delegate_->StartTls();
      } else {
        LOG(ERROR) << "Failed to start TLS: " << stanza->Str();
        OnError(SignalStrategy::PROTOCOL_ERROR);
      }
      break;
    }

    case State::WAIT_STREAM_HEADER_AFTER_TLS: {
      buzz::XmlElement* mechanisms_element =
          stanza->FirstNamed(kSaslMechanismsName);
      bool oauth_supported = false;
      if (mechanisms_element) {
        for (buzz::XmlElement* element =
                 mechanisms_element->FirstNamed(kSaslMechanismName);
             element; element = element->NextNamed(kSaslMechanismName)) {
          if (element->BodyText() == kOAuthMechanism) {
            oauth_supported = true;
            break;
          }
        }
      }

      if (!oauth_supported) {
        LOG(ERROR) << kOAuthMechanism
                   << " auth mechanism is not supported by the server.";
        OnError(SignalStrategy::PROTOCOL_ERROR);
        return;
      }

      state_ = State::WAIT_AUTH_RESULT;
      break;
    }

    case State::WAIT_AUTH_RESULT: {
      if (stanza->Name() == kSaslSuccessName) {
        state_ = State::WAIT_STREAM_HEADER_AFTER_AUTH;
        StartStream(
            "<iq type=\"set\" id=\"0\">"
              "<bind xmlns=\"urn:ietf:params:xml:ns:xmpp-bind\">"
                "<resource>chromoting</resource>"
              "</bind>"
            "</iq>"
            "<iq type=\"set\" id=\"1\">"
              "<session xmlns=\"urn:ietf:params:xml:ns:xmpp-session\"/>"
            "</iq>");
      } else {
        OnError(SignalStrategy::AUTHENTICATION_FAILED);
      }
      break;
    }

    case State::WAIT_STREAM_HEADER_AFTER_AUTH:
      if (stanza->Name() == kJabberFeaturesName &&
          stanza->FirstNamed(kXmppBindName) != nullptr) {
        state_ = State::WAIT_BIND_RESULT;
      } else {
        LOG(ERROR) << "Server doesn't support bind after authentication.";
        OnError(SignalStrategy::PROTOCOL_ERROR);
      }
      break;

    case State::WAIT_BIND_RESULT: {
      buzz::XmlElement* bind = stanza->FirstNamed(kXmppBindName);
      buzz::XmlElement* jid = bind ? bind->FirstNamed(kXmppJidName) : nullptr;
      if (stanza->Attr(buzz::QName("", "id")) != "0" ||
          stanza->Attr(buzz::QName("", "type")) != "result" || !jid) {
        LOG(ERROR) << "Received unexpected response to bind: " << stanza->Str();
        OnError(SignalStrategy::PROTOCOL_ERROR);
        return;
      }
      jid_ = jid->BodyText();
      state_ = State::WAIT_SESSION_IQ_RESULT;
      break;
    }

    case State::WAIT_SESSION_IQ_RESULT:
      if (stanza->Name() != kXmppIqName ||
          stanza->Attr(buzz::QName("", "id")) != "1" ||
          stanza->Attr(buzz::QName("", "type")) != "result") {
        LOG(ERROR) << "Failed to start session: " << stanza->Str();
        OnError(SignalStrategy::PROTOCOL_ERROR);
        return;
      }
      state_ = State::DONE;
      delegate_->OnHandshakeDone(jid_, std::move(stream_parser_));
      break;

    default:
      NOTREACHED();
      break;
  }
}

void XmppLoginHandler::OnTlsStarted() {
  DCHECK(state_ == State::STARTING_TLS);
  state_ = State::WAIT_STREAM_HEADER_AFTER_TLS;
  StartAuthHandshake();
}

void XmppLoginHandler::StartAuthHandshake() {
  DCHECK(state_ == State::WAIT_STREAM_HEADER_AFTER_TLS);

  std::string cookie;
  base::Base64Encode(
      std::string("\0", 1) + username_ + std::string("\0", 1) + auth_token_,
      &cookie);
  StartStream(
      "<auth xmlns=\"" + std::string(kXmppSaslNs) + "\" "
             "mechanism=\"" +  "X-OAUTH2" + "\" "
             "auth:service=\"oauth2\" "
             "auth:allow-generated-jid=\"true\" "
             "auth:client-uses-full-bind-result=\"true\" "
             "auth:allow-non-google-login=\"true\" "
             "xmlns:auth=\"http://www.google.com/talk/protocol/auth\">" +
        cookie +
      "</auth>");
};

void XmppLoginHandler::OnParserError() {
  OnError(SignalStrategy::PROTOCOL_ERROR);
}

void XmppLoginHandler::StartStream(const std::string& first_message) {
  stream_parser_.reset(new XmppStreamParser());
  stream_parser_->SetCallbacks(
      base::Bind(&XmppLoginHandler::OnStanza, base::Unretained(this)),
      base::Bind(&XmppLoginHandler::OnParserError, base::Unretained(this)));
  delegate_->SendMessage("<stream:stream to=\"" + server_ +
                         "\" version=\"1.0\" xmlns=\"jabber:client\" "
                         "xmlns:stream=\"http://etherx.jabber.org/streams\">" +
                         first_message);
}

void XmppLoginHandler::OnError(SignalStrategy::Error error) {
  if (state_ != State::ERROR) {
    state_ = State::ERROR;
    delegate_->OnLoginHandlerError(error);
  }
}

}  // namespace remoting


text:
These logs are also available on GitHub: https://github.com/pivotal-energy-solutions/django-datatable-view/releases

## 0.9.0
This release officially supports Django 1.11, 2.0, and 2.1, and Python 2.7, 3.5, and 3.6.

#### Added TimeColumn
With support of the Django 2-series, we've added a missing TimeColumn to handle the built-in field.  In the future, we intend to look at new ways of handling built-in fields and column registration to minimize such issues.

#### Notes about the future
If you conform to the new Datatable object-style configuration system, having migrated away from legacy ``datatable_options`` dict syntax, you will be able to skip this release and move to 1.0 when it is made available.  0.9 and 1.0 will have parity at release, except that legacy syntaxes will be unrecognized in 1.0.

Please see the 0.9 migration guide provided below if you need help converting to 1.0-style configurations ahead of actually making the jump to 1.0:

https://django-datatable-view.readthedocs.io/en/latest/migration-guide.html

Please note that as of the time of this release, we do not have a live public demo server to interact with.  The example project is included in the release, however, which contains additional short examples and code for the various ways to configure and display a table.  Brief instructions for running that example project are found in the README.

## 0.9.0-beta.6

#### Streamlined ``datatableview.js`` API
We are now using the proper ``DataTable`` "modern" API from datatables.js.

The modern JS API changes the option names and query parameter names.  We've updated those as far as the server-side stuff is concerned, but you should check any options you send to the JS constructors to ensure they match the official, modern datatables API.

The global JS hook ``window.confirm_datatable_options()`` is one step closer to its removal.  ``datatableview.checkGlobalConfirmHook`` will default to true for the time being, which will signal the new hook ``datatableview.finalizeOptions(datatable, options)`` to check for the global hook.  In 1.1, ``checkGlobalConfirmHook`` will default to false, and in 1.2, ``checkGlobalConfirmHook`` will be removed entirely and ``finalizeOptions()`` will be an empty hook for you to do with as you please.

This update aliases names that followed Pythonic naming conventions so that things are more Javascripty:

* ``datatableview.auto_initialize`` to ``datatableview.autoInitialize``
* ``datatableview.make_xeditable`` to ``datatableview.makeXEditable``

The underscore names will be removed in 1.2, simultaneous to the removal of ``datatableview.checkGlobalConfirmHook`` and code for consulting the global hook ``window.confirm_datatable_options()``.

#### QuerySet Caching

An official set of options exists to do automatic queryset caching on a per-View, per-User basis.  For querysets that are a little too heavy for their own good, a caching strategy offers a straightforward optimization.  There's not a good way to fix a bad queryset, but something is better than nothing!

Once configured to use of your Django ``settings.CACHES``, you may opt in a datatable class to use caching via its ``Meta.cache_type`` setting.  Using the default ``cache_types.SIMPLE`` strategy, the queryset is placed directly in your cache for retrieval on subsequent requests.  If that isn't fast enough, you can use ``cache_types.PK_LIST`` instead, which runs your query once to get the pks of the objects and stores that in the cache.  Each request will have to run a ``WHERE `pk` IN (...)`` query but will be signficantly faster than evaluating the original queryset.

1. Set ``settings.DATATABLEVIEW_CACHE_BACKEND`` to an appropriate Django ``CACHES`` name.
2. Opt a python ``Datatable`` subclass into caching by setting ``Datatable.Meta.cache_type`` to one of the cache strategy constants importable at ``datatableview.datatables.cache_types``:
  * ``cache_types.SIMPLE`` (``'simple'``): Stores the view's queryset directly
  * ``cache_types.PK_LIST`` (``'pk_list'``): Stores only the list of pks from the view's queryset.  Each new request will re-query the database with a (hopefully) simpler ``WHERE `pk` IN (...)`` query.
  * ``cache_types.DEFAULT`` (``'default'``): Defers to ``settings.DATATABLEVIEW_DEFAULT_CACHE_TYPE`` for a cache strategy (which is ``SIMPLE`` by default).

Caching for a queryset is unique to the ``kwargs`` that come through the Datatable's ``get_cache_key_kwargs(self, **kwargs)``.  If you need to add or remove items from the dict, modify the dict returned from ``super()`` to suit your needs.

By default, only three items are in the dict:

* ``datatable_class``: The Datatable doing the caching
* ``view``: The view using the Datatable
* ``user``: The view's ``request.user``

## 0.9.0-beta.5
Refinements since 0.9.0-beta.4

* Dropped ``LegacyDatatableView``, renamed ``LegacyConfigurationDatatableView`` to ``LegacyDatatableView`` in its place.
* Added strategy for adding columns that are not registered.  This helps address the issue that columns meant only for some specific interpretations of some columns were being registered for ``CharField``s all over the lonely little planet.
* Added ``CompoundColumn`` to allow explicit use of unregistered column subclasses.
* Add import structure to support accessing the columns from within the ``datatables`` module, hopefully mimicking how ``django.forms`` allows something similar.
* Fixed long-outstanding issue with the column instances declared directly on a datatable being ignored in favor of re-discovering the column class and instantiating it from scratch at runtime.
* Big sphinx documentation updates.
* Removed documentation from live demo site about helpers in favor of linking to the sphinx docs.

## 0.9.0-beta.4
Refinements since 0.9.0-beta.3

Sphinx documentation and Travis CI are now public:

* http://django-datatable-view.readthedocs.org/en/latest/
* https://travis-ci.org/pivotal-energy-solutions/django-datatable-view

Fixes:

* Several issues with LegacyConfiguration innards (sorting, some column names raising unexpected exceptions before the intended exception could be raised)
* Imports for some versions of Django
* Removed forced ``sortable=False`` kwarg when no sources are given (this was causing issues with columns that are expected to be sortable based on processor output)
* Fixed hook lookup for per-column searches
* Changed when internal configuration takes place on a ``Datatable``

## 0.9.0-beta.3
Refinements since 0.9.0-beta.2

We've added Sphinx documentation that we intend to have pushed to readthedocs.org, which will serve as the new primary documentation source.  A new live demo site for 0.9 will be launched soon (we want to keep 0.8 around because of this transitionary period for new syntax), and it will continue to play an important role in providing short and sweet examples, but it's not always a perfect substitute for the actual module documentation.  The documentation is stored at ``django-datatable-view/docs/``, alongside the ``datatableview`` python module.

* Fixed sorting of non-db columns
* Addition of column getter for extra kwargs to be sent to its processor function
* Require column kwarg ``sortable=False`` when no sources are present
* Internal method renames
* ``helpers.through_filter`` renamed to ``helpers.make_processor``

## 0.9.0-beta.2
Refinements since 0.9.0-beta.1

#### New features

It turns out I forgot to reintroduce some old functionality in the new modern column format code, but it's back!

* Support for model fields that use ``choices``.  Specifically, we enable the user to search for the (case-insensitive) label of the various choices and the column will flip the search term to the right thing.  Fixed a bug in 0.8 choices support that made some assumptions that the choice db value was a string (using ``iexact`` too aggressively).
* ``strptime`` date formatting will attempt to parse individual numbers and strings for matches that satisfy format symbols, such as ``%y`` (two digit year) and ``%M`` (month names).

#### Fixes

* Fixed a bug with legacy configuration where a sources list defined as a ``list`` instead of a ``tuple`` would cause dictionary key issues. [43ade82]
* Fixed an issue with ``LegacyConfigurationDatatableView`` skipping the implicit processor discovery phase.  This will be removed in 1.0, but for 0.9 we will continue supporting implicit callbacks when the legacy view is in use. [88a0318]
* Fixed a bug with columns declaring multiple sources that each targeted a value across an m2m relationship, where sources after the first would attempt to inspect the ORM path starting on the model where the first source left off during its own lookup. [4f0af04]
* Fixed an issue with sending multiple column sources directly to the ``link_to_model`` helper, where the generated link text was a ``repr()`` of the source values list, instead of the default ``' '``-joined list of those values. [a27b6eb]
* Changed choices label matching to support partial matches.
* Changed choices label matching to allow multiple matches (since partial matching is now also allowed).  Previously there was a nuance that if two choices had the same label for whatever reason, it was undefined behavior which one would be selected to represent the database value in the converted search query.

## 0.9.0-beta.1
This is a transition release to get people to 1.0, which brings a lot of syntax changes for table declaration on the python view, adopting a strategy that looks a lot like Django's forms framework,
or django-rest-framework's serializers.

0.9 will continue to offer backwards-compatible datatable declaration with the help of a ``LegacyConfigurationDatatableView`` as a baseclass.  ``DatatableView`` will presume that the modern configuration style is being used and will raise errors accordingly.

``wheel`` installation is also possible now.

The live demo site at http://django-datatable-view.appspot.com will continue to operate WITHOUT this beta release, so experimenting with interactive documentation will require that you run the included example project, which includes a 0.9 migration guide.  See the main README.md for quick instructions to get the example project running locally.

## 0.8.2
#### Important future note
This is the last planned release for the 0.8 series!  0.9 and 1.0 will arrive simultaneously sometime during the next couple of weeks, and the entire declaration process for datatableview options has been modernized.

0.9 will include all of the existing "legacy" configuration code from the 0.8 releases, powered by brand new internals.  0.9 will be a no-fuss update, but if you plan to jump up to 1.0, you will need to following the forthcoming migration guide to get away from these "legacy" delcaration syntaxes.

#### Release notes

This release fixes a number of internal issues for newer versions of Django, most notably the tests!   With the introduction of Django's AppConfig system, the hack we've been using (keeping a testing-only app with testing-only models nested inside of the main datatableview app) was broken by a change concerning which app label Django thought the model belonged to.  The tests themselves were doing okay, had they not been failing during the fixture loading process.

@PamelaM has added initial support for including Travis testing into the repository, which is long overdue for a repository that has been gaining popularity over the last couple of years.  I will commit to keeping up with it since, as they sometimes say, an untested app is considered broken by default.

Another Django 1.7 bug with related model fields was fixed, also thanks to @PamelaM.

Other miscellaneous changes:

* The ``datatableview.utils.FIELD_TYPES`` dictionary is now a ``defaultdict(list)`` (@davidfischer-ch)
* PEP-8 spacing changes (@davidfischer-ch)
* Added a ``queryset.distinct()`` to get around some funny ``Q()`` math (@@davidfischer-ch)
* Added/fixed various utf-8 encoding declarations on source files (@davidfischer-ch)
* Preemptive fixes for Django 1.8 and 1.9 import locations (@greenbender)
* Corrected string coercion when ugettext strings were being used as the starting point for looking up a method name (@akx)

## 0.8.1
This release fixes a Django >=1.7 compatibility bug where ORM query lookups would traverse a m2m relationship and incorrectly discover the manager to be a callable value function.

A small translation fix was provided, a wasteful ``count()`` query removed, ``NullBooleanField`` is now added to the 'boolean' FIELD_TYPES, and we fixed a documentation typo that referred users to the wrong javascript callback name.

## 0.8.0
This release modifies the way model fields are detected for ORM queries when submitting a search.  Previously, the approach was primarily hard-coded to support only the core Django fields that served as base classes for all others, but this approach failed to provide any value for third-party fields that were built from scratch.

As of this release, ``datatableview.utils`` contains a dictionary ``FIELD_TYPES`` that contains keys for the major field categories, and maps each one to a list of fields that can be treated identically in ORM query terms.  This dictionary can be extended by importing it and appending new fields to a category.

The default registration dictionary looks like this:

```python
FIELD_TYPES = {
    'text': [models.CharField, models.TextField, models.FileField, models.GenericIPAddressField],
    'date': [models.DateField],
    'boolean': [models.BooleanField],
    'integer': [models.IntegerField, models.AutoField],
    'float': [models.FloatField, models.DecimalField],

    # No direct search ORM queries make sense against these field types
    'ignored': [models.ForeignKey],
}
```

If a field type used in a table but isn't found in any of these categories, the old familiar exception will be raised stating that it is an unhandled field type.  The correct solution is to import this registry and append the field class:

```python
from datatableview.utils import FIELD_TYPES
from netfields.fields import InetAddressField
FIELD_TYPES['text'].append(InetAddressField)
```

In the future, looking towards the full 1.0 release, we would like to offer a more sophistocated field type registration that allows the new field to also declare what unique ORM extensions it offers, in the way that a ``CharField`` offers ``__icontains``, or ``InetAddressField`` offers ``__net_contains``, etc.  Until 1.0, we will be limited to offering this simple registration that limits the field categories to those already listed.

## 0.7.3
This release fixes an exception that is raised when using Django 1.7 release candidate, involving the removal of the deprecated ``StrAndUnicode`` utility base class.

## 0.7.2
This release fixes an issue involving ``verbose_name`` values wrapped in a proxy function used by
Django to defer instantiation of an underlying object.  These proxy values could not go through the ``re`` framework without raising errors about "expecting a string or buffer".

## 0.7.1
This release reverts a change to the Javascript that could cause errors in some cases.  A fix will be reintroduced at a later time to correct a potential issue with Chrome and Safari not updating the footer text when a filter is applied.

The ``default_structure.html`` template has received a minor update to include the use of a CSS class ``"display"`` on the table, which how the datatables.js 1.10.0 version has begun to show examples on their documentation website, which gives the table a more modern default appearance.  The bootstrap template is unchanged.

A fix from @michaeldjeffrey should allow the browser's locale setting to control how the number of results is rendered in the table footer.

A fix from @danmac-uk has been merged that adds Django 1.7 support, because of our current use of Django's ``StrAndUnicode`` base class for the template-renderable datatable object.

Various updates were made to the example project including a fix for "None" table headers in the embedded table demo.

New issues are being tracked at the github repository and we're building our milestone goals for release 1.0.  We would like to include a streamlined strategy for column filters, an updated configuration strategy, and new callbacks to simplify support for datatables new ``"DT_RowData"`` key and modifying the internals of how special field types are handled for ORM querying.

## 0.7.0
This release adds Python 3 support with the help of the [six](http://pythonhosted.org/six/) project.  We've taken some time to verify that unicode handling is handled correctly for both Python 2 and 3 simultaneously.

The options provided by a DatatableView are processed and merged with incoming GET data from ajax calls, and the resulting object replaces the view's ``datatable_options`` attribute at runtime.  Previous to this release, that merged object implemented an attribute API to support lookups like ``options.search`` to get the search string.

As of this release, that attribute API has been removed for the sake of simplicity.  Treat ``options`` like a normal dictionary and use the keys and values it contains to read any options.  The only reason the object is a subclass of the base ``dict`` itself is to provide a constructor that accepts a GET query string and normalizes and validates options.  Other than the normalization phase, it is a dictionary, first and foremost.

## 0.6.5
This release fixes a bug with sorting columns backed by concrete db fields not on the local model.  The sorting operation would fail to recognize the field as concrete and would fall back to text-only sorting, which produced unexpected results.

## 0.6.4
This release adds incremental support for Python 3 (not completed yet, but the occational pull request comes in to help get things ready), and fixes a Python 2.6 compatibility issue with string formatting syntax.

The history of changes on each release has also been added to the code repository, available at ``django-datatable-view/CHANGELOG.md``.

## 0.6.3
This release fixes an issue with non-local fields sometimes raising errors when requested for sorting operations over ajax.

## 0.6.2
This release fixes a mistake that was made because the author was overconfident about the jQuery-dataTables API interchangeability.

The return value of the Javascript late initialization function ``datatableview.initialize()`` should now work like this:

```javascript
$(function(){
    var oTable = datatableview.initialize($(".datatable"));
});
```

Release 0.6.1 mistakenly returned an awkward set of nested arrays, leading to a need to re-call the ``dataTable()`` constructor, defeating the purpose of the return value as a convenience.

## 0.6.1
This release adds a return statement to the ``datatableview.initialize()`` javascript function that was added in version 0.6.0.  The returned value is the jQuery collection of objects that are the initialized ``oTable`` objects from the initialization process.  This should support multiple or single initializations with a uniform interaction.

## 0.6.0
This release makes a number of changes for the benefit of flexibility and future development.

#### utils.get_datatable_structure() and DatatableStructure

Unfortunately, I made a decision to reverse the 2nd and 3rd arguments of this utility function.  The only reason the model class was being sent to the utility at all was because of certain default conditions that, if options weren't specified (like a column list, or the preferred ordering), the internals could look up those details and fill them in.

The reality was that supplying the model here was 9 times out of 10 not required.  The argument has been moved to the end of the parameter list, and now accepts ``None`` as a default value, making the signature:

```python
get_datatable_structure(ajax_url, options, model=None)
```

The constructor to the internal context variable object ``DatatableStructure`` matches this signature.

#### Helpers

* ``format_date``: This helper used to have trouble with columns that were ``null=True``, and would likely raise an error, worse even when the ``localize=True`` argument was set.  The helper now aborts sooner in its rendering process if the value is ``None``, returning the blank string.
* ``through_filter``: A new helper that takes a simple callable mapping function (e.g., takes one argument, returns a new value), wrapping that target function so that it is compatible with use as a column callback.  Django template filters are good examples of target functions.  These can not be used directly as callbacks because they don't accept extra ``**kwargs`` that get sent by the caller.  This helper swallows those extra arguments so that the target function can do its work.
* ``itemgetter`` and ``attrgetter``: While still convenient shorthand, these aren't strictly necessary anymore.  ``through_filter`` can wrap the built-in ``operator.itemgetter`` and ``operator.attrgetter`` and accomplish the same thing.  ``itemgetter`` still supports an ``ellipsis="..."`` argument, but more robust behavior can probably be found using ``through_filter(django.template.defaultfilters.truncatechars)``.

#### datatableview.js

Automatic initialization of tables via a jQuery ``document.ready`` event is still enabled by default, but it can be turned off via a global object property.  If the following is executed after you include the ``datatableview.js`` file, but before the jQuery ready handler, no tables will be initialized:

```javascript
datatableview.auto_initialize = false;
```

In this scenario, you can do late initialization and option declaration on your own, using the same global object:

```javascript
var datatableOptions = {};
datatableview.initialize($(".mytable"), datatableOptions);
```

Note that all of the configuration options specified on the view are represented on the DOM in ``data-*`` attributes.  dataTables.js doesn't actually support these, but this ``datatableview.initialize`` function does.  This method of late binding can also replace the need to use the global javascript hook ``confirm_datatable_options`` to specify options for tables that were previously being auto-initialized.

#### Bootstrap integration

To make your life slightly easier, we've included a new template fragment at ``datatableview/bootstrap_structure.html``.  This inclusion template simply adds the Bootstrap-esque ``table striped-table bordered-table`` classes to the main ``<table>`` tag.

To use this template, you can either specify on your view's options ``datatable_options["structure_template"] = "datatableview/bootstrap_structure.html"``, or you can copy the contents of this file into your own overridden ``"datatableview/default_structure.html"`` as a starting point for customization.

#### Tests

This release adds a set of tests for the ``helpers`` and ``utils`` modules, and for the new example project's views.

#### Example project

http://django-datatable-view.appspot.com/ — This is a public instance of the new example project, which includes live demos, descriptions, and short code examples.

The goal of this example project is to replace the incredibly long-winded README that was previously the only real information resource.  While a Django-powered example project might feel more annoying to set up, it's the only way to provide actual live demos, instead of faking them and defeating the purpose of the exercise.

The new example project is included as part of the ``datatableview.tests`` module.  The easiest way to get it running on your own machine is to do something like this:

```bash
$ git clone https://github.com/pivotal-energy-solutions/django-datatable-view.git
$ cd django-datatable-view
$ mkvirtualenv datatableview
(datatableview)$ pip install -r requirements.txt
(datatableview)$ datatableview/tests/example_project/manage.py syncdb
(datatableview)$ datatableview/tests/example_project/manage.py runserver
```

This downloads the latest code, uses virtualenvwrapper to set up a new environment, and installs the basic requirements for the project (Django and python-dateutil).  After that, it's just a matter of sync-ing the sqlite3 database and running the dev server.

## Smaller things

Less important for the average use cases, but maybe good to know:

* Detection of the default column value sent to a helper has been improved.  If values were ``False``-like, they were sometimes ignored as not being present, which led to the helper trying to act upon the row's instance as a fallback value.  This usually didn't produce an intuitive result.
* Due to the above point, the ``key`` argument to a few of the helpers is facing removal sometime in the future.
* Minor parameter-passing bug with the new ``make_xeditable`` helper.
* Added a utility that normalizes field definitions to an internal format.  Unless there was a lot of modification of the ``DatatableView``'s internal methods for deriving column data, this change shouldn't have an outward impact.
* Fixed bug concerning default "show all columns" mode and no data appearing in the rows
* Fixed bug that prevented the same field from being represented in multiple columns.  The field was reduced to a dictionary mapping to column definitions, which resulted in dropping one at random.  All column definitions are now properly respected.
* Fixed bug with Django < 1.5 versions using the ``XEditableDatatableView``.  The asynchronous ajax updates failed due to the use of a Django 1.5 ``update_fields`` parameter to the ``save()`` method.  Django 1.5 will still attempt to use this option, but older versions will not.
* Fixed bug with status code in ``make_xeditable`` responses.

## 0.5.5
This release fixes a mistake in the ``format_date`` helper function that prevented it from returning the expected output in a non-``key`` usage.

Thanks to @foobar76 for raising the issue.

## 0.5.4
Addresses the following issues:

* #19 — Uses py3 ``collections.UserDict`` if possible
* #20 — Defer object_list pagination until serialization time, not in ``apply_queryset_options()``.
* #16 — Built-in support for [x-editable](http://vitalets.github.io/x-editable/) datatables.  See documentation for a new view base class [``XEditableDatatableView``](https://github.com/pivotal-energy-solutions/django-datatable-view#x-editable-datatables) and the new [``make_xeditable()``](https://github.com/pivotal-energy-solutions/django-datatable-view#make_xeditable) helper for details on how to get this working with minimal configuration.

A backwards-incompatible change has been made to the return value of ``get_object_list()`` and ``apply_queryset_options()``, and the parameter type of ``serialize_to_json()``.  The former two methods previously returned a 3-tuple of ``(object_list, total, filtered_total)``, and the latter method received this 3-tuple as a single argument.  This was not ideal, so the former two are now updated to return a list-like object, and the latter method now receives just the python dictionary to serialize.

A new method has been broken out of the ``DatatableView`` request-response workflow:

[get_json_response_object()](https://github.com/pivotal-energy-solutions/django-datatable-view#get_json_response_objectobject_list-total-filtered_total) — This method receives several arguments that will be placed into a dictionary.  If custom fields need to be added to the AJAX response object, you can implement this method, call ``super()`` to get the normal object, and then add to it:

```python
class MyDatatableView(DatatableView):
    datatable_options = { ... }
    def get_json_response_object(self, object_list, *args, **kwargs):
        data = super(MyDatatableView, self).get_json_response_object(object_list, *args, **kwargs)

        # Keep customizations JSON-compatible! :)
        data.update({
            'special_arg': self.kwargs['special_arg'],
        })
        return data
```

## 0.5.1
Addressed in this bugfix release:

* #17 'console' is undefined error in IE8
* #8 pypi integration? — packaging error excluded relevant package_data items from being included in an sdist release

## 0.5.0
This is the first PyPI-compatible release.


text:
namespace TwoIoc.Builders
{
    public interface IBuilder
    {
        object Build(object[] args);
    }
}


text:
package node

// The local instance of this node
type Agent struct {
}

func NewAgent() Agent {
	return Agent{}
}


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

namespace VehicleEffects
{
    /*
	 * This file contains the public plugin api code for Vehicle Effects. It would have been better to just put it in another class to begin
	 * with but I didn't so this will have to do as far as organizing things goes.
	 */
    public partial class VehicleEffectsMod
    {

        public delegate void OnVehicleUpdate();
        public static event OnVehicleUpdate eventVehicleUpdateStart;
        public static event OnVehicleUpdate eventVehicleUpdateFinished;

		private void OnVehicleUpdateStart()
        {
            try
            {
                eventVehicleUpdateStart?.Invoke();
            }
            catch(Exception e)
            {
                Logging.LogWarning("Caught an exception when running a VehicleUpdateStart event on a plugin\nThe exception was:");
                Logging.LogException(e);
            }
        }

		private void OnVehicleUpdateFinished()
        {
            try
            {
                eventVehicleUpdateFinished?.Invoke();
            }
            catch(Exception e)
            {
                Logging.LogWarning("Caught an exception when running a VehicleUpdateFinished event on a plugin\nThe exception was:");
                Logging.LogException(e);
            }
        }

        public static bool RegisterEffect(string name, EffectInfo effect, bool forceOverwrite = false)
        {
            if (!effectDictionary.ContainsKey(name))
            {
                effectDictionary.Add(name, effect);
                Logging.Log($"Added effect dictionary entry for {name}");
                return true;
            }
            else
            {
                Logging.LogWarning($"Overwriting effect dictionary entry for {name}");
                effectDictionary[name] = effect;
            }
            return false;
        }

        public static void UnregisterEffect(string name)
        {
            if (effectDictionary.Remove(name))
            {
                Logging.Log($"Removed effect dictionary entry for {name}");
            }
        }
    }
}


text:
import { describe, it } from 'flow-typed-test';
import type { Logger, Levels, NpmLogLevels, Profiler, Info } from 'winston';

describe('profiler', () => {
  describe('profile method', () => {
    it('should accept name string param', <T: Levels>(logger: Logger<T>) => {
      logger.profile('test');
      // $FlowExpectedError
      logger.profiler(1);
      // $FlowExpectedError
      logger.profiler();
    });

    it('should accept valid level option', (logger: Logger<NpmLogLevels>) => {
      logger.profile('test', { level: 'debug' });
      logger.profile('test', { level: 'debug', message: 'hello', extra: 'some-value' });
      // $FlowExpectedError
      logger.profiler('test', { level: 'no-a-level' });
    });
  });

  describe('startTimer', (logger: Logger<NpmLogLevels>) => {
    it('should return a Profiler instance', () => {
      const profiler: Profiler<NpmLogLevels> = logger.startTimer();
      // $FlowExpectedError
      const invalidProfilerLevels: Profiler<{ nope: number, ... }> = logger.startTimer();
    });
  });

  describe('Profiler instance', (profiler: Profiler<NpmLogLevels>) => {
    it('should done method should accept InfoObject', (info: Info<NpmLogLevels>) => {
      profiler.done(info);
      const invalidInfoLevels: Info<{ nope: number, ... }> = { level: 'nope', message: 'hello' };
      // $FlowExpectedError
      profiler.done(invalidInfoLevels);
    });
  })
});


text:
Service components in ngResource

        Name
        Description

        $resource

A factory which creates a resource object that lets you interact with
RESTful server-side data sources.


text:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;

namespace Immerseum {
    namespace VRSimulator {
        /// <summary>
        ///   <para>Represents a virtual $$Touch$$ button accessible through the <see cref="!:https://www.assetstore.unity3d.com/en/#!/content/32647">SteamVR Plugin for Unity</see>, specifically
        /// for input devices that are supported by SteamVR but are not supported in the <see cref="!:https://docs.unity3d.com/Manual/class-InputManager.html">Unity Input Manager</see>.</para>
        ///   <para>By including this Input Button in an <see cref="InputAction" />, you associate the input device with the action that you want the user's input to evoke.</para>
        /// </summary>
        public class SteamVRTouch : SteamVRButton {
            public override bool isHeld {
                get {
                    if (HMDSimulator.isTrackingHands && isOutOfRange == false) {
                        return SteamVR_Controller.Input(deviceIndex).GetTouch(buttonMask);
                    }
                    return false;
                }
            }

            public override bool isPressed {
                get {
                    if (HMDSimulator.isTrackingHands && isOutOfRange == false) {
                        return SteamVR_Controller.Input(deviceIndex).GetTouchDown(buttonMask);
                    }
                    return false;
                }
            }

            public override bool isReleased {
                get {
                    if (HMDSimulator.isTrackingHands && isOutOfRange == false) {
                        return SteamVR_Controller.Input(deviceIndex).GetTouchUp(buttonMask);
                    }
                    return false;
                }
            }
        }
    }
}


text:
Ext.define('CF.store.Provider', {
  extend: 'Ext.data.Store',
  model: 'CF.model.Provider',
});


text:
    <pie-chart></pie-chart>

  <ba-card class="col-xlg-6 col-xl-6 col-lg-12 col-sm-12 col-12"
           cardTitle="Last five months paid" baCardClass="medium-card">
    <line-chart></line-chart>
  </ba-card>
  <ba-card class="col-xlg-6 col-xl-6 col-lg-12 col-sm-12 col-12"
           baCardClass="popular-app medium-card" cardTitle="Last five months expense">
    <bar-chart></bar-chart>
  </ba-card>

  <ba-card class="col-xlg-3 col-lg-6 col-md-12 col-sm-12 col-12" cardTitle="dashboard.todo_list"
           baCardClass="xmedium-card feed-comply-panel with-scroll todo-panel">
    <todo></todo>
  </ba-card>
  <ba-card class="col-xlg-6 col-lg-6 col-md-12 col-sm-12 col-12" cardTitle="dashboard.calendar"
           baCardClass="xmedium-card feed-comply-panel with-scroll calendar-panel">
    <calendar></calendar>
  </ba-card>


text:
package com.everypay.sdk.model;

import android.text.TextUtils;

import com.everypay.sdk.R;

public enum CardType {

    // Based on http://en.wikipedia.org/wiki/Bank_card_number#Issuer_identification_number_.28IIN.29
    AMERICAN_EXPRESS(R.drawable.ep_bt_amex, "American Express", 15, "34", "37"),
    DISCOVER(R.drawable.ep_bt_discover, "Discover", 16, "60", "62", "64", "65"),
    JCB(R.drawable.ep_bt_jcb, "JCB", 16, "35"),
    DINERS_CLUB(R.drawable.ep_bt_diners, "Diners Club", 14, "300", "301", "302", "303", "304", "305", "309", "36", "38", "37", "39"),
    VISA(R.drawable.ep_bt_visa, "Visa", 16, "4"),
    MASTERCARD(R.drawable.ep_bt_mastercard, "Mastercard", 16, "50", "51", "52", "53", "54", "55"),
    UNKNOWN(-1, "Unknown", 16);

    public static final int INVALID_ICON = -1;

    private int iconId;
    private String displayName;
    private int length;
    private String[] prefixes;

    CardType(int iconId, String displayName, int length, String... prefixes) {
        this.iconId = iconId;
        this.displayName = displayName;
        this.length = length;
        this.prefixes = prefixes;
    }

    public int getIconId() {
        return iconId;
    }

    public int getLength() {
        return length;
    }

    public static CardType byPrefixOf(String number) {
        if (TextUtils.isEmpty(number))
            return UNKNOWN;
        for (CardType type : CardType.values()) {
            if (type.prefixes != null && type.prefixes.length > 0) {
                for (String prefix : type.prefixes) {
                    if (number.startsWith(prefix))
                        return type;
                }
            }
        }
        return UNKNOWN;
    }

    @Override
    public String toString() {
        return displayName;
    }
}


text:
<?php

class RestUtils {

    public static function processRequest()
    {
        $request_method = strtolower($_SERVER['REQUEST_METHOD']);
        $return_obj     = new RestRequest();
        $data           = array();

        switch ($request_method) {
            // gets are easy...
            case 'get':
                $data = $_GET;
                break;
            // so are posts
            case 'post':
                $data = $_POST;
                break;
            // here's the tricky bit...
            case 'put':
                // basically, we read a string from PHP's special input location,
                // and then parse it out into an array via parse_str... per the PHP docs:
                // Parses str  as if it were the query string passed via a URL and sets
                // variables in the current scope.
                parse_str(file_get_contents('php://input'), $put_vars);
                $data = $put_vars;
                break;
        }

        return $data;
    }

    public static function sendResponse($status = 200, $body = '', $content_type = 'text/html')
    {

        $status_header = 'HTTP/1.1 ' . $status . ' ' . RestUtils::getStatusCodeMessage($status);
        // set the status
        header($status_header);
        // set the content type
        header('Content-type: ' . $content_type);

        // pages with body are easy
        if($body != '')
        {
            // send the body
            echo $body;
            exit;
        }
        // we need to create the body if none is passed
        else
        {
            // create some body messages
            $message = '';

            // this is purely optional, but makes the pages a little nicer to read
            // for your users.  Since you won't likely send a lot of different status codes,
            // this also shouldn't be too ponderous to maintain
            switch($status)
            {
                case 401:
                    $message = 'You must be authorized to view this page.';
                    break;
                case 404:
                    $message = 'The requested URL ' . $_SERVER['REQUEST_URI'] . ' was not found.';
                    break;
                case 500:
                    $message = 'The server encountered an error processing your request.';
                    break;
                case 501:
                    $message = 'The requested method is not implemented.';
                    break;
            }

            // servers don't always have a signature turned on (this is an apache directive "ServerSignature On")
            $signature = ($_SERVER['SERVER_SIGNATURE'] == '') ? $_SERVER['SERVER_SOFTWARE'] . ' Server at ' . $_SERVER['SERVER_NAME'] . ' Port ' . $_SERVER['SERVER_PORT'] : $_SERVER['SERVER_SIGNATURE'];

            // this should be templatized in a real-world solution
            $body = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

                                <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
                                <title>' . $status . ' ' . RestUtils::getStatusCodeMessage($status) . '</title>

' . RestUtils::getStatusCodeMessage($status) . '

' . $message . '

                                <address>' . $signature . '</address>

                        ';

            echo $body;
            exit;
        }
    }

    public static function getStatusCodeMessage($status)
    {
        // these could be stored in a .ini file and loaded
        // via parse_ini_file()... however, this will suffice
        // for an example
        $codes = Array(
            100 => 'Continue',
            101 => 'Switching Protocols',
            200 => 'OK',
            201 => 'Created',
            202 => 'Accepted',
            203 => 'Non-Authoritative Information',
            204 => 'No Content',
            205 => 'Reset Content',
            206 => 'Partial Content',
            300 => 'Multiple Choices',
            301 => 'Moved Permanently',
            302 => 'Found',
            303 => 'See Other',
            304 => 'Not Modified',
            305 => 'Use Proxy',
            306 => '(Unused)',
            307 => 'Temporary Redirect',

            # Below are the custom response codes
            308 => 'Invalid Parameters Sent',
            309 => 'Invalid or Absent Referer',
            310 => 'AppKey Invalid',
            311 => 'Code Interrupt',
            312 => 'Application Not Registered',
			313 => 'No Receiver Email Addresses Provided',
			314 => 'Request does not include an appkey',

            # Continue with the normal response codes
            400 => 'Bad Request',
            401 => 'Unauthorized',
            402 => 'Payment Required',
            403 => 'Forbidden',
            404 => 'Not Found',
            405 => 'Method Not Allowed',
            406 => 'Not Acceptable',
            407 => 'Proxy Authentication Required',
            408 => 'Request Timeout',
            409 => 'Conflict',
            410 => 'Gone',
            411 => 'Length Required',
            412 => 'Precondition Failed',
            413 => 'Request Entity Too Large',
            414 => 'Request-URI Too Long',
            415 => 'Unsupported Media Type',
            416 => 'Requested Range Not Satisfiable',
            417 => 'Expectation Failed',
            500 => 'Internal Server Error',
            501 => 'Not Implemented',
            502 => 'Bad Gateway',
            503 => 'Service Unavailable',
            504 => 'Gateway Timeout',
            505 => 'HTTP Version Not Supported'
        );

        return (isset($codes[$status])) ? $codes[$status] : '';
    }

}