text:
import datetime
import ssl
import sys

import google.cloud.exceptions
import pytest
from django.core.exceptions import SuspiciousFileOperation

from django_gcloud_storage import safe_join, remove_prefix, GCloudFile

from conftest import TEST_FILE_CONTENT, TEST_FILE_PATH
from helpers import upload_test_file

def urlopen(*args, **kwargs):
    try:
        from urllib.request import urlopen
    except ImportError:
        from urllib2 import urlopen

    try:
        # Ignore SSL errors (won't work on Py3.3 but can be ignored there)
        kwargs["context"] = ssl._create_unverified_context()
    except AttributeError:  # Py3.3
        pass

    return urlopen(*args, **kwargs)

# noinspection PyClassHasNoInit,PyMethodMayBeStatic
class TestSafeJoin:
    def test_should_join_urls(self):
        assert safe_join("test", "index.html") == "test/index.html"

    def test_should_not_break_on_slash_on_base(self):
        assert safe_join("test/", "index.html") == "test/index.html"
        assert safe_join("test///", "index.html") == "test/index.html"

    def test_should_enforce_no_starting_slash_on_base(self):
        assert safe_join("/test", "index.html") == "test/index.html"
        assert safe_join("////test", "index.html") == "test/index.html"

    def test_should_resolve_dots_to_absolute_path(self):
        assert safe_join("test", "/test/../index.html") == "test/index.html"

    def test_should_resolve_multiple_slashes(self):
        assert safe_join("test", "/test//abc////index.html") == "test/test/abc/index.html"
        assert safe_join("test///", "///test//abc////index.html") == "test/test/abc/index.html"

    def test_should_not_allow_escaping_base_path(self):
        with pytest.raises(SuspiciousFileOperation):
            safe_join("test", "../index.html")
        with pytest.raises(SuspiciousFileOperation):
            safe_join("test", "/../index.html")

    def test_should_work_with_bytes(self):
        assert safe_join(b"test", "index.html") == "test/index.html"
        assert safe_join("test", b"index.html") == "test/index.html"
        assert safe_join(b"test", b"index.html") == "test/index.html"

    def test_should_work_with_unicode_characters(self):
        assert safe_join("test", "brathähnchen.html") == "test/brathähnchen.html"

    def test_should_normalize_system_dependant_slashes(self):
        assert safe_join("test", "windows\\slashes") == "test/windows/slashes"
        assert safe_join("test", "windows\\/slashes") == "test/windows/slashes"
        assert safe_join("windows\\", "slashes") == "windows/slashes"

def test_remove_prefix_function():
    assert remove_prefix("/a/b/c/", "/a/") == "b/c/"
    assert remove_prefix("/a/b/c/", "/b/") == "/a/b/c/"

# noinspection PyMethodMayBeStatic,PyTypeChecker
class TestGCloudFile:
    TEST_CONTENT = "Brathähnchen".encode("utf8")

    def test_should_be_able_to_read_and_write(self, monkeypatch):
        monkeypatch.setattr(GCloudFile, "_update_blob", lambda: None)

        f = GCloudFile(None)
        f.open("w")
        assert f.read() == (b"" if sys.hexversion >= 0x3000000 else "")
        f.write(self.TEST_CONTENT)
        f.seek(0)
        assert f.read() == self.TEST_CONTENT

    def test_small_temporary_files_should_not_be_rolled_over_to_disk(self, monkeypatch):
        monkeypatch.setattr(GCloudFile, "_update_blob", lambda: None)

        f = GCloudFile(None, maxsize=1000)
        f.write("a".encode("utf8") * 1000)

        assert not f._tmpfile._rolled

    def test_large_temporary_files_should_be_rolled_over_to_disk(self, monkeypatch):
        monkeypatch.setattr(GCloudFile, "_update_blob", lambda: None)

        f = GCloudFile(None, maxsize=1000)
        f.write("a".encode("utf8") * 1001)

        assert f._tmpfile._rolled

    def test_modified_files_should_be_marked_as_dirty(self, monkeypatch):
        monkeypatch.setattr(GCloudFile, "_update_blob", lambda: None)

        f = GCloudFile(None)
        f.write(self.TEST_CONTENT)

        assert f._dirty

# noinspection PyClassHasNoInit,PyMethodMayBeStatic
class TestGCloudStorageClass:
    def test_should_create_blob_at_correct_path(self, storage, test_file):
        assert test_file == TEST_FILE_PATH

    def test_should_create_a_valid_client_object(self, storage):
        with pytest.raises(google.cloud.exceptions.NotFound):
            storage.client.get_bucket("some_random_bucket_name_that_doesnt_exist")

    def test_should_create_a_valid_bucket_object(self, storage):
        assert storage.bucket.exists()

    def test_should_be_able_to_save_and_open_files(self, storage, test_file):
        f = storage.open(test_file)
        assert f.read() == TEST_FILE_CONTENT

    def test_should_return_created_time(self, storage, test_file):
        assert isinstance(storage.created_time(test_file), datetime.datetime)

    def test_should_return_modified_time(self, storage, test_file):
        assert isinstance(storage.get_modified_time(test_file), datetime.datetime)

    def test_should_be_able_to_delete_files(self, storage):
        file_name = "test_delete_file"
        upload_test_file(storage, file_name, "")
        storage.delete(file_name)

        # Should not raise an exception by google.cloud
        assert storage.delete("missing_file") is None

    def test_exists_method(self, storage, test_file):
        assert not storage.exists("missing_file")
        assert storage.exists(test_file)

    def test_should_return_correct_file_size(self, storage, test_file):
        assert storage.size(test_file) == len(TEST_FILE_CONTENT)

    def test_should_return_publicly_downloadable_url(self, storage, test_file):
        assert urlopen(storage.url(test_file)).read() == TEST_FILE_CONTENT

    def test_should_work_with_utf8(self, storage):
        file_name = "test_utf8_file_陰陽"
        upload_test_file(storage, file_name, "")

        storage.exists(file_name)

        # Don't explode when trying to find a available name for existing files...
        upload_test_file(storage, file_name, "")

    def test_should_be_able_to_list_dirs_and_files(self, storage):
        file_name = "test_listdir_file"
        subdir_file_pattern = "/subdir/%s.%d"

        for i in range(1, 11):
            upload_test_file(storage, subdir_file_pattern % (file_name, i), "")

        upload_test_file(storage, "/subdir/a/" + file_name, "")
        upload_test_file(storage, "/subdir/b/" + file_name, "")

        # Make sure paths prefixed with a slash are normalized
        assert storage.listdir("") == storage.listdir("/")
        assert storage.listdir("subdir") == storage.listdir("/subdir")

        subdir_list_dir = storage.listdir("subdir/")
        assert len(subdir_list_dir[0]) == 2 and len(subdir_list_dir[1]) == 10
        assert subdir_list_dir[0] == ["a", "b"]
        assert subdir_list_dir[1][0] == "%s.%d" % (file_name, 1)

    def test_should_not_overwrite_files_on_save(self, storage, test_file):
        duplicate_file = upload_test_file(storage, test_file, "")
        assert duplicate_file != test_file

    def test_changed_files_should_be_reuploaded(self, storage):
        file_name = "test_changed_file_reuploaded"
        file_content = "gcloud".encode("ascii")

        upload_test_file(storage, file_name, "")
        first_modified_time = storage.get_modified_time(file_name)
        local_tmpfile = storage.open(file_name)

        assert local_tmpfile.read() == "".encode("ascii")
        local_tmpfile.seek(0)

        local_tmpfile.write(file_content)
        local_tmpfile.close()

        assert storage.open(file_name).read() == file_content
        assert storage.get_modified_time(file_name) != first_modified_time

    def test_open_should_be_able_to_create_new_file(self, storage):
        file_name = "test_open_creates_file"
        file_content = "".encode("ascii")

        with storage.open(file_name, mode="wb") as f:
            f.write(file_content)

        assert storage.exists(file_name)

    def test_use_unsigned_urls_option(self, storage, test_file):
        storage.use_unsigned_urls = True
        url = storage.url(test_file)
        storage.use_unsigned_urls = False
        for i in ["Signature=", "GoogleAccessId=", "Expires="]:
            assert i not in url

    def test_correctly_detect_mimetype(self, storage):
        file_name = "test.jpg"
        upload_test_file(storage, file_name, "")

        assert "image/jpeg" == urlopen(storage.url(file_name)).info().get("Content-Type")


text:
package com.cognizant.cognizantits.engine.constants;

/**
 *
 *
 */
public final class ObjectAttribute {

    public static final String name = "ref";
    public static final String value = "value";
    public static final String type = "type";
    public static final String preference = "pref";
    public static final String title = "title";
    public static final String frame = "frame";
    public static final String exist = "exist";
}

redpajama_set_name: RedPajamaGithub


text:
<mat-form-field [formGroup]="formGroup" class="cs-search-daterange-picker" >
  <input matInput
         ngxDaterangepickerMd
         formControlName="internalDateRange"
         [ranges]="ranges"
         [showRangeLabelOnInput]="showRangeLabelOnInput"
         [alwaysShowCalendars]="alwaysShowCalendars"
         [placeholder]="placeholder"
         [showDropdowns]="showDropdowns"
         [attr.aria-label]="placeholder"
         [autoApply]="true"
         (datesUpdated)="datesUpdated($event)"
         (rangeClicked)="datesUpdated($event)"
         />
