text:
/*
 * Author: tdanford
 * Date: Nov 15, 2008
 */
package edu.psu.compbio.seqcode.gse.utils.graphs;

import java.io.*;
import java.util.*;

import edu.psu.compbio.seqcode.gse.utils.Pair;
import edu.psu.compbio.seqcode.gse.utils.datastructures.Heap;

public class WeightedAlgorithms extends Algorithms {

	public static void main(String[] args) {
		//dijkstra_test(args);
		//bellman_ford_test(args);
		floyd_warshall_test(args);
	}

	public static void floyd_warshall_test(String[] args) {
		WeightedGraph wg = figure_26_1();

		WeightedAlgorithms algs = new WeightedAlgorithms(wg);
		WeightedGraph[] paths = algs.floydWarshall();

		String[] vertices = algs.vertices;
		int source = 1, target = 0;

		Pair<List<String>,Double> pathpair = algs.parsePathTree(paths[source], vertices[target]);
		System.out.println(String.format("%s -> %s", vertices[source], vertices[target]));
		System.out.println(String.format("Weight: %f", pathpair.getLast()));
		System.out.println(String.format("Path: %s", pathpair.getFirst()));
	}

	/**
	 * Tests the Bellman-Ford implementation using the example from CLRS page 589 (Figure 24.4).
	 *
	 * @param args
	 */
	public static void bellman_ford_test(String[] args) {
		WeightedGraph wg = figure_24_4();
		String source = "s", target = "z";

		WeightedAlgorithms algs = new WeightedAlgorithms(wg);
		WeightedGraph paths = algs.bellmanFord(source);

		Pair<List<String>,Double> pathpair = algs.parsePathTree(paths, target);
		System.out.println(String.format("%s -> %s", source, target));
		System.out.println(String.format("Weight: %f", pathpair.getLast()));
		System.out.println(String.format("Path: %s", pathpair.getFirst()));
	}

	/**
	 * Runs, as a test of the dijkstra implementation, the example from CLRS on page 596 of
	 * the 2nd edition.
	 *
	 * @param args
	 */
	public static void dijkstra_test(String[] args) {
		DirectedWeightedGraph wg = figure_25_5();
		String source = "s", target = "x";

		WeightedAlgorithms algs = new WeightedAlgorithms(wg);
		WeightedGraph paths = algs.dijkstra(source);

		Pair<List<String>,Double> pathpair = algs.parsePathTree(paths, target);
		System.out.println(String.format("%s -> %s", source, target));
		System.out.println(String.format("Weight: %f", pathpair.getLast()));
		System.out.println(String.format("Path: %s", pathpair.getFirst()));
	}

	private WeightedGraph graph;
	private String[] vertices;

	public WeightedAlgorithms(WeightedGraph g) {
		super(g);
		graph = g;
		vertices = graph.getVertices().toArray(new String[0]);
		Arrays.sort(vertices);
	}

	/**
	 * A utility method, for manipulating weighted path-tree objects (which are
	 * represented as WeightedGraphs in this implementation).
	 *
	 * For a given tree and a given "target" node, this method will follow links in the
	 * path tree back to the root -- this gives the shortest path (in reverse order, of course)
	 * of the path from root --> target in the original graph.
	 *
	 * This method also returns the ultimate weight of that (shortest) path.
	 *
	 * @param g The path-tree, which must have been calculated with respect to a given source.
	 * @param target The ultimate target in the graph.
	 * @return
	 */
	public Pair<List<String>, Double> parsePathTree(WeightedGraph g, String target) {
		LinkedList<String> path = new LinkedList<String>();
		Double weight = g.weight(target);

		while(target != null) {
			path.addFirst(target);
			Set<String> nbs = g.getNeighbors(target);
			Iterator<String> itr = nbs.iterator();
			target = itr.hasNext() ? itr.next() : null;
		}

		return new Pair<List<String>,Double>(path, weight);
	}

	/**
	 * Performs the Floyd-Warshall all-pairs shortest-paths algorithm.  Returns an array of path
	 * tree matrices.
	 * @return A path-tree matrix, where matrix[i] is the path-tree for paths originating from vertices[i].
	 */
	public WeightedGraph[] floydWarshall() {

		DirectedWeightedGraph[][] karray = new DirectedWeightedGraph[][] {
				createFloydWarshallMatrix(),
				createFloydWarshallMatrix()
		};

		System.out.println("Init:");
		printFloydWarshallMatrix(karray[0], System.out);

		int thisk = 0, lastk = 0;
		for(int k = 1; k <= vertices.length; k++) {
			thisk = k % 2;
			lastk = 1-thisk;

			floydWarshallStep(k-1, karray[thisk], karray[lastk]);

			System.out.println(String.format("%d:", k));
			printFloydWarshallMatrix(karray[thisk], System.out);
		}

		WeightedGraph[] finalMatrix = new WeightedGraph[karray[0].length];
		for(int i = 0; i < karray[0].length; i++) {
			finalMatrix[i] = karray[thisk][i];
		}

		return finalMatrix;
	}

	public void printFloydWarshallMatrix(DirectedWeightedGraph[] karray, PrintStream ps) {
		for(int j = 0; j < vertices.length; j++) {
			ps.print(String.format("\t%s", vertices[j]));
		}
		ps.println();

		for(int i = 0; i < karray.length; i++) {
			ps.print(vertices[i]);
			for(int j = 0; j < vertices.length; j++) {
				Double w = karray[i].weight(vertices[j]);
				String wstr = w != null ? String.format("%.1f", w) : "*";
				ps.print(String.format("\t%s", wstr));
			}

			ps.println();
		}
	}

	private void floydWarshallStep(int k, DirectedWeightedGraph[] thisK, DirectedWeightedGraph[] lastK) {
		for(int i = 0; i < vertices.length; i++) {
			for(int j = 0; j < vertices.length; j++) {

				String lastPath = lastK[i].chooseNeighbor(vertices[j]);
				Double lastWeight = lastPath != null ? graph.weight(lastPath, vertices[j]) : null;

				thisK[i].removeEdges(vertices[j]);

				Double dij = lastK[i].weight(vertices[j]);

				Double dik = lastK[i].weight(vertices[k]);
				Double dkj = lastK[k].weight(vertices[j]);
				Double ikjWeight = add(dik, dkj);

				Boolean isBetter = lessThan(ikjWeight, dij);

				if(isBetter) {
					thisK[i].addWeightedEdge(vertices[j], vertices[k], graph.weight(vertices[k], vertices[j]));
					thisK[i].setWeight(vertices[j], ikjWeight);
				} else if (lastPath != null) {
					thisK[i].addWeightedEdge(vertices[j], lastPath, lastWeight);
					thisK[i].setWeight(vertices[j], dij);
				}
			}
		}
	}

	private Double add(Double v1, Double v2) {
		return v1 == null || v2 == null ? null : v1 + v2;
	}

	private Boolean lessThan(Double v1, Double v2) {
		if(v1 == null) {
			return false;
		} else if (v2 == null) {
			return true;
		} else {
			return v1 < v2;
		}
	}