</mat-form-field>


text:
module qec {

    export class editorObject {
        //canvas = document.createElement('canvas');
        name: string;
        topSvgId: string;

        sd = new sdFields();
        isHole = false;
        top = new distanceFieldCanvas();
        profile = new distanceFieldCanvas();

        diffuseColor = vec3.create();
        inverseTransform = mat4.create();
        private tmpTransform = mat4.create();

        bsplineDrawer = new bsplineDrawer();
        lineDrawer = new lineDrawer();

        profilePoints: number[][] = [];
        profileBounds = vec4.create();
        tmpProfileCanvas = document.createElement('canvas');

        profileSmooth = true;

        needsTextureUpdate = true;
        needsTransformUpdate = true;
        needsMaterialUpdate = true;

        constructor() {
            // default profile
            vec4.set(this.profileBounds, -0.2, 0, 0, 0.5);
            this.profilePoints = [[-0.2, 0], [-0.1, 0], [0, 0], [0, 0.1], [0, 0.2], [0, 0.3], [0, 0.4], [0, 0.5], [-0.1, 0.5], [-0.2, 0.5]];

            //this.profile.canvas.style.border = 'solid 1px red';
            //$('.debug').append(this.profile.canvas);
        }

        toDto(): editorObjectDto {
            var dto = new editorObjectDto();
            dto.zTranslate = this.inverseTransform[14];
            dto.profilePoints = this.profilePoints;
            dto.profileBounds = float32ArrayToArray(this.profileBounds);
            dto.profileSmooth = this.profileSmooth;
            dto.topSvgId = this.topSvgId;
            return dto;
        }

        setDiffuseColor(rgb: number[]) {
            vec3.set(this.diffuseColor, rgb[0], rgb[1], rgb[2]);
            this.sd.material.setDiffuse(rgb[0], rgb[1], rgb[2]);
        }

        setSelected(b: boolean) {
            //if (b)
            //    this.sd.material.setDiffuse(1, 0, 0);
            //else
            this.sd.material.setDiffuse(this.diffuseColor[0], this.diffuseColor[1], this.diffuseColor[2]);
        }

        setProfileHeight(height: number) {
            var newBounds = vec4.fromValues(-this.top.distanceField.maxDepth, 0, 0, height);
            //var newBounds = vec4.fromValues(this.profileBounds[0],this.profileBounds[1],this.profileBounds[2], height);

            this.scaleProfilePoints(newBounds);
        }

        scaleProfilePoints(newBounds: Float32Array) {
            //console.log('new bounds : ' + vec4.str(newBounds));

            for (var i = 0; i < this.profilePoints.length; ++i) {
                var dx = (this.profilePoints[i][0] - this.profileBounds[0]) / (this.profileBounds[2] - this.profileBounds[0]);
                var dy = (this.profilePoints[i][1] - this.profileBounds[1]) / (this.profileBounds[3] - this.profileBounds[1]);

                this.profilePoints[i][0] = newBounds[0] + dx * (newBounds[2] - newBounds[0]);
                this.profilePoints[i][1] = newBounds[1] + dy * (newBounds[3] - newBounds[1]);
            }

            vec4.copy(this.profileBounds, newBounds);

            this.setProfilePoints(this.profilePoints);
        }

        setProfilePoints(points: number[][]) {
            /*
            console.log('setProfilePoints');
            console.log('profileBounds ' + vec4.str(this.profileBounds));
            console.log('profilePoints ' + JSON.stringify(this.profilePoints));
            */
            this.profilePoints = points;
            // update canvas width and height
            var boundW = this.profileBounds[2] - this.profileBounds[0];
            var boundH = this.profileBounds[3] - this.profileBounds[1];
            var canvasWidth = 400;
            var canvasHeight = 400;
            if (boundH > boundW)
                canvasWidth = canvasHeight * boundW / boundH;
            else
                canvasHeight = canvasWidth * boundH / boundW;

            this.tmpProfileCanvas.width = canvasWidth;
            this.tmpProfileCanvas.height = canvasHeight;

            var ctx = this.tmpProfileCanvas.getContext('2d');
            ctx.clearRect(0, 0, this.tmpProfileCanvas.width, this.tmpProfileCanvas.height);

            // convert profile points to pixels
            var canvasPoints = [];
            var profileBounds = this.profileBounds;
            for (var j = 0; j < this.profilePoints.length; ++j) {
                var x = this.profilePoints[j][0];
                var y = this.profilePoints[j][1];

                var px = (x - profileBounds[0]) / (profileBounds[2] - profileBounds[0]) * this.tmpProfileCanvas.width;
                var py = this.tmpProfileCanvas.height - (y - profileBounds[1]) / (profileBounds[3] - profileBounds[1]) * this.tmpProfileCanvas.height;

                canvasPoints.push([px, py]);
            }

            // draw bspline
            if (this.profileSmooth)
                this.bsplineDrawer.drawSpline(canvasPoints, this.tmpProfileCanvas);
            else
                this.lineDrawer.drawLine(canvasPoints, this.tmpProfileCanvas);

            // draw for distance field
            this.profile.drawUserCanvasForProfile(this.tmpProfileCanvas, this.profileBounds, 0.1);
            this.profile.update();

        }

        setTopSrc(src: string, bounds: Float32Array, done: () => void) {
            var img = new Image();
            img.onload = () => {
                this.setTopImg2(img, bounds);
                done();
            };
            img.src = src;
        }

        setTopImg2(img: HTMLCanvasElement | HTMLImageElement, bounds: Float32Array) {
            this.top.drawUserCanvasForTop(img, bounds, 0.1);
            this.top.update();

            //$('.debug').append(this.top.canvas);
            //this.profile.debugInfoInCanvas();
            //$(".debug")[0].appendChild(this.profile.canvas);
        }

        updateInverseTransform() {
            mat4.copy(this.sd.inverseTransform, this.inverseTransform);
        }

        /*
        updateSignedDistance()
        {
            this.sd.init(
                this.top.floatTexture, vec4.fromValues(0,0,1,1), this.top.totalBounds,
                this.profile.floatTexture, vec4.fromValues(0,0,1,1), this.profile.totalBounds);
            mat4.copy(this.sd.inverseTransform, this.inverseTransform);
        }
        */

        updateSignedDistanceWithSprites(topSprite: textureSprite, profileSprite: textureSprite) {
            this.sd.init(
                topSprite.bigTexture, topSprite.bounds, this.top.totalBounds,
                profileSprite.bigTexture, profileSprite.bounds, this.profile.totalBounds);
            mat4.copy(this.sd.inverseTransform, this.inverseTransform);
        }

        setIsHole(isHole: boolean) {
            this.isHole = isHole;
        }

        getAbsoluteCenter(out: Float32Array) {
            var bounds = this.top.totalBounds;
            mat4.invert(this.tmpTransform, this.inverseTransform);

            vec3.set(out,
                0.5 * (bounds[2] + bounds[0]),
                0.5 * (bounds[3] + bounds[1]),
                0.5 * (this.profileBounds[3] + this.profileBounds[1]));

            vec3.transformMat4(out, out, this.tmpTransform);
        }

        getAbsoluteTopCenter(out: Float32Array) {
            var bounds = this.top.totalBounds;
            mat4.invert(this.tmpTransform, this.inverseTransform);

            vec3.set(out,
                0.5 * (bounds[2] + bounds[0]),
                0.5 * (bounds[3] + bounds[1]),
                this.profileBounds[3]);

            vec3.transformMat4(out, out, this.tmpTransform);
        }

        getAbsoluteBottomCenter(out: Float32Array) {
            var bounds = this.top.totalBounds;
            mat4.invert(this.tmpTransform, this.inverseTransform);

            vec3.set(out,
                0.5 * (bounds[2] + bounds[0]),
                0.5 * (bounds[3] + bounds[1]),
                this.profileBounds[1]);

            vec3.transformMat4(out, out, this.tmpTransform);
        }

        getAbsoluteBounds(outMin: Float32Array, outMax: Float32Array) {
            var bounds = this.top.totalBounds;
            mat4.invert(this.tmpTransform, this.inverseTransform);

            vec3.set(outMin,
                bounds[0],
                bounds[1],
                this.profileBounds[1]);

            vec3.transformMat4(outMin, outMin, this.tmpTransform);

            vec3.set(outMax,
                bounds[2],
                bounds[3],
                this.profileBounds[3]);

            vec3.transformMat4(outMax, outMax, this.tmpTransform);
        }
    }
}


text:
package org.xmlcml.ami2.plugins.word;

import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.xmlcml.cmine.files.ResultContainerElement;
import org.xmlcml.cmine.files.ResultsElementList;

public class WordResultsElementList extends ResultsElementList {

	private static final Logger LOG = Logger
			.getLogger(WordResultsElementList.class);
	static {
		LOG.setLevel(Level.DEBUG);
	}

	public WordResultsElementList() {
		super();
	}

	public int getSingleCountsOfWord(String word) {
		int count = 0;
		for (ResultContainerElement resultsElement : resultsElementList) {
			WordResultsElement wordResultsElement = (WordResultsElement) resultsElement;
			if (wordResultsElement.contains(word)) count++;
		}
		return count;
	}

}


text:
/* deviceCode/Server-ID */
TD#serverId        {
    text-align: left;
}

/* Account */
TD#accountId        {
    text-align: left;
}
TD#accountDesc      {
    text-align: left;
}
TD#accountActive    {
    text-align: center;
}
TD#deviceCount      {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#privateLabel     {
    text-align: center;
}

/* User */
TD#userId           {
    text-align: left;
}
TD#userDesc        {
    text-align: left;
}

/* Device */
TD#deviceId        {
    text-align: left;
}
TD#deviceDesc      {
    text-align: left;
}
TD#deviceBattery {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}

/* Driver */
TD#driverBadge   {
    text-align: left;
}
TD#driverLicense   {
    text-align: left;
}
TD#driverLicenseExp {
    font-family: monospace;
    padding-top: 2px;
}
TD#driverBirthdate {
    font-family: monospace;
    padding-top: 2px;
}

/* VehicleID */
TD#vehicleId       {
    text-align: left;
}

/* Driver */
TD#driverId        {
    text-align: left;
}
TD#driverDesc      {
    text-align: left;
}
TD#driverBadge      {
    text-align: left;
}

/* Equipment Type */
TD#equipmentType   {
    text-align: left;
}

/* Group */
TD#groupId         {
    text-align: left;
}

/* Entity */
TD#entityId        {
    text-align: left;
}
TD#entityDesc      {
    text-align: left;
}

/* Event time */
TD#date            {
    font-family: monospace;
    padding-top: 2px;
}
TD#time            {
    font-family: monospace;
    padding-top: 2px;
}
TD#dateTime        {
    font-family: monospace;
    padding-top: 2px;
}
TD#timestamp       {
    font-family: monospace;
    padding-top: 2px;
}

/* Create/Insert time */
TD#createDate      {
    font-family: monospace;
    padding-top: 2px;
}
TD#createTime      {
    font-family: monospace;
    padding-top: 2px;
}
TD#createDateTime  {
    font-family: monospace;
    padding-top: 2px;
}
TD#createTimestamp {
    font-family: monospace;
    padding-top: 2px;
}

/* "Start" times */
TD#startTimestamp  {
    font-family: monospace;
    padding-top: 2px;
}
TD#startDateTime   {
    font-family: monospace;
    padding-top: 2px;
}
TD#enterTimestamp  {
    font-family: monospace;
    padding-top: 2px;
}
TD#enterDateTime   {
    font-family: monospace;
    padding-top: 2px;
}

/* "Stop" times */
TD#stopTimestamp  {
    font-family: monospace;
    padding-top: 2px;
}
TD#stopDateTime   {
    font-family: monospace;
    padding-top: 2px;
}
TD#exitTimestamp  {
    font-family: monospace;
    padding-top: 2px;
}
TD#exitDateTime   {
    font-family: monospace;
    padding-top: 2px;
}

/* GeoPoint */
TD#latitude       {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#longitude      {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#geoPoint       {
    font-family: monospace;
    padding-top: 2px;
}

/* Speed */
TD#speedLimit     {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#speed          {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#speedh         {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#speedu         {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}

/* Altitude */
TD#altitude       {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}

/* Odometer */
TD#odometer        {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#startOdometer    {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#odomDelta       {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#odomDeltaWH     {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#odomDeltaNWH     {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#odomDeltaAH     {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}

/* Address */
TD#address         {
    text-align: left;
    width: 200px;
}

/* Geozone */
TD#geozoneId       {
    text-align: left;
}

/* Counters */
TD#utilization     {
    text-align: right; monospace;
    padding-top: 2px;
}
TD#count           {
    text-align: right; monospace;
    padding-top: 2px;
}
TD#eventsReceived  {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}

/* Connections */
TD#tcpConnections  {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#udpConnections  {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#connections     {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}

/* Data transfer */
TD#bytesRead       {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#bytesWritten    {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#bytesOverhead   {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#bytesTotal      {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#bytesRounded    {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}

/* Elapsed time */
TD#elapsed         {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#insideElapse    {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#outsideElapse   {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#drivingElapse   {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#drivingElapseWH {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#drivingElapseNWH {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#drivingElapseAH {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#stopElapse      {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#stopCount      {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#stopCountWH    {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#stopCountNWH    {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#stopCountAH    {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#idleElapse      {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}

/* Device check-in */
TD#checkinDateTime {
    font-family: monospace;
    padding-top: 2px;
}
TD#checkinAge      {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#lastIPAddress   {
    font-family: monospace;
    padding-top: 2px;
}

/* Device codeVersion */
TD#codeVersion   {
    font-family: monospace;
    padding-top: 2px;
}

/* Account login */
TD#loginDateTime {
    font-family: monospace;
    padding-top: 2px;
}
TD#loginAge      {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}

/* Properties */
TD#propertyDesc    {
    text-align: left;
}
TD#propertyValue   {
    font-family: monospace;
    padding-top: 2px;
    text-align: left;
}

/* Diagnostics */
TD#diagKey         {
    font-family: monospace;
    padding-top: 2px;
    text-align: left;
}
TD#diagDesc {
    text-align: left;
}
TD#diagValue {
    font-family: monospace;
    padding-top: 2px;
    text-align: left;
}

/* Hours */
TD#engineHours {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#idleHours {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#workHours {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#ptoHours {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#serviceLastHR {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#serviceIntervalHR {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#serviceNextHR {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#serviceRemainingHR {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}

/* Fuel */
TD#fuelCapacity {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#fuelTotal {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#fuelLevel {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#fuelTrip {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#fuelTripWH {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#fuelTripNWH {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#fuelTripAH {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#fuelIdle {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#fuelIdleWH {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#fuelIdleNWH {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#fuelIdleAH {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#fuelWork    {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#fuelPTO    {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#fuelEconomy    {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}

/* Stop location */
TD#stopLatitude    {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#stopLongitude   {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#stopGeoPoint    {
    font-family: monospace;
    padding-top: 2px;
}
TD#stopOdometer    {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#stopAddress     {
    text-align: left;
    width: 200px;
}

/* Periodic Maintenance */
TD#serviceLast     {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#serviceNext     {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#serviceRemaining {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#serviceInterval {
    font-family: monospace;
    padding-top: 2px;
    text-align: right;
}
TD#serviceNotes    {
    text-align: left;
    width: 200px;
}

/* Job Number */
TD#jobNumber  {
    font-family: monospace;
    padding-top: 2px;
    text-align: center;
}

/* Custom Attributes */
TD#customField  {
    text-align: center;
}

/* blank */
TD#blankSpace {
    font-family: monospace;
    text-align: left;
    width: 150px;
}


text:
package main

import (
	"github.com/gorilla/mux"
	"github.com/syndtr/goleveldb/leveldb"
	"io/ioutil"
	"log"
	"net/http"

	"./api"
	"./auth"
	"./config"
	"./dynamic"
	"./events"
	"./fs"
	"./js"
	"./websocket"
)

var jsEngine *js.JSEngine = nil
var db *leveldb.DB = nil
var eventManager *events.EventManager = nil

func SetUpLevelDB(path string) {
	db_, err := leveldb.OpenFile(path, nil)
	if err != nil {
		log.Fatal("Leveldb: " + err.Error())
	}
	db = db_
}

func SetUpOtto(codeFile string) {
	jsEngine = js.CreateOtto()
	eventManager = events.NewEventManager()
	js.InjectLevelDB(jsEngine, db)
	fs.InjectIntoOtto(jsEngine)
	events.InjectIntoOtto(jsEngine, eventManager)
	backendCode, e := ioutil.ReadFile(codeFile)
	if e != nil {
		log.Fatal("Need " + codeFile)
	}
	_, e = jsEngine.Run(string(backendCode))
	if e != nil {
		log.Fatal("Error in backendjs:" + e.Error())
	}
}

func SetUpAPI(endpoints []config.Endpoint) *mux.Router {
	router := mux.NewRouter()
	router.StrictSlash(true)
	for _, endpoint := range endpoints {
		r := router.PathPrefix("/api" + endpoint.Url)
		api.BuildEndpoint(r, endpoint.Model, jsEngine, db)
	}
	return router
}

func main() {
	log.SetFlags(log.Lshortfile | log.LstdFlags)

	cfg := config.Load("./config.json")

	SetUpLevelDB(cfg.DB)
	SetUpOtto(cfg.JSBase)

	websocket.Setup(eventManager)

	authRouter := auth.SetupAuth("passwords.gob")
	err := auth.AddUser("root", "root@localhost", "toor", "admin")
	if err != nil {
		log.Fatal(err.Error())
	}

	http.Handle("/auth/", authRouter)

	apiRouter := SetUpAPI(cfg.Endpoints)
	http.Handle("/api/", apiRouter)

	http.Handle("/assets/", http.StripPrefix("/assets/", http.FileServer(http.Dir(cfg.Assets))))
	http.HandleFunc("/", dynamic.BuildHandler(jsEngine))

	if cfg.CertFile != "" && cfg.KeyFile != "" {
		log.Println("starting TLS secured server on", cfg.Address)
		log.Fatal(http.ListenAndServeTLS(cfg.Address, cfg.CertFile, cfg.KeyFile, nil))
	} else {
		log.Println("starting server on", cfg.Address)
		log.Fatal(http.ListenAndServe(cfg.Address, nil))
	}
}


text: create table sa.t(a int, b int);


text:
package com.android.tools.idea.ui.properties.expressions.string;

import com.android.tools.idea.ui.properties.BindingsManager;
import com.android.tools.idea.ui.properties.core.BoolValueProperty;
import com.android.tools.idea.ui.properties.core.IntValueProperty;
import com.android.tools.idea.ui.properties.core.StringValueProperty;
import org.junit.Test;