	private DirectedWeightedGraph[] createFloydWarshallMatrix() {
		DirectedWeightedGraph[] matrix = new DirectedWeightedGraph[vertices.length];
		for(int i = 0; i < vertices.length; i++) {
			matrix[i] = new DirectedWeightedGraph(null);
			for(int j = 0; j < vertices.length; j++) {
				matrix[i].addVertex(vertices[j]);
			}

			for(int j = 0; j < vertices.length; j++) {
				if(i == j) {
					matrix[i].setWeight(vertices[j], 0.0);
				} else if (graph.isNeighbor(vertices[i], vertices[j])) {
					Double w = graph.weight(vertices[i], vertices[j]);

					matrix[i].setWeight(vertices[j], w);
					matrix[i].addWeightedEdge(vertices[j], vertices[i], w);
				}
			}
		}
		return matrix;
	}

	public WeightedGraph bellmanFord(String source) {

		if(!graph.getVertices().contains(source)) {
			throw new IllegalArgumentException(source);
		}
		DirectedWeightedGraph pathtree = initializePathTree();
		pathtree.setWeight(source, 0.0);
		boolean hasNegativeLoop = false;

		int V = graph.getVertices().size();

		for(int i = 0; i < V-1; i++) {
			for(String n1 : graph.getVertices()) {
				for(String n2 : graph.getNeighbors(n1)) {
					double w = graph.weight(n1, n2);
					relax(pathtree, n1, n2, w);
				}
			}
		}

		outerLoop: for(String u : graph.getVertices()) {
			double du = pathtree.weight(u);
			for(String v : graph.getNeighbors(u)) {
				double dv = pathtree.weight(v);
				if(dv > du + graph.weight(u, v)) {
					hasNegativeLoop = true;
					break outerLoop;  // ends the outer-most for loop.
				}
			}
		}

		return hasNegativeLoop ? null : pathtree;
	}

	/**
	 * Returns a weighted graph of shortest-path links.
	 *
	 * For a given v2 \in G = dijkstra(v1), the
	 * weight(v2) in G is the weight of the shortest path v1 -> v2.
	 *
	 * Furthermore, v2 has exactly one neighbor in G, v3, which is the previous
	 * node on that shortest path from v2 back to v2.  The weight(v2, v3) is the
	 * weight of the edge v3->v2 in the *original* graph which is on that shortest path.
	 *
	 * dijkstra() throws an IllegalArgumentException if it encounters a negative-weight edge.
	 *
	 * @param source The source node in the original graph.
	 * @return The weighted path-tree.
	 */
	public WeightedGraph dijkstra(String source) {

		if(!graph.getVertices().contains(source)) {
			throw new IllegalArgumentException(source);
		}

		DirectedWeightedGraph pathtree = initializePathTree();
		pathtree.setWeight(source, 0.0);

		Heap<WeightedNode> Q = new Heap<WeightedNode>(-1);
		for(String vertex : pathtree.getVertices()) {
			Q.insert(new WeightedNode(vertex, pathtree.weight(vertex)));
		}

		while(Q.size() > 0) {
			//System.out.println(String.format("\nQ: %s", Q.asList().toString()));
			WeightedNode u = Q.removeFirst();
			//System.out.println(String.format("u: %s", u.toString()));
			if(u.weight == null) {
				// The rest of the graph is unconnected -- so we just return the pathtree.
				return pathtree;
			} else {
				for(String v : graph.getNeighbors(u.node)) {
					Double w = graph.weight(u.node, v);
					if(w < 0.0) {
						// Dijkstra's algorithm doesn't work, when there are negative weight edges.
						throw new IllegalArgumentException(String.format("%s->%s has negative weight %f",
								u.node, v, w));
					}
					relax(Q, pathtree, u, v, w);
				}
			}
		}

		return pathtree;
	}

	/**
	 * This is totally ugly.
	 *
	 * The RELAX() method described in CLRS is actually tricky --
	 * it requires an (implicit) update of the Q heap, and that requires knowing where each
	 * old key was in the heap so we can call increaseKey() on it ... so I do that here with a
	 * linear search through the heap (implemented in the increase() method, in Heap.java), but
	 * this is probably sub-optimal... sigh.
	 *
	 * @param Q See the note above.
	 * @param pathtree  Stores the 'd' and 'pi' variables from CLRS, implicitly.
	 * @param u
	 * @param v
	 * @param w
	 */
	private void relax(Heap<WeightedNode> Q, DirectedWeightedGraph pathtree,
			WeightedNode u, String v, Double w) {

		Double uweight = pathtree.weight(u.node);
		Double oldvweight = pathtree.weight(v);
		Double newvweight = uweight != null ? uweight + w : null;

		WeightedNode oldvn = new WeightedNode(v, oldvweight);
		WeightedNode newvn = new WeightedNode(v, newvweight);

		if(newvn.compareTo(oldvn) == -1) {
			for(String nn : pathtree.getNeighbors(v)) {
				pathtree.removeEdge(v, nn);
			}

			pathtree.addEdge(v, u.node);
			pathtree.setWeight(v, newvweight);
			pathtree.setWeight(v, u.node, w);

			//System.out.println(String.format("%s => %s", oldvn.toString(), newvn.toString()));
			Q.increase(oldvn, newvn);
		}
	}

	private void relax(DirectedWeightedGraph pathtree, String u, String v, Double w) {
		Double uweight = pathtree.weight(u);
		Double oldvweight = pathtree.weight(v);
		Double newvweight = uweight != null ? uweight + w : null;

		if(newvweight == null) { return; }

		if(oldvweight == null || newvweight < oldvweight) {
			for(String nn : pathtree.getNeighbors(v)) {
				pathtree.removeEdge(v, nn);
			}

			pathtree.addEdge(v, u);
			pathtree.setWeight(v, newvweight);
			pathtree.setWeight(v, u, w);
		}
	}

	private DirectedWeightedGraph initializePathTree() {
		DirectedWeightedGraph tree = new DirectedWeightedGraph(null);
		for(String node : graph.getVertices()) {
			tree.addVertex(node);
		}
		return tree;
	}

	private class WeightedNode implements Comparable<WeightedNode> {

		public String node;
		public Double weight;  // a null weight will represent 'infinity.'

		public WeightedNode(String n, Double w) {
			node = n; weight = w;
		}

		public WeightedNode(String n) {
			node = n;
			weight = null;
		}

		public String toString() {
			if(weight != null) {
				return String.format("%s (%.2f)", node, weight);
			} else {
				return String.format("%s (inf)", node);
			}
		}

		public int compareTo(WeightedNode n) {
			if(weight != null || n.weight != null) {
				if(weight != null && n.weight != null) {
					if(weight < n.weight) { return -1; }
					if(weight > n.weight) { return 1; }
				} else {
					if(weight == null) { return 1; }
					if(n.weight == null) { return -1; }
				}
			}
			//return node.compareTo(n.node);
			return 0;
		}

		public int hashCode() {
			return node.hashCode();
		}

		public boolean equals(Object o) {
			if(!(o instanceof WeightedNode)) { return false; }
			WeightedNode w = (WeightedNode)o;
			return w.node.equals(node);
		}
	}

	/**
	 * The example from CLRS, used to illustrate Dijkstra's Algorithm.
	 * @return
	 */
	public static DirectedWeightedGraph figure_25_5() {
		DirectedWeightedGraph wg = new DirectedWeightedGraph(1.0);
		wg.addVertex("s");
		wg.addVertex("t");
		wg.addVertex("x");
		wg.addVertex("y");
		wg.addVertex("z");
		wg.addWeightedEdge("s", "t", 10.0);
		wg.addWeightedEdge("s", "y", 5.0);
		wg.addWeightedEdge("t", "y", 2.0);
		wg.addWeightedEdge("y", "t", 3.0);
		wg.addWeightedEdge("y", "x", 9.0);
		wg.addWeightedEdge("t", "x", 1.0);
		wg.addWeightedEdge("y", "z", 2.0);
		wg.addWeightedEdge("x", "z", 4.0);
		wg.addWeightedEdge("z", "x", 6.0);
		wg.addWeightedEdge("z", "s", 7.0);

		return wg;
	}

	public static WeightedGraph figure_26_1() {
		DirectedWeightedGraph wg = new DirectedWeightedGraph(null);

		wg.addVertex("1");
		wg.addVertex("2");
		wg.addVertex("3");
		wg.addVertex("4");
		wg.addVertex("5");

		wg.addWeightedEdge("1", "5", -4.0);
		wg.addWeightedEdge("1", "2", 3.0);
		wg.addWeightedEdge("1", "3", 8.0);
		wg.addWeightedEdge("2", "5",  7.0);
		wg.addWeightedEdge("2", "4", 1.0);
		wg.addWeightedEdge("3", "2", 4.0);
		wg.addWeightedEdge("4", "3", -5.0);
		wg.addWeightedEdge("4", "1", 2.0);
		wg.addWeightedEdge("5", "4", 6.0);

		return wg;
	}

	public static WeightedGraph figure_24_4() {
		DirectedWeightedGraph wg = new DirectedWeightedGraph(null);
		wg.addVertex("s");
		wg.addVertex("t");
		wg.addVertex("x");
		wg.addVertex("y");
		wg.addVertex("z");
		wg.addWeightedEdge("s", "t", 6.0);
		wg.addWeightedEdge("s", "y", 7.0);
		wg.addWeightedEdge("t", "y", 8.0);
		wg.addWeightedEdge("t", "x", 5.0);
		wg.addWeightedEdge("t", "z", -4.0);
		wg.addWeightedEdge("y", "x", -3.0);
		wg.addWeightedEdge("y", "z", 9.0);
		wg.addWeightedEdge("x", "t", -2.0);
		wg.addWeightedEdge("z", "s", 2.0);
		wg.addWeightedEdge("z", "x", 7.0);

		return wg;
	}
}


text:
import { injectable, inject } from 'inversify';
import { QuickCommandService } from './quick-command-service';
import { Command, CommandRegistry, CommandContribution, KeybindingRegistry, KeybindingContribution } from '../../common';

export const quickCommand: Command = {
    id: 'quickCommand',
    label: 'Quick Command'
};

@injectable()
export class QuickCommandFrontendContribution implements CommandContribution, KeybindingContribution {

    @inject(QuickCommandService)
    protected readonly quickCommandService: QuickCommandService;

    registerCommands(commands: CommandRegistry): void {
        commands.registerCommand(quickCommand, {
            execute: () => this.quickCommandService.open()
        });
    }

    registerKeybindings(keybindings: KeybindingRegistry): void {
        keybindings.registerKeybinding({
            command: quickCommand.id,
            keybinding: "f1"
        });
        keybindings.registerKeybinding({
            command: quickCommand.id,
            keybinding: "ctrlcmd+shift+p"
        });
    }

}

redpajama_set_name: RedPajamaGithub


text:
package com.intellij.ide.util;

import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Condition;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiFile;
import com.intellij.psi.search.GlobalSearchScope;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public class TreeClassChooserFactoryImpl extends TreeClassChooserFactory {
  private final Project myProject;

  public TreeClassChooserFactoryImpl(@NotNull Project project) {
    myProject = project;
  }

  @NotNull
  public TreeClassChooser createWithInnerClassesScopeChooser(String title,
                                                             GlobalSearchScope scope,
                                                             final ClassFilter classFilter,
                                                             PsiClass initialClass) {
    return TreeJavaClassChooserDialog.withInnerClasses(title, myProject, scope, classFilter, initialClass);
  }

  @NotNull
  public TreeClassChooser createNoInnerClassesScopeChooser(String title,
                                                           GlobalSearchScope scope,
                                                           ClassFilter classFilter,
                                                           PsiClass initialClass) {
    return new TreeJavaClassChooserDialog(title, myProject, scope, classFilter, initialClass);
  }

  @NotNull
  public TreeClassChooser createProjectScopeChooser(String title, PsiClass initialClass) {
    return new TreeJavaClassChooserDialog(title, myProject, initialClass);
  }

  @NotNull
  public TreeClassChooser createProjectScopeChooser(String title) {
    return new TreeJavaClassChooserDialog(title, myProject);
  }

  @NotNull
  public TreeClassChooser createAllProjectScopeChooser(String title) {
    return new TreeJavaClassChooserDialog(title, myProject, GlobalSearchScope.allScope(myProject), null, null);
  }

  @NotNull
  public TreeClassChooser createInheritanceClassChooser(String title,
                                                        GlobalSearchScope scope,
                                                        PsiClass base,
                                                        boolean acceptsSelf,
                                                        boolean acceptInner,
                                                        @Nullable
                                                        Condition<? super PsiClass> additionalCondition) {
    ClassFilter classFilter = new TreeJavaClassChooserDialog.InheritanceJavaClassFilterImpl(base, acceptsSelf, acceptInner, additionalCondition);
    return new TreeJavaClassChooserDialog(title, myProject, scope, classFilter, base, null, false);
  }

  @NotNull
  public TreeClassChooser createInheritanceClassChooser(String title, GlobalSearchScope scope, PsiClass base, PsiClass initialClass) {
    return createInheritanceClassChooser(title, scope, base, initialClass, null);
  }

  @NotNull
  public TreeClassChooser createInheritanceClassChooser(String title, GlobalSearchScope scope, PsiClass base, PsiClass initialClass,
                                                        ClassFilter classFilter) {
    return new TreeJavaClassChooserDialog(title, myProject, scope, classFilter, base, initialClass, false);
  }

  @NotNull
  public TreeFileChooser createFileChooser(@NotNull String title,
                                           final PsiFile initialFile,
                                           FileType fileType,
                                           TreeFileChooser.PsiFileFilter filter) {
    return new TreeFileChooserDialog(myProject, title, initialFile, fileType, filter, false, false);
  }

  @NotNull
  public
  TreeFileChooser createFileChooser(@NotNull String title,
                                    @Nullable PsiFile initialFile,
                                    @Nullable FileType fileType,
                                    @Nullable TreeFileChooser.PsiFileFilter filter,
                                    boolean disableStructureProviders) {
    return new TreeFileChooserDialog(myProject, title, initialFile, fileType, filter, disableStructureProviders, false);
  }

  @NotNull
  public TreeFileChooser createFileChooser(@NotNull String title, @Nullable PsiFile initialFile, @Nullable FileType fileType,
                                           @Nullable TreeFileChooser.PsiFileFilter filter,
                                           boolean disableStructureProviders,
                                           boolean showLibraryContents) {
    return new TreeFileChooserDialog(myProject, title, initialFile, fileType, filter, disableStructureProviders, showLibraryContents);
  }
}