import static com.android.tools.idea.ui.properties.BindingsManager.INVOKE_IMMEDIATELY_STRATEGY;
import static org.fest.assertions.Assertions.assertThat;

public final class StringExpressionsTest {

  @Test
  public void testFormatStringExpression() throws Exception {
    IntValueProperty arg1 = new IntValueProperty(42);
    BoolValueProperty arg2 = new BoolValueProperty(true);
    StringValueProperty destValue = new StringValueProperty();
    BindingsManager bindings = new BindingsManager(INVOKE_IMMEDIATELY_STRATEGY);

    bindings.bind(destValue, new FormatExpression("The answer is %1$s. Hitchhiker reference? %2$s", arg1, arg2));

    assertThat(destValue.get()).isEqualTo("The answer is 42. Hitchhiker reference? true");

    arg1.set(2);
    arg2.set(false);

    assertThat(destValue.get()).isEqualTo("The answer is 2. Hitchhiker reference? false");
  }

  @Test
  public void testTrimExpression() throws Exception {
    StringValueProperty srcValue = new StringValueProperty();
    StringValueProperty destValue = new StringValueProperty();
    BindingsManager bindings = new BindingsManager(INVOKE_IMMEDIATELY_STRATEGY);

    bindings.bind(destValue, srcValue.trim());
    assertThat(destValue.get()).isEmpty();

    srcValue.set("    Preceded by whitespace");
    assertThat(destValue.get()).isEqualTo("Preceded by whitespace");

    srcValue.set(" Surrounded by whitespace ");
    assertThat(destValue.get()).isEqualTo("Surrounded by whitespace");

    srcValue.set("    ");
    assertThat(destValue.get()).isEmpty();

    srcValue.set(" \t  \n ");
    assertThat(destValue.get()).isEmpty();
  }
}


text:
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;

namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
{
    public class SliderCircleSelectionBlueprint : OsuSelectionBlueprint<Slider>
    {
        protected readonly HitCirclePiece CirclePiece;

        private readonly SliderPosition position;

        public SliderCircleSelectionBlueprint(DrawableSlider slider, SliderPosition position)
            : base(slider)
        {
            this.position = position;
            InternalChild = CirclePiece = new HitCirclePiece();

            Select();
        }

        protected override void Update()
        {
            base.Update();

            CirclePiece.UpdateFrom(position == SliderPosition.Start ? HitObject.HeadCircle : HitObject.TailCircle);
        }

        // Todo: This is temporary, since the slider circle masks don't do anything special yet. In the future they will handle input.
        public override bool HandlePositionalInput => false;
    }
}


text:
package fr.elongeau.bank.account.docs;

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

import java.util.Set;

import static org.assertj.core.api.Assertions.assertThat;

public class LivingDocClassParserTest {

    private LivingDocClassParser parser;

    @Before
    public void setUp() throws Exception {
        parser = new LivingDocClassParser();
    }

    @Test
    public void should_only_find_domain_classes() throws Exception {
        // When
        final Set<Class<?>> classes = parser.domainClass();

        // Then
        assertThat(classes).extracting(Class::getSimpleName)
                           .contains(
                                   "User",
                                   "Entity",
                                   "UseCase"
                                    )
                           .doesNotContain
                                   ("UserCreation","UserTest");
    }

    @Test
    public void should_only_find_not_domain_classes() throws Exception {
        // When
        final Set<Class<?>> classes = parser.notDomainClass();

        // Then
        assertThat(classes).extracting(Class::getSimpleName)
                           .doesNotContain(
                                   "User",
                                   "Entity",
                                   "UseCase","FakeEvent1","UserEndPointTest"
                                    )
                           .contains
                                   ("UserCreation");
    }
}


text:
using System.Security.Principal;
using System.Web;
using Moq;
using NuGetGallery.Framework;
using Xunit;

namespace NuGetGallery.Controllers
{
    public class JsonApiControllerFacts
    {
        public class TheAddPackageOwnerMethod : TestContainer
        {
            [Fact]
            public void ReturnsFailureWhenPackageNotFound()
            {
                var controller = GetController<JsonApiController>();

                dynamic result = controller.AddPackageOwner("foo", "steve");

                Assert.False(result.success);
                Assert.Equal("Package not found", result.message);
            }

            [Fact]
            public void DoesNotAllowNonPackageOwnerToAddPackageOwner()
            {
                var controller = GetController<JsonApiController>();
                GetMock<IPackageService>()
                    .Setup(svc => svc.FindPackageRegistrationById("foo"))
                    .Returns(new PackageRegistration());

                dynamic result = controller.AddPackageOwner("foo", "steve");

                Assert.False(result.success);
                Assert.Equal("You are not the package owner.", result.message);
            }

            [Fact]
            public void ReturnsFailureWhenRequestedNewOwnerDoesNotExist()
            {
                var controller = GetController<JsonApiController>();
                GetMock<HttpContextBase>()
                    .Setup(c => c.User)
                    .Returns(Fakes.Owner.ToPrincipal());

                dynamic result = controller.AddPackageOwner(Fakes.Package.Id, "notARealUser");

                Assert.False(TestUtility.GetAnonymousPropertyValue<bool>(result, "success"));
                Assert.Equal("Owner not found", TestUtility.GetAnonymousPropertyValue<string>(result, "message"));
            }

            [Fact]
            public void CreatesPackageOwnerRequestSendsEmailAndReturnsPendingState()
            {
                var controller = GetController<JsonApiController>();
                GetMock<HttpContextBase>()
                    .Setup(c => c.User)
                    .Returns(Fakes.Owner.ToPrincipal());

                GetMock<IPackageService>()
                    .Setup(p => p.CreatePackageOwnerRequest(Fakes.Package, Fakes.Owner, Fakes.User))
                    .Returns(new PackageOwnerRequest { ConfirmationCode = "confirmation-code" });

                dynamic result = controller.AddPackageOwner(Fakes.Package.Id, Fakes.User.Username);

                Assert.True(result.success);
                Assert.Equal(Fakes.User.Username, result.name);
                Assert.True(result.pending);

                GetMock<IMessageService>()
                    .Verify(m => m.SendPackageOwnerRequest(
                        Fakes.Owner,
                        Fakes.User,
                        Fakes.Package,
                        "https://nuget.local/packages/FakePackage/owners/testUser/confirm/confirmation-code"));
            }
        }
    }
}


text:
'use strict';
Connector.playerSelector = '#app';
Connector.trackSelector = '[class*=music-player_metaInner_] .title';
Connector.artistSelector = '[class*=music-player_metaInner_] .artist';
Connector.trackArtSelector = 'img[class*=_base-resource-image_image_]';
Connector.isPlaying = () => Util.getAttrFromSelectors('[class*=music-player_play_] > svg > use', 'xlink:href') === '#icon-pause';


text:
import player
from player import Mp3Player, PlayerListener
import time
import requests
from requests.exceptions import ConnectionError

class Popmuzik():

    class Mp3Listener(PlayerListener):
        def __init__(self, popmuzik):
            self.__popmuzik = popmuzik
        def onStop(self):
            self.__popmuzik.onStop()

    def __init__(self):
        self.__player = player.Mp3Player()
        self.__listener = Popmuzik.Mp3Listener(self)
        self.__player.attachListener(self.__listener)

    def requestSong(self):
        try:
            r = requests.get('http://localhost:8000/songs/next')
            if r.status_code == 200:
                song_json = r.json()
                if 'path' in song_json:
                    self.__player.play(song_json['path'])
            else:
                self.onFetchingFail()
        except ConnectionError:
            self.onFetchingFail()

    def onFetchingFail(self):
        time.sleep(10)
        self.requestSong()

    def start(self):
        self.requestSong()

    def onStop(self):
        self.__player.shutdown()
        self.requestSong()

if __name__ == '__main__':
    pop = Popmuzik()
    pop.start()


text:
using Abp.Dependency;
using Abp.Net.Remoting;
using Abp.Net.Remoting.Args;
using Abp.Serialization;
using BodeAbp.Queue.Broker.Client;
using System.Text;

namespace BodeAbp.Queue.Broker.RequestHandlers
{
    public class ProducerHeartbeatRequestHandler : IRequestHandler
    {
        private ProducerManager _producerManager;
        private ISerializer<byte[]> _binarySerializer;

        public ProducerHeartbeatRequestHandler(BrokerController brokerController)
        {
            _producerManager = IocManager.Instance.Resolve<ProducerManager>();
            _binarySerializer = IocManager.Instance.Resolve<ISerializer<byte[]>>();
        }

        public RemotingResponse HandleRequest(IRequestHandlerContext context, RemotingRequest remotingRequest)
        {
            var producerId = Encoding.UTF8.GetString(remotingRequest.Body);
            _producerManager.RegisterProducer(producerId, context.Connection);
            return null;
        }
    }
}


text:
**All issues and pull requests should be filed on the https://github.com/MaggieCabrera/w40krules repository.**

### License

This project is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)


text:
package org.openksavi.sponge.integration.tests.java.examples;

import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;

import org.openksavi.sponge.event.Event;
import org.openksavi.sponge.examples.SampleJavaTrigger;
import org.openksavi.sponge.java.JKnowledgeBase;
import org.openksavi.sponge.java.JTrigger;