text:
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class FAQ extends Model
{
    use SoftDeletes;
    protected $table = 'faqs';
    protected $dates = ['deleted_at'];
    protected $fillable = ['id', 'question', 'answer','category'];
}


text:
/**************************************************************
 *
 *	giants.h
 *
 *	Header file for large-integer arithmetic library giants.c.
 *
 *	Updates:
 *          18 Jul 99  REC  Added fer_mod().
 *          30 Apr 98  JF   USE_ASSEMBLER_MUL removed
 *          29 Apr 98  JF   Function prototypes cleaned up
 *			20 Apr 97  RDW
 *
 *	c. 1997 Perfectly Scientific, Inc.
 *	All Rights Reserved.
 *
 **************************************************************/

/**************************************************************
 *
 * Error Codes
 *
 **************************************************************/

#define DIVIDEBYZERO  1
#define OVFLOW      2
#define SIGN	      3
#define OVERRANGE     4
#define AUTO_MUL 0
#define GRAMMAR_MUL 1
#define FFT_MUL 2
#define KARAT_MUL 3

/**************************************************************
 *
 * Preprocessor definitions
 *
 **************************************************************/

/* 2^(16*MAX_SHORTS)-1 will fit into a giant, but take care:
 * one usually has squares, etc. of giants involved, and
 * every intermediate giant in a calculation must fit into
 * this many shorts. Thus, if you want systematically to effect
 * arithmetic on B-bit operands, you need MAX_SHORTS > B/8,
 * perferably a tad larger than this; e.g. MAX_SHORTS > B/7.
 */
#define MAX_SHORTS (1<<19)

#define INFINITY (-1)
#define FA 0
#define TR 1
#define COLUMNWIDTH 64

#define TWOPI (double)(2*3.1415926535897932384626433)
#define SQRT2 (double)(1.414213562373095048801688724209)
#define SQRTHALF (double)(0.707106781186547524400844362104)
#define TWO16 (double)(65536.0)
#define TWOM16 (double)(0.0000152587890625)

/* Decimal digit ceiling in digit-input routines. */
#define MAX_DIGITS 10000

/* Next, mumber of shorts per operand
   at which Karatsuba breaks over. */
#define KARAT_BREAK 40

/* Next, mumber of shorts per operand
   at which FFT breaks over. */
#define FFT_BREAK 200

#define newmin(a,b) ((a)<(b)? (a) : (b))
#define newmax(a,b) ((a)>(b)? (a) : (b))

/* Maximum number of recursive steps needed to calculate
 * gcds of integers. */
#define STEPS 32

/* The limit below which hgcd is too ponderous */
#define GCDLIMIT 5000

/* The limit below which ordinary ints will be used */
#define INTLIMIT  31

/* Size by which to increment the stack used in pushg() and popg(). */
#define	STACK_GROW	16

#define gin(x)   gread(x,stdin)
#define gout(x)  gwriteln(x,stdout)

/**************************************************************
 *
 * Structure definitions
 *
 **************************************************************/

typedef struct
{
	 int 					sign;
	 unsigned short	n[1];       /* number of shorts = abs(sign) */
} giantstruct;

typedef giantstruct *giant;

typedef struct _matrix
{
	 giant 				ul;			/* upper left */
	 giant				ur;         /* upper right */
	 giant				ll;         /* lower left */
	 giant				lr;       	/* lower right */
} *gmatrix;

typedef struct
{
	double				re;
	double				im;
} complex;

/**************************************************************
 *
 * Function Prototypes
 *
 **************************************************************/

/**************************************************************
 *
 * Initialization and utility functions
 *
 **************************************************************/

/* trig lookups. */
void			init_sinCos(int);
double			s_sin(int);
double			s_cos(int);

/* Creates a new giant, numshorts = INFINITY invokes the
 * maximum MAX_SHORTS. */
giant 			newgiant(int numshorts);

/* Creates a new giant matrix, but does not malloc
 * the component giants. */
gmatrix			newgmatrix(void);

/* Returns the bit-length n; e.g. n=7 returns 3. */
int 			bitlen(giant n);

/* Returns the value of the pos bit of n. */
int 			bitval(giant n, int pos);

/* Returns whether g is one. */
int 			isone(giant g);

/* Returns whether g is zero. */
int 			isZero(giant g);

/* Copies one giant to another. */
void 			gtog(giant src, giant dest);

/* Integer <-> giant. */
void 			itog(int n, giant g);
signed int		gtoi (giant);

/* Returns the sign of g: -1, 0, 1. */
int 			gsign(giant g);

/* Returns 1, 0, -1 as a>b, a=b, a<b. */
int 			gcompg(giant a, giant b);

/* Set AUTO_MUL for automatic FFT crossover (this is the
 * default), set FFT_MUL for forced FFT multiply, set
 * GRAMMAR_MUL for forced grammar school multiply. */
void 		setmulmode(int mode);

/**************************************************************
 *
 * I/O Routines
 *
 **************************************************************/

/* Output the giant in decimal, with optional newlines.  */
void 		gwrite(giant g, FILE *fp, int newlines);

/* Output the giant in decimal, with both '\'-newline
 * notation and a final newline. */
void 		gwriteln(giant g, FILE *fp);

/* Input the giant in decimal, assuming the formatting of
 * 'gwriteln'. */
void 		gread(giant g, FILE *fp);

/**************************************************************
 *
 * Math Functions
 *
 **************************************************************/

/* g := -g. */
void 		negg(giant g);

/* g := |g|. */
void 		absg(giant g);

/* g += i, with i non-negative and < 2^16. */
void 		iaddg(int i,giant g);

/* b += a. */
void 		addg(giant a, giant b);

/* b -= a. */
void 		subg(giant a, giant b);

/* Returns the number of trailing zero bits in g. */
int			numtrailzeros(giant g);

/* u becomes greatest power of two not exceeding u/v. */
void		bdivg(giant v, giant u);

/* Same as invg, but uses bdivg. */
int 		binvg(giant n, giant x);

/* If 1/x exists (mod n), 1 is returned and x := 1/x.  If
 * inverse does not exist, 0 is returned and x := GCD(n, x). */
int 		invg(giant n, giant x);

int			mersenneinvg(int q, giant x);

/* Classical GCD, x:= GCD(n, x). */
void 		cgcdg(giant n, giant x);