/**
 * Sponge Knowledge Base. Triggers - Generating events and using triggers.
 */
public class Triggers extends JKnowledgeBase {

    @Override
    public void onInit() {
        // Variables for assertions only
        getSponge().setVariable("receivedEventA", new AtomicBoolean(false));
        getSponge().setVariable("receivedEventBCount", new AtomicInteger(0));
        getSponge().setVariable("receivedEventTestJavaCount", new AtomicInteger(0));
    }

    public static class TriggerA extends JTrigger {

        @Override
        public void onConfigure() {
            withEvent("a");
        }

        @Override
        public void onRun(Event event) {
            getLogger().debug("Received event {}", event);
            getSponge().getVariable(AtomicBoolean.class, "receivedEventA").set(true);
        }
    }

    public static class TriggerB extends JTrigger {

        @Override
        public void onConfigure() {
            withEvent("b");
        }

        @Override
        public void onRun(Event event) {
            getLogger().debug("Received event {}", event);
            AtomicInteger receivedEventBCount = getSponge().getVariable(AtomicInteger.class, "receivedEventBCount");
            if (receivedEventBCount.get() == 0) {
                getLogger().debug("Statistics: {}", getSponge().getStatisticsSummary());
            }
            receivedEventBCount.incrementAndGet();
        }
    }

    @Override
    public void onLoad() {
        getSponge().enableJava(SampleJavaTrigger.class);
    }

    @Override
    public void onStartup() {
        getLogger().debug("Startup {}, triggers: {}", getSponge().getInfo(), getSponge().getEngine().getTriggers());
        getLogger().debug("Knowledge base name: {}", getSponge().getKb().getName());
        getSponge().event("a").send();
        getSponge().event("b").sendAfter(200, 200);
        getSponge().event("testJava").send();
    }

    @Override
    public void onShutdown() {
        getLogger().debug("Shutting down");
    }
}


text:
extern struct poptOption lace_options[];

extern struct poptOption options[];

extern int REL_PERF;

extern int MAYBE_AND_FALSE_IS_FALSE;

typedef enum {
    BFS_P,
    BFS,
#ifdef HAVE_SYLVAN
    PAR,
    PAR_P,
#endif
    CHAIN_P,
    CHAIN,
    NONE
} strategy_t;

extern strategy_t strategy;

typedef enum { NO_SAT, SAT_LIKE, SAT_LOOP, SAT_FIX, SAT } sat_strategy_t;

extern sat_strategy_t sat_strategy;

typedef enum { UNGUIDED, DIRECTED } guide_strategy_t;

extern guide_strategy_t guide_strategy;

extern char** ctl_star_formulas;
extern char** ctl_formulas;
extern char** ltl_formulas;
extern int num_ctl_star;
extern int num_ctl;
extern int num_ltl;
extern char** mu_formulas;
extern int num_mu;
extern int num_total;
extern int mu_par;
extern int mu_opt;

extern char* dot_dir;

extern char* trc_output;
extern char* trc_type;
extern int   dlk_detect;
extern char* act_detect;
extern char** inv_detect;
extern int   num_inv;
extern int   no_exit;
extern int   no_matrix;
extern int   peak_nodes;
extern int   no_soundness_check;
extern int   act_index;
extern int   act_label;
extern int   action_typeno;
extern int   ErrorActions; // count number of found errors (action/deadlock/invariant)
extern int   precise;
extern int   next_union;

extern int   sat_granularity;
extern int   save_sat_levels;

extern int   pgsolve_flag;
extern char* pg_output;

extern int inv_par;
extern int inv_bin_par;

extern size_t lace_n_workers;
extern size_t lace_dqsize; // can be very big, no problemo
extern size_t lace_stacksize; // use default

#endif


text:
'use strict';

angular.module('espaceClasse.classroom')

    .controller('ClassroomController', function ($scope, $rootScope, StorageService) {
        $rootScope.pageTitle = 'Classrooms';

        var SEATS_DEFAULT = [];
        for (let row = 0; row < 5; row += 1) {
            SEATS_DEFAULT[row] = [];

            for (let seat = 0; seat < 10; seat += 1) {
                SEATS_DEFAULT[row][seat] = {};
            }
        }

        $scope.classes = StorageService.getItem('classes', []);
        $scope.indexedClasses = {};
        for (let i = 0; i < $scope.classes.length; i += 1) {
            $scope.indexedClasses[$scope.classes[i].id] = $scope.classes[i];
        }

        $scope.classrooms = StorageService.getItem('classrooms', []);
        $scope.$watch('classrooms', function () {
            StorageService.setItem('classrooms', $scope.classrooms);
        }, true);

        $scope.addClassroom = function () {
            $scope.classrooms.push({
                id: $scope.classrooms.length > 0 ? $scope.classrooms[$scope.classrooms.length - 1].id + 1 : 0,
                name: 'New classroom',
                seats: JSON.parse(JSON.stringify(SEATS_DEFAULT))
            });
            $scope.selectClassroom($scope.classrooms.length - 1);
        };

        $scope.currentClassroom = null;
        $scope.indexedStudents = [];
        $scope.$watch('currentClassroom', function () {
            if ($scope.currentClassroom != null) {
                let currentClass = $scope.indexedClasses[$scope.currentClassroom.classeId];
                if (currentClass != null) {
                    for (let i = 0; i < currentClass.students.length; i += 1) {
                        $scope.indexedStudents[currentClass.students[i].id] = currentClass.students[i];
                    }
                }
            }
        });
        $scope.selectClassroom = function (classIndex) {
            $scope.currentClassroom = $scope.classrooms[classIndex];
        };

        $scope.currentClassroomDelete = null;
        $scope.openDeleteCurrentClassroomModal = function () {
            $scope.currentClassroomDelete = $scope.currentClassroom;
        };
        $scope.deleteCurrentClassroom = function () {
            $scope.classrooms.splice($scope.classrooms.map(function (e) {
                return e.id;
            }).indexOf($scope.currentClassroomDelete.id), 1);
            $scope.currentClassroom = null;
            $scope.currentClassroomDelete = null;
        };
        $scope.cancelDeleteCurrentClassroom = function () {
            $scope.currentClassroomDelete = null;
        };
    });


text:
<title>Target Format Checks - Using the GNU Compiler Collection (GCC)</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Using the GNU Compiler Collection (GCC)">
<meta name="generator" content="makeinfo 4.7">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="C-Extensions.html#C-Extensions" title="C Extensions">
<link rel="prev" href="Target-Builtins.html#Target-Builtins" title="Target Builtins">
<link rel="next" href="Pragmas.html#Pragmas" title="Pragmas">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">

<meta http-equiv="Content-Style-Type" content="text/css">

Next: Pragmas,
Previous: Target Builtins,
Up: C Extensions

5.51 Format Checks Specific to Particular Target Machines

For some target machines, GCC supports additional options to the
format attribute
(see Declaring Attributes of Functions).

Solaris Format Checks


text:
package org.apache.spark.ml

import org.apache.spark.ml.param.ParamMap
import org.apache.spark.sql.{DataFrame, Dataset}
import org.apache.spark.sql.types.StructType

/**
 * A wrapper for org.apache.spark.ml.Transformer.
 * Extends MlTransformer and override process to gain compatibility with
 * both spark 1.5 and spark 2.0.
 */
private[ml] abstract class DLTransformerBase
  extends Model[DLTransformerBase] with DLParams {

  protected def internalTransform(dataset: DataFrame): DataFrame

  override def transform(dataset: Dataset[_]): DataFrame = {
    transformSchema(dataset.schema, logging = true)
    internalTransform(toArrayType(dataset.toDF()))
  }

  override def transformSchema(schema : StructType): StructType = {
    validateAndTransformSchema(schema)
  }

  override def copy(extra: ParamMap): DLTransformerBase = defaultCopy(extra)

}