/* General GCD, x:= GCD(n, x). */
void 		gcdg(giant n, giant x);

/* Binary GCD, x:= GCD(n, x). */
void 		bgcdg(giant n, giant x);

/* g := m^n, no mod is performed. */
void 		powerg(int a, int b, giant g);

/* r becomes the steady-state reciprocal 2^(2b)/d, where
 * b = bit-length of d-1. */
void		make_recip(giant d, giant r);

/* n := [n/d], d positive, using stored reciprocal directly. */
void		divg_via_recip(giant d, giant r, giant n);

/* n := n % d, d positive, using stored reciprocal directly. */
void		modg_via_recip(giant d, giant r, giant n);

/* num := num % den, any positive den. */
void 		modg(giant den, giant num);

/* a becomes (a*b) (mod 2^q-k) where q % 16 == 0 and k is "small"
 * (0 < k < 65535). Returns 0 if unsuccessful, otherwise 1. */
int			feemulmod(giant x, giant y, int q, int k);

/* g := g/n, and (g mod n) is returned. */
int 		idivg(int n, giant g);

/* num := [num/den], any positive den. */
void 		divg(giant den, giant num);

/* num := [num/den], any positive den. */
void 		powermod(giant x, int n, giant z);

/* x := x^n (mod z). */
void 		powermodg(giant x, giant n, giant z);

/* x := x^n (mod 2^q+1). */
void 		fermatpowermod(giant x, int n, int q);

/* x := x^n (mod 2^q+1). */
void 		fermatpowermodg(giant x, giant n, int q);

/* x := x^n (mod 2^q-1). */
void 		mersennepowermod(giant x, int n, int q);

/* x := x^n (mod 2^q-1). */
void 		mersennepowermodg(giant x, giant n, int q);

/* Shift g left by bits, introducing zeros on the right. */
void 		gshiftleft(int bits, giant g);

/* Shift g right by bits, losing bits on the right. */
void 		gshiftright(int bits, giant g);

/* dest becomes lowermost n bits of src.
 * Equivalent to dest = src % 2^n. */
void 		extractbits(int n, giant src, giant dest);

/* negate g. g is mod 2^n+1. */
void 		fermatnegate(int n, giant g);

/* g := g (mod 2^n-1). */
void 		mersennemod(int n, giant g);

/* g := g (mod 2^n+1). */
void 		fermatmod(int n, giant g);

/* g := g (mod 2^n+1). */
void 		fer_mod(int n, giant g, giant modulus);

/* g *= s. */
void 		smulg(unsigned short s, giant g);

/* g *= g. */
void 		squareg(giant g);

/* b *= a. */
void 		mulg(giant a, giant b);

/* A giant gcd.  Modifies its arguments. */
void		ggcd(giant xx, giant yy);


text:
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>W29178_text</title>
        <link rel="stylesheet" type="text/css" href="style.css" />

                «

    <p class="styleSans32.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">

    <p class="styleSans9.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">STATE OF TEXAS § § COUNTY OF TARRANT §
1, Timothy Beggans, Senior Marketer of XTO Energy Inc., a Delaware corporation, who's mailing address is 810 Houston Street, Fort Worth, Texas 76102, state:

    <p class="styleSans10.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">1, Timothy Beggans, directly sent to ONEOK Partners representative Lindsey Lindsey, a well connection list which included the following well(s) for pipeline connection:

    <p class="styleSans9.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Name of the well(s): Moses 21X-9 A,B wells Anticipated completion date: May 12, 2015 (estimated) Anticipated production rate: 880 Mcf/d per well (1760 in total)
Date submitted: June I3, 2014

    <p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Executed this 28 day of July, 2014

    <p class="styleSans20.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Sworn and subscribed before me misc-2'8 day of 5 55 A is! , 2014, by Timothy Beggans

    <p class="styleSans29.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">STATE OF TEXAS §
§ COUNTY OF TARRANT §
This instrument was acknowledged before me on thiscaq day of , 2014, by Timothy Beggans, Senior Marketer of XTO Energy Inc., a Delaware corporation, a Delaware Corporation on behalf of said corporation.
' f A I

    <p class="styleSans12000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">

    <p class="styleSans6.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">XTO Energy Inc.
810 Houston Street
Fort Worth, TX 76102-6298 (817) 870-2800
(817) 870-1671 Fax

    <p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">AFFIDAVIT

    <p class="styleSans12000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">

    <p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">An ExxonMobil Subsidiary

    <p class="styleSans12000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.trino.plugin.bigquery;

import com.google.cloud.bigquery.storage.v1.BigQueryReadClient;
import com.google.cloud.bigquery.storage.v1.ReadRowsRequest;
import com.google.cloud.bigquery.storage.v1.ReadRowsResponse;

import java.util.Iterator;
import java.util.NoSuchElementException;

import static java.util.Objects.requireNonNull;

public class ReadRowsHelper
{
    private final BigQueryReadClient client;
    private final String streamName;
    private final int maxReadRowsRetries;

    public ReadRowsHelper(BigQueryReadClient client, String streamName, int maxReadRowsRetries)
    {
        this.client = requireNonNull(client, "client cannot be null");
        this.streamName = requireNonNull(streamName, "streamName cannot be null");
        this.maxReadRowsRetries = maxReadRowsRetries;
    }

    public Iterator<ReadRowsResponse> readRows()
    {
        Iterator<ReadRowsResponse> serverResponses = fetchResponses(0);
        return new ReadRowsIterator(this, serverResponses);
    }

    // In order to enable testing
    protected Iterator<ReadRowsResponse> fetchResponses(long offset)
    {
        return client.readRowsCallable()
                .call(ReadRowsRequest.newBuilder()
                        .setReadStream(streamName)
                        .setOffset(offset)
                        .build())
                .iterator();
    }

    // Ported from https://github.com/GoogleCloudDataproc/spark-bigquery-connector/pull/150
    private static class ReadRowsIterator
            implements Iterator<ReadRowsResponse>
    {
        private final ReadRowsHelper helper;
        private long nextOffset;
        private Iterator<ReadRowsResponse> serverResponses;
        private int retries;

        public ReadRowsIterator(
                ReadRowsHelper helper,
                Iterator<ReadRowsResponse> serverResponses)
        {
            this.helper = helper;
            this.serverResponses = serverResponses;
        }

        @Override
        public boolean hasNext()
        {
            return serverResponses.hasNext();
        }

        @Override
        public ReadRowsResponse next()
        {
            do {
                try {
                    ReadRowsResponse response = serverResponses.next();
                    nextOffset += response.getRowCount();
                    return response;
                }
                catch (Exception e) {
                    // if relevant, retry the read, from the last read position
                    if (BigQueryUtil.isRetryable(e) && retries < helper.maxReadRowsRetries) {
                        serverResponses = helper.fetchResponses(nextOffset);
                        retries++;
                    }
                    else {
                        helper.client.close();
                        throw e;
                    }
                }
            }
            while (serverResponses.hasNext());

            throw new NoSuchElementException("No more server responses");
        }
    }
}