text:
AliAnalysisTaskFemto *AddTaskFemto(TString configMacroName, TString containerName="femtolist", TString configMacroParameters="" )
{
// Creates a proton analysis task and adds it to the analysis manager.

  // A. Get the pointer to the existing analysis manager via the static access method.
  //==============================================================================
  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
  if (!mgr) {
    Error("AddTaskFemto", "No analysis manager to connect to.");
    return NULL;
  }

  // B. Check the analysis type using the event handlers connected to the analysis
  //    manager. The availability of MC handler cann also be checked here.
  //==============================================================================
  if (!mgr->GetInputEventHandler()) {
    ::Error("AddTaskFemto", "This task requires an input event handler");
    return NULL;
  }
  TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
  cout << "Found " <<type << " event handler" << endl;

  // C. Create the task, add it to manager.
  //===========================================================================
//  gSystem->SetIncludePath("-I$ROOTSYS/include  -I./PWG2AOD/AOD -I./PWG2femtoscopy/FEMTOSCOPY/AliFemto -I./PWG2femtoscopyUser/FEMTOSCOPY/AliFemtoUser -I$ALICE_PHYSICS/include");

  if (TProofMgr::GetListOfManagers()->GetEntries()) {
//     if (dynamic_cast<TProofLite *> gProof) {
//       char *macrocommand[10000];
//       sprintf(macrocommand, ".L %s", configMacroName);
//       gProof->Exec(macrocommand);
//     }
//     else
    gProof->Load(configMacroName);
  }
  //  gROOT->LoadMacro("ConfigFemtoAnalysis.C++");

  AliAnalysisTaskFemto *taskfemto = new AliAnalysisTaskFemto("TaskFemto",configMacroName,configMacroParameters,kFALSE);
  //TFile *file = TFile::Open("alien:///alice/cern.ch/user/m/majanik/2015/DEtaDPhi/Trains/Corrections/CorrectionFiles/AnalysisNote/1Dmap_FB96_MCOnlyLHC10f6a_Exclusive2Rej3.root");
  //taskfemto->Set1DCorrectionsPions((TH1D*) file->Get("CorrectionFactorPtEffandContPion"));
  //taskfemto->Set1DCorrectionsKaons((TH1D*) file->Get("CorrectionFactorPtEffandContKaon"));
  //taskfemto->Set1DCorrectionsProtons((TH1D*) file->Get("CorrectionFactorPtEffandContProton"));
  //taskfemto->Set1DCorrectionsAll((TH1D*) file->Get("CorrectionFactorPtEffandContAll"));
  //taskfemto->Set1DCorrectionsLambdas((TH1D*) file->Get("CorrectionFactorPtEffandContAll"));

  mgr->AddTask(taskfemto);

  // D. Configure the analysis task. Extra parameters can be used via optional
  // arguments of the AddTaskXXX() function.
  //===========================================================================

  // E. Create ONLY the output containers for the data produced by the task.
  // Get and connect other common input/output containers via the manager as below
  //==============================================================================
  TString outputfile = AliAnalysisManager::GetCommonFileName();
  outputfile += ":PWG2FEMTO";
  AliAnalysisDataContainer *cout_femto  = mgr->CreateContainer(containerName,  TList::Class(),
  							       AliAnalysisManager::kOutputContainer,outputfile);

   mgr->ConnectInput(taskfemto, 0, mgr->GetCommonInputContainer());
   mgr->ConnectOutput(taskfemto, 0, cout_femto);

   // Return task pointer at the end
   return taskfemto;
}


text:
@protocol RTCellHeight <NSObject>

+ (CGFloat)heightFromCellContent:(id)content;

@end

@interface RTBaseAdapterTableViewCell : UITableViewCell<RTCellHeight>

@property (assign, nonatomic) BOOL isLast;
@property (assign, nonatomic) BOOL isFirst;

- (void)cellContent:(id)content;

@end


text:
<?php
/**
 * User: casperlai
 * Date: 2016/9/18
 * Time: 下午9:56
 */

namespace Casperlaitw\LaravelFbMessenger\Messages;

use Casperlaitw\LaravelFbMessenger\Contracts\Messages\Message;

/**
 * Class QuickReply
 * @package Casperlaitw\LaravelFbMessenger\Messages
 */
class QuickReply extends Message
{
    /**
     * Text type
     */
    const TYPE_TEXT = 'text';

    /**
     * Location type
     */
    const TYPE_LOCATION = 'location';

    /**
     * @var string
     */
    private $title;

    /**
     * @var string
     */
    private $payload;

    /**
     * @var string
     */
    private $type;

    /**
     * @var string
     */
    private $imageUrl;

    /**
     * QuickReply constructor.
     *
     * @param $title
     * @param $payload
     */
    public function __construct($title, $payload)
    {
        parent::__construct(null);
        $this->title = $title;
        $this->payload = $payload;
        $this->type = self::TYPE_TEXT;
    }

    /**
     * Set location quick reply
     *
     * @return $this
     */
    public function setLocation()
    {
        $this->type = self::TYPE_LOCATION;

        return $this;
    }

    /**
     * Set image url
     *
     * @param $image
     *
     * @return $this
     */
    public function setImage($image)
    {
        $this->imageUrl = $image;

        return $this;
    }

    /**
     * To array for send api
     * @return array
     */
    public function toData()
    {
        if ($this->type === self::TYPE_LOCATION) {
            return ['content_type' => 'location'];
        }

        return array_merge([
            'content_type' => 'text',
            'title' => $this->title,
            'payload' => $this->payload,
        ], $this->imageUrl ? ['image_url' => $this->imageUrl] : []);
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>E-Index</title>
<meta name="date" content="2017-04-06">
<link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Letter

Next Letter

Frames

No Frames

All Classes

A B C D E F G H I J K L M N P Q R S T V W X Z

E

edu.asu.zoophy.rest - package edu.asu.zoophy.rest

edu.asu.zoophy.rest.database - package edu.asu.zoophy.rest.database

edu.asu.zoophy.rest.genbank - package edu.asu.zoophy.rest.genbank

edu.asu.zoophy.rest.index - package edu.asu.zoophy.rest.index

edu.asu.zoophy.rest.pipeline - package edu.asu.zoophy.rest.pipeline

edu.asu.zoophy.rest.pipeline.glm - package edu.asu.zoophy.rest.pipeline.glm

edu.asu.zoophy.rest.pipeline.utils - package edu.asu.zoophy.rest.pipeline.utils

edu.asu.zoophy.rest.security - package edu.asu.zoophy.rest.security

error(HttpServletRequest) - Method in class edu.asu.zoophy.rest.ZooPhyErrorController

Supports other formats like JSON, XML

A B C D E F G H I J K L M N P Q R S T V W X Z

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Letter

Next Letter

Frames

No Frames

All Classes


text:
package edu.buffalo.cse.pigout.partitioner;

import edu.buffalo.cse.pigout.tools.PigOutUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.pig.impl.PigContext;
import org.apache.pig.impl.io.FileSpec;
import org.apache.pig.impl.logicalLayer.FrontendException;
import org.apache.pig.newplan.DependencyOrderWalker;
import org.apache.pig.newplan.Operator;
import org.apache.pig.newplan.OperatorPlan;
import org.apache.pig.newplan.PlanWalker;
import org.apache.pig.newplan.logical.expression.LogicalExpression;
import org.apache.pig.newplan.logical.expression.LogicalExpressionPlan;
import org.apache.pig.newplan.logical.expression.UserFuncExpression;
import org.apache.pig.newplan.logical.relational.*;
import org.apache.pig.newplan.logical.relational.LogicalSchema.LogicalFieldSchema;

import java.util.List;

public class DataTransferCostEstimator extends LogicalPlanCostEstimator {

	protected final Log LOG = LogFactory.getLog(getClass());

    private PigContext context;

	private static final float OP_SCALER_FILTER = (float)0.5;
	private static final float OP_SCALER_DISTINCT = (float)0.25;
	private static final float OP_SCALER_LOAD = (float)0.000001;
    private static final float OP_SCALER_USERFUNC = (float) 0.10;

    private static final float NUMBER_OF_GROUPS = (float) 4.00;

    // For inner plan
    private float initCost = (float) 0.0;
    private boolean isInner = false;
    private OperatorPlan outerPlan = null;
    private LOForEach outerForEach = null;

    // when you get into inner plan
    protected DataTransferCostEstimator(OperatorPlan plan, PlanWalker walker, LOForEach op, float initCost)
        throws FrontendException {
        this(plan, walker);
        this.initCost = initCost;
        this.isInner = true;
        this.outerForEach = op;
        this.outerPlan = op.getPlan();
    }

    public DataTransferCostEstimator(PigContext context, OperatorPlan plan)
            throws FrontendException
    {
        this(plan, new DependencyOrderWalker(plan));
        this.context = context;
    }

	private DataTransferCostEstimator(OperatorPlan plan, PlanWalker walker)
			throws FrontendException {
		super(plan, walker);
	}

	private void updateAlias(LogicalRelationalOperator logRelOp) {
		String newAlias;
		List<Operator> preds = logRelOp.getPlan().getPredecessors(logRelOp);
		if (preds == null) {
			/* If the predecessor is null, set a unique alias */
			newAlias =  logRelOp.hashCode() + "null_pigout";
		} else {
			newAlias = ((LogicalRelationalOperator)preds.get(0)).getAlias() + "_pigout";
		}
		logRelOp.setAlias(newAlias);
	}

	private boolean updateCostTable(Operator op, Float cost) {
		this.costTable.put(op, cost);
		LogicalRelationalOperator logRelOp = (LogicalRelationalOperator)op;
		if (logRelOp.getAlias() == null) {
		    updateAlias(logRelOp);
		}
		LOG.debug(logRelOp.getAlias() + " = " + logRelOp.getName() + " => " + cost);
		    return false;
	}

	public void visit(LOStore store) throws FrontendException {
		Float costEstimate = getPredCost(store);
		this.updateCostTable(store, costEstimate);
	}

	public void visit(LOLoad load) throws FrontendException {
		FileSpec fs = load.getFileSpec();
		String namenode = getNameNode(fs);

		long size;
        size = PigOutUtils.getHDFSFileSize(fs.getFileName(), namenode);
		float costEstimate = OP_SCALER_LOAD * size;
		this.updateCostTable(load, costEstimate);
	}

	public void visit(LOFilter op) throws FrontendException {
		float costEstimate = OP_SCALER_FILTER * getPredCost(op);
        this.updateCostTable(op, costEstimate);
	}

	public void visit(LOJoin op) throws FrontendException {
		float costEstimate = getPredCost(op);
        this.updateCostTable(op, costEstimate);
	}

	public void visit(LOForEach op) throws FrontendException {
        float costEstimate;
        LogicalPlan innerPlan = op.getInnerPlan();
        DataTransferCostEstimator estimator;
        estimator = new DataTransferCostEstimator(innerPlan, new DependencyOrderWalker(innerPlan), op, getPredCost(op));
        estimator.visit();
        costEstimate = estimator.getCostTable().get(innerPlan.getSinks().get(0));
        this.updateCostTable(op, costEstimate);
	}

	public void visit(LOGenerate op) throws FrontendException {
		float total_pred_cost = 0;
		int total_pred_fields;
        boolean isUserFunc = false;

		LogicalPlan lp = (LogicalPlan) op.getPlan();
		List<Operator> preds = lp.getPredecessors(op);

        List<LogicalExpressionPlan> outExprPlans = op.getOutputPlans();
        for (LogicalExpressionPlan exprPlan : outExprPlans) {
            List<Operator> exprPlanSources = exprPlan.getSources();
            for (Operator exprSrc : exprPlanSources) {
                if (exprSrc instanceof UserFuncExpression) {
                    isUserFunc = true;
                }
            }
        }

		if (!preds.isEmpty()) {
			for (Operator pred : preds) {
				if (pred instanceof LogicalRelationalOperator) {
					LogicalRelationalOperator predLO = (LogicalRelationalOperator) pred;
					total_pred_cost += costTable.get(predLO);
				}
			}
		} else {
            LOG.error("Invalid logical plan: no predecessors for LOGenerate.");
			throw new FrontendException();
		}

        List<LogicalFieldSchema> result_fields = op.getSchema().getFields();
        float generate_weight = 1;
        /*
         * If generate has 'group' in output, we estimate that the number of rows
         * reduce by a factor of the number of groups, which is arbitrarily defined as 4
         */

        for (LogicalFieldSchema field : result_fields) {
            if (field.toString().startsWith("group")) {
                generate_weight = (float) 1.0 / NUMBER_OF_GROUPS;
                break;
            }
        }

        Operator outerPred = this.outerPlan.getPredecessors(this.outerForEach).get(0);
        try {
            total_pred_fields = ((LogicalRelationalOperator)outerPred).getSchema().size();
        } catch (NullPointerException npe) {
            if (((LogicalRelationalOperator) outerPred) instanceof LOLoad) {
                LOLoad loadOp = (LOLoad) outerPred;
                if (loadOp.getFileSpec().getFileName().endsWith("widerow"))
                    total_pred_fields = 500;
                else
                    throw npe;
            } else
                throw npe;
        }

		float cost = total_pred_cost * generate_weight * ( (float) 1 / total_pred_fields);

        if (isUserFunc)
            cost = cost * OP_SCALER_USERFUNC;

        this.updateCostTable(op, cost);
	}

    public void visit(LOInnerLoad op) throws FrontendException {
		float costEstimate;
        if (this.initCost != 0.0)
            costEstimate = this.initCost;
        else
            costEstimate = getPredCost(op);

        this.updateCostTable(op, costEstimate);
	}

	public void visit(LOCube op) throws FrontendException {
		float costEstimate = getPredCost(op);
        this.updateCostTable(op, costEstimate);
	}

	public void visit(LOCogroup op) throws FrontendException {
		float costEstimate = getPredCost(op);
        this.updateCostTable(op, costEstimate);
	}

	public void visit(LOSplit op) throws FrontendException {
		float costEstimate = getPredCost(op);
        this.updateCostTable(op, costEstimate);
	}

	public void visit(LOSplitOutput op) throws FrontendException {
		int no_of_splits = op.getSchema().getFields().size();
		float costEstimate = getPredCost(op) / no_of_splits;
        this.updateCostTable(op, costEstimate);
	}

	public void visit(LOSort op) throws FrontendException {
		float costEstimate = getPredCost(op);
        this.updateCostTable(op, costEstimate);
	}

	public void visit(LORank op) throws FrontendException {
		float costEstimate = getPredCost(op);
        this.updateCostTable(op, costEstimate);
	}

	public void visit(LODistinct op) throws FrontendException {
		float costEstimate = OP_SCALER_DISTINCT * getPredCost(op);
        this.updateCostTable(op, costEstimate);
	}

	public void visit(LOLimit op) throws FrontendException {
		float costEstimate = getPredCost(op);
        this.updateCostTable(op, costEstimate);
	}

	public void visit(LOCross op) throws FrontendException {
		LogicalPlan lp = (LogicalPlan) op.getPlan();
		float pred_cost_product = 1;
		List<Operator> preds = lp.getPredecessors(op);
		if (!preds.isEmpty()) {
			for (Operator pred : preds) {
				pred_cost_product *= costTable.get(pred);
			}
		}
        this.updateCostTable(op, pred_cost_product);
	}

	public void visit(LOUnion op) throws FrontendException {
		LogicalPlan lp = (LogicalPlan) op.getPlan();
		float pred_cost_union = 0;
		List<Operator> preds = lp.getPredecessors(op);
		/*
		List<Operator> succs = lp.getSuccessors(op);
		if (!succs.isEmpty()) {
			for (Operator succ : succs) {
				System.out.println("succ = " + succ);
			}
		}
		*/
		if ( !preds.isEmpty() ) {
			for (Operator pred : preds) {
				LOG.debug("LOUnion's Pred = " + pred);
				float pred_val = costTable.get(pred);
				pred_cost_union += pred_val;
			}
		}
        this.updateCostTable(op, pred_cost_union);
	}
}


text:
export function twoDigits (value) {
    if(value.toString().length <= 1) {
        return "0"+value.toString();
    }

    return value.toString();
}


text:
package org.jabref.gui;

import java.util.Optional;

import org.jabref.logic.preferences.TimestampPreferences;
import org.jabref.model.database.BibDatabase;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.field.StandardField;
import org.jabref.model.entry.field.UnknownField;
import org.jabref.preferences.PreferencesService;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

class UpdateTimestampListenerTest {

    private BibDatabase database;
    private BibEntry bibEntry;

    private PreferencesService preferencesMock;
    private TimestampPreferences timestampPreferencesMock;

    private final String baseDate = "2000-1-1";
    private final String newDate = "2000-1-2";

    @BeforeEach
    void setUp() {
        database = new BibDatabase();
        bibEntry = new BibEntry();

        database.insertEntry(bibEntry);

        preferencesMock = mock(PreferencesService.class);
        timestampPreferencesMock = mock(TimestampPreferences.class);

        when(preferencesMock.getTimestampPreferences()).thenReturn(timestampPreferencesMock);
    }

    @Test
    void updateTimestampEnabled() {
        final boolean includeTimestamp = true;

        when(timestampPreferencesMock.now()).thenReturn(newDate);
        when(timestampPreferencesMock.shouldAddModificationDate()).thenReturn(includeTimestamp);

        bibEntry.setField(StandardField.MODIFICATIONDATE, baseDate);

        assertEquals(Optional.of(baseDate), bibEntry.getField(StandardField.MODIFICATIONDATE), "Initial timestamp not set correctly");

        database.registerListener(new UpdateTimestampListener(preferencesMock));

        bibEntry.setField(new UnknownField("test"), "some value");

        assertEquals(Optional.of(newDate), bibEntry.getField(StandardField.MODIFICATIONDATE), "Timestamp not set correctly after entry changed");
    }

    @Test
    void updateTimestampDisabled() {
        final boolean includeTimestamp = false;

        when(timestampPreferencesMock.now()).thenReturn(newDate);
        when(timestampPreferencesMock.shouldAddModificationDate()).thenReturn(includeTimestamp);

        bibEntry.setField(StandardField.MODIFICATIONDATE, baseDate);

        assertEquals(Optional.of(baseDate), bibEntry.getField(StandardField.MODIFICATIONDATE), "Initial timestamp not set correctly");

        database.registerListener(new UpdateTimestampListener(preferencesMock));

        bibEntry.setField(new UnknownField("test"), "some value");

        assertEquals(Optional.of(baseDate), bibEntry.getField(StandardField.MODIFICATIONDATE), "New timestamp set after entry changed even though updates were disabled");
    }
}


text:
package gp

import (
	"../protocol"
)

type AppMultiplexer struct{}

// MakeGPNetwork register app to OS GP router and start handle income GP packets.
func (appMux *AppMultiplexer) Init() (err protocol.Error) {
	protocol.App.LogInfo("GP network begin listening...")
	return
}

func (appMux *AppMultiplexer) HeaderID() protocol.NetworkLinkNextHeaderID {
	return protocol.NetworkLinkNextHeaderGP
}

// Receive handle GP packet with any application protocol and response just some basic data!
// Protocol Standard : https://github.com/GeniusesGroup/RFCs/blob/master/Giti-Network.md
func (appMux *AppMultiplexer) Receive(linkConn protocol.NetworkLinkConnection, packet []byte) {
	var err protocol.Error
	var gpAddr [16]byte = GetSourceAddr(packet)
	// Find Connection from ConnectionPoolByPeerAdd by requester GP
	var conn protocol.Connection = protocol.App.GetConnectionByPeerAddr(gpAddr)
	// If it is first time that user want to connect or longer than server GC old unused connections!
	if conn == nil {
		// conn, err = MakeNewConnectionByPeerAdd(gpAddr, linkConn)
		if err != nil {
			// Send response or just ignore packet
			// TODO::: DDOS!!??
			return
		}
		protocol.App.RegisterConnection(conn)
	}
	conn.(*Connection).Receive(packet)
	return
}

// Shutdown the listener when the application closes or force to closes by not recovered panic!
func (appMux *AppMultiplexer) Shutdown() {
	// first closing open listener for income packet and refuse all new packet,
	// then closing all idle connections,
	// and then waiting indefinitely for connections to return to idle
	// and then shut down
}


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

namespace LearningSystem.App.ViewModels
{
    public class ExerciseViewModel
    {
        public int ExerciseId { get; set; }

        public string Name { get; set; }

        public string Description { get; set; }

        public bool IsCompleted { get; set; }

        public bool IsAvailable { get; set; }
    }
}


text:
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Windows.Forms;
using FileSystem;

namespace ListPlayers.Common
{
    public static class Settings
    {
        private const string configFileName = "listplayers.ini";
        public const int LastPathesCapacity = 5;
        private static readonly List<string> recentDatabases = new List<string>(LastPathesCapacity + 1);
        private static readonly List<string> recentSources = new List<string>(LastPathesCapacity + 1);
        public static bool SearchSubfolders = true;
        public static bool ShowAllRelatedData = false;
        public static bool NamePattern = false;
        public static bool IpPattern = false;

        public static string[] RecentDatabases
        {
            get { return recentDatabases.ToArray(); }
        }

        public static string[] RecentSources
        {
            get { return recentSources.ToArray(); }
        }

        public static void Load() { Load(configFileName); }

        public static void Save() { Save(configFileName); }

        private static void Load(string path)
        {
            if (!File.Exists(path))
            {
                Save(path);
                return;
            }
            IniFile cfg;
            try
            {
                cfg = new IniFile(path, Encoding.Default);
            }
            catch (Exception e)
            {
                MsgBox.Error(String.Format("Can't read file: {0}\n\n{1}", Path.GetFullPath(path), e.Message));
                return;
            }
            if (cfg.ContainsSection("global"))
            {
                cfg.TryGetBool("global", "search_subfolders", ref SearchSubfolders);
                cfg.TryGetBool("global", "show_all_related_data", ref ShowAllRelatedData);
                cfg.TryGetBool("global", "names_pattern", ref NamePattern);
                cfg.TryGetBool("global", "ips_pattern", ref IpPattern);
            }
            if (cfg.ContainsSection("last_databases"))
            {
                for (var i = 0; i < LastPathesCapacity; i++)
                {
                    string buf = null;
                    if (!cfg.TryGetString("last_databases", i.ToString(), ref buf))
                        break;
                    recentDatabases.Insert(0, buf);
                }
            }
            if (cfg.ContainsSection("last_sources"))
            {
                for (var i = 0; i < LastPathesCapacity; i++)
                {
                    string buf = null;
                    if (!cfg.TryGetString("last_sources", i.ToString(), ref buf))
                        break;
                    recentSources.Insert(0, buf);
                }
            }
        }

        private static void Save(string path)
        {
            try
            {
                using (var writer = new StreamWriter(path, false, Encoding.Default))
                {
                    writer.WriteLine("[global]");
                    writer.WriteLine("search_subfolders     =   {0}", Utils.BoolToString(SearchSubfolders));
                    writer.WriteLine("show_all_related_data =   {0}", Utils.BoolToString(ShowAllRelatedData));
                    writer.WriteLine("names_pattern         =   {0}", Utils.BoolToString(NamePattern));
                    writer.WriteLine("ips_pattern           =   {0}", Utils.BoolToString(IpPattern));
                    writer.WriteLine("\r\n[last_databases]");
                    var tmp = recentDatabases;
                    for (var i = tmp.Count - 1; i >= 0; i--)
                        writer.WriteLine((tmp.Count - i - 1) + " = " + tmp[i]);
                    writer.WriteLine("\r\n[last_sources]");
                    tmp = recentSources;
                    for (var i = tmp.Count - 1; i >= 0; i--)
                        writer.WriteLine((tmp.Count - i - 1) + " = " + tmp[i]);
                }
            }
            catch (Exception e)
            {
                MsgBox.Error(String.Format("Can't write file: {0}\n\n{1}", Path.GetFullPath(path), e.Message));
            }
        }

        public static bool SetLastDatabase(string path)
        {
            if (recentDatabases.Contains(path))
                return false;
            if (recentDatabases.Count >= LastPathesCapacity)
                recentDatabases.RemoveAt(recentDatabases.Count - 1);
            recentDatabases.Insert(0, path);
            return true;
        }

        public static bool SetLastSource(string path)
        {
            if (recentSources.Contains(path))
                return false;
            if (recentSources.Count >= LastPathesCapacity)
                recentSources.RemoveAt(recentSources.Count - 1);
            recentSources.Insert(0, path);
            return true;
        }
    }
}


text:
class FileInput < Formtastic::Inputs::FileInput
  def to_html
    input_wrapping do
      label_html <<
      builder.file_field(method, input_html_options) <<
      image_preview_content <<
      size_hint_html
    end
  end

  private

    def image_preview_content
      image_preview? ? image_preview_html : template.content_tag(:img, nil, class: "image-preview")
    end

    def image_preview?
      options[:image_preview] and @object.send(method).present?
    end

    def image_preview_html
      if @object.errors
        template.image_tag(nil, class: 'image-preview')
      else
        template.image_tag(@object.send(method).url, class: "image-preview")
      end
    end

    def size_hint?
      options[:size_hint]
    end

    def size_hint_text
      t = @object.send(method).options[:styles]
      my_text = ''
      t.each_with_index do |k, i|
        unless i == 0
          my_text += ' / '
        end
        my_text += "#{k[0].to_s.capitalize}: #{k[1].gsub('#', '').gsub('>', '')} "
      end
      my_text
    end

    def size_hint_html
      if size_hint?
        template.content_tag(:p, I18n.t('activeadmin.activeadmin_file_input_on_steroids.size_hint_text'), class: 'size-hint-text inline-hints') +
        template.content_tag(:p, size_hint_text, class: 'size-hint-text inline-hints')
      else
        nil
      end
    end
end


text:
<!DOCTYPE html>

	<meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="keywords" content="orientation, academic, career, guide, focus, mentor, counsellor, personality, tips.">
    <meta name="description" content="Academic Career Orientation.">
    <meta name="robots" content="index,follow">
    <meta name="author" content="Oryac">
    <link rel="icon" type="image/png" href="img/favicon2.png">

	<title>ORYAC | About Us...</title>
	<link href="style.css" rel="stylesheet">
	<link rel="stylesheet" type="text/css" href="css/ionicons-2.0.1/css/ionicons.css">
	<link rel="stylesheet" type="text/css" href="css/ionicons-2.0.1/css/ionicons.min.css">
	<link href="css/agency.css" rel="stylesheet">
	<link rel="stylesheet" href="css/bootstrap.min.css">
  	<link rel="stylesheet" href="css/bootstrap.css">

	<?php include('navbar2.php'); ?>

				About Us

		<?php require_once('displayif.php'); ?>

						Oryac is a leading technology education solution provider in Africa. We use cutting edge technologies to reach out to secondary and high school students and provide them with access to academic and career orientation services.

						Vision: A world full of passion driven students and working population.

						Mission: Provide the best Academic and Career orientation services to help students identify their true academic and career passion.

	<?php include('footer.php'); ?>


text:
package org.apache.sling.scripting.sightly.impl.engine.compiled;

import org.apache.sling.api.resource.Resource;
import org.apache.sling.scripting.sightly.impl.engine.SightlyEngineConfiguration;
import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

public class SourceIdentifierTest {

    private static final String BUNDLE_SYMBOLIC_NAME = "org.apache.sling.scripting.sightly";

    @Test
    public void testGetClassName() throws Exception {
        SourceIdentifier sourceIdentifier = getSourceIdentifier("/apps/blah/static/foo/foo.html");
        assertEquals("foo_html", sourceIdentifier.getSimpleClassName());
    }

    @Test
    public void testGetPackageName() throws Exception {
        SourceIdentifier sourceIdentifier = getSourceIdentifier("/apps/blah/static/foo/foo.html");
        assertEquals(BUNDLE_SYMBOLIC_NAME + ".apps.blah.static_.foo", sourceIdentifier.getPackageName());
    }

    @Test
    public void testGetFullyQualifiedName() throws Exception {
        SourceIdentifier sourceIdentifier = getSourceIdentifier("/apps/blah/static/foo/foo.html");
        assertEquals(BUNDLE_SYMBOLIC_NAME + ".apps.blah.static_.foo.foo_html", sourceIdentifier.getPackageName() + "." +
                sourceIdentifier.getSimpleClassName());
    }

    @Test
    public void testGetScriptName() {
        assertEquals("/apps/my-project/static-test/foo.html", SourceIdentifier.getScriptName(BUNDLE_SYMBOLIC_NAME, BUNDLE_SYMBOLIC_NAME +
                ".apps.my__002d__project.static__002d__test.foo_html"));
    }

    private SourceIdentifier getSourceIdentifier(String path) {
        Resource resource = mock(Resource.class);
        when(resource.getPath()).thenReturn(path);
        SightlyEngineConfiguration configuration = mock(SightlyEngineConfiguration.class);
        when(configuration.getBundleSymbolicName()).thenReturn(BUNDLE_SYMBOLIC_NAME);
        return new SourceIdentifier(configuration, resource.getPath());
    }
}


text:
{% load i18n wagtailcore_tags %}

{% for classifier in page.index_classifiers.all %}

{{classifier.name}}

        {% trans "All" %}

    {% for term in classifier.terms.all %}

        {{term.name}}

    {% endfor %}

{% endfor %}