text:
#import <Adium/AIContactControllerProtocol.h>

@class AIAccount;

@interface AIAccountViewController : NSObject {
	/* These are the views used in Adium's account preferences.  If views aren't provided by a custom account view
	 * nib, default views with the most common controls will be used.  There is no need to provide a custom nib
	 * if your account code only needs the default controls.  Avoid using the auxiliary tabs if possible. */
    IBOutlet	NSView			*view_setup;              		//Account setup (UID, password, etc)
    IBOutlet	NSView			*view_profile;              	//Account profile (Alias, profile)
    IBOutlet	NSView			*view_options;              	//Account options (Host, port, mail, protocol, etc)
    IBOutlet	NSView			*view_privacy;              	//Account privacy (Encryption, typing, etc)
    IBOutlet	NSTabView		*view_auxiliaryTabView;			//Tab view containing auxiliary tabs

	//These common controls are used by most protocols, so we place them here as a convenience to protocol code.
	//Custom account view nibs are encouraged to connect to these outlets.
	IBOutlet	NSTextField		*textField_accountUIDLabel;		//Label on UID field
	IBOutlet	NSTextField		*textField_accountUID;			//UID field
	IBOutlet	NSTextField		*label_password;				//Label on the password field
	IBOutlet	NSTextField		*textField_password;			//Password field
	IBOutlet	NSTextField		*textField_connectHost;			//Connect host
	IBOutlet	NSTextField		*textField_connectPort;			//Connect port
	IBOutlet	NSTextField		*textField_alias;				//User alias (or display name)
	IBOutlet	NSTextField		*label_alias;					//Label for the alias field
	IBOutlet	NSButton		*checkBox_checkMail;			//Check for new mail

	IBOutlet	NSTextField		*label_port;					//Label for the port field
	IBOutlet	NSTextField		*label_server;					//Label for the login server field

	IBOutlet	NSTextField		*label_typing;					//Label for the typing preference
	IBOutlet	NSButton		*checkBox_sendTyping;			//Send the user's typing state

	IBOutlet	NSTextField		*label_encryption;				//Label for the encryption preference
	IBOutlet	NSPopUpButton	*popUp_encryption;				//Encryption preference

	IBOutlet	NSProgressIndicator *progressIndicator_registering;
	IBOutlet	NSTextField			*textField_registering;

	//Instance variables
    AIAccount			*account;
	NSMutableDictionary	*changedPrefDict;
}

+ (id)accountViewController;
- (id)init;
- (NSView *)setupView;
- (NSView *)profileView;
- (NSView *)optionsView;
- (NSView *)privacyView;
- (void)configureForAccount:(AIAccount *)inAccount;
- (IBAction)changedPreference:(id)sender;
- (NSString *)nibName;
- (void)saveConfiguration;

- (void)didBeginRegistration;
- (void)usernameAndPasswordRegistered:(NSNotification*)notification;

@end

@interface AIAccountViewController (ForSubclasses)
- (NSDictionary *)keyToKeyDict;
- (void)localizeStrings;
@end


text:
import dj_database_url

from .base import *

#######################
# DEBUG CONFIGURATION #
#######################

# https://docs.djangoproject.com/en/1.8/ref/settings/#std:setting-DEBUG
DEBUG = env("DJANGO_DEBUG", False)

##########################
# DATABASE CONFIGURATION #
##########################

# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
DATABASES = {"default": dj_database_url.config()}

# https://docs.djangoproject.com/en/1.8/topics/db/transactions/#tying-transactions-to-http-requests
DATABASES["default"]["ATOMIC_REQUESTS"] = True

# https://docs.djangoproject.com/en/1.9/ref/databases/#persistent-connections
# https://docs.djangoproject.com/en/1.9/ref/settings/#std:setting-CONN_MAX_AGE
DATABASES["default"]["CONN_MAX_AGE"] = 60

#######################
# CACHE CONFIGURATION #
#######################

# https://docs.djangoproject.com/en/1.8/ref/settings/#caches
CACHES = {"default": {"BACKEND": "django.core.cache.backends.locmem.LocMemCache"}}

##########################
# TEMPLATE CONFIGURATION #
##########################

# https://docs.djangoproject.com/en/1.8/ref/settings/#std:setting-TEMPLATES
TEMPLATES = [
    {
        "BACKEND": "django.template.backends.django.DjangoTemplates",
        "DIRS": [path.join(APPS_DIR, "templates")],
        "OPTIONS": {
            "loaders": [
                (
                    "django.template.loaders.cached.Loader",
                    [
                        "django.template.loaders.filesystem.Loader",
                        "django.template.loaders.app_directories.Loader",
                    ],
                )
            ],
            "context_processors": [
                "django.template.context_processors.debug",
                "django.template.context_processors.request",
                "django.contrib.auth.context_processors.auth",
                "django.contrib.messages.context_processors.messages",
            ],
        },
    }
]

#############################
# STATIC FILE CONFIGURATION #
#############################

# https://docs.djangoproject.com/en/1.8/ref/settings/#staticfiles-storage
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"

######################
# HOST CONFIGURATION #
######################

# https://docs.djangoproject.com/en/1.8/ref/settings/#allowed-hosts
# https://docs.djangoproject.com/en/1.5/releases/1.5/#allowed-hosts-required-in-production
ALLOWED_HOSTS = [".texastribune.org"]

#########################
# LOGGING CONFIGURATION #
#########################

LOGGING = {
    "version": 1,
    "disable_existing_loggers": True,
    "formatters": {
        "verbose": {
            "format": "%(levelname)s %(asctime)s %(module)s "
            "%(process)d %(thread)d %(message)s"
        }
    },
    "handlers": {
        "console": {
            "level": "DEBUG",
            "class": "logging.StreamHandler",
            "formatter": "verbose",
        }
    },
    "loggers": {
        "django.db.backends": {
            "level": "ERROR",
            "handlers": ["console"],
            "propagate": False,
        }
    },
}

##########################
# SECURITY CONFIGURATION #
##########################

# https://docs.djangoproject.com/en/1.8/ref/settings/#secret-key
# This key should only be used for development and testing!
SECRET_KEY = env("SECRET_KEY")

# https://docs.djangoproject.com/en/1.8/ref/settings/#secure-content-type-nosniff
SECURE_CONTENT_TYPE_NOSNIFF = True

# https://docs.djangoproject.com/en/1.8/ref/settings/#secure-browser-xss-filter
SECURE_BROWSER_XSS_FILTER = True

# https://docs.djangoproject.com/en/1.8/ref/settings/#session-cookie-secure
SESSION_COOKIE_SECURE = True

# https://docs.djangoproject.com/en/1.8/ref/settings/#csrf-cookie-secure
CSRF_COOKIE_SECURE = True

# https://docs.djangoproject.com/en/1.8/ref/settings/#csrf-cookie-httponly
CSRF_COOKIE_HTTPONLY = True

# https://docs.djangoproject.com/en/1.8/ref/settings/#x-frame-options
X_FRAME_OPTIONS = "DENY"

# https://docs.djangoproject.com/en/1.8/ref/settings/#secure-proxy-ssl-header
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")

########################
# SENTRY CONFIGURATION #
########################

# https://docs.sentry.io/platforms/python/django/
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration

ENABLE_SENTRY = True

sentry_sdk.init(
    dsn=env("SENTRY_DSN", "None"),
    integrations=[DjangoIntegration()],
    environment=env("SENTRY_ENVIRONMENT", "None")
)

############################
# MIDDLEWARE CONFIGURATION #
############################

MIDDLEWARE += ("whitenoise.middleware.WhiteNoiseMiddleware",)


text:
package screenful.gui;

import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JFrame;

/**
 * Generic frame for displaying graphics. Can be closed by pressing Escape.
 */
public class GenericWindow implements Runnable {

    protected JFrame viewFrame;
    private boolean shouldRun = true;

    public GenericWindow(String name) {
        viewFrame = new JFrame(name);

        // register to key events
        viewFrame.addKeyListener(new KeyListener() {
            @Override
            public void keyTyped(KeyEvent arg0) {
            }

            @Override
            public void keyReleased(KeyEvent arg0) {
            }

            @Override
            public void keyPressed(KeyEvent arg0) {
                if (arg0.getKeyCode() == KeyEvent.VK_ESCAPE) {
                    shouldRun = false;
                }
            }
        });

        // register to closing event
        viewFrame.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                shouldRun = false;
            }
        });
    }

    @Override
    public void run() {

        while (shouldRun) {
            try {
                Thread.sleep(200);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        viewFrame.dispose();
    }

}


text:
@class DBTEAMLOGResellerLogInfo;

NS_ASSUME_NONNULL_BEGIN

#pragma mark - API Object

///
/// The `ResellerLogInfo` struct.
///
/// Reseller information.
///
/// This class implements the `DBSerializable` protocol (serialize and
/// deserialize instance methods), which is required for all Obj-C SDK API route
/// objects.
///
@interface DBTEAMLOGResellerLogInfo : NSObject <DBSerializable, NSCopying>

#pragma mark - Instance fields

/// Reseller name.
@property (nonatomic, readonly, copy) NSString *resellerName;

/// Reseller email.
@property (nonatomic, readonly, copy) NSString *resellerEmail;

#pragma mark - Constructors

///
/// Full constructor for the struct (exposes all instance variables).
///
/// @param resellerName Reseller name.
/// @param resellerEmail Reseller email.
///
/// @return An initialized instance.
///
- (instancetype)initWithResellerName:(NSString *)resellerName resellerEmail:(NSString *)resellerEmail;

- (instancetype)init NS_UNAVAILABLE;

@end

#pragma mark - Serializer Object

///
/// The serialization class for the `ResellerLogInfo` struct.
///
@interface DBTEAMLOGResellerLogInfoSerializer : NSObject

///
/// Serializes `DBTEAMLOGResellerLogInfo` instances.
///
/// @param instance An instance of the `DBTEAMLOGResellerLogInfo` API object.
///
/// @return A json-compatible dictionary representation of the
/// `DBTEAMLOGResellerLogInfo` API object.
///
+ (nullable NSDictionary *)serialize:(DBTEAMLOGResellerLogInfo *)instance;

///
/// Deserializes `DBTEAMLOGResellerLogInfo` instances.
///
/// @param dict A json-compatible dictionary representation of the
/// `DBTEAMLOGResellerLogInfo` API object.
///
/// @return An instantiation of the `DBTEAMLOGResellerLogInfo` object.
///
+ (DBTEAMLOGResellerLogInfo *)deserialize:(NSDictionary *)dict;

@end

NS_ASSUME_NONNULL_END


text:
package cc.factorie.util

import java.util.concurrent.ConcurrentHashMap

import scala.collection.JavaConversions._

class ThreadLocal[T](thunk: => T) {
  private val _instances: scala.collection.concurrent.Map[Long, T] = new ConcurrentHashMap[Long, T]
  def get: T = _instances.getOrElseUpdate(Thread.currentThread().getId, thunk)
  def instances = _instances.values
}


text:
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
using Scoala.Models;

namespace Scoala.Controllers
{
    public class StudentsController : Controller
    {
        // GET: Students
        public ActionResult Index()
        {
            ScoalaDB db = new ScoalaDB();
            return View(db.Students.ToList());
        }

        // GET: Students/Details/5
        public ActionResult Details(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            ScoalaDB db = new ScoalaDB();
            Student student = db.Students.Find(id);
            if (student == null)
            {
                return HttpNotFound();
            }
            return View(student);
        }

        // GET: Students/Create
        public ActionResult Create()
        {
            ViewBag.sex = string.Empty;
            return View();
        }

        // POST: Students/Create
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult Create([Bind(Include = "id_student,name,surname,sex,date_of_registration")] Student student)
        {
            if (ModelState.IsValid)
            {
                ScoalaDB db = new ScoalaDB();
                student.date_of_registration = DateTime.Now;
                db.Students.Add(student);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(student);
        }

        // GET: Students/Edit/5
        public ActionResult Edit(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            ScoalaDB db = new ScoalaDB();
            Student student = db.Students.Find(id);
            if (student == null)
            {
                return HttpNotFound();
            }
            return View(student);
        }

        // POST: Students/Edit/5
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult Edit([Bind(Include = "id_student,name,surname,sex,date_of_registration")] Student student)
        {
            if (ModelState.IsValid)
            {
                ScoalaDB db = new ScoalaDB();
                db.Entry(student).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            return View(student);
        }

        // GET: Students/Delete/5
        public ActionResult Delete(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            ScoalaDB db = new ScoalaDB();
            Student student = db.Students.Find(id);
            if (student == null)
            {
                return HttpNotFound();
            }
            return View(student);
        }

        // POST: Students/Delete/5
        [HttpPost, ActionName("Delete")]
        [ValidateAntiForgeryToken]
        public ActionResult DeleteConfirmed(int id)
        {
            ScoalaDB db = new ScoalaDB();
            Student student = db.Students.Find(id);
            db.Students.Remove(student);
            db.SaveChanges();
            return RedirectToAction("Index");
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                ScoalaDB db = new ScoalaDB();
                db.Dispose();
            }
            base.Dispose(disposing);
        }
    }
}


text:
// courtesy of
// https://gist.github.com/salomvary/5a295d32e0868ffde42a

(function() {

	var Timer = Java.type('java.util.Timer');
	var Phaser = Java.type('java.util.concurrent.Phaser');

	var timer = new Timer('jsEventLoop', false);
	var phaser = new Phaser();

	var onTaskFinished = function() {
		phaser.arriveAndDeregister();
	};

	setTimeout = function(fn, millis) {
		var self = null;

		var args = [].slice.call(arguments, 2, arguments.length);
		if (args.length > 0) {

			self = args[0];
		}

		var phase = phaser.register();
		var canceled = false;

		timer.schedule(function() {
			if (canceled)
				return;

			try {
				fn.call(self);

			} catch (e) {
				print(e);

			} finally {
				onTaskFinished();
			}

		}, millis);

		return function() {
			onTaskFinished();

			canceled = true;
		};
	}

})();


text:
namespace Aiv.Research.Visualizer2D
{
    partial class PropertyGridForm
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.m_hPropertyGrid = new System.Windows.Forms.PropertyGrid();
            this.splitContainer1 = new System.Windows.Forms.SplitContainer();
            this.m_hCancel = new System.Windows.Forms.Button();
            this.m_hButtonOk = new System.Windows.Forms.Button();
            ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
            this.splitContainer1.Panel1.SuspendLayout();
            this.splitContainer1.Panel2.SuspendLayout();
            this.splitContainer1.SuspendLayout();
            this.SuspendLayout();
            //
            // m_hPropertyGrid
            //
            this.m_hPropertyGrid.Dock = System.Windows.Forms.DockStyle.Fill;
            this.m_hPropertyGrid.Location = new System.Drawing.Point(0, 0);
            this.m_hPropertyGrid.Name = "m_hPropertyGrid";
            this.m_hPropertyGrid.Size = new System.Drawing.Size(632, 402);
            this.m_hPropertyGrid.TabIndex = 0;
            //
            // splitContainer1
            //
            this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.splitContainer1.Location = new System.Drawing.Point(0, 0);
            this.splitContainer1.Name = "splitContainer1";
            this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
            //
            // splitContainer1.Panel1
            //
            this.splitContainer1.Panel1.Controls.Add(this.m_hPropertyGrid);
            //
            // splitContainer1.Panel2
            //
            this.splitContainer1.Panel2.Controls.Add(this.m_hButtonOk);
            this.splitContainer1.Panel2.Controls.Add(this.m_hCancel);
            this.splitContainer1.Size = new System.Drawing.Size(632, 452);
            this.splitContainer1.SplitterDistance = 402;
            this.splitContainer1.TabIndex = 1;
            //
            // m_hCancel
            //
            this.m_hCancel.Dock = System.Windows.Forms.DockStyle.Right;
            this.m_hCancel.Location = new System.Drawing.Point(557, 0);
            this.m_hCancel.Name = "m_hCancel";
            this.m_hCancel.Size = new System.Drawing.Size(75, 46);
            this.m_hCancel.TabIndex = 0;
            this.m_hCancel.Text = "Cancel";
            this.m_hCancel.UseVisualStyleBackColor = true;
            this.m_hCancel.Click += new System.EventHandler(this.m_hCancel_Click);
            //
            // m_hButtonOk
            //
            this.m_hButtonOk.Dock = System.Windows.Forms.DockStyle.Right;
            this.m_hButtonOk.Location = new System.Drawing.Point(482, 0);
            this.m_hButtonOk.Name = "m_hButtonOk";
            this.m_hButtonOk.Size = new System.Drawing.Size(75, 46);
            this.m_hButtonOk.TabIndex = 1;
            this.m_hButtonOk.Text = "Ok";
            this.m_hButtonOk.UseVisualStyleBackColor = true;
            this.m_hButtonOk.Click += new System.EventHandler(this.m_hButtonOk_Click);
            //
            // PropertyGridForm
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(632, 452);
            this.Controls.Add(this.splitContainer1);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            this.KeyPreview = true;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "PropertyGridForm";
            this.Text = "PropertyGridForm";
            this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.OnKeyDown);
            this.splitContainer1.Panel1.ResumeLayout(false);
            this.splitContainer1.Panel2.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
            this.splitContainer1.ResumeLayout(false);
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.PropertyGrid m_hPropertyGrid;
        private System.Windows.Forms.SplitContainer splitContainer1;
        private System.Windows.Forms.Button m_hButtonOk;
        private System.Windows.Forms.Button m_hCancel;
    }
}


text:
    <meta http-equiv="pragma" content="no-cache" />

This is a overlay ad

                Ads by msdp


text:
using System;
using System.Collections.Generic;
using System.Linq;
using Siftables.ViewModel;
using Sifteo;

namespace Siftables
{
    public static class NeighborCalculator
    {

        public static void CalculateNeighbors(ICollection<CubeViewModel> cubeViewModels)
        {
            // I'd like to eliminate this loop... but we have to reset everything before we can start processing neighbors
            foreach (var cube in cubeViewModels.Select(cubeViewModel => cubeViewModel.CubeModel))
            {
                cube.Neighbors = new Neighbors();
            }
            for (var i = 0; i < cubeViewModels.Count - 1; i++)
            {
                var cubeViewModel = cubeViewModels.ToArray()[i];
                var cubeViewModelX = cubeViewModel.PositionX;
                var cubeViewModelY = cubeViewModel.PositionY;
                var cube = cubeViewModel.CubeModel;
                for (var j = i + 1; j < cubeViewModels.Count; j++)
                {
                    var otherCubeViewModel = cubeViewModels.ToArray()[j];
                    // If anybody knows a better way to do this, please fix it.  The only way I could get
                    // the DP to expose its value is through its ToString method...
                    var otherCubeViewModelX = otherCubeViewModel.PositionX;
                    var otherCubeViewModelY = otherCubeViewModel.PositionY;
                    var otherCube = otherCubeViewModel.CubeModel;
                    if ((Math.Abs(cubeViewModelX - otherCubeViewModelX) <= (Neighbors.GAP_TOLERANCE + Cube.dimension)) && (Math.Abs(cubeViewModelY - otherCubeViewModelY) <= (Cube.dimension - Neighbors.SHARED_EDGE_MINIMUM)))
                    {
                        if (cubeViewModelX < otherCubeViewModelX)
                        {
                            cube.Neighbors.Right = otherCube;
                            otherCube.Neighbors.Left = cube;
                        }
                        else
                        {
                            cube.Neighbors.Left = otherCube;
                            otherCube.Neighbors.Right = cube;
                        }
                    }
                    if ((Math.Abs(cubeViewModelY - otherCubeViewModelY) <= (Neighbors.GAP_TOLERANCE + Cube.dimension)) && (Math.Abs(cubeViewModelX - otherCubeViewModelX) <= (Cube.dimension - Neighbors.SHARED_EDGE_MINIMUM)))
                    {
                        if (cubeViewModelY < otherCubeViewModelY)
                        {
                            cube.Neighbors.Top = otherCube;
                            otherCube.Neighbors.Bottom = cube;
                        }
                        else
                        {
                            cube.Neighbors.Bottom = otherCube;
                            otherCube.Neighbors.Top = cube;
                        }
                    }
                }
            }
        }
    }
}


text:
import logging

log = logging.getLogger(__name__)

def init_robots(app):
    """
    Add X-Robots-Tag header. Use it to avoid search engines indexing airflow. This mitigates some
    of the risk associated with exposing Airflow to the public internet, however it does not
    address the real security risks associated with such a deployment.

    See also: https://developers.google.com/search/docs/advanced/robots/robots_meta_tag#xrobotstag
    """

    def apply_robot_tag(response):
        response.headers['X-Robots-Tag'] = 'noindex, nofollow'
        return response

    app.after_request(apply_robot_tag)